libevent.mk raw
1 package=libevent
2 $(package)_version=2.1.12-stable
3 $(package)_download_path=https://github.com/libevent/libevent/releases/download/release-$($(package)_version)/
4 $(package)_file_name=$(package)-$($(package)_version).tar.gz
5 $(package)_sha256_hash=92e6de1be9ec176428fd2367677e61ceffc2ee1cb119035037a27d346b0403bb
6 $(package)_patches=cmake_fixups.patch
7 $(package)_patches += netbsd_fixup.patch
8 $(package)_patches += winver_fixup.patch
9 $(package)_build_subdir=build
10
11 # When building for Windows, we set _WIN32_WINNT to target the same Windows
12 # version as we do in releases. Due to quirks in libevents build system, this
13 # is also required to enable support for ipv6. See #19375.
14 define $(package)_set_vars
15 $(package)_config_opts=-DCMAKE_BUILD_TYPE=None -DEVENT__DISABLE_BENCHMARK=ON -DEVENT__DISABLE_OPENSSL=ON
16 $(package)_config_opts+=-DEVENT__DISABLE_SAMPLES=ON -DEVENT__DISABLE_REGRESS=ON
17 $(package)_config_opts+=-DEVENT__DISABLE_TESTS=ON -DEVENT__LIBRARY_TYPE=STATIC
18 $(package)_cflags += -fdebug-prefix-map=$($(package)_extract_dir)=/usr -fmacro-prefix-map=$($(package)_extract_dir)=/usr
19 $(package)_cppflags += -D_GNU_SOURCE
20 $(package)_cppflags_mingw32=-D_WIN32_WINNT=0x0A00
21
22 ifeq ($(NO_HARDEN),)
23 $(package)_cppflags+=-D_FORTIFY_SOURCE=3
24 endif
25 endef
26
27 define $(package)_preprocess_cmds
28 patch -p1 < $($(package)_patch_dir)/cmake_fixups.patch && \
29 patch -p1 < $($(package)_patch_dir)/netbsd_fixup.patch && \
30 patch -p1 < $($(package)_patch_dir)/winver_fixup.patch
31 endef
32
33 define $(package)_config_cmds
34 $($(package)_cmake) -S .. -B .
35 endef
36
37 define $(package)_build_cmds
38 $(MAKE)
39 endef
40
41 define $(package)_stage_cmds
42 $(MAKE) DESTDIR=$($(package)_staging_dir) install
43 endef
44
45 define $(package)_postprocess_cmds
46 rm -rf bin lib/pkgconfig && \
47 rm include/ev*.h && \
48 rm include/event2/*_compat.h && \
49 rm lib/libevent.a
50 endef
51