]>
Commit | Line | Data |
---|---|---|
1dec09b3 CF |
1 | Each recipe consists of 3 main parts: defining identifiers, setting build |
2 | variables, and defining build commands. | |
3 | ||
4 | The package "mylib" will be used here as an example | |
5 | ||
6 | General tips: | |
7 | mylib_foo is written as $(package)_foo in order to make recipes more similar. | |
8 | ||
9 | Identifiers: | |
10 | Each package is required to define at least these variables: | |
11 | $(package)_version: | |
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 | |
16 | ftp. | |
17 | $(package)_file_name: | |
18 | The upstream source filename available at the download path. | |
19 | $(package)_sha256_hash: | |
20 | The sha256 hash of the upstream file | |
21 | ||
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 | |
28 | characters. | |
29 | $(package)_dependencies: | |
30 | Names of any other packages that this one depends on. | |
31 | $(package)_patches: | |
32 | Filenames of any patches needed to build the package | |
33 | ||
34 | ||
35 | Build Variables: | |
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: | |
39 | ||
40 | define $(package)_set_vars | |
41 | ... | |
42 | endef | |
43 | ||
44 | Most variables can be prefixed with the host, architecture, or both, to make | |
45 | the modifications specific to that case. For example: | |
46 | ||
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 | |
51 | ||
52 | These variables may be set to override or append their default values. | |
53 | $(package)_cc | |
54 | $(package)_cxx | |
55 | $(package)_objc | |
56 | $(package)_objcxx | |
57 | $(package)_ar | |
58 | $(package)_ranlib | |
59 | $(package)_libtool | |
60 | $(package)_nm | |
61 | $(package)_cflags | |
62 | $(package)_cxxflags | |
63 | $(package)_ldflags | |
64 | $(package)_cppflags | |
65 | $(package)_config_env | |
66 | $(package)_build_env | |
67 | $(package)_stage_env | |
68 | ||
69 | The *_env variables are used to add environment variables to the respective | |
70 | commands. | |
71 | ||
72 | Other variables may be defined as needed. | |
73 | ||
74 | Build commands: | |
75 | ||
76 | For each build, a unique build dir and staging dir are created. For example, | |
77 | work/build/mylib/1.0-1adac830f6e and work/staging/mylib/1.0-1adac830f6e. | |
78 | ||
79 | The following build commands are available for each recipe: | |
80 | ||
81 | $(package)_fetch_cmds: | |
82 | Runs from: build dir | |
83 | Fetch the source file. If undefined, it will be fetched and verified | |
84 | against its hash. | |
85 | $(package)_extract_cmds: | |
86 | Runs from: build dir | |
87 | Verify the source file against its hash and extract it. If undefined, the | |
88 | source is assumed to be a tarball. | |
89 | $(package)_preprocess_cmds: | |
90 | Runs from: build dir/$(package)_build_subdir | |
91 | Preprocess the source as necessary. If undefined, does nothing. | |
92 | $(package)_config_cmds: | |
93 | Runs from: build dir/$(package)_build_subdir | |
94 | Configure the source. If undefined, does nothing. | |
95 | $(package)_build_cmds: | |
96 | Runs from: build dir/$(package)_build_subdir | |
97 | Build the source. If undefined, does nothing. | |
98 | $(package)_stage_cmds: | |
99 | Runs from: build dir/$(package)_build_subdir | |
100 | Stage the build results. If undefined, does nothing. | |
101 | ||
102 | The following variables are available for each recipe: | |
103 | $(1)_staging_dir: package's destination sysroot path | |
104 | $(1)_staging_prefix_dir: prefix path inside of the package's staging dir | |
105 | $(1)_extract_dir: path to the package's extracted sources | |
106 | $(1)_build_dir: path where configure/build/stage commands will be run | |
107 | $(1)_patch_dir: path where the package's patches (if any) are found | |
108 | ||
109 | Notes on build commands: | |
110 | ||
111 | For packages built with autotools, $($(package)_autoconf) can be used in the | |
112 | configure step to (usually) correctly configure automatically. Any | |
113 | $($(package)_config_opts) will be appended. | |
114 | ||
115 | Most autotools projects can be properly staged using: | |
116 | $(MAKE) DESTDIR=$($(package)_staging_dir) install |