b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2011-2015 OpenWrt.org |
| 3 | # |
| 4 | # This is free software, licensed under the GNU General Public License v2. |
| 5 | # See /LICENSE for more information. |
| 6 | # |
| 7 | |
| 8 | include $(TOPDIR)/rules.mk |
| 9 | |
| 10 | PKG_NAME:=libevent2 |
| 11 | PKG_VERSION:=2.1.12 |
| 12 | PKG_RELEASE:=2 |
| 13 | |
| 14 | PKG_SOURCE:=libevent-$(PKG_VERSION)-stable.tar.gz |
| 15 | PKG_SOURCE_URL:=https://github.com/libevent/libevent/releases/download/release-$(PKG_VERSION)-stable |
| 16 | PKG_HASH:=92e6de1be9ec176428fd2367677e61ceffc2ee1cb119035037a27d346b0403bb |
| 17 | PKG_BUILD_DIR:=$(BUILD_DIR)/libevent-$(PKG_VERSION)-stable |
| 18 | |
| 19 | PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io> |
| 20 | PKG_LICENSE:=BSD-3-Clause |
| 21 | PKG_LICENSE_FILES:=LICENSE |
| 22 | PKG_CPE_ID:=cpe:/a:libevent_project:libevent |
| 23 | |
| 24 | PKG_CONFIG_DEPENDS:= \ |
| 25 | CONFIG_PACKAGE_libevent2-openssl \ |
| 26 | CONFIG_PACKAGE_libevent2-pthreads \ |
| 27 | CONFIG_PACKAGE_libevent2-mbedtls |
| 28 | |
| 29 | PKG_BUILD_FLAGS:=gc-sections lto |
| 30 | |
| 31 | include $(INCLUDE_DIR)/package.mk |
| 32 | include $(INCLUDE_DIR)/cmake.mk |
| 33 | |
| 34 | define Package/libevent2/Default |
| 35 | SECTION:=libs |
| 36 | CATEGORY:=Libraries |
| 37 | TITLE:=Event notification |
| 38 | URL:=http://libevent.org |
| 39 | ABI_VERSION:=7 |
| 40 | endef |
| 41 | |
| 42 | define Package/libevent2/Default/description |
| 43 | The libevent API provides a mechanism to execute a callback function |
| 44 | when a specific event occurs on a file descriptor or after a timeout |
| 45 | has been reached. Furthermore, libevent also support callbacks due |
| 46 | to signals or regular timeouts. |
| 47 | |
| 48 | libevent is meant to replace the event loop found in event driven |
| 49 | network servers. An application just needs to call event_dispatch() |
| 50 | and then add or remove events dynamically without having to change |
| 51 | the event loop. |
| 52 | endef |
| 53 | |
| 54 | define Package/libevent2 |
| 55 | $(call Package/libevent2/Default) |
| 56 | TITLE+= library (version 2.1) |
| 57 | endef |
| 58 | |
| 59 | define Package/libevent2/description |
| 60 | $(call Package/libevent2/Default/description) |
| 61 | |
| 62 | This package contains the libevent shared library historically |
| 63 | containing both the core & extra libraries. |
| 64 | endef |
| 65 | |
| 66 | define Package/libevent2-core |
| 67 | $(call Package/libevent2/Default) |
| 68 | TITLE+= core library (version 2.1) |
| 69 | endef |
| 70 | |
| 71 | define Package/libevent2-core/description |
| 72 | $(call Package/libevent2/Default/description) |
| 73 | |
| 74 | This package contains the libevent core shared library for the event, |
| 75 | buffer & utility functions. |
| 76 | endef |
| 77 | |
| 78 | define Package/libevent2-extra |
| 79 | $(call Package/libevent2/Default) |
| 80 | TITLE+= extra library (version 2.1) |
| 81 | DEPENDS+=+libevent2-core |
| 82 | endef |
| 83 | |
| 84 | define Package/libevent2-extra/description |
| 85 | $(call Package/libevent2/Default/description) |
| 86 | |
| 87 | This package contains the libevent extra shared library for specific |
| 88 | protocols including HTTP, DNS & RPC. |
| 89 | endef |
| 90 | |
| 91 | define Package/libevent2-openssl |
| 92 | $(call Package/libevent2/Default) |
| 93 | TITLE+= OpenSSL library (version 2.1) |
| 94 | DEPENDS+=+libopenssl +libevent2-core |
| 95 | endef |
| 96 | |
| 97 | define Package/libevent2-openssl/description |
| 98 | $(call Package/libevent2/Default/description) |
| 99 | |
| 100 | This package contains the libevent OpenSSL shared library for encrypted |
| 101 | bufferevents. |
| 102 | endef |
| 103 | |
| 104 | define Package/libevent2-pthreads |
| 105 | $(call Package/libevent2/Default) |
| 106 | TITLE+= Pthreads library (version 2.1) |
| 107 | DEPENDS+=+libpthread +libevent2-core |
| 108 | endef |
| 109 | |
| 110 | define Package/libevent2-pthreads/description |
| 111 | $(call Package/libevent2/Default/description) |
| 112 | |
| 113 | This package contains the libevent Pthreads shared library for |
| 114 | threading & locking. |
| 115 | endef |
| 116 | |
| 117 | TARGET_CFLAGS += $(FPIC) |
| 118 | TARGET_LDFLAGS += -Wl,--as-needed |
| 119 | |
| 120 | CMAKE_OPTIONS += \ |
| 121 | -DEVENT__DISABLE_BENCHMARK:BOOL=ON \ |
| 122 | -DEVENT__DISABLE_DEBUG_MODE:BOOL=ON \ |
| 123 | -DEVENT__DISABLE_REGRESS:BOOL=ON \ |
| 124 | -DEVENT__DISABLE_SAMPLES:BOOL=ON \ |
| 125 | $(if $(CONFIG_PACKAGE_libevent2-openssl),-DEVENT__DISABLE_OPENSSL:BOOL=OFF,-DEVENT__DISABLE_OPENSSL:BOOL=ON) \ |
| 126 | $(if $(CONFIG_PACKAGE_libevent2-pthreads),-DEVENT__DISABLE_THREAD_SUPPORT:BOOL=OFF,-DEVENT__DISABLE_THREAD_SUPPORT:BOOL=ON) \ |
| 127 | -DEVENT__DISABLE_TESTS:BOOL=ON \ |
| 128 | -DBUILD_TESTING:BOOL=OFF |
| 129 | |
| 130 | define Build/InstallDev |
| 131 | $(call Build/InstallDev/cmake,$(1)) |
| 132 | $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/libevent*.pc |
| 133 | $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/libevent*.pc |
| 134 | endef |
| 135 | |
| 136 | define Package/libevent2/install |
| 137 | $(INSTALL_DIR) $(1)/usr/lib |
| 138 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/libevent-2.1.so.* $(1)/usr/lib/ |
| 139 | endef |
| 140 | |
| 141 | define Package/libevent2-core/install |
| 142 | $(INSTALL_DIR) $(1)/usr/lib |
| 143 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/libevent_core-2.1.so.* $(1)/usr/lib/ |
| 144 | endef |
| 145 | |
| 146 | define Package/libevent2-extra/install |
| 147 | $(INSTALL_DIR) $(1)/usr/lib |
| 148 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/libevent_extra-2.1.so.* $(1)/usr/lib/ |
| 149 | endef |
| 150 | |
| 151 | define Package/libevent2-openssl/install |
| 152 | $(INSTALL_DIR) $(1)/usr/lib |
| 153 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/libevent_openssl-2.1.so.* $(1)/usr/lib/ |
| 154 | endef |
| 155 | |
| 156 | define Package/libevent2-pthreads/install |
| 157 | $(INSTALL_DIR) $(1)/usr/lib |
| 158 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/libevent_pthreads-2.1.so.* $(1)/usr/lib/ |
| 159 | endef |
| 160 | |
| 161 | $(eval $(call BuildPackage,libevent2)) |
| 162 | $(eval $(call BuildPackage,libevent2-core)) |
| 163 | $(eval $(call BuildPackage,libevent2-extra)) |
| 164 | $(eval $(call BuildPackage,libevent2-openssl)) |
| 165 | $(eval $(call BuildPackage,libevent2-pthreads)) |