dev-lua/cqueues: new package, add 20200726_p20241204

dep for dev-lua/lua-http and optional for net-dns/knot-resolver

Signed-off-by: Nicolas PARLANT <nicolas.parlant@parhuet.fr>
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Nicolas PARLANT
2024-12-10 15:25:58 +00:00
committed by Sam James
parent e00f685c7b
commit 455b886fc8
5 changed files with 245 additions and 0 deletions

1
dev-lua/cqueues/Manifest Normal file
View File

@@ -0,0 +1 @@
DIST cqueues-20200726_p20241204.tar.gz 511991 BLAKE2B 13aeb72435fbfd84e3af11f7d79547ca72b2863ffff4d24d1e14115225973f175b19440732c1d9f4f57c22ef454b3abfe503e7b18de145b4c04f44e87297365c SHA512 9e510c3da50ce601d7fde8cf4e3f4262aa9ec1e81099e4411cf233a138338f5098de8eddce5600732ff7ad97329a7eb501f7c51b911b0c3dd82cd4f0220e4c99

View File

@@ -0,0 +1,142 @@
# Copyright 2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
LUA_COMPAT=( lua5-{1..4} luajit )
inherit lua toolchain-funcs
DESCRIPTION="Stackable Continuation Queues"
HOMEPAGE="https://github.com/wahern/cqueues"
HOMEPAGE+=" http://25thandclement.com/~william/projects/cqueues.html"
EGIT_COMMIT="8c0142577d3cb1f24917879997678bef0d084815"
SRC_URI="https://github.com/wahern/${PN}/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/${PN}-${EGIT_COMMIT}"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64"
IUSE="examples"
REQUIRED_USE="${LUA_REQUIRED_USE}"
COMMON_DEPEND="
${LUA_DEPS}
dev-libs/openssl:0=
"
DEPEND="
${COMMON_DEPEND}
dev-lua/compat53[${LUA_USEDEP}]
"
RDEPEND="${COMMON_DEPEND}"
BDEPEND="virtual/pkgconfig"
PATCHES=(
"${FILESDIR}"/cqueues-20200726_p20241204-qa-flags.patch
"${FILESDIR}"/cqueues-20200726_p20241204-rm-vendor-compat53.patch
)
DOCS=( "doc/." )
lua_src_prepare() {
pushd "${BUILD_DIR}" || die
if [[ ${ELUA} != luajit ]]; then
LUA_VERSION="$(ver_cut 1-2 $(lua_get_version))"
# these two tests are forced upstream for luajit only
rm "${BUILD_DIR}"/regress/{44-resolvers-gc,51-join-defunct-thread}.lua || die
else
# Thanks to dev-lua/luaossl for this workaround
# This is a workaround for luajit, as it confirms to lua5.1
# and the 'GNUmakefile' doesn't understand LuaJITs version.
LUA_VERSION="5.1"
fi
if [[ ${LUA_VERSION} != 5.3 ]]; then
# this test is forced upstream for lua5-3 only
rm "${BUILD_DIR}"/regress/152-thread-integer-passing.lua || die
fi
# install tests for lua_version only
sed -e 's:for V in 5.1 5.2 5.3 5.4:for V in '${LUA_VERSION}':' \
-i "${BUILD_DIR}"/regress/GNUmakefile || die
popd || die
}
src_prepare() {
default
rm -r vendor || die
# tests deleted :
# 22, 73, 87 = weak/old ssl
# 30,62,153 = network required
rm regress/22-client-dtls.lua \
regress/73-starttls-buffering.lua \
regress/87-alpn-disappears.lua \
regress/30-starttls-completion.lua \
regress/62-noname.lua \
regress/153-dns-resolvers.lua || die
lua_copy_sources
lua_foreach_impl lua_src_prepare
}
lua_src_compile() {
pushd "${BUILD_DIR}" || die
if [[ ${ELUA} != luajit ]]; then
LUA_VERSION="$(ver_cut 1-2 $(lua_get_version))"
else
LUA_VERSION="5.1"
fi
emake CC=$(tc-getCC) \
all${LUA_VERSION}
popd || die
}
src_compile() {
lua_foreach_impl lua_src_compile
}
lua_src_test() {
pushd "${BUILD_DIR}" || die
emake CC=$(tc-getCC) check
popd || die
}
src_test() {
lua_foreach_impl lua_src_test
}
lua_src_install() {
pushd "${BUILD_DIR}" || die
if [[ ${ELUA} != luajit ]]; then
LUA_VERSION="$(ver_cut 1-2 $(lua_get_version))"
else
LUA_VERSION="5.1"
fi
emake CC=$(tc-getCC) \
"DESTDIR=${D}" \
"lua${LUA_VERSION/./}cpath=$(lua_get_cmod_dir)" \
"lua${LUA_VERSION/./}path=$(lua_get_lmod_dir)" \
"prefix=${EPREFIX}/usr" \
install${LUA_VERSION}
popd || die
}
src_install() {
lua_foreach_impl lua_src_install
use examples && dodoc -r "examples/."
einstalldocs
}

View File

@@ -0,0 +1,39 @@
--- a/GNUmakefile 2024-12-10 19:17:18.107965992 -0000
+++ b/GNUmakefile 2024-12-10 19:17:25.319850369 -0000
@@ -19,7 +19,6 @@
LUAPATH_FN = $(shell env CC='$(subst ',\\',$(CC))' CPPFLAGS='$(subst ',\\',$(CPPFLAGS))' LDFLAGS='$(subst ',\\',$(LDFLAGS))' $(LUAPATH) -krxm3 -I '$(subst ',\\',$(DESTDIR)$(includedir))' -I/usr/include -I/usr/local/include -P '$(subst ',\\',$(DESTDIR)$(bindir))' -P '$(subst ',\\',$(bindir))' -L '$(subst ',\\',$(DESTDIR)$(libdir))' -L '$(subst ',\\',$(libdir))' -v$(1) $(2))
# check whether luapath can locate Lua $(1) headers
-HAVE_API_FN = $(and $(filter $(1),$(call LUAPATH_FN,$(1),version)),$(1)$(info enabling Lua $(1)))
# check whether $(1) in LUA_APIS or $(LUA$(1:.=)_CPPFLAGS) is non-empty
WITH_API_FN = $$(and $$(or $$(filter $(1),$$(LUA_APIS)),$$(LUA$(subst .,,$(1))_CPPFLAGS)),$(1))
@@ -168,18 +167,15 @@
ifeq ($(origin ALL_CFLAGS), undefined)
ifeq ($(VENDOR_CC_$(d)), gcc)
-ALL_CFLAGS += -O2 -std=gnu99 -fPIC
-ALL_CFLAGS += -g -Wall -Wextra $(call cc-option, -Wno-missing-field-initializers) $(call cc-option, -Wno-override-init) -Wno-unused
+ALL_CFLAGS += -std=gnu99 -fPIC
endif
ifeq ($(VENDOR_CC_$(d)), clang)
-ALL_CFLAGS += -O2 -std=gnu99 -fPIC
-ALL_CFLAGS += -g -Wall -Wextra -Wno-missing-field-initializers -Wno-initializer-overrides -Wno-unused -Wno-dollar-in-identifier-extension
+ALL_CFLAGS += -std=gnu99 -fPIC
endif
ifeq ($(VENDOR_CC_$(d)), sunpro)
ALL_CFLAGS += -xcode=pic13
-ALL_CFLAGS += -g
#
# Solaris Studio supports anonymous unions just fine; but it complains
# incessantly about them.
@@ -215,7 +211,6 @@
#
ifeq ($(origin ALL_LDFLAGS), undefined)
-ALL_LDFLAGS += -L$(DESTDIR)$(libdir) -L$(libdir)
ALL_LDFLAGS += $(LDFLAGS)
endif # ALL_LDFLAGS

View File

@@ -0,0 +1,48 @@
--- a/src/GNUmakefile 2024-12-10 19:37:27.380639046 -0000
+++ b/src/GNUmakefile 2024-12-10 19:37:56.648169798 -0000
@@ -22,7 +22,7 @@
VERSION_$(d) = $(or $(CQUEUES_VERSION),$(shell $(<D)/../mk/changelog version))
COMMIT_$(d) = $(shell $(<D)/../mk/changelog commit)
-CPPFLAGS_$(d) = $(ALL_CPPFLAGS) -DCOMPAT53_PREFIX=cqueues
+CPPFLAGS_$(d) = $(ALL_CPPFLAGS)
CFLAGS_$(d) = $(ALL_CFLAGS)
SOFLAGS_$(d) = $(ALL_SOFLAGS)
LDFLAGS_$(d) = $(ALL_LDFLAGS)
@@ -50,7 +50,7 @@
$$(d)/$(1)/cqueues.so: $$(addprefix $$(d)/$(1)/, $$(OBJS_$(d))) $$(d)/lib/libnonlua.a
$$(CC) -o $$@ $$^ $$(SOFLAGS_$$(abspath $$(@D)/..)) $$(LDFLAGS_$$(abspath $$(@D)/..)) $$(LIBS_$$(abspath $$(@D)/..))
-$$(d)/$(1)/%.o: $$(d)/%.c $$(d)/cqueues.h $$(d)/../vendor/compat53/c-api/compat-5.3.h $$(d)/config.h
+$$(d)/$(1)/%.o: $$(d)/%.c $$(d)/cqueues.h $$(d)/config.h
$$(MKDIR) -p $$(@D)
$$(CC) $$(CFLAGS_$$(<D)) $$(ALL_LUA$(subst .,,$(1))_CPPFLAGS) $$(CPPFLAGS_$$(<D)) -c -o $$@ $$<
@@ -66,16 +66,6 @@
$$(d)/$(1)/notify.o: $$(d)/lib/notify.h
-ifneq ($(1), 5.3)
-ifneq ($(1), 5.4)
-$$(d)/$(1)/compat53.o: $$(d)/../vendor/compat53/c-api/compat-5.3.c $$(d)/../vendor/compat53/c-api/compat-5.3.h $$(d)/config.h
- $$(MKDIR) -p $$(@D)
- $$(CC) $$(CFLAGS_$(d)) $$(ALL_LUA$(subst .,,$(1))_CPPFLAGS) $$(CPPFLAGS_$(d)) -c -o $$@ $$<
-
-$$(d)/$(1)/cqueues.so: $$(d)/$(1)/compat53.o
-endif
-endif
-
.SECONDARY: liblua$(1)-cqueues cqueues$(1) cqueues
liblua$(1)-cqueues cqueues$(1) cqueues: $$(d)/$(1)/cqueues.so
--- a/src/cqueues.h 2024-12-10 19:37:27.380639046 -0000
+++ b/src/cqueues.h 2024-12-10 19:37:38.028468322 -0000
@@ -40,7 +40,7 @@
#include <lualib.h>
#include <lauxlib.h>
-#include "../vendor/compat53/c-api/compat-5.3.h"
+#include <compat-5.3.h>
/*

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>nicolas.parlant@parhuet.fr</email>
<name>Nicolas PARLANT</name>
</maintainer>
<maintainer type="project" proxied="proxy">
<email>proxy-maint@gentoo.org</email>
<name>Proxy Maintainers</name>
</maintainer>
<upstream>
<remote-id type="github">wahern/cqueues</remote-id>
</upstream>
</pkgmetadata>