xref: /OK3568_Linux_fs/buildroot/docs/manual/adding-packages-generic.txt (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun// -*- mode:doc; -*-
2*4882a593Smuzhiyun// vim: set syntax=asciidoc:
3*4882a593Smuzhiyun
4*4882a593Smuzhiyun=== Infrastructure for packages with specific build systems
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunBy 'packages with specific build systems' we mean all the packages
7*4882a593Smuzhiyunwhose build system is not one of the standard ones, such as
8*4882a593Smuzhiyun'autotools' or 'CMake'. This typically includes packages whose build
9*4882a593Smuzhiyunsystem is based on hand-written Makefiles or shell scripts.
10*4882a593Smuzhiyun
11*4882a593Smuzhiyun[[generic-package-tutorial]]
12*4882a593Smuzhiyun
13*4882a593Smuzhiyun==== +generic-package+ tutorial
14*4882a593Smuzhiyun
15*4882a593Smuzhiyun------------------------------
16*4882a593Smuzhiyun01: ################################################################################
17*4882a593Smuzhiyun02: #
18*4882a593Smuzhiyun03: # libfoo
19*4882a593Smuzhiyun04: #
20*4882a593Smuzhiyun05: ################################################################################
21*4882a593Smuzhiyun06:
22*4882a593Smuzhiyun07: LIBFOO_VERSION = 1.0
23*4882a593Smuzhiyun08: LIBFOO_SOURCE = libfoo-$(LIBFOO_VERSION).tar.gz
24*4882a593Smuzhiyun09: LIBFOO_SITE = http://www.foosoftware.org/download
25*4882a593Smuzhiyun10: LIBFOO_LICENSE = GPL-3.0+
26*4882a593Smuzhiyun11: LIBFOO_LICENSE_FILES = COPYING
27*4882a593Smuzhiyun12: LIBFOO_INSTALL_STAGING = YES
28*4882a593Smuzhiyun13: LIBFOO_CONFIG_SCRIPTS = libfoo-config
29*4882a593Smuzhiyun14: LIBFOO_DEPENDENCIES = host-libaaa libbbb
30*4882a593Smuzhiyun15:
31*4882a593Smuzhiyun16: define LIBFOO_BUILD_CMDS
32*4882a593Smuzhiyun17:	$(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) all
33*4882a593Smuzhiyun18: endef
34*4882a593Smuzhiyun19:
35*4882a593Smuzhiyun20: define LIBFOO_INSTALL_STAGING_CMDS
36*4882a593Smuzhiyun21:	$(INSTALL) -D -m 0755 $(@D)/libfoo.a $(STAGING_DIR)/usr/lib/libfoo.a
37*4882a593Smuzhiyun22:	$(INSTALL) -D -m 0644 $(@D)/foo.h $(STAGING_DIR)/usr/include/foo.h
38*4882a593Smuzhiyun23:	$(INSTALL) -D -m 0755 $(@D)/libfoo.so* $(STAGING_DIR)/usr/lib
39*4882a593Smuzhiyun24: endef
40*4882a593Smuzhiyun25:
41*4882a593Smuzhiyun26: define LIBFOO_INSTALL_TARGET_CMDS
42*4882a593Smuzhiyun27:	$(INSTALL) -D -m 0755 $(@D)/libfoo.so* $(TARGET_DIR)/usr/lib
43*4882a593Smuzhiyun28:	$(INSTALL) -d -m 0755 $(TARGET_DIR)/etc/foo.d
44*4882a593Smuzhiyun29: endef
45*4882a593Smuzhiyun30:
46*4882a593Smuzhiyun31: define LIBFOO_USERS
47*4882a593Smuzhiyun32:	foo -1 libfoo -1 * - - - LibFoo daemon
48*4882a593Smuzhiyun33: endef
49*4882a593Smuzhiyun34:
50*4882a593Smuzhiyun35: define LIBFOO_DEVICES
51*4882a593Smuzhiyun36:	/dev/foo c 666 0 0 42 0 - - -
52*4882a593Smuzhiyun37: endef
53*4882a593Smuzhiyun38:
54*4882a593Smuzhiyun39: define LIBFOO_PERMISSIONS
55*4882a593Smuzhiyun40:	/bin/foo f 4755 foo libfoo - - - - -
56*4882a593Smuzhiyun41: endef
57*4882a593Smuzhiyun42:
58*4882a593Smuzhiyun43: $(eval $(generic-package))
59*4882a593Smuzhiyun--------------------------------
60*4882a593Smuzhiyun
61*4882a593SmuzhiyunThe Makefile begins on line 7 to 11 with metadata information: the
62*4882a593Smuzhiyunversion of the package (+LIBFOO_VERSION+), the name of the
63*4882a593Smuzhiyuntarball containing the package (+LIBFOO_SOURCE+) (xz-ed tarball recommended)
64*4882a593Smuzhiyunthe Internet location at which the tarball can be downloaded from
65*4882a593Smuzhiyun(+LIBFOO_SITE+), the license (+LIBFOO_LICENSE+) and file with the
66*4882a593Smuzhiyunlicense text (+LIBFOO_LICENSE_FILES+). All variables must start with
67*4882a593Smuzhiyunthe same prefix, +LIBFOO_+ in this case. This prefix is always the
68*4882a593Smuzhiyunuppercased version of the package name (see below to understand where
69*4882a593Smuzhiyunthe package name is defined).
70*4882a593Smuzhiyun
71*4882a593SmuzhiyunOn line 12, we specify that this package wants to install something to
72*4882a593Smuzhiyunthe staging space. This is often needed for libraries, since they must
73*4882a593Smuzhiyuninstall header files and other development files in the staging space.
74*4882a593SmuzhiyunThis will ensure that the commands listed in the
75*4882a593Smuzhiyun+LIBFOO_INSTALL_STAGING_CMDS+ variable will be executed.
76*4882a593Smuzhiyun
77*4882a593SmuzhiyunOn line 13, we specify that there is some fixing to be done to some
78*4882a593Smuzhiyunof the 'libfoo-config' files that were installed during
79*4882a593Smuzhiyun+LIBFOO_INSTALL_STAGING_CMDS+ phase.
80*4882a593SmuzhiyunThese *-config files are executable shell script files that are
81*4882a593Smuzhiyunlocated in '$(STAGING_DIR)/usr/bin' directory and are executed
82*4882a593Smuzhiyunby other 3rd party packages to find out the location and the linking
83*4882a593Smuzhiyunflags of this particular package.
84*4882a593Smuzhiyun
85*4882a593SmuzhiyunThe problem is that all these *-config files by default give wrong,
86*4882a593Smuzhiyunhost system linking flags that are unsuitable for cross-compiling.
87*4882a593Smuzhiyun
88*4882a593SmuzhiyunFor example:	'-I/usr/include' instead of '-I$(STAGING_DIR)/usr/include'
89*4882a593Smuzhiyunor:		'-L/usr/lib' instead of '-L$(STAGING_DIR)/usr/lib'
90*4882a593Smuzhiyun
91*4882a593SmuzhiyunSo some sed magic is done to these scripts to make them give correct
92*4882a593Smuzhiyunflags.
93*4882a593SmuzhiyunThe argument to be given to +LIBFOO_CONFIG_SCRIPTS+ is the file name(s)
94*4882a593Smuzhiyunof the shell script(s) needing fixing. All these names are relative to
95*4882a593Smuzhiyun'$(STAGING_DIR)/usr/bin' and if needed multiple names can be given.
96*4882a593Smuzhiyun
97*4882a593SmuzhiyunIn addition, the scripts listed in +LIBFOO_CONFIG_SCRIPTS+ are removed
98*4882a593Smuzhiyunfrom +$(TARGET_DIR)/usr/bin+, since they are not needed on the target.
99*4882a593Smuzhiyun
100*4882a593Smuzhiyun.Config script: 'divine' package
101*4882a593Smuzhiyun================================
102*4882a593SmuzhiyunPackage divine installs shell script '$(STAGING_DIR)/usr/bin/divine-config'.
103*4882a593Smuzhiyun
104*4882a593SmuzhiyunSo its fixup would be:
105*4882a593Smuzhiyun
106*4882a593Smuzhiyun--------------------------------
107*4882a593SmuzhiyunDIVINE_CONFIG_SCRIPTS = divine-config
108*4882a593Smuzhiyun--------------------------------
109*4882a593Smuzhiyun================================
110*4882a593Smuzhiyun
111*4882a593Smuzhiyun.Config script: 'imagemagick' package:
112*4882a593Smuzhiyun================================
113*4882a593SmuzhiyunPackage imagemagick installs the following scripts:
114*4882a593Smuzhiyun'$(STAGING_DIR)/usr/bin/{Magick,Magick++,MagickCore,MagickWand,Wand}-config'
115*4882a593Smuzhiyun
116*4882a593SmuzhiyunSo it's fixup would be:
117*4882a593Smuzhiyun
118*4882a593Smuzhiyun--------------------------------
119*4882a593SmuzhiyunIMAGEMAGICK_CONFIG_SCRIPTS = \
120*4882a593Smuzhiyun   Magick-config Magick++-config \
121*4882a593Smuzhiyun   MagickCore-config MagickWand-config Wand-config
122*4882a593Smuzhiyun--------------------------------
123*4882a593Smuzhiyun================================
124*4882a593Smuzhiyun
125*4882a593SmuzhiyunOn line 14, we specify the list of dependencies this package relies
126*4882a593Smuzhiyunon. These dependencies are listed in terms of lower-case package names,
127*4882a593Smuzhiyunwhich can be packages for the target (without the +host-+
128*4882a593Smuzhiyunprefix) or packages for the host (with the +host-+) prefix).
129*4882a593SmuzhiyunBuildroot will ensure that all these packages are built and installed
130*4882a593Smuzhiyun'before' the current package starts its configuration.
131*4882a593Smuzhiyun
132*4882a593SmuzhiyunThe rest of the Makefile, lines 16..29, defines what should be done
133*4882a593Smuzhiyunat the different steps of the package configuration, compilation and
134*4882a593Smuzhiyuninstallation.
135*4882a593Smuzhiyun+LIBFOO_BUILD_CMDS+ tells what steps should be performed to
136*4882a593Smuzhiyunbuild the package. +LIBFOO_INSTALL_STAGING_CMDS+ tells what
137*4882a593Smuzhiyunsteps should be performed to install the package in the staging space.
138*4882a593Smuzhiyun+LIBFOO_INSTALL_TARGET_CMDS+ tells what steps should be
139*4882a593Smuzhiyunperformed to install the package in the target space.
140*4882a593Smuzhiyun
141*4882a593SmuzhiyunAll these steps rely on the +$(@D)+ variable, which
142*4882a593Smuzhiyuncontains the directory where the source code of the package has been
143*4882a593Smuzhiyunextracted.
144*4882a593Smuzhiyun
145*4882a593SmuzhiyunOn lines 31..33, we define a user that is used by this package (e.g.
146*4882a593Smuzhiyunto run a daemon as non-root) (+LIBFOO_USERS+).
147*4882a593Smuzhiyun
148*4882a593SmuzhiyunOn line 35..37, we define a device-node file used by this package
149*4882a593Smuzhiyun(+LIBFOO_DEVICES+).
150*4882a593Smuzhiyun
151*4882a593SmuzhiyunOn line 39..41, we define the permissions to set to specific files
152*4882a593Smuzhiyuninstalled by this package (+LIBFOO_PERMISSIONS+).
153*4882a593Smuzhiyun
154*4882a593SmuzhiyunFinally, on line 43, we call the +generic-package+ function, which
155*4882a593Smuzhiyungenerates, according to the variables defined previously, all the
156*4882a593SmuzhiyunMakefile code necessary to make your package working.
157*4882a593Smuzhiyun
158*4882a593Smuzhiyun[[generic-package-reference]]
159*4882a593Smuzhiyun
160*4882a593Smuzhiyun==== +generic-package+ reference
161*4882a593Smuzhiyun
162*4882a593SmuzhiyunThere are two variants of the generic target. The +generic-package+ macro is
163*4882a593Smuzhiyunused for packages to be cross-compiled for the target. The
164*4882a593Smuzhiyun+host-generic-package+ macro is used for host packages, natively compiled
165*4882a593Smuzhiyunfor the host. It is possible to call both of them in a single +.mk+
166*4882a593Smuzhiyunfile: once to create the rules to generate a target
167*4882a593Smuzhiyunpackage and once to create the rules to generate a host package:
168*4882a593Smuzhiyun
169*4882a593Smuzhiyun----------------------
170*4882a593Smuzhiyun$(eval $(generic-package))
171*4882a593Smuzhiyun$(eval $(host-generic-package))
172*4882a593Smuzhiyun----------------------
173*4882a593Smuzhiyun
174*4882a593SmuzhiyunThis might be useful if the compilation of the target package requires
175*4882a593Smuzhiyunsome tools to be installed on the host. If the package name is
176*4882a593Smuzhiyun+libfoo+, then the name of the package for the target is also
177*4882a593Smuzhiyun+libfoo+, while the name of the package for the host is
178*4882a593Smuzhiyun+host-libfoo+. These names should be used in the DEPENDENCIES
179*4882a593Smuzhiyunvariables of other packages, if they depend on +libfoo+ or
180*4882a593Smuzhiyun+host-libfoo+.
181*4882a593Smuzhiyun
182*4882a593SmuzhiyunThe call to the +generic-package+ and/or +host-generic-package+ macro
183*4882a593Smuzhiyun*must* be at the end of the +.mk+ file, after all variable definitions.
184*4882a593SmuzhiyunThe call to +host-generic-package+ *must* be after the call to
185*4882a593Smuzhiyun+generic-package+, if any.
186*4882a593Smuzhiyun
187*4882a593SmuzhiyunFor the target package, the +generic-package+ uses the variables defined by
188*4882a593Smuzhiyunthe .mk file and prefixed by the uppercased package name:
189*4882a593Smuzhiyun+LIBFOO_*+. +host-generic-package+ uses the +HOST_LIBFOO_*+ variables. For
190*4882a593Smuzhiyun'some' variables, if the +HOST_LIBFOO_+ prefixed variable doesn't
191*4882a593Smuzhiyunexist, the package infrastructure uses the corresponding variable
192*4882a593Smuzhiyunprefixed by +LIBFOO_+. This is done for variables that are likely to
193*4882a593Smuzhiyunhave the same value for both the target and host packages. See below
194*4882a593Smuzhiyunfor details.
195*4882a593Smuzhiyun
196*4882a593SmuzhiyunThe list of variables that can be set in a +.mk+ file to give metadata
197*4882a593Smuzhiyuninformation is (assuming the package name is +libfoo+) :
198*4882a593Smuzhiyun
199*4882a593Smuzhiyun* +LIBFOO_VERSION+, mandatory, must contain the version of the
200*4882a593Smuzhiyun  package. Note that if +HOST_LIBFOO_VERSION+ doesn't exist, it is
201*4882a593Smuzhiyun  assumed to be the same as +LIBFOO_VERSION+. It can also be a
202*4882a593Smuzhiyun  revision number or a tag for packages that are fetched directly
203*4882a593Smuzhiyun  from their version control system. Examples:
204*4882a593Smuzhiyun  ** a version for a release tarball: +LIBFOO_VERSION = 0.1.2+
205*4882a593Smuzhiyun  ** a sha1 for a git tree: +LIBFOO_VERSION = cb9d6aa9429e838f0e54faa3d455bcbab5eef057+
206*4882a593Smuzhiyun  ** a tag for a git tree +LIBFOO_VERSION = v0.1.2+
207*4882a593Smuzhiyun+
208*4882a593Smuzhiyun.Note:
209*4882a593SmuzhiyunUsing a branch name as +FOO_VERSION+ is not supported, because it does
210*4882a593Smuzhiyunnot and can not work as people would expect it should:
211*4882a593Smuzhiyun+
212*4882a593Smuzhiyun  1. due to local caching, Buildroot will not re-fetch the repository,
213*4882a593Smuzhiyun     so people who expect to be able to follow the remote repository
214*4882a593Smuzhiyun     would be quite surprised and disappointed;
215*4882a593Smuzhiyun  2. because two builds can never be perfectly simultaneous, and because
216*4882a593Smuzhiyun     the remote repository may get new commits on the branch anytime,
217*4882a593Smuzhiyun     two users, using the same Buildroot tree and building the same
218*4882a593Smuzhiyun     configuration, may get different source, thus rendering the build
219*4882a593Smuzhiyun     non reproducible, and people would be quite surprised and
220*4882a593Smuzhiyun     disappointed.
221*4882a593Smuzhiyun
222*4882a593Smuzhiyun* +LIBFOO_SOURCE+ may contain the name of the tarball of the package,
223*4882a593Smuzhiyun  which Buildroot will use to download the tarball from
224*4882a593Smuzhiyun  +LIBFOO_SITE+. If +HOST_LIBFOO_SOURCE+ is not specified, it defaults
225*4882a593Smuzhiyun  to +LIBFOO_SOURCE+. If none are specified, then the value is assumed
226*4882a593Smuzhiyun  to be +libfoo-$(LIBFOO_VERSION).tar.gz+. +
227*4882a593Smuzhiyun  Example: +LIBFOO_SOURCE = foobar-$(LIBFOO_VERSION).tar.bz2+
228*4882a593Smuzhiyun
229*4882a593Smuzhiyun* +LIBFOO_PATCH+ may contain a space-separated list of patch file
230*4882a593Smuzhiyun  names, that Buildroot will download and apply to the package source
231*4882a593Smuzhiyun  code. If an entry contains +://+, then Buildroot will assume it is a
232*4882a593Smuzhiyun  full URL and download the patch from this location. Otherwise,
233*4882a593Smuzhiyun  Buildroot will assume that the patch should be downloaded from
234*4882a593Smuzhiyun  +LIBFOO_SITE+. If +HOST_LIBFOO_PATCH+ is not specified, it defaults
235*4882a593Smuzhiyun  to +LIBFOO_PATCH+. Note that patches that are included in Buildroot
236*4882a593Smuzhiyun  itself use a different mechanism: all files of the form
237*4882a593Smuzhiyun  +*.patch+ present in the package directory inside
238*4882a593Smuzhiyun  Buildroot will be applied to the package after extraction (see
239*4882a593Smuzhiyun  xref:patch-policy[patching a package]). Finally, patches listed in
240*4882a593Smuzhiyun  the +LIBFOO_PATCH+ variable are applied _before_ the patches stored
241*4882a593Smuzhiyun  in the Buildroot package directory.
242*4882a593Smuzhiyun
243*4882a593Smuzhiyun* +LIBFOO_SITE+ provides the location of the package, which can be a
244*4882a593Smuzhiyun  URL or a local filesystem path. HTTP, FTP and SCP are supported URL
245*4882a593Smuzhiyun  types for retrieving package tarballs. In these cases don't include a
246*4882a593Smuzhiyun  trailing slash: it will be added by Buildroot between the directory
247*4882a593Smuzhiyun  and the filename as appropriate. Git, Subversion, Mercurial,
248*4882a593Smuzhiyun  and Bazaar are supported URL types for retrieving packages directly
249*4882a593Smuzhiyun  from source code management systems. There is a helper function to make
250*4882a593Smuzhiyun  it easier to download source tarballs from GitHub (refer to
251*4882a593Smuzhiyun  xref:github-download-url[] for details). A filesystem path may be used
252*4882a593Smuzhiyun  to specify either a tarball or a directory containing the package
253*4882a593Smuzhiyun  source code. See +LIBFOO_SITE_METHOD+ below for more details on how
254*4882a593Smuzhiyun  retrieval works. +
255*4882a593Smuzhiyun  Note that SCP URLs should be of the form
256*4882a593Smuzhiyun  +scp://[user@]host:filepath+, and that filepath is relative to the
257*4882a593Smuzhiyun  user's home directory, so you may want to prepend the path with a
258*4882a593Smuzhiyun  slash for absolute paths:
259*4882a593Smuzhiyun  +scp://[user@]host:/absolutepath+. +
260*4882a593Smuzhiyun  If +HOST_LIBFOO_SITE+ is not specified, it defaults to
261*4882a593Smuzhiyun  +LIBFOO_SITE+.
262*4882a593Smuzhiyun  Examples: +
263*4882a593Smuzhiyun    +LIBFOO_SITE=http://www.libfoosoftware.org/libfoo+ +
264*4882a593Smuzhiyun    +LIBFOO_SITE=http://svn.xiph.org/trunk/Tremor+ +
265*4882a593Smuzhiyun    +LIBFOO_SITE=/opt/software/libfoo.tar.gz+ +
266*4882a593Smuzhiyun    +LIBFOO_SITE=$(TOPDIR)/../src/libfoo+
267*4882a593Smuzhiyun
268*4882a593Smuzhiyun* +LIBFOO_DL_OPTS+ is a space-separated list of additional options to
269*4882a593Smuzhiyun  pass to the downloader. Useful for retrieving documents with
270*4882a593Smuzhiyun  server-side checking for user logins and passwords, or to use a proxy.
271*4882a593Smuzhiyun  All download methods valid for +LIBFOO_SITE_METHOD+ are supported;
272*4882a593Smuzhiyun  valid options depend on the download method (consult the man page
273*4882a593Smuzhiyun  for the respective download utilities).
274*4882a593Smuzhiyun
275*4882a593Smuzhiyun* +LIBFOO_EXTRA_DOWNLOADS+ is a space-separated list of additional
276*4882a593Smuzhiyun  files that Buildroot should download. If an entry contains +://+
277*4882a593Smuzhiyun  then Buildroot will assume it is a complete URL and will download
278*4882a593Smuzhiyun  the file using this URL. Otherwise, Buildroot will assume the file
279*4882a593Smuzhiyun  to be downloaded is located at +LIBFOO_SITE+. Buildroot will not do
280*4882a593Smuzhiyun  anything with those additional files, except download them: it will
281*4882a593Smuzhiyun  be up to the package recipe to use them from +$(LIBFOO_DL_DIR)+.
282*4882a593Smuzhiyun
283*4882a593Smuzhiyun* +LIBFOO_SITE_METHOD+ determines the method used to fetch or copy the
284*4882a593Smuzhiyun  package source code. In many cases, Buildroot guesses the method
285*4882a593Smuzhiyun  from the contents of +LIBFOO_SITE+ and setting +LIBFOO_SITE_METHOD+
286*4882a593Smuzhiyun  is unnecessary. When +HOST_LIBFOO_SITE_METHOD+ is not specified, it
287*4882a593Smuzhiyun  defaults to the value of +LIBFOO_SITE_METHOD+. +
288*4882a593Smuzhiyun  The possible values of +LIBFOO_SITE_METHOD+ are:
289*4882a593Smuzhiyun  ** +wget+ for normal FTP/HTTP downloads of tarballs. Used by
290*4882a593Smuzhiyun     default when +LIBFOO_SITE+ begins with +http://+, +https://+ or
291*4882a593Smuzhiyun     +ftp://+.
292*4882a593Smuzhiyun  ** +scp+ for downloads of tarballs over SSH with scp. Used by
293*4882a593Smuzhiyun     default when +LIBFOO_SITE+ begins with +scp://+.
294*4882a593Smuzhiyun  ** +svn+ for retrieving source code from a Subversion repository.
295*4882a593Smuzhiyun     Used by default when +LIBFOO_SITE+ begins with +svn://+. When a
296*4882a593Smuzhiyun     +http://+ Subversion repository URL is specified in
297*4882a593Smuzhiyun     +LIBFOO_SITE+, one 'must' specify +LIBFOO_SITE_METHOD=svn+.
298*4882a593Smuzhiyun     Buildroot performs a checkout which is preserved as a tarball in
299*4882a593Smuzhiyun     the download cache; subsequent builds use the tarball instead of
300*4882a593Smuzhiyun     performing another checkout.
301*4882a593Smuzhiyun  ** +cvs+ for retrieving source code from a CVS repository.
302*4882a593Smuzhiyun     Used by default when +LIBFOO_SITE+ begins with +cvs://+.
303*4882a593Smuzhiyun     The downloaded source code is cached as with the +svn+ method.
304*4882a593Smuzhiyun     Anonymous pserver mode is assumed otherwise explicitly defined
305*4882a593Smuzhiyun     on +LIBFOO_SITE+. Both
306*4882a593Smuzhiyun     +LIBFOO_SITE=cvs://libfoo.net:/cvsroot/libfoo+ and
307*4882a593Smuzhiyun     +LIBFOO_SITE=cvs://:ext:libfoo.net:/cvsroot/libfoo+
308*4882a593Smuzhiyun     are accepted, on the former anonymous pserver access mode is
309*4882a593Smuzhiyun     assumed.
310*4882a593Smuzhiyun     +LIBFOO_SITE+ 'must' contain the source URL as well as the remote
311*4882a593Smuzhiyun     repository directory. The module is the package name.
312*4882a593Smuzhiyun     +LIBFOO_VERSION+ is 'mandatory' and 'must' be a tag, a branch, or
313*4882a593Smuzhiyun     a date (e.g. "2014-10-20", "2014-10-20 13:45", "2014-10-20
314*4882a593Smuzhiyun     13:45+01" see "man cvs" for further details).
315*4882a593Smuzhiyun  ** +git+ for retrieving source code from a Git repository. Used by
316*4882a593Smuzhiyun     default when +LIBFOO_SITE+ begins with +git://+. The downloaded
317*4882a593Smuzhiyun     source code is cached as with the +svn+
318*4882a593Smuzhiyun     method.
319*4882a593Smuzhiyun  ** +hg+ for retrieving source code from a Mercurial repository. One
320*4882a593Smuzhiyun     'must' specify +LIBFOO_SITE_METHOD=hg+ when +LIBFOO_SITE+
321*4882a593Smuzhiyun     contains a Mercurial repository URL. The downloaded source code
322*4882a593Smuzhiyun     is cached as with the +svn+ method.
323*4882a593Smuzhiyun  ** +bzr+ for retrieving source code from a Bazaar repository. Used
324*4882a593Smuzhiyun     by default when +LIBFOO_SITE+ begins with +bzr://+. The
325*4882a593Smuzhiyun     downloaded source code is cached as with the +svn+ method.
326*4882a593Smuzhiyun  ** +file+ for a local tarball. One should use this when
327*4882a593Smuzhiyun     +LIBFOO_SITE+ specifies a package tarball as a local filename.
328*4882a593Smuzhiyun     Useful for software that isn't available publicly or in version
329*4882a593Smuzhiyun     control.
330*4882a593Smuzhiyun  ** +local+ for a local source code directory. One should use this
331*4882a593Smuzhiyun     when +LIBFOO_SITE+ specifies a local directory path containing
332*4882a593Smuzhiyun     the package source code. Buildroot copies the contents of the
333*4882a593Smuzhiyun     source directory into the package's build directory. Note that
334*4882a593Smuzhiyun     for +local+ packages, no patches are applied. If you need to
335*4882a593Smuzhiyun     still patch the source code, use +LIBFOO_POST_RSYNC_HOOKS+, see
336*4882a593Smuzhiyun     xref:hooks-rsync[].
337*4882a593Smuzhiyun
338*4882a593Smuzhiyun* +LIBFOO_GIT_SUBMODULES+ can be set to +YES+ to create an archive
339*4882a593Smuzhiyun  with the git submodules in the repository.  This is only available
340*4882a593Smuzhiyun  for packages downloaded with git (i.e. when
341*4882a593Smuzhiyun  +LIBFOO_SITE_METHOD=git+).  Note that we try not to use such git
342*4882a593Smuzhiyun  submodules when they contain bundled libraries, in which case we
343*4882a593Smuzhiyun  prefer to use those libraries from their own package.
344*4882a593Smuzhiyun
345*4882a593Smuzhiyun* +LIBFOO_STRIP_COMPONENTS+ is the number of leading components
346*4882a593Smuzhiyun  (directories) that tar must strip from file names on extraction.
347*4882a593Smuzhiyun  The tarball for most packages has one leading component named
348*4882a593Smuzhiyun  "<pkg-name>-<pkg-version>", thus Buildroot passes
349*4882a593Smuzhiyun  --strip-components=1 to tar to remove it.
350*4882a593Smuzhiyun  For non-standard packages that don't have this component, or
351*4882a593Smuzhiyun  that have more than one leading component to strip, set this
352*4882a593Smuzhiyun  variable with the value to be passed to tar. Default: 1.
353*4882a593Smuzhiyun
354*4882a593Smuzhiyun* +LIBFOO_EXCLUDES+ is a space-separated list of patterns to exclude
355*4882a593Smuzhiyun  when extracting the archive. Each item from that list is passed as
356*4882a593Smuzhiyun  a tar's +--exclude+ option. By default, empty.
357*4882a593Smuzhiyun
358*4882a593Smuzhiyun* +LIBFOO_DEPENDENCIES+ lists the dependencies (in terms of package
359*4882a593Smuzhiyun  name) that are required for the current target package to
360*4882a593Smuzhiyun  compile. These dependencies are guaranteed to be compiled and
361*4882a593Smuzhiyun  installed before the configuration of the current package starts.
362*4882a593Smuzhiyun  However, modifications to configuration of these dependencies will
363*4882a593Smuzhiyun  not force a rebuild of the current package. In a similar way,
364*4882a593Smuzhiyun  +HOST_LIBFOO_DEPENDENCIES+ lists the dependencies for the current
365*4882a593Smuzhiyun  host package.
366*4882a593Smuzhiyun
367*4882a593Smuzhiyun* +LIBFOO_EXTRACT_DEPENDENCIES+ lists the dependencies (in terms of
368*4882a593Smuzhiyun  package name) that are required for the current target package to be
369*4882a593Smuzhiyun  extracted. These dependencies are guaranteed to be compiled and
370*4882a593Smuzhiyun  installed before the extract step of the current package
371*4882a593Smuzhiyun  starts. This is only used internally by the package infrastructure,
372*4882a593Smuzhiyun  and should typically not be used directly by packages.
373*4882a593Smuzhiyun
374*4882a593Smuzhiyun* +LIBFOO_PATCH_DEPENDENCIES+ lists the dependencies (in terms of
375*4882a593Smuzhiyun  package name) that are required for the current package to be
376*4882a593Smuzhiyun  patched. These dependencies are guaranteed to be extracted and
377*4882a593Smuzhiyun  patched (but not necessarily built) before the current package is
378*4882a593Smuzhiyun  patched. In a similar way, +HOST_LIBFOO_PATCH_DEPENDENCIES+ lists
379*4882a593Smuzhiyun  the dependencies for the current host package.
380*4882a593Smuzhiyun  This is seldom used; usually, +LIBFOO_DEPENDENCIES+ is what you
381*4882a593Smuzhiyun  really want to use.
382*4882a593Smuzhiyun
383*4882a593Smuzhiyun* +LIBFOO_PROVIDES+ lists all the virtual packages +libfoo+ is an
384*4882a593Smuzhiyun  implementation of. See xref:virtual-package-tutorial[].
385*4882a593Smuzhiyun
386*4882a593Smuzhiyun* +LIBFOO_INSTALL_STAGING+ can be set to +YES+ or +NO+ (default). If
387*4882a593Smuzhiyun  set to +YES+, then the commands in the +LIBFOO_INSTALL_STAGING_CMDS+
388*4882a593Smuzhiyun  variables are executed to install the package into the staging
389*4882a593Smuzhiyun  directory.
390*4882a593Smuzhiyun
391*4882a593Smuzhiyun* +LIBFOO_INSTALL_TARGET+ can be set to +YES+ (default) or +NO+. If
392*4882a593Smuzhiyun  set to +YES+, then the commands in the +LIBFOO_INSTALL_TARGET_CMDS+
393*4882a593Smuzhiyun  variables are executed to install the package into the target
394*4882a593Smuzhiyun  directory.
395*4882a593Smuzhiyun
396*4882a593Smuzhiyun* +LIBFOO_INSTALL_IMAGES+ can be set to +YES+ or +NO+ (default). If
397*4882a593Smuzhiyun  set to +YES+, then the commands in the +LIBFOO_INSTALL_IMAGES_CMDS+
398*4882a593Smuzhiyun  variable are executed to install the package into the images
399*4882a593Smuzhiyun  directory.
400*4882a593Smuzhiyun
401*4882a593Smuzhiyun* +LIBFOO_CONFIG_SCRIPTS+ lists the names of the files in
402*4882a593Smuzhiyun  '$(STAGING_DIR)/usr/bin' that need some special fixing to make them
403*4882a593Smuzhiyun  cross-compiling friendly. Multiple file names separated by space can
404*4882a593Smuzhiyun  be given and all are relative to '$(STAGING_DIR)/usr/bin'. The files
405*4882a593Smuzhiyun  listed in +LIBFOO_CONFIG_SCRIPTS+ are also removed from
406*4882a593Smuzhiyun  +$(TARGET_DIR)/usr/bin+ since they are not needed on the target.
407*4882a593Smuzhiyun
408*4882a593Smuzhiyun* +LIBFOO_DEVICES+ lists the device files to be created by Buildroot
409*4882a593Smuzhiyun  when using the static device table. The syntax to use is the
410*4882a593Smuzhiyun  makedevs one. You can find some documentation for this syntax in the
411*4882a593Smuzhiyun  xref:makedev-syntax[]. This variable is optional.
412*4882a593Smuzhiyun
413*4882a593Smuzhiyun* +LIBFOO_PERMISSIONS+ lists the changes of permissions to be done at
414*4882a593Smuzhiyun  the end of the build process. The syntax is once again the makedevs one.
415*4882a593Smuzhiyun  You can find some documentation for this syntax in the xref:makedev-syntax[].
416*4882a593Smuzhiyun  This variable is optional.
417*4882a593Smuzhiyun
418*4882a593Smuzhiyun* +LIBFOO_USERS+ lists the users to create for this package, if it installs
419*4882a593Smuzhiyun  a program you want to run as a specific user (e.g. as a daemon, or as a
420*4882a593Smuzhiyun  cron-job). The syntax is similar in spirit to the makedevs one, and is
421*4882a593Smuzhiyun  described in the xref:makeuser-syntax[]. This variable is optional.
422*4882a593Smuzhiyun
423*4882a593Smuzhiyun* +LIBFOO_LICENSE+ defines the license (or licenses) under which the package
424*4882a593Smuzhiyun  is released.
425*4882a593Smuzhiyun  This name will appear in the manifest file produced by +make legal-info+.
426*4882a593Smuzhiyun  If the license appears in https://spdx.org/licenses/[the SPDX License List],
427*4882a593Smuzhiyun  use the SPDX short identifier to make the manifest file uniform.
428*4882a593Smuzhiyun  Otherwise, describe the license in a precise and concise way, avoiding
429*4882a593Smuzhiyun  ambiguous names such as +BSD+ which actually name a family of licenses.
430*4882a593Smuzhiyun  This variable is optional. If it is not defined, +unknown+ will appear in
431*4882a593Smuzhiyun  the +license+ field of the manifest file for this package. +
432*4882a593Smuzhiyun  The expected format for this variable must comply with the following rules:
433*4882a593Smuzhiyun  ** If different parts of the package are released under different
434*4882a593Smuzhiyun     licenses, then +comma+ separate licenses (e.g. +`LIBFOO_LICENSE =
435*4882a593Smuzhiyun     GPL-2.0+, LGPL-2.1+`+). If there is clear distinction between which
436*4882a593Smuzhiyun     component is licensed under what license, then annotate the license
437*4882a593Smuzhiyun     with that component, between parenthesis (e.g. +`LIBFOO_LICENSE =
438*4882a593Smuzhiyun     GPL-2.0+ (programs), LGPL-2.1+ (libraries)`+).
439*4882a593Smuzhiyun  ** If some licenses are conditioned on a sub-option being enabled, append
440*4882a593Smuzhiyun     the conditional licenses with a comma (e.g.: `FOO_LICENSE += , GPL-2.0+
441*4882a593Smuzhiyun     (programs)`); the infrastructure will internally remove the space before
442*4882a593Smuzhiyun     the comma.
443*4882a593Smuzhiyun  ** If the package is dual licensed, then separate licenses with the
444*4882a593Smuzhiyun     +or+ keyword (e.g. +`LIBFOO_LICENSE = AFL-2.1 or GPL-2.0+`+).
445*4882a593Smuzhiyun
446*4882a593Smuzhiyun* +LIBFOO_LICENSE_FILES+ is a space-separated list of files in the package
447*4882a593Smuzhiyun  tarball that contain the license(s) under which the package is released.
448*4882a593Smuzhiyun  +make legal-info+ copies all of these files in the +legal-info+ directory.
449*4882a593Smuzhiyun  See xref:legal-info[] for more information.
450*4882a593Smuzhiyun  This variable is optional. If it is not defined, a warning will be produced
451*4882a593Smuzhiyun  to let you know, and +not saved+ will appear in the +license files+ field
452*4882a593Smuzhiyun  of the manifest file for this package.
453*4882a593Smuzhiyun
454*4882a593Smuzhiyun* +LIBFOO_ACTUAL_SOURCE_TARBALL+ only applies to packages whose
455*4882a593Smuzhiyun  +LIBFOO_SITE+ / +LIBFOO_SOURCE+ pair points to an archive that does
456*4882a593Smuzhiyun  not actually contain source code, but binary code. This a very
457*4882a593Smuzhiyun  uncommon case, only known to apply to external toolchains which come
458*4882a593Smuzhiyun  already compiled, although theoretically it might apply to other
459*4882a593Smuzhiyun  packages. In such cases a separate tarball is usually available with
460*4882a593Smuzhiyun  the actual source code. Set +LIBFOO_ACTUAL_SOURCE_TARBALL+ to the
461*4882a593Smuzhiyun  name of the actual source code archive and Buildroot will download
462*4882a593Smuzhiyun  it and use it when you run +make legal-info+ to collect
463*4882a593Smuzhiyun  legally-relevant material.  Note this file will not be downloaded
464*4882a593Smuzhiyun  during regular builds nor by +make source+.
465*4882a593Smuzhiyun
466*4882a593Smuzhiyun* +LIBFOO_ACTUAL_SOURCE_SITE+ provides the location of the actual
467*4882a593Smuzhiyun  source tarball. The default value is +LIBFOO_SITE+, so you don't
468*4882a593Smuzhiyun  need to set this variable if the binary and source archives are
469*4882a593Smuzhiyun  hosted on the same directory.  If +LIBFOO_ACTUAL_SOURCE_TARBALL+ is
470*4882a593Smuzhiyun  not set, it doesn't make sense to define
471*4882a593Smuzhiyun  +LIBFOO_ACTUAL_SOURCE_SITE+.
472*4882a593Smuzhiyun
473*4882a593Smuzhiyun* +LIBFOO_REDISTRIBUTE+ can be set to +YES+ (default) or +NO+ to indicate if
474*4882a593Smuzhiyun  the package source code is allowed to be redistributed. Set it to +NO+ for
475*4882a593Smuzhiyun  non-opensource packages: Buildroot will not save the source code for this
476*4882a593Smuzhiyun  package when collecting the +legal-info+.
477*4882a593Smuzhiyun
478*4882a593Smuzhiyun* +LIBFOO_FLAT_STACKSIZE+ defines the stack size of an application built into
479*4882a593Smuzhiyun  the FLAT binary format. The application stack size on the NOMMU architecture
480*4882a593Smuzhiyun  processors can't be enlarged at run time. The default stack size for the
481*4882a593Smuzhiyun  FLAT binary format is only 4k bytes. If the application consumes more stack,
482*4882a593Smuzhiyun  append the required number here.
483*4882a593Smuzhiyun
484*4882a593Smuzhiyun* +LIBFOO_BIN_ARCH_EXCLUDE+ is a space-separated list of paths (relative
485*4882a593Smuzhiyun  to the target directory) to ignore when checking that the package
486*4882a593Smuzhiyun  installs correctly cross-compiled binaries. You seldom need to set this
487*4882a593Smuzhiyun  variable, unless the package installs binary blobs outside the default
488*4882a593Smuzhiyun  locations, `/lib/firmware`, `/usr/lib/firmware`, `/lib/modules`,
489*4882a593Smuzhiyun  `/usr/lib/modules`, and `/usr/share`, which are automatically excluded.
490*4882a593Smuzhiyun
491*4882a593Smuzhiyun* +LIBFOO_IGNORE_CVES+ is a space-separated list of CVEs that tells
492*4882a593Smuzhiyun  Buildroot CVE tracking tools which CVEs should be ignored for this
493*4882a593Smuzhiyun  package. This is typically used when the CVE is fixed by a patch in
494*4882a593Smuzhiyun  the package, or when the CVE for some reason does not affect the
495*4882a593Smuzhiyun  Buildroot package. A Makefile comment must always precede the
496*4882a593Smuzhiyun  addition of a CVE to this variable. Example:
497*4882a593Smuzhiyun
498*4882a593Smuzhiyun----------------------
499*4882a593Smuzhiyun# 0001-fix-cve-2020-12345.patch
500*4882a593SmuzhiyunLIBFOO_IGNORE_CVES += CVE-2020-12345
501*4882a593Smuzhiyun# only when built with libbaz, which Buildroot doesn't support
502*4882a593SmuzhiyunLIBFOO_IGNORE_CVES += CVE-2020-54321
503*4882a593Smuzhiyun----------------------
504*4882a593Smuzhiyun
505*4882a593Smuzhiyun* +LIBFOO_CPE_ID_*+ variables is a set of variables that allows the
506*4882a593Smuzhiyun  package to define its https://nvd.nist.gov/products/cpe[CPE
507*4882a593Smuzhiyun  identifier]. The available variables are:
508*4882a593Smuzhiyun+
509*4882a593Smuzhiyun--
510*4882a593Smuzhiyun** +LIBFOO_CPE_ID_PREFIX+, specifies the prefix of the CPE identifier,
511*4882a593Smuzhiyun   i.e the first three fields. When not defined, the default value is
512*4882a593Smuzhiyun   +cpe:2.3:a+.
513*4882a593Smuzhiyun
514*4882a593Smuzhiyun** +LIBFOO_CPE_ID_VENDOR+, specifies the vendor part of the CPE
515*4882a593Smuzhiyun   identifier. When not defined, the default value is
516*4882a593Smuzhiyun   +<pkgname>_project+.
517*4882a593Smuzhiyun
518*4882a593Smuzhiyun** +LIBFOO_CPE_ID_PRODUCT+, specifies the product part of the CPE
519*4882a593Smuzhiyun   identifier. When not defined, the default value is +<pkgname>+.
520*4882a593Smuzhiyun
521*4882a593Smuzhiyun** +LIBFOO_CPE_ID_VERSION+, specifies the version part of the CPE
522*4882a593Smuzhiyun   identifier. When not defined the default value is
523*4882a593Smuzhiyun   +$(LIBFOO_VERSION)+.
524*4882a593Smuzhiyun
525*4882a593Smuzhiyun** +LIBFOO_CPE_ID_UPDATE+ specifies the _update_ part of the CPE
526*4882a593Smuzhiyun   identifier. When not defined the default value is +*+.
527*4882a593Smuzhiyun--
528*4882a593Smuzhiyun+
529*4882a593SmuzhiyunIf any of those variables is defined, then the generic package
530*4882a593Smuzhiyuninfrastructure assumes the package provides valid CPE information. In
531*4882a593Smuzhiyunthis case, the generic package infrastructure will define
532*4882a593Smuzhiyun+LIBFOO_CPE_ID+.
533*4882a593Smuzhiyun+
534*4882a593SmuzhiyunFor a host package, if its +LIBFOO_CPE_ID_*+ variables are not
535*4882a593Smuzhiyundefined, it inherits the value of those variables from the
536*4882a593Smuzhiyuncorresponding target package.
537*4882a593Smuzhiyun
538*4882a593SmuzhiyunThe recommended way to define these variables is to use the following
539*4882a593Smuzhiyunsyntax:
540*4882a593Smuzhiyun
541*4882a593Smuzhiyun----------------------
542*4882a593SmuzhiyunLIBFOO_VERSION = 2.32
543*4882a593Smuzhiyun----------------------
544*4882a593Smuzhiyun
545*4882a593SmuzhiyunNow, the variables that define what should be performed at the
546*4882a593Smuzhiyundifferent steps of the build process.
547*4882a593Smuzhiyun
548*4882a593Smuzhiyun* +LIBFOO_EXTRACT_CMDS+ lists the actions to be performed to extract
549*4882a593Smuzhiyun  the package. This is generally not needed as tarballs are
550*4882a593Smuzhiyun  automatically handled by Buildroot. However, if the package uses a
551*4882a593Smuzhiyun  non-standard archive format, such as a ZIP or RAR file, or has a
552*4882a593Smuzhiyun  tarball with a non-standard organization, this variable allows to
553*4882a593Smuzhiyun  override the package infrastructure default behavior.
554*4882a593Smuzhiyun
555*4882a593Smuzhiyun* +LIBFOO_CONFIGURE_CMDS+ lists the actions to be performed to
556*4882a593Smuzhiyun  configure the package before its compilation.
557*4882a593Smuzhiyun
558*4882a593Smuzhiyun* +LIBFOO_BUILD_CMDS+ lists the actions to be performed to
559*4882a593Smuzhiyun  compile the package.
560*4882a593Smuzhiyun
561*4882a593Smuzhiyun* +HOST_LIBFOO_INSTALL_CMDS+ lists the actions to be performed
562*4882a593Smuzhiyun  to install the package, when the package is a host package. The
563*4882a593Smuzhiyun  package must install its files to the directory given by
564*4882a593Smuzhiyun  +$(HOST_DIR)+. All files, including development files such as
565*4882a593Smuzhiyun  headers should be installed, since other packages might be compiled
566*4882a593Smuzhiyun  on top of this package.
567*4882a593Smuzhiyun
568*4882a593Smuzhiyun* +LIBFOO_INSTALL_TARGET_CMDS+ lists the actions to be
569*4882a593Smuzhiyun  performed to install the package to the target directory, when the
570*4882a593Smuzhiyun  package is a target package. The package must install its files to
571*4882a593Smuzhiyun  the directory given by +$(TARGET_DIR)+. Only the files required for
572*4882a593Smuzhiyun  'execution' of the package have to be
573*4882a593Smuzhiyun  installed. Header files, static libraries and documentation will be
574*4882a593Smuzhiyun  removed again when the target filesystem is finalized.
575*4882a593Smuzhiyun
576*4882a593Smuzhiyun* +LIBFOO_INSTALL_STAGING_CMDS+ lists the actions to be
577*4882a593Smuzhiyun  performed to install the package to the staging directory, when the
578*4882a593Smuzhiyun  package is a target package. The package must install its files to
579*4882a593Smuzhiyun  the directory given by +$(STAGING_DIR)+. All development files
580*4882a593Smuzhiyun  should be installed, since they might be needed to compile other
581*4882a593Smuzhiyun  packages.
582*4882a593Smuzhiyun
583*4882a593Smuzhiyun* +LIBFOO_INSTALL_IMAGES_CMDS+ lists the actions to be performed to
584*4882a593Smuzhiyun  install the package to the images directory, when the package is a
585*4882a593Smuzhiyun  target package. The package must install its files to the directory
586*4882a593Smuzhiyun  given by +$(BINARIES_DIR)+. Only files that are binary images (aka
587*4882a593Smuzhiyun  images) that do not belong in the +TARGET_DIR+ but are necessary
588*4882a593Smuzhiyun  for booting the board should be placed here. For example, a package
589*4882a593Smuzhiyun  should utilize this step if it has binaries which would be similar
590*4882a593Smuzhiyun  to the kernel image, bootloader or root filesystem images.
591*4882a593Smuzhiyun
592*4882a593Smuzhiyun* +LIBFOO_INSTALL_INIT_SYSV+, +LIBFOO_INSTALL_INIT_OPENRC+ and
593*4882a593Smuzhiyun  +LIBFOO_INSTALL_INIT_SYSTEMD+ list the actions to install init
594*4882a593Smuzhiyun  scripts either for the systemV-like init systems (busybox,
595*4882a593Smuzhiyun  sysvinit, etc.), openrc or for the systemd units. These commands
596*4882a593Smuzhiyun  will be run only when the relevant init system is installed (i.e.
597*4882a593Smuzhiyun  if systemd is selected as the init system in the configuration,
598*4882a593Smuzhiyun  only +LIBFOO_INSTALL_INIT_SYSTEMD+ will be run). The only exception
599*4882a593Smuzhiyun  is when openrc is chosen as init system and +LIBFOO_INSTALL_INIT_OPENRC+
600*4882a593Smuzhiyun  has not been set, in such situation +LIBFOO_INSTALL_INIT_SYSV+ will
601*4882a593Smuzhiyun  be called, since openrc supports sysv init scripts.
602*4882a593Smuzhiyun  When systemd is used as the init system, buildroot will automatically enable
603*4882a593Smuzhiyun  all services using the +systemctl preset-all+ command in the final phase of
604*4882a593Smuzhiyun  image building. You can add preset files to prevent a particular unit from
605*4882a593Smuzhiyun  being automatically enabled by buildroot.
606*4882a593Smuzhiyun
607*4882a593Smuzhiyun* +LIBFOO_HELP_CMDS+ lists the actions to print the package help, which
608*4882a593Smuzhiyun  is included to the main +make help+ output. These commands can print
609*4882a593Smuzhiyun  anything in any format.
610*4882a593Smuzhiyun  This is seldom used, as packages rarely have custom rules. *Do not use
611*4882a593Smuzhiyun  this variable*, unless you really know that you need to print help.
612*4882a593Smuzhiyun
613*4882a593Smuzhiyun* +LIBFOO_LINUX_CONFIG_FIXUPS+ lists the Linux kernel configuration
614*4882a593Smuzhiyun  options that are needed to build and use this package, and without
615*4882a593Smuzhiyun  which the package is fundamentally broken. This shall be a set of
616*4882a593Smuzhiyun  calls to one of the kconfig tweaking option: `KCONFIG_ENABLE_OPT`,
617*4882a593Smuzhiyun  `KCONFIG_DISABLE_OPT`, or `KCONFIG_SET_OPT`.
618*4882a593Smuzhiyun  This is seldom used, as package usually have no strict requirements on
619*4882a593Smuzhiyun  the kernel options.
620*4882a593Smuzhiyun
621*4882a593SmuzhiyunThe preferred way to define these variables is:
622*4882a593Smuzhiyun
623*4882a593Smuzhiyun----------------------
624*4882a593Smuzhiyundefine LIBFOO_CONFIGURE_CMDS
625*4882a593Smuzhiyun	action 1
626*4882a593Smuzhiyun	action 2
627*4882a593Smuzhiyun	action 3
628*4882a593Smuzhiyunendef
629*4882a593Smuzhiyun----------------------
630*4882a593Smuzhiyun
631*4882a593SmuzhiyunIn the action definitions, you can use the following variables:
632*4882a593Smuzhiyun
633*4882a593Smuzhiyun* +$(LIBFOO_PKGDIR)+ contains the path to the directory containing the
634*4882a593Smuzhiyun  +libfoo.mk+ and +Config.in+ files. This variable is useful when it is
635*4882a593Smuzhiyun  necessary to install a file bundled in Buildroot, like a runtime
636*4882a593Smuzhiyun  configuration file, a splashscreen image...
637*4882a593Smuzhiyun
638*4882a593Smuzhiyun* +$(@D)+, which contains the directory in which the package source
639*4882a593Smuzhiyun  code has been uncompressed.
640*4882a593Smuzhiyun
641*4882a593Smuzhiyun* +$(LIBFOO_DL_DIR)+ contains the path to the directory where all the downloads
642*4882a593Smuzhiyun  made by Buildroot for +libfoo+ are stored in.
643*4882a593Smuzhiyun
644*4882a593Smuzhiyun* +$(TARGET_CC)+, +$(TARGET_LD)+, etc. to get the target
645*4882a593Smuzhiyun  cross-compilation utilities
646*4882a593Smuzhiyun
647*4882a593Smuzhiyun* +$(TARGET_CROSS)+ to get the cross-compilation toolchain prefix
648*4882a593Smuzhiyun
649*4882a593Smuzhiyun* Of course the +$(HOST_DIR)+, +$(STAGING_DIR)+ and +$(TARGET_DIR)+
650*4882a593Smuzhiyun  variables to install the packages properly. Those variables point to
651*4882a593Smuzhiyun  the global _host_, _staging_ and _target_ directories, unless
652*4882a593Smuzhiyun  _per-package directory_ support is used, in which case they point to
653*4882a593Smuzhiyun  the current package _host_, _staging_ and _target_ directories. In
654*4882a593Smuzhiyun  both cases, it doesn't make any difference from the package point of
655*4882a593Smuzhiyun  view: it should simply use +HOST_DIR+, +STAGING_DIR+ and
656*4882a593Smuzhiyun  +TARGET_DIR+. See xref:top-level-parallel-build[] for more details
657*4882a593Smuzhiyun  about _per-package directory_ support.
658*4882a593Smuzhiyun
659*4882a593SmuzhiyunFinally, you can also use hooks. See xref:hooks[] for more information.
660