Skip to content

Commit bd5d168

Browse files
committed
Merge bitcoin#29835: depends: build libevent with CMake
f59e905 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 f59e905 willcl-ark: ACK f59e905 Tree-SHA512: 875bf9bc57653c78775a1f8192a2c964fea8f4490d733ff796d9efb00e786f0ca9a7c1a3fd610cda032273c4f2ae06394585b03567d5f241ab073c83a47cf927
2 parents aa61d4f + f59e905 commit bd5d168

File tree

2 files changed

+43
-6
lines changed

2 files changed

+43
-6
lines changed

depends/packages/libevent.mk

+8-6
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@ $(package)_version=2.1.12-stable
33
$(package)_download_path=https://github.com/libevent/libevent/releases/download/release-$($(package)_version)/
44
$(package)_file_name=$(package)-$($(package)_version).tar.gz
55
$(package)_sha256_hash=92e6de1be9ec176428fd2367677e61ceffc2ee1cb119035037a27d346b0403bb
6+
$(package)_patches=cmake_fixups.patch
7+
$(package)_build_subdir=build
68

79
# When building for Windows, we set _WIN32_WINNT to target the same Windows
810
# version as we do in configure. Due to quirks in libevents build system, this
911
# is also required to enable support for ipv6. See #19375.
1012
define $(package)_set_vars
11-
$(package)_config_opts=--disable-shared --disable-openssl --disable-libevent-regress --disable-samples
12-
$(package)_config_opts += --disable-dependency-tracking --enable-option-checking
13-
$(package)_config_opts_release=--disable-debug-mode
13+
$(package)_config_opts=-DEVENT__DISABLE_BENCHMARK=ON -DEVENT__DISABLE_OPENSSL=ON
14+
$(package)_config_opts+=-DEVENT__DISABLE_SAMPLES=ON -DEVENT__DISABLE_REGRESS=ON
15+
$(package)_config_opts+=-DEVENT__DISABLE_TESTS=ON -DEVENT__LIBRARY_TYPE=STATIC
1416
$(package)_cppflags_mingw32=-D_WIN32_WINNT=0x0601
1517

1618
ifeq ($(NO_HARDEN),)
@@ -19,11 +21,11 @@ define $(package)_set_vars
1921
endef
2022

2123
define $(package)_preprocess_cmds
22-
cp -f $(BASEDIR)/config.guess $(BASEDIR)/config.sub build-aux
24+
patch -p1 < $($(package)_patch_dir)/cmake_fixups.patch
2325
endef
2426

2527
define $(package)_config_cmds
26-
$($(package)_autoconf)
28+
$($(package)_cmake) -S .. -B .
2729
endef
2830

2931
define $(package)_build_cmds
@@ -35,7 +37,7 @@ define $(package)_stage_cmds
3537
endef
3638

3739
define $(package)_postprocess_cmds
38-
rm lib/*.la && \
40+
rm bin/event_rpcgen.py && \
3941
rm include/ev*.h && \
4042
rm include/event2/*_compat.h
4143
endef
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
cmake: set minimum version to 3.5
2+
3+
Fix generated pkg-config files, see
4+
https://github.com/libevent/libevent/pull/1165.
5+
6+
--- a/CMakeLists.txt
7+
+++ b/CMakeLists.txt
8+
@@ -19,7 +19,7 @@
9+
# start libevent.sln
10+
#
11+
12+
-cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
13+
+cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
14+
15+
if (POLICY CMP0054)
16+
cmake_policy(SET CMP0054 NEW)
17+
diff --git a/cmake/AddEventLibrary.cmake b/cmake/AddEventLibrary.cmake
18+
index 04f5837e..d8ea42c4 100644
19+
--- a/cmake/AddEventLibrary.cmake
20+
+++ b/cmake/AddEventLibrary.cmake
21+
@@ -20,12 +20,12 @@ macro(generate_pkgconfig LIB_NAME)
22+
23+
set(LIBS "")
24+
foreach (LIB ${LIB_PLATFORM})
25+
- set(LIBS "${LIBS} -L${LIB}")
26+
+ set(LIBS "${LIBS} -l${LIB}")
27+
endforeach()
28+
29+
set(OPENSSL_LIBS "")
30+
foreach(LIB ${OPENSSL_LIBRARIES})
31+
- set(OPENSSL_LIBS "${OPENSSL_LIBS} -L${LIB}")
32+
+ set(OPENSSL_LIBS "${OPENSSL_LIBS} -l${LIB}")
33+
endforeach()
34+
35+
configure_file("lib${LIB_NAME}.pc.in" "lib${LIB_NAME}.pc" @ONLY)

0 commit comments

Comments
 (0)