2014-07-23 07:31:30 +02:00
|
|
|
Each recipe consists of 3 main parts: defining identifiers, setting build
|
|
|
|
variables, and defining build commands.
|
|
|
|
|
|
|
|
The package "mylib" will be used here as an example
|
|
|
|
|
|
|
|
General tips:
|
2015-04-22 06:06:39 +02:00
|
|
|
- mylib_foo is written as $(package)_foo in order to make recipes more similar.
|
2019-06-05 16:34:12 +02:00
|
|
|
- Secondary dependency packages relative to the bitcoin binaries/libraries (i.e.
|
|
|
|
those not in `ALLOWED_LIBRARIES` in `contrib/devtools/symbol-check.py`) don't
|
|
|
|
need to be shared and should be built statically whenever possible. See
|
|
|
|
[below](#secondary-dependencies) for more details.
|
2014-07-23 07:31:30 +02:00
|
|
|
|
2015-04-22 06:06:39 +02:00
|
|
|
## Identifiers
|
2014-07-23 07:31:30 +02:00
|
|
|
Each package is required to define at least these variables:
|
2015-04-22 06:06:39 +02:00
|
|
|
|
|
|
|
$(package)_version:
|
2014-07-23 07:31:30 +02:00
|
|
|
Version of the upstream library or program. If there is no version, a
|
|
|
|
placeholder such as 1.0 can be used.
|
2015-04-22 06:06:39 +02:00
|
|
|
|
|
|
|
$(package)_download_path:
|
2019-05-22 13:39:26 +02:00
|
|
|
Location of the upstream source, without the file-name. Usually http, https
|
|
|
|
or ftp. Secure transmission options like https should be preferred if
|
|
|
|
available.
|
2015-04-22 06:06:39 +02:00
|
|
|
|
|
|
|
$(package)_file_name:
|
2014-07-23 07:31:30 +02:00
|
|
|
The upstream source filename available at the download path.
|
2015-04-22 06:06:39 +02:00
|
|
|
|
|
|
|
$(package)_sha256_hash:
|
2014-07-23 07:31:30 +02:00
|
|
|
The sha256 hash of the upstream file
|
|
|
|
|
|
|
|
These variables are optional:
|
2015-04-22 06:06:39 +02:00
|
|
|
|
|
|
|
$(package)_build_subdir:
|
2014-07-23 07:31:30 +02:00
|
|
|
cd to this dir before running configure/build/stage commands.
|
Merge #16812: doc: Fix whitespace errs in .md files, bitcoin.conf, and Info.plist.in
6aab7649d30b19d136a27f1287fd2c8b00fb460c doc: Fix whitespace errs in .md files, bitcoin.conf, Info.plist.in, and find_bdb48.m4 (Jon Layton)
Pull request description:
Although there is an existing `test/lint/lint-whitespace.sh` linter, it only prevents new errors from being introduced. This commit removes all existing whitespace errors from Core markdown files (skips `src/crypto/ctaes/`, `leveldb/`, and `doc/release-notes/`), `bitcoin.conf`, and `Info.plist.in`.
Further formatting could be done on the markdown documents, but seeing as there several coexisting styles that break a few `markdownlint` rules, a first step would be to define and add a linter to Travis. For now, the small fix is made.
ACKs for top commit:
fanquake:
ACK 6aab7649d30b19d136a27f1287fd2c8b00fb460c - Thanks for following up. Hopefully we now never have to deal with whitespace again.
Tree-SHA512: 810cc31ae4364b2dedf85783e67315d7b4e11589e4b32c599606e1b1ba8de0663bcae9ddb1bd8c9762a3636a2d65bdcd64ec22d2e90943f374a0c9574b77ca23
2019-09-17 10:33:29 +02:00
|
|
|
|
2015-04-22 06:06:39 +02:00
|
|
|
$(package)_download_file:
|
2014-07-23 07:31:30 +02:00
|
|
|
The file-name of the upstream source if it differs from how it should be
|
|
|
|
stored locally. This can be used to avoid storing file-names with strange
|
|
|
|
characters.
|
Merge #16812: doc: Fix whitespace errs in .md files, bitcoin.conf, and Info.plist.in
6aab7649d30b19d136a27f1287fd2c8b00fb460c doc: Fix whitespace errs in .md files, bitcoin.conf, Info.plist.in, and find_bdb48.m4 (Jon Layton)
Pull request description:
Although there is an existing `test/lint/lint-whitespace.sh` linter, it only prevents new errors from being introduced. This commit removes all existing whitespace errors from Core markdown files (skips `src/crypto/ctaes/`, `leveldb/`, and `doc/release-notes/`), `bitcoin.conf`, and `Info.plist.in`.
Further formatting could be done on the markdown documents, but seeing as there several coexisting styles that break a few `markdownlint` rules, a first step would be to define and add a linter to Travis. For now, the small fix is made.
ACKs for top commit:
fanquake:
ACK 6aab7649d30b19d136a27f1287fd2c8b00fb460c - Thanks for following up. Hopefully we now never have to deal with whitespace again.
Tree-SHA512: 810cc31ae4364b2dedf85783e67315d7b4e11589e4b32c599606e1b1ba8de0663bcae9ddb1bd8c9762a3636a2d65bdcd64ec22d2e90943f374a0c9574b77ca23
2019-09-17 10:33:29 +02:00
|
|
|
|
2015-04-22 06:06:39 +02:00
|
|
|
$(package)_dependencies:
|
2014-07-23 07:31:30 +02:00
|
|
|
Names of any other packages that this one depends on.
|
Merge #16812: doc: Fix whitespace errs in .md files, bitcoin.conf, and Info.plist.in
6aab7649d30b19d136a27f1287fd2c8b00fb460c doc: Fix whitespace errs in .md files, bitcoin.conf, Info.plist.in, and find_bdb48.m4 (Jon Layton)
Pull request description:
Although there is an existing `test/lint/lint-whitespace.sh` linter, it only prevents new errors from being introduced. This commit removes all existing whitespace errors from Core markdown files (skips `src/crypto/ctaes/`, `leveldb/`, and `doc/release-notes/`), `bitcoin.conf`, and `Info.plist.in`.
Further formatting could be done on the markdown documents, but seeing as there several coexisting styles that break a few `markdownlint` rules, a first step would be to define and add a linter to Travis. For now, the small fix is made.
ACKs for top commit:
fanquake:
ACK 6aab7649d30b19d136a27f1287fd2c8b00fb460c - Thanks for following up. Hopefully we now never have to deal with whitespace again.
Tree-SHA512: 810cc31ae4364b2dedf85783e67315d7b4e11589e4b32c599606e1b1ba8de0663bcae9ddb1bd8c9762a3636a2d65bdcd64ec22d2e90943f374a0c9574b77ca23
2019-09-17 10:33:29 +02:00
|
|
|
|
2015-04-22 06:06:39 +02:00
|
|
|
$(package)_patches:
|
2014-07-23 07:31:30 +02:00
|
|
|
Filenames of any patches needed to build the package
|
2015-04-22 06:06:39 +02:00
|
|
|
|
|
|
|
$(package)_extra_sources:
|
2015-05-14 03:12:04 +02:00
|
|
|
Any extra files that will be fetched via $(package)_fetch_cmds. These are
|
|
|
|
specified so that they can be fetched and verified via 'make download'.
|
2014-07-23 07:31:30 +02:00
|
|
|
|
2015-04-22 06:06:39 +02:00
|
|
|
|
|
|
|
## Build Variables:
|
2014-07-23 07:31:30 +02:00
|
|
|
After defining the main identifiers, build variables may be added or customized
|
|
|
|
before running the build commands. They should be added to a function called
|
|
|
|
$(package)_set_vars. For example:
|
|
|
|
|
2015-04-22 06:06:39 +02:00
|
|
|
define $(package)_set_vars
|
|
|
|
...
|
|
|
|
endef
|
2014-07-23 07:31:30 +02:00
|
|
|
|
|
|
|
Most variables can be prefixed with the host, architecture, or both, to make
|
|
|
|
the modifications specific to that case. For example:
|
|
|
|
|
2015-04-22 06:06:39 +02:00
|
|
|
Universal: $(package)_cc=gcc
|
|
|
|
Linux only: $(package)_linux_cc=gcc
|
|
|
|
x86_64 only: $(package)_x86_64_cc = gcc
|
|
|
|
x86_64 linux only: $(package)_x86_64_linux_cc = gcc
|
2014-07-23 07:31:30 +02:00
|
|
|
|
|
|
|
These variables may be set to override or append their default values.
|
2015-04-22 06:06:39 +02:00
|
|
|
|
|
|
|
$(package)_cc
|
|
|
|
$(package)_cxx
|
|
|
|
$(package)_objc
|
|
|
|
$(package)_objcxx
|
|
|
|
$(package)_ar
|
|
|
|
$(package)_ranlib
|
|
|
|
$(package)_libtool
|
|
|
|
$(package)_nm
|
|
|
|
$(package)_cflags
|
|
|
|
$(package)_cxxflags
|
|
|
|
$(package)_ldflags
|
|
|
|
$(package)_cppflags
|
|
|
|
$(package)_config_env
|
|
|
|
$(package)_build_env
|
|
|
|
$(package)_stage_env
|
|
|
|
$(package)_build_opts
|
|
|
|
$(package)_config_opts
|
2014-07-23 07:31:30 +02:00
|
|
|
|
|
|
|
The *_env variables are used to add environment variables to the respective
|
|
|
|
commands.
|
|
|
|
|
2014-09-23 23:51:10 +02:00
|
|
|
Many variables respect a debug/release suffix as well, in order to use them for
|
|
|
|
only the appropriate build config. For example:
|
2015-04-22 06:06:39 +02:00
|
|
|
|
|
|
|
$(package)_cflags_release = -O3
|
|
|
|
$(package)_cflags_i686_debug = -g
|
|
|
|
$(package)_config_opts_release = --disable-debug
|
2014-09-23 23:51:10 +02:00
|
|
|
|
|
|
|
These will be used in addition to the options that do not specify
|
|
|
|
debug/release. All builds are considered to be release unless DEBUG=1 is set by
|
2015-04-22 06:06:39 +02:00
|
|
|
the user. Other variables may be defined as needed.
|
2014-07-23 07:31:30 +02:00
|
|
|
|
2015-04-22 06:06:39 +02:00
|
|
|
## Build commands:
|
2014-07-23 07:31:30 +02:00
|
|
|
|
|
|
|
For each build, a unique build dir and staging dir are created. For example,
|
2015-04-22 06:06:39 +02:00
|
|
|
`work/build/mylib/1.0-1adac830f6e` and `work/staging/mylib/1.0-1adac830f6e`.
|
2014-07-23 07:31:30 +02:00
|
|
|
|
|
|
|
The following build commands are available for each recipe:
|
|
|
|
|
2015-04-22 06:06:39 +02:00
|
|
|
$(package)_fetch_cmds:
|
2014-07-23 07:31:30 +02:00
|
|
|
Runs from: build dir
|
|
|
|
Fetch the source file. If undefined, it will be fetched and verified
|
|
|
|
against its hash.
|
2015-04-22 06:06:39 +02:00
|
|
|
|
|
|
|
$(package)_extract_cmds:
|
2014-07-23 07:31:30 +02:00
|
|
|
Runs from: build dir
|
|
|
|
Verify the source file against its hash and extract it. If undefined, the
|
|
|
|
source is assumed to be a tarball.
|
2015-04-22 06:06:39 +02:00
|
|
|
|
|
|
|
$(package)_preprocess_cmds:
|
2014-07-23 07:31:30 +02:00
|
|
|
Runs from: build dir/$(package)_build_subdir
|
|
|
|
Preprocess the source as necessary. If undefined, does nothing.
|
2015-04-22 06:06:39 +02:00
|
|
|
|
|
|
|
$(package)_config_cmds:
|
2014-07-23 07:31:30 +02:00
|
|
|
Runs from: build dir/$(package)_build_subdir
|
|
|
|
Configure the source. If undefined, does nothing.
|
2015-04-22 06:06:39 +02:00
|
|
|
|
|
|
|
$(package)_build_cmds:
|
2014-07-23 07:31:30 +02:00
|
|
|
Runs from: build dir/$(package)_build_subdir
|
|
|
|
Build the source. If undefined, does nothing.
|
2015-04-22 06:06:39 +02:00
|
|
|
|
|
|
|
$(package)_stage_cmds:
|
2014-07-23 07:31:30 +02:00
|
|
|
Runs from: build dir/$(package)_build_subdir
|
|
|
|
Stage the build results. If undefined, does nothing.
|
|
|
|
|
|
|
|
The following variables are available for each recipe:
|
Merge #16812: doc: Fix whitespace errs in .md files, bitcoin.conf, and Info.plist.in
6aab7649d30b19d136a27f1287fd2c8b00fb460c doc: Fix whitespace errs in .md files, bitcoin.conf, Info.plist.in, and find_bdb48.m4 (Jon Layton)
Pull request description:
Although there is an existing `test/lint/lint-whitespace.sh` linter, it only prevents new errors from being introduced. This commit removes all existing whitespace errors from Core markdown files (skips `src/crypto/ctaes/`, `leveldb/`, and `doc/release-notes/`), `bitcoin.conf`, and `Info.plist.in`.
Further formatting could be done on the markdown documents, but seeing as there several coexisting styles that break a few `markdownlint` rules, a first step would be to define and add a linter to Travis. For now, the small fix is made.
ACKs for top commit:
fanquake:
ACK 6aab7649d30b19d136a27f1287fd2c8b00fb460c - Thanks for following up. Hopefully we now never have to deal with whitespace again.
Tree-SHA512: 810cc31ae4364b2dedf85783e67315d7b4e11589e4b32c599606e1b1ba8de0663bcae9ddb1bd8c9762a3636a2d65bdcd64ec22d2e90943f374a0c9574b77ca23
2019-09-17 10:33:29 +02:00
|
|
|
|
2015-04-22 06:06:39 +02:00
|
|
|
$(1)_staging_dir: package's destination sysroot path
|
|
|
|
$(1)_staging_prefix_dir: prefix path inside of the package's staging dir
|
|
|
|
$(1)_extract_dir: path to the package's extracted sources
|
|
|
|
$(1)_build_dir: path where configure/build/stage commands will be run
|
|
|
|
$(1)_patch_dir: path where the package's patches (if any) are found
|
2014-07-23 07:31:30 +02:00
|
|
|
|
|
|
|
Notes on build commands:
|
|
|
|
|
|
|
|
For packages built with autotools, $($(package)_autoconf) can be used in the
|
|
|
|
configure step to (usually) correctly configure automatically. Any
|
|
|
|
$($(package)_config_opts) will be appended.
|
|
|
|
|
|
|
|
Most autotools projects can be properly staged using:
|
2015-04-22 06:06:39 +02:00
|
|
|
|
|
|
|
$(MAKE) DESTDIR=$($(package)_staging_dir) install
|
2019-06-05 16:34:12 +02:00
|
|
|
|
|
|
|
## Build outputs:
|
|
|
|
|
|
|
|
In general, the output of a depends package should not contain any libtool
|
|
|
|
archives. Instead, the package should output `.pc` (`pkg-config`) files where
|
|
|
|
possible.
|
|
|
|
|
|
|
|
From the [Gentoo Wiki entry](https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Handling_Libtool_Archives):
|
|
|
|
|
|
|
|
> Libtool pulls in all direct and indirect dependencies into the .la files it
|
|
|
|
> creates. This leads to massive overlinking, which is toxic to the Gentoo
|
|
|
|
> ecosystem, as it leads to a massive number of unnecessary rebuilds.
|
|
|
|
|
|
|
|
## Secondary dependencies:
|
|
|
|
|
|
|
|
Secondary dependency packages relative to the bitcoin binaries/libraries (i.e.
|
|
|
|
those not in `ALLOWED_LIBRARIES` in `contrib/devtools/symbol-check.py`) don't
|
|
|
|
need to be shared and should be built statically whenever possible. This
|
|
|
|
improves general build reliability as illustrated by the following example:
|
|
|
|
|
|
|
|
When linking an executable against a shared library `libprimary` that has its
|
|
|
|
own shared dependency `libsecondary`, we may need to specify the path to
|
|
|
|
`libsecondary` on the link command using the `-rpath/-rpath-link` options, it is
|
|
|
|
not sufficient to just say `libprimary`.
|
|
|
|
|
|
|
|
For us, it's much easier to just link a static `libsecondary` into a shared
|
|
|
|
`libprimary`. Especially because in our case, we are linking against a dummy
|
|
|
|
`libprimary` anyway that we'll throw away. We don't care if the end-user has a
|
2021-11-29 02:05:36 +01:00
|
|
|
static or dynamic `libsecondary`, that's not our concern. With a static
|
|
|
|
`libsecondary`, when we need to link `libprimary` into our executable, there's no
|
2019-06-05 16:34:12 +02:00
|
|
|
dependency chain to worry about as `libprimary` has all the symbols.
|