From fc1c29caf05854c1e39187c8d8f41de315abc206 Mon Sep 17 00:00:00 2001 From: fanquake Date: Tue, 16 Nov 2021 10:05:02 +0800 Subject: [PATCH 01/12] partial Merge bitcoin/bitcoin#23478: build: Add support for Android NDK r23 LTS BACKPORT NOTE: excludes documentation changes in doc/build-android.md 4ba492052ec09d48f8c3f391cc248340e761c7f2 doc: Add minimum supported Android NDK version (Hennadii Stepanov) 6393bdcd53b106367b10317c227a114494c90142 doc: Move Android dependencies guide into `build-android.md` (Hennadii Stepanov) ac323a7222efaafc7bc3110b02f1ef2d2635c9a2 build: Switch to llvm buinutils for Android builds (Hennadii Stepanov) Pull request description: The new Long Term Support release of the Android NDK is [available](https://groups.google.com/g/android-ndk-announce/c/MS6Qoub0DKE/m/Zfp5Ys8eAAAJ) since 2021-08-11: > As r23 is the new LTS, the support windows for r21 and r22 have now ended. On master (8ae4ba481ce8f7da173bef24432729c87a36cb70), dependency build fails because it expects GNU Binutils are present in the Android NDK. In [fact](https://android.googlesource.com/platform/ndk/+/master/docs/BuildSystemMaintainers.md#binutils): > GNU Binutils remains available up to and including r22. All binutils tools with the exception of the assembler (GAS) were removed in r23. GAS was removed in r24. This PR switches our depends build system to llvm binutils. The usage of `llvm-ar` and `llvm-ranlib` tools effectively makes r21 the minimum supported version of NDK. With this PR: - building depends against NDK r23 LTS now is possible with `NO_QT=1` - building the `qt` package in depends against NDK r23 LTS still fails: ``` Creating qmake... ... ERROR: Cannot detect Android NDK toolchain. Please use -android-toolchain-version to specify it. ``` The issue with the `qt` package is going to be addressed in another PR. ACKs for top commit: fanquake: ACK 4ba492052ec09d48f8c3f391cc248340e761c7f2 Tree-SHA512: cdc8f95ff9a3ad7f12eb55b9ea18b6b6b800d4cceff7e0321985be6e39d15a2b2ea5b1592972307d76d111292a0ed58fd287e5ca285e2f6868b42a286536d310 --- depends/README.md | 14 +------------- depends/hosts/android.mk | 7 +++---- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/depends/README.md b/depends/README.md index 404e66fc23..ec0c60ba43 100644 --- a/depends/README.md +++ b/depends/README.md @@ -41,7 +41,7 @@ Common `host-platform-triplet`s for cross compilation are: - `aarch64-linux-android` for Android ARM 64 bit - `x86_64-linux-android` for Android x86 64 bit -The paths are automatically configured and no other options are needed unless targeting [Android](#Android). +The paths are automatically configured and no other options are needed unless targeting [Android](../doc/build-android.md). ### Install the required dependencies: Ubuntu & Debian @@ -129,18 +129,6 @@ options will be passed to Dash Core's configure. In this case, `--disable-wallet download-linux: run 'make download-linux' to fetch all sources needed for linux builds -### Android - -Before proceeding with an Android build one needs to get the [Android SDK](https://developer.android.com/studio) and use the "SDK Manager" tool to download the NDK and one or more "Platform packages" (these are Android versions and have a corresponding API level). -In order to build `ANDROID_API_LEVEL` (API level corresponding to the Android version targeted, e.g. Android 9.0 Pie is 28 and its "Platform package" needs to be available) and `ANDROID_TOOLCHAIN_BIN` (path to toolchain binaries depending on the platform the build is being performed on) need to be set. - -API levels from 24 to 29 have been tested to work. - -If the build includes Qt, environment variables `ANDROID_SDK` and `ANDROID_NDK` need to be set as well but can otherwise be omitted. -This is an example command for a default build with no disabled dependencies: - - ANDROID_SDK=/home/user/Android/Sdk ANDROID_NDK=/home/user/Android/Sdk/ndk-bundle make HOST=aarch64-linux-android ANDROID_API_LEVEL=28 ANDROID_TOOLCHAIN_BIN=/home/user/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin - ### Other documentation - [description.md](description.md): General description of the depends system diff --git a/depends/hosts/android.mk b/depends/hosts/android.mk index eabd84bbbe..fcc1c4f5c3 100644 --- a/depends/hosts/android.mk +++ b/depends/hosts/android.mk @@ -1,12 +1,11 @@ ifeq ($(HOST),armv7a-linux-android) -android_AR=$(ANDROID_TOOLCHAIN_BIN)/arm-linux-androideabi-ar android_CXX=$(ANDROID_TOOLCHAIN_BIN)/$(HOST)eabi$(ANDROID_API_LEVEL)-clang++ android_CC=$(ANDROID_TOOLCHAIN_BIN)/$(HOST)eabi$(ANDROID_API_LEVEL)-clang -android_RANLIB=$(ANDROID_TOOLCHAIN_BIN)/arm-linux-androideabi-ranlib else -android_AR=$(ANDROID_TOOLCHAIN_BIN)/$(HOST)-ar android_CXX=$(ANDROID_TOOLCHAIN_BIN)/$(HOST)$(ANDROID_API_LEVEL)-clang++ android_CC=$(ANDROID_TOOLCHAIN_BIN)/$(HOST)$(ANDROID_API_LEVEL)-clang -android_RANLIB=$(ANDROID_TOOLCHAIN_BIN)/$(HOST)-ranlib endif +android_AR=$(ANDROID_TOOLCHAIN_BIN)/llvm-ar +android_RANLIB=$(ANDROID_TOOLCHAIN_BIN)/llvm-ranlib + android_cmake_system=Android From d2b8c6bbc9436cfb2f2bbdf52ea6902950f7536f Mon Sep 17 00:00:00 2001 From: laanwj <126646+laanwj@users.noreply.github.com> Date: Thu, 14 Apr 2022 19:36:34 +0200 Subject: [PATCH 02/12] Merge bitcoin/bitcoin#19952: build, ci: Add file-based logging for individual packages 86c2889518df0234b8b28112a9771b85c577eefd ci: Make log verbose in error case only (Hennadii Stepanov) 7f650883b71b67cd33026cf49af0b16f01e45541 depends: Add file-based logging for individual packages (Hennadii Stepanov) Pull request description: This PR adds file-based logging for individual packages in depends. To use this feature one should provide `LOG=1`. A log file is printed out automatically in case of a build error. After successful build log files are being moved along with package archives: ``` $ make -C depends HOST=x86_64-w64-mingw32 LOG=1 $ find ./depends/built/x86_64-w64-mingw32 -name '*.log' | sort ./depends/built/x86_64-w64-mingw32/bdb/bdb-4.8.30-5100a099801.log ./depends/built/x86_64-w64-mingw32/boost/boost-1_71_0-313f82dc7de.log ./depends/built/x86_64-w64-mingw32/libevent/libevent-2.1.12-stable-3fa27048d5e.log ./depends/built/x86_64-w64-mingw32/libnatpmp/libnatpmp-4536032ae32268a45c073a4d5e91bbab4534773a-9db4850dd32.log ./depends/built/x86_64-w64-mingw32/miniupnpc/miniupnpc-2.2.2-75d9a1807e0.log ./depends/built/x86_64-w64-mingw32/native_b2/native_b2-1_71_0-3bf253c19bf.log ./depends/built/x86_64-w64-mingw32/qrencode/qrencode-3.4.4-dfac87af599.log ./depends/built/x86_64-w64-mingw32/qt/qt-5.15.2-9304e03d3ac.log ./depends/built/x86_64-w64-mingw32/sqlite/sqlite-3320100-455acafa7be.log ./depends/built/x86_64-w64-mingw32/zeromq/zeromq-4.3.1-5ff627ec84a.log ``` An example of CI tasks with package build errors -- https://cirrus-ci.com/task/5275741788045312 Closes #16368. ACKs for top commit: laanwj: Tested ACK 86c2889518df0234b8b28112a9771b85c577eefd Tree-SHA512: 497f2146fd2e38c952124aecfd80ebb42be22bbc5dc59521491545f4465fc38f23da7787a0caea5686b7c30aa862f2b0c02092ae3fe863e80a5ddd14b3d324b9 --- ci/test/05_before_script.sh | 2 +- depends/Makefile | 2 +- depends/README.md | 5 ++++- depends/funcs.mk | 16 +++++++++++----- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/ci/test/05_before_script.sh b/ci/test/05_before_script.sh index d93e8eae37..578847c4f7 100755 --- a/ci/test/05_before_script.sh +++ b/ci/test/05_before_script.sh @@ -33,7 +33,7 @@ if [ -z "$NO_DEPENDS" ]; then else SHELL_OPTS="CONFIG_SHELL=" fi - DOCKER_EXEC $SHELL_OPTS make $MAKEJOBS -C depends HOST=$HOST $DEP_OPTS + DOCKER_EXEC $SHELL_OPTS make $MAKEJOBS -C depends HOST=$HOST $DEP_OPTS LOG=1 fi if [ -n "$PREVIOUS_RELEASES_TO_DOWNLOAD" ]; then DOCKER_EXEC test/get_previous_releases.py -b -t "$PREVIOUS_RELEASES_DIR" "${PREVIOUS_RELEASES_TO_DOWNLOAD}" diff --git a/depends/Makefile b/depends/Makefile index 5f427bb2e3..2c77f8bb88 100644 --- a/depends/Makefile +++ b/depends/Makefile @@ -271,7 +271,7 @@ clean-all: clean @rm -rf $(SOURCES_PATH) x86_64* i686* mips* arm* aarch64* powerpc* riscv32* riscv64* s390x* clean: - @rm -rf $(WORK_PATH) $(BASE_CACHE) $(BUILD) + @rm -rf $(WORK_PATH) $(BASE_CACHE) $(BUILD) *.log install: check-packages $(host_prefix)/share/config.site diff --git a/depends/README.md b/depends/README.md index ec0c60ba43..c0197d171a 100644 --- a/depends/README.md +++ b/depends/README.md @@ -116,7 +116,10 @@ The following can be set when running make: `make FOO=bar` - `BUILD_ID_SALT`: Optional salt to use when generating build package ids - `FORCE_USE_SYSTEM_CLANG`: (EXPERTS ONLY) When cross-compiling for macOS, use Clang found in the system's `$PATH` rather than the default prebuilt release of Clang - from llvm.org. Clang 8 or later is required. + from llvm.org. Clang 8 or later is required +- `LOG`: Use file-based logging for individual packages. During a package build its log file + resides in the `depends` directory, and the log file is printed out automatically in case + of build error. After successful build log files are moved along with package archives If some packages are not built, for example `make NO_WALLET=1`, the appropriate options will be passed to Dash Core's configure. In this case, `--disable-wallet`. diff --git a/depends/funcs.mk b/depends/funcs.mk index 14450150c2..10a3366b98 100644 --- a/depends/funcs.mk +++ b/depends/funcs.mk @@ -67,6 +67,7 @@ $(1)_cached_checksum:=$(BASE_CACHE)/$(host)/$(1)/$(1)-$($(1)_version)-$($(1)_bui $(1)_patch_dir:=$(base_build_dir)/$(host)/$(1)/$($(1)_version)-$($(1)_build_id)/.patches-$($(1)_build_id) $(1)_prefixbin:=$($($(1)_type)_prefix)/bin/ $(1)_cached:=$(BASE_CACHE)/$(host)/$(1)/$(1)-$($(1)_version)-$($(1)_build_id).tar.gz +$(1)_build_log:=$(BASEDIR)/$(1)-$($(1)_version)-$($(1)_build_id).log $(1)_all_sources=$($(1)_file_name) $($(1)_extra_sources) #stamps @@ -85,7 +86,7 @@ $(1)_download_path_fixed=$(subst :,\:,$$($(1)_download_path)) # The default behavior for tar will try to set ownership when running as uid 0 and may not succeed, --no-same-owner disables this behavior $(1)_fetch_cmds ?= $(call fetch_file,$(1),$(subst \:,:,$$($(1)_download_path_fixed)),$$($(1)_download_file),$($(1)_file_name),$($(1)_sha256_hash)) $(1)_extract_cmds ?= mkdir -p $$($(1)_extract_dir) && echo "$$($(1)_sha256_hash) $$($(1)_source)" > $$($(1)_extract_dir)/.$$($(1)_file_name).hash && $(build_SHA256SUM) -c $$($(1)_extract_dir)/.$$($(1)_file_name).hash && $(build_TAR) --no-same-owner --strip-components=1 -xf $$($(1)_source) -$(1)_preprocess_cmds ?= +$(1)_preprocess_cmds ?= true $(1)_build_cmds ?= $(1)_config_cmds ?= $(1)_stage_cmds ?= @@ -187,6 +188,10 @@ endif endef define int_add_cmds +ifneq ($(LOG),) +$(1)_logging = >>$$($(1)_build_log) 2>&1 || { if test -f $$($(1)_build_log); then cat $$($(1)_build_log); fi; exit 1; } +endif + $($(1)_fetched): mkdir -p $$(@D) $(SOURCES_PATH) rm -f $$@ @@ -203,23 +208,23 @@ $($(1)_preprocessed): | $($(1)_extracted) echo Preprocessing $(1)... mkdir -p $$(@D) $($(1)_patch_dir) $(foreach patch,$($(1)_patches),cd $(PATCHES_PATH)/$(1); cp $(patch) $($(1)_patch_dir) ;) - cd $$(@D); $($(1)_preprocess_cmds) + { cd $$(@D); $($(1)_preprocess_cmds); } $$($(1)_logging) touch $$@ $($(1)_configured): | $($(1)_dependencies) $($(1)_preprocessed) echo Configuring $(1)... rm -rf $(host_prefix); mkdir -p $(host_prefix)/lib; cd $(host_prefix); $(foreach package,$($(1)_all_dependencies), $(build_TAR) --no-same-owner -xf $($(package)_cached); ) mkdir -p $$(@D) - +cd $$(@D); $($(1)_config_env) $($(1)_config_cmds) + +{ cd $$(@D); $($(1)_config_env) $($(1)_config_cmds); } $$($(1)_logging) touch $$@ $($(1)_built): | $($(1)_configured) echo Building $(1)... mkdir -p $$(@D) - +cd $$(@D); $($(1)_build_env) $($(1)_build_cmds) + +{ cd $$(@D); $($(1)_build_env) $($(1)_build_cmds); } $$($(1)_logging) touch $$@ $($(1)_staged): | $($(1)_built) echo Staging $(1)... mkdir -p $($(1)_staging_dir)/$(host_prefix) - cd $($(1)_build_dir); $($(1)_stage_env) $($(1)_stage_cmds) + +{ cd $($(1)_build_dir); $($(1)_stage_env) $($(1)_stage_cmds); } $$($(1)_logging) rm -rf $($(1)_extract_dir) touch $$@ $($(1)_postprocessed): | $($(1)_staged) @@ -233,6 +238,7 @@ $($(1)_cached): | $($(1)_dependencies) $($(1)_postprocessed) rm -rf $$(@D) && mkdir -p $$(@D) mv $$($(1)_staging_dir)/$$(@F) $$(@) rm -rf $($(1)_staging_dir) + if test -f $($(1)_build_log); then mv $($(1)_build_log) $$(@D); fi $($(1)_cached_checksum): $($(1)_cached) cd $$(@D); $(build_SHA256SUM) $$( $$(@) From 685b7a7a1ba2abd4ae768a8df3e0794e527024c0 Mon Sep 17 00:00:00 2001 From: laanwj <126646+laanwj@users.noreply.github.com> Date: Tue, 14 Jun 2022 20:06:03 +0200 Subject: [PATCH 03/12] Merge bitcoin/bitcoin#23611: build: add `LTO` option to depends 094772656d71b3f5022ae292094e878da035de9e build: support LTO in depends (fanquake) Pull request description: This adds an `LTO` option to depends, i.e `make -C depends LTO=1`, which passes `-flto` when building packages (not currently qt), and automatically configures with `--enable-lto` when doing a build using a `CONFIG_SITE`. The following tables comapres the size (in bytes) of the stripped `x86_64` Linux binaries produced with master and this PR (full depends build): | Binary | stripped master | stripped LTO=1 | saving | | -------- | ----------------: | -------------: | --------: | | bitcoin-cli | 1178632 | 469872 | 60% | | bitcoin-tx | 2710584 | 1866504 | 31% | | bitcoin-util | 952880 | 240104 | 74% | | bitcoin-wallet | 7992888 | 5365984 | 32% | | bitcoind | 13421336 | 11868592 | 12% | | bitcoin-qt | 37680496 | 31640976 | 16% | ACKs for top commit: laanwj: Tested ACK 094772656d71b3f5022ae292094e878da035de9e Tree-SHA512: 6b8483ea490e57a153105ad8c38b25fb1af5d55b1af22db398c7c2573612aaf71b4d2b4cf09c18fd6331b1358dba01641eeaa03e5018a925392e1937118d984a --- depends/Makefile | 6 ++++-- depends/README.md | 1 + depends/config.site.in | 4 ++++ depends/gen_id | 6 +++++- depends/hosts/android.mk | 6 ++++++ depends/hosts/darwin.mk | 6 ++++++ depends/hosts/freebsd.mk | 6 ++++++ depends/hosts/linux.mk | 6 ++++++ depends/hosts/mingw32.mk | 6 ++++++ depends/hosts/netbsd.mk | 6 ++++++ depends/hosts/openbsd.mk | 5 +++++ 11 files changed, 55 insertions(+), 3 deletions(-) diff --git a/depends/Makefile b/depends/Makefile index 2c77f8bb88..e2edd9b28e 100644 --- a/depends/Makefile +++ b/depends/Makefile @@ -42,6 +42,7 @@ NO_UPNP ?= NO_USDT ?= NO_NATPMP ?= MULTIPROCESS ?= +LTO ?= FALLBACK_DOWNLOAD_PATH ?= http://dash-depends-sources.s3-website-us-west-2.amazonaws.com BUILD = $(shell ./config.guess) @@ -140,8 +141,8 @@ include packages/packages.mk # 2. Before including packages/*.mk (excluding packages/packages.mk), since # they rely on the build_id variables # -build_id:=$(shell env CC='$(build_CC)' CXX='$(build_CXX)' AR='$(build_AR)' RANLIB='$(build_RANLIB)' STRIP='$(build_STRIP)' SHA256SUM='$(build_SHA256SUM)' DEBUG='$(DEBUG)' ./gen_id '$(BUILD_ID_SALT)' 'GUIX_ENVIRONMENT=$(realpath $(GUIX_ENVIRONMENT))') -$(host_arch)_$(host_os)_id:=$(shell env CC='$(host_CC)' CXX='$(host_CXX)' AR='$(host_AR)' RANLIB='$(host_RANLIB)' STRIP='$(host_STRIP)' SHA256SUM='$(build_SHA256SUM)' DEBUG='$(DEBUG)' ./gen_id '$(HOST_ID_SALT)' 'GUIX_ENVIRONMENT=$(realpath $(GUIX_ENVIRONMENT))') +build_id:=$(shell env CC='$(build_CC)' CXX='$(build_CXX)' AR='$(build_AR)' RANLIB='$(build_RANLIB)' STRIP='$(build_STRIP)' SHA256SUM='$(build_SHA256SUM)' DEBUG='$(DEBUG)' LTO='$(LTO)' ./gen_id '$(BUILD_ID_SALT)' 'GUIX_ENVIRONMENT=$(realpath $(GUIX_ENVIRONMENT))') +$(host_arch)_$(host_os)_id:=$(shell env CC='$(host_CC)' CXX='$(host_CXX)' AR='$(host_AR)' RANLIB='$(host_RANLIB)' STRIP='$(host_STRIP)' SHA256SUM='$(build_SHA256SUM)' DEBUG='$(DEBUG)' LTO='$(LTO)' ./gen_id '$(HOST_ID_SALT)' 'GUIX_ENVIRONMENT=$(realpath $(GUIX_ENVIRONMENT))') qrencode_packages_$(NO_QR) = $(qrencode_$(host_os)_packages) @@ -239,6 +240,7 @@ $(host_prefix)/share/config.site : config.site.in $(host_prefix)/.stamp_$(final_ -e 's|@no_usdt@|$(NO_USDT)|' \ -e 's|@no_natpmp@|$(NO_NATPMP)|' \ -e 's|@multiprocess@|$(MULTIPROCESS)|' \ + -e 's|@lto@|$(LTO)|' \ -e 's|@debug@|$(DEBUG)|' \ $< > $@ touch $@ diff --git a/depends/README.md b/depends/README.md index c0197d171a..988c2f16f4 100644 --- a/depends/README.md +++ b/depends/README.md @@ -120,6 +120,7 @@ The following can be set when running make: `make FOO=bar` - `LOG`: Use file-based logging for individual packages. During a package build its log file resides in the `depends` directory, and the log file is printed out automatically in case of build error. After successful build log files are moved along with package archives +- `LTO`: Use LTO when building packages. If some packages are not built, for example `make NO_WALLET=1`, the appropriate options will be passed to Dash Core's configure. In this case, `--disable-wallet`. diff --git a/depends/config.site.in b/depends/config.site.in index bcfc2af171..ec78db0cf3 100644 --- a/depends/config.site.in +++ b/depends/config.site.in @@ -78,6 +78,10 @@ if test "@host_os@" = darwin; then BREW=no fi +if test -z "$enable_lto" && test -n "@lto@"; then + enable_lto=yes +fi + PATH="${depends_prefix}/native/bin:${PATH}" PKG_CONFIG="$(which pkg-config) --static" diff --git a/depends/gen_id b/depends/gen_id index ac69ca7ee1..a0cd586461 100755 --- a/depends/gen_id +++ b/depends/gen_id @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Usage: env [ CC=... ] [ CXX=... ] [ AR=... ] [ RANLIB=... ] [ STRIP=... ] \ -# [ DEBUG=... ] ./build-id [ID_SALT]... +# [ DEBUG=... ] [ LTO=... ] ./build-id [ID_SALT]... # # Prints to stdout a SHA256 hash representing the current toolset, used by # depends/Makefile as a build id for caching purposes (detecting when the @@ -63,6 +63,10 @@ env | grep '^STRIP_' echo "END STRIP" + echo "BEGIN LTO" + echo "LTO=${LTO}" + echo "END LTO" + echo "END ALL" ) | if [ -n "$DEBUG" ] && command -v tee > /dev/null 2>&1; then # When debugging and `tee` is available, output the preimage to stderr diff --git a/depends/hosts/android.mk b/depends/hosts/android.mk index fcc1c4f5c3..9029355460 100644 --- a/depends/hosts/android.mk +++ b/depends/hosts/android.mk @@ -5,6 +5,12 @@ else android_CXX=$(ANDROID_TOOLCHAIN_BIN)/$(HOST)$(ANDROID_API_LEVEL)-clang++ android_CC=$(ANDROID_TOOLCHAIN_BIN)/$(HOST)$(ANDROID_API_LEVEL)-clang endif + +ifneq ($(LTO),) +android_CFLAGS += -flto +android_LDFLAGS += -flto +endif + android_AR=$(ANDROID_TOOLCHAIN_BIN)/llvm-ar android_RANLIB=$(ANDROID_TOOLCHAIN_BIN)/llvm-ranlib diff --git a/depends/hosts/darwin.mk b/depends/hosts/darwin.mk index e470d2d285..926cade63a 100644 --- a/depends/hosts/darwin.mk +++ b/depends/hosts/darwin.mk @@ -113,6 +113,12 @@ darwin_CXX=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \ -Xclang -internal-externc-isystem$(OSX_SDK)/usr/include darwin_CFLAGS=-pipe + +ifneq ($(LTO),) +darwin_CFLAGS += -flto +darwin_LDFLAGS += -flto +endif + darwin_CXXFLAGS=$(darwin_CFLAGS) darwin_release_CFLAGS=-O2 diff --git a/depends/hosts/freebsd.mk b/depends/hosts/freebsd.mk index 0a62347b57..853fa0f457 100644 --- a/depends/hosts/freebsd.mk +++ b/depends/hosts/freebsd.mk @@ -1,4 +1,10 @@ freebsd_CFLAGS=-pipe + +ifneq ($(LTO),) +freebsd_CFLAGS += -flto +freebsd_LDFLAGS += -flto +endif + freebsd_CXXFLAGS=$(freebsd_CFLAGS) freebsd_release_CFLAGS=-O2 diff --git a/depends/hosts/linux.mk b/depends/hosts/linux.mk index 07da752492..5322520e6f 100644 --- a/depends/hosts/linux.mk +++ b/depends/hosts/linux.mk @@ -1,4 +1,10 @@ linux_CFLAGS=-pipe + +ifneq ($(LTO),) +linux_CFLAGS += -flto +linux_LDFLAGS += -flto +endif + linux_CXXFLAGS=$(linux_CFLAGS) linux_release_CFLAGS=-O2 diff --git a/depends/hosts/mingw32.mk b/depends/hosts/mingw32.mk index 48020d71af..979280b5cb 100644 --- a/depends/hosts/mingw32.mk +++ b/depends/hosts/mingw32.mk @@ -3,6 +3,12 @@ mingw32_CXX := $(host)-g++-posix endif mingw32_CFLAGS=-pipe + +ifneq ($(LTO),) +mingw32_CFLAGS += -flto +mingw32_LDFLAGS += -flto +endif + mingw32_CXXFLAGS=$(mingw32_CFLAGS) mingw32_release_CFLAGS=-O2 diff --git a/depends/hosts/netbsd.mk b/depends/hosts/netbsd.mk index b3e4545a64..9e48248b7e 100644 --- a/depends/hosts/netbsd.mk +++ b/depends/hosts/netbsd.mk @@ -1,4 +1,10 @@ netbsd_CFLAGS=-pipe + +ifneq ($(LTO),) +netbsd_CFLAGS += -flto +netbsd_LDFLAGS += -flto +endif + netbsd_CXXFLAGS=$(netbsd_CFLAGS) netbsd_release_CFLAGS=-O2 diff --git a/depends/hosts/openbsd.mk b/depends/hosts/openbsd.mk index 5988f24bff..c4a629e021 100644 --- a/depends/hosts/openbsd.mk +++ b/depends/hosts/openbsd.mk @@ -1,6 +1,11 @@ openbsd_CFLAGS=-pipe openbsd_CXXFLAGS=$(openbsd_CFLAGS) +ifneq ($(LTO),) +openbsd_CFLAGS += -flto +openbsd_LDFLAGS += -flto +endif + openbsd_release_CFLAGS=-O2 openbsd_release_CXXFLAGS=$(openbsd_release_CFLAGS) From e2b24461d458f956063948f9a4386a06ac3d9bd3 Mon Sep 17 00:00:00 2001 From: merge-script Date: Mon, 22 Jul 2024 17:49:27 +0100 Subject: [PATCH 04/12] Merge bitcoin/bitcoin#29723: depends: build zeromq with CMake 0388ad0d65b6c9ee802ca641eb01d69fcdd5605d depends: switch zmq to CMake (Cory Fields) fefb3bbe5b538f8faa59de191914ad0c22c3ade6 depends: add zeromq no librt patch (fanquake) a522ef15424110f76172b3c0603fa08f7291c9fc depends: add zeromq cmake minimum patch (fanquake) cbbc229adf4c12ad4bd7edde71425b8ef217edfc depends: add zeromq windows usage patch (fanquake) 2de68d6d388b9a33c57234d3161f6ffc4c2a0246 depends: add zeromq builtin sha1 patch (fanquake) 0c8605253ae887dac316264cb969b752027d277a depends: add zeromq mktemp macos patch (fanquake) Pull request description: This picks up a change, which is a switch to building zeromq with CMake. It includes a number of patches, some which have already been upstreamed (see each patch for details). ACKs for top commit: hebasto: ACK 0388ad0d65b6c9ee802ca641eb01d69fcdd5605d. Tree-SHA512: 5567e432b4e4e0446c41d502bd61810a80b329dea2399b5d9d9f6e79acc450d1c6ba861c8238ba895de98338cfc5dc44ad2bf86ee8c222ecb3fbf47d6eb60da4 --- depends/packages/zeromq.mk | 34 +++++++----- depends/patches/zeromq/builtin_sha1.patch | 17 ++++++ depends/patches/zeromq/cmake_minimum.patch | 18 +++++++ depends/patches/zeromq/fix_have_windows.patch | 54 +++++++++++++++++++ .../patches/zeromq/macos_mktemp_check.patch | 16 ++++++ depends/patches/zeromq/no_librt.patch | 54 +++++++++++++++++++ 6 files changed, 181 insertions(+), 12 deletions(-) create mode 100644 depends/patches/zeromq/builtin_sha1.patch create mode 100644 depends/patches/zeromq/cmake_minimum.patch create mode 100644 depends/patches/zeromq/fix_have_windows.patch create mode 100644 depends/patches/zeromq/macos_mktemp_check.patch create mode 100644 depends/patches/zeromq/no_librt.patch diff --git a/depends/packages/zeromq.mk b/depends/packages/zeromq.mk index 82119f866a..7f44f1980e 100644 --- a/depends/packages/zeromq.mk +++ b/depends/packages/zeromq.mk @@ -3,33 +3,43 @@ $(package)_version=4.3.5 $(package)_download_path=https://github.com/zeromq/libzmq/releases/download/v$($(package)_version)/ $(package)_file_name=$(package)-$($(package)_version).tar.gz $(package)_sha256_hash=6653ef5910f17954861fe72332e68b03ca6e4d9c7160eb3a8de5a5a913bfab43 -$(package)_patches=remove_libstd_link.patch +$(package)_build_subdir=build +$(package)_patches = remove_libstd_link.patch +$(package)_patches += macos_mktemp_check.patch +$(package)_patches += builtin_sha1.patch +$(package)_patches += fix_have_windows.patch +$(package)_patches += cmake_minimum.patch +$(package)_patches += no_librt.patch define $(package)_set_vars - $(package)_config_opts = --without-docs --disable-shared --disable-valgrind - $(package)_config_opts += --disable-perf --disable-curve-keygen --disable-curve --disable-libbsd - $(package)_config_opts += --without-libsodium --without-libgssapi_krb5 --without-pgm --without-norm --without-vmci - $(package)_config_opts += --disable-libunwind --disable-radix-tree --without-gcov --disable-dependency-tracking - $(package)_config_opts += --disable-Werror --disable-drafts --enable-option-checking + $(package)_config_opts := -DCMAKE_BUILD_TYPE=None -DWITH_DOCS=OFF -DWITH_LIBSODIUM=OFF + $(package)_config_opts += -DWITH_LIBBSD=OFF -DENABLE_CURVE=OFF -DENABLE_CPACK=OFF + $(package)_config_opts += -DBUILD_SHARED=OFF -DBUILD_TESTS=OFF -DZMQ_BUILD_TESTS=OFF + $(package)_config_opts += -DENABLE_DRAFTS=OFF -DZMQ_BUILD_TESTS=OFF + $(package)_cxxflags += -ffile-prefix-map=$($(package)_extract_dir)=/usr + $(package)_config_opts_mingw32 += -DZMQ_WIN32_WINNT=0x0601 -DZMQ_HAVE_IPC=OFF $(package)_cxxflags+=-std=c++17 endef define $(package)_preprocess_cmds - patch -p1 < $($(package)_patch_dir)/remove_libstd_link.patch + patch -p1 < $($(package)_patch_dir)/remove_libstd_link.patch && \ + patch -p1 < $($(package)_patch_dir)/macos_mktemp_check.patch && \ + patch -p1 < $($(package)_patch_dir)/builtin_sha1.patch && \ + patch -p1 < $($(package)_patch_dir)/fix_have_windows.patch && \ + patch -p1 < $($(package)_patch_dir)/cmake_minimum.patch && \ + patch -p1 < $($(package)_patch_dir)/no_librt.patch endef define $(package)_config_cmds - ./autogen.sh && \ - cp -f $(BASEDIR)/config.guess $(BASEDIR)/config.sub config && \ - $($(package)_autoconf) + $($(package)_cmake) -S .. -B . endef define $(package)_build_cmds - $(MAKE) src/libzmq.la + $(MAKE) endef define $(package)_stage_cmds - $(MAKE) DESTDIR=$($(package)_staging_dir) install-libLTLIBRARIES install-includeHEADERS install-pkgconfigDATA + $(MAKE) DESTDIR=$($(package)_staging_dir) install endef define $(package)_postprocess_cmds diff --git a/depends/patches/zeromq/builtin_sha1.patch b/depends/patches/zeromq/builtin_sha1.patch new file mode 100644 index 0000000000..5481c9dbdd --- /dev/null +++ b/depends/patches/zeromq/builtin_sha1.patch @@ -0,0 +1,17 @@ +Don't use builtin sha1 if not using ws + +The builtin SHA1 (ZMQ_USE_BUILTIN_SHA1) is only used in the websocket +engine (ws_engine.cpp). +Upstreamed in https://github.com/zeromq/libzmq/pull/4670. + +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -234,7 +234,7 @@ if(NOT ZMQ_USE_GNUTLS) + endif() + endif() + endif() +- if(NOT ZMQ_USE_NSS) ++ if(ENABLE_WS AND NOT ZMQ_USE_NSS) + list(APPEND sources ${CMAKE_CURRENT_SOURCE_DIR}/external/sha1/sha1.c + ${CMAKE_CURRENT_SOURCE_DIR}/external/sha1/sha1.h) + message(STATUS "Using builtin sha1") diff --git a/depends/patches/zeromq/cmake_minimum.patch b/depends/patches/zeromq/cmake_minimum.patch new file mode 100644 index 0000000000..d6b6b5fae7 --- /dev/null +++ b/depends/patches/zeromq/cmake_minimum.patch @@ -0,0 +1,18 @@ +Set a more sane cmake_minimum_required. + +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,12 +1,7 @@ + # CMake build script for ZeroMQ ++cmake_minimum_required(VERSION 3.16) + project(ZeroMQ) + +-if(${CMAKE_SYSTEM_NAME} STREQUAL Darwin) +- cmake_minimum_required(VERSION 3.0.2) +-else() +- cmake_minimum_required(VERSION 2.8.12) +-endif() +- + include(CheckIncludeFiles) + include(CheckCCompilerFlag) + include(CheckCXXCompilerFlag) diff --git a/depends/patches/zeromq/fix_have_windows.patch b/depends/patches/zeromq/fix_have_windows.patch new file mode 100644 index 0000000000..e77ef31adf --- /dev/null +++ b/depends/patches/zeromq/fix_have_windows.patch @@ -0,0 +1,54 @@ +This fixes several instances where _MSC_VER was +used to determine whether to use afunix.h or not. + +See https://github.com/zeromq/libzmq/pull/4678. +--- a/src/ipc_address.hpp ++++ b/src/ipc_address.hpp +@@ -7,7 +7,7 @@ + + #include + +-#if defined _MSC_VER ++#if defined ZMQ_HAVE_WINDOWS + #include + #else + #include +diff --git a/src/ipc_connecter.cpp b/src/ipc_connecter.cpp +index 3f988745..ed2a0645 100644 +--- a/src/ipc_connecter.cpp ++++ b/src/ipc_connecter.cpp +@@ -16,7 +16,7 @@ + #include "ipc_address.hpp" + #include "session_base.hpp" + +-#ifdef _MSC_VER ++#if defined ZMQ_HAVE_WINDOWS + #include + #else + #include +diff --git a/src/ipc_listener.cpp b/src/ipc_listener.cpp +index 50126040..5428579b 100644 +--- a/src/ipc_listener.cpp ++++ b/src/ipc_listener.cpp +@@ -17,7 +17,7 @@ + #include "socket_base.hpp" + #include "address.hpp" + +-#ifdef _MSC_VER ++#ifdef ZMQ_HAVE_WINDOWS + #ifdef ZMQ_IOTHREAD_POLLER_USE_SELECT + #error On Windows, IPC does not work with POLLER=select, use POLLER=epoll instead, or disable IPC transport + #endif +diff --git a/tests/testutil.cpp b/tests/testutil.cpp +index bdc80283..6f21e8f6 100644 +--- a/tests/testutil.cpp ++++ b/tests/testutil.cpp +@@ -7,7 +7,7 @@ + + #if defined _WIN32 + #include "../src/windows.hpp" +-#if defined _MSC_VER ++#if defined ZMQ_HAVE_WINDOWS + #if defined ZMQ_HAVE_IPC + #include + #include diff --git a/depends/patches/zeromq/macos_mktemp_check.patch b/depends/patches/zeromq/macos_mktemp_check.patch new file mode 100644 index 0000000000..c703abcd71 --- /dev/null +++ b/depends/patches/zeromq/macos_mktemp_check.patch @@ -0,0 +1,16 @@ +build: fix mkdtemp check on macOS + +On macOS, mkdtemp is in unistd.h. Fix the CMake check so that is works. +Upstreamed in https://github.com/zeromq/libzmq/pull/4668. + +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -599,7 +599,7 @@ if(NOT MSVC) + + check_cxx_symbol_exists(fork unistd.h HAVE_FORK) + check_cxx_symbol_exists(gethrtime sys/time.h HAVE_GETHRTIME) +- check_cxx_symbol_exists(mkdtemp stdlib.h HAVE_MKDTEMP) ++ check_cxx_symbol_exists(mkdtemp "stdlib.h;unistd.h" HAVE_MKDTEMP) + check_cxx_symbol_exists(accept4 sys/socket.h HAVE_ACCEPT4) + check_cxx_symbol_exists(strnlen string.h HAVE_STRNLEN) + else() diff --git a/depends/patches/zeromq/no_librt.patch b/depends/patches/zeromq/no_librt.patch new file mode 100644 index 0000000000..b63854c95b --- /dev/null +++ b/depends/patches/zeromq/no_librt.patch @@ -0,0 +1,54 @@ +We don't use librt, so don't try and link against it. + +Related to: https://github.com/zeromq/libzmq/pull/4702. + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 03462271..87ceab3c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -564,13 +564,6 @@ else() + check_cxx_symbol_exists(SO_BUSY_POLL sys/socket.h ZMQ_HAVE_BUSY_POLL) + endif() + +-if(NOT MINGW) +- find_library(RT_LIBRARY rt) +- if(RT_LIBRARY) +- set(pkg_config_libs_private "${pkg_config_libs_private} -lrt") +- endif() +-endif() +- + find_package(Threads) + + if(WIN32 AND NOT CYGWIN) +@@ -588,9 +581,7 @@ if(WIN32 AND NOT CYGWIN) + endif() + + if(NOT MSVC) +- set(CMAKE_REQUIRED_LIBRARIES rt) + check_cxx_symbol_exists(clock_gettime time.h HAVE_CLOCK_GETTIME) +- set(CMAKE_REQUIRED_LIBRARIES) + + check_cxx_symbol_exists(fork unistd.h HAVE_FORK) + check_cxx_symbol_exists(gethrtime sys/time.h HAVE_GETHRTIME) +@@ -1503,10 +1494,6 @@ if(BUILD_SHARED) + target_link_libraries(libzmq iphlpapi) + endif() + +- if(RT_LIBRARY) +- target_link_libraries(libzmq -lrt) +- endif() +- + if(norm_FOUND) + target_link_libraries(libzmq norm::norm) + endif() +@@ -1553,10 +1540,6 @@ if(BUILD_STATIC) + target_link_libraries(libzmq-static iphlpapi) + endif() + +- if(RT_LIBRARY) +- target_link_libraries(libzmq-static -lrt) +- endif() +- + if(CMAKE_SYSTEM_NAME MATCHES "QNX") + add_definitions(-DUNITY_EXCLUDE_MATH_H) + endif() From 02aee122de503015157791f73d79a24377cff9b1 Mon Sep 17 00:00:00 2001 From: merge-script Date: Wed, 28 Aug 2024 12:18:14 +0100 Subject: [PATCH 05/12] Merge bitcoin/bitcoin#30508: depends: Fix CMake-generated `libzmq.pc` file 371910a7682ecdaf86b3e65753667746add1ecd2 depends: Fix CMake-generated `libzmq.pc` file (Hennadii Stepanov) Pull request description: This is a backport of: https://github.com/zeromq/libzmq/pull/4706. Similar to https://github.com/bitcoin/bitcoin/pull/30488. Addresses https://github.com/bitcoin/bitcoin/pull/29723#issuecomment-2239864170: > Looking at the mingw .pc generated by this PR: > > ``` > Libs: -L${libdir} -lzmq > Libs.private: > Requires.private: > ``` > > It looks like we'll need to take [zeromq/libzmq#4706](https://github.com/zeromq/libzmq/pull/4706) as well for CMake. That can be done as a follow-up though, as it's not yet merged upstream. ACKs for top commit: fanquake: ACK 371910a7682ecdaf86b3e65753667746add1ecd2 Tree-SHA512: 6f9c2e32f83c0e629e32fd3e4c86712af00ffeaf0906bf85e5c2df889302707b9df102e8031249d1bae036eb4fc019c2a5124655682fbc5652d9337cb21c5f2c --- depends/packages/zeromq.mk | 4 ++- depends/patches/zeromq/fix_mingw_link.patch | 31 +++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 depends/patches/zeromq/fix_mingw_link.patch diff --git a/depends/packages/zeromq.mk b/depends/packages/zeromq.mk index 7f44f1980e..1f05cd051b 100644 --- a/depends/packages/zeromq.mk +++ b/depends/packages/zeromq.mk @@ -10,6 +10,7 @@ $(package)_patches += builtin_sha1.patch $(package)_patches += fix_have_windows.patch $(package)_patches += cmake_minimum.patch $(package)_patches += no_librt.patch +$(package)_patches += fix_mingw_link.patch define $(package)_set_vars $(package)_config_opts := -DCMAKE_BUILD_TYPE=None -DWITH_DOCS=OFF -DWITH_LIBSODIUM=OFF @@ -27,7 +28,8 @@ define $(package)_preprocess_cmds patch -p1 < $($(package)_patch_dir)/builtin_sha1.patch && \ patch -p1 < $($(package)_patch_dir)/fix_have_windows.patch && \ patch -p1 < $($(package)_patch_dir)/cmake_minimum.patch && \ - patch -p1 < $($(package)_patch_dir)/no_librt.patch + patch -p1 < $($(package)_patch_dir)/no_librt.patch && \ + patch -p1 < $($(package)_patch_dir)/fix_mingw_link.patch endef define $(package)_config_cmds diff --git a/depends/patches/zeromq/fix_mingw_link.patch b/depends/patches/zeromq/fix_mingw_link.patch new file mode 100644 index 0000000000..1434557dc7 --- /dev/null +++ b/depends/patches/zeromq/fix_mingw_link.patch @@ -0,0 +1,31 @@ +Fix CMake-generated `libzmq.pc` file + +This change mirrors the Autotools-based build system behavior for +cross-compiling for Windows with static linking. + +See https://github.com/zeromq/libzmq/pull/4706. + + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 03462271..0315e606 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -546,12 +546,18 @@ if(ZMQ_HAVE_WINDOWS) + # Cannot use check_library_exists because the symbol is always declared as char(*)(void) + set(CMAKE_REQUIRED_LIBRARIES "ws2_32.lib") + check_cxx_symbol_exists(WSAStartup "winsock2.h" HAVE_WS2_32) ++ if(HAVE_WS2_32) ++ set(pkg_config_libs_private "${pkg_config_libs_private} -lws2_32") ++ endif() + + set(CMAKE_REQUIRED_LIBRARIES "rpcrt4.lib") + check_cxx_symbol_exists(UuidCreateSequential "rpc.h" HAVE_RPCRT4) + + set(CMAKE_REQUIRED_LIBRARIES "iphlpapi.lib") + check_cxx_symbol_exists(GetAdaptersAddresses "winsock2.h;iphlpapi.h" HAVE_IPHLAPI) ++ if(HAVE_IPHLAPI) ++ set(pkg_config_libs_private "${pkg_config_libs_private} -liphlpapi") ++ endif() + check_cxx_symbol_exists(if_nametoindex "iphlpapi.h" HAVE_IF_NAMETOINDEX) + + set(CMAKE_REQUIRED_LIBRARIES "") From a2046164467414cd04957f72f3582039f46e38b9 Mon Sep 17 00:00:00 2001 From: merge-script Date: Thu, 18 Jul 2024 12:59:31 +0100 Subject: [PATCH 06/12] Merge bitcoin/bitcoin#30464: test, refactor: Fix MSVC warning C4101 "unreferenced local variable" 44f08786f435ed4284d39dc604c2a5fcbde9e602 test: Fix MSVC warning C4101 "unreferenced local variable" (Hennadii Stepanov) 5d25a82b9a5e54f74cc066599541bc1d3da70988 univalue, refactor: Convert indentation tabs to spaces (Hennadii Stepanov) Pull request description: This PR is split from https://github.com/bitcoin/bitcoin/pull/30454 and addresses MSVC warning [C4101](https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4101) "unreferenced local variable". The current MSVC build system in the master branch skips building univalue tests, so it is not affected. No behaviour changes. ACKs for top commit: kevkevinpal: utACK [44f0878](https://github.com/bitcoin/bitcoin/pull/30464/commits/44f08786f435ed4284d39dc604c2a5fcbde9e602) maflcko: ACK 44f08786f435ed4284d39dc604c2a5fcbde9e602 theuni: trivial ACK 44f08786f435ed4284d39dc604c2a5fcbde9e602. Tree-SHA512: 661d3b40ddb4f7915de7a65ccb27a24da88ae499ce03c036099007260b0597e83738f1a3a420985b51f798ee309ade32988c6d78f4ffed401099b175a0b2025b --- src/univalue/test/object.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/univalue/test/object.cpp b/src/univalue/test/object.cpp index c2f52f83ac..55510f0e0e 100644 --- a/src/univalue/test/object.cpp +++ b/src/univalue/test/object.cpp @@ -20,17 +20,17 @@ try { \ (stmt); \ assert(0 && "No exception caught"); \ - } catch (excMatch & e) { \ - } catch (...) { \ - assert(0 && "Wrong exception caught"); \ - } \ + } catch (excMatch&) { \ + } catch (...) { \ + assert(0 && "Wrong exception caught"); \ + } \ } #define BOOST_CHECK_NO_THROW(stmt) { \ try { \ (stmt); \ - } catch (...) { \ - assert(0); \ - } \ + } catch (...) { \ + assert(0); \ + } \ } BOOST_FIXTURE_TEST_SUITE(univalue_tests, BasicTestingSetup) From a27b08ed7af81dc6ee6d038d4398350122bb4a7a Mon Sep 17 00:00:00 2001 From: merge-script Date: Thu, 4 Jul 2024 14:28:16 +0100 Subject: [PATCH 07/12] Merge bitcoin/bitcoin#29835: depends: build libevent with CMake f59e9057e2aa596b54cf9e85bab35c3ead137547 depends: switch libevent to CMake (Cory Fields) Pull request description: Switches libevent in depends to be built with CMake. ACKs for top commit: TheCharlatan: ACK f59e9057e2aa596b54cf9e85bab35c3ead137547 willcl-ark: ACK f59e9057e2aa596b54cf9e85bab35c3ead137547 Tree-SHA512: 875bf9bc57653c78775a1f8192a2c964fea8f4490d733ff796d9efb00e786f0ca9a7c1a3fd610cda032273c4f2ae06394585b03567d5f241ab073c83a47cf927 --- depends/packages/libevent.mk | 14 +++++---- depends/patches/libevent/cmake_fixups.patch | 35 +++++++++++++++++++++ 2 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 depends/patches/libevent/cmake_fixups.patch diff --git a/depends/packages/libevent.mk b/depends/packages/libevent.mk index f033fc9723..423d92532a 100644 --- a/depends/packages/libevent.mk +++ b/depends/packages/libevent.mk @@ -3,23 +3,25 @@ $(package)_version=2.1.12-stable $(package)_download_path=https://github.com/libevent/libevent/releases/download/release-$($(package)_version)/ $(package)_file_name=$(package)-$($(package)_version).tar.gz $(package)_sha256_hash=92e6de1be9ec176428fd2367677e61ceffc2ee1cb119035037a27d346b0403bb +$(package)_patches=cmake_fixups.patch +$(package)_build_subdir=build # When building for Windows, we set _WIN32_WINNT to target the same Windows # version as we do in configure. Due to quirks in libevents build system, this # is also required to enable support for ipv6. See #19375. define $(package)_set_vars - $(package)_config_opts=--disable-shared --disable-openssl --disable-libevent-regress --disable-samples - $(package)_config_opts += --disable-dependency-tracking --enable-option-checking - $(package)_config_opts_release=--disable-debug-mode + $(package)_config_opts=-DEVENT__DISABLE_BENCHMARK=ON -DEVENT__DISABLE_OPENSSL=ON + $(package)_config_opts+=-DEVENT__DISABLE_SAMPLES=ON -DEVENT__DISABLE_REGRESS=ON + $(package)_config_opts+=-DEVENT__DISABLE_TESTS=ON -DEVENT__LIBRARY_TYPE=STATIC $(package)_cppflags_mingw32=-D_WIN32_WINNT=0x0601 endef define $(package)_preprocess_cmds - cp -f $(BASEDIR)/config.guess $(BASEDIR)/config.sub build-aux + patch -p1 < $($(package)_patch_dir)/cmake_fixups.patch endef define $(package)_config_cmds - $($(package)_autoconf) + $($(package)_cmake) -S .. -B . endef define $(package)_build_cmds @@ -31,7 +33,7 @@ define $(package)_stage_cmds endef define $(package)_postprocess_cmds - rm lib/*.la && \ + rm bin/event_rpcgen.py && \ rm include/ev*.h && \ rm include/event2/*_compat.h endef diff --git a/depends/patches/libevent/cmake_fixups.patch b/depends/patches/libevent/cmake_fixups.patch new file mode 100644 index 0000000000..d80c1a9489 --- /dev/null +++ b/depends/patches/libevent/cmake_fixups.patch @@ -0,0 +1,35 @@ +cmake: set minimum version to 3.5 + +Fix generated pkg-config files, see +https://github.com/libevent/libevent/pull/1165. + +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -19,7 +19,7 @@ + # start libevent.sln + # + +-cmake_minimum_required(VERSION 3.1 FATAL_ERROR) ++cmake_minimum_required(VERSION 3.5 FATAL_ERROR) + + if (POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +diff --git a/cmake/AddEventLibrary.cmake b/cmake/AddEventLibrary.cmake +index 04f5837e..d8ea42c4 100644 +--- a/cmake/AddEventLibrary.cmake ++++ b/cmake/AddEventLibrary.cmake +@@ -20,12 +20,12 @@ macro(generate_pkgconfig LIB_NAME) + + set(LIBS "") + foreach (LIB ${LIB_PLATFORM}) +- set(LIBS "${LIBS} -L${LIB}") ++ set(LIBS "${LIBS} -l${LIB}") + endforeach() + + set(OPENSSL_LIBS "") + foreach(LIB ${OPENSSL_LIBRARIES}) +- set(OPENSSL_LIBS "${OPENSSL_LIBS} -L${LIB}") ++ set(OPENSSL_LIBS "${OPENSSL_LIBS} -l${LIB}") + endforeach() + + configure_file("lib${LIB_NAME}.pc.in" "lib${LIB_NAME}.pc" @ONLY) From 24973ee34c5f0243ab38c05c064a81dcce6cb0a1 Mon Sep 17 00:00:00 2001 From: merge-script Date: Mon, 22 Jul 2024 17:59:47 +0100 Subject: [PATCH 08/12] Merge bitcoin/bitcoin#30488: depends: Fix CMake-generated `libevent*.pc` files 8c935e625ea75d180144f0526d6a0d5fd58c1f29 depends: Fix CMake-generated `libevent*.pc` files (Hennadii Stepanov) Pull request description: Broken out of #30454. This is a backport of the merged upstream PR: https://github.com/libevent/libevent/pull/1622. Note that after #29835 we might end up dropping pkg-config and using the installed CMake files directly, but that depends on whether or not enough distros actually ship those files. Either way, having fixed up .pc files won't hurt. ACKs for top commit: hebasto: ACK 8c935e625ea75d180144f0526d6a0d5fd58c1f29. fanquake: ACK 8c935e625ea75d180144f0526d6a0d5fd58c1f29 Tree-SHA512: 259c2ad78fb9e90370a7205dc71c40acda1a872f6509435133bc1c4c2c3de57366e80679aa083e13ed85e7966883dc470c0147ee171a2ed0171a18cd5ffc99b3 --- depends/packages/libevent.mk | 4 ++- depends/patches/libevent/fix_mingw_link.patch | 25 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 depends/patches/libevent/fix_mingw_link.patch diff --git a/depends/packages/libevent.mk b/depends/packages/libevent.mk index 423d92532a..12bb136ab0 100644 --- a/depends/packages/libevent.mk +++ b/depends/packages/libevent.mk @@ -4,6 +4,7 @@ $(package)_download_path=https://github.com/libevent/libevent/releases/download/ $(package)_file_name=$(package)-$($(package)_version).tar.gz $(package)_sha256_hash=92e6de1be9ec176428fd2367677e61ceffc2ee1cb119035037a27d346b0403bb $(package)_patches=cmake_fixups.patch +$(package)_patches+=fix_mingw_link.patch $(package)_build_subdir=build # When building for Windows, we set _WIN32_WINNT to target the same Windows @@ -17,7 +18,8 @@ define $(package)_set_vars endef define $(package)_preprocess_cmds - patch -p1 < $($(package)_patch_dir)/cmake_fixups.patch + patch -p1 < $($(package)_patch_dir)/cmake_fixups.patch && \ + patch -p1 < $($(package)_patch_dir)/fix_mingw_link.patch endef define $(package)_config_cmds diff --git a/depends/patches/libevent/fix_mingw_link.patch b/depends/patches/libevent/fix_mingw_link.patch new file mode 100644 index 0000000000..41cbd463c9 --- /dev/null +++ b/depends/patches/libevent/fix_mingw_link.patch @@ -0,0 +1,25 @@ +commit d108099913c5fdbe518f3f4d711f248f8522bd10 +Author: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> +Date: Mon Apr 22 06:39:35 2024 +0100 + + build: Add `Iphlpapi` to `Libs.private` in `*.pc` files on Windows + + It has been required since https://github.com/libevent/libevent/pull/923 + at least for the `if_nametoindex` call. + + See https://github.com/libevent/libevent/pull/1622. + + +diff --git a/configure.ac b/configure.ac +index d00e063a..cd1fce37 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -906,7 +906,7 @@ if(WIN32) + list(APPEND HDR_PRIVATE WIN32-Code/getopt.h) + + set(EVENT__DNS_USE_FTIME_FOR_ID 1) +- set(LIB_PLATFORM ws2_32 shell32 advapi32) ++ set(LIB_PLATFORM ws2_32 shell32 advapi32 iphlpapi) + add_definitions( + -D_CRT_SECURE_NO_WARNINGS + -D_CRT_NONSTDC_NO_DEPRECATE) From 6bee8e25f7778eed46ff4c982ed4acfa03de86a3 Mon Sep 17 00:00:00 2001 From: fanquake Date: Fri, 21 Apr 2023 14:22:33 +0100 Subject: [PATCH 09/12] Merge bitcoin/bitcoin#27496: depends: reuse _config_opts for CMake options 63c0c4ff10b2f6ed8510ef372a5b1f6a6494b179 depends: reuse _config_opts for CMake options (Cory Fields) Pull request description: Context: I'm [currently experimenting with building our depends with CMake when possible](https://github.com/theuni/bitcoin/commits/depends-cmake) as part of our future transition to CMake. Specifically zmq, libevent, libnatpmp, and miniupnpc all have existing CMake buildsystems. Building them with CMake will allow us to drop several deps that we currently have (autoconf, automake, pkg-config, etc) which would be unfortunate to carry over after the switch-over. But that's not relevant for this PR. This is just a very simple change that makes the above work easier to experiment with as it [adds a needed feature for CMake packages](https://github.com/theuni/bitcoin/commit/5733dc200004004dcce70eaa105d36ba2e75ce7b#diff-e6ed342a25092e0a6d0308e0bfd826044578847132cc6726ac4afa2ca767b61aR20). It's a no-op for the current builds. --- From commit description: This will allow us to use the existing machinery for filtering by arch, os, debug/release, etc. For example, the following becomes possible for libevent when building with CMake: `$(package)_config_opts_release=-DEVENT__DISABLE_DEBUG_MODE` Now the define is only set when not building depends with DEBUG=1 ACKs for top commit: hebasto: ACK 63c0c4ff10b2f6ed8510ef372a5b1f6a6494b179 Tree-SHA512: 17d123219d2f98c017880196966ffebd5d09d3e2db8e443e227eb7e49da46e9d971fbe7fd2b99a324fc367e1bbe0ac3cd15b399bce98dd87fbb144d767e15fe7 --- depends/funcs.mk | 2 +- depends/packages/libmultiprocess.mk | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/depends/funcs.mk b/depends/funcs.mk index 10a3366b98..324475b79c 100644 --- a/depends/funcs.mk +++ b/depends/funcs.mk @@ -175,7 +175,7 @@ $(1)_cmake=env CC="$$($(1)_cc)" \ CXX="$$($(1)_cxx)" \ CXXFLAGS="$$($(1)_cppflags) $$($(1)_cxxflags)" \ LDFLAGS="$$($(1)_ldflags)" \ - cmake -DCMAKE_INSTALL_PREFIX:PATH="$$($($(1)_type)_prefix)" $$($(1)_cmake_opts) + cmake -DCMAKE_INSTALL_PREFIX:PATH="$$($($(1)_type)_prefix)" $$($(1)_config_opts) ifeq ($($(1)_type),build) $(1)_cmake += -DCMAKE_INSTALL_RPATH:PATH="$$($($(1)_type)_prefix)/lib" else diff --git a/depends/packages/libmultiprocess.mk b/depends/packages/libmultiprocess.mk index 9b66207fc5..f4532daaea 100644 --- a/depends/packages/libmultiprocess.mk +++ b/depends/packages/libmultiprocess.mk @@ -10,8 +10,8 @@ endif define $(package)_set_vars := ifneq ($(host),$(build)) -$(package)_cmake_opts := -DCAPNP_EXECUTABLE="$$(native_capnp_prefixbin)/capnp" -$(package)_cmake_opts += -DCAPNPC_CXX_EXECUTABLE="$$(native_capnp_prefixbin)/capnpc-c++" +$(package)_config_opts := -DCAPNP_EXECUTABLE="$$(native_capnp_prefixbin)/capnp" +$(package)_config_opts += -DCAPNPC_CXX_EXECUTABLE="$$(native_capnp_prefixbin)/capnpc-c++" endif endef From 7bb1d0ef5e5b4aa04138a2cdfb62ffb845585c27 Mon Sep 17 00:00:00 2001 From: fanquake Date: Thu, 19 Aug 2021 07:54:47 +0800 Subject: [PATCH 10/12] Merge bitcoin/bitcoin#22724: windres: use PACKAGE_VERSION rather than building more version numbers f12fbad5a1852706184082c68655fafad4bb9fe1 windres: use PACKAGE_VERSION rather than building more version numbers (fanquake) Pull request description: Rather than defining more strings, reuse PACKAGE_VERSION, which is already available. We also already use PACKAGE_VERSION for `ProductVersion` and `FileVersion` in setup.nsi. ACKs for top commit: MarcoFalke: cr ACK f12fbad5a1852706184082c68655fafad4bb9fe1 laanwj: Code review ACK f12fbad5a1852706184082c68655fafad4bb9fe1 Tree-SHA512: b74a37cbba105d208d4da9264d295d7e052009fdd6b0ed54a0d9968bbe2deeba1766d6d310438b2939a81555faa0cbd67d5e53f0c8a2de669ce56353c1c67d22 --- src/dash-cli-res.rc | 6 ++---- src/dash-tx-res.rc | 6 ++---- src/dash-wallet-res.rc | 6 ++---- src/dashd-res.rc | 6 ++---- src/qt/res/dash-qt-res.rc | 6 ++---- 5 files changed, 10 insertions(+), 20 deletions(-) diff --git a/src/dash-cli-res.rc b/src/dash-cli-res.rc index b9ff8f119d..41cb013709 100644 --- a/src/dash-cli-res.rc +++ b/src/dash-cli-res.rc @@ -2,9 +2,7 @@ #include "clientversion.h" // holds the needed client version information #define VER_PRODUCTVERSION CLIENT_VERSION_MAJOR,CLIENT_VERSION_MINOR,CLIENT_VERSION_BUILD -#define VER_PRODUCTVERSION_STR STRINGIZE(CLIENT_VERSION_MAJOR) "." STRINGIZE(CLIENT_VERSION_MINOR) "." STRINGIZE(CLIENT_VERSION_BUILD) #define VER_FILEVERSION VER_PRODUCTVERSION -#define VER_FILEVERSION_STR VER_PRODUCTVERSION_STR VS_VERSION_INFO VERSIONINFO FILEVERSION VER_FILEVERSION @@ -18,13 +16,13 @@ BEGIN BEGIN VALUE "CompanyName", "Dash" VALUE "FileDescription", "dash-cli (JSON-RPC client for " PACKAGE_NAME ")" - VALUE "FileVersion", VER_FILEVERSION_STR + VALUE "FileVersion", PACKAGE_VERSION VALUE "InternalName", "dash-cli" VALUE "LegalCopyright", COPYRIGHT_STR VALUE "LegalTrademarks1", "Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php." VALUE "OriginalFilename", "dash-cli.exe" VALUE "ProductName", "dash-cli" - VALUE "ProductVersion", VER_PRODUCTVERSION_STR + VALUE "ProductVersion", PACKAGE_VERSION END END diff --git a/src/dash-tx-res.rc b/src/dash-tx-res.rc index 7500109845..43130dd7bd 100644 --- a/src/dash-tx-res.rc +++ b/src/dash-tx-res.rc @@ -2,9 +2,7 @@ #include "clientversion.h" // holds the needed client version information #define VER_PRODUCTVERSION CLIENT_VERSION_MAJOR,CLIENT_VERSION_MINOR,CLIENT_VERSION_BUILD -#define VER_PRODUCTVERSION_STR STRINGIZE(CLIENT_VERSION_MAJOR) "." STRINGIZE(CLIENT_VERSION_MINOR) "." STRINGIZE(CLIENT_VERSION_BUILD) #define VER_FILEVERSION VER_PRODUCTVERSION -#define VER_FILEVERSION_STR VER_PRODUCTVERSION_STR VS_VERSION_INFO VERSIONINFO FILEVERSION VER_FILEVERSION @@ -18,13 +16,13 @@ BEGIN BEGIN VALUE "CompanyName", "Dash" VALUE "FileDescription", "dash-tx (CLI Dash transaction editor utility)" - VALUE "FileVersion", VER_FILEVERSION_STR + VALUE "FileVersion", PACKAGE_VERSION VALUE "InternalName", "dash-tx" VALUE "LegalCopyright", COPYRIGHT_STR VALUE "LegalTrademarks1", "Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php." VALUE "OriginalFilename", "dash-tx.exe" VALUE "ProductName", "dash-tx" - VALUE "ProductVersion", VER_PRODUCTVERSION_STR + VALUE "ProductVersion", PACKAGE_VERSION END END diff --git a/src/dash-wallet-res.rc b/src/dash-wallet-res.rc index b3ec9f1b92..3f225e8dcb 100644 --- a/src/dash-wallet-res.rc +++ b/src/dash-wallet-res.rc @@ -2,9 +2,7 @@ #include "clientversion.h" // holds the needed client version information #define VER_PRODUCTVERSION CLIENT_VERSION_MAJOR,CLIENT_VERSION_MINOR,CLIENT_VERSION_BUILD -#define VER_PRODUCTVERSION_STR STRINGIZE(CLIENT_VERSION_MAJOR) "." STRINGIZE(CLIENT_VERSION_MINOR) "." STRINGIZE(CLIENT_VERSION_BUILD) #define VER_FILEVERSION VER_PRODUCTVERSION -#define VER_FILEVERSION_STR VER_PRODUCTVERSION_STR VS_VERSION_INFO VERSIONINFO FILEVERSION VER_FILEVERSION @@ -18,13 +16,13 @@ BEGIN BEGIN VALUE "CompanyName", "Dash Core" VALUE "FileDescription", "dash-wallet (CLI tool for " PACKAGE_NAME " wallets)" - VALUE "FileVersion", VER_FILEVERSION_STR + VALUE "FileVersion", PACKAGE_VERSION VALUE "InternalName", "dash-wallet" VALUE "LegalCopyright", COPYRIGHT_STR VALUE "LegalTrademarks1", "Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php." VALUE "OriginalFilename", "dash-wallet.exe" VALUE "ProductName", "dash-wallet" - VALUE "ProductVersion", VER_PRODUCTVERSION_STR + VALUE "ProductVersion", PACKAGE_VERSION END END diff --git a/src/dashd-res.rc b/src/dashd-res.rc index c3f89b169a..bfe3eeca49 100644 --- a/src/dashd-res.rc +++ b/src/dashd-res.rc @@ -2,9 +2,7 @@ #include "clientversion.h" // holds the needed client version information #define VER_PRODUCTVERSION CLIENT_VERSION_MAJOR,CLIENT_VERSION_MINOR,CLIENT_VERSION_BUILD -#define VER_PRODUCTVERSION_STR STRINGIZE(CLIENT_VERSION_MAJOR) "." STRINGIZE(CLIENT_VERSION_MINOR) "." STRINGIZE(CLIENT_VERSION_BUILD) #define VER_FILEVERSION VER_PRODUCTVERSION -#define VER_FILEVERSION_STR VER_PRODUCTVERSION_STR VS_VERSION_INFO VERSIONINFO FILEVERSION VER_FILEVERSION @@ -18,13 +16,13 @@ BEGIN BEGIN VALUE "CompanyName", "Dash" VALUE "FileDescription", "dashd (Dash node with a JSON-RPC server)" - VALUE "FileVersion", VER_FILEVERSION_STR + VALUE "FileVersion", PACKAGE_VERSION VALUE "InternalName", "dashd" VALUE "LegalCopyright", COPYRIGHT_STR VALUE "LegalTrademarks1", "Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php." VALUE "OriginalFilename", "dashd.exe" VALUE "ProductName", "dashd" - VALUE "ProductVersion", VER_PRODUCTVERSION_STR + VALUE "ProductVersion", PACKAGE_VERSION END END diff --git a/src/qt/res/dash-qt-res.rc b/src/qt/res/dash-qt-res.rc index 92ec1c103d..b15edf2bc6 100644 --- a/src/qt/res/dash-qt-res.rc +++ b/src/qt/res/dash-qt-res.rc @@ -5,9 +5,7 @@ IDI_ICON2 ICON DISCARDABLE "icons/dash_testnet.ico" #include "../../clientversion.h" // holds the needed client version information #define VER_PRODUCTVERSION CLIENT_VERSION_MAJOR,CLIENT_VERSION_MINOR,CLIENT_VERSION_BUILD -#define VER_PRODUCTVERSION_STR STRINGIZE(CLIENT_VERSION_MAJOR) "." STRINGIZE(CLIENT_VERSION_MINOR) "." STRINGIZE(CLIENT_VERSION_BUILD) #define VER_FILEVERSION VER_PRODUCTVERSION -#define VER_FILEVERSION_STR VER_PRODUCTVERSION_STR VS_VERSION_INFO VERSIONINFO FILEVERSION VER_FILEVERSION @@ -21,13 +19,13 @@ BEGIN BEGIN VALUE "CompanyName", "Dash" VALUE "FileDescription", PACKAGE_NAME " (GUI node for Dash)" - VALUE "FileVersion", VER_FILEVERSION_STR + VALUE "FileVersion", PACKAGE_VERSION VALUE "InternalName", "dash-qt" VALUE "LegalCopyright", COPYRIGHT_STR VALUE "LegalTrademarks1", "Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php." VALUE "OriginalFilename", "dash-qt.exe" VALUE "ProductName", PACKAGE_NAME - VALUE "ProductVersion", VER_PRODUCTVERSION_STR + VALUE "ProductVersion", PACKAGE_VERSION END END From 1522896f9f82c74aa53a2cc42b32b00558289817 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Sat, 28 Sep 2024 10:48:43 +0300 Subject: [PATCH 11/12] fix mingw32 build --- depends/packages/zeromq.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/depends/packages/zeromq.mk b/depends/packages/zeromq.mk index 1f05cd051b..28f730ae6d 100644 --- a/depends/packages/zeromq.mk +++ b/depends/packages/zeromq.mk @@ -19,6 +19,7 @@ define $(package)_set_vars $(package)_config_opts += -DENABLE_DRAFTS=OFF -DZMQ_BUILD_TESTS=OFF $(package)_cxxflags += -ffile-prefix-map=$($(package)_extract_dir)=/usr $(package)_config_opts_mingw32 += -DZMQ_WIN32_WINNT=0x0601 -DZMQ_HAVE_IPC=OFF + $(package)_config_opts_mingw32 += -DCMAKE_RC_COMPILER=x86_64-w64-mingw32-windres $(package)_cxxflags+=-std=c++17 endef From ae6e0ada9b4d20dd936812a0bb7f90d1a7fe7221 Mon Sep 17 00:00:00 2001 From: fanquake Date: Fri, 5 Apr 2024 15:05:50 +0100 Subject: [PATCH 12/12] Merge bitcoin/bitcoin#29725: depends: build libqrencode with CMake 007ea322a6492d46f1565ef58a0c49f5b468ff20 depends: switch to building libqrencode with CMake (fanquake) 884330c0a57ce839d48606dc2de3928869b31b7d guix: make cmake-minimal a global requirement (fanquake) Pull request description: Switch to building libqrencode with CMake. Note that upstream (https://github.com/fukuchi/libqrencode) hasn't seen any activity for ~4 years, so the odds of getting anything upstream seems low, but I've made two minor changes to the source here, which I will PR in any case. From an initial look I couldn't find any significant difference between the Autotools and CMake produced libs. As part of this change we move cmake-minimal in Guix into the global package set. ACKs for top commit: TheCharlatan: ACK 007ea322a6492d46f1565ef58a0c49f5b468ff20 Tree-SHA512: c784f790ddea958082c8ae96d3744bdf99331a8799765f9d44f00861b8e2cfcab1a88a3d64af5b10e51a8d5938d55eb6a3d271790b565e50492a39d00dc0e30f --- contrib/guix/manifest.scm | 3 ++- depends/packages/qrencode.mk | 16 +++++++------- depends/patches/qrencode/cmake_fixups.patch | 23 +++++++++++++++++++++ 3 files changed, 32 insertions(+), 10 deletions(-) create mode 100644 depends/patches/qrencode/cmake_fixups.patch diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm index e226d9bd56..beea4d6a17 100644 --- a/contrib/guix/manifest.scm +++ b/contrib/guix/manifest.scm @@ -590,6 +590,7 @@ parse, modify and abstract ELF, PE and MachO formats.") zlib (list zlib "static") ;; Build tools + cmake-minimal gnu-make libtool-2.4.7 autoconf-2.71 @@ -615,5 +616,5 @@ parse, modify and abstract ELF, PE and MachO formats.") ((string-contains target "-linux-") (list (make-bitcoin-cross-toolchain target))) ((string-contains target "darwin") - (list clang-toolchain-10 binutils cmake-minimal xorriso python-signapple)) + (list clang-toolchain-10 binutils xorriso python-signapple)) (else '()))))) diff --git a/depends/packages/qrencode.mk b/depends/packages/qrencode.mk index 9ebd2dd85a..4d852d833d 100644 --- a/depends/packages/qrencode.mk +++ b/depends/packages/qrencode.mk @@ -3,20 +3,22 @@ $(package)_version=4.1.1 $(package)_download_path=https://fukuchi.org/works/qrencode/ $(package)_file_name=$(package)-$($(package)_version).tar.bz2 $(package)_sha256_hash=e455d9732f8041cf5b9c388e345a641fd15707860f928e94507b1961256a6923 +$(package)_patches=cmake_fixups.patch define $(package)_set_vars -$(package)_config_opts=--disable-shared --without-tools --without-tests --without-png -$(package)_config_opts += --disable-gprof --disable-gcov --disable-mudflap -$(package)_config_opts += --disable-dependency-tracking --enable-option-checking +$(package)_config_opts := -DWITH_TOOLS=NO -DWITH_TESTS=NO -DGPROF=OFF -DCOVERAGE=OFF +$(package)_config_opts += -DCMAKE_DISABLE_FIND_PACKAGE_PNG=TRUE -DWITHOUT_PNG=ON +$(package)_config_opts += -DCMAKE_DISABLE_FIND_PACKAGE_ICONV=TRUE $(package)_cflags += -Wno-int-conversion -Wno-implicit-function-declaration endef define $(package)_preprocess_cmds - cp -f $(BASEDIR)/config.guess $(BASEDIR)/config.sub use + patch -p1 < $($(package)_patch_dir)/cmake_fixups.patch endef + define $(package)_config_cmds - $($(package)_autoconf) + $($(package)_cmake) -S . -B . endef define $(package)_build_cmds @@ -26,7 +28,3 @@ endef define $(package)_stage_cmds $(MAKE) DESTDIR=$($(package)_staging_dir) install endef - -define $(package)_postprocess_cmds - rm lib/*.la -endef diff --git a/depends/patches/qrencode/cmake_fixups.patch b/depends/patches/qrencode/cmake_fixups.patch new file mode 100644 index 0000000000..7518d756cb --- /dev/null +++ b/depends/patches/qrencode/cmake_fixups.patch @@ -0,0 +1,23 @@ +cmake: set minimum version to 3.5 + +Correct some dev warning output. + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 773e037..a558145 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required(VERSION 3.1.0) ++cmake_minimum_required(VERSION 3.5) + + project(QRencode VERSION 4.1.1 LANGUAGES C) + +@@ -20,7 +20,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") + set(CMAKE_THREAD_PREFER_PTHREAD ON) + find_package(Threads) + find_package(PNG) +-find_package(Iconv) ++find_package(ICONV) + + if(CMAKE_USE_PTHREADS_INIT) + add_definitions(-DHAVE_LIBPTHREAD=1)