-
Notifications
You must be signed in to change notification settings - Fork 35.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge #29707: depends: build miniupnpc with CMake
5195baa depends: fix miniupnpc snprintf usage on Windows (fanquake) 3c2d440 depends: switch miniupnpc to CMake (Cory Fields) f5618c7 depends: add upstream CMake patch to miniupnpc (fanquake) 6866b57 depends: miniupnpc 2.2.7 (fanquake) Pull request description: This picks up one of the changes from #29232, which is a switch to building miniupnpc with CMake. It includes an update to the most recent version of miniupnpc (2.2.7), which means we can drop one patch from that commit, and includes a new patch for a change I've upstreamed miniupnp/miniupnp#721, as well as some suggestions from the previous PR. ACKs for top commit: theuni: ACK 5195baa. TheCharlatan: utACK 5195baa Tree-SHA512: 5b27e132cd5eed285e9be34c8b96893417d92a1ae55c99345c9a89e1c1c5e40e4bc840bc061b879758b2b11fcb520cd98c3da985c1e153f2e5380cf63efe2d69
- Loading branch information
Showing
7 changed files
with
76 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,31 @@ | ||
package=miniupnpc | ||
$(package)_version=2.2.2 | ||
$(package)_version=2.2.7 | ||
$(package)_download_path=https://miniupnp.tuxfamily.org/files/ | ||
$(package)_file_name=$(package)-$($(package)_version).tar.gz | ||
$(package)_sha256_hash=888fb0976ba61518276fe1eda988589c700a3f2a69d71089260d75562afd3687 | ||
$(package)_patches=dont_leak_info.patch respect_mingw_cflags.patch no_libtool.patch | ||
$(package)_sha256_hash=b0c3a27056840fd0ec9328a5a9bac3dc5e0ec6d2e8733349cf577b0aa1e70ac1 | ||
$(package)_patches=dont_leak_info.patch cmake_get_src_addr.patch fix_windows_snprintf.patch | ||
$(package)_build_subdir=build | ||
|
||
# Next time this package is updated, ensure that _WIN32_WINNT is still properly set. | ||
# See discussion in https://github.com/bitcoin/bitcoin/pull/25964. | ||
define $(package)_set_vars | ||
$(package)_build_opts=CC="$($(package)_cc)" | ||
$(package)_build_opts_mingw32=-f Makefile.mingw CFLAGS="$($(package)_cflags) -D_WIN32_WINNT=0x0601" | ||
$(package)_build_env+=CFLAGS="$($(package)_cflags) $($(package)_cppflags)" AR="$($(package)_ar)" | ||
$(package)_config_opts = -DUPNPC_BUILD_SAMPLE=OFF -DUPNPC_BUILD_SHARED=OFF | ||
$(package)_config_opts += -DUPNPC_BUILD_STATIC=ON -DUPNPC_BUILD_TESTS=OFF | ||
$(package)_config_opts_mingw32 += -DMINIUPNPC_TARGET_WINDOWS_VERSION=0x0601 | ||
endef | ||
|
||
define $(package)_preprocess_cmds | ||
patch -p1 < $($(package)_patch_dir)/dont_leak_info.patch && \ | ||
patch -p1 < $($(package)_patch_dir)/respect_mingw_cflags.patch && \ | ||
patch -p1 < $($(package)_patch_dir)/no_libtool.patch | ||
patch -p1 < $($(package)_patch_dir)/cmake_get_src_addr.patch && \ | ||
patch -p1 < $($(package)_patch_dir)/fix_windows_snprintf.patch | ||
endef | ||
|
||
define $(package)_config_cmds | ||
$($(package)_cmake) -S .. -B . | ||
endef | ||
|
||
define $(package)_build_cmds | ||
$(MAKE) libminiupnpc.a $($(package)_build_opts) | ||
$(MAKE) | ||
endef | ||
|
||
define $(package)_stage_cmds | ||
mkdir -p $($(package)_staging_prefix_dir)/include/miniupnpc $($(package)_staging_prefix_dir)/lib &&\ | ||
install *.h $($(package)_staging_prefix_dir)/include/miniupnpc &&\ | ||
install libminiupnpc.a $($(package)_staging_prefix_dir)/lib | ||
cmake --install . --prefix $($(package)_staging_prefix_dir) | ||
endef |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
commit cb2026239c2a3aff393952ccb0ee1c448189402d | ||
Author: fanquake <fanquake@gmail.com> | ||
Date: Fri Mar 22 14:03:54 2024 +0000 | ||
|
||
build: add MINIUPNPC_GET_SRC_ADDR to CMake build | ||
|
||
This mirrors the autotools build. | ||
|
||
See https://github.com/miniupnp/miniupnp/pull/721. | ||
|
||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 1aa95a8..0cacf3e 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -31,6 +31,7 @@ endif () | ||
if (NOT WIN32) | ||
target_compile_definitions(miniupnpc-private INTERFACE | ||
MINIUPNPC_SET_SOCKET_TIMEOUT | ||
+ MINIUPNPC_GET_SRC_ADDR | ||
_BSD_SOURCE _DEFAULT_SOURCE) | ||
if (NOT APPLE AND NOT CMAKE_SYSTEM_NAME MATCHES ".*BSD" AND NOT CMAKE_SYSTEM_NAME STREQUAL "SunOS") | ||
# add_definitions (-D_POSIX_C_SOURCE=200112L) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
commit a1e9de80ab99b4c956a6a4e21d3e0de6f7a1014d | ||
Author: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | ||
Date: Sat Apr 20 15:14:47 2024 +0100 | ||
|
||
Fix macro expression that guards `snprintf` for Windows | ||
|
||
Otherwise, the `snprintf` is still wrongly emulated for the following | ||
cases: | ||
- mingw-w64 6.0.0 or new with ucrt | ||
- mingw-w64 8.0.0 or new with iso c ext | ||
|
||
--- a/src/win32_snprintf.h | ||
+++ b/src/win32_snprintf.h | ||
@@ -23,9 +23,9 @@ | ||
(defined(_MSC_VER) && _MSC_VER < 1900) /* Visual Studio older than 2015 */ || \ | ||
(defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) && defined(__NO_ISOCEXT)) /* mingw32 without iso c ext */ || \ | ||
(defined(__MINGW64_VERSION_MAJOR) && /* mingw-w64 not ... */ !( \ | ||
- (defined (__USE_MINGW_ANSI_STDIO) && __USE_MINGW_ANSI_STDIO != 0)) /* ... with ansi stdio */ || \ | ||
+ (defined (__USE_MINGW_ANSI_STDIO) && __USE_MINGW_ANSI_STDIO != 0) /* ... with ansi stdio */ || \ | ||
(__MINGW64_VERSION_MAJOR >= 6 && defined(_UCRT)) /* ... at least 6.0.0 with ucrt */ || \ | ||
- (__MINGW64_VERSION_MAJOR >= 8 && !defined(__NO_ISOCEXT)) /* ... at least 8.0.0 with iso c ext */ || \ | ||
+ (__MINGW64_VERSION_MAJOR >= 8 && !defined(__NO_ISOCEXT))) /* ... at least 8.0.0 with iso c ext */ || \ | ||
0) || \ | ||
0) | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters