commit:     d9e2dd79d860822c8ee78b6844511472a2bbcc6a
Author:     Conrad Kostecki <conikost <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 22 01:47:55 2020 +0000
Commit:     Conrad Kostecki <conikost <AT> gentoo <DOT> org>
CommitDate: Sun Nov 22 01:50:36 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d9e2dd79

dev-libs/concurrencykit: fixed several bugs

This is a overhaul of the whole ebuild. Nothing will change for the
user, so I will keep the stable keyword for amd64, as I will drop 0.7.0
afterwards.

Fixes:
1) Fixed calling AR - upstream accepted patch.
2) Failing tests on x86 - Setting PROFILE correctly.
3) Disabling static libs - upstream accepted patch.
4) Updated patches to use from upstreams git.

Closes: https://bugs.gentoo.org/721926
Closes: https://bugs.gentoo.org/733170
Closes: https://bugs.gentoo.org/726398
Package-Manager: Portage-3.0.9, Repoman-3.0.2
Signed-off-by: Conrad Kostecki <conikost <AT> gentoo.org>

 .../concurrencykit/concurrencykit-0.7.0-r1.ebuild  |  40 ++++++++
 .../files/concurrencykit-0.7.0-ar.patch            | 112 +++++++++++++++++++++
 .../files/concurrencykit-0.7.0-glibc-2.30.patch    |  54 ++++++++++
 .../files/concurrencykit-0.7.0-gzip.patch          |  58 +++++++++++
 .../files/concurrencykit-0.7.0-static-libs.patch   |  75 ++++++++++++++
 5 files changed, 339 insertions(+)

diff --git a/dev-libs/concurrencykit/concurrencykit-0.7.0-r1.ebuild 
b/dev-libs/concurrencykit/concurrencykit-0.7.0-r1.ebuild
new file mode 100644
index 00000000000..3a87fe43a08
--- /dev/null
+++ b/dev-libs/concurrencykit/concurrencykit-0.7.0-r1.ebuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit toolchain-funcs
+
+MY_PN="ck"
+MY_P="${MY_PN}-${PV}"
+
+DESCRIPTION="A library with concurrency related algorithms and data structures 
in C"
+HOMEPAGE="http://concurrencykit.org";
+SRC_URI="https://github.com/${PN}/${MY_PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
+S="${WORKDIR}/${MY_P}"
+
+LICENSE="Apache-2.0 BSD-2"
+SLOT="0"
+KEYWORDS="amd64 ~x86"
+
+# The 'libck.so' has a name collision.
+# See #616762 for more information.
+RDEPEND="!sys-cluster/charm"
+
+PATCHES=(
+       "${FILESDIR}/${P}-ar.patch"
+       "${FILESDIR}/${P}-glibc-2.30.patch"
+       "${FILESDIR}/${P}-gzip.patch"
+       "${FILESDIR}/${P}-static-libs.patch"
+)
+
+src_configure() {
+       tc-export AR CC LD
+       export PROFILE="x86$(usex amd64 '_64' '')"
+
+       local myeconfargs=(
+               "--disable-static"
+       )
+
+       GZIP="" $(usex x86 'PROFILE=x86' '') econf ${myeconfargs[@]}
+}

diff --git a/dev-libs/concurrencykit/files/concurrencykit-0.7.0-ar.patch 
b/dev-libs/concurrencykit/files/concurrencykit-0.7.0-ar.patch
new file mode 100644
index 00000000000..70dd46a113f
--- /dev/null
+++ b/dev-libs/concurrencykit/files/concurrencykit-0.7.0-ar.patch
@@ -0,0 +1,112 @@
+From c6a2f41369bb4549bfaadf1120ccacd884b0b70f Mon Sep 17 00:00:00 2001
+From: Conrad Kostecki <c...@bl4ckb0x.de>
+Date: Sun, 22 Nov 2020 00:55:36 +0100
+Subject: [PATCH] Add support for setting AR
+
+By default, the command 'ar' is called. Is should be possible, as with
+'CC', to override that value and set an own AR.
+
+Signed-off-by: Conrad Kostecki <con...@kostecki.com>
+---
+ configure       | 11 +++++++++++
+ src/Makefile.in |  2 +-
+ 2 files changed, 12 insertions(+), 1 deletion(-)
+
+diff --git a/configure b/configure
+index 1b85d113..78535332 100755
+--- a/configure
++++ b/configure
+@@ -146,6 +146,7 @@ generate_stdout()
+       echo "           SRC_DIR = $BUILD_DIR"
+       echo "            SYSTEM = $SYSTEM"
+       echo "           PROFILE = $PROFILE"
++      echo "                AR = $AR"
+       echo "                CC = $CC"
+       echo "          COMPILER = $COMPILER"
+       echo "            CFLAGS = $CFLAGS"
+@@ -215,6 +216,7 @@ for option; do
+               echo "  --cores=N                Specify number of cores 
available on target machine"
+               echo
+               echo "The following environment variables may be used:"
++              echo "   AR       AR archiver command"
+               echo "   CC       C compiler command"
+               echo "   CFLAGS   C compiler flags"
+               echo "   LDFLAGS  Linker flags"
+@@ -645,6 +647,15 @@ if test ! -x "${CC}"; then
+ fi
+ assert "$CC" "not found"
+ 
++printf "Finding suitable archiver........"
++if test ! -x "${AR}"; then
++      AR=`pathsearch "${AR:-ar}"`
++      if test -z "$AR" -o ! -x "$AR"; then
++              AR=`pathsearch "${AR:-ar}"`
++      fi
++fi
++assert "$AR" "not found"
++
+ cat << EOF > .1.c
+ #include <stdio.h>
+ int main(void) {
+diff --git a/src/Makefile.in b/src/Makefile.in
+index 0b7ae7b6..73788497 100644
+--- a/src/Makefile.in
++++ b/src/Makefile.in
+@@ -25,7 +25,7 @@ libck.so: $(OBJECTS)
+       $(LD) $(LDFLAGS) -o $(TARGET_DIR)/libck.so $(OBJECTS)
+ 
+ libck.a: $(OBJECTS)
+-      ar rcs $(TARGET_DIR)/libck.a $(OBJECTS)
++      $(AR) rcs $(TARGET_DIR)/libck.a $(OBJECTS)
+ 
+ ck_array.o: $(INCLUDE_DIR)/ck_array.h $(SDIR)/ck_array.c
+       $(CC) $(CFLAGS) -c -o $(TARGET_DIR)/ck_array.o $(SDIR)/ck_array.c
+From 866c2af332a075cc83af78b184be0d5e6152de13 Mon Sep 17 00:00:00 2001
+From: Olivier Houchard <cog...@ci0.org>
+Date: Sun, 22 Nov 2020 01:16:10 +0100
+Subject: [PATCH] build: Make the lookup for an archiver report success.
+
+Move the code looking for ar outside the compiler checking code, and make
+it report success if found.
+---
+ configure | 20 +++++++++++---------
+ 1 file changed, 11 insertions(+), 9 deletions(-)
+
+diff --git a/configure b/configure
+index 78535332..16a8f64f 100755
+--- a/configure
++++ b/configure
+@@ -647,15 +647,6 @@ if test ! -x "${CC}"; then
+ fi
+ assert "$CC" "not found"
+ 
+-printf "Finding suitable archiver........"
+-if test ! -x "${AR}"; then
+-      AR=`pathsearch "${AR:-ar}"`
+-      if test -z "$AR" -o ! -x "$AR"; then
+-              AR=`pathsearch "${AR:-ar}"`
+-      fi
+-fi
+-assert "$AR" "not found"
+-
+ cat << EOF > .1.c
+ #include <stdio.h>
+ int main(void) {
+@@ -736,6 +727,17 @@ else
+       assert "" "unknown compiler"
+ fi
+ 
++printf "Finding suitable archiver........"
++if test ! -x "${AR}"; then
++      AR=`pathsearch "${AR:-ar}"`
++      if test -z "$AR" -o ! -x "$AR"; then
++              AR=`pathsearch "${AR:-ar}"`
++      else
++              echo "success [$AR]"
++      fi
++fi
++assert "$AR" "not found"
++
+ printf "Detecting VMA bits..............."
+ VMA="unknown"
+ if test "$VMA_BITS" = "unknown"; then

diff --git 
a/dev-libs/concurrencykit/files/concurrencykit-0.7.0-glibc-2.30.patch 
b/dev-libs/concurrencykit/files/concurrencykit-0.7.0-glibc-2.30.patch
new file mode 100644
index 00000000000..77e63e3de7e
--- /dev/null
+++ b/dev-libs/concurrencykit/files/concurrencykit-0.7.0-glibc-2.30.patch
@@ -0,0 +1,54 @@
+From b520d58d00b7ed6c5cc9bc97c62f07e09f4f49ad Mon Sep 17 00:00:00 2001
+From: Samy Al Bahra <sba...@backtrace.io>
+Date: Tue, 29 Oct 2019 17:30:09 -0400
+Subject: [PATCH] regressions/common: rename gettid wrapper to common_gettid.
+
+glibc-2.30 added a wrapper to gettid (https://lwn.net/Articles/795127/).
+gettid will clash with the glibc-provided symbol. Remove the
+macro and instead move to a dedicated namespace.
+
+We go this route to avoid introducing unnecessary complexity to
+build.
+
+Fixes #147
+---
+ regressions/common.h | 8 +++-----
+ 1 file changed, 3 insertions(+), 5 deletions(-)
+
+diff --git a/regressions/common.h b/regressions/common.h
+index 6e53483d..9cdc690a 100644
+--- a/regressions/common.h
++++ b/regressions/common.h
+@@ -267,13 +267,11 @@ struct affinity {
+ #define AFFINITY_INITIALIZER {0, 0}
+ 
+ #ifdef __linux__
+-#ifndef gettid
+ static pid_t
+-gettid(void)
++common_gettid(void)
+ {
+       return syscall(__NR_gettid);
+ }
+-#endif /* gettid */
+ 
+ CK_CC_UNUSED static int
+ aff_iterate(struct affinity *acb)
+@@ -285,7 +283,7 @@ aff_iterate(struct affinity *acb)
+       CPU_ZERO(&s);
+       CPU_SET(c % CORES, &s);
+ 
+-      if (sched_setaffinity(gettid(), sizeof(s), &s) != 0)
++      if (sched_setaffinity(common_gettid(), sizeof(s), &s) != 0)
+               perror("WARNING: Could not affine thread");
+       
+         return 0;
+@@ -300,7 +298,7 @@ aff_iterate_core(struct affinity *acb, unsigned int *core)
+       CPU_ZERO(&s);
+       CPU_SET((*core) % CORES, &s);
+ 
+-      if (sched_setaffinity(gettid(), sizeof(s), &s) != 0)
++      if (sched_setaffinity(common_gettid(), sizeof(s), &s) != 0)
+               perror("WARNING: Could not affine thread");
+       
+         return 0;

diff --git a/dev-libs/concurrencykit/files/concurrencykit-0.7.0-gzip.patch 
b/dev-libs/concurrencykit/files/concurrencykit-0.7.0-gzip.patch
new file mode 100644
index 00000000000..62477f9acf6
--- /dev/null
+++ b/dev-libs/concurrencykit/files/concurrencykit-0.7.0-gzip.patch
@@ -0,0 +1,58 @@
+From cb63256ae2e5fde7a67d7740bb2f4a0eab538a2d Mon Sep 17 00:00:00 2001
+From: Samy Al Bahra <sba...@backtrace.io>
+Date: Thu, 9 Apr 2020 20:08:40 -0400
+Subject: [PATCH] build: allow GZIP to be set to empty string in configure.
+
+---
+ configure | 25 +++++++++++++++----------
+ 1 file changed, 15 insertions(+), 10 deletions(-)
+
+diff --git a/configure b/configure
+index 2cbdbef3..ed188f96 100755
+--- a/configure
++++ b/configure
+@@ -325,7 +325,7 @@ done
+ HEADERS=${HEADERS:-"${PREFIX}/include"}
+ LIBRARY=${LIBRARY:-"${PREFIX}/lib"}
+ MANDIR=${MANDIR:-"${PREFIX}/share/man"}
+-GZIP=${GZIP:-"gzip -c"}
++GZIP=${GZIP-"gzip -c"}
+ POINTER_PACK_ENABLE=${POINTER_PACK_ENABLE:-"CK_MD_POINTER_PACK_DISABLE"}
+ DISABLE_DOUBLE=${DISABLE_DOUBLE:-"CK_PR_ENABLE_DOUBLE"}
+ PPC32_LWSYNC_ENABLE=${PPC32_LWSYNC_ENABLE:-"CK_MD_PPC32_LWSYNC_DISABLE"}
+@@ -583,21 +583,26 @@ else
+       echo "success [$BUILD_DIR]"
+ fi
+ 
+-printf "Finding gzip tool................"
+-GZIP=`pathsearch "${GZIP:-gzip}"`
+-if test -z "$GZIP" -o ! -x "$GZIP"; then
++if test -n "$GZIP"; then
++      printf "Finding gzip tool................"
+       GZIP=`pathsearch "${GZIP:-gzip}"`
+-      GZIP="$GZIP"
++      if test -z "$GZIP" -o ! -x "$GZIP"; then
++              GZIP=`pathsearch "${GZIP:-gzip}"`
++              GZIP="$GZIP"
++      fi
++
++      if test -z "$GZIP"; then
++              echo "not found"
++      else
++              echo "success [$GZIP]"
++              GZIP="$GZIP -c"
++              GZIP_SUFFIX=".gz"
++      fi
+ fi
+ 
+ if test -z "$GZIP"; then
+-      echo "not found"
+       GZIP=cat
+       GZIP_SUFFIX=""
+-else
+-      echo "success [$GZIP]"
+-      GZIP="$GZIP -c"
+-      GZIP_SUFFIX=".gz"
+ fi
+ 
+ printf "Finding suitable compiler........"

diff --git 
a/dev-libs/concurrencykit/files/concurrencykit-0.7.0-static-libs.patch 
b/dev-libs/concurrencykit/files/concurrencykit-0.7.0-static-libs.patch
new file mode 100644
index 00000000000..3e1d080a5f4
--- /dev/null
+++ b/dev-libs/concurrencykit/files/concurrencykit-0.7.0-static-libs.patch
@@ -0,0 +1,75 @@
+diff --git a/configure b/configure
+index 7853533..4e1ee9d 100755
+--- a/configure
++++ b/configure
+@@ -119,6 +119,7 @@ generate()
+           -e "s#@GZIP_SUFFIX@#$GZIP_SUFFIX#g"                 \
+           -e "s#@POINTER_PACK_ENABLE@#$POINTER_PACK_ENABLE#g" \
+           -e "s#@DISABLE_DOUBLE@#$DISABLE_DOUBLE#g"           \
++          -e "s#@DISABLE_STATIC@#$DISABLE_STATIC#g"           \
+           -e "s#@SSE_DISABLE@#$SSE_DISABLE#g"                 \
+           -e "s#@PPC32_LWSYNC_ENABLE@#$PPC32_LWSYNC_ENABLE#g" \
+           -e "s#@RTM_ENABLE@#$RTM_ENABLE#g"                   \
+@@ -156,6 +157,7 @@ generate_stdout()
+       echo "    LDNAME_VERSION = $LDNAME_VERSION"
+       echo "      LDNAME_MAJOR = $LDNAME_MAJOR"
+       echo "           LDFLAGS = $LDFLAGS"
++      echo "        STATIC_LIB = $DISABLE_STATIC"
+       echo "              GZIP = $GZIP"
+       echo "             CORES = $CORES"
+       echo "      POINTER_PACK = $POINTER_PACK_ENABLE"
+@@ -205,6 +207,7 @@ for option; do
+               echo "  --platform=N             Force the platform type, 
instead of relying on autodetection"
+               echo "  --use-cc-builtins        Use the compiler atomic 
builtin functions, instead of the CK implementation"
+               echo "  --disable-double         Don't generate any of the 
functions using the \"double\" type"
++              echo "  --disable-static         Don't compile a static version 
of the ck lib"
+               echo
+               echo "The following options will affect specific 
platform-dependent generated code."
+               echo "  --disable-sse            Do not use any SSE 
instructions (x86)"
+@@ -293,6 +296,9 @@ for option; do
+       --disable-double)
+               DISABLE_DOUBLE="CK_PR_DISABLE_DOUBLE"
+               ;;
++      --disable-static)
++              DISABLE_STATIC=1
++              ;;
+       --platform=*)
+               PLATFORM=$value
+               ;;
+@@ -330,6 +336,7 @@ MANDIR=${MANDIR:-"${PREFIX}/share/man"}
+ GZIP=${GZIP-"gzip -c"}
+ POINTER_PACK_ENABLE=${POINTER_PACK_ENABLE:-"CK_MD_POINTER_PACK_DISABLE"}
+ DISABLE_DOUBLE=${DISABLE_DOUBLE:-"CK_PR_ENABLE_DOUBLE"}
++DISABLE_STATIC=${DISABLE_STATIC:-"0"}
+ PPC32_LWSYNC_ENABLE=${PPC32_LWSYNC_ENABLE:-"CK_MD_PPC32_LWSYNC_DISABLE"}
+ RTM_ENABLE=${RTM_ENABLE_SET:-"CK_MD_RTM_DISABLE"}
+ SSE_DISABLE=${SSE_DISABLE:-"CK_MD_SSE_ENABLE"}
+@@ -717,13 +724,24 @@ elif test "$COMPILER" = "gcc" || test "$COMPILER" = 
"clang" || test "$COMPILER"
+       if test "$WANT_PIC" = "yes"; then
+               LDFLAGS="$LDFLAGS -shared -fPIC"
+               CFLAGS="$CFLAGS -fPIC"
+-              ALL_LIBS="libck.so libck.a"
+-              INSTALL_LIBS="install-so install-lib"
++
++              if [ "$DISABLE_STATIC" -eq 1 ]; then
++                      ALL_LIBS="libck.so"
++                      INSTALL_LIBS="install-so"
++              else
++                      ALL_LIBS="libck.so libck.a"
++                      INSTALL_LIBS="install-so install-lib"
++              fi
+       else
+               LDFLAGS="$LDFLAGS -fno-PIC"
+               CFLAGS="$CFLAGS -fno-PIC"
+-              ALL_LIBS="libck.a"
+-              INSTALL_LIBS="install-lib"
++              if [ "$DISABLE_STATIC" -eq 1 ]; then
++                      echo "Error: You have choosen to disable PIC, yet you 
also disabled the static lib." 1>&2
++                      exit $EXIT_FAILURE
++              else
++                      ALL_LIBS="libck.a"
++                      INSTALL_LIBS="install-lib"
++              fi
+       fi
+ 
+       CFLAGS="-D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -std=gnu99 
-pedantic -Wall -W -Wundef -Wendif-labels -Wshadow -Wpointer-arith -Wcast-align 
-Wcast-qual -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes 
-Wnested-externs -Winline -Wdisabled-optimization -fstrict-aliasing -O2 -pipe 
-Wno-parentheses $CFLAGS"

Reply via email to