Skip to content

Commit 1420928

Browse files
committed
depends: Build secondary deps statically.
Secondary dependencies don't need to be shared.
1 parent 76e2cde commit 1420928

File tree

5 files changed

+28
-4
lines changed

5 files changed

+28
-4
lines changed

depends/packages.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ The package "mylib" will be used here as an example
55

66
General tips:
77
- mylib_foo is written as $(package)_foo in order to make recipes more similar.
8+
- Secondary dependency packages relative to the bitcoin binaries/libraries (i.e.
9+
those not in `ALLOWED_LIBRARIES` in `contrib/devtools/symbol-check.py`) don't
10+
need to be shared and should be built statically whenever possible. See
11+
[below](#secondary-dependencies) for more details.
812

913
## Identifiers
1014
Each package is required to define at least these variables:
@@ -146,3 +150,22 @@ $($(package)_config_opts) will be appended.
146150
Most autotools projects can be properly staged using:
147151

148152
$(MAKE) DESTDIR=$($(package)_staging_dir) install
153+
154+
## Secondary dependencies:
155+
156+
Secondary dependency packages relative to the bitcoin binaries/libraries (i.e.
157+
those not in `ALLOWED_LIBRARIES` in `contrib/devtools/symbol-check.py`) don't
158+
need to be shared and should be built statically whenever possible. This
159+
improves general build reliability as illustrated by the following example:
160+
161+
When linking an executable against a shared library `libprimary` that has its
162+
own shared dependency `libsecondary`, we may need to specify the path to
163+
`libsecondary` on the link command using the `-rpath/-rpath-link` options, it is
164+
not sufficient to just say `libprimary`.
165+
166+
For us, it's much easier to just link a static `libsecondary` into a shared
167+
`libprimary`. Especially because in our case, we are linking against a dummy
168+
`libprimary` anyway that we'll throw away. We don't care if the end-user has a
169+
static or dynamic `libseconday`, that's not our concern. With a static
170+
`libseconday`, when we need to link `libprimary` into our executable, there's no
171+
dependency chain to worry about as `libprimary` has all the symbols.

depends/packages/dbus.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ $(package)_sha256_hash=6049ddd5f3f3e2618f615f1faeda0a115104423a7996b7aa73e2f36e3
66
$(package)_dependencies=expat
77

88
define $(package)_set_vars
9-
$(package)_config_opts=--disable-tests --disable-doxygen-docs --disable-xml-docs --disable-static --without-x
9+
$(package)_config_opts=--disable-tests --disable-doxygen-docs --disable-xml-docs --disable-shared --without-x
1010
endef
1111

1212
define $(package)_config_cmds

depends/packages/expat.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ $(package)_file_name=$(package)-$($(package)_version).tar.bz2
55
$(package)_sha256_hash=17b43c2716d521369f82fc2dc70f359860e90fa440bea65b3b85f0b246ea81f2
66

77
define $(package)_set_vars
8-
$(package)_config_opts=--disable-static --without-docbook
8+
$(package)_config_opts=--disable-shared --without-docbook
9+
$(package)_config_opts_linux=--with-pic
910
endef
1011

1112
define $(package)_config_cmds

depends/packages/libXext.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ $(package)_sha256_hash=f829075bc646cdc085fa25d98d5885d83b1759ceb355933127c257e8e
66
$(package)_dependencies=xproto xextproto libX11 libXau
77

88
define $(package)_set_vars
9-
$(package)_config_opts=--disable-static
9+
$(package)_config_opts=--disable-shared
1010
endef
1111

1212
define $(package)_preprocess_cmds

depends/packages/xtrans.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ $(package)_sha256_hash=054d4ee3efd52508c753e9f7bc655ef185a29bd2850dd9e2fc2ccc335
66
$(package)_dependencies=
77

88
define $(package)_set_vars
9-
$(package)_config_opts_linux=--with-pic --disable-static
9+
$(package)_config_opts_linux=--with-pic --disable-shared
1010
endef
1111

1212
define $(package)_preprocess_cmds

0 commit comments

Comments
 (0)