[gentoo-commits] proj/hardened-dev:master commit in: sys-devel/gcc/files/, sys-devel/gcc/, eclass/, sys-devel/gcc/files/awk/

2016-09-12 Thread Magnus Granberg
commit: a02be4430b768a2c0b0b6f6676e44433c93332b2
Author: Magnus Granberg  gentoo  org>
AuthorDate: Mon Sep 12 23:06:43 2016 +
Commit: Magnus Granberg  gentoo  org>
CommitDate: Mon Sep 12 23:06:43 2016 +
URL:https://gitweb.gentoo.org/proj/hardened-dev.git/commit/?id=a02be443

Gcc 6.2.0 in tree

 eclass/toolchain.eclass  | 2356 --
 sys-devel/gcc/files/awk/fixlafiles.awk   |  314 ---
 sys-devel/gcc/files/awk/fixlafiles.awk-no_gcc_la |  335 ---
 sys-devel/gcc/files/c89  |   20 -
 sys-devel/gcc/files/c99  |   21 -
 sys-devel/gcc/files/fix_libtool_files.sh |   67 -
 sys-devel/gcc/files/gcc-configure-LANG.patch |   64 -
 sys-devel/gcc/files/gcc-configure-texinfo.patch  |   16 -
 sys-devel/gcc/gcc-6.2.0.ebuild   |   26 -
 sys-devel/gcc/metadata.xml   |   35 -
 10 files changed, 3254 deletions(-)

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
deleted file mode 100644
index 130e952..000
--- a/eclass/toolchain.eclass
+++ /dev/null
@@ -1,2356 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-# Maintainer: Toolchain Ninjas 
-
-DESCRIPTION="The GNU Compiler Collection"
-HOMEPAGE="https://gcc.gnu.org/;
-RESTRICT="strip" # cross-compilers need controlled stripping
-
-inherit eutils fixheadtails flag-o-matic gnuconfig libtool multilib pax-utils 
toolchain-funcs versionator
-
-if [[ ${PV} == *_pre* ]] ; then
-   EGIT_REPO_URI="git://gcc.gnu.org/git/gcc.git"
-   # naming style:
-   # gcc-4.7.1_pre -> gcc-4_7-branch
-   #  Note that the micro version is required or lots of stuff will break.
-   #  To checkout master set gcc_LIVE_BRANCH="master" in the ebuild before
-   #  inheriting this eclass.
-   EGIT_BRANCH="${PN}-${PV%.?_pre}-branch"
-   EGIT_BRANCH=${EGIT_BRANCH//./_}
-   inherit git-2
-fi
-
-FEATURES=${FEATURES/multilib-strict/}
-
-EXPORTED_FUNCTIONS="pkg_setup src_unpack src_compile src_test src_install 
pkg_postinst pkg_postrm"
-case ${EAPI:-0} in
-   0|1)die "Need to upgrade to at least EAPI=2";;
-   2|3)EXPORTED_FUNCTIONS+=" src_prepare src_configure" ;;
-   4*|5*)  EXPORTED_FUNCTIONS+=" pkg_pretend src_prepare src_configure" ;;
-   *)  die "I don't speak EAPI ${EAPI}."
-esac
-EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS}
-
-#>> globals <<
-
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} = ${CHOST} ]] ; then
-   if [[ ${CATEGORY} == cross-* ]] ; then
-   export CTARGET=${CATEGORY#cross-}
-   fi
-fi
-: ${TARGET_ABI:=${ABI}}
-: ${TARGET_MULTILIB_ABIS:=${MULTILIB_ABIS}}
-: ${TARGET_DEFAULT_ABI:=${DEFAULT_ABI}}
-
-is_crosscompile() {
-   [[ ${CHOST} != ${CTARGET} ]]
-}
-
-# General purpose version check.  Without a second arg matches up to minor 
version (x.x.x)
-tc_version_is_at_least() {
-   version_is_at_least "$1" "${2:-${GCC_RELEASE_VER}}"
-}
-
-# General purpose version range check
-# Note that it matches up to but NOT including the second version
-tc_version_is_between() {
-   tc_version_is_at_least "${1}" && ! tc_version_is_at_least "${2}"
-}
-
-GCC_PV=${TOOLCHAIN_GCC_PV:-${PV}}
-GCC_PVR=${GCC_PV}
-[[ ${PR} != "r0" ]] && GCC_PVR=${GCC_PVR}-${PR}
-GCC_RELEASE_VER=$(get_version_component_range 1-3 ${GCC_PV})
-GCC_BRANCH_VER=$(get_version_component_range 1-2 ${GCC_PV})
-GCCMAJOR=$(get_version_component_range 1 ${GCC_PV})
-GCCMINOR=$(get_version_component_range 2 ${GCC_PV})
-GCCMICRO=$(get_version_component_range 3 ${GCC_PV})
-[[ ${BRANCH_UPDATE-notset} == "notset" ]] && \
-   BRANCH_UPDATE=$(get_version_component_range 4 ${GCC_PV})
-
-# According to gcc/c-cppbuiltin.c, GCC_CONFIG_VER MUST match this regex.
-# ([^0-9]*-)?[0-9]+[.][0-9]+([.][0-9]+)?([- ].*)?
-GCC_CONFIG_VER=${GCC_CONFIG_VER:-$(replace_version_separator 3 '-' ${GCC_PV})}
-
-# Pre-release support
-if [[ ${GCC_PV} == *_pre* ]] ; then
-   PRERELEASE=${GCC_PV/_pre/-}
-elif [[ ${GCC_PV} == *_alpha* ]] ; then
-   SNAPSHOT=${GCC_BRANCH_VER}-${GCC_PV##*_alpha}
-elif [[ ${GCC_PV} == *_beta* ]] ; then
-   SNAPSHOT=${GCC_BRANCH_VER}-${GCC_PV##*_beta}
-elif [[ ${GCC_PV} == *_rc* ]] ; then
-   SNAPSHOT=${GCC_PV%_rc*}-RC-${GCC_PV##*_rc}
-fi
-
-if [[ ${SNAPSHOT} == [56789].0-* ]] ; then
-   # The gcc-5+ releases have dropped the .0 for some reason.
-   SNAPSHOT=${SNAPSHOT/.0}
-fi
-
-export GCC_FILESDIR=${GCC_FILESDIR:-${FILESDIR}}
-
-PREFIX=${TOOLCHAIN_PREFIX:-/usr}
-
-if tc_version_is_at_least 3.4.0 ; then
-   
LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/lib/gcc/${CTARGET}/${GCC_CONFIG_VER}}
-else
-   
LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/lib/gcc-lib/${CTARGET}/${GCC_CONFIG_VER}}
-fi
-INCLUDEPATH=${TOOLCHAIN_INCLUDEPATH:-${LIBPATH}/include}
-
-if is_crosscompile ; then
-   

[gentoo-commits] proj/hardened-dev:master commit in: sys-devel/gcc/

2016-08-24 Thread Magnus Granberg
commit: 7f1d2114e0baf903ee7ad9810ebe3c41ca442246
Author: Magnus Granberg  gentoo  org>
AuthorDate: Wed Aug 24 14:32:22 2016 +
Commit: Magnus Granberg  gentoo  org>
CommitDate: Wed Aug 24 14:32:22 2016 +
URL:https://gitweb.gentoo.org/proj/hardened-dev.git/commit/?id=7f1d2114

Fix Manifest for gcc 6.2.0

 sys-devel/gcc/gcc-6.1.0.ebuild | 39 ---
 sys-devel/gcc/gcc-6.2.0.ebuild | 13 -
 2 files changed, 52 deletions(-)

diff --git a/sys-devel/gcc/gcc-6.1.0.ebuild b/sys-devel/gcc/gcc-6.1.0.ebuild
deleted file mode 100644
index 062641d..000
--- a/sys-devel/gcc/gcc-6.1.0.ebuild
+++ /dev/null
@@ -1,39 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI="4"
-
-PATCH_VER="1.1"
-#UCLIBC_VER="1.0"
-
-# Hardened gcc 4 stuff
-#PIE_VER="0.6.5"
-#SPECS_VER="0.2.0"
-#SPECS_GCC_VER="4.4.3"
-# arch/libc configurations known to be stable with {PIE,SSP}-by-default
-#PIE_GLIBC_STABLE="x86 amd64 mips ppc ppc64 arm ia64"
-#PIE_UCLIBC_STABLE="x86 arm amd64 mips ppc ppc64"
-#SSP_STABLE="amd64 x86 mips ppc ppc64 arm"
-# uclibc need tls and nptl support for SSP support
-# uclibc need to be >= 0.9.33
-#SSP_UCLIBC_STABLE="x86 amd64 mips ppc ppc64 arm"
-#end Hardened stuff
-
-inherit toolchain
-
-KEYWORDS=""
-
-RDEPEND=""
-DEPEND="${RDEPEND}
-   elibc_glibc? ( >=sys-libs/glibc-2.8 )
-   >=${CATEGORY}/binutils-2.20"
-
-if [[ ${CATEGORY} != cross-* ]] ; then
-   PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
-fi
-
-src_prepare() {
-
-   toolchain_src_prepare
-}

diff --git a/sys-devel/gcc/gcc-6.2.0.ebuild b/sys-devel/gcc/gcc-6.2.0.ebuild
index b425590..67cbb30 100644
--- a/sys-devel/gcc/gcc-6.2.0.ebuild
+++ b/sys-devel/gcc/gcc-6.2.0.ebuild
@@ -7,19 +7,6 @@ EAPI="4"
 PATCH_VER="1.0"
 #UCLIBC_VER="1.0"
 
-# Hardened gcc 4 stuff
-#PIE_VER="0.6.5"
-#SPECS_VER="0.2.0"
-#SPECS_GCC_VER="4.4.3"
-# arch/libc configurations known to be stable with {PIE,SSP}-by-default
-#PIE_GLIBC_STABLE="x86 amd64 mips ppc ppc64 arm ia64"
-#PIE_UCLIBC_STABLE="x86 arm amd64 mips ppc ppc64"
-#SSP_STABLE="amd64 x86 mips ppc ppc64 arm"
-# uclibc need tls and nptl support for SSP support
-# uclibc need to be >= 0.9.33
-#SSP_UCLIBC_STABLE="x86 amd64 mips ppc ppc64 arm"
-#end Hardened stuff
-
 inherit toolchain
 
 KEYWORDS=""



[gentoo-commits] proj/hardened-dev:master commit in: sys-devel/gcc/, eclass/

2016-08-23 Thread Magnus Granberg
commit: d30a8e0729b55b469d1f63ee074655cf21ae84c1
Author: Magnus Granberg  gentoo  org>
AuthorDate: Tue Aug 23 20:24:01 2016 +
Commit: Magnus Granberg  gentoo  org>
CommitDate: Tue Aug 23 20:24:01 2016 +
URL:https://gitweb.gentoo.org/proj/hardened-dev.git/commit/?id=d30a8e07

Bump gcc 6 to 6.2

 eclass/toolchain.eclass| 116 -
 sys-devel/gcc/gcc-6.2.0.ebuild |  39 ++
 2 files changed, 108 insertions(+), 47 deletions(-)

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 247dcee..130e952 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -131,7 +131,7 @@ else
LICENSE="GPL-2+ LGPL-2.1+ FDL-1.1+"
 fi
 
-IUSE="multislot regression-test vanilla"
+IUSE="regression-test vanilla"
 IUSE_DEF=( nls nptl )
 
 if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
@@ -152,9 +152,9 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
# versions which we dropped.  Since graphite was also experimental in
# the older versions, we don't want to bother supporting it.  #448024
tc_version_is_at_least 4.8 && IUSE+=" graphite" IUSE_DEF+=( sanitize )
-   tc_version_is_at_least 4.9 && IUSE+=" cilk"
-   tc_version_is_at_least 5.0 && IUSE+=" jit pch"
-   tc_version_is_at_least 6.0 && IUSE+=" pie +ssp"
+   tc_version_is_at_least 4.9 && IUSE+=" cilk +vtv"
+   tc_version_is_at_least 5.0 && IUSE+=" jit mpx"
+   tc_version_is_at_least 6.0 && IUSE+=" pie +ssp +pch"
 fi
 
 IUSE+=" ${IUSE_DEF[*]/#/+}"
@@ -627,20 +627,47 @@ do_gcc_PIE_patches() {
 # configure to build with the hardened GCC specs as the default
 make_gcc_hard() {
 
-   # Gcc >= 6.X we don't need to sed in Makefile
-   # It have configurations options to turn pie/ssp on as default
+   local gcc_hard_flags=""
+   # Gcc >= 6.X we can use configurations options to turn pie/ssp on as 
default
if tc_version_is_at_least 6.0 ; then
-   if use hardened ; then
-   # rebrand to make bug reports easier
-   
BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
-   fi
if use pie ; then
einfo "Updating gcc to use automatic PIE building ..."
fi
if use ssp ; then
einfo "Updating gcc to use automatic SSP building ..."
fi
-   return 1
+   if use hardened ; then
+   # Will add some optimatizion as default.
+   gcc_hard_flags+=" -DHARDENED_OPTIMATIZON"
+   # rebrand to make bug reports easier
+   
BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
+   fi
+   else
+   if use hardened ; then
+   # rebrand to make bug reports easier
+   
BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
+   if hardened_gcc_works ; then
+   einfo "Updating gcc to use automatic PIE + SSP 
building ..."
+   gcc_hard_flags+=" -DEFAULT_PIE_SSP"
+   elif hardened_gcc_works pie ; then
+   einfo "Updating gcc to use automatic PIE 
building ..."
+   ewarn "SSP has not been enabled by default"
+   gcc_hard_flags+=" -DEFAULT_PIE"
+   elif hardened_gcc_works ssp ; then
+   einfo "Updating gcc to use automatic SSP 
building ..."
+   ewarn "PIE has not been enabled by default"
+   gcc_hard_flags+=" -DEFAULT_SSP"
+   else
+   # do nothing if hardened isn't supported, but 
don't die either
+   ewarn "hardened is not supported for this arch 
in this gcc version"
+   return 0
+   fi
+   else
+   if hardened_gcc_works ssp ; then
+   einfo "Updating gcc to use automatic SSP 
building ..."
+   gcc_hard_flags+=" -DEFAULT_SSP"
+   fi
+   fi
fi
 
# we want to be able to control the pie patch logic via something other
@@ -651,36 +678,8 @@ make_gcc_hard() {
# Need to add HARD_CFLAGS to ALL_CXXFLAGS on >= 4.7
if tc_version_is_at_least 4.7 ; then
sed -e '/^ALL_CXXFLAGS/iHARD_CFLAGS = ' \
--e 's|^ALL_CXXFLAGS = |ALL_CXXFLAGS = $(HARD_CFLAGS) 
|' \
--i "${S}"/gcc/Makefile.in
-   fi
-
-   # defaults to enable for all toolchains
-   local gcc_hard_flags=""
-   if use hardened ; then
-   if hardened_gcc_works 

[gentoo-commits] proj/hardened-dev:master commit in: sys-devel/gcc/

2016-05-05 Thread Magnus Granberg
commit: 8ddf8d8bd71a55d28d9eb41ea3b7b3562cdca3a3
Author: Magnus Granberg  gentoo  org>
AuthorDate: Thu May  5 19:44:11 2016 +
Commit: Magnus Granberg  gentoo  org>
CommitDate: Thu May  5 19:44:11 2016 +
URL:https://gitweb.gentoo.org/proj/hardened-dev.git/commit/?id=8ddf8d8b

Update gcc 6.1.0 to use patchset 1.1

 sys-devel/gcc/gcc-6.1.0.ebuild | 4 ++--
 sys-devel/gcc/metadata.xml | 4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/sys-devel/gcc/gcc-6.1.0.ebuild b/sys-devel/gcc/gcc-6.1.0.ebuild
index 71a02c1..062641d 100644
--- a/sys-devel/gcc/gcc-6.1.0.ebuild
+++ b/sys-devel/gcc/gcc-6.1.0.ebuild
@@ -1,10 +1,10 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2016 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
 EAPI="4"
 
-PATCH_VER="1.0"
+PATCH_VER="1.1"
 #UCLIBC_VER="1.0"
 
 # Hardened gcc 4 stuff

diff --git a/sys-devel/gcc/metadata.xml b/sys-devel/gcc/metadata.xml
index 68aedfb..c86e01d 100644
--- a/sys-devel/gcc/metadata.xml
+++ b/sys-devel/gcc/metadata.xml
@@ -18,7 +18,9 @@
   code in the C library (DO NOT ENABLE THIS IF YOU DON'T KNOW WHAT IT 
DOES)
 Allow for SLOTs to include minor version (3.3.4
   instead of just 3.3)
-Enable SSP support
+Build programs with Stack Smashing Protection as 
default
+Build programs as Position Independent Executables as 
default
+Enable precompiled header support for faster compilation 
at the expense of disk space and memory
 Build support for the Objective C code language
 Build support for the Objective C++ language
 Build support for the Objective C code language 
Garbage



[gentoo-commits] proj/hardened-dev:master commit in: sys-devel/gcc/

2016-05-04 Thread Anthony G. Basile
commit: 714a916995c40e5289afda0d89bdef5d7d06b116
Author: Anthony G. Basile  gentoo  org>
AuthorDate: Wed May  4 19:24:57 2016 +
Commit: Anthony G. Basile  gentoo  org>
CommitDate: Wed May  4 19:24:57 2016 +
URL:https://gitweb.gentoo.org/proj/hardened-dev.git/commit/?id=714a9169

sys-devel/gcc: fix metadata.xml

Package-Manager: portage-2.2.26

 sys-devel/gcc/metadata.xml | 10 +++---
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/sys-devel/gcc/metadata.xml b/sys-devel/gcc/metadata.xml
index 8374583..68aedfb 100644
--- a/sys-devel/gcc/metadata.xml
+++ b/sys-devel/gcc/metadata.xml
@@ -9,20 +9,16 @@
 Useful only when building GCJ, this enables Abstract 
Window Toolkit
   (AWT) peer support on top of GTK+
 Support the Cilk Plus language (C/C++ based languages 
for parallel programming)
-Enable support for the D programming language
 Enable fixed-point arithmetic support for MIPS 
targets 
   in gcc (Warning: significantly increases compile time!)
 Build the GCC Go language frontend.
 Add support for the framework for loop
   optimizations based on a polyhedral intermediate representation
-Enable libgccjit so other applications can embed gcc for 
Just-In-Time compilation.
-  This will slow down the compiler a bit as it forces all of the toolchain 
to be shared libs.
 Build SSP support into a dedicated library rather than 
use the
   code in the C library (DO NOT ENABLE THIS IF YOU DON'T KNOW WHAT IT 
DOES)
-Add support for mudflap, a pointer use checking 
library
-Allow for multiple versions to be emerged at once 
for same CTARGET
-Disable PIE support (NOT FOR GENERAL USE)
-Disable SSP support (NOT FOR GENERAL USE)
+Allow for SLOTs to include minor version (3.3.4
+  instead of just 3.3)
+Enable SSP support
 Build support for the Objective C code language
 Build support for the Objective C++ language
 Build support for the Objective C code language 
Garbage



[gentoo-commits] proj/hardened-dev:master commit in: sys-devel/gcc/

2016-05-04 Thread Magnus Granberg
commit: 95b7df585d1d87bab034216504a7addc531fceca
Author: Magnus Granberg  gentoo  org>
AuthorDate: Wed May  4 18:56:19 2016 +
Commit: Magnus Granberg  gentoo  org>
CommitDate: Wed May  4 18:56:19 2016 +
URL:https://gitweb.gentoo.org/proj/hardened-dev.git/commit/?id=95b7df58

Add Gcc 6.1.0

 sys-devel/gcc/{gcc-6.0.1_rc20160423.ebuild => gcc-6.1.0.ebuild} | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys-devel/gcc/gcc-6.0.1_rc20160423.ebuild 
b/sys-devel/gcc/gcc-6.1.0.ebuild
similarity index 91%
rename from sys-devel/gcc/gcc-6.0.1_rc20160423.ebuild
rename to sys-devel/gcc/gcc-6.1.0.ebuild
index aa41e69..71a02c1 100644
--- a/sys-devel/gcc/gcc-6.0.1_rc20160423.ebuild
+++ b/sys-devel/gcc/gcc-6.1.0.ebuild
@@ -22,7 +22,7 @@ PATCH_VER="1.0"
 
 inherit toolchain
 
-KEYWORDS="~amd64"
+KEYWORDS=""
 
 RDEPEND=""
 DEPEND="${RDEPEND}
@@ -34,7 +34,6 @@ if [[ ${CATEGORY} != cross-* ]] ; then
 fi
 
 src_prepare() {
-   is_crosscompile && EPATCH_EXCLUDE+=" 05_all_gcc-spec-env.patch"
 
toolchain_src_prepare
 }



[gentoo-commits] proj/hardened-dev:master commit in: sys-devel/gcc/files/, eclass/, sys-devel/gcc/files/awk/, sys-devel/gcc/

2016-04-23 Thread Magnus Granberg
commit: fe83d9435aeaf2f7914cd53a4d4ba081a6529e16
Author: Magnus Granberg  gentoo  org>
AuthorDate: Sat Apr 23 18:04:28 2016 +
Commit: Magnus Granberg  gentoo  org>
CommitDate: Sat Apr 23 18:04:28 2016 +
URL:https://gitweb.gentoo.org/proj/hardened-dev.git/commit/?id=fe83d943

add GCC 6.0.1 RC

 eclass/toolchain.eclass  |   1 +
 sys-devel/gcc/files/awk/fixlafiles.awk   | 314 +
 sys-devel/gcc/files/awk/fixlafiles.awk-no_gcc_la | 335 +++
 sys-devel/gcc/files/c89  |  20 ++
 sys-devel/gcc/files/c99  |  21 ++
 sys-devel/gcc/files/fix_libtool_files.sh |  67 +
 sys-devel/gcc/files/gcc-configure-LANG.patch |  64 +
 sys-devel/gcc/files/gcc-configure-texinfo.patch  |  16 ++
 sys-devel/gcc/gcc-6.0.1_rc20160423.ebuild|  40 +++
 sys-devel/gcc/metadata.xml   |  37 +++
 10 files changed, 915 insertions(+)

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index c9520a9..3106641 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -633,6 +633,7 @@ make_gcc_hard() {
if use hardened ; then
# rebrand to make bug reports easier

BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
+   fi
if use pie ; then
einfo "Updating gcc to use automatic PIE building ..."
fi

diff --git a/sys-devel/gcc/files/awk/fixlafiles.awk 
b/sys-devel/gcc/files/awk/fixlafiles.awk
new file mode 100644
index 000..ad2c2b1
--- /dev/null
+++ b/sys-devel/gcc/files/awk/fixlafiles.awk
@@ -0,0 +1,314 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+#
+# 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
+}
+
+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
+   #
+   pipe = "cat /etc/ld.so.conf | sort 2>/dev/null"
+   while(((pipe) | getline ldsoconf_data) > 0) {
+   if (ldsoconf_data !~ /^[[:space:]]*#/) {
+   if (ldsoconf_data == "") continue
+
+   # Remove any trailing comments
+   sub(/#.*$/, "", ldsoconf_data)
+   # Remove any trailing spaces
+   sub(/[[:space:]]+$/, "", ldsoconf_data)
+
+   # If there's more than one path per line, split 
+   # it up as if they were sep lines
+   split(ldsoconf_data, nodes, /[:,[:space:]]/)
+
+   # Now add the rest from ld.so.conf
+   for (x in nodes) {
+   # wtf does this line do ?
+   sub(/=.*/, "", nodes[x])
+   # Prune trailing /
+   sub(/\/$/, "", nodes[x])
+
+   if (nodes[x] == "") continue
+
+   #
+   # 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
+