mirror of
https://github.com/gentoo-mirror/guru.git
synced 2026-07-19 12:03:02 -04:00
net-libs/usockets: update to 0.8.8
Signed-off-by: Aisha Tammy <gentoo@aisha.cc>
This commit is contained in:
@@ -1 +1,2 @@
|
||||
DIST usockets-0.8.1_p20211023.tar.gz 66346 BLAKE2B 1833d1d3981fd5cf7f48794b183426341d7dd0b36654a528335c61a2495a59e54bad6f634ec14ccf8b33895091cc48306d7d7b90031888ba661a2db8019f30e9 SHA512 146c130731ac8f071f339e71c8cd45f319e837d333a36c6f578a2d7d9546267660ad0d3f82505d3f5d33b0494ec26b2d7b7eba3756d62ecc883b1afbf6c5bfb2
|
||||
DIST usockets-0.8.8.tar.gz 90860 BLAKE2B 9a0886cf9446e67d8026419b353472d68f74045346c9e92b7ebb4f626580e1150ec555e6b56fbfad217ef38cc3b2c9d6148743033d0e42839eca998294393935 SHA512 726b1665209d0006d6621352c12019bbab22bed75450c5ef1509b409d3c19c059caf94775439d3b910676fa2a4a790d490c3e25e5b8141423d88823642be7ac7
|
||||
|
||||
172
net-libs/usockets/files/usockets-0.8.8-Makefile.patch
Normal file
172
net-libs/usockets/files/usockets-0.8.8-Makefile.patch
Normal file
@@ -0,0 +1,172 @@
|
||||
diff --git a/Makefile b/Makefile
|
||||
index aa874b9..13f9b34 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -1,109 +1,90 @@
|
||||
-# By default we use LTO, but Windows does not support it
|
||||
-ifneq ($(WITH_LTO),0)
|
||||
- override CFLAGS += -flto
|
||||
-endif
|
||||
+VERSION ?= 0.0
|
||||
|
||||
-# WITH_BORINGSSL=1 enables BoringSSL support, linked statically (preferred over OpenSSL)
|
||||
-# You need to call "make boringssl" before
|
||||
-ifeq ($(WITH_BORINGSSL),1)
|
||||
- override CFLAGS += -Iboringssl/include -pthread -DLIBUS_USE_OPENSSL
|
||||
- override LDFLAGS += -pthread boringssl/build/ssl/libssl.a boringssl/build/crypto/libcrypto.a -lstdc++
|
||||
-else
|
||||
- # WITH_OPENSSL=1 enables OpenSSL 1.1+ support
|
||||
- # For now we need to link with C++ for OpenSSL support, but should be removed with time
|
||||
- ifeq ($(WITH_OPENSSL),1)
|
||||
- override CFLAGS += -DLIBUS_USE_OPENSSL
|
||||
- # With problems on macOS, make sure to pass needed LDFLAGS required to find these
|
||||
- override LDFLAGS += -lssl -lcrypto -lstdc++
|
||||
- else
|
||||
- # WITH_WOLFSSL=1 enables WolfSSL 4.2.0 support (mutually exclusive with OpenSSL)
|
||||
- ifeq ($(WITH_WOLFSSL),1)
|
||||
- # todo: change these
|
||||
- override CFLAGS += -DLIBUS_USE_WOLFSSL -I/usr/local/include
|
||||
- override LDFLAGS += -L/usr/local/lib -lwolfssl
|
||||
- else
|
||||
- override CFLAGS += -DLIBUS_NO_SSL
|
||||
- endif
|
||||
- endif
|
||||
-endif
|
||||
+PREFIX ?= /usr
|
||||
+LIB ?= lib
|
||||
+LIBDIR ?= $(PREFIX)/$(LIB)
|
||||
+INCDIR ?= $(PREFIX)/include
|
||||
|
||||
-# WITH_IO_URING=1 builds with io_uring as event-loop and network implementation
|
||||
-ifeq ($(WITH_IO_URING),1)
|
||||
- override CFLAGS += -DLIBUS_USE_IO_URING
|
||||
- # override LDFLAGS += -l
|
||||
+PKG_CONFIG ?= pkg-config
|
||||
+
|
||||
+LIBTARGET = libusockets.so
|
||||
+LIBTARGETV = $(LIBTARGET).$(VERSION)
|
||||
+
|
||||
+REQUIRES =
|
||||
+COMMON_FLAGS = -fPIC -Isrc
|
||||
+
|
||||
+# WITH_OPENSSL=1 enables OpenSSL 1.1+ support or BoringSSL
|
||||
+# For now we need to link with C++ for OpenSSL support, but should be removed with time
|
||||
+ifeq ($(WITH_OPENSSL),1)
|
||||
+COMMON_FLAGS += -DLIBUS_USE_OPENSSL
|
||||
+REQUIRES += libssl libcrypto
|
||||
endif
|
||||
|
||||
# WITH_LIBUV=1 builds with libuv as event-loop
|
||||
ifeq ($(WITH_LIBUV),1)
|
||||
- override CFLAGS += -DLIBUS_USE_LIBUV
|
||||
- override LDFLAGS += -luv
|
||||
-endif
|
||||
-
|
||||
-# WITH_ASIO builds with boot asio event-loop
|
||||
-ifeq ($(WITH_ASIO),1)
|
||||
- override CFLAGS += -DLIBUS_USE_ASIO
|
||||
- override LDFLAGS += -lstdc++ -lpthread
|
||||
- override CXXFLAGS += -pthread -DLIBUS_USE_ASIO
|
||||
+COMMON_FLAGS += -DLIBUS_USE_LIBUV
|
||||
+REQUIRES += libuv
|
||||
endif
|
||||
|
||||
-# WITH_GCD=1 builds with libdispatch as event-loop
|
||||
-ifeq ($(WITH_GCD),1)
|
||||
- override CFLAGS += -DLIBUS_USE_GCD
|
||||
- override LDFLAGS += -framework CoreFoundation
|
||||
+# WITH_IO_URING=1 builds with io_uring as event-loop and network implementation
|
||||
+ifeq ($(WITH_IO_URING),1)
|
||||
+COMMON_FLAGS += -DLIBUS_USE_IO_URING
|
||||
+REQUIRES += liburing
|
||||
endif
|
||||
|
||||
-# WITH_ASAN builds with sanitizers
|
||||
-ifeq ($(WITH_ASAN),1)
|
||||
- override CFLAGS += -fsanitize=address -g
|
||||
- override LDFLAGS += -fsanitize=address
|
||||
+# WITH_ASIO=1 builds with boost asio event-loop
|
||||
+ifeq ($(WITH_ASIO),1)
|
||||
+COMMON_FLAGS += -pthread -DLIBUS_USE_ASIO
|
||||
endif
|
||||
|
||||
ifeq ($(WITH_QUIC),1)
|
||||
- override CFLAGS += -DLIBUS_USE_QUIC -pthread -std=c11 -Isrc -Ilsquic/include
|
||||
- override LDFLAGS += -pthread -lz -lm uSockets.a lsquic/src/liblsquic/liblsquic.a
|
||||
-else
|
||||
- override CFLAGS += -std=c11 -Isrc
|
||||
- override LDFLAGS += uSockets.a
|
||||
+override CFLAGS += -DLIBUS_USE_QUIC -pthread -std=c11 -Isrc -Ilsquic/include
|
||||
+override LDFLAGS += -pthread -lz -lm uSockets.a lsquic/src/liblsquic/liblsquic.a
|
||||
endif
|
||||
|
||||
-# Also link liburing for io_uring support
|
||||
-ifeq ($(WITH_IO_URING),1)
|
||||
- override LDFLAGS += /usr/lib/liburing.a
|
||||
-endif
|
||||
+CFLAGS += -std=c11 $(COMMON_FLAGS)
|
||||
+CXXFLAGS += -std=c++17 $(COMMON_FLAGS)
|
||||
+
|
||||
|
||||
-# By default we build the uSockets.a static library
|
||||
default:
|
||||
- rm -f *.o
|
||||
- $(CC) $(CFLAGS) -O3 -c src/*.c src/eventing/*.c src/crypto/*.c src/io_uring/*.c
|
||||
-# Also link in Boost Asio support
|
||||
+ $(CC) $(CFLAGS) -c src/*.c src/eventing/*.c src/crypto/*.c
|
||||
ifeq ($(WITH_ASIO),1)
|
||||
- $(CXX) $(CXXFLAGS) -Isrc -std=c++14 -flto -O3 -c src/eventing/asio.cpp
|
||||
+ $(CXX) $(CXXFLAGS) -c src/eventing/asio.cpp
|
||||
endif
|
||||
-
|
||||
# For now we do rely on C++17 for OpenSSL support but we will be porting this work to C11
|
||||
ifeq ($(WITH_OPENSSL),1)
|
||||
- $(CXX) $(CXXFLAGS) -std=c++17 -flto -O3 -c src/crypto/*.cpp
|
||||
+ $(CXX) $(CXXFLAGS) -c src/crypto/*.cpp
|
||||
endif
|
||||
ifeq ($(WITH_BORINGSSL),1)
|
||||
$(CXX) $(CXXFLAGS) -std=c++17 -flto -O3 -c src/crypto/*.cpp
|
||||
endif
|
||||
-# Create a static library (try windows, then unix)
|
||||
- lib.exe /out:uSockets.a *.o || $(AR) rvs uSockets.a *.o
|
||||
+ $(AR) rvs libusockets.a *.o
|
||||
+ $(CXX) $(CXXFLAGS) -shared -o $(LIBTARGETV) *.o -Wl,-soname,$(LIBTARGET) `$(PKG_CONFIG) --libs $(REQUIRES)` $(LDFLAGS)
|
||||
+ sed -e "s:@PREFIX@:$(PREFIX):" -e "s:@REQUIRES@:$(REQUIRES):" \
|
||||
+ -e "s:@LIB@:$(LIB):" -e "s:@VERSION@:$(VERSION):" libusockets.pc.in > libusockets.pc
|
||||
|
||||
-# BoringSSL needs cmake and golang
|
||||
-.PHONY: boringssl
|
||||
-boringssl:
|
||||
- cd boringssl && mkdir -p build && cd build && cmake -DCMAKE_BUILD_TYPE=Release .. && make -j8
|
||||
|
||||
-# Builds all examples
|
||||
-.PHONY: examples
|
||||
-examples: default
|
||||
- for f in examples/*.c; do $(CC) -O3 $(CFLAGS) -o $$(basename "$$f" ".c")$(EXEC_SUFFIX) "$$f" $(LDFLAGS); done
|
||||
+install:
|
||||
+ install -d "$(DESTDIR)$(LIBDIR)/pkgconfig" "$(DESTDIR)$(INCDIR)"
|
||||
+ install -m 644 src/libusockets.h "$(DESTDIR)$(INCDIR)/"
|
||||
+ install -m 644 $(LIBTARGETV) "$(DESTDIR)$(LIBDIR)"
|
||||
+ ln -sf $(LIBTARGETV) "$(DESTDIR)$(LIBDIR)/$(LIBTARGET)"
|
||||
+ install -m 644 libusockets.a "$(DESTDIR)$(LIBDIR)/"
|
||||
+ install -m 644 libusockets.pc "$(DESTDIR)$(LIBDIR)/pkgconfig/"
|
||||
+
|
||||
+
|
||||
+test:
|
||||
+ rm -f localhost.pem localhost.crt
|
||||
+ openssl req -x509 -out localhost.crt -keyout localhost.pem -newkey rsa:2048 -nodes -sha256 -subj '/CN=localhost' -extensions EXT -config localhost.conf
|
||||
+ $(CXX) $(CXXFLAGS) examples/hammer_test.c libusockets.a -o hammer_test `$(PKG_CONFIG) --libs $(REQUIRES)` $(LDFLAGS)
|
||||
+ ./hammer_test
|
||||
|
||||
-swift_examples:
|
||||
- swiftc -O -I . examples/swift_http_server/main.swift uSockets.a -o swift_http_server
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
rm -f *.a
|
||||
- rm -rf .certs
|
||||
+ rm -f *.so
|
||||
+ rm -f localhost.pem localhost.crt
|
||||
+ rm -f libusockets.pc
|
||||
+
|
||||
+.PHONY: default install clean test
|
||||
16
net-libs/usockets/files/usockets-0.8.8-hammer-test.patch
Normal file
16
net-libs/usockets/files/usockets-0.8.8-hammer-test.patch
Normal file
@@ -0,0 +1,16 @@
|
||||
diff --git a/examples/hammer_test.c b/examples/hammer_test.c
|
||||
index 010e232..0837b8d 100644
|
||||
--- a/examples/hammer_test.c
|
||||
+++ b/examples/hammer_test.c
|
||||
@@ -406,9 +406,8 @@ int main() {
|
||||
// these are ignored for non-SSL
|
||||
struct us_socket_context_options_t options;
|
||||
memset(&options, 0, sizeof(struct us_socket_context_options_t));
|
||||
- options.key_file_name = "/home/alexhultman/uWebSockets.js/misc/key.pem";
|
||||
- options.cert_file_name = "/home/alexhultman/uWebSockets.js/misc/cert.pem";
|
||||
- options.passphrase = "1234";
|
||||
+ options.key_file_name = "localhost.pem";
|
||||
+ options.cert_file_name = "localhost.crt";
|
||||
|
||||
http_context = us_create_socket_context(SSL, loop, sizeof(struct http_context), options);
|
||||
|
||||
54
net-libs/usockets/usockets-0.8.8.ebuild
Normal file
54
net-libs/usockets/usockets-0.8.8.ebuild
Normal file
@@ -0,0 +1,54 @@
|
||||
# Copyright 2019-2021 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=7
|
||||
|
||||
inherit toolchain-funcs
|
||||
|
||||
DESCRIPTION="tiny eventing, networking & crypto for async applications"
|
||||
HOMEPAGE="https://github.com/uNetworking/uSockets"
|
||||
|
||||
if [[ ${PV} == 9999 ]]; then
|
||||
inherit git-r3
|
||||
EGIT_REPO_URI="https://github.com/uNetworking/uSockets.git"
|
||||
else
|
||||
SRC_URI="https://github.com/uNetworking/uSockets/archive/v${PV}.tar.gz -> ${P}.tar.gz"
|
||||
KEYWORDS="~amd64 ~arm64 ~x86"
|
||||
S="${WORKDIR}/uSockets-${PV}"
|
||||
fi
|
||||
|
||||
LICENSE="Apache-2.0"
|
||||
SLOT="0"
|
||||
IUSE="asio libuv +ssl test"
|
||||
REQUIRED_USE="?? ( asio libuv ) test? ( ssl )"
|
||||
RESTRICT="!test? ( test )"
|
||||
|
||||
DEPEND="
|
||||
asio? ( dev-cpp/asio[ssl(+)?]:= )
|
||||
libuv? ( dev-libs/libuv )
|
||||
ssl? ( >=dev-libs/openssl-1.1.0 )
|
||||
"
|
||||
RDEPEND="${DEPEND}"
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}/${PN}-0.8.8-Makefile.patch"
|
||||
"${FILESDIR}/${PN}-0.8.1_p20211023-pkg-config.patch"
|
||||
"${FILESDIR}/${PN}-0.8.1_p20211023-gen-ssl-config.patch"
|
||||
"${FILESDIR}/${PN}-0.8.8-hammer-test.patch"
|
||||
)
|
||||
|
||||
src_configure() {
|
||||
tc-export CC CXX AR
|
||||
export VERSION="${PV%_*}" \
|
||||
LIB="$(get_libdir)" \
|
||||
WITH_OPENSSL="$(usex ssl 1 0)" \
|
||||
WITH_LIBUV="$(usex libuv 1 0)" \
|
||||
WITH_ASIO="$(usex asio 1 0)"
|
||||
default
|
||||
}
|
||||
|
||||
src_install() {
|
||||
default
|
||||
einstalldocs
|
||||
rm -f "${ED}/usr/$(get_libdir)/libusockets.a" || die
|
||||
}
|
||||
@@ -12,10 +12,9 @@ if [[ ${PV} == 9999 ]]; then
|
||||
inherit git-r3
|
||||
EGIT_REPO_URI="https://github.com/uNetworking/uSockets.git"
|
||||
else
|
||||
COMMIT="c2c1bbfa1644f1f6eb7fc9375650f41c5f9b7b06"
|
||||
SRC_URI="https://github.com/uNetworking/uSockets/archive/${COMMIT}.tar.gz -> ${P}.tar.gz"
|
||||
SRC_URI="https://github.com/uNetworking/uSockets/archive/v${PV}.tar.gz -> ${P}.tar.gz"
|
||||
KEYWORDS="~amd64 ~arm64 ~x86"
|
||||
S="${WORKDIR}/uSockets-${COMMIT}"
|
||||
S="${WORKDIR}/uSockets-${PV}"
|
||||
fi
|
||||
|
||||
LICENSE="Apache-2.0"
|
||||
@@ -25,17 +24,17 @@ REQUIRED_USE="?? ( asio libuv ) test? ( ssl )"
|
||||
RESTRICT="!test? ( test )"
|
||||
|
||||
DEPEND="
|
||||
asio? ( dev-cpp/asio[ssl(+)?] )
|
||||
asio? ( dev-cpp/asio[ssl(+)?]:= )
|
||||
libuv? ( dev-libs/libuv )
|
||||
ssl? ( >=dev-libs/openssl-1.1.0 )
|
||||
"
|
||||
RDEPEND="${DEPEND}"
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}/${PN}-0.8.1_p20211023-Makefile.patch"
|
||||
"${FILESDIR}/${PN}-0.8.8-Makefile.patch"
|
||||
"${FILESDIR}/${PN}-0.8.1_p20211023-pkg-config.patch"
|
||||
"${FILESDIR}/${PN}-0.8.1_p20211023-gen-ssl-config.patch"
|
||||
"${FILESDIR}/${PN}-0.8.1_p20211023-hammer-test.patch"
|
||||
"${FILESDIR}/${PN}-0.8.8-hammer-test.patch"
|
||||
)
|
||||
|
||||
src_configure() {
|
||||
|
||||
Reference in New Issue
Block a user