4 At the bare minimum, a package in contrib must provide two Makefile
5 targets in src/foo/rules.mak:
6 - .foo to build and install the package, and
7 - .sum-foo to fetch or create a source tarball and verify it,
8 where foo the package name.
14 .sum-foo typically depends on a separate target that fetches the source
15 code. In that case, .sum-foo needs only verify that the tarball
19 $(TARBALLS)/libfoo-$(FOO_VERSION).tar.bz2:
20 $(call download,$(FOO_URL))
22 # This will use the default rule: check SHA-512
23 .sum-foo: libfoo-$(FOO_VERSION).tar.bz2
25 NOTE: contrary to the previous VLC contribs, this system always uses
26 a source tarball, even if the source code is downloaded from a VCS.
27 This serves two purposes:
28 - offline builds (or behind a firewall),
29 - source code requirements compliance.
35 Similarly, .foo typically depends on the source code directory. In this
36 case, care must be taken that the directory name only exists if the
37 source code is fully ready. Otherwise Makefile dependencies will break
38 (this is not an issue for files, only directories).
40 libfoo: libfoo-$(FOO_VERSION).tar.bz2 .sum-foo
41 $(UNPACK) # to libfoo-$(FOO_VERSION)
42 ### apply patches here ###
43 # last command: make the target directory
47 cd $< && $(HOSTVARS) ./configure $(HOSTCONF)
48 cd $< && $(MAKE) install
54 As far as possible, build rules should determine automatically whether
55 a package is useful (for VLC media player) or not. Useful packages
56 should be listed in the PKGS special variable. See some examples:
58 # FFmpeg is always useful
61 # DirectX headers are useful only on Windows
66 # x264 is only useful when stream output is enabled
71 Some packages may be provided by the target system. This is especially
72 common when building natively on Linux or BSD. When this situation is
73 detected, the package name should be added to the PKGS_FOUND special
74 variable. The build system will then skip building this package:
76 # Asks pkg-config if foo version 1.2.3 or later is present:
77 ifeq ($(call need_pkg,'foo >= 1.2.3'),)
81 Note: The need_pkg function always return 1 during cross-compilation.
88 If package bar depends on package foo, the special DEPS_bar variable
89 should be defined as follow:
91 DEPS_bar = foo $(DEPS_foo)
93 Note that dependency resolution is unfortunately _not_ recursive.
94 Therefore $(DEPS_foo) really should be specified explicitly as shown
95 above. (In practice, this will not make any difference insofar as there
96 are no pure second-level nested dependencies. For instance, libass
97 depends on FontConfig, which depends on FreeType, but libass depends
98 directly on FreeType anyway.)
100 Also note that DEPS_bar is set "recursively" with =, rather than
101 "immediately" with :=. This is so that $(DEPS_foo) is expanded
102 correctly, even if DEPS_foo it is defined after DEPS_bar.
106 If you must know, the main.mak build hackery will automatically
107 emit a dependency from .bar onto .dep-foo:
111 ...whereby .dep-foo will depend on .foo:
116 ...unless foo was detected in the target distribution:
121 So you really only need to set DEPS_bar.