2 // vim: set syntax=asciidoc:
4 === Infrastructure for packages with specific build systems
6 By 'packages with specific build systems' we mean all the packages
7 whose build system is not one of the standard ones, such as
8 'autotools' or 'CMake'. This typically includes packages whose build
9 system is based on hand-written Makefiles or shell scripts.
11 [[generic-package-tutorial]]
13 ==== +generic-package+ tutorial
15 ------------------------------
16 01: ################################################################################
20 05: ################################################################################
22 07: LIBFOO_VERSION = 1.0
23 08: LIBFOO_SOURCE = libfoo-$(LIBFOO_VERSION).tar.gz
24 09: LIBFOO_SITE = http://www.foosoftware.org/download
25 10: LIBFOO_LICENSE = GPL-3.0+
26 11: LIBFOO_LICENSE_FILES = COPYING
27 12: LIBFOO_INSTALL_STAGING = YES
28 13: LIBFOO_CONFIG_SCRIPTS = libfoo-config
29 14: LIBFOO_DEPENDENCIES = host-libaaa libbbb
31 16: define LIBFOO_BUILD_CMDS
32 17: $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) all
35 20: define LIBFOO_INSTALL_STAGING_CMDS
36 21: $(INSTALL) -D -m 0755 $(@D)/libfoo.a $(STAGING_DIR)/usr/lib/libfoo.a
37 22: $(INSTALL) -D -m 0644 $(@D)/foo.h $(STAGING_DIR)/usr/include/foo.h
38 23: $(INSTALL) -D -m 0755 $(@D)/libfoo.so* $(STAGING_DIR)/usr/lib
41 26: define LIBFOO_INSTALL_TARGET_CMDS
42 27: $(INSTALL) -D -m 0755 $(@D)/libfoo.so* $(TARGET_DIR)/usr/lib
43 28: $(INSTALL) -d -m 0755 $(TARGET_DIR)/etc/foo.d
46 31: define LIBFOO_USERS
47 32: foo -1 libfoo -1 * - - - LibFoo daemon
50 35: define LIBFOO_DEVICES
51 36: /dev/foo c 666 0 0 42 0 - - -
54 39: define LIBFOO_PERMISSIONS
55 40: /bin/foo f 4755 foo libfoo - - - - -
58 43: $(eval $(generic-package))
59 --------------------------------
61 The Makefile begins on line 7 to 11 with metadata information: the
62 version of the package (+LIBFOO_VERSION+), the name of the
63 tarball containing the package (+LIBFOO_SOURCE+) (xz-ed tarball recommended)
64 the Internet location at which the tarball can be downloaded from
65 (+LIBFOO_SITE+), the license (+LIBFOO_LICENSE+) and file with the
66 license text (+LIBFOO_LICENSE_FILES+). All variables must start with
67 the same prefix, +LIBFOO_+ in this case. This prefix is always the
68 uppercased version of the package name (see below to understand where
69 the package name is defined).
71 On line 12, we specify that this package wants to install something to
72 the staging space. This is often needed for libraries, since they must
73 install header files and other development files in the staging space.
74 This will ensure that the commands listed in the
75 +LIBFOO_INSTALL_STAGING_CMDS+ variable will be executed.
77 On line 13, we specify that there is some fixing to be done to some
78 of the 'libfoo-config' files that were installed during
79 +LIBFOO_INSTALL_STAGING_CMDS+ phase.
80 These *-config files are executable shell script files that are
81 located in '$(STAGING_DIR)/usr/bin' directory and are executed
82 by other 3rd party packages to find out the location and the linking
83 flags of this particular package.
85 The problem is that all these *-config files by default give wrong,
86 host system linking flags that are unsuitable for cross-compiling.
88 For example: '-I/usr/include' instead of '-I$(STAGING_DIR)/usr/include'
89 or: '-L/usr/lib' instead of '-L$(STAGING_DIR)/usr/lib'
91 So some sed magic is done to these scripts to make them give correct
93 The argument to be given to +LIBFOO_CONFIG_SCRIPTS+ is the file name(s)
94 of the shell script(s) needing fixing. All these names are relative to
95 '$(STAGING_DIR)/usr/bin' and if needed multiple names can be given.
97 In addition, the scripts listed in +LIBFOO_CONFIG_SCRIPTS+ are removed
98 from +$(TARGET_DIR)/usr/bin+, since they are not needed on the target.
100 .Config script: 'divine' package
101 ================================
102 Package divine installs shell script '$(STAGING_DIR)/usr/bin/divine-config'.
104 So its fixup would be:
106 --------------------------------
107 DIVINE_CONFIG_SCRIPTS = divine-config
108 --------------------------------
109 ================================
111 .Config script: 'imagemagick' package:
112 ================================
113 Package imagemagick installs the following scripts:
114 '$(STAGING_DIR)/usr/bin/{Magick,Magick++,MagickCore,MagickWand,Wand}-config'
116 So it's fixup would be:
118 --------------------------------
119 IMAGEMAGICK_CONFIG_SCRIPTS = \
120 Magick-config Magick++-config \
121 MagickCore-config MagickWand-config Wand-config
122 --------------------------------
123 ================================
125 On line 14, we specify the list of dependencies this package relies
126 on. These dependencies are listed in terms of lower-case package names,
127 which can be packages for the target (without the +host-+
128 prefix) or packages for the host (with the +host-+) prefix).
129 Buildroot will ensure that all these packages are built and installed
130 'before' the current package starts its configuration.
132 The rest of the Makefile, lines 16..29, defines what should be done
133 at the different steps of the package configuration, compilation and
135 +LIBFOO_BUILD_CMDS+ tells what steps should be performed to
136 build the package. +LIBFOO_INSTALL_STAGING_CMDS+ tells what
137 steps should be performed to install the package in the staging space.
138 +LIBFOO_INSTALL_TARGET_CMDS+ tells what steps should be
139 performed to install the package in the target space.
141 All these steps rely on the +$(@D)+ variable, which
142 contains the directory where the source code of the package has been
145 On lines 31..43, we define a user that is used by this package (e.g.
146 to run a daemon as non-root) (+LIBFOO_USERS+).
148 On line 35..37, we define a device-node file used by this package
151 On line 39..41, we define the permissions to set to specific files
152 installed by this package (+LIBFOO_PERMISSIONS+).
154 Finally, on line 43, we call the +generic-package+ function, which
155 generates, according to the variables defined previously, all the
156 Makefile code necessary to make your package working.
158 [[generic-package-reference]]
160 ==== +generic-package+ reference
162 There are two variants of the generic target. The +generic-package+ macro is
163 used for packages to be cross-compiled for the target. The
164 +host-generic-package+ macro is used for host packages, natively compiled
165 for the host. It is possible to call both of them in a single +.mk+
166 file: once to create the rules to generate a target
167 package and once to create the rules to generate a host package:
169 ----------------------
170 $(eval $(generic-package))
171 $(eval $(host-generic-package))
172 ----------------------
174 This might be useful if the compilation of the target package requires
175 some tools to be installed on the host. If the package name is
176 +libfoo+, then the name of the package for the target is also
177 +libfoo+, while the name of the package for the host is
178 +host-libfoo+. These names should be used in the DEPENDENCIES
179 variables of other packages, if they depend on +libfoo+ or
182 The call to the +generic-package+ and/or +host-generic-package+ macro
183 *must* be at the end of the +.mk+ file, after all variable definitions.
184 The call to +host-generic-package+ *must* be after the call to
185 +generic-package+, if any.
187 For the target package, the +generic-package+ uses the variables defined by
188 the .mk file and prefixed by the uppercased package name:
189 +LIBFOO_*+. +host-generic-package+ uses the +HOST_LIBFOO_*+ variables. For
190 'some' variables, if the +HOST_LIBFOO_+ prefixed variable doesn't
191 exist, the package infrastructure uses the corresponding variable
192 prefixed by +LIBFOO_+. This is done for variables that are likely to
193 have the same value for both the target and host packages. See below
196 The list of variables that can be set in a +.mk+ file to give metadata
197 information is (assuming the package name is +libfoo+) :
199 * +LIBFOO_VERSION+, mandatory, must contain the version of the
200 package. Note that if +HOST_LIBFOO_VERSION+ doesn't exist, it is
201 assumed to be the same as +LIBFOO_VERSION+. It can also be a
202 revision number or a tag for packages that are fetched directly
203 from their version control system. Do not use a branch name as
204 version; it does not work. Examples:
205 ** a version for a release tarball: +LIBFOO_VERSION = 0.1.2+
206 ** a sha1 for a git tree: +LIBFOO_VERSION = cb9d6aa9429e838f0e54faa3d455bcbab5eef057+
207 ** a tag for a git tree +LIBFOO_VERSION = v0.1.2+
209 * +LIBFOO_SOURCE+ may contain the name of the tarball of the package,
210 which Buildroot will use to download the tarball from
211 +LIBFOO_SITE+. If +HOST_LIBFOO_SOURCE+ is not specified, it defaults
212 to +LIBFOO_SOURCE+. If none are specified, then the value is assumed
213 to be +libfoo-$(LIBFOO_VERSION).tar.gz+. +
214 Example: +LIBFOO_SOURCE = foobar-$(LIBFOO_VERSION).tar.bz2+
216 * +LIBFOO_PATCH+ may contain a space-separated list of patch file
217 names, that Buildroot will download and apply to the package source
218 code. If an entry contains +://+, then Buildroot will assume it is a
219 full URL and download the patch from this location. Otherwise,
220 Buildroot will assume that the patch should be downloaded from
221 +LIBFOO_SITE+. If +HOST_LIBFOO_PATCH+ is not specified, it defaults
222 to +LIBFOO_PATCH+. Note that patches that are included in Buildroot
223 itself use a different mechanism: all files of the form
224 +*.patch+ present in the package directory inside
225 Buildroot will be applied to the package after extraction (see
226 xref:patch-policy[patching a package]). Finally, patches listed in
227 the +LIBFOO_PATCH+ variable are applied _before_ the patches stored
228 in the Buildroot package directory.
230 * +LIBFOO_SITE+ provides the location of the package, which can be a
231 URL or a local filesystem path. HTTP, FTP and SCP are supported URL
232 types for retrieving package tarballs. In these cases don't include a
233 trailing slash: it will be added by Buildroot between the directory
234 and the filename as appropriate. Git, Subversion, Mercurial,
235 and Bazaar are supported URL types for retrieving packages directly
236 from source code management systems. There is a helper function to make
237 it easier to download source tarballs from GitHub (refer to
238 xref:github-download-url[] for details). A filesystem path may be used
239 to specify either a tarball or a directory containing the package
240 source code. See +LIBFOO_SITE_METHOD+ below for more details on how
242 Note that SCP URLs should be of the form
243 +scp://[user@]host:filepath+, and that filepath is relative to the
244 user's home directory, so you may want to prepend the path with a
245 slash for absolute paths:
246 +scp://[user@]host:/absolutepath+. +
247 If +HOST_LIBFOO_SITE+ is not specified, it defaults to
250 +LIBFOO_SITE=http://www.libfoosoftware.org/libfoo+ +
251 +LIBFOO_SITE=http://svn.xiph.org/trunk/Tremor+ +
252 +LIBFOO_SITE=/opt/software/libfoo.tar.gz+ +
253 +LIBFOO_SITE=$(TOPDIR)/../src/libfoo+
255 * +LIBFOO_DL_OPTS+ is a space-separated list of additional options to
256 pass to the downloader. Useful for retrieving documents with
257 server-side checking for user logins and passwords, or to use a proxy.
258 All download methods valid for +LIBFOO_SITE_METHOD+ are supported;
259 valid options depend on the download method (consult the man page
260 for the respective download utilities).
262 * +LIBFOO_EXTRA_DOWNLOADS+ is a space-separated list of additional
263 files that Buildroot should download. If an entry contains +://+
264 then Buildroot will assume it is a complete URL and will download
265 the file using this URL. Otherwise, Buildroot will assume the file
266 to be downloaded is located at +LIBFOO_SITE+. Buildroot will not do
267 anything with those additional files, except download them: it will
268 be up to the package recipe to use them from +$(LIBFOO_DL_DIR)+.
270 * +LIBFOO_SITE_METHOD+ determines the method used to fetch or copy the
271 package source code. In many cases, Buildroot guesses the method
272 from the contents of +LIBFOO_SITE+ and setting +LIBFOO_SITE_METHOD+
273 is unnecessary. When +HOST_LIBFOO_SITE_METHOD+ is not specified, it
274 defaults to the value of +LIBFOO_SITE_METHOD+. +
275 The possible values of +LIBFOO_SITE_METHOD+ are:
276 ** +wget+ for normal FTP/HTTP downloads of tarballs. Used by
277 default when +LIBFOO_SITE+ begins with +http://+, +https://+ or
279 ** +scp+ for downloads of tarballs over SSH with scp. Used by
280 default when +LIBFOO_SITE+ begins with +scp://+.
281 ** +svn+ for retrieving source code from a Subversion repository.
282 Used by default when +LIBFOO_SITE+ begins with +svn://+. When a
283 +http://+ Subversion repository URL is specified in
284 +LIBFOO_SITE+, one 'must' specify +LIBFOO_SITE_METHOD=svn+.
285 Buildroot performs a checkout which is preserved as a tarball in
286 the download cache; subsequent builds use the tarball instead of
287 performing another checkout.
288 ** +cvs+ for retrieving source code from a CVS repository.
289 Used by default when +LIBFOO_SITE+ begins with +cvs://+.
290 The downloaded source code is cached as with the +svn+ method.
291 Anonymous pserver mode is assumed otherwise explicitly defined
292 on +LIBFOO_SITE+. Both
293 +LIBFOO_SITE=cvs://libfoo.net:/cvsroot/libfoo+ and
294 +LIBFOO_SITE=cvs://:ext:libfoo.net:/cvsroot/libfoo+
295 are accepted, on the former anonymous pserver access mode is
297 +LIBFOO_SITE+ 'must' contain the source URL as well as the remote
298 repository directory. The module is the package name.
299 +LIBFOO_VERSION+ is 'mandatory' and 'must' be a tag, a branch, or
300 a date (e.g. "2014-10-20", "2014-10-20 13:45", "2014-10-20
301 13:45+01" see "man cvs" for further details).
302 ** +git+ for retrieving source code from a Git repository. Used by
303 default when +LIBFOO_SITE+ begins with +git://+. The downloaded
304 source code is cached as with the +svn+
306 ** +hg+ for retrieving source code from a Mercurial repository. One
307 'must' specify +LIBFOO_SITE_METHOD=hg+ when +LIBFOO_SITE+
308 contains a Mercurial repository URL. The downloaded source code
309 is cached as with the +svn+ method.
310 ** +bzr+ for retrieving source code from a Bazaar repository. Used
311 by default when +LIBFOO_SITE+ begins with +bzr://+. The
312 downloaded source code is cached as with the +svn+ method.
313 ** +file+ for a local tarball. One should use this when
314 +LIBFOO_SITE+ specifies a package tarball as a local filename.
315 Useful for software that isn't available publicly or in version
317 ** +local+ for a local source code directory. One should use this
318 when +LIBFOO_SITE+ specifies a local directory path containing
319 the package source code. Buildroot copies the contents of the
320 source directory into the package's build directory. Note that
321 for +local+ packages, no patches are applied. If you need to
322 still patch the source code, use +LIBFOO_POST_RSYNC_HOOKS+, see
325 * +LIBFOO_GIT_SUBMODULES+ can be set to +YES+ to create an archive
326 with the git submodules in the repository. This is only available
327 for packages downloaded with git (i.e. when
328 +LIBFOO_SITE_METHOD=git+). Note that we try not to use such git
329 submodules when they contain bundled libraries, in which case we
330 prefer to use those libraries from their own package.
332 * +LIBFOO_STRIP_COMPONENTS+ is the number of leading components
333 (directories) that tar must strip from file names on extraction.
334 The tarball for most packages has one leading component named
335 "<pkg-name>-<pkg-version>", thus Buildroot passes
336 --strip-components=1 to tar to remove it.
337 For non-standard packages that don't have this component, or
338 that have more than one leading component to strip, set this
339 variable with the value to be passed to tar. Default: 1.
341 * +LIBFOO_EXCLUDES+ is a space-separated list of patterns to exclude
342 when extracting the archive. Each item from that list is passed as
343 a tar's +--exclude+ option. By default, empty.
345 * +LIBFOO_DEPENDENCIES+ lists the dependencies (in terms of package
346 name) that are required for the current target package to
347 compile. These dependencies are guaranteed to be compiled and
348 installed before the configuration of the current package starts. In
349 a similar way, +HOST_LIBFOO_DEPENDENCIES+ lists the dependencies for
350 the current host package.
352 * +LIBFOO_EXTRACT_DEPENDENCIES+ lists the dependencies (in terms of
353 package name) that are required for the current target package to be
354 extracted. These dependencies are guaranteed to be compiled and
355 installed before the extract step of the current package
356 starts. This is only used internally by the package infrastructure,
357 and should typically not be used directly by packages.
359 * +LIBFOO_PATCH_DEPENDENCIES+ lists the dependencies (in terms of
360 package name) that are required for the current package to be
361 patched. These dependencies are guaranteed to be extracted and
362 patched before the current package is patched. In a similar way,
363 +HOST_LIBFOO_PATCH_DEPENDENCIES+ lists the dependencies for the
364 current host package.
365 This is seldom used; usually, +LIBFOO_DEPENDENCIES+ is what you
368 * +LIBFOO_PROVIDES+ lists all the virtual packages +libfoo+ is an
369 implementation of. See xref:virtual-package-tutorial[].
371 * +LIBFOO_INSTALL_STAGING+ can be set to +YES+ or +NO+ (default). If
372 set to +YES+, then the commands in the +LIBFOO_INSTALL_STAGING_CMDS+
373 variables are executed to install the package into the staging
376 * +LIBFOO_INSTALL_TARGET+ can be set to +YES+ (default) or +NO+. If
377 set to +YES+, then the commands in the +LIBFOO_INSTALL_TARGET_CMDS+
378 variables are executed to install the package into the target
381 * +LIBFOO_INSTALL_IMAGES+ can be set to +YES+ or +NO+ (default). If
382 set to +YES+, then the commands in the +LIBFOO_INSTALL_IMAGES_CMDS+
383 variable are executed to install the package into the images
386 * +LIBFOO_CONFIG_SCRIPTS+ lists the names of the files in
387 '$(STAGING_DIR)/usr/bin' that need some special fixing to make them
388 cross-compiling friendly. Multiple file names separated by space can
389 be given and all are relative to '$(STAGING_DIR)/usr/bin'. The files
390 listed in +LIBFOO_CONFIG_SCRIPTS+ are also removed from
391 +$(TARGET_DIR)/usr/bin+ since they are not needed on the target.
393 * +LIBFOO_DEVICES+ lists the device files to be created by Buildroot
394 when using the static device table. The syntax to use is the
395 makedevs one. You can find some documentation for this syntax in the
396 xref:makedev-syntax[]. This variable is optional.
398 * +LIBFOO_PERMISSIONS+ lists the changes of permissions to be done at
399 the end of the build process. The syntax is once again the makedevs one.
400 You can find some documentation for this syntax in the xref:makedev-syntax[].
401 This variable is optional.
403 * +LIBFOO_USERS+ lists the users to create for this package, if it installs
404 a program you want to run as a specific user (e.g. as a daemon, or as a
405 cron-job). The syntax is similar in spirit to the makedevs one, and is
406 described in the xref:makeuser-syntax[]. This variable is optional.
408 * +LIBFOO_LICENSE+ defines the license (or licenses) under which the package
410 This name will appear in the manifest file produced by +make legal-info+.
411 If the license appears in https://spdx.org/licenses/[the SPDX License List],
412 use the SPDX short identifier to make the manifest file uniform.
413 Otherwise, describe the license in a precise and concise way, avoiding
414 ambiguous names such as +BSD+ which actually name a family of licenses.
415 This variable is optional. If it is not defined, +unknown+ will appear in
416 the +license+ field of the manifest file for this package. +
417 The expected format for this variable must comply with the following rules:
418 ** If different parts of the package are released under different
419 licenses, then +comma+ separate licenses (e.g. +`LIBFOO_LICENSE =
420 GPL-2.0+, LGPL-2.1+`+). If there is clear distinction between which
421 component is licensed under what license, then annotate the license
422 with that component, between parenthesis (e.g. +`LIBFOO_LICENSE =
423 GPL-2.0+ (programs), LGPL-2.1+ (libraries)`+).
424 ** If the package is dual licensed, then separate licenses with the
425 +or+ keyword (e.g. +`LIBFOO_LICENSE = AFL-2.1 or GPL-2.0+`+).
427 * +LIBFOO_LICENSE_FILES+ is a space-separated list of files in the package
428 tarball that contain the license(s) under which the package is released.
429 +make legal-info+ copies all of these files in the +legal-info+ directory.
430 See xref:legal-info[] for more information.
431 This variable is optional. If it is not defined, a warning will be produced
432 to let you know, and +not saved+ will appear in the +license files+ field
433 of the manifest file for this package.
435 * +LIBFOO_ACTUAL_SOURCE_TARBALL+ only applies to packages whose
436 +LIBFOO_SITE+ / +LIBTOO_SOURCE+ pair points to an archive that does
437 not actually contain source code, but binary code. This a very
438 uncommon case, only known to apply to external toolchains which come
439 already compiled, although theoretically it might apply to other
440 packages. In such cases a separate tarball is usually available with
441 the actual source code. Set +LIBFOO_ACTUAL_SOURCE_TARBALL+ to the
442 name of the actual source code archive and Buildroot will download
443 it and use it when you run +make legal-info+ to collect
444 legally-relevant material. Note this file will not be downloaded
445 during regular builds nor by +make source+.
447 * +LIBFOO_ACTUAL_SOURCE_SITE+ provides the location of the actual
448 source tarball. The default value is +LIBFOO_SITE+, so you don't
449 need to set this variable if the binary and source archives are
450 hosted on the same directory. If +LIBFOO_ACTUAL_SOURCE_TARBALL+ is
451 not set, it doesn't make sense to define
452 +LIBFOO_ACTUAL_SOURCE_SITE+.
454 * +LIBFOO_REDISTRIBUTE+ can be set to +YES+ (default) or +NO+ to indicate if
455 the package source code is allowed to be redistributed. Set it to +NO+ for
456 non-opensource packages: Buildroot will not save the source code for this
457 package when collecting the +legal-info+.
459 * +LIBFOO_FLAT_STACKSIZE+ defines the stack size of an application built into
460 the FLAT binary format. The application stack size on the NOMMU architecture
461 processors can't be enlarged at run time. The default stack size for the
462 FLAT binary format is only 4k bytes. If the application consumes more stack,
463 append the required number here.
465 * +LIBFOO_BIN_ARCH_EXCLUDE+ is a space-separated list of paths (relative
466 to the target directory) to ignore when checking that the package
467 installs correctly cross-compiled binaries. You seldom need to set this
468 variable, unless the package installs binary blobs outside the default
469 locations, `/lib/firmware`, `/usr/lib/firmware`, `/lib/modules`,
470 `/usr/lib/modules`, and `/usr/share`, which are automatically excluded.
472 The recommended way to define these variables is to use the following
475 ----------------------
476 LIBFOO_VERSION = 2.32
477 ----------------------
479 Now, the variables that define what should be performed at the
480 different steps of the build process.
482 * +LIBFOO_EXTRACT_CMDS+ lists the actions to be performed to extract
483 the package. This is generally not needed as tarballs are
484 automatically handled by Buildroot. However, if the package uses a
485 non-standard archive format, such as a ZIP or RAR file, or has a
486 tarball with a non-standard organization, this variable allows to
487 override the package infrastructure default behavior.
489 * +LIBFOO_CONFIGURE_CMDS+ lists the actions to be performed to
490 configure the package before its compilation.
492 * +LIBFOO_BUILD_CMDS+ lists the actions to be performed to
495 * +HOST_LIBFOO_INSTALL_CMDS+ lists the actions to be performed
496 to install the package, when the package is a host package. The
497 package must install its files to the directory given by
498 +$(HOST_DIR)+. All files, including development files such as
499 headers should be installed, since other packages might be compiled
500 on top of this package.
502 * +LIBFOO_INSTALL_TARGET_CMDS+ lists the actions to be
503 performed to install the package to the target directory, when the
504 package is a target package. The package must install its files to
505 the directory given by +$(TARGET_DIR)+. Only the files required for
506 'execution' of the package have to be
507 installed. Header files, static libraries and documentation will be
508 removed again when the target filesystem is finalized.
510 * +LIBFOO_INSTALL_STAGING_CMDS+ lists the actions to be
511 performed to install the package to the staging directory, when the
512 package is a target package. The package must install its files to
513 the directory given by +$(STAGING_DIR)+. All development files
514 should be installed, since they might be needed to compile other
517 * +LIBFOO_INSTALL_IMAGES_CMDS+ lists the actions to be performed to
518 install the package to the images directory, when the package is a
519 target package. The package must install its files to the directory
520 given by +$(BINARIES_DIR)+. Only files that are binary images (aka
521 images) that do not belong in the +TARGET_DIR+ but are necessary
522 for booting the board should be placed here. For example, a package
523 should utilize this step if it has binaries which would be similar
524 to the kernel image, bootloader or root filesystem images.
526 * +LIBFOO_INSTALL_INIT_SYSV+ and +LIBFOO_INSTALL_INIT_SYSTEMD+ list the
527 actions to install init scripts either for the systemV-like init systems
528 (busybox, sysvinit, etc.) or for the systemd units. These commands
529 will be run only when the relevant init system is installed (i.e. if
530 systemd is selected as the init system in the configuration, only
531 +LIBFOO_INSTALL_INIT_SYSTEMD+ will be run).
533 * +LIBFOO_HELP_CMDS+ lists the actions to print the package help, which
534 is included to the main +make help+ output. These commands can print
535 anything in any format.
536 This is seldom used, as packages rarely have custom rules. *Do not use
537 this variable*, unless you really know that you need to print help.
539 The preferred way to define these variables is:
541 ----------------------
542 define LIBFOO_CONFIGURE_CMDS
547 ----------------------
549 In the action definitions, you can use the following variables:
551 * +$(LIBFOO_PKGDIR)+ contains the path to the directory containing the
552 +libfoo.mk+ and +Config.in+ files. This variable is useful when it is
553 necessary to install a file bundled in Buildroot, like a runtime
554 configuration file, a splashscreen image...
556 * +$(@D)+, which contains the directory in which the package source
557 code has been uncompressed.
559 * +$(LIBFOO_DL_DIR)+ contains the path to the directory where all the downloads
560 made by Buildroot for +libfoo+ are stored in.
562 * +$(TARGET_CC)+, +$(TARGET_LD)+, etc. to get the target
563 cross-compilation utilities
565 * +$(TARGET_CROSS)+ to get the cross-compilation toolchain prefix
567 * Of course the +$(HOST_DIR)+, +$(STAGING_DIR)+ and +$(TARGET_DIR)+
568 variables to install the packages properly.
570 Finally, you can also use hooks. See xref:hooks[] for more information.