forked from cocos2d/cocos2d-x-3rd-party-libs-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
125 lines (89 loc) · 3.57 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
Writing rules
==============
At the bare minimum, a package in contrib must provide two Makefile
targets in src/foo/rules.mak:
- .foo to build and install the package, and
- .sum-foo to fetch or create a source tarball and verify it,
where foo the package name.
Tarball
--------
.sum-foo typically depends on a separate target that fetches the source
code. In that case, .sum-foo needs only verify that the tarball
is correct, e.g.:
$(TARBALLS)/libfoo-$(FOO_VERSION).tar.bz2:
$(call download,$(FOO_URL))
# This will use the default rule: check SHA-512
.sum-foo: libfoo-$(FOO_VERSION).tar.bz2
NOTE: contrary to the previous VLC contribs, this system always uses
a source tarball, even if the source code is downloaded from a VCS.
This serves two purposes:
- offline builds (or behind a firewall),
- source code requirements compliance.
Compilation
------------
Similarly, .foo typically depends on the source code directory. In this
case, care must be taken that the directory name only exists if the
source code is fully ready. Otherwise Makefile dependencies will break
(this is not an issue for files, only directories).
libfoo: libfoo-$(FOO_VERSION).tar.bz2 .sum-foo
$(UNPACK) # to libfoo-$(FOO_VERSION)
### apply patches here ###
# last command: make the target directory
$(MOVE)
.foo: libfoo
cd $< && $(HOSTVARS) ./configure $(HOSTCONF)
cd $< && $(MAKE) install
touch $@
Conditional builds
-------------------
As far as possible, build rules should determine automatically whether
a package is useful (for VLC media player) or not. Useful packages
should be listed in the PKGS special variable. See some examples:
# FFmpeg is always useful
PKGS += ffmpeg
# DirectX headers are useful only on Windows
ifdef HAVE_WIN32
PKGS += directx
endif
# x264 is only useful when stream output is enabled
ifdef BUILD_ENCODERS
PKGS += x264
endif
If a package is a dependency of another package, but it is not a
direct dependency of VLC, then it should NOT be added to PKGS. The
build system will automatically build it via dependencies (see below).
Some packages may be provided by the target system. This is especially
common when building natively on Linux or BSD. When this situation is
detected, the package name should be added to the PKGS_FOUND special
variable. The build system will then skip building this package:
# Asks pkg-config if foo version 1.2.3 or later is present:
ifeq ($(call need_pkg,'foo >= 1.2.3'),)
PKGS_FOUND += foo
endif
Note: The need_pkg function always return 1 during cross-compilation.
This is a known bug.
Dependencies
-------------
If package bar depends on package foo, the special DEPS_bar variable
should be defined as follow:
DEPS_bar = foo $(DEPS_foo)
Note that dependency resolution is unfortunately _not_ recursive.
Therefore $(DEPS_foo) really should be specified explicitly as shown
above. (In practice, this will not make any difference insofar as there
are no pure second-level nested dependencies. For instance, libass
depends on FontConfig, which depends on FreeType, but libass depends
directly on FreeType anyway.)
Also note that DEPS_bar is set "recursively" with =, rather than
"immediately" with :=. This is so that $(DEPS_foo) is expanded
correctly, even if DEPS_foo it is defined after DEPS_bar.
Implementation note:
If you must know, the main.mak build hackery will automatically
emit a dependency from .bar onto .dep-foo:
.bar: .dep-foo
...whereby .dep-foo will depend on .foo:
.dep-foo: .foo
touch $@
...unless foo was detected in the target distribution:
.dep-foo:
touch $@
So you really only need to set DEPS_bar.