@@ -5,6 +5,10 @@ The package "mylib" will be used here as an example
55
66General 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
1014Each package is required to define at least these variables:
@@ -146,3 +150,34 @@ $($(package)_config_opts) will be appended.
146150Most autotools projects can be properly staged using:
147151
148152 $(MAKE) DESTDIR=$($(package)_staging_dir) install
153+
154+ ## Build outputs:
155+
156+ In general, the output of a depends package should not contain any libtool
157+ archives. Instead, the package should output ` .pc ` (` pkg-config ` ) files where
158+ possible.
159+
160+ From the [ Gentoo Wiki entry] ( https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Handling_Libtool_Archives ) :
161+
162+ > Libtool pulls in all direct and indirect dependencies into the .la files it
163+ > creates. This leads to massive overlinking, which is toxic to the Gentoo
164+ > ecosystem, as it leads to a massive number of unnecessary rebuilds.
165+
166+ ## Secondary dependencies:
167+
168+ Secondary dependency packages relative to the bitcoin binaries/libraries (i.e.
169+ those not in ` ALLOWED_LIBRARIES ` in ` contrib/devtools/symbol-check.py ` ) don't
170+ need to be shared and should be built statically whenever possible. This
171+ improves general build reliability as illustrated by the following example:
172+
173+ When linking an executable against a shared library ` libprimary ` that has its
174+ own shared dependency ` libsecondary ` , we may need to specify the path to
175+ ` libsecondary ` on the link command using the ` -rpath/-rpath-link ` options, it is
176+ not sufficient to just say ` libprimary ` .
177+
178+ For us, it's much easier to just link a static ` libsecondary ` into a shared
179+ ` libprimary ` . Especially because in our case, we are linking against a dummy
180+ ` libprimary ` anyway that we'll throw away. We don't care if the end-user has a
181+ static or dynamic ` libseconday ` , that's not our concern. With a static
182+ ` libseconday ` , when we need to link ` libprimary ` into our executable, there's no
183+ dependency chain to worry about as ` libprimary ` has all the symbols.
0 commit comments