dev-cpp/usockets: tiny, ultra fast, async sockets framework

Package-Manager: Portage-2.3.89, Repoman-2.3.20
Signed-off-by: Aisha Tammy <gentoo@aisha.cc>
This commit is contained in:
Aisha Tammy
2020-04-30 13:12:17 -04:00
parent f2045894c2
commit d4ff18ce5d
4 changed files with 118 additions and 0 deletions

View File

@@ -0,0 +1 @@
DIST usockets-0.3.5.tar.gz 47939 BLAKE2B fc73f44adc19bd31b78832084a64f2ba3e7b463232056bf67370cf116bf43a0e63734a26fcc833b3d5f917c671cc6fb1983d52c4c92e2f7aae81500df5c5d12d SHA512 a76a469d10e10592b651aa6ccc5d25dfa89015d6b74c8d2268df8eee4206d9194de82ac79079f06f5277803ecfa13cf4bd9ff29bf0ccc98b6ee64798aada796e

View File

@@ -0,0 +1,54 @@
diff --git a/Makefile b/Makefile
index fa6e2ff..9fdcf47 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,14 @@
+DESTDIR ?=
+
+prefix ?= "/usr/local"
+exec_prefix ?= "$(prefix)"
+libdir ?= "$(exec_prefix)/lib"
+includedir?= "$(exec_prefix)/include/uSockets"
+
+VERSION = 0.3.5
+LIBTARGET = libusockets.so
+
+
# WITH_OPENSSL=1 enables OpenSSL 1.1+ support
ifeq ($(WITH_OPENSSL),1)
override CFLAGS += -DLIBUS_USE_OPENSSL
@@ -35,8 +46,27 @@ endif
override CFLAGS += -std=c11 -Isrc
override LDFLAGS += uSockets.a
-# By default we build the uSockets.a static library
+# By default we build the libusockets.so shared library
default:
+ rm -f *.o
+ $(CC) $(CFLAGS) $(CPPFLAGS) -fpic -c src/*.c src/eventing/*.c src/crypto/*.c
+ $(CC) -shared -Wl,-soname,libusockets.so -o $(LIBTARGET) *.o
+
+install: default
+ # install the folders needed (making sure that the exist)
+ install -d "$(DESTDIR)$(libdir)" \
+ "$(DESTDIR)$(includedir)/internal/eventing" \
+ "$(DESTDIR)$(includedir)/internal/networking"
+ # install the library first, while making sure that the symlink is updated
+ install -m 755 $(LIBTARGET) "$(DESTDIR)$(libdir)/$(LIBTARGET).$(VERSION)"
+ @ cd "$(DESTDIR)$(libdir)" && ln -snf "$(LIBTARGET).$(VERSION)" "$(LIBTARGET)"
+ # we also install all the header files
+ install -m 644 src/*.h "$(DESTDIR)$(includedir)/"
+ install -m 644 src/internal/*.h "$(DESTDIR)$(includedir)/internal/"
+ install -m 644 src/internal/eventing/*.h "$(DESTDIR)$(includedir)/internal/eventing/"
+ install -m 644 src/internal/networking/*.h "$(DESTDIR)$(includedir)/internal/networking/"
+
+static:
rm -f *.o
$(CC) $(CFLAGS) -flto -O3 -c src/*.c src/eventing/*.c src/crypto/*.c
$(AR) rvs uSockets.a *.o
@@ -52,4 +82,5 @@ swift_examples:
clean:
rm -f *.o
rm -f *.a
+ rm -f *.so
rm -rf .certs

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>gentoo@aisha.cc</email>
<name>Aisha Tammy</name>
</maintainer>
<maintainer type="project">
<email>proxy-maint@gentoo.org</email>
<name>Proxy Maintainers</name>
</maintainer>
<use>
<flag name="libuv">Enable bindings to use the libuv dispatcher</flag>
</use>
</pkgmetadata>

View File

@@ -0,0 +1,48 @@
# Copyright 2019-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit multilib
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="libuv +ssl libressl debug"
DEPEND="ssl? (
libressl? ( >=dev-libs/libressl-3.0.0 )
!libressl? ( >=dev-libs/openssl-1.1.0 )
)
libuv? ( dev-libs/libuv )
"
BDEPEND="${DEPEND}"
RDEPEND="${DEPEND}"
PATCHES=(
"${FILESDIR}/usockets-Makefile.patch"
)
src_compile() {
# the Makefile uses environment variables
emake WITH_OPENSSL=$(usex ssl 1 0) \
WITH_LIBUV=$(usex libuv 1 0) \
WITH_ASAN=$(usex debug 1 0) \
default
}
src_install() {
emake libdir="/usr/$(get_libdir)" prefix="/usr" DESTDIR="${D}" install
einstalldocs
}