aports/main/libwebsockets/APKBUILD
2025-04-09 14:30:07 +00:00

96 lines
2.3 KiB
Text

# Contributor: V.Krishn <vkrishn4@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libwebsockets
pkgver=4.3.5
pkgrel=1
pkgdesc="C library for lightweight websocket clients and servers"
url="https://libwebsockets.org/"
arch="all"
license="MIT"
makedepends="cmake
glib-dev
libev-dev
libevent-dev
libuv-dev
linux-headers
openssl-dev>3
samurai
zlib-dev
"
subpackages="$pkgname-doc
$pkgname-dev
$pkgname-evlib_ev:_evlib_ev
$pkgname-evlib_event:_evlib_event
$pkgname-evlib_glib:_evlib_glib
$pkgname-evlib_uv:_evlib_uv
$pkgname-test:_test
"
source="$pkgname-$pkgver.tar.gz::https://github.com/warmcat/libwebsockets/archive/v$pkgver.tar.gz
fix-version-string.patch
"
options="!check" # no tests were found
build() {
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_VERBOSE_MAKEFILE=TRUE \
-DLWS_IPV6=ON \
-DLWS_LINK_TESTAPPS_DYNAMIC=ON \
-DLWS_WITH_EVLIB_PLUGINS=1 \
-DLWS_WITH_EXTERNAL_POLL=On \
-DLWS_WITH_GLIB=ON \
-DLWS_WITH_LIBEV=ON \
-DLWS_WITH_LIBEVENT=ON \
-DLWS_WITH_LIBUV=ON \
-DLWS_WITH_SDEVENT=OFF \
-DLWS_WITH_STATIC=OFF
cmake --build build
}
# TODO: Use test subpkg to validate
check() {
ctest --test-dir build
}
package() {
install -Dm644 LICENSE \
"$pkgdir"/usr/share/licenses/"$pkgname"/LICENSE
DESTDIR="$pkgdir" cmake --install build
}
_test() {
pkgdesc="$pkgdesc (test server)"
mkdir -p "$subpkgdir"/usr
mv "$pkgdir"/usr/share "$pkgdir"/usr/bin "$subpkgdir"/usr/
}
_evlib_ev() {
local _plugin=${subpkgname#"$pkgname"-}
pkgdesc="libwebsocket $_plugin plugin"
amove usr/lib/libwebsockets-"$_plugin".so
}
_evlib_event() {
local _plugin=${subpkgname#"$pkgname"-}
pkgdesc="libwebsocket $_plugin plugin"
amove usr/lib/libwebsockets-"$_plugin".so
}
_evlib_glib() {
local _plugin=${subpkgname#"$pkgname"-}
pkgdesc="libwebsocket $_plugin plugin"
amove usr/lib/libwebsockets-"$_plugin".so
}
_evlib_uv() {
local _plugin=${subpkgname#"$pkgname"-}
pkgdesc="libwebsocket $_plugin plugin"
amove usr/lib/libwebsockets-"$_plugin".so
}
sha512sums="
629a4fe6b0c8f6b4a1d38128201f5a856bdcf8a33923120c24ceb8d7f7602906608ef4e289e98b66bb94633ed95f5901e2e46d8214dcc61cf276cc975b9d7134 libwebsockets-4.3.5.tar.gz
9325b7cadeb2ca8fb20b4759feb49fb255b1b14c432b7c8c3a1b793a49266bb4f69b78a9c72656039e94ba4fc59ca2c5e821ba33e4f133e72cab26786feb9d60 fix-version-string.patch
"