feat: add package libevent

Signed-off-by: sisungo <[email protected]>
This commit is contained in:
sisungo committed 2026-11-03 10:46:21 +00:00
1 parent 91fbbe42de
commit 34a784e0c4
1 file changed
+52
+52
View File
@@ -0,0 +1,52 @@
from lib.make import *
from lib import cpp
version("2.1.13")
description("Event notification library")
maintainer("sisungo <[email protected]>")
source_managed("github://libevent/libevent#release-2.1.13-stable")
builddep("shortcut/c")
builddep("shortcut/cmake")
builddep("aws-lc-dev @target")
def fix_pc(path):
with open(path) as fd:
pc = fd.read()
pc = pc.replace("libdir=/usr/local/lib", f"libdir={get_prefix('libevent')}/lib")
pc = pc.replace("includedir=/usr/local/include", f"includedir={get_prefix('libevent-dev')}/include")
pc = pc.replace("/usr/local", "/")
with open(path, 'wt+') as fd:
fd.write(pc)
def build():
cpp.cmake([
"-DCMAKE_POLICY_VERSION_MINIMUM=3.5",
"-DCMAKE_INSTALL_PREFIX=/usr/local",
f"-DCMAKE_INSTALL_LIBDIR={get_prefix('libevent')}/lib",
f"-DCMAKE_INSTALL_INCLUDEDIR={get_prefix('libevent-dev')}/include",
])
cpp.ninja()
cpp.ninja_install()
fix_pc("lib/pkgconfig/libevent.pc")
fix_pc("lib/pkgconfig/libevent_core.pc")
fix_pc("lib/pkgconfig/libevent_extra.pc")
fix_pc("lib/pkgconfig/libevent_openssl.pc")
fix_pc("lib/pkgconfig/libevent_pthreads.pc")
on_build(build)
package("libevent")
dep("semi-libc @same-arch")
dep("libcrypto @same-arch")
dep("libssl @same-arch")
cpp.use_auto_pack(["lib"])
package("libevent-dev")
dep("libevent (same)")
dep("semi-libc-dev @same-arch")
dep("aws-lc-dev @same-arch")
cpp.use_auto_pack(["dev"])