testing/lwan: new aport

https://lwan.ws
Experimental, scalable, high performance HTTP server
This commit is contained in:
Jakub Jirutka 2018-02-01 01:01:20 +01:00
parent 7b00fdeabd
commit c061c56629
3 changed files with 109 additions and 0 deletions

51
testing/lwan/APKBUILD Normal file
View File

@ -0,0 +1,51 @@
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=lwan
pkgver=0.1
pkgrel=0
pkgdesc="Experimental, scalable, high performance HTTP server"
url="https://lwan.ws"
arch="x86_64"
license="GPL-2.0-or-later"
checkdepends="python3 py3-requests"
makedepends="cmake bsd-compat-headers lua5.1-dev zlib-dev"
subpackages="$pkgname-dev $pkgname-libs $pkgname-dbg"
source="$pkgname-$pkgver.tar.gz::https://github.com/lpereira/$pkgname/archive/v$pkgver.tar.gz
fix-pthread-stack-min.patch
fix-libdir.patch"
builddir="$srcdir/$pkgname-$pkgver"
build() {
cd "$builddir"
cmake \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_INSTALL_PREFIX=/usr \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_C_FLAGS_MINSIZEREL="$CFLAGS" \
-DCMAKE_CXX_FLAGS_MINSIZEREL="$CXXFLAGS" \
-DCMAKE_EXE_LINKER_FLAGS_MINSIZEREL="$LDFLAGS"
make
}
check() {
cd "$builddir"
make testsuite -j1
}
package() {
cd "$builddir"
make DESTDIR="$pkgdir" install
}
libs() {
default_libs
mkdir -p "$subpkgdir"/usr/lib
mv "$pkgdir"/usr/lib/*.so "$subpkgdir"/usr/lib/
}
sha512sums="6cd42b81402f98c13f905149e515758994b15d9bda6179112c5b2ce59f63c1ce6299234ffcdd64fbc8c37e5f4fd45cfe125c80a05a09ba599158ecf26f5c511c lwan-0.1.tar.gz
e0db0c8c580543399893a86374cc2597cd8f8b358bc79334401948f0729e6da69d719388f023fd696e71d4cca3d9312d26b62b5d8aa0d44196754f8707b0bbcb fix-pthread-stack-min.patch
43e3cdbfa55357a35ea3980d18dcd1962bb850b52592f8c5d270f5f4860cde3ab1e4e371136cb59b7b3d1fa98d81c0f5de447630b40d2300953ff6b62ab1bb4a fix-libdir.patch"

View File

@ -0,0 +1,25 @@
Upstream-Issue: https://github.com/lpereira/lwan/issues/219
--- a/src/lib/CMakeLists.txt
+++ b/src/lib/CMakeLists.txt
@@ -90,19 +90,7 @@
set(ADDITIONAL_LIBRARIES ${ADDITIONAL_LIBRARIES} -lm PARENT_SCOPE)
-
-get_property(LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
-if ("${LIB64}" STREQUAL "TRUE")
- set(LIBSUFFIX 64)
-else ()
- get_property(LIB32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS)
- if ("${LIB32}" STREQUAL "TRUE")
- set(LIBSUFFIX 32)
- else ()
- set(LIBSUFFIX "")
- endif ()
-endif ()
-set(INSTALL_LIB_DIR lib${LIBSUFFIX} CACHE PATH "Installation directory for libraries")
+set(INSTALL_LIB_DIR lib CACHE PATH "Installation directory for libraries")
mark_as_advanced(INSTALL_LIB_DIR)
message(STATUS "Library install directory: ${CMAKE_INSTALL_PREFIX}/${INSTALL_LIB_DIR}")

View File

@ -0,0 +1,33 @@
From 3721cbececa18b369eb80176cb8aebe4beb99f1c Mon Sep 17 00:00:00 2001
From: Leandro Pereira <leandro@hardinfo.org>
Date: Mon, 22 Jan 2018 20:09:54 -0800
Subject: [PATCH] Pthread stack size should never be smaller than 16KiB
Tis is a nasty hack to support Musl libc, which defines
PTHREAD_STACK_MIN to 2048 bytes.
A better approach might be asking pthread to give the
actual stack size, and store this information somewhere
that the coroutine library will have access to; maybe
in the switcher struct.
Patch-Source: https://github.com/lpereira/lwan/commit/3721cbececa18b369eb80176cb8aebe4beb99f1c,
https://github.com/lpereira/lwan/commit/c5f5222a7c39d50c25348037b3d26716fbd6888b
diff --git a/src/lib/lwan-coro.c b/src/lib/lwan-coro.c
index 30be461..b3dfa54 100644
--- a/src/lib/lwan-coro.c
+++ b/src/lib/lwan-coro.c
@@ -34,7 +34,11 @@
#include <valgrind/valgrind.h>
#endif
-#define CORO_STACK_MIN ((3 * (PTHREAD_STACK_MIN)) / 2)
+#if PTHREAD_STACK_MIN <= 16384
+# undef PTHREAD_STACK_MIN
+# define PTHREAD_STACK_MIN 16384
+#endif
+#define CORO_STACK_MIN ((3 * (PTHREAD_STACK_MIN)) / 2)
static_assert(DEFAULT_BUFFER_SIZE < (CORO_STACK_MIN + PTHREAD_STACK_MIN),
"Request buffer fits inside coroutine stack");