Partial Merge #15844: depends: Purge libtool archives

8541cbea2 depends: libX*: --disable-malloc0returnsnull in conf (Carl Dong)
0e752637a depends: libXext: Bump to 1.3.3 to fix _XEatDataWords (Carl Dong)
683b7d7a3 depends: Purge libtool archives (Carl Dong)
14209286d depends: Build secondary deps statically. (Carl Dong)

Pull request description:

  ```
  We use pkg-config where we can, which generally replaces libtool at a
  higher level and does not have the same downsides as libtool. These
  archives sit in our depends tree with no purpose and pollute the final
  bitcoin build with massive overlinking.
  ```

  See [here](https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Handling_Libtool_Archives) for an explanation of the various problems libtool archives can cause.

  Unrelated in every way except in spirit: `-D__LIBTOOL_IS_A_FOOL__`!!

  -----

  This PR is based on #16041, and therefore should be merged after #16041.

ACKs for commit 8541cb:

Tree-SHA512: 76030cf32361f0b1cfe14e3827a0cbec99994e7da00a56194ca40cf6cf7d87f78552f49d03d41ce9cf9b642992b90d993578ed1f0ad6bae15cd3f1c88dfaa4b0
This commit is contained in:
Wladimir J. van der Laan 2019-06-05 16:34:12 +02:00 committed by munkybooty
parent 50daf4dce9
commit 8c889e7297
12 changed files with 72 additions and 4 deletions

View File

@ -5,6 +5,10 @@ The package "mylib" will be used here as an example
General tips: General tips:
- mylib_foo is written as $(package)_foo in order to make recipes more similar. - mylib_foo is written as $(package)_foo in order to make recipes more similar.
- 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.
## Identifiers ## Identifiers
Each package is required to define at least these variables: Each package is required to define at least these variables:
@ -146,3 +150,34 @@ $($(package)_config_opts) will be appended.
Most autotools projects can be properly staged using: Most autotools projects can be properly staged using:
$(MAKE) DESTDIR=$($(package)_staging_dir) install $(MAKE) DESTDIR=$($(package)_staging_dir) install
## 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
static or dynamic `libseconday`, that's not our concern. With a static
`libseconday`, when we need to link `libprimary` into our executable, there's no
dependency chain to worry about as `libprimary` has all the symbols.

View File

@ -20,3 +20,7 @@ endef
define $(package)_stage_cmds define $(package)_stage_cmds
$(MAKE) DESTDIR=$($(package)_staging_dir) install $(MAKE) DESTDIR=$($(package)_staging_dir) install
endef endef
define $(package)_postprocess_cmds
rm lib/*.la
endef

View File

@ -6,7 +6,7 @@ $(package)_sha256_hash=6049ddd5f3f3e2618f615f1faeda0a115104423a7996b7aa73e2f36e3
$(package)_dependencies=expat $(package)_dependencies=expat
define $(package)_set_vars define $(package)_set_vars
$(package)_config_opts=--disable-tests --disable-doxygen-docs --disable-xml-docs --disable-static --without-x $(package)_config_opts=--disable-tests --disable-doxygen-docs --disable-xml-docs --disable-shared --without-x
endef endef
define $(package)_config_cmds define $(package)_config_cmds
@ -21,3 +21,7 @@ define $(package)_stage_cmds
$(MAKE) -C dbus DESTDIR=$($(package)_staging_dir) install-libLTLIBRARIES install-dbusincludeHEADERS install-nodist_dbusarchincludeHEADERS && \ $(MAKE) -C dbus DESTDIR=$($(package)_staging_dir) install-libLTLIBRARIES install-dbusincludeHEADERS install-nodist_dbusarchincludeHEADERS && \
$(MAKE) DESTDIR=$($(package)_staging_dir) install-pkgconfigDATA $(MAKE) DESTDIR=$($(package)_staging_dir) install-pkgconfigDATA
endef endef
define $(package)_postprocess_cmds
rm lib/*.la
endef

View File

@ -5,7 +5,8 @@ $(package)_file_name=$(package)-$($(package)_version).tar.bz2
$(package)_sha256_hash=cbc9102f4a31a8dafd42d642e9a3aa31e79a0aedaa1f6efd2795ebc83174ec18 $(package)_sha256_hash=cbc9102f4a31a8dafd42d642e9a3aa31e79a0aedaa1f6efd2795ebc83174ec18
define $(package)_set_vars define $(package)_set_vars
$(package)_config_opts=--disable-static --without-docbook --without-tests --without-examples $(package)_config_opts=--disable-shared --without-docbook --without-tests --without-examples
$(package)_config_opts_linux=--with-pic
endef endef
define $(package)_config_cmds define $(package)_config_cmds
@ -19,3 +20,7 @@ endef
define $(package)_stage_cmds define $(package)_stage_cmds
$(MAKE) DESTDIR=$($(package)_staging_dir) install $(MAKE) DESTDIR=$($(package)_staging_dir) install
endef endef
define $(package)_postprocess_cmds
rm lib/*.la
endef

View File

@ -26,3 +26,7 @@ endef
define $(package)_stage_cmds define $(package)_stage_cmds
$(MAKE) DESTDIR=$($(package)_staging_dir) install $(MAKE) DESTDIR=$($(package)_staging_dir) install
endef endef
define $(package)_postprocess_cmds
rm lib/*.la
endef

View File

@ -20,3 +20,7 @@ endef
define $(package)_stage_cmds define $(package)_stage_cmds
$(MAKE) DESTDIR=$($(package)_staging_dir) install $(MAKE) DESTDIR=$($(package)_staging_dir) install
endef endef
define $(package)_postprocess_cmds
rm lib/*.la
endef

View File

@ -22,3 +22,6 @@ define $(package)_stage_cmds
$(MAKE) DESTDIR=$($(package)_staging_dir) install $(MAKE) DESTDIR=$($(package)_staging_dir) install
endef endef
define $(package)_postprocess_cmds
rm lib/*.la
endef

View File

@ -27,3 +27,7 @@ endef
define $(package)_stage_cmds define $(package)_stage_cmds
$(MAKE) DESTDIR=$($(package)_staging_dir) install $(MAKE) DESTDIR=$($(package)_staging_dir) install
endef endef
define $(package)_postprocess_cmds
rm lib/*.la
endef

View File

@ -35,4 +35,5 @@ define $(package)_stage_cmds
endef endef
define $(package)_postprocess_cmds define $(package)_postprocess_cmds
rm lib/*.la
endef endef

View File

@ -44,5 +44,5 @@ define $(package)_stage_cmds
endef endef
define $(package)_postprocess_cmds define $(package)_postprocess_cmds
rm -rf share/man share/doc rm -rf share/man share/doc lib/*.la
endef endef

View File

@ -26,3 +26,7 @@ endef
define $(package)_stage_cmds define $(package)_stage_cmds
$(MAKE) DESTDIR=$($(package)_staging_dir) install $(MAKE) DESTDIR=$($(package)_staging_dir) install
endef endef
define $(package)_postprocess_cmds
rm lib/*.la
endef

View File

@ -31,5 +31,5 @@ endef
define $(package)_postprocess_cmds define $(package)_postprocess_cmds
sed -i.old "s/ -lstdc++//" lib/pkgconfig/libzmq.pc && \ sed -i.old "s/ -lstdc++//" lib/pkgconfig/libzmq.pc && \
rm -rf bin share rm -rf bin share lib/*.la
endef endef