From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id D03F8139360 for ; Tue, 10 Aug 2021 21:17:11 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id ED205E0863; Tue, 10 Aug 2021 21:17:10 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id CD5DCE0863 for ; Tue, 10 Aug 2021 21:17:10 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 74B81342A93 for ; Tue, 10 Aug 2021 21:17:09 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id B7C4B7CE for ; Tue, 10 Aug 2021 21:17:07 +0000 (UTC) From: "Anna Vyalkova" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Anna Vyalkova" Message-ID: <1628629933.f7989067085a38f222241fa51792b6e86fb0a06f.cybertailor@gentoo> Subject: [gentoo-commits] repo/proj/guru:dev commit in: net-libs/kcgi/ X-VCS-Repository: repo/proj/guru X-VCS-Files: net-libs/kcgi/kcgi-0.12.5.ebuild X-VCS-Directories: net-libs/kcgi/ X-VCS-Committer: cybertailor X-VCS-Committer-Name: Anna Vyalkova X-VCS-Revision: f7989067085a38f222241fa51792b6e86fb0a06f X-VCS-Branch: dev Date: Tue, 10 Aug 2021 21:17:07 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 0388290b-9ff1-4a5a-9a91-cec27f1fd2f7 X-Archives-Hash: 2c3653d915334e7b8d5f08b50c3057b4 commit: f7989067085a38f222241fa51792b6e86fb0a06f Author: Anna (cybertailor) Vyalkova sysrq in> AuthorDate: Tue Aug 10 21:12:13 2021 +0000 Commit: Anna Vyalkova sysrq in> CommitDate: Tue Aug 10 21:12:13 2021 +0000 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=f7989067 net-libs/kcgi: convert static libraries to shared Signed-off-by: Anna (cybertailor) Vyalkova sysrq.in> net-libs/kcgi/kcgi-0.12.5.ebuild | 68 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 3 deletions(-) diff --git a/net-libs/kcgi/kcgi-0.12.5.ebuild b/net-libs/kcgi/kcgi-0.12.5.ebuild index 79afbe7c8..380808248 100644 --- a/net-libs/kcgi/kcgi-0.12.5.ebuild +++ b/net-libs/kcgi/kcgi-0.12.5.ebuild @@ -3,7 +3,7 @@ EAPI=8 -inherit multiprocessing toolchain-funcs +inherit flag-o-matic multilib multiprocessing toolchain-funcs DESCRIPTION="Minimal CGI library for web applications" HOMEPAGE="https://kristaps.bsd.lv/kcgi/" @@ -32,15 +32,72 @@ DEPEND="${RDEPEND} PATCHES=( "${FILESDIR}"/${PN}-$(ver_cut 1-2)-ldflags.patch ) +_get_version_component_count() { + local cnt=( $(ver_rs 1- ' ') ) + echo ${#cnt[@]} || die +} + +static_to_shared() { + local libstatic=${1} + shift + local libname=$(basename ${libstatic%.a}) + local soname=${libname}$(get_libname $(ver_cut 1-2)) + local libdir=$(dirname ${libstatic}) + + einfo "Making ${soname} from ${libstatic}" + if [[ ${CHOST} == *-darwin* ]] ; then + ${LINK:-$(tc-getCC)} ${LDFLAGS} \ + -dynamiclib -install_name "${EPREFIX}"/usr/lib/"${soname}" \ + -Wl,-all_load -Wl,${libstatic} \ + "$@" -o ${libdir}/${soname} || die "${soname} failed" + else + ${LINK:-$(tc-getCC)} ${LDFLAGS} \ + -shared -Wl,-soname=${soname} \ + -Wl,--whole-archive ${libstatic} -Wl,--no-whole-archive \ + "$@" -o ${libdir}/${soname} || die "${soname} failed" + + if [[ $(_get_version_component_count) -ge 1 ]] ; then + ln -s ${soname} ${libdir}/${libname}$(get_libname $(ver_cut 1)) || die + fi + + ln -s ${soname} ${libdir}/${libname}$(get_libname) || die + fi +} + src_prepare() { default # disable failing tests sed -e '/\s*regress\/test-debug-.*/d' -i Makefile || die + + # ld: multiple definition of `dummy' + local deselect=( sandbox-{capsicum,darwin,pledge,seccomp-filter}.o ) + case ${CHOST} in + *-linux-*) + deselect=( "${deselect[@]/sandbox-seccomp-filter.o}" ) + ;; + *-darwin*) + deselect=( "${deselect[@]/sandbox-darwin.o}" ) + ;; + *-freebsd*) + deselect=( "${deselect[@]/sandbox-capsicum.o}" ) + ;; + *-openbsd*) + deselect=( "${deselect[@]/sandbox-pledge.o}" ) + ;; + esac + + for obj in "${deselect[@]}"; do + # elements are not deleted completely from the array + if [[ -n "${obj}" ]]; then + sed "/${obj}/d" -i Makefile || die + fi + done } src_configure() { tc-export CC AR + append-cflags -fPIC # note: not an autoconf configure script conf_args=( @@ -56,6 +113,12 @@ src_configure() { src_compile() { bmake -j$(makeopts_jobs) || die + + static_to_shared libkcgi.a -lz -lmd + static_to_shared libkcgihtml.a + static_to_shared libkcgijson.a -lm + static_to_shared libkcgiregress.a + static_to_shared libkcgixml.a } src_test() { @@ -69,10 +132,9 @@ src_install() { DATADIR="/usr/share/doc/${PF}/examples" \ install || die - # kcgi does not install shared libraries + dolib.so lib*$(get_libname)* if ! use static-libs; then find "${ED}" -name '*.a' -delete || die - find "${ED}" -name '*.pc' -delete || die fi einstalldocs