net-libs/usockets: fix ssl build

Package-Manager: Portage-3.0.8, Repoman-3.0.2
Signed-off-by: Aisha Tammy <gentoo@aisha.cc>
This commit is contained in:
epsilonKNOT
2020-11-22 18:33:44 -05:00
parent bf680d5a2a
commit 753e8bf323
3 changed files with 11 additions and 10 deletions

View File

@@ -1,5 +1,5 @@
diff --git a/Makefile b/Makefile
index 27f97ce..1a01539 100644
index 27f97ce..066305c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,13 @@
@@ -8,7 +8,7 @@ index 27f97ce..1a01539 100644
+prefix ?= "/usr/local"
+exec_prefix ?= "$(prefix)"
+libdir ?= "$(exec_prefix)/lib"
+includedir?= "$(exec_prefix)/include/uSockets"
+includedir ?= "$(exec_prefix)/include/uSockets"
+
+# OpenBSD specific library version
+LIBTARGET = libusockets.so.$(LIBusockets_VERSION)
@@ -16,7 +16,7 @@ index 27f97ce..1a01539 100644
# 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)
@@ -34,17 +44,28 @@ ifeq ($(WITH_ASAN),1)
@@ -34,17 +44,31 @@ ifeq ($(WITH_ASAN),1)
endif
override CFLAGS += -std=c11 -Isrc
@@ -28,11 +28,12 @@ index 27f97ce..1a01539 100644
rm -f *.o
- $(CC) $(CFLAGS) -flto -O3 -c src/*.c src/eventing/*.c src/crypto/*.c
-# For now we do rely on C++17 for OpenSSL support but we will be porting this work to C11
-ifeq ($(WITH_OPENSSL),1)
+ $(CC) $(CFLAGS) -fPIC -c src/*.c src/eventing/*.c src/crypto/*.c
ifeq ($(WITH_OPENSSL),1)
- $(CXX) $(CXXFLAGS) -std=c++17 -flto -O3 -c src/crypto/*.cpp
-endif
+ $(CXX) $(CXXFLAGS) -fPIC -std=c++17 -c src/crypto/*.cpp
endif
- $(AR) rvs uSockets.a *.o
+ $(CC) -fPIC -c src/*.c src/eventing/*.c src/crypto/*.c $(CFLAGS)
+ $(AR) rvs libusockets.a *.o
+ $(CC) -shared -fPIC -Wl,-soname,$(LIBTARGET) $(CFLAGS) -o $(LIBTARGET) *.o $(LDFLAGS)
+
@@ -41,8 +42,8 @@ index 27f97ce..1a01539 100644
+ install -d "$(DESTDIR)$(libdir)" \
+ "$(DESTDIR)$(includedir)/internal/eventing" \
+ "$(DESTDIR)$(includedir)/internal/networking"
+ # OpenBSD specific library version
+ install -m 755 $(LIBTARGET) "$(DESTDIR)$(libdir)/"
+ ln -sf $(LIBTARGET)"$(DESTDIR)$(libdir)/libusockets.so"
+ # install static library
+ install -m 755 libusockets.a "$(DESTDIR)$(libdir)/"
+ # we also install all the header files
@@ -53,7 +54,7 @@ index 27f97ce..1a01539 100644
# Builds all examples
.PHONY: examples
@@ -57,4 +78,5 @@ swift_examples:
@@ -57,4 +81,5 @@ swift_examples:
clean:
rm -f *.o
rm -f *.a

View File

@@ -44,7 +44,7 @@ src_compile() {
src_install() {
emake libdir="/usr/$(get_libdir)" \
prefix="/usr" \
DESTDIR="${D}" \
DESTDIR="${ED}" \
LIBusockets_VERSION=${PV} \
install
einstalldocs

View File

@@ -44,7 +44,7 @@ src_compile() {
src_install() {
emake libdir="/usr/$(get_libdir)" \
prefix="/usr" \
DESTDIR="${D}" \
DESTDIR="${ED}" \
LIBusockets_VERSION=${PV} \
install
einstalldocs