logo

overlay

My (experimental) gentoo overlay
commit: 45f6bfa90af993c1c22ba901b1c4f694d14a8e84
parent: d705e88c5da77cc056813c41a1a43b0cd88bb06d
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Mon, 18 Nov 2019 07:23:13 +0100

sys-libs/db: Fix for lld and gold

Diffstat:

Asys-libs/db/Manifest1+
Asys-libs/db/db-5.3.28-r3.ebuild245+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asys-libs/db/files/db-4.2-listen-to-java-options.patch10++++++++++
Asys-libs/db/files/db-4.6-jni-check-prefix-first.patch30++++++++++++++++++++++++++++++
Asys-libs/db/files/db-4.8.24-java-manifest-location.patch12++++++++++++
Asys-libs/db/files/db-5.1.29-rename-atomic-compare-exchange.patch22++++++++++++++++++++++
Asys-libs/db/files/db-5.2.28-sqlite-configure-path.patch12++++++++++++
Asys-libs/db/files/db-6.0.20-test-link.patch38++++++++++++++++++++++++++++++++++++++
8 files changed, 370 insertions(+), 0 deletions(-)

diff --git a/sys-libs/db/Manifest b/sys-libs/db/Manifest @@ -0,0 +1 @@ +DIST db-5.3.28.tar.gz 35090431 BLAKE2B 5b77a4ec0945fa96ce6c2b452fb4b029295e037fa64d5ff8dcb3b5e01ee3501fd75d9a73b8f5fa54d8907717d93546fbb5348ee70119e877fa2f17d301ecf50d SHA512 e91bbe550fc147a8be7e69ade86fdb7066453814971b2b0223f7d17712bd029a8eff5b2b6b238042ff6ec1ffa6879d44cb95c5645a922fee305c26c3eeaee090 diff --git a/sys-libs/db/db-5.3.28-r3.ebuild b/sys-libs/db/db-5.3.28-r3.ebuild @@ -0,0 +1,245 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=5 +inherit eutils db flag-o-matic java-pkg-opt-2 autotools multilib multilib-minimal toolchain-funcs + +#Number of official patches +#PATCHNO=`echo ${PV}|sed -e "s,\(.*_p\)\([0-9]*\),\2,"` +PATCHNO=${PV/*.*.*_p} +if [[ ${PATCHNO} == "${PV}" ]] ; then + MY_PV=${PV} + MY_P=${P} + PATCHNO=0 +else + MY_PV=${PV/_p${PATCHNO}} + MY_P=${PN}-${MY_PV} +fi + +RESTRICT="!test? ( test )" + +S_BASE="${WORKDIR}/${MY_P}" +S="${S_BASE}/build_unix" +DESCRIPTION="Oracle Berkeley DB" +HOMEPAGE="http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/overview/index.html" +SRC_URI="http://download.oracle.com/berkeley-db/${MY_P}.tar.gz" +for (( i=1 ; i<=${PATCHNO} ; i++ )) ; do + export SRC_URI="${SRC_URI} http://www.oracle.com/technology/products/berkeley-db/db/update/${MY_PV}/patch.${MY_PV}.${i}" +done + +LICENSE="Sleepycat" +SLOT="5.3" +KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~m68k ppc ppc64 ~riscv ~s390 ~sh sparc x86" +IUSE="doc java cxx tcl test" + +REQUIRED_USE="test? ( tcl )" + +# the entire testsuite needs the TCL functionality +DEPEND="tcl? ( >=dev-lang/tcl-8.5.15-r1:0=[${MULTILIB_USEDEP}] ) + test? ( >=dev-lang/tcl-8.5.15-r1:0=[${MULTILIB_USEDEP}] ) + java? ( >=virtual/jdk-1.5 )" +RDEPEND="tcl? ( >=dev-lang/tcl-8.5.15-r1:0=[${MULTILIB_USEDEP}] ) + java? ( >=virtual/jre-1.5 )" + +MULTILIB_WRAPPED_HEADERS=( + /usr/include/db5.3/db.h +) + +src_prepare() { + cd "${WORKDIR}"/"${MY_P}" + for (( i=1 ; i<=${PATCHNO} ; i++ )) + do + epatch "${DISTDIR}"/patch."${MY_PV}"."${i}" + done + + # bug #510506 + epatch "${FILESDIR}"/${PN}-4.8.24-java-manifest-location.patch + + # use the includes from the prefix + epatch "${FILESDIR}"/${PN}-4.6-jni-check-prefix-first.patch + epatch "${FILESDIR}"/${PN}-4.2-listen-to-java-options.patch + + # sqlite configure call has an extra leading .. + # upstreamed:5.2.36, missing in 5.3.x + epatch "${FILESDIR}"/${PN}-5.2.28-sqlite-configure-path.patch + + # The upstream testsuite copies .lib and the binaries for each parallel test + # core, ~300MB each. This patch uses links instead, saves a lot of space. + epatch "${FILESDIR}"/${PN}-6.0.20-test-link.patch + + # Needed when compiling with clang + epatch "${FILESDIR}"/${PN}-5.1.29-rename-atomic-compare-exchange.patch + + # Upstream release script grabs the dates when the script was run, so lets + # end-run them to keep the date the same. + export REAL_DB_RELEASE_DATE="$(awk \ + '/^DB_VERSION_STRING=/{ gsub(".*\\(|\\).*","",$0); print $0; }' \ + "${S_BASE}"/dist/configure)" + sed -r -i \ + -e "/^DB_RELEASE_DATE=/s~=.*~='${REAL_DB_RELEASE_DATE}'~g" \ + "${S_BASE}"/dist/RELEASE || die + + # Include the SLOT for Java JAR files + # This supersedes the unused jarlocation patches. + sed -r -i \ + -e '/jarfile=.*\.jar$/s,(.jar$),-$(LIBVERSION)\1,g' \ + "${S_BASE}"/dist/Makefile.in || die + + cd "${S_BASE}"/dist || die + rm -f aclocal/libtool.m4 + sed -i \ + -e '/AC_PROG_LIBTOOL$/aLT_OUTPUT' \ + configure.ac || die + sed -i \ + -e '/^AC_PATH_TOOL/s/ sh, none/ bash, none/' \ + aclocal/programs.m4 || die + AT_M4DIR="aclocal aclocal_java" eautoreconf + # Upstream sucks - they do autoconf and THEN replace the version variables. + . ./RELEASE + for v in \ + DB_VERSION_{FAMILY,LETTER,RELEASE,MAJOR,MINOR} \ + DB_VERSION_{PATCH,FULL,UNIQUE_NAME,STRING,FULL_STRING} \ + DB_VERSION \ + DB_RELEASE_DATE ; do + local ev="__EDIT_${v}__" + sed -i -e "s/${ev}/${!v}/g" configure || die + done + + # This is a false positive skip in the tests as the test-reviewer code + # looks for 'Skipping\s' + sed -i \ + -e '/db_repsite/s,Skipping:,Skipping,g' \ + "${S_BASE}"/test/tcl/reputils.tcl || die +} + +multilib_src_configure() { + local myconf=() + + # compilation with -O0 fails on amd64, see bug #171231 + if [[ ${ABI} == amd64 ]]; then + local CFLAGS=${CFLAGS} CXXFLAGS=${CXXFLAGS} + replace-flags -O0 -O2 + is-flagq -O[s123] || append-flags -O2 + fi + + # Add linker versions to the symbols. Easier to do, and safer than header file + # mumbo jumbo. + # Does not include LLVM LLD as it doesn't have support for the option + # https://bugs.llvm.org/show_bug.cgi?id=43452 + if grep 'GNU ld' "$(${LD:-ld} --version)"; then + append-ldflags -Wl,--default-symver + fi + + # use `set` here since the java opts will contain whitespace + if multilib_is_native_abi && use java ; then + myconf+=( + --with-java-prefix="${JAVA_HOME}" + --with-javac-flags="$(java-pkg_javac-args)" + ) + fi + + # Bug #270851: test needs TCL support + if use tcl || use test ; then + myconf+=( + --enable-tcl + --with-tcl="${EPREFIX}/usr/$(get_libdir)" + ) + else + myconf+=(--disable-tcl ) + fi + + # sql_compat will cause a collision with sqlite3 + # --enable-sql_compat + ECONF_SOURCE="${S_BASE}"/dist \ + STRIP="true" \ + econf \ + --enable-compat185 \ + --enable-dbm \ + --enable-o_direct \ + --without-uniquename \ + --enable-sql \ + --enable-sql_codegen \ + --disable-sql_compat \ + $([[ ${ABI} == amd64 ]] && echo --with-mutex=x86/gcc-assembly) \ + $(use_enable cxx) \ + $(use_enable cxx stl) \ + $(multilib_native_use_enable java) \ + "${myconf[@]}" \ + $(use_enable test) + # The embedded assembly on ARM does not work on newer hardware + # so you CANNOT use --with-mutex=ARM/gcc-assembly anymore. + # Specifically, it uses the SWPB op, which was deprecated: + # http://www.keil.com/support/man/docs/armasm/armasm_dom1361289909499.htm + # The op ALSO cannot be used in ARM-Thumb mode. + # Trust the compiler instead. + # >=db-6.1 uses LDREX instead. +} + +multilib_src_install() { + emake install DESTDIR="${D}" + + db_src_install_headerslot + + db_src_install_usrlibcleanup + + if multilib_is_native_abi && use java; then + java-pkg_regso "${ED}"/usr/"$(get_libdir)"/libdb_java*.so + java-pkg_dojar "${ED}"/usr/"$(get_libdir)"/*.jar + rm -f "${ED}"/usr/"$(get_libdir)"/*.jar + fi +} + +multilib_src_install_all() { + db_src_install_usrbinslot + + db_src_install_doc + + dodir /usr/sbin + # This file is not always built, and no longer exists as of db-4.8 + if [[ -f "${ED}"/usr/bin/berkeley_db_svc ]] ; then + mv "${ED}"/usr/bin/berkeley_db_svc \ + "${ED}"/usr/sbin/berkeley_db"${SLOT/./}"_svc || die + fi +} + +pkg_postinst() { + multilib_foreach_abi db_fix_so +} + +pkg_postrm() { + multilib_foreach_abi db_fix_so +} + +src_test() { + # db_repsite is impossible to build, as upstream strips those sources. + # db_repsite is used directly in the setup_site_prog, + # setup_site_prog is called from open_site_prog + # which is called only from tests in the multi_repmgr group. + #sed -ri \ + # -e '/set subs/s,multi_repmgr,,g' \ + # "${S_BASE}/test/testparams.tcl" + sed -ri \ + -e '/multi_repmgr/d' \ + "${S_BASE}/test/tcl/test.tcl" || die + + # This is the only failure in 5.2.28 so far, and looks like a false positive. + # Repmgr018 (btree): Test of repmgr stats. + # Repmgr018.a: Start a master. + # Repmgr018.b: Start a client. + # Repmgr018.c: Run some transactions at master. + # Rep_test: btree 20 key/data pairs starting at 0 + # Rep_test.a: put/get loop + # FAIL:07:05:59 (00:00:00) perm_no_failed_stat: expected 0, got 1 + sed -ri \ + -e '/set parms.*repmgr018/d' \ + -e 's/repmgr018//g' \ + "${S_BASE}/test/tcl/test.tcl" || die + + multilib-minimal_src_test +} + +multilib_src_test() { + multilib_is_native_abi || return + + S=${BUILD_DIR} db_src_test +} diff --git a/sys-libs/db/files/db-4.2-listen-to-java-options.patch b/sys-libs/db/files/db-4.2-listen-to-java-options.patch @@ -0,0 +1,10 @@ +--- a/dist/configure.ac ++++ b/dist/configure.ac +@@ -385,6 +385,7 @@ + # A classpath that includes . is needed to check for Java + CLASSPATH=".:$CLASSPATH" + export CLASSPATH ++ AC_JAVA_OPTIONS + AC_PROG_JAVAC + AC_PROG_JAR + AC_PROG_JAVA diff --git a/sys-libs/db/files/db-4.6-jni-check-prefix-first.patch b/sys-libs/db/files/db-4.6-jni-check-prefix-first.patch @@ -0,0 +1,30 @@ +--- a/dist/aclocal_java/ac_jni_include_dirs.m4 ++++ b/dist/aclocal_java/ac_jni_include_dirs.m4 +@@ -43,14 +43,19 @@ + *) AC_MSG_ERROR([$_ACJNI_JAVAC is not an absolute path name]);; + esac + +-_ACJNI_FOLLOW_SYMLINKS("$_ACJNI_JAVAC") +-_JTOPDIR=`echo "$_ACJNI_FOLLOWED" | sed -e 's://*:/:g' -e 's:/[[^/]]*$::'` +-case "$host_os" in +- darwin*) _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'` +- _JINC="$_JTOPDIR/Headers";; +- *) _JINC="$_JTOPDIR/include";; +-esac +- ++# If JAVAPREFIX is defined, look there first ++if test -r "$JAVAPREFIX/include/jni.h"; then ++ _JTOPDIR="$JAVAPREFIX" ++ _JINC="$JAVAPREFIX/include" ++else ++ _ACJNI_FOLLOW_SYMLINKS("$_ACJNI_JAVAC") ++ _JTOPDIR=`echo "$_ACJNI_FOLLOWED" | sed -e 's://*:/:g' -e 's:/[[^/]]*$::'` ++ case "$host_os" in ++ darwin*) _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'` ++ _JINC="$_JTOPDIR/Headers";; ++ *) _JINC="$_JTOPDIR/include";; ++ esac ++fi + # If we find jni.h in /usr/include, then it's not a java-only tree, so + # don't add /usr/include or subdirectories to the list of includes. + # An extra -I/usr/include can foul things up with newer gcc's. diff --git a/sys-libs/db/files/db-4.8.24-java-manifest-location.patch b/sys-libs/db/files/db-4.8.24-java-manifest-location.patch @@ -0,0 +1,12 @@ +diff -Nuar db-4.8.24.orig/dist/Makefile.in db-4.8.24/dist/Makefile.in +--- db-4.8.24.orig/dist/Makefile.in 2009-09-19 23:39:45.286001896 +0000 ++++ db-4.8.24/dist/Makefile.in 2009-09-19 23:41:13.079326882 +0000 +@@ -830,7 +830,7 @@ + $(JAVA) -classpath $(JAVA_CLASSTOP) \ + com.sleepycat.persist.model.ClassEnhancer $(JAVA_CLASSTOP) + cd $(JAVA_CLASSTOP) && \ +- $(JAR) cfm ../$(libj_jarfile) ../$(JAVA_MANIFEST) ./com/sleepycat ++ $(JAR) cfm ../$(libj_jarfile) $(JAVA_MANIFEST) ./com/sleepycat + + $(libj_exjarfile): $(libj_jarfile) $(JAVA_EXSRCS) + @test -d $(JAVA_EXCLASSTOP) || \ diff --git a/sys-libs/db/files/db-5.1.29-rename-atomic-compare-exchange.patch b/sys-libs/db/files/db-5.1.29-rename-atomic-compare-exchange.patch @@ -0,0 +1,22 @@ +diff --git a/src/dbinc/atomic.h b/src/dbinc/atomic.h +index 0034dcc..fa7ba93 100644 +--- a/src/dbinc/atomic.h ++++ b/src/dbinc/atomic.h +@@ -144,7 +144,7 @@ typedef LONG volatile *interlocked_val; + #define atomic_inc(env, p) __atomic_inc(p) + #define atomic_dec(env, p) __atomic_dec(p) + #define atomic_compare_exchange(env, p, o, n) \ +- __atomic_compare_exchange((p), (o), (n)) ++ __db_atomic_compare_exchange((p), (o), (n)) + static inline int __atomic_inc(db_atomic_t *p) + { + int temp; +@@ -176,7 +176,7 @@ static inline int __atomic_dec(db_atomic_t *p) + * http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Atomic-Builtins.html + * which configure could be changed to use. + */ +-static inline int __atomic_compare_exchange( ++static inline int __db_atomic_compare_exchange( + db_atomic_t *p, atomic_value_t oldval, atomic_value_t newval) + { + atomic_value_t was; diff --git a/sys-libs/db/files/db-5.2.28-sqlite-configure-path.patch b/sys-libs/db/files/db-5.2.28-sqlite-configure-path.patch @@ -0,0 +1,12 @@ +diff -Nuar db-5.2.28.orig//dist/aclocal/sql.m4 db-5.2.28//dist/aclocal/sql.m4 +--- db-5.2.28.orig//dist/aclocal/sql.m4 2011-06-10 09:50:45.000000000 -0700 ++++ db-5.2.28//dist/aclocal/sql.m4 2011-07-15 17:02:54.646521189 -0700 +@@ -91,7 +91,7 @@ + # !!! END COPIED from autoconf distribution + + sqlite_dir=$srcdir/../lang/sql/sqlite +-(cd sql && eval "\$SHELL ../$sqlite_dir/configure --disable-option-checking $ac_sub_configure_args CPPFLAGS=\"-I.. $CPPFLAGS\" --enable-amalgamation=$db_cv_sql_amalgamation --enable-readline=$with_readline" && cat build_config.h >> config.h) || exit 1 ++(cd sql && eval "\$SHELL $sqlite_dir/configure --disable-option-checking $ac_sub_configure_args CPPFLAGS=\"-I.. $CPPFLAGS\" --enable-amalgamation=$db_cv_sql_amalgamation --enable-readline=$with_readline" && cat build_config.h >> config.h) || exit 1 + + # Configure JDBC if --enable-jdbc + if test "$db_cv_jdbc" != "no"; then diff --git a/sys-libs/db/files/db-6.0.20-test-link.patch b/sys-libs/db/files/db-6.0.20-test-link.patch @@ -0,0 +1,38 @@ +diff -Nuar db-6.0.20.orig/test/tcl/parallel.tcl db-6.0.20/test/tcl/parallel.tcl +--- db-6.0.20.orig/test/tcl/parallel.tcl 2013-07-04 15:49:43.408348040 +0000 ++++ db-6.0.20/test/tcl/parallel.tcl 2013-07-04 17:40:07.147943377 +0000 +@@ -289,16 +289,26 @@ + [eval glob -nocomplain {$dir/$buildpath/db_{reptest,repsite,replicate}$EXE}] \ + $destdir/$buildpath} + } ++ catch { ++ set l [eval glob {$dir/.libs} {$dir/db_{checkpoint,deadlock}$EXE} \ ++ {$dir/db_{dump,load,printlog,recover,stat,upgrade}$EXE} \ ++ {$dir/db_{archive,verify,hotbackup,log_verify}$EXE}] ++ foreach fn $l { ++ set fbasename [file tail $fn] ++ eval file link {$destdir/$fbasename} $fn ++ } ++ } ++ # we will be modifying this file, so we must copy, not link + catch {eval file copy \ +- [eval glob {$dir/{.libs,include.tcl}}] $destdir} ++ [eval glob {$dir/include.tcl}] $destdir} + # catch {eval file copy $dir/$queuedir $destdir} +- catch {eval file copy \ +- [eval glob {$dir/db_{checkpoint,deadlock}$EXE} \ +- {$dir/db_{dump,load,printlog,recover,stat,upgrade}$EXE} \ +- {$dir/db_{archive,verify,hotbackup,log_verify}$EXE}] \ +- $destdir} +- catch {eval file copy \ +- [eval glob -nocomplain {$dir/db_{reptest,repsite,replicate}$EXE}] $destdir} ++ catch { ++ set l [eval glob -nocomplain {$dir/db_{reptest,repsite,replicate}$EXE}] ++ foreach fn $l { ++ set fbasename [file tail $fn] ++ eval file link {$destdir/$fbasename} $fn ++ } ++ } + + # Create modified copies of include.tcl in parallel + # directories so paths still work.