From ad4972fe57ab3fe65c1057609450c214d4f98154 Mon Sep 17 00:00:00 2001 From: Tupone Alfredo Date: Mon, 4 Sep 2017 12:09:57 +0200 Subject: dev-lang/gnat-gpl: Remove usage of PORTDIR. Fix bug #629764 Package-Manager: Portage-2.3.6, Repoman-2.3.1 --- .../gnat-gpl/files/awk/fixlafiles.awk-no_gcc_la | 334 +++++++++++++++++++++ dev-lang/gnat-gpl/files/c89 | 20 ++ dev-lang/gnat-gpl/files/c99 | 21 ++ dev-lang/gnat-gpl/files/fix_libtool_files.sh | 66 ++++ dev-lang/gnat-gpl/files/gcc-configure-LANG.patch | 64 ++++ .../gnat-gpl/files/gcc-configure-texinfo.patch | 16 + dev-lang/gnat-gpl/gnat-gpl-2016.ebuild | 2 +- dev-lang/gnat-gpl/gnat-gpl-2017.ebuild | 2 - 8 files changed, 522 insertions(+), 3 deletions(-) create mode 100644 dev-lang/gnat-gpl/files/awk/fixlafiles.awk-no_gcc_la create mode 100644 dev-lang/gnat-gpl/files/c89 create mode 100644 dev-lang/gnat-gpl/files/c99 create mode 100644 dev-lang/gnat-gpl/files/fix_libtool_files.sh create mode 100644 dev-lang/gnat-gpl/files/gcc-configure-LANG.patch create mode 100644 dev-lang/gnat-gpl/files/gcc-configure-texinfo.patch (limited to 'dev-lang/gnat-gpl') diff --git a/dev-lang/gnat-gpl/files/awk/fixlafiles.awk-no_gcc_la b/dev-lang/gnat-gpl/files/awk/fixlafiles.awk-no_gcc_la new file mode 100644 index 000000000000..066c8d21681f --- /dev/null +++ b/dev-lang/gnat-gpl/files/awk/fixlafiles.awk-no_gcc_la @@ -0,0 +1,334 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +# +# Helper functions +# +function printn(string) { + printf("%s", string) +} +function einfo(string) { + printf(" \033[32;01m*\033[0m %s\n", string) +} +function einfon(string) { + printf(" \033[32;01m*\033[0m %s", string) +} +function ewarn(string) { + printf(" \033[33;01m*\033[0m %s\n", string) +} +function ewarnn(string) { + printf(" \033[33;01m*\033[0m %s", string) +} +function eerror(string) { + printf(" \033[31;01m*\033[0m %s\n", string) +} + +# +# assert(condition, errmsg) +# assert that a condition is true. Otherwise exit. +# +function assert(condition, string) { + if (! condition) { + printf("%s:%d: assertion failed: %s\n", + FILENAME, FNR, string) > "/dev/stderr" + _assert_exit = 1 + exit 1 + } +} + +# +# system(command, return) +# wrapper that normalizes return codes ... +# +function dosystem(command, ret) { + ret = 0 + ret = system(command) + if (ret == 0) + return 1 + else + return 0 +} + +# +# parse_ld_conf(config_file) +# +function parse_ld_conf(conf, pipe, ldsoconf_data, CHILD, y) { + pipe = "cd /etc; cat " conf " | sort 2>/dev/null" + while(((pipe) | getline ldsoconf_data) > 0) { + if (ldsoconf_data ~ /^[[:space:]]*#/) + continue + if (ldsoconf_data == "") + continue + + # Handle the "include" keyword + if (ldsoconf_data ~ /^include /) { + sub(/^include /, "", ldsoconf_data) + parse_ld_conf(ldsoconf_data) + continue + } + + # Remove any trailing comments + sub(/#.*$/, "", ldsoconf_data) + # Remove any trailing spaces + sub(/[[:space:]]+$/, "", ldsoconf_data) + # Eat duplicate slashes + sub(/\/\//, "/", ldsoconf_data) + # Prune trailing / + sub(/\/$/, "", ldsoconf_data) + + # + # Drop the directory if its a child directory of + # one that was already added ... + # For example, if we have: + # /usr/lib /usr/libexec /usr/lib/mozilla /usr/lib/nss + # We really just want to save /usr/lib /usr/libexec + # + CHILD = 0 + for (y in DIRLIST) { + if (ldsoconf_data ~ "^" DIRLIST[y] "(/|$)") { + CHILD = 1 + break + } + } + if (CHILD) continue + + DIRLIST[++LIBCOUNT] = ldsoconf_data + } + close(pipe) +} + +BEGIN { + # + # Get our variables from environment + # + OLDVER = ENVIRON["OLDVER"] + OLDCHOST = ENVIRON["OLDCHOST"] + + if (OLDVER == "") { + eerror("Could not get OLDVER!"); + exit 1 + } + + # Setup some sane defaults + LIBCOUNT = 2 + HAVE_GCC34 = 0 + DIRLIST[1] = "/lib" + DIRLIST[2] = "/usr/lib" + + # + # Walk /etc/ld.so.conf to discover all our library paths + # + parse_ld_conf("/etc/ld.so.conf") + + # + # Get line from gcc's output containing CHOST + # + pipe = "gcc -print-file-name=libgcc.a 2>/dev/null" + if ((!((pipe) | getline TMP_CHOST)) || (TMP_CHOST == "")) { + close(pipe) + + # If we fail to get the CHOST, see if we can get the CHOST + # portage thinks we are using ... + pipe = "/usr/bin/portageq envvar 'CHOST'" + assert(((pipe) | getline CHOST), "(" pipe ") | getline CHOST") + } else { + # Check pre gcc-3.4.x versions + CHOST = gensub("^.+lib/gcc-lib/([^/]+)/[0-9]+.+$", "\\1", 1, TMP_CHOST) + + if (CHOST == TMP_CHOST || CHOST == "") { + # Check gcc-3.4.x or later + CHOST = gensub("^.+lib/gcc/([^/]+)/[0-9]+.+$", "\\1", 1, TMP_CHOST); + + if (CHOST == TMP_CHOST || CHOST == "") + CHOST = "" + else + HAVE_GCC34 = 1 + } + } + close(pipe) + + if (CHOST == "") { + eerror("Could not get gcc's CHOST!") + exit 1 + } + + if (OLDCHOST != "") + if (OLDCHOST == CHOST) + OLDCHOST = "" + + GCCLIBPREFIX_OLD = "/usr/lib/gcc-lib/" + GCCLIBPREFIX_NEW = "/usr/lib/gcc/" + + if (HAVE_GCC34) + GCCLIBPREFIX = GCCLIBPREFIX_NEW + else + GCCLIBPREFIX = GCCLIBPREFIX_OLD + + GCCLIB = GCCLIBPREFIX CHOST + + if (OLDCHOST != "") { + OLDGCCLIB1 = GCCLIBPREFIX_OLD OLDCHOST + OLDGCCLIB2 = GCCLIBPREFIX_NEW OLDCHOST + } + + # Get current gcc's version + pipe = "gcc -dumpversion" + assert(((pipe) | getline NEWVER), "(" pipe ") | getline NEWVER)") + close(pipe) + + if (NEWVER == "") { + eerror("Could not get gcc's version!") + exit 1 + } + + # Nothing to do ? + # NB: Do not check for (OLDVER == NEWVER) anymore, as we might need to + # replace libstdc++.la .... + if ((OLDVER == "") && (OLDCHOST == "")) + exit 0 + + # + # Ok, now let's scan for the .la files and actually fix them up + # + for (x = 1; x <= LIBCOUNT; x++) { + # Do nothing if the target dir is gcc's internal library path + if (DIRLIST[x] ~ GCCLIBPREFIX_OLD || + DIRLIST[x] ~ GCCLIBPREFIX_NEW) + continue + + einfo(" [" x "/" LIBCOUNT "] Scanning " DIRLIST[x] " ...") + + pipe = "find " DIRLIST[x] "/ -name '*.la' 2>/dev/null" + while (((pipe) | getline la_files) > 0) { + + # Do nothing if the .la file is located in gcc's internal lib path + if (la_files ~ GCCLIBPREFIX_OLD || + la_files ~ GCCLIBPREFIX_NEW) + continue + + CHANGED = 0 + CHOST_CHANGED = 0 + + # See if we need to fix the .la file + while ((getline la_data < (la_files)) > 0) { + if (OLDCHOST != "") { + if ((gsub(OLDGCCLIB1 "[/[:space:]]+", + GCCLIB, la_data) > 0) || + (gsub(OLDGCCLIB2 "[/[:space:]]+", + GCCLIB, la_data) > 0)) { + CHANGED = 1 + CHOST_CHANGED = 1 + } + } + if (OLDVER != NEWVER) { + if ((gsub(GCCLIBPREFIX_OLD CHOST "/" OLDVER "[/[:space:]]*", + GCCLIB "/" NEWVER, la_data) > 0) || + (gsub(GCCLIBPREFIX_NEW CHOST "/" OLDVER "[/[:space:]]*", + GCCLIB "/" NEWVER, la_data) > 0)) + CHANGED = 1 + } + # We now check if we have libstdc++.la, as we remove the + # libtool linker scripts for gcc ... + # We do this last, as we only match the new paths + if (gsub(GCCLIB "/" NEWVER "/libstdc\\+\\+\\.la", + "-lstdc++", la_data) > 0) + CHANGED = 1 + } + close(la_files) + + # Do the actual changes in a second loop, as we can then + # verify that CHOST_CHANGED among things is correct ... + if (CHANGED) { + ewarnn(" FIXING: " la_files " ...[") + + # Clear the temp file (removing rather than '>foo' is better + # out of a security point of view?) + dosystem("rm -f " la_files ".new") + + while ((getline la_data < (la_files)) > 0) { + if (OLDCHOST != "") { + tmpstr = gensub(OLDGCCLIB1 "([/[:space:]]+)", + GCCLIB "\\1", "g", la_data) + tmpstr = gensub(OLDGCCLIB2 "([/[:space:]]+)", + GCCLIB "\\1", "g", tmpstr) + + if (la_data != tmpstr) { + printn("c") + la_data = tmpstr + } + + if (CHOST_CHANGED > 0) { + # We try to be careful about CHOST changes outside + # the gcc library path (meaning we cannot match it + # via /GCCLIBPREFIX CHOST/) ... + + # Catch: + # + # dependency_libs=' -L/usr/CHOST/{bin,lib}' + # + gsub("-L/usr/" OLDCHOST "/", + "-L/usr/" CHOST "/", la_data) + # Catch: + # + # dependency_libs=' -L/usr/lib/gcc-lib/CHOST/VER/../../../../CHOST/lib' + # + la_data = gensub("(" GCCLIB "/[^[:space:]]+)/" OLDCHOST "/", + "\\1/" CHOST "/", "g", la_data) + } + } + + if (OLDVER != NEWVER) { + # Catch: + # + # dependency_libs=' -L/usr/lib/gcc/CHOST/VER' + # + tmpstr = gensub(GCCLIBPREFIX_OLD CHOST "/" OLDVER "([/[:space:]]+)", + GCCLIB "/" NEWVER "\\1", "g", la_data) + tmpstr = gensub(GCCLIBPREFIX_NEW CHOST "/" OLDVER "([/[:space:]]+)", + GCCLIB "/" NEWVER "\\1", "g", tmpstr) + + if (la_data != tmpstr) { + # Catch: + # + # dependency_libs=' -L/usr/lib/gcc-lib/../../CHOST/lib' + # + # in cases where we have gcc34 + tmpstr = gensub(GCCLIBPREFIX_OLD "(../../" CHOST "/lib)", + GCCLIBPREFIX "\\1", "g", tmpstr) + tmpstr = gensub(GCCLIBPREFIX_NEW "(../../" CHOST "/lib)", + GCCLIBPREFIX "\\1", "g", tmpstr) + printn("v") + la_data = tmpstr + } + } + + # We now check if we have libstdc++.la, as we remove the + # libtool linker scripts for gcc and any referencese in any + # libtool linker scripts. + # We do this last, as we only match the new paths + tmpstr = gensub(GCCLIB "/" NEWVER "/libstdc\\+\\+\\.la", + "-lstdc++", "g", la_data); + if (la_data != tmpstr) { + printn("l") + la_data = tmpstr + } + + print la_data >> (la_files ".new") + } + + if (CHANGED) + print "]" + + close(la_files) + close(la_files ".new") + + assert(dosystem("mv -f " la_files ".new " la_files), + "dosystem(\"mv -f " la_files ".new " la_files "\")") + } + } + + close(pipe) + } +} + +# vim:ts=4 diff --git a/dev-lang/gnat-gpl/files/c89 b/dev-lang/gnat-gpl/files/c89 new file mode 100644 index 000000000000..cee0325f50f1 --- /dev/null +++ b/dev-lang/gnat-gpl/files/c89 @@ -0,0 +1,20 @@ +#! /bin/sh + +# Call the appropriate C compiler with options to accept ANSI/ISO C +# The following options are the same (as of gcc-2.95): +# -ansi +# -std=c89 +# -std=iso9899:1990 + +for i; do + case "$i" in + -ansi|-std=c89|-std=iso9899:1990) + ;; + -std=*) + echo >&2 "`basename $0` called with non ANSI/ISO C90 option $i" + exit 1 + ;; + esac +done + +exec gcc -std=c89 -pedantic -U_FORTIFY_SOURCE "$@" diff --git a/dev-lang/gnat-gpl/files/c99 b/dev-lang/gnat-gpl/files/c99 new file mode 100644 index 000000000000..c9542095e385 --- /dev/null +++ b/dev-lang/gnat-gpl/files/c99 @@ -0,0 +1,21 @@ +#! /bin/sh + +# Call the appropriate C compiler with options to accept ANSI/ISO C +# The following options are the same (as of gcc-3.3): +# -std=c99 +# -std=c9x +# -std=iso9899:1999 +# -std=iso9899:199x + +for i; do + case "$i" in + -std=c9[9x]|-std=iso9899:199[9x]) + ;; + -ansi|-std=*) + echo >&2 "`basename $0` called with non ANSI/ISO C99 option $i" + exit 1 + ;; + esac +done + +exec gcc -std=c99 -pedantic -U_FORTIFY_SOURCE ${1+"$@"} diff --git a/dev-lang/gnat-gpl/files/fix_libtool_files.sh b/dev-lang/gnat-gpl/files/fix_libtool_files.sh new file mode 100644 index 000000000000..28f9beb36bac --- /dev/null +++ b/dev-lang/gnat-gpl/files/fix_libtool_files.sh @@ -0,0 +1,66 @@ +#!/bin/sh +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +usage() { +cat << "USAGE_END" +Usage: fix_libtool_files.sh [--oldarch ] + + Where is the version number of the + previous gcc version. For example, if you updated to + gcc-3.2.1, and you had gcc-3.2 installed, run: + + # fix_libtool_files.sh 3.2 + + If you updated to gcc-3.2.3, and the old CHOST was i586-pc-linux-gnu + but you now have CHOST as i686-pc-linux-gnu, run: + + # fix_libtool_files.sh 3.2 --oldarch i586-pc-linux-gnu + + Note that if only the CHOST and not the version changed, you can run + it with the current version and the '--oldarch ' arguments, + and it will do the expected: + + # fix_libtool_files.sh `gcc -dumpversion` --oldarch i586-pc-linux-gnu + +USAGE_END + exit 1 +} + +case $2 in +--oldarch) [ $# -ne 3 ] && usage ;; +*) [ $# -ne 1 ] && usage ;; +esac + +ARGV1=$1 +ARGV2=$2 +ARGV3=$3 + +. /etc/profile || exit 1 + +if [ ${EUID:-0} -ne 0 ] ; then + echo "${0##*/}: Must be root." + exit 1 +fi + +# make sure the files come out sane +umask 0022 + +OLDCHOST= +[ "${ARGV2}" = "--oldarch" ] && OLDCHOST=${ARGV3} + +AWKDIR="/usr/share/gcc-data" + +if [ ! -r "${AWKDIR}/fixlafiles.awk" ] ; then + echo "${0##*/}: ${AWKDIR}/fixlafiles.awk does not exist!" + exit 1 +fi + +OLDVER=${ARGV1} + +export OLDVER OLDCHOST + +echo "Scanning libtool files for hardcoded gcc library paths..." +exec gawk -f "${AWKDIR}/fixlafiles.awk" + +# vim:ts=4 diff --git a/dev-lang/gnat-gpl/files/gcc-configure-LANG.patch b/dev-lang/gnat-gpl/files/gcc-configure-LANG.patch new file mode 100644 index 000000000000..d1b1b0353662 --- /dev/null +++ b/dev-lang/gnat-gpl/files/gcc-configure-LANG.patch @@ -0,0 +1,64 @@ +The LANG vars aren't reset early enough so when sed tries to use [a-zA-Z] in +option parsing, it may break. + +http://bugs.gentoo.org/103483 + +--- configure ++++ configure +@@ -54,6 +54,19 @@ + infodir='${prefix}/info' + mandir='${prefix}/man' + ++# NLS nuisances. ++for as_var in \ ++ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ ++ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ ++ LC_TELEPHONE LC_TIME ++do ++ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then ++ eval $as_var=C; export $as_var ++ else ++ unset $as_var ++ fi ++done ++ + # Initialize some other variables. + subdirs= + MFLAGS= MAKEFLAGS= +@@ -452,16 +463,6 @@ + esac + done + +-# NLS nuisances. +-# Only set these to C if already set. These must not be set unconditionally +-# because not all systems understand e.g. LANG=C (notably SCO). +-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +-# Non-C LC_CTYPE values break the ctype check. +-if test "${LANG+set}" = set; then LANG=C; export LANG; fi +-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi +- + # confdefs.h avoids OS command line length limits that DEFS can exceed. + rm -rf conftest* confdefs.h + # AIX cpp loses on an empty file, so make sure it contains at least a newline. +@@ -1850,6 +1850,19 @@ + # Compiler output produced by configure, useful for debugging + # configure, is in ./config.log if it exists. + ++# NLS nuisances. ++for as_var in \ ++ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ ++ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ ++ LC_TELEPHONE LC_TIME ++do ++ if (set +x; test -z "`(eval \$as_var=C; export \$as_var) 2>&1`"); then ++ eval \$as_var=C; export \$as_var ++ else ++ unset \$as_var ++ fi ++done ++ + ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" + for ac_option + do diff --git a/dev-lang/gnat-gpl/files/gcc-configure-texinfo.patch b/dev-lang/gnat-gpl/files/gcc-configure-texinfo.patch new file mode 100644 index 000000000000..ddc098ddbd58 --- /dev/null +++ b/dev-lang/gnat-gpl/files/gcc-configure-texinfo.patch @@ -0,0 +1,16 @@ +Chances are quite good that the installed makeinfo is sufficient. +So ignore false positives where the makeinfo installed is so new +that it violates the cheesy version grep. + +http://bugs.gentoo.org/198182 + +--- configure ++++ configure +@@ -3573,6 +3573,6 @@ + : + else +- MAKEINFO="$MISSING makeinfo" ++ : + fi + ;; + diff --git a/dev-lang/gnat-gpl/gnat-gpl-2016.ebuild b/dev-lang/gnat-gpl/gnat-gpl-2016.ebuild index 8ad45cb76a14..28d09b073931 100644 --- a/dev-lang/gnat-gpl/gnat-gpl-2016.ebuild +++ b/dev-lang/gnat-gpl/gnat-gpl-2016.ebuild @@ -20,7 +20,7 @@ SSP_UCLIBC_STABLE="x86 amd64 mips ppc ppc64 arm" #end Hardened stuff TOOLCHAIN_GCC_PV=4.9.4 -GCC_FILESDIR=${PORTDIR}/sys-devel/gcc/files +#GCC_FILESDIR=${PORTDIR}/sys-devel/gcc/files inherit eutils toolchain-funcs toolchain diff --git a/dev-lang/gnat-gpl/gnat-gpl-2017.ebuild b/dev-lang/gnat-gpl/gnat-gpl-2017.ebuild index a050c6bba303..50234668a010 100644 --- a/dev-lang/gnat-gpl/gnat-gpl-2017.ebuild +++ b/dev-lang/gnat-gpl/gnat-gpl-2017.ebuild @@ -4,10 +4,8 @@ EAPI="5" PATCH_VER="1.0" -#UCLIBC_VER="1.0" TOOLCHAIN_GCC_PV=6.3.0 -GCC_FILESDIR=${PORTDIR}/sys-devel/gcc/files inherit eutils toolchain-funcs toolchain -- cgit v1.2.3-65-gdbad