1 Each recipe consists of 3 main parts: defining identifiers, setting build
2 variables, and defining build commands.
4 The package "mylib" will be used here as an example
7 mylib_foo is written as $(package)_foo in order to make recipes more similar.
10 Each package is required to define at least these variables:
12 Version of the upstream library or program. If there is no version, a
13 placeholder such as 1.0 can be used.
14 $(package)_download_path:
15 Location of the upstream source, without the file-name. Usually http or
18 The upstream source filename available at the download path.
19 $(package)_sha256_hash:
20 The sha256 hash of the upstream file
22 These variables are optional:
23 $(package)_build_subdir:
24 cd to this dir before running configure/build/stage commands.
25 $(package)_download_file:
26 The file-name of the upstream source if it differs from how it should be
27 stored locally. This can be used to avoid storing file-names with strange
29 $(package)_dependencies:
30 Names of any other packages that this one depends on.
32 Filenames of any patches needed to build the package
36 After defining the main identifiers, build variables may be added or customized
37 before running the build commands. They should be added to a function called
38 $(package)_set_vars. For example:
40 define $(package)_set_vars
44 Most variables can be prefixed with the host, architecture, or both, to make
45 the modifications specific to that case. For example:
47 Universal: $(package)_cc=gcc
48 Linux only: $(package)_linux_cc=gcc
49 x86_64 only: $(package)_x86_64_cc = gcc
50 x86_64 linux only: $(package)_x86_64_linux_cc = gcc
52 These variables may be set to override or append their default values.
69 $(package)_config_opts
71 The *_env variables are used to add environment variables to the respective
74 Many variables respect a debug/release suffix as well, in order to use them for
75 only the appropriate build config. For example:
76 $(package)_cflags_release = -O3
77 $(package)_cflags_i686_debug = -g
78 $(package)_config_opts_release = --disable-debug
80 These will be used in addition to the options that do not specify
81 debug/release. All builds are considered to be release unless DEBUG=1 is set by
84 Other variables may be defined as needed.
88 For each build, a unique build dir and staging dir are created. For example,
89 work/build/mylib/1.0-1adac830f6e and work/staging/mylib/1.0-1adac830f6e.
91 The following build commands are available for each recipe:
93 $(package)_fetch_cmds:
95 Fetch the source file. If undefined, it will be fetched and verified
97 $(package)_extract_cmds:
99 Verify the source file against its hash and extract it. If undefined, the
100 source is assumed to be a tarball.
101 $(package)_preprocess_cmds:
102 Runs from: build dir/$(package)_build_subdir
103 Preprocess the source as necessary. If undefined, does nothing.
104 $(package)_config_cmds:
105 Runs from: build dir/$(package)_build_subdir
106 Configure the source. If undefined, does nothing.
107 $(package)_build_cmds:
108 Runs from: build dir/$(package)_build_subdir
109 Build the source. If undefined, does nothing.
110 $(package)_stage_cmds:
111 Runs from: build dir/$(package)_build_subdir
112 Stage the build results. If undefined, does nothing.
114 The following variables are available for each recipe:
115 $(1)_staging_dir: package's destination sysroot path
116 $(1)_staging_prefix_dir: prefix path inside of the package's staging dir
117 $(1)_extract_dir: path to the package's extracted sources
118 $(1)_build_dir: path where configure/build/stage commands will be run
119 $(1)_patch_dir: path where the package's patches (if any) are found
121 Notes on build commands:
123 For packages built with autotools, $($(package)_autoconf) can be used in the
124 configure step to (usually) correctly configure automatically. Any
125 $($(package)_config_opts) will be appended.
127 Most autotools projects can be properly staged using:
128 $(MAKE) DESTDIR=$($(package)_staging_dir) install