Skip to content

Commit 2102c97

Browse files
committed
Merge bitcoin/bitcoin#29706: depends: set two CMake options globally
76045bb depends: always set CMAKE_POSITION_INDEPENDENT_CODE=ON (fanquake) d046236 depends: always set CMAKE_INSTALL_LIBDIR=lib/ (fanquake) Pull request description: Set `CMAKE_INSTALL_LIBDIR=lib/` and `CMAKE_POSITION_INDEPENDENT_CODE=ON` globally in depends, rather than per-package. `CMAKE_INSTALL_LIBDIR=lib/` is needed to override the annoying [`GNUInstallDirs`](https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html) `lib` vs `lib64` behaviour, and we always want PIC code. The PIC commit is the counterpart to the same Autotools change in #29488. I'm PRing these commits as I have a CMake branch building on top, and want to avoid adding the same workarounds to every package we are going to touch, but these can go in separately as the build should be tested for existing packages (i.e multiprocess). ACKs for top commit: hebasto: re-ACK 76045bb. theuni: utACK 76045bb. Both changes make sense to me, and both can be overridden if needed, though I can't imagine we'd need to. Tree-SHA512: 655a0b6b7ee5a5820f52e8e919ef03fc216d29f13f3904f72b64ce57436510e073c903039488d5740535c56e1f6221267229238c5231de5f8467d238fd562578
2 parents 220487b + 76045bb commit 2102c97

File tree

4 files changed

+9
-13
lines changed

4 files changed

+9
-13
lines changed

depends/funcs.mk

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,19 @@ ifneq ($($(1)_ldflags),)
170170
$(1)_autoconf += LDFLAGS="$$($(1)_ldflags)"
171171
endif
172172

173+
# We hardcode the library install path to "lib" to match the PKG_CONFIG_PATH
174+
# setting in depends/config.site.in, which also hardcodes "lib".
175+
# Without this setting, CMake by default would use the OS library
176+
# directory, which might be "lib64" or something else, not "lib", on multiarch systems.
173177
$(1)_cmake=env CC="$$($(1)_cc)" \
174178
CFLAGS="$$($(1)_cppflags) $$($(1)_cflags)" \
175179
CXX="$$($(1)_cxx)" \
176180
CXXFLAGS="$$($(1)_cppflags) $$($(1)_cxxflags)" \
177181
LDFLAGS="$$($(1)_ldflags)" \
178-
cmake -DCMAKE_INSTALL_PREFIX:PATH="$$($($(1)_type)_prefix)" $$($(1)_config_opts)
182+
cmake -DCMAKE_INSTALL_PREFIX:PATH="$$($($(1)_type)_prefix)" \
183+
-DCMAKE_INSTALL_LIBDIR=lib/ \
184+
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
185+
$$($(1)_config_opts)
179186
ifeq ($($(1)_type),build)
180187
$(1)_cmake += -DCMAKE_INSTALL_RPATH:PATH="$$($($(1)_type)_prefix)/lib"
181188
else

depends/packages.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ From the [Gentoo Wiki entry](https://wiki.gentoo.org/wiki/Project:Quality_Assura
163163
> ecosystem, as it leads to a massive number of unnecessary rebuilds.
164164
165165
Where possible, packages are built with Position Independant Code. Either using
166-
the autotools `--with-pic` flag, or `DCMAKE_POSITION_INDEPENDENT_CODE` with CMake.
166+
the Autotools `--with-pic` flag, or `CMAKE_POSITION_INDEPENDENT_CODE` with CMake.
167167

168168
## Secondary dependencies:
169169

depends/packages/capnp.mk

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,10 @@ $(package)_download_file=$(native_$(package)_download_file)
55
$(package)_file_name=$(native_$(package)_file_name)
66
$(package)_sha256_hash=$(native_$(package)_sha256_hash)
77

8-
# Hardcode library install path to "lib" to match the PKG_CONFIG_PATH
9-
# setting in depends/config.site.in, which also hardcodes "lib".
10-
# Without this setting, cmake by default would use the OS library
11-
# directory, which might be "lib64" or something else, not "lib", on multiarch systems.
128
define $(package)_set_vars :=
139
$(package)_config_opts := -DBUILD_TESTING=OFF
1410
$(package)_config_opts += -DWITH_OPENSSL=OFF
1511
$(package)_config_opts += -DWITH_ZLIB=OFF
16-
$(package)_config_opts += -DCMAKE_INSTALL_LIBDIR=lib/
1712
endef
1813

1914
define $(package)_config_cmds

depends/packages/libmultiprocess.mk

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,7 @@ ifneq ($(host),$(build))
88
$(package)_dependencies += native_capnp
99
endif
1010

11-
# Hardcode library install path to "lib" to match the PKG_CONFIG_PATH
12-
# setting in depends/config.site.in, which also hardcodes "lib".
13-
# Without this setting, cmake by default would use the OS library
14-
# directory, which might be "lib64" or something else, not "lib", on multiarch systems.
1511
define $(package)_set_vars :=
16-
$(package)_config_opts += -DCMAKE_INSTALL_LIBDIR=lib/
17-
$(package)_config_opts += -DCMAKE_POSITION_INDEPENDENT_CODE=ON
1812
ifneq ($(host),$(build))
1913
$(package)_config_opts := -DCAPNP_EXECUTABLE="$$(native_capnp_prefixbin)/capnp"
2014
$(package)_config_opts += -DCAPNPC_CXX_EXECUTABLE="$$(native_capnp_prefixbin)/capnpc-c++"

0 commit comments

Comments
 (0)