summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /sys-libs
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'sys-libs')
-rw-r--r--sys-libs/argp-standalone/Manifest1
-rw-r--r--sys-libs/argp-standalone/argp-standalone-1.3.ebuild29
-rw-r--r--sys-libs/argp-standalone/files/argp-standalone-1.3-throw-in-funcdef.patch79
-rw-r--r--sys-libs/argp-standalone/metadata.xml13
-rw-r--r--sys-libs/cracklib/Manifest4
-rw-r--r--sys-libs/cracklib/cracklib-2.8.22.ebuild105
-rw-r--r--sys-libs/cracklib/cracklib-2.9.1-r1.ebuild106
-rw-r--r--sys-libs/cracklib/cracklib-2.9.4.ebuild105
-rw-r--r--sys-libs/cracklib/cracklib-2.9.5.ebuild105
-rw-r--r--sys-libs/cracklib/files/cracklib-2.9.1-setup.py-srcdir.patch35
-rw-r--r--sys-libs/cracklib/metadata.xml8
-rw-r--r--sys-libs/csu/Manifest2
-rw-r--r--sys-libs/csu/csu-79.ebuild45
-rw-r--r--sys-libs/csu/csu-85.ebuild52
-rw-r--r--sys-libs/csu/files/csu-85-arm-availability.patch18
-rw-r--r--sys-libs/csu/metadata.xml5
-rw-r--r--sys-libs/db/Manifest38
-rw-r--r--sys-libs/db/db-1.85-r3.ebuild51
-rw-r--r--sys-libs/db/db-3.2.9_p2.ebuild183
-rw-r--r--sys-libs/db/db-4.2.52_p5-r1.ebuild166
-rw-r--r--sys-libs/db/db-4.3.29_p1-r1.ebuild169
-rw-r--r--sys-libs/db/db-4.4.20_p4-r1.ebuild163
-rw-r--r--sys-libs/db/db-4.5.20_p2-r1.ebuild176
-rw-r--r--sys-libs/db/db-4.6.21_p4.ebuild169
-rw-r--r--sys-libs/db/db-4.7.25_p4.ebuild160
-rw-r--r--sys-libs/db/db-4.8.30-r1.ebuild185
-rw-r--r--sys-libs/db/db-4.8.30-r2.ebuild185
-rw-r--r--sys-libs/db/db-5.1.29-r1.ebuild201
-rw-r--r--sys-libs/db/db-5.3.28-r2.ebuild234
-rw-r--r--sys-libs/db/db-6.0.30-r1.ebuild235
-rw-r--r--sys-libs/db/db-6.0.35.ebuild235
-rw-r--r--sys-libs/db/db-6.1.26.ebuild235
-rw-r--r--sys-libs/db/files/db-1.85-gentoo-paths.patch29
-rw-r--r--sys-libs/db/files/db-3.2.9-fix-dep-link.patch26
-rw-r--r--sys-libs/db/files/db-3.2.9-gcc43.patch16
-rw-r--r--sys-libs/db/files/db-3.2.9-jarlocation.patch12
-rw-r--r--sys-libs/db/files/db-3.2.9-java15.patch15
-rw-r--r--sys-libs/db/files/db-4.0.14-fix-dep-link.patch38
-rw-r--r--sys-libs/db/files/db-4.0.14-jarlocation.patch14
-rw-r--r--sys-libs/db/files/db-4.2-jarlocation.patch16
-rw-r--r--sys-libs/db/files/db-4.2-jni-check-prefix-first.patch30
-rw-r--r--sys-libs/db/files/db-4.2-libtool.patch20
-rw-r--r--sys-libs/db/files/db-4.2-listen-to-java-options.patch10
-rw-r--r--sys-libs/db/files/db-4.2.52_p2-TXN.patch68
-rw-r--r--sys-libs/db/files/db-4.3-jarlocation.patch16
-rw-r--r--sys-libs/db/files/db-4.3-jni-check-prefix-first.patch30
-rw-r--r--sys-libs/db/files/db-4.3-libtool.patch47
-rw-r--r--sys-libs/db/files/db-4.3-listen-to-java-options.patch10
-rw-r--r--sys-libs/db/files/db-4.3.27-fix-dep-link.patch38
-rw-r--r--sys-libs/db/files/db-4.4-jarlocation.patch16
-rw-r--r--sys-libs/db/files/db-4.4-libtool.patch47
-rw-r--r--sys-libs/db/files/db-4.5-jarlocation.patch16
-rw-r--r--sys-libs/db/files/db-4.5-libtool.patch47
-rw-r--r--sys-libs/db/files/db-4.6-jarlocation.patch16
-rw-r--r--sys-libs/db/files/db-4.6-jni-check-prefix-first.patch30
-rw-r--r--sys-libs/db/files/db-4.6-libtool.patch47
-rw-r--r--sys-libs/db/files/db-4.8-libtool.patch65
-rw-r--r--sys-libs/db/files/db-4.8.24-java-manifest-location.patch12
-rw-r--r--sys-libs/db/files/db-4.8.30-rename-atomic-compare-exchange.patch22
-rw-r--r--sys-libs/db/files/db-5.0.21-enable-dbm-autoconf.patch49
-rw-r--r--sys-libs/db/files/db-5.2.28-sqlite-configure-path.patch12
-rw-r--r--sys-libs/db/files/db-6.0.19-sqlite-configure-path.patch11
-rw-r--r--sys-libs/db/files/db-6.0.20-test-link.patch38
-rw-r--r--sys-libs/db/files/db-6.0.35-sqlite-configure-path.patch11
-rw-r--r--sys-libs/db/files/db-6.1.19-sqlite-configure-path.patch10
-rw-r--r--sys-libs/db/metadata.xml23
-rw-r--r--sys-libs/e2fsprogs-libs/Manifest3
-rw-r--r--sys-libs/e2fsprogs-libs/e2fsprogs-libs-1.41.7.ebuild51
-rw-r--r--sys-libs/e2fsprogs-libs/e2fsprogs-libs-1.42.12.ebuild70
-rw-r--r--sys-libs/e2fsprogs-libs/e2fsprogs-libs-1.42.13.ebuild70
-rw-r--r--sys-libs/e2fsprogs-libs/files/e2fsprogs-libs-1.42.10-fix-build-cflags.patch13
-rw-r--r--sys-libs/e2fsprogs-libs/files/e2fsprogs-libs-1.42.13-fix-build-cflags.patch13
-rw-r--r--sys-libs/e2fsprogs-libs/files/e2fsprogs-libs-1.42.9-no-quota.patch36
-rw-r--r--sys-libs/e2fsprogs-libs/metadata.xml8
-rw-r--r--sys-libs/efivar/Manifest3
-rw-r--r--sys-libs/efivar/efivar-0.15.ebuild23
-rw-r--r--sys-libs/efivar/efivar-0.20.ebuild23
-rw-r--r--sys-libs/efivar/efivar-0.21.ebuild27
-rw-r--r--sys-libs/efivar/files/0.21-initializer.patch42
-rw-r--r--sys-libs/efivar/metadata.xml16
-rw-r--r--sys-libs/fortify-headers/Manifest3
-rw-r--r--sys-libs/fortify-headers/fortify-headers-0.4.ebuild22
-rw-r--r--sys-libs/fortify-headers/fortify-headers-0.5.ebuild28
-rw-r--r--sys-libs/fortify-headers/fortify-headers-0.6.ebuild28
-rw-r--r--sys-libs/fortify-headers/fortify-headers-9999.ebuild28
-rw-r--r--sys-libs/fortify-headers/metadata.xml8
-rw-r--r--sys-libs/freeipmi/Manifest4
-rw-r--r--sys-libs/freeipmi/files/bmc-watchdog.confd44
-rw-r--r--sys-libs/freeipmi/files/bmc-watchdog.initd.315
-rw-r--r--sys-libs/freeipmi/files/bmc-watchdog.initd.420
-rw-r--r--sys-libs/freeipmi/files/freeipmi-1.1.1-strictaliasing.patch13
-rw-r--r--sys-libs/freeipmi/files/freeipmi.icinga4
-rw-r--r--sys-libs/freeipmi/files/ipmidetectd.confd5
-rw-r--r--sys-libs/freeipmi/files/ipmiseld.confd5
-rw-r--r--sys-libs/freeipmi/freeipmi-1.2.2.ebuild82
-rw-r--r--sys-libs/freeipmi/freeipmi-1.4.3.ebuild96
-rw-r--r--sys-libs/freeipmi/freeipmi-1.4.6-r1.ebuild93
-rw-r--r--sys-libs/freeipmi/freeipmi-1.4.8.ebuild93
-rw-r--r--sys-libs/freeipmi/metadata.xml11
-rw-r--r--sys-libs/fts-standalone/Manifest1
-rw-r--r--sys-libs/fts-standalone/fts-standalone-0.2.ebuild22
-rw-r--r--sys-libs/fts-standalone/metadata.xml8
-rw-r--r--sys-libs/gdbm/Manifest4
-rw-r--r--sys-libs/gdbm/files/gdbm-1.8.3-build.patch21
-rw-r--r--sys-libs/gdbm/files/gdbm-1.8.3-compat-linking.patch19
-rw-r--r--sys-libs/gdbm/files/gdbm-1.8.3-fix-install-ownership.patch45
-rw-r--r--sys-libs/gdbm/files/gdbm-1.9.1-compat-link.patch24
-rw-r--r--sys-libs/gdbm/gdbm-1.10-r1.ebuild72
-rw-r--r--sys-libs/gdbm/gdbm-1.10.ebuild66
-rw-r--r--sys-libs/gdbm/gdbm-1.11.ebuild72
-rw-r--r--sys-libs/gdbm/gdbm-1.8.3-r3.ebuild44
-rw-r--r--sys-libs/gdbm/gdbm-1.8.3-r4.ebuild64
-rw-r--r--sys-libs/gdbm/gdbm-1.9.1-r2.ebuild68
-rw-r--r--sys-libs/gdbm/metadata.xml9
-rw-r--r--sys-libs/glibc/Manifest28
-rw-r--r--sys-libs/glibc/files/2.10/glibc-2.10-gentoo-chk_fail.c315
-rw-r--r--sys-libs/glibc/files/2.10/glibc-2.10-hardened-configure-picdefault.patch30
-rw-r--r--sys-libs/glibc/files/2.10/glibc-2.10-hardened-inittls-nosysenter.patch274
-rw-r--r--sys-libs/glibc/files/2.12/glibc-2.12-hardened-pie.patch39
-rw-r--r--sys-libs/glibc/files/2.16/glibc-2.16-hardened-pie.patch39
-rw-r--r--sys-libs/glibc/files/2.17/glibc-2.17-hardened-pie.patch42
-rw-r--r--sys-libs/glibc/files/2.18/glibc-2.18-gentoo-chk_fail.c314
-rw-r--r--sys-libs/glibc/files/2.18/glibc-2.18-gentoo-stack_chk_fail.c322
-rw-r--r--sys-libs/glibc/files/2.18/glibc-2.18-hardened-inittls-nosysenter.patch277
-rw-r--r--sys-libs/glibc/files/2.19/glibc-2.19-hardened-configure-picdefault.patch30
-rw-r--r--sys-libs/glibc/files/2.20/glibc-2.20-gentoo-chk_fail.c299
-rw-r--r--sys-libs/glibc/files/2.20/glibc-2.20-gentoo-stack_chk_fail.c2
-rw-r--r--sys-libs/glibc/files/2.20/glibc-2.20-hardened-inittls-nosysenter.patch306
-rw-r--r--sys-libs/glibc/files/2.6/glibc-2.6-gentoo-stack_chk_fail.c321
-rw-r--r--sys-libs/glibc/files/eblits/common.eblit360
-rw-r--r--sys-libs/glibc/files/eblits/pkg_postinst.eblit27
-rw-r--r--sys-libs/glibc/files/eblits/pkg_preinst.eblit60
-rw-r--r--sys-libs/glibc/files/eblits/pkg_pretend.eblit157
-rw-r--r--sys-libs/glibc/files/eblits/pkg_setup.eblit9
-rw-r--r--sys-libs/glibc/files/eblits/src_compile.eblit24
-rw-r--r--sys-libs/glibc/files/eblits/src_configure.eblit259
-rw-r--r--sys-libs/glibc/files/eblits/src_install.eblit244
-rw-r--r--sys-libs/glibc/files/eblits/src_prepare.eblit63
-rw-r--r--sys-libs/glibc/files/eblits/src_test.eblit30
-rw-r--r--sys-libs/glibc/files/eblits/src_unpack.eblit121
-rwxr-xr-xsys-libs/glibc/files/nscd64
-rw-r--r--sys-libs/glibc/files/nscd.service15
-rw-r--r--sys-libs/glibc/files/nscd.tmpfilesd4
-rw-r--r--sys-libs/glibc/files/nsswitch.conf24
-rw-r--r--sys-libs/glibc/glibc-2.13-r4.ebuild218
-rw-r--r--sys-libs/glibc/glibc-2.14.1-r3.ebuild246
-rw-r--r--sys-libs/glibc/glibc-2.15-r3.ebuild225
-rw-r--r--sys-libs/glibc/glibc-2.16.0.ebuild223
-rw-r--r--sys-libs/glibc/glibc-2.17.ebuild210
-rw-r--r--sys-libs/glibc/glibc-2.18-r1.ebuild210
-rw-r--r--sys-libs/glibc/glibc-2.19-r1.ebuild209
-rw-r--r--sys-libs/glibc/glibc-2.19.ebuild209
-rw-r--r--sys-libs/glibc/glibc-2.20-r1.ebuild188
-rw-r--r--sys-libs/glibc/glibc-2.20-r2.ebuild196
-rw-r--r--sys-libs/glibc/glibc-2.20.ebuild187
-rw-r--r--sys-libs/glibc/glibc-2.21-r1.ebuild196
-rw-r--r--sys-libs/glibc/glibc-2.22.ebuild196
-rw-r--r--sys-libs/glibc/glibc-9999.ebuild188
-rw-r--r--sys-libs/glibc/metadata.xml15
-rw-r--r--sys-libs/gpm/Manifest2
-rw-r--r--sys-libs/gpm/files/0001-daemon-use-sys-ioctl.h-for-ioctl.patch31
-rw-r--r--sys-libs/gpm/files/0001-fixup-make-warnings.patch35
-rw-r--r--sys-libs/gpm/files/gpm-1.20.5-abi.patch13
-rw-r--r--sys-libs/gpm/files/gpm-1.20.6-disablestatic.patch66
-rw-r--r--sys-libs/gpm/files/gpm.conf.d23
-rw-r--r--sys-libs/gpm/files/gpm.rc638
-rw-r--r--sys-libs/gpm/files/gpm.rc6-229
-rw-r--r--sys-libs/gpm/files/gpm.service12
-rw-r--r--sys-libs/gpm/gpm-1.20.6-r1.ebuild71
-rw-r--r--sys-libs/gpm/gpm-1.20.6.ebuild60
-rw-r--r--sys-libs/gpm/gpm-1.20.7-r1.ebuild65
-rw-r--r--sys-libs/gpm/gpm-1.20.7-r2.ebuild77
-rw-r--r--sys-libs/gpm/gpm-1.20.7.ebuild64
-rw-r--r--sys-libs/gpm/metadata.xml5
-rw-r--r--sys-libs/gwenhywfar/Manifest3
-rw-r--r--sys-libs/gwenhywfar/gwenhywfar-4.12.0_beta.ebuild60
-rw-r--r--sys-libs/gwenhywfar/gwenhywfar-4.13.1.ebuild60
-rw-r--r--sys-libs/gwenhywfar/gwenhywfar-4.3.3.ebuild58
-rw-r--r--sys-libs/gwenhywfar/metadata.xml10
-rw-r--r--sys-libs/itx-bind/files/weak.s304
-rw-r--r--sys-libs/itx-bind/itx-bind-0.1-r2.ebuild93
-rw-r--r--sys-libs/itx-bind/metadata.xml13
-rw-r--r--sys-libs/ldb/Manifest5
-rw-r--r--sys-libs/ldb/ldb-1.1.12.ebuild77
-rw-r--r--sys-libs/ldb/ldb-1.1.15.ebuild77
-rw-r--r--sys-libs/ldb/ldb-1.1.17-r1.ebuild77
-rw-r--r--sys-libs/ldb/ldb-1.1.20.ebuild77
-rw-r--r--sys-libs/ldb/ldb-1.1.21.ebuild77
-rw-r--r--sys-libs/ldb/metadata.xml5
-rw-r--r--sys-libs/lib-compat-loki/Manifest1
-rw-r--r--sys-libs/lib-compat-loki/lib-compat-loki-0.2-r1.ebuild40
-rw-r--r--sys-libs/lib-compat-loki/metadata.xml5
-rw-r--r--sys-libs/lib-compat/Manifest1
-rw-r--r--sys-libs/lib-compat/lib-compat-1.4.2-r1.ebuild31
-rw-r--r--sys-libs/lib-compat/metadata.xml5
-rw-r--r--sys-libs/libaal/Manifest2
-rw-r--r--sys-libs/libaal/libaal-1.0.5-r1.ebuild37
-rw-r--r--sys-libs/libaal/libaal-1.0.5.ebuild48
-rw-r--r--sys-libs/libaal/libaal-1.0.6.ebuild39
-rw-r--r--sys-libs/libaal/metadata.xml12
-rw-r--r--sys-libs/libacpi/Manifest1
-rw-r--r--sys-libs/libacpi/files/libacpi-0.2.patch81
-rw-r--r--sys-libs/libacpi/libacpi-0.2.ebuild29
-rw-r--r--sys-libs/libacpi/metadata.xml8
-rw-r--r--sys-libs/libapparmor/Manifest2
-rw-r--r--sys-libs/libapparmor/libapparmor-2.8.3.ebuild84
-rw-r--r--sys-libs/libapparmor/libapparmor-2.8.4.ebuild84
-rw-r--r--sys-libs/libapparmor/metadata.xml11
-rw-r--r--sys-libs/libavc1394/Manifest2
-rw-r--r--sys-libs/libavc1394/libavc1394-0.5.3.ebuild21
-rw-r--r--sys-libs/libavc1394/libavc1394-0.5.4-r1.ebuild22
-rw-r--r--sys-libs/libavc1394/libavc1394-0.5.4.ebuild20
-rw-r--r--sys-libs/libavc1394/metadata.xml8
-rw-r--r--sys-libs/libcap-ng/Manifest6
-rw-r--r--sys-libs/libcap-ng/files/libcap-ng-0.7.5-add-unistd_h.patch20
-rw-r--r--sys-libs/libcap-ng/libcap-ng-0.6.6.ebuild117
-rw-r--r--sys-libs/libcap-ng/libcap-ng-0.7.3.ebuild115
-rw-r--r--sys-libs/libcap-ng/libcap-ng-0.7.4.ebuild92
-rw-r--r--sys-libs/libcap-ng/libcap-ng-0.7.5.ebuild93
-rw-r--r--sys-libs/libcap-ng/libcap-ng-0.7.6.ebuild93
-rw-r--r--sys-libs/libcap-ng/libcap-ng-0.7.7.ebuild100
-rw-r--r--sys-libs/libcap-ng/metadata.xml10
-rw-r--r--sys-libs/libcap/Manifest6
-rw-r--r--sys-libs/libcap/files/2.16/0001-build-system-fixes.patch154
-rw-r--r--sys-libs/libcap/files/libcap-2.20-build-system-fixes.patch162
-rw-r--r--sys-libs/libcap/files/libcap-2.20-ignore-RAISE_SETFCAP-install-failures.patch29
-rw-r--r--sys-libs/libcap/files/libcap-2.21-include.patch10
-rw-r--r--sys-libs/libcap/files/libcap-2.22-build-system-fixes.patch171
-rw-r--r--sys-libs/libcap/files/libcap-2.22-no-perl.patch54
-rw-r--r--sys-libs/libcap/files/libcap-2.24-build-system-fixes.patch163
-rw-r--r--sys-libs/libcap/files/libcap-2.24-setcap-errno.patch45
-rw-r--r--sys-libs/libcap/libcap-2.17.ebuild48
-rw-r--r--sys-libs/libcap/libcap-2.19.ebuild47
-rw-r--r--sys-libs/libcap/libcap-2.20.ebuild47
-rw-r--r--sys-libs/libcap/libcap-2.21.ebuild48
-rw-r--r--sys-libs/libcap/libcap-2.22-r1.ebuild52
-rw-r--r--sys-libs/libcap/libcap-2.22-r2.ebuild69
-rw-r--r--sys-libs/libcap/libcap-2.22.ebuild51
-rw-r--r--sys-libs/libcap/libcap-2.24-r1.ebuild72
-rw-r--r--sys-libs/libcap/libcap-2.24-r2.ebuild73
-rw-r--r--sys-libs/libcap/libcap-2.24.ebuild71
-rw-r--r--sys-libs/libcap/metadata.xml5
-rw-r--r--sys-libs/libchipcard/Manifest1
-rw-r--r--sys-libs/libchipcard/files/libchipcard-5.0.0-pcsc-lite-1.6.2.patch33
-rw-r--r--sys-libs/libchipcard/libchipcard-5.0.2.ebuild44
-rw-r--r--sys-libs/libchipcard/metadata.xml5
-rw-r--r--sys-libs/libcxx/Manifest6
-rw-r--r--sys-libs/libcxx/files/Makefile38
-rwxr-xr-xsys-libs/libcxx/files/prepare_snapshot.sh16
-rw-r--r--sys-libs/libcxx/libcxx-0.0_p20130725.ebuild168
-rw-r--r--sys-libs/libcxx/libcxx-0.0_p20131222.ebuild169
-rw-r--r--sys-libs/libcxx/libcxx-0.0_p20140322.ebuild169
-rw-r--r--sys-libs/libcxx/libcxx-3.6.0.ebuild170
-rw-r--r--sys-libs/libcxx/libcxx-3.6.1.ebuild170
-rw-r--r--sys-libs/libcxx/libcxx-3.6.2.ebuild170
-rw-r--r--sys-libs/libcxx/libcxx-9999.ebuild170
-rw-r--r--sys-libs/libcxx/metadata.xml15
-rw-r--r--sys-libs/libcxxrt/Manifest2
-rw-r--r--sys-libs/libcxxrt/files/Makefile23
-rw-r--r--sys-libs/libcxxrt/files/Makefile.test7
-rwxr-xr-xsys-libs/libcxxrt/files/prepare_snapshot.sh16
-rw-r--r--sys-libs/libcxxrt/libcxxrt-0.0_p20140322.ebuild71
-rw-r--r--sys-libs/libcxxrt/libcxxrt-0.0_p20150423.ebuild71
-rw-r--r--sys-libs/libcxxrt/libcxxrt-9999.ebuild71
-rw-r--r--sys-libs/libcxxrt/metadata.xml15
-rw-r--r--sys-libs/libfaketime/Manifest1
-rw-r--r--sys-libs/libfaketime/libfaketime-0.9.6-r1.ebuild33
-rw-r--r--sys-libs/libfaketime/metadata.xml19
-rw-r--r--sys-libs/libfreevec/Manifest1
-rw-r--r--sys-libs/libfreevec/libfreevec-1.0.4.ebuild25
-rw-r--r--sys-libs/libfreevec/metadata.xml8
-rw-r--r--sys-libs/libhugetlbfs/Manifest2
-rw-r--r--sys-libs/libhugetlbfs/files/libhugetlbfs-2.6-fixup-testsuite.patch31
-rw-r--r--sys-libs/libhugetlbfs/files/libhugetlbfs-2.6-noexec-stack.patch44
-rw-r--r--sys-libs/libhugetlbfs/files/libhugetlbfs-2.9-build.patch31
-rw-r--r--sys-libs/libhugetlbfs/libhugetlbfs-2.18.ebuild147
-rw-r--r--sys-libs/libhugetlbfs/libhugetlbfs-2.19.ebuild147
-rw-r--r--sys-libs/libhugetlbfs/metadata.xml8
-rw-r--r--sys-libs/libhx/Manifest2
-rw-r--r--sys-libs/libhx/libhx-3.16.ebuild31
-rw-r--r--sys-libs/libhx/libhx-3.22.ebuild31
-rw-r--r--sys-libs/libhx/metadata.xml14
-rw-r--r--sys-libs/libieee1284/Manifest1
-rw-r--r--sys-libs/libieee1284/libieee1284-0.2.11-r1.ebuild41
-rw-r--r--sys-libs/libieee1284/libieee1284-0.2.11-r2.ebuild44
-rw-r--r--sys-libs/libieee1284/libieee1284-0.2.11-r3.ebuild48
-rw-r--r--sys-libs/libieee1284/metadata.xml8
-rw-r--r--sys-libs/libixp/Manifest1
-rw-r--r--sys-libs/libixp/libixp-0.5_p20110208-r3.ebuild50
-rw-r--r--sys-libs/libixp/metadata.xml5
-rw-r--r--sys-libs/libkudzu/Manifest1
-rw-r--r--sys-libs/libkudzu/files/kudzu-1.2.57.1-sbusfix.patch72
-rw-r--r--sys-libs/libkudzu/files/kudzu-1.2.57.1-sparc-keyboard.patch195
-rw-r--r--sys-libs/libkudzu/libkudzu-1.2.57.1.ebuild62
-rw-r--r--sys-libs/libkudzu/metadata.xml5
-rw-r--r--sys-libs/libmath++/Manifest1
-rw-r--r--sys-libs/libmath++/libmath++-0.0.4-r1.ebuild50
-rw-r--r--sys-libs/libmath++/metadata.xml5
-rw-r--r--sys-libs/libnih/Manifest1
-rw-r--r--sys-libs/libnih/files/libnih-1.0.3-optional-dbus.patch40
-rw-r--r--sys-libs/libnih/files/libnih-1.0.3-pkg-config.patch56
-rw-r--r--sys-libs/libnih/files/libnih-1.0.3-signal-race.patch60
-rw-r--r--sys-libs/libnih/libnih-1.0.3-r1.ebuild45
-rw-r--r--sys-libs/libnih/libnih-1.0.3-r2.ebuild46
-rw-r--r--sys-libs/libnih/libnih-1.0.3-r3.ebuild47
-rw-r--r--sys-libs/libnih/libnih-1.0.3.ebuild47
-rw-r--r--sys-libs/libnih/metadata.xml11
-rw-r--r--sys-libs/libosinfo/Manifest2
-rw-r--r--sys-libs/libosinfo/libosinfo-0.2.11.ebuild52
-rw-r--r--sys-libs/libosinfo/libosinfo-0.2.12.ebuild51
-rw-r--r--sys-libs/libosinfo/metadata.xml5
-rw-r--r--sys-libs/libraw1394/Manifest3
-rw-r--r--sys-libs/libraw1394/libraw1394-2.0.8.ebuild29
-rw-r--r--sys-libs/libraw1394/libraw1394-2.1.0-r1.ebuild22
-rw-r--r--sys-libs/libraw1394/libraw1394-2.1.1.ebuild22
-rw-r--r--sys-libs/libraw1394/metadata.xml5
-rw-r--r--sys-libs/librtas/Manifest5
-rw-r--r--sys-libs/librtas/files/librtas-1.3.3-open.patch22
-rw-r--r--sys-libs/librtas/files/librtas-1.3.3-remove-doc.patch14
-rw-r--r--sys-libs/librtas/files/librtas-1.3.6-symlink.patch24
-rw-r--r--sys-libs/librtas/files/librtas-1.3.8-symlink.patch20
-rw-r--r--sys-libs/librtas/librtas-1.3.13.ebuild21
-rw-r--r--sys-libs/librtas/librtas-1.3.3.ebuild25
-rw-r--r--sys-libs/librtas/librtas-1.3.5.ebuild19
-rw-r--r--sys-libs/librtas/librtas-1.3.6.ebuild22
-rw-r--r--sys-libs/librtas/librtas-1.3.8.ebuild22
-rw-r--r--sys-libs/librtas/metadata.xml8
-rw-r--r--sys-libs/libseccomp/Manifest6
-rw-r--r--sys-libs/libseccomp/libseccomp-0.1.0.ebuild36
-rw-r--r--sys-libs/libseccomp/libseccomp-1.0.0.ebuild38
-rw-r--r--sys-libs/libseccomp/libseccomp-1.0.1.ebuild38
-rw-r--r--sys-libs/libseccomp/libseccomp-2.1.0.ebuild41
-rw-r--r--sys-libs/libseccomp/libseccomp-2.1.1.ebuild41
-rw-r--r--sys-libs/libseccomp/libseccomp-2.2.0.ebuild39
-rw-r--r--sys-libs/libseccomp/metadata.xml13
-rw-r--r--sys-libs/libselinux/Manifest5
-rw-r--r--sys-libs/libselinux/files/0005-use-ruby-include-with-rubylibver.patch12
-rw-r--r--sys-libs/libselinux/files/0006-build-related-fixes-bug-500674.patch67
-rw-r--r--sys-libs/libselinux/libselinux-2.2.2-r5.ebuild95
-rw-r--r--sys-libs/libselinux/libselinux-2.3-r2.ebuild145
-rw-r--r--sys-libs/libselinux/libselinux-2.4.ebuild142
-rw-r--r--sys-libs/libselinux/libselinux-9999.ebuild152
-rw-r--r--sys-libs/libselinux/metadata.xml13
-rw-r--r--sys-libs/libsemanage/Manifest3
-rw-r--r--sys-libs/libsemanage/files/0001-libsemanage-do-not-copy-contexts-in-semanage_migrate.patch208
-rw-r--r--sys-libs/libsemanage/libsemanage-2.2-r2.ebuild91
-rw-r--r--sys-libs/libsemanage/libsemanage-2.3-r4.ebuild104
-rw-r--r--sys-libs/libsemanage/libsemanage-2.4-r1.ebuild127
-rw-r--r--sys-libs/libsemanage/libsemanage-9999.ebuild137
-rw-r--r--sys-libs/libsemanage/metadata.xml9
-rw-r--r--sys-libs/libsepol/Manifest3
-rw-r--r--sys-libs/libsepol/libsepol-2.2.ebuild46
-rw-r--r--sys-libs/libsepol/libsepol-2.3.ebuild49
-rw-r--r--sys-libs/libsepol/libsepol-2.4.ebuild43
-rw-r--r--sys-libs/libsepol/libsepol-9999.ebuild50
-rw-r--r--sys-libs/libsepol/metadata.xml9
-rw-r--r--sys-libs/libservicelog/Manifest3
-rw-r--r--sys-libs/libservicelog/files/libservicelog-1.0.1.patch10
-rw-r--r--sys-libs/libservicelog/files/libservicelog-1.1.11.patch9
-rw-r--r--sys-libs/libservicelog/libservicelog-1.0.1.ebuild33
-rw-r--r--sys-libs/libservicelog/libservicelog-1.1.11.ebuild33
-rw-r--r--sys-libs/libservicelog/libservicelog-1.1.15.ebuild35
-rw-r--r--sys-libs/libservicelog/metadata.xml8
-rw-r--r--sys-libs/libsmbios/Manifest1
-rw-r--r--sys-libs/libsmbios/files/libsmbios-2.2.28-cppunit-tests.patch11
-rw-r--r--sys-libs/libsmbios/files/libsmbios-2.2.28-gcc46.patch11
-rw-r--r--sys-libs/libsmbios/files/libsmbios-fix-pie.patch30
-rw-r--r--sys-libs/libsmbios/libsmbios-2.2.28.ebuild79
-rw-r--r--sys-libs/libsmbios/metadata.xml11
-rw-r--r--sys-libs/libspe2/Manifest2
-rw-r--r--sys-libs/libspe2/files/spe.rc639
-rw-r--r--sys-libs/libspe2/libspe2-2.2.80_p95-r1.ebuild67
-rw-r--r--sys-libs/libspe2/libspe2-2.3.0_p135.ebuild68
-rw-r--r--sys-libs/libspe2/metadata.xml10
-rw-r--r--sys-libs/libstatgrab/Manifest2
-rw-r--r--sys-libs/libstatgrab/files/libstatgrab-0.91-tinfo.patch43
-rw-r--r--sys-libs/libstatgrab/libstatgrab-0.17.ebuild32
-rw-r--r--sys-libs/libstatgrab/libstatgrab-0.91.ebuild43
-rw-r--r--sys-libs/libstatgrab/metadata.xml7
-rw-r--r--sys-libs/libstdc++-v3-bin/Manifest2
-rw-r--r--sys-libs/libstdc++-v3-bin/libstdc++-v3-bin-3.3.6.ebuild22
-rw-r--r--sys-libs/libstdc++-v3-bin/metadata.xml5
-rw-r--r--sys-libs/libstdc++-v3/Manifest3
-rw-r--r--sys-libs/libstdc++-v3/libstdc++-v3-3.3.6-r1.ebuild182
-rw-r--r--sys-libs/libstdc++-v3/libstdc++-v3-3.3.6.ebuild178
-rw-r--r--sys-libs/libstdc++-v3/metadata.xml5
-rw-r--r--sys-libs/libtermcap-compat/Manifest4
-rw-r--r--sys-libs/libtermcap-compat/libtermcap-compat-2.0.8-r2.ebuild64
-rw-r--r--sys-libs/libtermcap-compat/libtermcap-compat-2.0.8-r3.ebuild50
-rw-r--r--sys-libs/libtermcap-compat/metadata.xml5
-rw-r--r--sys-libs/libtrash/Manifest1
-rw-r--r--sys-libs/libtrash/files/cleanTrash.cron12
-rw-r--r--sys-libs/libtrash/files/libtrash-3.2-gentoo.patch63
-rw-r--r--sys-libs/libtrash/files/libtrash-3.2-ldflags.patch11
-rw-r--r--sys-libs/libtrash/libtrash-3.2-r1.ebuild68
-rw-r--r--sys-libs/libtrash/metadata.xml7
-rw-r--r--sys-libs/libunwind/Manifest3
-rw-r--r--sys-libs/libunwind/files/libunwind-0.99-disable-setjmp.patch213
-rw-r--r--sys-libs/libunwind/files/libunwind-0.99-implicit-declaration.patch17
-rw-r--r--sys-libs/libunwind/files/libunwind-1.0.1-disable-setjmp.patch37
-rw-r--r--sys-libs/libunwind/files/libunwind-1.0.1-ia64.patch133
-rw-r--r--sys-libs/libunwind/files/libunwind-1.1-lzma.patch63
-rw-r--r--sys-libs/libunwind/libunwind-0.99-r1.ebuild38
-rw-r--r--sys-libs/libunwind/libunwind-1.0.1-r1.ebuild60
-rw-r--r--sys-libs/libunwind/libunwind-1.0.1.ebuild50
-rw-r--r--sys-libs/libunwind/libunwind-1.1.ebuild70
-rw-r--r--sys-libs/libunwind/metadata.xml9
-rw-r--r--sys-libs/libutempter/Manifest2
-rw-r--r--sys-libs/libutempter/libutempter-1.1.5-r1.ebuild66
-rw-r--r--sys-libs/libutempter/libutempter-1.1.5.ebuild58
-rw-r--r--sys-libs/libutempter/libutempter-1.1.6-r1.ebuild70
-rw-r--r--sys-libs/libutempter/libutempter-1.1.6-r2.ebuild70
-rw-r--r--sys-libs/libutempter/libutempter-1.1.6.ebuild66
-rw-r--r--sys-libs/libutempter/metadata.xml6
-rw-r--r--sys-libs/libvpd/Manifest2
-rw-r--r--sys-libs/libvpd/libvpd-2.1.3.ebuild33
-rw-r--r--sys-libs/libvpd/libvpd-2.2.4.ebuild36
-rw-r--r--sys-libs/libvpd/metadata.xml8
-rw-r--r--sys-libs/libxcrypt/Manifest2
-rw-r--r--sys-libs/libxcrypt/files/libxcrypt-2.4-glibc-2.16.patch40
-rw-r--r--sys-libs/libxcrypt/libxcrypt-2.0.ebuild16
-rw-r--r--sys-libs/libxcrypt/libxcrypt-2.4.ebuild29
-rw-r--r--sys-libs/libxcrypt/metadata.xml10
-rw-r--r--sys-libs/lrmi/Manifest1
-rw-r--r--sys-libs/lrmi/files/lrmi-0.10-kernel-2.6.26.patch18
-rw-r--r--sys-libs/lrmi/files/lrmi-0.10-ldflags.patch26
-rw-r--r--sys-libs/lrmi/lrmi-0.10-r1.ebuild37
-rw-r--r--sys-libs/lrmi/metadata.xml8
-rw-r--r--sys-libs/lwp/Manifest3
-rw-r--r--sys-libs/lwp/files/lwp-2.0-amd64.patch28
-rw-r--r--sys-libs/lwp/lwp-2.2.ebuild33
-rw-r--r--sys-libs/lwp/lwp-2.5.ebuild33
-rw-r--r--sys-libs/lwp/lwp-2.6.ebuild21
-rw-r--r--sys-libs/lwp/metadata.xml5
-rw-r--r--sys-libs/mars/Manifest1
-rw-r--r--sys-libs/mars/mars-1.0.1.ebuild42
-rw-r--r--sys-libs/mars/metadata.xml7
-rw-r--r--sys-libs/metadata.xml32
-rw-r--r--sys-libs/mtdev/Manifest2
-rw-r--r--sys-libs/mtdev/metadata.xml8
-rw-r--r--sys-libs/mtdev/mtdev-1.1.4.ebuild25
-rw-r--r--sys-libs/mtdev/mtdev-1.1.5.ebuild25
-rw-r--r--sys-libs/musl/Manifest2
-rw-r--r--sys-libs/musl/files/getent45
-rw-r--r--sys-libs/musl/files/ldconfig143
-rw-r--r--sys-libs/musl/files/ldconfig.in144
-rw-r--r--sys-libs/musl/files/musl-1.1.10-uselocale-0-fix.diff25
-rw-r--r--sys-libs/musl/metadata.xml12
-rw-r--r--sys-libs/musl/musl-1.1.10-r1.ebuild130
-rw-r--r--sys-libs/musl/musl-1.1.8-r2.ebuild104
-rw-r--r--sys-libs/musl/musl-9999.ebuild126
-rw-r--r--sys-libs/ncurses/Manifest1
-rw-r--r--sys-libs/ncurses/files/ncurses-5.7-nongnu.patch11
-rw-r--r--sys-libs/ncurses/files/ncurses-5.8-gfbsd.patch24
-rw-r--r--sys-libs/ncurses/files/ncurses-5.9-fix-clang-build.patch44
-rw-r--r--sys-libs/ncurses/files/ncurses-5.9-gcc-5.patch46
-rw-r--r--sys-libs/ncurses/files/ncurses-5.9-no-I-usr-include.patch45
-rw-r--r--sys-libs/ncurses/files/ncurses-5.9-pkg-config.patch26
-rw-r--r--sys-libs/ncurses/files/ncurses-5.9-rxvt-unicode-9.15.patch191
-rw-r--r--sys-libs/ncurses/metadata.xml14
-rw-r--r--sys-libs/ncurses/ncurses-5.9-r3.ebuild224
-rw-r--r--sys-libs/ncurses/ncurses-5.9-r4.ebuild228
-rw-r--r--sys-libs/newlib/Manifest7
-rw-r--r--sys-libs/newlib/files/newlib-1.20.0-arm-targets.patch55
-rw-r--r--sys-libs/newlib/files/newlib-1.20.0-cris-install.patch13
-rw-r--r--sys-libs/newlib/files/newlib-2.1.0-msp430-destdir.patch41
-rw-r--r--sys-libs/newlib/metadata.xml8
-rw-r--r--sys-libs/newlib/newlib-1.18.0.ebuild72
-rw-r--r--sys-libs/newlib/newlib-1.19.0.ebuild72
-rw-r--r--sys-libs/newlib/newlib-1.20.0.ebuild77
-rw-r--r--sys-libs/newlib/newlib-2.0.0.ebuild70
-rw-r--r--sys-libs/newlib/newlib-2.1.0.ebuild75
-rw-r--r--sys-libs/newlib/newlib-2.2.0.20150423.ebuild82
-rw-r--r--sys-libs/newlib/newlib-2.2.0.ebuild83
-rw-r--r--sys-libs/newlib/newlib-9999.ebuild82
-rw-r--r--sys-libs/nss-db/Manifest4
-rw-r--r--sys-libs/nss-db/files/db3.patch43
-rw-r--r--sys-libs/nss-db/files/nss-db-2.2.3_pre1-root-upgrade-only.patch27
-rw-r--r--sys-libs/nss-db/files/nss-db-2.2.3_pre1-symlinkvuln.patch262
-rw-r--r--sys-libs/nss-db/files/remake-all-db6
-rw-r--r--sys-libs/nss-db/files/sandbox.d_50nss-db1
-rw-r--r--sys-libs/nss-db/metadata.xml5
-rw-r--r--sys-libs/nss-db/nss-db-2.2.3_pre1-r2.ebuild107
-rw-r--r--sys-libs/nss-db/nss-db-2.2.3_pre1-r3.ebuild111
-rw-r--r--sys-libs/nss-db/nss-db-2.2.3_pre1-r4.ebuild112
-rw-r--r--sys-libs/nss-usrfiles/Manifest1
-rw-r--r--sys-libs/nss-usrfiles/metadata.xml11
-rw-r--r--sys-libs/nss-usrfiles/nss-usrfiles-2.18.1.ebuild32
-rw-r--r--sys-libs/nss_wrapper/Manifest1
-rw-r--r--sys-libs/nss_wrapper/metadata.xml9
-rw-r--r--sys-libs/nss_wrapper/nss_wrapper-1.0.3.ebuild30
-rw-r--r--sys-libs/ntdb/Manifest1
-rw-r--r--sys-libs/ntdb/metadata.xml9
-rw-r--r--sys-libs/ntdb/ntdb-1.0-r1.ebuild53
-rw-r--r--sys-libs/openhpi/Manifest2
-rw-r--r--sys-libs/openhpi/files/openhpi-confd10
-rw-r--r--sys-libs/openhpi/files/openhpi-initd21
-rw-r--r--sys-libs/openhpi/metadata.xml10
-rw-r--r--sys-libs/openhpi/openhpi-2.12.0.ebuild64
-rw-r--r--sys-libs/openhpi/openhpi-3.0.0.ebuild55
-rw-r--r--sys-libs/openipmi/Manifest7
-rw-r--r--sys-libs/openipmi/files/openipmi-2.0.16-pthreads.patch12
-rw-r--r--sys-libs/openipmi/metadata.xml8
-rw-r--r--sys-libs/openipmi/openipmi-1.3.18.ebuild35
-rw-r--r--sys-libs/openipmi/openipmi-1.4.12.ebuild41
-rw-r--r--sys-libs/openipmi/openipmi-1.4.14.ebuild41
-rw-r--r--sys-libs/openipmi/openipmi-1.4.28.ebuild41
-rw-r--r--sys-libs/openipmi/openipmi-2.0.11.ebuild71
-rw-r--r--sys-libs/openipmi/openipmi-2.0.16-r1.ebuild105
-rw-r--r--sys-libs/openipmi/openipmi-2.0.16.ebuild102
-rw-r--r--sys-libs/openipmi/openipmi-2.0.18-r1.ebuild97
-rw-r--r--sys-libs/openipmi/openipmi-2.0.18.ebuild106
-rw-r--r--sys-libs/pam/Manifest9
-rw-r--r--sys-libs/pam/files/Linux-PAM-1.1.5+glibc-2.16.patch20
-rw-r--r--sys-libs/pam/files/Linux-PAM-1.1.6+glibc-2.16.patch29
-rw-r--r--sys-libs/pam/files/Linux-PAM-1.1.6-destdir.patch48
-rw-r--r--sys-libs/pam/files/pam-1.1.8-CVE-2013-7041.patch54
-rw-r--r--sys-libs/pam/files/pam-1.1.8-CVE-2014-2583.patch58
-rw-r--r--sys-libs/pam/files/pam-1.1.8-doc-install.patch142
-rw-r--r--sys-libs/pam/metadata.xml32
-rw-r--r--sys-libs/pam/pam-1.1.5.ebuild186
-rw-r--r--sys-libs/pam/pam-1.1.6-r2.ebuild197
-rw-r--r--sys-libs/pam/pam-1.1.8-r1.ebuild183
-rw-r--r--sys-libs/pam/pam-1.1.8-r2.ebuild198
-rw-r--r--sys-libs/pam/pam-1.1.8-r3.ebuild195
-rw-r--r--sys-libs/pam/pam-1.1.8.ebuild181
-rw-r--r--sys-libs/pam/pam-1.2.0.ebuild194
-rw-r--r--sys-libs/pam/pam-1.2.1-r1.ebuild202
-rw-r--r--sys-libs/pam/pam-1.2.1.ebuild201
-rw-r--r--sys-libs/pwdb/Manifest1
-rw-r--r--sys-libs/pwdb/files/passwd4
-rw-r--r--sys-libs/pwdb/files/pwdb-0.62-build.patch114
-rw-r--r--sys-libs/pwdb/files/pwdb-0.62-selinux.patch445
-rw-r--r--sys-libs/pwdb/metadata.xml5
-rw-r--r--sys-libs/pwdb/pwdb-0.62.ebuild58
-rw-r--r--sys-libs/readline/Manifest37
-rw-r--r--sys-libs/readline/files/readline-5.0-no_rpath.patch13
-rw-r--r--sys-libs/readline/files/readline-5.2-no-ignore-shlib-errors.patch24
-rw-r--r--sys-libs/readline/files/readline-6.2-rlfe-tgoto.patch14
-rw-r--r--sys-libs/readline/files/readline-6.3-fix-long-prompt-vi-search.patch26
-rw-r--r--sys-libs/readline/files/readline-6.3-read-eof.patch54
-rw-r--r--sys-libs/readline/metadata.xml8
-rw-r--r--sys-libs/readline/readline-4.3_p5.ebuild61
-rw-r--r--sys-libs/readline/readline-5.2_p14.ebuild70
-rw-r--r--sys-libs/readline/readline-6.2_p5-r1.ebuild153
-rw-r--r--sys-libs/readline/readline-6.3_p8-r1.ebuild163
-rw-r--r--sys-libs/readline/readline-6.3_p8-r2.ebuild164
-rw-r--r--sys-libs/readline/readline-7.0_alpha.ebuild165
-rw-r--r--sys-libs/rvm/Manifest3
-rw-r--r--sys-libs/rvm/metadata.xml5
-rw-r--r--sys-libs/rvm/rvm-1.12.ebuild24
-rw-r--r--sys-libs/rvm/rvm-1.16.ebuild24
-rw-r--r--sys-libs/rvm/rvm-1.17.ebuild23
-rw-r--r--sys-libs/slang/Manifest2
-rw-r--r--sys-libs/slang/files/slang-2.1.3-uclibc.patch12
-rw-r--r--sys-libs/slang/files/slang-2.2.3-slsh-libs.patch11
-rw-r--r--sys-libs/slang/files/slang-2.2.4-memset.patch32
-rw-r--r--sys-libs/slang/metadata.xml5
-rw-r--r--sys-libs/slang/slang-2.2.4-r1.ebuild74
-rw-r--r--sys-libs/slang/slang-2.2.4.ebuild66
-rw-r--r--sys-libs/slang/slang-2.3.0.ebuild74
-rw-r--r--sys-libs/suacomp/Manifest2
-rw-r--r--sys-libs/suacomp/files/suacomp-0.6.14-strtoll.patch44
-rw-r--r--sys-libs/suacomp/metadata.xml14
-rw-r--r--sys-libs/suacomp/suacomp-0.6.13.ebuild60
-rw-r--r--sys-libs/suacomp/suacomp-0.6.14.ebuild64
-rw-r--r--sys-libs/suacomp/suacomp-9999.ebuild60
-rw-r--r--sys-libs/system-config-base/files/1-r1-pam-0.99.8.0-r2-compat.patch11
-rw-r--r--sys-libs/system-config-base/files/config-util8
-rw-r--r--sys-libs/system-config-base/metadata.xml8
-rw-r--r--sys-libs/system-config-base/system-config-base-1-r1.ebuild40
-rw-r--r--sys-libs/talloc/Manifest3
-rw-r--r--sys-libs/talloc/metadata.xml12
-rw-r--r--sys-libs/talloc/talloc-2.1.0-r1.ebuild85
-rw-r--r--sys-libs/talloc/talloc-2.1.2.ebuild85
-rw-r--r--sys-libs/talloc/talloc-2.1.3.ebuild85
-rw-r--r--sys-libs/tdb/Manifest3
-rw-r--r--sys-libs/tdb/files/add_missing_stdbool_h_include.patch27
-rw-r--r--sys-libs/tdb/files/tdb-1.3.7-fix.patch55
-rw-r--r--sys-libs/tdb/metadata.xml9
-rw-r--r--sys-libs/tdb/tdb-1.3.0-r1.ebuild61
-rw-r--r--sys-libs/tdb/tdb-1.3.6.ebuild60
-rw-r--r--sys-libs/tdb/tdb-1.3.7.ebuild61
-rw-r--r--sys-libs/tevent/Manifest3
-rw-r--r--sys-libs/tevent/metadata.xml9
-rw-r--r--sys-libs/tevent/tevent-0.9.21-r1.ebuild55
-rw-r--r--sys-libs/tevent/tevent-0.9.24.ebuild55
-rw-r--r--sys-libs/tevent/tevent-0.9.25.ebuild55
-rw-r--r--sys-libs/timezone-data/Manifest18
-rw-r--r--sys-libs/timezone-data/files/timezone-data-2008h-makefile.patch138
-rw-r--r--sys-libs/timezone-data/files/timezone-data-2012a-makefile.patch138
-rw-r--r--sys-libs/timezone-data/files/timezone-data-2012i-makefile.patch95
-rw-r--r--sys-libs/timezone-data/files/timezone-data-2013a-makefile.patch95
-rw-r--r--sys-libs/timezone-data/files/timezone-data-2013d-makefile.patch95
-rw-r--r--sys-libs/timezone-data/files/timezone-data-2013f-makefile.patch119
-rw-r--r--sys-libs/timezone-data/files/timezone-data-2013h-makefile.patch112
-rw-r--r--sys-libs/timezone-data/files/timezone-data-2014f-makefile.patch112
-rw-r--r--sys-libs/timezone-data/files/timezone-data-2014g-makefile.patch113
-rw-r--r--sys-libs/timezone-data/files/timezone-data-2014h-makefile.patch113
-rw-r--r--sys-libs/timezone-data/files/timezone-data-2015a-makefile.patch113
-rw-r--r--sys-libs/timezone-data/files/timezone-data-2015c-makefile.patch86
-rw-r--r--sys-libs/timezone-data/metadata.xml20
-rw-r--r--sys-libs/timezone-data/timezone-data-2012j.ebuild110
-rw-r--r--sys-libs/timezone-data/timezone-data-2013i.ebuild129
-rw-r--r--sys-libs/timezone-data/timezone-data-2014i-r1.ebuild151
-rw-r--r--sys-libs/timezone-data/timezone-data-2014j.ebuild151
-rw-r--r--sys-libs/timezone-data/timezone-data-2015a.ebuild154
-rw-r--r--sys-libs/timezone-data/timezone-data-2015b.ebuild154
-rw-r--r--sys-libs/timezone-data/timezone-data-2015c-r1.ebuild143
-rw-r--r--sys-libs/timezone-data/timezone-data-2015c.ebuild154
-rw-r--r--sys-libs/timezone-data/timezone-data-2015d.ebuild143
-rw-r--r--sys-libs/timezone-data/timezone-data-2015e.ebuild143
-rw-r--r--sys-libs/uclibc/Manifest2
-rw-r--r--sys-libs/uclibc/metadata.xml26
-rw-r--r--sys-libs/uclibc/uclibc-0.9.33.2-r15.ebuild348
-rw-r--r--sys-libs/uclibc/uclibc-0.9.33.9999.ebuild349
-rw-r--r--sys-libs/uclibc/uclibc-9999.ebuild348
-rw-r--r--sys-libs/uid_wrapper/Manifest1
-rw-r--r--sys-libs/uid_wrapper/metadata.xml9
-rw-r--r--sys-libs/uid_wrapper/uid_wrapper-1.1.0.ebuild30
-rw-r--r--sys-libs/zlib/Manifest6
-rw-r--r--sys-libs/zlib/files/zlib-1.2.1-build-fPIC.patch72
-rw-r--r--sys-libs/zlib/files/zlib-1.2.1-configure.patch103
-rw-r--r--sys-libs/zlib/files/zlib-1.2.1-fPIC.patch16
-rw-r--r--sys-libs/zlib/files/zlib-1.2.1-glibc.patch12
-rw-r--r--sys-libs/zlib/files/zlib-1.2.3-LDFLAGS.patch31
-rw-r--r--sys-libs/zlib/files/zlib-1.2.3-build.patch66
-rw-r--r--sys-libs/zlib/files/zlib-1.2.3-mingw-implib.patch13
-rw-r--r--sys-libs/zlib/files/zlib-1.2.3-r1-bsd-soname.patch15
-rw-r--r--sys-libs/zlib/files/zlib-1.2.3-visibility-support.patch45
-rw-r--r--sys-libs/zlib/files/zlib-1.2.4-minizip-autotools.patch64
-rw-r--r--sys-libs/zlib/files/zlib-1.2.5-fbsd_chosts.patch15
-rw-r--r--sys-libs/zlib/files/zlib-1.2.5-ldflags.patch22
-rw-r--r--sys-libs/zlib/files/zlib-1.2.5-lfs-decls.patch15
-rw-r--r--sys-libs/zlib/files/zlib-1.2.5.1-symlinks.patch33
-rw-r--r--sys-libs/zlib/files/zlib-1.2.5.1-version.patch22
-rw-r--r--sys-libs/zlib/metadata.xml11
-rw-r--r--sys-libs/zlib/zlib-1.2.3-r1.ebuild78
-rw-r--r--sys-libs/zlib/zlib-1.2.5-r2.ebuild72
-rw-r--r--sys-libs/zlib/zlib-1.2.5.1-r1.ebuild76
-rw-r--r--sys-libs/zlib/zlib-1.2.5.1-r2.ebuild100
-rw-r--r--sys-libs/zlib/zlib-1.2.5.1.ebuild72
-rw-r--r--sys-libs/zlib/zlib-1.2.6.ebuild93
-rw-r--r--sys-libs/zlib/zlib-1.2.7.ebuild99
-rw-r--r--sys-libs/zlib/zlib-1.2.8-r1.ebuild116
-rw-r--r--sys-libs/zlib/zlib-1.2.8.ebuild99
646 files changed, 39635 insertions, 0 deletions
diff --git a/sys-libs/argp-standalone/Manifest b/sys-libs/argp-standalone/Manifest
new file mode 100644
index 000000000000..ad37c1e0e29c
--- /dev/null
+++ b/sys-libs/argp-standalone/Manifest
@@ -0,0 +1 @@
+DIST argp-standalone-1.3.tar.gz 130255 SHA256 dec79694da1319acd2238ce95df57f3680fea2482096e483323fddf3d818d8be SHA512 58c3feb8852b90248fff39e49b5019bd0dcf646790c3eaf70c3262eb81dda31a61dc0a45963c7b4a010e80fc14b37288dcb3b3ef48d02f2d33dd72c1c62e62d9 WHIRLPOOL aedcf1ae31ea9484ca10fe028490624b5e17ae2b484f6e31effdc5119aea6affb6f61140bd10ac28c5395f0374df0c46a1d35ed6b7cdea7ce02fd7a4781db456
diff --git a/sys-libs/argp-standalone/argp-standalone-1.3.ebuild b/sys-libs/argp-standalone/argp-standalone-1.3.ebuild
new file mode 100644
index 000000000000..6d30b5955ab2
--- /dev/null
+++ b/sys-libs/argp-standalone/argp-standalone-1.3.ebuild
@@ -0,0 +1,29 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils
+
+DESCRIPTION="Standalone argp library for use with uclibc"
+HOMEPAGE="http://www.lysator.liu.se/~nisse/misc/"
+SRC_URI="http://www.lysator.liu.se/~nisse/misc/argp-standalone-1.3.tar.gz"
+
+LICENSE="public-domain"
+SLOT="0"
+KEYWORDS="amd64 ~mips ~ppc x86"
+IUSE=""
+
+DEPEND="!sys-libs/glibc"
+
+src_prepare() {
+ epatch "${FILESDIR}/${P}-throw-in-funcdef.patch"
+}
+
+src_install() {
+ dolib.a libargp.a
+
+ insinto /usr/include
+ doins argp.h
+}
diff --git a/sys-libs/argp-standalone/files/argp-standalone-1.3-throw-in-funcdef.patch b/sys-libs/argp-standalone/files/argp-standalone-1.3-throw-in-funcdef.patch
new file mode 100644
index 000000000000..4a90751e1e62
--- /dev/null
+++ b/sys-libs/argp-standalone/files/argp-standalone-1.3-throw-in-funcdef.patch
@@ -0,0 +1,79 @@
+# --- T2-COPYRIGHT-NOTE-BEGIN ---
+# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
+#
+# T2 SDE: package/.../rng-tools/throw-in-funcdef.patch.argp-standalone
+# Copyright (C) 2006 The T2 SDE Project
+#
+# More information can be found in the files COPYING and README.
+#
+# This patch file is dual-licensed. It is available under the license the
+# patched project is licensed under, as long as it is an OpenSource license
+# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
+# of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+# --- T2-COPYRIGHT-NOTE-END ---
+
+
+No __THROW in function implementation.
+ --jsaw
+
+--- argp-standalone-1.4-test2/argp.h.orig 2006-01-06 02:29:59.000000000 +0100
++++ argp-standalone-1.4-test2/argp.h 2006-01-06 02:41:10.000000000 +0100
+@@ -560,17 +560,17 @@
+ # endif
+
+ # ifndef ARGP_EI
+-# define ARGP_EI extern __inline__
++# define ARGP_EI extern inline
+ # endif
+
+ ARGP_EI void
+-__argp_usage (__const struct argp_state *__state) __THROW
++__argp_usage (__const struct argp_state *__state)
+ {
+ __argp_state_help (__state, stderr, ARGP_HELP_STD_USAGE);
+ }
+
+ ARGP_EI int
+-__option_is_short (__const struct argp_option *__opt) __THROW
++__option_is_short (__const struct argp_option *__opt)
+ {
+ if (__opt->flags & OPTION_DOC)
+ return 0;
+@@ -582,7 +582,7 @@
+ }
+
+ ARGP_EI int
+-__option_is_end (__const struct argp_option *__opt) __THROW
++__option_is_end (__const struct argp_option *__opt)
+ {
+ return !__opt->key && !__opt->name && !__opt->doc && !__opt->group;
+ }
+--- argp-standalone-1.4-test2/argp-parse.c.orig 2006-01-06 02:47:48.000000000 +0100
++++ argp-standalone-1.4-test2/argp-parse.c 2006-01-06 02:48:16.000000000 +0100
+@@ -1290,13 +1290,13 @@
+ /* Defined here, in case a user is not inlining the definitions in
+ * argp.h */
+ void
+-__argp_usage (__const struct argp_state *__state) __THROW
++__argp_usage (__const struct argp_state *__state)
+ {
+ __argp_state_help (__state, stderr, ARGP_HELP_STD_USAGE);
+ }
+
+ int
+-__option_is_short (__const struct argp_option *__opt) __THROW
++__option_is_short (__const struct argp_option *__opt)
+ {
+ if (__opt->flags & OPTION_DOC)
+ return 0;
+@@ -1310,7 +1310,7 @@
+ }
+
+ int
+-__option_is_end (__const struct argp_option *__opt) __THROW
++__option_is_end (__const struct argp_option *__opt)
+ {
+ return !__opt->key && !__opt->name && !__opt->doc && !__opt->group;
+ }
diff --git a/sys-libs/argp-standalone/metadata.xml b/sys-libs/argp-standalone/metadata.xml
new file mode 100644
index 000000000000..c89e3114594a
--- /dev/null
+++ b/sys-libs/argp-standalone/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>proxy-maintainers</herd>
+ <maintainer>
+ <email>blueness@gentoo.org</email>
+ <name>Anthony G. Basile</name>
+ </maintainer>
+ <maintainer>
+ <email>gentoo@wildgooses.com</email>
+ <name>Ed Wildgoose</name>
+ </maintainer>
+</pkgmetadata>
diff --git a/sys-libs/cracklib/Manifest b/sys-libs/cracklib/Manifest
new file mode 100644
index 000000000000..eb8aaf245e26
--- /dev/null
+++ b/sys-libs/cracklib/Manifest
@@ -0,0 +1,4 @@
+DIST cracklib-2.8.22.tar.gz 631796 SHA256 feaff49bfb513ec10b2618c00d2f7f60776ba93fcc5fa22dd3479dd9cad9f770 SHA512 7ec9f93d1bb8132dc143e320373c0ffab2c3e4a9da4e449ce7c6e9b3aada5a30933d3bccbca4d2ea0ef5e72ef5593427756e06c03a97940edf74bac37f2fd08b WHIRLPOOL 186720e1cb5c9392343f9c8e569e35dc5c7a5be5d2067770555423667d4dc8e543e68c4dd7d4a3e5fac4a42b5bca66f18bc723441dea64d04e8f135cecc3029a
+DIST cracklib-2.9.1.tar.gz 635123 SHA256 408905c2539a97dc8cbbb6d7cd2046cb5647a345b4bda399220d9471be16d156 SHA512 19b1d38dfcfce98893e6a63e4387a8da9da1eae109d9d84e0f84adabc0ee25fac930576011fb60de007f59f7dea2ee0bb01fd6d8607d4854b7de006ec07a4b2a WHIRLPOOL ff3a71cb81535dde5ad63f51f9c8d5807c91ff5394e8336bac69708357804b8efc7816b2cfe32529777f18e9ba50c22af054b8d5ccff3d4b837a92d85b64dc80
+DIST cracklib-2.9.4.tar.gz 622478 SHA256 f2a866b4b9808344228ea6d68b69e3ba9a8a99210e23dfd718d4b95c60be8958 SHA512 4c94af41d5734e737576221620236951c083f45a7a8061d22ec174c283b91bf64b781ee8dddb91f459f5008ca70f1adfe59c311f082a7a7fecd5214705512a63 WHIRLPOOL 2d9fe10dbc50a45ec3e295e7c5aee3e327f1d7728811c33693bafcffad833e953a4425c4aac7c2556b75aa84a76b1a81bbfd2210d47555086cc4ddd5fd1f7eee
+DIST cracklib-2.9.5.tar.gz 622499 SHA256 59ab0138bc8cf90cccb8509b6969a024d5e58d2d02bcbdccbb9ba9b88be3fa33 SHA512 2362419deb9024b8d761f8349210a25c3182568bb4a4ecf59b1f221ad0c9bd6049fb26eafe853d55b50dcca5f66c695d58b432c70d14054db704ca28a68aa2e2 WHIRLPOOL 72210f50de508fcc70566aabce303c0d1cb09da71385808a2c50808bf8a894b16210633b492f6cd702af51024da0a5850a36e9b5a7542a1313b93bd350f53c35
diff --git a/sys-libs/cracklib/cracklib-2.8.22.ebuild b/sys-libs/cracklib/cracklib-2.8.22.ebuild
new file mode 100644
index 000000000000..b11162e6d49f
--- /dev/null
+++ b/sys-libs/cracklib/cracklib-2.8.22.ebuild
@@ -0,0 +1,105 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+PYTHON_DEPEND="python? 2"
+SUPPORT_PYTHON_ABIS="1"
+RESTRICT_PYTHON_ABIS="3.* 2.7-pypy-* *-jython"
+
+inherit eutils distutils libtool toolchain-funcs
+
+MY_P=${P/_}
+DESCRIPTION="Password Checking Library"
+HOMEPAGE="http://sourceforge.net/projects/cracklib"
+SRC_URI="mirror://sourceforge/cracklib/${MY_P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x86-macos ~m68k-mint"
+IUSE="build nls python static-libs zlib"
+
+RDEPEND="zlib? ( sys-libs/zlib )"
+DEPEND="${RDEPEND}
+ python? ( dev-python/setuptools )"
+
+S=${WORKDIR}/${MY_P}
+
+PYTHON_MODNAME="cracklib.py"
+do_python() {
+ use build && return 0
+ use python || return 0
+ case ${EBUILD_PHASE} in
+ prepare|configure|compile|install)
+ pushd python > /dev/null || die
+ distutils_src_${EBUILD_PHASE}
+ popd > /dev/null
+ ;;
+ *)
+ distutils_pkg_${EBUILD_PHASE}
+ ;;
+ esac
+}
+
+pkg_setup() {
+ # workaround #195017
+ if has unmerge-orphans ${FEATURES} && has_version "<${CATEGORY}/${PN}-2.8.10" ; then
+ eerror "Upgrade path is broken with FEATURES=unmerge-orphans"
+ eerror "Please run: FEATURES=-unmerge-orphans emerge cracklib"
+ die "Please run: FEATURES=-unmerge-orphans emerge cracklib"
+ fi
+
+ if use !build; then
+ use python && python_pkg_setup
+ fi
+}
+
+src_prepare() {
+ elibtoolize #269003
+ do_python
+}
+
+src_configure() {
+ export ac_cv_header_zlib_h=$(usex zlib)
+ export ac_cv_search_gzopen=$(usex zlib -lz no)
+ econf \
+ --with-default-dict='$(libdir)/cracklib_dict' \
+ --without-python \
+ $(use_enable nls) \
+ $(use_enable static-libs static)
+}
+
+src_compile() {
+ default
+ do_python
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die
+ use static-libs || find "${ED}"/usr -name libcrack.la -delete
+ rm -r "${ED}"/usr/share/cracklib
+
+ do_python
+
+ # move shared libs to /
+ gen_usr_ldscript -a crack
+
+ insinto /usr/share/dict
+ doins dicts/cracklib-small || die
+
+ dodoc AUTHORS ChangeLog NEWS README*
+}
+
+pkg_postinst() {
+ if [[ ${ROOT} == "/" ]] ; then
+ ebegin "Regenerating cracklib dictionary"
+ create-cracklib-dict "${EPREFIX}"/usr/share/dict/* > /dev/null
+ eend $?
+ fi
+
+ do_python
+}
+
+pkg_postrm() {
+ do_python
+}
diff --git a/sys-libs/cracklib/cracklib-2.9.1-r1.ebuild b/sys-libs/cracklib/cracklib-2.9.1-r1.ebuild
new file mode 100644
index 000000000000..f78b893766e4
--- /dev/null
+++ b/sys-libs/cracklib/cracklib-2.9.1-r1.ebuild
@@ -0,0 +1,106 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+PYTHON_COMPAT=( python2_7 )
+DISTUTILS_OPTIONAL=1
+
+inherit eutils distutils-r1 libtool multilib-minimal toolchain-funcs
+
+MY_P=${P/_}
+DESCRIPTION="Password Checking Library"
+HOMEPAGE="http://sourceforge.net/projects/cracklib"
+SRC_URI="mirror://sourceforge/cracklib/${MY_P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x86-macos ~m68k-mint"
+IUSE="nls python static-libs test zlib"
+
+RDEPEND="zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )"
+DEPEND="${RDEPEND}
+ python? (
+ dev-python/setuptools[${PYTHON_USEDEP}]
+ test? ( dev-python/nose[${PYTHON_USEDEP}] )
+ )"
+RDEPEND="${RDEPEND}
+ abi_x86_32? (
+ !<=app-emulation/emul-linux-x86-baselibs-20140508-r6
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ )"
+
+S=${WORKDIR}/${MY_P}
+
+do_python() {
+ multilib_is_native_abi || return 0
+ use python || return 0
+ pushd python > /dev/null || die
+ distutils-r1_src_${EBUILD_PHASE}
+ popd > /dev/null
+}
+
+pkg_setup() {
+ # workaround #195017
+ if has unmerge-orphans ${FEATURES} && has_version "<${CATEGORY}/${PN}-2.8.10" ; then
+ eerror "Upgrade path is broken with FEATURES=unmerge-orphans"
+ eerror "Please run: FEATURES=-unmerge-orphans emerge cracklib"
+ die "Please run: FEATURES=-unmerge-orphans emerge cracklib"
+ fi
+}
+
+src_prepare() {
+ elibtoolize #269003
+ epatch "${FILESDIR}"/cracklib-2.9.1-setup.py-srcdir.patch
+ do_python
+}
+
+multilib_src_configure() {
+ export ac_cv_header_zlib_h=$(usex zlib)
+ export ac_cv_search_gzopen=$(usex zlib -lz no)
+ # use /usr/lib so that the dictionary is shared between ABIs
+ ECONF_SOURCE=${S} \
+ econf \
+ --with-default-dict='/usr/lib/cracklib_dict' \
+ --without-python \
+ $(use_enable nls) \
+ $(use_enable static-libs static)
+}
+
+multilib_src_compile() {
+ default
+ do_python
+}
+
+multilib_src_test() {
+ do_python
+}
+
+python_test() {
+ nosetests -w "${S}"/python || die "Tests fail with ${EPYTHON}"
+}
+
+multilib_src_install() {
+ default
+ # move shared libs to /
+ multilib_is_native_abi && gen_usr_ldscript -a crack
+
+ do_python
+}
+
+multilib_src_install_all() {
+ einstalldocs
+ prune_libtool_files
+ rm -r "${ED}"/usr/share/cracklib
+
+ insinto /usr/share/dict
+ doins dicts/cracklib-small || die
+}
+
+pkg_postinst() {
+ if [[ ${ROOT} == "/" ]] ; then
+ ebegin "Regenerating cracklib dictionary"
+ create-cracklib-dict "${EPREFIX}"/usr/share/dict/* > /dev/null
+ eend $?
+ fi
+}
diff --git a/sys-libs/cracklib/cracklib-2.9.4.ebuild b/sys-libs/cracklib/cracklib-2.9.4.ebuild
new file mode 100644
index 000000000000..519afb7cc021
--- /dev/null
+++ b/sys-libs/cracklib/cracklib-2.9.4.ebuild
@@ -0,0 +1,105 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+PYTHON_COMPAT=( python2_7 )
+DISTUTILS_OPTIONAL=1
+
+inherit eutils distutils-r1 libtool multilib-minimal toolchain-funcs
+
+MY_P=${P/_}
+DESCRIPTION="Password Checking Library"
+HOMEPAGE="http://sourceforge.net/projects/cracklib"
+SRC_URI="mirror://sourceforge/cracklib/${MY_P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x86-macos ~m68k-mint"
+IUSE="nls python static-libs test zlib"
+
+RDEPEND="zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )"
+DEPEND="${RDEPEND}
+ python? (
+ dev-python/setuptools[${PYTHON_USEDEP}]
+ test? ( dev-python/nose[${PYTHON_USEDEP}] )
+ )"
+RDEPEND="${RDEPEND}
+ abi_x86_32? (
+ !<=app-emulation/emul-linux-x86-baselibs-20140508-r6
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ )"
+
+S=${WORKDIR}/${MY_P}
+
+do_python() {
+ multilib_is_native_abi || return 0
+ use python || return 0
+ pushd python > /dev/null || die
+ distutils-r1_src_${EBUILD_PHASE}
+ popd > /dev/null
+}
+
+pkg_setup() {
+ # workaround #195017
+ if has unmerge-orphans ${FEATURES} && has_version "<${CATEGORY}/${PN}-2.8.10" ; then
+ eerror "Upgrade path is broken with FEATURES=unmerge-orphans"
+ eerror "Please run: FEATURES=-unmerge-orphans emerge cracklib"
+ die "Please run: FEATURES=-unmerge-orphans emerge cracklib"
+ fi
+}
+
+src_prepare() {
+ elibtoolize #269003
+ do_python
+}
+
+multilib_src_configure() {
+ export ac_cv_header_zlib_h=$(usex zlib)
+ export ac_cv_search_gzopen=$(usex zlib -lz no)
+ # use /usr/lib so that the dictionary is shared between ABIs
+ ECONF_SOURCE=${S} \
+ econf \
+ --with-default-dict='/usr/lib/cracklib_dict' \
+ --without-python \
+ $(use_enable nls) \
+ $(use_enable static-libs static)
+}
+
+multilib_src_compile() {
+ default
+ do_python
+}
+
+multilib_src_test() {
+ do_python
+}
+
+python_test() {
+ nosetests -w "${S}"/python || die "Tests fail with ${EPYTHON}"
+}
+
+multilib_src_install() {
+ default
+ # move shared libs to /
+ multilib_is_native_abi && gen_usr_ldscript -a crack
+
+ do_python
+}
+
+multilib_src_install_all() {
+ einstalldocs
+ prune_libtool_files
+ rm -r "${ED}"/usr/share/cracklib
+
+ insinto /usr/share/dict
+ doins dicts/cracklib-small || die
+}
+
+pkg_postinst() {
+ if [[ ${ROOT} == "/" ]] ; then
+ ebegin "Regenerating cracklib dictionary"
+ create-cracklib-dict "${EPREFIX}"/usr/share/dict/* > /dev/null
+ eend $?
+ fi
+}
diff --git a/sys-libs/cracklib/cracklib-2.9.5.ebuild b/sys-libs/cracklib/cracklib-2.9.5.ebuild
new file mode 100644
index 000000000000..519afb7cc021
--- /dev/null
+++ b/sys-libs/cracklib/cracklib-2.9.5.ebuild
@@ -0,0 +1,105 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+PYTHON_COMPAT=( python2_7 )
+DISTUTILS_OPTIONAL=1
+
+inherit eutils distutils-r1 libtool multilib-minimal toolchain-funcs
+
+MY_P=${P/_}
+DESCRIPTION="Password Checking Library"
+HOMEPAGE="http://sourceforge.net/projects/cracklib"
+SRC_URI="mirror://sourceforge/cracklib/${MY_P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x86-macos ~m68k-mint"
+IUSE="nls python static-libs test zlib"
+
+RDEPEND="zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )"
+DEPEND="${RDEPEND}
+ python? (
+ dev-python/setuptools[${PYTHON_USEDEP}]
+ test? ( dev-python/nose[${PYTHON_USEDEP}] )
+ )"
+RDEPEND="${RDEPEND}
+ abi_x86_32? (
+ !<=app-emulation/emul-linux-x86-baselibs-20140508-r6
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ )"
+
+S=${WORKDIR}/${MY_P}
+
+do_python() {
+ multilib_is_native_abi || return 0
+ use python || return 0
+ pushd python > /dev/null || die
+ distutils-r1_src_${EBUILD_PHASE}
+ popd > /dev/null
+}
+
+pkg_setup() {
+ # workaround #195017
+ if has unmerge-orphans ${FEATURES} && has_version "<${CATEGORY}/${PN}-2.8.10" ; then
+ eerror "Upgrade path is broken with FEATURES=unmerge-orphans"
+ eerror "Please run: FEATURES=-unmerge-orphans emerge cracklib"
+ die "Please run: FEATURES=-unmerge-orphans emerge cracklib"
+ fi
+}
+
+src_prepare() {
+ elibtoolize #269003
+ do_python
+}
+
+multilib_src_configure() {
+ export ac_cv_header_zlib_h=$(usex zlib)
+ export ac_cv_search_gzopen=$(usex zlib -lz no)
+ # use /usr/lib so that the dictionary is shared between ABIs
+ ECONF_SOURCE=${S} \
+ econf \
+ --with-default-dict='/usr/lib/cracklib_dict' \
+ --without-python \
+ $(use_enable nls) \
+ $(use_enable static-libs static)
+}
+
+multilib_src_compile() {
+ default
+ do_python
+}
+
+multilib_src_test() {
+ do_python
+}
+
+python_test() {
+ nosetests -w "${S}"/python || die "Tests fail with ${EPYTHON}"
+}
+
+multilib_src_install() {
+ default
+ # move shared libs to /
+ multilib_is_native_abi && gen_usr_ldscript -a crack
+
+ do_python
+}
+
+multilib_src_install_all() {
+ einstalldocs
+ prune_libtool_files
+ rm -r "${ED}"/usr/share/cracklib
+
+ insinto /usr/share/dict
+ doins dicts/cracklib-small || die
+}
+
+pkg_postinst() {
+ if [[ ${ROOT} == "/" ]] ; then
+ ebegin "Regenerating cracklib dictionary"
+ create-cracklib-dict "${EPREFIX}"/usr/share/dict/* > /dev/null
+ eend $?
+ fi
+}
diff --git a/sys-libs/cracklib/files/cracklib-2.9.1-setup.py-srcdir.patch b/sys-libs/cracklib/files/cracklib-2.9.1-setup.py-srcdir.patch
new file mode 100644
index 000000000000..ac69b9f60581
--- /dev/null
+++ b/sys-libs/cracklib/files/cracklib-2.9.1-setup.py-srcdir.patch
@@ -0,0 +1,35 @@
+From 70909dd3d30a13bb0406ca76feea49f05b8b978d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Thu, 29 May 2014 23:57:32 +0200
+Subject: [PATCH] Fix paths in setup.py to support out-of-source builds.
+
+---
+ python/setup.py.in | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/python/setup.py.in b/python/setup.py.in
+index 4a258a0..4c70de4 100644
+--- a/python/setup.py.in
++++ b/python/setup.py.in
+@@ -23,8 +23,8 @@ from setuptools import setup, Extension, find_packages
+
+ extensions = [
+ Extension("_cracklib",
+- ["_cracklib.c"],
+- include_dirs = ["@top_builddir@/lib"],
++ ["@srcdir@/_cracklib.c"],
++ include_dirs = ["@top_srcdir@/lib"],
+ libraries = ["crack"],
+ library_dirs = ["@top_builddir@/lib/.libs"]),
+ ]
+@@ -43,6 +43,7 @@ convenience functions.
+ url="http://cracklib.sourceforge.net/",
+ license="GPLv2+",
+ py_modules=['cracklib', 'test_cracklib'],
++ package_dir={'': '@srcdir@'},
+ ext_modules=extensions,
+ zip_safe=False,
+ classifiers=[
+--
+2.0.0
+
diff --git a/sys-libs/cracklib/metadata.xml b/sys-libs/cracklib/metadata.xml
new file mode 100644
index 000000000000..42090b9cf925
--- /dev/null
+++ b/sys-libs/cracklib/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>base-system</herd>
+ <upstream>
+ <remote-id type="sourceforge">cracklib</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-libs/csu/Manifest b/sys-libs/csu/Manifest
new file mode 100644
index 000000000000..b27b010f8e75
--- /dev/null
+++ b/sys-libs/csu/Manifest
@@ -0,0 +1,2 @@
+DIST Csu-79.tar.gz 12719 SHA256 d052e1daa1f5de7fc02e7e7cb8b79ee2eeaad0f321c0a70bea4fc7217e232ec2 SHA512 1d47cce40d400241bdd0a4c24e332f999cb7ae08bd43b08b88e9b5fd5a0a53c9752816b0e07c5b6ffb78f7b5bc24f45986c6a50c661bc5cdd15fee5e465da1bb WHIRLPOOL 74df2f9a9c42bc346f165d8db1d9b3862e2eab89f5b7112e73e27c41419258c0f9c203d7c13acbe43bf2f6c253d12d0f37139d98188773b807419f6bd6bdf4cc
+DIST Csu-85.tar.gz 13376 SHA256 f2291d7548da854322acf194a875609bfae96c2481738cf6fd1d89eea9ae057a SHA512 3cfeb7d37630fc9d6607da018b9ac1aeb3f41a4c190a67e7dc242ae48e7abd0026e25055b9459f2f187d3bb25644f516f079d1b2e943e8cb4cc6c132ad594467 WHIRLPOOL 96552600235fa7e098658e16e2afc1f95ead6bb705703faa6b8f792ec6bcacf9c5c7da5de729d98f83eae337d086750b536f7c1ee0f1a2d5223b53a18d5143f4
diff --git a/sys-libs/csu/csu-79.ebuild b/sys-libs/csu/csu-79.ebuild
new file mode 100644
index 000000000000..728641a8e210
--- /dev/null
+++ b/sys-libs/csu/csu-79.ebuild
@@ -0,0 +1,45 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=3
+
+DESCRIPTION="Darwin Csu (crt1.o) - Mac OS X 10.6.6 to 10.9.5 versions"
+HOMEPAGE="http://www.opensource.apple.com/"
+SRC_URI="http://www.opensource.apple.com/tarballs/Csu/Csu-${PV}.tar.gz"
+
+LICENSE="APSL-2"
+
+SLOT="0"
+KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
+IUSE=""
+S=${WORKDIR}/Csu-${PV}
+
+src_prepare() {
+ # since we don't have crt0, we can't build it either
+ sed -i \
+ -e 's:$(SYMROOT)/crt0.o::' \
+ -e '/LOCLIBDIR)\/crt0.o/d' \
+ Makefile || die
+
+ if [[ ${CHOST} == powerpc-*-darwin* && ${CHOST##*-darwin} -le 8 ]] ; then
+ # *must not* be compiled with -Os on PPC because that will
+ # optimize out _pointer_to__darwin_gcc3_preregister_frame_info
+ # which causes linker errors for large programs because the
+ # jump to ___darwin_gcc3_preregister_frame_info gets to be more
+ # than 16MB away
+ sed -i -e "s, -Os , -O ,g" Makefile || die
+ fi
+}
+
+src_compile() {
+ emake USRLIBDIR="${EPREFIX}"/lib || die
+}
+
+src_install() {
+ emake -j1 \
+ USRLIBDIR="${EPREFIX}"/lib \
+ LOCLIBDIR="${EPREFIX}"/lib \
+ DSTROOT="${D}" \
+ install || die
+}
diff --git a/sys-libs/csu/csu-85.ebuild b/sys-libs/csu/csu-85.ebuild
new file mode 100644
index 000000000000..e99971289b00
--- /dev/null
+++ b/sys-libs/csu/csu-85.ebuild
@@ -0,0 +1,52 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit toolchain-funcs eutils
+
+DESCRIPTION="Darwin Csu (crt1.o) - Mac OS X 10.10 version"
+HOMEPAGE="http://www.opensource.apple.com/"
+SRC_URI="http://www.opensource.apple.com/tarballs/Csu/Csu-${PV}.tar.gz"
+
+LICENSE="APSL-2"
+
+SLOT="0"
+KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
+IUSE=""
+S=${WORKDIR}/Csu-${PV}
+
+src_prepare() {
+ # since we don't have crt0, we can't build it either
+ sed -i \
+ -e 's:$(SYMROOT)/crt0.o::' \
+ -e '/LOCLIBDIR)\/crt0.o/d' \
+ -e '/^CC = /d' \
+ Makefile || die
+
+ # only require Availability.h for arm, bugs #538602, #539964
+ epatch "${FILESDIR}"/${P}-arm-availability.patch
+
+ if [[ ${CHOST} == powerpc* ]] ; then
+ # *must not* be compiled with -Os on PPC because that
+ # will optimize out
+ # _pointer_to__darwin_gcc3_preregister_frame_info which
+ # causes linker errors for large programs because the
+ # jump to ___darwin_gcc3_preregister_frame_info gets to
+ # be more than 16MB away
+ sed -i -e "s, -Os , -O ,g" Makefile || die
+ fi
+}
+
+src_compile() {
+ emake USRLIBDIR="${EPREFIX}"/lib || die
+}
+
+src_install() {
+ emake -j1 \
+ USRLIBDIR="${EPREFIX}"/lib \
+ LOCLIBDIR="${EPREFIX}"/lib \
+ DSTROOT="${D}" \
+ install || die
+}
diff --git a/sys-libs/csu/files/csu-85-arm-availability.patch b/sys-libs/csu/files/csu-85-arm-availability.patch
new file mode 100644
index 000000000000..6d3f3cf42b06
--- /dev/null
+++ b/sys-libs/csu/files/csu-85-arm-availability.patch
@@ -0,0 +1,18 @@
+Guard inclusion of Availability.h so that it only happens on arm where it's
+actuallty used so it doesn't cause failures on old OS X where Availability.h
+doesn't exist yet.
+
+Michael Weiser <michael@weiser.dinsnail.net>
+
+--- Csu-85/start.s.orig 2013-10-09 01:11:47.000000000 +0200
++++ Csu-85/start.s 2015-02-11 20:34:04.000000000 +0100
+@@ -22,7 +22,9 @@
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
++#ifdef __arm__
+ #include <Availability.h>
++#endif
+
+ #if __ppc__ && __DYNAMIC__
+ //
diff --git a/sys-libs/csu/metadata.xml b/sys-libs/csu/metadata.xml
new file mode 100644
index 000000000000..f737f232e3bf
--- /dev/null
+++ b/sys-libs/csu/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>prefix</herd>
+</pkgmetadata>
diff --git a/sys-libs/db/Manifest b/sys-libs/db/Manifest
new file mode 100644
index 000000000000..838115ec6b76
--- /dev/null
+++ b/sys-libs/db/Manifest
@@ -0,0 +1,38 @@
+DIST db-1.85-r3.1.patch.bz2 14641 SHA256 88e3095b191fe425d0192d052595ab838ad4ef6324aac0a9e338fd6df7ae40d4 SHA512 32b1810515476758ece7415f241378460a4051bf5ee23fb464748f84a90a56ff2c5119ed93028114d64f1b1691b1c694c2301ff825edd89cdee90a870a68b6f4 WHIRLPOOL 3c3437cd4a6294c2ca6db3b6522c4999d5efd9c1807b499b72bba7534c658349bd7f889912b0dbc4bc017fcc5f6d2062ec112ebf044673802bc0d9476ee26dfb
+DIST db-3.2.9.tar.gz 2085238 SHA256 3eccaec87bca4ca0f5728cf4579650da9d12e331187f1e98321e5c9e9e04b108 SHA512 5f07b27ae0cbd2832e5db9473cd4f2d4aebeee25ed8245ebd2c297a576571635ca5cf75e63e0967b1e90978128a5b6f5d8112559c56927d5bc5eb0d9fd3a2e95 WHIRLPOOL 248641e75420fc353d3ace86b3c65ee8354b073e2dddc7d71c1d2ea4681d81306255077dd7ed322a2b5ad8b87d356fa5aba864e5f24dc956133d563e2bba96bd
+DIST db-4.2.52.tar.gz 4073147 SHA256 72f581d8b91da900434629886d1d1c6ea8b9d2a9329368c3b875e7cd556b6a0e SHA512 47a4e1353fe4f5c2160952a8f7a09b73fdf2dfcd222a8214e12630cec3139a624907bba83a06f10f8492b4dce328a979e9155ee049b9a88798edaca62cfe60d1 WHIRLPOOL 409df946378054ccca9e5f27980f28da410f9dad9ffa7acaf092725779897fe89a2ac7a4add4a7974271e1d82bc9255681fb1b6cde94782feae86b7f73f8e8f7
+DIST db-4.3.29.tar.gz 6103264 SHA256 db3e762d819f9a31bc4ebf5ecada53e9787aeb26fc92fa6064b2ba57df806af4 SHA512 93d36c040b25739b92c52504e117a9c7f4b671463d61d00029e70d0bc8171311f5d04211f7d966b8a9ef8c2a85a5ebe8cc55e4469c3c7c0e468caa4221f691fc WHIRLPOOL 39bdfd19561d676b4feebf8ccc64dea29c783601613e2cf470e050fd3a15b626937243538fe109b1816c936a792ed0014eb5dd5a410699b39413f671dc04f741
+DIST db-4.4.20-20060110-rpc_server-java.tar.gz 158976 SHA256 a1bbc35c4ac3ce1c13de695dd2870cf8bd0f5030a19d4531c1fbf9c95e5fcc78 SHA512 d1f04fe512baa0e5c8a11d765cb9040943ab70258f7d07fbaf579b3442c43ca0dfee56267db7543a71abbbd2f056b80fb5f9d2d8bb83b0f5e5ccebf273280e6f WHIRLPOOL 2e895dd68df9a9ef35a448754d1d49b12a782c53eb7ad7bf7f4f13e42ea7a09676ddeada67bebedd0ae673b454c530d4cbb3ba234ee96bd0df5e11e201df32de
+DIST db-4.4.20.tar.gz 7952742 SHA256 298ab78801f7502016aa2db033b65fab46f323533bdc08610d3dabd910d63b79 SHA512 dea85d0aa3cea0539de2f9819e1ebc8a8aba887614bbbd1710a69dbf2cef3fe262414b8b03deb7325c8bfeb3bbbdc3d5ba35377a73aac5e3c63aa1082d3a579e WHIRLPOOL cf597b0fd688422b0a7828cf101518e5e3bb197e7a8f42e28056745a549da820a9d921b179a2afe6bc698ee0e5166771d636eee2949d62eb649f581e430866dc
+DIST db-4.5.20.tar.gz 9281894 SHA256 f52cd5cea899823dd200d56556f70b33c55e48a33bb7b65ee128968dc10ca82d SHA512 c34907a53323158627971f464c32b9a5b00aff0fa779c67117826ebeea86a4731e272a5dc6dc5ae32f16284ff15c79d93050273795381acaaefd48e18dc2d612 WHIRLPOOL b0fbf20befbcaa1dc4c6c8fa1f190f17cce9d8034d8a3c96c296ec3212e37aaa11ce6d35cdf9dbb64d266b443453d967eb9da530d6c6c9ae8b9bd0ee08c3d352
+DIST db-4.6.21.tar.gz 11881885 SHA256 53ea9c9f03746a0aa415e6706e9c6da18ca18148f20ad1465b182411a7985e21 SHA512 8118218e2eaf9d22e445e551ef184f4610406b81f9257794d14f637d9d12a51a007166b48bf820140c5be287ef61d22a62a16f7702f0d29f385108c40b11ce43 WHIRLPOOL f6011aa40be091a8bbd52981d99d1e41e336bc64b6b89ca69ce0e9d97a6650c2e10d363ea738d3d47b656f290fdaeb8f1a2ed016967182228eb6509253f561b3
+DIST db-4.7.25.tar.gz 13124129 SHA256 f14fd96dd38915a1d63dcb94a63fbb8092334ceba6b5060760427096f631263e SHA512 3a0b2bcb210192c7a37b082fab47a8a32da5e7e91058e18be8fb844c8780088cbd4de6234257750505d5a05864517be03afdad95cb1c549f9743386d6129554b WHIRLPOOL 71ef3aefab84d1ccd782aa948c03bf814eef45b8352837b5d797f781a94652c72f45adf2a114014a78693d27f8ad87c6cd22237b154dc4a8452eba72ee5b2c16
+DIST db-4.8.30.tar.gz 22887305 SHA256 e0491a07cdb21fb9aa82773bbbedaeb7639cbd0e7f96147ab46141e0045db72a SHA512 d1a3c52b0ab54ae3fd6792e6396c9f74d25f36b2eb9e853b67ef9c872508a58c784c7818108d06d184f59601b70cc877916e67dfea6f0ee1ca2b07468c1041f1 WHIRLPOOL 4a9c8b4ca4ff3c94d2c01001911ea7aff824ddff971f99c802eee642bd78882456dca1347bb1ce7add42f402b9bdc3b099775f8b74e81496d1c0ee2bd131eaf3
+DIST db-5.1.29.tar.gz 32188074 SHA256 a943cb4920e62df71de1069ddca486d408f6d7a09ddbbb5637afe7a229389182 SHA512 b3487161cc09dd0aee6117d685d0bc0a58854cf5e96f9e778969a51d3a61b66f8e007b76e584e4ef73f84e07d4418b89c2f6697e34c1ad4072609b11b7b4c5b0 WHIRLPOOL c2c5e335a8ed85f9dd947eb8225148c9633d21f5e17d321a6938b50d4bf061e735563cdbefb8c8aa457923ef80e778f95ad80aba4a92a381432ecf52c2a25353
+DIST db-5.3.28.tar.gz 35090431 SHA256 e0a992d740709892e81f9d93f06daf305cf73fb81b545afe72478043172c3628 SHA512 e91bbe550fc147a8be7e69ade86fdb7066453814971b2b0223f7d17712bd029a8eff5b2b6b238042ff6ec1ffa6879d44cb95c5645a922fee305c26c3eeaee090 WHIRLPOOL ad9042c4509ece1cae42ade4734f69d59a9ec946a85bd486063a7e8f9fa1ae3f925b71f0475fef05a27d33f695ef82ffd06fbaadbd7dc5bfaa77a8caacf9d1dc
+DIST db-6.0.30.tar.gz 36584356 SHA256 608e4b1cf390e9bf54c0ef00c5bd9ca76d36e2261b9f4d33d54516f3f6a20fd2 SHA512 ea249c59dba18cad391f523840028ba8ef962c32f2c7470942d52f9c07f18ba9fdf964dcd545cb7f2d6c66b91924a0ba1478af1d8f81f0dcbbf94c97ac515cf9 WHIRLPOOL 6784730d250dd480bacf78e966c6acb2fb3ca2c3989668e9440a0a60376b009850b2b48fc35f47e3964b175e78501d18b1c3e3b265831165083fe2dd04a46eb3
+DIST db-6.0.35.tar.gz 36532251 SHA256 24421affa8ae436fe427ae4f5f2d1634da83d3d55a5ad6354a98eeedb825de55 SHA512 002db1553def44efa715095b04b2bac2de7450cdc7142586d1d8b5d8ce79ee5e98f824b3bd276cd586ca932dc51ed35a9ffbed95b2b9847264f262cfa092479d WHIRLPOOL ebbbe7dd0969a36d06c8cc5618a0f61334396b38671b9b1c2523e3d1d3ba687903242acd23999be3efec45e1ea6b9c7f0f9f5acbb54d8d1dc48bba51d196c487
+DIST db-6.1.26.tar.gz 37495772 SHA256 dd1417af5443f326ee3998e40986c3c60e2a7cfb5bfa25177ef7cadb2afb13a6 SHA512 2590ee3d9e30e6eaeb350edbc2fa7400582c0b520177fe0a3a57a966573268e18ad10b1dc6dee3fb1be9c93ac6f96f848c120793eaf873562464edd125cff4d4 WHIRLPOOL 9aad6c2ec058d332185c630904dca766ca9f9c017c8f6216a4363f007fced3b7cf1b91d76134fa676780f6f8e37966bdea75845deb5cb2dff8f4b432e8068f5f
+DIST db.1.85.tar.gz 270953 SHA256 4220d4ddeb77fb57ba2f37c1aa105d561d3ef85a6fb89c79c3edd735d0e193c6 SHA512 03bf3a2b0947efdca4e38719542e96378b5eeb57da64d5030dd23ab710773c1826f1c867032d0bea658b7fdd8272db253e97bbc490d198b9437025ffdf9e880e WHIRLPOOL 802346b9fc133f6c9316e987352e8bd8e12792b30b0eae9b4e2b3629c9bc8385ab12244dead428bb824945aab383cd4801de3fc705667797bdf6159066ed1352
+DIST patch.3.2.9.1 2139 SHA256 6d89a42ee0be9e47b3e8a42981c65266a556de84bc6281edcf0f977f52547798 SHA512 f410c43ea4af28a39d8ea47f774d38b53bf1183a34abfcf1f27e253eb61b42f4b5e9f0a3a500e174eb796ea342e6dd50a8bb95ff3eb8ee188461489cc994b8f9 WHIRLPOOL 3a879d5306403739465550ade1fbf53ac62b832fbdf507a204fef13949bc7be9c35ddd972834d3ca74bf17c421791011200556dffd95265eb64849f1d7b647ec
+DIST patch.3.2.9.2 495 SHA256 61db874796fe8789b0045f456285b27c5b8b7b8902a5e342a115456015716d0e SHA512 cc75fef11a641d480beaa2b62201177c72d10c4eb20376b5f15769db6e9e1a0da41c0365d79772af19b4cacdaa9f91dad049c735de9f95b98dcfc4f0b611b557 WHIRLPOOL 1362c32dc16875a97b451ff52415fe4b9e9d37b256a92c7e86c14a52431937352ae55ecee4361459e9036b9bea238c205a8f0d4406ac7e47387a8cda22906879
+DIST patch.4.2.52.1 988 SHA256 98b7580916459ee931b9c7e06dcb9da980732672fe0811714933f366ad97dfa5 SHA512 67b894678503dc394e50b7c6a875ebbd996d6f78acd21858c04ba2cc4aba118f527aa3aae0793cff4e44bcb17b13fb1eb6a3d895e94cb97270d9759be1bb4bdb WHIRLPOOL eb0f038e0be19473ae938afec57aab061ff2e6ef1a5bd55891ab50000889a5e7b8e20220168427fb5edea550e3d852460dfc90ecac0b9c4ca3cb7c95d49621df
+DIST patch.4.2.52.2 1433 SHA256 c9b132bcc8f1c12e03baaf47abd3801f2adf24ffbd56f35a27617fec12654f32 SHA512 93c9463e2a795049473a2799186642185b7e2f94c51efa0412031d134088d129ebcf07e6a5f309d6cb37d9d282d8168276305d7420fb4cff6d7acc38a6ba4f00 WHIRLPOOL 093aba1ce3ecdc72fae6e2050fe1436a8da49ed59aedf17e4f6e5e3a87c860ce6728967a32b0281c703ded4769e1f888a14b6a8806ec48b4fb787155ee68364a
+DIST patch.4.2.52.3 8672 SHA256 ca5245d2e1c7a40df5ec57cbabee8bf0106292c69a37eb0ca275d1aa59061907 SHA512 234bd96b93aec826c97314b41c8b9231c55598213ee8437a6df7efea44e6c1e8e4844db8214a9468d27bae9a588b028c765747493b5d169235e3d06d0cf107b4 WHIRLPOOL c52417393f47e4028472bbf64ac20d799f2d5651077ed2252459ef6aed80a8d04bf2262d4fd35fe8ebf80d7a8604b44214516375800662ca17d6148bb339def0
+DIST patch.4.2.52.4 1311 SHA256 c15c82071c02ce1a10024c572e2e9fd72006089007141a01fdd37b889411b973 SHA512 e2632944d82f5b6dcbbdfc237bdc37d5db736acd0284edfdb51fc0f3a9ca4fc6bcdb412bab325e62fc30d690f6963dfe53e6120cdda65dc403eff89d3a931287 WHIRLPOOL ac6cebc2a007bced6140519bdc2091335f1a824845310b7bc5c8a965d672818ca7d31894ddc6357b40c016b73a14f19d22b583a9b912e1b7a3b000f652ee1d36
+DIST patch.4.2.52.5 839 SHA256 242f1a9c3efdd61a2b738c12617175849dbc73df6a2bf7cff61c814b13905e06 SHA512 5457bc4e433c8f12f34a764fcec1dfc9e832f960f518b21bd9116ec1b1130d9ad12373553e224d844e2b2de254470daf142120ff6d3125683a57f14a42a8e879 WHIRLPOOL ce7c6e3c85182d8eac99468d6a05e0ea0aa09927b7d0a3522706c5806eb8f5e7dfdd5b8724307163861160682e3e9bcf390e547f8a14e15663410997142721b1
+DIST patch.4.3.29.1 835 SHA256 6fbda9c0554cfe3d281161b288f779e7cf2c814f311c69e1c6309b6f97d75931 SHA512 c3dda4de68bff744dac5c96d1533032b2c8e8e0945f1a126b8aacdda322e05d1ec2e364eb7432ea1fb7366424ce155a9e58f84b9bee8e1ab4dd05a3313bcd8f7 WHIRLPOOL e05c4e52c56299a434c8e7259386c84f33f07dca0286c07e8df95cdf5a612df55055c8607ee5e624b59d76c7d988ce01ea03c1b6fb554119eab4f9faeb27cc80
+DIST patch.4.4.20.1 867 SHA256 4eeb18450b88703282251c386405bf7c9efa053a42d1dda97603ee8039ee5869 SHA512 0fd501d219eb3de94c59e7b526c5031bba5dcc7dea4174545db5d688f33a5b4324aadd71e0e4eca3781592da0e90c1481c3b2d8f74612dfdff651c18d10eb2d7 WHIRLPOOL db6c05c1ab2582a55cd6c08dbdb2729ff539b71ac96728509ab58d749ed36dd8dd8f38ab3d15ef8409d66935811d1fb1caf7050856d2d1d1c554191aea7ca2cc
+DIST patch.4.4.20.2 721 SHA256 45949e288482736bbc27bd62c854a99fad4b3e55103897eafd62bce1d5629bbc SHA512 4c497ce01c740c9c32b3a74946638c21b619cf057bbc8acaef24cb9f8d55d0d020d4cbc7775cb0cf07113c44981f076316cea14573fa08b49bc6352770bf5de6 WHIRLPOOL 92fbd4744b769af310a1aa03f932e40e51e0da1a9331a7d60fab565e54388a1e639e8587cbf28897ebe9307b21f4c5d01da07e6a5510a73efa5249e38bc58fad
+DIST patch.4.4.20.3 1366 SHA256 ae54bb752a31655a1a945f12900b740fad397c3e2ddab792ecfd4660d3e6e236 SHA512 2b00acd823342083f0eaaf3b9659c811d05eebba67b39d9a9dbfa4a8fb56cded322e3f9028c57d83c75cb949a79f705cd8584df1630dd8cd3ad22a54c83baa91 WHIRLPOOL f346d372f91ec2ba948f4ceea02aa88c1ea63285963f7681d4f83097336f106d24562092941f67d13ea53a2f4667471e275d12b3a174100a3e61ad81a5dd2846
+DIST patch.4.4.20.4 837 SHA256 7018f74e5184451809f6864172132472e91d95e2bec97ce6124afb67f0d65e59 SHA512 9aa464580cc1b402e594da56cdfc5e4d7c465f125b5f0cb312abbcdf72753bbf9ff14248657e0d354c93d7f1f89c7189e08060242c9a061033bb1016db640ceb WHIRLPOOL b0a2ef5f9fcb642accad061c9c0b8ae3b6713a63266ade97d851c3a84dd07642d80b91c4c601d4d6549697a83d1f02f42b30425221bb68a2a99ed42082f562ae
+DIST patch.4.5.20.1 984 SHA256 f0749a6780cd260fed20b6e961a0d354889ffe84505129d5c81925a4a4dcf6cb SHA512 a8aff6f594e5413436a7ae5afe48286b0d397a247b2cd466f192eb6b4870fc68353c1ec1d0209cdd06640e09090b3d84ddb0fb709f8478ff3823e244c7f6cd3e WHIRLPOOL 6fdb09551a04593af15c18530f0d984e5bc96e09b284525cab23c608c368067642fb7939ba81189c4150f12dcd054af91c097cd5fa779d1ee8166e5eb9031af7
+DIST patch.4.5.20.2 1752 SHA256 232a93565ab1bf34db10f7513b612867bb61e0c012def7f63715800a05d07e6a SHA512 b6af4b73e03b290595b6823e4d5c27da1b1bb5e66721ed5f0c6ecfec6595bcc56281340ec77fe6fb9432397adec0e292b31a5ee9d01870fb2955b8519017ffb7 WHIRLPOOL f99ea354e1ad91579057c1a4f82f3cf8c9c6ef38afc35dd47d7540358d13c5fe94c5f9d735501d909c501e9762cce18667b3534923feddca3f7f0dfabb2ddead
+DIST patch.4.6.21.1 2475 SHA256 d28c0723c465a2cf3ff2ddc5ed3c643b40c955c4e64d56580961f2fd799cbb53 SHA512 9fe4991a59e409cb7df5b507efed7e443c05199b41646ea2d5d52de29513c8d27c2f3bf154a0170f04e12eaee6a622b945ae0f9789c3faaeb2ccea55f7a1ca2d WHIRLPOOL 3110a7172e2596805b1527ff9b9aad37eccd761c8d46e78097c9c058c2f06438851e879dad1f169b207f65a50a3cce225db66e4da638c6b6dca685cda33bc641
+DIST patch.4.6.21.2 892 SHA256 9496a6cad44377ad1fab8c617f17c6f541e3423814663bfa81c3abb4001622d9 SHA512 e8570c0bee7522056f74cea73379fc13dae02258cffa78e540ee1c0433f368b3f856a21dc83017798120b3db7987c09e23af448153f0c024217df41a3e027347 WHIRLPOOL 370b636f0d1299ced97f70ba4d2f8ab8ab9a7e48106a5ce51fa48994bf4774b3f492d08d35369e128dc7975a07999af36b23ffbc741052071aa92162c4c8e93b
+DIST patch.4.6.21.3 1517 SHA256 3f531b18d88ce68ff080761cd62ef621444e675593aa23045d69121cd2c7c638 SHA512 4da65c9414bd04d2efddd7d7855235f1276d827258971bf3ae175c73ab9c1b57a4f089b27e22928d1ed869e4e14cfde2f5e7c6a31ddf63c8dc582d0a2384cfcf WHIRLPOOL 2bc3e1f8a70b9ff743f7007736798e23efbaf3fc0a65089325a02331d2eaa5f3ccec36327f2224a3cc22961304ba7c471af980b49cf756fa5f69cc9e39850872
+DIST patch.4.6.21.4 41501 SHA256 98bb4499dc7408c27a8a855330972a69abd3b29d0ff3820d6e1da790593a5bb7 SHA512 cb7819d7b1742f09af352e7563344abef27f1db1bbf04be049710abd26fb12eda142a08ff3cd3449b0a4a406141e39bbb0535f08bff051efbd261e7fbe5b53be WHIRLPOOL 58edfc65dce80bf2cc985c494ef635a65f70d96b1fc8ed3b62f01ae6bb4c283ab50035fc4dcf7b8925a3b85fafd2ad8f800f12c8f2678ecea21acfae52b37b51
+DIST patch.4.7.25.1 2072 SHA256 e91590af872705efc34414afb702abc630a75c55ba61570dca2216c783e0a83a SHA512 6f8618a3acc7ebc2839d2786d66c85904b8a9805319178175298239a9441550f1c61dda544d7994931e2aa412cdf5c209d8bb2f38207cebca341c556b97b9191 WHIRLPOOL 6723452283c9a487f86793d3580324736083d40424a81e7c5981cb125b44de23ea04e660a6336ff2b376c6fa85dfe97f49bef444b3333aade7232001deae7434
+DIST patch.4.7.25.2 2210 SHA256 05d6cde0ab1bfdb80394a7a88ff7233d0407f0b09103b0dd3791ebfccbbcca31 SHA512 d57746a527574966606955a8ad6b97742ff3979e85a0d087ae0c33b64b4fc2fd854f3ac145e2efc061b3479de5ee8172a02183cf54ada91fce3e331ab948ff18 WHIRLPOOL 63976fafb5a207f732534b501ccffbcd1d552e876b6379f3a1d3559c144c34d77eb5dea5dfb4ffa399a8bbc2f7cd66f2cd04a39cd3cf860f1ed1014083250383
+DIST patch.4.7.25.3 8442 SHA256 e5393cbfc8538cc21cc939d26ceca3e5782b4a4259a644884d91790e18ed39f3 SHA512 815560c45c9c8491fd58d881a0bc1d23a82a13298d4757ed7d2ae4df4b88b278b8e4d6063eb46349a8f6f11ca9aa5b8555f3ce01df025715c2579dfa36241238 WHIRLPOOL 30ffb9d93269543bf4463ac401f41b257c15dd19d301b8703a972d0a29973ccc86a155ac020f753d726c8998891ae349e47620fadc2cecd92cf36cfa09bff54c
+DIST patch.4.7.25.4 5647 SHA256 f55ea01a7905f8439d617717892e03d026c0ac34434c8fa16798fec75e5ba798 SHA512 df9810034773a9d0556cbd174e4f131f0461402bf3f476ae5da1deb92f3e2e9ef789687c5cc5c2df6385f6b14251e893be225ffacd895d71dfb305b9de32567e WHIRLPOOL 4cd00af410e23efbe43b6a8e8734294d829f19522e747c4f502fedc8c3c47adf821c6b9632149ee19ccf082f8067a3cbf20235e513558c397165ee25f2b5283a
diff --git a/sys-libs/db/db-1.85-r3.ebuild b/sys-libs/db/db-1.85-r3.ebuild
new file mode 100644
index 000000000000..dc6730300ba0
--- /dev/null
+++ b/sys-libs/db/db-1.85-r3.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils toolchain-funcs multilib multilib
+
+DESCRIPTION="old berk db kept around for really old packages"
+HOMEPAGE="http://www.oracle.com/technology/software/products/berkeley-db/db/index.html"
+SRC_URI="http://download.oracle.com/berkeley-db/db.${PV}.tar.gz
+ mirror://gentoo/${PF}.1.patch.bz2"
+# The patch used by Gentoo is from Fedora, and includes all 5 patches found on
+# the Oracle page, plus others.
+
+LICENSE="Sleepycat"
+SLOT="1"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
+IUSE=""
+
+DEPEND=""
+
+S=${WORKDIR}/db.${PV}
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epatch "${WORKDIR}"/${PF}.1.patch
+ epatch "${FILESDIR}"/${P}-gentoo-paths.patch
+ sed -i \
+ -e "s:@GENTOO_LIBDIR@:$(get_libdir):" \
+ PORT/linux/Makefile || die
+}
+
+src_compile() {
+ tc-export CC AR RANLIB
+ emake -C PORT/linux OORG="${CFLAGS}" || die
+}
+
+src_install() {
+ make -C PORT/linux install DESTDIR="${D}" || die
+
+ # binary compat symlink
+ dosym libdb1.so.2 /usr/$(get_libdir)/libdb.so.2 || die
+
+ dosed "s:<db.h>:<db1/db.h>:" /usr/include/db1/ndbm.h
+ dosym db1/ndbm.h /usr/include/ndbm.h
+
+ dodoc changelog README
+ newdoc hash/README README.hash
+ docinto ps
+ dodoc docs/*.ps
+}
diff --git a/sys-libs/db/db-3.2.9_p2.ebuild b/sys-libs/db/db-3.2.9_p2.ebuild
new file mode 100644
index 000000000000..06df0546aa1d
--- /dev/null
+++ b/sys-libs/db/db-3.2.9_p2.ebuild
@@ -0,0 +1,183 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils db multilib
+
+#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
+
+DESCRIPTION="Berkeley DB for transaction support in MySQL"
+HOMEPAGE="http://www.oracle.com/technology/software/products/berkeley-db/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="3"
+# This ebuild is to be the compatibility ebuild for when db4 is put
+# in the tree.
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
+IUSE="doc"
+
+DEPEND="${RDEPEND}
+ =sys-libs/db-1.85*"
+
+# This doesn't build without exceptions
+export CXXFLAGS="${CXXFLAGS/-fno-exceptions/-fexceptions}"
+
+S="${WORKDIR}/${MY_P}"
+
+src_unpack() {
+ unpack "${MY_P}".tar.gz
+
+ chmod -R ug+w *
+
+ cd "${WORKDIR}"/"${MY_P}"
+ for (( i=1 ; i<=${PATCHNO} ; i++ ))
+ do
+ epatch "${DISTDIR}"/patch."${MY_PV}"."${i}"
+ done
+
+ # Get db to link libdb* to correct dependencies ... for example if we use
+ # NPTL or NGPT, db detects usable mutexes, and should link against
+ # libpthread, but does not do so ...
+ # <azarah@gentoo.org> (23 Feb 2003)
+ epatch "${FILESDIR}"/${MY_P}-fix-dep-link.patch
+
+ # We should get dump185 to link against system db1 ..
+ # <azarah@gentoo.org> (23 Feb 2003)
+ mv "${S}"/dist/Makefile.in "${S}"/dist/Makefile.in.orig
+ sed -e 's:DB185INC=:DB185INC= -I/usr/include/db1:' \
+ -e 's:DB185LIB=:DB185LIB= -ldb1:' \
+ "${S}"/dist/Makefile.in.orig > "${S}"/dist/Makefile.in || die "Failed to sed"
+
+ epatch "${FILESDIR}"/${MY_P}-gcc43.patch
+
+ # Fix invalid .la files
+ cd "${WORKDIR}"/${MY_P}/dist
+ rm -f ltversion.sh
+ # remove config.guess else we have problems with gcc-3.2
+ rm -f config.guess
+ sed -i "s,\(-D_GNU_SOURCE\),\1 ${CFLAGS}," configure
+
+}
+
+src_compile() {
+ local conf=
+ local conf_shared=
+ local conf_static=
+
+ conf="${conf}
+ --host=${CHOST} \
+ --build=${CHOST} \
+ --enable-cxx \
+ --enable-compat185 \
+ --enable-dump185 \
+ --prefix=/usr"
+
+ # --enable-rpc DOES NOT BUILD
+ # Robin H. Johnson <robbat2@gentoo.org> (18 Oct 2003)
+
+ conf_shared="${conf_shared}
+ --enable-dynamic"
+
+ # TCL support is also broken
+ # Robin H. Johnson <robbat2@gentoo.org> (18 Oct 2003)
+ # conf_shared="${conf_shared}
+ # `use_enable tcl tcl`
+ # `use_with tcl tcl /usr/$(get_libdir)`"
+
+ # NOTE: we should not build both shared and static versions
+ # of the libraries in the same build root!
+
+ einfo "Configuring ${P} (static)..."
+ mkdir -p "${S}"/build-static
+ cd "${S}"/build-static
+ strip=/bin/true \
+ ECONF_SOURCE="${S}"/dist econf \
+ ${conf} ${conf_static} \
+ --libdir=/usr/$(get_libdir) \
+ --disable-shared \
+ --enable-static || die
+
+ einfo "Configuring ${P} (shared)..."
+ mkdir -p "${S}"/build-shared
+ cd "${S}"/build-shared
+ strip=/bin/true \
+ ECONF_SOURCE="${S}"/dist econf \
+ ${conf} ${conf_shared} \
+ --libdir=/usr/$(get_libdir) \
+ --disable-static \
+ --enable-shared || die
+
+ # Parallel make does not work
+ MAKEOPTS="${MAKEOPTS} -j1"
+ einfo "Building ${P} (static)..."
+ cd "${S}"/build-static
+ emake strip=/bin/true || die "Static build failed"
+ einfo "Building ${P} (shared)..."
+ cd "${S}"/build-shared
+ emake strip=/bin/true || die "Shared build failed"
+}
+
+src_install () {
+ cd "${S}"/build-shared
+ make libdb=libdb-3.2.a \
+ libcxx=libcxx_3.2.a \
+ prefix="${D}"/usr \
+ libdir="${D}"/usr/$(get_libdir) \
+ strip=/bin/true \
+ install || die
+
+ cd "${S}"/build-static
+ newlib.a libdb.a libdb-3.2.a || die "failed to package static libraries!"
+ newlib.a libdb_cxx.a libdb_cxx-3.2.a || die "failed to package static libraries!"
+
+ db_src_install_headerslot || die "db_src_install_headerslot failed!"
+
+ # this is now done in the db eclass, function db_fix_so and db_src_install_usrlibcleanup
+ #cd "${D}"/usr/lib
+ #ln -s libdb-3.2.so libdb.so.3
+
+ # For some reason, db.so's are *not* readable by group or others,
+ # resulting in no one but root being able to use them!!!
+ # This fixes it -- DR 15 Jun 2001
+ cd "${D}"/usr/$(get_libdir)
+ chmod go+rx *.so
+ # The .la's aren't readable either
+ chmod go+r *.la
+
+ cd "${S}"
+ dodoc README
+
+ db_src_install_doc || die "db_src_install_doc failed!"
+
+ db_src_install_usrbinslot || die "db_src_install_usrbinslot failed!"
+
+ db_src_install_usrlibcleanup || die "db_src_install_usrlibcleanup failed!"
+}
+
+pkg_postinst () {
+ db_fix_so
+}
+
+pkg_postrm () {
+ db_fix_so
+}
+
+src_test() {
+ if use test; then
+ eerror "We'd love to be able to test, but the testsuite is broken in the 3.2.9 series"
+ fi
+}
diff --git a/sys-libs/db/db-4.2.52_p5-r1.ebuild b/sys-libs/db/db-4.2.52_p5-r1.ebuild
new file mode 100644
index 000000000000..1ce4d55394f3
--- /dev/null
+++ b/sys-libs/db/db-4.2.52_p5-r1.ebuild
@@ -0,0 +1,166 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils db flag-o-matic java-pkg-opt-2 autotools multilib
+
+#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
+
+S="${WORKDIR}/${MY_P}/build_unix"
+DESCRIPTION="Oracle Berkeley DB"
+HOMEPAGE="http://www.oracle.com/technology/software/products/berkeley-db/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="4.2"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
+IUSE="tcl java doc cxx rpc"
+
+DEPEND="tcl? ( >=dev-lang/tcl-8.4 )
+ java? ( >=virtual/jdk-1.4 )"
+RDEPEND="tcl? ( dev-lang/tcl )
+ java? ( >=virtual/jre-1.4 )"
+
+src_unpack() {
+ unpack "${MY_P}".tar.gz
+ cd "${WORKDIR}"/"${MY_P}"
+ for (( i=1 ; i<=${PATCHNO} ; i++ ))
+ do
+ epatch "${DISTDIR}"/patch."${MY_PV}"."${i}"
+ done
+ epatch "${FILESDIR}"/"${PN}"-4.2.52_p2-TXN.patch
+ epatch "${FILESDIR}"/"${PN}"-"${SLOT}"-libtool.patch
+
+ # use the includes from the prefix
+ epatch "${FILESDIR}"/"${PN}"-"${SLOT}"-jni-check-prefix-first.patch
+ epatch "${FILESDIR}"/"${PN}"-"${SLOT}"-listen-to-java-options.patch
+ epatch "${FILESDIR}"/"${PN}"-4.0.14-fix-dep-link.patch
+
+ sed -e "/^DB_RELEASE_DATE=/s/%B %e, %Y/%Y-%m-%d/" -i dist/RELEASE
+
+ # 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}"/../dist/Makefile.in
+
+ # START of 4.5+earlier specific
+ # Upstream sucks, they normally concat these
+ cd "${S}"/../dist/aclocal
+ for i in *; do ln -s $i ${i%.ac}.m4 ; done ;
+ cd "${S}"/../dist/aclocal_java
+ for i in *; do ln -s $i ${i%.ac}.m4 ; done ;
+ # END of 4.5+earlier specific
+ cd "${S}"/../dist
+ rm -f aclocal/libtool.{m4,ac} aclocal.m4
+ sed -i \
+ -e '/AC_PROG_LIBTOOL$/aLT_OUTPUT' \
+ configure.ac
+ sed -i \
+ -e '/^AC_PATH_TOOL/s/ sh, missing_sh/ bash, missing_sh/' \
+ aclocal/programs.m4
+ AT_M4DIR="aclocal aclocal_java" eautoreconf
+ # Upstream sucks - they do autoconf and THEN replace the version variables.
+ . ./RELEASE
+ sed -i \
+ -e "s/__EDIT_DB_VERSION_MAJOR__/$DB_VERSION_MAJOR/g" \
+ -e "s/__EDIT_DB_VERSION_MINOR__/$DB_VERSION_MINOR/g" \
+ -e "s/__EDIT_DB_VERSION_PATCH__/$DB_VERSION_PATCH/g" \
+ -e "s/__EDIT_DB_VERSION_STRING__/$DB_VERSION_STRING/g" \
+ -e "s/__EDIT_DB_VERSION_UNIQUE_NAME__/$DB_VERSION_UNIQUE_NAME/g" \
+ -e "s/__EDIT_DB_VERSION__/$DB_VERSION/g" configure
+}
+
+src_compile() {
+ local myconf=""
+
+ use amd64 && myconf="${myconf} --with-mutex=x86/gcc-assembly"
+
+ myconf="${myconf} $(use_enable cxx)"
+
+ use tcl \
+ && myconf="${myconf} --enable-tcl --with-tcl=/usr/$(get_libdir)" \
+ || myconf="${myconf} --disable-tcl"
+
+ myconf="${myconf} $(use_enable java)"
+ if use java; then
+ myconf="${myconf} --with-java-prefix=${JAVA_HOME}"
+ # Can't get this working any other way, since it returns spaces, and
+ # bash doesn't seem to want to pass correctly in any way i try
+ local javaconf="-with-javac-flags=$(java-pkg_javac-args)"
+ fi
+
+ [[ -n ${CBUILD} ]] && myconf="${myconf} --build=${CBUILD}"
+
+ # the entire testsuite needs the TCL functionality
+ if use tcl && use test; then
+ myconf="${myconf} --enable-test"
+ else
+ myconf="${myconf} --disable-test"
+ fi
+
+ cd "${S}" && ECONF_SOURCE="${S}"/../dist econf \
+ --prefix=/usr \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --datadir=/usr/share \
+ --sysconfdir=/etc \
+ --localstatedir=/var/lib \
+ --libdir=/usr/"$(get_libdir)" \
+ --enable-compat185 \
+ --with-uniquename \
+ $(use_enable rpc) \
+ --host="${CHOST}" \
+ ${myconf} "${javaconf}" || die "configure failed"
+
+ # This isn't safe for prefix (Darwin should be .jnilib), but I can't get the
+ # build system to behave itself, it generates libtool too late.
+ sed -i \
+ -e 's/-shrext $(SOFLAGS)/-shrext .so $(SOFLAGS)/g' \
+ Makefile
+ emake || die "make failed"
+}
+
+src_install() {
+ einstall libdir="${D}/usr/$(get_libdir)" strip="${D}/bin/strip" || die
+
+ db_src_install_usrbinslot
+
+ db_src_install_headerslot
+
+ db_src_install_doc
+
+ db_src_install_usrlibcleanup
+
+ dodir /usr/sbin
+ # This file is not always built, and no longer exists as of db-4.8
+ [[ -f "${D}"/usr/bin/berkeley_db_svc ]] && \
+ mv "${D}"/usr/bin/berkeley_db_svc "${D}"/usr/sbin/berkeley_db"${SLOT/./}"_svc
+
+ if use java; then
+ java-pkg_regso "${D}"/usr/"$(get_libdir)"/libdb_java*.so
+ java-pkg_dojar "${D}"/usr/"$(get_libdir)"/*.jar
+ rm -f "${D}"/usr/"$(get_libdir)"/*.jar
+ fi
+}
+
+pkg_postinst() {
+ db_fix_so
+}
+
+pkg_postrm() {
+ db_fix_so
+}
diff --git a/sys-libs/db/db-4.3.29_p1-r1.ebuild b/sys-libs/db/db-4.3.29_p1-r1.ebuild
new file mode 100644
index 000000000000..53c537e263d5
--- /dev/null
+++ b/sys-libs/db/db-4.3.29_p1-r1.ebuild
@@ -0,0 +1,169 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils db flag-o-matic java-pkg-opt-2 autotools multilib
+
+#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
+
+S="${WORKDIR}/${MY_P}/build_unix"
+DESCRIPTION="Oracle Berkeley DB"
+HOMEPAGE="http://www.oracle.com/technology/software/products/berkeley-db/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="4.3"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+IUSE="tcl java doc cxx rpc"
+
+DEPEND="tcl? ( >=dev-lang/tcl-8.4 )
+ java? ( >=virtual/jdk-1.4 )
+ >=sys-devel/binutils-2.16.1"
+RDEPEND="tcl? ( dev-lang/tcl )
+ java? ( >=virtual/jre-1.4 )"
+
+src_unpack() {
+ unpack "${MY_P}".tar.gz
+ cd "${WORKDIR}"/"${MY_P}"
+ for (( i=1 ; i<=${PATCHNO} ; i++ ))
+ do
+ epatch "${DISTDIR}"/patch."${MY_PV}"."${i}"
+ done
+ epatch "${FILESDIR}"/"${PN}"-"${SLOT}"-libtool.patch
+
+ # use the includes from the prefix
+ epatch "${FILESDIR}"/"${PN}"-"${SLOT}"-jni-check-prefix-first.patch
+ epatch "${FILESDIR}"/"${PN}"-"${SLOT}"-listen-to-java-options.patch
+
+ epatch "${FILESDIR}"/"${PN}"-4.3.27-fix-dep-link.patch
+
+ sed -e "/^DB_RELEASE_DATE=/s/%B %e, %Y/%Y-%m-%d/" -i dist/RELEASE
+
+ # 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}"/../dist/Makefile.in
+
+ # START of 4.5+earlier specific
+ # Upstream sucks, they normally concat these
+ cd "${S}"/../dist/aclocal
+ for i in *; do ln -s $i ${i%.ac}.m4 ; done ;
+ cd "${S}"/../dist/aclocal_java
+ for i in *; do ln -s $i ${i%.ac}.m4 ; done ;
+ # END of 4.5+earlier specific
+ cd "${S}"/../dist
+ rm -f aclocal/libtool.{m4,ac} aclocal.m4
+ sed -i \
+ -e '/AC_PROG_LIBTOOL$/aLT_OUTPUT' \
+ configure.ac
+ sed -i \
+ -e '/^AC_PATH_TOOL/s/ sh, missing_sh/ bash, missing_sh/' \
+ aclocal/programs.m4
+ AT_M4DIR="aclocal aclocal_java" eautoreconf
+ # Upstream sucks - they do autoconf and THEN replace the version variables.
+ . ./RELEASE
+ sed -i \
+ -e "s/__EDIT_DB_VERSION_MAJOR__/$DB_VERSION_MAJOR/g" \
+ -e "s/__EDIT_DB_VERSION_MINOR__/$DB_VERSION_MINOR/g" \
+ -e "s/__EDIT_DB_VERSION_PATCH__/$DB_VERSION_PATCH/g" \
+ -e "s/__EDIT_DB_VERSION_STRING__/$DB_VERSION_STRING/g" \
+ -e "s/__EDIT_DB_VERSION_UNIQUE_NAME__/$DB_VERSION_UNIQUE_NAME/g" \
+ -e "s/__EDIT_DB_VERSION__/$DB_VERSION/g" configure
+}
+
+src_compile() {
+ local myconf=""
+
+ use amd64 && myconf="${myconf} --with-mutex=x86/gcc-assembly"
+
+ myconf="${myconf} $(use_enable cxx)"
+
+ use tcl \
+ && myconf="${myconf} --enable-tcl --with-tcl=/usr/$(get_libdir)" \
+ || myconf="${myconf} --disable-tcl"
+
+ myconf="${myconf} $(use_enable java)"
+ if use java; then
+ myconf="${myconf} --with-java-prefix=${JAVA_HOME}"
+ # Can't get this working any other way, since it returns spaces, and
+ # bash doesn't seem to want to pass correctly in any way i try
+ local javaconf="-with-javac-flags=$(java-pkg_javac-args)"
+ fi
+
+ [[ -n ${CBUILD} ]] && myconf="${myconf} --build=${CBUILD}"
+
+ # the entire testsuite needs the TCL functionality
+ if use tcl && use test ; then
+ myconf="${myconf} --enable-test"
+ else
+ myconf="${myconf} --disable-test"
+ fi
+
+ # Add linker versions to the symbols. Easier to do, and safer than header
+ # file mumbo jumbo.
+ if use userland_GNU; then
+ append-ldflags -Wl,--default-symver
+ fi
+
+ cd "${S}" && ECONF_SOURCE="${S}"/../dist econf \
+ --prefix=/usr \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --datadir=/usr/share \
+ --sysconfdir=/etc \
+ --localstatedir=/var/lib \
+ --libdir=/usr/"$(get_libdir)" \
+ --enable-compat185 \
+ --enable-o_direct \
+ --without-uniquename \
+ $(use_enable rpc) \
+ --host="${CHOST}" \
+ ${myconf} "${javaconf}" || die "configure failed"
+
+ emake || die "make failed"
+}
+
+src_install() {
+ einstall libdir="${D}/usr/$(get_libdir)" strip="${D}/bin/strip" || die
+
+ db_src_install_usrbinslot
+
+ db_src_install_headerslot
+
+ db_src_install_doc
+
+ db_src_install_usrlibcleanup
+
+ dodir /usr/sbin
+ # This file is not always built, and no longer exists as of db-4.8
+ [[ -f "${D}"/usr/bin/berkeley_db_svc ]] && \
+ mv "${D}"/usr/bin/berkeley_db_svc "${D}"/usr/sbin/berkeley_db"${SLOT/./}"_svc
+
+ if use java; then
+ java-pkg_regso "${D}"/usr/"$(get_libdir)"/libdb_java*.so
+ java-pkg_dojar "${D}"/usr/"$(get_libdir)"/*.jar
+ rm -f "${D}"/usr/"$(get_libdir)"/*.jar
+ fi
+}
+
+pkg_postinst() {
+ db_fix_so
+}
+
+pkg_postrm() {
+ db_fix_so
+}
diff --git a/sys-libs/db/db-4.4.20_p4-r1.ebuild b/sys-libs/db/db-4.4.20_p4-r1.ebuild
new file mode 100644
index 000000000000..9026b480db3e
--- /dev/null
+++ b/sys-libs/db/db-4.4.20_p4-r1.ebuild
@@ -0,0 +1,163 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils db flag-o-matic java-pkg-opt-2 autotools multilib
+
+#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
+
+S="${WORKDIR}/${MY_P}/build_unix"
+DESCRIPTION="Oracle Berkeley DB"
+HOMEPAGE="http://www.oracle.com/technology/software/products/berkeley-db/index.html"
+SRC_URI="http://download.oracle.com/berkeley-db/${MY_P}.tar.gz
+ mirror://gentoo/${MY_P}-20060110-rpc_server-java.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 BSD"
+SLOT="4.4"
+KEYWORDS="~amd64 ~arm ~arm64 ~ia64 ~m68k ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+IUSE="tcl java doc cxx rpc"
+
+DEPEND="tcl? ( >=dev-lang/tcl-8.4 )
+ java? ( >=virtual/jdk-1.4 )
+ >=sys-devel/binutils-2.16.1"
+RDEPEND="tcl? ( dev-lang/tcl )
+ java? ( >=virtual/jre-1.4 )"
+
+src_unpack() {
+ unpack "${MY_P}".tar.gz
+ unpack "${MY_P}-20060110-rpc_server-java".tar.gz
+ cd "${WORKDIR}"/"${MY_P}"
+ for (( i=1 ; i<=${PATCHNO} ; i++ ))
+ do
+ epatch "${DISTDIR}"/patch."${MY_PV}"."${i}"
+ done
+ epatch "${FILESDIR}"/"${PN}"-"${SLOT}"-libtool.patch
+
+ # use the includes from the prefix
+ epatch "${FILESDIR}"/"${PN}"-4.3-jni-check-prefix-first.patch
+ epatch "${FILESDIR}"/"${PN}"-4.3-listen-to-java-options.patch
+
+ sed -e "/^DB_RELEASE_DATE=/s/%B %e, %Y/%Y-%m-%d/" -i dist/RELEASE
+
+ # 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}"/../dist/Makefile.in
+
+ # START of 4.5+earlier specific
+ # Upstream sucks, they normally concat these
+ cd "${S}"/../dist/aclocal
+ for i in *; do ln -s $i ${i%.ac}.m4 ; done ;
+ cd "${S}"/../dist/aclocal_java
+ for i in *; do ln -s $i ${i%.ac}.m4 ; done ;
+ # END of 4.5+earlier specific
+ cd "${S}"/../dist
+ rm -f aclocal/libtool.{m4,ac} aclocal.m4
+ AT_M4DIR="aclocal aclocal_java" eautoreconf
+ # Upstream sucks - they do autoconf and THEN replace the version variables.
+ . ./RELEASE
+ sed -i \
+ -e "s/__EDIT_DB_VERSION_MAJOR__/$DB_VERSION_MAJOR/g" \
+ -e "s/__EDIT_DB_VERSION_MINOR__/$DB_VERSION_MINOR/g" \
+ -e "s/__EDIT_DB_VERSION_PATCH__/$DB_VERSION_PATCH/g" \
+ -e "s/__EDIT_DB_VERSION_STRING__/$DB_VERSION_STRING/g" \
+ -e "s/__EDIT_DB_VERSION_UNIQUE_NAME__/$DB_VERSION_UNIQUE_NAME/g" \
+ -e "s/__EDIT_DB_VERSION__/$DB_VERSION/g" configure
+}
+
+src_compile() {
+ local myconf=""
+
+ use amd64 && myconf="${myconf} --with-mutex=x86/gcc-assembly"
+
+ myconf="${myconf} $(use_enable cxx)"
+
+ use tcl \
+ && myconf="${myconf} --enable-tcl --with-tcl=/usr/$(get_libdir)" \
+ || myconf="${myconf} --disable-tcl"
+
+ myconf="${myconf} $(use_enable java)"
+ if use java; then
+ myconf="${myconf} --with-java-prefix=${JAVA_HOME}"
+ # Can't get this working any other way, since it returns spaces, and
+ # bash doesn't seem to want to pass correctly in any way i try
+ local javaconf="-with-javac-flags=$(java-pkg_javac-args)"
+ fi
+
+ [[ -n ${CBUILD} ]] && myconf="${myconf} --build=${CBUILD}"
+
+ # the entire testsuite needs the TCL functionality
+ if use tcl && use test ; then
+ myconf="${myconf} --enable-test"
+ else
+ myconf="${myconf} --disable-test"
+ fi
+
+ # Add linker versions to the symbols. Easier to do, and safer than header file
+ # mumbo jumbo.
+ if use userland_GNU; then
+ append-ldflags -Wl,--default-symver
+ fi
+
+ cd "${S}" && ECONF_SOURCE="${S}"/../dist econf \
+ --prefix=/usr \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --datadir=/usr/share \
+ --sysconfdir=/etc \
+ --localstatedir=/var/lib \
+ --libdir=/usr/"$(get_libdir)" \
+ --enable-compat185 \
+ --enable-o_direct \
+ --without-uniquename \
+ $(use_enable rpc) \
+ --host="${CHOST}" \
+ ${myconf} "${javaconf}" || die "configure failed"
+
+ emake -j1 || die "make failed"
+}
+
+src_install() {
+ einstall libdir="${D}/usr/$(get_libdir)" strip="${D}/bin/strip" || die
+
+ db_src_install_usrbinslot
+
+ db_src_install_headerslot
+
+ db_src_install_doc
+
+ db_src_install_usrlibcleanup
+
+ dodir /usr/sbin
+ # This file is not always built, and no longer exists as of db-4.8
+ [[ -f "${D}"/usr/bin/berkeley_db_svc ]] && \
+ mv "${D}"/usr/bin/berkeley_db_svc "${D}"/usr/sbin/berkeley_db"${SLOT/./}"_svc
+
+ if use java; then
+ java-pkg_regso "${D}"/usr/"$(get_libdir)"/libdb_java*.so
+ java-pkg_dojar "${D}"/usr/"$(get_libdir)"/*.jar
+ rm -f "${D}"/usr/"$(get_libdir)"/*.jar
+ fi
+}
+
+pkg_postinst() {
+ db_fix_so
+}
+
+pkg_postrm() {
+ db_fix_so
+}
diff --git a/sys-libs/db/db-4.5.20_p2-r1.ebuild b/sys-libs/db/db-4.5.20_p2-r1.ebuild
new file mode 100644
index 000000000000..2d4fb546be3d
--- /dev/null
+++ b/sys-libs/db/db-4.5.20_p2-r1.ebuild
@@ -0,0 +1,176 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils db flag-o-matic java-pkg-opt-2 autotools multilib
+
+#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
+
+S="${WORKDIR}/${MY_P}/build_unix"
+DESCRIPTION="Oracle Berkeley DB"
+HOMEPAGE="http://www.oracle.com/technology/software/products/berkeley-db/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="4.5"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+IUSE="tcl java doc cxx rpc"
+
+DEPEND="tcl? ( >=dev-lang/tcl-8.4 )
+ java? ( >=virtual/jdk-1.4 )
+ >=sys-devel/binutils-2.16.1"
+RDEPEND="tcl? ( dev-lang/tcl )
+ java? ( >=virtual/jre-1.4 )"
+
+src_unpack() {
+ unpack "${MY_P}".tar.gz
+ cd "${WORKDIR}"/"${MY_P}"
+ for (( i=1 ; i<=${PATCHNO} ; i++ ))
+ do
+ epatch "${DISTDIR}"/patch."${MY_PV}"."${i}"
+ done
+ epatch "${FILESDIR}"/"${PN}"-"${SLOT}"-libtool.patch
+
+ # use the includes from the prefix
+ epatch "${FILESDIR}"/"${PN}"-4.3-jni-check-prefix-first.patch
+ epatch "${FILESDIR}"/"${PN}"-4.3-listen-to-java-options.patch
+
+ sed -e "/^DB_RELEASE_DATE=/s/%B %e, %Y/%Y-%m-%d/" -i dist/RELEASE
+
+ # 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}"/../dist/Makefile.in
+
+ # START of 4.5+earlier specific
+ # Upstream sucks, they normally concat these
+ cd "${S}"/../dist/aclocal
+ for i in *; do ln -s $i ${i%.ac}.m4 ; done ;
+ cd "${S}"/../dist/aclocal_java
+ for i in *; do ln -s $i ${i%.ac}.m4 ; done ;
+ # END of 4.5+earlier specific
+ cd "${S}"/../dist
+ rm -f aclocal/libtool.{m4,ac} aclocal.m4
+ sed -i \
+ -e '/AC_PROG_LIBTOOL$/aLT_OUTPUT' \
+ configure.ac
+ sed -i \
+ -e '/^AC_PATH_TOOL/s/ sh, none/ bash, none/' \
+ aclocal/programs.m4
+ AT_M4DIR="aclocal aclocal_java" eautoreconf
+ # Upstream sucks - they do autoconf and THEN replace the version variables.
+ . ./RELEASE
+ sed -i \
+ -e "s/__EDIT_DB_VERSION_MAJOR__/$DB_VERSION_MAJOR/g" \
+ -e "s/__EDIT_DB_VERSION_MINOR__/$DB_VERSION_MINOR/g" \
+ -e "s/__EDIT_DB_VERSION_PATCH__/$DB_VERSION_PATCH/g" \
+ -e "s/__EDIT_DB_VERSION_STRING__/$DB_VERSION_STRING/g" \
+ -e "s/__EDIT_DB_VERSION_UNIQUE_NAME__/$DB_VERSION_UNIQUE_NAME/g" \
+ -e "s/__EDIT_DB_VERSION__/$DB_VERSION/g" configure
+}
+
+src_compile() {
+ # compilation with -O0 fails on amd64, see bug #171231
+ if use amd64; then
+ replace-flags -O0 -O2
+ is-flagq -O[s123] || append-flags -O2
+ fi
+
+ local myconf=""
+
+ use amd64 && myconf="${myconf} --with-mutex=x86/gcc-assembly"
+
+ myconf="${myconf} $(use_enable cxx)"
+
+ use tcl \
+ && myconf="${myconf} --enable-tcl --with-tcl=/usr/$(get_libdir)" \
+ || myconf="${myconf} --disable-tcl"
+
+ myconf="${myconf} $(use_enable java)"
+ if use java; then
+ myconf="${myconf} --with-java-prefix=${JAVA_HOME}"
+ # Can't get this working any other way, since it returns spaces, and
+ # bash doesn't seem to want to pass correctly in any way i try
+ local javaconf="-with-javac-flags=$(java-pkg_javac-args)"
+ fi
+
+ [[ -n ${CBUILD} ]] && myconf="${myconf} --build=${CBUILD}"
+
+ # the entire testsuite needs the TCL functionality
+ if use tcl && use test ; then
+ myconf="${myconf} --enable-test"
+ else
+ myconf="${myconf} --disable-test"
+ fi
+
+ # Add linker versions to the symbols. Easier to do, and safer than header file
+ # mumbo jumbo.
+ if use userland_GNU; then
+ append-ldflags -Wl,--default-symver
+ fi
+
+ cd "${S}" && ECONF_SOURCE="${S}"/../dist econf \
+ --prefix=/usr \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --datadir=/usr/share \
+ --sysconfdir=/etc \
+ --localstatedir=/var/lib \
+ --libdir=/usr/"$(get_libdir)" \
+ --enable-compat185 \
+ --enable-o_direct \
+ --without-uniquename \
+ $(use_enable rpc) \
+ --host="${CHOST}" \
+ ${myconf} "${javaconf}" || die "configure failed"
+
+ sed -e "s,\(^STRIP *=\).*,\1\"true\"," Makefile > Makefile.cpy \
+ && mv Makefile.cpy Makefile
+
+ emake || die "make failed"
+}
+
+src_install() {
+ einstall libdir="${D}/usr/$(get_libdir)" STRIP="true" || die
+
+ db_src_install_usrbinslot
+
+ db_src_install_headerslot
+
+ db_src_install_doc
+
+ db_src_install_usrlibcleanup
+
+ dodir /usr/sbin
+ # This file is not always built, and no longer exists as of db-4.8
+ [[ -f "${D}"/usr/bin/berkeley_db_svc ]] && \
+ mv "${D}"/usr/bin/berkeley_db_svc "${D}"/usr/sbin/berkeley_db"${SLOT/./}"_svc
+
+ if use java; then
+ java-pkg_regso "${D}"/usr/"$(get_libdir)"/libdb_java*.so
+ java-pkg_dojar "${D}"/usr/"$(get_libdir)"/*.jar
+ rm -f "${D}"/usr/"$(get_libdir)"/*.jar
+ fi
+}
+
+pkg_postinst() {
+ db_fix_so
+}
+
+pkg_postrm() {
+ db_fix_so
+}
diff --git a/sys-libs/db/db-4.6.21_p4.ebuild b/sys-libs/db/db-4.6.21_p4.ebuild
new file mode 100644
index 000000000000..d4fc002d366c
--- /dev/null
+++ b/sys-libs/db/db-4.6.21_p4.ebuild
@@ -0,0 +1,169 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils db flag-o-matic java-pkg-opt-2 autotools multilib
+
+#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
+
+S="${WORKDIR}/${MY_P}/build_unix"
+DESCRIPTION="Oracle Berkeley DB"
+HOMEPAGE="http://www.oracle.com/technology/software/products/berkeley-db/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="4.6"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+IUSE="tcl java doc cxx rpc"
+
+DEPEND="tcl? ( >=dev-lang/tcl-8.4 )
+ java? ( >=virtual/jdk-1.4 )
+ >=sys-devel/binutils-2.16.1"
+RDEPEND="tcl? ( dev-lang/tcl )
+ java? ( >=virtual/jre-1.4 )"
+
+src_unpack() {
+ unpack "${MY_P}".tar.gz
+ cd "${WORKDIR}"/"${MY_P}"
+ for (( i=1 ; i<=${PATCHNO} ; i++ ))
+ do
+ epatch "${DISTDIR}"/patch."${MY_PV}"."${i}"
+ done
+ epatch "${FILESDIR}"/"${PN}"-"${SLOT}"-libtool.patch
+
+ # use the includes from the prefix
+ epatch "${FILESDIR}"/"${PN}"-"${SLOT}"-jni-check-prefix-first.patch
+ epatch "${FILESDIR}"/"${PN}"-4.3-listen-to-java-options.patch
+
+ sed -e "/^DB_RELEASE_DATE=/s/%B %e, %Y/%Y-%m-%d/" -i dist/RELEASE
+
+ # 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}"/../dist/Makefile.in
+
+ cd "${S}"/../dist
+ rm -f aclocal/libtool.m4
+ sed -i \
+ -e '/AC_PROG_LIBTOOL$/aLT_OUTPUT' \
+ configure.ac
+ sed -i \
+ -e '/^AC_PATH_TOOL/s/ sh, none/ bash, none/' \
+ aclocal/programs.m4
+ AT_M4DIR="aclocal aclocal_java" eautoreconf
+ # Upstream sucks - they do autoconf and THEN replace the version variables.
+ . ./RELEASE
+ sed -i \
+ -e "s/__EDIT_DB_VERSION_MAJOR__/$DB_VERSION_MAJOR/g" \
+ -e "s/__EDIT_DB_VERSION_MINOR__/$DB_VERSION_MINOR/g" \
+ -e "s/__EDIT_DB_VERSION_PATCH__/$DB_VERSION_PATCH/g" \
+ -e "s/__EDIT_DB_VERSION_STRING__/$DB_VERSION_STRING/g" \
+ -e "s/__EDIT_DB_VERSION_UNIQUE_NAME__/$DB_VERSION_UNIQUE_NAME/g" \
+ -e "s/__EDIT_DB_VERSION__/$DB_VERSION/g" configure
+}
+
+src_compile() {
+ # compilation with -O0 fails on amd64, see bug #171231
+ if use amd64; then
+ replace-flags -O0 -O2
+ is-flagq -O[s123] || append-flags -O2
+ fi
+
+ local myconf=""
+
+ use amd64 && myconf="${myconf} --with-mutex=x86/gcc-assembly"
+
+ myconf="${myconf} $(use_enable cxx)"
+
+ use tcl \
+ && myconf="${myconf} --enable-tcl --with-tcl=/usr/$(get_libdir)" \
+ || myconf="${myconf} --disable-tcl"
+
+ myconf="${myconf} $(use_enable java)"
+ if use java; then
+ myconf="${myconf} --with-java-prefix=${JAVA_HOME}"
+ # Can't get this working any other way, since it returns spaces, and
+ # bash doesn't seem to want to pass correctly in any way i try
+ local javaconf="-with-javac-flags=$(java-pkg_javac-args)"
+ fi
+
+ [[ -n ${CBUILD} ]] && myconf="${myconf} --build=${CBUILD}"
+
+ # the entire testsuite needs the TCL functionality
+ if use tcl && use test ; then
+ myconf="${myconf} --enable-test"
+ else
+ myconf="${myconf} --disable-test"
+ fi
+
+ # Add linker versions to the symbols. Easier to do, and safer than header file
+ # mumbo jumbo.
+ if use userland_GNU; then
+ append-ldflags -Wl,--default-symver
+ fi
+
+ cd "${S}" && ECONF_SOURCE="${S}"/../dist econf \
+ --prefix=/usr \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --datadir=/usr/share \
+ --sysconfdir=/etc \
+ --localstatedir=/var/lib \
+ --libdir=/usr/"$(get_libdir)" \
+ --enable-compat185 \
+ --enable-o_direct \
+ --without-uniquename \
+ $(use_enable rpc) \
+ --host="${CHOST}" \
+ ${myconf} "${javaconf}" || die "configure failed"
+
+ sed -e "s,\(^STRIP *=\).*,\1\"true\"," Makefile > Makefile.cpy \
+ && mv Makefile.cpy Makefile
+
+ emake || die "make failed"
+}
+
+src_install() {
+ einstall libdir="${D}/usr/$(get_libdir)" STRIP="true" || die
+
+ db_src_install_usrbinslot
+
+ db_src_install_headerslot
+
+ db_src_install_doc
+
+ db_src_install_usrlibcleanup
+
+ dodir /usr/sbin
+ # This file is not always built, and no longer exists as of db-4.8
+ [[ -f "${D}"/usr/bin/berkeley_db_svc ]] && \
+ mv "${D}"/usr/bin/berkeley_db_svc "${D}"/usr/sbin/berkeley_db"${SLOT/./}"_svc
+
+ if use java; then
+ java-pkg_regso "${D}"/usr/"$(get_libdir)"/libdb_java*.so
+ java-pkg_dojar "${D}"/usr/"$(get_libdir)"/*.jar
+ rm -f "${D}"/usr/"$(get_libdir)"/*.jar
+ fi
+}
+
+pkg_postinst() {
+ db_fix_so
+}
+
+pkg_postrm() {
+ db_fix_so
+}
diff --git a/sys-libs/db/db-4.7.25_p4.ebuild b/sys-libs/db/db-4.7.25_p4.ebuild
new file mode 100644
index 000000000000..9f63b9921598
--- /dev/null
+++ b/sys-libs/db/db-4.7.25_p4.ebuild
@@ -0,0 +1,160 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils db flag-o-matic java-pkg-opt-2 autotools multilib
+
+#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
+
+S="${WORKDIR}/${MY_P}/build_unix"
+DESCRIPTION="Oracle Berkeley DB"
+HOMEPAGE="http://www.oracle.com/technology/software/products/berkeley-db/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="4.7"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+IUSE="doc java cxx tcl test rpc"
+
+# the entire testsuite needs the TCL functionality
+DEPEND="tcl? ( >=dev-lang/tcl-8.4 )
+ test? ( >=dev-lang/tcl-8.4 )
+ java? ( >=virtual/jdk-1.5 )
+ >=sys-devel/binutils-2.16.1"
+RDEPEND="tcl? ( dev-lang/tcl )
+ java? ( >=virtual/jre-1.5 )"
+
+src_unpack() {
+ unpack "${MY_P}".tar.gz
+ cd "${WORKDIR}"/"${MY_P}"
+ for (( i=1 ; i<=${PATCHNO} ; i++ ))
+ do
+ epatch "${DISTDIR}"/patch."${MY_PV}"."${i}"
+ done
+ epatch "${FILESDIR}"/"${PN}"-4.6-libtool.patch
+
+ # use the includes from the prefix
+ epatch "${FILESDIR}"/"${PN}"-4.6-jni-check-prefix-first.patch
+ epatch "${FILESDIR}"/"${PN}"-4.3-listen-to-java-options.patch
+
+ sed -e "/^DB_RELEASE_DATE=/s/%B %e, %Y/%Y-%m-%d/" -i dist/RELEASE
+
+ # 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}"/../dist/Makefile.in
+
+ cd "${S}"/../dist
+ rm -f aclocal/libtool.m4
+ sed -i \
+ -e '/AC_PROG_LIBTOOL$/aLT_OUTPUT' \
+ configure.ac
+ sed -i \
+ -e '/^AC_PATH_TOOL/s/ sh, none/ bash, none/' \
+ aclocal/programs.m4
+ AT_M4DIR="aclocal aclocal_java" eautoreconf
+ # Upstream sucks - they do autoconf and THEN replace the version variables.
+ . ./RELEASE
+ sed -i \
+ -e "s/__EDIT_DB_VERSION_MAJOR__/$DB_VERSION_MAJOR/g" \
+ -e "s/__EDIT_DB_VERSION_MINOR__/$DB_VERSION_MINOR/g" \
+ -e "s/__EDIT_DB_VERSION_PATCH__/$DB_VERSION_PATCH/g" \
+ -e "s/__EDIT_DB_VERSION_STRING__/$DB_VERSION_STRING/g" \
+ -e "s/__EDIT_DB_VERSION_UNIQUE_NAME__/$DB_VERSION_UNIQUE_NAME/g" \
+ -e "s/__EDIT_DB_VERSION__/$DB_VERSION/g" configure
+}
+
+src_compile() {
+ local myconf=''
+
+ # compilation with -O0 fails on amd64, see bug #171231
+ if use amd64; then
+ replace-flags -O0 -O2
+ is-flagq -O[s123] || append-flags -O2
+ fi
+
+ # use `set` here since the java opts will contain whitespace
+ set --
+ if use java ; then
+ set -- "$@" \
+ --with-java-prefix="${JAVA_HOME}" \
+ --with-javac-flags="$(java-pkg_javac-args)"
+ fi
+
+ # Add linker versions to the symbols. Easier to do, and safer than header file
+ # mumbo jumbo.
+ if use userland_GNU ; then
+ append-ldflags -Wl,--default-symver
+ fi
+
+ # Bug #270851: test needs TCL support
+ if use tcl || use test ; then
+ myconf="${myconf} --enable-tcl"
+ myconf="${myconf} --with-tcl=/usr/$(get_libdir)"
+ else
+ myconf="${myconf} --disable-tcl"
+ fi
+
+ cd "${S}"
+ ECONF_SOURCE="${S}"/../dist \
+ STRIP="true" \
+ econf \
+ --enable-compat185 \
+ --enable-o_direct \
+ --without-uniquename \
+ $(use_enable rpc) \
+ $(use arm && echo --with-mutex=ARM/gcc-assembly) \
+ $(use amd64 && echo --with-mutex=x86/gcc-assembly) \
+ $(use_enable cxx) \
+ $(use_enable java) \
+ ${myconf} \
+ $(use_enable test) \
+ "$@"
+
+ emake || die "make failed"
+}
+
+src_install() {
+ emake install DESTDIR="${D}" || die
+
+ db_src_install_usrbinslot
+
+ db_src_install_headerslot
+
+ db_src_install_doc
+
+ db_src_install_usrlibcleanup
+
+ dodir /usr/sbin
+ # This file is not always built, and no longer exists as of db-4.8
+ [[ -f "${D}"/usr/bin/berkeley_db_svc ]] && \
+ mv "${D}"/usr/bin/berkeley_db_svc "${D}"/usr/sbin/berkeley_db"${SLOT/./}"_svc
+
+ if use java; then
+ java-pkg_regso "${D}"/usr/"$(get_libdir)"/libdb_java*.so
+ java-pkg_dojar "${D}"/usr/"$(get_libdir)"/*.jar
+ rm -f "${D}"/usr/"$(get_libdir)"/*.jar
+ fi
+}
+
+pkg_postinst() {
+ db_fix_so
+}
+
+pkg_postrm() {
+ db_fix_so
+}
diff --git a/sys-libs/db/db-4.8.30-r1.ebuild b/sys-libs/db/db-4.8.30-r1.ebuild
new file mode 100644
index 000000000000..f56a734022d4
--- /dev/null
+++ b/sys-libs/db/db-4.8.30-r1.ebuild
@@ -0,0 +1,185 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit eutils db flag-o-matic java-pkg-opt-2 autotools multilib multilib-minimal
+
+#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
+
+S="${WORKDIR}/${MY_P}/build_unix"
+DESCRIPTION="Oracle Berkeley DB"
+HOMEPAGE="http://www.oracle.com/technology/software/products/berkeley-db/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="4.8"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE="doc java cxx tcl test"
+
+# 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 )
+ >=sys-devel/binutils-2.16.1"
+RDEPEND="tcl? ( >=dev-lang/tcl-8.5.15-r1:0[${MULTILIB_USEDEP}] )
+ java? ( >=virtual/jre-1.5 )
+ abi_x86_32? (
+ !<=app-emulation/emul-linux-x86-baselibs-20140508-r2
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ )"
+
+src_unpack() {
+ unpack "${MY_P}".tar.gz
+}
+
+src_prepare() {
+ cd "${WORKDIR}"/"${MY_P}" || die
+ for (( i=1 ; i<=${PATCHNO} ; i++ ))
+ do
+ epatch "${DISTDIR}"/patch."${MY_PV}"."${i}"
+ done
+ epatch "${FILESDIR}"/${PN}-4.8-libtool.patch
+ epatch "${FILESDIR}"/${PN}-4.8.24-java-manifest-location.patch
+ epatch "${FILESDIR}"/${PN}-4.8.30-rename-atomic-compare-exchange.patch
+
+ # use the includes from the prefix
+ epatch "${FILESDIR}"/${PN}-4.6-jni-check-prefix-first.patch
+ epatch "${FILESDIR}"/${PN}-4.3-listen-to-java-options.patch
+
+ sed -e "/^DB_RELEASE_DATE=/s/%B %e, %Y/%Y-%m-%d/" -i 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}"/../dist/Makefile.in || die
+
+ cd "${S}"/../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
+ sed -i \
+ -e "s/__EDIT_DB_VERSION_MAJOR__/$DB_VERSION_MAJOR/g" \
+ -e "s/__EDIT_DB_VERSION_MINOR__/$DB_VERSION_MINOR/g" \
+ -e "s/__EDIT_DB_VERSION_PATCH__/$DB_VERSION_PATCH/g" \
+ -e "s/__EDIT_DB_VERSION_STRING__/$DB_VERSION_STRING/g" \
+ -e "s/__EDIT_DB_VERSION_UNIQUE_NAME__/$DB_VERSION_UNIQUE_NAME/g" \
+ -e "s/__EDIT_DB_VERSION__/$DB_VERSION/g" configure || die
+}
+
+src_configure() {
+ # Add linker versions to the symbols. Easier to do, and safer than header file
+ # mumbo jumbo.
+ if use userland_GNU ; then
+ append-ldflags -Wl,--default-symver
+ fi
+
+ multilib-minimal_src_configure
+}
+
+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
+
+ # 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=/usr/$(get_libdir)
+ )
+ else
+ myconf+=(--disable-tcl )
+ fi
+
+ ECONF_SOURCE="${S}"/../dist \
+ STRIP="true" \
+ econf \
+ --enable-compat185 \
+ --enable-o_direct \
+ --without-uniquename \
+ $([[ ${ABI} == arm ]] && echo --with-mutex=ARM/gcc-assembly) \
+ $([[ ${ABI} == amd64 ]] && echo --with-mutex=x86/gcc-assembly) \
+ $(use_enable cxx) \
+ $(use_enable cxx stl) \
+ $(multilib_native_use_enable java) \
+ "${myconf[@]}" \
+ $(use_enable test)
+}
+
+multilib_src_test() {
+ multilib_is_native_abi || return
+
+ S=${BUILD_DIR} db_src_test
+}
+
+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 "${D}"/usr/"$(get_libdir)"/libdb_java*.so
+ java-pkg_dojar "${D}"/usr/"$(get_libdir)"/*.jar
+ rm -f "${D}"/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 "${D}"/usr/bin/berkeley_db_svc ]] ; then
+ mv "${D}"/usr/bin/berkeley_db_svc \
+ "${D}"/usr/sbin/berkeley_db"${SLOT/./}"_svc || die
+ fi
+}
+
+pkg_postinst() {
+ multilib_foreach_abi db_fix_so
+}
+
+pkg_postrm() {
+ multilib_foreach_abi db_fix_so
+}
diff --git a/sys-libs/db/db-4.8.30-r2.ebuild b/sys-libs/db/db-4.8.30-r2.ebuild
new file mode 100644
index 000000000000..abb91dec4812
--- /dev/null
+++ b/sys-libs/db/db-4.8.30-r2.ebuild
@@ -0,0 +1,185 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+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
+
+S="${WORKDIR}/${MY_P}/build_unix"
+DESCRIPTION="Oracle Berkeley DB"
+HOMEPAGE="http://www.oracle.com/technology/software/products/berkeley-db/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="4.8"
+KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+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 )
+ >=sys-devel/binutils-2.16.1"
+RDEPEND="tcl? ( >=dev-lang/tcl-8.5.15-r1:0=[${MULTILIB_USEDEP}] )
+ java? ( >=virtual/jre-1.5 )
+ abi_x86_32? (
+ !<=app-emulation/emul-linux-x86-baselibs-20140508-r2
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ )"
+
+src_prepare() {
+ cd "${WORKDIR}"/"${MY_P}" || die
+ for (( i=1 ; i<=${PATCHNO} ; i++ ))
+ do
+ epatch "${DISTDIR}"/patch."${MY_PV}"."${i}"
+ done
+ epatch "${FILESDIR}"/${PN}-4.8-libtool.patch
+ epatch "${FILESDIR}"/${PN}-4.8.24-java-manifest-location.patch
+ epatch "${FILESDIR}"/${PN}-4.8.30-rename-atomic-compare-exchange.patch
+
+ # use the includes from the prefix
+ epatch "${FILESDIR}"/${PN}-4.6-jni-check-prefix-first.patch
+ epatch "${FILESDIR}"/${PN}-4.3-listen-to-java-options.patch
+
+ sed -e "/^DB_RELEASE_DATE=/s/%B %e, %Y/%Y-%m-%d/" -i 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}"/../dist/Makefile.in || die
+
+ cd "${S}"/../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
+ sed -i \
+ -e "s/__EDIT_DB_VERSION_MAJOR__/$DB_VERSION_MAJOR/g" \
+ -e "s/__EDIT_DB_VERSION_MINOR__/$DB_VERSION_MINOR/g" \
+ -e "s/__EDIT_DB_VERSION_PATCH__/$DB_VERSION_PATCH/g" \
+ -e "s/__EDIT_DB_VERSION_STRING__/$DB_VERSION_STRING/g" \
+ -e "s/__EDIT_DB_VERSION_UNIQUE_NAME__/$DB_VERSION_UNIQUE_NAME/g" \
+ -e "s/__EDIT_DB_VERSION__/$DB_VERSION/g" configure || die
+}
+
+src_configure() {
+ # Add linker versions to the symbols. Easier to do, and safer than header file
+ # mumbo jumbo.
+ if use userland_GNU ; then
+ append-ldflags -Wl,--default-symver
+ fi
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=()
+
+ tc-ld-disable-gold #470634
+
+ # 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
+
+ # 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=/usr/$(get_libdir)
+ )
+ else
+ myconf+=(--disable-tcl )
+ fi
+
+ ECONF_SOURCE="${S}"/../dist \
+ STRIP="true" \
+ econf \
+ --enable-compat185 \
+ --enable-o_direct \
+ --without-uniquename \
+ $([[ ${ABI} == arm ]] && echo --with-mutex=ARM/gcc-assembly) \
+ $([[ ${ABI} == amd64 ]] && echo --with-mutex=x86/gcc-assembly) \
+ $(use_enable cxx) \
+ $(use_enable cxx stl) \
+ $(multilib_native_use_enable java) \
+ "${myconf[@]}" \
+ $(use_enable test)
+}
+
+multilib_src_test() {
+ multilib_is_native_abi || return
+
+ S=${BUILD_DIR} db_src_test
+}
+
+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 "${D}"/usr/"$(get_libdir)"/libdb_java*.so
+ java-pkg_dojar "${D}"/usr/"$(get_libdir)"/*.jar
+ rm -f "${D}"/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 "${D}"/usr/bin/berkeley_db_svc ]] ; then
+ mv "${D}"/usr/bin/berkeley_db_svc \
+ "${D}"/usr/sbin/berkeley_db"${SLOT/./}"_svc || die
+ fi
+}
+
+pkg_postinst() {
+ multilib_foreach_abi db_fix_so
+}
+
+pkg_postrm() {
+ multilib_foreach_abi db_fix_so
+}
diff --git a/sys-libs/db/db-5.1.29-r1.ebuild b/sys-libs/db/db-5.1.29-r1.ebuild
new file mode 100644
index 000000000000..cac26457da2b
--- /dev/null
+++ b/sys-libs/db/db-5.1.29-r1.ebuild
@@ -0,0 +1,201 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils db flag-o-matic java-pkg-opt-2 autotools multilib 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
+
+S_BASE="${WORKDIR}/${MY_P}"
+S="${S_BASE}/build_unix"
+DESCRIPTION="Oracle Berkeley DB"
+HOMEPAGE="http://www.oracle.com/technology/software/products/berkeley-db/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.1"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
+IUSE="doc java cxx tcl test"
+
+REQUIRED_USE="test? ( tcl )"
+
+# the entire testsuite needs the TCL functionality
+DEPEND="tcl? ( >=dev-lang/tcl-8.4:0 )
+ test? ( >=dev-lang/tcl-8.4:0 )
+ java? ( >=virtual/jdk-1.5 )
+ >=sys-devel/binutils-2.16.1"
+RDEPEND="tcl? ( dev-lang/tcl:0 )
+ java? ( >=virtual/jre-1.5 )"
+
+src_prepare() {
+ cd "${WORKDIR}"/"${MY_P}"
+ for (( i=1 ; i<=${PATCHNO} ; i++ ))
+ do
+ epatch "${DISTDIR}"/patch."${MY_PV}"."${i}"
+ done
+ epatch "${FILESDIR}"/${PN}-4.8-libtool.patch
+ 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.3-listen-to-java-options.patch
+
+ # upstream autoconf fails to build DBM when it's supposed to
+ # merged upstream in 5.0.26
+ #epatch "${FILESDIR}"/${PN}-5.0.21-enable-dbm-autoconf.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
+
+ # 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
+
+ cd "${S_BASE}"/dist
+ rm -f aclocal/libtool.m4
+ sed -i \
+ -e '/AC_PROG_LIBTOOL$/aLT_OUTPUT' \
+ configure.ac
+ sed -i \
+ -e '/^AC_PATH_TOOL/s/ sh, none/ bash, none/' \
+ aclocal/programs.m4
+ 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
+ done
+}
+
+src_configure() {
+ local myconf=''
+
+ tc-ld-disable-gold #470634
+
+ # compilation with -O0 fails on amd64, see bug #171231
+ if use amd64; then
+ replace-flags -O0 -O2
+ is-flagq -O[s123] || append-flags -O2
+ fi
+
+ # use `set` here since the java opts will contain whitespace
+ set --
+ if use java ; then
+ set -- "$@" \
+ --with-java-prefix="${JAVA_HOME}" \
+ --with-javac-flags="$(java-pkg_javac-args)"
+ fi
+
+ # Add linker versions to the symbols. Easier to do, and safer than header file
+ # mumbo jumbo.
+ if use userland_GNU ; then
+ append-ldflags -Wl,--default-symver
+ fi
+
+ # Bug #270851: test needs TCL support
+ if use tcl || use test ; then
+ myconf="${myconf} --enable-tcl"
+ myconf="${myconf} --with-tcl=/usr/$(get_libdir)"
+ else
+ myconf="${myconf} --disable-tcl"
+ fi
+
+ # sql_compat will cause a collision with sqlite3
+ # --enable-sql_compat
+ cd "${S}"
+ 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 \
+ $(use arm && echo --with-mutex=ARM/gcc-assembly) \
+ $(use amd64 && echo --with-mutex=x86/gcc-assembly) \
+ $(use_enable cxx) \
+ $(use_enable cxx stl) \
+ $(use_enable java) \
+ ${myconf} \
+ $(use_enable test) \
+ "$@"
+}
+
+src_compile() {
+ emake || die "make failed"
+}
+
+src_install() {
+ emake install DESTDIR="${D}" || die
+
+ db_src_install_usrbinslot
+
+ db_src_install_headerslot
+
+ db_src_install_doc
+
+ db_src_install_usrlibcleanup
+
+ dodir /usr/sbin
+ # This file is not always built, and no longer exists as of db-4.8
+ [[ -f "${D}"/usr/bin/berkeley_db_svc ]] && \
+ mv "${D}"/usr/bin/berkeley_db_svc "${D}"/usr/sbin/berkeley_db"${SLOT/./}"_svc
+
+ if use java; then
+ java-pkg_regso "${D}"/usr/"$(get_libdir)"/libdb_java*.so
+ java-pkg_dojar "${D}"/usr/"$(get_libdir)"/*.jar
+ rm -f "${D}"/usr/"$(get_libdir)"/*.jar
+ fi
+}
+
+pkg_postinst() {
+ db_fix_so
+}
+
+pkg_postrm() {
+ 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"
+
+ db_src_test
+}
diff --git a/sys-libs/db/db-5.3.28-r2.ebuild b/sys-libs/db/db-5.3.28-r2.ebuild
new file mode 100644
index 000000000000..fa3f8d6be49f
--- /dev/null
+++ b/sys-libs/db/db-5.3.28-r2.ebuild
@@ -0,0 +1,234 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+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
+
+S_BASE="${WORKDIR}/${MY_P}"
+S="${S_BASE}/build_unix"
+DESCRIPTION="Oracle Berkeley DB"
+HOMEPAGE="http://www.oracle.com/technology/software/products/berkeley-db/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 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
+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 )
+ >=sys-devel/binutils-2.16.1"
+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.3-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
+
+ # 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
+}
+
+src_configure() {
+ # Add linker versions to the symbols. Easier to do, and safer than header file
+ # mumbo jumbo.
+ if use userland_GNU ; then
+ append-ldflags -Wl,--default-symver
+ fi
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=()
+
+ tc-ld-disable-gold #470634
+
+ # 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
+
+ # 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=/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} == arm ]] && echo --with-mutex=ARM/gcc-assembly) \
+ $([[ ${ABI} == amd64 ]] && echo --with-mutex=x86/gcc-assembly) \
+ $(use_enable cxx) \
+ $(use_enable cxx stl) \
+ $(multilib_native_use_enable java) \
+ "${myconf[@]}" \
+ $(use_enable test)
+}
+
+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 "${D}"/usr/"$(get_libdir)"/libdb_java*.so
+ java-pkg_dojar "${D}"/usr/"$(get_libdir)"/*.jar
+ rm -f "${D}"/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 "${D}"/usr/bin/berkeley_db_svc ]] ; then
+ mv "${D}"/usr/bin/berkeley_db_svc \
+ "${D}"/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/db-6.0.30-r1.ebuild b/sys-libs/db/db-6.0.30-r1.ebuild
new file mode 100644
index 000000000000..64433d238606
--- /dev/null
+++ b/sys-libs/db/db-6.0.30-r1.ebuild
@@ -0,0 +1,235 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils db flag-o-matic java-pkg-opt-2 autotools multilib multilib-minimal versionator 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
+
+S_BASE="${WORKDIR}/${MY_P}"
+S="${S_BASE}/build_unix"
+DESCRIPTION="Oracle Berkeley DB"
+HOMEPAGE="http://www.oracle.com/technology/software/products/berkeley-db/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="AGPL-3"
+SLOT="$(get_version_component_range 1-2)"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
+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 )
+ >=sys-devel/binutils-2.16.1"
+RDEPEND="tcl? ( >=dev-lang/tcl-8.5.15-r1:0=[${MULTILIB_USEDEP}] )
+ java? ( >=virtual/jre-1.5 )"
+
+MULTILIB_WRAPPED_HEADERS=(
+ /usr/include/db$(get_version_component_range 1-2)/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.3-listen-to-java-options.patch
+
+ # sqlite configure call has an extra leading ..
+ # upstreamed:5.2.36, missing in 5.3.x/6.x
+ # still needs to be patched in 6.0.20
+ epatch "${FILESDIR}"/${PN}-6.0.19-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
+
+ # 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
+}
+
+src_configure() {
+ # Add linker versions to the symbols. Easier to do, and safer than header file
+ # mumbo jumbo.
+ if use userland_GNU ; then
+ append-ldflags -Wl,--default-symver
+ fi
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=()
+
+ tc-ld-disable-gold #470634
+
+ # 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
+
+ # 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=/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} == arm ]] && echo --with-mutex=ARM/gcc-assembly) \
+ $([[ ${ABI} == amd64 ]] && echo --with-mutex=x86/gcc-assembly) \
+ $(use_enable cxx) \
+ $(use_enable cxx stl) \
+ $(multilib_native_use_enable java) \
+ "${myconf[@]}" \
+ $(use_enable test)
+}
+
+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 "${D}"/usr/"$(get_libdir)"/libdb_java*.so
+ java-pkg_dojar "${D}"/usr/"$(get_libdir)"/*.jar
+ rm -f "${D}"/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 "${D}"/usr/bin/berkeley_db_svc ]] ; then
+ mv "${D}"/usr/bin/berkeley_db_svc \
+ "${D}"/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/db-6.0.35.ebuild b/sys-libs/db/db-6.0.35.ebuild
new file mode 100644
index 000000000000..357f5ac8131d
--- /dev/null
+++ b/sys-libs/db/db-6.0.35.ebuild
@@ -0,0 +1,235 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils db flag-o-matic java-pkg-opt-2 autotools multilib multilib-minimal versionator 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
+
+S_BASE="${WORKDIR}/${MY_P}"
+S="${S_BASE}/build_unix"
+DESCRIPTION="Oracle Berkeley DB"
+HOMEPAGE="http://www.oracle.com/technology/software/products/berkeley-db/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="AGPL-3"
+SLOT="$(get_version_component_range 1-2)"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
+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 )
+ >=sys-devel/binutils-2.16.1"
+RDEPEND="tcl? ( >=dev-lang/tcl-8.5.15-r1:0=[${MULTILIB_USEDEP}] )
+ java? ( >=virtual/jre-1.5 )"
+
+MULTILIB_WRAPPED_HEADERS=(
+ /usr/include/db$(get_version_component_range 1-2)/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.3-listen-to-java-options.patch
+
+ # sqlite configure call has an extra leading ..
+ # upstreamed:5.2.36, missing in 5.3.x/6.x
+ # still needs to be patched in 6.0.20
+ epatch "${FILESDIR}"/${PN}-6.0.35-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
+
+ # 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
+}
+
+src_configure() {
+ # Add linker versions to the symbols. Easier to do, and safer than header file
+ # mumbo jumbo.
+ if use userland_GNU ; then
+ append-ldflags -Wl,--default-symver
+ fi
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=()
+
+ tc-ld-disable-gold #470634
+
+ # 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
+
+ # 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=/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} == arm ]] && echo --with-mutex=ARM/gcc-assembly) \
+ $([[ ${ABI} == amd64 ]] && echo --with-mutex=x86/gcc-assembly) \
+ $(use_enable cxx) \
+ $(use_enable cxx stl) \
+ $(multilib_native_use_enable java) \
+ "${myconf[@]}" \
+ $(use_enable test)
+}
+
+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 "${D}"/usr/"$(get_libdir)"/libdb_java*.so
+ java-pkg_dojar "${D}"/usr/"$(get_libdir)"/*.jar
+ rm -f "${D}"/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 "${D}"/usr/bin/berkeley_db_svc ]] ; then
+ mv "${D}"/usr/bin/berkeley_db_svc \
+ "${D}"/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/db-6.1.26.ebuild b/sys-libs/db/db-6.1.26.ebuild
new file mode 100644
index 000000000000..22cf36f227a6
--- /dev/null
+++ b/sys-libs/db/db-6.1.26.ebuild
@@ -0,0 +1,235 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils db flag-o-matic java-pkg-opt-2 autotools multilib multilib-minimal versionator 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
+
+S_BASE="${WORKDIR}/${MY_P}"
+S="${S_BASE}/build_unix"
+DESCRIPTION="Oracle Berkeley DB"
+HOMEPAGE="http://www.oracle.com/technology/software/products/berkeley-db/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="AGPL-3"
+SLOT="$(get_version_component_range 1-2)"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
+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 )
+ >=sys-devel/binutils-2.16.1"
+RDEPEND="tcl? ( >=dev-lang/tcl-8.5.15-r1:0=[${MULTILIB_USEDEP}] )
+ java? ( >=virtual/jre-1.5 )"
+
+MULTILIB_WRAPPED_HEADERS=(
+ /usr/include/db$(get_version_component_range 1-2)/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.3-listen-to-java-options.patch
+
+ # sqlite configure call has an extra leading ..
+ # upstreamed:5.2.36, missing in 5.3.x/6.x
+ # still needs to be patched in 6.0.20
+ epatch "${FILESDIR}"/${PN}-6.1.19-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
+
+ # 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
+}
+
+src_configure() {
+ # Add linker versions to the symbols. Easier to do, and safer than header file
+ # mumbo jumbo.
+ if use userland_GNU ; then
+ append-ldflags -Wl,--default-symver
+ fi
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=()
+
+ tc-ld-disable-gold #470634
+
+ # 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
+
+ # 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=/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} == arm ]] && echo --with-mutex=ARM/gcc-assembly) \
+ $([[ ${ABI} == amd64 ]] && echo --with-mutex=x86/gcc-assembly) \
+ $(use_enable cxx) \
+ $(use_enable cxx stl) \
+ $(multilib_native_use_enable java) \
+ "${myconf[@]}" \
+ $(use_enable test)
+}
+
+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 "${D}"/usr/"$(get_libdir)"/libdb_java*.so
+ java-pkg_dojar "${D}"/usr/"$(get_libdir)"/*.jar
+ rm -f "${D}"/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 "${D}"/usr/bin/berkeley_db_svc ]] ; then
+ mv "${D}"/usr/bin/berkeley_db_svc \
+ "${D}"/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-1.85-gentoo-paths.patch b/sys-libs/db/files/db-1.85-gentoo-paths.patch
new file mode 100644
index 000000000000..4a65106bdc70
--- /dev/null
+++ b/sys-libs/db/files/db-1.85-gentoo-paths.patch
@@ -0,0 +1,29 @@
+--- PORT/linux/Makefile
++++ PORT/linux/Makefile
+@@ -1,12 +1,12 @@
+ # @(#)Makefile 8.9 (Berkeley) 7/14/94
+
+-LIBDB= libdb.a
+-LIBDBSO=libdb.so
++LIBDB= libdb1.a
++LIBDBSO=libdb1.so
+ SOVER=2
+ SONAME=$(LIBDBSO).$(SOVER)
+ LIBNDBM=libndbm.a
+ LIBNDBMSO=libndbm.so
+-PROG= db_dump185
++PROG= db1_dump185
+ OBJ1= hash.o hash_bigkey.o hash_buf.o hash_func.o hash_log2.o hash_page.o \
+ ndbm.o
+ OBJ2= bt_close.o bt_conv.o bt_debug.o bt_delete.o bt_get.o bt_open.o \
+@@ -27,8 +27,8 @@
+ DESTDIR =
+ prefix = /usr
+ bindir = $(prefix)/bin
+-libdir = $(prefix)/lib
+-includedir = $(prefix)/include
++libdir = $(prefix)/@GENTOO_LIBDIR@
++includedir = $(prefix)/include/db1
+
+ all: $(LIBDB) $(LIBDBSO) $(PROG)
+
diff --git a/sys-libs/db/files/db-3.2.9-fix-dep-link.patch b/sys-libs/db/files/db-3.2.9-fix-dep-link.patch
new file mode 100644
index 000000000000..cdf6599b0d55
--- /dev/null
+++ b/sys-libs/db/files/db-3.2.9-fix-dep-link.patch
@@ -0,0 +1,26 @@
+--- db-3.2.9/dist/Makefile.in.orig 2003-02-23 23:41:13.000000000 +0200
++++ db-3.2.9/dist/Makefile.in 2003-02-23 23:42:07.000000000 +0200
+@@ -240,19 +240,19 @@
+
+ $(libso_target): $(OBJS)
+ $(SOLINK) $(SOFLAGS) -o $(libso_target) \
+- $(OBJS) $(LDFLAGS) $(LIBSO_LIBS)
++ $(OBJS) $(LDFLAGS) $(LIBS) $(LIBSO_LIBS)
+
+ $(libxso_target): $(COBJS) $(OBJS)
+ $(SOLINK) $(SOFLAGS) -o $(libxso_target) \
+- $(COBJS) $(OBJS) $(LDFLAGS) $(LIBXSO_LIBS)
++ $(COBJS) $(OBJS) $(LDFLAGS) $(LIBS) $(LIBXSO_LIBS)
+
+ $(libjso_target): $(JOBJS) $(OBJS)
+ $(SOLINK) $(SOFLAGS) -o $(libjso_target) \
+- $(JOBJS) $(OBJS) $(LDFLAGS) $(LIBJSO_LIBS)
++ $(JOBJS) $(OBJS) $(LDFLAGS) $(LIBS) $(LIBJSO_LIBS)
+
+ $(libtso_target): $(TOBJS) $(OBJS)
+ $(SOLINK) $(SOFLAGS) -o $(libtso_target) \
+- $(TOBJS) $(OBJS) $(LDFLAGS) $(LIBTSO_LIBS)
++ $(TOBJS) $(OBJS) $(LDFLAGS) $(LIBS) $(LIBTSO_LIBS)
+
+ ##################################################
+ # Creating individual dependencies and actions for building class
diff --git a/sys-libs/db/files/db-3.2.9-gcc43.patch b/sys-libs/db/files/db-3.2.9-gcc43.patch
new file mode 100644
index 000000000000..f032da85296a
--- /dev/null
+++ b/sys-libs/db/files/db-3.2.9-gcc43.patch
@@ -0,0 +1,16 @@
+diff -Nuar db-3.2.9.orig/include/db_cxx.h db-3.2.9/include/db_cxx.h
+--- db-3.2.9.orig/include/db_cxx.h 2001-01-11 10:28:55.000000000 -0800
++++ db-3.2.9/include/db_cxx.h 2008-08-16 16:10:48.474699646 -0700
+@@ -49,7 +49,12 @@
+ // Forward declarations
+ //
+
++#if defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)
++using namespace std;
++#include <iostream>
++#else
+ #include <iostream.h>
++#endif
+ #include <stdarg.h>
+ #include "db.h"
+
diff --git a/sys-libs/db/files/db-3.2.9-jarlocation.patch b/sys-libs/db/files/db-3.2.9-jarlocation.patch
new file mode 100644
index 000000000000..0654e2ef48e8
--- /dev/null
+++ b/sys-libs/db/files/db-3.2.9-jarlocation.patch
@@ -0,0 +1,12 @@
+diff -ur db-3.2.9.old/dist/Makefile.in db-3.2.9/dist/Makefile.in
+--- db-3.2.9.old/dist/Makefile.in 2003-10-18 02:21:18.000000000 -0700
++++ db-3.2.9/dist/Makefile.in 2003-10-18 02:22:14.000000000 -0700
+@@ -72,7 +72,7 @@
+ JAVA_DBDIR= $(JAVA_SRCDIR)/$(JAVA_DBREL)
+ JAVA_EXDIR= $(JAVA_SRCDIR)/com/sleepycat/examples
+
+-libj_jarfile= db.jar
++libj_jarfile= db-$(SOVERSION).jar
+ libjso_base= libdb_java
+ libjso= $(libjso_base)-$(SOVERSION).@SOSUFFIX@
+ libjso_target= $(libjso_base)-$(SOVERSION).la
diff --git a/sys-libs/db/files/db-3.2.9-java15.patch b/sys-libs/db/files/db-3.2.9-java15.patch
new file mode 100644
index 000000000000..5482831e317a
--- /dev/null
+++ b/sys-libs/db/files/db-3.2.9-java15.patch
@@ -0,0 +1,15 @@
+--- db-3.2.9/java/src/com/sleepycat/db/DbEnv.java.orig 2005-03-10 18:30:19.705147736 +0000
++++ db-3.2.9/java/src/com/sleepycat/db/DbEnv.java 2005-03-10 18:03:07.930215232 +0000
+@@ -78,9 +78,9 @@
+ //
+ /*package*/ void _notify_dbs()
+ {
+- Enumeration enum = dblist_.elements();
+- while (enum.hasMoreElements()) {
+- Db db = (Db)enum.nextElement();
++ Enumeration en = dblist_.elements();
++ while (en.hasMoreElements()) {
++ Db db = (Db)en.nextElement();
+ db._notify_dbenv_close();
+ }
+ dblist_.removeAllElements();
diff --git a/sys-libs/db/files/db-4.0.14-fix-dep-link.patch b/sys-libs/db/files/db-4.0.14-fix-dep-link.patch
new file mode 100644
index 000000000000..f54f064640e6
--- /dev/null
+++ b/sys-libs/db/files/db-4.0.14-fix-dep-link.patch
@@ -0,0 +1,38 @@
+--- db-4.0.14/dist/Makefile.in.orig 2003-08-16 06:21:53.763400112 +0200
++++ db-4.0.14/dist/Makefile.in 2003-08-16 06:23:16.036892640 +0200
+@@ -58,7 +58,7 @@
+
+ LDFLAGS= @LDFLAGS@
+ LIBS= @LIBS@
+-LIBSO_LIBS= @LIBSO_LIBS@
++LIBSO_LIBS= @LIBSO_LIBS@ $(LIBS)
+
+ libdb= libdb.a
+ libso_base= libdb
+@@ -77,7 +77,7 @@
+ CXX= @MAKEFILE_CXX@
+ CXXLINK= @MAKEFILE_CXXLINK@
+ XSOLINK= @MAKEFILE_XSOLINK@
+-LIBXSO_LIBS= @LIBXSO_LIBS@
++LIBXSO_LIBS= @LIBXSO_LIBS@ $(LIBS)
+
+ libcxx= libdb_cxx.a
+ libxso_base= libdb_cxx
+@@ -93,7 +93,7 @@
+ # Java support is optional and requires shared librarires.
+ ##################################################
+ CLASSPATH= $(JAVA_CLASSTOP)
+-LIBJSO_LIBS= @LIBJSO_LIBS@
++LIBJSO_LIBS= @LIBJSO_LIBS@ $(LIBS)
+
+ JAR= @JAR@
+ JAVAC= env CLASSPATH="$(CLASSPATH)" @JAVAC@
+@@ -121,7 +121,7 @@
+ # Tcl support is optional and requires shared libraries.
+ ##################################################
+ TCFLAGS= @TCFLAGS@
+-LIBTSO_LIBS= @LIBTSO_LIBS@
++LIBTSO_LIBS= @LIBTSO_LIBS@ $(LIBS)
+ libtso_base= libdb_tcl
+ libtso= $(libtso_base)-$(SOVERSION).@SOSUFFIX@
+ libtso_static= $(libtso_base)-$(SOVERSION).a
diff --git a/sys-libs/db/files/db-4.0.14-jarlocation.patch b/sys-libs/db/files/db-4.0.14-jarlocation.patch
new file mode 100644
index 000000000000..667a32b20d3a
--- /dev/null
+++ b/sys-libs/db/files/db-4.0.14-jarlocation.patch
@@ -0,0 +1,14 @@
+diff -ur db-4.0.14.old/dist/Makefile.in db-4.0.14/dist/Makefile.in
+--- db-4.0.14.old/dist/Makefile.in 2003-10-18 02:24:50.000000000 -0700
++++ db-4.0.14/dist/Makefile.in 2003-10-18 02:25:18.000000000 -0700
+@@ -105,8 +105,8 @@
+ JAVA_DBDIR= $(JAVA_SRCDIR)/$(JAVA_DBREL)
+ JAVA_EXDIR= $(JAVA_SRCDIR)/$(JAVA_EXREL)
+
+-libj_jarfile= db.jar
+-libj_exjarfile= dbexamples.jar
++libj_jarfile= db-$(SOVERSION).jar
++libj_exjarfile= dbexamples-$(SOVERSION).jar
+ libjso_base= libdb_java
+ libjso= $(libjso_base)-$(SOVERSION).@SOSUFFIX@
+ libjso_static= $(libjso_base)-$(SOVERSION).a
diff --git a/sys-libs/db/files/db-4.2-jarlocation.patch b/sys-libs/db/files/db-4.2-jarlocation.patch
new file mode 100644
index 000000000000..600f48a3a6d6
--- /dev/null
+++ b/sys-libs/db/files/db-4.2-jarlocation.patch
@@ -0,0 +1,16 @@
+diff -ur db-4.1.25.old/dist/Makefile.in db-4.1.25/dist/Makefile.in
+--- db-4.1.25.old/dist/Makefile.in 2003-10-18 02:15:45.000000000 -0700
++++ db-4.1.25/dist/Makefile.in 2003-10-18 02:13:47.000000000 -0700
+@@ -107,9 +107,9 @@
+ JAVA_EXDIR= $(JAVA_SRCDIR)/$(JAVA_EXREL)
+ JAVA_RPCDIR= $(srcdir)/rpc_server/java
+
+-libj_jarfile= db.jar
+-libj_exjarfile= dbexamples.jar
+-rpc_jarfile= dbsvc.jar
++libj_jarfile= db-4.2.jar
++libj_exjarfile= dbexamples-4.2.jar
++rpc_jarfile= dbsvc-4.2.jar
+ libjso_base= libdb_java
+ libjso= $(libjso_base)-$(SOVERSION).@JMODSUFFIX@
+ libjso_static= $(libjso_base)-$(SOVERSION).a
diff --git a/sys-libs/db/files/db-4.2-jni-check-prefix-first.patch b/sys-libs/db/files/db-4.2-jni-check-prefix-first.patch
new file mode 100644
index 000000000000..17f80e1bcfef
--- /dev/null
+++ b/sys-libs/db/files/db-4.2-jni-check-prefix-first.patch
@@ -0,0 +1,30 @@
+--- dist/aclocal_java/ac_jni_include_dirs.ac 2003-10-06 20:41:38.000000000 +0200
++++ dist/aclocal_java/ac_jni_include_dirs.ac 2005-09-23 21:31:26.000000000 +0200
+@@ -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.2-libtool.patch b/sys-libs/db/files/db-4.2-libtool.patch
new file mode 100644
index 000000000000..a4a9db7f4557
--- /dev/null
+++ b/sys-libs/db/files/db-4.2-libtool.patch
@@ -0,0 +1,20 @@
+--- ./dist/configure.orig 2004-09-22 22:58:48.421632944 -0700
++++ ./dist/configure 2004-09-22 23:02:55.068136976 -0700
+@@ -5657,7 +5657,7 @@
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+ # I'd rather use --version here, but apparently some GNU ld's only accept -v.
+-case `"$LD" -v 2>&1 </dev/null` in
++case `$LD -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+@@ -11135,7 +11135,7 @@
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+ # I'd rather use --version here, but apparently some GNU ld's only accept -v.
+-case `"$LD" -v 2>&1 </dev/null` in
++case `$LD -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
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
new file mode 100644
index 000000000000..8ddb46b70261
--- /dev/null
+++ b/sys-libs/db/files/db-4.2-listen-to-java-options.patch
@@ -0,0 +1,10 @@
+--- dist/configure.ac 2005-09-23 21:01:26.000000000 +0200
++++ dist/configure.ac 2005-09-23 20:59:20.000000000 +0200
+@@ -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.2.52_p2-TXN.patch b/sys-libs/db/files/db-4.2.52_p2-TXN.patch
new file mode 100644
index 000000000000..7ff8874c0ca8
--- /dev/null
+++ b/sys-libs/db/files/db-4.2.52_p2-TXN.patch
@@ -0,0 +1,68 @@
+This patch is intended to be applied to Berkeley DB 4.2.52 and,
+if applied, will automatically be used by slapd(8) back-bdb/hdb.
+Without this patch the BDB DB_LOG_AUTOREMOVE option will not work,
+nor will db_archive allow any transaction log files to be removed
+while slapd is running.
+
+The patch can be applied to the BDB source using patch(1) as follows
+ cd db-4.2.52
+ patch -p0 < openldap-src/build/BerkeleyDB42.patch
+
+(modify directory paths as necessary), then recompile and reinstall
+the BerkeleyDB 4.2 library, and then build and install OpenLDAP
+Software.
+
+The patch should not be applied to Berkeley DB 4.3.
+
+
+Index: dbinc/db.in
+===================================================================
+RCS file: /var/CVSROOT/bdb42/dbinc/db.in,v
+retrieving revision 1.1.1.1
+retrieving revision 1.2
+diff -u -r1.1.1.1 -r1.2
+--- dbinc/db.in 25 Nov 2003 21:58:02 -0000 1.1.1.1
++++ dbinc/db.in 17 Jul 2004 16:07:23 -0000 1.2
+@@ -839,6 +839,7 @@
+ #define TXN_NOWAIT 0x040 /* Do not wait on locks. */
+ #define TXN_RESTORED 0x080 /* Transaction has been restored. */
+ #define TXN_SYNC 0x100 /* Sync on prepare and commit. */
++#define TXN_NOLOG 0x200 /* Do not log this transaction. */
+ u_int32_t flags;
+ };
+
+Index: txn/txn.c
+===================================================================
+RCS file: /var/CVSROOT/bdb42/txn/txn.c,v
+retrieving revision 1.1.1.2
+retrieving revision 1.2
+diff -u -r1.1.1.2 -r1.2
+--- txn/txn.c 17 Dec 2003 21:43:53 -0000 1.1.1.2
++++ txn/txn.c 17 Jul 2004 16:07:27 -0000 1.2
+@@ -127,7 +127,7 @@
+ if ((ret = __db_fchk(dbenv,
+ "txn_begin", flags,
+ DB_DIRTY_READ | DB_TXN_NOWAIT |
+- DB_TXN_NOSYNC | DB_TXN_SYNC)) != 0)
++ DB_TXN_NOSYNC | DB_TXN_SYNC | DB_TXN_NOT_DURABLE)) != 0)
+ return (ret);
+ if ((ret = __db_fcchk(dbenv,
+ "txn_begin", flags, DB_TXN_NOSYNC, DB_TXN_SYNC)) != 0)
+@@ -193,6 +193,8 @@
+ F_SET(txn, TXN_SYNC);
+ if (LF_ISSET(DB_TXN_NOWAIT))
+ F_SET(txn, TXN_NOWAIT);
++ if (LF_ISSET(DB_TXN_NOT_DURABLE))
++ F_SET(txn, TXN_NOLOG);
+
+ if ((ret = __txn_begin_int(txn, 0)) != 0)
+ goto err;
+@@ -328,7 +330,7 @@
+ * We should set this value when we write the first log record, not
+ * here.
+ */
+- if (DBENV_LOGGING(dbenv))
++ if (DBENV_LOGGING(dbenv) && !F_ISSET(txn, TXN_NOLOG))
+ __log_txn_lsn(dbenv, &begin_lsn, NULL, NULL);
+ else
+ ZERO_LSN(begin_lsn);
diff --git a/sys-libs/db/files/db-4.3-jarlocation.patch b/sys-libs/db/files/db-4.3-jarlocation.patch
new file mode 100644
index 000000000000..17a342a7fca3
--- /dev/null
+++ b/sys-libs/db/files/db-4.3-jarlocation.patch
@@ -0,0 +1,16 @@
+diff -ur db-4.1.25.old/dist/Makefile.in db-4.1.25/dist/Makefile.in
+--- db-4.1.25.old/dist/Makefile.in 2003-10-18 02:15:45.000000000 -0700
++++ db-4.1.25/dist/Makefile.in 2003-10-18 02:13:47.000000000 -0700
+@@ -107,9 +107,9 @@
+ JAVA_EXDIR= $(JAVA_SRCDIR)/$(JAVA_EXREL)
+ JAVA_RPCDIR= $(srcdir)/rpc_server/java
+
+-libj_jarfile= db.jar
+-libj_exjarfile= dbexamples.jar
+-rpc_jarfile= dbsvc.jar
++libj_jarfile= db-4.3.jar
++libj_exjarfile= dbexamples-4.3.jar
++rpc_jarfile= dbsvc-4.3.jar
+ libjso_base= libdb_java
+ libjso= $(libjso_base)-$(SOVERSION).@JMODSUFFIX@
+ libjso_static= $(libjso_base)-$(SOVERSION).a
diff --git a/sys-libs/db/files/db-4.3-jni-check-prefix-first.patch b/sys-libs/db/files/db-4.3-jni-check-prefix-first.patch
new file mode 100644
index 000000000000..17f80e1bcfef
--- /dev/null
+++ b/sys-libs/db/files/db-4.3-jni-check-prefix-first.patch
@@ -0,0 +1,30 @@
+--- dist/aclocal_java/ac_jni_include_dirs.ac 2003-10-06 20:41:38.000000000 +0200
++++ dist/aclocal_java/ac_jni_include_dirs.ac 2005-09-23 21:31:26.000000000 +0200
+@@ -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.3-libtool.patch b/sys-libs/db/files/db-4.3-libtool.patch
new file mode 100644
index 000000000000..426fd519f714
--- /dev/null
+++ b/sys-libs/db/files/db-4.3-libtool.patch
@@ -0,0 +1,47 @@
+--- dist/configure.orig 2005-02-02 11:22:49.596096072 +0100
++++ dist/configure 2005-02-02 11:23:46.749407448 +0100
+@@ -5684,7 +5684,7 @@
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+ # I'd rather use --version here, but apparently some GNU ld's only accept -v.
+-case `$LD -v 2>&1 </dev/null` in
++case `"$LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+@@ -8461,7 +8461,7 @@
+ tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_cmds="$tmp_archive_cmds"
+ supports_anon_versioning=no
+- case `$LD -v 2>/dev/null` in
++ case `"$LD" -v 2>/dev/null` in
+ *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+@@ -11383,7 +11383,7 @@
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+ # I'd rather use --version here, but apparently some GNU ld's only accept -v.
+-case `$LD -v 2>&1 </dev/null` in
++case `"$LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+@@ -15353,7 +15353,7 @@
+ tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_cmds_F77="$tmp_archive_cmds"
+ supports_anon_versioning=no
+- case `$LD -v 2>/dev/null` in
++ case `"$LD" -v 2>/dev/null` in
+ *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+@@ -17695,7 +17695,7 @@
+ tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_cmds_GCJ="$tmp_archive_cmds"
+ supports_anon_versioning=no
+- case `$LD -v 2>/dev/null` in
++ case `"$LD" -v 2>/dev/null` in
+ *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
diff --git a/sys-libs/db/files/db-4.3-listen-to-java-options.patch b/sys-libs/db/files/db-4.3-listen-to-java-options.patch
new file mode 100644
index 000000000000..8ddb46b70261
--- /dev/null
+++ b/sys-libs/db/files/db-4.3-listen-to-java-options.patch
@@ -0,0 +1,10 @@
+--- dist/configure.ac 2005-09-23 21:01:26.000000000 +0200
++++ dist/configure.ac 2005-09-23 20:59:20.000000000 +0200
+@@ -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.3.27-fix-dep-link.patch b/sys-libs/db/files/db-4.3.27-fix-dep-link.patch
new file mode 100644
index 000000000000..1d14e83d078c
--- /dev/null
+++ b/sys-libs/db/files/db-4.3.27-fix-dep-link.patch
@@ -0,0 +1,38 @@
+--- db-4.3.27/dist/Makefile.in.chris 2005-02-01 23:40:34.447945464 +0100
++++ db-4.3.27/dist/Makefile.in 2005-02-01 23:42:21.635650456 +0100
+@@ -58,7 +58,7 @@
+ LDFLAGS= @LDFLAGS@
+ LIBS= @LIBS@
+ TEST_LIBS= @TEST_LIBS@
+-LIBSO_LIBS= @LIBSO_LIBS@
++LIBSO_LIBS= @LIBSO_LIBS@ $(LIBS)
+
+ libdb_base= libdb
+ libdb= $(libdb_base).a
+@@ -77,7 +77,7 @@
+ CXX= @MAKEFILE_CXX@
+ CXXLINK= @MAKEFILE_CXXLINK@ @CXXFLAGS@
+ XSOLINK= @MAKEFILE_XSOLINK@ @CXXFLAGS@
+-LIBXSO_LIBS= @LIBXSO_LIBS@
++LIBXSO_LIBS= @LIBXSO_LIBS@ $(LIBS)
+
+ libcxx_base= libdb_cxx
+ libcxx= $(libcxx_base).a
+@@ -93,7 +93,7 @@
+ # Java support is optional and requires shared librarires.
+ ##################################################
+ CLASSPATH= $(JAVA_CLASSTOP)
+-LIBJSO_LIBS= @LIBJSO_LIBS@
++LIBJSO_LIBS= @LIBJSO_LIBS@ $(LIBS)
+
+ JAR= @JAR@
+ JAVAC= env CLASSPATH="$(CLASSPATH)" @JAVAC@
+@@ -126,7 +126,7 @@
+ # Tcl support is optional and requires shared libraries.
+ ##################################################
+ TCFLAGS= @TCFLAGS@
+-LIBTSO_LIBS= @LIBTSO_LIBS@
++LIBTSO_LIBS= @LIBTSO_LIBS@ $(LIBS)
+ libtso_base= libdb_tcl
+ libtso= $(libtso_base)-$(LIBVERSION)@MODSUFFIX@
+ libtso_static= $(libtso_base)-$(LIBVERSION).a
diff --git a/sys-libs/db/files/db-4.4-jarlocation.patch b/sys-libs/db/files/db-4.4-jarlocation.patch
new file mode 100644
index 000000000000..2d4bd4e46032
--- /dev/null
+++ b/sys-libs/db/files/db-4.4-jarlocation.patch
@@ -0,0 +1,16 @@
+diff -ur db-4.1.25.old/dist/Makefile.in db-4.1.25/dist/Makefile.in
+--- db-4.1.25.old/dist/Makefile.in 2003-10-18 02:15:45.000000000 -0700
++++ db-4.1.25/dist/Makefile.in 2003-10-18 02:13:47.000000000 -0700
+@@ -107,9 +107,9 @@
+ JAVA_EXDIR= $(JAVA_SRCDIR)/$(JAVA_EXREL)
+ JAVA_RPCDIR= $(srcdir)/rpc_server/java
+
+-libj_jarfile= db.jar
+-libj_exjarfile= dbexamples.jar
+-rpc_jarfile= dbsvc.jar
++libj_jarfile= db-4.5.jar
++libj_exjarfile= dbexamples-4.5.jar
++rpc_jarfile= dbsvc-4.5.jar
+ libjso_base= libdb_java
+ libjso= $(libjso_base)-$(SOVERSION).@JMODSUFFIX@
+ libjso_static= $(libjso_base)-$(SOVERSION).a
diff --git a/sys-libs/db/files/db-4.4-libtool.patch b/sys-libs/db/files/db-4.4-libtool.patch
new file mode 100644
index 000000000000..3d86b88f86b3
--- /dev/null
+++ b/sys-libs/db/files/db-4.4-libtool.patch
@@ -0,0 +1,47 @@
+--- dist/configure.orig 2006-01-31 10:23:58.000000000 +0100
++++ dist/configure 2006-01-31 10:26:43.000000000 +0100
+@@ -5765,7 +5765,7 @@
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+ # I'd rather use --version here, but apparently some GNU lds only accept -v.
+-case `$LD -v 2>&1 </dev/null` in
++case `"$LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+@@ -8753,7 +8753,7 @@
+ whole_archive_flag_spec=
+ fi
+ supports_anon_versioning=no
+- case `$LD -v 2>/dev/null` in
++ case `"$LD" -v 2>/dev/null` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+@@ -11855,7 +11855,7 @@
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+ # I'd rather use --version here, but apparently some GNU lds only accept -v.
+-case `$LD -v 2>&1 </dev/null` in
++case `"$LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+@@ -15842,7 +15842,7 @@
+ whole_archive_flag_spec_F77=
+ fi
+ supports_anon_versioning=no
+- case `$LD -v 2>/dev/null` in
++ case `"$LD" -v 2>/dev/null` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+@@ -18300,7 +18300,7 @@
+ whole_archive_flag_spec_GCJ=
+ fi
+ supports_anon_versioning=no
+- case `$LD -v 2>/dev/null` in
++ case `"$LD" -v 2>/dev/null` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
diff --git a/sys-libs/db/files/db-4.5-jarlocation.patch b/sys-libs/db/files/db-4.5-jarlocation.patch
new file mode 100644
index 000000000000..c0d689f43691
--- /dev/null
+++ b/sys-libs/db/files/db-4.5-jarlocation.patch
@@ -0,0 +1,16 @@
+diff -ur db-4.1.25.old/dist/Makefile.in db-4.1.25/dist/Makefile.in
+--- db-4.1.25.old/dist/Makefile.in 2003-10-18 02:15:45.000000000 -0700
++++ db-4.1.25/dist/Makefile.in 2003-10-18 02:13:47.000000000 -0700
+@@ -107,9 +107,9 @@
+ JAVA_EXDIR= $(JAVA_SRCDIR)/$(JAVA_EXREL)
+ JAVA_RPCDIR= $(srcdir)/rpc_server/java
+
+-libj_jarfile= db.jar
+-libj_exjarfile= dbexamples.jar
+-rpc_jarfile= dbsvc.jar
++libj_jarfile= db-4.4.jar
++libj_exjarfile= dbexamples-4.4.jar
++rpc_jarfile= dbsvc-4.4.jar
+ libjso_base= libdb_java
+ libjso= $(libjso_base)-$(SOVERSION).@JMODSUFFIX@
+ libjso_static= $(libjso_base)-$(SOVERSION).a
diff --git a/sys-libs/db/files/db-4.5-libtool.patch b/sys-libs/db/files/db-4.5-libtool.patch
new file mode 100644
index 000000000000..3d86b88f86b3
--- /dev/null
+++ b/sys-libs/db/files/db-4.5-libtool.patch
@@ -0,0 +1,47 @@
+--- dist/configure.orig 2006-01-31 10:23:58.000000000 +0100
++++ dist/configure 2006-01-31 10:26:43.000000000 +0100
+@@ -5765,7 +5765,7 @@
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+ # I'd rather use --version here, but apparently some GNU lds only accept -v.
+-case `$LD -v 2>&1 </dev/null` in
++case `"$LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+@@ -8753,7 +8753,7 @@
+ whole_archive_flag_spec=
+ fi
+ supports_anon_versioning=no
+- case `$LD -v 2>/dev/null` in
++ case `"$LD" -v 2>/dev/null` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+@@ -11855,7 +11855,7 @@
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+ # I'd rather use --version here, but apparently some GNU lds only accept -v.
+-case `$LD -v 2>&1 </dev/null` in
++case `"$LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+@@ -15842,7 +15842,7 @@
+ whole_archive_flag_spec_F77=
+ fi
+ supports_anon_versioning=no
+- case `$LD -v 2>/dev/null` in
++ case `"$LD" -v 2>/dev/null` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+@@ -18300,7 +18300,7 @@
+ whole_archive_flag_spec_GCJ=
+ fi
+ supports_anon_versioning=no
+- case `$LD -v 2>/dev/null` in
++ case `"$LD" -v 2>/dev/null` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
diff --git a/sys-libs/db/files/db-4.6-jarlocation.patch b/sys-libs/db/files/db-4.6-jarlocation.patch
new file mode 100644
index 000000000000..c0d689f43691
--- /dev/null
+++ b/sys-libs/db/files/db-4.6-jarlocation.patch
@@ -0,0 +1,16 @@
+diff -ur db-4.1.25.old/dist/Makefile.in db-4.1.25/dist/Makefile.in
+--- db-4.1.25.old/dist/Makefile.in 2003-10-18 02:15:45.000000000 -0700
++++ db-4.1.25/dist/Makefile.in 2003-10-18 02:13:47.000000000 -0700
+@@ -107,9 +107,9 @@
+ JAVA_EXDIR= $(JAVA_SRCDIR)/$(JAVA_EXREL)
+ JAVA_RPCDIR= $(srcdir)/rpc_server/java
+
+-libj_jarfile= db.jar
+-libj_exjarfile= dbexamples.jar
+-rpc_jarfile= dbsvc.jar
++libj_jarfile= db-4.4.jar
++libj_exjarfile= dbexamples-4.4.jar
++rpc_jarfile= dbsvc-4.4.jar
+ libjso_base= libdb_java
+ libjso= $(libjso_base)-$(SOVERSION).@JMODSUFFIX@
+ libjso_static= $(libjso_base)-$(SOVERSION).a
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
new file mode 100644
index 000000000000..63735e62469f
--- /dev/null
+++ b/sys-libs/db/files/db-4.6-jni-check-prefix-first.patch
@@ -0,0 +1,30 @@
+--- dist/aclocal_java/ac_jni_include_dirs.m4 2003-10-06 20:41:38.000000000 +0200
++++ dist/aclocal_java/ac_jni_include_dirs.m4 2005-09-23 21:31:26.000000000 +0200
+@@ -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.6-libtool.patch b/sys-libs/db/files/db-4.6-libtool.patch
new file mode 100644
index 000000000000..3d86b88f86b3
--- /dev/null
+++ b/sys-libs/db/files/db-4.6-libtool.patch
@@ -0,0 +1,47 @@
+--- dist/configure.orig 2006-01-31 10:23:58.000000000 +0100
++++ dist/configure 2006-01-31 10:26:43.000000000 +0100
+@@ -5765,7 +5765,7 @@
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+ # I'd rather use --version here, but apparently some GNU lds only accept -v.
+-case `$LD -v 2>&1 </dev/null` in
++case `"$LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+@@ -8753,7 +8753,7 @@
+ whole_archive_flag_spec=
+ fi
+ supports_anon_versioning=no
+- case `$LD -v 2>/dev/null` in
++ case `"$LD" -v 2>/dev/null` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+@@ -11855,7 +11855,7 @@
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+ # I'd rather use --version here, but apparently some GNU lds only accept -v.
+-case `$LD -v 2>&1 </dev/null` in
++case `"$LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+@@ -15842,7 +15842,7 @@
+ whole_archive_flag_spec_F77=
+ fi
+ supports_anon_versioning=no
+- case `$LD -v 2>/dev/null` in
++ case `"$LD" -v 2>/dev/null` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+@@ -18300,7 +18300,7 @@
+ whole_archive_flag_spec_GCJ=
+ fi
+ supports_anon_versioning=no
+- case `$LD -v 2>/dev/null` in
++ case `"$LD" -v 2>/dev/null` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
diff --git a/sys-libs/db/files/db-4.8-libtool.patch b/sys-libs/db/files/db-4.8-libtool.patch
new file mode 100644
index 000000000000..f5d985b2f209
--- /dev/null
+++ b/sys-libs/db/files/db-4.8-libtool.patch
@@ -0,0 +1,65 @@
+--- dist/configure
++++ dist/configure
+@@ -6691,7 +6691,7 @@
+ $as_echo_n "(cached) " >&6
+ else
+ # I'd rather use --version here, but apparently some GNU lds only accept -v.
+-case `$LD -v 2>&1 </dev/null` in
++case `"$LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+@@ -7348,7 +7348,7 @@
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+- case $LD in
++ case "$LD" in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+@@ -10664,7 +10664,7 @@
+ whole_archive_flag_spec=
+ fi
+ supports_anon_versioning=no
+- case `$LD -v 2>&1` in
++ case `"$LD" -v 2>&1` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+@@ -10858,7 +10858,7 @@
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+- case `$LD -v 2>&1` in
++ case `"$LD" -v 2>&1` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+@@ -12206,7 +12206,7 @@
+ libsuff= shlibsuff=
+ ;;
+ *)
+- case $LD in # libtool.m4 will add one of these switches to LD
++ case "$LD" in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+ libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+@@ -13423,7 +13423,7 @@
+ $as_echo_n "(cached) " >&6
+ else
+ # I'd rather use --version here, but apparently some GNU lds only accept -v.
+-case `$LD -v 2>&1 </dev/null` in
++case `"$LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+@@ -15672,7 +15672,7 @@
+ libsuff= shlibsuff=
+ ;;
+ *)
+- case $LD in # libtool.m4 will add one of these switches to LD
++ case "$LD" in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+ libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
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
new file mode 100644
index 000000000000..9cebadc52064
--- /dev/null
+++ 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-4.8.30-rename-atomic-compare-exchange.patch b/sys-libs/db/files/db-4.8.30-rename-atomic-compare-exchange.patch
new file mode 100644
index 000000000000..c53160a82970
--- /dev/null
+++ b/sys-libs/db/files/db-4.8.30-rename-atomic-compare-exchange.patch
@@ -0,0 +1,22 @@
+diff --git a/dbinc/atomic.h b/dbinc/atomic.h
+index 0034dcc..fa7ba93 100644
+--- a/dbinc/atomic.h
++++ b/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.0.21-enable-dbm-autoconf.patch b/sys-libs/db/files/db-5.0.21-enable-dbm-autoconf.patch
new file mode 100644
index 000000000000..5405206fc516
--- /dev/null
+++ b/sys-libs/db/files/db-5.0.21-enable-dbm-autoconf.patch
@@ -0,0 +1,49 @@
+The autoconf from upstream never built DBM even if you wanted it, because
+enable_build_dbm was never true with --enable-dbm. The only time you actually
+got it before was when you had selected the testsuite.
+
+Fixed up that, and the entire reversed logic, and just throw away the useless
+db_cv_build_dbm variable entirely.
+
+Correct logic is:
+if(--enable-dbm || --enable-test) {
+ Build DBM
+}
+
+Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
+
+diff -Nuar db-5.0.21.orig//dist/aclocal/options.m4 db-5.0.21//dist/aclocal/options.m4
+--- db-5.0.21.orig//dist/aclocal/options.m4 2010-03-30 10:36:10.000000000 -0700
++++ db-5.0.21//dist/aclocal/options.m4 2010-05-13 13:49:23.889947877 -0700
+@@ -274,15 +274,11 @@
+ AC_MSG_RESULT($db_cv_test)
+
+ AC_MSG_CHECKING(if --enable-dbm option specified)
+-AC_ARG_ENABLE(build_dbm,
++AC_ARG_ENABLE(dbm,
+ [AC_HELP_STRING([--enable-dbm],
+ [Configure to enable the historic dbm interface.])],
+- [db_cv_build_dbm="$enable_dbm"], enableval="$db_cv_test")
+-db_cv_build_dbm="$enableval"
+-case "$enableval" in
+- no) AC_MSG_RESULT(yes);;
+-yes) AC_MSG_RESULT(no);;
+-esac
++ [db_cv_dbm="$enable_dbm"], [db_cv_dbm="$db_cv_test"])
++AC_MSG_RESULT($db_cv_dbm)
+
+ AC_MSG_CHECKING(if --enable-dtrace option specified)
+ AC_ARG_ENABLE(dtrace,
+diff -Nuar db-5.0.21.orig//dist/configure.ac db-5.0.21//dist/configure.ac
+--- db-5.0.21.orig//dist/configure.ac 2010-05-13 13:41:26.415822427 -0700
++++ db-5.0.21//dist/configure.ac 2010-05-13 13:48:59.185822961 -0700
+@@ -973,7 +973,8 @@
+ fi
+
+ # The DBM API can be disabled.
+-if test "$db_cv_build_dbm" = "yes"; then
++
++if test "$db_cv_dbm" = "yes"; then
+ AC_DEFINE(HAVE_DBM)
+ AH_TEMPLATE(HAVE_DBM, [Define to 1 if building the DBM API.])
+ ADDITIONAL_OBJS="$ADDITIONAL_OBJS dbm${o} hsearch${o}"
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
new file mode 100644
index 000000000000..ff7abbe1fd79
--- /dev/null
+++ 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.19-sqlite-configure-path.patch b/sys-libs/db/files/db-6.0.19-sqlite-configure-path.patch
new file mode 100644
index 000000000000..78a2ba3ea8aa
--- /dev/null
+++ b/sys-libs/db/files/db-6.0.19-sqlite-configure-path.patch
@@ -0,0 +1,11 @@
+--- db-6.0.19/dist/aclocal/sql.m4
++++ db-6.0.19/dist/aclocal/sql.m4
+@@ -96,7 +96,7 @@
+ if test "$db_cv_build_cryptography" = "yes"; then
+ CPPFLAGS="$CPPFLAGS -DSQLITE_HAS_CODEC=1"
+ fi
+-(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
+ CPPFLAGS="$orig_CPPFLAGS"
+
+ # Configure JDBC if --enable-jdbc
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
new file mode 100644
index 000000000000..8aceaa4d6f8c
--- /dev/null
+++ 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.
diff --git a/sys-libs/db/files/db-6.0.35-sqlite-configure-path.patch b/sys-libs/db/files/db-6.0.35-sqlite-configure-path.patch
new file mode 100644
index 000000000000..c239bb118a82
--- /dev/null
+++ b/sys-libs/db/files/db-6.0.35-sqlite-configure-path.patch
@@ -0,0 +1,11 @@
+--- db-6.0.35/dist/aclocal/sql.m4
++++ db-6.0.35/dist/aclocal/sql.m4
+@@ -96,7 +96,7 @@
+ if test "$db_cv_build_cryptography" = "yes"; then
+ CPPFLAGS="$CPPFLAGS -DSQLITE_HAS_CODEC=1"
+ fi
+-(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.1.19-sqlite-configure-path.patch b/sys-libs/db/files/db-6.1.19-sqlite-configure-path.patch
new file mode 100644
index 000000000000..25854c53e160
--- /dev/null
+++ b/sys-libs/db/files/db-6.1.19-sqlite-configure-path.patch
@@ -0,0 +1,10 @@
+--- db-6.1.19/dist/aclocal/sql.m4
++++ db-6.1.19/dist/aclocal/sql.m4
+@@ -96,6 +96,6 @@
+ if test "$db_cv_build_cryptography" = "yes"; then
+ CPPFLAGS="$CPPFLAGS -DSQLITE_HAS_CODEC=1"
+ fi
+-(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
diff --git a/sys-libs/db/metadata.xml b/sys-libs/db/metadata.xml
new file mode 100644
index 000000000000..74fb0c9417a7
--- /dev/null
+++ b/sys-libs/db/metadata.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>base-system</herd>
+<longdescription>The Berkeley Database (Berkeley DB) is a programmatic toolkit
+that provides embedded database support for both traditional and client/server
+applications. Berkeley DB includes b+tree, queue, extended linear hashing,
+fixed, and variable-length record access methods, transactions, locking,
+logging, shared memory caching and database recovery. DB supports C, C++, Java,
+and Perl APIs. DB is available for a wide variety of UNIX platforms as well as
+Windows NT and Windows '95 (MSVC 4, 5 and 6).</longdescription>
+<longdescription lang="nl">De Berkeley Database is een programmatische toolkit
+die embedded database support verzorg voor en traditionele en client/server
+applicaties. Berkeley DB bevat b+tree, rij, uitgebreide lineaire hashing, vaste
+en variabele lengte record toegangsmethoden, transacties, locking, logging,
+gedeeld geheugen caching en database herstel. DB ondersteund C, C++, Java en
+Perl API's. DB is beschikbaar voor veel UNIX platformen en
+Windows.</longdescription>
+<use>
+ <flag name='rpc'>Enable rpc client/server</flag>
+</use>
+</pkgmetadata>
+
diff --git a/sys-libs/e2fsprogs-libs/Manifest b/sys-libs/e2fsprogs-libs/Manifest
new file mode 100644
index 000000000000..f289e0b29ec0
--- /dev/null
+++ b/sys-libs/e2fsprogs-libs/Manifest
@@ -0,0 +1,3 @@
+DIST e2fsprogs-libs-1.41.7.tar.gz 494463 SHA256 b6d9c9ec405ad1d644cf35d57f0f1e878fa6af6ad45b97683de847ff49cbdf84 SHA512 01bf6571efc3b63b985bb45190553cbf0e486ddcf022715a2bdf36eb3e45ffada603ed52bf17d6920b9dc3e98ffc6758d2481a83b68bbf5d946c76173f7d14a8 WHIRLPOOL 058fc1278ff2427d956728ad2d132652e80b60570c20c904c6d6e2a15c4a9d00ec13340ad56114f82dd703ee87cd576c2f69eb3d40f1f16743430476c3e383b1
+DIST e2fsprogs-libs-1.42.12.tar.gz 604947 SHA256 ca0a562b9b35f340d849f68977d1158ac9d92d9e77d97e2a85b8383e949dcd7b SHA512 2de9e828b5f123236505ae83cbfef906ca23f875dd15f5b7d8cbac9f59722e31c7304e5a92a326b42b71186ea5eb18550aac2986c45e70176047a5b1774b260a WHIRLPOOL 177ef831b978ea5febce5b87c98216843463df5a292705f93129dd8609f6ada345b45910c85248f1f70685b073d95531c63512366e4e407158bf1467781c9f24
+DIST e2fsprogs-libs-1.42.13.tar.gz 605222 SHA256 79ad28c14ffd12083d8c4efea04cff7d175faf070de03d29bc580b5f1b669a14 SHA512 803ec87f9b3926c1f423cac424dc7fe2bfbaa3237a93023fe0213b88e35b933090299304be1c47d876d9d14487acadea3e8b9a926dab24733dbe6ee3f1d846e0 WHIRLPOOL 0adb43e1dd0ea476729dfd455430d1b803e96985c6a190ec518e57f628da6c9a85e2389f877026492f3b757db2d470a175e54db9d608ec586536854e21c7462f
diff --git a/sys-libs/e2fsprogs-libs/e2fsprogs-libs-1.41.7.ebuild b/sys-libs/e2fsprogs-libs/e2fsprogs-libs-1.41.7.ebuild
new file mode 100644
index 000000000000..9a355c2daa32
--- /dev/null
+++ b/sys-libs/e2fsprogs-libs/e2fsprogs-libs-1.41.7.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="2"
+
+inherit flag-o-matic toolchain-funcs multilib
+
+DESCRIPTION="e2fsprogs libraries (common error, subsystem, uuid, block id)"
+HOMEPAGE="http://e2fsprogs.sourceforge.net/"
+SRC_URI="mirror://sourceforge/e2fsprogs/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+IUSE="nls"
+
+RDEPEND="!sys-libs/com_err
+ !sys-libs/ss
+ !<sys-fs/e2fsprogs-1.41"
+DEPEND="nls? ( sys-devel/gettext )
+ virtual/pkgconfig"
+
+src_prepare() {
+ # stupid configure script clobbers CC for us
+ sed -i '/if test -z "$CC" ; then CC=cc; fi/d' configure
+}
+
+src_configure() {
+ # We want to use the "bsd" libraries while building on Darwin, but while
+ # building on other Gentoo/*BSD we prefer elf-naming scheme.
+ local libtype
+ case ${CHOST} in
+ *-darwin*) libtype=bsd;;
+ *) libtype=elf;;
+ esac
+
+ ac_cv_path_LDCONFIG=: \
+ econf \
+ --enable-${libtype}-shlibs \
+ $(tc-has-tls || echo --disable-tls) \
+ $(use_enable nls)
+}
+
+src_install() {
+ emake STRIP=: DESTDIR="${D}" install || die
+
+ set -- "${D}"/usr/$(get_libdir)/*.a
+ set -- ${@/*\/lib}
+ gen_usr_ldscript -a "${@/.a}"
+}
diff --git a/sys-libs/e2fsprogs-libs/e2fsprogs-libs-1.42.12.ebuild b/sys-libs/e2fsprogs-libs/e2fsprogs-libs-1.42.12.ebuild
new file mode 100644
index 000000000000..1c268c24c09b
--- /dev/null
+++ b/sys-libs/e2fsprogs-libs/e2fsprogs-libs-1.42.12.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+case ${PV} in
+*_pre*) UP_PV="${PV%_pre*}-WIP-${PV#*_pre}" ;;
+*) UP_PV=${PV} ;;
+esac
+
+inherit toolchain-funcs eutils multilib-minimal
+
+DESCRIPTION="e2fsprogs libraries (common error and subsystem)"
+HOMEPAGE="http://e2fsprogs.sourceforge.net/"
+SRC_URI="mirror://sourceforge/e2fsprogs/${PN}-${UP_PV}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~arm-linux ~x86-linux ~m68k-mint ~x86-solaris"
+IUSE="nls static-libs"
+
+RDEPEND="!sys-libs/com_err
+ !sys-libs/ss
+ !<sys-fs/e2fsprogs-1.41.8
+ abi_x86_32? (
+ !<=app-emulation/emul-linux-x86-baselibs-20130224-r12
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ )"
+DEPEND="nls? ( sys-devel/gettext )
+ virtual/pkgconfig"
+
+S=${WORKDIR}/${P%_pre*}
+
+src_prepare() {
+ printf 'all:\n%%:;@:\n' > doc/Makefile.in # don't bother with docs #305613
+ epatch "${FILESDIR}"/${PN}-1.42.9-no-quota.patch
+ epatch "${FILESDIR}"/${PN}-1.42.10-fix-build-cflags.patch #516854
+}
+
+multilib_src_configure() {
+ local myconf=()
+ # we use blkid/uuid from util-linux now
+ if use kernel_linux ; then
+ export ac_cv_lib_{uuid_uuid_generate,blkid_blkid_get_cache}=yes
+ myconf+=( --disable-lib{blkid,uuid} )
+ fi
+ ac_cv_path_LDCONFIG=: \
+ ECONF_SOURCE="${S}" \
+ CC="$(tc-getCC)" \
+ BUILD_CC="$(tc-getBUILD_CC)" \
+ BUILD_LD="$(tc-getBUILD_LD)" \
+ econf \
+ --disable-quota \
+ $(tc-is-static-only || echo --enable-elf-shlibs) \
+ $(tc-has-tls || echo --disable-tls) \
+ $(use_enable nls) \
+ "${myconf[@]}"
+}
+
+multilib_src_compile() {
+ emake V=1
+}
+
+multilib_src_install() {
+ emake V=1 STRIP=: DESTDIR="${D}" install || die
+ multilib_is_native_abi && gen_usr_ldscript -a com_err ss $(usex kernel_linux '' 'uuid blkid')
+ # configure doesn't have an option to disable static libs :/
+ use static-libs || find "${ED}" -name '*.a' -delete
+}
diff --git a/sys-libs/e2fsprogs-libs/e2fsprogs-libs-1.42.13.ebuild b/sys-libs/e2fsprogs-libs/e2fsprogs-libs-1.42.13.ebuild
new file mode 100644
index 000000000000..7b69b47b63c7
--- /dev/null
+++ b/sys-libs/e2fsprogs-libs/e2fsprogs-libs-1.42.13.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+case ${PV} in
+*_pre*) UP_PV="${PV%_pre*}-WIP-${PV#*_pre}" ;;
+*) UP_PV=${PV} ;;
+esac
+
+inherit toolchain-funcs eutils multilib-minimal
+
+DESCRIPTION="e2fsprogs libraries (common error and subsystem)"
+HOMEPAGE="http://e2fsprogs.sourceforge.net/"
+SRC_URI="mirror://sourceforge/e2fsprogs/${PN}-${UP_PV}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~arm-linux ~x86-linux ~m68k-mint ~x86-solaris"
+IUSE="nls static-libs"
+
+RDEPEND="!sys-libs/com_err
+ !sys-libs/ss
+ !<sys-fs/e2fsprogs-1.41.8
+ abi_x86_32? (
+ !<=app-emulation/emul-linux-x86-baselibs-20130224-r12
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ )"
+DEPEND="nls? ( sys-devel/gettext )
+ virtual/pkgconfig"
+
+S=${WORKDIR}/${P%_pre*}
+
+src_prepare() {
+ printf 'all:\n%%:;@:\n' > doc/Makefile.in # don't bother with docs #305613
+ epatch "${FILESDIR}"/${PN}-1.42.9-no-quota.patch
+ epatch "${FILESDIR}"/${PN}-1.42.13-fix-build-cflags.patch #516854
+}
+
+multilib_src_configure() {
+ local myconf=()
+ # we use blkid/uuid from util-linux now
+ if use kernel_linux ; then
+ export ac_cv_lib_{uuid_uuid_generate,blkid_blkid_get_cache}=yes
+ myconf+=( --disable-lib{blkid,uuid} )
+ fi
+ ac_cv_path_LDCONFIG=: \
+ ECONF_SOURCE="${S}" \
+ CC="$(tc-getCC)" \
+ BUILD_CC="$(tc-getBUILD_CC)" \
+ BUILD_LD="$(tc-getBUILD_LD)" \
+ econf \
+ --disable-quota \
+ $(tc-is-static-only || echo --enable-elf-shlibs) \
+ $(tc-has-tls || echo --disable-tls) \
+ $(use_enable nls) \
+ "${myconf[@]}"
+}
+
+multilib_src_compile() {
+ emake V=1
+}
+
+multilib_src_install() {
+ emake V=1 STRIP=: DESTDIR="${D}" install || die
+ multilib_is_native_abi && gen_usr_ldscript -a com_err ss $(usex kernel_linux '' 'uuid blkid')
+ # configure doesn't have an option to disable static libs :/
+ use static-libs || find "${ED}" -name '*.a' -delete
+}
diff --git a/sys-libs/e2fsprogs-libs/files/e2fsprogs-libs-1.42.10-fix-build-cflags.patch b/sys-libs/e2fsprogs-libs/files/e2fsprogs-libs-1.42.10-fix-build-cflags.patch
new file mode 100644
index 000000000000..69e6f358d9e1
--- /dev/null
+++ b/sys-libs/e2fsprogs-libs/files/e2fsprogs-libs-1.42.10-fix-build-cflags.patch
@@ -0,0 +1,13 @@
+https://bugs.gentoo.org/516854
+
+--- a/e2fsprogs-libs-1.42.10/configure
++++ b/e2fsprogs-libs-1.42.10/configure
+@@ -1328,7 +1328,7 @@
+ BUILD_CFLAGS="$CFLAGS $CPPFLAGS $INCLUDES -DHAVE_CONFIG_H"
+ BUILD_LDFLAGS="$LDFLAGS"
+ else
+- BUILD_CFLAGS=
++ BUILD_CFLAGS="$INCLUDES"
+ BUILD_LDFLAGS=
+ fi
+
diff --git a/sys-libs/e2fsprogs-libs/files/e2fsprogs-libs-1.42.13-fix-build-cflags.patch b/sys-libs/e2fsprogs-libs/files/e2fsprogs-libs-1.42.13-fix-build-cflags.patch
new file mode 100644
index 000000000000..a87f0c697eab
--- /dev/null
+++ b/sys-libs/e2fsprogs-libs/files/e2fsprogs-libs-1.42.13-fix-build-cflags.patch
@@ -0,0 +1,13 @@
+https://bugs.gentoo.org/516854
+
+--- e2fsprogs-libs-1.42.13/configure
++++ e2fsprogs-libs-1.42.13/configure
+@@ -1315,6 +1315,8 @@
+ if test $cross_compiling = no; then
+ BUILD_CFLAGS="$CFLAGS $CPPFLAGS $INCLUDES -DHAVE_CONFIG_H"
+ BUILD_LDFLAGS="$LDFLAGS"
++else
++ BUILD_CFLAGS="$INCLUDES"
+ fi
+
+
diff --git a/sys-libs/e2fsprogs-libs/files/e2fsprogs-libs-1.42.9-no-quota.patch b/sys-libs/e2fsprogs-libs/files/e2fsprogs-libs-1.42.9-no-quota.patch
new file mode 100644
index 000000000000..0b472806c777
--- /dev/null
+++ b/sys-libs/e2fsprogs-libs/files/e2fsprogs-libs-1.42.9-no-quota.patch
@@ -0,0 +1,36 @@
+From 947b1fe6c67b2399edd436c74408cb354c381e4a Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Tue, 31 Dec 2013 13:35:05 -0500
+Subject: [PATCH] fix build when quota is disabled
+
+Building e2fsprogs-libs with quota disabled fails:
+
+making all in lib/quota
+make[2]: Entering directory '.../lib/quota'
+make[2]: *** No rule to make target '.../lib/ext2fs/ext2_fs.h', needed by 'mkquota.o'. Stop.
+make[2]: *** Waiting for unfinished jobs....
+make[2]: Leaving directory '.../lib/quota'
+Makefile:380: recipe for target 'all-libs-recursive' failed
+make[1]: *** [all-libs-recursive] Error 1
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ Makefile.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index f327d19..544ed02 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -13,7 +13,7 @@ INSTALL = @INSTALL@
+ @DEBUGFS_CMT@DEBUGFS_DIR= debugfs
+ @UUID_CMT@UUID_LIB_SUBDIR= lib/uuid
+ @BLKID_CMT@BLKID_LIB_SUBDIR= lib/blkid
+-QUOTA_LIB_SUBDIR= lib/quota
++@QUOTA_CMT@QUOTA_LIB_SUBDIR= lib/quota
+
+ LIB_SUBDIRS=lib/et lib/ss lib/e2p $(UUID_LIB_SUBDIR) lib/ext2fs $(BLKID_LIB_SUBDIR) $(QUOTA_LIB_SUBDIR) intl
+ PROG_SUBDIRS=e2fsck $(DEBUGFS_DIR) misc $(RESIZE_DIR) tests/progs po
+--
+1.8.4.3
+
diff --git a/sys-libs/e2fsprogs-libs/metadata.xml b/sys-libs/e2fsprogs-libs/metadata.xml
new file mode 100644
index 000000000000..ab7b3fa6a367
--- /dev/null
+++ b/sys-libs/e2fsprogs-libs/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>base-system</herd>
+ <upstream>
+ <remote-id type="sourceforge">e2fsprogs</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-libs/efivar/Manifest b/sys-libs/efivar/Manifest
new file mode 100644
index 000000000000..965c81d1e28d
--- /dev/null
+++ b/sys-libs/efivar/Manifest
@@ -0,0 +1,3 @@
+DIST efivar-0.15.tar.bz2 26936 SHA256 08251e10dbee8a5a9851d859b98fc6cb479acfced38695a101bd8ed2a447051e SHA512 f6fbc71fa892366933f11f230f662ff7af515bcee3d4eb0279a3aeb6aa5bf21d86f86db928ff3cb4ed3366f52bd3fb8b959752759277ed4bf368a5fc223d62e9 WHIRLPOOL 8fd6a689b14aed7d8a9ed7d17fe4206416d5bb72d04843dab7de22c513cc0ad639daa8dad0de4c87e60164092d3c31c8d25973be03e20add99018c9a122bb9be
+DIST efivar-0.20.tar.bz2 66165 SHA256 cf699c1406c6d012ab0665f653b2f1a14d99edd8e2bf06f5ac2caa1b10e030a9 SHA512 c50de9cb8bad49eeaf00721c1bcea060a5c3486574bbba891a51eaff81bd12e764bf42b56c94c8b483359e082365848198a88d67b7c82df4c39c09fb47ce7474 WHIRLPOOL af760446f24832702f6b6d65dd6bbb9ccfede45680aac7bd9700619522bb5e774b1d24386aa74a879cd4cf6fdfa7362bb19b390aa519b3b9e8fc651b5af20951
+DIST efivar-0.21.tar.bz2 66677 SHA256 04b9b9de9d9a1a013395400438a033daf4a4290f497ec5be04a120e2ac535094 SHA512 851b5e29c2dab213bb81c6ea5c5c211d36fb6846de8aa1086b0657f06917c2f93bf154aa3a4c2dda22103bdf1d67ca877f9771dc3f979c9311ca24e0bc09492a WHIRLPOOL d6cdb2e2f047a22677d046581490ee4e64a2ac0631be8e41bf6250241b2554f62ddf81226fa3970ee80ebb9ec62665ca21f4fec94cc5ebe05414b0c674ad38dd
diff --git a/sys-libs/efivar/efivar-0.15.ebuild b/sys-libs/efivar/efivar-0.15.ebuild
new file mode 100644
index 000000000000..77e7c4c5dc20
--- /dev/null
+++ b/sys-libs/efivar/efivar-0.15.ebuild
@@ -0,0 +1,23 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit multilib toolchain-funcs
+
+DESCRIPTION="Tools and library to manipulate EFI variables"
+HOMEPAGE="https://github.com/rhinstaller/efivar"
+SRC_URI="https://github.com/rhinstaller/${PN}/releases/download/${PV}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ia64 x86"
+
+RDEPEND="dev-libs/popt"
+DEPEND="${RDEPEND}"
+
+src_configure() {
+ tc-export CC
+ export libdir="/usr/$(get_libdir)"
+}
diff --git a/sys-libs/efivar/efivar-0.20.ebuild b/sys-libs/efivar/efivar-0.20.ebuild
new file mode 100644
index 000000000000..5a1e5d2153f6
--- /dev/null
+++ b/sys-libs/efivar/efivar-0.20.ebuild
@@ -0,0 +1,23 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit multilib toolchain-funcs
+
+DESCRIPTION="Tools and library to manipulate EFI variables"
+HOMEPAGE="https://github.com/rhinstaller/efivar"
+SRC_URI="https://github.com/rhinstaller/${PN}/releases/download/${PV}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ia64 ~x86"
+
+RDEPEND="dev-libs/popt"
+DEPEND="${RDEPEND}"
+
+src_configure() {
+ tc-export CC
+ export libdir="/usr/$(get_libdir)"
+}
diff --git a/sys-libs/efivar/efivar-0.21.ebuild b/sys-libs/efivar/efivar-0.21.ebuild
new file mode 100644
index 000000000000..bce0f4e84662
--- /dev/null
+++ b/sys-libs/efivar/efivar-0.21.ebuild
@@ -0,0 +1,27 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils multilib toolchain-funcs
+
+DESCRIPTION="Tools and library to manipulate EFI variables"
+HOMEPAGE="https://github.com/rhinstaller/efivar"
+SRC_URI="https://github.com/rhinstaller/${PN}/releases/download/${PV}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ia64 ~x86"
+
+RDEPEND="dev-libs/popt"
+DEPEND="${RDEPEND}"
+
+src_prepare() {
+ epatch "${FILESDIR}/0.21-initializer.patch"
+}
+
+src_configure() {
+ tc-export CC
+ export libdir="/usr/$(get_libdir)"
+}
diff --git a/sys-libs/efivar/files/0.21-initializer.patch b/sys-libs/efivar/files/0.21-initializer.patch
new file mode 100644
index 000000000000..25d065968318
--- /dev/null
+++ b/sys-libs/efivar/files/0.21-initializer.patch
@@ -0,0 +1,42 @@
+From a3606c02fd271d32e364fcc540e34ba1899309f6 Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones@redhat.com>
+Date: Tue, 14 Jul 2015 09:33:54 -0400
+Subject: [PATCH] Sometimes the compiler doesn't like { 0, } as an
+ initializer...
+
+Because it really wants to be { {0, },} or something, and sometimes the
+compiler, knowing full well what we're trying to do, likes to complain
+about the rigor applied to our technique in doing it.
+
+memset() the struct ifreq to 0 instead so I don't need to figure out its
+internal structure just to zero it out.
+
+Resolves #28
+
+Signed-off-by: Peter Jones <pjones@redhat.com>
+---
+ src/linux.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/linux.c b/src/linux.c
+index 57f71f3..817b8e6 100644
+--- a/src/linux.c
++++ b/src/linux.c
+@@ -847,12 +847,13 @@ ssize_t
+ __attribute__((__visibility__ ("hidden")))
+ make_mac_path(uint8_t *buf, ssize_t size, const char * const ifname)
+ {
+- struct ifreq ifr = { 0, };
++ struct ifreq ifr;
+ struct ethtool_drvinfo drvinfo = { 0, };
+ int fd, rc;
+ ssize_t ret = -1, sz, off=0;
+ char busname[PATH_MAX+1] = "";
+
++ memset(&ifr, 0, sizeof (ifr));
+ strncpy(ifr.ifr_name, ifname, IF_NAMESIZE);
+ drvinfo.cmd = ETHTOOL_GDRVINFO;
+ ifr.ifr_data = (caddr_t)&drvinfo;
+--
+2.4.6
+
diff --git a/sys-libs/efivar/metadata.xml b/sys-libs/efivar/metadata.xml
new file mode 100644
index 000000000000..4d06771db586
--- /dev/null
+++ b/sys-libs/efivar/metadata.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>floppym@gentoo.org</email>
+ <name>Mike Gilbert</name>
+ </maintainer>
+ <maintainer>
+ <email>yannick.schaeffer@epfl.ch</email>
+ <name>Yannick Schaeffer</name>
+ </maintainer>
+ <herd>proxy-maintainers</herd>
+ <upstream>
+ <remote-id type="github">vathpela/efivar</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-libs/fortify-headers/Manifest b/sys-libs/fortify-headers/Manifest
new file mode 100644
index 000000000000..1b7be043b7d7
--- /dev/null
+++ b/sys-libs/fortify-headers/Manifest
@@ -0,0 +1,3 @@
+DIST fortify-headers-0.4.tar.gz 5610 SHA256 fedfbd951bf4d4bd30d32bef20710d6124c004037df52059a274c090c1f11a0a SHA512 669bf35df5278d4557caa2c8f28e33fe3e4a03c4267eed2cc8638dcb8e705d8797e487fbb524d9ff919e2752f1dc817cef9d41f14ceb46d520661e3d2301c5f2 WHIRLPOOL 2c3907913455417af3503d4b5cbea9afb8d374d954199cb58d4911c0af18c8078f45fd3d82b4184063127572fab023c4317734c484ccff75da5703d535d6a104
+DIST fortify-headers-0.5.tar.gz 5365 SHA256 4564f0ee9cb7c789b5a827d21a0d3b6da9df61fcb7ba31b711999f638e9e913a SHA512 951e3a5771c3cf9b2fe248e62badfc6699f0a05b8967f3982d279de8473501c66a6d1c17d7b42c90ef8bd303c06a642d7bdfea334caef892c90a15c45d4bb1c4 WHIRLPOOL 7e39879569746523688d0c6ea44bcf105a6e589c128341bcb7d8dc68c34cbfc344cd0f204b751364112a1e2340c26355931bef3538369bcfedf4b25e2050d04c
+DIST fortify-headers-0.6.tar.gz 5339 SHA256 e3baedbd1a2ca612faf83f3c87c50eeb33b31c663948cfb3ca04300751d86b68 SHA512 6106219332515e7c23354d916383cdac6efccba7eefa13b0c2c221d0fd03be7afb29b3a8622bd29b62ee0b602f9d1f273e1a08c07583bdcd12db9938ef4d7acc WHIRLPOOL 833aa8df26e1e28ec064ba0592dab42ee63e8fe794d095085ed544c7232855646790257c9b1c4d3a4af34873de9b1fcce222c3f665da3221c36ca5130cc88bc7
diff --git a/sys-libs/fortify-headers/fortify-headers-0.4.ebuild b/sys-libs/fortify-headers/fortify-headers-0.4.ebuild
new file mode 100644
index 000000000000..73494d4530e8
--- /dev/null
+++ b/sys-libs/fortify-headers/fortify-headers-0.4.ebuild
@@ -0,0 +1,22 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+DESCRIPTION="A standalone implementation of fortify source."
+HOMEPAGE="http://git.2f30.org/fortify-headers/"
+SRC_URI="http://git.2f30.org/fortify-headers/snapshot/fortify-headers-${PV}.tar.gz"
+
+LICENSE="ISC"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~mips ~ppc ~x86"
+IUSE=""
+
+DEPEND=""
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+ sed -i -e 's|^PREFIX = /usr/local|PREFIX = /usr|g' Makefile
+ export DESTDIR="${D}"
+}
diff --git a/sys-libs/fortify-headers/fortify-headers-0.5.ebuild b/sys-libs/fortify-headers/fortify-headers-0.5.ebuild
new file mode 100644
index 000000000000..2d8096ef9d8a
--- /dev/null
+++ b/sys-libs/fortify-headers/fortify-headers-0.5.ebuild
@@ -0,0 +1,28 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://git.2f30.org/fortify-headers"
+ inherit git-2
+else
+ SRC_URI="http://git.2f30.org/fortify-headers/snapshot/fortify-headers-${PV}.tar.gz"
+ KEYWORDS="~amd64 ~arm ~mips ~ppc ~x86"
+fi
+
+DESCRIPTION="A standalone implementation of fortify source."
+HOMEPAGE="http://git.2f30.org/fortify-headers/"
+
+LICENSE="ISC"
+SLOT="0"
+IUSE=""
+
+DEPEND=""
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+ sed -i -e 's|^PREFIX = /usr/local|PREFIX = /usr|g' Makefile
+ export DESTDIR="${D}"
+}
diff --git a/sys-libs/fortify-headers/fortify-headers-0.6.ebuild b/sys-libs/fortify-headers/fortify-headers-0.6.ebuild
new file mode 100644
index 000000000000..2d8096ef9d8a
--- /dev/null
+++ b/sys-libs/fortify-headers/fortify-headers-0.6.ebuild
@@ -0,0 +1,28 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://git.2f30.org/fortify-headers"
+ inherit git-2
+else
+ SRC_URI="http://git.2f30.org/fortify-headers/snapshot/fortify-headers-${PV}.tar.gz"
+ KEYWORDS="~amd64 ~arm ~mips ~ppc ~x86"
+fi
+
+DESCRIPTION="A standalone implementation of fortify source."
+HOMEPAGE="http://git.2f30.org/fortify-headers/"
+
+LICENSE="ISC"
+SLOT="0"
+IUSE=""
+
+DEPEND=""
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+ sed -i -e 's|^PREFIX = /usr/local|PREFIX = /usr|g' Makefile
+ export DESTDIR="${D}"
+}
diff --git a/sys-libs/fortify-headers/fortify-headers-9999.ebuild b/sys-libs/fortify-headers/fortify-headers-9999.ebuild
new file mode 100644
index 000000000000..2d8096ef9d8a
--- /dev/null
+++ b/sys-libs/fortify-headers/fortify-headers-9999.ebuild
@@ -0,0 +1,28 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://git.2f30.org/fortify-headers"
+ inherit git-2
+else
+ SRC_URI="http://git.2f30.org/fortify-headers/snapshot/fortify-headers-${PV}.tar.gz"
+ KEYWORDS="~amd64 ~arm ~mips ~ppc ~x86"
+fi
+
+DESCRIPTION="A standalone implementation of fortify source."
+HOMEPAGE="http://git.2f30.org/fortify-headers/"
+
+LICENSE="ISC"
+SLOT="0"
+IUSE=""
+
+DEPEND=""
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+ sed -i -e 's|^PREFIX = /usr/local|PREFIX = /usr|g' Makefile
+ export DESTDIR="${D}"
+}
diff --git a/sys-libs/fortify-headers/metadata.xml b/sys-libs/fortify-headers/metadata.xml
new file mode 100644
index 000000000000..1e7587374fdf
--- /dev/null
+++ b/sys-libs/fortify-headers/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>blueness@gentoo.org</email>
+ <name>Anthony G. Basile</name>
+ </maintainer>
+</pkgmetadata>
diff --git a/sys-libs/freeipmi/Manifest b/sys-libs/freeipmi/Manifest
new file mode 100644
index 000000000000..4d265f6fe304
--- /dev/null
+++ b/sys-libs/freeipmi/Manifest
@@ -0,0 +1,4 @@
+DIST freeipmi-1.2.2.tar.gz 3031730 SHA256 c8539a8225616e3e647b99903ef1243c5a6a4e1c7bd009399bd8bacf3b263b9c SHA512 86ea9a073ec275b3594e93c7e7fdef2b7214dcd3e696fdec4a017841d4bb7e2179a407d91aa11b26c952cf5b06262801b41293642ed38220d57112a37878a5f4 WHIRLPOOL 763a46cea7bfd1a5e18fae79094a73bd86173a73a8b8d150b3f938bc51c8da6c18db5105ece7ca8f3821254de19bc4e2b2429aac66b260c36426f789be176243
+DIST freeipmi-1.4.3.tar.gz 3089282 SHA256 2d8701555f7fd5c3cdc0186e2e435d2ed7945047d22b66088f1e5417dcc35386 SHA512 88a2dec70696017407aac313628407200ee2c6600547fbff73c6880ae8d65cda166c8e00e0f4b7eaddc35f4376143b8fdb0b4ac284aba401c2592a95804e6cec WHIRLPOOL 36c05750f58d018768c82b2a9531892c8c933a7f7b92ea4513dd3527d27494993f82b59d621558bc2975585f51bc6b555b85e246bec1e79704947ac7591cf08b
+DIST freeipmi-1.4.6.tar.gz 3182413 SHA256 6e404329378aed4ea2078575d7a8787820da3c8e1412b309ab8643f0284626af SHA512 52561ffe0c7b8d29431be6d89b4f4072361c8543a877f005a0190682dbdc739c716b6cfba4e6c6ac26324a94930c5d90554dd06bfd7310f723f8e7dd32432fe3 WHIRLPOOL 391ba17833d64e450bf6e273c7bcca8fdf036ff612f1a3d2be2bb1bbfc3e2dff418f997e78fcdc32571dae40077c2e3089d1002717ee61c8cd4d93dc8b1d42d4
+DIST freeipmi-1.4.8.tar.gz 3185068 SHA256 9fa7e9df7f848445cf6035b26b4167a79711ecc05d8e96ab16bbec10b36e551b SHA512 3cd4acde402bbc945b007e31e7f8dad3ad4539d2cf00310e9168d7cec8024203a280c8ad91e3f08b86dfa9be536779969c5393c4523df2fe8eb904f765fcfc56 WHIRLPOOL ae4393fd36271238597f1602fbaaa6c975268291d26ae3303d9bb1b447cc40070ff4c66ac56a7c301f0544f69ab54eb49a9c6f81fdbdc83ab4d89f3f253b3701
diff --git a/sys-libs/freeipmi/files/bmc-watchdog.confd b/sys-libs/freeipmi/files/bmc-watchdog.confd
new file mode 100644
index 000000000000..4d39cf4d8b7d
--- /dev/null
+++ b/sys-libs/freeipmi/files/bmc-watchdog.confd
@@ -0,0 +1,44 @@
+#
+# This configuration file controls the behaviour of the bmc-watchdog daemon
+# from FreeIPMI.
+#
+# -u INT, --timer-use=INT
+# Set timer use. The timer use value can be set to one of the
+# following: 1 = BIOS FRB2, 2 = BIOS POST, 3 = OS_LOAD, 4 = SMS
+# OS, 5 = OEM.
+#
+# -p INT, --pre-timeout-interrupt=INT
+# Set pre-timeout interrupt. The pre timeout interrupt can be set
+# to one of the following: 0 = None, 1 = SMI, 2 = NMI, 3 = Messag-
+# ing Interrupt.
+#
+# -a INT, --timeout-action=INT
+# Set timeout action. The timeout action can be set to one of the
+# following: 0 = No action, 1 = Hard Reset, 2 = Power Down, 3 =
+# Power Cycle.
+#
+# -F, --clear-bios-frb2
+# Clear BIOS FRB2 Timer Use Flag.
+#
+# -P, --clear-bios-post
+# Clear BIOS POST Timer Use Flag.
+#
+# -L, --clear-os-load
+# Clear OS Load Timer Use Flag.
+#
+# -S, --clear-sms-os
+# Clear SMS/OS Timer Use Flag.
+#
+# -O, --clear-oem
+# Clear OEM Timer Use Flag.
+#
+# -i SECS, --initial-countdown=SECS
+# Set initial countdown in seconds.
+#
+# -e, --reset-period
+# Time interval to wait before resetting timer. The default is 60
+# seconds.
+#
+# For the remaining options, consult man bmc-watchdog
+#
+OPTIONS="-d -u 4 -p 0 -a 1 -F -P -L -S -O -i 900 -e 60"
diff --git a/sys-libs/freeipmi/files/bmc-watchdog.initd.3 b/sys-libs/freeipmi/files/bmc-watchdog.initd.3
new file mode 100644
index 000000000000..e662c9537aae
--- /dev/null
+++ b/sys-libs/freeipmi/files/bmc-watchdog.initd.3
@@ -0,0 +1,15 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+extra_commands="condrestart"
+description_condrestart="Restart the service only if started already"
+
+command="/usr/sbin/${SVCNAME}"
+command_args="${OPTIONS}"
+pidfile=/var/run/$SVCNAME.pid
+
+condrestart() {
+ service_started && restart
+}
diff --git a/sys-libs/freeipmi/files/bmc-watchdog.initd.4 b/sys-libs/freeipmi/files/bmc-watchdog.initd.4
new file mode 100644
index 000000000000..88999eddc99e
--- /dev/null
+++ b/sys-libs/freeipmi/files/bmc-watchdog.initd.4
@@ -0,0 +1,20 @@
+#!/sbin/runscript
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+extra_commands="condrestart"
+description_condrestart="Restart the service only if started already"
+
+command="/usr/sbin/${SVCNAME}"
+command_args="${OPTIONS}"
+pidfile=/var/run/$SVCNAME.pid
+
+depend() {
+ need localmount
+ use logger
+}
+
+condrestart() {
+ service_started && restart
+}
diff --git a/sys-libs/freeipmi/files/freeipmi-1.1.1-strictaliasing.patch b/sys-libs/freeipmi/files/freeipmi-1.1.1-strictaliasing.patch
new file mode 100644
index 000000000000..ecbb77f216fb
--- /dev/null
+++ b/sys-libs/freeipmi/files/freeipmi-1.1.1-strictaliasing.patch
@@ -0,0 +1,13 @@
+diff -Nuar freeipmi-1.1.1.orig/libfreeipmi/Makefile.am freeipmi-1.1.1/libfreeipmi/Makefile.am
+--- freeipmi-1.1.1.orig/libfreeipmi/Makefile.am 2012-01-02 19:26:00.000000000 +0000
++++ freeipmi-1.1.1/libfreeipmi/Makefile.am 2012-01-21 20:26:26.957801741 +0000
+@@ -25,7 +25,8 @@
+ -DIPMI_IPCKEY=\"$(localstatedir)/lib/$(PACKAGE_NAME)/ipckey\" \
+ -DIPMI_DEBUG_IPCKEY=\"$(top_builddir)/libfreeipmi/driver/ipmi-semaphores.h\" \
+ -D_GNU_SOURCE \
+- -D_REENTRANT
++ -D_REENTRANT \
++ -fno-strict-aliasing
+
+ libfreeipmi_la_LDFLAGS = \
+ -version-info @LIBFREEIPMI_VERSION_INFO@ $(VERSION_FLAGS) \
diff --git a/sys-libs/freeipmi/files/freeipmi.icinga b/sys-libs/freeipmi/files/freeipmi.icinga
new file mode 100644
index 000000000000..4c4026c72b87
--- /dev/null
+++ b/sys-libs/freeipmi/files/freeipmi.icinga
@@ -0,0 +1,4 @@
+define command {
+ command_name nagios_ipmi_sensors
+ command_line $USER1$/nagios_ipmi_sensors.pl -h $HOSTADDRESS$
+}
diff --git a/sys-libs/freeipmi/files/ipmidetectd.confd b/sys-libs/freeipmi/files/ipmidetectd.confd
new file mode 100644
index 000000000000..74245f14c0c5
--- /dev/null
+++ b/sys-libs/freeipmi/files/ipmidetectd.confd
@@ -0,0 +1,5 @@
+# This configuration file controls the behaviour of the ipmid daemon
+# from FreeIPMI.
+# See `man 8 ipmitdetectd` for further information.
+
+# OPTIONS="-c /etc/freeipmi/ipmidetectd.conf"
diff --git a/sys-libs/freeipmi/files/ipmiseld.confd b/sys-libs/freeipmi/files/ipmiseld.confd
new file mode 100644
index 000000000000..8e40a5c0c8dc
--- /dev/null
+++ b/sys-libs/freeipmi/files/ipmiseld.confd
@@ -0,0 +1,5 @@
+# This configuration file controls the behaviour of the ipmiseld daemon
+# from FreeIPMI.
+# See `man 8 ipmiseld` for further information.
+
+# OPTIONS="--config-file /etc/freeipmi/ipmiseld.conf"
diff --git a/sys-libs/freeipmi/freeipmi-1.2.2.ebuild b/sys-libs/freeipmi/freeipmi-1.2.2.ebuild
new file mode 100644
index 000000000000..a607f57d6449
--- /dev/null
+++ b/sys-libs/freeipmi/freeipmi-1.2.2.ebuild
@@ -0,0 +1,82 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit autotools eutils
+
+DESCRIPTION="Provides Remote-Console and System Management Software as per IPMI v1.5/2.0"
+HOMEPAGE="http://www.gnu.org/software/freeipmi/"
+
+MY_P="${P/_/.}"
+S="${WORKDIR}"/${MY_P}
+[[ ${MY_P} == *.beta* ]] && ALPHA="-alpha"
+SRC_URI="mirror://gnu${ALPHA}/${PN}/${MY_P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="debug"
+
+RDEPEND="dev-libs/libgcrypt:0"
+DEPEND="${RDEPEND}
+ virtual/os-headers"
+RDEPEND="${RDEPEND}
+ sys-apps/openrc"
+
+src_prepare() {
+ epatch \
+ "${FILESDIR}"/${PN}-1.1.1-strictaliasing.patch
+
+ AT_M4DIR="config" eautoreconf
+}
+
+src_configure() {
+ econf \
+ $(use_enable debug) \
+ --disable-dependency-tracking \
+ --enable-fast-install \
+ --disable-static \
+ --disable-init-scripts \
+ --localstatedir=/var
+}
+
+# There are no tests
+src_test() { :; }
+
+src_install() {
+ emake DESTDIR="${D}" docdir="/usr/share/doc/${PF}" install
+ find "${D}" -name '*.la' -delete
+
+ # freeipmi by defaults install _all_ commands to /usr/sbin, but
+ # quite a few can be run remotely as standard user, so move them
+ # in /usr/bin afterwards.
+ dodir /usr/bin
+ for file in ipmi{detect,ping,power,console}; do
+ mv "${D}"/usr/{s,}bin/${file} || die
+
+ # The default install symlinks these commands to add a dash
+ # after the ipmi prefix; we repeat those after move for
+ # consistency.
+ rm "${D}"/usr/sbin/${file/ipmi/ipmi-}
+ dosym ${file} /usr/bin/${file/ipmi/ipmi-}
+ done
+
+ dodoc AUTHORS ChangeLog* DISCLAIMER* NEWS README* TODO doc/*.txt
+
+ keepdir \
+ /var/cache/ipmimonitoringsdrcache \
+ /var/lib/freeipmi \
+ /var/log/ipmiconsole
+
+ # starting from version 1.2.0 the two daemons are similar enough
+ newinitd "${FILESDIR}"/bmc-watchdog.initd.4 ipmidetectd
+ newconfd "${FILESDIR}"/ipmidetectd.confd ipmidetectd
+
+ newinitd "${FILESDIR}"/bmc-watchdog.initd.4 bmc-watchdog
+ newconfd "${FILESDIR}"/bmc-watchdog.confd bmc-watchdog
+
+ newinitd "${FILESDIR}"/bmc-watchdog.initd.4 ipmiseld
+ newconfd "${FILESDIR}"/ipmiseld.confd ipmiseld
+}
diff --git a/sys-libs/freeipmi/freeipmi-1.4.3.ebuild b/sys-libs/freeipmi/freeipmi-1.4.3.ebuild
new file mode 100644
index 000000000000..181b80bf5956
--- /dev/null
+++ b/sys-libs/freeipmi/freeipmi-1.4.3.ebuild
@@ -0,0 +1,96 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit autotools eutils multilib autotools-utils
+
+DESCRIPTION="Provides Remote-Console and System Management Software as per IPMI v1.5/2.0"
+HOMEPAGE="http://www.gnu.org/software/freeipmi/"
+
+MY_P="${P/_/.}"
+S="${WORKDIR}"/${MY_P}
+[[ ${MY_P} == *.beta* ]] && ALPHA="-alpha"
+SRC_URI="mirror://gnu${ALPHA}/${PN}/${MY_P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="amd64 ~x86"
+IUSE="debug nagios"
+
+RDEPEND="dev-libs/libgcrypt:0"
+DEPEND="${RDEPEND}
+ virtual/os-headers"
+RDEPEND="${RDEPEND}
+ nagios? (
+ || ( net-analyzer/icinga net-analyzer/nagios )
+ dev-lang/perl
+ )
+ sys-apps/openrc"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-1.1.1-strictaliasing.patch
+
+ AT_M4DIR="config" eautoreconf
+}
+
+src_configure() {
+ local myeconfargs=(
+ $(use_enable debug)
+ --disable-static
+ --disable-init-scripts
+ --localstatedir=/var
+ )
+
+ autotools-utils_src_configure
+}
+
+# There are no tests
+src_test() { :; }
+
+src_install() {
+ autotools-utils_src_install
+
+ # freeipmi by defaults install _all_ commands to /usr/sbin, but
+ # quite a few can be run remotely as standard user, so move them
+ # in /usr/bin afterwards.
+ dodir /usr/bin
+ for file in ipmi{detect,ping,power,console}; do
+ mv "${D}"/usr/{s,}bin/${file} || die
+
+ # The default install symlinks these commands to add a dash
+ # after the ipmi prefix; we repeat those after move for
+ # consistency.
+ rm "${D}"/usr/sbin/${file/ipmi/ipmi-}
+ dosym ${file} /usr/bin/${file/ipmi/ipmi-}
+ done
+
+ # Install the nagios plugin in its proper place, if desired
+ if use nagios; then
+ dodir /usr/$(get_libdir)/nagios/plugins
+ mv "${D}"/usr/share/doc/${PF}/contrib/nagios/nagios_ipmi_sensors.pl \
+ "${D}"/usr/$(get_libdir)/nagios/plugins/ || die
+ fperms 0755 /usr/$(get_libdir)/nagios/plugins/nagios_ipmi_sensors.pl
+
+ insinto /etc/icinga/conf.d
+ newins "${FILESDIR}"/freeipmi.icinga freeipmi-command.cfg
+ fi
+
+ dodoc AUTHORS ChangeLog* DISCLAIMER* NEWS README* TODO doc/*.txt
+
+ keepdir \
+ /var/cache/ipmimonitoringsdrcache \
+ /var/lib/freeipmi \
+ /var/log/ipmiconsole
+
+ # starting from version 1.2.0 the two daemons are similar enough
+ newinitd "${FILESDIR}"/bmc-watchdog.initd.4 ipmidetectd
+ newconfd "${FILESDIR}"/ipmidetectd.confd ipmidetectd
+
+ newinitd "${FILESDIR}"/bmc-watchdog.initd.4 bmc-watchdog
+ newconfd "${FILESDIR}"/bmc-watchdog.confd bmc-watchdog
+
+ newinitd "${FILESDIR}"/bmc-watchdog.initd.4 ipmiseld
+ newconfd "${FILESDIR}"/ipmiseld.confd ipmiseld
+}
diff --git a/sys-libs/freeipmi/freeipmi-1.4.6-r1.ebuild b/sys-libs/freeipmi/freeipmi-1.4.6-r1.ebuild
new file mode 100644
index 000000000000..6ee1c3ea7d03
--- /dev/null
+++ b/sys-libs/freeipmi/freeipmi-1.4.6-r1.ebuild
@@ -0,0 +1,93 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+#AUTOTOOLS_AUTORECONF=1
+AT_M4DIR="config"
+
+inherit eutils multilib autotools-utils
+
+DESCRIPTION="Provides Remote-Console and System Management Software as per IPMI v1.5/2.0"
+HOMEPAGE="http://www.gnu.org/software/freeipmi/"
+
+MY_P="${P/_/.}"
+S="${WORKDIR}"/${MY_P}
+[[ ${MY_P} == *.beta* ]] && ALPHA="-alpha"
+SRC_URI="mirror://gnu${ALPHA}/${PN}/${MY_P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="debug nagios"
+
+RDEPEND="dev-libs/libgcrypt:0"
+DEPEND="${RDEPEND}
+ virtual/os-headers"
+RDEPEND="${RDEPEND}
+ nagios? (
+ || ( net-analyzer/icinga net-analyzer/nagios )
+ dev-lang/perl
+ )
+ sys-apps/openrc"
+
+src_configure() {
+ local myeconfargs=(
+ $(use_enable debug)
+ --disable-static
+ --disable-init-scripts
+ --localstatedir=/var
+ )
+
+ autotools-utils_src_configure
+}
+
+# There are no tests
+src_test() { :; }
+
+src_install() {
+ autotools-utils_src_install
+
+ # freeipmi by defaults install _all_ commands to /usr/sbin, but
+ # quite a few can be run remotely as standard user, so move them
+ # in /usr/bin afterwards.
+ dodir /usr/bin
+ for file in ipmi{detect,ping,power,console}; do
+ mv "${D}"/usr/{s,}bin/${file} || die
+
+ # The default install symlinks these commands to add a dash
+ # after the ipmi prefix; we repeat those after move for
+ # consistency.
+ rm "${D}"/usr/sbin/${file/ipmi/ipmi-}
+ dosym ${file} /usr/bin/${file/ipmi/ipmi-}
+ done
+
+ # Install the nagios plugin in its proper place, if desired
+ if use nagios; then
+ dodir /usr/$(get_libdir)/nagios/plugins
+ mv "${D}"/usr/share/doc/${PF}/contrib/nagios/nagios_ipmi_sensors.pl \
+ "${D}"/usr/$(get_libdir)/nagios/plugins/ || die
+ fperms 0755 /usr/$(get_libdir)/nagios/plugins/nagios_ipmi_sensors.pl
+
+ insinto /etc/icinga/conf.d
+ newins "${FILESDIR}"/freeipmi.icinga freeipmi-command.cfg
+ fi
+
+ dodoc AUTHORS ChangeLog* DISCLAIMER* NEWS README* TODO doc/*.txt
+
+ keepdir \
+ /var/cache/ipmimonitoringsdrcache \
+ /var/lib/freeipmi \
+ /var/log/ipmiconsole
+
+ # starting from version 1.2.0 the two daemons are similar enough
+ newinitd "${FILESDIR}"/bmc-watchdog.initd.4 ipmidetectd
+ newconfd "${FILESDIR}"/ipmidetectd.confd ipmidetectd
+
+ newinitd "${FILESDIR}"/bmc-watchdog.initd.4 bmc-watchdog
+ newconfd "${FILESDIR}"/bmc-watchdog.confd bmc-watchdog
+
+ newinitd "${FILESDIR}"/bmc-watchdog.initd.4 ipmiseld
+ newconfd "${FILESDIR}"/ipmiseld.confd ipmiseld
+}
diff --git a/sys-libs/freeipmi/freeipmi-1.4.8.ebuild b/sys-libs/freeipmi/freeipmi-1.4.8.ebuild
new file mode 100644
index 000000000000..340a50929548
--- /dev/null
+++ b/sys-libs/freeipmi/freeipmi-1.4.8.ebuild
@@ -0,0 +1,93 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+#AUTOTOOLS_AUTORECONF=1
+AT_M4DIR="config"
+
+inherit eutils multilib autotools-utils
+
+DESCRIPTION="Provides Remote-Console and System Management Software as per IPMI v1.5/2.0"
+HOMEPAGE="http://www.gnu.org/software/freeipmi/"
+
+MY_P="${P/_/.}"
+S="${WORKDIR}"/${MY_P}
+[[ ${MY_P} == *.beta* ]] && ALPHA="-alpha"
+SRC_URI="mirror://gnu${ALPHA}/${PN}/${MY_P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="debug nagios"
+
+RDEPEND="dev-libs/libgcrypt:0"
+DEPEND="${RDEPEND}
+ virtual/os-headers"
+RDEPEND="${RDEPEND}
+ nagios? (
+ || ( net-analyzer/icinga net-analyzer/nagios )
+ dev-lang/perl
+ )
+ sys-apps/openrc"
+
+src_configure() {
+ local myeconfargs=(
+ $(use_enable debug)
+ --disable-static
+ --disable-init-scripts
+ --localstatedir=/var
+ )
+
+ autotools-utils_src_configure
+}
+
+# There are no tests
+src_test() { :; }
+
+src_install() {
+ autotools-utils_src_install
+
+ # freeipmi by defaults install _all_ commands to /usr/sbin, but
+ # quite a few can be run remotely as standard user, so move them
+ # in /usr/bin afterwards.
+ dodir /usr/bin
+ for file in ipmi{detect,ping,power,console}; do
+ mv "${D}"/usr/{s,}bin/${file} || die
+
+ # The default install symlinks these commands to add a dash
+ # after the ipmi prefix; we repeat those after move for
+ # consistency.
+ rm "${D}"/usr/sbin/${file/ipmi/ipmi-}
+ dosym ${file} /usr/bin/${file/ipmi/ipmi-}
+ done
+
+ # Install the nagios plugin in its proper place, if desired
+ if use nagios; then
+ dodir /usr/$(get_libdir)/nagios/plugins
+ mv "${D}"/usr/share/doc/${PF}/contrib/nagios/nagios_ipmi_sensors.pl \
+ "${D}"/usr/$(get_libdir)/nagios/plugins/ || die
+ fperms 0755 /usr/$(get_libdir)/nagios/plugins/nagios_ipmi_sensors.pl
+
+ insinto /etc/icinga/conf.d
+ newins "${FILESDIR}"/freeipmi.icinga freeipmi-command.cfg
+ fi
+
+ dodoc AUTHORS ChangeLog* DISCLAIMER* NEWS README* TODO doc/*.txt
+
+ keepdir \
+ /var/cache/ipmimonitoringsdrcache \
+ /var/lib/freeipmi \
+ /var/log/ipmiconsole
+
+ # starting from version 1.2.0 the two daemons are similar enough
+ newinitd "${FILESDIR}"/bmc-watchdog.initd.4 ipmidetectd
+ newconfd "${FILESDIR}"/ipmidetectd.confd ipmidetectd
+
+ newinitd "${FILESDIR}"/bmc-watchdog.initd.4 bmc-watchdog
+ newconfd "${FILESDIR}"/bmc-watchdog.confd bmc-watchdog
+
+ newinitd "${FILESDIR}"/bmc-watchdog.initd.4 ipmiseld
+ newconfd "${FILESDIR}"/ipmiseld.confd ipmiseld
+}
diff --git a/sys-libs/freeipmi/metadata.xml b/sys-libs/freeipmi/metadata.xml
new file mode 100644
index 000000000000..3ab012f3c9fa
--- /dev/null
+++ b/sys-libs/freeipmi/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sysadmin</herd>
+
+ <use>
+ <flag name='nagios'>
+ Install a nagios plugin to check sensors' status.
+ </flag>
+ </use>
+</pkgmetadata>
diff --git a/sys-libs/fts-standalone/Manifest b/sys-libs/fts-standalone/Manifest
new file mode 100644
index 000000000000..4f58f869d5aa
--- /dev/null
+++ b/sys-libs/fts-standalone/Manifest
@@ -0,0 +1 @@
+DIST fts-0.2.tar.gz 339498 SHA256 4ee5db6449dc0fa4a83438616fd4bbed0f65b2123e56ac253cba5b25dbd9e056 SHA512 4f31182f4ebce7f663db893def0e2380b87ef1a262a021837fc6fc9965803a829217142df140c67b1cd83b292eb8862fa0a470cf795a312494674e6e94f02f79 WHIRLPOOL 23a55fc572189d827fc35849205296ac39d83d74ccab9431fb47b1eab7e2da8e196aca50b8161e9b9ea4a2f0e7471676a4f229f8c510c4b6af023beb5a5657b4
diff --git a/sys-libs/fts-standalone/fts-standalone-0.2.ebuild b/sys-libs/fts-standalone/fts-standalone-0.2.ebuild
new file mode 100644
index 000000000000..34af48d0678f
--- /dev/null
+++ b/sys-libs/fts-standalone/fts-standalone-0.2.ebuild
@@ -0,0 +1,22 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+MY_P=${P/-standalone/}
+
+DESCRIPTION="Standalone fts library for use with mus"
+HOMEPAGE="http://dev.gentoo.org/~blueness/fts-standalone"
+SRC_URI="http://dev.gentoo.org/~blueness/fts-standalone/${MY_P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~mips ~ppc ~x86"
+IUSE=""
+
+DEPEND="
+ !sys-libs/glibc
+ !sys-libs/uclibc"
+
+S="${WORKDIR}/${MY_P}"
diff --git a/sys-libs/fts-standalone/metadata.xml b/sys-libs/fts-standalone/metadata.xml
new file mode 100644
index 000000000000..1e7587374fdf
--- /dev/null
+++ b/sys-libs/fts-standalone/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>blueness@gentoo.org</email>
+ <name>Anthony G. Basile</name>
+ </maintainer>
+</pkgmetadata>
diff --git a/sys-libs/gdbm/Manifest b/sys-libs/gdbm/Manifest
new file mode 100644
index 000000000000..cb54cea2b068
--- /dev/null
+++ b/sys-libs/gdbm/Manifest
@@ -0,0 +1,4 @@
+DIST gdbm-1.10.tar.gz 655599 SHA256 23f8134c5b94bbfb06d756a6b78f074fba6e6028cf2fe01341d40b26db773441 SHA512 e93604a79d693ccc4be5ba4b41bb3f046186d95ebfdb075f8b201adde8405299cf34011c4863438bef2f5eda38304ad9ad562a56644b46c46036dc8f45b4dd9c WHIRLPOOL 3d71980caa96697c30679af99bcdaad0c595f15636c6ababe33dc9ff243101fd7f6cf25372dfb943c3ae91c5ab3364ca9599e16332ee3086abdd166fb1bef6f7
+DIST gdbm-1.11.tar.gz 811662 SHA256 8d912f44f05d0b15a4a5d96a76f852e905d051bb88022fcdfd98b43be093e3c3 SHA512 272fb65ab9ca0a21e9f0dcfb2c638457e87cbb938c65ee850123474d11f2858496f84d3fa9edca27cd91c7220160cfdb59f90bd46ddc45395514addc9fd4151c WHIRLPOOL 827f100826273fb8e6d8fdc88fffdb81e5630a7d07bdbeeb7d25759809c5165613446567b0b48bf862d4a4b231e5db921e28c9d6915e669fd0ce795f4a9f150a
+DIST gdbm-1.8.3.tar.gz 228695 SHA256 cc340338a2e28b40058ab9eb5354a21d53f88a1582ea21ba0bb185c37a281dc9 SHA512 2a01751ee8f730db563b4f52185c72f1c7a4f66530d6736f05f7446153be685ea0bb6ea1d2bad16ce31547fea879dc48507ff65ad35b0973df9aa385713b10d7 WHIRLPOOL 9d2e402b2ec00cadfc64e40d87da095f293f157386abbe9a64ebe8b7a2af9b965546805826ffe3d5c88212dec0628ab2ae3ebef91de2da7fc69d0937d03d7075
+DIST gdbm-1.9.1.tar.gz 554843 SHA256 6025852637772b0699f2294b5f14fd4a084bca3c8161d29d64d1f30d6d1a9aed SHA512 4e491d956ed3212ab735d77463c7d62c16910d526951568ca728e03e4a184b5a9825d722e1a4b34d93a703fe31bf4c92972c9f7daad82670d85c2aa113b4c509 WHIRLPOOL f2aa9a7d65456c35a7b24e35601fffc8c55732f59e17802789a8e7303d2c07e92a38cf7167fbe4d25f2fa01313916994f5fe0b80e4b8c4e367666b70f0399cc3
diff --git a/sys-libs/gdbm/files/gdbm-1.8.3-build.patch b/sys-libs/gdbm/files/gdbm-1.8.3-build.patch
new file mode 100644
index 000000000000..084f5a1d247a
--- /dev/null
+++ b/sys-libs/gdbm/files/gdbm-1.8.3-build.patch
@@ -0,0 +1,21 @@
+Respect system LDFLAGS when generating gdbm libs
+
+http://bugs.gentoo.org/209730
+
+--- Makefile.in
++++ Makefile.in
+@@ -146,12 +146,12 @@
+
+ libgdbm.la: $(LOBJS) gdbm.h
+ rm -f libgdbm.la
+- $(LIBTOOL) --mode=link $(CC) -o libgdbm.la -rpath $(libdir) \
++ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o libgdbm.la -rpath $(libdir) \
+ -version-info $(SHLIB_VER) $(LOBJS)
+
+ libgdbm_compat.la: $(C_LOBJS) gdbm.h libgdbm.la
+ rm -f libgdbm_compat.la
+- $(LIBTOOL) --mode=link $(CC) -o libgdbm_compat.la -rpath $(libdir) \
++ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o libgdbm_compat.la -rpath $(libdir) \
+ -version-info $(SHLIB_VER) $(C_LOBJS) libgdbm.la
+
+ gdbm.h: gdbm.proto gdbmerrno.h gdbm.proto2
diff --git a/sys-libs/gdbm/files/gdbm-1.8.3-compat-linking.patch b/sys-libs/gdbm/files/gdbm-1.8.3-compat-linking.patch
new file mode 100644
index 000000000000..cebcf4e917ee
--- /dev/null
+++ b/sys-libs/gdbm/files/gdbm-1.8.3-compat-linking.patch
@@ -0,0 +1,19 @@
+Since libgdbm_compat uses libgdbm, make sure we link it in.
+
+http://bugs.gentoo.org/165263
+
+--- gdbm-1.8.3/Makefile.in
++++ gdbm-1.8.3/Makefile.in
+@@ -161,10 +161,10 @@
+ $(LIBTOOL) --mode=link $(CC) -o libgdbm.la -rpath $(libdir) \
+ -version-info $(SHLIB_VER) $(LOBJS)
+
+-libgdbm_compat.la: $(C_LOBJS) gdbm.h
++libgdbm_compat.la: $(C_LOBJS) gdbm.h libgdbm.la
+ rm -f libgdbm_compat.la
+ $(LIBTOOL) --mode=link $(CC) -o libgdbm_compat.la -rpath $(libdir) \
+- -version-info $(SHLIB_VER) $(C_LOBJS)
++ -version-info $(SHLIB_VER) $(C_LOBJS) libgdbm.la
+
+ gdbm.h: gdbm.proto gdbmerrno.h gdbm.proto2
+ rm -f gdbm.h
diff --git a/sys-libs/gdbm/files/gdbm-1.8.3-fix-install-ownership.patch b/sys-libs/gdbm/files/gdbm-1.8.3-fix-install-ownership.patch
new file mode 100644
index 000000000000..970bb7976939
--- /dev/null
+++ b/sys-libs/gdbm/files/gdbm-1.8.3-fix-install-ownership.patch
@@ -0,0 +1,45 @@
+Install with proper ownership.
+
+http://bugs.gentoo.org/24178
+
+--- gdbm/Makefile.in
++++ gdbm/Makefile.in
+@@ -14,10 +14,6 @@
+ INSTALL_PROGRAM = @INSTALL_PROGRAM@
+ INSTALL_DATA = @INSTALL_DATA@
+
+-# File ownership and group
+-BINOWN = bin
+-BINGRP = bin
+-
+ MAKEINFO = makeinfo
+ TEXI2DVI = texi2dvi
+
+@@ -131,22 +127,17 @@
+ $(INSTALL_ROOT)$(includedir) $(INSTALL_ROOT)$(man3dir) \
+ $(INSTALL_ROOT)$(infodir)
+ $(LIBTOOL) $(INSTALL) -c libgdbm.la $(INSTALL_ROOT)$(libdir)/libgdbm.la
+- $(INSTALL_DATA) -o $(BINOWN) -g $(BINGRP) gdbm.h \
+- $(INSTALL_ROOT)$(includedir)/gdbm.h
+- $(INSTALL_DATA) -o $(BINOWN) -g $(BINGRP) $(srcdir)/gdbm.3 \
+- $(INSTALL_ROOT)$(man3dir)/gdbm.3
+- $(INSTALL_DATA) -o $(BINOWN) -g $(BINGRP) $(srcdir)/gdbm.info \
+- $(INSTALL_ROOT)$(infodir)/gdbm.info
++ $(INSTALL_DATA) gdbm.h $(INSTALL_ROOT)$(includedir)/gdbm.h
++ $(INSTALL_DATA) $(srcdir)/gdbm.3 $(INSTALL_ROOT)$(man3dir)/gdbm.3
++ $(INSTALL_DATA) $(srcdir)/gdbm.info $(INSTALL_ROOT)$(infodir)/gdbm.info
+
+ install-compat:
+ $(srcdir)/mkinstalldirs $(INSTALL_ROOT)$(libdir) \
+ $(INSTALL_ROOT)$(includedir)
+ $(LIBTOOL) $(INSTALL) -c libgdbm_compat.la \
+ $(INSTALL_ROOT)$(libdir)/libgdbm_compat.la
+- $(INSTALL_DATA) -o $(BINOWN) -g $(BINGRP) $(srcdir)/dbm.h \
+- $(INSTALL_ROOT)$(includedir)/dbm.h
+- $(INSTALL_DATA) -o $(BINOWN) -g $(BINGRP) $(srcdir)/ndbm.h \
+- $(INSTALL_ROOT)$(includedir)/ndbm.h
++ $(INSTALL_DATA) $(srcdir)/dbm.h $(INSTALL_ROOT)$(includedir)/dbm.h
++ $(INSTALL_DATA) $(srcdir)/ndbm.h $(INSTALL_ROOT)$(includedir)/ndbm.h
+
+ #libgdbm.a: $(OBJS) gdbm.h
+ # rm -f libgdbm.a
diff --git a/sys-libs/gdbm/files/gdbm-1.9.1-compat-link.patch b/sys-libs/gdbm/files/gdbm-1.9.1-compat-link.patch
new file mode 100644
index 000000000000..bc445294eb3a
--- /dev/null
+++ b/sys-libs/gdbm/files/gdbm-1.9.1-compat-link.patch
@@ -0,0 +1,24 @@
+fix from upstream
+https://bugs.gentoo.org/383743
+
+From ae9ea0011da4ba01e5639611d61c442af8d42817 Mon Sep 17 00:00:00 2001
+From: Sergey Poznyakoff <gray@gnu.org.ua>
+Date: Sun, 14 Aug 2011 20:17:54 +0000
+Subject: * compat/Makefile.am (libgdbm_compat_la_LIBADD): Link against libgdbm.
+
+2011-08-14 Sergey Poznyakoff <gray@gnu.org.ua>
+
+ * compat/Makefile.am (libgdbm_compat_la_LIBADD): Link against
+ libgdbm. Suggested by Adam Sampson.
+
+--- a/compat/Makefile.in
++++ b/compat/Makefile.in
+@@ -23,7 +23,7 @@
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
+ LTLIBRARIES = $(lib_LTLIBRARIES)
+-libgdbm_compat_la_LIBADD =
++libgdbm_compat_la_LIBADD = ../src/libgdbm.la
+ am__objects_1 = dbminit.lo delete.lo fetch.lo store.lo seq.lo close.lo
+ am__objects_2 = dbmopen.lo dbmdelete.lo dbmerr.lo dbmfetch.lo \
+ dbmstore.lo dbmseq.lo dbmclose.lo dbmdirfno.lo dbmpagfno.lo \
diff --git a/sys-libs/gdbm/gdbm-1.10-r1.ebuild b/sys-libs/gdbm/gdbm-1.10-r1.ebuild
new file mode 100644
index 000000000000..f86377ddacd9
--- /dev/null
+++ b/sys-libs/gdbm/gdbm-1.10-r1.ebuild
@@ -0,0 +1,72 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit flag-o-matic libtool multilib multilib-minimal
+
+EX_P="${PN}-1.8.3"
+DESCRIPTION="Standard GNU database libraries"
+HOMEPAGE="http://www.gnu.org/software/gdbm/"
+SRC_URI="mirror://gnu/gdbm/${P}.tar.gz
+ exporter? ( mirror://gnu/gdbm/${EX_P}.tar.gz )"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~x86-interix ~amd64-linux ~arm-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="+berkdb exporter nls static-libs"
+
+RDEPEND="
+ abi_x86_32? (
+ !<=app-emulation/emul-linux-x86-baselibs-20131008-r4
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ )"
+
+EX_S="${WORKDIR}"/${EX_P}
+
+src_prepare() {
+ elibtoolize
+}
+
+multilib_src_configure() {
+ # gdbm doesn't appear to use either of these libraries
+ export ac_cv_lib_dbm_main=no ac_cv_lib_ndbm_main=no
+
+ if multilib_is_native_abi && use exporter ; then
+ pushd "${EX_S}" >/dev/null
+ append-lfs-flags
+ econf --disable-shared
+ popd >/dev/null
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf \
+ --includedir="${EPREFIX}"/usr/include/gdbm \
+ --with-gdbm183-libdir="${EX_S}/.libs" \
+ --with-gdbm183-includedir="${EX_S}" \
+ $(use_enable berkdb libgdbm-compat) \
+ $(multilib_is_native_abi && use_enable exporter gdbm-export) \
+ $(use_enable nls) \
+ $(use_enable static-libs static)
+}
+
+multilib_src_compile() {
+ use exporter && emake -C "${EX_S}" libgdbm.la
+ emake
+}
+
+multilib_src_install_all() {
+ einstalldocs
+
+ use static-libs || find "${ED}" -name '*.la' -delete
+ mv "${ED}"/usr/include/gdbm/gdbm.h "${ED}"/usr/include/ || die
+}
+
+pkg_preinst() {
+ preserve_old_lib libgdbm{,_compat}.so.{2,3} #32510
+}
+
+pkg_postinst() {
+ preserve_old_lib_notify libgdbm{,_compat}.so.{2,3} #32510
+}
diff --git a/sys-libs/gdbm/gdbm-1.10.ebuild b/sys-libs/gdbm/gdbm-1.10.ebuild
new file mode 100644
index 000000000000..aaa92393b8fc
--- /dev/null
+++ b/sys-libs/gdbm/gdbm-1.10.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit libtool flag-o-matic
+
+EX_P="${PN}-1.8.3"
+DESCRIPTION="Standard GNU database libraries"
+HOMEPAGE="http://www.gnu.org/software/gdbm/"
+SRC_URI="mirror://gnu/gdbm/${P}.tar.gz
+ exporter? ( mirror://gnu/gdbm/${EX_P}.tar.gz )"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~x86-interix ~amd64-linux ~arm-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="+berkdb exporter static-libs"
+
+EX_S="${WORKDIR}"/${EX_P}
+
+src_prepare() {
+ elibtoolize
+}
+
+src_configure() {
+ # gdbm doesn't appear to use either of these libraries
+ export ac_cv_lib_dbm_main=no ac_cv_lib_ndbm_main=no
+
+ if use exporter ; then
+ pushd "${EX_S}" >/dev/null
+ append-lfs-flags
+ econf --disable-shared
+ popd >/dev/null
+ fi
+
+ econf \
+ --includedir="${EPREFIX}"/usr/include/gdbm \
+ --with-gdbm183-libdir="${EX_S}/.libs" \
+ --with-gdbm183-includedir="${EX_S}" \
+ $(use_enable berkdb libgdbm-compat) \
+ $(use_enable exporter gdbm-export) \
+ $(use_enable static-libs static)
+}
+
+src_compile() {
+ if use exporter ; then
+ emake -C "${WORKDIR}"/${EX_P} libgdbm.la
+ fi
+
+ emake
+}
+
+src_install() {
+ default
+ use static-libs || find "${ED}" -name '*.la' -delete
+ mv "${ED}"/usr/include/gdbm/gdbm.h "${ED}"/usr/include/ || die
+}
+
+pkg_preinst() {
+ preserve_old_lib libgdbm{,_compat}.so.{2,3} #32510
+}
+
+pkg_postinst() {
+ preserve_old_lib_notify libgdbm{,_compat}.so.{2,3} #32510
+}
diff --git a/sys-libs/gdbm/gdbm-1.11.ebuild b/sys-libs/gdbm/gdbm-1.11.ebuild
new file mode 100644
index 000000000000..1b5832bcdf28
--- /dev/null
+++ b/sys-libs/gdbm/gdbm-1.11.ebuild
@@ -0,0 +1,72 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit flag-o-matic libtool multilib multilib-minimal
+
+EX_P="${PN}-1.8.3"
+DESCRIPTION="Standard GNU database libraries"
+HOMEPAGE="http://www.gnu.org/software/gdbm/"
+SRC_URI="mirror://gnu/gdbm/${P}.tar.gz
+ exporter? ( mirror://gnu/gdbm/${EX_P}.tar.gz )"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~x86-interix ~amd64-linux ~arm-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="+berkdb exporter nls static-libs"
+
+RDEPEND="
+ abi_x86_32? (
+ !<=app-emulation/emul-linux-x86-baselibs-20131008-r4
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ )"
+
+EX_S="${WORKDIR}"/${EX_P}
+
+src_prepare() {
+ elibtoolize
+}
+
+multilib_src_configure() {
+ # gdbm doesn't appear to use either of these libraries
+ export ac_cv_lib_dbm_main=no ac_cv_lib_ndbm_main=no
+
+ if multilib_is_native_abi && use exporter ; then
+ pushd "${EX_S}" >/dev/null
+ append-lfs-flags
+ econf --disable-shared
+ popd >/dev/null
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf \
+ --includedir="${EPREFIX}"/usr/include/gdbm \
+ --with-gdbm183-libdir="${EX_S}/.libs" \
+ --with-gdbm183-includedir="${EX_S}" \
+ $(use_enable berkdb libgdbm-compat) \
+ $(multilib_native_use_enable exporter gdbm-export) \
+ $(use_enable nls) \
+ $(use_enable static-libs static)
+}
+
+multilib_src_compile() {
+ use exporter && emake -C "${EX_S}" libgdbm.la
+ emake
+}
+
+multilib_src_install_all() {
+ einstalldocs
+
+ use static-libs || find "${ED}" -name '*.la' -delete
+ mv "${ED}"/usr/include/gdbm/gdbm.h "${ED}"/usr/include/ || die
+}
+
+pkg_preinst() {
+ preserve_old_lib libgdbm{,_compat}.so.{2,3} #32510
+}
+
+pkg_postinst() {
+ preserve_old_lib_notify libgdbm{,_compat}.so.{2,3} #32510
+}
diff --git a/sys-libs/gdbm/gdbm-1.8.3-r3.ebuild b/sys-libs/gdbm/gdbm-1.8.3-r3.ebuild
new file mode 100644
index 000000000000..cfadd2e47b28
--- /dev/null
+++ b/sys-libs/gdbm/gdbm-1.8.3-r3.ebuild
@@ -0,0 +1,44 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils libtool multilib
+
+DESCRIPTION="Standard GNU database libraries"
+HOMEPAGE="http://www.gnu.org/software/gdbm/gdbm.html"
+SRC_URI="mirror://gnu/gdbm/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+IUSE="berkdb"
+
+DEPEND="berkdb? ( sys-libs/db )"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epatch "${FILESDIR}"/${P}-fix-install-ownership.patch #24178
+ epatch "${FILESDIR}"/${P}-compat-linking.patch #165263
+ elibtoolize
+}
+
+src_compile() {
+ use berkdb || export ac_cv_lib_dbm_main=no ac_cv_lib_ndbm_main=no
+ econf --includedir=/usr/include/gdbm || die
+ emake || die
+}
+
+src_install() {
+ emake -j1 INSTALL_ROOT="${D}" install install-compat || die
+ mv "${D}"/usr/include/gdbm/gdbm.h "${D}"/usr/include/ || die
+ dodoc ChangeLog NEWS README
+}
+
+pkg_preinst() {
+ preserve_old_lib libgdbm.so.2 #32510
+}
+
+pkg_postinst() {
+ preserve_old_lib_notify libgdbm.so.2 #32510
+}
diff --git a/sys-libs/gdbm/gdbm-1.8.3-r4.ebuild b/sys-libs/gdbm/gdbm-1.8.3-r4.ebuild
new file mode 100644
index 000000000000..df85982a4198
--- /dev/null
+++ b/sys-libs/gdbm/gdbm-1.8.3-r4.ebuild
@@ -0,0 +1,64 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils libtool flag-o-matic
+
+DESCRIPTION="Standard GNU database libraries"
+HOMEPAGE="http://www.gnu.org/software/gdbm/gdbm.html"
+SRC_URI="mirror://gnu/gdbm/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+IUSE="berkdb"
+
+DEPEND="berkdb? ( sys-libs/db )"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epatch "${FILESDIR}"/${P}-fix-install-ownership.patch #24178
+ epatch "${FILESDIR}"/${P}-compat-linking.patch #165263
+ epatch "${FILESDIR}"/${P}-build.patch #209730
+ elibtoolize
+ append-lfs-flags
+}
+
+src_compile() {
+ use berkdb || export ac_cv_lib_dbm_main=no ac_cv_lib_ndbm_main=no
+ econf \
+ --includedir=/usr/include/gdbm \
+ --disable-dependency-tracking \
+ --enable-fast-install \
+ || die
+ emake || die
+}
+
+src_install() {
+ emake -j1 INSTALL_ROOT="${D}" install install-compat || die
+ mv "${D}"/usr/include/gdbm/gdbm.h "${D}"/usr/include/ || die
+ dodoc ChangeLog NEWS README
+}
+
+pkg_preinst() {
+ preserve_old_lib libgdbm.so.2 #32510
+}
+
+pkg_postinst() {
+ preserve_old_lib_notify libgdbm.so.2 #32510
+
+ ewarn "32bit systems might have to rebuild all gdbm databases due to"
+ ewarn "LFS changes in the gdbm format. You can either delete the db"
+ ewarn "and regenerate it from scratch, or use the converter:"
+ ewarn "http://bugs.gentoo.org/attachment.cgi?id=215326"
+ ewarn
+ ewarn "See this comment for information on how to use it:"
+ ewarn "http://bugs.gentoo.org/299390#c15"
+ ewarn
+ ewarn "You should be able to locate most gdbm db's on your system with:"
+ ewarn "find /etc /var -type f -exec file {} + | grep 'GNU dbm 1.x or ndbm database'"
+ ewarn
+ ewarn "You could also try using this helper script:"
+ ewarn "http://bugs.gentoo.org/attachment.cgi?id=222581"
+}
diff --git a/sys-libs/gdbm/gdbm-1.9.1-r2.ebuild b/sys-libs/gdbm/gdbm-1.9.1-r2.ebuild
new file mode 100644
index 000000000000..3fed3ad3d22b
--- /dev/null
+++ b/sys-libs/gdbm/gdbm-1.9.1-r2.ebuild
@@ -0,0 +1,68 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils libtool flag-o-matic
+
+EX_P="${PN}-1.8.3"
+DESCRIPTION="Standard GNU database libraries"
+HOMEPAGE="http://www.gnu.org/software/gdbm/"
+SRC_URI="mirror://gnu/gdbm/${P}.tar.gz
+ exporter? ( mirror://gnu/gdbm/${EX_P}.tar.gz )"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="+berkdb exporter static-libs"
+
+EX_S="${WORKDIR}"/${EX_P}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-compat-link.patch #383743
+ elibtoolize
+}
+
+src_configure() {
+ # gdbm doesn't appear to use either of these libraries
+ export ac_cv_lib_dbm_main=no ac_cv_lib_ndbm_main=no
+
+ if use exporter ; then
+ pushd "${EX_S}" >/dev/null
+ append-lfs-flags
+ econf --disable-shared
+ popd >/dev/null
+ fi
+
+ econf \
+ --includedir="${EPREFIX}"/usr/include/gdbm \
+ --with-gdbm183-libdir="${EX_S}/.libs" \
+ --with-gdbm183-includedir="${EX_S}" \
+ $(use_enable berkdb libgdbm-compat) \
+ $(use_enable exporter gdbm-export) \
+ $(use_enable static-libs static)
+}
+
+src_compile() {
+ if use exporter ; then
+ emake -C "${WORKDIR}"/${EX_P} libgdbm.la || die
+ fi
+
+ emake || die
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die
+ use static-libs || find "${ED}" -name '*.la' -delete
+ mv "${ED}"/usr/include/gdbm/gdbm.h "${ED}"/usr/include/ || die
+ dodoc ChangeLog NEWS README
+}
+
+pkg_preinst() {
+ preserve_old_lib libgdbm{,_compat}.so.{2,3} #32510
+}
+
+pkg_postinst() {
+ preserve_old_lib_notify libgdbm{,_compat}.so.{2,3} #32510
+}
diff --git a/sys-libs/gdbm/metadata.xml b/sys-libs/gdbm/metadata.xml
new file mode 100644
index 000000000000..07b37856f07f
--- /dev/null
+++ b/sys-libs/gdbm/metadata.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>base-system</herd>
+<use>
+ <flag name='berkdb'>enable compatibility layer for UNIX-like dbm and ndbm interfaces</flag>
+ <flag name='exporter'>enable gdbmexport binary for exporting data from gdbm-1.8 databases into gdbm-1.9</flag>
+</use>
+</pkgmetadata>
diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
new file mode 100644
index 000000000000..35e49e8221b2
--- /dev/null
+++ b/sys-libs/glibc/Manifest
@@ -0,0 +1,28 @@
+DIST gcc-4.7.3-r1-multilib-bootstrap.tar.bz2 8064097 SHA256 34aec5a59bb4d0ecf908c62fd418461d0f3793238296897687305fd7a1f27299 SHA512 40b93e194ad41a75d649d84d1c49070680f253a13f0617803243bc61c44fed1ca2d0a7572a97ebb79353f312b58b5f6360be916dd7435928cc53935082e15269 WHIRLPOOL bbce19e7fe5c30faa55ddd4e29070f0d1fdfca3a04e8d68e0772260fa9be89ccde63ec92badb490209008df5fee6e53dfdeec4ae51857b90ba298a79315a199f
+DIST glibc-2.13-patches-11.tar.bz2 114949 SHA256 7db753b6ba3f58b77a95d48cf9fd8c54d843ece9b8ecdc01fd9cc787552a6e54 SHA512 ee3f02f12958220b5d97d72dbac0352d97dd225f9538fb8d036ec469c572ec577fb2648bf39f155d823928a01ab37ed8a1540d309b25b8719130d4a9d36447d1 WHIRLPOOL c26acfa64262c130be786bac905775ac0a2b1037b73259d6d4f387d6bcd5c82452e3525e284010fa687a921a8882b17737b87e7f214af546940f41e55f4edf75
+DIST glibc-2.13.tar.bz2 15725729 SHA256 0173c92a0545e6d99a46a4fbed2da00ba26556f5c6198e2f9f1631ed5318dbb2 SHA512 7fdae9acdbe8cbfda008f107ffd1559c0163ff70730a5bc618f1f15b64096a813a3495e0b2d2be7b7206bef3ed9ca67a68fd2004c8275ffeffa38b70c80887e0 WHIRLPOOL cfaeb0831f177926610d2c89bd6bd20735107ac4738ee0485a2d2e14b13c986e68e64c8f9093b89f135c3d7eb94fc2230b9f3837f3841a8bc2bc886ff5415005
+DIST glibc-2.14.1-patches-10.tar.bz2 167926 SHA256 e93815f125a6d1cfbaa6aa920274ea55c12da0bb4719fafd4bc0bfad27322108 SHA512 520a8e5e63daf33f1ac2d475e2d880718a774dc9228fa1d61792eb17d39a5a3d92dafac7963c4eada71ad06e8d34aea34098e08533dbc6844e9649d84b8980ab WHIRLPOOL a0c246425bffb5ce84ac8e5f25614e2ccb90de668365fc1a3ddf187ab8ae954990d12a5924f83ffa56d563b6c70fa1dbb01263d0219c40279f4267301b83646c
+DIST glibc-2.14.1.tar.bz2 15650580 SHA256 6e85a2fa3ebe6b28103361f09d27eeda37a021f24dab73f34064456d5a715b3b SHA512 c83c9d6dae0091b7b6d3c8fb2b9376e58d2574a8016ce1b4d6e870afca3b892e8da2482ddf95d07ae7407a7f4cc84c1f52cb2f975a18c734529ec019204f65b7 WHIRLPOOL 0aee8c43d851375dd18b3b0ec33aad74ab396936f347cbc9f91f182d84ec03d45425be44a7edbc3faa8159dcbf9cbc4a09fa8c70b3da495fff071469fe063959
+DIST glibc-2.15-patches-23.tar.bz2 118999 SHA256 11c38082635822eb7b12d538e3b9c38ee71f6a86be6cebb59f5f2c575be93830 SHA512 ff3792a0029ea24990fe2419579472bd02119ed6a2dab28e85089d232029be5f1c18c643bcb9d577dce78a7c682bb5eee1ed3644f086b5cf19230bcf37ce8a4b WHIRLPOOL 110ddb5989bf1b66a487c9ebae03a3e62ac22b7a28b4c70d142e1c56160bdd50b9f5fa6f4dc4a28cfb28d94281c582fcfc1f60df8ae2ef4e8a946b3b06d2b1b1
+DIST glibc-2.15.tar.xz 10280176 SHA256 321ec482abdc27b03244f7b345ee22dc431bc55daf9c000a4e7b040fbdbecb50 SHA512 fc8bc407cd9edfd79bd286d28c84e0b8224e1f57c1d318e73da098a9693257d78970178fd59f487f0321a079fcb772e8e78473fab52f091b2addb0a48fe8dcf7 WHIRLPOOL 061fc0c9915bd821dc31c2fea8e4f9a75b6c7ec0c935ea713d8c087408a8bf3c600179273438f3d9748fe40b946866b2f160e6da6fee4da51e549a30d0f0ebbc
+DIST glibc-2.16.0-patches-12.tar.bz2 95047 SHA256 e8fd08ee1af5ba4c2999657ea7ec3a0669c10fcf36151874a22f9d8e20d535ed SHA512 f377043d51e7b1d9d74af2ae1d40543329b9d6d5e07f7f9d84b1db9773f61864dc1f52253a952b2618bfe170f9cae32fdf748919460605bafaea6bc0c1f1befe WHIRLPOOL 69fe1b2a9ca0f2521bb59089cfccb7393c3fdd335498ab397d17dcb441a8ea0c579a35e3f175025d2c348b72d08ce496a0ed6d577bc1e0b5a65eb5fcef88e04c
+DIST glibc-2.16.0.tar.xz 9990512 SHA256 1edc36aa2a6cb7127971fce8e02eecffe9c7956297ad3ef10dd4c09f486d5924 SHA512 be9acc11b77ab3c01d5766fe626a6a51bc3192ac98f9554fbb5c37120cfc6f636c0b7a80beddc180f13b32ad06051d24c1999fa2e64eeb724d55a9498f0f634e WHIRLPOOL 9bfd4358a4488080e12e08deca5fca59c1555853d1c1978b7d1bb3b480eb8fb125dccab38c55644248ae5e18b0167aec85f8a7850bab9e11f980aae6f171eac3
+DIST glibc-2.17-patches-8.tar.bz2 83707 SHA256 477946a4915dcd0cc0565ff8532d219e2ee868f6e821ea71ce579652d01ccbb3 SHA512 6675357e62b554d9d0f8ef70341b8038f8f89591fba384bc3783ef81aead0532486e2218af71da9c6f88a3b8b382edec81bed36eb636ee231eac80e111acbfd8 WHIRLPOOL 946f431b28ec60cc61d44364187f64a2d6e92ed7c9071126cf70277843c656de4dfac9f184f572f9a72c0cb452d879cdb7aca5b9f92f8ff02a8b1a521fffef43
+DIST glibc-2.17.tar.xz 10981956 SHA256 6914e337401e0e0ade23694e1b2c52a5f09e4eda3270c67e7c3ba93a89b5b23e SHA512 384e54037daaa344a26ce58242acc3f9a249d0765088d18a540a305745afa33ae6dec4024adae958eacd7100be9c713d117260ace8340f6d8c8396dbde4868d2 WHIRLPOOL 9b98c1c298aeff607aaa554341c300c15491b7314f127524fc5c048c67c5059daaf706e6cf206bb69213d5307e37bed87137ab46f504d8072bb778310081fc23
+DIST glibc-2.18-patches-4.tar.bz2 95165 SHA256 89b458e22db60847b4ad869e3b5cf32868528b8d73205a692a6c0d07779dd083 SHA512 d881c9c5fe32b967694d4ca5185ff5ffc964449f2ed49fd062e5d57a3c6d9f16eef2f591d2d8e98a1a95a6487f3436ef031839ed8766fd085404b288340b7933 WHIRLPOOL 55f87d0efce1f84b45968f377e868c31102cb5228fe4ff1ffa132770f242f9f4f1843c28e4eb38ee7bed1321507ae12b7284a18199af63df1ecd070233d1076f
+DIST glibc-2.18.tar.xz 11150148 SHA256 2cb4e1e381928f1e5e55e71ab1ba8e0ea7ede75ff9709770435bfd018ea257a3 SHA512 27218d2e7dd3bf3908d7af171c490933680e958c579ebd27b43b661e223fd5de2219cc1cf699170405280808c84de476d0ad86dbba35a488ef404e9438552327 WHIRLPOOL 89b877c7db602ffd4374c7fb84db17397b91f889a7de6259f79374cc3fcd00613114cbb93feb518ef25fb2e579fb03843df15d17235c1fe1b6a7e0e64aa8e8fa
+DIST glibc-2.19-patches-1.tar.bz2 75062 SHA256 0f4a9be17a659be02079d4e3bbbe04d3cecbe6ab19b2106edb81a83b743b9b22 SHA512 c884235676ad0b7c77ec1db5bc2406b79cb4f9fb341770fe3871292acca10972f46716f9e4a192368d937b24b594229cc45c23607767071807e4df4f3ed7fca3 WHIRLPOOL 53e6181c061365c8b6b3d3b4b355993e6a7e7fb2b1ad80d5463a30edadaed6848eb2e5656090998c82ed75625eaf30e69a2750019f47358ff08c99ffc36ffd08
+DIST glibc-2.19-patches-3.tar.bz2 80664 SHA256 6fb03292e224199e0dd9ba7ee83aca723e1560f26831e85cdc6302b187c6de3c SHA512 d281d6a2757920124cf8a3f02b97e75192598b08d96ae48840df34c7ffdcb212952d171f233e6f12a429b19437d0a296212fe1f2eae164d6a1c6793cb3cb69f0 WHIRLPOOL 6f28a2d0dff42e8ad0e77859938e3093753f77f78821375777eebb2db5568bf1c56e8b8208f02280f23acb2dd26dc8a313fedd5b2c10755f1659e6d324a1dbc3
+DIST glibc-2.19.tar.xz 12083312 SHA256 2d3997f588401ea095a0b27227b1d50cdfdd416236f6567b564549d3b46ea2a2 SHA512 9e021fcb3afbb9ace2a0e37fded231a62de861bd766e29d47163a03182e37add718b7acc3963d1c525f9556773e842297725715acde48dcfbaab6e756af1a23d WHIRLPOOL 9581a3a23ebdd56bc559b56b95b7bcd21ca039546ec19c6c0e4e0738597542164fdb21ab1d1f36d5e73a205fb51f0974c7d497972615bce69ae002298f6475b6
+DIST glibc-2.20-patches-1.tar.bz2 78477 SHA256 b3b1c4022503dc433cc4969534f27ee019ab695aed8b722e914d7fb864db5606 SHA512 56e954f11610fa4f9fffc68bdad98114bed7592f5a4f8bd81a0306ee99311db8cb4dd4469a6f2a5a60ff4a9e6d172e49971d389f1b2911df7a408571737c1ee1 WHIRLPOOL 02aeda854ca220ed3b4fe41510d918a8fc4fb9e95a3761a3884e2d2d3c0a515c82e835d7a74e41dc0a20c865de120b60ea4e561cd3f25534568981c8084dce00
+DIST glibc-2.20-patches-3.tar.bz2 30916 SHA256 c10cc881a1ee587dcaaff234c8e05dcc6a6e4d4bbafcae21e6267616a20bb354 SHA512 cbbfccdf0ba0ad7fb740a557a246b647c020dd841aabd256c34bb8c5f4aac2ee0ed50e5f15ac28a161e294a9a3803560317bcf934cc938daa58111d7373b1b66 WHIRLPOOL 2889809da097e148bae7769316f7a744880fce0c1cd74ef16e45e343c5aa02f549ff6f9e13ac114cb061b914d3517151ab803af5683864ed09ebc72326561e64
+DIST glibc-2.20-patches-5.tar.bz2 55986 SHA256 3d3eec9ac9b5d0530f9e05614f4646d64ff93a48865b42c156990bea69247cda SHA512 409f59a028127e02f0c9f91107715b540d8d234475830adc17108a02664be232098d119b43bcc8df9b328ab50c1fffb0868d510e6487ce1c34ec2c7c7a78375b WHIRLPOOL b3c41b01af5d8ae8e901ac48ae124e13ff1c76fbeb35315cb9630c648c03d7abbfb753294cbdfe1dc939bda260e24d8450ffb19cfe5c255b32f8c5500f2c43f3
+DIST glibc-2.20.tar.xz 12283992 SHA256 f84b6d42aecc288d593c397b0a3d02260a33ee686bce0c634eb9b32798f36ba5 SHA512 7a8eea8b71d3ccba766c3f304cab61055446d451ef063309476b26dc40d880562dc33b1b68fbedeedb4b55b84c26415b9202311aaa71ef8c141b6849a814d2fa WHIRLPOOL 042f74d75c62a655ae35348c9cd0bed0845ab199e37a76635eb74c04ed927b5eca77723c38d2dc46f12fca62c1004001887b43946a914b079ad22f6a9cc8daaa
+DIST glibc-2.21-patches-4.tar.bz2 32021 SHA256 2a77ab05ff0df464a0f2deb642d9ac9dc7b42d94b333e1db033ef2a33ba0a8e1 SHA512 39e128a550617d9b692e9ec12e77466767907e5066f78141af3089d06241282f06cf333fc9f7c932c5d5ecdd5020fdd79bfb33827332cce765cad2bcc06758cc WHIRLPOOL 98cc3324127c91c97e59f705a05b46abcd499c345eab873605d9fc3e456ec103ccb52f97b2aeaf59b4bfa5f47ed81cce32899aed3d7d46d201f3b6657c00c1dc
+DIST glibc-2.21.tar.xz 12322092 SHA256 aeeb362437965a5d3f40b151094ca79def04a115bd363fdd4a9a0c69482923b8 SHA512 8cded6693618bec115f678fcbd0b77556f97dfa8337608f66e37224aefa55b38765ba61cb4d58beea37b5934e5ec8e30bad58613707388484906f2a0ce77997d WHIRLPOOL d07fec32bd92eade065a3b6170932b8bd41d07df4aa69dd5a860ebb9678c22bd1e20bf88b1fc05c3ecc18e709c0a63118e12525dc668e0399d7ef7fe4454702d
+DIST glibc-2.22-patches-2.tar.bz2 28416 SHA256 6b6107232d36cf1edd5e2691f9f5d9466313d51fee9a97b242ef5841473ad9df SHA512 a5b80c6be0e96354d94754ebf9439a48aa952ffdae0b97e76d780fc431bba2744e40a7e76435ef11c0797cb174f1faf86afcb320a62422a4775bc1ee20f34dbf WHIRLPOOL f09cfb8ecd42929e3e7d50da22cad29339398487a5f358f6a383e59025ba415f13b3321c05eddc3d202b554598ec8dd5b7c45df9dc82ba716b90461380dee816
+DIST glibc-2.22.tar.xz 12969072 SHA256 eb731406903befef1d8f878a46be75ef862b9056ab0cde1626d08a7a05328948 SHA512 a8719f3a4f8aa5fa81711116fdafbea5082c6dfd85bd8c4cdce60571910263ab422b35bb8b55a84d37ccb146442133ba60a84d453ca4a439c8ccd35419bd051b WHIRLPOOL f7e707b3776fc197a2e7bf5633721925507237b154bbc1f94b9fc303c87e6fc039ff0758da6ee55b4c1a0daaa87c6e594a6c96e7b00a7ba8ae98ee29918709a7
+DIST glibc-ports-2.13.tar.bz2 625945 SHA256 b11c4501ae929883447f409c31d65e82822b1c5693075a825a3d54612876ee5a SHA512 39ed578db363dab05e54d5272d3a8a0600493b91985c65a4d043b5a88d617ff46cca2d66d99ae69e92282d8f8a2357e79dcd5b0ae45b505497417d5137866ad6 WHIRLPOOL 766309e315f2f7edbe0b431691ea16f9917dd2f1c8d54b707e819b695f26dedac2d60c3a58499ee1b51a218b982e9930e49f79db096e166576c215a6ccac21e5
+DIST glibc-ports-2.14.1.tar.bz2 630641 SHA256 1c830afb6d4aa166edaa09ec539580377ecbb16ba655d0aad6f5cb5a9a269aa9 SHA512 4ed18be51e2dec4395bf89701b32e443ba02e4e6b26ee1a72684a1f84ef302d58ed8b58f99e4e0ba3f539da0ade668de5881bb2b86fcd065d741448d9c129bae WHIRLPOOL 463aac8660f7f8d9d6e4ee5728aef2948892a54dc250d0543ffb3c2fb636a816384d5984631ab4420b98a51254d62b4b0ad8381a8006ceb1f632de135155939d
+DIST glibc-ports-2.15.tar.xz 421820 SHA256 fcc271fcc3a808bf0f3aa1d144bc39b8d0d5f730aed6e206b883961515f0d1b9 SHA512 fc3c80a9a7ede0f35054e5be043fff4b967e6ef6678f42e617dd1dd498920edb4e4c785cf8e3cd97fc2914a35a892e0fd7e1aab24f0c3c8d207765a131bf3744 WHIRLPOOL a8a617eacb326615265832f86a7ef39678364b5b65d5c16d58680ec0debfbca6780018b7da9c1a86bdfffcde58aa1258b96ea4bd50b114901b522e62d48ae4a5
+DIST glibc-ports-2.16.0.tar.xz 925916 SHA256 93a10ac3b9ab70ccc59dfe50a4747d48a7e92f9481656f8a37558a2767ac02f3 SHA512 8653ad9f5cf239a55eb2e236f9510ba227e910168efefd74df8e4951f2e1e4bca69598bc23daa6581e0ba94fe334ac625524fb22f0d38c2a07e373eda1db821b WHIRLPOOL 60b0cb559e28bcab9c6625ccd24a13ecfc301cc055d7e18d1324627912b528ca8cc7c2f999e1e979d2685e407879b1bfffdb61f1536d91fa143cffb7ded72a8a
diff --git a/sys-libs/glibc/files/2.10/glibc-2.10-gentoo-chk_fail.c b/sys-libs/glibc/files/2.10/glibc-2.10-gentoo-chk_fail.c
new file mode 100644
index 000000000000..37711e8aacbf
--- /dev/null
+++ b/sys-libs/glibc/files/2.10/glibc-2.10-gentoo-chk_fail.c
@@ -0,0 +1,315 @@
+/* Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* Copyright (C) 2006-2008 Gentoo Foundation Inc.
+ * License terms as above.
+ *
+ * Hardened Gentoo SSP and FORTIFY handler
+ *
+ * An SSP failure handler that does not use functions from the rest of
+ * glibc; it uses the INTERNAL_SYSCALL methods directly. This ensures
+ * no possibility of recursion into the handler.
+ *
+ * Direct all bug reports to http://bugs.gentoo.org/
+ *
+ * Re-written from the glibc-2.3 Hardened Gentoo SSP handler
+ * by Kevin F. Quinn - <kevquinn[@]gentoo.org>
+ *
+ * The following people contributed to the glibc-2.3 Hardened
+ * Gentoo SSP and FORTIFY handler, from which this implementation draws much:
+ *
+ * Ned Ludd - <solar[@]gentoo.org>
+ * Alexander Gabert - <pappy[@]gentoo.org>
+ * The PaX Team - <pageexec[@]freemail.hu>
+ * Peter S. Mazinger - <ps.m[@]gmx.net>
+ * Yoann Vandoorselaere - <yoann[@]prelude-ids.org>
+ * Robert Connolly - <robert[@]linuxfromscratch.org>
+ * Cory Visi <cory[@]visi.name>
+ * Mike Frysinger <vapier[@]gentoo.org>
+ * Magnus Granberg <zorry[@]ume.nu>
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <unistd.h>
+#include <signal.h>
+
+#include <sys/types.h>
+
+#include <sysdep-cancel.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+#include <kernel-features.h>
+
+#include <alloca.h>
+/* from sysdeps */
+#include <socketcall.h>
+/* for the stuff in bits/socket.h */
+#include <sys/socket.h>
+#include <sys/un.h>
+
+/* Sanity check on SYSCALL macro names - force compilation
+ * failure if the names used here do not exist
+ */
+#if !defined __NR_socketcall && !defined __NR_socket
+# error Cannot do syscall socket or socketcall
+#endif
+#if !defined __NR_socketcall && !defined __NR_connect
+# error Cannot do syscall connect or socketcall
+#endif
+#ifndef __NR_write
+# error Cannot do syscall write
+#endif
+#ifndef __NR_close
+# error Cannot do syscall close
+#endif
+#ifndef __NR_getpid
+# error Cannot do syscall getpid
+#endif
+#ifndef __NR_kill
+# error Cannot do syscall kill
+#endif
+#ifndef __NR_exit
+# error Cannot do syscall exit
+#endif
+#ifdef SSP_SMASH_DUMPS_CORE
+# define ENABLE_SSP_SMASH_DUMPS_CORE 1
+# if !defined _KERNEL_NSIG && !defined _NSIG
+# error No _NSIG or _KERNEL_NSIG for rt_sigaction
+# endif
+# if !defined __NR_sigaction && !defined __NR_rt_sigaction
+# error Cannot do syscall sigaction or rt_sigaction
+# endif
+/* Although rt_sigaction expects sizeof(sigset_t) - it expects the size
+ * of the _kernel_ sigset_t which is not the same as the user sigset_t.
+ * Most arches have this as _NSIG bits - mips has _KERNEL_NSIG bits for
+ * some reason.
+ */
+# ifdef _KERNEL_NSIG
+# define _SSP_NSIG _KERNEL_NSIG
+# else
+# define _SSP_NSIG _NSIG
+# endif
+#else
+# define _SSP_NSIG 0
+# define ENABLE_SSP_SMASH_DUMPS_CORE 0
+#endif
+
+/* Define DO_SIGACTION - default to newer rt signal interface but
+ * fallback to old as needed.
+ */
+#ifdef __NR_rt_sigaction
+# define DO_SIGACTION(signum, act, oldact) \
+ INLINE_SYSCALL(rt_sigaction, 4, signum, act, oldact, _SSP_NSIG/8)
+#else
+# define DO_SIGACTION(signum, act, oldact) \
+ INLINE_SYSCALL(sigaction, 3, signum, act, oldact)
+#endif
+
+/* Define DO_SOCKET/DO_CONNECT functions to deal with socketcall vs socket/connect */
+#if defined(__NR_socket) && defined(__NR_connect)
+# define USE_OLD_SOCKETCALL 0
+#else
+# define USE_OLD_SOCKETCALL 1
+#endif
+
+/* stub out the __NR_'s so we can let gcc optimize away dead code */
+#ifndef __NR_socketcall
+# define __NR_socketcall 0
+#endif
+#ifndef __NR_socket
+# define __NR_socket 0
+#endif
+#ifndef __NR_connect
+# define __NR_connect 0
+#endif
+#define DO_SOCKET(result, domain, type, protocol) \
+ do { \
+ if (USE_OLD_SOCKETCALL) { \
+ socketargs[0] = domain; \
+ socketargs[1] = type; \
+ socketargs[2] = protocol; \
+ socketargs[3] = 0; \
+ result = INLINE_SYSCALL(socketcall, 2, SOCKOP_socket, socketargs); \
+ } else \
+ result = INLINE_SYSCALL(socket, 3, domain, type, protocol); \
+ } while (0)
+#define DO_CONNECT(result, sockfd, serv_addr, addrlen) \
+ do { \
+ if (USE_OLD_SOCKETCALL) { \
+ socketargs[0] = sockfd; \
+ socketargs[1] = (unsigned long int)serv_addr; \
+ socketargs[2] = addrlen; \
+ socketargs[3] = 0; \
+ result = INLINE_SYSCALL(socketcall, 2, SOCKOP_connect, socketargs); \
+ } else \
+ result = INLINE_SYSCALL(connect, 3, sockfd, serv_addr, addrlen); \
+ } while (0)
+
+#ifndef _PATH_LOG
+# define _PATH_LOG "/dev/log"
+#endif
+
+static const char path_log[] = _PATH_LOG;
+
+/* For building glibc with SSP switched on, define __progname to a
+ * constant if building for the run-time loader, to avoid pulling
+ * in more of libc.so into ld.so
+ */
+#ifdef IS_IN_rtld
+static char *__progname = "<rtld>";
+#else
+extern char *__progname;
+#endif
+
+/* Common handler code, used by chk_fail
+ * Inlined to ensure no self-references to the handler within itself.
+ * Data static to avoid putting more than necessary on the stack,
+ * to aid core debugging.
+ */
+__attribute__ ((__noreturn__ , __always_inline__))
+static inline void
+__hardened_gentoo_chk_fail(char func[], int damaged)
+{
+#define MESSAGE_BUFSIZ 256
+ static pid_t pid;
+ static int plen, i;
+ static char message[MESSAGE_BUFSIZ];
+ static const char msg_ssa[] = ": buffer overflow attack";
+ static const char msg_inf[] = " in function ";
+ static const char msg_ssd[] = "*** buffer overflow detected ***: ";
+ static const char msg_terminated[] = " - terminated\n";
+ static const char msg_report[] = "Report to http://bugs.gentoo.org/\n";
+ static const char msg_unknown[] = "<unknown>";
+ static int log_socket, connect_result;
+ static struct sockaddr_un sock;
+ static unsigned long int socketargs[4];
+
+ /* Build socket address
+ */
+ sock.sun_family = AF_UNIX;
+ i = 0;
+ while ((path_log[i] != '\0') && (i<(sizeof(sock.sun_path)-1))) {
+ sock.sun_path[i] = path_log[i];
+ i++;
+ }
+ sock.sun_path[i] = '\0';
+
+ /* Try SOCK_DGRAM connection to syslog */
+ connect_result = -1;
+ DO_SOCKET(log_socket, AF_UNIX, SOCK_DGRAM, 0);
+ if (log_socket != -1)
+ DO_CONNECT(connect_result, log_socket, &sock, sizeof(sock));
+ if (connect_result == -1) {
+ if (log_socket != -1)
+ INLINE_SYSCALL(close, 1, log_socket);
+ /* Try SOCK_STREAM connection to syslog */
+ DO_SOCKET(log_socket, AF_UNIX, SOCK_STREAM, 0);
+ if (log_socket != -1)
+ DO_CONNECT(connect_result, log_socket, &sock, sizeof(sock));
+ }
+
+ /* Build message. Messages are generated both in the old style and new style,
+ * so that log watchers that are configured for the old-style message continue
+ * to work.
+ */
+#define strconcat(str) \
+ {i=0; while ((str[i] != '\0') && ((i+plen)<(MESSAGE_BUFSIZ-1))) \
+ {\
+ message[plen+i]=str[i];\
+ i++;\
+ }\
+ plen+=i;}
+
+ /* R.Henderson post-gcc-4 style message */
+ plen = 0;
+ strconcat(msg_ssd);
+ if (__progname != (char *)0)
+ strconcat(__progname)
+ else
+ strconcat(msg_unknown);
+ strconcat(msg_terminated);
+
+ /* Write out error message to STDERR, to syslog if open */
+ INLINE_SYSCALL(write, 3, STDERR_FILENO, message, plen);
+ if (connect_result != -1)
+ INLINE_SYSCALL(write, 3, log_socket, message, plen);
+
+ /* Dr. Etoh pre-gcc-4 style message */
+ plen = 0;
+ if (__progname != (char *)0)
+ strconcat(__progname)
+ else
+ strconcat(msg_unknown);
+ strconcat(msg_ssa);
+ strconcat(msg_inf);
+ if (func != NULL)
+ strconcat(func)
+ else
+ strconcat(msg_unknown);
+ strconcat(msg_terminated);
+ /* Write out error message to STDERR, to syslog if open */
+ INLINE_SYSCALL(write, 3, STDERR_FILENO, message, plen);
+ if (connect_result != -1)
+ INLINE_SYSCALL(write, 3, log_socket, message, plen);
+
+ /* Direct reports to bugs.gentoo.org */
+ plen=0;
+ strconcat(msg_report);
+ message[plen++]='\0';
+
+ /* Write out error message to STDERR, to syslog if open */
+ INLINE_SYSCALL(write, 3, STDERR_FILENO, message, plen);
+ if (connect_result != -1)
+ INLINE_SYSCALL(write, 3, log_socket, message, plen);
+
+ if (log_socket != -1)
+ INLINE_SYSCALL(close, 1, log_socket);
+
+ /* Suicide */
+ pid = INLINE_SYSCALL(getpid, 0);
+
+ if (ENABLE_SSP_SMASH_DUMPS_CORE) {
+ static struct sigaction default_abort_act;
+ /* Remove any user-supplied handler for SIGABRT, before using it */
+ default_abort_act.sa_handler = SIG_DFL;
+ default_abort_act.sa_sigaction = NULL;
+ __sigfillset(&default_abort_act.sa_mask);
+ default_abort_act.sa_flags = 0;
+ if (DO_SIGACTION(SIGABRT, &default_abort_act, NULL) == 0)
+ INLINE_SYSCALL(kill, 2, pid, SIGABRT);
+ }
+
+ /* Note; actions cannot be added to SIGKILL */
+ INLINE_SYSCALL(kill, 2, pid, SIGKILL);
+
+ /* In case the kill didn't work, exit anyway
+ * The loop prevents gcc thinking this routine returns
+ */
+ while (1)
+ INLINE_SYSCALL(exit, 0);
+}
+
+__attribute__ ((__noreturn__))
+void __chk_fail(void)
+{
+ __hardened_gentoo_chk_fail(NULL, 0);
+}
+
diff --git a/sys-libs/glibc/files/2.10/glibc-2.10-hardened-configure-picdefault.patch b/sys-libs/glibc/files/2.10/glibc-2.10-hardened-configure-picdefault.patch
new file mode 100644
index 000000000000..e75ccc788c89
--- /dev/null
+++ b/sys-libs/glibc/files/2.10/glibc-2.10-hardened-configure-picdefault.patch
@@ -0,0 +1,30 @@
+Prevent default-fPIE from confusing configure into thinking
+PIC code is default. This causes glibc to build both PIC and
+non-PIC code as normal, which on the hardened compiler generates
+PIC and PIE.
+
+Patch by Kevin F. Quinn <kevquinn@gentoo.org>
+Fixed for glibc 2.10 by Magnus Granberg <zorry@ume.nu>
+
+--- configure.in
++++ configure.in
+@@ -2145,7 +2145,7 @@
+ # error PIC is default.
+ #endif
+ EOF
+-if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
++if eval "${CC-cc} -fno-PIE -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
+ libc_cv_pic_default=no
+ fi
+ rm -f conftest.*])
+--- configure
++++ configure
+@@ -7698,7 +7698,7 @@
+ # error PIC is default.
+ #endif
+ EOF
+-if eval "${CC-cc} -S conftest.c 2>&5 1>&5"; then
++if eval "${CC-cc} -fno-PIE -S conftest.c 2>&5 1>&5"; then
+ libc_cv_pic_default=no
+ fi
+ rm -f conftest.*
diff --git a/sys-libs/glibc/files/2.10/glibc-2.10-hardened-inittls-nosysenter.patch b/sys-libs/glibc/files/2.10/glibc-2.10-hardened-inittls-nosysenter.patch
new file mode 100644
index 000000000000..cb6d8e3c78ba
--- /dev/null
+++ b/sys-libs/glibc/files/2.10/glibc-2.10-hardened-inittls-nosysenter.patch
@@ -0,0 +1,274 @@
+When building glibc PIE (which is not something upstream support),
+several modifications are necessary to the glibc build process.
+
+First, any syscalls in PIEs must be of the PIC variant, otherwise
+textrels ensue. Then, any syscalls made before the initialisation
+of the TLS will fail on i386, as the sysenter variant on i386 uses
+the TLS, giving rise to a chicken-and-egg situation. This patch
+defines a PIC syscall variant that doesn't use sysenter, even when the sysenter
+version is normally used, and uses the non-sysenter version for the brk
+syscall that is performed by the TLS initialisation. Further, the TLS
+initialisation is moved in this case prior to the initialisation of
+dl_osversion, as that requires further syscalls.
+
+csu/libc-start.c: Move initial TLS initialization to before the
+initialisation of dl_osversion, when INTERNAL_SYSCALL_NOSYSENTER is defined
+
+csu/libc-tls.c: Use the no-sysenter version of sbrk when
+INTERNAL_SYSCALL_NOSYSENTER is defined.
+
+misc/sbrk.c: Define a no-sysenter version of sbrk, using the no-sysenter
+version of brk - if INTERNAL_SYSCALL_NOSYSENTER is defined.
+
+misc/brk.c: Define a no-sysenter version of brk if
+INTERNAL_SYSCALL_NOSYSENTER is defined.
+
+sysdeps/unix/sysv/linux/i386/sysdep.h: Define INTERNAL_SYSCALL_NOSYSENTER
+Make INTERNAL_SYSCALL always use the PIC variant, even if not SHARED.
+
+Patch by Kevin F. Quinn <kevquinn@gentoo.org>
+Fixed for 2.10 by Magnus Granberg <zorry@ume.nu>
+
+--- csu/libc-start.c
++++ csu/libc-start.c
+@@ -28,6 +28,7 @@
+ extern int __libc_multiple_libcs;
+
+ #include <tls.h>
++#include <sysdep.h>
+ #ifndef SHARED
+ # include <dl-osinfo.h>
+ extern void __pthread_initialize_minimal (void);
+@@ -129,6 +130,11 @@
+ # endif
+ _dl_aux_init (auxvec);
+ # endif
++# ifdef INTERNAL_SYSCALL_NOSYSENTER
++ /* Do the initial TLS initialization before _dl_osversion,
++ since the latter uses the uname syscall. */
++ __pthread_initialize_minimal ();
++# endif
+ # ifdef DL_SYSDEP_OSCHECK
+ if (!__libc_multiple_libcs)
+ {
+@@ -138,10 +144,12 @@
+ }
+ # endif
+
++# ifndef INTERNAL_SYSCALL_NOSYSENTER
+ /* Initialize the thread library at least a bit since the libgcc
+ functions are using thread functions if these are available and
+ we need to setup errno. */
+ __pthread_initialize_minimal ();
++# endif
+
+ /* Set up the stack checker's canary. */
+ uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard ();
+--- csu/libc-tls.c
++++ csu/libc-tls.c
+@@ -23,6 +23,7 @@
+ #include <unistd.h>
+ #include <stdio.h>
+ #include <sys/param.h>
++#include <sysdep.h>
+
+
+ #ifdef SHARED
+@@ -29,6 +30,9 @@
+ #error makefile bug, this file is for static only
+ #endif
+
++#ifdef INTERNAL_SYSCALL_NOSYSENTER
++extern void *__sbrk_nosysenter (intptr_t __delta);
++#endif
+ extern ElfW(Phdr) *_dl_phdr;
+ extern size_t _dl_phnum;
+
+@@ -141,14 +145,26 @@
+
+ The initialized value of _dl_tls_static_size is provided by dl-open.c
+ to request some surplus that permits dynamic loading of modules with
+- IE-model TLS. */
++ IE-model TLS.
++
++ Where the normal sbrk would use a syscall that needs the TLS (i386)
++ use the special non-sysenter version instead. */
+ #if TLS_TCB_AT_TP
+ tcb_offset = roundup (memsz + GL(dl_tls_static_size), tcbalign);
++# ifdef INTERNAL_SYSCALL_NOSYSENTER
++ tlsblock = __sbrk_nosysenter (tcb_offset + tcbsize + max_align);
++# else
+ tlsblock = __sbrk (tcb_offset + tcbsize + max_align);
++# endif
+ #elif TLS_DTV_AT_TP
+ tcb_offset = roundup (tcbsize, align ?: 1);
++# ifdef INTERNAL_SYSCALL_NOSYSENTER
++ tlsblock = __sbrk_nosysenter (tcb_offset + memsz + max_align
++ + TLS_PRE_TCB_SIZE + GL(dl_tls_static_size));
++# else
+ tlsblock = __sbrk (tcb_offset + memsz + max_align
+ + TLS_PRE_TCB_SIZE + GL(dl_tls_static_size));
++# endif
+ tlsblock += TLS_PRE_TCB_SIZE;
+ #else
+ /* In case a model with a different layout for the TCB and DTV
+--- misc/sbrk.c
++++ misc/sbrk.c
+@@ -18,6 +18,7 @@
+ #include <errno.h>
+ #include <stdint.h>
+ #include <unistd.h>
++#include <sysdep.h>
+
+ /* Defined in brk.c. */
+ extern void *__curbrk;
+@@ -29,6 +30,35 @@
+ /* Extend the process's data space by INCREMENT.
+ If INCREMENT is negative, shrink data space by - INCREMENT.
+ Return start of new space allocated, or -1 for errors. */
++#ifdef INTERNAL_SYSCALL_NOSYSENTER
++/* This version is used by csu/libc-tls.c whem initialising the TLS
++ if the SYSENTER version requires the TLS (which it does on i386).
++ Obviously using the TLS before it is initialised is broken. */
++extern int __brk_nosysenter (void *addr);
++void *
++__sbrk_nosysenter (intptr_t increment)
++{
++ void *oldbrk;
++
++ /* If this is not part of the dynamic library or the library is used
++ via dynamic loading in a statically linked program update
++ __curbrk from the kernel's brk value. That way two separate
++ instances of __brk and __sbrk can share the heap, returning
++ interleaved pieces of it. */
++ if (__curbrk == NULL || __libc_multiple_libcs)
++ if (__brk_nosysenter (0) < 0) /* Initialize the break. */
++ return (void *) -1;
++
++ if (increment == 0)
++ return __curbrk;
++
++ oldbrk = __curbrk;
++ if (__brk_nosysenter (oldbrk + increment) < 0)
++ return (void *) -1;
++
++ return oldbrk;
++}
++#endif
+ void *
+ __sbrk (intptr_t increment)
+ {
+--- sysdeps/unix/sysv/linux/i386/brk.c
++++ sysdeps/unix/sysv/linux/i386/brk.c
+@@ -31,6 +31,30 @@
+ linker. */
+ weak_alias (__curbrk, ___brk_addr)
+
++#ifdef INTERNAL_SYSCALL_NOSYSENTER
++/* This version is used by csu/libc-tls.c whem initialising the TLS
++ * if the SYSENTER version requires the TLS (which it does on i386).
++ * Obviously using the TLS before it is initialised is broken. */
++int
++__brk_nosysenter (void *addr)
++{
++ void *__unbounded newbrk;
++
++ INTERNAL_SYSCALL_DECL (err);
++ newbrk = (void *__unbounded) INTERNAL_SYSCALL_NOSYSENTER (brk, err, 1,
++ __ptrvalue (addr));
++
++ __curbrk = newbrk;
++
++ if (newbrk < addr)
++ {
++ __set_errno (ENOMEM);
++ return -1;
++ }
++
++ return 0;
++}
++#endif
+ int
+ __brk (void *addr)
+ {
+--- sysdeps/unix/sysv/linux/i386/sysdep.h
++++ sysdeps/unix/sysv/linux/i386/sysdep.h
+@@ -187,7 +187,7 @@
+ /* The original calling convention for system calls on Linux/i386 is
+ to use int $0x80. */
+ #ifdef I386_USE_SYSENTER
+-# ifdef SHARED
++# if defined SHARED || defined __PIC__
+ # define ENTER_KERNEL call *%gs:SYSINFO_OFFSET
+ # else
+ # define ENTER_KERNEL call *_dl_sysinfo
+@@ -358,7 +358,7 @@
+ possible to use more than four parameters. */
+ #undef INTERNAL_SYSCALL
+ #ifdef I386_USE_SYSENTER
+-# ifdef SHARED
++# if defined SHARED || defined __PIC__
+ # define INTERNAL_SYSCALL(name, err, nr, args...) \
+ ({ \
+ register unsigned int resultvar; \
+@@ -384,6 +384,18 @@
+ : "0" (name), "i" (offsetof (tcbhead_t, sysinfo)) \
+ ASMFMT_##nr(args) : "memory", "cc"); \
+ (int) resultvar; })
++# define INTERNAL_SYSCALL_NOSYSENTER(name, err, nr, args...) \
++ ({ \
++ register unsigned int resultvar; \
++ EXTRAVAR_##nr \
++ asm volatile ( \
++ LOADARGS_NOSYSENTER_##nr \
++ "movl %1, %%eax\n\t" \
++ "int $0x80\n\t" \
++ RESTOREARGS_NOSYSENTER_##nr \
++ : "=a" (resultvar) \
++ : "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc"); \
++ (int) resultvar; })
+ # else
+ # define INTERNAL_SYSCALL(name, err, nr, args...) \
+ ({ \
+@@ -447,12 +459,20 @@
+
+ #define LOADARGS_0
+ #ifdef __PIC__
+-# if defined I386_USE_SYSENTER && defined SHARED
++# if defined I386_USE_SYSENTER && ( defined SHARED || defined __PIC__ )
+ # define LOADARGS_1 \
+ "bpushl .L__X'%k3, %k3\n\t"
+ # define LOADARGS_5 \
+ "movl %%ebx, %4\n\t" \
+ "movl %3, %%ebx\n\t"
++# define LOADARGS_NOSYSENTER_1 \
++ "bpushl .L__X'%k2, %k2\n\t"
++# define LOADARGS_NOSYSENTER_2 LOADARGS_NOSYSENTER_1
++# define LOADARGS_NOSYSENTER_3 LOADARGS_3
++# define LOADARGS_NOSYSENTER_4 LOADARGS_3
++# define LOADARGS_NOSYSENTER_5 \
++ "movl %%ebx, %3\n\t" \
++ "movl %2, %%ebx\n\t"
+ # else
+ # define LOADARGS_1 \
+ "bpushl .L__X'%k2, %k2\n\t"
+@@ -474,11 +495,18 @@
+
+ #define RESTOREARGS_0
+ #ifdef __PIC__
+-# if defined I386_USE_SYSENTER && defined SHARED
++# if defined I386_USE_SYSENTER && ( defined SHARED || defined __PIC__ )
+ # define RESTOREARGS_1 \
+ "bpopl .L__X'%k3, %k3\n\t"
+ # define RESTOREARGS_5 \
+ "movl %4, %%ebx"
++# define RESTOREARGS_NOSYSENTER_1 \
++ "bpopl .L__X'%k2, %k2\n\t"
++# define RESTOREARGS_NOSYSENTER_2 RESTOREARGS_NOSYSENTER_1
++# define RESTOREARGS_NOSYSENTER_3 RESTOREARGS_3
++# define RESTOREARGS_NOSYSENTER_4 RESTOREARGS_3
++# define RESTOREARGS_NOSYSENTER_5 \
++ "movl %3, %%ebx"
+ # else
+ # define RESTOREARGS_1 \
+ "bpopl .L__X'%k2, %k2\n\t"
diff --git a/sys-libs/glibc/files/2.12/glibc-2.12-hardened-pie.patch b/sys-libs/glibc/files/2.12/glibc-2.12-hardened-pie.patch
new file mode 100644
index 000000000000..3315171d953f
--- /dev/null
+++ b/sys-libs/glibc/files/2.12/glibc-2.12-hardened-pie.patch
@@ -0,0 +1,39 @@
+2010-08-11 Magnus Granberg <zorry@ume.nu>
+
+ #332331
+ * Makeconfig (+link): Set to +link-pie.
+ (+link-static): Change $(static-start-installed-name) to
+ S$(static-start-installed-name).
+ (+prector): Set to +prectorS.
+ (+postctor): Set to +postctorS.
+
+--- libc/Makeconfig
++++ libc/Makeconfig
+@@ -447,11 +447,12 @@
+ $(common-objpfx)libc% $(+postinit),$^) \
+ $(link-extra-libs) $(link-libc) $(+postctorS) $(+postinit)
+ endif
+++link = $(+link-pie)
+ # Command for statically linking programs with the C library.
+ ifndef +link-static
+ +link-static = $(CC) -nostdlib -nostartfiles -static -o $@ \
+ $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
+- $(addprefix $(csu-objpfx),$(static-start-installed-name)) \
++ $(addprefix $(csu-objpfx),S$(static-start-installed-name)) \
+ $(+preinit) $(+prector) \
+ $(filter-out $(addprefix $(csu-objpfx),start.o \
+ $(start-installed-name))\
+@@ -549,11 +550,10 @@
+ ifeq ($(elf),yes)
+ +preinit = $(addprefix $(csu-objpfx),crti.o)
+ +postinit = $(addprefix $(csu-objpfx),crtn.o)
+-+prector = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbegin.o`
+-+postctor = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtend.o`
+-# Variants of the two previous definitions for linking PIE programs.
+ +prectorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginS.o`
+ +postctorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtendS.o`
+++prector = $(+prectorS)
+++postctor = $(+postctorS)
+ +interp = $(addprefix $(elf-objpfx),interp.os)
+ endif
+ csu-objpfx = $(common-objpfx)csu/
diff --git a/sys-libs/glibc/files/2.16/glibc-2.16-hardened-pie.patch b/sys-libs/glibc/files/2.16/glibc-2.16-hardened-pie.patch
new file mode 100644
index 000000000000..a850a61a272a
--- /dev/null
+++ b/sys-libs/glibc/files/2.16/glibc-2.16-hardened-pie.patch
@@ -0,0 +1,39 @@
+2012-11-11 Magnus Granberg <zorry@gentoo.org>
+
+ #442712
+ * Makeconfig (+link): Set to +link-pie.
+ (+link-static-before-libc): Change $(static-start-installed-name) to
+ S$(static-start-installed-name).
+ (+prector): Set to +prectorS.
+ (+postctor): Set to +postctorS.
+
+--- libc/Makeconfig
++++ libc/Makeconfig
+@@ -447,11 +447,12 @@
+ $(common-objpfx)libc% $(+postinit),$^) \
+ $(link-extra-libs) $(link-libc) $(+postctorS) $(+postinit)
+ endif
+++link = $(+link-pie)
+ # Command for statically linking programs with the C library.
+ ifndef +link-static
+ +link-static-before-libc = $(CC) -nostdlib -nostartfiles -static -o $@ \
+ $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
+- $(addprefix $(csu-objpfx),$(static-start-installed-name)) \
++ $(addprefix $(csu-objpfx),S$(static-start-installed-name)) \
+ $(+preinit) $(+prector) \
+ $(filter-out $(addprefix $(csu-objpfx),start.o \
+ $(start-installed-name))\
+@@ -549,11 +550,10 @@
+ ifeq ($(elf),yes)
+ +preinit = $(addprefix $(csu-objpfx),crti.o)
+ +postinit = $(addprefix $(csu-objpfx),crtn.o)
+-+prector = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbegin.o`
+-+postctor = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtend.o`
+-# Variants of the two previous definitions for linking PIE programs.
+ +prectorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginS.o`
+ +postctorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtendS.o`
+++prector = $(+prectorS)
+++postctor = $(+postctorS)
+ +interp = $(addprefix $(elf-objpfx),interp.os)
+ endif
+ csu-objpfx = $(common-objpfx)csu/
diff --git a/sys-libs/glibc/files/2.17/glibc-2.17-hardened-pie.patch b/sys-libs/glibc/files/2.17/glibc-2.17-hardened-pie.patch
new file mode 100644
index 000000000000..da4fb82539cf
--- /dev/null
+++ b/sys-libs/glibc/files/2.17/glibc-2.17-hardened-pie.patch
@@ -0,0 +1,42 @@
+2012-11-11 Magnus Granberg <zorry@gentoo.org>
+
+ #442712
+ * Makeconfig (+link): Set to +link-pie.
+ (+link-static-before-libc): Change $(static-start-installed-name) to
+ S$(static-start-installed-name).
+ (+prector): Set to +prectorS.
+ (+postctor): Set to +postctorS.
+
+--- libc/Makeconfig
++++ libc/Makeconfig
+@@ -447,11 +447,12 @@
+ $(common-objpfx)libc% $(+postinit),$^) \
+ $(link-extra-libs) $(link-libc) $(+postctorS) $(+postinit)
+ endif
+++link = $(+link-pie)
+ # Command for statically linking programs with the C library.
+ ifndef +link-static
+ +link-static-before-libc = $(CC) -nostdlib -nostartfiles -static -o $@ \
+ $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
+- $(addprefix $(csu-objpfx),$(static-start-installed-name)) \
++ $(addprefix $(csu-objpfx),S$(static-start-installed-name)) \
+ $(+preinit) $(+prectorT) \
+ $(filter-out $(addprefix $(csu-objpfx),start.o \
+ $(start-installed-name))\
+@@ -549,11 +550,10 @@
+ ifeq ($(elf),yes)
+ +preinit = $(addprefix $(csu-objpfx),crti.o)
+ +postinit = $(addprefix $(csu-objpfx),crtn.o)
+-+prector = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbegin.o`
+-+postctor = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtend.o`
+-# Variants of the two previous definitions for linking PIE programs.
+ +prectorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginS.o`
+ +postctorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtendS.o`
+++prector = $(+prectorS)
+++postctor = $(+postctorS)
+ # Variants of the two previous definitions for statically linking programs.
+ +prectorT = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginT.o`
+ +postctorT = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtend.o`
+ +interp = $(addprefix $(elf-objpfx),interp.os)
+ endif
+ csu-objpfx = $(common-objpfx)csu/
diff --git a/sys-libs/glibc/files/2.18/glibc-2.18-gentoo-chk_fail.c b/sys-libs/glibc/files/2.18/glibc-2.18-gentoo-chk_fail.c
new file mode 100644
index 000000000000..c1934362f628
--- /dev/null
+++ b/sys-libs/glibc/files/2.18/glibc-2.18-gentoo-chk_fail.c
@@ -0,0 +1,314 @@
+/* Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* Copyright (C) 2006-2013 Gentoo Foundation Inc.
+ * License terms as above.
+ *
+ * Hardened Gentoo SSP and FORTIFY handler
+ *
+ * An SSP failure handler that does not use functions from the rest of
+ * glibc; it uses the INTERNAL_SYSCALL methods directly. This ensures
+ * no possibility of recursion into the handler.
+ *
+ * Direct all bug reports to http://bugs.gentoo.org/
+ *
+ * Re-written from the glibc-2.3 Hardened Gentoo SSP handler
+ * by Kevin F. Quinn - <kevquinn[@]gentoo.org>
+ *
+ * The following people contributed to the glibc-2.3 Hardened
+ * Gentoo SSP and FORTIFY handler, from which this implementation draws much:
+ *
+ * Ned Ludd - <solar[@]gentoo.org>
+ * Alexander Gabert - <pappy[@]gentoo.org>
+ * The PaX Team - <pageexec[@]freemail.hu>
+ * Peter S. Mazinger - <ps.m[@]gmx.net>
+ * Yoann Vandoorselaere - <yoann[@]prelude-ids.org>
+ * Robert Connolly - <robert[@]linuxfromscratch.org>
+ * Cory Visi <cory[@]visi.name>
+ * Mike Frysinger <vapier[@]gentoo.org>
+ * Magnus Granberg <zorry[@]ume.nu>
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <unistd.h>
+#include <signal.h>
+
+#include <sys/types.h>
+
+#include <sysdep-cancel.h>
+#include <sys/syscall.h>
+
+#include <kernel-features.h>
+
+#include <alloca.h>
+/* from sysdeps */
+#include <socketcall.h>
+/* for the stuff in bits/socket.h */
+#include <sys/socket.h>
+#include <sys/un.h>
+
+/* Sanity check on SYSCALL macro names - force compilation
+ * failure if the names used here do not exist
+ */
+#if !defined __NR_socketcall && !defined __NR_socket
+# error Cannot do syscall socket or socketcall
+#endif
+#if !defined __NR_socketcall && !defined __NR_connect
+# error Cannot do syscall connect or socketcall
+#endif
+#ifndef __NR_write
+# error Cannot do syscall write
+#endif
+#ifndef __NR_close
+# error Cannot do syscall close
+#endif
+#ifndef __NR_getpid
+# error Cannot do syscall getpid
+#endif
+#ifndef __NR_kill
+# error Cannot do syscall kill
+#endif
+#ifndef __NR_exit
+# error Cannot do syscall exit
+#endif
+#ifdef SSP_SMASH_DUMPS_CORE
+# define ENABLE_SSP_SMASH_DUMPS_CORE 1
+# if !defined _KERNEL_NSIG && !defined _NSIG
+# error No _NSIG or _KERNEL_NSIG for rt_sigaction
+# endif
+# if !defined __NR_sigaction && !defined __NR_rt_sigaction
+# error Cannot do syscall sigaction or rt_sigaction
+# endif
+/* Although rt_sigaction expects sizeof(sigset_t) - it expects the size
+ * of the _kernel_ sigset_t which is not the same as the user sigset_t.
+ * Most arches have this as _NSIG bits - mips has _KERNEL_NSIG bits for
+ * some reason.
+ */
+# ifdef _KERNEL_NSIG
+# define _SSP_NSIG _KERNEL_NSIG
+# else
+# define _SSP_NSIG _NSIG
+# endif
+#else
+# define _SSP_NSIG 0
+# define ENABLE_SSP_SMASH_DUMPS_CORE 0
+#endif
+
+/* Define DO_SIGACTION - default to newer rt signal interface but
+ * fallback to old as needed.
+ */
+#ifdef __NR_rt_sigaction
+# define DO_SIGACTION(signum, act, oldact) \
+ INLINE_SYSCALL(rt_sigaction, 4, signum, act, oldact, _SSP_NSIG/8)
+#else
+# define DO_SIGACTION(signum, act, oldact) \
+ INLINE_SYSCALL(sigaction, 3, signum, act, oldact)
+#endif
+
+/* Define DO_SOCKET/DO_CONNECT functions to deal with socketcall vs socket/connect */
+#if defined(__NR_socket) && defined(__NR_connect)
+# define USE_OLD_SOCKETCALL 0
+#else
+# define USE_OLD_SOCKETCALL 1
+#endif
+
+/* stub out the __NR_'s so we can let gcc optimize away dead code */
+#ifndef __NR_socketcall
+# define __NR_socketcall 0
+#endif
+#ifndef __NR_socket
+# define __NR_socket 0
+#endif
+#ifndef __NR_connect
+# define __NR_connect 0
+#endif
+#define DO_SOCKET(result, domain, type, protocol) \
+ do { \
+ if (USE_OLD_SOCKETCALL) { \
+ socketargs[0] = domain; \
+ socketargs[1] = type; \
+ socketargs[2] = protocol; \
+ socketargs[3] = 0; \
+ result = INLINE_SYSCALL(socketcall, 2, SOCKOP_socket, socketargs); \
+ } else \
+ result = INLINE_SYSCALL(socket, 3, domain, type, protocol); \
+ } while (0)
+#define DO_CONNECT(result, sockfd, serv_addr, addrlen) \
+ do { \
+ if (USE_OLD_SOCKETCALL) { \
+ socketargs[0] = sockfd; \
+ socketargs[1] = (unsigned long int)serv_addr; \
+ socketargs[2] = addrlen; \
+ socketargs[3] = 0; \
+ result = INLINE_SYSCALL(socketcall, 2, SOCKOP_connect, socketargs); \
+ } else \
+ result = INLINE_SYSCALL(connect, 3, sockfd, serv_addr, addrlen); \
+ } while (0)
+
+#ifndef _PATH_LOG
+# define _PATH_LOG "/dev/log"
+#endif
+
+static const char path_log[] = _PATH_LOG;
+
+/* For building glibc with SSP switched on, define __progname to a
+ * constant if building for the run-time loader, to avoid pulling
+ * in more of libc.so into ld.so
+ */
+#ifdef IS_IN_rtld
+static char *__progname = "<rtld>";
+#else
+extern char *__progname;
+#endif
+
+/* Common handler code, used by chk_fail
+ * Inlined to ensure no self-references to the handler within itself.
+ * Data static to avoid putting more than necessary on the stack,
+ * to aid core debugging.
+ */
+__attribute__ ((__noreturn__ , __always_inline__))
+static inline void
+__hardened_gentoo_chk_fail(char func[], int damaged)
+{
+#define MESSAGE_BUFSIZ 256
+ static pid_t pid;
+ static int plen, i;
+ static char message[MESSAGE_BUFSIZ];
+ static const char msg_ssa[] = ": buffer overflow attack";
+ static const char msg_inf[] = " in function ";
+ static const char msg_ssd[] = "*** buffer overflow detected ***: ";
+ static const char msg_terminated[] = " - terminated\n";
+ static const char msg_report[] = "Report to http://bugs.gentoo.org/\n";
+ static const char msg_unknown[] = "<unknown>";
+ static int log_socket, connect_result;
+ static struct sockaddr_un sock;
+ static unsigned long int socketargs[4];
+
+ /* Build socket address
+ */
+ sock.sun_family = AF_UNIX;
+ i = 0;
+ while ((path_log[i] != '\0') && (i<(sizeof(sock.sun_path)-1))) {
+ sock.sun_path[i] = path_log[i];
+ i++;
+ }
+ sock.sun_path[i] = '\0';
+
+ /* Try SOCK_DGRAM connection to syslog */
+ connect_result = -1;
+ DO_SOCKET(log_socket, AF_UNIX, SOCK_DGRAM, 0);
+ if (log_socket != -1)
+ DO_CONNECT(connect_result, log_socket, &sock, sizeof(sock));
+ if (connect_result == -1) {
+ if (log_socket != -1)
+ INLINE_SYSCALL(close, 1, log_socket);
+ /* Try SOCK_STREAM connection to syslog */
+ DO_SOCKET(log_socket, AF_UNIX, SOCK_STREAM, 0);
+ if (log_socket != -1)
+ DO_CONNECT(connect_result, log_socket, &sock, sizeof(sock));
+ }
+
+ /* Build message. Messages are generated both in the old style and new style,
+ * so that log watchers that are configured for the old-style message continue
+ * to work.
+ */
+#define strconcat(str) \
+ {i=0; while ((str[i] != '\0') && ((i+plen)<(MESSAGE_BUFSIZ-1))) \
+ {\
+ message[plen+i]=str[i];\
+ i++;\
+ }\
+ plen+=i;}
+
+ /* R.Henderson post-gcc-4 style message */
+ plen = 0;
+ strconcat(msg_ssd);
+ if (__progname != (char *)0)
+ strconcat(__progname)
+ else
+ strconcat(msg_unknown);
+ strconcat(msg_terminated);
+
+ /* Write out error message to STDERR, to syslog if open */
+ INLINE_SYSCALL(write, 3, STDERR_FILENO, message, plen);
+ if (connect_result != -1)
+ INLINE_SYSCALL(write, 3, log_socket, message, plen);
+
+ /* Dr. Etoh pre-gcc-4 style message */
+ plen = 0;
+ if (__progname != (char *)0)
+ strconcat(__progname)
+ else
+ strconcat(msg_unknown);
+ strconcat(msg_ssa);
+ strconcat(msg_inf);
+ if (func != NULL)
+ strconcat(func)
+ else
+ strconcat(msg_unknown);
+ strconcat(msg_terminated);
+ /* Write out error message to STDERR, to syslog if open */
+ INLINE_SYSCALL(write, 3, STDERR_FILENO, message, plen);
+ if (connect_result != -1)
+ INLINE_SYSCALL(write, 3, log_socket, message, plen);
+
+ /* Direct reports to bugs.gentoo.org */
+ plen=0;
+ strconcat(msg_report);
+ message[plen++]='\0';
+
+ /* Write out error message to STDERR, to syslog if open */
+ INLINE_SYSCALL(write, 3, STDERR_FILENO, message, plen);
+ if (connect_result != -1)
+ INLINE_SYSCALL(write, 3, log_socket, message, plen);
+
+ if (log_socket != -1)
+ INLINE_SYSCALL(close, 1, log_socket);
+
+ /* Suicide */
+ pid = INLINE_SYSCALL(getpid, 0);
+
+ if (ENABLE_SSP_SMASH_DUMPS_CORE) {
+ static struct sigaction default_abort_act;
+ /* Remove any user-supplied handler for SIGABRT, before using it */
+ default_abort_act.sa_handler = SIG_DFL;
+ default_abort_act.sa_sigaction = NULL;
+ __sigfillset(&default_abort_act.sa_mask);
+ default_abort_act.sa_flags = 0;
+ if (DO_SIGACTION(SIGABRT, &default_abort_act, NULL) == 0)
+ INLINE_SYSCALL(kill, 2, pid, SIGABRT);
+ }
+
+ /* Note; actions cannot be added to SIGKILL */
+ INLINE_SYSCALL(kill, 2, pid, SIGKILL);
+
+ /* In case the kill didn't work, exit anyway
+ * The loop prevents gcc thinking this routine returns
+ */
+ while (1)
+ INLINE_SYSCALL(exit, 0);
+}
+
+__attribute__ ((__noreturn__))
+void __chk_fail(void)
+{
+ __hardened_gentoo_chk_fail(NULL, 0);
+}
+
diff --git a/sys-libs/glibc/files/2.18/glibc-2.18-gentoo-stack_chk_fail.c b/sys-libs/glibc/files/2.18/glibc-2.18-gentoo-stack_chk_fail.c
new file mode 100644
index 000000000000..9535c2157895
--- /dev/null
+++ b/sys-libs/glibc/files/2.18/glibc-2.18-gentoo-stack_chk_fail.c
@@ -0,0 +1,322 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* Copyright (C) 2006-2013 Gentoo Foundation Inc.
+ * License terms as above.
+ *
+ * Hardened Gentoo SSP handler
+ *
+ * An SSP failure handler that does not use functions from the rest of
+ * glibc; it uses the INTERNAL_SYSCALL methods directly. This ensures
+ * no possibility of recursion into the handler.
+ *
+ * Direct all bug reports to http://bugs.gentoo.org/
+ *
+ * Re-written from the glibc-2.3 Hardened Gentoo SSP handler
+ * by Kevin F. Quinn - <kevquinn[@]gentoo.org>
+ *
+ * Fixed to support glibc-2.18 by Magnus Granberg - <zorry[@]gentoo.org>
+ *
+ * The following people contributed to the glibc-2.3 Hardened
+ * Gentoo SSP handler, from which this implementation draws much:
+ *
+ * Ned Ludd - <solar[@]gentoo.org>
+ * Alexander Gabert - <pappy[@]gentoo.org>
+ * The PaX Team - <pageexec[@]freemail.hu>
+ * Peter S. Mazinger - <ps.m[@]gmx.net>
+ * Yoann Vandoorselaere - <yoann[@]prelude-ids.org>
+ * Robert Connolly - <robert[@]linuxfromscratch.org>
+ * Cory Visi <cory[@]visi.name>
+ * Mike Frysinger <vapier[@]gentoo.org>
+ */
+
+#include <errno.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <signal.h>
+
+#include <sys/types.h>
+
+#include <sysdep-cancel.h>
+#include <sys/syscall.h>
+
+#include <kernel-features.h>
+
+#include <alloca.h>
+/* from sysdeps */
+#include <socketcall.h>
+/* for the stuff in bits/socket.h */
+#include <sys/socket.h>
+#include <sys/un.h>
+
+
+/* Sanity check on SYSCALL macro names - force compilation
+ * failure if the names used here do not exist
+ */
+#if !defined __NR_socketcall && !defined __NR_socket
+# error Cannot do syscall socket or socketcall
+#endif
+#if !defined __NR_socketcall && !defined __NR_connect
+# error Cannot do syscall connect or socketcall
+#endif
+#ifndef __NR_write
+# error Cannot do syscall write
+#endif
+#ifndef __NR_close
+# error Cannot do syscall close
+#endif
+#ifndef __NR_getpid
+# error Cannot do syscall getpid
+#endif
+#ifndef __NR_kill
+# error Cannot do syscall kill
+#endif
+#ifndef __NR_exit
+# error Cannot do syscall exit
+#endif
+#ifdef SSP_SMASH_DUMPS_CORE
+# define ENABLE_SSP_SMASH_DUMPS_CORE 1
+# if !defined _KERNEL_NSIG && !defined _NSIG
+# error No _NSIG or _KERNEL_NSIG for rt_sigaction
+# endif
+# if !defined __NR_sigaction && !defined __NR_rt_sigaction
+# error Cannot do syscall sigaction or rt_sigaction
+# endif
+/* Although rt_sigaction expects sizeof(sigset_t) - it expects the size
+ * of the _kernel_ sigset_t which is not the same as the user sigset_t.
+ * Most arches have this as _NSIG bits - mips has _KERNEL_NSIG bits for
+ * some reason.
+ */
+# ifdef _KERNEL_NSIG
+# define _SSP_NSIG _KERNEL_NSIG
+# else
+# define _SSP_NSIG _NSIG
+# endif
+#else
+# define _SSP_NSIG 0
+# define ENABLE_SSP_SMASH_DUMPS_CORE 0
+#endif
+
+/* Define DO_SIGACTION - default to newer rt signal interface but
+ * fallback to old as needed.
+ */
+#ifdef __NR_rt_sigaction
+# define DO_SIGACTION(signum, act, oldact) \
+ INLINE_SYSCALL(rt_sigaction, 4, signum, act, oldact, _SSP_NSIG/8)
+#else
+# define DO_SIGACTION(signum, act, oldact) \
+ INLINE_SYSCALL(sigaction, 3, signum, act, oldact)
+#endif
+
+/* Define DO_SOCKET/DO_CONNECT functions to deal with socketcall vs socket/connect */
+#if defined(__NR_socket) && defined(__NR_connect)
+# define USE_OLD_SOCKETCALL 0
+#else
+# define USE_OLD_SOCKETCALL 1
+#endif
+/* stub out the __NR_'s so we can let gcc optimize away dead code */
+#ifndef __NR_socketcall
+# define __NR_socketcall 0
+#endif
+#ifndef __NR_socket
+# define __NR_socket 0
+#endif
+#ifndef __NR_connect
+# define __NR_connect 0
+#endif
+#define DO_SOCKET(result, domain, type, protocol) \
+ do { \
+ if (USE_OLD_SOCKETCALL) { \
+ socketargs[0] = domain; \
+ socketargs[1] = type; \
+ socketargs[2] = protocol; \
+ socketargs[3] = 0; \
+ result = INLINE_SYSCALL(socketcall, 2, SOCKOP_socket, socketargs); \
+ } else \
+ result = INLINE_SYSCALL(socket, 3, domain, type, protocol); \
+ } while (0)
+#define DO_CONNECT(result, sockfd, serv_addr, addrlen) \
+ do { \
+ if (USE_OLD_SOCKETCALL) { \
+ socketargs[0] = sockfd; \
+ socketargs[1] = (unsigned long int)serv_addr; \
+ socketargs[2] = addrlen; \
+ socketargs[3] = 0; \
+ result = INLINE_SYSCALL(socketcall, 2, SOCKOP_connect, socketargs); \
+ } else \
+ result = INLINE_SYSCALL(connect, 3, sockfd, serv_addr, addrlen); \
+ } while (0)
+
+#ifndef _PATH_LOG
+# define _PATH_LOG "/dev/log"
+#endif
+
+static const char path_log[] = _PATH_LOG;
+
+/* For building glibc with SSP switched on, define __progname to a
+ * constant if building for the run-time loader, to avoid pulling
+ * in more of libc.so into ld.so
+ */
+#ifdef IS_IN_rtld
+static char *__progname = "<rtld>";
+#else
+extern char *__progname;
+#endif
+
+
+/* Common handler code, used by stack_chk_fail and __stack_smash_handler
+ * Inlined to ensure no self-references to the handler within itself.
+ * Data static to avoid putting more than necessary on the stack,
+ * to aid core debugging.
+ */
+__attribute__ ((__noreturn__ , __always_inline__))
+static inline void
+__hardened_gentoo_stack_chk_fail(char func[], int damaged)
+{
+#define MESSAGE_BUFSIZ 256
+ static pid_t pid;
+ static int plen, i;
+ static char message[MESSAGE_BUFSIZ];
+ static const char msg_ssa[] = ": stack smashing attack";
+ static const char msg_inf[] = " in function ";
+ static const char msg_ssd[] = "*** stack smashing detected ***: ";
+ static const char msg_terminated[] = " - terminated\n";
+ static const char msg_report[] = "Report to http://bugs.gentoo.org/\n";
+ static const char msg_unknown[] = "<unknown>";
+ static int log_socket, connect_result;
+ static struct sockaddr_un sock;
+ static unsigned long int socketargs[4];
+
+ /* Build socket address
+ */
+ sock.sun_family = AF_UNIX;
+ i = 0;
+ while ((path_log[i] != '\0') && (i<(sizeof(sock.sun_path)-1))) {
+ sock.sun_path[i] = path_log[i];
+ i++;
+ }
+ sock.sun_path[i] = '\0';
+
+ /* Try SOCK_DGRAM connection to syslog */
+ connect_result = -1;
+ DO_SOCKET(log_socket, AF_UNIX, SOCK_DGRAM, 0);
+ if (log_socket != -1)
+ DO_CONNECT(connect_result, log_socket, &sock, sizeof(sock));
+ if (connect_result == -1) {
+ if (log_socket != -1)
+ INLINE_SYSCALL(close, 1, log_socket);
+ /* Try SOCK_STREAM connection to syslog */
+ DO_SOCKET(log_socket, AF_UNIX, SOCK_STREAM, 0);
+ if (log_socket != -1)
+ DO_CONNECT(connect_result, log_socket, &sock, sizeof(sock));
+ }
+
+ /* Build message. Messages are generated both in the old style and new style,
+ * so that log watchers that are configured for the old-style message continue
+ * to work.
+ */
+#define strconcat(str) \
+ {i=0; while ((str[i] != '\0') && ((i+plen)<(MESSAGE_BUFSIZ-1))) \
+ {\
+ message[plen+i]=str[i];\
+ i++;\
+ }\
+ plen+=i;}
+
+ /* R.Henderson post-gcc-4 style message */
+ plen = 0;
+ strconcat(msg_ssd);
+ if (__progname != (char *)0)
+ strconcat(__progname)
+ else
+ strconcat(msg_unknown);
+ strconcat(msg_terminated);
+
+ /* Write out error message to STDERR, to syslog if open */
+ INLINE_SYSCALL(write, 3, STDERR_FILENO, message, plen);
+ if (connect_result != -1)
+ INLINE_SYSCALL(write, 3, log_socket, message, plen);
+
+ /* Dr. Etoh pre-gcc-4 style message */
+ plen = 0;
+ if (__progname != (char *)0)
+ strconcat(__progname)
+ else
+ strconcat(msg_unknown);
+ strconcat(msg_ssa);
+ strconcat(msg_inf);
+ if (func != NULL)
+ strconcat(func)
+ else
+ strconcat(msg_unknown);
+ strconcat(msg_terminated);
+ /* Write out error message to STDERR, to syslog if open */
+ INLINE_SYSCALL(write, 3, STDERR_FILENO, message, plen);
+ if (connect_result != -1)
+ INLINE_SYSCALL(write, 3, log_socket, message, plen);
+
+ /* Direct reports to bugs.gentoo.org */
+ plen=0;
+ strconcat(msg_report);
+ message[plen++]='\0';
+
+ /* Write out error message to STDERR, to syslog if open */
+ INLINE_SYSCALL(write, 3, STDERR_FILENO, message, plen);
+ if (connect_result != -1)
+ INLINE_SYSCALL(write, 3, log_socket, message, plen);
+
+ if (log_socket != -1)
+ INLINE_SYSCALL(close, 1, log_socket);
+
+ /* Suicide */
+ pid = INLINE_SYSCALL(getpid, 0);
+
+ if (ENABLE_SSP_SMASH_DUMPS_CORE) {
+ static struct sigaction default_abort_act;
+ /* Remove any user-supplied handler for SIGABRT, before using it */
+ default_abort_act.sa_handler = SIG_DFL;
+ default_abort_act.sa_sigaction = NULL;
+ __sigfillset(&default_abort_act.sa_mask);
+ default_abort_act.sa_flags = 0;
+ if (DO_SIGACTION(SIGABRT, &default_abort_act, NULL) == 0)
+ INLINE_SYSCALL(kill, 2, pid, SIGABRT);
+ }
+
+ /* Note; actions cannot be added to SIGKILL */
+ INLINE_SYSCALL(kill, 2, pid, SIGKILL);
+
+ /* In case the kill didn't work, exit anyway
+ * The loop prevents gcc thinking this routine returns
+ */
+ while (1)
+ INLINE_SYSCALL(exit, 0);
+}
+
+__attribute__ ((__noreturn__))
+void __stack_chk_fail(void)
+{
+ __hardened_gentoo_stack_chk_fail(NULL, 0);
+}
+
+#ifdef ENABLE_OLD_SSP_COMPAT
+__attribute__ ((__noreturn__))
+void __stack_smash_handler(char func[], int damaged)
+{
+ __hardened_gentoo_stack_chk_fail(func, damaged);
+}
+#endif
diff --git a/sys-libs/glibc/files/2.18/glibc-2.18-hardened-inittls-nosysenter.patch b/sys-libs/glibc/files/2.18/glibc-2.18-hardened-inittls-nosysenter.patch
new file mode 100644
index 000000000000..8907ab2c6a34
--- /dev/null
+++ b/sys-libs/glibc/files/2.18/glibc-2.18-hardened-inittls-nosysenter.patch
@@ -0,0 +1,277 @@
+When building glibc PIE (which is not something upstream support),
+several modifications are necessary to the glibc build process.
+
+First, any syscalls in PIEs must be of the PIC variant, otherwise
+textrels ensue. Then, any syscalls made before the initialisation
+of the TLS will fail on i386, as the sysenter variant on i386 uses
+the TLS, giving rise to a chicken-and-egg situation. This patch
+defines a PIC syscall variant that doesn't use sysenter, even when the sysenter
+version is normally used, and uses the non-sysenter version for the brk
+syscall that is performed by the TLS initialisation. Further, the TLS
+initialisation is moved in this case prior to the initialisation of
+dl_osversion, as that requires further syscalls.
+
+csu/libc-start.c: Move initial TLS initialization to before the
+initialisation of dl_osversion, when INTERNAL_SYSCALL_NOSYSENTER is defined
+
+csu/libc-tls.c: Use the no-sysenter version of sbrk when
+INTERNAL_SYSCALL_NOSYSENTER is defined.
+
+misc/sbrk.c: Define a no-sysenter version of sbrk, using the no-sysenter
+version of brk - if INTERNAL_SYSCALL_NOSYSENTER is defined.
+
+misc/brk.c: Define a no-sysenter version of brk if
+INTERNAL_SYSCALL_NOSYSENTER is defined.
+
+sysdeps/unix/sysv/linux/i386/sysdep.h: Define INTERNAL_SYSCALL_NOSYSENTER
+Make INTERNAL_SYSCALL always use the PIC variant, even if not SHARED.
+
+Patch by Kevin F. Quinn <kevquinn@gentoo.org>
+Fixed for 2.10 by Magnus Granberg <zorry@ume.nu>
+Fixed for 2.18 by Magnus Granberg <zorry@gentoo.org>
+
+--- csu/libc-start.c
++++ csu/libc-start.c
+@@ -28,6 +28,7 @@
+ extern int __libc_multiple_libcs;
+
+ #include <tls.h>
++#include <sysdep.h>
+ #ifndef SHARED
+ # include <dl-osinfo.h>
+ extern void __pthread_initialize_minimal (void);
+@@ -170,7 +170,11 @@ LIBC_START_MAIN (int (*main) (int, char
+ GL(dl_phnum) = __ehdr_start.e_phnum;
+ }
+ }
+-
++# ifdef INTERNAL_SYSCALL_NOSYSENTER
++ /* Do the initial TLS initialization before _dl_osversion,
++ since the latter uses the uname syscall. */
++ __pthread_initialize_minimal ();
++# endif
+ # ifdef DL_SYSDEP_OSCHECK
+ if (!__libc_multiple_libcs)
+ {
+@@ -138,10 +144,12 @@
+ }
+ # endif
+
++# ifndef INTERNAL_SYSCALL_NOSYSENTER
+ /* Initialize the thread library at least a bit since the libgcc
+ functions are using thread functions if these are available and
+ we need to setup errno. */
+ __pthread_initialize_minimal ();
++# endif
+
+ /* Set up the stack checker's canary. */
+ uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard ();
+--- csu/libc-tls.c
++++ csu/libc-tls.c
+@@ -22,14 +22,17 @@
+ #include <unistd.h>
+ #include <stdio.h>
+ #include <sys/param.h>
+-
++#include <sysdep.h>
+
+ #ifdef SHARED
+ #error makefile bug, this file is for static only
+ #endif
+
+-dtv_t _dl_static_dtv[2 + TLS_SLOTINFO_SURPLUS];
++#ifdef INTERNAL_SYSCALL_NOSYSENTER
++extern void *__sbrk_nosysenter (intptr_t __delta);
++#endif
+
++dtv_t _dl_static_dtv[2 + TLS_SLOTINFO_SURPLUS];
+
+ static struct
+ {
+@@ -139,14 +142,26 @@ __libc_setup_tls (size_t tcbsize, size_t
+
+ The initialized value of _dl_tls_static_size is provided by dl-open.c
+ to request some surplus that permits dynamic loading of modules with
+- IE-model TLS. */
++ IE-model TLS.
++
++ Where the normal sbrk would use a syscall that needs the TLS (i386)
++ use the special non-sysenter version instead. */
+ #if TLS_TCB_AT_TP
+ tcb_offset = roundup (memsz + GL(dl_tls_static_size), tcbalign);
++# ifdef INTERNAL_SYSCALL_NOSYSENTER
++ tlsblock = __sbrk_nosysenter (tcb_offset + tcbsize + max_align);
++# else
+ tlsblock = __sbrk (tcb_offset + tcbsize + max_align);
++#endif
+ #elif TLS_DTV_AT_TP
+ tcb_offset = roundup (tcbsize, align ?: 1);
++# ifdef INTERNAL_SYSCALL_NOSYSENTER
++ tlsblock = __sbrk_nosysenter (tcb_offset + memsz + max_align
++ + TLS_PRE_TCB_SIZE + GL(dl_tls_static_size));
++# else
+ tlsblock = __sbrk (tcb_offset + memsz + max_align
+ + TLS_PRE_TCB_SIZE + GL(dl_tls_static_size));
++#endif
+ tlsblock += TLS_PRE_TCB_SIZE;
+ #else
+ /* In case a model with a different layout for the TCB and DTV
+--- misc/sbrk.c
++++ misc/sbrk.c
+@@ -18,6 +18,7 @@
+ #include <errno.h>
+ #include <stdint.h>
+ #include <unistd.h>
++#include <sysdep.h>
+
+ /* Defined in brk.c. */
+ extern void *__curbrk;
+@@ -29,6 +30,35 @@
+ /* Extend the process's data space by INCREMENT.
+ If INCREMENT is negative, shrink data space by - INCREMENT.
+ Return start of new space allocated, or -1 for errors. */
++#ifdef INTERNAL_SYSCALL_NOSYSENTER
++/* This version is used by csu/libc-tls.c whem initialising the TLS
++ if the SYSENTER version requires the TLS (which it does on i386).
++ Obviously using the TLS before it is initialised is broken. */
++extern int __brk_nosysenter (void *addr);
++void *
++__sbrk_nosysenter (intptr_t increment)
++{
++ void *oldbrk;
++
++ /* If this is not part of the dynamic library or the library is used
++ via dynamic loading in a statically linked program update
++ __curbrk from the kernel's brk value. That way two separate
++ instances of __brk and __sbrk can share the heap, returning
++ interleaved pieces of it. */
++ if (__curbrk == NULL || __libc_multiple_libcs)
++ if (__brk_nosysenter (0) < 0) /* Initialize the break. */
++ return (void *) -1;
++
++ if (increment == 0)
++ return __curbrk;
++
++ oldbrk = __curbrk;
++ if (__brk_nosysenter (oldbrk + increment) < 0)
++ return (void *) -1;
++
++ return oldbrk;
++}
++#endif
+ void *
+ __sbrk (intptr_t increment)
+ {
+--- sysdeps/unix/sysv/linux/i386/brk.c
++++ sysdeps/unix/sysv/linux/i386/brk.c
+@@ -31,6 +31,29 @@
+ linker. */
+ weak_alias (__curbrk, ___brk_addr)
+
++#ifdef INTERNAL_SYSCALL_NOSYSENTER
++/* This version is used by csu/libc-tls.c whem initialising the TLS
++ * if the SYSENTER version requires the TLS (which it does on i386).
++ * Obviously using the TLS before it is initialised is broken. */
++int
++__brk_nosysenter (void *addr)
++{
++ void * newbrk;
++
++ INTERNAL_SYSCALL_DECL (err);
++ newbrk = (void *) INTERNAL_SYSCALL_NOSYSENTER (brk, err, 1, addr);
++
++ __curbrk = newbrk;
++
++ if (newbrk < addr)
++ {
++ __set_errno (ENOMEM);
++ return -1;
++ }
++
++ return 0;
++}
++#endif
+ int
+ __brk (void *addr)
+ {
+--- sysdeps/unix/sysv/linux/i386/sysdep.h
++++ sysdeps/unix/sysv/linux/i386/sysdep.h
+@@ -187,7 +187,7 @@
+ /* The original calling convention for system calls on Linux/i386 is
+ to use int $0x80. */
+ #ifdef I386_USE_SYSENTER
+-# ifdef SHARED
++# if defined SHARED || defined __PIC__
+ # define ENTER_KERNEL call *%gs:SYSINFO_OFFSET
+ # else
+ # define ENTER_KERNEL call *_dl_sysinfo
+@@ -358,7 +358,7 @@
+ possible to use more than four parameters. */
+ #undef INTERNAL_SYSCALL
+ #ifdef I386_USE_SYSENTER
+-# ifdef SHARED
++# if defined SHARED || defined __PIC__
+ # define INTERNAL_SYSCALL(name, err, nr, args...) \
+ ({ \
+ register unsigned int resultvar; \
+@@ -384,6 +384,18 @@
+ : "0" (name), "i" (offsetof (tcbhead_t, sysinfo)) \
+ ASMFMT_##nr(args) : "memory", "cc"); \
+ (int) resultvar; })
++# define INTERNAL_SYSCALL_NOSYSENTER(name, err, nr, args...) \
++ ({ \
++ register unsigned int resultvar; \
++ EXTRAVAR_##nr \
++ asm volatile ( \
++ LOADARGS_NOSYSENTER_##nr \
++ "movl %1, %%eax\n\t" \
++ "int $0x80\n\t" \
++ RESTOREARGS_NOSYSENTER_##nr \
++ : "=a" (resultvar) \
++ : "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc"); \
++ (int) resultvar; })
+ # else
+ # define INTERNAL_SYSCALL(name, err, nr, args...) \
+ ({ \
+@@ -447,12 +459,20 @@
+
+ #define LOADARGS_0
+ #ifdef __PIC__
+-# if defined I386_USE_SYSENTER && defined SHARED
++# if defined I386_USE_SYSENTER && ( defined SHARED || defined __PIC__ )
+ # define LOADARGS_1 \
+ "bpushl .L__X'%k3, %k3\n\t"
+ # define LOADARGS_5 \
+ "movl %%ebx, %4\n\t" \
+ "movl %3, %%ebx\n\t"
++# define LOADARGS_NOSYSENTER_1 \
++ "bpushl .L__X'%k2, %k2\n\t"
++# define LOADARGS_NOSYSENTER_2 LOADARGS_NOSYSENTER_1
++# define LOADARGS_NOSYSENTER_3 LOADARGS_3
++# define LOADARGS_NOSYSENTER_4 LOADARGS_3
++# define LOADARGS_NOSYSENTER_5 \
++ "movl %%ebx, %3\n\t" \
++ "movl %2, %%ebx\n\t"
+ # else
+ # define LOADARGS_1 \
+ "bpushl .L__X'%k2, %k2\n\t"
+@@ -474,11 +495,18 @@
+
+ #define RESTOREARGS_0
+ #ifdef __PIC__
+-# if defined I386_USE_SYSENTER && defined SHARED
++# if defined I386_USE_SYSENTER && ( defined SHARED || defined __PIC__ )
+ # define RESTOREARGS_1 \
+ "bpopl .L__X'%k3, %k3\n\t"
+ # define RESTOREARGS_5 \
+ "movl %4, %%ebx"
++# define RESTOREARGS_NOSYSENTER_1 \
++ "bpopl .L__X'%k2, %k2\n\t"
++# define RESTOREARGS_NOSYSENTER_2 RESTOREARGS_NOSYSENTER_1
++# define RESTOREARGS_NOSYSENTER_3 RESTOREARGS_3
++# define RESTOREARGS_NOSYSENTER_4 RESTOREARGS_3
++# define RESTOREARGS_NOSYSENTER_5 \
++ "movl %3, %%ebx"
+ # else
+ # define RESTOREARGS_1 \
+ "bpopl .L__X'%k2, %k2\n\t"
diff --git a/sys-libs/glibc/files/2.19/glibc-2.19-hardened-configure-picdefault.patch b/sys-libs/glibc/files/2.19/glibc-2.19-hardened-configure-picdefault.patch
new file mode 100644
index 000000000000..341d8c5028e1
--- /dev/null
+++ b/sys-libs/glibc/files/2.19/glibc-2.19-hardened-configure-picdefault.patch
@@ -0,0 +1,30 @@
+Prevent default-fPIE from confusing configure into thinking
+PIC code is default. This causes glibc to build both PIC and
+non-PIC code as normal, which on the hardened compiler generates
+PIC and PIE.
+
+Patch by Kevin F. Quinn <kevquinn@gentoo.org>
+Fixed for glibc 2.19 by Magnus Granberg <zorry@ume.nu>
+
+--- configure.ac
++++ configure.ac
+@@ -2145,7 +2145,7 @@
+ # error PIC is default.
+ #endif
+ EOF
+-if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
++if eval "${CC-cc} -fno-PIE -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
+ libc_cv_pic_default=no
+ fi
+ rm -f conftest.*])
+--- configure
++++ configure
+@@ -7698,7 +7698,7 @@
+ # error PIC is default.
+ #endif
+ EOF
+-if eval "${CC-cc} -S conftest.c 2>&5 1>&5"; then
++if eval "${CC-cc} -fno-PIE -S conftest.c 2>&5 1>&5"; then
+ libc_cv_pic_default=no
+ fi
+ rm -f conftest.*
diff --git a/sys-libs/glibc/files/2.20/glibc-2.20-gentoo-chk_fail.c b/sys-libs/glibc/files/2.20/glibc-2.20-gentoo-chk_fail.c
new file mode 100644
index 000000000000..a8ab9d8a3e29
--- /dev/null
+++ b/sys-libs/glibc/files/2.20/glibc-2.20-gentoo-chk_fail.c
@@ -0,0 +1,299 @@
+/* Copyright (C) 2004-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2014 Gentoo Foundation Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* Hardened Gentoo SSP and FORTIFY handler
+
+ A failure handler that does not use functions from the rest of glibc;
+ it uses the INTERNAL_SYSCALL methods directly. This helps ensure no
+ possibility of recursion into the handler.
+
+ Direct all bug reports to http://bugs.gentoo.org/
+
+ People who have contributed significantly to the evolution of this file:
+ Ned Ludd - <solar[@]gentoo.org>
+ Alexander Gabert - <pappy[@]gentoo.org>
+ The PaX Team - <pageexec[@]freemail.hu>
+ Peter S. Mazinger - <ps.m[@]gmx.net>
+ Yoann Vandoorselaere - <yoann[@]prelude-ids.org>
+ Robert Connolly - <robert[@]linuxfromscratch.org>
+ Cory Visi <cory[@]visi.name>
+ Mike Frysinger <vapier[@]gentoo.org>
+ Magnus Granberg <zorry[@]gentoo.org>
+ Kevin F. Quinn - <kevquinn[@]gentoo.org>
+ */
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <signal.h>
+
+#include <sys/types.h>
+
+#include <sysdep-cancel.h>
+#include <sys/syscall.h>
+
+#include <kernel-features.h>
+
+#include <alloca.h>
+/* from sysdeps */
+#include <socketcall.h>
+/* for the stuff in bits/socket.h */
+#include <sys/socket.h>
+#include <sys/un.h>
+
+/* Sanity check on SYSCALL macro names - force compilation
+ * failure if the names used here do not exist
+ */
+#if !defined __NR_socketcall && !defined __NR_socket
+# error Cannot do syscall socket or socketcall
+#endif
+#if !defined __NR_socketcall && !defined __NR_connect
+# error Cannot do syscall connect or socketcall
+#endif
+#ifndef __NR_write
+# error Cannot do syscall write
+#endif
+#ifndef __NR_close
+# error Cannot do syscall close
+#endif
+#ifndef __NR_getpid
+# error Cannot do syscall getpid
+#endif
+#ifndef __NR_kill
+# error Cannot do syscall kill
+#endif
+#ifndef __NR_exit
+# error Cannot do syscall exit
+#endif
+#ifdef SSP_SMASH_DUMPS_CORE
+# define ENABLE_SSP_SMASH_DUMPS_CORE 1
+# if !defined _KERNEL_NSIG && !defined _NSIG
+# error No _NSIG or _KERNEL_NSIG for rt_sigaction
+# endif
+# if !defined __NR_sigaction && !defined __NR_rt_sigaction
+# error Cannot do syscall sigaction or rt_sigaction
+# endif
+/* Although rt_sigaction expects sizeof(sigset_t) - it expects the size
+ * of the _kernel_ sigset_t which is not the same as the user sigset_t.
+ * Most arches have this as _NSIG bits - mips has _KERNEL_NSIG bits for
+ * some reason.
+ */
+# ifdef _KERNEL_NSIG
+# define _SSP_NSIG _KERNEL_NSIG
+# else
+# define _SSP_NSIG _NSIG
+# endif
+#else
+# define _SSP_NSIG 0
+# define ENABLE_SSP_SMASH_DUMPS_CORE 0
+#endif
+
+/* Define DO_SIGACTION - default to newer rt signal interface but
+ * fallback to old as needed.
+ */
+#ifdef __NR_rt_sigaction
+# define DO_SIGACTION(signum, act, oldact) \
+ INLINE_SYSCALL(rt_sigaction, 4, signum, act, oldact, _SSP_NSIG/8)
+#else
+# define DO_SIGACTION(signum, act, oldact) \
+ INLINE_SYSCALL(sigaction, 3, signum, act, oldact)
+#endif
+
+/* Define DO_SOCKET/DO_CONNECT functions to deal with socketcall vs socket/connect */
+#if defined(__NR_socket) && defined(__NR_connect)
+# define USE_OLD_SOCKETCALL 0
+#else
+# define USE_OLD_SOCKETCALL 1
+#endif
+
+/* stub out the __NR_'s so we can let gcc optimize away dead code */
+#ifndef __NR_socketcall
+# define __NR_socketcall 0
+#endif
+#ifndef __NR_socket
+# define __NR_socket 0
+#endif
+#ifndef __NR_connect
+# define __NR_connect 0
+#endif
+#define DO_SOCKET(result, domain, type, protocol) \
+ do { \
+ if (USE_OLD_SOCKETCALL) { \
+ socketargs[0] = domain; \
+ socketargs[1] = type; \
+ socketargs[2] = protocol; \
+ socketargs[3] = 0; \
+ result = INLINE_SYSCALL(socketcall, 2, SOCKOP_socket, socketargs); \
+ } else \
+ result = INLINE_SYSCALL(socket, 3, domain, type, protocol); \
+ } while (0)
+#define DO_CONNECT(result, sockfd, serv_addr, addrlen) \
+ do { \
+ if (USE_OLD_SOCKETCALL) { \
+ socketargs[0] = sockfd; \
+ socketargs[1] = (unsigned long int)serv_addr; \
+ socketargs[2] = addrlen; \
+ socketargs[3] = 0; \
+ result = INLINE_SYSCALL(socketcall, 2, SOCKOP_connect, socketargs); \
+ } else \
+ result = INLINE_SYSCALL(connect, 3, sockfd, serv_addr, addrlen); \
+ } while (0)
+
+#ifndef _PATH_LOG
+# define _PATH_LOG "/dev/log"
+#endif
+
+static const char path_log[] = _PATH_LOG;
+
+/* For building glibc with SSP switched on, define __progname to a
+ * constant if building for the run-time loader, to avoid pulling
+ * in more of libc.so into ld.so
+ */
+#ifdef IS_IN_rtld
+static const char *__progname = "<ldso>";
+#else
+extern const char *__progname;
+#endif
+
+#ifdef GENTOO_SSP_HANDLER
+# define ERROR_MSG "stack smashing"
+#else
+# define ERROR_MSG "buffer overflow"
+#endif
+
+/* Common handler code, used by chk_fail
+ * Inlined to ensure no self-references to the handler within itself.
+ * Data static to avoid putting more than necessary on the stack,
+ * to aid core debugging.
+ */
+__attribute__ ((__noreturn__, __always_inline__))
+static inline void
+__hardened_gentoo_fail(void)
+{
+#define MESSAGE_BUFSIZ 512
+ static pid_t pid;
+ static int plen, i, hlen;
+ static char message[MESSAGE_BUFSIZ];
+ /* <11> is LOG_USER|LOG_ERR. A dummy date for loggers to skip over. */
+ static const char msg_header[] = "<11>" __DATE__ " " __TIME__ " glibc-gentoo-hardened-check: ";
+ static const char msg_ssd[] = "*** " ERROR_MSG " detected ***: ";
+ static const char msg_terminated[] = " terminated; ";
+ static const char msg_report[] = "report to " REPORT_BUGS_TO "\n";
+ static const char msg_unknown[] = "<unknown>";
+ static int log_socket, connect_result;
+ static struct sockaddr_un sock;
+ static unsigned long int socketargs[4];
+
+ /* Build socket address */
+ sock.sun_family = AF_UNIX;
+ i = 0;
+ while (path_log[i] != '\0' && i < sizeof(sock.sun_path) - 1) {
+ sock.sun_path[i] = path_log[i];
+ ++i;
+ }
+ sock.sun_path[i] = '\0';
+
+ /* Try SOCK_DGRAM connection to syslog */
+ connect_result = -1;
+ DO_SOCKET(log_socket, AF_UNIX, SOCK_DGRAM, 0);
+ if (log_socket != -1)
+ DO_CONNECT(connect_result, log_socket, &sock, sizeof(sock));
+ if (connect_result == -1) {
+ if (log_socket != -1)
+ INLINE_SYSCALL(close, 1, log_socket);
+ /* Try SOCK_STREAM connection to syslog */
+ DO_SOCKET(log_socket, AF_UNIX, SOCK_STREAM, 0);
+ if (log_socket != -1)
+ DO_CONNECT(connect_result, log_socket, &sock, sizeof(sock));
+ }
+
+ /* Build message. Messages are generated both in the old style and new style,
+ * so that log watchers that are configured for the old-style message continue
+ * to work.
+ */
+#define strconcat(str) \
+ ({ \
+ i = 0; \
+ while ((str[i] != '\0') && ((i + plen) < (MESSAGE_BUFSIZ - 1))) { \
+ message[plen + i] = str[i]; \
+ ++i; \
+ } \
+ plen += i; \
+ })
+
+ /* Tersely log the failure */
+ plen = 0;
+ strconcat(msg_header);
+ hlen = plen;
+ strconcat(msg_ssd);
+ if (__progname != NULL)
+ strconcat(__progname);
+ else
+ strconcat(msg_unknown);
+ strconcat(msg_terminated);
+ strconcat(msg_report);
+
+ /* Write out error message to STDERR, to syslog if open */
+ INLINE_SYSCALL(write, 3, STDERR_FILENO, message + hlen, plen - hlen);
+ if (connect_result != -1) {
+ INLINE_SYSCALL(write, 3, log_socket, message, plen);
+ INLINE_SYSCALL(close, 1, log_socket);
+ }
+
+ /* Time to kill self since we have no idea what is going on */
+ pid = INLINE_SYSCALL(getpid, 0);
+
+ if (ENABLE_SSP_SMASH_DUMPS_CORE) {
+ /* Remove any user-supplied handler for SIGABRT, before using it. */
+#if 0
+ /*
+ * Note: Disabled because some programs catch & process their
+ * own crashes. We've already enabled this code path which
+ * means we want to let core dumps happen.
+ */
+ static struct sigaction default_abort_act;
+ default_abort_act.sa_handler = SIG_DFL;
+ default_abort_act.sa_sigaction = NULL;
+ __sigfillset(&default_abort_act.sa_mask);
+ default_abort_act.sa_flags = 0;
+ if (DO_SIGACTION(SIGABRT, &default_abort_act, NULL) == 0)
+#endif
+ INLINE_SYSCALL(kill, 2, pid, SIGABRT);
+ }
+
+ /* SIGKILL is only signal which cannot be caught */
+ INLINE_SYSCALL(kill, 2, pid, SIGKILL);
+
+ /* In case the kill didn't work, exit anyway.
+ * The loop prevents gcc thinking this routine returns.
+ */
+ while (1)
+ INLINE_SYSCALL(exit, 1, 137);
+}
+
+__attribute__ ((__noreturn__))
+#ifdef GENTOO_SSP_HANDLER
+void __stack_chk_fail(void)
+#else
+void __chk_fail(void)
+#endif
+{
+ __hardened_gentoo_fail();
+}
diff --git a/sys-libs/glibc/files/2.20/glibc-2.20-gentoo-stack_chk_fail.c b/sys-libs/glibc/files/2.20/glibc-2.20-gentoo-stack_chk_fail.c
new file mode 100644
index 000000000000..4a537bb52c5f
--- /dev/null
+++ b/sys-libs/glibc/files/2.20/glibc-2.20-gentoo-stack_chk_fail.c
@@ -0,0 +1,2 @@
+#define GENTOO_SSP_HANDLER
+#include <debug/chk_fail.c>
diff --git a/sys-libs/glibc/files/2.20/glibc-2.20-hardened-inittls-nosysenter.patch b/sys-libs/glibc/files/2.20/glibc-2.20-hardened-inittls-nosysenter.patch
new file mode 100644
index 000000000000..35eabe94014a
--- /dev/null
+++ b/sys-libs/glibc/files/2.20/glibc-2.20-hardened-inittls-nosysenter.patch
@@ -0,0 +1,306 @@
+When building glibc PIE (which is not something upstream support),
+several modifications are necessary to the glibc build process.
+
+First, any syscalls in PIEs must be of the PIC variant, otherwise
+textrels ensue. Then, any syscalls made before the initialisation
+of the TLS will fail on i386, as the sysenter variant on i386 uses
+the TLS, giving rise to a chicken-and-egg situation. This patch
+defines a PIC syscall variant that doesn't use sysenter, even when the sysenter
+version is normally used, and uses the non-sysenter version for the brk
+syscall that is performed by the TLS initialisation. Further, the TLS
+initialisation is moved in this case prior to the initialisation of
+dl_osversion, as that requires further syscalls.
+
+csu/libc-start.c: Move initial TLS initialization to before the
+initialisation of dl_osversion, when INTERNAL_SYSCALL_PRE_TLS is defined
+
+csu/libc-tls.c: Use the no-sysenter version of sbrk when
+INTERNAL_SYSCALL_PRE_TLS is defined.
+
+misc/sbrk.c: Define a no-sysenter version of sbrk, using the no-sysenter
+version of brk - if INTERNAL_SYSCALL_PRE_TLS is defined.
+
+misc/brk.c: Define a no-sysenter version of brk if
+INTERNAL_SYSCALL_PRE_TLS is defined.
+
+sysdeps/unix/sysv/linux/i386/sysdep.h: Define INTERNAL_SYSCALL_PRE_TLS
+Make INTERNAL_SYSCALL always use the PIC variant, even if not SHARED.
+
+Patch by Kevin F. Quinn <kevquinn@gentoo.org>
+Fixed for 2.10 by Magnus Granberg <zorry@ume.nu>
+Fixed for 2.18 by Magnus Granberg <zorry@gentoo.org>
+Fixed for 2.20 by Francisco Blas Izquierdo Riera <klondike@gentoo.org>
+
+--- a/csu/libc-start.c
++++ b/csu/libc-start.c
+@@ -28,6 +28,7 @@
+ extern int __libc_multiple_libcs;
+
+ #include <tls.h>
++#include <sysdep.h>
+ #ifndef SHARED
+ # include <dl-osinfo.h>
+ extern void __pthread_initialize_minimal (void);
+@@ -170,6 +171,11 @@ LIBC_START_MAIN (int (*main) (int, char
+ }
+ }
+
++# ifdef INTERNAL_SYSCALL_PRE_TLS
++ /* Do the initial TLS initialization before _dl_osversion,
++ since the latter uses the uname syscall. */
++ __pthread_initialize_minimal ();
++# endif
+ # ifdef DL_SYSDEP_OSCHECK
+ if (!__libc_multiple_libcs)
+ {
+@@ -138,10 +144,12 @@
+ }
+ # endif
+
++# ifndef INTERNAL_SYSCALL_PRE_TLS
+ /* Initialize the thread library at least a bit since the libgcc
+ functions are using thread functions if these are available and
+ we need to setup errno. */
+ __pthread_initialize_minimal ();
++# endif
+
+ /* Set up the stack checker's canary. */
+ uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard ();
+--- a/csu/libc-tls.c
++++ b/csu/libc-tls.c
+@@ -22,12 +22,17 @@
+ #include <unistd.h>
+ #include <stdio.h>
+ #include <sys/param.h>
++#include <sysdep.h>
+
+
+ #ifdef SHARED
+ #error makefile bug, this file is for static only
+ #endif
+
++#ifdef INTERNAL_SYSCALL_PRE_TLS
++extern void *__sbrk_nosysenter (intptr_t __delta);
++#endif
++
+ dtv_t _dl_static_dtv[2 + TLS_SLOTINFO_SURPLUS];
+
+
+@@ -139,20 +144,29 @@ __libc_setup_tls (size_t tcbsize, size_t
+
+ The initialized value of _dl_tls_static_size is provided by dl-open.c
+ to request some surplus that permits dynamic loading of modules with
+- IE-model TLS. */
++ IE-model TLS.
++
++ Where the normal sbrk would use a syscall that needs the TLS (i386)
++ use the special non-sysenter version instead. */
++#ifdef INTERNAL_SYSCALL_PRE_TLS
++# define __sbrk __sbrk_nosysenter
++#endif
+ #if TLS_TCB_AT_TP
+ tcb_offset = roundup (memsz + GL(dl_tls_static_size), tcbalign);
+ tlsblock = __sbrk (tcb_offset + tcbsize + max_align);
+ #elif TLS_DTV_AT_TP
+ tcb_offset = roundup (tcbsize, align ?: 1);
+ tlsblock = __sbrk (tcb_offset + memsz + max_align
+ + TLS_PRE_TCB_SIZE + GL(dl_tls_static_size));
+ tlsblock += TLS_PRE_TCB_SIZE;
+ #else
+ /* In case a model with a different layout for the TCB and DTV
+ is defined add another #elif here and in the following #ifs. */
+ # error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
+ #endif
++#ifdef INTERNAL_SYSCALL_PRE_TLS
++# undef __sbrk
++#endif
+
+ /* Align the TLS block. */
+ tlsblock = (void *) (((uintptr_t) tlsblock + max_align - 1)
+--- a/misc/sbrk.c
++++ b/misc/sbrk.c
+@@ -18,6 +18,7 @@
+ #include <errno.h>
+ #include <stdint.h>
+ #include <unistd.h>
++#include <sysdep.h>
+
+ /* Defined in brk.c. */
+ extern void *__curbrk;
+@@ -29,6 +30,35 @@
+ /* Extend the process's data space by INCREMENT.
+ If INCREMENT is negative, shrink data space by - INCREMENT.
+ Return start of new space allocated, or -1 for errors. */
++#ifdef INTERNAL_SYSCALL_PRE_TLS
++/* This version is used by csu/libc-tls.c whem initialising the TLS
++ if the SYSENTER version requires the TLS (which it does on i386).
++ Obviously using the TLS before it is initialised is broken. */
++extern int __brk_nosysenter (void *addr);
++void *
++__sbrk_nosysenter (intptr_t increment)
++{
++ void *oldbrk;
++
++ /* If this is not part of the dynamic library or the library is used via
++ dynamic loading in a statically linked program update __curbrk from the
++ kernel's brk value. That way two separate instances of __brk and __sbrk
++ can share the heap, returning interleaved pieces of it. */
++ if (__curbrk == NULL || __libc_multiple_libcs)
++ if (__brk_nosysenter (0) < 0) /* Initialize the break. */
++ return (void *) -1;
++
++ if (increment == 0)
++ return __curbrk;
++
++ oldbrk = __curbrk;
++ if (__brk_nosysenter (oldbrk + increment) < 0)
++ return (void *) -1;
++
++ return oldbrk;
++}
++#endif
++
+ void *
+ __sbrk (intptr_t increment)
+ {
+--- a/sysdeps/unix/sysv/linux/i386/brk.c
++++ b/sysdeps/unix/sysv/linux/i386/brk.c
+@@ -31,6 +31,30 @@
+ linker. */
+ weak_alias (__curbrk, ___brk_addr)
+
++#ifdef INTERNAL_SYSCALL_PRE_TLS
++/* This version is used by csu/libc-tls.c whem initialising the TLS
++ if the SYSENTER version requires the TLS (which it does on i386).
++ Obviously using the TLS before it is initialised is broken. */
++int
++__brk_nosysenter (void *addr)
++{
++ void *newbrk;
++
++ INTERNAL_SYSCALL_DECL (err);
++ newbrk = (void *) INTERNAL_SYSCALL_PRE_TLS (brk, err, 1, addr);
++
++ __curbrk = newbrk;
++
++ if (newbrk < addr)
++ {
++ __set_errno (ENOMEM);
++ return -1;
++ }
++
++ return 0;
++}
++#endif
++
+ int
+ __brk (void *addr)
+ {
+--- a/sysdeps/unix/sysv/linux/i386/sysdep.h
++++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
+@@ -187,7 +187,7 @@
+ /* The original calling convention for system calls on Linux/i386 is
+ to use int $0x80. */
+ #ifdef I386_USE_SYSENTER
+-# ifdef SHARED
++# ifdef __PIC__
+ # define ENTER_KERNEL call *%gs:SYSINFO_OFFSET
+ # else
+ # define ENTER_KERNEL call *_dl_sysinfo
+@@ -358,7 +358,7 @@
+ possible to use more than four parameters. */
+ #undef INTERNAL_SYSCALL
+ #ifdef I386_USE_SYSENTER
+-# ifdef SHARED
++# ifdef __PIC__
+ # define INTERNAL_SYSCALL(name, err, nr, args...) \
+ ({ \
+ register unsigned int resultvar; \
+@@ -384,6 +384,18 @@
+ : "0" (name), "i" (offsetof (tcbhead_t, sysinfo)) \
+ ASMFMT_##nr(args) : "memory", "cc"); \
+ (int) resultvar; })
++# define INTERNAL_SYSCALL_PRE_TLS(name, err, nr, args...) \
++ ({ \
++ register unsigned int resultvar; \
++ EXTRAVAR_##nr \
++ asm volatile ( \
++ LOADARGS_NOSYSENTER_##nr \
++ "movl %1, %%eax\n\t" \
++ "int $0x80\n\t" \
++ RESTOREARGS_NOSYSENTER_##nr \
++ : "=a" (resultvar) \
++ : "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc"); \
++ (int) resultvar; })
+ # else
+ # define INTERNAL_SYSCALL(name, err, nr, args...) \
+ ({ \
+@@ -447,12 +459,20 @@
+
+ #define LOADARGS_0
+ #ifdef __PIC__
+-# if defined I386_USE_SYSENTER && defined SHARED
++# if defined I386_USE_SYSENTER && defined __PIC__
+ # define LOADARGS_1 \
+ "bpushl .L__X'%k3, %k3\n\t"
+ # define LOADARGS_5 \
+ "movl %%ebx, %4\n\t" \
+ "movl %3, %%ebx\n\t"
++# define LOADARGS_NOSYSENTER_1 \
++ "bpushl .L__X'%k2, %k2\n\t"
++# define LOADARGS_NOSYSENTER_2 LOADARGS_NOSYSENTER_1
++# define LOADARGS_NOSYSENTER_3 LOADARGS_3
++# define LOADARGS_NOSYSENTER_4 LOADARGS_3
++# define LOADARGS_NOSYSENTER_5 \
++ "movl %%ebx, %3\n\t" \
++ "movl %2, %%ebx\n\t"
+ # else
+ # define LOADARGS_1 \
+ "bpushl .L__X'%k2, %k2\n\t"
+@@ -474,11 +494,18 @@
+
+ #define RESTOREARGS_0
+ #ifdef __PIC__
+-# if defined I386_USE_SYSENTER && defined SHARED
++# if defined I386_USE_SYSENTER && defined __PIC__
+ # define RESTOREARGS_1 \
+ "bpopl .L__X'%k3, %k3\n\t"
+ # define RESTOREARGS_5 \
+ "movl %4, %%ebx"
++# define RESTOREARGS_NOSYSENTER_1 \
++ "bpopl .L__X'%k2, %k2\n\t"
++# define RESTOREARGS_NOSYSENTER_2 RESTOREARGS_NOSYSENTER_1
++# define RESTOREARGS_NOSYSENTER_3 RESTOREARGS_3
++# define RESTOREARGS_NOSYSENTER_4 RESTOREARGS_3
++# define RESTOREARGS_NOSYSENTER_5 \
++ "movl %3, %%ebx"
+ # else
+ # define RESTOREARGS_1 \
+ "bpopl .L__X'%k2, %k2\n\t"
+--- a/sysdeps/i386/nptl/tls.h
++++ b/sysdeps/i386/nptl/tls.h
+@@ -189,6 +189,15 @@
+ desc->vals[3] = 0x51;
+ }
+
++/* We have no sysenter until the tls is initialized which is a
++ problem for PIC. Thus we need to do the right call depending
++ on the situation. */
++#ifndef INTERNAL_SYSCALL_PRE_TLS
++# define TLS_INIT_SYSCALL INTERNAL_SYSCALL
++#else
++# define TLS_INIT_SYSCALL INTERNAL_SYSCALL_PRE_TLS
++#endif
++
+ /* Code to initially initialize the thread pointer. This might need
+ special attention since 'errno' is not yet available and if the
+ operation can cause a failure 'errno' must not be touched. */
+@@ -209,7 +218,7 @@
+ \
+ /* Install the TLS. */ \
+ INTERNAL_SYSCALL_DECL (err); \
+- _result = INTERNAL_SYSCALL (set_thread_area, err, 1, &_segdescr.desc); \
++ _result = TLS_INIT_SYSCALL (set_thread_area, err, 1, &_segdescr.desc); \
+ \
+ if (_result == 0) \
+ /* We know the index in the GDT, now load the segment register. \
diff --git a/sys-libs/glibc/files/2.6/glibc-2.6-gentoo-stack_chk_fail.c b/sys-libs/glibc/files/2.6/glibc-2.6-gentoo-stack_chk_fail.c
new file mode 100644
index 000000000000..217bf1a90790
--- /dev/null
+++ b/sys-libs/glibc/files/2.6/glibc-2.6-gentoo-stack_chk_fail.c
@@ -0,0 +1,321 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* Copyright (C) 2006-2007 Gentoo Foundation Inc.
+ * License terms as above.
+ *
+ * Hardened Gentoo SSP handler
+ *
+ * An SSP failure handler that does not use functions from the rest of
+ * glibc; it uses the INTERNAL_SYSCALL methods directly. This ensures
+ * no possibility of recursion into the handler.
+ *
+ * Direct all bug reports to http://bugs.gentoo.org/
+ *
+ * Re-written from the glibc-2.3 Hardened Gentoo SSP handler
+ * by Kevin F. Quinn - <kevquinn[@]gentoo.org>
+ *
+ * The following people contributed to the glibc-2.3 Hardened
+ * Gentoo SSP handler, from which this implementation draws much:
+ *
+ * Ned Ludd - <solar[@]gentoo.org>
+ * Alexander Gabert - <pappy[@]gentoo.org>
+ * The PaX Team - <pageexec[@]freemail.hu>
+ * Peter S. Mazinger - <ps.m[@]gmx.net>
+ * Yoann Vandoorselaere - <yoann[@]prelude-ids.org>
+ * Robert Connolly - <robert[@]linuxfromscratch.org>
+ * Cory Visi <cory[@]visi.name>
+ * Mike Frysinger <vapier[@]gentoo.org>
+ */
+
+#include <errno.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <signal.h>
+
+#include <sys/types.h>
+
+#include <sysdep-cancel.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+#include <kernel-features.h>
+
+#include <alloca.h>
+/* from sysdeps */
+#include <socketcall.h>
+/* for the stuff in bits/socket.h */
+#include <sys/socket.h>
+#include <sys/un.h>
+
+
+/* Sanity check on SYSCALL macro names - force compilation
+ * failure if the names used here do not exist
+ */
+#if !defined __NR_socketcall && !defined __NR_socket
+# error Cannot do syscall socket or socketcall
+#endif
+#if !defined __NR_socketcall && !defined __NR_connect
+# error Cannot do syscall connect or socketcall
+#endif
+#ifndef __NR_write
+# error Cannot do syscall write
+#endif
+#ifndef __NR_close
+# error Cannot do syscall close
+#endif
+#ifndef __NR_getpid
+# error Cannot do syscall getpid
+#endif
+#ifndef __NR_kill
+# error Cannot do syscall kill
+#endif
+#ifndef __NR_exit
+# error Cannot do syscall exit
+#endif
+#ifdef SSP_SMASH_DUMPS_CORE
+# define ENABLE_SSP_SMASH_DUMPS_CORE 1
+# if !defined _KERNEL_NSIG && !defined _NSIG
+# error No _NSIG or _KERNEL_NSIG for rt_sigaction
+# endif
+# if !defined __NR_sigaction && !defined __NR_rt_sigaction
+# error Cannot do syscall sigaction or rt_sigaction
+# endif
+/* Although rt_sigaction expects sizeof(sigset_t) - it expects the size
+ * of the _kernel_ sigset_t which is not the same as the user sigset_t.
+ * Most arches have this as _NSIG bits - mips has _KERNEL_NSIG bits for
+ * some reason.
+ */
+# ifdef _KERNEL_NSIG
+# define _SSP_NSIG _KERNEL_NSIG
+# else
+# define _SSP_NSIG _NSIG
+# endif
+#else
+# define _SSP_NSIG 0
+# define ENABLE_SSP_SMASH_DUMPS_CORE 0
+#endif
+
+/* Define DO_SIGACTION - default to newer rt signal interface but
+ * fallback to old as needed.
+ */
+#ifdef __NR_rt_sigaction
+# define DO_SIGACTION(signum, act, oldact) \
+ INLINE_SYSCALL(rt_sigaction, 4, signum, act, oldact, _SSP_NSIG/8)
+#else
+# define DO_SIGACTION(signum, act, oldact) \
+ INLINE_SYSCALL(sigaction, 3, signum, act, oldact)
+#endif
+
+/* Define DO_SOCKET/DO_CONNECT functions to deal with socketcall vs socket/connect */
+#if defined(__NR_socket) && defined(__NR_connect)
+# define USE_OLD_SOCKETCALL 0
+#else
+# define USE_OLD_SOCKETCALL 1
+#endif
+/* stub out the __NR_'s so we can let gcc optimize away dead code */
+#ifndef __NR_socketcall
+# define __NR_socketcall 0
+#endif
+#ifndef __NR_socket
+# define __NR_socket 0
+#endif
+#ifndef __NR_connect
+# define __NR_connect 0
+#endif
+#define DO_SOCKET(result, domain, type, protocol) \
+ do { \
+ if (USE_OLD_SOCKETCALL) { \
+ socketargs[0] = domain; \
+ socketargs[1] = type; \
+ socketargs[2] = protocol; \
+ socketargs[3] = 0; \
+ result = INLINE_SYSCALL(socketcall, 2, SOCKOP_socket, socketargs); \
+ } else \
+ result = INLINE_SYSCALL(socket, 3, domain, type, protocol); \
+ } while (0)
+#define DO_CONNECT(result, sockfd, serv_addr, addrlen) \
+ do { \
+ if (USE_OLD_SOCKETCALL) { \
+ socketargs[0] = sockfd; \
+ socketargs[1] = (unsigned long int)serv_addr; \
+ socketargs[2] = addrlen; \
+ socketargs[3] = 0; \
+ result = INLINE_SYSCALL(socketcall, 2, SOCKOP_connect, socketargs); \
+ } else \
+ result = INLINE_SYSCALL(connect, 3, sockfd, serv_addr, addrlen); \
+ } while (0)
+
+#ifndef _PATH_LOG
+# define _PATH_LOG "/dev/log"
+#endif
+
+static const char path_log[] = _PATH_LOG;
+
+/* For building glibc with SSP switched on, define __progname to a
+ * constant if building for the run-time loader, to avoid pulling
+ * in more of libc.so into ld.so
+ */
+#ifdef IS_IN_rtld
+static char *__progname = "<rtld>";
+#else
+extern char *__progname;
+#endif
+
+
+/* Common handler code, used by stack_chk_fail and __stack_smash_handler
+ * Inlined to ensure no self-references to the handler within itself.
+ * Data static to avoid putting more than necessary on the stack,
+ * to aid core debugging.
+ */
+__attribute__ ((__noreturn__ , __always_inline__))
+static inline void
+__hardened_gentoo_stack_chk_fail(char func[], int damaged)
+{
+#define MESSAGE_BUFSIZ 256
+ static pid_t pid;
+ static int plen, i;
+ static char message[MESSAGE_BUFSIZ];
+ static const char msg_ssa[] = ": stack smashing attack";
+ static const char msg_inf[] = " in function ";
+ static const char msg_ssd[] = "*** stack smashing detected ***: ";
+ static const char msg_terminated[] = " - terminated\n";
+ static const char msg_report[] = "Report to http://bugs.gentoo.org/\n";
+ static const char msg_unknown[] = "<unknown>";
+ static int log_socket, connect_result;
+ static struct sockaddr_un sock;
+ static unsigned long int socketargs[4];
+
+ /* Build socket address
+ */
+ sock.sun_family = AF_UNIX;
+ i = 0;
+ while ((path_log[i] != '\0') && (i<(sizeof(sock.sun_path)-1))) {
+ sock.sun_path[i] = path_log[i];
+ i++;
+ }
+ sock.sun_path[i] = '\0';
+
+ /* Try SOCK_DGRAM connection to syslog */
+ connect_result = -1;
+ DO_SOCKET(log_socket, AF_UNIX, SOCK_DGRAM, 0);
+ if (log_socket != -1)
+ DO_CONNECT(connect_result, log_socket, &sock, sizeof(sock));
+ if (connect_result == -1) {
+ if (log_socket != -1)
+ INLINE_SYSCALL(close, 1, log_socket);
+ /* Try SOCK_STREAM connection to syslog */
+ DO_SOCKET(log_socket, AF_UNIX, SOCK_STREAM, 0);
+ if (log_socket != -1)
+ DO_CONNECT(connect_result, log_socket, &sock, sizeof(sock));
+ }
+
+ /* Build message. Messages are generated both in the old style and new style,
+ * so that log watchers that are configured for the old-style message continue
+ * to work.
+ */
+#define strconcat(str) \
+ {i=0; while ((str[i] != '\0') && ((i+plen)<(MESSAGE_BUFSIZ-1))) \
+ {\
+ message[plen+i]=str[i];\
+ i++;\
+ }\
+ plen+=i;}
+
+ /* R.Henderson post-gcc-4 style message */
+ plen = 0;
+ strconcat(msg_ssd);
+ if (__progname != (char *)0)
+ strconcat(__progname)
+ else
+ strconcat(msg_unknown);
+ strconcat(msg_terminated);
+
+ /* Write out error message to STDERR, to syslog if open */
+ INLINE_SYSCALL(write, 3, STDERR_FILENO, message, plen);
+ if (connect_result != -1)
+ INLINE_SYSCALL(write, 3, log_socket, message, plen);
+
+ /* Dr. Etoh pre-gcc-4 style message */
+ plen = 0;
+ if (__progname != (char *)0)
+ strconcat(__progname)
+ else
+ strconcat(msg_unknown);
+ strconcat(msg_ssa);
+ strconcat(msg_inf);
+ if (func != NULL)
+ strconcat(func)
+ else
+ strconcat(msg_unknown);
+ strconcat(msg_terminated);
+ /* Write out error message to STDERR, to syslog if open */
+ INLINE_SYSCALL(write, 3, STDERR_FILENO, message, plen);
+ if (connect_result != -1)
+ INLINE_SYSCALL(write, 3, log_socket, message, plen);
+
+ /* Direct reports to bugs.gentoo.org */
+ plen=0;
+ strconcat(msg_report);
+ message[plen++]='\0';
+
+ /* Write out error message to STDERR, to syslog if open */
+ INLINE_SYSCALL(write, 3, STDERR_FILENO, message, plen);
+ if (connect_result != -1)
+ INLINE_SYSCALL(write, 3, log_socket, message, plen);
+
+ if (log_socket != -1)
+ INLINE_SYSCALL(close, 1, log_socket);
+
+ /* Suicide */
+ pid = INLINE_SYSCALL(getpid, 0);
+
+ if (ENABLE_SSP_SMASH_DUMPS_CORE) {
+ static struct sigaction default_abort_act;
+ /* Remove any user-supplied handler for SIGABRT, before using it */
+ default_abort_act.sa_handler = SIG_DFL;
+ default_abort_act.sa_sigaction = NULL;
+ __sigfillset(&default_abort_act.sa_mask);
+ default_abort_act.sa_flags = 0;
+ if (DO_SIGACTION(SIGABRT, &default_abort_act, NULL) == 0)
+ INLINE_SYSCALL(kill, 2, pid, SIGABRT);
+ }
+
+ /* Note; actions cannot be added to SIGKILL */
+ INLINE_SYSCALL(kill, 2, pid, SIGKILL);
+
+ /* In case the kill didn't work, exit anyway
+ * The loop prevents gcc thinking this routine returns
+ */
+ while (1)
+ INLINE_SYSCALL(exit, 0);
+}
+
+__attribute__ ((__noreturn__))
+void __stack_chk_fail(void)
+{
+ __hardened_gentoo_stack_chk_fail(NULL, 0);
+}
+
+#ifdef ENABLE_OLD_SSP_COMPAT
+__attribute__ ((__noreturn__))
+void __stack_smash_handler(char func[], int damaged)
+{
+ __hardened_gentoo_stack_chk_fail(func, damaged);
+}
+#endif
diff --git a/sys-libs/glibc/files/eblits/common.eblit b/sys-libs/glibc/files/eblits/common.eblit
new file mode 100644
index 000000000000..51ba4a923997
--- /dev/null
+++ b/sys-libs/glibc/files/eblits/common.eblit
@@ -0,0 +1,360 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+alt_prefix() {
+ is_crosscompile && echo /usr/${CTARGET}
+}
+
+if [[ ${EAPI:-0} == [012] ]] ; then
+ : ${ED:=${D}}
+ : ${EROOT:=${ROOT}}
+fi
+# This indirection is for binpkgs. #523332
+_nonfatal() { nonfatal "$@" ; }
+if [[ ${EAPI:-0} == [0123] ]] ; then
+ nonfatal() { "$@" ; }
+ _nonfatal() { "$@" ; }
+fi
+
+# We need to be able to set alternative headers for
+# compiling for non-native platform
+# Will also become useful for testing kernel-headers without screwing up
+# the whole system.
+# note: intentionally undocumented.
+alt_headers() {
+ echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
+}
+alt_build_headers() {
+ if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
+ ALT_BUILD_HEADERS=$(alt_headers)
+ if tc-is-cross-compiler ; then
+ ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
+ if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
+ local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
+ ALT_BUILD_HEADERS=${header_path%/linux/version.h}
+ fi
+ fi
+ fi
+ echo "${ALT_BUILD_HEADERS}"
+}
+
+alt_libdir() {
+ echo $(alt_prefix)/$(get_libdir)
+}
+alt_usrlibdir() {
+ echo $(alt_prefix)/usr/$(get_libdir)
+}
+
+builddir() {
+ echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
+}
+
+setup_target_flags() {
+ # This largely mucks with compiler flags. None of which should matter
+ # when building up just the headers.
+ just_headers && return 0
+
+ case $(tc-arch) in
+ x86)
+ # -march needed for #185404 #199334
+ # TODO: When creating the first glibc cross-compile, this test will
+ # always fail as it does a full link which in turn requires glibc.
+ # Probably also applies when changing multilib profile settings (e.g.
+ # enabling x86 when the profile was amd64-only previously).
+ # We could change main to _start and pass -nostdlib here so that we
+ # only test the gcc code compilation. Or we could do a compile and
+ # then look for the symbol via scanelf.
+ if ! glibc_compile_test "" 'void f(int i, void *p) {if (__sync_fetch_and_add(&i, 1)) f(i, p);}\nint main(){return 0;}\n' 2>/dev/null ; then
+ local t=${CTARGET_OPT:-${CTARGET}}
+ t=${t%%-*}
+ filter-flags '-march=*'
+ export CFLAGS="-march=${t} ${CFLAGS}"
+ einfo "Auto adding -march=${t} to CFLAGS #185404"
+ fi
+ ;;
+ amd64)
+ # -march needed for #185404 #199334
+ # Note: This test only matters when the x86 ABI is enabled, so we could
+ # optimize a bit and elide it.
+ # TODO: See cross-compile issues listed above for x86.
+ if ! glibc_compile_test "${CFLAGS_x86}" 'void f(int i, void *p) {if (__sync_fetch_and_add(&i, 1)) f(i, p);}\nint main(){return 0;}\n' 2>/dev/null ; then
+ local t=${CTARGET_OPT:-${CTARGET}}
+ t=${t%%-*}
+ # Normally the target is x86_64-xxx, so turn that into the -march that
+ # gcc actually accepts. #528708
+ [[ ${t} == "x86_64" ]] && t="x86-64"
+ filter-flags '-march=*'
+ # ugly, ugly, ugly. ugly.
+ CFLAGS_x86=$(CFLAGS=${CFLAGS_x86} filter-flags '-march=*'; echo "${CFLAGS}")
+ export CFLAGS_x86="${CFLAGS_x86} -march=${t}"
+ einfo "Auto adding -march=${t} to CFLAGS_x86 #185404"
+ fi
+ ;;
+ mips)
+ # The mips abi cannot support the GNU style hashes. #233233
+ filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
+ ;;
+ ppc)
+ append-flags "-freorder-blocks"
+ ;;
+ sparc)
+ # Both sparc and sparc64 can use -fcall-used-g6. -g7 is bad, though.
+ filter-flags "-fcall-used-g7"
+ append-flags "-fcall-used-g6"
+ filter-flags "-mvis"
+
+ GLIBCMAJOR=$(get_version_component_range 1 ${PV})
+ GLIBCMINOR=$(get_version_component_range 2 ${PV})
+
+ # set CTARGET_OPT so glibc can use cpu-specific .S files for better performance
+ # - UltraSPARC T1 (niagara) support requires >= glibc 2.8
+ # - UltraSPARC T2 (niagara2) support requires >= glibc 2.7
+
+ if is_crosscompile || [[ ${PROFILE_ARCH} == "sparc64" ]] || { has_multilib_profile && ! tc-is-cross-compiler; } ; then
+ case ${ABI}:${CTARGET} in
+ sparc64:*|\
+ default:sparc64*)
+ filter-flags -Wa,-xarch -Wa,-A
+
+ if is-flagq "-mcpu=niagara2" && [[ ${GLIBCMAJOR}.${GLIBCMINOR} > 2.7 ]] ; then
+ CTARGET_OPT="sparc64v2-unknown-linux-gnu"
+ append-flags "-Wa,-xarch=v9b"
+ export ASFLAGS="${ASFLAGS} -Wa,-xarch=v9b"
+ elif { is-flagq "-mcpu=niagara" || is-flagq "-mcpu=niagara2" ; } && [[ ${GLIBCMAJOR}.${GLIBCMINOR} > 2.6 ]] ; then
+ CTARGET_OPT="sparc64v-unknown-linux-gnu"
+ append-flags "-Wa,-xarch=v9b"
+ export ASFLAGS="${ASFLAGS} -Wa,-xarch=v9b"
+ elif is-flagq "-mcpu=ultrasparc3" || is-flagq "-mcpu=niagara" || is-flagq "-mcpu=niagara2"; then
+ CTARGET_OPT="sparc64b-unknown-linux-gnu"
+ append-flags "-Wa,-xarch=v9b"
+ export ASFLAGS="${ASFLAGS} -Wa,-xarch=v9b"
+ else
+ CTARGET_OPT="sparc64-unknown-linux-gnu"
+ append-flags "-Wa,-xarch=v9a"
+ export ASFLAGS="${ASFLAGS} -Wa,-xarch=v9a"
+ fi
+ ;;
+ *)
+ if is-flagq "-mcpu=niagara2" && [[ ${GLIBCMAJOR}.${GLIBCMINOR} > 2.7 ]] ; then
+ CTARGET_OPT="sparcv9v2-unknown-linux-gnu"
+ elif { is-flagq "-mcpu=niagara" || is-flagq "-mcpu=niagara2" ; } && [[ ${GLIBCMAJOR}.${GLIBCMINOR} > 2.6 ]] ; then
+ CTARGET_OPT="sparcv9v-unknown-linux-gnu"
+ elif is-flagq "-mcpu=ultrasparc3" || is-flagq "-mcpu=niagara" || is-flagq "-mcpu=niagara2"; then
+ CTARGET_OPT="sparcv9b-unknown-linux-gnu"
+ else
+ CTARGET_OPT="sparcv9-unknown-linux-gnu"
+ fi
+ ;;
+ esac
+ else
+ if is-flagq "-mcpu=niagara2" && [[ ${GLIBCMAJOR}.${GLIBCMINOR} > 2.7 ]] ; then
+ CTARGET_OPT="sparcv9v2-unknown-linux-gnu"
+ elif { is-flagq "-mcpu=niagara" || is-flagq "-mcpu=niagara2" ; } && [[ ${GLIBCMAJOR}.${GLIBCMINOR} > 2.6 ]] ; then
+ CTARGET_OPT="sparcv9v-unknown-linux-gnu"
+ elif is-flagq "-mcpu=ultrasparc3" || is-flagq "-mcpu=niagara" || is-flagq "-mcpu=niagara2"; then
+ CTARGET_OPT="sparcv9b-unknown-linux-gnu"
+ elif { is_crosscompile && want_nptl; } || is-flagq "-mcpu=ultrasparc2" || is-flagq "-mcpu=ultrasparc"; then
+ CTARGET_OPT="sparcv9-unknown-linux-gnu"
+ fi
+ fi
+ ;;
+ esac
+}
+
+setup_flags() {
+ # Make sure host make.conf doesn't pollute us
+ if is_crosscompile || tc-is-cross-compiler ; then
+ CHOST=${CTARGET} strip-unsupported-flags
+ fi
+
+ # Store our CFLAGS because it's changed depending on which CTARGET
+ # we are building when pulling glibc on a multilib profile
+ CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
+ CFLAGS=${CFLAGS_BASE}
+ CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
+ CXXFLAGS=${CXXFLAGS_BASE}
+ ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
+ ASFLAGS=${ASFLAGS_BASE}
+
+ # Over-zealous CFLAGS can often cause problems. What may work for one
+ # person may not work for another. To avoid a large influx of bugs
+ # relating to failed builds, we strip most CFLAGS out to ensure as few
+ # problems as possible.
+ strip-flags
+ strip-unsupported-flags
+ filter-flags -m32 -m64 -mabi=*
+
+ # Bug 492892.
+ filter-flags -frecord-gcc-switches
+
+ unset CBUILD_OPT CTARGET_OPT
+ if use multilib ; then
+ CTARGET_OPT=$(get_abi_CTARGET)
+ [[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
+ fi
+
+ setup_target_flags
+
+ if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
+ CBUILD_OPT=${CTARGET_OPT}
+ fi
+
+ # Lock glibc at -O2 -- linuxthreads needs it and we want to be
+ # conservative here. -fno-strict-aliasing is to work around #155906
+ filter-flags -O?
+ append-flags -O2 -fno-strict-aliasing
+
+ # Can't build glibc itself with fortify code. Newer versions add
+ # this flag for us, so no need to do it manually.
+ version_is_at_least 2.16 ${PV} || append-cppflags -U_FORTIFY_SOURCE
+
+ # building glibc with SSP is fraught with difficulty, especially
+ # due to __stack_chk_fail_local which would mean significant changes
+ # to the glibc build process. See bug #94325 #293721
+ # Note we have to handle both user-given CFLAGS and gcc defaults via
+ # spec rules here. We can't simply add -fno-stack-protector as it gets
+ # added before user flags, and we can't just filter-flags because
+ # _filter_hardened doesn't support globs.
+ filter-flags -fstack-protector*
+ gcc-specs-ssp && append-flags $(test-flags -fno-stack-protector)
+
+ if use hardened && gcc-specs-pie ; then
+ # Force PIC macro definition for all compilations since they're all
+ # either -fPIC or -fPIE with the default-PIE compiler.
+ append-cppflags -DPIC
+ else
+ # Don't build -fPIE without the default-PIE compiler and the
+ # hardened-pie patch
+ filter-flags -fPIE
+ fi
+}
+
+want_nptl() {
+ [[ -z ${LT_VER} ]] && return 0
+ want_tls || return 1
+ use nptl || return 1
+
+ # Older versions of glibc had incomplete arch support for nptl.
+ # But if you're building those now, you can handle USE=nptl yourself.
+ return 0
+}
+
+want_linuxthreads() {
+ [[ -z ${LT_VER} ]] && return 1
+ use linuxthreads
+}
+
+want_tls() {
+ # Archs that can use TLS (Thread Local Storage)
+ case $(tc-arch) in
+ x86)
+ # requires i486 or better #106556
+ [[ ${CTARGET} == i[4567]86* ]] && return 0
+ return 1
+ ;;
+ esac
+
+ return 0
+}
+
+want__thread() {
+ want_tls || return 1
+
+ # For some reason --with-tls --with__thread is causing segfaults on sparc32.
+ [[ ${PROFILE_ARCH} == "sparc" ]] && return 1
+
+ [[ -n ${WANT__THREAD} ]] && return ${WANT__THREAD}
+
+ # only test gcc -- cant test linking yet
+ tc-has-tls -c ${CTARGET}
+ WANT__THREAD=$?
+
+ return ${WANT__THREAD}
+}
+
+use_multiarch() {
+ # Make sure binutils is new enough to support indirect functions #336792
+ # This funky sed supports gold and bfd linkers.
+ local bver nver
+ bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
+ case $(tc-arch ${CTARGET}) in
+ amd64|x86) nver="2.20" ;;
+ arm) nver="2.22" ;;
+ hppa) nver="2.23" ;;
+ ppc|ppc64) nver="2.20" ;;
+ # ifunc was added in 2.23, but glibc also needs machinemode which is in 2.24.
+ s390) nver="2.24" ;;
+ sparc) nver="2.21" ;;
+ *) return 1 ;;
+ esac
+ version_is_at_least ${nver} ${bver}
+}
+
+# Setup toolchain variables that had historically
+# been defined in the profiles for these archs.
+setup_env() {
+ # silly users
+ unset LD_RUN_PATH
+ unset LD_ASSUME_KERNEL
+
+ multilib_env ${CTARGET_OPT:-${CTARGET}}
+ if is_crosscompile || tc-is-cross-compiler ; then
+ if ! use multilib ; then
+ MULTILIB_ABIS=${DEFAULT_ABI}
+ else
+ MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
+ fi
+
+ # If the user has CFLAGS_<CTARGET> in their make.conf, use that,
+ # and fall back on CFLAGS.
+ local VAR=CFLAGS_${CTARGET//[-.]/_}
+ CFLAGS=${!VAR-${CFLAGS}}
+ fi
+
+ setup_flags
+
+ export ABI=${ABI:-${DEFAULT_ABI:-default}}
+
+ local VAR=CFLAGS_${ABI}
+ # We need to export CFLAGS with abi information in them because glibc's
+ # configure script checks CFLAGS for some targets (like mips). Keep
+ # around the original clean value to avoid appending multiple ABIs on
+ # top of each other.
+ : ${__GLIBC_CC:=$(tc-getCC ${CTARGET_OPT:-${CTARGET}})}
+ export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
+}
+
+foreach_abi() {
+ setup_env
+
+ local ret=0
+ local abilist=""
+ if use multilib ; then
+ abilist=$(get_install_abis)
+ else
+ abilist=${DEFAULT_ABI}
+ fi
+ evar_push ABI
+ export ABI
+ for ABI in ${abilist:-default} ; do
+ setup_env
+ einfo "Running $1 for ABI ${ABI}"
+ $1
+ : $(( ret |= $? ))
+ done
+ evar_pop
+ return ${ret}
+}
+
+just_headers() {
+ is_crosscompile && use crosscompile_opts_headers-only
+}
+
+glibc_banner() {
+ local b="Gentoo ${PVR}"
+ [[ -n ${SNAP_VER} ]] && b+=" snapshot ${SNAP_VER}"
+ [[ -n ${BRANCH_UPDATE} ]] && b+=" branch ${BRANCH_UPDATE}"
+ [[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
+ echo "${b}"
+}
diff --git a/sys-libs/glibc/files/eblits/pkg_postinst.eblit b/sys-libs/glibc/files/eblits/pkg_postinst.eblit
new file mode 100644
index 000000000000..074cf3a0b91b
--- /dev/null
+++ b/sys-libs/glibc/files/eblits/pkg_postinst.eblit
@@ -0,0 +1,27 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+eblit-glibc-pkg_postinst() {
+ # nothing to do if just installing headers
+ just_headers && return
+
+ if ! tc-is-cross-compiler && [[ -x ${ROOT}/usr/sbin/iconvconfig ]] ; then
+ # Generate fastloading iconv module configuration file.
+ "${ROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
+ fi
+
+ if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
+ # Reload init ... if in a chroot or a diff init package, ignore
+ # errors from this step #253697
+ /sbin/telinit U 2>/dev/null
+
+ # if the host locales.gen contains no entries, we'll install everything
+ local locale_list="${ROOT}etc/locale.gen"
+ if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
+ ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
+ locale_list="${ROOT}usr/share/i18n/SUPPORTED"
+ fi
+ locale-gen -j $(makeopts_jobs) --config "${locale_list}"
+ fi
+}
diff --git a/sys-libs/glibc/files/eblits/pkg_preinst.eblit b/sys-libs/glibc/files/eblits/pkg_preinst.eblit
new file mode 100644
index 000000000000..9160aaf8b78d
--- /dev/null
+++ b/sys-libs/glibc/files/eblits/pkg_preinst.eblit
@@ -0,0 +1,60 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# Simple test to make sure our new glibc isnt completely broken.
+# Make sure we don't test with statically built binaries since
+# they will fail. Also, skip if this glibc is a cross compiler.
+#
+# If coreutils is built with USE=multicall, some of these files
+# will just be wrapper scripts, not actual ELFs we can test.
+glibc_sanity_check() {
+ cd / #228809
+
+ # We enter ${D} so to avoid trouble if the path contains
+ # special characters; for instance if the path contains the
+ # colon character (:), then the linker will try to split it
+ # and look for the libraries in an unexpected place. This can
+ # lead to unsafe code execution if the generated prefix is
+ # within a world-writable directory.
+ # (e.g. /var/tmp/portage:${HOSTNAME})
+ pushd "${ED}"/$(get_libdir) >/dev/null
+
+ local x striptest
+ for x in cal date env free ls true uname uptime ; do
+ x=$(type -p ${x})
+ [[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
+ striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
+ case ${striptest} in
+ *"statically linked"*) continue;;
+ *"ASCII text"*) continue;;
+ esac
+ ./ld-*.so --library-path . ${x} > /dev/null \
+ || die "simple run test (${x}) failed"
+ done
+
+ popd >/dev/null
+}
+
+eblit-glibc-pkg_preinst() {
+ # nothing to do if just installing headers
+ just_headers && return
+
+ # prepare /etc/ld.so.conf.d/ for files
+ mkdir -p "${EROOT}"/etc/ld.so.conf.d
+
+ # Default /etc/hosts.conf:multi to on for systems with small dbs.
+ if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
+ sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
+ elog "Defaulting /etc/host.conf:multi to on"
+ fi
+
+ [[ ${ROOT} != "/" ]] && return 0
+ [[ -d ${D}/$(get_libdir) ]] || return 0
+ glibc_sanity_check
+
+ # For newer EAPIs, this was run in pkg_pretend.
+ if [[ ${EAPI:-0} == [0123] ]] ; then
+ check_devpts
+ fi
+}
diff --git a/sys-libs/glibc/files/eblits/pkg_pretend.eblit b/sys-libs/glibc/files/eblits/pkg_pretend.eblit
new file mode 100644
index 000000000000..c900ccc62f8b
--- /dev/null
+++ b/sys-libs/glibc/files/eblits/pkg_pretend.eblit
@@ -0,0 +1,157 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+glibc_compile_test() {
+ local ret save_cflags=${CFLAGS}
+ CFLAGS+=" $1"
+ shift
+
+ pushd "${T}" >/dev/null
+
+ rm -f glibc-test*
+ printf '%b' "$*" > glibc-test.c
+
+ _nonfatal emake -s glibc-test
+ ret=$?
+
+ popd >/dev/null
+
+ CFLAGS=${save_cflags}
+ return ${ret}
+}
+
+glibc_run_test() {
+ local ret
+
+ if [[ ${EMERGE_FROM} == "binary" ]] ; then
+ # ignore build failures when installing a binary package #324685
+ glibc_compile_test "" "$@" 2>/dev/null || return 0
+ else
+ if ! glibc_compile_test "" "$@" ; then
+ ewarn "Simple build failed ... assuming this is desired #324685"
+ return 0
+ fi
+ fi
+
+ pushd "${T}" >/dev/null
+
+ ./glibc-test
+ ret=$?
+ rm -f glibc-test*
+
+ popd >/dev/null
+
+ return ${ret}
+}
+
+check_devpts() {
+ # Make sure devpts is mounted correctly for use w/out setuid pt_chown.
+
+ # If merely building the binary package, then there's nothing to verify.
+ [[ ${MERGE_TYPE} == "buildonly" ]] && return
+
+ # Only sanity check when installing the native glibc.
+ [[ ${ROOT} != "/" ]] && return
+
+ # Older versions always installed setuid, so no need to check.
+ in_iuse suid || return
+
+ # If they're opting in to the old suid code, then no need to check.
+ use suid && return
+
+ if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
+ eerror "In order to use glibc with USE=-suid, you must make sure that"
+ eerror "you have devpts mounted at /dev/pts with the gid=5 option."
+ eerror "Openrc should do this for you, so you should check /etc/fstab"
+ eerror "and make sure you do not have any invalid settings there."
+ # Do not die on older kernels as devpts did not export these settings #489520.
+ if version_is_at_least 2.6.25 $(uname -r) ; then
+ die "mount & fix your /dev/pts settings"
+ fi
+ fi
+}
+
+eblit-glibc-pkg_pretend() {
+ # For older EAPIs, this is run in pkg_preinst.
+ if [[ ${EAPI:-0} != [0123] ]] ; then
+ check_devpts
+ fi
+
+ # prevent native builds from downgrading ... maybe update to allow people
+ # to change between diff -r versions ? (2.3.6-r4 -> 2.3.6-r2)
+ if [[ ${MERGE_TYPE} != "buildonly" ]] && \
+ [[ ${ROOT} == "/" ]] && \
+ [[ ${CBUILD} == ${CHOST} ]] && \
+ [[ ${CHOST} == ${CTARGET} ]] ; then
+ if has_version '>'${CATEGORY}/${PF} ; then
+ eerror "Sanity check to keep you from breaking your system:"
+ eerror " Downgrading glibc is not supported and a sure way to destruction"
+ die "aborting to save your system"
+ fi
+
+ if ! glibc_run_test '#include <pwd.h>\nint main(){return getpwuid(0)==0;}\n'
+ then
+ eerror "Your patched vendor kernel is broken. You need to get an"
+ eerror "update from whoever is providing the kernel to you."
+ eerror "http://sourceware.org/bugzilla/show_bug.cgi?id=5227"
+ eerror "http://bugs.gentoo.org/262698"
+ die "keeping your system alive, say thank you"
+ fi
+
+ if ! glibc_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n'
+ then
+ eerror "Your old kernel is broken. You need to update it to"
+ eerror "a newer version as syscall(<bignum>) will break."
+ eerror "http://bugs.gentoo.org/279260"
+ die "keeping your system alive, say thank you"
+ fi
+ fi
+
+ # users have had a chance to phase themselves, time to give em the boot
+ if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
+ eerror "You still haven't deleted ${EROOT}/etc/locales.build."
+ eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
+ die "lazy upgrader detected"
+ fi
+
+ if [[ ${CTARGET} == i386-* ]] ; then
+ eerror "i386 CHOSTs are no longer supported."
+ eerror "Chances are you don't actually want/need i386."
+ eerror "Please read http://www.gentoo.org/doc/en/change-chost.xml"
+ die "please fix your CHOST"
+ fi
+
+ if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
+ ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
+ ewarn "This will result in a 50% performance penalty when running with a 32bit"
+ ewarn "hypervisor, which is probably not what you want."
+ fi
+
+ use hardened && ! gcc-specs-pie && \
+ ewarn "PIE hardening not applied, as your compiler doesn't default to PIE"
+
+ # Make sure host system is up to date #394453
+ if has_version '<sys-libs/glibc-2.13' && \
+ [[ -n $(scanelf -qys__guard -F'#s%F' "${EROOT}"/lib*/l*-*.so) ]]
+ then
+ ebegin "Scanning system for __guard to see if you need to rebuild first ..."
+ local files=$(
+ scanelf -qys__guard -F'#s%F' \
+ "${EROOT}"/*bin/ \
+ "${EROOT}"/lib* \
+ "${EROOT}"/usr/*bin/ \
+ "${EROOT}"/usr/lib* | \
+ egrep -v \
+ -e "^${EROOT}/lib.*/(libc|ld)-2.*.so$" \
+ -e "^${EROOT}/sbin/(ldconfig|sln)$"
+ )
+ [[ -z ${files} ]]
+ if ! eend $? ; then
+ eerror "Your system still has old SSP __guard symbols. You need to"
+ eerror "rebuild all the packages that provide these files first:"
+ eerror "${files}"
+ die "old __guard detected"
+ fi
+ fi
+}
diff --git a/sys-libs/glibc/files/eblits/pkg_setup.eblit b/sys-libs/glibc/files/eblits/pkg_setup.eblit
new file mode 100644
index 000000000000..2aff25870cc3
--- /dev/null
+++ b/sys-libs/glibc/files/eblits/pkg_setup.eblit
@@ -0,0 +1,9 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+[[ ${EAPI:-0} == [0123] ]] && source "${FILESDIR}/eblits/pkg_pretend.eblit"
+
+eblit-glibc-pkg_setup() {
+ [[ ${EAPI:-0} == [0123] ]] && eblit-glibc-pkg_pretend
+}
diff --git a/sys-libs/glibc/files/eblits/src_compile.eblit b/sys-libs/glibc/files/eblits/src_compile.eblit
new file mode 100644
index 000000000000..7a38b3e6e479
--- /dev/null
+++ b/sys-libs/glibc/files/eblits/src_compile.eblit
@@ -0,0 +1,24 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+[[ ${EAPI:-0} == [01] ]] && source "${FILESDIR}/eblits/src_configure.eblit"
+
+toolchain-glibc_src_compile() {
+ local t
+ for t in linuxthreads nptl ; do
+ if want_${t} ; then
+ [[ ${EAPI:-0} == [01] ]] && glibc_do_configure ${t}
+ emake -C "$(builddir ${t})" || die "make ${t} for ${ABI} failed"
+ fi
+ done
+}
+
+eblit-glibc-src_compile() {
+ if just_headers ; then
+ [[ ${EAPI:-0} == [01] ]] && toolchain-glibc_headers_configure
+ return
+ fi
+
+ foreach_abi toolchain-glibc_src_compile
+}
diff --git a/sys-libs/glibc/files/eblits/src_configure.eblit b/sys-libs/glibc/files/eblits/src_configure.eblit
new file mode 100644
index 000000000000..954508ca51aa
--- /dev/null
+++ b/sys-libs/glibc/files/eblits/src_configure.eblit
@@ -0,0 +1,259 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+dump_toolchain_settings() {
+ echo
+
+ einfo "$*"
+
+ local v
+ for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC LD {AS,C,CPP,CXX,LD}FLAGS ; do
+ einfo " $(printf '%15s' ${v}:) ${!v}"
+ done
+
+ # The glibc configure script doesn't properly use LDFLAGS all the time.
+ export CC="$(tc-getCC ${CTARGET}) ${LDFLAGS}"
+ einfo " $(printf '%15s' 'Manual CC:') ${CC}"
+ echo
+}
+
+glibc_do_configure() {
+ # Glibc does not work with gold (for various reasons) #269274.
+ tc-ld-disable-gold
+
+ dump_toolchain_settings "Configuring glibc for $1"
+
+ local myconf=()
+
+ # set addons
+ pushd "${S}" > /dev/null
+ local addons=$(echo */configure | sed \
+ -e 's:/configure::g' \
+ -e 's:\(linuxthreads\|nptl\|rtkaio\|glibc-compat\)\( \|$\)::g' \
+ -e 's: \+$::' \
+ -e 's! !,!g' \
+ -e 's!^!,!' \
+ -e '/^,\*$/d')
+ [[ -d ports ]] && addons+=",ports"
+ popd > /dev/null
+
+ myconf+=( $(use_enable hardened stackguard-randomization) )
+ if has_version '<sys-libs/glibc-2.13' ; then
+ myconf+=( --enable-old-ssp-compat )
+ fi
+
+ [[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
+
+ if [[ $1 == "linuxthreads" ]] ; then
+ if want_tls ; then
+ myconf+=( --with-tls )
+
+ if ! want__thread || use glibc-compat20 || [[ ${LT_KER_VER} == 2.[02].* ]] ; then
+ myconf+=( --without-__thread )
+ else
+ myconf+=( --with-__thread )
+ fi
+ else
+ myconf+=( --without-tls --without-__thread )
+ fi
+
+ myconf+=( --disable-sanity-checks )
+ addons="linuxthreads${addons}"
+ myconf+=( --enable-kernel=${LT_KER_VER} )
+ elif [[ $1 == "nptl" ]] ; then
+ # Newer versions require nptl, so there is no addon for it.
+ version_is_at_least 2.20 || addons="nptl${addons}"
+ myconf+=( --enable-kernel=${NPTL_KERN_VER} )
+ else
+ die "invalid pthread option"
+ fi
+ myconf+=( --enable-add-ons="${addons#,}" )
+
+ # Since SELinux support is only required for nscd, only enable it if:
+ # 1. USE selinux
+ # 2. only for the primary ABI on multilib systems
+ # 3. Not a crosscompile
+ if ! is_crosscompile && use selinux ; then
+ if use multilib ; then
+ if is_final_abi ; then
+ myconf+=( --with-selinux )
+ else
+ myconf+=( --without-selinux )
+ fi
+ else
+ myconf+=( --with-selinux )
+ fi
+ else
+ myconf+=( --without-selinux )
+ fi
+
+ # Force a few tests where we always know the answer but
+ # configure is incapable of finding it.
+ if is_crosscompile ; then
+ export \
+ libc_cv_c_cleanup=yes \
+ libc_cv_forced_unwind=yes
+ fi
+
+ myconf+=(
+ --without-cvs
+ --disable-werror
+ --enable-bind-now
+ --build=${CBUILD_OPT:-${CBUILD}}
+ --host=${CTARGET_OPT:-${CTARGET}}
+ $(use_enable profile)
+ $(use_with gd)
+ --with-headers=$(alt_build_headers)
+ --prefix=/usr
+ --libdir=/usr/$(get_libdir)
+ --mandir=/usr/share/man
+ --infodir=/usr/share/info
+ --libexecdir=/usr/$(get_libdir)/misc/glibc
+ --with-bugurl=http://bugs.gentoo.org/
+ --with-pkgversion="$(glibc_banner)"
+ $(use_multiarch || echo --disable-multi-arch)
+ --enable-obsolete-rpc
+ $(in_iuse systemtap && use_enable systemtap)
+ $(in_iuse nscd && use_enable nscd)
+ ${EXTRA_ECONF}
+ )
+
+ # There is no configure option for this and we need to export it
+ # since the glibc build will re-run configure on itself
+ export libc_cv_slibdir=/$(get_libdir)
+
+ # We take care of patching our binutils to use both hash styles,
+ # and many people like to force gnu hash style only, so disable
+ # this overriding check. #347761
+ export libc_cv_hashstyle=no
+
+ # Overtime, generating info pages can be painful. So disable this for
+ # versions older than the latest stable to avoid the issue (this ver
+ # should be updated from time to time). #464394 #465816
+ if ! version_is_at_least 2.17 ; then
+ export ac_cv_prog_MAKEINFO=:
+ fi
+
+ local builddir=$(builddir "$1")
+ mkdir -p "${builddir}"
+ cd "${builddir}"
+ set -- "${S}"/configure "${myconf[@]}"
+ echo "$@"
+ "$@" || die "failed to configure glibc"
+
+ # ia64 static cross-compilers are a pita in so much that they
+ # can't produce static ELFs (as the libgcc.a is broken). so
+ # disable building of the programs for those targets if it
+ # doesn't work.
+ # XXX: We could turn this into a compiler test, but ia64 is
+ # the only one that matters, so this should be fine for now.
+ if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
+ sed -i '1i+link-static = touch $@' config.make
+ fi
+
+ # If we're trying to migrate between ABI sets, we need
+ # to lie and use a local copy of gcc. Like if the system
+ # is built with MULTILIB_ABIS="amd64 x86" but we want to
+ # add x32 to it, gcc/glibc don't yet support x32.
+ if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
+ echo 'main(){}' > "${T}"/test.c
+ if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
+ sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
+ mkdir -p sunrpc
+ cp $(which rpcgen) sunrpc/cross-rpcgen || die
+ touch -t 202001010101 sunrpc/cross-rpcgen || die
+ fi
+ fi
+}
+
+toolchain-glibc_headers_configure() {
+ export ABI=default
+
+ local builddir=$(builddir "headers")
+ mkdir -p "${builddir}"
+ cd "${builddir}"
+
+ # if we don't have a compiler yet, we cant really test it now ...
+ # hopefully they don't affect header geneation, so let's hope for
+ # the best here ...
+ local v vars=(
+ ac_cv_header_cpuid_h=yes
+ libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
+ libc_cv_asm_cfi_directives=yes
+ libc_cv_broken_visibility_attribute=no
+ libc_cv_c_cleanup=yes
+ libc_cv_forced_unwind=yes
+ libc_cv_gcc___thread=yes
+ libc_cv_mlong_double_128=yes
+ libc_cv_mlong_double_128ibm=yes
+ libc_cv_ppc_machine=yes
+ libc_cv_ppc_rel16=yes
+ libc_cv_predef_{fortify_source,stack_protector}=no
+ libc_cv_visibility_attribute=yes
+ libc_cv_z_combreloc=yes
+ libc_cv_z_execstack=yes
+ libc_cv_z_initfirst=yes
+ libc_cv_z_nodelete=yes
+ libc_cv_z_nodlopen=yes
+ libc_cv_z_relro=yes
+ libc_mips_abi=${ABI}
+ libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
+ )
+ einfo "Forcing cached settings:"
+ for v in "${vars[@]}" ; do
+ einfo " ${v}"
+ export ${v}
+ done
+
+ # Blow away some random CC settings that screw things up. #550192
+ if [[ -d ${S}/sysdeps/mips ]]; then
+ pushd "${S}"/sysdeps/mips >/dev/null
+ sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
+ sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
+ popd >/dev/null
+ fi
+
+ local myconf=()
+ myconf+=(
+ --disable-sanity-checks
+ --enable-hacker-mode
+ --without-cvs
+ --disable-werror
+ --enable-bind-now
+ --build=${CBUILD_OPT:-${CBUILD}}
+ --host=${CTARGET_OPT:-${CTARGET}}
+ --with-headers=$(alt_build_headers)
+ --prefix=/usr
+ ${EXTRA_ECONF}
+ )
+
+ local addons
+ [[ -d ${S}/ports ]] && addons+=",ports"
+ # Newer versions require nptl, so there is no addon for it.
+ version_is_at_least 2.20 || addons+=",nptl"
+ myconf+=( --enable-add-ons="${addons#,}" )
+
+ # Nothing is compiled here which would affect the headers for the target.
+ # So forcing CC/CFLAGS is sane.
+ set -- "${S}"/configure "${myconf[@]}"
+ echo "$@"
+ CC="$(tc-getBUILD_CC)" \
+ CFLAGS="-O1 -pipe" \
+ CPPFLAGS="-U_FORTIFY_SOURCE" \
+ LDFLAGS="" \
+ "$@" || die "failed to configure glibc"
+}
+
+toolchain-glibc_src_configure() {
+ if just_headers ; then
+ toolchain-glibc_headers_configure
+ else
+ want_linuxthreads && glibc_do_configure linuxthreads
+ want_nptl && glibc_do_configure nptl
+ fi
+}
+
+eblit-glibc-src_configure() {
+ foreach_abi toolchain-glibc_src_configure
+}
diff --git a/sys-libs/glibc/files/eblits/src_install.eblit b/sys-libs/glibc/files/eblits/src_install.eblit
new file mode 100644
index 000000000000..4a8056071a40
--- /dev/null
+++ b/sys-libs/glibc/files/eblits/src_install.eblit
@@ -0,0 +1,244 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+toolchain-glibc_src_install() {
+ local builddir=$(builddir $(want_linuxthreads && echo linuxthreads || echo nptl))
+ cd "${builddir}"
+
+ emake install_root="${D}$(alt_prefix)" install || die
+
+ if want_linuxthreads && want_nptl ; then
+ einfo "Installing NPTL to $(alt_libdir)/tls/..."
+ cd "$(builddir nptl)"
+ dodir $(alt_libdir)/tls $(alt_usrlibdir)/nptl
+
+ local l src_lib
+ for l in libc libm librt libpthread libthread_db ; do
+ # take care of shared lib first ...
+ l=${l}.so
+ if [[ -e ${l} ]] ; then
+ src_lib=${l}
+ else
+ src_lib=$(eval echo */${l})
+ fi
+ cp -a ${src_lib} "${ED}"$(alt_libdir)/tls/${l} || die "copying nptl ${l}"
+ fperms a+rx $(alt_libdir)/tls/${l}
+ dosym ${l} $(alt_libdir)/tls/$(scanelf -qSF'%S#F' ${src_lib})
+
+ # then grab the linker script or the symlink ...
+ if [[ -L ${ED}$(alt_usrlibdir)/${l} ]] ; then
+ dosym $(alt_libdir)/tls/${l} $(alt_usrlibdir)/nptl/${l}
+ else
+ sed \
+ -e "s:/${l}:/tls/${l}:g" \
+ -e "s:/${l/%.so/_nonshared.a}:/nptl/${l/%.so/_nonshared.a}:g" \
+ "${ED}"$(alt_usrlibdir)/${l} > "${ED}"$(alt_usrlibdir)/nptl/${l}
+ fi
+
+ # then grab the static lib ...
+ src_lib=${src_lib/%.so/.a}
+ [[ ! -e ${src_lib} ]] && src_lib=${src_lib/%.a/_pic.a}
+ cp -a ${src_lib} "${ED}"$(alt_usrlibdir)/nptl/ || die "copying nptl ${src_lib}"
+ src_lib=${src_lib/%.a/_nonshared.a}
+ if [[ -e ${src_lib} ]] ; then
+ cp -a ${src_lib} "${ED}"$(alt_usrlibdir)/nptl/ || die "copying nptl ${src_lib}"
+ fi
+ done
+
+ # use the nptl linker instead of the linuxthreads one as the linuxthreads
+ # one may lack TLS support and that can be really bad for business
+ cp -a elf/ld.so "${ED}"$(alt_libdir)/$(scanelf -qSF'%S#F' elf/ld.so) || die "copying nptl interp"
+ fi
+
+ # We'll take care of the cache ourselves
+ rm -f "${ED}"/etc/ld.so.cache
+
+ # Everything past this point just needs to be done once ...
+ is_final_abi || return 0
+
+ # Make sure the non-native interp can be found on multilib systems even
+ # if the main library set isn't installed into the right place. Maybe
+ # we should query the active gcc for info instead of hardcoding it ?
+ local i ldso_abi ldso_name
+ local ldso_abi_list=(
+ # x86
+ amd64 /lib64/ld-linux-x86-64.so.2
+ x32 /libx32/ld-linux-x32.so.2
+ x86 /lib/ld-linux.so.2
+ # mips
+ o32 /lib/ld.so.1
+ n32 /lib32/ld.so.1
+ n64 /lib64/ld.so.1
+ # powerpc
+ ppc /lib/ld.so.1
+ ppc64 /lib64/ld64.so.1
+ # s390
+ s390 /lib/ld.so.1
+ s390x /lib/ld64.so.1
+ # sparc
+ sparc32 /lib/ld-linux.so.2
+ sparc64 /lib64/ld-linux.so.2
+ )
+ case $(tc-endian) in
+ little)
+ ldso_abi_list+=(
+ # arm
+ arm64 /lib/ld-linux-aarch64.so.1
+ )
+ ;;
+ big)
+ ldso_abi_list+=(
+ # arm
+ arm64 /lib/ld-linux-aarch64_be.so.1
+ )
+ ;;
+ esac
+ if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
+ dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
+ fi
+ for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
+ ldso_abi=${ldso_abi_list[i]}
+ has ${ldso_abi} $(get_install_abis) || continue
+
+ ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
+ if [[ ! -L ${D}/${ldso_name} && ! -e ${D}/${ldso_name} ]] ; then
+ dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
+ fi
+ done
+
+ # With devpts under Linux mounted properly, we do not need the pt_chown
+ # binary to be setuid. This is because the default owners/perms will be
+ # exactly what we want.
+ if in_iuse suid && ! use suid ; then
+ find "${D}" -name pt_chown -exec chmod -s {} +
+ fi
+
+ #################################################################
+ # EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
+ # Make sure we install some symlink hacks so that when we build
+ # a 2nd stage cross-compiler, gcc finds the target system
+ # headers correctly. See gcc/doc/gccinstall.info
+ if is_crosscompile ; then
+ # We need to make sure that /lib and /usr/lib always exists.
+ # gcc likes to use relative paths to get to its multilibs like
+ # /usr/lib/../lib64/. So while we don't install any files into
+ # /usr/lib/, we do need it to exist.
+ cd "${ED}"$(alt_libdir)/..
+ [[ -e lib ]] || mkdir lib
+ cd "${ED}"$(alt_usrlibdir)/..
+ [[ -e lib ]] || mkdir lib
+
+ dosym usr/include $(alt_prefix)/sys-include
+ return 0
+ fi
+
+ # Files for Debian-style locale updating
+ dodir /usr/share/i18n
+ sed \
+ -e "/^#/d" \
+ -e "/SUPPORTED-LOCALES=/d" \
+ -e "s: \\\\::g" -e "s:/: :g" \
+ "${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
+ || die "generating /usr/share/i18n/SUPPORTED failed"
+ cd "${WORKDIR}"/extra/locale
+ dosbin locale-gen || die
+ doman *.[0-8]
+ insinto /etc
+ doins locale.gen || die
+
+ # Make sure all the ABI's can find the locales and so we only
+ # have to generate one set
+ local a
+ keepdir /usr/$(get_libdir)/locale
+ for a in $(get_install_abis) ; do
+ if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
+ dosym /usr/$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
+ fi
+ done
+
+ cd "${S}"
+
+ # Install misc network config files
+ insinto /etc
+ doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf || die
+ doins "${WORKDIR}"/extra/etc/*.conf || die
+
+ if ! in_iuse nscd || use nscd ; then
+ doinitd "${WORKDIR}"/extra/etc/nscd || die
+
+ local nscd_args=(
+ -e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
+ )
+ version_is_at_least 2.16 || nscd_args+=( -e 's: --foreground : :' )
+ sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
+
+ # Newer versions of glibc include the nscd.service themselves.
+ # TODO: Drop the $FILESDIR copy once 2.19 goes stable.
+ if version_is_at_least 2.19 ; then
+ systemd_dounit nscd/nscd.service || die
+ systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf || die
+ else
+ systemd_dounit "${FILESDIR}"/nscd.service || die
+ systemd_newtmpfilesd "${FILESDIR}"/nscd.tmpfilesd nscd.conf || die
+ fi
+ else
+ # Do this since extra/etc/*.conf above might have nscd.conf.
+ rm -f "${ED}"/etc/nscd.conf
+ fi
+
+ echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
+ doenvd "${T}"/00glibc || die
+
+ for d in BUGS ChangeLog* CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
+ [[ -s ${d} ]] && dodoc ${d}
+ done
+
+ # Prevent overwriting of the /etc/localtime symlink. We'll handle the
+ # creation of the "factory" symlink in pkg_postinst().
+ rm -f "${ED}"/etc/localtime
+}
+
+toolchain-glibc_headers_install() {
+ local builddir=$(builddir "headers")
+ cd "${builddir}"
+ emake install_root="${D}$(alt_prefix)" install-headers || die
+ if ! version_is_at_least 2.16 ; then
+ insinto $(alt_headers)/bits
+ doins bits/stdio_lim.h || die
+ fi
+ insinto $(alt_headers)/gnu
+ doins "${S}"/include/gnu/stubs.h || die "doins include gnu"
+ # Make sure we install the sys-include symlink so that when
+ # we build a 2nd stage cross-compiler, gcc finds the target
+ # system headers correctly. See gcc/doc/gccinstall.info
+ dosym usr/include /usr/${CTARGET}/sys-include
+}
+
+src_strip() {
+ # gdb is lame and requires some debugging information to remain in
+ # libpthread, so we need to strip it by hand. libthread_db makes no
+ # sense stripped as it is only used when debugging.
+ local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
+ env \
+ -uRESTRICT \
+ CHOST=${CTARGET} \
+ STRIP_MASK="/*/{,tls/}${pthread}*" \
+ prepallstrip
+ # if user has stripping enabled and does not have split debug turned on,
+ # then leave the debugging sections in libpthread.
+ if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
+ ${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"/*/libpthread-*.so
+ fi
+}
+
+eblit-glibc-src_install() {
+ if just_headers ; then
+ export ABI=default
+ toolchain-glibc_headers_install
+ return
+ fi
+
+ foreach_abi toolchain-glibc_src_install
+ src_strip
+}
diff --git a/sys-libs/glibc/files/eblits/src_prepare.eblit b/sys-libs/glibc/files/eblits/src_prepare.eblit
new file mode 100644
index 000000000000..162cf530c8db
--- /dev/null
+++ b/sys-libs/glibc/files/eblits/src_prepare.eblit
@@ -0,0 +1,63 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+eblit-glibc-src_prepare() {
+ # XXX: We should do the branchupdate, before extracting the manpages and
+ # infopages else it does not help much (mtimes change if there is a change
+ # to them with branchupdate)
+ if [[ -n ${BRANCH_UPDATE} ]] ; then
+ epatch "${DISTDIR}"/glibc-${RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2
+
+ # Snapshot date patch
+ einfo "Patching version to display snapshot date ..."
+ sed -i -e "s:\(#define RELEASE\).*:\1 \"${BRANCH_UPDATE}\":" version.h
+ fi
+
+ # tag, glibc is it
+ if ! version_is_at_least 2.17 ; then
+ [[ -e csu/Banner ]] && die "need new banner location"
+ glibc_banner > csu/Banner
+ fi
+ if [[ -n ${PATCH_VER} ]] && ! use vanilla ; then
+ EPATCH_MULTI_MSG="Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER} ..." \
+ EPATCH_EXCLUDE=${GLIBC_PATCH_EXCLUDE} \
+ EPATCH_SUFFIX="patch" \
+ ARCH=$(tc-arch) \
+ epatch "${WORKDIR}"/patches
+ fi
+
+ if just_headers ; then
+ if [[ -e ports/sysdeps/mips/preconfigure ]] ; then
+ # mips peeps like to screw with us. if building headers,
+ # we don't have a real compiler, so we can't let them
+ # insert -mabi on us.
+ sed -i '/CPPFLAGS=.*-mabi/s|.*|:|' ports/sysdeps/mips/preconfigure || die
+ find ports/sysdeps/mips/ -name Makefile -exec sed -i '/^CC.*-mabi=/s:-mabi=.*:-D_MIPS_SZPTR=32:' {} +
+ fi
+ fi
+
+ epatch_user
+
+ gnuconfig_update
+
+ # Glibc is stupid sometimes, and doesn't realize that with a
+ # static C-Only gcc, -lgcc_eh doesn't exist.
+ # http://sourceware.org/ml/libc-alpha/2003-09/msg00100.html
+ # http://sourceware.org/ml/libc-alpha/2005-02/msg00042.html
+ # But! Finally fixed in recent versions:
+ # http://sourceware.org/ml/libc-alpha/2012-05/msg01865.html
+ if ! version_is_at_least 2.16 ; then
+ echo 'int main(){}' > "${T}"/gcc_eh_test.c
+ if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/gcc_eh_test.c -lgcc_eh 2>/dev/null ; then
+ sed -i -e 's:-lgcc_eh::' Makeconfig || die "sed gcc_eh"
+ fi
+ fi
+
+ cd "${WORKDIR}"
+ find . -type f '(' -size 0 -o -name "*.orig" ')' -delete
+ find . -name configure -exec touch {} +
+
+ # Fix permissions on some of the scripts.
+ chmod u+x "${S}"/scripts/*.sh
+}
diff --git a/sys-libs/glibc/files/eblits/src_test.eblit b/sys-libs/glibc/files/eblits/src_test.eblit
new file mode 100644
index 000000000000..fc5b950f4681
--- /dev/null
+++ b/sys-libs/glibc/files/eblits/src_test.eblit
@@ -0,0 +1,30 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+glibc_src_test() {
+ cd "$(builddir $1)"
+ nonfatal emake -j1 check && return 0
+ einfo "make check failed - re-running with --keep-going to get the rest of the results"
+ nonfatal emake -j1 -k check
+ ewarn "make check failed for ${ABI}-${CTARGET}-$1"
+ return 1
+}
+
+toolchain-glibc_src_test() {
+ local ret=0 t
+ for t in linuxthreads nptl ; do
+ if want_${t} ; then
+ glibc_src_test ${t}
+ : $(( ret |= $? ))
+ fi
+ done
+ return ${ret}
+}
+
+eblit-glibc-src_test() {
+ # Give tests more time to complete.
+ export TIMEOUTFACTOR=5
+
+ foreach_abi toolchain-glibc_src_test || die "tests failed"
+}
diff --git a/sys-libs/glibc/files/eblits/src_unpack.eblit b/sys-libs/glibc/files/eblits/src_unpack.eblit
new file mode 100644
index 000000000000..8d4c74071713
--- /dev/null
+++ b/sys-libs/glibc/files/eblits/src_unpack.eblit
@@ -0,0 +1,121 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+[[ ${EAPI:-0} == [01] ]] && source "${FILESDIR}/eblits/src_prepare.eblit"
+
+int_to_KV() {
+ local version=$1 major minor micro
+ major=$((version / 65536))
+ minor=$(((version % 65536) / 256))
+ micro=$((version % 256))
+ echo ${major}.${minor}.${micro}
+}
+
+eend_KV() {
+ [[ $(KV_to_int $1) -ge $(KV_to_int $2) ]]
+ eend $?
+}
+
+get_kheader_version() {
+ printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
+ $(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \
+ tail -n 1
+}
+
+check_nptl_support() {
+ # don't care about the compiler here as we arent using it
+ just_headers && return
+
+ local run_kv build_kv want_kv
+ run_kv=$(int_to_KV $(get_KV))
+ build_kv=$(int_to_KV $(get_kheader_version))
+ want_kv=${NPTL_KERN_VER}
+
+ ebegin "Checking gcc for __thread support"
+ if ! eend $(want__thread ; echo $?) ; then
+ echo
+ eerror "Could not find a gcc that supports the __thread directive!"
+ eerror "Please update your binutils/gcc and try again."
+ die "No __thread support in gcc!"
+ fi
+
+ if ! is_crosscompile && ! tc-is-cross-compiler ; then
+ # Building fails on an non-supporting kernel
+ ebegin "Checking kernel version (${run_kv} >= ${want_kv})"
+ if ! eend_KV ${run_kv} ${want_kv} ; then
+ echo
+ eerror "You need a kernel of at least ${want_kv} for NPTL support!"
+ die "Kernel version too low!"
+ fi
+ fi
+
+ ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
+ if ! eend_KV ${build_kv} ${want_kv} ; then
+ echo
+ eerror "You need linux-headers of at least ${want_kv} for NPTL support!"
+ die "linux-headers version too low!"
+ fi
+}
+
+unpack_pkg() {
+ local a=${PN}
+ [[ -n ${SNAP_VER} ]] && a="${a}-${RELEASE_VER}"
+ [[ -n $1 ]] && a="${a}-$1"
+ if [[ -n ${SNAP_VER} ]] ; then
+ a="${a}-${SNAP_VER}"
+ else
+ if [[ -n $2 ]] ; then
+ a="${a}-$2"
+ else
+ a="${a}-${RELEASE_VER}"
+ fi
+ fi
+ if has ${a}.tar.xz ${A} ; then
+ unpacker ${a}.tar.xz
+ else
+ unpack ${a}.tar.bz2
+ fi
+ [[ -n $1 ]] && { mv ${a} $1 || die ; }
+}
+
+toolchain-glibc_src_unpack() {
+ # Check NPTL support _before_ we unpack things to save some time
+ want_nptl && check_nptl_support
+
+ if [[ -n ${EGIT_REPO_URIS} ]] ; then
+ local i d
+ for ((i=0; i<${#EGIT_REPO_URIS[@]}; ++i)) ; do
+ EGIT_REPO_URI=${EGIT_REPO_URIS[$i]}
+ EGIT_SOURCEDIR=${EGIT_SOURCEDIRS[$i]}
+ git-2_src_unpack
+ done
+ else
+ unpack_pkg
+ fi
+
+ cd "${S}"
+ touch locale/C-translit.h #185476 #218003
+ [[ -n ${LT_VER} ]] && unpack_pkg linuxthreads ${LT_VER}
+ [[ -n ${PORTS_VER} ]] && unpack_pkg ports ${PORTS_VER}
+ [[ -n ${LIBIDN_VER} ]] && unpack_pkg libidn
+
+ if [[ -n ${PATCH_VER} ]] ; then
+ cd "${WORKDIR}"
+ unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
+ # pull out all the addons
+ local d
+ for d in extra/*/configure ; do
+ d=${d%/configure}
+ [[ -d ${S}/${d} ]] && die "${d} already exists in \${S}"
+ mv "${d}" "${S}" || die "moving ${d} failed"
+ done
+ fi
+}
+
+eblit-glibc-src_unpack() {
+ setup_env
+
+ toolchain-glibc_src_unpack
+ [[ ${EAPI:-0} == [01] ]] && cd "${S}" && eblit-glibc-src_prepare
+}
diff --git a/sys-libs/glibc/files/nscd b/sys-libs/glibc/files/nscd
new file mode 100755
index 000000000000..e47f9b98bdfd
--- /dev/null
+++ b/sys-libs/glibc/files/nscd
@@ -0,0 +1,64 @@
+#!/sbin/runscript
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+depend() {
+ use dns ldap net slapd
+}
+
+checkconfig() {
+ if [ ! -d /var/run/nscd ] ; then
+ mkdir -p /var/run/nscd
+ chmod 755 /var/run/nscd
+ fi
+ if [ -z "${NSCD_PERMS_OK}" ] && [ "$(stat -c %a /var/run/nscd)" != "755" ] ; then
+ echo ""
+ ewarn "nscd run dir is not world readable, you should reset the perms:"
+ ewarn "chmod 755 /var/run/nscd"
+ ewarn "chmod a+rw /var/run/nscd/socket"
+ echo ""
+ ewarn "To disable this warning, set 'NSCD_PERMS_OK' in /etc/conf.d/nscd"
+ echo ""
+ fi
+}
+
+start() {
+ checkconfig
+
+ ebegin "Starting Name Service Cache Daemon"
+ local secure=`while read curline ; do
+ table=${curline%:*}
+ entries=${curline##$table:}
+ table=${table%%[^a-z]*}
+ case $table in
+ passwd*|group*|hosts)
+ for entry in $entries ; do
+ case $entry in
+ nisplus*)
+ /usr/sbin/nscd_nischeck $table || \
+ /echo "-S $table,yes"
+ ;;
+ esac
+ done
+ ;;
+ esac
+ done < /etc/nsswitch.conf`
+ local pidfile="$(strings /usr/sbin/nscd | grep nscd.pid)"
+ mkdir -p "$(dirname ${pidfile})"
+ save_options pidfile "${pidfile}"
+ start-stop-daemon --start --quiet \
+ --exec /usr/sbin/nscd --pidfile "${pidfile}" \
+ -- $secure
+ eend $?
+}
+
+stop() {
+ local pidfile="$(get_options pidfile)"
+ [ -n "${pidfile}" ] && pidfile="--pidfile ${pidfile}"
+ ebegin "Shutting down Name Service Cache Daemon"
+ start-stop-daemon --stop --quiet --exec /usr/sbin/nscd ${pidfile}
+ eend $?
+}
+
+# vim:ts=4
diff --git a/sys-libs/glibc/files/nscd.service b/sys-libs/glibc/files/nscd.service
new file mode 100644
index 000000000000..25a3b1d9be0a
--- /dev/null
+++ b/sys-libs/glibc/files/nscd.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Name Service Cache Daemon
+After=network.target
+
+[Service]
+ExecStart=/usr/sbin/nscd -F
+ExecStop=/usr/sbin/nscd --shutdown
+ExecReload=/usr/sbin/nscd -i passwd
+ExecReload=/usr/sbin/nscd -i group
+ExecReload=/usr/sbin/nscd -i hosts
+ExecReload=/usr/sbin/nscd -i services
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
diff --git a/sys-libs/glibc/files/nscd.tmpfilesd b/sys-libs/glibc/files/nscd.tmpfilesd
new file mode 100644
index 000000000000..52edbba673cf
--- /dev/null
+++ b/sys-libs/glibc/files/nscd.tmpfilesd
@@ -0,0 +1,4 @@
+# Configuration to create /run/nscd directory
+# Used as part of systemd's tmpfiles
+
+d /run/nscd 0755 root root
diff --git a/sys-libs/glibc/files/nsswitch.conf b/sys-libs/glibc/files/nsswitch.conf
new file mode 100644
index 000000000000..f28d534edf68
--- /dev/null
+++ b/sys-libs/glibc/files/nsswitch.conf
@@ -0,0 +1,24 @@
+# /etc/nsswitch.conf:
+# $Id$
+
+passwd: compat
+shadow: compat
+group: compat
+
+# passwd: db files nis
+# shadow: db files nis
+# group: db files nis
+
+hosts: files dns
+networks: files dns
+
+services: db files
+protocols: db files
+rpc: db files
+ethers: db files
+netmasks: files
+netgroup: files
+bootparams: files
+
+automount: files
+aliases: files
diff --git a/sys-libs/glibc/glibc-2.13-r4.ebuild b/sys-libs/glibc/glibc-2.13-r4.ebuild
new file mode 100644
index 000000000000..4cf40a583d00
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.13-r4.ebuild
@@ -0,0 +1,218 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils versionator toolchain-funcs flag-o-matic gnuconfig multilib systemd unpacker multiprocessing
+
+DESCRIPTION="GNU libc6 (also called glibc2) C library"
+HOMEPAGE="http://www.gnu.org/software/libc/libc.html"
+
+LICENSE="LGPL-2.1+ BSD HPND inner-net"
+KEYWORDS="alpha amd64 arm hppa ia64 ~m68k ~mips ppc ppc64 s390 ~sh sparc x86"
+RESTRICT="strip" # strip ourself #46186
+EMULTILIB_PKG="true"
+
+# Configuration variables
+if [[ ${PV} == *_p* ]] ; then
+RELEASE_VER=${PV%_p*}
+BRANCH_UPDATE=""
+SNAP_VER=${PV#*_p}
+else
+RELEASE_VER=${PV}
+BRANCH_UPDATE=""
+SNAP_VER=""
+fi
+LIBIDN_VER="" # it's integrated into the main tarball now
+PATCH_VER="11" # Gentoo patchset
+PORTS_VER="2.13" # version of glibc ports addon
+LT_VER="" # version of linuxthreads addon
+NPTL_KERN_VER=${NPTL_KERN_VER:-"2.6.9"} # min kernel version nptl requires
+#LT_KERN_VER=${LT_KERN_VER:-"2.4.1"} # min kernel version linuxthreads requires
+
+IUSE="debug gd hardened multilib selinux profile vanilla crosscompile_opts_headers-only ${LT_VER:+glibc-compat20 nptl linuxthreads}"
+S=${WORKDIR}/glibc-${RELEASE_VER}${SNAP_VER:+-${SNAP_VER}}
+
+# Here's how the cross-compile logic breaks down ...
+# CTARGET - machine that will target the binaries
+# CHOST - machine that will host the binaries
+# CBUILD - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+# CBUILD = CHOST = CTARGET - native build/install
+# CBUILD != (CHOST = CTARGET) - cross-compile a native build
+# (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+# CBUILD != CHOST != CTARGET - cross-compile a libc for a cross-compiler
+# For install paths:
+# CHOST = CTARGET - install into /
+# CHOST != CTARGET - install into /usr/CTARGET/
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+[[ ${CTARGET} == hppa* ]] && NPTL_KERN_VER=${NPTL_KERN_VER/2.6.9/2.6.20}
+
+is_crosscompile() {
+ [[ ${CHOST} != ${CTARGET} ]]
+}
+
+# Why SLOT 2.2 you ask yourself while sippin your tea ?
+# Everyone knows 2.2 > 0, duh.
+SLOT="2.2"
+
+# General: We need a new-enough binutils for as-needed
+# arch: we need to make sure our binutils/gcc supports TLS
+DEPEND=">=sys-devel/gcc-3.4.4
+ arm? ( >=sys-devel/binutils-2.16.90 >=sys-devel/gcc-4.1.0 )
+ x86? ( >=sys-devel/gcc-4.3 )
+ amd64? ( >=sys-devel/binutils-2.19 >=sys-devel/gcc-4.3 )
+ ppc? ( >=sys-devel/gcc-4.1.0 )
+ ppc64? ( >=sys-devel/gcc-4.1.0 )
+ >=sys-devel/binutils-2.15.94
+ ${LT_VER:+nptl? (} >=sys-kernel/linux-headers-${NPTL_KERN_VER} ${LT_VER:+)}
+ >=app-misc/pax-utils-0.1.10
+ virtual/os-headers
+ !<sys-apps/sandbox-1.2.18.1-r2
+ !<sys-apps/portage-2.1.2
+ !<sys-devel/patch-2.6
+ selinux? ( sys-libs/libselinux )"
+RDEPEND="!sys-kernel/ps3-sources
+ selinux? ( sys-libs/libselinux )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+ DEPEND="${DEPEND} !crosscompile_opts_headers-only? ( ${CATEGORY}/gcc )"
+ [[ ${CATEGORY} == *-linux* ]] && DEPEND="${DEPEND} ${CATEGORY}/linux-headers"
+else
+ DEPEND="${DEPEND} !vanilla? ( >=sys-libs/timezone-data-2007c )"
+ RDEPEND="${RDEPEND}
+ vanilla? ( !sys-libs/timezone-data )
+ !vanilla? ( sys-libs/timezone-data )"
+fi
+
+SRC_URI=$(
+ upstream_uris() {
+ echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
+ }
+ gentoo_uris() {
+ local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI"
+ devspace=${devspace//HTTP/http://dev.gentoo.org/}
+ echo mirror://gentoo/$1 ${devspace//URI/$1}
+ }
+
+ TARNAME=${PN}
+ if [[ -n ${SNAP_VER} ]] ; then
+ TARNAME="${PN}-${RELEASE_VER}"
+ [[ -n ${PORTS_VER} ]] && PORTS_VER=${SNAP_VER}
+ upstream_uris ${TARNAME}-${SNAP_VER}.tar.bz2
+ else
+ upstream_uris ${TARNAME}-${RELEASE_VER}.tar.bz2
+ fi
+ [[ -n ${LIBIDN_VER} ]] && upstream_uris glibc-libidn-${LIBIDN_VER}.tar.bz2
+ [[ -n ${PORTS_VER} ]] && upstream_uris ${TARNAME}-ports-${PORTS_VER}.tar.bz2
+ [[ -n ${LT_VER} ]] && upstream_uris ${TARNAME}-linuxthreads-${LT_VER}.tar.bz2
+ [[ -n ${BRANCH_UPDATE} ]] && gentoo_uris glibc-${RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2
+ [[ -n ${PATCH_VER} ]] && gentoo_uris glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
+)
+
+# eblit-include [--skip] <function> [version]
+eblit-include() {
+ local skipable=false
+ [[ $1 == "--skip" ]] && skipable=true && shift
+ [[ $1 == pkg_* ]] && skipable=true
+
+ local e v func=$1 ver=$2
+ [[ -z ${func} ]] && die "Usage: eblit-include <function> [version]"
+ for v in ${ver:+-}${ver} -${PVR} -${PV} "" ; do
+ e="${FILESDIR}/eblits/${func}${v}.eblit"
+ if [[ -e ${e} ]] ; then
+ source "${e}"
+ return 0
+ fi
+ done
+ ${skipable} && return 0
+ die "Could not locate requested eblit '${func}' in ${FILESDIR}/eblits/"
+}
+
+# eblit-run-maybe <function>
+# run the specified function if it is defined
+eblit-run-maybe() {
+ [[ $(type -t "$@") == "function" ]] && "$@"
+}
+
+# eblit-run <function> [version]
+# aka: src_unpack() { eblit-run src_unpack ; }
+eblit-run() {
+ eblit-include --skip common "${*:2}"
+ eblit-include "$@"
+ eblit-run-maybe eblit-$1-pre
+ eblit-${PN}-$1
+ eblit-run-maybe eblit-$1-post
+}
+
+src_unpack() { eblit-run src_unpack ; }
+src_compile() { eblit-run src_compile ; }
+src_test() { eblit-run src_test ; }
+src_install() { eblit-run src_install ; }
+
+# FILESDIR might not be available during binpkg install
+for x in setup {pre,post}inst ; do
+ e="${FILESDIR}/eblits/pkg_${x}.eblit"
+ if [[ -e ${e} ]] ; then
+ . "${e}"
+ eval "pkg_${x}() { eblit-run pkg_${x} ; }"
+ fi
+done
+
+pkg_setup() {
+ eblit-run pkg_setup
+
+ # Static binary sanity check #332927
+ if [[ ${ROOT} == "/" ]] && \
+ has_version "<${CATEGORY}/${P}" && \
+ built_with_use sys-apps/coreutils static
+ then
+ eerror "Please rebuild coreutils with USE=-static, then install"
+ eerror "glibc, then you may rebuild coreutils with USE=static."
+ die "Avoiding system meltdown #332927"
+ fi
+}
+
+eblit-src_unpack-post() {
+ if use hardened ; then
+ cd "${S}"
+ einfo "Patching to get working PIE binaries on PIE (hardened) platforms"
+ gcc-specs-pie && epatch "${FILESDIR}"/2.12/glibc-2.12-hardened-pie.patch
+ epatch "${FILESDIR}"/2.10/glibc-2.10-hardened-configure-picdefault.patch
+ epatch "${FILESDIR}"/2.10/glibc-2.10-hardened-inittls-nosysenter.patch
+
+ einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
+ cp -f "${FILESDIR}"/2.6/glibc-2.6-gentoo-stack_chk_fail.c \
+ debug/stack_chk_fail.c || die
+ cp -f "${FILESDIR}"/2.10/glibc-2.10-gentoo-chk_fail.c \
+ debug/chk_fail.c || die
+
+ if use debug ; then
+ # When using Hardened Gentoo stack handler, have smashes dump core for
+ # analysis - debug only, as core could be an information leak
+ # (paranoia).
+ sed -i \
+ -e '/^CFLAGS-backtrace.c/ iCFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+ debug/Makefile \
+ || die "Failed to modify debug/Makefile for debug stack handler"
+ sed -i \
+ -e '/^CFLAGS-backtrace.c/ iCFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+ debug/Makefile \
+ || die "Failed to modify debug/Makefile for debug fortify handler"
+ fi
+
+ # Build nscd with ssp-all
+ sed -i \
+ -e 's:-fstack-protector$:-fstack-protector-all:' \
+ nscd/Makefile \
+ || die "Failed to ensure nscd builds with ssp-all"
+ fi
+}
diff --git a/sys-libs/glibc/glibc-2.14.1-r3.ebuild b/sys-libs/glibc/glibc-2.14.1-r3.ebuild
new file mode 100644
index 000000000000..72b02819a3cb
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.14.1-r3.ebuild
@@ -0,0 +1,246 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils versionator toolchain-funcs flag-o-matic gnuconfig multilib systemd unpacker multiprocessing
+
+DESCRIPTION="GNU libc6 (also called glibc2) C library"
+HOMEPAGE="http://www.gnu.org/software/libc/libc.html"
+
+LICENSE="LGPL-2.1+ BSD HPND inner-net"
+KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 s390 ~sh sparc x86"
+RESTRICT="strip" # strip ourself #46186
+EMULTILIB_PKG="true"
+
+# Configuration variables
+RELEASE_VER=""
+BRANCH_UPDATE=""
+SNAP_VER=""
+case ${PV} in
+9999*)
+ EGIT_REPO_URIS=( "git://sourceware.org/git/glibc.git" "git://sourceware.org/git/glibc-ports.git" )
+ EGIT_SOURCEDIRS=( "${S}" "${S}/ports" )
+ inherit git-2
+ ;;
+*_p*)
+ RELEASE_VER=${PV%_p*}
+ SNAP_VER=${PV#*_p}
+ ;;
+*)
+ RELEASE_VER=${PV}
+ ;;
+esac
+LIBIDN_VER="" # it's integrated into the main tarball now
+PATCH_VER="10" # Gentoo patchset
+PORTS_VER=${RELEASE_VER} # version of glibc ports addon
+LT_VER="" # version of linuxthreads addon
+NPTL_KERN_VER=${NPTL_KERN_VER:-"2.6.9"} # min kernel version nptl requires
+#LT_KERN_VER=${LT_KERN_VER:-"2.4.1"} # min kernel version linuxthreads requires
+
+IUSE="debug gd hardened multilib selinux profile vanilla crosscompile_opts_headers-only ${LT_VER:+glibc-compat20 nptl linuxthreads}"
+[[ -n ${RELEASE_VER} ]] && S=${WORKDIR}/glibc-${RELEASE_VER}${SNAP_VER:+-${SNAP_VER}}
+
+# Here's how the cross-compile logic breaks down ...
+# CTARGET - machine that will target the binaries
+# CHOST - machine that will host the binaries
+# CBUILD - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+# CBUILD = CHOST = CTARGET - native build/install
+# CBUILD != (CHOST = CTARGET) - cross-compile a native build
+# (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+# CBUILD != CHOST != CTARGET - cross-compile a libc for a cross-compiler
+# For install paths:
+# CHOST = CTARGET - install into /
+# CHOST != CTARGET - install into /usr/CTARGET/
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+[[ ${CTARGET} == hppa* ]] && NPTL_KERN_VER=${NPTL_KERN_VER/2.6.9/2.6.20}
+
+is_crosscompile() {
+ [[ ${CHOST} != ${CTARGET} ]]
+}
+
+# Why SLOT 2.2 you ask yourself while sippin your tea ?
+# Everyone knows 2.2 > 0, duh.
+SLOT="2.2"
+
+# General: We need a new-enough binutils for as-needed
+# arch: we need to make sure our binutils/gcc supports TLS
+DEPEND=">=sys-devel/gcc-3.4.4
+ arm? ( >=sys-devel/binutils-2.16.90 >=sys-devel/gcc-4.1.0 )
+ x86? ( >=sys-devel/gcc-4.3 )
+ amd64? ( >=sys-devel/binutils-2.19 >=sys-devel/gcc-4.3 )
+ ppc? ( >=sys-devel/gcc-4.1.0 )
+ ppc64? ( >=sys-devel/gcc-4.1.0 )
+ >=sys-devel/binutils-2.15.94
+ ${LT_VER:+nptl? (} >=sys-kernel/linux-headers-${NPTL_KERN_VER} ${LT_VER:+)}
+ >=app-misc/pax-utils-0.1.10
+ virtual/os-headers
+ !<sys-apps/sandbox-1.2.18.1-r2
+ !<sys-apps/portage-2.1.2
+ !<sys-devel/patch-2.6
+ selinux? ( sys-libs/libselinux )"
+RDEPEND="!sys-kernel/ps3-sources
+ selinux? ( sys-libs/libselinux )"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+ DEPEND="${DEPEND} !crosscompile_opts_headers-only? ( ${CATEGORY}/gcc )"
+ [[ ${CATEGORY} == *-linux* ]] && DEPEND="${DEPEND} ${CATEGORY}/linux-headers"
+else
+ DEPEND="${DEPEND} !vanilla? ( >=sys-libs/timezone-data-2007c )"
+ RDEPEND="${RDEPEND}
+ vanilla? ( !sys-libs/timezone-data )
+ !vanilla? ( sys-libs/timezone-data )"
+fi
+
+SRC_URI=$(
+ upstream_uris() {
+ echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
+ }
+ gentoo_uris() {
+ local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI"
+ devspace=${devspace//HTTP/http://dev.gentoo.org/}
+ echo mirror://gentoo/$1 ${devspace//URI/$1}
+ }
+
+ TARNAME=${PN}
+ if [[ -n ${SNAP_VER} ]] ; then
+ TARNAME="${PN}-${RELEASE_VER}"
+ [[ -n ${PORTS_VER} ]] && PORTS_VER=${SNAP_VER}
+ upstream_uris ${TARNAME}-${SNAP_VER}.tar.bz2
+ elif [[ -z ${EGIT_REPO_URIS} ]] ; then
+ upstream_uris ${TARNAME}-${RELEASE_VER}.tar.bz2
+ fi
+ [[ -n ${LIBIDN_VER} ]] && upstream_uris glibc-libidn-${LIBIDN_VER}.tar.bz2
+ [[ -n ${PORTS_VER} ]] && upstream_uris ${TARNAME}-ports-${PORTS_VER}.tar.bz2
+ [[ -n ${LT_VER} ]] && upstream_uris ${TARNAME}-linuxthreads-${LT_VER}.tar.bz2
+ [[ -n ${BRANCH_UPDATE} ]] && gentoo_uris glibc-${RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2
+ [[ -n ${PATCH_VER} ]] && gentoo_uris glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
+)
+
+# eblit-include [--skip] <function> [version]
+eblit-include() {
+ local skipable=false
+ [[ $1 == "--skip" ]] && skipable=true && shift
+ [[ $1 == pkg_* ]] && skipable=true
+
+ local e v func=$1 ver=$2
+ [[ -z ${func} ]] && die "Usage: eblit-include <function> [version]"
+ for v in ${ver:+-}${ver} -${PVR} -${PV} "" ; do
+ e="${FILESDIR}/eblits/${func}${v}.eblit"
+ if [[ -e ${e} ]] ; then
+ source "${e}"
+ return 0
+ fi
+ done
+ ${skipable} && return 0
+ die "Could not locate requested eblit '${func}' in ${FILESDIR}/eblits/"
+}
+
+# eblit-run-maybe <function>
+# run the specified function if it is defined
+eblit-run-maybe() {
+ [[ $(type -t "$@") == "function" ]] && "$@"
+}
+
+# eblit-run <function> [version]
+# aka: src_unpack() { eblit-run src_unpack ; }
+eblit-run() {
+ eblit-include --skip common "${*:2}"
+ eblit-include "$@"
+ eblit-run-maybe eblit-$1-pre
+ eblit-${PN}-$1
+ eblit-run-maybe eblit-$1-post
+}
+
+src_unpack() { eblit-run src_unpack ; }
+src_compile() { eblit-run src_compile ; }
+src_test() { eblit-run src_test ; }
+src_install() { eblit-run src_install ; }
+
+# FILESDIR might not be available during binpkg install
+for x in setup {pre,post}inst ; do
+ e="${FILESDIR}/eblits/pkg_${x}.eblit"
+ if [[ -e ${e} ]] ; then
+ . "${e}"
+ eval "pkg_${x}() { eblit-run pkg_${x} ; }"
+ fi
+done
+
+pkg_setup() {
+ eblit-run pkg_setup
+
+ # Static binary sanity check #332927
+ if [[ ${ROOT} == "/" ]] && \
+ has_version "<${CATEGORY}/${P}" && \
+ built_with_use sys-apps/coreutils static
+ then
+ eerror "Please rebuild coreutils with USE=-static, then install"
+ eerror "glibc, then you may rebuild coreutils with USE=static."
+ die "Avoiding system meltdown #332927"
+ fi
+}
+
+eblit-src_unpack-pre() {
+ GLIBC_PATCH_EXCLUDE+=" 1200_all_glibc-${PV}-x32.patch"
+}
+
+eblit-src_unpack-post() {
+ if use hardened ; then
+ cd "${S}"
+ einfo "Patching to get working PIE binaries on PIE (hardened) platforms"
+ gcc-specs-pie && epatch "${FILESDIR}"/2.12/glibc-2.12-hardened-pie.patch
+ epatch "${FILESDIR}"/2.10/glibc-2.10-hardened-configure-picdefault.patch
+ epatch "${FILESDIR}"/2.10/glibc-2.10-hardened-inittls-nosysenter.patch
+
+ einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
+ cp -f "${FILESDIR}"/2.6/glibc-2.6-gentoo-stack_chk_fail.c \
+ debug/stack_chk_fail.c || die
+ cp -f "${FILESDIR}"/2.10/glibc-2.10-gentoo-chk_fail.c \
+ debug/chk_fail.c || die
+
+ if use debug ; then
+ # When using Hardened Gentoo stack handler, have smashes dump core for
+ # analysis - debug only, as core could be an information leak
+ # (paranoia).
+ sed -i \
+ -e '/^CFLAGS-backtrace.c/ iCFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+ debug/Makefile \
+ || die "Failed to modify debug/Makefile for debug stack handler"
+ sed -i \
+ -e '/^CFLAGS-backtrace.c/ iCFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+ debug/Makefile \
+ || die "Failed to modify debug/Makefile for debug fortify handler"
+ fi
+
+ # Build nscd with ssp-all
+ sed -i \
+ -e 's:-fstack-protector$:-fstack-protector-all:' \
+ nscd/Makefile \
+ || die "Failed to ensure nscd builds with ssp-all"
+ fi
+}
+
+eblit-pkg_preinst-post() {
+ if [[ ${CTARGET} == arm* ]] ; then
+ # Backwards compat support for renaming hardfp ldsos #417287
+ local oldso='/lib/ld-linux.so.3'
+ local nldso='/lib/ld-linux-armhf.so.3'
+ if [[ -e ${D}${nldso} ]] ; then
+ if scanelf -qRyi "${ROOT}$(alt_prefix)"/*bin/ | grep -s "^${oldso}" ; then
+ ewarn "Symlinking old ldso (${oldso}) to new ldso (${nldso})."
+ ewarn "Please rebuild all packages using this old ldso as compat"
+ ewarn "support will be dropped in the future."
+ ln -s "${nldso##*/}" "${D}$(alt_prefix)${oldso}"
+ fi
+ fi
+ fi
+}
diff --git a/sys-libs/glibc/glibc-2.15-r3.ebuild b/sys-libs/glibc/glibc-2.15-r3.ebuild
new file mode 100644
index 000000000000..eefde954290e
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.15-r3.ebuild
@@ -0,0 +1,225 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils versionator toolchain-funcs flag-o-matic gnuconfig multilib systemd unpacker multiprocessing
+
+DESCRIPTION="GNU libc6 (also called glibc2) C library"
+HOMEPAGE="http://www.gnu.org/software/libc/libc.html"
+
+LICENSE="LGPL-2.1+ BSD HPND inner-net"
+KEYWORDS="alpha amd64 arm -hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
+RESTRICT="strip" # strip ourself #46186
+EMULTILIB_PKG="true"
+
+# Configuration variables
+RELEASE_VER=""
+BRANCH_UPDATE=""
+SNAP_VER=""
+case ${PV} in
+9999*)
+ EGIT_REPO_URIS=( "git://sourceware.org/git/glibc.git" "git://sourceware.org/git/glibc-ports.git" )
+ EGIT_SOURCEDIRS=( "${S}" "${S}/ports" )
+ inherit git-2
+ ;;
+*_p*)
+ RELEASE_VER=${PV%_p*}
+ SNAP_VER=${PV#*_p}
+ ;;
+*)
+ RELEASE_VER=${PV}
+ ;;
+esac
+LIBIDN_VER="" # it's integrated into the main tarball now
+PATCH_VER="23" # Gentoo patchset
+PORTS_VER=${RELEASE_VER} # version of glibc ports addon
+NPTL_KERN_VER=${NPTL_KERN_VER:-"2.6.9"} # min kernel version nptl requires
+
+IUSE="debug gd hardened multilib selinux profile vanilla crosscompile_opts_headers-only"
+[[ -n ${RELEASE_VER} ]] && S=${WORKDIR}/glibc-${RELEASE_VER}${SNAP_VER:+-${SNAP_VER}}
+
+# Here's how the cross-compile logic breaks down ...
+# CTARGET - machine that will target the binaries
+# CHOST - machine that will host the binaries
+# CBUILD - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+# CBUILD = CHOST = CTARGET - native build/install
+# CBUILD != (CHOST = CTARGET) - cross-compile a native build
+# (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+# CBUILD != CHOST != CTARGET - cross-compile a libc for a cross-compiler
+# For install paths:
+# CHOST = CTARGET - install into /
+# CHOST != CTARGET - install into /usr/CTARGET/
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+[[ ${CTARGET} == hppa* ]] && NPTL_KERN_VER=${NPTL_KERN_VER/2.6.9/2.6.20}
+
+is_crosscompile() {
+ [[ ${CHOST} != ${CTARGET} ]]
+}
+
+# Why SLOT 2.2 you ask yourself while sippin your tea ?
+# Everyone knows 2.2 > 0, duh.
+SLOT="2.2"
+
+# General: We need a new-enough binutils for as-needed
+# arch: we need to make sure our binutils/gcc supports TLS
+DEPEND=">=sys-devel/gcc-3.4.4
+ arm? ( >=sys-devel/binutils-2.16.90 >=sys-devel/gcc-4.1.0 )
+ x86? ( >=sys-devel/gcc-4.3 )
+ amd64? ( >=sys-devel/binutils-2.19 >=sys-devel/gcc-4.3 )
+ ppc? ( >=sys-devel/gcc-4.1.0 )
+ ppc64? ( >=sys-devel/gcc-4.1.0 )
+ >=sys-devel/binutils-2.15.94
+ >=app-misc/pax-utils-0.1.10
+ virtual/os-headers
+ !<sys-apps/sandbox-1.2.18.1-r2
+ !<sys-apps/portage-2.1.2
+ !<sys-devel/patch-2.6
+ selinux? ( sys-libs/libselinux )"
+RDEPEND="!sys-kernel/ps3-sources
+ selinux? ( sys-libs/libselinux )
+ !sys-libs/nss-db"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+ DEPEND="${DEPEND} !crosscompile_opts_headers-only? ( ${CATEGORY}/gcc )"
+ [[ ${CATEGORY} == *-linux* ]] && DEPEND="${DEPEND} ${CATEGORY}/linux-headers"
+else
+ DEPEND="${DEPEND} !vanilla? ( >=sys-libs/timezone-data-2007c )"
+ RDEPEND="${RDEPEND}
+ vanilla? ( !sys-libs/timezone-data )
+ !vanilla? ( sys-libs/timezone-data )"
+fi
+
+SRC_URI=$(
+ upstream_uris() {
+ echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
+ }
+ gentoo_uris() {
+ local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI"
+ devspace=${devspace//HTTP/http://dev.gentoo.org/}
+ echo mirror://gentoo/$1 ${devspace//URI/$1}
+ }
+
+ TARNAME=${PN}
+ if [[ -n ${SNAP_VER} ]] ; then
+ TARNAME="${PN}-${RELEASE_VER}"
+ [[ -n ${PORTS_VER} ]] && PORTS_VER=${SNAP_VER}
+ upstream_uris ${TARNAME}-${SNAP_VER}.tar.bz2
+ elif [[ -z ${EGIT_REPO_URIS} ]] ; then
+ upstream_uris ${TARNAME}-${RELEASE_VER}.tar.xz
+ fi
+ [[ -n ${LIBIDN_VER} ]] && upstream_uris glibc-libidn-${LIBIDN_VER}.tar.bz2
+ [[ -n ${PORTS_VER} ]] && upstream_uris ${TARNAME}-ports-${PORTS_VER}.tar.xz
+ [[ -n ${BRANCH_UPDATE} ]] && gentoo_uris glibc-${RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2
+ [[ -n ${PATCH_VER} ]] && gentoo_uris glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
+)
+
+# eblit-include [--skip] <function> [version]
+eblit-include() {
+ local skipable=false
+ [[ $1 == "--skip" ]] && skipable=true && shift
+ [[ $1 == pkg_* ]] && skipable=true
+
+ local e v func=$1 ver=$2
+ [[ -z ${func} ]] && die "Usage: eblit-include <function> [version]"
+ for v in ${ver:+-}${ver} -${PVR} -${PV} "" ; do
+ e="${FILESDIR}/eblits/${func}${v}.eblit"
+ if [[ -e ${e} ]] ; then
+ source "${e}"
+ return 0
+ fi
+ done
+ ${skipable} && return 0
+ die "Could not locate requested eblit '${func}' in ${FILESDIR}/eblits/"
+}
+
+# eblit-run-maybe <function>
+# run the specified function if it is defined
+eblit-run-maybe() {
+ [[ $(type -t "$@") == "function" ]] && "$@"
+}
+
+# eblit-run <function> [version]
+# aka: src_unpack() { eblit-run src_unpack ; }
+eblit-run() {
+ eblit-include --skip common "${*:2}"
+ eblit-include "$@"
+ eblit-run-maybe eblit-$1-pre
+ eblit-${PN}-$1
+ eblit-run-maybe eblit-$1-post
+}
+
+src_unpack() { eblit-run src_unpack ; }
+src_compile() { eblit-run src_compile ; }
+src_test() { eblit-run src_test ; }
+src_install() { eblit-run src_install ; }
+
+# FILESDIR might not be available during binpkg install
+for x in setup {pre,post}inst ; do
+ e="${FILESDIR}/eblits/pkg_${x}.eblit"
+ if [[ -e ${e} ]] ; then
+ . "${e}"
+ eval "pkg_${x}() { eblit-run pkg_${x} ; }"
+ fi
+done
+
+eblit-src_unpack-post() {
+ if use hardened ; then
+ cd "${S}"
+ einfo "Patching to get working PIE binaries on PIE (hardened) platforms"
+ gcc-specs-pie && epatch "${FILESDIR}"/2.12/glibc-2.12-hardened-pie.patch
+ epatch "${FILESDIR}"/2.10/glibc-2.10-hardened-configure-picdefault.patch
+ epatch "${FILESDIR}"/2.10/glibc-2.10-hardened-inittls-nosysenter.patch
+
+ einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
+ cp -f "${FILESDIR}"/2.6/glibc-2.6-gentoo-stack_chk_fail.c \
+ debug/stack_chk_fail.c || die
+ cp -f "${FILESDIR}"/2.10/glibc-2.10-gentoo-chk_fail.c \
+ debug/chk_fail.c || die
+
+ if use debug ; then
+ # When using Hardened Gentoo stack handler, have smashes dump core for
+ # analysis - debug only, as core could be an information leak
+ # (paranoia).
+ sed -i \
+ -e '/^CFLAGS-backtrace.c/ iCFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+ debug/Makefile \
+ || die "Failed to modify debug/Makefile for debug stack handler"
+ sed -i \
+ -e '/^CFLAGS-backtrace.c/ iCFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+ debug/Makefile \
+ || die "Failed to modify debug/Makefile for debug fortify handler"
+ fi
+
+ # Build nscd with ssp-all
+ sed -i \
+ -e 's:-fstack-protector$:-fstack-protector-all:' \
+ nscd/Makefile \
+ || die "Failed to ensure nscd builds with ssp-all"
+ fi
+}
+
+eblit-pkg_preinst-post() {
+ if [[ ${CTARGET} == arm* ]] ; then
+ # Backwards compat support for renaming hardfp ldsos #417287
+ local oldso='/lib/ld-linux.so.3'
+ local nldso='/lib/ld-linux-armhf.so.3'
+ if [[ -e ${D}${nldso} ]] ; then
+ if scanelf -qRyi "${ROOT}$(alt_prefix)"/*bin/ | grep -s "^${oldso}" ; then
+ ewarn "Symlinking old ldso (${oldso}) to new ldso (${nldso})."
+ ewarn "Please rebuild all packages using this old ldso as compat"
+ ewarn "support will be dropped in the future."
+ ln -s "${nldso##*/}" "${D}$(alt_prefix)${oldso}"
+ fi
+ fi
+ fi
+}
diff --git a/sys-libs/glibc/glibc-2.16.0.ebuild b/sys-libs/glibc/glibc-2.16.0.ebuild
new file mode 100644
index 000000000000..588b27c60a5c
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.16.0.ebuild
@@ -0,0 +1,223 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils versionator toolchain-funcs flag-o-matic gnuconfig multilib systemd unpacker multiprocessing
+
+DESCRIPTION="GNU libc6 (also called glibc2) C library"
+HOMEPAGE="http://www.gnu.org/software/libc/libc.html"
+
+LICENSE="LGPL-2.1+ BSD HPND inner-net"
+KEYWORDS="~alpha amd64 arm -hppa ia64 ~mips ppc ppc64 ~s390 ~sh ~sparc x86"
+RESTRICT="strip" # strip ourself #46186
+EMULTILIB_PKG="true"
+
+# Configuration variables
+RELEASE_VER=""
+BRANCH_UPDATE=""
+SNAP_VER=""
+case ${PV} in
+9999*)
+ EGIT_REPO_URIS=( "git://sourceware.org/git/glibc.git" "git://sourceware.org/git/glibc-ports.git" )
+ EGIT_SOURCEDIRS=( "${S}" "${S}/ports" )
+ inherit git-2
+ ;;
+*_p*)
+ RELEASE_VER=${PV%_p*}
+ SNAP_VER=${PV#*_p}
+ ;;
+*)
+ RELEASE_VER=${PV}
+ ;;
+esac
+LIBIDN_VER="" # it's integrated into the main tarball now
+PATCH_VER="12" # Gentoo patchset
+PORTS_VER=${RELEASE_VER} # version of glibc ports addon
+NPTL_KERN_VER=${NPTL_KERN_VER:-"2.6.16"} # min kernel version nptl requires
+
+IUSE="debug gd hardened multilib selinux suid systemtap profile vanilla crosscompile_opts_headers-only"
+[[ -n ${RELEASE_VER} ]] && S=${WORKDIR}/glibc-${RELEASE_VER}${SNAP_VER:+-${SNAP_VER}}
+
+# Here's how the cross-compile logic breaks down ...
+# CTARGET - machine that will target the binaries
+# CHOST - machine that will host the binaries
+# CBUILD - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+# CBUILD = CHOST = CTARGET - native build/install
+# CBUILD != (CHOST = CTARGET) - cross-compile a native build
+# (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+# CBUILD != CHOST != CTARGET - cross-compile a libc for a cross-compiler
+# For install paths:
+# CHOST = CTARGET - install into /
+# CHOST != CTARGET - install into /usr/CTARGET/
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+[[ ${CTARGET} == hppa* ]] && NPTL_KERN_VER=${NPTL_KERN_VER/2.6.16/2.6.20}
+
+is_crosscompile() {
+ [[ ${CHOST} != ${CTARGET} ]]
+}
+
+# Why SLOT 2.2 you ask yourself while sippin your tea ?
+# Everyone knows 2.2 > 0, duh.
+SLOT="2.2"
+
+# General: We need a new-enough binutils/gcc to match upstream baseline.
+# arch: we need to make sure our binutils/gcc supports TLS.
+DEPEND=">=app-misc/pax-utils-0.1.10
+ !<sys-apps/sandbox-1.6
+ !<sys-apps/portage-2.1.2
+ selinux? ( sys-libs/libselinux )"
+RDEPEND="!sys-kernel/ps3-sources
+ selinux? ( sys-libs/libselinux )
+ !sys-libs/nss-db"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+ DEPEND+=" !crosscompile_opts_headers-only? (
+ >=${CATEGORY}/binutils-2.20
+ >=${CATEGORY}/gcc-4.3
+ )"
+ [[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+ DEPEND+="
+ >=sys-devel/binutils-2.20
+ >=sys-devel/gcc-4.3
+ virtual/os-headers
+ !vanilla? ( >=sys-libs/timezone-data-2012c )"
+ RDEPEND+="
+ vanilla? ( !sys-libs/timezone-data )
+ !vanilla? ( sys-libs/timezone-data )"
+fi
+
+SRC_URI=$(
+ upstream_uris() {
+ echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
+ }
+ gentoo_uris() {
+ local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI"
+ devspace=${devspace//HTTP/http://dev.gentoo.org/}
+ echo mirror://gentoo/$1 ${devspace//URI/$1}
+ }
+
+ TARNAME=${PN}
+ if [[ -n ${SNAP_VER} ]] ; then
+ TARNAME="${PN}-${RELEASE_VER}"
+ [[ -n ${PORTS_VER} ]] && PORTS_VER=${SNAP_VER}
+ upstream_uris ${TARNAME}-${SNAP_VER}.tar.bz2
+ elif [[ -z ${EGIT_REPO_URIS} ]] ; then
+ upstream_uris ${TARNAME}-${RELEASE_VER}.tar.xz
+ fi
+ [[ -n ${LIBIDN_VER} ]] && upstream_uris glibc-libidn-${LIBIDN_VER}.tar.bz2
+ [[ -n ${PORTS_VER} ]] && upstream_uris ${TARNAME}-ports-${PORTS_VER}.tar.xz
+ [[ -n ${BRANCH_UPDATE} ]] && gentoo_uris glibc-${RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2
+ [[ -n ${PATCH_VER} ]] && gentoo_uris glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
+)
+
+# eblit-include [--skip] <function> [version]
+eblit-include() {
+ local skipable=false
+ [[ $1 == "--skip" ]] && skipable=true && shift
+ [[ $1 == pkg_* ]] && skipable=true
+
+ local e v func=$1 ver=$2
+ [[ -z ${func} ]] && die "Usage: eblit-include <function> [version]"
+ for v in ${ver:+-}${ver} -${PVR} -${PV} "" ; do
+ e="${FILESDIR}/eblits/${func}${v}.eblit"
+ if [[ -e ${e} ]] ; then
+ source "${e}"
+ return 0
+ fi
+ done
+ ${skipable} && return 0
+ die "Could not locate requested eblit '${func}' in ${FILESDIR}/eblits/"
+}
+
+# eblit-run-maybe <function>
+# run the specified function if it is defined
+eblit-run-maybe() {
+ [[ $(type -t "$@") == "function" ]] && "$@"
+}
+
+# eblit-run <function> [version]
+# aka: src_unpack() { eblit-run src_unpack ; }
+eblit-run() {
+ eblit-include --skip common "${*:2}"
+ eblit-include "$@"
+ eblit-run-maybe eblit-$1-pre
+ eblit-${PN}-$1
+ eblit-run-maybe eblit-$1-post
+}
+
+src_unpack() { eblit-run src_unpack ; }
+src_compile() { eblit-run src_compile ; }
+src_test() { eblit-run src_test ; }
+src_install() { eblit-run src_install ; }
+
+# FILESDIR might not be available during binpkg install
+for x in setup {pre,post}inst ; do
+ e="${FILESDIR}/eblits/pkg_${x}.eblit"
+ if [[ -e ${e} ]] ; then
+ . "${e}"
+ eval "pkg_${x}() { eblit-run pkg_${x} ; }"
+ fi
+done
+
+eblit-src_unpack-post() {
+ if use hardened ; then
+ cd "${S}"
+ einfo "Patching to get working PIE binaries on PIE (hardened) platforms"
+ gcc-specs-pie && epatch "${FILESDIR}"/2.16/glibc-2.16-hardened-pie.patch
+ epatch "${FILESDIR}"/2.10/glibc-2.10-hardened-configure-picdefault.patch
+ epatch "${FILESDIR}"/2.10/glibc-2.10-hardened-inittls-nosysenter.patch
+
+ einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
+ cp -f "${FILESDIR}"/2.6/glibc-2.6-gentoo-stack_chk_fail.c \
+ debug/stack_chk_fail.c || die
+ cp -f "${FILESDIR}"/2.10/glibc-2.10-gentoo-chk_fail.c \
+ debug/chk_fail.c || die
+
+ if use debug ; then
+ # When using Hardened Gentoo stack handler, have smashes dump core for
+ # analysis - debug only, as core could be an information leak
+ # (paranoia).
+ sed -i \
+ -e '/^CFLAGS-backtrace.c/ iCFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+ debug/Makefile \
+ || die "Failed to modify debug/Makefile for debug stack handler"
+ sed -i \
+ -e '/^CFLAGS-backtrace.c/ iCFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+ debug/Makefile \
+ || die "Failed to modify debug/Makefile for debug fortify handler"
+ fi
+
+ # Build nscd with ssp-all
+ sed -i \
+ -e 's:-fstack-protector$:-fstack-protector-all:' \
+ nscd/Makefile \
+ || die "Failed to ensure nscd builds with ssp-all"
+ fi
+}
+
+eblit-pkg_preinst-post() {
+ if [[ ${CTARGET} == arm* ]] ; then
+ # Backwards compat support for renaming hardfp ldsos #417287
+ local oldso='/lib/ld-linux.so.3'
+ local nldso='/lib/ld-linux-armhf.so.3'
+ if [[ -e ${D}${nldso} ]] ; then
+ if scanelf -qRyi "${ROOT}$(alt_prefix)"/*bin/ | grep -s "^${oldso}" ; then
+ ewarn "Symlinking old ldso (${oldso}) to new ldso (${nldso})."
+ ewarn "Please rebuild all packages using this old ldso as compat"
+ ewarn "support will be dropped in the future."
+ ln -s "${nldso##*/}" "${D}$(alt_prefix)${oldso}"
+ fi
+ fi
+ fi
+}
diff --git a/sys-libs/glibc/glibc-2.17.ebuild b/sys-libs/glibc/glibc-2.17.ebuild
new file mode 100644
index 000000000000..91f9b3eccc30
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.17.ebuild
@@ -0,0 +1,210 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils versionator toolchain-funcs flag-o-matic gnuconfig multilib systemd unpacker multiprocessing
+
+DESCRIPTION="GNU libc6 (also called glibc2) C library"
+HOMEPAGE="http://www.gnu.org/software/libc/libc.html"
+
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
+RESTRICT="strip" # strip ourself #46186
+EMULTILIB_PKG="true"
+
+# Configuration variables
+RELEASE_VER=""
+case ${PV} in
+9999*)
+ EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
+ EGIT_SOURCEDIRS="${S}"
+ inherit git-2
+ ;;
+*)
+ RELEASE_VER=${PV}
+ ;;
+esac
+GCC_BOOTSTRAP_VER="4.7.3-r1"
+PATCH_VER="8" # Gentoo patchset
+NPTL_KERN_VER=${NPTL_KERN_VER:-"2.6.16"} # min kernel version nptl requires
+
+IUSE="debug gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+
+# Here's how the cross-compile logic breaks down ...
+# CTARGET - machine that will target the binaries
+# CHOST - machine that will host the binaries
+# CBUILD - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+# CBUILD = CHOST = CTARGET - native build/install
+# CBUILD != (CHOST = CTARGET) - cross-compile a native build
+# (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+# CBUILD != CHOST != CTARGET - cross-compile a libc for a cross-compiler
+# For install paths:
+# CHOST = CTARGET - install into /
+# CHOST != CTARGET - install into /usr/CTARGET/
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+[[ ${CTARGET} == hppa* ]] && NPTL_KERN_VER=${NPTL_KERN_VER/2.6.16/2.6.20}
+
+is_crosscompile() {
+ [[ ${CHOST} != ${CTARGET} ]]
+}
+
+# Why SLOT 2.2 you ask yourself while sippin your tea ?
+# Everyone knows 2.2 > 0, duh.
+SLOT="2.2"
+
+# General: We need a new-enough binutils/gcc to match upstream baseline.
+# arch: we need to make sure our binutils/gcc supports TLS.
+DEPEND=">=app-misc/pax-utils-0.1.10
+ !<sys-apps/sandbox-1.6
+ !<sys-apps/portage-2.1.2
+ selinux? ( sys-libs/libselinux )"
+RDEPEND="!sys-kernel/ps3-sources
+ selinux? ( sys-libs/libselinux )
+ !sys-libs/nss-db"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+ DEPEND+=" !crosscompile_opts_headers-only? (
+ >=${CATEGORY}/binutils-2.20
+ >=${CATEGORY}/gcc-4.3
+ )"
+ [[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+ DEPEND+="
+ >=sys-devel/binutils-2.20
+ >=sys-devel/gcc-4.3
+ virtual/os-headers
+ !vanilla? ( >=sys-libs/timezone-data-2012c )"
+ RDEPEND+="
+ vanilla? ( !sys-libs/timezone-data )
+ !vanilla? ( sys-libs/timezone-data )"
+fi
+
+upstream_uris() {
+ echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
+}
+gentoo_uris() {
+ local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI"
+ devspace=${devspace//HTTP/http://dev.gentoo.org/}
+ echo mirror://gentoo/$1 ${devspace//URI/$1}
+}
+SRC_URI=$(
+ [[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
+ [[ -n ${PATCH_VER} ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
+)
+SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
+
+# eblit-include [--skip] <function> [version]
+eblit-include() {
+ local skipable=false
+ [[ $1 == "--skip" ]] && skipable=true && shift
+ [[ $1 == pkg_* ]] && skipable=true
+
+ local e v func=$1 ver=$2
+ [[ -z ${func} ]] && die "Usage: eblit-include <function> [version]"
+ for v in ${ver:+-}${ver} -${PVR} -${PV} "" ; do
+ e="${FILESDIR}/eblits/${func}${v}.eblit"
+ if [[ -e ${e} ]] ; then
+ source "${e}"
+ return 0
+ fi
+ done
+ ${skipable} && return 0
+ die "Could not locate requested eblit '${func}' in ${FILESDIR}/eblits/"
+}
+
+# eblit-run-maybe <function>
+# run the specified function if it is defined
+eblit-run-maybe() {
+ [[ $(type -t "$@") == "function" ]] && "$@"
+}
+
+# eblit-run <function> [version]
+# aka: src_unpack() { eblit-run src_unpack ; }
+eblit-run() {
+ eblit-include --skip common "${*:2}"
+ eblit-include "$@"
+ eblit-run-maybe eblit-$1-pre
+ eblit-${PN}-$1
+ eblit-run-maybe eblit-$1-post
+}
+
+src_unpack() { eblit-run src_unpack ; }
+src_compile() { eblit-run src_compile ; }
+src_test() { eblit-run src_test ; }
+src_install() { eblit-run src_install ; }
+
+# FILESDIR might not be available during binpkg install
+for x in setup {pre,post}inst ; do
+ e="${FILESDIR}/eblits/pkg_${x}.eblit"
+ if [[ -e ${e} ]] ; then
+ . "${e}"
+ eval "pkg_${x}() { eblit-run pkg_${x} ; }"
+ fi
+done
+
+eblit-src_unpack-pre() {
+ GLIBC_PATCH_EXCLUDE+=" 6600_mips_librt-mips.patch" #456912
+ [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
+}
+
+eblit-src_unpack-post() {
+ if use hardened ; then
+ cd "${S}"
+ einfo "Patching to get working PIE binaries on PIE (hardened) platforms"
+ gcc-specs-pie && epatch "${FILESDIR}"/2.17/glibc-2.17-hardened-pie.patch
+ epatch "${FILESDIR}"/2.10/glibc-2.10-hardened-configure-picdefault.patch
+ epatch "${FILESDIR}"/2.10/glibc-2.10-hardened-inittls-nosysenter.patch
+
+ einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
+ cp -f "${FILESDIR}"/2.6/glibc-2.6-gentoo-stack_chk_fail.c \
+ debug/stack_chk_fail.c || die
+ cp -f "${FILESDIR}"/2.10/glibc-2.10-gentoo-chk_fail.c \
+ debug/chk_fail.c || die
+
+ if use debug ; then
+ # When using Hardened Gentoo stack handler, have smashes dump core for
+ # analysis - debug only, as core could be an information leak
+ # (paranoia).
+ sed -i \
+ -e '/^CFLAGS-backtrace.c/ iCFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+ debug/Makefile \
+ || die "Failed to modify debug/Makefile for debug stack handler"
+ sed -i \
+ -e '/^CFLAGS-backtrace.c/ iCFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+ debug/Makefile \
+ || die "Failed to modify debug/Makefile for debug fortify handler"
+ fi
+
+ # Build nscd with ssp-all
+ sed -i \
+ -e 's:-fstack-protector$:-fstack-protector-all:' \
+ nscd/Makefile \
+ || die "Failed to ensure nscd builds with ssp-all"
+ fi
+}
+
+eblit-pkg_preinst-post() {
+ if [[ ${CTARGET} == arm* ]] ; then
+ # Backwards compat support for renaming hardfp ldsos #417287
+ local oldso='/lib/ld-linux.so.3'
+ local nldso='/lib/ld-linux-armhf.so.3'
+ if [[ -e ${D}${nldso} ]] ; then
+ if scanelf -qRyi "${ROOT}$(alt_prefix)"/*bin/ | grep -s "^${oldso}" ; then
+ ewarn "Symlinking old ldso (${oldso}) to new ldso (${nldso})."
+ ewarn "Please rebuild all packages using this old ldso as compat"
+ ewarn "support will be dropped in the future."
+ ln -s "${nldso##*/}" "${D}$(alt_prefix)${oldso}"
+ fi
+ fi
+ fi
+}
diff --git a/sys-libs/glibc/glibc-2.18-r1.ebuild b/sys-libs/glibc/glibc-2.18-r1.ebuild
new file mode 100644
index 000000000000..da3d2d723dad
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.18-r1.ebuild
@@ -0,0 +1,210 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils versionator toolchain-funcs flag-o-matic gnuconfig multilib systemd unpacker multiprocessing
+
+DESCRIPTION="GNU libc6 (also called glibc2) C library"
+HOMEPAGE="http://www.gnu.org/software/libc/libc.html"
+
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+RESTRICT="strip" # strip ourself #46186
+EMULTILIB_PKG="true"
+
+# Configuration variables
+RELEASE_VER=""
+case ${PV} in
+9999*)
+ EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
+ EGIT_SOURCEDIRS="${S}"
+ inherit git-2
+ ;;
+*)
+ RELEASE_VER=${PV}
+ ;;
+esac
+GCC_BOOTSTRAP_VER="4.7.3-r1"
+PATCH_VER="4" # Gentoo patchset
+NPTL_KERN_VER=${NPTL_KERN_VER:-"2.6.16"} # min kernel version nptl requires
+
+IUSE="debug gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+
+# Here's how the cross-compile logic breaks down ...
+# CTARGET - machine that will target the binaries
+# CHOST - machine that will host the binaries
+# CBUILD - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+# CBUILD = CHOST = CTARGET - native build/install
+# CBUILD != (CHOST = CTARGET) - cross-compile a native build
+# (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+# CBUILD != CHOST != CTARGET - cross-compile a libc for a cross-compiler
+# For install paths:
+# CHOST = CTARGET - install into /
+# CHOST != CTARGET - install into /usr/CTARGET/
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+[[ ${CTARGET} == hppa* ]] && NPTL_KERN_VER=${NPTL_KERN_VER/2.6.16/2.6.20}
+
+is_crosscompile() {
+ [[ ${CHOST} != ${CTARGET} ]]
+}
+
+# Why SLOT 2.2 you ask yourself while sippin your tea ?
+# Everyone knows 2.2 > 0, duh.
+SLOT="2.2"
+
+# General: We need a new-enough binutils/gcc to match upstream baseline.
+# arch: we need to make sure our binutils/gcc supports TLS.
+DEPEND=">=app-misc/pax-utils-0.1.10
+ !<sys-apps/sandbox-1.6
+ !<sys-apps/portage-2.1.2
+ selinux? ( sys-libs/libselinux )"
+RDEPEND="!sys-kernel/ps3-sources
+ selinux? ( sys-libs/libselinux )
+ !sys-libs/nss-db"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+ DEPEND+=" !crosscompile_opts_headers-only? (
+ >=${CATEGORY}/binutils-2.20
+ >=${CATEGORY}/gcc-4.3
+ )"
+ [[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+ DEPEND+="
+ >=sys-devel/binutils-2.20
+ >=sys-devel/gcc-4.3
+ virtual/os-headers
+ !vanilla? ( >=sys-libs/timezone-data-2012c )"
+ RDEPEND+="
+ vanilla? ( !sys-libs/timezone-data )
+ !vanilla? ( sys-libs/timezone-data )"
+fi
+
+upstream_uris() {
+ echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
+}
+gentoo_uris() {
+ local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI"
+ devspace=${devspace//HTTP/http://dev.gentoo.org/}
+ echo mirror://gentoo/$1 ${devspace//URI/$1}
+}
+SRC_URI=$(
+ [[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
+ [[ -n ${PATCH_VER} ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
+)
+SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
+
+# eblit-include [--skip] <function> [version]
+eblit-include() {
+ local skipable=false
+ [[ $1 == "--skip" ]] && skipable=true && shift
+ [[ $1 == pkg_* ]] && skipable=true
+
+ local e v func=$1 ver=$2
+ [[ -z ${func} ]] && die "Usage: eblit-include <function> [version]"
+ for v in ${ver:+-}${ver} -${PVR} -${PV} "" ; do
+ e="${FILESDIR}/eblits/${func}${v}.eblit"
+ if [[ -e ${e} ]] ; then
+ source "${e}"
+ return 0
+ fi
+ done
+ ${skipable} && return 0
+ die "Could not locate requested eblit '${func}' in ${FILESDIR}/eblits/"
+}
+
+# eblit-run-maybe <function>
+# run the specified function if it is defined
+eblit-run-maybe() {
+ [[ $(type -t "$@") == "function" ]] && "$@"
+}
+
+# eblit-run <function> [version]
+# aka: src_unpack() { eblit-run src_unpack ; }
+eblit-run() {
+ eblit-include --skip common "${*:2}"
+ eblit-include "$@"
+ eblit-run-maybe eblit-$1-pre
+ eblit-${PN}-$1
+ eblit-run-maybe eblit-$1-post
+}
+
+src_unpack() { eblit-run src_unpack ; }
+src_compile() { eblit-run src_compile ; }
+src_test() { eblit-run src_test ; }
+src_install() { eblit-run src_install ; }
+
+# FILESDIR might not be available during binpkg install
+for x in setup {pre,post}inst ; do
+ e="${FILESDIR}/eblits/pkg_${x}.eblit"
+ if [[ -e ${e} ]] ; then
+ . "${e}"
+ eval "pkg_${x}() { eblit-run pkg_${x} ; }"
+ fi
+done
+
+eblit-src_unpack-pre() {
+ GLIBC_PATCH_EXCLUDE+=" 00_all_0012-mips-add-clock_-g-s-ettime-symbol-compat-hacks.patch" #456912 #481438
+ [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
+}
+
+eblit-src_unpack-post() {
+ if use hardened ; then
+ cd "${S}"
+ einfo "Patching to get working PIE binaries on PIE (hardened) platforms"
+ gcc-specs-pie && epatch "${FILESDIR}"/2.17/glibc-2.17-hardened-pie.patch
+ epatch "${FILESDIR}"/2.10/glibc-2.10-hardened-configure-picdefault.patch
+ epatch "${FILESDIR}"/2.18/glibc-2.18-hardened-inittls-nosysenter.patch
+
+ einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
+ cp -f "${FILESDIR}"/2.18/glibc-2.18-gentoo-stack_chk_fail.c \
+ debug/stack_chk_fail.c || die
+ cp -f "${FILESDIR}"/2.18/glibc-2.18-gentoo-chk_fail.c \
+ debug/chk_fail.c || die
+
+ if use debug ; then
+ # When using Hardened Gentoo stack handler, have smashes dump core for
+ # analysis - debug only, as core could be an information leak
+ # (paranoia).
+ sed -i \
+ -e '/^CFLAGS-backtrace.c/ iCFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+ debug/Makefile \
+ || die "Failed to modify debug/Makefile for debug stack handler"
+ sed -i \
+ -e '/^CFLAGS-backtrace.c/ iCFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+ debug/Makefile \
+ || die "Failed to modify debug/Makefile for debug fortify handler"
+ fi
+
+ # Build nscd with ssp-all
+ sed -i \
+ -e 's:-fstack-protector$:-fstack-protector-all:' \
+ nscd/Makefile \
+ || die "Failed to ensure nscd builds with ssp-all"
+ fi
+}
+
+eblit-pkg_preinst-post() {
+ if [[ ${CTARGET} == arm* ]] ; then
+ # Backwards compat support for renaming hardfp ldsos #417287
+ local oldso='/lib/ld-linux.so.3'
+ local nldso='/lib/ld-linux-armhf.so.3'
+ if [[ -e ${D}${nldso} ]] ; then
+ if scanelf -qRyi "${ROOT}$(alt_prefix)"/*bin/ | grep -s "^${oldso}" ; then
+ ewarn "Symlinking old ldso (${oldso}) to new ldso (${nldso})."
+ ewarn "Please rebuild all packages using this old ldso as compat"
+ ewarn "support will be dropped in the future."
+ ln -s "${nldso##*/}" "${D}$(alt_prefix)${oldso}"
+ fi
+ fi
+ fi
+}
diff --git a/sys-libs/glibc/glibc-2.19-r1.ebuild b/sys-libs/glibc/glibc-2.19-r1.ebuild
new file mode 100644
index 000000000000..87f73d887957
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.19-r1.ebuild
@@ -0,0 +1,209 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils versionator toolchain-funcs flag-o-matic gnuconfig multilib systemd unpacker multiprocessing
+
+DESCRIPTION="GNU libc6 (also called glibc2) C library"
+HOMEPAGE="http://www.gnu.org/software/libc/libc.html"
+
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
+RESTRICT="strip" # strip ourself #46186
+EMULTILIB_PKG="true"
+
+# Configuration variables
+RELEASE_VER=""
+case ${PV} in
+9999*)
+ EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
+ EGIT_SOURCEDIRS="${S}"
+ inherit git-2
+ ;;
+*)
+ RELEASE_VER=${PV}
+ ;;
+esac
+GCC_BOOTSTRAP_VER="4.7.3-r1"
+PATCH_VER="3" # Gentoo patchset
+NPTL_KERN_VER=${NPTL_KERN_VER:-"2.6.16"} # min kernel version nptl requires
+
+IUSE="debug gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+
+# Here's how the cross-compile logic breaks down ...
+# CTARGET - machine that will target the binaries
+# CHOST - machine that will host the binaries
+# CBUILD - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+# CBUILD = CHOST = CTARGET - native build/install
+# CBUILD != (CHOST = CTARGET) - cross-compile a native build
+# (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+# CBUILD != CHOST != CTARGET - cross-compile a libc for a cross-compiler
+# For install paths:
+# CHOST = CTARGET - install into /
+# CHOST != CTARGET - install into /usr/CTARGET/
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+[[ ${CTARGET} == hppa* ]] && NPTL_KERN_VER=${NPTL_KERN_VER/2.6.16/2.6.20}
+
+is_crosscompile() {
+ [[ ${CHOST} != ${CTARGET} ]]
+}
+
+# Why SLOT 2.2 you ask yourself while sippin your tea ?
+# Everyone knows 2.2 > 0, duh.
+SLOT="2.2"
+
+# General: We need a new-enough binutils/gcc to match upstream baseline.
+# arch: we need to make sure our binutils/gcc supports TLS.
+DEPEND=">=app-misc/pax-utils-0.1.10
+ !<sys-apps/sandbox-1.6
+ !<sys-apps/portage-2.1.2
+ selinux? ( sys-libs/libselinux )"
+RDEPEND="!sys-kernel/ps3-sources
+ selinux? ( sys-libs/libselinux )
+ !sys-libs/nss-db"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+ DEPEND+=" !crosscompile_opts_headers-only? (
+ >=${CATEGORY}/binutils-2.20
+ >=${CATEGORY}/gcc-4.3
+ )"
+ [[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+ DEPEND+="
+ >=sys-devel/binutils-2.20
+ >=sys-devel/gcc-4.3
+ virtual/os-headers
+ !vanilla? ( >=sys-libs/timezone-data-2012c )"
+ RDEPEND+="
+ vanilla? ( !sys-libs/timezone-data )
+ !vanilla? ( sys-libs/timezone-data )"
+fi
+
+upstream_uris() {
+ echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
+}
+gentoo_uris() {
+ local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI"
+ devspace=${devspace//HTTP/http://dev.gentoo.org/}
+ echo mirror://gentoo/$1 ${devspace//URI/$1}
+}
+SRC_URI=$(
+ [[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
+ [[ -n ${PATCH_VER} ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
+)
+SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
+
+# eblit-include [--skip] <function> [version]
+eblit-include() {
+ local skipable=false
+ [[ $1 == "--skip" ]] && skipable=true && shift
+ [[ $1 == pkg_* ]] && skipable=true
+
+ local e v func=$1 ver=$2
+ [[ -z ${func} ]] && die "Usage: eblit-include <function> [version]"
+ for v in ${ver:+-}${ver} -${PVR} -${PV} "" ; do
+ e="${FILESDIR}/eblits/${func}${v}.eblit"
+ if [[ -e ${e} ]] ; then
+ source "${e}"
+ return 0
+ fi
+ done
+ ${skipable} && return 0
+ die "Could not locate requested eblit '${func}' in ${FILESDIR}/eblits/"
+}
+
+# eblit-run-maybe <function>
+# run the specified function if it is defined
+eblit-run-maybe() {
+ [[ $(type -t "$@") == "function" ]] && "$@"
+}
+
+# eblit-run <function> [version]
+# aka: src_unpack() { eblit-run src_unpack ; }
+eblit-run() {
+ eblit-include --skip common "${*:2}"
+ eblit-include "$@"
+ eblit-run-maybe eblit-$1-pre
+ eblit-${PN}-$1
+ eblit-run-maybe eblit-$1-post
+}
+
+src_unpack() { eblit-run src_unpack ; }
+src_compile() { eblit-run src_compile ; }
+src_test() { eblit-run src_test ; }
+src_install() { eblit-run src_install ; }
+
+# FILESDIR might not be available during binpkg install
+for x in setup {pre,post}inst ; do
+ e="${FILESDIR}/eblits/pkg_${x}.eblit"
+ if [[ -e ${e} ]] ; then
+ . "${e}"
+ eval "pkg_${x}() { eblit-run pkg_${x} ; }"
+ fi
+done
+
+eblit-src_unpack-pre() {
+ [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
+}
+
+eblit-src_unpack-post() {
+ if use hardened ; then
+ cd "${S}"
+ einfo "Patching to get working PIE binaries on PIE (hardened) platforms"
+ gcc-specs-pie && epatch "${FILESDIR}"/2.17/glibc-2.17-hardened-pie.patch
+ epatch "${FILESDIR}"/2.19/glibc-2.19-hardened-configure-picdefault.patch
+ epatch "${FILESDIR}"/2.18/glibc-2.18-hardened-inittls-nosysenter.patch
+
+ einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
+ cp -f "${FILESDIR}"/2.18/glibc-2.18-gentoo-stack_chk_fail.c \
+ debug/stack_chk_fail.c || die
+ cp -f "${FILESDIR}"/2.18/glibc-2.18-gentoo-chk_fail.c \
+ debug/chk_fail.c || die
+
+ if use debug ; then
+ # When using Hardened Gentoo stack handler, have smashes dump core for
+ # analysis - debug only, as core could be an information leak
+ # (paranoia).
+ sed -i \
+ -e '/^CFLAGS-backtrace.c/ iCFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+ debug/Makefile \
+ || die "Failed to modify debug/Makefile for debug stack handler"
+ sed -i \
+ -e '/^CFLAGS-backtrace.c/ iCFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+ debug/Makefile \
+ || die "Failed to modify debug/Makefile for debug fortify handler"
+ fi
+
+ # Build nscd with ssp-all
+ sed -i \
+ -e 's:-fstack-protector$:-fstack-protector-all:' \
+ nscd/Makefile \
+ || die "Failed to ensure nscd builds with ssp-all"
+ fi
+}
+
+eblit-pkg_preinst-post() {
+ if [[ ${CTARGET} == arm* ]] ; then
+ # Backwards compat support for renaming hardfp ldsos #417287
+ local oldso='/lib/ld-linux.so.3'
+ local nldso='/lib/ld-linux-armhf.so.3'
+ if [[ -e ${D}${nldso} ]] ; then
+ if scanelf -qRyi "${ROOT}$(alt_prefix)"/*bin/ | grep -s "^${oldso}" ; then
+ ewarn "Symlinking old ldso (${oldso}) to new ldso (${nldso})."
+ ewarn "Please rebuild all packages using this old ldso as compat"
+ ewarn "support will be dropped in the future."
+ ln -s "${nldso##*/}" "${D}$(alt_prefix)${oldso}"
+ fi
+ fi
+ fi
+}
diff --git a/sys-libs/glibc/glibc-2.19.ebuild b/sys-libs/glibc/glibc-2.19.ebuild
new file mode 100644
index 000000000000..5b171b1bc6fe
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.19.ebuild
@@ -0,0 +1,209 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils versionator toolchain-funcs flag-o-matic gnuconfig multilib systemd unpacker multiprocessing
+
+DESCRIPTION="GNU libc6 (also called glibc2) C library"
+HOMEPAGE="http://www.gnu.org/software/libc/libc.html"
+
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+RESTRICT="strip" # strip ourself #46186
+EMULTILIB_PKG="true"
+
+# Configuration variables
+RELEASE_VER=""
+case ${PV} in
+9999*)
+ EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
+ EGIT_SOURCEDIRS="${S}"
+ inherit git-2
+ ;;
+*)
+ RELEASE_VER=${PV}
+ ;;
+esac
+GCC_BOOTSTRAP_VER="4.7.3-r1"
+PATCH_VER="1" # Gentoo patchset
+NPTL_KERN_VER=${NPTL_KERN_VER:-"2.6.16"} # min kernel version nptl requires
+
+IUSE="debug gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+
+# Here's how the cross-compile logic breaks down ...
+# CTARGET - machine that will target the binaries
+# CHOST - machine that will host the binaries
+# CBUILD - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+# CBUILD = CHOST = CTARGET - native build/install
+# CBUILD != (CHOST = CTARGET) - cross-compile a native build
+# (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+# CBUILD != CHOST != CTARGET - cross-compile a libc for a cross-compiler
+# For install paths:
+# CHOST = CTARGET - install into /
+# CHOST != CTARGET - install into /usr/CTARGET/
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+[[ ${CTARGET} == hppa* ]] && NPTL_KERN_VER=${NPTL_KERN_VER/2.6.16/2.6.20}
+
+is_crosscompile() {
+ [[ ${CHOST} != ${CTARGET} ]]
+}
+
+# Why SLOT 2.2 you ask yourself while sippin your tea ?
+# Everyone knows 2.2 > 0, duh.
+SLOT="2.2"
+
+# General: We need a new-enough binutils/gcc to match upstream baseline.
+# arch: we need to make sure our binutils/gcc supports TLS.
+DEPEND=">=app-misc/pax-utils-0.1.10
+ !<sys-apps/sandbox-1.6
+ !<sys-apps/portage-2.1.2
+ selinux? ( sys-libs/libselinux )"
+RDEPEND="!sys-kernel/ps3-sources
+ selinux? ( sys-libs/libselinux )
+ !sys-libs/nss-db"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+ DEPEND+=" !crosscompile_opts_headers-only? (
+ >=${CATEGORY}/binutils-2.20
+ >=${CATEGORY}/gcc-4.3
+ )"
+ [[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+ DEPEND+="
+ >=sys-devel/binutils-2.20
+ >=sys-devel/gcc-4.3
+ virtual/os-headers
+ !vanilla? ( >=sys-libs/timezone-data-2012c )"
+ RDEPEND+="
+ vanilla? ( !sys-libs/timezone-data )
+ !vanilla? ( sys-libs/timezone-data )"
+fi
+
+upstream_uris() {
+ echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
+}
+gentoo_uris() {
+ local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI"
+ devspace=${devspace//HTTP/http://dev.gentoo.org/}
+ echo mirror://gentoo/$1 ${devspace//URI/$1}
+}
+SRC_URI=$(
+ [[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
+ [[ -n ${PATCH_VER} ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
+)
+SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
+
+# eblit-include [--skip] <function> [version]
+eblit-include() {
+ local skipable=false
+ [[ $1 == "--skip" ]] && skipable=true && shift
+ [[ $1 == pkg_* ]] && skipable=true
+
+ local e v func=$1 ver=$2
+ [[ -z ${func} ]] && die "Usage: eblit-include <function> [version]"
+ for v in ${ver:+-}${ver} -${PVR} -${PV} "" ; do
+ e="${FILESDIR}/eblits/${func}${v}.eblit"
+ if [[ -e ${e} ]] ; then
+ source "${e}"
+ return 0
+ fi
+ done
+ ${skipable} && return 0
+ die "Could not locate requested eblit '${func}' in ${FILESDIR}/eblits/"
+}
+
+# eblit-run-maybe <function>
+# run the specified function if it is defined
+eblit-run-maybe() {
+ [[ $(type -t "$@") == "function" ]] && "$@"
+}
+
+# eblit-run <function> [version]
+# aka: src_unpack() { eblit-run src_unpack ; }
+eblit-run() {
+ eblit-include --skip common "${*:2}"
+ eblit-include "$@"
+ eblit-run-maybe eblit-$1-pre
+ eblit-${PN}-$1
+ eblit-run-maybe eblit-$1-post
+}
+
+src_unpack() { eblit-run src_unpack ; }
+src_compile() { eblit-run src_compile ; }
+src_test() { eblit-run src_test ; }
+src_install() { eblit-run src_install ; }
+
+# FILESDIR might not be available during binpkg install
+for x in setup {pre,post}inst ; do
+ e="${FILESDIR}/eblits/pkg_${x}.eblit"
+ if [[ -e ${e} ]] ; then
+ . "${e}"
+ eval "pkg_${x}() { eblit-run pkg_${x} ; }"
+ fi
+done
+
+eblit-src_unpack-pre() {
+ [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
+}
+
+eblit-src_unpack-post() {
+ if use hardened ; then
+ cd "${S}"
+ einfo "Patching to get working PIE binaries on PIE (hardened) platforms"
+ gcc-specs-pie && epatch "${FILESDIR}"/2.17/glibc-2.17-hardened-pie.patch
+ epatch "${FILESDIR}"/2.19/glibc-2.19-hardened-configure-picdefault.patch
+ epatch "${FILESDIR}"/2.18/glibc-2.18-hardened-inittls-nosysenter.patch
+
+ einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
+ cp -f "${FILESDIR}"/2.18/glibc-2.18-gentoo-stack_chk_fail.c \
+ debug/stack_chk_fail.c || die
+ cp -f "${FILESDIR}"/2.18/glibc-2.18-gentoo-chk_fail.c \
+ debug/chk_fail.c || die
+
+ if use debug ; then
+ # When using Hardened Gentoo stack handler, have smashes dump core for
+ # analysis - debug only, as core could be an information leak
+ # (paranoia).
+ sed -i \
+ -e '/^CFLAGS-backtrace.c/ iCFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+ debug/Makefile \
+ || die "Failed to modify debug/Makefile for debug stack handler"
+ sed -i \
+ -e '/^CFLAGS-backtrace.c/ iCFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+ debug/Makefile \
+ || die "Failed to modify debug/Makefile for debug fortify handler"
+ fi
+
+ # Build nscd with ssp-all
+ sed -i \
+ -e 's:-fstack-protector$:-fstack-protector-all:' \
+ nscd/Makefile \
+ || die "Failed to ensure nscd builds with ssp-all"
+ fi
+}
+
+eblit-pkg_preinst-post() {
+ if [[ ${CTARGET} == arm* ]] ; then
+ # Backwards compat support for renaming hardfp ldsos #417287
+ local oldso='/lib/ld-linux.so.3'
+ local nldso='/lib/ld-linux-armhf.so.3'
+ if [[ -e ${D}${nldso} ]] ; then
+ if scanelf -qRyi "${ROOT}$(alt_prefix)"/*bin/ | grep -s "^${oldso}" ; then
+ ewarn "Symlinking old ldso (${oldso}) to new ldso (${nldso})."
+ ewarn "Please rebuild all packages using this old ldso as compat"
+ ewarn "support will be dropped in the future."
+ ln -s "${nldso##*/}" "${D}$(alt_prefix)${oldso}"
+ fi
+ fi
+ fi
+}
diff --git a/sys-libs/glibc/glibc-2.20-r1.ebuild b/sys-libs/glibc/glibc-2.20-r1.ebuild
new file mode 100644
index 000000000000..21f2ac213b2b
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.20-r1.ebuild
@@ -0,0 +1,188 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils versionator toolchain-funcs flag-o-matic gnuconfig multilib systemd unpacker multiprocessing
+
+DESCRIPTION="GNU libc6 (also called glibc2) C library"
+HOMEPAGE="http://www.gnu.org/software/libc/libc.html"
+
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 -hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh -sparc ~x86"
+RESTRICT="strip" # strip ourself #46186
+EMULTILIB_PKG="true"
+
+# Configuration variables
+RELEASE_VER=""
+case ${PV} in
+9999*)
+ EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
+ EGIT_SOURCEDIRS="${S}"
+ inherit git-2
+ ;;
+*)
+ RELEASE_VER=${PV}
+ ;;
+esac
+GCC_BOOTSTRAP_VER="4.7.3-r1"
+PATCH_VER="3" # Gentoo patchset
+: ${NPTL_KERN_VER:="2.6.32"} # min kernel version nptl requires
+
+IUSE="debug gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+
+# Here's how the cross-compile logic breaks down ...
+# CTARGET - machine that will target the binaries
+# CHOST - machine that will host the binaries
+# CBUILD - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+# CBUILD = CHOST = CTARGET - native build/install
+# CBUILD != (CHOST = CTARGET) - cross-compile a native build
+# (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+# CBUILD != CHOST != CTARGET - cross-compile a libc for a cross-compiler
+# For install paths:
+# CHOST = CTARGET - install into /
+# CHOST != CTARGET - install into /usr/CTARGET/
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+is_crosscompile() {
+ [[ ${CHOST} != ${CTARGET} ]]
+}
+
+# Why SLOT 2.2 you ask yourself while sippin your tea ?
+# Everyone knows 2.2 > 0, duh.
+SLOT="2.2"
+
+# General: We need a new-enough binutils/gcc to match upstream baseline.
+# arch: we need to make sure our binutils/gcc supports TLS.
+DEPEND=">=app-misc/pax-utils-0.1.10
+ !<sys-apps/sandbox-1.6
+ !<sys-apps/portage-2.1.2
+ selinux? ( sys-libs/libselinux )"
+RDEPEND="!sys-kernel/ps3-sources
+ sys-apps/gentoo-functions
+ selinux? ( sys-libs/libselinux )
+ !sys-libs/nss-db"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+ DEPEND+=" !crosscompile_opts_headers-only? (
+ >=${CATEGORY}/binutils-2.24
+ >=${CATEGORY}/gcc-4.4
+ )"
+ [[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+ DEPEND+="
+ >=sys-devel/binutils-2.24
+ >=sys-devel/gcc-4.4
+ virtual/os-headers"
+ RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
+ PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+upstream_uris() {
+ echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
+}
+gentoo_uris() {
+ local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI HTTP~blueness/glibc/URI"
+ devspace=${devspace//HTTP/http://dev.gentoo.org/}
+ echo mirror://gentoo/$1 ${devspace//URI/$1}
+}
+SRC_URI=$(
+ [[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
+ [[ -n ${PATCH_VER} ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
+)
+SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
+
+# eblit-include [--skip] <function> [version]
+eblit-include() {
+ local skipable=false
+ [[ $1 == "--skip" ]] && skipable=true && shift
+ [[ $1 == pkg_* ]] && skipable=true
+
+ local e v func=$1 ver=$2
+ [[ -z ${func} ]] && die "Usage: eblit-include <function> [version]"
+ for v in ${ver:+-}${ver} -${PVR} -${PV} "" ; do
+ e="${FILESDIR}/eblits/${func}${v}.eblit"
+ if [[ -e ${e} ]] ; then
+ source "${e}"
+ return 0
+ fi
+ done
+ ${skipable} && return 0
+ die "Could not locate requested eblit '${func}' in ${FILESDIR}/eblits/"
+}
+
+# eblit-run-maybe <function>
+# run the specified function if it is defined
+eblit-run-maybe() {
+ [[ $(type -t "$@") == "function" ]] && "$@"
+}
+
+# eblit-run <function> [version]
+# aka: src_unpack() { eblit-run src_unpack ; }
+eblit-run() {
+ eblit-include --skip common "${*:2}"
+ eblit-include "$@"
+ eblit-run-maybe eblit-$1-pre
+ eblit-${PN}-$1
+ eblit-run-maybe eblit-$1-post
+}
+
+src_unpack() { eblit-run src_unpack ; }
+src_prepare() { eblit-run src_prepare ; }
+src_configure() { eblit-run src_configure ; }
+src_compile() { eblit-run src_compile ; }
+src_test() { eblit-run src_test ; }
+src_install() { eblit-run src_install ; }
+
+# FILESDIR might not be available during binpkg install
+for x in pretend setup {pre,post}inst ; do
+ e="${FILESDIR}/eblits/pkg_${x}.eblit"
+ if [[ -e ${e} ]] ; then
+ . "${e}"
+ eval "pkg_${x}() { eblit-run pkg_${x} ; }"
+ fi
+done
+
+eblit-src_unpack-pre() {
+ [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
+}
+
+eblit-src_prepare-post() {
+ cd "${S}"
+
+ if use hardened ; then
+ einfo "Patching to get working PIE binaries on PIE (hardened) platforms"
+ gcc-specs-pie && epatch "${FILESDIR}"/2.17/glibc-2.17-hardened-pie.patch
+ epatch "${FILESDIR}"/2.20/glibc-2.20-hardened-inittls-nosysenter.patch
+
+ # We don't enable these for non-hardened as the output is very terse --
+ # it only states that a crash happened. The default upstream behavior
+ # includes backtraces and symbols.
+ einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
+ cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
+ cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-chk_fail.c debug/chk_fail.c || die
+
+ if use debug ; then
+ # Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
+ sed -i \
+ -e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+ -e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+ debug/Makefile || die
+ fi
+
+ # Build various bits with ssp-all
+ sed -i \
+ -e 's:-fstack-protector$:-fstack-protector-all:' \
+ */Makefile || die
+ fi
+}
diff --git a/sys-libs/glibc/glibc-2.20-r2.ebuild b/sys-libs/glibc/glibc-2.20-r2.ebuild
new file mode 100644
index 000000000000..9225619ab638
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.20-r2.ebuild
@@ -0,0 +1,196 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils versionator toolchain-funcs flag-o-matic gnuconfig multilib systemd unpacker multiprocessing
+
+DESCRIPTION="GNU libc6 (also called glibc2) C library"
+HOMEPAGE="http://www.gnu.org/software/libc/libc.html"
+
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+KEYWORDS="alpha amd64 arm arm64 -hppa ia64 m68k ~mips ppc ppc64 s390 sh ~sparc x86"
+RESTRICT="strip" # strip ourself #46186
+EMULTILIB_PKG="true"
+
+# Configuration variables
+RELEASE_VER=""
+case ${PV} in
+9999*)
+ EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
+ EGIT_SOURCEDIRS="${S}"
+ inherit git-2
+ ;;
+*)
+ RELEASE_VER=${PV}
+ ;;
+esac
+GCC_BOOTSTRAP_VER="4.7.3-r1"
+PATCH_VER="5" # Gentoo patchset
+: ${NPTL_KERN_VER:="2.6.32"} # min kernel version nptl requires
+
+IUSE="debug gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+
+# Here's how the cross-compile logic breaks down ...
+# CTARGET - machine that will target the binaries
+# CHOST - machine that will host the binaries
+# CBUILD - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+# CBUILD = CHOST = CTARGET - native build/install
+# CBUILD != (CHOST = CTARGET) - cross-compile a native build
+# (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+# CBUILD != CHOST != CTARGET - cross-compile a libc for a cross-compiler
+# For install paths:
+# CHOST = CTARGET - install into /
+# CHOST != CTARGET - install into /usr/CTARGET/
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+is_crosscompile() {
+ [[ ${CHOST} != ${CTARGET} ]]
+}
+
+# Why SLOT 2.2 you ask yourself while sippin your tea ?
+# Everyone knows 2.2 > 0, duh.
+SLOT="2.2"
+
+# General: We need a new-enough binutils/gcc to match upstream baseline.
+# arch: we need to make sure our binutils/gcc supports TLS.
+DEPEND=">=app-misc/pax-utils-0.1.10
+ !<sys-apps/sandbox-1.6
+ !<sys-apps/portage-2.1.2
+ selinux? ( sys-libs/libselinux )"
+RDEPEND="!sys-kernel/ps3-sources
+ sys-apps/gentoo-functions
+ selinux? ( sys-libs/libselinux )
+ !sys-libs/nss-db"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+ DEPEND+=" !crosscompile_opts_headers-only? (
+ >=${CATEGORY}/binutils-2.24
+ >=${CATEGORY}/gcc-4.4
+ )"
+ [[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+ DEPEND+="
+ >=sys-devel/binutils-2.24
+ >=sys-devel/gcc-4.4
+ virtual/os-headers"
+ RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
+ PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+upstream_uris() {
+ echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
+}
+gentoo_uris() {
+ local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI HTTP~blueness/glibc/URI"
+ devspace=${devspace//HTTP/http://dev.gentoo.org/}
+ echo mirror://gentoo/$1 ${devspace//URI/$1}
+}
+SRC_URI=$(
+ [[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
+ [[ -n ${PATCH_VER} ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
+)
+SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
+
+# eblit-include [--skip] <function> [version]
+eblit-include() {
+ local skipable=false
+ [[ $1 == "--skip" ]] && skipable=true && shift
+ [[ $1 == pkg_* ]] && skipable=true
+
+ local e v func=$1 ver=$2
+ [[ -z ${func} ]] && die "Usage: eblit-include <function> [version]"
+ for v in ${ver:+-}${ver} -${PVR} -${PV} "" ; do
+ e="${FILESDIR}/eblits/${func}${v}.eblit"
+ if [[ -e ${e} ]] ; then
+ source "${e}"
+ return 0
+ fi
+ done
+ ${skipable} && return 0
+ die "Could not locate requested eblit '${func}' in ${FILESDIR}/eblits/"
+}
+
+# eblit-run-maybe <function>
+# run the specified function if it is defined
+eblit-run-maybe() {
+ [[ $(type -t "$@") == "function" ]] && "$@"
+}
+
+# eblit-run <function> [version]
+# aka: src_unpack() { eblit-run src_unpack ; }
+eblit-run() {
+ eblit-include --skip common "${*:2}"
+ eblit-include "$@"
+ eblit-run-maybe eblit-$1-pre
+ eblit-${PN}-$1
+ eblit-run-maybe eblit-$1-post
+}
+
+src_unpack() { eblit-run src_unpack ; }
+src_prepare() { eblit-run src_prepare ; }
+src_configure() { eblit-run src_configure ; }
+src_compile() { eblit-run src_compile ; }
+src_test() { eblit-run src_test ; }
+src_install() { eblit-run src_install ; }
+
+# FILESDIR might not be available during binpkg install
+for x in pretend setup {pre,post}inst ; do
+ e="${FILESDIR}/eblits/pkg_${x}.eblit"
+ if [[ -e ${e} ]] ; then
+ . "${e}"
+ eval "pkg_${x}() { eblit-run pkg_${x} ; }"
+ fi
+done
+
+eblit-src_unpack-pre() {
+ [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
+}
+
+eblit-src_prepare-post() {
+ cd "${S}"
+
+ if use hardened ; then
+ einfo "Patching to get working PIE binaries on PIE (hardened) platforms"
+ gcc-specs-pie && epatch "${FILESDIR}"/2.17/glibc-2.17-hardened-pie.patch
+ epatch "${FILESDIR}"/2.20/glibc-2.20-hardened-inittls-nosysenter.patch
+
+ # We don't enable these for non-hardened as the output is very terse --
+ # it only states that a crash happened. The default upstream behavior
+ # includes backtraces and symbols.
+ einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
+ cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
+ cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-chk_fail.c debug/chk_fail.c || die
+
+ if use debug ; then
+ # Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
+ sed -i \
+ -e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+ -e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+ debug/Makefile || die
+ fi
+
+ # Build various bits with ssp-all
+ sed -i \
+ -e 's:-fstack-protector$:-fstack-protector-all:' \
+ */Makefile || die
+ fi
+
+ case $(gcc-fullversion) in
+ 4.8.[0-3]|4.9.0)
+ eerror "You need to switch to a newer compiler; gcc-4.8.[0-3] and gcc-4.9.0 miscompile"
+ eerror "glibc. See https://bugs.gentoo.org/547420 for details."
+ die "need to switch compilers #547420"
+ ;;
+ esac
+}
diff --git a/sys-libs/glibc/glibc-2.20.ebuild b/sys-libs/glibc/glibc-2.20.ebuild
new file mode 100644
index 000000000000..546c86cc7a15
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.20.ebuild
@@ -0,0 +1,187 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils versionator toolchain-funcs flag-o-matic gnuconfig multilib systemd unpacker multiprocessing
+
+DESCRIPTION="GNU libc6 (also called glibc2) C library"
+HOMEPAGE="http://www.gnu.org/software/libc/libc.html"
+
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 -hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh -sparc ~x86"
+RESTRICT="strip" # strip ourself #46186
+EMULTILIB_PKG="true"
+
+# Configuration variables
+RELEASE_VER=""
+case ${PV} in
+9999*)
+ EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
+ EGIT_SOURCEDIRS="${S}"
+ inherit git-2
+ ;;
+*)
+ RELEASE_VER=${PV}
+ ;;
+esac
+GCC_BOOTSTRAP_VER="4.7.3-r1"
+PATCH_VER="1" # Gentoo patchset
+: ${NPTL_KERN_VER:="2.6.32"} # min kernel version nptl requires
+
+IUSE="debug gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+
+# Here's how the cross-compile logic breaks down ...
+# CTARGET - machine that will target the binaries
+# CHOST - machine that will host the binaries
+# CBUILD - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+# CBUILD = CHOST = CTARGET - native build/install
+# CBUILD != (CHOST = CTARGET) - cross-compile a native build
+# (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+# CBUILD != CHOST != CTARGET - cross-compile a libc for a cross-compiler
+# For install paths:
+# CHOST = CTARGET - install into /
+# CHOST != CTARGET - install into /usr/CTARGET/
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+is_crosscompile() {
+ [[ ${CHOST} != ${CTARGET} ]]
+}
+
+# Why SLOT 2.2 you ask yourself while sippin your tea ?
+# Everyone knows 2.2 > 0, duh.
+SLOT="2.2"
+
+# General: We need a new-enough binutils/gcc to match upstream baseline.
+# arch: we need to make sure our binutils/gcc supports TLS.
+DEPEND=">=app-misc/pax-utils-0.1.10
+ !<sys-apps/sandbox-1.6
+ !<sys-apps/portage-2.1.2
+ selinux? ( sys-libs/libselinux )"
+RDEPEND="!sys-kernel/ps3-sources
+ selinux? ( sys-libs/libselinux )
+ !sys-libs/nss-db"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+ DEPEND+=" !crosscompile_opts_headers-only? (
+ >=${CATEGORY}/binutils-2.24
+ >=${CATEGORY}/gcc-4.4
+ )"
+ [[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+ DEPEND+="
+ >=sys-devel/binutils-2.24
+ >=sys-devel/gcc-4.4
+ virtual/os-headers"
+ RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
+ PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+upstream_uris() {
+ echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
+}
+gentoo_uris() {
+ local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI"
+ devspace=${devspace//HTTP/http://dev.gentoo.org/}
+ echo mirror://gentoo/$1 ${devspace//URI/$1}
+}
+SRC_URI=$(
+ [[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
+ [[ -n ${PATCH_VER} ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
+)
+SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
+
+# eblit-include [--skip] <function> [version]
+eblit-include() {
+ local skipable=false
+ [[ $1 == "--skip" ]] && skipable=true && shift
+ [[ $1 == pkg_* ]] && skipable=true
+
+ local e v func=$1 ver=$2
+ [[ -z ${func} ]] && die "Usage: eblit-include <function> [version]"
+ for v in ${ver:+-}${ver} -${PVR} -${PV} "" ; do
+ e="${FILESDIR}/eblits/${func}${v}.eblit"
+ if [[ -e ${e} ]] ; then
+ source "${e}"
+ return 0
+ fi
+ done
+ ${skipable} && return 0
+ die "Could not locate requested eblit '${func}' in ${FILESDIR}/eblits/"
+}
+
+# eblit-run-maybe <function>
+# run the specified function if it is defined
+eblit-run-maybe() {
+ [[ $(type -t "$@") == "function" ]] && "$@"
+}
+
+# eblit-run <function> [version]
+# aka: src_unpack() { eblit-run src_unpack ; }
+eblit-run() {
+ eblit-include --skip common "${*:2}"
+ eblit-include "$@"
+ eblit-run-maybe eblit-$1-pre
+ eblit-${PN}-$1
+ eblit-run-maybe eblit-$1-post
+}
+
+src_unpack() { eblit-run src_unpack ; }
+src_prepare() { eblit-run src_prepare ; }
+src_configure() { eblit-run src_configure ; }
+src_compile() { eblit-run src_compile ; }
+src_test() { eblit-run src_test ; }
+src_install() { eblit-run src_install ; }
+
+# FILESDIR might not be available during binpkg install
+for x in pretend setup {pre,post}inst ; do
+ e="${FILESDIR}/eblits/pkg_${x}.eblit"
+ if [[ -e ${e} ]] ; then
+ . "${e}"
+ eval "pkg_${x}() { eblit-run pkg_${x} ; }"
+ fi
+done
+
+eblit-src_unpack-pre() {
+ [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
+}
+
+eblit-src_prepare-post() {
+ cd "${S}"
+
+ if use hardened ; then
+ einfo "Patching to get working PIE binaries on PIE (hardened) platforms"
+ gcc-specs-pie && epatch "${FILESDIR}"/2.17/glibc-2.17-hardened-pie.patch
+ epatch "${FILESDIR}"/2.20/glibc-2.20-hardened-inittls-nosysenter.patch
+
+ # We don't enable these for non-hardened as the output is very terse --
+ # it only states that a crash happened. The default upstream behavior
+ # includes backtraces and symbols.
+ einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
+ cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
+ cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-chk_fail.c debug/chk_fail.c || die
+
+ if use debug ; then
+ # Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
+ sed -i \
+ -e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+ -e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+ debug/Makefile || die
+ fi
+
+ # Build various bits with ssp-all
+ sed -i \
+ -e 's:-fstack-protector$:-fstack-protector-all:' \
+ */Makefile || die
+ fi
+}
diff --git a/sys-libs/glibc/glibc-2.21-r1.ebuild b/sys-libs/glibc/glibc-2.21-r1.ebuild
new file mode 100644
index 000000000000..4f5641ffaab1
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.21-r1.ebuild
@@ -0,0 +1,196 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils versionator toolchain-funcs flag-o-matic gnuconfig multilib systemd unpacker multiprocessing
+
+DESCRIPTION="GNU libc6 (also called glibc2) C library"
+HOMEPAGE="http://www.gnu.org/software/libc/libc.html"
+
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+RESTRICT="strip" # strip ourself #46186
+EMULTILIB_PKG="true"
+
+# Configuration variables
+RELEASE_VER=""
+case ${PV} in
+9999*)
+ EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
+ EGIT_SOURCEDIRS="${S}"
+ inherit git-2
+ ;;
+*)
+ RELEASE_VER=${PV}
+ ;;
+esac
+GCC_BOOTSTRAP_VER="4.7.3-r1"
+PATCH_VER="4" # Gentoo patchset
+: ${NPTL_KERN_VER:="2.6.32"} # min kernel version nptl requires
+
+IUSE="debug gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+
+# Here's how the cross-compile logic breaks down ...
+# CTARGET - machine that will target the binaries
+# CHOST - machine that will host the binaries
+# CBUILD - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+# CBUILD = CHOST = CTARGET - native build/install
+# CBUILD != (CHOST = CTARGET) - cross-compile a native build
+# (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+# CBUILD != CHOST != CTARGET - cross-compile a libc for a cross-compiler
+# For install paths:
+# CHOST = CTARGET - install into /
+# CHOST != CTARGET - install into /usr/CTARGET/
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+is_crosscompile() {
+ [[ ${CHOST} != ${CTARGET} ]]
+}
+
+# Why SLOT 2.2 you ask yourself while sippin your tea ?
+# Everyone knows 2.2 > 0, duh.
+SLOT="2.2"
+
+# General: We need a new-enough binutils/gcc to match upstream baseline.
+# arch: we need to make sure our binutils/gcc supports TLS.
+DEPEND=">=app-misc/pax-utils-0.1.10
+ !<sys-apps/sandbox-1.6
+ !<sys-apps/portage-2.1.2
+ selinux? ( sys-libs/libselinux )"
+RDEPEND="!sys-kernel/ps3-sources
+ sys-apps/gentoo-functions
+ selinux? ( sys-libs/libselinux )
+ !sys-libs/nss-db"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+ DEPEND+=" !crosscompile_opts_headers-only? (
+ >=${CATEGORY}/binutils-2.24
+ >=${CATEGORY}/gcc-4.6
+ )"
+ [[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+ DEPEND+="
+ >=sys-devel/binutils-2.24
+ >=sys-devel/gcc-4.6
+ virtual/os-headers"
+ RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
+ PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+upstream_uris() {
+ echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
+}
+gentoo_uris() {
+ local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI"
+ devspace=${devspace//HTTP/http://dev.gentoo.org/}
+ echo mirror://gentoo/$1 ${devspace//URI/$1}
+}
+SRC_URI=$(
+ [[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
+ [[ -n ${PATCH_VER} ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
+)
+SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
+
+# eblit-include [--skip] <function> [version]
+eblit-include() {
+ local skipable=false
+ [[ $1 == "--skip" ]] && skipable=true && shift
+ [[ $1 == pkg_* ]] && skipable=true
+
+ local e v func=$1 ver=$2
+ [[ -z ${func} ]] && die "Usage: eblit-include <function> [version]"
+ for v in ${ver:+-}${ver} -${PVR} -${PV} "" ; do
+ e="${FILESDIR}/eblits/${func}${v}.eblit"
+ if [[ -e ${e} ]] ; then
+ source "${e}"
+ return 0
+ fi
+ done
+ ${skipable} && return 0
+ die "Could not locate requested eblit '${func}' in ${FILESDIR}/eblits/"
+}
+
+# eblit-run-maybe <function>
+# run the specified function if it is defined
+eblit-run-maybe() {
+ [[ $(type -t "$@") == "function" ]] && "$@"
+}
+
+# eblit-run <function> [version]
+# aka: src_unpack() { eblit-run src_unpack ; }
+eblit-run() {
+ eblit-include --skip common "${*:2}"
+ eblit-include "$@"
+ eblit-run-maybe eblit-$1-pre
+ eblit-${PN}-$1
+ eblit-run-maybe eblit-$1-post
+}
+
+src_unpack() { eblit-run src_unpack ; }
+src_prepare() { eblit-run src_prepare ; }
+src_configure() { eblit-run src_configure ; }
+src_compile() { eblit-run src_compile ; }
+src_test() { eblit-run src_test ; }
+src_install() { eblit-run src_install ; }
+
+# FILESDIR might not be available during binpkg install
+for x in pretend setup {pre,post}inst ; do
+ e="${FILESDIR}/eblits/pkg_${x}.eblit"
+ if [[ -e ${e} ]] ; then
+ . "${e}"
+ eval "pkg_${x}() { eblit-run pkg_${x} ; }"
+ fi
+done
+
+eblit-src_unpack-pre() {
+ [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
+}
+
+eblit-src_prepare-post() {
+ cd "${S}"
+
+ if use hardened ; then
+ einfo "Patching to get working PIE binaries on PIE (hardened) platforms"
+ gcc-specs-pie && epatch "${FILESDIR}"/2.17/glibc-2.17-hardened-pie.patch
+ epatch "${FILESDIR}"/2.20/glibc-2.20-hardened-inittls-nosysenter.patch
+
+ # We don't enable these for non-hardened as the output is very terse --
+ # it only states that a crash happened. The default upstream behavior
+ # includes backtraces and symbols.
+ einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
+ cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
+ cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-chk_fail.c debug/chk_fail.c || die
+
+ if use debug ; then
+ # Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
+ sed -i \
+ -e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+ -e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+ debug/Makefile || die
+ fi
+
+ # Build various bits with ssp-all
+ sed -i \
+ -e 's:-fstack-protector$:-fstack-protector-all:' \
+ */Makefile || die
+ fi
+
+ case $(gcc-fullversion) in
+ 4.8.[0-3]|4.9.0)
+ eerror "You need to switch to a newer compiler; gcc-4.8.[0-3] and gcc-4.9.0 miscompile"
+ eerror "glibc. See https://bugs.gentoo.org/547420 for details."
+ die "need to switch compilers #547420"
+ ;;
+ esac
+}
diff --git a/sys-libs/glibc/glibc-2.22.ebuild b/sys-libs/glibc/glibc-2.22.ebuild
new file mode 100644
index 000000000000..506493e4d075
--- /dev/null
+++ b/sys-libs/glibc/glibc-2.22.ebuild
@@ -0,0 +1,196 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils versionator toolchain-funcs flag-o-matic gnuconfig multilib systemd unpacker multiprocessing
+
+DESCRIPTION="GNU libc6 (also called glibc2) C library"
+HOMEPAGE="http://www.gnu.org/software/libc/libc.html"
+
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+RESTRICT="strip" # strip ourself #46186
+EMULTILIB_PKG="true"
+
+# Configuration variables
+RELEASE_VER=""
+case ${PV} in
+9999*)
+ EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
+ EGIT_SOURCEDIRS="${S}"
+ inherit git-2
+ ;;
+*)
+ RELEASE_VER=${PV}
+ ;;
+esac
+GCC_BOOTSTRAP_VER="4.7.3-r1"
+PATCH_VER="2" # Gentoo patchset
+: ${NPTL_KERN_VER:="2.6.32"} # min kernel version nptl requires
+
+IUSE="debug gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+
+# Here's how the cross-compile logic breaks down ...
+# CTARGET - machine that will target the binaries
+# CHOST - machine that will host the binaries
+# CBUILD - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+# CBUILD = CHOST = CTARGET - native build/install
+# CBUILD != (CHOST = CTARGET) - cross-compile a native build
+# (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+# CBUILD != CHOST != CTARGET - cross-compile a libc for a cross-compiler
+# For install paths:
+# CHOST = CTARGET - install into /
+# CHOST != CTARGET - install into /usr/CTARGET/
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+is_crosscompile() {
+ [[ ${CHOST} != ${CTARGET} ]]
+}
+
+# Why SLOT 2.2 you ask yourself while sippin your tea ?
+# Everyone knows 2.2 > 0, duh.
+SLOT="2.2"
+
+# General: We need a new-enough binutils/gcc to match upstream baseline.
+# arch: we need to make sure our binutils/gcc supports TLS.
+DEPEND=">=app-misc/pax-utils-0.1.10
+ !<sys-apps/sandbox-1.6
+ !<sys-apps/portage-2.1.2
+ selinux? ( sys-libs/libselinux )"
+RDEPEND="!sys-kernel/ps3-sources
+ sys-apps/gentoo-functions
+ selinux? ( sys-libs/libselinux )
+ !sys-libs/nss-db"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+ DEPEND+=" !crosscompile_opts_headers-only? (
+ >=${CATEGORY}/binutils-2.24
+ >=${CATEGORY}/gcc-4.6
+ )"
+ [[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+ DEPEND+="
+ >=sys-devel/binutils-2.24
+ >=sys-devel/gcc-4.6
+ virtual/os-headers"
+ RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
+ PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+upstream_uris() {
+ echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
+}
+gentoo_uris() {
+ local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI"
+ devspace=${devspace//HTTP/http://dev.gentoo.org/}
+ echo mirror://gentoo/$1 ${devspace//URI/$1}
+}
+SRC_URI=$(
+ [[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
+ [[ -n ${PATCH_VER} ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
+)
+SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
+
+# eblit-include [--skip] <function> [version]
+eblit-include() {
+ local skipable=false
+ [[ $1 == "--skip" ]] && skipable=true && shift
+ [[ $1 == pkg_* ]] && skipable=true
+
+ local e v func=$1 ver=$2
+ [[ -z ${func} ]] && die "Usage: eblit-include <function> [version]"
+ for v in ${ver:+-}${ver} -${PVR} -${PV} "" ; do
+ e="${FILESDIR}/eblits/${func}${v}.eblit"
+ if [[ -e ${e} ]] ; then
+ source "${e}"
+ return 0
+ fi
+ done
+ ${skipable} && return 0
+ die "Could not locate requested eblit '${func}' in ${FILESDIR}/eblits/"
+}
+
+# eblit-run-maybe <function>
+# run the specified function if it is defined
+eblit-run-maybe() {
+ [[ $(type -t "$@") == "function" ]] && "$@"
+}
+
+# eblit-run <function> [version]
+# aka: src_unpack() { eblit-run src_unpack ; }
+eblit-run() {
+ eblit-include --skip common "${*:2}"
+ eblit-include "$@"
+ eblit-run-maybe eblit-$1-pre
+ eblit-${PN}-$1
+ eblit-run-maybe eblit-$1-post
+}
+
+src_unpack() { eblit-run src_unpack ; }
+src_prepare() { eblit-run src_prepare ; }
+src_configure() { eblit-run src_configure ; }
+src_compile() { eblit-run src_compile ; }
+src_test() { eblit-run src_test ; }
+src_install() { eblit-run src_install ; }
+
+# FILESDIR might not be available during binpkg install
+for x in pretend setup {pre,post}inst ; do
+ e="${FILESDIR}/eblits/pkg_${x}.eblit"
+ if [[ -e ${e} ]] ; then
+ . "${e}"
+ eval "pkg_${x}() { eblit-run pkg_${x} ; }"
+ fi
+done
+
+eblit-src_unpack-pre() {
+ [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
+}
+
+eblit-src_prepare-post() {
+ cd "${S}"
+
+ if use hardened ; then
+ einfo "Patching to get working PIE binaries on PIE (hardened) platforms"
+ gcc-specs-pie && epatch "${FILESDIR}"/2.17/glibc-2.17-hardened-pie.patch
+ epatch "${FILESDIR}"/2.20/glibc-2.20-hardened-inittls-nosysenter.patch
+
+ # We don't enable these for non-hardened as the output is very terse --
+ # it only states that a crash happened. The default upstream behavior
+ # includes backtraces and symbols.
+ einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
+ cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
+ cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-chk_fail.c debug/chk_fail.c || die
+
+ if use debug ; then
+ # Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
+ sed -i \
+ -e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+ -e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+ debug/Makefile || die
+ fi
+
+ # Build various bits with ssp-all
+ sed -i \
+ -e 's:-fstack-protector$:-fstack-protector-all:' \
+ */Makefile || die
+ fi
+
+ case $(gcc-fullversion) in
+ 4.8.[0-3]|4.9.0)
+ eerror "You need to switch to a newer compiler; gcc-4.8.[0-3] and gcc-4.9.0 miscompile"
+ eerror "glibc. See https://bugs.gentoo.org/547420 for details."
+ die "need to switch compilers #547420"
+ ;;
+ esac
+}
diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
new file mode 100644
index 000000000000..d0609ff11afe
--- /dev/null
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -0,0 +1,188 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils versionator toolchain-funcs flag-o-matic gnuconfig multilib systemd unpacker multiprocessing
+
+DESCRIPTION="GNU libc6 (also called glibc2) C library"
+HOMEPAGE="http://www.gnu.org/software/libc/libc.html"
+
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
+#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+RESTRICT="strip" # strip ourself #46186
+EMULTILIB_PKG="true"
+
+# Configuration variables
+RELEASE_VER=""
+case ${PV} in
+9999*)
+ EGIT_REPO_URIS="git://sourceware.org/git/glibc.git"
+ EGIT_SOURCEDIRS="${S}"
+ inherit git-2
+ ;;
+*)
+ RELEASE_VER=${PV}
+ ;;
+esac
+GCC_BOOTSTRAP_VER="4.7.3-r1"
+PATCH_VER="" # Gentoo patchset
+: ${NPTL_KERN_VER:="2.6.32"} # min kernel version nptl requires
+
+IUSE="debug gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only"
+
+# Here's how the cross-compile logic breaks down ...
+# CTARGET - machine that will target the binaries
+# CHOST - machine that will host the binaries
+# CBUILD - machine that will build the binaries
+# If CTARGET != CHOST, it means you want a libc for cross-compiling.
+# If CHOST != CBUILD, it means you want to cross-compile the libc.
+# CBUILD = CHOST = CTARGET - native build/install
+# CBUILD != (CHOST = CTARGET) - cross-compile a native build
+# (CBUILD = CHOST) != CTARGET - libc for cross-compiler
+# CBUILD != CHOST != CTARGET - cross-compile a libc for a cross-compiler
+# For install paths:
+# CHOST = CTARGET - install into /
+# CHOST != CTARGET - install into /usr/CTARGET/
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+is_crosscompile() {
+ [[ ${CHOST} != ${CTARGET} ]]
+}
+
+# Why SLOT 2.2 you ask yourself while sippin your tea ?
+# Everyone knows 2.2 > 0, duh.
+SLOT="2.2"
+
+# General: We need a new-enough binutils/gcc to match upstream baseline.
+# arch: we need to make sure our binutils/gcc supports TLS.
+DEPEND=">=app-misc/pax-utils-0.1.10
+ !<sys-apps/sandbox-1.6
+ !<sys-apps/portage-2.1.2
+ selinux? ( sys-libs/libselinux )"
+RDEPEND="!sys-kernel/ps3-sources
+ sys-apps/gentoo-functions
+ selinux? ( sys-libs/libselinux )
+ !sys-libs/nss-db"
+
+if [[ ${CATEGORY} == cross-* ]] ; then
+ DEPEND+=" !crosscompile_opts_headers-only? (
+ >=${CATEGORY}/binutils-2.24
+ >=${CATEGORY}/gcc-4.6
+ )"
+ [[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
+else
+ DEPEND+="
+ >=sys-devel/binutils-2.24
+ >=sys-devel/gcc-4.6
+ virtual/os-headers"
+ RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
+ PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
+fi
+
+upstream_uris() {
+ echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
+}
+gentoo_uris() {
+ local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI"
+ devspace=${devspace//HTTP/http://dev.gentoo.org/}
+ echo mirror://gentoo/$1 ${devspace//URI/$1}
+}
+SRC_URI=$(
+ [[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
+ [[ -n ${PATCH_VER} ]] && gentoo_uris ${P}-patches-${PATCH_VER}.tar.bz2
+)
+SRC_URI+=" ${GCC_BOOTSTRAP_VER:+multilib? ( $(gentoo_uris gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2) )}"
+
+# eblit-include [--skip] <function> [version]
+eblit-include() {
+ local skipable=false
+ [[ $1 == "--skip" ]] && skipable=true && shift
+ [[ $1 == pkg_* ]] && skipable=true
+
+ local e v func=$1 ver=$2
+ [[ -z ${func} ]] && die "Usage: eblit-include <function> [version]"
+ for v in ${ver:+-}${ver} -${PVR} -${PV} "" ; do
+ e="${FILESDIR}/eblits/${func}${v}.eblit"
+ if [[ -e ${e} ]] ; then
+ source "${e}"
+ return 0
+ fi
+ done
+ ${skipable} && return 0
+ die "Could not locate requested eblit '${func}' in ${FILESDIR}/eblits/"
+}
+
+# eblit-run-maybe <function>
+# run the specified function if it is defined
+eblit-run-maybe() {
+ [[ $(type -t "$@") == "function" ]] && "$@"
+}
+
+# eblit-run <function> [version]
+# aka: src_unpack() { eblit-run src_unpack ; }
+eblit-run() {
+ eblit-include --skip common "${*:2}"
+ eblit-include "$@"
+ eblit-run-maybe eblit-$1-pre
+ eblit-${PN}-$1
+ eblit-run-maybe eblit-$1-post
+}
+
+src_unpack() { eblit-run src_unpack ; }
+src_prepare() { eblit-run src_prepare ; }
+src_configure() { eblit-run src_configure ; }
+src_compile() { eblit-run src_compile ; }
+src_test() { eblit-run src_test ; }
+src_install() { eblit-run src_install ; }
+
+# FILESDIR might not be available during binpkg install
+for x in pretend setup {pre,post}inst ; do
+ e="${FILESDIR}/eblits/pkg_${x}.eblit"
+ if [[ -e ${e} ]] ; then
+ . "${e}"
+ eval "pkg_${x}() { eblit-run pkg_${x} ; }"
+ fi
+done
+
+eblit-src_unpack-pre() {
+ [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
+}
+
+eblit-src_prepare-post() {
+ cd "${S}"
+
+ if use hardened ; then
+ einfo "Patching to get working PIE binaries on PIE (hardened) platforms"
+ gcc-specs-pie && epatch "${FILESDIR}"/2.17/glibc-2.17-hardened-pie.patch
+ epatch "${FILESDIR}"/2.20/glibc-2.20-hardened-inittls-nosysenter.patch
+
+ # We don't enable these for non-hardened as the output is very terse --
+ # it only states that a crash happened. The default upstream behavior
+ # includes backtraces and symbols.
+ einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
+ cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
+ cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-chk_fail.c debug/chk_fail.c || die
+
+ if use debug ; then
+ # Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
+ sed -i \
+ -e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+ -e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
+ debug/Makefile || die
+ fi
+
+ # Build various bits with ssp-all
+ sed -i \
+ -e 's:-fstack-protector$:-fstack-protector-all:' \
+ */Makefile || die
+ fi
+}
diff --git a/sys-libs/glibc/metadata.xml b/sys-libs/glibc/metadata.xml
new file mode 100644
index 000000000000..a113d4369b6c
--- /dev/null
+++ b/sys-libs/glibc/metadata.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>toolchain</herd>
+<use>
+ <flag name='debug'>When USE=hardened, allow fortify/stack violations to dump core (SIGABRT) and not kill self (SIGKILL)</flag>
+ <flag name='gd'>build memusage and memusagestat tools</flag>
+ <flag name='nscd'>Build, and enable support for, the Name Service Cache Daemon</flag>
+ <flag name='suid'>Make internal pt_chown helper setuid -- not needed if using Linux and have /dev/pts mounted with gid=5</flag>
+ <flag name='systemtap'>enable systemtap static probe points</flag>
+</use>
+<upstream>
+ <remote-id type="cpe">cpe:/a:gnu:glibc</remote-id>
+</upstream>
+</pkgmetadata>
diff --git a/sys-libs/gpm/Manifest b/sys-libs/gpm/Manifest
new file mode 100644
index 000000000000..5a1f85499afa
--- /dev/null
+++ b/sys-libs/gpm/Manifest
@@ -0,0 +1,2 @@
+DIST gpm-1.20.6.tar.lzma 1280871 SHA256 27abb8a9142d3f7c31aeade2f2f1ed4b76bc760e181f552c504a7a9be00a868f SHA512 6f12d49cb690506ed116251376f0a2c946d86d323e93e11b9c71e7c40212fcc25b9ed364cd4dca3e5f0666fc7d9c38f1c3cdf6e80924cc68aef8623b39c0e623 WHIRLPOOL 05bee4c9156bbde78ea6ee06d7c4afba39899d2877a90a72e60bdab8c921fca9041cbebe5fa0afcc055a1cec2b0674392bcb9b3f1712103f236172e54e15b3b9
+DIST gpm-1.20.7.tar.lzma 789691 SHA256 a955053b36556ffa7c628ce18fd6de7d625966573fa412fb08869533d8f7385c SHA512 a502741e2f457b47e41c6d155b1f7ef7c95384fd394503f82ddacf80cde9cdc286c906c77be12b6af8565ef1c3ab24d226379c1dcebcfcd15d64bcf3e94b63b9 WHIRLPOOL d3d142c3aa385e2ef4b16c96e0f94c04b3666376d893c516d439737c2f3016a12fff7884a8f18b5e6b58e4ba21d82379204b18621a2f338d8ab6d478e4e1ec1a
diff --git a/sys-libs/gpm/files/0001-daemon-use-sys-ioctl.h-for-ioctl.patch b/sys-libs/gpm/files/0001-daemon-use-sys-ioctl.h-for-ioctl.patch
new file mode 100644
index 000000000000..b6c7809c0eb5
--- /dev/null
+++ b/sys-libs/gpm/files/0001-daemon-use-sys-ioctl.h-for-ioctl.patch
@@ -0,0 +1,31 @@
+From b184152761d8a4dbf73adcffaddac85709949c2f Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Sun, 15 Feb 2009 16:16:51 -0500
+Subject: [PATCH] daemon: use sys/ioctl.h for ioctl()
+
+Including stropts.h for the ioctl() prototype is weird and breaks some
+systems that do not implement stropts.h. Use sys/ioctl.h like normal.
+
+URL: http://bugs.gentoo.org/222099
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+Reported-by: Sergey Dryabzhinsky <sergey.dryabzhinsky@gmail.com>
+---
+ src/daemon/open_console.c | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/src/daemon/open_console.c b/src/daemon/open_console.c
+index 27b62e2..98297c9 100644
+--- a/src/daemon/open_console.c
++++ b/src/daemon/open_console.c
+@@ -21,7 +21,7 @@
+
+ #include <fcntl.h> /* open and co. */
+ #include <sys/stat.h> /* stat() */
+-#include <stropts.h> /* ioctl */
++#include <sys/ioctl.h> /* ioctl */
+
+ /* Linux specific (to be outsourced in gpm2 */
+ #include <linux/serial.h> /* for serial console check */
+--
+1.6.1.3
+
diff --git a/sys-libs/gpm/files/0001-fixup-make-warnings.patch b/sys-libs/gpm/files/0001-fixup-make-warnings.patch
new file mode 100644
index 000000000000..c55d2f826d01
--- /dev/null
+++ b/sys-libs/gpm/files/0001-fixup-make-warnings.patch
@@ -0,0 +1,35 @@
+From 1bee81778e7355e6b902986b6e0fc5750546444a Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Mon, 16 Feb 2009 15:43:40 -0500
+Subject: [PATCH] fixup make warnings
+
+Split the toplevel dep target to use normal make dependencies and use the
+$(MAKE) var rather than hardcoding `make`.
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ Makefile.in | 8 +++++---
+ 1 files changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index 90b92d0..89cbb5e 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -26,9 +26,11 @@ SUBDIRS = src doc contrib
+
+ all: do-all
+
+-dep:
+- touch src/$(DEPFILE) # to prevent unecessary warnings
+- make -C src dep
++src/$(DEPFILE):
++ touch $@ # to prevent unecessary warnings
++
++dep: src/$(DEPFILE)
++ $(MAKE) -C src dep
+
+ check: all
+
+--
+1.7.3.1
+
diff --git a/sys-libs/gpm/files/gpm-1.20.5-abi.patch b/sys-libs/gpm/files/gpm-1.20.5-abi.patch
new file mode 100644
index 000000000000..28980151e7a3
--- /dev/null
+++ b/sys-libs/gpm/files/gpm-1.20.5-abi.patch
@@ -0,0 +1,13 @@
+the SONAME upstream was bumped to try and sort out the 1.19.x/1.20.x mess, but
+since we've always had 1.20.x in our tree, we dont care about that breakage.
+
+http://lists.linux.it/pipermail/gpm/2008-June/001026.html
+http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=473496
+
+--- gpm/configure
++++ gpm/configure
+@@ -1736,2 +1736,2 @@
+-abi_lev="2"
+-abi_age="1"
++abi_lev="1"
++abi_age="20"
diff --git a/sys-libs/gpm/files/gpm-1.20.6-disablestatic.patch b/sys-libs/gpm/files/gpm-1.20.6-disablestatic.patch
new file mode 100644
index 000000000000..cb51a71e6e91
--- /dev/null
+++ b/sys-libs/gpm/files/gpm-1.20.6-disablestatic.patch
@@ -0,0 +1,66 @@
+From b28e69f92f0b0a690e01a7a9b9bc08ffa9e9bc5e Mon Sep 17 00:00:00 2001
+From: Sean McGovern <gseanmcg@gmail.com>
+Date: Mon, 27 Aug 2012 01:00:44 -0400
+Subject: [PATCH] configure: don't build static libgpm by default
+
+---
+ configure.ac | 11 +++++++++++
+ src/Makefile.in | 6 ++++--
+ 2 files changed, 15 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 7245826..899b92d 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -79,6 +79,16 @@ AC_CHECK_HEADERS(sys/sysmacros.h linux/major.h linux/tty.h)
+ # Required headers
+ AC_CHECK_HEADERS(sys/socket.h,,[AC_MSG_ERROR([Required header file missing])])
+
++AC_ARG_ENABLE([static],
++[ --enable-static build static libraries @<:@default=no@:>@])
++
++LIBGPM_A=
++
++AS_IF([test "x$enable_static" = "xyes"], [
++ LIBGPM_A=lib/libgpm.a
++])
++
++
+ AC_ARG_WITH(curses,
+ [ --without-curses disable curses support even if curses found])
+
+@@ -138,6 +148,7 @@ AC_SUBST(ELISP)
+ AC_SUBST(SHLIB)
+ AC_SUBST(PICFLAGS)
+ AC_SUBST(SOLDFLAGS)
++AC_SUBST(LIBGPM_A)
+ AC_SUBST(CURSES_OBJS)
+ AC_SUBST(SHARED_LIBS)
+ AC_SUBST(lispdir)
+diff --git a/src/Makefile.in b/src/Makefile.in
+index da35a5d..d3b1dcd 100644
+--- a/src/Makefile.in
++++ b/src/Makefile.in
+@@ -79,7 +79,7 @@ prog/%: prog/%.o
+ # | $(SED) '\''s/\($*\)\.o\([ :]*\)/\1.o \1.lo\2/g'\'' > $(DEPDIR)/$@'
+
+ # Do it all!
+-all: gpm lib/libgpm.so.@abi_lev@ lib/libgpm.a $(PROG)
++all: gpm lib/libgpm.so.@abi_lev@ @LIBGPM_A@ $(PROG)
+
+ gpm: $(GOBJ)
+ $(CC) @LDFLAGS@ $(LDFLAGS) -o $@ $(GOBJ) @LIBS@ $(LIBS) -lm
+@@ -105,7 +105,9 @@ installdirs:
+
+ install: check
+ $(INSTALL_PROGRAM) gpm $(sbindir)/gpm
+- $(INSTALL_DATA) -m 644 lib/libgpm.a $(libdir)/libgpm.a
++ if [ -f lib/libgpm.a ] ; then \
++ $(INSTALL_DATA) -m 644 lib/libgpm.a $(libdir)/libgpm.a ; \
++ fi
+ $(INSTALL_DATA) -m 644 $(srcdir)/headers/gpm.h $(includedir)/gpm.h
+ # POSIX requires the range of a for loop be nonempty and Bash
+ # 2.x goes along; unfortunately that means an additional
+--
+1.7.8.6
+
diff --git a/sys-libs/gpm/files/gpm.conf.d b/sys-libs/gpm/files/gpm.conf.d
new file mode 100644
index 000000000000..f21c25755b4a
--- /dev/null
+++ b/sys-libs/gpm/files/gpm.conf.d
@@ -0,0 +1,23 @@
+# /etc/init.d/gpm
+
+# Please uncomment the type of mouse you have and the appropriate MOUSEDEV entry
+
+MOUSE=ps2
+#MOUSE=imps2
+#MOUSEDEV=/dev/psaux
+MOUSEDEV=/dev/input/mice
+
+# Extra settings
+
+#RESPONSIVENESS=
+#REPEAT_TYPE=raw
+
+# Please uncomment this line if you want gpm to understand charsets used
+# in URLs and names with ~ or : in them, etc. This is a good idea to turn on!
+
+#APPEND="-l \"a-zA-Z0-9_.:~/\300-\326\330-\366\370-\377\""
+
+# Various other options, see gpm(8) manpage for more.
+
+#APPEND="-g 1 -A60"
+#APPEND="-l \"a-zA-Z0-9_.:~/\300-\326\330-\366\370-\377\" -g 1 -A60"
diff --git a/sys-libs/gpm/files/gpm.rc6 b/sys-libs/gpm/files/gpm.rc6
new file mode 100644
index 000000000000..7a3328cb62ce
--- /dev/null
+++ b/sys-libs/gpm/files/gpm.rc6
@@ -0,0 +1,38 @@
+#!/sbin/runscript
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+#NB: Config is in /etc/conf.d/gpm
+
+depend() {
+ need localmount
+ use hotplug logger
+}
+
+checkconfig() {
+ if [ -z "$MOUSEDEV" ] || [ -z "$MOUSE" ] ; then
+ eerror "You need to setup MOUSEDEV and MOUSE in /etc/conf.d/gpm first"
+ return 1
+ fi
+}
+
+start() {
+ checkconfig || return 1
+
+ local params=""
+ [ -n "$RESPONSIVENESS" ] && params="$params -r $RESPONSIVENESS"
+ [ -n "$REPEAT_TYPE" ] && params="$params -R$REPEAT_TYPE"
+ [ -n "$APPEND" ] && params="$params $APPEND "
+
+ ebegin "Starting gpm"
+ start-stop-daemon --start --quiet --exec /usr/sbin/gpm \
+ -- -m ${MOUSEDEV} -t ${MOUSE} ${params}
+ eend ${?}
+}
+
+stop() {
+ ebegin "Stopping gpm"
+ start-stop-daemon --stop --quiet --pidfile /var/run/gpm.pid
+ eend ${?}
+}
diff --git a/sys-libs/gpm/files/gpm.rc6-2 b/sys-libs/gpm/files/gpm.rc6-2
new file mode 100644
index 000000000000..7f7352784c36
--- /dev/null
+++ b/sys-libs/gpm/files/gpm.rc6-2
@@ -0,0 +1,29 @@
+#!/sbin/runscript
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+#NB: Config is in /etc/conf.d/gpm
+
+command=/usr/sbin/gpm
+command_args="
+ -m ${MOUSEDEV}
+ -t ${MOUSE}
+ ${RESPONSIVENESS:+ -r ${RESPONSIVENESS}}
+ ${REPEAT_TYPE:+ -R${REPEAT_TYPE}}
+ ${APPEND}
+"
+
+pidfile=/var/run/gpm.pid
+
+depend() {
+ need localmount
+ use hotplug logger
+}
+
+start_pre() {
+ if [ -z "${MOUSEDEV}" ] || [ -z "${MOUSE}" ] ; then
+ eerror "You need to setup MOUSEDEV and MOUSE in /etc/conf.d/gpm first"
+ return 1
+ fi
+}
diff --git a/sys-libs/gpm/files/gpm.service b/sys-libs/gpm/files/gpm.service
new file mode 100644
index 000000000000..966ad80060fe
--- /dev/null
+++ b/sys-libs/gpm/files/gpm.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Console Mouse manager
+After=syslog.target
+
+[Service]
+ExecStart=/usr/sbin/gpm -m /dev/input/mice -t exps2
+StandardOutput=syslog
+Type=forking
+PIDFile=/var/run/gpm.pid
+
+[Install]
+WantedBy=multi-user.target
diff --git a/sys-libs/gpm/gpm-1.20.6-r1.ebuild b/sys-libs/gpm/gpm-1.20.6-r1.ebuild
new file mode 100644
index 000000000000..ddebd1dc338f
--- /dev/null
+++ b/sys-libs/gpm/gpm-1.20.6-r1.ebuild
@@ -0,0 +1,71 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# emacs support disabled due to #99533 #335900
+
+EAPI=4
+
+inherit eutils toolchain-funcs autotools
+
+DESCRIPTION="Console-based mouse driver"
+HOMEPAGE="http://www.nico.schottelius.org/software/gpm/"
+SRC_URI="http://www.nico.schottelius.org/software/${PN}/archives/${P}.tar.lzma"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+IUSE="selinux static-libs"
+
+CDPEND="sys-libs/ncurses"
+DEPEND="${CDEPEND}
+ app-arch/xz-utils
+ virtual/yacc"
+RDEPEND="${CDEPEND}
+ selinux? ( sec-policy/selinux-gpm )"
+
+src_prepare() {
+ epatch "${FILESDIR}"/0001-daemon-use-sys-ioctl.h-for-ioctl.patch #222099
+ epatch "${FILESDIR}"/0001-fixup-make-warnings.patch #206291
+ epatch "${FILESDIR}"/${P}-disablestatic.patch #378283
+
+ # fix ABI values
+ sed -i \
+ -e 's/^abi_lev=.*$/abi_lev="1"/' \
+ -e 's/^abi_age=.*$/abi_age="20"/' \
+ configure.ac || die
+
+ # workaround broken release
+ find -name '*.o' -delete
+
+ eautoreconf
+}
+
+src_configure() {
+ econf \
+ --sysconfdir=/etc/gpm \
+ $(use_enable static-libs static) \
+ emacs=/bin/false
+}
+
+src_compile() {
+ # make sure nothing compiled is left
+ emake clean
+ emake EMACS=:
+}
+
+src_install() {
+ emake install DESTDIR="${D}" EMACS=: ELISP=""
+
+ dosym libgpm.so.1 /usr/$(get_libdir)/libgpm.so
+ gen_usr_ldscript -a gpm
+
+ insinto /etc/gpm
+ doins conf/gpm-*.conf
+
+ dodoc BUGS Changes README TODO
+ dodoc doc/Announce doc/FAQ doc/README*
+
+ newinitd "${FILESDIR}"/gpm.rc6-2 gpm
+ newconfd "${FILESDIR}"/gpm.conf.d gpm
+}
diff --git a/sys-libs/gpm/gpm-1.20.6.ebuild b/sys-libs/gpm/gpm-1.20.6.ebuild
new file mode 100644
index 000000000000..3a923a97dd5d
--- /dev/null
+++ b/sys-libs/gpm/gpm-1.20.6.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# emacs support disabled due to #99533 #335900
+
+EAPI="2"
+
+inherit eutils toolchain-funcs
+
+DESCRIPTION="Console-based mouse driver"
+HOMEPAGE="http://www.nico.schottelius.org/software/gpm/"
+SRC_URI="http://www.nico.schottelius.org/software/${PN}/archives/${P}.tar.lzma"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
+IUSE="selinux"
+
+DEPEND="sys-libs/ncurses
+ app-arch/xz-utils
+ virtual/yacc"
+RDEPEND="selinux? ( sec-policy/selinux-gpm )"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-1.20.5-abi.patch
+ epatch "${FILESDIR}"/0001-daemon-use-sys-ioctl.h-for-ioctl.patch #222099
+ epatch "${FILESDIR}"/0001-fixup-make-warnings.patch #206291
+
+ # workaround broken release
+ find -name '*.o' -delete
+}
+
+src_configure() {
+ econf \
+ --sysconfdir=/etc/gpm \
+ emacs=/bin/false
+}
+
+src_compile() {
+ # make sure nothing compiled is left
+ emake clean || die
+ emake EMACS=: || die
+}
+
+src_install() {
+ emake install DESTDIR="${D}" EMACS=: ELISP="" || die
+
+ dosym libgpm.so.1 /usr/$(get_libdir)/libgpm.so
+ gen_usr_ldscript -a gpm
+
+ insinto /etc/gpm
+ doins conf/gpm-*.conf
+
+ dodoc BUGS Changes README TODO
+ dodoc doc/Announce doc/FAQ doc/README*
+
+ newinitd "${FILESDIR}"/gpm.rc6 gpm
+ newconfd "${FILESDIR}"/gpm.conf.d gpm
+}
diff --git a/sys-libs/gpm/gpm-1.20.7-r1.ebuild b/sys-libs/gpm/gpm-1.20.7-r1.ebuild
new file mode 100644
index 000000000000..c2024fd74700
--- /dev/null
+++ b/sys-libs/gpm/gpm-1.20.7-r1.ebuild
@@ -0,0 +1,65 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# emacs support disabled due to #99533 #335900
+
+EAPI="4"
+
+inherit eutils systemd toolchain-funcs autotools
+
+DESCRIPTION="Console-based mouse driver"
+HOMEPAGE="http://www.nico.schottelius.org/software/gpm/"
+SRC_URI="http://www.nico.schottelius.org/software/${PN}/archives/${P}.tar.lzma"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
+IUSE="selinux static-libs"
+
+RDEPEND="sys-libs/ncurses
+ selinux? ( sec-policy/selinux-gpm )"
+DEPEND="sys-libs/ncurses
+ app-arch/xz-utils
+ virtual/yacc"
+
+src_prepare() {
+ # fix ABI values
+ sed -i \
+ -e '/^abi_lev=/s:=.*:=1:' \
+ -e '/^abi_age=/s:=.*:=20:' \
+ configure.ac.footer || die
+ sed -i -e '/ACLOCAL/,$d' autogen.sh || die
+ ./autogen.sh
+ eautoreconf
+}
+
+src_configure() {
+ econf \
+ --sysconfdir=/etc/gpm \
+ $(use_enable static-libs static) \
+ emacs=/bin/false
+}
+
+src_compile() {
+ # make sure nothing compiled is left
+ emake clean
+ emake EMACS=:
+}
+
+src_install() {
+ emake install DESTDIR="${D}" EMACS=: ELISP=""
+
+ dosym libgpm.so.1 /usr/$(get_libdir)/libgpm.so
+ gen_usr_ldscript -a gpm
+
+ insinto /etc/gpm
+ doins conf/gpm-*.conf
+
+ dodoc README TODO
+ dodoc doc/Announce doc/FAQ doc/README*
+
+ newinitd "${FILESDIR}"/gpm.rc6-2 gpm
+ newconfd "${FILESDIR}"/gpm.conf.d gpm
+ systemd_dounit "${FILESDIR}"/gpm.service
+}
diff --git a/sys-libs/gpm/gpm-1.20.7-r2.ebuild b/sys-libs/gpm/gpm-1.20.7-r2.ebuild
new file mode 100644
index 000000000000..a041ff271b92
--- /dev/null
+++ b/sys-libs/gpm/gpm-1.20.7-r2.ebuild
@@ -0,0 +1,77 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# emacs support disabled due to #99533 #335900
+
+EAPI="4"
+
+inherit eutils systemd toolchain-funcs autotools multilib-minimal
+
+DESCRIPTION="Console-based mouse driver"
+HOMEPAGE="http://www.nico.schottelius.org/software/gpm/"
+SRC_URI="http://www.nico.schottelius.org/software/${PN}/archives/${P}.tar.lzma"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 s390 ~sh sparc x86"
+IUSE="selinux static-libs"
+
+RDEPEND=">=sys-libs/ncurses-5.9-r3[${MULTILIB_USEDEP}]
+ selinux? ( sec-policy/selinux-gpm )
+ abi_x86_32? (
+ !<=app-emulation/emul-linux-x86-baselibs-20130224-r12
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ )"
+DEPEND=">=sys-libs/ncurses-5.9-r3[${MULTILIB_USEDEP}]
+ app-arch/xz-utils
+ sys-apps/texinfo
+ virtual/yacc"
+
+src_prepare() {
+ # fix ABI values
+ sed -i \
+ -e '/^abi_lev=/s:=.*:=1:' \
+ -e '/^abi_age=/s:=.*:=20:' \
+ configure.ac.footer || die
+ sed -i -e '/ACLOCAL/,$d' autogen.sh || die
+ ./autogen.sh
+ eautoreconf
+ multilib_copy_sources
+}
+
+multilib_src_configure() {
+ econf \
+ --sysconfdir=/etc/gpm \
+ $(use_enable static-libs static) \
+ emacs=/bin/false
+}
+
+multilib_src_compile() {
+ # make sure nothing compiled is left
+ emake clean
+ emake EMACS=: $(multilib_is_native_abi || echo "PROG= ")
+}
+
+multilib_src_install() {
+ emake \
+ DESTDIR="${D}" \
+ EMACS=: ELISP="" \
+ $(multilib_is_native_abi || echo "PROG= ") \
+ install
+
+ dosym libgpm.so.1 /usr/$(get_libdir)/libgpm.so
+ multilib_is_native_abi && gen_usr_ldscript -a gpm
+}
+
+multilib_src_install_all() {
+ insinto /etc/gpm
+ doins conf/gpm-*.conf
+
+ dodoc README TODO
+ dodoc doc/Announce doc/FAQ doc/README*
+
+ newinitd "${FILESDIR}"/gpm.rc6-2 gpm
+ newconfd "${FILESDIR}"/gpm.conf.d gpm
+ systemd_dounit "${FILESDIR}"/gpm.service
+}
diff --git a/sys-libs/gpm/gpm-1.20.7.ebuild b/sys-libs/gpm/gpm-1.20.7.ebuild
new file mode 100644
index 000000000000..6cc573ca7c92
--- /dev/null
+++ b/sys-libs/gpm/gpm-1.20.7.ebuild
@@ -0,0 +1,64 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# emacs support disabled due to #99533 #335900
+
+EAPI="4"
+
+inherit eutils toolchain-funcs autotools
+
+DESCRIPTION="Console-based mouse driver"
+HOMEPAGE="http://www.nico.schottelius.org/software/gpm/"
+SRC_URI="http://www.nico.schottelius.org/software/${PN}/archives/${P}.tar.lzma"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+IUSE="selinux static-libs"
+
+RDEPEND="sys-libs/ncurses
+ selinux? ( sec-policy/selinux-gpm )"
+DEPEND="sys-libs/ncurses
+ app-arch/xz-utils
+ virtual/yacc"
+
+src_prepare() {
+ # fix ABI values
+ sed -i \
+ -e '/^abi_lev=/s:=.*:=1:' \
+ -e '/^abi_age=/s:=.*:=20:' \
+ configure.ac.footer || die
+ sed -i -e '/ACLOCAL/,$d' autogen.sh || die
+ ./autogen.sh
+ eautoreconf
+}
+
+src_configure() {
+ econf \
+ --sysconfdir=/etc/gpm \
+ $(use_enable static-libs static) \
+ emacs=/bin/false
+}
+
+src_compile() {
+ # make sure nothing compiled is left
+ emake clean
+ emake EMACS=:
+}
+
+src_install() {
+ emake install DESTDIR="${D}" EMACS=: ELISP=""
+
+ dosym libgpm.so.1 /usr/$(get_libdir)/libgpm.so
+ gen_usr_ldscript -a gpm
+
+ insinto /etc/gpm
+ doins conf/gpm-*.conf
+
+ dodoc README TODO
+ dodoc doc/Announce doc/FAQ doc/README*
+
+ newinitd "${FILESDIR}"/gpm.rc6-2 gpm
+ newconfd "${FILESDIR}"/gpm.conf.d gpm
+}
diff --git a/sys-libs/gpm/metadata.xml b/sys-libs/gpm/metadata.xml
new file mode 100644
index 000000000000..96a2d586367d
--- /dev/null
+++ b/sys-libs/gpm/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>base-system</herd>
+</pkgmetadata>
diff --git a/sys-libs/gwenhywfar/Manifest b/sys-libs/gwenhywfar/Manifest
new file mode 100644
index 000000000000..a6bb355c03a2
--- /dev/null
+++ b/sys-libs/gwenhywfar/Manifest
@@ -0,0 +1,3 @@
+DIST gwenhywfar-4.12.0beta.tar.gz 2442433 SHA256 bbc7d64baaa005173699e1d5bac3b427e26f4fd0702e2fff25450ee24a4b59d2 SHA512 102d41a2efa248fe5c65f8d85688728f081c4e97e6ca58b125430e5b4dbc8f5f5d025ea0b03015f6055b21811d4baf2cc9e5e96fc80d3ae4b768a777a06c7531 WHIRLPOOL 88196b13ed0ea478b6e7a288cb02467a2a12a77323ffe0d7f7e1ff7cba1927fe8e3ccb22fcb27287d3642d942ddc740234a2fd6626043b66652a69d7308f0c1c
+DIST gwenhywfar-4.13.1.tar.gz 2518248 SHA256 4beca892c1235548ea0ae30132a6d2e57911c22340746585395ccb01d84ec72b SHA512 6a7d58189c0a9250c5291ab6350ace3b33201f5565b713b2728a2253bec209295306cd13fbbcf6bd51c4e919fa5b8fdc812d3098d946606708cd819fccc0ea1a WHIRLPOOL b5c31dd60835d0e5295520553aff433d3781e7000c62a6d567770e5188afa03dd0526a9a2185dc27a9696f1c88f671d4fa249c98d765d8da77a6e036227de43c
+DIST gwenhywfar-4.3.3.tar.gz 2346826 SHA256 87ed0f8669e1c21eaa717a18a8cf516b771c00610f5e17148cd36bce0d7d8ec2 SHA512 cb8896991d012b3acfcb653ad5557f9f63e7239c76d0882b06382e6f3d1b0f05e705f85b6adef6d3c057ccf532c4836ab06dd0af2d5bc3d8283f13a1a12b3216 WHIRLPOOL 2b2af49609c7cad860956f3ec68c6678c5160e88e6de35ef5d42eaba7401be7e61f99ca69ad8e646bb870a1ef1f14c07799b67842792b3cce7f19106c4d41113
diff --git a/sys-libs/gwenhywfar/gwenhywfar-4.12.0_beta.ebuild b/sys-libs/gwenhywfar/gwenhywfar-4.12.0_beta.ebuild
new file mode 100644
index 000000000000..e09d0f475a59
--- /dev/null
+++ b/sys-libs/gwenhywfar/gwenhywfar-4.12.0_beta.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+MY_P="${P/_beta/beta}"
+DESCRIPTION="A multi-platform helper library for other libraries"
+HOMEPAGE="http://www.aquamaniac.de/aqbanking/"
+SRC_URI="http://www.aquamaniac.de/sites/download/download.php?package=01&release=76&file=01&dummy=${MY_P}.tar.gz -> ${MY_P}.tar.gz"
+S="${WORKDIR}/${MY_P}"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~hppa ~ppc ~ppc64 ~sparc ~x86"
+IUSE="debug doc fox gtk qt4"
+
+RDEPEND="dev-libs/libgpg-error
+ >=dev-libs/libgcrypt-1.2.0:0
+ dev-libs/openssl:0
+ >=net-libs/gnutls-2.0.1
+ virtual/libiconv
+ virtual/libintl
+ fox? ( x11-libs/fox:1.6 )
+ gtk? ( >=x11-libs/gtk+-2.17.5:2 )
+ qt4? ( dev-qt/qtgui:4 )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ sys-devel/gettext
+ doc? ( app-doc/doxygen )"
+
+# broken upstream, reported but got no reply
+RESTRICT="test"
+
+src_configure() {
+ local guis
+ use fox && guis="${guis} fox16"
+ use gtk && guis="${guis} gtk2"
+ use qt4 && guis="${guis} qt4"
+
+ econf \
+ --enable-ssl \
+ --enable-visibility \
+ $(use_enable debug) \
+ $(use_enable doc full-doc) \
+ --with-guis="${guis}" \
+ --with-docpath=/usr/share/doc/${PF}/apidoc
+}
+
+src_compile() {
+ emake
+ use doc && emake srcdoc
+}
+
+src_install() {
+ emake DESTDIR="${D}" install
+ use doc && emake DESTDIR="${D}" install-srcdoc
+ dodoc AUTHORS ChangeLog README TODO
+ find "${ED}" -name '*.la' -exec rm -f {} +
+}
diff --git a/sys-libs/gwenhywfar/gwenhywfar-4.13.1.ebuild b/sys-libs/gwenhywfar/gwenhywfar-4.13.1.ebuild
new file mode 100644
index 000000000000..cbb80d4ddb27
--- /dev/null
+++ b/sys-libs/gwenhywfar/gwenhywfar-4.13.1.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+MY_P="${P/_beta/beta}"
+DESCRIPTION="A multi-platform helper library for other libraries"
+HOMEPAGE="http://www.aquamaniac.de/aqbanking/"
+SRC_URI="http://www.aquamaniac.de/sites/download/download.php?package=01&release=78&file=01&dummy=${MY_P}.tar.gz -> ${MY_P}.tar.gz"
+S="${WORKDIR}/${MY_P}"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~hppa ~ppc ~ppc64 ~sparc ~x86"
+IUSE="debug doc fox gtk qt4"
+
+RDEPEND="dev-libs/libgpg-error
+ >=dev-libs/libgcrypt-1.2.0:0
+ dev-libs/openssl:0
+ >=net-libs/gnutls-2.0.1
+ virtual/libiconv
+ virtual/libintl
+ fox? ( x11-libs/fox:1.6 )
+ gtk? ( >=x11-libs/gtk+-2.17.5:2 )
+ qt4? ( dev-qt/qtgui:4 )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ sys-devel/gettext
+ doc? ( app-doc/doxygen )"
+
+# broken upstream, reported but got no reply
+RESTRICT="test"
+
+src_configure() {
+ local guis
+ use fox && guis="${guis} fox16"
+ use gtk && guis="${guis} gtk2"
+ use qt4 && guis="${guis} qt4"
+
+ econf \
+ --enable-ssl \
+ --enable-visibility \
+ $(use_enable debug) \
+ $(use_enable doc full-doc) \
+ --with-guis="${guis}" \
+ --with-docpath=/usr/share/doc/${PF}/apidoc
+}
+
+src_compile() {
+ emake
+ use doc && emake srcdoc
+}
+
+src_install() {
+ emake DESTDIR="${D}" install
+ use doc && emake DESTDIR="${D}" install-srcdoc
+ dodoc AUTHORS ChangeLog README TODO
+ find "${ED}" -name '*.la' -exec rm -f {} +
+}
diff --git a/sys-libs/gwenhywfar/gwenhywfar-4.3.3.ebuild b/sys-libs/gwenhywfar/gwenhywfar-4.3.3.ebuild
new file mode 100644
index 000000000000..a286b2d8f82c
--- /dev/null
+++ b/sys-libs/gwenhywfar/gwenhywfar-4.3.3.ebuild
@@ -0,0 +1,58 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+DESCRIPTION="A multi-platform helper library for other libraries"
+HOMEPAGE="http://www.aquamaniac.de/aqbanking/"
+SRC_URI="http://www.aquamaniac.de/sites/download/download.php?package=01&release=67&file=01&dummy=${P}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="amd64 hppa ppc ~ppc64 ~sparc x86"
+IUSE="debug doc fox gtk qt4"
+
+RDEPEND="dev-libs/libgpg-error
+ >=dev-libs/libgcrypt-1.2.0:0
+ dev-libs/openssl:0
+ >=net-libs/gnutls-2.0.1
+ virtual/libiconv
+ virtual/libintl
+ fox? ( x11-libs/fox:1.6 )
+ gtk? ( >=x11-libs/gtk+-2.17.5:2 )
+ qt4? ( dev-qt/qtgui:4 )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ sys-devel/gettext
+ doc? ( app-doc/doxygen )"
+
+# broken upstream, reported but got no reply
+RESTRICT="test"
+
+src_configure() {
+ local guis
+ use fox && guis="${guis} fox16"
+ use gtk && guis="${guis} gtk2"
+ use qt4 && guis="${guis} qt4"
+
+ econf \
+ --enable-ssl \
+ --enable-visibility \
+ $(use_enable debug) \
+ $(use_enable doc full-doc) \
+ --with-guis="${guis}" \
+ --with-docpath=/usr/share/doc/${PF}/apidoc
+}
+
+src_compile() {
+ emake
+ use doc && emake srcdoc
+}
+
+src_install() {
+ emake DESTDIR="${D}" install
+ use doc && emake DESTDIR="${D}" install-srcdoc
+ dodoc AUTHORS ChangeLog README TODO
+ find "${ED}" -name '*.la' -exec rm -f {} +
+}
diff --git a/sys-libs/gwenhywfar/metadata.xml b/sys-libs/gwenhywfar/metadata.xml
new file mode 100644
index 000000000000..d6821f8a56db
--- /dev/null
+++ b/sys-libs/gwenhywfar/metadata.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>hanno@gentoo.org</email>
+ </maintainer>
+ <use>
+ <flag name="fox">Use <pkg>x11-libs/fox</pkg> graphical toolkit</flag>
+ </use>
+</pkgmetadata>
diff --git a/sys-libs/itx-bind/files/weak.s b/sys-libs/itx-bind/files/weak.s
new file mode 100644
index 000000000000..9efa9622af4e
--- /dev/null
+++ b/sys-libs/itx-bind/files/weak.s
@@ -0,0 +1,304 @@
+.extern ___fp_nquery
+.global _fp_nquery
+_fp_nquery:
+ jmp ___fp_nquery
+.extern ___fp_query
+.global _fp_query
+_fp_query:
+ jmp ___fp_query
+.extern ___hostalias
+.global _hostalias
+_hostalias:
+ jmp ___hostalias
+.extern ___p_query
+.global _p_query
+_p_query:
+ jmp ___p_query
+.extern ___res_close
+.global _res_close
+_res_close:
+ jmp ___res_close
+.extern ___res_init
+.global _res_init
+_res_init:
+ jmp ___res_init
+.extern ___res_isourserver
+.global _res_isourserver
+_res_isourserver:
+ jmp ___res_isourserver
+.extern ___res_mkquery
+.global _res_mkquery
+_res_mkquery:
+ jmp ___res_mkquery
+.extern ___res_query
+.global _res_query
+_res_query:
+ jmp ___res_query
+.extern ___res_querydomain
+.global _res_querydomain
+_res_querydomain:
+ jmp ___res_querydomain
+.extern ___res_search
+.global _res_search
+_res_search:
+ jmp ___res_search
+.extern ___res_send
+.global _res_send
+_res_send:
+ jmp ___res_send
+.extern ___res_sendsigned
+.global _res_sendsigned
+_res_sendsigned:
+ jmp ___res_sendsigned
+.extern ___b64_ntop
+.global _b64_ntop
+_b64_ntop:
+ jmp ___b64_ntop
+.extern ___b64_pton
+.global _b64_pton
+_b64_pton:
+ jmp ___b64_pton
+.extern ___dn_comp
+.global _dn_comp
+_dn_comp:
+ jmp ___dn_comp
+.extern ___dn_count_labels
+.global _dn_count_labels
+_dn_count_labels:
+ jmp ___dn_count_labels
+.extern ___dn_expand
+.global _dn_expand
+_dn_expand:
+ jmp ___dn_expand
+.extern ___dn_skipname
+.global _dn_skipname
+_dn_skipname:
+ jmp ___dn_skipname
+.extern ___fp_resstat
+.global _fp_resstat
+_fp_resstat:
+ jmp ___fp_resstat
+.extern ___loc_aton
+.global _loc_aton
+_loc_aton:
+ jmp ___loc_aton
+.extern ___loc_ntoa
+.global _loc_ntoa
+_loc_ntoa:
+ jmp ___loc_ntoa
+.extern ___p_cdname
+.global _p_cdname
+_p_cdname:
+ jmp ___p_cdname
+.extern ___p_cdnname
+.global _p_cdnname
+_p_cdnname:
+ jmp ___p_cdnname
+.extern ___p_class
+.global _p_class
+_p_class:
+ jmp ___p_class
+.extern ___p_fqname
+.global _p_fqname
+_p_fqname:
+ jmp ___p_fqname
+.extern ___p_fqnname
+.global _p_fqnname
+_p_fqnname:
+ jmp ___p_fqnname
+.extern ___p_option
+.global _p_option
+_p_option:
+ jmp ___p_option
+.extern ___p_secstodate
+.global _p_secstodate
+_p_secstodate:
+ jmp ___p_secstodate
+.extern ___p_section
+.global _p_section
+_p_section:
+ jmp ___p_section
+.extern ___p_time
+.global _p_time
+_p_time:
+ jmp ___p_time
+.extern ___p_type
+.global _p_type
+_p_type:
+ jmp ___p_type
+.extern ___p_rcode
+.global _p_rcode
+_p_rcode:
+ jmp ___p_rcode
+.extern ___p_sockun
+.global _p_sockun
+_p_sockun:
+ jmp ___p_sockun
+.extern ___putlong
+.global _putlong
+_putlong:
+ jmp ___putlong
+.extern ___putshort
+.global _putshort
+_putshort:
+ jmp ___putshort
+.extern ___res_dnok
+.global _res_dnok
+_res_dnok:
+ jmp ___res_dnok
+.extern ___res_findzonecut
+.global _res_findzonecut
+_res_findzonecut:
+ jmp ___res_findzonecut
+.extern ___res_findzonecut2
+.global _res_findzonecut2
+_res_findzonecut2:
+ jmp ___res_findzonecut2
+.extern ___res_hnok
+.global _res_hnok
+_res_hnok:
+ jmp ___res_hnok
+.extern ___res_hostalias
+.global _res_hostalias
+_res_hostalias:
+ jmp ___res_hostalias
+.extern ___res_mailok
+.global _res_mailok
+_res_mailok:
+ jmp ___res_mailok
+.extern ___res_nameinquery
+.global _res_nameinquery
+_res_nameinquery:
+ jmp ___res_nameinquery
+.extern ___res_nclose
+.global _res_nclose
+_res_nclose:
+ jmp ___res_nclose
+.extern ___res_ninit
+.global _res_ninit
+_res_ninit:
+ jmp ___res_ninit
+.extern ___res_nmkquery
+.global _res_nmkquery
+_res_nmkquery:
+ jmp ___res_nmkquery
+.extern ___res_pquery
+.global _res_pquery
+_res_pquery:
+ jmp ___res_pquery
+.extern ___res_nquery
+.global _res_nquery
+_res_nquery:
+ jmp ___res_nquery
+.extern ___res_nquerydomain
+.global _res_nquerydomain
+_res_nquerydomain:
+ jmp ___res_nquerydomain
+.extern ___res_nsearch
+.global _res_nsearch
+_res_nsearch:
+ jmp ___res_nsearch
+.extern ___res_nsend
+.global _res_nsend
+_res_nsend:
+ jmp ___res_nsend
+.extern ___res_nsendsigned
+.global _res_nsendsigned
+_res_nsendsigned:
+ jmp ___res_nsendsigned
+.extern ___res_ownok
+.global _res_ownok
+_res_ownok:
+ jmp ___res_ownok
+.extern ___res_queriesmatch
+.global _res_queriesmatch
+_res_queriesmatch:
+ jmp ___res_queriesmatch
+.extern ___res_randomid
+.global _res_randomid
+_res_randomid:
+ jmp ___res_randomid
+.extern ___sym_ntop
+.global _sym_ntop
+_sym_ntop:
+ jmp ___sym_ntop
+.extern ___sym_ntos
+.global _sym_ntos
+_sym_ntos:
+ jmp ___sym_ntos
+.extern ___sym_ston
+.global _sym_ston
+_sym_ston:
+ jmp ___sym_ston
+.extern ___res_nopt
+.global _res_nopt
+_res_nopt:
+ jmp ___res_nopt
+.extern ___res_ndestroy
+.global _res_ndestroy
+_res_ndestroy:
+ jmp ___res_ndestroy
+.extern ___res_nametoclass
+.global _res_nametoclass
+_res_nametoclass:
+ jmp ___res_nametoclass
+.extern ___res_nametotype
+.global _res_nametotype
+_res_nametotype:
+ jmp ___res_nametotype
+.extern ___res_setservers
+.global _res_setservers
+_res_setservers:
+ jmp ___res_setservers
+.extern ___res_getservers
+.global _res_getservers
+_res_getservers:
+ jmp ___res_getservers
+.extern ___res_buildprotolist
+.global _res_buildprotolist
+_res_buildprotolist:
+ jmp ___res_buildprotolist
+.extern ___res_destroyprotolist
+.global _res_destroyprotolist
+_res_destroyprotolist:
+ jmp ___res_destroyprotolist
+.extern ___res_destroyservicelist
+.global _res_destroyservicelist
+_res_destroyservicelist:
+ jmp ___res_destroyservicelist
+.extern ___res_get_nibblesuffix
+.global _res_get_nibblesuffix
+_res_get_nibblesuffix:
+ jmp ___res_get_nibblesuffix
+.extern ___res_get_nibblesuffix2
+.global _res_get_nibblesuffix2
+_res_get_nibblesuffix2:
+ jmp ___res_get_nibblesuffix2
+.extern ___res_ourserver_p
+.global _res_ourserver_p
+_res_ourserver_p:
+ jmp ___res_ourserver_p
+.extern ___res_protocolname
+.global _res_protocolname
+_res_protocolname:
+ jmp ___res_protocolname
+.extern ___res_protocolnumber
+.global _res_protocolnumber
+_res_protocolnumber:
+ jmp ___res_protocolnumber
+.extern ___res_send_setqhook
+.global _res_send_setqhook
+_res_send_setqhook:
+ jmp ___res_send_setqhook
+.extern ___res_send_setrhook
+.global _res_send_setrhook
+_res_send_setrhook:
+ jmp ___res_send_setrhook
+.extern ___res_servicename
+.global _res_servicename
+_res_servicename:
+ jmp ___res_servicename
+.extern ___res_servicenumber
+.global _res_servicenumber
+_res_servicenumber:
+ jmp ___res_servicenumber
diff --git a/sys-libs/itx-bind/itx-bind-0.1-r2.ebuild b/sys-libs/itx-bind/itx-bind-0.1-r2.ebuild
new file mode 100644
index 000000000000..4a414b3b1b9c
--- /dev/null
+++ b/sys-libs/itx-bind/itx-bind-0.1-r2.ebuild
@@ -0,0 +1,93 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=2
+
+inherit toolchain-funcs
+
+DESCRIPTION="the bind library for interix"
+HOMEPAGE="http://dev.gentoo.org/~mduft"
+SRC_URI=""
+
+LICENSE="ISC BSD-4"
+SLOT="0"
+KEYWORDS="-* ~x86-interix"
+IUSE=""
+
+DEPEND=""
+RDEPEND=""
+
+src_install() {
+ # scratch together the pieces of the bind installation from all over the
+ # place on different interix systems, and copy the files to the local
+ # prefix installation.
+
+ if [[ -d /usr/local/bind ]]; then
+ # layout as of vista onwards.
+ local incdir="/usr/local/bind/include"
+ local libdir="/usr/local/lib/bind"
+ else
+ # layout of xp and server 2003
+ local incdir="/usr/local/include/bind"
+ local libdir="/usr/local/lib/bind"
+
+ # windows xp has a silly bug in the installer it seems:
+ [[ -x "${incdir}/sys" ]] || chmod a+x "${incdir}/sys"
+ fi
+
+ insinto /usr/include/bind
+
+ for obj in "${incdir}"/*; do
+ [[ -f "${obj}" ]] && doins "${obj}"
+ [[ -d "${obj}" ]] && doins -r "${obj}"
+ done
+
+ cd "${T}"
+ # wrap some symbols for the sake of configure link test. the libbind names
+ # symbols differently than required (some extra underscores), and renames
+ # them through the headers. however this is not enough, if configure checks
+ # don't include header files ... :(
+ $(tc-getCC) -c "${FILESDIR}"/weak.s
+
+ mkdir "${T}"/link || die "cannot mkdir"
+ cd "${T}"/link
+
+ # now for the _magic_ part...
+ ar -x "${libdir}/libbind.a"
+ # permissions are _totally_ broken here...
+ chmod 666 *.o
+
+ # remove the gethostent.o file, since the contained gethostbyname* functions
+ # seem to not work on older interixen, whereas the libc contained versions
+ # do work well enough.
+ rm gethostent.o
+
+ # find libdb.a from the system - need the _oold_ one...
+ local mydb=
+
+ for mydb in \
+ "/usr/lib/x86/libdb.a" \
+ "/usr/lib/libdb.a"; do
+ if test -f "${mydb}"; then
+ break
+ fi
+ done
+
+ # this needs a _stoneage_ berkeley db, so we really need to take the
+ # systems instead if installing db ourselves. newer db's don't have the
+ # requested symbols (they do support it, but with a different name). Another
+ # option would be to generate wrapper symbols for the things needed, but i'd
+ # rather avoid doing so, since i don't know them all.
+ $(tc-getCC) -shared -Wl,-h,libbind.so.${PV} -o libbind.so.${PV} *.o \
+ ../weak.o "${mydb}" || die "cannot link shared libbind"
+
+ dolib.so libbind.so.${PV}
+
+ # to prevent accidental linking during configure tests of packages which are
+ # not prepared for itx-bind, install things in a separate directory.
+ # packages need to explicitly add this and the include directory for this to
+ # work!
+ dosym ../libbind.so.${PV} /usr/lib/bind/libbind.so
+ dosym ../libbind.so.${PV} /usr/lib/bind/libresolv.so # mean, huh? :)
+}
diff --git a/sys-libs/itx-bind/metadata.xml b/sys-libs/itx-bind/metadata.xml
new file mode 100644
index 000000000000..4dfff39fdd6b
--- /dev/null
+++ b/sys-libs/itx-bind/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer>
+ <email>haubi@gentoo.org</email>
+ <name>Michael Haubenwallner</name>
+</maintainer>
+<longdescription lang="en">
+ bind library based on the interix' host bind library. the host library
+ is linked into a shared library, wrapping some symbols to more common names
+</longdescription>
+</pkgmetadata>
+
diff --git a/sys-libs/ldb/Manifest b/sys-libs/ldb/Manifest
new file mode 100644
index 000000000000..f0f2a3db9c04
--- /dev/null
+++ b/sys-libs/ldb/Manifest
@@ -0,0 +1,5 @@
+DIST ldb-1.1.12.tar.gz 1110134 SHA256 b6444a1bfc9b8c8f43df171b12b5a581c44a64b4d92062d4959fed17e4cf1b4c SHA512 e00af0367b99b8829bbca636859beee75c1c0828fc15f760a2b2fed6e4fadd850b55bfa6a57e4c6cc3a698fec70f1446635b152ed3a0559ef4483907e5a2102c WHIRLPOOL ebf339d27b0a14b56dcb9e4fe85af9e034f0670567b982edb9927fa808e8eac51c672083d76e747d58d29067b441d158e78d1cb2ee343589aba44bf9aa11689b
+DIST ldb-1.1.15.tar.gz 1121684 SHA256 6bd8317e82747461394ab8ad1ee5873589d9a46d12f021571aca9fac45de8997 SHA512 48aada749986cf636aa8ae259c9ba1f07899e136129414752f2e4932f396348d56eef987fa96595c940bd159f8c03795973ba66fc49f00e204339986bf49a970 WHIRLPOOL 683e5abf53817527d42bff83330b5b8e6b07b0d2b5936ee7ac794d037091dd85b4f6674ef8538a7d6489933473908ed2026265b4b6db8a253ff711f86a9661a6
+DIST ldb-1.1.17.tar.gz 1177926 SHA256 b9a312aad19e9463716d257d8f2529fd7fc1a5ef24f6dcdc0c4a1930d7bdb6e6 SHA512 bbdb79bc584bb26e053d21c47457b0c10c62080034e44d41ae9c0a6225f6d30f6976b30617f57fc4cb0776af770a4e9c569726d2385a8ec4545b1f732d366f17 WHIRLPOOL 56cbe6763010eba49c94146b1cb7748d643d2233eb5d26a1bf0a8aa02fcf2afa11b9d22a13608b753385a9817ee37804281651e47668bdc61eefd5ffa200a8c0
+DIST ldb-1.1.20.tar.gz 1220484 SHA256 ba493bab271fdaa6ba07960728ffca71c8f9da5240162e86f1e56694b7a377b2 SHA512 432dfa1d64197a74638762bfdfc18b060c5e37890f2c8a21dc5c8f19fc0070123400ad835256b9c1a94631f80d9930d2a2a714e711a60d11af6ab587bc372155 WHIRLPOOL e992a8b16d22f098f3dd68dc17a2c21c9af34ac18b39d69bd63146eadc7cf62eb48d23b5a0aa7366cbf1e0db3b9d61a3b3ed5fce7b14c82b7b2ae80fc170ba1f
+DIST ldb-1.1.21.tar.gz 1244825 SHA256 267bbb7f278068eaf0de27adffda2e691a070a93c5c15ee27c828e87b4c7dbf1 SHA512 2ce35bfb2c8db22c87e7adea454ae05cb1234260d9beaaea564e76c5d83d8022610f18db70ad27e0d39d951b62cd17695e2f9f576213f9ac54f7e418416a5837 WHIRLPOOL 623bbe38252d5318bdd4a152189ed2258692867392771a2c5f8eccc5160bc4d83fdae8303ab11d249753132807071b460f87108a83141b63fe9e0dce3aca07a2
diff --git a/sys-libs/ldb/ldb-1.1.12.ebuild b/sys-libs/ldb/ldb-1.1.12.ebuild
new file mode 100644
index 000000000000..4b413c69f3e4
--- /dev/null
+++ b/sys-libs/ldb/ldb-1.1.12.ebuild
@@ -0,0 +1,77 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+PYTHON_DEPEND="2"
+PYTHON_REQ_USE="threads"
+
+inherit python waf-utils multilib
+
+DESCRIPTION="An LDAP-like embedded database"
+HOMEPAGE="http://ldb.samba.org"
+SRC_URI="http://www.samba.org/ftp/pub/${PN}/${P}.tar.gz"
+
+LICENSE="LGPL-3"
+SLOT="0"
+KEYWORDS="~alpha amd64 hppa ppc ppc64 x86 ~amd64-fbsd ~x86-fbsd"
+IUSE="doc"
+
+RDEPEND="dev-libs/popt
+ >=sys-libs/talloc-2.0.7[python]
+ >=sys-libs/tevent-0.9.17[python(+)]
+ >=sys-libs/tdb-1.2.10[python]
+ net-nds/openldap
+ !!<net-fs/samba-3.6.0[ldb]
+ !!>=net-fs/samba-4.0.0[ldb]
+ "
+
+DEPEND="dev-libs/libxslt
+ doc? ( app-doc/doxygen )
+ virtual/pkgconfig
+ ${RDEPEND}"
+
+WAF_BINARY="${S}/buildtools/bin/waf"
+
+pkg_setup() {
+ python_set_active_version 2
+ python_pkg_setup
+ python_need_rebuild
+}
+
+src_configure() {
+ waf-utils_src_configure \
+ --disable-rpath \
+ --disable-rpath-install --bundled-libraries=NONE \
+ --with-modulesdir="${EPREFIX}"/usr/$(get_libdir)/ldb/modules \
+ --builtin-libraries=NONE
+}
+
+src_compile(){
+ waf-utils_src_compile
+ use doc && doxygen Doxyfile
+}
+
+src_test() {
+ WAF_MAKE=1 \
+ PATH=buildtools/bin:../../../buildtools/bin:$PATH:"${S}"/bin/shared/private/ \
+ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"${S}"/bin/shared/private/:"${S}"/bin/shared waf test || die
+}
+
+src_install() {
+ waf-utils_src_install
+
+ if use doc; then
+ dohtml -r apidocs/html/*
+ doman apidocs/man/man3/*.3
+ fi
+}
+
+pkg_postinst() {
+ python_need_rebuild
+ if has_version sys-auth/sssd; then
+ ewarn "You have sssd installed. It is known to break after ldb upgrades,"
+ ewarn "so please try to rebuild it before reporting bugs."
+ ewarn "See http://bugs.gentoo.org/404281"
+ fi
+}
diff --git a/sys-libs/ldb/ldb-1.1.15.ebuild b/sys-libs/ldb/ldb-1.1.15.ebuild
new file mode 100644
index 000000000000..f52d4973ebcd
--- /dev/null
+++ b/sys-libs/ldb/ldb-1.1.15.ebuild
@@ -0,0 +1,77 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+PYTHON_DEPEND="2"
+PYTHON_REQ_USE="threads"
+
+inherit python waf-utils multilib
+
+DESCRIPTION="An LDAP-like embedded database"
+HOMEPAGE="http://ldb.samba.org"
+SRC_URI="http://www.samba.org/ftp/pub/${PN}/${P}.tar.gz"
+
+LICENSE="LGPL-3"
+SLOT="0"
+KEYWORDS="alpha amd64 arm ~hppa ia64 ~ppc ~ppc64 sparc x86 ~amd64-fbsd ~x86-fbsd"
+IUSE="doc"
+
+RDEPEND="dev-libs/popt
+ >=sys-libs/talloc-2.0.8[python]
+ >=sys-libs/tevent-0.9.17[python(+)]
+ >=sys-libs/tdb-1.2.11[python]
+ net-nds/openldap
+ !!<net-fs/samba-3.6.0[ldb]
+ !!>=net-fs/samba-4.0.0[ldb]
+ "
+
+DEPEND="dev-libs/libxslt
+ doc? ( app-doc/doxygen )
+ virtual/pkgconfig
+ ${RDEPEND}"
+
+WAF_BINARY="${S}/buildtools/bin/waf"
+
+pkg_setup() {
+ python_set_active_version 2
+ python_pkg_setup
+ python_need_rebuild
+}
+
+src_configure() {
+ waf-utils_src_configure \
+ --disable-rpath \
+ --disable-rpath-install --bundled-libraries=NONE \
+ --with-modulesdir="${EPREFIX}"/usr/$(get_libdir)/ldb/modules \
+ --builtin-libraries=NONE
+}
+
+src_compile(){
+ waf-utils_src_compile
+ use doc && doxygen Doxyfile
+}
+
+src_test() {
+ WAF_MAKE=1 \
+ PATH=buildtools/bin:../../../buildtools/bin:$PATH:"${S}"/bin/shared/private/ \
+ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"${S}"/bin/shared/private/:"${S}"/bin/shared waf test || die
+}
+
+src_install() {
+ waf-utils_src_install
+
+ if use doc; then
+ dohtml -r apidocs/html/*
+ doman apidocs/man/man3/*.3
+ fi
+}
+
+pkg_postinst() {
+ python_need_rebuild
+ if has_version sys-auth/sssd; then
+ ewarn "You have sssd installed. It is known to break after ldb upgrades,"
+ ewarn "so please try to rebuild it before reporting bugs."
+ ewarn "See http://bugs.gentoo.org/404281"
+ fi
+}
diff --git a/sys-libs/ldb/ldb-1.1.17-r1.ebuild b/sys-libs/ldb/ldb-1.1.17-r1.ebuild
new file mode 100644
index 000000000000..df83744d521e
--- /dev/null
+++ b/sys-libs/ldb/ldb-1.1.17-r1.ebuild
@@ -0,0 +1,77 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="threads"
+
+inherit python-single-r1 waf-utils multilib
+
+DESCRIPTION="An LDAP-like embedded database"
+HOMEPAGE="http://ldb.samba.org"
+SRC_URI="http://www.samba.org/ftp/pub/${PN}/${P}.tar.gz"
+
+LICENSE="LGPL-3"
+SLOT="0/${PV}"
+KEYWORDS="~alpha amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh x86 ~amd64-fbsd ~x86-fbsd"
+IUSE="doc"
+
+RDEPEND="dev-libs/popt
+ >=sys-libs/talloc-2.1.0[python]
+ >=sys-libs/tevent-0.9.21[python(+)]
+ >=sys-libs/tdb-1.2.12[python]
+ net-nds/openldap
+ !!<net-fs/samba-3.6.0[ldb]
+ !!>=net-fs/samba-4.0.0[ldb]
+ ${PYTHON_DEPS}
+ "
+
+DEPEND="dev-libs/libxslt
+ doc? ( app-doc/doxygen )
+ virtual/pkgconfig
+ ${RDEPEND}"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+WAF_BINARY="${S}/buildtools/bin/waf"
+
+pkg_setup() {
+ python-single-r1_pkg_setup
+}
+
+src_configure() {
+ waf-utils_src_configure \
+ --disable-rpath \
+ --disable-rpath-install --bundled-libraries=NONE \
+ --with-modulesdir="${EPREFIX}"/usr/$(get_libdir)/samba \
+ --builtin-libraries=NONE
+}
+
+src_compile(){
+ waf-utils_src_compile
+ use doc && doxygen Doxyfile
+}
+
+src_test() {
+ WAF_MAKE=1 \
+ PATH=buildtools/bin:../../../buildtools/bin:$PATH:"${S}"/bin/shared/private/ \
+ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"${S}"/bin/shared/private/:"${S}"/bin/shared waf test || die
+}
+
+src_install() {
+ waf-utils_src_install
+
+ if use doc; then
+ dohtml -r apidocs/html/*
+ doman apidocs/man/man3/*.3
+ fi
+}
+
+pkg_postinst() {
+ if has_version sys-auth/sssd; then
+ ewarn "You have sssd installed. It is known to break after ldb upgrades,"
+ ewarn "so please try to rebuild it before reporting bugs."
+ ewarn "See http://bugs.gentoo.org/404281"
+ fi
+}
diff --git a/sys-libs/ldb/ldb-1.1.20.ebuild b/sys-libs/ldb/ldb-1.1.20.ebuild
new file mode 100644
index 000000000000..ad77f42b409e
--- /dev/null
+++ b/sys-libs/ldb/ldb-1.1.20.ebuild
@@ -0,0 +1,77 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="threads"
+
+inherit python-single-r1 waf-utils multilib
+
+DESCRIPTION="An LDAP-like embedded database"
+HOMEPAGE="http://ldb.samba.org"
+SRC_URI="http://www.samba.org/ftp/pub/${PN}/${P}.tar.gz"
+
+LICENSE="LGPL-3"
+SLOT="0/${PV}"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~x86 ~amd64-fbsd ~x86-fbsd"
+IUSE="doc"
+
+RDEPEND="dev-libs/popt
+ >=sys-libs/talloc-2.1.1[python]
+ >=sys-libs/tevent-0.9.22[python(+)]
+ >=sys-libs/tdb-1.3.4[python]
+ net-nds/openldap
+ !!<net-fs/samba-3.6.0[ldb]
+ !!>=net-fs/samba-4.0.0[ldb]
+ ${PYTHON_DEPS}
+ "
+
+DEPEND="dev-libs/libxslt
+ doc? ( app-doc/doxygen )
+ virtual/pkgconfig
+ ${RDEPEND}"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+WAF_BINARY="${S}/buildtools/bin/waf"
+
+pkg_setup() {
+ python-single-r1_pkg_setup
+}
+
+src_configure() {
+ waf-utils_src_configure \
+ --disable-rpath \
+ --disable-rpath-install --bundled-libraries=NONE \
+ --with-modulesdir="${EPREFIX}"/usr/$(get_libdir)/samba \
+ --builtin-libraries=NONE
+}
+
+src_compile(){
+ waf-utils_src_compile
+ use doc && doxygen Doxyfile
+}
+
+src_test() {
+ WAF_MAKE=1 \
+ PATH=buildtools/bin:../../../buildtools/bin:$PATH:"${S}"/bin/shared/private/ \
+ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"${S}"/bin/shared/private/:"${S}"/bin/shared waf test || die
+}
+
+src_install() {
+ waf-utils_src_install
+
+ if use doc; then
+ dohtml -r apidocs/html/*
+ doman apidocs/man/man3/*.3
+ fi
+}
+
+pkg_postinst() {
+ if has_version sys-auth/sssd; then
+ ewarn "You have sssd installed. It is known to break after ldb upgrades,"
+ ewarn "so please try to rebuild it before reporting bugs."
+ ewarn "See http://bugs.gentoo.org/404281"
+ fi
+}
diff --git a/sys-libs/ldb/ldb-1.1.21.ebuild b/sys-libs/ldb/ldb-1.1.21.ebuild
new file mode 100644
index 000000000000..c14ba91258e7
--- /dev/null
+++ b/sys-libs/ldb/ldb-1.1.21.ebuild
@@ -0,0 +1,77 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="threads"
+
+inherit python-single-r1 waf-utils multilib
+
+DESCRIPTION="An LDAP-like embedded database"
+HOMEPAGE="http://ldb.samba.org"
+SRC_URI="http://www.samba.org/ftp/pub/${PN}/${P}.tar.gz"
+
+LICENSE="LGPL-3"
+SLOT="0/${PV}"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~x86 ~amd64-fbsd ~x86-fbsd"
+IUSE="doc"
+
+RDEPEND="dev-libs/popt
+ >=sys-libs/talloc-2.1.3[python]
+ >=sys-libs/tevent-0.9.25[python(+)]
+ >=sys-libs/tdb-1.3.7[python]
+ net-nds/openldap
+ !!<net-fs/samba-3.6.0[ldb]
+ !!>=net-fs/samba-4.0.0[ldb]
+ ${PYTHON_DEPS}
+ "
+
+DEPEND="dev-libs/libxslt
+ doc? ( app-doc/doxygen )
+ virtual/pkgconfig
+ ${RDEPEND}"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+WAF_BINARY="${S}/buildtools/bin/waf"
+
+pkg_setup() {
+ python-single-r1_pkg_setup
+}
+
+src_configure() {
+ waf-utils_src_configure \
+ --disable-rpath \
+ --disable-rpath-install --bundled-libraries=NONE \
+ --with-modulesdir="${EPREFIX}"/usr/$(get_libdir)/samba \
+ --builtin-libraries=NONE
+}
+
+src_compile(){
+ waf-utils_src_compile
+ use doc && doxygen Doxyfile
+}
+
+src_test() {
+ WAF_MAKE=1 \
+ PATH=buildtools/bin:../../../buildtools/bin:$PATH:"${S}"/bin/shared/private/ \
+ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"${S}"/bin/shared/private/:"${S}"/bin/shared waf test || die
+}
+
+src_install() {
+ waf-utils_src_install
+
+ if use doc; then
+ dohtml -r apidocs/html/*
+ doman apidocs/man/man3/*.3
+ fi
+}
+
+pkg_postinst() {
+ if has_version sys-auth/sssd; then
+ ewarn "You have sssd installed. It is known to break after ldb upgrades,"
+ ewarn "so please try to rebuild it before reporting bugs."
+ ewarn "See http://bugs.gentoo.org/404281"
+ fi
+}
diff --git a/sys-libs/ldb/metadata.xml b/sys-libs/ldb/metadata.xml
new file mode 100644
index 000000000000..587dabd73f1d
--- /dev/null
+++ b/sys-libs/ldb/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>samba</herd>
+</pkgmetadata>
diff --git a/sys-libs/lib-compat-loki/Manifest b/sys-libs/lib-compat-loki/Manifest
new file mode 100644
index 000000000000..a82dfefc362b
--- /dev/null
+++ b/sys-libs/lib-compat-loki/Manifest
@@ -0,0 +1 @@
+DIST lib-compat-loki-0.2.tar.bz2 1441552 SHA256 112b916c21f1a47d257aff721cda10a79e40efe4b75f71d696b70a0036f12234 SHA512 7a090d9bfb3cb3a184d64030f9c85070034365e83c9e11b315df98995d15933d13542069f15b7bd1dd1c4f1cfab3466c1b354bdc073172573846347ecc8c8527 WHIRLPOOL e92a57bed5a77af44fde2d310fab24feb872af6483a0b3da1ce2e914c2cc107428adfb15d86afcb44a50c7a8858093c65186f51e2c741f7bb7666b6ccd9f107a
diff --git a/sys-libs/lib-compat-loki/lib-compat-loki-0.2-r1.ebuild b/sys-libs/lib-compat-loki/lib-compat-loki-0.2-r1.ebuild
new file mode 100644
index 000000000000..9ba84f538442
--- /dev/null
+++ b/sys-libs/lib-compat-loki/lib-compat-loki-0.2-r1.ebuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+DESCRIPTION="Compatibility libc6 libraries for Loki games"
+HOMEPAGE="http://www.gentoo.org/"
+SRC_URI="http://www.blfh.de/gentoo/distfiles/${P}.tar.bz2
+ http://dev.gentoo.org/~wolf31o2/sources/lib-compat-loki/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+RDEPEND="sys-libs/lib-compat
+ >=media-libs/libsdl-1.2.15-r4[abi_x86_32(-)]"
+
+# I'm not quite sure if this is necessary:
+RESTRICT="strip"
+
+S=${WORKDIR}/${P}/x86
+
+src_prepare() {
+ # rename the libs in order to _never_ overwrite any existing lib.
+ mv libc-2.2.5.so loki_libc.so.6 || die
+ mv ld-2.2.5.so loki_ld-linux.so.2 || die
+ mv libnss_files-2.2.5.so loki_libnss_files.so.2 || die
+ mv libsmpeg-0.4.so.0 loki_libsmpeg-0.4.so.0 || die
+}
+
+src_install() {
+ ABI=x86
+
+ into /
+ dolib.so loki_ld-linux.so.2
+ rm -f loki_ld-linux.so.2
+ into /usr
+ dolib.so *.so*
+}
diff --git a/sys-libs/lib-compat-loki/metadata.xml b/sys-libs/lib-compat-loki/metadata.xml
new file mode 100644
index 000000000000..d3c2cc926f0b
--- /dev/null
+++ b/sys-libs/lib-compat-loki/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>games</herd>
+</pkgmetadata>
diff --git a/sys-libs/lib-compat/Manifest b/sys-libs/lib-compat/Manifest
new file mode 100644
index 000000000000..b6380cda3068
--- /dev/null
+++ b/sys-libs/lib-compat/Manifest
@@ -0,0 +1 @@
+DIST lib-compat-1.4.2.tar.bz2 3002557 SHA256 89861c0ba899e8f9c81561422007d0c6961fce60eb5d2967fff2618230ed562c SHA512 aa801434db2749f5f6f42fb12aaa4e518474e8a2b75e7d2e93733d99ebdbc52615c879f575b708dafa15bd1e8bd8362697a6d1f5a38691dd4664cd6fbb51ae14 WHIRLPOOL b1cee9cd0c19d06c1f08fc0b7fda18fef51501f27bc11dc0b345797a90a10a32a3f6e377c89bcd380126f12c59835e53035b802dc24242ee75b26128ef4b9dd9
diff --git a/sys-libs/lib-compat/lib-compat-1.4.2-r1.ebuild b/sys-libs/lib-compat/lib-compat-1.4.2-r1.ebuild
new file mode 100644
index 000000000000..88ec45c540bd
--- /dev/null
+++ b/sys-libs/lib-compat/lib-compat-1.4.2-r1.ebuild
@@ -0,0 +1,31 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+DESCRIPTION="Compatibility C++ and libc5 and libc6 libraries for very old programs"
+HOMEPAGE="http://www.gentoo.org/"
+SRC_URI="mirror://gentoo/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+RDEPEND="!<=app-emulation/emul-linux-x86-compat-20140508"
+
+src_install() {
+ if use amd64 || use x86; then
+ cd x86 || die
+ ABI=x86
+ into /
+ dolib.so ld-linux.so.1*
+ rm -f ld-linux.so.1*
+ #elif use alpha; then
+ # cd alpha || die
+ else
+ die "arch not supported"
+ fi
+ into /usr
+ dolib.so *.so*
+}
diff --git a/sys-libs/lib-compat/metadata.xml b/sys-libs/lib-compat/metadata.xml
new file mode 100644
index 000000000000..96a2d586367d
--- /dev/null
+++ b/sys-libs/lib-compat/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>base-system</herd>
+</pkgmetadata>
diff --git a/sys-libs/libaal/Manifest b/sys-libs/libaal/Manifest
new file mode 100644
index 000000000000..e7a1c643dce1
--- /dev/null
+++ b/sys-libs/libaal/Manifest
@@ -0,0 +1,2 @@
+DIST libaal-1.0.5.tar.gz 336052 SHA256 ff1adb7aa7b917010d827f2e451fad8cb65ce981877d762b48baf20e89212e81 SHA512 1e4076ce4228a7947074ce2764da63f48cbeb4086cf6ab75b882ecd4ff07d4de3a6f5411c5c0b9cdd1c279b3bb98f92f5da3892e5479b7112b67703fddc102be WHIRLPOOL 805ffefdf22b6df05e57d0f836940c4f5748dba8fa5d6933bf07f410ae85f3914353d0697eb33dbc7a927e6d367bd9ab1e85caa1c1be94f710d0395f52854432
+DIST libaal-1.0.6.tar.gz 345894 SHA256 b1a1547746438b156156f82332557b05442e6d6c39fa9fe0d8dd47a3ad16ce9c SHA512 9b13096abcb90e75fff607ffd7b11ed8b100f349800b726acb01aca12f54abe784adb9912916fe8ed0751ebf367ecced04ab058e1e8b947f4209a5e6c390f123 WHIRLPOOL 7d93c3dc6eb62712a460f37bc933588c0b71d17472c64104a5cba939324af801ca0ba37063cd020caf8aa0d352a21b5222f838b427fbba0c03144b89d64e98c6
diff --git a/sys-libs/libaal/libaal-1.0.5-r1.ebuild b/sys-libs/libaal/libaal-1.0.5-r1.ebuild
new file mode 100644
index 000000000000..57dd7f5605d8
--- /dev/null
+++ b/sys-libs/libaal/libaal-1.0.5-r1.ebuild
@@ -0,0 +1,37 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit toolchain-funcs
+
+DESCRIPTION="library required by reiser4progs"
+HOMEPAGE="https://sourceforge.net/projects/reiser4/"
+SRC_URI="mirror://sourceforge/reiser4/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 -sparc ~x86"
+IUSE="static-libs"
+
+src_prepare() {
+ # remove stupid CFLAG hardcodes
+ sed -i \
+ -e "/GENERIC_CFLAGS/s:-O3::" \
+ -e "/^CFLAGS=/s:\"\":\"${CFLAGS}\":" \
+ configure || die "sed"
+ printf '#!/bin/sh\n:\n' > run-ldconfig
+}
+
+src_configure() {
+ econf \
+ --enable-libminimal \
+ --enable-memory-manager \
+ $(use_enable static-libs static)
+}
+
+src_install() {
+ default
+ gen_usr_ldscript -a aal{,-minimal}
+}
diff --git a/sys-libs/libaal/libaal-1.0.5.ebuild b/sys-libs/libaal/libaal-1.0.5.ebuild
new file mode 100644
index 000000000000..87ce722b11f0
--- /dev/null
+++ b/sys-libs/libaal/libaal-1.0.5.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit toolchain-funcs
+
+DESCRIPTION="library required by reiser4progs"
+HOMEPAGE="http://www.kernel.org/pub/linux/utils/fs/reiser4/libaal/"
+SRC_URI="mirror://kernel/linux/utils/fs/reiser4/libaal/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 arm ppc ppc64 -sparc x86"
+IUSE=""
+
+DEPEND=""
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ # remove stupid CFLAG hardcodes
+ sed -i \
+ -e "/GENERIC_CFLAGS/s:-O3::" \
+ -e "/^CFLAGS=/s:\"\":\"${CFLAGS}\":" \
+ configure || die "sed"
+ cat <<-EOF > run-ldconfig
+ #!/bin/sh
+ true
+ EOF
+}
+
+src_compile() {
+ econf \
+ --enable-libminimal \
+ --enable-memory-manager \
+ || die "configure failed"
+ emake || die "make failed"
+}
+
+src_install() {
+ make DESTDIR="${D}" install || die
+ dodoc AUTHORS BUGS CREDITS ChangeLog NEWS README THANKS TODO
+
+ # move shared libs to /
+ dodir /$(get_libdir)
+ mv "${D}"/usr/$(get_libdir)/lib*.so* "${D}"/$(get_libdir)/ || die
+ gen_usr_ldscript libaal.so libaal-minimal.so
+}
diff --git a/sys-libs/libaal/libaal-1.0.6.ebuild b/sys-libs/libaal/libaal-1.0.6.ebuild
new file mode 100644
index 000000000000..948b3643549b
--- /dev/null
+++ b/sys-libs/libaal/libaal-1.0.6.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit toolchain-funcs
+
+DESCRIPTION="library required by reiser4progs"
+HOMEPAGE="https://sourceforge.net/projects/reiser4/"
+SRC_URI="mirror://sourceforge/reiser4/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 arm ppc ppc64 -sparc x86"
+IUSE="static-libs"
+
+DEPEND="virtual/os-headers"
+
+src_prepare() {
+ # remove stupid CFLAG hardcodes
+ sed -i \
+ -e "/GENERIC_CFLAGS/s:-O3::" \
+ -e "/^CFLAGS=/s:\"\":\"${CFLAGS}\":" \
+ configure || die "sed"
+ printf '#!/bin/sh\n:\n' > run-ldconfig
+}
+
+src_configure() {
+ econf \
+ --enable-libminimal \
+ --enable-memory-manager \
+ $(use_enable static-libs static)
+}
+
+src_install() {
+ default
+ gen_usr_ldscript -a aal{,-minimal}
+}
diff --git a/sys-libs/libaal/metadata.xml b/sys-libs/libaal/metadata.xml
new file mode 100644
index 000000000000..bf71b94afea3
--- /dev/null
+++ b/sys-libs/libaal/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>base-system</herd>
+ <longdescription>
+This is a library, that provides application abstraction mechanism.
+It includes device abstraction, libc independence code, etc.
+</longdescription>
+ <upstream>
+ <remote-id type="sourceforge">reiser4</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-libs/libacpi/Manifest b/sys-libs/libacpi/Manifest
new file mode 100644
index 000000000000..76620b0e2328
--- /dev/null
+++ b/sys-libs/libacpi/Manifest
@@ -0,0 +1 @@
+DIST libacpi-0.2.tar.gz 104881 SHA256 13086e31d428b9c125954d48ac497b754bbbce2ef34ea29ecd903e82e25bad29
diff --git a/sys-libs/libacpi/files/libacpi-0.2.patch b/sys-libs/libacpi/files/libacpi-0.2.patch
new file mode 100644
index 000000000000..f3f2b5e98cca
--- /dev/null
+++ b/sys-libs/libacpi/files/libacpi-0.2.patch
@@ -0,0 +1,81 @@
+--- config.mk
++++ config.mk
+@@ -3,15 +3,17 @@
+ SONAME = libacpi.so.${SOVERSION}
+
+ # customize below to fit your system
+-PREFIX = /usr/local
++PREFIX = /usr
+ MANPREFIX = ${PREFIX}/share/man
++DOCDIR = ${PREFIX}/share/doc/libacpi-${VERSION}
++LIBDIR = ${PREFIX}/lib
+
+ # flags
+ SOFLAGS = -shared -Wl,-soname,${SONAME}
+-CFLAGS += -fPIC -g --pedantic -Wall -Wextra
++CFLAGS += -fPIC -pedantic -Wall -Wextra
+
+ # Compiler and linker
+-CC = cc
++CC ?= cc
+ LD = ${CC}
+-AR = ar cr
+-RANLIB = ranlib
++AR ?= ar
++RANLIB ?= ranlib
+--- Makefile
++++ Makefile
+@@ -25,30 +25,29 @@
+
+ libacpi.a: ${OBJ}
+ @echo AR $@
+- @${AR} $@ ${OBJ}
++ @${AR} cr $@ ${OBJ}
+ @${RANLIB} $@
+
+ libacpi.so: ${OBJ}
+ @echo LD $@
+- @${LD} ${SOFLAGS} -o $@.${SOVERSION} ${OBJ}
++ @${LD} ${LDFLAGS} ${SOFLAGS} -o $@.${SOVERSION} ${OBJ}
+
+ test-libacpi: ${OBJ_test}
+ @echo LD $@
+- @${LD} -o $@ ${OBJ_test} ${LDFLAGS}
+- @strip $@
++ @${LD} ${LDFLAGS} -o $@ ${OBJ_test}
+
+ install: all
+ @echo installing header to ${DESTDIR}${PREFIX}/include
+ @mkdir -p ${DESTDIR}${PREFIX}/include
+ @cp -f libacpi.h ${DESTDIR}${PREFIX}/include
+ @chmod 644 ${DESTDIR}${PREFIX}/include/libacpi.h
+- @echo installing library to ${DESTDIR}${PREFIX}/lib
+- @mkdir -p ${DESTDIR}${PREFIX}/lib
+- @cp -f libacpi.a ${DESTDIR}${PREFIX}/lib
+- @chmod 644 ${DESTDIR}${PREFIX}/lib/libacpi.a
+- @cp -f ${SONAME} ${DESTDIR}${PREFIX}/lib/
+- @chmod 644 ${DESTDIR}${PREFIX}/lib/${SONAME}
+- @ln -s ${SONAME} ${DESTDIR}${PREFIX}/lib/libacpi.so
++ @echo installing library to ${DESTDIR}${LIBDIR}
++ @mkdir -p ${DESTDIR}${LIBDIR}
++ @cp -f libacpi.a ${DESTDIR}${LIBDIR}
++ @chmod 644 ${DESTDIR}${LIBDIR}/libacpi.a
++ @cp -f ${SONAME} ${DESTDIR}${LIBDIR}/
++ @chmod 644 ${DESTDIR}${LIBDIR}/${SONAME}
++ @ln -s ${SONAME} ${DESTDIR}${LIBDIR}/libacpi.so
+ @echo installing test-libacpi to ${DESTDIR}${PREFIX}/bin
+ @mkdir -p ${DESTDIR}${PREFIX}/bin
+ @cp -f test-libacpi ${DESTDIR}${PREFIX}/bin
+@@ -56,9 +55,9 @@
+ @echo installing manual page to ${DESTDIR}${MANPREFIX}/man3
+ @mkdir -p ${DESTDIR}${MANPREFIX}/man3
+ @cp libacpi.3 ${DESTDIR}${MANPREFIX}/man3
+- @echo installing documentation and misc files to ${DESTDIR}${PREFIX}/share/doc/libacpi
+- @mkdir -p ${DESTDIR}${PREFIX}/share/doc/libacpi
+- @cp -r AUTHORS CHANGES README LICENSE doc ${DESTDIR}${PREFIX}/share/doc/libacpi
++ @echo installing documentation and misc files to ${DESTDIR}${DOCDIR}
++ @mkdir -p ${DESTDIR}${DOCDIR}
++ @cp -r AUTHORS CHANGES README doc/* ${DESTDIR}${DOCDIR}
+ @echo finished installation
+
+ uninstall:
diff --git a/sys-libs/libacpi/libacpi-0.2.ebuild b/sys-libs/libacpi/libacpi-0.2.ebuild
new file mode 100644
index 000000000000..1a46dfff9732
--- /dev/null
+++ b/sys-libs/libacpi/libacpi-0.2.ebuild
@@ -0,0 +1,29 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=2
+inherit eutils multilib toolchain-funcs
+
+DESCRIPTION="A general purpose library for ACPI"
+HOMEPAGE="http://www.ngolde.de/libacpi.html"
+SRC_URI="http://www.ngolde.de/download/${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}.patch
+}
+
+src_compile() {
+ tc-export AR CC RANLIB
+ emake || die
+}
+
+src_install() {
+ emake DESTDIR="${D}" LIBDIR="/usr/$(get_libdir)" install || die
+ prepalldocs
+}
diff --git a/sys-libs/libacpi/metadata.xml b/sys-libs/libacpi/metadata.xml
new file mode 100644
index 000000000000..c2d865517c00
--- /dev/null
+++ b/sys-libs/libacpi/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>ssuominen@gentoo.org</email>
+ <name>Samuli Suominen</name>
+ </maintainer>
+</pkgmetadata>
diff --git a/sys-libs/libapparmor/Manifest b/sys-libs/libapparmor/Manifest
new file mode 100644
index 000000000000..dbf34e84db21
--- /dev/null
+++ b/sys-libs/libapparmor/Manifest
@@ -0,0 +1,2 @@
+DIST apparmor-2.8.3.tar.gz 1534245 SHA256 84c2ca7fb6d170e5bb56270f01c9b78e78a991b9eee7fa53a9e6409ef0845c7e SHA512 c1102206fc93e09865a8cbb239164298af298175d7043efa10ab7227c23e7aef664d38fa3b67e82e2263fba9dbc0567fa659233226633b7e26ac80e2c02c78fb WHIRLPOOL 24ee03843c4cc08e63c4641784bd648f2b85e42b2528e03b3a7d80d5d6b96e1eec5ea9cfdd2d1243dc855c9a05d0661fa3336f8d95b460be3b2bceab51936086
+DIST apparmor-2.8.4.tar.gz 1539923 SHA256 98cb81b2e2e17a8034005d2612ba6c33893486fdf995626f3bb94a4a082371d6 SHA512 d9f15bbfb4cb8428cacc7669099a0ce8acf33cbf309a65fea601f1d23b6e741a403eb4f8d91a8897f1959862f8d2ca8843918e56f511f2230e88476037511177 WHIRLPOOL 0520a5295a1184754c4d4dafe8253f4c0b6c8d0145ee586f0ecdab2d86630b7d08f8fd8ae87658c5663d3410575838b01d8c1ad2faec74271153c0d7a510e35b
diff --git a/sys-libs/libapparmor/libapparmor-2.8.3.ebuild b/sys-libs/libapparmor/libapparmor-2.8.3.ebuild
new file mode 100644
index 000000000000..00b4af1b19ad
--- /dev/null
+++ b/sys-libs/libapparmor/libapparmor-2.8.3.ebuild
@@ -0,0 +1,84 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+AUTOTOOLS_AUTORECONF=1
+DISTUTILS_OPTIONAL=1
+PYTHON_COMPAT=( python{2_7,3_3} )
+GENTOO_DEPEND_ON_PERL="no"
+
+inherit autotools-utils distutils-r1 perl-module versionator
+
+DESCRIPTION="Library to support AppArmor userspace utilities"
+HOMEPAGE="http://apparmor.net/"
+SRC_URI="http://launchpad.net/apparmor/$(get_version_component_range 1-2)/${PV}/+download/apparmor-${PV}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc +perl python static-libs"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+RDEPEND="perl? ( dev-lang/perl:= )
+ python? ( ${PYTHON_DEPS} )"
+
+DEPEND="${RDEPEND}
+ sys-devel/autoconf-archive
+ sys-devel/bison
+ sys-devel/flex
+ doc? ( dev-lang/perl )
+ perl? ( dev-lang/swig )
+ python? ( dev-lang/swig )"
+
+S=${WORKDIR}/apparmor-${PV}/libraries/${PN}
+
+src_prepare() {
+ rm -r m4 || die "failed to remove bundled macros"
+
+ autotools-utils_src_prepare
+ use python && distutils-r1_src_prepare
+}
+
+src_configure() {
+ local myeconfargs=(
+ $(use_with perl) \
+ $(use_with python)
+ )
+
+ autotools-utils_src_configure
+}
+
+src_compile() {
+ autotools-utils_src_compile -C src
+
+ use doc && autotools-utils_src_compile -C doc
+ use perl && autotools-utils_src_compile -C swig/perl
+
+ if use python ; then
+ pushd "${BUILD_DIR}"/swig/python > /dev/null
+ emake libapparmor_wrap.c
+ distutils-r1_src_compile
+ popd > /dev/null
+ fi
+}
+
+src_install() {
+ autotools-utils_src_install -C src
+ use doc && autotools-utils_src_install -C doc
+
+ if use perl ; then
+ autotools-utils_src_install -C swig/perl
+ perl_set_version
+ insinto "${VENDOR_ARCH}"
+ doins "${BUILD_DIR}"/swig/perl/LibAppArmor.pm
+ fi
+
+ if use python ; then
+ pushd "${BUILD_DIR}"/swig/python > /dev/null
+ distutils-r1_src_install
+ popd > /dev/null
+ fi
+}
diff --git a/sys-libs/libapparmor/libapparmor-2.8.4.ebuild b/sys-libs/libapparmor/libapparmor-2.8.4.ebuild
new file mode 100644
index 000000000000..0b3041d3a3aa
--- /dev/null
+++ b/sys-libs/libapparmor/libapparmor-2.8.4.ebuild
@@ -0,0 +1,84 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+AUTOTOOLS_AUTORECONF=1
+DISTUTILS_OPTIONAL=1
+PYTHON_COMPAT=( python{2_7,3_3,3_4} )
+GENTOO_DEPEND_ON_PERL="no"
+
+inherit autotools-utils distutils-r1 perl-module versionator
+
+DESCRIPTION="Library to support AppArmor userspace utilities"
+HOMEPAGE="http://apparmor.net/"
+SRC_URI="http://launchpad.net/apparmor/$(get_version_component_range 1-2)/${PV}/+download/apparmor-${PV}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc +perl python static-libs"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+RDEPEND="perl? ( dev-lang/perl:= )
+ python? ( ${PYTHON_DEPS} )"
+
+DEPEND="${RDEPEND}
+ sys-devel/autoconf-archive
+ sys-devel/bison
+ sys-devel/flex
+ doc? ( dev-lang/perl )
+ perl? ( dev-lang/swig )
+ python? ( dev-lang/swig )"
+
+S=${WORKDIR}/apparmor-${PV}/libraries/${PN}
+
+src_prepare() {
+ rm -r m4 || die "failed to remove bundled macros"
+
+ autotools-utils_src_prepare
+ use python && distutils-r1_src_prepare
+}
+
+src_configure() {
+ local myeconfargs=(
+ $(use_with perl) \
+ $(use_with python)
+ )
+
+ autotools-utils_src_configure
+}
+
+src_compile() {
+ autotools-utils_src_compile -C src
+
+ use doc && autotools-utils_src_compile -C doc
+ use perl && autotools-utils_src_compile -C swig/perl
+
+ if use python ; then
+ pushd "${BUILD_DIR}"/swig/python > /dev/null
+ emake libapparmor_wrap.c
+ distutils-r1_src_compile
+ popd > /dev/null
+ fi
+}
+
+src_install() {
+ autotools-utils_src_install -C src
+ use doc && autotools-utils_src_install -C doc
+
+ if use perl ; then
+ autotools-utils_src_install -C swig/perl
+ perl_set_version
+ insinto "${VENDOR_ARCH}"
+ doins "${BUILD_DIR}"/swig/perl/LibAppArmor.pm
+ fi
+
+ if use python ; then
+ pushd "${BUILD_DIR}"/swig/python > /dev/null
+ distutils-r1_src_install
+ popd > /dev/null
+ fi
+}
diff --git a/sys-libs/libapparmor/metadata.xml b/sys-libs/libapparmor/metadata.xml
new file mode 100644
index 000000000000..f60a2bbf973d
--- /dev/null
+++ b/sys-libs/libapparmor/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>hardened</herd>
+ <maintainer>
+ <email>kensington@gentoo.org</email>
+ </maintainer>
+ <upstream>
+ <remote-id type="launchpad">apparmor</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-libs/libavc1394/Manifest b/sys-libs/libavc1394/Manifest
new file mode 100644
index 000000000000..b603dbf22060
--- /dev/null
+++ b/sys-libs/libavc1394/Manifest
@@ -0,0 +1,2 @@
+DIST libavc1394-0.5.3.tar.gz 355976 SHA256 23c96822df4edc90e3da0f19b69d31fbf7c28d1aba393be387340a71460424a6 SHA512 36761830082c0040708074eea8124c2eb027e3bb80fdbb8978af5eabe655afd2e6c9d7fc2aa9d4aba4d4d218cba9fa41fa6079119a9e460900b1e17effb4c145 WHIRLPOOL f001090b91b10baacfe0d641ed8bbb511ccd32f1fc158d39f1ab663d37809f67e155c2d157266372693617e692c76ba2b58971759c9fb6c67662b00cc34c9052
+DIST libavc1394-0.5.4.tar.gz 341679 SHA256 7cb1ff09506ae911ca9860bef4af08c2403f3e131f6c913a2cbd6ddca4215b53 SHA512 ef07631cd2de9b79dec9d81247d705be318101e8f8a1fe007b946ffab3dfe7b97f392144614d867ef6b2315b6c0e82d53e915f07855d4e21401645293e18842a WHIRLPOOL 87d77193635c1fb4ce7b6b3547566c41dada6b0fc1acd522c93a582a6bdce07d939d171269475d8d5a9aae0bc84c2326df5c3db5378aefb9d60df988b907f09f
diff --git a/sys-libs/libavc1394/libavc1394-0.5.3.ebuild b/sys-libs/libavc1394/libavc1394-0.5.3.ebuild
new file mode 100644
index 000000000000..cc584b602b68
--- /dev/null
+++ b/sys-libs/libavc1394/libavc1394-0.5.3.ebuild
@@ -0,0 +1,21 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+DESCRIPTION="library for the 1394 Trade Association AV/C (Audio/Video Control) Digital Interface Command Set"
+HOMEPAGE="http://sourceforge.net/projects/libavc1394/"
+SRC_URI="mirror://sourceforge/libavc1394/${P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="alpha amd64 ia64 ppc ppc64 sparc x86"
+IUSE=""
+
+RDEPEND=">=sys-libs/libraw1394-0.8"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+src_install() {
+ emake DESTDIR="${D}" install || die
+ dodoc AUTHORS ChangeLog NEWS README TODO
+}
diff --git a/sys-libs/libavc1394/libavc1394-0.5.4-r1.ebuild b/sys-libs/libavc1394/libavc1394-0.5.4-r1.ebuild
new file mode 100644
index 000000000000..f53e3a5b4516
--- /dev/null
+++ b/sys-libs/libavc1394/libavc1394-0.5.4-r1.ebuild
@@ -0,0 +1,22 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit autotools-multilib
+
+DESCRIPTION="library for the 1394 Trade Association AV/C (Audio/Video Control) Digital Interface Command Set"
+HOMEPAGE="http://sourceforge.net/projects/libavc1394/"
+SRC_URI="mirror://sourceforge/libavc1394/${P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="alpha amd64 arm ia64 ppc ppc64 sparc x86"
+IUSE="static-libs"
+
+RDEPEND=">=sys-libs/libraw1394-2.1.0-r1[${MULTILIB_USEDEP}]
+ abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r4
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
diff --git a/sys-libs/libavc1394/libavc1394-0.5.4.ebuild b/sys-libs/libavc1394/libavc1394-0.5.4.ebuild
new file mode 100644
index 000000000000..2d08e7654671
--- /dev/null
+++ b/sys-libs/libavc1394/libavc1394-0.5.4.ebuild
@@ -0,0 +1,20 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit autotools-utils
+
+DESCRIPTION="library for the 1394 Trade Association AV/C (Audio/Video Control) Digital Interface Command Set"
+HOMEPAGE="http://sourceforge.net/projects/libavc1394/"
+SRC_URI="mirror://sourceforge/libavc1394/${P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="alpha amd64 arm ia64 ppc ppc64 sparc x86"
+IUSE="static-libs"
+
+RDEPEND=">=sys-libs/libraw1394-0.8"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
diff --git a/sys-libs/libavc1394/metadata.xml b/sys-libs/libavc1394/metadata.xml
new file mode 100644
index 000000000000..5d6da8b55696
--- /dev/null
+++ b/sys-libs/libavc1394/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>base-system</herd>
+ <upstream>
+ <remote-id type="sourceforge">libavc1394</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-libs/libcap-ng/Manifest b/sys-libs/libcap-ng/Manifest
new file mode 100644
index 000000000000..52418a019012
--- /dev/null
+++ b/sys-libs/libcap-ng/Manifest
@@ -0,0 +1,6 @@
+DIST libcap-ng-0.6.6.tar.gz 367231 SHA256 89589a29a6b19068edd650dd4f626c10e84bfe63eacae7b1fd1f98f3ac8ea00d SHA512 383aaa9e315e2498c779a17bef35df6aee072c42598d07d92bdd7a2328a3bcd22d5ec46d600babc467aa4d1b01e9dd660493dafba3b06c7ac81f35df9d4d6e3e WHIRLPOOL c1a72480d545b45ae385065449098f0878f8c8d138f1d9bd9b3445d1146fd6a227bb9b0ac0148542995c5b6683c7c5998d0cd61a369b9f5c84fb39a9dc5cf8a3
+DIST libcap-ng-0.7.3.tar.gz 392613 SHA256 5ca441c8d3a1e4cfe8a8151907977662679457311ccaa7eaac91447c33a35bb1 SHA512 f03a35c54b5998ef2e712540caa1f4ade37f9abe60992a1e727142b26815a4b8a7ce86ea94466fe692e4798c7297e5e1bbd338e5afe05689905ee9e0c0f16ef2 WHIRLPOOL 7752a70ea348dfc52537f67d5dccab03d598a112a7263a8811987453b53cda58643e938b4651c5cd8d0ea02f20fddc10bff2ac8bc23f68f97c9ab8c5791429ab
+DIST libcap-ng-0.7.4.tar.gz 407007 SHA256 48a2083276f9820cb92dcb05d001b30733bcbf48c14c230303cac3cd08b45b6b SHA512 443b92f44cffd4b436a2651eb3539c560382102d918faf63f993d3b6627c03e80f7b4a5105ddb040890ef82122a42ca6881795ab0639de337f693705f5506cf0 WHIRLPOOL 3d62f26fad8c9e7756374022982a4f2fcdde5af5532474dfa7eb6ba1bc7f97984691bdda8975ef32423b8e86af2462ef672ba3175a3121a484c46096cc8f10b2
+DIST libcap-ng-0.7.5.tar.gz 409426 SHA256 7ba01e73c027e4f17bff6cdd77c01b25987e58ed14e422a437e14df6e2dbca31 SHA512 947ec84037c6c383e47d7e15168058b01a0a6eddf73c94cea7e1d4c8b27af1d646b483abdf14d3aa8ecb35fda2ead803f8596aed023a7e5ff9396690313c24a1 WHIRLPOOL 8dc79529034f5ad2c4c8cc514157adfd9097b902647240134be82bd2bc2eb590adadb74c71f4324788702a0694d612ab0f5bdb9c0ddfc688407505ad23a39132
+DIST libcap-ng-0.7.6.tar.gz 417329 SHA256 9de3caebcc6248f3e9f8c278068253dee89c39d7ffcd284a10fc6ce2b06a2dff SHA512 838b8731d10c4adcfbc5fd1199d60f831dcb4e69cb3a645bd9e5c284c883ddbdc48289d696ecbed47a782112403210b685816935d2eec38f344adc1051d357fe WHIRLPOOL 3863f22d74e22cdfd88fc329a8f616fda1e846ed8489dcfe3a5bceeb76d847fce4b7fc3ac4166429b1e1c37691ac5b085e08c790b1c274b52551678797b7d4c3
+DIST libcap-ng-0.7.7.tar.gz 420178 SHA256 615549ce39b333f6b78baee0c0b4ef18bc726c6bf1cca123dfd89dd963f6d06b SHA512 eb049b29fdd31aa31c6c14ca023df62c2910504c1edd1242dba13579d0befae5b98249c22c145517bd5451969a0b186390dc11b2269e58001336e10c855e920c WHIRLPOOL 5d376b8d12ed8c19ca649095297e6016e86e5ad6112fd12685929bdd5f3c34bbcdf9c1c61cad44f44d3784192ca37df1a77c478e5fc15dacb20a2561ee945652
diff --git a/sys-libs/libcap-ng/files/libcap-ng-0.7.5-add-unistd_h.patch b/sys-libs/libcap-ng/files/libcap-ng-0.7.5-add-unistd_h.patch
new file mode 100644
index 000000000000..bfeef6e2da39
--- /dev/null
+++ b/sys-libs/libcap-ng/files/libcap-ng-0.7.5-add-unistd_h.patch
@@ -0,0 +1,20 @@
+utils/proc-llist.c: include <unistd.h>
+
+proc-llist.c references pid_t and uid_t types but does not include <unistd.h>. This
+works on glibc and uClibc because of the way their headers stack, but on musl (and
+possible other libc) this fails. POSIX mandates that <unistd.h> provides these. See
+Issue 6 at http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html.
+
+Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
+
+diff -Nuar libcap-ng-0.7.5.orig/utils/proc-llist.c libcap-ng-0.7.5/utils/proc-llist.c
+--- libcap-ng-0.7.5.orig/utils/proc-llist.c 2015-02-18 17:13:33.000000000 -0500
++++ libcap-ng-0.7.5/utils/proc-llist.c 2015-05-25 13:39:32.196624248 -0400
+@@ -24,6 +24,7 @@
+ #include "config.h"
+ #include <stdlib.h>
+ #include <string.h>
++#include <unistd.h>
+ #include "proc-llist.h"
+
+ void list_create(llist *l)
diff --git a/sys-libs/libcap-ng/libcap-ng-0.6.6.ebuild b/sys-libs/libcap-ng/libcap-ng-0.6.6.ebuild
new file mode 100644
index 000000000000..840a4a59b775
--- /dev/null
+++ b/sys-libs/libcap-ng/libcap-ng-0.6.6.ebuild
@@ -0,0 +1,117 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+SUPPORT_PYTHON_ABIS="1"
+RESTRICT_PYTHON_ABIS="*-jython *-pypy-*"
+
+inherit autotools flag-o-matic python
+
+DESCRIPTION="POSIX 1003.1e capabilities"
+HOMEPAGE="http://people.redhat.com/sgrubb/libcap-ng/"
+SRC_URI="http://people.redhat.com/sgrubb/${PN}/${P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 s390 sh sparc x86"
+IUSE="python static-libs"
+
+RDEPEND="sys-apps/attr
+ python? ( dev-lang/python )"
+DEPEND="${RDEPEND}
+ sys-kernel/linux-headers
+ python? ( >=dev-lang/swig-2 )"
+
+PYTHON_CFLAGS=("2.* + -fno-strict-aliasing")
+
+pkg_setup() {
+ use python && python_pkg_setup
+}
+
+src_prepare() {
+ # Disable byte-compilation of Python modules.
+ >py-compile
+
+ # Python bindings are built/tested/installed manually.
+ sed -i -e "/^SUBDIRS/s/ python//" bindings/Makefile.am || die
+
+ eautoreconf
+
+ use sparc && replace-flags -O? -O0
+}
+
+src_configure() {
+ econf \
+ $(use_enable static-libs static) \
+ $(use_with python)
+}
+
+src_compile() {
+ default
+
+ if use python; then
+ python_copy_sources bindings/python
+
+ building() {
+ emake \
+ CFLAGS="${CFLAGS}" \
+ PYTHON_VERSION="$(python_get_version)" \
+ pyexecdir="$(python_get_sitedir)" \
+ pythondir="$(python_get_sitedir)"
+ }
+ python_execute_function -s --source-dir bindings/python building
+ fi
+}
+
+src_test() {
+ if [[ "${EUID}" -eq 0 ]]; then
+ ewarn "Skipping tests due to root permissions."
+ return
+ fi
+
+ default
+
+ if use python; then
+ testing() {
+ emake \
+ PYTHON_VERSION="$(python_get_version)" \
+ pyexecdir="$(python_get_sitedir)" \
+ pythondir="$(python_get_sitedir)" \
+ TESTS_ENVIRONMENT="PYTHONPATH=..:../.libs" \
+ check
+ }
+ python_execute_function -s --source-dir bindings/python testing
+ fi
+}
+
+src_install() {
+ emake DESTDIR="${D}" install
+
+ if use python; then
+ installation() {
+ emake \
+ DESTDIR="${D}" \
+ PYTHON_VERSION="$(python_get_version)" \
+ pyexecdir="$(python_get_sitedir)" \
+ pythondir="$(python_get_sitedir)" \
+ install
+ }
+ python_execute_function -s --source-dir bindings/python installation
+
+ python_clean_installation_image
+ fi
+
+ dodoc AUTHORS ChangeLog README
+
+ rm -f "${ED}"/usr/lib*/${PN}.la
+}
+
+pkg_postinst() {
+ use python && python_mod_optimize capng.py
+}
+
+pkg_postrm() {
+ use python && python_mod_cleanup capng.py
+}
diff --git a/sys-libs/libcap-ng/libcap-ng-0.7.3.ebuild b/sys-libs/libcap-ng/libcap-ng-0.7.3.ebuild
new file mode 100644
index 000000000000..1a7dab609784
--- /dev/null
+++ b/sys-libs/libcap-ng/libcap-ng-0.7.3.ebuild
@@ -0,0 +1,115 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+SUPPORT_PYTHON_ABIS="1"
+RESTRICT_PYTHON_ABIS="*-jython *-pypy-*"
+
+inherit autotools flag-o-matic python
+
+DESCRIPTION="POSIX 1003.1e capabilities"
+HOMEPAGE="http://people.redhat.com/sgrubb/libcap-ng/"
+SRC_URI="http://people.redhat.com/sgrubb/${PN}/${P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86 ~arm-linux ~x86-linux"
+IUSE="python static-libs"
+
+RDEPEND="python? ( dev-lang/python )"
+DEPEND="${RDEPEND}
+ sys-kernel/linux-headers
+ python? ( >=dev-lang/swig-2 )"
+
+PYTHON_CFLAGS=("2.* + -fno-strict-aliasing")
+
+pkg_setup() {
+ use python && python_pkg_setup
+}
+
+src_prepare() {
+ # Disable byte-compilation of Python modules.
+ >py-compile
+
+ # Python bindings are built/tested/installed manually.
+ sed -i -e "/^SUBDIRS/s/ python//" bindings/Makefile.am || die
+ sed -i -e 's:AM_CONFIG_HEADER:AC_CONFIG_HEADERS:' configure.ac || die
+
+ eautoreconf
+
+ use sparc && replace-flags -O? -O0
+}
+
+src_configure() {
+ econf \
+ $(use_enable static-libs static) \
+ $(use_with python)
+}
+
+src_compile() {
+ default
+
+ if use python; then
+ python_copy_sources bindings/python
+
+ building() {
+ emake \
+ CFLAGS="${CFLAGS}" \
+ PYTHON_VERSION="$(python_get_version)" \
+ pyexecdir="$(python_get_sitedir)" \
+ pythondir="$(python_get_sitedir)"
+ }
+ python_execute_function -s --source-dir bindings/python building
+ fi
+}
+
+src_test() {
+ if [[ "${EUID}" -eq 0 ]]; then
+ ewarn "Skipping tests due to root permissions."
+ return
+ fi
+
+ default
+
+ if use python; then
+ testing() {
+ emake \
+ PYTHON_VERSION="$(python_get_version)" \
+ pyexecdir="$(python_get_sitedir)" \
+ pythondir="$(python_get_sitedir)" \
+ TESTS_ENVIRONMENT="PYTHONPATH=..:../.libs" \
+ check
+ }
+ python_execute_function -s --source-dir bindings/python testing
+ fi
+}
+
+src_install() {
+ default
+
+ if use python; then
+ installation() {
+ emake \
+ DESTDIR="${D}" \
+ PYTHON_VERSION="$(python_get_version)" \
+ pyexecdir="$(python_get_sitedir)" \
+ pythondir="$(python_get_sitedir)" \
+ install
+ }
+ python_execute_function -s --source-dir bindings/python installation
+
+ python_clean_installation_image
+ fi
+
+ rm -f "${ED}"/usr/lib*/${PN}.la
+}
+
+pkg_postinst() {
+ use python && python_mod_optimize capng.py
+}
+
+pkg_postrm() {
+ use python && python_mod_cleanup capng.py
+}
diff --git a/sys-libs/libcap-ng/libcap-ng-0.7.4.ebuild b/sys-libs/libcap-ng/libcap-ng-0.7.4.ebuild
new file mode 100644
index 000000000000..f8ec6eba0be3
--- /dev/null
+++ b/sys-libs/libcap-ng/libcap-ng-0.7.4.ebuild
@@ -0,0 +1,92 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+AUTOTOOLS_AUTORECONF=1
+AUTOTOOLS_PRUNE_LIBTOOL_FILES=all
+PYTHON_COMPAT=( python{2_7,3_3,3_4} )
+
+inherit autotools-utils flag-o-matic python-r1
+
+DESCRIPTION="POSIX 1003.1e capabilities"
+HOMEPAGE="http://people.redhat.com/sgrubb/libcap-ng/"
+SRC_URI="http://people.redhat.com/sgrubb/${PN}/${P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc ~x86 ~arm-linux ~x86-linux"
+IUSE="python static-libs"
+
+RDEPEND="python? ( ${PYTHON_DEPS} )"
+DEPEND="${RDEPEND}
+ sys-kernel/linux-headers
+ python? ( >=dev-lang/swig-2 )"
+
+src_prepare() {
+ sed -i -e 's:AM_CONFIG_HEADER:AC_CONFIG_HEADERS:' configure.ac || die
+
+ autotools-utils_src_prepare
+
+ use sparc && replace-flags -O? -O0
+}
+
+src_configure() {
+ local myeconfargs=(
+ --without-python
+ )
+
+ # set up the library build
+ autotools-utils_src_configure
+
+ if use python; then
+ python_parallel_foreach_impl \
+ autotools-utils_src_configure --with-python
+ fi
+}
+
+src_compile() {
+ autotools-utils_src_compile
+
+ if use python; then
+ python_compile() {
+ local CFLAGS=${CFLAGS}
+
+ python_is_python3 || CFLAGS+=" -fno-strict-aliasing"
+
+ emake "${@}" \
+ -C "${BUILD_DIR}"/bindings/python
+ }
+
+ # help build system find the right objects
+ python_foreach_impl python_compile \
+ VPATH="${BUILD_DIR}"/bindings/python \
+ LIBS="${BUILD_DIR}"/src/libcap-ng.la
+ fi
+}
+
+src_test() {
+ if [[ "${EUID}" -eq 0 ]]; then
+ ewarn "Skipping tests due to root permissions."
+ return
+ fi
+
+ autotools-utils_src_test
+
+ if use python; then
+ python_foreach_impl \
+ autotools-utils_src_compile -C bindings/python check \
+ VPATH="${BUILD_DIR}"/bindings/python:"${S}"/bindings/python/test
+ fi
+}
+
+src_install() {
+ autotools-utils_src_install
+
+ if use python; then
+ python_foreach_impl \
+ autotools-utils_src_install -C bindings/python \
+ VPATH="${BUILD_DIR}"/bindings/python
+ fi
+}
diff --git a/sys-libs/libcap-ng/libcap-ng-0.7.5.ebuild b/sys-libs/libcap-ng/libcap-ng-0.7.5.ebuild
new file mode 100644
index 000000000000..de617937f637
--- /dev/null
+++ b/sys-libs/libcap-ng/libcap-ng-0.7.5.ebuild
@@ -0,0 +1,93 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+AUTOTOOLS_AUTORECONF=1
+AUTOTOOLS_PRUNE_LIBTOOL_FILES=all
+PYTHON_COMPAT=( python{2_7,3_3,3_4} )
+
+inherit autotools-utils flag-o-matic python-r1
+
+DESCRIPTION="POSIX 1003.1e capabilities"
+HOMEPAGE="http://people.redhat.com/sgrubb/libcap-ng/"
+SRC_URI="http://people.redhat.com/sgrubb/${PN}/${P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~arm-linux ~x86-linux"
+IUSE="python static-libs"
+
+RDEPEND="python? ( ${PYTHON_DEPS} )"
+DEPEND="${RDEPEND}
+ sys-kernel/linux-headers
+ python? ( >=dev-lang/swig-2 )"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-add-unistd_h.patch
+ sed -i -e 's:AM_CONFIG_HEADER:AC_CONFIG_HEADERS:' configure.ac || die
+
+ autotools-utils_src_prepare
+
+ use sparc && replace-flags -O? -O0
+}
+
+src_configure() {
+ local myeconfargs=(
+ --without-python
+ )
+
+ # set up the library build
+ autotools-utils_src_configure
+
+ if use python; then
+ python_parallel_foreach_impl \
+ autotools-utils_src_configure --with-python
+ fi
+}
+
+src_compile() {
+ autotools-utils_src_compile
+
+ if use python; then
+ python_compile() {
+ local CFLAGS=${CFLAGS}
+
+ python_is_python3 || CFLAGS+=" -fno-strict-aliasing"
+
+ emake "${@}" \
+ -C "${BUILD_DIR}"/bindings/python
+ }
+
+ # help build system find the right objects
+ python_foreach_impl python_compile \
+ VPATH="${BUILD_DIR}"/bindings/python \
+ LIBS="${BUILD_DIR}"/src/libcap-ng.la
+ fi
+}
+
+src_test() {
+ if [[ "${EUID}" -eq 0 ]]; then
+ ewarn "Skipping tests due to root permissions."
+ return
+ fi
+
+ autotools-utils_src_test
+
+ if use python; then
+ python_foreach_impl \
+ autotools-utils_src_compile -C bindings/python check \
+ VPATH="${BUILD_DIR}"/bindings/python:"${S}"/bindings/python/test
+ fi
+}
+
+src_install() {
+ autotools-utils_src_install
+
+ if use python; then
+ python_foreach_impl \
+ autotools-utils_src_install -C bindings/python \
+ VPATH="${BUILD_DIR}"/bindings/python
+ fi
+}
diff --git a/sys-libs/libcap-ng/libcap-ng-0.7.6.ebuild b/sys-libs/libcap-ng/libcap-ng-0.7.6.ebuild
new file mode 100644
index 000000000000..ceab139e9ff3
--- /dev/null
+++ b/sys-libs/libcap-ng/libcap-ng-0.7.6.ebuild
@@ -0,0 +1,93 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+AUTOTOOLS_AUTORECONF=1
+AUTOTOOLS_PRUNE_LIBTOOL_FILES=all
+PYTHON_COMPAT=( python{2_7,3_3,3_4} )
+
+inherit autotools-utils flag-o-matic python-r1
+
+DESCRIPTION="POSIX 1003.1e capabilities"
+HOMEPAGE="http://people.redhat.com/sgrubb/libcap-ng/"
+SRC_URI="http://people.redhat.com/sgrubb/${PN}/${P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~arm-linux ~x86-linux"
+IUSE="python static-libs"
+
+RDEPEND="python? ( ${PYTHON_DEPS} )"
+DEPEND="${RDEPEND}
+ sys-kernel/linux-headers
+ python? ( >=dev-lang/swig-2 )"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-0.7.5-add-unistd_h.patch
+ sed -i -e 's:AM_CONFIG_HEADER:AC_CONFIG_HEADERS:' configure.ac || die
+
+ autotools-utils_src_prepare
+
+ use sparc && replace-flags -O? -O0
+}
+
+src_configure() {
+ local myeconfargs=(
+ --without-python
+ )
+
+ # set up the library build
+ autotools-utils_src_configure
+
+ if use python; then
+ python_parallel_foreach_impl \
+ autotools-utils_src_configure --with-python
+ fi
+}
+
+src_compile() {
+ autotools-utils_src_compile
+
+ if use python; then
+ python_compile() {
+ local CFLAGS=${CFLAGS}
+
+ python_is_python3 || CFLAGS+=" -fno-strict-aliasing"
+
+ emake "${@}" \
+ -C "${BUILD_DIR}"/bindings/python
+ }
+
+ # help build system find the right objects
+ python_foreach_impl python_compile \
+ VPATH="${BUILD_DIR}"/bindings/python \
+ LIBS="${BUILD_DIR}"/src/libcap-ng.la
+ fi
+}
+
+src_test() {
+ if [[ "${EUID}" -eq 0 ]]; then
+ ewarn "Skipping tests due to root permissions."
+ return
+ fi
+
+ autotools-utils_src_test
+
+ if use python; then
+ python_foreach_impl \
+ autotools-utils_src_compile -C bindings/python check \
+ VPATH="${BUILD_DIR}"/bindings/python:"${S}"/bindings/python/test
+ fi
+}
+
+src_install() {
+ autotools-utils_src_install
+
+ if use python; then
+ python_foreach_impl \
+ autotools-utils_src_install -C bindings/python \
+ VPATH="${BUILD_DIR}"/bindings/python
+ fi
+}
diff --git a/sys-libs/libcap-ng/libcap-ng-0.7.7.ebuild b/sys-libs/libcap-ng/libcap-ng-0.7.7.ebuild
new file mode 100644
index 000000000000..a979b1c80802
--- /dev/null
+++ b/sys-libs/libcap-ng/libcap-ng-0.7.7.ebuild
@@ -0,0 +1,100 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+AUTOTOOLS_AUTORECONF=1
+AUTOTOOLS_PRUNE_LIBTOOL_FILES=all
+PYTHON_COMPAT=( python{2_7,3_3,3_4} )
+
+inherit autotools-utils flag-o-matic python-r1
+
+DESCRIPTION="POSIX 1003.1e capabilities"
+HOMEPAGE="http://people.redhat.com/sgrubb/libcap-ng/"
+SRC_URI="http://people.redhat.com/sgrubb/${PN}/${P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~arm-linux ~x86-linux"
+IUSE="python static-libs"
+
+RDEPEND="python? ( ${PYTHON_DEPS} )"
+DEPEND="${RDEPEND}
+ sys-kernel/linux-headers
+ python? ( >=dev-lang/swig-2 )"
+
+RESTRICT="test"
+
+src_prepare() {
+ sed -i -e 's:AM_CONFIG_HEADER:AC_CONFIG_HEADERS:' configure.ac || die
+
+ autotools-utils_src_prepare
+
+ use sparc && replace-flags -O? -O0
+}
+
+src_configure() {
+ # set up the library build
+ local myeconfargs=( --without-python --without-python3 )
+ autotools-utils_src_configure
+
+ # set up python bindings build(s)
+ if use python ; then
+ setup_python_flags_configure() {
+ if [[ ${EPYTHON} == python2* ]] ; then
+ myeconfargs=( --with-python --without-python3 )
+ else
+ myeconfargs=( --with-python --with-python3 )
+ fi
+ autotools-utils_src_configure
+ }
+
+ python_foreach_impl setup_python_flags_configure
+ fi
+}
+
+src_compile() {
+ autotools-utils_src_compile
+
+ if use python; then
+ python_compile() {
+ local CFLAGS=${CFLAGS}
+
+ python_is_python3 || CFLAGS+=" -fno-strict-aliasing"
+
+ emake "${@}" \
+ -C "${BUILD_DIR}"/bindings/python
+ }
+
+ # help build system find the right objects
+ python_foreach_impl python_compile \
+ VPATH="${BUILD_DIR}"/bindings/python \
+ LIBS="${BUILD_DIR}"/src/libcap-ng.la
+ fi
+}
+
+src_test() {
+ if [[ "${EUID}" -eq 0 ]]; then
+ ewarn "Skipping tests due to root permissions."
+ return
+ fi
+
+ autotools-utils_src_test
+
+ if use python; then
+ python_foreach_impl \
+ autotools-utils_src_compile -C bindings/python check \
+ VPATH="${BUILD_DIR}"/bindings/python:"${S}"/bindings/python/test
+ fi
+}
+
+src_install() {
+ autotools-utils_src_install
+
+ if use python; then
+ python_foreach_impl \
+ autotools-utils_src_install -C bindings/python \
+ VPATH="${BUILD_DIR}"/bindings/python
+ fi
+}
diff --git a/sys-libs/libcap-ng/metadata.xml b/sys-libs/libcap-ng/metadata.xml
new file mode 100644
index 000000000000..703c25260d21
--- /dev/null
+++ b/sys-libs/libcap-ng/metadata.xml
@@ -0,0 +1,10 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>base-system</herd>
+ <longdescription>The libcap-ng library is intended to make programming with
+ POSIX capabilities much easier than the traditional libcap library. It
+ includes utilities that can analyse all currently running applications and
+ print out any capabilities and whether or not it has an open ended bounding
+ set.</longdescription>
+</pkgmetadata>
diff --git a/sys-libs/libcap/Manifest b/sys-libs/libcap/Manifest
new file mode 100644
index 000000000000..fa1d8b6fa387
--- /dev/null
+++ b/sys-libs/libcap/Manifest
@@ -0,0 +1,6 @@
+DIST libcap-2.17.tar.bz2 48899 SHA256 2cab109eed9bd944408c13efed910091479d8770cf9aa1bec4f9b26d9302f5b0 SHA512 f8c79889359f92c9f714b4fe602454f0e0ae7c78bf2fa2ddf849a1cda05a8ef7d993c69f7662cbb8939e42da6a43b401e9199d5aa9de220eafcede9a06f727b5 WHIRLPOOL dc6cb019ec32c529600eb8198098b69157b2ebf279e0b003a003e906aedda07ebac355cdcbbebde222aa1ab9a2d22be34b2b216b0c1249134404a736a540bea4
+DIST libcap-2.19.tar.bz2 53099 SHA256 ed1693e344054a398e68a7cc840892e3d1a880562743bdf28fd918649aa5a4ce SHA512 1453e3014fdff57c01e3dca5a4b5d1754e641ecb4011296a39d0d088ee1fe371e13f851ae2c6c29e7f0d7bfeeeb4c2a11d112da6ed4600f5d489788faaee9fb2 WHIRLPOOL 2b6ee718d91902617dda3cb7beaa3bf29e785dc635f33af635ab74245259dd0d81f8da1cc5bd38bbed8ff85752536b2596941c4da581a29d7380d039218fbd49
+DIST libcap-2.20.tar.bz2 53629 SHA256 20e7c1ea4d3d5c410efb3a6ff138dc417912fae316d883460dcd58d9803a9220 SHA512 3ab62d1a563d1f380485b4cb6ba77e9a4c8806b9d6b115c0bc9bad8c1e251bb4906a8b2cc21b07c0c274811e2f6d2aa3840696babb9348dcdf25eae166214810 WHIRLPOOL eb84e9fad6056d02e482e582fc26bcbeac456da7d0daeb1ad43f54056afd814bdeef231acd3037eab44eb3a5d7a4c23c7638a73ca7ee706a1c75e739edbc36a3
+DIST libcap-2.21.tar.bz2 54360 SHA256 9e1615bb331786eb6cb3968ca27153bcfac8a16cf8db9253b8407faa53b3f011 SHA512 71398dacc4dc3b896233d6c991f07b0913253512961195c597cd4f6714c316df2ae1954da1bf60c7d6011e67dcefda7f7effd6cd37be6e215a29fc7d81eaad2e WHIRLPOOL c5fff6a9a6e6c4c1b186422891d38f5dffab8b40f62ee54625359bb7980d4de8557979f78c459b9c4545496e8649cecc32983d2581d17e4b7349c85e882d7950
+DIST libcap-2.22.tar.bz2 60051 SHA256 73ebbd4877b5f69dd28b72098e510c5b318bc480f8201c4061ac98b78c04050f SHA512 d4e070cfed7dbf416c949e79fbfbfcde2da4705d4f55527b18482c9959b80fea2841bf70f317fa5e620e13a75a8e5da69f94304b8e54195f2d0492f14d342339 WHIRLPOOL 000e3c76e83366423efc0e935c6191496c0e9bf1cc559babdbeea74c8c81009e883985c5f1c739b4fb1744522e09bda253f6012b7e52284f291eabeaf20f6a88
+DIST libcap-2.24.tar.xz 63412 SHA256 cee4568f78dc851d726fc93f25f4ed91cc223b1fe8259daa4a77158d174e6c65 SHA512 c062bab936d651a50efa66dcfa51ab3ce4b0881195d23bb32142b5c8044d30e0e2152f3497844ce90c04f909aeffe2d41203efff41972e38758dcca7b653884b WHIRLPOOL bb7a9d8d3b999ad289962ebdc8b9eff87e25bd744a86ee4717e999738cb5a556a51826d0f0cbfc628629948fa8355d5d972208910d6c1c99bdf66a673b6f1cc8
diff --git a/sys-libs/libcap/files/2.16/0001-build-system-fixes.patch b/sys-libs/libcap/files/2.16/0001-build-system-fixes.patch
new file mode 100644
index 000000000000..e82975ba8f90
--- /dev/null
+++ b/sys-libs/libcap/files/2.16/0001-build-system-fixes.patch
@@ -0,0 +1,154 @@
+From 7ee197885e113878aedab58bdda80302e42aff4c Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Sun, 16 Nov 2008 09:10:31 -0500
+Subject: [PATCH] build system fixes
+
+This touches up the homebrewed build system to work much better "out of the
+box" for people. Specifically:
+ - allow toolchain vars to be set via environment
+ - CC / BUILD_CC / AR / RANLIB
+ - CFLAGS / CPPFLAGS / LDFLAGS
+ - split CPPFLAGS out of CFLAGS
+ - break -fPIC out of global CFLAGS and only use where needed
+ - use LDLIBS for libraries, not LDFLAGS
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ Make.Rules | 28 ++++++++++++++--------------
+ libcap/Makefile | 11 ++++++-----
+ pam_cap/Makefile | 6 +++---
+ progs/Makefile | 2 +-
+ 4 files changed, 24 insertions(+), 23 deletions(-)
+
+diff --git a/Make.Rules b/Make.Rules
+index 6e63a5b..32cb5ea 100644
+--- a/Make.Rules
++++ b/Make.Rules
+@@ -42,27 +42,27 @@ MINOR=16
+
+ # Compilation specifics
+
+-KERNEL_HEADERS := $(topdir)/libcap/include
+-IPATH += -I$(topdir)/libcap/include -I$(KERNEL_HEADERS)
+-
+-CC := gcc
+-CFLAGS := -O2
+-BUILD_CC := $(CC)
+-BUILD_CFLAGS := $(CFLAGS) $(IPATH)
+-AR := ar
+-RANLIB := ranlib
+-DEBUG = -g #-DDEBUG
+-WARNINGS=-fPIC -Wall -Wwrite-strings \
++CC ?= gcc
++BUILD_CC ?= $(CC)
++AR ?= ar
++RANLIB ?= ranlib
++CFLAGS ?= -O2
++BUILD_CFLAGS ?= -O2 -pipe
++WARNINGS=-Wall -Wwrite-strings \
+ -Wpointer-arith -Wcast-qual -Wcast-align \
+ -Wstrict-prototypes -Wmissing-prototypes \
+ -Wnested-externs -Winline -Wshadow
+ LD=$(CC) -Wl,-x -shared
+-LDFLAGS := #-g
++LDFLAGS ?= #-g
+
+-SYSTEM_HEADERS = /usr/include
++KERNEL_HEADERS = $(topdir)/libcap/include
++LIBCAP_CPPFLAGS = -I$(topdir)/libcap/include -I$(KERNEL_HEADERS)
++CPPFLAGS += $(LIBCAP_CPPFLAGS)
++BUILD_CPPFLAGS += $(LIBCAP_CPPFLAGS)
+ INCS=$(topdir)/libcap/include/sys/capability.h
+ LDFLAGS += -L$(topdir)/libcap
+-CFLAGS += -Dlinux $(WARNINGS) $(DEBUG) $(IPATH)
++CPPFLAGS += -Dlinux
++CFLAGS += $(WARNINGS)
+ PAM_CAP := $(shell if [ -f /usr/include/security/pam_modules.h ]; then echo yes ; else echo no ; fi)
+ INDENT := $(shell if [ -n "$(which indent 2>/dev/null)" ]; then echo "| indent -kr" ; fi)
+ DYNAMIC := $(shell if [ ! -d "$(topdir)/.git" ]; then echo yes; fi)
+diff --git a/libcap/Makefile b/libcap/Makefile
+index 8a61752..cf99523 100644
+--- a/libcap/Makefile
++++ b/libcap/Makefile
+@@ -16,7 +16,7 @@ FILES=cap_alloc cap_proc cap_extint cap_flag cap_text
+ # no support).
+ ifeq ($(LIBATTR),yes)
+ FILES += cap_file
+-LDFLAGS += -lattr
++LDLIBS += -lattr
+ endif
+
+ INCLS=libcap.h cap_names.h $(INCS)
+@@ -24,6 +24,7 @@ OBJS=$(addsuffix .o, $(FILES))
+ MAJLIBNAME=$(LIBNAME).$(VERSION)
+ MINLIBNAME=$(MAJLIBNAME).$(MINOR)
+ GPERF_OUTPUT = _caps_output.gperf
++CFLAGS += -fPIC
+
+ all: $(MINLIBNAME) $(STALIBNAME)
+
+@@ -33,7 +34,7 @@ INCLUDE_GPERF_OUTPUT = -include $(GPERF_OUTPUT)
+ endif
+
+ _makenames: _makenames.c cap_names.list.h
+- $(BUILD_CC) $(BUILD_CFLAGS) $< -o $@
++ $(BUILD_CC) $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $< -o $@
+
+ cap_names.h: _makenames
+ ./_makenames > cap_names.h
+@@ -50,15 +51,15 @@ $(STALIBNAME): $(OBJS)
+ $(RANLIB) $@
+
+ $(MINLIBNAME): $(OBJS)
+- $(LD) $(CFLAGS) $(LDFLAGS) -Wl,-soname,$(MAJLIBNAME) -o $@ $^
++ $(LD) $(CFLAGS) $(LDFLAGS) -Wl,-soname,$(MAJLIBNAME) -o $@ $^ $(LDLIBS)
+ ln -sf $(MINLIBNAME) $(MAJLIBNAME)
+ ln -sf $(MAJLIBNAME) $(LIBNAME)
+
+ %.o: %.c $(INCLS)
+- $(CC) $(CFLAGS) -c $< -o $@
++ $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
+
+ cap_text.o: cap_text.c $(USE_GPERF_OUTPUT) $(INCLS)
+- $(CC) $(CFLAGS) $(INCLUDE_GPERF_OUTPUT) -c $< -o $@
++ $(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDE_GPERF_OUTPUT) -c $< -o $@
+
+ install: all
+ mkdir -p -m 0755 $(INCDIR)/sys
+diff --git a/pam_cap/Makefile b/pam_cap/Makefile
+index eae88ed..bef59d2 100644
+--- a/pam_cap/Makefile
++++ b/pam_cap/Makefile
+@@ -14,13 +14,13 @@ install: all
+ install -m 0755 pam_cap.so $(LIBDIR)/security
+
+ pam_cap.so: pam_cap.o
+- $(LD) $(LDFLAGS) -o pam_cap.so $< $(LDLIBS)
++ $(LD) $(CFLAGS) $(LDFLAGS) -o pam_cap.so $< $(LDLIBS) -lpam
+
+ pam_cap.o: pam_cap.c
+- $(CC) $(CFLAGS) -c $< -o $@
++ $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
+
+ testcompile: test.c pam_cap.o
+- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $+ -lpam -ldl $(LDLIBS)
++ $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $+ -lpam -ldl $(LDLIBS)
+
+ clean:
+ rm -f *.o *.so testcompile *~
+diff --git a/progs/Makefile b/progs/Makefile
+index a1542dc..612cf86 100644
+--- a/progs/Makefile
++++ b/progs/Makefile
+@@ -22,7 +22,7 @@ $(BUILD): %: %.o
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDLIBS)
+
+ %.o: %.c $(INCS)
+- $(CC) $(CFLAGS) -c $< -o $@
++ $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
+
+ install: all
+ mkdir -p -m 0755 $(SBINDIR)
+--
+1.6.0.4
+
diff --git a/sys-libs/libcap/files/libcap-2.20-build-system-fixes.patch b/sys-libs/libcap/files/libcap-2.20-build-system-fixes.patch
new file mode 100644
index 000000000000..c7273df39a8c
--- /dev/null
+++ b/sys-libs/libcap/files/libcap-2.20-build-system-fixes.patch
@@ -0,0 +1,162 @@
+From 5540f3c2a3bd70ebc8140b74ac5a0aecdbc53234 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Sun, 16 Nov 2008 09:10:31 -0500
+Subject: [PATCH] build system fixes
+
+This touches up the homebrewed build system to work much better "out of the
+box" for people. Specifically:
+ - allow toolchain vars to be set via environment
+ - CC / BUILD_CC / AR / RANLIB
+ - CFLAGS / CPPFLAGS / LDFLAGS
+ - split CPPFLAGS out of CFLAGS
+ - break -fPIC out of global CFLAGS and only use where needed
+ - use LDLIBS for libraries, not LDFLAGS
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ Make.Rules | 25 +++++++++++++------------
+ libcap/Makefile | 11 ++++++-----
+ pam_cap/Makefile | 8 +++++---
+ progs/Makefile | 2 +-
+ 4 files changed, 25 insertions(+), 21 deletions(-)
+
+diff --git a/Make.Rules b/Make.Rules
+index 011aa14..6e432a6 100644
+--- a/Make.Rules
++++ b/Make.Rules
+@@ -44,27 +44,28 @@ MINOR=19
+
+ # Compilation specifics
+
+-KERNEL_HEADERS := $(topdir)/libcap/include
+-IPATH += -fPIC -I$(topdir)/libcap/include -I$(KERNEL_HEADERS)
+-
+-CC := gcc
+-CFLAGS := -O2
+-BUILD_CC := $(CC)
+-BUILD_CFLAGS := $(CFLAGS) $(IPATH)
+-AR := ar
+-RANLIB := ranlib
++CC ?= gcc
++CFLAGS ?= -O2
++BUILD_CC ?= $(CC)
++BUILD_CFLAGS ?= $(CFLAGS)
++AR ?= ar
++RANLIB ?= ranlib
+ DEBUG = -g #-DDEBUG
+ WARNINGS=-Wall -Wwrite-strings \
+ -Wpointer-arith -Wcast-qual -Wcast-align \
+ -Wstrict-prototypes -Wmissing-prototypes \
+ -Wnested-externs -Winline -Wshadow
+ LD=$(CC) -Wl,-x -shared
+-LDFLAGS := #-g
++LDFLAGS ?= #-g
+
+-SYSTEM_HEADERS = /usr/include
++KERNEL_HEADERS = $(topdir)/libcap/include
++LIBCAP_CPPFLAGS = -I$(topdir)/libcap/include -I$(KERNEL_HEADERS)
++CPPFLAGS += $(LIBCAP_CPPFLAGS)
++BUILD_CPPFLAGS += $(LIBCAP_CPPFLAGS)
+ INCS=$(topdir)/libcap/include/sys/capability.h
+ LDFLAGS += -L$(topdir)/libcap
+-CFLAGS += -Dlinux $(WARNINGS) $(DEBUG)
++CPPFLAGS += -Dlinux
++CFLAGS += $(WARNINGS) $(DEBUG)
+ PAM_CAP := $(shell if [ -f /usr/include/security/pam_modules.h ]; then echo yes ; else echo no ; fi)
+ INDENT := $(shell if [ -n "$(which indent 2>/dev/null)" ]; then echo "| indent -kr" ; fi)
+ DYNAMIC := $(shell if [ ! -d "$(topdir)/.git" ]; then echo yes; fi)
+diff --git a/libcap/Makefile b/libcap/Makefile
+index 4762c60..cf99523 100644
+--- a/libcap/Makefile
++++ b/libcap/Makefile
+@@ -16,7 +16,7 @@ FILES=cap_alloc cap_proc cap_extint cap_flag cap_text
+ # no support).
+ ifeq ($(LIBATTR),yes)
+ FILES += cap_file
+-LDFLAGS += -lattr
++LDLIBS += -lattr
+ endif
+
+ INCLS=libcap.h cap_names.h $(INCS)
+@@ -24,6 +24,7 @@ OBJS=$(addsuffix .o, $(FILES))
+ MAJLIBNAME=$(LIBNAME).$(VERSION)
+ MINLIBNAME=$(MAJLIBNAME).$(MINOR)
+ GPERF_OUTPUT = _caps_output.gperf
++CFLAGS += -fPIC
+
+ all: $(MINLIBNAME) $(STALIBNAME)
+
+@@ -33,7 +34,7 @@ INCLUDE_GPERF_OUTPUT = -include $(GPERF_OUTPUT)
+ endif
+
+ _makenames: _makenames.c cap_names.list.h
+- $(BUILD_CC) $(BUILD_CFLAGS) $< -o $@
++ $(BUILD_CC) $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $< -o $@
+
+ cap_names.h: _makenames
+ ./_makenames > cap_names.h
+@@ -50,15 +51,15 @@ $(STALIBNAME): $(OBJS)
+ $(RANLIB) $@
+
+ $(MINLIBNAME): $(OBJS)
+- $(LD) $(CFLAGS) $(LDFLAGS) -Wl,-soname,$(MAJLIBNAME) -o $@ $^
++ $(LD) $(CFLAGS) $(LDFLAGS) -Wl,-soname,$(MAJLIBNAME) -o $@ $^ $(LDLIBS)
+ ln -sf $(MINLIBNAME) $(MAJLIBNAME)
+ ln -sf $(MAJLIBNAME) $(LIBNAME)
+
+ %.o: %.c $(INCLS)
+- $(CC) $(CFLAGS) $(IPATH) -c $< -o $@
++ $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
+
+ cap_text.o: cap_text.c $(USE_GPERF_OUTPUT) $(INCLS)
+- $(CC) $(CFLAGS) $(IPATH) $(INCLUDE_GPERF_OUTPUT) -c $< -o $@
++ $(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDE_GPERF_OUTPUT) -c $< -o $@
+
+ install: all
+ mkdir -p -m 0755 $(INCDIR)/sys
+diff --git a/pam_cap/Makefile b/pam_cap/Makefile
+index 9ca5bef..bdae933 100644
+--- a/pam_cap/Makefile
++++ b/pam_cap/Makefile
+@@ -9,6 +9,8 @@ include ../Make.Rules
+ # written (and you know why it fails), email me and explain why. Thanks!
+ LDLIBS += -L../libcap -lcap
+
++CFLAGS += -fPIC
++
+ all: pam_cap.so
+ $(MAKE) testcompile
+
+@@ -17,13 +19,13 @@ install: all
+ install -m 0755 pam_cap.so $(LIBDIR)/security
+
+ pam_cap.so: pam_cap.o
+- $(LD) $(LDFLAGS) -o pam_cap.so $< $(LDLIBS)
++ $(LD) $(CFLAGS) $(LDFLAGS) -o pam_cap.so $< $(LDLIBS)
+
+ pam_cap.o: pam_cap.c
+- $(CC) $(CFLAGS) $(IPATH) -c $< -o $@
++ $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
+
+ testcompile: test.c pam_cap.o
+- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $+ -lpam -ldl $(LDLIBS)
++ $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $+ -lpam -ldl $(LDLIBS)
+
+ clean:
+ rm -f *.o *.so testcompile *~
+diff --git a/progs/Makefile b/progs/Makefile
+index ef51dc6..c261f57 100644
+--- a/progs/Makefile
++++ b/progs/Makefile
+@@ -22,7 +22,7 @@ $(BUILD): %: %.o
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDLIBS)
+
+ %.o: %.c $(INCS)
+- $(CC) $(IPATH) $(CFLAGS) -c $< -o $@
++ $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
+
+ install: all
+ mkdir -p -m 0755 $(SBINDIR)
+--
+1.7.4.rc2
+
diff --git a/sys-libs/libcap/files/libcap-2.20-ignore-RAISE_SETFCAP-install-failures.patch b/sys-libs/libcap/files/libcap-2.20-ignore-RAISE_SETFCAP-install-failures.patch
new file mode 100644
index 000000000000..1bc4d63ebb1a
--- /dev/null
+++ b/sys-libs/libcap/files/libcap-2.20-ignore-RAISE_SETFCAP-install-failures.patch
@@ -0,0 +1,29 @@
+From f2020ee4ee4b2f245637c77e81d62ab6d1db3c6c Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Tue, 25 Jan 2011 15:52:31 -0500
+Subject: [PATCH] ignore RAISE_SETFCAP install failures
+
+While the new RAISE_SETFCAP feature is nifty, its failure to run (often
+due to the fs not supporting it) shouldn't impair the default install.
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ progs/Makefile | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/progs/Makefile b/progs/Makefile
+index c261f57..9e1a84d 100644
+--- a/progs/Makefile
++++ b/progs/Makefile
+@@ -30,7 +30,7 @@ install: all
+ install -m 0755 $$p $(SBINDIR) ; \
+ done
+ ifeq ($(RAISE_SETFCAP),yes)
+- $(SBINDIR)/setcap cap_setfcap=i $(SBINDIR)/setcap
++ -$(SBINDIR)/setcap cap_setfcap=i $(SBINDIR)/setcap
+ endif
+
+ clean:
+--
+1.7.4.rc2
+
diff --git a/sys-libs/libcap/files/libcap-2.21-include.patch b/sys-libs/libcap/files/libcap-2.21-include.patch
new file mode 100644
index 000000000000..2a534246ee01
--- /dev/null
+++ b/sys-libs/libcap/files/libcap-2.21-include.patch
@@ -0,0 +1,10 @@
+--- libcap/libcap.h.org 2011-06-15 07:25:58.912480899 +0200
++++ libcap/libcap.h 2011-06-15 07:26:16.421329661 +0200
+@@ -13,6 +13,7 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <sys/capability.h>
++#include <sys/prctl.h> /* prctl() */
+
+ #ifndef __u8
+ #define __u8 unsigned char
diff --git a/sys-libs/libcap/files/libcap-2.22-build-system-fixes.patch b/sys-libs/libcap/files/libcap-2.22-build-system-fixes.patch
new file mode 100644
index 000000000000..888c0897652b
--- /dev/null
+++ b/sys-libs/libcap/files/libcap-2.22-build-system-fixes.patch
@@ -0,0 +1,171 @@
+From 5540f3c2a3bd70ebc8140b74ac5a0aecdbc53234 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Sun, 16 Nov 2008 09:10:31 -0500
+Subject: [PATCH] build system fixes
+
+This touches up the homebrewed build system to work much better "out of the
+box" for people. Specifically:
+ - allow toolchain vars to be set via environment
+ - CC / BUILD_CC / AR / RANLIB
+ - CFLAGS / CPPFLAGS / LDFLAGS
+ - split CPPFLAGS out of CFLAGS
+ - break -fPIC out of global CFLAGS and only use where needed
+ - use LDLIBS for libraries, not LDFLAGS
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ Make.Rules | 25 +++++++++++++------------
+ libcap/Makefile | 11 ++++++-----
+ pam_cap/Makefile | 8 +++++---
+ progs/Makefile | 2 +-
+ 4 files changed, 25 insertions(+), 21 deletions(-)
+
+diff --git a/Make.Rules b/Make.Rules
+index 011aa14..6e432a6 100644
+--- a/Make.Rules
++++ b/Make.Rules
+@@ -44,27 +44,28 @@ MINOR=19
+
+ # Compilation specifics
+
+-KERNEL_HEADERS := $(topdir)/libcap/include
+-IPATH += -fPIC -I$(topdir)/libcap/include -I$(KERNEL_HEADERS)
+-
+-CC := gcc
+-CFLAGS := -O2 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
+-BUILD_CC := $(CC)
+-BUILD_CFLAGS := $(CFLAGS) $(IPATH)
+-AR := ar
+-RANLIB := ranlib
++CC ?= gcc
++CFLAGS ?= -O2
++BUILD_CC ?= $(CC)
++BUILD_CFLAGS ?= $(CFLAGS)
++AR ?= ar
++RANLIB ?= ranlib
+ DEBUG = -g #-DDEBUG
+ WARNINGS=-Wall -Wwrite-strings \
+ -Wpointer-arith -Wcast-qual -Wcast-align \
+ -Wstrict-prototypes -Wmissing-prototypes \
+ -Wnested-externs -Winline -Wshadow
+ LD=$(CC) -Wl,-x -shared
+-LDFLAGS := #-g
++LDFLAGS ?= #-g
+
+-SYSTEM_HEADERS = /usr/include
++KERNEL_HEADERS = $(topdir)/libcap/include
++LIBCAP_CPPFLAGS = -I$(topdir)/libcap/include -I$(KERNEL_HEADERS)
++CPPFLAGS += $(LIBCAP_CPPFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
++BUILD_CPPFLAGS += $(LIBCAP_CPPFLAGS)
+ INCS=$(topdir)/libcap/include/sys/capability.h
+ LDFLAGS += -L$(topdir)/libcap
+-CFLAGS += -Dlinux $(WARNINGS) $(DEBUG)
++CPPFLAGS += -Dlinux
++CFLAGS += $(WARNINGS) $(DEBUG)
+ PAM_CAP := $(shell if [ -f /usr/include/security/pam_modules.h ]; then echo yes ; else echo no ; fi)
+ INDENT := $(shell if [ -n "$(which indent 2>/dev/null)" ]; then echo "| indent -kr" ; fi)
+ DYNAMIC := $(shell if [ ! -d "$(topdir)/.git" ]; then echo yes; fi)
+diff --git a/libcap/Makefile b/libcap/Makefile
+index 4762c60..cf99523 100644
+--- a/libcap/Makefile
++++ b/libcap/Makefile
+@@ -16,7 +16,7 @@ FILES=cap_alloc cap_proc cap_extint cap_flag cap_text
+ # no support).
+ ifeq ($(LIBATTR),yes)
+ FILES += cap_file
+-LDFLAGS += -lattr
++LDLIBS += -lattr
+ endif
+
+ INCLS=libcap.h cap_names.h $(INCS)
+@@ -24,6 +24,7 @@ OBJS=$(addsuffix .o, $(FILES))
+ MAJLIBNAME=$(LIBNAME).$(VERSION)
+ MINLIBNAME=$(MAJLIBNAME).$(MINOR)
+ GPERF_OUTPUT = _caps_output.gperf
++CFLAGS += -fPIC
+
+ all: $(MINLIBNAME) $(STALIBNAME)
+
+@@ -33,7 +34,7 @@ INCLUDE_GPERF_OUTPUT = -include $(GPERF_OUTPUT)
+ endif
+
+ _makenames: _makenames.c cap_names.list.h
+- $(BUILD_CC) $(BUILD_CFLAGS) $< -o $@
++ $(BUILD_CC) $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $< -o $@
+
+ cap_names.h: _makenames
+ ./_makenames > cap_names.h
+@@ -50,15 +51,15 @@ $(STALIBNAME): $(OBJS)
+ $(RANLIB) $@
+
+ $(MINLIBNAME): $(OBJS)
+- $(LD) $(CFLAGS) $(LDFLAGS) -Wl,-soname,$(MAJLIBNAME) -o $@ $^
++ $(LD) $(CFLAGS) $(LDFLAGS) -Wl,-soname,$(MAJLIBNAME) -o $@ $^ $(LDLIBS)
+ ln -sf $(MINLIBNAME) $(MAJLIBNAME)
+ ln -sf $(MAJLIBNAME) $(LIBNAME)
+
+ %.o: %.c $(INCLS)
+- $(CC) $(CFLAGS) $(IPATH) -c $< -o $@
++ $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
+
+ cap_text.o: cap_text.c $(USE_GPERF_OUTPUT) $(INCLS)
+- $(CC) $(CFLAGS) $(IPATH) $(INCLUDE_GPERF_OUTPUT) -c $< -o $@
++ $(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDE_GPERF_OUTPUT) -c $< -o $@
+
+ install: all
+ mkdir -p -m 0755 $(INCDIR)/sys
+@@ -77,7 +77,7 @@ install: all
+ install -m 0644 include/sys/capability.h $(INCDIR)/sys
+ mkdir -p -m 0755 $(LIBDIR)
+ install -m 0644 $(STALIBNAME) $(LIBDIR)/$(STALIBNAME)
+- install -m 0644 $(MINLIBNAME) $(LIBDIR)/$(MINLIBNAME)
++ install -m 0755 $(MINLIBNAME) $(LIBDIR)/$(MINLIBNAME)
+ ln -sf $(MINLIBNAME) $(LIBDIR)/$(MAJLIBNAME)
+ ln -sf $(MAJLIBNAME) $(LIBDIR)/$(LIBNAME)
+ ifeq ($(FAKEROOT),)
+diff --git a/pam_cap/Makefile b/pam_cap/Makefile
+index 9ca5bef..bdae933 100644
+--- a/pam_cap/Makefile
++++ b/pam_cap/Makefile
+@@ -9,6 +9,8 @@ include ../Make.Rules
+ # written (and you know why it fails), email me and explain why. Thanks!
+ LDLIBS += -L../libcap -lcap
+
++CFLAGS += -fPIC
++
+ all: pam_cap.so
+ $(MAKE) testcompile
+
+@@ -17,13 +19,13 @@ install: all
+ install -m 0755 pam_cap.so $(LIBDIR)/security
+
+ pam_cap.so: pam_cap.o
+- $(LD) $(LDFLAGS) -o pam_cap.so $< $(LDLIBS)
++ $(LD) $(CFLAGS) $(LDFLAGS) -o pam_cap.so $< $(LDLIBS)
+
+ pam_cap.o: pam_cap.c
+- $(CC) $(CFLAGS) $(IPATH) -c $< -o $@
++ $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
+
+ testcompile: test.c pam_cap.o
+- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $+ -lpam -ldl $(LDLIBS)
++ $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $+ -lpam -ldl $(LDLIBS)
+
+ clean:
+ rm -f *.o *.so testcompile *~
+diff --git a/progs/Makefile b/progs/Makefile
+index ef51dc6..c261f57 100644
+--- a/progs/Makefile
++++ b/progs/Makefile
+@@ -22,7 +22,7 @@ $(BUILD): %: %.o
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDLIBS)
+
+ %.o: %.c $(INCS)
+- $(CC) $(IPATH) $(CFLAGS) -c $< -o $@
++ $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
+
+ install: all
+ mkdir -p -m 0755 $(SBINDIR)
+--
+1.7.4.rc2
+
diff --git a/sys-libs/libcap/files/libcap-2.22-no-perl.patch b/sys-libs/libcap/files/libcap-2.22-no-perl.patch
new file mode 100644
index 000000000000..9c29e7efbf38
--- /dev/null
+++ b/sys-libs/libcap/files/libcap-2.22-no-perl.patch
@@ -0,0 +1,54 @@
+From fdd0f3b207785711663f48e0dd3414d90d1f2e86 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Sat, 12 Nov 2011 14:24:08 -0500
+Subject: [PATCH] use awk/sed instead of perl for creating header files
+
+More systems should have awk/sed than perl.
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ libcap/Makefile | 20 ++++++++++++++++----
+ 1 files changed, 16 insertions(+), 4 deletions(-)
+
+diff --git a/libcap/Makefile b/libcap/Makefile
+index 4762c60..68845e0 100644
+--- a/libcap/Makefile
++++ b/libcap/Makefile
+@@ -24,6 +24,8 @@ OBJS=$(addsuffix .o, $(FILES))
+ MINLIBNAME=$(MAJLIBNAME).$(MINOR)
+ GPERF_OUTPUT = _caps_output.gperf
+ CFLAGS += -fPIC
++AWK = awk
++SED = sed
+
+ all: $(MINLIBNAME) $(STALIBNAME)
+
+@@ -39,11 +41,21 @@ cap_names.h: _makenames
+ ./_makenames > cap_names.h
+
+ $(GPERF_OUTPUT): cap_names.list.h
+- perl -e 'print "struct __cap_token_s { const char *name; int index; };\n%{\nconst struct __cap_token_s *__cap_lookup_name(const char *, unsigned int);\n%}\n%%\n"; while ($$l = <>) { $$l =~ s/[\{\"]//g; $$l =~ s/\}.*// ; print $$l; }' < $< | gperf --ignore-case --language=ANSI-C --readonly --null-strings --global-table --hash-function-name=__cap_hash_name --lookup-function-name="__cap_lookup_name" -c -t -m20 $(INDENT) > $@
++ (printf "%b" "struct __cap_token_s { const char *name; int index; };\n%{\nconst struct __cap_token_s *__cap_lookup_name(const char *, unsigned int);\n%}\n%%\n"; \
++ $(SED) -e 's:["{}]::g' -e 's:,$$::' $<) | \
++ gperf \
++ --ignore-case \
++ --language=ANSI-C \
++ --readonly \
++ --null-strings \
++ --global-table \
++ --hash-function-name=__cap_hash_name \
++ --lookup-function-name="__cap_lookup_name" \
++ -c -t -m20 $(INDENT) > $@
+
+-cap_names.list.h: Makefile $(KERNEL_HEADERS)/linux/capability.h
+- @echo "=> making $@ from $(KERNEL_HEADERS)/linux/capability.h"
+- perl -e 'while ($$l=<>) { if ($$l =~ /^\#define[ \t](CAP[_A-Z]+)[ \t]+([0-9]+)\s+$$/) { $$tok=$$1; $$val=$$2; $$tok =~ tr/A-Z/a-z/; print "{\"$$tok\",$$val},\n"; } }' $(KERNEL_HEADERS)/linux/capability.h | fgrep -v 0x > $@
++cap_names.list.h: $(KERNEL_HEADERS)/linux/capability.h Makefile
++ @echo "=> making $@ from $<"
++ $(AWK) '($$0 ~ /^#define[[:space:]]+CAP[_A-Z]+[[:space:]]+[0-9]+[[:space:]]*$$/) { printf "{\"%s\",%s},\n", tolower($$2), $$3 }' $< > $@
+
+ $(STALIBNAME): $(OBJS)
+ $(AR) rcs $@ $^
+--
+1.7.6.1
+
diff --git a/sys-libs/libcap/files/libcap-2.24-build-system-fixes.patch b/sys-libs/libcap/files/libcap-2.24-build-system-fixes.patch
new file mode 100644
index 000000000000..64393275bb80
--- /dev/null
+++ b/sys-libs/libcap/files/libcap-2.24-build-system-fixes.patch
@@ -0,0 +1,163 @@
+From 0485ff3e7f62a331aa4f1e8ec4c2fdcee400e324 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Sun, 16 Nov 2008 09:10:31 -0500
+Subject: [PATCH] build system fixes
+
+This touches up the homebrewed build system to work much better "out of the
+box" for people. Specifically:
+ - allow toolchain vars to be set via environment
+ - CC / BUILD_CC / AR / RANLIB
+ - CFLAGS / CPPFLAGS / LDFLAGS
+ - split CPPFLAGS out of CFLAGS
+ - break -fPIC out of global CFLAGS and only use where needed
+ - use LDLIBS for libraries, not LDFLAGS
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ Make.Rules | 26 ++++++++++++++------------
+ libcap/Makefile | 11 ++++++-----
+ pam_cap/Makefile | 8 +++++---
+ progs/Makefile | 2 +-
+ 4 files changed, 26 insertions(+), 21 deletions(-)
+
+diff --git a/Make.Rules b/Make.Rules
+index 18b7cf7..5364c46 100644
+--- a/Make.Rules
++++ b/Make.Rules
+@@ -45,27 +45,29 @@ MINOR=24
+
+ # Compilation specifics
+
+-KERNEL_HEADERS := $(topdir)/libcap/include/uapi
+-IPATH += -fPIC -I$(KERNEL_HEADERS) -I$(topdir)/libcap/include
+-
+-CC := gcc
+-CFLAGS := -O2 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
+-BUILD_CC := $(CC)
+-BUILD_CFLAGS := $(CFLAGS) $(IPATH)
+-AR := ar
+-RANLIB := ranlib
++CC ?= gcc
++CFLAGS ?= -O2
++BUILD_CC ?= $(CC)
++BUILD_CFLAGS ?= $(CFLAGS)
++AR ?= ar
++RANLIB ?= ranlib
+ DEBUG = -g #-DDEBUG
+ WARNINGS=-Wall -Wwrite-strings \
+ -Wpointer-arith -Wcast-qual -Wcast-align \
+ -Wstrict-prototypes -Wmissing-prototypes \
+ -Wnested-externs -Winline -Wshadow
+ LD=$(CC) -Wl,-x -shared
+-LDFLAGS := #-g
++LDFLAGS ?= #-g
+
+-SYSTEM_HEADERS = /usr/include
++KERNEL_HEADERS = $(topdir)/libcap/include/uapi
++LIBCAP_CPPFLAGS = -I$(KERNEL_HEADERS) -I$(topdir)/libcap/include
++LIBCAP_CPPFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
++CPPFLAGS += $(LIBCAP_CPPFLAGS)
++BUILD_CPPFLAGS += $(LIBCAP_CPPFLAGS)
+ INCS=$(topdir)/libcap/include/sys/capability.h
+ LDFLAGS += -L$(topdir)/libcap
+-CFLAGS += -Dlinux $(WARNINGS) $(DEBUG)
++CPPFLAGS += -Dlinux
++CFLAGS += $(WARNINGS) $(DEBUG)
+ PAM_CAP := $(shell if [ -f /usr/include/security/pam_modules.h ]; then echo yes ; else echo no ; fi)
+ INDENT := $(shell if [ -n "$$(which indent 2>/dev/null)" ]; then echo "| indent -kr" ; fi)
+ DYNAMIC := $(shell if [ ! -d "$(topdir)/.git" ]; then echo yes; fi)
+diff --git a/libcap/Makefile b/libcap/Makefile
+index 0ccd2e7..6b446ea 100644
+--- a/libcap/Makefile
++++ b/libcap/Makefile
+@@ -16,7 +16,7 @@ FILES=cap_alloc cap_proc cap_extint cap_flag cap_text
+ # no support).
+ ifeq ($(LIBATTR),yes)
+ FILES += cap_file
+-LDFLAGS += -lattr
++LDLIBS += -lattr
+ DEPS = -lattr
+ endif
+
+@@ -25,6 +25,7 @@ OBJS=$(addsuffix .o, $(FILES))
+ MAJLIBNAME=$(LIBNAME).$(VERSION)
+ MINLIBNAME=$(MAJLIBNAME).$(MINOR)
+ GPERF_OUTPUT = _caps_output.gperf
++CFLAGS += -fPIC
+
+ all: $(MINLIBNAME) $(STALIBNAME) libcap.pc
+
+@@ -43,7 +44,7 @@ libcap.pc: libcap.pc.in
+ $< >$@
+
+ _makenames: _makenames.c cap_names.list.h
+- $(BUILD_CC) $(BUILD_CFLAGS) $< -o $@
++ $(BUILD_CC) $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $< -o $@
+
+ cap_names.h: _makenames
+ ./_makenames > cap_names.h
+@@ -60,15 +61,15 @@ $(STALIBNAME): $(OBJS)
+ $(RANLIB) $@
+
+ $(MINLIBNAME): $(OBJS)
+- $(LD) $(CFLAGS) $(LDFLAGS) -Wl,-soname,$(MAJLIBNAME) -o $@ $^
++ $(LD) $(CFLAGS) $(LDFLAGS) -Wl,-soname,$(MAJLIBNAME) -o $@ $^ $(LDLIBS)
+ ln -sf $(MINLIBNAME) $(MAJLIBNAME)
+ ln -sf $(MAJLIBNAME) $(LIBNAME)
+
+ %.o: %.c $(INCLS)
+- $(CC) $(CFLAGS) $(IPATH) -c $< -o $@
++ $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
+
+ cap_text.o: cap_text.c $(USE_GPERF_OUTPUT) $(INCLS)
+- $(CC) $(CFLAGS) $(IPATH) $(INCLUDE_GPERF_OUTPUT) -c $< -o $@
++ $(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDE_GPERF_OUTPUT) -c $< -o $@
+
+ install: all
+ mkdir -p -m 0755 $(FAKEROOT)$(INCDIR)/sys
+diff --git a/pam_cap/Makefile b/pam_cap/Makefile
+index cc32fb6..6f07b6b 100644
+--- a/pam_cap/Makefile
++++ b/pam_cap/Makefile
+@@ -9,6 +9,8 @@ include ../Make.Rules
+ # written (and you know why it fails), email me and explain why. Thanks!
+ LDLIBS += -L../libcap -lcap
+
++CFLAGS += -fPIC
++
+ all: pam_cap.so
+ $(MAKE) testcompile
+
+@@ -17,13 +19,13 @@ install: all
+ install -m 0755 pam_cap.so $(FAKEROOT)$(LIBDIR)/security
+
+ pam_cap.so: pam_cap.o
+- $(LD) $(LDFLAGS) -o pam_cap.so $< $(LDLIBS)
++ $(LD) $(CFLAGS) $(LDFLAGS) -o pam_cap.so $< $(LDLIBS)
+
+ pam_cap.o: pam_cap.c
+- $(CC) $(CFLAGS) $(IPATH) -c $< -o $@
++ $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
+
+ testcompile: test.c pam_cap.o
+- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $+ -lpam -ldl $(LDLIBS)
++ $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $+ -lpam -ldl $(LDLIBS)
+
+ clean:
+ rm -f *.o *.so testcompile *~
+diff --git a/progs/Makefile b/progs/Makefile
+index 778149e..8f4e2e6 100644
+--- a/progs/Makefile
++++ b/progs/Makefile
+@@ -22,7 +22,7 @@ $(BUILD): %: %.o
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDLIBS)
+
+ %.o: %.c $(INCS)
+- $(CC) $(IPATH) $(CFLAGS) -c $< -o $@
++ $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
+
+ install: all
+ mkdir -p -m 0755 $(FAKEROOT)$(SBINDIR)
+--
+2.4.1
+
diff --git a/sys-libs/libcap/files/libcap-2.24-setcap-errno.patch b/sys-libs/libcap/files/libcap-2.24-setcap-errno.patch
new file mode 100644
index 000000000000..08513f643e65
--- /dev/null
+++ b/sys-libs/libcap/files/libcap-2.24-setcap-errno.patch
@@ -0,0 +1,45 @@
+From 62b190c09d5652c58679dffd7f09e4aceb4c7daa Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Mon, 13 Jul 2015 01:59:14 -0400
+Subject: [PATCH] setcap: fix errno display
+
+The commit 056ffb0bd25d91ffbcb83c521fc4d3d9904ec4d4 broke the display of
+the final error message because it would do more operations that would
+clobber errno. Example:
+(libcap-2.22) sudo setcap cap_ipc_lock=ep /proc/filesystems | head -1
+Failed to set capabilities on file `/proc/filesystems' (Operation not supported)
+(libcap-2.23) sudo setcap cap_ipc_lock=ep /proc/filesystems | head -1
+Failed to set capabilities on file `/proc/filesystems' (Invalid argument)
+
+Save the original errno value and use that for the final display instead.
+
+URL: https://bugs.gentoo.org/551672
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ progs/setcap.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/progs/setcap.c b/progs/setcap.c
+index 83090ae..7304343 100644
+--- a/progs/setcap.c
++++ b/progs/setcap.c
+@@ -171,6 +171,7 @@ int main(int argc, char **argv)
+ retval = cap_set_file(*++argv, cap_d);
+ if (retval != 0) {
+ int explained = 0;
++ int oerrno = errno;
+ #ifdef linux
+ cap_value_t cap;
+ cap_flag_value_t per_state;
+@@ -193,7 +194,7 @@ int main(int argc, char **argv)
+
+ fprintf(stderr,
+ "Failed to set capabilities on file `%s' (%s)\n",
+- argv[0], strerror(errno));
++ argv[0], strerror(oerrno));
+ if (!explained) {
+ usage();
+ }
+--
+2.4.4
+
diff --git a/sys-libs/libcap/libcap-2.17.ebuild b/sys-libs/libcap/libcap-2.17.ebuild
new file mode 100644
index 000000000000..a0b7be8d5b33
--- /dev/null
+++ b/sys-libs/libcap/libcap-2.17.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils multilib toolchain-funcs pam
+
+DESCRIPTION="POSIX 1003.1e capabilities"
+HOMEPAGE="http://www.friedhoff.org/posixfilecaps.html"
+SRC_URI="mirror://kernel/linux/libs/security/linux-privs/libcap${PV:0:1}/${P}.tar.bz2"
+
+LICENSE="GPL-2 BSD"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
+IUSE="pam"
+
+RDEPEND="sys-apps/attr
+ pam? ( virtual/pam )"
+DEPEND="${RDEPEND}
+ sys-kernel/linux-headers"
+
+src_unpack() {
+ unpack ${P}.tar.bz2
+ cd "${S}"
+ epatch "${FILESDIR}"/2.16/*.patch
+ sed -i -e '/cap_setfcap.*morgan/s:^:#:' pam_cap/capability.conf
+ sed -i \
+ -e "/^PAM_CAP/s:=.*:=$(use pam && echo yes || echo no):" \
+ -e '/^DYNAMIC/s:=.*:=yes:' \
+ -e "/^lib=/s:=.*:=$(get_libdir):" \
+ Make.Rules
+}
+
+src_compile() {
+ tc-export BUILD_CC CC AR RANLIB
+ emake || die
+}
+
+src_install() {
+ emake install DESTDIR="${D}" || die
+
+ gen_usr_ldscript libcap.so
+ mv "${D}"/$(get_libdir)/libcap.a "${D}"/usr/$(get_libdir)/ || die
+
+ dopammod pam_cap/pam_cap.so
+ dopamsecurity '' pam_cap/capability.conf
+
+ dodoc CHANGELOG README doc/capability.notes
+}
diff --git a/sys-libs/libcap/libcap-2.19.ebuild b/sys-libs/libcap/libcap-2.19.ebuild
new file mode 100644
index 000000000000..4b7398e189ab
--- /dev/null
+++ b/sys-libs/libcap/libcap-2.19.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils multilib toolchain-funcs pam
+
+DESCRIPTION="POSIX 1003.1e capabilities"
+HOMEPAGE="http://www.friedhoff.org/posixfilecaps.html"
+SRC_URI="mirror://kernel/linux/libs/security/linux-privs/libcap${PV:0:1}/${P}.tar.bz2"
+
+LICENSE="GPL-2 BSD"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+IUSE="pam"
+
+RDEPEND="sys-apps/attr
+ pam? ( virtual/pam )"
+DEPEND="${RDEPEND}
+ sys-kernel/linux-headers"
+
+src_unpack() {
+ unpack ${P}.tar.bz2
+ cd "${S}"
+ epatch "${FILESDIR}"/2.16/*.patch
+ sed -i -e '/cap_setfcap.*morgan/s:^:#:' pam_cap/capability.conf
+ sed -i \
+ -e "/^PAM_CAP/s:=.*:=$(use pam && echo yes || echo no):" \
+ -e '/^DYNAMIC/s:=.*:=yes:' \
+ -e "/^lib=/s:=.*:=/usr/$(get_libdir):" \
+ Make.Rules
+}
+
+src_compile() {
+ tc-export BUILD_CC CC AR RANLIB
+ emake || die
+}
+
+src_install() {
+ emake install DESTDIR="${D}" || die
+
+ gen_usr_ldscript -a cap
+
+ dopammod pam_cap/pam_cap.so
+ dopamsecurity '' pam_cap/capability.conf
+
+ dodoc CHANGELOG README doc/capability.notes
+}
diff --git a/sys-libs/libcap/libcap-2.20.ebuild b/sys-libs/libcap/libcap-2.20.ebuild
new file mode 100644
index 000000000000..ee69ae865c9b
--- /dev/null
+++ b/sys-libs/libcap/libcap-2.20.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="2"
+
+inherit eutils multilib toolchain-funcs pam
+
+DESCRIPTION="POSIX 1003.1e capabilities"
+HOMEPAGE="http://www.friedhoff.org/posixfilecaps.html"
+SRC_URI="mirror://kernel/linux/libs/security/linux-privs/libcap${PV:0:1}/${P}.tar.bz2"
+
+LICENSE="GPL-2 BSD"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+IUSE="pam"
+
+RDEPEND="sys-apps/attr
+ pam? ( virtual/pam )"
+DEPEND="${RDEPEND}
+ sys-kernel/linux-headers"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2.20-build-system-fixes.patch
+ epatch "${FILESDIR}"/${PN}-2.20-ignore-RAISE_SETFCAP-install-failures.patch
+ sed -i \
+ -e "/^PAM_CAP/s:=.*:=$(use pam && echo yes || echo no):" \
+ -e '/^DYNAMIC/s:=.*:=yes:' \
+ -e "/^lib=/s:=.*:=/usr/$(get_libdir):" \
+ Make.Rules
+}
+
+src_compile() {
+ tc-export BUILD_CC CC AR RANLIB
+ emake || die
+}
+
+src_install() {
+ emake install DESTDIR="${D}" || die
+
+ gen_usr_ldscript -a cap
+
+ dopammod pam_cap/pam_cap.so
+ dopamsecurity '' pam_cap/capability.conf
+
+ dodoc CHANGELOG README doc/capability.notes
+}
diff --git a/sys-libs/libcap/libcap-2.21.ebuild b/sys-libs/libcap/libcap-2.21.ebuild
new file mode 100644
index 000000000000..db473d79e670
--- /dev/null
+++ b/sys-libs/libcap/libcap-2.21.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="2"
+
+inherit eutils multilib toolchain-funcs pam
+
+DESCRIPTION="POSIX 1003.1e capabilities"
+HOMEPAGE="http://www.friedhoff.org/posixfilecaps.html"
+SRC_URI="mirror://kernel/linux/libs/security/linux-privs/libcap${PV:0:1}/${P}.tar.bz2"
+
+LICENSE="GPL-2 BSD"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+IUSE="pam"
+
+RDEPEND="sys-apps/attr
+ pam? ( virtual/pam )"
+DEPEND="${RDEPEND}
+ sys-kernel/linux-headers"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2.20-build-system-fixes.patch
+ epatch "${FILESDIR}"/${PN}-2.20-ignore-RAISE_SETFCAP-install-failures.patch
+ epatch "${FILESDIR}"/${PN}-2.21-include.patch
+ sed -i \
+ -e "/^PAM_CAP/s:=.*:=$(use pam && echo yes || echo no):" \
+ -e '/^DYNAMIC/s:=.*:=yes:' \
+ -e "/^lib=/s:=.*:=/usr/$(get_libdir):" \
+ Make.Rules
+}
+
+src_compile() {
+ tc-export BUILD_CC CC AR RANLIB
+ emake || die
+}
+
+src_install() {
+ emake install DESTDIR="${D}" || die
+
+ gen_usr_ldscript -a cap
+
+ dopammod pam_cap/pam_cap.so
+ dopamsecurity '' pam_cap/capability.conf
+
+ dodoc CHANGELOG README doc/capability.notes
+}
diff --git a/sys-libs/libcap/libcap-2.22-r1.ebuild b/sys-libs/libcap/libcap-2.22-r1.ebuild
new file mode 100644
index 000000000000..78148cac115c
--- /dev/null
+++ b/sys-libs/libcap/libcap-2.22-r1.ebuild
@@ -0,0 +1,52 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils multilib toolchain-funcs pam
+
+DESCRIPTION="POSIX 1003.1e capabilities"
+HOMEPAGE="http://www.friedhoff.org/posixfilecaps.html"
+SRC_URI="mirror://gentoo/${P}.tar.bz2"
+
+# it's available under either of the licenses
+LICENSE="|| ( GPL-2 BSD )"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~arm-linux ~ia64-linux ~x86-linux"
+IUSE="pam"
+
+RDEPEND="sys-apps/attr
+ pam? ( virtual/pam )"
+DEPEND="${RDEPEND}
+ sys-kernel/linux-headers"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2.22-build-system-fixes.patch
+ epatch "${FILESDIR}"/${PN}-2.22-no-perl.patch
+ epatch "${FILESDIR}"/${PN}-2.20-ignore-RAISE_SETFCAP-install-failures.patch
+ epatch "${FILESDIR}"/${PN}-2.21-include.patch
+ sed -i \
+ -e "/^PAM_CAP/s:=.*:=$(usex pam):" \
+ -e '/^DYNAMIC/s:=.*:=yes:' \
+ -e "/^lib=/s:=.*:=/usr/$(get_libdir):" \
+ Make.Rules
+}
+
+src_configure() {
+ tc-export_build_env BUILD_CC
+ tc-export CC AR RANLIB
+}
+
+src_install() {
+ # no configure, needs explicit install line #444724#c3
+ emake install DESTDIR="${ED}"
+
+ gen_usr_ldscript -a cap
+
+ rm -rf "${ED}"/usr/$(get_libdir)/security
+ dopammod pam_cap/pam_cap.so
+ dopamsecurity '' pam_cap/capability.conf
+
+ dodoc CHANGELOG README doc/capability.notes
+}
diff --git a/sys-libs/libcap/libcap-2.22-r2.ebuild b/sys-libs/libcap/libcap-2.22-r2.ebuild
new file mode 100644
index 000000000000..b5e8e317c1e8
--- /dev/null
+++ b/sys-libs/libcap/libcap-2.22-r2.ebuild
@@ -0,0 +1,69 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils multilib multilib-minimal toolchain-funcs pam
+
+DESCRIPTION="POSIX 1003.1e capabilities"
+HOMEPAGE="http://www.friedhoff.org/posixfilecaps.html"
+SRC_URI="mirror://gentoo/${P}.tar.bz2"
+
+# it's available under either of the licenses
+LICENSE="|| ( GPL-2 BSD )"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-linux ~arm-linux ~ia64-linux ~x86-linux"
+IUSE="pam"
+
+RDEPEND=">=sys-apps/attr-2.4.47-r1[${MULTILIB_USEDEP}]
+ pam? ( virtual/pam )"
+DEPEND="${RDEPEND}
+ sys-kernel/linux-headers"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2.22-build-system-fixes.patch
+ epatch "${FILESDIR}"/${PN}-2.22-no-perl.patch
+ epatch "${FILESDIR}"/${PN}-2.20-ignore-RAISE_SETFCAP-install-failures.patch
+ epatch "${FILESDIR}"/${PN}-2.21-include.patch
+
+ multilib_copy_sources
+}
+
+multilib_src_configure() {
+ if multilib_is_native_abi && use pam; then
+ pam=yes
+ else
+ pam=no
+ fi
+
+ sed -i \
+ -e "/^PAM_CAP/s:=.*:=${pam}:" \
+ -e '/^DYNAMIC/s:=.*:=yes:' \
+ -e "/^lib=/s:=.*:=/usr/$(get_libdir):" \
+ Make.Rules
+}
+
+multilib_src_compile() {
+ tc-export_build_env BUILD_CC
+ tc-export AR CC RANLIB
+
+ default
+}
+
+multilib_src_install() {
+ # no configure, needs explicit install line #444724#c3
+ emake install DESTDIR="${ED}"
+
+ multilib_is_native_abi && gen_usr_ldscript -a cap
+
+ rm -rf "${ED}"/usr/$(get_libdir)/security
+ if multilib_is_native_abi && use pam; then
+ dopammod pam_cap/pam_cap.so
+ dopamsecurity '' pam_cap/capability.conf
+ fi
+}
+
+multilib_src_install_all() {
+ dodoc CHANGELOG README doc/capability.notes
+}
diff --git a/sys-libs/libcap/libcap-2.22.ebuild b/sys-libs/libcap/libcap-2.22.ebuild
new file mode 100644
index 000000000000..2b22021becfc
--- /dev/null
+++ b/sys-libs/libcap/libcap-2.22.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="2"
+
+inherit eutils multilib toolchain-funcs pam
+
+DESCRIPTION="POSIX 1003.1e capabilities"
+HOMEPAGE="http://www.friedhoff.org/posixfilecaps.html"
+SRC_URI="mirror://gentoo/${P}.tar.bz2"
+
+# it's available under either of the licenses
+LICENSE="|| ( GPL-2 BSD )"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
+IUSE="pam"
+
+RDEPEND="sys-apps/attr
+ pam? ( virtual/pam )"
+DEPEND="${RDEPEND}
+ sys-kernel/linux-headers"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2.22-build-system-fixes.patch
+ epatch "${FILESDIR}"/${PN}-2.22-no-perl.patch
+ epatch "${FILESDIR}"/${PN}-2.20-ignore-RAISE_SETFCAP-install-failures.patch
+ epatch "${FILESDIR}"/${PN}-2.21-include.patch
+ sed -i \
+ -e "/^PAM_CAP/s:=.*:=$(usex pam):" \
+ -e '/^DYNAMIC/s:=.*:=yes:' \
+ -e "/^lib=/s:=.*:=/usr/$(get_libdir):" \
+ Make.Rules
+}
+
+src_configure() {
+ tc-export_build_env BUILD_CC
+ tc-export CC AR RANLIB
+}
+
+src_install() {
+ emake install DESTDIR="${D}" || die
+
+ gen_usr_ldscript -a cap
+
+ rm -rf "${D}"/usr/$(get_libdir)/security
+ dopammod pam_cap/pam_cap.so
+ dopamsecurity '' pam_cap/capability.conf
+
+ dodoc CHANGELOG README doc/capability.notes
+}
diff --git a/sys-libs/libcap/libcap-2.24-r1.ebuild b/sys-libs/libcap/libcap-2.24-r1.ebuild
new file mode 100644
index 000000000000..3d8e7ad4c61a
--- /dev/null
+++ b/sys-libs/libcap/libcap-2.24-r1.ebuild
@@ -0,0 +1,72 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils multilib multilib-minimal toolchain-funcs pam
+
+DESCRIPTION="POSIX 1003.1e capabilities"
+HOMEPAGE="http://www.friedhoff.org/posixfilecaps.html"
+SRC_URI="mirror://kernel/linux/libs/security/linux-privs/libcap2/${P}.tar.xz"
+
+# it's available under either of the licenses
+LICENSE="|| ( GPL-2 BSD )"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~arm-linux ~ia64-linux ~x86-linux"
+IUSE="pam static-libs"
+
+RDEPEND=">=sys-apps/attr-2.4.47-r1[${MULTILIB_USEDEP}]
+ pam? ( virtual/pam )"
+DEPEND="${RDEPEND}
+ sys-kernel/linux-headers"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2.24-build-system-fixes.patch
+ epatch "${FILESDIR}"/${PN}-2.22-no-perl.patch
+ epatch "${FILESDIR}"/${PN}-2.20-ignore-RAISE_SETFCAP-install-failures.patch
+ epatch "${FILESDIR}"/${PN}-2.21-include.patch
+
+ multilib_copy_sources
+}
+
+multilib_src_configure() {
+ local pam
+ if multilib_is_native_abi && use pam; then
+ pam=yes
+ else
+ pam=no
+ fi
+
+ sed -i \
+ -e "/^PAM_CAP/s:=.*:=${pam}:" \
+ -e '/^DYNAMIC/s:=.*:=yes:' \
+ -e '/^lib_prefix=/s:=.*:=$(prefix):' \
+ -e "/^lib=/s:=.*:=$(get_libdir):" \
+ Make.Rules
+}
+
+multilib_src_compile() {
+ tc-export_build_env BUILD_CC
+ tc-export AR CC RANLIB
+
+ default
+}
+
+multilib_src_install() {
+ # no configure, needs explicit install line #444724#c3
+ emake install DESTDIR="${ED}"
+
+ multilib_is_native_abi && gen_usr_ldscript -a cap
+ use static-libs || rm "${ED}"/usr/$(get_libdir)/libcap.a
+
+ rm -rf "${ED}"/usr/$(get_libdir)/security
+ if multilib_is_native_abi && use pam; then
+ dopammod pam_cap/pam_cap.so
+ dopamsecurity '' pam_cap/capability.conf
+ fi
+}
+
+multilib_src_install_all() {
+ dodoc CHANGELOG README doc/capability.notes
+}
diff --git a/sys-libs/libcap/libcap-2.24-r2.ebuild b/sys-libs/libcap/libcap-2.24-r2.ebuild
new file mode 100644
index 000000000000..7a58eea5d87a
--- /dev/null
+++ b/sys-libs/libcap/libcap-2.24-r2.ebuild
@@ -0,0 +1,73 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils multilib multilib-minimal toolchain-funcs pam
+
+DESCRIPTION="POSIX 1003.1e capabilities"
+HOMEPAGE="http://www.friedhoff.org/posixfilecaps.html"
+SRC_URI="mirror://kernel/linux/libs/security/linux-privs/libcap2/${P}.tar.xz"
+
+# it's available under either of the licenses
+LICENSE="|| ( GPL-2 BSD )"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~arm-linux ~ia64-linux ~x86-linux"
+IUSE="pam static-libs"
+
+RDEPEND=">=sys-apps/attr-2.4.47-r1[${MULTILIB_USEDEP}]
+ pam? ( virtual/pam )"
+DEPEND="${RDEPEND}
+ sys-kernel/linux-headers"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2.24-build-system-fixes.patch
+ epatch "${FILESDIR}"/${PN}-2.22-no-perl.patch
+ epatch "${FILESDIR}"/${PN}-2.20-ignore-RAISE_SETFCAP-install-failures.patch
+ epatch "${FILESDIR}"/${PN}-2.21-include.patch
+ epatch "${FILESDIR}"/${PN}-2.24-setcap-errno.patch #551672
+
+ multilib_copy_sources
+}
+
+multilib_src_configure() {
+ local pam
+ if multilib_is_native_abi && use pam; then
+ pam=yes
+ else
+ pam=no
+ fi
+
+ sed -i \
+ -e "/^PAM_CAP/s:=.*:=${pam}:" \
+ -e '/^DYNAMIC/s:=.*:=yes:' \
+ -e '/^lib_prefix=/s:=.*:=$(prefix):' \
+ -e "/^lib=/s:=.*:=$(get_libdir):" \
+ Make.Rules
+}
+
+multilib_src_compile() {
+ tc-export_build_env BUILD_CC
+ tc-export AR CC RANLIB
+
+ default
+}
+
+multilib_src_install() {
+ # no configure, needs explicit install line #444724#c3
+ emake install DESTDIR="${ED}"
+
+ multilib_is_native_abi && gen_usr_ldscript -a cap
+ use static-libs || rm "${ED}"/usr/$(get_libdir)/libcap.a
+
+ rm -rf "${ED}"/usr/$(get_libdir)/security
+ if multilib_is_native_abi && use pam; then
+ dopammod pam_cap/pam_cap.so
+ dopamsecurity '' pam_cap/capability.conf
+ fi
+}
+
+multilib_src_install_all() {
+ dodoc CHANGELOG README doc/capability.notes
+}
diff --git a/sys-libs/libcap/libcap-2.24.ebuild b/sys-libs/libcap/libcap-2.24.ebuild
new file mode 100644
index 000000000000..35fd27743763
--- /dev/null
+++ b/sys-libs/libcap/libcap-2.24.ebuild
@@ -0,0 +1,71 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils multilib multilib-minimal toolchain-funcs pam
+
+DESCRIPTION="POSIX 1003.1e capabilities"
+HOMEPAGE="http://www.friedhoff.org/posixfilecaps.html"
+SRC_URI="mirror://kernel/linux/libs/security/linux-privs/libcap2/${P}.tar.xz"
+
+# it's available under either of the licenses
+LICENSE="|| ( GPL-2 BSD )"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~arm-linux ~ia64-linux ~x86-linux"
+IUSE="pam static-libs"
+
+RDEPEND=">=sys-apps/attr-2.4.47-r1[${MULTILIB_USEDEP}]
+ pam? ( virtual/pam )"
+DEPEND="${RDEPEND}
+ sys-kernel/linux-headers"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2.24-build-system-fixes.patch
+ epatch "${FILESDIR}"/${PN}-2.22-no-perl.patch
+ epatch "${FILESDIR}"/${PN}-2.20-ignore-RAISE_SETFCAP-install-failures.patch
+ epatch "${FILESDIR}"/${PN}-2.21-include.patch
+
+ multilib_copy_sources
+}
+
+multilib_src_configure() {
+ local pam
+ if multilib_is_native_abi && use pam; then
+ pam=yes
+ else
+ pam=no
+ fi
+
+ sed -i \
+ -e "/^PAM_CAP/s:=.*:=${pam}:" \
+ -e '/^DYNAMIC/s:=.*:=yes:' \
+ -e "/^lib=/s:=.*:=/usr/$(get_libdir):" \
+ Make.Rules
+}
+
+multilib_src_compile() {
+ tc-export_build_env BUILD_CC
+ tc-export AR CC RANLIB
+
+ default
+}
+
+multilib_src_install() {
+ # no configure, needs explicit install line #444724#c3
+ emake install DESTDIR="${ED}"
+
+ multilib_is_native_abi && gen_usr_ldscript -a cap
+ use static-libs || rm "${ED}"/usr/$(get_libdir)/libcap.a
+
+ rm -rf "${ED}"/usr/$(get_libdir)/security
+ if multilib_is_native_abi && use pam; then
+ dopammod pam_cap/pam_cap.so
+ dopamsecurity '' pam_cap/capability.conf
+ fi
+}
+
+multilib_src_install_all() {
+ dodoc CHANGELOG README doc/capability.notes
+}
diff --git a/sys-libs/libcap/metadata.xml b/sys-libs/libcap/metadata.xml
new file mode 100644
index 000000000000..96a2d586367d
--- /dev/null
+++ b/sys-libs/libcap/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>base-system</herd>
+</pkgmetadata>
diff --git a/sys-libs/libchipcard/Manifest b/sys-libs/libchipcard/Manifest
new file mode 100644
index 000000000000..20e89b9951fe
--- /dev/null
+++ b/sys-libs/libchipcard/Manifest
@@ -0,0 +1 @@
+DIST libchipcard-5.0.2.tar.gz 736107 SHA256 d0968594c8ed0fc4cb6d681a74a5f000b48b0ac7a9375648b57d397ac49c1808
diff --git a/sys-libs/libchipcard/files/libchipcard-5.0.0-pcsc-lite-1.6.2.patch b/sys-libs/libchipcard/files/libchipcard-5.0.0-pcsc-lite-1.6.2.patch
new file mode 100644
index 000000000000..c6109dc753a8
--- /dev/null
+++ b/sys-libs/libchipcard/files/libchipcard-5.0.0-pcsc-lite-1.6.2.patch
@@ -0,0 +1,33 @@
+http://cvs.pld-linux.org/cgi-bin/cvsweb/packages/libchipcard/libchipcard-pcsc.patch?rev=1.1
+
+--- src/lib/client/base/client_p.h
++++ src/lib/client/base/client_p.h
+@@ -42,7 +42,7 @@
+ SCARDCONTEXT scardContext;
+
+ int pnpAvailable;
+- SCARD_READERSTATE_A readerStates[MAX_READERS];
++ SCARD_READERSTATE readerStates[MAX_READERS];
+ int readerCount;
+ int lastUsedReader;
+ LPSTR readerList;
+--- src/lib/client/base/client.c
++++ src/lib/client/base/client.c
+@@ -865,7 +865,7 @@
+ DBG_INFO(LC_LOGDOMAIN, "Creating reader \"%s\"", p);
+ i=cl->readerCount;
+ /* preset */
+- memset((void*) &(cl->readerStates[i]), 0, sizeof(SCARD_READERSTATE_A));
++ memset((void*) &(cl->readerStates[i]), 0, sizeof(SCARD_READERSTATE));
+ cl->readerStates[i].szReader=p;
+ cl->readerStates[i].dwCurrentState=SCARD_STATE_UNAWARE;
+ /* reader added */
+@@ -941,7 +941,7 @@
+ assert(cl);
+
+ /* clear reader list and reader status list */
+- memset((void*) &cl->readerStates, 0, sizeof(SCARD_READERSTATE_A)*MAX_READERS);
++ memset((void*) &cl->readerStates, 0, sizeof(SCARD_READERSTATE)*MAX_READERS);
+ cl->readerCount=0;
+ free(cl->readerList);
+ cl->readerList=NULL;
diff --git a/sys-libs/libchipcard/libchipcard-5.0.2.ebuild b/sys-libs/libchipcard/libchipcard-5.0.2.ebuild
new file mode 100644
index 000000000000..6f8dae4ea5ff
--- /dev/null
+++ b/sys-libs/libchipcard/libchipcard-5.0.2.ebuild
@@ -0,0 +1,44 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=2
+
+DESCRIPTION="Libchipcard is a library for easy access to chip cards via chip card readers (terminals)"
+HOMEPAGE="http://www.aquamaniac.de/aqbanking/"
+SRC_URI="http://www.aquamaniac.de/sites/download/download.php?package=02&release=26&file=01&dummy=${P}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="amd64 hppa ppc ~ppc64 ~sparc x86"
+IUSE="doc examples"
+
+RDEPEND=">=sys-libs/gwenhywfar-4.2.1
+ >=sys-apps/pcsc-lite-1.6.2
+ sys-libs/zlib
+ virtual/libintl"
+DEPEND="${RDEPEND}
+ sys-devel/gettext
+ doc? ( app-doc/doxygen )"
+
+src_configure() {
+ econf \
+ --disable-dependency-tracking \
+ --disable-static \
+ $(use_enable doc full-doc) \
+ --with-docpath=/usr/share/doc/${PF}/apidoc
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die
+
+ dodoc AUTHORS ChangeLog NEWS README TODO \
+ doc/{CERTIFICATES,CONFIG,IPCCOMMANDS}
+
+ if use examples; then
+ docinto tutorials
+ dodoc tutorials/*.{c,h,xml} tutorials/README
+ fi
+
+ find "${D}" -name '*.la' -exec rm -f {} +
+}
diff --git a/sys-libs/libchipcard/metadata.xml b/sys-libs/libchipcard/metadata.xml
new file mode 100644
index 000000000000..8cb548491f4e
--- /dev/null
+++ b/sys-libs/libchipcard/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer><email>hanno@gentoo.org</email></maintainer>
+</pkgmetadata>
diff --git a/sys-libs/libcxx/Manifest b/sys-libs/libcxx/Manifest
new file mode 100644
index 000000000000..f7608c7bbd94
--- /dev/null
+++ b/sys-libs/libcxx/Manifest
@@ -0,0 +1,6 @@
+DIST libcxx-0.0_p20130725.tar.xz 833240 SHA256 16428d2a493d2f833bc695300f4fc4e2bfd756fa4eb8e0b7696af10ff5e82653 SHA512 756cb089dc6514125b53623a410039c0edc2fb56a734b7faabee018e073adb96a30f7413546ba42fb40dd815697f27735fbbb6bbcce2e7dea10d284a3ed394d3 WHIRLPOOL 329817e70c27e13d37d75d3d15f0b49375e59d660d784b2e174b059046090a2514d7ddd39ac8fc917da784899f7d394842e73f7c81301d4fdf9add74d259f086
+DIST libcxx-0.0_p20131222.tar.xz 872416 SHA256 d77b7555daa368a493a71c99d9d5868706cc3a66a4e37e002a860733407d21ee SHA512 d4466a4e66365d38c552813f9d4be251bbc956ca0f2800dcd08b3d5633e6bd1a48601016e0e63a92cb4cd2f7863b31ece0ce9b68f2de2c76cf457a7093920fec WHIRLPOOL 07acd16939694e2cfc946f8f021a2b8a4d4ae40dfe2128273a6e0c76b9a2ac8d9f2e6347d091861219044674ea02b76caf80b3f55f74e8e504c58fe96b19eb91
+DIST libcxx-0.0_p20140322.tar.xz 879256 SHA256 b5eae28ced378349e4b7ec6f2e944d0630213462159a0bb2393dc82b536d77d8 SHA512 a80cc3b47acdc1de1a24f5aad19ed0b2518529fe6e8d56cbbe6801874ea334dabd6cec38c27cccbaec961de69b731e22462f0faae30f371e3acb8ecd1b46b2b4 WHIRLPOOL 9374e2b717a3a00f3046f06920775a31403e36ee9a6c5049e4a50173eae947c5e4641dafd178e459ab3caf6dcad6c99baf37cd5587ebf8a3e2d021e18ac36793
+DIST libcxx-3.6.0.src.tar.xz 946380 SHA256 299c1e82b0086a79c5c1aa1885ea3be3bbce6979aaa9b886409b14f9b387fbb7 SHA512 fe16d129a4e2429677a2b87aa2da27fcb5331d6335a0b819ea67de6498e82293bc13661602baafabb56a7f0a4e8f304d468088b8d3e0b5d1c0d01976f7cf3e92 WHIRLPOOL 527b4d1c54e5d76d0958c6d8ac622be4cb7b1a2feb3a9f2d2efa09564ab8d2f8f8cb15a536b8390f80c327dc8b86fee4fcc0b3d7c3771b11ca64885505fb449a
+DIST libcxx-3.6.1.src.tar.xz 943756 SHA256 5a5c653becf3978d4c4f6095708660855bed691210a9426bb839eecd88b6c0f9 SHA512 96d7700ef1c15327b68e8865c2294a3455f09e166991d4465c45bf870fe2d9ce4ddc9af1cd52b900a8a6a9f89c096b9ee1b2c2af58b550f7bc224505eb04d8ea WHIRLPOOL e7eba2d69d679198725147845d2e92631294b27ab2eb73bc057f6851bffbae941fb2570d66bdc28a7382b69d7dc87558e12b730f87a7e9a54f9d149eea1209c9
+DIST libcxx-3.6.2.src.tar.xz 944020 SHA256 52f3d452f48209c9df1792158fdbd7f3e98ed9bca8ebb51fcd524f67437c8b81 SHA512 1eb575921ca0d636c4b7ba21b3ad2c09468d779c69b3106ceefde294344cf20a48a03f9d38ea0db9f8b909f56f0fd1a56a255101305318e04d9f2d20af358ba6 WHIRLPOOL ec225d10cbfe3ca5eba2ed5f16ac6c19914ee75d71db2a1d8ca30f326c9fd5576899361f4397f2ee5d09dd3e8abaca82080c63e303b90d6f19f755465a11a065
diff --git a/sys-libs/libcxx/files/Makefile b/sys-libs/libcxx/files/Makefile
new file mode 100644
index 000000000000..029e7295b889
--- /dev/null
+++ b/sys-libs/libcxx/files/Makefile
@@ -0,0 +1,38 @@
+CXXFLAGS+=-std=c++11 -fstrict-aliasing -Wall -Wextra -Wshadow -Wconversion \
+ -Wpadded -Wstrict-aliasing=2 -Wstrict-overflow=4
+
+SRCDIR=..
+LIB=libc++
+STATIC=libc++.a
+MAJOR=1
+MINOR=0
+SHEXT?=.so
+SHLIB=$(LIB)$(SHEXT).$(MAJOR).$(MINOR)
+SONAME=$(LIB)$(SHEXT).$(MAJOR)
+
+SRC=$(wildcard $(SRCDIR)/src/*.cpp)
+OBJ=$(SRC:$(SRCDIR)/src/%.cpp=%.o)
+SOBJ=$(SRC:$(SRCDIR)/src/%.cpp=%.So)
+
+
+%.So: $(SRCDIR)/src/%.cpp
+ $(CXX) -I$(SRCDIR)/include $(CPPFLAGS) $(CXXFLAGS) -fPIC -nostdinc++ -c $< -o $@
+
+%.o: $(SRCDIR)/src/%.cpp
+ $(CXX) -I$(SRCDIR)/include $(CPPFLAGS) $(CXXFLAGS) -nostdinc++ -c $< -o $@
+
+$(STATIC): $(OBJ)
+ $(AR) cr $@ $^
+
+static: $(STATIC)
+
+$(SHLIB): $(SOBJ)
+ $(CXX) -fPIC -nodefaultlibs $(CXXFLAGS) $(LDFLAGS) -shared -Wl,-soname,$(SONAME) -o $@ $^ $(LIBS)
+
+$(SONAME): $(SHLIB)
+ ln -s $< $@
+
+$(LIB)$(SHEXT): $(SONAME)
+ ln -s $< $@
+
+shared: $(SHLIB) $(SONAME) $(LIB)$(SHEXT)
diff --git a/sys-libs/libcxx/files/prepare_snapshot.sh b/sys-libs/libcxx/files/prepare_snapshot.sh
new file mode 100755
index 000000000000..3de5a97a8096
--- /dev/null
+++ b/sys-libs/libcxx/files/prepare_snapshot.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+VERSION=$(date +%Y%m%d)
+BASE_VERSION="0.0"
+PACKAGE="libcxx-${BASE_VERSION}_p${VERSION}"
+
+svn co http://llvm.org/svn/llvm-project/libcxx/trunk ${PACKAGE}
+
+find "${PACKAGE}" -type d -name '.svn' -prune -print0 | xargs -0 rm -rf
+find "${PACKAGE}" -type d -name '.git' -prune -print0 | xargs -0 rm -rf
+
+tar cJf ${PACKAGE}.tar.xz ${PACKAGE}
+rm -rf ${PACKAGE}/
+
+echo "Tarball: \"${PACKAGE}.tar.xz\""
+
+echo "** all done **"
diff --git a/sys-libs/libcxx/libcxx-0.0_p20130725.ebuild b/sys-libs/libcxx/libcxx-0.0_p20130725.ebuild
new file mode 100644
index 000000000000..dde2eea354f8
--- /dev/null
+++ b/sys-libs/libcxx/libcxx-0.0_p20130725.ebuild
@@ -0,0 +1,168 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+ESVN_REPO_URI="http://llvm.org/svn/llvm-project/libcxx/trunk"
+
+[ "${PV%9999}" != "${PV}" ] && SCM="subversion" || SCM=""
+
+inherit ${SCM} flag-o-matic toolchain-funcs multilib multilib-minimal
+
+DESCRIPTION="New implementation of the C++ standard library, targeting C++11"
+HOMEPAGE="http://libcxx.llvm.org/"
+if [ "${PV%9999}" = "${PV}" ] ; then
+ SRC_URI="mirror://gentoo/${P}.tar.xz"
+else
+ SRC_URI=""
+fi
+
+LICENSE="|| ( UoI-NCSA MIT )"
+SLOT="0"
+if [ "${PV%9999}" = "${PV}" ] ; then
+ KEYWORDS="~amd64 ~mips ~x86 ~amd64-fbsd ~amd64-linux ~x86-linux"
+else
+ KEYWORDS=""
+fi
+IUSE="elibc_glibc +libcxxrt static-libs test"
+
+RDEPEND="libcxxrt? ( >=sys-libs/libcxxrt-0.0_p20130725[static-libs?,${MULTILIB_USEDEP}] )
+ !libcxxrt? ( >=sys-devel/gcc-4.7[cxx] )"
+DEPEND="${RDEPEND}
+ test? ( sys-devel/clang )
+ app-arch/xz-utils"
+
+DOCS=( CREDITS.TXT )
+
+pkg_setup() {
+ if ! use libcxxrt ; then
+ ewarn "You have disabled USE=libcxxrt. This will build ${PN} against"
+ ewarn "libsupc++. Please note that this is not well supported."
+ ewarn "In particular, static linking will not work."
+ fi
+ if [[ $(gcc-version) < 4.7 ]] && [[ $(tc-getCXX) != *clang++* ]] ; then
+ eerror "${PN} needs to be built with clang++ or gcc-4.7 or later."
+ eerror "Please use gcc-config to switch to gcc-4.7 or later version."
+ die
+ fi
+}
+
+src_prepare() {
+ cp -f "${FILESDIR}/Makefile" lib/ || die
+ multilib_copy_sources
+}
+
+src_configure() {
+ export LIBS="-lpthread -lrt -lc -lgcc_s"
+ if use libcxxrt ; then
+ append-cppflags -DLIBCXXRT "-I${EPREFIX}/usr/include/libcxxrt/"
+ LIBS="-lcxxrt ${LIBS}"
+ cp "${EPREFIX}/usr/include/libcxxrt/"*.h "${S}/include"
+ else
+ # Very hackish, see $HOMEPAGE
+ # If someone has a clever idea, please share it!
+ local includes="$(echo | ${CHOST}-g++ -Wp,-v -x c++ - -fsyntax-only 2>&1 | grep -C 2 '#include.*<...>' | tail -n 2 | sed -e 's/^ /-I/' | tr '\n' ' ')"
+ local libcxx_gcc_dirs="$(echo | ${CHOST}-g++ -Wp,-v -x c++ - -fsyntax-only 2>&1 | grep -C 2 '#include.*<...>' | tail -n 2 | tr '\n' ' ')"
+ append-cppflags -D__GLIBCXX__ ${includes}
+ LIBS="-lsupc++ ${LIBS}"
+ local libsupcxx_includes="cxxabi.h bits/c++config.h bits/os_defines.h bits/cpu_defines.h bits/cxxabi_tweaks.h bits/cxxabi_forced.h"
+ for i in ${libsupcxx_includes} ; do
+ local found=""
+ [ -d "${S}/include/$(dirname ${i})/" ] || mkdir -p "${S}/include/$(dirname ${i})"
+ for j in ${libcxx_gcc_dirs} ; do
+ if [ -f "${j}/${i}" ] ; then
+ cp "${j}/${i}" "${S}/include/$(dirname ${i})/" || die
+ found=yes
+ fi
+ done
+ [ -n "${found}" ] || die "Header not found: ${i}"
+ done
+ fi
+
+ tc-export AR CC CXX
+
+ append-ldflags "-Wl,-z,defs" # make sure we are not underlinked
+}
+
+multilib_src_compile() {
+ cd "${BUILD_DIR}/lib" || die
+ emake shared
+ use static-libs && emake static
+}
+
+# Tests fail for now, if anybody is able to fix them, help is very welcome.
+multilib_src_test() {
+ cd "${BUILD_DIR}/test"
+ LD_LIBRARY_PATH="${BUILD_DIR}/lib:${LD_LIBRARY_PATH}" \
+ CC="clang++ $(get_abi_CFLAGS) ${CXXFLAGS}" \
+ HEADER_INCLUDE="-I${BUILD_DIR}/include" \
+ SOURCE_LIB="-L${BUILD_DIR}/lib" \
+ LIBS="-lm" \
+ ./testit || die
+}
+
+# Usage: deps
+gen_ldscript() {
+ local output_format
+ output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p')
+ [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )"
+
+ cat <<-END_LDSCRIPT
+/* GNU ld script
+ Include missing dependencies
+*/
+${output_format}
+GROUP ( $@ )
+END_LDSCRIPT
+}
+
+gen_static_ldscript() {
+ if use libcxxrt ; then
+ # Move it first.
+ mv "${ED}/usr/$(get_libdir)/libc++.a" "${ED}/usr/$(get_libdir)/libc++_static.a" || die
+
+ # Generate libc++.a ldscript for inclusion of its dependencies so that
+ # clang++ -stdlib=libc++ -static works out of the box.
+ local deps="${EPREFIX}/usr/$(get_libdir)/libc++_static.a ${EPREFIX}/usr/$(get_libdir)/libcxxrt.a"
+ # On Linux/glibc it does not link without libpthread or libdl. It is
+ # fine on FreeBSD.
+ use elibc_glibc && deps="${deps} ${EPREFIX}/usr/$(get_libdir)/libpthread.a ${EPREFIX}/usr/$(get_libdir)/libdl.a"
+
+ gen_ldscript "${deps}" > "${ED}/usr/$(get_libdir)/libc++.a"
+ fi
+ # TODO: Generate a libc++.a ldscript when building against libsupc++
+}
+
+gen_shared_ldscript() {
+ if use libcxxrt ; then
+ mv "${ED}/usr/$(get_libdir)/libc++.so" "${ED}/usr/$(get_libdir)/libc++_shared.so" || die
+ local deps="${EPREFIX}/usr/$(get_libdir)/libc++_shared.so ${EPREFIX}/usr/$(get_libdir)/libcxxrt.so"
+ gen_ldscript "${deps}" > "${ED}/usr/$(get_libdir)/libc++.so"
+ fi
+ # TODO: Generate the linker script for other confiurations too.
+}
+
+multilib_src_install() {
+ cd "${BUILD_DIR}/lib"
+ if use static-libs ; then
+ dolib.a libc++.a
+ gen_static_ldscript
+ fi
+ dolib.so libc++.so*
+ gen_shared_ldscript
+}
+
+multilib_src_install_all() {
+ einstalldocs
+ insinto /usr/include/c++/v1
+ doins -r include/*
+}
+
+pkg_postinst() {
+ elog "This package (${PN}) is mainly intended as a replacement for the C++"
+ elog "standard library when using clang."
+ elog "To use it, instead of libstdc++, use:"
+ elog " clang++ -stdlib=libc++"
+ elog "to compile your C++ programs."
+}
diff --git a/sys-libs/libcxx/libcxx-0.0_p20131222.ebuild b/sys-libs/libcxx/libcxx-0.0_p20131222.ebuild
new file mode 100644
index 000000000000..4ceb09fe3904
--- /dev/null
+++ b/sys-libs/libcxx/libcxx-0.0_p20131222.ebuild
@@ -0,0 +1,169 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+ESVN_REPO_URI="http://llvm.org/svn/llvm-project/libcxx/trunk"
+
+[ "${PV%9999}" != "${PV}" ] && SCM="subversion" || SCM=""
+
+inherit ${SCM} flag-o-matic toolchain-funcs multilib multilib-minimal
+
+DESCRIPTION="New implementation of the C++ standard library, targeting C++11"
+HOMEPAGE="http://libcxx.llvm.org/"
+if [ "${PV%9999}" = "${PV}" ] ; then
+ SRC_URI="mirror://gentoo/${P}.tar.xz"
+else
+ SRC_URI=""
+fi
+
+LICENSE="|| ( UoI-NCSA MIT )"
+SLOT="0"
+if [ "${PV%9999}" = "${PV}" ] ; then
+ KEYWORDS="~amd64 ~mips ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux"
+else
+ KEYWORDS=""
+fi
+IUSE="elibc_glibc +libcxxrt static-libs test"
+
+RDEPEND="libcxxrt? ( >=sys-libs/libcxxrt-0.0_p20130725[static-libs?,${MULTILIB_USEDEP}] )
+ !libcxxrt? ( >=sys-devel/gcc-4.7[cxx] )"
+DEPEND="${RDEPEND}
+ test? ( sys-devel/clang )
+ app-arch/xz-utils"
+
+DOCS=( CREDITS.TXT )
+
+pkg_setup() {
+ if ! use libcxxrt ; then
+ ewarn "You have disabled USE=libcxxrt. This will build ${PN} against"
+ ewarn "libsupc++. Please note that this is not well supported."
+ ewarn "In particular, static linking will not work."
+ fi
+ if [[ $(gcc-version) < 4.7 ]] && [[ $(tc-getCXX) != *clang++* ]] ; then
+ eerror "${PN} needs to be built with clang++ or gcc-4.7 or later."
+ eerror "Please use gcc-config to switch to gcc-4.7 or later version."
+ die
+ fi
+}
+
+src_prepare() {
+ cp -f "${FILESDIR}/Makefile" lib/ || die
+ multilib_copy_sources
+}
+
+src_configure() {
+ export LIBS="-lpthread -lrt -lc -lgcc_s"
+ if use libcxxrt ; then
+ append-cppflags -DLIBCXXRT "-I${EPREFIX}/usr/include/libcxxrt/"
+ LIBS="-lcxxrt ${LIBS}"
+ cp "${EPREFIX}/usr/include/libcxxrt/"*.h "${S}/include"
+ else
+ # Very hackish, see $HOMEPAGE
+ # If someone has a clever idea, please share it!
+ local includes="$(echo | ${CHOST}-g++ -Wp,-v -x c++ - -fsyntax-only 2>&1 | grep -C 2 '#include.*<...>' | tail -n 2 | sed -e 's/^ /-I/' | tr '\n' ' ')"
+ local libcxx_gcc_dirs="$(echo | ${CHOST}-g++ -Wp,-v -x c++ - -fsyntax-only 2>&1 | grep -C 2 '#include.*<...>' | tail -n 2 | tr '\n' ' ')"
+ append-cppflags -D__GLIBCXX__ ${includes}
+ LIBS="-lsupc++ ${LIBS}"
+ local libsupcxx_includes="cxxabi.h bits/c++config.h bits/os_defines.h bits/cpu_defines.h bits/cxxabi_tweaks.h bits/cxxabi_forced.h"
+ for i in ${libsupcxx_includes} ; do
+ local found=""
+ [ -d "${S}/include/$(dirname ${i})/" ] || mkdir -p "${S}/include/$(dirname ${i})"
+ for j in ${libcxx_gcc_dirs} ; do
+ if [ -f "${j}/${i}" ] ; then
+ cp "${j}/${i}" "${S}/include/$(dirname ${i})/" || die
+ found=yes
+ fi
+ done
+ [ -n "${found}" ] || die "Header not found: ${i}"
+ done
+ fi
+
+ tc-export AR CC CXX
+
+ append-ldflags "-Wl,-z,defs" # make sure we are not underlinked
+}
+
+multilib_src_compile() {
+ cd "${BUILD_DIR}/lib" || die
+ emake shared
+ use static-libs && emake static
+}
+
+# Tests fail for now, if anybody is able to fix them, help is very welcome.
+multilib_src_test() {
+ cd "${BUILD_DIR}/test"
+ LD_LIBRARY_PATH="${BUILD_DIR}/lib:${LD_LIBRARY_PATH}" \
+ CC="clang++ $(get_abi_CFLAGS) ${CXXFLAGS}" \
+ HEADER_INCLUDE="-I${BUILD_DIR}/include" \
+ SOURCE_LIB="-L${BUILD_DIR}/lib" \
+ LIBS="-lm $(usex libcxxrt -lcxxrt "")" \
+ ./testit || die
+ # TODO: fix link against libsupc++
+}
+
+# Usage: deps
+gen_ldscript() {
+ local output_format
+ output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p')
+ [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )"
+
+ cat <<-END_LDSCRIPT
+/* GNU ld script
+ Include missing dependencies
+*/
+${output_format}
+GROUP ( $@ )
+END_LDSCRIPT
+}
+
+gen_static_ldscript() {
+ if use libcxxrt ; then
+ # Move it first.
+ mv "${ED}/usr/$(get_libdir)/libc++.a" "${ED}/usr/$(get_libdir)/libc++_static.a" || die
+
+ # Generate libc++.a ldscript for inclusion of its dependencies so that
+ # clang++ -stdlib=libc++ -static works out of the box.
+ local deps="${EPREFIX}/usr/$(get_libdir)/libc++_static.a ${EPREFIX}/usr/$(get_libdir)/libcxxrt.a"
+ # On Linux/glibc it does not link without libpthread or libdl. It is
+ # fine on FreeBSD.
+ use elibc_glibc && deps="${deps} ${EPREFIX}/usr/$(get_libdir)/libpthread.a ${EPREFIX}/usr/$(get_libdir)/libdl.a"
+
+ gen_ldscript "${deps}" > "${ED}/usr/$(get_libdir)/libc++.a"
+ fi
+ # TODO: Generate a libc++.a ldscript when building against libsupc++
+}
+
+gen_shared_ldscript() {
+ if use libcxxrt ; then
+ mv "${ED}/usr/$(get_libdir)/libc++.so" "${ED}/usr/$(get_libdir)/libc++_shared.so" || die
+ local deps="${EPREFIX}/usr/$(get_libdir)/libc++_shared.so ${EPREFIX}/usr/$(get_libdir)/libcxxrt.so"
+ gen_ldscript "${deps}" > "${ED}/usr/$(get_libdir)/libc++.so"
+ fi
+ # TODO: Generate the linker script for other confiurations too.
+}
+
+multilib_src_install() {
+ cd "${BUILD_DIR}/lib"
+ if use static-libs ; then
+ dolib.a libc++.a
+ gen_static_ldscript
+ fi
+ dolib.so libc++.so*
+ gen_shared_ldscript
+}
+
+multilib_src_install_all() {
+ einstalldocs
+ insinto /usr/include/c++/v1
+ doins -r include/*
+}
+
+pkg_postinst() {
+ elog "This package (${PN}) is mainly intended as a replacement for the C++"
+ elog "standard library when using clang."
+ elog "To use it, instead of libstdc++, use:"
+ elog " clang++ -stdlib=libc++"
+ elog "to compile your C++ programs."
+}
diff --git a/sys-libs/libcxx/libcxx-0.0_p20140322.ebuild b/sys-libs/libcxx/libcxx-0.0_p20140322.ebuild
new file mode 100644
index 000000000000..4ceb09fe3904
--- /dev/null
+++ b/sys-libs/libcxx/libcxx-0.0_p20140322.ebuild
@@ -0,0 +1,169 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+ESVN_REPO_URI="http://llvm.org/svn/llvm-project/libcxx/trunk"
+
+[ "${PV%9999}" != "${PV}" ] && SCM="subversion" || SCM=""
+
+inherit ${SCM} flag-o-matic toolchain-funcs multilib multilib-minimal
+
+DESCRIPTION="New implementation of the C++ standard library, targeting C++11"
+HOMEPAGE="http://libcxx.llvm.org/"
+if [ "${PV%9999}" = "${PV}" ] ; then
+ SRC_URI="mirror://gentoo/${P}.tar.xz"
+else
+ SRC_URI=""
+fi
+
+LICENSE="|| ( UoI-NCSA MIT )"
+SLOT="0"
+if [ "${PV%9999}" = "${PV}" ] ; then
+ KEYWORDS="~amd64 ~mips ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux"
+else
+ KEYWORDS=""
+fi
+IUSE="elibc_glibc +libcxxrt static-libs test"
+
+RDEPEND="libcxxrt? ( >=sys-libs/libcxxrt-0.0_p20130725[static-libs?,${MULTILIB_USEDEP}] )
+ !libcxxrt? ( >=sys-devel/gcc-4.7[cxx] )"
+DEPEND="${RDEPEND}
+ test? ( sys-devel/clang )
+ app-arch/xz-utils"
+
+DOCS=( CREDITS.TXT )
+
+pkg_setup() {
+ if ! use libcxxrt ; then
+ ewarn "You have disabled USE=libcxxrt. This will build ${PN} against"
+ ewarn "libsupc++. Please note that this is not well supported."
+ ewarn "In particular, static linking will not work."
+ fi
+ if [[ $(gcc-version) < 4.7 ]] && [[ $(tc-getCXX) != *clang++* ]] ; then
+ eerror "${PN} needs to be built with clang++ or gcc-4.7 or later."
+ eerror "Please use gcc-config to switch to gcc-4.7 or later version."
+ die
+ fi
+}
+
+src_prepare() {
+ cp -f "${FILESDIR}/Makefile" lib/ || die
+ multilib_copy_sources
+}
+
+src_configure() {
+ export LIBS="-lpthread -lrt -lc -lgcc_s"
+ if use libcxxrt ; then
+ append-cppflags -DLIBCXXRT "-I${EPREFIX}/usr/include/libcxxrt/"
+ LIBS="-lcxxrt ${LIBS}"
+ cp "${EPREFIX}/usr/include/libcxxrt/"*.h "${S}/include"
+ else
+ # Very hackish, see $HOMEPAGE
+ # If someone has a clever idea, please share it!
+ local includes="$(echo | ${CHOST}-g++ -Wp,-v -x c++ - -fsyntax-only 2>&1 | grep -C 2 '#include.*<...>' | tail -n 2 | sed -e 's/^ /-I/' | tr '\n' ' ')"
+ local libcxx_gcc_dirs="$(echo | ${CHOST}-g++ -Wp,-v -x c++ - -fsyntax-only 2>&1 | grep -C 2 '#include.*<...>' | tail -n 2 | tr '\n' ' ')"
+ append-cppflags -D__GLIBCXX__ ${includes}
+ LIBS="-lsupc++ ${LIBS}"
+ local libsupcxx_includes="cxxabi.h bits/c++config.h bits/os_defines.h bits/cpu_defines.h bits/cxxabi_tweaks.h bits/cxxabi_forced.h"
+ for i in ${libsupcxx_includes} ; do
+ local found=""
+ [ -d "${S}/include/$(dirname ${i})/" ] || mkdir -p "${S}/include/$(dirname ${i})"
+ for j in ${libcxx_gcc_dirs} ; do
+ if [ -f "${j}/${i}" ] ; then
+ cp "${j}/${i}" "${S}/include/$(dirname ${i})/" || die
+ found=yes
+ fi
+ done
+ [ -n "${found}" ] || die "Header not found: ${i}"
+ done
+ fi
+
+ tc-export AR CC CXX
+
+ append-ldflags "-Wl,-z,defs" # make sure we are not underlinked
+}
+
+multilib_src_compile() {
+ cd "${BUILD_DIR}/lib" || die
+ emake shared
+ use static-libs && emake static
+}
+
+# Tests fail for now, if anybody is able to fix them, help is very welcome.
+multilib_src_test() {
+ cd "${BUILD_DIR}/test"
+ LD_LIBRARY_PATH="${BUILD_DIR}/lib:${LD_LIBRARY_PATH}" \
+ CC="clang++ $(get_abi_CFLAGS) ${CXXFLAGS}" \
+ HEADER_INCLUDE="-I${BUILD_DIR}/include" \
+ SOURCE_LIB="-L${BUILD_DIR}/lib" \
+ LIBS="-lm $(usex libcxxrt -lcxxrt "")" \
+ ./testit || die
+ # TODO: fix link against libsupc++
+}
+
+# Usage: deps
+gen_ldscript() {
+ local output_format
+ output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p')
+ [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )"
+
+ cat <<-END_LDSCRIPT
+/* GNU ld script
+ Include missing dependencies
+*/
+${output_format}
+GROUP ( $@ )
+END_LDSCRIPT
+}
+
+gen_static_ldscript() {
+ if use libcxxrt ; then
+ # Move it first.
+ mv "${ED}/usr/$(get_libdir)/libc++.a" "${ED}/usr/$(get_libdir)/libc++_static.a" || die
+
+ # Generate libc++.a ldscript for inclusion of its dependencies so that
+ # clang++ -stdlib=libc++ -static works out of the box.
+ local deps="${EPREFIX}/usr/$(get_libdir)/libc++_static.a ${EPREFIX}/usr/$(get_libdir)/libcxxrt.a"
+ # On Linux/glibc it does not link without libpthread or libdl. It is
+ # fine on FreeBSD.
+ use elibc_glibc && deps="${deps} ${EPREFIX}/usr/$(get_libdir)/libpthread.a ${EPREFIX}/usr/$(get_libdir)/libdl.a"
+
+ gen_ldscript "${deps}" > "${ED}/usr/$(get_libdir)/libc++.a"
+ fi
+ # TODO: Generate a libc++.a ldscript when building against libsupc++
+}
+
+gen_shared_ldscript() {
+ if use libcxxrt ; then
+ mv "${ED}/usr/$(get_libdir)/libc++.so" "${ED}/usr/$(get_libdir)/libc++_shared.so" || die
+ local deps="${EPREFIX}/usr/$(get_libdir)/libc++_shared.so ${EPREFIX}/usr/$(get_libdir)/libcxxrt.so"
+ gen_ldscript "${deps}" > "${ED}/usr/$(get_libdir)/libc++.so"
+ fi
+ # TODO: Generate the linker script for other confiurations too.
+}
+
+multilib_src_install() {
+ cd "${BUILD_DIR}/lib"
+ if use static-libs ; then
+ dolib.a libc++.a
+ gen_static_ldscript
+ fi
+ dolib.so libc++.so*
+ gen_shared_ldscript
+}
+
+multilib_src_install_all() {
+ einstalldocs
+ insinto /usr/include/c++/v1
+ doins -r include/*
+}
+
+pkg_postinst() {
+ elog "This package (${PN}) is mainly intended as a replacement for the C++"
+ elog "standard library when using clang."
+ elog "To use it, instead of libstdc++, use:"
+ elog " clang++ -stdlib=libc++"
+ elog "to compile your C++ programs."
+}
diff --git a/sys-libs/libcxx/libcxx-3.6.0.ebuild b/sys-libs/libcxx/libcxx-3.6.0.ebuild
new file mode 100644
index 000000000000..92689d826fc6
--- /dev/null
+++ b/sys-libs/libcxx/libcxx-3.6.0.ebuild
@@ -0,0 +1,170 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+ESVN_REPO_URI="http://llvm.org/svn/llvm-project/libcxx/trunk"
+
+[ "${PV%9999}" != "${PV}" ] && SCM="subversion" || SCM=""
+
+inherit ${SCM} flag-o-matic toolchain-funcs multilib multilib-minimal
+
+DESCRIPTION="New implementation of the C++ standard library, targeting C++11"
+HOMEPAGE="http://libcxx.llvm.org/"
+if [ "${PV%9999}" = "${PV}" ] ; then
+ SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz"
+ S="${WORKDIR}/${P}.src"
+else
+ SRC_URI=""
+fi
+
+LICENSE="|| ( UoI-NCSA MIT )"
+SLOT="0"
+if [ "${PV%9999}" = "${PV}" ] ; then
+ KEYWORDS="~amd64 ~mips ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux"
+else
+ KEYWORDS=""
+fi
+IUSE="elibc_glibc +libcxxrt +static-libs test"
+
+RDEPEND="libcxxrt? ( >=sys-libs/libcxxrt-0.0_p20130725[static-libs?,${MULTILIB_USEDEP}] )
+ !libcxxrt? ( >=sys-devel/gcc-4.7:=[cxx] )"
+DEPEND="${RDEPEND}
+ test? ( sys-devel/clang )
+ app-arch/xz-utils"
+
+DOCS=( CREDITS.TXT )
+
+pkg_setup() {
+ if ! use libcxxrt ; then
+ ewarn "You have disabled USE=libcxxrt. This will build ${PN} against"
+ ewarn "libsupc++. Please note that this is not well supported."
+ ewarn "In particular, static linking will not work."
+ fi
+ if [[ $(gcc-version) < 4.7 ]] && [[ $(tc-getCXX) != *clang++* ]] ; then
+ eerror "${PN} needs to be built with clang++ or gcc-4.7 or later."
+ eerror "Please use gcc-config to switch to gcc-4.7 or later version."
+ die
+ fi
+}
+
+src_prepare() {
+ cp -f "${FILESDIR}/Makefile" lib/ || die
+ multilib_copy_sources
+}
+
+src_configure() {
+ export LIBS="-lpthread -lrt -lc -lgcc_s"
+ if use libcxxrt ; then
+ append-cppflags -DLIBCXXRT "-I${EPREFIX}/usr/include/libcxxrt/"
+ LIBS="-lcxxrt ${LIBS}"
+ cp "${EPREFIX}/usr/include/libcxxrt/"*.h "${S}/include"
+ else
+ # Very hackish, see $HOMEPAGE
+ # If someone has a clever idea, please share it!
+ local includes="$(echo | ${CHOST}-g++ -Wp,-v -x c++ - -fsyntax-only 2>&1 | grep -C 2 '#include.*<...>' | tail -n 2 | sed -e 's/^ /-I/' | tr '\n' ' ')"
+ local libcxx_gcc_dirs="$(echo | ${CHOST}-g++ -Wp,-v -x c++ - -fsyntax-only 2>&1 | grep -C 2 '#include.*<...>' | tail -n 2 | tr '\n' ' ')"
+ append-cppflags -D__GLIBCXX__ ${includes}
+ LIBS="-lsupc++ ${LIBS}"
+ local libsupcxx_includes="cxxabi.h bits/c++config.h bits/os_defines.h bits/cpu_defines.h bits/cxxabi_tweaks.h bits/cxxabi_forced.h"
+ for i in ${libsupcxx_includes} ; do
+ local found=""
+ [ -d "${S}/include/$(dirname ${i})/" ] || mkdir -p "${S}/include/$(dirname ${i})"
+ for j in ${libcxx_gcc_dirs} ; do
+ if [ -f "${j}/${i}" ] ; then
+ cp "${j}/${i}" "${S}/include/$(dirname ${i})/" || die
+ found=yes
+ fi
+ done
+ [ -n "${found}" ] || die "Header not found: ${i}"
+ done
+ fi
+
+ tc-export AR CC CXX
+
+ append-ldflags "-Wl,-z,defs" # make sure we are not underlinked
+}
+
+multilib_src_compile() {
+ cd "${BUILD_DIR}/lib" || die
+ emake shared
+ use static-libs && emake static
+}
+
+# Tests fail for now, if anybody is able to fix them, help is very welcome.
+multilib_src_test() {
+ cd "${BUILD_DIR}/test"
+ LD_LIBRARY_PATH="${BUILD_DIR}/lib:${LD_LIBRARY_PATH}" \
+ CC="clang++ $(get_abi_CFLAGS) ${CXXFLAGS}" \
+ HEADER_INCLUDE="-I${BUILD_DIR}/include" \
+ SOURCE_LIB="-L${BUILD_DIR}/lib" \
+ LIBS="-lm $(usex libcxxrt -lcxxrt "")" \
+ ./testit || die
+ # TODO: fix link against libsupc++
+}
+
+# Usage: deps
+gen_ldscript() {
+ local output_format
+ output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p')
+ [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )"
+
+ cat <<-END_LDSCRIPT
+/* GNU ld script
+ Include missing dependencies
+*/
+${output_format}
+GROUP ( $@ )
+END_LDSCRIPT
+}
+
+gen_static_ldscript() {
+ if use libcxxrt ; then
+ # Move it first.
+ mv "${ED}/usr/$(get_libdir)/libc++.a" "${ED}/usr/$(get_libdir)/libc++_static.a" || die
+
+ # Generate libc++.a ldscript for inclusion of its dependencies so that
+ # clang++ -stdlib=libc++ -static works out of the box.
+ local deps="${EPREFIX}/usr/$(get_libdir)/libc++_static.a ${EPREFIX}/usr/$(get_libdir)/libcxxrt.a"
+ # On Linux/glibc it does not link without libpthread or libdl. It is
+ # fine on FreeBSD.
+ use elibc_glibc && deps="${deps} ${EPREFIX}/usr/$(get_libdir)/libpthread.a ${EPREFIX}/usr/$(get_libdir)/libdl.a"
+
+ gen_ldscript "${deps}" > "${ED}/usr/$(get_libdir)/libc++.a"
+ fi
+ # TODO: Generate a libc++.a ldscript when building against libsupc++
+}
+
+gen_shared_ldscript() {
+ if use libcxxrt ; then
+ mv "${ED}/usr/$(get_libdir)/libc++.so" "${ED}/usr/$(get_libdir)/libc++_shared.so" || die
+ local deps="${EPREFIX}/usr/$(get_libdir)/libc++_shared.so ${EPREFIX}/usr/$(get_libdir)/libcxxrt.so"
+ gen_ldscript "${deps}" > "${ED}/usr/$(get_libdir)/libc++.so"
+ fi
+ # TODO: Generate the linker script for other confiurations too.
+}
+
+multilib_src_install() {
+ cd "${BUILD_DIR}/lib"
+ if use static-libs ; then
+ dolib.a libc++.a
+ gen_static_ldscript
+ fi
+ dolib.so libc++.so*
+ gen_shared_ldscript
+}
+
+multilib_src_install_all() {
+ einstalldocs
+ insinto /usr/include/c++/v1
+ doins -r include/*
+}
+
+pkg_postinst() {
+ elog "This package (${PN}) is mainly intended as a replacement for the C++"
+ elog "standard library when using clang."
+ elog "To use it, instead of libstdc++, use:"
+ elog " clang++ -stdlib=libc++"
+ elog "to compile your C++ programs."
+}
diff --git a/sys-libs/libcxx/libcxx-3.6.1.ebuild b/sys-libs/libcxx/libcxx-3.6.1.ebuild
new file mode 100644
index 000000000000..92689d826fc6
--- /dev/null
+++ b/sys-libs/libcxx/libcxx-3.6.1.ebuild
@@ -0,0 +1,170 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+ESVN_REPO_URI="http://llvm.org/svn/llvm-project/libcxx/trunk"
+
+[ "${PV%9999}" != "${PV}" ] && SCM="subversion" || SCM=""
+
+inherit ${SCM} flag-o-matic toolchain-funcs multilib multilib-minimal
+
+DESCRIPTION="New implementation of the C++ standard library, targeting C++11"
+HOMEPAGE="http://libcxx.llvm.org/"
+if [ "${PV%9999}" = "${PV}" ] ; then
+ SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz"
+ S="${WORKDIR}/${P}.src"
+else
+ SRC_URI=""
+fi
+
+LICENSE="|| ( UoI-NCSA MIT )"
+SLOT="0"
+if [ "${PV%9999}" = "${PV}" ] ; then
+ KEYWORDS="~amd64 ~mips ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux"
+else
+ KEYWORDS=""
+fi
+IUSE="elibc_glibc +libcxxrt +static-libs test"
+
+RDEPEND="libcxxrt? ( >=sys-libs/libcxxrt-0.0_p20130725[static-libs?,${MULTILIB_USEDEP}] )
+ !libcxxrt? ( >=sys-devel/gcc-4.7:=[cxx] )"
+DEPEND="${RDEPEND}
+ test? ( sys-devel/clang )
+ app-arch/xz-utils"
+
+DOCS=( CREDITS.TXT )
+
+pkg_setup() {
+ if ! use libcxxrt ; then
+ ewarn "You have disabled USE=libcxxrt. This will build ${PN} against"
+ ewarn "libsupc++. Please note that this is not well supported."
+ ewarn "In particular, static linking will not work."
+ fi
+ if [[ $(gcc-version) < 4.7 ]] && [[ $(tc-getCXX) != *clang++* ]] ; then
+ eerror "${PN} needs to be built with clang++ or gcc-4.7 or later."
+ eerror "Please use gcc-config to switch to gcc-4.7 or later version."
+ die
+ fi
+}
+
+src_prepare() {
+ cp -f "${FILESDIR}/Makefile" lib/ || die
+ multilib_copy_sources
+}
+
+src_configure() {
+ export LIBS="-lpthread -lrt -lc -lgcc_s"
+ if use libcxxrt ; then
+ append-cppflags -DLIBCXXRT "-I${EPREFIX}/usr/include/libcxxrt/"
+ LIBS="-lcxxrt ${LIBS}"
+ cp "${EPREFIX}/usr/include/libcxxrt/"*.h "${S}/include"
+ else
+ # Very hackish, see $HOMEPAGE
+ # If someone has a clever idea, please share it!
+ local includes="$(echo | ${CHOST}-g++ -Wp,-v -x c++ - -fsyntax-only 2>&1 | grep -C 2 '#include.*<...>' | tail -n 2 | sed -e 's/^ /-I/' | tr '\n' ' ')"
+ local libcxx_gcc_dirs="$(echo | ${CHOST}-g++ -Wp,-v -x c++ - -fsyntax-only 2>&1 | grep -C 2 '#include.*<...>' | tail -n 2 | tr '\n' ' ')"
+ append-cppflags -D__GLIBCXX__ ${includes}
+ LIBS="-lsupc++ ${LIBS}"
+ local libsupcxx_includes="cxxabi.h bits/c++config.h bits/os_defines.h bits/cpu_defines.h bits/cxxabi_tweaks.h bits/cxxabi_forced.h"
+ for i in ${libsupcxx_includes} ; do
+ local found=""
+ [ -d "${S}/include/$(dirname ${i})/" ] || mkdir -p "${S}/include/$(dirname ${i})"
+ for j in ${libcxx_gcc_dirs} ; do
+ if [ -f "${j}/${i}" ] ; then
+ cp "${j}/${i}" "${S}/include/$(dirname ${i})/" || die
+ found=yes
+ fi
+ done
+ [ -n "${found}" ] || die "Header not found: ${i}"
+ done
+ fi
+
+ tc-export AR CC CXX
+
+ append-ldflags "-Wl,-z,defs" # make sure we are not underlinked
+}
+
+multilib_src_compile() {
+ cd "${BUILD_DIR}/lib" || die
+ emake shared
+ use static-libs && emake static
+}
+
+# Tests fail for now, if anybody is able to fix them, help is very welcome.
+multilib_src_test() {
+ cd "${BUILD_DIR}/test"
+ LD_LIBRARY_PATH="${BUILD_DIR}/lib:${LD_LIBRARY_PATH}" \
+ CC="clang++ $(get_abi_CFLAGS) ${CXXFLAGS}" \
+ HEADER_INCLUDE="-I${BUILD_DIR}/include" \
+ SOURCE_LIB="-L${BUILD_DIR}/lib" \
+ LIBS="-lm $(usex libcxxrt -lcxxrt "")" \
+ ./testit || die
+ # TODO: fix link against libsupc++
+}
+
+# Usage: deps
+gen_ldscript() {
+ local output_format
+ output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p')
+ [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )"
+
+ cat <<-END_LDSCRIPT
+/* GNU ld script
+ Include missing dependencies
+*/
+${output_format}
+GROUP ( $@ )
+END_LDSCRIPT
+}
+
+gen_static_ldscript() {
+ if use libcxxrt ; then
+ # Move it first.
+ mv "${ED}/usr/$(get_libdir)/libc++.a" "${ED}/usr/$(get_libdir)/libc++_static.a" || die
+
+ # Generate libc++.a ldscript for inclusion of its dependencies so that
+ # clang++ -stdlib=libc++ -static works out of the box.
+ local deps="${EPREFIX}/usr/$(get_libdir)/libc++_static.a ${EPREFIX}/usr/$(get_libdir)/libcxxrt.a"
+ # On Linux/glibc it does not link without libpthread or libdl. It is
+ # fine on FreeBSD.
+ use elibc_glibc && deps="${deps} ${EPREFIX}/usr/$(get_libdir)/libpthread.a ${EPREFIX}/usr/$(get_libdir)/libdl.a"
+
+ gen_ldscript "${deps}" > "${ED}/usr/$(get_libdir)/libc++.a"
+ fi
+ # TODO: Generate a libc++.a ldscript when building against libsupc++
+}
+
+gen_shared_ldscript() {
+ if use libcxxrt ; then
+ mv "${ED}/usr/$(get_libdir)/libc++.so" "${ED}/usr/$(get_libdir)/libc++_shared.so" || die
+ local deps="${EPREFIX}/usr/$(get_libdir)/libc++_shared.so ${EPREFIX}/usr/$(get_libdir)/libcxxrt.so"
+ gen_ldscript "${deps}" > "${ED}/usr/$(get_libdir)/libc++.so"
+ fi
+ # TODO: Generate the linker script for other confiurations too.
+}
+
+multilib_src_install() {
+ cd "${BUILD_DIR}/lib"
+ if use static-libs ; then
+ dolib.a libc++.a
+ gen_static_ldscript
+ fi
+ dolib.so libc++.so*
+ gen_shared_ldscript
+}
+
+multilib_src_install_all() {
+ einstalldocs
+ insinto /usr/include/c++/v1
+ doins -r include/*
+}
+
+pkg_postinst() {
+ elog "This package (${PN}) is mainly intended as a replacement for the C++"
+ elog "standard library when using clang."
+ elog "To use it, instead of libstdc++, use:"
+ elog " clang++ -stdlib=libc++"
+ elog "to compile your C++ programs."
+}
diff --git a/sys-libs/libcxx/libcxx-3.6.2.ebuild b/sys-libs/libcxx/libcxx-3.6.2.ebuild
new file mode 100644
index 000000000000..92689d826fc6
--- /dev/null
+++ b/sys-libs/libcxx/libcxx-3.6.2.ebuild
@@ -0,0 +1,170 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+ESVN_REPO_URI="http://llvm.org/svn/llvm-project/libcxx/trunk"
+
+[ "${PV%9999}" != "${PV}" ] && SCM="subversion" || SCM=""
+
+inherit ${SCM} flag-o-matic toolchain-funcs multilib multilib-minimal
+
+DESCRIPTION="New implementation of the C++ standard library, targeting C++11"
+HOMEPAGE="http://libcxx.llvm.org/"
+if [ "${PV%9999}" = "${PV}" ] ; then
+ SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz"
+ S="${WORKDIR}/${P}.src"
+else
+ SRC_URI=""
+fi
+
+LICENSE="|| ( UoI-NCSA MIT )"
+SLOT="0"
+if [ "${PV%9999}" = "${PV}" ] ; then
+ KEYWORDS="~amd64 ~mips ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux"
+else
+ KEYWORDS=""
+fi
+IUSE="elibc_glibc +libcxxrt +static-libs test"
+
+RDEPEND="libcxxrt? ( >=sys-libs/libcxxrt-0.0_p20130725[static-libs?,${MULTILIB_USEDEP}] )
+ !libcxxrt? ( >=sys-devel/gcc-4.7:=[cxx] )"
+DEPEND="${RDEPEND}
+ test? ( sys-devel/clang )
+ app-arch/xz-utils"
+
+DOCS=( CREDITS.TXT )
+
+pkg_setup() {
+ if ! use libcxxrt ; then
+ ewarn "You have disabled USE=libcxxrt. This will build ${PN} against"
+ ewarn "libsupc++. Please note that this is not well supported."
+ ewarn "In particular, static linking will not work."
+ fi
+ if [[ $(gcc-version) < 4.7 ]] && [[ $(tc-getCXX) != *clang++* ]] ; then
+ eerror "${PN} needs to be built with clang++ or gcc-4.7 or later."
+ eerror "Please use gcc-config to switch to gcc-4.7 or later version."
+ die
+ fi
+}
+
+src_prepare() {
+ cp -f "${FILESDIR}/Makefile" lib/ || die
+ multilib_copy_sources
+}
+
+src_configure() {
+ export LIBS="-lpthread -lrt -lc -lgcc_s"
+ if use libcxxrt ; then
+ append-cppflags -DLIBCXXRT "-I${EPREFIX}/usr/include/libcxxrt/"
+ LIBS="-lcxxrt ${LIBS}"
+ cp "${EPREFIX}/usr/include/libcxxrt/"*.h "${S}/include"
+ else
+ # Very hackish, see $HOMEPAGE
+ # If someone has a clever idea, please share it!
+ local includes="$(echo | ${CHOST}-g++ -Wp,-v -x c++ - -fsyntax-only 2>&1 | grep -C 2 '#include.*<...>' | tail -n 2 | sed -e 's/^ /-I/' | tr '\n' ' ')"
+ local libcxx_gcc_dirs="$(echo | ${CHOST}-g++ -Wp,-v -x c++ - -fsyntax-only 2>&1 | grep -C 2 '#include.*<...>' | tail -n 2 | tr '\n' ' ')"
+ append-cppflags -D__GLIBCXX__ ${includes}
+ LIBS="-lsupc++ ${LIBS}"
+ local libsupcxx_includes="cxxabi.h bits/c++config.h bits/os_defines.h bits/cpu_defines.h bits/cxxabi_tweaks.h bits/cxxabi_forced.h"
+ for i in ${libsupcxx_includes} ; do
+ local found=""
+ [ -d "${S}/include/$(dirname ${i})/" ] || mkdir -p "${S}/include/$(dirname ${i})"
+ for j in ${libcxx_gcc_dirs} ; do
+ if [ -f "${j}/${i}" ] ; then
+ cp "${j}/${i}" "${S}/include/$(dirname ${i})/" || die
+ found=yes
+ fi
+ done
+ [ -n "${found}" ] || die "Header not found: ${i}"
+ done
+ fi
+
+ tc-export AR CC CXX
+
+ append-ldflags "-Wl,-z,defs" # make sure we are not underlinked
+}
+
+multilib_src_compile() {
+ cd "${BUILD_DIR}/lib" || die
+ emake shared
+ use static-libs && emake static
+}
+
+# Tests fail for now, if anybody is able to fix them, help is very welcome.
+multilib_src_test() {
+ cd "${BUILD_DIR}/test"
+ LD_LIBRARY_PATH="${BUILD_DIR}/lib:${LD_LIBRARY_PATH}" \
+ CC="clang++ $(get_abi_CFLAGS) ${CXXFLAGS}" \
+ HEADER_INCLUDE="-I${BUILD_DIR}/include" \
+ SOURCE_LIB="-L${BUILD_DIR}/lib" \
+ LIBS="-lm $(usex libcxxrt -lcxxrt "")" \
+ ./testit || die
+ # TODO: fix link against libsupc++
+}
+
+# Usage: deps
+gen_ldscript() {
+ local output_format
+ output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p')
+ [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )"
+
+ cat <<-END_LDSCRIPT
+/* GNU ld script
+ Include missing dependencies
+*/
+${output_format}
+GROUP ( $@ )
+END_LDSCRIPT
+}
+
+gen_static_ldscript() {
+ if use libcxxrt ; then
+ # Move it first.
+ mv "${ED}/usr/$(get_libdir)/libc++.a" "${ED}/usr/$(get_libdir)/libc++_static.a" || die
+
+ # Generate libc++.a ldscript for inclusion of its dependencies so that
+ # clang++ -stdlib=libc++ -static works out of the box.
+ local deps="${EPREFIX}/usr/$(get_libdir)/libc++_static.a ${EPREFIX}/usr/$(get_libdir)/libcxxrt.a"
+ # On Linux/glibc it does not link without libpthread or libdl. It is
+ # fine on FreeBSD.
+ use elibc_glibc && deps="${deps} ${EPREFIX}/usr/$(get_libdir)/libpthread.a ${EPREFIX}/usr/$(get_libdir)/libdl.a"
+
+ gen_ldscript "${deps}" > "${ED}/usr/$(get_libdir)/libc++.a"
+ fi
+ # TODO: Generate a libc++.a ldscript when building against libsupc++
+}
+
+gen_shared_ldscript() {
+ if use libcxxrt ; then
+ mv "${ED}/usr/$(get_libdir)/libc++.so" "${ED}/usr/$(get_libdir)/libc++_shared.so" || die
+ local deps="${EPREFIX}/usr/$(get_libdir)/libc++_shared.so ${EPREFIX}/usr/$(get_libdir)/libcxxrt.so"
+ gen_ldscript "${deps}" > "${ED}/usr/$(get_libdir)/libc++.so"
+ fi
+ # TODO: Generate the linker script for other confiurations too.
+}
+
+multilib_src_install() {
+ cd "${BUILD_DIR}/lib"
+ if use static-libs ; then
+ dolib.a libc++.a
+ gen_static_ldscript
+ fi
+ dolib.so libc++.so*
+ gen_shared_ldscript
+}
+
+multilib_src_install_all() {
+ einstalldocs
+ insinto /usr/include/c++/v1
+ doins -r include/*
+}
+
+pkg_postinst() {
+ elog "This package (${PN}) is mainly intended as a replacement for the C++"
+ elog "standard library when using clang."
+ elog "To use it, instead of libstdc++, use:"
+ elog " clang++ -stdlib=libc++"
+ elog "to compile your C++ programs."
+}
diff --git a/sys-libs/libcxx/libcxx-9999.ebuild b/sys-libs/libcxx/libcxx-9999.ebuild
new file mode 100644
index 000000000000..92689d826fc6
--- /dev/null
+++ b/sys-libs/libcxx/libcxx-9999.ebuild
@@ -0,0 +1,170 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+ESVN_REPO_URI="http://llvm.org/svn/llvm-project/libcxx/trunk"
+
+[ "${PV%9999}" != "${PV}" ] && SCM="subversion" || SCM=""
+
+inherit ${SCM} flag-o-matic toolchain-funcs multilib multilib-minimal
+
+DESCRIPTION="New implementation of the C++ standard library, targeting C++11"
+HOMEPAGE="http://libcxx.llvm.org/"
+if [ "${PV%9999}" = "${PV}" ] ; then
+ SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz"
+ S="${WORKDIR}/${P}.src"
+else
+ SRC_URI=""
+fi
+
+LICENSE="|| ( UoI-NCSA MIT )"
+SLOT="0"
+if [ "${PV%9999}" = "${PV}" ] ; then
+ KEYWORDS="~amd64 ~mips ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux"
+else
+ KEYWORDS=""
+fi
+IUSE="elibc_glibc +libcxxrt +static-libs test"
+
+RDEPEND="libcxxrt? ( >=sys-libs/libcxxrt-0.0_p20130725[static-libs?,${MULTILIB_USEDEP}] )
+ !libcxxrt? ( >=sys-devel/gcc-4.7:=[cxx] )"
+DEPEND="${RDEPEND}
+ test? ( sys-devel/clang )
+ app-arch/xz-utils"
+
+DOCS=( CREDITS.TXT )
+
+pkg_setup() {
+ if ! use libcxxrt ; then
+ ewarn "You have disabled USE=libcxxrt. This will build ${PN} against"
+ ewarn "libsupc++. Please note that this is not well supported."
+ ewarn "In particular, static linking will not work."
+ fi
+ if [[ $(gcc-version) < 4.7 ]] && [[ $(tc-getCXX) != *clang++* ]] ; then
+ eerror "${PN} needs to be built with clang++ or gcc-4.7 or later."
+ eerror "Please use gcc-config to switch to gcc-4.7 or later version."
+ die
+ fi
+}
+
+src_prepare() {
+ cp -f "${FILESDIR}/Makefile" lib/ || die
+ multilib_copy_sources
+}
+
+src_configure() {
+ export LIBS="-lpthread -lrt -lc -lgcc_s"
+ if use libcxxrt ; then
+ append-cppflags -DLIBCXXRT "-I${EPREFIX}/usr/include/libcxxrt/"
+ LIBS="-lcxxrt ${LIBS}"
+ cp "${EPREFIX}/usr/include/libcxxrt/"*.h "${S}/include"
+ else
+ # Very hackish, see $HOMEPAGE
+ # If someone has a clever idea, please share it!
+ local includes="$(echo | ${CHOST}-g++ -Wp,-v -x c++ - -fsyntax-only 2>&1 | grep -C 2 '#include.*<...>' | tail -n 2 | sed -e 's/^ /-I/' | tr '\n' ' ')"
+ local libcxx_gcc_dirs="$(echo | ${CHOST}-g++ -Wp,-v -x c++ - -fsyntax-only 2>&1 | grep -C 2 '#include.*<...>' | tail -n 2 | tr '\n' ' ')"
+ append-cppflags -D__GLIBCXX__ ${includes}
+ LIBS="-lsupc++ ${LIBS}"
+ local libsupcxx_includes="cxxabi.h bits/c++config.h bits/os_defines.h bits/cpu_defines.h bits/cxxabi_tweaks.h bits/cxxabi_forced.h"
+ for i in ${libsupcxx_includes} ; do
+ local found=""
+ [ -d "${S}/include/$(dirname ${i})/" ] || mkdir -p "${S}/include/$(dirname ${i})"
+ for j in ${libcxx_gcc_dirs} ; do
+ if [ -f "${j}/${i}" ] ; then
+ cp "${j}/${i}" "${S}/include/$(dirname ${i})/" || die
+ found=yes
+ fi
+ done
+ [ -n "${found}" ] || die "Header not found: ${i}"
+ done
+ fi
+
+ tc-export AR CC CXX
+
+ append-ldflags "-Wl,-z,defs" # make sure we are not underlinked
+}
+
+multilib_src_compile() {
+ cd "${BUILD_DIR}/lib" || die
+ emake shared
+ use static-libs && emake static
+}
+
+# Tests fail for now, if anybody is able to fix them, help is very welcome.
+multilib_src_test() {
+ cd "${BUILD_DIR}/test"
+ LD_LIBRARY_PATH="${BUILD_DIR}/lib:${LD_LIBRARY_PATH}" \
+ CC="clang++ $(get_abi_CFLAGS) ${CXXFLAGS}" \
+ HEADER_INCLUDE="-I${BUILD_DIR}/include" \
+ SOURCE_LIB="-L${BUILD_DIR}/lib" \
+ LIBS="-lm $(usex libcxxrt -lcxxrt "")" \
+ ./testit || die
+ # TODO: fix link against libsupc++
+}
+
+# Usage: deps
+gen_ldscript() {
+ local output_format
+ output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p')
+ [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )"
+
+ cat <<-END_LDSCRIPT
+/* GNU ld script
+ Include missing dependencies
+*/
+${output_format}
+GROUP ( $@ )
+END_LDSCRIPT
+}
+
+gen_static_ldscript() {
+ if use libcxxrt ; then
+ # Move it first.
+ mv "${ED}/usr/$(get_libdir)/libc++.a" "${ED}/usr/$(get_libdir)/libc++_static.a" || die
+
+ # Generate libc++.a ldscript for inclusion of its dependencies so that
+ # clang++ -stdlib=libc++ -static works out of the box.
+ local deps="${EPREFIX}/usr/$(get_libdir)/libc++_static.a ${EPREFIX}/usr/$(get_libdir)/libcxxrt.a"
+ # On Linux/glibc it does not link without libpthread or libdl. It is
+ # fine on FreeBSD.
+ use elibc_glibc && deps="${deps} ${EPREFIX}/usr/$(get_libdir)/libpthread.a ${EPREFIX}/usr/$(get_libdir)/libdl.a"
+
+ gen_ldscript "${deps}" > "${ED}/usr/$(get_libdir)/libc++.a"
+ fi
+ # TODO: Generate a libc++.a ldscript when building against libsupc++
+}
+
+gen_shared_ldscript() {
+ if use libcxxrt ; then
+ mv "${ED}/usr/$(get_libdir)/libc++.so" "${ED}/usr/$(get_libdir)/libc++_shared.so" || die
+ local deps="${EPREFIX}/usr/$(get_libdir)/libc++_shared.so ${EPREFIX}/usr/$(get_libdir)/libcxxrt.so"
+ gen_ldscript "${deps}" > "${ED}/usr/$(get_libdir)/libc++.so"
+ fi
+ # TODO: Generate the linker script for other confiurations too.
+}
+
+multilib_src_install() {
+ cd "${BUILD_DIR}/lib"
+ if use static-libs ; then
+ dolib.a libc++.a
+ gen_static_ldscript
+ fi
+ dolib.so libc++.so*
+ gen_shared_ldscript
+}
+
+multilib_src_install_all() {
+ einstalldocs
+ insinto /usr/include/c++/v1
+ doins -r include/*
+}
+
+pkg_postinst() {
+ elog "This package (${PN}) is mainly intended as a replacement for the C++"
+ elog "standard library when using clang."
+ elog "To use it, instead of libstdc++, use:"
+ elog " clang++ -stdlib=libc++"
+ elog "to compile your C++ programs."
+}
diff --git a/sys-libs/libcxx/metadata.xml b/sys-libs/libcxx/metadata.xml
new file mode 100644
index 000000000000..578f810d9f7a
--- /dev/null
+++ b/sys-libs/libcxx/metadata.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>bsd</herd>
+ <!-- BSD is here because the plan is to have libc++ as the standard C++
+ library with clang. A llvm herd would make a lot of sense here too -->
+ <maintainer>
+ <email>aballier@gentoo.org</email>
+ <name>Alexis Ballier</name>
+ </maintainer>
+ <use>
+ <flag name="libcxxrt">Build on top of <pkg>sys-libs/libcxxrt</pkg> instead of gcc's libsupc++ (avoids depending on gcc).</flag>
+ </use>
+</pkgmetadata>
+
diff --git a/sys-libs/libcxxrt/Manifest b/sys-libs/libcxxrt/Manifest
new file mode 100644
index 000000000000..34a5c0f9d403
--- /dev/null
+++ b/sys-libs/libcxxrt/Manifest
@@ -0,0 +1,2 @@
+DIST libcxxrt-0.0_p20140322.tar.xz 58208 SHA256 39392e1081710d7bf62de1a9723632adbaed5cd516e8b27af764195b8ea9aeb0 SHA512 8cc2f3779a28b8eb215c3dc97e1382651016127ec6b1feb5067de435841c20e6338662172176f003242f1393b8df3ecf91eaa85b54281e1c588dab44d01ca930 WHIRLPOOL 1e6b105cb6650762025f3ce0b6853eff84c94d6fb6c34269b6e3d92984c66308d59c20f2b4311cafea24928f0e3e645527ea6b041b939e941a05f2fea9a2c02e
+DIST libcxxrt-0.0_p20150423.tar.xz 58596 SHA256 a633256ffe43261dd873866aa4a0be9aaa8bdd38f8d554f16c209e84be2f1a88 SHA512 67a3b9204cee7b7900228483b8e24898d83f76b3ff2ed94bbbd67ca3fba623021e1b346c91ef46955da78f2e001395dc84a2f496223b52a0e59e97ff2e27e247 WHIRLPOOL bcf34a715b7aafa4169d39f045896be9230d3365dfffc422d91af160c64a254561a7f2e67bcdc35b4e2a2032a9d1c5e87eeebbc5c40607737f5715bbeeb4b530
diff --git a/sys-libs/libcxxrt/files/Makefile b/sys-libs/libcxxrt/files/Makefile
new file mode 100644
index 000000000000..18b90a7cf712
--- /dev/null
+++ b/sys-libs/libcxxrt/files/Makefile
@@ -0,0 +1,23 @@
+LIB=cxxrt
+MAJ=1
+OBJS=dynamic_cast.o exception.o guard.o stdexcept.o typeinfo.o memory.o auxhelper.o libelftc_dem_gnu3.o
+SOBJS=${OBJS:.o=.So}
+
+static: lib$(LIB).a
+
+shared: lib$(LIB).so
+
+%.So: %.cc
+ $(CXX) -fPIC $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
+
+%.So: %.c
+ $(CC) -fPIC $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
+
+lib$(LIB).a: $(OBJS)
+ $(AR) cr $@ $^
+
+lib$(LIB).so.$(MAJ): $(SOBJS)
+ $(CXX) -fPIC -nodefaultlibs $(CXXFLAGS) $(LDFLAGS) -shared -Wl,-soname,$@ -o $@ $^ $(LIBS)
+
+lib$(LIB).so: lib$(LIB).so.$(MAJ)
+ ln -s $< $@
diff --git a/sys-libs/libcxxrt/files/Makefile.test b/sys-libs/libcxxrt/files/Makefile.test
new file mode 100644
index 000000000000..55099426e7b4
--- /dev/null
+++ b/sys-libs/libcxxrt/files/Makefile.test
@@ -0,0 +1,7 @@
+OBJS=test.o test_exception.o test_guard.o test_typeinfo.o
+
+cxxrttest: $(OBJS)
+ $(CXX) -nodefaultlibs $(CXXFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
+
+check: cxxrttest
+ ./cxxrttest
diff --git a/sys-libs/libcxxrt/files/prepare_snapshot.sh b/sys-libs/libcxxrt/files/prepare_snapshot.sh
new file mode 100755
index 000000000000..004bea7b2040
--- /dev/null
+++ b/sys-libs/libcxxrt/files/prepare_snapshot.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+VERSION=$(date +%Y%m%d)
+BASE_VERSION="0.0"
+PACKAGE="libcxxrt-${BASE_VERSION}_p${VERSION}"
+
+git clone git://github.com/pathscale/libcxxrt.git ${PACKAGE}
+
+find "${PACKAGE}" -type d -name '.svn' -prune -print0 | xargs -0 rm -rf
+find "${PACKAGE}" -type d -name '.git' -prune -print0 | xargs -0 rm -rf
+
+tar cJf ${PACKAGE}.tar.xz ${PACKAGE}
+rm -rf ${PACKAGE}/
+
+echo "Tarball: \"${PACKAGE}.tar.xz\""
+
+echo "** all done **"
diff --git a/sys-libs/libcxxrt/libcxxrt-0.0_p20140322.ebuild b/sys-libs/libcxxrt/libcxxrt-0.0_p20140322.ebuild
new file mode 100644
index 000000000000..815bede3d4e6
--- /dev/null
+++ b/sys-libs/libcxxrt/libcxxrt-0.0_p20140322.ebuild
@@ -0,0 +1,71 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+EGIT_REPO_URI="git://github.com/pathscale/libcxxrt.git"
+
+[ "${PV%9999}" != "${PV}" ] && SCM="git-2" || SCM=""
+
+inherit flag-o-matic toolchain-funcs portability ${SCM} multilib-minimal
+
+DESCRIPTION="C++ Runtime from PathScale, FreeBSD and NetBSD"
+HOMEPAGE="https://github.com/pathscale/libcxxrt http://www.pathscale.com/node/265"
+if [ "${PV%9999}" = "${PV}" ] ; then
+ SRC_URI="mirror://gentoo/${P}.tar.xz"
+ DEPEND="app-arch/xz-utils"
+else
+ SRC_URI=""
+fi
+
+LICENSE="BSD-2"
+SLOT="0"
+if [ "${PV%9999}" = "${PV}" ] ; then
+ KEYWORDS="~amd64 ~mips ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux"
+else
+ KEYWORDS=""
+fi
+IUSE="libunwind static-libs"
+
+RDEPEND="libunwind? ( >=sys-libs/libunwind-1.0.1-r1[static-libs?] )"
+DEPEND="${RDEPEND}
+ ${DEPEND}"
+
+DOCS=( AUTHORS COPYRIGHT README )
+
+src_prepare() {
+ cp "${FILESDIR}/Makefile" src/ || die
+ cp "${FILESDIR}/Makefile.test" test/Makefile || die
+ multilib_copy_sources
+}
+
+multilib_src_compile() {
+ # Notes: we build -nodefaultlibs to avoid linking to gcc libs.
+ # libcxxrt needs: dladdr (dlopen_lib), libunwind or libgcc_s and the libc.
+ tc-export CC CXX AR
+ append-ldflags "-Wl,-z,defs" # make sure we are not underlinked
+ cd "${BUILD_DIR}/src"
+ LIBS="$(dlopen_lib) -l$(usex libunwind unwind gcc_s) -lc" emake shared
+ use static-libs && emake static
+}
+
+multilib_src_test() {
+ cd "${BUILD_DIR}/test"
+ LD_LIBRARY_PATH="${BUILD_DIR}/src:${LD_LIBRARY_PATH}" \
+ LIBS="-L${BUILD_DIR}/src -lcxxrt -l$(usex libunwind unwind gcc_s) -lc" \
+ emake check
+}
+
+multilib_src_install() {
+ # TODO: See README. Maybe hide it in a subdir and let only libcxx know about
+ # it. FreeBSD head installs it in /lib
+ dolib.so src/${PN}.so*
+ use static-libs && dolib.a src/${PN}.a
+}
+
+multilib_src_install_all() {
+ einstalldocs
+ insinto /usr/include/libcxxrt/
+ doins src/cxxabi.h src/unwind*.h
+}
diff --git a/sys-libs/libcxxrt/libcxxrt-0.0_p20150423.ebuild b/sys-libs/libcxxrt/libcxxrt-0.0_p20150423.ebuild
new file mode 100644
index 000000000000..49a035949027
--- /dev/null
+++ b/sys-libs/libcxxrt/libcxxrt-0.0_p20150423.ebuild
@@ -0,0 +1,71 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+EGIT_REPO_URI="git://github.com/pathscale/libcxxrt.git"
+
+[ "${PV%9999}" != "${PV}" ] && SCM="git-2" || SCM=""
+
+inherit flag-o-matic toolchain-funcs portability ${SCM} multilib-minimal
+
+DESCRIPTION="C++ Runtime from PathScale, FreeBSD and NetBSD"
+HOMEPAGE="https://github.com/pathscale/libcxxrt http://www.pathscale.com/node/265"
+if [ "${PV%9999}" = "${PV}" ] ; then
+ SRC_URI="mirror://gentoo/${P}.tar.xz"
+ DEPEND="app-arch/xz-utils"
+else
+ SRC_URI=""
+fi
+
+LICENSE="BSD-2"
+SLOT="0"
+if [ "${PV%9999}" = "${PV}" ] ; then
+ KEYWORDS="~amd64 ~mips ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux"
+else
+ KEYWORDS=""
+fi
+IUSE="libunwind +static-libs"
+
+RDEPEND="libunwind? ( >=sys-libs/libunwind-1.0.1-r1[static-libs?] )"
+DEPEND="${RDEPEND}
+ ${DEPEND}"
+
+DOCS=( AUTHORS COPYRIGHT README )
+
+src_prepare() {
+ cp "${FILESDIR}/Makefile" src/ || die
+ cp "${FILESDIR}/Makefile.test" test/Makefile || die
+ multilib_copy_sources
+}
+
+multilib_src_compile() {
+ # Notes: we build -nodefaultlibs to avoid linking to gcc libs.
+ # libcxxrt needs: dladdr (dlopen_lib), libunwind or libgcc_s and the libc.
+ tc-export CC CXX AR
+ append-ldflags "-Wl,-z,defs" # make sure we are not underlinked
+ cd "${BUILD_DIR}/src"
+ LIBS="$(dlopen_lib) -l$(usex libunwind unwind gcc_s) -lc" emake shared
+ use static-libs && emake static
+}
+
+multilib_src_test() {
+ cd "${BUILD_DIR}/test"
+ LD_LIBRARY_PATH="${BUILD_DIR}/src:${LD_LIBRARY_PATH}" \
+ LIBS="-L${BUILD_DIR}/src -lcxxrt -l$(usex libunwind unwind gcc_s) -lc" \
+ emake check
+}
+
+multilib_src_install() {
+ # TODO: See README. Maybe hide it in a subdir and let only libcxx know about
+ # it. FreeBSD head installs it in /lib
+ dolib.so src/${PN}.so*
+ use static-libs && dolib.a src/${PN}.a
+}
+
+multilib_src_install_all() {
+ einstalldocs
+ insinto /usr/include/libcxxrt/
+ doins src/cxxabi.h src/unwind*.h
+}
diff --git a/sys-libs/libcxxrt/libcxxrt-9999.ebuild b/sys-libs/libcxxrt/libcxxrt-9999.ebuild
new file mode 100644
index 000000000000..49a035949027
--- /dev/null
+++ b/sys-libs/libcxxrt/libcxxrt-9999.ebuild
@@ -0,0 +1,71 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+EGIT_REPO_URI="git://github.com/pathscale/libcxxrt.git"
+
+[ "${PV%9999}" != "${PV}" ] && SCM="git-2" || SCM=""
+
+inherit flag-o-matic toolchain-funcs portability ${SCM} multilib-minimal
+
+DESCRIPTION="C++ Runtime from PathScale, FreeBSD and NetBSD"
+HOMEPAGE="https://github.com/pathscale/libcxxrt http://www.pathscale.com/node/265"
+if [ "${PV%9999}" = "${PV}" ] ; then
+ SRC_URI="mirror://gentoo/${P}.tar.xz"
+ DEPEND="app-arch/xz-utils"
+else
+ SRC_URI=""
+fi
+
+LICENSE="BSD-2"
+SLOT="0"
+if [ "${PV%9999}" = "${PV}" ] ; then
+ KEYWORDS="~amd64 ~mips ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux"
+else
+ KEYWORDS=""
+fi
+IUSE="libunwind +static-libs"
+
+RDEPEND="libunwind? ( >=sys-libs/libunwind-1.0.1-r1[static-libs?] )"
+DEPEND="${RDEPEND}
+ ${DEPEND}"
+
+DOCS=( AUTHORS COPYRIGHT README )
+
+src_prepare() {
+ cp "${FILESDIR}/Makefile" src/ || die
+ cp "${FILESDIR}/Makefile.test" test/Makefile || die
+ multilib_copy_sources
+}
+
+multilib_src_compile() {
+ # Notes: we build -nodefaultlibs to avoid linking to gcc libs.
+ # libcxxrt needs: dladdr (dlopen_lib), libunwind or libgcc_s and the libc.
+ tc-export CC CXX AR
+ append-ldflags "-Wl,-z,defs" # make sure we are not underlinked
+ cd "${BUILD_DIR}/src"
+ LIBS="$(dlopen_lib) -l$(usex libunwind unwind gcc_s) -lc" emake shared
+ use static-libs && emake static
+}
+
+multilib_src_test() {
+ cd "${BUILD_DIR}/test"
+ LD_LIBRARY_PATH="${BUILD_DIR}/src:${LD_LIBRARY_PATH}" \
+ LIBS="-L${BUILD_DIR}/src -lcxxrt -l$(usex libunwind unwind gcc_s) -lc" \
+ emake check
+}
+
+multilib_src_install() {
+ # TODO: See README. Maybe hide it in a subdir and let only libcxx know about
+ # it. FreeBSD head installs it in /lib
+ dolib.so src/${PN}.so*
+ use static-libs && dolib.a src/${PN}.a
+}
+
+multilib_src_install_all() {
+ einstalldocs
+ insinto /usr/include/libcxxrt/
+ doins src/cxxabi.h src/unwind*.h
+}
diff --git a/sys-libs/libcxxrt/metadata.xml b/sys-libs/libcxxrt/metadata.xml
new file mode 100644
index 000000000000..bb8b535288ce
--- /dev/null
+++ b/sys-libs/libcxxrt/metadata.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>bsd</herd>
+ <maintainer>
+ <email>aballier@gentoo.org</email>
+ <name>Alexis Ballier</name>
+ </maintainer>
+ <use>
+ <flag name="libunwind">Use <pkg>sys-libs/libunwind</pkg> instead of libgcc_s for unwinding. This should allow avoiding relying on <pkg>sys-devel/gcc</pkg> but for now clang is setup to use libgcc_s.</flag>
+ </use>
+ <upstream>
+ <remote-id type="github">pathscale/libcxxrt</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-libs/libfaketime/Manifest b/sys-libs/libfaketime/Manifest
new file mode 100644
index 000000000000..bd010b43a42a
--- /dev/null
+++ b/sys-libs/libfaketime/Manifest
@@ -0,0 +1 @@
+DIST libfaketime-0.9.6.tar.gz 51333 SHA256 3a89972708e262ae3a548655a04f197b48e9c82ac2b61acaeb1c47b135a682b7 SHA512 ab2e9c53f4ca2b9dcd2bbcd8de3ab9e27be57547ed9b52a17f07a6fe880fd3a283a6f10018736be2a6ba4e150f54e92161959ccb887be1f78ddfc96058729860 WHIRLPOOL 1a2dcc549286bb9d4e8a576ee8ea44b8508e6b40c581560099cf3351464470ef3b01e0ea8667e9d4973f5f8d35d3eeea68bd258f9ffc2fb0f424e128ba446a6d
diff --git a/sys-libs/libfaketime/libfaketime-0.9.6-r1.ebuild b/sys-libs/libfaketime/libfaketime-0.9.6-r1.ebuild
new file mode 100644
index 000000000000..a0dedf80474e
--- /dev/null
+++ b/sys-libs/libfaketime/libfaketime-0.9.6-r1.ebuild
@@ -0,0 +1,33 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit toolchain-funcs multilib
+
+DESCRIPTION="Report faked system time to programs"
+HOMEPAGE="http://www.code-wizards.com/projects/libfaketime/ https://github.com/wolfcw/libfaketime/"
+SRC_URI="http://www.code-wizards.com/projects/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+
+src_prepare() {
+ tc-export CC
+}
+
+src_compile() {
+ emake CC="$(tc-getCC)" LIBDIRNAME="/$(get_libdir)" PREFIX=/usr
+}
+
+src_install() {
+ dobin src/faketime
+ doman man/faketime.1
+ exeinto /usr/$(get_libdir)
+ doexe src/${PN}*.so.*
+ dosym ${PN}.so.1 /usr/$(get_libdir)/${PN}.so
+ dosym ${PN}MT.so.1 /usr/$(get_libdir)/${PN}MT.so
+ dodoc NEWS README TODO
+}
diff --git a/sys-libs/libfaketime/metadata.xml b/sys-libs/libfaketime/metadata.xml
new file mode 100644
index 000000000000..a08a3edf25c9
--- /dev/null
+++ b/sys-libs/libfaketime/metadata.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>radhermit@gentoo.org</email>
+ <name>Tim Harder</name>
+ </maintainer>
+ <longdescription lang="en">
+ The Fake Time Preload Library (FTPL, a.k.a. libfaketime) intercepts
+ various system calls which programs use to retrieve the current date and time.
+ It can then report faked dates and times (as specified by you, the user) to
+ these programs. This means you can modify the system time a program sees
+ without having to change the time system-wide. FTPL allows you to specify both
+ absolute dates (e.g., 2004-01-01) and relative dates (e.g., 10 days ago).
+ </longdescription>
+ <upstream>
+ <remote-id type="github">wolfcw/libfaketime</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-libs/libfreevec/Manifest b/sys-libs/libfreevec/Manifest
new file mode 100644
index 000000000000..e8c3fe22a709
--- /dev/null
+++ b/sys-libs/libfreevec/Manifest
@@ -0,0 +1 @@
+DIST libfreevec-1.0.4.tar.bz2 485620 RMD160 aa764a7908dabbcc40d32b04716be2ebd8d0ea76 SHA1 dc30a402a83ffdfccd308e340d0e005c5a4c089d SHA256 4f0ea1cbb4daa27fe700766b9a545c820e8ae73460ed79eced682552ed1e586b
diff --git a/sys-libs/libfreevec/libfreevec-1.0.4.ebuild b/sys-libs/libfreevec/libfreevec-1.0.4.ebuild
new file mode 100644
index 000000000000..5045cd8e409b
--- /dev/null
+++ b/sys-libs/libfreevec/libfreevec-1.0.4.ebuild
@@ -0,0 +1,25 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+DESCRIPTION="Altivec enabled libc memory function"
+HOMEPAGE="http://freevec.org"
+SRC_URI="http://www.codex.gr/system/files/${P}.tar.bz2"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~ppc ~ppc64"
+IUSE=""
+
+DEPEND=">=sys-devel/gcc-4.2"
+RDEPEND=""
+
+src_compile() {
+ econf || die "econf failed"
+ emake || die "emake failed"
+
+}
+src_install() {
+ make DESTDIR="${D}" install || die "install failed"
+ dodoc TODO README INSTALL
+}
diff --git a/sys-libs/libfreevec/metadata.xml b/sys-libs/libfreevec/metadata.xml
new file mode 100644
index 000000000000..c5e4f911c5c4
--- /dev/null
+++ b/sys-libs/libfreevec/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>ppc</herd>
+<maintainer>
+ <email>lu_zero@gentoo.org</email>
+</maintainer>
+</pkgmetadata>
diff --git a/sys-libs/libhugetlbfs/Manifest b/sys-libs/libhugetlbfs/Manifest
new file mode 100644
index 000000000000..5a7e936d66d6
--- /dev/null
+++ b/sys-libs/libhugetlbfs/Manifest
@@ -0,0 +1,2 @@
+DIST libhugetlbfs-2.18.tar.gz 181275 SHA256 8c6ed5e884988e0c879a3705455ece153cf805f69cb9c710334e2711acbb6a06 SHA512 6dcdbf571d6a723a40c15e10b24533f16d65f67fe149aa2d25bee48a034d003419d4cf4b6e55fcd385e1214fc4f6b4dda72ba429b9eea9b38be9b1a393528746 WHIRLPOOL da0b17ca4d2a61be919ea47733b3da485714ce29cdc5e854e143ef0e9c0e45517a37649cb056eeeb74efe8c538f566267152aaad5d53ff837a3a15a9e11070cd
+DIST libhugetlbfs-2.19.tar.gz 181504 SHA256 a5ecb6e925ab2e491bcaa4049fbd6484740950da47d474e7af06dfc6bd1f690b SHA512 d21781fe68736eb3bbafeb8f36f4f34d30f290f2f6744b52c1a40161caf2e28b823cd8e9b9c74ec4e6d11f7d398d909f80eb736cc39a64ecc7bf571018bfec7c WHIRLPOOL bd76e6334acd11e55dec790170781aa418a74e4b1bd0007a15c0b65f5c0f4fd977d02eb89d6b16d48b4e4c7fd980ed2bd7ac9a8246179c0480874afe901da851
diff --git a/sys-libs/libhugetlbfs/files/libhugetlbfs-2.6-fixup-testsuite.patch b/sys-libs/libhugetlbfs/files/libhugetlbfs-2.6-fixup-testsuite.patch
new file mode 100644
index 000000000000..12548a884a6f
--- /dev/null
+++ b/sys-libs/libhugetlbfs/files/libhugetlbfs-2.6-fixup-testsuite.patch
@@ -0,0 +1,31 @@
+diff -Nuar --exclude '*.S' --exclude Makefile libhugetlbfs-2.6.orig/tests/run_tests.py libhugetlbfs-2.6/tests/run_tests.py
+--- libhugetlbfs-2.6.orig/tests/run_tests.py 2009-08-24 05:56:07.000000000 -0700
++++ libhugetlbfs-2.6/tests/run_tests.py 2009-10-31 00:40:28.520387427 -0700
+@@ -56,6 +56,11 @@
+ local_env["LD_LIBRARY_PATH"] = "../obj%d:obj%d:%s" \
+ % (bits, bits, local_env.get("LD_LIBRARY_PATH", ""))
+ local_env["HUGETLB_DEFAULT_PAGE_SIZE"] = repr(pagesize)
++ if isinstance(cmd, types.StringType):
++ cmd = 'obj%d/%s' % (bits, cmd)
++ else:
++ s = 'obj%d/%s' % (bits, cmd[0])
++ cmd = (s,)+(cmd[1:])
+
+ p = subprocess.Popen(cmd, env=local_env, stdout=subprocess.PIPE)
+ try:
+@@ -523,10 +528,11 @@
+ elfshare_test("linkshare")
+ elflink_and_share_test("linkhuge")
+
+- # elflink_rw tests
+- elflink_rw_test("linkhuge_rw")
+- # elflink_rw sharing tests
+- elflink_rw_and_share_test("linkhuge_rw")
++ if 32 in wordsizes:
++ # elflink_rw tests
++ elflink_rw_test("linkhuge_rw")
++ # elflink_rw sharing tests
++ elflink_rw_and_share_test("linkhuge_rw")
+
+ # Accounting bug tests
+ # reset free hpages because sharing will have held some
diff --git a/sys-libs/libhugetlbfs/files/libhugetlbfs-2.6-noexec-stack.patch b/sys-libs/libhugetlbfs/files/libhugetlbfs-2.6-noexec-stack.patch
new file mode 100644
index 000000000000..bf964cda7a68
--- /dev/null
+++ b/sys-libs/libhugetlbfs/files/libhugetlbfs-2.6-noexec-stack.patch
@@ -0,0 +1,44 @@
+diff -Nuar libhugetlbfs-2.6.orig/sys-elf32ppclinux.S libhugetlbfs-2.6/sys-elf32ppclinux.S
+--- libhugetlbfs-2.6.orig/sys-elf32ppclinux.S 2009-08-24 12:56:07.000000000 +0000
++++ libhugetlbfs-2.6/sys-elf32ppclinux.S 2009-10-31 06:43:49.040319417 +0000
+@@ -32,3 +32,7 @@
+ mr 8,9
+ sc
+ blr
++
++#if defined(__linux__) && defined(__ELF__)
++ .section .note.GNU-stack,"",%progbits
++#endif
+diff -Nuar libhugetlbfs-2.6.orig/sys-elf64ppc.S libhugetlbfs-2.6/sys-elf64ppc.S
+--- libhugetlbfs-2.6.orig/sys-elf64ppc.S 2009-08-24 12:56:07.000000000 +0000
++++ libhugetlbfs-2.6/sys-elf64ppc.S 2009-10-31 06:43:54.303652251 +0000
+@@ -41,3 +41,7 @@
+ mr 8,9
+ sc
+ blr
++
++#if defined(__linux__) && defined(__ELF__)
++ .section .note.GNU-stack,"",%progbits
++#endif
+diff -Nuar libhugetlbfs-2.6.orig/sys-elf_i386.S libhugetlbfs-2.6/sys-elf_i386.S
+--- libhugetlbfs-2.6.orig/sys-elf_i386.S 2009-08-24 12:56:07.000000000 +0000
++++ libhugetlbfs-2.6/sys-elf_i386.S 2009-10-31 06:43:57.536975670 +0000
+@@ -40,3 +40,7 @@
+ pop %edi
+ pop %ebp
+ ret
++
++#if defined(__linux__) && defined(__ELF__)
++ .section .note.GNU-stack,"",%progbits
++#endif
+diff -Nuar libhugetlbfs-2.6.orig/sys-elf_x86_64.S libhugetlbfs-2.6/sys-elf_x86_64.S
+--- libhugetlbfs-2.6.orig/sys-elf_x86_64.S 2009-08-24 12:56:07.000000000 +0000
++++ libhugetlbfs-2.6/sys-elf_x86_64.S 2009-10-31 06:44:26.943648847 +0000
+@@ -32,3 +32,7 @@
+ mov 0x8(%rsp),%r9
+ syscall
+ retq
++
++#if defined(__linux__) && defined(__ELF__)
++ .section .note.GNU-stack,"",%progbits
++#endif
diff --git a/sys-libs/libhugetlbfs/files/libhugetlbfs-2.9-build.patch b/sys-libs/libhugetlbfs/files/libhugetlbfs-2.9-build.patch
new file mode 100644
index 000000000000..827e2a58d101
--- /dev/null
+++ b/sys-libs/libhugetlbfs/files/libhugetlbfs-2.9-build.patch
@@ -0,0 +1,31 @@
+--- Makefile.orig 2010-08-13 20:14:18.000000000 -0400
++++ Makefile 2010-08-13 20:14:42.000000000 -0400
+@@ -314,24 +314,24 @@
+ $(BIN_OBJ_DIR)/hugectl: $(BIN_OBJ_DIR)/hugectl.o
+ @$(VECHO) LDHOST $@
+ mkdir -p $(BIN_OBJ_DIR)
+- $(CCBIN) $(CPPFLAGS) $(CFLAGS) -o $@ $^
++ $(CCBIN) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(LDFLAGS)
+
+ $(BIN_OBJ_DIR)/hugeedit: $(BIN_OBJ_DIR)/hugeedit.o
+ @$(VECHO) LDHOST $@
+ mkdir -p $(BIN_OBJ_DIR)
+- $(CCBIN) $(CPPFLAGS) $(CFLAGS) $(LIBPATHS) -o $@ $^
++ $(CCBIN) $(CPPFLAGS) $(CFLAGS) $(LIBPATHS) -o $@ $^ $(LDFLAGS)
+
+ HUGEADM_OBJ=hugeadm.o libhugetlbfs_privutils.a
+ $(BIN_OBJ_DIR)/hugeadm: $(foreach file,$(HUGEADM_OBJ),$(BIN_OBJ_DIR)/$(file))
+ @$(VECHO) LDHOST $@
+ mkdir -p $(BIN_OBJ_DIR)
+- $(CCBIN) $(CPPFLAGS) $(CFLAGS) $(LIBPATHS) -o $@ $^
++ $(CCBIN) $(CPPFLAGS) $(CFLAGS) $(LIBPATHS) -o $@ $^ $(LDFLAGS)
+
+ PAGESIZE_OBJ=pagesize.o libhugetlbfs_privutils.a
+ $(BIN_OBJ_DIR)/pagesize: $(foreach file,$(PAGESIZE_OBJ),$(BIN_OBJ_DIR)/$(file))
+ @$(VECHO) LDHOST $@
+ mkdir -p $(BIN_OBJ_DIR)
+- $(CCBIN) $(CPPFLAGS) $(CFLAGS) $(LIBPATHS) -o $@ $^
++ $(CCBIN) $(CPPFLAGS) $(CFLAGS) $(LIBPATHS) -o $@ $^ $(LDFLAGS)
+
+ clean:
+ @$(VECHO) CLEAN
diff --git a/sys-libs/libhugetlbfs/libhugetlbfs-2.18.ebuild b/sys-libs/libhugetlbfs/libhugetlbfs-2.18.ebuild
new file mode 100644
index 000000000000..8dc62c383307
--- /dev/null
+++ b/sys-libs/libhugetlbfs/libhugetlbfs-2.18.ebuild
@@ -0,0 +1,147 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils multilib toolchain-funcs
+
+DESCRIPTION="easy hugepage access"
+HOMEPAGE="http://libhugetlbfs.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc64 ~x86"
+IUSE="static-libs"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2.9-build.patch #332517
+ epatch "${FILESDIR}"/${PN}-2.6-noexec-stack.patch
+ epatch "${FILESDIR}"/${PN}-2.6-fixup-testsuite.patch
+ sed -i \
+ -e '/^PREFIX/s:/local::' \
+ -e '1iBUILDTYPE = NATIVEONLY' \
+ -e '1iV = 1' \
+ -e "/^LIB\(32\)/s:=.*:= $(get_libdir):" \
+ -e '/^CC\(32\|64\)/s:=.*:= $(CC):' \
+ Makefile
+ if [ "$(get_libdir)" == "lib64" ]; then
+ sed -i \
+ -e "/^LIB\(32\)/s:=.*:= lib32:" \
+ Makefile
+ fi
+}
+
+src_compile() {
+ tc-export AR
+ emake CC="$(tc-getCC)" libs tools
+}
+
+src_install() {
+ default
+ use static-libs || rm -f "${D}"/usr/$(get_libdir)/*.a
+ rm "${D}"/usr/bin/oprofile* || die
+}
+
+src_test_alloc_one() {
+ hugeadm="$1"
+ sign="$2"
+ pagesize="$3"
+ pagecount="$4"
+ ${hugeadm} \
+ --pool-pages-max ${pagesize}:${sign}${pagecount} \
+ && \
+ ${hugeadm} \
+ --pool-pages-min ${pagesize}:${sign}${pagecount}
+ return $?
+}
+
+# die is NOT allowed in this src_test block after the marked point, so that we
+# can clean up memory allocation. You'll leak at LEAST 64MiB per run otherwise.
+src_test() {
+ [[ $UID -eq 0 ]] || die "Need FEATURES=-userpriv to run this testsuite"
+ einfo "Building testsuite"
+ emake -j1 tests || die "Failed to build tests"
+
+ hugeadm='obj/hugeadm'
+ allocated=''
+ rc=0
+ # the testcases need 64MiB per pagesize.
+ MIN_HUGEPAGE_RAM=$((64*1024*1024))
+
+ einfo "Planning allocation"
+ PAGESIZES="$(${hugeadm} --page-sizes-all)"
+
+ # Need to do this before we can create the mountpoints.
+ for pagesize in ${PAGESIZES} ; do
+ # The kernel depends on the location :-(
+ mkdir -p /var/lib/hugetlbfs/pagesize-${pagesize}
+ addwrite /var/lib/hugetlbfs/pagesize-${pagesize}
+ done
+ addwrite /proc/sys/vm/
+ addwrite /proc/sys/kernel/shmall
+ addwrite /proc/sys/kernel/shmmax
+ addwrite /proc/sys/kernel/shmmni
+
+ einfo "Checking HugeTLB mountpoints"
+ ${hugeadm} --create-mounts || die "Failed to set up hugetlb mountpoints."
+
+ # -----------------------------------------------------
+ # --------- die is unsafe after this point. -----------
+ # -----------------------------------------------------
+
+ einfo "Starting allocation"
+ for pagesize in ${PAGESIZES} ; do
+ pagecount=$((${MIN_HUGEPAGE_RAM}/${pagesize}))
+ einfo " ${pagecount} @ ${pagesize}"
+ addwrite /var/lib/hugetlbfs/pagesize-${pagesize}
+ src_test_alloc_one "$hugeadm" "+" "${pagesize}" "${pagecount}"
+ rc=$?
+ if [[ $rc -eq 0 ]]; then
+ allocated="${allocated} ${pagesize}:${pagecount}"
+ else
+ eerror "Failed to add ${pagecount} pages of size ${pagesize}"
+ fi
+ done
+
+ einfo "Allocation status"
+ ${hugeadm} --pool-list
+
+ if [[ -n "${allocated}" ]]; then
+ # All our allocations worked, so time to run.
+ einfo "Starting tests"
+ cd "${S}"/tests
+ TESTOPTS="-t func"
+ case $ARCH in
+ amd64|ppc64)
+ TESTOPTS="${TESTOPTS} -b 64"
+ ;;
+ x86)
+ TESTOPTS="${TESTOPTS} -b 32"
+ ;;
+ esac
+ # This needs a bit of work to give a nice exit code still.
+ ./run_tests.py ${TESTOPTS}
+ rc=$?
+ else
+ eerror "Failed to make HugeTLB allocations."
+ rc=1
+ fi
+
+ einfo "Cleaning up memory"
+ cd "${S}"
+ # Cleanup memory allocation
+ for alloc in ${allocated} ; do
+ pagesize="${alloc/:*}"
+ pagecount="${alloc/*:}"
+ einfo " ${pagecount} @ ${pagesize}"
+ src_test_alloc_one "$hugeadm" "-" "${pagesize}" "${pagecount}"
+ done
+
+ # ---------------------------------------------------------
+ # --------- die is safe again after this point. -----------
+ # ---------------------------------------------------------
+
+ return $rc
+}
diff --git a/sys-libs/libhugetlbfs/libhugetlbfs-2.19.ebuild b/sys-libs/libhugetlbfs/libhugetlbfs-2.19.ebuild
new file mode 100644
index 000000000000..84d9e34d8414
--- /dev/null
+++ b/sys-libs/libhugetlbfs/libhugetlbfs-2.19.ebuild
@@ -0,0 +1,147 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils multilib toolchain-funcs
+
+DESCRIPTION="easy hugepage access"
+HOMEPAGE="http://libhugetlbfs.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc64 ~x86"
+IUSE="static-libs"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2.9-build.patch #332517
+ epatch "${FILESDIR}"/${PN}-2.6-noexec-stack.patch
+ epatch "${FILESDIR}"/${PN}-2.6-fixup-testsuite.patch
+ sed -i \
+ -e '/^PREFIX/s:/local::' \
+ -e '1iBUILDTYPE = NATIVEONLY' \
+ -e '1iV = 1' \
+ -e "/^LIB\(32\)/s:=.*:= $(get_libdir):" \
+ -e '/^CC\(32\|64\)/s:=.*:= $(CC):' \
+ Makefile
+ if [ "$(get_libdir)" == "lib64" ]; then
+ sed -i \
+ -e "/^LIB\(32\)/s:=.*:= lib32:" \
+ Makefile
+ fi
+}
+
+src_compile() {
+ tc-export AR
+ emake CC="$(tc-getCC)" libs tools
+}
+
+src_install() {
+ default
+ use static-libs || rm -f "${D}"/usr/$(get_libdir)/*.a
+ rm "${D}"/usr/bin/oprofile* || die
+}
+
+src_test_alloc_one() {
+ hugeadm="$1"
+ sign="$2"
+ pagesize="$3"
+ pagecount="$4"
+ ${hugeadm} \
+ --pool-pages-max ${pagesize}:${sign}${pagecount} \
+ && \
+ ${hugeadm} \
+ --pool-pages-min ${pagesize}:${sign}${pagecount}
+ return $?
+}
+
+# die is NOT allowed in this src_test block after the marked point, so that we
+# can clean up memory allocation. You'll leak at LEAST 64MiB per run otherwise.
+src_test() {
+ [[ $UID -eq 0 ]] || die "Need FEATURES=-userpriv to run this testsuite"
+ einfo "Building testsuite"
+ emake -j1 tests || die "Failed to build tests"
+
+ hugeadm='obj/hugeadm'
+ allocated=''
+ rc=0
+ # the testcases need 64MiB per pagesize.
+ MIN_HUGEPAGE_RAM=$((64*1024*1024))
+
+ einfo "Planning allocation"
+ PAGESIZES="$(${hugeadm} --page-sizes-all)"
+
+ # Need to do this before we can create the mountpoints.
+ for pagesize in ${PAGESIZES} ; do
+ # The kernel depends on the location :-(
+ mkdir -p /var/lib/hugetlbfs/pagesize-${pagesize}
+ addwrite /var/lib/hugetlbfs/pagesize-${pagesize}
+ done
+ addwrite /proc/sys/vm/
+ addwrite /proc/sys/kernel/shmall
+ addwrite /proc/sys/kernel/shmmax
+ addwrite /proc/sys/kernel/shmmni
+
+ einfo "Checking HugeTLB mountpoints"
+ ${hugeadm} --create-mounts || die "Failed to set up hugetlb mountpoints."
+
+ # -----------------------------------------------------
+ # --------- die is unsafe after this point. -----------
+ # -----------------------------------------------------
+
+ einfo "Starting allocation"
+ for pagesize in ${PAGESIZES} ; do
+ pagecount=$((${MIN_HUGEPAGE_RAM}/${pagesize}))
+ einfo " ${pagecount} @ ${pagesize}"
+ addwrite /var/lib/hugetlbfs/pagesize-${pagesize}
+ src_test_alloc_one "$hugeadm" "+" "${pagesize}" "${pagecount}"
+ rc=$?
+ if [[ $rc -eq 0 ]]; then
+ allocated="${allocated} ${pagesize}:${pagecount}"
+ else
+ eerror "Failed to add ${pagecount} pages of size ${pagesize}"
+ fi
+ done
+
+ einfo "Allocation status"
+ ${hugeadm} --pool-list
+
+ if [[ -n "${allocated}" ]]; then
+ # All our allocations worked, so time to run.
+ einfo "Starting tests"
+ cd "${S}"/tests
+ TESTOPTS="-t func"
+ case $ARCH in
+ amd64|ppc64)
+ TESTOPTS="${TESTOPTS} -b 64"
+ ;;
+ x86)
+ TESTOPTS="${TESTOPTS} -b 32"
+ ;;
+ esac
+ # This needs a bit of work to give a nice exit code still.
+ ./run_tests.py ${TESTOPTS}
+ rc=$?
+ else
+ eerror "Failed to make HugeTLB allocations."
+ rc=1
+ fi
+
+ einfo "Cleaning up memory"
+ cd "${S}"
+ # Cleanup memory allocation
+ for alloc in ${allocated} ; do
+ pagesize="${alloc/:*}"
+ pagecount="${alloc/*:}"
+ einfo " ${pagecount} @ ${pagesize}"
+ src_test_alloc_one "$hugeadm" "-" "${pagesize}" "${pagecount}"
+ done
+
+ # ---------------------------------------------------------
+ # --------- die is safe again after this point. -----------
+ # ---------------------------------------------------------
+
+ return $rc
+}
diff --git a/sys-libs/libhugetlbfs/metadata.xml b/sys-libs/libhugetlbfs/metadata.xml
new file mode 100644
index 000000000000..f981d9d66212
--- /dev/null
+++ b/sys-libs/libhugetlbfs/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>base-system</herd>
+ <upstream>
+ <remote-id type="sourceforge">libhugetlbfs</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-libs/libhx/Manifest b/sys-libs/libhx/Manifest
new file mode 100644
index 000000000000..1db827a4004b
--- /dev/null
+++ b/sys-libs/libhx/Manifest
@@ -0,0 +1,2 @@
+DIST libHX-3.16.tar.xz 867336 SHA256 b744e3754eebab5c81a7dbd5d77b3a94af8edf60488e6b4887c2b1cc332511f3 SHA512 d5c6f4ac889f4d1043d58742305632c78143c683be09ddd4288c3911747d4c5c6b33b4c1517813066f7933d87dcb7b8cd1dfb015f08c7e7afccc718899cdd259 WHIRLPOOL 3a0c44b4bd809f6f9051ae6c7a25dd03d85e3dbea0f3f982302f94d1a28bcb9cbfaa7c5a1bbf0a3f4e026cb515043b7496c108031786bd1f4ee1b976ed5de8bb
+DIST libHX-3.22.tar.xz 875516 SHA256 cc2087a964a82d2e50e8161cf458481ededebb7021e4660410cf53248a4c83a3 SHA512 4a50b7171be9f60e1a1bfefb0641f74fa8879c0edb258533ee04ec89617802c48358dc244497fb18d02dc37f828f79f7c52dd5ce2a07d8a2f5e6e6f7b4e97646 WHIRLPOOL 36d582261bce3cf4f3306d49876e4f44811e0782aee8e1b01838aa5397589e227f315d1b5da27ff1a8e8f118322ab9064831ac49c7ae0e26acdec054e8bf07c4
diff --git a/sys-libs/libhx/libhx-3.16.ebuild b/sys-libs/libhx/libhx-3.16.ebuild
new file mode 100644
index 000000000000..cc412e059f5f
--- /dev/null
+++ b/sys-libs/libhx/libhx-3.16.ebuild
@@ -0,0 +1,31 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils
+
+DESCRIPTION="Platform independent library providing basic system functions"
+HOMEPAGE="http://libhx.sourceforge.net"
+SRC_URI="mirror://sourceforge/${PN}/libHX-${PV}.tar.xz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="amd64 ppc x86"
+IUSE=""
+
+DEPEND="app-arch/xz-utils"
+RDEPEND=""
+
+S="${WORKDIR}/libHX-${PV}"
+
+src_configure() {
+ econf --docdir="/usr/share/doc/${PF}"
+}
+
+src_install() {
+ default
+ dodoc doc/*.txt
+ prune_libtool_files --all
+}
diff --git a/sys-libs/libhx/libhx-3.22.ebuild b/sys-libs/libhx/libhx-3.22.ebuild
new file mode 100644
index 000000000000..95558611cde7
--- /dev/null
+++ b/sys-libs/libhx/libhx-3.22.ebuild
@@ -0,0 +1,31 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils
+
+DESCRIPTION="Platform independent library providing basic system functions"
+HOMEPAGE="http://libhx.sourceforge.net"
+SRC_URI="mirror://sourceforge/${PN}/libHX-${PV}.tar.xz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE=""
+
+DEPEND="app-arch/xz-utils"
+RDEPEND=""
+
+S="${WORKDIR}/libHX-${PV}"
+
+src_configure() {
+ econf --docdir="/usr/share/doc/${PF}"
+}
+
+src_install() {
+ default
+ dodoc doc/*.txt
+ prune_libtool_files --all
+}
diff --git a/sys-libs/libhx/metadata.xml b/sys-libs/libhx/metadata.xml
new file mode 100644
index 000000000000..9b490f1e8b1a
--- /dev/null
+++ b/sys-libs/libhx/metadata.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>hanno@gentoo.org</email>
+ </maintainer>
+ <maintainer>
+ <email>mattst88@gentoo.org</email>
+ <name>Matt Turner</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="sourceforge">libhx</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-libs/libieee1284/Manifest b/sys-libs/libieee1284/Manifest
new file mode 100644
index 000000000000..938c1dd9dbb0
--- /dev/null
+++ b/sys-libs/libieee1284/Manifest
@@ -0,0 +1 @@
+DIST libieee1284-0.2.11.tar.bz2 278804 SHA256 7730de107782e5d2b071bdcb5b06a44da74856f00ef4a9be85d1ba4806a38f1a SHA512 06cc3049ce15613d34e39dc71bc572843c61ab64077c29ef9a6257edb0849c98565ff612a4cf787bc9642a39f1c89b7c47a20fb27f2318105be82aad8d472bb9 WHIRLPOOL 16ab2763c11f32ec75c6df8d77a0b558ac572bcea487edb93e4eb67a7461ff96973a78a3fb11ec02d3f93cb71d0c586ee66b4ce5efa471c26f3507a820cc46ed
diff --git a/sys-libs/libieee1284/libieee1284-0.2.11-r1.ebuild b/sys-libs/libieee1284/libieee1284-0.2.11-r1.ebuild
new file mode 100644
index 000000000000..b120d255106f
--- /dev/null
+++ b/sys-libs/libieee1284/libieee1284-0.2.11-r1.ebuild
@@ -0,0 +1,41 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+PYTHON_DEPEND="python? 2"
+inherit python
+
+DESCRIPTION="Library to query devices using IEEE1284"
+HOMEPAGE="http://cyberelk.net/tim/libieee1284/index.html"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc x86 ~x86-fbsd"
+IUSE="doc python"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ doc? (
+ app-text/docbook-sgml-utils
+ >=app-text/docbook-sgml-dtd-4.1
+ app-text/docbook-dsssl-stylesheets
+ dev-perl/XML-RegExp
+ )"
+
+pkg_setup() {
+ python_set_active_version 2
+}
+
+src_configure() {
+ econf \
+ $(use_with python) \
+ --disable-dependency-tracking
+}
+
+src_install () {
+ emake DESTDIR="${D}" install || die "emake install failed"
+ dodoc AUTHORS NEWS README* TODO doc/interface* || die
+}
diff --git a/sys-libs/libieee1284/libieee1284-0.2.11-r2.ebuild b/sys-libs/libieee1284/libieee1284-0.2.11-r2.ebuild
new file mode 100644
index 000000000000..0823473f3a54
--- /dev/null
+++ b/sys-libs/libieee1284/libieee1284-0.2.11-r2.ebuild
@@ -0,0 +1,44 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+PYTHON_DEPEND="python? 2"
+inherit python
+
+DESCRIPTION="Library to query devices using IEEE1284"
+HOMEPAGE="http://cyberelk.net/tim/libieee1284/index.html"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc x86 ~x86-fbsd"
+IUSE="doc python static-libs"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ doc? (
+ app-text/docbook-sgml-utils
+ >=app-text/docbook-sgml-dtd-4.1
+ app-text/docbook-dsssl-stylesheets
+ dev-perl/XML-RegExp
+ )"
+
+pkg_setup() {
+ use python && python_set_active_version 2
+}
+
+src_configure() {
+ econf \
+ --enable-shared \
+ $(use_enable static-libs static) \
+ $(use_with python) \
+ --disable-dependency-tracking
+}
+
+src_install () {
+ emake DESTDIR="${D}" install || die
+ find "${D}" -name '*.la' -delete
+ dodoc AUTHORS NEWS README* TODO doc/interface*
+}
diff --git a/sys-libs/libieee1284/libieee1284-0.2.11-r3.ebuild b/sys-libs/libieee1284/libieee1284-0.2.11-r3.ebuild
new file mode 100644
index 000000000000..0af6c8511d77
--- /dev/null
+++ b/sys-libs/libieee1284/libieee1284-0.2.11-r3.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+PYTHON_DEPEND="python? 2"
+inherit eutils python multilib-minimal
+
+DESCRIPTION="Library to query devices using IEEE1284"
+HOMEPAGE="http://cyberelk.net/tim/libieee1284/index.html"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc x86 ~x86-fbsd"
+IUSE="doc python static-libs"
+
+RDEPEND="abi_x86_32? ( !<=app-emulation/emul-linux-x86-medialibs-20130224-r9
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)] )"
+DEPEND="${RDEPEND}
+ doc? (
+ app-text/docbook-sgml-utils
+ >=app-text/docbook-sgml-dtd-4.1
+ app-text/docbook-dsssl-stylesheets
+ dev-perl/XML-RegExp
+ )"
+
+DOCS="AUTHORS NEWS README* TODO doc/interface*"
+
+pkg_setup() {
+ use python && python_set_active_version 2
+}
+
+multilib_src_configure() {
+ local myconf="--without-python"
+ multilib_is_native_abi && myconf="$(use_with python)"
+
+ ECONF_SOURCE="${S}" econf \
+ --enable-shared \
+ $(use_enable static-libs static) \
+ ${myconf}
+}
+
+multilib_src_install_all() {
+ prune_libtool_files --all
+ einstalldocs
+}
diff --git a/sys-libs/libieee1284/metadata.xml b/sys-libs/libieee1284/metadata.xml
new file mode 100644
index 000000000000..bec15437c073
--- /dev/null
+++ b/sys-libs/libieee1284/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>base-system</herd>
+ <upstream>
+ <remote-id type="sourceforge">libieee1284</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-libs/libixp/Manifest b/sys-libs/libixp/Manifest
new file mode 100644
index 000000000000..5be3f0c3f446
--- /dev/null
+++ b/sys-libs/libixp/Manifest
@@ -0,0 +1 @@
+DIST libixp-0.5_p20110208.tar.xz 655956 SHA256 66ce92b25486505d04b97d838fb9b102cd1edb1455d90916d00dc38369b2c06b
diff --git a/sys-libs/libixp/libixp-0.5_p20110208-r3.ebuild b/sys-libs/libixp/libixp-0.5_p20110208-r3.ebuild
new file mode 100644
index 000000000000..ea2a3bdab2d2
--- /dev/null
+++ b/sys-libs/libixp/libixp-0.5_p20110208-r3.ebuild
@@ -0,0 +1,50 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# hg clone http://hg.suckless.org/libixp
+
+EAPI=4
+inherit multilib toolchain-funcs
+
+DESCRIPTION="A stand-alone client/server 9P library including ixpc client"
+HOMEPAGE="http://libs.suckless.org/libixp"
+SRC_URI="mirror://gentoo/${P}.tar.xz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~hppa ~ppc ~ppc64 ~x86 ~x86-fbsd"
+IUSE=""
+
+RDEPEND=""
+DEPEND="app-arch/xz-utils"
+
+pkg_setup() {
+ myixpconf=(
+ PREFIX="/usr"
+ LIBDIR="/usr/$(get_libdir)"
+ CC="$(tc-getCC) -c"
+ LD="$(tc-getCC) ${LDFLAGS}"
+ AR="$(tc-getAR) crs"
+ MAKESO="1"
+ SOLDFLAGS="-shared"
+ )
+}
+
+src_prepare() {
+ # http://code.google.com/p/libixp/issues/detail?id=2
+ sed -i -e 's:ixp_serve9pconn:ixp_serve9conn:' include/ixp.h || die
+
+ # http://bugs.gentoo.org/393299 http://code.google.com/p/wmii/issues/detail?id=247
+ sed -i -e '69s:uint32_t:unsigned long:' include/ixp.h || die
+}
+
+src_compile() {
+ emake "${myixpconf[@]}"
+}
+
+src_install() {
+ emake "${myixpconf[@]}" DESTDIR="${D}" install
+ dolib.so lib/libixp{,_pthread}.so
+ dodoc NEWS
+}
diff --git a/sys-libs/libixp/metadata.xml b/sys-libs/libixp/metadata.xml
new file mode 100644
index 000000000000..4538a68724a6
--- /dev/null
+++ b/sys-libs/libixp/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer><email>maintainer-needed@gentoo.org</email></maintainer>
+</pkgmetadata>
diff --git a/sys-libs/libkudzu/Manifest b/sys-libs/libkudzu/Manifest
new file mode 100644
index 000000000000..c4bac3a3a1b9
--- /dev/null
+++ b/sys-libs/libkudzu/Manifest
@@ -0,0 +1 @@
+DIST kudzu-1.2.57.1.tar.gz 165855 SHA256 436a3fe44eb906155b954c85887c15d2d9e7ee5107641437443db8997b300687 SHA512 799e7cea840b7495fc007f4e34adc50fecd2fa7ceda2e2779e39639d0b93b10419bd44a0eb910b2e47024a49a4376330653a6fd96e5560c4828d55e18ab5d641 WHIRLPOOL dbed78dbcde3d73627c7950f9a6b8ee96fed0f7585b936b4ec3fe0839472546e64c81b4b65f0eabec95a00c13741090dd10d1b473c4254bfadebaf2c5479a804
diff --git a/sys-libs/libkudzu/files/kudzu-1.2.57.1-sbusfix.patch b/sys-libs/libkudzu/files/kudzu-1.2.57.1-sbusfix.patch
new file mode 100644
index 000000000000..5c186ed631da
--- /dev/null
+++ b/sys-libs/libkudzu/files/kudzu-1.2.57.1-sbusfix.patch
@@ -0,0 +1,72 @@
+--- a/sbus.c
++++ b/sbus.c
+@@ -162,6 +162,7 @@
+ devClass = CLASS_NETWORK;
+ } else if (!strcmp(prop, "le")) {
+ type = "Sun Lance Ethernet";
++ module = "sunlance";
+ devClass = CLASS_NETWORK;
+ } else if (!strcmp(prop, "qe")) {
+ prop = prom_getproperty("channel#", &len);
+@@ -206,9 +207,11 @@
+ devClass = CLASS_SCSI;
+ } else if (!strcmp(prop, "esp")) {
+ type = "Sun Enhanced SCSI Processor (ESP)";
++ module = "esp";
+ devClass = CLASS_SCSI;
+ } else if (!strcmp(prop, "fas")) {
+ type = "Sun Swift (ESP)";
++ module = "esp";
+ devClass = CLASS_SCSI;
+ } else if (!strcmp(prop, "ptisp")) {
+ type = "Performance Technologies ISP";
+@@ -232,19 +235,19 @@
+ while ((*prop >= 'A' && *prop <= 'Z') || *prop == ',')
+ if (*prop++ == ',') break;
+ if (!strcmp(prop, "audio")) {
+- type = "AMD7930";
+- module = "amd7930";
++ type = "Sun|AMD7930";
++ module = "snd-sun-amd7930";
+ devClass = CLASS_AUDIO;
+ } else if (!strcmp(prop, "CS4231")) {
+ if (ebus)
+- type = "CS4231 EB2 DMA (PCI)";
++ type = "Sun|CS4231 EB2 DMA (PCI)";
+ else
+- type = "CS4231 APC DMA (SBUS)";
+- module = "cs4231";
++ type = "Sun|CS4231 APC DMA (SBUS)";
++ module = "snd-sun-cs4231";
+ devClass = CLASS_AUDIO;
+ } else if (!strcmp(prop, "DBRIe")) {
+- type = "SS10/SS20 DBRI";
+- module = "dbri";
++ type = "Sun|SS10/SS20 DBRI";
++ module = "snd-sun-dbri";
+ devClass = CLASS_AUDIO;
+ }
+ prop = prom_getproperty("device_type", &len);
+@@ -452,22 +455,6 @@
+
+ struct device *sbusProbe( enum deviceClass probeClass, int probeFlags,
+ struct device *devlist) {
+- if (probeClass & CLASS_MOUSE) {
+- int fd;
+- struct sbusDevice *mousedev;
+-
+- if ((fd = open("/dev/sunmouse", O_RDONLY)) != -1) {
+- /* FIXME: Should probably talk to the mouse to see
+- if the connector is not empty. */
+- close (fd);
+- mousedev = sbusNewDevice(NULL);
+- mousedev->type = CLASS_MOUSE;
+- mousedev->device = strdup("sunmouse");
+- mousedev->desc = strdup("Sun Mouse");
+- mousedev->next = devlist;
+- devlist = (struct device *)mousedev;
+- }
+- }
+ if (
+ (probeClass & CLASS_OTHER) ||
+ (probeClass & CLASS_NETWORK) ||
diff --git a/sys-libs/libkudzu/files/kudzu-1.2.57.1-sparc-keyboard.patch b/sys-libs/libkudzu/files/kudzu-1.2.57.1-sparc-keyboard.patch
new file mode 100644
index 000000000000..5626a357345d
--- /dev/null
+++ b/sys-libs/libkudzu/files/kudzu-1.2.57.1-sparc-keyboard.patch
@@ -0,0 +1,195 @@
+--- a/keyboard.c
++++ b/keyboard.c
+@@ -21,7 +21,6 @@
+ #include "keyboard.h"
+
+ #ifdef __sparc__
+-#include <asm/kbio.h>
+ #include <asm/openpromio.h>
+ #include <asm/types.h>
+ #endif
+@@ -96,7 +95,15 @@
+ {0, 0}
+ };
+
+-#if !defined(__s390__) && !defined(__s390x__)
++#if defined(__sparc__)
++static int termcmp(struct termios *a, struct termios *b)
++{
++ if (a->c_iflag != b->c_iflag || a->c_oflag != b->c_oflag ||
++ a->c_cflag != b->c_cflag || a->c_lflag != b->c_lflag)
++ return 1;
++ return memcmp(a->c_cc, b->c_cc, sizeof(a->c_cc));
++}
++#elif !defined(__s390__) && !defined(__s390x__)
+ static int termcmp(struct termios *a, struct termios *b)
+ {
+ if (a->c_iflag != b->c_iflag || a->c_oflag != b->c_oflag ||
+@@ -110,150 +117,6 @@
+ struct device *keyboardProbe(enum deviceClass probeClass, int probeFlags,
+ struct device *devlist)
+ {
+-#ifdef __sparc__
+- int fd;
+- char buf[256];
+- struct keyboardDevice *kbddev;
+-
+- if (probeClass & CLASS_KEYBOARD) {
+- static struct {
+- int layout0, layout1, layout2;
+- char *symbols;
+- int use_iso9995_3;
+- } sunkbd_translate[] = {
+- { 0, 33, 80, "", 0, },
+- { 1, 34, 81, "", 0, },
+- { 2, -1, -1, "fr_BE", 0, },
+- { 3, -1, -1, "ca", 0, },
+- { 4, 36, 83, "dk", 1, },
+- { 5, 37, 84, "de", 1, },
+- { 6, 38, 85, "it", 1, },
+- { 7, 39, 86, "nl", 0, },
+- { 8, 40, 87, "no", 1, },
+- { 9, 41, 88, "pt", 1, },
+- { 10, 42, 89, "es", 1, },
+- { 11, 43, 90, "se", 1, },
+- { 12, 44, 91, "fr_CH",1, },
+- { 13, 45, 92, "de_CH",1, },
+- { 14, 46, 93, "gb", 1, },
+- { 16, 47, 94, "ko", 0, },
+- { 17, 48, 95, "tw", 0, },
+- { 32, 49, 96, "jp", 0, },
+- { 50, 97, -1, "fr_CA",0, },
+- { 51, -1, -1, "hu", 0, },
+- { 52, -1, -1, "pl", 0, },
+- { 53, -1, -1, "cs", 0, },
+- { 54, -1, -1, "ru", 0, },
+- { -1, -1, -1, NULL, 0, }
+- };
+-
+- char twelve = 12;
+- int fdstd = 0;
+- char buf[4096];
+-
+- for (fd = 0; fd <= 2; fd++) {
+- sprintf (buf, "/proc/self/fd/%d", fd);
+- if (readlink (buf, buf, 4096) == 12 &&
+- !strncmp (buf, "/dev/console", 12)) {
+- fdstd = 1;
+- break;
+- }
+- }
+- if (!fdstd) {
+- fd = open("/dev/console", O_RDWR);
+- if (fd < 0) return devlist;
+- }
+-
+- kbddev=keyboardNewDevice(NULL);
+- kbddev->type=CLASS_KEYBOARD;
+- if (devlist)
+- kbddev->next = devlist;
+- devlist = (struct device *) kbddev;
+-
+- if (ioctl (fd, TIOCLINUX, &twelve) < 0) {
+- /* Serial console */
+- char desc[64];
+- struct serial_struct si;
+- int line = 0;
+-
+- if (ioctl (fd, TIOCGSERIAL, &si) >= 0) {
+- if (si.line & 1)
+- /* ttyb */
+- line = 1;
+- }
+- if (!fdstd) close(fd);
+- sprintf (desc, "Serial console tty%c", line + 'a');
+- fd = open("/dev/openprom", O_RDONLY);
+- if (fd >= 0) {
+- struct openpromio *op = (struct openpromio *)buf;
+- sprintf (op->oprom_array, "tty%c-mode", line + 'a');
+- op->oprom_size = 4096-128-4;
+- if (ioctl (fd, OPROMGETOPT, op) >= 0 &&
+- op->oprom_size > 0 && op->oprom_size < 40) {
+- strcat (desc, " ");
+- op->oprom_array [op->oprom_size] = 0;
+- strcat (desc, op->oprom_array);
+- }
+- close (fd);
+- }
+- kbddev->desc=strdup(desc);
+- kbddev->device=strdup("console");
+- return devlist;
+- }
+-
+- if (!fdstd) close(fd);
+- fd=open("/dev/kbd", O_RDWR);
+- if (fd < 0) {
+- /* PS/2 keyboard */
+- kbddev->desc=strdup("Generic PS/2 Keyboard");
+- } else {
+- /* Sun keyboard */
+- int kbdtype, kbdlayout, i;
+- char *desc, *desclayout = NULL;
+-
+- kbddev->device=strdup("kbd");
+- desc = "Sun Type4 ";
+- if (ioctl(fd, KIOCTYPE, &kbdtype) >= 0)
+- switch (kbdtype) {
+- case 2: desc = "Sun Type2 "; break;
+- case 3: desc = "Sun Type3 "; break;
+- case 4: ioctl(fd, KIOCLAYOUT, &kbdlayout);
+- if (kbdlayout < 33)
+- desc = "Sun Type4 ";
+- else switch (kbdlayout) {
+- case 33: case 47: case 48: case 49:
+- case 80: case 94: case 95: case 96:
+- desc = "Sun Type5 "; break;
+- case 34: case 81:
+- desc = "Sun Type5 Unix "; break;
+- default:
+- desc = "Sun Type5 Euro "; break;
+- }
+- for (i = 0; sunkbd_translate[i].layout0 != -1; i++) {
+- if (sunkbd_translate[i].layout0 == kbdlayout ||
+- sunkbd_translate[i].layout1 == kbdlayout ||
+- sunkbd_translate[i].layout2 == kbdlayout)
+- break;
+- }
+- if (sunkbd_translate[i].layout0 != -1 &&
+- sunkbd_translate[i].symbols[0])
+- desclayout = sunkbd_translate[i].symbols;
+- break;
+- }
+- if (desclayout) {
+- kbddev->desc = malloc(strlen(desc) + strlen(desclayout) + 1 + strlen("Keyboard") + 1);
+- strcpy (kbddev->desc, desc);
+- strcat (kbddev->desc, desclayout);
+- strcat (kbddev->desc, " Keyboard");
+- } else {
+- kbddev->desc = malloc(strlen(desc) + strlen("Keyboard") + 1);
+- strcpy (kbddev->desc, desc);
+- strcat (kbddev->desc, "Keyboard");
+- }
+- }
+- close (fd);
+- }
+-#else
+ int fd;
+ char twelve = 12;
+ int fdstd = 0;
+@@ -311,7 +174,7 @@
+ kbddev->device = strdup("ttySG0");
+ }
+ #endif
+-#if defined(__i386__) || defined(__x86_64__) || defined(__ia64__)
++#if defined(__i386__) || defined(__x86_64__) || defined(__ia64__) || defined(__sparc__)
+ int cfd;
+ struct termios cmode, mode;
+
+@@ -397,7 +260,6 @@
+ kbddev->device=strdup(desc);
+ }
+ }
+-#endif
+ out:
+ return devlist;
+ }
diff --git a/sys-libs/libkudzu/libkudzu-1.2.57.1.ebuild b/sys-libs/libkudzu/libkudzu-1.2.57.1.ebuild
new file mode 100644
index 000000000000..c5b159bc1773
--- /dev/null
+++ b/sys-libs/libkudzu/libkudzu-1.2.57.1.ebuild
@@ -0,0 +1,62 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils linux-info flag-o-matic toolchain-funcs
+
+DESCRIPTION="Red Hat Hardware detection tools"
+HOMEPAGE="http://rhlinux.redhat.com/kudzu/"
+SRC_URI="mirror://gentoo/kudzu-${PV}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 hppa ia64 -mips ppc ppc64 sparc x86"
+IUSE="zlib"
+
+DEPEND="
+ dev-libs/popt
+ >=sys-apps/pciutils-2.2.4[zlib?]
+ zlib? ( sys-libs/zlib )
+"
+RDEPEND="
+ ${DEPEND}
+ sys-apps/hwdata-gentoo
+ !sys-apps/kudzu
+"
+
+S=${WORKDIR}/kudzu-${PV}
+
+src_prepare() {
+ epatch \
+ "${FILESDIR}"/kudzu-${PV}-sbusfix.patch \
+ "${FILESDIR}"/kudzu-${PV}-sparc-keyboard.patch
+}
+
+src_configure() {
+ if use zlib; then
+ sed -i -e 's| -lpci| -lz -lpci|g' Makefile || die
+ fi
+ # Fix the modules directory to match Gentoo layout.
+ sed -i -e 's|/etc/modutils/kudzu|/etc/modules.d/kudzu|g' *.* || die
+
+ tc-export CC
+}
+
+src_compile() {
+ emake \
+ $( usex ppc ARCH='ppc' ARCH=$(tc-arch-kernel) ) \
+ AR=$(tc-getAR) \
+ RANLIB=$(tc-getRANLIB) \
+ RPM_OPT_FLAGS="${CFLAGS}" \
+ libkudzu.a libkudzu_loader.a
+}
+
+src_install() {
+ insinto /usr/include/kudzu
+ doins *.h
+
+ dolib.a libkudzu.a libkudzu_loader.a
+
+ keepdir /etc/sysconfig
+}
diff --git a/sys-libs/libkudzu/metadata.xml b/sys-libs/libkudzu/metadata.xml
new file mode 100644
index 000000000000..88653ddd7172
--- /dev/null
+++ b/sys-libs/libkudzu/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>livecd</herd>
+</pkgmetadata>
diff --git a/sys-libs/libmath++/Manifest b/sys-libs/libmath++/Manifest
new file mode 100644
index 000000000000..afcb0ff15492
--- /dev/null
+++ b/sys-libs/libmath++/Manifest
@@ -0,0 +1 @@
+DIST libmath++-0.0.4.tar.gz 51107 SHA256 9bfeb340a1331d53b43fcd0f0c3aef0b985985ee9bfffac7c42eb57405db3414 SHA512 4ee86f365f9eb4f8a122beef430041b5133da1b780a595627ec43c53bb45a6b5a5836a1f2453d2c93f6771ff45683b1143a1d1432f3904ba5b6317c50f010bbc WHIRLPOOL 47c80adcfab7fd0599fde2a53d71c297dfa61bb7b19a4e9fd6c6d486c870aa28135b3b1be6a09836ac36fa4aef1f4ff37f81636cecffc562cfe10a0884f2ec76
diff --git a/sys-libs/libmath++/libmath++-0.0.4-r1.ebuild b/sys-libs/libmath++/libmath++-0.0.4-r1.ebuild
new file mode 100644
index 000000000000..0102e19f602d
--- /dev/null
+++ b/sys-libs/libmath++/libmath++-0.0.4-r1.ebuild
@@ -0,0 +1,50 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+AUTOTOOLS_AUTORECONF=1
+AUTOTOOLS_IN_SOURCE_BUILD=1 # bug #474098
+inherit autotools-utils
+
+DESCRIPTION="template based math library, written in C++, for symbolic and numeric calculus applications"
+HOMEPAGE="http://rm-rf.in/libmath%2B%2B/"
+SRC_URI="http://upstream.rm-rf.in/libmath%2B%2B/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="1"
+KEYWORDS="amd64 ppc ~s390 x86"
+IUSE="doc static-libs"
+
+DEPEND="doc? ( app-doc/doxygen )"
+RDEPEND=""
+
+DOCS=( AUTHORS README TODO )
+
+src_prepare() {
+ # Autotools 1.13 compatibility, bug #471950
+ sed -i -e 's/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/' configure.in || die 'sed on configure.in failed'
+
+ autotools-utils_src_prepare
+}
+
+src_compile() {
+ autotools-utils_src_compile
+
+ if use doc; then
+ pushd "${AUTOTOOLS_BUILD_DIR}" >/dev/null
+ emake -C doc api-doc
+ popd >/dev/null
+ fi
+}
+
+src_install() {
+ autotools-utils_src_install
+
+ if use doc; then
+ pushd "${AUTOTOOLS_BUILD_DIR}" >/dev/null
+ dohtml -r doc/user-api/*
+ popd >/dev/null
+ fi
+}
diff --git a/sys-libs/libmath++/metadata.xml b/sys-libs/libmath++/metadata.xml
new file mode 100644
index 000000000000..8434377a6047
--- /dev/null
+++ b/sys-libs/libmath++/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>cpp</herd>
+</pkgmetadata>
diff --git a/sys-libs/libnih/Manifest b/sys-libs/libnih/Manifest
new file mode 100644
index 000000000000..110e84d8276e
--- /dev/null
+++ b/sys-libs/libnih/Manifest
@@ -0,0 +1 @@
+DIST libnih-1.0.3.tar.gz 1187624 SHA256 897572df7565c0a90a81532671e23c63f99b4efde2eecbbf11e7857fbc61f405 SHA512 fce40d2445b28c27b8838631681ca3206a4f053b2dd4fc488fc9ef98bbd3d933e3d62b82cf346be2ef1677f6457f692cf5544cd915a6bb1e5c618f98ffa101b4 WHIRLPOOL da001ba05111d3a654e6800cf283e11b5508e53d6d91b37ed277df5a889a1138e90ae13161e0af81bdcac929b105bf889e4dcdc443789f28417c6e3f61530d8c
diff --git a/sys-libs/libnih/files/libnih-1.0.3-optional-dbus.patch b/sys-libs/libnih/files/libnih-1.0.3-optional-dbus.patch
new file mode 100644
index 000000000000..afe43749b6b0
--- /dev/null
+++ b/sys-libs/libnih/files/libnih-1.0.3-optional-dbus.patch
@@ -0,0 +1,40 @@
+--- libnih-1.0.1/configure.ac
++++ libnih-1.0.1/configure.ac
+@@ -23,12 +23,21 @@
+ PKG_PROG_PKG_CONFIG([0.22])
+
+ # Checks for libraries.
+-PKG_CHECK_MODULES([DBUS], [dbus-1 >= 1.2.16])
+-AC_CHECK_LIB([expat], [XML_ParserCreate],
++AC_ARG_WITH([dbus],
++ [AS_HELP_STRING([--without-dbus],
++ [disable support for dbus])],
++ [],
++ [with_dbus=yes])
++
++AS_IF([test "x$with_dbus" != xno],[
++ PKG_CHECK_MODULES([DBUS], [dbus-1 >= 1.2.16])
++ AC_CHECK_LIB([expat], [XML_ParserCreate],
+ [AC_CHECK_LIB([expat], [XML_StopParser],
+ [AC_SUBST([EXPAT_LIBS], [-lexpat])],
+ [AC_MSG_ERROR([expat >= 2.0.0 required])])],
+- [AC_MSG_ERROR([expat library not found])])
++ [AC_MSG_ERROR([expat library not found])])])
++
++AM_CONDITIONAL([DBUS_SUPPORT], [test "x$with_dbus" != xno])
+
+ # Checks for header files.
+ AC_CHECK_HEADERS([valgrind/valgrind.h])
+--- libnih-1.0.1.orig/Makefile.am
++++ libnih-1.0.1/Makefile.am
+@@ -1,6 +1,9 @@
+ ## Process this file with automake to produce Makefile.in
+
+-SUBDIRS = m4 intl nih nih-dbus nih-dbus-tool po
++SUBDIRS = m4 intl nih po
++if DBUS_SUPPORT
++SUBDIRS += nih-dbus nih-dbus-tool
++endif
+
+ EXTRA_DIST = HACKING
+
diff --git a/sys-libs/libnih/files/libnih-1.0.3-pkg-config.patch b/sys-libs/libnih/files/libnih-1.0.3-pkg-config.patch
new file mode 100644
index 000000000000..979e363f2157
--- /dev/null
+++ b/sys-libs/libnih/files/libnih-1.0.3-pkg-config.patch
@@ -0,0 +1,56 @@
+# Bazaar merge directive format 2 (Bazaar 0.90)
+# revision_id: vapier@gentoo.org-20111019170935-fheqs03szv6mhh3o
+# target_branch: http://bazaar.launchpad.net/~scott/libnih/trunk/
+# testament_sha1: 84b368e08fdd9f8276611cdfe97d34f51cd90598
+# timestamp: 2011-10-19 13:13:52 -0400
+# base_revision_id: scott@netsplit.com-20110901184103-d2xbvc5hbt0vqxf0
+#
+# Begin patch
+=== modified file 'nih-dbus/Makefile.am'
+--- nih-dbus/Makefile.am 2009-11-21 21:44:23 +0000
++++ nih-dbus/Makefile.am 2011-10-19 17:09:35 +0000
+@@ -49,7 +49,7 @@
+ test_dbus.h
+
+
+-pkgconfigdir = $(prefix)/lib/pkgconfig
++pkgconfigdir = $(libdir)/pkgconfig
+ pkgconfig_DATA = libnih-dbus.pc
+
+
+
+=== modified file 'nih/Makefile.am'
+--- nih/Makefile.am 2009-11-21 21:44:23 +0000
++++ nih/Makefile.am 2011-10-19 17:09:35 +0000
+@@ -71,7 +71,7 @@
+ test_hash.h
+
+
+-pkgconfigdir = $(prefix)/lib/pkgconfig
++pkgconfigdir = $(libdir)/pkgconfig
+ pkgconfig_DATA = libnih.pc
+
+
+
+# Begin bundle
+IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWerAspcAAhZfgAAQVGf/93Mi
+DAC/7//wUASW8VttRtyKRaUhJU00ZTUab1GBT9JpNNqeiAADEEpDUwp5Gk9KeiZAANAAABIo0hE9
+GTTJJ5AMo8oB6IwmmMNDQAAAaAAAAAEkgQBGTCGmmoZQPSIxoCJYV1m4Z59VmltTEiVlNBLfEBWL
+DPUvZdcke3iHe+YuVhuGNtnl+0Xxmwcuy+RkTlRw9Ct83uYaZ7PH3vOd/AqYc6mhoKnwOCJD7ej5
+jS/rj7FmeOwxohzIMw9Ftarf11sHFhfFyWQEWL15gMctp9IL8d5sOYp0YoMOIw5htiyuYikcaPZ+
+xeB0ZI+IpppnCWQD3qlFKeI1NHACFmRBrQ2Sn1nmVurFZLNeqWK2Xy7eKAJK1SuguZhs8DekVjKE
+YGJwURdteHklA3WkfNMdKKNMQHQqnTtxAg1ShnXAzzkjnDtTSCwNhnuoY0WM1bLLCJlFM6NphCLS
+CGV+ZxUbN6YirSh9tVJWBzJKQaE5HEstAsAuqdVKlAlNKIrkYPSb3oy9WkKNsyyLYUiplUvi8C3i
+ioz+SscYWhwHzkxL/k0TPk8tL6l5FzzBa8FCKRWbDCTa0nbGzEhoJmaYEfwBog+pmXpsuVNUZmF4
+OreOMqF7JyNA1HJJ14+yxa6SRpJ51jBFyaNAojQK2ai7BtxEVZFoG3TYZiaTnR8LwZPDCtw7GqpA
+6mKFWiqtj/KxW+zQNmQbh9XE5eCCdFBTQzJmb7H3fDQpKW1njIoLHI+HeAXGDxYmu7HJ3DoZtH3Z
+7UfYYlEO8WoZpHZIMdDSCTWUE41kdp0nBWlshTuqcODflplwgnc03YlpZF9eBKQsUJi4gRvOhwmO
+XzuHW8qzc+JojHueBjZGJRiZQktKmJFoSD3k4+SOEue4uOh88jC0uRC8zDtbDCuz1fd6m5nsBrXh
+4KCGR5mWo4953Ie6CdWVops43mZdcboGGpUVirZZC+SPwwvwVSDuTAzASyFMevBBdbmdy3y0L0Y2
+oqRD3LY5+RqPM9R4/XEkdVuXmAxvF7GgrzRSIuDsTD2MANhmBxuF+EEbTKN/ciAzAUxnOdie1hol
+lqAkHxA44ja0WMKzYlmGU28kSdqB1i6h4nLevOVCnK+WtEKLpuOy6eZFThX5IsRrjenja/BSN2iu
+FFE+cHoYwJzGRI9yFKvpRUQ+H0qqaIoI5lP18lEqsPiBhRHMkpPIHqMuoiGiZyQxSXC0ynqSTYNX
+80VoGbTVLspApI9vo8XZBOScj6oHLR6qkjlnhkwwNQ8/wZdSfNBI0NSKLNasgKl6LF7FVbx4MCcj
+jYREWWzVEEVd81rloiAfu+h8H33/8DPhciqmx3QHdcdLEOKQ1mHIp8NQLYDAhQjJPmRA4hvGfSG+
+dwTBj1rKUFKGB7BYiKJ+C3dZ91NewHQ8kxHGlS0rSLioLvwrlwNSrRgtyZzWVFTWB8C7kinChIdW
+BZS4
diff --git a/sys-libs/libnih/files/libnih-1.0.3-signal-race.patch b/sys-libs/libnih/files/libnih-1.0.3-signal-race.patch
new file mode 100644
index 000000000000..4cba5ae4ded3
--- /dev/null
+++ b/sys-libs/libnih/files/libnih-1.0.3-signal-race.patch
@@ -0,0 +1,60 @@
+https://bugs.launchpad.net/libnih/+bug/518921
+
+fix race in signal processing leading to lost signals
+
+The current loop will walk all signals one by one and run the handler
+for it if any signals were pending. Then it clears the array. But if
+a signal comes in for an earlier checked signal, it will get clobbered
+when the final clear runs.
+
+Change the logic so that we only clear entries for signals whose handler
+we explicitly call. If a different signal comes in, we'll process it
+the next time around.
+
+This was discovered & triaged by Jeffy Chen from Rockchip.
+
+=== modified file 'nih/signal.c'
+--- nih/signal.c 2009-06-23 09:29:37 +0000
++++ nih/signal.c 2015-05-21 08:12:11 +0000
+@@ -337,17 +337,37 @@
+
+ nih_signal_init ();
+
++ /* Since this poller runs w/out signals masked, we do not want to try
++ * and clear any other signals (like zeroing the caught array at the
++ * end). If we do that, we open a race:
++ * - Walk the list of signals.
++ * - First one is not set so we move on to the second one.
++ * - First signal comes in while processing second and increments the
++ * caught array entry.
++ * - Finish walking the whole list.
++ * - Zero out the whole list and thus throw away the first signal.
++ * Since the signal handlers can take any length of time, this race
++ * can be open for a variable amount of time.
++ */
++
+ NIH_LIST_FOREACH_SAFE (nih_signals, iter) {
+ NihSignal *signal = (NihSignal *)iter;
+
+ if (! signals_caught[signal->signum])
+ continue;
+
++ /* Now that we know we're going to process this signal, clear
++ * out all pending counts for it. There is a slight race here
++ * where the same signal can come in, but the API has never
++ * guaranteed exact coverage since POSIX does not provide it --
++ * more than one signal can be collapsed into one event. All
++ * we can guarantee is that we'll notice signals that come in
++ * once the handler runs.
++ */
++ signals_caught[signal->signum] = 0;
++
+ signal->handler (signal->data, signal);
+ }
+-
+- for (s = 0; s < NUM_SIGNALS; s++)
+- signals_caught[s] = 0;
+ }
+
+
+
diff --git a/sys-libs/libnih/libnih-1.0.3-r1.ebuild b/sys-libs/libnih/libnih-1.0.3-r1.ebuild
new file mode 100644
index 000000000000..f8d37791181e
--- /dev/null
+++ b/sys-libs/libnih/libnih-1.0.3-r1.ebuild
@@ -0,0 +1,45 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit versionator eutils autotools toolchain-funcs multilib
+
+DESCRIPTION="Light-weight 'standard library' of C functions"
+HOMEPAGE="https://launchpad.net/libnih"
+SRC_URI="http://launchpad.net/${PN}/$(get_version_component_range 1-2)/${PV}/+download/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="+dbus nls static-libs test +threads"
+
+RDEPEND="dbus? ( dev-libs/expat >=sys-apps/dbus-1.2.16 )"
+DEPEND="${RDEPEND}
+ sys-devel/gettext
+ virtual/pkgconfig
+ test? ( dev-util/valgrind )"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-1.0.3-optional-dbus.patch
+ epatch "${FILESDIR}"/${PN}-1.0.3-pkg-config.patch
+ eautoreconf
+}
+
+src_configure() {
+ econf \
+ $(use_with dbus) \
+ $(use_enable nls) \
+ $(use_enable static-libs static) \
+ $(use_enable threads) \
+ $(use_enable threads threading)
+}
+
+src_install() {
+ default
+
+ # we need to be in / because upstart needs libnih
+ gen_usr_ldscript -a nih $(use dbus && echo nih-dbus)
+ use static-libs || rm "${ED}"/usr/$(get_libdir)/*.la
+}
diff --git a/sys-libs/libnih/libnih-1.0.3-r2.ebuild b/sys-libs/libnih/libnih-1.0.3-r2.ebuild
new file mode 100644
index 000000000000..2ce8380ac9f1
--- /dev/null
+++ b/sys-libs/libnih/libnih-1.0.3-r2.ebuild
@@ -0,0 +1,46 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit versionator eutils autotools toolchain-funcs multilib flag-o-matic
+
+DESCRIPTION="Light-weight 'standard library' of C functions"
+HOMEPAGE="https://launchpad.net/libnih"
+SRC_URI="http://launchpad.net/${PN}/$(get_version_component_range 1-2)/${PV}/+download/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="+dbus nls static-libs test +threads"
+
+RDEPEND="dbus? ( dev-libs/expat >=sys-apps/dbus-1.2.16 )"
+DEPEND="${RDEPEND}
+ sys-devel/gettext
+ virtual/pkgconfig
+ test? ( dev-util/valgrind )"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-1.0.3-optional-dbus.patch
+ epatch "${FILESDIR}"/${PN}-1.0.3-pkg-config.patch
+ eautoreconf
+}
+
+src_configure() {
+ append-lfs-flags
+ econf \
+ $(use_with dbus) \
+ $(use_enable nls) \
+ $(use_enable static-libs static) \
+ $(use_enable threads) \
+ $(use_enable threads threading)
+}
+
+src_install() {
+ default
+
+ # we need to be in / because upstart needs libnih
+ gen_usr_ldscript -a nih $(use dbus && echo nih-dbus)
+ use static-libs || rm "${ED}"/usr/$(get_libdir)/*.la
+}
diff --git a/sys-libs/libnih/libnih-1.0.3-r3.ebuild b/sys-libs/libnih/libnih-1.0.3-r3.ebuild
new file mode 100644
index 000000000000..74473d4ef49d
--- /dev/null
+++ b/sys-libs/libnih/libnih-1.0.3-r3.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit versionator eutils autotools toolchain-funcs multilib flag-o-matic
+
+DESCRIPTION="Light-weight 'standard library' of C functions"
+HOMEPAGE="https://launchpad.net/libnih"
+SRC_URI="http://launchpad.net/${PN}/$(get_version_component_range 1-2)/${PV}/+download/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~mips ~x86"
+IUSE="+dbus nls static-libs test +threads"
+
+RDEPEND="dbus? ( dev-libs/expat >=sys-apps/dbus-1.2.16 )"
+DEPEND="${RDEPEND}
+ sys-devel/gettext
+ virtual/pkgconfig
+ test? ( dev-util/valgrind )"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-1.0.3-optional-dbus.patch
+ epatch "${FILESDIR}"/${PN}-1.0.3-pkg-config.patch
+ epatch "${FILESDIR}"/${PN}-1.0.3-signal-race.patch
+ eautoreconf
+}
+
+src_configure() {
+ append-lfs-flags
+ econf \
+ $(use_with dbus) \
+ $(use_enable nls) \
+ $(use_enable static-libs static) \
+ $(use_enable threads) \
+ $(use_enable threads threading)
+}
+
+src_install() {
+ default
+
+ # we need to be in / because upstart needs libnih
+ gen_usr_ldscript -a nih $(use dbus && echo nih-dbus)
+ use static-libs || rm "${ED}"/usr/$(get_libdir)/*.la
+}
diff --git a/sys-libs/libnih/libnih-1.0.3.ebuild b/sys-libs/libnih/libnih-1.0.3.ebuild
new file mode 100644
index 000000000000..4a1301950083
--- /dev/null
+++ b/sys-libs/libnih/libnih-1.0.3.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="2"
+
+inherit versionator eutils autotools toolchain-funcs
+
+DESCRIPTION="Light-weight 'standard library' of C functions"
+HOMEPAGE="https://launchpad.net/libnih"
+SRC_URI="http://launchpad.net/${PN}/$(get_version_component_range 1-2)/${PV}/+download/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="+dbus nls static-libs test +threads"
+
+RDEPEND="dbus? ( dev-libs/expat >=sys-apps/dbus-1.2.16 )"
+DEPEND="${RDEPEND}
+ sys-devel/gettext
+ virtual/pkgconfig
+ test? ( dev-util/valgrind )"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-1.0.3-optional-dbus.patch
+ epatch "${FILESDIR}"/${PN}-1.0.3-pkg-config.patch
+ eautoreconf
+}
+
+src_configure() {
+ econf \
+ $(use_with dbus) \
+ $(use_enable nls) \
+ $(use_enable static-libs static) \
+ $(use_enable threads) \
+ $(use_enable threads threading)
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die
+
+ # we need to be in / because upstart needs libnih
+ gen_usr_ldscript -a nih $(use dbus && echo nih-dbus)
+ use static-libs || rm "${D}"/usr/lib*/*.la
+
+ dodoc AUTHORS ChangeLog HACKING NEWS README TODO
+}
diff --git a/sys-libs/libnih/metadata.xml b/sys-libs/libnih/metadata.xml
new file mode 100644
index 000000000000..4ef875497dfd
--- /dev/null
+++ b/sys-libs/libnih/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>vapier@gentoo.org</email>
+ <description>feel free to update however you like</description>
+ </maintainer>
+ <upstream>
+ <remote-id type="launchpad">libnih</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-libs/libosinfo/Manifest b/sys-libs/libosinfo/Manifest
new file mode 100644
index 000000000000..64ab92916bd7
--- /dev/null
+++ b/sys-libs/libosinfo/Manifest
@@ -0,0 +1,2 @@
+DIST libosinfo-0.2.11.tar.gz 1304566 SHA256 bb6ba136756b26045ba3ed9b3c1b0920a639dd80b007769a1df356d8e2fe0921 SHA512 a459c6e0e396786b7093685a9a4fe871c12854b1c7c7fb6f0384659fa66be255f3e0c83f0633ecdb42fbb88e18b5f804637fdd145a596bfbc5b6cd41ce08bada WHIRLPOOL 26601de224e58e99f769f8dfaba44a26f31ec7476537b615d46aa61d2b8431362498f7f87ac0bcacd8a1a1044a8a17d2b89e24033abdc90f78a02467c21a800e
+DIST libosinfo-0.2.12.tar.gz 1953453 SHA256 fa00ea8ddbca06c0dcc31e8938ac55cb71e71c6e2449687cd2c9e003a9478fed SHA512 ec09a65a9cfb5e3f2ffe2a7d85b9f51938f1633469338826ab3380f22788d40732b39e0f96005eb6b800d04ac76da09a89918085f840439b5bdde759692c6b9d WHIRLPOOL bddfef060d7a5f794c6f5e7b11798ca8cac5b55812361a8c2d66acd283394a5a0327ba5559cae294a9e49fa9eaca7dc426a92b6a9b68e8314ddc586623ddad6c
diff --git a/sys-libs/libosinfo/libosinfo-0.2.11.ebuild b/sys-libs/libosinfo/libosinfo-0.2.11.ebuild
new file mode 100644
index 000000000000..9a742ee9dba2
--- /dev/null
+++ b/sys-libs/libosinfo/libosinfo-0.2.11.ebuild
@@ -0,0 +1,52 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+GCONF_DEBUG="no"
+VALA_MIN_API_VERSION="0.16"
+VALA_USE_DEPEND="vapigen"
+
+inherit gnome2 udev vala
+
+DESCRIPTION="GObject library for managing information about real and virtual OSes"
+HOMEPAGE="http://libosinfo.org/"
+SRC_URI="http://fedorahosted.org/releases/${PN:0:1}/${PN:1:1}/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="0"
+IUSE="+introspection +vala test"
+REQUIRED_USE="vala? ( introspection )"
+
+KEYWORDS="~alpha amd64 ~arm ~ia64 ~ppc ~ppc64 ~sparc x86"
+
+RDEPEND="
+ >=dev-libs/glib-2:2
+ >=dev-libs/libxslt-1.0.0:=
+ dev-libs/libxml2:=
+ net-libs/libsoup-gnome:2.4
+ sys-apps/hwids
+ introspection? ( >=dev-libs/gobject-introspection-0.9.7:= )
+"
+DEPEND="${RDEPEND}
+ dev-libs/gobject-introspection-common
+ >=dev-util/gtk-doc-am-1.10
+ virtual/pkgconfig
+ test? ( dev-libs/check )
+ vala? ( $(vala_depend) )
+"
+
+src_configure() {
+ # --enable-udev is only for rules.d file install
+ gnome2_src_configure \
+ --disable-static \
+ $(use_enable test tests) \
+ $(use_enable introspection) \
+ $(use_enable vala) \
+ --enable-udev \
+ --disable-coverage \
+ --with-html-dir=/usr/share/doc/${PF}/html \
+ --with-udev-rulesdir="$(get_udevdir)"/rules.d \
+ --with-usb-ids-path=/usr/share/misc/usb.ids \
+ --with-pci-ids-path=/usr/share/misc/pci.ids
+}
diff --git a/sys-libs/libosinfo/libosinfo-0.2.12.ebuild b/sys-libs/libosinfo/libosinfo-0.2.12.ebuild
new file mode 100644
index 000000000000..c42f103f3042
--- /dev/null
+++ b/sys-libs/libosinfo/libosinfo-0.2.12.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+GCONF_DEBUG="no"
+VALA_USE_DEPEND="vapigen"
+
+inherit gnome2 udev vala
+
+DESCRIPTION="GObject library for managing information about real and virtual OSes"
+HOMEPAGE="http://libosinfo.org/"
+SRC_URI="http://fedorahosted.org/releases/${PN:0:1}/${PN:1:1}/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="0"
+IUSE="+introspection +vala test"
+REQUIRED_USE="vala? ( introspection )"
+
+KEYWORDS="~alpha amd64 ~arm ~ia64 ~ppc ~ppc64 ~sparc x86"
+
+RDEPEND="
+ >=dev-libs/glib-2:2
+ >=dev-libs/libxslt-1.0.0:=
+ dev-libs/libxml2:=
+ net-libs/libsoup-gnome:2.4
+ sys-apps/hwids
+ introspection? ( >=dev-libs/gobject-introspection-0.9.7:= )
+"
+DEPEND="${RDEPEND}
+ dev-libs/gobject-introspection-common
+ >=dev-util/gtk-doc-am-1.10
+ virtual/pkgconfig
+ test? ( dev-libs/check )
+ vala? ( $(vala_depend) )
+"
+
+src_configure() {
+ # --enable-udev is only for rules.d file install
+ gnome2_src_configure \
+ --disable-static \
+ $(use_enable test tests) \
+ $(use_enable introspection) \
+ $(use_enable vala) \
+ --enable-udev \
+ --disable-coverage \
+ --with-html-dir=/usr/share/doc/${PF}/html \
+ --with-udev-rulesdir="$(get_udevdir)"/rules.d \
+ --with-usb-ids-path=/usr/share/misc/usb.ids \
+ --with-pci-ids-path=/usr/share/misc/pci.ids
+}
diff --git a/sys-libs/libosinfo/metadata.xml b/sys-libs/libosinfo/metadata.xml
new file mode 100644
index 000000000000..da6fd63d0085
--- /dev/null
+++ b/sys-libs/libosinfo/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>gnome</herd>
+</pkgmetadata>
diff --git a/sys-libs/libraw1394/Manifest b/sys-libs/libraw1394/Manifest
new file mode 100644
index 000000000000..4d8eed1a3285
--- /dev/null
+++ b/sys-libs/libraw1394/Manifest
@@ -0,0 +1,3 @@
+DIST libraw1394-2.0.8.tar.xz 279060 SHA256 e8c2fa8860a3e4067d9342490842f63f2cde2015521092064ba383aa75104467 SHA512 92f83c1b005fd043a14b15779ca24204ff2da59798531a90db147d964c3b53328c5a7ff7834a624aa2c7913e0780c4d75283fe13f7cea6b2cd2cb4b14800551e WHIRLPOOL c815a2a8c3c4e330e6d4bc6ec09f8215af92c3aa8a3d7915a4b77cdbf85fa26eee65e980e02f181eea4525677db0826acdeb0060fa277c755e28a79e4ca08e5f
+DIST libraw1394-2.1.0.tar.xz 291456 SHA256 0b3126d8158d156de9da2ff4d861c47857acc4318a7ac260258015a22071964f SHA512 04295c2b4391b1c61cc1c65dbe5921f5e208bbb311104366d5756a82a6c53f1339c368fe76077318b22e2402fd8f679236606d0be4898728a9dba2d7a8989b9e WHIRLPOOL f89a4abe1a1c5a7c22a88e8d397f03e6fe2943af18d721ab87eace027b43fb899658beea9b94ea6909398aa6b14920da58cbf8a3934df18acc0b587102b50d02
+DIST libraw1394-2.1.1.tar.xz 309396 SHA256 1bab9780189f9d1eb4e973df12679c04f979c21e024240fc98e536ff5b680ee9 SHA512 ed6acf10e50593e6070764e57cb6cc0eabb6f2bc4b4ed805a55cdfc37109c1975eb597dfbef9b6f8bc73a9e9270e7d643956489f54682f4c670fa510ef726fbe WHIRLPOOL 10e075374855c03395cefb7357f055fafd223b91b7e89ed22d96d691a398d3371db580e38fd53718305a5b1f2708bd52bc55cf1ccedfa5e508bd6e64bc04f6ad
diff --git a/sys-libs/libraw1394/libraw1394-2.0.8.ebuild b/sys-libs/libraw1394/libraw1394-2.0.8.ebuild
new file mode 100644
index 000000000000..f09d6677e867
--- /dev/null
+++ b/sys-libs/libraw1394/libraw1394-2.0.8.ebuild
@@ -0,0 +1,29 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+DESCRIPTION="library that provides direct access to the IEEE 1394 bus"
+HOMEPAGE="http://ieee1394.wiki.kernel.org/"
+SRC_URI="mirror://kernel/linux/libs/ieee1394/${P}.tar.xz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 ppc ppc64 sh sparc x86"
+IUSE="static-libs"
+
+DEPEND="app-arch/xz-utils"
+
+DOCS=( AUTHORS ChangeLog NEWS README )
+
+src_configure() {
+ econf \
+ --without-fw-dir \
+ $(use_enable static-libs static)
+}
+
+src_install() {
+ default
+ find "${ED}" -name '*.la' -exec rm -f {} +
+}
diff --git a/sys-libs/libraw1394/libraw1394-2.1.0-r1.ebuild b/sys-libs/libraw1394/libraw1394-2.1.0-r1.ebuild
new file mode 100644
index 000000000000..7cbb5128a9fa
--- /dev/null
+++ b/sys-libs/libraw1394/libraw1394-2.1.0-r1.ebuild
@@ -0,0 +1,22 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+AUTOTOOLS_PRUNE_LIBTOOL_FILES=all
+
+inherit autotools-multilib
+
+DESCRIPTION="library that provides direct access to the IEEE 1394 bus"
+HOMEPAGE="http://ieee1394.wiki.kernel.org/"
+SRC_URI="mirror://kernel/linux/libs/ieee1394/${P}.tar.xz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 ppc ppc64 ~sh sparc x86"
+IUSE="static-libs"
+
+DEPEND="app-arch/xz-utils"
+RDEPEND="abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r4
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )"
diff --git a/sys-libs/libraw1394/libraw1394-2.1.1.ebuild b/sys-libs/libraw1394/libraw1394-2.1.1.ebuild
new file mode 100644
index 000000000000..792bf6d0e17b
--- /dev/null
+++ b/sys-libs/libraw1394/libraw1394-2.1.1.ebuild
@@ -0,0 +1,22 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+AUTOTOOLS_PRUNE_LIBTOOL_FILES=all
+
+inherit autotools-multilib
+
+DESCRIPTION="library that provides direct access to the IEEE 1394 bus"
+HOMEPAGE="http://ieee1394.wiki.kernel.org/"
+SRC_URI="mirror://kernel/linux/libs/ieee1394/${P}.tar.xz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sh ~sparc ~x86"
+IUSE="static-libs"
+
+DEPEND="app-arch/xz-utils"
+RDEPEND="abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r4
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )"
diff --git a/sys-libs/libraw1394/metadata.xml b/sys-libs/libraw1394/metadata.xml
new file mode 100644
index 000000000000..96a2d586367d
--- /dev/null
+++ b/sys-libs/libraw1394/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>base-system</herd>
+</pkgmetadata>
diff --git a/sys-libs/librtas/Manifest b/sys-libs/librtas/Manifest
new file mode 100644
index 000000000000..8ddddd3354f8
--- /dev/null
+++ b/sys-libs/librtas/Manifest
@@ -0,0 +1,5 @@
+DIST librtas-1.3.13.tar.gz 90959 SHA256 d5f2951b0934ffbd82bebf26acfa103cc21d89f4c90c7c41472acf7b4ec6d907 SHA512 1cd0dec624aff2fdf3e851913246d89a98c94c09ab9fe3ca80c3fca53a5d6ca5589e0680216c3722560e5701827b52a283ddefe7ab04228b352f5535f63a85c1 WHIRLPOOL 1dc10baf127aba6dbb57776fe7f99061234e875c9a8cdf19f653b24939b16c314927d43344081dd5affbe6281aa28924e867bf7d012111de8adcf81bd766ac2a
+DIST librtas-1.3.3.tar.gz 77223 SHA256 3de76aaebfa5d232e126a0aa4000b80cbaaadbe355b6900c381b3aa00b6587d8
+DIST librtas-1.3.5.tar.gz 245381 SHA256 89b5ec979919a44f5eb96866c28a44284cc4fe739b8b749ce32ee7ccdcef03df SHA512 77970ed646418cd406ce1be93d700c7e214a91bb31aee0cd42e09c5d892e90c1fbd99ea5e0bcb23ffa39fbed4453044b9b614c3e73568f68a3a1a050438b6451 WHIRLPOOL 0ee648773467683c967d35c1df2915c224d05a6a711d6df589c22c904b3a46b17e1c70826e6b211bea130afffbec05736972b11c834a526c172ad3c65e29f3a4
+DIST librtas-1.3.6.tar.gz 83828 SHA256 21b380586f801fba1f76573e97596078b588e8d716ee7b7c757a2815d2425a51 SHA512 f81271cf524218395c488aee6625b9f39c9acb81d7c109ca0dec9c7349ad013a6eb17e5324cc5243caf9f5c32b755831afd9bb74c6a2505ccc50d400734b26fa WHIRLPOOL 8f44bcb5f389cc2d13a9d74351a2e07704bf733b40f3b49af582b2d6c216e0445fd078fba0cd65d3a601892cab6e948b3e374b6e569ed6e195e521781111786a
+DIST librtas-1.3.8.tar.gz 221684 SHA256 97ae0168759bf2bc058dacad9c70bdb6403cf8ae617d25ad7230d702725407b3 SHA512 bb68369a10f0fb35e8631dc440fe68bb02b13d971be420539bb3fc0d29328421702a43f489941e90b20bff35863269a0d8fd159f65a18467d22cea7cfeed2cd2 WHIRLPOOL a843f0e2a88a48b3f75530c1242a087e92521ee98b281f26abde91aafa94724520d4b03efae09a8ad132cfc303ae6ea3be247a7c7a3425da1937e7557adea61f
diff --git a/sys-libs/librtas/files/librtas-1.3.3-open.patch b/sys-libs/librtas/files/librtas-1.3.3-open.patch
new file mode 100644
index 000000000000..46bdede6efdf
--- /dev/null
+++ b/sys-libs/librtas/files/librtas-1.3.3-open.patch
@@ -0,0 +1,22 @@
+--- librtas_src/syscall_rmo.bak 2010-02-01 10:38:01.000000000 -0500
++++ librtas-1.3.3/librtas_src/syscall_rmo.c 2010-02-01 10:38:25.000000000 -0500
+@@ -117,7 +117,7 @@
+
+ /* Lazily open lock file */
+ if (wa_config.lockfile_fd < 0) {
+- wa_config.lockfile_fd = open(lockfile_path, O_CREAT | O_RDWR);
++ wa_config.lockfile_fd = open(lockfile_path, O_CREAT | O_RDWR, 644);
+ if (wa_config.lockfile_fd < 0) {
+ dbg1("could not open lockfile %s\n", lockfile_path);
+ return RTAS_IO_ASSERT;
+--- librtas_src/common.bak 2010-02-01 10:37:34.000000000 -0500
++++ librtas-1.3.3/librtas_src/common.c 2010-02-01 10:37:50.000000000 -0500
+@@ -65,7 +65,7 @@
+ npaths = sizeof(proc_rtas_paths) / sizeof(char *);
+ for (i = 0; i < npaths; i++) {
+ sprintf(full_name, "%s/%s", proc_rtas_paths[i], name);
+- fd = open(full_name, mode);
++ fd = open(full_name, mode, 644);
+ if (fd >= 0)
+ break;
+ }
diff --git a/sys-libs/librtas/files/librtas-1.3.3-remove-doc.patch b/sys-libs/librtas/files/librtas-1.3.3-remove-doc.patch
new file mode 100644
index 000000000000..66d9aeaabeb5
--- /dev/null
+++ b/sys-libs/librtas/files/librtas-1.3.3-remove-doc.patch
@@ -0,0 +1,14 @@
+--- librtas-1.3.3.orig/Makefile 2007-04-12 15:01:01.000000000 -0500
++++ librtas-1.3.3/Makefile 2007-05-29 11:55:54.000000000 -0500
+@@ -15,11 +15,9 @@
+ @$(foreach d,$(SUBDIRS), $(MAKE) -C $d;)
+
+ install:
+- @$(call install_doc,$(FILES),$(DESTDIR))
+ @$(foreach d,$(SUBDIRS), $(MAKE) -C $d install;)
+
+ uninstall:
+- @$(call uninstall_doc,$(FILES),$(DESTDIR))
+ @$(foreach d,$(SUBDIRS), $(MAKE) -C $d uninstall;)
+
+ rpm: all
diff --git a/sys-libs/librtas/files/librtas-1.3.6-symlink.patch b/sys-libs/librtas/files/librtas-1.3.6-symlink.patch
new file mode 100644
index 000000000000..f9536f427492
--- /dev/null
+++ b/sys-libs/librtas/files/librtas-1.3.6-symlink.patch
@@ -0,0 +1,24 @@
+QA Notice: Missing soname symlink(s):
+usr/lib64/libofdt.so.1 -> libofdt.so.1.3.6
+usr/lib64/librtas.so.1 -> librtas.so.1.3.6
+
+--- libofdt_src/Makefile
++++ libofdt_src/Makefile
+@@ -27,6 +27,7 @@
+ @$(call install_lib,$(LIBOFDT),$(DESTDIR))
+ @$(call install_inc,$(LIBOFDT_SHIP_HDR),$(DESTDIR))
+ @ln -sf $(LIBOFDT) $(DESTDIR)/$(LIB_DIR)$(call is_lib64,$(LIBOFDT))/$(LIBOFDT_SONAME)
++ @ln -sf $(LIBOFDT) $(DESTDIR)/$(LIB_DIR)$(call is_lib64,$(LIBOFDT))/$(LIBOFDT_SONAME).1
+
+ uninstall:
+ @$(call uninstall_lib,$(LIBOFDT),$(DESTDIR))
+--- librtas_src/Makefile
++++ librtas_src/Makefile
+@@ -33,6 +33,7 @@
+ @$(call install_lib,$(LIBRTAS),$(DESTDIR))
+ @$(call install_inc,$(HEADERS),$(DESTDIR))
+ @ln -sf $(LIBRTAS) $(DESTDIR)/$(LIB_DIR)$(call is_lib64,$(LIBRTAS))/$(LIBRTAS_SONAME)
++ @ln -sf $(LIBRTAS) $(DESTDIR)/$(LIB_DIR)$(call is_lib64,$(LIBRTAS))/$(LIBRTAS_SONAME).1
+
+ uninstall:
+ @$(call uninstall_lib,$(LIBRTAS),$(DESTDIR))
diff --git a/sys-libs/librtas/files/librtas-1.3.8-symlink.patch b/sys-libs/librtas/files/librtas-1.3.8-symlink.patch
new file mode 100644
index 000000000000..c3faeaf41e22
--- /dev/null
+++ b/sys-libs/librtas/files/librtas-1.3.8-symlink.patch
@@ -0,0 +1,20 @@
+--- libofdt_src/Makefile
++++ libofdt_src/Makefile
+@@ -27,6 +27,7 @@
+ @$(call install_lib,$(LIBOFDT),$(DESTDIR))
+ @$(call install_inc,$(LIBOFDT_SHIP_HDR),$(DESTDIR))
+ @ln -sf $(LIBOFDT) $(DESTDIR)/$(LIB_DIR)$(call is_lib64,$(LIBOFDT))/$(LIBOFDT_SONAME)
++ @ln -sf $(LIBOFDT) $(DESTDIR)/$(LIB_DIR)$(call is_lib64,$(LIBOFDT))/$(LIBOFDT_SONAME).1
+
+ uninstall:
+ @$(call uninstall_lib,$(LIBOFDT),$(DESTDIR))
+--- librtas_src/Makefile
++++ librtas_src/Makefile
+@@ -33,6 +33,7 @@
+ @$(call install_lib,$(LIBRTAS),$(DESTDIR))
+ @$(call install_inc,$(HEADERS),$(DESTDIR))
+ @ln -sf $(LIBRTAS) $(DESTDIR)/$(LIB_DIR)$(call is_lib64,$(LIBRTAS))/$(LIBRTAS_SONAME)
++ @ln -sf $(LIBRTAS) $(DESTDIR)/$(LIB_DIR)$(call is_lib64,$(LIBRTAS))/$(LIBRTAS_SONAME).1
+
+ uninstall:
+ @$(call uninstall_lib,$(LIBRTAS),$(DESTDIR))
diff --git a/sys-libs/librtas/librtas-1.3.13.ebuild b/sys-libs/librtas/librtas-1.3.13.ebuild
new file mode 100644
index 000000000000..50e3f4c48d6e
--- /dev/null
+++ b/sys-libs/librtas/librtas-1.3.13.ebuild
@@ -0,0 +1,21 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils
+
+DESCRIPTION="A set of libraries for userspace access to RTAS on the PowerPC platform(s)"
+HOMEPAGE="http://sourceforge.net/projects/librtas/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="IBM"
+SLOT="0"
+KEYWORDS="~ppc ~ppc64"
+
+DOCS="README"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-1.3.8-symlink.patch
+ sed -i -e '/install_doc/d' Makefile || die
+}
diff --git a/sys-libs/librtas/librtas-1.3.3.ebuild b/sys-libs/librtas/librtas-1.3.3.ebuild
new file mode 100644
index 000000000000..2c5f2595aabf
--- /dev/null
+++ b/sys-libs/librtas/librtas-1.3.3.ebuild
@@ -0,0 +1,25 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils
+
+DESCRIPTION=" Librtas provides a set of libraries for user-space access to RTAS on the ppc64 architecture"
+SRC_URI="http://librtas.ozlabs.org/releases/librtas-${PV}.tar.gz"
+HOMEPAGE="http://librtas.ozlabs.org/"
+
+SLOT="0"
+LICENSE="IBM"
+KEYWORDS="ppc ppc64"
+IUSE=""
+
+src_unpack() {
+ unpack ${A}
+ epatch "${FILESDIR}"/${PN}-1.3.3-remove-doc.patch
+ epatch "${FILESDIR}"/${PN}-1.3.3-open.patch
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die
+ dodoc README
+}
diff --git a/sys-libs/librtas/librtas-1.3.5.ebuild b/sys-libs/librtas/librtas-1.3.5.ebuild
new file mode 100644
index 000000000000..04472c5f58dd
--- /dev/null
+++ b/sys-libs/librtas/librtas-1.3.5.ebuild
@@ -0,0 +1,19 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils
+
+DESCRIPTION=" Librtas provides a set of libraries for user-space access to RTAS on the ppc64 architecture"
+SRC_URI="http://librtas.ozlabs.org/releases/librtas-${PV}.tar.gz"
+HOMEPAGE="http://librtas.ozlabs.org/"
+
+SLOT="0"
+LICENSE="IBM"
+KEYWORDS="ppc ppc64"
+IUSE=""
+
+src_install() {
+ emake DESTDIR="${D}" install || die
+ dodoc README
+}
diff --git a/sys-libs/librtas/librtas-1.3.6.ebuild b/sys-libs/librtas/librtas-1.3.6.ebuild
new file mode 100644
index 000000000000..e4f91f634c55
--- /dev/null
+++ b/sys-libs/librtas/librtas-1.3.6.ebuild
@@ -0,0 +1,22 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+inherit eutils
+
+DESCRIPTION="A set of libraries for userspace access to RTAS on the PowerPC platform(s)"
+HOMEPAGE="http://sourceforge.net/projects/librtas/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="IBM"
+SLOT="0"
+KEYWORDS="ppc ppc64"
+IUSE=""
+
+DOCS="README"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-symlink.patch
+ sed -i -e '/install_doc/d' Makefile || die
+}
diff --git a/sys-libs/librtas/librtas-1.3.8.ebuild b/sys-libs/librtas/librtas-1.3.8.ebuild
new file mode 100644
index 000000000000..5acad1477398
--- /dev/null
+++ b/sys-libs/librtas/librtas-1.3.8.ebuild
@@ -0,0 +1,22 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+inherit eutils
+
+DESCRIPTION="A set of libraries for userspace access to RTAS on the PowerPC platform(s)"
+HOMEPAGE="http://sourceforge.net/projects/librtas/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="IBM"
+SLOT="0"
+KEYWORDS="~ppc ~ppc64"
+IUSE=""
+
+DOCS="README"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-symlink.patch
+ sed -i -e '/install_doc/d' Makefile || die
+}
diff --git a/sys-libs/librtas/metadata.xml b/sys-libs/librtas/metadata.xml
new file mode 100644
index 000000000000..749b46648ac5
--- /dev/null
+++ b/sys-libs/librtas/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>ppc64</herd>
+ <upstream>
+ <remote-id type="sourceforge">librtas</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-libs/libseccomp/Manifest b/sys-libs/libseccomp/Manifest
new file mode 100644
index 000000000000..551a5fdbc0d8
--- /dev/null
+++ b/sys-libs/libseccomp/Manifest
@@ -0,0 +1,6 @@
+DIST libseccomp-0.1.0.tar.gz 62837 SHA256 e940989c093c9c057aca4e1a878be48bdcdb027f876a8d4bdcd9a1405a3d7f6f SHA512 69bf68d561bf8e12959a517c5156e9d14a42717a409a5bed4945026fb053ceb13dbff215774a2fac460811641f3425173ee7b076c1f4cb943d8b172bd28f8c2e WHIRLPOOL 375f573953ea241dc845bea4a82cd16c4d9708cb1d739774217f7085c600e52823e0dc30e5efed01edc7cb9a4c623444af99f95d6d4218c3b9d566735645284f
+DIST libseccomp-1.0.0.tar.gz 70172 SHA256 7c35493c890af509955397ea1f5d3c1a8e84a3002a64fa8c716de395e117cc4c SHA512 e75f0e3a593ccf9efb6d0ccd2364afe3c7420dd891f6d3e94cd5edc497e3b73f7122ebf82f3aeab97d984f35d7e82c09d1f17d099e5a86a95a6e9ac0afbbd3d5 WHIRLPOOL e806fbb068dff09610cce2b93d262a14245c1bc26260a97c4e804f0ba7f5d564f3d07401d46cd715888b7650d3d653f14426bc66ed67742ef3ed522950d633ef
+DIST libseccomp-1.0.1.tar.gz 129602 SHA256 7c38fa4bcb92ec48179132e9532feee65f9dc3a00b733328a21551f028b62966 SHA512 eb67e298d3fd80d46d70629c2a159a4cd1954e97d7b8ea00138880f3b34748e215153150021c0554e2123369db61f490e0279672feb91f184f46eb4fc09ecf7e WHIRLPOOL 58d62f310e7f118eaee52f0cf6bfbf33b44469c9fbbaa76975975cd63dfa71b48647e50370f85963d7819368ac37359ac88d176e7cd6d6e93871a42c837741ad
+DIST libseccomp-2.1.0.tar.gz 216834 SHA256 b0d6e4f0984e6632a04f0cf33c6babdb011674ba15ff208e196f037e0e09905e SHA512 4096aed2d09332a954ab949e548e2b51c14c8da6f99514dcf57572bcb68dba42f0f67904159ec2b2624e34f7ee81f9904c1e79a5525300949f70d25315f63718 WHIRLPOOL dd8081567056c4e0b7dea281cb1f69d4f289925d86761d6a5f71c007c9c47d634377ab2ae2636613067f95b8a07a1199edd8aa69d058be2f3f1ece3e2b9f5dd0
+DIST libseccomp-2.1.1.tar.gz 113133 SHA256 8812c11e407c383f5ad6afb84a88e5a0224477bcfe8ff03f0c548e5abaac841c SHA512 1f2916d80a9b9937d2ab9ecf9c4f1e2a8ffc27f90f14e8481eb2f32c8122ea1756950f753f25fb571053f492cc97c8792760e0f058e7ea07ec4bb442508d1112 WHIRLPOOL 77db55f9317e27930b6fd7e83d122b1dd460849bbf9910d7619424d791b1ecd96ffbc5f741cd35e89f27cdc0ab537d5c7c9febaafbf1556c932b9774b80a8643
+DIST libseccomp-2.2.0.tar.gz 516697 SHA256 5aa8a230f8529d6ee777098550245e43d2247395fdfd5a2176e28cf7236f1b10 SHA512 c013fdfc868d19bc6703019e91f4bea9c2b7472417a9f0df4fc593fc5fdf29bf535f4b32defd738652838799483684ca18a57e32eeb4b7fb3512b07fb2a440c5 WHIRLPOOL ec1e42186d813d8cf9aea248c27e732162bd4016f06385b4d66ce573f76cb45418211f7b5c06ccb4a35a3c56ce97619827c21a3910e717e35a7c343ee4adf8dc
diff --git a/sys-libs/libseccomp/libseccomp-0.1.0.ebuild b/sys-libs/libseccomp/libseccomp-0.1.0.ebuild
new file mode 100644
index 000000000000..48dd73fe2b31
--- /dev/null
+++ b/sys-libs/libseccomp/libseccomp-0.1.0.ebuild
@@ -0,0 +1,36 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# Note: USE=static-libs isn't great -- only PIC objects are provided.
+
+EAPI="4"
+
+inherit eutils
+
+DESCRIPTION="high level interface to Linux seccomp filter"
+HOMEPAGE="http://sourceforge.net/projects/libseccomp/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="LGPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="static-libs tools"
+
+src_prepare() {
+ sed -i \
+ -e "/^SUBDIRS_BUILD/s:=.*:= src $(usex tools tools ''):" \
+ Makefile || die
+}
+
+src_test() {
+ emake SUBDIRS_BUILD='tools tests'
+ cd tests
+ ./regression
+}
+
+src_install() {
+ default
+ use tools && dobin tools/{bpf_{disasm,sim},sys_{inspector,resolver}}
+ use static-libs && dolib.a src/libseccomp.a
+}
diff --git a/sys-libs/libseccomp/libseccomp-1.0.0.ebuild b/sys-libs/libseccomp/libseccomp-1.0.0.ebuild
new file mode 100644
index 000000000000..155767a03afe
--- /dev/null
+++ b/sys-libs/libseccomp/libseccomp-1.0.0.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# Note: USE=static-libs isn't great -- only PIC objects are provided.
+
+EAPI="4"
+
+inherit eutils
+
+DESCRIPTION="high level interface to Linux seccomp filter"
+HOMEPAGE="http://sourceforge.net/projects/libseccomp/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="LGPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="static-libs tools"
+
+src_prepare() {
+ sed -i \
+ -e "/^SUBDIRS_BUILD/s:=.*:= src $(usex tools tools ''):" \
+ Makefile || die
+ tc-export AR CC
+ export GCC=${CC}
+}
+
+src_test() {
+ emake SUBDIRS_BUILD='tools tests'
+ cd tests
+ ./regression
+}
+
+src_install() {
+ default
+ use tools && dobin tools/{bpf_{disasm,sim},sys_{inspector,resolver}}
+ use static-libs && dolib.a src/libseccomp.a
+}
diff --git a/sys-libs/libseccomp/libseccomp-1.0.1.ebuild b/sys-libs/libseccomp/libseccomp-1.0.1.ebuild
new file mode 100644
index 000000000000..8c469cc2098f
--- /dev/null
+++ b/sys-libs/libseccomp/libseccomp-1.0.1.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# Note: USE=static-libs isn't great -- only PIC objects are provided.
+
+EAPI="4"
+
+inherit eutils
+
+DESCRIPTION="high level interface to Linux seccomp filter"
+HOMEPAGE="http://sourceforge.net/projects/libseccomp/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="LGPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="static-libs tools"
+
+src_prepare() {
+ sed -i \
+ -e "/^SUBDIRS_BUILD/s:=.*:= src $(usex tools tools ''):" \
+ Makefile || die
+ tc-export AR CC
+ export GCC=${CC}
+}
+
+src_test() {
+ emake SUBDIRS_BUILD='tools tests'
+ cd tests
+ ./regression
+}
+
+src_install() {
+ default
+ use tools && dobin tools/{bpf_{disasm,sim},sys_{inspector,resolver}}
+ use static-libs && dolib.a src/libseccomp.a
+}
diff --git a/sys-libs/libseccomp/libseccomp-2.1.0.ebuild b/sys-libs/libseccomp/libseccomp-2.1.0.ebuild
new file mode 100644
index 000000000000..6c48b663a508
--- /dev/null
+++ b/sys-libs/libseccomp/libseccomp-2.1.0.ebuild
@@ -0,0 +1,41 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# Note: USE=static-libs isn't great -- only PIC objects are provided.
+
+EAPI="4"
+
+inherit eutils
+
+DESCRIPTION="high level interface to Linux seccomp filter"
+HOMEPAGE="http://sourceforge.net/projects/libseccomp/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="LGPL-2"
+SLOT="0"
+KEYWORDS="amd64 arm x86"
+IUSE="static-libs"
+
+src_prepare() {
+ sed -i \
+ -e '/^SUBDIRS_BUILD/s:tests::' \
+ Makefile || die
+ sed -i \
+ -e '/^LDFLAGS/s|:=|+=|' \
+ {tests,tools}/Makefile || die
+ export MAKEOPTS+=" V=1"
+ tc-export AR CC
+ export GCC=${CC}
+}
+
+src_test() {
+ emake SUBDIRS_BUILD='tests'
+ cd tests
+ ./regression || die
+}
+
+src_install() {
+ default
+ use static-libs && dolib.a src/libseccomp.a
+}
diff --git a/sys-libs/libseccomp/libseccomp-2.1.1.ebuild b/sys-libs/libseccomp/libseccomp-2.1.1.ebuild
new file mode 100644
index 000000000000..dab9016ee308
--- /dev/null
+++ b/sys-libs/libseccomp/libseccomp-2.1.1.ebuild
@@ -0,0 +1,41 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# Note: USE=static-libs isn't great -- only PIC objects are provided.
+
+EAPI="4"
+
+inherit eutils
+
+DESCRIPTION="high level interface to Linux seccomp filter"
+HOMEPAGE="http://sourceforge.net/projects/libseccomp/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="LGPL-2"
+SLOT="0"
+KEYWORDS="amd64 arm x86"
+IUSE="static-libs"
+
+src_prepare() {
+ sed -i \
+ -e '/^SUBDIRS_BUILD/s:tests::' \
+ Makefile || die
+ sed -i \
+ -e '/^LDFLAGS/s|:=|+=|' \
+ {tests,tools}/Makefile || die
+ export MAKEOPTS+=" V=1"
+ tc-export AR CC
+ export GCC=${CC}
+}
+
+src_test() {
+ emake SUBDIRS_BUILD='tests'
+ cd tests
+ ./regression || die
+}
+
+src_install() {
+ default
+ use static-libs && dolib.a src/libseccomp.a
+}
diff --git a/sys-libs/libseccomp/libseccomp-2.2.0.ebuild b/sys-libs/libseccomp/libseccomp-2.2.0.ebuild
new file mode 100644
index 000000000000..3e389d99a973
--- /dev/null
+++ b/sys-libs/libseccomp/libseccomp-2.2.0.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# TODO: Add python support.
+
+EAPI="5"
+
+inherit eutils multilib-minimal
+
+DESCRIPTION="high level interface to Linux seccomp filter"
+HOMEPAGE="https://github.com/seccomp/libseccomp"
+SRC_URI="https://github.com/seccomp/libseccomp/releases/download/v${PV}/${P}.tar.gz"
+
+LICENSE="LGPL-2"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~arm ~arm64 ~mips ~x86"
+IUSE="static-libs"
+
+# We need newer kernel headers; we don't keep strict control of the exact
+# version here, just be safe and pull in the latest stable ones. #551248
+DEPEND=">=sys-kernel/linux-headers-3.18"
+
+src_prepare() {
+ sed -i \
+ -e '/_LDFLAGS/s:-static::' \
+ tools/Makefile.in || die
+}
+
+multilib_src_configure() {
+ ECONF_SOURCE=${S} \
+ econf \
+ $(use_enable static-libs static) \
+ --disable-python
+}
+
+multilib_src_install_all() {
+ find "${ED}" -name libseccomp.la -delete
+}
diff --git a/sys-libs/libseccomp/metadata.xml b/sys-libs/libseccomp/metadata.xml
new file mode 100644
index 000000000000..bc9d25599e98
--- /dev/null
+++ b/sys-libs/libseccomp/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>vapier@gentoo.org</email>
+ </maintainer>
+ <use>
+ <flag name="tools">enable debugging tools</flag>
+ </use>
+ <upstream>
+ <remote-id type="github">seccomp/libseccomp</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-libs/libselinux/Manifest b/sys-libs/libselinux/Manifest
new file mode 100644
index 000000000000..f9ea8da6d956
--- /dev/null
+++ b/sys-libs/libselinux/Manifest
@@ -0,0 +1,5 @@
+DIST libselinux-2.2.2.tar.gz 171013 SHA256 30ab363416806da907b86b97f1d31c252473e3200358bb1570f563c8312b5a3e SHA512 1270cba11ec0795a2cea3706ac5547655d0e65dcd2141932000526f3d0c781b6ae114051b2bb53950b8ef207a318335329280b9fc9fd81796e8e4a27cf6ae841 WHIRLPOOL a444e44225ced35b126bbd2e8924aaf5c9f4da7abb9663d20a32b97babe750245c22d75e2238de0958b73295cf582b8aec39e23312886b96417120c600ed37dc
+DIST libselinux-2.3.tar.gz 171254 SHA256 0b1e0b43ecd84a812713d09564019b08e7c205d89072b5cbcd07b052cd8e77b2 SHA512 8cfcd20ab0b43ffbb32389e0498b21e43cde643dcdf471a2354f1ca557f11641d250871ed5e71b9dde4c5f47ac1048746fe514f8f6cfad668fa179ed5136e802 WHIRLPOOL e975a391559aca3f8b251d2aa484cf8e344d09caa43ff56dd929e75a0ad195cf8d9a88b950679f589f4deb74aea0d22be4e7ad00b11eacc080288df0b5ac7ccb
+DIST libselinux-2.4.tar.gz 165931 SHA256 46043091f4c5ba4f43e8d3715f30d665a2d571c9126c1f03945c9ea4ed380f7b SHA512 f7c7ceabcc6ca7bb5cb24fd04b8ea4771af7e509a11ce601fb50d52bd14b291ab6136b7f5193912d02b61b132a2fdd1666f229478598d0b20b99bdea0f5e69d6 WHIRLPOOL d1499818fc885c3bd07785d41466b4ea4bcf56fafe8cbc9bd1a517fe0d2d528b10911fa6df08756ca63aebc411fd69c7f01283685c8a858a81301e203dfd3ec2
+DIST patchbundle-libselinux-2.2.2-r5.tar.gz 2304 SHA256 ad77f499c05ec3b5707cb9db518a891dd9c84ccb77db07e686c87e5799e1802c SHA512 a01db39a7aade27b0127dd0e2f3185587ff4d913b7b1be7beac36dc2d3e1007de5e6bae8a11bc84567385420fff064ba54892d8e113c8fd54ad3c598dde7648d WHIRLPOOL 5886d9de6fcf073d54ca5e0eac3f8b4754c44382e7044debb223f94ecc81ea0e26b7638037eef17eb6f8ce4cc5046a4bb9f93b9b7767480908ee5b2ced0413ac
+DIST patchbundle-libselinux-4.tar.gz 2631 SHA256 91bf43c84ce3d3178c8d21fdcf97380a635fa2465d1611fe4e0e3838a586c78c SHA512 bd2f9762f095e3dbc67e77ee04968cb8e87d460fdf10feff91cb1ce6027e19a660bb57617887e44608d39720e8f95500c451c4b284d58c0a756a04b08fa305c2 WHIRLPOOL 07a6a69d33c46c443907aae2ae4f3646a0360565e28d0a50cbcf81f8b5d8c259812d3e086841fc21c2a8104ce9863fc6c9c1d32e28ea08ebc7baf2d45af3509f
diff --git a/sys-libs/libselinux/files/0005-use-ruby-include-with-rubylibver.patch b/sys-libs/libselinux/files/0005-use-ruby-include-with-rubylibver.patch
new file mode 100644
index 000000000000..0fc84141a3db
--- /dev/null
+++ b/sys-libs/libselinux/files/0005-use-ruby-include-with-rubylibver.patch
@@ -0,0 +1,12 @@
+diff -uNr libselinux-2.2.2.orig/src/Makefile libselinux-2.2.2/src/Makefile
+--- libselinux-2.2.2.orig/src/Makefile 2013-11-06 20:56:30.000000000 +0100
++++ libselinux-2.2.2/src/Makefile 2013-11-25 21:02:05.327561766 +0100
+@@ -16,7 +16,7 @@
+ PYLIBDIR ?= $(LIBDIR)/$(PYLIBVER)
+ RUBYLIBVER ?= $(shell $(RUBY) -e 'print RUBY_VERSION.split(".")[0..1].join(".")')
+ RUBYPLATFORM ?= $(shell $(RUBY) -e 'print RUBY_PLATFORM')
+-RUBYINC ?= $(shell pkg-config --cflags ruby)
++RUBYINC ?= $(shell pkg-config --cflags ruby-$(RUBYLIBVER))
+ RUBYINSTALL ?= $(LIBDIR)/ruby/site_ruby/$(RUBYLIBVER)/$(RUBYPLATFORM)
+ LIBBASE ?= $(shell basename $(LIBDIR))
+
diff --git a/sys-libs/libselinux/files/0006-build-related-fixes-bug-500674.patch b/sys-libs/libselinux/files/0006-build-related-fixes-bug-500674.patch
new file mode 100644
index 000000000000..cec91b12829a
--- /dev/null
+++ b/sys-libs/libselinux/files/0006-build-related-fixes-bug-500674.patch
@@ -0,0 +1,67 @@
+https://bugs.gentoo.org/500674
+
+random fixes:
+ - make sure PCRE_CFLAGS get used
+ - use PCRE_LIBS via pkg-config
+ - move LDFLAGS to before objects, not after
+ - do not hardcode -L$(LIBDIR) (let the toolchain handle it)
+ - do not hardcode -I$(INCLUDEDIR) (let the toolchain handle it)
+
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -75,7 +75,7 @@ CFLAGS ?= -O -Wall -W -Wundef -Wformat-y2k -Wformat-security -Winit-self -Wmissi
+ -fipa-pure-const -Wno-suggest-attribute=pure -Wno-suggest-attribute=const \
+ -Werror -Wno-aggregate-return -Wno-redundant-decls
+
+-override CFLAGS += -I../include -I$(INCLUDEDIR) -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 $(EMFLAGS)
++override CFLAGS += -I../include $(PCRE_CFLAGS) -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 $(EMFLAGS)
+
+ SWIG_CFLAGS += -Wno-error -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unused-parameter \
+ -Wno-shadow -Wno-uninitialized -Wno-missing-prototypes -Wno-missing-declarations
+@@ -104,17 +104,17 @@ $(SWIGRUBYLOBJ): $(SWIGRUBYCOUT)
+ $(CC) $(CFLAGS) $(SWIG_CFLAGS) $(RUBYINC) -fPIC -DSHARED -c -o $@ $<
+
+ $(SWIGSO): $(SWIGLOBJ)
+- $(CC) $(CFLAGS) -shared -o $@ $< -L. -lselinux $(LDFLAGS) -L$(LIBDIR)
++ $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $< -L. -lselinux
+
+ $(SWIGRUBYSO): $(SWIGRUBYLOBJ)
+- $(CC) $(CFLAGS) -shared -o $@ $^ -L. -lselinux $(LDFLAGS) -L$(LIBDIR)
++ $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -L. -lselinux
+
+ $(LIBA): $(OBJS)
+ $(AR) rcs $@ $^
+ $(RANLIB) $@
+
+ $(LIBSO): $(LOBJS)
+- $(CC) $(CFLAGS) -shared -o $@ $^ -lpcre -ldl $(LDFLAGS) -L$(LIBDIR) -Wl,-soname,$(LIBSO),-z,defs,-z,relro
++ $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -ldl $(PCRE_LIBS) -Wl,-soname,$(LIBSO),-z,defs,-z,relro
+ ln -sf $@ $(TARGET)
+
+ $(LIBPC): $(LIBPC).in ../VERSION
+@@ -127,7 +127,7 @@ $(AUDIT2WHYLOBJ): audit2why.c
+ $(CC) $(filter-out -Werror, $(CFLAGS)) $(PYINC) -fPIC -DSHARED -c -o $@ $<
+
+ $(AUDIT2WHYSO): $(AUDIT2WHYLOBJ)
+- $(CC) $(CFLAGS) -shared -o $@ $^ -L. $(LDFLAGS) -lselinux $(LIBDIR)/libsepol.a -L$(LIBDIR)
++ $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -L. -lselinux $(LIBDIR)/libsepol.a
+
+ %.o: %.c policy.h
+ $(CC) $(CFLAGS) $(TLSFLAGS) -c -o $@ $<
+--- a/utils/Makefile
++++ b/utils/Makefile
+@@ -24,11 +24,12 @@ CFLAGS ?= -O -Wall -W -Wundef -Wformat-y2k -Wformat-security -Winit-self -Wmissi
+ -fipa-pure-const -Wno-suggest-attribute=pure -Wno-suggest-attribute=const \
+ -Werror -Wno-aggregate-return -Wno-redundant-decls
+ override CFLAGS += -I../include -D_GNU_SOURCE $(EMFLAGS)
+-LDLIBS += -L../src -lselinux -L$(LIBDIR)
++LDLIBS += -L../src -lselinux
+
+ TARGETS=$(patsubst %.c,%,$(wildcard *.c))
+
+-sefcontext_compile: LDLIBS += -lpcre
++sefcontext_compile: CFLAGS += $(PCRE_CFLAGS)
++sefcontext_compile: LDLIBS += $(PCRE_LIBS)
+
+ ifeq ($(DISABLE_AVC),y)
+ UNUSED_TARGETS+=compute_av compute_create compute_member compute_relabel
diff --git a/sys-libs/libselinux/libselinux-2.2.2-r5.ebuild b/sys-libs/libselinux/libselinux-2.2.2-r5.ebuild
new file mode 100644
index 000000000000..dda1b92d579c
--- /dev/null
+++ b/sys-libs/libselinux/libselinux-2.2.2-r5.ebuild
@@ -0,0 +1,95 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+PYTHON_COMPAT=( python2_7 python3_3 )
+
+inherit multilib python-r1 toolchain-funcs eutils multilib-minimal
+
+SEPOL_VER="2.2"
+
+DESCRIPTION="SELinux userland library"
+HOMEPAGE="http://userspace.selinuxproject.org"
+SRC_URI="http://userspace.selinuxproject.org/releases/20131030/${P}.tar.gz
+ http://dev.gentoo.org/~swift/patches/${PN}/patchbundle-${P}-r5.tar.gz"
+
+LICENSE="public-domain"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="python static-libs"
+
+RDEPEND=">=sys-libs/libsepol-${SEPOL_VER}
+ >=dev-libs/libpcre-8.30-r2[static-libs?]
+ python? ( ${PYTHON_DEPS} )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ python? ( >=dev-lang/swig-2.0.9 )"
+
+src_prepare() {
+ EPATCH_MULTI_MSG="Applying libselinux patches ... " \
+ EPATCH_SUFFIX="patch" \
+ EPATCH_SOURCE="${WORKDIR}/gentoo-patches" \
+ EPATCH_FORCE="yes" \
+ epatch
+
+ epatch_user
+
+ multilib_copy_sources
+}
+
+multilib_src_compile() {
+ tc-export PKG_CONFIG RANLIB
+ local PCRE_CFLAGS=$(${PKG_CONFIG} libpcre --cflags)
+ local PCRE_LIBS=$(${PKG_CONFIG} libpcre --libs)
+ export PCRE_{CFLAGS,LIBS}
+
+ emake \
+ AR="$(tc-getAR)" \
+ CC="$(tc-getCC)" \
+ LIBDIR="\$(PREFIX)/$(get_libdir)" \
+ SHLIBDIR="\$(DESTDIR)/$(get_libdir)" \
+ LDFLAGS="-fPIC ${LDFLAGS} -pthread" \
+ all
+
+ if multilib_is_native_abi && use python; then
+ building() {
+ python_export PYTHON_INCLUDEDIR PYTHON_LIBPATH
+ emake \
+ CC="$(tc-getCC)" \
+ PYINC="-I${PYTHON_INCLUDEDIR}" \
+ PYTHONLIBDIR="${PYTHON_LIBPATH}" \
+ PYPREFIX="${EPYTHON##*/}" \
+ LDFLAGS="-fPIC ${LDFLAGS} -lpthread" \
+ pywrap
+ }
+ python_foreach_impl building
+ fi
+}
+
+multilib_src_install() {
+ LIBDIR="\$(PREFIX)/$(get_libdir)" SHLIBDIR="\$(DESTDIR)/$(get_libdir)" \
+ emake DESTDIR="${D}" install
+
+ if multilib_is_native_abi && use python; then
+ installation() {
+ LIBDIR="\$(PREFIX)/$(get_libdir)" emake DESTDIR="${D}" install-pywrap
+ }
+ python_foreach_impl installation
+ fi
+
+ use static-libs || rm "${D}"/usr/lib*/*.a
+}
+
+pkg_postinst() {
+ # Fix bug 473502
+ for POLTYPE in ${POLICY_TYPES};
+ do
+ mkdir -p /etc/selinux/${POLTYPE}/contexts/files
+ touch /etc/selinux/${POLTYPE}/contexts/files/file_contexts.local
+ # Fix bug 516608
+ for EXPRFILE in file_contexts file_contexts.homedirs file_contexts.local ; do
+ sefcontext_compile /etc/selinux/${POLTYPE}/contexts/files/${EXPRFILE};
+ done
+ done
+}
diff --git a/sys-libs/libselinux/libselinux-2.3-r2.ebuild b/sys-libs/libselinux/libselinux-2.3-r2.ebuild
new file mode 100644
index 000000000000..349684d8bae5
--- /dev/null
+++ b/sys-libs/libselinux/libselinux-2.3-r2.ebuild
@@ -0,0 +1,145 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+PYTHON_COMPAT=( python2_7 python3_3 python3_4 )
+USE_RUBY="ruby19 ruby20"
+
+PATCHBUNDLE="4"
+
+# No, I am not calling ruby-ng
+inherit multilib python-r1 toolchain-funcs eutils multilib-minimal
+
+MY_P="${P//_/-}"
+
+SEPOL_VER="2.3"
+
+DESCRIPTION="SELinux userland library"
+HOMEPAGE="http://userspace.selinuxproject.org"
+SRC_URI="https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/20140506/${MY_P}.tar.gz
+ http://dev.gentoo.org/~swift/patches/${PN}/patchbundle-${PN}-${PATCHBUNDLE}.tar.gz"
+
+LICENSE="public-domain"
+SLOT="0"
+KEYWORDS="amd64 x86"
+
+IUSE="python ruby static-libs ruby_targets_ruby19 ruby_targets_ruby20"
+
+RDEPEND=">=sys-libs/libsepol-${SEPOL_VER}[${MULTILIB_USEDEP}]
+ >=dev-libs/libpcre-8.33-r1[static-libs?,${MULTILIB_USEDEP}]
+ python? ( ${PYTHON_DEPS} )
+ ruby? (
+ ruby_targets_ruby19? ( dev-lang/ruby:1.9 )
+ ruby_targets_ruby20? ( dev-lang/ruby:2.0 )
+ )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ python? ( >=dev-lang/swig-2.0.9 )"
+
+S="${WORKDIR}/${MY_P}"
+
+src_prepare() {
+ EPATCH_MULTI_MSG="Applying libselinux patches ... " \
+ EPATCH_SUFFIX="patch" \
+ EPATCH_SOURCE="${WORKDIR}/gentoo-patches" \
+ EPATCH_FORCE="yes" \
+ epatch
+
+ epatch_user
+
+ multilib_copy_sources
+}
+
+multilib_src_compile() {
+ tc-export PKG_CONFIG RANLIB
+ local PCRE_CFLAGS=$(${PKG_CONFIG} libpcre --cflags)
+ local PCRE_LIBS=$(${PKG_CONFIG} libpcre --libs)
+ export PCRE_{CFLAGS,LIBS}
+
+ emake \
+ AR="$(tc-getAR)" \
+ CC="$(tc-getCC)" \
+ LIBDIR="\$(PREFIX)/$(get_libdir)" \
+ SHLIBDIR="\$(DESTDIR)/$(get_libdir)" \
+ LDFLAGS="-fPIC ${LDFLAGS} -pthread" \
+ all
+
+ if multilib_is_native_abi && use python; then
+ building() {
+ python_export PYTHON_INCLUDEDIR PYTHON_LIBPATH
+ emake \
+ CC="$(tc-getCC)" \
+ PYINC="-I${PYTHON_INCLUDEDIR}" \
+ PYTHONLIBDIR="${PYTHON_LIBPATH}" \
+ PYPREFIX="${EPYTHON##*/}" \
+ LDFLAGS="-fPIC ${LDFLAGS} -lpthread" \
+ pywrap
+ }
+ python_foreach_impl building
+ fi
+
+ if multilib_is_native_abi && use ruby; then
+ building() {
+ einfo "Calling rubywrap for ${1}"
+ # Clean up .lo file to force rebuild
+ test -f src/selinuxswig_ruby_wrap.lo && rm src/selinuxswig_ruby_wrap.lo
+ emake \
+ CC="$(tc-getCC)" \
+ RUBY=${1} \
+ RUBYINSTALL=$(${1} -e 'print RbConfig::CONFIG["vendorarchdir"]') \
+ LDFLAGS="-fPIC ${LDFLAGS} -lpthread" \
+ rubywrap
+ }
+ for RUBYTARGET in ${USE_RUBY}; do
+ use ruby_targets_${RUBYTARGET} || continue
+
+ building ${RUBYTARGET}
+ done
+ fi
+}
+
+multilib_src_install() {
+ LIBDIR="\$(PREFIX)/$(get_libdir)" SHLIBDIR="\$(DESTDIR)/$(get_libdir)" \
+ emake DESTDIR="${D}" install
+
+ if multilib_is_native_abi && use python; then
+ installation() {
+ LIBDIR="\$(PREFIX)/$(get_libdir)" emake DESTDIR="${D}" install-pywrap
+ python_optimize # bug 531638
+ }
+ python_foreach_impl installation
+ fi
+
+ if multilib_is_native_abi && use ruby; then
+ installation() {
+ einfo "Calling install-rubywrap for ${1}"
+ # Forcing (re)build here as otherwise the resulting SO file is used for all ruby versions
+ rm src/selinuxswig_ruby_wrap.lo
+ LIBDIR="\$(PREFIX)/$(get_libdir)" emake DESTDIR="${D}" \
+ RUBY=${1} \
+ RUBYINSTALL="${D}/$(${1} -e 'print RbConfig::CONFIG["vendorarchdir"]')" \
+ install-rubywrap
+ }
+ for RUBYTARGET in ${USE_RUBY}; do
+ use ruby_targets_${RUBYTARGET} || continue
+
+ installation ${RUBYTARGET}
+ done
+ fi
+
+ use static-libs || rm "${D}"/usr/lib*/*.a
+}
+
+pkg_postinst() {
+ # Fix bug 473502
+ for POLTYPE in ${POLICY_TYPES};
+ do
+ mkdir -p /etc/selinux/${POLTYPE}/contexts/files
+ touch /etc/selinux/${POLTYPE}/contexts/files/file_contexts.local
+ # Fix bug 516608
+ for EXPRFILE in file_contexts file_contexts.homedirs file_contexts.local ; do
+ sefcontext_compile /etc/selinux/${POLTYPE}/contexts/files/${EXPRFILE};
+ done
+ done
+}
diff --git a/sys-libs/libselinux/libselinux-2.4.ebuild b/sys-libs/libselinux/libselinux-2.4.ebuild
new file mode 100644
index 000000000000..02d769021d85
--- /dev/null
+++ b/sys-libs/libselinux/libselinux-2.4.ebuild
@@ -0,0 +1,142 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+PYTHON_COMPAT=( python2_7 python3_3 python3_4 )
+USE_RUBY="ruby19 ruby20"
+
+# No, I am not calling ruby-ng
+inherit multilib python-r1 toolchain-funcs eutils multilib-minimal
+
+MY_P="${P//_/-}"
+SEPOL_VER="${PV}"
+
+DESCRIPTION="SELinux userland library"
+HOMEPAGE="https://github.com/SELinuxProject/selinux/wiki"
+SRC_URI="https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/20150202/${MY_P}.tar.gz"
+
+LICENSE="public-domain"
+SLOT="0"
+KEYWORDS="amd64 x86"
+
+IUSE="python ruby static-libs ruby_targets_ruby19 ruby_targets_ruby20"
+
+RDEPEND=">=sys-libs/libsepol-${SEPOL_VER}[${MULTILIB_USEDEP}]
+ >=dev-libs/libpcre-8.33-r1[static-libs?,${MULTILIB_USEDEP}]
+ python? ( ${PYTHON_DEPS} )
+ ruby? (
+ ruby_targets_ruby19? ( dev-lang/ruby:1.9 )
+ ruby_targets_ruby20? ( dev-lang/ruby:2.0 )
+ )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ python? ( >=dev-lang/swig-2.0.9 )"
+
+S="${WORKDIR}/${MY_P}"
+
+src_prepare() {
+ epatch "${FILESDIR}/0005-use-ruby-include-with-rubylibver.patch"
+ epatch "${FILESDIR}/0006-build-related-fixes-bug-500674.patch"
+
+ epatch_user
+
+ multilib_copy_sources
+}
+
+multilib_src_compile() {
+ tc-export PKG_CONFIG RANLIB
+ local PCRE_CFLAGS=$(${PKG_CONFIG} libpcre --cflags)
+ local PCRE_LIBS=$(${PKG_CONFIG} libpcre --libs)
+ export PCRE_{CFLAGS,LIBS}
+
+ emake \
+ AR="$(tc-getAR)" \
+ CC="$(tc-getCC)" \
+ LIBDIR="\$(PREFIX)/$(get_libdir)" \
+ SHLIBDIR="\$(DESTDIR)/$(get_libdir)" \
+ LDFLAGS="-fPIC ${LDFLAGS} -pthread" \
+ all
+
+ if multilib_is_native_abi && use python; then
+ building() {
+ python_export PYTHON_INCLUDEDIR PYTHON_LIBPATH
+ emake \
+ CC="$(tc-getCC)" \
+ PYINC="-I${PYTHON_INCLUDEDIR}" \
+ PYTHONLIBDIR="${PYTHON_LIBPATH}" \
+ PYPREFIX="${EPYTHON##*/}" \
+ LDFLAGS="-fPIC ${LDFLAGS} -lpthread" \
+ LIBDIR="\$(PREFIX)/$(get_libdir)" \
+ SHLIBDIR="\$(DESTDIR)/$(get_libdir)" \
+ pywrap
+ }
+ python_foreach_impl building
+ fi
+
+ if multilib_is_native_abi && use ruby; then
+ building() {
+ einfo "Calling rubywrap for ${1}"
+ # Clean up .lo file to force rebuild
+ test -f src/selinuxswig_ruby_wrap.lo && rm src/selinuxswig_ruby_wrap.lo
+ emake \
+ CC="$(tc-getCC)" \
+ RUBY=${1} \
+ RUBYINSTALL=$(${1} -e 'print RbConfig::CONFIG["vendorarchdir"]') \
+ LDFLAGS="-fPIC ${LDFLAGS} -lpthread" \
+ LIBDIR="\$(PREFIX)/$(get_libdir)" \
+ SHLIBDIR="\$(DESTDIR)/$(get_libdir)" \
+ rubywrap
+ }
+ for RUBYTARGET in ${USE_RUBY}; do
+ use ruby_targets_${RUBYTARGET} || continue
+
+ building ${RUBYTARGET}
+ done
+ fi
+}
+
+multilib_src_install() {
+ LIBDIR="\$(PREFIX)/$(get_libdir)" SHLIBDIR="\$(DESTDIR)/$(get_libdir)" \
+ emake DESTDIR="${D}" install
+
+ if multilib_is_native_abi && use python; then
+ installation() {
+ LIBDIR="\$(PREFIX)/$(get_libdir)" emake DESTDIR="${D}" install-pywrap
+ python_optimize # bug 531638
+ }
+ python_foreach_impl installation
+ fi
+
+ if multilib_is_native_abi && use ruby; then
+ installation() {
+ einfo "Calling install-rubywrap for ${1}"
+ # Forcing (re)build here as otherwise the resulting SO file is used for all ruby versions
+ rm src/selinuxswig_ruby_wrap.lo
+ LIBDIR="\$(PREFIX)/$(get_libdir)" emake DESTDIR="${D}" \
+ RUBY=${1} \
+ RUBYINSTALL="${D}/$(${1} -e 'print RbConfig::CONFIG["vendorarchdir"]')" \
+ install-rubywrap
+ }
+ for RUBYTARGET in ${USE_RUBY}; do
+ use ruby_targets_${RUBYTARGET} || continue
+
+ installation ${RUBYTARGET}
+ done
+ fi
+
+ use static-libs || rm "${D}"/usr/lib*/*.a
+}
+
+pkg_postinst() {
+ # Fix bug 473502
+ for POLTYPE in ${POLICY_TYPES};
+ do
+ mkdir -p /etc/selinux/${POLTYPE}/contexts/files
+ touch /etc/selinux/${POLTYPE}/contexts/files/file_contexts.local
+ # Fix bug 516608
+ for EXPRFILE in file_contexts file_contexts.homedirs file_contexts.local ; do
+ sefcontext_compile /etc/selinux/${POLTYPE}/contexts/files/${EXPRFILE};
+ done
+ done
+}
diff --git a/sys-libs/libselinux/libselinux-9999.ebuild b/sys-libs/libselinux/libselinux-9999.ebuild
new file mode 100644
index 000000000000..d78ace2dee65
--- /dev/null
+++ b/sys-libs/libselinux/libselinux-9999.ebuild
@@ -0,0 +1,152 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+PYTHON_COMPAT=( python2_7 python3_3 python3_4 )
+USE_RUBY="ruby19 ruby20"
+
+# No, I am not calling ruby-ng
+inherit multilib python-r1 toolchain-funcs eutils multilib-minimal
+
+MY_P="${P//_/-}"
+SEPOL_VER="${PV}"
+MY_RELEASEDATE="20150202"
+
+DESCRIPTION="SELinux userland library"
+HOMEPAGE="https://github.com/SELinuxProject/selinux/wiki"
+
+if [[ ${PV} == 9999 ]] ; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/SELinuxProject/selinux.git"
+ S="${WORKDIR}/${MY_P}/${PN}"
+else
+ SRC_URI="https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/${MY_RELEASEDATE}/${MY_P}.tar.gz"
+ KEYWORDS="~amd64 ~x86"
+ S="${WORKDIR}/${MY_P}"
+fi
+
+LICENSE="public-domain"
+SLOT="0"
+
+IUSE="python ruby static-libs ruby_targets_ruby19 ruby_targets_ruby20"
+
+RDEPEND=">=sys-libs/libsepol-${SEPOL_VER}[${MULTILIB_USEDEP}]
+ >=dev-libs/libpcre-8.33-r1[static-libs?,${MULTILIB_USEDEP}]
+ python? ( ${PYTHON_DEPS} )
+ ruby? (
+ ruby_targets_ruby19? ( dev-lang/ruby:1.9 )
+ ruby_targets_ruby20? ( dev-lang/ruby:2.0 )
+ )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ python? ( >=dev-lang/swig-2.0.9 )"
+
+src_prepare() {
+ if [[ ${PV} != 9999 ]] ; then
+ # If needed for live builds, place them in /etc/portage/patches
+ epatch "${FILESDIR}/0005-use-ruby-include-with-rubylibver.patch"
+ epatch "${FILESDIR}/0006-build-related-fixes-bug-500674.patch"
+ fi
+
+ epatch_user
+
+ multilib_copy_sources
+}
+
+multilib_src_compile() {
+ tc-export PKG_CONFIG RANLIB
+ local PCRE_CFLAGS=$(${PKG_CONFIG} libpcre --cflags)
+ local PCRE_LIBS=$(${PKG_CONFIG} libpcre --libs)
+ export PCRE_{CFLAGS,LIBS}
+
+ emake \
+ AR="$(tc-getAR)" \
+ CC="$(tc-getCC)" \
+ LIBDIR="\$(PREFIX)/$(get_libdir)" \
+ SHLIBDIR="\$(DESTDIR)/$(get_libdir)" \
+ LDFLAGS="-fPIC ${LDFLAGS} -pthread" \
+ all
+
+ if multilib_is_native_abi && use python; then
+ building() {
+ python_export PYTHON_INCLUDEDIR PYTHON_LIBPATH
+ emake \
+ CC="$(tc-getCC)" \
+ PYINC="-I${PYTHON_INCLUDEDIR}" \
+ PYTHONLIBDIR="${PYTHON_LIBPATH}" \
+ PYPREFIX="${EPYTHON##*/}" \
+ LDFLAGS="-fPIC ${LDFLAGS} -lpthread" \
+ LIBDIR="\$(PREFIX)/$(get_libdir)" \
+ SHLIBDIR="\$(DESTDIR)/$(get_libdir)" \
+ pywrap
+ }
+ python_foreach_impl building
+ fi
+
+ if multilib_is_native_abi && use ruby; then
+ building() {
+ einfo "Calling rubywrap for ${1}"
+ # Clean up .lo file to force rebuild
+ test -f src/selinuxswig_ruby_wrap.lo && rm src/selinuxswig_ruby_wrap.lo
+ emake \
+ CC="$(tc-getCC)" \
+ RUBY=${1} \
+ RUBYINSTALL=$(${1} -e 'print RbConfig::CONFIG["vendorarchdir"]') \
+ LDFLAGS="-fPIC ${LDFLAGS} -lpthread" \
+ LIBDIR="\$(PREFIX)/$(get_libdir)" \
+ SHLIBDIR="\$(DESTDIR)/$(get_libdir)" \
+ rubywrap
+ }
+ for RUBYTARGET in ${USE_RUBY}; do
+ use ruby_targets_${RUBYTARGET} || continue
+
+ building ${RUBYTARGET}
+ done
+ fi
+}
+
+multilib_src_install() {
+ LIBDIR="\$(PREFIX)/$(get_libdir)" SHLIBDIR="\$(DESTDIR)/$(get_libdir)" \
+ emake DESTDIR="${D}" install
+
+ if multilib_is_native_abi && use python; then
+ installation() {
+ LIBDIR="\$(PREFIX)/$(get_libdir)" emake DESTDIR="${D}" install-pywrap
+ python_optimize # bug 531638
+ }
+ python_foreach_impl installation
+ fi
+
+ if multilib_is_native_abi && use ruby; then
+ installation() {
+ einfo "Calling install-rubywrap for ${1}"
+ # Forcing (re)build here as otherwise the resulting SO file is used for all ruby versions
+ rm src/selinuxswig_ruby_wrap.lo
+ LIBDIR="\$(PREFIX)/$(get_libdir)" emake DESTDIR="${D}" \
+ RUBY=${1} \
+ RUBYINSTALL="${D}/$(${1} -e 'print RbConfig::CONFIG["vendorarchdir"]')" \
+ install-rubywrap
+ }
+ for RUBYTARGET in ${USE_RUBY}; do
+ use ruby_targets_${RUBYTARGET} || continue
+
+ installation ${RUBYTARGET}
+ done
+ fi
+
+ use static-libs || rm "${D}"/usr/lib*/*.a
+}
+
+pkg_postinst() {
+ # Fix bug 473502
+ for POLTYPE in ${POLICY_TYPES};
+ do
+ mkdir -p /etc/selinux/${POLTYPE}/contexts/files
+ touch /etc/selinux/${POLTYPE}/contexts/files/file_contexts.local
+ # Fix bug 516608
+ for EXPRFILE in file_contexts file_contexts.homedirs file_contexts.local ; do
+ sefcontext_compile /etc/selinux/${POLTYPE}/contexts/files/${EXPRFILE};
+ done
+ done
+}
diff --git a/sys-libs/libselinux/metadata.xml b/sys-libs/libselinux/metadata.xml
new file mode 100644
index 000000000000..3794d1d83f5a
--- /dev/null
+++ b/sys-libs/libselinux/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>selinux</herd>
+ <longdescription>
+ Libselinux provides an API for SELinux applications to get and set
+ process and file security contexts and to obtain security policy
+ decisions. Required for any applications that use the SELinux API.
+ </longdescription>
+ <upstream>
+ <remote-id type="github">SELinuxProject/selinux</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-libs/libsemanage/Manifest b/sys-libs/libsemanage/Manifest
new file mode 100644
index 000000000000..f95583eccd84
--- /dev/null
+++ b/sys-libs/libsemanage/Manifest
@@ -0,0 +1,3 @@
+DIST libsemanage-2.2.tar.gz 138208 SHA256 11f60bfa0f1c6063cd9bd99ce0cb4acc9d6d9e9b8d7743d39e847bcd7803bd75 SHA512 09032b1b322fec7346164939ade118034812cb538ebc72121640d4ac5c89d2a66b59caa465027cfbebb590dee039a26d4345eafedf365d7f6ad0b5e90377d50f WHIRLPOOL 49170c5ee9ff57dcc4a15aa72386f37993f76436f0da25808c60dab2d03ba52932d0d4fa753c326900d83d2fae30f8bcf659251f17327783f2e2be3deb4842f4
+DIST libsemanage-2.3.tar.gz 138231 SHA256 03e09e35e611c286e446bef92b6023ef2623815996f5a53394bb02e49a312e4b SHA512 defe3bbdbe51abdaa13a39f693c33446d8a1a8509ac1eb25c7770da2df6487bcb0ca31259d02b4531d4c81db5e221e94e95bec97f6a1a155e1de2f65e6f0da34 WHIRLPOOL 943d4d300aa8ad49c411b10b41c0c3e751c46dbcbbe129bdd1d2e975e231c58391d6ecdee6b27699fff9f6e6facf5b48fc8d57c2ff68692694c7de430750fac9
+DIST libsemanage-2.4.tar.gz 151173 SHA256 1a4cace4ef16786531ec075c0e7b2f961e2fee5dc86c5f983a689058899a6484 SHA512 54f993253b22207b053daf4d34e72c65c72279866416089b6c0f047ef77bca3e307eac0ce6dfe40bd14e2e47e79841b358d5607501779f38d9b5f7c35f3b7729 WHIRLPOOL 7303c06515ed59b5756a87d08aff07671e51d26ce9fa452ca75643dd0ce4658571dc69d86434c943d691a4ab0d90cbdccdaa27e5aaec5fdf8057cf2d5d30631e
diff --git a/sys-libs/libsemanage/files/0001-libsemanage-do-not-copy-contexts-in-semanage_migrate.patch b/sys-libs/libsemanage/files/0001-libsemanage-do-not-copy-contexts-in-semanage_migrate.patch
new file mode 100644
index 000000000000..8e523dcbf7e3
--- /dev/null
+++ b/sys-libs/libsemanage/files/0001-libsemanage-do-not-copy-contexts-in-semanage_migrate.patch
@@ -0,0 +1,208 @@
+From 9caebebd598de737f27cdc8d5253a2cebd67d5a9 Mon Sep 17 00:00:00 2001
+From: Jason Zaman <jason@perfinion.com>
+Date: Wed, 22 Apr 2015 18:27:09 +0400
+Subject: [PATCH] libsemanage: do not copy contexts in semanage_migrate_store
+
+The modules from the old store were previously copied to the new one
+using setfscreatecon and shutil.copy2(). Now that refpolicy has rules
+about the new policy location[1], copying the contexts is redundant.
+
+More importantly, the setcreatefscon caused a constraint violation[2]
+which made the migration fail. In python3, shutil.copy2() copies xattrs
+as well which again causes problems. shutil.copy() is enough for our
+needs here as it will copy the file and permissions in both py2 and 3.
+We do not need the extra things that copy2() does (mtime, xattr, etc).
+
+[1] http://oss.tresys.com/pipermail/refpolicy/2014-December/007511.html
+
+[2]
+type=AVC msg=audit(1429438272.872:1869): avc: denied { create } for pid=28739 comm="semanage_migrat" name="strict" scontext=staff_u:sysadm_r:semanage_t tcontext=system_u:object_r:semanage_store_t tclass=dir permissive=0
+ constrain dir { create relabelfrom relabelto } ((u1 == u2 -Fail-) or (t1 == can_change_object_identity -Fail-) ); Constraint DENIED
+allow semanage_t semanage_store_t:dir create;
+
+Signed-off-by: Jason Zaman <jason@perfinion.com>
+---
+ libsemanage/utils/semanage_migrate_store | 77 ++++++++------------------------
+ 1 file changed, 18 insertions(+), 59 deletions(-)
+
+diff --git a/libsemanage/utils/semanage_migrate_store b/libsemanage/utils/semanage_migrate_store
+index 03b492e..2f85e9c 100755
+--- a/libsemanage/utils/semanage_migrate_store
++++ b/libsemanage/utils/semanage_migrate_store
+@@ -8,7 +8,6 @@ import shutil
+ import sys
+ from optparse import OptionParser
+
+-import bz2
+ import ctypes
+
+ sepol = ctypes.cdll.LoadLibrary('libsepol.so')
+@@ -21,41 +20,20 @@ except:
+ exit(1)
+
+
+-
+-
+-# For some reason this function doesn't exist in libselinux :\
+-def copy_with_context(src, dst):
++def copy_file(src, dst):
+ if DEBUG:
+ print("copying %s to %s" % (src, dst))
+ try:
+- con = selinux.lgetfilecon_raw(src)[1]
+- except:
+- print("Could not get file context of %s" % src, file=sys.stderr)
+- exit(1)
+-
+- try:
+- selinux.setfscreatecon_raw(con)
+- except:
+- print("Could not set fs create context: %s" %con, file=sys.stderr)
+- exit(1)
+-
+- try:
+- shutil.copy2(src, dst)
++ shutil.copy(src, dst)
+ except OSError as the_err:
+ (err, strerr) = the_err.args
+ print("Could not copy %s to %s, %s" %(src, dst, strerr), file=sys.stderr)
+ exit(1)
+
+- try:
+- selinux.setfscreatecon_raw(None)
+- except:
+- print("Could not reset fs create context. May need to relabel system.", file=sys.stderr)
+
+-def create_dir_from(src, dst, mode):
++def create_dir(dst, mode):
+ if DEBUG: print("Making directory %s" % dst)
+ try:
+- con = selinux.lgetfilecon_raw(src)[1]
+- selinux.setfscreatecon_raw(con)
+ os.makedirs(dst, mode)
+ except OSError as the_err:
+ (err, stderr) = the_err.args
+@@ -65,28 +43,18 @@ def create_dir_from(src, dst, mode):
+ print("Error creating %s" % dst, file=sys.stderr)
+ exit(1)
+
+- try:
+- selinux.setfscreatecon_raw(None)
+- except:
+- print("Could not reset fs create context. May need to relabel system.", file=sys.stderr)
+
+-def create_file_from(src, dst):
++def create_file(dst):
+ if DEBUG: print("Making file %s" % dst)
+ try:
+- con = selinux.lgetfilecon_raw(src)[1]
+- selinux.setfscreatecon_raw(con)
+ open(dst, 'a').close()
+ except OSError as the_err:
+ (err, stderr) = the_err.args
+ print("Error creating %s" % dst, file=sys.stderr)
+ exit(1)
+
+- try:
+- selinux.setfscreatecon_raw(None)
+- except:
+- print("Could not reset fs create context. May need to relabel system.", file=sys.stderr)
+
+-def copy_module(store, name, con, base):
++def copy_module(store, name, base):
+ if DEBUG: print("Install module %s" % name)
+ (file, ext) = os.path.splitext(name)
+ if ext != ".pp":
+@@ -94,8 +62,6 @@ def copy_module(store, name, con, base):
+ print("warning: %s has invalid extension, skipping" % name, file=sys.stderr)
+ return
+ try:
+- selinux.setfscreatecon_raw(con)
+-
+ if base:
+ root = oldstore_path(store)
+ else:
+@@ -105,7 +71,7 @@ def copy_module(store, name, con, base):
+
+ os.mkdir("%s/%s" % (bottomdir, file))
+
+- copy_with_context(os.path.join(root, name), "%s/%s/hll" % (bottomdir, file))
++ copy_file(os.path.join(root, name), "%s/%s/hll" % (bottomdir, file))
+
+ # This is the ext file that will eventually be used to choose a compiler
+ efile = open("%s/%s/lang_ext" % (bottomdir, file), "w+", 0o600)
+@@ -116,15 +82,11 @@ def copy_module(store, name, con, base):
+ print("Error installing module %s" % name, file=sys.stderr)
+ exit(1)
+
+- try:
+- selinux.setfscreatecon_raw(None)
+- except:
+- print("Could not reset fs create context. May need to relabel system.", file=sys.stderr)
+
+-def disable_module(file, root, name, disabledmodules):
++def disable_module(file, name, disabledmodules):
+ if DEBUG: print("Disabling %s" % name)
+ (disabledname, disabledext) = os.path.splitext(file)
+- create_file_from(os.path.join(root, name), "%s/%s" % (disabledmodules, disabledname))
++ create_file("%s/%s" % (disabledmodules, disabledname))
+
+ def migrate_store(store):
+
+@@ -138,17 +100,14 @@ def migrate_store(store):
+ print("Migrating from %s to %s" % (oldstore, newstore))
+
+ # Build up new directory structure
+- create_dir_from(oldstore, "%s/%s" % (newroot_path(), store), 0o755)
+- create_dir_from(oldstore, newstore, 0o700)
+- create_dir_from(oldstore, newmodules, 0o700)
+- create_dir_from(oldstore, bottomdir, 0o700)
+- create_dir_from(oldstore, disabledmodules, 0o700)
+-
+- # use whatever the file context of bottomdir is for the module directories
+- con = selinux.lgetfilecon_raw(bottomdir)[1]
++ create_dir("%s/%s" % (newroot_path(), store), 0o755)
++ create_dir(newstore, 0o700)
++ create_dir(newmodules, 0o700)
++ create_dir(bottomdir, 0o700)
++ create_dir(disabledmodules, 0o700)
+
+ # Special case for base since it was in a different location
+- copy_module(store, "base.pp", con, 1)
++ copy_module(store, "base.pp", 1)
+
+ # Dir structure built, start copying files
+ for root, dirs, files in os.walk(oldstore):
+@@ -161,7 +120,7 @@ def migrate_store(store):
+ newname = "seusers.local"
+ else:
+ newname = name
+- copy_with_context(os.path.join(root, name), os.path.join(newstore, newname))
++ copy_file(os.path.join(root, name), os.path.join(newstore, newname))
+
+ elif root == oldmodules:
+ # This should be the modules directory
+@@ -171,9 +130,9 @@ def migrate_store(store):
+ print("Error installing module %s, name conflicts with base" % name, file=sys.stderr)
+ exit(1)
+ elif ext == ".disabled":
+- disable_module(file, root, name, disabledmodules)
++ disable_module(file, name, disabledmodules)
+ else:
+- copy_module(store, name, con, 0)
++ copy_module(store, name, 0)
+
+ def rebuild_policy():
+ # Ok, the modules are loaded, lets try to rebuild the policy
+@@ -287,7 +246,7 @@ if __name__ == "__main__":
+ "preserve_tunables" ]
+
+
+- create_dir_from(oldroot_path(), newroot_path(), 0o755)
++ create_dir(newroot_path(), 0o755)
+
+ stores = None
+ if TYPE is not None:
+--
+2.0.5
+
diff --git a/sys-libs/libsemanage/libsemanage-2.2-r2.ebuild b/sys-libs/libsemanage/libsemanage-2.2-r2.ebuild
new file mode 100644
index 000000000000..2d6bc07413ea
--- /dev/null
+++ b/sys-libs/libsemanage/libsemanage-2.2-r2.ebuild
@@ -0,0 +1,91 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+PYTHON_COMPAT=( python2_7 python3_3 )
+
+inherit multilib python-r1 toolchain-funcs eutils multilib-minimal
+
+SEPOL_VER="2.2"
+SELNX_VER="2.2.2-r1"
+
+DESCRIPTION="SELinux kernel and policy management library"
+HOMEPAGE="http://userspace.selinuxproject.org"
+SRC_URI="http://userspace.selinuxproject.org/releases/20131030/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="python"
+
+RDEPEND=">=sys-libs/libsepol-${SEPOL_VER}
+ >=sys-libs/libselinux-${SELNX_VER}
+ dev-libs/ustr
+ sys-process/audit"
+DEPEND="${RDEPEND}
+ sys-devel/bison
+ sys-devel/flex
+ python? (
+ >=dev-lang/swig-2.0.4-r1
+ virtual/pkgconfig
+ ${PYTHON_DEPS}
+ )"
+
+# tests are not meant to be run outside of the
+# full SELinux userland repo
+RESTRICT="test"
+
+src_prepare() {
+ echo "# Set this to true to save the linked policy." >> "${S}/src/semanage.conf"
+ echo "# This is normally only useful for analysis" >> "${S}/src/semanage.conf"
+ echo "# or debugging of policy." >> "${S}/src/semanage.conf"
+ echo "save-linked=false" >> "${S}/src/semanage.conf"
+ echo >> "${S}/src/semanage.conf"
+ echo "# Set this to 0 to disable assertion checking." >> "${S}/src/semanage.conf"
+ echo "# This should speed up building the kernel policy" >> "${S}/src/semanage.conf"
+ echo "# from policy modules, but may leave you open to" >> "${S}/src/semanage.conf"
+ echo "# dangerous rules which assertion checking" >> "${S}/src/semanage.conf"
+ echo "# would catch." >> "${S}/src/semanage.conf"
+ echo "expand-check=1" >> "${S}/src/semanage.conf"
+ echo >> "${S}/src/semanage.conf"
+ echo "# Modules in the module store can be compressed" >> "${S}/src/semanage.conf"
+ echo "# with bzip2. Set this to the bzip2 blocksize" >> "${S}/src/semanage.conf"
+ echo "# 1-9 when compressing. The higher the number," >> "${S}/src/semanage.conf"
+ echo "# the more memory is traded off for disk space." >> "${S}/src/semanage.conf"
+ echo "# Set to 0 to disable bzip2 compression." >> "${S}/src/semanage.conf"
+ echo "bzip-blocksize=0" >> "${S}/src/semanage.conf"
+ echo >> "${S}/src/semanage.conf"
+ echo "# Reduce memory usage for bzip2 compression and" >> "${S}/src/semanage.conf"
+ echo "# decompression of modules in the module store." >> "${S}/src/semanage.conf"
+ echo "bzip-small=true" >> "${S}/src/semanage.conf"
+
+ epatch_user
+
+ multilib_copy_sources
+}
+
+multilib_src_compile() {
+ emake AR="$(tc-getAR)" CC="$(tc-getCC)" all || die
+
+ if multilib_is_native_abi && use python; then
+ building() {
+ python_export PYTHON_INCLUDEDIR PYTHON_LIBPATH
+ emake CC="$(tc-getCC)" PYINC="-I${PYTHON_INCLUDEDIR}" PYTHONLBIDIR="${PYTHON_LIBPATH}" PYPREFIX="${EPYTHON##*/}" "$@"
+ }
+ python_foreach_impl building swigify
+ python_foreach_impl building pywrap
+ fi
+}
+
+multilib_src_install() {
+ LIBDIR="\$(PREFIX)/$(get_libdir)" SHLIBDIR="\$(PREFIX)/$(get_libdir)" \
+ emake DESTDIR="${D}" install
+
+ if multilib_is_native_abi && use python; then
+ installation() {
+ emake DESTDIR="${D}" install-pywrap
+ }
+ python_foreach_impl installation
+ fi
+}
diff --git a/sys-libs/libsemanage/libsemanage-2.3-r4.ebuild b/sys-libs/libsemanage/libsemanage-2.3-r4.ebuild
new file mode 100644
index 000000000000..3e52b94dee8f
--- /dev/null
+++ b/sys-libs/libsemanage/libsemanage-2.3-r4.ebuild
@@ -0,0 +1,104 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+PYTHON_COMPAT=( python2_7 python3_3 python3_4 )
+
+inherit multilib python-r1 toolchain-funcs eutils multilib-minimal
+
+MY_P="${P//_/-}"
+
+SEPOL_VER="2.3"
+SELNX_VER="2.3"
+
+DESCRIPTION="SELinux kernel and policy management library"
+HOMEPAGE="http://userspace.selinuxproject.org"
+SRC_URI="https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/20140506/${MY_P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="python"
+
+RDEPEND=">=sys-libs/libsepol-${SEPOL_VER}[${MULTILIB_USEDEP}]
+ >=sys-libs/libselinux-${SELNX_VER}[${MULTILIB_USEDEP}]
+ >=sys-process/audit-2.2.2[${MULTILIB_USEDEP}]
+ >=dev-libs/ustr-1.0.4-r2[${MULTILIB_USEDEP}]
+ "
+DEPEND="${RDEPEND}
+ sys-devel/bison
+ sys-devel/flex
+ python? (
+ >=dev-lang/swig-2.0.4-r1
+ virtual/pkgconfig
+ ${PYTHON_DEPS}
+ )"
+
+# tests are not meant to be run outside of the
+# full SELinux userland repo
+RESTRICT="test"
+
+S="${WORKDIR}/${MY_P}"
+
+src_prepare() {
+ echo "# Set this to true to save the linked policy." >> "${S}/src/semanage.conf"
+ echo "# This is normally only useful for analysis" >> "${S}/src/semanage.conf"
+ echo "# or debugging of policy." >> "${S}/src/semanage.conf"
+ echo "save-linked=false" >> "${S}/src/semanage.conf"
+ echo >> "${S}/src/semanage.conf"
+ echo "# Set this to 0 to disable assertion checking." >> "${S}/src/semanage.conf"
+ echo "# This should speed up building the kernel policy" >> "${S}/src/semanage.conf"
+ echo "# from policy modules, but may leave you open to" >> "${S}/src/semanage.conf"
+ echo "# dangerous rules which assertion checking" >> "${S}/src/semanage.conf"
+ echo "# would catch." >> "${S}/src/semanage.conf"
+ echo "expand-check=1" >> "${S}/src/semanage.conf"
+ echo >> "${S}/src/semanage.conf"
+ echo "# Modules in the module store can be compressed" >> "${S}/src/semanage.conf"
+ echo "# with bzip2. Set this to the bzip2 blocksize" >> "${S}/src/semanage.conf"
+ echo "# 1-9 when compressing. The higher the number," >> "${S}/src/semanage.conf"
+ echo "# the more memory is traded off for disk space." >> "${S}/src/semanage.conf"
+ echo "# Set to 0 to disable bzip2 compression." >> "${S}/src/semanage.conf"
+ echo "bzip-blocksize=0" >> "${S}/src/semanage.conf"
+ echo >> "${S}/src/semanage.conf"
+ echo "# Reduce memory usage for bzip2 compression and" >> "${S}/src/semanage.conf"
+ echo "# decompression of modules in the module store." >> "${S}/src/semanage.conf"
+ echo "bzip-small=true" >> "${S}/src/semanage.conf"
+
+ epatch_user
+
+ multilib_copy_sources
+}
+
+multilib_src_compile() {
+ emake \
+ AR="$(tc-getAR)" \
+ CC="$(tc-getCC)" \
+ LIBDIR="${EPREFIX}/usr/$(get_libdir)" \
+ all
+
+ if multilib_is_native_abi && use python; then
+ building_py() {
+ python_export PYTHON_INCLUDEDIR PYTHON_LIBPATH
+ emake CC="$(tc-getCC)" PYINC="-I${PYTHON_INCLUDEDIR}" PYTHONLBIDIR="${PYTHON_LIBPATH}" PYPREFIX="${EPYTHON##*/}" "$@"
+ python_optimize # bug 531638
+ }
+ python_foreach_impl building_py swigify
+ python_foreach_impl building_py pywrap
+ fi
+}
+
+multilib_src_install() {
+ emake \
+ LIBDIR="${ED}/usr/$(get_libdir)" \
+ SHLIBDIR="${ED}/usr/$(get_libdir)" \
+ DESTDIR="${ED}" install
+
+ if multilib_is_native_abi && use python; then
+ installation_py() {
+ emake DESTDIR="${ED}" LIBDIR="${ED}/usr/$(get_libdir)" \
+ SHLIBDIR="${ED}/usr/$(get_libdir)" install-pywrap
+ }
+ python_foreach_impl installation_py
+ fi
+}
diff --git a/sys-libs/libsemanage/libsemanage-2.4-r1.ebuild b/sys-libs/libsemanage/libsemanage-2.4-r1.ebuild
new file mode 100644
index 000000000000..f28af4cb58c8
--- /dev/null
+++ b/sys-libs/libsemanage/libsemanage-2.4-r1.ebuild
@@ -0,0 +1,127 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+PYTHON_COMPAT=( python2_7 python3_3 python3_4 )
+
+inherit multilib python-r1 toolchain-funcs eutils multilib-minimal
+
+MY_P="${P//_/-}"
+
+SEPOL_VER="${PV}"
+SELNX_VER="${PV}"
+
+DESCRIPTION="SELinux kernel and policy management library"
+HOMEPAGE="https://github.com/SELinuxProject/selinux/wiki"
+SRC_URI="https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/20150202/${MY_P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="python"
+
+RDEPEND=">=sys-libs/libsepol-${SEPOL_VER}[${MULTILIB_USEDEP}]
+ >=sys-libs/libselinux-${SELNX_VER}[${MULTILIB_USEDEP}]
+ >=sys-process/audit-2.2.2[${MULTILIB_USEDEP}]
+ >=dev-libs/ustr-1.0.4-r2[${MULTILIB_USEDEP}]
+ "
+DEPEND="${RDEPEND}
+ sys-devel/bison
+ sys-devel/flex
+ python? (
+ >=dev-lang/swig-2.0.4-r1
+ virtual/pkgconfig
+ ${PYTHON_DEPS}
+ )"
+
+# tests are not meant to be run outside of the
+# full SELinux userland repo
+RESTRICT="test"
+
+S="${WORKDIR}/${MY_P}"
+
+src_prepare() {
+ echo "# Set this to true to save the linked policy." >> "${S}/src/semanage.conf"
+ echo "# This is normally only useful for analysis" >> "${S}/src/semanage.conf"
+ echo "# or debugging of policy." >> "${S}/src/semanage.conf"
+ echo "save-linked=false" >> "${S}/src/semanage.conf"
+ echo >> "${S}/src/semanage.conf"
+ echo "# Set this to 0 to disable assertion checking." >> "${S}/src/semanage.conf"
+ echo "# This should speed up building the kernel policy" >> "${S}/src/semanage.conf"
+ echo "# from policy modules, but may leave you open to" >> "${S}/src/semanage.conf"
+ echo "# dangerous rules which assertion checking" >> "${S}/src/semanage.conf"
+ echo "# would catch." >> "${S}/src/semanage.conf"
+ echo "expand-check=1" >> "${S}/src/semanage.conf"
+ echo >> "${S}/src/semanage.conf"
+ echo "# Modules in the module store can be compressed" >> "${S}/src/semanage.conf"
+ echo "# with bzip2. Set this to the bzip2 blocksize" >> "${S}/src/semanage.conf"
+ echo "# 1-9 when compressing. The higher the number," >> "${S}/src/semanage.conf"
+ echo "# the more memory is traded off for disk space." >> "${S}/src/semanage.conf"
+ echo "# Set to 0 to disable bzip2 compression." >> "${S}/src/semanage.conf"
+ echo "bzip-blocksize=0" >> "${S}/src/semanage.conf"
+ echo >> "${S}/src/semanage.conf"
+ echo "# Reduce memory usage for bzip2 compression and" >> "${S}/src/semanage.conf"
+ echo "# decompression of modules in the module store." >> "${S}/src/semanage.conf"
+ echo "bzip-small=true" >> "${S}/src/semanage.conf"
+
+ epatch "${FILESDIR}/0001-libsemanage-do-not-copy-contexts-in-semanage_migrate.patch"
+
+ epatch_user
+
+ multilib_copy_sources
+}
+
+multilib_src_compile() {
+ emake \
+ AR="$(tc-getAR)" \
+ CC="$(tc-getCC)" \
+ LIBDIR="${EPREFIX}/usr/$(get_libdir)" \
+ all
+
+ if multilib_is_native_abi && use python; then
+ building_py() {
+ python_export PYTHON_INCLUDEDIR PYTHON_LIBPATH
+ emake CC="$(tc-getCC)" PYINC="-I${PYTHON_INCLUDEDIR}" PYTHONLBIDIR="${PYTHON_LIBPATH}" PYPREFIX="${EPYTHON##*/}" "$@"
+ }
+ python_foreach_impl building_py swigify
+ python_foreach_impl building_py pywrap
+ fi
+}
+
+multilib_src_install() {
+ emake \
+ LIBDIR="${ED}/usr/$(get_libdir)" \
+ SHLIBDIR="${ED}/usr/$(get_libdir)" \
+ DESTDIR="${ED}" install
+
+ if multilib_is_native_abi && use python; then
+ installation_py() {
+ emake DESTDIR="${ED}" LIBDIR="${ED}/usr/$(get_libdir)" \
+ SHLIBDIR="${ED}/usr/$(get_libdir)" install-pywrap
+ python_optimize # bug 531638
+ }
+ python_foreach_impl installation_py
+ fi
+}
+
+pkg_postinst() {
+ # Migrate the SELinux semanage configuration store if not done already
+ local selinuxtype=$(awk -F'=' '/SELINUXTYPE=/ {print $2}' /etc/selinux/config);
+ if [ -n "${selinuxtype}" ] && [ ! -d /var/lib/selinux/${mcs}/active ] ; then
+ ewarn "Since the 2.4 SELinux userspace, the policy module store is moved"
+ ewarn "from /etc/selinux to /var/lib/selinux. The migration will be run now."
+ ewarn "If there are any issues, it can be done manually by running:"
+ ewarn "/usr/libexec/selinux/semanage_migrate_store"
+ ewarn "For more information, please see"
+ ewarn "- https://github.com/SELinuxProject/selinux/wiki/Policy-Store-Migration"
+ fi
+
+ # Run the store migration without rebuilds
+ for POLICY_TYPE in ${POLICY_TYPES} ; do
+ if [ ! -d "${ROOT}/var/lib/selinux/${POLICY_TYPE}/active" ] ; then
+ einfo "Migrating store ${POLICY_TYPE} (without policy rebuild)."
+ /usr/libexec/selinux/semanage_migrate_store -n -s "${POLICY_TYPE}" || die "Failed to migrate store ${POLICY_TYPE}"
+ fi
+ done
+}
diff --git a/sys-libs/libsemanage/libsemanage-9999.ebuild b/sys-libs/libsemanage/libsemanage-9999.ebuild
new file mode 100644
index 000000000000..5132051ba8c2
--- /dev/null
+++ b/sys-libs/libsemanage/libsemanage-9999.ebuild
@@ -0,0 +1,137 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+PYTHON_COMPAT=( python2_7 python3_3 python3_4 )
+
+inherit multilib python-r1 toolchain-funcs eutils multilib-minimal
+
+MY_P="${P//_/-}"
+MY_RELEASEDATE="20150202"
+
+SEPOL_VER="${PV}"
+SELNX_VER="${PV}"
+
+DESCRIPTION="SELinux kernel and policy management library"
+HOMEPAGE="https://github.com/SELinuxProject/selinux/wiki"
+
+if [[ ${PV} == 9999 ]] ; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/SELinuxProject/selinux.git"
+ S="${WORKDIR}/${MY_P}/${PN}"
+else
+ SRC_URI="https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/20150202/${MY_P}.tar.gz"
+ KEYWORDS="~amd64 ~x86"
+ S="${WORKDIR}/${MY_P}"
+fi
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="python"
+
+RDEPEND=">=sys-libs/libsepol-${SEPOL_VER}[${MULTILIB_USEDEP}]
+ >=sys-libs/libselinux-${SELNX_VER}[${MULTILIB_USEDEP}]
+ >=sys-process/audit-2.2.2[${MULTILIB_USEDEP}]
+ >=dev-libs/ustr-1.0.4-r2[${MULTILIB_USEDEP}]
+ "
+DEPEND="${RDEPEND}
+ sys-devel/bison
+ sys-devel/flex
+ python? (
+ >=dev-lang/swig-2.0.4-r1
+ virtual/pkgconfig
+ ${PYTHON_DEPS}
+ )"
+
+# tests are not meant to be run outside of the
+# full SELinux userland repo
+RESTRICT="test"
+
+src_prepare() {
+ echo "# Set this to true to save the linked policy." >> "${S}/src/semanage.conf"
+ echo "# This is normally only useful for analysis" >> "${S}/src/semanage.conf"
+ echo "# or debugging of policy." >> "${S}/src/semanage.conf"
+ echo "save-linked=false" >> "${S}/src/semanage.conf"
+ echo >> "${S}/src/semanage.conf"
+ echo "# Set this to 0 to disable assertion checking." >> "${S}/src/semanage.conf"
+ echo "# This should speed up building the kernel policy" >> "${S}/src/semanage.conf"
+ echo "# from policy modules, but may leave you open to" >> "${S}/src/semanage.conf"
+ echo "# dangerous rules which assertion checking" >> "${S}/src/semanage.conf"
+ echo "# would catch." >> "${S}/src/semanage.conf"
+ echo "expand-check=1" >> "${S}/src/semanage.conf"
+ echo >> "${S}/src/semanage.conf"
+ echo "# Modules in the module store can be compressed" >> "${S}/src/semanage.conf"
+ echo "# with bzip2. Set this to the bzip2 blocksize" >> "${S}/src/semanage.conf"
+ echo "# 1-9 when compressing. The higher the number," >> "${S}/src/semanage.conf"
+ echo "# the more memory is traded off for disk space." >> "${S}/src/semanage.conf"
+ echo "# Set to 0 to disable bzip2 compression." >> "${S}/src/semanage.conf"
+ echo "bzip-blocksize=0" >> "${S}/src/semanage.conf"
+ echo >> "${S}/src/semanage.conf"
+ echo "# Reduce memory usage for bzip2 compression and" >> "${S}/src/semanage.conf"
+ echo "# decompression of modules in the module store." >> "${S}/src/semanage.conf"
+ echo "bzip-small=true" >> "${S}/src/semanage.conf"
+
+ if [[ ${PV} != 9999 ]] ; then
+ # If wanted for live builds, please use /etc/portage/patches
+ epatch "${FILESDIR}/0001-libsemanage-do-not-copy-contexts-in-semanage_migrate.patch"
+ fi
+
+ epatch_user
+
+ multilib_copy_sources
+}
+
+multilib_src_compile() {
+ emake \
+ AR="$(tc-getAR)" \
+ CC="$(tc-getCC)" \
+ LIBDIR="${EPREFIX}/usr/$(get_libdir)" \
+ all
+
+ if multilib_is_native_abi && use python; then
+ building_py() {
+ python_export PYTHON_INCLUDEDIR PYTHON_LIBPATH
+ emake CC="$(tc-getCC)" PYINC="-I${PYTHON_INCLUDEDIR}" PYTHONLBIDIR="${PYTHON_LIBPATH}" PYPREFIX="${EPYTHON##*/}" "$@"
+ }
+ python_foreach_impl building_py swigify
+ python_foreach_impl building_py pywrap
+ fi
+}
+
+multilib_src_install() {
+ emake \
+ LIBDIR="${ED}/usr/$(get_libdir)" \
+ SHLIBDIR="${ED}/usr/$(get_libdir)" \
+ DESTDIR="${ED}" install
+
+ if multilib_is_native_abi && use python; then
+ installation_py() {
+ emake DESTDIR="${ED}" LIBDIR="${ED}/usr/$(get_libdir)" \
+ SHLIBDIR="${ED}/usr/$(get_libdir)" install-pywrap
+ python_optimize # bug 531638
+ }
+ python_foreach_impl installation_py
+ fi
+}
+
+pkg_postinst() {
+ # Migrate the SELinux semanage configuration store if not done already
+ local selinuxtype=$(awk -F'=' '/SELINUXTYPE=/ {print $2}' /etc/selinux/config);
+ if [ -n "${selinuxtype}" ] && [ ! -d /var/lib/selinux/${mcs}/active ] ; then
+ ewarn "Since the 2.4 SELinux userspace, the policy module store is moved"
+ ewarn "from /etc/selinux to /var/lib/selinux. The migration will be run now."
+ ewarn "If there are any issues, it can be done manually by running:"
+ ewarn "/usr/libexec/selinux/semanage_migrate_store"
+ ewarn "For more information, please see"
+ ewarn "- https://github.com/SELinuxProject/selinux/wiki/Policy-Store-Migration"
+ fi
+
+ # Run the store migration without rebuilds
+ for POLICY_TYPE in ${POLICY_TYPES} ; do
+ if [ ! -d "${ROOT}/var/lib/selinux/${POLICY_TYPE}/active" ] ; then
+ einfo "Migrating store ${POLICY_TYPE} (without policy rebuild)."
+ /usr/libexec/selinux/semanage_migrate_store -n -s "${POLICY_TYPE}" || die "Failed to migrate store ${POLICY_TYPE}"
+ fi
+ done
+}
diff --git a/sys-libs/libsemanage/metadata.xml b/sys-libs/libsemanage/metadata.xml
new file mode 100644
index 000000000000..83c24ee19582
--- /dev/null
+++ b/sys-libs/libsemanage/metadata.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>selinux</herd>
+ <longdescription>SELinux policy management libraries</longdescription>
+ <upstream>
+ <remote-id type="github">SELinuxProject/selinux</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-libs/libsepol/Manifest b/sys-libs/libsepol/Manifest
new file mode 100644
index 000000000000..661c7be45b46
--- /dev/null
+++ b/sys-libs/libsepol/Manifest
@@ -0,0 +1,3 @@
+DIST libsepol-2.2.tar.gz 209622 SHA256 77a4b27006295805bdbd7f240038cb32a49be1d60847d413899501702933fc0f SHA512 96e489eb29f5256fbcb1a522d3738e0c5f05fff55041989c7c26331987abc71d80ed8fdbe228aadb60248869552c5d62fa5721b6218fb093ad027bfb44fac772 WHIRLPOOL 4d1eeaa0e1964461b0b28de9e3d19e38bb28e386413280c8ef45919906c25abaf575a3ecd0f40dce0de82800d34b5e1c3d5060f1e93d0270e5fe3c3105964305
+DIST libsepol-2.3.tar.gz 209570 SHA256 cc8d8642c3b7b95d6928d65dcbca2ab0627abc1c05166637851e63c1a6eae68f SHA512 5155645642f7f09c7e1d17736d7ce1654c973d1feb9401ee67aad0a96f9bd561105b4ab1f564c60362821985023ac523d20ed40da0e5a52973f7984217ad0d03 WHIRLPOOL 15b19d021c4a52cfdae118a7a1ddd7057722286553a0e1dccfe5d92f0b8c5b1291388b8bb8d37b8f5e51fd162f57708746ccde67d0d9ae035506839cf9ba3bc0
+DIST libsepol-2.4.tar.gz 570822 SHA256 299015d59932404c6b69d365fdecffe5c0e2f9c44e08b47286a4bfc02ee49659 SHA512 95d25c90e3447d7b0d3e2ef5a404aed8bd946d7458ccbc57538bb9e9bd0cfa394022171ef4772ae4f1ea2422c0c4bd8c852badd28f79088d131062cee80f53fd WHIRLPOOL 407b7b335cb366e1773975cec843e9ebb6ca31c0ee9c69cd2ac1636efa63e1ee787cec1041f7a5d7fb37177730f20cadd2ed60bdf10f0f6d32e41f85e012ad43
diff --git a/sys-libs/libsepol/libsepol-2.2.ebuild b/sys-libs/libsepol/libsepol-2.2.ebuild
new file mode 100644
index 000000000000..5a722b91cc8e
--- /dev/null
+++ b/sys-libs/libsepol/libsepol-2.2.ebuild
@@ -0,0 +1,46 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit multilib toolchain-funcs eutils multilib-minimal
+
+DESCRIPTION="SELinux binary policy representation library"
+HOMEPAGE="http://userspace.selinuxproject.org"
+SRC_URI="http://userspace.selinuxproject.org/releases/20131030/${P}.tar.gz"
+# http://dev.gentoo.org/~swift/patches/${PN}/patchbundle-${P}-r1.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE=""
+
+DEPEND=""
+RDEPEND=""
+
+# tests are not meant to be run outside of the
+# full SELinux userland repo
+RESTRICT="test"
+
+src_prepare() {
+# EPATCH_MULTI_MSG="Applying libsepol patches ... " \
+# EPATCH_SUFFIX="patch" \
+# EPATCH_SOURCE="${WORKDIR}/gentoo-patches" \
+# EPATCH_FORCE="yes" \
+# epatch
+
+ epatch_user
+ multilib_copy_sources
+}
+
+multilib_src_compile() {
+ tc-export RANLIB;
+ LIBDIR="\$(PREFIX)/$(get_libdir)" SHLIBDIR="\$(DESTDIR)/$(get_libdir)" \
+ emake AR="$(tc-getAR)" CC="$(tc-getCC)"
+}
+
+multilib_src_install() {
+ LIBDIR="\$(PREFIX)/$(get_libdir)" SHLIBDIR="\$(DESTDIR)/$(get_libdir)" \
+ emake DESTDIR="${D}" install
+}
diff --git a/sys-libs/libsepol/libsepol-2.3.ebuild b/sys-libs/libsepol/libsepol-2.3.ebuild
new file mode 100644
index 000000000000..97f1ab458356
--- /dev/null
+++ b/sys-libs/libsepol/libsepol-2.3.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit multilib toolchain-funcs eutils multilib-minimal
+
+MY_P="${P//_/-}"
+
+DESCRIPTION="SELinux binary policy representation library"
+HOMEPAGE="http://userspace.selinuxproject.org"
+SRC_URI="https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/20140506/${MY_P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE=""
+
+DEPEND=""
+RDEPEND=""
+
+S="${WORKDIR}/${MY_P}"
+
+# tests are not meant to be run outside of the
+# full SELinux userland repo
+RESTRICT="test"
+
+src_prepare() {
+# EPATCH_MULTI_MSG="Applying libsepol patches ... " \
+# EPATCH_SUFFIX="patch" \
+# EPATCH_SOURCE="${WORKDIR}/gentoo-patches" \
+# EPATCH_FORCE="yes" \
+# epatch
+
+ epatch_user
+ multilib_copy_sources
+}
+
+multilib_src_compile() {
+ tc-export RANLIB;
+ LIBDIR="\$(PREFIX)/$(get_libdir)" SHLIBDIR="\$(DESTDIR)/$(get_libdir)" \
+ emake AR="$(tc-getAR)" CC="$(tc-getCC)"
+}
+
+multilib_src_install() {
+ LIBDIR="\$(PREFIX)/$(get_libdir)" SHLIBDIR="\$(DESTDIR)/$(get_libdir)" \
+ emake DESTDIR="${D}" install
+}
diff --git a/sys-libs/libsepol/libsepol-2.4.ebuild b/sys-libs/libsepol/libsepol-2.4.ebuild
new file mode 100644
index 000000000000..5f7b16f8e659
--- /dev/null
+++ b/sys-libs/libsepol/libsepol-2.4.ebuild
@@ -0,0 +1,43 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit multilib toolchain-funcs eutils multilib-minimal
+
+MY_P="${P//_/-}"
+
+DESCRIPTION="SELinux binary policy representation library"
+HOMEPAGE="https://github.com/SELinuxProject/selinux/wiki"
+SRC_URI="https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/20150202/${MY_P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE=""
+
+DEPEND=""
+RDEPEND=""
+
+S="${WORKDIR}/${MY_P}"
+
+# tests are not meant to be run outside of the
+# full SELinux userland repo
+RESTRICT="test"
+
+src_prepare() {
+ epatch_user
+ multilib_copy_sources
+}
+
+multilib_src_compile() {
+ tc-export RANLIB;
+ LIBDIR="\$(PREFIX)/$(get_libdir)" SHLIBDIR="\$(DESTDIR)/$(get_libdir)" \
+ emake AR="$(tc-getAR)" CC="$(tc-getCC)"
+}
+
+multilib_src_install() {
+ LIBDIR="\$(PREFIX)/$(get_libdir)" SHLIBDIR="\$(DESTDIR)/$(get_libdir)" \
+ emake DESTDIR="${D}" install
+}
diff --git a/sys-libs/libsepol/libsepol-9999.ebuild b/sys-libs/libsepol/libsepol-9999.ebuild
new file mode 100644
index 000000000000..a3182a615cbd
--- /dev/null
+++ b/sys-libs/libsepol/libsepol-9999.ebuild
@@ -0,0 +1,50 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit multilib toolchain-funcs eutils multilib-minimal
+
+MY_P="${P//_/-}"
+MY_RELEASEDATE="20150202"
+
+DESCRIPTION="SELinux binary policy representation library"
+HOMEPAGE="https://github.com/SELinuxProject/selinux/wiki"
+
+if [[ ${PV} == 9999 ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/SELinuxProject/selinux.git"
+ S="${WORKDIR}/${MY_P}/${PN}"
+else
+ SRC_URI="https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/${MY_RELEASEDATE}/${MY_P}.tar.gz"
+ KEYWORDS="~amd64 ~x86"
+ S="${WORKDIR}/${MY_P}"
+fi
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+DEPEND=""
+RDEPEND=""
+
+# tests are not meant to be run outside of the
+# full SELinux userland repo
+RESTRICT="test"
+
+src_prepare() {
+ epatch_user
+ multilib_copy_sources
+}
+
+multilib_src_compile() {
+ tc-export RANLIB;
+ LIBDIR="\$(PREFIX)/$(get_libdir)" SHLIBDIR="\$(DESTDIR)/$(get_libdir)" \
+ emake AR="$(tc-getAR)" CC="$(tc-getCC)"
+}
+
+multilib_src_install() {
+ LIBDIR="\$(PREFIX)/$(get_libdir)" SHLIBDIR="\$(DESTDIR)/$(get_libdir)" \
+ emake DESTDIR="${D}" install
+}
diff --git a/sys-libs/libsepol/metadata.xml b/sys-libs/libsepol/metadata.xml
new file mode 100644
index 000000000000..a19075f95396
--- /dev/null
+++ b/sys-libs/libsepol/metadata.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>selinux</herd>
+ <longdescription>SELinux library for manipulating binary security policies</longdescription>
+ <upstream>
+ <remote-id type="github">SELinuxProject/selinux</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-libs/libservicelog/Manifest b/sys-libs/libservicelog/Manifest
new file mode 100644
index 000000000000..d3c1da351138
--- /dev/null
+++ b/sys-libs/libservicelog/Manifest
@@ -0,0 +1,3 @@
+DIST libservicelog-1.0.1.tar.gz 673264 SHA256 562d0160da772732002fb749e7f704b5e20ab57a8b73908638afd1a75d8cf944
+DIST libservicelog-1.1.11.tar.gz 905377 SHA256 c371be75e5941b58b8409b9e403bec30bc65a86ffd420e43be755d5d7852b587 SHA512 7706e108573d79e7973bb6004fb987833b04a2896c088fc259a84f17192a6e5fc0e760f59031f1b0b28306a9043534a9fa5690dde099060f9546e046fa8d0f5b WHIRLPOOL 1ba6c249141fff06d2cf62cb7778db51be7902158e402d333bdafaebba94d4552e953d16a0a72e9cbdef70f7e334c817cfde8d872575ecaf98e4423c0cb8fef9
+DIST libservicelog-1.1.15.tar.gz 392259 SHA256 981c85cef132153fde7da0635fd65f487d1f90adf0e929cef54b5ecc9d43230d SHA512 70cdf8340a8b0df39bc5669976feab022917b5884256370281ed3356633100cc9c7e69c6cc1bd0784bfedc65d388d9ecc50f6dd37e6ed19f796bb7f55bb436f7 WHIRLPOOL 4b76babbd98e125c89f757223b70ee83cbc448304caaff6e8f9382466ef3d8c49e378199079fb3427c980314c6a7f8d61033fcd1fecb8befdbff47732e480fa6
diff --git a/sys-libs/libservicelog/files/libservicelog-1.0.1.patch b/sys-libs/libservicelog/files/libservicelog-1.0.1.patch
new file mode 100644
index 000000000000..712421271ed0
--- /dev/null
+++ b/sys-libs/libservicelog/files/libservicelog-1.0.1.patch
@@ -0,0 +1,10 @@
+diff -Naur libservicelog-1.0.1.orig/Makefile.am libservicelog-1.0.1/Makefile.am
+--- libservicelog-1.0.1.orig/Makefile.am 2008-08-16 19:01:37.000000000 -0500
++++ libservicelog-1.0.1/Makefile.am 2008-10-20 19:11:17.000000000 -0500
+@@ -19,5 +19,5 @@
+ library_include_HEADERS = servicelog-1/servicelog.h
+
+ install-exec-hook:
+- install -D --mode=754 --group=service servicelog.db \
++ install -D --mode=754 --group=wheel servicelog.db \
+ ${DESTDIR}/var/lib/servicelog/servicelog.db
diff --git a/sys-libs/libservicelog/files/libservicelog-1.1.11.patch b/sys-libs/libservicelog/files/libservicelog-1.1.11.patch
new file mode 100644
index 000000000000..092ac15482ab
--- /dev/null
+++ b/sys-libs/libservicelog/files/libservicelog-1.1.11.patch
@@ -0,0 +1,9 @@
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -19,5 +19,5 @@
+ library_include_HEADERS = servicelog-1/servicelog.h
+
+ install-exec-hook:
+- install -D --mode=754 --group=service servicelog.db \
++ install -D --mode=754 --group=wheel servicelog.db \
+ ${DESTDIR}/var/lib/servicelog/servicelog.db
diff --git a/sys-libs/libservicelog/libservicelog-1.0.1.ebuild b/sys-libs/libservicelog/libservicelog-1.0.1.ebuild
new file mode 100644
index 000000000000..d8da34a1eeaa
--- /dev/null
+++ b/sys-libs/libservicelog/libservicelog-1.0.1.ebuild
@@ -0,0 +1,33 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils autotools
+
+DESCRIPTION="Provides a library for logging service-related events"
+SRC_URI="mirror://sourceforge/linux-diag/${P}.tar.gz"
+HOMEPAGE="http://linux-diag.sourceforge.net/servicelog/"
+
+SLOT="0"
+LICENSE="IBM"
+KEYWORDS="ppc ppc64"
+IUSE=""
+
+DEPEND="dev-db/sqlite"
+
+RDEPEND="${DEPEND}
+ virtual/logger"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+
+ epatch "${FILESDIR}"/libservicelog-1.0.1.patch
+
+ eautoreconf
+}
+
+src_install () {
+ emake install DESTDIR="${D}" || die
+ dodoc ChangeLog || die
+}
diff --git a/sys-libs/libservicelog/libservicelog-1.1.11.ebuild b/sys-libs/libservicelog/libservicelog-1.1.11.ebuild
new file mode 100644
index 000000000000..4bec780a22d1
--- /dev/null
+++ b/sys-libs/libservicelog/libservicelog-1.1.11.ebuild
@@ -0,0 +1,33 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils autotools
+
+DESCRIPTION="Provides a library for logging service-related events"
+SRC_URI="mirror://sourceforge/linux-diag/${P}.tar.gz"
+HOMEPAGE="http://linux-diag.sourceforge.net/servicelog/"
+
+SLOT="0"
+LICENSE="IBM"
+KEYWORDS="~ppc ~ppc64"
+IUSE=""
+
+DEPEND="dev-db/sqlite"
+
+RDEPEND="${DEPEND}
+ virtual/logger"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+
+ epatch "${FILESDIR}"/${P}.patch
+
+ eautoreconf
+}
+
+src_install () {
+ emake install DESTDIR="${D}" || die
+ dodoc ChangeLog || die
+}
diff --git a/sys-libs/libservicelog/libservicelog-1.1.15.ebuild b/sys-libs/libservicelog/libservicelog-1.1.15.ebuild
new file mode 100644
index 000000000000..02174fede2a6
--- /dev/null
+++ b/sys-libs/libservicelog/libservicelog-1.1.15.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils
+
+DESCRIPTION="Provides a library for logging service-related events"
+SRC_URI="mirror://sourceforge/linux-diag/${P}.tar.gz"
+HOMEPAGE="http://linux-diag.sourceforge.net/servicelog/"
+
+SLOT="0"
+LICENSE="IBM"
+KEYWORDS="~ppc ~ppc64"
+IUSE="static-libs"
+
+DEPEND="
+ dev-db/sqlite:=
+ sys-libs/librtas
+"
+RDEPEND="
+ ${DEPEND}
+ virtual/logger
+"
+
+DOCS=( ChangeLog )
+
+src_configure() {
+ econf $(use_enable static-libs static)
+}
+
+src_install() {
+ default
+ prune_libtool_files
+}
diff --git a/sys-libs/libservicelog/metadata.xml b/sys-libs/libservicelog/metadata.xml
new file mode 100644
index 000000000000..09b995174c26
--- /dev/null
+++ b/sys-libs/libservicelog/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>ppc64</herd>
+ <upstream>
+ <remote-id type="sourceforge">linux-diag</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-libs/libsmbios/Manifest b/sys-libs/libsmbios/Manifest
new file mode 100644
index 000000000000..1b9dd9031b0c
--- /dev/null
+++ b/sys-libs/libsmbios/Manifest
@@ -0,0 +1 @@
+DIST libsmbios-2.2.28.tar.bz2 943292 SHA256 dd247fd43296df3352435b090dd789a22a89c4b316e98b46b915323290a3e350 SHA512 64477adb4cc647613c682d8ff30ced0c951bc83d4cfc696dc343690fb37155e53b0c8c338c7c66822f3b91480fadaf5f70eee6b1ec33371c623213ea07d2b78f WHIRLPOOL e0427e406426705163614f76ac460fa1778b94ad9ce180f606cdf02ff037ee29275830e48065e8a883a19ebe314cc77eabf3cf6a4f9f5c8d5d0b2372486d64ac
diff --git a/sys-libs/libsmbios/files/libsmbios-2.2.28-cppunit-tests.patch b/sys-libs/libsmbios/files/libsmbios-2.2.28-cppunit-tests.patch
new file mode 100644
index 000000000000..61f392787213
--- /dev/null
+++ b/sys-libs/libsmbios/files/libsmbios-2.2.28-cppunit-tests.patch
@@ -0,0 +1,11 @@
+diff -Naur libsmbios-2.2.28/src/libsmbios_c/smi/smi_linux.c libsmbios-2.2.28.new/src/libsmbios_c/smi/smi_linux.c
+--- libsmbios-2.2.28/src/libsmbios_c/smi/smi_linux.c 2010-06-11 11:31:01.000000000 -0400
++++ libsmbios-2.2.28.new/src/libsmbios_c/smi/smi_linux.c 2012-06-21 14:57:15.000000000 -0400
+@@ -48,6 +48,7 @@
+ #define bufsize 256
+
+ // not in header file. for private use by unit tests.
++LIBSMBIOS_C_DLL_SPEC void set_basedir(const char *); // needed to link tests
+ void set_basedir(const char *newdir)
+ {
+ sysfs_basedir = newdir;
diff --git a/sys-libs/libsmbios/files/libsmbios-2.2.28-gcc46.patch b/sys-libs/libsmbios/files/libsmbios-2.2.28-gcc46.patch
new file mode 100644
index 000000000000..0532e01b4363
--- /dev/null
+++ b/sys-libs/libsmbios/files/libsmbios-2.2.28-gcc46.patch
@@ -0,0 +1,11 @@
+--- libsmbios-2.2.28/src/include/smbios/config/compiler/gcc.hpp
++++ libsmbios-2.2.28/src/include/smbios/config/compiler/gcc.hpp
+@@ -113,7 +113,7 @@
+ # error "Compiler not configured - please reconfigure"
+ #endif
+ //
+-#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5))
++#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 7))
+ # if defined(LIBSMBIOS_ASSERT_CONFIG)
+ # error "Unknown compiler version - please run the configure tests and report the results"
+ # else
diff --git a/sys-libs/libsmbios/files/libsmbios-fix-pie.patch b/sys-libs/libsmbios/files/libsmbios-fix-pie.patch
new file mode 100644
index 000000000000..9162044169e2
--- /dev/null
+++ b/sys-libs/libsmbios/files/libsmbios-fix-pie.patch
@@ -0,0 +1,30 @@
+diff -Naur libsmbios-2.2.19.orig/src/bin/dellMediaDirectCtl.cpp libsmbios-2.2.19/src/bin/dellMediaDirectCtl.cpp
+--- libsmbios-2.2.19.orig/src/bin/dellMediaDirectCtl.cpp 2009-02-26 14:29:03.000000000 +0000
++++ libsmbios-2.2.19/src/bin/dellMediaDirectCtl.cpp 2011-01-20 06:55:48.000000000 +0000
+@@ -183,16 +183,21 @@
+ {
+ iopl(3);
+
++ u32 tmpebx;
+ __asm__ __volatile__ (
+- // magic port
+- "outb %%al, %%dx \n\t"
+-
++ "movl %%ebx,%[tmpebx]\n\t"
++ "movl %[ebx],%%ebx\n\t"
++ // magic port
++ "outb %%al, %%dx \n\t"
++ "movl %%ebx,%[ebx]\n\t"
++ "movl %[tmpebx],%%ebx\n\t"
+ : /* output args */
+ "=a" (r->eax),
+- "=b" (r->ebx),
++ [ebx] "=rm" (r->ebx),
+ "=c" (r->ecx),
+ "=S" (r->esi),
+- "=D" (r->edi)
++ "=D" (r->edi),
++ [tmpebx] "+m" (tmpebx)
+ : /* input args */
+ "0" (r->eax),
+ "1" (r->ebx),
diff --git a/sys-libs/libsmbios/libsmbios-2.2.28.ebuild b/sys-libs/libsmbios/libsmbios-2.2.28.ebuild
new file mode 100644
index 000000000000..e3eb600c3514
--- /dev/null
+++ b/sys-libs/libsmbios/libsmbios-2.2.28.ebuild
@@ -0,0 +1,79 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+PYTHON_COMPAT=( python2_7 )
+
+inherit eutils python-single-r1 flag-o-matic autotools
+
+DESCRIPTION="Provide access to (SM)BIOS information"
+HOMEPAGE="http://linux.dell.com/libsmbios/main/index.html"
+SRC_URI="http://linux.dell.com/libsmbios/download/libsmbios/${P}/${P}.tar.bz2"
+
+LICENSE="GPL-2 OSL-2.0"
+SLOT="0"
+KEYWORDS="amd64 ia64 x86"
+IUSE="doc graphviz nls python static-libs test"
+
+RDEPEND="dev-libs/libxml2
+ sys-libs/zlib
+ nls? ( virtual/libintl )
+ python? ( ${PYTHON_DEPS} )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ doc? ( app-doc/doxygen )
+ graphviz? ( media-gfx/graphviz )
+ nls? ( sys-devel/gettext )
+ test? ( >=dev-util/cppunit-1.9.6 )"
+
+pkg_setup() {
+ use python && python-single-r1_pkg_setup
+}
+
+src_prepare() {
+ epatch \
+ "${FILESDIR}"/${PN}-2.2.28-gcc46.patch \
+ "${FILESDIR}"/${PN}-fix-pie.patch \
+ "${FILESDIR}"/${PN}-2.2.28-cppunit-tests.patch
+
+ >pkg/py-compile
+
+ # dist-lzma was removed from automake-1.12 (bug #422779)
+ sed 's@dist-lzma@dist-xz@' -i "${S}"/configure.ac || die
+
+ eautoreconf
+}
+
+src_configure() {
+ #Remove -O3 for bug #290097
+ replace-flags -O3 -O2
+
+ econf \
+ $(use_enable doc doxygen) \
+ $(use_enable graphviz) \
+ $(use_enable nls) \
+ $(use_enable python) \
+ $(use_enable static-libs static)
+}
+
+src_install() {
+ emake install DESTDIR="${D}"
+
+ rm -rf "${D}etc/yum"
+ rm -rf "${D}usr/lib/yum-plugins"
+ if ! use python ; then
+ rmdir "${D}libsmbios_c" "${D}usr/share/smbios-utils"
+ rm -rf "${D}etc"
+ else
+ local python_scriptroot="/usr/sbin"
+ python_doscript "${D}"/usr/sbin/smbios-{lcd-brightness,passwd,rbu-bios-update,sys-info,token-ctl,wakeup-ctl,wireless-ctl}
+ fi
+
+ insinto /usr/include/
+ doins -r src/include/smbios/
+
+ dodoc AUTHORS ChangeLog NEWS README TODO
+
+ use static-libs || prune_libtool_files --all
+}
diff --git a/sys-libs/libsmbios/metadata.xml b/sys-libs/libsmbios/metadata.xml
new file mode 100644
index 000000000000..560c25a05c27
--- /dev/null
+++ b/sys-libs/libsmbios/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer>
+ <email>polynomial-c@gentoo.org</email>
+ <name>Lars Wendler</name>
+</maintainer>
+<longdescription>The libsmbios project aims towards providing access to as much
+BIOS information as possible. It does this by providing a library of functions
+that can be used as well as sample binaries.</longdescription>
+</pkgmetadata>
diff --git a/sys-libs/libspe2/Manifest b/sys-libs/libspe2/Manifest
new file mode 100644
index 000000000000..831e99813aab
--- /dev/null
+++ b/sys-libs/libspe2/Manifest
@@ -0,0 +1,2 @@
+DIST libspe2-2.2.80-95.tar.gz 153122 SHA256 a8160fb41faa83247ffe132a25502fdd2237427a55ed3a22344058f3dc5e2a44
+DIST libspe2-2.3.0.135.tar.gz 197848 SHA256 35b26c2f478feabce9b94ecca2b28726b462e29578aa49f38fb104f8ecf2d23a
diff --git a/sys-libs/libspe2/files/spe.rc6 b/sys-libs/libspe2/files/spe.rc6
new file mode 100644
index 000000000000..33fc72fdbe9f
--- /dev/null
+++ b/sys-libs/libspe2/files/spe.rc6
@@ -0,0 +1,39 @@
+#!/sbin/runscript
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+depend() {
+ # you need the elfspe bin
+ need localmount
+}
+
+start() {
+ ebegin "Registering elfspe to binfmt"
+
+ if test -f /proc/sys/fs/binfmt_misc/spe
+ then
+ eerror "elfspe already registered"
+ return 1
+ else
+ if test -f /proc/sys/fs/binfmt_misc/register
+ then
+ echo ':spe:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x17::/usr/bin/elfspe:' >/proc/sys/fs/binfmt_misc/register
+ eend $?
+ else
+ eerror "binfmt not available"
+ return 1
+ fi
+ fi
+}
+
+stop() {
+ if ! test -f /proc/sys/fs/binfmt_misc/spe
+ then
+ eerror "elfspe not present"
+ return 1
+ else
+ echo -1 > /proc/sys/fs/binfmt_misc/spe
+ eend $?
+ fi
+}
diff --git a/sys-libs/libspe2/libspe2-2.2.80_p95-r1.ebuild b/sys-libs/libspe2/libspe2-2.2.80_p95-r1.ebuild
new file mode 100644
index 000000000000..8d8384a4dda6
--- /dev/null
+++ b/sys-libs/libspe2/libspe2-2.2.80_p95-r1.ebuild
@@ -0,0 +1,67 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+inherit eutils
+
+MY_P=${P/_p/-}
+
+DESCRIPTION="A wrapper library to adapt the JSRE SPU usage model to SPUFS"
+HOMEPAGE="http://sourceforge.net/projects/libspe"
+SRC_URI="mirror://sourceforge/libspe/${MY_P}.tar.gz"
+
+LICENSE="LGPL-2"
+SLOT="0"
+KEYWORDS="ppc ppc64"
+IUSE="debug"
+
+S="${WORKDIR}/${P//_p*}"
+
+DEPEND=""
+# This packages also provides libspe1
+RDEPEND="!sys-libs/libspe"
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ SYSROOT=""
+else
+ SYSROOT="/usr/${CTARGET}"
+fi
+
+src_unpack () {
+ unpack ${A}
+ #just in case something is missing
+ cd "${S}"
+}
+
+src_compile() {
+ myconf=""
+ use debug && myconf="${myconf} DEBUG=1"
+ make all elfspe-all CROSS="${CTARGET}-" \
+ prefix=/usr SYSROOT="$SYSROOT" ${myconf} \
+ speinclude=/usr/spu-elf/include || die
+}
+
+src_install() {
+ make CROSS="${CTARGET}-" prefix=/usr \
+ speinclude=/usr/spu-elf/include \
+ SYSROOT="$SYSROOT" \
+ DESTDIR="$D" install elfspe-install || die
+ newinitd "${FILESDIR}/spe.rc6" elfspe
+}
+
+pkg_postinst() {
+ einfo "You may want to register elfspe to binfmt using the"
+ einfo "provided initscript"
+ einfo "# rc-update add elfspe boot"
+ ewarn "make sure your fstab contains the following line"
+ ewarn "none /spu spufs defaults
+ 0 0"
+ ewarn "and that you have spufs support enabled in the kernel"
+}
diff --git a/sys-libs/libspe2/libspe2-2.3.0_p135.ebuild b/sys-libs/libspe2/libspe2-2.3.0_p135.ebuild
new file mode 100644
index 000000000000..cf010518d118
--- /dev/null
+++ b/sys-libs/libspe2/libspe2-2.3.0_p135.ebuild
@@ -0,0 +1,68 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+inherit eutils
+
+MY_P=${P/_p/.}
+
+DESCRIPTION="A wrapper library to adapt the JSRE SPU usage model to SPUFS"
+HOMEPAGE="http://sourceforge.net/projects/libspe"
+SRC_URI="mirror://sourceforge/libspe/${MY_P}.tar.gz"
+
+LICENSE="LGPL-2"
+SLOT="0"
+KEYWORDS="~ppc ~ppc64"
+IUSE="debug"
+
+S="${WORKDIR}/${P/_p*//}"
+
+DEPEND=""
+# This packages also provides libspe1
+RDEPEND="!sys-libs/libspe"
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ SYSROOT=""
+else
+ SYSROOT="/usr/${CTARGET}"
+fi
+
+src_unpack () {
+ unpack ${A}
+ #just in case something is missing
+ cd "${S}"
+ echo "${S}"
+}
+
+src_compile() {
+ myconf=""
+ use debug && myconf="${myconf} DEBUG=1"
+ make all elfspe-all CROSS="${CTARGET}-" \
+ prefix=/usr SYSROOT="$SYSROOT" ${myconf} \
+ speinclude=/usr/spu-elf/include || die
+}
+
+src_install() {
+ make CROSS="${CTARGET}-" prefix=/usr \
+ speinclude=/usr/spu-elf/include \
+ SYSROOT="$SYSROOT" \
+ DESTDIR="$D" install elfspe-install || die
+ newinitd "${FILESDIR}/spe.rc6" elfspe
+}
+
+pkg_postinst() {
+ einfo "You may want to register elfspe to binfmt using the"
+ einfo "provided initscript"
+ einfo "# rc-update add elfspe boot"
+ ewarn "make sure your fstab contains the following line"
+ ewarn "none /spu spufs defaults
+ 0 0"
+ ewarn "and that you have spufs support enabled in the kernel"
+}
diff --git a/sys-libs/libspe2/metadata.xml b/sys-libs/libspe2/metadata.xml
new file mode 100644
index 000000000000..16fed8ff6fb6
--- /dev/null
+++ b/sys-libs/libspe2/metadata.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>lu_zero@gentoo.org</email>
+ </maintainer>
+ <upstream>
+ <remote-id type="sourceforge">libspe</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-libs/libstatgrab/Manifest b/sys-libs/libstatgrab/Manifest
new file mode 100644
index 000000000000..5b795f9c6632
--- /dev/null
+++ b/sys-libs/libstatgrab/Manifest
@@ -0,0 +1,2 @@
+DIST libstatgrab-0.17.tar.gz 463224 SHA256 bbaa88c6bde8bd3cf2720b81a26528cc055a7e83e4ea3bdb1d0a3c4287cceb88 SHA512 feb8d8aa345d57a9036700d580a7d1e21aed9bb2063b46b2c57a59fce00eb20a22590e5e391c8a9a1f43055c14a6ce3fcf648b98f1fec3b4efd270455a2933e3 WHIRLPOOL fb317f471a2669389c4b3a8267d609a54c09d34c87c86ae833fe5bdb06619e895ed7224272238fc8449f573da8e4e4eda31affaea39a09e83bd85fa0c754f02b
+DIST libstatgrab-0.91.tar.gz 776046 SHA256 03e9328e4857c2c9dcc1b0347724ae4cd741a72ee11acc991784e8ef45b7f1ab SHA512 f360f2e1b185bf9603b1d9c50649b0050e9502128ff81a9f4de88457e2f5203deafe7fd7ac13ebc4cc56e6ecd1bdf8aacae64987bdf36af0c9929e30626915f6 WHIRLPOOL 185f895093e1a91204acf856847ee5dd3f1da7d3b25fb6987d8a30ec1b962ada0168b84f032b3f9974942ac41643c1ad12cee1b1b797faca5fe806d21a491048
diff --git a/sys-libs/libstatgrab/files/libstatgrab-0.91-tinfo.patch b/sys-libs/libstatgrab/files/libstatgrab-0.91-tinfo.patch
new file mode 100644
index 000000000000..b0eb94cbcd8e
--- /dev/null
+++ b/sys-libs/libstatgrab/files/libstatgrab-0.91-tinfo.patch
@@ -0,0 +1,43 @@
+--- a/m4/ax_ncurses.m4
++++ b/m4/ax_ncurses.m4
+@@ -12,24 +12,31 @@
+
+ AS_IF([test "x$with_ncurses" != "xno"], [
+ AC_CACHE_CHECK([for working ncurses], mp_cv_ncurses, [
+- LIBS="$mp_save_LIBS $SAIDARLIBS -lncurses"
++ LIBS="$mp_save_LIBS $SAIDARLIBS -lncurses -ltinfo"
+ CPPFLAGS="$mp_save_CPPFLAGS $SAIDARCPPFLAGS"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <ncurses.h>], [testcode])], [
+ mp_cv_ncurses="ncurses.h"
+- CURSES_LIB="-lncurses"
++ CURSES_LIB="-lncurses -ltinfo"
+ ], [
+ LIBS="$mp_save_LIBS $SAIDARLIBS -lncurses"
+ CPPFLAGS="$mp_save_CPPFLAGS $SAIDARCPPFLAGS"
+- AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <ncurses/ncurses.h>], [testcode])], [
+- mp_cv_ncurses="ncurses/ncurses.h"
++ AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <ncurses.h>], [testcode])], [
++ mp_cv_ncurses="ncurses.h"
+ CURSES_LIB="-lncurses"
+ ], [
+- LIBS="$mp_save_LIBS $SAIDARLIBS -lcurses"
++ LIBS="$mp_save_LIBS $SAIDARLIBS -lncurses"
+ CPPFLAGS="$mp_save_CPPFLAGS $SAIDARCPPFLAGS"
+- AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <curses.h>], [testcode])], [
+- mp_cv_ncurses="curses.h"
+- CURSES_LIB="-lcurses"
+- ], [mp_cv_ncurses=no])
++ AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <ncurses/ncurses.h>], [testcode])], [
++ mp_cv_ncurses="ncurses/ncurses.h"
++ CURSES_LIB="-lncurses"
++ ], [
++ LIBS="$mp_save_LIBS $SAIDARLIBS -lcurses"
++ CPPFLAGS="$mp_save_CPPFLAGS $SAIDARCPPFLAGS"
++ AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <curses.h>], [testcode])], [
++ mp_cv_ncurses="curses.h"
++ CURSES_LIB="-lcurses"
++ ], [mp_cv_ncurses=no])
++ ])
+ ])
+ ])
+ ])
diff --git a/sys-libs/libstatgrab/libstatgrab-0.17.ebuild b/sys-libs/libstatgrab/libstatgrab-0.17.ebuild
new file mode 100644
index 000000000000..70a92ccdbc00
--- /dev/null
+++ b/sys-libs/libstatgrab/libstatgrab-0.17.ebuild
@@ -0,0 +1,32 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit autotools-utils
+
+DESCRIPTION="A tool to provide access to statistics about the system on which it's run"
+HOMEPAGE="http://www.i-scream.org/libstatgrab/"
+SRC_URI="http://www.mirrorservice.org/sites/ftp.i-scream.org/pub/i-scream/libstatgrab/${P}.tar.gz"
+
+LICENSE="|| ( GPL-2 LGPL-2.1 )"
+SLOT=0
+KEYWORDS="amd64 ~arm ~ia64 ppc x86"
+IUSE="static-libs"
+
+RDEPEND="sys-libs/ncurses"
+DEPEND="${RDEPEND}"
+
+DOCS=( ChangeLog PLATFORMS NEWS AUTHORS README )
+
+src_configure() {
+ local myeconfargs=(
+ --disable-setgid-binaries
+ --disable-setuid-binaries
+ --disable-deprecated
+ --with-ncurses
+ $(use_enable static-libs static)
+ )
+ autotools-utils_src_configure
+}
diff --git a/sys-libs/libstatgrab/libstatgrab-0.91.ebuild b/sys-libs/libstatgrab/libstatgrab-0.91.ebuild
new file mode 100644
index 000000000000..4fb5ebcddd45
--- /dev/null
+++ b/sys-libs/libstatgrab/libstatgrab-0.91.ebuild
@@ -0,0 +1,43 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+AUTOTOOLS_AUTORECONF=frob
+inherit autotools-utils
+
+DESCRIPTION="A tool to provide access to statistics about the system on which it's run"
+HOMEPAGE="http://www.i-scream.org/libstatgrab/"
+SRC_URI="http://www.mirrorservice.org/sites/ftp.i-scream.org/pub/i-scream/libstatgrab/${P}.tar.gz"
+
+LICENSE="|| ( GPL-2 LGPL-2.1 )"
+SLOT=0
+KEYWORDS="~amd64 ~arm ~ia64 ~ppc ~x86"
+IUSE="doc examples static-libs"
+
+RDEPEND="sys-libs/ncurses"
+DEPEND="${RDEPEND}"
+
+DOCS=( ChangeLog PLATFORMS NEWS AUTHORS README )
+
+PATCHES=( "${FILESDIR}"/${P}-tinfo.patch )
+
+src_configure() {
+ local myeconfargs=(
+ --disable-setgid-binaries
+ --disable-setuid-binaries
+ --with-ncurses
+ $(use_enable static-libs static)
+ )
+ autotools-utils_src_configure
+}
+
+src_install() {
+ autotools-utils_src_install
+ if use examples; then
+ docompress -x /usr/share/doc/${PF}/examples
+ insinto /usr/share/doc/${PF}/examples
+ doins -r examples/*
+ fi
+}
diff --git a/sys-libs/libstatgrab/metadata.xml b/sys-libs/libstatgrab/metadata.xml
new file mode 100644
index 000000000000..91f4e72fb544
--- /dev/null
+++ b/sys-libs/libstatgrab/metadata.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>maintainer-needed@gentoo.org</email>
+ </maintainer>
+</pkgmetadata>
diff --git a/sys-libs/libstdc++-v3-bin/Manifest b/sys-libs/libstdc++-v3-bin/Manifest
new file mode 100644
index 000000000000..796c0680dbb0
--- /dev/null
+++ b/sys-libs/libstdc++-v3-bin/Manifest
@@ -0,0 +1,2 @@
+DIST libstdc++-v3-bin-ia64-3.3.6.tbz2 325449 RMD160 05a18434a115d1f6191fed65d0907511fea9d661 SHA1 636d8020274dd7b4aa0af10f1fe81b153c645ed8 SHA256 280bd169f7c2608cf102d296be70a71d0d2d20812c2b35c03d17ca11e841708c
+DIST libstdc++-v3-bin-ppc64-3.3.6.tbz2 301670 RMD160 0018f9645049128491edcd344a0662dee13828b6 SHA1 65550069c5e793b740e92d1ce270536fa0ca5626 SHA256 b0e62a415f57e8870049fa6ca4f8d56aed6fd2359782b178d0e9fd1c5ae9d1a1
diff --git a/sys-libs/libstdc++-v3-bin/libstdc++-v3-bin-3.3.6.ebuild b/sys-libs/libstdc++-v3-bin/libstdc++-v3-bin-3.3.6.ebuild
new file mode 100644
index 000000000000..f484cb9863a8
--- /dev/null
+++ b/sys-libs/libstdc++-v3-bin/libstdc++-v3-bin-3.3.6.ebuild
@@ -0,0 +1,22 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+DESCRIPTION="Compatibility package for running binaries linked against a pre gcc 3.4 libstdc++"
+HOMEPAGE="http://gcc.gnu.org/libstdc++/"
+SRC_URI="ia64? ( mirror://gentoo/${PN}-ia64-${PV}.tbz2 )
+ ppc64? ( mirror://gentoo/${PN}-ppc64-${PV}.tbz2 )"
+
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="0"
+KEYWORDS="ia64 ppc64"
+IUSE=""
+
+DEPEND=""
+RDEPEND="sys-libs/glibc"
+
+RESTRICT="strip"
+
+src_install() {
+ cp -pPR "${WORKDIR}"/* "${D}"/ || die "copying files failed!"
+}
diff --git a/sys-libs/libstdc++-v3-bin/metadata.xml b/sys-libs/libstdc++-v3-bin/metadata.xml
new file mode 100644
index 000000000000..034c09eb248a
--- /dev/null
+++ b/sys-libs/libstdc++-v3-bin/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>ppc</herd>
+</pkgmetadata>
diff --git a/sys-libs/libstdc++-v3/Manifest b/sys-libs/libstdc++-v3/Manifest
new file mode 100644
index 000000000000..ee4212437abe
--- /dev/null
+++ b/sys-libs/libstdc++-v3/Manifest
@@ -0,0 +1,3 @@
+DIST gcc-3.3.6-patches-1.6.tar.bz2 48814 SHA256 c692f8f00d16947e13dd86ca974e419c35d1befee9ee915fa6c50a741487ef63 SHA512 d40fbabbb7ed9ecc660f191bea1f56dd607a7aa978ecb4cb57b2fcc0dc3c57e6f3bda33ae012ab0f119615097c54651b8b8efe06ba252327ffb8affebab07af2 WHIRLPOOL 821003faa9953e8443a37e07fc5b5e04fe538fd79873b68ce413db151037de08e77558ca0751155248183af183e3e698bcba25efa4598dbb812973143888bb81
+DIST gcc-3.3.6-patches-1.9.tar.bz2 51760 SHA256 9759a4dc139c9c739a179fdabff484c8b2d036707f0be03ca54fdb7f7d4ffdb4 SHA512 306220c537c5cd90af7638431e6547ee9a80199c384629b5fbda06c28b2d6168fcf1dd448c0e178b104f41e03a8ebda4f389489d205b9e66ade6637e4747196c WHIRLPOOL 0a49ae8fe42f24c8c0e1a9d7671c462219e501bbe2fb27c78a723889cb084632899403d78230e7618899d2cb639bdeada0d5c577949a87c1d249891cd22a5b01
+DIST gcc-3.3.6.tar.bz2 23972413 SHA256 1c1aa533c67e9da5e55ed4f5736258dc753466bd716bdae3fb88fb66e6ff1d7f SHA512 576b88e2fa675314a79a85f180684fe5af370c596476a0bf02e33e8ae0e2be838417ea80675ce4194a8213792cf7ada50cae5131149e4b890ab61e0b8d50d0ed WHIRLPOOL 27372f9d12cdedaad38e75c3efea3430d6873d92f85ec0024e2cc5ad986c710ed940edecc926a4c25ce14d14cddc1aec3eb35ac2c29e8c85309685d525a99cf1
diff --git a/sys-libs/libstdc++-v3/libstdc++-v3-3.3.6-r1.ebuild b/sys-libs/libstdc++-v3/libstdc++-v3-3.3.6-r1.ebuild
new file mode 100644
index 000000000000..3d36f044f887
--- /dev/null
+++ b/sys-libs/libstdc++-v3/libstdc++-v3-3.3.6-r1.ebuild
@@ -0,0 +1,182 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils flag-o-matic libtool multilib
+
+transform_known_flags() {
+ declare setting
+
+ # and on x86, we just need to filter the 3.4 specific amd64 -marchs
+ replace-cpu-flags k8 athlon64 opteron x86-64
+
+ # gcc 3.3 doesn't support -march=pentium-m
+ replace-cpu-flags pentium-m pentium3m pentium3
+
+ #GCC 3.3 does not understand G3, G4, G5 on ppc
+ replace-cpu-flags G3 750
+ replace-cpu-flags G4 7400
+ replace-cpu-flags G5 7400
+}
+
+is_arch_allowed() {
+ i386_processor_table="i386 i486 i586 pentium pentium-mmx winchip-c6 \
+ winchip2 c3 i686 pentiumpro pentium2 pentium3 pentium4 prescott \
+ nocona k6 k6-2 k6-3 athlon athlon-tbird x86-64 athlon-4 athlon-xp \
+ athlon-mp"
+
+ for proc in ${i386_processor_table} ; do
+ [ "${proc}" == "${1}" ] && return 0
+ done
+
+ mips_processor_table="mips1 mips2 mips3 mips4 mips32 mips64 r3000 r2000 \
+ r3900 r6000 r4000 vr4100 vr4111 vr4120 vr4300 r4400 r4600 orion \
+ r4650 r8000 vr5000 vr5400 vr5500 4kc 4kp 5kc 20kc sr71000 sb1"
+
+ for proc in ${mips_processor_table} ; do
+ [ "${proc}" == "${1}" ] && return 0
+ done
+
+ rs6000_processor_table="common power power2 power3 power4 powerpc \
+ powerpc64 rios rios1 rsc rsc1 rios2 rs64a 401 403 405 505 601 602 \
+ 603 603e ec603e 604 604e 620 630 740 750 7400 7450 8540 801 821 823 \
+ 860"
+
+ for proc in ${rs6000_processor_table} ; do
+ [ "${proc}" == "${1}" ] && return 0
+ done
+
+ return 1
+}
+
+do_filter_flags() {
+ declare setting
+
+ # In general gcc does not like optimization, and add -O2 where
+ # it is safe. This is especially true for gcc 3.3 + 3.4
+ replace-flags -O? -O2
+
+ # gcc 3.3 doesn't support -mtune on numerous archs, so xgcc will fail
+ setting="`get-flag mtune`"
+ [ ! -z "${setting}" ] && filter-flags -mtune="${setting}"
+
+ # in gcc 3.3 there is a bug on ppc64 where if -mcpu is used
+ # the compiler incorrectly assumes the code you are about to build
+ # is 32 bit
+ use ppc64 && setting="`get-flag mcpu`"
+ [ ! -z "${setting}" ] && filter-flags -mcpu="${setting}"
+
+ # only allow the flags that we -know- are supported
+ transform_known_flags
+ setting="`get-flag march`"
+ if [ ! -z "${setting}" ] ; then
+ is_arch_allowed "${setting}" || filter-flags -march="${setting}"
+ fi
+ setting="`get-flag mcpu`"
+ if [ ! -z "${setting}" ] ; then
+ is_arch_allowed "${setting}" || filter-flags -mcpu="${setting}"
+ fi
+
+ # xgcc wont understand gcc 3.4 flags...
+ filter-flags -fno-unit-at-a-time
+ filter-flags -funit-at-a-time
+ filter-flags -fweb
+ filter-flags -fno-web
+ filter-flags -mno-tls-direct-seg-refs
+
+ # xgcc isnt patched with propolice
+ filter-flags -fstack-protector-all
+ filter-flags -fno-stack-protector-all
+ filter-flags -fstack-protector
+ filter-flags -fno-stack-protector
+
+ # xgcc isnt patched with the gcc symbol visibility patch
+ filter-flags -fvisibility-inlines-hidden
+ filter-flags -fvisibility=hidden
+
+ # Bug #269433 & #290202
+ filter-flags -fno-strict-overflow
+ filter-flags -fstrict-overflow
+
+ # Bug #442784
+ filter-flags '-W*'
+
+ filter-flags -frecord-gcc-switches
+
+ # ...sure, why not?
+ strip-unsupported-flags
+
+ strip-flags
+}
+
+PATCH_VER="1.9"
+
+DESCRIPTION="Compatibility package for running binaries linked against a pre gcc 3.4 libstdc++"
+HOMEPAGE="http://gcc.gnu.org/libstdc++/"
+SRC_URI="ftp://gcc.gnu.org/pub/gcc/releases/gcc-${PV}/gcc-${PV}.tar.bz2
+ mirror://gentoo/gcc-${PV}-patches-${PATCH_VER}.tar.bz2"
+
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="5"
+KEYWORDS="amd64 ~mips ppc -ppc64 sparc x86 ~x86-fbsd"
+IUSE="multilib nls"
+
+DEPEND="sys-devel/bison"
+RDEPEND=""
+
+S=${WORKDIR}/gcc-${PV}
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/patch
+ elibtoolize --portage --shallow
+ ./contrib/gcc_update --touch
+ mkdir -p "${WORKDIR}"/build
+
+ if use multilib && [[ ${SYMLINK_LIB} == "yes" ]] ; then
+ # ugh, this shit has to match the way we've hacked gcc else
+ # the build falls apart #259215
+ sed -i \
+ -e 's:\(MULTILIB_OSDIRNAMES = \).*:\1../lib64 ../lib32:' \
+ "${S}"/gcc/config/i386/t-linux64 \
+ || die "sed failed!"
+ fi
+}
+
+src_compile() {
+ cd "${WORKDIR}"/build
+ do_filter_flags
+ ECONF_SOURCE=${S} \
+ econf \
+ --enable-shared \
+ --with-system-zlib \
+ --enable-languages=c++ \
+ --enable-threads=posix \
+ --enable-long-long \
+ --disable-checking \
+ --enable-cstdio=stdio \
+ --enable-__cxa_atexit \
+ $(use_enable multilib) \
+ $(use_enable nls) \
+ $(use_with !nls included-gettext)
+
+ touch "${S}"/gcc/c-gperf.h
+
+ emake all-target-libstdc++-v3 || die
+}
+
+src_install() {
+ emake -j1 \
+ -C "${WORKDIR}"/build \
+ DESTDIR="${D}" \
+ install-target-libstdc++-v3 || die
+
+ # scrub everything but the library we care about
+ pushd "${D}" >/dev/null
+ mv usr/lib* . || die
+ rm -rf usr
+ rm -f lib*/*.{a,la,so} || die
+ dodir /usr
+ mv lib* usr/ || die
+}
diff --git a/sys-libs/libstdc++-v3/libstdc++-v3-3.3.6.ebuild b/sys-libs/libstdc++-v3/libstdc++-v3-3.3.6.ebuild
new file mode 100644
index 000000000000..695085bb92b2
--- /dev/null
+++ b/sys-libs/libstdc++-v3/libstdc++-v3-3.3.6.ebuild
@@ -0,0 +1,178 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils flag-o-matic libtool multilib
+
+transform_known_flags() {
+ declare setting
+
+ # and on x86, we just need to filter the 3.4 specific amd64 -marchs
+ replace-cpu-flags k8 athlon64 opteron x86-64
+
+ # gcc 3.3 doesn't support -march=pentium-m
+ replace-cpu-flags pentium-m pentium3m pentium3
+
+ #GCC 3.3 does not understand G3, G4, G5 on ppc
+ replace-cpu-flags G3 750
+ replace-cpu-flags G4 7400
+ replace-cpu-flags G5 7400
+}
+
+is_arch_allowed() {
+ i386_processor_table="i386 i486 i586 pentium pentium-mmx winchip-c6 \
+ winchip2 c3 i686 pentiumpro pentium2 pentium3 pentium4 prescott \
+ nocona k6 k6-2 k6-3 athlon athlon-tbird x86-64 athlon-4 athlon-xp \
+ athlon-mp"
+
+ for proc in ${i386_processor_table} ; do
+ [ "${proc}" == "${1}" ] && return 0
+ done
+
+ mips_processor_table="mips1 mips2 mips3 mips4 mips32 mips64 r3000 r2000 \
+ r3900 r6000 r4000 vr4100 vr4111 vr4120 vr4300 r4400 r4600 orion \
+ r4650 r8000 vr5000 vr5400 vr5500 4kc 4kp 5kc 20kc sr71000 sb1"
+
+ for proc in ${mips_processor_table} ; do
+ [ "${proc}" == "${1}" ] && return 0
+ done
+
+ rs6000_processor_table="common power power2 power3 power4 powerpc \
+ powerpc64 rios rios1 rsc rsc1 rios2 rs64a 401 403 405 505 601 602 \
+ 603 603e ec603e 604 604e 620 630 740 750 7400 7450 8540 801 821 823 \
+ 860"
+
+ for proc in ${rs6000_processor_table} ; do
+ [ "${proc}" == "${1}" ] && return 0
+ done
+
+ return 1
+}
+
+do_filter_flags() {
+ declare setting
+
+ # In general gcc does not like optimization, and add -O2 where
+ # it is safe. This is especially true for gcc 3.3 + 3.4
+ replace-flags -O? -O2
+
+ # gcc 3.3 doesn't support -mtune on numerous archs, so xgcc will fail
+ setting="`get-flag mtune`"
+ [ ! -z "${setting}" ] && filter-flags -mtune="${setting}"
+
+ # in gcc 3.3 there is a bug on ppc64 where if -mcpu is used
+ # the compiler incorrectly assumes the code you are about to build
+ # is 32 bit
+ use ppc64 && setting="`get-flag mcpu`"
+ [ ! -z "${setting}" ] && filter-flags -mcpu="${setting}"
+
+ # only allow the flags that we -know- are supported
+ transform_known_flags
+ setting="`get-flag march`"
+ if [ ! -z "${setting}" ] ; then
+ is_arch_allowed "${setting}" || filter-flags -march="${setting}"
+ fi
+ setting="`get-flag mcpu`"
+ if [ ! -z "${setting}" ] ; then
+ is_arch_allowed "${setting}" || filter-flags -mcpu="${setting}"
+ fi
+
+ # xgcc wont understand gcc 3.4 flags...
+ filter-flags -fno-unit-at-a-time
+ filter-flags -funit-at-a-time
+ filter-flags -fweb
+ filter-flags -fno-web
+ filter-flags -mno-tls-direct-seg-refs
+
+ # xgcc isnt patched with propolice
+ filter-flags -fstack-protector-all
+ filter-flags -fno-stack-protector-all
+ filter-flags -fstack-protector
+ filter-flags -fno-stack-protector
+
+ # xgcc isnt patched with the gcc symbol visibility patch
+ filter-flags -fvisibility-inlines-hidden
+ filter-flags -fvisibility=hidden
+
+ # Bug #269433 & #290202
+ filter-flags -fno-strict-overflow
+ filter-flags -fstrict-overflow
+
+ # Bug #442784
+ filter-flags '-W*'
+
+ # ...sure, why not?
+ strip-unsupported-flags
+
+ strip-flags
+}
+
+PATCH_VER="1.6"
+
+DESCRIPTION="Compatibility package for running binaries linked against a pre gcc 3.4 libstdc++"
+HOMEPAGE="http://gcc.gnu.org/libstdc++/"
+SRC_URI="ftp://gcc.gnu.org/pub/gcc/releases/gcc-${PV}/gcc-${PV}.tar.bz2
+ mirror://gentoo/gcc-${PV}-patches-${PATCH_VER}.tar.bz2"
+
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="5"
+KEYWORDS="amd64 ~mips ppc -ppc64 sparc x86 ~x86-fbsd"
+IUSE="multilib nls"
+
+S=${WORKDIR}/gcc-${PV}
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/patch
+ elibtoolize --portage --shallow
+ ./contrib/gcc_update --touch
+ mkdir -p "${WORKDIR}"/build
+
+ if use multilib ; then
+ # ugh, this shit has to match the way we've hacked gcc else
+ # the build falls apart #259215
+ sed -i \
+ -e 's:\(MULTILIB_OSDIRNAMES = \).*:\1../lib64 ../lib32:' \
+ "${S}"/gcc/config/i386/t-linux64 \
+ || die "sed failed!"
+ fi
+}
+
+src_compile() {
+ cd "${WORKDIR}"/build
+ do_filter_flags
+ ECONF_SOURCE=${S}
+ econf \
+ --enable-shared \
+ --with-system-zlib \
+ --enable-languages=c++ \
+ --enable-threads=posix \
+ --enable-long-long \
+ --disable-checking \
+ --enable-cstdio=stdio \
+ --enable-__cxa_atexit \
+ $(use_enable multilib) \
+ $(use_enable nls) \
+ $(use_with !nls included-gettext) \
+ || die
+
+ touch "${S}"/gcc/c-gperf.h
+
+ emake all-target-libstdc++-v3 || die
+}
+
+src_install() {
+ emake -j1 \
+ -C "${WORKDIR}"/build \
+ DESTDIR="${D}" \
+ install-target-libstdc++-v3 || die
+
+ # scrub everything but the library we care about
+ pushd "${D}" >/dev/null
+ mv usr/lib* . || die
+ rm -rf usr
+ rm -f lib*/*.{a,la,so} || die
+ dodir /usr
+ mv lib* usr/ || die
+}
diff --git a/sys-libs/libstdc++-v3/metadata.xml b/sys-libs/libstdc++-v3/metadata.xml
new file mode 100644
index 000000000000..fb4199eb7afe
--- /dev/null
+++ b/sys-libs/libstdc++-v3/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>toolchain</herd>
+</pkgmetadata>
diff --git a/sys-libs/libtermcap-compat/Manifest b/sys-libs/libtermcap-compat/Manifest
new file mode 100644
index 000000000000..390ea18e334c
--- /dev/null
+++ b/sys-libs/libtermcap-compat/Manifest
@@ -0,0 +1,4 @@
+DIST termcap-2.0.8-patches-1.tar.bz2 10573 SHA256 0f77dc3ac217f8800e0f70f5c47e93b8bd253f20bb53552356bcdb690a21cef9 SHA512 74ccfa95338574cb234faf4bda6ec3d4aa5bb45b2a59d6ef03a0b33fecc8d2da07e8df80d441de90e26f0eac06346dd697fbdcd9c0ec3068f179e12cd82405f2 WHIRLPOOL fb93e0e78984f884cb01d8a3712c90c2a356f227726c97b8b99630ece32fae1a114c9674d89edc8afee4f234674b272a3d8c8fb309fc18d2cdaecdd668a84409
+DIST termcap-2.0.8-patches-2.tar.bz2 11589 SHA256 9e6e623445070f351c3c5fcc0a13da9f8df93687b3429160f7a8c2e7928f795a SHA512 24d871007191a051dca604635f6d4e2dec67b675c2c9a0c728a0458a6a501ac268f5d4c4203356a6f64e718edba5c8ec970276c244435a25bef11c6fba0e837d WHIRLPOOL 97562be3b39aaf023e8e177cf6e02e3b38aecd105dffe02fbfb56a80e1223b06e4acb5cbd5ca0ca2a34ed654054dc9dd53d6346a355d2526acea453e3bda7929
+DIST termcap-2.0.8.tar.bz2 211523 SHA256 293fb17823ae10b01902465d9f83625598b784e7bf72dde5425914c1c718f917 SHA512 1aca52f5bcda60933229143085416296fed1aa981bae4440f30424f1e2bd9d90e9836f05c5a5a53af77d20dbb1d2425bf2b7c5fa2952258e2b4a2a5babaddaad WHIRLPOOL 1893929d35ca9fa8a68a9ea7ed8a424709d3393c4671f01e75995f4ed9bef8c70f3c5026dae2edcc4f88a1bb29542398477dae33915dadf4011f80bd4f6ca04e
+DIST termtypes.tc.gz 228329 SHA256 c4fa04257fea6e968d4caa28cc18dbbf9eea4769a463296eaca21ceea757a728 SHA512 13a2ee2cd0bc349d69af7efb8e8122f655b67f4bcbe0dc5cbf8a9ba22649548086a097de8bc148fb71ceba1640434a6b94763410beb3b915e03c3a6b46e8a678 WHIRLPOOL ee07db90257172a651e067e5313b2c9240b6a4cb60f376fd699f70ae95d20c1c7ed36cdb954259b21ecd48b7f997fe67f1be6ab5555ce8bdc3f65f7f3d6fa18f
diff --git a/sys-libs/libtermcap-compat/libtermcap-compat-2.0.8-r2.ebuild b/sys-libs/libtermcap-compat/libtermcap-compat-2.0.8-r2.ebuild
new file mode 100644
index 000000000000..71c735cf2aaf
--- /dev/null
+++ b/sys-libs/libtermcap-compat/libtermcap-compat-2.0.8-r2.ebuild
@@ -0,0 +1,64 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# we only want this for binary-only packages, so we will only be installing
+# the lib used at runtime; no headers and no files to link against
+
+inherit eutils multilib
+
+PATCHVER=1
+
+MY_P="termcap-${PV}"
+DESCRIPTION="Compatibility package for old termcap-based programs"
+HOMEPAGE="http://www.catb.org/~esr/terminfo/"
+SRC_URI="http://www.catb.org/~esr/terminfo/termtypes.tc.gz
+ mirror://gentoo/${MY_P}.tar.bz2
+ mirror://gentoo/${MY_P}-patches-${PATCHVER}.tar.bz2"
+
+LICENSE="GPL-2 LGPL-2 BSD"
+SLOT="0"
+KEYWORDS="alpha amd64 hppa ppc sparc x86"
+IUSE=""
+
+DEPEND=""
+
+S=${WORKDIR}/${MY_P}
+
+src_unpack() {
+ unpack ${A}
+
+ EPATCH_SOURCE="${WORKDIR}/patch"
+ EPATCH_SUFFIX="patch"
+
+ cd "${WORKDIR}"
+ mv termtypes.tc termcap || die
+ epatch "${EPATCH_SOURCE}"/tc.file
+
+ cd "${S}"
+ epatch "${EPATCH_SOURCE}"
+}
+
+src_compile() {
+ emake prefix="/" CFLAGS="${CFLAGS} -I." || die
+}
+
+src_install() {
+ dodir /lib /include
+ emake prefix="${D}" OWNER="root:root" install || die
+ dodoc ChangeLog README
+
+ insinto /etc
+ doins "${WORKDIR}"/termcap
+
+ # now punt everything used for compiling
+ cd "${D}"
+ rm -r include || die
+
+ if [[ $(get_libdir) != "lib" ]] ; then
+ mv lib $(get_libdir) || die
+ fi
+ dosym libtermcap.so.${PV} /$(get_libdir)/libtermcap.so.2
+ cd $(get_libdir)
+ rm -f libtermcap.{a,so}
+}
diff --git a/sys-libs/libtermcap-compat/libtermcap-compat-2.0.8-r3.ebuild b/sys-libs/libtermcap-compat/libtermcap-compat-2.0.8-r3.ebuild
new file mode 100644
index 000000000000..424c85f58828
--- /dev/null
+++ b/sys-libs/libtermcap-compat/libtermcap-compat-2.0.8-r3.ebuild
@@ -0,0 +1,50 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# we only want this for binary-only packages, so we will only be installing
+# the lib used at runtime; no headers and no files to link against
+
+EAPI="4"
+
+inherit eutils multilib toolchain-funcs
+
+PATCHVER="2"
+
+MY_P="termcap-${PV}"
+DESCRIPTION="Compatibility package for old termcap-based programs"
+HOMEPAGE="http://www.catb.org/~esr/terminfo/"
+SRC_URI="http://www.catb.org/~esr/terminfo/termtypes.tc.gz
+ mirror://gentoo/${MY_P}.tar.bz2
+ mirror://gentoo/${MY_P}-patches-${PATCHVER}.tar.bz2"
+
+LICENSE="GPL-2 LGPL-2 BSD"
+SLOT="0"
+KEYWORDS="alpha amd64 ~arm hppa ppc sparc x86"
+IUSE=""
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+ EPATCH_SOURCE="${WORKDIR}/patch"
+ EPATCH_SUFFIX="patch"
+ epatch "${EPATCH_SOURCE}"
+
+ cd "${WORKDIR}"
+ mv termtypes.tc termcap || die
+ epatch "${EPATCH_SOURCE}"/tc.file
+}
+
+src_configure() {
+ tc-export CC
+}
+
+src_install() {
+ dolib.so libtermcap.so.${PV}
+ dosym libtermcap.so.${PV} /usr/$(get_libdir)/libtermcap.so.2
+
+ insinto /etc
+ doins "${WORKDIR}"/termcap
+
+ dodoc ChangeLog README
+}
diff --git a/sys-libs/libtermcap-compat/metadata.xml b/sys-libs/libtermcap-compat/metadata.xml
new file mode 100644
index 000000000000..96a2d586367d
--- /dev/null
+++ b/sys-libs/libtermcap-compat/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>base-system</herd>
+</pkgmetadata>
diff --git a/sys-libs/libtrash/Manifest b/sys-libs/libtrash/Manifest
new file mode 100644
index 000000000000..2e5b68efa201
--- /dev/null
+++ b/sys-libs/libtrash/Manifest
@@ -0,0 +1 @@
+DIST libtrash-3.2.tgz 98138 SHA256 c1bb4b941ed0eef29f9acf9f4101f8695bdb49763f80ed41647b01063d6e946f SHA512 b79d26f8414016044de36359fc98b261dd850a550003d13bf910be7ab5faad42820c4c7f06be6fd5aad34f9aacd0e234ee24d72d43b37eb80d69b197b25442cd WHIRLPOOL 1ede1936d6e41a1a7097e8980f9dcbc76180cb0c43ed52bb876c66ad1eea707e05c6e0a400c9503465f4950daf72714e6ef2c276ebca318b92d9cb1e282e49a3
diff --git a/sys-libs/libtrash/files/cleanTrash.cron b/sys-libs/libtrash/files/cleanTrash.cron
new file mode 100644
index 000000000000..e9686119ac44
--- /dev/null
+++ b/sys-libs/libtrash/files/cleanTrash.cron
@@ -0,0 +1,12 @@
+#!/bin/sh
+#
+# Uncomment the following if you want
+# your Trash cleaned out regularly.
+#
+# This is part of the libtrash package.
+#
+
+#if [ -x /usr/sbin/ct2.pl ]
+#then
+# /usr/sbin/ct2.pl > /dev/null
+#fi
diff --git a/sys-libs/libtrash/files/libtrash-3.2-gentoo.patch b/sys-libs/libtrash/files/libtrash-3.2-gentoo.patch
new file mode 100644
index 000000000000..f1dba6b03917
--- /dev/null
+++ b/sys-libs/libtrash/files/libtrash-3.2-gentoo.patch
@@ -0,0 +1,63 @@
+diff -Naur libtrash-3.2.orig/cleanTrash/ct2.pl libtrash-3.2/cleanTrash/ct2.pl
+--- libtrash-3.2.orig/cleanTrash/ct2.pl 2003-12-08 04:11:49.000000000 +0900
++++ libtrash-3.2/cleanTrash/ct2.pl 2008-12-30 10:13:12.000000000 +0900
+@@ -39,7 +39,8 @@
+ ### CONFIGURATION
+ ##########################################################################
+ # Trash-directory relative to home-dir
+-$TRASH_DIR = '/Desktop/Trash';
++#$TRASH_DIR = '/Desktop/Trash';
++$TRASH_DIR = '/Trash';
+
+ # Trash-history file relative to home-dir
+ $TRASH_HIST_FILE = '/.trashhist';
+@@ -52,7 +53,8 @@
+
+ # minimum user number (by convention on many Linux systems, 'real' users
+ # have UIDs >= 500). Set to zero to process all users
+-$MIN_USER = 500;
++#$MIN_USER = 500;
++$MIN_USER = 1000;
+
+ ##########################################################################
+ ### PROGRAM
+diff -Naur libtrash-3.2.orig/libtrash.conf libtrash-3.2/libtrash.conf
+--- libtrash-3.2.orig/libtrash.conf 2007-12-04 08:33:34.000000000 +0900
++++ libtrash-3.2/libtrash.conf 2008-12-30 10:16:12.000000000 +0900
+@@ -286,8 +286,8 @@
+ # through the use of the UNCOVER_DIRS environmental variable (see
+ # below).
+
+-UNREMOVABLE_DIRS =
+-#UNREMOVABLE_DIRS=/bin;/boot;/dev;/etc;/lib;/sbin;/usr
++#UNREMOVABLE_DIRS =
++UNREMOVABLE_DIRS=/bin;/boot;/dev;/etc;/lib;/lib32;/lib64;/sbin;/usr;/opt
+
+ # This is a convenience configuration variable: it simply instructs
+ # libtrash to temporarily remove the listed directory(ies) from the
+diff -Naur libtrash-3.2.orig/src/Makefile libtrash-3.2/src/Makefile
+--- libtrash-3.2.orig/src/Makefile 2008-01-23 21:41:24.000000000 +0900
++++ libtrash-3.2/src/Makefile 2008-12-30 10:21:10.000000000 +0900
+@@ -1,5 +1,5 @@
+ CC=gcc
+-CFLAGS=-Wall -W -Wmissing-prototypes -D_REENTRANT
++CFLAGS+=-Wall -W -Wmissing-prototypes -D_REENTRANT
+
+ INSTLIBDIR=/usr/local/lib
+ SYSCONFFILE=/etc/libtrash.conf
+@@ -32,10 +32,11 @@
+ -o libtrash.so.${VERSION} -ldl
+
+ install-libtrash:
+- TRASH_OFF=YES install libtrash.so.${VERSION} ${INSTLIBDIR}/libtrash.so.${VERSION}
+- TRASH_OFF=YES ln -sf libtrash.so.${VERSION} ${INSTLIBDIR}/libtrash.so
+- TRASH_OFF=YES install libtrash.conf.sys --mode a=r ${SYSCONFFILE}
+- ldconfig
++ TRASH_OFF=YES install libtrash.so.${VERSION} $(DESTDIR)${INSTLIBDIR}/libtrash.so.${VERSION}
++ TRASH_OFF=YES ln -sf libtrash.so.${VERSION} $(DESTDIR)${INSTLIBDIR}/libtrash.so
++ TRASH_OFF=YES ln -sf libtrash.so.${VERSION} $(DESTDIR)${INSTLIBDIR}/libtrash.so.3
++ TRASH_OFF=YES install libtrash.conf.sys --mode a=r $(DESTDIR)${SYSCONFFILE}
++# ldconfig
+
+ clean:
+ rm -f *~
diff --git a/sys-libs/libtrash/files/libtrash-3.2-ldflags.patch b/sys-libs/libtrash/files/libtrash-3.2-ldflags.patch
new file mode 100644
index 000000000000..b8c3917132a6
--- /dev/null
+++ b/sys-libs/libtrash/files/libtrash-3.2-ldflags.patch
@@ -0,0 +1,11 @@
+--- src/Makefile.orig 2013-02-26 01:16:14.367046358 +0400
++++ src/Makefile 2013-02-26 01:16:26.054046729 +0400
+@@ -28,7 +28,7 @@
+ python ../scripts/get_symbol_versions.py
+ rm -f linking-helper
+ perl -w ../scripts/genconf.pl
+- $(CC) $(CFLAGS) $(SRC) -nostartfiles -shared -fPIC -Wl,-soname,libtrash.so.${MAJOR} \
++ $(CC) $(CFLAGS) $(SRC) -nostartfiles -shared -fPIC $(LDFLAGS) -Wl,-soname,libtrash.so.${MAJOR} \
+ -o libtrash.so.${VERSION} -ldl
+
+ install-libtrash:
diff --git a/sys-libs/libtrash/libtrash-3.2-r1.ebuild b/sys-libs/libtrash/libtrash-3.2-r1.ebuild
new file mode 100644
index 000000000000..c8c9c9e6c85f
--- /dev/null
+++ b/sys-libs/libtrash/libtrash-3.2-r1.ebuild
@@ -0,0 +1,68 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils multilib toolchain-funcs
+
+DESCRIPTION="Provides a trash can by intercepting certain calls to glibc"
+HOMEPAGE="http://pages.stern.nyu.edu/~marriaga/software/libtrash/"
+SRC_URI="http://pages.stern.nyu.edu/~marriaga/software/libtrash/${P}.tgz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+
+DEPEND="dev-lang/perl"
+RDEPEND="${DEPEND}"
+
+src_unpack() {
+ unpack "${A}"
+
+ # now let's unpack strash too in cash anyone is interested
+ cd "${S}/cleanTrash" || die "cd failed"
+ unpack ./strash-0.9.tar.gz
+}
+
+src_prepare() {
+ epatch "${FILESDIR}/${P}-gentoo.patch"
+ epatch "${FILESDIR}/${P}-ldflags.patch" # bug 334833
+ sed -i -e "/^INSTLIBDIR/s:local/lib:$(get_libdir):" src/Makefile || die "sed on Makefile failed"
+}
+
+src_compile() {
+ emake CC="$(tc-getCC)"
+}
+
+src_install() {
+ dodir /etc /usr/$(get_libdir)
+ emake DESTDIR="${D}" install
+
+ dosbin cleanTrash/ct2.pl
+ exeinto /etc/cron.daily
+ doexe "${FILESDIR}/cleanTrash.cron"
+
+ dodoc CHANGE.LOG README libtrash.conf TODO config.txt
+
+ docinto cleanTrash
+ dodoc cleanTrash/README cleanTrash/cleanTrash
+
+ # new strash installation stuff
+ dosbin cleanTrash/strash-0.9/strash
+ docinto strash
+ dodoc cleanTrash/strash-0.9/README
+ doman cleanTrash/strash-0.9/strash.8
+}
+
+pkg_postinst() {
+ elog
+ elog "To use this you have to put the trash library as one"
+ elog "of the variables in LD_PRELOAD."
+ elog "Example in bash:"
+ elog "export LD_PRELOAD=/usr/$(get_libdir)/libtrash.so"
+ elog
+ elog "Also, see /etc/cron.daily/cleanTrash.cron if you'd like to turn on"
+ elog "daily trash cleanup."
+ elog
+}
diff --git a/sys-libs/libtrash/metadata.xml b/sys-libs/libtrash/metadata.xml
new file mode 100644
index 000000000000..d9cd2cad66c2
--- /dev/null
+++ b/sys-libs/libtrash/metadata.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer>
+<email>maintainer-needed@gentoo.org</email>
+</maintainer>
+</pkgmetadata>
diff --git a/sys-libs/libunwind/Manifest b/sys-libs/libunwind/Manifest
new file mode 100644
index 000000000000..fa690d83e6cf
--- /dev/null
+++ b/sys-libs/libunwind/Manifest
@@ -0,0 +1,3 @@
+DIST libunwind-0.99.tar.gz 711817 SHA256 56083aae17eab3ccb7a36b95f0430f5a5f258755bf193bb5ca4fd4b918356164 SHA512 26796c546490c3065d04e2143b8a4a7bcc3d3d8fc0c1c8bc1da1ddfb6abc0807d994fe83f008e82ba7cb78525d6fe66800aafa266e931a6aef9813283f904daf WHIRLPOOL 868cf12c71fb1ca64da185e3e804bcddfafd70f8c443c7ca5684f9fa99f1a1943bb75cc4137082a5bd3865a6aeea39c1b2ad68d62db261d14164afded8f0ee3e
+DIST libunwind-1.0.1.tar.gz 1028725 SHA256 aa95fd184c0b90d95891c2f3bac2c7df708ff016d2a6ee8b2eabb769f864101f SHA512 e360f0c0abf1e8b153a01cf522237495cecd9b4c689fa55868e60cec86f650e86ceefa283c045fa3d4bd50dc130e75ce7a8ad221c8f938c20a56f106aa3de8c5 WHIRLPOOL 0a2bcfdabb97cb541f7050203db4b658d0b853fdeb504e5917a731547a673e78db9ea0a64ee17ffc137017fc474c7ba44086fdbf2f5f3519993b5bd0048c76b4
+DIST libunwind-1.1.tar.gz 1098603 SHA256 9dfe0fcae2a866de9d3942c66995e4b460230446887dbdab302d41a8aee8d09a SHA512 bfe04f2bfac9f9e47c37f0b23ed2f264d8d3d3d6f1392fe9d794ee13cad216b3740979e922e4276fb65c1ccdc836fce48812cb5459ecdd2a89a621036a35d7c1 WHIRLPOOL 1a0e566edf92c0563cb5525203f2718c3454bc0be25ec8079cde8441de08b6d8951db7cbf2f0a02a4a0f1e6c350e74e551a482d9094996daefa216a79bc9d383
diff --git a/sys-libs/libunwind/files/libunwind-0.99-disable-setjmp.patch b/sys-libs/libunwind/files/libunwind-0.99-disable-setjmp.patch
new file mode 100644
index 000000000000..698d2acff816
--- /dev/null
+++ b/sys-libs/libunwind/files/libunwind-0.99-disable-setjmp.patch
@@ -0,0 +1,213 @@
+http://cvs.fedoraproject.org/viewvc/rpms/libunwind/devel/libunwind-disable-setjmp.patch?revision=1.1&view=markup
+http://bugs.gentoo.org/show_bug.cgi?id=299344
+
+At least x86_64 version cannot work, src/setjmp/setjmp.c and
+src/setjmp/sigsetjmp.c are not even compiled, src/x86_64/longjmp.S does not
+match src/setjmp/setjmp.c + include/tdep-x86_64/jmpbuf.h .
+
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -12,7 +12,7 @@ lib_LTLIBRARIES_cdep_setjmp =
+ else
+ LIBRARIES_cdep = libunwind-ptrace.a
+ lib_LTLIBRARIES_cdep = libunwind.la
+-lib_LTLIBRARIES_cdep_setjmp = libunwind-setjmp.la
++lib_LTLIBRARIES_cdep_setjmp = #libunwind-setjmp.la
+ endif
+
+ ### libunwind-ptrace:
+@@ -27,21 +27,21 @@ libunwind_ptrace_a_SOURCES = \
+ ptrace/_UPT_reg_offset.c ptrace/_UPT_resume.c
+
+ ### libunwind-setjmp:
+-libunwind_setjmp_la_LDFLAGS = $(COMMON_SO_LDFLAGS) \
+- -version-info $(SETJMP_SO_VERSION)
+-libunwind_setjmp_la_LIBADD = libunwind-$(arch).la -lc
+-libunwind_setjmp_la_SOURCES_common = setjmp/setjmp_i.h \
+- setjmp/longjmp.c \
+- setjmp/siglongjmp.c
+-libunwind_setjmp_la_SOURCES_arm = arm/siglongjmp.S
+-libunwind_setjmp_la_SOURCES_ia64 = ia64/setjmp.S ia64/sigsetjmp.S \
+- ia64/longjmp.S ia64/siglongjmp.S
+-libunwind_setjmp_la_SOURCES_hppa = hppa/siglongjmp.S
+-libunwind_setjmp_la_SOURCES_mips = mips/siglongjmp.S
+-libunwind_setjmp_la_SOURCES_x86 = x86/longjmp.S x86/siglongjmp.S
+-libunwind_setjmp_la_SOURCES_x86_64 = x86_64/longjmp.S x86_64/siglongjmp.S
+-libunwind_setjmp_la_SOURCES_ppc64 = ppc/longjmp.S ppc/siglongjmp.S
+-libunwind_setjmp_la_SOURCES_ppc32 = ppc/longjmp.S ppc/siglongjmp.S
++#libunwind_setjmp_la_LDFLAGS = $(COMMON_SO_LDFLAGS) \
++# -version-info $(SETJMP_SO_VERSION)
++#libunwind_setjmp_la_LIBADD = libunwind-$(arch).la -lc
++#libunwind_setjmp_la_SOURCES_common = setjmp/setjmp_i.h \
++# setjmp/longjmp.c \
++# setjmp/siglongjmp.c
++#libunwind_setjmp_la_SOURCES_arm = arm/siglongjmp.S
++#libunwind_setjmp_la_SOURCES_ia64 = ia64/setjmp.S ia64/sigsetjmp.S \
++# ia64/longjmp.S ia64/siglongjmp.S
++#libunwind_setjmp_la_SOURCES_hppa = hppa/siglongjmp.S
++#libunwind_setjmp_la_SOURCES_mips = mips/siglongjmp.S
++#libunwind_setjmp_la_SOURCES_x86 = x86/longjmp.S x86/siglongjmp.S
++#libunwind_setjmp_la_SOURCES_x86_64 = x86_64/longjmp.S x86_64/siglongjmp.S
++#libunwind_setjmp_la_SOURCES_ppc64 = ppc/longjmp.S ppc/siglongjmp.S
++#libunwind_setjmp_la_SOURCES_ppc32 = ppc/longjmp.S ppc/siglongjmp.S
+
+ ### libunwind:
+
+@@ -359,8 +359,8 @@ if ARCH_ARM
+ if !REMOTE_ONLY
+ libunwind_arm_la_LIBADD = libunwind.la -lc
+ endif
+- libunwind_setjmp_la_SOURCES = $(libunwind_setjmp_la_SOURCES_common) \
+- $(libunwind_setjmp_la_SOURCES_arm)
++# libunwind_setjmp_la_SOURCES = $(libunwind_setjmp_la_SOURCES_common) \
++# $(libunwind_setjmp_la_SOURCES_arm)
+ else
+ if ARCH_IA64
+ ia64_mk_Gcursor_i_SOURCES = ia64/mk_Gcursor_i.c
+@@ -378,8 +378,8 @@ Lcursor_i.h: ia64/mk_Lcursor_i
+ if !REMOTE_ONLY
+ libunwind_ia64_la_LIBADD = libunwind.la -lc
+ endif
+- libunwind_setjmp_la_SOURCES = $(libunwind_setjmp_la_SOURCES_common) \
+- $(libunwind_setjmp_la_SOURCES_ia64)
++# libunwind_setjmp_la_SOURCES = $(libunwind_setjmp_la_SOURCES_common) \
++# $(libunwind_setjmp_la_SOURCES_ia64)
+ else
+ if ARCH_HPPA
+ lib_LTLIBRARIES_arch = libunwind-hppa.la
+@@ -389,8 +389,8 @@ if ARCH_HPPA
+ if !REMOTE_ONLY
+ libunwind_hppa_la_LIBADD = libunwind.la -lc
+ endif
+- libunwind_setjmp_la_SOURCES = $(libunwind_setjmp_la_SOURCES_common) \
+- $(libunwind_setjmp_la_SOURCES_hppa)
++# libunwind_setjmp_la_SOURCES = $(libunwind_setjmp_la_SOURCES_common) \
++# $(libunwind_setjmp_la_SOURCES_hppa)
+ else
+ if ARCH_MIPS
+ lib_LTLIBRARIES_arch = libunwind-mips.la
+@@ -400,8 +400,8 @@ if ARCH_MIPS
+ if !REMOTE_ONLY
+ libunwind_mips_la_LIBADD = libunwind.la -lc
+ endif
+- libunwind_setjmp_la_SOURCES = $(libunwind_setjmp_la_SOURCES_common) \
+- $(libunwind_setjmp_la_SOURCES_mips)
++# libunwind_setjmp_la_SOURCES = $(libunwind_setjmp_la_SOURCES_common) \
++# $(libunwind_setjmp_la_SOURCES_mips)
+ else
+ if ARCH_X86
+ lib_LTLIBRARIES_arch = libunwind-x86.la
+@@ -411,8 +411,8 @@ if ARCH_X86
+ if !REMOTE_ONLY
+ libunwind_x86_la_LIBADD = libunwind.la -lc
+ endif
+- libunwind_setjmp_la_SOURCES = $(libunwind_setjmp_la_SOURCES_common) \
+- $(libunwind_setjmp_la_SOURCES_x86)
++# libunwind_setjmp_la_SOURCES = $(libunwind_setjmp_la_SOURCES_common) \
++# $(libunwind_setjmp_la_SOURCES_x86)
+ else
+ if ARCH_X86_64
+ lib_LTLIBRARIES_arch = libunwind-x86_64.la
+@@ -422,8 +422,8 @@ if ARCH_X86_64
+ if !REMOTE_ONLY
+ libunwind_x86_64_la_LIBADD = libunwind.la -lc
+ endif
+- libunwind_setjmp_la_SOURCES = $(libunwind_setjmp_la_SOURCES_common) \
+- $(libunwind_setjmp_la_SOURCES_x86_64)
++# libunwind_setjmp_la_SOURCES = $(libunwind_setjmp_la_SOURCES_common) \
++# $(libunwind_setjmp_la_SOURCES_x86_64)
+ else
+ if ARCH_PPC32
+ lib_LTLIBRARIES_arch = libunwind-ppc32.la
+@@ -433,8 +433,8 @@ if ARCH_PPC32
+ if !REMOTE_ONLY
+ libunwind_ppc32_la_LIBADD = libunwind.la -lc
+ endif
+- libunwind_setjmp_la_SOURCES = $(libunwind_setjmp_la_SOURCES_common) \
+- $(libunwind_setjmp_la_SOURCES_ppc32)
++# libunwind_setjmp_la_SOURCES = $(libunwind_setjmp_la_SOURCES_common) \
++# $(libunwind_setjmp_la_SOURCES_ppc32)
+ else
+ if ARCH_PPC64
+ lib_LTLIBRARIES_arch = libunwind-ppc64.la
+@@ -444,8 +444,8 @@ if ARCH_PPC64
+ if !REMOTE_ONLY
+ libunwind_ppc64_la_LIBADD = libunwind.la -lc
+ endif
+- libunwind_setjmp_la_SOURCES = $(libunwind_setjmp_la_SOURCES_common) \
+- $(libunwind_setjmp_la_SOURCES_ppc64)
++# libunwind_setjmp_la_SOURCES = $(libunwind_setjmp_la_SOURCES_common) \
++# $(libunwind_setjmp_la_SOURCES_ppc64)
+
+ endif # ARCH_PPC64
+ endif # ARCH_PPC32
+@@ -466,7 +466,7 @@ libunwind_la_LIBADD = -lc $(LIBCRTS)
+
+ lib_LIBRARIES = $(LIBRARIES_cdep)
+ lib_LTLIBRARIES = $(lib_LTLIBRARIES_cdep) $(lib_LTLIBRARIES_arch) \
+- $(lib_LTLIBRARIES_cdep_setjmp)
++ # $(lib_LTLIBRARIES_cdep_setjmp)
+
+ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/include/tdep-$(arch) -I.
+ AM_CCASFLAGS = $(AM_CPPFLAGS)
+@@ -488,16 +488,16 @@ EXTRA_DIST = elfxx.h elfxx.c unwind/unwind-internal.h \
+ $(libunwind_mips_la_SOURCES_mips) \
+ $(libunwind_x86_la_SOURCES_x86) \
+ $(libunwind_x86_64_la_SOURCES_x86_64) \
+- $(libunwind_ptrace_a_SOURCES) \
+- $(libunwind_setjmp_la_SOURCES_common) \
+- $(libunwind_setjmp_la_SOURCES_arm) \
+- $(libunwind_setjmp_la_SOURCES_hppa) \
+- $(libunwind_setjmp_la_SOURCES_ia64) \
+- $(libunwind_setjmp_la_SOURCES_mips) \
+- $(libunwind_setjmp_la_SOURCES_x86) \
+- $(libunwind_setjmp_la_SOURCES_x86_64) \
+- $(libunwind_setjmp_la_SOURCES_ppc32) \
+- $(libunwind_setjmp_la_SOURCES_ppc64)
++ $(libunwind_ptrace_a_SOURCES)
++# $(libunwind_setjmp_la_SOURCES_common) \
++# $(libunwind_setjmp_la_SOURCES_arm) \
++# $(libunwind_setjmp_la_SOURCES_hppa) \
++# $(libunwind_setjmp_la_SOURCES_ia64) \
++# $(libunwind_setjmp_la_SOURCES_mips) \
++# $(libunwind_setjmp_la_SOURCES_x86) \
++# $(libunwind_setjmp_la_SOURCES_x86_64) \
++# $(libunwind_setjmp_la_SOURCES_ppc32) \
++# $(libunwind_setjmp_la_SOURCES_ppc64)
+
+
+ # The -version-info flag accepts an argument of the form
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
+@@ -24,7 +24,8 @@ if ARCH_IA64
+ Gia64-test-nat Lia64-test-nat \
+ Gia64-test-rbs Lia64-test-rbs \
+ Gia64-test-readonly Lia64-test-readonly \
+- ia64-test-setjmp ia64-test-sig
++ ia64-test-sig
++# ia64-test-setjmp
+ else
+ if ARCH_PPC64
+ if USE_ALTIVEC
+@@ -40,8 +41,9 @@ endif #ARCH_IA64
+ Gtest-resume-sig Ltest-resume-sig \
+ Gtest-dyn1 Ltest-dyn1 \
+ test-async-sig test-flush-cache test-init-remote \
+- test-mem test-setjmp test-ptrace \
++ test-mem test-ptrace \
+ Ltest-nomalloc
++# test-setjmp
+ noinst_PROGRAMS_cdep = forker mapper test-ptrace-misc test-varargs \
+ Gperf-simple Lperf-simple
+
+@@ -93,8 +95,8 @@ test_ptrace_misc_SOURCES = test-ptrace-misc.c ident.c
+ LIBUNWIND = ../src/libunwind-$(arch).la $(LIBUNWIND_local)
+ LDADD = $(LIBUNWIND)
+
+-test_setjmp_LDADD = ../src/libunwind-setjmp.la $(LIBUNWIND_local)
+-ia64_test_setjmp_LDADD = ../src/libunwind-setjmp.la $(LIBUNWIND_local)
++# test_setjmp_LDADD = ../src/libunwind-setjmp.la $(LIBUNWIND_local)
++# ia64_test_setjmp_LDADD = ../src/libunwind-setjmp.la $(LIBUNWIND_local)
+ test_ptrace_LDADD = ../src/libunwind-ptrace.a $(LIBUNWIND)
+ Ltest_concurrent_LDADD = $(LIBUNWIND) -lpthread
+ Gtest_concurrent_LDADD = $(LIBUNWIND) -lpthread
diff --git a/sys-libs/libunwind/files/libunwind-0.99-implicit-declaration.patch b/sys-libs/libunwind/files/libunwind-0.99-implicit-declaration.patch
new file mode 100644
index 000000000000..6387f0a889c7
--- /dev/null
+++ b/sys-libs/libunwind/files/libunwind-0.99-implicit-declaration.patch
@@ -0,0 +1,17 @@
+http://bugs.gentoo.org/show_bug.cgi?id=289445#c2
+
+--- src/x86_64/unwind_i.h
++++ src/x86_64/unwind_i.h
+@@ -65,6 +65,12 @@
+ extern void x86_64_local_addr_space_init (void);
+ extern int x86_64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor,
+ void *arg);
++
++/* implemented in setcontext.S */
++#if defined(__linux)
++extern int _Ux86_64_setcontext (const ucontext_t *ucp);
++#endif
++
+ #if 0
+ extern dwarf_loc_t x86_64_scratch_loc (struct cursor *c, unw_regnum_t reg);
+ #endif
diff --git a/sys-libs/libunwind/files/libunwind-1.0.1-disable-setjmp.patch b/sys-libs/libunwind/files/libunwind-1.0.1-disable-setjmp.patch
new file mode 100644
index 000000000000..442a5dfd7a37
--- /dev/null
+++ b/sys-libs/libunwind/files/libunwind-1.0.1-disable-setjmp.patch
@@ -0,0 +1,37 @@
+http://cvs.fedoraproject.org/viewvc/rpms/libunwind/devel/libunwind-disable-setjmp.patch?revision=1.1&view=markup
+http://bugs.gentoo.org/299344
+
+At least x86_64 version cannot work, src/setjmp/setjmp.c and
+src/setjmp/sigsetjmp.c are not even compiled, src/x86_64/longjmp.S does not
+match src/setjmp/setjmp.c + include/tdep-x86_64/jmpbuf.h .
+
+--- libunwind-1.0.1/src/Makefile.am
++++ libunwind-1.0.1/src/Makefile.am
+@@ -9,6 +9,3 @@
+ # libunwind-setjmp depends on libunwind-$(arch). Therefore must be added
+ # at the end.
+-if !REMOTE_ONLY
+-lib_LTLIBRARIES += libunwind-setjmp.la
+-endif
+
+ #
+--- libunwind-1.0.1/tests/Makefile.am
++++ libunwind-1.0.1/tests/Makefile.am
+@@ -27,7 +27,7 @@
+ Gia64-test-nat Lia64-test-nat \
+ Gia64-test-rbs Lia64-test-rbs \
+ Gia64-test-readonly Lia64-test-readonly \
+- ia64-test-setjmp ia64-test-sig
++ ia64-test-sig
+ else
+ if ARCH_PPC64
+ if USE_ALTIVEC
+@@ -44,7 +44,7 @@
+ Gtest-dyn1 Ltest-dyn1 \
+ Gtest-trace Ltest-trace \
+ test-async-sig test-flush-cache test-init-remote \
+- test-mem test-setjmp test-ptrace \
++ test-mem test-ptrace \
+ Ltest-nomalloc Ltest-nocalloc rs-race
+ noinst_PROGRAMS_cdep = forker mapper test-ptrace-misc \
+ Gperf-simple Lperf-simple
diff --git a/sys-libs/libunwind/files/libunwind-1.0.1-ia64.patch b/sys-libs/libunwind/files/libunwind-1.0.1-ia64.patch
new file mode 100644
index 000000000000..0639e64e8a91
--- /dev/null
+++ b/sys-libs/libunwind/files/libunwind-1.0.1-ia64.patch
@@ -0,0 +1,133 @@
+fix from upstream for building on ia64
+
+https://bugs.gentoo.org/425736
+
+From 197571915c70b9ccd0978c13f12acb2a5f3058d4 Mon Sep 17 00:00:00 2001
+From: Ken Werner <ken.werner@linaro.org>
+Date: Tue, 11 Oct 2011 15:13:35 +0200
+Subject: [PATCH] Change _UPTi_find_unwind_table to return an integer.
+
+This keeps the definition on IA64 and all the other architectures in sync with
+the declaration of _UPTi_find_unwind_table. This also mimics the behaviour of
+what's done for local unwinding and allows the function to provide more than
+one way to undwind.
+
+Signed-off-by: Ken Werner <ken.werner@linaro.org>
+---
+ src/ptrace/_UPT_find_proc_info.c | 8 ++++----
+ src/ptrace/_UPT_get_dyn_info_list_addr.c | 6 ++----
+ src/ptrace/_UPT_internal.h | 2 +-
+ 3 files changed, 7 insertions(+), 9 deletions(-)
+
+diff --git a/src/ptrace/_UPT_find_proc_info.c b/src/ptrace/_UPT_find_proc_info.c
+index 44feb34..7aaa0c2 100644
+--- a/src/ptrace/_UPT_find_proc_info.c
++++ b/src/ptrace/_UPT_find_proc_info.c
+@@ -95,7 +95,7 @@ find_gp (struct UPT_info *ui, Elf64_Phdr *pdyn, Elf64_Addr load_base)
+ return gp;
+ }
+
+-HIDDEN unw_dyn_info_t *
++HIDDEN int
+ _UPTi_find_unwind_table (struct UPT_info *ui, unw_addr_space_t as,
+ char *path, unw_word_t segbase, unw_word_t mapoff,
+ unw_word_t ip)
+@@ -105,7 +105,7 @@ _UPTi_find_unwind_table (struct UPT_info *ui, unw_addr_space_t as,
+ int i;
+
+ if (!_Uelf64_valid_object (&ui->ei))
+- return NULL;
++ return -UNW_ENOINFO;
+
+ ehdr = ui->ei.image;
+ phdr = (Elf64_Phdr *) ((char *) ui->ei.image + ehdr->e_phoff);
+@@ -132,7 +132,7 @@ _UPTi_find_unwind_table (struct UPT_info *ui, unw_addr_space_t as,
+ }
+ }
+ if (!ptxt || !punw)
+- return NULL;
++ return 0;
+
+ ui->di_cache.start_ip = segbase;
+ ui->di_cache.end_ip = ui->di_cache.start_ip + ptxt->p_memsz;
+@@ -143,7 +143,7 @@ _UPTi_find_unwind_table (struct UPT_info *ui, unw_addr_space_t as,
+ ui->di_cache.u.ti.table_len = punw->p_memsz / sizeof (unw_word_t);
+ ui->di_cache.u.ti.table_data = (unw_word_t *)
+ ((char *) ui->ei.image + (punw->p_vaddr - ptxt->p_vaddr));
+- return &ui->di_cache;
++ return 1;
+ }
+
+ #elif UNW_TARGET_X86 || UNW_TARGET_X86_64 || UNW_TARGET_HPPA \
+
+From 962366dace4fed902ad5e89df1b34c13c3224b8b Mon Sep 17 00:00:00 2001
+From: Arun Sharma <asharma@fb.com>
+Date: Fri, 23 Sep 2011 11:11:34 -0700
+Subject: [PATCH] Fixup compile errors on ia64.
+
+Suggested-by: Harald Servat <harald.servat@bsc.es>
+---
+ src/ptrace/_UPT_get_dyn_info_list_addr.c | 2 +-
+ src/ptrace/_UPT_internal.h | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/ptrace/_UPT_get_dyn_info_list_addr.c b/src/ptrace/_UPT_get_dyn_info_list_addr.c
+index d82d4e4..ba9c795 100644
+--- a/src/ptrace/_UPT_get_dyn_info_list_addr.c
++++ b/src/ptrace/_UPT_get_dyn_info_list_addr.c
+@@ -62,7 +62,7 @@ get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg,
+
+ Debug (16, "checking object %s\n", path);
+
+- di = _UPTi_find_unwind_table (ui, as, path, lo, off);
++ di = _UPTi_find_unwind_table (ui, as, path, lo, off, 0);
+ if (di)
+ {
+ res = _Uia64_find_dyn_list (as, di, arg);
+From d93d96ad833390519ea68a2df22dd55dd26a3214 Mon Sep 17 00:00:00 2001
+From: Martin Milata <mmilata@redhat.com>
+Date: Tue, 22 May 2012 11:51:06 +0200
+Subject: [PATCH] Fix compilation on IA64
+
+ - Add tdep macro for {dwarf,ia64}_find_unwind_table so that ia64
+ doesn't try to use dwarf code.
+ - Fix extraneous #if.
+ - Fix mistyped filename in Makefile.am.
+ - Link ia64-specific tests with correct libraries.
+
+Signed-off-by: Martin Milata <mmilata@redhat.com>
+---
+ include/tdep-arm/libunwind_i.h | 1 +
+ include/tdep-hppa/libunwind_i.h | 1 +
+ include/tdep-ia64/libunwind_i.h | 1 +
+ include/tdep-mips/libunwind_i.h | 1 +
+ include/tdep-ppc32/libunwind_i.h | 1 +
+ include/tdep-ppc64/libunwind_i.h | 1 +
+ include/tdep-x86/libunwind_i.h | 1 +
+ include/tdep-x86_64/libunwind_i.h | 1 +
+ src/Makefile.am | 4 ++--
+ src/ia64/Gfind_unwind_table.c | 3 ---
+ src/ptrace/_UPT_find_proc_info.c | 2 +-
+ src/ptrace/_UPT_get_dyn_info_list_addr.c | 2 +-
+ tests/Makefile.am | 11 +++++++++++
+ 13 files changed, 23 insertions(+), 7 deletions(-)
+
+diff --git a/tests/Makefile.am b/tests/Makefile.am
+index 26e7987..4b3bce3 100644
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
+@@ -165,3 +165,14 @@ test_setjmp_LDADD = $(LIBUNWIND_setjmp)
+ test_setjmp_LDADD = $(LIBUNWIND_setjmp)
+ ia64_test_setjmp_LDADD = $(LIBUNWIND_setjmp)
+
++
++Gia64_test_nat_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
++Gia64_test_stack_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
++Gia64_test_rbs_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
++Gia64_test_readonly_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
++Lia64_test_nat_LDADD = $(LIBUNWIND_local)
++Lia64_test_stack_LDADD = $(LIBUNWIND_local)
++Lia64_test_rbs_LDADD = $(LIBUNWIND_local)
++Lia64_test_readonly_LDADD = $(LIBUNWIND_local)
++ia64_test_dyn1_LDADD = $(LIBUNWIND)
++ia64_test_sig_LDADD = $(LIBUNWIND)
diff --git a/sys-libs/libunwind/files/libunwind-1.1-lzma.patch b/sys-libs/libunwind/files/libunwind-1.1-lzma.patch
new file mode 100644
index 000000000000..09cefa028539
--- /dev/null
+++ b/sys-libs/libunwind/files/libunwind-1.1-lzma.patch
@@ -0,0 +1,63 @@
+From 38c349bb000b427c376e756e3ecdb764a2b4d297 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Sat, 15 Feb 2014 21:00:59 -0500
+Subject: [PATCH] link sublibs against liblzma as needed
+
+The coredump/elf32/elf64/elfxx libs use lzma funcs but don't link against
+it. This produces sub-shared libs that don't link against lzma and can
+make the linker angry due to underlinking like so:
+
+libtool: link: x86_64-pc-linux-gnu-gcc -O2 -march=amdfam10 -pipe -g \
+ -frecord-gcc-switches -Wimplicit-function-declaration -fexceptions \
+ -Wall -Wsign-compare -Wl,-O1 -Wl,--hash-style=gnu \
+ -o .libs/test-coredump-unwind test-coredump-unwind.o \
+ ../src/.libs/libunwind-coredump.so ../src/.libs/libunwind-x86_64.so
+../src/.libs/libunwind-coredump.so: error: undefined reference to 'lzma_stream_footer_decode'
+../src/.libs/libunwind-coredump.so: error: undefined reference to 'lzma_index_buffer_decode'
+../src/.libs/libunwind-coredump.so: error: undefined reference to 'lzma_index_size'
+../src/.libs/libunwind-coredump.so: error: undefined reference to 'lzma_index_end'
+../src/.libs/libunwind-coredump.so: error: undefined reference to 'lzma_index_uncompressed_size'
+../src/.libs/libunwind-coredump.so: error: undefined reference to 'lzma_stream_buffer_decode'
+collect2: error: ld returned 1 exit status
+
+So add LIBLZMA to the right LIBADD for each of these libraries.
+
+URL: https://bugs.gentoo.org/444050
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ src/Makefile.am | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/src/Makefile.in
++++ b/src/Makefile.in
+@@ -169,7 +169,7 @@ libunwind_arm_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libunwind_arm_la_LDFLAGS) $(LDFLAGS) -o $@
+ @ARCH_ARM_TRUE@am_libunwind_arm_la_rpath = -rpath $(libdir)
+-libunwind_coredump_la_LIBADD =
++libunwind_coredump_la_LIBADD = $(LIBLZMA)
+ am__libunwind_coredump_la_SOURCES_DIST = coredump/_UCD_accessors.c \
+ coredump/_UCD_create.c coredump/_UCD_destroy.c \
+ coredump/_UCD_access_mem.c coredump/_UCD_elf_map_image.c \
+@@ -214,15 +214,15 @@ am_libunwind_dwarf_local_la_OBJECTS = dwarf/Lexpr.lo dwarf/Lfde.lo \
+ libunwind_dwarf_local_la_OBJECTS = \
+ $(am_libunwind_dwarf_local_la_OBJECTS)
+ @REMOTE_ONLY_FALSE@@USE_DWARF_TRUE@am_libunwind_dwarf_local_la_rpath =
+-libunwind_elf32_la_LIBADD =
++libunwind_elf32_la_LIBADD = $(LIBLZMA)
+ am_libunwind_elf32_la_OBJECTS = elf32.lo
+ libunwind_elf32_la_OBJECTS = $(am_libunwind_elf32_la_OBJECTS)
+ @USE_ELF32_TRUE@am_libunwind_elf32_la_rpath =
+-libunwind_elf64_la_LIBADD =
++libunwind_elf64_la_LIBADD = $(LIBLZMA)
+ am_libunwind_elf64_la_OBJECTS = elf64.lo
+ libunwind_elf64_la_OBJECTS = $(am_libunwind_elf64_la_OBJECTS)
+ @USE_ELF64_TRUE@am_libunwind_elf64_la_rpath =
+-libunwind_elfxx_la_LIBADD =
++libunwind_elfxx_la_LIBADD = $(LIBLZMA)
+ am_libunwind_elfxx_la_OBJECTS = elfxx.lo
+ libunwind_elfxx_la_OBJECTS = $(am_libunwind_elfxx_la_OBJECTS)
+ @USE_ELFXX_TRUE@am_libunwind_elfxx_la_rpath =
+--
+1.8.5.5
+
diff --git a/sys-libs/libunwind/libunwind-0.99-r1.ebuild b/sys-libs/libunwind/libunwind-0.99-r1.ebuild
new file mode 100644
index 000000000000..2fe29ac71f42
--- /dev/null
+++ b/sys-libs/libunwind/libunwind-0.99-r1.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+inherit autotools eutils
+
+DESCRIPTION="Portable and efficient API to determine the call-chain of a program"
+HOMEPAGE="http://savannah.nongnu.org/projects/libunwind"
+SRC_URI="http://download.savannah.nongnu.org/releases/libunwind/${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="7"
+KEYWORDS="amd64 ia64 x86"
+IUSE="static-libs"
+
+RESTRICT="test" # https://savannah.nongnu.org/bugs/?22368
+ # https://bugs.gentoo.org/273372
+
+DOCS=( AUTHORS ChangeLog NEWS README TODO )
+
+src_prepare() {
+ epatch \
+ "${FILESDIR}"/${P}-disable-setjmp.patch \
+ "${FILESDIR}"/${P}-implicit-declaration.patch
+ eautoreconf
+}
+
+src_configure() {
+ econf $(use_enable static-libs static)
+}
+
+src_install() {
+ default
+ # libunwind-ptrace.a (and libunwind-ptrace.h) is separate API and without
+ # shared library, so we keep it in any case
+ use static-libs || rm -f "${D}"usr/lib*/libunwind{-generic.a,*.la}
+}
diff --git a/sys-libs/libunwind/libunwind-1.0.1-r1.ebuild b/sys-libs/libunwind/libunwind-1.0.1-r1.ebuild
new file mode 100644
index 000000000000..31cbfdd97035
--- /dev/null
+++ b/sys-libs/libunwind/libunwind-1.0.1-r1.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit autotools eutils
+
+DESCRIPTION="Portable and efficient API to determine the call-chain of a program"
+HOMEPAGE="http://savannah.nongnu.org/projects/libunwind"
+SRC_URI="http://download.savannah.nongnu.org/releases/libunwind/${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="7"
+KEYWORDS="amd64 ~arm ia64 ~ppc x86 ~amd64-fbsd ~x86-fbsd"
+IUSE="debug debug-frame static-libs"
+
+# https://savannah.nongnu.org/bugs/?22368
+# https://bugs.gentoo.org/273372
+RESTRICT="test"
+
+DOCS=( AUTHORS ChangeLog NEWS README TODO )
+
+QA_DT_NEEDED_x86_fbsd="usr/lib/libunwind.so.7.0.0"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-1.0.1-disable-setjmp.patch
+ epatch "${FILESDIR}"/${PN}-1.0.1-ia64.patch #425736
+ eautoreconf
+}
+
+src_configure() {
+ # do not $(use_enable) because the configure.in is broken and parses
+ # --disable-debug the same as --enable-debug.
+ # https://savannah.nongnu.org/bugs/index.php?34324
+ # --enable-cxx-exceptions: always enable it, headers provide the interface
+ # and on some archs it is disabled by default causing a mismatch between the
+ # API and the ABI, bug #418253
+ # conservative-checks: validate memory addresses before use; as of 1.0.1,
+ # only x86_64 supports this, yet may be useful for debugging, couple it with
+ # debug useflag.
+ econf \
+ --enable-cxx-exceptions \
+ $(use_enable debug-frame) \
+ $(use_enable static-libs static) \
+ $(use_enable debug conservative_checks) \
+ $(use debug && echo --enable-debug)
+}
+
+src_test() {
+ # explicitly allow parallel build of tests
+ emake check
+}
+
+src_install() {
+ default
+ # libunwind-ptrace.a (and libunwind-ptrace.h) is separate API and without
+ # shared library, so we keep it in any case
+ use static-libs || rm -f "${ED}"usr/lib*/libunwind{-generic.a,*.la}
+}
diff --git a/sys-libs/libunwind/libunwind-1.0.1.ebuild b/sys-libs/libunwind/libunwind-1.0.1.ebuild
new file mode 100644
index 000000000000..10cbbb4d0ff9
--- /dev/null
+++ b/sys-libs/libunwind/libunwind-1.0.1.ebuild
@@ -0,0 +1,50 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit autotools eutils
+
+DESCRIPTION="Portable and efficient API to determine the call-chain of a program"
+HOMEPAGE="http://savannah.nongnu.org/projects/libunwind"
+SRC_URI="http://download.savannah.nongnu.org/releases/libunwind/${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="7"
+KEYWORDS="~amd64 ~ia64 ~x86 ~x86-fbsd"
+IUSE="debug static-libs"
+
+# https://savannah.nongnu.org/bugs/?22368
+# https://bugs.gentoo.org/273372
+RESTRICT="test"
+
+DOCS=( AUTHORS ChangeLog NEWS README TODO )
+
+QA_DT_NEEDED_x86_fbsd="usr/lib/libunwind.so.7.0.0"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-1.0.1-disable-setjmp.patch
+ eautoreconf
+}
+
+src_configure() {
+ # do not $(use_enable) because the configure.in is broken and parses
+ # --disable-debug the same as --enable-debug.
+ # https://savannah.nongnu.org/bugs/index.php?34324
+ econf \
+ $(use_enable static-libs static) \
+ $(use debug && echo --enable-debug)
+}
+
+src_test() {
+ # explicitly allow parallel build of tests
+ emake check
+}
+
+src_install() {
+ default
+ # libunwind-ptrace.a (and libunwind-ptrace.h) is separate API and without
+ # shared library, so we keep it in any case
+ use static-libs || rm -f "${ED}"usr/lib*/libunwind{-generic.a,*.la}
+}
diff --git a/sys-libs/libunwind/libunwind-1.1.ebuild b/sys-libs/libunwind/libunwind-1.1.ebuild
new file mode 100644
index 000000000000..e4a0222fec8c
--- /dev/null
+++ b/sys-libs/libunwind/libunwind-1.1.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils libtool
+
+DESCRIPTION="Portable and efficient API to determine the call-chain of a program"
+HOMEPAGE="http://savannah.nongnu.org/projects/libunwind"
+SRC_URI="http://download.savannah.nongnu.org/releases/libunwind/${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="7"
+KEYWORDS="amd64 arm hppa ~ia64 ~mips ppc ppc64 x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux"
+IUSE="debug debug-frame libatomic lzma static-libs"
+
+RESTRICT="test" #461958 -- re-enable tests with >1.1 again for retesting, this is here for #461394
+
+# We just use the header from libatomic.
+RDEPEND="lzma? ( app-arch/xz-utils )"
+DEPEND="${RDEPEND}
+ libatomic? ( dev-libs/libatomic_ops )"
+
+DOCS=( AUTHORS ChangeLog NEWS README TODO )
+
+QA_DT_NEEDED_x86_fbsd="usr/lib/libunwind.so.7.0.0"
+
+src_prepare() {
+ # These tests like to fail. bleh.
+ echo 'int main(){return 0;}' > tests/Gtest-dyn1.c
+ echo 'int main(){return 0;}' > tests/Ltest-dyn1.c
+
+ sed -i -e '/LIBLZMA/s:-lzma:-llzma:' configure{.ac,} || die #444050
+ epatch "${FILESDIR}"/${P}-lzma.patch #444050
+ elibtoolize
+}
+
+src_configure() {
+ # do not $(use_enable) because the configure.in is broken and parses
+ # --disable-debug the same as --enable-debug.
+ # https://savannah.nongnu.org/bugs/index.php?34324
+ # --enable-cxx-exceptions: always enable it, headers provide the interface
+ # and on some archs it is disabled by default causing a mismatch between the
+ # API and the ABI, bug #418253
+ # conservative-checks: validate memory addresses before use; as of 1.0.1,
+ # only x86_64 supports this, yet may be useful for debugging, couple it with
+ # debug useflag.
+ ac_cv_header_atomic_ops_h=$(usex libatomic) \
+ econf \
+ --enable-cxx-exceptions \
+ $(use_enable debug-frame) \
+ $(use_enable lzma minidebuginfo) \
+ $(use_enable static-libs static) \
+ $(use_enable debug conservative_checks) \
+ $(use debug && echo --enable-debug)
+}
+
+src_test() {
+ # Explicitly allow parallel build of tests.
+ # Sandbox causes some tests to freak out.
+ SANDBOX_ON=0 emake check
+}
+
+src_install() {
+ default
+ # libunwind-ptrace.a (and libunwind-ptrace.h) is separate API and without
+ # shared library, so we keep it in any case
+ use static-libs || find "${ED}"usr '(' -name 'libunwind-generic.a' -o -name 'libunwind*.la' ')' -delete
+}
diff --git a/sys-libs/libunwind/metadata.xml b/sys-libs/libunwind/metadata.xml
new file mode 100644
index 000000000000..808179f059c8
--- /dev/null
+++ b/sys-libs/libunwind/metadata.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>toolchain</herd>
+ <use>
+ <flag name='debug-frame'>Adds support for DWARF .debug_frame section: Use the information from this section if available</flag>
+ <flag name='libatomic'>Use libatomic instead of builtin atomic operations</flag>
+ </use>
+</pkgmetadata>
diff --git a/sys-libs/libutempter/Manifest b/sys-libs/libutempter/Manifest
new file mode 100644
index 000000000000..e4d64562b59d
--- /dev/null
+++ b/sys-libs/libutempter/Manifest
@@ -0,0 +1,2 @@
+DIST libutempter-1.1.5.tar.bz2 14588 SHA256 73d0576b16caeb22874dc80d0ce7a6aeebb3181b117e95c147cd8d29df99e70e SHA512 12012d2bf3efa40b2afb90525883d2398105d75042cd5eac3091dd0b763107406c549038215747adcb3797edc6b2da1efe4bf31d9ab019d9e205d53a7c36492d WHIRLPOOL b61c1e0c84726e7f824ac83bc195c4d29ac236e2bab5790a559bbcacd75a97429c5458d8ff459f6257959b4f92855402273badaae4f69b9982ac26a72285e029
+DIST libutempter-1.1.6.tar.bz2 15705 SHA256 b898565f31ced7e5c1fa0a2eaa0f6ff0ed862b5fe375d26375b64bfbdfeac397 SHA512 6ada410b981d157ae20b578de8ce20997ec0446ec6de6859549b080aa65976fc9900d211600dab09dc3d0d109daabad0994a648b093b8781b442ff26ca17fede WHIRLPOOL c94d42d6929754608f9504defec3ab5b4c5c61fd0baa373e07508a11167241c07de4ecf26e14271e2c9914b731afba12ff7930e8ecd0126da1f472dccabdea30
diff --git a/sys-libs/libutempter/libutempter-1.1.5-r1.ebuild b/sys-libs/libutempter/libutempter-1.1.5-r1.ebuild
new file mode 100644
index 000000000000..c0f2ac282e8a
--- /dev/null
+++ b/sys-libs/libutempter/libutempter-1.1.5-r1.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit user multilib flag-o-matic
+
+DESCRIPTION="Library that allows non-privileged apps to write utmp (login) info, which need root access"
+HOMEPAGE="http://altlinux.org/index.php?module=sisyphus&package=libutempter"
+SRC_URI="ftp://ftp.altlinux.org/pub/people/ldv/${PN}/${P}.tar.bz2"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+IUSE="static-libs elibc_FreeBSD"
+
+RDEPEND="!sys-apps/utempter"
+
+pkg_setup() {
+ enewgroup utmp 406
+}
+
+src_prepare() {
+ local args=(
+ -e "/^libdir /s:/lib:/$(get_libdir):"
+ -e '/^libexecdir /s:=.*:= $(libdir)/misc:'
+ -e '/^CFLAGS = $(RPM_OPT_FLAGS)/d'
+ -e 's:,-stats::'
+ )
+ use static-libs || args+=(
+ -e '/^STATICLIB/d'
+ -e '/INSTALL.*STATICLIB/d'
+ )
+ sed -i "${args[@]}" Makefile || die
+}
+
+src_configure() {
+ use elibc_FreeBSD && append-libs -lutil
+ tc-export CC
+}
+
+src_compile() {
+ emake LDLIBS="${LIBS}"
+}
+
+src_install() {
+ default
+
+ fowners root:utmp /usr/$(get_libdir)/misc/utempter/utempter
+ fperms 2755 /usr/$(get_libdir)/misc/utempter/utempter
+ dodir /usr/sbin
+ dosym ../$(get_libdir)/misc/utempter/utempter /usr/sbin/utempter
+}
+
+pkg_postinst() {
+ if [ -f "${ROOT}/var/log/wtmp" ] ; then
+ chown root:utmp "${ROOT}/var/log/wtmp"
+ chmod 664 "${ROOT}/var/log/wtmp"
+ fi
+
+ if [ -f "${ROOT}/var/run/utmp" ] ; then
+ chown root:utmp "${ROOT}/var/run/utmp"
+ chmod 664 "${ROOT}/var/run/utmp"
+ fi
+}
diff --git a/sys-libs/libutempter/libutempter-1.1.5.ebuild b/sys-libs/libutempter/libutempter-1.1.5.ebuild
new file mode 100644
index 000000000000..585c9e6c2f26
--- /dev/null
+++ b/sys-libs/libutempter/libutempter-1.1.5.ebuild
@@ -0,0 +1,58 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit user multilib flag-o-matic
+
+DESCRIPTION="Library that allows non-privileged apps to write utmp (login) info, which need root access"
+HOMEPAGE="http://altlinux.org/index.php?module=sisyphus&package=libutempter"
+SRC_URI="ftp://ftp.altlinux.org/pub/people/ldv/${PN}/${P}.tar.bz2"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
+IUSE="elibc_FreeBSD"
+
+RDEPEND="!sys-apps/utempter"
+
+pkg_setup() {
+ enewgroup utmp 406
+}
+
+src_compile() {
+ use elibc_FreeBSD && append-flags -lutil
+ emake \
+ CC="$(tc-getCC)" \
+ RPM_OPT_FLAGS="${CFLAGS}" \
+ libdir=/usr/$(get_libdir) \
+ libexecdir=/usr/$(get_libdir)/misc || die
+}
+
+src_install() {
+ make \
+ DESTDIR="${D}" \
+ libdir=/usr/$(get_libdir) \
+ libexecdir=/usr/$(get_libdir)/misc \
+ includedir=/usr/include \
+ install || die
+
+ fowners root:utmp /usr/$(get_libdir)/misc/utempter/utempter
+ fperms 2755 /usr/$(get_libdir)/misc/utempter/utempter
+ dodir /usr/sbin
+ dosym ../$(get_libdir)/misc/utempter/utempter /usr/sbin/utempter
+ dodoc README
+}
+
+pkg_postinst() {
+ if [ -f "${ROOT}/var/log/wtmp" ]
+ then
+ chown root:utmp "${ROOT}/var/log/wtmp"
+ chmod 664 "${ROOT}/var/log/wtmp"
+ fi
+
+ if [ -f "${ROOT}/var/run/utmp" ]
+ then
+ chown root:utmp "${ROOT}/var/run/utmp"
+ chmod 664 "${ROOT}/var/run/utmp"
+ fi
+}
diff --git a/sys-libs/libutempter/libutempter-1.1.6-r1.ebuild b/sys-libs/libutempter/libutempter-1.1.6-r1.ebuild
new file mode 100644
index 000000000000..96710257a726
--- /dev/null
+++ b/sys-libs/libutempter/libutempter-1.1.6-r1.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit user multilib flag-o-matic
+
+DESCRIPTION="Library that allows non-privileged apps to write utmp (login) info, which need root access"
+HOMEPAGE="http://altlinux.org/index.php?module=sisyphus&package=libutempter"
+SRC_URI="ftp://ftp.altlinux.org/pub/people/ldv/${PN}/${P}.tar.bz2"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux"
+IUSE="static-libs elibc_FreeBSD"
+
+RDEPEND="!sys-apps/utempter"
+
+pkg_setup() {
+ enewgroup utmp 406
+}
+
+src_prepare() {
+ local args=(
+ -e "/^libdir /s:/usr/lib:${EPREFIX}/usr/$(get_libdir):"
+ -e '/^libexecdir /s:=.*:= $(libdir)/misc:'
+ -e '/^CFLAGS = $(RPM_OPT_FLAGS)/d'
+ -e 's:,-stats::'
+ -e "/^includedir /s:/usr/include:${EPREFIX}/usr/include:"
+ -e "/^mandir /s:=.*:= ${EPREFIX}/usr/share/man:"
+ )
+ use static-libs || args+=(
+ -e '/^STATICLIB/d'
+ -e '/INSTALL.*STATICLIB/d'
+ )
+ sed -i "${args[@]}" Makefile || die
+}
+
+src_configure() {
+ use elibc_FreeBSD && append-libs -lutil
+ tc-export CC
+}
+
+src_compile() {
+ emake LDLIBS="${LIBS}"
+}
+
+src_install() {
+ default
+
+ if ! use prefix ; then
+ fowners root:utmp /usr/$(get_libdir)/misc/utempter/utempter
+ fperms 2755 /usr/$(get_libdir)/misc/utempter/utempter
+ fi
+ dodir /usr/sbin
+ dosym ../$(get_libdir)/misc/utempter/utempter /usr/sbin/utempter
+}
+
+pkg_postinst() {
+ if [ -f "${EROOT}/var/log/wtmp" ] ; then
+ chown root:utmp "${EROOT}/var/log/wtmp"
+ chmod 664 "${EROOT}/var/log/wtmp"
+ fi
+
+ if [ -f "${EROOT}/var/run/utmp" ] ; then
+ chown root:utmp "${EROOT}/var/run/utmp"
+ chmod 664 "${EROOT}/var/run/utmp"
+ fi
+}
diff --git a/sys-libs/libutempter/libutempter-1.1.6-r2.ebuild b/sys-libs/libutempter/libutempter-1.1.6-r2.ebuild
new file mode 100644
index 000000000000..2914cd740184
--- /dev/null
+++ b/sys-libs/libutempter/libutempter-1.1.6-r2.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit user multilib flag-o-matic
+
+DESCRIPTION="Library that allows non-privileged apps to write utmp (login) info, which need root access"
+HOMEPAGE="http://altlinux.org/index.php?module=sisyphus&package=libutempter"
+SRC_URI="ftp://ftp.altlinux.org/pub/people/ldv/${PN}/${P}.tar.bz2"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux"
+IUSE="static-libs elibc_FreeBSD"
+
+RDEPEND="!sys-apps/utempter"
+
+pkg_setup() {
+ enewgroup utmp 406
+}
+
+src_prepare() {
+ local args=(
+ -e "/^libdir /s:/usr/lib:${EPREFIX}/usr/$(get_libdir):"
+ -e '/^libexecdir /s:=.*:= $(libdir)/misc:'
+ -e '/^CFLAGS = $(RPM_OPT_FLAGS)/d'
+ -e 's:,-stats::'
+ -e "/^includedir /s:/usr/include:${EPREFIX}/usr/include:"
+ -e "/^mandir /s:=.*:= ${EPREFIX}/usr/share/man:"
+ )
+ use static-libs || args+=(
+ -e '/^STATICLIB/d'
+ -e '/INSTALL.*STATICLIB/d'
+ )
+ sed -i "${args[@]}" Makefile || die
+}
+
+src_configure() {
+ use elibc_FreeBSD && append-libs -lutil
+ tc-export AR CC
+}
+
+src_compile() {
+ emake LDLIBS="${LIBS}"
+}
+
+src_install() {
+ default
+
+ if ! use prefix ; then
+ fowners root:utmp /usr/$(get_libdir)/misc/utempter/utempter
+ fperms 2755 /usr/$(get_libdir)/misc/utempter/utempter
+ fi
+ dodir /usr/sbin
+ dosym ../$(get_libdir)/misc/utempter/utempter /usr/sbin/utempter
+}
+
+pkg_postinst() {
+ if [ -f "${EROOT}/var/log/wtmp" ] ; then
+ chown root:utmp "${EROOT}/var/log/wtmp"
+ chmod 664 "${EROOT}/var/log/wtmp"
+ fi
+
+ if [ -f "${EROOT}/var/run/utmp" ] ; then
+ chown root:utmp "${EROOT}/var/run/utmp"
+ chmod 664 "${EROOT}/var/run/utmp"
+ fi
+}
diff --git a/sys-libs/libutempter/libutempter-1.1.6.ebuild b/sys-libs/libutempter/libutempter-1.1.6.ebuild
new file mode 100644
index 000000000000..c0f2ac282e8a
--- /dev/null
+++ b/sys-libs/libutempter/libutempter-1.1.6.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit user multilib flag-o-matic
+
+DESCRIPTION="Library that allows non-privileged apps to write utmp (login) info, which need root access"
+HOMEPAGE="http://altlinux.org/index.php?module=sisyphus&package=libutempter"
+SRC_URI="ftp://ftp.altlinux.org/pub/people/ldv/${PN}/${P}.tar.bz2"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+IUSE="static-libs elibc_FreeBSD"
+
+RDEPEND="!sys-apps/utempter"
+
+pkg_setup() {
+ enewgroup utmp 406
+}
+
+src_prepare() {
+ local args=(
+ -e "/^libdir /s:/lib:/$(get_libdir):"
+ -e '/^libexecdir /s:=.*:= $(libdir)/misc:'
+ -e '/^CFLAGS = $(RPM_OPT_FLAGS)/d'
+ -e 's:,-stats::'
+ )
+ use static-libs || args+=(
+ -e '/^STATICLIB/d'
+ -e '/INSTALL.*STATICLIB/d'
+ )
+ sed -i "${args[@]}" Makefile || die
+}
+
+src_configure() {
+ use elibc_FreeBSD && append-libs -lutil
+ tc-export CC
+}
+
+src_compile() {
+ emake LDLIBS="${LIBS}"
+}
+
+src_install() {
+ default
+
+ fowners root:utmp /usr/$(get_libdir)/misc/utempter/utempter
+ fperms 2755 /usr/$(get_libdir)/misc/utempter/utempter
+ dodir /usr/sbin
+ dosym ../$(get_libdir)/misc/utempter/utempter /usr/sbin/utempter
+}
+
+pkg_postinst() {
+ if [ -f "${ROOT}/var/log/wtmp" ] ; then
+ chown root:utmp "${ROOT}/var/log/wtmp"
+ chmod 664 "${ROOT}/var/log/wtmp"
+ fi
+
+ if [ -f "${ROOT}/var/run/utmp" ] ; then
+ chown root:utmp "${ROOT}/var/run/utmp"
+ chmod 664 "${ROOT}/var/run/utmp"
+ fi
+}
diff --git a/sys-libs/libutempter/metadata.xml b/sys-libs/libutempter/metadata.xml
new file mode 100644
index 000000000000..5aafc105dd09
--- /dev/null
+++ b/sys-libs/libutempter/metadata.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>base-system</herd>
+ <herd>x11</herd>
+</pkgmetadata>
diff --git a/sys-libs/libvpd/Manifest b/sys-libs/libvpd/Manifest
new file mode 100644
index 000000000000..37d4a90a5eea
--- /dev/null
+++ b/sys-libs/libvpd/Manifest
@@ -0,0 +1,2 @@
+DIST libvpd-2.1.3.tar.gz 116493 SHA256 18390b1c272c774b153615a84d4f4e683da08156daf5a0b001c3c07f54d422ae SHA512 f5aac9253752552674ac6c54dd3e6dbdd7ff79867740076d6e19782940b809e53736a11e668978d8d73bf636d92d1daeb78080e5fd31c4febc2257e5497c373c WHIRLPOOL a0f34265c865282a755092c854521d538bbb633b92ff8004a7b8f4949a91bfd924ca156edd4357f67fbf62c7456e0785887a6e62e67f385d348aae8836c4b199
+DIST libvpd-2.2.4.tar.gz 374665 SHA256 13a44a156cfe60b6ee7c1f4dc9171335657bfd5903c59a686abf1149b1b12c12 SHA512 89f7e235e957393fe33e484b23fce15fbf36274db6115e7245027a17b7535e387f835c048a7063f317f10de2351a78acf2ca72b10adee0020ce62a035bfe787e WHIRLPOOL e902455cd34262f581af2af160c9f16c542a63a5c58121116be2d6eb3bf58cc6ec2ee2074ad45959f7d0add9836129bba884d264e970ac9b62edb720f19157ec
diff --git a/sys-libs/libvpd/libvpd-2.1.3.ebuild b/sys-libs/libvpd/libvpd-2.1.3.ebuild
new file mode 100644
index 000000000000..f9bda3facce4
--- /dev/null
+++ b/sys-libs/libvpd/libvpd-2.1.3.ebuild
@@ -0,0 +1,33 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+DESCRIPTION="Library implementation for listing vpds"
+HOMEPAGE="http://sourceforge.net/projects/linux-diag/"
+SRC_URI="http://sourceforge.net/projects/linux-diag/files/libvpd/${PV}/libvpd-${PV}.tar.gz"
+
+LICENSE="IBM"
+SLOT="0"
+KEYWORDS="ppc ppc64"
+IUSE=""
+
+DEPEND=">=dev-db/sqlite-3.7.8
+ sys-libs/zlib"
+
+RDEPEND="${DEPEND}"
+
+src_unpack() {
+ unpack ${A}
+}
+
+src_configure() {
+ ./bootstrap.sh
+ econf || die "Unable to configure"
+}
+
+src_install(){
+ emake DESTDIR="${D}" install || die "Something went wrong"
+
+}
diff --git a/sys-libs/libvpd/libvpd-2.2.4.ebuild b/sys-libs/libvpd/libvpd-2.2.4.ebuild
new file mode 100644
index 000000000000..220009728d95
--- /dev/null
+++ b/sys-libs/libvpd/libvpd-2.2.4.ebuild
@@ -0,0 +1,36 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils udev
+
+DESCRIPTION="Library implementation for listing vpds"
+HOMEPAGE="http://sourceforge.net/projects/linux-diag/"
+SRC_URI="http://sourceforge.net/projects/linux-diag/files/libvpd/${PV}/libvpd-${PV}.tar.gz"
+
+LICENSE="IBM"
+SLOT="0"
+KEYWORDS="~ppc ~ppc64"
+IUSE="static-libs"
+
+DEPEND="
+ >=dev-db/sqlite-3.7.8
+ sys-libs/zlib
+"
+RDEPEND="${DEPEND}"
+
+src_configure() {
+ # sysconfdir is used only to establish where the udev rules file should go
+ # unfortunately it also adds the subdirs on its own so we strip it down to
+ # dirname
+ econf \
+ $(use_enable static-libs static) \
+ --sysconfdir="$( dirname $(get_udevdir) )"
+}
+
+src_install(){
+ emake DESTDIR="${D}" install
+ prune_libtool_files
+
+}
diff --git a/sys-libs/libvpd/metadata.xml b/sys-libs/libvpd/metadata.xml
new file mode 100644
index 000000000000..8dc591673f73
--- /dev/null
+++ b/sys-libs/libvpd/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>ppc64</herd>
+<longdescription lang="en">
+</longdescription>
+</pkgmetadata>
+
diff --git a/sys-libs/libxcrypt/Manifest b/sys-libs/libxcrypt/Manifest
new file mode 100644
index 000000000000..3efc20592ec3
--- /dev/null
+++ b/sys-libs/libxcrypt/Manifest
@@ -0,0 +1,2 @@
+DIST libxcrypt-2.0.tar.bz2 255228 SHA256 176ed37cfdd3b1fe6f9e01cb75c5f864287906bb5741d22fa586d6239ad672a8
+DIST libxcrypt_2.4.orig.tar.gz 361503 SHA256 4207aee39c4454c1955b26a3d77f33e730eae94c20406976b6de80c3a3cfb1cd SHA512 7171ce1b5b7f949232c4db94cf98bdd6396c3e2a8f2f483c041cab92d752e3a2fa93d564ede7efece57c069df129e6cc03049cf3e3f07bd3556031a7c4197cbf WHIRLPOOL 7f23673dacf2d3c6b7f8967aaeb3c2e23039a8f61149372df0dfb700ef5a316ea661be0a76a2caf63e32007a505626c13d8667885935693454bd44c7fc1849c8
diff --git a/sys-libs/libxcrypt/files/libxcrypt-2.4-glibc-2.16.patch b/sys-libs/libxcrypt/files/libxcrypt-2.4-glibc-2.16.patch
new file mode 100644
index 000000000000..150ff99ab2f9
--- /dev/null
+++ b/sys-libs/libxcrypt/files/libxcrypt-2.4-glibc-2.16.patch
@@ -0,0 +1,40 @@
+diff -urN libxcrypt-3.0.2/src/crypt_util.c libxcrypt-3.0.2.new/src/crypt_util.c
+--- libxcrypt-3.0.2/src/crypt_util.c 2007-10-25 15:17:46.000000000 +0200
++++ libxcrypt-3.0.2.new/src/crypt_util.c 2013-02-04 12:45:20.560191479 +0100
+@@ -30,8 +30,7 @@
+ #endif
+ #include <string.h>
+
+-#include <bits/libc-lock.h>
+-#define __libc_lock_t pthread_mutex_t
++#include <pthread.h>
+
+ #ifndef STATIC
+ #define STATIC static
+@@ -265,7 +264,7 @@
+ */
+ struct crypt_data _ufc_foobar;
+
+-__libc_lock_define_initialized (static, _ufc_tables_lock)
++static pthread_mutex_t _ufc_tables_lock = PTHREAD_MUTEX_INITIALIZER;
+
+ #ifdef DEBUG
+
+@@ -362,7 +361,7 @@
+ #endif
+
+ if(small_tables_initialized == 0) {
+- __libc_lock_lock (_ufc_tables_lock);
++ pthread_mutex_lock (&_ufc_tables_lock);
+ if(small_tables_initialized)
+ goto small_tables_done;
+
+@@ -471,7 +470,7 @@
+ }
+ small_tables_initialized = 1;
+ small_tables_done:
+- __libc_lock_unlock(_ufc_tables_lock);
++ pthread_mutex_unlock (&_ufc_tables_lock);
+ }
+
+ /*
diff --git a/sys-libs/libxcrypt/libxcrypt-2.0.ebuild b/sys-libs/libxcrypt/libxcrypt-2.0.ebuild
new file mode 100644
index 000000000000..be3c47039c60
--- /dev/null
+++ b/sys-libs/libxcrypt/libxcrypt-2.0.ebuild
@@ -0,0 +1,16 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+DESCRIPTION="A replacement for libcrypt with DES, MD5 and blowfish support"
+SRC_URI="mirror://gentoo/${P}.tar.bz2"
+HOMEPAGE="http://www.suse.de/us/private/products/suse_linux/i386/packages_personal/libxcrypt.html"
+
+LICENSE="LGPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+src_install() {
+ emake DESTDIR="${D}" install || die
+}
diff --git a/sys-libs/libxcrypt/libxcrypt-2.4.ebuild b/sys-libs/libxcrypt/libxcrypt-2.4.ebuild
new file mode 100644
index 000000000000..80a18741df72
--- /dev/null
+++ b/sys-libs/libxcrypt/libxcrypt-2.4.ebuild
@@ -0,0 +1,29 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils multilib
+
+DESCRIPTION="A replacement for libcrypt with DES, MD5 and blowfish support"
+SRC_URI="mirror://debian/pool/main/libx/${PN}/${PN}_${PV}.orig.tar.gz"
+HOMEPAGE="http://packages.debian.org/sid/libxcrypt1"
+
+LICENSE="LGPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}-2.4-glibc-2.16.patch"
+}
+
+src_configure() {
+ # Do not install into /usr so that tcb and pam can use us.
+ econf --libdir=/$(get_libdir) --disable-static
+}
+
+src_install() {
+ default
+ prune_libtool_files
+}
diff --git a/sys-libs/libxcrypt/metadata.xml b/sys-libs/libxcrypt/metadata.xml
new file mode 100644
index 000000000000..8f5a0e9c8006
--- /dev/null
+++ b/sys-libs/libxcrypt/metadata.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>hardened</herd>
+ <longdescription>
+ Crypt library for DES, MD5, and blowfish. Libxcrypt is a replacement for
+ libcrypt, which comes with the GNU C Library. It supports DES crypt,
+ MD5, and passwords with blowfish encryption.
+ </longdescription>
+</pkgmetadata>
diff --git a/sys-libs/lrmi/Manifest b/sys-libs/lrmi/Manifest
new file mode 100644
index 000000000000..0a1b978a4dc9
--- /dev/null
+++ b/sys-libs/lrmi/Manifest
@@ -0,0 +1 @@
+DIST lrmi-0.10.tar.gz 10271 SHA256 b0be55c14407f586dc10836e8f348b3a002c461a9b47a302071eac0ef85770da
diff --git a/sys-libs/lrmi/files/lrmi-0.10-kernel-2.6.26.patch b/sys-libs/lrmi/files/lrmi-0.10-kernel-2.6.26.patch
new file mode 100644
index 000000000000..9547439376a3
--- /dev/null
+++ b/sys-libs/lrmi/files/lrmi-0.10-kernel-2.6.26.patch
@@ -0,0 +1,18 @@
+diff -Naurp lrmi-0.10-orig/lrmi.c lrmi-0.10/lrmi.c
+--- lrmi-0.10-orig/lrmi.c 2008-08-23 14:39:44.000000000 +0200
++++ lrmi-0.10/lrmi.c 2008-08-23 14:40:25.000000000 +0200
+@@ -61,6 +61,14 @@ OTHER DEALINGS IN THE SOFTWARE.
+
+ #include "lrmi.h"
+
++/* 2.6.26+ kernels don't define the legacy masks. */
++#if defined(__linux__) && !defined(TF_MASK)
++ #define TF_MASK X86_EFLAGS_TF
++ #define IF_MASK X86_EFLAGS_IF
++ #define VIF_MASK X86_EFLAGS_VIF
++ #define IOPL_MASK X86_EFLAGS_IOPL
++#endif
++
+ #define REAL_MEM_BASE ((void *)0x10000)
+ #define REAL_MEM_SIZE 0x40000
+ #define REAL_MEM_BLOCKS 0x100
diff --git a/sys-libs/lrmi/files/lrmi-0.10-ldflags.patch b/sys-libs/lrmi/files/lrmi-0.10-ldflags.patch
new file mode 100644
index 000000000000..b23bd9c5cdf8
--- /dev/null
+++ b/sys-libs/lrmi/files/lrmi-0.10-ldflags.patch
@@ -0,0 +1,26 @@
+diff -Naurp lrmi-0.10-orig/Makefile lrmi-0.10/Makefile
+--- lrmi-0.10-orig/Makefile 2010-08-20 15:03:17.093144820 +0200
++++ lrmi-0.10/Makefile 2010-08-20 15:03:47.761144267 +0200
+@@ -2,6 +2,7 @@ LIBDIR ?= /usr/local/lib
+ INCDIR ?= /usr/local/include
+
+ CFLAGS = -g -Wall
++LDFLAGS =
+
+ sources = lrmi.c
+ objects = lrmi.o
+@@ -26,12 +27,12 @@ liblrmi.a: $(objects)
+
+ liblrmi.so: $(pic_objects)
+ # $(CC) $(CPPFLAGS) $(CFLAGS) -fPIC -shared -o $@ $^
+- $(CC) $(CPPFLAGS) $(CFLAGS) -Wl,-soname,$(LIBNAME).so.$(MAJOR) -fPIC -shared -o $(LIBNAME).so.$(VERSION) $^
++ $(CC) $(CPPFLAGS) $(CFLAGS) -Wl,-soname,$(LIBNAME).so.$(MAJOR) $(LDFLAGS) -fPIC -shared -o $(LIBNAME).so.$(VERSION) $^
+ ln -sf $(LIBNAME).so.$(VERSION) $(LIBNAME).so.$(MAJOR)
+ ln -sf $(LIBNAME).so.$(MAJOR) $(LIBNAME).so
+
+ vbetest: vbetest.c liblrmi.a
+- $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^
++ $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^
+
+ install:
+ mkdir -p $(LIBDIR)
diff --git a/sys-libs/lrmi/lrmi-0.10-r1.ebuild b/sys-libs/lrmi/lrmi-0.10-r1.ebuild
new file mode 100644
index 000000000000..80b90c630046
--- /dev/null
+++ b/sys-libs/lrmi/lrmi-0.10-r1.ebuild
@@ -0,0 +1,37 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils toolchain-funcs
+
+DESCRIPTION="library for calling real mode BIOS routines under Linux"
+HOMEPAGE="http://www.sourceforge.net/projects/lrmi/"
+SRC_URI="mirror://sourceforge/lrmi/${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="x86"
+IUSE=""
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epatch "${FILESDIR}"/${P}-kernel-2.6.26.patch
+ epatch "${FILESDIR}"/${P}-ldflags.patch
+}
+
+src_compile() {
+ tc-export CC AR RANLIB
+ emake CFLAGS="${CFLAGS} -Wall" LDFLAGS="${LDFLAGS}" || die "emake failed."
+}
+
+src_install() {
+ dobin vbetest || die "dobin failed."
+ dolib.a liblrmi.a || die "dolib.a failed."
+ dolib.so liblrmi.so.${PV} || die "dolib.so failed."
+ dosym liblrmi.so.${PV} /usr/lib/liblrmi.so
+ dosym liblrmi.so.${PV} /usr/lib/liblrmi.so.${PV%%.*}
+
+ insinto /usr/include
+ doins lrmi.h vbe.h || die "doins failed."
+}
diff --git a/sys-libs/lrmi/metadata.xml b/sys-libs/lrmi/metadata.xml
new file mode 100644
index 000000000000..c5ea2bc11d70
--- /dev/null
+++ b/sys-libs/lrmi/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>base-system</herd>
+ <upstream>
+ <remote-id type="sourceforge">lrmi</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-libs/lwp/Manifest b/sys-libs/lwp/Manifest
new file mode 100644
index 000000000000..f20b62feaaae
--- /dev/null
+++ b/sys-libs/lwp/Manifest
@@ -0,0 +1,3 @@
+DIST lwp-2.2.tar.gz 376136 SHA256 64a3570559083bee657551b6673037161f33b71ad55ee45812612c29df2924b0
+DIST lwp-2.5.tar.gz 404121 SHA256 6b6f55c75d4d5ada9a000824b1d39bc88efa2cfb33006778ccbe7111a7bd0aa2
+DIST lwp-2.6.tar.gz 372225 SHA256 4887fd7f74564552f53dfe42440f4777808a82b1249b2733ecfd062849a4d32d SHA512 ad8374ddf55ef9fddf9ce0b8d7c2ae0dc206e5108a01f278a37486070ab70e5bd7312f057863254b4fc430cfbed2c36f589807813e6a99067933142d5225395b WHIRLPOOL 205836226f86e77dfbc795bdf667f51b2c40b99cbc7bf5b998361472b6ad46b102c519d88e1afc503b259c9073ac7b155e322d134f5787d770517f3bf3a2e54d
diff --git a/sys-libs/lwp/files/lwp-2.0-amd64.patch b/sys-libs/lwp/files/lwp-2.0-amd64.patch
new file mode 100644
index 000000000000..64a1576f0894
--- /dev/null
+++ b/sys-libs/lwp/files/lwp-2.0-amd64.patch
@@ -0,0 +1,28 @@
+diff -ruN lwp-2.0/src/lwp.c lwp-2.0-fixed/src/lwp.c
+--- lwp-2.0/src/lwp.c 2005-03-25 17:50:56.000000000 +0100
++++ lwp-2.0-fixed/src/lwp.c 2005-05-05 14:32:56.580753096 +0200
+@@ -463,6 +463,16 @@
+ #ifndef MMAP_LWP_STACKS
+ stackptr = (char *) malloc(stacksize);
+ #else
++ pagesize = getpagesize();
++
++#if defined(__x86_64__)
++ /* [gb] Ensure minimal stack size. Heuristically determined
++ through tdb test that 2048 is too small when printf() et al. come
++ into action. */
++ if (stacksize < pagesize)
++ stacksize = pagesize;
++#endif
++
+ #ifdef MAP_ANON
+ stackptr = mmap(lwp_stackbase, stacksize, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANON, -1, 0);
+@@ -483,7 +493,6 @@
+ perror("stack: ");
+ assert(0);
+ }
+- pagesize = getpagesize();
+ lwp_stackbase += ((stacksize/pagesize) + 2) * pagesize;
+ #endif
+ if (!stackptr)
diff --git a/sys-libs/lwp/lwp-2.2.ebuild b/sys-libs/lwp/lwp-2.2.ebuild
new file mode 100644
index 000000000000..8d5af861ec94
--- /dev/null
+++ b/sys-libs/lwp/lwp-2.2.ebuild
@@ -0,0 +1,33 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils
+
+DESCRIPTION="Light weight process library (used by Coda). This is NOT libwww-perl"
+HOMEPAGE="http://www.coda.cs.cmu.edu/"
+SRC_URI="http://www.coda.cs.cmu.edu/pub/lwp/src/${P}.tar.gz"
+
+SLOT="1"
+LICENSE="LGPL-2.1"
+KEYWORDS="alpha amd64 ~hppa ia64 ~mips ppc ppc64 sparc x86"
+IUSE=""
+
+DEPEND="sys-apps/grep
+ sys-apps/sed
+ sys-devel/libtool
+ sys-devel/gcc"
+RDEPEND=""
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+
+ # Was introduced for bug #34542, not sure if still needed
+ use amd64 && epatch "${FILESDIR}"/lwp-2.0-amd64.patch
+}
+
+src_install() {
+ einstall || die "einstall failed."
+ dodoc AUTHORS NEWS PORTING README
+}
diff --git a/sys-libs/lwp/lwp-2.5.ebuild b/sys-libs/lwp/lwp-2.5.ebuild
new file mode 100644
index 000000000000..4a849e035bf5
--- /dev/null
+++ b/sys-libs/lwp/lwp-2.5.ebuild
@@ -0,0 +1,33 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils
+
+DESCRIPTION="Light weight process library (used by Coda). This is NOT libwww-perl"
+HOMEPAGE="http://www.coda.cs.cmu.edu/"
+SRC_URI="http://www.coda.cs.cmu.edu/pub/lwp/src/${P}.tar.gz"
+
+SLOT="1"
+LICENSE="LGPL-2.1"
+KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
+IUSE=""
+
+DEPEND="sys-apps/grep
+ sys-apps/sed
+ sys-devel/libtool
+ sys-devel/gcc"
+RDEPEND=""
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+
+ # Was introduced for bug #34542, not sure if still needed
+ use amd64 && epatch "${FILESDIR}"/lwp-2.0-amd64.patch
+}
+
+src_install() {
+ einstall || die "einstall failed."
+ dodoc AUTHORS NEWS PORTING README
+}
diff --git a/sys-libs/lwp/lwp-2.6.ebuild b/sys-libs/lwp/lwp-2.6.ebuild
new file mode 100644
index 000000000000..8231b8ed9e95
--- /dev/null
+++ b/sys-libs/lwp/lwp-2.6.ebuild
@@ -0,0 +1,21 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils
+
+DESCRIPTION="Light weight process library (used by Coda). This is NOT libwww-perl"
+HOMEPAGE="http://www.coda.cs.cmu.edu/"
+SRC_URI="http://www.coda.cs.cmu.edu/pub/lwp/src/${P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="1"
+KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
+IUSE=""
+
+src_prepare() {
+ # Was introduced for bug #34542, not sure if still needed
+ use amd64 && epatch "${FILESDIR}"/lwp-2.0-amd64.patch
+}
diff --git a/sys-libs/lwp/metadata.xml b/sys-libs/lwp/metadata.xml
new file mode 100644
index 000000000000..ca66751dee2f
--- /dev/null
+++ b/sys-libs/lwp/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>net-fs</herd>
+</pkgmetadata>
diff --git a/sys-libs/mars/Manifest b/sys-libs/mars/Manifest
new file mode 100644
index 000000000000..815be56211b4
--- /dev/null
+++ b/sys-libs/mars/Manifest
@@ -0,0 +1 @@
+DIST mars-src-1.0.1.tar.gz 1264844 RMD160 44d6ac117c72a69e4d9282e45a72b2ada4583f5f SHA1 3aae04c489947acad8874e8a79b2e1b2972912a0 SHA256 f61e60fb219c265344e65f34976cd5db2ea55dea05b51fd7107d50f263dd5234
diff --git a/sys-libs/mars/mars-1.0.1.ebuild b/sys-libs/mars/mars-1.0.1.ebuild
new file mode 100644
index 000000000000..715f69aca959
--- /dev/null
+++ b/sys-libs/mars/mars-1.0.1.ebuild
@@ -0,0 +1,42 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit autotools
+
+MY_P=${P/mars/mars-src}
+
+DESCRIPTION="Multicore Application Runtime System"
+HOMEPAGE="ftp://ftp.infradead.org/pub/Sony-PS3/mars/"
+SRC_URI="ftp://ftp.infradead.org/pub/Sony-PS3/mars/1.0.1/${MY_P}.tar.gz"
+
+LICENSE="MIT_Plus MIT"
+SLOT="0"
+KEYWORDS="~ppc64"
+IUSE=""
+
+DEPEND="sys-libs/libspe2"
+RDEPEND="${DEPEND}"
+
+S="${WORKDIR}/${MY_P}/core"
+
+src_unpack () {
+ unpack ${A}
+ cd "${S}"
+ # repeat after me: "dummy tuples are bogus"
+ sed -i -e "s:/spu:/spu-elf:" \
+ -e "s:--host=spu:--host=spu-elf:" configure.ac
+ eautoreconf
+}
+
+src_compile () {
+ unset CFLAGS
+ unset CXXFLAGS
+ unset CFLAGS_ppc64
+ econf --with-mars-platform=cell || die
+ emake || die
+}
+
+src_install () {
+ emake -j1 DESTDIR="${D}" install
+}
diff --git a/sys-libs/mars/metadata.xml b/sys-libs/mars/metadata.xml
new file mode 100644
index 000000000000..6eb35690d41d
--- /dev/null
+++ b/sys-libs/mars/metadata.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer>
+ <email>lu_zero@gentoo.org</email>
+</maintainer>
+</pkgmetadata>
diff --git a/sys-libs/metadata.xml b/sys-libs/metadata.xml
new file mode 100644
index 000000000000..bb3bb995d357
--- /dev/null
+++ b/sys-libs/metadata.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE catmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<catmetadata>
+ <longdescription lang="en">
+ The sys-libs category contains various system-level libraries.
+ </longdescription>
+ <longdescription lang="es">
+ La categoría sys-libs contiene varias librerías del sistema.
+ </longdescription>
+ <longdescription lang="de">
+ Die Kategorie sys-libs enthält verschiedene Systembibliotheken.
+ </longdescription>
+ <longdescription lang="ja">
+ sys-libsカテゴリには様々なシステムレベルライブラリが含まれます。
+ </longdescription>
+ <longdescription lang="nl">
+ De sys-libs categorie bevat verschillende systeembibliotheken.
+ </longdescription>
+ <longdescription lang="vi">
+ Nhóm sys-libs chứa các thư viện cấp hệ thống.
+ </longdescription>
+ <longdescription lang="it">
+ La categoria sys-libs contiene varie librerie di sistema.
+ </longdescription>
+ <longdescription lang="pt">
+ A categoria sys-libs contém várias bibliotecas de sistema.
+ </longdescription>
+ <longdescription lang="pl">
+ Kategoria sys-libs zawiera biblioteki systemowe.
+ </longdescription>
+</catmetadata>
+
diff --git a/sys-libs/mtdev/Manifest b/sys-libs/mtdev/Manifest
new file mode 100644
index 000000000000..4a7e086f3336
--- /dev/null
+++ b/sys-libs/mtdev/Manifest
@@ -0,0 +1,2 @@
+DIST mtdev-1.1.4.tar.bz2 273780 SHA256 6b59b055ff22f2b91d4284187c2515826c338b81f6f33bd90f6bedc7c1fb9a38 SHA512 75da652e720cce9efcc23c2b72a0d8050096f054eff1338e02477816e107d469a7f9c5f4973146d38d939c3515ea39e926c70cf8f2ca0372c83c75506c61732b WHIRLPOOL 7cab0a478f342d019aae9103da36c18fdef137463d820f2f688fab18639e89a7f26b721a551b295df811262bd7d2466a9a405513b033c06abb9fd386a045fec3
+DIST mtdev-1.1.5.tar.bz2 274162 SHA256 6677d5708a7948840de734d8b4675d5980d4561171c5a8e89e54adf7a13eba7f SHA512 78477a4af784e3f846df867f1428ffdc458e3ff33d465d45a84247a7e52f0e215cace397d72be64f6e641f07e0b97a930eff0e07fe9507e0138fb028a4037d6d WHIRLPOOL a0231e159b9a88ab2b46e72d64db1cfb9ae3734f8dc014c3be7bcde6e7c20b9587f0e0be83d5d37fddb5a1896f3419b58a80e97ab669993e6c01b2b1a19da1f2
diff --git a/sys-libs/mtdev/metadata.xml b/sys-libs/mtdev/metadata.xml
new file mode 100644
index 000000000000..1e9847021115
--- /dev/null
+++ b/sys-libs/mtdev/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>x11</herd>
+<maintainer>
+ <email>naota@gentoo.org</email>
+</maintainer>
+</pkgmetadata>
diff --git a/sys-libs/mtdev/mtdev-1.1.4.ebuild b/sys-libs/mtdev/mtdev-1.1.4.ebuild
new file mode 100644
index 000000000000..2b05b2dcb18e
--- /dev/null
+++ b/sys-libs/mtdev/mtdev-1.1.4.ebuild
@@ -0,0 +1,25 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+DESCRIPTION="Multitouch Protocol Translation Library"
+HOMEPAGE="http://bitmath.org/code/mtdev/"
+SRC_URI="http://bitmath.org/code/mtdev/${P}.tar.bz2"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 ~sh sparc x86"
+IUSE="static-libs"
+
+DEPEND=">=sys-kernel/linux-headers-2.6.31"
+
+src_configure() {
+ econf $(use_enable static-libs static)
+}
+
+src_install() {
+ default
+ find "${ED}" -name '*.la' -exec rm -f {} +
+}
diff --git a/sys-libs/mtdev/mtdev-1.1.5.ebuild b/sys-libs/mtdev/mtdev-1.1.5.ebuild
new file mode 100644
index 000000000000..ab9e3f74d5b8
--- /dev/null
+++ b/sys-libs/mtdev/mtdev-1.1.5.ebuild
@@ -0,0 +1,25 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+DESCRIPTION="Multitouch Protocol Translation Library"
+HOMEPAGE="http://bitmath.org/code/mtdev/"
+SRC_URI="http://bitmath.org/code/mtdev/${P}.tar.bz2"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~mips ppc ppc64 ~sh sparc x86"
+IUSE="static-libs"
+
+DEPEND=">=sys-kernel/linux-headers-2.6.31"
+
+src_configure() {
+ econf $(use_enable static-libs static)
+}
+
+src_install() {
+ default
+ find "${ED}" -name '*.la' -exec rm -f {} +
+}
diff --git a/sys-libs/musl/Manifest b/sys-libs/musl/Manifest
new file mode 100644
index 000000000000..382351b00beb
--- /dev/null
+++ b/sys-libs/musl/Manifest
@@ -0,0 +1,2 @@
+DIST musl-1.1.10.tar.gz 907181 SHA256 45bbe9b1c7f7a0f743477af1e103b6889bfe4dd9815e16f6c89f6c90831c8b7c SHA512 183a66a8cc9cd056a8387a1602dd44b502d8976642a21dd0dcef51165fa0dec8a4a124fda6c1918f402b20ad2d6037fcc188a8b174b07a0cbedf11fc2e011141 WHIRLPOOL b69737c22a77da0ff59886d8233b9b1d43228e75bfdf857a5a74ab26f4699564c5b54390bcf171a4f4d9c8fc211f4c6e9c6d4dd6802cc01a5dfe5369bbdd8158
+DIST musl-1.1.8.tar.gz 904465 SHA256 fa928506415b9c555977daaf874c190eaf7fbbd16028cc5c5f33a00a83227813 SHA512 de2f0b03fd199e2ceb9937686d1092838744dccaddb3916f9baef9cdd2621624fb3c4af2206a3366d12852d84ccc8b0b68350f9d06a9e2bcdbc0309dc05383ff WHIRLPOOL 439059ed2134614cf7ccd3b8b7a8c50c53b7aab4a8114b030a1bd2fdb12c6c57621a7ee139aafcada2500c3b0dea3b1b812d7bae7bca85243867edd520adb891
diff --git a/sys-libs/musl/files/getent b/sys-libs/musl/files/getent
new file mode 100644
index 000000000000..b7de424354b6
--- /dev/null
+++ b/sys-libs/musl/files/getent
@@ -0,0 +1,45 @@
+#!/bin/sh
+# This files is part of uClibc.
+# Distributed under the terms of the Lesser GNU General Public License v2
+#
+# Closely (not perfectly) emulate the behavior of glibc's getent utility
+#
+#passwd|shadow|group|aliases|hosts|networks|ethers|netgroup|protocols|services|rpc
+# only returns the first match (by design)
+# dns based search is not supported (hosts,networks)
+# case-insensitive matches not supported (ethers; others?)
+# may return false-positives (hosts,protocols,rpc,services,ethers)
+
+[ -z "$PATH" ] && PATH="/bin:/usr/bin" || PATH="${PATH}:/bin:/usr/bin"
+export PATH
+
+file="/etc/$1"
+case $1 in
+ passwd|group)
+ match="^$2:\|^[^:]*:[^:]*:$2:" ;;
+ shadow)
+ match="^$2:" ;;
+ networks|netgroup)
+ match="^[[:space:]]*$2\>" ;;
+ hosts|protocols|rpc|services|ethers)
+ match="\<$2\>" ;;
+ aliases)
+ match="^[[:space:]]*$2[[:space:]]*:" ;;
+ ""|-h|--help)
+ echo "USAGE: $0 database [key]"
+ exit 0 ;;
+ *)
+ echo "$0: Unknown database: $1" 1>&2
+ exit 1 ;;
+esac
+
+if [ ! -f "$file" ] ; then
+ echo "$0: Could not find database file for $1" 1>&2
+ exit 1
+fi
+
+if [ $# -eq 1 ] ; then
+ exec cat "$file"
+else
+ sed "s/#.*//; /$match/q; d" "$file" | grep . || exit 2
+fi
diff --git a/sys-libs/musl/files/ldconfig b/sys-libs/musl/files/ldconfig
new file mode 100644
index 000000000000..be0aa2b331c1
--- /dev/null
+++ b/sys-libs/musl/files/ldconfig
@@ -0,0 +1,143 @@
+#!/bin/bash -e
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+ROOT="/"
+
+LDSO_CONF="/etc/ld.so.conf"
+if [[ ! -e $LDSO_CONF ]]; then
+ echo "$LDSO_CONF not found" >&2
+ exit 1
+fi
+
+LDSO_CONF_DIR=$(dirname $LDSO_CONF)
+
+VERBOSE=0
+
+UPDATE_LINKS=1
+
+get_options() {
+ while getopts "vnNXf:C:r:p" opt "$@"; do
+ case $opt in
+ v)
+ echo "ldconfig for musl in Gentoo"
+ VERBOSE=1
+ ;;
+ r)
+ ROOT=$OPTARG
+ ;;
+ f)
+ LDSO_CONF=$OPTARG
+ ;;
+ X)
+ UPDATE_LINKS=0
+ ;;
+ \?)
+ echo "Invalid option: -$opt" >&2
+ exit 1
+ ;;
+ n|N|C|p)
+ echo "Unimplemented option: -$opt" >&2
+ exit 1
+ ;;
+ esac
+ done
+
+ if [[ $UPDATE_LINKS == 1 ]]; then
+ echo "Updating links is not implemented."
+ fi
+}
+
+
+repeated() {
+ local l=$1
+ local drs="${@:2}"
+ for m in $drs; do
+ [[ $m == $l ]] && return 0
+ done
+ return 1
+}
+
+expand() {
+ # We are assuming the ld.so.conf's 'include' is not recursive
+ local f line l
+ local glob="$LDSO_CONF_DIR/$1"
+ local drs="${@:2} "
+
+ for f in $glob; do
+ [[ ! -f $f ]] && continue
+ while read line; do
+ line=${line%%#*}
+ line=${line//:/ }
+ line=${line//,/ }
+ for l in $line; do
+ #We must add this whether or not the directory exists
+ repeated $l $drs && continue
+ drs+=" $l "
+ done
+ done < $f
+ done
+
+ echo $drs
+}
+
+read_ldso_conf() {
+ local drs=" "
+
+ while read line; do
+ # Sanitize the line - see ldconfig(8) for delimiters
+ # Note: bash read turns tabs into spaces and read already
+ # delimits on newlines with the default $IFS
+ line=${line%%#*} # Remove comments
+ line=${line//:/ } # Change colon delimiter to space
+ line=${line//,/ } # Change comma delimiter to space
+
+ next=0
+ for l in $line; do
+ if [[ $next == 1 ]]; then
+ next=0
+ drs=$(expand $l $drs)
+ elif [[ $l == "include" ]]; then
+ next=1
+ else
+ # glibc's ldconfig silently skips non directories
+ if [[ -d $l ]]; then
+ repeated $l $drs && continue
+ drs+=" $l "
+ fi
+ fi
+ done
+ done < $1
+
+ echo $drs
+}
+
+sanitize() {
+ local drs=$@
+
+ repeated "/lib" $drs || drs="/lib $drs"
+ repeated "/usr/lib" $drs || drs="/usr/lib $drs"
+
+ echo $drs
+}
+
+get_options "$@"
+drs=$(read_ldso_conf "$LDSO_CONF")
+drs=$(sanitize $drs)
+
+LDSO_PATH=$(ls /lib/ld-musl-*.so.1)
+if [[ ! -e $LDSO_PATH ]]; then
+ echo "$LDSO_PATH not found" >&2
+ exit 1
+fi
+
+LDSO_ARCH=$(basename $LDSO_PATH)
+LDSO_NAME=${LDSO_ARCH%.so.1}
+ETC_LDSO_PATH=/etc/${LDSO_NAME}.path
+
+X=$(mktemp --tmpdir=/tmp ${LDSO_NAME}.XXXXXX)
+for d in $drs; do
+ echo $d >> $X
+done
+chmod 644 $X
+mv $X $ETC_LDSO_PATH
diff --git a/sys-libs/musl/files/ldconfig.in b/sys-libs/musl/files/ldconfig.in
new file mode 100644
index 000000000000..a2921903c32c
--- /dev/null
+++ b/sys-libs/musl/files/ldconfig.in
@@ -0,0 +1,144 @@
+#!/bin/bash -e
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+ROOT="/"
+
+LDSO_CONF="/etc/ld.so.conf"
+if [[ ! -e $LDSO_CONF ]]; then
+ echo "$LDSO_CONF not found" >&2
+ exit 1
+fi
+
+LDSO_CONF_DIR=$(dirname $LDSO_CONF)
+
+VERBOSE=0
+
+UPDATE_LINKS=1
+
+get_options() {
+ while getopts "vnNXf:C:r:p" opt "$@"; do
+ case $opt in
+ v)
+ echo "ldconfig for musl in Gentoo"
+ VERBOSE=1
+ ;;
+ r)
+ ROOT=$OPTARG
+ ;;
+ f)
+ LDSO_CONF=$OPTARG
+ ;;
+ X)
+ UPDATE_LINKS=0
+ ;;
+ \?)
+ echo "Invalid option: -$opt" >&2
+ exit 1
+ ;;
+ n|N|C|p)
+ echo "Unimplemented option: -$opt" >&2
+ exit 1
+ ;;
+ esac
+ done
+
+ if [[ $UPDATE_LINKS == 1 ]]; then
+ echo "Updating links is not implemented."
+ fi
+}
+
+
+repeated() {
+ local l=$1
+ local drs="${@:2}"
+ for m in $drs; do
+ [[ $m == $l ]] && return 0
+ done
+ return 1
+}
+
+expand() {
+ # We are assuming the ld.so.conf's 'include' is not recursive
+ local f line l
+ local glob="$LDSO_CONF_DIR/$1"
+ local drs="${@:2} "
+
+ for f in $glob; do
+ [[ ! -f $f ]] && continue
+ while read line; do
+ line=${line%%#*}
+ line=${line//:/ }
+ line=${line//,/ }
+ for l in $line; do
+ #We must add this whether or not the directory exists
+ repeated $l $drs && continue
+ drs+=" $l "
+ done
+ done < $f
+ done
+
+ echo $drs
+}
+
+read_ldso_conf() {
+ local drs=" "
+
+ while read line; do
+ # Sanitize the line - see ldconfig(8) for delimiters
+ # Note: bash read turns tabs into spaces and read already
+ # delimits on newlines with the default $IFS
+ line=${line%%#*} # Remove comments
+ line=${line//:/ } # Change colon delimiter to space
+ line=${line//,/ } # Change comma delimiter to space
+
+ next=0
+ for l in $line; do
+ if [[ $next == 1 ]]; then
+ next=0
+ drs=$(expand $l $drs)
+ elif [[ $l == "include" ]]; then
+ next=1
+ else
+ # glibc's ldconfig silently skips non directories
+ if [[ -d $l ]]; then
+ repeated $l $drs && continue
+ drs+=" $l "
+ fi
+ fi
+ done
+ done < $1
+
+ echo $drs
+}
+
+sanitize() {
+ local drs=$@
+
+ repeated "/lib" $drs || drs="/lib $drs"
+ repeated "/usr/lib" $drs || drs="/usr/lib $drs"
+
+ echo $drs
+}
+
+get_options "$@"
+drs=$(read_ldso_conf "$LDSO_CONF")
+drs=$(sanitize $drs)
+
+ARCH=@@ARCH@@
+LDSO_PATH="/lib/ld-musl-${ARCH}.so.1"
+if [[ ! -e $LDSO_PATH ]]; then
+ echo "$LDSO_PATH not found" >&2
+ exit 1
+fi
+
+LDSO_ARCH=$(basename $LDSO_PATH)
+LDSO_NAME=${LDSO_ARCH%.so.1}
+ETC_LDSO_PATH=/etc/${LDSO_NAME}.path
+
+X=$(mktemp --tmpdir=/tmp ${LDSO_NAME}.XXXXXX)
+for d in $drs; do
+ echo $d >> $X
+done
+chmod 644 $X
+mv $X $ETC_LDSO_PATH
diff --git a/sys-libs/musl/files/musl-1.1.10-uselocale-0-fix.diff b/sys-libs/musl/files/musl-1.1.10-uselocale-0-fix.diff
new file mode 100644
index 000000000000..2785195dc0d0
--- /dev/null
+++ b/sys-libs/musl/files/musl-1.1.10-uselocale-0-fix.diff
@@ -0,0 +1,25 @@
+>From 63f4b9f18f3674124d8bcb119739fec85e6da005 Mon Sep 17 00:00:00 2001
+From: Timo Teräs <timo.teras@iki.fi>
+Date: Fri, 05 Jun 2015 07:39:42 +0000
+Subject: fix uselocale((locale_t)0) not to modify locale
+
+commit 68630b55c0c7219fe9df70dc28ffbf9efc8021d8 made the new locale to
+be assigned unconditonally resulting in crashes later on.
+---
+diff --git a/src/locale/uselocale.c b/src/locale/uselocale.c
+index b70a0c1..0fc5ecb 100644
+--- a/src/locale/uselocale.c
++++ b/src/locale/uselocale.c
+@@ -8,9 +8,7 @@ locale_t __uselocale(locale_t new)
+ locale_t old = self->locale;
+ locale_t global = &libc.global_locale;
+
+- if (new == LC_GLOBAL_LOCALE) new = global;
+-
+- self->locale = new;
++ if (new) self->locale = new == LC_GLOBAL_LOCALE ? global : new;
+
+ return old == global ? LC_GLOBAL_LOCALE : old;
+ }
+--
+cgit v0.9.0.3-65-g4555
diff --git a/sys-libs/musl/metadata.xml b/sys-libs/musl/metadata.xml
new file mode 100644
index 000000000000..733d904a9f88
--- /dev/null
+++ b/sys-libs/musl/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>toolchain</herd>
+ <maintainer>
+ <email>blueness@gentoo.org</email>
+ <name>Anthony G. Basile</name>
+ </maintainer>
+ <maintainer>
+ <email>lu_zero@gentoo.org</email>
+ </maintainer>
+</pkgmetadata>
diff --git a/sys-libs/musl/musl-1.1.10-r1.ebuild b/sys-libs/musl/musl-1.1.10-r1.ebuild
new file mode 100644
index 000000000000..3357f91f306c
--- /dev/null
+++ b/sys-libs/musl/musl-1.1.10-r1.ebuild
@@ -0,0 +1,130 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils flag-o-matic multilib toolchain-funcs
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://git.musl-libc.org/musl"
+ inherit git-2
+fi
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+DESCRIPTION="Lightweight, fast and simple C library focused on standards-conformance and safety"
+HOMEPAGE="http://www.musl-libc.org/"
+if [[ ${PV} != "9999" ]] ; then
+ PATCH_VER=""
+ SRC_URI="http://www.musl-libc.org/releases/${P}.tar.gz"
+ KEYWORDS="-* amd64 arm ~mips ppc x86"
+fi
+
+LICENSE="MIT LGPL-2 GPL-2"
+SLOT="0"
+IUSE="crosscompile_opts_headers-only"
+
+RDEPEND="!sys-apps/getent"
+
+is_crosscompile() {
+ [[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+ use crosscompile_opts_headers-only && is_crosscompile
+}
+
+musl_endian() {
+ # XXX: this wont work for bi-endian, but we dont have any
+ touch "${T}"/endian.s
+ $(tc-getAS ${CTARGET}) "${T}"/endian.s -o "${T}"/endian.o
+ case $(file "${T}"/endian.o) in
+ *" MSB "*) echo "";;
+ *" LSB "*) echo "el";;
+ *) echo "nfc";; # We shouldn't be here
+ esac
+}
+
+pkg_setup() {
+ if [ ${CTARGET} == ${CHOST} ] ; then
+ case ${CHOST} in
+ *-musl*) ;;
+ *) die "Use sys-devel/crossdev to build a musl toolchain" ;;
+ esac
+ fi
+
+ epatch_user
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-uselocale-0-fix.diff
+}
+
+src_configure() {
+ tc-getCC ${CTARGET}
+ just_headers && export CC=true
+
+ local sysroot
+ is_crosscompile && sysroot=/usr/${CTARGET}
+ ./configure \
+ --target=${CTARGET} \
+ --prefix=${sysroot}/usr \
+ --syslibdir=${sysroot}/lib \
+ --disable-gcc-wrapper
+}
+
+src_compile() {
+ emake include/bits/alltypes.h || die
+ just_headers && return 0
+
+ emake || die
+}
+
+src_install() {
+ local target="install"
+ just_headers && target="install-headers"
+ emake DESTDIR="${D}" ${target} || die
+ just_headers && return 0
+
+ # musl provides ldd via a sym link to its ld.so
+ local sysroot
+ is_crosscompile && sysroot=/usr/${CTARGET}
+ local ldso=$(basename "${D}"${sysroot}/lib/ld-musl-*)
+ dosym ${sysroot}/lib/${ldso} ${sysroot}/usr/bin/ldd
+
+ if [[ ${CATEGORY} != cross-* ]] ; then
+ local target=$(tc-arch) arch
+ local endian=$(musl_endian)
+ case ${target} in
+ amd64) arch="x86_64";;
+ arm) arch="armhf";; # We only have hardfloat right now
+ mips) arch="mips${endian}";;
+ ppc) arch="powerpc";;
+ x86) arch="i386";;
+ esac
+ cp "${FILESDIR}"/ldconfig.in "${T}"
+ sed -e "s|@@ARCH@@|${arch}|" "${T}"/ldconfig.in > "${T}"/ldconfig
+ into /
+ dosbin "${T}"/ldconfig
+ into /usr
+ dobin "${FILESDIR}"/getent
+ echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00musl
+ doenvd "${T}"/00musl || die
+ fi
+}
+
+pkg_postinst() {
+ is_crosscompile && return 0
+
+ [ "${ROOT}" != "/" ] && return 0
+
+ ldconfig
+ # reload init ...
+ /sbin/telinit U 2>/dev/null
+}
diff --git a/sys-libs/musl/musl-1.1.8-r2.ebuild b/sys-libs/musl/musl-1.1.8-r2.ebuild
new file mode 100644
index 000000000000..940d1e44a391
--- /dev/null
+++ b/sys-libs/musl/musl-1.1.8-r2.ebuild
@@ -0,0 +1,104 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils flag-o-matic multilib toolchain-funcs
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://git.musl-libc.org/musl"
+ inherit git-2
+fi
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+DESCRIPTION="Lightweight, fast and simple C library focused on standards-conformance and safety"
+HOMEPAGE="http://www.musl-libc.org/"
+if [[ ${PV} != "9999" ]] ; then
+ PATCH_VER=""
+ SRC_URI="http://www.musl-libc.org/releases/${P}.tar.gz"
+ KEYWORDS="-* amd64 arm ~mips ppc x86"
+fi
+
+LICENSE="MIT LGPL-2 GPL-2"
+SLOT="0"
+IUSE="crosscompile_opts_headers-only"
+
+RDEPEND="!sys-apps/getent"
+
+is_crosscompile() {
+ [[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+ use crosscompile_opts_headers-only && is_crosscompile
+}
+
+pkg_setup() {
+ if [ ${CTARGET} == ${CHOST} ] ; then
+ case ${CHOST} in
+ *-musl*) ;;
+ *) die "Use sys-devel/crossdev to build a musl toolchain" ;;
+ esac
+ fi
+
+ epatch_user
+}
+
+src_configure() {
+ tc-getCC ${CTARGET}
+ just_headers && export CC=true
+
+ local sysroot
+ is_crosscompile && sysroot=/usr/${CTARGET}
+ ./configure \
+ --target=${CTARGET} \
+ --prefix=${sysroot}/usr \
+ --syslibdir=${sysroot}/lib \
+ --disable-gcc-wrapper
+}
+
+src_compile() {
+ emake include/bits/alltypes.h || die
+ just_headers && return 0
+
+ emake || die
+}
+
+src_install() {
+ local target="install"
+ just_headers && target="install-headers"
+ emake DESTDIR="${D}" ${target} || die
+ just_headers && return 0
+
+ # musl provides ldd via a sym link to its ld.so
+ local sysroot
+ is_crosscompile && sysroot=/usr/${CTARGET}
+ local ldso=$(basename "${D}"${sysroot}/lib/ld-musl-*)
+ dosym ${sysroot}/lib/${ldso} ${sysroot}/usr/bin/ldd
+
+ if [[ ${CATEGORY} != cross-* ]] ; then
+ into /usr
+ dobin "${FILESDIR}"/getent
+ into /
+ dosbin "${FILESDIR}"/ldconfig
+ echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00musl
+ doenvd "${T}"/00musl || die
+ fi
+}
+
+pkg_postinst() {
+ is_crosscompile && return 0
+
+ [ "${ROOT}" != "/" ] && return 0
+
+ ldconfig
+ # reload init ...
+ /sbin/telinit U 2>/dev/null
+}
diff --git a/sys-libs/musl/musl-9999.ebuild b/sys-libs/musl/musl-9999.ebuild
new file mode 100644
index 000000000000..6d1ca35631a6
--- /dev/null
+++ b/sys-libs/musl/musl-9999.ebuild
@@ -0,0 +1,126 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils flag-o-matic multilib toolchain-funcs
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://git.musl-libc.org/musl"
+ inherit git-2
+fi
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+DESCRIPTION="Lightweight, fast and simple C library focused on standards-conformance and safety"
+HOMEPAGE="http://www.musl-libc.org/"
+if [[ ${PV} != "9999" ]] ; then
+ PATCH_VER=""
+ SRC_URI="http://www.musl-libc.org/releases/${P}.tar.gz"
+ KEYWORDS="-* ~amd64 ~arm ~mips ~ppc ~x86"
+fi
+
+LICENSE="MIT LGPL-2 GPL-2"
+SLOT="0"
+IUSE="crosscompile_opts_headers-only"
+
+RDEPEND="!sys-apps/getent"
+
+is_crosscompile() {
+ [[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+ use crosscompile_opts_headers-only && is_crosscompile
+}
+
+musl_endian() {
+ # XXX: this wont work for bi-endian, but we dont have any
+ touch "${T}"/endian.s
+ $(tc-getAS ${CTARGET}) "${T}"/endian.s -o "${T}"/endian.o
+ case $(file "${T}"/endian.o) in
+ *" MSB "*) echo "";;
+ *" LSB "*) echo "el";;
+ *) echo "nfc";; # We shouldn't be here
+ esac
+}
+
+pkg_setup() {
+ if [ ${CTARGET} == ${CHOST} ] ; then
+ case ${CHOST} in
+ *-musl*) ;;
+ *) die "Use sys-devel/crossdev to build a musl toolchain" ;;
+ esac
+ fi
+
+ epatch_user
+}
+
+src_configure() {
+ tc-getCC ${CTARGET}
+ just_headers && export CC=true
+
+ local sysroot
+ is_crosscompile && sysroot=/usr/${CTARGET}
+ ./configure \
+ --target=${CTARGET} \
+ --prefix=${sysroot}/usr \
+ --syslibdir=${sysroot}/lib \
+ --disable-gcc-wrapper
+}
+
+src_compile() {
+ emake include/bits/alltypes.h || die
+ just_headers && return 0
+
+ emake || die
+}
+
+src_install() {
+ local target="install"
+ just_headers && target="install-headers"
+ emake DESTDIR="${D}" ${target} || die
+ just_headers && return 0
+
+ # musl provides ldd via a sym link to its ld.so
+ local sysroot
+ is_crosscompile && sysroot=/usr/${CTARGET}
+ local ldso=$(basename "${D}"${sysroot}/lib/ld-musl-*)
+ dosym ${sysroot}/lib/${ldso} ${sysroot}/usr/bin/ldd
+
+ if [[ ${CATEGORY} != cross-* ]] ; then
+ local target=$(tc-arch) arch
+ local endian=$(musl_endian)
+ case ${target} in
+ amd64) arch="x86_64";;
+ arm) arch="armhf";; # We only have hardfloat right now
+ mips) arch="mips${endian}";;
+ ppc) arch="powerpc";;
+ x86) arch="i386";;
+ esac
+ cp "${FILESDIR}"/ldconfig.in "${T}"
+ sed -e "s|@@ARCH@@|${arch}|" "${T}"/ldconfig.in > "${T}"/ldconfig
+ into /
+ dosbin "${T}"/ldconfig
+ into /usr
+ dobin "${FILESDIR}"/getent
+ echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00musl
+ doenvd "${T}"/00musl || die
+ fi
+}
+
+pkg_postinst() {
+ is_crosscompile && return 0
+
+ [ "${ROOT}" != "/" ] && return 0
+
+ ldconfig
+ # reload init ...
+ /sbin/telinit U 2>/dev/null
+}
diff --git a/sys-libs/ncurses/Manifest b/sys-libs/ncurses/Manifest
new file mode 100644
index 000000000000..92a0d9890862
--- /dev/null
+++ b/sys-libs/ncurses/Manifest
@@ -0,0 +1 @@
+DIST ncurses-5.9.tar.gz 2826473 SHA256 9046298fb440324c9d4135ecea7879ffed8546dd1b58e59430ea07a4633f563b SHA512 d7c5e54b6d4d8b9211f0006ca8786f7609d180cc1aaebf4f25e7e35e12959779cf66447359a602daed625621ca32b0d910d67aef3eb8b6fdc3c373819a88faa1 WHIRLPOOL 069e98c6392ce9aca960c72a20f1a502387d33a4b237aaeaa95548024ce4d47b129eafbe0288d21c590e725fe71aaca21cacb300f11a660b7234cb39a777672a
diff --git a/sys-libs/ncurses/files/ncurses-5.7-nongnu.patch b/sys-libs/ncurses/files/ncurses-5.7-nongnu.patch
new file mode 100644
index 000000000000..3f4a40520009
--- /dev/null
+++ b/sys-libs/ncurses/files/ncurses-5.7-nongnu.patch
@@ -0,0 +1,11 @@
+--- ncurses-5.7/ncurses/curses.priv.h
++++ ncurses-5.7/ncurses/curses.priv.h
+@@ -1452,6 +1452,8 @@ extern NCURSES_EXPORT(void) _nc_expanded
+
+ /* charable.c */
+ #if USE_WIDEC_SUPPORT
++#include <wchar.h>
++
+ extern NCURSES_EXPORT(bool) _nc_is_charable(wchar_t);
+ extern NCURSES_EXPORT(int) _nc_to_char(wint_t);
+ extern NCURSES_EXPORT(wint_t) _nc_to_widechar(int);
diff --git a/sys-libs/ncurses/files/ncurses-5.8-gfbsd.patch b/sys-libs/ncurses/files/ncurses-5.8-gfbsd.patch
new file mode 100644
index 000000000000..0200a14462af
--- /dev/null
+++ b/sys-libs/ncurses/files/ncurses-5.8-gfbsd.patch
@@ -0,0 +1,24 @@
+we'll hijack the freebsd* case that comes later
+
+--- ncurses-5.6/aclocal.m4
++++ ncurses-5.6/aclocal.m4
+@@ -3806,7 +3806,7 @@
+ fi
+ cf_cv_rm_so_locs=yes
+ ;;
+- linux*|gnu*|k*bsd*-gnu) #(vi
++ linux*|gnu*|k*bsd*-gnu|freebsd*|dragonfly*) #(vi
+ if test "$DFT_LWR_MODEL" = "shared" ; then
+ LOCAL_LDFLAGS="-Wl,-rpath,\$(LOCAL_LIBDIR)"
+ LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
+--- ncurses-5.6/configure
++++ ncurses-5.6/configure
+@@ -3806,7 +3806,7 @@
+ fi
+ cf_cv_rm_so_locs=yes
+ ;;
+- linux*|gnu*|k*bsd*-gnu) #(vi
++ linux*|gnu*|k*bsd*-gnu|freebsd*|dragonfly*) #(vi
+ if test "$DFT_LWR_MODEL" = "shared" ; then
+ LOCAL_LDFLAGS="-Wl,-rpath,\$(LOCAL_LIBDIR)"
+ LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
diff --git a/sys-libs/ncurses/files/ncurses-5.9-fix-clang-build.patch b/sys-libs/ncurses/files/ncurses-5.9-fix-clang-build.patch
new file mode 100644
index 000000000000..0c6ca7acc4fc
--- /dev/null
+++ b/sys-libs/ncurses/files/ncurses-5.9-fix-clang-build.patch
@@ -0,0 +1,44 @@
+diff --git a/ncurses-5.9/c++/cursesf.h b/ncurses-5.9/c++/cursesf.h
+index 70a30c3..db38063 100644
+--- a/ncurses-5.9/c++/cursesf.h
++++ b/ncurses-5.9/c++/cursesf.h
+@@ -677,7 +677,7 @@ protected:
+ }
+
+ public:
+- NCursesUserForm (NCursesFormField Fields[],
++ NCursesUserForm (NCursesFormField* Fields[],
+ const T* p_UserData = STATIC_CAST(T*)(0),
+ bool with_frame=FALSE,
+ bool autoDelete_Fields=FALSE)
+@@ -686,7 +686,7 @@ public:
+ set_user (const_cast<void *>(p_UserData));
+ };
+
+- NCursesUserForm (NCursesFormField Fields[],
++ NCursesUserForm (NCursesFormField* Fields[],
+ int nlines,
+ int ncols,
+ int begin_y = 0,
+diff --git a/ncurses-5.9/c++/cursesm.h b/ncurses-5.9/c++/cursesm.h
+index d9c2273..2d5b79a 100644
+--- a/ncurses-5.9/c++/cursesm.h
++++ b/ncurses-5.9/c++/cursesm.h
+@@ -635,7 +635,7 @@ protected:
+ }
+
+ public:
+- NCursesUserMenu (NCursesMenuItem Items[],
++ NCursesUserMenu (NCursesMenuItem* Items[],
+ const T* p_UserData = STATIC_CAST(T*)(0),
+ bool with_frame=FALSE,
+ bool autoDelete_Items=FALSE)
+@@ -644,7 +644,7 @@ public:
+ set_user (const_cast<void *>(p_UserData));
+ };
+
+- NCursesUserMenu (NCursesMenuItem Items[],
++ NCursesUserMenu (NCursesMenuItem* Items[],
+ int nlines,
+ int ncols,
+ int begin_y = 0,
diff --git a/sys-libs/ncurses/files/ncurses-5.9-gcc-5.patch b/sys-libs/ncurses/files/ncurses-5.9-gcc-5.patch
new file mode 100644
index 000000000000..2448229b88e1
--- /dev/null
+++ b/sys-libs/ncurses/files/ncurses-5.9-gcc-5.patch
@@ -0,0 +1,46 @@
+https://bugs.gentoo.org/545114
+
+extracted from the upstream change (which had many unrelated commits in one)
+
+From 97bb4678dc03e753290b39bbff30ba2825df9517 Mon Sep 17 00:00:00 2001
+From: "Thomas E. Dickey" <dickey@invisible-island.net>
+Date: Sun, 7 Dec 2014 03:10:09 +0000
+Subject: [PATCH] ncurses 5.9 - patch 20141206
+
++ modify MKlib_gen.sh to work around change in development version of
+ gcc introduced here:
+ https://gcc.gnu.org/ml/gcc-patches/2014-06/msg02185.html
+ https://gcc.gnu.org/ml/gcc-patches/2014-07/msg00236.html
+ (reports by Marcus Shawcroft, Maohui Lei).
+
+diff --git a/ncurses/base/MKlib_gen.sh b/ncurses/base/MKlib_gen.sh
+index d8cc3c9..b91398c 100755
+--- a/ncurses/base/MKlib_gen.sh
++++ b/ncurses/base/MKlib_gen.sh
+@@ -474,11 +474,22 @@ sed -n -f $ED1 \
+ -e 's/gen_$//' \
+ -e 's/ / /g' >>$TMP
+
++cat >$ED1 <<EOF
++s/ / /g
++s/^ //
++s/ $//
++s/P_NCURSES_BOOL/NCURSES_BOOL/g
++EOF
++
++# A patch discussed here:
++# https://gcc.gnu.org/ml/gcc-patches/2014-06/msg02185.html
++# introduces spurious #line markers. Work around that by ignoring the system's
++# attempt to define "bool" and using our own symbol here.
++sed -e 's/bool/P_NCURSES_BOOL/g' $TMP > $ED2
++cat $ED2 >$TMP
++
+ $preprocessor $TMP 2>/dev/null \
+-| sed \
+- -e 's/ / /g' \
+- -e 's/^ //' \
+- -e 's/_Bool/NCURSES_BOOL/g' \
++| sed -f $ED1 \
+ | $AWK -f $AW2 \
+ | sed -f $ED3 \
+ | sed \
diff --git a/sys-libs/ncurses/files/ncurses-5.9-no-I-usr-include.patch b/sys-libs/ncurses/files/ncurses-5.9-no-I-usr-include.patch
new file mode 100644
index 000000000000..5c968e76c378
--- /dev/null
+++ b/sys-libs/ncurses/files/ncurses-5.9-no-I-usr-include.patch
@@ -0,0 +1,45 @@
+https://bugs.gentoo.org/522586
+
+delete the -I$includedir paths that get added to CPPFLAGS. these are never
+needed when building natively or cross-compiling and really get in the way
+in both cases (upgrades/cross-compiling/etc...).
+
+extracted from the upstream change:
+http://ncurses.scripts.mit.edu/?p=ncurses.git;a=commitdiff;h=9ee3995474454b7d956885e0fe5c8cac2ae25d42#patch5
+
+--- a/configure
++++ b/configure
+@@ -18596,33 +18596,11 @@ CPPFLAGS="$CPPFLAGS -I. -I../include"
+ if test "$srcdir" != "."; then
+ CPPFLAGS="$CPPFLAGS -I\${srcdir}/../include"
+ fi
+-if test "$GCC" != yes; then
+- CPPFLAGS="$CPPFLAGS -I\${includedir}"
+-elif test "$includedir" != "/usr/include"; then
+- if test "$includedir" = '${prefix}/include' ; then
+- if test $prefix != /usr ; then
+- CPPFLAGS="$CPPFLAGS -I\${includedir}"
+- fi
+- else
+- CPPFLAGS="$CPPFLAGS -I\${includedir}"
+- fi
+-fi
+
+ ACPPFLAGS="-I. -I../include -I../../include $ACPPFLAGS"
+ if test "$srcdir" != "."; then
+ ACPPFLAGS="-I\${srcdir}/../../include $ACPPFLAGS"
+ fi
+-if test "$GCC" != yes; then
+- ACPPFLAGS="$ACPPFLAGS -I\${includedir}"
+-elif test "$includedir" != "/usr/include"; then
+- if test "$includedir" = '${prefix}/include' ; then
+- if test $prefix != /usr ; then
+- ACPPFLAGS="$ACPPFLAGS -I\${includedir}"
+- fi
+- else
+- ACPPFLAGS="$ACPPFLAGS -I\${includedir}"
+- fi
+-fi
+
+ ### Build up pieces for makefile rules
+ echo "$as_me:18628: checking default library suffix" >&5
diff --git a/sys-libs/ncurses/files/ncurses-5.9-pkg-config.patch b/sys-libs/ncurses/files/ncurses-5.9-pkg-config.patch
new file mode 100644
index 000000000000..7c3c04a449f8
--- /dev/null
+++ b/sys-libs/ncurses/files/ncurses-5.9-pkg-config.patch
@@ -0,0 +1,26 @@
+disable the $PATH search for the PKG_CONFIG tool. it isn't needed and just
+gets in the way when setting to a value that might not yet exist.
+
+disable the existence test for the PKG_CONFIG_LIBDIR dir. it breaks when you
+cross-compile for an ABI that doesn't exist in the root dir (--build).
+
+--- a/configure
++++ b/configure
+@@ -3582,7 +3582,7 @@ fi
+ esac
+
+ test -z "$PKG_CONFIG" && PKG_CONFIG=none
+-if test "$PKG_CONFIG" != none ; then
++if false ; then
+
+ if test "x$prefix" != xNONE; then
+ cf_path_syntax="$prefix"
+@@ -3626,7 +3626,7 @@ echo $ECHO_N "checking if we should install .pc files for $PKG_CONFIG... $ECHO_C
+ PKG_CONFIG_LIBDIR=`echo "$PKG_CONFIG" | sed -e 's,/[^/]*/[^/]*$,,'`/lib/pkgconfig
+ fi
+ PKG_CONFIG_LIBDIR=`echo "$PKG_CONFIG_LIBDIR" | sed -e 's/^://' -e 's/:.*//'`
+- if test -n "$PKG_CONFIG_LIBDIR" && test -d "$PKG_CONFIG_LIBDIR" ; then
++ if test -n "$PKG_CONFIG_LIBDIR" ; then
+
+ # Check whether --enable-pc-files or --disable-pc-files was given.
+ if test "${enable_pc_files+set}" = set; then
diff --git a/sys-libs/ncurses/files/ncurses-5.9-rxvt-unicode-9.15.patch b/sys-libs/ncurses/files/ncurses-5.9-rxvt-unicode-9.15.patch
new file mode 100644
index 000000000000..b6d1924cbe7e
--- /dev/null
+++ b/sys-libs/ncurses/files/ncurses-5.9-rxvt-unicode-9.15.patch
@@ -0,0 +1,191 @@
+Add rxvt-unicode terminfo, required by rxvt-unicode to function properly.
+
+Providing this in ncurses makes it widely available, much better than having to
+install rxvt-unicode everywhere.
+
+http://bugs.gentoo.org/show_bug.cgi?id=192083
+
+This patch uses the updated rxvt-unicode-9.15 terminfo
+which includes 256 color support and fixes Gentoo bug 383871
+
+http://bugs.gentoo.org/show_bug.cgi?id=383871
+
+--- misc/terminfo.src
++++ misc/terminfo.src
+@@ -4208,6 +4208,176 @@
+ rxvt-16color|xterm with 16 colors like aixterm,
+ ncv#32, use=ibm+16color, use=rxvt,
+
++# From: Thomas Dickey <dickey@clark.net> 04 Oct 1997
++# Updated: Özgür Kesim <kesim@math.fu-berlin.de> 02 Nov 1997
++# Updated: Marc Lehmann <schmorp@schmorp.de>, 17 Feb 2005
++# Updated: Marc Lehmann <schmorp@schmorp.de>, 04 Nov 2008: change init/reset sequences
++rxvt-unicode|rxvt-unicode terminal (X Window System),
++ am,
++ bce,
++ eo,
++ km,
++ msgr,
++ xenl,
++ hs,
++ cols#80,
++ it#8,
++ lines#24,
++ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~-A.B+C\,D0EhFiG,
++ bel=^G,
++ blink=\E[5m,
++ bold=\E[1m,
++ civis=\E[?25l,
++ clear=\E[H\E[2J,
++ cnorm=\E[?25h,
++ cr=^M,
++ csr=\E[%i%p1%d;%p2%dr,
++ cub=\E[%p1%dD,
++ cub1=^H,
++ cud=\E[%p1%dB,
++ cud1=^J,
++ cuf=\E[%p1%dC,
++ cuf1=\E[C,
++ cup=\E[%i%p1%d;%p2%dH,
++ cuu=\E[%p1%dA,
++ cuu1=\E[A,
++ cvvis=\E[?25h,
++ dch=\E[%p1%dP,
++ dch1=\E[P,
++ dl=\E[%p1%dM,
++ dl1=\E[M,
++ ed=\E[J,
++ el=\E[K,
++ el1=\E[1K,
++ flash=\E[?5h$<20/>\E[?5l,
++ home=\E[H,
++ hpa=\E[%i%p1%dG,
++ ht=^I,
++ hts=\EH,
++ ich=\E[%p1%d@,
++ ich1=\E[@,
++ il=\E[%p1%dL,
++ il1=\E[L,
++ ind=^J,
++ is1=\E[\041p,
++ is2=\E[r\E[m\E[2J\E[?7;25h\E[?1;3;4;5;6;9;66;1000;1001;1049l\E[4l,
++ kDC=\E[3$,
++ kIC=\E[2$,
++ kEND=\E[8$,
++ kHOM=\E[7$,
++ kLFT=\E[d,
++ kNXT=\E[6$,
++ kPRV=\E[5$,
++ kRIT=\E[c,
++ kbs=\177,
++ ka1=\EOw,
++ ka3=\EOy,
++ kb2=\EOu,
++ kc1=\EOq,
++ kc3=\EOs,
++ kcbt=\E[Z,
++ kcub1=\E[D,
++ kcud1=\E[B,
++ kcuf1=\E[C,
++ kcuu1=\E[A,
++ kdch1=\E[3~,
++ kel=\E[8\^,
++ kend=\E[8~,
++ kent=\EOM,
++ kf1=\E[11~,
++ kf10=\E[21~,
++ kf11=\E[23~,
++ kf12=\E[24~,
++ kf13=\E[25~,
++ kf14=\E[26~,
++ kf15=\E[28~,
++ kf16=\E[29~,
++ kf17=\E[31~,
++ kf18=\E[32~,
++ kf19=\E[33~,
++ kf2=\E[12~,
++ kf20=\E[34~,
++ kf3=\E[13~,
++ kf4=\E[14~,
++ kf5=\E[15~,
++ kf6=\E[17~,
++ kf7=\E[18~,
++ kf8=\E[19~,
++ kf9=\E[20~,
++ kfnd=\E[1~,
++ khome=\E[7~,
++ kich1=\E[2~,
++ kmous=\E[M,
++ knp=\E[6~,
++ kpp=\E[5~,
++ kslt=\E[4~,
++ rc=\E8,
++ rev=\E[7m,
++ ri=\EM,
++ rmso=\E[27m,
++ rmul=\E[24m,
++ rs1=\Ec,
++ rs2=\E[r\E[m\E[?7;25h\E[?1;3;4;5;6;9;66;1000;1001;1049l\E[4l,
++ sgr0=\E[m\E(B,
++ enacs=,
++ smacs=\E(0,
++ rmacs=\E(B,
++ smso=\E[7m,
++ smul=\E[4m,
++ tbc=\E[3g,
++ vpa=\E[%i%p1%dd,
++ colors#88,
++ pairs#7744,
++ btns#5,
++ lm#0,
++ ccc,
++ npc,
++ mc5i,
++ ncv#0,
++ mir,
++ xon,
++ bw,
++ ech=\E[%p1%dX,
++ mc0=\E[i,
++ mc4=\E[4i,
++ mc5=\E[5i,
++ sitm=\E[3m,
++ ritm=\E[23m,
++ smam=\E[?7h,
++ rmam=\E[?7l,
++ smir=\E[4h,
++ rmir=\E[4l,
++ smcup=\E[?1049h,
++ rmcup=\E[r\E[?1049l,
++ smkx=\E=,
++ rmkx=\E>,
++ indn=\E[%p1%dS,
++ rin=\E[%p1%dT,
++ sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\E(0%e\E(B%;,
++ op=\E[39;49m,
++ setaf=\E[38;5;%p1%dm,
++ setab=\E[48;5;%p1%dm,
++ setf=%?%p1%{7}%>%t\E[38;5;%p1%dm%e\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m%;,
++ setb=%?%p1%{7}%>%t\E[48;5;%p1%dm%e\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m%;,
++ initc=\E]4;%p1%d;rgb\:%p2%{65535}%*%{1000}%/%4.4X/%p3%{65535}%*%{1000}%/%4.4X/%p4%{65535}%*%{1000}%/%4.4X\E\\,
++ sc=\E7,
++ s0ds=\E(B,
++ s1ds=\E(0,
++ s2ds=\E*B,
++ s3ds=\E+B,
++ u6=\E[%i%d;%dR,
++ u7=\E[6n,
++ u8=\E[?1;2c,
++ u9=\E[c,
++ tsl=\E]2;,
++ fsl=\007,
++ dsl=\E]2;\007,
++
++rxvt-unicode-256color|rxvt-unicode terminal with 256 colors (X Window System),
++ colors#256,
++ pairs#32767,
++ use=rxvt-unicode,
++
+ # mrxvt 0.5.4
+ #
+ # mrxvt is based on rxvt 2.7.11, but has by default XTERM_FKEYS defined, which
diff --git a/sys-libs/ncurses/metadata.xml b/sys-libs/ncurses/metadata.xml
new file mode 100644
index 000000000000..78563648f103
--- /dev/null
+++ b/sys-libs/ncurses/metadata.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>base-system</herd>
+<use>
+ <flag name='ada'>Add bindings for the ADA programming language</flag>
+ <flag name='tinfo'>
+ Build curses library (libncurses) sep from the low-level terminfo
+ library (libtinfo) -- usually needed only for binary packages -- but
+ it is binary compatible in either mode
+ </flag>
+ <flag name='trace'>Enable test trace() support in ncurses calls</flag>
+</use>
+</pkgmetadata>
diff --git a/sys-libs/ncurses/ncurses-5.9-r3.ebuild b/sys-libs/ncurses/ncurses-5.9-r3.ebuild
new file mode 100644
index 000000000000..18038340a7e9
--- /dev/null
+++ b/sys-libs/ncurses/ncurses-5.9-r3.ebuild
@@ -0,0 +1,224 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+inherit eutils flag-o-matic toolchain-funcs multilib-minimal
+
+MY_PV=${PV:0:3}
+PV_SNAP=${PV:4}
+MY_P=${PN}-${MY_PV}
+DESCRIPTION="console display library"
+HOMEPAGE="http://www.gnu.org/software/ncurses/ http://dickey.his.com/ncurses/"
+SRC_URI="mirror://gnu/ncurses/${MY_P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="5"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 s390 ~sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE="ada +cxx debug doc gpm minimal profile static-libs tinfo trace unicode"
+
+DEPEND="gpm? ( sys-libs/gpm )"
+# berkdb? ( sys-libs/db )"
+RDEPEND="${DEPEND}
+ !<x11-terms/rxvt-unicode-9.06-r3
+ abi_x86_32? (
+ !<=app-emulation/emul-linux-x86-baselibs-20130224-r12
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ )"
+# Put the MULTILIB_USEDEP on gpm in PDEPEND only to avoid circular deps.
+# We can move it to DEPEND and drop the --with-gpm=libgpm.so.1 from the econf
+# line below once we can assume multilib gpm is available everywhere.
+PDEPEND="gpm? ( sys-libs/gpm[${MULTILIB_USEDEP}] )"
+
+S=${WORKDIR}/${MY_P}
+HOSTTIC_DIR=${WORKDIR}/${P}-host
+
+src_prepare() {
+ [[ -n ${PV_SNAP} ]] && epatch "${WORKDIR}"/${MY_P}-${PV_SNAP}-patch.sh
+ epatch "${FILESDIR}"/${PN}-5.8-gfbsd.patch
+ epatch "${FILESDIR}"/${PN}-5.7-nongnu.patch
+ epatch "${FILESDIR}"/${PN}-5.9-rxvt-unicode-9.15.patch #192083 #383871
+ epatch "${FILESDIR}"/${PN}-5.9-fix-clang-build.patch #417763
+ epatch "${FILESDIR}"/${PN}-5.9-pkg-config.patch
+}
+
+src_configure() {
+ unset TERMINFO #115036
+ tc-export_build_env BUILD_{CC,CPP}
+ BUILD_CPPFLAGS+=" -D_GNU_SOURCE" #214642
+
+ # when cross-compiling, we need to build up our own tic
+ # because people often don't keep matching host/target
+ # ncurses versions #249363
+ if tc-is-cross-compiler && ! ROOT=/ has_version ~sys-libs/${P} ; then
+ CHOST=${CBUILD} \
+ CFLAGS=${BUILD_CFLAGS} \
+ CXXFLAGS=${BUILD_CXXFLAGS} \
+ CPPFLAGS=${BUILD_CPPFLAGS} \
+ LDFLAGS="${BUILD_LDFLAGS} -static" \
+ BUILD_DIR="${HOSTTIC_DIR}" do_configure cross --without-shared --with-normal
+ fi
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ do_configure narrowc
+ use unicode && do_configure widec --enable-widec --includedir="${EPREFIX}"/usr/include/ncursesw
+}
+
+do_configure() {
+ ECONF_SOURCE=${S}
+
+ mkdir "${BUILD_DIR}"-$1
+ cd "${BUILD_DIR}"-$1 || die
+ shift
+
+ local conf=(
+ # We need the basic terminfo files in /etc, bug #37026. We will
+ # add '--with-terminfo-dirs' and then populate /etc/terminfo in
+ # src_install() ...
+ --with-terminfo-dirs="${EPREFIX}/etc/terminfo:${EPREFIX}/usr/share/terminfo"
+
+ # Disabled until #245417 is sorted out.
+ #$(use_with berkdb hashed-db)
+
+ # ncurses is dumb and doesn't install .pc files unless pkg-config
+ # is also installed. Force the tests to go our way. Note that it
+ # doesn't actually use pkg-config ... it just looks for set vars.
+ --enable-pc-files
+ --with-pkg-config="$(tc-getPKG_CONFIG)"
+ # This path is used to control where the .pc files are installed.
+ PKG_CONFIG_LIBDIR="${EPREFIX}/usr/$(get_libdir)/pkgconfig"
+
+ # Now the rest of the various standard flags.
+ --with-shared
+ --without-hashed-db
+ $(use_with ada)
+ $(use_with cxx)
+ $(use_with cxx cxx-binding)
+ $(use_with debug)
+ $(use_with profile)
+ $(use_with gpm)
+ $(multilib_is_native_abi || use_with gpm gpm libgpm.so.1)
+ --disable-termcap
+ --enable-symlinks
+ --with-rcs-ids
+ --with-manpage-format=normal
+ --enable-const
+ --enable-colorfgbg
+ --enable-echo
+ $(use_enable !ada warnings)
+ $(use_with debug assertions)
+ $(use_enable debug leaks)
+ $(use_with debug expanded)
+ $(use_with !debug macros)
+ $(use_with trace)
+ $(use_with tinfo termlib)
+
+ # The chtype/mmask-t settings below are to retain ABI compat
+ # with ncurses-5.4 so dont change em !
+ --with-chtype=long
+ --with-mmask-t=long
+ --disable-ext-colors
+ --disable-ext-mouse
+ --without-pthread
+ --without-reentrant
+ )
+
+ econf "${conf[@]}" "$@"
+}
+
+src_compile() {
+ # when cross-compiling, we need to build up our own tic
+ # because people often don't keep matching host/target
+ # ncurses versions #249363
+ if tc-is-cross-compiler && ! ROOT=/ has_version ~sys-libs/${P} ; then
+ make_flags="-C progs tic"
+ BUILD_DIR="${HOSTTIC_DIR}" do_compile cross
+ fi
+
+ multilib-minimal_src_compile
+}
+
+multilib_src_compile() {
+ make_flags=""
+ multilib_is_native_abi || make_flags="PROGS= "
+ do_compile narrowc
+ use unicode && do_compile widec
+}
+
+do_compile() {
+ cd "${BUILD_DIR}"-$1 || die
+
+ # A little hack to fix parallel builds ... they break when
+ # generating sources so if we generate the sources first (in
+ # non-parallel), we can then build the rest of the package
+ # in parallel. This is not really a perf hit since the source
+ # generation is quite small.
+ emake -j1 sources
+ # For some reason, sources depends on pc-files which depends on
+ # compiled libraries which depends on sources which ...
+ # Manually delete the pc-files file so the install step will
+ # create the .pc files we want.
+ rm -f misc/pc-files
+ emake ${make_flags}
+}
+
+multilib_src_install() {
+ # use the cross-compiled tic (if need be) #249363
+ export PATH="${HOSTTIC_DIR}-cross/progs:${PATH}"
+
+ # install unicode version second so that the binaries in /usr/bin
+ # support both wide and narrow
+ cd "${BUILD_DIR}"-narrowc || die
+ emake DESTDIR="${D}" install
+ if use unicode ; then
+ cd "${BUILD_DIR}"-widec || die
+ emake DESTDIR="${D}" install
+ fi
+
+ # Move libncurses{,w} into /lib
+ multilib_is_native_abi && gen_usr_ldscript -a \
+ ncurses \
+ $(usex unicode 'ncursesw' '') \
+ $(use tinfo && usex unicode 'tinfow' '') \
+ $(usev tinfo)
+ if ! tc-is-static-only ; then
+ ln -sf libncurses$(get_libname) "${ED}"/usr/$(get_libdir)/libcurses$(get_libname) || die
+ fi
+ use static-libs || find "${ED}"/usr/ -name '*.a' -a '!' -name '*curses++*.a' -delete
+
+ # Build fails to create this ...
+ dosym ../share/terminfo /usr/$(get_libdir)/terminfo
+}
+
+multilib_src_install_all() {
+# if ! use berkdb ; then
+ # We need the basic terminfo files in /etc, bug #37026
+ einfo "Installing basic terminfo files in /etc..."
+ for x in ansi console dumb linux rxvt rxvt-unicode screen sun vt{52,100,102,200,220} \
+ xterm xterm-color xterm-xfree86
+ do
+ local termfile=$(find "${ED}"/usr/share/terminfo/ -name "${x}" 2>/dev/null)
+ local basedir=$(basename $(dirname "${termfile}"))
+
+ if [[ -n ${termfile} ]] ; then
+ dodir /etc/terminfo/${basedir}
+ mv ${termfile} "${ED}"/etc/terminfo/${basedir}/
+ dosym ../../../../etc/terminfo/${basedir}/${x} \
+ /usr/share/terminfo/${basedir}/${x}
+ fi
+ done
+# fi
+
+ echo "CONFIG_PROTECT_MASK=\"/etc/terminfo\"" > "${T}"/50ncurses
+ doenvd "${T}"/50ncurses
+
+ use minimal && rm -r "${ED}"/usr/share/terminfo*
+ # Because ncurses5-config --terminfo returns the directory we keep it
+ keepdir /usr/share/terminfo #245374
+
+ cd "${S}"
+ dodoc ANNOUNCE MANIFEST NEWS README* TO-DO doc/*.doc
+ use doc && dohtml -r doc/html/
+}
diff --git a/sys-libs/ncurses/ncurses-5.9-r4.ebuild b/sys-libs/ncurses/ncurses-5.9-r4.ebuild
new file mode 100644
index 000000000000..e4553aab4a7a
--- /dev/null
+++ b/sys-libs/ncurses/ncurses-5.9-r4.ebuild
@@ -0,0 +1,228 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+inherit eutils flag-o-matic toolchain-funcs multilib-minimal
+
+MY_PV=${PV:0:3}
+PV_SNAP=${PV:4}
+MY_P=${PN}-${MY_PV}
+DESCRIPTION="console display library"
+HOMEPAGE="http://www.gnu.org/software/ncurses/ http://dickey.his.com/ncurses/"
+SRC_URI="mirror://gnu/ncurses/${MY_P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="5"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE="ada +cxx debug doc gpm minimal profile static-libs tinfo trace unicode"
+
+DEPEND="gpm? ( sys-libs/gpm )"
+# berkdb? ( sys-libs/db )"
+RDEPEND="${DEPEND}
+ !<x11-terms/rxvt-unicode-9.06-r3
+ abi_x86_32? (
+ !<=app-emulation/emul-linux-x86-baselibs-20130224-r12
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ )"
+# Put the MULTILIB_USEDEP on gpm in PDEPEND only to avoid circular deps.
+# We can move it to DEPEND and drop the --with-gpm=libgpm.so.1 from the econf
+# line below once we can assume multilib gpm is available everywhere.
+PDEPEND="gpm? ( sys-libs/gpm[${MULTILIB_USEDEP}] )"
+
+S=${WORKDIR}/${MY_P}
+HOSTTIC_DIR=${WORKDIR}/${P}-host
+
+src_prepare() {
+ [[ -n ${PV_SNAP} ]] && epatch "${WORKDIR}"/${MY_P}-${PV_SNAP}-patch.sh
+ epatch "${FILESDIR}"/${PN}-5.8-gfbsd.patch
+ epatch "${FILESDIR}"/${PN}-5.7-nongnu.patch
+ epatch "${FILESDIR}"/${PN}-5.9-rxvt-unicode-9.15.patch #192083 #383871
+ epatch "${FILESDIR}"/${PN}-5.9-fix-clang-build.patch #417763
+ epatch "${FILESDIR}"/${PN}-5.9-pkg-config.patch
+ epatch "${FILESDIR}"/${P}-no-I-usr-include.patch #522586
+ epatch "${FILESDIR}"/${P}-gcc-5.patch #545114
+}
+
+src_configure() {
+ unset TERMINFO #115036
+ tc-export_build_env BUILD_{CC,CPP}
+ BUILD_CPPFLAGS+=" -D_GNU_SOURCE" #214642
+
+ # when cross-compiling, we need to build up our own tic
+ # because people often don't keep matching host/target
+ # ncurses versions #249363
+ if tc-is-cross-compiler && ! ROOT=/ has_version ~sys-libs/${P} ; then
+ CHOST=${CBUILD} \
+ CFLAGS=${BUILD_CFLAGS} \
+ CXXFLAGS=${BUILD_CXXFLAGS} \
+ CPPFLAGS=${BUILD_CPPFLAGS} \
+ LDFLAGS="${BUILD_LDFLAGS} -static" \
+ BUILD_DIR="${HOSTTIC_DIR}" do_configure cross --without-shared --with-normal
+ fi
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ do_configure narrowc
+ use unicode && do_configure widec --enable-widec --includedir="${EPREFIX}"/usr/include/ncursesw
+}
+
+do_configure() {
+ ECONF_SOURCE=${S}
+
+ mkdir "${BUILD_DIR}"-$1
+ cd "${BUILD_DIR}"-$1 || die
+ shift
+
+ local conf=(
+ # We need the basic terminfo files in /etc, bug #37026. We will
+ # add '--with-terminfo-dirs' and then populate /etc/terminfo in
+ # src_install() ...
+ --with-terminfo-dirs="${EPREFIX}/etc/terminfo:${EPREFIX}/usr/share/terminfo"
+
+ # Disabled until #245417 is sorted out.
+ #$(use_with berkdb hashed-db)
+
+ # ncurses is dumb and doesn't install .pc files unless pkg-config
+ # is also installed. Force the tests to go our way. Note that it
+ # doesn't actually use pkg-config ... it just looks for set vars.
+ --enable-pc-files
+ --with-pkg-config="$(tc-getPKG_CONFIG)"
+ # This path is used to control where the .pc files are installed.
+ PKG_CONFIG_LIBDIR="${EPREFIX}/usr/$(get_libdir)/pkgconfig"
+
+ # Now the rest of the various standard flags.
+ --with-shared
+ --without-hashed-db
+ $(use_with ada)
+ $(use_with cxx)
+ $(use_with cxx cxx-binding)
+ $(use_with debug)
+ $(use_with profile)
+ $(use_with gpm)
+ $(multilib_is_native_abi || use_with gpm gpm libgpm.so.1)
+ --disable-termcap
+ --enable-symlinks
+ --with-rcs-ids
+ --with-manpage-format=normal
+ --enable-const
+ --enable-colorfgbg
+ --enable-echo
+ $(use_enable !ada warnings)
+ $(use_with debug assertions)
+ $(use_enable !debug leaks)
+ $(use_with debug expanded)
+ $(use_with !debug macros)
+ $(use_with trace)
+ $(use_with tinfo termlib)
+
+ # The chtype/mmask-t settings below are to retain ABI compat
+ # with ncurses-5.4 so dont change em !
+ --with-chtype=long
+ --with-mmask-t=long
+ --disable-ext-colors
+ --disable-ext-mouse
+ --without-pthread
+ --without-reentrant
+ )
+
+ # Force bash until upstream rebuilds the configure script with a newer
+ # version of autotools. #545532
+ CONFIG_SHELL=/bin/bash econf "${conf[@]}" "$@"
+}
+
+src_compile() {
+ # when cross-compiling, we need to build up our own tic
+ # because people often don't keep matching host/target
+ # ncurses versions #249363
+ if tc-is-cross-compiler && ! ROOT=/ has_version ~sys-libs/${P} ; then
+ make_flags="-C progs tic"
+ BUILD_DIR="${HOSTTIC_DIR}" do_compile cross
+ fi
+
+ multilib-minimal_src_compile
+}
+
+multilib_src_compile() {
+ make_flags=""
+ multilib_is_native_abi || make_flags="PROGS= "
+ do_compile narrowc
+ use unicode && do_compile widec
+}
+
+do_compile() {
+ cd "${BUILD_DIR}"-$1 || die
+
+ # A little hack to fix parallel builds ... they break when
+ # generating sources so if we generate the sources first (in
+ # non-parallel), we can then build the rest of the package
+ # in parallel. This is not really a perf hit since the source
+ # generation is quite small.
+ emake -j1 sources
+ # For some reason, sources depends on pc-files which depends on
+ # compiled libraries which depends on sources which ...
+ # Manually delete the pc-files file so the install step will
+ # create the .pc files we want.
+ rm -f misc/pc-files
+ emake ${make_flags}
+}
+
+multilib_src_install() {
+ # use the cross-compiled tic (if need be) #249363
+ export PATH="${HOSTTIC_DIR}-cross/progs:${PATH}"
+
+ # install unicode version second so that the binaries in /usr/bin
+ # support both wide and narrow
+ cd "${BUILD_DIR}"-narrowc || die
+ emake DESTDIR="${D}" install
+ if use unicode ; then
+ cd "${BUILD_DIR}"-widec || die
+ emake DESTDIR="${D}" install
+ fi
+
+ # Move libncurses{,w} into /lib
+ multilib_is_native_abi && gen_usr_ldscript -a \
+ ncurses \
+ $(usex unicode 'ncursesw' '') \
+ $(use tinfo && usex unicode 'tinfow' '') \
+ $(usev tinfo)
+ if ! tc-is-static-only ; then
+ ln -sf libncurses$(get_libname) "${ED}"/usr/$(get_libdir)/libcurses$(get_libname) || die
+ fi
+ use static-libs || find "${ED}"/usr/ -name '*.a' -a '!' -name '*curses++*.a' -delete
+
+ # Build fails to create this ...
+ dosym ../share/terminfo /usr/$(get_libdir)/terminfo
+}
+
+multilib_src_install_all() {
+# if ! use berkdb ; then
+ # We need the basic terminfo files in /etc, bug #37026
+ einfo "Installing basic terminfo files in /etc..."
+ for x in ansi console dumb linux rxvt rxvt-unicode screen sun vt{52,100,102,200,220} \
+ xterm xterm-color xterm-xfree86
+ do
+ local termfile=$(find "${ED}"/usr/share/terminfo/ -name "${x}" 2>/dev/null)
+ local basedir=$(basename $(dirname "${termfile}"))
+
+ if [[ -n ${termfile} ]] ; then
+ dodir /etc/terminfo/${basedir}
+ mv ${termfile} "${ED}"/etc/terminfo/${basedir}/
+ dosym ../../../../etc/terminfo/${basedir}/${x} \
+ /usr/share/terminfo/${basedir}/${x}
+ fi
+ done
+# fi
+
+ echo "CONFIG_PROTECT_MASK=\"/etc/terminfo\"" > "${T}"/50ncurses
+ doenvd "${T}"/50ncurses
+
+ use minimal && rm -r "${ED}"/usr/share/terminfo*
+ # Because ncurses5-config --terminfo returns the directory we keep it
+ keepdir /usr/share/terminfo #245374
+
+ cd "${S}"
+ dodoc ANNOUNCE MANIFEST NEWS README* TO-DO doc/*.doc
+ use doc && dohtml -r doc/html/
+}
diff --git a/sys-libs/newlib/Manifest b/sys-libs/newlib/Manifest
new file mode 100644
index 000000000000..d5e19256c3f3
--- /dev/null
+++ b/sys-libs/newlib/Manifest
@@ -0,0 +1,7 @@
+DIST newlib-1.18.0.tar.gz 13598301 SHA256 d608f22b0b2e7725d2fca13cac19f34bc652d9773acadae778db9881746cb071 SHA512 67b80060fd7bb9d035c004cfbcfbc66b8c8f176366c1ce11ae68dd31b8ee3e02b59ad37ceaf6f54da3c35eeee977c462ddaff4492a27425128ee5d5898840771 WHIRLPOOL 04908a55d1e992877668b80a8e5743f433ab96b7d9f8ab0b936ff4aa27862024490e2856acb88188d7f45ecb0d2197cbc22362f8aaf10ff07b9d89d15d258906
+DIST newlib-1.19.0.tar.gz 14323667 SHA256 4f43807236b2274c220881ca69f7dc6aecc52f14bb32a6f03404d30780c25007 SHA512 041004947fbbf1a205f365512de52f9052060f35291827e38caa202c202a76e2f442bbd880abf8edd05317fe179b8c3cb94662b2688b58b3390136d6214ef6f6 WHIRLPOOL e24575945c4d2338694fb00230fa82d5081ba8bb8ddb84d68c1d9eaac778e229d2c56356b0ba5f962480478aeb39df1b4f301f60becb48e9feea923e6b57ceea
+DIST newlib-1.20.0.tar.gz 14571004 SHA256 c644b2847244278c57bec2ddda69d8fab5a7c767f3b9af69aa7aa3da823ff692 SHA512 2abf1d30980e460c4d6ffe4d1682e38403d056048e00675362256731e57fe6759d01e85bcba84258d211941926e13bf3c632ff3824931a844c8b2596e795451f WHIRLPOOL be7996e493b0f2be6992c579796ea9d6968ed3b0a4f5d9c58e1c8b255a1060df18e6ae3d7ecf3a291c5859a6c04bdd39296e9ee5811eb59e2e7646da27089f66
+DIST newlib-2.0.0.tar.gz 15868470 SHA256 49c29e9129325e7c3b221aa829743ddcd796d024440e47c80fc0d6769af72d8a SHA512 539cc6e3854a52a7871a822e35563ff0dff7124b667fd9471150b9c56f556c0bcc526dfb5503aba5160a5fb61955a3d0876df639374727d2a444b08f90dbf233 WHIRLPOOL f9fbd87e36c1bfc94cfabfdcfa3a347d611e275eafa9167f9c4b5adea6b1833b090960ba37503210146aec4060dc360f43c31dab5cb8def2d51db33fac935640
+DIST newlib-2.1.0.tar.gz 16199705 SHA256 3e4d5ab9f0508942b6231b8ade4f8e5048cf92c96ed574c2bd6bd3320a599a48 SHA512 6770864f9307abb2401a4e48f286845d3a4afc30b2ac987da4b964a5485cc3823b32d06a0abf61528e93c4ad8a3a0aa3cc1ecd3b033850e6b2bde6d9bbc9a547 WHIRLPOOL 6faba54a72c6242c694f43a7f2e62d23584fec658818201ee58e1d2954d45b58a5f4effd63f5274b99748ed7730db76e0cf2aa1ecfbdf7001f10929d7db6353c
+DIST newlib-2.2.0.20150423.tar.gz 17485660 SHA256 b1ff3642b246adc6ee546884cb9ea3b0913f17394cbf7ca4d3b82544fef759f7 SHA512 0eecaf5dbf6caf0e0fca3697dfd70e5f60ecbc0a3365852586bc40a32bd535ef0936fa7fc68fceda3426cdb9b6259de12ed00303cadeea09d95b5f1a07022bae WHIRLPOOL 37d78cf24a072819bcf098e3b384cf6fa3a11ded461d6fb12e8635169fcb8b638400622878ad947df55236957a6ce3884ad46f02f7351414842eb048ceed7d73
+DIST newlib-2.2.0.tar.gz 16521910 SHA256 f8add263b0737591aff451b12a00c262c2efac4fa87d741fa1c318fc3bb335be SHA512 ab9161f16845367c823b6709e3c5708969f29f05c77edb1cf969ff4202f358648f1e55080974599dcefed2fbced4694dc73748596e76c1aa37c50cddff6e4be3 WHIRLPOOL 8dfc23f93d774c5092d64d1482c3ecc6e3ba35395822bb1d52f5e3b86f644ee803927bff133883926f3e019cfd5d9f04ffe0dcaac20bdf144c542ba1dc3edff9
diff --git a/sys-libs/newlib/files/newlib-1.20.0-arm-targets.patch b/sys-libs/newlib/files/newlib-1.20.0-arm-targets.patch
new file mode 100644
index 000000000000..1704cc0ba7f4
--- /dev/null
+++ b/sys-libs/newlib/files/newlib-1.20.0-arm-targets.patch
@@ -0,0 +1,55 @@
+https://bugs.gentoo.org/413547
+
+From 3b98b99eaa23f242b984af8cbf4a0e707bc7eae8 Mon Sep 17 00:00:00 2001
+From: Corinna Vinschen <corinna@vinschen.de>
+Date: Thu, 23 Feb 2012 09:30:17 +0000
+Subject: [PATCH] * configure.host: Accept "arm*" host spec instead of
+ just "arm".
+
+---
+ newlib/ChangeLog | 4 ++++
+ newlib/configure.host | 8 ++++----
+ 2 files changed, 8 insertions(+), 4 deletions(-)
+
++2012-02-23 Dan Egnor <egnor@ofb.net>
+
+ * configure.host: Accept "arm*" host spec instead of just "arm".
+
+diff --git a/newlib/configure.host b/newlib/configure.host
+index a6673af..dc44e80 100644
+--- a/newlib/configure.host
++++ b/newlib/configure.host
+@@ -98,7 +98,7 @@ case "${host_cpu}" in
+ arc)
+ machine_dir=
+ ;;
+- arm)
++ arm*)
+ machine_dir=arm
+ ;;
+ avr*)
+@@ -367,7 +367,7 @@ case "${host}" in
+ arc-*-*)
+ sys_dir=arc
+ ;;
+- arm-*-*)
++ arm*-*-*)
+ sys_dir=arm
+ if [ "x${newlib_may_supply_syscalls}" = "xno" ] ; then
+ have_crt0="no"
+@@ -560,10 +560,10 @@ case "${host}" in
+ arc-*-*)
+ syscall_dir=syscalls
+ ;;
+- arm-*-pe)
++ arm*-*-pe)
+ syscall_dir=syscalls
+ ;;
+- arm-*-*)
++ arm*-*-*)
+ syscall_dir=syscalls
+ # If newlib is supplying syscalls, select which debug protocol is being used.
+ # ARM_RDP_MONITOR selects the Demon monitor.
+--
+1.7.8.5
+
diff --git a/sys-libs/newlib/files/newlib-1.20.0-cris-install.patch b/sys-libs/newlib/files/newlib-1.20.0-cris-install.patch
new file mode 100644
index 000000000000..05f571fbe258
--- /dev/null
+++ b/sys-libs/newlib/files/newlib-1.20.0-cris-install.patch
@@ -0,0 +1,13 @@
+sent upstream already
+
+--- libgloss/cris/Makefile.in
++++ libgloss/cris/Makefile.in
+@@ -228,7 +228,7 @@ install-lin:
+ *) \
+ set -e; \
+ for x in ${LIN_BSP} ${LIN_SCRIPTS} ${LIN_EXTRA}; do \
+- ${INSTALL_DATA} $$x ${tooldir}/lib${MULTISUBDIR}/$$x; \
++ ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; \
+ done;; \
+ esac
+
diff --git a/sys-libs/newlib/files/newlib-2.1.0-msp430-destdir.patch b/sys-libs/newlib/files/newlib-2.1.0-msp430-destdir.patch
new file mode 100644
index 000000000000..38fa2643dce3
--- /dev/null
+++ b/sys-libs/newlib/files/newlib-2.1.0-msp430-destdir.patch
@@ -0,0 +1,41 @@
+From 0a7009c61811b4451ff6cccda24f42ab07142603 Mon Sep 17 00:00:00 2001
+From: DJ Delorie <dj@redhat.com>
+Date: Thu, 23 Oct 2014 01:49:45 +0000
+Subject: [PATCH] 2014-10-22 Tim Harder <radhermit@gmail.com> *
+ msp430/Makefile.in: respect DESTDIR during install
+
+---
+ libgloss/ChangeLog | 4 ++++
+ libgloss/msp430/Makefile.in | 6 ++++--
+ 2 files changed, 8 insertions(+), 2 deletions(-)
+
+2014-10-22 Tim Harder <radhermit@gmail.com>
+
+ * msp430/Makefile.in: respect DESTDIR during install
+
+diff --git a/libgloss/msp430/Makefile.in b/libgloss/msp430/Makefile.in
+index d72051d..b9f5a6a 100644
+--- a/libgloss/msp430/Makefile.in
++++ b/libgloss/msp430/Makefile.in
+@@ -12,6 +12,7 @@
+
+ # Makefile for libgloss/msp430.
+
++DESTDIR =
+ VPATH = @srcdir@
+ srcdir = @srcdir@
+ objdir = .
+@@ -138,11 +139,11 @@
+
+ install: $(CRT) $(SIM_BSP) $(LIBNOSYS) $(LIB_CRT) $(SCRIPTS)
+ for c in $(CRT) $(SIM_BSP) $(LIBNOSYS) $(LIB_CRT); do \
+- $(INSTALL_DATA) $$c $(tooldir)/lib${MULTISUBDIR}/$$c ;\
++ $(INSTALL_DATA) $$c $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$$c ;\
+ done
+ for c in $(SCRIPTS); do \
+ b=`basename $$c`; \
+- $(INSTALL_DATA) $$c $(tooldir)/lib${MULTISUBDIR}/$$b ;\
++ $(INSTALL_DATA) $$c $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$$b ;\
+ done
+
+ clean mostlyclean:
diff --git a/sys-libs/newlib/metadata.xml b/sys-libs/newlib/metadata.xml
new file mode 100644
index 000000000000..c30294285aee
--- /dev/null
+++ b/sys-libs/newlib/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>toolchain</herd>
+<maintainer>
+<email>lu_zero@gentoo.org</email>
+</maintainer>
+</pkgmetadata>
diff --git a/sys-libs/newlib/newlib-1.18.0.ebuild b/sys-libs/newlib/newlib-1.18.0.ebuild
new file mode 100644
index 000000000000..d68e30774120
--- /dev/null
+++ b/sys-libs/newlib/newlib-1.18.0.ebuild
@@ -0,0 +1,72 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils flag-o-matic toolchain-funcs
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+DESCRIPTION="Newlib is a C library intended for use on embedded systems"
+HOMEPAGE="http://sourceware.org/newlib/"
+SRC_URI="ftp://sourceware.org/pub/newlib/${P}.tar.gz"
+
+LICENSE="NEWLIB LIBGLOSS GPL-2"
+[[ ${CTARGET} != ${CHOST} ]] \
+ && SLOT="${CTARGET}" \
+ || SLOT="0"
+KEYWORDS="-* ~arm ~hppa ~m68k ~mips ~ppc ~ppc64 ~sh ~sparc ~x86"
+IUSE="nls threads unicode crosscompile_opts_headers-only"
+RESTRICT="strip"
+
+NEWLIBBUILD="${WORKDIR}/build"
+
+pkg_setup() {
+ # Reject newlib-on-glibc type installs
+ if [[ ${CTARGET} == ${CHOST} ]] ; then
+ case ${CHOST} in
+ *-newlib|*-elf) ;;
+ *) die "Use sys-devel/crossdev to build a newlib toolchain" ;;
+ esac
+ fi
+}
+
+src_unpack() {
+ unpack ${A}
+ mkdir -p "${NEWLIBBUILD}"
+}
+
+src_compile() {
+ # we should fix this ...
+ unset LDFLAGS
+ CHOST=${CTARGET} strip-unsupported-flags
+
+ local myconf=""
+ [[ ${CTARGET} == "spu" ]] \
+ && myconf="${myconf} --disable-newlib-multithread" \
+ || myconf="${myconf} $(use_enable threads newlib-multithread)"
+
+ cd "${NEWLIBBUILD}"
+
+ ECONF_SOURCE=${S} \
+ econf \
+ $(use_enable unicode newlib-mb) \
+ $(use_enable nls) \
+ ${myconf} \
+ || die "econf failed"
+ emake || die "emake failed"
+}
+
+src_install() {
+ cd "${NEWLIBBUILD}"
+ emake -j1 DESTDIR="${D}" install || die
+# env -uRESTRICT CHOST=${CTARGET} prepallstrip
+ # minor hack to keep things clean
+ rm -fR "${D}"/usr/share/info
+ rm -fR "${D}"/usr/info
+}
diff --git a/sys-libs/newlib/newlib-1.19.0.ebuild b/sys-libs/newlib/newlib-1.19.0.ebuild
new file mode 100644
index 000000000000..d68e30774120
--- /dev/null
+++ b/sys-libs/newlib/newlib-1.19.0.ebuild
@@ -0,0 +1,72 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils flag-o-matic toolchain-funcs
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+DESCRIPTION="Newlib is a C library intended for use on embedded systems"
+HOMEPAGE="http://sourceware.org/newlib/"
+SRC_URI="ftp://sourceware.org/pub/newlib/${P}.tar.gz"
+
+LICENSE="NEWLIB LIBGLOSS GPL-2"
+[[ ${CTARGET} != ${CHOST} ]] \
+ && SLOT="${CTARGET}" \
+ || SLOT="0"
+KEYWORDS="-* ~arm ~hppa ~m68k ~mips ~ppc ~ppc64 ~sh ~sparc ~x86"
+IUSE="nls threads unicode crosscompile_opts_headers-only"
+RESTRICT="strip"
+
+NEWLIBBUILD="${WORKDIR}/build"
+
+pkg_setup() {
+ # Reject newlib-on-glibc type installs
+ if [[ ${CTARGET} == ${CHOST} ]] ; then
+ case ${CHOST} in
+ *-newlib|*-elf) ;;
+ *) die "Use sys-devel/crossdev to build a newlib toolchain" ;;
+ esac
+ fi
+}
+
+src_unpack() {
+ unpack ${A}
+ mkdir -p "${NEWLIBBUILD}"
+}
+
+src_compile() {
+ # we should fix this ...
+ unset LDFLAGS
+ CHOST=${CTARGET} strip-unsupported-flags
+
+ local myconf=""
+ [[ ${CTARGET} == "spu" ]] \
+ && myconf="${myconf} --disable-newlib-multithread" \
+ || myconf="${myconf} $(use_enable threads newlib-multithread)"
+
+ cd "${NEWLIBBUILD}"
+
+ ECONF_SOURCE=${S} \
+ econf \
+ $(use_enable unicode newlib-mb) \
+ $(use_enable nls) \
+ ${myconf} \
+ || die "econf failed"
+ emake || die "emake failed"
+}
+
+src_install() {
+ cd "${NEWLIBBUILD}"
+ emake -j1 DESTDIR="${D}" install || die
+# env -uRESTRICT CHOST=${CTARGET} prepallstrip
+ # minor hack to keep things clean
+ rm -fR "${D}"/usr/share/info
+ rm -fR "${D}"/usr/info
+}
diff --git a/sys-libs/newlib/newlib-1.20.0.ebuild b/sys-libs/newlib/newlib-1.20.0.ebuild
new file mode 100644
index 000000000000..767ce602672c
--- /dev/null
+++ b/sys-libs/newlib/newlib-1.20.0.ebuild
@@ -0,0 +1,77 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils flag-o-matic toolchain-funcs
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+DESCRIPTION="Newlib is a C library intended for use on embedded systems"
+HOMEPAGE="http://sourceware.org/newlib/"
+SRC_URI="ftp://sourceware.org/pub/newlib/${P}.tar.gz"
+
+LICENSE="NEWLIB LIBGLOSS GPL-2"
+[[ ${CTARGET} != ${CHOST} ]] \
+ && SLOT="${CTARGET}" \
+ || SLOT="0"
+KEYWORDS="-* ~arm ~hppa ~m68k ~mips ~ppc ~ppc64 ~sh ~sparc ~x86"
+IUSE="nls threads unicode crosscompile_opts_headers-only"
+RESTRICT="strip"
+
+NEWLIBBUILD="${WORKDIR}/build"
+
+pkg_setup() {
+ # Reject newlib-on-glibc type installs
+ if [[ ${CTARGET} == ${CHOST} ]] ; then
+ case ${CHOST} in
+ *-newlib|*-elf) ;;
+ *) die "Use sys-devel/crossdev to build a newlib toolchain" ;;
+ esac
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-cris-install.patch
+ epatch "${FILESDIR}"/${P}-arm-targets.patch #413547
+}
+
+src_configure() {
+ # we should fix this ...
+ unset LDFLAGS
+ CHOST=${CTARGET} strip-unsupported-flags
+
+ local myconf=""
+ [[ ${CTARGET} == "spu" ]] \
+ && myconf="${myconf} --disable-newlib-multithread" \
+ || myconf="${myconf} $(use_enable threads newlib-multithread)"
+
+ mkdir -p "${NEWLIBBUILD}"
+ cd "${NEWLIBBUILD}"
+
+ ECONF_SOURCE=${S} \
+ econf \
+ $(use_enable unicode newlib-mb) \
+ $(use_enable nls) \
+ ${myconf}
+}
+
+src_compile() {
+ emake -C "${NEWLIBBUILD}"
+}
+
+src_install() {
+ cd "${NEWLIBBUILD}"
+ emake -j1 DESTDIR="${D}" install
+# env -uRESTRICT CHOST=${CTARGET} prepallstrip
+ # minor hack to keep things clean
+ rm -fR "${D}"/usr/share/info
+ rm -fR "${D}"/usr/info
+}
diff --git a/sys-libs/newlib/newlib-2.0.0.ebuild b/sys-libs/newlib/newlib-2.0.0.ebuild
new file mode 100644
index 000000000000..24db8d219ced
--- /dev/null
+++ b/sys-libs/newlib/newlib-2.0.0.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit flag-o-matic toolchain-funcs
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+DESCRIPTION="Newlib is a C library intended for use on embedded systems"
+HOMEPAGE="http://sourceware.org/newlib/"
+SRC_URI="ftp://sourceware.org/pub/newlib/${P}.tar.gz"
+
+LICENSE="NEWLIB LIBGLOSS GPL-2"
+SLOT="0"
+KEYWORDS="-* arm hppa m68k ~mips ppc ppc64 sh sparc x86"
+IUSE="nls threads unicode crosscompile_opts_headers-only"
+RESTRICT="strip"
+
+NEWLIBBUILD="${WORKDIR}/build"
+
+pkg_setup() {
+ # Reject newlib-on-glibc type installs
+ if [[ ${CTARGET} == ${CHOST} ]] ; then
+ case ${CHOST} in
+ *-newlib|*-elf) ;;
+ *) die "Use sys-devel/crossdev to build a newlib toolchain" ;;
+ esac
+ fi
+}
+
+src_configure() {
+ # we should fix this ...
+ unset LDFLAGS
+ CHOST=${CTARGET} strip-unsupported-flags
+
+ local myconf=""
+ [[ ${CTARGET} == "spu" ]] \
+ && myconf="${myconf} --disable-newlib-multithread" \
+ || myconf="${myconf} $(use_enable threads newlib-multithread)"
+
+ mkdir -p "${NEWLIBBUILD}"
+ cd "${NEWLIBBUILD}"
+
+ ECONF_SOURCE=${S} \
+ econf \
+ $(use_enable unicode newlib-mb) \
+ $(use_enable nls) \
+ ${myconf}
+}
+
+src_compile() {
+ emake -C "${NEWLIBBUILD}"
+}
+
+src_install() {
+ cd "${NEWLIBBUILD}"
+ emake -j1 DESTDIR="${D}" install
+# env -uRESTRICT CHOST=${CTARGET} prepallstrip
+ # minor hack to keep things clean
+ rm -fR "${D}"/usr/share/info
+ rm -fR "${D}"/usr/info
+}
diff --git a/sys-libs/newlib/newlib-2.1.0.ebuild b/sys-libs/newlib/newlib-2.1.0.ebuild
new file mode 100644
index 000000000000..7f50e9877f0c
--- /dev/null
+++ b/sys-libs/newlib/newlib-2.1.0.ebuild
@@ -0,0 +1,75 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit flag-o-matic toolchain-funcs eutils
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+DESCRIPTION="Newlib is a C library intended for use on embedded systems"
+HOMEPAGE="http://sourceware.org/newlib/"
+SRC_URI="ftp://sourceware.org/pub/newlib/${P}.tar.gz"
+
+LICENSE="NEWLIB LIBGLOSS GPL-2"
+SLOT="0"
+KEYWORDS="-* ~arm ~hppa ~m68k ~mips ~ppc ~ppc64 ~sh ~sparc ~x86"
+IUSE="nls threads unicode crosscompile_opts_headers-only"
+RESTRICT="strip"
+
+NEWLIBBUILD="${WORKDIR}/build"
+
+pkg_setup() {
+ # Reject newlib-on-glibc type installs
+ if [[ ${CTARGET} == ${CHOST} ]] ; then
+ case ${CHOST} in
+ *-newlib|*-elf) ;;
+ *) die "Use sys-devel/crossdev to build a newlib toolchain" ;;
+ esac
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-msp430-destdir.patch
+ epatch_user
+}
+
+src_configure() {
+ # we should fix this ...
+ unset LDFLAGS
+ CHOST=${CTARGET} strip-unsupported-flags
+
+ local myconf=""
+ [[ ${CTARGET} == "spu" ]] \
+ && myconf="${myconf} --disable-newlib-multithread" \
+ || myconf="${myconf} $(use_enable threads newlib-multithread)"
+
+ mkdir -p "${NEWLIBBUILD}"
+ cd "${NEWLIBBUILD}"
+
+ ECONF_SOURCE=${S} \
+ econf \
+ $(use_enable unicode newlib-mb) \
+ $(use_enable nls) \
+ ${myconf}
+}
+
+src_compile() {
+ emake -C "${NEWLIBBUILD}"
+}
+
+src_install() {
+ cd "${NEWLIBBUILD}"
+ emake -j1 DESTDIR="${D}" install
+# env -uRESTRICT CHOST=${CTARGET} prepallstrip
+ # minor hack to keep things clean
+ rm -fR "${D}"/usr/share/info
+ rm -fR "${D}"/usr/info
+}
diff --git a/sys-libs/newlib/newlib-2.2.0.20150423.ebuild b/sys-libs/newlib/newlib-2.2.0.20150423.ebuild
new file mode 100644
index 000000000000..710990d1c8c9
--- /dev/null
+++ b/sys-libs/newlib/newlib-2.2.0.20150423.ebuild
@@ -0,0 +1,82 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit flag-o-matic toolchain-funcs eutils
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://sourceware.org/git/newlib.git"
+ inherit git-r3
+else
+ SRC_URI="ftp://sourceware.org/pub/newlib/${P}.tar.gz"
+ if [[ ${PV} != *.201[5-9]???? ]] ; then
+ KEYWORDS="-* ~arm ~hppa ~m68k ~mips ~ppc ~ppc64 ~sh ~sparc ~x86"
+ fi
+fi
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+DESCRIPTION="Newlib is a C library intended for use on embedded systems"
+HOMEPAGE="http://sourceware.org/newlib/"
+
+LICENSE="NEWLIB LIBGLOSS GPL-2"
+SLOT="0"
+IUSE="nls threads unicode crosscompile_opts_headers-only"
+RESTRICT="strip"
+
+NEWLIBBUILD="${WORKDIR}/build"
+
+pkg_setup() {
+ # Reject newlib-on-glibc type installs
+ if [[ ${CTARGET} == ${CHOST} ]] ; then
+ case ${CHOST} in
+ *-newlib|*-elf) ;;
+ *) die "Use sys-devel/crossdev to build a newlib toolchain" ;;
+ esac
+ fi
+}
+
+src_prepare() {
+ epatch_user
+}
+
+src_configure() {
+ # we should fix this ...
+ unset LDFLAGS
+ CHOST=${CTARGET} strip-unsupported-flags
+
+ local myconf=""
+ [[ ${CTARGET} == "spu" ]] \
+ && myconf="${myconf} --disable-newlib-multithread" \
+ || myconf="${myconf} $(use_enable threads newlib-multithread)"
+
+ mkdir -p "${NEWLIBBUILD}"
+ cd "${NEWLIBBUILD}"
+
+ ECONF_SOURCE=${S} \
+ econf \
+ $(use_enable unicode newlib-mb) \
+ $(use_enable nls) \
+ ${myconf}
+}
+
+src_compile() {
+ emake -C "${NEWLIBBUILD}"
+}
+
+src_install() {
+ cd "${NEWLIBBUILD}"
+ emake -j1 DESTDIR="${D}" install
+# env -uRESTRICT CHOST=${CTARGET} prepallstrip
+ # minor hack to keep things clean
+ rm -fR "${D}"/usr/share/info
+ rm -fR "${D}"/usr/info
+}
diff --git a/sys-libs/newlib/newlib-2.2.0.ebuild b/sys-libs/newlib/newlib-2.2.0.ebuild
new file mode 100644
index 000000000000..f009c8d68ea7
--- /dev/null
+++ b/sys-libs/newlib/newlib-2.2.0.ebuild
@@ -0,0 +1,83 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit flag-o-matic toolchain-funcs eutils
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://sourceware.org/git/newlib.git"
+ inherit git-r3
+else
+ SRC_URI="ftp://sourceware.org/pub/newlib/${P}.tar.gz"
+ KEYWORDS="-* arm hppa m68k ~mips ppc ppc64 sh sparc x86"
+fi
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+DESCRIPTION="Newlib is a C library intended for use on embedded systems"
+HOMEPAGE="http://sourceware.org/newlib/"
+
+LICENSE="NEWLIB LIBGLOSS GPL-2"
+SLOT="0"
+IUSE="nls threads unicode crosscompile_opts_headers-only"
+RESTRICT="strip"
+
+# Handle the SLOT changes. #497344
+RDEPEND="!<${CATEGORY}/${PN}-2.1.0"
+
+NEWLIBBUILD="${WORKDIR}/build"
+
+pkg_setup() {
+ # Reject newlib-on-glibc type installs
+ if [[ ${CTARGET} == ${CHOST} ]] ; then
+ case ${CHOST} in
+ *-newlib|*-elf) ;;
+ *) die "Use sys-devel/crossdev to build a newlib toolchain" ;;
+ esac
+ fi
+}
+
+src_prepare() {
+ epatch_user
+}
+
+src_configure() {
+ # we should fix this ...
+ unset LDFLAGS
+ CHOST=${CTARGET} strip-unsupported-flags
+
+ local myconf=""
+ [[ ${CTARGET} == "spu" ]] \
+ && myconf="${myconf} --disable-newlib-multithread" \
+ || myconf="${myconf} $(use_enable threads newlib-multithread)"
+
+ mkdir -p "${NEWLIBBUILD}"
+ cd "${NEWLIBBUILD}"
+
+ ECONF_SOURCE=${S} \
+ econf \
+ $(use_enable unicode newlib-mb) \
+ $(use_enable nls) \
+ ${myconf}
+}
+
+src_compile() {
+ emake -C "${NEWLIBBUILD}"
+}
+
+src_install() {
+ cd "${NEWLIBBUILD}"
+ emake -j1 DESTDIR="${D}" install
+# env -uRESTRICT CHOST=${CTARGET} prepallstrip
+ # minor hack to keep things clean
+ rm -fR "${D}"/usr/share/info
+ rm -fR "${D}"/usr/info
+}
diff --git a/sys-libs/newlib/newlib-9999.ebuild b/sys-libs/newlib/newlib-9999.ebuild
new file mode 100644
index 000000000000..710990d1c8c9
--- /dev/null
+++ b/sys-libs/newlib/newlib-9999.ebuild
@@ -0,0 +1,82 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit flag-o-matic toolchain-funcs eutils
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://sourceware.org/git/newlib.git"
+ inherit git-r3
+else
+ SRC_URI="ftp://sourceware.org/pub/newlib/${P}.tar.gz"
+ if [[ ${PV} != *.201[5-9]???? ]] ; then
+ KEYWORDS="-* ~arm ~hppa ~m68k ~mips ~ppc ~ppc64 ~sh ~sparc ~x86"
+ fi
+fi
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+DESCRIPTION="Newlib is a C library intended for use on embedded systems"
+HOMEPAGE="http://sourceware.org/newlib/"
+
+LICENSE="NEWLIB LIBGLOSS GPL-2"
+SLOT="0"
+IUSE="nls threads unicode crosscompile_opts_headers-only"
+RESTRICT="strip"
+
+NEWLIBBUILD="${WORKDIR}/build"
+
+pkg_setup() {
+ # Reject newlib-on-glibc type installs
+ if [[ ${CTARGET} == ${CHOST} ]] ; then
+ case ${CHOST} in
+ *-newlib|*-elf) ;;
+ *) die "Use sys-devel/crossdev to build a newlib toolchain" ;;
+ esac
+ fi
+}
+
+src_prepare() {
+ epatch_user
+}
+
+src_configure() {
+ # we should fix this ...
+ unset LDFLAGS
+ CHOST=${CTARGET} strip-unsupported-flags
+
+ local myconf=""
+ [[ ${CTARGET} == "spu" ]] \
+ && myconf="${myconf} --disable-newlib-multithread" \
+ || myconf="${myconf} $(use_enable threads newlib-multithread)"
+
+ mkdir -p "${NEWLIBBUILD}"
+ cd "${NEWLIBBUILD}"
+
+ ECONF_SOURCE=${S} \
+ econf \
+ $(use_enable unicode newlib-mb) \
+ $(use_enable nls) \
+ ${myconf}
+}
+
+src_compile() {
+ emake -C "${NEWLIBBUILD}"
+}
+
+src_install() {
+ cd "${NEWLIBBUILD}"
+ emake -j1 DESTDIR="${D}" install
+# env -uRESTRICT CHOST=${CTARGET} prepallstrip
+ # minor hack to keep things clean
+ rm -fR "${D}"/usr/share/info
+ rm -fR "${D}"/usr/info
+}
diff --git a/sys-libs/nss-db/Manifest b/sys-libs/nss-db/Manifest
new file mode 100644
index 000000000000..6415d1c5c6d5
--- /dev/null
+++ b/sys-libs/nss-db/Manifest
@@ -0,0 +1,4 @@
+DIST nss_db-2.2.3pre1-dbopen.patch.bz2 258 SHA256 9d7bf1ef17ca91c59c234bfa96d4b9e3f866a792c609a02cc6d9daa601dee1d3 SHA512 59c9c375150f217e5d98d6f12cde5f9227a4734721b1352bd8bae33579bccfc208cfe43af57e20081a25fb7c32b5926fe0344a16fab497cb7a0de0a2b37c9a60 WHIRLPOOL f1dfc1355bc6f40cbf3414665cf3704e751db56376d8e26dec64f59505ca224e87889064997201c9a3b135167819ca292731e51bdef7baf692fbf69560157639
+DIST nss_db-2.2.3pre1-dbupgrade.patch.bz2 263 SHA256 31052eb79cc4aa60f639a3a57d9225630327ee6c728d62eda1d9c91ea7d70dc3 SHA512 f3c787d2ccec66039e2af08d18f69890192aa95670c9e26066d94249f1f6f3a3f2df17c35b6ba214f9ac9522642c3adce8a9bea98562f33efc907b16334c2512 WHIRLPOOL 73cda93849598dd9b3b86a391dbab7679358eb4084f82d723a58812726c2c9215c7636aeef3756ea0e129efd5fb7d90b4193f2428b094cc5790e946f091a5313
+DIST nss_db-2.2.3pre1-external.patch.bz2 1870 SHA256 dbc45a4dc7c977fae2193e0a14fdb862a5f42479ac40da0d4772d5d66e95ade0 SHA512 6f1c6ed373130c9fa5e4ba7c57d110f42be235b20a30f2fe971de09f8be255e59ac319bd95cc46af50f0ce11e0af482f496cdd6db2318028ad2e7ac2ed4fdc3e WHIRLPOOL de050b229134d60d1c24efdff36c0625b7ffc8f256521a2f3380c6a4dcf3e136e99df5ae41319a7e3a1626477c84dabdfd463cf7aa7f6c41003fd62ce3641092
+DIST nss_db-2.2.3pre1.tar.gz 235360 SHA256 0c5d677a49c7bf6b9318bf40adf335839a668d1c7509e9b1915bd22a9e0ac694 SHA512 f8839cd0bea11e349be1afd7189560993b320d33f9c70da25c8aae03bae91cd6a48b597462d636021cf0e4e477c2bdb37952100bc6b871049c2650d5ee7853ae WHIRLPOOL 3695650757a9f6c5b3cd28f866c0bd0334d686aac2770b1567d0be9658797b32e3bdc4a5e3774fadddbffd9e9eedf40b6eb86058e1b0789dad6925275ccde0a0
diff --git a/sys-libs/nss-db/files/db3.patch b/sys-libs/nss-db/files/db3.patch
new file mode 100644
index 000000000000..2da6ecbd5550
--- /dev/null
+++ b/sys-libs/nss-db/files/db3.patch
@@ -0,0 +1,43 @@
+diff -u nss_db-2.2.orig/configure.in nss_db-2.2/configure.in
+--- nss_db-2.2.orig/configure.in 2003-06-27 11:41:13.000000000 +0200
++++ nss_db-2.2/configure.in 2003-06-27 11:44:30.000000000 +0200
+@@ -43,22 +43,28 @@
+ AC_CHECK_HEADER(db.h,, AC_MSG_ERROR([
+ *** Could not find Berkeley DB headers.]))
+
+-AC_CHECK_LIB(db, db_version,, AC_MSG_ERROR([
++
++AC_CHECK_LIB(db-3, db_version,,
++ AC_CHECK_LIB(db, db_version,,AC_MSG_ERROR([
+ *** Could not find Berkeley DB library.]))
++)
+
+ AC_CACHE_CHECK([Berkeley DB version], nss_db_cv_db_version,
+ [AC_TRY_CPP(
+ [
+-# include <db.h>
+-# ifndef DB_VERSION_STRING
+-# error "Unknown"
+-# endif
+-# if DB_VERSION_MAJOR < 2
+-# error "Too old"
+-# endif
+-# if DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR < 4
+-# error "Too old"
+-# endif
++ include <db.h>
++ ifndef DB_VERSION_STRING
++ error "Unknown"
++ endif
++ if DB_VERSION_MAJOR < 2
++ error "Too old"
++ endif
++ if DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR < 4
++ error "Too old"
++ endif
++ if DB_VERSION_MAJOR >= 4
++ error "Too new"
++ endif
+ ],
+ nss_db_cv_db_version="ok",
+ nss_db_cv_db_version="not ok")
diff --git a/sys-libs/nss-db/files/nss-db-2.2.3_pre1-root-upgrade-only.patch b/sys-libs/nss-db/files/nss-db-2.2.3_pre1-root-upgrade-only.patch
new file mode 100644
index 000000000000..e2db2342e2a4
--- /dev/null
+++ b/sys-libs/nss-db/files/nss-db-2.2.3_pre1-root-upgrade-only.patch
@@ -0,0 +1,27 @@
+diff -NuarwbB nss_db-2.2.3pre1.orig/src/db-compat.c nss_db-2.2.3pre1/src/db-compat.c
+--- nss_db-2.2.3pre1.orig/src/db-compat.c 2005-06-07 00:08:39.000000000 -0700
++++ nss_db-2.2.3pre1/src/db-compat.c 2005-06-07 00:53:00.000000000 -0700
+@@ -20,6 +20,9 @@
+ #include <assert.h>
+ #include <db.h>
+ #include <fcntl.h>
++#include <unistd.h>
++#include <sys/types.h>
++
+
+ #if DB_VERSION_MAJOR > 2
+
+@@ -39,8 +42,13 @@
+ if (err)
+ return err;
+
++ uid_t uid = geteuid();
++
++ if(uid == 0) {
+ /* Make sure we upgrade, in case this is an older database */
++ /* However we need root access to do so */
+ db->upgrade(db, file, 0);
++ }
+
+ err = db->open (db, NULL, file, NULL, type, flags, mode);
+ if (err)
diff --git a/sys-libs/nss-db/files/nss-db-2.2.3_pre1-symlinkvuln.patch b/sys-libs/nss-db/files/nss-db-2.2.3_pre1-symlinkvuln.patch
new file mode 100644
index 000000000000..54a67b58499b
--- /dev/null
+++ b/sys-libs/nss-db/files/nss-db-2.2.3_pre1-symlinkvuln.patch
@@ -0,0 +1,262 @@
+diff -urNad libnss-db-2.2.3pre1~/src/db-XXX.c libnss-db-2.2.3pre1/src/db-XXX.c
+--- libnss-db-2.2.3pre1~/src/db-XXX.c 2010-03-30 10:41:48.026483855 -0700
++++ libnss-db-2.2.3pre1/src/db-XXX.c 2010-03-30 10:41:48.216484130 -0700
+@@ -56,6 +56,7 @@
+
+ /* Maintenance of the shared handle open on the database. */
+
++static DB_ENV *dbenv;
+ static DB *db;
+ static int keep_db;
+ static int entidx;
+@@ -69,7 +70,7 @@
+
+ pthread_mutex_lock (&lock);
+
+- status = internal_setent (DBFILE, &db);
++ status = internal_setent (DBFILE, &db, &dbenv);
+
+ /* Remember STAYOPEN flag. */
+ if (db != NULL)
+@@ -89,7 +90,7 @@
+ {
+ pthread_mutex_lock (&lock);
+
+- internal_endent (&db);
++ internal_endent (&db, &dbenv);
+
+ /* Reset STAYOPEN flag. */
+ keep_db = 0;
+@@ -112,7 +113,7 @@
+ /* Open the database. */
+ if (db == NULL)
+ {
+- status = internal_setent (DBFILE, &db);
++ status = internal_setent (DBFILE, &db, &dbenv);
+ if (status != NSS_STATUS_SUCCESS)
+ {
+ *errnop = errno;
+@@ -194,7 +195,7 @@
+ }
+
+ if (! keep_db)
+- internal_endent (&db);
++ internal_endent (&db, &dbenv);
+
+ return status;
+ }
+diff -urNad libnss-db-2.2.3pre1~/src/db-alias.c libnss-db-2.2.3pre1/src/db-alias.c
+--- libnss-db-2.2.3pre1~/src/db-alias.c 2010-03-30 10:41:47.996483420 -0700
++++ libnss-db-2.2.3pre1/src/db-alias.c 2010-03-30 10:41:48.216484130 -0700
+@@ -34,6 +34,7 @@
+
+ /* Maintenance of the shared handle open on the database. */
+
++static DB_ENV *dbenv;
+ static DB *db;
+ static int keep_db;
+ static unsigned int entidx; /* Index for `getaliasent_r'. */
+@@ -47,7 +48,7 @@
+
+ pthread_mutex_lock (&lock);
+
+- status = internal_setent (_PATH_VARDB "aliases.db", &db);
++ status = internal_setent (_PATH_VARDB "aliases.db", &db, &dbenv);
+
+ /* Remember STAYOPEN flag. */
+ if (db != NULL)
+@@ -68,7 +69,7 @@
+ {
+ pthread_mutex_lock (&lock);
+
+- internal_endent (&db);
++ internal_endent (&db, &dbenv);
+
+ /* Reset STAYOPEN flag. */
+ keep_db = 0;
+@@ -92,7 +93,7 @@
+ /* Open the database. */
+ if (db == NULL)
+ {
+- status = internal_setent (_PATH_VARDB "aliases.db", &db);
++ status = internal_setent (_PATH_VARDB "aliases.db", &db, &dbenv);
+ if (status != NSS_STATUS_SUCCESS)
+ {
+ *errnop = errno;
+@@ -165,7 +166,7 @@
+ status = NSS_STATUS_NOTFOUND;
+
+ if (! keep_db)
+- internal_endent (&db);
++ internal_endent (&db, &dbenv);
+
+ return status;
+ }
+diff -urNad libnss-db-2.2.3pre1~/src/db-compat.c libnss-db-2.2.3pre1/src/db-compat.c
+--- libnss-db-2.2.3pre1~/src/db-compat.c 2010-03-30 10:41:47.956483550 -0700
++++ libnss-db-2.2.3pre1/src/db-compat.c 2010-03-30 10:41:48.216484130 -0700
+@@ -27,15 +27,14 @@
+
+ int
+ db_open (const char *file, DBTYPE type, u_int32_t flags, int mode,
+- void *dbenv, void *dbinfo, DB **dbp)
++ DB_ENV *dbenv, void *dbinfo, DB **dbp)
+ {
+ DB *db;
+ int err;
+
+- assert (dbenv == NULL);
+ assert (dbinfo == NULL);
+
+- err = db_create (&db, NULL, 0);
++ err = db_create (&db, dbenv, 0);
+ if (err)
+ return err;
+
+diff -urNad libnss-db-2.2.3pre1~/src/db-compat.h libnss-db-2.2.3pre1/src/db-compat.h
+--- libnss-db-2.2.3pre1~/src/db-compat.h 2001-04-29 18:07:41.000000000 -0700
++++ libnss-db-2.2.3pre1/src/db-compat.h 2010-03-30 10:41:48.216484130 -0700
+@@ -2,5 +2,5 @@
+
+ #if DB_VERSION_MAJOR > 2
+ extern int db_open (const char *__file, DBTYPE __type, u_int32_t __flags,
+- int __mode, void *__dbenv, void *__dbinfo, DB **__dbp);
++ int __mode, DB_ENV *dbenv, void *__dbinfo, DB **__dbp);
+ #endif
+diff -urNad libnss-db-2.2.3pre1~/src/db-netgrp.c libnss-db-2.2.3pre1/src/db-netgrp.c
+--- libnss-db-2.2.3pre1~/src/db-netgrp.c 2010-03-30 10:41:47.996483420 -0700
++++ libnss-db-2.2.3pre1/src/db-netgrp.c 2010-03-30 10:41:48.216484130 -0700
+@@ -35,6 +35,7 @@
+ static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
+
+ /* Maintenance of the shared handle open on the database. */
++static DB_ENV *dbenv;
+ static DB *db;
+ static char *entry;
+ static char *cursor;
+@@ -46,7 +47,7 @@
+
+ pthread_mutex_lock (&lock);
+
+- status = internal_setent (DBFILE, &db);
++ status = internal_setent (DBFILE, &db, &dbenv);
+
+ if (status == NSS_STATUS_SUCCESS)
+ {
+@@ -72,7 +73,7 @@
+ {
+ pthread_mutex_lock (&lock);
+
+- internal_endent (&db);
++ internal_endent (&db, &dbenv);
+
+ pthread_mutex_unlock (&lock);
+
+diff -urNad libnss-db-2.2.3pre1~/src/db-open.c libnss-db-2.2.3pre1/src/db-open.c
+--- libnss-db-2.2.3pre1~/src/db-open.c 2010-03-30 10:41:47.996483420 -0700
++++ libnss-db-2.2.3pre1/src/db-open.c 2010-03-30 10:42:24.127733451 -0700
+@@ -21,6 +21,9 @@
+ #include <db.h>
+ #include <errno.h>
+ #include <fcntl.h>
++#include <stdlib.h>
++#include <string.h>
++#include <libgen.h>
+
+ #include "db-compat.h"
+
+@@ -45,35 +48,46 @@
+ handle in *DBP and return NSS_STATUS_SUCCESS. On failure, return
+ the appropriate lookup status. */
+ enum nss_status
+-internal_setent (const char *file, DB **dbp)
++internal_setent (const char *file, DB **dbp, DB_ENV **dbenvp)
+ {
+- DB *db;
++ char *filecopy = NULL, *home;
++ DB_ENV *dbenv = NULL;
++ DB *db = NULL;
+ int err;
+ int fd;
+
+ if (*dbp)
+ return NSS_STATUS_SUCCESS;
+
+- err = db_open (file, DB_BTREE, DB_RDONLY, 0, NULL, NULL, &db);
++ err = db_env_create(&dbenv, 0);
+ if (err != 0)
+- {
+- if (err > 0)
+- errno = err;
+- return NSS_STATUS_UNAVAIL;
+- }
++ goto fail;
++ filecopy = strdup(file);
++ home = dirname(filecopy);
++ err = dbenv->open(dbenv, home, DB_INIT_MPOOL | DB_CREATE | DB_PRIVATE, 0);
++ if (err != 0)
++ goto fail_env;
++ err = db_open (file, DB_BTREE, DB_RDONLY, 0, dbenv, NULL, &db);
++ if (err != 0)
++ goto fail_env;
+
+ /* We have to make sure the file is `closed on exec'. */
+ err = db->fd (db, &fd);
+ if (err)
+- goto fail;
++ goto fail_db;
+ if (set_cloexec_flag (fd) < 0)
+- goto fail;
++ goto fail_db;
+
++ *dbenvp = dbenv;
+ *dbp = db;
+ return NSS_STATUS_SUCCESS;
+
+- fail:
++ fail_db:
+ db->close (db, 0);
++ fail_env:
++ dbenv->close (dbenv, 0);
++ fail:
++ if (filecopy) free(filecopy);
+ if (err > 0)
+ errno = err;
+ return NSS_STATUS_UNAVAIL;
+@@ -81,8 +95,9 @@
+
+ /* Close the database *DBP. */
+ void
+-internal_endent (DB **dbp)
++internal_endent (DB **dbp, DB_ENV **dbenvp)
+ {
++ DB_ENV *dbenv = *dbenvp;
+ DB *db = *dbp;
+
+ if (db != NULL)
+@@ -90,4 +105,9 @@
+ db->close (db, 0);
+ *dbp = NULL;
+ }
++ if (dbenv != NULL)
++ {
++ dbenv->close (dbenv, 0);
++ *dbenvp = NULL;
++ }
+ }
+diff -urNad libnss-db-2.2.3pre1~/src/nss_db.h libnss-db-2.2.3pre1/src/nss_db.h
+--- libnss-db-2.2.3pre1~/src/nss_db.h 2001-04-29 18:07:41.000000000 -0700
++++ libnss-db-2.2.3pre1/src/nss_db.h 2010-03-30 10:41:48.216484130 -0700
+@@ -26,9 +26,9 @@
+ /* Open the database stored in FILE. If succesful, store the database
+ handle in *DBP and return NSS_STATUS_SUCCESS. On failure, return
+ the appropriate lookup status. */
+-extern enum nss_status internal_setent (const char *file, DB **dbp);
++extern enum nss_status internal_setent (const char *file, DB **dbp, DB_ENV **dbenvp);
+
+ /* Close the database *DBP. */
+-extern void internal_endent (DB **dbp);
++extern void internal_endent (DB **dbp, DB_ENV **dbenvp);
+
+ #endif /* nss_db.h */
+
diff --git a/sys-libs/nss-db/files/remake-all-db b/sys-libs/nss-db/files/remake-all-db
new file mode 100644
index 000000000000..eab57a5e7ed8
--- /dev/null
+++ b/sys-libs/nss-db/files/remake-all-db
@@ -0,0 +1,6 @@
+#!/bin/sh
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# Written by Robin H. Johnson <robbat2@gentoo.org>
+# 16 Feb 2004
+/usr/bin/make -f /usr/share/nss-db/db-Makefile all
diff --git a/sys-libs/nss-db/files/sandbox.d_50nss-db b/sys-libs/nss-db/files/sandbox.d_50nss-db
new file mode 100644
index 000000000000..f8cfba24dd74
--- /dev/null
+++ b/sys-libs/nss-db/files/sandbox.d_50nss-db
@@ -0,0 +1 @@
+SANDBOX_PREDICT="/var/db/aliases.db:/var/db/automount.db:/var/db/bootparams.db:/var/db/ethers.db:/var/db/group.db:/var/db/hosts.db:/var/db/netgroup.db:/var/db/netmasks.db:/var/db/networks.db:/var/db/passwd.db:/var/db/protocols.db:/var/db/rpc.db:/var/db/services.db:/var/db/shadow.db"
diff --git a/sys-libs/nss-db/metadata.xml b/sys-libs/nss-db/metadata.xml
new file mode 100644
index 000000000000..96a2d586367d
--- /dev/null
+++ b/sys-libs/nss-db/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>base-system</herd>
+</pkgmetadata>
diff --git a/sys-libs/nss-db/nss-db-2.2.3_pre1-r2.ebuild b/sys-libs/nss-db/nss-db-2.2.3_pre1-r2.ebuild
new file mode 100644
index 000000000000..75e9a7bd7922
--- /dev/null
+++ b/sys-libs/nss-db/nss-db-2.2.3_pre1-r2.ebuild
@@ -0,0 +1,107 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils versionator multilib autotools
+
+MY_PN="${PN/-/_}"
+MY_PV="${PV/_}"
+MY_P="${MY_PN}-${MY_PV}"
+
+DESCRIPTION="Allows important system files to be stored in a fast database file rather than plain text"
+HOMEPAGE="http://sources.redhat.com/glibc/"
+SRC_URI="ftp://sources.redhat.com/pub/glibc/old-releases/${MY_P}.tar.gz
+ mirror://gentoo/${MY_P}-external.patch.bz2
+ mirror://gentoo/${MY_P}-dbupgrade.patch.bz2
+ mirror://gentoo/${MY_P}-dbopen.patch.bz2"
+
+LICENSE="GPL-2 LGPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc x86"
+IUSE="nls"
+
+# awk and make ARE needed at runtime!
+# and this didn't compile on BSD libc either
+RDEPEND=">=sys-libs/db-4
+ sys-devel/make
+ >=sys-libs/glibc-2.3
+ !>=sys-libs/glibc-2.15"
+# We really do need gettext to compile always :-(
+DEPEND="${RDEPEND}
+ sys-devel/gettext"
+
+S="${WORKDIR}/${MY_P}"
+
+db_getver() {
+ local DBPKG
+ DBPKG="$(best_version '>=sys-libs/db-4')"
+ echo "${DBPKG//sys-libs\/db-}"
+}
+
+db_getversym() {
+ local DBVER DBSYMSUFFIX
+ [ -n "${1}" ] && DBVER="${1}" || DBVER="$(db_getver)"
+ DBVER=($(get_version_components "${DBVER}"))
+ if has_version '>=sys-libs/db-4.3'; then
+ DBSYMSUFFIX=""
+ else
+ let DBSYMSUFFIX=(${DBVER[0]}*1000)+${DBVER[1]}
+ DBSYMSUFFIX=_${DBSYMSUFFIX}
+ fi
+ echo "${DBSYMSUFFIX}"
+}
+
+src_unpack() {
+ unpack ${MY_P}.tar.gz
+ EPATCH_OPTS="-p1 -d ${S}" epatch ${DISTDIR}/${MY_P}-external.patch.bz2
+ EPATCH_OPTS="-p0 -d ${S}" epatch ${DISTDIR}/${MY_P}-dbupgrade.patch.bz2
+ EPATCH_OPTS="-p1 -d ${S}" epatch ${DISTDIR}/${MY_P}-dbopen.patch.bz2
+ EPATCH_OPTS="-p1 -d ${S}" epatch ${FILESDIR}/${P}-root-upgrade-only.patch
+
+ # make sure we use the correct version of DB
+ cd "${S}"
+ DB_PV="$(db_getver)"
+ DB_SYM="$(db_getversym ${DB_PV})"
+ DB_PV_MAJORMINOR="$(get_version_component_range 1-2 ${DB_PV})"
+ sed -i configure.in \
+ -e "s!db.h!db${DB_PV_MAJORMINOR}/db.h!g" \
+ -e "s!db, db_version!db-${DB_PV_MAJORMINOR}, db_version${DB_SYM}!g"
+
+ # fix ancient broken-ness
+ for f in po/Makefile.in.in ./intl/Makefile.in; do
+ egrep -q '^mkinstalldirs = .*case.*esac' ${f} && \
+ sed -i ${f} \
+ -e '/^mkinstalldirs = /s,\(mkinstalldirs =\).*,\1 $(top_builddir)/./mkinstalldirs,'
+ done
+
+ # Fixes thanks to Flameeyes
+ cp /usr/share/gettext/config.rpath . # missing
+ sed -i -e '/makedb_LDADD/i makedb_CFLAGS=$(AM_CFLAGS)' src/Makefile.am
+ sed -i -e '/AC_PROG_CC/a AC_PROG_CC_C_O' configure.in
+ eautoreconf
+
+ # This is an evil target and we don't like it
+ sed -i -e '/^install-data-am:.*install-data-local/s,install-data-local,,g' "${S}"/src/Makefile.in
+}
+
+src_compile() {
+ econf -C --libdir=/$(get_libdir) `use_enable nls` || die
+ emake || die
+}
+
+src_install() {
+ emake -j1 DESTDIR="${D}" slibdir="/$(get_libdir)" install || \
+ die "failed emake install"
+
+ into /usr
+ insinto /usr/share/${PN}
+ doins db-Makefile
+
+ dosbin "${FILESDIR}"/remake-all-db
+
+ dodoc AUTHORS COPYING* ChangeLog INSTALL NEWS README THANKS
+
+ dodir /usr/$(get_libdir)/
+ mv "${D}"/$(get_libdir)/*.la "${D}"/usr/$(get_libdir)/ || \
+ die "failed to set up .la"
+}
diff --git a/sys-libs/nss-db/nss-db-2.2.3_pre1-r3.ebuild b/sys-libs/nss-db/nss-db-2.2.3_pre1-r3.ebuild
new file mode 100644
index 000000000000..69d8766567f6
--- /dev/null
+++ b/sys-libs/nss-db/nss-db-2.2.3_pre1-r3.ebuild
@@ -0,0 +1,111 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils versionator multilib autotools
+
+MY_PN="${PN/-/_}"
+MY_PV="${PV/_}"
+MY_P="${MY_PN}-${MY_PV}"
+
+DESCRIPTION="Allows important system files to be stored in a fast database file rather than plain text"
+HOMEPAGE="http://sources.redhat.com/glibc/"
+SRC_URI="ftp://sources.redhat.com/pub/glibc/old-releases/${MY_P}.tar.gz
+ mirror://gentoo/${MY_P}-external.patch.bz2
+ mirror://gentoo/${MY_P}-dbupgrade.patch.bz2
+ mirror://gentoo/${MY_P}-dbopen.patch.bz2"
+
+LICENSE="GPL-2 LGPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE="nls"
+
+# awk and make ARE needed at runtime!
+# and this didn't compile on BSD libc either
+RDEPEND=">=sys-libs/db-4
+ sys-devel/make
+ >=sys-libs/glibc-2.3
+ !>=sys-libs/glibc-2.15"
+# We really do need gettext to compile always :-(
+DEPEND="${RDEPEND}
+ sys-devel/gettext"
+
+S="${WORKDIR}/${MY_P}"
+
+db_getver() {
+ local DBPKG
+ DBPKG="$(best_version '>=sys-libs/db-4')"
+ echo "${DBPKG//sys-libs\/db-}"
+}
+
+db_getversym() {
+ local DBVER DBSYMSUFFIX
+ [ -n "${1}" ] && DBVER="${1}" || DBVER="$(db_getver)"
+ DBVER=($(get_version_components "${DBVER}"))
+ if has_version '>=sys-libs/db-4.3'; then
+ DBSYMSUFFIX=""
+ else
+ let DBSYMSUFFIX=(${DBVER[0]}*1000)+${DBVER[1]}
+ DBSYMSUFFIX=_${DBSYMSUFFIX}
+ fi
+ echo "${DBSYMSUFFIX}"
+}
+
+src_unpack() {
+ unpack ${MY_P}.tar.gz
+ EPATCH_OPTS="-p1 -d ${S}" epatch ${DISTDIR}/${MY_P}-external.patch.bz2
+ EPATCH_OPTS="-p0 -d ${S}" epatch ${DISTDIR}/${MY_P}-dbupgrade.patch.bz2
+ EPATCH_OPTS="-p1 -d ${S}" epatch ${DISTDIR}/${MY_P}-dbopen.patch.bz2
+ EPATCH_OPTS="-p1 -d ${S}" epatch ${FILESDIR}/${P}-root-upgrade-only.patch
+
+ # make sure we use the correct version of DB
+ cd "${S}"
+ DB_PV="$(db_getver)"
+ DB_SYM="$(db_getversym ${DB_PV})"
+ DB_PV_MAJORMINOR="$(get_version_component_range 1-2 ${DB_PV})"
+ sed -i configure.in \
+ -e "s!db.h!db${DB_PV_MAJORMINOR}/db.h!g" \
+ -e "s!db, db_version!db-${DB_PV_MAJORMINOR}, db_version${DB_SYM}!g"
+
+ # fix ancient broken-ness
+ for f in po/Makefile.in.in ./intl/Makefile.in; do
+ egrep -q '^mkinstalldirs = .*case.*esac' ${f} && \
+ sed -i ${f} \
+ -e '/^mkinstalldirs = /s,\(mkinstalldirs =\).*,\1 $(top_builddir)/./mkinstalldirs,'
+ done
+
+ # Fixes thanks to Flameeyes
+ # missing
+ cp /usr/share/gettext/config.rpath .
+ sed -i -e '/makedb_LDADD/i makedb_CFLAGS=$(AM_CFLAGS)' src/Makefile.am
+ sed -i -e '/AC_PROG_CC/a AC_PROG_CC_C_O' configure.in
+ eautoreconf
+
+ # This is an evil target and we don't like it
+ sed -i -e '/^install-data-am:.*install-data-local/s,install-data-local,,g' "${S}"/src/Makefile.in
+}
+
+src_compile() {
+ econf -C --libdir=/$(get_libdir) `use_enable nls` || die
+ emake || die
+}
+
+src_install() {
+ emake -j1 DESTDIR="${D}" slibdir="/$(get_libdir)" install || \
+ die "failed emake install"
+
+ into /usr
+ insinto /usr/share/${PN}
+ doins db-Makefile
+
+ dosbin "${FILESDIR}"/remake-all-db
+
+ dodoc AUTHORS COPYING* ChangeLog INSTALL NEWS README THANKS
+
+ dodir /usr/$(get_libdir)/
+ mv "${D}"/$(get_libdir)/*.la "${D}"/usr/$(get_libdir)/ || \
+ die "failed to set up .la"
+
+ insinto /etc/sandbox.d/
+ newins "${FILESDIR}"/sandbox.d_50nss-db 50nss-db
+}
diff --git a/sys-libs/nss-db/nss-db-2.2.3_pre1-r4.ebuild b/sys-libs/nss-db/nss-db-2.2.3_pre1-r4.ebuild
new file mode 100644
index 000000000000..7c4d2abc982b
--- /dev/null
+++ b/sys-libs/nss-db/nss-db-2.2.3_pre1-r4.ebuild
@@ -0,0 +1,112 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils versionator multilib autotools
+
+MY_PN="${PN/-/_}"
+MY_PV="${PV/_}"
+MY_P="${MY_PN}-${MY_PV}"
+
+DESCRIPTION="Allows important system files to be stored in a fast database file rather than plain text"
+HOMEPAGE="http://sources.redhat.com/glibc/"
+SRC_URI="ftp://sources.redhat.com/pub/glibc/old-releases/${MY_P}.tar.gz
+ mirror://gentoo/${MY_P}-external.patch.bz2
+ mirror://gentoo/${MY_P}-dbupgrade.patch.bz2
+ mirror://gentoo/${MY_P}-dbopen.patch.bz2"
+
+LICENSE="GPL-2 LGPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE="nls"
+
+# awk and make ARE needed at runtime!
+# and this didn't compile on BSD libc either
+RDEPEND=">=sys-libs/db-4
+ sys-devel/make
+ >=sys-libs/glibc-2.3
+ !>=sys-libs/glibc-2.15"
+# We really do need gettext to compile always :-(
+DEPEND="${RDEPEND}
+ sys-devel/gettext"
+
+S="${WORKDIR}/${MY_P}"
+
+db_getver() {
+ local DBPKG
+ DBPKG="$(best_version '>=sys-libs/db-4')"
+ echo "${DBPKG//sys-libs\/db-}"
+}
+
+db_getversym() {
+ local DBVER DBSYMSUFFIX
+ [ -n "${1}" ] && DBVER="${1}" || DBVER="$(db_getver)"
+ DBVER=($(get_version_components "${DBVER}"))
+ if has_version '>=sys-libs/db-4.3'; then
+ DBSYMSUFFIX=""
+ else
+ let DBSYMSUFFIX=(${DBVER[0]}*1000)+${DBVER[1]}
+ DBSYMSUFFIX=_${DBSYMSUFFIX}
+ fi
+ echo "${DBSYMSUFFIX}"
+}
+
+src_unpack() {
+ unpack ${MY_P}.tar.gz
+ EPATCH_OPTS="-p1 -d ${S}" epatch ${DISTDIR}/${MY_P}-external.patch.bz2
+ EPATCH_OPTS="-p0 -d ${S}" epatch ${DISTDIR}/${MY_P}-dbupgrade.patch.bz2
+ EPATCH_OPTS="-p1 -d ${S}" epatch ${DISTDIR}/${MY_P}-dbopen.patch.bz2
+ EPATCH_OPTS="-p1 -d ${S}" epatch ${FILESDIR}/${P}-root-upgrade-only.patch
+ EPATCH_OPTS="-p1 -d ${S}" epatch ${FILESDIR}/${P}-symlinkvuln.patch
+ # make sure we use the correct version of DB
+ cd "${S}"
+ DB_PV="$(db_getver)"
+ DB_SYM="$(db_getversym ${DB_PV})"
+ DB_PV_MAJORMINOR="$(get_version_component_range 1-2 ${DB_PV})"
+ sed -i configure.in \
+ -e "s!db.h!db${DB_PV_MAJORMINOR}/db.h!g" \
+ -e "s!db, db_version!db-${DB_PV_MAJORMINOR}, db_version${DB_SYM}!g"
+
+ # fix ancient broken-ness
+ for f in po/Makefile.in.in ./intl/Makefile.in; do
+ egrep -q '^mkinstalldirs = .*case.*esac' ${f} && \
+ sed -i ${f} \
+ -e '/^mkinstalldirs = /s,\(mkinstalldirs =\).*,\1 $(top_builddir)/./mkinstalldirs,'
+ done
+
+ # Fixes thanks to Flameeyes
+ # missing
+ cp /usr/share/gettext/config.rpath .
+ sed -i -e '/makedb_LDADD/i makedb_CFLAGS=$(AM_CFLAGS)' src/Makefile.am
+ sed -i -e '/AC_PROG_CC/a AC_PROG_CC_C_O' configure.in
+ eautoreconf
+
+ # This is an evil target and we don't like it
+ sed -i -e '/^install-data-am:.*install-data-local/s,install-data-local,,g' "${S}"/src/Makefile.in
+}
+
+src_compile() {
+ econf -C --libdir=/$(get_libdir) `use_enable nls` || die
+ emake || die
+}
+
+src_install() {
+ emake -j1 DESTDIR="${D}" slibdir="/$(get_libdir)" install || \
+ die "failed emake install"
+
+ into /usr
+ insinto /usr/share/${PN}
+ doins db-Makefile
+
+ exeinto /usr/sbin
+ dosbin "${FILESDIR}"/remake-all-db
+
+ dodoc AUTHORS COPYING* ChangeLog INSTALL NEWS README THANKS
+
+ dodir /usr/$(get_libdir)/
+ mv "${D}"/$(get_libdir)/*.la "${D}"/usr/$(get_libdir)/ || \
+ die "failed to set up .la"
+
+ insinto /etc/sandbox.d/
+ newins "${FILESDIR}"/sandbox.d_50nss-db 50nss-db
+}
diff --git a/sys-libs/nss-usrfiles/Manifest b/sys-libs/nss-usrfiles/Manifest
new file mode 100644
index 000000000000..5878aa33529f
--- /dev/null
+++ b/sys-libs/nss-usrfiles/Manifest
@@ -0,0 +1 @@
+DIST nss-altfiles-2.18.1.zip 42369 SHA256 32eb1ecd94c7c789b540e2d047bb90f5a82d3ec02f8b4adbfc48ae55c32aa1d6 SHA512 d9e2c34ce2518a5310578a2b99a59fc1a8142c252c41e5dab0fd0c07e62ccfa2e3c5d2dd29e179514f3b37537bb0576e2bc3c850f459fa251cd57923438981af WHIRLPOOL 7a035ccb0844df32064f7dc6bf027a1cc55ac4421feda2832516445f904ec6616d67e1dcc3387b85553fdeacd566c7fcff970a24888587d16654c444247ae636
diff --git a/sys-libs/nss-usrfiles/metadata.xml b/sys-libs/nss-usrfiles/metadata.xml
new file mode 100644
index 000000000000..64847d14b7cf
--- /dev/null
+++ b/sys-libs/nss-usrfiles/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>ryao@gentoo.org</email>
+ <name>Richard Yao</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">coreos/nss-altfiles</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-libs/nss-usrfiles/nss-usrfiles-2.18.1.ebuild b/sys-libs/nss-usrfiles/nss-usrfiles-2.18.1.ebuild
new file mode 100644
index 000000000000..e3bb3d8db160
--- /dev/null
+++ b/sys-libs/nss-usrfiles/nss-usrfiles-2.18.1.ebuild
@@ -0,0 +1,32 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+MY_PN="nss-altfiles"
+MY_P="${MY_PN}-${PV}"
+DESCRIPTION="NSS module to read passwd/group files from CoreOS /usr location"
+HOMEPAGE="https://github.com/coreos/${MY_PN}"
+SRC_URI="https://github.com/coreos/${MY_PN}/archive/v${PV}.zip -> ${MY_P}.zip"
+
+LICENSE="LGPL-2.1+"
+SLOT="0"
+KEYWORDS="~amd64-linux"
+IUSE=""
+
+DEPEND=""
+RDEPEND="${DEPEND}"
+S="${WORKDIR}/${MY_P}"
+
+src_configure() {
+ : # Don't bother with the custom configure script.
+}
+
+src_compile() {
+ emake DATADIR=/usr/share/baselayout MODULE_NAME=usrfiles
+}
+
+src_install() {
+ dolib.so libnss_usrfiles.so.2
+}
diff --git a/sys-libs/nss_wrapper/Manifest b/sys-libs/nss_wrapper/Manifest
new file mode 100644
index 000000000000..abe77f671505
--- /dev/null
+++ b/sys-libs/nss_wrapper/Manifest
@@ -0,0 +1 @@
+DIST nss_wrapper-1.0.3.tar.gz 42535 SHA256 285427ff84020f804b738c1e7154407b4f7017748bce48ce94c0a6b8656cda2f SHA512 3d921b1529e225d4060193ed8b491557d71c172d13d76188f2c9eaeef90f2a5f999ed1cc5b5be1feebf705147371d333355a5587049ecb66f39049a8da1dbf8d WHIRLPOOL ea643931f56e9449f6dce4d9ece943ba9701d758f7a893aae05fa0b5c0f924ba34a046b1cb3392e37c43de6e7ea60ec84db224e83bc111a321135b81addcb1d4
diff --git a/sys-libs/nss_wrapper/metadata.xml b/sys-libs/nss_wrapper/metadata.xml
new file mode 100644
index 000000000000..c2d9e83c908a
--- /dev/null
+++ b/sys-libs/nss_wrapper/metadata.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>samba</herd>
+ <maintainer>
+ <email>polynomial-c@gentoo.org</email>
+ <name>Lars Wendler</name>
+ </maintainer>
+</pkgmetadata>
diff --git a/sys-libs/nss_wrapper/nss_wrapper-1.0.3.ebuild b/sys-libs/nss_wrapper/nss_wrapper-1.0.3.ebuild
new file mode 100644
index 000000000000..1216a7fa08b4
--- /dev/null
+++ b/sys-libs/nss_wrapper/nss_wrapper-1.0.3.ebuild
@@ -0,0 +1,30 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit cmake-utils multilib-minimal
+
+DESCRIPTION="A wrapper for the user, group and hosts NSS API"
+HOMEPAGE="https://cwrap.org/nss_wrapper.html"
+SRC_URI="ftp://ftp.samba.org/pub/cwrap/${P}.tar.gz"
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="test"
+
+DEPEND=""
+RDEPEND="${DEPEND}"
+
+multilib_src_configure() {
+ cmake-utils_src_configure
+}
+
+multilib_src_compile() {
+ cmake-utils_src_compile
+}
+
+multilib_src_install() {
+ cmake-utils_src_install
+}
diff --git a/sys-libs/ntdb/Manifest b/sys-libs/ntdb/Manifest
new file mode 100644
index 000000000000..08e6670a970e
--- /dev/null
+++ b/sys-libs/ntdb/Manifest
@@ -0,0 +1 @@
+DIST ntdb-1.0.tar.gz 794585 SHA256 817ae862b1e6976cab867468f209d8417a90c7c2fcf0ec079a45645d7e7ebf49 SHA512 27f550f85a7bfd105d4115b55f9919f1871964f576a8470688fe8040fb9e2be209246a291d78f55c61cf0920238d7f41917ad7e2d44b202382b3ea47c8c97100 WHIRLPOOL 71a007312eacf7805dadc0b0089f7344b270a628e9dc3c1d8aeb505efdeead3b66cb8006377550c672a15cbf814264cb16c93892f7319bc031b8fe669bf29747
diff --git a/sys-libs/ntdb/metadata.xml b/sys-libs/ntdb/metadata.xml
new file mode 100644
index 000000000000..c2d9e83c908a
--- /dev/null
+++ b/sys-libs/ntdb/metadata.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>samba</herd>
+ <maintainer>
+ <email>polynomial-c@gentoo.org</email>
+ <name>Lars Wendler</name>
+ </maintainer>
+</pkgmetadata>
diff --git a/sys-libs/ntdb/ntdb-1.0-r1.ebuild b/sys-libs/ntdb/ntdb-1.0-r1.ebuild
new file mode 100644
index 000000000000..6ea3348d56b1
--- /dev/null
+++ b/sys-libs/ntdb/ntdb-1.0-r1.ebuild
@@ -0,0 +1,53 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="threads(+)"
+
+inherit waf-utils multilib-minimal python-single-r1
+
+DESCRIPTION="A not-so trivial keyword/data database system"
+HOMEPAGE="http://tdb.samba.org/"
+SRC_URI="http://samba.org/ftp/tdb/${P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64 ~hppa ~x86"
+IUSE="python"
+
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+RDEPEND="python? ( ${PYTHON_DEPS} )"
+DEPEND="!!<net-fs/samba-4.1.7
+ ${RDEPEND}
+ ${PYTHON_DEPS}
+ app-text/docbook-xml-dtd:4.2"
+
+WAF_BINARY="${S}/buildtools/bin/waf"
+
+src_prepare() {
+ multilib_copy_sources
+}
+
+multilib_src_configure() {
+ local extra_opts=()
+ if ! multilib_is_native_abi || ! use python; then
+ extra_opts+=( --disable-python )
+ fi
+
+ waf-utils_src_configure \
+ "${extra_opts[@]}"
+}
+
+multilib_src_test() {
+ # the default src_test runs 'make test' and 'make check', letting
+ # the tests fail occasionally (reason: unknown)
+ emake check
+}
+
+multilib_src_install() {
+ waf-utils_src_install
+}
diff --git a/sys-libs/openhpi/Manifest b/sys-libs/openhpi/Manifest
new file mode 100644
index 000000000000..bdc1d1b50ed4
--- /dev/null
+++ b/sys-libs/openhpi/Manifest
@@ -0,0 +1,2 @@
+DIST openhpi-2.12.0.tar.gz 2902996 SHA256 53c42b7e367cd9ce98a4f5f28be42c3797f7746059203743e542cc3b51862f59 SHA512 3b9ba75a02bf7893bf49eab2a6b0cf4e77c277e626f70a9c970c0b4c0ae05f38d3f8d3923d900ed229a809df2cfdf2cd8961eb1b135e9d29e891a15180ac6d13 WHIRLPOOL cfae9f8d7a057cbf24e8ef52be4e20d5029ade867b1a1badefdbaebf456cccda3a04e494c7667ff70efc05599a1edabc12fa092c23530640c27990e6f280a93e
+DIST openhpi-3.0.0.tar.gz 7271799 SHA256 2af5f40040a1b99b0c0a60f1bc03505d3d51f5c445cd04b1f832eb060acbb227 SHA512 a5749782808c43c4408e8cc924fbab9f80bd026710f242c482b036bcdb283660035f1257ec11ba664118167fc7b9d6efb38276875eb090d29afbb783066e6aa7 WHIRLPOOL 845648336b29a04df7713b914493817e353823e5b39f84b94f34dfe9e008cd76729da63f1e384d4fceab5880fc83180271ed8886c689fb5533483b559bf4799c
diff --git a/sys-libs/openhpi/files/openhpi-confd b/sys-libs/openhpi/files/openhpi-confd
new file mode 100644
index 000000000000..f8c861e49eba
--- /dev/null
+++ b/sys-libs/openhpi/files/openhpi-confd
@@ -0,0 +1,10 @@
+# /etc/conf.d/openhpid: config file for /etc/init.d/openhpid
+
+# Listening port. Default is 4743.
+#OPENHPID_PORT="4743"
+
+# Socket read timeout in seconds. Default is 1800 seconds.
+#OPENHPID_READTIMEOUT="1800"
+
+# Maximum number of connection threads. Default is unlimited.
+#OPENHPID_THREADS=""
diff --git a/sys-libs/openhpi/files/openhpi-initd b/sys-libs/openhpi/files/openhpi-initd
new file mode 100644
index 000000000000..d164759e6632
--- /dev/null
+++ b/sys-libs/openhpi/files/openhpi-initd
@@ -0,0 +1,21 @@
+#!/sbin/runscript
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+start() {
+ local extraopts
+ [ -n "${OPENHPID_PORT}" ] && extraopts += " -p ${OPENHPID_PORT}"
+ [ -n "${OPENHPID_READTIMEOUT}" ] && extraopts += " -s ${OPENHPID_READTIMEOUT}"
+ [ -n "${OPENHPID_THREADS}" ] && extraopts += " -t ${OPENHPID_THREADS}"
+
+ ebegin "Starting openhpid"
+ start-stop-daemon --start --exec /usr/sbin/openhpid --pidfile /var/run/openhpid.pid \
+ -- -c /etc/openhpi/openhpi.conf -f /var/run/openhpid.pid ${extraopts}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping openhpid"
+ start-stop-daemon --stop --exec /usr/sbin/openhpid --pidfile /var/run/openhpid.pid
+ eend $?
+}
diff --git a/sys-libs/openhpi/metadata.xml b/sys-libs/openhpi/metadata.xml
new file mode 100644
index 000000000000..7e6386a7dfe2
--- /dev/null
+++ b/sys-libs/openhpi/metadata.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>robbat2@gentoo.org</email>
+ </maintainer>
+ <upstream>
+ <remote-id type="sourceforge">openhpi</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-libs/openhpi/openhpi-2.12.0.ebuild b/sys-libs/openhpi/openhpi-2.12.0.ebuild
new file mode 100644
index 000000000000..1bcbcb44aa2e
--- /dev/null
+++ b/sys-libs/openhpi/openhpi-2.12.0.ebuild
@@ -0,0 +1,64 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils
+
+DESCRIPTION="Open source implementation of the Service Availability Forum (SAF) Hardware Platform Interface (HPI)"
+HOMEPAGE="http://www.openhpi.org/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~x86 ~amd64"
+IUSE="snmp"
+
+COMMONDEPEND=">=dev-libs/glib-2.2
+ sys-fs/e2fsprogs
+ sys-fs/sysfsutils
+ >=sys-libs/openipmi-1.4.20
+ snmp? ( >=net-analyzer/net-snmp-5.07 )"
+RDEPEND="${COMMONDEPEND}"
+DEPEND="${COMMONDEPEND}
+ >=sys-devel/autoconf-2.57
+ >=sys-devel/automake-1.8
+ >=sys-devel/gcc-3.2.0
+ virtual/os-headers"
+
+src_unpack() {
+ unpack ${A}
+ sed -i -e 's:-Werror::g' "${S}"/configure || die "sed failed"
+}
+
+src_compile() {
+ econf --with-varpath=/var/lib/openhpi \
+ --enable-clients \
+ --enable-cpp_wrappers \
+ --enable-daemon \
+ --enable-ipmi \
+ --enable-ipmidirect \
+ --enable-sysfs \
+ --enable-thread \
+ --enable-watchdog \
+ --enable-simulator \
+ --disable-testcover \
+ $(use_enable snmp snmp_bc) \
+ || die "econf failed"
+
+ emake || die "emake failed"
+}
+
+src_install() {
+ # Stage main files.
+ emake DESTDIR="${D}" install || die "emake install failed"
+
+ # Stage conf.d-file and init.d-script.
+ newinitd "${FILESDIR}"/openhpi-initd openhpid
+ newconfd "${FILESDIR}"/openhpi-confd openhpid
+
+ # Stage documentation.
+ dodoc README
+
+ # Make sure the data dir exists or openhpid will fail silently.
+ keepdir /var/lib/openhpi/
+}
diff --git a/sys-libs/openhpi/openhpi-3.0.0.ebuild b/sys-libs/openhpi/openhpi-3.0.0.ebuild
new file mode 100644
index 000000000000..7054b77e4aa6
--- /dev/null
+++ b/sys-libs/openhpi/openhpi-3.0.0.ebuild
@@ -0,0 +1,55 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+inherit eutils
+
+DESCRIPTION="Open source implementation of the Service Availability Forum (SAF) Hardware Platform Interface (HPI)"
+HOMEPAGE="http://www.openhpi.org/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="BSD GPL-2"
+SLOT="0"
+KEYWORDS="~x86 ~amd64"
+IUSE="snmp"
+
+COMMONDEPEND=">=dev-libs/glib-2.12:2
+ sys-fs/e2fsprogs
+ sys-fs/sysfsutils
+ >=sys-libs/openipmi-1.4.20
+ snmp? ( >=net-analyzer/net-snmp-5.07 )"
+RDEPEND="${COMMONDEPEND}"
+DEPEND="${COMMONDEPEND}
+ >=sys-devel/autoconf-2.57
+ >=sys-devel/automake-1.8
+ >=sys-devel/gcc-3.2.0
+ virtual/os-headers"
+
+src_configure() {
+ econf --with-varpath=/var/lib/openhpi \
+ --enable-clients \
+ --enable-cpp_wrappers \
+ --enable-daemon \
+ --enable-ipmidirect \
+ --enable-sysfs \
+ --enable-watchdog \
+ --enable-simulator \
+ --disable-testcover \
+ $(use_enable snmp snmp_bc)
+}
+
+src_install() {
+ # Stage main files.
+ emake DESTDIR="${D}" install
+
+ # Stage conf.d-file and init.d-script.
+ newinitd "${FILESDIR}"/openhpi-initd openhpid
+ newconfd "${FILESDIR}"/openhpi-confd openhpid
+
+ # Stage documentation.
+ dodoc README
+
+ # Make sure the data dir exists or openhpid will fail silently.
+ keepdir /var/lib/openhpi/
+}
diff --git a/sys-libs/openipmi/Manifest b/sys-libs/openipmi/Manifest
new file mode 100644
index 000000000000..04b929b1a09e
--- /dev/null
+++ b/sys-libs/openipmi/Manifest
@@ -0,0 +1,7 @@
+DIST OpenIPMI-1.3.18.tar.gz 993450 SHA256 d30bd5fe601c2f34367678f5b5aadaa879f35024eed6a0a585b30099560ff4af
+DIST OpenIPMI-1.4.12.tar.gz 1887180 SHA256 df684c19808c49c3b9b6b68ddd808c41cef283099e0b7dcb9877b5b1223048a4
+DIST OpenIPMI-1.4.14.tar.gz 1890751 SHA256 53fd789ab980c57be7155d397276a7bba214a41dccbc47c86757a669f9cddae7
+DIST OpenIPMI-1.4.28.tar.gz 2310138 SHA256 75fbff6c03c1bbea448aa8021aa2f0ee5c4f75f53600e0e479483ce2bf6d06ed
+DIST OpenIPMI-2.0.11.tar.gz 2897970 SHA256 9a824bc1faf69ef8e668dcc426c356b41abb4a18a7367c9fbbc87350df7b9cfa
+DIST OpenIPMI-2.0.16.tar.gz 2890960 SHA256 1a2f9881f27de2bb64b70c8bf9a7c38b5447e4c9a0ec9e0bf6a2833f15893c05 SHA512 f848f805427c886f41419d1312b4b2103bccf99a395c445abf4753809a5a4780a9105d25684527d4d9f43b8047726d273d18708ac67b99bae18fc294b5ea37a9 WHIRLPOOL e070a383a0639742a6302a3e546ed1a26c4a491561daf2ef991049892f4de0659370c993c486a9c2217549cf18e9829cb6fe4497b9cc528f222c0a16d612d88a
+DIST OpenIPMI-2.0.18.tar.gz 2895686 SHA256 6c1679a1c16aade48dd929e5124d2640ff12224ac0de1bb3777e9f1030d62e01 SHA512 a6caf791fb6d5bd83234481ea3c84a408dad3eabc093dbc4681742d23b47b223d0a1715a71a9b977a03a80f5c350dd34f6591ece5ea0d9876cb6debfc80a39d4 WHIRLPOOL 3b9bd32e01c118a450c5f6ec744b5cad521d41091f786a59485b91cde05ca184bdb4d8c05d53e9494966a9a733c560190f85208bedaa3b40e2cac116e3e6a84a
diff --git a/sys-libs/openipmi/files/openipmi-2.0.16-pthreads.patch b/sys-libs/openipmi/files/openipmi-2.0.16-pthreads.patch
new file mode 100644
index 000000000000..7666e34e936f
--- /dev/null
+++ b/sys-libs/openipmi/files/openipmi-2.0.16-pthreads.patch
@@ -0,0 +1,12 @@
+diff -ruN OpenIPMI-2.0.16.orig/OpenIPMIpthread.pc.in OpenIPMI-2.0.16/OpenIPMIpthread.pc.in
+--- OpenIPMI-2.0.16.orig/OpenIPMIpthread.pc.in 2005-08-17 05:56:02.000000000 +0200
++++ OpenIPMI-2.0.16/OpenIPMIpthread.pc.in 2010-10-31 21:35:56.126933520 +0100
+@@ -6,6 +6,6 @@
+ Name: OpenIPMIpthread
+ Description: Pthread OS handler for OpenIPMI
+ Version: @VERSION@
+-Requires: OpenIPMI pthread
+-Libs: -L${libdir} -lOpenIPMIutils -lOpenIPMIpthread
++Requires: OpenIPMI
++Libs: -L${libdir} -lOpenIPMIutils -lOpenIPMIpthread -lpthread
+ Cflags: -I${includedir}
diff --git a/sys-libs/openipmi/metadata.xml b/sys-libs/openipmi/metadata.xml
new file mode 100644
index 000000000000..cc81d5a5bb71
--- /dev/null
+++ b/sys-libs/openipmi/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sysadmin</herd>
+ <upstream>
+ <remote-id type="sourceforge">openipmi</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-libs/openipmi/openipmi-1.3.18.ebuild b/sys-libs/openipmi/openipmi-1.3.18.ebuild
new file mode 100644
index 000000000000..00e6746300a1
--- /dev/null
+++ b/sys-libs/openipmi/openipmi-1.3.18.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+DESCRIPTION="Library interface to IPMI"
+HOMEPAGE="http://sourceforge.net/projects/${PN}/"
+MY_PN="OpenIPMI"
+MY_P="${MY_PN}-${PV}"
+SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz"
+
+LICENSE="LGPL-2.1 GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="crypt snmp"
+S="${WORKDIR}/${MY_P}"
+
+RDEPEND="sys-libs/gdbm
+ crypt? ( dev-libs/openssl )
+ snmp? ( net-analyzer/net-snmp )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+src_compile() {
+ local myconf=""
+ myconf="${myconf} `use_with snmp ucdsnmp yes`"
+ myconf="${myconf} `use_with crypt openssl yes`"
+ # these binaries are for root!
+ econf ${myconf} --bindir=/usr/sbin || die "econf failed"
+ emake || die "emake failed"
+}
+
+src_install() {
+ make DESTDIR="${D}" install || die
+ dodoc README* FAQ ChangeLog TODO lanserv/README.emulator lanserv/atca.emu
+}
diff --git a/sys-libs/openipmi/openipmi-1.4.12.ebuild b/sys-libs/openipmi/openipmi-1.4.12.ebuild
new file mode 100644
index 000000000000..310607494302
--- /dev/null
+++ b/sys-libs/openipmi/openipmi-1.4.12.ebuild
@@ -0,0 +1,41 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+DESCRIPTION="Library interface to IPMI"
+HOMEPAGE="http://sourceforge.net/projects/${PN}/"
+MY_PN="OpenIPMI"
+MY_P="${MY_PN}-${PV}"
+SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz"
+
+LICENSE="LGPL-2.1 GPL-2"
+SLOT="0"
+KEYWORDS="~x86"
+IUSE="crypt snmp perl"
+S="${WORKDIR}/${MY_P}"
+
+RDEPEND="dev-libs/glib
+ sys-libs/gdbm
+ crypt? ( dev-libs/openssl )
+ snmp? ( net-analyzer/net-snmp )
+ perl? ( dev-lang/perl )"
+DEPEND="${RDEPEND}
+ >=dev-lang/swig-1.3.21
+ virtual/pkgconfig"
+
+src_compile() {
+ local myconf=""
+ myconf="${myconf} `use_with snmp ucdsnmp yes`"
+ myconf="${myconf} `use_with crypt openssl yes`"
+ myconf="${myconf} `use_with perl perl yes`"
+ myconf="${myconf} --with-swig=yes --with-glib=yes"
+ # these binaries are for root!
+ econf ${myconf} --bindir=/usr/sbin || die "econf failed"
+ emake || die "emake failed"
+}
+
+src_install() {
+ make DESTDIR="${D}" install || die
+ dodoc README* FAQ ChangeLog TODO doc/IPMI.pdf lanserv/README.emulator
+ newdoc cmdlang/README README.cmdlang
+}
diff --git a/sys-libs/openipmi/openipmi-1.4.14.ebuild b/sys-libs/openipmi/openipmi-1.4.14.ebuild
new file mode 100644
index 000000000000..271ff4f08fe5
--- /dev/null
+++ b/sys-libs/openipmi/openipmi-1.4.14.ebuild
@@ -0,0 +1,41 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+DESCRIPTION="Library interface to IPMI"
+HOMEPAGE="http://sourceforge.net/projects/${PN}/"
+MY_PN="OpenIPMI"
+MY_P="${MY_PN}-${PV}"
+SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz"
+
+LICENSE="LGPL-2.1 GPL-2"
+SLOT="0"
+KEYWORDS="~x86"
+IUSE="crypt snmp perl"
+S="${WORKDIR}/${MY_P}"
+
+RDEPEND="dev-libs/glib
+ sys-libs/gdbm
+ crypt? ( dev-libs/openssl )
+ snmp? ( net-analyzer/net-snmp )
+ perl? ( dev-lang/perl )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ >=dev-lang/swig-1.3.21"
+
+src_compile() {
+ local myconf=""
+ myconf="${myconf} `use_with snmp ucdsnmp yes`"
+ myconf="${myconf} `use_with crypt openssl yes`"
+ myconf="${myconf} `use_with perl perl yes`"
+ myconf="${myconf} --with-swig=yes --with-glib=yes"
+ # these binaries are for root!
+ econf ${myconf} --bindir=/usr/sbin || die "econf failed"
+ emake || die "emake failed"
+}
+
+src_install() {
+ make DESTDIR="${D}" install || die
+ dodoc README* FAQ ChangeLog TODO doc/IPMI.pdf lanserv/README.emulator
+ newdoc cmdlang/README README.cmdlang
+}
diff --git a/sys-libs/openipmi/openipmi-1.4.28.ebuild b/sys-libs/openipmi/openipmi-1.4.28.ebuild
new file mode 100644
index 000000000000..381292348b8a
--- /dev/null
+++ b/sys-libs/openipmi/openipmi-1.4.28.ebuild
@@ -0,0 +1,41 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+DESCRIPTION="Library interface to IPMI"
+HOMEPAGE="http://sourceforge.net/projects/openipmi/"
+MY_PN="OpenIPMI"
+MY_P="${MY_PN}-${PV}"
+SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz"
+
+LICENSE="LGPL-2.1 GPL-2"
+SLOT="0"
+KEYWORDS="~x86 ~amd64"
+IUSE="crypt snmp perl"
+S="${WORKDIR}/${MY_P}"
+
+RDEPEND="dev-libs/glib
+ sys-libs/gdbm
+ crypt? ( dev-libs/openssl )
+ snmp? ( net-analyzer/net-snmp )
+ perl? ( dev-lang/perl )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ >=dev-lang/swig-1.3.21"
+
+src_compile() {
+ local myconf=""
+ myconf="${myconf} `use_with snmp ucdsnmp yes`"
+ myconf="${myconf} `use_with crypt openssl yes`"
+ myconf="${myconf} `use_with perl perl yes`"
+ myconf="${myconf} --with-swig=yes --with-glib=yes"
+ # these binaries are for root!
+ econf ${myconf} --bindir=/usr/sbin || die "econf failed"
+ emake || die "emake failed"
+}
+
+src_install() {
+ make DESTDIR="${D}" install || die
+ dodoc README* FAQ ChangeLog TODO doc/IPMI.pdf lanserv/README.emulator
+ newdoc cmdlang/README README.cmdlang
+}
diff --git a/sys-libs/openipmi/openipmi-2.0.11.ebuild b/sys-libs/openipmi/openipmi-2.0.11.ebuild
new file mode 100644
index 000000000000..4cc54a483f1b
--- /dev/null
+++ b/sys-libs/openipmi/openipmi-2.0.11.ebuild
@@ -0,0 +1,71 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+DESCRIPTION="Library interface to IPMI"
+HOMEPAGE="http://sourceforge.net/projects/openipmi/"
+MY_PN="OpenIPMI"
+MY_P="${MY_PN}-${PV}"
+SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz"
+
+LICENSE="LGPL-2.1 GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~ia64 ppc x86"
+IUSE="crypt snmp perl tcl python"
+S="${WORKDIR}/${MY_P}"
+RESTRICT='test'
+
+RDEPEND="dev-libs/glib
+ sys-libs/gdbm
+ crypt? ( dev-libs/openssl )
+ snmp? ( net-analyzer/net-snmp )
+ perl? ( dev-lang/perl )
+ python? ( dev-lang/python )
+ tcl? ( dev-lang/tcl )"
+DEPEND="${RDEPEND}
+ >=dev-lang/swig-1.3.21
+ virtual/pkgconfig"
+# Gui is broken!
+# python? ( tcl? ( tk? ( dev-lang/tk dev-tcltk/tix ) ) )"
+
+# Upstream doesn't use --without properly
+use_yesno() {
+ yesmsg="yes"
+ [ -n "$3" ] && yesmsg="$3"
+ if use $1; then
+ echo "--with-$2=${yesmsg}"
+ else
+ echo "--without-$2"
+ fi
+}
+
+src_compile() {
+ local myconf=""
+ myconf="${myconf} `use_with snmp ucdsnmp yes`"
+ myconf="${myconf} `use_with crypt openssl yes`"
+ myconf="${myconf} `use_with perl perl yes`"
+ myconf="${myconf} `use_with tcl tcl yes`"
+ myconf="${myconf} `use_with python python yes`"
+
+ # GUI is broken
+ #use tk && use python && use !tcl && \
+ # ewarn "Not building Tk GUI because it needs both Python AND Tcl"
+ #if use python && use tcl; then
+ # myconf="${myconf} `use_yesno tk tkinter yes`"
+ #else
+ # myconf="${myconf} `use_yesno tk tkinter no`"
+ #fi
+
+ myconf="${myconf} --without-tkinter"
+ myconf="${myconf} --with-glib --with-swig"
+ # these binaries are for root!
+ econf ${myconf} --bindir=/usr/sbin || die "econf failed"
+ emake || die "emake failed"
+}
+
+src_install() {
+ # bug #298250
+ emake -j1 DESTDIR="${D}" install || die
+ dodoc README* FAQ ChangeLog TODO doc/IPMI.pdf lanserv/README.emulator
+ newdoc cmdlang/README README.cmdlang
+}
diff --git a/sys-libs/openipmi/openipmi-2.0.16-r1.ebuild b/sys-libs/openipmi/openipmi-2.0.16-r1.ebuild
new file mode 100644
index 000000000000..f3d3eba4e0b1
--- /dev/null
+++ b/sys-libs/openipmi/openipmi-2.0.16-r1.ebuild
@@ -0,0 +1,105 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils autotools python
+
+DESCRIPTION="Library interface to IPMI"
+HOMEPAGE="http://sourceforge.net/projects/openipmi/"
+MY_PN="OpenIPMI"
+MY_P="${MY_PN}-${PV}"
+SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz"
+
+LICENSE="LGPL-2.1 GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ia64 ~ppc ~x86"
+IUSE="crypt snmp perl tcl python"
+S="${WORKDIR}/${MY_P}"
+RESTRICT='test'
+
+RDEPEND="dev-libs/glib
+ sys-libs/gdbm
+ crypt? ( dev-libs/openssl )
+ snmp? ( net-analyzer/net-snmp )
+ perl? ( dev-lang/perl )
+ python? ( dev-lang/python )
+ tcl? ( dev-lang/tcl )"
+DEPEND="${RDEPEND}
+ >=dev-lang/swig-1.3.21
+ virtual/pkgconfig"
+# Gui is broken!
+# python? ( tcl? ( tk? ( dev-lang/tk dev-tcltk/tix ) ) )"
+
+# Upstream doesn't use --without properly
+use_yesno() {
+ yesmsg="yes"
+ [ -n "$3" ] && yesmsg="$3"
+ if use $1; then
+ echo "--with-$2=${yesmsg}"
+ else
+ echo "--without-$2"
+ fi
+}
+
+src_unpack() {
+ unpack ${A}
+ # Bug #338499: The installed OpenIPMIpthread.pc depends on a non-existing
+ # pthread.pc. We patch it to link -lpthread directly instead.
+ epatch "${FILESDIR}/${P}-pthreads.patch"
+ # Bug #290763: The buildsys tries to compile+optimize the py file during
+ # install, when the .so might not be been added yet. We just skip the files
+ # and use python_mod_optimize ourselves later instead.
+ sed -r -i \
+ -e '/INSTALL.*\.py[oc] /d' \
+ -e '/install-exec-local/s,OpenIPMI.pyc OpenIPMI.pyo,,g' \
+ "${S}"/swig/python/Makefile.{am,in}
+
+ # Bug #298250: parallel install fix.
+ sed -r -i \
+ -e '/^install-data-local:/s,$, install-exec-am,g' \
+ "${S}"/cmdlang/Makefile.{am,in}
+
+ # We touch the .in and .am above because if we use the below, the Perl stuff
+ # is very fragile, and often fails to link.
+ #cd "${S}"
+ #elibtoolize
+ #eautoreconf
+}
+
+src_compile() {
+ local myconf=""
+ myconf="${myconf} `use_with snmp ucdsnmp yes`"
+ myconf="${myconf} `use_with crypt openssl yes`"
+ myconf="${myconf} `use_with perl perl yes`"
+ myconf="${myconf} `use_with tcl tcl yes`"
+ myconf="${myconf} `use_with python python yes`"
+
+ # GUI is broken
+ #use tk && use python && use !tcl && \
+ # ewarn "Not building Tk GUI because it needs both Python AND Tcl"
+ #if use python && use tcl; then
+ # myconf="${myconf} `use_yesno tk tkinter yes`"
+ #else
+ # myconf="${myconf} `use_yesno tk tkinter no`"
+ #fi
+
+ myconf="${myconf} --without-tkinter"
+ myconf="${myconf} --with-glib --with-swig"
+ # these binaries are for root!
+ econf ${myconf} --bindir=/usr/sbin || die "econf failed"
+ emake || die "emake $i failed"
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die
+ dodoc README* FAQ ChangeLog TODO doc/IPMI.pdf lanserv/README.emulator
+ newdoc cmdlang/README README.cmdlang
+}
+
+pkg_postinst() {
+ use python && python_mod_optimize $(python_get_sitedir)/OpenIPMI.py
+}
+
+pkg_postrm() {
+ use python && python_mod_cleanup $(python_get_sitedir)/OpenIPMI.py
+}
diff --git a/sys-libs/openipmi/openipmi-2.0.16.ebuild b/sys-libs/openipmi/openipmi-2.0.16.ebuild
new file mode 100644
index 000000000000..28d2623ab8c0
--- /dev/null
+++ b/sys-libs/openipmi/openipmi-2.0.16.ebuild
@@ -0,0 +1,102 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit autotools python
+
+DESCRIPTION="Library interface to IPMI"
+HOMEPAGE="http://sourceforge.net/projects/openipmi/"
+MY_PN="OpenIPMI"
+MY_P="${MY_PN}-${PV}"
+SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz"
+
+LICENSE="LGPL-2.1 GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~ia64 ppc x86"
+IUSE="crypt snmp perl tcl python"
+S="${WORKDIR}/${MY_P}"
+RESTRICT='test'
+
+RDEPEND="dev-libs/glib
+ sys-libs/gdbm
+ crypt? ( dev-libs/openssl )
+ snmp? ( net-analyzer/net-snmp )
+ perl? ( dev-lang/perl )
+ python? ( dev-lang/python )
+ tcl? ( dev-lang/tcl )"
+DEPEND="${RDEPEND}
+ >=dev-lang/swig-1.3.21
+ virtual/pkgconfig"
+# Gui is broken!
+# python? ( tcl? ( tk? ( dev-lang/tk dev-tcltk/tix ) ) )"
+
+# Upstream doesn't use --without properly
+use_yesno() {
+ yesmsg="yes"
+ [ -n "$3" ] && yesmsg="$3"
+ if use $1; then
+ echo "--with-$2=${yesmsg}"
+ else
+ echo "--without-$2"
+ fi
+}
+
+src_unpack() {
+ unpack ${A}
+ # Bug #290763: The buildsys tries to compile+optimize the py file during
+ # install, when the .so might not be been added yet. We just skip the files
+ # and use python_mod_optimize ourselves later instead.
+ sed -r -i \
+ -e '/INSTALL.*\.py[oc] /d' \
+ -e '/install-exec-local/s,OpenIPMI.pyc OpenIPMI.pyo,,g' \
+ "${S}"/swig/python/Makefile.{am,in}
+
+ # Bug #298250: parallel install fix.
+ sed -r -i \
+ -e '/^install-data-local:/s,$, install-exec-am,g' \
+ "${S}"/cmdlang/Makefile.{am,in}
+
+ # We touch the .in and .am above because if we use the below, the Perl stuff
+ # is very fragile, and often fails to link.
+ #cd "${S}"
+ #elibtoolize
+ #eautoreconf
+}
+
+src_compile() {
+ local myconf=""
+ myconf="${myconf} `use_with snmp ucdsnmp yes`"
+ myconf="${myconf} `use_with crypt openssl yes`"
+ myconf="${myconf} `use_with perl perl yes`"
+ myconf="${myconf} `use_with tcl tcl yes`"
+ myconf="${myconf} `use_with python python yes`"
+
+ # GUI is broken
+ #use tk && use python && use !tcl && \
+ # ewarn "Not building Tk GUI because it needs both Python AND Tcl"
+ #if use python && use tcl; then
+ # myconf="${myconf} `use_yesno tk tkinter yes`"
+ #else
+ # myconf="${myconf} `use_yesno tk tkinter no`"
+ #fi
+
+ myconf="${myconf} --without-tkinter"
+ myconf="${myconf} --with-glib --with-swig"
+ # these binaries are for root!
+ econf ${myconf} --bindir=/usr/sbin || die "econf failed"
+ emake || die "emake $i failed"
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die
+ dodoc README* FAQ ChangeLog TODO doc/IPMI.pdf lanserv/README.emulator
+ newdoc cmdlang/README README.cmdlang
+}
+
+pkg_postinst() {
+ use python && python_mod_optimize $(python_get_sitedir)/OpenIPMI.py
+}
+
+pkg_postrm() {
+ use python && python_mod_cleanup $(python_get_sitedir)/OpenIPMI.py
+}
diff --git a/sys-libs/openipmi/openipmi-2.0.18-r1.ebuild b/sys-libs/openipmi/openipmi-2.0.18-r1.ebuild
new file mode 100644
index 000000000000..d7fa7eef078f
--- /dev/null
+++ b/sys-libs/openipmi/openipmi-2.0.18-r1.ebuild
@@ -0,0 +1,97 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 )
+
+inherit eutils autotools python-single-r1
+
+DESCRIPTION="Library interface to IPMI"
+HOMEPAGE="http://sourceforge.net/projects/openipmi/"
+MY_PN="OpenIPMI"
+MY_P="${MY_PN}-${PV}"
+SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz"
+
+LICENSE="LGPL-2.1 GPL-2"
+SLOT="0"
+KEYWORDS="amd64 hppa ~ia64 ppc x86"
+IUSE="crypt snmp perl tcl python"
+S="${WORKDIR}/${MY_P}"
+RESTRICT='test'
+
+RDEPEND="
+ dev-libs/glib:2
+ sys-libs/gdbm
+ crypt? ( dev-libs/openssl:0= )
+ snmp? ( net-analyzer/net-snmp )
+ perl? ( dev-lang/perl )
+ python? ( ${PYTHON_DEPS} )
+ tcl? ( dev-lang/tcl:0= )"
+DEPEND="${RDEPEND}
+ >=dev-lang/swig-1.3.21
+ virtual/pkgconfig"
+# Gui is broken!
+# python? ( tcl? ( tk? ( dev-lang/tk dev-tcltk/tix ) ) )"
+
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+pkg_setup() {
+ use python && python-single-r1_pkg_setup
+}
+
+src_prepare() {
+ # Bug #338499: The installed OpenIPMIpthread.pc depends on a non-existing
+ # pthread.pc. We patch it to link -lpthread directly instead.
+ epatch "${FILESDIR}/${PN}-2.0.16-pthreads.patch"
+ # Bug #290763: The buildsys tries to compile+optimize the py file during
+ # install, when the .so might not be been added yet. We just skip the files
+ # and use python_optimize ourselves later instead.
+ sed -r -i \
+ -e '/INSTALL.*\.py[oc] /d' \
+ -e '/install-exec-local/s,OpenIPMI.pyc OpenIPMI.pyo,,g' \
+ swig/python/Makefile.{am,in}
+
+ # Bug #298250: parallel install fix.
+ sed -r -i \
+ -e '/^install-data-local:/s,$, install-exec-am,g' \
+ cmdlang/Makefile.{am,in}
+
+ # We touch the .in and .am above because if we use the below, the Perl stuff
+ # is very fragile, and often fails to link.
+ #cd "${S}"
+ #elibtoolize
+ #eautoreconf
+}
+
+src_configure() {
+ local myconf=""
+ myconf="${myconf} `use_with snmp ucdsnmp yes`"
+ myconf="${myconf} `use_with crypt openssl yes`"
+ myconf="${myconf} `use_with perl perl yes`"
+ myconf="${myconf} `use_with tcl tcl yes`"
+ myconf="${myconf} `use_with python python yes`"
+
+ # GUI is broken
+ #use tk && use python && use !tcl && \
+ # ewarn "Not building Tk GUI because it needs both Python AND Tcl"
+ #if use python && use tcl; then
+ # myconf="${myconf} `use_yesno tk tkinter yes`"
+ #else
+ # myconf="${myconf} `use_yesno tk tkinter no`"
+ #fi
+
+ myconf="${myconf} --without-tkinter"
+ myconf="${myconf} --with-glib --with-swig"
+ # these binaries are for root!
+ econf ${myconf} --bindir=/usr/sbin
+}
+
+src_install() {
+ emake DESTDIR="${D}" install
+ dodoc README* FAQ ChangeLog TODO doc/IPMI.pdf lanserv/README.emulator
+ newdoc cmdlang/README README.cmdlang
+
+ use python && python_optimize
+}
diff --git a/sys-libs/openipmi/openipmi-2.0.18.ebuild b/sys-libs/openipmi/openipmi-2.0.18.ebuild
new file mode 100644
index 000000000000..4e12b0a22b0d
--- /dev/null
+++ b/sys-libs/openipmi/openipmi-2.0.18.ebuild
@@ -0,0 +1,106 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils autotools python
+
+DESCRIPTION="Library interface to IPMI"
+HOMEPAGE="http://sourceforge.net/projects/openipmi/"
+MY_PN="OpenIPMI"
+MY_P="${MY_PN}-${PV}"
+SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz"
+
+LICENSE="LGPL-2.1 GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 hppa ~ia64 ~ppc ~x86"
+IUSE="crypt snmp perl tcl python"
+S="${WORKDIR}/${MY_P}"
+RESTRICT='test'
+
+RDEPEND="dev-libs/glib
+ sys-libs/gdbm
+ crypt? ( dev-libs/openssl )
+ snmp? ( net-analyzer/net-snmp )
+ perl? ( dev-lang/perl )
+ python? ( dev-lang/python )
+ tcl? ( dev-lang/tcl )"
+DEPEND="${RDEPEND}
+ >=dev-lang/swig-1.3.21
+ virtual/pkgconfig"
+# Gui is broken!
+# python? ( tcl? ( tk? ( dev-lang/tk dev-tcltk/tix ) ) )"
+
+# Upstream doesn't use --without properly
+use_yesno() {
+ yesmsg="yes"
+ [ -n "$3" ] && yesmsg="$3"
+ if use $1; then
+ echo "--with-$2=${yesmsg}"
+ else
+ echo "--without-$2"
+ fi
+}
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ # Bug #338499: The installed OpenIPMIpthread.pc depends on a non-existing
+ # pthread.pc. We patch it to link -lpthread directly instead.
+ epatch "${FILESDIR}/${PN}-2.0.16-pthreads.patch"
+ # Bug #290763: The buildsys tries to compile+optimize the py file during
+ # install, when the .so might not be been added yet. We just skip the files
+ # and use python_mod_optimize ourselves later instead.
+ sed -r -i \
+ -e '/INSTALL.*\.py[oc] /d' \
+ -e '/install-exec-local/s,OpenIPMI.pyc OpenIPMI.pyo,,g' \
+ swig/python/Makefile.{am,in}
+
+ # Bug #298250: parallel install fix.
+ sed -r -i \
+ -e '/^install-data-local:/s,$, install-exec-am,g' \
+ cmdlang/Makefile.{am,in}
+
+ # We touch the .in and .am above because if we use the below, the Perl stuff
+ # is very fragile, and often fails to link.
+ #cd "${S}"
+ #elibtoolize
+ #eautoreconf
+}
+
+src_compile() {
+ local myconf=""
+ myconf="${myconf} `use_with snmp ucdsnmp yes`"
+ myconf="${myconf} `use_with crypt openssl yes`"
+ myconf="${myconf} `use_with perl perl yes`"
+ myconf="${myconf} `use_with tcl tcl yes`"
+ myconf="${myconf} `use_with python python yes`"
+
+ # GUI is broken
+ #use tk && use python && use !tcl && \
+ # ewarn "Not building Tk GUI because it needs both Python AND Tcl"
+ #if use python && use tcl; then
+ # myconf="${myconf} `use_yesno tk tkinter yes`"
+ #else
+ # myconf="${myconf} `use_yesno tk tkinter no`"
+ #fi
+
+ myconf="${myconf} --without-tkinter"
+ myconf="${myconf} --with-glib --with-swig"
+ # these binaries are for root!
+ econf ${myconf} --bindir=/usr/sbin || die "econf failed"
+ emake || die "emake $i failed"
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die
+ dodoc README* FAQ ChangeLog TODO doc/IPMI.pdf lanserv/README.emulator
+ newdoc cmdlang/README README.cmdlang
+}
+
+pkg_postinst() {
+ use python && python_mod_optimize $(python_get_sitedir)/OpenIPMI.py
+}
+
+pkg_postrm() {
+ use python && python_mod_cleanup $(python_get_sitedir)/OpenIPMI.py
+}
diff --git a/sys-libs/pam/Manifest b/sys-libs/pam/Manifest
new file mode 100644
index 000000000000..8cc152f7dfda
--- /dev/null
+++ b/sys-libs/pam/Manifest
@@ -0,0 +1,9 @@
+DIST Linux-PAM-1.1.5-docs.tar.bz2 498228 SHA256 e4b10ffebe2e5cc355bd37c4e17a2288eb90d1396b06961738a7e7ef848c754c SHA512 6209b3d1936e0c0aef3a7bf24d497b867995261ad227f7d0c4b28796c0b1f9262c99e3e12d7e1d37e286af39367f6e2d79e06915dff77c65b547d62ee8772c5b WHIRLPOOL a26c778be99b21c6701260871ffd7348f7a302c5e4358b8419e9436131b83650bdf0f5bc1d845dba419bab6c50c89733bea4518f619b7b75d66b2f02408c3df1
+DIST Linux-PAM-1.1.5.tar.bz2 1123524 SHA256 65def4df04254dc4c5156859d36c34ad6d7afbcf3adbf2780530ebc4dbf2a116 SHA512 c898c3db3da1856b1b16c2bfe19963c30696345982253888c2edf85317cf82ab4daaf9d105a162975d4cfd818b7bbca3d0e63ea7267af435e8f88b8fdc83ddd0 WHIRLPOOL 29ad881f6b1d908fb84e8d5802cceff70838bd0e29f6c700ad64d3c5d43c189f0c122fdddfa4333f008a8ef2828bb0e2fd68cdd479b43efac9456b6d6a5bb25a
+DIST Linux-PAM-1.1.6-docs.tar.bz2 147359 SHA256 0244321b1c4b8a71064d984880566890cc809b1c77bdd0550f121fa7d8450497 SHA512 f158116c2a3d604a9195d96263f094a1c9c0e2ba78b54e0f8a92bfa73955d8cec36d68b985eb70f1bf0958fc54be5590b61669b3b777ba6bd2138bc156cec782 WHIRLPOOL 73b42d795b3ca06c3a22ea8a91258da9bd4662e72de8a72751eec3824524a44e13dbc13a7c0e79256429f583d21c2764512363921d5709e61752e391f8227577
+DIST Linux-PAM-1.1.6.tar.bz2 1147538 SHA256 bab887d6280f47fc3963df3b95735a27a16f0f663636163ddf3acab5f1149fc2 SHA512 f68e3a0d648441eef7589efe0fad65c621d030a9425635f461f2882a5129240830a55d5a5b81d02b439c633870a96f61b4c4dea22d0eacfdd583f4fac353928a WHIRLPOOL 619214ecf859e1fc4e6f59e37045e370b98bae57ceeaed3f6a5e0732fc0caba41c040bea926830b678f6e5c243d73a607daea438f55cf28d339ce458eded7db5
+DIST Linux-PAM-1.1.8-docs.tar.bz2 147887 SHA256 c4bb6a0e8307d2ab5611457fecf20fcbd6cdfff51dea524f0f06c74e4f3b4ff8 SHA512 36aa99996f8cc0640686d2af40845e18ad4b48183f18de9e1495427550ad5b61e2f59e25f6d5e8df1277cd3f171fd69bf6c49fe7c5b31f0b290e3641b65521e8 WHIRLPOOL c4b373e59fac30a29c2b16f01419492c72fae2ceb15b157418bba4899b75cf4b97bac4559b688ef8d5a231cc972f72654c4e10d63a0b72a0d6573388f7125f87
+DIST Linux-PAM-1.1.8.tar.bz2 1148944 SHA256 c4b1f23a236d169e2496fea20721578d864ba00f7242d2b41d81050ac87a1e55 SHA512 245785ab4e187ceaab6393967352c8d2a2319c64e1e83285d0251cc02995dc2edab8e3001301b6d9f6774c441b7557d9caf4dfdf94c7cd5d44aa53ae759d9e5d WHIRLPOOL b4ec7baeb57b9d987086fe3e007e08e8b9c92b2ff86a94f8003a87c8448925835808661cd719d2445570aa8dd1c20fcbbe8bd465d73f4af8cd7edde0f650a734
+DIST Linux-PAM-1.2.0-docs.tar.bz2 490586 SHA256 3bc9ae398f759e372dbf4065ceed2df8b1ac5ab62c6688cb5f7849ce773df2c3 SHA512 028b7f9d6b0a5cf38f063e0f82ac3d0955e1e41d77c9f3fc803363d9ea710d71366e0a91f31b418cac397bb6639442de908fa00f02cd94cf612496d1b43c7e4c WHIRLPOOL 9a329b610d840c904050b2261e5ce34ac54232b0c7d51c12ee45c9e758ab6659ea8562e032fa9815c2beab0cfa1ea455dbfbf3cdef39d30d299a8bc5286f7a14
+DIST Linux-PAM-1.2.0.tar.bz2 1278831 SHA256 cd8beac5961e942e9c73b32a3cd1a3457755f8fb35d07c9ec64511e19e135ea4 SHA512 26b9ec0f8c7fcc00a04696a2208fc00dabb070593f1a420c81e2855cd2eb26ebcc993f80ccbb6a2aac88dd402b670e7800e1722c56451dfc71521c76a2f0bf9a WHIRLPOOL b3327394bb99ff02d9efba43655a2f5bfd4acbf0c75630fde19634ff575cce3fef614c188d538529673526fd88488a5493b19af30c6f69064824cbc1aad3d766
+DIST Linux-PAM-1.2.1.tar.bz2 1279523 SHA256 342b1211c0d3b203a7df2540a5b03a428a087bd8a48c17e49ae268f992b334d9 SHA512 4572aa1eaf5a1312410c74b5ed055b2592c5efe2bb82f59981da4e9e93555ad40aee3a89f446d9dc6c6af79efc04c33f739f66db9edc07e02479475a14e426da WHIRLPOOL 562917945b3b3a407955cc5bf5cd251ff7e257a94055d7cfbf06d5c2619b58d61624f16848de3512ddf61636ad8618315de3f7bd8e4e51b3b7d109adfa212c8a
diff --git a/sys-libs/pam/files/Linux-PAM-1.1.5+glibc-2.16.patch b/sys-libs/pam/files/Linux-PAM-1.1.5+glibc-2.16.patch
new file mode 100644
index 000000000000..114d3e47008a
--- /dev/null
+++ b/sys-libs/pam/files/Linux-PAM-1.1.5+glibc-2.16.patch
@@ -0,0 +1,20 @@
+--- a/modules/pam_unix/pam_unix_acct.c 2011-06-21 11:04:56.000000000 +0200
++++ b/modules/pam_unix/pam_unix_acct.c 2012-07-05 16:04:35.643727485 +0200
+@@ -41,6 +41,7 @@
+ #include <string.h>
+ #include <unistd.h>
+ #include <sys/types.h>
++#include <sys/resource.h>
+ #include <syslog.h>
+ #include <pwd.h>
+ #include <shadow.h>
+--- a/modules/pam_unix/pam_unix_passwd.c 2012-07-16 11:49:25.954638105 -0500
++++ b/modules/pam_unix/pam_unix_passwd.c 2012-07-16 11:50:04.408635441 -0500
+@@ -46,6 +46,7 @@
+ #include <unistd.h>
+ #include <errno.h>
+ #include <sys/types.h>
++#include <sys/resource.h>
+ #include <pwd.h>
+ #include <syslog.h>
+ #include <shadow.h>
diff --git a/sys-libs/pam/files/Linux-PAM-1.1.6+glibc-2.16.patch b/sys-libs/pam/files/Linux-PAM-1.1.6+glibc-2.16.patch
new file mode 100644
index 000000000000..cddda35fbeb9
--- /dev/null
+++ b/sys-libs/pam/files/Linux-PAM-1.1.6+glibc-2.16.patch
@@ -0,0 +1,29 @@
+From 18da0c4763f5e079f8b2df45fa462b0b70b6fd3a Mon Sep 17 00:00:00 2001
+From: "Jory A. Pratt" <anarchy@gentoo.org>
+Date: Sun, 7 Oct 2012 11:44:17 -0700
+Subject: [PATCH] Fix building with GLIBC 2.16 and SELinux.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+
+Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.eu>
+---
+ modules/pam_unix/pam_unix_passwd.c | 1 +
+ 1 file modificato, 1 inserzione(+)
+
+diff --git a/modules/pam_unix/pam_unix_passwd.c b/modules/pam_unix/pam_unix_passwd.c
+index 9e1302d..b5f5ae9 100644
+--- a/modules/pam_unix/pam_unix_passwd.c
++++ b/modules/pam_unix/pam_unix_passwd.c
+@@ -46,6 +46,7 @@
+ #include <unistd.h>
+ #include <errno.h>
+ #include <sys/types.h>
++#include <sys/resource.h>
+ #include <pwd.h>
+ #include <syslog.h>
+ #include <shadow.h>
+--
+1.7.12
+
diff --git a/sys-libs/pam/files/Linux-PAM-1.1.6-destdir.patch b/sys-libs/pam/files/Linux-PAM-1.1.6-destdir.patch
new file mode 100644
index 000000000000..6859ccb60d3f
--- /dev/null
+++ b/sys-libs/pam/files/Linux-PAM-1.1.6-destdir.patch
@@ -0,0 +1,48 @@
+From d7e6b921cd34f7ad8fc4d05065c75d13ba330896 Mon Sep 17 00:00:00 2001
+From: Tomas Mraz <tmraz@fedoraproject.org>
+Date: Fri, 17 Aug 2012 14:46:40 +0200
+Subject: [PATCH] Add missing $(DESTDIR) when making directories on install.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+modules/pam_namespace/Makefile.am: Add missing $(DESTDIR) when making
+$(namespaceddir) on install.
+modules/pam_sepermit/Makefile.am: Add missing $(DESTDIR) when making
+$(sepermitlockdir) on install.
+
+Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.eu>
+---
+ modules/pam_namespace/Makefile.am | 2 +-
+ modules/pam_sepermit/Makefile.am | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/modules/pam_namespace/Makefile.am b/modules/pam_namespace/Makefile.am
+index a28f196..ebb00f3 100644
+--- a/modules/pam_namespace/Makefile.am
++++ b/modules/pam_namespace/Makefile.am
+@@ -40,7 +40,7 @@ if HAVE_UNSHARE
+ secureconf_SCRIPTS = namespace.init
+
+ install-data-local:
+- mkdir -p $(namespaceddir)
++ mkdir -p $(DESTDIR)$(namespaceddir)
+ endif
+
+
+diff --git a/modules/pam_sepermit/Makefile.am b/modules/pam_sepermit/Makefile.am
+index cfc5594..bc82275 100644
+--- a/modules/pam_sepermit/Makefile.am
++++ b/modules/pam_sepermit/Makefile.am
+@@ -35,7 +35,7 @@ if HAVE_LIBSELINUX
+ securelib_LTLIBRARIES = pam_sepermit.la
+
+ install-data-local:
+- mkdir -p $(sepermitlockdir)
++ mkdir -p $(DESTDIR)$(sepermitlockdir)
+ endif
+ if ENABLE_REGENERATE_MAN
+ noinst_DATA = README pam_sepermit.8 sepermit.conf.5
+--
+1.7.8.6
+
diff --git a/sys-libs/pam/files/pam-1.1.8-CVE-2013-7041.patch b/sys-libs/pam/files/pam-1.1.8-CVE-2013-7041.patch
new file mode 100644
index 000000000000..338aa9695ae5
--- /dev/null
+++ b/sys-libs/pam/files/pam-1.1.8-CVE-2013-7041.patch
@@ -0,0 +1,54 @@
+https://bugs.gentoo.org/493432
+
+From 57a1e2b274d0a6376d92ada9926e5c5741e7da20 Mon Sep 17 00:00:00 2001
+From: "Dmitry V. Levin" <ldv@altlinux.org>
+Date: Fri, 24 Jan 2014 22:18:32 +0000
+Subject: [PATCH] pam_userdb: fix password hash comparison
+
+Starting with commit Linux-PAM-0-77-28-g0b3e583 that introduced hashed
+passwords support in pam_userdb, hashes are compared case-insensitively.
+This bug leads to accepting hashes for completely different passwords in
+addition to those that should be accepted.
+
+Additionally, commit Linux-PAM-1_1_6-13-ge2a8187 that added support for
+modern password hashes with different lengths and settings, did not
+update the hash comparison accordingly, which leads to accepting
+computed hashes longer than stored hashes when the latter is a prefix
+of the former.
+
+* modules/pam_userdb/pam_userdb.c (user_lookup): Reject the computed
+hash whose length differs from the stored hash length.
+Compare computed and stored hashes case-sensitively.
+Fixes CVE-2013-7041.
+
+Bug-Debian: http://bugs.debian.org/731368
+---
+ modules/pam_userdb/pam_userdb.c | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/modules/pam_userdb/pam_userdb.c b/modules/pam_userdb/pam_userdb.c
+index de8b5b1..ff040e6 100644
+--- a/modules/pam_userdb/pam_userdb.c
++++ b/modules/pam_userdb/pam_userdb.c
+@@ -222,12 +222,15 @@ user_lookup (pam_handle_t *pamh, const char *database, const char *cryptmode,
+ } else {
+ cryptpw = crypt (pass, data.dptr);
+
+- if (cryptpw) {
+- compare = strncasecmp (data.dptr, cryptpw, data.dsize);
++ if (cryptpw && strlen(cryptpw) == (size_t)data.dsize) {
++ compare = memcmp(data.dptr, cryptpw, data.dsize);
+ } else {
+ compare = -2;
+ if (ctrl & PAM_DEBUG_ARG) {
+- pam_syslog(pamh, LOG_INFO, "crypt() returned NULL");
++ if (cryptpw)
++ pam_syslog(pamh, LOG_INFO, "lengths of computed and stored hashes differ");
++ else
++ pam_syslog(pamh, LOG_INFO, "crypt() returned NULL");
+ }
+ };
+
+--
+2.4.0
+
diff --git a/sys-libs/pam/files/pam-1.1.8-CVE-2014-2583.patch b/sys-libs/pam/files/pam-1.1.8-CVE-2014-2583.patch
new file mode 100644
index 000000000000..7965b77b0484
--- /dev/null
+++ b/sys-libs/pam/files/pam-1.1.8-CVE-2014-2583.patch
@@ -0,0 +1,58 @@
+https://bugs.gentoo.org/505604
+
+From 9dcead87e6d7f66d34e7a56d11a30daca367dffb Mon Sep 17 00:00:00 2001
+From: "Dmitry V. Levin" <ldv@altlinux.org>
+Date: Wed, 26 Mar 2014 22:17:23 +0000
+Subject: [PATCH] pam_timestamp: fix potential directory traversal issue
+ (ticket #27)
+
+pam_timestamp uses values of PAM_RUSER and PAM_TTY as components of
+the timestamp pathname it creates, so extra care should be taken to
+avoid potential directory traversal issues.
+
+* modules/pam_timestamp/pam_timestamp.c (check_tty): Treat
+"." and ".." tty values as invalid.
+(get_ruser): Treat "." and ".." ruser values, as well as any ruser
+value containing '/', as invalid.
+
+Fixes CVE-2014-2583.
+
+Reported-by: Sebastian Krahmer <krahmer@suse.de>
+---
+ modules/pam_timestamp/pam_timestamp.c | 13 ++++++++++++-
+ 1 file changed, 12 insertions(+), 1 deletion(-)
+
+diff --git a/modules/pam_timestamp/pam_timestamp.c b/modules/pam_timestamp/pam_timestamp.c
+index 5193733..b3f08b1 100644
+--- a/modules/pam_timestamp/pam_timestamp.c
++++ b/modules/pam_timestamp/pam_timestamp.c
+@@ -158,7 +158,7 @@ check_tty(const char *tty)
+ tty = strrchr(tty, '/') + 1;
+ }
+ /* Make sure the tty wasn't actually a directory (no basename). */
+- if (strlen(tty) == 0) {
++ if (!strlen(tty) || !strcmp(tty, ".") || !strcmp(tty, "..")) {
+ return NULL;
+ }
+ return tty;
+@@ -243,6 +243,17 @@ get_ruser(pam_handle_t *pamh, char *ruserbuf, size_t ruserbuflen)
+ if (pwd != NULL) {
+ ruser = pwd->pw_name;
+ }
++ } else {
++ /*
++ * This ruser is used by format_timestamp_name as a component
++ * of constructed timestamp pathname, so ".", "..", and '/'
++ * are disallowed to avoid potential path traversal issues.
++ */
++ if (!strcmp(ruser, ".") ||
++ !strcmp(ruser, "..") ||
++ strchr(ruser, '/')) {
++ ruser = NULL;
++ }
+ }
+ if (ruser == NULL || strlen(ruser) >= ruserbuflen) {
+ *ruserbuf = '\0';
+--
+2.4.0
+
diff --git a/sys-libs/pam/files/pam-1.1.8-doc-install.patch b/sys-libs/pam/files/pam-1.1.8-doc-install.patch
new file mode 100644
index 000000000000..bdd5b9d48164
--- /dev/null
+++ b/sys-libs/pam/files/pam-1.1.8-doc-install.patch
@@ -0,0 +1,142 @@
+https://bugs.gentoo.org/473650
+https://fedorahosted.org/linux-pam/ticket/31
+
+fix doc installs when doing out of tree builds
+
+--- a/doc/adg/Makefile.in
++++ b/doc/adg/Makefile.in
+@@ -463,17 +463,17 @@ install-data-local:
+ $(mkinstalldirs) $(DESTDIR)$(docdir)
+ $(mkinstalldirs) $(DESTDIR)$(pdfdir)
+ $(mkinstalldirs) $(DESTDIR)$(htmldir)
+- test -f html/Linux-PAM_ADG.html || exit 0; \
++ test -f html/Linux-PAM_ADG.html -o -f $(srcdir)/html/Linux-PAM_ADG.html || exit 0; \
+ $(install_sh_DATA) html/Linux-PAM_ADG.html html/adg-*.html \
+ $(DESTDIR)$(htmldir)/ || \
+ $(install_sh_DATA) $(srcdir)/html/Linux-PAM_ADG.html \
+- $(srcdir)/html/sag-*.html \
++ $(srcdir)/html/adg-*.html \
+ $(DESTDIR)$(htmldir)/
+- test -f Linux-PAM_ADG.txt || exit 0; \
++ test -f Linux-PAM_ADG.txt -o -f $(srcdir)/Linux-PAM_ADG.txt || exit 0; \
+ $(install_sh_DATA) Linux-PAM_ADG.txt $(DESTDIR)$(docdir)/ || \
+ $(install_sh_DATA) $(srcdir)/Linux-PAM_ADG.txt \
+ $(DESTDIR)$(docdir)/
+- test -f Linux-PAM_ADG.pdf || exit 0; \
++ test -f Linux-PAM_ADG.pdf -o -f $(srcdir)/Linux-PAM_ADG.pdf || exit 0; \
+ $(install_sh_DATA) Linux-PAM_ADG.pdf $(DESTDIR)$(pdfdir)/ || \
+ $(install_sh_DATA) $(srcdir)/Linux-PAM_ADG.pdf \
+ $(DESTDIR)$(pdfdir)/
+@@ -486,18 +486,18 @@ uninstall-local:
+
+ releasedocs: all
+ $(mkinstalldirs) $(top_builddir)/Linux-PAM-$(VERSION)/doc/adg/html
+- test -f html/Linux-PAM_ADG.html || exit 0; \
++ test -f html/Linux-PAM_ADG.html -o -f $(srcdir)/html/Linux-PAM_ADG.html || exit 0; \
+ cp -ap html/Linux-PAM_ADG.html html/adg-*.html \
+ $(top_builddir)/Linux-PAM-$(VERSION)/doc/adg/html/ || \
+ cp -ap $(srcdir)/html/Linux-PAM_ADG.html \
+ $(srcdir)/html/adg-*.html \
+ $(top_builddir)/Linux-PAM-$(VERSION)/doc/adg/html/
+- test -f Linux-PAM_ADG.txt || exit 0; \
++ test -f Linux-PAM_ADG.txt -o -f $(srcdir)/Linux-PAM_ADG.txt || exit 0; \
+ cp -p Linux-PAM_ADG.txt \
+ $(top_builddir)/Linux-PAM-$(VERSION)/doc/adg/ || \
+ cp -p $(srcdir)/Linux-PAM_ADG.txt \
+ $(top_builddir)/Linux-PAM-$(VERSION)/doc/adg/
+- test -f Linux-PAM_ADG.pdf || exit 0; \
++ test -f Linux-PAM_ADG.pdf -o -f $(srcdir)/Linux-PAM_ADG.pdf || exit 0; \
+ cp -p Linux-PAM_ADG.pdf \
+ $(top_builddir)/Linux-PAM-$(VERSION)/doc/adg/ || \
+ cp -p $(srcdir)/Linux-PAM_ADG.pdf \
+--- a/doc/mwg/Makefile.in
++++ b/doc/mwg/Makefile.in
+@@ -463,17 +463,17 @@ install-data-local:
+ $(mkinstalldirs) $(DESTDIR)$(docdir)
+ $(mkinstalldirs) $(DESTDIR)$(pdfdir)
+ $(mkinstalldirs) $(DESTDIR)$(htmldir)
+- test -f html/Linux-PAM_MWG.html || exit 0; \
++ test -f html/Linux-PAM_MWG.html -o -f $(srcdir)/html/Linux-PAM_MWG.html || exit 0; \
+ $(install_sh_DATA) html/Linux-PAM_MWG.html html/mwg-*.html \
+ $(DESTDIR)$(htmldir)/ || \
+ $(install_sh_DATA) $(srcdir)/html/Linux-PAM_MWG.html \
+- $(srcdir)/html/sag-*.html \
++ $(srcdir)/html/mwg-*.html \
+ $(DESTDIR)$(htmldir)/
+- test -f Linux-PAM_MWG.txt || exit 0; \
++ test -f Linux-PAM_MWG.txt -o -f $(srcdir)/Linux-PAM_MWG.txt || exit 0; \
+ $(install_sh_DATA) Linux-PAM_MWG.txt $(DESTDIR)$(docdir)/ || \
+ $(install_sh_DATA) $(srcdir)/Linux-PAM_MWG.txt \
+ $(DESTDIR)$(docdir)/
+- test -f Linux-PAM_MWG.pdf || exit 0; \
++ test -f Linux-PAM_MWG.pdf -o -f $(srcdir)/Linux-PAM_MWG.pdf || exit 0; \
+ $(install_sh_DATA) Linux-PAM_MWG.pdf $(DESTDIR)$(pdfdir)/ || \
+ $(install_sh_DATA) $(srcdir)/Linux-PAM_MWG.pdf \
+ $(DESTDIR)$(pdfdir)/
+@@ -486,18 +486,18 @@ uninstall-local:
+
+ releasedocs: all
+ $(mkinstalldirs) $(top_builddir)/Linux-PAM-$(VERSION)/doc/mwg/html
+- test -f html/Linux-PAM_MWG.html || exit 0; \
++ test -f html/Linux-PAM_MWG.html -o -f $(srcdir)/html/Linux-PAM_MWG.html || exit 0; \
+ cp -ap html/Linux-PAM_MWG.html html/mwg-*.html \
+ $(top_builddir)/Linux-PAM-$(VERSION)/doc/mwg/html/ || \
+ cp -ap $(srcdir)/html/Linux-PAM_MWG.html \
+ $(srcdir)/html/mwg-*.html \
+ $(top_builddir)/Linux-PAM-$(VERSION)/doc/mwg/html/
+- test -f Linux-PAM_MWG.txt || exit 0; \
++ test -f Linux-PAM_MWG.txt -o -f $(srcdir)/Linux-PAM_MWG.txt || exit 0; \
+ cp -p Linux-PAM_MWG.txt \
+ $(top_builddir)/Linux-PAM-$(VERSION)/doc/mwg/ || \
+ cp -p $(srcdir)/Linux-PAM_MWG.txt \
+ $(top_builddir)/Linux-PAM-$(VERSION)/doc/mwg/
+- test -f Linux-PAM_MWG.pdf || exit 0; \
++ test -f Linux-PAM_MWG.pdf -o -f $(srcdir)/Linux-PAM_MWG.pdf || exit 0; \
+ cp -p Linux-PAM_MWG.pdf \
+ $(top_builddir)/Linux-PAM-$(VERSION)/doc/mwg/ || \
+ cp -p $(srcdir)/Linux-PAM_MWG.pdf \
+--- a/doc/sag/Makefile.in
++++ b/doc/sag/Makefile.in
+@@ -463,17 +463,17 @@ install-data-local:
+ $(mkinstalldirs) $(DESTDIR)$(docdir)
+ $(mkinstalldirs) $(DESTDIR)$(pdfdir)
+ $(mkinstalldirs) $(DESTDIR)$(htmldir)
+- test -f html/Linux-PAM_SAG.html || exit 0; \
++ test -f html/Linux-PAM_SAG.html -o -f $(srcdir)/html/Linux-PAM_SAG.html || exit 0; \
+ $(install_sh_DATA) html/Linux-PAM_SAG.html html/sag-*.html \
+ $(DESTDIR)$(htmldir)/ || \
+ $(install_sh_DATA) $(srcdir)/html/Linux-PAM_SAG.html \
+ $(srcdir)/html/sag-*.html \
+ $(DESTDIR)$(htmldir)/
+- test -f Linux-PAM_SAG.txt || exit 0; \
++ test -f Linux-PAM_SAG.txt -o -f $(srcdir)/Linux-PAM_SAG.txt || exit 0; \
+ $(install_sh_DATA) Linux-PAM_SAG.txt $(DESTDIR)$(docdir)/ || \
+ $(install_sh_DATA) $(srcdir)/Linux-PAM_SAG.txt \
+ $(DESTDIR)$(docdir)/
+- test -f Linux-PAM_SAG.pdf || exit 0; \
++ test -f Linux-PAM_SAG.pdf -o -f $(srcdir)/Linux-PAM_SAG.pdf || exit 0; \
+ $(install_sh_DATA) Linux-PAM_SAG.pdf $(DESTDIR)$(pdfdir)/ || \
+ $(install_sh_DATA) $(srcdir)/Linux-PAM_SAG.pdf \
+ $(DESTDIR)$(pdfdir)/
+@@ -486,18 +486,18 @@ uninstall-local:
+
+ releasedocs: all
+ $(mkinstalldirs) $(top_builddir)/Linux-PAM-$(VERSION)/doc/sag/html
+- test -f html/Linux-PAM_SAG.html || exit 0; \
++ test -f html/Linux-PAM_SAG.html -o -f $(srcdir)/html/Linux-PAM_SAG.html || exit 0; \
+ cp -ap html/Linux-PAM_SAG.html html/sag-*.html \
+ $(top_builddir)/Linux-PAM-$(VERSION)/doc/sag/html/ || \
+ cp -ap $(srcdir)/html/Linux-PAM_SAG.html \
+ $(srcdir)/html/sag-*.html \
+ $(top_builddir)/Linux-PAM-$(VERSION)/doc/sag/html/
+- test -f Linux-PAM_SAG.txt || exit 0; \
++ test -f Linux-PAM_SAG.txt -o -f $(srcdir)/Linux-PAM_SAG.txt || exit 0; \
+ cp -p Linux-PAM_SAG.txt \
+ $(top_builddir)/Linux-PAM-$(VERSION)/doc/sag/ || \
+ cp -p $(srcdir)/Linux-PAM_SAG.txt \
+ $(top_builddir)/Linux-PAM-$(VERSION)/doc/sag/
+- test -f Linux-PAM_SAG.pdf || exit 0; \
++ test -f Linux-PAM_SAG.pdf -o -f $(srcdir)/Linux-PAM_SAG.pdf || exit 0; \
+ cp -p Linux-PAM_SAG.pdf \
+ $(top_builddir)/Linux-PAM-$(VERSION)/doc/sag/ || \
+ cp -p $(srcdir)/Linux-PAM_SAG.pdf \
diff --git a/sys-libs/pam/metadata.xml b/sys-libs/pam/metadata.xml
new file mode 100644
index 000000000000..4ee5aecd2bb5
--- /dev/null
+++ b/sys-libs/pam/metadata.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>pam</herd>
+ <maintainer>
+ <email>pam-bugs@gentoo.org</email>
+ </maintainer>
+ <use>
+ <flag name='audit'>Enable support for <pkg>sys-process/audit</pkg></flag>
+
+ <flag name="berkdb">
+ Build the pam_userdb module, that allows to authenticate users
+ against a Berkeley DB file. Please note that enabling this USE
+ flag will create a PAM module that links to the Berkeley DB (as
+ provided by <pkg>sys-libs/db</pkg>) installed in /usr/lib and
+ will thus not work for boot-critical services authentication.
+ </flag>
+
+ <flag name="cracklib">
+ Build the pam_cracklib module, that allows to verify the chosen
+ passwords' strength through the use of
+ <pkg>sys-libs/cracklib</pkg>. Please note that simply enabling
+ the USE flag on this package will not make use of pam_cracklib
+ by default, you should also enable it in
+ <pkg>sys-auth/pambase</pkg> as well as update your configuration
+ files.
+ </flag>
+ </use>
+ <upstream>
+ <remote-id type="cpe">cpe:/a:kernel:linux-pam</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-libs/pam/pam-1.1.5.ebuild b/sys-libs/pam/pam-1.1.5.ebuild
new file mode 100644
index 000000000000..da863addcd87
--- /dev/null
+++ b/sys-libs/pam/pam-1.1.5.ebuild
@@ -0,0 +1,186 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit libtool multilib eutils pam toolchain-funcs flag-o-matic db-use
+
+MY_PN="Linux-PAM"
+MY_P="${MY_PN}-${PV}"
+
+HOMEPAGE="https://fedorahosted.org/linux-pam/"
+DESCRIPTION="Linux-PAM (Pluggable Authentication Modules)"
+
+SRC_URI="https://fedorahosted.org/releases/l/i/linux-pam/${MY_P}.tar.bz2
+ https://fedorahosted.org/releases/l/i/linux-pam/${MY_P}-docs.tar.bz2"
+
+LICENSE="|| ( BSD GPL-2 )"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-linux ~ia64-linux ~x86-linux"
+IUSE="cracklib nls elibc_FreeBSD selinux vim-syntax audit test elibc_glibc debug berkdb nis"
+
+RDEPEND="nls? ( virtual/libintl )
+ cracklib? ( >=sys-libs/cracklib-2.8.3 )
+ audit? ( sys-process/audit )
+ selinux? ( >=sys-libs/libselinux-1.28 )
+ berkdb? ( sys-libs/db )
+ elibc_glibc? (
+ >=sys-libs/glibc-2.7
+ nis? ( || ( >=net-libs/libtirpc-0.2.2-r1 <sys-libs/glibc-2.14 ) )
+ )"
+DEPEND="${RDEPEND}
+ >=sys-devel/libtool-2
+ sys-devel/flex
+ nls? ( sys-devel/gettext )
+ virtual/pkgconfig"
+PDEPEND="sys-auth/pambase
+ vim-syntax? ( app-vim/pam-syntax )"
+RDEPEND="${RDEPEND}
+ !sys-auth/openpam
+ !sys-auth/pam_userdb"
+
+S="${WORKDIR}/${MY_P}"
+
+check_old_modules() {
+ local retval="0"
+
+ if sed -e 's:#.*::' "${EROOT}"/etc/pam.d/* 2>/dev/null | fgrep -q pam_stack.so; then
+ eerror ""
+ eerror "Your current setup is using the pam_stack module."
+ eerror "This module is deprecated and no longer supported, and since version"
+ eerror "0.99 is no longer installed, nor provided by any other package."
+ eerror "The package will be built (to allow binary package builds), but will"
+ eerror "not be installed."
+ eerror "Please replace pam_stack usage with proper include directive usage,"
+ eerror "following the PAM Upgrade guide at the following URL"
+ eerror " http://www.gentoo.org/proj/en/base/pam/upgrade-0.99.xml"
+ eerror ""
+
+ retval=1
+ fi
+
+ if sed -e 's:#.*::' "${EROOT}"/etc/pam.d/* 2>/dev/null | egrep -q 'pam_(pwdb|console)'; then
+ eerror ""
+ eerror "Your current setup is using one or more of the following modules,"
+ eerror "that are not built or supported anymore:"
+ eerror "pam_pwdb, pam_console"
+ eerror "If you are in real need for these modules, please contact the maintainers"
+ eerror "of PAM through http://bugs.gentoo.org/ providing information about its"
+ eerror "use cases."
+ eerror "Please also make sure to read the PAM Upgrade guide at the following URL:"
+ eerror " http://www.gentoo.org/proj/en/base/pam/upgrade-0.99.xml"
+ eerror ""
+
+ retval=1
+ fi
+
+ return $retval
+}
+
+pkg_setup() {
+ check_old_modules
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${MY_P}+glibc-2.16.patch
+
+ elibtoolize
+}
+
+src_configure() {
+ local myconf
+
+ if use hppa || use elibc_FreeBSD; then
+ myconf="${myconf} --disable-pie"
+ fi
+
+ # Disable automatic detection of libxcrypt; we _don't_ want the
+ # user to link libxcrypt in by default, since we won't track the
+ # dependency and allow to break PAM this way.
+ export ac_cv_header_xcrypt_h=no
+
+ econf \
+ --disable-dependency-tracking \
+ --enable-fast-install \
+ --libdir="${EPREFIX}"/usr/$(get_libdir) \
+ --docdir="${EPREFIX}"/usr/share/doc/${PF} \
+ --htmldir="${EPREFIX}"/usr/share/doc/${PF}/html \
+ --enable-securedir="${EPREFIX}"/$(get_libdir)/security \
+ --enable-isadir="${EPREFIX}"/$(get_libdir)/security \
+ $(use_enable nls) \
+ $(use_enable selinux) \
+ $(use_enable cracklib) \
+ $(use_enable audit) \
+ $(use_enable debug) \
+ $(use_enable berkdb db) \
+ $(use_enable nis) \
+ --with-db-uniquename=-$(db_findver sys-libs/db) \
+ --disable-prelude \
+ ${myconf}
+}
+
+src_compile() {
+ emake sepermitlockdir="${EPREFIX}/var/run/sepermit" || die "emake failed"
+}
+
+src_test() {
+ # explicitly allow parallel-build during testing
+ emake sepermitlockdir="${EPREFIX}/var/run/sepermit" check || die "emake check failed"
+}
+
+src_install() {
+ local lib
+
+ emake DESTDIR="${D}" install \
+ sepermitlockdir="${EPREFIX}/var/run/sepermit" || die "make install failed"
+
+ # Need to be suid
+ fperms u+s /sbin/unix_chkpwd
+
+ gen_usr_ldscript -a pam pamc pam_misc
+
+ # create extra symlinks just in case something depends on them...
+ for lib in pam pamc pam_misc; do
+ if ! [[ -f "${ED}"/$(get_libdir)/lib${lib}$(get_libname) ]]; then
+ dosym lib${lib}$(get_libname 0) /$(get_libdir)/lib${lib}$(get_libname)
+ fi
+ done
+
+ dodoc CHANGELOG ChangeLog README AUTHORS Copyright NEWS
+
+ docinto modules
+ for dir in modules/pam_*; do
+ newdoc "${dir}"/README README."$(basename "${dir}")"
+ done
+
+ # Get rid of the .la files. We certainly don't need them for PAM
+ # modules, and libpam is installed as a shared object only, so we
+ # don't need them for static linking either.
+ find "${D}" -name '*.la' -delete
+}
+
+pkg_preinst() {
+ check_old_modules || die "deprecated PAM modules still used"
+}
+
+pkg_postinst() {
+ ewarn "Some software with pre-loaded PAM libraries might experience"
+ ewarn "warnings or failures related to missing symbols and/or versions"
+ ewarn "after any update. While unfortunate this is a limit of the"
+ ewarn "implementation of PAM and the software, and it requires you to"
+ ewarn "restart the software manually after the update."
+ ewarn ""
+ ewarn "You can get a list of such software running a command like"
+ ewarn " lsof / | egrep -i 'del.*libpam\\.so'"
+ ewarn ""
+ ewarn "Alternatively, simply reboot your system."
+ if [ -x "${ROOT}"/var/log/tallylog ] ; then
+ elog ""
+ elog "Because of a bug present up to version 1.1.1-r2, you have"
+ elog "an executable /var/log/tallylog file. You can safely"
+ elog "correct it by running the command"
+ elog " chmod -x /var/log/tallylog"
+ elog ""
+ fi
+}
diff --git a/sys-libs/pam/pam-1.1.6-r2.ebuild b/sys-libs/pam/pam-1.1.6-r2.ebuild
new file mode 100644
index 000000000000..8cdc8f2ccd81
--- /dev/null
+++ b/sys-libs/pam/pam-1.1.6-r2.ebuild
@@ -0,0 +1,197 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit libtool multilib eutils pam toolchain-funcs flag-o-matic db-use autotools
+
+MY_PN="Linux-PAM"
+MY_P="${MY_PN}-${PV}"
+
+HOMEPAGE="https://fedorahosted.org/linux-pam/"
+DESCRIPTION="Linux-PAM (Pluggable Authentication Modules)"
+
+SRC_URI="http://www.linux-pam.org/library/${MY_P}.tar.bz2
+ http://www.linux-pam.org/documentation/${MY_P}-docs.tar.bz2"
+
+LICENSE="|| ( BSD GPL-2 )"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-linux ~ia64-linux ~x86-linux"
+IUSE="cracklib nls elibc_FreeBSD selinux vim-syntax audit test elibc_glibc debug berkdb nis"
+
+RDEPEND="nls? ( virtual/libintl )
+ cracklib? ( >=sys-libs/cracklib-2.8.3 )
+ audit? ( sys-process/audit )
+ selinux? ( >=sys-libs/libselinux-1.28 )
+ berkdb? ( sys-libs/db )
+ elibc_glibc? (
+ >=sys-libs/glibc-2.7
+ nis? ( || ( >=net-libs/libtirpc-0.2.2-r1 <sys-libs/glibc-2.14 ) )
+ )"
+DEPEND="${RDEPEND}
+ >=sys-devel/libtool-2
+ sys-devel/flex
+ nls? ( sys-devel/gettext )
+ virtual/pkgconfig"
+PDEPEND="sys-auth/pambase
+ vim-syntax? ( app-vim/pam-syntax )"
+RDEPEND="${RDEPEND}
+ !<sys-apps/openrc-0.11.8
+ !sys-auth/openpam
+ !sys-auth/pam_userdb"
+
+S="${WORKDIR}/${MY_P}"
+
+check_old_modules() {
+ local retval="0"
+
+ if sed -e 's:#.*::' "${EROOT}"/etc/pam.d/* 2>/dev/null | fgrep -q pam_stack.so; then
+ eerror ""
+ eerror "Your current setup is using the pam_stack module."
+ eerror "This module is deprecated and no longer supported, and since version"
+ eerror "0.99 is no longer installed, nor provided by any other package."
+ eerror "The package will be built (to allow binary package builds), but will"
+ eerror "not be installed."
+ eerror "Please replace pam_stack usage with proper include directive usage,"
+ eerror "following the PAM Upgrade guide at the following URL"
+ eerror " http://www.gentoo.org/proj/en/base/pam/upgrade-0.99.xml"
+ eerror ""
+
+ retval=1
+ fi
+
+ if sed -e 's:#.*::' "${EROOT}"/etc/pam.d/* 2>/dev/null | egrep -q 'pam_(pwdb|console)'; then
+ eerror ""
+ eerror "Your current setup is using one or more of the following modules,"
+ eerror "that are not built or supported anymore:"
+ eerror "pam_pwdb, pam_console"
+ eerror "If you are in real need for these modules, please contact the maintainers"
+ eerror "of PAM through http://bugs.gentoo.org/ providing information about its"
+ eerror "use cases."
+ eerror "Please also make sure to read the PAM Upgrade guide at the following URL:"
+ eerror " http://www.gentoo.org/proj/en/base/pam/upgrade-0.99.xml"
+ eerror ""
+
+ retval=1
+ fi
+
+ return $retval
+}
+
+pkg_pretend() {
+ # do not error out, this is just a warning, one could build a binpkg
+ # with old modules enabled.
+ check_old_modules
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${MY_P}-destdir.patch
+ epatch "${FILESDIR}"/${MY_P}+glibc-2.16.patch
+
+ eautoreconf
+ elibtoolize
+}
+
+src_configure() {
+ local myconf
+
+ if use hppa || use elibc_FreeBSD; then
+ myconf="${myconf} --disable-pie"
+ fi
+
+ # Disable automatic detection of libxcrypt; we _don't_ want the
+ # user to link libxcrypt in by default, since we won't track the
+ # dependency and allow to break PAM this way.
+ export ac_cv_header_xcrypt_h=no
+
+ econf \
+ --enable-fast-install \
+ --libdir="${EPREFIX}"/usr/$(get_libdir) \
+ --docdir="${EPREFIX}"/usr/share/doc/${PF} \
+ --htmldir="${EPREFIX}"/usr/share/doc/${PF}/html \
+ --enable-securedir="${EPREFIX}"/$(get_libdir)/security \
+ --enable-isadir="${EPREFIX}"/$(get_libdir)/security \
+ $(use_enable nls) \
+ $(use_enable selinux) \
+ $(use_enable cracklib) \
+ $(use_enable audit) \
+ $(use_enable debug) \
+ $(use_enable berkdb db) \
+ $(use_enable nis) \
+ --with-db-uniquename=-$(db_findver sys-libs/db) \
+ --disable-prelude \
+ ${myconf}
+}
+
+src_compile() {
+ emake sepermitlockdir="${EPREFIX}/run/sepermit"
+}
+
+src_test() {
+ # explicitly allow parallel-build during testing
+ emake sepermitlockdir="${EPREFIX}/run/sepermit" check
+}
+
+src_install() {
+ local lib
+
+ emake DESTDIR="${D}" install \
+ sepermitlockdir="${EPREFIX}/run/sepermit"
+
+ # Need to be suid
+ fperms u+s /sbin/unix_chkpwd
+
+ gen_usr_ldscript -a pam pamc pam_misc
+
+ # create extra symlinks just in case something depends on them...
+ for lib in pam pamc pam_misc; do
+ if ! [[ -f "${ED}"/$(get_libdir)/lib${lib}$(get_libname) ]]; then
+ dosym lib${lib}$(get_libname 0) /$(get_libdir)/lib${lib}$(get_libname)
+ fi
+ done
+
+ dodoc CHANGELOG ChangeLog README AUTHORS Copyright NEWS
+
+ docinto modules
+ for dir in modules/pam_*; do
+ newdoc "${dir}"/README README."$(basename "${dir}")"
+ done
+
+ # Get rid of the .la files. We certainly don't need them for PAM
+ # modules, and libpam is installed as a shared object only, so we
+ # don't need them for static linking either.
+ find "${D}" -name '*.la' -delete
+
+ if use selinux; then
+ dodir /usr/lib/tmpfiles.d
+ cat - > "${D}"/usr/lib/tmpfiles.d/${CATEGORY}:${PN}:${SLOT}.conf <<EOF
+d /run/sepermit 0755 root root
+EOF
+ fi
+}
+
+pkg_preinst() {
+ check_old_modules || die "deprecated PAM modules still used"
+}
+
+pkg_postinst() {
+ ewarn "Some software with pre-loaded PAM libraries might experience"
+ ewarn "warnings or failures related to missing symbols and/or versions"
+ ewarn "after any update. While unfortunate this is a limit of the"
+ ewarn "implementation of PAM and the software, and it requires you to"
+ ewarn "restart the software manually after the update."
+ ewarn ""
+ ewarn "You can get a list of such software running a command like"
+ ewarn " lsof / | egrep -i 'del.*libpam\\.so'"
+ ewarn ""
+ ewarn "Alternatively, simply reboot your system."
+ if [ -x "${ROOT}"/var/log/tallylog ] ; then
+ elog ""
+ elog "Because of a bug present up to version 1.1.1-r2, you have"
+ elog "an executable /var/log/tallylog file. You can safely"
+ elog "correct it by running the command"
+ elog " chmod -x /var/log/tallylog"
+ elog ""
+ fi
+}
diff --git a/sys-libs/pam/pam-1.1.8-r1.ebuild b/sys-libs/pam/pam-1.1.8-r1.ebuild
new file mode 100644
index 000000000000..e57a0cfa4a4d
--- /dev/null
+++ b/sys-libs/pam/pam-1.1.8-r1.ebuild
@@ -0,0 +1,183 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit libtool multilib eutils pam toolchain-funcs flag-o-matic db-use autotools-utils
+
+MY_PN="Linux-PAM"
+MY_P="${MY_PN}-${PV}"
+
+HOMEPAGE="https://fedorahosted.org/linux-pam/"
+DESCRIPTION="Linux-PAM (Pluggable Authentication Modules)"
+
+SRC_URI="http://www.linux-pam.org/library/${MY_P}.tar.bz2
+ http://www.linux-pam.org/documentation/${MY_P}-docs.tar.bz2"
+
+LICENSE="|| ( BSD GPL-2 )"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~ia64-linux ~x86-linux"
+IUSE="cracklib nls elibc_FreeBSD selinux vim-syntax audit test elibc_glibc debug berkdb nis"
+
+RDEPEND="nls? ( virtual/libintl )
+ cracklib? ( >=sys-libs/cracklib-2.8.3 )
+ audit? ( sys-process/audit )
+ selinux? ( >=sys-libs/libselinux-1.28 )
+ berkdb? ( sys-libs/db )
+ elibc_glibc? (
+ >=sys-libs/glibc-2.7
+ nis? ( || ( >=net-libs/libtirpc-0.2.2-r1 <sys-libs/glibc-2.14 ) )
+ )"
+DEPEND="${RDEPEND}
+ >=sys-devel/libtool-2
+ sys-devel/flex
+ nls? ( sys-devel/gettext )
+ virtual/pkgconfig"
+PDEPEND="sys-auth/pambase
+ vim-syntax? ( app-vim/pam-syntax )"
+RDEPEND="${RDEPEND}
+ !<sys-apps/openrc-0.11.8
+ !sys-auth/openpam
+ !sys-auth/pam_userdb"
+
+S="${WORKDIR}/${MY_P}"
+
+check_old_modules() {
+ local retval="0"
+
+ if sed -e 's:#.*::' "${EROOT}"/etc/pam.d/* 2>/dev/null | fgrep -q pam_stack.so; then
+ eerror ""
+ eerror "Your current setup is using the pam_stack module."
+ eerror "This module is deprecated and no longer supported, and since version"
+ eerror "0.99 is no longer installed, nor provided by any other package."
+ eerror "The package will be built (to allow binary package builds), but will"
+ eerror "not be installed."
+ eerror "Please replace pam_stack usage with proper include directive usage,"
+ eerror "following the PAM Upgrade guide at the following URL"
+ eerror " http://www.gentoo.org/proj/en/base/pam/upgrade-0.99.xml"
+ eerror ""
+
+ retval=1
+ fi
+
+ if sed -e 's:#.*::' "${EROOT}"/etc/pam.d/* 2>/dev/null | egrep -q 'pam_(pwdb|console)'; then
+ eerror ""
+ eerror "Your current setup is using one or more of the following modules,"
+ eerror "that are not built or supported anymore:"
+ eerror "pam_pwdb, pam_console"
+ eerror "If you are in real need for these modules, please contact the maintainers"
+ eerror "of PAM through http://bugs.gentoo.org/ providing information about its"
+ eerror "use cases."
+ eerror "Please also make sure to read the PAM Upgrade guide at the following URL:"
+ eerror " http://www.gentoo.org/proj/en/base/pam/upgrade-0.99.xml"
+ eerror ""
+
+ retval=1
+ fi
+
+ return $retval
+}
+
+pkg_pretend() {
+ # do not error out, this is just a warning, one could build a binpkg
+ # with old modules enabled.
+ check_old_modules
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-1.1.8-doc-install.patch #473650
+
+ elibtoolize
+}
+
+src_configure() {
+ # Disable automatic detection of libxcrypt; we _don't_ want the
+ # user to link libxcrypt in by default, since we won't track the
+ # dependency and allow to break PAM this way.
+ export ac_cv_header_xcrypt_h=no
+
+ local myeconfargs=(
+ --htmldir="${EPREFIX}"/usr/share/doc/${PF}/html
+ --libdir="${EPREFIX}"/usr/$(get_libdir) \
+ --enable-securedir="${EPREFIX}"/$(get_libdir)/security
+ --enable-isadir="${EPREFIX}"/$(get_libdir)/security
+ $(use_enable nls)
+ $(use_enable selinux)
+ $(use_enable cracklib)
+ $(use_enable audit)
+ $(use_enable debug)
+ $(use_enable berkdb db)
+ $(use_enable nis)
+ --with-db-uniquename=-$(db_findver sys-libs/db)
+ --disable-prelude
+ )
+
+ if use hppa || use elibc_FreeBSD; then
+ myeconfargs+=( --disable-pie )
+ fi
+
+ autotools-utils_src_configure
+}
+
+src_compile() {
+ autotools-utils_src_compile sepermitlockdir="${EPREFIX}/run/sepermit"
+}
+
+DOCS=( CHANGELOG ChangeLog README AUTHORS Copyright NEWS )
+
+src_install() {
+ autotools-utils_src_install sepermitlockdir="${EPREFIX}/run/sepermit"
+
+ # Need to be suid
+ fperms u+s /sbin/unix_chkpwd
+
+ gen_usr_ldscript -a pam pamc pam_misc
+
+ # create extra symlinks just in case something depends on them...
+ local lib
+ for lib in pam pamc pam_misc; do
+ if ! [[ -f "${ED}"/$(get_libdir)/lib${lib}$(get_libname) ]]; then
+ dosym lib${lib}$(get_libname 0) /$(get_libdir)/lib${lib}$(get_libname)
+ fi
+ done
+
+ docinto modules
+ for dir in modules/pam_*; do
+ newdoc "${dir}"/README README."$(basename "${dir}")"
+ done
+
+ prune_libtool_files --all
+
+ if use selinux; then
+ dodir /usr/lib/tmpfiles.d
+ cat - > "${D}"/usr/lib/tmpfiles.d/${CATEGORY}:${PN}:${SLOT}.conf <<EOF
+d /run/sepermit 0755 root root
+EOF
+ fi
+}
+
+pkg_preinst() {
+ check_old_modules || die "deprecated PAM modules still used"
+}
+
+pkg_postinst() {
+ ewarn "Some software with pre-loaded PAM libraries might experience"
+ ewarn "warnings or failures related to missing symbols and/or versions"
+ ewarn "after any update. While unfortunate this is a limit of the"
+ ewarn "implementation of PAM and the software, and it requires you to"
+ ewarn "restart the software manually after the update."
+ ewarn ""
+ ewarn "You can get a list of such software running a command like"
+ ewarn " lsof / | egrep -i 'del.*libpam\\.so'"
+ ewarn ""
+ ewarn "Alternatively, simply reboot your system."
+ if [ -x "${EROOT}"/var/log/tallylog ] ; then
+ elog ""
+ elog "Because of a bug present up to version 1.1.1-r2, you have"
+ elog "an executable /var/log/tallylog file. You can safely"
+ elog "correct it by running the command"
+ elog " chmod -x /var/log/tallylog"
+ elog ""
+ fi
+}
diff --git a/sys-libs/pam/pam-1.1.8-r2.ebuild b/sys-libs/pam/pam-1.1.8-r2.ebuild
new file mode 100644
index 000000000000..0cc239dd2b7f
--- /dev/null
+++ b/sys-libs/pam/pam-1.1.8-r2.ebuild
@@ -0,0 +1,198 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit libtool multilib multilib-minimal eutils pam toolchain-funcs flag-o-matic db-use
+
+MY_PN="Linux-PAM"
+MY_P="${MY_PN}-${PV}"
+
+HOMEPAGE="https://fedorahosted.org/linux-pam/"
+DESCRIPTION="Linux-PAM (Pluggable Authentication Modules)"
+
+SRC_URI="http://www.linux-pam.org/library/${MY_P}.tar.bz2
+ http://www.linux-pam.org/documentation/${MY_P}-docs.tar.bz2"
+
+LICENSE="|| ( BSD GPL-2 )"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-linux ~ia64-linux ~x86-linux"
+IUSE="cracklib nls elibc_FreeBSD selinux vim-syntax audit test elibc_glibc debug berkdb nis"
+
+RDEPEND="nls? ( >=virtual/libintl-0-r1[${MULTILIB_USEDEP}] )
+ cracklib? ( >=sys-libs/cracklib-2.9.1-r1[${MULTILIB_USEDEP}] )
+ audit? ( >=sys-process/audit-2.2.2[${MULTILIB_USEDEP}] )
+ selinux? ( >=sys-libs/libselinux-2.2.2-r4[${MULTILIB_USEDEP}] )
+ berkdb? ( >=sys-libs/db-4.8.30-r1[${MULTILIB_USEDEP}] )
+ elibc_glibc? (
+ >=sys-libs/glibc-2.7
+ nis? ( || ( >=net-libs/libtirpc-0.2.4-r2[${MULTILIB_USEDEP}] <sys-libs/glibc-2.14 ) )
+ )"
+DEPEND="${RDEPEND}
+ >=sys-devel/libtool-2
+ >=sys-devel/flex-2.5.39-r1[${MULTILIB_USEDEP}]
+ nls? ( sys-devel/gettext )
+ >=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]"
+PDEPEND="sys-auth/pambase
+ vim-syntax? ( app-vim/pam-syntax )"
+RDEPEND="${RDEPEND}
+ !<sys-apps/openrc-0.11.8
+ !sys-auth/openpam
+ !sys-auth/pam_userdb
+ abi_x86_32? (
+ !<=app-emulation/emul-linux-x86-baselibs-20140508-r7
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ )"
+
+S="${WORKDIR}/${MY_P}"
+
+check_old_modules() {
+ local retval="0"
+
+ if sed -e 's:#.*::' "${EROOT}"/etc/pam.d/* 2>/dev/null | fgrep -q pam_stack.so; then
+ eerror ""
+ eerror "Your current setup is using the pam_stack module."
+ eerror "This module is deprecated and no longer supported, and since version"
+ eerror "0.99 is no longer installed, nor provided by any other package."
+ eerror "The package will be built (to allow binary package builds), but will"
+ eerror "not be installed."
+ eerror "Please replace pam_stack usage with proper include directive usage,"
+ eerror "following the PAM Upgrade guide at the following URL"
+ eerror " http://www.gentoo.org/proj/en/base/pam/upgrade-0.99.xml"
+ eerror ""
+
+ retval=1
+ fi
+
+ if sed -e 's:#.*::' "${EROOT}"/etc/pam.d/* 2>/dev/null | egrep -q 'pam_(pwdb|console)'; then
+ eerror ""
+ eerror "Your current setup is using one or more of the following modules,"
+ eerror "that are not built or supported anymore:"
+ eerror "pam_pwdb, pam_console"
+ eerror "If you are in real need for these modules, please contact the maintainers"
+ eerror "of PAM through http://bugs.gentoo.org/ providing information about its"
+ eerror "use cases."
+ eerror "Please also make sure to read the PAM Upgrade guide at the following URL:"
+ eerror " http://www.gentoo.org/proj/en/base/pam/upgrade-0.99.xml"
+ eerror ""
+
+ retval=1
+ fi
+
+ return $retval
+}
+
+pkg_pretend() {
+ # do not error out, this is just a warning, one could build a binpkg
+ # with old modules enabled.
+ check_old_modules
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-1.1.8-doc-install.patch #473650
+
+ elibtoolize
+}
+
+multilib_src_configure() {
+ # Disable automatic detection of libxcrypt; we _don't_ want the
+ # user to link libxcrypt in by default, since we won't track the
+ # dependency and allow to break PAM this way.
+ export ac_cv_header_xcrypt_h=no
+
+ local myconf=(
+ --htmldir="${EPREFIX}"/usr/share/doc/${PF}/html
+ --libdir="${EPREFIX}"/usr/$(get_libdir) \
+ --enable-securedir="${EPREFIX}"/$(get_libdir)/security
+ --enable-isadir="${EPREFIX}"/$(get_libdir)/security
+ $(use_enable nls)
+ $(use_enable selinux)
+ $(use_enable cracklib)
+ $(use_enable audit)
+ $(use_enable debug)
+ $(use_enable berkdb db)
+ $(use_enable nis)
+ --with-db-uniquename=-$(db_findver sys-libs/db)
+ --disable-prelude
+ )
+
+ if use hppa || use elibc_FreeBSD; then
+ myconf+=( --disable-pie )
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+}
+
+multilib_src_compile() {
+ emake sepermitlockdir="${EPREFIX}/run/sepermit"
+}
+
+multilib_src_install() {
+ emake DESTDIR="${D}" install \
+ sepermitlockdir="${EPREFIX}/run/sepermit"
+
+ local prefix
+ if multilib_is_native_abi; then
+ prefix=
+ gen_usr_ldscript -a pam pamc pam_misc
+ else
+ prefix=/usr
+ fi
+
+ # create extra symlinks just in case something depends on them...
+ local lib
+ for lib in pam pamc pam_misc; do
+ if ! [[ -f "${ED}"${prefix}/$(get_libdir)/lib${lib}$(get_libname) ]]; then
+ dosym lib${lib}$(get_libname 0) ${prefix}/$(get_libdir)/lib${lib}$(get_libname)
+ fi
+ done
+}
+
+DOCS=( CHANGELOG ChangeLog README AUTHORS Copyright NEWS )
+
+multilib_src_install_all() {
+ einstalldocs
+ prune_libtool_files --all
+
+ # Need to be suid
+ fperms u+s /sbin/unix_chkpwd
+
+ docinto modules
+ for dir in modules/pam_*; do
+ newdoc "${dir}"/README README."$(basename "${dir}")"
+ done
+
+ if use selinux; then
+ dodir /usr/lib/tmpfiles.d
+ cat - > "${D}"/usr/lib/tmpfiles.d/${CATEGORY}:${PN}:${SLOT}.conf <<EOF
+d /run/sepermit 0755 root root
+EOF
+ fi
+}
+
+pkg_preinst() {
+ check_old_modules || die "deprecated PAM modules still used"
+}
+
+pkg_postinst() {
+ ewarn "Some software with pre-loaded PAM libraries might experience"
+ ewarn "warnings or failures related to missing symbols and/or versions"
+ ewarn "after any update. While unfortunate this is a limit of the"
+ ewarn "implementation of PAM and the software, and it requires you to"
+ ewarn "restart the software manually after the update."
+ ewarn ""
+ ewarn "You can get a list of such software running a command like"
+ ewarn " lsof / | egrep -i 'del.*libpam\\.so'"
+ ewarn ""
+ ewarn "Alternatively, simply reboot your system."
+ if [[ -x "${EROOT}"/var/log/tallylog ]] ; then
+ elog ""
+ elog "Because of a bug present up to version 1.1.1-r2, you have"
+ elog "an executable /var/log/tallylog file. You can safely"
+ elog "correct it by running the command"
+ elog " chmod -x /var/log/tallylog"
+ elog ""
+ fi
+}
diff --git a/sys-libs/pam/pam-1.1.8-r3.ebuild b/sys-libs/pam/pam-1.1.8-r3.ebuild
new file mode 100644
index 000000000000..f04ef9486f24
--- /dev/null
+++ b/sys-libs/pam/pam-1.1.8-r3.ebuild
@@ -0,0 +1,195 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit libtool multilib multilib-minimal eutils pam toolchain-funcs flag-o-matic db-use
+
+MY_PN="Linux-PAM"
+MY_P="${MY_PN}-${PV}"
+
+HOMEPAGE="https://fedorahosted.org/linux-pam/"
+DESCRIPTION="Linux-PAM (Pluggable Authentication Modules)"
+SRC_URI="http://www.linux-pam.org/library/${MY_P}.tar.bz2
+ http://www.linux-pam.org/documentation/${MY_P}-docs.tar.bz2"
+
+LICENSE="|| ( BSD GPL-2 )"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~ia64-linux ~x86-linux"
+IUSE="audit berkdb cracklib debug nis nls +pie selinux test vim-syntax"
+
+RDEPEND="nls? ( >=virtual/libintl-0-r1[${MULTILIB_USEDEP}] )
+ cracklib? ( >=sys-libs/cracklib-2.9.1-r1[${MULTILIB_USEDEP}] )
+ audit? ( >=sys-process/audit-2.2.2[${MULTILIB_USEDEP}] )
+ selinux? ( >=sys-libs/libselinux-2.2.2-r4[${MULTILIB_USEDEP}] )
+ berkdb? ( >=sys-libs/db-4.8.30-r1[${MULTILIB_USEDEP}] )
+ nis? ( >=net-libs/libtirpc-0.2.4-r2[${MULTILIB_USEDEP}] )"
+DEPEND="${RDEPEND}
+ >=sys-devel/libtool-2
+ >=sys-devel/flex-2.5.39-r1[${MULTILIB_USEDEP}]
+ nls? ( sys-devel/gettext )
+ >=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]"
+PDEPEND="sys-auth/pambase
+ vim-syntax? ( app-vim/pam-syntax )"
+RDEPEND="${RDEPEND}
+ !<sys-apps/openrc-0.11.8
+ !sys-auth/openpam
+ !sys-auth/pam_userdb
+ abi_x86_32? (
+ !<=app-emulation/emul-linux-x86-baselibs-20140508-r7
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ )"
+
+S="${WORKDIR}/${MY_P}"
+
+check_old_modules() {
+ local retval="0"
+
+ if sed -e 's:#.*::' "${EROOT}"/etc/pam.d/* 2>/dev/null | fgrep -q pam_stack.so; then
+ eerror ""
+ eerror "Your current setup is using the pam_stack module."
+ eerror "This module is deprecated and no longer supported, and since version"
+ eerror "0.99 is no longer installed, nor provided by any other package."
+ eerror "The package will be built (to allow binary package builds), but will"
+ eerror "not be installed."
+ eerror "Please replace pam_stack usage with proper include directive usage,"
+ eerror "following the PAM Upgrade guide at the following URL"
+ eerror " http://www.gentoo.org/proj/en/base/pam/upgrade-0.99.xml"
+ eerror ""
+
+ retval=1
+ fi
+
+ if sed -e 's:#.*::' "${EROOT}"/etc/pam.d/* 2>/dev/null | egrep -q 'pam_(pwdb|console)'; then
+ eerror ""
+ eerror "Your current setup is using one or more of the following modules,"
+ eerror "that are not built or supported anymore:"
+ eerror "pam_pwdb, pam_console"
+ eerror "If you are in real need for these modules, please contact the maintainers"
+ eerror "of PAM through http://bugs.gentoo.org/ providing information about its"
+ eerror "use cases."
+ eerror "Please also make sure to read the PAM Upgrade guide at the following URL:"
+ eerror " http://www.gentoo.org/proj/en/base/pam/upgrade-0.99.xml"
+ eerror ""
+
+ retval=1
+ fi
+
+ return ${retval}
+}
+
+pkg_pretend() {
+ # do not error out, this is just a warning, one could build a binpkg
+ # with old modules enabled.
+ check_old_modules
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-1.1.8-doc-install.patch #473650
+ epatch "${FILESDIR}"/${PN}-1.1.8-CVE-2013-7041.patch #493432
+ epatch "${FILESDIR}"/${PN}-1.1.8-CVE-2014-2583.patch #505604
+
+ elibtoolize
+}
+
+multilib_src_configure() {
+ # Disable automatic detection of libxcrypt; we _don't_ want the
+ # user to link libxcrypt in by default, since we won't track the
+ # dependency and allow to break PAM this way.
+ export ac_cv_header_xcrypt_h=no
+
+ local myconf=(
+ --docdir='$(datarootdir)'/doc/${PF}
+ --htmldir='$(docdir)/html'
+ --libdir='$(prefix)'/$(get_libdir)
+ --enable-securedir="${EPREFIX}"/$(get_libdir)/security
+ --enable-isadir='.' #464016
+ $(use_enable nls)
+ $(use_enable selinux)
+ $(use_enable cracklib)
+ $(use_enable audit)
+ $(use_enable debug)
+ $(use_enable berkdb db)
+ $(use_enable nis)
+ $(use_enable pie)
+ --with-db-uniquename=-$(db_findver sys-libs/db)
+ --disable-prelude
+ )
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+}
+
+multilib_src_compile() {
+ emake sepermitlockdir="${EPREFIX}/run/sepermit"
+}
+
+multilib_src_install() {
+ emake DESTDIR="${D}" install \
+ sepermitlockdir="${EPREFIX}/run/sepermit"
+
+ local prefix
+ if multilib_is_native_abi; then
+ prefix=
+ gen_usr_ldscript -a pam pamc pam_misc
+ else
+ prefix=/usr
+ fi
+
+ # create extra symlinks just in case something depends on them...
+ local lib
+ for lib in pam pamc pam_misc; do
+ if ! [[ -f "${ED}"${prefix}/$(get_libdir)/lib${lib}$(get_libname) ]]; then
+ dosym lib${lib}$(get_libname 0) ${prefix}/$(get_libdir)/lib${lib}$(get_libname)
+ fi
+ done
+}
+
+DOCS=( CHANGELOG ChangeLog README AUTHORS Copyright NEWS )
+
+multilib_src_install_all() {
+ einstalldocs
+ prune_libtool_files --all
+
+ # Need to be suid
+ fperms 4711 /sbin/unix_chkpwd
+
+ docinto modules
+ local dir
+ for dir in modules/pam_*; do
+ newdoc "${dir}"/README README."$(basename "${dir}")"
+ done
+
+ if use selinux; then
+ dodir /usr/lib/tmpfiles.d
+ cat - > "${D}"/usr/lib/tmpfiles.d/${CATEGORY}:${PN}:${SLOT}.conf <<EOF
+d /run/sepermit 0755 root root
+EOF
+ fi
+}
+
+pkg_preinst() {
+ check_old_modules || die "deprecated PAM modules still used"
+}
+
+pkg_postinst() {
+ ewarn "Some software with pre-loaded PAM libraries might experience"
+ ewarn "warnings or failures related to missing symbols and/or versions"
+ ewarn "after any update. While unfortunate this is a limit of the"
+ ewarn "implementation of PAM and the software, and it requires you to"
+ ewarn "restart the software manually after the update."
+ ewarn ""
+ ewarn "You can get a list of such software running a command like"
+ ewarn " lsof / | egrep -i 'del.*libpam\\.so'"
+ ewarn ""
+ ewarn "Alternatively, simply reboot your system."
+ if [[ -x "${EROOT}"/var/log/tallylog ]] ; then
+ elog ""
+ elog "Because of a bug present up to version 1.1.1-r2, you have"
+ elog "an executable /var/log/tallylog file. You can safely"
+ elog "correct it by running the command"
+ elog " chmod -x /var/log/tallylog"
+ elog ""
+ fi
+}
diff --git a/sys-libs/pam/pam-1.1.8.ebuild b/sys-libs/pam/pam-1.1.8.ebuild
new file mode 100644
index 000000000000..1ebba4c8dcae
--- /dev/null
+++ b/sys-libs/pam/pam-1.1.8.ebuild
@@ -0,0 +1,181 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit libtool multilib eutils pam toolchain-funcs flag-o-matic db-use autotools-utils
+
+MY_PN="Linux-PAM"
+MY_P="${MY_PN}-${PV}"
+
+HOMEPAGE="https://fedorahosted.org/linux-pam/"
+DESCRIPTION="Linux-PAM (Pluggable Authentication Modules)"
+
+SRC_URI="http://www.linux-pam.org/library/${MY_P}.tar.bz2
+ http://www.linux-pam.org/documentation/${MY_P}-docs.tar.bz2"
+
+LICENSE="|| ( BSD GPL-2 )"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~ia64-linux ~x86-linux"
+IUSE="cracklib nls elibc_FreeBSD selinux vim-syntax audit test elibc_glibc debug berkdb nis"
+
+RDEPEND="nls? ( virtual/libintl )
+ cracklib? ( >=sys-libs/cracklib-2.8.3 )
+ audit? ( sys-process/audit )
+ selinux? ( >=sys-libs/libselinux-1.28 )
+ berkdb? ( sys-libs/db )
+ elibc_glibc? (
+ >=sys-libs/glibc-2.7
+ nis? ( || ( >=net-libs/libtirpc-0.2.2-r1 <sys-libs/glibc-2.14 ) )
+ )"
+DEPEND="${RDEPEND}
+ >=sys-devel/libtool-2
+ sys-devel/flex
+ nls? ( sys-devel/gettext )
+ virtual/pkgconfig"
+PDEPEND="sys-auth/pambase
+ vim-syntax? ( app-vim/pam-syntax )"
+RDEPEND="${RDEPEND}
+ !<sys-apps/openrc-0.11.8
+ !sys-auth/openpam
+ !sys-auth/pam_userdb"
+
+S="${WORKDIR}/${MY_P}"
+
+check_old_modules() {
+ local retval="0"
+
+ if sed -e 's:#.*::' "${EROOT}"/etc/pam.d/* 2>/dev/null | fgrep -q pam_stack.so; then
+ eerror ""
+ eerror "Your current setup is using the pam_stack module."
+ eerror "This module is deprecated and no longer supported, and since version"
+ eerror "0.99 is no longer installed, nor provided by any other package."
+ eerror "The package will be built (to allow binary package builds), but will"
+ eerror "not be installed."
+ eerror "Please replace pam_stack usage with proper include directive usage,"
+ eerror "following the PAM Upgrade guide at the following URL"
+ eerror " http://www.gentoo.org/proj/en/base/pam/upgrade-0.99.xml"
+ eerror ""
+
+ retval=1
+ fi
+
+ if sed -e 's:#.*::' "${EROOT}"/etc/pam.d/* 2>/dev/null | egrep -q 'pam_(pwdb|console)'; then
+ eerror ""
+ eerror "Your current setup is using one or more of the following modules,"
+ eerror "that are not built or supported anymore:"
+ eerror "pam_pwdb, pam_console"
+ eerror "If you are in real need for these modules, please contact the maintainers"
+ eerror "of PAM through http://bugs.gentoo.org/ providing information about its"
+ eerror "use cases."
+ eerror "Please also make sure to read the PAM Upgrade guide at the following URL:"
+ eerror " http://www.gentoo.org/proj/en/base/pam/upgrade-0.99.xml"
+ eerror ""
+
+ retval=1
+ fi
+
+ return $retval
+}
+
+pkg_pretend() {
+ # do not error out, this is just a warning, one could build a binpkg
+ # with old modules enabled.
+ check_old_modules
+}
+
+src_prepare() {
+ elibtoolize
+}
+
+src_configure() {
+ # Disable automatic detection of libxcrypt; we _don't_ want the
+ # user to link libxcrypt in by default, since we won't track the
+ # dependency and allow to break PAM this way.
+ export ac_cv_header_xcrypt_h=no
+
+ local myeconfargs=(
+ --htmldir="${EPREFIX}"/usr/share/doc/${PF}/html
+ --libdir="${EPREFIX}"/usr/$(get_libdir) \
+ --enable-securedir="${EPREFIX}"/$(get_libdir)/security
+ --enable-isadir="${EPREFIX}"/$(get_libdir)/security
+ $(use_enable nls)
+ $(use_enable selinux)
+ $(use_enable cracklib)
+ $(use_enable audit)
+ $(use_enable debug)
+ $(use_enable berkdb db)
+ $(use_enable nis)
+ --with-db-uniquename=-$(db_findver sys-libs/db)
+ --disable-prelude
+ )
+
+ if use hppa || use elibc_FreeBSD; then
+ myeconfargs+=( --disable-pie )
+ fi
+
+ autotools-utils_src_configure
+}
+
+src_compile() {
+ autotools-utils_src_compile sepermitlockdir="${EPREFIX}/run/sepermit"
+}
+
+DOCS=( CHANGELOG ChangeLog README AUTHORS Copyright NEWS )
+
+src_install() {
+ autotools-utils_src_install sepermitlockdir="${EPREFIX}/run/sepermit"
+
+ # Need to be suid
+ fperms u+s /sbin/unix_chkpwd
+
+ gen_usr_ldscript -a pam pamc pam_misc
+
+ # create extra symlinks just in case something depends on them...
+ local lib
+ for lib in pam pamc pam_misc; do
+ if ! [[ -f "${ED}"/$(get_libdir)/lib${lib}$(get_libname) ]]; then
+ dosym lib${lib}$(get_libname 0) /$(get_libdir)/lib${lib}$(get_libname)
+ fi
+ done
+
+ docinto modules
+ for dir in modules/pam_*; do
+ newdoc "${dir}"/README README."$(basename "${dir}")"
+ done
+
+ prune_libtool_files --all
+
+ if use selinux; then
+ dodir /usr/lib/tmpfiles.d
+ cat - > "${D}"/usr/lib/tmpfiles.d/${CATEGORY}:${PN}:${SLOT}.conf <<EOF
+d /run/sepermit 0755 root root
+EOF
+ fi
+}
+
+pkg_preinst() {
+ check_old_modules || die "deprecated PAM modules still used"
+}
+
+pkg_postinst() {
+ ewarn "Some software with pre-loaded PAM libraries might experience"
+ ewarn "warnings or failures related to missing symbols and/or versions"
+ ewarn "after any update. While unfortunate this is a limit of the"
+ ewarn "implementation of PAM and the software, and it requires you to"
+ ewarn "restart the software manually after the update."
+ ewarn ""
+ ewarn "You can get a list of such software running a command like"
+ ewarn " lsof / | egrep -i 'del.*libpam\\.so'"
+ ewarn ""
+ ewarn "Alternatively, simply reboot your system."
+ if [ -x "${ROOT}"/var/log/tallylog ] ; then
+ elog ""
+ elog "Because of a bug present up to version 1.1.1-r2, you have"
+ elog "an executable /var/log/tallylog file. You can safely"
+ elog "correct it by running the command"
+ elog " chmod -x /var/log/tallylog"
+ elog ""
+ fi
+}
diff --git a/sys-libs/pam/pam-1.2.0.ebuild b/sys-libs/pam/pam-1.2.0.ebuild
new file mode 100644
index 000000000000..a44d9eaea2ab
--- /dev/null
+++ b/sys-libs/pam/pam-1.2.0.ebuild
@@ -0,0 +1,194 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit libtool multilib multilib-minimal eutils pam toolchain-funcs flag-o-matic db-use
+
+MY_PN="Linux-PAM"
+MY_P="${MY_PN}-${PV}"
+
+HOMEPAGE="https://fedorahosted.org/linux-pam/"
+DESCRIPTION="Linux-PAM (Pluggable Authentication Modules)"
+SRC_URI="http://www.linux-pam.org/library/${MY_P}.tar.bz2
+ http://www.linux-pam.org/documentation/${MY_P}-docs.tar.bz2"
+
+LICENSE="|| ( BSD GPL-2 )"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~ia64-linux ~x86-linux"
+IUSE="audit berkdb cracklib debug nis nls +pie selinux test vim-syntax"
+
+RDEPEND="nls? ( >=virtual/libintl-0-r1[${MULTILIB_USEDEP}] )
+ cracklib? ( >=sys-libs/cracklib-2.9.1-r1[${MULTILIB_USEDEP}] )
+ audit? ( >=sys-process/audit-2.2.2[${MULTILIB_USEDEP}] )
+ selinux? ( >=sys-libs/libselinux-2.2.2-r4[${MULTILIB_USEDEP}] )
+ berkdb? ( >=sys-libs/db-4.8.30-r1[${MULTILIB_USEDEP}] )
+ nis? ( >=net-libs/libtirpc-0.2.4-r2[${MULTILIB_USEDEP}] )"
+DEPEND="${RDEPEND}
+ >=sys-devel/libtool-2
+ >=sys-devel/flex-2.5.39-r1[${MULTILIB_USEDEP}]
+ nls? ( sys-devel/gettext )
+ >=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]"
+PDEPEND="sys-auth/pambase
+ vim-syntax? ( app-vim/pam-syntax )"
+RDEPEND="${RDEPEND}
+ !<sys-apps/openrc-0.11.8
+ !sys-auth/openpam
+ !sys-auth/pam_userdb
+ abi_x86_32? (
+ !<=app-emulation/emul-linux-x86-baselibs-20140508-r7
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ )"
+
+S="${WORKDIR}/${MY_P}"
+
+check_old_modules() {
+ local retval="0"
+
+ if sed -e 's:#.*::' "${EROOT}"/etc/pam.d/* 2>/dev/null | fgrep -q pam_stack.so; then
+ eerror ""
+ eerror "Your current setup is using the pam_stack module."
+ eerror "This module is deprecated and no longer supported, and since version"
+ eerror "0.99 is no longer installed, nor provided by any other package."
+ eerror "The package will be built (to allow binary package builds), but will"
+ eerror "not be installed."
+ eerror "Please replace pam_stack usage with proper include directive usage,"
+ eerror "following the PAM Upgrade guide at the following URL"
+ eerror " http://www.gentoo.org/proj/en/base/pam/upgrade-0.99.xml"
+ eerror ""
+
+ retval=1
+ fi
+
+ if sed -e 's:#.*::' "${EROOT}"/etc/pam.d/* 2>/dev/null | egrep -q 'pam_(pwdb|console)'; then
+ eerror ""
+ eerror "Your current setup is using one or more of the following modules,"
+ eerror "that are not built or supported anymore:"
+ eerror "pam_pwdb, pam_console"
+ eerror "If you are in real need for these modules, please contact the maintainers"
+ eerror "of PAM through http://bugs.gentoo.org/ providing information about its"
+ eerror "use cases."
+ eerror "Please also make sure to read the PAM Upgrade guide at the following URL:"
+ eerror " http://www.gentoo.org/proj/en/base/pam/upgrade-0.99.xml"
+ eerror ""
+
+ retval=1
+ fi
+
+ return ${retval}
+}
+
+pkg_pretend() {
+ # do not error out, this is just a warning, one could build a binpkg
+ # with old modules enabled.
+ check_old_modules
+}
+
+src_prepare() {
+ elibtoolize
+}
+
+multilib_src_configure() {
+ # Do not let user's BROWSER setting mess us up. #549684
+ unset BROWSER
+
+ # Disable automatic detection of libxcrypt; we _don't_ want the
+ # user to link libxcrypt in by default, since we won't track the
+ # dependency and allow to break PAM this way.
+ export ac_cv_header_xcrypt_h=no
+
+ local myconf=(
+ --docdir='$(datarootdir)'/doc/${PF}
+ --htmldir='$(docdir)/html'
+ --libdir='$(prefix)'/$(get_libdir)
+ --enable-securedir="${EPREFIX}"/$(get_libdir)/security
+ --enable-isadir='.' #464016
+ $(use_enable nls)
+ $(use_enable selinux)
+ $(use_enable cracklib)
+ $(use_enable audit)
+ $(use_enable debug)
+ $(use_enable berkdb db)
+ $(use_enable nis)
+ $(use_enable pie)
+ --with-db-uniquename=-$(db_findver sys-libs/db)
+ --disable-prelude
+ )
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+}
+
+multilib_src_compile() {
+ emake sepermitlockdir="${EPREFIX}/run/sepermit"
+}
+
+multilib_src_install() {
+ emake DESTDIR="${D}" install \
+ sepermitlockdir="${EPREFIX}/run/sepermit"
+
+ local prefix
+ if multilib_is_native_abi; then
+ prefix=
+ gen_usr_ldscript -a pam pamc pam_misc
+ else
+ prefix=/usr
+ fi
+
+ # create extra symlinks just in case something depends on them...
+ local lib
+ for lib in pam pamc pam_misc; do
+ if ! [[ -f "${ED}"${prefix}/$(get_libdir)/lib${lib}$(get_libname) ]]; then
+ dosym lib${lib}$(get_libname 0) ${prefix}/$(get_libdir)/lib${lib}$(get_libname)
+ fi
+ done
+}
+
+DOCS=( CHANGELOG ChangeLog README AUTHORS Copyright NEWS )
+
+multilib_src_install_all() {
+ einstalldocs
+ prune_libtool_files --all
+
+ # Need to be suid
+ fperms 4711 /sbin/unix_chkpwd
+
+ docinto modules
+ local dir
+ for dir in modules/pam_*; do
+ newdoc "${dir}"/README README."$(basename "${dir}")"
+ done
+
+ if use selinux; then
+ dodir /usr/lib/tmpfiles.d
+ cat - > "${D}"/usr/lib/tmpfiles.d/${CATEGORY}:${PN}:${SLOT}.conf <<EOF
+d /run/sepermit 0755 root root
+EOF
+ fi
+}
+
+pkg_preinst() {
+ check_old_modules || die "deprecated PAM modules still used"
+}
+
+pkg_postinst() {
+ ewarn "Some software with pre-loaded PAM libraries might experience"
+ ewarn "warnings or failures related to missing symbols and/or versions"
+ ewarn "after any update. While unfortunate this is a limit of the"
+ ewarn "implementation of PAM and the software, and it requires you to"
+ ewarn "restart the software manually after the update."
+ ewarn ""
+ ewarn "You can get a list of such software running a command like"
+ ewarn " lsof / | egrep -i 'del.*libpam\\.so'"
+ ewarn ""
+ ewarn "Alternatively, simply reboot your system."
+ if [[ -x "${EROOT}"/var/log/tallylog ]] ; then
+ elog ""
+ elog "Because of a bug present up to version 1.1.1-r2, you have"
+ elog "an executable /var/log/tallylog file. You can safely"
+ elog "correct it by running the command"
+ elog " chmod -x /var/log/tallylog"
+ elog ""
+ fi
+}
diff --git a/sys-libs/pam/pam-1.2.1-r1.ebuild b/sys-libs/pam/pam-1.2.1-r1.ebuild
new file mode 100644
index 000000000000..0c86a62dc36d
--- /dev/null
+++ b/sys-libs/pam/pam-1.2.1-r1.ebuild
@@ -0,0 +1,202 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit libtool multilib multilib-minimal eutils pam toolchain-funcs flag-o-matic db-use fcaps
+
+MY_PN="Linux-PAM"
+MY_P="${MY_PN}-${PV}"
+
+DESCRIPTION="Linux-PAM (Pluggable Authentication Modules)"
+HOMEPAGE="http://www.linux-pam.org/ https://fedorahosted.org/linux-pam/"
+SRC_URI="http://www.linux-pam.org/library/${MY_P}.tar.bz2
+ http://www.linux-pam.org/documentation/${MY_PN}-1.2.0-docs.tar.bz2"
+
+LICENSE="|| ( BSD GPL-2 )"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~ia64-linux ~x86-linux"
+IUSE="audit berkdb cracklib debug nis nls +pie selinux test vim-syntax"
+
+RDEPEND="nls? ( >=virtual/libintl-0-r1[${MULTILIB_USEDEP}] )
+ cracklib? ( >=sys-libs/cracklib-2.9.1-r1[${MULTILIB_USEDEP}] )
+ audit? ( >=sys-process/audit-2.2.2[${MULTILIB_USEDEP}] )
+ selinux? ( >=sys-libs/libselinux-2.2.2-r4[${MULTILIB_USEDEP}] )
+ berkdb? ( >=sys-libs/db-4.8.30-r1[${MULTILIB_USEDEP}] )
+ nis? ( >=net-libs/libtirpc-0.2.4-r2[${MULTILIB_USEDEP}] )"
+DEPEND="${RDEPEND}
+ >=sys-devel/libtool-2
+ >=sys-devel/flex-2.5.39-r1[${MULTILIB_USEDEP}]
+ nls? ( sys-devel/gettext )
+ >=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]"
+PDEPEND="sys-auth/pambase
+ vim-syntax? ( app-vim/pam-syntax )"
+RDEPEND="${RDEPEND}
+ !<sys-apps/openrc-0.11.8
+ !sys-auth/openpam
+ !sys-auth/pam_userdb
+ abi_x86_32? (
+ !<=app-emulation/emul-linux-x86-baselibs-20140508-r7
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ )"
+
+S="${WORKDIR}/${MY_P}"
+
+check_old_modules() {
+ local retval="0"
+
+ if sed -e 's:#.*::' "${EROOT}"/etc/pam.d/* 2>/dev/null | fgrep -q pam_stack.so; then
+ eerror ""
+ eerror "Your current setup is using the pam_stack module."
+ eerror "This module is deprecated and no longer supported, and since version"
+ eerror "0.99 is no longer installed, nor provided by any other package."
+ eerror "The package will be built (to allow binary package builds), but will"
+ eerror "not be installed."
+ eerror "Please replace pam_stack usage with proper include directive usage,"
+ eerror "following the PAM Upgrade guide at the following URL"
+ eerror " http://www.gentoo.org/proj/en/base/pam/upgrade-0.99.xml"
+ eerror ""
+
+ retval=1
+ fi
+
+ if sed -e 's:#.*::' "${EROOT}"/etc/pam.d/* 2>/dev/null | egrep -q 'pam_(pwdb|console)'; then
+ eerror ""
+ eerror "Your current setup is using one or more of the following modules,"
+ eerror "that are not built or supported anymore:"
+ eerror "pam_pwdb, pam_console"
+ eerror "If you are in real need for these modules, please contact the maintainers"
+ eerror "of PAM through http://bugs.gentoo.org/ providing information about its"
+ eerror "use cases."
+ eerror "Please also make sure to read the PAM Upgrade guide at the following URL:"
+ eerror " http://www.gentoo.org/proj/en/base/pam/upgrade-0.99.xml"
+ eerror ""
+
+ retval=1
+ fi
+
+ return ${retval}
+}
+
+pkg_pretend() {
+ # do not error out, this is just a warning, one could build a binpkg
+ # with old modules enabled.
+ check_old_modules
+}
+
+src_unpack() {
+ # Upstream didn't release a new doc tarball (since nothing changed?).
+ unpack ${MY_PN}-1.2.0-docs.tar.bz2
+ mv Linux-PAM-1.2.{0,1} || die
+ unpack ${MY_P}.tar.bz2
+}
+
+src_prepare() {
+ elibtoolize
+}
+
+multilib_src_configure() {
+ # Do not let user's BROWSER setting mess us up. #549684
+ unset BROWSER
+
+ # Disable automatic detection of libxcrypt; we _don't_ want the
+ # user to link libxcrypt in by default, since we won't track the
+ # dependency and allow to break PAM this way.
+ export ac_cv_header_xcrypt_h=no
+
+ local myconf=(
+ --docdir='$(datarootdir)'/doc/${PF}
+ --htmldir='$(docdir)/html'
+ --libdir='$(prefix)'/$(get_libdir)
+ --enable-securedir="${EPREFIX}"/$(get_libdir)/security
+ --enable-isadir='.' #464016
+ $(use_enable nls)
+ $(use_enable selinux)
+ $(use_enable cracklib)
+ $(use_enable audit)
+ $(use_enable debug)
+ $(use_enable berkdb db)
+ $(use_enable nis)
+ $(use_enable pie)
+ --with-db-uniquename=-$(db_findver sys-libs/db)
+ --disable-prelude
+ )
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+}
+
+multilib_src_compile() {
+ emake sepermitlockdir="${EPREFIX}/run/sepermit"
+}
+
+multilib_src_install() {
+ emake DESTDIR="${D}" install \
+ sepermitlockdir="${EPREFIX}/run/sepermit"
+
+ local prefix
+ if multilib_is_native_abi; then
+ prefix=
+ gen_usr_ldscript -a pam pamc pam_misc
+ else
+ prefix=/usr
+ fi
+
+ # create extra symlinks just in case something depends on them...
+ local lib
+ for lib in pam pamc pam_misc; do
+ if ! [[ -f "${ED}"${prefix}/$(get_libdir)/lib${lib}$(get_libname) ]]; then
+ dosym lib${lib}$(get_libname 0) ${prefix}/$(get_libdir)/lib${lib}$(get_libname)
+ fi
+ done
+}
+
+DOCS=( CHANGELOG ChangeLog README AUTHORS Copyright NEWS )
+
+multilib_src_install_all() {
+ einstalldocs
+ prune_libtool_files --all
+
+ docinto modules
+ local dir
+ for dir in modules/pam_*; do
+ newdoc "${dir}"/README README."$(basename "${dir}")"
+ done
+
+ if use selinux; then
+ dodir /usr/lib/tmpfiles.d
+ cat - > "${D}"/usr/lib/tmpfiles.d/${CATEGORY}:${PN}:${SLOT}.conf <<EOF
+d /run/sepermit 0755 root root
+EOF
+ fi
+}
+
+pkg_preinst() {
+ check_old_modules || die "deprecated PAM modules still used"
+}
+
+pkg_postinst() {
+ ewarn "Some software with pre-loaded PAM libraries might experience"
+ ewarn "warnings or failures related to missing symbols and/or versions"
+ ewarn "after any update. While unfortunate this is a limit of the"
+ ewarn "implementation of PAM and the software, and it requires you to"
+ ewarn "restart the software manually after the update."
+ ewarn ""
+ ewarn "You can get a list of such software running a command like"
+ ewarn " lsof / | egrep -i 'del.*libpam\\.so'"
+ ewarn ""
+ ewarn "Alternatively, simply reboot your system."
+ if [[ -x "${EROOT}"/var/log/tallylog ]] ; then
+ elog ""
+ elog "Because of a bug present up to version 1.1.1-r2, you have"
+ elog "an executable /var/log/tallylog file. You can safely"
+ elog "correct it by running the command"
+ elog " chmod -x /var/log/tallylog"
+ elog ""
+ fi
+
+ # The pam_unix module needs to check the password of the user which requires
+ # read access to /etc/shadow only.
+ fcaps cap_dac_override sbin/unix_chkpwd
+}
diff --git a/sys-libs/pam/pam-1.2.1.ebuild b/sys-libs/pam/pam-1.2.1.ebuild
new file mode 100644
index 000000000000..67d1dd2487ac
--- /dev/null
+++ b/sys-libs/pam/pam-1.2.1.ebuild
@@ -0,0 +1,201 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit libtool multilib multilib-minimal eutils pam toolchain-funcs flag-o-matic db-use
+
+MY_PN="Linux-PAM"
+MY_P="${MY_PN}-${PV}"
+
+DESCRIPTION="Linux-PAM (Pluggable Authentication Modules)"
+HOMEPAGE="http://www.linux-pam.org/ https://fedorahosted.org/linux-pam/"
+SRC_URI="http://www.linux-pam.org/library/${MY_P}.tar.bz2
+ http://www.linux-pam.org/documentation/${MY_PN}-1.2.0-docs.tar.bz2"
+
+LICENSE="|| ( BSD GPL-2 )"
+SLOT="0"
+KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-linux ~ia64-linux ~x86-linux"
+IUSE="audit berkdb cracklib debug nis nls +pie selinux test vim-syntax"
+
+RDEPEND="nls? ( >=virtual/libintl-0-r1[${MULTILIB_USEDEP}] )
+ cracklib? ( >=sys-libs/cracklib-2.9.1-r1[${MULTILIB_USEDEP}] )
+ audit? ( >=sys-process/audit-2.2.2[${MULTILIB_USEDEP}] )
+ selinux? ( >=sys-libs/libselinux-2.2.2-r4[${MULTILIB_USEDEP}] )
+ berkdb? ( >=sys-libs/db-4.8.30-r1[${MULTILIB_USEDEP}] )
+ nis? ( >=net-libs/libtirpc-0.2.4-r2[${MULTILIB_USEDEP}] )"
+DEPEND="${RDEPEND}
+ >=sys-devel/libtool-2
+ >=sys-devel/flex-2.5.39-r1[${MULTILIB_USEDEP}]
+ nls? ( sys-devel/gettext )
+ >=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]"
+PDEPEND="sys-auth/pambase
+ vim-syntax? ( app-vim/pam-syntax )"
+RDEPEND="${RDEPEND}
+ !<sys-apps/openrc-0.11.8
+ !sys-auth/openpam
+ !sys-auth/pam_userdb
+ abi_x86_32? (
+ !<=app-emulation/emul-linux-x86-baselibs-20140508-r7
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ )"
+
+S="${WORKDIR}/${MY_P}"
+
+check_old_modules() {
+ local retval="0"
+
+ if sed -e 's:#.*::' "${EROOT}"/etc/pam.d/* 2>/dev/null | fgrep -q pam_stack.so; then
+ eerror ""
+ eerror "Your current setup is using the pam_stack module."
+ eerror "This module is deprecated and no longer supported, and since version"
+ eerror "0.99 is no longer installed, nor provided by any other package."
+ eerror "The package will be built (to allow binary package builds), but will"
+ eerror "not be installed."
+ eerror "Please replace pam_stack usage with proper include directive usage,"
+ eerror "following the PAM Upgrade guide at the following URL"
+ eerror " http://www.gentoo.org/proj/en/base/pam/upgrade-0.99.xml"
+ eerror ""
+
+ retval=1
+ fi
+
+ if sed -e 's:#.*::' "${EROOT}"/etc/pam.d/* 2>/dev/null | egrep -q 'pam_(pwdb|console)'; then
+ eerror ""
+ eerror "Your current setup is using one or more of the following modules,"
+ eerror "that are not built or supported anymore:"
+ eerror "pam_pwdb, pam_console"
+ eerror "If you are in real need for these modules, please contact the maintainers"
+ eerror "of PAM through http://bugs.gentoo.org/ providing information about its"
+ eerror "use cases."
+ eerror "Please also make sure to read the PAM Upgrade guide at the following URL:"
+ eerror " http://www.gentoo.org/proj/en/base/pam/upgrade-0.99.xml"
+ eerror ""
+
+ retval=1
+ fi
+
+ return ${retval}
+}
+
+pkg_pretend() {
+ # do not error out, this is just a warning, one could build a binpkg
+ # with old modules enabled.
+ check_old_modules
+}
+
+src_unpack() {
+ # Upstream didn't release a new doc tarball (since nothing changed?).
+ unpack ${MY_PN}-1.2.0-docs.tar.bz2
+ mv Linux-PAM-1.2.{0,1} || die
+ unpack ${MY_P}.tar.bz2
+}
+
+src_prepare() {
+ elibtoolize
+}
+
+multilib_src_configure() {
+ # Do not let user's BROWSER setting mess us up. #549684
+ unset BROWSER
+
+ # Disable automatic detection of libxcrypt; we _don't_ want the
+ # user to link libxcrypt in by default, since we won't track the
+ # dependency and allow to break PAM this way.
+ export ac_cv_header_xcrypt_h=no
+
+ local myconf=(
+ --docdir='$(datarootdir)'/doc/${PF}
+ --htmldir='$(docdir)/html'
+ --libdir='$(prefix)'/$(get_libdir)
+ --enable-securedir="${EPREFIX}"/$(get_libdir)/security
+ --enable-isadir='.' #464016
+ $(use_enable nls)
+ $(use_enable selinux)
+ $(use_enable cracklib)
+ $(use_enable audit)
+ $(use_enable debug)
+ $(use_enable berkdb db)
+ $(use_enable nis)
+ $(use_enable pie)
+ --with-db-uniquename=-$(db_findver sys-libs/db)
+ --disable-prelude
+ )
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+}
+
+multilib_src_compile() {
+ emake sepermitlockdir="${EPREFIX}/run/sepermit"
+}
+
+multilib_src_install() {
+ emake DESTDIR="${D}" install \
+ sepermitlockdir="${EPREFIX}/run/sepermit"
+
+ local prefix
+ if multilib_is_native_abi; then
+ prefix=
+ gen_usr_ldscript -a pam pamc pam_misc
+ else
+ prefix=/usr
+ fi
+
+ # create extra symlinks just in case something depends on them...
+ local lib
+ for lib in pam pamc pam_misc; do
+ if ! [[ -f "${ED}"${prefix}/$(get_libdir)/lib${lib}$(get_libname) ]]; then
+ dosym lib${lib}$(get_libname 0) ${prefix}/$(get_libdir)/lib${lib}$(get_libname)
+ fi
+ done
+}
+
+DOCS=( CHANGELOG ChangeLog README AUTHORS Copyright NEWS )
+
+multilib_src_install_all() {
+ einstalldocs
+ prune_libtool_files --all
+
+ # Need to be suid
+ fperms 4711 /sbin/unix_chkpwd
+
+ docinto modules
+ local dir
+ for dir in modules/pam_*; do
+ newdoc "${dir}"/README README."$(basename "${dir}")"
+ done
+
+ if use selinux; then
+ dodir /usr/lib/tmpfiles.d
+ cat - > "${D}"/usr/lib/tmpfiles.d/${CATEGORY}:${PN}:${SLOT}.conf <<EOF
+d /run/sepermit 0755 root root
+EOF
+ fi
+}
+
+pkg_preinst() {
+ check_old_modules || die "deprecated PAM modules still used"
+}
+
+pkg_postinst() {
+ ewarn "Some software with pre-loaded PAM libraries might experience"
+ ewarn "warnings or failures related to missing symbols and/or versions"
+ ewarn "after any update. While unfortunate this is a limit of the"
+ ewarn "implementation of PAM and the software, and it requires you to"
+ ewarn "restart the software manually after the update."
+ ewarn ""
+ ewarn "You can get a list of such software running a command like"
+ ewarn " lsof / | egrep -i 'del.*libpam\\.so'"
+ ewarn ""
+ ewarn "Alternatively, simply reboot your system."
+ if [[ -x "${EROOT}"/var/log/tallylog ]] ; then
+ elog ""
+ elog "Because of a bug present up to version 1.1.1-r2, you have"
+ elog "an executable /var/log/tallylog file. You can safely"
+ elog "correct it by running the command"
+ elog " chmod -x /var/log/tallylog"
+ elog ""
+ fi
+}
diff --git a/sys-libs/pwdb/Manifest b/sys-libs/pwdb/Manifest
new file mode 100644
index 000000000000..edae62b8df14
--- /dev/null
+++ b/sys-libs/pwdb/Manifest
@@ -0,0 +1 @@
+DIST pwdb-0.62.tar.gz 133183 RMD160 01aca626eb54e82811ee7c7ae27b96bc22035b75 SHA1 10997946c087c3afdf9e4cca458eabaa1fac5317 SHA256 1e0420b92c9996f82b3364b982f7d6c62460c513afa329b78317b3037dc3d4b9
diff --git a/sys-libs/pwdb/files/passwd b/sys-libs/pwdb/files/passwd
new file mode 100644
index 000000000000..09a3643714cf
--- /dev/null
+++ b/sys-libs/pwdb/files/passwd
@@ -0,0 +1,4 @@
+auth required pam_pwdb.so shadow nullok
+account required pam_pwdb.so
+password required pam_pwdb.so md5
+session required pam_pwdb.so
diff --git a/sys-libs/pwdb/files/pwdb-0.62-build.patch b/sys-libs/pwdb/files/pwdb-0.62-build.patch
new file mode 100644
index 000000000000..ecef517b1ca3
--- /dev/null
+++ b/sys-libs/pwdb/files/pwdb-0.62-build.patch
@@ -0,0 +1,114 @@
+ - drop ldconfig junk
+ - fix types used in socket functions (socklen_t, not int)
+
+http://bugs.gentoo.org/126977
+ - respect user LDFLAGS
+
+http://bugs.gentoo.org/126695
+ - add missing headers
+ - add missing comma to supp_entry
+
+http://bugs.gentoo.org/137134
+ - don't show traditional warnings
+
+--- Makefile
++++ Makefile
+@@ -71,7 +71,7 @@
+
+ WARNINGS += -ansi -D_POSIX_SOURCE -Wall -Wwrite-strings \
+ -Wcast-qual -Wcast-align \
+- -Wtraditional -Wstrict-prototypes -Wmissing-prototypes \
++ -Wstrict-prototypes -Wmissing-prototypes \
+ -Wnested-externs -Winline -Wshadow
+ INCLUDEDIR=-I$(CRTDIR)/include
+
+--- libpwdb/Makefile
++++ libpwdb/Makefile
+@@ -50,7 +50,7 @@
+
+
+ $(LIBDYNAME): $(LIBOBJ)
+- $(LD) -soname $(LIBSONAME) -x -shared -o $(LIBFILENAME) $(LIBOBJ) -lcrypt -lnsl -lc
++ $(CC) $(LDFLAGS) -shared -Wl,-soname -Wl,$(LIBSONAME) -Wl,-x -o $(LIBFILENAME) $(LIBOBJ) -lcrypt -lnsl $(LDLIBS)
+ @ln -sf $(LIBFILENAME) $@
+
+ $(LIBSTATIC): $(LIBOBJ)
+@@ -68,7 +68,7 @@
+ $(INSTALL) -m 644 radius.h $(INCLUDED)/radius.h
+ $(INSTALL) -m 644 _pwdb_macros.h $(INCLUDED)/_pwdb_macros.h
+ $(INSTALL) -m 755 $(LIBFILENAME) $(LIBDIR)
+- $(LDCONFIG)
++ ln -sf $(LIBFILENAME) $(LIBDIR)/$(LIBSONAME)
+ ln -sf $(LIBFILENAME) $(LIBDIR)/$(LIBDYNAME)
+ $(INSTALL) -m 644 $(LIBSTATIC) $(LIBDIR)
+
+--- libpwdb/posix/pwd.c
++++ libpwdb/posix/pwd.c
+@@ -7,6 +7,7 @@
+ */
+
+ #include <stdio.h>
++#include <string.h>
+
+ #define PWDB_HARD_CORE 1
+ #include <pwdb/pwdb_public.h>
+--- libpwdb/posix/undefined.c
++++ libpwdb/posix/undefined.c
+@@ -5,6 +5,7 @@
+ */
+
+ #include <stdio.h>
++#include <stdlib.h>
+
+ #define PWDB_HARD_CORE 1
+ #include <pwdb/pwdb_public.h>
+--- libpwdb/pwdb/pwdb_helper.c
++++ libpwdb/pwdb/pwdb_helper.c
+@@ -18,6 +18,7 @@
+ *
+ */
+
++#include <string.h>
+ #include "pwdb_public.h"
+ #include "pwdb_module.h"
+
+--- libpwdb/pwdb/interface/shadow/group.c
++++ libpwdb/pwdb/interface/shadow/group.c
+@@ -533,7 +533,7 @@
+
+ static const char *supp_entry[] = {
+ "group", "passwd",
+- "users", "admins" /* these are from /etc/group */
++ "users", "admins", /* these are from /etc/group */
+ "groups", /* these are serviced by requests */
+ NULL
+ };
+--- libpwdb/radius/radius.c
++++ libpwdb/radius/radius.c
+@@ -145,7 +145,7 @@
+ const char* password,
+ RADIUS_RESULT *rad_result)
+ {
+- int salen;
++ socklen_t salen;
+ int sockfd;
+ struct sockaddr saremote;
+ struct sockaddr_in *s_in;
+@@ -333,7 +333,7 @@
+ const char* new_password,
+ RADIUS_RESULT *rad_result)
+ {
+- int salen;
++ socklen_t salen;
+ int sockfd;
+ struct sockaddr saremote;
+ struct sockaddr_in *s_in;
+@@ -535,7 +535,7 @@
+ int sense,
+ int session_time)
+ {
+- int salen;
++ socklen_t salen;
+ int sockfd;
+ struct sockaddr saremote;
+ struct sockaddr_in *s_in;
diff --git a/sys-libs/pwdb/files/pwdb-0.62-selinux.patch b/sys-libs/pwdb/files/pwdb-0.62-selinux.patch
new file mode 100644
index 000000000000..c31579cc8d98
--- /dev/null
+++ b/sys-libs/pwdb/files/pwdb-0.62-selinux.patch
@@ -0,0 +1,445 @@
+--- pwdb-0.62/examples/Makefile.pwdbselinux 1998-10-06 19:57:04.000000000 -0400
++++ pwdb-0.62/examples/Makefile 2003-07-09 14:45:54.702663000 -0400
+@@ -4,6 +4,8 @@ PROGS = posix gentest tpwdb radtest grou
+ SRCS = $(addsuffix .c,$(PROGS))
+ OBJS = $(addsuffix .o,$(PROGS))
+
++SELINUXLIBS = -lselinux
++
+ # rules
+ junk:
+ @echo "this is not a top-level Makefile"
+@@ -14,20 +16,20 @@ junk:
+
+ all: ${PROGS} ../libpwdb/libpwdb.a
+
+-posix: posix.o ../libpwdb/libpwdb.a
+- $(CC) -o $@ $< ../libpwdb/libpwdb.a -lnsl
++posix: posix.o ../libpwdb/libpwdb.a
++ $(CC) -o $@ $< ../libpwdb/libpwdb.a -lnsl ${SELINUXLIBS}
+
+ tpwdb: tpwdb.o ../libpwdb/libpwdb.a
+- ${CC} -g -o $@ $< ../libpwdb/libpwdb.a -lnsl
++ ${CC} -g -o $@ $< ../libpwdb/libpwdb.a -lnsl ${SELINUXLIBS}
+
+ radtest: radtest.o ../libpwdb/libpwdb.a
+- ${CC} -g -o $@ $< ../libpwdb/libpwdb.a -lnsl
++ ${CC} -g -o $@ $< ../libpwdb/libpwdb.a -lnsl ${SELINUXLIBS}
+
+ gentest: gentest.o ../libpwdb/libpwdb.a
+- ${CC} -g -o $@ $< ../libpwdb/libpwdb.a -lnsl
++ ${CC} -g -o $@ $< ../libpwdb/libpwdb.a -lnsl ${SELINUXLIBS}
+
+ grouptest: grouptest.o ../libpwdb/libpwdb.a
+- ${CC} -g -o $@ $< ../libpwdb/libpwdb.a -lnsl
++ ${CC} -g -o $@ $< ../libpwdb/libpwdb.a -lnsl ${SELINUXLIBS}
+
+ clean:
+ rm -f ${PROGS} *.o *~
+--- pwdb-0.62/libpwdb/shadow/shadowio.c.pwdbselinux 1998-10-06 16:58:43.000000000 -0400
++++ pwdb-0.62/libpwdb/shadow/shadowio.c 2003-07-09 14:45:54.705662544 -0400
+@@ -16,6 +16,12 @@
+
+ #include "../_pwdb_internal.h"
+
++#ifdef WITH_SELINUX
++#include <selinux/selinux.h>
++static int selinux_enabled=0;
++static security_context_t prev_context=NULL;
++#endif
++
+ struct spw_file_entry {
+ char *spwf_line;
+ int spwf_changed;
+@@ -259,8 +265,28 @@ int __pwdb_spw_close (void)
+ if (fstat (fileno (spwfp), &sb))
+ return 0;
+
+- if (create_backup_file(spwfp, backup, &sb))
+- return 0;
++#ifdef WITH_SELINUX
++ if (selinux_enabled=is_selinux_enabled()) {
++ security_context_t passwd_context=NULL;
++ if (fgetfilecon(fileno (spwfp),&passwd_context)<0) {
++ return 0;
++ };
++ if (getfscreatecon(&prev_context)<0) {
++ freecon(passwd_context);
++ return 0;
++ }
++ if (setfscreatecon(passwd_context)) {
++ freecon(passwd_context);
++ freecon(prev_context);
++ return 0;
++ }
++ freecon(passwd_context);
++ }
++#endif
++ if (create_backup_file(spwfp, backup, &sb)){
++ errors++;
++ goto errorexit;
++ }
+
+ isopen = 0;
+ (void) fclose (spwfp);
+@@ -278,11 +304,15 @@ int __pwdb_spw_close (void)
+ */
+
+ spwfp = fopen_with_umask(newfile, "w", 0777);
+- if (!spwfp)
+- return 0;
++ if (!spwfp){
++ errors++;
++ goto errorexit;
++ }
+ if (chown(newfile, sb.st_uid, sb.st_gid) ||
+- chmod(newfile, sb.st_mode))
+- return 0;
++ chmod(newfile, sb.st_mode)){
++ errors++;
++ goto errorexit;
++ }
+
+ /*
+ * Check each member in the list and write out any elements
+@@ -308,7 +338,7 @@ int __pwdb_spw_close (void)
+
+ if (errors) {
+ unlink (newfile);
+- return 0;
++ goto errorexit;
+ }
+
+ /*
+@@ -352,7 +382,20 @@ int __pwdb_spw_close (void)
+ }
+ spwf_tail = 0;
+ isopen = 0;
+- return 1;
++
++ errorexit:
++#ifdef WITH_SELINUX
++ if (selinux_enabled) {
++ if (setfscreatecon(prev_context)) {
++ errors++;
++ }
++ if (prev_context != NULL) {
++ freecon(prev_context);
++ prev_context=NULL;
++ }
++ }
++#endif
++ return errors==0;
+ }
+
+ int __pwdb_spw_update (const struct __pwdb_spwd *spwd)
+--- pwdb-0.62/libpwdb/shadow/sgroupio.c.pwdbselinux 1998-10-06 16:58:43.000000000 -0400
++++ pwdb-0.62/libpwdb/shadow/sgroupio.c 2003-07-09 14:45:54.704662696 -0400
+@@ -16,6 +16,12 @@
+
+ #include "../_pwdb_internal.h"
+
++#ifdef WITH_SELINUX
++#include <selinux/selinux.h>
++static int selinux_enabled=0;
++static security_context_t prev_context=NULL;
++#endif
++
+ static int islocked;
+ static int isopen;
+ static int open_modes;
+@@ -278,8 +284,28 @@ int __pwdb_sgr_close (void)
+ if (fstat (fileno (sgrfp), &sb))
+ return 0;
+
+- if (create_backup_file(sgrfp, backup, &sb))
+- return 0;
++#ifdef WITH_SELINUX
++ if (selinux_enabled=is_selinux_enabled()) {
++ security_context_t passwd_context=NULL;
++ if (fgetfilecon(fileno (sgrfp),&passwd_context)<0) {
++ return 0;
++ };
++ if (getfscreatecon(&prev_context)<0) {
++ freecon(passwd_context);
++ return 0;
++ }
++ if (setfscreatecon(passwd_context)) {
++ freecon(passwd_context);
++ freecon(prev_context);
++ return 0;
++ }
++ freecon(passwd_context);
++ }
++#endif
++ if (create_backup_file(sgrfp, backup, &sb)){
++ errors++;
++ goto errorexit;
++ }
+
+ isopen = 0;
+ (void) fclose (sgrfp);
+@@ -296,11 +322,15 @@ int __pwdb_sgr_close (void)
+ */
+
+ sgrfp = fopen_with_umask(newfile, "w", 0777);
+- if (!sgrfp)
+- return 0;
++ if (!sgrfp){
++ errors++;
++ goto errorexit;
++ }
+ if (chown(newfile, sb.st_uid, sb.st_gid) ||
+- chmod(newfile, sb.st_mode))
+- return 0;
++ chmod(newfile, sb.st_mode)){
++ errors++;
++ goto errorexit;
++ }
+
+ /*
+ * Check each member in the list and write out any elements
+@@ -326,7 +356,7 @@ int __pwdb_sgr_close (void)
+
+ if (errors) {
+ unlink (newfile);
+- return 0;
++ goto errorexit;
+ }
+
+ /*
+@@ -370,7 +400,20 @@ int __pwdb_sgr_close (void)
+ }
+ sgr_tail = 0;
+ isopen = 0;
+- return 1;
++
++ errorexit:
++#ifdef WITH_SELINUX
++ if (selinux_enabled) {
++ if (setfscreatecon(prev_context)) {
++ errors++;
++ }
++ if (prev_context != NULL) {
++ freecon(prev_context);
++ prev_context=NULL;
++ }
++ }
++#endif
++ return errors==0;
+ }
+
+ int __pwdb_sgr_update (const struct __pwdb_sgrp *sgrent)
+--- pwdb-0.62/libpwdb/unix/pwio.c.pwdbselinux 1998-10-06 16:58:43.000000000 -0400
++++ pwdb-0.62/libpwdb/unix/pwio.c 2003-07-09 14:45:54.707662240 -0400
+@@ -16,6 +16,11 @@
+
+ #include "../_pwdb_internal.h"
+
++#ifdef WITH_SELINUX
++#include <selinux/selinux.h>
++static int selinux_enabled=0;
++static security_context_t prev_context=NULL;
++#endif
+ struct pw_file_entry {
+ char *pwf_line;
+ int pwf_changed;
+@@ -204,8 +209,28 @@ int __pwdb_pw_close (void)
+ if (fstat (fileno (pwfp), &sb))
+ return 0;
+
+- if (create_backup_file(pwfp, backup, &sb))
+- return 0;
++#ifdef WITH_SELINUX
++ if (selinux_enabled=is_selinux_enabled()) {
++ security_context_t passwd_context=NULL;
++ if (fgetfilecon(fileno (pwfp),&passwd_context)<0) {
++ return 0;
++ };
++ if (getfscreatecon(&prev_context)<0) {
++ freecon(passwd_context);
++ return 0;
++ }
++ if (setfscreatecon(passwd_context)) {
++ freecon(passwd_context);
++ freecon(prev_context);
++ return 0;
++ }
++ freecon(passwd_context);
++ }
++#endif
++ if (create_backup_file(pwfp, backup, &sb)) {
++ errors++;
++ goto errorexit;
++ }
+
+ isopen = 0;
+ (void) fclose (pwfp);
+@@ -222,11 +247,15 @@ int __pwdb_pw_close (void)
+ */
+
+ pwfp = fopen_with_umask(newfile, "w", 0777);
+- if (!pwfp)
+- return 0;
++ if (!pwfp) {
++ errors++;
++ goto errorexit;
++ }
+ if (chown(newfile, sb.st_uid, sb.st_gid) ||
+- chmod(newfile, sb.st_mode))
+- return 0;
++ chmod(newfile, sb.st_mode)) {
++ errors++;
++ goto errorexit;
++ }
+
+ /*
+ * Check each member in the list and write out any elements
+@@ -251,7 +280,7 @@ int __pwdb_pw_close (void)
+
+ if (errors) {
+ unlink (newfile);
+- return 0;
++ goto errorexit;
+ }
+
+ /*
+@@ -294,7 +323,20 @@ int __pwdb_pw_close (void)
+ }
+ pwf_tail = 0;
+ isopen = 0;
+- return 1;
++
++ errorexit:
++#ifdef WITH_SELINUX
++ if (selinux_enabled) {
++ if (setfscreatecon(prev_context)) {
++ errors++;
++ }
++ if (prev_context != NULL) {
++ freecon(prev_context);
++ prev_context=NULL;
++ }
++ }
++#endif
++ return errors==0;
+ }
+
+ /*
+--- pwdb-0.62/libpwdb/unix/groupio.c.pwdbselinux 1998-10-06 16:58:43.000000000 -0400
++++ pwdb-0.62/libpwdb/unix/groupio.c 2003-07-09 14:45:54.708662088 -0400
+@@ -11,6 +11,12 @@
+ #include "../_pwdb_internal.h"
+
+
++#ifdef WITH_SELINUX
++#include <selinux/selinux.h>
++int selinux_enabled=0;
++static security_context_t prev_context=NULL;
++#endif
++
+ static int islocked;
+ static int isopen;
+ static int open_modes;
+@@ -259,8 +265,28 @@ int __pwdb_gr_close (void)
+ if (fstat (fileno (grfp), &sb))
+ return 0;
+
+- if (create_backup_file(grfp, backup, &sb))
+- return 0;
++#ifdef WITH_SELINUX
++ if (selinux_enabled=is_selinux_enabled()) {
++ security_context_t group_context=NULL;
++ if (fgetfilecon(fileno (grfp),&group_context)<0) {
++ return 0;
++ };
++ if (getfscreatecon(&prev_context)<0) {
++ freecon(group_context);
++ return 0;
++ }
++ if (setfscreatecon(group_context)) {
++ freecon(group_context);
++ freecon(prev_context);
++ return 0;
++ }
++ freecon(group_context);
++ }
++#endif
++ if (create_backup_file(grfp, backup, &sb)) {
++ errors++;
++ goto errorexit;
++ }
+
+ isopen = 0;
+ (void) fclose (grfp);
+@@ -278,11 +304,15 @@ int __pwdb_gr_close (void)
+ */
+
+ grfp = fopen_with_umask(newfile, "w", 0777);
+- if (!grfp)
+- return 0;
++ if (!grfp) {
++ errors++;
++ goto errorexit;
++ }
+ if (chown(newfile, sb.st_uid, sb.st_gid) ||
+- chmod(newfile, sb.st_mode))
+- return 0;
++ chmod(newfile, sb.st_mode)) {
++ errors++;
++ goto errorexit;
++ }
+
+ /*
+ * Check each member in the list and write out any elements
+@@ -308,7 +338,7 @@ int __pwdb_gr_close (void)
+
+ if (errors) {
+ unlink (newfile);
+- return 0;
++ goto errorexit;
+ }
+
+ /*
+@@ -351,7 +381,19 @@ int __pwdb_gr_close (void)
+ }
+ grf_tail = 0;
+ isopen = 0;
+- return 1;
++ errorexit:
++#ifdef WITH_SELINUX
++ if (selinux_enabled) {
++ if (setfscreatecon(prev_context)) {
++ errors++;
++ }
++ if (prev_context != NULL) {
++ freecon(prev_context);
++ prev_context=NULL;
++ }
++ }
++#endif
++ return errors==0;
+ }
+
+ /* update an entry */
+--- pwdb-0.62/libpwdb/Makefile.pwdbselinux 1999-04-10 05:31:20.000000000 -0400
++++ pwdb-0.62/libpwdb/Makefile 2003-07-09 14:45:54.709661936 -0400
+@@ -22,7 +22,7 @@ HEADERS = pwdb/pwdb_public.h pwdb/pwdb_c
+
+ # needed for generic interface compilation
+ # if header files are not installed (CG)
+-CFLAGS+=-I.
++CFLAGS+=-I. -DWITH_SELINUX
+
+ CFLAGS+=# -DDEBUG
+
+@@ -50,6 +50,6 @@ all: $(LIBSTATIC) $(LIBDYNAME)
+
+
+ $(LIBDYNAME): $(LIBOBJ)
+- $(CC) $(LDFLAGS) -shared -Wl,-soname -Wl,$(LIBSONAME) -Wl,-x -o $(LIBFILENAME) $(LIBOBJ) -lcrypt -lnsl -lc
++ $(CC) $(LDFLAGS) -shared -Wl,-soname -Wl,$(LIBSONAME) -Wl,-x -o $(LIBFILENAME) $(LIBOBJ) -lcrypt -lnsl -lc -lselinux
+ @ln -sf $(LIBFILENAME) $@
+
+ $(LIBSTATIC): $(LIBOBJ)
+ $(AR) $@ $(LIBOBJ)
diff --git a/sys-libs/pwdb/metadata.xml b/sys-libs/pwdb/metadata.xml
new file mode 100644
index 000000000000..96a2d586367d
--- /dev/null
+++ b/sys-libs/pwdb/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>base-system</herd>
+</pkgmetadata>
diff --git a/sys-libs/pwdb/pwdb-0.62.ebuild b/sys-libs/pwdb/pwdb-0.62.ebuild
new file mode 100644
index 000000000000..8a7725c27a96
--- /dev/null
+++ b/sys-libs/pwdb/pwdb-0.62.ebuild
@@ -0,0 +1,58 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils toolchain-funcs flag-o-matic
+
+DESCRIPTION="Password database"
+HOMEPAGE="http://packages.gentoo.org/package/sys-libs/pwdb"
+SRC_URI="mirror://gentoo/${P}.tar.gz"
+
+LICENSE="|| ( BSD GPL-2 )"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
+IUSE="selinux"
+RESTRICT="test" #122603
+
+# Note: NIS could probably be made conditional if anyone cared ...
+RDEPEND="selinux? ( sys-libs/libselinux )
+ net-libs/libtirpc"
+DEPEND="${RDEPEND}"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-build.patch
+
+ use selinux && epatch "${FILESDIR}"/${P}-selinux.patch
+
+ append-cppflags $($(tc-getPKG_CONFIG) --cflags libtirpc)
+ export LDLIBS=$($(tc-getPKG_CONFIG) --libs libtirpc)
+
+ sed -i \
+ -e "s/^DIRS = .*/DIRS = libpwdb/" \
+ -e "s:EXTRAS += :EXTRAS += ${CFLAGS} :" \
+ Makefile || die
+ sed -i \
+ -e "s:=gcc:=$(tc-getCC):g" \
+ -e "s:=ar:=$(tc-getAR):g" \
+ -e "s:=ranlib:=$(tc-getRANLIB):g" \
+ default.defs || die
+}
+
+src_install() {
+ dodir /usr/$(get_libdir) /usr/include/pwdb
+ emake \
+ INCLUDED="${D}"/usr/include/pwdb \
+ LIBDIR="${D}"/usr/$(get_libdir) \
+ LDCONFIG="echo" \
+ install
+
+ gen_usr_ldscript -a pwdb
+
+ insinto /etc
+ doins conf/pwdb.conf
+
+ dodoc CHANGES CREDITS README doc/*.txt
+ dohtml -r doc/html/*
+}
diff --git a/sys-libs/readline/Manifest b/sys-libs/readline/Manifest
new file mode 100644
index 000000000000..fe00f84e7d46
--- /dev/null
+++ b/sys-libs/readline/Manifest
@@ -0,0 +1,37 @@
+DIST readline-4.3.tar.gz 961662 SHA256 eeaf6f050b9f515b0636e5b4f2c153f9ef78e9061ee5dd74f612fab54c77bf88 SHA512 4dbc4d9f16a453f8cf6adefb5723b0f35ef79b8db7dcdfcdd2d6465cb62ca961035e5e9547bfa46d4cb1370d738b042e0e10f9233c3751925c6bccab41e7d182 WHIRLPOOL bad0852f5a97b747c79923bbef29dc48bb7730b96ba86dd444f63d9ee78fe0dda3edd249607dbaf98b3a8932b69cbcf0f79592cfc3757887791e38673dccb352
+DIST readline-5.2.tar.gz 2037705 SHA256 12e88d96aee2cd1192500356f0535540db499282ca7f76339fb4228c31249f45 SHA512 74318b32c56e888716bda2507228ecc374a24e85b2faeec4778227a9f04eb19de1fc8468c78746954c84f9e616a06dd0f8a4332ba4b438fefb7e222699baa379 WHIRLPOOL 8641abf42316ab278207c0a25d9155d4d4fddaf0e704255b40708875b9f31bd3e6caf903550783c15b160bd2b86ffc129b2eb7a1fb4a641d8d58edc3b53145c3
+DIST readline-6.2.tar.gz 2277926 SHA256 79a696070a058c233c72dd6ac697021cc64abd5ed51e59db867d66d196a89381 SHA512 fa5b4f1b6f81bc0b3be0739adb06dab0668603ff256fe62b59ebfe21d5a9e340a758a8eef569df8c4c4ecb86cdd9698a6dabc2ee8c70a769de2bd5930c32ff59 WHIRLPOOL 5d92645085f253206c16533e3cb35bb382d6fe616bf2144feb06f9ffb9b4d7cc25ceaa846b98f17aa442552a0e80642a62d57fe20982e0ed8fdefb75c2f9bbf0
+DIST readline-6.3.tar.gz 2468560 SHA256 56ba6071b9462f980c5a72ab0023893b65ba6debb4eeb475d7a563dc65cafd43 SHA512 f70efaf46d570b85c7637172b0ee2eb9a4aa73ba38a62bb45075e665929d9701b96fba0aea6c767fd9a2a0d39dfe8e70ab06da08f8524aee76a7c502f370a401 WHIRLPOOL 7c68627559890dbebf1394b911cfd4675ec8862b84d4e067a207dd37a0a94482c8d92216195df2873bcdf03a0a86150663a9604cd65a0d78363376bc8ee4cfda
+DIST readline-7.0-alpha.tar.gz 2929686 SHA256 415d6769f2b93db61f01ed3cdb34ba1878e19c69320570546f16ef543cb79632 SHA512 a3240668c2b31e4f171b034341bac7e0e0348869c9d59179724e036bb4cee57675c4aced2da53d7bca2d32ae710f0f6528bbc0af9fb6e3d1943031ee12cf5614 WHIRLPOOL e051293f8147e0c1882ae958b7c8b84dd1ffb2cf68dcb38a349c794f788d4691e8152dc56d5243ce34da52e2685bed71d674070a40db51ddd14d115a0ad5da39
+DIST readline43-001 1126 SHA256 787244afefceeaf8bfbdc95eef0c4d163ab05ecf178bb631fff287354df0d955 SHA512 1bfcaf9fd36d154230682ef66a9561281822f09629f9923acfbacbaafd650974b4d94267e1bf74ab4a66f0e2da95e64894c78373c82bee593bd9afbae4af58bc WHIRLPOOL 080c0cffb0637bba2f6819524291c8efd1832b42b7ca619fda551b00ed82558d9c03a6f739b350b8a1de2c32e6ab92fd86137a9620473439c5b6ced6d3a06f91
+DIST readline43-002 738 SHA256 3fd4694c4043b61010c44778ed61581073ac5ddee53436b0e4e1ad2bbe4da226 SHA512 546a7bfab27dd0b77f8b0683b82358a295d47e4e249e01d2e49612a2f113c18580c8276b17451e1edab61a26ddcff0267457a804120d5e0052dfe8e88632ddd2 WHIRLPOOL d3b43145a4ed207f353c5b95b52bdb81be31bd5b077ad60152799333ca582c7524c5587a4e0d9a0fc9246a114552f0c26933d2bc8f60e9de2536a8b6ec9f2cda
+DIST readline43-003 2202 SHA256 346120970e3860c776e3cf5fd78e4f09b0d326a3b633a508f35f3f0b56f4412b SHA512 fbabbe5a11c2a17dd0cb47adfb40940c860069f0e99b1478546b0351471663094d032c8049e1a2ca060f4b51835bb6a824276e1864a627711e0805268386cb8e WHIRLPOOL 076d101812e7a98d445fd447d816fd0b15c9690869f4a567d76287c495c257f85e4e79f11f7e6e8354093613ca1c0a758514672cec98d303279daf597dee2577
+DIST readline43-004 3140 SHA256 82ede838829d2f39109851eddf2dc0144885d9fdeec4e07e0814f3465320edfd SHA512 8bc87915f5340f7f88266af0bb3aa976b40d8636373def11ec23dc412d112bc314eeac5ee2832be7993a03f2d0e38643964e838d69321c7d3e2e9ea1c606df79 WHIRLPOOL aa9e8152c600f891f2b2f40d3c3b986969eb787906cf78bd305cac5d4ab97cb47cf4e0f7fe868f62abc72f254e2e562ea4caa6fde0c0fecf7de859561abe324e
+DIST readline43-005 1056 SHA256 7a06494282519d47cd7a0c13447f93d9178de43548a645a9808017cfa9bdb233 SHA512 853fcb9cacce7a9ad0d29abe979a60291253fcb3fcae1fc067718a75d123ceb16e60d11a31583c8b5bd217d5f2460ebc77d8d2c89487a7331627348d5901281c WHIRLPOOL 68e67ae313cca750d50eea0291be11cf9c69732481a5ecc75dbbc72b2ade3202fcc610f5b511bfa7a13c82103aef3a53d97b43e5966feeceab22b676ba5dff6d
+DIST readline52-001 874 SHA256 eac304c369154059f93049ada328739faaf40338d3cb1fb4b544c93d5ce3f8d5 SHA512 65b92b5e03c20566eb3c7626e3ee9631e2b26932c34f2f95d88ae731df2805bcf63fc1215b97c97a2948e83b9373e3985ca1f64a598d84f1457bb33b605e5d9c WHIRLPOOL a11176d2bd2e02c5d81dc2791946251e89133d74d8621874db638a3854415e184934589b9c04d066035ca83f00b0de5e06876fddc7d6ca8e33203559b1eeda9c
+DIST readline52-002 1433 SHA256 9deacaef25507a0c2ae0b661bf9342559b59a2954d66ea3c5f5bcd900fdfcf78 SHA512 9d5b5549c355e80608d76b532bdf358a4e26dac0b62f7c51055bb15ea831a74ad2ef25391ddc2b1615bff8974a2e89a8045567fb0c6d2726dde37aa02a0e6b31 WHIRLPOOL f45f3641984fbb519344f8be6cffb863ee9dd07dd4a59c83d8a722770e84d35be8722970e87afa47b7db6c568bf45cea8904136a92dcfab85e0c5f6b04591077
+DIST readline52-003 1204 SHA256 2a55d2ecb1c9b0147aeb193a6323616ab31c1c525a83b2db3a994b15594ba934 SHA512 7f1722adea9bb9a94277cfbc66d47f600654a0d43bce7def1405e1bb925e5fb324615dd588d1ff2555e6bdebbe3b4609237ba7f52d80689a45f80935e440a37c WHIRLPOOL ad2bf92f7bcdd50f1bf2cacf917339590a9614237712f55f6432f0f6b7354b1a4c336be7784689749809d91b8f9e1b8e518642d315f84ee2a2fb4ff3235d1ad9
+DIST readline52-004 2192 SHA256 a03b65633781efa7c3aae5d57162985e7b7a3c10acf0f2621be610e16f27e5f2 SHA512 e0c0f87ca14a3d473aa31627385f1cb9c2daaf685d8bc0c25bfb2214d5665077a74c4589e3ff5bbc6d0e8b5321ac7fe0c4f7620761d46bbdca787a751e6dbd02 WHIRLPOOL c4f95b2bdc4d2e87983f307d484276cac5e8cd1a14fdef316cba91f53e274a87928f5b7701e098d6d8e9e522320925b086786513f70599cc749dd010e27f9638
+DIST readline52-005 8029 SHA256 06001896514148a757ea6edbbd40c4fc4331dc653847244386c37b138b150f64 SHA512 bd7af4e71f1572811b37bccb68d5ebc20f2e7c21850d9ec55bc48fdf756f9ebaac888b0fc6d83b70e94e335056646e5021ec86b26100a976883ff72ee6d8d521 WHIRLPOOL 6fed5902600d880b181cde7962d0d8eb8f1552770cddf7e80fa2547da7f8f1b8da4dda06d1875510974c897136cfe36079c80aaa83ce81aafab5af39675f393b
+DIST readline52-006 2820 SHA256 dfef3e982c0adf8bb5a9b7d0468ec8f5f18138b325e28759437464de5be71013 SHA512 3523800517b24fa512f3bc8750ecb83be73d57c7d48636ac3aa6b681ee185b6460ce8461a046734b64d78834f89d18d4c9c1de92d1eee94294eeae7e2911ce93 WHIRLPOOL b85c88d1bba3ac13d7379a6018d1d2a8c5fde78af37b28eeaf18e2ce3257e220b7ed36e106b649bd35f45b83703e7d5749a7ebe7e606857a8c774f4197a5f648
+DIST readline52-007 1523 SHA256 775b028c7b761397ac6ae1bdfbac7e896dc3b9b3adc2f91312499180ca13bdd1 SHA512 fe9471b237713ef7ce53fd0cf7bbb5a60720c64ec3df9dc58146d9c187511f0a6f480ae3f3b65168723e416ba4f08c67a2add0b01ede1149f72e7fc2ef21050f WHIRLPOOL 0a737ca595dcf8ce11f22e07b0927ba35f76981b7dcab38931536f38f9f94cf57882a555f3d0993b3b9d986156deaa8742db5ad50767beb7b68bda4cd067d3ba
+DIST readline52-008 2277 SHA256 a21b4e0bf0530b878bad24d5be23d18a9e03a75a31ae30844dc0933bb3d77ecd SHA512 a864e970006146533dac885b00f53dcf1471f95d6143d8874fe8c8e056477d6c237cf2814625bf2031844285484757fa0ccf66d064ac2065ac62a21384d67c93 WHIRLPOOL 2ec34f16bb51f2def75d6ba70a99073a8164157000bc2cdd84590060e7192c7c5aaedb67a89fa8602b02c5db3636262f6bd6d49321ca1130b9571d6d5c6285b4
+DIST readline52-009 1332 SHA256 138d5e0f0709a47a2d1621295a3dd5e3cc73b63b5cc28dab03abc4e94fe95ecf SHA512 a19ca5b5875208f8ea4804461c1ba1b0e27feabb0a2a0db1fe9ea94b8d84e366e754688f5d8840f48c6bc22a02b0abcbaf35dd3361784b7db4e9e83629d840be WHIRLPOOL 707c8bbe7492f7744d43b8c90e4ae83a44fae0932bb7007725d6e75c0748cac4bb3a6b20823cb546760d1c0009c31ebaac6088e6e3a71b0ffc5bf8329538301f
+DIST readline52-010 1543 SHA256 83f8c1aadb86b1a2fad8821a9c6be72a8de5afd7fd9fde58a30b3b57d939693e SHA512 851b7ee9fa3ab84e570723d445ade084fbb5af17fd4131520650f53000e93cb7c799c56cb00e8f906b230524b2fdda60970e72a44d1673d9bcd2c4de7ae400f8 WHIRLPOOL c491a42ac29463172c56408362ac3f3787b5f18e7050a72e73ed1191519c0093591b1ff095b8ec056af001016b47f654d4db46df86fd02b643b9ff3e8ee8ecee
+DIST readline52-011 886 SHA256 08ad3384ab0906e6fa4cc417eb8c43ff59375bcead15fd5c8e31730f0413b3d6 SHA512 b4d813c3aa9c1f35962ea8ca6ad1abb34f4ed3ab91dd31eb1fc5e9b9e54da032e6fbfea583e472cc6d8c6baa4f2ad8f63efc22c749fd713e0704474aad74f0ae WHIRLPOOL 4d3b05ed68601a96d2046a917051f87263ee60b5a4f5e44211f8f6d4dd26cd55e88f119ef0fd1c92dace7de88e981155dbfc64e595f2d59d2af430585f70adad
+DIST readline52-012 3870 SHA256 20f0243be2299c23213492cc2c19cfd15cc528d2b566a76a2de58306bb9e4c9e SHA512 2964c1c3a234223216ca3a099c42d8ee7de94fa7bee73ac346cc9991b9a11ad0406d3f9d785548f15170bf803714f4ffb0c2dfad19bb633358805c9b2e2873d3 WHIRLPOOL fa4bb64304b266dc24565ca4c5396aec8a5192998bb2322906be45e40389ef10141f0bdf243a33438384508d74387b4fb645b9189264742ae6a10e5600a57af3
+DIST readline52-013 5147 SHA256 0cc649516a5bdfa61c5e56937407570288b6972d75aa1bd060ad30ebe98144d5 SHA512 6c9addc3b130d5f034488cc9506f22bd183794fd1a8ac820c674b39761c8c47df1b69dc41c8be60054a068b2ae5fb63a76268b977ea07b33a8fcc4a829b55a8f WHIRLPOOL 17a956bb00d99819067f81dbe73ab1e573f0079b0c328ecede4082b98a03b20ff2d5629daf639abc1ff19b3b9d13e3c8d23a5bfa85b4712337611ef3a4d91aff
+DIST readline52-014 1244 SHA256 6f1a68320d01522ca1ea5a737124ecc8739f3dcbfea2dee21e3ccf839a21a817 SHA512 d262861e67b79059de3967ba820ce02a7d28eff33175ecb30b748d24c08f3a151da3c53430fc2d26da5934f198075c55d2f616b93fabd297d60b9c82bae17cf0 WHIRLPOOL ff137bf6e56989e24a378dfc15c1831a7f0f458442781bffe07c429e04f21d674993ab523198341918a1cd540d2bd8806ec0c9283f879d7346f0c26b920eeca8
+DIST readline62-001 1388 SHA256 38a86c417437692db01069c8ab40a9a8f548e67ad9af0390221b024b1c39b4e3 SHA512 e505161a9ab28f6c1086a6a4ecc5a82da9001d79e4c2b7c44cd82e86dca90bc726ee2387a31e8b4c6893b240877a766fdd913ee7294389722214e6281c518478 WHIRLPOOL 28c63b09a62fa1b64902b04a3c5607da742f7f308648262736240138fa7c957f21856556c8dd2dc08749acf143c271907c69124a978191a5ddb21a6dcf9ee70a
+DIST readline62-002 1714 SHA256 1e6349128cb573172063ea007c67af79256889c809973002ca66c5dfc503c7d4 SHA512 e86cb15b4df7b2a4cf68148a3e2414b48f70ad23d9685764627906164a74f31967ba8247510229aa19dfb7f6e8e92ff89164896e79b2d7320d3a62187a9173f5 WHIRLPOOL 444fa6eaa6b3e13728224f49a012f969f736d9b448d4c7da6cf0fdd3cfb33d24ca7566801d0ffa5a642fa581571c485e3c913b4a057a096a665735a84d9fbfe8
+DIST readline62-003 1911 SHA256 cb2131ff352d6e5f82edc09755191f74220b15f026bdb6c52624931c79622374 SHA512 863a4f0725df357fdd4a2ea738a8b81d850f36652705a45a415762a643fcf32f71ecb29f9faf9acd84d0b4b67580329adc491ab3562f0ad6f4b808768539301e WHIRLPOOL 86d10b4c23eef4c64ece0a4537f13cf68198888cfdd83eb38124da8610b971e87dfcdbd64c52fd21ca6d3753298b6582ce15378112d575944ff7d9b68baea3a6
+DIST readline62-004 3335 SHA256 09bd342479ea5bb8b6411bfdf7d302fab2e521d1d241bcb8344d3bad5d9f5476 SHA512 d5c80fb49748b586867a4df0900a73257a2973653c00e1403b9ba4eb5b265cdf6b32b6432f10c23482051f173fe63c18f2b569940b9a609ee29da60ce0ae38b2 WHIRLPOOL 471ace4d86d241d11fb494e885b6e6f78a5938bcbd7f438250e0410849ed2c94ae6743162576412d7d2b7125c2151b009d97295578a716327d8a9cd003543884
+DIST readline62-005 2143 SHA256 ef02905e4d544a5a511142e8b8282e325411200c7eaca4287f413f3ea85cc1f4 SHA512 8717df6034b64cc185e006cd0a00ba80b2cc06406420fb4e080affc4bfe2d4bab07b4d0c8fdd1f5b95692ee6b572199731daeaa64c17a0d799853e132d130e90 WHIRLPOOL 5469407cbc196bfffff890d288ac8dc1a11c34a9ac87baba615587617a3e540331cf54db89de861c8fcc126a443afc91af108d9e94f6234ec80c1ade219b51a0
+DIST readline63-001 1366 SHA256 1a79bbb6eaee750e0d6f7f3d059b30a45fc54e8e388a8e05e9c3ae598590146f SHA512 e70f89ca52a4eae7e1cddd70de6a7162252231ee029c89bb3fcb0f6c8c8b46c666be910c8b2eee72e96983ec2f1a23663694dc222f67228d82e8e4684f1504a2 WHIRLPOOL ed0b0ce066ab4764851d81e44d708cc9e2f3fe36ac4788243c81b3e25aa0995d054c1caf0a788c25969c7cdc6b2bad55a9c9c64286f485194b4e76bc453edf74
+DIST readline63-002 1297 SHA256 39e304c7a526888f9e112e733848215736fb7b9d540729b9e31f3347b7a1e0a5 SHA512 4e23bd67433577e6e361d10a6c32768ea9e13b10e77493e565b870f56069b673fbcb0b860225f79fa9931845fc91d35c9a82c1385c23f8b757ebfd59f27851f4 WHIRLPOOL ca878e614ee233748f7017f5606fe2e96bb8374b33e4a571c5901594d7f329fd19b217abcf9cb844fa96374bff9e044712ed1017d6d99936f700da030202231d
+DIST readline63-003 985 SHA256 ec41bdd8b00fd884e847708513df41d51b1243cecb680189e31b7173d01ca52f SHA512 6bfb84a5b980091b995e2b96bdf5680f97fe670e6cac1b8606d2d75a1ef922ff5bd4e73f029f7af98a115006b7ab7828146f2cd6986287543d8a29987c91dc12 WHIRLPOOL 3615b462024e836f0854c2ffaf1282b42462a0da90c8ce248a47e9ea5a0ce00892135c1b725f9fb8ef1fafb1e88e02649c664373ba41683ca2457aafdd12ac93
+DIST readline63-004 1363 SHA256 4547b906fb2570866c21887807de5dee19838a60a1afb66385b272155e4355cc SHA512 6b683e9fe28831885135391b5a23bc580cacf0ffe720951a80f545574eda4eb064fe189801d44329b2eb2d3577db5a90f9e5ad9ed131e7e8a8ae349511632721 WHIRLPOOL 49deb89325cb582538027855169067c4224504d8aa944f8c6f34c07afd0bab30690e01a573ab67279d851b75c6e33e236f19a9fc9eb0271cd1f10d9b91fd0203
+DIST readline63-005 1664 SHA256 877788f9228d1a9907a4bcfe3d6dd0439c08d728949458b41208d9bf9060274b SHA512 b0332d7f999376788155341319d138a899a2278c338a6faaac89ecf3ed1e2248a07413dd810a76996bf25f211de787182b55f34ab3d7d31eb7519d7a48ebed32 WHIRLPOOL d10a4a6a9ea20e2e9bb9180e0a0511796ea0ca247bec17f2357ee8a759ac5adc877f5f838c3d1f45157014d88306f1b1dc7e9633c2bbd4a7125b9b8df5c0c0e8
+DIST readline63-006 1982 SHA256 5c237ab3c6c97c23cf52b2a118adc265b7fb411b57c93a5f7c221d50fafbe556 SHA512 e9fbfa38d7b03ab2aff2e9e48918b85b4b67a729862ee47d1cc8e0aeb90c3224394a79f68829951e1377cae65742aa5385eae865f75e9c0b2e2abde42889431c WHIRLPOOL 7b88ad9fcad9eee0762d881307d2f865c66a9ee246bc1a648d6203677fc307759ca7ee216fb632114d3da76ca27a67222aefd830bcf99ee9a96d1ba2f2105290
+DIST readline63-007 1428 SHA256 4d79b5a2adec3c2e8114cbd3d63c1771f7c6cf64035368624903d257014f5bea SHA512 abee331894846b360203a521d9a66fa02c03214120d5cafbd1cb4d680bd7bbef14321ae845dd67f7b5e8c87322801fd96fc9a5fd0ae026b41d98dc24a8949854 WHIRLPOOL fc9d866a6e0f0c2a2f752c65e6fcae56a1b0e1b5cef45154ff51b5d1b49fc75ffaa30bdf90c221fb6493381b9d67eb20168bdfd273fa0dd89602f18680bb3e5f
+DIST readline63-008 1452 SHA256 3bc093cf526ceac23eb80256b0ec87fa1735540d659742107b6284d635c43787 SHA512 8e30bbca3aa5cea8c2ee511abe0ec8f131608d74fe5ab24d68bcf452267f0f97446ed6e7cd482360876ce6c027280e4f4450cae05eb18f56046240f4c224841c WHIRLPOOL 94d9371e6ca35e72565c1990e0ec8bedf8a141f0a3d061e4928f6184c3ef4a4b472f4278d443b990a53977ad6f3f7bdbf41e51a999202b48414df3a946bb9796
diff --git a/sys-libs/readline/files/readline-5.0-no_rpath.patch b/sys-libs/readline/files/readline-5.0-no_rpath.patch
new file mode 100644
index 000000000000..624b2d7dea2b
--- /dev/null
+++ b/sys-libs/readline/files/readline-5.0-no_rpath.patch
@@ -0,0 +1,13 @@
+ripped from Fedora
+
+--- support/shobj-conf
++++ support/shobj-conf
+@@ -102,7 +102,7 @@
+ SHOBJ_LD='${CC}'
+ SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
+
+- SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir) -Wl,-soname,`basename $@ $(SHLIB_MINOR)`'
++ SHLIB_XLDFLAGS='-Wl,-soname,`basename $@ $(SHLIB_MINOR)`'
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
+ ;;
+
diff --git a/sys-libs/readline/files/readline-5.2-no-ignore-shlib-errors.patch b/sys-libs/readline/files/readline-5.2-no-ignore-shlib-errors.patch
new file mode 100644
index 000000000000..fc6349113167
--- /dev/null
+++ b/sys-libs/readline/files/readline-5.2-no-ignore-shlib-errors.patch
@@ -0,0 +1,24 @@
+dont ignore errors in the shlib subdir
+
+http://bugs.gentoo.org/216952
+
+--- Makefile.in
++++ Makefile.in
+@@ -194,7 +194,7 @@
+
+ shared: force
+ -test -d shlib || mkdir shlib
+- -( cd shlib ; ${MAKE} ${MFLAGS} all )
++ ( cd shlib ; ${MAKE} ${MFLAGS} all )
+
+ documentation: force
+ -test -d doc || mkdir doc
+@@ -238,7 +238,7 @@
+ -( cd shlib; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} uninstall )
+
+ install-shared: installdirs install-headers shared install-doc
+- -( cd shlib ; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} install )
++ ( cd shlib ; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} install )
+
+ uninstall-shared: maybe-uninstall-headers
+ -( cd shlib; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} uninstall )
diff --git a/sys-libs/readline/files/readline-6.2-rlfe-tgoto.patch b/sys-libs/readline/files/readline-6.2-rlfe-tgoto.patch
new file mode 100644
index 000000000000..b898bf053ecc
--- /dev/null
+++ b/sys-libs/readline/files/readline-6.2-rlfe-tgoto.patch
@@ -0,0 +1,14 @@
+https://bugs.gentoo.org/385091
+
+https://lists.gnu.org/archive/html/bug-readline/2011-10/msg00000.html
+
+--- a/examples/rlfe/configure
++++ b/examples/rlfe/configure
+@@ -4062,6 +4062,7 @@ cat confdefs.h >>conftest.$ac_ext
+ cat >>conftest.$ac_ext <<_ACEOF
+ /* end confdefs.h. */
+
++extern char *tgoto(char *, int, int);
+ main()
+ {
+ exit(strcmp(tgoto("%p1%d", 0, 1), "1") ? 0 : 1);
diff --git a/sys-libs/readline/files/readline-6.3-fix-long-prompt-vi-search.patch b/sys-libs/readline/files/readline-6.3-fix-long-prompt-vi-search.patch
new file mode 100644
index 000000000000..23d785054e75
--- /dev/null
+++ b/sys-libs/readline/files/readline-6.3-fix-long-prompt-vi-search.patch
@@ -0,0 +1,26 @@
+https://lists.gnu.org/archive/html/bug-bash/2014-08/msg00082.html
+
+From 2774192e93991e3d85ccc37c714aa018e442af6d Mon Sep 17 00:00:00 2001
+From: Dylan Cali <calid1984@gmail.com>
+Date: Sat, 23 Aug 2014 02:26:05 -0500
+Subject: [PATCH] fix vi search prompt bug for long prompts
+
+---
+ display.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/display.c b/display.c
+index 4df1f73..e575b16 100644
+--- a/display.c
++++ b/display.c
+@@ -2259,7 +2259,7 @@ rl_message (va_alist)
+ va_start (args);
+ format = va_arg (args, char *);
+ #endif
+- vsnprintf (msg_buf, msg_bufsiz - 1, format, args);
++ vsnprintf (msg_buf, msg_bufsiz, format, args);
+ }
+ #else
+ vsprintf (msg_buf, format, args);
+--
+1.7.10.4
diff --git a/sys-libs/readline/files/readline-6.3-read-eof.patch b/sys-libs/readline/files/readline-6.3-read-eof.patch
new file mode 100644
index 000000000000..f74aad63be1f
--- /dev/null
+++ b/sys-libs/readline/files/readline-6.3-read-eof.patch
@@ -0,0 +1,54 @@
+http://lists.gnu.org/archive/html/bug-bash/2014-12/msg00152.html
+
+*** ../bash-4.3-patched/lib/readline/readline.c 2014-10-01 13:08:28.000000000 -0400
+--- lib/readline/readline.c 2014-12-20 22:37:28.000000000 -0500
+***************
+*** 580,592 ****
+ }
+
+! /* EOF typed to a non-blank line is a <NL>. If we want to change this,
+! to force any existing line to be ignored when read(2) reads EOF,
+! for example, this is the place to change. */
+ if (c == EOF && rl_end)
+! c = NEWLINE;
+
+ /* The character _rl_eof_char typed to blank line, and not as the
+! previous character is interpreted as EOF. */
+! if (((c == _rl_eof_char && lastc != c) || c == EOF) && !rl_end)
+ {
+ #if defined (READLINE_CALLBACKS)
+--- 587,620 ----
+ }
+
+! /* EOF typed to a non-blank line is ^D the first time, EOF the second
+! time in a row. This won't return any partial line read from the tty.
+! If we want to change this, to force any existing line to be returned
+! when read(2) reads EOF, for example, this is the place to change. */
+ if (c == EOF && rl_end)
+! {
+! if (RL_SIG_RECEIVED ())
+! {
+! RL_CHECK_SIGNALS ();
+! if (rl_signal_event_hook)
+! (*rl_signal_event_hook) (); /* XXX */
+! }
+!
+! /* XXX - reading two consecutive EOFs returns EOF */
+! if (RL_ISSTATE (RL_STATE_TERMPREPPED))
+! {
+! if (lastc == _rl_eof_char || lastc == EOF)
+! rl_end = 0;
+! else
+! c = _rl_eof_char;
+! }
+! else
+! c = NEWLINE;
+! }
+
+ /* The character _rl_eof_char typed to blank line, and not as the
+! previous character is interpreted as EOF. This doesn't work when
+! READLINE_CALLBACKS is defined, so hitting a series of ^Ds will
+! erase all the chars on the line and then return EOF. */
+! if (((c == _rl_eof_char && lastc != c) || c == EOF) && rl_end == 0)
+ {
+ #if defined (READLINE_CALLBACKS)
diff --git a/sys-libs/readline/metadata.xml b/sys-libs/readline/metadata.xml
new file mode 100644
index 000000000000..0ff924c56c0e
--- /dev/null
+++ b/sys-libs/readline/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>base-system</herd>
+<use>
+ <flag name='utils'>Install rlfe (ReadLine Front-End) helper tool -- a wrapper program for making any stdin use readline</flag>
+</use>
+</pkgmetadata>
diff --git a/sys-libs/readline/readline-4.3_p5.ebuild b/sys-libs/readline/readline-4.3_p5.ebuild
new file mode 100644
index 000000000000..986d7449dacc
--- /dev/null
+++ b/sys-libs/readline/readline-4.3_p5.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# This version is just for the ABI .4 library
+
+inherit eutils flag-o-matic
+
+# Official patches
+# See ftp://ftp.cwru.edu/pub/bash/readline-4.3-patches/
+PLEVEL=${PV##*_p}
+MY_PV=${PV/_p*}
+MY_P=${PN}-${MY_PV}
+[[ ${PV} != *_p* ]] && PLEVEL=0
+patches() {
+ [[ ${PLEVEL} -eq 0 ]] && return 1
+ local opt=$1
+ eval set -- {1..${PLEVEL}}
+ set -- $(printf "${PN}${MY_PV/\.}-%03d " "$@")
+ if [[ ${opt} == -s ]] ; then
+ echo "${@/#/${DISTDIR}/}"
+ else
+ local u
+ for u in ftp://ftp.cwru.edu/pub/bash mirror://gnu/${PN} ; do
+ printf "${u}/${PN}-${MY_PV}-patches/%s " "$@"
+ done
+ fi
+}
+
+DESCRIPTION="Another cute console display library"
+HOMEPAGE="http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html"
+SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.gz $(patches)"
+
+LICENSE="GPL-2"
+SLOT="${PV:0:1}"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
+IUSE=""
+
+RDEPEND=">=sys-libs/ncurses-5.2-r2"
+DEPEND="${RDEPEND}"
+
+S=${WORKDIR}/${MY_P}
+
+src_unpack() {
+ unpack ${MY_P}.tar.gz
+ cd "${S}"
+ [[ ${PLEVEL} -gt 0 ]] && epatch $(patches -s)
+ # force ncurses linking #71420
+ sed -i -e 's:^SHLIB_LIBS=:SHLIB_LIBS=-lncurses:' support/shobj-conf || die "sed"
+}
+
+src_compile() {
+ append-cppflags -D_GNU_SOURCE
+ econf --with-curses --disable-static || die
+ emake -C shlib || die
+}
+
+src_install() {
+ emake -C shlib DESTDIR="${D}" install || die
+ rm -f "${D}"/usr/lib*/*.so
+}
diff --git a/sys-libs/readline/readline-5.2_p14.ebuild b/sys-libs/readline/readline-5.2_p14.ebuild
new file mode 100644
index 000000000000..89f18029e84b
--- /dev/null
+++ b/sys-libs/readline/readline-5.2_p14.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# This version is just for the ABI .5 library
+
+inherit eutils multilib flag-o-matic
+
+# Official patches
+# See ftp://ftp.cwru.edu/pub/bash/readline-5.1-patches/
+PLEVEL=${PV##*_p}
+MY_PV=${PV/_p*}
+MY_P=${PN}-${MY_PV}
+[[ ${PV} != *_p* ]] && PLEVEL=0
+patches() {
+ [[ ${PLEVEL} -eq 0 ]] && return 1
+ local opt=$1
+ eval set -- {1..${PLEVEL}}
+ set -- $(printf "${PN}${MY_PV/\.}-%03d " "$@")
+ if [[ ${opt} == -s ]] ; then
+ echo "${@/#/${DISTDIR}/}"
+ else
+ local u
+ for u in ftp://ftp.cwru.edu/pub/bash mirror://gnu/${PN} ; do
+ printf "${u}/${PN}-${MY_PV}-patches/%s " "$@"
+ done
+ fi
+}
+
+DESCRIPTION="Another cute console display library"
+HOMEPAGE="http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html"
+SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.gz $(patches)"
+
+LICENSE="GPL-2"
+SLOT="${PV:0:1}"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+RDEPEND=">=sys-libs/ncurses-5.2-r2"
+DEPEND="${RDEPEND}"
+
+S=${WORKDIR}/${MY_P}
+
+src_unpack() {
+ unpack ${MY_P}.tar.gz
+ cd "${S}"
+ [[ ${PLEVEL} -gt 0 ]] && epatch $(patches -s)
+ epatch "${FILESDIR}"/${PN}-5.0-no_rpath.patch
+ # force ncurses linking #71420
+ sed -i -e 's:^SHLIB_LIBS=:SHLIB_LIBS=-lncurses:' support/shobj-conf || die "sed"
+}
+
+src_compile() {
+ append-flags -D_GNU_SOURCE
+
+ # the --libdir= is needed because if lib64 is a directory, it will default
+ # to using that... even if CONF_LIBDIR isnt set or we're using a version
+ # of portage without CONF_LIBDIR support.
+ econf \
+ --with-curses \
+ --disable-static \
+ --libdir=/usr/$(get_libdir) \
+ || die
+ emake -C shlib || die
+}
+
+src_install() {
+ emake -C shlib DESTDIR="${D}" install || die
+ rm -f "${D}"/usr/lib*/*.so
+}
diff --git a/sys-libs/readline/readline-6.2_p5-r1.ebuild b/sys-libs/readline/readline-6.2_p5-r1.ebuild
new file mode 100644
index 000000000000..8ef785d1aca9
--- /dev/null
+++ b/sys-libs/readline/readline-6.2_p5-r1.ebuild
@@ -0,0 +1,153 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils multilib toolchain-funcs flag-o-matic multilib-minimal
+
+# Official patches
+# See ftp://ftp.cwru.edu/pub/bash/readline-6.2-patches/
+PLEVEL=${PV##*_p}
+MY_PV=${PV/_p*}
+MY_PV=${MY_PV/_/-}
+MY_P=${PN}-${MY_PV}
+[[ ${PV} != *_p* ]] && PLEVEL=0
+patches() {
+ [[ ${PLEVEL} -eq 0 ]] && return 1
+ local opt=$1
+ eval set -- {1..${PLEVEL}}
+ set -- $(printf "${PN}${MY_PV/\.}-%03d " "$@")
+ if [[ ${opt} == -s ]] ; then
+ echo "${@/#/${DISTDIR}/}"
+ else
+ local u
+ for u in ftp://ftp.cwru.edu/pub/bash mirror://gnu/${PN} ; do
+ printf "${u}/${PN}-${MY_PV}-patches/%s " "$@"
+ done
+ fi
+}
+
+DESCRIPTION="Another cute console display library"
+HOMEPAGE="http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html"
+SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.gz $(patches)"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux"
+IUSE="static-libs"
+
+RDEPEND=">=sys-libs/ncurses-5.9-r3[${MULTILIB_USEDEP}]
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<=app-emulation/emul-linux-x86-baselibs-20131008-r7
+ )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+S=${WORKDIR}/${MY_P}
+
+src_unpack() {
+ unpack ${MY_P}.tar.gz
+}
+
+src_prepare() {
+ [[ ${PLEVEL} -gt 0 ]] && epatch $(patches -s)
+ epatch "${FILESDIR}"/${PN}-5.0-no_rpath.patch
+ epatch "${FILESDIR}"/${PN}-5.2-no-ignore-shlib-errors.patch #216952
+ epatch "${FILESDIR}"/${PN}-6.2-rlfe-tgoto.patch #385091
+
+ # Force ncurses linking. #71420
+ # Use pkg-config to get the right values. #457558
+ local ncurses_libs=$($(tc-getPKG_CONFIG) ncurses --libs)
+ sed -i \
+ -e "/^SHLIB_LIBS=/s:=.*:='${ncurses_libs}':" \
+ support/shobj-conf || die
+ sed -i \
+ -e "/^[[:space:]]*LIBS=.-lncurses/s:-lncurses:${ncurses_libs}:" \
+ examples/rlfe/configure || die
+
+ # fix building under Gentoo/FreeBSD; upstream FreeBSD deprecated
+ # objformat for years, so we don't want to rely on that.
+ sed -i -e '/objformat/s:if .*; then:if true; then:' support/shobj-conf || die
+
+ ln -s ../.. examples/rlfe/readline # for local readline headers
+}
+
+src_configure() {
+ # fix implicit decls with widechar funcs
+ append-cppflags -D_GNU_SOURCE
+ # http://lists.gnu.org/archive/html/bug-readline/2010-07/msg00013.html
+ append-cppflags -Dxrealloc=_rl_realloc -Dxmalloc=_rl_malloc -Dxfree=_rl_free
+
+ # Make sure configure picks a better ar than `ar`. #484866
+ export ac_cv_prog_AR=$(tc-getAR)
+
+ # Force the test since we used sed above to force it.
+ export bash_cv_termcap_lib=ncurses
+
+ # This is for rlfe, but we need to make sure LDFLAGS doesn't change
+ # so we can re-use the config cache file between the two.
+ append-ldflags -L.
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ ECONF_SOURCE=${S} \
+ econf \
+ --cache-file="${BUILD_DIR}"/config.cache \
+ --with-curses \
+ $(use_enable static-libs static)
+
+ if multilib_is_native_abi && ! tc-is-cross-compiler ; then
+ # code is full of AC_TRY_RUN()
+ mkdir -p examples/rlfe || die
+ cd examples/rlfe || die
+ ECONF_SOURCE=${S}/examples/rlfe \
+ econf --cache-file="${BUILD_DIR}"/config.cache
+ fi
+}
+
+multilib_src_compile() {
+ emake
+
+ if multilib_is_native_abi && ! tc-is-cross-compiler ; then
+ # code is full of AC_TRY_RUN()
+ cd examples/rlfe || die
+ local l
+ for l in readline history ; do
+ ln -s ../../shlib/lib${l}$(get_libname)* lib${l}$(get_libname)
+ ln -sf ../../lib${l}.a lib${l}.a
+ done
+ emake
+ fi
+}
+
+multilib_src_install() {
+ default
+
+ if multilib_is_native_abi ; then
+ gen_usr_ldscript -a readline history #4411
+
+ if ! tc-is-cross-compiler; then
+ dobin examples/rlfe/rlfe
+ fi
+ fi
+}
+
+multilib_src_install_all() {
+ einstalldocs
+ dodoc USAGE
+ dohtml -r doc/.
+ docinto ps
+ dodoc doc/*.ps
+}
+
+pkg_preinst() {
+ preserve_old_lib /$(get_libdir)/lib{history,readline}.so.{4,5} #29865
+}
+
+pkg_postinst() {
+ preserve_old_lib_notify /$(get_libdir)/lib{history,readline}.so.{4,5}
+}
diff --git a/sys-libs/readline/readline-6.3_p8-r1.ebuild b/sys-libs/readline/readline-6.3_p8-r1.ebuild
new file mode 100644
index 000000000000..960a131341a7
--- /dev/null
+++ b/sys-libs/readline/readline-6.3_p8-r1.ebuild
@@ -0,0 +1,163 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit eutils multilib toolchain-funcs flag-o-matic multilib-minimal
+
+# Official patches
+# See ftp://ftp.cwru.edu/pub/bash/readline-6.3-patches/
+PLEVEL=${PV##*_p}
+MY_PV=${PV/_p*}
+MY_PV=${MY_PV/_/-}
+MY_P=${PN}-${MY_PV}
+[[ ${PV} != *_p* ]] && PLEVEL=0
+patches() {
+ [[ ${PLEVEL} -eq 0 ]] && return 1
+ local opt=$1
+ eval set -- {1..${PLEVEL}}
+ set -- $(printf "${PN}${MY_PV/\.}-%03d " "$@")
+ if [[ ${opt} == -s ]] ; then
+ echo "${@/#/${DISTDIR}/}"
+ else
+ local u
+ for u in ftp://ftp.cwru.edu/pub/bash mirror://gnu/${PN} ; do
+ printf "${u}/${PN}-${MY_PV}-patches/%s " "$@"
+ done
+ fi
+}
+
+DESCRIPTION="Another cute console display library"
+HOMEPAGE="http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html"
+SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.gz $(patches)"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux"
+IUSE="static-libs"
+
+RDEPEND=">=sys-libs/ncurses-5.9-r3[${MULTILIB_USEDEP}]
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<=app-emulation/emul-linux-x86-baselibs-20131008-r7
+ )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+S=${WORKDIR}/${MY_P}
+
+src_unpack() {
+ unpack ${MY_P}.tar.gz
+}
+
+src_prepare() {
+ [[ ${PLEVEL} -gt 0 ]] && epatch $(patches -s)
+ epatch "${FILESDIR}"/${PN}-5.0-no_rpath.patch
+ epatch "${FILESDIR}"/${PN}-6.2-rlfe-tgoto.patch #385091
+ epatch "${FILESDIR}"/${PN}-6.3-fix-long-prompt-vi-search.patch
+
+ # Force ncurses linking. #71420
+ # Use pkg-config to get the right values. #457558
+ local ncurses_libs=$($(tc-getPKG_CONFIG) ncurses --libs)
+ sed -i \
+ -e "/^SHLIB_LIBS=/s:=.*:='${ncurses_libs}':" \
+ support/shobj-conf || die
+ sed -i \
+ -e "/^[[:space:]]*LIBS=.-lncurses/s:-lncurses:${ncurses_libs}:" \
+ examples/rlfe/configure || die
+
+ # fix building under Gentoo/FreeBSD; upstream FreeBSD deprecated
+ # objformat for years, so we don't want to rely on that.
+ sed -i -e '/objformat/s:if .*; then:if true; then:' support/shobj-conf || die
+
+ ln -s ../.. examples/rlfe/readline # for local readline headers
+}
+
+src_configure() {
+ # fix implicit decls with widechar funcs
+ append-cppflags -D_GNU_SOURCE
+ # http://lists.gnu.org/archive/html/bug-readline/2010-07/msg00013.html
+ append-cppflags -Dxrealloc=_rl_realloc -Dxmalloc=_rl_malloc -Dxfree=_rl_free
+
+ # Make sure configure picks a better ar than `ar`. #484866
+ export ac_cv_prog_AR=$(tc-getAR)
+
+ # Force the test since we used sed above to force it.
+ export bash_cv_termcap_lib=ncurses
+
+ # Control cross-compiling cases when we know the right answer.
+ # In cases where the C library doesn't support wide characters, readline
+ # itself won't work correctly, so forcing the answer below should be OK.
+ if tc-is-cross-compiler ; then
+ export bash_cv_func_sigsetjmp='present'
+ export bash_cv_func_ctype_nonascii='yes'
+ export bash_cv_wcwidth_broken='no' #503312
+ fi
+
+ # This is for rlfe, but we need to make sure LDFLAGS doesn't change
+ # so we can re-use the config cache file between the two.
+ append-ldflags -L.
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ ECONF_SOURCE=${S} \
+ econf \
+ --cache-file="${BUILD_DIR}"/config.cache \
+ --docdir=/usr/share/doc/${PF} \
+ --with-curses \
+ $(use_enable static-libs static)
+
+ if multilib_is_native_abi && ! tc-is-cross-compiler ; then
+ # code is full of AC_TRY_RUN()
+ mkdir -p examples/rlfe || die
+ cd examples/rlfe || die
+ ECONF_SOURCE=${S}/examples/rlfe \
+ econf --cache-file="${BUILD_DIR}"/config.cache
+ fi
+}
+
+multilib_src_compile() {
+ emake
+
+ if multilib_is_native_abi && ! tc-is-cross-compiler ; then
+ # code is full of AC_TRY_RUN()
+ cd examples/rlfe || die
+ local l
+ for l in readline history ; do
+ ln -s ../../shlib/lib${l}$(get_libname)* lib${l}$(get_libname)
+ ln -sf ../../lib${l}.a lib${l}.a
+ done
+ emake
+ fi
+}
+
+multilib_src_install() {
+ default
+
+ if multilib_is_native_abi ; then
+ gen_usr_ldscript -a readline history #4411
+
+ if ! tc-is-cross-compiler; then
+ dobin examples/rlfe/rlfe
+ fi
+ fi
+}
+
+multilib_src_install_all() {
+ einstalldocs
+ dodoc USAGE
+ dohtml -r doc/.
+ docinto ps
+ dodoc doc/*.ps
+}
+
+pkg_preinst() {
+ preserve_old_lib /$(get_libdir)/lib{history,readline}.so.{4,5} #29865
+}
+
+pkg_postinst() {
+ preserve_old_lib_notify /$(get_libdir)/lib{history,readline}.so.{4,5}
+}
diff --git a/sys-libs/readline/readline-6.3_p8-r2.ebuild b/sys-libs/readline/readline-6.3_p8-r2.ebuild
new file mode 100644
index 000000000000..94e222320d1d
--- /dev/null
+++ b/sys-libs/readline/readline-6.3_p8-r2.ebuild
@@ -0,0 +1,164 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit eutils multilib toolchain-funcs flag-o-matic multilib-minimal
+
+# Official patches
+# See ftp://ftp.cwru.edu/pub/bash/readline-6.3-patches/
+PLEVEL=${PV##*_p}
+MY_PV=${PV/_p*}
+MY_PV=${MY_PV/_/-}
+MY_P=${PN}-${MY_PV}
+[[ ${PV} != *_p* ]] && PLEVEL=0
+patches() {
+ [[ ${PLEVEL} -eq 0 ]] && return 1
+ local opt=$1
+ eval set -- {1..${PLEVEL}}
+ set -- $(printf "${PN}${MY_PV/\.}-%03d " "$@")
+ if [[ ${opt} == -s ]] ; then
+ echo "${@/#/${DISTDIR}/}"
+ else
+ local u
+ for u in ftp://ftp.cwru.edu/pub/bash mirror://gnu/${PN} ; do
+ printf "${u}/${PN}-${MY_PV}-patches/%s " "$@"
+ done
+ fi
+}
+
+DESCRIPTION="Another cute console display library"
+HOMEPAGE="http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html"
+SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.gz $(patches)"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux"
+IUSE="static-libs utils"
+
+RDEPEND=">=sys-libs/ncurses-5.9-r3[${MULTILIB_USEDEP}]
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<=app-emulation/emul-linux-x86-baselibs-20131008-r7
+ )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+S=${WORKDIR}/${MY_P}
+
+src_unpack() {
+ unpack ${MY_P}.tar.gz
+}
+
+src_prepare() {
+ [[ ${PLEVEL} -gt 0 ]] && epatch $(patches -s)
+ epatch "${FILESDIR}"/${PN}-5.0-no_rpath.patch
+ epatch "${FILESDIR}"/${PN}-6.2-rlfe-tgoto.patch #385091
+ epatch "${FILESDIR}"/${PN}-6.3-fix-long-prompt-vi-search.patch
+ epatch "${FILESDIR}"/${PN}-6.3-read-eof.patch
+
+ # Force ncurses linking. #71420
+ # Use pkg-config to get the right values. #457558
+ local ncurses_libs=$($(tc-getPKG_CONFIG) ncurses --libs)
+ sed -i \
+ -e "/^SHLIB_LIBS=/s:=.*:='${ncurses_libs}':" \
+ support/shobj-conf || die
+ sed -i \
+ -e "/^[[:space:]]*LIBS=.-lncurses/s:-lncurses:${ncurses_libs}:" \
+ examples/rlfe/configure || die
+
+ # fix building under Gentoo/FreeBSD; upstream FreeBSD deprecated
+ # objformat for years, so we don't want to rely on that.
+ sed -i -e '/objformat/s:if .*; then:if true; then:' support/shobj-conf || die
+
+ ln -s ../.. examples/rlfe/readline # for local readline headers
+}
+
+src_configure() {
+ # fix implicit decls with widechar funcs
+ append-cppflags -D_GNU_SOURCE
+ # http://lists.gnu.org/archive/html/bug-readline/2010-07/msg00013.html
+ append-cppflags -Dxrealloc=_rl_realloc -Dxmalloc=_rl_malloc -Dxfree=_rl_free
+
+ # Make sure configure picks a better ar than `ar`. #484866
+ export ac_cv_prog_AR=$(tc-getAR)
+
+ # Force the test since we used sed above to force it.
+ export bash_cv_termcap_lib=ncurses
+
+ # Control cross-compiling cases when we know the right answer.
+ # In cases where the C library doesn't support wide characters, readline
+ # itself won't work correctly, so forcing the answer below should be OK.
+ if tc-is-cross-compiler ; then
+ export bash_cv_func_sigsetjmp='present'
+ export bash_cv_func_ctype_nonascii='yes'
+ export bash_cv_wcwidth_broken='no' #503312
+ fi
+
+ # This is for rlfe, but we need to make sure LDFLAGS doesn't change
+ # so we can re-use the config cache file between the two.
+ append-ldflags -L.
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ ECONF_SOURCE=${S} \
+ econf \
+ --cache-file="${BUILD_DIR}"/config.cache \
+ --docdir=/usr/share/doc/${PF} \
+ --with-curses \
+ $(use_enable static-libs static)
+
+ if use utils && multilib_is_native_abi && ! tc-is-cross-compiler ; then
+ # code is full of AC_TRY_RUN()
+ mkdir -p examples/rlfe || die
+ cd examples/rlfe || die
+ ECONF_SOURCE=${S}/examples/rlfe \
+ econf --cache-file="${BUILD_DIR}"/config.cache
+ fi
+}
+
+multilib_src_compile() {
+ emake
+
+ if use utils && multilib_is_native_abi && ! tc-is-cross-compiler ; then
+ # code is full of AC_TRY_RUN()
+ cd examples/rlfe || die
+ local l
+ for l in readline history ; do
+ ln -s ../../shlib/lib${l}$(get_libname)* lib${l}$(get_libname)
+ ln -sf ../../lib${l}.a lib${l}.a
+ done
+ emake
+ fi
+}
+
+multilib_src_install() {
+ default
+
+ if multilib_is_native_abi ; then
+ gen_usr_ldscript -a readline history #4411
+
+ if use utils && ! tc-is-cross-compiler; then
+ dobin examples/rlfe/rlfe
+ fi
+ fi
+}
+
+multilib_src_install_all() {
+ einstalldocs
+ dodoc USAGE
+ dohtml -r doc/.
+ docinto ps
+ dodoc doc/*.ps
+}
+
+pkg_preinst() {
+ preserve_old_lib /$(get_libdir)/lib{history,readline}.so.{4,5} #29865
+}
+
+pkg_postinst() {
+ preserve_old_lib_notify /$(get_libdir)/lib{history,readline}.so.{4,5}
+}
diff --git a/sys-libs/readline/readline-7.0_alpha.ebuild b/sys-libs/readline/readline-7.0_alpha.ebuild
new file mode 100644
index 000000000000..fb437475ea35
--- /dev/null
+++ b/sys-libs/readline/readline-7.0_alpha.ebuild
@@ -0,0 +1,165 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils multilib toolchain-funcs flag-o-matic multilib-minimal
+
+# Official patches
+# See ftp://ftp.cwru.edu/pub/bash/readline-6.3-patches/
+PLEVEL=${PV##*_p}
+MY_PV=${PV/_p*}
+MY_PV=${MY_PV/_/-}
+MY_P=${PN}-${MY_PV}
+[[ ${PV} != *_p* ]] && PLEVEL=0
+patches() {
+ [[ ${PLEVEL} -eq 0 ]] && return 1
+ local opt=$1
+ eval set -- {1..${PLEVEL}}
+ set -- $(printf "${PN}${MY_PV/\.}-%03d " "$@")
+ if [[ ${opt} == -s ]] ; then
+ echo "${@/#/${DISTDIR}/}"
+ else
+ local u
+ for u in ftp://ftp.cwru.edu/pub/bash mirror://gnu/${PN} ; do
+ printf "${u}/${PN}-${MY_PV}-patches/%s " "$@"
+ done
+ fi
+}
+
+DESCRIPTION="Another cute console display library"
+HOMEPAGE="http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html"
+case ${PV} in
+*_alpha*|*_rc*) SRC_URI+=" ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz" ;;
+*) SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.gz $(patches)" ;;
+esac
+
+LICENSE="GPL-3"
+SLOT="0/7" # subslot matches SONAME major
+#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux"
+IUSE="static-libs utils"
+
+RDEPEND=">=sys-libs/ncurses-5.9-r3[${MULTILIB_USEDEP}]
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<=app-emulation/emul-linux-x86-baselibs-20131008-r7
+ )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+S=${WORKDIR}/${MY_P}
+
+src_unpack() {
+ unpack ${MY_P}.tar.gz
+}
+
+src_prepare() {
+ [[ ${PLEVEL} -gt 0 ]] && epatch $(patches -s)
+ epatch "${FILESDIR}"/${PN}-5.0-no_rpath.patch
+ epatch "${FILESDIR}"/${PN}-6.2-rlfe-tgoto.patch #385091
+
+ # Force ncurses linking. #71420
+ # Use pkg-config to get the right values. #457558
+ local ncurses_libs=$($(tc-getPKG_CONFIG) ncurses --libs)
+ sed -i \
+ -e "/^SHLIB_LIBS=/s:=.*:='${ncurses_libs}':" \
+ support/shobj-conf || die
+ sed -i \
+ -e "/^[[:space:]]*LIBS=.-lncurses/s:-lncurses:${ncurses_libs}:" \
+ examples/rlfe/configure || die
+
+ # fix building under Gentoo/FreeBSD; upstream FreeBSD deprecated
+ # objformat for years, so we don't want to rely on that.
+ sed -i -e '/objformat/s:if .*; then:if true; then:' support/shobj-conf || die
+
+ ln -s ../.. examples/rlfe/readline # for local readline headers
+}
+
+src_configure() {
+ # fix implicit decls with widechar funcs
+ append-cppflags -D_GNU_SOURCE
+ # http://lists.gnu.org/archive/html/bug-readline/2010-07/msg00013.html
+ append-cppflags -Dxrealloc=_rl_realloc -Dxmalloc=_rl_malloc -Dxfree=_rl_free
+
+ # Make sure configure picks a better ar than `ar`. #484866
+ export ac_cv_prog_AR=$(tc-getAR)
+
+ # Force the test since we used sed above to force it.
+ export bash_cv_termcap_lib=ncurses
+
+ # Control cross-compiling cases when we know the right answer.
+ # In cases where the C library doesn't support wide characters, readline
+ # itself won't work correctly, so forcing the answer below should be OK.
+ if tc-is-cross-compiler ; then
+ export bash_cv_func_sigsetjmp='present'
+ export bash_cv_func_ctype_nonascii='yes'
+ export bash_cv_wcwidth_broken='no' #503312
+ fi
+
+ # This is for rlfe, but we need to make sure LDFLAGS doesn't change
+ # so we can re-use the config cache file between the two.
+ append-ldflags -L.
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ ECONF_SOURCE=${S} \
+ econf \
+ --cache-file="${BUILD_DIR}"/config.cache \
+ --docdir=/usr/share/doc/${PF} \
+ --with-curses \
+ $(use_enable static-libs static)
+
+ if use utils && multilib_is_native_abi && ! tc-is-cross-compiler ; then
+ # code is full of AC_TRY_RUN()
+ mkdir -p examples/rlfe || die
+ cd examples/rlfe || die
+ ECONF_SOURCE=${S}/examples/rlfe \
+ econf --cache-file="${BUILD_DIR}"/config.cache
+ fi
+}
+
+multilib_src_compile() {
+ emake
+
+ if use utils && multilib_is_native_abi && ! tc-is-cross-compiler ; then
+ # code is full of AC_TRY_RUN()
+ cd examples/rlfe || die
+ local l
+ for l in readline history ; do
+ ln -s ../../shlib/lib${l}$(get_libname)* lib${l}$(get_libname)
+ ln -sf ../../lib${l}.a lib${l}.a
+ done
+ emake
+ fi
+}
+
+multilib_src_install() {
+ default
+
+ if multilib_is_native_abi ; then
+ gen_usr_ldscript -a readline history #4411
+
+ if use utils && ! tc-is-cross-compiler; then
+ dobin examples/rlfe/rlfe
+ fi
+ fi
+}
+
+multilib_src_install_all() {
+ einstalldocs
+ dodoc USAGE
+ dohtml -r doc/.
+ docinto ps
+ dodoc doc/*.ps
+}
+
+pkg_preinst() {
+ preserve_old_lib /$(get_libdir)/lib{history,readline}.so.{4,5} #29865
+}
+
+pkg_postinst() {
+ preserve_old_lib_notify /$(get_libdir)/lib{history,readline}.so.{4,5}
+}
diff --git a/sys-libs/rvm/Manifest b/sys-libs/rvm/Manifest
new file mode 100644
index 000000000000..168f14a6681b
--- /dev/null
+++ b/sys-libs/rvm/Manifest
@@ -0,0 +1,3 @@
+DIST rvm-1.12.tar.gz 532869 RMD160 0fb596354733b384deb523c8f4266e387bfa2e8b SHA1 27dd25ed7b244cbdef6f606fc0e80aedf8cb9415 SHA256 62de522fd70fc22ce87767e3a942e331d50fb696c43cf7e80349258f9787192c
+DIST rvm-1.16.tar.gz 553968 RMD160 512e665467ad42deb1e942f08b2d92509904707e SHA1 503cd940b6e0d9c193dd9723b4f63e235c6278f4 SHA256 14549596db2608ab8d4b780e95526caf14f68f7257a1f599973af30c7725884b
+DIST rvm-1.17.tar.gz 558574 RMD160 ed5a5a3ed499cb1822766154755cb91860b533a7 SHA1 e31915d34f70c5ec9e8a08d702414b84fe0dda1f SHA256 ae560ce39ba54b57b3fcb08d37ec9e525b0f97dbb816fadbbeaddf76d609c27d
diff --git a/sys-libs/rvm/metadata.xml b/sys-libs/rvm/metadata.xml
new file mode 100644
index 000000000000..ca66751dee2f
--- /dev/null
+++ b/sys-libs/rvm/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>net-fs</herd>
+</pkgmetadata>
diff --git a/sys-libs/rvm/rvm-1.12.ebuild b/sys-libs/rvm/rvm-1.12.ebuild
new file mode 100644
index 000000000000..21ad23f36df3
--- /dev/null
+++ b/sys-libs/rvm/rvm-1.12.ebuild
@@ -0,0 +1,24 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+DESCRIPTION="Recoverable Virtual Memory (used by Coda)"
+HOMEPAGE="http://www.coda.cs.cmu.edu/"
+SRC_URI="http://www.coda.cs.cmu.edu/pub/rvm/src/${P}.tar.gz"
+IUSE=""
+SLOT="1"
+LICENSE="LGPL-2.1"
+KEYWORDS="~alpha ~amd64 ~hppa ia64 ~mips ~ppc ~sparc x86"
+
+DEPEND=">=sys-libs/lwp-2.0
+ sys-apps/grep
+ sys-devel/libtool
+ sys-devel/gcc"
+
+RDEPEND=">=sys-libs/lwp-2.0"
+
+src_install() {
+ make DESTDIR="${D}" install || die
+
+ dodoc NEWS
+}
diff --git a/sys-libs/rvm/rvm-1.16.ebuild b/sys-libs/rvm/rvm-1.16.ebuild
new file mode 100644
index 000000000000..da76ae6c2022
--- /dev/null
+++ b/sys-libs/rvm/rvm-1.16.ebuild
@@ -0,0 +1,24 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+DESCRIPTION="Recoverable Virtual Memory (used by Coda)"
+HOMEPAGE="http://www.coda.cs.cmu.edu/"
+SRC_URI="http://www.coda.cs.cmu.edu/pub/rvm/src/${P}.tar.gz"
+IUSE=""
+SLOT="1"
+LICENSE="LGPL-2.1"
+KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~mips ~ppc ~sparc ~x86"
+
+DEPEND=">=sys-libs/lwp-2.0
+ sys-apps/grep
+ sys-devel/libtool
+ sys-devel/gcc"
+
+RDEPEND=">=sys-libs/lwp-2.0"
+
+src_install() {
+ make DESTDIR="${D}" install || die
+
+ dodoc NEWS
+}
diff --git a/sys-libs/rvm/rvm-1.17.ebuild b/sys-libs/rvm/rvm-1.17.ebuild
new file mode 100644
index 000000000000..32ea4bb63d67
--- /dev/null
+++ b/sys-libs/rvm/rvm-1.17.ebuild
@@ -0,0 +1,23 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="2"
+
+DESCRIPTION="Recoverable Virtual Memory (used by Coda)"
+HOMEPAGE="http://www.coda.cs.cmu.edu/"
+SRC_URI="http://www.coda.cs.cmu.edu/pub/rvm/src/${P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="1"
+KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~mips ~ppc ~sparc ~x86"
+IUSE=""
+
+RDEPEND=">=sys-libs/lwp-2.5"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+src_install() {
+ emake DESTDIR="${D}" install || die
+ dodoc NEWS
+}
diff --git a/sys-libs/slang/Manifest b/sys-libs/slang/Manifest
new file mode 100644
index 000000000000..ab09b3dcf716
--- /dev/null
+++ b/sys-libs/slang/Manifest
@@ -0,0 +1,2 @@
+DIST slang-2.2.4.tar.bz2 1427363 SHA256 9a8257a9a2a55099af858b13338dc8f3a06dd2069f46f0df2c9c3bb84a01d5db SHA512 aaf0dcea5f1583487732098bd9dfe47f4fd968d81783955f58ed7bbffb852c217cde8999f2a515d77c22d44efc79047fc841eea6fecc48f18b402461ce6a848f WHIRLPOOL 5a0c81ef103116733df952fec8593f476bd57c9b2799ee566b0bf93dfd465709ef5f565a369d89a92bfd13cfc7577a047c46116bcac2f0b3176e50556c7484e1
+DIST slang-2.3.0.tar.bz2 1532986 SHA256 f95224060f45e0d8212a5039b339afa5f1a94a1bb0298e796104e5b12e926129 SHA512 0b04d916409c59f66301877c078bcca63c8b71e5dfa6c1d804353e41949bca16e664a79381c4156068b1f878c333e618f1de165e4059b09831fa83a794613050 WHIRLPOOL 395dc36d2f571ed19d88ee1f1c3594ab50d3a955949724d46582191430aa0c23cf3f78f966b184f3220ab86f2939e4601821160455159783793df30597c53257
diff --git a/sys-libs/slang/files/slang-2.1.3-uclibc.patch b/sys-libs/slang/files/slang-2.1.3-uclibc.patch
new file mode 100644
index 000000000000..d7ed5a8d650f
--- /dev/null
+++ b/sys-libs/slang/files/slang-2.1.3-uclibc.patch
@@ -0,0 +1,12 @@
+diff -ur slang-2.1.3.orig/src/slcommon.c slang-2.1.3/src/slcommon.c
+--- slang-2.1.3.orig/src/slcommon.c 2007-01-10 18:09:07.000000000 +0200
++++ slang-2.1.3/src/slcommon.c 2008-03-19 16:09:09.000000000 +0200
+@@ -191,7 +191,7 @@
+ return p;
+ }
+
+-#if !defined(HAVE_ISSETUGID) && defined(__GLIBC__) && (__GLIBC__ >= 2)
++#if !defined(HAVE_ISSETUGID) && defined(__GLIBC__) && (__GLIBC__ >= 2) && !defined(__UCLIBC__)
+ extern int __libc_enable_secure;
+ # define HAVE___LIBC_ENABLE_SECURE 1
+ #endif
diff --git a/sys-libs/slang/files/slang-2.2.3-slsh-libs.patch b/sys-libs/slang/files/slang-2.2.3-slsh-libs.patch
new file mode 100644
index 000000000000..2c999fb184d3
--- /dev/null
+++ b/sys-libs/slang/files/slang-2.2.3-slsh-libs.patch
@@ -0,0 +1,11 @@
+--- slsh/Makefile.in
++++ slsh/Makefile.in
+@@ -80,7 +80,7 @@
+ $(OBJDIR)/slsh_exe: $(OBJDIR)/slsh.o $(OBJDIR)/readline.o
+ $(CC) $(CFLAGS) $(OBJDIR)/slsh.o $(OBJDIR)/readline.o -o $(OBJDIR)/slsh_exe $(LDFLAGS) $(SRC_LIBS)
+ $(OBJDIR)/slsh: $(OBJDIR)/slsh.o $(OBJDIR)/readline.o
+- $(CC) $(CFLAGS) $(OBJDIR)/slsh.o $(OBJDIR)/readline.o -o $(OBJDIR)/slsh $(LDFLAGS) $(INST_LIBS)
++ $(CC) $(CFLAGS) $(OBJDIR)/slsh.o $(OBJDIR)/readline.o -o $(OBJDIR)/slsh $(LDFLAGS) $(SRC_LIBS)
+ $(OBJDIR)/slsh.o: $(OBJDIR) slsh.c slsh.h config.h Makefile
+ cd $(OBJDIR) && $(CC) -c $(CFLAGS) $(SLANG_SRCINC) $(DEFS) $(SRCDIR)/slsh.c
+ $(OBJDIR)/readline.o: $(OBJDIR) readline.c slsh.h config.h Makefile
diff --git a/sys-libs/slang/files/slang-2.2.4-memset.patch b/sys-libs/slang/files/slang-2.2.4-memset.patch
new file mode 100644
index 000000000000..0be90fdc3091
--- /dev/null
+++ b/sys-libs/slang/files/slang-2.2.4-memset.patch
@@ -0,0 +1,32 @@
+From e06be392e42c23dd9bd7205445f3c5232ddb9ed7 Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <slyfox@gentoo.org>
+Date: Tue, 19 Nov 2013 15:17:52 +0300
+Subject: [PATCH] modules/png-module.c: add declaration of 'memset'
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+ * QA Notice: Package triggers severe warnings which indicate that it
+ * may exhibit random runtime failures.
+ * /tmp/portage/sys-libs/slang-2.2.4/work/slang-2.2.4/modules/png-module.c:122:2: warning: incompatible implicit declaration of built-in function ‘memset’ [enabled by default]
+
+Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+---
+ modules/png-module.c | 1 +
+ 3 files changed, 403 insertions(+), 259 deletions(-)
+
+diff --git a/modules/png-module.c b/modules/png-module.c
+index 92ede3d..fed9392 100644
+--- a/modules/png-module.c
++++ b/modules/png-module.c
+@@ -23,6 +23,7 @@ USA.
+ #include "config.h"
+
+ #include <stdio.h>
++#include <string.h> /* memset() */
+ #include <errno.h>
+ #include <slang.h>
+
+--
+1.8.4
+
diff --git a/sys-libs/slang/metadata.xml b/sys-libs/slang/metadata.xml
new file mode 100644
index 000000000000..aef01fc3d591
--- /dev/null
+++ b/sys-libs/slang/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>cjk</herd>
+</pkgmetadata>
diff --git a/sys-libs/slang/slang-2.2.4-r1.ebuild b/sys-libs/slang/slang-2.2.4-r1.ebuild
new file mode 100644
index 000000000000..d0d15f65a95e
--- /dev/null
+++ b/sys-libs/slang/slang-2.2.4-r1.ebuild
@@ -0,0 +1,74 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils multilib-minimal
+
+DESCRIPTION="A multi-platform programmer's library designed to allow a developer to create robust software"
+HOMEPAGE="http://www.jedsoft.org/slang/"
+SRC_URI="mirror://slang/v${PV%.*}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x86-solaris"
+IUSE="cjk pcre png readline static-libs zlib"
+
+# ncurses for ncurses5-config to get terminfo directory
+RDEPEND="sys-libs/ncurses
+ pcre? ( >=dev-libs/libpcre-8.33-r1[${MULTILIB_USEDEP}] )
+ png? ( >=media-libs/libpng-1.6.10:0[${MULTILIB_USEDEP}] )
+ cjk? ( >=dev-libs/oniguruma-5.9.5[${MULTILIB_USEDEP}] )
+ readline? ( >=sys-libs/readline-6.2_p5-r1:0[${MULTILIB_USEDEP}] )
+ zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<=app-emulation/emul-linux-x86-baselibs-20140406-r1
+ )"
+DEPEND="${RDEPEND}"
+
+MAKEOPTS="${MAKEOPTS} -j1"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2.2.3-slsh-libs.patch
+ epatch "${FILESDIR}"/${PN}-2.2.4-memset.patch
+
+ # avoid linking to -ltermcap race with some systems
+ sed -i -e '/^TERMCAP=/s:=.*:=:' configure || die
+ # we use the GNU linker also on Solaris
+ sed -i -e 's/-G -fPIC/-shared -fPIC/g' \
+ -e 's/-Wl,-h,/-Wl,-soname,/g' configure || die
+
+ # slang does not support configuration from another dir
+ multilib_copy_sources
+}
+
+multilib_src_configure() {
+ local myconf=slang
+ use readline && myconf=gnu
+
+ econf \
+ --with-readline=${myconf} \
+ $(use_with pcre) \
+ $(use_with cjk onig) \
+ $(use_with png) \
+ $(use_with zlib z)
+}
+
+multilib_src_compile() {
+ emake elf $(use static-libs && echo static)
+
+ pushd slsh >/dev/null
+ emake slsh
+ popd
+}
+
+multilib_src_install() {
+ emake DESTDIR="${D}" install $(use static-libs && echo install-static)
+}
+
+multilib_src_install_all() {
+ rm -rf "${ED}"/usr/share/doc/{slang,slsh}
+ dodoc NEWS README *.txt doc/{,internal,text}/*.txt
+ dohtml doc/slangdoc.html slsh/doc/html/*.html
+}
diff --git a/sys-libs/slang/slang-2.2.4.ebuild b/sys-libs/slang/slang-2.2.4.ebuild
new file mode 100644
index 000000000000..c856abb81990
--- /dev/null
+++ b/sys-libs/slang/slang-2.2.4.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+inherit eutils
+
+DESCRIPTION="A multi-platform programmer's library designed to allow a developer to create robust software"
+HOMEPAGE="http://www.jedsoft.org/slang/"
+SRC_URI="mirror://slang/v${PV%.*}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x86-solaris"
+IUSE="cjk pcre png readline static-libs zlib"
+
+# ncurses for ncurses5-config to get terminfo directory
+RDEPEND="sys-libs/ncurses
+ pcre? ( dev-libs/libpcre )
+ png? ( >=media-libs/libpng-1.2:0 )
+ cjk? ( dev-libs/oniguruma )
+ readline? ( sys-libs/readline )
+ zlib? ( sys-libs/zlib )"
+DEPEND="${RDEPEND}"
+
+MAKEOPTS="${MAKEOPTS} -j1"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2.2.3-slsh-libs.patch
+ epatch "${FILESDIR}"/${PN}-2.2.4-memset.patch
+
+ # avoid linking to -ltermcap race with some systems
+ sed -i -e '/^TERMCAP=/s:=.*:=:' configure || die
+ # we use the GNU linker also on Solaris
+ sed -i -e 's/-G -fPIC/-shared -fPIC/g' \
+ -e 's/-Wl,-h,/-Wl,-soname,/g' configure || die
+}
+
+src_configure() {
+ local myconf=slang
+ use readline && myconf=gnu
+
+ econf \
+ --with-readline=${myconf} \
+ $(use_with pcre) \
+ $(use_with cjk onig) \
+ $(use_with png) \
+ $(use_with zlib z)
+}
+
+src_compile() {
+ emake elf $(use static-libs && echo static)
+
+ pushd slsh >/dev/null
+ emake slsh
+ popd
+}
+
+src_install() {
+ emake DESTDIR="${D}" install $(use static-libs && echo install-static)
+
+ rm -rf "${ED}"/usr/share/doc/{slang,slsh}
+
+ dodoc NEWS README *.txt doc/{,internal,text}/*.txt
+ dohtml doc/slangdoc.html slsh/doc/html/*.html
+}
diff --git a/sys-libs/slang/slang-2.3.0.ebuild b/sys-libs/slang/slang-2.3.0.ebuild
new file mode 100644
index 000000000000..496f6ab31f20
--- /dev/null
+++ b/sys-libs/slang/slang-2.3.0.ebuild
@@ -0,0 +1,74 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils multilib-minimal
+
+DESCRIPTION="A multi-platform programmer's library designed to allow a developer to create robust software"
+HOMEPAGE="http://www.jedsoft.org/slang/"
+SRC_URI="http://www.jedsoft.org/releases/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x86-solaris"
+IUSE="cjk pcre png readline static-libs zlib"
+
+# ncurses for ncurses5-config to get terminfo directory
+RDEPEND="sys-libs/ncurses
+ pcre? ( >=dev-libs/libpcre-8.33-r1[${MULTILIB_USEDEP}] )
+ png? ( >=media-libs/libpng-1.6.10:0[${MULTILIB_USEDEP}] )
+ cjk? ( >=dev-libs/oniguruma-5.9.5[${MULTILIB_USEDEP}] )
+ readline? ( >=sys-libs/readline-6.2_p5-r1:0[${MULTILIB_USEDEP}] )
+ zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<=app-emulation/emul-linux-x86-baselibs-20140406-r1
+ )"
+DEPEND="${RDEPEND}"
+
+MAKEOPTS="${MAKEOPTS} -j1"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2.2.3-slsh-libs.patch
+ epatch "${FILESDIR}"/${PN}-2.2.4-memset.patch
+
+ # avoid linking to -ltermcap race with some systems
+ sed -i -e '/^TERMCAP=/s:=.*:=:' configure || die
+ # we use the GNU linker also on Solaris
+ sed -i -e 's/-G -fPIC/-shared -fPIC/g' \
+ -e 's/-Wl,-h,/-Wl,-soname,/g' configure || die
+
+ # slang does not support configuration from another dir
+ multilib_copy_sources
+}
+
+multilib_src_configure() {
+ local myconf=slang
+ use readline && myconf=gnu
+
+ econf \
+ --with-readline=${myconf} \
+ $(use_with pcre) \
+ $(use_with cjk onig) \
+ $(use_with png) \
+ $(use_with zlib z)
+}
+
+multilib_src_compile() {
+ emake elf $(use static-libs && echo static)
+
+ pushd slsh >/dev/null
+ emake slsh
+ popd
+}
+
+multilib_src_install() {
+ emake DESTDIR="${D}" install $(use static-libs && echo install-static)
+}
+
+multilib_src_install_all() {
+ rm -rf "${ED}"/usr/share/doc/{slang,slsh}
+ dodoc NEWS README *.txt doc/{,internal,text}/*.txt
+ dohtml doc/slangdoc.html slsh/doc/html/*.html
+}
diff --git a/sys-libs/suacomp/Manifest b/sys-libs/suacomp/Manifest
new file mode 100644
index 000000000000..913c45f71c67
--- /dev/null
+++ b/sys-libs/suacomp/Manifest
@@ -0,0 +1,2 @@
+DIST suacomp-0.6.13.tar.gz 35838 SHA256 e8f488cec531dd64b797900a10e13c35758fe20bc6ef97c3da538246318afd3f
+DIST suacomp-0.6.14.tar.gz 36712 SHA256 453c64c9c6c7f255a14fa19250696e7f3acc3a72498340b76eb681eb648df1a2
diff --git a/sys-libs/suacomp/files/suacomp-0.6.14-strtoll.patch b/sys-libs/suacomp/files/suacomp-0.6.14-strtoll.patch
new file mode 100644
index 000000000000..16ee7f4e5c41
--- /dev/null
+++ b/sys-libs/suacomp/files/suacomp-0.6.14-strtoll.patch
@@ -0,0 +1,44 @@
+From a498772e5fe942eafe06ed62a00a21c4b99164b5 Mon Sep 17 00:00:00 2001
+From: David Holm <dholmster@gmail.com>
+Date: Fri, 14 Sep 2012 20:57:30 +0200
+Subject: [PATCH] Fixes build issues on SUA 6.0
+
+The prototypes for strto[u]ll.c in SUA 6.0 use C99 and are defined using (u_)quad_t. This will cause compilation to fail since there is a mismatch between stdlib.h and the implementation in suacomp. This change switches to the C99 definition and undefines strto[u]ll in case stdlib.h wants to map them to existing implementations.
+
+https://sourceforge.net/p/suacomp/tickets/1/
+---
+ strtoll.c | 3 ++-
+ strtoull.c | 3 ++-
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/strtoll.c b/strtoll.c
+index 12f9886..c9e34b8 100644
+--- a/strtoll.c
++++ b/strtoll.c
+@@ -9,7 +9,8 @@
+ #include <unistd.h>
+ #include <stdlib.h>
+
+-long long int strtoll(const char* nptr, char** endptr, int base) {
++#undef strtoll
++quad_t strtoll(const char* nptr, char** endptr, int base) {
+ long long int ret;
+ DT("enter: %p, %p, %d\n", nptr, endptr, base);
+
+diff --git a/strtoull.c b/strtoull.c
+index d0e0e67..622ee9b 100644
+--- a/strtoull.c
++++ b/strtoull.c
+@@ -9,7 +9,8 @@
+ #include <unistd.h>
+ #include <stdlib.h>
+
+-long long int strtoull(const char* nptr, char** endptr, int base) {
++#undef strtoull
++u_quad_t strtoull(const char* nptr, char** endptr, int base) {
+ long long int ret;
+ DT("enter: %p, %p, %d\n", nptr, endptr, base);
+
+--
+1.7.6.1
+
diff --git a/sys-libs/suacomp/metadata.xml b/sys-libs/suacomp/metadata.xml
new file mode 100644
index 000000000000..8465ca57d980
--- /dev/null
+++ b/sys-libs/suacomp/metadata.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer>
+ <email>haubi@gentoo.org</email>
+ <name>Michael Haubenwallner</name>
+</maintainer>
+<longdescription lang="en">
+ A small library, trying to overcome the problems occuring when building
+ (and using) gentoo-prefix on an interix based system. This has no use
+ on non-interix systems.
+</longdescription>
+</pkgmetadata>
+
diff --git a/sys-libs/suacomp/suacomp-0.6.13.ebuild b/sys-libs/suacomp/suacomp-0.6.13.ebuild
new file mode 100644
index 000000000000..34dbaf08e663
--- /dev/null
+++ b/sys-libs/suacomp/suacomp-0.6.13.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=3
+
+inherit toolchain-funcs flag-o-matic
+
+DESCRIPTION="library wrapping the interix lib-c to make it less buggy"
+HOMEPAGE="http://suacomp.sf.net"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="BEER-WARE"
+SLOT="0"
+KEYWORDS="-* ~x86-interix"
+IUSE="debug"
+
+DEPEND=""
+RDEPEND=""
+
+get_opts() {
+ local shlibc=
+ local stlibc=
+
+ for dir in /usr/lib /usr/lib/x86; do
+ [[ -f ${dir}/libc.a ]] && stlibc=${dir}/libc.a
+
+ for name in libc.so.5.2 libc.so.3.5; do
+ [[ -f ${dir}/${name} ]] && { shlibc=${dir}/${name}; break; }
+ done
+
+ [[ -f ${shlibc} && -f ${stlibc} ]] && break
+ done
+
+ echo "SHARED_LIBC=${shlibc} STATIC_LIBC=${stlibc}"
+}
+
+pkg_setup() {
+ if use debug; then
+ append-flags -D_DEBUG -D_DEBUG_TRACE
+ fi
+}
+
+src_compile() {
+ emake all CC=$(tc-getCC) $(get_opts) CFLAGS="${CFLAGS}" || die "emake failed"
+}
+
+src_install() {
+ emake install PREFIX="${EPREFIX}/usr" DESTDIR="${D}" $(get_opts) \
+ CFLAGS="${CFLAGS}" || die "emake install failed"
+}
+
+src_test() {
+ local v=
+
+ use debug && v="TEST_VERBOSE=1"
+ use debug && export SUACOMP_DEBUG_OUT=stderr
+
+ emake check $(get_opts) ${v} || die "emake check failed"
+}
diff --git a/sys-libs/suacomp/suacomp-0.6.14.ebuild b/sys-libs/suacomp/suacomp-0.6.14.ebuild
new file mode 100644
index 000000000000..9fe7f79cc5aa
--- /dev/null
+++ b/sys-libs/suacomp/suacomp-0.6.14.ebuild
@@ -0,0 +1,64 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=3
+
+inherit toolchain-funcs flag-o-matic eutils
+
+DESCRIPTION="library wrapping the interix lib-c to make it less buggy"
+HOMEPAGE="http://suacomp.sf.net"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="BEER-WARE"
+SLOT="0"
+KEYWORDS="-* ~x86-interix"
+IUSE="debug"
+
+DEPEND=""
+RDEPEND=""
+
+get_opts() {
+ local shlibc=
+ local stlibc=
+
+ for dir in /usr/lib /usr/lib/x86; do
+ [[ -f ${dir}/libc.a ]] && stlibc=${dir}/libc.a
+
+ for name in libc.so.5.2 libc.so.3.5; do
+ [[ -f ${dir}/${name} ]] && { shlibc=${dir}/${name}; break; }
+ done
+
+ [[ -f ${shlibc} && -f ${stlibc} ]] && break
+ done
+
+ echo "SHARED_LIBC=${shlibc} STATIC_LIBC=${stlibc}"
+}
+
+pkg_setup() {
+ if use debug; then
+ append-flags -D_DEBUG -D_DEBUG_TRACE
+ fi
+}
+
+src_prepare() {
+ [[ ${CHOST} == *-interix6* ]] && epatch "${FILESDIR}"/${P}-strtoll.patch
+}
+
+src_compile() {
+ emake all CC=$(tc-getCC) $(get_opts) CFLAGS="${CFLAGS}" || die "emake failed"
+}
+
+src_install() {
+ emake install PREFIX="${EPREFIX}/usr" DESTDIR="${D}" $(get_opts) \
+ CFLAGS="${CFLAGS}" || die "emake install failed"
+}
+
+src_test() {
+ local v=
+
+ use debug && v="TEST_VERBOSE=1"
+ use debug && export SUACOMP_DEBUG_OUT=stderr
+
+ emake check $(get_opts) ${v} || die "emake check failed"
+}
diff --git a/sys-libs/suacomp/suacomp-9999.ebuild b/sys-libs/suacomp/suacomp-9999.ebuild
new file mode 100644
index 000000000000..6760c43633fd
--- /dev/null
+++ b/sys-libs/suacomp/suacomp-9999.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit toolchain-funcs flag-o-matic git-2
+
+DESCRIPTION="library wrapping the interix lib-c to make it less buggy"
+HOMEPAGE="http://suacomp.sf.net"
+EGIT_REPO_URI="http://git.code.sf.net/p/suacomp/git"
+
+LICENSE="BEER-WARE"
+SLOT="0"
+KEYWORDS=""
+IUSE="debug"
+
+DEPEND=""
+RDEPEND=""
+
+get_opts() {
+ local shlibc=
+ local stlibc=
+
+ for dir in /usr/lib /usr/lib/x86; do
+ [[ -f ${dir}/libc.a ]] && stlibc=${dir}/libc.a
+
+ for name in libc.so.5.2 libc.so.3.5; do
+ [[ -f ${dir}/${name} ]] && { shlibc=${dir}/${name}; break; }
+ done
+
+ [[ -f ${shlibc} && -f ${stlibc} ]] && break
+ done
+
+ echo "SHARED_LIBC=${shlibc} STATIC_LIBC=${stlibc}"
+}
+
+pkg_setup() {
+ if use debug; then
+ append-flags -D_DEBUG -D_DEBUG_TRACE
+ fi
+}
+
+src_compile() {
+ emake all CC=$(tc-getCC) $(get_opts) CFLAGS="${CFLAGS}"
+}
+
+src_install() {
+ emake install PREFIX="${EPREFIX}/usr" DESTDIR="${D}" $(get_opts) \
+ CFLAGS="${CFLAGS}"
+}
+
+src_test() {
+ local v=
+
+ use debug && v="TEST_VERBOSE=1"
+ use debug && export SUACOMP_DEBUG_OUT=stderr
+
+ emake check $(get_opts) ${v}
+}
diff --git a/sys-libs/system-config-base/files/1-r1-pam-0.99.8.0-r2-compat.patch b/sys-libs/system-config-base/files/1-r1-pam-0.99.8.0-r2-compat.patch
new file mode 100644
index 000000000000..821bc7e29f5e
--- /dev/null
+++ b/sys-libs/system-config-base/files/1-r1-pam-0.99.8.0-r2-compat.patch
@@ -0,0 +1,11 @@
+--- config-util.orig 2007-07-14 12:56:13.000000000 -0700
++++ config-util 2007-07-14 12:56:18.000000000 -0700
+@@ -1,8 +1,6 @@
+ #%PAM-1.0
+ auth sufficient pam_rootok.so
+-auth sufficient pam_timestamp.so
+ auth include system-auth
+ account required pam_permit.so
+ session required pam_permit.so
+ session optional pam_xauth.so
+-session optional pam_timestamp.so
diff --git a/sys-libs/system-config-base/files/config-util b/sys-libs/system-config-base/files/config-util
new file mode 100644
index 000000000000..8e70d9aba1da
--- /dev/null
+++ b/sys-libs/system-config-base/files/config-util
@@ -0,0 +1,8 @@
+#%PAM-1.0
+auth sufficient pam_rootok.so
+auth sufficient pam_timestamp.so
+auth include system-auth
+account required pam_permit.so
+session required pam_permit.so
+session optional pam_xauth.so
+session optional pam_timestamp.so
diff --git a/sys-libs/system-config-base/metadata.xml b/sys-libs/system-config-base/metadata.xml
new file mode 100644
index 000000000000..59e2b8f78cb5
--- /dev/null
+++ b/sys-libs/system-config-base/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>maintainer-needed@gentoo.org</email>
+ <name>Default assignee for orphaned packages</name>
+ </maintainer>
+</pkgmetadata>
diff --git a/sys-libs/system-config-base/system-config-base-1-r1.ebuild b/sys-libs/system-config-base/system-config-base-1-r1.ebuild
new file mode 100644
index 000000000000..b824498f3f30
--- /dev/null
+++ b/sys-libs/system-config-base/system-config-base-1-r1.ebuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils pam
+
+DESCRIPTION="system-config-* layout package"
+SRC_URI=""
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE=""
+
+RDEPEND="virtual/pam"
+
+S=${WORKDIR}
+
+src_unpack() {
+ cp "${FILESDIR}"/config-util . || die "failed to copy config-util"
+ epatch "${FILESDIR}"/${PVR}-pam-0.99.8.0-r2-compat.patch
+}
+
+src_install() {
+ dopamd config-util
+}
+
+pkg_postinst() {
+ if [ "$(stat -c%a ${ROOT}etc/default/useradd)" != "644" ] ; then
+ echo
+ ewarn
+ ewarn "Your ${ROOT}etc/default/useradd file must be world-readable"
+ ewarn "for the system-config-* utilities to work properly."
+ ewarn "If you did not change them on purpose, consider running:"
+ ewarn
+ ewarn " chmod 0644 ${ROOT}etc/default/useradd"
+ echo
+ fi
+}
diff --git a/sys-libs/talloc/Manifest b/sys-libs/talloc/Manifest
new file mode 100644
index 000000000000..def8976d0161
--- /dev/null
+++ b/sys-libs/talloc/Manifest
@@ -0,0 +1,3 @@
+DIST talloc-2.1.0.tar.gz 416097 SHA256 0701393882647f823503e3aa075bc67d75c194b376822377dae2d20f9130f08f SHA512 7bdc448c91211299edf16502d263362ac660d5123d8ea7bb2ed58af2231537e4f29da5384b8d5be10254a02b193520890e95a73d697c40eba09728a9b6d56d57 WHIRLPOOL d8593cba27f5d971acb39acacdbea70df5b80ed31288cf440a2ebeaca266e070deeea8322f4ba5682580f66044128f18dd6d76b735aa0670aed46f13f5a4e857
+DIST talloc-2.1.2.tar.gz 423706 SHA256 230d78a3fca75a15ab0f5d76d7bbaeadd3c1e695adcbb085932d227f5c31838d SHA512 9bb3b8a1be663b63c03ec3336de2e4941052012357dacd0f4303ebb0c4d7f84fb7425bece114fda67167624ea417f57b33dfd5a8f373178c044f8270fecd596a WHIRLPOOL 464ead270ef6e315316505eb287eb8c3647d0807ace35a8b8f3fcf9697aeeac85ba652b56a5ae7a58d7eada7d2fd8cb33ee1032b912a7ee83eee74df8eadb349
+DIST talloc-2.1.3.tar.gz 434093 SHA256 7aa5f75b22d4ef9c737b25515f2a2837ddc13014ff4ac6e58dd9e311f41f2cb0 SHA512 4ec350ab5d7e53c8ae816a3d722b10cce75552f1b3d6a31cc7aae13d6c5722d39a126702c8ebb4fa2f6b7908a6501e916e341e2b660080a6c8d22f70171862f6 WHIRLPOOL 143b733e4694b02b2c6319d1ee7017a54c0a60af5202ad764247aada0ada7a6fc95bcf08992dac4ae1396ed45106ad1102f09eece8b0f0304d32d965655c7c86
diff --git a/sys-libs/talloc/metadata.xml b/sys-libs/talloc/metadata.xml
new file mode 100644
index 000000000000..be0176a4cf3b
--- /dev/null
+++ b/sys-libs/talloc/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>samba</herd>
+ <maintainer>
+ <email>patrick@gentoo.org</email>
+ <name>Patrick Lauer</name>
+ </maintainer>
+ <use>
+ <flag name="compat">Enable extra compatibility stuff</flag>
+ </use>
+</pkgmetadata>
diff --git a/sys-libs/talloc/talloc-2.1.0-r1.ebuild b/sys-libs/talloc/talloc-2.1.0-r1.ebuild
new file mode 100644
index 000000000000..79589e989505
--- /dev/null
+++ b/sys-libs/talloc/talloc-2.1.0-r1.ebuild
@@ -0,0 +1,85 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="threads"
+
+inherit waf-utils python-single-r1 multilib multilib-minimal
+
+DESCRIPTION="Samba talloc library"
+HOMEPAGE="http://talloc.samba.org/"
+SRC_URI="http://samba.org/ftp/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-3 LGPL-3+ LGPL-2 BSD"
+SLOT="0"
+KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~x64-macos ~sparc-solaris"
+IUSE="compat +python"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+RDEPEND="python? ( ${PYTHON_DEPS} )
+ !!<sys-libs/talloc-2.0.5
+ abi_x86_32? (
+ !<=app-emulation/emul-linux-x86-baselibs-20140508-r1
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ )"
+DEPEND="${RDEPEND}
+ sys-devel/gettext
+ dev-libs/libxslt
+ ${PYTHON_DEPS}"
+
+WAF_BINARY="${S}/buildtools/bin/waf"
+
+MULTILIB_WRAPPED_HEADERS=(
+ # python goes only for native
+ /usr/include/pytalloc.h
+)
+
+src_prepare() {
+ # what would you expect of waf? i won't even waste time trying.
+ multilib_copy_sources
+}
+
+multilib_src_configure() {
+ local extra_opts=()
+
+ use compat && extra_opts+=( --enable-talloc-compat1 )
+ if ! multilib_is_native_abi || ! use python; then
+ extra_opts+=( --disable-python )
+ fi
+
+ waf-utils_src_configure \
+ "${extra_opts[@]}"
+}
+
+multilib_src_compile() {
+ waf-utils_src_compile
+}
+
+multilib_src_install() {
+ waf-utils_src_install
+
+ # waf is stupid, and no, we can't fix the build-system, since it's provided
+ # as a brilliant binary blob thats decompressed on the fly
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ install_name_tool \
+ -id "${EPREFIX}"/usr/$(get_libdir)/libtalloc.2.dylib \
+ "${ED}"/usr/$(get_libdir)/libtalloc.2.0.5.dylib || die
+ if use python ; then
+ install_name_tool \
+ -id "${EPREFIX}"/usr/$(get_libdir)/libpytalloc-util.2.dylib \
+ "${ED}"/usr/$(get_libdir)/libpytalloc-util.2.0.5.dylib || die
+ install_name_tool \
+ -change "${S}/bin/default/libtalloc.dylib" \
+ "${EPREFIX}"/usr/$(get_libdir)/libtalloc.2.dylib \
+ "${ED}"/usr/$(get_libdir)/libpytalloc-util.2.0.5.dylib || die
+ install_name_tool \
+ -change "${S}/bin/default/libtalloc.dylib" \
+ "${EPREFIX}"/usr/$(get_libdir)/libtalloc.2.dylib \
+ "${ED}"$(python_get_sitedir)/talloc.bundle || die
+ fi
+ fi
+}
diff --git a/sys-libs/talloc/talloc-2.1.2.ebuild b/sys-libs/talloc/talloc-2.1.2.ebuild
new file mode 100644
index 000000000000..a0633c2af256
--- /dev/null
+++ b/sys-libs/talloc/talloc-2.1.2.ebuild
@@ -0,0 +1,85 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="threads"
+
+inherit waf-utils python-single-r1 multilib multilib-minimal
+
+DESCRIPTION="Samba talloc library"
+HOMEPAGE="http://talloc.samba.org/"
+SRC_URI="http://samba.org/ftp/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-3 LGPL-3+ LGPL-2 BSD"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~x64-macos ~sparc-solaris"
+IUSE="compat +python"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+RDEPEND="python? ( ${PYTHON_DEPS} )
+ !!<sys-libs/talloc-2.0.5
+ abi_x86_32? (
+ !<=app-emulation/emul-linux-x86-baselibs-20140508-r1
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ )"
+DEPEND="${RDEPEND}
+ sys-devel/gettext
+ dev-libs/libxslt
+ ${PYTHON_DEPS}"
+
+WAF_BINARY="${S}/buildtools/bin/waf"
+
+MULTILIB_WRAPPED_HEADERS=(
+ # python goes only for native
+ /usr/include/pytalloc.h
+)
+
+src_prepare() {
+ # what would you expect of waf? i won't even waste time trying.
+ multilib_copy_sources
+}
+
+multilib_src_configure() {
+ local extra_opts=()
+
+ use compat && extra_opts+=( --enable-talloc-compat1 )
+ if ! multilib_is_native_abi || ! use python; then
+ extra_opts+=( --disable-python )
+ fi
+
+ waf-utils_src_configure \
+ "${extra_opts[@]}"
+}
+
+multilib_src_compile() {
+ waf-utils_src_compile
+}
+
+multilib_src_install() {
+ waf-utils_src_install
+
+ # waf is stupid, and no, we can't fix the build-system, since it's provided
+ # as a brilliant binary blob thats decompressed on the fly
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ install_name_tool \
+ -id "${EPREFIX}"/usr/$(get_libdir)/libtalloc.2.dylib \
+ "${ED}"/usr/$(get_libdir)/libtalloc.2.0.5.dylib || die
+ if use python ; then
+ install_name_tool \
+ -id "${EPREFIX}"/usr/$(get_libdir)/libpytalloc-util.2.dylib \
+ "${ED}"/usr/$(get_libdir)/libpytalloc-util.2.0.5.dylib || die
+ install_name_tool \
+ -change "${S}/bin/default/libtalloc.dylib" \
+ "${EPREFIX}"/usr/$(get_libdir)/libtalloc.2.dylib \
+ "${ED}"/usr/$(get_libdir)/libpytalloc-util.2.0.5.dylib || die
+ install_name_tool \
+ -change "${S}/bin/default/libtalloc.dylib" \
+ "${EPREFIX}"/usr/$(get_libdir)/libtalloc.2.dylib \
+ "${ED}"$(python_get_sitedir)/talloc.bundle || die
+ fi
+ fi
+}
diff --git a/sys-libs/talloc/talloc-2.1.3.ebuild b/sys-libs/talloc/talloc-2.1.3.ebuild
new file mode 100644
index 000000000000..a0633c2af256
--- /dev/null
+++ b/sys-libs/talloc/talloc-2.1.3.ebuild
@@ -0,0 +1,85 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="threads"
+
+inherit waf-utils python-single-r1 multilib multilib-minimal
+
+DESCRIPTION="Samba talloc library"
+HOMEPAGE="http://talloc.samba.org/"
+SRC_URI="http://samba.org/ftp/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-3 LGPL-3+ LGPL-2 BSD"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~x64-macos ~sparc-solaris"
+IUSE="compat +python"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+RDEPEND="python? ( ${PYTHON_DEPS} )
+ !!<sys-libs/talloc-2.0.5
+ abi_x86_32? (
+ !<=app-emulation/emul-linux-x86-baselibs-20140508-r1
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ )"
+DEPEND="${RDEPEND}
+ sys-devel/gettext
+ dev-libs/libxslt
+ ${PYTHON_DEPS}"
+
+WAF_BINARY="${S}/buildtools/bin/waf"
+
+MULTILIB_WRAPPED_HEADERS=(
+ # python goes only for native
+ /usr/include/pytalloc.h
+)
+
+src_prepare() {
+ # what would you expect of waf? i won't even waste time trying.
+ multilib_copy_sources
+}
+
+multilib_src_configure() {
+ local extra_opts=()
+
+ use compat && extra_opts+=( --enable-talloc-compat1 )
+ if ! multilib_is_native_abi || ! use python; then
+ extra_opts+=( --disable-python )
+ fi
+
+ waf-utils_src_configure \
+ "${extra_opts[@]}"
+}
+
+multilib_src_compile() {
+ waf-utils_src_compile
+}
+
+multilib_src_install() {
+ waf-utils_src_install
+
+ # waf is stupid, and no, we can't fix the build-system, since it's provided
+ # as a brilliant binary blob thats decompressed on the fly
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ install_name_tool \
+ -id "${EPREFIX}"/usr/$(get_libdir)/libtalloc.2.dylib \
+ "${ED}"/usr/$(get_libdir)/libtalloc.2.0.5.dylib || die
+ if use python ; then
+ install_name_tool \
+ -id "${EPREFIX}"/usr/$(get_libdir)/libpytalloc-util.2.dylib \
+ "${ED}"/usr/$(get_libdir)/libpytalloc-util.2.0.5.dylib || die
+ install_name_tool \
+ -change "${S}/bin/default/libtalloc.dylib" \
+ "${EPREFIX}"/usr/$(get_libdir)/libtalloc.2.dylib \
+ "${ED}"/usr/$(get_libdir)/libpytalloc-util.2.0.5.dylib || die
+ install_name_tool \
+ -change "${S}/bin/default/libtalloc.dylib" \
+ "${EPREFIX}"/usr/$(get_libdir)/libtalloc.2.dylib \
+ "${ED}"$(python_get_sitedir)/talloc.bundle || die
+ fi
+ fi
+}
diff --git a/sys-libs/tdb/Manifest b/sys-libs/tdb/Manifest
new file mode 100644
index 000000000000..069eee5b530f
--- /dev/null
+++ b/sys-libs/tdb/Manifest
@@ -0,0 +1,3 @@
+DIST tdb-1.3.0.tar.gz 479096 SHA256 04bee48d405ab7815810575a6e0cb364cc0eea6187b54b18c84e9c18a768ba20 SHA512 b9a66070002879119627bae82d8bafeb52ae336afdc4d97e14a7e4ff78e42c7c516f8349781964c2bfbbcc6949247c5fa9519f936c884151ffff9e121f9f9334 WHIRLPOOL 88da0b12ecdc8746bf627f2e1ce896b1a2b435c1dc34cd5649cd1554aa2cf90fe16014dd31fc45605d6a3dcdf02c3a09b1a43e68527497379734a96a3dd99711
+DIST tdb-1.3.6.tar.gz 490881 SHA256 85d7dd247e58d8b303de542a2bc39a3dff9e5f54dea39a94c1c910cee25a59a5 SHA512 be372865e3b809897d46b3ac134de3569185366a0b608e09836e6e37657ae7d0afdcb6b1d4990fee54d16a004e7e792987f51a974fc44fa4632c695e8b1e9341 WHIRLPOOL f278ab51e2716b0948cb8c802d3380d8ca08a31d414d71168d7e786f0113f8a78fbda39977b8b0f8d0007a50df98f4e19d4c2a4f24b192cf20e67c1c4efa491a
+DIST tdb-1.3.7.tar.gz 493847 SHA256 a64d95ca0cc06a28fed24c6e952aed7660cae04983108735d6bc30b925136412 SHA512 661404df8328a2e7bbb0d7865759e299edafee186f3798c11034c36b2076402a826306007986d6cdd5bf8774d2af7ebf4312a501ca9d9e62a26e504bc13652e4 WHIRLPOOL 92586febe155e87ffadd7cdfd3e83b75d51d41cb3e3e70b886a371f01b1e7c628a02217afff9eb33dadab23849afec18e5c4f78f30def549e629adafa1437479
diff --git a/sys-libs/tdb/files/add_missing_stdbool_h_include.patch b/sys-libs/tdb/files/add_missing_stdbool_h_include.patch
new file mode 100644
index 000000000000..756eaaeebf06
--- /dev/null
+++ b/sys-libs/tdb/files/add_missing_stdbool_h_include.patch
@@ -0,0 +1,27 @@
+From 4e14a437963ba54987cd58b4e0705d9a6d8aea6f Mon Sep 17 00:00:00 2001
+From: Adam Williamson <awilliam@redhat.com>
+Date: Fri, 23 May 2014 10:08:14 -0700
+Subject: [PATCH] tdb/include: include stdbool.h in tdb.h
+
+Commit db5bda56bf08 (tdb: add TDB_MUTEX_LOCKING support) adds a bool, but does
+not include stdbool.h. This causes any build including tdb.h to fail, at least
+for me with GCC 4.9.0.
+---
+ lib/tdb/include/tdb.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/lib/tdb/include/tdb.h b/lib/tdb/include/tdb.h
+index 5ea5e60..03e429c 100644
+--- a/lib/tdb/include/tdb.h
++++ b/lib/tdb/include/tdb.h
+@@ -31,6 +31,7 @@ extern "C" {
+ #endif
+
+ #include <signal.h>
++#include <stdbool.h>
+
+ /**
+ * @defgroup tdb The tdb API
+--
+1.9.3
+
diff --git a/sys-libs/tdb/files/tdb-1.3.7-fix.patch b/sys-libs/tdb/files/tdb-1.3.7-fix.patch
new file mode 100644
index 000000000000..bfbd8ab70a98
--- /dev/null
+++ b/sys-libs/tdb/files/tdb-1.3.7-fix.patch
@@ -0,0 +1,55 @@
+From patchwork Thu Jul 23 05:10:38 2015
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: tdb: Fix broken build with --disable-python
+Date: Thu, 23 Jul 2015 04:10:38 -0000
+From: Martin Schwenke <martin@meltin.net>
+X-Patchwork-Id: 11098
+Message-Id: <20150723151038.617e1c49@martins.ozlabs.org>
+To: Samba Technical <samba-technical@lists.samba.org>
+
+Please NACK if you don't want this pushed... :-)
+
+peace & happiness,
+martin
+
+
+>From c7609c35b6bdb488b74d63ebfd27838b9b8e7e2f Mon Sep 17 00:00:00 2001
+From: Martin Schwenke <martin@meltin.net>
+Date: Thu, 23 Jul 2015 09:47:24 +1000
+Subject: [PATCH] tdb: Fix broken build with --disable-python
+
+With --disable-python, we should not install any python files.
+
+Signed-off-by: Martin Schwenke <martin@meltin.net>
+Reviewed-by: Amitay Isaacs <amitay@gmail.com>
+---
+ lib/tdb/wscript | 11 ++++++-----
+ 1 file changed, 6 insertions(+), 5 deletions(-)
+
+diff --git a/lib/tdb/wscript b/lib/tdb/wscript
+index 5845fa0..1822e74 100644
+--- a/lib/tdb/wscript
++++ b/lib/tdb/wscript
+@@ -187,12 +187,13 @@ def build(bld):
+ realname='tdb.so',
+ cflags='-DPACKAGE_VERSION=\"%s\"' % VERSION)
+
+- for env in bld.gen_python_environments(['PKGCONFIGDIR']):
+- bld.SAMBA_SCRIPT('_tdb_text.py',
+- pattern='_tdb_text.py',
+- installdir='python')
++ if not bld.env.disable_python:
++ for env in bld.gen_python_environments(['PKGCONFIGDIR']):
++ bld.SAMBA_SCRIPT('_tdb_text.py',
++ pattern='_tdb_text.py',
++ installdir='python')
+
+- bld.INSTALL_FILES('${PYTHONARCHDIR}', '_tdb_text.py')
++ bld.INSTALL_FILES('${PYTHONARCHDIR}', '_tdb_text.py')
+
+ def testonly(ctx):
+ '''run tdb testsuite'''
+--
+2.1.4
diff --git a/sys-libs/tdb/metadata.xml b/sys-libs/tdb/metadata.xml
new file mode 100644
index 000000000000..eb993d35b82e
--- /dev/null
+++ b/sys-libs/tdb/metadata.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>samba</herd>
+ <maintainer>
+ <email>patrick@gentoo.org</email>
+ <name>Patrick Lauer</name>
+ </maintainer>
+</pkgmetadata>
diff --git a/sys-libs/tdb/tdb-1.3.0-r1.ebuild b/sys-libs/tdb/tdb-1.3.0-r1.ebuild
new file mode 100644
index 000000000000..b6b6cc847d10
--- /dev/null
+++ b/sys-libs/tdb/tdb-1.3.0-r1.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="threads"
+
+inherit waf-utils multilib-minimal python-single-r1 eutils
+
+DESCRIPTION="A simple database API"
+HOMEPAGE="http://tdb.samba.org/"
+SRC_URI="http://samba.org/ftp/tdb/${P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux"
+IUSE="python"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+RDEPEND="python? ( ${PYTHON_DEPS} )"
+DEPEND="
+ ${RDEPEND}
+ ${PYTHON_DEPS}
+ app-text/docbook-xml-dtd:4.2"
+
+WAF_BINARY="${S}/buildtools/bin/waf"
+
+src_prepare() {
+ epatch "${FILESDIR}/add_missing_stdbool_h_include.patch"
+ python_fix_shebang .
+ multilib_copy_sources
+}
+
+multilib_src_configure() {
+ local extra_opts=()
+ if ! multilib_is_native_abi || ! use python; then
+ extra_opts+=( --disable-python )
+ fi
+
+ waf-utils_src_configure \
+ "${extra_opts[@]}"
+}
+
+multilib_src_compile() {
+ # need to avoid parallel building, this looks like the sanest way with waf-utils/multiprocessing eclasses
+ unset MAKEOPTS
+ waf-utils_src_compile
+}
+
+multilib_src_test() {
+ # the default src_test runs 'make test' and 'make check', letting
+ # the tests fail occasionally (reason: unknown)
+ emake check
+}
+
+multilib_src_install() {
+ waf-utils_src_install
+}
diff --git a/sys-libs/tdb/tdb-1.3.6.ebuild b/sys-libs/tdb/tdb-1.3.6.ebuild
new file mode 100644
index 000000000000..884d02974449
--- /dev/null
+++ b/sys-libs/tdb/tdb-1.3.6.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="threads"
+
+inherit waf-utils multilib-minimal python-single-r1 eutils
+
+DESCRIPTION="A simple database API"
+HOMEPAGE="http://tdb.samba.org/"
+SRC_URI="http://samba.org/ftp/tdb/${P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux"
+IUSE="python"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+RDEPEND="python? ( ${PYTHON_DEPS} )"
+DEPEND="
+ ${RDEPEND}
+ ${PYTHON_DEPS}
+ app-text/docbook-xml-dtd:4.2"
+
+WAF_BINARY="${S}/buildtools/bin/waf"
+
+src_prepare() {
+ python_fix_shebang .
+ multilib_copy_sources
+}
+
+multilib_src_configure() {
+ local extra_opts=()
+ if ! multilib_is_native_abi || ! use python; then
+ extra_opts+=( --disable-python )
+ fi
+
+ waf-utils_src_configure \
+ "${extra_opts[@]}"
+}
+
+multilib_src_compile() {
+ # need to avoid parallel building, this looks like the sanest way with waf-utils/multiprocessing eclasses
+ unset MAKEOPTS
+ waf-utils_src_compile
+}
+
+multilib_src_test() {
+ # the default src_test runs 'make test' and 'make check', letting
+ # the tests fail occasionally (reason: unknown)
+ emake check
+}
+
+multilib_src_install() {
+ waf-utils_src_install
+}
diff --git a/sys-libs/tdb/tdb-1.3.7.ebuild b/sys-libs/tdb/tdb-1.3.7.ebuild
new file mode 100644
index 000000000000..91d4425790fc
--- /dev/null
+++ b/sys-libs/tdb/tdb-1.3.7.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="threads"
+
+inherit waf-utils multilib-minimal python-single-r1 eutils
+
+DESCRIPTION="A simple database API"
+HOMEPAGE="http://tdb.samba.org/"
+SRC_URI="http://samba.org/ftp/tdb/${P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux"
+IUSE="python"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+RDEPEND="python? ( ${PYTHON_DEPS} )"
+DEPEND="
+ ${RDEPEND}
+ ${PYTHON_DEPS}
+ app-text/docbook-xml-dtd:4.2"
+
+WAF_BINARY="${S}/buildtools/bin/waf"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-1.3.7-fix.patch
+ python_fix_shebang .
+ multilib_copy_sources
+}
+
+multilib_src_configure() {
+ local extra_opts=()
+ if ! multilib_is_native_abi || ! use python; then
+ extra_opts+=( --disable-python )
+ fi
+
+ waf-utils_src_configure \
+ "${extra_opts[@]}"
+}
+
+multilib_src_compile() {
+ # need to avoid parallel building, this looks like the sanest way with waf-utils/multiprocessing eclasses
+ unset MAKEOPTS
+ waf-utils_src_compile
+}
+
+multilib_src_test() {
+ # the default src_test runs 'make test' and 'make check', letting
+ # the tests fail occasionally (reason: unknown)
+ emake check
+}
+
+multilib_src_install() {
+ waf-utils_src_install
+}
diff --git a/sys-libs/tevent/Manifest b/sys-libs/tevent/Manifest
new file mode 100644
index 000000000000..34ba208e5dd3
--- /dev/null
+++ b/sys-libs/tevent/Manifest
@@ -0,0 +1,3 @@
+DIST tevent-0.9.21.tar.gz 550606 SHA256 f2be7463573dab2d8210cb57fe7e7e2aeb323274cbdc865a6e29ddcfb977f0f4 SHA512 d1d76402bf32c4da9394ec5e0eb149abefa3f4dc86e5d22529f5cc4f30b1d3071e7a00aac3bd5707532e68dfed5a03dc5a267ea367c8fbe0aaead9df63beafdf WHIRLPOOL 4b4525394cdc06a5ce2535216eea8fdcf44dc0b4ab7964506042df3ee67ce9463d82e9b6be3bdd4cd9983ce92a62e3dfc69c6abf66d30b9b6466e863b2c1d7cd
+DIST tevent-0.9.24.tar.gz 560585 SHA256 4db94cc092611775340891bb138e1c45310638b27fb3c59fb11b5af345973f50 SHA512 38e7757556f6438d06343cd20f9ecad9bc66e3fad461486d56d5bba9d5cdb0738deeaf8735dd0f7cf364bb94007a757207e8c0c115452253a864eca3ee1ebab1 WHIRLPOOL 2f3dcddfd2f03e25fc456620cb9b22a74995951f7ce91953012af05824d1ee6d4c441c7da9423ba3b81f8d57f053fbd049d13ad472cbc2f4a923425625ec7fda
+DIST tevent-0.9.25.tar.gz 573357 SHA256 fedeb0d55a11b3593b562ec09b32e44bd67619ed10e5fa10d1868adb1649c669 SHA512 5cc477bf7a67b2a80c5d663a8382c0006395b17396f5e7ac44ed24b40b58b8a498497b08ed050a2ea838140ad36d60ad3256552c60b3339bf307244f9de4704e WHIRLPOOL 359557ed7cfa3046a141c2a263fea5382576f7554636a1f13b1ba102650d6f8222ac5fa478db4e81fcc31bec01157cd701a8580e635c5ba1823307e45e692b56
diff --git a/sys-libs/tevent/metadata.xml b/sys-libs/tevent/metadata.xml
new file mode 100644
index 000000000000..e06ba379b734
--- /dev/null
+++ b/sys-libs/tevent/metadata.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>samba</herd>
+ <maintainer>
+ <email>patrick@gentoo.org</email>
+ <name>Patrick Lauer</name>
+ </maintainer>
+</pkgmetadata>
diff --git a/sys-libs/tevent/tevent-0.9.21-r1.ebuild b/sys-libs/tevent/tevent-0.9.21-r1.ebuild
new file mode 100644
index 000000000000..d1fadd3a934d
--- /dev/null
+++ b/sys-libs/tevent/tevent-0.9.21-r1.ebuild
@@ -0,0 +1,55 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="threads(+)"
+
+inherit waf-utils multilib-minimal python-single-r1
+
+DESCRIPTION="Samba tevent library"
+HOMEPAGE="http://tevent.samba.org/"
+SRC_URI="http://samba.org/ftp/tevent/${P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-fbsd ~x86-fbsd ~arm-linux ~x86-linux"
+IUSE="python"
+
+RDEPEND=">=sys-libs/talloc-2.1.0[python?,${MULTILIB_USEDEP}]
+ python? ( ${PYTHON_DEPS} )"
+
+DEPEND="${RDEPEND}
+ >=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]
+ ${PYTHON_DEPS}
+"
+# build system does not work with python3
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+WAF_BINARY="${S}/buildtools/bin/waf"
+
+pkg_setup() {
+ python-single-r1_pkg_setup
+}
+
+src_prepare() {
+ multilib_copy_sources
+}
+
+multilib_src_configure() {
+ waf-utils_src_configure \
+ $(multilib_native_usex python '' '--disable-python')
+}
+
+multilib_src_compile() {
+ # need to avoid parallel building, this looks like the sanest way with waf-utils/multiprocessing eclasses
+ unset MAKEOPTS
+ waf-utils_src_compile
+}
+
+multilib_src_install() {
+ waf-utils_src_install
+
+ multilib_is_native_abi && use python && python_domodule tevent.py
+}
diff --git a/sys-libs/tevent/tevent-0.9.24.ebuild b/sys-libs/tevent/tevent-0.9.24.ebuild
new file mode 100644
index 000000000000..fc89ca11bd84
--- /dev/null
+++ b/sys-libs/tevent/tevent-0.9.24.ebuild
@@ -0,0 +1,55 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="threads(+)"
+
+inherit waf-utils multilib-minimal python-single-r1
+
+DESCRIPTION="Samba tevent library"
+HOMEPAGE="http://tevent.samba.org/"
+SRC_URI="http://samba.org/ftp/tevent/${P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~arm-linux ~x86-linux"
+IUSE="python"
+
+RDEPEND=">=sys-libs/talloc-2.1.1[${MULTILIB_USEDEP}]
+ python? ( ${PYTHON_DEPS} )"
+
+DEPEND="${RDEPEND}
+ >=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]
+ ${PYTHON_DEPS}
+"
+# build system does not work with python3
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+WAF_BINARY="${S}/buildtools/bin/waf"
+
+pkg_setup() {
+ python-single-r1_pkg_setup
+}
+
+src_prepare() {
+ multilib_copy_sources
+}
+
+multilib_src_configure() {
+ waf-utils_src_configure \
+ $(multilib_native_usex python '' '--disable-python')
+}
+
+multilib_src_compile() {
+ # need to avoid parallel building, this looks like the sanest way with waf-utils/multiprocessing eclasses
+ unset MAKEOPTS
+ waf-utils_src_compile
+}
+
+multilib_src_install() {
+ waf-utils_src_install
+
+ multilib_is_native_abi && use python && python_domodule tevent.py
+}
diff --git a/sys-libs/tevent/tevent-0.9.25.ebuild b/sys-libs/tevent/tevent-0.9.25.ebuild
new file mode 100644
index 000000000000..f4ba223c7bac
--- /dev/null
+++ b/sys-libs/tevent/tevent-0.9.25.ebuild
@@ -0,0 +1,55 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="threads(+)"
+
+inherit waf-utils multilib-minimal python-single-r1
+
+DESCRIPTION="Samba tevent library"
+HOMEPAGE="http://tevent.samba.org/"
+SRC_URI="http://samba.org/ftp/tevent/${P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~arm-linux ~x86-linux"
+IUSE="python"
+
+RDEPEND=">=sys-libs/talloc-2.1.2[${MULTILIB_USEDEP}]
+ python? ( ${PYTHON_DEPS} )"
+
+DEPEND="${RDEPEND}
+ >=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]
+ ${PYTHON_DEPS}
+"
+# build system does not work with python3
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+WAF_BINARY="${S}/buildtools/bin/waf"
+
+pkg_setup() {
+ python-single-r1_pkg_setup
+}
+
+src_prepare() {
+ multilib_copy_sources
+}
+
+multilib_src_configure() {
+ waf-utils_src_configure \
+ $(multilib_native_usex python '' '--disable-python')
+}
+
+multilib_src_compile() {
+ # need to avoid parallel building, this looks like the sanest way with waf-utils/multiprocessing eclasses
+ unset MAKEOPTS
+ waf-utils_src_compile
+}
+
+multilib_src_install() {
+ waf-utils_src_install
+
+ multilib_is_native_abi && use python && python_domodule tevent.py
+}
diff --git a/sys-libs/timezone-data/Manifest b/sys-libs/timezone-data/Manifest
new file mode 100644
index 000000000000..caa035779eb6
--- /dev/null
+++ b/sys-libs/timezone-data/Manifest
@@ -0,0 +1,18 @@
+DIST tzcode2012j.tar.gz 134654 SHA256 ee4361b3b4ae201a270857c84d0f063c2a2191b3e4cd7414ea4622bb8bae9a82 SHA512 a0182438fedb1d855b52c0734f52bfd4dd3707d65c6f347833d5a68aab132a68f2b77a0e182d7ecfe7c58185245d7181ab01da909c2fdc84b71150c3090382c2 WHIRLPOOL 430e7320976e184753364d034f16109713a350ec0828d864be2f30ce6d29dd403d8f9c25866f828c664f0324f57ad72197fd752ba343f316d80d7c11a1ebdee6
+DIST tzcode2013i.tar.gz 173169 SHA256 63bba6790afc1cb2ea0af2b998a35fc237e247608140dbe4e08b4216a8c31358 SHA512 863d181339d8b44ae9876a02e436da33b723f81e592a0e0f51f1300a2dac277bc18ed422b8631e27032769620323c94c848f3abc926d8bc28074d3d4b4bb8a28 WHIRLPOOL 9de16a388ac7a1e7965b1aaed4461657a2f822a08fe6c8c5f025bdad6512b53ef0ea6960ef03bc372df3541f9c8588797cd1e2b2dcecb10afb9041965b3684a1
+DIST tzcode2014i.tar.gz 181815 SHA256 62591075fb0d47459889b71bac3c8487f09b7417b81dfa541d750b4889e84783 SHA512 ed780815a1e209616c791997f14da56cb9311c6585b70c503b32a11e8ec15e0dc04c37bdeaa5a1a1378ada714935a2d931679d0aa4ab42808d185b600e5d0582 WHIRLPOOL ba5bdf8117b64eda76dc559dd211fa83ee0662792a93004fd696b3d8463da2046d91a0cb45b88656230ac935b528b5cd3e8ce9a460c5e27fdb0b4a19ddadb666
+DIST tzcode2014j.tar.gz 182416 SHA256 7fd46125464856309fc81fe85a67a61de862b8ab884ce8ca82051f5fa308ede2 SHA512 1207670c168a80fe9db86307028efa3af8ca304817ebe36df5b5c2d2b67deba4294f05f4d6afa04220c3b255ad1903e2850bfb0649b2edfb2d754345a4b2490a WHIRLPOOL 87275670bc5eeaa634ea7cc858e0c52e61e69640d89a98119d42bf087f26b65216146749648c1347dca0924776e9f6f914ba85aac19c5a3e581ad329fb85de84
+DIST tzcode2015a.tar.gz 182993 SHA256 885bab11f286852f34030d7a86ede7d4126319ca74b8ee22be8ca7c17d72dd19 SHA512 80d3bd3aeb70e21552a599c6203670fe742ca8d270c3fc430a3045d8e8a6610ebfe74941532c0791d5a99d6e4bf5fbdf62918de57d377d3fd26e7f7f786c66a4 WHIRLPOOL de4d9ea9611cc47e71f6e64fc4b0f6c45e5b3c995268d6244ed58fdc9b5e6d896c0e3ce1299e04ae018681523dc1e57f2dfcd0fb7f03423a93282123eb8a0376
+DIST tzcode2015b.tar.gz 183630 SHA256 e668f1235b998c90e43ecc93c8535728c65bb01d6bb93d22467e04b5ffa35d76 SHA512 d9b56c8ec98d9158d10cf80df0181864c467a4387b8ced5701f466c40885ea524bc1d49b0e17c0a18d8006a423da1c1b9a7e74626c4a916dd37cbb85e04b2b0a WHIRLPOOL 9e57737318d00470a6315cda75ed0cc3b4bb7f57de4c60b0d3b527be12164ec7c390f285dde23102c764e2ff6b9473d2e4762642f7a3e716e746bcacb931eaad
+DIST tzcode2015c.tar.gz 184278 SHA256 7feeb1a60dff8b179c884f6e3aa7684606f4eaeb7f7ecc61a6bb81e3e38af42e SHA512 01f57e27c1031434e7da8876f30084dfef9dbe36988539c857f71f86c0ab1995f82c9fe5dad32ded12185c53433b7f1a0553d8848a2d97529981021ffd70dfb1 WHIRLPOOL b2dff9985ad6845ad368a35e471890e99c69f03cf6d92da9d0da362af1d0545e30485a7be1ca159444d49c148c2f1588b8fa3fd1161859cfa566365fb45ba341
+DIST tzcode2015d.tar.gz 184178 SHA256 221af54ec5c42eaf0101159ffe1256a883d1c14c46228d42774c656a56317128 SHA512 2cb4faced839d02e6313a7aacca4d2dfe6454186d9864ee4aa034f7280442e6a751cec2285bde2d5712962b733e107a46f2282469f6510b42d93972d6c34424a WHIRLPOOL d5760e6530f65a4aac86258cbec62b27c86952d0f5896fbc1f567af6aef025e453f455ba94805069706981ecd4806a22e09581dd38cfba18f892343eb2038e3d
+DIST tzcode2015e.tar.gz 185129 SHA256 b5a217b55847fb56f470a7738939c36f3a520d6cc12342d965cfcf848e59ada0 SHA512 fdc568a68f4876b967b39e21fa53f063dc5756e886e2a273cc046d5a014eb517e9c91eb6e03d18c94a89ce48578868aed710790415c500188fce4e4add0ce7ca WHIRLPOOL d3fde26e0b0ebe98d7de0c2a666a79dd6020e471b647de2b61a89dc1eeba61e8928c7dcb2e1b15d867e8e81b5e33321a288a2b94e713deaf5579e00b6082e7b8
+DIST tzdata2012j.tar.gz 214075 SHA256 4b6a3c2831bdbb68ab1a1bf906bcf11d18ab78009713a0339da6fe96b6afceaa SHA512 98515b92268a2ee49386f6955211c14b9fe47460ba1c3ec5d60681b1a934688c3de4452f8f757ca3a6924e15784585967c768e7c86be730378d0332c249584fe WHIRLPOOL 17af29d05587bea2b05762751d146101a8bcc647346aa22a33e06a095805ecf4feab62693b3216ba5d75cf87f8a63d8cbcee9167be4b6dfe7936e1828bbc4b8a
+DIST tzdata2013i.tar.gz 218866 SHA256 1cd56a6ee964143ef0c65229968a5093988335b95e9115235b5e7b7e45e67dda SHA512 679645837b940c0d4c63cb070e26c042461a520caa5fbe1ed12897a6bfb5c440352d54a9e1ffb8b7098a10dd9e2f33cf4c6f9cb0b6fc84c0dfc3898501ce4082 WHIRLPOOL f5c559b8bd3869e2f90792079329582d26d3e95f744543c40b5c3aa6429390a39e04697d68151730019e60cfa3c6fe6b4f8d3d3e79b6b4bed28dc4e81cffa9ce
+DIST tzdata2014i.tar.gz 289312 SHA256 2af331bdd2b794ec59b8ded7300fb29dc3573a009ec14183f5c9ad38e3886153 SHA512 d8893703cebfa337254a6cfb26b0c0083533922016d51dcb56c0cbc46ff7fb76d83e4e1359eec3a7728b4ebffd24e912117ac1f7425a150cad4d33e20033c40e WHIRLPOOL ca2fb6f470ff975168124ee30c2f4638ce9f0a68b0d999e451c19d328c0df438f6934b458b48e7d05a724445e7fc5c3e1ca5adbcc97e1998f88983630f132e43
+DIST tzdata2014j.tar.gz 290688 SHA256 a2d870320694d40535df822ac8074dc629a90e92abafa5d3373314f78ddc0e0d SHA512 4c2979be3a96f91f8576304ec905d571b73df0842c8300c1d7317819b45ab3e29948ed911aa265b12a4ad587d5cba44f646dd02e40e4fbf9e68556a2d327142e WHIRLPOOL adf3fc77aae18dccf05e3c990052fc2cb735a2c91bf9e93136cb45862e6f283e706beaa79373354817662a8b17449000a58760cb8f95fa78de88690207014a3e
+DIST tzdata2015a.tar.gz 292131 SHA256 c52490917d00a8e7fc9b5f0b1b65ef6ec76d612b5b20c81bf86a04147af18e4c SHA512 ff36feb437238ba42fe67257e81ade0a2179d11f6c6449146e28e4b6553c62348b4131af75e440b4467109c9edba13e25ddaf701f2fcebb2a258b4ac9b57293c WHIRLPOOL 22d42c60e87948c691255282aea9e4c9d69b46db8c19ef1c06a262b5e6054e45fec39c5fa8d1dc24ad121ed70bd3dfa24ea61fe97961938b733262238d74b5bb
+DIST tzdata2015b.tar.gz 293482 SHA256 556ac1a5b3a371adc1ad4e77138f78ddd7f8ddd7bc2b52545924598c7dc8ad62 SHA512 767782b87e62a8f7a4dbcae595d16a54197c9e04ca974d7016d11f90ebaf2537b804d111f204af9052c68d4670afe0af0af9e5b150867a357fc199bb541368d0 WHIRLPOOL e6d7bd671dd17c44b9d51744bda2283b42d5e4b9b673e693976af2f52f2a03a9571d6604a30b88701ed11f69a3a797429c72274126c0f45e5a4b9637b589a632
+DIST tzdata2015c.tar.gz 294353 SHA256 860fac5f5f57f7a2dfc1ba682dbd1f5c0f0b597f761571277b6ed6561e22365a SHA512 ca89c2041c8420e7b154660e227211b60ba20e8d70b6870b5c0a149838c588d13065202b1266c59caf22a99df2387da95ac04049b9ecb7939cd406c7f007a73e WHIRLPOOL e5806b47d3082b260837c675ac267a99ec45549070c66b5cbd6a51b7fe57802a555bfd54918093e83447089d965fe2459c5e9c6ea12c333080add280b012182f
+DIST tzdata2015d.tar.gz 296131 SHA256 8b9f5008277f09e251e97dba7813f56168d691115bda90ade4638d72f296d531 SHA512 37b5aa3c5e0d601c8b20fac08d7267c398a836e4190ef85625d5e86a806ba1baceb2315ba81a9a6c854eae4fce40e9c8f90cf5adade3f48ad443f77c221d8983 WHIRLPOOL c42972f20c8815557a9545f73bf3ff3b10a0148168a229641cb8e436da8ec337c5fc968acacfbd4d5beeae0fb183c5b6d54fe4240539352a9c3ce2b2f2318824
+DIST tzdata2015e.tar.gz 296773 SHA256 ffc9b5d38abda8277aa479e3f75aa7668819d0977cd1a0c8ef3b09128334ba6f SHA512 86498190a20c5c67827aa75f7e9c6aa6c19d58a88a70425ce70d5ae7cea42dc7386eb2867fa455fcfcdedc6a105ad70fbbdc7c27c7a58a51bd21d76a135983ce WHIRLPOOL aaf2f2009f451beaf178d1ee622ebacdd04f1795e07a606b61620cac8faf74a63e1ea3f75ef58b846a6093922cba9df764ed1929e70d1f0be5181fdc25901282
diff --git a/sys-libs/timezone-data/files/timezone-data-2008h-makefile.patch b/sys-libs/timezone-data/files/timezone-data-2008h-makefile.patch
new file mode 100644
index 000000000000..70f43c35f2d6
--- /dev/null
+++ b/sys-libs/timezone-data/files/timezone-data-2008h-makefile.patch
@@ -0,0 +1,138 @@
+ - Fix up default paths
+ - Support env DESTDIR / LDFLAGS / CFLAGS / CC
+ - Use awk instead of nawk
+ - Don't build/install libtz.a
+ - Don't install man-pages provided by sys-apps/man-pages
+ - Move zic zdump to sbin and tzselect to bin ala glibc
+ - Install posix zoneinfo into zoneinfo/posix/ instead of zoneinfo-posix/ ala glibc
+ - Install leaps zoneinfo into zoneinfo/right/ ala glibc
+ - Disable broken web test
+ - Make sure tzselect uses #!/bin/bash and not #!/bin/ksh
+ - Flags to the linking are passed as LDFLAGS, not LFLAGS
+ - LDFLAGS was missed for the 'date' target
+
+--- Makefile
++++ Makefile
+@@ -35,5 +35,5 @@
+ # Everything gets put in subdirectories of. . .
+
+-TOPDIR= /usr/local
++TOPDIR= $(DESTDIR)/usr
+
+ # "Compiled" time zone information is placed in the "TZDIR" directory
+@@ -41,9 +41,9 @@
+ # Use an absolute path name for TZDIR unless you're just testing the software.
+
+-TZDIR= $(TOPDIR)/etc/zoneinfo
++TZDIR= $(TOPDIR)/share/zoneinfo
+
+ # The "tzselect", "zic", and "zdump" commands get installed in. . .
+
+-ETCDIR= $(TOPDIR)/etc
++SBINDIR= $(TOPDIR)/sbin
+
+ # If you "make INSTALL", the "date" command gets installed in. . .
+@@ -53,5 +53,5 @@
+ # Manual pages go in subdirectories of. . .
+
+-MANDIR= $(TOPDIR)/man
++MANDIR= $(TOPDIR)/share/man
+
+ # Library functions are put in an archive in LIBDIR.
+@@ -211,5 +211,5 @@
+ # falls on a Friday, Saturday, or Sunday.
+
+-CFLAGS=
++CFLAGS += -std=gnu99
+
+ # If you want zic's -s option used when installing, uncomment the next line
+@@ -220,5 +220,5 @@
+
+ # The name of a Posix-compliant `awk' on your system.
+-AWK= nawk
++AWK= awk
+
+ # The path where SGML DTDs are kept.
+@@ -241,8 +241,10 @@
+
+ ###############################################################################
+
+-cc= cc
+-CC= $(cc) -DTZDIR=\"$(TZDIR)\"
++CC+= -DTZDIR=\"$(TZDIR)\"
++ifeq ($(NLS),1)
++CC += -DHAVE_GETTEXT=1 -DTZ_DOMAIN=\"libc\"
++endif
+
+ TZCSRCS= zic.c localtime.c asctime.c scheck.c ialloc.c
+ TZCOBJS= zic.o localtime.o asctime.o scheck.o ialloc.o
+@@ -281,11 +281,13 @@
+ ALL: all date
+
+-install: all $(DATA) $(REDO) $(TZLIB) $(MANS) $(TABDATA)
++install: all $(DATA) $(REDO) $(MANS) $(TABDATA)
+ $(ZIC) -y $(YEARISTYPE) \
+ -d $(TZDIR) -l $(LOCALTIME) -p $(POSIXRULES)
+ -rm -f $(TZDIR)/iso3166.tab $(TZDIR)/zone.tab
+ cp iso3166.tab zone.tab $(TZDIR)/.
+- -mkdir $(TOPDIR) $(ETCDIR)
+- cp tzselect zic zdump $(ETCDIR)/.
++ -mkdir $(TOPDIR) $(SBINDIR)
++ cp zic zdump $(SBINDIR)/.
++ -mkdir $(TOPDIR) $(BINDIR)
++ cp tzselect $(BINDIR)/.
+ -mkdir $(TOPDIR) $(MANDIR) \
+ $(MANDIR)/man3 $(MANDIR)/man5 $(MANDIR)/man8
+@@ -297,6 +299,4 @@
+ $(MANDIR)/man8/zic.8
+ cp newctime.3 newtzset.3 $(MANDIR)/man3/.
+- cp tzfile.5 $(MANDIR)/man5/.
+- cp tzselect.8 zdump.8 zic.8 $(MANDIR)/man8/.
+
+ INSTALL: ALL install date.1
+@@ -309,10 +309,10 @@
+ cp date.1 $(MANDIR)/man1/.
+
+ zdump: $(TZDOBJS)
+- $(CC) $(CFLAGS) $(LFLAGS) $(TZDOBJS) $(LDLIBS) -o $@
++ $(CC) $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS) -o $@
+
+ zic: $(TZCOBJS) yearistype
+- $(CC) $(CFLAGS) $(LFLAGS) $(TZCOBJS) $(LDLIBS) -o $@
++ $(CC) $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS) -o $@
+
+ yearistype: yearistype.sh
+ cp yearistype.sh yearistype
+@@ -333,7 +333,7 @@
+ # to using them, or vice versa.
+ other_two: zic leapseconds $(TDATA)
+- $(ZIC) -y $(YEARISTYPE) -d $(TZDIR)-posix -L /dev/null $(TDATA)
++ $(ZIC) -y $(YEARISTYPE) -d $(TZDIR)/posix -L /dev/null $(TDATA)
+ $(ZIC) -y $(YEARISTYPE) \
+- -d $(TZDIR)-leaps -L leapseconds $(TDATA)
++ -d $(TZDIR)/right -L leapseconds $(TDATA)
+
+ posix_right: posix_only other_two
+@@ -351,7 +351,7 @@
+ then ranlib $@ ; fi
+
+ date: $(DATEOBJS)
+- $(CC) $(CFLAGS) date.o localtime.o asctime.o strftime.o \
++ $(CC) $(CFLAGS) $(LDFLAGS) date.o localtime.o asctime.o strftime.o \
+ $(LDLIBS) -lc -o $@
+
+ tzselect: tzselect.ksh
+@@ -366,5 +366,5 @@
+ chmod +x $@
+
+-check: check_tables check_web
++check: check_tables
+
+ check_tables: checktab.awk $(PRIMARY_YDATA)
+--- tzselect.ksh
++++ tzselect.ksh
+@@ -1,3 +1,3 @@
+-#! /bin/ksh
++#! /bin/bash
+
+ # '@(#)tzselect.ksh 1.8'
diff --git a/sys-libs/timezone-data/files/timezone-data-2012a-makefile.patch b/sys-libs/timezone-data/files/timezone-data-2012a-makefile.patch
new file mode 100644
index 000000000000..38e10dd7f0f9
--- /dev/null
+++ b/sys-libs/timezone-data/files/timezone-data-2012a-makefile.patch
@@ -0,0 +1,138 @@
+ - Fix up default paths
+ - Support env DESTDIR / LDFLAGS / CFLAGS / CC
+ - Use awk instead of nawk
+ - Don't build/install libtz.a
+ - Don't install man-pages provided by sys-apps/man-pages
+ - Move zic zdump to sbin and tzselect to bin ala glibc
+ - Install posix zoneinfo into zoneinfo/posix/ instead of zoneinfo-posix/ ala glibc
+ - Install leaps zoneinfo into zoneinfo/right/ ala glibc
+ - Disable broken web test
+ - Make sure tzselect uses #!/bin/bash and not #!/bin/ksh
+ - Flags to the linking are passed as LDFLAGS, not LFLAGS
+ - LDFLAGS was missed for the 'date' target
+
+--- Makefile
++++ Makefile
+@@ -35,5 +35,5 @@
+ # Everything gets put in subdirectories of. . .
+
+-TOPDIR= /usr/local
++TOPDIR= $(DESTDIR)/usr
+
+ # "Compiled" time zone information is placed in the "TZDIR" directory
+@@ -41,9 +41,8 @@
+
+-# TZDIR= $(TOPDIR)/etc/zoneinfo
+-TZDIR= /home/kre/src/tz/data/TZ
++TZDIR= $(TOPDIR)/share/zoneinfo
+
+ # The "tzselect", "zic", and "zdump" commands get installed in. . .
+
+-ETCDIR= $(TOPDIR)/etc
++SBINDIR= $(TOPDIR)/sbin
+
+ # If you "make INSTALL", the "date" command gets installed in. . .
+@@ -53,5 +53,5 @@
+ # Manual pages go in subdirectories of. . .
+
+-MANDIR= $(TOPDIR)/man
++MANDIR= $(TOPDIR)/share/man
+
+ # Library functions are put in an archive in LIBDIR.
+@@ -211,5 +211,5 @@
+ # falls on a Friday, Saturday, or Sunday.
+
+-CFLAGS= -DSTD_INSPIRED
++CFLAGS += -DSTD_INSPIRED -std=gnu99
+
+ # If you want zic's -s option used when installing, uncomment the next line
+@@ -220,5 +220,5 @@
+
+ # The name of a Posix-compliant `awk' on your system.
+-AWK= nawk
++AWK= awk
+
+ # The path where SGML DTDs are kept.
+@@ -241,8 +241,10 @@
+
+ ###############################################################################
+
+-cc= cc
+-CC= $(cc) -DTZDIR=\"$(TZDIR)\"
++CC+= -DTZDIR=\"$(TZDIR)\"
++ifeq ($(NLS),1)
++CC += -DHAVE_GETTEXT=1 -DTZ_DOMAIN=\"libc\"
++endif
+
+ TZCSRCS= zic.c localtime.c asctime.c scheck.c ialloc.c
+ TZCOBJS= zic.o localtime.o asctime.o scheck.o ialloc.o
+@@ -281,11 +281,13 @@
+ ALL: all date
+
+-install: all $(DATA) $(REDO) $(TZLIB) $(MANS) $(TABDATA)
++install: all $(DATA) $(REDO) $(MANS) $(TABDATA)
+ $(ZIC) -y $(YEARISTYPE) \
+ -d $(TZDIR) -l $(LOCALTIME) -p $(POSIXRULES)
+ -rm -f $(TZDIR)/iso3166.tab $(TZDIR)/zone.tab
+ cp iso3166.tab zone.tab $(TZDIR)/.
+- -mkdir $(TOPDIR) $(ETCDIR)
+- cp tzselect zic zdump $(ETCDIR)/.
++ -mkdir $(TOPDIR) $(SBINDIR)
++ cp zic zdump $(SBINDIR)/.
++ -mkdir $(TOPDIR) $(BINDIR)
++ cp tzselect $(BINDIR)/.
+ -mkdir $(TOPDIR) $(MANDIR) \
+ $(MANDIR)/man3 $(MANDIR)/man5 $(MANDIR)/man8
+@@ -297,6 +299,4 @@
+ $(MANDIR)/man8/zic.8
+ cp newctime.3 newtzset.3 $(MANDIR)/man3/.
+- cp tzfile.5 $(MANDIR)/man5/.
+- cp tzselect.8 zdump.8 zic.8 $(MANDIR)/man8/.
+
+ INSTALL: ALL install date.1
+@@ -309,10 +309,10 @@
+ cp date.1 $(MANDIR)/man1/.
+
+ zdump: $(TZDOBJS)
+- $(CC) $(CFLAGS) $(LFLAGS) $(TZDOBJS) $(LDLIBS) -o $@
++ $(CC) $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS) -o $@
+
+ zic: $(TZCOBJS) yearistype
+- $(CC) $(CFLAGS) $(LFLAGS) $(TZCOBJS) $(LDLIBS) -o $@
++ $(CC) $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS) -o $@
+
+ yearistype: yearistype.sh
+ cp yearistype.sh yearistype
+@@ -333,7 +333,7 @@
+ # to using them, or vice versa.
+ other_two: zic leapseconds $(TDATA)
+- $(ZIC) -y $(YEARISTYPE) -d $(TZDIR)-posix -L /dev/null $(TDATA)
++ $(ZIC) -y $(YEARISTYPE) -d $(TZDIR)/posix -L /dev/null $(TDATA)
+ $(ZIC) -y $(YEARISTYPE) \
+- -d $(TZDIR)-leaps -L leapseconds $(TDATA)
++ -d $(TZDIR)/right -L leapseconds $(TDATA)
+
+ posix_right: posix_only other_two
+@@ -351,7 +351,7 @@
+ then ranlib $@ ; fi
+
+ date: $(DATEOBJS)
+- $(CC) $(CFLAGS) date.o localtime.o asctime.o strftime.o \
++ $(CC) $(CFLAGS) $(LDFLAGS) date.o localtime.o asctime.o strftime.o \
+ $(LDLIBS) -lc -o $@
+
+ tzselect: tzselect.ksh
+@@ -366,5 +366,5 @@
+ chmod +x $@
+
+-check: check_tables check_web
++check: check_tables
+
+ check_tables: checktab.awk $(PRIMARY_YDATA)
+--- tzselect.ksh
++++ tzselect.ksh
+@@ -1,3 +1,3 @@
+-#! /bin/ksh
++#! /bin/bash
+
+ # '@(#)tzselect.ksh 1.8'
diff --git a/sys-libs/timezone-data/files/timezone-data-2012i-makefile.patch b/sys-libs/timezone-data/files/timezone-data-2012i-makefile.patch
new file mode 100644
index 000000000000..383492dcce0f
--- /dev/null
+++ b/sys-libs/timezone-data/files/timezone-data-2012i-makefile.patch
@@ -0,0 +1,95 @@
+ - Fix up default paths
+ - Support env DESTDIR / LDFLAGS / CFLAGS / CC
+ - Use awk instead of nawk
+ - Don't build/install libtz.a
+ - Don't install man-pages provided by sys-apps/man-pages
+ - Move zic zdump to sbin and tzselect to bin ala glibc
+ - Install posix zoneinfo into zoneinfo/posix/ instead of zoneinfo-posix/ ala glibc
+ - Install leaps zoneinfo into zoneinfo/right/ ala glibc
+ - Disable broken web test
+ - Make sure tzselect uses #!/bin/bash and not #!/bin/ksh
+ - Flags to the linking are passed as LDFLAGS, not LFLAGS
+ - LDFLAGS was missed for the 'date' target
+
+--- Makefile
++++ Makefile
+@@ -35,5 +35,5 @@
+ # Everything gets put in subdirectories of. . .
+
+-TOPDIR= /usr/local
++TOPDIR= $(DESTDIR)/usr
+
+ # "Compiled" time zone information is placed in the "TZDIR" directory
+@@ -41,9 +41,9 @@
+ # Use an absolute path name for TZDIR unless you're just testing the software.
+
+-TZDIR= $(TOPDIR)/etc/zoneinfo
++TZDIR= $(TOPDIR)/share/zoneinfo
+
+ # The "tzselect", "zic", and "zdump" commands get installed in. . .
+
+-ETCDIR= $(TOPDIR)/etc
++SBINDIR= $(TOPDIR)/sbin
+
+ # If you "make INSTALL", the "date" command gets installed in. . .
+@@ -53,5 +53,5 @@
+ # Manual pages go in subdirectories of. . .
+
+-MANDIR= $(TOPDIR)/man
++MANDIR= $(TOPDIR)/share/man
+
+ # Library functions are put in an archive in LIBDIR.
+@@ -241,8 +241,10 @@
+
+ ###############################################################################
+
+-cc= cc
+-CC= $(cc) -DTZDIR=\"$(TZDIR)\"
++CC+= -DTZDIR=\"$(TZDIR)\"
++ifeq ($(NLS),1)
++CC += -DHAVE_GETTEXT=1 -DTZ_DOMAIN=\"libc\"
++endif
+
+ TZCSRCS= zic.c localtime.c asctime.c scheck.c ialloc.c
+ TZCOBJS= zic.o localtime.o asctime.o scheck.o ialloc.o
+@@ -281,11 +281,13 @@
+ ALL: all date
+
+-install: all $(DATA) $(REDO) $(TZLIB) $(MANS) $(TABDATA)
++install: all $(DATA) $(REDO) $(MANS) $(TABDATA)
+ $(ZIC) -y $(YEARISTYPE) \
+ -d $(TZDIR) -l $(LOCALTIME) -p $(POSIXRULES)
+ -rm -f $(TZDIR)/iso3166.tab $(TZDIR)/zone.tab
+ cp iso3166.tab zone.tab $(TZDIR)/.
+- -mkdir $(TOPDIR) $(ETCDIR)
+- cp tzselect zic zdump $(ETCDIR)/.
++ -mkdir $(TOPDIR) $(SBINDIR)
++ cp zic zdump $(SBINDIR)/.
++ -mkdir $(TOPDIR) $(BINDIR)
++ cp tzselect $(BINDIR)/.
+ -mkdir $(TOPDIR) $(MANDIR) \
+ $(MANDIR)/man3 $(MANDIR)/man5 $(MANDIR)/man8
+@@ -297,6 +299,4 @@
+ $(MANDIR)/man8/zic.8
+ cp newctime.3 newtzset.3 $(MANDIR)/man3/.
+- cp tzfile.5 $(MANDIR)/man5/.
+- cp tzselect.8 zdump.8 zic.8 $(MANDIR)/man8/.
+
+ INSTALL: ALL install date.1
+@@ -333,7 +333,7 @@
+ # to using them, or vice versa.
+ other_two: zic leapseconds $(TDATA)
+- $(ZIC) -y $(YEARISTYPE) -d $(TZDIR)-posix -L /dev/null $(TDATA)
++ $(ZIC) -y $(YEARISTYPE) -d $(TZDIR)/posix -L /dev/null $(TDATA)
+ $(ZIC) -y $(YEARISTYPE) \
+- -d $(TZDIR)-leaps -L leapseconds $(TDATA)
++ -d $(TZDIR)/right -L leapseconds $(TDATA)
+
+ posix_right: posix_only other_two
+@@ -366,5 +366,5 @@
+ chmod +x $@
+
+-check: check_tables check_web
++check: check_tables
+
+ check_tables: checktab.awk $(PRIMARY_YDATA)
diff --git a/sys-libs/timezone-data/files/timezone-data-2013a-makefile.patch b/sys-libs/timezone-data/files/timezone-data-2013a-makefile.patch
new file mode 100644
index 000000000000..b3bbcf54186f
--- /dev/null
+++ b/sys-libs/timezone-data/files/timezone-data-2013a-makefile.patch
@@ -0,0 +1,95 @@
+ - Fix up default paths
+ - Support env DESTDIR / LDFLAGS / CFLAGS / CC
+ - Use awk instead of nawk
+ - Don't build/install libtz.a
+ - Don't install man-pages provided by sys-apps/man-pages
+ - Move zic zdump to sbin and tzselect to bin ala glibc
+ - Install posix zoneinfo into zoneinfo/posix/ instead of zoneinfo-posix/ ala glibc
+ - Install leaps zoneinfo into zoneinfo/right/ ala glibc
+ - Disable broken web test
+ - Make sure tzselect uses #!/bin/bash and not #!/bin/ksh
+ - Flags to the linking are passed as LDFLAGS, not LFLAGS
+ - LDFLAGS was missed for the 'date' target
+
+--- Makefile
++++ Makefile
+@@ -35,5 +35,5 @@
+ # Everything gets put in subdirectories of. . .
+
+-TOPDIR= /usr/local
++TOPDIR= $(DESTDIR)/usr
+
+ # "Compiled" time zone information is placed in the "TZDIR" directory
+@@ -41,9 +41,9 @@
+ # Use an absolute path name for TZDIR unless you're just testing the software.
+
+-TZDIR= $(TOPDIR)/etc/zoneinfo
++TZDIR= $(TOPDIR)/share/zoneinfo
+
+ # The "tzselect", "zic", and "zdump" commands get installed in. . .
+
+-ETCDIR= $(TOPDIR)/etc
++SBINDIR= $(TOPDIR)/sbin
+
+ # If you "make INSTALL", the "date" command gets installed in. . .
+@@ -53,5 +53,5 @@
+ # Manual pages go in subdirectories of. . .
+
+-MANDIR= $(TOPDIR)/man
++MANDIR= $(TOPDIR)/share/man
+
+ # Library functions are put in an archive in LIBDIR.
+@@ -241,8 +241,10 @@
+
+ ###############################################################################
+
+-cc= cc
+-CC= $(cc) -DTZDIR=\"$(TZDIR)\"
++CC+= -DTZDIR=\"$(TZDIR)\"
++ifeq ($(NLS),1)
++CC += -DHAVE_GETTEXT=1 -DTZ_DOMAIN=\"libc\"
++endif
+
+ TZCSRCS= zic.c localtime.c asctime.c scheck.c ialloc.c
+ TZCOBJS= zic.o localtime.o asctime.o scheck.o ialloc.o
+@@ -281,11 +281,13 @@
+ ALL: all date
+
+-install: all $(DATA) $(REDO) $(TZLIB) $(MANS) $(TABDATA)
++install: all $(DATA) $(REDO) $(MANS) $(TABDATA)
+ $(ZIC) -y $(YEARISTYPE) \
+ -d $(TZDIR) -l $(LOCALTIME) -p $(POSIXRULES)
+ -rm -f $(TZDIR)/iso3166.tab $(TZDIR)/zone.tab
+ cp iso3166.tab zone.tab $(TZDIR)/.
+- -mkdir $(TOPDIR) $(ETCDIR)
+- cp tzselect zic zdump $(ETCDIR)/.
++ -mkdir $(TOPDIR) $(SBINDIR)
++ cp zic zdump $(SBINDIR)/.
++ -mkdir $(TOPDIR) $(BINDIR)
++ cp tzselect $(BINDIR)/.
+ -mkdir $(TOPDIR) $(MANDIR) \
+ $(MANDIR)/man3 $(MANDIR)/man5 $(MANDIR)/man8
+@@ -297,6 +299,4 @@
+ $(MANDIR)/man8/zic.8
+ cp newctime.3 newtzset.3 $(MANDIR)/man3/.
+- cp tzfile.5 $(MANDIR)/man5/.
+- cp tzselect.8 zdump.8 zic.8 $(MANDIR)/man8/.
+
+ INSTALL: ALL install date.1
+@@ -333,7 +333,7 @@
+ # to using them, or vice versa.
+ other_two: zic leapseconds $(TDATA)
+- $(ZIC) -y $(YEARISTYPE) -d $(TZDIR)-posix -L /dev/null $(TDATA)
++ $(ZIC) -y $(YEARISTYPE) -d $(TZDIR)/posix -L /dev/null $(TDATA)
+ $(ZIC) -y $(YEARISTYPE) \
+- -d $(TZDIR)-leaps -L leapseconds $(TDATA)
++ -d $(TZDIR)/right -L leapseconds $(TDATA)
+
+ posix_right: posix_only other_two
+@@ -366,5 +366,5 @@
+ chmod +x $@
+
+-check: check_character_set check_tables check_web
++check: check_character_set check_tables
+
+ check_tables: checktab.awk $(PRIMARY_YDATA)
diff --git a/sys-libs/timezone-data/files/timezone-data-2013d-makefile.patch b/sys-libs/timezone-data/files/timezone-data-2013d-makefile.patch
new file mode 100644
index 000000000000..eb52f87f600d
--- /dev/null
+++ b/sys-libs/timezone-data/files/timezone-data-2013d-makefile.patch
@@ -0,0 +1,95 @@
+ - Fix up default paths
+ - Support env DESTDIR / LDFLAGS / CFLAGS / CC
+ - Use awk instead of nawk
+ - Don't build/install libtz.a
+ - Don't install man-pages provided by sys-apps/man-pages
+ - Move zic zdump to sbin and tzselect to bin ala glibc
+ - Install posix zoneinfo into zoneinfo/posix/ instead of zoneinfo-posix/ ala glibc
+ - Install leaps zoneinfo into zoneinfo/right/ ala glibc
+ - Disable broken web test
+ - Make sure tzselect uses #!/bin/bash and not #!/bin/ksh
+ - Flags to the linking are passed as LDFLAGS, not LFLAGS
+ - LDFLAGS was missed for the 'date' target
+
+--- a/Makefile
++++ b/Makefile
+@@ -46,5 +46,5 @@
+ # Everything gets put in subdirectories of. . .
+
+-TOPDIR= /usr/local
++TOPDIR= $(DESTDIR)/usr
+
+ # "Compiled" time zone information is placed in the "TZDIR" directory
+@@ -52,5 +52,5 @@
+ # Use an absolute path name for TZDIR unless you're just testing the software.
+
+-TZDIR= $(TOPDIR)/etc/zoneinfo
++TZDIR= $(TOPDIR)/share/zoneinfo
+
+ # Types to try, as an alternative to time_t. int64_t should be first.
+@@ -59,5 +59,5 @@
+ # The "tzselect", "zic", and "zdump" commands get installed in. . .
+
+-ETCDIR= $(TOPDIR)/etc
++SBINDIR= $(TOPDIR)/sbin
+
+ # If you "make INSTALL", the "date" command gets installed in. . .
+@@ -67,5 +67,5 @@
+ # Manual pages go in subdirectories of. . .
+
+-MANDIR= $(TOPDIR)/man
++MANDIR= $(TOPDIR)/share/man
+
+ # Library functions are put in an archive in LIBDIR.
+@@ -293,6 +293,8 @@
+ ###############################################################################
+
+-cc= cc
+-CC= $(cc) -DTZDIR=\"$(TZDIR)\"
++CC+= -DTZDIR=\"$(TZDIR)\"
++ifeq ($(NLS),1)
++CC += -DHAVE_GETTEXT=1 -DTZ_DOMAIN=\"libc\"
++endif
+
+ TZCSRCS= zic.c localtime.c asctime.c scheck.c ialloc.c
+@@ -335,11 +337,13 @@
+ ALL: all date
+
+-install: all $(DATA) $(REDO) $(TZLIB) $(MANS) $(TABDATA)
++install: all $(DATA) $(REDO) $(MANS) $(TABDATA)
+ $(ZIC) -y $(YEARISTYPE) \
+ -d $(TZDIR) -l $(LOCALTIME) -p $(POSIXRULES)
+ -rm -f $(TZDIR)/iso3166.tab $(TZDIR)/zone.tab
+ cp iso3166.tab zone.tab $(TZDIR)/.
+- -mkdir $(TOPDIR) $(ETCDIR)
+- cp tzselect zic zdump $(ETCDIR)/.
++ -mkdir $(TOPDIR) $(SBINDIR)
++ cp zic zdump $(SBINDIR)/.
++ -mkdir $(TOPDIR) $(BINDIR)
++ cp tzselect $(BINDIR)/.
+ -mkdir $(TOPDIR) $(MANDIR) \
+ $(MANDIR)/man3 $(MANDIR)/man5 $(MANDIR)/man8
+@@ -351,6 +355,4 @@
+ $(MANDIR)/man8/zic.8
+ cp newctime.3 newtzset.3 $(MANDIR)/man3/.
+- cp tzfile.5 $(MANDIR)/man5/.
+- cp tzselect.8 zdump.8 zic.8 $(MANDIR)/man8/.
+
+ INSTALL: ALL install date.1
+@@ -392,7 +394,7 @@
+ # to using them, or vice versa.
+ other_two: zic leapseconds $(TDATA)
+- $(ZIC) -y $(YEARISTYPE) -d $(TZDIR)-posix -L /dev/null $(TDATA)
++ $(ZIC) -y $(YEARISTYPE) -d $(TZDIR)/posix -L /dev/null $(TDATA)
+ $(ZIC) -y $(YEARISTYPE) \
+- -d $(TZDIR)-leaps -L leapseconds $(TDATA)
++ -d $(TZDIR)/right -L leapseconds $(TDATA)
+
+ posix_right: posix_only other_two
+@@ -422,5 +424,5 @@
+ chmod +x $@
+
+-check: check_character_set check_tables check_web
++check: check_character_set check_tables
+
+ check_character_set: $(ENCHILADA)
diff --git a/sys-libs/timezone-data/files/timezone-data-2013f-makefile.patch b/sys-libs/timezone-data/files/timezone-data-2013f-makefile.patch
new file mode 100644
index 000000000000..f496098f3048
--- /dev/null
+++ b/sys-libs/timezone-data/files/timezone-data-2013f-makefile.patch
@@ -0,0 +1,119 @@
+ - Fix up default paths
+ - Support env CC
+ - Don't build/install libtz.a
+ - Don't install man-pages provided by sys-apps/man-pages
+ - Move zic, zdump to sbin and tzselect to bin ala glibc
+ - Install posix zoneinfo into zoneinfo/posix/ instead of zoneinfo-posix/ ala glibc
+ - Install leaps zoneinfo into zoneinfo/right/ ala glibc
+
+--- a/Makefile
++++ b/Makefile
+@@ -45,21 +45,21 @@
+
+ # Everything gets put in subdirectories of. . .
+
+-TOPDIR= /usr/local
++TOPDIR= /usr
+
+ # "Compiled" time zone information is placed in the "TZDIR" directory
+ # (and subdirectories).
+ # Use an absolute path name for TZDIR unless you're just testing the software.
+
+ TZDIR_BASENAME= zoneinfo
+-TZDIR= $(TOPDIR)/etc/$(TZDIR_BASENAME)
++TZDIR= $(TOPDIR)/share/$(TZDIR_BASENAME)
+
+ # Types to try, as an alternative to time_t. int64_t should be first.
+ TIME_T_ALTERNATIVES= int64_t int32_t uint32_t uint64_t
+
+ # The "tzselect", "zic", and "zdump" commands get installed in. . .
+
+-ETCDIR= $(TOPDIR)/etc
++SBINDIR= $(TOPDIR)/sbin
+
+ # If you "make INSTALL", the "date" command gets installed in. . .
+
+@@ -67,7 +67,7 @@
+
+ # Manual pages go in subdirectories of. . .
+
+-MANDIR= $(TOPDIR)/man
++MANDIR= $(TOPDIR)/share/man
+
+ # Library functions are put in an archive in LIBDIR.
+
+@@ -294,8 +294,10 @@
+
+ ###############################################################################
+
+-cc= cc
+-CC= $(cc) -DTZDIR=\"$(TZDIR)\"
++CC+= -DTZDIR=\"$(TZDIR)\"
++ifeq ($(NLS),1)
++CC+= -DHAVE_GETTEXT=1 -DTZ_DOMAIN=\"libc\"
++endif
+
+ TZCSRCS= zic.c localtime.c asctime.c scheck.c ialloc.c
+ TZCOBJS= zic.o localtime.o asctime.o scheck.o ialloc.o
+@@ -338,14 +340,16 @@
+
+ ALL: all date
+
+-install: all $(DATA) $(REDO) $(DESTDIR)$(TZLIB) $(MANS)
++install: all $(DATA) $(REDO) $(MANS)
+ $(ZIC) -y $(YEARISTYPE) \
+ -d $(DESTDIR)$(TZDIR) -l $(LOCALTIME) -p $(POSIXRULES)
+ -rm -f $(DESTDIR)$(TZDIR)/iso3166.tab \
+ $(DESTDIR)$(TZDIR)/zone.tab
+ cp iso3166.tab zone.tab $(DESTDIR)$(TZDIR)/.
+- -mkdir $(DESTDIR)$(TOPDIR) $(DESTDIR)$(ETCDIR)
+- cp tzselect zic zdump $(DESTDIR)$(ETCDIR)/.
++ -mkdir $(DESTDIR)$(TOPDIR) $(DESTDIR)$(SBINDIR)
++ cp zic zdump $(DESTDIR)$(SBINDIR)/.
++ -mkdir $(DESTDIR)$(TOPDIR) $(DESTDIR)$(BINDIR)
++ cp tzselect $(DESTDIR)$(BINDIR)/.
+ -mkdir $(DESTDIR)$(TOPDIR) $(DESTDIR)$(MANDIR) \
+ $(DESTDIR)$(MANDIR)/man3 $(DESTDIR)$(MANDIR)/man5 \
+ $(DESTDIR)$(MANDIR)/man8
+@@ -356,8 +360,6 @@
+ $(DESTDIR)$(MANDIR)/man8/zdump.8 \
+ $(DESTDIR)$(MANDIR)/man8/zic.8
+ cp newctime.3 newtzset.3 $(DESTDIR)$(MANDIR)/man3/.
+- cp tzfile.5 $(DESTDIR)$(MANDIR)/man5/.
+- cp tzselect.8 zdump.8 zic.8 $(DESTDIR)$(MANDIR)/man8/.
+
+ INSTALL: ALL install date.1
+ -mkdir $(DESTDIR)$(TOPDIR) $(DESTDIR)$(BINDIR)
+@@ -405,17 +407,17 @@
+ right_posix: right_only leapseconds
+ rm -fr $(DESTDIR)$(TZDIR)-leaps
+- ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-leaps || \
++ ln -s . $(DESTDIR)$(TZDIR)/right || \
+- $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \
++ $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)/right \
+ -L leapseconds $(TDATA)
+- $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \
++ $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)/posix \
+ -L /dev/null $(TDATA)
+
+ posix_right: posix_only leapseconds
+ rm -fr $(DESTDIR)$(TZDIR)-posix
+- ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-posix || \
++ ln -s . $(DESTDIR)$(TZDIR)/posix || \
+- $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \
++ $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)/posix \
+ -L /dev/null $(TDATA)
+- $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \
++ $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)/right \
+ -L leapseconds $(TDATA)
+
+ zones: $(REDO)
+@@ -442,7 +442,7 @@
+ <$? >$@
+ chmod +x $@
+
+-check: check_character_set check_tables check_web
++check: check_character_set check_tables
+
+ check_character_set: $(ENCHILADA)
+ sharp='#'; ! grep -n $(INVALID_CHAR) $(ENCHILADA)
diff --git a/sys-libs/timezone-data/files/timezone-data-2013h-makefile.patch b/sys-libs/timezone-data/files/timezone-data-2013h-makefile.patch
new file mode 100644
index 000000000000..01335c901371
--- /dev/null
+++ b/sys-libs/timezone-data/files/timezone-data-2013h-makefile.patch
@@ -0,0 +1,112 @@
+ - Fix up default paths
+ - Support env CC
+ - Don't build/install libtz.a
+ - Don't install man-pages provided by sys-apps/man-pages
+ - Move zic, zdump to sbin and tzselect to bin ala glibc
+ - Install posix zoneinfo into zoneinfo/posix/ instead of zoneinfo-posix/ ala glibc
+ - Install leaps zoneinfo into zoneinfo/right/ ala glibc
+
+--- a/Makefile
++++ b/Makefile
+@@ -45,21 +45,21 @@ POSIXRULES= America/New_York
+
+ # Everything gets put in subdirectories of. . .
+
+-TOPDIR= /usr/local
++TOPDIR= /usr
+
+ # "Compiled" time zone information is placed in the "TZDIR" directory
+ # (and subdirectories).
+ # Use an absolute path name for TZDIR unless you're just testing the software.
+
+ TZDIR_BASENAME= zoneinfo
+-TZDIR= $(TOPDIR)/etc/$(TZDIR_BASENAME)
++TZDIR= $(TOPDIR)/share/$(TZDIR_BASENAME)
+
+ # Types to try, as an alternative to time_t. int64_t should be first.
+ TIME_T_ALTERNATIVES= int64_t int32_t uint32_t uint64_t
+
+ # The "tzselect", "zic", and "zdump" commands get installed in. . .
+
+-ETCDIR= $(TOPDIR)/etc
++SBINDIR= $(TOPDIR)/sbin
+
+ # If you "make INSTALL", the "date" command gets installed in. . .
+
+@@ -67,7 +67,7 @@ BINDIR= $(TOPDIR)/bin
+
+ # Manual pages go in subdirectories of. . .
+
+-MANDIR= $(TOPDIR)/man
++MANDIR= $(TOPDIR)/share/man
+
+ # Library functions are put in an archive in LIBDIR.
+
+@@ -298,8 +298,10 @@ GZIPFLAGS= -9n
+
+ ###############################################################################
+
+-cc= cc
+-CC= $(cc) -DTZDIR=\"$(TZDIR)\"
++CC+= -DTZDIR=\"$(TZDIR)\"
++ifeq ($(NLS),1)
++CC+= -DHAVE_GETTEXT=1 -DTZ_DOMAIN=\"libc\"
++endif
+
+ AR= ar
+
+@@ -352,17 +354,14 @@ ALL: all date
+ install: all $(DATA) $(REDO) $(MANS)
+ mkdir -p $(DESTDIR)$(ETCDIR) $(DESTDIR)$(TZDIR) \
+- $(DESTDIR)$(LIBDIR) \
++ $(DESTDIR)$(SBINDIR) $(DESTDIR)$(BINDIR) \
+ $(DESTDIR)$(MANDIR)/man3 $(DESTDIR)$(MANDIR)/man5 \
+ $(DESTDIR)$(MANDIR)/man8
+ $(ZIC) -y $(YEARISTYPE) \
+ -d $(DESTDIR)$(TZDIR) -l $(LOCALTIME) -p $(POSIXRULES)
+ cp -f iso3166.tab zone.tab $(DESTDIR)$(TZDIR)/.
+- cp tzselect zic zdump $(DESTDIR)$(ETCDIR)/.
++ cp zic zdump $(DESTDIR)$(SBINDIR)/.
++ cp tzselect $(DESTDIR)$(BINDIR)/.
+- cp libtz.a $(DESTDIR)$(LIBDIR)/.
+- $(RANLIB) $(DESTDIR)$(LIBDIR)/libtz.a
+ cp -f newctime.3 newtzset.3 $(DESTDIR)$(MANDIR)/man3/.
+- cp -f tzfile.5 $(DESTDIR)$(MANDIR)/man5/.
+- cp -f tzselect.8 zdump.8 zic.8 $(DESTDIR)$(MANDIR)/man8/.
+
+ INSTALL: ALL install date.1
+ mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1
+@@ -406,18 +408,18 @@ right_only: zic leapseconds $(TDATA)
+ # to using them, or vice versa.
+ right_posix: right_only leapseconds
+ rm -fr $(DESTDIR)$(TZDIR)-leaps
+- ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-leaps || \
+- $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \
++ ln -s . $(DESTDIR)$(TZDIR)/right || \
++ $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)/right \
+ -L leapseconds $(TDATA)
+- $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \
++ $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)/posix \
+ -L /dev/null $(TDATA)
+
+ posix_right: posix_only leapseconds
+ rm -fr $(DESTDIR)$(TZDIR)-posix
+- ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-posix || \
+- $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \
++ ln -s . $(DESTDIR)$(TZDIR)/posix || \
++ $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)/posix \
+ -L /dev/null $(TDATA)
+- $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \
++ $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)/right \
+ -L leapseconds $(TDATA)
+
+ zones: $(REDO)
+@@ -440,7 +442,7 @@ tzselect: tzselect.ksh
+ <$? >$@
+ chmod +x $@
+
+-check: check_character_set check_tables check_web
++check: check_character_set check_tables
+
+ check_character_set: $(ENCHILADA)
+ sharp='#'; ! grep -n $(INVALID_CHAR) $(ENCHILADA)
diff --git a/sys-libs/timezone-data/files/timezone-data-2014f-makefile.patch b/sys-libs/timezone-data/files/timezone-data-2014f-makefile.patch
new file mode 100644
index 000000000000..7f9efc8f5f38
--- /dev/null
+++ b/sys-libs/timezone-data/files/timezone-data-2014f-makefile.patch
@@ -0,0 +1,112 @@
+ - Fix up default paths
+ - Support env CC
+ - Don't build/install libtz.a
+ - Don't install man-pages provided by sys-apps/man-pages
+ - Move zic, zdump to sbin and tzselect to bin ala glibc
+ - Install posix zoneinfo into zoneinfo/posix/ instead of zoneinfo-posix/ ala glibc
+ - Install leaps zoneinfo into zoneinfo/right/ ala glibc
+
+--- a/Makefile
++++ b/Makefile
+@@ -45,21 +45,21 @@ POSIXRULES= America/New_York
+
+ # Everything gets put in subdirectories of. . .
+
+-TOPDIR= /usr/local
++TOPDIR= /usr
+
+ # "Compiled" time zone information is placed in the "TZDIR" directory
+ # (and subdirectories).
+ # Use an absolute path name for TZDIR unless you're just testing the software.
+
+ TZDIR_BASENAME= zoneinfo
+-TZDIR= $(TOPDIR)/etc/$(TZDIR_BASENAME)
++TZDIR= $(TOPDIR)/share/$(TZDIR_BASENAME)
+
+ # Types to try, as an alternative to time_t. int64_t should be first.
+ TIME_T_ALTERNATIVES= int64_t int32_t uint32_t uint64_t
+
+ # The "tzselect", "zic", and "zdump" commands get installed in. . .
+
+-ETCDIR= $(TOPDIR)/etc
++SBINDIR= $(TOPDIR)/sbin
+
+ # If you "make INSTALL", the "date" command gets installed in. . .
+
+@@ -67,7 +67,7 @@ BINDIR= $(TOPDIR)/bin
+
+ # Manual pages go in subdirectories of. . .
+
+-MANDIR= $(TOPDIR)/man
++MANDIR= $(TOPDIR)/share/man
+
+ # Library functions are put in an archive in LIBDIR.
+
+@@ -298,8 +298,10 @@ GZIPFLAGS= -9n
+
+ ###############################################################################
+
+-cc= cc
+-CC= $(cc) -DTZDIR=\"$(TZDIR)\"
++CC+= -DTZDIR=\"$(TZDIR)\"
++ifeq ($(NLS),1)
++CC+= -DHAVE_GETTEXT=1 -DTZ_DOMAIN=\"libc\"
++endif
+
+ AR= ar
+
+@@ -352,17 +354,14 @@ ALL: all date
+ install: all $(DATA) $(REDO) $(MANS)
+ mkdir -p $(DESTDIR)$(ETCDIR) $(DESTDIR)$(TZDIR) \
+- $(DESTDIR)$(LIBDIR) \
++ $(DESTDIR)$(SBINDIR) $(DESTDIR)$(BINDIR) \
+ $(DESTDIR)$(MANDIR)/man3 $(DESTDIR)$(MANDIR)/man5 \
+ $(DESTDIR)$(MANDIR)/man8
+ $(ZIC) -y $(YEARISTYPE) \
+ -d $(DESTDIR)$(TZDIR) -l $(LOCALTIME) -p $(POSIXRULES)
+ cp -f iso3166.tab $(ZONETABLES) $(DESTDIR)$(TZDIR)/.
+- cp tzselect zic zdump $(DESTDIR)$(ETCDIR)/.
++ cp zic zdump $(DESTDIR)$(SBINDIR)/.
++ cp tzselect $(DESTDIR)$(BINDIR)/.
+- cp libtz.a $(DESTDIR)$(LIBDIR)/.
+- $(RANLIB) $(DESTDIR)$(LIBDIR)/libtz.a
+ cp -f newctime.3 newtzset.3 $(DESTDIR)$(MANDIR)/man3/.
+- cp -f tzfile.5 $(DESTDIR)$(MANDIR)/man5/.
+- cp -f tzselect.8 zdump.8 zic.8 $(DESTDIR)$(MANDIR)/man8/.
+
+ INSTALL: ALL install date.1
+ mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1
+@@ -406,18 +408,18 @@ right_only: zic leapseconds $(TDATA)
+ # to using them, or vice versa.
+ right_posix: right_only leapseconds
+ rm -fr $(DESTDIR)$(TZDIR)-leaps
+- ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-leaps || \
+- $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \
++ ln -s . $(DESTDIR)$(TZDIR)/right || \
++ $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)/right \
+ -L leapseconds $(TDATA)
+- $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \
++ $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)/posix \
+ -L /dev/null $(TDATA)
+
+ posix_right: posix_only leapseconds
+ rm -fr $(DESTDIR)$(TZDIR)-posix
+- ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-posix || \
+- $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \
++ ln -s . $(DESTDIR)$(TZDIR)/posix || \
++ $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)/posix \
+ -L /dev/null $(TDATA)
+- $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \
++ $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)/right \
+ -L leapseconds $(TDATA)
+
+ zones: $(REDO)
+@@ -440,7 +442,7 @@ tzselect: tzselect.ksh
+ <$? >$@
+ chmod +x $@
+
+-check: check_character_set check_tables check_web
++check: check_character_set check_tables
+
+ check_character_set: $(ENCHILADA)
+ sharp='#'; ! grep -n $(INVALID_CHAR) $(ENCHILADA)
diff --git a/sys-libs/timezone-data/files/timezone-data-2014g-makefile.patch b/sys-libs/timezone-data/files/timezone-data-2014g-makefile.patch
new file mode 100644
index 000000000000..826637512338
--- /dev/null
+++ b/sys-libs/timezone-data/files/timezone-data-2014g-makefile.patch
@@ -0,0 +1,113 @@
+ - Fix up default paths
+ - Support env CC
+ - Don't build/install libtz.a
+ - Don't install man-pages provided by sys-apps/man-pages
+ - Move zic, zdump to sbin and tzselect to bin ala glibc
+ - Install posix zoneinfo into zoneinfo/posix/ instead of zoneinfo-posix/ ala glibc
+ - Install leaps zoneinfo into zoneinfo/right/ ala glibc
+ - Do not run network based unittests
+
+--- a/Makefile
++++ b/Makefile
+@@ -45,21 +45,21 @@ POSIXRULES= America/New_York
+
+ # Everything gets put in subdirectories of. . .
+
+-TOPDIR= /usr/local
++TOPDIR= /usr
+
+ # "Compiled" time zone information is placed in the "TZDIR" directory
+ # (and subdirectories).
+ # Use an absolute path name for TZDIR unless you're just testing the software.
+
+ TZDIR_BASENAME= zoneinfo
+-TZDIR= $(TOPDIR)/etc/$(TZDIR_BASENAME)
++TZDIR= $(TOPDIR)/share/$(TZDIR_BASENAME)
+
+ # Types to try, as an alternative to time_t. int64_t should be first.
+ TIME_T_ALTERNATIVES= int64_t int32_t uint32_t uint64_t
+
+ # The "tzselect", "zic", and "zdump" commands get installed in. . .
+
+-ETCDIR= $(TOPDIR)/etc
++SBINDIR= $(TOPDIR)/sbin
+
+ # If you "make INSTALL", the "date" command gets installed in. . .
+
+@@ -67,7 +67,7 @@ BINDIR= $(TOPDIR)/bin
+
+ # Manual pages go in subdirectories of. . .
+
+-MANDIR= $(TOPDIR)/man
++MANDIR= $(TOPDIR)/share/man
+
+ # Library functions are put in an archive in LIBDIR.
+
+@@ -298,8 +298,10 @@ GZIPFLAGS= -9n
+
+ ###############################################################################
+
+-cc= cc
+-CC= $(cc) -DTZDIR=\"$(TZDIR)\"
++CC+= -DTZDIR=\"$(TZDIR)\"
++ifeq ($(NLS),1)
++CC+= -DHAVE_GETTEXT=1 -DTZ_DOMAIN=\"libc\"
++endif
+
+ AR= ar
+
+@@ -352,17 +354,14 @@ ALL: all date
+ install: all $(DATA) $(REDO) $(MANS)
+ mkdir -p $(DESTDIR)$(ETCDIR) $(DESTDIR)$(TZDIR) \
+- $(DESTDIR)$(LIBDIR) \
++ $(DESTDIR)$(SBINDIR) $(DESTDIR)$(BINDIR) \
+ $(DESTDIR)$(MANDIR)/man3 $(DESTDIR)$(MANDIR)/man5 \
+ $(DESTDIR)$(MANDIR)/man8
+ $(ZIC) -y $(YEARISTYPE) \
+ -d $(DESTDIR)$(TZDIR) -l $(LOCALTIME) -p $(POSIXRULES)
+ cp -f iso3166.tab $(ZONETABLES) $(DESTDIR)$(TZDIR)/.
+- cp tzselect zic zdump $(DESTDIR)$(ETCDIR)/.
++ cp zic zdump $(DESTDIR)$(SBINDIR)/.
++ cp tzselect $(DESTDIR)$(BINDIR)/.
+- cp libtz.a $(DESTDIR)$(LIBDIR)/.
+- $(RANLIB) $(DESTDIR)$(LIBDIR)/libtz.a
+ cp -f newctime.3 newtzset.3 $(DESTDIR)$(MANDIR)/man3/.
+- cp -f tzfile.5 $(DESTDIR)$(MANDIR)/man5/.
+- cp -f tzselect.8 zdump.8 zic.8 $(DESTDIR)$(MANDIR)/man8/.
+
+ INSTALL: ALL install date.1
+ mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1
+@@ -406,18 +408,18 @@ right_only: zic leapseconds $(TDATA)
+ # to using them, or vice versa.
+ right_posix: right_only leapseconds
+ rm -fr $(DESTDIR)$(TZDIR)-leaps
+- ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-leaps || \
+- $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \
++ ln -s . $(DESTDIR)$(TZDIR)/right || \
++ $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)/right \
+ -L leapseconds $(TDATA)
+- $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \
++ $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)/posix \
+ -L /dev/null $(TDATA)
+
+ posix_right: posix_only leapseconds
+ rm -fr $(DESTDIR)$(TZDIR)-posix
+- ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-posix || \
+- $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \
++ ln -s . $(DESTDIR)$(TZDIR)/posix || \
++ $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)/posix \
+ -L /dev/null $(TDATA)
+- $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \
++ $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)/right \
+ -L leapseconds $(TDATA)
+
+ posix_packrat: posix_only backzone
+@@ -440,7 +442,7 @@ tzselect: tzselect.ksh
+ <$? >$@
+ chmod +x $@
+
+-check: check_character_set check_white_space check_tables check_web
++check: check_character_set check_white_space check_tables
+
+ check_character_set: $(ENCHILADA)
+ LC_ALL=en_US.utf8 && export LC_ALL && \
diff --git a/sys-libs/timezone-data/files/timezone-data-2014h-makefile.patch b/sys-libs/timezone-data/files/timezone-data-2014h-makefile.patch
new file mode 100644
index 000000000000..38af3bebc97d
--- /dev/null
+++ b/sys-libs/timezone-data/files/timezone-data-2014h-makefile.patch
@@ -0,0 +1,113 @@
+ - Fix up default paths
+ - Support env CC
+ - Don't build/install libtz.a
+ - Don't install man-pages provided by sys-apps/man-pages
+ - Move zic, zdump to sbin and tzselect to bin ala glibc
+ - Install posix zoneinfo into zoneinfo/posix/ instead of zoneinfo-posix/ ala glibc
+ - Install leaps zoneinfo into zoneinfo/right/ ala glibc
+ - Do not run network based unittests
+
+--- a/Makefile
++++ b/Makefile
+@@ -45,21 +45,21 @@ POSIXRULES= America/New_York
+
+ # Everything gets put in subdirectories of. . .
+
+-TOPDIR= /usr/local
++TOPDIR= /usr
+
+ # "Compiled" time zone information is placed in the "TZDIR" directory
+ # (and subdirectories).
+ # Use an absolute path name for TZDIR unless you're just testing the software.
+
+ TZDIR_BASENAME= zoneinfo
+-TZDIR= $(TOPDIR)/etc/$(TZDIR_BASENAME)
++TZDIR= $(TOPDIR)/share/$(TZDIR_BASENAME)
+
+ # Types to try, as an alternative to time_t. int64_t should be first.
+ TIME_T_ALTERNATIVES= int64_t int32_t uint32_t uint64_t
+
+ # The "tzselect", "zic", and "zdump" commands get installed in. . .
+
+-ETCDIR= $(TOPDIR)/etc
++SBINDIR= $(TOPDIR)/sbin
+
+ # If you "make INSTALL", the "date" command gets installed in. . .
+
+@@ -67,7 +67,7 @@ BINDIR= $(TOPDIR)/bin
+
+ # Manual pages go in subdirectories of. . .
+
+-MANDIR= $(TOPDIR)/man
++MANDIR= $(TOPDIR)/share/man
+
+ # Library functions are put in an archive in LIBDIR.
+
+@@ -298,8 +298,10 @@ GZIPFLAGS= -9n
+
+ ###############################################################################
+
+-cc= cc
+-CC= $(cc) -DTZDIR=\"$(TZDIR)\"
++CPPFLAGS+= -DTZDIR=\"$(TZDIR)\"
++ifeq ($(NLS),1)
++CPPFLAGS+= -DHAVE_GETTEXT=1 -DTZ_DOMAIN=\"libc\"
++endif
+
+ AR= ar
+
+@@ -352,17 +354,14 @@ ALL: all date
+ install: all $(DATA) $(REDO) $(MANS)
+ mkdir -p $(DESTDIR)$(ETCDIR) $(DESTDIR)$(TZDIR) \
+- $(DESTDIR)$(LIBDIR) \
++ $(DESTDIR)$(SBINDIR) $(DESTDIR)$(BINDIR) \
+ $(DESTDIR)$(MANDIR)/man3 $(DESTDIR)$(MANDIR)/man5 \
+ $(DESTDIR)$(MANDIR)/man8
+ $(ZIC) -y $(YEARISTYPE) \
+ -d $(DESTDIR)$(TZDIR) -l $(LOCALTIME) -p $(POSIXRULES)
+ cp -f iso3166.tab $(ZONETABLES) $(DESTDIR)$(TZDIR)/.
+- cp tzselect zic zdump $(DESTDIR)$(ETCDIR)/.
++ cp zic zdump $(DESTDIR)$(SBINDIR)/.
++ cp tzselect $(DESTDIR)$(BINDIR)/.
+- cp libtz.a $(DESTDIR)$(LIBDIR)/.
+- $(RANLIB) $(DESTDIR)$(LIBDIR)/libtz.a
+ cp -f newctime.3 newtzset.3 $(DESTDIR)$(MANDIR)/man3/.
+- cp -f tzfile.5 $(DESTDIR)$(MANDIR)/man5/.
+- cp -f tzselect.8 zdump.8 zic.8 $(DESTDIR)$(MANDIR)/man8/.
+
+ INSTALL: ALL install date.1
+ mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1
+@@ -406,18 +408,18 @@ right_only: zic leapseconds $(TDATA)
+ # to using them, or vice versa.
+ right_posix: right_only leapseconds
+ rm -fr $(DESTDIR)$(TZDIR)-leaps
+- ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-leaps || \
+- $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \
++ ln -s . $(DESTDIR)$(TZDIR)/right || \
++ $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)/right \
+ -L leapseconds $(TDATA)
+- $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \
++ $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)/posix \
+ -L /dev/null $(TDATA)
+
+ posix_right: posix_only leapseconds
+ rm -fr $(DESTDIR)$(TZDIR)-posix
+- ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-posix || \
+- $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \
++ ln -s . $(DESTDIR)$(TZDIR)/posix || \
++ $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)/posix \
+ -L /dev/null $(TDATA)
+- $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \
++ $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)/right \
+ -L leapseconds $(TDATA)
+
+ posix_packrat: posix_only backzone
+@@ -440,7 +442,7 @@ tzselect: tzselect.ksh
+ chmod +x $@
+
+ check: check_character_set check_white_space check_sorted \
+- check_tables check_web
++ check_tables
+
+ check_character_set: $(ENCHILADA)
+ LC_ALL=en_US.utf8 && export LC_ALL && \
diff --git a/sys-libs/timezone-data/files/timezone-data-2015a-makefile.patch b/sys-libs/timezone-data/files/timezone-data-2015a-makefile.patch
new file mode 100644
index 000000000000..2153d764981d
--- /dev/null
+++ b/sys-libs/timezone-data/files/timezone-data-2015a-makefile.patch
@@ -0,0 +1,113 @@
+ - Fix up default paths
+ - Support env CC
+ - Don't build/install libtz.a
+ - Don't install man-pages provided by sys-apps/man-pages
+ - Move zic, zdump to sbin and tzselect to bin ala glibc
+ - Install posix zoneinfo into zoneinfo/posix/ instead of zoneinfo-posix/ ala glibc
+ - Install leaps zoneinfo into zoneinfo/right/ ala glibc
+ - Do not run network based unittests
+
+--- a/Makefile
++++ b/Makefile
+@@ -45,21 +45,21 @@ POSIXRULES= America/New_York
+
+ # Everything gets put in subdirectories of. . .
+
+-TOPDIR= /usr/local
++TOPDIR= /usr
+
+ # "Compiled" time zone information is placed in the "TZDIR" directory
+ # (and subdirectories).
+ # Use an absolute path name for TZDIR unless you're just testing the software.
+
+ TZDIR_BASENAME= zoneinfo
+-TZDIR= $(TOPDIR)/etc/$(TZDIR_BASENAME)
++TZDIR= $(TOPDIR)/share/$(TZDIR_BASENAME)
+
+ # Types to try, as an alternative to time_t. int64_t should be first.
+ TIME_T_ALTERNATIVES= int64_t int32_t uint32_t uint64_t
+
+ # The "tzselect", "zic", and "zdump" commands get installed in. . .
+
+-ETCDIR= $(TOPDIR)/etc
++SBINDIR= $(TOPDIR)/sbin
+
+ # If you "make INSTALL", the "date" command gets installed in. . .
+
+@@ -67,7 +67,7 @@ BINDIR= $(TOPDIR)/bin
+
+ # Manual pages go in subdirectories of. . .
+
+-MANDIR= $(TOPDIR)/man
++MANDIR= $(TOPDIR)/share/man
+
+ # Library functions are put in an archive in LIBDIR.
+
+@@ -298,8 +298,10 @@ GZIPFLAGS= -9n
+
+ ###############################################################################
+
+-cc= cc
+-CC= $(cc) -DTZDIR=\"$(TZDIR)\"
++CPPFLAGS+= -DTZDIR=\"$(TZDIR)\"
++ifeq ($(NLS),1)
++CPPFLAGS+= -DHAVE_GETTEXT=1 -DTZ_DOMAIN=\"libc\"
++endif
+
+ AR= ar
+
+@@ -352,17 +354,14 @@ ALL: all date
+ install: all $(DATA) $(REDO) $(MANS)
+ mkdir -p $(DESTDIR)$(ETCDIR) $(DESTDIR)$(TZDIR) \
+- $(DESTDIR)$(LIBDIR) \
++ $(DESTDIR)$(SBINDIR) $(DESTDIR)$(BINDIR) \
+ $(DESTDIR)$(MANDIR)/man3 $(DESTDIR)$(MANDIR)/man5 \
+ $(DESTDIR)$(MANDIR)/man8
+ $(ZIC) -y $(YEARISTYPE) \
+ -d $(DESTDIR)$(TZDIR) -l $(LOCALTIME) -p $(POSIXRULES)
+ cp -f iso3166.tab $(ZONETABLES) $(DESTDIR)$(TZDIR)/.
+- cp tzselect zic zdump $(DESTDIR)$(ETCDIR)/.
++ cp zic zdump $(DESTDIR)$(SBINDIR)/.
++ cp tzselect $(DESTDIR)$(BINDIR)/.
+- cp libtz.a $(DESTDIR)$(LIBDIR)/.
+- $(RANLIB) $(DESTDIR)$(LIBDIR)/libtz.a
+ cp -f newctime.3 newtzset.3 $(DESTDIR)$(MANDIR)/man3/.
+- cp -f tzfile.5 $(DESTDIR)$(MANDIR)/man5/.
+- cp -f tzselect.8 zdump.8 zic.8 $(DESTDIR)$(MANDIR)/man8/.
+
+ INSTALL: ALL install date.1
+ mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1
+@@ -406,18 +408,18 @@ right_only: zic leapseconds $(TDATA)
+ # to using them, or vice versa.
+ right_posix: right_only leapseconds
+ rm -fr $(DESTDIR)$(TZDIR)-leaps
+- ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-leaps || \
+- $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \
++ ln -s . $(DESTDIR)$(TZDIR)/right || \
++ $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)/right \
+ -L leapseconds $(TDATA)
+- $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \
++ $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)/posix \
+ -L /dev/null $(TDATA)
+
+ posix_right: posix_only leapseconds
+ rm -fr $(DESTDIR)$(TZDIR)-posix
+- ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-posix || \
+- $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \
++ ln -s . $(DESTDIR)$(TZDIR)/posix || \
++ $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)/posix \
+ -L /dev/null $(TDATA)
+- $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \
++ $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)/right \
+ -L leapseconds $(TDATA)
+
+ posix_packrat: posix_only backzone
+@@ -440,7 +442,7 @@ tzselect: tzselect.ksh
+ chmod +x $@
+
+ check: check_character_set check_white_space check_links check_sorted \
+- check_tables check_web
++ check_tables
+
+ check_character_set: $(ENCHILADA)
+ LC_ALL=en_US.utf8 && export LC_ALL && \
diff --git a/sys-libs/timezone-data/files/timezone-data-2015c-makefile.patch b/sys-libs/timezone-data/files/timezone-data-2015c-makefile.patch
new file mode 100644
index 000000000000..fef0f84f0878
--- /dev/null
+++ b/sys-libs/timezone-data/files/timezone-data-2015c-makefile.patch
@@ -0,0 +1,86 @@
+ - Fix up default paths
+ - Support env CC
+ - Don't build/install libtz.a
+ - Don't install man-pages provided by sys-apps/man-pages
+ - Move zic, zdump to sbin and tzselect to bin ala glibc
+ - Do not run network based unittests
+
+--- a/Makefile
++++ b/Makefile
+@@ -45,21 +45,21 @@ POSIXRULES= America/New_York
+
+ # Everything gets put in subdirectories of. . .
+
+-TOPDIR= /usr/local
++TOPDIR= /usr
+
+ # "Compiled" time zone information is placed in the "TZDIR" directory
+ # (and subdirectories).
+ # Use an absolute path name for TZDIR unless you're just testing the software.
+
+ TZDIR_BASENAME= zoneinfo
+-TZDIR= $(TOPDIR)/etc/$(TZDIR_BASENAME)
++TZDIR= $(TOPDIR)/share/$(TZDIR_BASENAME)
+
+ # Types to try, as an alternative to time_t. int64_t should be first.
+ TIME_T_ALTERNATIVES= int64_t int32_t uint32_t uint64_t
+
+ # The "tzselect", "zic", and "zdump" commands get installed in. . .
+
+-ETCDIR= $(TOPDIR)/etc
++SBINDIR= $(TOPDIR)/sbin
+
+ # If you "make INSTALL", the "date" command gets installed in. . .
+
+@@ -67,7 +67,7 @@ BINDIR= $(TOPDIR)/bin
+
+ # Manual pages go in subdirectories of. . .
+
+-MANDIR= $(TOPDIR)/man
++MANDIR= $(TOPDIR)/share/man
+
+ # Library functions are put in an archive in LIBDIR.
+
+@@ -298,8 +298,10 @@ GZIPFLAGS= -9n
+
+ ###############################################################################
+
+-cc= cc
+-CC= $(cc) -DTZDIR=\"$(TZDIR)\"
++CPPFLAGS+= -DTZDIR=\"$(TZDIR)\"
++ifeq ($(NLS),1)
++CPPFLAGS+= -DHAVE_GETTEXT=1 -DTZ_DOMAIN=\"libc\"
++endif
+
+ AR= ar
+
+@@ -352,17 +354,14 @@ ALL: all date
+ install: all $(DATA) $(REDO) $(MANS)
+ mkdir -p $(DESTDIR)$(ETCDIR) $(DESTDIR)$(TZDIR) \
+- $(DESTDIR)$(LIBDIR) \
++ $(DESTDIR)$(SBINDIR) $(DESTDIR)$(BINDIR) \
+ $(DESTDIR)$(MANDIR)/man3 $(DESTDIR)$(MANDIR)/man5 \
+ $(DESTDIR)$(MANDIR)/man8
+ $(ZIC) -y $(YEARISTYPE) \
+ -d $(DESTDIR)$(TZDIR) -l $(LOCALTIME) -p $(POSIXRULES)
+ cp -f iso3166.tab $(ZONETABLES) $(DESTDIR)$(TZDIR)/.
+- cp tzselect zic zdump $(DESTDIR)$(ETCDIR)/.
++ cp zic zdump $(DESTDIR)$(SBINDIR)/.
++ cp tzselect $(DESTDIR)$(BINDIR)/.
+- cp libtz.a $(DESTDIR)$(LIBDIR)/.
+- $(RANLIB) $(DESTDIR)$(LIBDIR)/libtz.a
+ cp -f newctime.3 newtzset.3 $(DESTDIR)$(MANDIR)/man3/.
+- cp -f tzfile.5 $(DESTDIR)$(MANDIR)/man5/.
+- cp -f tzselect.8 zdump.8 zic.8 $(DESTDIR)$(MANDIR)/man8/.
+
+ INSTALL: ALL install date.1
+ mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1
+@@ -440,7 +442,7 @@ tzselect: tzselect.ksh
+ chmod +x $@
+
+ check: check_character_set check_white_space check_links check_sorted \
+- check_tables check_web
++ check_tables
+
+ check_character_set: $(ENCHILADA)
+ LC_ALL=en_US.utf8 && export LC_ALL && \
diff --git a/sys-libs/timezone-data/metadata.xml b/sys-libs/timezone-data/metadata.xml
new file mode 100644
index 000000000000..541771197a2b
--- /dev/null
+++ b/sys-libs/timezone-data/metadata.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>toolchain</herd>
+ <maintainer>
+ <email>djc@gentoo.org</email>
+ <name>Dirkjan Ochtman</name>
+ </maintainer>
+ <use>
+ <flag name='leaps_timezone'>
+ Install the set of "right" timezones; these timezones include leap seconds
+ when counting seconds since the epoch (while POSIX does not) as they are
+ based on the TAI (International Atomic Time) clock
+ </flag>
+ <flag name='right_timezone'>
+ Install the set of "right" timezones; these timezones include leap seconds
+ when counting seconds since the epoch (while posix does not)
+ </flag>
+ </use>
+</pkgmetadata>
diff --git a/sys-libs/timezone-data/timezone-data-2012j.ebuild b/sys-libs/timezone-data/timezone-data-2012j.ebuild
new file mode 100644
index 000000000000..8df52ea0b918
--- /dev/null
+++ b/sys-libs/timezone-data/timezone-data-2012j.ebuild
@@ -0,0 +1,110 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils toolchain-funcs flag-o-matic
+
+code_ver=${PV}
+data_ver=${PV}
+DESCRIPTION="Timezone data (/usr/share/zoneinfo) and utilities (tzselect/zic/zdump)"
+HOMEPAGE="http://www.iana.org/time-zones http://www.twinsun.com/tz/tz-link.htm"
+SRC_URI="http://www.iana.org/time-zones/repository/releases/tzdata${data_ver}.tar.gz
+ http://www.iana.org/time-zones/repository/releases/tzcode${code_ver}.tar.gz
+ ftp://munnari.oz.au/pub/tzdata${data_ver}.tar.gz
+ ftp://munnari.oz.au/pub/tzcode${code_ver}.tar.gz"
+
+LICENSE="BSD public-domain"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE="nls elibc_FreeBSD elibc_glibc"
+
+RDEPEND="!<sys-libs/glibc-2.3.5"
+
+S=${WORKDIR}
+
+src_unpack() {
+ unpack ${A}
+ epatch "${FILESDIR}"/${PN}-2012i-makefile.patch
+ tc-is-cross-compiler && cp -pR "${S}" "${S}"-native
+}
+
+src_compile() {
+ local LDLIBS
+ tc-export CC
+ use elibc_FreeBSD && append-flags -DSTD_INSPIRED #138251
+ export NLS=$(usex nls 1 0)
+ if use nls && ! use elibc_glibc ; then
+ LDLIBS+=" -lintl" #154181
+ fi
+ emake \
+ CFLAGS="${CPPFLAGS} ${CFLAGS} -std=gnu99" \
+ LDFLAGS="${LDFLAGS}" \
+ LDLIBS="${LDLIBS}" \
+ || die "emake failed"
+ if tc-is-cross-compiler ; then
+ emake -C "${S}"-native \
+ CC=$(tc-getBUILD_CC) \
+ CFLAGS="${BUILD_CFLAGS}" \
+ LDFLAGS="${BUILD_LDFLAGS}" \
+ LDLIBS="${LDLIBS}" \
+ zic || die
+ fi
+}
+
+src_install() {
+ local zic=""
+ tc-is-cross-compiler && zic="zic=${S}-native/zic"
+ emake install ${zic} DESTDIR="${D}" || die
+ rm -rf "${D}"/usr/share/zoneinfo-leaps
+ dodoc README Theory
+ dohtml *.htm
+}
+
+pkg_config() {
+ # make sure the /etc/localtime file does not get stale #127899
+ local tz src etc_lt="${ROOT}etc/localtime"
+
+ if has_version '<sys-apps/baselayout-2' ; then
+ src="${ROOT}etc/conf.d/clock"
+ tz=$(unset TIMEZONE ; source "${src}" ; echo ${TIMEZONE-FOOKABLOIE})
+ else
+ src="${ROOT}etc/timezone"
+ if [[ -e ${src} ]] ; then
+ tz=$(sed -e 's:#.*::' -e 's:[[:space:]]*::g' -e '/^$/d' "${src}")
+ else
+ tz="FOOKABLOIE"
+ fi
+ fi
+ [[ -z ${tz} ]] && return 0
+
+ if [[ ${tz} == "FOOKABLOIE" ]] ; then
+ elog "You do not have TIMEZONE set in ${src}."
+
+ if [[ ! -e ${etc_lt} ]] ; then
+ # if /etc/localtime is a symlink somewhere, assume they
+ # know what they're doing and they're managing it themselves
+ if [[ ! -L ${etc_lt} ]] ; then
+ cp -f "${ROOT}"/usr/share/zoneinfo/Factory "${etc_lt}"
+ elog "Setting ${etc_lt} to Factory."
+ else
+ elog "Assuming your ${etc_lt} symlink is what you want; skipping update."
+ fi
+ else
+ elog "Skipping auto-update of ${etc_lt}."
+ fi
+ return 0
+ fi
+
+ if [[ ! -e ${ROOT}/usr/share/zoneinfo/${tz} ]] ; then
+ elog "You have an invalid TIMEZONE setting in ${src}"
+ elog "Your ${etc_lt} has been reset to Factory; enjoy!"
+ tz="Factory"
+ fi
+ einfo "Updating ${etc_lt} with ${ROOT}usr/share/zoneinfo/${tz}"
+ [[ -L ${etc_lt} ]] && rm -f "${etc_lt}"
+ cp -f "${ROOT}"/usr/share/zoneinfo/"${tz}" "${etc_lt}"
+}
+
+pkg_postinst() {
+ pkg_config
+}
diff --git a/sys-libs/timezone-data/timezone-data-2013i.ebuild b/sys-libs/timezone-data/timezone-data-2013i.ebuild
new file mode 100644
index 000000000000..79369c259b23
--- /dev/null
+++ b/sys-libs/timezone-data/timezone-data-2013i.ebuild
@@ -0,0 +1,129 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils toolchain-funcs flag-o-matic
+
+code_ver=${PV}
+data_ver=${PV}
+DESCRIPTION="Timezone data (/usr/share/zoneinfo) and utilities (tzselect/zic/zdump)"
+HOMEPAGE="http://www.iana.org/time-zones http://www.twinsun.com/tz/tz-link.htm"
+SRC_URI="http://www.iana.org/time-zones/repository/releases/tzdata${data_ver}.tar.gz
+ http://www.iana.org/time-zones/repository/releases/tzcode${code_ver}.tar.gz
+ ftp://munnari.oz.au/pub/oldtz/tzdata${data_ver}.tar.gz
+ ftp://munnari.oz.au/pub/oldtz/tzcode${data_ver}.tar.gz"
+
+LICENSE="BSD public-domain"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="nls elibc_FreeBSD elibc_glibc"
+
+RDEPEND="!<sys-libs/glibc-2.3.5"
+
+S=${WORKDIR}
+
+pkg_setup() {
+ # Deal with the case where older timezone-data installed a
+ # dir here, but newer one installs symlinks. Portage will
+ # barf when you try to transition file types.
+ if cd "${EROOT}"/usr/share/zoneinfo 2>/dev/null ; then
+ if [[ -d posix ]] ; then
+ rm -rf .gentoo-upgrade #487192
+ mv posix .gentoo-upgrade || die
+ ln -s .gentoo-upgrade posix || die
+ fi
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2013h-makefile.patch
+ tc-is-cross-compiler && cp -pR "${S}" "${S}"-native
+}
+
+src_compile() {
+ local LDLIBS
+ tc-export CC
+ if use elibc_FreeBSD || use elibc_Darwin ; then
+ append-cppflags -DSTD_INSPIRED #138251
+ fi
+ export NLS=$(usex nls 1 0)
+ if use nls && ! use elibc_glibc ; then
+ LDLIBS+=" -lintl" #154181
+ fi
+ # TOPDIR is used in some utils when compiling.
+ emake \
+ TOPDIR="${EPREFIX}/usr" \
+ CFLAGS="${CPPFLAGS} ${CFLAGS} -std=gnu99" \
+ LDFLAGS="${LDFLAGS}" \
+ LDLIBS="${LDLIBS}" \
+ || die
+ if tc-is-cross-compiler ; then
+ emake -C "${S}"-native \
+ CC=$(tc-getBUILD_CC) \
+ CFLAGS="${BUILD_CFLAGS}" \
+ LDFLAGS="${BUILD_LDFLAGS}" \
+ LDLIBS="${LDLIBS}" \
+ zic || die
+ fi
+}
+
+src_install() {
+ local zic=""
+ tc-is-cross-compiler && zic="zic=${S}-native/zic"
+ emake install ${zic} DESTDIR="${ED}" || die
+ dodoc README Theory
+ dohtml *.htm
+}
+
+pkg_config() {
+ # make sure the /etc/localtime file does not get stale #127899
+ local tz src etc_lt="${EROOT}etc/localtime"
+
+ if has_version '<sys-apps/baselayout-2' ; then
+ src="${EROOT}etc/conf.d/clock"
+ tz=$(unset TIMEZONE ; source "${src}" ; echo ${TIMEZONE-FOOKABLOIE})
+ else
+ src="${EROOT}etc/timezone"
+ if [[ -e ${src} ]] ; then
+ tz=$(sed -e 's:#.*::' -e 's:[[:space:]]*::g' -e '/^$/d' "${src}")
+ else
+ tz="FOOKABLOIE"
+ fi
+ fi
+ [[ -z ${tz} ]] && return 0
+
+ if [[ ${tz} == "FOOKABLOIE" ]] ; then
+ elog "You do not have TIMEZONE set in ${src}."
+
+ if [[ ! -e ${etc_lt} ]] ; then
+ # if /etc/localtime is a symlink somewhere, assume they
+ # know what they're doing and they're managing it themselves
+ if [[ ! -L ${etc_lt} ]] ; then
+ cp -f "${EROOT}"/usr/share/zoneinfo/Factory "${etc_lt}"
+ elog "Setting ${etc_lt} to Factory."
+ else
+ elog "Assuming your ${etc_lt} symlink is what you want; skipping update."
+ fi
+ else
+ elog "Skipping auto-update of ${etc_lt}."
+ fi
+ return 0
+ fi
+
+ if [[ ! -e ${EROOT}/usr/share/zoneinfo/${tz} ]] ; then
+ elog "You have an invalid TIMEZONE setting in ${src}"
+ elog "Your ${etc_lt} has been reset to Factory; enjoy!"
+ tz="Factory"
+ fi
+ einfo "Updating ${etc_lt} with ${EROOT}usr/share/zoneinfo/${tz}"
+ [[ -L ${etc_lt} ]] && rm -f "${etc_lt}"
+ cp -f "${EROOT}"/usr/share/zoneinfo/"${tz}" "${etc_lt}"
+}
+
+pkg_postinst() {
+ rm -rf "${EROOT}"/usr/share/zoneinfo/.gentoo-upgrade &
+ pkg_config
+ wait
+}
diff --git a/sys-libs/timezone-data/timezone-data-2014i-r1.ebuild b/sys-libs/timezone-data/timezone-data-2014i-r1.ebuild
new file mode 100644
index 000000000000..53414b85a924
--- /dev/null
+++ b/sys-libs/timezone-data/timezone-data-2014i-r1.ebuild
@@ -0,0 +1,151 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils toolchain-funcs flag-o-matic
+
+code_ver=${PV}
+data_ver=${PV}
+DESCRIPTION="Timezone data (/usr/share/zoneinfo) and utilities (tzselect/zic/zdump)"
+HOMEPAGE="http://www.iana.org/time-zones http://www.twinsun.com/tz/tz-link.htm"
+SRC_URI="http://www.iana.org/time-zones/repository/releases/tzdata${data_ver}.tar.gz
+ http://www.iana.org/time-zones/repository/releases/tzcode${code_ver}.tar.gz"
+
+LICENSE="BSD public-domain"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="nls right_timezone elibc_FreeBSD elibc_glibc"
+
+RDEPEND="!sys-libs/glibc[vanilla(+)]"
+
+S=${WORKDIR}
+
+pkg_setup() {
+ # Deal with the case where older timezone-data installed a
+ # dir here, but newer one installs symlinks. Portage will
+ # barf when you try to transition file types.
+ if cd "${EROOT}"/usr/share/zoneinfo 2>/dev/null ; then
+ # In case of a failed upgrade, clean up the symlinks #506570
+ if [ -L .gentoo-upgrade ] ; then
+ rm -rf posix .gentoo-upgrade
+ fi
+ if [ -d posix ] ; then
+ rm -rf .gentoo-upgrade #487192
+ mv posix .gentoo-upgrade || die
+ ln -s .gentoo-upgrade posix || die
+ fi
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2014h-makefile.patch
+ tc-is-cross-compiler && cp -pR "${S}" "${S}"-native
+}
+
+_emake() {
+ emake \
+ TOPDIR="${EPREFIX}/usr" \
+ REDO=$(usex right_timezone posix_right posix_only) \
+ "$@"
+}
+
+src_compile() {
+ local LDLIBS
+ tc-export CC
+ if use elibc_FreeBSD || use elibc_Darwin ; then
+ append-cppflags -DSTD_INSPIRED #138251
+ fi
+ export NLS=$(usex nls 1 0)
+ if use nls && ! use elibc_glibc ; then
+ LDLIBS+=" -lintl" #154181
+ fi
+ # TOPDIR is used in some utils when compiling.
+ _emake \
+ AR="$(tc-getAR)" \
+ CC="$(tc-getCC)" \
+ RANLIB="$(tc-getRANLIB)" \
+ CFLAGS="${CFLAGS} -std=gnu99" \
+ LDFLAGS="${LDFLAGS}" \
+ LDLIBS="${LDLIBS}"
+ if tc-is-cross-compiler ; then
+ _emake -C "${S}"-native \
+ CC="$(tc-getBUILD_CC)" \
+ CFLAGS="${BUILD_CFLAGS}" \
+ CPPFLAGS="${BUILD_CPPFLAGS}" \
+ LDFLAGS="${BUILD_LDFLAGS}" \
+ LDLIBS="${LDLIBS}" \
+ zic
+ fi
+}
+
+src_install() {
+ local zic=""
+ tc-is-cross-compiler && zic="zic=${S}-native/zic"
+ _emake install ${zic} DESTDIR="${D}"
+ dodoc CONTRIBUTING README NEWS Theory
+ dohtml *.htm
+
+ # install the symlink by hand to not break existing timezones
+ if ! use right_timezone && [[ ! -e ${ED}/usr/share/zoneinfo/posix ]] ; then
+ dosym . /usr/share/zoneinfo/posix
+ fi
+}
+
+get_TIMEZONE() {
+ local tz src="${EROOT}etc/timezone"
+ if [[ -e ${src} ]] ; then
+ tz=$(sed -e 's:#.*::' -e 's:[[:space:]]*::g' -e '/^$/d' "${src}")
+ else
+ tz="FOOKABLOIE"
+ fi
+ [[ -z ${tz} ]] && return 1 || echo "${tz}"
+}
+
+pkg_preinst() {
+ local tz=$(get_TIMEZONE)
+ if ! use right_timezone && [[ ${tz} == right/* ]] ; then
+ eerror "Your timezone is set to '${tz}' but you have USE=-right_timezone."
+ die "Please fix your USE or timezone"
+ fi
+}
+
+pkg_config() {
+ # make sure the /etc/localtime file does not get stale #127899
+ local tz src="${EROOT}etc/timezone" etc_lt="${EROOT}etc/localtime"
+
+ tz=$(get_TIMEZONE) || return 0
+ if [[ ${tz} == "FOOKABLOIE" ]] ; then
+ elog "You do not have TIMEZONE set in ${src}."
+
+ if [[ ! -e ${etc_lt} ]] ; then
+ # if /etc/localtime is a symlink somewhere, assume they
+ # know what they're doing and they're managing it themselves
+ if [[ ! -L ${etc_lt} ]] ; then
+ cp -f "${EROOT}"/usr/share/zoneinfo/Factory "${etc_lt}"
+ elog "Setting ${etc_lt} to Factory."
+ else
+ elog "Assuming your ${etc_lt} symlink is what you want; skipping update."
+ fi
+ else
+ elog "Skipping auto-update of ${etc_lt}."
+ fi
+ return 0
+ fi
+
+ if [[ ! -e ${EROOT}/usr/share/zoneinfo/${tz} ]] ; then
+ elog "You have an invalid TIMEZONE setting in ${src}"
+ elog "Your ${etc_lt} has been reset to Factory; enjoy!"
+ tz="Factory"
+ fi
+ einfo "Updating ${etc_lt} with ${EROOT}usr/share/zoneinfo/${tz}"
+ [[ -L ${etc_lt} ]] && rm -f "${etc_lt}"
+ cp -f "${EROOT}"/usr/share/zoneinfo/"${tz}" "${etc_lt}"
+}
+
+pkg_postinst() {
+ rm -rf "${EROOT}"/usr/share/zoneinfo/.gentoo-upgrade &
+ pkg_config
+ wait
+}
diff --git a/sys-libs/timezone-data/timezone-data-2014j.ebuild b/sys-libs/timezone-data/timezone-data-2014j.ebuild
new file mode 100644
index 000000000000..805ee502caea
--- /dev/null
+++ b/sys-libs/timezone-data/timezone-data-2014j.ebuild
@@ -0,0 +1,151 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils toolchain-funcs flag-o-matic
+
+code_ver=${PV}
+data_ver=${PV}
+DESCRIPTION="Timezone data (/usr/share/zoneinfo) and utilities (tzselect/zic/zdump)"
+HOMEPAGE="http://www.iana.org/time-zones http://www.twinsun.com/tz/tz-link.htm"
+SRC_URI="http://www.iana.org/time-zones/repository/releases/tzdata${data_ver}.tar.gz
+ http://www.iana.org/time-zones/repository/releases/tzcode${code_ver}.tar.gz"
+
+LICENSE="BSD public-domain"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="nls right_timezone elibc_FreeBSD elibc_glibc"
+
+RDEPEND="!sys-libs/glibc[vanilla(+)]"
+
+S=${WORKDIR}
+
+pkg_setup() {
+ # Deal with the case where older timezone-data installed a
+ # dir here, but newer one installs symlinks. Portage will
+ # barf when you try to transition file types.
+ if cd "${EROOT}"/usr/share/zoneinfo 2>/dev/null ; then
+ # In case of a failed upgrade, clean up the symlinks #506570
+ if [ -L .gentoo-upgrade ] ; then
+ rm -rf posix .gentoo-upgrade
+ fi
+ if [ -d posix ] ; then
+ rm -rf .gentoo-upgrade #487192
+ mv posix .gentoo-upgrade || die
+ ln -s .gentoo-upgrade posix || die
+ fi
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2014h-makefile.patch
+ tc-is-cross-compiler && cp -pR "${S}" "${S}"-native
+}
+
+_emake() {
+ emake \
+ TOPDIR="${EPREFIX}/usr" \
+ REDO=$(usex right_timezone posix_right posix_only) \
+ "$@"
+}
+
+src_compile() {
+ local LDLIBS
+ tc-export CC
+ if use elibc_FreeBSD || use elibc_Darwin ; then
+ append-cppflags -DSTD_INSPIRED #138251
+ fi
+ export NLS=$(usex nls 1 0)
+ if use nls && ! use elibc_glibc ; then
+ LDLIBS+=" -lintl" #154181
+ fi
+ # TOPDIR is used in some utils when compiling.
+ _emake \
+ AR="$(tc-getAR)" \
+ CC="$(tc-getCC)" \
+ RANLIB="$(tc-getRANLIB)" \
+ CFLAGS="${CFLAGS} -std=gnu99" \
+ LDFLAGS="${LDFLAGS}" \
+ LDLIBS="${LDLIBS}"
+ if tc-is-cross-compiler ; then
+ _emake -C "${S}"-native \
+ CC="$(tc-getBUILD_CC)" \
+ CFLAGS="${BUILD_CFLAGS}" \
+ CPPFLAGS="${BUILD_CPPFLAGS}" \
+ LDFLAGS="${BUILD_LDFLAGS}" \
+ LDLIBS="${LDLIBS}" \
+ zic
+ fi
+}
+
+src_install() {
+ local zic=""
+ tc-is-cross-compiler && zic="zic=${S}-native/zic"
+ _emake install ${zic} DESTDIR="${D}"
+ dodoc CONTRIBUTING README NEWS Theory
+ dohtml *.htm
+
+ # install the symlink by hand to not break existing timezones
+ if ! use right_timezone && [[ ! -e ${ED}/usr/share/zoneinfo/posix ]] ; then
+ dosym . /usr/share/zoneinfo/posix
+ fi
+}
+
+get_TIMEZONE() {
+ local tz src="${EROOT}etc/timezone"
+ if [[ -e ${src} ]] ; then
+ tz=$(sed -e 's:#.*::' -e 's:[[:space:]]*::g' -e '/^$/d' "${src}")
+ else
+ tz="FOOKABLOIE"
+ fi
+ [[ -z ${tz} ]] && return 1 || echo "${tz}"
+}
+
+pkg_preinst() {
+ local tz=$(get_TIMEZONE)
+ if ! use right_timezone && [[ ${tz} == right/* ]] ; then
+ eerror "Your timezone is set to '${tz}' but you have USE=-right_timezone."
+ die "Please fix your USE or timezone"
+ fi
+}
+
+pkg_config() {
+ # make sure the /etc/localtime file does not get stale #127899
+ local tz src="${EROOT}etc/timezone" etc_lt="${EROOT}etc/localtime"
+
+ tz=$(get_TIMEZONE) || return 0
+ if [[ ${tz} == "FOOKABLOIE" ]] ; then
+ elog "You do not have TIMEZONE set in ${src}."
+
+ if [[ ! -e ${etc_lt} ]] ; then
+ # if /etc/localtime is a symlink somewhere, assume they
+ # know what they're doing and they're managing it themselves
+ if [[ ! -L ${etc_lt} ]] ; then
+ cp -f "${EROOT}"/usr/share/zoneinfo/Factory "${etc_lt}"
+ elog "Setting ${etc_lt} to Factory."
+ else
+ elog "Assuming your ${etc_lt} symlink is what you want; skipping update."
+ fi
+ else
+ elog "Skipping auto-update of ${etc_lt}."
+ fi
+ return 0
+ fi
+
+ if [[ ! -e ${EROOT}/usr/share/zoneinfo/${tz} ]] ; then
+ elog "You have an invalid TIMEZONE setting in ${src}"
+ elog "Your ${etc_lt} has been reset to Factory; enjoy!"
+ tz="Factory"
+ fi
+ einfo "Updating ${etc_lt} with ${EROOT}usr/share/zoneinfo/${tz}"
+ [[ -L ${etc_lt} ]] && rm -f "${etc_lt}"
+ cp -f "${EROOT}"/usr/share/zoneinfo/"${tz}" "${etc_lt}"
+}
+
+pkg_postinst() {
+ rm -rf "${EROOT}"/usr/share/zoneinfo/.gentoo-upgrade &
+ pkg_config
+ wait
+}
diff --git a/sys-libs/timezone-data/timezone-data-2015a.ebuild b/sys-libs/timezone-data/timezone-data-2015a.ebuild
new file mode 100644
index 000000000000..8ddb089d1ad0
--- /dev/null
+++ b/sys-libs/timezone-data/timezone-data-2015a.ebuild
@@ -0,0 +1,154 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils toolchain-funcs flag-o-matic
+
+code_ver=${PV}
+data_ver=${PV}
+DESCRIPTION="Timezone data (/usr/share/zoneinfo) and utilities (tzselect/zic/zdump)"
+HOMEPAGE="http://www.iana.org/time-zones http://www.twinsun.com/tz/tz-link.htm"
+SRC_URI="http://www.iana.org/time-zones/repository/releases/tzdata${data_ver}.tar.gz
+ http://www.iana.org/time-zones/repository/releases/tzcode${code_ver}.tar.gz"
+
+LICENSE="BSD public-domain"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="nls right_timezone elibc_FreeBSD elibc_glibc"
+
+RDEPEND="!sys-libs/glibc[vanilla(+)]"
+
+S=${WORKDIR}
+
+pkg_setup() {
+ # Deal with the case where older timezone-data installed a
+ # dir here, but newer one installs symlinks. Portage will
+ # barf when you try to transition file types.
+ if cd "${EROOT}"/usr/share/zoneinfo 2>/dev/null ; then
+ # In case of a failed upgrade, clean up the symlinks #506570
+ if [ -L .gentoo-upgrade ] ; then
+ rm -rf posix .gentoo-upgrade
+ fi
+ if [ -d posix ] ; then
+ rm -rf .gentoo-upgrade #487192
+ mv posix .gentoo-upgrade || die
+ ln -s .gentoo-upgrade posix || die
+ fi
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2015a-makefile.patch
+ tc-is-cross-compiler && cp -pR "${S}" "${S}"-native
+}
+
+_emake() {
+ emake \
+ TOPDIR="${EPREFIX}/usr" \
+ REDO=$(usex right_timezone posix_right posix_only) \
+ "$@"
+}
+
+src_compile() {
+ local LDLIBS
+ tc-export CC
+ if use elibc_FreeBSD || use elibc_Darwin ; then
+ append-cppflags -DSTD_INSPIRED #138251
+ fi
+ export NLS=$(usex nls 1 0)
+ if use nls && ! use elibc_glibc ; then
+ LDLIBS+=" -lintl" #154181
+ fi
+ # TOPDIR is used in some utils when compiling.
+ _emake \
+ AR="$(tc-getAR)" \
+ CC="$(tc-getCC)" \
+ RANLIB="$(tc-getRANLIB)" \
+ CFLAGS="${CFLAGS} -std=gnu99" \
+ LDFLAGS="${LDFLAGS}" \
+ LDLIBS="${LDLIBS}"
+ if tc-is-cross-compiler ; then
+ _emake -C "${S}"-native \
+ CC="$(tc-getBUILD_CC)" \
+ CFLAGS="${BUILD_CFLAGS}" \
+ CPPFLAGS="${BUILD_CPPFLAGS}" \
+ LDFLAGS="${BUILD_LDFLAGS}" \
+ LDLIBS="${LDLIBS}" \
+ zic
+ fi
+}
+
+src_install() {
+ local zic=""
+ tc-is-cross-compiler && zic="zic=${S}-native/zic"
+ _emake install ${zic} DESTDIR="${D}"
+ dodoc CONTRIBUTING README NEWS Theory
+ dohtml *.htm
+
+ # install the symlink by hand to not break existing timezones
+ if ! use right_timezone && [[ ! -e ${ED}/usr/share/zoneinfo/posix ]] ; then
+ dosym . /usr/share/zoneinfo/posix
+ fi
+}
+
+get_TIMEZONE() {
+ local tz src="${EROOT}etc/timezone"
+ if [[ -e ${src} ]] ; then
+ tz=$(sed -e 's:#.*::' -e 's:[[:space:]]*::g' -e '/^$/d' "${src}")
+ else
+ tz="FOOKABLOIE"
+ fi
+ [[ -z ${tz} ]] && return 1 || echo "${tz}"
+}
+
+pkg_preinst() {
+ local tz=$(get_TIMEZONE)
+ if ! use right_timezone && [[ ${tz} == right/* ]] ; then
+ eerror "Your timezone is set to '${tz}' but you have USE=-right_timezone."
+ die "Please fix your USE or timezone"
+ fi
+}
+
+pkg_config() {
+ # make sure the /etc/localtime file does not get stale #127899
+ local tz src="${EROOT}etc/timezone" etc_lt="${EROOT}etc/localtime"
+
+ tz=$(get_TIMEZONE) || return 0
+ if [[ ${tz} == "FOOKABLOIE" ]] ; then
+ elog "You do not have TIMEZONE set in ${src}."
+
+ if [[ ! -e ${etc_lt} ]] ; then
+ # if /etc/localtime is a symlink somewhere, assume they
+ # know what they're doing and they're managing it themselves
+ if [[ ! -L ${etc_lt} ]] ; then
+ cp -f "${EROOT}"/usr/share/zoneinfo/Factory "${etc_lt}"
+ elog "Setting ${etc_lt} to Factory."
+ else
+ elog "Assuming your ${etc_lt} symlink is what you want; skipping update."
+ fi
+ else
+ elog "Skipping auto-update of ${etc_lt}."
+ fi
+ return 0
+ fi
+
+ if [[ ! -e ${EROOT}/usr/share/zoneinfo/${tz} ]] ; then
+ elog "You have an invalid TIMEZONE setting in ${src}"
+ elog "Your ${etc_lt} has been reset to Factory; enjoy!"
+ tz="Factory"
+ fi
+ if [[ -L ${etc_lt} ]]; then
+ einfo "Skipping symlinked ${etc_lt}"
+ else
+ einfo "Updating ${etc_lt} with ${EROOT}usr/share/zoneinfo/${tz}"
+ cp -f "${EROOT}"/usr/share/zoneinfo/"${tz}" "${etc_lt}"
+ fi
+}
+
+pkg_postinst() {
+ rm -rf "${EROOT}"/usr/share/zoneinfo/.gentoo-upgrade &
+ pkg_config
+ wait
+}
diff --git a/sys-libs/timezone-data/timezone-data-2015b.ebuild b/sys-libs/timezone-data/timezone-data-2015b.ebuild
new file mode 100644
index 000000000000..8ddb089d1ad0
--- /dev/null
+++ b/sys-libs/timezone-data/timezone-data-2015b.ebuild
@@ -0,0 +1,154 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils toolchain-funcs flag-o-matic
+
+code_ver=${PV}
+data_ver=${PV}
+DESCRIPTION="Timezone data (/usr/share/zoneinfo) and utilities (tzselect/zic/zdump)"
+HOMEPAGE="http://www.iana.org/time-zones http://www.twinsun.com/tz/tz-link.htm"
+SRC_URI="http://www.iana.org/time-zones/repository/releases/tzdata${data_ver}.tar.gz
+ http://www.iana.org/time-zones/repository/releases/tzcode${code_ver}.tar.gz"
+
+LICENSE="BSD public-domain"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="nls right_timezone elibc_FreeBSD elibc_glibc"
+
+RDEPEND="!sys-libs/glibc[vanilla(+)]"
+
+S=${WORKDIR}
+
+pkg_setup() {
+ # Deal with the case where older timezone-data installed a
+ # dir here, but newer one installs symlinks. Portage will
+ # barf when you try to transition file types.
+ if cd "${EROOT}"/usr/share/zoneinfo 2>/dev/null ; then
+ # In case of a failed upgrade, clean up the symlinks #506570
+ if [ -L .gentoo-upgrade ] ; then
+ rm -rf posix .gentoo-upgrade
+ fi
+ if [ -d posix ] ; then
+ rm -rf .gentoo-upgrade #487192
+ mv posix .gentoo-upgrade || die
+ ln -s .gentoo-upgrade posix || die
+ fi
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2015a-makefile.patch
+ tc-is-cross-compiler && cp -pR "${S}" "${S}"-native
+}
+
+_emake() {
+ emake \
+ TOPDIR="${EPREFIX}/usr" \
+ REDO=$(usex right_timezone posix_right posix_only) \
+ "$@"
+}
+
+src_compile() {
+ local LDLIBS
+ tc-export CC
+ if use elibc_FreeBSD || use elibc_Darwin ; then
+ append-cppflags -DSTD_INSPIRED #138251
+ fi
+ export NLS=$(usex nls 1 0)
+ if use nls && ! use elibc_glibc ; then
+ LDLIBS+=" -lintl" #154181
+ fi
+ # TOPDIR is used in some utils when compiling.
+ _emake \
+ AR="$(tc-getAR)" \
+ CC="$(tc-getCC)" \
+ RANLIB="$(tc-getRANLIB)" \
+ CFLAGS="${CFLAGS} -std=gnu99" \
+ LDFLAGS="${LDFLAGS}" \
+ LDLIBS="${LDLIBS}"
+ if tc-is-cross-compiler ; then
+ _emake -C "${S}"-native \
+ CC="$(tc-getBUILD_CC)" \
+ CFLAGS="${BUILD_CFLAGS}" \
+ CPPFLAGS="${BUILD_CPPFLAGS}" \
+ LDFLAGS="${BUILD_LDFLAGS}" \
+ LDLIBS="${LDLIBS}" \
+ zic
+ fi
+}
+
+src_install() {
+ local zic=""
+ tc-is-cross-compiler && zic="zic=${S}-native/zic"
+ _emake install ${zic} DESTDIR="${D}"
+ dodoc CONTRIBUTING README NEWS Theory
+ dohtml *.htm
+
+ # install the symlink by hand to not break existing timezones
+ if ! use right_timezone && [[ ! -e ${ED}/usr/share/zoneinfo/posix ]] ; then
+ dosym . /usr/share/zoneinfo/posix
+ fi
+}
+
+get_TIMEZONE() {
+ local tz src="${EROOT}etc/timezone"
+ if [[ -e ${src} ]] ; then
+ tz=$(sed -e 's:#.*::' -e 's:[[:space:]]*::g' -e '/^$/d' "${src}")
+ else
+ tz="FOOKABLOIE"
+ fi
+ [[ -z ${tz} ]] && return 1 || echo "${tz}"
+}
+
+pkg_preinst() {
+ local tz=$(get_TIMEZONE)
+ if ! use right_timezone && [[ ${tz} == right/* ]] ; then
+ eerror "Your timezone is set to '${tz}' but you have USE=-right_timezone."
+ die "Please fix your USE or timezone"
+ fi
+}
+
+pkg_config() {
+ # make sure the /etc/localtime file does not get stale #127899
+ local tz src="${EROOT}etc/timezone" etc_lt="${EROOT}etc/localtime"
+
+ tz=$(get_TIMEZONE) || return 0
+ if [[ ${tz} == "FOOKABLOIE" ]] ; then
+ elog "You do not have TIMEZONE set in ${src}."
+
+ if [[ ! -e ${etc_lt} ]] ; then
+ # if /etc/localtime is a symlink somewhere, assume they
+ # know what they're doing and they're managing it themselves
+ if [[ ! -L ${etc_lt} ]] ; then
+ cp -f "${EROOT}"/usr/share/zoneinfo/Factory "${etc_lt}"
+ elog "Setting ${etc_lt} to Factory."
+ else
+ elog "Assuming your ${etc_lt} symlink is what you want; skipping update."
+ fi
+ else
+ elog "Skipping auto-update of ${etc_lt}."
+ fi
+ return 0
+ fi
+
+ if [[ ! -e ${EROOT}/usr/share/zoneinfo/${tz} ]] ; then
+ elog "You have an invalid TIMEZONE setting in ${src}"
+ elog "Your ${etc_lt} has been reset to Factory; enjoy!"
+ tz="Factory"
+ fi
+ if [[ -L ${etc_lt} ]]; then
+ einfo "Skipping symlinked ${etc_lt}"
+ else
+ einfo "Updating ${etc_lt} with ${EROOT}usr/share/zoneinfo/${tz}"
+ cp -f "${EROOT}"/usr/share/zoneinfo/"${tz}" "${etc_lt}"
+ fi
+}
+
+pkg_postinst() {
+ rm -rf "${EROOT}"/usr/share/zoneinfo/.gentoo-upgrade &
+ pkg_config
+ wait
+}
diff --git a/sys-libs/timezone-data/timezone-data-2015c-r1.ebuild b/sys-libs/timezone-data/timezone-data-2015c-r1.ebuild
new file mode 100644
index 000000000000..0ba79099f6b0
--- /dev/null
+++ b/sys-libs/timezone-data/timezone-data-2015c-r1.ebuild
@@ -0,0 +1,143 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils toolchain-funcs flag-o-matic
+
+code_ver=${PV}
+data_ver=${PV}
+DESCRIPTION="Timezone data (/usr/share/zoneinfo) and utilities (tzselect/zic/zdump)"
+HOMEPAGE="http://www.iana.org/time-zones http://www.twinsun.com/tz/tz-link.htm"
+SRC_URI="http://www.iana.org/time-zones/repository/releases/tzdata${data_ver}.tar.gz
+ http://www.iana.org/time-zones/repository/releases/tzcode${code_ver}.tar.gz"
+
+LICENSE="BSD public-domain"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="nls leaps_timezone elibc_FreeBSD elibc_glibc"
+
+RDEPEND="!sys-libs/glibc[vanilla(+)]"
+
+S=${WORKDIR}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2015c-makefile.patch
+ tc-is-cross-compiler && cp -pR "${S}" "${S}"-native
+}
+
+_emake() {
+ emake \
+ TOPDIR="${EPREFIX}/usr" \
+ REDO=$(usex leaps_timezone posix_right posix_only) \
+ "$@"
+}
+
+src_compile() {
+ local LDLIBS
+ tc-export CC
+ if use elibc_FreeBSD || use elibc_Darwin ; then
+ append-cppflags -DSTD_INSPIRED #138251
+ fi
+ export NLS=$(usex nls 1 0)
+ if use nls && ! use elibc_glibc ; then
+ LDLIBS+=" -lintl" #154181
+ fi
+ # TOPDIR is used in some utils when compiling.
+ _emake \
+ AR="$(tc-getAR)" \
+ CC="$(tc-getCC)" \
+ RANLIB="$(tc-getRANLIB)" \
+ CFLAGS="${CFLAGS} -std=gnu99" \
+ LDFLAGS="${LDFLAGS}" \
+ LDLIBS="${LDLIBS}"
+ if tc-is-cross-compiler ; then
+ _emake -C "${S}"-native \
+ CC="$(tc-getBUILD_CC)" \
+ CFLAGS="${BUILD_CFLAGS}" \
+ CPPFLAGS="${BUILD_CPPFLAGS}" \
+ LDFLAGS="${BUILD_LDFLAGS}" \
+ LDLIBS="${LDLIBS}" \
+ zic
+ fi
+}
+
+src_install() {
+ local zic=""
+ tc-is-cross-compiler && zic="zic=${S}-native/zic"
+ _emake install ${zic} DESTDIR="${D}"
+ dodoc CONTRIBUTING README NEWS Theory
+ dohtml *.htm
+}
+
+get_TIMEZONE() {
+ local tz src="${EROOT}etc/timezone"
+ if [[ -e ${src} ]] ; then
+ tz=$(sed -e 's:#.*::' -e 's:[[:space:]]*::g' -e '/^$/d' "${src}")
+ else
+ tz="FOOKABLOIE"
+ fi
+ [[ -z ${tz} ]] && return 1 || echo "${tz}"
+}
+
+pkg_preinst() {
+ local tz=$(get_TIMEZONE)
+ if [[ ${tz} == right/* || ${tz} == posix/* ]] ; then
+ eerror "The right & posix subdirs are no longer installed as subdirs -- they have been"
+ eerror "relocated to match upstream paths as sibling paths. Further, posix/xxx is the"
+ eerror "same as xxx, so you should simply drop the posix/ prefix. You also should not"
+ eerror "be using right/xxx for the system timezone as it breaks programs."
+ die "Please fix your timezone setting"
+ fi
+
+ # Trim the symlink by hand to avoid portage's automatic protection checks.
+ rm -f "${EROOT}"/usr/share/zoneinfo/posix
+
+ if has_version "<=${CATEGORY}/${PN}-2015c" ; then
+ elog "Support for accessing posix/ and right/ directly has been dropped to match"
+ elog "upstream. There is no need to set TZ=posix/xxx as it is the same as TZ=xxx."
+ elog "For TZ=right/, you can use TZ=../zoneinfo-leaps/xxx instead. See this post"
+ elog "for details: https://mm.icann.org/pipermail/tz/2015-February/022024.html"
+ fi
+}
+
+pkg_config() {
+ # make sure the /etc/localtime file does not get stale #127899
+ local tz src="${EROOT}etc/timezone" etc_lt="${EROOT}etc/localtime"
+
+ tz=$(get_TIMEZONE) || return 0
+ if [[ ${tz} == "FOOKABLOIE" ]] ; then
+ elog "You do not have TIMEZONE set in ${src}."
+
+ if [[ ! -e ${etc_lt} ]] ; then
+ # if /etc/localtime is a symlink somewhere, assume they
+ # know what they're doing and they're managing it themselves
+ if [[ ! -L ${etc_lt} ]] ; then
+ cp -f "${EROOT}"/usr/share/zoneinfo/Factory "${etc_lt}"
+ elog "Setting ${etc_lt} to Factory."
+ else
+ elog "Assuming your ${etc_lt} symlink is what you want; skipping update."
+ fi
+ else
+ elog "Skipping auto-update of ${etc_lt}."
+ fi
+ return 0
+ fi
+
+ if [[ ! -e ${EROOT}/usr/share/zoneinfo/${tz} ]] ; then
+ elog "You have an invalid TIMEZONE setting in ${src}"
+ elog "Your ${etc_lt} has been reset to Factory; enjoy!"
+ tz="Factory"
+ fi
+ if [[ -L ${etc_lt} ]]; then
+ einfo "Skipping symlinked ${etc_lt}"
+ else
+ einfo "Updating ${etc_lt} with ${EROOT}usr/share/zoneinfo/${tz}"
+ cp -f "${EROOT}"/usr/share/zoneinfo/"${tz}" "${etc_lt}"
+ fi
+}
+
+pkg_postinst() {
+ pkg_config
+}
diff --git a/sys-libs/timezone-data/timezone-data-2015c.ebuild b/sys-libs/timezone-data/timezone-data-2015c.ebuild
new file mode 100644
index 000000000000..f0f999a9d8cc
--- /dev/null
+++ b/sys-libs/timezone-data/timezone-data-2015c.ebuild
@@ -0,0 +1,154 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils toolchain-funcs flag-o-matic
+
+code_ver=${PV}
+data_ver=${PV}
+DESCRIPTION="Timezone data (/usr/share/zoneinfo) and utilities (tzselect/zic/zdump)"
+HOMEPAGE="http://www.iana.org/time-zones http://www.twinsun.com/tz/tz-link.htm"
+SRC_URI="http://www.iana.org/time-zones/repository/releases/tzdata${data_ver}.tar.gz
+ http://www.iana.org/time-zones/repository/releases/tzcode${code_ver}.tar.gz"
+
+LICENSE="BSD public-domain"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="nls right_timezone elibc_FreeBSD elibc_glibc"
+
+RDEPEND="!sys-libs/glibc[vanilla(+)]"
+
+S=${WORKDIR}
+
+pkg_setup() {
+ # Deal with the case where older timezone-data installed a
+ # dir here, but newer one installs symlinks. Portage will
+ # barf when you try to transition file types.
+ if cd "${EROOT}"/usr/share/zoneinfo 2>/dev/null ; then
+ # In case of a failed upgrade, clean up the symlinks #506570
+ if [ -L .gentoo-upgrade ] ; then
+ rm -rf posix .gentoo-upgrade
+ fi
+ if [ -d posix ] ; then
+ rm -rf .gentoo-upgrade #487192
+ mv posix .gentoo-upgrade || die
+ ln -s .gentoo-upgrade posix || die
+ fi
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2015a-makefile.patch
+ tc-is-cross-compiler && cp -pR "${S}" "${S}"-native
+}
+
+_emake() {
+ emake \
+ TOPDIR="${EPREFIX}/usr" \
+ REDO=$(usex right_timezone posix_right posix_only) \
+ "$@"
+}
+
+src_compile() {
+ local LDLIBS
+ tc-export CC
+ if use elibc_FreeBSD || use elibc_Darwin ; then
+ append-cppflags -DSTD_INSPIRED #138251
+ fi
+ export NLS=$(usex nls 1 0)
+ if use nls && ! use elibc_glibc ; then
+ LDLIBS+=" -lintl" #154181
+ fi
+ # TOPDIR is used in some utils when compiling.
+ _emake \
+ AR="$(tc-getAR)" \
+ CC="$(tc-getCC)" \
+ RANLIB="$(tc-getRANLIB)" \
+ CFLAGS="${CFLAGS} -std=gnu99" \
+ LDFLAGS="${LDFLAGS}" \
+ LDLIBS="${LDLIBS}"
+ if tc-is-cross-compiler ; then
+ _emake -C "${S}"-native \
+ CC="$(tc-getBUILD_CC)" \
+ CFLAGS="${BUILD_CFLAGS}" \
+ CPPFLAGS="${BUILD_CPPFLAGS}" \
+ LDFLAGS="${BUILD_LDFLAGS}" \
+ LDLIBS="${LDLIBS}" \
+ zic
+ fi
+}
+
+src_install() {
+ local zic=""
+ tc-is-cross-compiler && zic="zic=${S}-native/zic"
+ _emake install ${zic} DESTDIR="${D}"
+ dodoc CONTRIBUTING README NEWS Theory
+ dohtml *.htm
+
+ # install the symlink by hand to not break existing timezones
+ if ! use right_timezone && [[ ! -e ${ED}/usr/share/zoneinfo/posix ]] ; then
+ dosym . /usr/share/zoneinfo/posix
+ fi
+}
+
+get_TIMEZONE() {
+ local tz src="${EROOT}etc/timezone"
+ if [[ -e ${src} ]] ; then
+ tz=$(sed -e 's:#.*::' -e 's:[[:space:]]*::g' -e '/^$/d' "${src}")
+ else
+ tz="FOOKABLOIE"
+ fi
+ [[ -z ${tz} ]] && return 1 || echo "${tz}"
+}
+
+pkg_preinst() {
+ local tz=$(get_TIMEZONE)
+ if ! use right_timezone && [[ ${tz} == right/* ]] ; then
+ eerror "Your timezone is set to '${tz}' but you have USE=-right_timezone."
+ die "Please fix your USE or timezone"
+ fi
+}
+
+pkg_config() {
+ # make sure the /etc/localtime file does not get stale #127899
+ local tz src="${EROOT}etc/timezone" etc_lt="${EROOT}etc/localtime"
+
+ tz=$(get_TIMEZONE) || return 0
+ if [[ ${tz} == "FOOKABLOIE" ]] ; then
+ elog "You do not have TIMEZONE set in ${src}."
+
+ if [[ ! -e ${etc_lt} ]] ; then
+ # if /etc/localtime is a symlink somewhere, assume they
+ # know what they're doing and they're managing it themselves
+ if [[ ! -L ${etc_lt} ]] ; then
+ cp -f "${EROOT}"/usr/share/zoneinfo/Factory "${etc_lt}"
+ elog "Setting ${etc_lt} to Factory."
+ else
+ elog "Assuming your ${etc_lt} symlink is what you want; skipping update."
+ fi
+ else
+ elog "Skipping auto-update of ${etc_lt}."
+ fi
+ return 0
+ fi
+
+ if [[ ! -e ${EROOT}/usr/share/zoneinfo/${tz} ]] ; then
+ elog "You have an invalid TIMEZONE setting in ${src}"
+ elog "Your ${etc_lt} has been reset to Factory; enjoy!"
+ tz="Factory"
+ fi
+ if [[ -L ${etc_lt} ]]; then
+ einfo "Skipping symlinked ${etc_lt}"
+ else
+ einfo "Updating ${etc_lt} with ${EROOT}usr/share/zoneinfo/${tz}"
+ cp -f "${EROOT}"/usr/share/zoneinfo/"${tz}" "${etc_lt}"
+ fi
+}
+
+pkg_postinst() {
+ rm -rf "${EROOT}"/usr/share/zoneinfo/.gentoo-upgrade &
+ pkg_config
+ wait
+}
diff --git a/sys-libs/timezone-data/timezone-data-2015d.ebuild b/sys-libs/timezone-data/timezone-data-2015d.ebuild
new file mode 100644
index 000000000000..0ba79099f6b0
--- /dev/null
+++ b/sys-libs/timezone-data/timezone-data-2015d.ebuild
@@ -0,0 +1,143 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils toolchain-funcs flag-o-matic
+
+code_ver=${PV}
+data_ver=${PV}
+DESCRIPTION="Timezone data (/usr/share/zoneinfo) and utilities (tzselect/zic/zdump)"
+HOMEPAGE="http://www.iana.org/time-zones http://www.twinsun.com/tz/tz-link.htm"
+SRC_URI="http://www.iana.org/time-zones/repository/releases/tzdata${data_ver}.tar.gz
+ http://www.iana.org/time-zones/repository/releases/tzcode${code_ver}.tar.gz"
+
+LICENSE="BSD public-domain"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="nls leaps_timezone elibc_FreeBSD elibc_glibc"
+
+RDEPEND="!sys-libs/glibc[vanilla(+)]"
+
+S=${WORKDIR}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2015c-makefile.patch
+ tc-is-cross-compiler && cp -pR "${S}" "${S}"-native
+}
+
+_emake() {
+ emake \
+ TOPDIR="${EPREFIX}/usr" \
+ REDO=$(usex leaps_timezone posix_right posix_only) \
+ "$@"
+}
+
+src_compile() {
+ local LDLIBS
+ tc-export CC
+ if use elibc_FreeBSD || use elibc_Darwin ; then
+ append-cppflags -DSTD_INSPIRED #138251
+ fi
+ export NLS=$(usex nls 1 0)
+ if use nls && ! use elibc_glibc ; then
+ LDLIBS+=" -lintl" #154181
+ fi
+ # TOPDIR is used in some utils when compiling.
+ _emake \
+ AR="$(tc-getAR)" \
+ CC="$(tc-getCC)" \
+ RANLIB="$(tc-getRANLIB)" \
+ CFLAGS="${CFLAGS} -std=gnu99" \
+ LDFLAGS="${LDFLAGS}" \
+ LDLIBS="${LDLIBS}"
+ if tc-is-cross-compiler ; then
+ _emake -C "${S}"-native \
+ CC="$(tc-getBUILD_CC)" \
+ CFLAGS="${BUILD_CFLAGS}" \
+ CPPFLAGS="${BUILD_CPPFLAGS}" \
+ LDFLAGS="${BUILD_LDFLAGS}" \
+ LDLIBS="${LDLIBS}" \
+ zic
+ fi
+}
+
+src_install() {
+ local zic=""
+ tc-is-cross-compiler && zic="zic=${S}-native/zic"
+ _emake install ${zic} DESTDIR="${D}"
+ dodoc CONTRIBUTING README NEWS Theory
+ dohtml *.htm
+}
+
+get_TIMEZONE() {
+ local tz src="${EROOT}etc/timezone"
+ if [[ -e ${src} ]] ; then
+ tz=$(sed -e 's:#.*::' -e 's:[[:space:]]*::g' -e '/^$/d' "${src}")
+ else
+ tz="FOOKABLOIE"
+ fi
+ [[ -z ${tz} ]] && return 1 || echo "${tz}"
+}
+
+pkg_preinst() {
+ local tz=$(get_TIMEZONE)
+ if [[ ${tz} == right/* || ${tz} == posix/* ]] ; then
+ eerror "The right & posix subdirs are no longer installed as subdirs -- they have been"
+ eerror "relocated to match upstream paths as sibling paths. Further, posix/xxx is the"
+ eerror "same as xxx, so you should simply drop the posix/ prefix. You also should not"
+ eerror "be using right/xxx for the system timezone as it breaks programs."
+ die "Please fix your timezone setting"
+ fi
+
+ # Trim the symlink by hand to avoid portage's automatic protection checks.
+ rm -f "${EROOT}"/usr/share/zoneinfo/posix
+
+ if has_version "<=${CATEGORY}/${PN}-2015c" ; then
+ elog "Support for accessing posix/ and right/ directly has been dropped to match"
+ elog "upstream. There is no need to set TZ=posix/xxx as it is the same as TZ=xxx."
+ elog "For TZ=right/, you can use TZ=../zoneinfo-leaps/xxx instead. See this post"
+ elog "for details: https://mm.icann.org/pipermail/tz/2015-February/022024.html"
+ fi
+}
+
+pkg_config() {
+ # make sure the /etc/localtime file does not get stale #127899
+ local tz src="${EROOT}etc/timezone" etc_lt="${EROOT}etc/localtime"
+
+ tz=$(get_TIMEZONE) || return 0
+ if [[ ${tz} == "FOOKABLOIE" ]] ; then
+ elog "You do not have TIMEZONE set in ${src}."
+
+ if [[ ! -e ${etc_lt} ]] ; then
+ # if /etc/localtime is a symlink somewhere, assume they
+ # know what they're doing and they're managing it themselves
+ if [[ ! -L ${etc_lt} ]] ; then
+ cp -f "${EROOT}"/usr/share/zoneinfo/Factory "${etc_lt}"
+ elog "Setting ${etc_lt} to Factory."
+ else
+ elog "Assuming your ${etc_lt} symlink is what you want; skipping update."
+ fi
+ else
+ elog "Skipping auto-update of ${etc_lt}."
+ fi
+ return 0
+ fi
+
+ if [[ ! -e ${EROOT}/usr/share/zoneinfo/${tz} ]] ; then
+ elog "You have an invalid TIMEZONE setting in ${src}"
+ elog "Your ${etc_lt} has been reset to Factory; enjoy!"
+ tz="Factory"
+ fi
+ if [[ -L ${etc_lt} ]]; then
+ einfo "Skipping symlinked ${etc_lt}"
+ else
+ einfo "Updating ${etc_lt} with ${EROOT}usr/share/zoneinfo/${tz}"
+ cp -f "${EROOT}"/usr/share/zoneinfo/"${tz}" "${etc_lt}"
+ fi
+}
+
+pkg_postinst() {
+ pkg_config
+}
diff --git a/sys-libs/timezone-data/timezone-data-2015e.ebuild b/sys-libs/timezone-data/timezone-data-2015e.ebuild
new file mode 100644
index 000000000000..0ba79099f6b0
--- /dev/null
+++ b/sys-libs/timezone-data/timezone-data-2015e.ebuild
@@ -0,0 +1,143 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils toolchain-funcs flag-o-matic
+
+code_ver=${PV}
+data_ver=${PV}
+DESCRIPTION="Timezone data (/usr/share/zoneinfo) and utilities (tzselect/zic/zdump)"
+HOMEPAGE="http://www.iana.org/time-zones http://www.twinsun.com/tz/tz-link.htm"
+SRC_URI="http://www.iana.org/time-zones/repository/releases/tzdata${data_ver}.tar.gz
+ http://www.iana.org/time-zones/repository/releases/tzcode${code_ver}.tar.gz"
+
+LICENSE="BSD public-domain"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="nls leaps_timezone elibc_FreeBSD elibc_glibc"
+
+RDEPEND="!sys-libs/glibc[vanilla(+)]"
+
+S=${WORKDIR}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2015c-makefile.patch
+ tc-is-cross-compiler && cp -pR "${S}" "${S}"-native
+}
+
+_emake() {
+ emake \
+ TOPDIR="${EPREFIX}/usr" \
+ REDO=$(usex leaps_timezone posix_right posix_only) \
+ "$@"
+}
+
+src_compile() {
+ local LDLIBS
+ tc-export CC
+ if use elibc_FreeBSD || use elibc_Darwin ; then
+ append-cppflags -DSTD_INSPIRED #138251
+ fi
+ export NLS=$(usex nls 1 0)
+ if use nls && ! use elibc_glibc ; then
+ LDLIBS+=" -lintl" #154181
+ fi
+ # TOPDIR is used in some utils when compiling.
+ _emake \
+ AR="$(tc-getAR)" \
+ CC="$(tc-getCC)" \
+ RANLIB="$(tc-getRANLIB)" \
+ CFLAGS="${CFLAGS} -std=gnu99" \
+ LDFLAGS="${LDFLAGS}" \
+ LDLIBS="${LDLIBS}"
+ if tc-is-cross-compiler ; then
+ _emake -C "${S}"-native \
+ CC="$(tc-getBUILD_CC)" \
+ CFLAGS="${BUILD_CFLAGS}" \
+ CPPFLAGS="${BUILD_CPPFLAGS}" \
+ LDFLAGS="${BUILD_LDFLAGS}" \
+ LDLIBS="${LDLIBS}" \
+ zic
+ fi
+}
+
+src_install() {
+ local zic=""
+ tc-is-cross-compiler && zic="zic=${S}-native/zic"
+ _emake install ${zic} DESTDIR="${D}"
+ dodoc CONTRIBUTING README NEWS Theory
+ dohtml *.htm
+}
+
+get_TIMEZONE() {
+ local tz src="${EROOT}etc/timezone"
+ if [[ -e ${src} ]] ; then
+ tz=$(sed -e 's:#.*::' -e 's:[[:space:]]*::g' -e '/^$/d' "${src}")
+ else
+ tz="FOOKABLOIE"
+ fi
+ [[ -z ${tz} ]] && return 1 || echo "${tz}"
+}
+
+pkg_preinst() {
+ local tz=$(get_TIMEZONE)
+ if [[ ${tz} == right/* || ${tz} == posix/* ]] ; then
+ eerror "The right & posix subdirs are no longer installed as subdirs -- they have been"
+ eerror "relocated to match upstream paths as sibling paths. Further, posix/xxx is the"
+ eerror "same as xxx, so you should simply drop the posix/ prefix. You also should not"
+ eerror "be using right/xxx for the system timezone as it breaks programs."
+ die "Please fix your timezone setting"
+ fi
+
+ # Trim the symlink by hand to avoid portage's automatic protection checks.
+ rm -f "${EROOT}"/usr/share/zoneinfo/posix
+
+ if has_version "<=${CATEGORY}/${PN}-2015c" ; then
+ elog "Support for accessing posix/ and right/ directly has been dropped to match"
+ elog "upstream. There is no need to set TZ=posix/xxx as it is the same as TZ=xxx."
+ elog "For TZ=right/, you can use TZ=../zoneinfo-leaps/xxx instead. See this post"
+ elog "for details: https://mm.icann.org/pipermail/tz/2015-February/022024.html"
+ fi
+}
+
+pkg_config() {
+ # make sure the /etc/localtime file does not get stale #127899
+ local tz src="${EROOT}etc/timezone" etc_lt="${EROOT}etc/localtime"
+
+ tz=$(get_TIMEZONE) || return 0
+ if [[ ${tz} == "FOOKABLOIE" ]] ; then
+ elog "You do not have TIMEZONE set in ${src}."
+
+ if [[ ! -e ${etc_lt} ]] ; then
+ # if /etc/localtime is a symlink somewhere, assume they
+ # know what they're doing and they're managing it themselves
+ if [[ ! -L ${etc_lt} ]] ; then
+ cp -f "${EROOT}"/usr/share/zoneinfo/Factory "${etc_lt}"
+ elog "Setting ${etc_lt} to Factory."
+ else
+ elog "Assuming your ${etc_lt} symlink is what you want; skipping update."
+ fi
+ else
+ elog "Skipping auto-update of ${etc_lt}."
+ fi
+ return 0
+ fi
+
+ if [[ ! -e ${EROOT}/usr/share/zoneinfo/${tz} ]] ; then
+ elog "You have an invalid TIMEZONE setting in ${src}"
+ elog "Your ${etc_lt} has been reset to Factory; enjoy!"
+ tz="Factory"
+ fi
+ if [[ -L ${etc_lt} ]]; then
+ einfo "Skipping symlinked ${etc_lt}"
+ else
+ einfo "Updating ${etc_lt} with ${EROOT}usr/share/zoneinfo/${tz}"
+ cp -f "${EROOT}"/usr/share/zoneinfo/"${tz}" "${etc_lt}"
+ fi
+}
+
+pkg_postinst() {
+ pkg_config
+}
diff --git a/sys-libs/uclibc/Manifest b/sys-libs/uclibc/Manifest
new file mode 100644
index 000000000000..0ee972817bd6
--- /dev/null
+++ b/sys-libs/uclibc/Manifest
@@ -0,0 +1,2 @@
+DIST uClibc-0.9.33.2-patches-17.tar.bz2 32437 SHA256 4e846e5fa71815e37971d6bfc1ed1381a97189b38575a64ff9396f6a561d48e0 SHA512 6a6ad8aef862f742e60965c447e5abee2349886f01bf5e44111b2a6c21e59e4644195cf36e85b8ce0dabbf7b92dc2c36ae27f0b7a02b0f9f4278e46ec5fb5a76 WHIRLPOOL 02e1c35b57403dcf2beed599c37c8cb52dab36a8e4c87fb8e8cac9cc536640cb0bf47a3df2a939bae6a6d728035362ad0427f830ffd35c9db174a42e342a03d9
+DIST uClibc-0.9.33.2.tar.bz2 2834029 SHA256 988d2c777e0605fe253d12157f71ec68f25d1bb8428725d2b7460bf9977e1662 SHA512 1cf18fe5418e12ae12ce995d7455d465bc4737f225afc49512ec69858771e099bead7b18408b01c7e6f845dcc80c3b4f875332eeffdcc04ae4b48474fb29a8dd WHIRLPOOL e2ca16c179893a58228e701ddf8b5614cb6b3fe2eaa6e2a9b909a27f78a348723fa7ec99f7b437ce35d9ac0870e3e2ec4e4d46834ca6b3cbc3d8fa5306b57fb4
diff --git a/sys-libs/uclibc/metadata.xml b/sys-libs/uclibc/metadata.xml
new file mode 100644
index 000000000000..e4cf5b884b75
--- /dev/null
+++ b/sys-libs/uclibc/metadata.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>embedded</herd>
+ <maintainer>
+ <email>vapier@gentoo.org</email>
+ <description>Primary Maintainer</description>
+ </maintainer>
+ <longdescription>
+uClibc pronounced yew-see-lib-see is a C library for developing embedded Linux
+systems. It is much smaller than the GNU C Library, but nearly all applications supported
+by glibc also work perfectly with uClibc. Porting applications from glibc to uClibc
+typically involves just recompiling the source code. uClibc even supports shared libraries
+and threading. It currently runs on standard Linux and MMU-less (also known as uClinux)
+systems with support for alpha, ARM, cris, i386, i960, h8300, m68k, mips/mipsel, PowerPC,
+SH, SPARC, and v850 processors.
+</longdescription>
+<use>
+ <flag name='rpc'>Enable sun nis/rpc support (you should use libtirpc though)</flag>
+ <flag name='ssp'>Force the use of ssp to be built into a hardened uclibc setup</flag>
+ <flag name='savedconfig'>Adds support for user defined configs</flag>
+ <flag name='uclibc-compat'>Build uclibc with backwards compatible
+ options</flag>
+ <flag name='wordexp'>Add support for word expansion (wordexp.h)</flag>
+</use>
+</pkgmetadata>
diff --git a/sys-libs/uclibc/uclibc-0.9.33.2-r15.ebuild b/sys-libs/uclibc/uclibc-0.9.33.2-r15.ebuild
new file mode 100644
index 000000000000..6c3c0a09e801
--- /dev/null
+++ b/sys-libs/uclibc/uclibc-0.9.33.2-r15.ebuild
@@ -0,0 +1,348 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils flag-o-matic multilib toolchain-funcs savedconfig
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://git.busybox.net/uClibc"
+ inherit git-2
+fi
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+MY_P=uClibc-${PV}
+DESCRIPTION="C library for developing embedded Linux systems"
+HOMEPAGE="http://www.uclibc.org/"
+if [[ ${PV} != "9999" ]] ; then
+ PATCH_VER="17"
+ SRC_URI="http://uclibc.org/downloads/${MY_P}.tar.bz2
+ ${PATCH_VER:+mirror://gentoo/${MY_P}-patches-${PATCH_VER}.tar.bz2}"
+ KEYWORDS="-* amd64 arm m68k ~mips ppc sh sparc x86"
+fi
+
+LICENSE="LGPL-2"
+SLOT="0"
+IUSE="debug hardened iconv ipv6 nptl rpc ssp uclibc-compat wordexp crosscompile_opts_headers-only"
+RESTRICT="strip"
+
+S=${WORKDIR}/${MY_P}
+
+is_crosscompile() {
+ [[ ${CHOST} != ${CTARGET} ]]
+}
+alt_build_kprefix() {
+ if [[ ${CBUILD} == ${CHOST} && ${CTARGET} == ${CHOST} ]] ; then
+ echo /usr/include
+ else
+ echo /usr/${CTARGET}/usr/include
+ fi
+}
+
+just_headers() {
+ use crosscompile_opts_headers-only && is_crosscompile
+}
+
+uclibc_endian() {
+ # XXX: this wont work for a toolchain which is bi-endian, but we
+ # dont have any such thing at the moment, so not a big deal
+ touch "${T}"/endian.s
+ $(tc-getAS ${CTARGET}) "${T}"/endian.s -o "${T}"/endian.o
+ case $(file "${T}"/endian.o) in
+ *" MSB "*) echo "BIG";;
+ *" LSB "*) echo "LITTLE";;
+ *) echo "NFC";;
+ esac
+ rm -f "${T}"/endian.{s,o}
+}
+
+pkg_setup() {
+ if [ ${CTARGET} = ${CHOST} ] ; then
+ case ${CHOST} in
+ *-uclinux*|*-uclibc*) ;;
+ *) die "Use sys-devel/crossdev to build a uclibc toolchain" ;;
+ esac
+ fi
+}
+
+check_cpu_opts() {
+ case ${CTARGET} in
+ # Need to handle $ABI here w/mips.
+ mips[1234]*) export UCLIBC_CPU="MIPS_ISA_${CTARGET:4:1}";;
+ sh[2345]*) export UCLIBC_CPU="SH${CTARGET:2:1}";;
+ i[3456]86*) export UCLIBC_CPU="${CTARGET:1:1}86";;
+ # XXX: Should figure out how to handle sparc.
+ esac
+
+ if use nptl ; then
+ case ${CTARGET} in
+ i386*)
+ die "Your target has no support for NPTL"
+ ;;
+ esac
+ fi
+}
+
+kconfig_q_opt() {
+ local flag=$1; shift
+ case ${flag} in
+ y|n) ;;
+ *) flag=$(usex ${flag} y n) ;;
+ esac
+
+ local var="defs_${flag}"
+ eval "${var}+=( $* )"
+}
+
+get_opt() {
+ (
+ unset ${1}
+ . ${2:-"${S}"/.config}
+ echo ${!1}
+ )
+}
+
+src_oldconfig() {
+ yes "" 2>/dev/null | emake -s oldconfig >/dev/null
+}
+src_config() {
+ restore_config .config
+ if [ -f .config ]; then
+ src_oldconfig
+ return 0
+ else
+ ewarn "Could not locate user configfile, so we will save a default one"
+ fi
+
+ emake ARCH=${target} defconfig >/dev/null || die
+
+ local defs_{y,n} defs
+
+ defs=(
+ DO{DEBUG_PT,ASSERTS}
+ SUPPORT_LD_DEBUG_EARLY
+ UCLIBC_HAS_PROFILING
+ )
+ kconfig_q_opt n "${defs[@]}"
+ kconfig_q_opt debug DODEBUG SUPPORT_LD_DEBUG
+
+ sed -i -e '/ARCH_.*_ENDIAN/d' .config
+ kconfig_q_opt y "ARCH_WANTS_$(uclibc_endian)_ENDIAN"
+
+ if [[ ${CTARGET} == arm* ]] ; then
+ kconfig_q_opt n CONFIG_ARM_OABI
+ kconfig_q_opt y CONFIG_ARM_EABI
+ fi
+
+ defs=(
+ MALLOC_GLIBC_COMPAT
+ DO_C99_MATH
+ UCLIBC_HAS_{CTYPE_CHECKED,WCHAR,HEXADECIMAL_FLOATS,GLIBC_CUSTOM_PRINTF,FOPEN_EXCLUSIVE_MODE,GLIBC_CUSTOM_STREAMS,PRINTF_M_SPEC}
+ UCLIBC_HAS_FENV
+ UCLIBC_HAS_{N,}FTW
+ UCLIBC_HAS_GNU_GLOB
+ UCLIBC_HAS_LIBUTIL
+ UCLIBC_HAS_PROGRAM_INVOCATION_NAME
+ UCLIBC_HAS_RESOLVER_SUPPORT
+ UCLIBC_HAS_TZ_FILE_READ_MANY
+ UCLIBC_HAS_UTMPX
+ UCLIBC_SUPPORT_AI_ADDRCONFIG
+ UCLIBC_SUSV3_LEGACY
+ UCLIBC_SUSV3_LEGACY_MACROS
+ UCLIBC_SUSV4_LEGACY
+ UCLIBC_USE_NETLINK
+ PTHREADS_DEBUG_SUPPORT
+ )
+ kconfig_q_opt y "${defs[@]}"
+ kconfig_q_opt n UCLIBC_HAS_CTYPE_UNSAFE
+ kconfig_q_opt n UCLIBC_HAS_LOCALE
+ kconfig_q_opt n HAS_NO_THREADS
+ kconfig_q_opt ipv6 UCLIBC_HAS_IPV6
+ kconfig_q_opt nptl UCLIBC_HAS_THREADS_NATIVE
+ kconfig_q_opt !nptl LINUXTHREADS_OLD
+ kconfig_q_opt rpc UCLIBC_HAS_{,{FULL,REENTRANT}_}RPC
+ kconfig_q_opt wordexp UCLIBC_HAS_WORDEXP
+ kconfig_q_opt uclibc-compat UCLIBC_HAS_LIB{NSL,RESOLV}_STUB COMPAT_ATEXIT
+
+ # we need to do it independently of hardened to get ssp.c built into libc
+ kconfig_q_opt y UCLIBC_HAS_SSP
+ kconfig_q_opt n UCLIBC_HAS_SSP_COMPAT
+ kconfig_q_opt y UCLIBC_HAS_ARC4RANDOM
+ kconfig_q_opt n PROPOLICE_BLOCK_ABRT
+ kconfig_q_opt y PROPOLICE_BLOCK_SEGV
+
+ # arm/mips do not emit PT_GNU_STACK, but if we enable this here
+ # it will be emitted as RWE, ppc has to be checked, x86 needs it
+ # this option should be used independently of hardened
+ if has $(tc-arch) x86 || has $(tc-arch) ppc ; then
+ kconfig_q_opt y UCLIBC_BUILD_NOEXECSTACK
+ else
+ kconfig_q_opt n UCLIBC_BUILD_NOEXECSTACK
+ fi
+ kconfig_q_opt y UCLIBC_BUILD_RELRO
+ kconfig_q_opt hardened UCLIBC_BUILD_PIE
+ kconfig_q_opt hardened UCLIBC_BUILD_NOW
+ kconfig_q_opt !ssp SSP_QUICK_CANARY
+ kconfig_q_opt ssp UCLIBC_BUILD_SSP
+
+ local def
+ for def in 1 2 ; do
+ # Run twice as some config opts depend on others being enabled first.
+ for def in ${defs_y[@]} ; do
+ sed -i -e "s:.*\<${def}\>.*set:${def}=y:g" .config
+ done
+ for def in ${defs_n[@]} ; do
+ sed -i -e "s:${def}=y:# ${def} is not set:g" .config
+ done
+ src_oldconfig
+ done
+
+ einfo "Enabled options:"
+ for def in ${defs_y[@]} ; do
+ einfo " " $(grep "^${def}=y" .config || echo "could not find ${def}")
+ done
+ einfo "Disabled options:"
+ for def in ${defs_n[@]} ; do
+ einfo " " $(grep "^# ${def} is not set" .config || echo "could not find ${def}")
+ done
+
+ # setup build and run paths
+ sed -i \
+ -e "/^CROSS_COMPILER_PREFIX/s:=.*:=\"${CTARGET}-\":" \
+ -e "/^KERNEL_HEADERS/s:=.*:=\"$(alt_build_kprefix)\":" \
+ -e "/^SHARED_LIB_LOADER_PREFIX/s:=.*:=\"/$(get_libdir)\":" \
+ -e "/^DEVEL_PREFIX/s:=.*:=\"/usr\":" \
+ -e "/^RUNTIME_PREFIX/s:=.*:=\"/\":" \
+ -e "/^UCLIBC_EXTRA_CFLAGS/s:=.*:=\"${UCLIBC_EXTRA_CFLAGS}\":" \
+ .config || die
+
+ src_oldconfig
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ git-2_src_unpack
+ else
+ unpack ${A}
+ fi
+ cd "${S}"
+ if [[ -n ${PATCH_VER} ]] ; then
+ EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/patch
+ fi
+
+ epatch_user
+
+ check_cpu_opts
+
+ echo
+ einfo "Runtime Prefix: /"
+ einfo "Devel Prefix: /usr"
+ einfo "Kernel Prefix: $(alt_build_kprefix)"
+ einfo "CBUILD: ${CBUILD}"
+ einfo "CHOST: ${CHOST}"
+ einfo "CTARGET: ${CTARGET}"
+ einfo "CPU: ${UCLIBC_CPU:-default}"
+ einfo "ENDIAN: $(uclibc_endian)"
+ echo
+
+ ########## CPU SELECTION ##########
+
+ local target=$(tc-arch) config_target
+ case ${target} in
+ amd64) target="x86_64";;
+ arm) target="arm"; config_target="GENERIC_ARM";;
+ avr) target="avr32";;
+ mips) target="mips"; config_target="MIPS_ISA_1";;
+ ppc) target="powerpc";;
+ sh) target="sh"; config_target="SH4";;
+ x86) target="i386"; config_target="486";;
+ esac
+ if [[ -n ${config_target} ]] ; then
+ sed -i -e "s:default CONFIG_${config_target}:default CONFIG_${UCLIBC_CPU:-${config_target}}:" \
+ extra/Configs/Config.${target} || die
+ fi
+ sed -i -e "s:^HOSTCC.*=.*:HOSTCC=$(tc-getBUILD_CC):" Rules.mak
+
+ src_config
+
+ if use iconv ; then
+ # Run after make clean, otherwise files removed
+ find ./extra/locale/charmaps -name "*.pairs" > extra/locale/codesets.txt
+ if [[ ! -f /etc/locale.gen ]] ; then
+ # See ./extra/locale/LOCALES for examples
+ die "Please create an appropriate /etc/locale.gen for locale support"
+ fi
+ echo -e "@euro e\n@cyrillic c\n#---\nUTF-8 yes\n8-BIT yes\n#---\n\n" > ./extra/locale/locales.txt
+ cat /etc/locale.gen >> ./extra/locale/locales.txt
+ fi
+}
+
+src_compile() {
+ emake headers || die
+ just_headers && return 0
+
+ emake || die
+ if is_crosscompile ; then
+ emake -C utils hostutils || die
+ else
+ emake utils || die
+ fi
+}
+
+src_test() {
+ is_crosscompile && return 0
+
+ # assert test fails on pax/grsec enabled kernels - normal
+ # vfork test fails in sandbox (both glibc/uclibc)
+ emake UCLIBC_ONLY=1 check || die
+}
+
+src_install() {
+ local sysroot=${D}
+ is_crosscompile && sysroot+="/usr/${CTARGET}"
+
+ local target="install"
+ just_headers && target="install_headers"
+ emake DESTDIR="${sysroot}" ${target} || die
+
+ save_config .config
+
+ # remove files coming from kernel-headers
+ rm -rf "${sysroot}"/usr/include/{linux,asm*}
+
+ # Make sure we install the sys-include symlink so that when
+ # we build a 2nd stage cross-compiler, gcc finds the target
+ # system headers correctly. See gcc/doc/gccinstall.info
+ if is_crosscompile ; then
+ dosym usr/include /usr/${CTARGET}/sys-include
+ if ! just_headers && [[ -n $(get_opt HAVE_SHARED) ]] ; then
+ newbin utils/ldconfig.host ${CTARGET}-ldconfig || die
+ newbin utils/ldd.host ${CTARGET}-ldd || die
+ fi
+ return 0
+ fi
+
+ emake DESTDIR="${D}" install_utils || die
+ dobin extra/scripts/getent
+ dodoc Changelog* README TODO docs/*.txt DEDICATION.mjn3
+}
+
+pkg_postinst() {
+ is_crosscompile && return 0
+
+ if [ ! -e "${ROOT}"/etc/TZ ] ; then
+ ewarn "Please remember to set your timezone in /etc/TZ"
+ mkdir -p "${ROOT}"/etc
+ echo "UTC" > "${ROOT}"/etc/TZ
+ fi
+ [ "${ROOT}" != "/" ] && return 0
+ # update cache before reloading init
+ ldconfig
+ # reload init ...
+ /sbin/telinit U 2>/dev/null
+}
diff --git a/sys-libs/uclibc/uclibc-0.9.33.9999.ebuild b/sys-libs/uclibc/uclibc-0.9.33.9999.ebuild
new file mode 100644
index 000000000000..a6dd21f56729
--- /dev/null
+++ b/sys-libs/uclibc/uclibc-0.9.33.9999.ebuild
@@ -0,0 +1,349 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils flag-o-matic multilib toolchain-funcs savedconfig
+if [[ ${PV} == *9999 ]] ; then
+ EGIT_BRANCH="0.9.33"
+ EGIT_REPO_URI="git://git.busybox.net/uClibc"
+ inherit git-2
+fi
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+MY_P=uClibc-${PV}
+DESCRIPTION="C library for developing embedded Linux systems"
+HOMEPAGE="http://www.uclibc.org/"
+if [[ ${PV} != *9999 ]] ; then
+ PATCH_VER=""
+ SRC_URI="http://uclibc.org/downloads/${MY_P}.tar.bz2
+ ${PATCH_VER:+mirror://gentoo/${MY_P}-patches-${PATCH_VER}.tar.bz2}"
+ KEYWORDS="-* ~amd64 ~arm ~m68k ~mips ~ppc ~sh ~sparc ~x86"
+fi
+
+LICENSE="LGPL-2"
+SLOT="0"
+IUSE="debug hardened iconv ipv6 nptl rpc ssp uclibc-compat wordexp crosscompile_opts_headers-only"
+RESTRICT="strip"
+
+S=${WORKDIR}/${MY_P}
+
+is_crosscompile() {
+ [[ ${CHOST} != ${CTARGET} ]]
+}
+alt_build_kprefix() {
+ if [[ ${CBUILD} == ${CHOST} && ${CTARGET} == ${CHOST} ]] ; then
+ echo /usr/include
+ else
+ echo /usr/${CTARGET}/usr/include
+ fi
+}
+
+just_headers() {
+ use crosscompile_opts_headers-only && is_crosscompile
+}
+
+uclibc_endian() {
+ # XXX: this wont work for a toolchain which is bi-endian, but we
+ # dont have any such thing at the moment, so not a big deal
+ touch "${T}"/endian.s
+ $(tc-getAS ${CTARGET}) "${T}"/endian.s -o "${T}"/endian.o
+ case $(file "${T}"/endian.o) in
+ *" MSB "*) echo "BIG";;
+ *" LSB "*) echo "LITTLE";;
+ *) echo "NFC";;
+ esac
+ rm -f "${T}"/endian.{s,o}
+}
+
+pkg_setup() {
+ if [ ${CTARGET} = ${CHOST} ] ; then
+ case ${CHOST} in
+ *-uclinux*|*-uclibc*) ;;
+ *) die "Use sys-devel/crossdev to build a uclibc toolchain" ;;
+ esac
+ fi
+}
+
+check_cpu_opts() {
+ case ${CTARGET} in
+ # Need to handle $ABI here w/mips.
+ mips[1234]*) export UCLIBC_CPU="MIPS_ISA_${CTARGET:4:1}";;
+ sh[2345]*) export UCLIBC_CPU="SH${CTARGET:2:1}";;
+ i[3456]86*) export UCLIBC_CPU="${CTARGET:1:1}86";;
+ # XXX: Should figure out how to handle sparc.
+ esac
+
+ if use nptl ; then
+ case ${CTARGET} in
+ i386*)
+ die "Your target has no support for NPTL"
+ ;;
+ esac
+ fi
+}
+
+kconfig_q_opt() {
+ local flag=$1; shift
+ case ${flag} in
+ y|n) ;;
+ *) flag=$(usex ${flag} y n) ;;
+ esac
+
+ local var="defs_${flag}"
+ eval "${var}+=( $* )"
+}
+
+get_opt() {
+ (
+ unset ${1}
+ . ${2:-"${S}"/.config}
+ echo ${!1}
+ )
+}
+
+src_oldconfig() {
+ yes "" 2>/dev/null | emake -s oldconfig >/dev/null
+}
+src_config() {
+ restore_config .config
+ if [ -f .config ]; then
+ src_oldconfig
+ return 0
+ else
+ ewarn "Could not locate user configfile, so we will save a default one"
+ fi
+
+ emake ARCH=${target} defconfig >/dev/null || die
+
+ local defs_{y,n} defs
+
+ defs=(
+ DO{DEBUG_PT,ASSERTS}
+ SUPPORT_LD_DEBUG_EARLY
+ UCLIBC_HAS_PROFILING
+ )
+ kconfig_q_opt n "${defs[@]}"
+ kconfig_q_opt debug DODEBUG SUPPORT_LD_DEBUG
+
+ sed -i -e '/ARCH_.*_ENDIAN/d' .config
+ kconfig_q_opt y "ARCH_WANTS_$(uclibc_endian)_ENDIAN"
+
+ if [[ ${CTARGET} == arm* ]] ; then
+ kconfig_q_opt n CONFIG_ARM_OABI
+ kconfig_q_opt y CONFIG_ARM_EABI
+ fi
+
+ defs=(
+ MALLOC_GLIBC_COMPAT
+ DO_C99_MATH
+ UCLIBC_HAS_{CTYPE_CHECKED,WCHAR,HEXADECIMAL_FLOATS,GLIBC_CUSTOM_PRINTF,FOPEN_EXCLUSIVE_MODE,GLIBC_CUSTOM_STREAMS,PRINTF_M_SPEC}
+ UCLIBC_HAS_FENV
+ UCLIBC_HAS_{N,}FTW
+ UCLIBC_HAS_GNU_GLOB
+ UCLIBC_HAS_LIBUTIL
+ UCLIBC_HAS_PROGRAM_INVOCATION_NAME
+ UCLIBC_HAS_RESOLVER_SUPPORT
+ UCLIBC_HAS_TZ_FILE_READ_MANY
+ UCLIBC_HAS_UTMPX
+ UCLIBC_SUPPORT_AI_ADDRCONFIG
+ UCLIBC_SUSV3_LEGACY
+ UCLIBC_SUSV3_LEGACY_MACROS
+ UCLIBC_SUSV4_LEGACY
+ UCLIBC_USE_NETLINK
+ PTHREADS_DEBUG_SUPPORT
+ )
+ kconfig_q_opt y "${defs[@]}"
+ kconfig_q_opt n UCLIBC_HAS_CTYPE_UNSAFE
+ kconfig_q_opt n UCLIBC_HAS_LOCALE
+ kconfig_q_opt n HAS_NO_THREADS
+ kconfig_q_opt ipv6 UCLIBC_HAS_IPV6
+ kconfig_q_opt nptl UCLIBC_HAS_THREADS_NATIVE
+ kconfig_q_opt !nptl LINUXTHREADS_OLD
+ kconfig_q_opt rpc UCLIBC_HAS_{,{FULL,REENTRANT}_}RPC
+ kconfig_q_opt wordexp UCLIBC_HAS_WORDEXP
+ kconfig_q_opt uclibc-compat UCLIBC_HAS_LIB{NSL,RESOLV}_STUB COMPAT_ATEXIT
+
+ # we need to do it independently of hardened to get ssp.c built into libc
+ kconfig_q_opt y UCLIBC_HAS_SSP
+ kconfig_q_opt n UCLIBC_HAS_SSP_COMPAT
+ kconfig_q_opt y UCLIBC_HAS_ARC4RANDOM
+ kconfig_q_opt n PROPOLICE_BLOCK_ABRT
+ kconfig_q_opt y PROPOLICE_BLOCK_SEGV
+
+ # arm/mips do not emit PT_GNU_STACK, but if we enable this here
+ # it will be emitted as RWE, ppc has to be checked, x86 needs it
+ # this option should be used independently of hardened
+ if has $(tc-arch) x86 || has $(tc-arch) ppc ; then
+ kconfig_q_opt y UCLIBC_BUILD_NOEXECSTACK
+ else
+ kconfig_q_opt n UCLIBC_BUILD_NOEXECSTACK
+ fi
+ kconfig_q_opt y UCLIBC_BUILD_RELRO
+ kconfig_q_opt hardened UCLIBC_BUILD_PIE
+ kconfig_q_opt hardened UCLIBC_BUILD_NOW
+ kconfig_q_opt !ssp SSP_QUICK_CANARY
+ kconfig_q_opt ssp UCLIBC_BUILD_SSP
+
+ local def
+ for def in 1 2 ; do
+ # Run twice as some config opts depend on others being enabled first.
+ for def in ${defs_y[@]} ; do
+ sed -i -e "s:.*\<${def}\>.*set:${def}=y:g" .config
+ done
+ for def in ${defs_n[@]} ; do
+ sed -i -e "s:${def}=y:# ${def} is not set:g" .config
+ done
+ src_oldconfig
+ done
+
+ einfo "Enabled options:"
+ for def in ${defs_y[@]} ; do
+ einfo " " $(grep "^${def}=y" .config || echo "could not find ${def}")
+ done
+ einfo "Disabled options:"
+ for def in ${defs_n[@]} ; do
+ einfo " " $(grep "^# ${def} is not set" .config || echo "could not find ${def}")
+ done
+
+ # setup build and run paths
+ sed -i \
+ -e "/^CROSS_COMPILER_PREFIX/s:=.*:=\"${CTARGET}-\":" \
+ -e "/^KERNEL_HEADERS/s:=.*:=\"$(alt_build_kprefix)\":" \
+ -e "/^SHARED_LIB_LOADER_PREFIX/s:=.*:=\"/$(get_libdir)\":" \
+ -e "/^DEVEL_PREFIX/s:=.*:=\"/usr\":" \
+ -e "/^RUNTIME_PREFIX/s:=.*:=\"/\":" \
+ -e "/^UCLIBC_EXTRA_CFLAGS/s:=.*:=\"${UCLIBC_EXTRA_CFLAGS}\":" \
+ .config || die
+
+ src_oldconfig
+}
+
+src_unpack() {
+ if [[ ${PV} == *9999 ]] ; then
+ git-2_src_unpack
+ else
+ unpack ${A}
+ fi
+ cd "${S}"
+ if [[ -n ${PATCH_VER} ]] ; then
+ EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/patch
+ fi
+
+ epatch_user
+
+ check_cpu_opts
+
+ echo
+ einfo "Runtime Prefix: /"
+ einfo "Devel Prefix: /usr"
+ einfo "Kernel Prefix: $(alt_build_kprefix)"
+ einfo "CBUILD: ${CBUILD}"
+ einfo "CHOST: ${CHOST}"
+ einfo "CTARGET: ${CTARGET}"
+ einfo "CPU: ${UCLIBC_CPU:-default}"
+ einfo "ENDIAN: $(uclibc_endian)"
+ echo
+
+ ########## CPU SELECTION ##########
+
+ local target=$(tc-arch) config_target
+ case ${target} in
+ amd64) target="x86_64";;
+ arm) target="arm"; config_target="GENERIC_ARM";;
+ avr) target="avr32";;
+ mips) target="mips"; config_target="MIPS_ISA_1";;
+ ppc) target="powerpc";;
+ sh) target="sh"; config_target="SH4";;
+ x86) target="i386"; config_target="486";;
+ esac
+ if [[ -n ${config_target} ]] ; then
+ sed -i -e "s:default CONFIG_${config_target}:default CONFIG_${UCLIBC_CPU:-${config_target}}:" \
+ extra/Configs/Config.${target} || die
+ fi
+ sed -i -e "s:^HOSTCC.*=.*:HOSTCC=$(tc-getBUILD_CC):" Rules.mak
+
+ src_config
+
+ if use iconv ; then
+ # Run after make clean, otherwise files removed
+ find ./extra/locale/charmaps -name "*.pairs" > extra/locale/codesets.txt
+ if [[ ! -f /etc/locale.gen ]] ; then
+ # See ./extra/locale/LOCALES for examples
+ die "Please create an appropriate /etc/locale.gen for locale support"
+ fi
+ echo -e "@euro e\n@cyrillic c\n#---\nUTF-8 yes\n8-BIT yes\n#---\n\n" > ./extra/locale/locales.txt
+ cat /etc/locale.gen >> ./extra/locale/locales.txt
+ fi
+}
+
+src_compile() {
+ emake headers || die
+ just_headers && return 0
+
+ emake || die
+ if is_crosscompile ; then
+ emake -C utils hostutils || die
+ else
+ emake utils || die
+ fi
+}
+
+src_test() {
+ is_crosscompile && return 0
+
+ # assert test fails on pax/grsec enabled kernels - normal
+ # vfork test fails in sandbox (both glibc/uclibc)
+ emake UCLIBC_ONLY=1 check || die
+}
+
+src_install() {
+ local sysroot=${D}
+ is_crosscompile && sysroot+="/usr/${CTARGET}"
+
+ local target="install"
+ just_headers && target="install_headers"
+ emake DESTDIR="${sysroot}" ${target} || die
+
+ save_config .config
+
+ # remove files coming from kernel-headers
+ rm -rf "${sysroot}"/usr/include/{linux,asm*}
+
+ # Make sure we install the sys-include symlink so that when
+ # we build a 2nd stage cross-compiler, gcc finds the target
+ # system headers correctly. See gcc/doc/gccinstall.info
+ if is_crosscompile ; then
+ dosym usr/include /usr/${CTARGET}/sys-include
+ if ! just_headers && [[ -n $(get_opt HAVE_SHARED) ]] ; then
+ newbin utils/ldconfig.host ${CTARGET}-ldconfig || die
+ newbin utils/ldd.host ${CTARGET}-ldd || die
+ fi
+ return 0
+ fi
+
+ emake DESTDIR="${D}" install_utils || die
+ dobin extra/scripts/getent
+ dodoc Changelog* README TODO docs/*.txt DEDICATION.mjn3
+}
+
+pkg_postinst() {
+ is_crosscompile && return 0
+
+ if [ ! -e "${ROOT}"/etc/TZ ] ; then
+ ewarn "Please remember to set your timezone in /etc/TZ"
+ mkdir -p "${ROOT}"/etc
+ echo "UTC" > "${ROOT}"/etc/TZ
+ fi
+ [ "${ROOT}" != "/" ] && return 0
+ # update cache before reloading init
+ ldconfig
+ # reload init ...
+ /sbin/telinit U 2>/dev/null
+}
diff --git a/sys-libs/uclibc/uclibc-9999.ebuild b/sys-libs/uclibc/uclibc-9999.ebuild
new file mode 100644
index 000000000000..0d45e8364a25
--- /dev/null
+++ b/sys-libs/uclibc/uclibc-9999.ebuild
@@ -0,0 +1,348 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils flag-o-matic multilib toolchain-funcs savedconfig
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://git.busybox.net/uClibc"
+ inherit git-2
+fi
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+MY_P=uClibc-${PV}
+DESCRIPTION="C library for developing embedded Linux systems"
+HOMEPAGE="http://www.uclibc.org/"
+if [[ ${PV} != "9999" ]] ; then
+ PATCH_VER=""
+ SRC_URI="http://uclibc.org/downloads/${MY_P}.tar.bz2
+ ${PATCH_VER:+mirror://gentoo/${MY_P}-patches-${PATCH_VER}.tar.bz2}"
+ KEYWORDS="-* ~amd64 ~arm ~m68k ~mips ~ppc ~sh ~sparc ~x86"
+fi
+
+LICENSE="LGPL-2"
+SLOT="0"
+IUSE="debug hardened iconv ipv6 nptl rpc ssp uclibc-compat wordexp crosscompile_opts_headers-only"
+RESTRICT="strip"
+
+S=${WORKDIR}/${MY_P}
+
+is_crosscompile() {
+ [[ ${CHOST} != ${CTARGET} ]]
+}
+alt_build_kprefix() {
+ if [[ ${CBUILD} == ${CHOST} && ${CTARGET} == ${CHOST} ]] ; then
+ echo /usr/include
+ else
+ echo /usr/${CTARGET}/usr/include
+ fi
+}
+
+just_headers() {
+ use crosscompile_opts_headers-only && is_crosscompile
+}
+
+uclibc_endian() {
+ # XXX: this wont work for a toolchain which is bi-endian, but we
+ # dont have any such thing at the moment, so not a big deal
+ touch "${T}"/endian.s
+ $(tc-getAS ${CTARGET}) "${T}"/endian.s -o "${T}"/endian.o
+ case $(file "${T}"/endian.o) in
+ *" MSB "*) echo "BIG";;
+ *" LSB "*) echo "LITTLE";;
+ *) echo "NFC";;
+ esac
+ rm -f "${T}"/endian.{s,o}
+}
+
+pkg_setup() {
+ if [ ${CTARGET} = ${CHOST} ] ; then
+ case ${CHOST} in
+ *-uclinux*|*-uclibc*) ;;
+ *) die "Use sys-devel/crossdev to build a uclibc toolchain" ;;
+ esac
+ fi
+}
+
+check_cpu_opts() {
+ case ${CTARGET} in
+ # Need to handle $ABI here w/mips.
+ mips[1234]*) export UCLIBC_CPU="MIPS_ISA_${CTARGET:4:1}";;
+ sh[2345]*) export UCLIBC_CPU="SH${CTARGET:2:1}";;
+ i[3456]86*) export UCLIBC_CPU="${CTARGET:1:1}86";;
+ # XXX: Should figure out how to handle sparc.
+ esac
+
+ if use nptl ; then
+ case ${CTARGET} in
+ i386*)
+ die "Your target has no support for NPTL"
+ ;;
+ esac
+ fi
+}
+
+kconfig_q_opt() {
+ local flag=$1; shift
+ case ${flag} in
+ y|n) ;;
+ *) flag=$(usex ${flag} y n) ;;
+ esac
+
+ local var="defs_${flag}"
+ eval "${var}+=( $* )"
+}
+
+get_opt() {
+ (
+ unset ${1}
+ . ${2:-"${S}"/.config}
+ echo ${!1}
+ )
+}
+
+src_oldconfig() {
+ yes "" 2>/dev/null | emake -s oldconfig >/dev/null
+}
+src_config() {
+ restore_config .config
+ if [ -f .config ]; then
+ src_oldconfig
+ return 0
+ else
+ ewarn "Could not locate user configfile, so we will save a default one"
+ fi
+
+ emake ARCH=${target} defconfig >/dev/null || die
+
+ local defs_{y,n} defs
+
+ defs=(
+ DO{DEBUG_PT,ASSERTS}
+ SUPPORT_LD_DEBUG_EARLY
+ UCLIBC_HAS_PROFILING
+ )
+ kconfig_q_opt n "${defs[@]}"
+ kconfig_q_opt debug DODEBUG SUPPORT_LD_DEBUG
+
+ sed -i -e '/ARCH_.*_ENDIAN/d' .config
+ kconfig_q_opt y "ARCH_WANTS_$(uclibc_endian)_ENDIAN"
+
+ if [[ ${CTARGET} == arm* ]] ; then
+ kconfig_q_opt n CONFIG_ARM_OABI
+ kconfig_q_opt y CONFIG_ARM_EABI
+ fi
+
+ defs=(
+ MALLOC_GLIBC_COMPAT
+ DO_C99_MATH
+ UCLIBC_HAS_{CTYPE_CHECKED,WCHAR,HEXADECIMAL_FLOATS,GLIBC_CUSTOM_PRINTF,FOPEN_EXCLUSIVE_MODE,GLIBC_CUSTOM_STREAMS,PRINTF_M_SPEC}
+ UCLIBC_HAS_FENV
+ UCLIBC_HAS_{N,}FTW
+ UCLIBC_HAS_GNU_GLOB
+ UCLIBC_HAS_LIBUTIL
+ UCLIBC_HAS_PROGRAM_INVOCATION_NAME
+ UCLIBC_HAS_RESOLVER_SUPPORT
+ UCLIBC_HAS_TZ_FILE_READ_MANY
+ UCLIBC_HAS_UTMPX
+ UCLIBC_SUPPORT_AI_ADDRCONFIG
+ UCLIBC_SUSV3_LEGACY
+ UCLIBC_SUSV3_LEGACY_MACROS
+ UCLIBC_SUSV4_LEGACY
+ UCLIBC_USE_NETLINK
+ PTHREADS_DEBUG_SUPPORT
+ )
+ kconfig_q_opt y "${defs[@]}"
+ kconfig_q_opt n UCLIBC_HAS_CTYPE_UNSAFE
+ kconfig_q_opt n UCLIBC_HAS_LOCALE
+ kconfig_q_opt n HAS_NO_THREADS
+ kconfig_q_opt ipv6 UCLIBC_HAS_IPV6
+ kconfig_q_opt nptl UCLIBC_HAS_THREADS_NATIVE
+ kconfig_q_opt !nptl LINUXTHREADS_OLD
+ kconfig_q_opt rpc UCLIBC_HAS_{,{FULL,REENTRANT}_}RPC
+ kconfig_q_opt wordexp UCLIBC_HAS_WORDEXP
+ kconfig_q_opt uclibc-compat UCLIBC_HAS_LIB{NSL,RESOLV}_STUB COMPAT_ATEXIT
+
+ # we need to do it independently of hardened to get ssp.c built into libc
+ kconfig_q_opt y UCLIBC_HAS_SSP
+ kconfig_q_opt n UCLIBC_HAS_SSP_COMPAT
+ kconfig_q_opt y UCLIBC_HAS_ARC4RANDOM
+ kconfig_q_opt n PROPOLICE_BLOCK_ABRT
+ kconfig_q_opt y PROPOLICE_BLOCK_SEGV
+
+ # arm/mips do not emit PT_GNU_STACK, but if we enable this here
+ # it will be emitted as RWE, ppc has to be checked, x86 needs it
+ # this option should be used independently of hardened
+ if has $(tc-arch) x86 || has $(tc-arch) ppc ; then
+ kconfig_q_opt y UCLIBC_BUILD_NOEXECSTACK
+ else
+ kconfig_q_opt n UCLIBC_BUILD_NOEXECSTACK
+ fi
+ kconfig_q_opt y UCLIBC_BUILD_RELRO
+ kconfig_q_opt hardened UCLIBC_BUILD_PIE
+ kconfig_q_opt hardened UCLIBC_BUILD_NOW
+ kconfig_q_opt !ssp SSP_QUICK_CANARY
+ kconfig_q_opt ssp UCLIBC_BUILD_SSP
+
+ local def
+ for def in 1 2 ; do
+ # Run twice as some config opts depend on others being enabled first.
+ for def in ${defs_y[@]} ; do
+ sed -i -e "s:.*\<${def}\>.*set:${def}=y:g" .config
+ done
+ for def in ${defs_n[@]} ; do
+ sed -i -e "s:${def}=y:# ${def} is not set:g" .config
+ done
+ src_oldconfig
+ done
+
+ einfo "Enabled options:"
+ for def in ${defs_y[@]} ; do
+ einfo " " $(grep "^${def}=y" .config || echo "could not find ${def}")
+ done
+ einfo "Disabled options:"
+ for def in ${defs_n[@]} ; do
+ einfo " " $(grep "^# ${def} is not set" .config || echo "could not find ${def}")
+ done
+
+ # setup build and run paths
+ sed -i \
+ -e "/^CROSS_COMPILER_PREFIX/s:=.*:=\"${CTARGET}-\":" \
+ -e "/^KERNEL_HEADERS/s:=.*:=\"$(alt_build_kprefix)\":" \
+ -e "/^SHARED_LIB_LOADER_PREFIX/s:=.*:=\"/$(get_libdir)\":" \
+ -e "/^DEVEL_PREFIX/s:=.*:=\"/usr\":" \
+ -e "/^RUNTIME_PREFIX/s:=.*:=\"/\":" \
+ -e "/^UCLIBC_EXTRA_CFLAGS/s:=.*:=\"${UCLIBC_EXTRA_CFLAGS}\":" \
+ .config || die
+
+ src_oldconfig
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ git-2_src_unpack
+ else
+ unpack ${A}
+ fi
+ cd "${S}"
+ if [[ -n ${PATCH_VER} ]] ; then
+ EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/patch
+ fi
+
+ epatch_user
+
+ check_cpu_opts
+
+ echo
+ einfo "Runtime Prefix: /"
+ einfo "Devel Prefix: /usr"
+ einfo "Kernel Prefix: $(alt_build_kprefix)"
+ einfo "CBUILD: ${CBUILD}"
+ einfo "CHOST: ${CHOST}"
+ einfo "CTARGET: ${CTARGET}"
+ einfo "CPU: ${UCLIBC_CPU:-default}"
+ einfo "ENDIAN: $(uclibc_endian)"
+ echo
+
+ ########## CPU SELECTION ##########
+
+ local target=$(tc-arch) config_target
+ case ${target} in
+ amd64) target="x86_64";;
+ arm) target="arm"; config_target="GENERIC_ARM";;
+ avr) target="avr32";;
+ mips) target="mips"; config_target="MIPS_ISA_1";;
+ ppc) target="powerpc";;
+ sh) target="sh"; config_target="SH4";;
+ x86) target="i386"; config_target="486";;
+ esac
+ if [[ -n ${config_target} ]] ; then
+ sed -i -e "s:default CONFIG_${config_target}:default CONFIG_${UCLIBC_CPU:-${config_target}}:" \
+ extra/Configs/Config.${target} || die
+ fi
+ sed -i -e "s:^HOSTCC.*=.*:HOSTCC=$(tc-getBUILD_CC):" Rules.mak
+
+ src_config
+
+ if use iconv ; then
+ # Run after make clean, otherwise files removed
+ find ./extra/locale/charmaps -name "*.pairs" > extra/locale/codesets.txt
+ if [[ ! -f /etc/locale.gen ]] ; then
+ # See ./extra/locale/LOCALES for examples
+ die "Please create an appropriate /etc/locale.gen for locale support"
+ fi
+ echo -e "@euro e\n@cyrillic c\n#---\nUTF-8 yes\n8-BIT yes\n#---\n\n" > ./extra/locale/locales.txt
+ cat /etc/locale.gen >> ./extra/locale/locales.txt
+ fi
+}
+
+src_compile() {
+ emake headers || die
+ just_headers && return 0
+
+ emake || die
+ if is_crosscompile ; then
+ emake -C utils hostutils || die
+ else
+ emake utils || die
+ fi
+}
+
+src_test() {
+ is_crosscompile && return 0
+
+ # assert test fails on pax/grsec enabled kernels - normal
+ # vfork test fails in sandbox (both glibc/uclibc)
+ emake UCLIBC_ONLY=1 check || die
+}
+
+src_install() {
+ local sysroot=${D}
+ is_crosscompile && sysroot+="/usr/${CTARGET}"
+
+ local target="install"
+ just_headers && target="install_headers"
+ emake DESTDIR="${sysroot}" ${target} || die
+
+ save_config .config
+
+ # remove files coming from kernel-headers
+ rm -rf "${sysroot}"/usr/include/{linux,asm*}
+
+ # Make sure we install the sys-include symlink so that when
+ # we build a 2nd stage cross-compiler, gcc finds the target
+ # system headers correctly. See gcc/doc/gccinstall.info
+ if is_crosscompile ; then
+ dosym usr/include /usr/${CTARGET}/sys-include
+ if ! just_headers && [[ -n $(get_opt HAVE_SHARED) ]] ; then
+ newbin utils/ldconfig.host ${CTARGET}-ldconfig || die
+ newbin utils/ldd.host ${CTARGET}-ldd || die
+ fi
+ return 0
+ fi
+
+ emake DESTDIR="${D}" install_utils || die
+ dobin extra/scripts/getent
+ dodoc Changelog* README TODO docs/*.txt DEDICATION.mjn3
+}
+
+pkg_postinst() {
+ is_crosscompile && return 0
+
+ if [ ! -e "${ROOT}"/etc/TZ ] ; then
+ ewarn "Please remember to set your timezone in /etc/TZ"
+ mkdir -p "${ROOT}"/etc
+ echo "UTC" > "${ROOT}"/etc/TZ
+ fi
+ [ "${ROOT}" != "/" ] && return 0
+ # update cache before reloading init
+ ldconfig
+ # reload init ...
+ /sbin/telinit U 2>/dev/null
+}
diff --git a/sys-libs/uid_wrapper/Manifest b/sys-libs/uid_wrapper/Manifest
new file mode 100644
index 000000000000..b8f288064ddd
--- /dev/null
+++ b/sys-libs/uid_wrapper/Manifest
@@ -0,0 +1 @@
+DIST uid_wrapper-1.1.0.tar.gz 34979 SHA256 d6038b7f9eb04714798ad37b4d0ca677014c5ad7c02b42a4791fd89d8ff7ada3 SHA512 21443e4945e932db6043990693a44c45df04d0a1235b499c1d01bebfbf0feac9bc231f4c9fc14334e8d0e45967344627c7de48e16c5ccb493ab8c2de696ee9f9 WHIRLPOOL 33fe78236b20793f3e490c12fd4c55d1fbf42d115d86ab9b951562e9dd474d26fbec2c676bc6f913a945f95caf02bacf6a49bc4c912959fcae4c3599db987e49
diff --git a/sys-libs/uid_wrapper/metadata.xml b/sys-libs/uid_wrapper/metadata.xml
new file mode 100644
index 000000000000..c2d9e83c908a
--- /dev/null
+++ b/sys-libs/uid_wrapper/metadata.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>samba</herd>
+ <maintainer>
+ <email>polynomial-c@gentoo.org</email>
+ <name>Lars Wendler</name>
+ </maintainer>
+</pkgmetadata>
diff --git a/sys-libs/uid_wrapper/uid_wrapper-1.1.0.ebuild b/sys-libs/uid_wrapper/uid_wrapper-1.1.0.ebuild
new file mode 100644
index 000000000000..da68e88ac768
--- /dev/null
+++ b/sys-libs/uid_wrapper/uid_wrapper-1.1.0.ebuild
@@ -0,0 +1,30 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit cmake-utils multilib-minimal
+
+DESCRIPTION="A wrapper to fake privilege separation"
+HOMEPAGE="https://cwrap.org/uid_wrapper.html"
+SRC_URI="ftp://ftp.samba.org/pub/cwrap/${P}.tar.gz"
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="test"
+
+DEPEND=""
+RDEPEND="${DEPEND}"
+
+multilib_src_configure() {
+ cmake-utils_src_configure
+}
+
+multilib_src_compile() {
+ cmake-utils_src_compile
+}
+
+multilib_src_install() {
+ cmake-utils_src_install
+}
diff --git a/sys-libs/zlib/Manifest b/sys-libs/zlib/Manifest
new file mode 100644
index 000000000000..5ebb26afb799
--- /dev/null
+++ b/sys-libs/zlib/Manifest
@@ -0,0 +1,6 @@
+DIST zlib-1.2.3.tar.bz2 425209 SHA256 e3b9950851a19904d642c4dec518623382cf4d2ac24f70a76510c944330d28ca SHA512 edae735960279d92acf58e1f4095c6392a7c2059b8f1d2c46648fc608a0fb06b392db2d073f4973f5762c034ea66596e769b95b3d26ad963a086b9b2d09825f2 WHIRLPOOL e874b123296f5d77daf60617501b30f4beebccb64b3910c2539f75f6c194a2cf4885dc7a3904bf790e1651120ec33b55c48e95970dd6bfd6c4d0a2ea48d7d0f4
+DIST zlib-1.2.5.1.tar.gz 548499 SHA256 c1f24a64f808528293cf04ba09a2dffbc3dd65ad7ebcee4737124ff8923756da SHA512 fceaf55eee0b8029dd4e3a6098fd9b9909a172cead79a2d92cf5b98ced0433e4bacec1064282459fea7e387f0367f78ee6e487da74199ea36da32311455802b2 WHIRLPOOL 2a64b8cb42b0913cd8a417c02ae80edcccab8346c4c9b2bfe9e7ef0c8144ed20571e1516972bf77771abb070afe0bfecd28abb07160a1c2f5be4c764dc4d385f
+DIST zlib-1.2.5.tar.bz2 486374 SHA256 239aead2f22f16bfcfa6a6a5150dcbd6d6f2e4d1eaa8727b5769ea014120b307 SHA512 88e8aa4bd2f23233cc6c0f52e568c7d8d2c18a69170c2363b574fbe5c86ce352d0768178c3fde6372576c45e0fdf80537ebde773689e3ad8584baddb889d0ede WHIRLPOOL d660761c4f437dd6c20e5cd23e442672c77264e6dc639bbf749d253c2fffd6b9fd32a9a9df7f5e9c3ec791afebbf486b8a4d6e8bac35cd2d2371dba759bb83a7
+DIST zlib-1.2.6.tar.gz 557220 SHA256 21235e08552e6feba09ea5e8d750805b3391c62fb81c71a235c0044dc7a8a61b SHA512 f812ab3049fc2920a8da4649f6e60340ac365d58a0e76ace5219426aeb0759c0a474cfb2b9902cd0471158fa32a4d2c35692309d266e66013444bdced8ed00d9 WHIRLPOOL 9655627d9770b6850d33b18ef7dc349396454fc217b90d3f7c2ffdac028533ff741c3a70ee4280ef91baf67425d037e6559dcea1da4c568ca51df8e9b7ab6df3
+DIST zlib-1.2.7.tar.gz 560351 SHA256 fa9c9c8638efb8cb8ef5e4dd5453e455751e1c530b1595eed466e1be9b7e26c5 SHA512 b1c073ad26684e354f7c522c14655840592e03872bc0a94690f89cae2ff88f146fce1dad252ff27a889dac4a32ff9f8ab63ba940671f9da89e9ba3e19f1bf58d WHIRLPOOL 2f0bc05a9c14033adc33cdd14d1dce72a57c650304692141a89af26274b62ffa67d09afbc68562d07279f80e214e396b357f20094ecf4b9576bc200cafa01a6d
+DIST zlib-1.2.8.tar.gz 571091 SHA256 36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d SHA512 ece209d4c7ec0cb58ede791444dc754e0d10811cbbdebe3df61c0fd9f9f9867c1c3ccd5f1827f847c005e24eef34fb5bf87b5d3f894d75da04f1797538290e4a WHIRLPOOL bcb6243f1a9370eafcea03c227938da1cc106c934193ce59ef4fbdca0167777b95c9baa376feb6d8d369023024a74de5df17c2b6ec5887cdb732ffc95808ef95
diff --git a/sys-libs/zlib/files/zlib-1.2.1-build-fPIC.patch b/sys-libs/zlib/files/zlib-1.2.1-build-fPIC.patch
new file mode 100644
index 000000000000..86d05c8a61c5
--- /dev/null
+++ b/sys-libs/zlib/files/zlib-1.2.1-build-fPIC.patch
@@ -0,0 +1,72 @@
+--- zlib-1.2.1/Makefile.in
++++ zlib-1.2.1/Makefile.in
+@@ -49,6 +49,8 @@
+ OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
+ zutil.o inflate.o infback.o inftrees.o inffast.o
+
++PIC_OBJS = $(OBJS:%.o=%.lo)
++
+ OBJA =
+ # to use the asm code: make OBJA=match.o
+
+@@ -77,8 +79,11 @@
+ mv _match.o match.o
+ rm -f _match.s
+
+-$(SHAREDLIBV): $(OBJS)
+- $(LDSHARED) -o $@ $(OBJS) -lc
++%.lo: %.c
++ $(CC) $(CFLAGS) -DPIC -fPIC -c $< -o $@
++
++$(SHAREDLIBV): $(PIC_OBJS)
++ $(LDSHARED) -o $@ $(PIC_OBJS) -lc
+ rm -f $(SHAREDLIB) $(SHAREDLIBM)
+ ln -s $@ $(SHAREDLIB)
+ ln -s $@ $(SHAREDLIBM)
+@@ -89,13 +94,10 @@
+ minigzip$(EXE): minigzip.o $(LIBS)
+ $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
+
+-install: $(LIBS)
++install-libs: $(LIBS)
+ -@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi
+- -@if [ ! -d $(includedir) ]; then mkdir -p $(includedir); fi
+ -@if [ ! -d $(libdir) ]; then mkdir -p $(libdir); fi
+ -@if [ ! -d $(man3dir) ]; then mkdir -p $(man3dir); fi
+- cp zlib.h zconf.h $(includedir)
+- chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h
+ cp $(LIBS) $(libdir)
+ cd $(libdir); chmod 755 $(LIBS)
+ -@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
+@@ -110,6 +112,11 @@
+ # The ranlib in install is needed on NeXTSTEP which checks file times
+ # ldconfig is for Linux
+
++install: install-libs
++ -@if [ ! -d $(includedir) ]; then mkdir $(includedir); fi
++ cp zlib.h zconf.h $(includedir)
++ chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h
++
+ uninstall:
+ cd $(includedir); \
+ cd $(libdir); rm -f libz.a; \
+@@ -127,7 +127,7 @@
+
+ mostlyclean: clean
+ clean:
+- rm -f *.o *~ example$(EXE) minigzip$(EXE) \
++ rm -f *.lo *.o *~ example$(EXE) minigzip$(EXE) \
+ libz.* foo.gz so_locations \
+ _match.s maketree contrib/infback9/*.o
+
+--- zlib-1.2.1/configure
++++ zlib-1.2.1/configure
+@@ -160,7 +160,7 @@
+ if test "`($CC -c $SFLAGS $test.c) 2>&1`" = "" &&
+ test "`($LDSHARED -o $test$shared_ext $test.o) 2>&1`" = ""; then
+ CFLAGS="$SFLAGS"
+- LIBS="$SHAREDLIBV"
++ LIBS="$LIBS $SHAREDLIBV"
+ echo Building shared library $SHAREDLIBV with $CC.
+ elif test -z "$old_cc" -a -z "$old_cflags"; then
+ echo No shared library support.
diff --git a/sys-libs/zlib/files/zlib-1.2.1-configure.patch b/sys-libs/zlib/files/zlib-1.2.1-configure.patch
new file mode 100644
index 000000000000..477fc5c26b53
--- /dev/null
+++ b/sys-libs/zlib/files/zlib-1.2.1-configure.patch
@@ -0,0 +1,103 @@
+--- configure.orig 2004-06-29 18:49:20.065187520 -0400
++++ configure 2004-06-29 18:52:54.142642800 -0400
+@@ -160,8 +160,8 @@
+ if test $shared -eq 1; then
+ echo Checking for shared library support...
+ # we must test in two steps (cc then ld), required at least on SunOS 4.x
+- if test "`($CC -c $SFLAGS $test.c) 2>&1`" = "" &&
+- test "`($LDSHARED -o $test$shared_ext $test.o) 2>&1`" = ""; then
++ if ($CC -c $SFLAGS $test.c) 2>/dev/null &&
++ ($LDSHARED -o $test$shared_ext $test.o) 2>/dev/null; then
+ CFLAGS="$SFLAGS"
+ LIBS="$LIBS $SHAREDLIBV"
+ echo Building shared library $SHAREDLIBV with $CC.
+@@ -185,7 +185,7 @@
+ #include <unistd.h>
+ int main() { return 0; }
+ EOF
+-if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
++if ($CC -c $CFLAGS $test.c) 2>/dev/null; then
+ sed < zconf.in.h "/HAVE_UNISTD_H/s%0%1%" > zconf.h
+ echo "Checking for unistd.h... Yes."
+ else
+@@ -208,7 +208,7 @@
+ }
+ EOF
+
+-if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
++if ($CC -c $CFLAGS $test.c) 2>/dev/null; then
+ echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()"
+
+ cat > $test.c <<EOF
+@@ -232,7 +232,7 @@
+ }
+ EOF
+
+- if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then
++ if ($CC $CFLAGS -o $test $test.c) 2>/dev/null; then
+ echo "Checking for vsnprintf() in stdio.h... Yes."
+
+ cat >$test.c <<EOF
+@@ -257,7 +257,7 @@
+ }
+ EOF
+
+- if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
++ if ($CC -c $CFLAGS $test.c) 2>/dev/null; then
+ echo "Checking for return value of vsnprintf()... Yes."
+ else
+ CFLAGS="$CFLAGS -DHAS_vsnprintf_void"
+@@ -295,7 +295,7 @@
+ }
+ EOF
+
+- if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
++ if ($CC -c $CFLAGS $test.c) 2>/dev/null; then
+ echo "Checking for return value of vsprintf()... Yes."
+ else
+ CFLAGS="$CFLAGS -DHAS_vsprintf_void"
+@@ -325,7 +325,7 @@
+ }
+ EOF
+
+- if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then
++ if ($CC $CFLAGS -o $test $test.c) 2>/dev/null; then
+ echo "Checking for snprintf() in stdio.h... Yes."
+
+ cat >$test.c <<EOF
+@@ -344,7 +344,7 @@
+ }
+ EOF
+
+- if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
++ if ($CC -c $CFLAGS $test.c) 2>/dev/null; then
+ echo "Checking for return value of snprintf()... Yes."
+ else
+ CFLAGS="$CFLAGS -DHAS_snprintf_void"
+@@ -376,7 +376,7 @@
+ }
+ EOF
+
+- if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
++ if ($CC -c $CFLAGS $test.c) 2>/dev/null; then
+ echo "Checking for return value of sprintf()... Yes."
+ else
+ CFLAGS="$CFLAGS -DHAS_sprintf_void"
+@@ -392,7 +392,7 @@
+ #include <errno.h>
+ int main() { return 0; }
+ EOF
+-if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
++if ($CC -c $CFLAGS $test.c) 2>/dev/null; then
+ echo "Checking for errno.h... Yes."
+ else
+ echo "Checking for errno.h... No."
+@@ -407,7 +407,7 @@
+ return mmap((caddr_t)0, (off_t)0, PROT_READ, MAP_SHARED, 0, (off_t)0);
+ }
+ EOF
+-if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
++if ($CC -c $CFLAGS $test.c) 2>/dev/null; then
+ CFLAGS="$CFLAGS -DUSE_MMAP"
+ echo Checking for mmap support... Yes.
+ else
diff --git a/sys-libs/zlib/files/zlib-1.2.1-fPIC.patch b/sys-libs/zlib/files/zlib-1.2.1-fPIC.patch
new file mode 100644
index 000000000000..5ccbddfd0fbe
--- /dev/null
+++ b/sys-libs/zlib/files/zlib-1.2.1-fPIC.patch
@@ -0,0 +1,16 @@
+--- zlib-1.2.1/configure
++++ zlib-1.2.1/configure
+@@ -73,7 +73,12 @@
+
+ if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then
+ CC="$cc"
+- SFLAGS=${CFLAGS-"-fPIC -O3"}
++ #SFLAGS=${CFLAGS-"-fPIC -O3"}
++ # the above is horribly wrong on a few archs where -fPIC should ALWAYS be
++ # used in the creation of shared libraries. without the following, the
++ # shared lib test will sometimes fail even when shared libs -can- be created.
++ SFLAGS=${CFLAGS-"-O3"}
++ SFLAGS="${SFLAGS} -fPIC"
+ CFLAGS="$cflags"
+ case `(uname -s || echo unknown) 2>/dev/null` in
+ Linux | linux | GNU | GNU/*)
diff --git a/sys-libs/zlib/files/zlib-1.2.1-glibc.patch b/sys-libs/zlib/files/zlib-1.2.1-glibc.patch
new file mode 100644
index 000000000000..db5e0df9fb58
--- /dev/null
+++ b/sys-libs/zlib/files/zlib-1.2.1-glibc.patch
@@ -0,0 +1,12 @@
+diff -urN zlib-1.2.1-old/Makefile.in zlib-1.2.1/Makefile.in
+--- zlib-1.2.1-old/Makefile.in 2003-11-08 18:29:23.000000000 -0800
++++ zlib-1.2.1/Makefile.in 2003-12-02 12:12:43.000000000 -0800
+@@ -78,7 +78,7 @@
+ rm -f _match.s
+
+ $(SHAREDLIBV): $(OBJS)
+- $(LDSHARED) -o $@ $(OBJS)
++ $(LDSHARED) -o $@ $(OBJS) -lc
+ rm -f $(SHAREDLIB) $(SHAREDLIBM)
+ ln -s $@ $(SHAREDLIB)
+ ln -s $@ $(SHAREDLIBM)
diff --git a/sys-libs/zlib/files/zlib-1.2.3-LDFLAGS.patch b/sys-libs/zlib/files/zlib-1.2.3-LDFLAGS.patch
new file mode 100644
index 000000000000..86da956eb5f4
--- /dev/null
+++ b/sys-libs/zlib/files/zlib-1.2.3-LDFLAGS.patch
@@ -0,0 +1,31 @@
+--- zlib-1.2.3/Makefile.in
++++ zlib-1.2.3/Makefile.in
+@@ -24,7 +24,7 @@
+ #CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
+ # -Wstrict-prototypes -Wmissing-prototypes
+
+-LDFLAGS=libz.a
++TEST_LDFLAGS=libz.a
+ LDSHARED=$(CC)
+ CPP=$(CC) -E
+
+@@ -83,16 +83,16 @@
+ $(CC) $(CFLAGS) -DPIC -fPIC -c $< -o $@
+
+ $(SHAREDLIBV): $(PIC_OBJS)
+- $(LDSHARED) -o $@ $(PIC_OBJS) -lc
++ $(LDSHARED) -o $@ $(PIC_OBJS) -lc $(LDFLAGS)
+ rm -f $(SHAREDLIB) $(SHAREDLIBM)
+ ln -s $@ $(SHAREDLIB)
+ ln -s $@ $(SHAREDLIBM)
+
+ example$(EXE): example.o $(LIBS)
+- $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS)
++ $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) $(TEST_LDFLAGS)
+
+ minigzip$(EXE): minigzip.o $(LIBS)
+- $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
++ $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) $(TEST_LDFLAGS)
+
+ install-libs: $(LIBS)
+ -@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi
diff --git a/sys-libs/zlib/files/zlib-1.2.3-build.patch b/sys-libs/zlib/files/zlib-1.2.3-build.patch
new file mode 100644
index 000000000000..10435b85fbd6
--- /dev/null
+++ b/sys-libs/zlib/files/zlib-1.2.3-build.patch
@@ -0,0 +1,66 @@
+--- zlib-1.2.3/configure
++++ zlib-1.2.3/configure
+@@ -23,7 +23,7 @@
+ VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`
+ VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < zlib.h`
+ VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < zlib.h`
+-AR=${AR-"ar rc"}
++AR=${AR-"ar"}
+ RANLIB=${RANLIB-"ranlib"}
+ prefix=${prefix-/usr/local}
+ exec_prefix=${exec_prefix-'${prefix}'}
+--- zlib-1.2.3/Makefile.in
++++ zlib-1.2.3/Makefile.in
+@@ -70,7 +70,7 @@
+ fi
+
+ libz.a: $(OBJS) $(OBJA)
+- $(AR) $@ $(OBJS) $(OBJA)
++ $(AR) rc $@ $(OBJS) $(OBJA)
+ -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
+
+ match.o: match.S
+--- zlib-1.2.3/win32/Makefile.gcc
++++ zlib-1.2.3/win32/Makefile.gcc
+@@ -30,21 +30,23 @@
+ #LOC = -DASMV
+ #LOC = -DDEBUG -g
+
+-CC = gcc
+-CFLAGS = $(LOC) -O3 -Wall
++CC ?= gcc
++CFLAGS ?= $(LOC) -O3 -Wall
+
+-AS = $(CC)
+-ASFLAGS = $(LOC) -Wall
++AS ?= $(CC)
++ASFLAGS ?= $(LOC) -Wall
+
+ LD = $(CC)
+-LDFLAGS = $(LOC) -s
++LDFLAGS ?= $(LOC) -s
+
+-AR = ar
++AR ?= ar
+ ARFLAGS = rcs
+
+-RC = windres
++RC ?= windres
+ RCFLAGS = --define GCC_WINDRES
+
++DLLWRAP ?= dllwrap
++
+ CP = cp -fp
+ # If GNU install is available, replace $(CP) with install.
+ INSTALL = $(CP)
+@@ -79,9 +81,8 @@
+ $(IMPLIB): $(SHAREDLIB)
+
+ $(SHAREDLIB): win32/zlib.def $(OBJS) $(OBJA) zlibrc.o
+- dllwrap --driver-name $(CC) --def win32/zlib.def \
++ $(DLLWRAP) --driver-name $(CC) --def win32/zlib.def \
+ --implib $(IMPLIB) -o $@ $(OBJS) $(OBJA) zlibrc.o
+- strip $@
+
+ example: example.o $(STATICLIB)
+ $(LD) $(LDFLAGS) -o $@ example.o $(STATICLIB)
diff --git a/sys-libs/zlib/files/zlib-1.2.3-mingw-implib.patch b/sys-libs/zlib/files/zlib-1.2.3-mingw-implib.patch
new file mode 100644
index 000000000000..9726237d56d0
--- /dev/null
+++ b/sys-libs/zlib/files/zlib-1.2.3-mingw-implib.patch
@@ -0,0 +1,13 @@
+http://bugs.gentoo.org/288212
+
+--- zlib-1.2.3/win32/Makefile.gcc
++++ zlib-1.2.3/win32/Makefile.gcc
+@@ -25,7 +25,7 @@
+
+ STATICLIB = libz.a
+ SHAREDLIB = zlib1.dll
+-IMPLIB = libzdll.a
++IMPLIB = libz.dll.a
+
+ #LOC = -DASMV
+ #LOC = -DDEBUG -g
diff --git a/sys-libs/zlib/files/zlib-1.2.3-r1-bsd-soname.patch b/sys-libs/zlib/files/zlib-1.2.3-r1-bsd-soname.patch
new file mode 100644
index 000000000000..872070b03027
--- /dev/null
+++ b/sys-libs/zlib/files/zlib-1.2.3-r1-bsd-soname.patch
@@ -0,0 +1,15 @@
+Generate a DT_SONAME on *BSD machines
+
+http://bugs.gentoo.org/123571
+
+--- configure
++++ configure
+@@ -80,7 +80,7 @@
+ SFLAGS="${CFLAGS-"-O3"} -fPIC"
+ CFLAGS="$cflags"
+ case `(uname -s || echo unknown) 2>/dev/null` in
+- Linux | linux | GNU | GNU/*) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1"};;
++ Linux | linux | GNU | GNU/* | *BSD | DragonFly) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1"};;
+ CYGWIN* | Cygwin* | cygwin* | OS/2* )
+ EXE='.exe';;
+ QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4
diff --git a/sys-libs/zlib/files/zlib-1.2.3-visibility-support.patch b/sys-libs/zlib/files/zlib-1.2.3-visibility-support.patch
new file mode 100644
index 000000000000..ceb065e9c7bb
--- /dev/null
+++ b/sys-libs/zlib/files/zlib-1.2.3-visibility-support.patch
@@ -0,0 +1,45 @@
+Only export symbols that should be exported.
+
+Patch by Mike Frysinger
+
+http://bugs.gentoo.org/32764
+http://bugs.gentoo.org/149929
+
+--- zlib-1.2.3/configure
++++ zlib-1.2.3/configure
+@@ -209,6 +209,20 @@
+ fi
+
+ cat > $test.c <<EOF
++int foo __attribute__ ((visibility ("hidden")));
++int main()
++{
++ return 0;
++}
++EOF
++if ($CC -c -fvisibility=hidden $CFLAGS $test.c) 2>/dev/null; then
++ CFLAGS="$CFLAGS -DHAS_attribute_visibility -fvisibility=hidden"
++ echo "Checking for attribute(visibility) support... Yes."
++else
++ echo "Checking for attribute(visibility) support... No."
++fi
++
++cat > $test.c <<EOF
+ #include <stdio.h>
+ #include <stdarg.h>
+ #include "zconf.h"
+--- zlib-1.2.3/zconf.in.h
++++ zlib-1.2.3/zconf.in.h
+@@ -244,7 +244,11 @@
+ #endif
+
+ #ifndef ZEXTERN
+-# define ZEXTERN extern
++# if defined(ZLIB_INTERNAL) && defined(HAS_attribute_visibility)
++# define ZEXTERN extern __attribute__ ((visibility("default")))
++# else
++# define ZEXTERN extern
++# endif
+ #endif
+ #ifndef ZEXPORT
+ # define ZEXPORT
diff --git a/sys-libs/zlib/files/zlib-1.2.4-minizip-autotools.patch b/sys-libs/zlib/files/zlib-1.2.4-minizip-autotools.patch
new file mode 100644
index 000000000000..81a62f0b1d18
--- /dev/null
+++ b/sys-libs/zlib/files/zlib-1.2.4-minizip-autotools.patch
@@ -0,0 +1,64 @@
+sniped & improved from Fedora
+
+--- zlib-1.2.4/contrib/minizip/configure.ac
++++ zlib-1.2.4/contrib/minizip/configure.ac
+@@ -0,0 +1,12 @@
++# -*- Autoconf -*-
++# Process this file with autoconf to produce a configure script.
++
++AC_INIT([minizip], [@ZLIB_VER@], [bugzilla.redhat.com])
++AC_CONFIG_SRCDIR([minigzip.c])
++AM_INIT_AUTOMAKE([foreign])
++LT_INIT
++
++AC_SUBST([HAVE_UNISTD_H], [0])
++AC_CHECK_HEADER([unistd.h], [HAVE_UNISTD_H=1], [])
++AC_CONFIG_FILES([Makefile minizip.pc])
++AC_OUTPUT
+--- zlib-1.2.4/contrib/minizip/Makefile.am
++++ zlib-1.2.4/contrib/minizip/Makefile.am
+@@ -0,0 +1,28 @@
++lib_LTLIBRARIES = libminizip.la
++
++libminizip_la_SOURCES = \
++ ioapi.c \
++ mztools.c \
++ unzip.c \
++ zip.c
++
++libminizip_la_CFLAGS = -I../.. -L../..
++libminizip_la_LDFLAGS = -version-info 1:0:0 -lz
++
++minizip_includedir = $(includedir)/minizip
++minizip_include_HEADERS = \
++ crypt.h \
++ ioapi.h \
++ mztools.h \
++ unzip.h \
++ zip.h
++
++pkgconfigdir = $(libdir)/pkgconfig
++pkgconfig_DATA = minizip.pc
++
++EXTRA_PROGRAMS = miniunzip minizip
++
++miniunzip_SOURCES = miniunz.c
++miniunzip_LDADD = libminizip.la
++
++minizip_SOURCES = minizip.c
++minizip_LDADD = libminizip.la
+--- zlib-1.2.4/contrib/minizip/minizip.pc.in
++++ zlib-1.2.4/contrib/minizip/minizip.pc.in
+@@ -0,0 +1,12 @@
++prefix=@prefix@
++exec_prefix=@exec_prefix@
++libdir=@libdir@
++includedir=@includedir@/minizip
++
++Name: minizip
++Description: Minizip zip file manipulation library
++Requires:
++Version: @PACKAGE_VERSION@
++Libs: -L${libdir} -lminizip
++Libs.private: -lz
++Cflags: -I${includedir}
diff --git a/sys-libs/zlib/files/zlib-1.2.5-fbsd_chosts.patch b/sys-libs/zlib/files/zlib-1.2.5-fbsd_chosts.patch
new file mode 100644
index 000000000000..9b1f8331029d
--- /dev/null
+++ b/sys-libs/zlib/files/zlib-1.2.5-fbsd_chosts.patch
@@ -0,0 +1,15 @@
+accept freebsd targets
+
+http://bugs.gentoo.org/316841
+
+--- zlib-1.2.5/configure
++++ zlib-1.2.5/configure
+@@ -118,7 +118,7 @@
+ uname=`(uname -s || echo unknown) 2>/dev/null`
+ fi
+ case "$uname" in
+- Linux* | linux* | GNU | GNU/* | *BSD | DragonFly) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"} ;;
++ Linux* | linux* | GNU | GNU/* | *BSD | DragonFly | freebsd* ) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"} ;;
+ CYGWIN* | Cygwin* | cygwin* | OS/2*)
+ EXE='.exe' ;;
+ MINGW*|mingw*)
diff --git a/sys-libs/zlib/files/zlib-1.2.5-ldflags.patch b/sys-libs/zlib/files/zlib-1.2.5-ldflags.patch
new file mode 100644
index 000000000000..dff534b457c3
--- /dev/null
+++ b/sys-libs/zlib/files/zlib-1.2.5-ldflags.patch
@@ -0,0 +1,22 @@
+http://bugs.gentoo.org/319661
+
+LDFLAGS is only used with the shared lib, so dont link against the static zlib
+
+--- a/configure
++++ b/configure
+@@ -19,7 +19,6 @@
+ fi
+
+ STATICLIB=libz.a
+-LDFLAGS="${LDFLAGS} -L. ${STATICLIB}"
+ VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`
+ VER3=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/p' < zlib.h`
+ VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < zlib.h`
+@@ -174,7 +173,6 @@
+ LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;;
+ OSF1\ V4*) SFLAGS=${CFLAGS-"-O -std1"}
+ CFLAGS=${CFLAGS-"-O -std1"}
+- LDFLAGS="${LDFLAGS} -Wl,-rpath,."
+ LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so -Wl,-msym -Wl,-rpath,$(libdir) -Wl,-set_version,${VER}:1.0"} ;;
+ OSF1*) SFLAGS=${CFLAGS-"-O -std1"}
+ CFLAGS=${CFLAGS-"-O -std1"}
diff --git a/sys-libs/zlib/files/zlib-1.2.5-lfs-decls.patch b/sys-libs/zlib/files/zlib-1.2.5-lfs-decls.patch
new file mode 100644
index 000000000000..8d7343084059
--- /dev/null
+++ b/sys-libs/zlib/files/zlib-1.2.5-lfs-decls.patch
@@ -0,0 +1,15 @@
+http://bugs.gentoo.org/316377
+
+try to unbreak over-eager LFS logic in zlib header
+
+--- zlib-1.2.5/zlib.h
++++ zlib-1.2.5/zlib.h
+@@ -1578,7 +1578,7 @@
+ # define gzoffset gzoffset64
+ # define adler32_combine adler32_combine64
+ # define crc32_combine crc32_combine64
+-# ifdef _LARGEFILE64_SOURCE
++# ifndef _LARGEFILE64_SOURCE
+ ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
+ ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
+ ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));
diff --git a/sys-libs/zlib/files/zlib-1.2.5.1-symlinks.patch b/sys-libs/zlib/files/zlib-1.2.5.1-symlinks.patch
new file mode 100644
index 000000000000..e747b01135a5
--- /dev/null
+++ b/sys-libs/zlib/files/zlib-1.2.5.1-symlinks.patch
@@ -0,0 +1,33 @@
+From e41d99c135935b849e1e639632937829ff2000d8 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Sun, 11 Sep 2011 14:32:53 -0400
+Subject: [PATCH] use relative symlinks for shared libs
+
+The DESTDIR should not be encoded into symlinks as it is only a
+temporary path. Further, since we install the symlinks into the
+same dir as the files, let's use relative links so that they can
+always resolve.
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ Makefile.in | 4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index 861970d..299bd1d 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -176,8 +176,8 @@ install-libs: $(LIBS)
+ chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \
+ echo "chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV)"; \
+ rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
+- ln -s $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB); \
+- ln -s $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
++ ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB); \
++ ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
+ ($(LDCONFIG) || true) >/dev/null 2>&1; \
+ fi
+ cp zlib.3 $(DESTDIR)$(man3dir)
+--
+1.7.6
+
diff --git a/sys-libs/zlib/files/zlib-1.2.5.1-version.patch b/sys-libs/zlib/files/zlib-1.2.5.1-version.patch
new file mode 100644
index 000000000000..afaa1f050518
--- /dev/null
+++ b/sys-libs/zlib/files/zlib-1.2.5.1-version.patch
@@ -0,0 +1,22 @@
+From 70386acb30b690fc9fcfdac9e01c8ca29ff20ef5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?T=C3=B6r=C3=B6k=20Edwin?= <edwintorok@gmail.com>
+Date: Sun, 11 Sep 2011 10:00:52 +0300
+Subject: [PATCH] fix ld error: unable to find version dependency `ZLIB_1.2.5'
+
+---
+ zlib.map | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/zlib.map b/zlib.map
+index 65bcf17..f65a125 100644
+--- a/zlib.map
++++ b/zlib.map
+@@ -69,4 +69,4 @@ ZLIB_1.2.3.5 {
+
+ ZLIB_1.2.5.1 {
+ deflatePending;
+-} ZLIB_1.2.5;
++} ZLIB_1.2.3.5;
+--
+1.7.5.4
+
diff --git a/sys-libs/zlib/metadata.xml b/sys-libs/zlib/metadata.xml
new file mode 100644
index 000000000000..b2dbe04926fa
--- /dev/null
+++ b/sys-libs/zlib/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>base-system</herd>
+ <use>
+ <flag name="minizip">include the minizip library for quick and dirty zip extraction</flag>
+ </use>
+ <upstream>
+ <remote-id type="cpe">cpe:/a:gnu:zlib</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-libs/zlib/zlib-1.2.3-r1.ebuild b/sys-libs/zlib/zlib-1.2.3-r1.ebuild
new file mode 100644
index 000000000000..ffbe7730e630
--- /dev/null
+++ b/sys-libs/zlib/zlib-1.2.3-r1.ebuild
@@ -0,0 +1,78 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils flag-o-matic toolchain-funcs multilib
+
+DESCRIPTION="Standard (de)compression library"
+HOMEPAGE="http://www.zlib.net/"
+SRC_URI="http://www.gzip.org/zlib/${P}.tar.bz2
+ http://www.zlib.net/${P}.tar.bz2"
+
+LICENSE="ZLIB"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+RDEPEND=""
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epatch "${FILESDIR}"/${P}-build.patch
+ epatch "${FILESDIR}"/${P}-visibility-support.patch #149929
+ epatch "${FILESDIR}"/${PN}-1.2.1-glibc.patch
+ epatch "${FILESDIR}"/${PN}-1.2.1-build-fPIC.patch
+ epatch "${FILESDIR}"/${PN}-1.2.1-configure.patch #55434
+ epatch "${FILESDIR}"/${PN}-1.2.1-fPIC.patch
+ epatch "${FILESDIR}"/${PN}-1.2.3-r1-bsd-soname.patch #123571
+ epatch "${FILESDIR}"/${PN}-1.2.3-LDFLAGS.patch #126718
+ epatch "${FILESDIR}"/${PN}-1.2.3-mingw-implib.patch #288212
+ sed -i -e '/ldconfig/d' Makefile*
+}
+
+src_compile() {
+ tc-export AR CC RANLIB
+ case ${CHOST} in
+ *-mingw*|mingw*)
+ export RC=${CHOST}-windres DLLWRAP=${CHOST}-dllwrap
+ emake -f win32/Makefile.gcc prefix=/usr || die
+ ;;
+ *)
+ # not an autoconf script, so cant use econf
+ ./configure --shared --prefix=/usr --libdir=/$(get_libdir) || die
+ emake || die
+ ;;
+ esac
+}
+
+src_install() {
+ einstall libdir="${D}"/$(get_libdir) || die
+ rm "${D}"/$(get_libdir)/libz.a
+ insinto /usr/include
+ doins zconf.h zlib.h
+
+ doman zlib.3
+ dodoc FAQ README ChangeLog algorithm.txt
+
+ # we don't need the static lib in /lib
+ # as it's only for compiling against
+ dolib libz.a
+
+ # all the shared libs go into /lib
+ # for NFS based /usr
+ case ${CHOST} in
+ *-mingw*|mingw*)
+ dobin zlib1.dll || die
+ dolib libz.dll.a || die
+ ;;
+ *)
+ into /
+ dolib libz.so.${PV}
+ ( cd "${D}"/$(get_libdir) ; chmod 755 libz.so.* )
+ dosym libz.so.${PV} /$(get_libdir)/libz.so
+ dosym libz.so.${PV} /$(get_libdir)/libz.so.1
+ gen_usr_ldscript libz.so
+ ;;
+ esac
+}
diff --git a/sys-libs/zlib/zlib-1.2.5-r2.ebuild b/sys-libs/zlib/zlib-1.2.5-r2.ebuild
new file mode 100644
index 000000000000..efc81c6a95fa
--- /dev/null
+++ b/sys-libs/zlib/zlib-1.2.5-r2.ebuild
@@ -0,0 +1,72 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils toolchain-funcs multilib
+
+DESCRIPTION="Standard (de)compression library"
+HOMEPAGE="http://www.zlib.net/"
+SRC_URI="http://www.gzip.org/zlib/${P}.tar.bz2
+ http://www.zlib.net/${P}.tar.bz2"
+
+LICENSE="ZLIB"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+RDEPEND="!<dev-libs/libxml2-2.7.7" #309623
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ # trust exit status of the compiler rather than stderr #55434
+ # -if test "`(...) 2>&1`" = ""; then
+ # +if (...) 2>/dev/null; then
+ sed -i 's|\<test "`\([^"]*\) 2>&1`" = ""|\1 2>/dev/null|' configure || die
+
+ epatch "${FILESDIR}"/${P}-ldflags.patch #319661
+ epatch "${FILESDIR}"/${P}-lfs-decls.patch #316377
+ epatch "${FILESDIR}"/${P}-fbsd_chosts.patch #316841
+}
+
+src_compile() {
+ case ${CHOST} in
+ *-mingw*|mingw*)
+ emake -f win32/Makefile.gcc STRIP=true PREFIX=${CHOST}- || die
+ sed \
+ -e 's|@prefix@|/usr|g' \
+ -e 's|@exec_prefix@|${prefix}|g' \
+ -e 's|@libdir@|${exec_prefix}/'$(get_libdir)'|g' \
+ -e 's|@sharedlibdir@|${exec_prefix}/'$(get_libdir)'|g' \
+ -e 's|@includedir@|${prefix}/include|g' \
+ -e 's|@VERSION@|'${PV}'|g' \
+ zlib.pc.in > zlib.pc || die
+ ;;
+ *) # not an autoconf script, so can't use econf
+ ./configure --shared --prefix=/usr --libdir=/usr/$(get_libdir) || die
+ emake || die
+ ;;
+ esac
+}
+
+src_install() {
+ case ${CHOST} in
+ *-mingw*|mingw*)
+ emake -f win32/Makefile.gcc install \
+ BINARY_PATH="${D}/usr/bin" \
+ LIBRARY_PATH="${D}/usr/$(get_libdir)" \
+ INCLUDE_PATH="${D}/usr/include" \
+ SHARED_MODE=1 \
+ || die
+ insinto /usr/share/pkgconfig
+ doins zlib.pc || die
+ ;;
+
+ *)
+ emake install DESTDIR="${D}" LDCONFIG=: || die
+ gen_usr_ldscript -a z
+ ;;
+ esac
+
+ dodoc FAQ README ChangeLog doc/*.txt
+}
diff --git a/sys-libs/zlib/zlib-1.2.5.1-r1.ebuild b/sys-libs/zlib/zlib-1.2.5.1-r1.ebuild
new file mode 100644
index 000000000000..369f93de80a7
--- /dev/null
+++ b/sys-libs/zlib/zlib-1.2.5.1-r1.ebuild
@@ -0,0 +1,76 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils toolchain-funcs multilib
+
+DESCRIPTION="Standard (de)compression library"
+HOMEPAGE="http://www.zlib.net/"
+SRC_URI="http://www.gzip.org/zlib/${P}.tar.gz
+ http://www.zlib.net/current/beta/${P}.tar.gz"
+
+LICENSE="ZLIB"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+RDEPEND="!<dev-libs/libxml2-2.7.7" #309623
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ # trust exit status of the compiler rather than stderr #55434
+ # -if test "`(...) 2>&1`" = ""; then
+ # +if (...) 2>/dev/null; then
+ sed -i 's|\<test "`\([^"]*\) 2>&1`" = ""|\1 2>/dev/null|' configure || die
+
+ epatch "${FILESDIR}"/${P}-version.patch
+ epatch "${FILESDIR}"/${P}-symlinks.patch
+}
+
+echoit() { echo "$@"; "$@"; }
+src_compile() {
+ case ${CHOST} in
+ *-mingw*|mingw*)
+ emake -f win32/Makefile.gcc STRIP=true PREFIX=${CHOST}- || die
+ sed \
+ -e 's|@prefix@|/usr|g' \
+ -e 's|@exec_prefix@|${prefix}|g' \
+ -e 's|@libdir@|${exec_prefix}/'$(get_libdir)'|g' \
+ -e 's|@sharedlibdir@|${exec_prefix}/'$(get_libdir)'|g' \
+ -e 's|@includedir@|${prefix}/include|g' \
+ -e 's|@VERSION@|'${PV}'|g' \
+ zlib.pc.in > zlib.pc || die
+ ;;
+ *) # not an autoconf script, so can't use econf
+ echoit ./configure --shared --prefix=/usr --libdir=/usr/$(get_libdir) || die
+ emake || die
+ ;;
+ esac
+}
+
+src_install() {
+ case ${CHOST} in
+ *-mingw*|mingw*)
+ emake -f win32/Makefile.gcc install \
+ BINARY_PATH="${D}/usr/bin" \
+ LIBRARY_PATH="${D}/usr/$(get_libdir)" \
+ INCLUDE_PATH="${D}/usr/include" \
+ SHARED_MODE=1 \
+ || die
+ insinto /usr/share/pkgconfig
+ doins zlib.pc || die
+ ;;
+
+ *)
+ emake install DESTDIR="${D}" LDCONFIG=: || die
+ gen_usr_ldscript -a z
+ ;;
+ esac
+
+ # clean up namespace a little #383179
+ # we do it here so we only have to tweak 2 files
+ sed -i -r 's:\<(O[FN])\>:_Z_\1:g' "${D}"/usr/include/*.h
+
+ dodoc FAQ README ChangeLog doc/*.txt
+}
diff --git a/sys-libs/zlib/zlib-1.2.5.1-r2.ebuild b/sys-libs/zlib/zlib-1.2.5.1-r2.ebuild
new file mode 100644
index 000000000000..accca1051eaa
--- /dev/null
+++ b/sys-libs/zlib/zlib-1.2.5.1-r2.ebuild
@@ -0,0 +1,100 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit autotools eutils toolchain-funcs multilib
+
+DESCRIPTION="Standard (de)compression library"
+HOMEPAGE="http://www.zlib.net/"
+SRC_URI="http://www.gzip.org/zlib/${P}.tar.gz
+ http://www.zlib.net/current/beta/${P}.tar.gz"
+
+LICENSE="ZLIB"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+IUSE="minizip static-libs"
+
+RDEPEND="!<dev-libs/libxml2-2.7.7" #309623
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ # trust exit status of the compiler rather than stderr #55434
+ # -if test "`(...) 2>&1`" = ""; then
+ # +if (...) 2>/dev/null; then
+ sed -i 's|\<test "`\([^"]*\) 2>&1`" = ""|\1 2>/dev/null|' configure || die
+
+ epatch "${FILESDIR}"/${P}-version.patch
+ epatch "${FILESDIR}"/${P}-symlinks.patch
+ EPATCH_OPTS=-p1 epatch "${FILESDIR}"/${PN}-1.2.4-minizip-autotools.patch
+ if use minizip ; then
+ cd contrib/minizip
+ sed -i "s:@ZLIB_VER@:${PV}:" configure.ac || die
+ ln -s ../../minigzip.c || die
+ eautoreconf
+ fi
+}
+
+usex() { use $1 && echo ${2:-yes} || echo ${3:-no} ; }
+echoit() { echo "$@"; "$@"; }
+src_compile() {
+ case ${CHOST} in
+ *-mingw*|mingw*)
+ emake -f win32/Makefile.gcc STRIP=true PREFIX=${CHOST}- || die
+ sed \
+ -e 's|@prefix@|/usr|g' \
+ -e 's|@exec_prefix@|${prefix}|g' \
+ -e 's|@libdir@|${exec_prefix}/'$(get_libdir)'|g' \
+ -e 's|@sharedlibdir@|${exec_prefix}/'$(get_libdir)'|g' \
+ -e 's|@includedir@|${prefix}/include|g' \
+ -e 's|@VERSION@|'${PV}'|g' \
+ zlib.pc.in > zlib.pc || die
+ ;;
+ *) # not an autoconf script, so can't use econf
+ echoit ./configure --shared --prefix=/usr --libdir=/usr/$(get_libdir) || die
+ emake || die
+ ;;
+ esac
+ if use minizip ; then
+ cd contrib/minizip
+ econf $(use_enable static-libs static)
+ emake || die
+ fi
+}
+
+sed_macros() {
+ # clean up namespace a little #383179
+ # we do it here so we only have to tweak 2 files
+ sed -i -r 's:\<(O[FN])\>:_Z_\1:g' "$@" || die
+}
+src_install() {
+ case ${CHOST} in
+ *-mingw*|mingw*)
+ emake -f win32/Makefile.gcc install \
+ BINARY_PATH="${D}/usr/bin" \
+ LIBRARY_PATH="${D}/usr/$(get_libdir)" \
+ INCLUDE_PATH="${D}/usr/include" \
+ SHARED_MODE=1 \
+ || die
+ insinto /usr/share/pkgconfig
+ doins zlib.pc || die
+ ;;
+
+ *)
+ emake install DESTDIR="${D}" LDCONFIG=: || die
+ gen_usr_ldscript -a z
+ sed_macros "${D}"/usr/include/*.h
+ ;;
+ esac
+
+ dodoc FAQ README ChangeLog doc/*.txt
+
+ if use minizip ; then
+ cd contrib/minizip
+ emake install DESTDIR="${D}" || die
+ sed_macros "${D}"/usr/include/minizip/*.h
+ dodoc *.txt
+ fi
+
+ use static-libs || rm -f "${D}"/usr/$(get_libdir)/*.{a,la}
+}
diff --git a/sys-libs/zlib/zlib-1.2.5.1.ebuild b/sys-libs/zlib/zlib-1.2.5.1.ebuild
new file mode 100644
index 000000000000..7fff535df92e
--- /dev/null
+++ b/sys-libs/zlib/zlib-1.2.5.1.ebuild
@@ -0,0 +1,72 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils toolchain-funcs multilib
+
+DESCRIPTION="Standard (de)compression library"
+HOMEPAGE="http://www.zlib.net/"
+SRC_URI="http://www.gzip.org/zlib/${P}.tar.gz
+ http://www.zlib.net/current/beta/${P}.tar.gz"
+
+LICENSE="ZLIB"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+RDEPEND="!<dev-libs/libxml2-2.7.7" #309623
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ # trust exit status of the compiler rather than stderr #55434
+ # -if test "`(...) 2>&1`" = ""; then
+ # +if (...) 2>/dev/null; then
+ sed -i 's|\<test "`\([^"]*\) 2>&1`" = ""|\1 2>/dev/null|' configure || die
+
+ epatch "${FILESDIR}"/${P}-version.patch
+ epatch "${FILESDIR}"/${P}-symlinks.patch
+}
+
+echoit() { echo "$@"; "$@"; }
+src_compile() {
+ case ${CHOST} in
+ *-mingw*|mingw*)
+ emake -f win32/Makefile.gcc STRIP=true PREFIX=${CHOST}- || die
+ sed \
+ -e 's|@prefix@|/usr|g' \
+ -e 's|@exec_prefix@|${prefix}|g' \
+ -e 's|@libdir@|${exec_prefix}/'$(get_libdir)'|g' \
+ -e 's|@sharedlibdir@|${exec_prefix}/'$(get_libdir)'|g' \
+ -e 's|@includedir@|${prefix}/include|g' \
+ -e 's|@VERSION@|'${PV}'|g' \
+ zlib.pc.in > zlib.pc || die
+ ;;
+ *) # not an autoconf script, so can't use econf
+ echoit ./configure --shared --prefix=/usr --libdir=/usr/$(get_libdir) || die
+ emake || die
+ ;;
+ esac
+}
+
+src_install() {
+ case ${CHOST} in
+ *-mingw*|mingw*)
+ emake -f win32/Makefile.gcc install \
+ BINARY_PATH="${D}/usr/bin" \
+ LIBRARY_PATH="${D}/usr/$(get_libdir)" \
+ INCLUDE_PATH="${D}/usr/include" \
+ SHARED_MODE=1 \
+ || die
+ insinto /usr/share/pkgconfig
+ doins zlib.pc || die
+ ;;
+
+ *)
+ emake install DESTDIR="${D}" LDCONFIG=: || die
+ gen_usr_ldscript -a z
+ ;;
+ esac
+
+ dodoc FAQ README ChangeLog doc/*.txt
+}
diff --git a/sys-libs/zlib/zlib-1.2.6.ebuild b/sys-libs/zlib/zlib-1.2.6.ebuild
new file mode 100644
index 000000000000..34683f710391
--- /dev/null
+++ b/sys-libs/zlib/zlib-1.2.6.ebuild
@@ -0,0 +1,93 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+AUTOTOOLS_AUTO_DEPEND="no"
+inherit autotools eutils toolchain-funcs multilib
+
+DESCRIPTION="Standard (de)compression library"
+HOMEPAGE="http://www.zlib.net/"
+SRC_URI="http://zlib.net/${P}.tar.gz
+ http://www.gzip.org/zlib/${P}.tar.gz
+ http://www.zlib.net/current/beta/${P}.tar.gz"
+
+LICENSE="ZLIB"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE="minizip static-libs"
+
+DEPEND="minizip? ( ${AUTOTOOLS_DEPEND} )"
+RDEPEND="!<dev-libs/libxml2-2.7.7" #309623
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+
+ if use minizip ; then
+ cd contrib/minizip
+ eautoreconf
+ fi
+}
+
+echoit() { echo "$@"; "$@"; }
+src_compile() {
+ case ${CHOST} in
+ *-mingw*|mingw*)
+ emake -f win32/Makefile.gcc STRIP=true PREFIX=${CHOST}- || die
+ sed \
+ -e 's|@prefix@|/usr|g' \
+ -e 's|@exec_prefix@|${prefix}|g' \
+ -e 's|@libdir@|${exec_prefix}/'$(get_libdir)'|g' \
+ -e 's|@sharedlibdir@|${exec_prefix}/'$(get_libdir)'|g' \
+ -e 's|@includedir@|${prefix}/include|g' \
+ -e 's|@VERSION@|'${PV}'|g' \
+ zlib.pc.in > zlib.pc || die
+ ;;
+ *) # not an autoconf script, so can't use econf
+ echoit ./configure --shared --prefix=/usr --libdir=/usr/$(get_libdir) || die
+ emake || die
+ ;;
+ esac
+ if use minizip ; then
+ cd contrib/minizip
+ econf $(use_enable static-libs static)
+ emake || die
+ fi
+}
+
+sed_macros() {
+ # clean up namespace a little #383179
+ # we do it here so we only have to tweak 2 files
+ sed -i -r 's:\<(O[FN])\>:_Z_\1:g' "$@" || die
+}
+src_install() {
+ case ${CHOST} in
+ *-mingw*|mingw*)
+ emake -f win32/Makefile.gcc install \
+ BINARY_PATH="${D}/usr/bin" \
+ LIBRARY_PATH="${D}/usr/$(get_libdir)" \
+ INCLUDE_PATH="${D}/usr/include" \
+ SHARED_MODE=1 \
+ || die
+ insinto /usr/share/pkgconfig
+ doins zlib.pc || die
+ ;;
+
+ *)
+ emake install DESTDIR="${D}" LDCONFIG=: || die
+ gen_usr_ldscript -a z
+ ;;
+ esac
+ sed_macros "${D}"/usr/include/*.h
+
+ dodoc FAQ README ChangeLog doc/*.txt
+
+ if use minizip ; then
+ cd contrib/minizip
+ emake install DESTDIR="${D}" || die
+ sed_macros "${D}"/usr/include/minizip/*.h
+ dodoc *.txt
+ fi
+
+ use static-libs || rm -f "${D}"/usr/$(get_libdir)/*.{a,la}
+}
diff --git a/sys-libs/zlib/zlib-1.2.7.ebuild b/sys-libs/zlib/zlib-1.2.7.ebuild
new file mode 100644
index 000000000000..3155b6bb2f54
--- /dev/null
+++ b/sys-libs/zlib/zlib-1.2.7.ebuild
@@ -0,0 +1,99 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+AUTOTOOLS_AUTO_DEPEND="no"
+inherit autotools toolchain-funcs multilib
+
+DESCRIPTION="Standard (de)compression library"
+HOMEPAGE="http://www.zlib.net/"
+SRC_URI="http://zlib.net/${P}.tar.gz
+ http://www.gzip.org/zlib/${P}.tar.gz
+ http://www.zlib.net/current/beta/${P}.tar.gz"
+
+LICENSE="ZLIB"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE="minizip static-libs"
+
+DEPEND="minizip? ( ${AUTOTOOLS_DEPEND} )"
+RDEPEND="!<dev-libs/libxml2-2.7.7" #309623
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+
+ if use minizip ; then
+ cd contrib/minizip
+ eautoreconf
+ fi
+}
+
+echoit() { echo "$@"; "$@"; }
+src_compile() {
+ case ${CHOST} in
+ *-mingw*|mingw*)
+ emake -f win32/Makefile.gcc STRIP=true PREFIX=${CHOST}- || die
+ sed \
+ -e 's|@prefix@|/usr|g' \
+ -e 's|@exec_prefix@|${prefix}|g' \
+ -e 's|@libdir@|${exec_prefix}/'$(get_libdir)'|g' \
+ -e 's|@sharedlibdir@|${exec_prefix}/'$(get_libdir)'|g' \
+ -e 's|@includedir@|${prefix}/include|g' \
+ -e 's|@VERSION@|'${PV}'|g' \
+ zlib.pc.in > zlib.pc || die
+ ;;
+ *) # not an autoconf script, so can't use econf
+ local uname=$(/usr/share/gnuconfig/config.sub "${CHOST}" | cut -d- -f3) #347167
+ echoit ./configure \
+ --shared \
+ --prefix=/usr \
+ --libdir=/usr/$(get_libdir) \
+ ${uname:+--uname=${uname}} \
+ || die
+ emake || die
+ ;;
+ esac
+ if use minizip ; then
+ cd contrib/minizip
+ econf $(use_enable static-libs static)
+ emake || die
+ fi
+}
+
+sed_macros() {
+ # clean up namespace a little #383179
+ # we do it here so we only have to tweak 2 files
+ sed -i -r 's:\<(O[FN])\>:_Z_\1:g' "$@" || die
+}
+src_install() {
+ case ${CHOST} in
+ *-mingw*|mingw*)
+ emake -f win32/Makefile.gcc install \
+ BINARY_PATH="${D}/usr/bin" \
+ LIBRARY_PATH="${D}/usr/$(get_libdir)" \
+ INCLUDE_PATH="${D}/usr/include" \
+ SHARED_MODE=1 \
+ || die
+ insinto /usr/share/pkgconfig
+ doins zlib.pc || die
+ ;;
+
+ *)
+ emake install DESTDIR="${D}" LDCONFIG=: || die
+ gen_usr_ldscript -a z
+ ;;
+ esac
+ sed_macros "${D}"/usr/include/*.h
+
+ dodoc FAQ README ChangeLog doc/*.txt
+
+ if use minizip ; then
+ cd contrib/minizip
+ emake install DESTDIR="${D}" || die
+ sed_macros "${D}"/usr/include/minizip/*.h
+ dodoc *.txt
+ fi
+
+ use static-libs || rm -f "${D}"/usr/$(get_libdir)/lib{z,minizip}.{a,la} #419645
+}
diff --git a/sys-libs/zlib/zlib-1.2.8-r1.ebuild b/sys-libs/zlib/zlib-1.2.8-r1.ebuild
new file mode 100644
index 000000000000..43a555a12a49
--- /dev/null
+++ b/sys-libs/zlib/zlib-1.2.8-r1.ebuild
@@ -0,0 +1,116 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+AUTOTOOLS_AUTO_DEPEND="no"
+
+inherit autotools toolchain-funcs multilib multilib-minimal
+
+DESCRIPTION="Standard (de)compression library"
+HOMEPAGE="http://www.zlib.net/"
+SRC_URI="http://zlib.net/${P}.tar.gz
+ http://www.gzip.org/zlib/${P}.tar.gz
+ http://www.zlib.net/current/beta/${P}.tar.gz"
+
+LICENSE="ZLIB"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE="minizip static-libs"
+
+DEPEND="minizip? ( ${AUTOTOOLS_DEPEND} )"
+RDEPEND="abi_x86_32? (
+ !<=app-emulation/emul-linux-x86-baselibs-20130224
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ )
+ !<dev-libs/libxml2-2.7.7" #309623
+
+src_prepare() {
+ if use minizip ; then
+ cd contrib/minizip || die
+ eautoreconf
+ fi
+
+ multilib_copy_sources
+}
+
+echoit() { echo "$@"; "$@"; }
+
+multilib_src_configure() {
+ case ${CHOST} in
+ *-mingw*|mingw*)
+ ;;
+ *) # not an autoconf script, so can't use econf
+ local uname=$("${EPREFIX}"/usr/share/gnuconfig/config.sub "${CHOST}" | cut -d- -f3) #347167
+ echoit ./configure \
+ --shared \
+ --prefix="${EPREFIX}/usr" \
+ --libdir="${EPREFIX}/usr/$(get_libdir)" \
+ ${uname:+--uname=${uname}} \
+ || die
+ ;;
+ esac
+
+ if use minizip ; then
+ cd contrib/minizip || die
+ econf $(use_enable static-libs static)
+ fi
+}
+
+multilib_src_compile() {
+ case ${CHOST} in
+ *-mingw*|mingw*)
+ emake -f win32/Makefile.gcc STRIP=true PREFIX=${CHOST}-
+ sed \
+ -e 's|@prefix@|${EPREFIX}/usr|g' \
+ -e 's|@exec_prefix@|${prefix}|g' \
+ -e 's|@libdir@|${exec_prefix}/'$(get_libdir)'|g' \
+ -e 's|@sharedlibdir@|${exec_prefix}/'$(get_libdir)'|g' \
+ -e 's|@includedir@|${prefix}/include|g' \
+ -e 's|@VERSION@|'${PV}'|g' \
+ zlib.pc.in > zlib.pc || die
+ ;;
+ *)
+ emake
+ ;;
+ esac
+ use minizip && emake -C contrib/minizip
+}
+
+sed_macros() {
+ # clean up namespace a little #383179
+ # we do it here so we only have to tweak 2 files
+ sed -i -r 's:\<(O[FN])\>:_Z_\1:g' "$@" || die
+}
+
+multilib_src_install() {
+ case ${CHOST} in
+ *-mingw*|mingw*)
+ emake -f win32/Makefile.gcc install \
+ BINARY_PATH="${ED}/usr/bin" \
+ LIBRARY_PATH="${ED}/usr/$(get_libdir)" \
+ INCLUDE_PATH="${ED}/usr/include" \
+ SHARED_MODE=1
+ insinto /usr/share/pkgconfig
+ doins zlib.pc
+ ;;
+
+ *)
+ emake install DESTDIR="${D}" LDCONFIG=:
+ gen_usr_ldscript -a z
+ ;;
+ esac
+ sed_macros "${ED}"/usr/include/*.h
+
+ if use minizip ; then
+ emake -C contrib/minizip install DESTDIR="${D}"
+ sed_macros "${ED}"/usr/include/minizip/*.h
+ fi
+
+ use static-libs || rm -f "${ED}"/usr/$(get_libdir)/lib{z,minizip}.{a,la} #419645
+}
+
+multilib_src_install_all() {
+ dodoc FAQ README ChangeLog doc/*.txt
+ use minizip && dodoc contrib/minizip/*.txt
+}
diff --git a/sys-libs/zlib/zlib-1.2.8.ebuild b/sys-libs/zlib/zlib-1.2.8.ebuild
new file mode 100644
index 000000000000..af06d91d91b0
--- /dev/null
+++ b/sys-libs/zlib/zlib-1.2.8.ebuild
@@ -0,0 +1,99 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+AUTOTOOLS_AUTO_DEPEND="no"
+inherit autotools toolchain-funcs multilib
+
+DESCRIPTION="Standard (de)compression library"
+HOMEPAGE="http://www.zlib.net/"
+SRC_URI="http://zlib.net/${P}.tar.gz
+ http://www.gzip.org/zlib/${P}.tar.gz
+ http://www.zlib.net/current/beta/${P}.tar.gz"
+
+LICENSE="ZLIB"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE="minizip static-libs"
+
+DEPEND="minizip? ( ${AUTOTOOLS_DEPEND} )"
+RDEPEND="!<dev-libs/libxml2-2.7.7" #309623
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+
+ if use minizip ; then
+ cd contrib/minizip
+ eautoreconf
+ fi
+}
+
+echoit() { echo "$@"; "$@"; }
+src_compile() {
+ case ${CHOST} in
+ *-mingw*|mingw*)
+ emake -f win32/Makefile.gcc STRIP=true PREFIX=${CHOST}- || die
+ sed \
+ -e 's|@prefix@|/usr|g' \
+ -e 's|@exec_prefix@|${prefix}|g' \
+ -e 's|@libdir@|${exec_prefix}/'$(get_libdir)'|g' \
+ -e 's|@sharedlibdir@|${exec_prefix}/'$(get_libdir)'|g' \
+ -e 's|@includedir@|${prefix}/include|g' \
+ -e 's|@VERSION@|'${PV}'|g' \
+ zlib.pc.in > zlib.pc || die
+ ;;
+ *) # not an autoconf script, so can't use econf
+ local uname=$(/usr/share/gnuconfig/config.sub "${CHOST}" | cut -d- -f3) #347167
+ echoit ./configure \
+ --shared \
+ --prefix=/usr \
+ --libdir=/usr/$(get_libdir) \
+ ${uname:+--uname=${uname}} \
+ || die
+ emake || die
+ ;;
+ esac
+ if use minizip ; then
+ cd contrib/minizip
+ econf $(use_enable static-libs static)
+ emake || die
+ fi
+}
+
+sed_macros() {
+ # clean up namespace a little #383179
+ # we do it here so we only have to tweak 2 files
+ sed -i -r 's:\<(O[FN])\>:_Z_\1:g' "$@" || die
+}
+src_install() {
+ case ${CHOST} in
+ *-mingw*|mingw*)
+ emake -f win32/Makefile.gcc install \
+ BINARY_PATH="${D}/usr/bin" \
+ LIBRARY_PATH="${D}/usr/$(get_libdir)" \
+ INCLUDE_PATH="${D}/usr/include" \
+ SHARED_MODE=1 \
+ || die
+ insinto /usr/share/pkgconfig
+ doins zlib.pc || die
+ ;;
+
+ *)
+ emake install DESTDIR="${D}" LDCONFIG=: || die
+ gen_usr_ldscript -a z
+ ;;
+ esac
+ sed_macros "${D}"/usr/include/*.h
+
+ dodoc FAQ README ChangeLog doc/*.txt
+
+ if use minizip ; then
+ cd contrib/minizip
+ emake install DESTDIR="${D}" || die
+ sed_macros "${D}"/usr/include/minizip/*.h
+ dodoc *.txt
+ fi
+
+ use static-libs || rm -f "${D}"/usr/$(get_libdir)/lib{z,minizip}.{a,la} #419645
+}