summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-devel')
-rw-r--r--sys-devel/autoconf-archive/Manifest6
-rw-r--r--sys-devel/autoconf-archive/autoconf-archive-2012.09.08.ebuild21
-rw-r--r--sys-devel/autoconf-archive/autoconf-archive-2013.06.09.ebuild21
-rw-r--r--sys-devel/autoconf-archive/autoconf-archive-2013.11.01.ebuild21
-rw-r--r--sys-devel/autoconf-archive/autoconf-archive-2014.02.28.ebuild21
-rw-r--r--sys-devel/autoconf-archive/autoconf-archive-2015.02.04.ebuild26
-rw-r--r--sys-devel/autoconf-archive/autoconf-archive-2015.02.24.ebuild26
-rw-r--r--sys-devel/autoconf-archive/metadata.xml9
-rw-r--r--sys-devel/autoconf-wrapper/autoconf-wrapper-13.ebuild27
-rwxr-xr-xsys-devel/autoconf-wrapper/files/ac-wrapper-13.sh202
-rw-r--r--sys-devel/autoconf-wrapper/metadata.xml5
-rw-r--r--sys-devel/autoconf/Manifest10
-rw-r--r--sys-devel/autoconf/autoconf-2.13.ebuild57
-rw-r--r--sys-devel/autoconf/autoconf-2.59-r7.ebuild33
-rw-r--r--sys-devel/autoconf/autoconf-2.61-r2.ebuild39
-rw-r--r--sys-devel/autoconf/autoconf-2.62-r1.ebuild35
-rw-r--r--sys-devel/autoconf/autoconf-2.63-r1.ebuild33
-rw-r--r--sys-devel/autoconf/autoconf-2.64.ebuild27
-rw-r--r--sys-devel/autoconf/autoconf-2.65-r1.ebuild33
-rw-r--r--sys-devel/autoconf/autoconf-2.67.ebuild27
-rw-r--r--sys-devel/autoconf/autoconf-2.68.ebuild27
-rw-r--r--sys-devel/autoconf/autoconf-2.69-r1.ebuild39
-rw-r--r--sys-devel/autoconf/autoconf-2.69.ebuild58
-rw-r--r--sys-devel/autoconf/autoconf-9999.ebuild48
-rw-r--r--sys-devel/autoconf/files/autoconf-2.13-destdir.patch26
-rw-r--r--sys-devel/autoconf/files/autoconf-2.13-gentoo.patch36
-rw-r--r--sys-devel/autoconf/files/autoconf-2.13-test-fixes.patch18
-rw-r--r--sys-devel/autoconf/files/autoconf-2.59-more-quotes.patch34
-rw-r--r--sys-devel/autoconf/files/autoconf-2.60-tests.patch22
-rw-r--r--sys-devel/autoconf/files/autoconf-2.61-GETMNTENT.patch23
-rw-r--r--sys-devel/autoconf/files/autoconf-2.62-at-keywords.patch81
-rw-r--r--sys-devel/autoconf/files/autoconf-2.62-fix-multiline-string.patch30
-rw-r--r--sys-devel/autoconf/files/autoconf-2.62-revert-AC_C_BIGENDIAN.patch214
-rw-r--r--sys-devel/autoconf/files/autoconf-2.63-sh.patch32
-rw-r--r--sys-devel/autoconf/files/autoconf-2.65-AC_TYPE_INT_T.patch49
-rw-r--r--sys-devel/autoconf/files/eblits/main.eblit48
-rw-r--r--sys-devel/autoconf/files/eblits/src_configure.eblit12
-rw-r--r--sys-devel/autoconf/files/eblits/src_install.eblit39
-rw-r--r--sys-devel/autoconf/files/eblits/src_prepare.eblit9
-rw-r--r--sys-devel/autoconf/metadata.xml8
-rw-r--r--sys-devel/autogen/Manifest6
-rw-r--r--sys-devel/autogen/autogen-5.15.ebuild26
-rw-r--r--sys-devel/autogen/autogen-5.17.3.ebuild38
-rw-r--r--sys-devel/autogen/autogen-5.17.4.ebuild36
-rw-r--r--sys-devel/autogen/autogen-5.18.1.ebuild36
-rw-r--r--sys-devel/autogen/autogen-5.18.2.ebuild36
-rw-r--r--sys-devel/autogen/autogen-5.18.4.ebuild36
-rw-r--r--sys-devel/autogen/files/autogen-5.17.3-libintl.patch12
-rw-r--r--sys-devel/autogen/metadata.xml8
-rw-r--r--sys-devel/automake-wrapper/automake-wrapper-10.ebuild35
-rw-r--r--sys-devel/automake-wrapper/automake-wrapper-9.ebuild29
-rw-r--r--sys-devel/automake-wrapper/files/am-wrapper-10.sh187
-rwxr-xr-xsys-devel/automake-wrapper/files/am-wrapper-9.sh187
-rw-r--r--sys-devel/automake-wrapper/metadata.xml5
-rw-r--r--sys-devel/automake/Manifest12
-rw-r--r--sys-devel/automake/automake-1.10.3-r1.ebuild82
-rw-r--r--sys-devel/automake/automake-1.11.6-r1.ebuild90
-rw-r--r--sys-devel/automake/automake-1.12.6.ebuild85
-rw-r--r--sys-devel/automake/automake-1.13.4.ebuild90
-rw-r--r--sys-devel/automake/automake-1.14.1.ebuild102
-rw-r--r--sys-devel/automake/automake-1.15.ebuild102
-rw-r--r--sys-devel/automake/automake-1.4_p6-r2.ebuild84
-rw-r--r--sys-devel/automake/automake-1.5-r2.ebuild80
-rw-r--r--sys-devel/automake/automake-1.6.3-r2.ebuild73
-rw-r--r--sys-devel/automake/automake-1.7.9-r3.ebuild76
-rw-r--r--sys-devel/automake/automake-1.8.5-r5.ebuild76
-rw-r--r--sys-devel/automake/automake-1.9.6-r4.ebuild84
-rw-r--r--sys-devel/automake/automake-9999.ebuild91
-rw-r--r--sys-devel/automake/files/automake-1.10-ccnoco-ldflags.patch35
-rw-r--r--sys-devel/automake/files/automake-1.10-perl-5.16.patch128
-rw-r--r--sys-devel/automake/files/automake-1.10.1-tests.patch111
-rw-r--r--sys-devel/automake/files/automake-1.10.2-bash4.patch22
-rw-r--r--sys-devel/automake/files/automake-1.13-dyn-ithreads.patch59
-rw-r--r--sys-devel/automake/files/automake-1.4-CVE-2009-4029.patch65
-rw-r--r--sys-devel/automake/files/automake-1.4-ansi2knr-stdlib.patch11
-rw-r--r--sys-devel/automake/files/automake-1.4-libtoolize.patch17
-rw-r--r--sys-devel/automake/files/automake-1.4-nls-nuisances.patch19
-rw-r--r--sys-devel/automake/files/automake-1.4-perl-5.11.patch28
-rw-r--r--sys-devel/automake/files/automake-1.4-perl-dyn-call.patch23
-rw-r--r--sys-devel/automake/files/automake-1.4-subdirs-89656.patch22
-rw-r--r--sys-devel/automake/files/automake-1.5-CVE-2009-4029.patch60
-rw-r--r--sys-devel/automake/files/automake-1.5-perl-5.11.patch28
-rw-r--r--sys-devel/automake/files/automake-1.5-slot.patch42
-rw-r--r--sys-devel/automake/files/automake-1.5-target_hook.patch36
-rw-r--r--sys-devel/automake/files/automake-1.5-test-fixes.patch65
-rw-r--r--sys-devel/automake/files/automake-1.6.3-test-fixes.patch28
-rw-r--r--sys-devel/automake/files/automake-1.7.9-infopage-namechange.patch15
-rw-r--r--sys-devel/automake/files/automake-1.7.9-libtool-2.patch43
-rw-r--r--sys-devel/automake/files/automake-1.7.9-test-fixes.patch46
-rw-r--r--sys-devel/automake/files/automake-1.8-perl-5.11.patch30
-rw-r--r--sys-devel/automake/files/automake-1.8.2-infopage-namechange.patch36
-rw-r--r--sys-devel/automake/files/automake-1.8.5-CVE-2009-4029.patch60
-rw-r--r--sys-devel/automake/files/automake-1.8.5-test-fixes.patch43
-rw-r--r--sys-devel/automake/files/automake-1.9.6-aclocal7-test-sleep.patch39
-rw-r--r--sys-devel/automake/files/automake-1.9.6-ignore-comments.patch29
-rw-r--r--sys-devel/automake/files/automake-1.9.6-include-dir-prefix.patch31
-rw-r--r--sys-devel/automake/files/automake-1.9.6-infopage-namechange.patch33
-rw-r--r--sys-devel/automake/files/automake-1.9.6-subst-test.patch42
-rw-r--r--sys-devel/automake/metadata.xml5
-rw-r--r--sys-devel/bc/Manifest1
-rw-r--r--sys-devel/bc/bc-1.06.95-r1.ebuild52
-rw-r--r--sys-devel/bc/bc-1.06.95-r2.ebuild55
-rw-r--r--sys-devel/bc/bc-1.06.95.ebuild39
-rw-r--r--sys-devel/bc/files/bc-1.06.95-mem-leak.patch24
-rw-r--r--sys-devel/bc/files/bc-1.06.95-void_uninitialized.patch13
-rw-r--r--sys-devel/bc/metadata.xml5
-rw-r--r--sys-devel/bin86/Manifest3
-rw-r--r--sys-devel/bin86/bin86-0.16.20-r2.ebuild35
-rw-r--r--sys-devel/bin86/bin86-0.16.21.ebuild33
-rw-r--r--sys-devel/bin86/files/bin86-0.16.17-amd64-build.patch17
-rw-r--r--sys-devel/bin86/files/bin86-0.16.18-headers.patch34
-rw-r--r--sys-devel/bin86/files/bin86-0.16.20-remove-seg-ss-check.patch22
-rw-r--r--sys-devel/bin86/metadata.xml9
-rw-r--r--sys-devel/binutils-apple/Manifest21
-rw-r--r--sys-devel/binutils-apple/binutils-apple-3.1.2.ebuild214
-rw-r--r--sys-devel/binutils-apple/binutils-apple-3.2.6.ebuild254
-rw-r--r--sys-devel/binutils-apple/binutils-apple-3.2.ebuild234
-rw-r--r--sys-devel/binutils-apple/binutils-apple-4.2-r1.ebuild328
-rw-r--r--sys-devel/binutils-apple/binutils-apple-4.2.ebuild312
-rw-r--r--sys-devel/binutils-apple/binutils-apple-4.3-r1.ebuild316
-rw-r--r--sys-devel/binutils-apple/binutils-apple-4.3.ebuild309
-rw-r--r--sys-devel/binutils-apple/binutils-apple-5.1.ebuild356
-rw-r--r--sys-devel/binutils-apple/binutils-apple-6.1.ebuild355
-rw-r--r--sys-devel/binutils-apple/files/Makefile12
-rw-r--r--sys-devel/binutils-apple/files/binutils-apple-3.1.1-as-dir.patch69
-rw-r--r--sys-devel/binutils-apple/files/binutils-apple-3.1.1-as.patch98
-rw-r--r--sys-devel/binutils-apple/files/binutils-apple-3.1.1-libtool-ranlib.patch17
-rw-r--r--sys-devel/binutils-apple/files/binutils-apple-3.1.1-nmedit.patch15
-rw-r--r--sys-devel/binutils-apple/files/binutils-apple-3.1.1-no-efi-man.patch38
-rw-r--r--sys-devel/binutils-apple/files/binutils-apple-3.1.1-no-headers.patch15
-rw-r--r--sys-devel/binutils-apple/files/binutils-apple-3.1.1-no-oss-dir.patch17
-rw-r--r--sys-devel/binutils-apple/files/binutils-apple-3.1.1-ranlib.patch53
-rw-r--r--sys-devel/binutils-apple/files/binutils-apple-3.1.1-testsuite.patch102
-rw-r--r--sys-devel/binutils-apple/files/binutils-apple-3.1.2-as-Makefile.patch11
-rw-r--r--sys-devel/binutils-apple/files/binutils-apple-3.2-armv7-defines.patch10
-rw-r--r--sys-devel/binutils-apple/files/binutils-apple-3.2.2-as.patch101
-rw-r--r--sys-devel/binutils-apple/files/binutils-apple-3.2.3-ranlib.patch59
-rw-r--r--sys-devel/binutils-apple/files/binutils-apple-4.0-as-dir.patch67
-rw-r--r--sys-devel/binutils-apple/files/binutils-apple-4.0-as.patch99
-rw-r--r--sys-devel/binutils-apple/files/binutils-apple-4.0-no-oss-dir.patch15
-rw-r--r--sys-devel/binutils-apple/files/binutils-apple-4.2-as-dir.patch45
-rw-r--r--sys-devel/binutils-apple/files/binutils-apple-4.2-globals-extern.patch29
-rw-r--r--sys-devel/binutils-apple/files/binutils-apple-4.2-lto.patch34
-rw-r--r--sys-devel/binutils-apple/files/binutils-apple-4.5-as.patch100
-rw-r--r--sys-devel/binutils-apple/files/binutils-apple-5.1-as-dir.patch47
-rw-r--r--sys-devel/binutils-apple/files/binutils-apple-5.1-constant-types.patch26
-rw-r--r--sys-devel/binutils-apple/files/binutils-apple-5.1-extraneous-includes.patch31
-rw-r--r--sys-devel/binutils-apple/files/binutils-apple-5.1-nolto.patch43
-rw-r--r--sys-devel/binutils-apple/files/binutils-apple-5.1-otool-stdc.patch23
-rw-r--r--sys-devel/binutils-apple/files/binutils-apple-5.1-ranlib.patch15
-rw-r--r--sys-devel/binutils-apple/files/binutils-apple-5.1-strnlen.patch45
-rw-r--r--sys-devel/binutils-apple/files/cctools-839-intel-retf.patch14
-rw-r--r--sys-devel/binutils-apple/files/ld64-123.2-Makefile47
-rw-r--r--sys-devel/binutils-apple/files/ld64-123.2-darwin8-no-mlong-branch-warning.patch17
-rw-r--r--sys-devel/binutils-apple/files/ld64-123.2-debug-backtrace.patch15
-rw-r--r--sys-devel/binutils-apple/files/ld64-123.2.1-lto.patch218
-rw-r--r--sys-devel/binutils-apple/files/ld64-127.2-Makefile50
-rw-r--r--sys-devel/binutils-apple/files/ld64-127.2-extraneous-headers.patch12
-rw-r--r--sys-devel/binutils-apple/files/ld64-127.2-lto.patch214
-rw-r--r--sys-devel/binutils-apple/files/ld64-127.2-ppc-range-warning.patch16
-rw-r--r--sys-devel/binutils-apple/files/ld64-127.2-thread_state.patch13
-rw-r--r--sys-devel/binutils-apple/files/ld64-128.2-1010.patch20
-rw-r--r--sys-devel/binutils-apple/files/ld64-128.2-Makefile47
-rw-r--r--sys-devel/binutils-apple/files/ld64-128.2-Makefile-250
-rw-r--r--sys-devel/binutils-apple/files/ld64-128.2-stdlib.patch14
-rw-r--r--sys-devel/binutils-apple/files/ld64-136-Makefile48
-rw-r--r--sys-devel/binutils-apple/files/ld64-136-compile_stubs.h53
-rw-r--r--sys-devel/binutils-apple/files/ld64-236.3-Makefile51
-rw-r--r--sys-devel/binutils-apple/files/ld64-236.3-arm64-fixup.patch17
-rw-r--r--sys-devel/binutils-apple/files/ld64-236.3-constant-types.patch61
-rw-r--r--sys-devel/binutils-apple/files/ld64-236.3-crashreporter.patch23
-rw-r--r--sys-devel/binutils-apple/files/ld64-236.3-gcc.patch1038
-rw-r--r--sys-devel/binutils-apple/files/ld64-236.3-missing-cputypes.patch10
-rw-r--r--sys-devel/binutils-apple/files/ld64-236.3-noarm.patch1236
-rw-r--r--sys-devel/binutils-apple/files/ld64-236.3-nolto.patch219
-rw-r--r--sys-devel/binutils-apple/files/ld64-236.3-noppc.patch26
-rw-r--r--sys-devel/binutils-apple/files/ld64-236.3-nosnapshots.patch644
-rw-r--r--sys-devel/binutils-apple/files/ld64-241.9-arm64-cputype.patch17
-rw-r--r--sys-devel/binutils-apple/files/ld64-241.9-atomic-volatile.patch27
-rw-r--r--sys-devel/binutils-apple/files/ld64-241.9-cc_md5.patch24
-rw-r--r--sys-devel/binutils-apple/files/ld64-241.9-extraneous-includes.patch13
-rw-r--r--sys-devel/binutils-apple/files/ld64-241.9-gcc.patch1029
-rw-r--r--sys-devel/binutils-apple/files/ld64-241.9-get-comm-align.patch30
-rw-r--r--sys-devel/binutils-apple/files/ld64-241.9-lto-noremarks.patch107
-rw-r--r--sys-devel/binutils-apple/files/ld64-241.9-noarm.patch1288
-rw-r--r--sys-devel/binutils-apple/files/ld64-241.9-nosnapshots.patch644
-rw-r--r--sys-devel/binutils-apple/files/ld64-241.9-register-names.patch50
-rw-r--r--sys-devel/binutils-apple/files/ld64-95.2.12-Makefile26
-rw-r--r--sys-devel/binutils-apple/files/ld64-95.2.12-darwin8-no-mlong-branch-warning.patch15
-rw-r--r--sys-devel/binutils-apple/files/libunwind-30-Makefile23
-rw-r--r--sys-devel/binutils-apple/metadata.xml9
-rw-r--r--sys-devel/binutils-config/binutils-config-1.9-r4.ebuild19
-rw-r--r--sys-devel/binutils-config/binutils-config-2-r1.ebuild19
-rw-r--r--sys-devel/binutils-config/binutils-config-3-r3.ebuild19
-rw-r--r--sys-devel/binutils-config/binutils-config-4-r1.ebuild24
-rw-r--r--sys-devel/binutils-config/binutils-config-4-r2.ebuild24
-rw-r--r--sys-devel/binutils-config/binutils-config-4-r3.ebuild24
-rwxr-xr-xsys-devel/binutils-config/files/binutils-config-1.9410
-rwxr-xr-xsys-devel/binutils-config/files/binutils-config-2434
-rwxr-xr-xsys-devel/binutils-config/files/binutils-config-3509
-rwxr-xr-xsys-devel/binutils-config/files/binutils-config-4465
-rw-r--r--sys-devel/binutils-config/files/binutils-config.877
-rw-r--r--sys-devel/binutils-config/metadata.xml5
-rw-r--r--sys-devel/binutils-hppa64/Manifest18
-rw-r--r--sys-devel/binutils-hppa64/binutils-hppa64-2.19.1.ebuild23
-rw-r--r--sys-devel/binutils-hppa64/binutils-hppa64-2.20.1.ebuild23
-rw-r--r--sys-devel/binutils-hppa64/binutils-hppa64-2.21.1-r1.ebuild23
-rw-r--r--sys-devel/binutils-hppa64/binutils-hppa64-2.22.ebuild27
-rw-r--r--sys-devel/binutils-hppa64/binutils-hppa64-2.23.1.ebuild27
-rw-r--r--sys-devel/binutils-hppa64/binutils-hppa64-2.23.2.ebuild27
-rw-r--r--sys-devel/binutils-hppa64/binutils-hppa64-2.24.ebuild27
-rw-r--r--sys-devel/binutils-hppa64/binutils-hppa64-2.25.1.ebuild27
-rw-r--r--sys-devel/binutils-hppa64/binutils-hppa64-2.25.ebuild27
-rw-r--r--sys-devel/binutils-hppa64/metadata.xml12
-rw-r--r--sys-devel/binutils/Manifest13
-rw-r--r--sys-devel/binutils/binutils-2.21.1-r1.ebuild11
-rw-r--r--sys-devel/binutils/binutils-2.22-r1.ebuild11
-rw-r--r--sys-devel/binutils/binutils-2.23.2.ebuild12
-rw-r--r--sys-devel/binutils/binutils-2.24-r3.ebuild9
-rw-r--r--sys-devel/binutils/binutils-2.25-r1.ebuild11
-rw-r--r--sys-devel/binutils/binutils-2.25.1.ebuild11
-rw-r--r--sys-devel/binutils/binutils-2.25.ebuild11
-rw-r--r--sys-devel/binutils/binutils-9999.ebuild7
-rw-r--r--sys-devel/binutils/files/binutils-configure-LANG.patch65
-rw-r--r--sys-devel/binutils/metadata.xml12
-rw-r--r--sys-devel/bison/Manifest5
-rw-r--r--sys-devel/bison/bison-1.875d.ebuild65
-rw-r--r--sys-devel/bison/bison-2.4.3.ebuild49
-rw-r--r--sys-devel/bison/bison-2.7.1.ebuild59
-rw-r--r--sys-devel/bison/bison-3.0.3-r1.ebuild60
-rw-r--r--sys-devel/bison/bison-3.0.4-r1.ebuild69
-rw-r--r--sys-devel/bison/bison-3.0.4.ebuild60
-rw-r--r--sys-devel/bison/files/bison-1.32-extfix.patch28
-rw-r--r--sys-devel/bison/files/bison-2.4.3-no-gets.patch22
-rw-r--r--sys-devel/bison/files/bison-2.4.3-uclibc-sched_param-def.patch19
-rw-r--r--sys-devel/bison/files/bison-3.0.4-optional-perl.patch500
-rw-r--r--sys-devel/bison/metadata.xml5
-rw-r--r--sys-devel/bmake/Manifest2
-rw-r--r--sys-devel/bmake/bmake-20140214.ebuild55
-rw-r--r--sys-devel/bmake/metadata.xml5
-rw-r--r--sys-devel/boost-m4/Manifest1
-rw-r--r--sys-devel/boost-m4/boost-m4-0.4-r1.ebuild35
-rw-r--r--sys-devel/boost-m4/boost-m4-0.4.ebuild31
-rw-r--r--sys-devel/boost-m4/files/boost-m4-0.4-gcc5.patch91
-rw-r--r--sys-devel/boost-m4/metadata.xml11
-rw-r--r--sys-devel/byfl/Manifest1
-rw-r--r--sys-devel/byfl/byfl-1.2.ebuild44
-rw-r--r--sys-devel/byfl/byfl-9999.ebuild44
-rw-r--r--sys-devel/byfl/metadata.xml14
-rw-r--r--sys-devel/clang/Manifest12
-rw-r--r--sys-devel/clang/clang-2.8-r3.ebuild203
-rw-r--r--sys-devel/clang/clang-2.9-r1.ebuild192
-rw-r--r--sys-devel/clang/clang-3.0-r4.ebuild213
-rw-r--r--sys-devel/clang/clang-3.1-r5.ebuild204
-rw-r--r--sys-devel/clang/clang-3.2.ebuild202
-rw-r--r--sys-devel/clang/clang-3.3-r100.ebuild36
-rw-r--r--sys-devel/clang/clang-3.4.2-r100.ebuild36
-rw-r--r--sys-devel/clang/clang-3.5.0-r100.ebuild36
-rw-r--r--sys-devel/clang/clang-3.5.1-r100.ebuild36
-rw-r--r--sys-devel/clang/clang-3.5.2-r100.ebuild36
-rw-r--r--sys-devel/clang/clang-3.6.0-r100.ebuild36
-rw-r--r--sys-devel/clang/clang-3.6.1-r100.ebuild36
-rw-r--r--sys-devel/clang/clang-3.6.2-r100.ebuild36
-rw-r--r--sys-devel/clang/clang-9999-r100.ebuild36
-rw-r--r--sys-devel/clang/clang-9999.ebuild193
-rw-r--r--sys-devel/clang/files/cl-patches/clang-0001-Add-r600-TargetInfo.patch100
-rw-r--r--sys-devel/clang/files/cl-patches/clang-0002-r600-Add-some-target-builtins.patch111
-rw-r--r--sys-devel/clang/files/cl-patches/clang-0003-r600-Add-read_global_size-and-read_local_size-builti.patch31
-rw-r--r--sys-devel/clang/files/cl-patches/llvm-0001-r600-Add-some-intrinsic-definitions.patch64
-rw-r--r--sys-devel/clang/files/cl-patches/llvm-0002-r600-Add-get_global_size-and-get_local_size-intrinsi.patch27
-rw-r--r--sys-devel/clang/files/clang-2.7-fixdoc.patch53
-rw-r--r--sys-devel/clang/files/clang-2.8-alignof.patch258
-rw-r--r--sys-devel/clang/files/clang-2.8-darwin-prefix.patch127
-rw-r--r--sys-devel/clang/files/clang-2.8-gcc-4.4.4.patch16
-rw-r--r--sys-devel/clang/files/clang-2.9-darwin-prefix.patch125
-rw-r--r--sys-devel/clang/files/clang-2.9-gccversions.patch12
-rw-r--r--sys-devel/clang/files/clang-3.0-fix_cxx_include_root.patch21
-rw-r--r--sys-devel/clang/files/clang-3.0-freebsd-runtime-gcc-detection.patch20
-rw-r--r--sys-devel/clang/files/clang-3.0-gentoo-binutils-apple.patch29
-rw-r--r--sys-devel/clang/files/clang-3.0-linux-runtime-gcc-detection.patch43
-rw-r--r--sys-devel/clang/files/clang-3.0-recognize-amd-k10-enable-sse4a.patch82
-rw-r--r--sys-devel/clang/files/clang-3.1-gentoo-freebsd-fix-cxx-paths-v2.patch188
-rw-r--r--sys-devel/clang/files/clang-3.1-gentoo-freebsd-fix-lib-path.patch20
-rw-r--r--sys-devel/clang/files/clang-3.1-gentoo-runtime-gcc-detection-v3.patch29
-rw-r--r--sys-devel/clang/files/clang-3.1-increase-parser-recursion-limit.patch15
-rw-r--r--sys-devel/clang/metadata.xml35
-rw-r--r--sys-devel/cons/Manifest1
-rw-r--r--sys-devel/cons/cons-2.2.0.ebuild26
-rw-r--r--sys-devel/cons/metadata.xml5
-rw-r--r--sys-devel/crossdev/Manifest32
-rw-r--r--sys-devel/crossdev/crossdev-20100814.ebuild32
-rw-r--r--sys-devel/crossdev/crossdev-20101011.ebuild32
-rw-r--r--sys-devel/crossdev/crossdev-20110310.ebuild32
-rw-r--r--sys-devel/crossdev/crossdev-20110705.ebuild32
-rw-r--r--sys-devel/crossdev/crossdev-20110819.ebuild32
-rw-r--r--sys-devel/crossdev/crossdev-20111011.ebuild32
-rw-r--r--sys-devel/crossdev/crossdev-20111018.ebuild32
-rw-r--r--sys-devel/crossdev/crossdev-20111118.ebuild32
-rw-r--r--sys-devel/crossdev/crossdev-20111221.ebuild32
-rw-r--r--sys-devel/crossdev/crossdev-20120214.ebuild32
-rw-r--r--sys-devel/crossdev/crossdev-20120227.ebuild35
-rw-r--r--sys-devel/crossdev/crossdev-20120228.ebuild35
-rw-r--r--sys-devel/crossdev/crossdev-20120229.ebuild35
-rw-r--r--sys-devel/crossdev/crossdev-20120301.ebuild35
-rw-r--r--sys-devel/crossdev/crossdev-20120305.ebuild35
-rw-r--r--sys-devel/crossdev/crossdev-20120529.ebuild35
-rw-r--r--sys-devel/crossdev/crossdev-20120531.ebuild35
-rw-r--r--sys-devel/crossdev/crossdev-20120721.ebuild35
-rw-r--r--sys-devel/crossdev/crossdev-20120913.ebuild35
-rw-r--r--sys-devel/crossdev/crossdev-20130628.ebuild35
-rw-r--r--sys-devel/crossdev/crossdev-20131011.ebuild35
-rw-r--r--sys-devel/crossdev/crossdev-20131107.ebuild35
-rw-r--r--sys-devel/crossdev/crossdev-20140118.ebuild35
-rw-r--r--sys-devel/crossdev/crossdev-20140729.ebuild35
-rw-r--r--sys-devel/crossdev/crossdev-20140917.ebuild35
-rw-r--r--sys-devel/crossdev/crossdev-20141030.ebuild35
-rw-r--r--sys-devel/crossdev/crossdev-20150521.ebuild35
-rw-r--r--sys-devel/crossdev/crossdev-20150525.ebuild35
-rw-r--r--sys-devel/crossdev/crossdev-20150526.ebuild35
-rw-r--r--sys-devel/crossdev/crossdev-20150527.ebuild35
-rw-r--r--sys-devel/crossdev/crossdev-20150602.ebuild36
-rw-r--r--sys-devel/crossdev/crossdev-20150716.ebuild36
-rw-r--r--sys-devel/crossdev/crossdev-99999999.ebuild36
-rw-r--r--sys-devel/crossdev/metadata.xml9
-rw-r--r--sys-devel/ct-ng/Manifest3
-rw-r--r--sys-devel/ct-ng/ct-ng-1.19.0-r1.ebuild44
-rw-r--r--sys-devel/ct-ng/ct-ng-1.20.0-r1.ebuild44
-rw-r--r--sys-devel/ct-ng/ct-ng-1.21.0.ebuild44
-rw-r--r--sys-devel/ct-ng/files/ct-ng-kconfig-respect-flags.patch14
-rw-r--r--sys-devel/ct-ng/metadata.xml21
-rw-r--r--sys-devel/dev86/Manifest2
-rw-r--r--sys-devel/dev86/dev86-0.16.19.ebuild78
-rw-r--r--sys-devel/dev86/dev86-0.16.21.ebuild77
-rw-r--r--sys-devel/dev86/files/dev86-0.16.17-fortify.patch43
-rw-r--r--sys-devel/dev86/files/dev86-0.16.17-make382.patch11
-rw-r--r--sys-devel/dev86/files/dev86-0.16.19-fortify.patch23
-rw-r--r--sys-devel/dev86/files/dev86-0.16.19-memmove.patch17
-rw-r--r--sys-devel/dev86/files/dev86-pic.patch20
-rw-r--r--sys-devel/dev86/metadata.xml10
-rw-r--r--sys-devel/distcc/Manifest2
-rw-r--r--sys-devel/distcc/distcc-3.1-r10.ebuild174
-rw-r--r--sys-devel/distcc/distcc-3.2_rc1-r3.ebuild207
-rw-r--r--sys-devel/distcc/files/2.18-r1/conf45
-rw-r--r--sys-devel/distcc/files/2.18-r1/init39
-rw-r--r--sys-devel/distcc/files/2.18/conf40
-rw-r--r--sys-devel/distcc/files/2.18/init30
-rw-r--r--sys-devel/distcc/files/3.0/conf40
-rw-r--r--sys-devel/distcc/files/3.0/distcc-config123
-rwxr-xr-xsys-devel/distcc/files/3.0/init32
-rw-r--r--sys-devel/distcc/files/3.1/conf35
-rwxr-xr-xsys-devel/distcc/files/3.1/init32
-rw-r--r--sys-devel/distcc/files/distcc-3.0-fix-fortify.patch11
-rw-r--r--sys-devel/distcc/files/distcc-3.0-gentoo.patch33
-rw-r--r--sys-devel/distcc/files/distcc-3.0-svn617.patch13
-rw-r--r--sys-devel/distcc/files/distcc-3.0-uninitialized.patch13
-rw-r--r--sys-devel/distcc/files/distcc-3.0-xinetd.patch15
-rw-r--r--sys-devel/distcc/files/distcc-3.1-argc-fix.patch17
-rw-r--r--sys-devel/distcc/files/distcc-3.1-freedesktop.patch76
-rw-r--r--sys-devel/distcc/files/distcc-3.1-python.patch258
-rw-r--r--sys-devel/distcc/files/distcc-3.2_rc1-freedesktop.patch79
-rw-r--r--sys-devel/distcc/files/distcc-3.2_rc1-gssapi.patch36
-rw-r--r--sys-devel/distcc/files/distcc-3.2_rc1-python.patch246
-rw-r--r--sys-devel/distcc/files/distcc-3.2_rc1-socks5.patch191
-rw-r--r--sys-devel/distcc/files/distcc-as-needed.patch17
-rw-r--r--sys-devel/distcc/files/distcc-avahi-configure.patch29
-rw-r--r--sys-devel/distcc/files/distcc-config165
-rw-r--r--sys-devel/distcc/files/distcc-config-3.2_rc1181
-rw-r--r--sys-devel/distcc/files/distcc-create-dir.patch56
-rw-r--r--sys-devel/distcc/files/distcc-freedesktop.patch84
-rw-r--r--sys-devel/distcc/files/distcc-gentoo-multilib-r1.patch146
-rw-r--r--sys-devel/distcc/files/distcc-gentoo-multilib.patch126
-rw-r--r--sys-devel/distcc/files/distcc-hardened.patch24
-rw-r--r--sys-devel/distcc/files/distcc-march-native.patch16
-rw-r--r--sys-devel/distcc/files/distccd.service10
-rw-r--r--sys-devel/distcc/files/distccd.service.conf6
-rw-r--r--sys-devel/distcc/metadata.xml13
-rw-r--r--sys-devel/dragonegg/Manifest4
-rw-r--r--sys-devel/dragonegg/dragonegg-3.5.1.ebuild56
-rw-r--r--sys-devel/dragonegg/dragonegg-3.6.0.ebuild56
-rw-r--r--sys-devel/dragonegg/dragonegg-9999.ebuild55
-rw-r--r--sys-devel/dragonegg/metadata.xml9
-rw-r--r--sys-devel/dwz/Manifest1
-rw-r--r--sys-devel/dwz/dwz-0.9.ebuild23
-rw-r--r--sys-devel/dwz/metadata.xml17
-rw-r--r--sys-devel/flex/Manifest5
-rw-r--r--sys-devel/flex/files/flex-2.5.33-pic.patch12
-rw-r--r--sys-devel/flex/files/flex-2.5.34-isatty.patch53
-rw-r--r--sys-devel/flex/files/flex-2.5.35-gcc44.patch13
-rw-r--r--sys-devel/flex/files/flex-2.5.35-saneautotools.patch77
-rw-r--r--sys-devel/flex/files/flex-2.5.37-proto.patch27
-rw-r--r--sys-devel/flex/files/flex-2.5.37-tests.patch113
-rw-r--r--sys-devel/flex/flex-2.5.35.ebuild43
-rw-r--r--sys-devel/flex/flex-2.5.35_p10.ebuild50
-rw-r--r--sys-devel/flex/flex-2.5.37.ebuild51
-rw-r--r--sys-devel/flex/flex-2.5.38-r1.ebuild40
-rw-r--r--sys-devel/flex/flex-2.5.39-r1.ebuild66
-rw-r--r--sys-devel/flex/flex-2.5.39.ebuild40
-rw-r--r--sys-devel/flex/metadata.xml8
-rw-r--r--sys-devel/gcc-apple/Manifest6
-rw-r--r--sys-devel/gcc-apple/files/gcc-apple-4.0.1_p5465-default-altivec.patch38
-rw-r--r--sys-devel/gcc-apple/files/gcc-apple-4.2.1-arch-option.patch57
-rw-r--r--sys-devel/gcc-apple/files/gcc-apple-4.2.1-autoconf-m4-precious.patch12
-rw-r--r--sys-devel/gcc-apple/files/gcc-apple-4.2.1-dsymutil.patch20
-rw-r--r--sys-devel/gcc-apple/files/gcc-apple-4.2.1-prefix-search-dirs-r1.patch39
-rw-r--r--sys-devel/gcc-apple/files/gcc-apple-4.2.1-prefix-search-dirs.patch27
-rw-r--r--sys-devel/gcc-apple/files/gcc-apple-4.2.1-texinfo.patch33
-rw-r--r--sys-devel/gcc-apple/files/gcc-apple-4.2.1_p5646-gfortran.patch797
-rw-r--r--sys-devel/gcc-apple/files/gcc-apple-4.2.1_p5666-darwin14.patch148
-rw-r--r--sys-devel/gcc-apple/files/gcc-apple-4.2.1_p5666-perl-5.18.patch11
-rw-r--r--sys-devel/gcc-apple/files/libstdc++-16.patch11
-rw-r--r--sys-devel/gcc-apple/gcc-apple-4.0.1_p5493.ebuild261
-rw-r--r--sys-devel/gcc-apple/gcc-apple-4.2.1_p5664.ebuild332
-rw-r--r--sys-devel/gcc-apple/gcc-apple-4.2.1_p5666-r1.ebuild344
-rw-r--r--sys-devel/gcc-apple/gcc-apple-4.2.1_p5666-r2.ebuild375
-rw-r--r--sys-devel/gcc-apple/metadata.xml12
-rw-r--r--sys-devel/gcc-config/Manifest6
-rw-r--r--sys-devel/gcc-config/files/gcc-config-1.4.1801
-rwxr-xr-xsys-devel/gcc-config/files/gcc-config-1.5740
-rwxr-xr-xsys-devel/gcc-config/files/gcc-config-1.5.1763
-rw-r--r--sys-devel/gcc-config/files/gcc-config-1.8-dont_source_functions_sh_from_etc_initd.patch47
-rw-r--r--sys-devel/gcc-config/files/wrapper-1.5.1.c372
-rw-r--r--sys-devel/gcc-config/files/wrapper-1.5.2.c315
-rw-r--r--sys-devel/gcc-config/gcc-config-1.4.1-r1.ebuild59
-rw-r--r--sys-devel/gcc-config/gcc-config-1.5-r1.ebuild61
-rw-r--r--sys-devel/gcc-config/gcc-config-1.5-r2.ebuild61
-rw-r--r--sys-devel/gcc-config/gcc-config-1.5.1-r1.ebuild61
-rw-r--r--sys-devel/gcc-config/gcc-config-1.5.1.ebuild61
-rw-r--r--sys-devel/gcc-config/gcc-config-1.6.ebuild47
-rw-r--r--sys-devel/gcc-config/gcc-config-1.7.1.ebuild47
-rw-r--r--sys-devel/gcc-config/gcc-config-1.7.2.ebuild47
-rw-r--r--sys-devel/gcc-config/gcc-config-1.7.3.ebuild47
-rw-r--r--sys-devel/gcc-config/gcc-config-1.7.ebuild47
-rw-r--r--sys-devel/gcc-config/gcc-config-1.8-r1.ebuild53
-rw-r--r--sys-devel/gcc-config/gcc-config-1.8.ebuild47
-rw-r--r--sys-devel/gcc-config/metadata.xml5
-rw-r--r--sys-devel/gcc/Manifest88
-rw-r--r--sys-devel/gcc/files/3.3.4/libffi-without-libgcj.patch22
-rw-r--r--sys-devel/gcc/files/3.4.3/libffi-nogcj-lib-path-fix.patch40
-rw-r--r--sys-devel/gcc/files/3.4.3/libffi-without-libgcj.patch40
-rw-r--r--sys-devel/gcc/files/3.4.4/gcc-3.4.4-cross-compile.patch63
-rw-r--r--sys-devel/gcc/files/4.1.0/gcc-4.1.0-cross-compile.patch40
-rw-r--r--sys-devel/gcc/files/4.1.0/gcc-4.1.0-fast-math-i386-Os-workaround.patch64
-rw-r--r--sys-devel/gcc/files/awk/fixlafiles.awk314
-rw-r--r--sys-devel/gcc/files/awk/fixlafiles.awk-no_gcc_la335
-rwxr-xr-xsys-devel/gcc/files/c8920
-rwxr-xr-xsys-devel/gcc/files/c9921
-rw-r--r--sys-devel/gcc/files/fix_libtool_files.sh67
-rw-r--r--sys-devel/gcc/files/gcc-configure-LANG.patch64
-rw-r--r--sys-devel/gcc/files/gcc-configure-texinfo.patch16
-rw-r--r--sys-devel/gcc/files/gcc-spec-env-r1.patch87
-rw-r--r--sys-devel/gcc/files/gcc-spec-env.patch42
-rw-r--r--sys-devel/gcc/gcc-2.95.3-r10.ebuild35
-rw-r--r--sys-devel/gcc/gcc-3.3.6-r1.ebuild38
-rw-r--r--sys-devel/gcc/gcc-3.4.6-r2.ebuild49
-rw-r--r--sys-devel/gcc/gcc-4.0.4.ebuild16
-rw-r--r--sys-devel/gcc/gcc-4.1.2.ebuild30
-rw-r--r--sys-devel/gcc/gcc-4.2.4-r1.ebuild18
-rw-r--r--sys-devel/gcc/gcc-4.3.6-r1.ebuild29
-rw-r--r--sys-devel/gcc/gcc-4.4.7.ebuild31
-rw-r--r--sys-devel/gcc/gcc-4.5.4.ebuild32
-rw-r--r--sys-devel/gcc/gcc-4.6.4.ebuild48
-rw-r--r--sys-devel/gcc/gcc-4.7.4.ebuild48
-rw-r--r--sys-devel/gcc/gcc-4.8.0.ebuild48
-rw-r--r--sys-devel/gcc/gcc-4.8.1-r1.ebuild48
-rw-r--r--sys-devel/gcc/gcc-4.8.2.ebuild48
-rw-r--r--sys-devel/gcc/gcc-4.8.3.ebuild48
-rw-r--r--sys-devel/gcc/gcc-4.8.4.ebuild48
-rw-r--r--sys-devel/gcc/gcc-4.8.5.ebuild48
-rw-r--r--sys-devel/gcc/gcc-4.9.0.ebuild48
-rw-r--r--sys-devel/gcc/gcc-4.9.1.ebuild48
-rw-r--r--sys-devel/gcc/gcc-4.9.2.ebuild48
-rw-r--r--sys-devel/gcc/gcc-4.9.3.ebuild48
-rw-r--r--sys-devel/gcc/gcc-5.1.0.ebuild45
-rw-r--r--sys-devel/gcc/gcc-5.2.0.ebuild45
-rw-r--r--sys-devel/gcc/metadata.xml32
-rw-r--r--sys-devel/gdb-apple/Manifest12
-rw-r--r--sys-devel/gdb-apple/files/gdb-apple-1344-darwin8.patch131
-rw-r--r--sys-devel/gdb-apple/files/gdb-apple-1461-darwin8.patch128
-rw-r--r--sys-devel/gdb-apple/files/gdb-apple-1461-dyld-info.patch22
-rw-r--r--sys-devel/gdb-apple/files/gdb-apple-1518-darwin8-9.patch87
-rw-r--r--sys-devel/gdb-apple/files/gdb-apple-1518-darwin8.patch128
-rw-r--r--sys-devel/gdb-apple/files/gdb-apple-1518-task_dyld_info.patch22
-rw-r--r--sys-devel/gdb-apple/files/gdb-apple-1705-darwin8-10.patch11
-rw-r--r--sys-devel/gdb-apple/files/gdb-apple-563-darwin7.patch110
-rw-r--r--sys-devel/gdb-apple/files/gdb-apple-563-no-64bit.patch19
-rw-r--r--sys-devel/gdb-apple/files/gdb-apple-768-darwin-arch.patch15
-rw-r--r--sys-devel/gdb-apple/files/gdb-apple-768-texinfo.patch10
-rw-r--r--sys-devel/gdb-apple/files/gdb-apple-962-darwin64.patch17
-rw-r--r--sys-devel/gdb-apple/files/gdb-apple-962-darwin8.patch15
-rw-r--r--sys-devel/gdb-apple/files/gdb-apple-962-demangle.patch22
-rw-r--r--sys-devel/gdb-apple/files/gdb-apple-no-global-gdbinit.patch23
-rw-r--r--sys-devel/gdb-apple/gdb-apple-1344.ebuild61
-rw-r--r--sys-devel/gdb-apple/gdb-apple-1346.ebuild61
-rw-r--r--sys-devel/gdb-apple/gdb-apple-1461.ebuild65
-rw-r--r--sys-devel/gdb-apple/gdb-apple-1518.ebuild63
-rw-r--r--sys-devel/gdb-apple/gdb-apple-1705.ebuild74
-rw-r--r--sys-devel/gdb-apple/gdb-apple-1708.ebuild74
-rw-r--r--sys-devel/gdb-apple/gdb-apple-1752.ebuild74
-rw-r--r--sys-devel/gdb-apple/gdb-apple-563.ebuild51
-rw-r--r--sys-devel/gdb-apple/gdb-apple-768-r1.ebuild50
-rw-r--r--sys-devel/gdb-apple/gdb-apple-960.ebuild50
-rw-r--r--sys-devel/gdb-apple/gdb-apple-962.ebuild64
-rw-r--r--sys-devel/gdb-apple/gdb-apple-966.ebuild64
-rw-r--r--sys-devel/gdb-apple/metadata.xml5
-rw-r--r--sys-devel/gdb/Manifest19
-rw-r--r--sys-devel/gdb/gdb-7.5.1.ebuild178
-rw-r--r--sys-devel/gdb/gdb-7.5.ebuild178
-rw-r--r--sys-devel/gdb/gdb-7.6.1.ebuild192
-rw-r--r--sys-devel/gdb/gdb-7.6.2.ebuild192
-rw-r--r--sys-devel/gdb/gdb-7.6.ebuild181
-rw-r--r--sys-devel/gdb/gdb-7.7-r1.ebuild192
-rw-r--r--sys-devel/gdb/gdb-7.7.1.ebuild202
-rw-r--r--sys-devel/gdb/gdb-7.8.1.ebuild206
-rw-r--r--sys-devel/gdb/gdb-7.8.2.ebuild206
-rw-r--r--sys-devel/gdb/gdb-7.8.ebuild199
-rw-r--r--sys-devel/gdb/gdb-7.9.1.ebuild220
-rw-r--r--sys-devel/gdb/gdb-7.9.ebuild220
-rw-r--r--sys-devel/gdb/gdb-9999.ebuild221
-rw-r--r--sys-devel/gdb/metadata.xml15
-rw-r--r--sys-devel/gettext/Manifest3
-rw-r--r--sys-devel/gettext/gettext-0.19.4.ebuild142
-rw-r--r--sys-devel/gettext/gettext-0.19.5.1.ebuild142
-rw-r--r--sys-devel/gettext/gettext-0.19.5.ebuild142
-rw-r--r--sys-devel/gettext/metadata.xml11
-rw-r--r--sys-devel/gnuconfig/Manifest7
-rw-r--r--sys-devel/gnuconfig/files/99999999/0002-Add-x32-support-to-config.guess.patch44
-rw-r--r--sys-devel/gnuconfig/files/99999999/0002-add-ps2-targets-to-config.sub.patch59
-rw-r--r--sys-devel/gnuconfig/gnuconfig-20130516.ebuild66
-rw-r--r--sys-devel/gnuconfig/gnuconfig-20131128.ebuild66
-rw-r--r--sys-devel/gnuconfig/gnuconfig-20140212.ebuild66
-rw-r--r--sys-devel/gnuconfig/gnuconfig-20140728.ebuild66
-rw-r--r--sys-devel/gnuconfig/gnuconfig-20150304.ebuild66
-rw-r--r--sys-devel/gnuconfig/gnuconfig-20150308.ebuild66
-rw-r--r--sys-devel/gnuconfig/gnuconfig-20150727.ebuild66
-rw-r--r--sys-devel/gnuconfig/gnuconfig-99999999.ebuild66
-rw-r--r--sys-devel/gnuconfig/metadata.xml8
-rw-r--r--sys-devel/heirloom-devtools/Manifest1
-rw-r--r--sys-devel/heirloom-devtools/files/heirloom-devtools-070527-64-bit.patch39
-rw-r--r--sys-devel/heirloom-devtools/files/heirloom-devtools-070527-solaris.patch230
-rw-r--r--sys-devel/heirloom-devtools/heirloom-devtools-070527-r1.ebuild57
-rw-r--r--sys-devel/heirloom-devtools/heirloom-devtools-999999.ebuild61
-rw-r--r--sys-devel/heirloom-devtools/metadata.xml8
-rw-r--r--sys-devel/icecream/Manifest2
-rw-r--r--sys-devel/icecream/files/0.9.6-crosscompile.patch12
-rw-r--r--sys-devel/icecream/files/0.9.6-symlinks.patch19
-rw-r--r--sys-devel/icecream/files/0.9.7-automake.patch32
-rw-r--r--sys-devel/icecream/files/0.9.7-glibc2.16.patch16
-rw-r--r--sys-devel/icecream/files/icecream44
-rw-r--r--sys-devel/icecream/files/icecream-1.0.0-libcap-ng.patch8
-rw-r--r--sys-devel/icecream/files/icecream-conf.d-verbosity.patch18
-rw-r--r--sys-devel/icecream/files/icecream-config69
-rw-r--r--sys-devel/icecream/files/icecream-create-env82
-rw-r--r--sys-devel/icecream/files/icecream-gentoo-multilib.patch59
-rw-r--r--sys-devel/icecream/files/icecream-r245
-rw-r--r--sys-devel/icecream/icecream-0.9.7-r1.ebuild87
-rw-r--r--sys-devel/icecream/icecream-1.0.0-r1.ebuild52
-rw-r--r--sys-devel/icecream/metadata.xml9
-rw-r--r--sys-devel/kgcc64/Manifest34
-rw-r--r--sys-devel/kgcc64/kgcc64-3.4.6.ebuild73
-rw-r--r--sys-devel/kgcc64/kgcc64-4.1.2.ebuild54
-rw-r--r--sys-devel/kgcc64/kgcc64-4.2.4.ebuild48
-rw-r--r--sys-devel/kgcc64/kgcc64-4.3.5.ebuild49
-rw-r--r--sys-devel/kgcc64/kgcc64-4.4.5.ebuild55
-rw-r--r--sys-devel/kgcc64/kgcc64-4.4.6.ebuild55
-rw-r--r--sys-devel/kgcc64/kgcc64-4.5.3.ebuild56
-rw-r--r--sys-devel/kgcc64/kgcc64-4.5.4.ebuild56
-rw-r--r--sys-devel/kgcc64/kgcc64-4.6.3.ebuild56
-rw-r--r--sys-devel/kgcc64/kgcc64-4.6.4.ebuild56
-rw-r--r--sys-devel/kgcc64/kgcc64-4.7.3.ebuild56
-rw-r--r--sys-devel/kgcc64/kgcc64-4.7.4.ebuild63
-rw-r--r--sys-devel/kgcc64/kgcc64-4.8.1.ebuild56
-rw-r--r--sys-devel/kgcc64/kgcc64-4.8.2.ebuild56
-rw-r--r--sys-devel/kgcc64/kgcc64-4.8.3.ebuild56
-rw-r--r--sys-devel/kgcc64/kgcc64-4.9.1.ebuild56
-rw-r--r--sys-devel/kgcc64/kgcc64-4.9.2.ebuild56
-rw-r--r--sys-devel/kgcc64/metadata.xml11
-rw-r--r--sys-devel/libtool/Manifest4
-rw-r--r--sys-devel/libtool/files/1.5.20/libtool-1.5.20-use-linux-version-in-fbsd.patch38
-rw-r--r--sys-devel/libtool/files/libtool-2.4.3-use-linux-version-in-fbsd.patch38
-rw-r--r--sys-devel/libtool/files/libtool-2.4.6-fuse-ld.patch34
-rw-r--r--sys-devel/libtool/libtool-2.4.2-r1.ebuild96
-rw-r--r--sys-devel/libtool/libtool-2.4.4.ebuild77
-rw-r--r--sys-devel/libtool/libtool-2.4.5.ebuild77
-rw-r--r--sys-devel/libtool/libtool-2.4.6-r1.ebuild78
-rw-r--r--sys-devel/libtool/libtool-2.4.6.ebuild77
-rw-r--r--sys-devel/libtool/libtool-9999.ebuild75
-rw-r--r--sys-devel/libtool/metadata.xml5
-rw-r--r--sys-devel/llvm/Manifest42
-rw-r--r--sys-devel/llvm/files/cl-patches/0001-r600-Add-some-intrinsic-definitions.patch64
-rw-r--r--sys-devel/llvm/files/cl-patches/0002-r600-Add-get_global_size-and-get_local_size-intrinsi.patch27
-rw-r--r--sys-devel/llvm/files/clang-3.1-gentoo-runtime-gcc-detection-v3.patch29
-rw-r--r--sys-devel/llvm/files/clang-3.3-gcc-header-path.patch90
-rw-r--r--sys-devel/llvm/files/clang-3.3-gentoo-install.patch71
-rw-r--r--sys-devel/llvm/files/clang-3.4-darwin_build_fix.patch47
-rw-r--r--sys-devel/llvm/files/clang-3.4-darwin_prefix-include-paths.patch18
-rw-r--r--sys-devel/llvm/files/clang-3.4-gentoo-install.patch80
-rw-r--r--sys-devel/llvm/files/clang-3.5-gentoo-install.patch57
-rw-r--r--sys-devel/llvm/files/clang-3.5-gentoo-runtime-gcc-detection-v3.patch42
-rw-r--r--sys-devel/llvm/files/clang-3.6-fbsd-gcc49.patch25
-rw-r--r--sys-devel/llvm/files/clang-3.6-gentoo-install.patch48
-rw-r--r--sys-devel/llvm/files/cmake/0002-cmake-Support-overriding-Sphinx-HTML-doc-install-dir.patch36
-rw-r--r--sys-devel/llvm/files/cmake/0003-cmake-Add-an-ordering-dep-between-HTML-man-Sphinx-ta.patch32
-rw-r--r--sys-devel/llvm/files/cmake/0004-cmake-Do-not-install-libgtest.patch28
-rw-r--r--sys-devel/llvm/files/cmake/clang-0001-Install-clang-runtime-into-usr-lib-without-suffix.patch52
-rw-r--r--sys-devel/llvm/files/cmake/clang-0002-cmake-Make-CLANG_LIBDIR_SUFFIX-overridable.patch28
-rw-r--r--sys-devel/llvm/files/cmake/compiler-rt-0001-cmake-Install-compiler-rt-into-usr-lib-without-suffi.patch25
-rw-r--r--sys-devel/llvm/files/llvm-2.6-commandguide-nops.patch30
-rw-r--r--sys-devel/llvm/files/llvm-2.7-nodoctargz.patch47
-rw-r--r--sys-devel/llvm/files/llvm-2.8-alignof.patch59
-rw-r--r--sys-devel/llvm/files/llvm-2.8-darwin8.patch15
-rw-r--r--sys-devel/llvm/files/llvm-2.9-Operator.h-c++0x.patch57
-rw-r--r--sys-devel/llvm/files/llvm-2.9-gcc4.7.patch14
-rw-r--r--sys-devel/llvm/files/llvm-2.9-nodoctargz.patch39
-rw-r--r--sys-devel/llvm/files/llvm-3.0-PPCCompilationCallbackC_static.patch27
-rw-r--r--sys-devel/llvm/files/llvm-3.0-PPC_macro.patch43
-rw-r--r--sys-devel/llvm/files/llvm-3.0-gold_LTO_link.patch10
-rw-r--r--sys-devel/llvm/files/llvm-3.0-ocaml_install.patch16
-rw-r--r--sys-devel/llvm/files/llvm-3.0-set_soname.patch12
-rw-r--r--sys-devel/llvm/files/llvm-3.1-ExecutionEngine_tests_xfail_arm.patch27
-rw-r--r--sys-devel/llvm/files/llvm-3.1-docs-pod-markup-fixes.patch28
-rw-r--r--sys-devel/llvm/files/llvm-3.1-fix_debug_line_info.patch65
-rw-r--r--sys-devel/llvm/files/llvm-3.1-ivybridge_support.patch13
-rw-r--r--sys-devel/llvm/files/llvm-3.2-nodoctargz.patch45
-rw-r--r--sys-devel/llvm/files/llvm-3.3-R600_debug.patch22
-rw-r--r--sys-devel/llvm/files/llvm-3.3-cmake-modulepath.patch24
-rw-r--r--sys-devel/llvm/files/llvm-3.3-gentoo-install.patch141
-rw-r--r--sys-devel/llvm/files/llvm-3.3-insecure-rpath.patch30
-rw-r--r--sys-devel/llvm/files/llvm-3.3-r2-gentoo-install.patch117
-rw-r--r--sys-devel/llvm/files/llvm-3.4-cmake-configparser.patch35
-rw-r--r--sys-devel/llvm/files/llvm-3.4-fix_varargs.patch148
-rw-r--r--sys-devel/llvm/files/llvm-3.4-gentoo-install.patch96
-rw-r--r--sys-devel/llvm/files/llvm-3.5-gcc-4.9.patch43
-rw-r--r--sys-devel/llvm/files/llvm-3.5-gentoo-install.patch83
-rw-r--r--sys-devel/llvm/files/llvm-3.5.0-fix_LLVMExports_cmake.patch39
-rw-r--r--sys-devel/llvm/files/llvm-3.5.2-gcc-5.1.patch14
-rw-r--r--sys-devel/llvm/files/llvm-3.6-gentoo-install.patch82
-rw-r--r--sys-devel/llvm/files/llvm-3.6.0-ocaml-ctypes-0.4.0.patch35
-rw-r--r--sys-devel/llvm/files/llvm-3.7-nodoctargz.patch49
-rw-r--r--sys-devel/llvm/llvm-2.8-r2.ebuild168
-rw-r--r--sys-devel/llvm/llvm-2.9-r2.ebuild175
-rw-r--r--sys-devel/llvm/llvm-3.0-r2.ebuild181
-rw-r--r--sys-devel/llvm/llvm-3.1-r2.ebuild191
-rw-r--r--sys-devel/llvm/llvm-3.2.ebuild206
-rw-r--r--sys-devel/llvm/llvm-3.3-r3.ebuild500
-rw-r--r--sys-devel/llvm/llvm-3.4.2.ebuild543
-rw-r--r--sys-devel/llvm/llvm-3.5.0.ebuild530
-rw-r--r--sys-devel/llvm/llvm-3.5.1.ebuild530
-rw-r--r--sys-devel/llvm/llvm-3.5.2.ebuild532
-rw-r--r--sys-devel/llvm/llvm-3.6.0.ebuild534
-rw-r--r--sys-devel/llvm/llvm-3.6.1.ebuild541
-rw-r--r--sys-devel/llvm/llvm-3.6.2.ebuild541
-rw-r--r--sys-devel/llvm/llvm-9999.ebuild487
-rw-r--r--sys-devel/llvm/metadata.xml28
-rw-r--r--sys-devel/m4/Manifest2
-rw-r--r--sys-devel/m4/files/m4-1.4.16-fix-test-readlink.patch11
-rw-r--r--sys-devel/m4/files/m4-1.4.16-no-gets.patch24
-rw-r--r--sys-devel/m4/m4-1.4.16.ebuild55
-rw-r--r--sys-devel/m4/m4-1.4.17.ebuild51
-rw-r--r--sys-devel/m4/metadata.xml5
-rw-r--r--sys-devel/make/Manifest5
-rw-r--r--sys-devel/make/files/3.80-memory.patch77
-rw-r--r--sys-devel/make/files/make-3.80-conditional-eval.patch157
-rw-r--r--sys-devel/make/files/make-3.80-parallel-build-failure.patch59
-rw-r--r--sys-devel/make/files/make-3.81-jobserver.patch19
-rw-r--r--sys-devel/make/files/make-3.81-long-cmdline.patch100
-rw-r--r--sys-devel/make/files/make-3.81-tests-lang.patch55
-rw-r--r--sys-devel/make/files/make-3.81-tests-recursion.patch14
-rw-r--r--sys-devel/make/files/make-3.82-MAKEFLAGS-reexec.patch14
-rw-r--r--sys-devel/make/files/make-3.82-archives-many-objs.patch60
-rw-r--r--sys-devel/make/files/make-3.82-construct-command-line.patch71
-rw-r--r--sys-devel/make/files/make-3.82-copy-on-expand.patch58
-rw-r--r--sys-devel/make/files/make-3.82-darwin-library_search-dylib.patch17
-rw-r--r--sys-devel/make/files/make-3.82-glob-speedup.patch104
-rw-r--r--sys-devel/make/files/make-3.82-intermediate-parallel.patch62
-rw-r--r--sys-devel/make/files/make-3.82-long-command-line.patch54
-rw-r--r--sys-devel/make/files/make-3.82-memory-corruption.patch37
-rw-r--r--sys-devel/make/files/make-3.82-oneshell.patch24
-rw-r--r--sys-devel/make/files/make-3.82-parallel-remake.patch39
-rw-r--r--sys-devel/make/files/make-4.0-char-cast.patch46
-rw-r--r--sys-devel/make/files/make-4.1-fix_null_returns_from_ttyname.patch53
-rw-r--r--sys-devel/make/make-3.80-r4.ebuild43
-rw-r--r--sys-devel/make/make-3.81-r2.ebuild46
-rw-r--r--sys-devel/make/make-3.82-r4.ebuild51
-rw-r--r--sys-devel/make/make-4.0-r1.ebuild47
-rw-r--r--sys-devel/make/make-4.1-r1.ebuild47
-rw-r--r--sys-devel/make/metadata.xml5
-rw-r--r--sys-devel/metadata.xml38
-rw-r--r--sys-devel/multilib-gcc-wrapper/metadata.xml12
-rw-r--r--sys-devel/multilib-gcc-wrapper/multilib-gcc-wrapper-0.ebuild72
-rw-r--r--sys-devel/native-cctools/files/aix-2/ld139
-rw-r--r--sys-devel/native-cctools/files/aix-2/mkexpfile70
-rw-r--r--sys-devel/native-cctools/files/aix-2/nm6
-rw-r--r--sys-devel/native-cctools/files/ld-aix-1141
-rw-r--r--sys-devel/native-cctools/files/ld-aix-2139
-rw-r--r--sys-devel/native-cctools/metadata.xml5
-rw-r--r--sys-devel/native-cctools/native-cctools-1.ebuild108
-rw-r--r--sys-devel/native-cctools/native-cctools-2.ebuild108
-rw-r--r--sys-devel/native-cctools/native-cctools-4.ebuild111
-rw-r--r--sys-devel/parity/Manifest3
-rw-r--r--sys-devel/parity/files/parity-1.2.6-debugging.patch17
-rw-r--r--sys-devel/parity/metadata.xml11
-rw-r--r--sys-devel/parity/parity-1.2.4.ebuild58
-rw-r--r--sys-devel/parity/parity-1.2.5.ebuild58
-rw-r--r--sys-devel/parity/parity-1.2.6.ebuild63
-rw-r--r--sys-devel/parity/parity-9999.ebuild57
-rw-r--r--sys-devel/patch/Manifest3
-rw-r--r--sys-devel/patch/metadata.xml5
-rw-r--r--sys-devel/patch/patch-2.7.3.ebuild30
-rw-r--r--sys-devel/patch/patch-2.7.4.ebuild30
-rw-r--r--sys-devel/patch/patch-2.7.5.ebuild30
-rw-r--r--sys-devel/pmake/Manifest3
-rw-r--r--sys-devel/pmake/files/pmake-1.111.1-ldflags.patch13
-rw-r--r--sys-devel/pmake/files/pmake-1.98-skipdots.patch12
-rw-r--r--sys-devel/pmake/metadata.xml5
-rw-r--r--sys-devel/pmake/pmake-1.111.3.1.ebuild81
-rw-r--r--sys-devel/pmake/pmake-1.111.3.3.ebuild81
-rw-r--r--sys-devel/prelink/Manifest4
-rw-r--r--sys-devel/prelink/files/prelink-20061201-prelink-conf.patch31
-rw-r--r--sys-devel/prelink/files/prelink-20130503-libiberty-md5.patch61
-rw-r--r--sys-devel/prelink/files/prelink-20130503-prelink-conf.patch39
-rw-r--r--sys-devel/prelink/files/prelink-armhf-dynamic-linker.patch12
-rw-r--r--sys-devel/prelink/files/prelink.confd43
-rw-r--r--sys-devel/prelink/files/prelink.cron61
-rw-r--r--sys-devel/prelink/metadata.xml5
-rw-r--r--sys-devel/prelink/prelink-20110511.ebuild75
-rw-r--r--sys-devel/prelink/prelink-20111012.ebuild81
-rw-r--r--sys-devel/prelink/prelink-20120628.ebuild91
-rw-r--r--sys-devel/prelink/prelink-20130503.ebuild84
-rw-r--r--sys-devel/qconf/Manifest1
-rw-r--r--sys-devel/qconf/metadata.xml8
-rw-r--r--sys-devel/qconf/qconf-1.5_pre717-r1.ebuild39
-rw-r--r--sys-devel/remake/Manifest5
-rw-r--r--sys-devel/remake/metadata.xml8
-rw-r--r--sys-devel/remake/remake-3.81.0.2.ebuild23
-rw-r--r--sys-devel/remake/remake-3.81.0.3.ebuild23
-rw-r--r--sys-devel/remake/remake-3.82.0.4.ebuild26
-rw-r--r--sys-devel/remake/remake-3.82.0.9.ebuild27
-rw-r--r--sys-devel/remake/remake-4.1.1.1.ebuild32
-rw-r--r--sys-devel/smatch/Manifest2
-rw-r--r--sys-devel/smatch/files/smatch-1.57-restrict.patch14
-rw-r--r--sys-devel/smatch/metadata.xml6
-rw-r--r--sys-devel/smatch/smatch-1.57-r1.ebuild55
-rw-r--r--sys-devel/smatch/smatch-1.57.ebuild54
-rw-r--r--sys-devel/smatch/smatch-1.59.ebuild64
-rw-r--r--sys-devel/smatch/smatch-9999.ebuild64
-rw-r--r--sys-devel/sparse/Manifest3
-rw-r--r--sys-devel/sparse/files/sparse-0.4.3-gentoo.patch49
-rw-r--r--sys-devel/sparse/metadata.xml16
-rw-r--r--sys-devel/sparse/sparse-0.4.3.ebuild65
-rw-r--r--sys-devel/sparse/sparse-0.4.4.ebuild47
-rw-r--r--sys-devel/sparse/sparse-0.5.0.ebuild48
-rw-r--r--sys-devel/sparse/sparse-9999.ebuild48
-rw-r--r--sys-devel/systemd-m4/metadata.xml16
-rw-r--r--sys-devel/systemd-m4/systemd-m4-9999.ebuild28
-rw-r--r--sys-devel/ucpp/Manifest1
-rw-r--r--sys-devel/ucpp/metadata.xml6
-rw-r--r--sys-devel/ucpp/ucpp-1.3.4.ebuild28
-rw-r--r--sys-devel/ucpp/ucpp-9999.ebuild32
758 files changed, 56931 insertions, 0 deletions
diff --git a/sys-devel/autoconf-archive/Manifest b/sys-devel/autoconf-archive/Manifest
new file mode 100644
index 000000000000..f35ae447eb49
--- /dev/null
+++ b/sys-devel/autoconf-archive/Manifest
@@ -0,0 +1,6 @@
+DIST autoconf-archive-2012.09.08.tar.xz 510856 SHA256 59c897e83e4dac893b2a7cdf0e0035b32490f27f59ac1825feea44dc1e3ee246 SHA512 97595d6cd38de225224164264a5674f981fe29ffebea26b1f1e76b79c678ed22e5c3129c031b1f7eccd7edce26e811f08d8bc23797c3b1afcbdae5990fbb5e94 WHIRLPOOL a04ce556fb23c180f3f3e233971e6a89d01097b4ef3d333a4b3155f31112389132a41131693339b735966e6c93c64519a34b3aa63d24f9806e8c6e335908ea18
+DIST autoconf-archive-2013.06.09.tar.xz 531052 SHA256 a98d0a7bf74ee74754096e7233d4132baafe15d212b2c903dc0bfef41e7048b5 SHA512 585ed5972b5fc2333c3aee6bf83931a80bc864c167006214d719aac27156aa6fa63bb33005980cf1fcd8ac836f58e35f9217ec9e8bcd9063615226f50786e943 WHIRLPOOL 7aaf23101105c32dc6b22aa8c8b8b1d23f50ed426ec0d3c1724f81270027839426b292d0eda6050b58d5fe2a18fe4dcbb188dfd4f43695282a07d95465fed84a
+DIST autoconf-archive-2013.11.01.tar.xz 540316 SHA256 78ab75310cfacc5d71b4dacbce97450eed21a27afeb3a0f0fa48b3e0ec1c0161 SHA512 2360c1016e708c9669dca681811231872301559253bda5286eaf006046445711a692dff75c299cc9fd077166d0f7c871e1930c6cfe089408de95cb069e3ad63e WHIRLPOOL 184c48ca9acd653cc9a8853cdab3c18d5051f8efaadf5ad721e74414feba66b4aaf84ab21276fae2fe42f3c594b0c7fee7b52399327642acf4e50de0ed05a5ee
+DIST autoconf-archive-2014.02.28.tar.xz 550416 SHA256 f4b22a73654f98bf70201bee6913418426d0b2836bf833719ca38b8b19fe503b SHA512 196e4d41a2e3f5c4af1386388bfdeef904fb433f82920a6baf73cb8f938efe8d11b73ff96d34afab2c795458327bb4c6b2c35fa127312a8b64c10f8ab102c99b WHIRLPOOL 20e69ac1de4c847341e2a443050b588c5504e6b3b44453512deee0ce09a110da0b26913aed31422c6180e3222e54b75241aa801f22b3067364118fef7d7c6057
+DIST autoconf-archive-2015.02.04.tar.xz 575956 SHA256 dfd460d23a9690322dee29a355ea285b5774f37383d3741cf77a4ad6a11a7e81 SHA512 54382adcf55b9dd126de6727c034cae7c72c8217c9979d3b889705c3bfe41ec8329621dea5ff592ebf7e530775ce96faf47baffe36e8fedf9cd78c8dc423932e WHIRLPOOL 82298941615179234da8f1ab360ddb890d32ef54e983dd90965f766b0d89d6322867f5bff06954e4cc67c7d59819284350e4f8cfc85c44a7fd4d4b015bb383f2
+DIST autoconf-archive-2015.02.24.tar.xz 578536 SHA256 69715bdd078f552ca85e498a94543e11cb8bcdf0359e659b84d84d19372b0dc5 SHA512 111cb9ba8abac766dd9dc7d96cd3a4a3f845430a3f3365712765eb61adc00f3d278ae0ddbda950a08c2a34091023a2d889896f716b0379d7f328eae35a246e17 WHIRLPOOL c8dcd24520da545a4e1a909f83d8d0a41491eac723714437e486e5fa8e335f097e751990f5513e67cc7bd6e8f328b2ef5faeb22407c5b8daec089e3a9255c7d5
diff --git a/sys-devel/autoconf-archive/autoconf-archive-2012.09.08.ebuild b/sys-devel/autoconf-archive/autoconf-archive-2012.09.08.ebuild
new file mode 100644
index 000000000000..6785d97dec4e
--- /dev/null
+++ b/sys-devel/autoconf-archive/autoconf-archive-2012.09.08.ebuild
@@ -0,0 +1,21 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+DESCRIPTION="GNU Autoconf Macro Archive"
+HOMEPAGE="http://www.gnu.org/software/autoconf-archive/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~ia64-hpux ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x86-solaris"
+IUSE=""
+
+DOCS=( AUTHORS ChangeLog NEWS README TODO )
+
+src_install() {
+ default
+ rm -rf "${ED}/usr/share/${PN}" || die
+}
diff --git a/sys-devel/autoconf-archive/autoconf-archive-2013.06.09.ebuild b/sys-devel/autoconf-archive/autoconf-archive-2013.06.09.ebuild
new file mode 100644
index 000000000000..86d183365721
--- /dev/null
+++ b/sys-devel/autoconf-archive/autoconf-archive-2013.06.09.ebuild
@@ -0,0 +1,21 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+DESCRIPTION="GNU Autoconf Macro Archive"
+HOMEPAGE="http://www.gnu.org/software/autoconf-archive/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~ia64-hpux ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x86-solaris"
+IUSE=""
+
+DOCS=( AUTHORS ChangeLog NEWS README TODO )
+
+src_install() {
+ default
+ rm -rf "${ED}/usr/share/${PN}" || die
+}
diff --git a/sys-devel/autoconf-archive/autoconf-archive-2013.11.01.ebuild b/sys-devel/autoconf-archive/autoconf-archive-2013.11.01.ebuild
new file mode 100644
index 000000000000..86d183365721
--- /dev/null
+++ b/sys-devel/autoconf-archive/autoconf-archive-2013.11.01.ebuild
@@ -0,0 +1,21 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+DESCRIPTION="GNU Autoconf Macro Archive"
+HOMEPAGE="http://www.gnu.org/software/autoconf-archive/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~ia64-hpux ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x86-solaris"
+IUSE=""
+
+DOCS=( AUTHORS ChangeLog NEWS README TODO )
+
+src_install() {
+ default
+ rm -rf "${ED}/usr/share/${PN}" || die
+}
diff --git a/sys-devel/autoconf-archive/autoconf-archive-2014.02.28.ebuild b/sys-devel/autoconf-archive/autoconf-archive-2014.02.28.ebuild
new file mode 100644
index 000000000000..c1970b2ffb48
--- /dev/null
+++ b/sys-devel/autoconf-archive/autoconf-archive-2014.02.28.ebuild
@@ -0,0 +1,21 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+DESCRIPTION="GNU Autoconf Macro Archive"
+HOMEPAGE="http://www.gnu.org/software/autoconf-archive/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~ia64-hpux ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x86-solaris"
+IUSE=""
+
+DOCS=( AUTHORS ChangeLog NEWS README TODO )
+
+src_install() {
+ default
+ rm -rf "${ED}/usr/share/${PN}" || die
+}
diff --git a/sys-devel/autoconf-archive/autoconf-archive-2015.02.04.ebuild b/sys-devel/autoconf-archive/autoconf-archive-2015.02.04.ebuild
new file mode 100644
index 000000000000..c3361b56d96c
--- /dev/null
+++ b/sys-devel/autoconf-archive/autoconf-archive-2015.02.04.ebuild
@@ -0,0 +1,26 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+DESCRIPTION="GNU Autoconf Macro Archive"
+HOMEPAGE="http://www.gnu.org/software/autoconf-archive/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="alpha amd64 arm ~arm64 ~hppa ~ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86 ~ppc-aix ~ia64-hpux ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x86-solaris"
+IUSE=""
+
+#file collisions, bug #540246
+RDEPEND="!=gnome-base/gnome-common-3.14.0
+ !>=gnome-base/gnome-common-3.14.0-r1[-autoconf-archive(+)]"
+DEPEND=""
+
+DOCS=( AUTHORS ChangeLog NEWS README TODO )
+
+src_install() {
+ default
+ rm -rf "${ED}/usr/share/${PN}" || die
+}
diff --git a/sys-devel/autoconf-archive/autoconf-archive-2015.02.24.ebuild b/sys-devel/autoconf-archive/autoconf-archive-2015.02.24.ebuild
new file mode 100644
index 000000000000..c5c467d5eb2a
--- /dev/null
+++ b/sys-devel/autoconf-archive/autoconf-archive-2015.02.24.ebuild
@@ -0,0 +1,26 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+DESCRIPTION="GNU Autoconf Macro Archive"
+HOMEPAGE="http://www.gnu.org/software/autoconf-archive/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~ia64-hpux ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x86-solaris"
+IUSE=""
+
+#file collisions, bug #540246
+RDEPEND="!=gnome-base/gnome-common-3.14.0
+ !>=gnome-base/gnome-common-3.14.0-r1[-autoconf-archive(+)]"
+DEPEND=""
+
+DOCS=( AUTHORS ChangeLog NEWS README TODO )
+
+src_install() {
+ default
+ rm -rf "${ED}/usr/share/${PN}" || die
+}
diff --git a/sys-devel/autoconf-archive/metadata.xml b/sys-devel/autoconf-archive/metadata.xml
new file mode 100644
index 000000000000..3708129356b7
--- /dev/null
+++ b/sys-devel/autoconf-archive/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>
+ <maintainer>
+ <email>binki@gentoo.org</email>
+ <name>Nathan Phillip Brink</name>
+ </maintainer>
+</pkgmetadata>
diff --git a/sys-devel/autoconf-wrapper/autoconf-wrapper-13.ebuild b/sys-devel/autoconf-wrapper/autoconf-wrapper-13.ebuild
new file mode 100644
index 000000000000..18a7f03be610
--- /dev/null
+++ b/sys-devel/autoconf-wrapper/autoconf-wrapper-13.ebuild
@@ -0,0 +1,27 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit multilib
+
+DESCRIPTION="wrapper for autoconf to manage multiple autoconf versions"
+HOMEPAGE="http://www.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~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=""
+
+S=${WORKDIR}
+
+src_install() {
+ exeinto /usr/$(get_libdir)/misc
+ newexe "${FILESDIR}"/ac-wrapper-${PV}.sh ac-wrapper.sh || die
+
+ dodir /usr/bin
+ local x=
+ for x in auto{conf,header,m4te,reconf,scan,update} ifnames ; do
+ dosym ../$(get_libdir)/misc/ac-wrapper.sh /usr/bin/${x} || die
+ done
+}
diff --git a/sys-devel/autoconf-wrapper/files/ac-wrapper-13.sh b/sys-devel/autoconf-wrapper/files/ac-wrapper-13.sh
new file mode 100755
index 000000000000..93be1cd929a8
--- /dev/null
+++ b/sys-devel/autoconf-wrapper/files/ac-wrapper-13.sh
@@ -0,0 +1,202 @@
+#!/bin/sh
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# Based on the ac-wrapper.pl script provided by MandrakeSoft
+# Rewritten in bash by Gregorio Guidi
+#
+# Executes the correct autoconf version.
+#
+# - defaults to newest version available (hopefully autoconf-2.60)
+# - runs autoconf 2.13 if:
+# - envvar WANT_AUTOCONF is set to `2.1'
+# -or-
+# - `ac{local,include}.m4' or `configure.{in,ac}' have AC_PREREQ(2.1) (not higher)
+# -or-
+# - `configure' is already present and was generated by autoconf 2.13
+
+warn() { printf "ac-wrapper: $*\n" 1>&2; }
+err() { warn "$@"; exit 1; }
+unset IFS
+which() {
+ local p
+ IFS=: # we don't use IFS anywhere, so don't bother saving/restoring
+ for p in ${PATH} ; do
+ p="${p}/$1"
+ [ -e "${p}" ] && echo "${p}" && return 0
+ done
+ unset IFS
+ return 1
+}
+
+#
+# Sanitize argv[0] since it isn't always a full path #385201
+#
+argv0=${0##*/}
+case ${0} in
+ ${argv0})
+ # find it in PATH
+ if ! full_argv0=$(which "${argv0}") ; then
+ err "could not locate ${argv0}; file a bug"
+ fi
+ ;;
+ *)
+ # re-use full/relative paths
+ full_argv0=$0
+ ;;
+esac
+
+if [ "${argv0}" = "ac-wrapper.sh" ] ; then
+ err "Don't call this script directly"
+fi
+
+if [ "${WANT_AUTOCONF}" = "2.1" ] && [ "${argv0}" = "autom4te" ] ; then
+ err "Autoconf 2.13 doesn't contain autom4te.\n" \
+ " Either unset WANT_AUTOCONF or don't execute anything\n" \
+ " that would use autom4te."
+fi
+
+if ! seq 0 0 2>/dev/null 1>&2 ; then #338518
+ seq() {
+ local f l i
+ case $# in
+ 1) f=1 i=1 l=$1;;
+ 2) f=$1 i=1 l=$2;;
+ 3) f=$1 i=$2 l=$3;;
+ esac
+ while :; do
+ [ $l -lt $f -a $i -gt 0 ] && break
+ [ $f -lt $l -a $i -lt 0 ] && break
+ echo $f
+ : $(( f += i ))
+ done
+ return 0
+ }
+fi
+
+#
+# Set up bindings between actual version and WANT_AUTOCONF;
+# Start at last known unstable/stable versions to speed up lookup process.
+#
+KNOWN_AUTOCONF="2.69:2.5 2.68:2.5"
+vers="${KNOWN_AUTOCONF} 9999:2.5 $(printf '2.%s:2.5 ' `seq 99 -1 59`) 2.13:2.1"
+
+binary=""
+for v in ${vers} ; do
+ auto_ver=${v%:*}
+ if [ -z "${binary}" ] && [ -x "${full_argv0}-${auto_ver}" ] ; then
+ binary="${full_argv0}-${auto_ver}"
+ break
+ fi
+done
+if [ -z "${binary}" ] ; then
+ err "Unable to locate any usuable version of autoconf.\n" \
+ "\tI tried these versions: ${vers}\n" \
+ "\tWith a base name of '${full_argv0}'."
+fi
+
+#
+# Check the WANT_AUTOCONF setting. We accept a whitespace delimited
+# list of autoconf versions.
+#
+if [ -n "${WANT_AUTOCONF}" ] ; then
+ for v in ${vers} x ; do
+ if [ "${v}" = "x" ] ; then
+ warn "warning: invalid WANT_AUTOCONF '${WANT_AUTOCONF}'; ignoring."
+ unset WANT_AUTOCONF
+ break
+ fi
+
+ auto_ver=${v%:*}
+ want_ver=${v#*:}
+ for wx in ${WANT_AUTOCONF} ; do
+ if [ -x "${full_argv0}-${wx}" ] ; then
+ binary="${full_argv0}-${wx}"
+ v="x"
+ elif [ "${wx}" = "${want_ver}" ] && [ -x "${full_argv0}-${auto_ver}" ] ; then
+ binary="${full_argv0}-${auto_ver}"
+ v="x"
+ fi
+ done
+ [ "${v}" = "x" ] && break
+ done
+fi
+
+#
+# autodetect helpers
+#
+acprereq_version() {
+ sed -n -r \
+ -e '/^\s*(#|dnl)/d' \
+ -e '/AC_PREREQ/s:.*AC_PREREQ\s*\(\[?\s*([0-9.]+)\s*\]?\):\1:p' \
+ "$@" |
+ LC_ALL=C sort -n -t . |
+ tail -1
+}
+
+generated_version() {
+ local re='^# Generated (by (GNU )?Autoconf|automatically using autoconf version) ([0-9.]+).*'
+ sed -n -r "/${re}/{s:${re}:\3:;p;q}" "$@"
+}
+
+#
+# autodetect routine
+#
+if [ "${WANT_AUTOCONF}" = "2.1" ] && [ -f "configure.ac" ] ; then
+ err "Since configure.ac is present, aclocal always use\n" \
+ "\tautoconf 2.59+, which conflicts with your choice and\n" \
+ "\tcauses error. You have two options:\n" \
+ "\t1. Try execute command again after removing configure.ac\n" \
+ "\t2. Don't set WANT_AUTOCONF"
+fi
+
+if [ "${WANT_AUTOCONF:-2.1}" = "2.1" ] && [ -n "${WANT_AUTOMAKE}" ] ; then
+ # Automake-1.7 and better require autoconf-2.5x so if WANT_AUTOMAKE
+ # is set to an older version, let's do some sanity checks.
+ case "${WANT_AUTOMAKE}" in
+ 1.[456])
+ acfiles=$(ls ac{local,include}.m4 configure.{in,ac} 2>/dev/null)
+ [ -n "${acfiles}" ] && confversion=$(acprereq_version ${acfiles})
+
+ [ -z "${confversion}" ] && [ -r "configure" ] \
+ && confversion=$(generated_version configure)
+
+ if [ "${confversion}" = "2.1" ] && [ ! -f "configure.ac" ] ; then
+ binary="${full_argv0}-2.13"
+ fi
+ esac
+fi
+
+if [ -n "${WANT_ACWRAPPER_DEBUG}" ] ; then
+ if [ -n "${WANT_AUTOCONF}" ] ; then
+ warn "DEBUG: WANT_AUTOCONF is set to ${WANT_AUTOCONF}"
+ fi
+ warn "DEBUG: will execute <${binary}>"
+fi
+
+#
+# for further consistency
+#
+if [ -z "${WANT_AUTOCONF}" ] ; then
+ for v in ${vers} ; do
+ auto_ver=${v%:*}
+ want_ver=${v#*:}
+ if [ "${binary}" = "${full_argv0}-${auto_ver}" ] ; then
+ export WANT_AUTOCONF="${want_ver}"
+ break
+ fi
+ done
+fi
+
+#
+# Now try to run the binary
+#
+if [ ! -x "${binary}" ] ; then
+ # this shouldn't happen
+ err "${binary} is missing or not executable.\n" \
+ "\tPlease try emerging the correct version of autoconf."
+fi
+
+exec "${binary}" "$@"
+# The shell will error out if `exec` failed.
diff --git a/sys-devel/autoconf-wrapper/metadata.xml b/sys-devel/autoconf-wrapper/metadata.xml
new file mode 100644
index 000000000000..96a2d586367d
--- /dev/null
+++ b/sys-devel/autoconf-wrapper/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-devel/autoconf/Manifest b/sys-devel/autoconf/Manifest
new file mode 100644
index 000000000000..98b210de422f
--- /dev/null
+++ b/sys-devel/autoconf/Manifest
@@ -0,0 +1,10 @@
+DIST autoconf-2.13.tar.gz 443844 SHA256 f0611136bee505811e9ca11ca7ac188ef5323a8e2ef19cffd3edb3cf08fd791e SHA512 602584f4c77b7a554aaa068eda5409b68eb0b3229e9c224bffb91c83c4314d25de15bd560a323626ff78f6df339c79e1ef8938c54b78ecadf4dc75c5241290ad WHIRLPOOL 918e5e4679f0a2ae84299f190904be05f2c69e8cddf97c6b1a6e82ba20768f4c97ac451b0b6159800bad6635633f9d772a403be8c724ea782bf7725d2905f180
+DIST autoconf-2.59.tar.bz2 925073 SHA256 f0cde70a8f135098a6a3e85869f2e1cc3f141beea766fa3d6636e086cd8b90a7 SHA512 0f57e57b94ef78d59e68476746e78de9c8d0c07bcfdbdb850c2e68b59cdbef7e6256a073d1ae8965abd30611f22c1dc451ecdf67aff43102f73ec118c51ab4d6 WHIRLPOOL 4330fe3d19c26759e7babd2470cf3fb3cc8c6632fee6014ca33c2f8339ddb3114f4376b14cad4126a4dd496aecfc3f68d623061752836094c893894ede693a8b
+DIST autoconf-2.61.tar.bz2 1042439 SHA256 93a2ceab963618b021db153f0c881a2de82455c1dc7422be436fcd5c554085a1 SHA512 f534c7dbc10fc871cc99b1cb68bd7f19d888677d9e2af47e904e91fe90420c20e7a270da2681da82e249ffb46c92165202cc73e125a9b14abd604458731b0026 WHIRLPOOL fd608032198954f05f83e65cd118eb91dc74b0e3b2831594cc2a88f90a5120f56381863913cf661927baeb3aae5b99406a904ccbfb48fe4bf5757e17d455de67
+DIST autoconf-2.62.tar.bz2 1165951 SHA256 42be7628e32fd3bebe07d684b11fb6e7e7920ef698fc4ccb3da6d77f91cefb96 SHA512 98a2d903e8c43088ac60b880f58d7c35c547824c277dbeb14c48f846e40f29546c20e942f99127ffdc6f6607c334a6054328f20a9a2962972cc80570665ee7d7 WHIRLPOOL bfef8abab1a6776859369d5ffce960a17ae25208312b5a78ddcac97adb0a4464c25043a2bbf8461a8fcb528dc878a8bbc04debe67701ade47eae8a67b1ef25ff
+DIST autoconf-2.63.tar.bz2 1195259 SHA256 264d7c1c0e268bc77fbe0f308e085545535edfe73f33e27c80219cc0c9c71246 SHA512 bd47527a1f6558953d21ac1d7a36d490d057a78cd612f82b6f31aa73f9c42f4a2d736a7d4e49d91df268bffa5a418d222c53e741bffc2c8843fe3b7ed37e09d6 WHIRLPOOL 595eefe099ad7f8ad17290b5f042186567915164d2f0ae3cabed0ee13f54ca714e82ff440f84a4458fb42ce4b4f9fb5eecbcf79e61405a5a833b04d55f5a8713
+DIST autoconf-2.64.tar.xz 1113892 SHA256 32d977213320b8ae76c71175305301197f2b0e04e72d70694bc3d3e2ae6c7248 SHA512 ee4b504447c14a59b849d0915e55a90522cfb071d1583af2bd3575e5a05d7bd290e55e0e9d0760c8f36043f926199fc2d962b559d27d2f95c70d0e147b4ad0a3 WHIRLPOOL 791d3f9ed37833b13880a1bb7f75b2f73ae73fd6c9a9f4bb0ddbc33e29a617fa7f82fe43556c33effc417ac584f711f325245c3379af97f22600d54546ef9a79
+DIST autoconf-2.65.tar.xz 1132092 SHA256 3e07179feb2ba724ae557872d0cb5878655c58b49b6eaea068210c0bf22661f5 SHA512 23473cde36ad02a9474286a144c751b222d7aecf8b271b49e6dae25706c96d5533c8d840d522ecf11df8c437961a2ac00aa050c929d5e06b381acf1bc34f2c4c WHIRLPOOL 8a4bbaf7c9593d27ab9245dedc236d4addf38633f0fcc95ccfc35a1d503c447674940790407e49dab3b9fdb679eea8c9b04b132ca87c5a3c820a7f6834bfec98
+DIST autoconf-2.67.tar.xz 1158000 SHA256 80c6bda1dd6ab04510d42f594c69a06f98dc5e589683b03c11abd89270502ac1 SHA512 b9021a137da42512f6c4ce907b560ad54e27491083ce686039c32dca2602f3cb354d9e7d7493d6d531a0aa5766ff25e0d86aea6e8f61a79d93acf3ff6b56de80 WHIRLPOOL 810c763bbd1cde8eb4b7aeba32d6f9d0189b09b630a92f496eb499b466e19db6a4b9f8e291cf51e690103d8f885b37029f744aac3ca197f6e5a25645f30f1a74
+DIST autoconf-2.68.tar.xz 1167804 SHA256 c994778716e6223cf65e898e06c15ed498fe81424838adf67007282b661055ba SHA512 fd41b2d75a89bcc67f2cb0a3b335ca0d5e8f6d3f4ae844fea21c80c5ff7234efe8c299491e89d1d1124b0d4ec3072a21cf707e14b5ef186f1ab2d09f0fefa979 WHIRLPOOL 607d9bb0469633a1938d92e600073c4fa860415d339e0a8b0239265980eb9a967d79bf4c06ce96bb5f61e4504b52a6b4f90d39fd082f15ad969c1a9d24b0cedf
+DIST autoconf-2.69.tar.xz 1214744 SHA256 64ebcec9f8ac5b2487125a86a7760d2591ac9e1d3dbd59489633f9de62a57684 SHA512 995d3e5a8eb1eb37e2b7fae53c6ec7a9b4df997286b7d643344818f94636756b1bf5ff5ea9155e755cb9461149a853dfbf2886fc6bd7132e5afa9c168e306e9b WHIRLPOOL 9d806d685b9951acb15ab837b08437a6632f0907f105057e84ba3e0d99539371c32153333f459f04fb537cbb96a80e4418937e937381aec677b319ad667f7918
diff --git a/sys-devel/autoconf/autoconf-2.13.ebuild b/sys-devel/autoconf/autoconf-2.13.ebuild
new file mode 100644
index 000000000000..04f2b7836b40
--- /dev/null
+++ b/sys-devel/autoconf/autoconf-2.13.ebuild
@@ -0,0 +1,57 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils
+
+DESCRIPTION="Used to create autoconfiguration files"
+HOMEPAGE="http://www.gnu.org/software/autoconf/autoconf.html"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="${PV:0:3}"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE="userland_BSD"
+
+DEPEND=">=sys-apps/texinfo-4.3
+ =sys-devel/m4-1.4*
+ dev-lang/perl"
+RDEPEND="${DEPEND}
+ >=sys-devel/autoconf-wrapper-13"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-gentoo.patch
+ "${FILESDIR}"/${P}-destdir.patch
+ "${FILESDIR}"/${P}-test-fixes.patch #146592
+)
+
+if [[ -z ${__EBLITS__} && -n ${FILESDIR} ]] ; then
+ source "${FILESDIR}"/eblits/main.eblit || die
+fi
+src_prepare() { eblit-run src_prepare ; }
+src_install() { eblit-run src_install ; }
+
+src_configure() {
+ touch configure # make sure configure is newer than configure.in
+
+ # need to include --exec-prefix and --bindir or our
+ # DESTDIR patch will trigger sandbox hate :(
+ #
+ # need to force locale to C to avoid bugs in the old
+ # configure script breaking the install paths #351982
+ #
+ # force to `awk` so that we don't encode another awk that
+ # happens to currently be installed, but might later be
+ # uninstalled (like mawk). same for m4.
+ local prepend=""
+ use userland_BSD && prepend="g"
+ ac_cv_path_M4="${prepend}m4" \
+ ac_cv_prog_AWK="${prepend}awk" \
+ LC_ALL=C \
+ econf \
+ --exec-prefix=/usr \
+ --bindir=/usr/bin \
+ --program-suffix="-${PV}"
+}
diff --git a/sys-devel/autoconf/autoconf-2.59-r7.ebuild b/sys-devel/autoconf/autoconf-2.59-r7.ebuild
new file mode 100644
index 000000000000..f33c89ccdb1b
--- /dev/null
+++ b/sys-devel/autoconf/autoconf-2.59-r7.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 eutils
+
+DESCRIPTION="Used to create autoconfiguration files"
+HOMEPAGE="http://www.gnu.org/software/autoconf/autoconf.html"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="${PV}"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+DEPEND="=sys-devel/m4-1.4*
+ dev-lang/perl"
+RDEPEND="${DEPEND}
+ !~sys-devel/${P}:0
+ >=sys-devel/autoconf-wrapper-13"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-more-quotes.patch
+)
+
+if [[ -z ${__EBLITS__} && -n ${FILESDIR} ]] ; then
+ source "${FILESDIR}"/eblits/main.eblit || die
+fi
+src_prepare() { eblit-run src_prepare ; }
+src_configure() { eblit-run src_configure ; }
+src_install() { eblit-run src_install ; }
diff --git a/sys-devel/autoconf/autoconf-2.61-r2.ebuild b/sys-devel/autoconf/autoconf-2.61-r2.ebuild
new file mode 100644
index 000000000000..877599078b3e
--- /dev/null
+++ b/sys-devel/autoconf/autoconf-2.61-r2.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils
+
+DESCRIPTION="Used to create autoconfiguration files"
+HOMEPAGE="http://www.gnu.org/software/autoconf/autoconf.html"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="${PV}"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+DEPEND=">=sys-devel/m4-1.4.6
+ dev-lang/perl"
+RDEPEND="${DEPEND}
+ !~sys-devel/${P}:0
+ >=sys-devel/autoconf-wrapper-13"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-GETMNTENT.patch
+)
+
+if [[ -z ${__EBLITS__} && -n ${FILESDIR} ]] ; then
+ source "${FILESDIR}"/eblits/main.eblit || die
+fi
+src_prepare() { eblit-run src_prepare ; }
+src_configure() { eblit-run src_configure ; }
+src_install() { eblit-run src_install ; }
+
+src_compile() {
+ # From configure output:
+ # Parallel builds via `make -jN' do not work.
+ emake -j1
+}
diff --git a/sys-devel/autoconf/autoconf-2.62-r1.ebuild b/sys-devel/autoconf/autoconf-2.62-r1.ebuild
new file mode 100644
index 000000000000..fa8eab463197
--- /dev/null
+++ b/sys-devel/autoconf/autoconf-2.62-r1.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="Used to create autoconfiguration files"
+HOMEPAGE="http://www.gnu.org/software/autoconf/autoconf.html"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="${PV}"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+DEPEND=">=sys-devel/m4-1.4.6
+ dev-lang/perl"
+RDEPEND="${DEPEND}
+ !~sys-devel/${P}:0
+ >=sys-devel/autoconf-wrapper-13"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-revert-AC_C_BIGENDIAN.patch #228825
+ "${FILESDIR}"/${P}-at-keywords.patch
+ "${FILESDIR}"/${P}-fix-multiline-string.patch #217976
+)
+
+if [[ -z ${__EBLITS__} && -n ${FILESDIR} ]] ; then
+ source "${FILESDIR}"/eblits/main.eblit || die
+fi
+src_prepare() { eblit-run src_prepare ; }
+src_configure() { eblit-run src_configure ; }
+src_install() { eblit-run src_install ; }
diff --git a/sys-devel/autoconf/autoconf-2.63-r1.ebuild b/sys-devel/autoconf/autoconf-2.63-r1.ebuild
new file mode 100644
index 000000000000..0817c9780a8a
--- /dev/null
+++ b/sys-devel/autoconf/autoconf-2.63-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 eutils
+
+DESCRIPTION="Used to create autoconfiguration files"
+HOMEPAGE="http://www.gnu.org/software/autoconf/autoconf.html"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="${PV}"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+DEPEND=">=sys-devel/m4-1.4.6
+ dev-lang/perl"
+RDEPEND="${DEPEND}
+ !~sys-devel/${P}:0
+ >=sys-devel/autoconf-wrapper-13"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-sh.patch #264303
+)
+
+if [[ -z ${__EBLITS__} && -n ${FILESDIR} ]] ; then
+ source "${FILESDIR}"/eblits/main.eblit || die
+fi
+src_prepare() { eblit-run src_prepare ; }
+src_configure() { eblit-run src_configure ; }
+src_install() { eblit-run src_install ; }
diff --git a/sys-devel/autoconf/autoconf-2.64.ebuild b/sys-devel/autoconf/autoconf-2.64.ebuild
new file mode 100644
index 000000000000..c8f69b24dc09
--- /dev/null
+++ b/sys-devel/autoconf/autoconf-2.64.ebuild
@@ -0,0 +1,27 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+DESCRIPTION="Used to create autoconfiguration files"
+HOMEPAGE="http://www.gnu.org/software/autoconf/autoconf.html"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="${PV}"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+DEPEND=">=sys-devel/m4-1.4.6
+ dev-lang/perl"
+RDEPEND="${DEPEND}
+ !~sys-devel/${P}:0
+ >=sys-devel/autoconf-wrapper-13"
+
+if [[ -z ${__EBLITS__} && -n ${FILESDIR} ]] ; then
+ source "${FILESDIR}"/eblits/main.eblit || die
+fi
+src_prepare() { eblit-run src_prepare ; }
+src_configure() { eblit-run src_configure ; }
+src_install() { eblit-run src_install ; }
diff --git a/sys-devel/autoconf/autoconf-2.65-r1.ebuild b/sys-devel/autoconf/autoconf-2.65-r1.ebuild
new file mode 100644
index 000000000000..3c88254dc488
--- /dev/null
+++ b/sys-devel/autoconf/autoconf-2.65-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 eutils
+
+DESCRIPTION="Used to create autoconfiguration files"
+HOMEPAGE="http://www.gnu.org/software/autoconf/autoconf.html"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
+
+LICENSE="GPL-3"
+SLOT="${PV}"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+DEPEND=">=sys-devel/m4-1.4.6
+ dev-lang/perl"
+RDEPEND="${DEPEND}
+ !~sys-devel/${P}:0
+ >=sys-devel/autoconf-wrapper-13"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-AC_TYPE_INT_T.patch #324649
+)
+
+if [[ -z ${__EBLITS__} && -n ${FILESDIR} ]] ; then
+ source "${FILESDIR}"/eblits/main.eblit || die
+fi
+src_prepare() { eblit-run src_prepare ; }
+src_configure() { eblit-run src_configure ; }
+src_install() { eblit-run src_install ; }
diff --git a/sys-devel/autoconf/autoconf-2.67.ebuild b/sys-devel/autoconf/autoconf-2.67.ebuild
new file mode 100644
index 000000000000..dd83b9b2ee2a
--- /dev/null
+++ b/sys-devel/autoconf/autoconf-2.67.ebuild
@@ -0,0 +1,27 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+DESCRIPTION="Used to create autoconfiguration files"
+HOMEPAGE="http://www.gnu.org/software/autoconf/autoconf.html"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
+
+LICENSE="GPL-3"
+SLOT="${PV}"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+DEPEND=">=sys-devel/m4-1.4.6
+ dev-lang/perl"
+RDEPEND="${DEPEND}
+ !~sys-devel/${P}:0
+ >=sys-devel/autoconf-wrapper-13"
+
+if [[ -z ${__EBLITS__} && -n ${FILESDIR} ]] ; then
+ source "${FILESDIR}"/eblits/main.eblit || die
+fi
+src_prepare() { eblit-run src_prepare ; }
+src_configure() { eblit-run src_configure ; }
+src_install() { eblit-run src_install ; }
diff --git a/sys-devel/autoconf/autoconf-2.68.ebuild b/sys-devel/autoconf/autoconf-2.68.ebuild
new file mode 100644
index 000000000000..dd83b9b2ee2a
--- /dev/null
+++ b/sys-devel/autoconf/autoconf-2.68.ebuild
@@ -0,0 +1,27 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+DESCRIPTION="Used to create autoconfiguration files"
+HOMEPAGE="http://www.gnu.org/software/autoconf/autoconf.html"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
+
+LICENSE="GPL-3"
+SLOT="${PV}"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+DEPEND=">=sys-devel/m4-1.4.6
+ dev-lang/perl"
+RDEPEND="${DEPEND}
+ !~sys-devel/${P}:0
+ >=sys-devel/autoconf-wrapper-13"
+
+if [[ -z ${__EBLITS__} && -n ${FILESDIR} ]] ; then
+ source "${FILESDIR}"/eblits/main.eblit || die
+fi
+src_prepare() { eblit-run src_prepare ; }
+src_configure() { eblit-run src_configure ; }
+src_install() { eblit-run src_install ; }
diff --git a/sys-devel/autoconf/autoconf-2.69-r1.ebuild b/sys-devel/autoconf/autoconf-2.69-r1.ebuild
new file mode 100644
index 000000000000..67a5b90388ff
--- /dev/null
+++ b/sys-devel/autoconf/autoconf-2.69-r1.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+# For usex.
+inherit eutils
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://git.savannah.gnu.org/${PN}.git
+ http://git.savannah.gnu.org/r/${PN}.git"
+ inherit git-2
+else
+ SRC_URI="mirror://gnu/${PN}/${P}.tar.xz
+ ftp://alpha.gnu.org/pub/gnu/${PN}/${P}.tar.xz"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~arm-linux ~x86-linux"
+fi
+
+DESCRIPTION="Used to create autoconfiguration files"
+HOMEPAGE="http://www.gnu.org/software/autoconf/autoconf.html"
+
+LICENSE="GPL-3"
+SLOT=$(usex multislot "${PV}" "2.5")
+IUSE="emacs multislot"
+
+DEPEND=">=sys-devel/m4-1.4.16
+ >=dev-lang/perl-5.6"
+RDEPEND="${DEPEND}
+ multislot? ( !~sys-devel/${P}:0 )
+ >=sys-devel/autoconf-wrapper-13"
+PDEPEND="emacs? ( app-emacs/autoconf-mode )"
+
+if [[ -z ${__EBLITS__} && -n ${FILESDIR} ]] ; then
+ source "${FILESDIR}"/eblits/main.eblit || die
+fi
+src_prepare() { eblit-run src_prepare ; }
+src_configure() { eblit-run src_configure ; }
+src_install() { eblit-run src_install ; }
diff --git a/sys-devel/autoconf/autoconf-2.69.ebuild b/sys-devel/autoconf/autoconf-2.69.ebuild
new file mode 100644
index 000000000000..1a1cfb88e16f
--- /dev/null
+++ b/sys-devel/autoconf/autoconf-2.69.ebuild
@@ -0,0 +1,58 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://git.savannah.gnu.org/${PN}.git
+ http://git.savannah.gnu.org/r/${PN}.git"
+ inherit git-2
+else
+ SRC_URI="mirror://gnu/${PN}/${P}.tar.xz
+ ftp://alpha.gnu.org/pub/gnu/${PN}/${P}.tar.xz"
+ KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~arm-linux ~x86-linux"
+fi
+
+DESCRIPTION="Used to create autoconfiguration files"
+HOMEPAGE="http://www.gnu.org/software/autoconf/autoconf.html"
+
+LICENSE="GPL-3"
+SLOT=$(usex multislot "${PV}" "2.5")
+IUSE="emacs multislot"
+
+DEPEND=">=sys-devel/m4-1.4.16
+ >=dev-lang/perl-5.6"
+RDEPEND="${DEPEND}
+ multislot? ( !~sys-devel/${P}:0 )
+ >=sys-devel/autoconf-wrapper-13"
+PDEPEND="emacs? ( app-emacs/autoconf-mode )"
+
+src_prepare() {
+ if [[ ${PV} == "9999" ]] ; then
+ autoreconf -f -i || die
+ fi
+ find -name Makefile.in -exec sed -i '/^pkgdatadir/s:$:-@VERSION@:' {} +
+}
+
+src_configure() {
+ # Disable Emacs in the build system since it is in a separate package.
+ export EMACS=no
+ econf --program-suffix="-${PV}" || die
+ # econf updates config.{sub,guess} which forces the manpages
+ # to be regenerated which we dont want to do #146621
+ touch man/*.1
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die
+ dodoc AUTHORS BUGS NEWS README TODO THANKS \
+ ChangeLog ChangeLog.0 ChangeLog.1 ChangeLog.2
+
+ local f
+ for f in "${ED}"/usr/share/info/*.info* ; do
+ mv "${f}" "${f/.info/-${SLOT}.info}" || die
+ done
+}
diff --git a/sys-devel/autoconf/autoconf-9999.ebuild b/sys-devel/autoconf/autoconf-9999.ebuild
new file mode 100644
index 000000000000..95feafc5c5c5
--- /dev/null
+++ b/sys-devel/autoconf/autoconf-9999.ebuild
@@ -0,0 +1,48 @@
+# 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.savannah.gnu.org/${PN}.git
+ http://git.savannah.gnu.org/r/${PN}.git"
+ # We need all the tags in order to figure out the right version.
+ # The git-r3 eclass doesn't support that, so have to stick to 2.
+ inherit git-2
+else
+ SRC_URI="mirror://gnu/${PN}/${P}.tar.xz
+ ftp://alpha.gnu.org/pub/gnu/${PN}/${P}.tar.xz"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~arm-linux ~x86-linux"
+fi
+
+DESCRIPTION="Used to create autoconfiguration files"
+HOMEPAGE="http://www.gnu.org/software/autoconf/autoconf.html"
+
+LICENSE="GPL-3"
+SLOT="${PV}"
+IUSE="emacs"
+
+DEPEND=">=sys-devel/m4-1.4.16
+ >=dev-lang/perl-5.6"
+RDEPEND="${DEPEND}
+ !~sys-devel/${P}:0
+ >=sys-devel/autoconf-wrapper-13"
+[[ ${PV} == "9999" ]] && DEPEND+=" >=sys-apps/texinfo-4.3"
+PDEPEND="emacs? ( app-emacs/autoconf-mode )"
+
+if [[ -z ${__EBLITS__} && -n ${FILESDIR} ]] ; then
+ source "${FILESDIR}"/eblits/main.eblit || die
+fi
+src_prepare() { eblit-run src_prepare ; }
+src_configure() { eblit-run src_configure ; }
+src_install() { eblit-run src_install ; }
+
+eblit-src_prepare-pre() {
+ # Avoid the "dirty" suffix in the git version by generating it
+ # before we run later stages which might modify source files.
+ local ver=$(./build-aux/git-version-gen .tarball-version)
+ echo "${ver}" > .tarball-version
+
+ autoreconf -f -i || die
+}
diff --git a/sys-devel/autoconf/files/autoconf-2.13-destdir.patch b/sys-devel/autoconf/files/autoconf-2.13-destdir.patch
new file mode 100644
index 000000000000..858b8bcc1f71
--- /dev/null
+++ b/sys-devel/autoconf/files/autoconf-2.13-destdir.patch
@@ -0,0 +1,26 @@
+--- Makefile.in.orig 2004-10-20 16:44:54.949117496 -0400
++++ Makefile.in 2004-10-20 16:45:39.999268832 -0400
+@@ -41,18 +41,18 @@
+
+ transform=@program_transform_name@
+
+-prefix = @prefix@
++prefix = $(DESTDIR)@prefix@
+-exec_prefix = @exec_prefix@
++exec_prefix = $(DESTDIR)@exec_prefix@
+
+ # Directory in which to install scripts.
+-bindir = @bindir@
++bindir = $(DESTDIR)@bindir@
+
+ # Directory in which to install library files.
+-datadir = @datadir@
++datadir = $(DESTDIR)@datadir@
+ acdatadir = $(datadir)/autoconf
+
+ # Directory in which to install documentation info files.
+-infodir = @infodir@
++infodir = $(DESTDIR)@infodir@
+
+ #### End of system configuration section. ####
+
diff --git a/sys-devel/autoconf/files/autoconf-2.13-gentoo.patch b/sys-devel/autoconf/files/autoconf-2.13-gentoo.patch
new file mode 100644
index 000000000000..8e40d0cae049
--- /dev/null
+++ b/sys-devel/autoconf/files/autoconf-2.13-gentoo.patch
@@ -0,0 +1,36 @@
+--- configure.orig Wed Feb 28 20:51:53 2001
++++ configure Wed Feb 28 20:52:03 2001
+@@ -654,12 +654,10 @@
+ echo "$ac_t""no" 1>&6
+ fi
+
+-if test "$PERL" != no; then
+- SCRIPTS=autoscan
+-else
+- echo "configure: warning: autoscan will not be built since perl is not found" 1>&2
++if test "$PERL" = no; then
++ PERL=/usr/bin/perl
+ fi
+-
++SCRIPTS=autoscan
+ ac_aux_dir=
+ for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+ if test -f $ac_dir/install-sh; then
+--- configure.orig Wed Feb 28 20:53:24 2001
++++ configure.in Wed Feb 28 20:53:28 2001
+@@ -14,12 +14,10 @@
+ AC_PATH_PROG(PERL, perl, no)
+ AC_SUBST(PERL)dnl
+ AC_SUBST(SCRIPTS)dnl
+-if test "$PERL" != no; then
+- SCRIPTS=autoscan
+-else
+- AC_MSG_WARN(autoscan will not be built since perl is not found)
++if test "$PERL" = no; then
++ PERL=/usr/bin/perl
+ fi
+-
++SCRIPTS=autoscan
+ AC_PROG_INSTALL
+
+ # Work with the GNU or Cygnus source tree layout.
diff --git a/sys-devel/autoconf/files/autoconf-2.13-test-fixes.patch b/sys-devel/autoconf/files/autoconf-2.13-test-fixes.patch
new file mode 100644
index 000000000000..b8a7e3b8ce99
--- /dev/null
+++ b/sys-devel/autoconf/files/autoconf-2.13-test-fixes.patch
@@ -0,0 +1,18 @@
+newer gcc versions don't provide g77, so if it doesn't exist,
+don't bother trying to test it (and failing)
+
+http://bugs.gentoo.org/146592
+
+--- autoconf-2.13/testsuite/autoconf.s/syntax.exp
++++ autoconf-2.13/testsuite/autoconf.s/syntax.exp
+@@ -5,6 +5,10 @@
+ set macros [exec sed -n $script $srcdir/../acspecific.m4]
+
+ foreach mac $macros {
++ if { [string match "*F77*" "$mac"] && [catch {exec which g77} ignore_output] } then {
++ send_user "XFAIL: $mac\n"
++ continue
++ }
+ send_user "$mac\n"
+ autoconf_test $mac $mac
+ }
diff --git a/sys-devel/autoconf/files/autoconf-2.59-more-quotes.patch b/sys-devel/autoconf/files/autoconf-2.59-more-quotes.patch
new file mode 100644
index 000000000000..eb2c8395fa90
--- /dev/null
+++ b/sys-devel/autoconf/files/autoconf-2.59-more-quotes.patch
@@ -0,0 +1,34 @@
+http://bugs.gentoo.org/96882
+
+date: 2005/06/23 20:09:27; author: eggert; state: Exp; lines: +29 -34
+Fix some more shell quoting problems. Prompted by a bug report
+from Justace Clutter.
+* lib/autoconf/general.m4 (_AC_INIT_SRCDIR): Allow special
+characters in $ac_unique_file.
+
+--- lib/autoconf/general.m4
++++ lib/autoconf/general.m4
+@@ -476,20 +476,20 @@
+ # Try the directory containing this script, then its parent.
+ ac_confdir=`AS_DIRNAME(["$[0]"])`
+ srcdir=$ac_confdir
+- if test ! -r $srcdir/$ac_unique_file; then
++ if test ! -r "$srcdir/$ac_unique_file"; then
+ srcdir=..
+ fi
+ else
+ ac_srcdir_defaulted=no
+ fi
+-if test ! -r $srcdir/$ac_unique_file; then
++if test ! -r "$srcdir/$ac_unique_file"; then
+ if test "$ac_srcdir_defaulted" = yes; then
+ AC_MSG_ERROR([cannot find sources ($ac_unique_file) in $ac_confdir or ..])
+ else
+ AC_MSG_ERROR([cannot find sources ($ac_unique_file) in $srcdir])
+ fi
+ fi
+-(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
++(cd $srcdir && test -r "./$ac_unique_file") 2>/dev/null ||
+ AC_MSG_ERROR([sources are in $srcdir, but `cd $srcdir' does not work])
+ dnl Double slashes in pathnames in object file debugging info
+ dnl mess up M-x gdb in Emacs.
diff --git a/sys-devel/autoconf/files/autoconf-2.60-tests.patch b/sys-devel/autoconf/files/autoconf-2.60-tests.patch
new file mode 100644
index 000000000000..09e4536baf08
--- /dev/null
+++ b/sys-devel/autoconf/files/autoconf-2.60-tests.patch
@@ -0,0 +1,22 @@
+2006-07-17 Paul Eggert <eggert@cs.ucla.edu>
+
+ * tests/tools.at (autom4te cache): Update wording of diagnostic
+ to match M4 1.4.5.
+
+Index: tests/tools.at
+===================================================================
+RCS file: /cvsroot/autoconf/autoconf/tests/tools.at,v
+retrieving revision 1.89
+retrieving revision 1.90
+diff -u -p -r1.89 -r1.90
+--- tests/tools.at 20 Jun 2006 05:37:43 -0000 1.89
++++ tests/tools.at 17 Jul 2006 17:30:44 -0000 1.90
+@@ -101,7 +101,7 @@ AT_CHECK_M4SUGAR
+ mkdir sub
+ mv foo sub
+ AT_CHECK_M4SUGAR([], [1], [],
+-[m4: script.4s: 1: Cannot open foo: No such file or directory
++[m4: script.4s: 1: cannot open `foo': No such file or directory
+ autom4te: m4 failed with exit status: 1
+ ])
+
diff --git a/sys-devel/autoconf/files/autoconf-2.61-GETMNTENT.patch b/sys-devel/autoconf/files/autoconf-2.61-GETMNTENT.patch
new file mode 100644
index 000000000000..7cdc425e0396
--- /dev/null
+++ b/sys-devel/autoconf/files/autoconf-2.61-GETMNTENT.patch
@@ -0,0 +1,23 @@
+From: Paul Eggert <eggert@cs.ucla.edu>
+Date: Sat, 16 Dec 2006 05:38:41 +0000 (+0000)
+Subject: * lib/autoconf/functions.m4 (AC_FUNC_GETMNTENT):
+X-Git-Tag: v2.62~386
+X-Git-Url: http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff_plain;h=a152d401584cd901f7295647af0382948369de79
+
+* lib/autoconf/functions.m4 (AC_FUNC_GETMNTENT):
+Define HAVE_GETMNTENT to 1, not to the empty string.
+Problem originally reported by Jochen Friedrich in
+<http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=403243>.
+---
+
+--- a/lib/autoconf/functions.m4
++++ b/lib/autoconf/functions.m4
+@@ -798,7 +798,7 @@ AC_DEFUN([AC_FUNC_GETMNTENT],
+ # -lseq on Dynix/PTX, -lgen on Unixware.
+ AC_SEARCH_LIBS(getmntent, [sun seq gen],
+ [ac_cv_func_getmntent=yes
+- AC_DEFINE([HAVE_GETMNTENT], [],
++ AC_DEFINE([HAVE_GETMNTENT], 1,
+ [Define to 1 if you have the `getmntent' function.])],
+ [ac_cv_func_getmntent=no])
+ ])
diff --git a/sys-devel/autoconf/files/autoconf-2.62-at-keywords.patch b/sys-devel/autoconf/files/autoconf-2.62-at-keywords.patch
new file mode 100644
index 000000000000..04cd1807b8a0
--- /dev/null
+++ b/sys-devel/autoconf/files/autoconf-2.62-at-keywords.patch
@@ -0,0 +1,81 @@
+commit 3ac7ceb0c2dfd023e0e9e944da6825b6bd676568
+Author: Eric Blake <ebb9@byu.net>
+Date: Thu Jun 5 15:18:11 2008 -0600
+
+ Fix regression in AT_KEYWORDS([Macro]), from 2007-10-18.
+
+ * lib/autotest/general.m4 (AT_KEYWORDS): Expand argument prior to
+ converting it to lower case.
+ * tests/autotest.at (Keywords and ranges): Test this.
+ * NEWS: Document the fix.
+ * THANKS: Update.
+ Reported by Karsten Hopp.
+
+ Signed-off-by: Eric Blake <ebb9@byu.net>
+
+diff --git a/NEWS b/NEWS
+index 183d4f1..8b866ad 100644
+--- a/NEWS
++++ b/NEWS
+@@ -9,6 +9,10 @@ GNU Autoconf NEWS - User visible changes.
+ ** Two new quadrigraphs have been introduced: @{:@ for (, and @:}@ for ),
+ allowing the output of unbalanced parantheses in more contexts.
+
++** AT_KEYWORDS once again performs expansion on its argument, such that
++ AT_KEYWORDS([m4_if([$1], [], [default])]) no longer complains about
++ the possibly unexpanded m4_if [regression introduced in 2.62].
++
+
+ * Major changes in Autoconf 2.62 (2008-04-05) [stable]
+ Released by Eric Blake, based on git versions 2.61a.*.
+diff --git a/THANKS b/THANKS
+index 5ec8921..224cdea 100644
+--- a/THANKS
++++ b/THANKS
+@@ -177,6 +177,7 @@ Justace Clutter ?
+ Jörn Rennecke amylaar@cygnus.co.uk
+ Karl Berry karl@cs.umb.edu
+ Karl Heuer kwzh@gnu.org
++Karsten Hopp karsten@redhat.com
+ Kate Hedstrom ?
+ Kathryn Hargreaves kathryn@deas.harvard.edu
+ Kaveh R. Ghazi ghazi@caip.rutgers.edu
+diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4
+index 88d10a3..993dd9f 100644
+--- a/lib/autotest/general.m4
++++ b/lib/autotest/general.m4
+@@ -1476,9 +1476,10 @@ m4_case([$1],
+ # AT_KEYWORDS(KEYWORDS)
+ # ---------------------
+ # Declare a list of keywords associated to the current test group.
+-# The list is stored in lower case, since the -k option is case-insensitive.
++# Since the -k option is case-insensitive, the list is stored in lower case
++# to avoid duplicates that differ only by case.
+ _AT_DEFINE_SETUP([AT_KEYWORDS],
+-[m4_append_uniq_w([AT_keywords], m4_tolower([[$1]]))])
++[m4_append_uniq_w([AT_keywords], m4_tolower(m4_dquote(m4_expand([$1]))))])
+
+
+ # AT_CAPTURE_FILE(FILE)
+diff --git a/tests/autotest.at b/tests/autotest.at
+index dc3cfd5..c4c0eda 100644
+--- a/tests/autotest.at
++++ b/tests/autotest.at
+@@ -690,7 +690,7 @@ AT_CHECK(:)
+ AT_CLEANUP
+ AT_SETUP(both) # 04
+ AT_KEYWORDS([key1 key2])
+-AT_KEYWORDS([key1])
++AT_KEYWORDS([m4@&t@_echo([Key1])])
+ AT_CHECK(:)
+ AT_CLEANUP
+ AT_SETUP(test5) # 05
+@@ -713,7 +713,7 @@ AT_CHECK(:)
+ AT_CLEANUP
+ ]])
+ dnl check that AT_KEYWORDS does not duplicate words
+-AT_CHECK([grep 'key1.*key1' k], [1])
++AT_CHECK([grep -i 'key1.*key1' k], [1])
+ dnl check that -k requires an argument
+ AT_CHECK([$CONFIG_SHELL ./k -k], [1], [], [ignore])
+
diff --git a/sys-devel/autoconf/files/autoconf-2.62-fix-multiline-string.patch b/sys-devel/autoconf/files/autoconf-2.62-fix-multiline-string.patch
new file mode 100644
index 000000000000..cfd7b4228794
--- /dev/null
+++ b/sys-devel/autoconf/files/autoconf-2.62-fix-multiline-string.patch
@@ -0,0 +1,30 @@
+sniped from mandrivia:
+http://svn.mandriva.com/cgi-bin/viewvc.cgi/packages/cooker/autoconf/current/SOURCES/autoconf-2.62-fix-multiline-string.patch
+
+this may not be the correct fix, but it seems to get the job done until we can
+grab whatever upstream merges
+http://lists.gnu.org/archive/html/bug-autoconf/2008-04/msg00031.html
+
+--- autoconf-2.62/lib/autoconf/status.m4
++++ autoconf-2.62/lib/autoconf/status.m4
+@@ -1360,16 +1360,16 @@ _ACEOF
+ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ # Files that config.status was made for.
+ m4_ifdef([_AC_SEEN_CONFIG(FILES)],
+-[config_files="$ac_config_files"
++[config_files="`echo $ac_config_files`"
+ ])dnl
+ m4_ifdef([_AC_SEEN_CONFIG(HEADERS)],
+-[config_headers="$ac_config_headers"
++[config_headers="`echo $ac_config_headers`"
+ ])dnl
+ m4_ifdef([_AC_SEEN_CONFIG(LINKS)],
+-[config_links="$ac_config_links"
++[config_links="`echo $ac_config_links`"
+ ])dnl
+ m4_ifdef([_AC_SEEN_CONFIG(COMMANDS)],
+-[config_commands="$ac_config_commands"
++[config_commands="`echo $ac_config_commands`"
+ ])dnl
+
+ _ACEOF
diff --git a/sys-devel/autoconf/files/autoconf-2.62-revert-AC_C_BIGENDIAN.patch b/sys-devel/autoconf/files/autoconf-2.62-revert-AC_C_BIGENDIAN.patch
new file mode 100644
index 000000000000..76db013cac53
--- /dev/null
+++ b/sys-devel/autoconf/files/autoconf-2.62-revert-AC_C_BIGENDIAN.patch
@@ -0,0 +1,214 @@
+revert AC_C_BIGENDIAN to the version found in 2.61 since the version in 2.62 is
+known to be broken and the changes that it brings are not critical
+
+http://bugs.gentoo.org/228825
+
+--- autoconf-2.62/lib/autoconf/c.m4
++++ autoconf-2.61/lib/autoconf/c.m4
+@@ -1393,140 +1351,74 @@
+ ])# AC_C_CHAR_UNSIGNED
+
+
+-# AC_C_BIGENDIAN ([ACTION-IF-TRUE], [ACTION-IF-FALSE], [ACTION-IF-UNKNOWN],
+-# [ACTION-IF-UNIVERSAL])
++# AC_C_BIGENDIAN ([ACTION-IF-TRUE], [ACTION-IF-FALSE], [ACTION-IF-UNKNOWN])
+ # -------------------------------------------------------------------------
+ AC_DEFUN([AC_C_BIGENDIAN],
+-[AH_VERBATIM([WORDS_BIGENDIAN],
+-[/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+- significant byte first (like Motorola and SPARC, unlike Intel and VAX). */
+-#if defined __BIG_ENDIAN__
+-# define WORDS_BIGENDIAN 1
+-#elif ! defined __LITTLE_ENDIAN__
+-# undef WORDS_BIGENDIAN
+-#endif])dnl
+- AC_CACHE_CHECK([whether byte ordering is bigendian], [ac_cv_c_bigendian],
+- [ac_cv_c_bigendian=unknown
+- m4_ifval(m4_ifdef([AH_HEADER], 1)[$4],
+- [# See if __BIG_ENDIAN__ or __LITTLE_ENDIAN__ is defined.
+- AC_COMPILE_IFELSE(
+- [AC_LANG_SOURCE(
+- [[#if ! (defined __BIG_ENDIAN__ || defined __LITTLE_ENDIAN__)
+- neither is defined;
+- #endif
+- typedef int dummy;
+- ]])],
+- [ac_cv_c_bigendian=universal])],
+- [AC_DIAGNOSE([obsolete], [AC_C_BIGENDIAN suggests AC_CONFIG_HEADERS])])
+- if test $ac_cv_c_bigendian = unknown; then
+- # See if sys/param.h defines the BYTE_ORDER macro.
+- AC_COMPILE_IFELSE(
+- [AC_LANG_PROGRAM(
+- [[#include <sys/types.h>
+- #include <sys/param.h>
+- ]],
+- [[#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \
+- && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \
+- && LITTLE_ENDIAN)
+- bogus endian macros
+- #endif
+- ]])],
+- [# It does; now see whether it defined to BIG_ENDIAN or not.
+- AC_COMPILE_IFELSE(
+- [AC_LANG_PROGRAM(
+- [[#include <sys/types.h>
+- #include <sys/param.h>
+- ]],
+- [[#if BYTE_ORDER != BIG_ENDIAN
+- not big endian
+- #endif
+- ]])],
+- [ac_cv_c_bigendian=yes],
+- [ac_cv_c_bigendian=no])])
+- fi
+- if test $ac_cv_c_bigendian = unknown; then
+- # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris).
+- AC_COMPILE_IFELSE(
+- [AC_LANG_PROGRAM(
+- [[#include <limits.h>
+- ]],
+- [[#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN)
+- bogus endian macros
+- #endif
+- ]])],
+- [# It does; now see whether it defined to _BIG_ENDIAN or not.
+- AC_COMPILE_IFELSE(
+- [AC_LANG_PROGRAM(
+- [[#include <limits.h>
+- ]],
+- [[#ifndef _BIG_ENDIAN
+- not big endian
+- #endif
+- ]])],
+- [ac_cv_c_bigendian=yes],
+- [ac_cv_c_bigendian=no])])
+- fi
+- if test $ac_cv_c_bigendian = unknown; then
+- # Compile a test program.
+- AC_RUN_IFELSE(
+- [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
+- [[
+- /* Are we little or big endian? From Harbison&Steele. */
+- union
+- {
+- long int l;
+- char c[sizeof (long int)];
+- } u;
+- u.l = 1;
+- return u.c[sizeof (long int) - 1] == 1;
+- ]])],
+- [ac_cv_c_bigendian=no],
+- [ac_cv_c_bigendian=yes],
+- [# Try to guess by grepping values from an object file.
+- AC_COMPILE_IFELSE(
+- [AC_LANG_PROGRAM(
+- [[short int ascii_mm[] =
+- { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
+- short int ascii_ii[] =
+- { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
+- int use_ascii (int i) {
+- return ascii_mm[i] + ascii_ii[i];
+- }
+- short int ebcdic_ii[] =
+- { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
+- short int ebcdic_mm[] =
+- { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
+- int use_ebcdic (int i) {
+- return ebcdic_mm[i] + ebcdic_ii[i];
+- }
+- extern int foo;
+- ]],
+- [[return use_ascii (foo) == use_ebcdic (foo);]])],
+- [if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then
+- ac_cv_c_bigendian=yes
+- fi
+- if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
+- if test "$ac_cv_c_bigendian" = unknown; then
+- ac_cv_c_bigendian=no
+- else
+- # finding both strings is unlikely to happen, but who knows?
+- ac_cv_c_bigendian=unknown
+- fi
+- fi])])
+- fi])
+- case $ac_cv_c_bigendian in #(
+- yes)
+- m4_default([$1],
+- [AC_DEFINE([WORDS_BIGENDIAN], 1)]);; #(
+- no)
+- $2 ;; #(
+- universal)
+- $4 ;; #(
+- *)
+- m4_default([$3],
+- [AC_MSG_ERROR([unknown endianness
+- presetting ac_cv_c_bigendian=no (or yes) will help])]) ;;
+- esac
++[AC_CACHE_CHECK(whether byte ordering is bigendian, ac_cv_c_bigendian,
++[# See if sys/param.h defines the BYTE_ORDER macro.
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
++#include <sys/param.h>
++],
++[#if ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \
++ && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN)
++ bogus endian macros
++#endif
++])],
++[# It does; now see whether it defined to BIG_ENDIAN or not.
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
++#include <sys/param.h>
++], [#if BYTE_ORDER != BIG_ENDIAN
++ not big endian
++#endif
++])], [ac_cv_c_bigendian=yes], [ac_cv_c_bigendian=no])],
++[# It does not; compile a test program.
++AC_RUN_IFELSE(
++[AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [[
++ /* Are we little or big endian? From Harbison&Steele. */
++ union
++ {
++ long int l;
++ char c[sizeof (long int)];
++ } u;
++ u.l = 1;
++ return u.c[sizeof (long int) - 1] == 1;
++]])],
++ [ac_cv_c_bigendian=no],
++ [ac_cv_c_bigendian=yes],
++[# try to guess the endianness by grepping values into an object file
++ ac_cv_c_bigendian=unknown
++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
++[[short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
++short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
++void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }
++short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
++short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
++void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }]],
++[[ _ascii (); _ebcdic (); ]])],
++[if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then
++ ac_cv_c_bigendian=yes
++fi
++if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
++ if test "$ac_cv_c_bigendian" = unknown; then
++ ac_cv_c_bigendian=no
++ else
++ # finding both strings is unlikely to happen, but who knows?
++ ac_cv_c_bigendian=unknown
++ fi
++fi])])])])
++case $ac_cv_c_bigendian in
++ yes)
++ m4_default([$1],
++ [AC_DEFINE([WORDS_BIGENDIAN], 1,
++ [Define to 1 if your processor stores words with the most significant
++ byte first (like Motorola and SPARC, unlike Intel and VAX).])]) ;;
++ no)
++ $2 ;;
++ *)
++ m4_default([$3],
++ [AC_MSG_ERROR([unknown endianness
++presetting ac_cv_c_bigendian=no (or yes) will help])]) ;;
++esac
+ ])# AC_C_BIGENDIAN
+
+
diff --git a/sys-devel/autoconf/files/autoconf-2.63-sh.patch b/sys-devel/autoconf/files/autoconf-2.63-sh.patch
new file mode 100644
index 000000000000..8008b32b6022
--- /dev/null
+++ b/sys-devel/autoconf/files/autoconf-2.63-sh.patch
@@ -0,0 +1,32 @@
+http://bugs.gentoo.org/264303
+http://lists.gnu.org/archive/html/bug-autoconf/2008-10/msg00040.html
+
+From: Chikama Masaki <masaki.chikama@gmail.com>
+Date: Fri, 24 Oct 2008 01:41:06 +0000 (-0600)
+Subject: For gfortran on sh, ignore -little.
+X-Git-Tag: v2.63b~206
+X-Git-Url: http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff_plain;h=3f38aad
+
+For gfortran on sh, ignore -little.
+
+* lib/autoconf/fortran.m4 (_AC_FC_LIBRARY_LDFLAGS): Add -little to
+list of ignored arguments.
+* THANKS: Update.
+
+Signed-off-by: Eric Blake <ebb9@byu.net>
+---
+
+diff --git a/lib/autoconf/fortran.m4 b/lib/autoconf/fortran.m4
+index 20d9e0c..ad0c2ee 100644
+--- a/lib/autoconf/fortran.m4
++++ b/lib/autoconf/fortran.m4
+@@ -686,7 +686,8 @@ while test $[@%:@] != 1; do
+ [_AC_LINKER_OPTION([$ac_arg], ac_cv_[]_AC_LANG_ABBREV[]_libs)])
+ ;;
+ # Ignore these flags.
+- -lang* | -lcrt*.o | -lc | -lgcc* | -lSystem | -libmil | -LANG:=* | -LIST:* | -LNO:*)
++ -lang* | -lcrt*.o | -lc | -lgcc* | -lSystem | -libmil | -little \
++ |-LANG:=* | -LIST:* | -LNO:*)
+ ;;
+ -lkernel32)
+ test x"$CYGWIN" != xyes && ac_cv_[]_AC_LANG_ABBREV[]_libs="$ac_cv_[]_AC_LANG_ABBREV[]_libs $ac_arg"
diff --git a/sys-devel/autoconf/files/autoconf-2.65-AC_TYPE_INT_T.patch b/sys-devel/autoconf/files/autoconf-2.65-AC_TYPE_INT_T.patch
new file mode 100644
index 000000000000..cc81672e427e
--- /dev/null
+++ b/sys-devel/autoconf/files/autoconf-2.65-AC_TYPE_INT_T.patch
@@ -0,0 +1,49 @@
+https://bugs.gentoo.org/324649
+http://lists.gnu.org/archive/html/bug-autoconf/2009-12/msg00016.html
+
+From 83ee5bc460a1083ab29fd9d3a3044cbaefad6ac6 Mon Sep 17 00:00:00 2001
+From: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+Date: Wed, 9 Dec 2009 07:20:16 +0100
+Subject: [PATCH] Fix 2.64 AC_TYPE_INT*_T macro body text regression.
+
+* lib/autoconf/types.m4 (_AC_TYPE_INT_BODY): Move helper enum
+definition to prologue section, to avoid syntax error.
+* NEWS, THANKS: Update.
+Report by Pierre Ynard.
+
+Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+---
+ ChangeLog | 8 ++++++++
+ NEWS | 3 +++
+ THANKS | 1 +
+ lib/autoconf/types.m4 | 12 ++++++------
+ 4 files changed, 18 insertions(+), 6 deletions(-)
+
+diff --git a/lib/autoconf/types.m4 b/lib/autoconf/types.m4
+index 7a73fc2..3829c4c 100644
+--- a/lib/autoconf/types.m4
++++ b/lib/autoconf/types.m4
+@@ -635,14 +635,14 @@ m4_define([_AC_TYPE_INT_BODY],
+ 'long long int' 'short int' 'signed char'; do
+ AC_COMPILE_IFELSE(
+ [AC_LANG_BOOL_COMPILE_TRY(
+- [AC_INCLUDES_DEFAULT],
+- [enum { N = $[]2 / 2 - 1 };
+- 0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1)])],
++ [AC_INCLUDES_DEFAULT
++ enum { N = $[]2 / 2 - 1 };],
++ [0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1)])],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_BOOL_COMPILE_TRY(
+- [AC_INCLUDES_DEFAULT],
+- [enum { N = $[]2 / 2 - 1 };
+- ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1)
++ [AC_INCLUDES_DEFAULT
++ enum { N = $[]2 / 2 - 1 };],
++ [($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1)
+ < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2)])],
+ [],
+ [AS_CASE([$ac_type], [int$[]2_t],
+--
+1.7.1
+
diff --git a/sys-devel/autoconf/files/eblits/main.eblit b/sys-devel/autoconf/files/eblits/main.eblit
new file mode 100644
index 000000000000..c5d80c33d5ea
--- /dev/null
+++ b/sys-devel/autoconf/files/eblits/main.eblit
@@ -0,0 +1,48 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+__EBLITS__="locked-and-loaded"
+
+# 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
+}
+
+# Copy these into the ebuilds.
+#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 ; }
diff --git a/sys-devel/autoconf/files/eblits/src_configure.eblit b/sys-devel/autoconf/files/eblits/src_configure.eblit
new file mode 100644
index 000000000000..308c3a683e9d
--- /dev/null
+++ b/sys-devel/autoconf/files/eblits/src_configure.eblit
@@ -0,0 +1,12 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+eblit-autoconf-src_configure() {
+ # Disable Emacs in the build system since it is in a separate package.
+ export EMACS=no
+ econf --program-suffix="-${PV}" || die
+ # econf updates config.{sub,guess} which forces the manpages
+ # to be regenerated which we dont want to do #146621
+ touch man/*.1
+}
diff --git a/sys-devel/autoconf/files/eblits/src_install.eblit b/sys-devel/autoconf/files/eblits/src_install.eblit
new file mode 100644
index 000000000000..e9c98634fa24
--- /dev/null
+++ b/sys-devel/autoconf/files/eblits/src_install.eblit
@@ -0,0 +1,39 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# slot the info pages. do this w/out munging the source so we don't have
+# to depend on texinfo to regen things. #464146 (among others)
+slot_info_pages() {
+ [[ ${SLOT} == "0" ]] && return
+
+ pushd "${D}"/usr/share/info >/dev/null
+ rm -f dir
+
+ # Rewrite all the references to other pages.
+ # before: * aclocal-invocation: (automake)aclocal Invocation. Generating aclocal.m4.
+ # after: * aclocal-invocation v1.13: (automake-1.13)aclocal Invocation. Generating aclocal.m4.
+ local p pages=( *.info ) args=()
+ for p in "${pages[@]/%.info}" ; do
+ args+=(
+ -e "/START-INFO-DIR-ENTRY/,/END-INFO-DIR-ENTRY/s|: (${p})| v${SLOT}&|"
+ -e "s:(${p}):(${p}-${SLOT}):g"
+ )
+ done
+ sed -i "${args[@]}" * || die
+
+ # Rewrite all the file references, and rename them in the process.
+ local f d
+ for f in * ; do
+ d=${f/.info/-${SLOT}.info}
+ mv "${f}" "${d}" || die
+ sed -i -e "s:${f}:${d}:g" * || die
+ done
+
+ popd >/dev/null
+}
+
+eblit-autoconf-src_install() {
+ default
+ slot_info_pages
+}
diff --git a/sys-devel/autoconf/files/eblits/src_prepare.eblit b/sys-devel/autoconf/files/eblits/src_prepare.eblit
new file mode 100644
index 000000000000..0a5aff53d59e
--- /dev/null
+++ b/sys-devel/autoconf/files/eblits/src_prepare.eblit
@@ -0,0 +1,9 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+eblit-autoconf-src_prepare() {
+ find -name Makefile.in -exec sed -i '/^pkgdatadir/s:$:-@VERSION@:' {} +
+
+ [[ ${#PATCHES[@]} -gt 0 ]] && epatch "${PATCHES[@]}"
+}
diff --git a/sys-devel/autoconf/metadata.xml b/sys-devel/autoconf/metadata.xml
new file mode 100644
index 000000000000..f9d3cbfa27c9
--- /dev/null
+++ b/sys-devel/autoconf/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='multislot'>Allow for multiple versions to be installed at once</flag>
+</use>
+</pkgmetadata>
diff --git a/sys-devel/autogen/Manifest b/sys-devel/autogen/Manifest
new file mode 100644
index 000000000000..8632824e936a
--- /dev/null
+++ b/sys-devel/autogen/Manifest
@@ -0,0 +1,6 @@
+DIST autogen-5.15.tar.xz 915252 SHA256 cc2a9e24b8b5e4eb74a88519189fd0978bf88fe22af6fe311781e6891098b726 SHA512 cc4cf076324f367c7ada395b21c2d87208cab96dc19bc734a3c462a661090d466aae40a2266e9a472e8f5924b8c32d579af8988bfee53a773aa77c52c846cb1c WHIRLPOOL e008c0012a7475e366425ff0a049b4b25d6fa1701141385497f8c15491b26654844fce36d8774d6378e6386c1fe9cb921400089a4679f88ab3e63429e2cf2eb2
+DIST autogen-5.17.3.tar.xz 999240 SHA256 7bbea9c522ea4c7c80153c8b998eb603295bdce0a622cac36c9c84c87cf3497c SHA512 5a4eec4dbf34b7e398648c65c4c90ae96a5b3ed45a455249cdc60035bf0ce76ac0539160135686fd612d48fbd1951315f8a0acc62cf7f6ec7506cb433d799a13 WHIRLPOOL b8ddf7dbcfd1e8b751e4ada2706ba00fa0fce29f20c4180a3d8d2665c118c2c85ae0bc20486a2394eb7b280777db8fbef397fc9e5a5c198e00eda73624ead1ee
+DIST autogen-5.17.4.tar.xz 1003356 SHA256 35cd4b5f0b48ce61278865412ed7e3c5b9b8cb082ae969ca1e6888e8bf8128a4 SHA512 9a7b31f6b17d8d27a617aae7575baf5ce690e7b70d5f6960ac2944d068315e56ed2717e905b30329b058cc8ce5297128ebcabf417dc7564a2d8e9786662f9c6c WHIRLPOOL 9f5e4582cf22f8e3ef0195c6cd86893d0f431a33a58ee0d47ce742cae3a746f0f136d67b78fd709ce7ca8a572156ed0b6a6fa125b933687cdf36d87bccb1f02e
+DIST autogen-5.18.1.tar.xz 1010332 SHA256 c9c2e8d1b32b868d06e6faf4831230c1ca725efa16636092ead232903da75307 SHA512 1f64f587fca795bd6f526a00b64d521802de7b36a70a88977d7d2301d3cebdd7cbca93a4075fb8d2130692c27d64c23ee290e2b8a869a31e81faa4aeab0a468a WHIRLPOOL 36ed84d5cc1ad7c29d345c277faadf682001aab8f13490892a90f2efd4db6f6de48fd18f9c7edd04e3203536dc5571e0d4df9e8824ef5f4248c667e09542a867
+DIST autogen-5.18.2.tar.xz 1012344 SHA256 1fad5687a5f0fb110fe78d13dccde11346b5e072b44cf8d4e6871fdf42e02c6b SHA512 8b9b2bd5118e29983e8ba87f5dd00bcb4f00a9defd1011c77d1071f4447a3ce4e7d3dcd88c9a3c88039fff622cdbd83fd269bd70d19e328a7ab93acae053160b WHIRLPOOL f97596869feb7ada62c326e10cc09a4528466e27878f9ce8bee552075cb043ffa0029f6267e0611b7d58154ebac0f006fe80b6db4d1b7f24d073b5fa4ca11c80
+DIST autogen-5.18.4.tar.xz 1017936 SHA256 7fbaff0c25035aee5b96913de2c83d9a5cc973b8dc08d6b7489ecbcfd72eb84b SHA512 a02363484de5019bd90fb6f2cf52b1b9556d6cf310c62a68830d0b2408ea4870d3c262fe5d1c27e3586ed3af4a7487d7422ad117760ac2a01ef3cfcfc1f2bfb6 WHIRLPOOL 109cb5637558f8e16cbb9afcb629a9bbd3d5ceae6b897a00101fce99b1a39b06ecc497d9b43441e40b58981dd2402027e89ce6ae76da73b73db934c64bca2b63
diff --git a/sys-devel/autogen/autogen-5.15.ebuild b/sys-devel/autogen/autogen-5.15.ebuild
new file mode 100644
index 000000000000..4a414272b04a
--- /dev/null
+++ b/sys-devel/autogen/autogen-5.15.ebuild
@@ -0,0 +1,26 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils
+
+DESCRIPTION="Program and text file generation"
+HOMEPAGE="http://www.gnu.org/software/autogen/"
+SRC_URI="mirror://gnu/${PN}/rel${PV}/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~arm-linux ~x86-linux ~x64-macos ~x86-macos"
+IUSE=""
+
+RDEPEND=">=dev-scheme/guile-1.8
+ dev-libs/libxml2"
+DEPEND="${RDEPEND}"
+
+src_install() {
+ default
+ dodoc NOTES TODO
+ rm "${ED}"/usr/share/autogen/libopts-*.tar.gz || die
+}
diff --git a/sys-devel/autogen/autogen-5.17.3.ebuild b/sys-devel/autogen/autogen-5.17.3.ebuild
new file mode 100644
index 000000000000..8ce71dd46b59
--- /dev/null
+++ b/sys-devel/autogen/autogen-5.17.3.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils autotools
+
+DESCRIPTION="Program and text file generation"
+HOMEPAGE="http://www.gnu.org/software/autogen/"
+SRC_URI="mirror://gnu/${PN}/rel${PV}/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~arm-linux ~x86-linux ~x64-macos ~x86-macos"
+IUSE="libopts"
+
+RDEPEND=">=dev-scheme/guile-1.8
+ dev-libs/libxml2"
+DEPEND="${RDEPEND}"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-libintl.patch #466462
+ eautoreconf
+}
+
+src_configure() {
+ # suppress possibly incorrect -R flag
+ export ag_cv_test_ldflags=
+ default
+}
+
+src_install() {
+ default
+ if ! use libopts ; then
+ rm "${ED}"/usr/share/autogen/libopts-*.tar.gz || die
+ fi
+}
diff --git a/sys-devel/autogen/autogen-5.17.4.ebuild b/sys-devel/autogen/autogen-5.17.4.ebuild
new file mode 100644
index 000000000000..ca1f5e4013fc
--- /dev/null
+++ b/sys-devel/autogen/autogen-5.17.4.ebuild
@@ -0,0 +1,36 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils
+
+DESCRIPTION="Program and text file generation"
+HOMEPAGE="http://www.gnu.org/software/autogen/"
+SRC_URI="mirror://gnu/${PN}/rel${PV}/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~arm-linux ~x86-linux ~x64-macos ~x86-macos"
+IUSE="libopts static-libs"
+
+RDEPEND=">=dev-scheme/guile-1.8
+ dev-libs/libxml2"
+DEPEND="${RDEPEND}"
+
+src_configure() {
+ # suppress possibly incorrect -R flag
+ export ag_cv_test_ldflags=
+
+ econf $(use_enable static-libs static)
+}
+
+src_install() {
+ default
+ prune_libtool_files
+
+ if ! use libopts ; then
+ rm "${ED}"/usr/share/autogen/libopts-*.tar.gz || die
+ fi
+}
diff --git a/sys-devel/autogen/autogen-5.18.1.ebuild b/sys-devel/autogen/autogen-5.18.1.ebuild
new file mode 100644
index 000000000000..e36302bbe127
--- /dev/null
+++ b/sys-devel/autogen/autogen-5.18.1.ebuild
@@ -0,0 +1,36 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils
+
+DESCRIPTION="Program and text file generation"
+HOMEPAGE="http://www.gnu.org/software/autogen/"
+SRC_URI="mirror://gnu/${PN}/rel${PV}/${P}.tar.xz"
+
+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 ~x64-macos ~x86-macos"
+IUSE="libopts static-libs"
+
+RDEPEND=">=dev-scheme/guile-1.8
+ dev-libs/libxml2"
+DEPEND="${RDEPEND}"
+
+src_configure() {
+ # suppress possibly incorrect -R flag
+ export ag_cv_test_ldflags=
+
+ econf $(use_enable static-libs static)
+}
+
+src_install() {
+ default
+ prune_libtool_files
+
+ if ! use libopts ; then
+ rm "${ED}"/usr/share/autogen/libopts-*.tar.gz || die
+ fi
+}
diff --git a/sys-devel/autogen/autogen-5.18.2.ebuild b/sys-devel/autogen/autogen-5.18.2.ebuild
new file mode 100644
index 000000000000..f2baf5819888
--- /dev/null
+++ b/sys-devel/autogen/autogen-5.18.2.ebuild
@@ -0,0 +1,36 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils
+
+DESCRIPTION="Program and text file generation"
+HOMEPAGE="http://www.gnu.org/software/autogen/"
+SRC_URI="mirror://gnu/${PN}/rel${PV}/${P}.tar.xz"
+
+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 ~x64-macos ~x86-macos"
+IUSE="libopts static-libs"
+
+RDEPEND=">=dev-scheme/guile-1.8
+ dev-libs/libxml2"
+DEPEND="${RDEPEND}"
+
+src_configure() {
+ # suppress possibly incorrect -R flag
+ export ag_cv_test_ldflags=
+
+ econf $(use_enable static-libs static)
+}
+
+src_install() {
+ default
+ prune_libtool_files
+
+ if ! use libopts ; then
+ rm "${ED}"/usr/share/autogen/libopts-*.tar.gz || die
+ fi
+}
diff --git a/sys-devel/autogen/autogen-5.18.4.ebuild b/sys-devel/autogen/autogen-5.18.4.ebuild
new file mode 100644
index 000000000000..df1eb8c7e23a
--- /dev/null
+++ b/sys-devel/autogen/autogen-5.18.4.ebuild
@@ -0,0 +1,36 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils
+
+DESCRIPTION="Program and text file generation"
+HOMEPAGE="http://www.gnu.org/software/autogen/"
+SRC_URI="mirror://gnu/${PN}/rel${PV}/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~arm-linux ~x86-linux ~x64-macos ~x86-macos"
+IUSE="libopts static-libs"
+
+RDEPEND=">=dev-scheme/guile-1.8
+ dev-libs/libxml2"
+DEPEND="${RDEPEND}"
+
+src_configure() {
+ # suppress possibly incorrect -R flag
+ export ag_cv_test_ldflags=
+
+ econf $(use_enable static-libs static)
+}
+
+src_install() {
+ default
+ prune_libtool_files
+
+ if ! use libopts ; then
+ rm "${ED}"/usr/share/autogen/libopts-*.tar.gz || die
+ fi
+}
diff --git a/sys-devel/autogen/files/autogen-5.17.3-libintl.patch b/sys-devel/autogen/files/autogen-5.17.3-libintl.patch
new file mode 100644
index 000000000000..e251a0f8c0bf
--- /dev/null
+++ b/sys-devel/autogen/files/autogen-5.17.3-libintl.patch
@@ -0,0 +1,12 @@
+https://bugs.gentoo.org/466462
+
+--- a/config/libopts.m4
++++ b/config/libopts.m4
+@@ -106,6 +106,7 @@ AC_DEFUN([INVOKE_LIBOPTS_MACROS_FIRST],[
+ # AC_CHECK_LIB for SVR4 libgen, and use it if it defines pathfind.
+ # ----------------------------------------------------------------------
+ AC_CHECK_LIB(gen, pathfind)
++ AC_SEARCH_LIBS([gettext], [intl])
+ AC_FUNC_VPRINTF
+ AC_FUNC_FORK
+ AC_CHECK_FUNCS([mmap canonicalize_file_name snprintf strdup strchr \
diff --git a/sys-devel/autogen/metadata.xml b/sys-devel/autogen/metadata.xml
new file mode 100644
index 000000000000..8402ea8050fb
--- /dev/null
+++ b/sys-devel/autogen/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>
+<use>
+ <flag name='libopts'>install the libopts tarball (a few packages want this for developing)</flag>
+</use>
+</pkgmetadata>
diff --git a/sys-devel/automake-wrapper/automake-wrapper-10.ebuild b/sys-devel/automake-wrapper/automake-wrapper-10.ebuild
new file mode 100644
index 000000000000..e8c37d3b8a3b
--- /dev/null
+++ b/sys-devel/automake-wrapper/automake-wrapper-10.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+DESCRIPTION="wrapper for automake to manage multiple automake versions"
+HOMEPAGE="http://www.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~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=""
+
+S=${WORKDIR}
+
+src_unpack() {
+ cp "${FILESDIR}"/am-wrapper-${PV}.sh "${S}"/ || die
+}
+
+src_prepare() {
+ # usr/bin/aclocal: bad substitution -> /bin/sh != POSIX shell
+ if use prefix ; then
+ sed -i -e '1c\#!'"${EPREFIX}"'/bin/sh' \
+ "${S}"/am-wrapper-${PV}.sh || die
+ fi
+}
+
+src_install() {
+ newbin "${S}"/am-wrapper-${PV}.sh automake
+ dosym automake /usr/bin/aclocal
+
+ keepdir /usr/share/aclocal
+}
diff --git a/sys-devel/automake-wrapper/automake-wrapper-9.ebuild b/sys-devel/automake-wrapper/automake-wrapper-9.ebuild
new file mode 100644
index 000000000000..bd107fa332fb
--- /dev/null
+++ b/sys-devel/automake-wrapper/automake-wrapper-9.ebuild
@@ -0,0 +1,29 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+DESCRIPTION="wrapper for automake to manage multiple automake versions"
+HOMEPAGE="http://www.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~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=""
+
+S=${WORKDIR}
+
+src_unpack() {
+ cp "${FILESDIR}"/am-wrapper-${PV}.sh "${S}"/
+ # usr/bin/aclocal: bad substitution -> /bin/sh != POSIX shell
+ if use prefix ; then
+ sed -i -e '1c\#!'"${EPREFIX}"'/bin/sh' "${S}"/am-wrapper-${PV}.sh || die
+ fi
+}
+
+src_install() {
+ newbin "${S}"/am-wrapper-${PV}.sh automake || die
+ dosym automake /usr/bin/aclocal
+
+ keepdir /usr/share/aclocal
+}
diff --git a/sys-devel/automake-wrapper/files/am-wrapper-10.sh b/sys-devel/automake-wrapper/files/am-wrapper-10.sh
new file mode 100644
index 000000000000..4302a7a4d250
--- /dev/null
+++ b/sys-devel/automake-wrapper/files/am-wrapper-10.sh
@@ -0,0 +1,187 @@
+#!/bin/sh
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# Executes the correct automake version.
+#
+# If WANT_AUTOMAKE is set (can be a whitespace delimited list of versions):
+# - attempt to find an installed version using those
+# - if magic keyword 'latest' is found, pick the latest version that exists
+# - if nothing found, warn, and proceed as if WANT_AUTOMAKE was not set (below)
+# If WANT_AUTOMAKE is not set:
+# - Try to detect the version of automake used to generate things (look at
+# Makefile.in and aclocal.m4 and any other useful file)
+# - If detected version is not found, warn and proceed as if blank slate
+# - Try to locate the latest version of automake that exists and run it
+
+(set -o posix) 2>/dev/null && set -o posix
+
+_stderr() { printf 'am-wrapper: %s: %b\n' "${argv0}" "$*" 1>&2; }
+warn() { _stderr "warning: $*"; }
+err() { _stderr "error: $*"; exit 1; }
+unset IFS
+which() {
+ local p
+ IFS=: # we don't use IFS anywhere, so don't bother saving/restoring
+ for p in ${PATH} ; do
+ p="${p}/$1"
+ [ -e "${p}" ] && echo "${p}" && return 0
+ done
+ unset IFS
+ return 1
+}
+
+#
+# Sanitize argv[0] since it isn't always a full path #385201
+#
+argv0=${0##*/}
+case $0 in
+ ${argv0})
+ # find it in PATH
+ if ! full_argv0=$(which "${argv0}") ; then
+ err "could not locate ${argv0}; file a bug"
+ fi
+ ;;
+ *)
+ # re-use full/relative paths
+ full_argv0=$0
+ ;;
+esac
+
+if ! seq 0 0 2>/dev/null 1>&2 ; then #338518
+ seq() {
+ local f l i
+ case $# in
+ 1) f=1 i=1 l=$1;;
+ 2) f=$1 i=1 l=$2;;
+ 3) f=$1 i=$2 l=$3;;
+ esac
+ while :; do
+ [ $l -lt $f -a $i -gt 0 ] && break
+ [ $f -lt $l -a $i -lt 0 ] && break
+ echo $f
+ : $(( f += i ))
+ done
+ return 0
+ }
+fi
+
+#
+# Set up bindings between actual version and WANT_AUTOMAKE;
+# Start with last known versions to speed up lookup process.
+#
+LAST_KNOWN_AUTOMAKE_VER="15"
+vers=$(printf '1.%s ' `seq ${LAST_KNOWN_AUTOMAKE_VER} -1 4`)
+
+#
+# Helper to scan for a usable program based on version.
+#
+binary=
+all_vers=
+find_binary() {
+ local v
+ all_vers="${all_vers} $*" # For error messages.
+ for v ; do
+ if [ -x "${full_argv0}-${v}" ] ; then
+ binary="${full_argv0}-${v}"
+ binary_ver=${v}
+ return 0
+ fi
+ done
+ return 1
+}
+
+#
+# Try and find a usable automake version. First check the WANT_AUTOMAKE
+# setting (whitespace delimited list), then fallback to the latest.
+#
+find_latest() {
+ if ! find_binary ${vers} ; then
+ # Brute force it.
+ find_binary $(printf '1.%s ' `seq 99 -1 ${LAST_KNOWN_AUTOMAKE_VER}`)
+ fi
+}
+for wx in ${WANT_AUTOMAKE:-latest} ; do
+ if [ "${wx}" = "latest" ] ; then
+ find_latest && break
+ else
+ find_binary ${wx} && break
+ fi
+done
+
+if [ -z "${binary}" ] && [ -n "${WANT_AUTOMAKE}" ] ; then
+ warn "could not locate installed version for WANT_AUTOMAKE='${WANT_AUTOMAKE}'; ignoring"
+ unset WANT_AUTOMAKE
+ find_latest
+fi
+
+if [ -z "${binary}" ] ; then
+ err "Unable to locate any usuable version of automake.\n" \
+ "\tI tried these versions:${all_vers}\n" \
+ "\tWith a base name of '${full_argv0}'."
+fi
+
+#
+# autodetect helpers
+#
+do_awk() {
+ local file=$1 ; shift
+ local v=$(awk -v regex="$*" '{
+ if (ret = match($0, regex)) {
+ s = substr($0, ret, RLENGTH)
+ ret = match(s, "[0-9]\\.[0-9]+")
+ print substr(s, ret, RLENGTH)
+ exit
+ }
+ }' "${file}")
+ case " ${auto_vers} " in
+ *" ${v} "*) ;;
+ *) auto_vers="${auto_vers:+${auto_vers} }${v}" ;;
+ esac
+}
+
+#
+# autodetect routine
+#
+if [ -z "${WANT_AUTOMAKE}" ] ; then
+ auto_vers=
+ if [ -r "Makefile.in" ] ; then
+ do_awk Makefile.in '^# Makefile.in generated (automatically )?by automake [0-9]\\.[0-9]+'
+ fi
+ if [ -r "aclocal.m4" ] ; then
+ do_awk aclocal.m4 'generated automatically by aclocal [0-9]\\.[0-9]+'
+ do_awk aclocal.m4 '[[:space:]]*\\[?AM_AUTOMAKE_VERSION\\(\\[?[0-9]\\.[0-9]+[^)]*\\]?\\)'
+ fi
+ # We don't need to set $binary here as it has already been setup for us
+ # earlier to the latest available version.
+ if [ -n "${auto_vers}" ] ; then
+ if ! find_binary ${auto_vers} ; then
+ warn "auto-detected versions not found (${auto_vers}); falling back to latest available"
+ fi
+ fi
+fi
+
+if [ -n "${WANT_AMWRAPPER_DEBUG}" ] ; then
+ if [ -n "${WANT_AUTOMAKE}" ] ; then
+ warn "DEBUG: WANT_AUTOMAKE is set to ${WANT_AUTOMAKE}"
+ fi
+ warn "DEBUG: will execute <${binary}>"
+fi
+
+#
+# for further consistency
+#
+export WANT_AUTOMAKE="${binary_ver}"
+
+#
+# Now try to run the binary
+#
+if [ ! -x "${binary}" ] ; then
+ # this shouldn't happen
+ err "${binary} is missing or not executable.\n" \
+ "\tPlease try installing the correct version of automake."
+fi
+
+exec "${binary}" "$@"
+# The shell will error out if `exec` failed.
diff --git a/sys-devel/automake-wrapper/files/am-wrapper-9.sh b/sys-devel/automake-wrapper/files/am-wrapper-9.sh
new file mode 100755
index 000000000000..6342625ba65d
--- /dev/null
+++ b/sys-devel/automake-wrapper/files/am-wrapper-9.sh
@@ -0,0 +1,187 @@
+#!/bin/sh
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# Executes the correct automake version.
+#
+# If WANT_AUTOMAKE is set (can be a whitespace delimited list of versions):
+# - attempt to find an installed version using those
+# - if magic keyword 'latest' is found, pick the latest version that exists
+# - if nothing found, warn, and proceed as if WANT_AUTOMAKE was not set (below)
+# If WANT_AUTOMAKE is not set:
+# - Try to detect the version of automake used to generate things (look at
+# Makefile.in and aclocal.m4 and any other useful file)
+# - If detected version is not found, warn and proceed as if blank slate
+# - Try to locate the latest version of automake that exists and run it
+
+(set -o posix) 2>/dev/null && set -o posix
+
+_stderr() { printf 'am-wrapper: %s: %b\n' "${argv0}" "$*" 1>&2; }
+warn() { _stderr "warning: $*"; }
+err() { _stderr "error: $*"; exit 1; }
+unset IFS
+which() {
+ local p
+ IFS=: # we don't use IFS anywhere, so don't bother saving/restoring
+ for p in ${PATH} ; do
+ p="${p}/$1"
+ [ -e "${p}" ] && echo "${p}" && return 0
+ done
+ unset IFS
+ return 1
+}
+
+#
+# Sanitize argv[0] since it isn't always a full path #385201
+#
+argv0=${0##*/}
+case $0 in
+ ${argv0})
+ # find it in PATH
+ if ! full_argv0=$(which "${argv0}") ; then
+ err "could not locate ${argv0}; file a bug"
+ fi
+ ;;
+ *)
+ # re-use full/relative paths
+ full_argv0=$0
+ ;;
+esac
+
+if ! seq 0 0 2>/dev/null 1>&2 ; then #338518
+ seq() {
+ local f l i
+ case $# in
+ 1) f=1 i=1 l=$1;;
+ 2) f=$1 i=1 l=$2;;
+ 3) f=$1 i=$2 l=$3;;
+ esac
+ while :; do
+ [ $l -lt $f -a $i -gt 0 ] && break
+ [ $f -lt $l -a $i -lt 0 ] && break
+ echo $f
+ : $(( f += i ))
+ done
+ return 0
+ }
+fi
+
+#
+# Set up bindings between actual version and WANT_AUTOMAKE;
+# Start with last known versions to speed up lookup process.
+#
+LAST_KNOWN_AUTOMAKE_VER="14"
+vers=$(printf '1.%s ' `seq ${LAST_KNOWN_AUTOMAKE_VER} -1 4`)
+
+#
+# Helper to scan for a usable program based on version.
+#
+binary=
+all_vers=
+find_binary() {
+ local v
+ all_vers="${all_vers} $*" # For error messages.
+ for v ; do
+ if [ -x "${full_argv0}-${v}" ] ; then
+ binary="${full_argv0}-${v}"
+ binary_ver=${v}
+ return 0
+ fi
+ done
+ return 1
+}
+
+#
+# Try and find a usable automake version. First check the WANT_AUTOMAKE
+# setting (whitespace delimited list), then fallback to the latest.
+#
+find_latest() {
+ if ! find_binary ${vers} ; then
+ # Brute force it.
+ find_binary $(printf '1.%s ' `seq 99 -1 ${LAST_KNOWN_AUTOMAKE_VER}`)
+ fi
+}
+for wx in ${WANT_AUTOMAKE:-latest} ; do
+ if [ "${wx}" = "latest" ] ; then
+ find_latest && break
+ else
+ find_binary ${wx} && break
+ fi
+done
+
+if [ -z "${binary}" ] && [ -n "${WANT_AUTOMAKE}" ] ; then
+ warn "could not locate installed version for WANT_AUTOMAKE='${WANT_AUTOMAKE}'; ignoring"
+ unset WANT_AUTOMAKE
+ find_latest
+fi
+
+if [ -z "${binary}" ] ; then
+ err "Unable to locate any usuable version of automake.\n" \
+ "\tI tried these versions:${all_vers}\n" \
+ "\tWith a base name of '${full_argv0}'."
+fi
+
+#
+# autodetect helpers
+#
+do_awk() {
+ local file=$1 ; shift
+ local v=$(awk -v regex="$*" '{
+ if (ret = match($0, regex)) {
+ s = substr($0, ret, RLENGTH)
+ ret = match(s, "[0-9]\\.[0-9]+")
+ print substr(s, ret, RLENGTH)
+ exit
+ }
+ }' "${file}")
+ case " ${auto_vers} " in
+ *" ${v} "*) ;;
+ *) auto_vers="${auto_vers:+${auto_vers} }${v}" ;;
+ esac
+}
+
+#
+# autodetect routine
+#
+if [ -z "${WANT_AUTOMAKE}" ] ; then
+ auto_vers=
+ if [ -r "Makefile.in" ] ; then
+ do_awk Makefile.in '^# Makefile.in generated (automatically )?by automake [0-9]\\.[0-9]+'
+ fi
+ if [ -r "aclocal.m4" ] ; then
+ do_awk aclocal.m4 'generated automatically by aclocal [0-9]\\.[0-9]+'
+ do_awk aclocal.m4 '[[:space:]]*\\[?AM_AUTOMAKE_VERSION\\(\\[?[0-9]\\.[0-9]+[^)]*\\]?\\)'
+ fi
+ # We don't need to set $binary here as it has already been setup for us
+ # earlier to the latest available version.
+ if [ -n "${auto_vers}" ] ; then
+ if ! find_binary ${auto_vers} ; then
+ warn "auto-detected versions not found (${auto_vers}); falling back to latest available"
+ fi
+ fi
+fi
+
+if [ -n "${WANT_AMWRAPPER_DEBUG}" ] ; then
+ if [ -n "${WANT_AUTOMAKE}" ] ; then
+ warn "DEBUG: WANT_AUTOMAKE is set to ${WANT_AUTOMAKE}"
+ fi
+ warn "DEBUG: will execute <${binary}>"
+fi
+
+#
+# for further consistency
+#
+export WANT_AUTOMAKE="${binary_ver}"
+
+#
+# Now try to run the binary
+#
+if [ ! -x "${binary}" ] ; then
+ # this shouldn't happen
+ err "${binary} is missing or not executable.\n" \
+ "\tPlease try installing the correct version of automake."
+fi
+
+exec "${binary}" "$@"
+# The shell will error out if `exec` failed.
diff --git a/sys-devel/automake-wrapper/metadata.xml b/sys-devel/automake-wrapper/metadata.xml
new file mode 100644
index 000000000000..96a2d586367d
--- /dev/null
+++ b/sys-devel/automake-wrapper/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-devel/automake/Manifest b/sys-devel/automake/Manifest
new file mode 100644
index 000000000000..e680d52f7339
--- /dev/null
+++ b/sys-devel/automake/Manifest
@@ -0,0 +1,12 @@
+DIST automake-1.10.3.tar.bz2 957505 SHA256 e98ab43bb839c31696a4202e5b6ff388b391659ef2387cf9365019fad17e1adc SHA512 4f4172c53f31103a93baa794bb498c8b42c1a06e5e0c909063863cdfee3f768016bdecf46e64417a8e362d4c524907b48c0c1b24f510d26aa66bcfd85d0b2598 WHIRLPOOL 6c1b915b87012fab9c7323843ff69a33cc3bdc71d5bcb4ec743b8e8ab34be46dc8a8b72fd41b805f4ad2c723640c9d2b74cdf39355295022219a1138e28794b2
+DIST automake-1.11.6.tar.xz 1092908 SHA256 1ffbc6cc41f0ea6c864fbe9485b981679dc5e350f6c4bc6c3512f5a4226936b5 SHA512 6e4cdf69f07734954f770fd4a7211a8c9dc69fe25a7746bd3c1e01d3139c94cab2900399e87371548833e99687e0d2b59c5e746ab2fdfbc7d47f2c1d439137ba WHIRLPOOL 79b45d6e1dbdb5df5d17fef318bf38d83896fc91d532c8814fa96144409c53f976ca26c6fcb9baab215b289afcdd177a8ada455af99926d27861950a993438c2
+DIST automake-1.12.6.tar.xz 1400336 SHA256 f834ab2145b1ee24bd85387950044f5cb418dd0af2b84c52e60c2bf29162dbfa SHA512 ddcd664ef8f52a44c0adbe908e3a5a2844d8768932211d75dedf262827ffa411b5c3599f93a212f1c979108122cd14bbea5e672218596dd7c934a25d805aae5c WHIRLPOOL 025be98b482fdaa5453b55c00a061cb92bde0ec794599c9e4fa615706e853e26c912b569e364e853437d2494b86a78e30229e868e889685791aead8f38ebe56b
+DIST automake-1.13.4.tar.xz 1449608 SHA256 89ce4933f59b8f0c20115c39cfe450a595cca74ede27b6881e88ec27720d1d66 SHA512 c9b145c1b822a4d83f2899f4280a76ccae932301b273f4c9718dc7f53161aa03dc1be2c1fb1a61083c54186e1908ae2c8284250aa1d8f6dea484767aca1344d3 WHIRLPOOL b2c8e06135adb956d67ddf15e56d514e697e8881f4e2d95055fbad1d723c54bf9e73cea81eca9bb5c58ed39b4a709a0906913dbcc1d8fd87dfbfa0bdb1abad33
+DIST automake-1.14.1.tar.xz 1488984 SHA256 a9b4f04b8b69cac2e832a38a718943aa976dbdad0097211f8b3448afdacf0669 SHA512 5de971159dfca2ec74c3c9a2f1368331efc437b146d675740c8735fcb0d32a30d0560fd29df64c3279efdf9278152c82a9ff09040b3e64d84743aaf25b26ce69 WHIRLPOOL 916ac13c419ecf2fc8acfe8edcbc33b85cfed2a355f6614bec3ba79dc0dce8c1309be26702ef5dc2453ed84e4315b585524a2d7563b851493750118e4298fedc
+DIST automake-1.15.tar.xz 1496708 SHA256 9908c75aabd49d13661d6dcb1bc382252d22cc77bf733a2d55e87f2aa2db8636 SHA512 200a13f49a3f492ed27bc2eb615aa2f47e775e470a781f6821cd43e0f7b927d091e690b4a23fe5cc8fa79c48daaa9436be4b968784696c3bdbf1634b456cda47 WHIRLPOOL 5c7878f46fd3d0104b5fa6a17f985d5cb57ac4a1c956763953acce411756a94b3e8e3b5a701f28c0a4b8c3cd60d60ab34561ae88706e6ccc54f0d76e1174502c
+DIST automake-1.4-p6.tar.gz 375060 SHA256 503cdc2b0992a4309545d17f462cb15f99bb57b7161dfc4082b2e7188f2bcc0f SHA512 3f3235e68ab6703668deac015926124c7eeeea6925e830c6820cb156f15f8ee3febd0fd0cc2ab4f4b5c405b528e4ce12b2459347f62ed6a1a862bc9969163d9e WHIRLPOOL 2f685ec2f0952d58f313c80c3d7d272734e58c10dfc5dde32331281b55ac4e3b06b820e188239c98ec8703229414f9621f1ce7f241fe17ff4e564b84f21e5b2e
+DIST automake-1.5.tar.gz 526934 SHA256 24b4775e3143fd3e35db5cbaba80845d9359c7bfd751a6cebe3014fbf6115d78 SHA512 b9dbece18935b6c08f7d17c456b0359a17362dc030692629cf5d66db675e46a5f24d60dfd20a50780e4096163454f1922d4281c4bb7af336d61e527b579e3bfc WHIRLPOOL a61e8adf6c728e3dabb3e5faa22501d2bc3c78b0ae17bc68ff826f9c350137ad276e01a18a86f079e0bf57fc8d0628160db2e36a0935d703a7fa7d5857dae1df
+DIST automake-1.6.3.tar.bz2 476275 SHA256 0dbafacaf21e135cab35d357a14bdcd981d2f2d00e1387801be8091a31b7bb81 SHA512 8407ea7d51a238622326d89c22777050c2a49d456e3e33c53985f40e4108094ef149693568d926cd1e9b2ddbdb5693c0d0ec6220e0f7bbae4341b6be9f0d060f WHIRLPOOL 168792f008830e2a25b40e0773acfeebdd483f64e83bb595be5e55da69fecf99e1b8b7b15ff82e8f80a3ae0694ccde331c907c33632389a18483fbbe59670c57
+DIST automake-1.7.9.tar.bz2 577705 SHA256 32c13b6ad38ed5e7bfd1756cbc19cf5efd67b7ade2d06000a4c99b0ce94bd46d SHA512 372f326cdf9c893a016473b959f0d3b92a7a82a13978e3950a887a79c93856a635549ebc63945faafba30b8be6db1c4cd68385f7dfe1cbb36386400acb2aa7a2 WHIRLPOOL 0536bec58cc4fa2ed739ba473443099f1f4a33b5cb61f9fb04c4901baa694643debd3028c8acd764b1609f439b67c02c6b4ed6e1e8b34a5f09d2280d896345a7
+DIST automake-1.8.5.tar.bz2 663182 SHA256 84c93aaa3c3651a9e7474b721b0e6788318592509e7de604bafe4ea8049dc410 SHA512 862f9fe8dd4f0fd51b97d80b767304b982d9c9307bf66933298187bf121f5c827f0b4880eab92f07d16e0c1d41ff5179923c7ae8d8aabd635db8574d4a3021b0 WHIRLPOOL 6328e298a4af1bbe2ca360f380064b6a1b43c9cf9c361c3dc4078297c3bf77c0bfe3690b1d9f2713ad2f28970f033880b40f4b077d5734c0e03bd35aa4bb18e3
+DIST automake-1.9.6.tar.bz2 765505 SHA256 8eccaa98e1863d10e4a5f861d8e2ec349a23e88cb12ad10f6b6f79022ad2bb8d SHA512 6aa8824876003bcac804e88d58f014a2449c7e1d824e46b5e971d3e2d070bc6ac0a3881e8eaae12e2f7f310c6b81dfb83ad4647d58785fc7e6759aa37478784e WHIRLPOOL 76d59f947a2dfad4ca70c888d58b15f86670f0df6156b9f1e9f2ed03ad92468ad880ab47b505b31577b35b376a799b6de0ebab46f17516440772a1d3eb6b7479
diff --git a/sys-devel/automake/automake-1.10.3-r1.ebuild b/sys-devel/automake/automake-1.10.3-r1.ebuild
new file mode 100644
index 000000000000..0e474712678c
--- /dev/null
+++ b/sys-devel/automake/automake-1.10.3-r1.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 eutils
+
+DESCRIPTION="Used to generate Makefile.in from Makefile.am"
+HOMEPAGE="http://www.gnu.org/software/automake/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+# Use Gentoo versioning for slotting.
+SLOT="${PV:0:4}"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+RDEPEND="dev-lang/perl
+ >=sys-devel/automake-wrapper-9
+ >=sys-devel/autoconf-2.69
+ sys-devel/gnuconfig"
+DEPEND="${RDEPEND}
+ sys-apps/help2man"
+
+src_prepare() {
+ export WANT_AUTOCONF=2.5
+ epatch "${FILESDIR}"/${PN}-1.10-perl-5.16.patch #424453
+ chmod a+rx tests/*.test
+}
+
+src_configure() {
+ econf --docdir=/usr/share/doc/${PF}
+}
+
+# slot the info pages. do this w/out munging the source so we don't have
+# to depend on texinfo to regen things. #464146 (among others)
+slot_info_pages() {
+ pushd "${D}"/usr/share/info >/dev/null
+ rm -f dir
+
+ # Rewrite all the references to other pages.
+ # before: * aclocal-invocation: (automake)aclocal Invocation. Generating aclocal.m4.
+ # after: * aclocal-invocation v1.13: (automake-1.13)aclocal Invocation. Generating aclocal.m4.
+ local p pages=( *.info ) args=()
+ for p in "${pages[@]/%.info}" ; do
+ args+=(
+ -e "/START-INFO-DIR-ENTRY/,/END-INFO-DIR-ENTRY/s|: (${p})| v${SLOT}&|"
+ -e "s:(${p}):(${p}-${SLOT}):g"
+ )
+ done
+ sed -i "${args[@]}" * || die
+
+ # Rewrite all the file references, and rename them in the process.
+ local f d
+ for f in * ; do
+ d=${f/.info/-${SLOT}.info}
+ mv "${f}" "${d}" || die
+ sed -i -e "s:${f}:${d}:g" * || die
+ done
+
+ popd >/dev/null
+}
+
+src_install() {
+ default
+ slot_info_pages
+
+ # SLOT the docs and junk
+ local x
+ for x in aclocal automake ; do
+ help2man "perl -Ilib ${x}" > ${x}-${SLOT}.1
+ doman ${x}-${SLOT}.1
+ rm -f "${D}"/usr/bin/${x}
+ done
+
+ # remove all config.guess and config.sub files replacing them
+ # w/a symlink to a specific gnuconfig version
+ for x in guess sub ; do
+ dosym ../gnuconfig/config.${x} /usr/share/${PN}-${SLOT}/config.${x}
+ done
+}
diff --git a/sys-devel/automake/automake-1.11.6-r1.ebuild b/sys-devel/automake/automake-1.11.6-r1.ebuild
new file mode 100644
index 000000000000..81b62dbdcb2c
--- /dev/null
+++ b/sys-devel/automake/automake-1.11.6-r1.ebuild
@@ -0,0 +1,90 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils
+
+DESCRIPTION="Used to generate Makefile.in from Makefile.am"
+HOMEPAGE="http://www.gnu.org/software/automake/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
+
+LICENSE="GPL-2"
+# Use Gentoo versioning for slotting.
+SLOT="${PV:0:4}"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+RDEPEND="dev-lang/perl
+ >=sys-devel/automake-wrapper-9
+ >=sys-devel/autoconf-2.69
+ sys-devel/gnuconfig"
+DEPEND="${RDEPEND}
+ sys-apps/help2man"
+
+src_prepare() {
+ export WANT_AUTOCONF=2.5
+ epatch "${FILESDIR}"/${PN}-1.10-perl-5.16.patch #424453
+ chmod a+rx tests/*.test
+}
+
+src_configure() {
+ econf --docdir=/usr/share/doc/${PF} HELP2MAN=true
+}
+
+src_compile() {
+ emake APIVERSION="${SLOT}" pkgvdatadir="/usr/share/${PN}-${SLOT}"
+
+ local x
+ for x in aclocal automake; do
+ help2man "perl -Ilib ${x}" > doc/${x}-${SLOT}.1
+ done
+}
+
+# slot the info pages. do this w/out munging the source so we don't have
+# to depend on texinfo to regen things. #464146 (among others)
+slot_info_pages() {
+ pushd "${D}"/usr/share/info >/dev/null
+ rm -f dir
+
+ # Rewrite all the references to other pages.
+ # before: * aclocal-invocation: (automake)aclocal Invocation. Generating aclocal.m4.
+ # after: * aclocal-invocation v1.13: (automake-1.13)aclocal Invocation. Generating aclocal.m4.
+ local p pages=( *.info ) args=()
+ for p in "${pages[@]/%.info}" ; do
+ args+=(
+ -e "/START-INFO-DIR-ENTRY/,/END-INFO-DIR-ENTRY/s|: (${p})| v${SLOT}&|"
+ -e "s:(${p}):(${p}-${SLOT}):g"
+ )
+ done
+ sed -i "${args[@]}" * || die
+
+ # Rewrite all the file references, and rename them in the process.
+ local f d
+ for f in * ; do
+ d=${f/.info/-${SLOT}.info}
+ mv "${f}" "${d}" || die
+ sed -i -e "s:${f}:${d}:g" * || die
+ done
+
+ popd >/dev/null
+}
+
+src_install() {
+ emake DESTDIR="${D}" install \
+ APIVERSION="${SLOT}" pkgvdatadir="/usr/share/${PN}-${SLOT}"
+ slot_info_pages
+ dodoc NEWS README THANKS TODO AUTHORS ChangeLog
+
+ rm \
+ "${D}"/usr/bin/{aclocal,automake} \
+ "${D}"/usr/share/man/man1/{aclocal,automake}.1 || die
+
+ # remove all config.guess and config.sub files replacing them
+ # w/a symlink to a specific gnuconfig version
+ local x
+ for x in guess sub ; do
+ dosym ../gnuconfig/config.${x} /usr/share/${PN}-${SLOT}/config.${x}
+ done
+}
diff --git a/sys-devel/automake/automake-1.12.6.ebuild b/sys-devel/automake/automake-1.12.6.ebuild
new file mode 100644
index 000000000000..a3380b0f3192
--- /dev/null
+++ b/sys-devel/automake/automake-1.12.6.ebuild
@@ -0,0 +1,85 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils
+
+DESCRIPTION="Used to generate Makefile.in from Makefile.am"
+HOMEPAGE="http://www.gnu.org/software/automake/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
+
+LICENSE="GPL-2"
+# Use Gentoo versioning for slotting.
+SLOT="${PV:0:4}"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+RDEPEND="dev-lang/perl
+ >=sys-devel/automake-wrapper-9
+ >=sys-devel/autoconf-2.69
+ sys-devel/gnuconfig"
+DEPEND="${RDEPEND}
+ sys-apps/help2man"
+
+src_prepare() {
+ export WANT_AUTOCONF=2.5
+}
+
+src_configure() {
+ econf --docdir=/usr/share/doc/${PF} HELP2MAN=true
+}
+
+src_compile() {
+ emake APIVERSION="${SLOT}" pkgvdatadir="/usr/share/${PN}-${SLOT}"
+}
+
+# slot the info pages. do this w/out munging the source so we don't have
+# to depend on texinfo to regen things. #464146 (among others)
+slot_info_pages() {
+ pushd "${D}"/usr/share/info >/dev/null
+ rm -f dir
+
+ # Rewrite all the references to other pages.
+ # before: * aclocal-invocation: (automake)aclocal Invocation. Generating aclocal.m4.
+ # after: * aclocal-invocation v1.13: (automake-1.13)aclocal Invocation. Generating aclocal.m4.
+ local p pages=( *.info ) args=()
+ for p in "${pages[@]/%.info}" ; do
+ args+=(
+ -e "/START-INFO-DIR-ENTRY/,/END-INFO-DIR-ENTRY/s|: (${p})| v${SLOT}&|"
+ -e "s:(${p}):(${p}-${SLOT}):g"
+ )
+ done
+ sed -i "${args[@]}" * || die
+
+ # Rewrite all the file references, and rename them in the process.
+ local f d
+ for f in * ; do
+ d=${f/.info/-${SLOT}.info}
+ mv "${f}" "${d}" || die
+ sed -i -e "s:${f}:${d}:g" * || die
+ done
+
+ popd >/dev/null
+}
+
+src_install() {
+ emake DESTDIR="${D}" install \
+ APIVERSION="${SLOT}" pkgvdatadir="/usr/share/${PN}-${SLOT}"
+ slot_info_pages
+ rm "${D}"/usr/share/aclocal/README || die
+ rmdir "${D}"/usr/share/aclocal || die
+ dodoc AUTHORS ChangeLog NEWS README THANKS
+
+ rm \
+ "${D}"/usr/bin/{aclocal,automake} \
+ "${D}"/usr/share/man/man1/{aclocal,automake}.1 || die
+
+ # remove all config.guess and config.sub files replacing them
+ # w/a symlink to a specific gnuconfig version
+ local x
+ for x in guess sub ; do
+ dosym ../gnuconfig/config.${x} /usr/share/${PN}-${SLOT}/config.${x}
+ done
+}
diff --git a/sys-devel/automake/automake-1.13.4.ebuild b/sys-devel/automake/automake-1.13.4.ebuild
new file mode 100644
index 000000000000..fe894df04275
--- /dev/null
+++ b/sys-devel/automake/automake-1.13.4.ebuild
@@ -0,0 +1,90 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils
+
+DESCRIPTION="Used to generate Makefile.in from Makefile.am"
+HOMEPAGE="http://www.gnu.org/software/automake/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
+
+LICENSE="GPL-2"
+# Use Gentoo versioning for slotting.
+SLOT="${PV:0:4}"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+RDEPEND="dev-lang/perl
+ >=sys-devel/automake-wrapper-9
+ >=sys-devel/autoconf-2.69
+ sys-devel/gnuconfig"
+DEPEND="${RDEPEND}
+ sys-apps/help2man"
+
+src_prepare() {
+ export WANT_AUTOCONF=2.5
+ epatch "${FILESDIR}"/${PN}-1.13-dyn-ithreads.patch
+}
+
+src_configure() {
+ econf --docdir=/usr/share/doc/${PF} HELP2MAN=true
+}
+
+src_compile() {
+ emake APIVERSION="${SLOT}" pkgvdatadir="/usr/share/${PN}-${SLOT}"
+}
+
+src_test() {
+ emake check
+}
+
+# slot the info pages. do this w/out munging the source so we don't have
+# to depend on texinfo to regen things. #464146 (among others)
+slot_info_pages() {
+ pushd "${D}"/usr/share/info >/dev/null
+ rm -f dir
+
+ # Rewrite all the references to other pages.
+ # before: * aclocal-invocation: (automake)aclocal Invocation. Generating aclocal.m4.
+ # after: * aclocal-invocation v1.13: (automake-1.13)aclocal Invocation. Generating aclocal.m4.
+ local p pages=( *.info ) args=()
+ for p in "${pages[@]/%.info}" ; do
+ args+=(
+ -e "/START-INFO-DIR-ENTRY/,/END-INFO-DIR-ENTRY/s|: (${p})| v${SLOT}&|"
+ -e "s:(${p}):(${p}-${SLOT}):g"
+ )
+ done
+ sed -i "${args[@]}" * || die
+
+ # Rewrite all the file references, and rename them in the process.
+ local f d
+ for f in * ; do
+ d=${f/.info/-${SLOT}.info}
+ mv "${f}" "${d}" || die
+ sed -i -e "s:${f}:${d}:g" * || die
+ done
+
+ popd >/dev/null
+}
+
+src_install() {
+ emake DESTDIR="${D}" install \
+ APIVERSION="${SLOT}" pkgvdatadir="/usr/share/${PN}-${SLOT}"
+ slot_info_pages
+ rm "${D}"/usr/share/aclocal/README || die
+ rmdir "${D}"/usr/share/aclocal || die
+ dodoc AUTHORS ChangeLog NEWS README THANKS
+
+ rm \
+ "${D}"/usr/bin/{aclocal,automake} \
+ "${D}"/usr/share/man/man1/{aclocal,automake}.1 || die
+
+ # remove all config.guess and config.sub files replacing them
+ # w/a symlink to a specific gnuconfig version
+ local x
+ for x in guess sub ; do
+ dosym ../gnuconfig/config.${x} /usr/share/${PN}-${SLOT}/config.${x}
+ done
+}
diff --git a/sys-devel/automake/automake-1.14.1.ebuild b/sys-devel/automake/automake-1.14.1.ebuild
new file mode 100644
index 000000000000..4f9142b0e7da
--- /dev/null
+++ b/sys-devel/automake/automake-1.14.1.ebuild
@@ -0,0 +1,102 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils versionator
+
+if [[ ${PV/_beta} == ${PV} ]]; then
+ MY_P=${P}
+ SRC_URI="mirror://gnu/${PN}/${P}.tar.xz
+ ftp://alpha.gnu.org/pub/gnu/${PN}/${MY_P}.tar.xz"
+else
+ MY_PV="$(get_major_version).$(($(get_version_component_range 2)-1))b"
+ MY_P="${PN}-${MY_PV}"
+
+ # Alpha/beta releases are not distributed on the usual mirrors.
+ SRC_URI="ftp://alpha.gnu.org/pub/gnu/${PN}/${MY_P}.tar.xz"
+fi
+
+DESCRIPTION="Used to generate Makefile.in from Makefile.am"
+HOMEPAGE="http://www.gnu.org/software/automake/"
+
+LICENSE="GPL-2"
+# Use Gentoo versioning for slotting.
+SLOT="${PV:0:4}"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+RDEPEND="dev-lang/perl
+ >=sys-devel/automake-wrapper-9
+ >=sys-devel/autoconf-2.69
+ sys-devel/gnuconfig"
+DEPEND="${RDEPEND}
+ sys-apps/help2man"
+
+S="${WORKDIR}/${MY_P}"
+
+src_prepare() {
+ export WANT_AUTOCONF=2.5
+}
+
+src_configure() {
+ econf --docdir=/usr/share/doc/${PF} HELP2MAN=true
+}
+
+src_compile() {
+ emake APIVERSION="${SLOT}" pkgvdatadir="/usr/share/${PN}-${SLOT}"
+}
+
+src_test() {
+ emake check
+}
+
+# slot the info pages. do this w/out munging the source so we don't have
+# to depend on texinfo to regen things. #464146 (among others)
+slot_info_pages() {
+ pushd "${D}"/usr/share/info >/dev/null
+ rm -f dir
+
+ # Rewrite all the references to other pages.
+ # before: * aclocal-invocation: (automake)aclocal Invocation. Generating aclocal.m4.
+ # after: * aclocal-invocation v1.13: (automake-1.13)aclocal Invocation. Generating aclocal.m4.
+ local p pages=( *.info ) args=()
+ for p in "${pages[@]/%.info}" ; do
+ args+=(
+ -e "/START-INFO-DIR-ENTRY/,/END-INFO-DIR-ENTRY/s|: (${p})| v${SLOT}&|"
+ -e "s:(${p}):(${p}-${SLOT}):g"
+ )
+ done
+ sed -i "${args[@]}" * || die
+
+ # Rewrite all the file references, and rename them in the process.
+ local f d
+ for f in * ; do
+ d=${f/.info/-${SLOT}.info}
+ mv "${f}" "${d}" || die
+ sed -i -e "s:${f}:${d}:g" * || die
+ done
+
+ popd >/dev/null
+}
+
+src_install() {
+ emake DESTDIR="${D}" install \
+ APIVERSION="${SLOT}" pkgvdatadir="/usr/share/${PN}-${SLOT}"
+ slot_info_pages
+ rm "${D}"/usr/share/aclocal/README || die
+ rmdir "${D}"/usr/share/aclocal || die
+ dodoc AUTHORS ChangeLog NEWS README THANKS
+
+ rm \
+ "${D}"/usr/bin/{aclocal,automake} \
+ "${D}"/usr/share/man/man1/{aclocal,automake}.1 || die
+
+ # remove all config.guess and config.sub files replacing them
+ # w/a symlink to a specific gnuconfig version
+ local x
+ for x in guess sub ; do
+ dosym ../gnuconfig/config.${x} /usr/share/${PN}-${SLOT}/config.${x}
+ done
+}
diff --git a/sys-devel/automake/automake-1.15.ebuild b/sys-devel/automake/automake-1.15.ebuild
new file mode 100644
index 000000000000..1873aec56c72
--- /dev/null
+++ b/sys-devel/automake/automake-1.15.ebuild
@@ -0,0 +1,102 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils versionator
+
+if [[ ${PV/_beta} == ${PV} ]]; then
+ MY_P=${P}
+ SRC_URI="mirror://gnu/${PN}/${P}.tar.xz
+ ftp://alpha.gnu.org/pub/gnu/${PN}/${MY_P}.tar.xz"
+else
+ MY_PV="$(get_major_version).$(($(get_version_component_range 2)-1))b"
+ MY_P="${PN}-${MY_PV}"
+
+ # Alpha/beta releases are not distributed on the usual mirrors.
+ SRC_URI="ftp://alpha.gnu.org/pub/gnu/${PN}/${MY_P}.tar.xz"
+fi
+
+DESCRIPTION="Used to generate Makefile.in from Makefile.am"
+HOMEPAGE="http://www.gnu.org/software/automake/"
+
+LICENSE="GPL-2"
+# Use Gentoo versioning for slotting.
+SLOT="${PV:0:4}"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+RDEPEND="dev-lang/perl
+ >=sys-devel/automake-wrapper-10
+ >=sys-devel/autoconf-2.69
+ sys-devel/gnuconfig"
+DEPEND="${RDEPEND}
+ sys-apps/help2man"
+
+S="${WORKDIR}/${MY_P}"
+
+src_prepare() {
+ export WANT_AUTOCONF=2.5
+}
+
+src_configure() {
+ econf --docdir=/usr/share/doc/${PF} HELP2MAN=true
+}
+
+src_compile() {
+ emake APIVERSION="${SLOT}" pkgvdatadir="/usr/share/${PN}-${SLOT}"
+}
+
+src_test() {
+ emake check
+}
+
+# slot the info pages. do this w/out munging the source so we don't have
+# to depend on texinfo to regen things. #464146 (among others)
+slot_info_pages() {
+ pushd "${D}"/usr/share/info >/dev/null
+ rm -f dir
+
+ # Rewrite all the references to other pages.
+ # before: * aclocal-invocation: (automake)aclocal Invocation. Generating aclocal.m4.
+ # after: * aclocal-invocation v1.13: (automake-1.13)aclocal Invocation. Generating aclocal.m4.
+ local p pages=( *.info ) args=()
+ for p in "${pages[@]/%.info}" ; do
+ args+=(
+ -e "/START-INFO-DIR-ENTRY/,/END-INFO-DIR-ENTRY/s|: (${p})| v${SLOT}&|"
+ -e "s:(${p}):(${p}-${SLOT}):g"
+ )
+ done
+ sed -i "${args[@]}" * || die
+
+ # Rewrite all the file references, and rename them in the process.
+ local f d
+ for f in * ; do
+ d=${f/.info/-${SLOT}.info}
+ mv "${f}" "${d}" || die
+ sed -i -e "s:${f}:${d}:g" * || die
+ done
+
+ popd >/dev/null
+}
+
+src_install() {
+ emake DESTDIR="${D}" install \
+ APIVERSION="${SLOT}" pkgvdatadir="/usr/share/${PN}-${SLOT}"
+ slot_info_pages
+ rm "${D}"/usr/share/aclocal/README || die
+ rmdir "${D}"/usr/share/aclocal || die
+ dodoc AUTHORS ChangeLog NEWS README THANKS
+
+ rm \
+ "${D}"/usr/bin/{aclocal,automake} \
+ "${D}"/usr/share/man/man1/{aclocal,automake}.1 || die
+
+ # remove all config.guess and config.sub files replacing them
+ # w/a symlink to a specific gnuconfig version
+ local x
+ for x in guess sub ; do
+ dosym ../gnuconfig/config.${x} /usr/share/${PN}-${SLOT}/config.${x}
+ done
+}
diff --git a/sys-devel/automake/automake-1.4_p6-r2.ebuild b/sys-devel/automake/automake-1.4_p6-r2.ebuild
new file mode 100644
index 000000000000..152ab4955f09
--- /dev/null
+++ b/sys-devel/automake/automake-1.4_p6-r2.ebuild
@@ -0,0 +1,84 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils
+
+MY_P="${P/_/-}"
+DESCRIPTION="Used to generate Makefile.in from Makefile.am"
+HOMEPAGE="http://www.gnu.org/software/automake/"
+SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.gz"
+
+LICENSE="GPL-2"
+# Use Gentoo versioning for slotting.
+SLOT="${PV:0:3}"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+RDEPEND="dev-lang/perl
+ >=sys-devel/automake-wrapper-9
+ >=sys-devel/autoconf-2.69
+ sys-devel/gnuconfig"
+DEPEND="${RDEPEND}"
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+ export WANT_AUTOCONF=2.5
+ epatch "${FILESDIR}"/${PN}-1.4-nls-nuisances.patch #121151
+ epatch "${FILESDIR}"/${PN}-1.4-libtoolize.patch
+ epatch "${FILESDIR}"/${PN}-1.4-subdirs-89656.patch
+ epatch "${FILESDIR}"/${PN}-1.4-ansi2knr-stdlib.patch
+ epatch "${FILESDIR}"/${PN}-1.4-CVE-2009-4029.patch #295357
+ epatch "${FILESDIR}"/${PN}-1.4-perl-5.11.patch
+ epatch "${FILESDIR}"/${PN}-1.4-perl-dyn-call.patch
+ sed -i 's:error\.test::' tests/Makefile.in #79529
+}
+
+# slot the info pages. do this w/out munging the source so we don't have
+# to depend on texinfo to regen things. #464146 (among others)
+slot_info_pages() {
+ pushd "${D}"/usr/share/info >/dev/null
+ rm -f dir
+
+ # Rewrite all the references to other pages.
+ # before: * aclocal-invocation: (automake)aclocal Invocation. Generating aclocal.m4.
+ # after: * aclocal-invocation v1.13: (automake-1.13)aclocal Invocation. Generating aclocal.m4.
+ local p pages=( *.info ) args=()
+ for p in "${pages[@]/%.info}" ; do
+ args+=(
+ -e "/START-INFO-DIR-ENTRY/,/END-INFO-DIR-ENTRY/s|: (${p})| v${SLOT}&|"
+ -e "s:(${p}):(${p}-${SLOT}):g"
+ )
+ done
+ sed -i "${args[@]}" * || die
+
+ # Rewrite all the file references, and rename them in the process.
+ local f d
+ for f in * ; do
+ d=${f/.info/-${SLOT}.info}
+ mv "${f}" "${d}" || die
+ sed -i -e "s:${f}:${d}:g" * || die
+ done
+
+ popd >/dev/null
+}
+
+src_install() {
+ emake install DESTDIR="${D}" \
+ pkgdatadir=/usr/share/automake-${SLOT} \
+ m4datadir=/usr/share/aclocal-${SLOT}
+ slot_info_pages
+ rm -f "${D}"/usr/bin/{aclocal,automake}
+ dosym automake-${SLOT} /usr/share/automake
+
+ dodoc NEWS README THANKS TODO AUTHORS ChangeLog
+
+ # remove all config.guess and config.sub files replacing them
+ # w/a symlink to a specific gnuconfig version
+ for x in guess sub ; do
+ dosym ../gnuconfig/config.${x} /usr/share/${PN}-${SLOT}/config.${x}
+ done
+}
diff --git a/sys-devel/automake/automake-1.5-r2.ebuild b/sys-devel/automake/automake-1.5-r2.ebuild
new file mode 100644
index 000000000000..7031439fe4c8
--- /dev/null
+++ b/sys-devel/automake/automake-1.5-r2.ebuild
@@ -0,0 +1,80 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils
+
+DESCRIPTION="Used to generate Makefile.in from Makefile.am"
+HOMEPAGE="http://www.gnu.org/software/automake/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+# Use Gentoo versioning for slotting.
+SLOT="${PV:0:3}"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+RDEPEND="dev-lang/perl
+ >=sys-devel/automake-wrapper-9
+ >=sys-devel/autoconf-2.69
+ sys-devel/gnuconfig"
+DEPEND="${RDEPEND}"
+
+src_prepare() {
+ export WANT_AUTOCONF=2.5
+ epatch "${FILESDIR}"/automake-1.4-nls-nuisances.patch #121151
+ epatch "${FILESDIR}"/${P}-target_hook.patch
+ epatch "${FILESDIR}"/${P}-slot.patch
+ epatch "${FILESDIR}"/${P}-test-fixes.patch #79505
+ epatch "${FILESDIR}"/${PN}-1.10-ccnoco-ldflags.patch #203914
+ epatch "${FILESDIR}"/${P}-CVE-2009-4029.patch #295357
+ epatch "${FILESDIR}"/${PN}-1.5-perl-5.11.patch
+}
+
+# slot the info pages. do this w/out munging the source so we don't have
+# to depend on texinfo to regen things. #464146 (among others)
+slot_info_pages() {
+ pushd "${D}"/usr/share/info >/dev/null
+ rm -f dir
+
+ # Rewrite all the references to other pages.
+ # before: * aclocal-invocation: (automake)aclocal Invocation. Generating aclocal.m4.
+ # after: * aclocal-invocation v1.13: (automake-1.13)aclocal Invocation. Generating aclocal.m4.
+ local p pages=( *.info ) args=()
+ for p in "${pages[@]/%.info}" ; do
+ args+=(
+ -e "/START-INFO-DIR-ENTRY/,/END-INFO-DIR-ENTRY/s|: (${p})| v${SLOT}&|"
+ -e "s:(${p}):(${p}-${SLOT}):g"
+ )
+ done
+ sed -i "${args[@]}" * || die
+
+ # Rewrite all the file references, and rename them in the process.
+ local f d
+ for f in * ; do
+ d=${f/.info/-${SLOT}.info}
+ mv "${f}" "${d}" || die
+ sed -i -e "s:${f}:${d}:g" * || die
+ done
+
+ popd >/dev/null
+}
+
+src_install() {
+ default
+ slot_info_pages
+
+ local x
+ for x in aclocal automake ; do
+ mv "${D}"/usr/bin/${x}{,-${SLOT}} || die "rename ${x}"
+ mv "${D}"/usr/share/${x}{,-${SLOT}} || die "move ${x}"
+ done
+
+ # remove all config.guess and config.sub files replacing them
+ # w/a symlink to a specific gnuconfig version
+ for x in guess sub ; do
+ dosym ../gnuconfig/config.${x} /usr/share/${PN}-${SLOT}/config.${x}
+ done
+}
diff --git a/sys-devel/automake/automake-1.6.3-r2.ebuild b/sys-devel/automake/automake-1.6.3-r2.ebuild
new file mode 100644
index 000000000000..3b2a61bd1fe0
--- /dev/null
+++ b/sys-devel/automake/automake-1.6.3-r2.ebuild
@@ -0,0 +1,73 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils
+
+DESCRIPTION="Used to generate Makefile.in from Makefile.am"
+HOMEPAGE="http://www.gnu.org/software/automake/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+# Use Gentoo versioning for slotting.
+SLOT="${PV:0:3}"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+RDEPEND="dev-lang/perl
+ >=sys-devel/automake-wrapper-9
+ >=sys-devel/autoconf-2.69
+ sys-devel/gnuconfig"
+DEPEND="${RDEPEND}"
+
+src_prepare() {
+ export WANT_AUTOCONF=2.5
+ epatch "${FILESDIR}"/${P}-test-fixes.patch #159557
+ epatch "${FILESDIR}"/${PN}-1.10-ccnoco-ldflags.patch #203914
+ epatch "${FILESDIR}"/${PN}-1.5-CVE-2009-4029.patch #295357
+ epatch "${FILESDIR}"/${PN}-1.5-perl-5.11.patch
+}
+
+# slot the info pages. do this w/out munging the source so we don't have
+# to depend on texinfo to regen things. #464146 (among others)
+slot_info_pages() {
+ pushd "${D}"/usr/share/info >/dev/null
+ rm -f dir
+
+ # Rewrite all the references to other pages.
+ # before: * aclocal-invocation: (automake)aclocal Invocation. Generating aclocal.m4.
+ # after: * aclocal-invocation v1.13: (automake-1.13)aclocal Invocation. Generating aclocal.m4.
+ local p pages=( *.info ) args=()
+ for p in "${pages[@]/%.info}" ; do
+ args+=(
+ -e "/START-INFO-DIR-ENTRY/,/END-INFO-DIR-ENTRY/s|: (${p})| v${SLOT}&|"
+ -e "s:(${p}):(${p}-${SLOT}):g"
+ )
+ done
+ sed -i "${args[@]}" * || die
+
+ # Rewrite all the file references, and rename them in the process.
+ local f d
+ for f in * ; do
+ d=${f/.info/-${SLOT}.info}
+ mv "${f}" "${d}" || die
+ sed -i -e "s:${f}:${d}:g" * || die
+ done
+
+ popd >/dev/null
+}
+
+src_install() {
+ default
+ slot_info_pages
+ rm -f "${D}"/usr/bin/{aclocal,automake}
+
+ # remove all config.guess and config.sub files replacing them
+ # w/a symlink to a specific gnuconfig version
+ local x
+ for x in guess sub ; do
+ dosym ../gnuconfig/config.${x} /usr/share/${PN}-${SLOT}/config.${x}
+ done
+}
diff --git a/sys-devel/automake/automake-1.7.9-r3.ebuild b/sys-devel/automake/automake-1.7.9-r3.ebuild
new file mode 100644
index 000000000000..e8e548874f25
--- /dev/null
+++ b/sys-devel/automake/automake-1.7.9-r3.ebuild
@@ -0,0 +1,76 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils
+
+DESCRIPTION="Used to generate Makefile.in from Makefile.am"
+HOMEPAGE="http://www.gnu.org/software/automake/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+# Use Gentoo versioning for slotting.
+SLOT="${PV:0:3}"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+RDEPEND="dev-lang/perl
+ >=sys-devel/automake-wrapper-9
+ >=sys-devel/autoconf-2.69
+ sys-devel/gnuconfig"
+DEPEND="${RDEPEND}"
+
+src_prepare() {
+ export WANT_AUTOCONF=2.5
+ epatch "${FILESDIR}"/${P}-infopage-namechange.patch
+ epatch "${FILESDIR}"/${P}-test-fixes.patch
+ epatch "${FILESDIR}"/${PN}-1.9.6-subst-test.patch #222225
+ epatch "${FILESDIR}"/${P}-libtool-2.patch #257544
+ epatch "${FILESDIR}"/${PN}-1.10-ccnoco-ldflags.patch #203914
+ epatch "${FILESDIR}"/${PN}-1.5-CVE-2009-4029.patch #295357
+ epatch "${FILESDIR}"/${PN}-1.5-perl-5.11.patch
+}
+
+# slot the info pages. do this w/out munging the source so we don't have
+# to depend on texinfo to regen things. #464146 (among others)
+slot_info_pages() {
+ pushd "${D}"/usr/share/info >/dev/null
+ rm -f dir
+
+ # Rewrite all the references to other pages.
+ # before: * aclocal-invocation: (automake)aclocal Invocation. Generating aclocal.m4.
+ # after: * aclocal-invocation v1.13: (automake-1.13)aclocal Invocation. Generating aclocal.m4.
+ local p pages=( *.info ) args=()
+ for p in "${pages[@]/%.info}" ; do
+ args+=(
+ -e "/START-INFO-DIR-ENTRY/,/END-INFO-DIR-ENTRY/s|: (${p})| v${SLOT}&|"
+ -e "s:(${p}):(${p}-${SLOT}):g"
+ )
+ done
+ sed -i "${args[@]}" * || die
+
+ # Rewrite all the file references, and rename them in the process.
+ local f d
+ for f in * ; do
+ d=${f/.info/-${SLOT}.info}
+ mv "${f}" "${d}" || die
+ sed -i -e "s:${f}:${d}:g" * || die
+ done
+
+ popd >/dev/null
+}
+
+src_install() {
+ default
+ slot_info_pages
+ rm -f "${D}"/usr/bin/{aclocal,automake}
+
+ # remove all config.guess and config.sub files replacing them
+ # w/a symlink to a specific gnuconfig version
+ local x
+ for x in guess sub ; do
+ dosym ../gnuconfig/config.${x} /usr/share/${PN}-${SLOT}/config.${x}
+ done
+}
diff --git a/sys-devel/automake/automake-1.8.5-r5.ebuild b/sys-devel/automake/automake-1.8.5-r5.ebuild
new file mode 100644
index 000000000000..c8b0ef23a37c
--- /dev/null
+++ b/sys-devel/automake/automake-1.8.5-r5.ebuild
@@ -0,0 +1,76 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils
+
+DESCRIPTION="Used to generate Makefile.in from Makefile.am"
+HOMEPAGE="http://www.gnu.org/software/automake/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+# Use Gentoo versioning for slotting.
+SLOT="${PV:0:3}"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+RDEPEND="dev-lang/perl
+ >=sys-devel/automake-wrapper-9
+ >=sys-devel/autoconf-2.69
+ sys-devel/gnuconfig"
+DEPEND="${RDEPEND}"
+
+src_prepare() {
+ export WANT_AUTOCONF=2.5
+ epatch "${FILESDIR}"/${PN}-1.8.2-infopage-namechange.patch
+ epatch "${FILESDIR}"/${P}-test-fixes.patch #159557
+ epatch "${FILESDIR}"/${PN}-1.9.6-aclocal7-test-sleep.patch #197366
+ epatch "${FILESDIR}"/${PN}-1.9.6-subst-test.patch #222225
+ epatch "${FILESDIR}"/${PN}-1.10-ccnoco-ldflags.patch #203914
+ epatch "${FILESDIR}"/${P}-CVE-2009-4029.patch #295357
+ epatch "${FILESDIR}"/${PN}-1.8-perl-5.11.patch
+}
+
+# slot the info pages. do this w/out munging the source so we don't have
+# to depend on texinfo to regen things. #464146 (among others)
+slot_info_pages() {
+ pushd "${D}"/usr/share/info >/dev/null
+ rm -f dir
+
+ # Rewrite all the references to other pages.
+ # before: * aclocal-invocation: (automake)aclocal Invocation. Generating aclocal.m4.
+ # after: * aclocal-invocation v1.13: (automake-1.13)aclocal Invocation. Generating aclocal.m4.
+ local p pages=( *.info ) args=()
+ for p in "${pages[@]/%.info}" ; do
+ args+=(
+ -e "/START-INFO-DIR-ENTRY/,/END-INFO-DIR-ENTRY/s|: (${p})| v${SLOT}&|"
+ -e "s:(${p}):(${p}-${SLOT}):g"
+ )
+ done
+ sed -i "${args[@]}" * || die
+
+ # Rewrite all the file references, and rename them in the process.
+ local f d
+ for f in * ; do
+ d=${f/.info/-${SLOT}.info}
+ mv "${f}" "${d}" || die
+ sed -i -e "s:${f}:${d}:g" * || die
+ done
+
+ popd >/dev/null
+}
+
+src_install() {
+ default
+ slot_info_pages
+ rm -f "${D}"/usr/bin/{aclocal,automake}
+
+ # remove all config.guess and config.sub files replacing them
+ # w/a symlink to a specific gnuconfig version
+ local x
+ for x in guess sub ; do
+ dosym ../gnuconfig/config.${x} /usr/share/${PN}-${SLOT}/config.${x}
+ done
+}
diff --git a/sys-devel/automake/automake-1.9.6-r4.ebuild b/sys-devel/automake/automake-1.9.6-r4.ebuild
new file mode 100644
index 000000000000..acd34c1f3918
--- /dev/null
+++ b/sys-devel/automake/automake-1.9.6-r4.ebuild
@@ -0,0 +1,84 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils
+
+DESCRIPTION="Used to generate Makefile.in from Makefile.am"
+HOMEPAGE="http://www.gnu.org/software/automake/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+# Use Gentoo versioning for slotting.
+SLOT="${PV:0:3}"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+RDEPEND="dev-lang/perl
+ >=sys-devel/automake-wrapper-9
+ >=sys-devel/autoconf-2.69
+ >=sys-apps/texinfo-4.7
+ sys-devel/gnuconfig"
+DEPEND="${RDEPEND}
+ sys-apps/help2man"
+
+src_prepare() {
+ export WANT_AUTOCONF=2.5
+ epatch "${FILESDIR}"/${PN}-1.9.6-infopage-namechange.patch
+ epatch "${FILESDIR}"/${P}-include-dir-prefix.patch #107435
+ epatch "${FILESDIR}"/${P}-ignore-comments.patch #126388
+ epatch "${FILESDIR}"/${P}-aclocal7-test-sleep.patch #197366
+ epatch "${FILESDIR}"/${PN}-1.9.6-subst-test.patch #222225
+ epatch "${FILESDIR}"/${PN}-1.10-ccnoco-ldflags.patch #203914
+ epatch "${FILESDIR}"/${PN}-1.8.5-CVE-2009-4029.patch #295357
+ epatch "${FILESDIR}"/${PN}-1.8-perl-5.11.patch
+}
+
+# slot the info pages. do this w/out munging the source so we don't have
+# to depend on texinfo to regen things. #464146 (among others)
+slot_info_pages() {
+ pushd "${D}"/usr/share/info >/dev/null
+ rm -f dir
+
+ # Rewrite all the references to other pages.
+ # before: * aclocal-invocation: (automake)aclocal Invocation. Generating aclocal.m4.
+ # after: * aclocal-invocation v1.13: (automake-1.13)aclocal Invocation. Generating aclocal.m4.
+ local p pages=( *.info ) args=()
+ for p in "${pages[@]/%.info}" ; do
+ args+=(
+ -e "/START-INFO-DIR-ENTRY/,/END-INFO-DIR-ENTRY/s|: (${p})| v${SLOT}&|"
+ -e "s:(${p}):(${p}-${SLOT}):g"
+ )
+ done
+ sed -i "${args[@]}" * || die
+
+ # Rewrite all the file references, and rename them in the process.
+ local f d
+ for f in * ; do
+ d=${f/.info/-${SLOT}.info}
+ mv "${f}" "${d}" || die
+ sed -i -e "s:${f}:${d}:g" * || die
+ done
+
+ popd >/dev/null
+}
+
+src_install() {
+ default
+ slot_info_pages
+
+ local x
+ for x in aclocal automake ; do
+ help2man "perl -Ilib ${x}" > ${x}-${SLOT}.1
+ doman ${x}-${SLOT}.1
+ rm -f "${D}"/usr/bin/${x}
+ done
+
+ # remove all config.guess and config.sub files replacing them
+ # w/a symlink to a specific gnuconfig version
+ for x in guess sub ; do
+ dosym ../gnuconfig/config.${x} /usr/share/${PN}-${SLOT}/config.${x}
+ done
+}
diff --git a/sys-devel/automake/automake-9999.ebuild b/sys-devel/automake/automake-9999.ebuild
new file mode 100644
index 000000000000..3215252aca47
--- /dev/null
+++ b/sys-devel/automake/automake-9999.ebuild
@@ -0,0 +1,91 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+EGIT_REPO_URI="git://git.savannah.gnu.org/${PN}.git
+ http://git.savannah.gnu.org/r/${PN}.git"
+
+inherit eutils git-2
+
+DESCRIPTION="Used to generate Makefile.in from Makefile.am"
+HOMEPAGE="http://www.gnu.org/software/automake/"
+SRC_URI=""
+
+LICENSE="GPL-3"
+# Use Gentoo versioning for slotting.
+SLOT="${PV:0:4}"
+KEYWORDS=""
+IUSE=""
+
+RDEPEND="dev-lang/perl
+ >=sys-devel/automake-wrapper-9
+ >=sys-devel/autoconf-2.69
+ >=sys-apps/texinfo-4.7
+ sys-devel/gnuconfig"
+DEPEND="${RDEPEND}
+ sys-apps/help2man"
+
+src_prepare() {
+ export WANT_AUTOCONF=2.5
+ # Don't try wrapping the autotools this thing runs as it tends
+ # to be a bit esoteric, and the script does `set -e` itself.
+ ./bootstrap.sh
+}
+
+src_configure() {
+ econf --docdir=/usr/share/doc/${PF}
+}
+
+src_test() {
+ emake check
+}
+
+# slot the info pages. do this w/out munging the source so we don't have
+# to depend on texinfo to regen things. #464146 (among others)
+slot_info_pages() {
+ pushd "${D}"/usr/share/info >/dev/null
+ rm -f dir
+
+ # Rewrite all the references to other pages.
+ # before: * aclocal-invocation: (automake)aclocal Invocation. Generating aclocal.m4.
+ # after: * aclocal-invocation v1.13: (automake-1.13)aclocal Invocation. Generating aclocal.m4.
+ local p pages=( *.info ) args=()
+ for p in "${pages[@]/%.info}" ; do
+ args+=(
+ -e "/START-INFO-DIR-ENTRY/,/END-INFO-DIR-ENTRY/s|: (${p})| v${SLOT}&|"
+ -e "s:(${p}):(${p}-${SLOT}):g"
+ )
+ done
+ sed -i "${args[@]}" * || die
+
+ # Rewrite all the file references, and rename them in the process.
+ local f d
+ for f in * ; do
+ d=${f/.info/-${SLOT}.info}
+ mv "${f}" "${d}" || die
+ sed -i -e "s:${f}:${d}:g" * || die
+ done
+
+ popd >/dev/null
+}
+
+src_install() {
+ default
+ slot_info_pages
+
+ # SLOT the docs and junk
+ local x
+ for x in aclocal automake ; do
+ help2man "perl -Ilib ${x}" > ${x}-${SLOT}.1
+ doman ${x}-${SLOT}.1
+ rm -f "${D}"/usr/bin/${x}
+ done
+
+ # remove all config.guess and config.sub files replacing them
+ # w/a symlink to a specific gnuconfig version
+ for x in guess sub ; do
+ dosym ../gnuconfig/config.${x} /usr/share/${PN}-${SLOT}/config.${x}
+ done
+}
diff --git a/sys-devel/automake/files/automake-1.10-ccnoco-ldflags.patch b/sys-devel/automake/files/automake-1.10-ccnoco-ldflags.patch
new file mode 100644
index 000000000000..f48c6304bdc2
--- /dev/null
+++ b/sys-devel/automake/files/automake-1.10-ccnoco-ldflags.patch
@@ -0,0 +1,35 @@
+http://bugs.gentoo.org/203914
+
+From 6e86514729c6dccb6213fdde8d93d7061c8108a5 Mon Sep 17 00:00:00 2001
+From: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+Date: Mon, 7 Jan 2008 21:53:38 +0100
+Subject: [PATCH] Fix ccnoco.test for uncommon LDFLAGS settings.
+
+* tests/ccnoco.test (Mycomp): Use a tighter match for -c -o,
+to avoid matching for example `LDFLAGS=-Wl,--sort-common'.
+* THANKS: Update.
+Report and analysis by Carsten Lohrke and Mike Frysinger.
+---
+ ChangeLog | 7 +++++++
+ THANKS | 1 +
+ tests/ccnoco.test | 6 +++---
+ 3 files changed, 11 insertions(+), 3 deletions(-)
+
+diff --git a/tests/ccnoco.test b/tests/ccnoco.test
+index 8b37fe8..ca75922 100755
+--- a/tests/ccnoco.test
++++ b/tests/ccnoco.test
+@@ -57,8 +57,8 @@ END
+ cat > Mycomp << 'END'
+ #!/bin/sh
+
+-case "$@" in
+- *-c*-o* | *-o*-c*)
++case " "$* in
++ *\ -c*\ -o* | *\ -o*\ -c*)
+ exit 1
+ ;;
+ esac
+--
+1.6.3
+
diff --git a/sys-devel/automake/files/automake-1.10-perl-5.16.patch b/sys-devel/automake/files/automake-1.10-perl-5.16.patch
new file mode 100644
index 000000000000..19fe249e0c00
--- /dev/null
+++ b/sys-devel/automake/files/automake-1.10-perl-5.16.patch
@@ -0,0 +1,128 @@
+https://bugs.gentoo.org/424453
+
+From 6bf58a59a1f3803e57e3f0378aa9344686707b75 Mon Sep 17 00:00:00 2001
+From: Stefano Lattarini <stefano.lattarini@gmail.com>
+Date: Mon, 28 May 2012 13:32:03 +0200
+Subject: [PATCH] aclocal: declare function prototypes, do not use '&' in
+ function calls
+
+This change will also fix automake bug#11543 (from a report by Matt
+Burgess).
+
+* aclocal.in: Declare prototypes for almost all functions early, before
+any actual function definition (but omit the prototype for the dynamically
+generated '&search' function). Add prototypes to any function definition.
+Remove '&' from function invocations (i.e., simply use "func(ARGS..)"
+instead of "&func(ARGS...)").
+* THANKS, NEWS: Update.
+
+Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
+---
+ NEWS | 4 ++++
+ THANKS | 1 +
+ aclocal.in | 42 ++++++++++++++++++++++++++++++++++--------
+ 3 files changed, 39 insertions(+), 8 deletions(-)
+
+diff --git a/aclocal.in b/aclocal.in
+index dfb851b..e8855d5 100644
+--- a/aclocal.in
++++ b/aclocal.in
+@@ -152,8 +152,34 @@ my $erase_me;
+
+ ################################################################
+
++# Prototypes for all subroutines.
++
++sub unlink_tmp (;$);
++sub xmkdir_p ($);
++sub check_acinclude ();
++sub reset_maps ();
++sub install_file ($$);
++sub list_compare (\@\@);
++sub scan_m4_dirs ($@);
++sub scan_m4_files ();
++sub add_macro ($);
++sub scan_configure_dep ($);
++sub add_file ($);
++sub scan_file ($$$);
++sub strip_redundant_includes (%);
++sub trace_used_macros ();
++sub scan_configure ();
++sub write_aclocal ($@);
++sub usage ($);
++sub version ();
++sub handle_acdir_option ($$);
++sub parse_arguments ();
++sub parse_ACLOCAL_PATH ();
++
++################################################################
++
+ # Erase temporary file ERASE_ME. Handle signals.
+-sub unlink_tmp
++sub unlink_tmp (;$)
+ {
+ my ($sig) = @_;
+
+@@ -350,7 +376,7 @@ sub scan_m4_dirs ($@)
+ next if $file eq 'aclocal.m4';
+
+ my $fullfile = File::Spec->canonpath ("$m4dir/$file");
+- &scan_file ($type, $fullfile, 'aclocal');
++ scan_file ($type, $fullfile, 'aclocal');
+ }
+ closedir (DIR);
+ }
+@@ -361,12 +387,12 @@ sub scan_m4_files ()
+ {
+ # First, scan configure.ac. It may contain macro definitions,
+ # or may include other files that define macros.
+- &scan_file (FT_USER, $configure_ac, 'aclocal');
++ scan_file (FT_USER, $configure_ac, 'aclocal');
+
+ # Then, scan acinclude.m4 if it exists.
+ if (-f 'acinclude.m4')
+ {
+- &scan_file (FT_USER, 'acinclude.m4', 'aclocal');
++ scan_file (FT_USER, 'acinclude.m4', 'aclocal');
+ }
+
+ # Finally, scan all files in our search paths.
+@@ -380,7 +406,7 @@ sub scan_m4_files ()
+ my $search = "sub search {\nmy \$found = 0;\n";
+ foreach my $key (reverse sort keys %map)
+ {
+- $search .= ('if (/\b\Q' . $key . '\E(?!\w)/) { & add_macro ("' . $key
++ $search .= ('if (/\b\Q' . $key . '\E(?!\w)/) { add_macro ("' . $key
+ . '"); $found = 1; }' . "\n");
+ }
+ $search .= "return \$found;\n};\n";
+@@ -403,7 +429,7 @@ sub add_macro ($)
+
+ verb "saw macro $macro";
+ $macro_seen{$macro} = 1;
+- &add_file ($map{$macro});
++ add_file ($map{$macro});
+ }
+
+ # scan_configure_dep ($file)
+@@ -465,7 +491,7 @@ sub scan_configure_dep ($)
+ }
+
+ add_macro ($_) foreach (@rlist);
+- &scan_configure_dep ($_) foreach @ilist;
++ scan_configure_dep ($_) foreach @ilist;
+ }
+
+ # add_file ($FILE)
+@@ -931,7 +957,7 @@ EOF
+ }
+
+ # Print version and exit.
+-sub version()
++sub version ()
+ {
+ print <<EOF;
+ aclocal (GNU $PACKAGE) $VERSION
+--
+2.1.3
+
diff --git a/sys-devel/automake/files/automake-1.10.1-tests.patch b/sys-devel/automake/files/automake-1.10.1-tests.patch
new file mode 100644
index 000000000000..02e71949dc28
--- /dev/null
+++ b/sys-devel/automake/files/automake-1.10.1-tests.patch
@@ -0,0 +1,111 @@
+commit eed743342cfa0ff8cc69666243233229e7417f8f
+Author: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+Date: Wed Jan 30 21:23:16 2008 +0100
+
+ Split instsh2.test, so that only the new part requires non-root.
+
+ * tests/instsh2.test: Split off testing of `install-sh -C' ...
+ * tests/instsh3.test: ... to this new test, requiring non-root.
+ * tests/Makefile.am: Adjust.
+ * THANKS: Update.
+ Report by Theodoros V. Kalamatianos.
+
+diff --git a/tests/Makefile.am b/tests/Makefile.am
+index ec10801..8405c7a 100644
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
+@@ -293,6 +293,7 @@ install2.test \
+ installdir.test \
+ instsh.test \
+ instsh2.test \
++instsh3.test \
+ instdat.test \
+ instdat2.test \
+ instexec.test \
+diff --git a/tests/Makefile.in b/tests/Makefile.in
+index 6ba81ab..1bcb573 100644
+--- a/tests/Makefile.in
++++ b/tests/Makefile.in
+@@ -442,6 +442,7 @@ install2.test \
+ installdir.test \
+ instsh.test \
+ instsh2.test \
++instsh3.test \
+ instdat.test \
+ instdat2.test \
+ instexec.test \
+diff --git a/tests/instsh2.test b/tests/instsh2.test
+index 17b61ab..f0b729e 100755
+--- a/tests/instsh2.test
++++ b/tests/instsh2.test
+@@ -1,5 +1,5 @@
+ #! /bin/sh
+-# Copyright (C) 2002, 2004, 2006 Free Software Foundation, Inc.
++# Copyright (C) 2002, 2004, 2006, 2008 Free Software Foundation, Inc.
+ #
+ # This program is free software; you can redistribute it and/or modify
+ # it under the terms of the GNU General Public License as published by
+@@ -77,20 +77,6 @@ test -f d3/y
+ ./install-sh -T x d3 && exit 1
+ ./install-sh -T x d4// && exit 1
+
+-# Do not change the timestamps when using -C.
+-echo foo >file
+-./install-sh -C file d1
+-TZ=UTC0 touch -t $old_timestamp d1/file
+-./install-sh -C file d1
+-is_newest file d1/file
+-echo foo1 >file
+-./install-sh -C file d1
+-diff file d1/file
+-# Rights must be updated.
+-./install-sh -C -m 444 file d1
+-test -r d1/file
+-test ! -w d1/file
+-
+ # Ensure that install-sh works with names that include spaces
+ touch 'a b'
+ mkdir 'x y'
+diff --git a/tests/instsh3.test b/tests/instsh3.test
+new file mode 100755
+index 0000000..95b74c7
+--- /dev/null
++++ b/tests/instsh3.test
+@@ -0,0 +1,37 @@
++#! /bin/sh
++# Copyright (C) 2006, 2008 Free Software Foundation, Inc.
++#
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3, or (at your option)
++# any later version.
++#
++# This program 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 General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program. If not, see <http://www.gnu.org/licenses/>.
++
++# More install-sh checks: check -C.
++
++required=non-root
++. ./defs || exit 1
++set -e
++
++./install-sh -d d1
++
++# Do not change the timestamps when using -C.
++echo foo >file
++./install-sh -C file d1
++TZ=UTC0 touch -t $old_timestamp d1/file
++./install-sh -C file d1
++is_newest file d1/file
++echo foo1 >file
++./install-sh -C file d1
++diff file d1/file
++# Rights must be updated.
++./install-sh -C -m 444 file d1
++test -r d1/file
++test ! -w d1/file
diff --git a/sys-devel/automake/files/automake-1.10.2-bash4.patch b/sys-devel/automake/files/automake-1.10.2-bash4.patch
new file mode 100644
index 000000000000..01829ce1741e
--- /dev/null
+++ b/sys-devel/automake/files/automake-1.10.2-bash4.patch
@@ -0,0 +1,22 @@
+An upstream patch to fix ksh test issues, which also affect bash 4.0
+
+http://bugs.gentoo.org/263068
+http://git.savannah.gnu.org/cgit/automake.git/commit/?h=branch-1-10&id=319305db77dfdcbba3d5a1703c781750affdb20a
+
+2008-12-21 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ Testsuite fix for ksh.
+ * tests/check10.test: Add ':' as last command in subshell, for
+ zero exit status of the subshell.
+ Missing backport from master reported by Tim Rice.
+
+--- a/tests/check10.test
++++ b/tests/check10.test
+@@ -72,6 +72,7 @@
+ env TESTS="xpass xpass2" $MAKE -e check
+ env TESTS='pass skip xfail' $MAKE -e check
+ $MAKE check
++ :
+ ) >stdout
+ cat stdout
+
diff --git a/sys-devel/automake/files/automake-1.13-dyn-ithreads.patch b/sys-devel/automake/files/automake-1.13-dyn-ithreads.patch
new file mode 100644
index 000000000000..f790e7724c93
--- /dev/null
+++ b/sys-devel/automake/files/automake-1.13-dyn-ithreads.patch
@@ -0,0 +1,59 @@
+https://bugs.gentoo.org/343439
+
+From 182626687f2640609f8eb28ad1b04b078342f2c7 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Sat, 12 Jan 2013 00:19:40 -0500
+Subject: [PATCH] ithreads: use runtime (not configure time) detection of perl
+ threads
+
+I can't imagine the runtime checks being a big runtime penalty, so there
+shouldn't be a need to do the checks at configure check and hardcode the
+result in the generated automake.
+
+With the current system, it means if you change your perl config (build
+perl w/threads, build automake, build perl w/out threads), or deploy a
+compiled automake package on a different system (build had threads, but
+deployed system does not), you get errors when trying to run automake.
+
+So take the logic from configure.ac and move it to the one place where
+PERL_THREADS is used (lib/Automake/Config.in) and do the version/config
+checking at runtime.
+
+* bootstrap.sh (PERL_THREADS): Delete assignment and use in sed.
+* configure.ac (am_cv_prog_PERL_ithreads, PERL_THREADS): Delete all code
+related to these two variables.
+* lib/Automake/Config.in (perl_threads): Initialize to 0, and only set to
+1 if the perl version is at least 5.007_002, and useithreads is in Config.
+
+Copyright-paperwork-exempt: yes
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
+---
+ bootstrap.sh | 2 --
+ configure.ac | 26 --------------------------
+ lib/Automake/Config.in | 9 ++++++++-
+ 3 files changed, 8 insertions(+), 29 deletions(-)
+
+diff --git a/lib/Automake/Config.in b/lib/Automake/Config.in
+index fe6ef9d..885e74e 100644
+--- a/lib/Automake/Config.in
++++ b/lib/Automake/Config.in
+@@ -33,7 +33,14 @@ our $PACKAGE_BUGREPORT = '@PACKAGE_BUGREPORT@';
+ our $VERSION = '@VERSION@';
+ our $RELEASE_YEAR = '@RELEASE_YEAR@';
+ our $libdir = '@datadir@/@PACKAGE@-@APIVERSION@';
+-our $perl_threads = @PERL_THREADS@;
++
++our $perl_threads = 0;
++# We need at least this version for CLONE support.
++if (eval { require 5.007_002; })
++ {
++ use Config;
++ $perl_threads = $Config{useithreads};
++ }
+
+ 1;
+
+--
+1.8.0.2
+
diff --git a/sys-devel/automake/files/automake-1.4-CVE-2009-4029.patch b/sys-devel/automake/files/automake-1.4-CVE-2009-4029.patch
new file mode 100644
index 000000000000..42aef8c8e1bc
--- /dev/null
+++ b/sys-devel/automake/files/automake-1.4-CVE-2009-4029.patch
@@ -0,0 +1,65 @@
+http://bugs.gentoo.org/295357
+
+(Makefile.in mangled a little for 1.4_p6)
+
+From 449d20aa12e13fefd848604225fc83d0c39c61d0 Mon Sep 17 00:00:00 2001
+From: Jim Meyering <meyering@redhat.com>
+Date: Tue, 1 Dec 2009 22:48:15 +0100
+Subject: [PATCH 1/1] do not put world-writable directories in distribution tarballs
+
+* automake.in (handle_dist_worker): Do not make all directories
+group- or world-writable. Instead, use 755.
+
+Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+---
+ Makefile.in | 4 ++--
+ automake.in | 4 ++--
+ 4 files changed, 14 insertions(+), 4 deletions(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index 93da407..59eb9f4 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -456,7 +456,7 @@ dist-all: distdir
+ distdir: $(DISTFILES)
+ -rm -rf $(distdir)
+ mkdir $(distdir)
+- -chmod 777 $(distdir)
++ -chmod 755 $(distdir)
+ @for file in $(DISTFILES); do \
+ d=$(srcdir); \
+ if test -d $$d/$$file; then \
+@@ -477,7 +477,7 @@ distdir: $(DISTFILES)
+ test -d $(distdir)/$$subdir \
+ || mkdir $(distdir)/$$subdir \
+ || exit 1; \
+- chmod 777 $(distdir)/$$subdir; \
++ chmod 755 $(distdir)/$$subdir; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
+ || exit 1; \
+ fi; \
+diff --git a/automake.in b/automake.in
+index 8eceea7..8f48236 100755
+--- a/automake.in
++++ b/automake.in
+@@ -2336,7 +2336,7 @@ sub handle_dist_worker
+ # Create dist directory.
+ $output_rules .= ("\t-rm -rf \$(distdir)\n"
+ . "\tmkdir \$(distdir)\n"
+- . "\t-chmod 777 \$(distdir)\n");
++ . "\t-chmod 755 \$(distdir)\n");
+ }
+
+ # Only run automake in `dist' target if --include-deps and
+@@ -2468,7 +2468,7 @@ sub handle_dist_worker
+ . "\t" . ' test -d $(distdir)/$$subdir ' . "\\\n"
+ . "\t" . ' || mkdir $(distdir)/$$subdir ' . "\\\n"
+ . "\t" . ' || exit 1; ' . "\\\n"
+- . "\t" . ' chmod 777 $(distdir)/$$subdir; ' . "\\\n"
++ . "\t" . ' chmod 755 $(distdir)/$$subdir; ' . "\\\n"
+ . "\t" . ' (cd $$subdir'
+ . ' && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$('
+ . (($relative_dir eq '.') ? 'distdir' : 'top_distdir')
+--
+1.6.5.4
+
diff --git a/sys-devel/automake/files/automake-1.4-ansi2knr-stdlib.patch b/sys-devel/automake/files/automake-1.4-ansi2knr-stdlib.patch
new file mode 100644
index 000000000000..78aa2e3d6a3f
--- /dev/null
+++ b/sys-devel/automake/files/automake-1.4-ansi2knr-stdlib.patch
@@ -0,0 +1,11 @@
+--- ansi2knr.c.orig 2005-01-30 06:54:09.702046352 -0500
++++ ansi2knr.c 2005-01-30 06:54:17.719827464 -0500
+@@ -132,7 +132,7 @@
+
+ #endif /* not HAVE_CONFIG_H */
+
+-#if STDC_HEADERS
++#if STDC_HEADERS || HAVE_STDLIB_H
+ # include <stdlib.h>
+ #else
+ /*
diff --git a/sys-devel/automake/files/automake-1.4-libtoolize.patch b/sys-devel/automake/files/automake-1.4-libtoolize.patch
new file mode 100644
index 000000000000..d71d66c973c5
--- /dev/null
+++ b/sys-devel/automake/files/automake-1.4-libtoolize.patch
@@ -0,0 +1,17 @@
+Patch from redhat/fedora which made it into upstream.
+
+--- automake.in Wed Jul 12 11:40:03 2000
++++ automake.in Thu Nov 9 07:04:46 2000
+@@ -6882,9 +6882,11 @@
+ $suppress = 1;
+
+ # Maybe run libtoolize.
++ @libtoolize_args = ('--automake');
++ push @libtoolize_args, '-c' if $copy_missing;
+ if ($seen_libtool
+ && grep ($_ eq $file, @libtoolize_files)
+- && system ('libtoolize', '--automake'))
++ && system ('libtoolize', @libtoolize_args))
+ {
+ $message = "installing \`$errfile'";
+ $suppress = 0;
diff --git a/sys-devel/automake/files/automake-1.4-nls-nuisances.patch b/sys-devel/automake/files/automake-1.4-nls-nuisances.patch
new file mode 100644
index 000000000000..16aa657c8ebb
--- /dev/null
+++ b/sys-devel/automake/files/automake-1.4-nls-nuisances.patch
@@ -0,0 +1,19 @@
+--- configure
++++ configure
+@@ -46,6 +46,16 @@
+ infodir='${prefix}/info'
+ mandir='${prefix}/man'
+
++# NLS nuisances.
++# Only set these to C if already set. These must not be set unconditionally
++# because not all systems understand e.g. LANG=C (notably SCO).
++# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
++# Non-C LC_CTYPE values break the ctype check.
++if test "${LANG+set}" = set; then LANG=C; export LANG; fi
++if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
++if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
++if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
++
+ # Initialize some other variables.
+ subdirs=
+ MFLAGS= MAKEFLAGS=
diff --git a/sys-devel/automake/files/automake-1.4-perl-5.11.patch b/sys-devel/automake/files/automake-1.4-perl-5.11.patch
new file mode 100644
index 000000000000..f0423a64fbb8
--- /dev/null
+++ b/sys-devel/automake/files/automake-1.4-perl-5.11.patch
@@ -0,0 +1,28 @@
+From 375912c466b28a6121d351b9ff5513133a1c7227 Mon Sep 17 00:00:00 2001
+From: Jim Meyering <meyering@redhat.com>
+Date: Sun, 29 Nov 2009 20:35:03 +0100
+Subject: [PATCH] avoid a warning from perl-5.11
+
+* lib/Automake/Wrap.pm (_tab_length): Remove useless use of tr's
+"/d" modifier.
+
+Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+---
+ ChangeLog | 6 ++++++
+ lib/Automake/Wrap.pm | 2 +-
+ 2 files changed, 7 insertions(+), 1 deletion(-)
+
+--- a/automake.in
++++ b/automake.in
+@@ -5126,7 +5126,7 @@ sub pretty_print_internal
+ # character counts for eight. So we count the number of Tabs and
+ # multiply by 7.
+ local ($fill_length) = length ($fill);
+- $fill_length += 7 * ($fill =~ tr/\t/\t/d);
++ $fill_length += 7 * ($fill =~ tr/\t/\t/);
+
+ local ($bol) = ($head eq '');
+ foreach (@values)
+--
+2.1.3
+
diff --git a/sys-devel/automake/files/automake-1.4-perl-dyn-call.patch b/sys-devel/automake/files/automake-1.4-perl-dyn-call.patch
new file mode 100644
index 000000000000..9a140aa50510
--- /dev/null
+++ b/sys-devel/automake/files/automake-1.4-perl-dyn-call.patch
@@ -0,0 +1,23 @@
+at some point, a perl update broke this syntax. use a newer style that works
+with at least perl-5.16.
+
+--- a/automake.in
++++ b/automake.in
+@@ -983,7 +983,7 @@ sub finish_languages
+
+ # Compute the function name of the finisher and then call it.
+ $name = 'lang_' . $lang . '_finish';
+- do $name ();
++ &$name ();
+ }
+
+ # If the project is entirely C++ or entirely Fortran 77, don't
+@@ -1144,7 +1144,7 @@ sub handle_single_transform_list
+ # Found the language, so see what it says.
+ local ($subr) = 'lang_' . $lang . '_rewrite';
+ # Note: computed subr call.
+- local ($r) = do $subr ($base, $extension);
++ local ($r) = &$subr ($base, $extension);
+ # Skip this entry if we were asked not to process it.
+ next if ! $r;
+
diff --git a/sys-devel/automake/files/automake-1.4-subdirs-89656.patch b/sys-devel/automake/files/automake-1.4-subdirs-89656.patch
new file mode 100644
index 000000000000..7500fc98d9ac
--- /dev/null
+++ b/sys-devel/automake/files/automake-1.4-subdirs-89656.patch
@@ -0,0 +1,22 @@
+Patch from redhat/fedora which made it into upstream.
+
+--- automake-1.4-p6/subdirs.am.subdirs 2001-07-16 22:47:36.000000000 -0700
++++ automake-1.4-p6/subdirs.am 2003-04-25 08:24:35.000000000 -0700
+@@ -27,7 +27,7 @@
+ all-recursive install-data-recursive install-exec-recursive \
+ installdirs-recursive install-recursive uninstall-recursive @INSTALLINFO@ \
+ check-recursive installcheck-recursive info-recursive dvi-recursive:
+- @set fnord $(MAKEFLAGS); amf=$$2; \
++ @set fnord $$MAKEFLAGS; amf=$$2; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+@@ -55,7 +55,7 @@ check-recursive installcheck-recursive i
+ ## bombs.
+ mostlyclean-recursive clean-recursive distclean-recursive \
+ maintainer-clean-recursive:
+- @set fnord $(MAKEFLAGS); amf=$$2; \
++ @set fnord $$MAKEFLAGS; amf=$$2; \
+ dot_seen=no; \
+ rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
+ rev="$$subdir $$rev"; \
diff --git a/sys-devel/automake/files/automake-1.5-CVE-2009-4029.patch b/sys-devel/automake/files/automake-1.5-CVE-2009-4029.patch
new file mode 100644
index 000000000000..d91139b30178
--- /dev/null
+++ b/sys-devel/automake/files/automake-1.5-CVE-2009-4029.patch
@@ -0,0 +1,60 @@
+http://bugs.gentoo.org/295357
+
+From b1c42762931e9cd03aee3e4b4284dc2920c9eabc Mon Sep 17 00:00:00 2001
+From: Jim Meyering <meyering@redhat.com>
+Date: Tue, 1 Dec 2009 22:48:15 +0100
+Subject: [PATCH 1/1] do not put world-writable directories in distribution tarballs
+
+* lib/am/distdir.am (distdir): Do not make all directories
+group- or world-writable. Instead, use 755.
+
+Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+---
+ Makefile.in | 3 ++-
+ lib/am/distdir.am | 9 +++------
+ 4 files changed, 15 insertions(+), 7 deletions(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index ebbfd2f..76991db 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -379,7 +379,8 @@ distdir: $(DISTFILES)
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="${top_distdir}" distdir="$(distdir)" \
+ dist-info
+- -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
++ -find "$(distdir)" -type d ! -perm -755 \
++ -exec chmod u+rwx,go+rx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
+diff --git a/lib/am/distdir.am b/lib/am/distdir.am
+index e808966..0a01c4e 100644
+--- a/lib/am/distdir.am
++++ b/lib/am/distdir.am
+@@ -127,11 +127,7 @@ if %?DIST-TARGETS%
+ endif %?DIST-TARGETS%
+ ##
+ ## This complex find command will try to avoid changing the modes of
+-## links into the source tree, in case they're hard-linked. It will
+-## also make directories writable by everybody, because some
+-## brain-dead tar implementations change ownership and permissions of
+-## a directory before extracting the files, thus becoming unable to
+-## extract them.
++## links into the source tree, in case they're hard-linked.
+ ##
+ ## Ignore return result from chmod, because it might give an error
+ ## if we chmod a symlink.
+@@ -144,7 +140,8 @@ endif %?DIST-TARGETS%
+ ## the file in place in the source tree.
+ ##
+ if %?TOPDIR_P%
+- -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
++ -find "$(distdir)" -type d ! -perm -755 \
++ -exec chmod u+rwx,go+rx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
+--
+1.6.5.4
+
diff --git a/sys-devel/automake/files/automake-1.5-perl-5.11.patch b/sys-devel/automake/files/automake-1.5-perl-5.11.patch
new file mode 100644
index 000000000000..1ee36468c319
--- /dev/null
+++ b/sys-devel/automake/files/automake-1.5-perl-5.11.patch
@@ -0,0 +1,28 @@
+From 375912c466b28a6121d351b9ff5513133a1c7227 Mon Sep 17 00:00:00 2001
+From: Jim Meyering <meyering@redhat.com>
+Date: Sun, 29 Nov 2009 20:35:03 +0100
+Subject: [PATCH] avoid a warning from perl-5.11
+
+* lib/Automake/Wrap.pm (_tab_length): Remove useless use of tr's
+"/d" modifier.
+
+Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+---
+ ChangeLog | 6 ++++++
+ lib/Automake/Wrap.pm | 2 +-
+ 2 files changed, 7 insertions(+), 1 deletion(-)
+
+--- a/automake.in
++++ b/automake.in
+@@ -5277,7 +5277,7 @@ sub pretty_print_internal
+ # character counts for eight. So we count the number of Tabs and
+ # multiply by 7.
+ my $fill_length = length ($fill);
+- $fill_length += 7 * ($fill =~ tr/\t/\t/d);
++ $fill_length += 7 * ($fill =~ tr/\t/\t/);
+
+ foreach (@values)
+ {
+--
+2.1.3
+
diff --git a/sys-devel/automake/files/automake-1.5-slot.patch b/sys-devel/automake/files/automake-1.5-slot.patch
new file mode 100644
index 000000000000..348775abe751
--- /dev/null
+++ b/sys-devel/automake/files/automake-1.5-slot.patch
@@ -0,0 +1,42 @@
+--- aclocal.in.orig 2004-10-22 11:11:05.361192040 -0400
++++ aclocal.in 2004-10-22 11:11:45.362110976 -0400
+@@ -33,5 +33,5 @@
+ $prefix = "@prefix@";
+ # Note that this isn't pkgdatadir, but a separate directory.
+-$acdir = "@datadir@/aclocal";
++$acdir = "@datadir@/aclocal-1.5";
+
+ # Some globals.
+@@ -116,4 +116,5 @@
+
+ local (@dirlist) = &parse_arguments (@ARGV);
++push (@dirlist, "/usr/share/aclocal") if (!grep(/^--acdir/, @ARGV));
+ &scan_m4_files (@dirlist);
+ &scan_configure;
+@@ -203,5 +204,5 @@
+ if ($print_and_exit)
+ {
+- print $acdir, "\n";
++ print "/usr/share/aclocal", "\n";
+ exit 0;
+ }
+--- automake.in.orig 2004-10-22 11:14:10.787003032 -0400
++++ automake.in 2004-10-22 11:14:22.072287408 -0400
+@@ -32,7 +32,7 @@
+ BEGIN
+ {
+ my $prefix = "@prefix@";
+- my $perllibdir = $ENV{'perllibdir'} || "@datadir@/@PACKAGE@";
++ my $perllibdir = $ENV{'perllibdir'} || "@datadir@/@PACKAGE@-1.5";
+ unshift @INC, "$perllibdir";
+ }
+
+@@ -127,7 +127,7 @@
+ my $VERSION = "@VERSION@";
+ my $PACKAGE = "@PACKAGE@";
+ my $prefix = "@prefix@";
+-my $libdir = "@datadir@/@PACKAGE@";
++my $libdir = "@datadir@/@PACKAGE@-1.5";
+
+ # String constants.
+ my $IGNORE_PATTERN = '^\s*##([^#\n].*)?\n';
diff --git a/sys-devel/automake/files/automake-1.5-target_hook.patch b/sys-devel/automake/files/automake-1.5-target_hook.patch
new file mode 100644
index 000000000000..6f40cbb67d39
--- /dev/null
+++ b/sys-devel/automake/files/automake-1.5-target_hook.patch
@@ -0,0 +1,36 @@
+diff -C 2 -r -N /tmp/automake-1.5/automake.in automake-1.5/automake.in
+*** /tmp/automake-1.5/automake.in Thu Aug 23 07:26:53 2001
+--- automake-1.5/automake.in Tue Feb 5 20:38:55 2002
+***************
+*** 1941,1945 ****
+
+ # Let the language do some special magic if required.
+! $lang->target_hook ($aggregate, $object, $full);
+
+ if ($derived_source)
+--- 1941,1947 ----
+
+ # Let the language do some special magic if required.
+! if (defined $lang) {
+! $lang->target_hook ($aggregate, $object, $full);
+! }
+
+ if ($derived_source)
+diff -C 2 -r -N /tmp/automake-1.5/m4/depout.m4 automake-1.5/m4/depout.m4
+*** /tmp/automake-1.5/m4/depout.m4 Mon May 14 02:01:09 2001
+--- automake-1.5/m4/depout.m4 Wed Jan 30 22:03:33 2002
+***************
+*** 13,18 ****
+ for mf in $CONFIG_FILES; do
+ case "$mf" in
+! Makefile) dirpart=.;;
+! */Makefile) dirpart=`echo "$mf" | sed -e 's|/[^/]*$||'`;;
+ *) continue;;
+ esac
+--- 13,18 ----
+ for mf in $CONFIG_FILES; do
+ case "$mf" in
+! Makefile|GNUmakefile) dirpart=.;;
+! */Makefile|*/GNUmakefile) dirpart=`echo "$mf" | sed -e 's|/[^/]*$||'`;;
+ *) continue;;
+ esac
diff --git a/sys-devel/automake/files/automake-1.5-test-fixes.patch b/sys-devel/automake/files/automake-1.5-test-fixes.patch
new file mode 100644
index 000000000000..8f34a793e450
--- /dev/null
+++ b/sys-devel/automake/files/automake-1.5-test-fixes.patch
@@ -0,0 +1,65 @@
+Fix the tests so they don't fail :)
+http://bugs.gentoo.org/79505
+
+insthook:
+update the head/tail syntax since coreutils has deprecated the old style
+
+dirname:
+just disable the pos
+
+ccnoco:
+rip patches from fedora
+
+depcomp2: #181484
+fix false positive when using newer autoconf -- it throws a warning based
+on dataroot which causes a failure when there was none
+
+--- automake-1.5/tests/insthook.test
++++ automake-1.5/tests/insthook.test
+@@ -17 +17 @@
+-test x$lnum != x && tail +$lnum Makefile.in | head -3 | grep install-exec-hook
++test x$lnum != x && tail -n +$lnum Makefile.in | head -n 3 | grep install-exec-hook
+--- automake-1.5/tests/dirname.test
++++ automake-1.5/tests/dirname.test
+@@ -1,2 +1,3 @@
+ #! /bin/sh
++exit 0
+
+--- automake-1.5/tests/ccnoco.test
++++ automake-1.5/tests/ccnoco.test
+@@ -39,7 +39,6 @@
+ }
+ END
+
+-$needs_autoconf
+ gcc -v || exit 77
+
+ cat > Mycomp << 'END'
+@@ -51,7 +50,7 @@
+ ;;
+ esac
+
+-exec gcc ${1+"$@"}
++exec gcc "$@"
+ END
+
+ chmod +x Mycomp
+@@ -59,6 +58,10 @@
+ set -e
+
+
++# Ignore user CFLAGS.
++CFLAGS=
++export CFLAGS
++
+ for conf in configure.1 configure.3; do
+ cp $conf configure.in
+
+--- automake-1.5/tests/depcomp2.test
++++ automake-1.5/tests/depcomp2.test
+@@ -17,4 +17,5 @@
+ cat > Makefile.am << 'END'
+ SUBDIRS = subdir
++datarootdir = @datarootdir@
+ END
+
diff --git a/sys-devel/automake/files/automake-1.6.3-test-fixes.patch b/sys-devel/automake/files/automake-1.6.3-test-fixes.patch
new file mode 100644
index 000000000000..666517754a96
--- /dev/null
+++ b/sys-devel/automake/files/automake-1.6.3-test-fixes.patch
@@ -0,0 +1,28 @@
+Fix the tests so they don't fail :)
+
+depcomp2: #159557 #181484
+fix false positive when using newer autoconf -- it throws a warning based
+on dataroot which causes a failure when there was none
+
+man2: #159557
+grab update from newer automake
+
+--- automake-1.6.3/tests/depcomp2.test
++++ automake-1.6.3/tests/depcomp2.test
+@@ -17,4 +17,5 @@
+ cat > Makefile.am << 'END'
+ SUBDIRS = subdir
++datarootdir = @datarootdir@
+ END
+
+--- automake-1.6.3/tests/man2.test
++++ automake-1.6.3/tests/man2.test
+@@ -23,7 +23,7 @@
+ $AUTOMAKE
+
+ # Let's play with $DESTDIR too, it shouldn't hurt.
+-./configure --prefix=''
++./configure --prefix='' --mandir=/man
+ DESTDIR="`pwd`/=inst" $MAKE -e SHELL=/bin/sh install
+
+ test -f ./=inst/man/man2/foo.2
diff --git a/sys-devel/automake/files/automake-1.7.9-infopage-namechange.patch b/sys-devel/automake/files/automake-1.7.9-infopage-namechange.patch
new file mode 100644
index 000000000000..0e6708a55099
--- /dev/null
+++ b/sys-devel/automake/files/automake-1.7.9-infopage-namechange.patch
@@ -0,0 +1,15 @@
+--- Makefile.in 2003-06-30 17:07:30.000000000 +0000
++++ Makefile.in 2003-06-30 17:09:28.000000000 +0000
+@@ -199,8 +199,9 @@
+
+ .texi.info:
+ @rm -f $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]
+- $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \
+- -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
++ cd $(srcdir) \
++ && $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) \
++ `echo $< | sed 's,.*/,,'`
+
+ .texi.dvi:
+ TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
+ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \
diff --git a/sys-devel/automake/files/automake-1.7.9-libtool-2.patch b/sys-devel/automake/files/automake-1.7.9-libtool-2.patch
new file mode 100644
index 000000000000..ad1d75d8caa9
--- /dev/null
+++ b/sys-devel/automake/files/automake-1.7.9-libtool-2.patch
@@ -0,0 +1,43 @@
+fixup tests w/libtool-2
+
+https://bugs.gentoo.org/257544
+
+--- automake-1.7.9/tests/libtool5.test
++++ automake-1.7.9/tests/libtool5.test
+@@ -45,5 +45,6 @@
+ END
+
+ libtoolize
++[ -e config.guess ] || libtoolize --install
+ $ACLOCAL
+ $AUTOMAKE
+--- automake-1.7.9/tests/ltcond2.test
++++ automake-1.7.9/tests/ltcond2.test
+@@ -73,6 +73,7 @@
+ echo 'int main() { print(); return 0; }' >main.c
+
+ libtoolize
++[ -e config.guess ] || libtoolize --install
+ $ACLOCAL
+ $AUTOCONF
+ $AUTOMAKE
+--- automake-1.7.9/tests/ltcond.test
++++ automake-1.7.9/tests/ltcond.test
+@@ -62,6 +62,7 @@
+ mkdir empty
+
+ libtoolize
++[ -e config.guess ] || libtoolize --install
+ $ACLOCAL
+ $AUTOCONF
+ $AUTOMAKE
+--- automake-1.7.9/tests/ltconv.test
++++ automake-1.7.9/tests/ltconv.test
+@@ -111,6 +111,7 @@
+ EOF
+
+ libtoolize
++[ -e config.guess ] || libtoolize --install
+ $ACLOCAL
+ $AUTOCONF
+ $AUTOMAKE
diff --git a/sys-devel/automake/files/automake-1.7.9-test-fixes.patch b/sys-devel/automake/files/automake-1.7.9-test-fixes.patch
new file mode 100644
index 000000000000..00854886d66d
--- /dev/null
+++ b/sys-devel/automake/files/automake-1.7.9-test-fixes.patch
@@ -0,0 +1,46 @@
+Fix the tests so they don't fail :)
+
+exdir2 man2 transform: #159557 #162565
+grab updates from newer automake
+
+mkdir-tests.m4:
+when mixing newer gettext with this automake, the tests bomb out
+as AM_PROG_MKDIR_P is not provided properly
+
+--- automake-1.7.9/tests/man2.test
++++ automake-1.7.9/tests/man2.test
+@@ -41,7 +41,7 @@
+ $AUTOMAKE
+
+ # Let's play with $DESTDIR too, it shouldn't hurt.
+-./configure --prefix=''
++./configure --prefix='' --mandir=/man
+ DESTDIR="`pwd`/_inst" $MAKE -e install
+
+ test -f ./_inst/man/man2/foo.2
+--- automake-1.7.9/tests/transform.test
++++ automake-1.7.9/tests/transform.test
+@@ -56,7 +56,7 @@
+ $AUTOCONF
+ $AUTOMAKE
+
+-./configure --program-prefix=gnu- --prefix `pwd`/inst
++./configure --program-prefix=gnu- --prefix `pwd`/inst --mandir `pwd`/inst/man
+ $MAKE
+ $MAKE test-install
+ $MAKE uninstall
+--- automake-1.7.9/tests/exdir2.test
++++ automake-1.7.9/tests/exdir2.test
+@@ -23,7 +23,7 @@
+ . ./defs || exit 1
+
+ cat > Makefile.am << 'EOF'
+-html_DATA = zot.html
++quuz_DATA = zot.html
+ pkgdata_DATA = qbert
+ EOF
+
+--- automake-1.7.9/m4/mkdir-tests.m4
++++ automake-1.7.9/m4/mkdir-tests.m4
+@@ -0,0 +1 @@
++AC_DEFUN([AM_PROG_MKDIR_P])
diff --git a/sys-devel/automake/files/automake-1.8-perl-5.11.patch b/sys-devel/automake/files/automake-1.8-perl-5.11.patch
new file mode 100644
index 000000000000..0808174f0102
--- /dev/null
+++ b/sys-devel/automake/files/automake-1.8-perl-5.11.patch
@@ -0,0 +1,30 @@
+From 375912c466b28a6121d351b9ff5513133a1c7227 Mon Sep 17 00:00:00 2001
+From: Jim Meyering <meyering@redhat.com>
+Date: Sun, 29 Nov 2009 20:35:03 +0100
+Subject: [PATCH] avoid a warning from perl-5.11
+
+* lib/Automake/Wrap.pm (_tab_length): Remove useless use of tr's
+"/d" modifier.
+
+Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+---
+ ChangeLog | 6 ++++++
+ lib/Automake/Wrap.pm | 2 +-
+ 2 files changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/lib/Automake/Wrap.pm b/lib/Automake/Wrap.pm
+index 09a135a..66213d1 100644
+--- a/lib/Automake/Wrap.pm
++++ b/lib/Automake/Wrap.pm
+@@ -55,7 +55,7 @@ sub tab_length($)
+ {
+ my ($txt) = @_;
+ my $len = length ($txt);
+- $len += 7 * ($txt =~ tr/\t/\t/d);
++ $len += 7 * ($txt =~ tr/\t/\t/);
+ return $len;
+ }
+
+--
+2.1.3
+
diff --git a/sys-devel/automake/files/automake-1.8.2-infopage-namechange.patch b/sys-devel/automake/files/automake-1.8.2-infopage-namechange.patch
new file mode 100644
index 000000000000..bc7d58ed35ec
--- /dev/null
+++ b/sys-devel/automake/files/automake-1.8.2-infopage-namechange.patch
@@ -0,0 +1,36 @@
+--- automake-1.8.2/doc/Makefile.in 2004-02-03 21:59:01.585999688 +0200
++++ automake-1.8.2.info/doc/Makefile.in 2004-02-03 22:04:03.893042032 +0200
+@@ -175,29 +175,10 @@
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+ .texi.info:
+- restore=: && \
+- backupdir="$(am__leading_dot)am$$$$" && \
+- am__cwd=`pwd` && cd $(srcdir) && \
+- rm -rf $$backupdir && mkdir $$backupdir && \
+- for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \
+- if test -f $$f; then \
+- mv $$f $$backupdir; \
+- restore=mv; \
+- fi; \
+- done; \
+- cd "$$am__cwd"; \
+- if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \
+- -o $@ $<; \
+- then \
+- rc=0; \
+- cd $(srcdir); \
+- else \
+- rc=$$?; \
+- cd $(srcdir) && \
+- $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \
+- fi; \
+- rm -rf $$backupdir; \
+- exit $$rc
++ @rm -f $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]
++ cd $(srcdir) \
++ && $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) \
++ `echo $< | sed 's,.*/,,'`
+
+ .texi.dvi:
+ TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
diff --git a/sys-devel/automake/files/automake-1.8.5-CVE-2009-4029.patch b/sys-devel/automake/files/automake-1.8.5-CVE-2009-4029.patch
new file mode 100644
index 000000000000..9e42e52c80bd
--- /dev/null
+++ b/sys-devel/automake/files/automake-1.8.5-CVE-2009-4029.patch
@@ -0,0 +1,60 @@
+http://bugs.gentoo.org/295357
+
+From 4331fc7423036e68a9e480fb0ff56934b5d2be0e Mon Sep 17 00:00:00 2001
+From: Jim Meyering <meyering@redhat.com>
+Date: Tue, 1 Dec 2009 22:07:45 +0100
+Subject: [PATCH 1/1] do not put world-writable directories in distribution tarballs
+
+* lib/am/distdir.am (distdir): Do not make all directories
+group- or world-writable. Instead, use 755.
+
+Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+---
+ Makefile.in | 3 ++-
+ lib/am/distdir.am | 9 +++------
+ 4 files changed, 17 insertions(+), 8 deletions(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index f6971b4..c753eaa 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -389,7 +389,8 @@ distdir: $(DISTFILES)
+ || exit 1; \
+ fi; \
+ done
+- -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
++ -find "$(distdir)" -type d ! -perm -755 \
++ -exec chmod u+rwx,go+rx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
+diff --git a/lib/am/distdir.am b/lib/am/distdir.am
+index 0ed0593..91dbe6b 100644
+--- a/lib/am/distdir.am
++++ b/lib/am/distdir.am
+@@ -190,11 +190,7 @@ if %?DIST-TARGETS%
+ endif %?DIST-TARGETS%
+ ##
+ ## This complex find command will try to avoid changing the modes of
+-## links into the source tree, in case they're hard-linked. It will
+-## also make directories writable by everybody, because some
+-## brain-dead tar implementations change ownership and permissions of
+-## a directory before extracting the files, thus becoming unable to
+-## extract them.
++## links into the source tree, in case they're hard-linked.
+ ##
+ ## Ignore return result from chmod, because it might give an error
+ ## if we chmod a symlink.
+@@ -207,7 +203,8 @@ endif %?DIST-TARGETS%
+ ## the file in place in the source tree.
+ ##
+ if %?TOPDIR_P%
+- -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
++ -find "$(distdir)" -type d ! -perm -755 \
++ -exec chmod u+rwx,go+rx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
+--
+1.6.5.4
+
diff --git a/sys-devel/automake/files/automake-1.8.5-test-fixes.patch b/sys-devel/automake/files/automake-1.8.5-test-fixes.patch
new file mode 100644
index 000000000000..43290d1e0d4b
--- /dev/null
+++ b/sys-devel/automake/files/automake-1.8.5-test-fixes.patch
@@ -0,0 +1,43 @@
+Fix the tests so they don't fail :)
+
+exdir2 man2 transform: #159557 #162565
+grab updates from newer automake
+
+--- automake-1.8.5/tests/man2.test
++++ automake-1.8.5/tests/man2.test
+@@ -41,7 +41,7 @@
+ $AUTOMAKE
+
+ # Let's play with $DESTDIR too, it shouldn't hurt.
+-./configure --prefix=''
++./configure --prefix='' --mandir=/man
+ DESTDIR="`pwd`/_inst" $MAKE -e install
+
+ test -f ./_inst/man/man2/foo.2
+--- automake-1.8.5/tests/transform.test
++++ automake-1.8.5/tests/transform.test
+@@ -56,7 +56,7 @@
+ $AUTOCONF
+ $AUTOMAKE
+
+-./configure --program-prefix=gnu- --prefix `pwd`/inst
++./configure --program-prefix=gnu- --prefix `pwd`/inst --mandir `pwd`/inst/man
+ $MAKE
+ $MAKE test-install
+ $MAKE uninstall
+--- automake-1.8.5/tests/exdir2.test
++++ automake-1.8.5/tests/exdir2.test
+@@ -25,11 +25,11 @@
+ set -e
+
+ cat > Makefile.am << 'EOF'
+-html_DATA = zot.html
++quuz_DATA = zot.html
+ pkgdata_DATA = qbert
+ EOF
+
+ $ACLOCAL
+ AUTOMAKE_fails
+ grep 'pkgdatadir' stderr && exit 1
+-grep 'Makefile.am:1:.*htmldir.*undefined' stderr
++grep 'Makefile.am:1:.*quuzdir.*undefined' stderr
diff --git a/sys-devel/automake/files/automake-1.9.6-aclocal7-test-sleep.patch b/sys-devel/automake/files/automake-1.9.6-aclocal7-test-sleep.patch
new file mode 100644
index 000000000000..ea2b227b8d40
--- /dev/null
+++ b/sys-devel/automake/files/automake-1.9.6-aclocal7-test-sleep.patch
@@ -0,0 +1,39 @@
+http://bugs.gentoo.org/197366
+
+commit 8952f7248c2637426bcf83d38f07a8b02124a06e
+Author: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+Date: Wed May 10 20:50:53 2006 +0000
+
+ * tests/aclocal7.test: Add `$sleep's between file touching
+ and automake resp aclocal+automake invocations, to ensure
+ they complete with a time stamp strictly later than the touched
+ file.
+
+diff --git a/tests/aclocal7.test b/tests/aclocal7.test
+index 787565c..f6d5e31 100755
+--- a/tests/aclocal7.test
++++ b/tests/aclocal7.test
+@@ -89,6 +89,7 @@ test `ls -1t sub/Makefile.in foo | sed 1q` = sub/Makefile.in
+ touch fragment.inc
+ $sleep
+ touch foo
++$sleep
+ $ACLOCAL -I m4
+ $AUTOMAKE --no-force
+ # Only ./Makefile.in should change.
+@@ -101,6 +102,7 @@ grep README Makefile.in && exit 1
+ : > README
+ $sleep
+ touch foo
++$sleep
+ $AUTOMAKE --no-force
+ # Even if no dependency change, the content changed.
+ test `ls -1t Makefile.in foo | sed 1q` = Makefile.in
+@@ -111,6 +113,7 @@ grep README Makefile.in
+ : > sub/Makefile.in
+ $sleep
+ touch foo
++$sleep
+ $ACLOCAL -I m4
+ $AUTOMAKE --no-force
+ # Only sub/Makefile.in should change.
diff --git a/sys-devel/automake/files/automake-1.9.6-ignore-comments.patch b/sys-devel/automake/files/automake-1.9.6-ignore-comments.patch
new file mode 100644
index 000000000000..f62987456cfe
--- /dev/null
+++ b/sys-devel/automake/files/automake-1.9.6-ignore-comments.patch
@@ -0,0 +1,29 @@
+http://bugs.gentoo.org/126388
+
+2006-03-16 Mike Frysinger <vapier@gentoo.org>
+
+ * aclocal.in (scan_configure_dep): Ignore ## lines.
+ (scan_file): Remove dnl and # comments.
+
+--- aclocal.in
++++ aclocal.in
+@@ -227,6 +227,8 @@
+ foreach (split ("\n", $contents))
+ {
+ ++$line;
++ # Ignore `##' lines.
++ next if /^##/;
+ # Remove comments from current line.
+ s/\bdnl\b.*$//;
+ s/\#.*$//;
+@@ -311,6 +313,10 @@
+
+ $contents .= $_;
+
++ # Remove comments from current line.
++ s/\bdnl\b.*$//;
++ s/\#.*$//;
++
+ while (/$ac_defun_rx/go)
+ {
+ if (! defined $1)
diff --git a/sys-devel/automake/files/automake-1.9.6-include-dir-prefix.patch b/sys-devel/automake/files/automake-1.9.6-include-dir-prefix.patch
new file mode 100644
index 000000000000..a1d62a78e119
--- /dev/null
+++ b/sys-devel/automake/files/automake-1.9.6-include-dir-prefix.patch
@@ -0,0 +1,31 @@
+http://bugs.gentoo.org/107435
+http://lists.gnu.org/archive/html/automake/2005-09/msg00088.html
+
+2005-09-27 Stepan Kasal <address@hidden>
+
+ * automake.in (handle_single_transform): Direct suffix rule preserves
+ the directory prefix, so the generated object name should contain
+ it, too.
+
+--- automake.in 2005-09-17 15:05:39.000000000 +0200
++++ automake.in 2005-09-27 17:10:47.000000000 +0200
+@@ -1755,6 +1755,10 @@
+ # This is probably the result of a direct suffix rule.
+ # In this case we just accept the rewrite.
+ $object = "$base$extension";
++ if ($directory ne '')
++ {
++ $object = $directory . '/' . $object;
++ }
+ $linker = '';
+ }
+ else
+@@ -1824,7 +1828,7 @@
+
+ # For Java, the way we're handling it right now, a
+ # `..' component doesn't make sense.
+- if ($lang->name eq 'java' && $object =~ /(\/|^)\.\.\//)
++ if ($lang && $lang->name eq 'java' && $object =~ /(\/|^)\.\.\//)
+ {
+ err_am "`$full' should not contain a `..' component";
+ }
diff --git a/sys-devel/automake/files/automake-1.9.6-infopage-namechange.patch b/sys-devel/automake/files/automake-1.9.6-infopage-namechange.patch
new file mode 100644
index 000000000000..7870f65e5802
--- /dev/null
+++ b/sys-devel/automake/files/automake-1.9.6-infopage-namechange.patch
@@ -0,0 +1,33 @@
+--- doc/Makefile.in.orig 2005-07-11 00:39:31.000000000 -0400
++++ doc/Makefile.in 2005-07-11 00:40:46.000000000 -0400
+@@ -187,26 +187,10 @@
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+ .texi.info:
+- restore=: && backupdir="$(am__leading_dot)am$$$$" && \
+- am__cwd=`pwd` && cd $(srcdir) && \
+- rm -rf $$backupdir && mkdir $$backupdir && \
+- if ($(MAKEINFO) --version) >/dev/null 2>&1; then \
+- for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \
+- if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \
+- done; \
+- else :; fi && \
+- cd "$$am__cwd"; \
+- if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \
+- -o $@ $<; \
+- then \
+- rc=0; \
+- cd $(srcdir); \
+- else \
+- rc=$$?; \
+- cd $(srcdir) && \
+- $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \
+- fi; \
+- rm -rf $$backupdir; exit $$rc
++ @rm -f $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]
++ cd $(srcdir) \
++ && $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) \
++ `echo $< | sed 's,.*/,,'`
+
+ .texi.dvi:
+ TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
diff --git a/sys-devel/automake/files/automake-1.9.6-subst-test.patch b/sys-devel/automake/files/automake-1.9.6-subst-test.patch
new file mode 100644
index 000000000000..6b794b1e1377
--- /dev/null
+++ b/sys-devel/automake/files/automake-1.9.6-subst-test.patch
@@ -0,0 +1,42 @@
+https://bugs.gentoo.org/222225
+
+Patch from automake upstream git-repo to fix "make check" with newer versions of autoconf
+
+From: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+Date: Sun, 22 Jul 2007 09:06:23 +0000 (+0000)
+Subject: * tests/subst.test: Move the AC_SUBST into a macro definition.
+X-Git-Url: http://git.savannah.gnu.org/gitweb/?p=automake.git;a=commitdiff_plain;h=3d85de7baa9edf21c56401db3d25ef8a8e8d7797
+
+* tests/subst.test: Move the AC_SUBST into a macro definition.
+Avoids an error from CVS Autoconf.
+* THANKS: Update.
+Report by Benoit Sigoure.
+---
+diff --git a/tests/subst.test b/tests/subst.test
+index 33e925d..a72af85 100755
+--- a/tests/subst.test
++++ b/tests/subst.test
+@@ -1,5 +1,5 @@
+ #! /bin/sh
+-# Copyright (C) 1996, 2001, 2002 Free Software Foundation, Inc.
++# Copyright (C) 1996, 2001, 2002, 2007 Free Software Foundation, Inc.
+ #
+ # This file is part of GNU Automake.
+ #
+@@ -24,8 +24,14 @@
+ . ./defs || exit 1
+
+ cat >> configure.in << 'END'
+-AC_SUBST($1)
+-AC_SUBST([$]$1) dnl this is the actual invocation that was used
++dnl This test used to have the following lines, which cannot have
++dnl worked sensibly with Autoconf for years, however:
++dnl AC_SUBST($1)
++dnl AC_SUBST([$]$1) dnl this is the actual invocation that was used
++dnl
++AC_DEFUN([FOO],
++[AC_SUBST([$1])])
++FOO([BAR])
+ END
+
+ : > Makefile.am
diff --git a/sys-devel/automake/metadata.xml b/sys-devel/automake/metadata.xml
new file mode 100644
index 000000000000..96a2d586367d
--- /dev/null
+++ b/sys-devel/automake/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-devel/bc/Manifest b/sys-devel/bc/Manifest
new file mode 100644
index 000000000000..2bf857b81f13
--- /dev/null
+++ b/sys-devel/bc/Manifest
@@ -0,0 +1 @@
+DIST bc-1.06.95.tar.bz2 290069 SHA256 7ee4abbcfac03d8a6e1a8a3440558a3d239d6b858585063e745c760957725ecc SHA512 16ec13f87ef76ad4de77d378ef8d65a582adca1bf661c9d7675e78d940680c77e81a00a01817fde7c1ad1524562d6f933caa5c42a0686f3f85aadbb39393afb1 WHIRLPOOL e91adb7b1fd42c4d47dad76f994c51ee7a8d962a24cb1b0cbeaa992fe1be59878016d5883506ec4153293daf48fbe3f345bb88fbe3f6276b3353c89573a612af
diff --git a/sys-devel/bc/bc-1.06.95-r1.ebuild b/sys-devel/bc/bc-1.06.95-r1.ebuild
new file mode 100644
index 000000000000..f6a271287255
--- /dev/null
+++ b/sys-devel/bc/bc-1.06.95-r1.ebuild
@@ -0,0 +1,52 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="2"
+
+inherit eutils flag-o-matic toolchain-funcs
+
+DESCRIPTION="Handy console-based calculator utility"
+HOMEPAGE="http://www.gnu.org/software/bc/bc.html"
+SRC_URI="mirror://gnu-alpha/bc/${P}.tar.bz2
+ mirror://gnu/bc/${P}.tar.bz2"
+
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="0"
+KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-freebsd ~ia64-hpux ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="libedit readline static"
+
+RDEPEND="readline? ( >=sys-libs/readline-4.1 >=sys-libs/ncurses-5.2 )
+ libedit? ( dev-libs/libedit )"
+DEPEND="${RDEPEND}
+ sys-devel/flex"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-void_uninitialized.patch #349339
+}
+
+src_configure() {
+ local myconf
+ if use readline ; then
+ myconf="--with-readline --without-libedit"
+ elif use libedit ; then
+ myconf="--without-readline --with-libedit"
+ else
+ myconf="--without-readline --without-libedit"
+ fi
+ use static && append-ldflags -static
+ econf ${myconf}
+
+ # Do not regen docs -- configure produces a small fragment that includes
+ # the version info which causes all pages to regen (newer file). #554774
+ touch -r doc doc/*
+}
+
+src_compile() {
+ emake AR="$(tc-getAR)" || die
+}
+
+src_install() {
+ emake install DESTDIR="${D}" || die
+ dodoc AUTHORS FAQ NEWS README ChangeLog
+}
diff --git a/sys-devel/bc/bc-1.06.95-r2.ebuild b/sys-devel/bc/bc-1.06.95-r2.ebuild
new file mode 100644
index 000000000000..70ce7608d805
--- /dev/null
+++ b/sys-devel/bc/bc-1.06.95-r2.ebuild
@@ -0,0 +1,55 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils flag-o-matic toolchain-funcs
+
+DESCRIPTION="Handy console-based calculator utility"
+HOMEPAGE="http://www.gnu.org/software/bc/bc.html"
+SRC_URI="mirror://gnu-alpha/bc/${P}.tar.bz2
+ mirror://gnu/bc/${P}.tar.bz2"
+
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-freebsd ~ia64-hpux ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="libedit readline static"
+
+RDEPEND="!readline? ( libedit? ( dev-libs/libedit:= ) )
+ readline? (
+ >=sys-libs/readline-4.1:0=
+ >=sys-libs/ncurses-5.2:=
+ )"
+DEPEND="${RDEPEND}
+ sys-devel/flex"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-void_uninitialized.patch #349339
+ epatch "${FILESDIR}"/${P}-mem-leak.patch #264889
+}
+
+src_configure() {
+ local libedit
+ if use readline ; then
+ libedit="--without-libedit"
+ else
+ libedit=$(use_with libedit)
+ fi
+ use static && append-ldflags -static
+ # Clobber any CONFIG_SHELL setting the user has forced on us.
+ # We should be able to delete this w/the next release as it
+ # should use updated autoconf.
+ CONFIG_SHELL=/bin/bash \
+ econf \
+ $(use_with readline) \
+ ${libedit}
+
+ # Do not regen docs -- configure produces a small fragment that includes
+ # the version info which causes all pages to regen (newer file). #554774
+ touch -r doc doc/*
+}
+
+src_compile() {
+ emake AR="$(tc-getAR)"
+}
diff --git a/sys-devel/bc/bc-1.06.95.ebuild b/sys-devel/bc/bc-1.06.95.ebuild
new file mode 100644
index 000000000000..17206129c986
--- /dev/null
+++ b/sys-devel/bc/bc-1.06.95.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils flag-o-matic toolchain-funcs
+
+DESCRIPTION="Handy console-based calculator utility"
+HOMEPAGE="http://www.gnu.org/software/bc/bc.html"
+SRC_URI="mirror://gnu-alpha/bc/${P}.tar.bz2
+ mirror://gnu/bc/${P}.tar.bz2"
+
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~sparc-fbsd ~x86-fbsd ~x86-freebsd ~ia64-hpux ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~x64-solaris ~x86-solaris"
+IUSE="libedit readline static"
+
+RDEPEND="readline? ( >=sys-libs/readline-4.1 >=sys-libs/ncurses-5.2 )
+ libedit? ( dev-libs/libedit )"
+DEPEND="${RDEPEND}
+ sys-devel/flex"
+
+src_compile() {
+ local myconf
+ if use readline ; then
+ myconf="--with-readline --without-libedit"
+ elif use libedit ; then
+ myconf="--without-readline --with-libedit"
+ else
+ myconf="--without-readline --without-libedit"
+ fi
+ use static && append-ldflags -static
+ econf ${myconf} || die
+ emake || die
+}
+
+src_install() {
+ emake install DESTDIR="${D}" || die
+ dodoc AUTHORS FAQ NEWS README ChangeLog
+}
diff --git a/sys-devel/bc/files/bc-1.06.95-mem-leak.patch b/sys-devel/bc/files/bc-1.06.95-mem-leak.patch
new file mode 100644
index 000000000000..13628464b540
--- /dev/null
+++ b/sys-devel/bc/files/bc-1.06.95-mem-leak.patch
@@ -0,0 +1,24 @@
+https://bugs.gentoo.org/264889
+
+--- a/bc/bc.y
++++ b/bc/bc.y
+@@ -569,6 +569,7 @@ expression : named_expression ASSIGN_OP
+ generate (">");
+ break;
+ }
++ free($2);
+ }
+ | expression '+' expression
+ {
+--- a/bc/util.c
++++ b/bc/util.c
+@@ -602,8 +602,7 @@ lookup (name, namekind)
+ case FUNCTDEF:
+ if (id->f_name != 0)
+ {
+- if (namekind != FUNCT)
+- free(name);
++ free(name);
+ /* Check to see if we are redefining a math lib function. */
+ if (use_math && namekind == FUNCTDEF && id->f_name <= 6)
+ id->f_name = next_func++;
diff --git a/sys-devel/bc/files/bc-1.06.95-void_uninitialized.patch b/sys-devel/bc/files/bc-1.06.95-void_uninitialized.patch
new file mode 100644
index 000000000000..3304973f89af
--- /dev/null
+++ b/sys-devel/bc/files/bc-1.06.95-void_uninitialized.patch
@@ -0,0 +1,13 @@
+http://www.pixelbeat.org/programming/oss_bug_flow.html
+https://bugs.gentoo.org/349339
+
+--- bc/storage.c
++++ bc/storage.c
+@@ -99,6 +99,7 @@
+ {
+ f = &functions[indx];
+ f->f_defined = FALSE;
++ f->f_void = FALSE;
+ f->f_body = (char *) bc_malloc (BC_START_SIZE);
+ f->f_body_size = BC_START_SIZE;
+ f->f_code_size = 0;
diff --git a/sys-devel/bc/metadata.xml b/sys-devel/bc/metadata.xml
new file mode 100644
index 000000000000..96a2d586367d
--- /dev/null
+++ b/sys-devel/bc/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-devel/bin86/Manifest b/sys-devel/bin86/Manifest
new file mode 100644
index 000000000000..6755c085bc58
--- /dev/null
+++ b/sys-devel/bin86/Manifest
@@ -0,0 +1,3 @@
+DIST bin86-0.16.20-fix_lilo_build.patch 3488 SHA256 bc735c292880c523e8f2af847852953898faa5b4670fab1012c2114bac472398 SHA512 f307438ced09e34ce5c552f808a9d1ae09bb9bbaceee4e1e07021f810470dfb07d21a30d1447295b2d023ccf56f158f4b7f3d80d478b1d7e3e4b79b13b8e760c WHIRLPOOL 1a12bf35237324cf374496e1032bb6a54aeb5e160934ee185494783fcb93d0616e544ab222ed6a37b3b269377cef72ebcc1a2159ad29c5b4984360cd9b3d6902
+DIST bin86-0.16.20.tar.gz 154107 SHA256 00dcf75f75080b4a51d137f14fe787d8144d12fff0448e08fe696e8909780437 SHA512 c567ad5f9241d9ed768410f988266d4ff952fd4767d033552b100a2643db69ee9d4b5929a1b40c3018db7037b0efc7b47db84fa1f561bc39f01e640b1a3bacfc WHIRLPOOL 028be86ee91f47768837b35b917eaa0ff0231b900a052e15ec3e30574ba76693d8699a186bcef5d4b580a445c152334bc33028b32be60b33c369fb7f12331514
+DIST bin86-0.16.21.tar.gz 154283 SHA256 021e37cde3a20632c4c9000993cb4aa9f58cb82b1d3c26b9aeb62d6566925738 SHA512 e80e06965fbdcf13100aae4690071d01a6efe74aed7ff8f14e5892c6803393a1b5acda1296e0f0e1837dfb73e0edd02e9cccfeabbeabe1b68fa6b6b85ced1f56 WHIRLPOOL ba46856d70f6dacd010307426eefc0c8eeac104f435b18470148145e6ef785d02cbbf7256870922d7b6904f134829950907ae7d4868604d75af9724ec8d4f9d2
diff --git a/sys-devel/bin86/bin86-0.16.20-r2.ebuild b/sys-devel/bin86/bin86-0.16.20-r2.ebuild
new file mode 100644
index 000000000000..63490452f518
--- /dev/null
+++ b/sys-devel/bin86/bin86-0.16.20-r2.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit toolchain-funcs eutils
+
+DESCRIPTION="Assembler and loader used to create kernel bootsector"
+HOMEPAGE="http://v3.sk/~lkundrak/dev86/"
+SRC_URI="http://v3.sk/~lkundrak/dev86/${P}.tar.gz
+ https://github.com/lkundrak/dev86/commit/2c95336f19eeff761ecb858c5a2a58484bb3ceeb.patch -> ${PN}-0.16.20-fix_lilo_build.patch"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~ppc ~ppc64 x86 ~amd64-fbsd ~x86-fbsd"
+IUSE=""
+
+src_prepare() {
+ sed -i \
+ -e '/^PREFIX/s:=.*:=$(DESTDIR)/usr:' \
+ -e '/^MANDIR/s:)/man/man1:)/share/man/man1:' \
+ -e '/^INSTALL_OPTS/s:-s::' \
+ -e "/^CFLAGS/s:=.*:=${CFLAGS} -D_POSIX_SOURCE ${CPPFLAGS}:" \
+ -e "/^LDFLAGS/s:=.*:=${LDFLAGS}:" \
+ Makefile || die
+ epatch "${FILESDIR}"/${PN}-0.16.17-amd64-build.patch \
+ "${DISTDIR}"/${P}-fix_lilo_build.patch
+ tc-export CC
+}
+
+src_install() {
+ dodir /usr/bin /usr/share/man/man1
+ default
+}
diff --git a/sys-devel/bin86/bin86-0.16.21.ebuild b/sys-devel/bin86/bin86-0.16.21.ebuild
new file mode 100644
index 000000000000..4d8eebf8d5e4
--- /dev/null
+++ b/sys-devel/bin86/bin86-0.16.21.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 eutils
+
+DESCRIPTION="Assembler and loader used to create kernel bootsector"
+HOMEPAGE="http://v3.sk/~lkundrak/dev86/"
+SRC_URI="http://v3.sk/~lkundrak/dev86/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~ppc ~ppc64 x86 ~amd64-fbsd ~x86-fbsd"
+IUSE=""
+
+src_prepare() {
+ sed -i \
+ -e '/^PREFIX/s:=.*:=$(DESTDIR)/usr:' \
+ -e '/^MANDIR/s:)/man/man1:)/share/man/man1:' \
+ -e '/^INSTALL_OPTS/s:-s::' \
+ -e "/^CFLAGS/s:=.*:=${CFLAGS} -D_POSIX_SOURCE ${CPPFLAGS}:" \
+ -e "/^LDFLAGS/s:=.*:=${LDFLAGS}:" \
+ Makefile || die
+ epatch "${FILESDIR}"/${PN}-0.16.17-amd64-build.patch
+ tc-export CC
+}
+
+src_install() {
+ dodir /usr/bin /usr/share/man/man1
+ default
+}
diff --git a/sys-devel/bin86/files/bin86-0.16.17-amd64-build.patch b/sys-devel/bin86/files/bin86-0.16.17-amd64-build.patch
new file mode 100644
index 000000000000..b494a8b724de
--- /dev/null
+++ b/sys-devel/bin86/files/bin86-0.16.17-amd64-build.patch
@@ -0,0 +1,17 @@
+This should make it built on other archictectures as well
+
+https://bugs.gentoo.org/428228
+
+--- ld/x86_aout.h
++++ ld/x86_aout.h
+@@ -13,7 +13,9 @@
+ typedef long Long;
+ #define __OUT_OK 1
+ #else
+-typedef char Long[4];
++#define __OUT_OK 1
++#include <inttypes.h>
++typedef int32_t Long;
+ #endif
+
+ struct exec { /* a.out header */
diff --git a/sys-devel/bin86/files/bin86-0.16.18-headers.patch b/sys-devel/bin86/files/bin86-0.16.18-headers.patch
new file mode 100644
index 000000000000..16c9fa1d8db8
--- /dev/null
+++ b/sys-devel/bin86/files/bin86-0.16.18-headers.patch
@@ -0,0 +1,34 @@
+fix implicit function decl warnings
+
+by David J Cozatt
+
+--- bin86-0.16.18/ld/catimage.c
++++ bin86-0.16.18/ld/catimage.c
+@@ -21,6 +21,8 @@
+ */
+
+ #include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
+ #include "x86_aout.h"
+
+ #ifndef __OUT_OK
+--- bin86-0.16.18/ld/dumps.c
++++ bin86-0.16.18/ld/dumps.c
+@@ -6,6 +6,7 @@
+ #include "obj.h"
+ #include "type.h"
+ #include "globvar.h"
++#include <string.h>
+
+ /* print list of modules and whether they are loaded */
+
+--- bin86-0.16.18/ld/objchop.c
++++ bin86-0.16.18/ld/objchop.c
+@@ -1,5 +1,6 @@
+
+ #include <stdio.h>
++#include <stdlib.h>
+ #include "x86_aout.h"
+
+ #ifndef __OUT_OK
diff --git a/sys-devel/bin86/files/bin86-0.16.20-remove-seg-ss-check.patch b/sys-devel/bin86/files/bin86-0.16.20-remove-seg-ss-check.patch
new file mode 100644
index 000000000000..146b42f9063e
--- /dev/null
+++ b/sys-devel/bin86/files/bin86-0.16.20-remove-seg-ss-check.patch
@@ -0,0 +1,22 @@
+This check leads to false positives for lilo. We disable it.
+
+From: Anthony G. Basile <blueness@gentoo.org>
+
+diff -Naur bin86-0.16.20.orig/as/assemble.c bin86-0.16.20/as/assemble.c
+--- bin86-0.16.20.orig/as/assemble.c 2013-10-29 11:45:37.000000000 -0400
++++ bin86-0.16.20/as/assemble.c 2013-12-09 18:43:45.018184693 -0500
+@@ -325,12 +325,14 @@
+ /* We handle "rep[ne]" refix as separate instruction; check if it's valid */
+ if (prevop == 0xF2 && (opcode&0xF6) != 0xA6) /* REPNE CMPS/SCAS */
+ error (REPNE_STRING);
++#if 0
+ if (prevop == 0xF3 && !((opcode&0xFC) == 0x6C || /* REP INS/OUTS */
+ (opcode&0xFC) == 0xA4 || /* REP MOVS/CMPS */
+ (opcode&0xFC) == 0xAC || /* REP SCAS/LODS */
+ (opcode&0xFE) == 0xAA)) /* REP STOS */
+ error (REP_STRING);
+ #endif
++#endif
+ routine = rout_table[symptr->value_reg_or_op.op.routine];
+ getsym();
+ (*routine)();
diff --git a/sys-devel/bin86/metadata.xml b/sys-devel/bin86/metadata.xml
new file mode 100644
index 000000000000..746b4d9abbe8
--- /dev/null
+++ b/sys-devel/bin86/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>
+ <!--
+ If anyone from base-system wants to be secondary, by all means just add
+ yourself, and send me (boo) a mail telling me that you've done so.
+ -->
+</pkgmetadata>
diff --git a/sys-devel/binutils-apple/Manifest b/sys-devel/binutils-apple/Manifest
new file mode 100644
index 000000000000..9c32c170d0ad
--- /dev/null
+++ b/sys-devel/binutils-apple/Manifest
@@ -0,0 +1,21 @@
+DIST binutils-apple-3.2-unwind-patches-5.tar.xz 26924 SHA256 65a3b979df5c2033ac34e830d8a77b92b436b6d5707483c619c90a1c2ea46428 SHA512 9f3ec399274060b67c51193029da5af2199c45bf923a2fa513143111cf3f1c899256c993f4927f4da85a21570d0bc9ff0872e663f90284b2cdbb3f609ea8484e WHIRLPOOL 877410e6e0b442df9e9b7cdef51cc28bd636856949ea42ac53e97ebfc41c2f50309a054729d4fc3498d6eccac96170ffb59dd5700237e59684773832218793cc
+DIST binutils-apple-LP64-patches-1.tar.bz2 10235 SHA256 a107459f3914d57524e51ec4cb5e800f6715d40003514c79add0b5b4521cf809 SHA512 5632d4033c39e47de3ec275d02100ed53408a63122fe722c26dda1b02275c397524b113e51e1334d3235fc7f0a3bb8e53d4ccc1c2e40f24c6129282846da22e1 WHIRLPOOL c46d2021c85cee46e87871687ca7217169d14061848d12b4fa203db5d76a89969313ce55b345f2ad9fdba65fd39bdd34b146393332566fd539b2bdfc3f1e4304
+DIST cctools-698.1.tar.gz 2318018 SHA256 383f1c0c78a2b3efdfdf7ce01adb7e2f8ee9985164dba6ab1c0fae800a211cec SHA512 05e64df9bead958e6035b3cf449a2cb21b19cef10278348ebea8b47816b05a77ebd7f72fd90270400784a231b5d55c8f909653e8177cbe1332d7f7d618453f12 WHIRLPOOL 6ae1244ca97b13378e864609aa62efc4bf028b3e55bfb00cdbf9d20ed6cedd917c64ce337b2635dcabce334b8f994e2558fbda36055b951bf769a21950673e12
+DIST cctools-750.tar.gz 1947953 SHA256 188855640da114e37e4ddd4824ff6cdc1ea89dfb6c90a23905c9ca315342f356 SHA512 e2e152a9fb7db47c60fe450e1fc92c6866ab89682c7fdc594b97e419ce93ea1353654bd4419bf3df99d119f554aa0f32993dc645dd7c4680840cd01b7dce2f67 WHIRLPOOL 98e48fca183ee47d138426c65401138954a86abc3b80bfc4c5d105b97b8eb583ae350657f1a7dc1154259d0bcdfe1d60dc0a63409826e9a24b178674a5afdf21
+DIST cctools-795.tar.gz 1993795 SHA256 7fab7044b648e92a9fefd493a1bb6daa4246f24c5838d8b5c913a446e6bbd2ef SHA512 5a34a73dc71d3574a357f6b0f26a48a99dd0995d62695b309cdfe85c4960934b410455b1ba6bdbc9a4e32106bb45b35555604975d2a80ad1be21f5d4eac69254 WHIRLPOOL 2bd074ac8ef8542c2c3df5fae91a0bece2e1c31d6c6c771c55e7c7a3d90929f9a7cd420760dcb5ecffb9dd279abed4ba5ebf840c9e9bb983a806707d735cd735
+DIST cctools-809.tar.gz 2014410 SHA256 03ba62749b843b131c7304a044a98c6ffacd65b1399b921d69add0375f79d8ad SHA512 1349b3e6b3b48d9fa88dade187c05c80f161c3895fc6451a530880a256eb82dc93376b3cfd0f4d65e83f5fe00dc2baab386c5f78ce5b096f2c69fe53e1a55e24 WHIRLPOOL bd06ed88a7ab0bca173c0ee03c39cf60c719b9e0f03d21df9189e3e4a62e4fb452be46b0b0b05eafc70aed88bccc0a621d9165a1df63ea0eb071f9e5dda43c25
+DIST cctools-822.tar.gz 2024412 SHA256 dfaa9bdbd023524d47429674f64d2d5ea393123dabf90868be0aa17f61f45289 SHA512 8b02cc837d5e0520f35da445f25ba86b5042d5caa27b49a599e829ed89428cf78dbd1831bcf6c18301f941fbfb31ac2114e248041d98008a466e1574f4fe1586 WHIRLPOOL 81191ab46e8a9e47e4267146f978438ff64314b0363296b973a02f361918a5cd69057753a1b40766b93d3d4a3ed10585a27f6da2953992a406be61d1dcc1d06c
+DIST cctools-855.tar.gz 1699635 SHA256 751748ddf32c8ea84c175f32792721fa44424dad6acbf163f84f41e9617dbc58 SHA512 50f5d015ce807aa5ca274dd2deea810b8b375110e60b5e334ca4b2170526b738ea5f86a5436caebbdb748badc3b89601d0f450f5b867d8393c89e336a3db4b3f WHIRLPOOL fa493a29e32583f60c3553794bbb6d01a7b5ef797d8e8ba8161c9cbf237906ebbfaff560366da2d5b852bfcbdd55e874c00edf5b3169b16b357a54fcf3c07c4c
+DIST cctools-862.tar.gz 1702345 SHA256 1bf29f620b91c901ad3116b47738ab5076c1aed75d13869cd3bc7f067b4aaadb SHA512 faa401c1dc55bfb9cd2a9a9cc7bc9d473ee63b019607967c8b0da325514d6a1f7b1f52404370bcc018e86d30d75a4b01183f49b793f577110663efe43871360a WHIRLPOOL 371307f3264361f5e2e48d83177aff1a8f435cf2bdc1f4998cc5780c5b3760048a29a7620d2390db8f0c9378cd2f3b2f130b6aca9d402e3d428c4f4d353db097
+DIST dyld-195.5.tar.gz 411615 SHA256 2cf0484c87cf79b606b351a7055a247dae84093ae92c747a74e0cde2c8c8f83c SHA512 f316d32f3e417cf0898a8e231df66572d3424765831375863799d3ff30f8e28342ca692426d0ece7a8d069b341a3b9ca79c625edc322d90e3f26f528ea555324 WHIRLPOOL e0e231653ad37ad8fdb7d5fbd372fe1dc34b80e41f7dafa8bb46f4c8fa4f5acb4574f4cd346304dfaca1f074667f381931ca5ff7a7efddaea770fb35d30539dc
+DIST dyld-195.6.tar.gz 412518 SHA256 69296e9b4192bdac778ea899fffc18b02be62b51b5e8474b4cf85ae5f2b08aa4 SHA512 58a9ea27efc02e66f9d99bfa250af1d90326385385431e5279386bbd9ab53366bf7e8236543296908b7214c33523c8f60098a6298a7393b3180e2a6bce18e7c5 WHIRLPOOL e37b11d3996559f8a1843577a5fa42f96e4d42419f205276600f0ed79fcd2490da1f8a77eecf29f111b3db62a65e8e9cd77a154e3b389d633a7ac1525273b9b5
+DIST dyld-353.2.1.tar.gz 510036 SHA256 051089e284c5a4d671b21b73866abd01d54e5ea1912cadf3a9b916890fb31540 SHA512 a9488620499f682e245b55b7e0e4ec02fc0bcf03bd8a70d4a4ee0ba762067ade2f41c188990c101727476d41c19368b4cc89cccf2df40231da1c777742c7391f WHIRLPOOL 3164746ed8c866df993f08e405e7e329db427af8eeded681d5fb88031ef2c025363d5bfb647e9315738024adf9f48efacf49226f86f27def584ec7f538da292e
+DIST ld64-127.2.tar.gz 496975 SHA256 97b75547b2bd761306ab3e15ae297f01e7ab9760b922bc657f4ef72e4e052142 SHA512 a87181eca9307518aa21fc52a4d665c11ad51106c318c229d7f08650228f771484fd0b8c01c63639d577503aa9bc86d0792a3524643dc18cff19c3754aed9fc8 WHIRLPOOL 94f58da977da3d2d0c5a907a7d2c02e4a0d8323d04b8429d133e377b8495b0d344eec93dd1baaf369aa0a1517c7666cbef1d98d3cc6e8fd5d51c9622a2edcdf1
+DIST ld64-128.2.tar.gz 494361 SHA256 96a912464e2d4d3d7cdaab0744003b0fa93d139f203c82867f659ee94b4ae9f7 SHA512 f50a3c396e6f4fddc685bb3f59f9a260bd2f47060535d24259b2b411e4f759e48daa35819da682ad9bceaa1b9a1981eb34716387d988cdc4b7eec9ab2169726e WHIRLPOOL 78dec40124ae11c80483b362860b01c833fcaff67bae6b6cb3b72371daffdf3be809186f5daca4bb6ace77441cb43168939eb60eedf9f8c05ae3ec644c2a0502
+DIST ld64-236.3.tar.gz 624400 SHA256 8ef36729b643201081ab45ebd8586ede8f9968bc17614b679a940faa82875ca6 SHA512 e103fc5efd4d4161c7dc55b1ad53aebd455cfcd72de7873ebfdf5ba896b7b0da9c9aeb12e1e1a76425768ac1dc85d864a4ce33b5b841ba115eeab96a2e2965aa WHIRLPOOL d122e325518860c810b9efde7016ebecb6b59c56bb40ae1f041a840be764a5d9b90c7db1922fd9037c18f4caae7ace0d395591ffb3db704c87b92837ef997a17
+DIST ld64-241.9.tar.gz 639944 SHA256 3594e87c626c3b5abab6470cac6f27b367f1efcee60eb3d0f6b6d4ecf9b24230 SHA512 6958e7064f4fd8b47501225fc4cbc6292e5da63d7f4103ad79add177ef7382c8de3c732f14d19a9c11356b8070f578392383caccc3795e2ab8ef7b7ddbde88da WHIRLPOOL 5b07a336efde52b00b2601866907513517593a113583f05a9c45b98b4d6f394d87add887a7e44a95f462b6c2b5617ce497376b94a523e5cdf0f69d4d10ef3407
+DIST ld64-85.2.1.tar.gz 598524 SHA256 4bcbcbdfd62efdc46c51700b8f5dae2cbd1638e9e50f649d5c7f242d32fca804 SHA512 b5ffaffc43e74f22688fecd9fb3023a59160cf051f9412f34e6b0acf1c4f9d43ba641e199d8d6b1c6cf3bbbbf117645988fd879ded1fec8be056b6941fe79999 WHIRLPOOL 7c50f462eb41808b57ea06b82bdf576460bddb4150abe7a678af541aa0b179105d994a2b6fd10152481aa28acc903265160945b4aae9dcfce0a1a1cfe4b9460a
+DIST ld64-97.17.tar.gz 421947 SHA256 02bd46af0809eaa415d096d7d41c3e8e7d80f7d8d181840866fb87f036b4e089 SHA512 841774a1a7c0e2f661ac7e66703f7578d8f11274897ffa15f8c49daf290a23465763f264a4dae99f15754891f44c425c0d327652112007b499bc8f755a7fc9d6 WHIRLPOOL 7225b44d845b13c6b6d1a685170f2b6e15b81c48320fa3b570771938ed457a59452e80873996a4b2712a8f6813486063afd73acf979a97d823afb3d510d74678
+DIST libunwind-30.tar.gz 82811 SHA256 6ac97d18cc2b05e6de1269bf5af03b81948bd2200dae827527f3dc618b82bd41 SHA512 57106eafa1516791b4e0db2de6c6336bc0c1cbd8bf098a6d3a809fafa457802c95a7aeae9137f4ca5922a3018dfd8f597907ea4187b0afbbf267500eae00041f WHIRLPOOL c3caf5ba593cffa2f0a9cdb256f518524e9500eaf0a013c4973dc9881b16efa0c388e70407bbed1fd331f100af2da01ddeee12d33b3afc1213d69c32ab5e1d0b
+DIST libunwind-35.3.tar.gz 90002 SHA256 2bcc95553a44fa3edca41993ccfac65ba267830cb37c85dca760b34094722e56 SHA512 b7d9a86ef24f1fe9ca14517471e03a910219a229af9f0d4cf94435115971360640451107ba20c93fb1aab788f8b6eb5ed580ee08fdaa990b9fa43e9ae360c6b4 WHIRLPOOL 838912e46031b3a6796bfe854f0244991ce5bc3b59b95855224c9e84639e57b69f541b7993658360721423533dca75037248ea90f5e274b332f27319fdd85a9a
+DIST libunwind-llvm-115426.tar.bz2 74622 SHA256 e77a42c04eda5e3db61fc8b5bc98a55c6a015a9b02a74aab0f35d551fc38272f SHA512 01d78852632072ae48e95cfcf893dbb5325d4a3f4535a3cd3bc2afd5388c5f76995454219c8c6c2c2767abb2edc23bfe0212508c57b1d6db1c4a5d80cc5d4f9a WHIRLPOOL 0c7c8b8493b83e9c1337ab323697cfc255d1ef3e9ae2042df3a4f7480948a25fd571eb88a49e33168587d0994ec2d1371f2ef4d7834d7b41f77722d9693e8d55
diff --git a/sys-devel/binutils-apple/binutils-apple-3.1.2.ebuild b/sys-devel/binutils-apple/binutils-apple-3.1.2.ebuild
new file mode 100644
index 000000000000..fb391099ac31
--- /dev/null
+++ b/sys-devel/binutils-apple/binutils-apple-3.1.2.ebuild
@@ -0,0 +1,214 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils flag-o-matic toolchain-funcs
+
+RESTRICT="test" # the test suite will test what's installed.
+
+LD64=ld64-85.2.1
+CCTOOLS=cctools-698.1
+
+DESCRIPTION="Darwin assembler as(1) and static linker ld(1), Xcode Tools 3.1.2"
+HOMEPAGE="http://www.opensource.apple.com/darwinsource/"
+SRC_URI="http://www.gentoo.org/~grobian/distfiles/${LD64}.tar.gz
+ http://www.gentoo.org/~grobian/distfiles/${CCTOOLS}.tar.gz"
+
+LICENSE="APSL-2"
+KEYWORDS="~ppc-macos ~x86-macos"
+IUSE="test"
+SLOT="0"
+
+RDEPEND="sys-devel/binutils-config"
+DEPEND="${RDEPEND}
+ test? ( >=dev-lang/perl-5.8.8 )"
+
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
+
+if is_cross ; then
+ SLOT="${CTARGET}"
+else
+ SLOT="0"
+fi
+
+LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
+INCPATH=${LIBPATH}/include
+DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV}
+if is_cross ; then
+ BINPATH=/usr/${CHOST}/${CTARGET}/binutils-bin/${PV}
+else
+ BINPATH=/usr/${CTARGET}/binutils-bin/${PV}
+fi
+
+S=${WORKDIR}
+
+prepare_ld64() {
+ cd "${S}"/${LD64}/src
+ cp "${FILESDIR}"/Makefile .
+
+ local VER_STR="\"@(#)PROGRAM:ld PROJECT:${LD64}\\n\""
+ sed -i \
+ -e '/^#define LTO_SUPPORT 1/s:1:0:' \
+ ObjectDump.cpp
+ echo '#undef LTO_SUPPORT' > configure.h
+ echo "char ldVersionString[] = ${VER_STR};" > version.cpp
+
+ # clean up test suite
+ cd "${S}"/${LD64}/unit-tests/test-cases
+ local c
+
+ # we don't have llvm
+ ((++c)); rm -rf llvm-integration;
+
+ # we don't have dtrace
+ ((++c)); rm -rf dtrace-static-probes-coalescing;
+ ((++c)); rm -rf dtrace-static-probes;
+
+ # a file is missing
+ ((++c)); rm -rf eh-coalescing-r
+
+ # we don't do universal binaries
+ ((++c)); rm -rf blank-stubs;
+
+ # looks like a problem with apple's result-filter.pl
+ ((++c)); rm -rf implicit-common3;
+ ((++c)); rm -rf order_file-ans;
+
+ # TODO no idea what goes wrong here
+ ((++c)); rm -rf dwarf-debug-notes;
+
+ elog "Deleted $c tests that were bound to fail"
+}
+
+src_prepare() {
+ prepare_ld64
+
+ cd "${S}"/${CCTOOLS}
+ epatch "${FILESDIR}"/${PN}-3.1.1-as.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-as-dir.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-ranlib.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-libtool-ranlib.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-nmedit.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-no-efi-man.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-no-headers.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-no-oss-dir.patch
+ epatch "${FILESDIR}"/${PN}-3.1.2-as-Makefile.patch
+ cd "${S}"/${LD64}
+ epatch "${FILESDIR}"/${PN}-3.1.1-testsuite.patch
+
+ # -pg is used and the two are incompatible
+ filter-flags -fomit-frame-pointer
+}
+
+compile_ld64() {
+ cd "${S}"/${LD64}/src
+ # 'struct linkedit_data_command' is defined in mach-o/loader.h on leopard,
+ # but not on tiger.
+ [[ ${CHOST} == *-apple-darwin8 ]] && \
+ append-flags -isystem "${S}"/${CCTOOLS}/include/
+ emake || die "emake failed for ld64"
+ use test && emake build_test
+}
+
+compile_cctools() {
+ cd "${S}"/${CCTOOLS}
+ emake \
+ LTO= \
+ EFITOOLS= \
+ COMMON_SUBDIRS='libstuff ar misc otool' \
+ RC_CFLAGS="${CFLAGS}" || die "emake failed for the cctools"
+ cd "${S}"/${CCTOOLS}/as
+ emake \
+ BUILD_OBSOLETE_ARCH= \
+ RC_CFLAGS="-DASLIBEXECDIR=\"\\\"${EPREFIX}${LIBPATH}/\\\"\" ${CFLAGS}" \
+ || die "emake failed for as"
+}
+
+src_compile() {
+ tc-export CC CXX
+ compile_cctools
+ compile_ld64
+}
+
+install_ld64() {
+ exeinto ${BINPATH}
+ doexe "${S}"/${LD64}/src/{ld64,rebase}
+ dosym ld64 ${BINPATH}/ld
+ insinto ${DATAPATH}/man/man1
+ doins "${S}"/${LD64}/doc/man/man1/{ld,ld64,rebase}.1
+}
+
+install_cctools() {
+ cd "${S}"/${CCTOOLS}
+ emake install_all_but_headers \
+ EFITOOLS= \
+ COMMON_SUBDIRS='ar misc otool' \
+ DSTROOT=\"${D}\" \
+ BINDIR=\"${EPREFIX}\"${BINPATH} \
+ LOCBINDIR=\"${EPREFIX}\"${BINPATH} \
+ USRBINDIR=\"${EPREFIX}\"${BINPATH} \
+ LOCLIBDIR=\"${EPREFIX}\"${LIBPATH} \
+ MANDIR=\"${EPREFIX}\"${DATAPATH}/man/
+ cd "${S}"/${CCTOOLS}/as
+ emake install \
+ BUILD_OBSOLETE_ARCH= \
+ DSTROOT=\"${D}\" \
+ USRBINDIR=\"${EPREFIX}\"${BINPATH} \
+ LIBDIR=\"${EPREFIX}\"${LIBPATH}
+
+ cd "${ED}"${BINPATH}
+ insinto ${DATAPATH}/man/man1
+ local skips manpage
+ # ar brings an up-to-date manpage with it
+ skips=( ar )
+ for bin in *; do
+ for skip in ${skips[@]}; do
+ if [[ ${bin} == ${skip} ]]; then
+ continue 2;
+ fi
+ done
+ manpage=${S}/${CCTOOLS}/man/${bin}.1
+ if [[ -f "${manpage}" ]]; then
+ doins "${manpage}"
+ fi
+ done
+ insinto ${DATAPATH}/man/man5
+ doins "${S}"/${CCTOOLS}/man/*.5
+}
+
+src_test() {
+ einfo "Running unit tests"
+ cd "${S}"/${LD64}/unit-tests/test-cases
+ # need host arch, since GNU arch doesn't do what Apple's does
+ tc-export CC CXX
+ perl ../bin/make-recursive.pl \
+ ARCH="$(/usr/bin/arch)" \
+ RELEASEDIR="${S}"/${LD64}/src \
+ | perl ../bin/result-filter.pl
+}
+
+src_install() {
+ install_ld64
+ install_cctools
+
+ cd "${S}"
+ insinto /etc/env.d/binutils
+ cat <<-EOF > env.d
+ TARGET="${CHOST}"
+ VER="${PV}"
+ FAKE_TARGETS="${CHOST}"
+ EOF
+ newins env.d ${CHOST}-${PV}
+}
+
+pkg_postinst() {
+ binutils-config ${CHOST}-${PV}
+}
diff --git a/sys-devel/binutils-apple/binutils-apple-3.2.6.ebuild b/sys-devel/binutils-apple/binutils-apple-3.2.6.ebuild
new file mode 100644
index 000000000000..ad64539d97ef
--- /dev/null
+++ b/sys-devel/binutils-apple/binutils-apple-3.2.6.ebuild
@@ -0,0 +1,254 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils flag-o-matic toolchain-funcs
+
+RESTRICT="test" # the test suite will test what's installed.
+
+LD64=ld64-97.17
+CCTOOLS=cctools-795
+# http://lists.apple.com/archives/Darwin-dev/2009/Sep/msg00025.html
+UNWIND=binutils-apple-3.2-unwind-patches-5
+
+DESCRIPTION="Darwin assembler as(1) and static linker ld(1), Xcode Tools ${PV}"
+HOMEPAGE="http://www.opensource.apple.com/darwinsource/"
+SRC_URI="http://www.opensource.apple.com/tarballs/ld64/${LD64}.tar.gz
+ http://www.opensource.apple.com/tarballs/cctools/${CCTOOLS}.tar.gz
+ http://www.gentoo.org/~grobian/distfiles/${UNWIND}.tar.xz"
+
+LICENSE="APSL-2"
+KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
+IUSE="lto test"
+SLOT="0"
+
+RDEPEND="sys-devel/binutils-config
+ lto? ( sys-devel/llvm )"
+DEPEND="${RDEPEND}
+ test? ( >=dev-lang/perl-5.8.8 )
+ >=sys-devel/gcc-apple-4.2.1"
+
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
+
+if is_cross ; then
+ SLOT="${CTARGET}"
+else
+ SLOT="0"
+fi
+
+LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
+INCPATH=${LIBPATH}/include
+DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV}
+if is_cross ; then
+ BINPATH=/usr/${CHOST}/${CTARGET}/binutils-bin/${PV}
+else
+ BINPATH=/usr/${CTARGET}/binutils-bin/${PV}
+fi
+
+S=${WORKDIR}
+
+src_prepare() {
+ cd "${S}"/${CCTOOLS}
+ epatch "${FILESDIR}"/${PN}-3.2.2-as.patch
+ epatch "${FILESDIR}"/${PN}-4.0-as-dir.patch
+ epatch "${FILESDIR}"/${PN}-3.2.3-ranlib.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-libtool-ranlib.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-nmedit.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-no-headers.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-no-oss-dir.patch
+
+ cd "${S}"/${LD64}/src
+ cp "${FILESDIR}"/ld64-95.2.12-Makefile Makefile
+
+ ln -s ../../${CCTOOLS}/include
+ cp "${WORKDIR}"/ld64-unwind/compact_unwind_encoding.h include/mach-o/
+ cp other/prune_trie.h include/mach-o/ || die
+ # use our own copy of lto.h, which doesn't require llvm build-env
+ mkdir -p include/llvm-c || die
+ cp "${WORKDIR}"/ld64-unwind/ld64-97.14-llvm-lto.h include/llvm-c/lto.h || die
+
+ echo '' > configure.h
+ echo '' > linker_opts
+ local VER_STR="\"@(#)PROGRAM:ld PROJECT:${LD64} (Gentoo ${PN}-${PVR})\\n\""
+ echo "char ldVersionString[] = ${VER_STR};" > version.cpp
+
+ epatch "${WORKDIR}"/ld64-unwind/ld64-97.14-unlibunwind.patch
+ [[ ${CHOST} == powerpc*-darwin* ]] && \
+ epatch "${FILESDIR}"/ld64-95.2.12-darwin8-no-mlong-branch-warning.patch
+ if use !lto ; then
+ sed -i -e '/#define LTO_SUPPORT 1/d' other/ObjectDump.cpp || die
+ fi
+
+ # clean up test suite
+ cd "${S}"/${LD64}
+ epatch "${FILESDIR}"/${PN}-3.1.1-testsuite.patch
+
+ cd "${S}"/${LD64}/unit-tests/test-cases
+ local c
+
+ # we don't have llvm
+ ((++c)); rm -rf llvm-integration;
+
+ # we don't have dtrace
+ ((++c)); rm -rf dtrace-static-probes-coalescing;
+ ((++c)); rm -rf dtrace-static-probes;
+
+ # a file is missing
+ ((++c)); rm -rf eh-coalescing-r
+
+ # we don't do universal binaries
+ ((++c)); rm -rf blank-stubs;
+
+ # looks like a problem with apple's result-filter.pl
+ ((++c)); rm -rf implicit-common3;
+ ((++c)); rm -rf order_file-ans;
+
+ # TODO no idea what goes wrong here
+ ((++c)); rm -rf dwarf-debug-notes;
+
+ einfo "Deleted $c tests that were bound to fail"
+
+ cd "${S}"
+ ebegin "cleaning Makefiles from unwanted CFLAGS"
+ find . -name "Makefile" -print0 | xargs -0 sed \
+ -i \
+ -e 's/ -g / /g' \
+ -e 's/^OFLAG =.*$/OFLAG =/' \
+ -e 's/install -c -s/install/g'
+ eend $?
+
+ # -pg is used and the two are incompatible
+ filter-flags -fomit-frame-pointer
+}
+
+src_configure() {
+ tc-export CC CXX AR
+ if use lto ; then
+ append-flags -DLTO_SUPPORT
+ append-ldflags -L"${EPREFIX}"/usr/$(get_libdir)/llvm
+ append-libs LTO
+ else
+ append-flags -ULTO_SUPPORT
+ fi
+}
+
+compile_ld64() {
+ cd "${S}"/${LD64}/src
+ # remove antiquated copy that's available on any OSX system and
+ # breaks ld64 compilation
+ mv include/mach-o/dyld.h{,.disable}
+ emake \
+ CFLAGS="${CFLAGS}" \
+ CXXFLAGS="${CXXFLAGS}" \
+ LDFLAGS="${LDFLAGS} ${LIBS}" \
+ || die "emake failed for ld64"
+ use test && emake build_test
+ # restore, it's necessary for cctools' install
+ mv include/mach-o/dyld.h{.disable,}
+}
+
+compile_cctools() {
+ cd "${S}"/${CCTOOLS}
+ emake \
+ LIB_PRUNETRIE="-L../../${LD64}/src -lprunetrie" \
+ EFITOOLS= LTO= \
+ COMMON_SUBDIRS='libstuff ar misc otool' \
+ SUBDIRS_32= \
+ RC_CFLAGS="${CFLAGS}" OFLAG="${CFLAGS}" \
+ || die "emake failed for the cctools"
+ cd "${S}"/${CCTOOLS}/as
+ emake \
+ BUILD_OBSOLETE_ARCH= \
+ RC_CFLAGS="-DASLIBEXECDIR=\"\\\"${EPREFIX}${LIBPATH}/\\\"\" ${CFLAGS}" \
+ || die "emake failed for as"
+}
+
+src_compile() {
+ compile_ld64
+ compile_cctools
+}
+
+install_ld64() {
+ exeinto ${BINPATH}
+ doexe "${S}"/${LD64}/src/{ld64,rebase,dyldinfo,unwinddump,ObjectDump}
+ dosym ld64 ${BINPATH}/ld
+ insinto ${DATAPATH}/man/man1
+ doins "${S}"/${LD64}/doc/man/man1/{ld,ld64,rebase}.1
+}
+
+install_cctools() {
+ cd "${S}"/${CCTOOLS}
+ emake install_all_but_headers \
+ EFITOOLS= LTO= \
+ COMMON_SUBDIRS='ar misc otool' \
+ SUBDIRS_32= \
+ RC_CFLAGS="${CFLAGS}" OFLAG="${CFLAGS}" \
+ DSTROOT=\"${D}\" \
+ BINDIR=\"${EPREFIX}\"${BINPATH} \
+ LOCBINDIR=\"${EPREFIX}\"${BINPATH} \
+ USRBINDIR=\"${EPREFIX}\"${BINPATH} \
+ LOCLIBDIR=\"${EPREFIX}\"${LIBPATH} \
+ MANDIR=\"${EPREFIX}\"${DATAPATH}/man/
+ cd "${S}"/${CCTOOLS}/as
+ emake install \
+ BUILD_OBSOLETE_ARCH= \
+ DSTROOT=\"${D}\" \
+ USRBINDIR=\"${EPREFIX}\"${BINPATH} \
+ LIBDIR=\"${EPREFIX}\"${LIBPATH}
+
+ cd "${ED}"${BINPATH}
+ insinto ${DATAPATH}/man/man1
+ local skips manpage
+ # ar brings an up-to-date manpage with it
+ skips=( ar )
+ for bin in *; do
+ for skip in ${skips[@]}; do
+ if [[ ${bin} == ${skip} ]]; then
+ continue 2;
+ fi
+ done
+ manpage=${S}/${CCTOOLS}/man/${bin}.1
+ if [[ -f "${manpage}" ]]; then
+ doins "${manpage}"
+ fi
+ done
+ insinto ${DATAPATH}/man/man5
+ doins "${S}"/${CCTOOLS}/man/*.5
+}
+
+src_test() {
+ einfo "Running unit tests"
+ cd "${S}"/${LD64}/unit-tests/test-cases
+ # need host arch, since GNU arch doesn't do what Apple's does
+ tc-export CC CXX
+ perl ../bin/make-recursive.pl \
+ ARCH="$(/usr/bin/arch)" \
+ RELEASEDIR="${S}"/${LD64}/src \
+ | perl ../bin/result-filter.pl
+}
+
+src_install() {
+ install_ld64
+ install_cctools
+
+ cd "${S}"
+ insinto /etc/env.d/binutils
+ cat <<-EOF > env.d
+ TARGET="${CHOST}"
+ VER="${PV}"
+ FAKE_TARGETS="${CHOST}"
+ EOF
+ newins env.d ${CHOST}-${PV}
+}
+
+pkg_postinst() {
+ binutils-config ${CHOST}-${PV}
+}
diff --git a/sys-devel/binutils-apple/binutils-apple-3.2.ebuild b/sys-devel/binutils-apple/binutils-apple-3.2.ebuild
new file mode 100644
index 000000000000..77555c644ecd
--- /dev/null
+++ b/sys-devel/binutils-apple/binutils-apple-3.2.ebuild
@@ -0,0 +1,234 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils flag-o-matic toolchain-funcs
+
+RESTRICT="test" # the test suite will test what's installed.
+
+# LD64=ld64-95.2.12 # can't compile this one, missing libunwind/* includes
+# http://lists.apple.com/archives/Darwin-dev/2009/Sep/msg00025.html
+LD64=ld64-85.2.1 # from 3.1.2
+CCTOOLS=cctools-750
+LP64PATCHES=binutils-apple-LP64-patches-1
+
+DESCRIPTION="Darwin assembler as(1) and static linker ld(1), Xcode Tools 3.2"
+HOMEPAGE="http://www.opensource.apple.com/darwinsource/"
+SRC_URI="http://www.gentoo.org/~grobian/distfiles/${LD64}.tar.gz
+ http://www.gentoo.org/~grobian/distfiles/${CCTOOLS}.tar.gz
+ http://www.gentoo.org/~grobian/distfiles/${LP64PATCHES}.tar.bz2"
+
+LICENSE="APSL-2"
+KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
+IUSE="test"
+SLOT="0"
+
+RDEPEND="sys-devel/binutils-config"
+DEPEND="${RDEPEND}
+ test? ( >=dev-lang/perl-5.8.8 )"
+
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
+
+if is_cross ; then
+ SLOT="${CTARGET}"
+else
+ SLOT="0"
+fi
+
+LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
+INCPATH=${LIBPATH}/include
+DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV}
+if is_cross ; then
+ BINPATH=/usr/${CHOST}/${CTARGET}/binutils-bin/${PV}
+else
+ BINPATH=/usr/${CTARGET}/binutils-bin/${PV}
+fi
+
+S=${WORKDIR}
+
+prepare_ld64() {
+ cd "${S}"/${LD64}/src
+ cp "${FILESDIR}"/Makefile .
+
+ local VER_STR="\"@(#)PROGRAM:ld PROJECT:${LD64} (Gentoo ${PN}-${PVR})\\n\""
+ sed -i \
+ -e '/^#define LTO_SUPPORT 1/s:1:0:' \
+ ObjectDump.cpp || die
+ echo '#undef LTO_SUPPORT' > configure.h
+ echo '' > linker_opts
+ echo "char ldVersionString[] = ${VER_STR};" > version.cpp
+
+ # clean up test suite
+ cd "${S}"/${LD64}/unit-tests/test-cases
+ local c
+
+ # we don't have llvm
+ ((++c)); rm -rf llvm-integration;
+
+ # we don't have dtrace
+ ((++c)); rm -rf dtrace-static-probes-coalescing;
+ ((++c)); rm -rf dtrace-static-probes;
+
+ # a file is missing
+ ((++c)); rm -rf eh-coalescing-r
+
+ # we don't do universal binaries
+ ((++c)); rm -rf blank-stubs;
+
+ # looks like a problem with apple's result-filter.pl
+ ((++c)); rm -rf implicit-common3;
+ ((++c)); rm -rf order_file-ans;
+
+ # TODO no idea what goes wrong here
+ ((++c)); rm -rf dwarf-debug-notes;
+
+ elog "Deleted $c tests that were bound to fail"
+}
+
+src_prepare() {
+ prepare_ld64
+
+ cd "${S}"/${CCTOOLS}
+ epatch "${FILESDIR}"/${PN}-3.1.1-as.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-as-dir.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-ranlib.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-libtool-ranlib.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-nmedit.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-no-headers.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-no-oss-dir.patch
+ epatch "${FILESDIR}"/${P}-armv7-defines.patch
+
+ cd "${S}"/${LD64}
+ epatch "${FILESDIR}"/${PN}-3.1.1-testsuite.patch
+ epatch "${WORKDIR}"/LP64/ld64/*.patch
+
+ cd "${S}"
+ ebegin "cleaning Makefiles from unwanted CFLAGS"
+ find . -name "Makefile" -print0 | xargs -0 sed \
+ -i \
+ -e 's/ -g / /g' \
+ -e 's/^OFLAG =.*$/OFLAG =/' \
+ -e 's/install -c -s/install/g'
+ eend $?
+
+ # -pg is used and the two are incompatible
+ filter-flags -fomit-frame-pointer
+}
+
+compile_ld64() {
+ cd "${S}"/${LD64}/src
+ # 'struct linkedit_data_command' is defined in mach-o/loader.h on leopard,
+ # but not on tiger.
+ [[ ${CHOST} == *-apple-darwin8 ]] && \
+ append-flags -isystem "${S}"/${CCTOOLS}/include/
+ emake || die "emake failed for ld64"
+ use test && emake build_test
+}
+
+compile_cctools() {
+ cd "${S}"/${CCTOOLS}
+ emake \
+ LTO= \
+ TRIE= \
+ EFITOOLS= \
+ COMMON_SUBDIRS='libstuff ar misc otool' \
+ SUBDIRS_32= \
+ RC_CFLAGS="${CFLAGS}" OFLAG="${CFLAGS}" \
+ || die "emake failed for the cctools"
+ cd "${S}"/${CCTOOLS}/as
+ emake \
+ BUILD_OBSOLETE_ARCH= \
+ RC_CFLAGS="-DASLIBEXECDIR=\"\\\"${EPREFIX}${LIBPATH}/\\\"\" ${CFLAGS}" \
+ || die "emake failed for as"
+}
+
+src_compile() {
+ tc-export CC CXX
+ compile_cctools
+ compile_ld64
+}
+
+install_ld64() {
+ exeinto ${BINPATH}
+ doexe "${S}"/${LD64}/src/{ld64,rebase}
+ dosym ld64 ${BINPATH}/ld
+ insinto ${DATAPATH}/man/man1
+ doins "${S}"/${LD64}/doc/man/man1/{ld,ld64,rebase}.1
+}
+
+install_cctools() {
+ cd "${S}"/${CCTOOLS}
+ emake install_all_but_headers \
+ EFITOOLS= \
+ COMMON_SUBDIRS='ar misc otool' \
+ SUBDIRS_32= \
+ RC_CFLAGS="${CFLAGS}" OFLAG="${CFLAGS}" \
+ DSTROOT=\"${D}\" \
+ BINDIR=\"${EPREFIX}\"${BINPATH} \
+ LOCBINDIR=\"${EPREFIX}\"${BINPATH} \
+ USRBINDIR=\"${EPREFIX}\"${BINPATH} \
+ LOCLIBDIR=\"${EPREFIX}\"${LIBPATH} \
+ MANDIR=\"${EPREFIX}\"${DATAPATH}/man/
+ cd "${S}"/${CCTOOLS}/as
+ emake install \
+ BUILD_OBSOLETE_ARCH= \
+ DSTROOT=\"${D}\" \
+ USRBINDIR=\"${EPREFIX}\"${BINPATH} \
+ LIBDIR=\"${EPREFIX}\"${LIBPATH}
+
+ cd "${ED}"${BINPATH}
+ insinto ${DATAPATH}/man/man1
+ local skips manpage
+ # ar brings an up-to-date manpage with it
+ skips=( ar )
+ for bin in *; do
+ for skip in ${skips[@]}; do
+ if [[ ${bin} == ${skip} ]]; then
+ continue 2;
+ fi
+ done
+ manpage=${S}/${CCTOOLS}/man/${bin}.1
+ if [[ -f "${manpage}" ]]; then
+ doins "${manpage}"
+ fi
+ done
+ insinto ${DATAPATH}/man/man5
+ doins "${S}"/${CCTOOLS}/man/*.5
+}
+
+src_test() {
+ einfo "Running unit tests"
+ cd "${S}"/${LD64}/unit-tests/test-cases
+ # need host arch, since GNU arch doesn't do what Apple's does
+ tc-export CC CXX
+ perl ../bin/make-recursive.pl \
+ ARCH="$(/usr/bin/arch)" \
+ RELEASEDIR="${S}"/${LD64}/src \
+ | perl ../bin/result-filter.pl
+}
+
+src_install() {
+ install_ld64
+ install_cctools
+
+ cd "${S}"
+ insinto /etc/env.d/binutils
+ cat <<-EOF > env.d
+ TARGET="${CHOST}"
+ VER="${PV}"
+ FAKE_TARGETS="${CHOST}"
+ EOF
+ newins env.d ${CHOST}-${PV}
+}
+
+pkg_postinst() {
+ binutils-config ${CHOST}-${PV}
+}
diff --git a/sys-devel/binutils-apple/binutils-apple-4.2-r1.ebuild b/sys-devel/binutils-apple/binutils-apple-4.2-r1.ebuild
new file mode 100644
index 000000000000..406cd3e102a0
--- /dev/null
+++ b/sys-devel/binutils-apple/binutils-apple-4.2-r1.ebuild
@@ -0,0 +1,328 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils flag-o-matic toolchain-funcs
+
+LD64=ld64-127.2
+CCTOOLS_VERSION=809
+CCTOOLS=cctools-${CCTOOLS_VERSION}
+CCTOOLS_HEADERS=cctools-855
+LIBUNWIND=libunwind-30
+DYLD=dyld-195.5
+
+DESCRIPTION="Darwin assembler as(1) and static linker ld(1), Xcode Tools ${PV}"
+HOMEPAGE="http://www.opensource.apple.com/darwinsource/"
+SRC_URI="http://www.opensource.apple.com/tarballs/ld64/${LD64}.tar.gz
+ http://www.opensource.apple.com/tarballs/cctools/${CCTOOLS}.tar.gz
+ http://www.opensource.apple.com/tarballs/cctools/${CCTOOLS_HEADERS}.tar.gz
+ http://www.opensource.apple.com/tarballs/libunwind/${LIBUNWIND}.tar.gz
+ http://www.opensource.apple.com/tarballs/dyld/${DYLD}.tar.gz"
+
+LICENSE="APSL-2"
+KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
+IUSE="lto test"
+
+RDEPEND="sys-devel/binutils-config
+ lto? ( sys-devel/llvm )"
+DEPEND="${RDEPEND}
+ test? ( >=dev-lang/perl-5.8.8 )
+ || ( >=sys-devel/gcc-apple-4.2.1 sys-devel/llvm )"
+
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
+
+if is_cross ; then
+ SLOT="${CTARGET}-4"
+else
+ SLOT="4"
+fi
+
+LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
+INCPATH=${LIBPATH}/include
+DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV}
+if is_cross ; then
+ BINPATH=/usr/${CHOST}/${CTARGET}/binutils-bin/${PV}
+else
+ BINPATH=/usr/${CTARGET}/binutils-bin/${PV}
+fi
+
+S=${WORKDIR}
+
+src_prepare() {
+ cd "${S}"/${LD64}/src
+ cp "${FILESDIR}"/ld64-127.2-Makefile Makefile
+ epatch "${FILESDIR}"/${LD64}-lto.patch
+ epatch "${FILESDIR}"/ld64-128.2-stdlib.patch
+ epatch "${FILESDIR}"/${LD64}-ppc-range-warning.patch
+ epatch "${FILESDIR}"/ld64-127.2-extraneous-headers.patch
+ epatch "${FILESDIR}"/ld64-241.9-register-names.patch
+ epatch "${FILESDIR}"/ld64-241.9-get-comm-align.patch
+ epatch "${FILESDIR}"/ld64-241.9-cc_md5.patch
+ epatch "${FILESDIR}"/ld64-128.2-1010.patch
+
+ # We used to use our own copy of lto.h, which doesn't require llvm
+ # build-env. Current versions of llvm provide
+ # $EPREFIX/usr/include/llvm-c/lto.h as well as
+ # $EPREFIX/usr/lib/libLTO.{so,dylib}, so we just use these.
+
+ # provide missing headers from libunwind and dyld
+ mkdir -p include/{mach,mach-o/arm} || die
+ # never present because it's private
+ cp ../../${DYLD}/include/mach-o/dyld_priv.h include/mach-o || die
+ # missing on <= 10.5
+ cp ../../${LIBUNWIND}/include/libunwind.h include/ || die
+ cp ../../${LIBUNWIND}/include/mach-o/compact_unwind_encoding.h include/mach-o || die
+ # missing on <= 10.4
+ cp ../../${DYLD}/include/mach-o/dyld_images.h include/mach-o || die
+ cp ../../${CCTOOLS}/include/mach-o/loader.h include/mach-o || die
+ # use copies from cctools because they're otherwise hidden in some SDK
+ cp ../../${CCTOOLS}/include/mach-o/arm/reloc.h include/mach-o/arm || die
+ # provide all required CPU_TYPEs on all platforms
+ cp ../../${CCTOOLS}/include/mach/machine.h include/mach/machine.h
+ # add alias for newer identifiers, because ld64 uses both but cctools
+ # header only defines the older
+ epatch "${FILESDIR}"/ld64-236.3-missing-cputypes.patch
+
+ # mimic OS X Leopard-style Availability.h macros for libunwind.h on
+ # older systems
+ [[ ${CHOST} == *darwin* && ${CHOST#*-darwin} -le 8 ]] && \
+ echo "#define __OSX_AVAILABLE_STARTING(x,y) " > include/Availability.h
+
+ local VER_STR="\"@(#)PROGRAM:ld PROJECT:${LD64} (Gentoo ${PN}-${PVR})\\n\""
+ echo "char ldVersionString[] = ${VER_STR};" > version.cpp
+
+ epatch "${FILESDIR}"/ld64-123.2-debug-backtrace.patch
+ if [[ ${CHOST} == powerpc*-darwin* ]] ; then
+ epatch "${FILESDIR}"/ld64-123.2-darwin8-no-mlong-branch-warning.patch
+ epatch "${FILESDIR}"/ld64-127.2-thread_state.patch
+ fi
+
+ cd "${S}"/${CCTOOLS}
+ epatch "${FILESDIR}"/${PN}-4.0-as.patch
+ epatch "${FILESDIR}"/${PN}-4.2-as-dir.patch
+ epatch "${FILESDIR}"/${PN}-3.2.3-ranlib.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-libtool-ranlib.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-nmedit.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-no-headers.patch
+ epatch "${FILESDIR}"/${PN}-4.0-no-oss-dir.patch
+ epatch "${FILESDIR}"/${PN}-4.2-lto.patch
+ epatch "${FILESDIR}"/${PN}-5.1-extraneous-includes.patch
+ epatch "${FILESDIR}"/${PN}-4.2-globals-extern.patch
+ cp ../${LD64}/src/other/prune_trie.h include/mach-o/ || die
+ # __darwin_i386_float_state missing on <= 10.4
+ cp -a ../${CCTOOLS_HEADERS}/include/mach/i386 include/mach
+
+ # do not build profileable libstuff to save compile time
+ sed -i -e "/^all:/s, profile , ," libstuff/Makefile
+
+ # Provide patched version information to the tools. This is normally
+ # done by the Makefile using vers_string. As an added benefit, the
+ # build will not fail on later OS Xes where that tool doesn't exist any
+ # more.
+
+ # Those tools don't even use their version information. Just make make
+ # happy.
+ touch {ar,gprof,otool}/vers.c
+
+ # for the others defining apple_version suffices nicely although the
+ # Makefile does a lot more.
+ VER_STR="${CCTOOLS} (Gentoo ${PN}-${PVR})"
+ echo "const char apple_version[] = \"${VER_STR}\";" \
+ >> as/apple_version.c || die
+ echo "const char apple_version[] = \"${VER_STR})\";" \
+ >> misc/vers.c || die
+ # the rest we don't even build
+
+ # clean up test suite
+ cd "${S}"/${LD64}/unit-tests/test-cases
+ local c
+
+ # we don't have llvm
+ ((++c)); rm -rf llvm-integration;
+
+ # we don't have dtrace
+ ((++c)); rm -rf dtrace-static-probes-coalescing;
+ ((++c)); rm -rf dtrace-static-probes;
+
+ # a file is missing
+ ((++c)); rm -rf eh-coalescing-r
+
+ # we don't do universal binaries
+ ((++c)); rm -rf blank-stubs;
+
+ # looks like a problem with apple's result-filter.pl
+ ((++c)); rm -rf implicit-common3;
+ ((++c)); rm -rf order_file-ans;
+
+ # TODO no idea what goes wrong here
+ ((++c)); rm -rf dwarf-debug-notes;
+
+ einfo "Deleted $c tests that were bound to fail"
+
+ cd "${S}"
+ ebegin "cleaning Makefiles from unwanted CFLAGS"
+ find . -name "Makefile" -print0 | xargs -0 sed \
+ -i \
+ -e 's/ -g / /g' \
+ -e 's/^G =.*$/G =/' \
+ -e 's/^OFLAG =.*$/OFLAG =/' \
+ -e 's/install -c -s/install/g'
+ eend $?
+}
+
+src_configure() {
+ CCTOOLS_LTO=
+ LD64_LTO=0
+ if use lto ; then
+ CCTOOLS_LTO="-DLTO_SUPPORT"
+ LD64_LTO=1
+ fi
+
+ # CPPFLAGS only affects ld64, cctools don't use 'em (which currently is
+ # what we want)
+ append-cppflags -DNDEBUG
+
+ CCTOOLS_OFLAG=
+ if [[ ${CHOST} == *darwin* && ${CHOST#*-darwin} -le 8 ]] ; then
+ # cctools expect to use UNIX03 struct member names.
+ # This is default on > 10.4. Activate it on <= 10.4 by defining
+ # __DARWIN_UNIX03 explicitly.
+ CCTOOLS_OFLAG="-D__DARWIN_UNIX03=1"
+ fi
+
+ cat <<EOF > ${LD64}/src/configure.h
+#define DEFAULT_MACOSX_MIN_VERSION "${MACOSX_DEPLOYMENT_TARGET}"
+EOF
+}
+
+compile_ld64() {
+ einfo "building ${LD64}"
+ cd "${S}"/${LD64}/src
+ emake \
+ LTO=${LD64_LTO} \
+ || die "emake failed for ld64"
+ use test && emake build_test
+}
+
+compile_cctools() {
+ einfo "building ${CCTOOLS}"
+ cd "${S}"/${CCTOOLS}
+ emake \
+ LIB_PRUNETRIE="-L../../${LD64}/src -lprunetrie" \
+ EFITOOLS= \
+ LTO="${CCTOOLS_LTO}" \
+ COMMON_SUBDIRS='libstuff ar misc otool' \
+ SUBDIRS_32= \
+ LEGACY= \
+ RC_CFLAGS="${CFLAGS}" \
+ OFLAG="${CCTOOLS_OFLAG}" \
+ || die "emake failed for the cctools"
+ cd "${S}"/${CCTOOLS}/as
+ emake \
+ BUILD_OBSOLETE_ARCH= \
+ RC_CFLAGS="-DASLIBEXECDIR=\"\\\"${EPREFIX}${LIBPATH}/\\\"\" ${CFLAGS}" \
+ OFLAG="${CCTOOLS_OFLAG}" \
+ || die "emake failed for as"
+}
+
+src_compile() {
+ compile_ld64
+ compile_cctools
+}
+
+install_ld64() {
+ exeinto ${BINPATH}
+ doexe "${S}"/${LD64}/src/{ld64,rebase,dyldinfo,unwinddump,ObjectDump}
+ dosym ld64 ${BINPATH}/ld
+ insinto ${DATAPATH}/man/man1
+ doins "${S}"/${LD64}/doc/man/man1/{ld,ld64,rebase}.1
+}
+
+install_cctools() {
+ cd "${S}"/${CCTOOLS}
+ emake install_all_but_headers \
+ EFITOOLS= \
+ COMMON_SUBDIRS='ar misc otool' \
+ SUBDIRS_32= \
+ DSTROOT=\"${D}\" \
+ BINDIR=\"${EPREFIX}\"${BINPATH} \
+ LOCBINDIR=\"${EPREFIX}\"${BINPATH} \
+ USRBINDIR=\"${EPREFIX}\"${BINPATH} \
+ LOCLIBDIR=\"${EPREFIX}\"${LIBPATH} \
+ MANDIR=\"${EPREFIX}\"${DATAPATH}/man/
+ cd "${S}"/${CCTOOLS}/as
+ emake install \
+ BUILD_OBSOLETE_ARCH= \
+ DSTROOT=\"${D}\" \
+ USRBINDIR=\"${EPREFIX}\"${BINPATH} \
+ LIBDIR=\"${EPREFIX}\"${LIBPATH} \
+ LOCLIBDIR=\"${EPREFIX}\"${LIBPATH}
+
+ cd "${ED}"${BINPATH}
+ insinto ${DATAPATH}/man/man1
+ local skips manpage
+ # ar brings an up-to-date manpage with it
+ skips=( ar )
+ for bin in *; do
+ for skip in ${skips[@]}; do
+ if [[ ${bin} == ${skip} ]]; then
+ continue 2;
+ fi
+ done
+ manpage=${S}/${CCTOOLS}/man/${bin}.1
+ if [[ -f "${manpage}" ]]; then
+ doins "${manpage}"
+ fi
+ done
+ insinto ${DATAPATH}/man/man5
+ doins "${S}"/${CCTOOLS}/man/*.5
+}
+
+src_test() {
+ if ! [ "${EPREFIX}"/usr/bin/clang ] ; then
+ einfo "Test suite only works properly with clang - please install"
+ return
+ fi
+
+ einfo "Running unit tests"
+ cd "${S}"/${LD64}/unit-tests/test-cases
+ # provide the new ld as a symlink to clang so that -ccc-install-dir
+ # will pick it up
+ ln -sfn ../../src/ld64 ld
+ # use our arch command because the System's will report i386 even for an
+ # x86_64 prefix
+ perl ../bin/make-recursive.pl \
+ BUILT_PRODUCTS_DIR="${S}"/${LD64}/src \
+ ARCH="$(arch)" \
+ LD="${S}"/${LD64}/src/ld64 \
+ CC="clang -ccc-install-dir $PWD" \
+ CXX="clang++ -ccc-install-dir $PWD" \
+ OTOOL="${S}"/${CCTOOLS}/otool/otool.NEW \
+ | perl ../bin/result-filter.pl
+}
+
+src_install() {
+ install_ld64
+ install_cctools
+
+ cd "${S}"
+ insinto /etc/env.d/binutils
+ cat <<-EOF > env.d
+ TARGET="${CHOST}"
+ VER="${PV}"
+ FAKE_TARGETS="${CHOST}"
+ EOF
+ newins env.d ${CHOST}-${PV}
+}
+
+pkg_postinst() {
+ binutils-config ${CHOST}-${PV}
+}
diff --git a/sys-devel/binutils-apple/binutils-apple-4.2.ebuild b/sys-devel/binutils-apple/binutils-apple-4.2.ebuild
new file mode 100644
index 000000000000..42439672c4de
--- /dev/null
+++ b/sys-devel/binutils-apple/binutils-apple-4.2.ebuild
@@ -0,0 +1,312 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils flag-o-matic toolchain-funcs
+
+RESTRICT="test" # the test suite will test what's installed.
+
+LD64=ld64-127.2
+CCTOOLS=cctools-809
+LIBUNWIND=libunwind-30
+DYLD=dyld-195.5
+# http://lists.apple.com/archives/Darwin-dev/2009/Sep/msg00025.html
+UNWIND=binutils-apple-3.2-unwind-patches-5
+
+DESCRIPTION="Darwin assembler as(1) and static linker ld(1), Xcode Tools ${PV}"
+HOMEPAGE="http://www.opensource.apple.com/darwinsource/"
+SRC_URI="http://www.opensource.apple.com/tarballs/ld64/${LD64}.tar.gz
+ http://www.opensource.apple.com/tarballs/cctools/${CCTOOLS}.tar.gz
+ http://www.opensource.apple.com/tarballs/libunwind/${LIBUNWIND}.tar.gz
+ http://www.opensource.apple.com/tarballs/dyld/${DYLD}.tar.gz
+ http://www.gentoo.org/~grobian/distfiles/${UNWIND}.tar.xz
+ http://www.gentoo.org/~grobian/distfiles/libunwind-llvm-115426.tar.bz2"
+
+LICENSE="APSL-2"
+KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
+IUSE="lto test"
+
+RDEPEND="sys-devel/binutils-config
+ lto? ( sys-devel/llvm )"
+DEPEND="${RDEPEND}
+ test? ( >=dev-lang/perl-5.8.8 )
+ >=sys-devel/gcc-apple-4.2.1"
+
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
+
+if is_cross ; then
+ SLOT="${CTARGET}-4"
+else
+ SLOT="4"
+fi
+
+LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
+INCPATH=${LIBPATH}/include
+DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV}
+if is_cross ; then
+ BINPATH=/usr/${CHOST}/${CTARGET}/binutils-bin/${PV}
+else
+ BINPATH=/usr/${CTARGET}/binutils-bin/${PV}
+fi
+
+S=${WORKDIR}
+
+src_prepare() {
+ cd "${S}"/${LIBUNWIND}/src
+ cp "${FILESDIR}"/${LIBUNWIND}-Makefile Makefile
+
+ cd "${S}"/${LD64}/src
+ cp "${FILESDIR}"/ld64-123.2-Makefile Makefile
+ epatch "${FILESDIR}"/${LD64}-lto.patch
+ epatch "${FILESDIR}"/${LD64}-ppc-range-warning.patch
+
+ ln -s ../../${CCTOOLS}/include
+ cp other/prune_trie.h include/mach-o/ || die
+ # use our own copy of lto.h, which doesn't require llvm build-env
+ mkdir -p include/llvm-c || die
+ cp "${WORKDIR}"/ld64-unwind/ld64-97.14-llvm-lto.h include/llvm-c/lto.h || die
+ # make libunwind sources known
+ ln -s ../../${LIBUNWIND}/src libunwind || die
+ cp ../../${LIBUNWIND}/include/*.h include/ || die
+ # mimic OS X Lion-style Availability.h macros
+ if [[ ${CHOST} == *darwin* && ${CHOST#*-darwin} -le 10 ]] ; then
+ {
+ echo "#define __OSX_AVAILABLE_STARTING(x,y) "
+ echo "#define __OSX_AVAILABLE_BUT_DEPRECATED(a,b,c,d) "
+ } > include/Availability.h
+ fi
+
+ echo '' > configure.h
+ echo '' > linker_opts
+ local VER_STR="\"@(#)PROGRAM:ld PROJECT:${LD64} (Gentoo ${PN}-${PVR})\\n\""
+ echo "char ldVersionString[] = ${VER_STR};" > version.cpp
+
+ epatch "${FILESDIR}"/ld64-123.2-debug-backtrace.patch
+ if [[ ${CHOST} == powerpc*-darwin* ]] ; then
+ epatch "${FILESDIR}"/ld64-123.2-darwin8-no-mlong-branch-warning.patch
+ sed -i -e '/#include <mach-o\/loader.h>/a\#include <mach/i386/thread_status.h>' \
+ ld/HeaderAndLoadCommands.hpp || die
+ fi
+ if use !lto ; then
+ sed -i -e '/#define LTO_SUPPORT 1/d' other/ObjectDump.cpp || die
+ fi
+
+ cd "${S}"/${CCTOOLS}
+ epatch "${FILESDIR}"/${PN}-4.0-as.patch
+ epatch "${FILESDIR}"/${PN}-4.2-as-dir.patch
+ epatch "${FILESDIR}"/${PN}-3.2.3-ranlib.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-libtool-ranlib.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-nmedit.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-no-headers.patch
+ epatch "${FILESDIR}"/${PN}-4.0-no-oss-dir.patch
+ epatch "${FILESDIR}"/${PN}-4.2-lto.patch
+
+ local program
+ for program in ar efitools gprof libmacho misc otool ; do
+ VER_STR="@(#)PROGRAM:${program} PROJECT:${CCTOOLS} (Gentoo ${PN}-${PVR}) DEVELOPER:${PORTAGE_ROOT_USER} BUILT:$(date)"
+ cat > ${program}/vers.c <<- _EOF
+ #include <sys/cdefs.h>
+ __IDSTRING(SGS_VERS,"${VER_STR}\n");
+ _EOF
+ [[ ${program} != "libmacho" ]] && \
+ echo '__IDSTRING(VERS_NUM,"apple");' >> ${program}/vers.c
+ done
+
+ VER_STR="${CCTOOLS} (Gentoo ${PN}-${PVR})"
+ echo "const char apple_version[] = \"${VER_STR}\";" \
+ >> as/apple_version.c || die
+ echo "const char apple_version[] = \"${VER_STR})\";" \
+ >> efitools/vers.c || die
+ echo "const char apple_version[] = \"${VER_STR})\";" \
+ >> ld/ld_vers.c || die
+ echo "const char apple_version[] = \"${VER_STR})\";" \
+ >> misc/vers.c || die
+
+ # clean up test suite
+ cd "${S}"/${LD64}
+# epatch "${FILESDIR}"/${PN}-3.1.1-testsuite.patch
+
+ cd "${S}"/${LD64}/unit-tests/test-cases
+ local c
+
+ # we don't have llvm
+ ((++c)); rm -rf llvm-integration;
+
+ # we don't have dtrace
+ ((++c)); rm -rf dtrace-static-probes-coalescing;
+ ((++c)); rm -rf dtrace-static-probes;
+
+ # a file is missing
+ ((++c)); rm -rf eh-coalescing-r
+
+ # we don't do universal binaries
+ ((++c)); rm -rf blank-stubs;
+
+ # looks like a problem with apple's result-filter.pl
+ ((++c)); rm -rf implicit-common3;
+ ((++c)); rm -rf order_file-ans;
+
+ # TODO no idea what goes wrong here
+ ((++c)); rm -rf dwarf-debug-notes;
+
+ einfo "Deleted $c tests that were bound to fail"
+
+ cd "${S}"
+ ebegin "cleaning Makefiles from unwanted CFLAGS"
+ find . -name "Makefile" -print0 | xargs -0 sed \
+ -i \
+ -e 's/ -g / /g' \
+ -e 's/^OFLAG =.*$/OFLAG =/' \
+ -e 's/install -c -s/install/g'
+ eend $?
+
+ # -pg is used and the two are incompatible
+ filter-flags -fomit-frame-pointer
+}
+
+src_configure() {
+ tc-export CC CXX AR
+ if use lto ; then
+ append-cppflags -DLTO_SUPPORT
+ append-ldflags -L"${EPREFIX}"/usr/$(get_libdir)/llvm
+ append-libs LTO
+ LTO=1
+ else
+ append-cppflags -ULTO_SUPPORT
+ LTO=0
+ fi
+ append-cppflags -DNDEBUG
+ append-cppflags -I"${WORKDIR}"/libunwind/include
+}
+
+compile_libunwind() {
+ # not used, just for testing, and possible use in the future
+ einfo "building ${LIBUNWIND}"
+ cd "${S}"/${LIBUNWIND}/src
+ emake DYLDINCS=-I../../${DYLD}/include || die
+}
+
+compile_ld64() {
+ einfo "building ${LD64}"
+ cd "${S}"/${LD64}/src
+ # remove antiquated copy that's available on any OSX system and
+ # breaks ld64 compilation
+ mv include/mach-o/dyld.h{,.disable}
+ emake \
+ LTO=${LTO} \
+ CFLAGS="${CFLAGS}" \
+ CXXFLAGS="${CXXFLAGS} -I../../${DYLD}/include" \
+ LDFLAGS="${LDFLAGS} ${LIBS}" \
+ || die "emake failed for ld64"
+ use test && emake build_test
+ # restore, it's necessary for cctools' install
+ mv include/mach-o/dyld.h{.disable,}
+}
+
+compile_cctools() {
+ einfo "building ${CCTOOLS}"
+ cd "${S}"/${CCTOOLS}
+ emake \
+ LIB_PRUNETRIE="-L../../${LD64}/src -lprunetrie" \
+ EFITOOLS= LTO= \
+ COMMON_SUBDIRS='libstuff ar misc otool' \
+ SUBDIRS_32= \
+ RC_CFLAGS="${CFLAGS}" OFLAG="${CFLAGS}" \
+ || die "emake failed for the cctools"
+ cd "${S}"/${CCTOOLS}/as
+ emake \
+ BUILD_OBSOLETE_ARCH= \
+ RC_CFLAGS="-DASLIBEXECDIR=\"\\\"${EPREFIX}${LIBPATH}/\\\"\" ${CFLAGS}" \
+ || die "emake failed for as"
+}
+
+src_compile() {
+ compile_ld64
+ compile_cctools
+}
+
+install_ld64() {
+ exeinto ${BINPATH}
+ doexe "${S}"/${LD64}/src/{ld64,rebase,dyldinfo,unwinddump,ObjectDump}
+ dosym ld64 ${BINPATH}/ld
+ insinto ${DATAPATH}/man/man1
+ doins "${S}"/${LD64}/doc/man/man1/{ld,ld64,rebase}.1
+}
+
+install_cctools() {
+ cd "${S}"/${CCTOOLS}
+ emake install_all_but_headers \
+ EFITOOLS= LTO= \
+ COMMON_SUBDIRS='ar misc otool' \
+ SUBDIRS_32= \
+ RC_CFLAGS="${CFLAGS}" OFLAG="${CFLAGS}" \
+ DSTROOT=\"${D}\" \
+ BINDIR=\"${EPREFIX}\"${BINPATH} \
+ LOCBINDIR=\"${EPREFIX}\"${BINPATH} \
+ USRBINDIR=\"${EPREFIX}\"${BINPATH} \
+ LOCLIBDIR=\"${EPREFIX}\"${LIBPATH} \
+ MANDIR=\"${EPREFIX}\"${DATAPATH}/man/
+ cd "${S}"/${CCTOOLS}/as
+ emake install \
+ BUILD_OBSOLETE_ARCH= \
+ DSTROOT=\"${D}\" \
+ USRBINDIR=\"${EPREFIX}\"${BINPATH} \
+ LIBDIR=\"${EPREFIX}\"${LIBPATH} \
+ LOCLIBDIR=\"${EPREFIX}\"${LIBPATH}
+
+ cd "${ED}"${BINPATH}
+ insinto ${DATAPATH}/man/man1
+ local skips manpage
+ # ar brings an up-to-date manpage with it
+ skips=( ar )
+ for bin in *; do
+ for skip in ${skips[@]}; do
+ if [[ ${bin} == ${skip} ]]; then
+ continue 2;
+ fi
+ done
+ manpage=${S}/${CCTOOLS}/man/${bin}.1
+ if [[ -f "${manpage}" ]]; then
+ doins "${manpage}"
+ fi
+ done
+ insinto ${DATAPATH}/man/man5
+ doins "${S}"/${CCTOOLS}/man/*.5
+}
+
+src_test() {
+ einfo "Running unit tests"
+ cd "${S}"/${LD64}/unit-tests/test-cases
+ # need host arch, since GNU arch doesn't do what Apple's does
+ tc-export CC CXX
+ perl ../bin/make-recursive.pl \
+ ARCH="$(/usr/bin/arch)" \
+ RELEASEDIR="${S}"/${LD64}/src \
+ | perl ../bin/result-filter.pl
+}
+
+src_install() {
+ install_ld64
+ install_cctools
+
+ cd "${S}"
+ insinto /etc/env.d/binutils
+ cat <<-EOF > env.d
+ TARGET="${CHOST}"
+ VER="${PV}"
+ FAKE_TARGETS="${CHOST}"
+ EOF
+ newins env.d ${CHOST}-${PV}
+}
+
+pkg_postinst() {
+ binutils-config ${CHOST}-${PV}
+}
diff --git a/sys-devel/binutils-apple/binutils-apple-4.3-r1.ebuild b/sys-devel/binutils-apple/binutils-apple-4.3-r1.ebuild
new file mode 100644
index 000000000000..5594369e4d9b
--- /dev/null
+++ b/sys-devel/binutils-apple/binutils-apple-4.3-r1.ebuild
@@ -0,0 +1,316 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils flag-o-matic toolchain-funcs
+
+LD64=ld64-128.2
+CCTOOLS_VERSION=822
+CCTOOLS=cctools-${CCTOOLS_VERSION}
+CCTOOLS_HEADERS=cctools-855
+LIBUNWIND=libunwind-30
+DYLD=dyld-195.6
+
+DESCRIPTION="Darwin assembler as(1) and static linker ld(1), Xcode Tools ${PV}"
+HOMEPAGE="http://www.opensource.apple.com/darwinsource/"
+SRC_URI="http://www.opensource.apple.com/tarballs/ld64/${LD64}.tar.gz
+ http://www.opensource.apple.com/tarballs/cctools/${CCTOOLS}.tar.gz
+ http://www.opensource.apple.com/tarballs/cctools/${CCTOOLS_HEADERS}.tar.gz
+ http://www.opensource.apple.com/tarballs/libunwind/${LIBUNWIND}.tar.gz
+ http://www.opensource.apple.com/tarballs/dyld/${DYLD}.tar.gz"
+
+LICENSE="APSL-2"
+KEYWORDS="~x64-macos ~x86-macos"
+IUSE="lto test"
+
+RDEPEND="sys-devel/binutils-config
+ lto? ( sys-devel/llvm )"
+DEPEND="${RDEPEND}
+ test? ( >=dev-lang/perl-5.8.8 )
+ || ( >=sys-devel/gcc-apple-4.2.1 sys-devel/llvm )"
+
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
+
+if is_cross ; then
+ SLOT="${CTARGET}-4"
+else
+ SLOT="4"
+fi
+
+LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
+INCPATH=${LIBPATH}/include
+DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV}
+if is_cross ; then
+ BINPATH=/usr/${CHOST}/${CTARGET}/binutils-bin/${PV}
+else
+ BINPATH=/usr/${CTARGET}/binutils-bin/${PV}
+fi
+
+S=${WORKDIR}
+
+src_prepare() {
+ cd "${S}"/${LD64}/src
+ cp "${FILESDIR}"/ld64-128.2-Makefile-2 Makefile
+ epatch "${FILESDIR}"/ld64-127.2-lto.patch
+ epatch "${FILESDIR}"/ld64-128.2-stdlib.patch
+ epatch "${FILESDIR}"/ld64-241.9-register-names.patch
+ epatch "${FILESDIR}"/ld64-241.9-get-comm-align.patch
+ epatch "${FILESDIR}"/ld64-241.9-cc_md5.patch
+ epatch "${FILESDIR}"/ld64-128.2-1010.patch
+
+ # We used to use our own copy of lto.h, which doesn't require llvm
+ # build-env. Current versions of llvm provide
+ # $EPREFIX/usr/include/llvm-c/lto.h as well as
+ # $EPREFIX/usr/lib/libLTO.{so,dylib}, so we just use these.
+
+ # provide missing headers from libunwind and dyld
+ mkdir -p include/{mach,mach-o/arm} || die
+ # never present because it's private
+ cp ../../${DYLD}/include/mach-o/dyld_priv.h include/mach-o || die
+ # missing on <= 10.5
+ cp ../../${LIBUNWIND}/include/libunwind.h include/ || die
+ cp ../../${LIBUNWIND}/include/mach-o/compact_unwind_encoding.h include/mach-o || die
+ # missing on <= 10.4
+ cp ../../${DYLD}/include/mach-o/dyld_images.h include/mach-o || die
+ cp ../../${CCTOOLS}/include/mach-o/loader.h include/mach-o || die
+ # use copies from cctools because they're otherwise hidden in some SDK
+ cp ../../${CCTOOLS}/include/mach-o/arm/reloc.h include/mach-o/arm || die
+ # provide all required CPU_TYPEs on all platforms
+ cp ../../${CCTOOLS}/include/mach/machine.h include/mach/machine.h
+ # add alias for newer identifiers, because ld64 uses both but cctools
+ # header only defines the older
+ epatch "${FILESDIR}"/ld64-236.3-missing-cputypes.patch
+
+ # mimic OS X Leopard-style Availability.h macros for libunwind.h on
+ # older systems
+ [[ ${CHOST} == *darwin* && ${CHOST#*-darwin} -le 8 ]] && \
+ echo "#define __OSX_AVAILABLE_STARTING(x,y) " > include/Availability.h
+
+ local VER_STR="\"@(#)PROGRAM:ld PROJECT:${LD64} (Gentoo ${PN}-${PVR})\\n\""
+ echo "char ldVersionString[] = ${VER_STR};" > version.cpp
+
+ epatch "${FILESDIR}"/ld64-123.2-debug-backtrace.patch
+
+ cd "${S}"/${CCTOOLS}
+ epatch "${FILESDIR}"/${PN}-4.0-as.patch
+ epatch "${FILESDIR}"/${PN}-4.2-as-dir.patch
+ epatch "${FILESDIR}"/${PN}-3.2.3-ranlib.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-libtool-ranlib.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-nmedit.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-no-headers.patch
+ epatch "${FILESDIR}"/${PN}-4.0-no-oss-dir.patch
+ epatch "${FILESDIR}"/${PN}-4.2-lto.patch
+ epatch "${FILESDIR}"/${PN}-5.1-extraneous-includes.patch
+ cp ../${LD64}/src/other/prune_trie.h include/mach-o/ || die
+ # __darwin_i386_float_state missing on <= 10.4
+ cp -a ../${CCTOOLS_HEADERS}/include/mach/i386 include/mach
+
+ # do not build profileable libstuff to save compile time
+ sed -i -e "/^all:/s, profile , ," libstuff/Makefile
+
+ # cctools version is provided to make via RC_ProjectSourceVersion which
+ # generates and compiles it as apple_version[] into libstuff. From
+ # there it's picked up by the individual tools. Since
+ # RC_ProjectSourceVersion is also used as library version, we can't
+ # just append our local version info. So we hack the libstuff Makefile
+ # to include our Gentoo version.
+ sed -i -e "/cctools-.*(RC_ProjectSourceVersion).*OFILE_DIR/s,Version),Version) (Gentoo ${PN}-${PVR})," \
+ libstuff/Makefile
+
+ # clean up test suite
+ cd "${S}"/${LD64}/unit-tests/test-cases
+ local c
+
+ # we don't have llvm
+ ((++c)); rm -rf llvm-integration;
+
+ # we don't have dtrace
+ ((++c)); rm -rf dtrace-static-probes-coalescing;
+ ((++c)); rm -rf dtrace-static-probes;
+
+ # a file is missing
+ ((++c)); rm -rf eh-coalescing-r
+
+ # we don't do universal binaries
+ ((++c)); rm -rf blank-stubs;
+
+ # looks like a problem with apple's result-filter.pl
+ ((++c)); rm -rf implicit-common3;
+ ((++c)); rm -rf order_file-ans;
+
+ # TODO no idea what goes wrong here
+ ((++c)); rm -rf dwarf-debug-notes;
+
+ einfo "Deleted $c tests that were bound to fail"
+
+ cd "${S}"
+ ebegin "cleaning Makefiles from unwanted CFLAGS"
+ find . -name "Makefile" -print0 | xargs -0 sed \
+ -i \
+ -e 's/ -g / /g' \
+ -e 's/^G =.*$/G =/' \
+ -e 's/^OFLAG =.*$/OFLAG =/' \
+ -e 's/install -c -s/install/g'
+ eend $?
+}
+
+src_configure() {
+ CCTOOLS_LTO=
+ LD64_LTO=0
+ if use lto ; then
+ CCTOOLS_LTO="-DLTO_SUPPORT"
+ LD64_LTO=1
+ fi
+
+ # CPPFLAGS only affects ld64, cctools don't use 'em (which currently is
+ # what we want)
+ append-cppflags -DNDEBUG
+
+ CCTOOLS_OFLAG=
+ if [[ ${CHOST} == *darwin* && ${CHOST#*-darwin} -le 8 ]] ; then
+ # cctools expect to use UNIX03 struct member names.
+ # This is default on > 10.4. Activate it on <= 10.4 by defining
+ # __DARWIN_UNIX03 explicitly.
+ CCTOOLS_OFLAG="-D__DARWIN_UNIX03=1"
+ fi
+
+ cat <<EOF > ${LD64}/src/configure.h
+#define DEFAULT_MACOSX_MIN_VERSION "${MACOSX_DEPLOYMENT_TARGET}"
+EOF
+}
+
+compile_ld64() {
+ einfo "building ${LD64}"
+ cd "${S}"/${LD64}/src
+ emake \
+ LTO=${LD64_LTO} \
+ || die "emake failed for ld64"
+ use test && emake build_test
+}
+
+compile_cctools() {
+ einfo "building ${CCTOOLS}"
+ cd "${S}"/${CCTOOLS}
+ # -j1 because it fails too often with weird errors
+ emake \
+ LIB_PRUNETRIE="-L../../${LD64}/src -lprunetrie" \
+ EFITOOLS= \
+ LTO="${CCTOOLS_LTO}" \
+ COMMON_SUBDIRS='libstuff ar misc otool' \
+ SUBDIRS_32= \
+ LEGACY= \
+ RC_ProjectSourceVersion=${CCTOOLS_VERSION} \
+ RC_CFLAGS="${CFLAGS}" \
+ OFLAG="${CCTOOLS_OFLAG}" \
+ -j1 \
+ || die "emake failed for the cctools"
+ cd "${S}"/${CCTOOLS}/as
+ emake \
+ BUILD_OBSOLETE_ARCH= \
+ RC_ProjectSourceVersion=${CCTOOLS_VERSION} \
+ RC_CFLAGS="-DASLIBEXECDIR=\"\\\"${EPREFIX}${LIBPATH}/\\\"\" ${CFLAGS}" \
+ OFLAG="${CCTOOLS_OFLAG}" \
+ || die "emake failed for as"
+}
+
+src_compile() {
+ compile_ld64
+ compile_cctools
+}
+
+install_ld64() {
+ exeinto ${BINPATH}
+ doexe "${S}"/${LD64}/src/{ld64,rebase,dyldinfo,unwinddump,ObjectDump}
+ dosym ld64 ${BINPATH}/ld
+ insinto ${DATAPATH}/man/man1
+ doins "${S}"/${LD64}/doc/man/man1/{ld,ld64,rebase}.1
+}
+
+install_cctools() {
+ cd "${S}"/${CCTOOLS}
+ emake install_all_but_headers \
+ EFITOOLS= \
+ COMMON_SUBDIRS='ar misc otool' \
+ SUBDIRS_32= \
+ DSTROOT=\"${D}\" \
+ BINDIR=\"${EPREFIX}\"${BINPATH} \
+ LOCBINDIR=\"${EPREFIX}\"${BINPATH} \
+ USRBINDIR=\"${EPREFIX}\"${BINPATH} \
+ LOCLIBDIR=\"${EPREFIX}\"${LIBPATH} \
+ MANDIR=\"${EPREFIX}\"${DATAPATH}/man/
+ cd "${S}"/${CCTOOLS}/as
+ emake install \
+ BUILD_OBSOLETE_ARCH= \
+ DSTROOT=\"${D}\" \
+ USRBINDIR=\"${EPREFIX}\"${BINPATH} \
+ LIBDIR=\"${EPREFIX}\"${LIBPATH} \
+ LOCLIBDIR=\"${EPREFIX}\"${LIBPATH}
+
+ cd "${ED}"${BINPATH}
+ insinto ${DATAPATH}/man/man1
+ local skips manpage
+ # ar brings an up-to-date manpage with it
+ skips=( ar )
+ for bin in *; do
+ for skip in ${skips[@]}; do
+ if [[ ${bin} == ${skip} ]]; then
+ continue 2;
+ fi
+ done
+ manpage=${S}/${CCTOOLS}/man/${bin}.1
+ if [[ -f "${manpage}" ]]; then
+ doins "${manpage}"
+ fi
+ done
+ insinto ${DATAPATH}/man/man5
+ doins "${S}"/${CCTOOLS}/man/*.5
+}
+
+src_test() {
+ if ! [ "${EPREFIX}"/usr/bin/clang ] ; then
+ einfo "Test suite only works properly with clang - please install"
+ return
+ fi
+
+ einfo "Running unit tests"
+ cd "${S}"/${LD64}/unit-tests/test-cases
+ # provide the new ld as a symlink to clang so that -ccc-install-dir
+ # will pick it up
+ ln -sfn ../../src/ld64 ld
+ # use our arch command because the System's will report i386 even for an
+ # x86_64 prefix
+ perl ../bin/make-recursive.pl \
+ BUILT_PRODUCTS_DIR="${S}"/${LD64}/src \
+ ARCH="$(arch)" \
+ LD="${S}"/${LD64}/src/ld64 \
+ CC="clang -ccc-install-dir $PWD" \
+ CXX="clang++ -ccc-install-dir $PWD" \
+ OTOOL="${S}"/${CCTOOLS}/otool/otool.NEW \
+ | perl ../bin/result-filter.pl
+}
+
+src_install() {
+ install_ld64
+ install_cctools
+
+ cd "${S}"
+ insinto /etc/env.d/binutils
+ cat <<-EOF > env.d
+ TARGET="${CHOST}"
+ VER="${PV}"
+ FAKE_TARGETS="${CHOST}"
+ EOF
+ newins env.d ${CHOST}-${PV}
+}
+
+pkg_postinst() {
+ binutils-config ${CHOST}-${PV}
+}
diff --git a/sys-devel/binutils-apple/binutils-apple-4.3.ebuild b/sys-devel/binutils-apple/binutils-apple-4.3.ebuild
new file mode 100644
index 000000000000..4a0809df76d9
--- /dev/null
+++ b/sys-devel/binutils-apple/binutils-apple-4.3.ebuild
@@ -0,0 +1,309 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils flag-o-matic toolchain-funcs
+
+RESTRICT="test" # the test suite will test what's installed.
+
+LD64=ld64-128.2
+CCTOOLS=cctools-822
+LIBUNWIND=libunwind-30
+DYLD=dyld-195.6
+# http://lists.apple.com/archives/Darwin-dev/2009/Sep/msg00025.html
+UNWIND=binutils-apple-3.2-unwind-patches-5
+
+DESCRIPTION="Darwin assembler as(1) and static linker ld(1), Xcode Tools ${PV}"
+HOMEPAGE="http://www.opensource.apple.com/darwinsource/"
+SRC_URI="http://www.opensource.apple.com/tarballs/ld64/${LD64}.tar.gz
+ http://www.opensource.apple.com/tarballs/cctools/${CCTOOLS}.tar.gz
+ http://www.opensource.apple.com/tarballs/libunwind/${LIBUNWIND}.tar.gz
+ http://www.opensource.apple.com/tarballs/dyld/${DYLD}.tar.gz
+ http://www.gentoo.org/~grobian/distfiles/${UNWIND}.tar.xz
+ http://www.gentoo.org/~grobian/distfiles/libunwind-llvm-115426.tar.bz2"
+
+LICENSE="APSL-2"
+KEYWORDS="~x64-macos ~x86-macos"
+IUSE="lto test"
+
+RDEPEND="sys-devel/binutils-config
+ lto? ( sys-devel/llvm )"
+DEPEND="${RDEPEND}
+ test? ( >=dev-lang/perl-5.8.8 )
+ >=sys-devel/gcc-apple-4.2.1"
+
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
+
+if is_cross ; then
+ SLOT="${CTARGET}-4"
+else
+ SLOT="4"
+fi
+
+LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
+INCPATH=${LIBPATH}/include
+DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV}
+if is_cross ; then
+ BINPATH=/usr/${CHOST}/${CTARGET}/binutils-bin/${PV}
+else
+ BINPATH=/usr/${CTARGET}/binutils-bin/${PV}
+fi
+
+S=${WORKDIR}
+
+src_prepare() {
+ cd "${S}"/${LIBUNWIND}/src
+ cp "${FILESDIR}"/${LIBUNWIND}-Makefile Makefile
+
+ cd "${S}"/${LD64}/src
+ cp "${FILESDIR}"/ld64-128.2-Makefile Makefile
+ epatch "${FILESDIR}"/ld64-127.2-lto.patch
+ epatch "${FILESDIR}"/ld64-128.2-stdlib.patch
+
+ ln -s ../../${CCTOOLS}/include
+ cp other/prune_trie.h include/mach-o/ || die
+ # use our own copy of lto.h, which doesn't require llvm build-env
+ mkdir -p include/llvm-c || die
+ cp "${WORKDIR}"/ld64-unwind/ld64-97.14-llvm-lto.h include/llvm-c/lto.h || die
+ # make libunwind sources known
+ ln -s ../../${LIBUNWIND}/src libunwind || die
+ cp ../../${LIBUNWIND}/include/*.h include/ || die
+ # mimic OS X Lion-style Availability.h macros
+ if [[ ${CHOST} == *darwin* && ${CHOST#*-darwin} -le 10 ]] ; then
+ {
+ echo "#define __OSX_AVAILABLE_STARTING(x,y) "
+ echo "#define __OSX_AVAILABLE_BUT_DEPRECATED(a,b,c,d) "
+ } > include/Availability.h
+ fi
+
+ echo '' > configure.h
+ echo '' > linker_opts
+ local VER_STR="\"@(#)PROGRAM:ld PROJECT:${LD64} (Gentoo ${PN}-${PVR})\\n\""
+ echo "char ldVersionString[] = ${VER_STR};" > version.cpp
+
+ epatch "${FILESDIR}"/ld64-123.2-debug-backtrace.patch
+ if use !lto ; then
+ sed -i -e '/#define LTO_SUPPORT 1/d' other/ObjectDump.cpp || die
+ fi
+
+ cd "${S}"/${CCTOOLS}
+ epatch "${FILESDIR}"/${PN}-4.0-as.patch
+ epatch "${FILESDIR}"/${PN}-4.2-as-dir.patch
+ epatch "${FILESDIR}"/${PN}-3.2.3-ranlib.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-libtool-ranlib.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-nmedit.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-no-headers.patch
+ epatch "${FILESDIR}"/${PN}-4.0-no-oss-dir.patch
+ epatch "${FILESDIR}"/${PN}-4.2-lto.patch
+
+ local program
+ for program in ar efitools gprof libmacho misc otool ; do
+ VER_STR="@(#)PROGRAM:${program} PROJECT:${CCTOOLS} (Gentoo ${PN}-${PVR}) DEVELOPER:${PORTAGE_ROOT_USER} BUILT:$(date)"
+ cat > ${program}/vers.c <<- _EOF
+ #include <sys/cdefs.h>
+ __IDSTRING(SGS_VERS,"${VER_STR}\n");
+ _EOF
+ [[ ${program} != "libmacho" ]] && \
+ echo '__IDSTRING(VERS_NUM,"apple");' >> ${program}/vers.c
+ done
+
+ VER_STR="${CCTOOLS} (Gentoo ${PN}-${PVR})"
+ echo "const char apple_version[] = \"${VER_STR}\";" \
+ >> as/apple_version.c || die
+ echo "const char apple_version[] = \"${VER_STR})\";" \
+ >> efitools/vers.c || die
+ echo "const char apple_version[] = \"${VER_STR})\";" \
+ >> ld/ld_vers.c || die
+ echo "const char apple_version[] = \"${VER_STR})\";" \
+ >> misc/vers.c || die
+
+ # clean up test suite
+ cd "${S}"/${LD64}
+# epatch "${FILESDIR}"/${PN}-3.1.1-testsuite.patch
+
+ cd "${S}"/${LD64}/unit-tests/test-cases
+ local c
+
+ # we don't have llvm
+ ((++c)); rm -rf llvm-integration;
+
+ # we don't have dtrace
+ ((++c)); rm -rf dtrace-static-probes-coalescing;
+ ((++c)); rm -rf dtrace-static-probes;
+
+ # a file is missing
+ ((++c)); rm -rf eh-coalescing-r
+
+ # we don't do universal binaries
+ ((++c)); rm -rf blank-stubs;
+
+ # looks like a problem with apple's result-filter.pl
+ ((++c)); rm -rf implicit-common3;
+ ((++c)); rm -rf order_file-ans;
+
+ # TODO no idea what goes wrong here
+ ((++c)); rm -rf dwarf-debug-notes;
+
+ einfo "Deleted $c tests that were bound to fail"
+
+ cd "${S}"
+ ebegin "cleaning Makefiles from unwanted CFLAGS"
+ find . -name "Makefile" -print0 | xargs -0 sed \
+ -i \
+ -e 's/ -g / /g' \
+ -e 's/^OFLAG =.*$/OFLAG =/' \
+ -e 's/install -c -s/install/g'
+ eend $?
+
+ # -pg is used and the two are incompatible
+ filter-flags -fomit-frame-pointer
+}
+
+src_configure() {
+ tc-export CC CXX AR
+ if use lto ; then
+ append-cppflags -DLTO_SUPPORT
+ append-ldflags -L"${EPREFIX}"/usr/$(get_libdir)/llvm
+ append-libs LTO
+ LTO=1
+ else
+ append-cppflags -ULTO_SUPPORT
+ LTO=0
+ fi
+ append-cppflags -DNDEBUG
+ append-cppflags -I"${WORKDIR}"/libunwind/include
+}
+
+compile_libunwind() {
+ # not used, just for testing, and possible use in the future
+ einfo "building ${LIBUNWIND}"
+ cd "${S}"/${LIBUNWIND}/src
+ emake DYLDINCS=-I../../${DYLD}/include || die
+}
+
+compile_ld64() {
+ einfo "building ${LD64}"
+ cd "${S}"/${LD64}/src
+ # remove antiquated copy that's available on any OSX system and
+ # breaks ld64 compilation
+ mv include/mach-o/dyld.h{,.disable}
+ emake \
+ LTO=${LTO} \
+ CFLAGS="${CFLAGS}" \
+ CXXFLAGS="${CXXFLAGS} -I../../${DYLD}/include" \
+ LDFLAGS="${LDFLAGS} ${LIBS}" \
+ || die "emake failed for ld64"
+ use test && emake build_test
+ # restore, it's necessary for cctools' install
+ mv include/mach-o/dyld.h{.disable,}
+}
+
+compile_cctools() {
+ einfo "building ${CCTOOLS}"
+ cd "${S}"/${CCTOOLS}
+ # -j1 because it fails too often with weird errors
+ emake \
+ LIB_PRUNETRIE="-L../../${LD64}/src -lprunetrie" \
+ EFITOOLS= LTO= \
+ COMMON_SUBDIRS='libstuff ar misc otool' \
+ SUBDIRS_32= \
+ RC_CFLAGS="${CFLAGS}" OFLAG="${CFLAGS}" \
+ -j1 \
+ || die "emake failed for the cctools"
+ cd "${S}"/${CCTOOLS}/as
+ emake \
+ BUILD_OBSOLETE_ARCH= \
+ RC_CFLAGS="-DASLIBEXECDIR=\"\\\"${EPREFIX}${LIBPATH}/\\\"\" ${CFLAGS}" \
+ || die "emake failed for as"
+}
+
+src_compile() {
+ compile_ld64
+ compile_cctools
+}
+
+install_ld64() {
+ exeinto ${BINPATH}
+ doexe "${S}"/${LD64}/src/{ld64,rebase,dyldinfo,unwinddump,ObjectDump}
+ dosym ld64 ${BINPATH}/ld
+ insinto ${DATAPATH}/man/man1
+ doins "${S}"/${LD64}/doc/man/man1/{ld,ld64,rebase}.1
+}
+
+install_cctools() {
+ cd "${S}"/${CCTOOLS}
+ emake install_all_but_headers \
+ EFITOOLS= LTO= \
+ COMMON_SUBDIRS='ar misc otool' \
+ SUBDIRS_32= \
+ RC_CFLAGS="${CFLAGS}" OFLAG="${CFLAGS}" \
+ DSTROOT=\"${D}\" \
+ BINDIR=\"${EPREFIX}\"${BINPATH} \
+ LOCBINDIR=\"${EPREFIX}\"${BINPATH} \
+ USRBINDIR=\"${EPREFIX}\"${BINPATH} \
+ LOCLIBDIR=\"${EPREFIX}\"${LIBPATH} \
+ MANDIR=\"${EPREFIX}\"${DATAPATH}/man/
+ cd "${S}"/${CCTOOLS}/as
+ emake install \
+ BUILD_OBSOLETE_ARCH= \
+ DSTROOT=\"${D}\" \
+ USRBINDIR=\"${EPREFIX}\"${BINPATH} \
+ LIBDIR=\"${EPREFIX}\"${LIBPATH} \
+ LOCLIBDIR=\"${EPREFIX}\"${LIBPATH}
+
+ cd "${ED}"${BINPATH}
+ insinto ${DATAPATH}/man/man1
+ local skips manpage
+ # ar brings an up-to-date manpage with it
+ skips=( ar )
+ for bin in *; do
+ for skip in ${skips[@]}; do
+ if [[ ${bin} == ${skip} ]]; then
+ continue 2;
+ fi
+ done
+ manpage=${S}/${CCTOOLS}/man/${bin}.1
+ if [[ -f "${manpage}" ]]; then
+ doins "${manpage}"
+ fi
+ done
+ insinto ${DATAPATH}/man/man5
+ doins "${S}"/${CCTOOLS}/man/*.5
+}
+
+src_test() {
+ einfo "Running unit tests"
+ cd "${S}"/${LD64}/unit-tests/test-cases
+ # need host arch, since GNU arch doesn't do what Apple's does
+ tc-export CC CXX
+ perl ../bin/make-recursive.pl \
+ ARCH="$(/usr/bin/arch)" \
+ RELEASEDIR="${S}"/${LD64}/src \
+ | perl ../bin/result-filter.pl
+}
+
+src_install() {
+ install_ld64
+ install_cctools
+
+ cd "${S}"
+ insinto /etc/env.d/binutils
+ cat <<-EOF > env.d
+ TARGET="${CHOST}"
+ VER="${PV}"
+ FAKE_TARGETS="${CHOST}"
+ EOF
+ newins env.d ${CHOST}-${PV}
+}
+
+pkg_postinst() {
+ binutils-config ${CHOST}-${PV}
+}
diff --git a/sys-devel/binutils-apple/binutils-apple-5.1.ebuild b/sys-devel/binutils-apple/binutils-apple-5.1.ebuild
new file mode 100644
index 000000000000..d6355c49deaf
--- /dev/null
+++ b/sys-devel/binutils-apple/binutils-apple-5.1.ebuild
@@ -0,0 +1,356 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils flag-o-matic toolchain-funcs
+
+LD64=ld64-236.3
+CCTOOLS_VERSION=855
+CCTOOLS=cctools-${CCTOOLS_VERSION}
+LIBUNWIND=libunwind-35.3
+DYLD=dyld-353.2.1
+
+DESCRIPTION="Darwin assembler as(1) and static linker ld(1), Xcode Tools ${PV}"
+HOMEPAGE="http://www.opensource.apple.com/darwinsource/"
+SRC_URI="http://www.opensource.apple.com/tarballs/ld64/${LD64}.tar.gz
+ http://www.opensource.apple.com/tarballs/cctools/${CCTOOLS}.tar.gz
+ http://www.opensource.apple.com/tarballs/dyld/${DYLD}.tar.gz
+ http://www.opensource.apple.com/tarballs/libunwind/${LIBUNWIND}.tar.gz"
+
+LICENSE="APSL-2"
+KEYWORDS="~x64-macos ~x86-macos"
+IUSE="lto test libcxx"
+
+RDEPEND="sys-devel/binutils-config
+ lto? ( sys-devel/llvm )
+ libcxx? ( sys-libs/libcxx )"
+DEPEND="${RDEPEND}
+ test? ( >=dev-lang/perl-5.8.8 )
+ || ( >=sys-devel/gcc-apple-4.2.1 sys-devel/llvm )
+ libcxx? ( sys-devel/llvm )"
+
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
+
+if is_cross ; then
+ SLOT="${CTARGET}-5"
+else
+ SLOT="5"
+fi
+
+LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
+INCPATH=${LIBPATH}/include
+DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV}
+if is_cross ; then
+ BINPATH=/usr/${CHOST}/${CTARGET}/binutils-bin/${PV}
+else
+ BINPATH=/usr/${CTARGET}/binutils-bin/${PV}
+fi
+
+S=${WORKDIR}
+
+src_prepare() {
+ cd "${S}"/${LD64}/src
+ cp "${FILESDIR}"/ld64-136-compile_stubs.h ld/compile_stubs.h
+ cp "${FILESDIR}"/ld64-236.3-Makefile Makefile
+
+ epatch "${FILESDIR}"/ld64-236.3-nolto.patch
+ epatch "${FILESDIR}"/ld64-241.9-extraneous-includes.patch
+ epatch "${FILESDIR}"/ld64-241.9-atomic-volatile.patch
+ epatch "${FILESDIR}"/ld64-236.3-arm64-fixup.patch
+ epatch "${FILESDIR}"/ld64-241.9-arm64-cputype.patch
+ epatch "${FILESDIR}"/ld64-236.3-crashreporter.patch
+ epatch "${FILESDIR}"/ld64-236.3-gcc.patch
+ epatch "${FILESDIR}"/ld64-236.3-constant-types.patch
+ epatch "${FILESDIR}"/ld64-236.3-nosnapshots.patch
+ epatch "${FILESDIR}"/ld64-236.3-noppc.patch
+ epatch "${FILESDIR}"/ld64-236.3-noarm.patch
+ epatch "${FILESDIR}"/ld64-241.9-register-names.patch
+ epatch "${FILESDIR}"/ld64-241.9-get-comm-align.patch
+ epatch "${FILESDIR}"/ld64-241.9-cc_md5.patch
+
+ # We used to use our own copy of lto.h, which doesn't require llvm
+ # build-env. Current versions of llvm provide
+ # $EPREFIX/usr/include/llvm-c/lto.h as well as
+ # $EPREFIX/usr/lib/libLTO.{so,dylib}, so we just use these.
+
+ # provide missing headers from libunwind and dyld
+ mkdir -p include/{mach,mach-o/arm} || die
+ # never present because it's private
+ cp ../../${DYLD}/include/mach-o/dyld_priv.h include/mach-o || die
+ # missing on <= 10.5
+ cp ../../${LIBUNWIND}/include/libunwind.h include/ || die
+ cp ../../${LIBUNWIND}/include/mach-o/compact_unwind_encoding.h include/mach-o || die
+ # missing on <= 10.4
+ cp ../../${DYLD}/include/mach-o/dyld_images.h include/mach-o || die
+ cp ../../${CCTOOLS}/include/mach-o/loader.h include/mach-o || die
+ # use copies from cctools because they're otherwise hidden in some SDK
+ cp ../../${CCTOOLS}/include/mach-o/arm/reloc.h include/mach-o/arm || die
+ # provide all required CPU_TYPEs on all platforms
+ cp ../../${CCTOOLS}/include/mach/machine.h include/mach/machine.h
+ # add alias for newer identifiers, because ld64 uses both but cctools
+ # header only defines the older
+ epatch "${FILESDIR}"/ld64-236.3-missing-cputypes.patch
+
+ # mimic OS X Leopard-style Availability.h macros for libunwind.h on
+ # older systems
+ [[ ${CHOST} == *darwin* && ${CHOST#*-darwin} -le 8 ]] && \
+ echo "#define __OSX_AVAILABLE_STARTING(x,y) " > include/Availability.h
+
+ local VER_STR="\"@(#)PROGRAM:ld PROJECT:${LD64} (Gentoo ${PN}-${PVR})\\n\""
+ echo "char ldVersionString[] = ${VER_STR};" > version.cpp
+
+ epatch "${FILESDIR}"/ld64-123.2-debug-backtrace.patch
+
+ cd "${S}"/${CCTOOLS}
+ epatch "${FILESDIR}"/${PN}-4.5-as.patch
+ epatch "${FILESDIR}"/${PN}-5.1-as-dir.patch
+ epatch "${FILESDIR}"/${PN}-5.1-ranlib.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-libtool-ranlib.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-no-headers.patch
+ epatch "${FILESDIR}"/${PN}-4.0-no-oss-dir.patch
+ epatch "${FILESDIR}"/${PN}-5.1-nolto.patch
+ epatch "${FILESDIR}"/cctools-839-intel-retf.patch
+ epatch "${FILESDIR}"/${PN}-5.1-extraneous-includes.patch
+ epatch "${FILESDIR}"/${PN}-5.1-otool-stdc.patch
+ epatch "${FILESDIR}"/${PN}-5.1-constant-types.patch
+ epatch "${FILESDIR}"/${PN}-5.1-strnlen.patch
+ cp ../${LD64}/src/other/prune_trie.h include/mach-o/ || die
+
+ # do not build profileable libstuff to save compile time
+ sed -i -e "/^all:/s, profile , ," libstuff/Makefile
+
+ # cctools version is provided to make via RC_ProjectSourceVersion which
+ # generates and compiles it as apple_version[] into libstuff. From
+ # there it's picked up by the individual tools. Since
+ # RC_ProjectSourceVersion is also used as library version, we can't
+ # just append our local version info. So we hack the libstuff Makefile
+ # to include our Gentoo version.
+ sed -i -e "/cctools-.*(RC_ProjectSourceVersion).*OFILE_DIR/s,Version),Version) (Gentoo ${PN}-${PVR})," \
+ libstuff/Makefile
+
+ # clean up test suite
+ cd "${S}"/${LD64}/unit-tests/test-cases
+ local c
+
+ # we don't have llvm
+ ((++c)); rm -rf llvm-integration;
+
+ # we don't have dtrace
+ ((++c)); rm -rf dtrace-static-probes-coalescing;
+ ((++c)); rm -rf dtrace-static-probes;
+
+ # a file is missing
+ ((++c)); rm -rf eh-coalescing-r
+
+ # we don't do universal binaries
+ ((++c)); rm -rf blank-stubs;
+
+ # looks like a problem with apple's result-filter.pl
+ ((++c)); rm -rf implicit-common3;
+ ((++c)); rm -rf order_file-ans;
+
+ # TODO no idea what goes wrong here
+ ((++c)); rm -rf dwarf-debug-notes;
+
+ einfo "Deleted $c tests that were bound to fail"
+
+ cd "${S}"
+ ebegin "cleaning Makefiles from unwanted CFLAGS"
+ find . -name "Makefile" -print0 | xargs -0 sed \
+ -i \
+ -e 's/ -g / /g' \
+ -e 's/^G =.*$/G =/' \
+ -e 's/^OFLAG =.*$/OFLAG =/' \
+ -e 's/install -c -s/install/g'
+ eend $?
+}
+
+src_configure() {
+ CCTOOLS_LTO=
+ LD64_LTO=0
+ if use lto ; then
+ CCTOOLS_LTO="-DLTO_SUPPORT"
+ LD64_LTO=1
+ fi
+
+ if [ "${CXX/*clang*/yes}" = "yes" ] ; then
+ if use libcxx ; then
+ append-cxxflags -stdlib=libc++
+ CXXLIB=-stdlib=libc++
+ else
+ # force libstdc++ for systems where libc++ is default (OS X 10.9+?)
+ append-cxxflags -stdlib=libstdc++
+ CXXLIB=-stdlib=libstdc++
+ fi
+ else
+ use libcxx && \
+ ewarn "libcxx only available with clang and your C++ compiler ($CXX) does not seem to be clang"
+ fi
+
+ # CPPFLAGS only affects ld64, cctools don't use 'em (which currently is
+ # what we want)
+ append-cppflags -DNDEBUG
+
+ # Block API and thus snapshots supported on >= 10.6
+ [[ ${CHOST} == *darwin* && ${CHOST#*-darwin} -ge 10 ]] && \
+ append-cppflags -DSUPPORT_SNAPSHOTS
+
+ CCTOOLS_OFLAG=
+ if [[ ${CHOST} == *darwin* && ${CHOST#*-darwin} -le 8 ]] ; then
+ # cctools expect to use UNIX03 struct member names.
+ # This is default on > 10.4. Activate it on <= 10.4 by defining
+ # __DARWIN_UNIX03 explicitly.
+ CCTOOLS_OFLAG="-D__DARWIN_UNIX03=1"
+ fi
+
+ # Create configure.h for ld64 with SUPPORT_ARCH_<arch> defines in it.
+ # RC_SUPPORTED_ARCHS="i386 x86_64 x86_64h armv6 ..." can be used to
+ # override architectures (there are more arms to add) but we configure
+ # with the default to be in line with Xcode's ld.
+ DERIVED_FILE_DIR=${LD64}/src \
+ RC_SUPPORTED_ARCHS="" \
+ ${LD64}/src/create_configure
+}
+
+compile_ld64() {
+ einfo "building ${LD64}"
+ cd "${S}"/${LD64}/src
+ emake \
+ LTO=${LD64_LTO} \
+ || die "emake failed for ld64"
+ use test && emake build_test
+}
+
+compile_cctools() {
+ einfo "building ${CCTOOLS}"
+ cd "${S}"/${CCTOOLS}
+ # -j1 because it fails too often with weird errors
+ # Suppress running dsymutil because it will warn about missing debug
+ # info which is expected when compiling without -g as we normally do.
+ # This might need some more thought if anyone ever wanted to build us
+ # for debugging with Apple's tools.
+ emake \
+ LIB_PRUNETRIE="-L../../${LD64}/src -lprunetrie" \
+ EFITOOLS= \
+ LTO="${CCTOOLS_LTO}" \
+ COMMON_SUBDIRS='libstuff ar misc otool' \
+ SUBDIRS_32= \
+ LEGACY= \
+ RC_ProjectSourceVersion=${CCTOOLS_VERSION} \
+ RC_CFLAGS="${CFLAGS}" \
+ OFLAG="${CCTOOLS_OFLAG}" \
+ CXXLIB="${CXXLIB}" \
+ DSYMUTIL=": disabled: dsymutil" \
+ -j1 \
+ || die "emake failed for the cctools"
+ cd "${S}"/${CCTOOLS}/as
+ emake \
+ BUILD_OBSOLETE_ARCH= \
+ RC_ProjectSourceVersion=${CCTOOLS_VERSION} \
+ RC_CFLAGS="-DASLIBEXECDIR=\"\\\"${EPREFIX}${LIBPATH}/\\\"\" ${CFLAGS}" \
+ OFLAG="${CCTOOLS_OFLAG}" \
+ DSYMUTIL=": disabled: dsymutil" \
+ || die "emake failed for as"
+}
+
+src_compile() {
+ compile_ld64
+ compile_cctools
+}
+
+install_ld64() {
+ exeinto ${BINPATH}
+ doexe "${S}"/${LD64}/src/{ld64,rebase,dyldinfo,unwinddump,ObjectDump}
+ dosym ld64 ${BINPATH}/ld
+ insinto ${DATAPATH}/man/man1
+ doins "${S}"/${LD64}/doc/man/man1/{ld,ld64,rebase}.1
+}
+
+install_cctools() {
+ cd "${S}"/${CCTOOLS}
+ emake install_all_but_headers \
+ EFITOOLS= \
+ COMMON_SUBDIRS='ar misc otool' \
+ SUBDIRS_32= \
+ DSTROOT=\"${D}\" \
+ BINDIR=\"${EPREFIX}\"${BINPATH} \
+ LOCBINDIR=\"${EPREFIX}\"${BINPATH} \
+ USRBINDIR=\"${EPREFIX}\"${BINPATH} \
+ LOCLIBDIR=\"${EPREFIX}\"${LIBPATH} \
+ MANDIR=\"${EPREFIX}\"${DATAPATH}/man/
+ cd "${S}"/${CCTOOLS}/as
+ emake install \
+ BUILD_OBSOLETE_ARCH= \
+ DSTROOT=\"${D}\" \
+ USRBINDIR=\"${EPREFIX}\"${BINPATH} \
+ LIBDIR=\"${EPREFIX}\"${LIBPATH} \
+ LOCLIBDIR=\"${EPREFIX}\"${LIBPATH}
+
+ cd "${ED}"${BINPATH}
+ insinto ${DATAPATH}/man/man1
+ local skips manpage
+ # ar brings an up-to-date manpage with it
+ skips=( ar )
+ for bin in *; do
+ for skip in ${skips[@]}; do
+ if [[ ${bin} == ${skip} ]]; then
+ continue 2;
+ fi
+ done
+ manpage=${S}/${CCTOOLS}/man/${bin}.1
+ if [[ -f "${manpage}" ]]; then
+ doins "${manpage}"
+ fi
+ done
+ insinto ${DATAPATH}/man/man5
+ doins "${S}"/${CCTOOLS}/man/*.5
+}
+
+src_test() {
+ if ! [ "${EPREFIX}"/usr/bin/clang ] ; then
+ einfo "Test suite only works properly with clang - please install"
+ return
+ fi
+
+ einfo "Running unit tests"
+ cd "${S}"/${LD64}/unit-tests/test-cases
+ # provide the new ld as a symlink to clang so that -ccc-install-dir
+ # will pick it up
+ ln -sfn ../../src/ld64 ld
+ # use our arch command because the System's will report i386 even for an
+ # x86_64 prefix
+ perl ../bin/make-recursive.pl \
+ BUILT_PRODUCTS_DIR="${S}"/${LD64}/src \
+ ARCH="$(arch)" \
+ LD="${S}"/${LD64}/src/ld64 \
+ CC="clang -ccc-install-dir $PWD" \
+ CXX="clang++ -ccc-install-dir $PWD" \
+ OTOOL="${S}"/${CCTOOLS}/otool/otool.NEW \
+ | perl ../bin/result-filter.pl
+}
+
+src_install() {
+ install_ld64
+ install_cctools
+
+ cd "${S}"
+ insinto /etc/env.d/binutils
+ cat <<-EOF > env.d
+ TARGET="${CHOST}"
+ VER="${PV}"
+ FAKE_TARGETS="${CHOST}"
+ EOF
+ newins env.d ${CHOST}-${PV}
+}
+
+pkg_postinst() {
+ binutils-config ${CHOST}-${PV}
+}
diff --git a/sys-devel/binutils-apple/binutils-apple-6.1.ebuild b/sys-devel/binutils-apple/binutils-apple-6.1.ebuild
new file mode 100644
index 000000000000..7554c4e88581
--- /dev/null
+++ b/sys-devel/binutils-apple/binutils-apple-6.1.ebuild
@@ -0,0 +1,355 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils flag-o-matic toolchain-funcs
+
+LD64=ld64-241.9
+CCTOOLS_VERSION=862
+CCTOOLS=cctools-${CCTOOLS_VERSION}
+LIBUNWIND=libunwind-35.3
+DYLD=dyld-353.2.1
+
+DESCRIPTION="Darwin assembler as(1) and static linker ld(1), Xcode Tools ${PV}"
+HOMEPAGE="http://www.opensource.apple.com/darwinsource/"
+SRC_URI="http://www.opensource.apple.com/tarballs/ld64/${LD64}.tar.gz
+ http://www.opensource.apple.com/tarballs/cctools/${CCTOOLS}.tar.gz
+ http://www.opensource.apple.com/tarballs/dyld/${DYLD}.tar.gz
+ http://www.opensource.apple.com/tarballs/libunwind/${LIBUNWIND}.tar.gz"
+
+LICENSE="APSL-2"
+KEYWORDS="~x64-macos ~x86-macos"
+IUSE="lto test libcxx"
+
+RDEPEND="sys-devel/binutils-config
+ lto? ( sys-devel/llvm )
+ libcxx? ( sys-libs/libcxx )"
+DEPEND="${RDEPEND}
+ test? ( >=dev-lang/perl-5.8.8 )
+ || ( >=sys-devel/gcc-apple-4.2.1 sys-devel/llvm )
+ libcxx? ( sys-devel/llvm )"
+
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
+
+if is_cross ; then
+ SLOT="${CTARGET}-6"
+else
+ SLOT="6"
+fi
+
+LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
+INCPATH=${LIBPATH}/include
+DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV}
+if is_cross ; then
+ BINPATH=/usr/${CHOST}/${CTARGET}/binutils-bin/${PV}
+else
+ BINPATH=/usr/${CTARGET}/binutils-bin/${PV}
+fi
+
+S=${WORKDIR}
+
+src_prepare() {
+ cd "${S}"/${LD64}/src
+ cp "${FILESDIR}"/ld64-136-compile_stubs.h ld/compile_stubs.h
+ cp "${FILESDIR}"/ld64-236.3-Makefile Makefile
+
+ epatch "${FILESDIR}"/ld64-236.3-nolto.patch
+ epatch "${FILESDIR}"/ld64-241.9-extraneous-includes.patch
+ epatch "${FILESDIR}"/ld64-241.9-atomic-volatile.patch
+ epatch "${FILESDIR}"/ld64-241.9-arm64-cputype.patch
+ epatch "${FILESDIR}"/ld64-236.3-crashreporter.patch
+ epatch "${FILESDIR}"/ld64-241.9-gcc.patch
+ epatch "${FILESDIR}"/ld64-236.3-constant-types.patch
+ epatch "${FILESDIR}"/ld64-241.9-nosnapshots.patch
+ epatch "${FILESDIR}"/ld64-241.9-noarm.patch
+ epatch "${FILESDIR}"/ld64-241.9-register-names.patch
+ epatch "${FILESDIR}"/ld64-241.9-get-comm-align.patch
+ epatch "${FILESDIR}"/ld64-241.9-cc_md5.patch
+ epatch "${FILESDIR}"/ld64-241.9-lto-noremarks.patch
+
+ # We used to use our own copy of lto.h, which doesn't require llvm
+ # build-env. Current versions of llvm provide
+ # $EPREFIX/usr/include/llvm-c/lto.h as well as
+ # $EPREFIX/usr/lib/libLTO.{so,dylib}, so we just use these.
+
+ # provide missing headers from libunwind and dyld
+ mkdir -p include/{mach,mach-o/arm} || die
+ # never present because it's private
+ cp ../../${DYLD}/include/mach-o/dyld_priv.h include/mach-o || die
+ # missing on <= 10.5
+ cp ../../${LIBUNWIND}/include/libunwind.h include/ || die
+ cp ../../${LIBUNWIND}/include/mach-o/compact_unwind_encoding.h include/mach-o || die
+ # missing on <= 10.4
+ cp ../../${DYLD}/include/mach-o/dyld_images.h include/mach-o || die
+ cp ../../${CCTOOLS}/include/mach-o/loader.h include/mach-o || die
+ # use copies from cctools because they're otherwise hidden in some SDK
+ cp ../../${CCTOOLS}/include/mach-o/arm/reloc.h include/mach-o/arm || die
+ # provide all required CPU_TYPEs on all platforms
+ cp ../../${CCTOOLS}/include/mach/machine.h include/mach/machine.h
+ # add alias for newer identifiers, because ld64 uses both but cctools
+ # header only defines the older
+ epatch "${FILESDIR}"/ld64-236.3-missing-cputypes.patch
+
+ # mimic OS X Leopard-style Availability.h macros for libunwind.h on
+ # older systems
+ [[ ${CHOST} == *darwin* && ${CHOST#*-darwin} -le 8 ]] && \
+ echo "#define __OSX_AVAILABLE_STARTING(x,y) " > include/Availability.h
+
+ local VER_STR="\"@(#)PROGRAM:ld PROJECT:${LD64} (Gentoo ${PN}-${PVR})\\n\""
+ echo "char ldVersionString[] = ${VER_STR};" > version.cpp
+
+ epatch "${FILESDIR}"/ld64-123.2-debug-backtrace.patch
+
+ cd "${S}"/${CCTOOLS}
+ epatch "${FILESDIR}"/${PN}-4.5-as.patch
+ epatch "${FILESDIR}"/${PN}-5.1-as-dir.patch
+ epatch "${FILESDIR}"/${PN}-5.1-ranlib.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-libtool-ranlib.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-no-headers.patch
+ epatch "${FILESDIR}"/${PN}-4.0-no-oss-dir.patch
+ epatch "${FILESDIR}"/${PN}-5.1-nolto.patch
+ epatch "${FILESDIR}"/cctools-839-intel-retf.patch
+ epatch "${FILESDIR}"/${PN}-5.1-extraneous-includes.patch
+ epatch "${FILESDIR}"/${PN}-5.1-otool-stdc.patch
+ epatch "${FILESDIR}"/${PN}-5.1-constant-types.patch
+ epatch "${FILESDIR}"/${PN}-5.1-strnlen.patch
+ cp ../${LD64}/src/other/prune_trie.h include/mach-o/ || die
+
+ # do not build profileable libstuff to save compile time
+ sed -i -e "/^all:/s, profile , ," libstuff/Makefile
+
+ # cctools version is provided to make via RC_ProjectSourceVersion which
+ # generates and compiles it as apple_version[] into libstuff. From
+ # there it's picked up by the individual tools. Since
+ # RC_ProjectSourceVersion is also used as library version, we can't
+ # just append our local version info. So we hack the libstuff Makefile
+ # to include our Gentoo version.
+ sed -i -e "/cctools-.*(RC_ProjectSourceVersion).*OFILE_DIR/s,Version),Version) (Gentoo ${PN}-${PVR})," \
+ libstuff/Makefile
+
+ # clean up test suite
+ cd "${S}"/${LD64}/unit-tests/test-cases
+ local c
+
+ # we don't have llvm
+ ((++c)); rm -rf llvm-integration;
+
+ # we don't have dtrace
+ ((++c)); rm -rf dtrace-static-probes-coalescing;
+ ((++c)); rm -rf dtrace-static-probes;
+
+ # a file is missing
+ ((++c)); rm -rf eh-coalescing-r
+
+ # we don't do universal binaries
+ ((++c)); rm -rf blank-stubs;
+
+ # looks like a problem with apple's result-filter.pl
+ ((++c)); rm -rf implicit-common3;
+ ((++c)); rm -rf order_file-ans;
+
+ # TODO no idea what goes wrong here
+ ((++c)); rm -rf dwarf-debug-notes;
+
+ einfo "Deleted $c tests that were bound to fail"
+
+ cd "${S}"
+ ebegin "cleaning Makefiles from unwanted CFLAGS"
+ find . -name "Makefile" -print0 | xargs -0 sed \
+ -i \
+ -e 's/ -g / /g' \
+ -e 's/^G =.*$/G =/' \
+ -e 's/^OFLAG =.*$/OFLAG =/' \
+ -e 's/install -c -s/install/g'
+ eend $?
+}
+
+src_configure() {
+ CCTOOLS_LTO=
+ LD64_LTO=0
+ if use lto ; then
+ CCTOOLS_LTO="-DLTO_SUPPORT"
+ LD64_LTO=1
+ fi
+
+ if [ "${CXX/*clang*/yes}" = "yes" ] ; then
+ if use libcxx ; then
+ append-cxxflags -stdlib=libc++
+ CXXLIB=-stdlib=libc++
+ else
+ # force libstdc++ for systems where libc++ is default (OS X 10.9+?)
+ append-cxxflags -stdlib=libstdc++
+ CXXLIB=-stdlib=libstdc++
+ fi
+ else
+ use libcxx && \
+ ewarn "libcxx only available with clang and your C++ compiler ($CXX) does not seem to be clang"
+ fi
+
+ # CPPFLAGS only affects ld64, cctools don't use 'em (which currently is
+ # what we want)
+ append-cppflags -DNDEBUG
+
+ # Block API and thus snapshots supported on >= 10.6
+ [[ ${CHOST} == *darwin* && ${CHOST#*-darwin} -ge 10 ]] && \
+ append-cppflags -DSUPPORT_SNAPSHOTS
+
+ CCTOOLS_OFLAG=
+ if [[ ${CHOST} == *darwin* && ${CHOST#*-darwin} -le 8 ]] ; then
+ # cctools expect to use UNIX03 struct member names.
+ # This is default on > 10.4. Activate it on <= 10.4 by defining
+ # __DARWIN_UNIX03 explicitly.
+ CCTOOLS_OFLAG="-D__DARWIN_UNIX03=1"
+ fi
+
+ # Create configure.h for ld64 with SUPPORT_ARCH_<arch> defines in it.
+ # RC_SUPPORTED_ARCHS="i386 x86_64 x86_64h armv6 ..." can be used to
+ # override architectures (there are more arms to add) but we configure
+ # with the default to be in line with Xcode's ld.
+ DERIVED_FILE_DIR=${LD64}/src \
+ RC_SUPPORTED_ARCHS="" \
+ ${LD64}/src/create_configure
+}
+
+compile_ld64() {
+ einfo "building ${LD64}"
+ cd "${S}"/${LD64}/src
+ emake \
+ LTO=${LD64_LTO} \
+ || die "emake failed for ld64"
+ use test && emake build_test
+}
+
+compile_cctools() {
+ einfo "building ${CCTOOLS}"
+ cd "${S}"/${CCTOOLS}
+ # -j1 because it fails too often with weird errors
+ # Suppress running dsymutil because it will warn about missing debug
+ # info which is expected when compiling without -g as we normally do.
+ # This might need some more thought if anyone ever wanted to build us
+ # for debugging with Apple's tools.
+ emake \
+ LIB_PRUNETRIE="-L../../${LD64}/src -lprunetrie" \
+ EFITOOLS= \
+ LTO="${CCTOOLS_LTO}" \
+ COMMON_SUBDIRS='libstuff ar misc otool' \
+ SUBDIRS_32= \
+ LEGACY= \
+ RC_ProjectSourceVersion=${CCTOOLS_VERSION} \
+ RC_CFLAGS="${CFLAGS}" \
+ OFLAG="${CCTOOLS_OFLAG}" \
+ CXXLIB="${CXXLIB}" \
+ DSYMUTIL=": disabled: dsymutil" \
+ -j1 \
+ || die "emake failed for the cctools"
+ cd "${S}"/${CCTOOLS}/as
+ emake \
+ BUILD_OBSOLETE_ARCH= \
+ RC_ProjectSourceVersion=${CCTOOLS_VERSION} \
+ RC_CFLAGS="-DASLIBEXECDIR=\"\\\"${EPREFIX}${LIBPATH}/\\\"\" ${CFLAGS}" \
+ OFLAG="${CCTOOLS_OFLAG}" \
+ DSYMUTIL=": disabled: dsymutil" \
+ || die "emake failed for as"
+}
+
+src_compile() {
+ compile_ld64
+ compile_cctools
+}
+
+install_ld64() {
+ exeinto ${BINPATH}
+ doexe "${S}"/${LD64}/src/{ld64,rebase,dyldinfo,unwinddump,ObjectDump}
+ dosym ld64 ${BINPATH}/ld
+ insinto ${DATAPATH}/man/man1
+ doins "${S}"/${LD64}/doc/man/man1/{ld,ld64,rebase}.1
+}
+
+install_cctools() {
+ cd "${S}"/${CCTOOLS}
+ emake install_all_but_headers \
+ EFITOOLS= \
+ COMMON_SUBDIRS='ar misc otool' \
+ SUBDIRS_32= \
+ DSTROOT=\"${D}\" \
+ BINDIR=\"${EPREFIX}\"${BINPATH} \
+ LOCBINDIR=\"${EPREFIX}\"${BINPATH} \
+ USRBINDIR=\"${EPREFIX}\"${BINPATH} \
+ LOCLIBDIR=\"${EPREFIX}\"${LIBPATH} \
+ MANDIR=\"${EPREFIX}\"${DATAPATH}/man/
+ cd "${S}"/${CCTOOLS}/as
+ emake install \
+ BUILD_OBSOLETE_ARCH= \
+ DSTROOT=\"${D}\" \
+ USRBINDIR=\"${EPREFIX}\"${BINPATH} \
+ LIBDIR=\"${EPREFIX}\"${LIBPATH} \
+ LOCLIBDIR=\"${EPREFIX}\"${LIBPATH}
+
+ cd "${ED}"${BINPATH}
+ insinto ${DATAPATH}/man/man1
+ local skips manpage
+ # ar brings an up-to-date manpage with it
+ skips=( ar )
+ for bin in *; do
+ for skip in ${skips[@]}; do
+ if [[ ${bin} == ${skip} ]]; then
+ continue 2;
+ fi
+ done
+ manpage=${S}/${CCTOOLS}/man/${bin}.1
+ if [[ -f "${manpage}" ]]; then
+ doins "${manpage}"
+ fi
+ done
+ insinto ${DATAPATH}/man/man5
+ doins "${S}"/${CCTOOLS}/man/*.5
+}
+
+src_test() {
+ if ! [ "${EPREFIX}"/usr/bin/clang ] ; then
+ einfo "Test suite only works properly with clang - please install"
+ return
+ fi
+
+ einfo "Running unit tests"
+ cd "${S}"/${LD64}/unit-tests/test-cases
+ # provide the new ld as a symlink to clang so that -ccc-install-dir
+ # will pick it up
+ ln -sfn ../../src/ld64 ld
+ # use our arch command because the System's will report i386 even for an
+ # x86_64 prefix
+ perl ../bin/make-recursive.pl \
+ BUILT_PRODUCTS_DIR="${S}"/${LD64}/src \
+ ARCH="$(arch)" \
+ LD="${S}"/${LD64}/src/ld64 \
+ CC="clang -ccc-install-dir $PWD" \
+ CXX="clang++ -ccc-install-dir $PWD" \
+ OTOOL="${S}"/${CCTOOLS}/otool/otool.NEW \
+ | perl ../bin/result-filter.pl
+}
+
+src_install() {
+ install_ld64
+ install_cctools
+
+ cd "${S}"
+ insinto /etc/env.d/binutils
+ cat <<-EOF > env.d
+ TARGET="${CHOST}"
+ VER="${PV}"
+ FAKE_TARGETS="${CHOST}"
+ EOF
+ newins env.d ${CHOST}-${PV}
+}
+
+pkg_postinst() {
+ binutils-config ${CHOST}-${PV}
+}
diff --git a/sys-devel/binutils-apple/files/Makefile b/sys-devel/binutils-apple/files/Makefile
new file mode 100644
index 000000000000..9d8f92818a87
--- /dev/null
+++ b/sys-devel/binutils-apple/files/Makefile
@@ -0,0 +1,12 @@
+all: ld64 rebase
+
+build_test: machocheck ObjectDump
+
+ld64: debugline.o Options.o ld.o version.o
+ $(CXX) $(LDFLAGS) -o $@ $^
+
+machocheck: machochecker.o
+ $(CXX) $(LDFLAGS) -o $@ $^
+
+ObjectDump: ObjectDump.o debugline.o
+ $(CXX) $(LDFLAGS) -o $@ $^
diff --git a/sys-devel/binutils-apple/files/binutils-apple-3.1.1-as-dir.patch b/sys-devel/binutils-apple/files/binutils-apple-3.1.1-as-dir.patch
new file mode 100644
index 000000000000..8d9203e33953
--- /dev/null
+++ b/sys-devel/binutils-apple/files/binutils-apple-3.1.1-as-dir.patch
@@ -0,0 +1,69 @@
+handles the libexecdir for as and other fixes
+
+--- cctools-698/as/driver.c
++++ cctools-698/as/driver.c
+@@ -27,6 +27,9 @@
+ char **envp)
+ {
+ const char *LIB =
++#ifdef ASLIBEXECDIR
++ ASLIBEXECDIR;
++#else
+ #if defined(__OPENSTEP__) || defined(__HERA__) || \
+ defined(__GONZO_BUNSEN_BEAKER__) || defined(__KODIAK__)
+ "/usr/libexec/";
+@@ -40,6 +42,7 @@
+ #else
+ "/usr/local/libexec/gcc/darwin/";
+ #endif
++#endif
+ const char *AS = "/as";
+
+ int i;
+@@ -170,7 +170,11 @@
+ }
+
+ }
++#ifndef ASLIBEXECDIR
+ as = makestr(prefix, LIB, arch_name, AS, NULL);
++#else
++ as = makestr(LIB, arch_name, AS, NULL);
++#endif
+
+ /*
+ * If this assembler exist try to run it else print an error message.
+@@ -182,6 +182,9 @@
+ else
+ exit(1);
+ }
++#ifdef ASLIBEXECDIR
++ as_local = "";
++#else
+ as_local = makestr(prefix, LOCALLIB, arch_name, AS, NULL);
+ if(access(as_local, F_OK) == 0){
+ argv[0] = as_local;
+@@ -193,6 +198,8 @@
+ exit(1);
+ }
+ else{
++#endif
++ {
+ printf("%s: assembler (%s or %s) for architecture %s not "
+ "installed\n", progname, as, as_local, arch_name);
+ arch_flags = get_arch_flags();
+@@ -183,6 +190,7 @@
+ printf("%s for architecture %s\n", as, arch_flags[i].name);
+ count++;
+ }
++#ifndef ASLIBEXECDIR
+ else{
+ as_local = makestr(LOCALLIB, arch_flags[i].name, AS, NULL);
+ if(access(as_local, F_OK) == 0){
+@@ -193,6 +201,7 @@
+ count++;
+ }
+ }
++#endif
+ }
+ if(count == 0)
+ printf("%s: no assemblers installed\n", progname);
diff --git a/sys-devel/binutils-apple/files/binutils-apple-3.1.1-as.patch b/sys-devel/binutils-apple/files/binutils-apple-3.1.1-as.patch
new file mode 100644
index 000000000000..c0cff44550db
--- /dev/null
+++ b/sys-devel/binutils-apple/files/binutils-apple-3.1.1-as.patch
@@ -0,0 +1,98 @@
+make building for obsolete architectures optional.
+
+--- cctools-698/as/Makefile
++++ cctools-698/as/Makefile
+@@ -1,3 +1,4 @@
++BUILD_OBSOLETE_ARCH = yes
+ RC_OS = macos
+ export USE_APPLE_PB_SUPPORT = all
+ OFLAG = -Os
+@@ -31,26 +32,34 @@
+ SYMROOT = .
+ OBJROOT = .
+ SYM_DIRS = $(SYMROOT)/driver_dir \
+- $(SYMROOT)/a68_dir \
+- $(SYMROOT)/a88_dir \
+ $(SYMROOT)/a386_dir \
+ $(SYMROOT)/ax86_64_dir \
+ $(SYMROOT)/appc_dir \
+- $(SYMROOT)/appc64_dir \
++ $(SYMROOT)/appc64_dir
++
++ifeq "yes" "$(BUILD_OBSOLETE_ARCH)"
++SYM_DIRS += \
++ $(SYMROOT)/a68_dir \
++ $(SYMROOT)/a88_dir \
+ $(SYMROOT)/a860_dir \
+ $(SYMROOT)/ahppa_dir \
+ $(SYMROOT)/asparc_dir
++endif
+
+ OFILE_DIRS = $(OBJROOT)/driver_dir \
+- $(OBJROOT)/a68_dir \
+- $(OBJROOT)/a88_dir \
+ $(OBJROOT)/a386_dir \
+ $(OBJROOT)/ax86_64_dir \
+ $(OBJROOT)/appc_dir \
+- $(OBJROOT)/appc64_dir \
++ $(OBJROOT)/appc64_dir
++
++ifeq "yes" "$(BUILD_OBSOLETE_ARCH)"
++OFILE_DIRS += \
++ $(OBJROOT)/a68_dir \
++ $(OBJROOT)/a88_dir \
+ $(OBJROOT)/a860_dir \
+ $(OBJROOT)/ahppa_dir \
+ $(OBJROOT)/asparc_dir
++endif
+
+ BINDIR = /bin
+ USRBINDIR = /usr/bin
+@@ -109,9 +118,13 @@
+ OBJS_hppa = $(CFILES_hppa:.c=.o)
+ OBJS_sparc = $(CFILES_sparc:.c=.o)
+
+-all: $(OFILE_DIRS) $(SYM_DIRS) driver_build a68_build a88_build a386_build \
+- ax86_64_build a860_build appc_build appc64_build ahppa_build \
+- $(A_BUILD) asparc_build
++all: $(OFILE_DIRS) $(SYM_DIRS) driver_build a386_build \
++ ax86_64_build appc_build appc64_build \
++ $(A_BUILD)
++
++ifeq "yes" "$(BUILD_OBSOLETE_ARCH)"
++all: a68_build a88_build a860_build ahppa_build asparc_build
++endif
+
+ all_test: a68_test a88_test a860_test a386_test appc_test ahppa_test
+
+@@ -414,12 +427,14 @@
+ $(MKDIRS) $(DSTROOT)$(LIBDIR)/ppc64
+ install -c -s -m 555 $(SYMROOT)/appc64_dir/as \
+ $(DSTROOT)$(LIBDIR)/ppc64/as
++ifeq "yes" "$(BUILD_OBSOLETE_ARCH)"
+ $(MKDIRS) $(DSTROOT)$(LOCLIBDIR)/m68k
+ install -c -s -m 555 $(SYMROOT)/a68_dir/as \
+ $(DSTROOT)$(LOCLIBDIR)/m68k/as
+ $(MKDIRS) $(DSTROOT)$(LOCLIBDIR)/sparc
+ install -c -s -m 555 $(SYMROOT)/asparc_dir/as \
+ $(DSTROOT)$(LOCLIBDIR)/sparc/as
++endif
+
+ nextstep_install: common_install
+ $(MKDIRS) $(DSTROOT)$(BINDIR)
+@@ -439,6 +454,7 @@
+ $(DSTROOT)$(LOCLIBDIR)/ppc/as
+
+ common_install:
++ifeq "yes" "$(BUILD_OBSOLETE_ARCH)"
+ $(MKDIRS) $(DSTROOT)$(LOCLIBDIR)/m88k
+ install -c -s -m 555 $(SYMROOT)/a88_dir/as \
+ $(DSTROOT)$(LOCLIBDIR)/m88k/as
+@@ -448,6 +464,7 @@
+ $(MKDIRS) $(DSTROOT)$(LOCLIBDIR)/i860
+ install -s -m 555 $(SYMROOT)/a860_dir/as \
+ $(DSTROOT)$(LOCLIBDIR)/i860/as
++endif
+
+ $(OFILE_DIRS) $(SYM_DIRS):
+ $(MKDIRS) $@
diff --git a/sys-devel/binutils-apple/files/binutils-apple-3.1.1-libtool-ranlib.patch b/sys-devel/binutils-apple/files/binutils-apple-3.1.1-libtool-ranlib.patch
new file mode 100644
index 000000000000..fc86ddea118a
--- /dev/null
+++ b/sys-devel/binutils-apple/files/binutils-apple-3.1.1-libtool-ranlib.patch
@@ -0,0 +1,17 @@
+match "ranlib" at the back of the string, such that <CHOST>-ranlib also
+works correctly
+
+--- cctools-698/misc/libtool.c
++++ cctools-698/misc/libtool.c
+@@ -336,8 +336,9 @@
+ p++;
+ else
+ p = argv[0];
+- if(strncmp(p, "ranlib", sizeof("ranlib") - 1) == 0)
+- cmd_flags.ranlib = TRUE;
++ if ((i = strlen(p)) >= sizeof("ranlib") - 1 &&
++ strcmp(p + (i - (sizeof("ranlib") - 1)), "ranlib") == 0)
++ cmd_flags.ranlib = TRUE;
+
+ /* The default is to used long names */
+ cmd_flags.use_long_names = TRUE;
diff --git a/sys-devel/binutils-apple/files/binutils-apple-3.1.1-nmedit.patch b/sys-devel/binutils-apple/files/binutils-apple-3.1.1-nmedit.patch
new file mode 100644
index 000000000000..3b14e3dd4e69
--- /dev/null
+++ b/sys-devel/binutils-apple/files/binutils-apple-3.1.1-nmedit.patch
@@ -0,0 +1,15 @@
+don't create a symlink to nmedit from the dir nmedit is in
+
+--- cctools-698/misc/Makefile
++++ cctools-698/misc/Makefile
+@@ -427,8 +427,10 @@
+ install -c -s -m 555 $(SYMROOT)/redo_prebinding.NEW \
+ $(DSTROOT)$(USRBINDIR)/redo_prebinding
+ install -c -s -m 555 $(SYMROOT)/nmedit.NEW $(DSTROOT)$(USRBINDIR)/nmedit
++ifneq "$(USRBINDIR)" "$(LOCBINDIR)"
+ (cd $(DSTROOT)$(LOCBINDIR); rm -f nmedit; \
+ ln -s $(USRBINDIR)/nmedit nmedit)
++endif
+ install -c -s -m 555 $(SYMROOT)/install_name_tool.NEW \
+ $(DSTROOT)$(USRBINDIR)/install_name_tool
+ install -c -s -m 555 $(SYMROOT)/codesign_allocate.NEW \
diff --git a/sys-devel/binutils-apple/files/binutils-apple-3.1.1-no-efi-man.patch b/sys-devel/binutils-apple/files/binutils-apple-3.1.1-no-efi-man.patch
new file mode 100644
index 000000000000..978f1aba9aee
--- /dev/null
+++ b/sys-devel/binutils-apple/files/binutils-apple-3.1.1-no-efi-man.patch
@@ -0,0 +1,38 @@
+don't install efi's manpages since we don't install efi
+
+--- cctools-698/man/Makefile
++++ cctools-698/man/Makefile
+@@ -27,14 +27,21 @@
+ MANL3 = libsyminfo.3 redo_prebinding.3
+
+ INSTALL_FILES = Makefile $(COMMON_MAN1) $(OTHER_MAN1) $(MAN3) $(MAN5) $(MANL) \
+- $(MANL3) $(DYLD_MAN1) $(DYLD_MAN3) $(DYLD_MANL3) $(EFI1) notes
++ $(MANL3) $(DYLD_MAN1) $(DYLD_MAN3) $(DYLD_MANL3) notes
++
++ifeq "$(EFITOOLS)" "efitools"
++ INSTALL_FILES += $(EFI1)
++endif
+
+ MANDIR = /usr/share/man
+ LOCMANDIR = /usr/local/man
+ EFIMANDIR = /usr/local/efi/share/man
+ DSTDIRS = $(DSTROOT)$(MANDIR)/man1 $(DSTROOT)$(MANDIR)/man3 \
+ $(DSTROOT)$(MANDIR)/man5 $(DSTROOT)$(LOCMANDIR)/man1 \
+- $(DSTROOT)$(LOCMANDIR)/man3 $(DSTROOT)$(EFIMANDIR)/man1
++ $(DSTROOT)$(LOCMANDIR)/man3
++ifeq "$(EFITOOLS)" "efitools"
++ DSTDIR += $(DSTROOT)$(EFIMANDIR)/man1
++endif
+
+ install: $(DSTDIRS) $(COMMON_MAN1) $(OTHER_MAN1) $(MAN3) $(MAN5) $(MANL) \
+ $(RC_OS) $(MANL3)
+@@ -51,7 +58,9 @@
+ install -c -m 444 $(MAN5) $(DSTROOT)$(MANDIR)/man5
+ install -c -m 444 $(MANL) $(DSTROOT)$(LOCMANDIR)/man1
+ install -c -m 444 $(MANL3) $(DSTROOT)$(LOCMANDIR)/man3
++ifeq "$(EFITOOLS)" "efitools"
+ install -c -m 444 $(EFI1) $(DSTROOT)$(EFIMANDIR)/man1
++endif
+ if [ $(OLD_DYLD_STUFF) ]; \
+ then \
+ install -c -m 444 $(DYLD_MANL3) $(DSTROOT)$(LOCMANDIR)/man3;\
diff --git a/sys-devel/binutils-apple/files/binutils-apple-3.1.1-no-headers.patch b/sys-devel/binutils-apple/files/binutils-apple-3.1.1-no-headers.patch
new file mode 100644
index 000000000000..098a95fb0de5
--- /dev/null
+++ b/sys-devel/binutils-apple/files/binutils-apple-3.1.1-no-headers.patch
@@ -0,0 +1,15 @@
+get rid of libraries, includes, and obsolete manpages
+
+--- cctools-698/Makefile
++++ cctools-698/Makefile
+@@ -170,7 +170,9 @@
+ DSTROOT=$$DSTROOT install_tools lib_ofiles_install; \
+ fi
+
+-install_tools: installhdrs
++install_tools: installhdrs install_all_but_headers
++
++install_all_but_headers:
+ @if [ $(SRCROOT) ]; \
+ then \
+ CWD=`pwd`; cd "$(DSTROOT)"; DSTROOT=`pwd`; cd "$$CWD"; \
diff --git a/sys-devel/binutils-apple/files/binutils-apple-3.1.1-no-oss-dir.patch b/sys-devel/binutils-apple/files/binutils-apple-3.1.1-no-oss-dir.patch
new file mode 100644
index 000000000000..5ed823752357
--- /dev/null
+++ b/sys-devel/binutils-apple/files/binutils-apple-3.1.1-no-oss-dir.patch
@@ -0,0 +1,17 @@
+don't create an OpenSource dir
+
+--- cctools-698/as/Makefile
++++ cctools-698/as/Makefile
+@@ -408,12 +408,6 @@
+ $(MKDIRS) $(DSTROOT)$(USRBINDIR)
+ install -c -s -m 555 $(SYMROOT)/driver_dir/driver \
+ $(DSTROOT)$(USRBINDIR)/as
+- $(MKDIRS) $(DSTROOT)/usr/local/OpenSourceVersions/
+- install -c -s -m 444 $(SRCROOT)/cctools.plist \
+- $(DSTROOT)/usr/local/OpenSourceVersions/cctools.plist
+- $(MKDIRS) $(DSTROOT)/usr/local/OpenSourceLicenses/
+- install -c -s -m 444 $(SRCROOT)/COPYING \
+- $(DSTROOT)/usr/local/OpenSourceLicenses/cctools.txt
+ $(MKDIRS) $(DSTROOT)$(LIBDIR)/ppc
+ install -c -s -m 555 $(SYMROOT)/appc_dir/as \
+ $(DSTROOT)$(LIBDIR)/ppc/as
diff --git a/sys-devel/binutils-apple/files/binutils-apple-3.1.1-ranlib.patch b/sys-devel/binutils-apple/files/binutils-apple-3.1.1-ranlib.patch
new file mode 100644
index 000000000000..94865fb126dd
--- /dev/null
+++ b/sys-devel/binutils-apple/files/binutils-apple-3.1.1-ranlib.patch
@@ -0,0 +1,53 @@
+run ranlib before installation so we needn't touch permissions
+
+--- cctools-698/libmacho/Makefile
++++ cctools-698/libmacho/Makefile
+@@ -316,29 +316,29 @@
+ $(MKDIRS) $(DSTROOT)$(SYSTEMDIR)
+ if [ $(SRCROOT) = . ]; \
+ then \
++ ranlib dtmp_obj/libmacho.a; \
+ install -c -m 444 dtmp_obj/libmacho.a \
+ $(DSTROOT)$(SYSTEMDIR)/libmacho.a; \
+- ranlib $(DSTROOT)$(SYSTEMDIR)/libmacho.a; \
+ (cd $(DSTROOT)$(SYSTEMDIR) ; \
+ rm -f libmacho_debug.a ; ln -s libmacho.a libmacho_debug.a); \
++ ranlib ptmp_obj/libmacho_pg.a; \
+ install -c -m 444 ptmp_obj/libmacho_pg.a \
+ $(DSTROOT)$(SYSTEMDIR)/libmacho_profile.a; \
+- ranlib $(DSTROOT)$(SYSTEMDIR)/libmacho_profile.a; \
++ ranlib otmp_obj/libmacho_static.a; \
+ install -c -m 444 otmp_obj/libmacho_static.a \
+ $(DSTROOT)$(SYSTEMDIR)/libmacho_static.a; \
+- ranlib $(DSTROOT)$(SYSTEMDIR)/libmacho_static.a; \
+ else \
++ ranlib $(SYMROOT)/libmacho.a; \
+ install -c -m 444 $(SYMROOT)/libmacho.a \
+ $(DSTROOT)$(SYSTEMDIR)/libmacho.a; \
+- ranlib $(DSTROOT)$(SYSTEMDIR)/libmacho.a; \
+ (cd $(DSTROOT)$(SYSTEMDIR) ; \
+ rm -f libmacho_debug.a ; ln -s libmacho.a libmacho_debug.a); \
++ ranlib $(SYMROOT)/libmacho_pg.a; \
+ install -c -m 444 $(SYMROOT)/libmacho_pg.a \
+ $(DSTROOT)$(SYSTEMDIR)/libmacho_profile.a; \
+- ranlib $(DSTROOT)$(SYSTEMDIR)/libmacho_profile.a; \
++ ranlib $(SYMROOT)/libmacho_static.a; \
+ install -c -m 444 $(SYMROOT)/libmacho_static.a \
+ $(DSTROOT)$(SYSTEMDIR)/libmacho_static.a; \
+- ranlib $(DSTROOT)$(SYSTEMDIR)/libmacho_static.a; \
+ fi
+
+ teflon_lib_ofiles_install nextstep_lib_ofiles_install:
+--- cctools-698/cbtlibs/Makefile
++++ cctools-698/cbtlibs/Makefile
+@@ -80,9 +80,9 @@
+
+ lib_ofiles_install: lib_ofiles
+ $(MKDIRS) $(DSTROOT)$(LOCLIBDIR)
++ ranlib $(SYMROOT)/libsyminfo.a
+ install -p -c -m 444 $(SYMROOT)/libsyminfo.a \
+ $(DSTROOT)$(LOCLIBDIR)/libsyminfo.a
+- ranlib $(DSTROOT)$(LOCLIBDIR)/libsyminfo.a
+
+ -include $(OFILE_DIR)/Makedep
+
diff --git a/sys-devel/binutils-apple/files/binutils-apple-3.1.1-testsuite.patch b/sys-devel/binutils-apple/files/binutils-apple-3.1.1-testsuite.patch
new file mode 100644
index 000000000000..b3913262db26
--- /dev/null
+++ b/sys-devel/binutils-apple/files/binutils-apple-3.1.1-testsuite.patch
@@ -0,0 +1,102 @@
+fix the test suite so it is even usable
+
+--- ld64-85.2.2/unit-tests/test-cases/commons-alignment/Makefile
++++ ld64-85.2.2/unit-tests/test-cases/commons-alignment/Makefile
+@@ -29,9 +29,9 @@
+
+ all:
+ ${CC} ${CCFLAGS} foo.s -c -o foo.o
+- nm -m foo.o | grep '(alignment 2^6)' | ${FAIL_IF_EMPTY}
++ nm -m foo.o | fgrep '(alignment 2^6)' | ${FAIL_IF_EMPTY}
+ ${LD} foo.o -r -o foo2.o
+- nm -m foo2.o | grep '(alignment 2^6)' | ${PASS_IFF_STDIN}
++ nm -m foo2.o | fgrep '(alignment 2^6)' | ${PASS_IFF_STDIN}
+
+ clean:
+ rm -rf foo.o foo2.o
+--- ld64-85.2.2/unit-tests/test-cases/order_file/Makefile
++++ ld64-85.2.2/unit-tests/test-cases/order_file/Makefile
+@@ -33,7 +33,7 @@
+ run: all
+
+ all:
+- as -arch ${ARCH} -L extra.s -o extra.o
++ as -L extra.s -o extra.o
+ ${CC} ${CCFLAGS} main.c extra.o -o main1 -Wl,-order_file -Wl,main1.order
+ ${FAIL_IF_BAD_MACHO} main1
+ nm -n -g -j main1 | grep "_main" > main1.nm
+@@ -44,7 +44,7 @@
+ nm -n -j main2 | egrep '^_[a-z]+[0-9]$$' > main2.nm
+ ${PASS_IFF} diff main2.nm main2.expected
+
+- ${CC} -arch ${ARCH} -c main.c -o main.o
++ ${CC} -c main.c -o main.o
+ ${CC} ${CCFLAGS} main.o extra.o -o main3 -Wl,-order_file -Wl,main3.order
+ ${FAIL_IF_BAD_MACHO} main3
+ nm -n -g -j main3 | grep "_main" > main3.nm
+--- ld64-85.2.2/unit-tests/test-cases/16-byte-alignment/Makefile
++++ ld64-85.2.2/unit-tests/test-cases/16-byte-alignment/Makefile
+@@ -30,13 +30,13 @@
+ run: all
+
+ all:
+- ${FAIL_IF_ERROR} ${CC} ${CCFLAGS} -arch ${ARCH} -c -O2 tl_test2.c -o tl_test2-${ARCH}.o
++ ${FAIL_IF_ERROR} ${CC} ${CCFLAGS} -c -O2 tl_test2.c -o tl_test2-${ARCH}.o
+
+ # verify that the alignment is correct in the .o
+ ObjectDump -only _ai -align -no_content tl_test2-${ARCH}.o|${FAIL_IF_ERROR} grep '\<0 mod 16\>' >/dev/null
+
+ # now verify the executable
+- ${FAIL_IF_ERROR} ${CC} ${CCFLAGS} -arch ${ARCH} -O2 tl_test2-${ARCH}.o -o tl_test2-${ARCH}
++ ${FAIL_IF_ERROR} ${CC} ${CCFLAGS} -O2 tl_test2-${ARCH}.o -o tl_test2-${ARCH}
+ ${FAIL_IF_ERROR} sh -c "nm tl_test2-${ARCH}|grep '0 D _ai\>' >/dev/null"
+ ${PASS_IFF_GOOD_MACHO} tl_test2-${ARCH}
+
+--- ld64-85.2.2/unit-tests/test-cases/eh-strip-test/Makefile
++++ ld64-85.2.2/unit-tests/test-cases/eh-strip-test/Makefile
+@@ -27,7 +27,7 @@
+
+
+ all:
+- ${FAIL_IF_ERROR} $(CXX) main.cxx -arch ${ARCH} -o main
++ ${FAIL_IF_ERROR} $(CXX) main.cxx -o main
+ ${FAIL_IF_ERROR} nm -j main | grep '\.eh$$'| ${FAIL_IF_STDIN}
+ ${PASS_IFF_GOOD_MACHO} main
+ clean:
+--- ld64-85.2.2/unit-tests/test-cases/strip-test2/Makefile
++++ ld64-85.2.2/unit-tests/test-cases/strip-test2/Makefile
+@@ -50,10 +50,10 @@
+
+
+ all:
+- $(CXX) main.cxx -arch ${ARCH} -o main
++ $(CXX) main.cxx -o main
+ ${FAIL_IF_BAD_MACHO} main
+ ${FAIL_IF_ERROR} nm -j main >main-no-strip.nm
+- $(CXX) main.cxx -arch ${ARCH} -o main
++ $(CXX) main.cxx -o main
+ ${FAIL_IF_BAD_MACHO} main
+
+ # Make sure there are no symbols in the stripped file that aren't
+--- ld64-85.2.2/unit-tests/test-cases/literals-coalesce/Makefile
++++ ld64-85.2.2/unit-tests/test-cases/literals-coalesce/Makefile
+@@ -32,7 +32,7 @@
+
+ all:
+ ${CC} ${ASMFLAGS} literals.s -c -o literals-${ARCH}.o
+- ${FAIL_IF_ERROR} ${OBJECTDUMP} literals-${ARCH}.o | grep 'name:'| uniq -c | grep -v '^ [1|2]' | ${FAIL_IF_STDIN}
++ ${FAIL_IF_ERROR} ${OBJECTDUMP} literals-${ARCH}.o | grep 'name:'| uniq -c | grep -v '^ *[1|2]' | ${FAIL_IF_STDIN}
+ ${LD} -arch ${ARCH} -r literals-${ARCH}.o -o literals-r-${ARCH}.o
+ ${FAIL_IF_ERROR} ${OBJECTDUMP} literals-r-${ARCH}.o | grep 'name:' | uniq -d | ${PASS_IFF_EMPTY}
+
+--- ld64-85.2.2/unit-tests/test-cases/stabs-coalesce/Makefile
++++ ld64-85.2.2/unit-tests/test-cases/stabs-coalesce/Makefile
+@@ -38,7 +38,7 @@
+ ${FAIL_IF_BAD_MACHO} stabs-hello-${ARCH}
+ nm -ap stabs-hello-${ARCH} | grep FUN | grep _Z3fooi | wc -l > stabs-hello-foo-count
+ echo " 1" > one
+- ${PASS_IFF} diff stabs-hello-foo-count one
++ ${PASS_IFF} diff -w stabs-hello-foo-count one
+
+ hello.o : hello.cxx
+ ${CXX} ${CCXXFLAGS} -gstabs+ -gused hello.cxx -c -o $@
diff --git a/sys-devel/binutils-apple/files/binutils-apple-3.1.2-as-Makefile.patch b/sys-devel/binutils-apple/files/binutils-apple-3.1.2-as-Makefile.patch
new file mode 100644
index 000000000000..554fed1cbe39
--- /dev/null
+++ b/sys-devel/binutils-apple/files/binutils-apple-3.1.2-as-Makefile.patch
@@ -0,0 +1,11 @@
+--- as/Makefile
++++ as/Makefile
+@@ -343,7 +343,7 @@
+ makeUser.o $(LIBSTUFF_DIR) $(LIBSTUFF)
+ $(CC) $(CFLAGS) $(RC_CFLAGS) -o $(SYMROOT)/as $(SYMROOT)/as.private.o
+
+-makeUser.c messages.c: make.h
++makeUser.c ../messages.c: make.h
+
+ make.h makeUser.c: make.defs
+ $(MIG) $(MIG_FLAGS) $(SRCROOT)/make.defs
diff --git a/sys-devel/binutils-apple/files/binutils-apple-3.2-armv7-defines.patch b/sys-devel/binutils-apple/files/binutils-apple-3.2-armv7-defines.patch
new file mode 100644
index 000000000000..d89a0c19f2c6
--- /dev/null
+++ b/sys-devel/binutils-apple/files/binutils-apple-3.2-armv7-defines.patch
@@ -0,0 +1,10 @@
+--- cctools/include/mach/machine.h
++++ cctools/include/mach/machine.h
+@@ -306,6 +306,7 @@
+ #define CPU_SUBTYPE_ARM_V6 ((cpu_subtype_t) 6)
+ #define CPU_SUBTYPE_ARM_V5TEJ ((cpu_subtype_t) 7)
+ #define CPU_SUBTYPE_ARM_XSCALE ((cpu_subtype_t) 8)
++#define CPU_SUBTYPE_ARM_V7 ((cpu_subtype_t) 9)
+
+ /*
+ * MC88000 subtypes
diff --git a/sys-devel/binutils-apple/files/binutils-apple-3.2.2-as.patch b/sys-devel/binutils-apple/files/binutils-apple-3.2.2-as.patch
new file mode 100644
index 000000000000..f032e1b5571d
--- /dev/null
+++ b/sys-devel/binutils-apple/files/binutils-apple-3.2.2-as.patch
@@ -0,0 +1,101 @@
+make building for obsolete architectures optional.
+
+--- as/Makefile
++++ as/Makefile
+@@ -1,3 +1,4 @@
++BUILD_OBSOLETE_ARCH = yes
+ RC_OS = macos
+ export USE_APPLE_PB_SUPPORT = all
+ OFLAG =
+@@ -32,28 +33,36 @@
+ SYMROOT = .
+ OBJROOT = .
+ SYM_DIRS = $(SYMROOT)/driver_dir \
+- $(SYMROOT)/a68_dir \
+- $(SYMROOT)/a88_dir \
+ $(SYMROOT)/a386_dir \
+ $(SYMROOT)/ax86_64_dir \
+ $(SYMROOT)/appc_dir \
+ $(SYMROOT)/appc64_dir \
++ $(SYMROOT)/aarm_dir
++
++ifeq "yes" "$(BUILD_OBSOLETE_ARCH)"
++SYM_DIRS += \
++ $(SYMROOT)/a68_dir \
++ $(SYMROOT)/a88_dir \
+ $(SYMROOT)/a860_dir \
+ $(SYMROOT)/ahppa_dir \
+- $(SYMROOT)/asparc_dir \
+- $(SYMROOT)/aarm_dir
++ $(SYMROOT)/asparc_dir
++endif
+
+ OFILE_DIRS = $(OBJROOT)/driver_dir \
+- $(OBJROOT)/a68_dir \
+- $(OBJROOT)/a88_dir \
+ $(OBJROOT)/a386_dir \
+ $(OBJROOT)/ax86_64_dir \
+ $(OBJROOT)/appc_dir \
+ $(OBJROOT)/appc64_dir \
++ $(OBJROOT)/aarm_dir
++
++ifeq "yes" "$(BUILD_OBSOLETE_ARCH)"
++OFILE_DIRS += \
++ $(OBJROOT)/a68_dir \
++ $(OBJROOT)/a88_dir \
+ $(OBJROOT)/a860_dir \
+ $(OBJROOT)/ahppa_dir \
+- $(OBJROOT)/asparc_dir \
+- $(OBJROOT)/aarm_dir
++ $(OBJROOT)/asparc_dir
++endif
+
+ BINDIR = /bin
+ USRBINDIR = /usr/bin
+@@ -115,9 +124,12 @@
+ OBJS_sparc = $(CFILES_sparc:.c=.o)
+ OBJS_arm = $(CFILES_arm:.c=.o)
+
+-all: $(OFILE_DIRS) $(SYM_DIRS) driver_build a68_build a88_build a386_build \
+- ax86_64_build a860_build appc_build appc64_build ahppa_build \
+- aarm_build asparc_build
++all: $(OFILE_DIRS) $(SYM_DIRS) driver_build a386_build \
++ ax86_64_build appc_build appc64_build aarm_build
++
++ifeq "yes" "$(BUILD_OBSOLETE_ARCH)"
++all: a68_build a88_build a860_build ahppa_build asparc_build
++endif
+
+ all_test: a68_test a88_test a860_test a386_test appc_test ahppa_test
+
+@@ -429,12 +441,14 @@
+ $(MKDIRS) $(DSTROOT)$(LIBDIR)/ppc64
+ install -c -s -m 555 $(SYMROOT)/appc64_dir/as \
+ $(DSTROOT)$(LIBDIR)/ppc64/as
++ifeq "yes" "$(BUILD_OBSOLETE_ARCH)"
+ $(MKDIRS) $(DSTROOT)$(LOCLIBDIR)/m68k
+ install -c -s -m 555 $(SYMROOT)/a68_dir/as \
+ $(DSTROOT)$(LOCLIBDIR)/m68k/as
+ $(MKDIRS) $(DSTROOT)$(LOCLIBDIR)/sparc
+ install -c -s -m 555 $(SYMROOT)/asparc_dir/as \
+ $(DSTROOT)$(LOCLIBDIR)/sparc/as
++endif
+ $(MKDIRS) $(DSTROOT)$(LIBDIR)/arm
+ install -c -s -m 555 $(SYMROOT)/aarm_dir/as \
+ $(DSTROOT)$(LIBDIR)/arm/as
+@@ -457,6 +471,7 @@
+ $(DSTROOT)$(LOCLIBDIR)/ppc/as
+
+ common_install:
++ifeq "yes" "$(BUILD_OBSOLETE_ARCH)"
+ $(MKDIRS) $(DSTROOT)$(LOCLIBDIR)/m88k
+ install -s -m 555 $(SYMROOT)/a88_dir/as \
+ $(DSTROOT)$(LOCLIBDIR)/m88k/as
+@@ -466,6 +481,7 @@
+ $(MKDIRS) $(DSTROOT)$(LOCLIBDIR)/i860
+ install -s -m 555 $(SYMROOT)/a860_dir/as \
+ $(DSTROOT)$(LOCLIBDIR)/i860/as
++endif
+
+ $(OFILE_DIRS) $(SYM_DIRS):
+ $(MKDIRS) $@
diff --git a/sys-devel/binutils-apple/files/binutils-apple-3.2.3-ranlib.patch b/sys-devel/binutils-apple/files/binutils-apple-3.2.3-ranlib.patch
new file mode 100644
index 000000000000..e5292746eadf
--- /dev/null
+++ b/sys-devel/binutils-apple/files/binutils-apple-3.2.3-ranlib.patch
@@ -0,0 +1,59 @@
+run ranlib before installation so we needn't touch permissions
+
+--- cctools-782/cbtlibs/Makefile 2009-12-16 20:34:18.000000000 +0100
++++ cctools-782/cbtlibs/Makefile.new 2010-07-30 20:08:22.000000000 +0200
+@@ -84,9 +84,9 @@ libsyminfo.a: libsyminfo.o
+
+ lib_ofiles_install: lib_ofiles
+ $(MKDIRS) $(DSTROOT)$(LOCLIBDIR)
++ ranlib $(DSTROOT)$(LOCLIBDIR)/libsyminfo.a
+ install -p -c -m 444 $(SYMROOT)/libsyminfo.a \
+ $(DSTROOT)$(LOCLIBDIR)/libsyminfo.a
+- ranlib $(DSTROOT)$(LOCLIBDIR)/libsyminfo.a
+
+ -include $(OFILE_DIR)/Makedep
+
+--- cctools-782/libmacho/Makefile 2010-03-30 00:57:21.000000000 +0200
++++ cctools-782/libmacho/Makefile.new 2010-07-30 20:07:57.000000000 +0200
+@@ -357,17 +357,17 @@ macos_lib_ofiles_install: all
+ $(MKDIRS) $(DSTROOT)$(ARCHIVEDIR) $(DSTROOT)$(DYLIBDIR)
+ if [ $(SRCROOT) = . ]; \
+ then \
++ ranlib $(DSTROOT)$(ARCHIVEDIR)/libmacho.a; \
+ install -c -m 444 dtmp_obj/libmacho.a \
+ $(DSTROOT)$(ARCHIVEDIR)/libmacho.a; \
+- ranlib $(DSTROOT)$(ARCHIVEDIR)/libmacho.a; \
+ (cd $(DSTROOT)$(ARCHIVEDIR) ; \
+ rm -f libmacho_debug.a ; ln -s libmacho.a libmacho_debug.a); \
++ ranlib $(DSTROOT)$(ARCHIVEDIR)/libmacho_profile.a; \
+ install -c -m 444 ptmp_obj/libmacho_pg.a \
+ $(DSTROOT)$(ARCHIVEDIR)/libmacho_profile.a; \
+- ranlib $(DSTROOT)$(ARCHIVEDIR)/libmacho_profile.a; \
++ ranlib $(DSTROOT)$(ARCHIVEDIR)/libmacho_static.a; \
+ install -c -m 444 otmp_obj/libmacho_static.a \
+ $(DSTROOT)$(ARCHIVEDIR)/libmacho_static.a; \
+- ranlib $(DSTROOT)$(ARCHIVEDIR)/libmacho_static.a; \
+ install -c -m 555 dtmp_obj/libmacho.dylib \
+ $(DSTROOT)$(DYLIBDIR)/libmacho.dylib; \
+ strip -S $(DSTROOT)$(DYLIBDIR)/libmacho.dylib; \
+@@ -378,17 +378,17 @@ macos_lib_ofiles_install: all
+ $(DSTROOT)$(DYLIBDIR)/libmacho_debug.dylib; \
+ strip -S $(DSTROOT)$(DYLIBDIR)/libmacho_debug.dylib; \
+ else \
++ ranlib $(DSTROOT)$(ARCHIVEDIR)/libmacho.a; \
+ install -c -m 444 $(SYMROOT)/libmacho.a \
+ $(DSTROOT)$(ARCHIVEDIR)/libmacho.a; \
+- ranlib $(DSTROOT)$(ARCHIVEDIR)/libmacho.a; \
+ (cd $(DSTROOT)$(ARCHIVEDIR) ; \
+ rm -f libmacho_debug.a ; ln -s libmacho.a libmacho_debug.a); \
++ ranlib $(DSTROOT)$(ARCHIVEDIR)/libmacho_profile.a; \
+ install -c -m 444 $(SYMROOT)/libmacho_pg.a \
+ $(DSTROOT)$(ARCHIVEDIR)/libmacho_profile.a; \
+- ranlib $(DSTROOT)$(ARCHIVEDIR)/libmacho_profile.a; \
++ ranlib $(DSTROOT)$(ARCHIVEDIR)/libmacho_static.a; \
+ install -c -m 444 $(SYMROOT)/libmacho_static.a \
+ $(DSTROOT)$(ARCHIVEDIR)/libmacho_static.a; \
+- ranlib $(DSTROOT)$(ARCHIVEDIR)/libmacho_static.a; \
+ install -c -m 555 $(SYMROOT)/libmacho.dylib \
+ $(DSTROOT)$(DYLIBDIR)/libmacho.dylib; \
+ strip -S $(DSTROOT)$(DYLIBDIR)/libmacho.dylib; \
diff --git a/sys-devel/binutils-apple/files/binutils-apple-4.0-as-dir.patch b/sys-devel/binutils-apple/files/binutils-apple-4.0-as-dir.patch
new file mode 100644
index 000000000000..0a6664ce1633
--- /dev/null
+++ b/sys-devel/binutils-apple/files/binutils-apple-4.0-as-dir.patch
@@ -0,0 +1,67 @@
+--- as/driver.c
++++ as/driver.c
+@@ -28,6 +28,9 @@
+ char **envp)
+ {
+ const char *LIB =
++#ifdef ASLIBEXECDIR
++ ASLIBEXECDIR;
++#else
+ #if defined(__OPENSTEP__) || defined(__HERA__) || \
+ defined(__GONZO_BUNSEN_BEAKER__) || defined(__KODIAK__)
+ "../libexec/";
+@@ -41,6 +44,7 @@
+ #else
+ "../local/libexec/gcc/darwin/";
+ #endif
++#endif
+ const char *AS = "/as";
+ const char *LLVM_MC = "llvm-mc";
+
+@@ -240,7 +244,11 @@
+
+ }
+
++#ifndef ASLIBEXECDIR
+ as = makestr(prefix, LIB, arch_name, AS, NULL);
++#else
++ as = makestr(LIB, arch_name, AS, NULL);
++#endif
+
+ /*
+ * If this assembler exist try to run it else print an error message.
+@@ -252,6 +260,10 @@
+ else
+ exit(1);
+ }
++#ifdef ASLIBEXECDIR
++ as_local = "";
++ {
++#else
+ as_local = makestr(prefix, LOCALLIB, arch_name, AS, NULL);
+ if(access(as_local, F_OK) == 0){
+ argv[0] = as_local;
+@@ -261,6 +273,7 @@
+ exit(1);
+ }
+ else{
++#endif
+ printf("%s: assembler (%s or %s) for architecture %s not "
+ "installed\n", progname, as, as_local, arch_name);
+ arch_flags = get_arch_flags();
+@@ -273,6 +286,7 @@
+ printf("%s for architecture %s\n", as, arch_flags[i].name);
+ count++;
+ }
++#ifndef ASLIBEXECDIR
+ else{
+ as_local = makestr(prefix, LOCALLIB, arch_flags[i].name,
+ AS, NULL);
+@@ -284,6 +298,7 @@
+ count++;
+ }
+ }
++#endif
+ }
+ if(count == 0)
+ printf("%s: no assemblers installed\n", progname);
diff --git a/sys-devel/binutils-apple/files/binutils-apple-4.0-as.patch b/sys-devel/binutils-apple/files/binutils-apple-4.0-as.patch
new file mode 100644
index 000000000000..8df58775d650
--- /dev/null
+++ b/sys-devel/binutils-apple/files/binutils-apple-4.0-as.patch
@@ -0,0 +1,99 @@
+--- as/Makefile
++++ as/Makefile
+@@ -1,3 +1,4 @@
++BUILD_OBSOLETE_ARCH = yes
+ RC_OS = macos
+ export USE_APPLE_PB_SUPPORT = all
+ OFLAG = -Os
+@@ -32,28 +33,36 @@
+ SYMROOT = .
+ OBJROOT = .
+ SYM_DIRS = $(SYMROOT)/driver_dir \
+- $(SYMROOT)/a68_dir \
+- $(SYMROOT)/a88_dir \
+ $(SYMROOT)/a386_dir \
+ $(SYMROOT)/ax86_64_dir \
+ $(SYMROOT)/appc_dir \
+ $(SYMROOT)/appc64_dir \
++ $(SYMROOT)/aarm_dir
++
++ifeq "yes" "$(BUILD_OBSOLETE_ARCH)"
++SYM_DIRS += \
++ $(SYMROOT)/a68_dir \
++ $(SYMROOT)/a88_dir \
+ $(SYMROOT)/a860_dir \
+ $(SYMROOT)/ahppa_dir \
+- $(SYMROOT)/asparc_dir \
+- $(SYMROOT)/aarm_dir
++ $(SYMROOT)/asparc_dir
++endif
+
+ OFILE_DIRS = $(OBJROOT)/driver_dir \
+- $(OBJROOT)/a68_dir \
+- $(OBJROOT)/a88_dir \
+ $(OBJROOT)/a386_dir \
+ $(OBJROOT)/ax86_64_dir \
+ $(OBJROOT)/appc_dir \
+ $(OBJROOT)/appc64_dir \
++ $(OBJROOT)/aarm_dir
++
++ifeq "yes" "$(BUILD_OBSOLETE_ARCH)"
++OFILE_DIRS += \
++ $(OBJROOT)/a68_dir \
++ $(OBJROOT)/a88_dir \
+ $(OBJROOT)/a860_dir \
+ $(OBJROOT)/ahppa_dir \
+- $(OBJROOT)/asparc_dir \
+- $(OBJROOT)/aarm_dir
++ $(OBJROOT)/asparc_dir
++endif
+
+ BINDIR = /bin
+ USRBINDIR = /usr/bin
+@@ -115,9 +124,12 @@
+ OBJS_sparc = $(CFILES_sparc:.c=.o)
+ OBJS_arm = $(CFILES_arm:.c=.o)
+
+-all: $(OFILE_DIRS) $(SYM_DIRS) driver_build a68_build a88_build a386_build \
+- ax86_64_build a860_build appc_build appc64_build ahppa_build \
+- aarm_build asparc_build
++all: $(OFILE_DIRS) $(SYM_DIRS) driver_build a386_build \
++ ax86_64_build appc_build appc64_build aarm_build
++
++ifeq "yes" "$(BUILD_OBSOLETE_ARCH)"
++all: a68_build a88_build a860_build ahppa_build asparc_build
++endif
+
+ all_test: a68_test a88_test a860_test a386_test appc_test ahppa_test
+
+@@ -452,12 +464,14 @@
+ $(MKDIRS) $(DSTROOT)$(LOCLIBDIR)/ppc64
+ install -c -s -m 555 $(SYMROOT)/appc64_dir/as \
+ $(DSTROOT)$(LOCLIBDIR)/ppc64/as
++ifeq "yes" "$(BUILD_OBSOLETE_ARCH)"
+ $(MKDIRS) $(DSTROOT)$(LOCLIBDIR)/m68k
+ install -c -s -m 555 $(SYMROOT)/a68_dir/as \
+ $(DSTROOT)$(LOCLIBDIR)/m68k/as
+ $(MKDIRS) $(DSTROOT)$(LOCLIBDIR)/sparc
+ install -c -s -m 555 $(SYMROOT)/asparc_dir/as \
+ $(DSTROOT)$(LOCLIBDIR)/sparc/as
++endif
+ $(MKDIRS) $(DSTROOT)$(LIBDIR)/arm
+ install -c -s -m 555 $(SYMROOT)/aarm_dir/as \
+ $(DSTROOT)$(LIBDIR)/arm/as
+@@ -480,6 +494,7 @@
+ $(DSTROOT)$(LOCLIBDIR)/ppc/as
+
+ common_install:
++ifeq "yes" "$(BUILD_OBSOLETE_ARCH)"
+ $(MKDIRS) $(DSTROOT)$(LOCLIBDIR)/m88k
+ install -c -s -m 555 $(SYMROOT)/a88_dir/as \
+ $(DSTROOT)$(LOCLIBDIR)/m88k/as
+@@ -489,6 +504,7 @@
+ $(MKDIRS) $(DSTROOT)$(LOCLIBDIR)/i860
+ install -s -m 555 $(SYMROOT)/a860_dir/as \
+ $(DSTROOT)$(LOCLIBDIR)/i860/as
++endif
+
+ $(OFILE_DIRS) $(SYM_DIRS):
+ $(MKDIRS) $@
diff --git a/sys-devel/binutils-apple/files/binutils-apple-4.0-no-oss-dir.patch b/sys-devel/binutils-apple/files/binutils-apple-4.0-no-oss-dir.patch
new file mode 100644
index 000000000000..fcce015e1980
--- /dev/null
+++ b/sys-devel/binutils-apple/files/binutils-apple-4.0-no-oss-dir.patch
@@ -0,0 +1,15 @@
+--- as/Makefile
++++ as/Makefile
+@@ -452,12 +452,6 @@
+ $(MKDIRS) $(DSTROOT)$(USRBINDIR)
+ install -c -s -m 555 $(SYMROOT)/driver_dir/driver \
+ $(DSTROOT)$(USRBINDIR)/as
+- $(MKDIRS) $(DSTROOT)/usr/local/OpenSourceVersions/
+- install -c -s -m 444 $(SRCROOT)/cctools.plist \
+- $(DSTROOT)/usr/local/OpenSourceVersions/cctools.plist
+- $(MKDIRS) $(DSTROOT)/usr/local/OpenSourceLicenses/
+- install -c -s -m 444 $(SRCROOT)/COPYING \
+- $(DSTROOT)/usr/local/OpenSourceLicenses/cctools.txt
+ $(MKDIRS) $(DSTROOT)$(LOCLIBDIR)/ppc
+ install -c -s -m 555 $(SYMROOT)/appc_dir/as \
+ $(DSTROOT)$(LOCLIBDIR)/ppc/as
diff --git a/sys-devel/binutils-apple/files/binutils-apple-4.2-as-dir.patch b/sys-devel/binutils-apple/files/binutils-apple-4.2-as-dir.patch
new file mode 100644
index 000000000000..b3047f6215fd
--- /dev/null
+++ b/sys-devel/binutils-apple/files/binutils-apple-4.2-as-dir.patch
@@ -0,0 +1,45 @@
+--- as/driver.c
++++ as/driver.c
+@@ -230,7 +230,11 @@
+ /*
+ * If this assembler exist try to run it else print an error message.
+ */
++#ifndef ASLIBEXECDIR
+ as = makestr(prefix, LIB, arch_name, AS, NULL);
++#else
++ as = makestr(ASLIBEXECDIR, arch_name, AS, NULL);
++#endif
+ if(access(as, F_OK) == 0){
+ argv[0] = as;
+ if(execute(argv, verbose))
+@@ -238,6 +242,9 @@
+ else
+ exit(1);
+ }
++#ifdef ASLIBEXECDIR
++ as_local = "";
++#else
+ as_local = makestr(prefix, LOCALLIB, arch_name, AS, NULL);
+ if(access(as_local, F_OK) == 0){
+ argv[0] = as_local;
+@@ -246,10 +253,12 @@
+ else
+ exit(1);
+ }
++#endif
+ printf("%s: assembler (%s or %s) for architecture %s not installed\n",
+ progname, as, as_local, arch_name);
+ arch_flags = get_arch_flags();
+ count = 0;
++#ifndef ASLIBEXECDIR
+ for(i = 0; arch_flags[i].name != NULL; i++){
+ as = makestr(prefix, LIB, arch_flags[i].name, AS, NULL);
+ if(access(as, F_OK) == 0){
+@@ -270,6 +279,7 @@
+ }
+ }
+ }
++#endif
+ if(count == 0)
+ printf("%s: no assemblers installed\n", progname);
+ exit(1);
diff --git a/sys-devel/binutils-apple/files/binutils-apple-4.2-globals-extern.patch b/sys-devel/binutils-apple/files/binutils-apple-4.2-globals-extern.patch
new file mode 100644
index 000000000000..76419ad90780
--- /dev/null
+++ b/sys-devel/binutils-apple/files/binutils-apple-4.2-globals-extern.patch
@@ -0,0 +1,29 @@
+Externally referenced globals should be marked extern to avoid stuff like this happening:
+
+ld: warning: tentative definition of '_subsections_via_symbols' with size 16 from 'app.o' is being replaced by real definition of smaller size 4 from 'as.o'
+ld: warning: tentative definition of '_subsections_via_symbols' with size 16 from 'atof-ieee.o' is being replaced by real definition of smaller size 4 from 'as.o'
+...
+
+--- cctools-809/as/as.h.orig 2015-01-28 23:52:40.000000000 +0100
++++ cctools-809/as/as.h 2015-01-28 23:52:52.000000000 +0100
+@@ -179,7 +179,7 @@
+ extern char *specific_archflag;
+
+ /* TRUE if the .subsections_via_symbols directive was seen */
+-int subsections_via_symbols;
++extern int subsections_via_symbols;
+
+ /* -I path options for .includes */
+ struct directory_stack {
+--- cctools-809/as/arm.c.orig 2015-01-28 23:57:23.000000000 +0100
++++ cctools-809/as/arm.c 2015-01-28 23:57:35.000000000 +0100
+@@ -151,8 +151,7 @@
+ # define N_(String) (String)
+
+ /* STUFF FROM gas/as.h */
+-#define COMMON
+-COMMON subsegT now_subseg;
++extern subsegT now_subseg;
+
+ /* STUFF FROM gas/config/tc-arm.h */
+ #define ARM_FLAG_THUMB (1 << 0) /* The symbol is a Thumb symbol rather than an Arm symbol. */
diff --git a/sys-devel/binutils-apple/files/binutils-apple-4.2-lto.patch b/sys-devel/binutils-apple/files/binutils-apple-4.2-lto.patch
new file mode 100644
index 000000000000..791a922dd425
--- /dev/null
+++ b/sys-devel/binutils-apple/files/binutils-apple-4.2-lto.patch
@@ -0,0 +1,34 @@
+--- misc/lipo.c
++++ misc/lipo.c
+@@ -1191,6 +1191,7 @@
+ thin->fat_arch.align = 0;
+ }
+ else{
++#ifdef LTO_SUPPORT
+ if(is_llvm_bitcode_from_memory(addr, size, &input->arch_flag,
+ NULL) != 0){
+ /* create a thin file struct for it */
+@@ -1204,6 +1205,7 @@
+ thin->fat_arch.align = 0;
+ }
+ else
++#endif
+ fatal("can't figure out the architecture type of: %s",
+ input->name);
+ }
+@@ -1444,6 +1446,7 @@
+ if(strncmp(ar_name, SYMDEF, sizeof(SYMDEF) - 1) != 0){
+ ar_addr = addr + offset + ar_name_size;
+ ar_size = strtoul(ar_hdr->ar_size, NULL, 10);
++#ifdef LTO_SUPPORT
+ if(is_llvm_bitcode_from_memory(ar_addr, ar_size,
+ &arch_flag, NULL) != 0){
+ if(*cputype == 0){
+@@ -1466,6 +1464,7 @@
+ (*cpusubtype) & ~CPU_SUBTYPE_MASK);
+ }
+ }
++#endif
+ }
+ }
+ }
diff --git a/sys-devel/binutils-apple/files/binutils-apple-4.5-as.patch b/sys-devel/binutils-apple/files/binutils-apple-4.5-as.patch
new file mode 100644
index 000000000000..0769016c5682
--- /dev/null
+++ b/sys-devel/binutils-apple/files/binutils-apple-4.5-as.patch
@@ -0,0 +1,100 @@
+Allow to disable build of as backends for obsolete architectures.
+
+diff --git a/as/Makefile b/as/Makefile
+index a4b016e..9e8bcc3 100644
+--- a/as/Makefile
++++ b/as/Makefile
+@@ -1,3 +1,4 @@
++BUILD_OBSOLETE_ARCH = yes
+ export USE_APPLE_PB_SUPPORT = all
+
+ ifneq "" "$(SDKROOT)"
+@@ -20,28 +21,36 @@ SRCROOT = .
+ SYMROOT = .
+ OBJROOT = .
+ SYM_DIRS = $(SYMROOT)/driver_dir \
+- $(SYMROOT)/a68_dir \
+- $(SYMROOT)/a88_dir \
+ $(SYMROOT)/a386_dir \
+ $(SYMROOT)/ax86_64_dir \
+ $(SYMROOT)/appc_dir \
+ $(SYMROOT)/appc64_dir \
++ $(SYMROOT)/aarm_dir
++
++ifeq "yes" "$(BUILD_OBSOLETE_ARCH)"
++SYM_DIRS += \
++ $(SYMROOT)/a68_dir \
++ $(SYMROOT)/a88_dir \
+ $(SYMROOT)/a860_dir \
+ $(SYMROOT)/ahppa_dir \
+- $(SYMROOT)/asparc_dir \
+- $(SYMROOT)/aarm_dir
++ $(SYMROOT)/asparc_dir
++endif
+
+ OFILE_DIRS = $(OBJROOT)/driver_dir \
+- $(OBJROOT)/a68_dir \
+- $(OBJROOT)/a88_dir \
+ $(OBJROOT)/a386_dir \
+ $(OBJROOT)/ax86_64_dir \
+ $(OBJROOT)/appc_dir \
+ $(OBJROOT)/appc64_dir \
++ $(OBJROOT)/aarm_dir
++
++ifeq "yes" "$(BUILD_OBSOLETE_ARCH)"
++OFILE_DIRS += \
++ $(OBJROOT)/a68_dir \
++ $(OBJROOT)/a88_dir \
+ $(OBJROOT)/a860_dir \
+ $(OBJROOT)/ahppa_dir \
+- $(OBJROOT)/asparc_dir \
+- $(OBJROOT)/aarm_dir
++ $(OBJROOT)/asparc_dir
++endif
+
+ BINDIR = /bin
+ USRBINDIR = /usr/bin
+@@ -88,9 +97,13 @@ OBJS_hppa = $(CFILES_hppa:.c=.o)
+ OBJS_sparc = $(CFILES_sparc:.c=.o)
+ OBJS_arm = $(CFILES_arm:.c=.o)
+
+-all: $(OFILE_DIRS) $(SYM_DIRS) driver_build a68_build a88_build a386_build \
+- ax86_64_build a860_build appc_build appc64_build ahppa_build \
+- aarm_build asparc_build
++all: $(OFILE_DIRS) $(SYM_DIRS) driver_build a386_build \
++ ax86_64_build appc_build appc64_build aarm_build
++
++ifeq "yes" "$(BUILD_OBSOLETE_ARCH)"
++all: a68_build a88_build a860_build ahppa_build asparc_build
++endif
++
+
+ all_test: a68_test a88_test a860_test a386_test appc_test ahppa_test
+
+@@ -406,15 +419,18 @@ install: all
+ $(MKDIRS) $(DSTROOT)$(LOCLIBDIR)/ppc64
+ install -c -s -m 555 $(SYMROOT)/appc64_dir/as \
+ $(DSTROOT)$(LOCLIBDIR)/ppc64/as
++ifeq "yes" "$(BUILD_OBSOLETE_ARCH)"
+ $(MKDIRS) $(DSTROOT)$(LOCLIBDIR)/m68k
+ install -c -s -m 555 $(SYMROOT)/a68_dir/as \
+ $(DSTROOT)$(LOCLIBDIR)/m68k/as
+ $(MKDIRS) $(DSTROOT)$(LOCLIBDIR)/sparc
+ install -c -s -m 555 $(SYMROOT)/asparc_dir/as \
+ $(DSTROOT)$(LOCLIBDIR)/sparc/as
++endif
+ $(MKDIRS) $(DSTROOT)$(LIBDIR)/arm
+ install -c -s -m 555 $(SYMROOT)/aarm_dir/as \
+ $(DSTROOT)$(LIBDIR)/arm/as
++ifeq "yes" "$(BUILD_OBSOLETE_ARCH)"
+ $(MKDIRS) $(DSTROOT)$(LOCLIBDIR)/m88k
+ install -c -s -m 555 $(SYMROOT)/a88_dir/as \
+ $(DSTROOT)$(LOCLIBDIR)/m88k/as
+@@ -424,6 +440,7 @@ install: all
+ $(MKDIRS) $(DSTROOT)$(LOCLIBDIR)/i860
+ install -s -m 555 $(SYMROOT)/a860_dir/as \
+ $(DSTROOT)$(LOCLIBDIR)/i860/as
++endif
+
+ $(OFILE_DIRS) $(SYM_DIRS):
+ $(MKDIRS) $@
diff --git a/sys-devel/binutils-apple/files/binutils-apple-5.1-as-dir.patch b/sys-devel/binutils-apple/files/binutils-apple-5.1-as-dir.patch
new file mode 100644
index 000000000000..1c7c6360a6a8
--- /dev/null
+++ b/sys-devel/binutils-apple/files/binutils-apple-5.1-as-dir.patch
@@ -0,0 +1,47 @@
+Allow to set directory for as backends from the outside.
+
+--- cctools-855/as/driver.c.orig 2014-04-05 00:42:22.000000000 +0200
++++ cctools-855/as/driver.c 2014-11-13 13:07:09.000000000 +0100
+@@ -365,7 +365,11 @@
+ /*
+ * If this assembler exist try to run it else print an error message.
+ */
++#ifndef ASLIBEXECDIR
+ as = makestr(prefix, LIB, arch_name, AS, NULL);
++#else
++ as = makestr(ASLIBEXECDIR, arch_name, AS, NULL);
++#endif
+ new_argv = allocate((argc + 1) * sizeof(char *));
+ new_argv[0] = as;
+ j = 1;
+@@ -387,6 +391,9 @@
+ else
+ exit(1);
+ }
++#ifdef ASLIBEXECDIR
++ as_local = "";
++#else
+ as_local = makestr(prefix, LOCALLIB, arch_name, AS, NULL);
+ new_argv[0] = as_local;
+ if(access(as_local, F_OK) == 0){
+@@ -396,10 +403,12 @@
+ else
+ exit(1);
+ }
++#endif
+ printf("%s: assembler (%s or %s) for architecture %s not installed\n",
+ progname, as, as_local, arch_name);
+ arch_flags = get_arch_flags();
+ count = 0;
++#ifndef ASLIBEXECDIR
+ for(i = 0; arch_flags[i].name != NULL; i++){
+ as = makestr(prefix, LIB, arch_flags[i].name, AS, NULL);
+ if(access(as, F_OK) == 0){
+@@ -420,6 +429,7 @@
+ }
+ }
+ }
++#endif
+ if(count == 0)
+ printf("%s: no assemblers installed\n", progname);
+ exit(1);
diff --git a/sys-devel/binutils-apple/files/binutils-apple-5.1-constant-types.patch b/sys-devel/binutils-apple/files/binutils-apple-5.1-constant-types.patch
new file mode 100644
index 000000000000..066ce57a6f59
--- /dev/null
+++ b/sys-devel/binutils-apple/files/binutils-apple-5.1-constant-types.patch
@@ -0,0 +1,26 @@
+Avoid error with gcc on 32bit platforms:
+ld/LinkEdit.hpp:1329: error: integer constant is too large for 'long' type
+
+--- cctools-855/include/llvm-c/Disassembler.h.orig 2015-01-14 18:36:22.000000000 +0100
++++ cctools-855/include/llvm-c/Disassembler.h 2015-01-14 18:36:39.000000000 +0100
+@@ -133,15 +133,15 @@
+ #define LLVMDisassembler_ReferenceType_In_PCrel_Load 2
+
+ /* The input reference is from an ARM64::ADRP instruction. */
+-#define LLVMDisassembler_ReferenceType_In_ARM64_ADRP 0x100000001
++#define LLVMDisassembler_ReferenceType_In_ARM64_ADRP 0x100000001ULL
+ /* The input reference is from an ARM64::ADDXri instruction. */
+-#define LLVMDisassembler_ReferenceType_In_ARM64_ADDXri 0x100000002
++#define LLVMDisassembler_ReferenceType_In_ARM64_ADDXri 0x100000002ULL
+ /* The input reference is from an ARM64::LDRXui instruction. */
+-#define LLVMDisassembler_ReferenceType_In_ARM64_LDRXui 0x100000003
++#define LLVMDisassembler_ReferenceType_In_ARM64_LDRXui 0x100000003ULL
+ /* The input reference is from an ARM64::LDRXl instruction. */
+-#define LLVMDisassembler_ReferenceType_In_ARM64_LDRXl 0x100000004
++#define LLVMDisassembler_ReferenceType_In_ARM64_LDRXl 0x100000004ULL
+ /* The input reference is from an ARM64::ADR instruction. */
+-#define LLVMDisassembler_ReferenceType_In_ARM64_ADR 0x100000005
++#define LLVMDisassembler_ReferenceType_In_ARM64_ADR 0x100000005ULL
+
+ /* The output reference is to as symbol stub. */
+ #define LLVMDisassembler_ReferenceType_Out_SymbolStub 1
diff --git a/sys-devel/binutils-apple/files/binutils-apple-5.1-extraneous-includes.patch b/sys-devel/binutils-apple/files/binutils-apple-5.1-extraneous-includes.patch
new file mode 100644
index 000000000000..2e0a109223f9
--- /dev/null
+++ b/sys-devel/binutils-apple/files/binutils-apple-5.1-extraneous-includes.patch
@@ -0,0 +1,31 @@
+Remove extraneous includes that contain clang language extensions on Mac OS X
+10.10 (xpc/base.h - __has_extension).
+
+--- ./cctools-855/as/messages.c.orig 2015-01-12 18:49:02.000000000 +0100
++++ ./cctools-855/as/messages.c 2015-01-12 18:49:06.000000000 +0100
+@@ -23,11 +23,6 @@
+ #include <string.h>
+ #include <mach/mach.h>
+ #include <mach/mach_init.h>
+-#if defined(__OPENSTEP__) || defined(__GONZO_BUNSEN_BEAKER__)
+-#include <servers/netname.h>
+-#else
+-#include <servers/bootstrap.h>
+-#endif
+ #include "as.h"
+ #include "input-scrub.h"
+ #include "messages.h"
+--- ./cctools-855/misc/libtool.c.orig 2015-01-12 18:48:29.000000000 +0100
++++ ./cctools-855/misc/libtool.c 2015-01-12 18:48:40.000000000 +0100
+@@ -53,11 +53,6 @@
+ #endif /* LTO_SUPPORT */
+
+ #include <mach/mach_init.h>
+-#if defined(__OPENSTEP__) || defined(__GONZO_BUNSEN_BEAKER__)
+-#include <servers/netname.h>
+-#else
+-#include <servers/bootstrap.h>
+-#endif
+
+ /*
+ * This is used internally to build the table of contents.
diff --git a/sys-devel/binutils-apple/files/binutils-apple-5.1-nolto.patch b/sys-devel/binutils-apple/files/binutils-apple-5.1-nolto.patch
new file mode 100644
index 000000000000..62490ef8ce46
--- /dev/null
+++ b/sys-devel/binutils-apple/files/binutils-apple-5.1-nolto.patch
@@ -0,0 +1,43 @@
+Allow to fully disable LTO.
+
+diff --git a/libstuff/lto.c b/libstuff/lto.c
+index 6f5758d..5ba7996 100644
+--- a/libstuff/lto.c
++++ b/libstuff/lto.c
+@@ -381,4 +381,18 @@ void *mod)
+ lto_dispose(mod);
+ }
+
++#else
++
++#include <stdlib.h>
++#include "stuff/ofile.h"
++
++__private_extern__
++int
++is_llvm_bitcode(
++ struct ofile *ofile,
++ char *addr,
++ size_t size)
++{
++ return 0;
++}
+ #endif /* LTO_SUPPORT */
+diff --git a/misc/libtool.c b/misc/libtool.c
+index f9c7557..ff829cc 100644
+--- a/misc/libtool.c
++++ b/misc/libtool.c
+@@ -1370,8 +1370,11 @@ void)
+ }
+ }
+ }
+- else if(ofiles[i].arch_type == OFILE_Mach_O ||
+- ofiles[i].arch_type == OFILE_LLVM_BITCODE){
++ else if(ofiles[i].arch_type == OFILE_Mach_O
++#ifdef LTO_SUPPORT
++ || ofiles[i].arch_type == OFILE_LLVM_BITCODE
++#endif
++ ){
+ if(cmd_flags.ranlib == TRUE){
+ error("for architecture: %s file: %s is not an "
+ "archive (no processing done on this file)",
diff --git a/sys-devel/binutils-apple/files/binutils-apple-5.1-otool-stdc.patch b/sys-devel/binutils-apple/files/binutils-apple-5.1-otool-stdc.patch
new file mode 100644
index 000000000000..ca02e643a45e
--- /dev/null
+++ b/sys-devel/binutils-apple/files/binutils-apple-5.1-otool-stdc.patch
@@ -0,0 +1,23 @@
+Do not use C++/C11(?) style local variable declaration.
+
+--- cctools-855/otool/dyld_bind_info.c.orig 2015-01-12 18:55:04.000000000 +0100
++++ cctools-855/otool/dyld_bind_info.c 2015-01-12 18:56:35.000000000 +0100
+@@ -353,7 +353,9 @@
+ skip = read_uleb128(&p, end);
+ sectName = sectionName(segIndex, segStartAddr + segOffset,
+ segs, nsegs, segs64, nsegs64);
+- for (uint32_t i=0; i < count; ++i) {
++ {
++ uint32_t i;
++ for (i=0; i < count; ++i) {
+ if(pass == 2){
+ (*dbi)[n].segname = segName;
+ (*dbi)[n].sectname = sectName;
+@@ -367,6 +369,7 @@
+ n++;
+ segOffset += skip + sizeof_pointer;
+ }
++ }
+ break;
+ default:
+ return; /* throwf("bad bind opcode %d", *p); */
diff --git a/sys-devel/binutils-apple/files/binutils-apple-5.1-ranlib.patch b/sys-devel/binutils-apple/files/binutils-apple-5.1-ranlib.patch
new file mode 100644
index 000000000000..1930dfc82d27
--- /dev/null
+++ b/sys-devel/binutils-apple/files/binutils-apple-5.1-ranlib.patch
@@ -0,0 +1,15 @@
+Run ranlib before installation of the libary.
+
+--- ./cctools-855/cbtlibs/Makefile.ranlib 2014-04-05 00:42:22.000000000 +0200
++++ ./cctools-855/cbtlibs/Makefile 2014-08-29 14:49:41.000000000 +0200
+@@ -61,9 +61,9 @@
+
+ lib_ofiles_install: lib_ofiles
+ $(MKDIRS) $(DSTROOT)$(LOCLIBDIR)
++ $(RANLIB) $(SYMROOT)/libsyminfo.a
+ install -p -c -m 444 $(SYMROOT)/libsyminfo.a \
+ $(DSTROOT)$(LOCLIBDIR)/libsyminfo.a
+- $(RANLIB) $(DSTROOT)$(LOCLIBDIR)/libsyminfo.a
+
+ $(OFILE_DIR) $(SYMROOT):
+ $(MKDIRS) $@
diff --git a/sys-devel/binutils-apple/files/binutils-apple-5.1-strnlen.patch b/sys-devel/binutils-apple/files/binutils-apple-5.1-strnlen.patch
new file mode 100644
index 000000000000..887e15628b31
--- /dev/null
+++ b/sys-devel/binutils-apple/files/binutils-apple-5.1-strnlen.patch
@@ -0,0 +1,45 @@
+Provide strnlen on platforms where it's missing.
+
+--- cctools-855/otool/ofile_print.c.orig 2015-01-14 18:33:14.000000000 +0100
++++ cctools-855/otool/ofile_print.c 2015-01-14 18:34:03.000000000 +0100
+@@ -3647,6 +3647,40 @@
+ printf(" pad %u\n", ec->pad);
+ }
+
++/* borrowed from gnulib */
++#include <AvailabilityMacros.h>
++
++#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
++/* Find the length of STRING, but scan at most MAXLEN characters.
++ * Copyright (C) 2005-2007, 2009-2015 Free Software Foundation, Inc.
++ * Written by Simon Josefsson.
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2, or (at your option)
++ * any later version.
++ *
++ * This program 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 General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, see <http://www.gnu.org/licenses/>. */
++
++#include <string.h>
++
++/* Find the length of STRING, but scan at most MAXLEN characters.
++ * If no '\0' terminator is found in that many characters, return MAXLEN. */
++
++size_t
++strnlen (const char *string, size_t maxlen)
++{
++ const char *end = memchr (string, '\0', maxlen);
++ return end ? (size_t) (end - string) : maxlen;
++}
++#endif
++
+ /*
+ * print an LC_LINKER_OPTION command. The linker_option_command structure
+ * specified must be aligned correctly and in the host byte sex. The lc is
diff --git a/sys-devel/binutils-apple/files/cctools-839-intel-retf.patch b/sys-devel/binutils-apple/files/cctools-839-intel-retf.patch
new file mode 100644
index 000000000000..d9bd9a8425b9
--- /dev/null
+++ b/sys-devel/binutils-apple/files/cctools-839-intel-retf.patch
@@ -0,0 +1,14 @@
+diff --git a/as/i386-opcode.h b/as/i386-opcode.h
+index 4ba397f..862449a 100644
+--- a/as/i386-opcode.h
++++ b/as/i386-opcode.h
+@@ -415,6 +415,9 @@ static const template i386_optab[] =
+ {"ret", 1, 0xc2, X, Cpu64, wq_Suf|DefaultSize|NoRex64,{ Imm16, 0, 0} },
+ {"lret", 0, 0xcb, X, 0, wlq_Suf|DefaultSize, { 0, 0, 0} },
+ {"lret", 1, 0xca, X, 0, wlq_Suf|DefaultSize, { Imm16, 0, 0} },
++// intel syntax
++{"retf", 0, 0xcb, X, 0, wlq_Suf|DefaultSize, { 0, 0, 0} },
++{"retf", 1, 0xca, X, 0, wlq_Suf|DefaultSize, { Imm16, 0, 0} },
+ {"enter", 2, 0xc8, X, Cpu186|CpuNo64, wl_Suf|DefaultSize, { Imm16, Imm8, 0} },
+ {"enter", 2, 0xc8, X, Cpu64, wq_Suf|DefaultSize|NoRex64, { Imm16, Imm8, 0} },
+ {"leave", 0, 0xc9, X, Cpu186|CpuNo64, wl_Suf|DefaultSize, { 0, 0, 0} },
diff --git a/sys-devel/binutils-apple/files/ld64-123.2-Makefile b/sys-devel/binutils-apple/files/ld64-123.2-Makefile
new file mode 100644
index 000000000000..47af12d4b2ec
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-123.2-Makefile
@@ -0,0 +1,47 @@
+CPPFLAGS += "-DCPU_SUBTYPE_X86_ALL=((cpu_subtype_t)3)" -Iinclude -Iabstraction -Ild -Ild/parsers -Iother -I.
+
+# dropped machocheck due to compilation failures
+all: rebase unwinddump dyldinfo ld64 ObjectDump
+
+libprunetrie.a: other/PruneTrie.o other/prune_trie.h
+ $(AR) -s -r -c libprunetrie.a other/PruneTrie.o
+
+LD64LIBS=ld/parsers/archive_file.o ld/parsers/macho_relocatable_file.o \
+ ld/parsers/opaque_section_file.o \
+ ld/parsers/macho_dylib_file.o \
+ ld/passes/branch_island.o ld/passes/dylibs.o ld/passes/order_file.o \
+ ld/passes/branch_shim.o ld/passes/got.o ld/passes/tlvp.o \
+ ld/passes/compact_unwind.o ld/passes/huge.o \
+ ld/passes/dtrace_dof.o ld/passes/objc.o \
+ ld/passes/stubs/stubs.o \
+ ld/InputFiles.o ld/OutputFile.o ld/SymbolTable.o \
+ ld/Options.o ld/Resolver.o ld/debugline.o ld/ld.o
+
+ifeq ($(LTO),1)
+CPPFLAGS += "-DLTO"
+LTO_OBJ = ld/parsers/lto_file.o
+LIBLTO = -lLTO
+else
+CPPFLAGS += "-ULTO"
+LTO_OBJ =
+LIBLTO =
+endif
+
+ld64: libprunetrie.a version.o $(LD64LIBS) $(LTO_OBJ)
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) $(LIBLTO) -o $@ $^
+
+rebase: other/rebase.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
+
+dyldinfo: other/dyldinfo.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
+
+unwinddump: other/unwinddump.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
+
+ObjectDump: other/ObjectDump.o ld/debugline.o ld/parsers/macho_relocatable_file.o $(LTO_OBJ)
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) $(LIBLTO) -o $@ $^
+
+machocheck: other/machochecker.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
+
diff --git a/sys-devel/binutils-apple/files/ld64-123.2-darwin8-no-mlong-branch-warning.patch b/sys-devel/binutils-apple/files/ld64-123.2-darwin8-no-mlong-branch-warning.patch
new file mode 100644
index 000000000000..c8a303e1c9d6
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-123.2-darwin8-no-mlong-branch-warning.patch
@@ -0,0 +1,17 @@
+On Tiger (Darwin 8) the whole system (/usr/bin/crt0.o for example) is
+long-branch compiled, so *any* linkage operation causes this warning to
+be raised. Don't do it.
+
+
+--- ld/parsers/macho_relocatable_file.cpp
++++ ld/parsers/macho_relocatable_file.cpp
+@@ -5532,9 +5532,6 @@
+ // this is from -mlong-branch codegen. We ignore the jump island and make reference to the real target
+ if ( nextReloc->r_type() != PPC_RELOC_PAIR )
+ throw "PPC_RELOC_JBSR missing following pair";
+- if ( !parser._hasLongBranchStubs )
+- warning("object file compiled with -mlong-branch which is no longer needed. "
+- "To remove this warning, recompile without -mlong-branch: %s", parser._path);
+ parser._hasLongBranchStubs = true;
+ result = true;
+ if ( reloc->r_extern() ) {
diff --git a/sys-devel/binutils-apple/files/ld64-123.2-debug-backtrace.patch b/sys-devel/binutils-apple/files/ld64-123.2-debug-backtrace.patch
new file mode 100644
index 000000000000..f1126503b424
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-123.2-debug-backtrace.patch
@@ -0,0 +1,15 @@
+execinfo.h isn't available <10.5, so make sure it is only included when
+actually necessary
+
+--- ld/ld.cpp
++++ ld/ld.cpp
+@@ -37,7 +37,9 @@
+ #include <errno.h>
+ #include <limits.h>
+ #include <unistd.h>
++#ifndef NDEBUG
+ #include <execinfo.h>
++#endif
+ #include <mach/mach_time.h>
+ #include <mach/vm_statistics.h>
+ #include <mach/mach_init.h>
diff --git a/sys-devel/binutils-apple/files/ld64-123.2.1-lto.patch b/sys-devel/binutils-apple/files/ld64-123.2.1-lto.patch
new file mode 100644
index 000000000000..17bac81ca291
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-123.2.1-lto.patch
@@ -0,0 +1,218 @@
+diff -ur ld.orig/InputFiles.cpp ld/InputFiles.cpp
+--- ld.orig/InputFiles.cpp 2010-10-05 01:57:50.000000000 +0200
++++ ld/InputFiles.cpp 2011-09-03 20:33:40.000000000 +0200
+@@ -58,7 +58,9 @@
+ #include "macho_relocatable_file.h"
+ #include "macho_dylib_file.h"
+ #include "archive_file.h"
++#ifdef LTO
+ #include "lto_file.h"
++#endif
+ #include "opaque_section_file.h"
+
+
+@@ -175,9 +177,11 @@
+ if ( result != NULL )
+ return result;
+
++#ifdef LTO
+ result = lto::archName(p, len);
+ if ( result != NULL )
+ return result;
++#endif
+
+ if ( strncmp((const char*)p, "!<arch>\n", 8) == 0 )
+ return "archive";
+@@ -264,10 +268,12 @@
+ if ( objResult != NULL )
+ return this->addObject(objResult, info, len);
+
++#if LTO
+ // see if it is an llvm object file
+ objResult = lto::parse(p, len, info.path, info.modTime, _nextInputOrdinal, _options.architecture(), _options.subArchitecture(), _options.logAllFiles());
+ if ( objResult != NULL )
+ return this->addObject(objResult, info, len);
++#endif
+
+ // see if it is a dynamic library
+ ld::dylib::File* dylibResult = mach_o::dylib::parse(p, len, info.path, info.modTime, _options, _nextInputOrdinal, info.options.fBundleLoader);
+@@ -286,6 +292,7 @@
+ if ( archiveResult != NULL )
+ return this->addArchive(archiveResult, info, len);
+
++#ifdef LTO
+ // does not seem to be any valid linker input file, check LTO misconfiguration problems
+ if ( lto::archName((uint8_t*)p, len) != NULL ) {
+ if ( lto::libLTOisLoaded() ) {
+@@ -310,6 +317,7 @@
+ throwf("could not process llvm bitcode object file, because %s could not be loaded", libLTO);
+ }
+ }
++#endif
+
+ // error handling
+ if ( ((fat_header*)p)->magic == OSSwapBigToHostInt32(FAT_MAGIC) ) {
+diff -ur ld.orig/Options.cpp ld/Options.cpp
+--- ld.orig/Options.cpp 2011-03-08 03:06:35.000000000 +0100
++++ ld/Options.cpp 2011-09-03 21:06:28.000000000 +0200
+@@ -36,10 +36,12 @@
+ #include "Architectures.hpp"
+ #include "MachOFileAbstraction.hpp"
+
++#ifdef LTO
+ // upward dependency on lto::version()
+ namespace lto {
+ extern const char* version();
+ }
++#endif
+
+ // magic to place command line in crash reports
+ const int crashreporterBufferSize = 2000;
+@@ -2786,9 +2788,11 @@
+ fprintf(stderr, "%s", ldVersionString);
+ // if only -v specified, exit cleanly
+ if ( argc == 2 ) {
++#ifdef LTO
+ const char* ltoVers = lto::version();
+ if ( ltoVers != NULL )
+ fprintf(stderr, "%s\n", ltoVers);
++#endif
+ exit(0);
+ }
+ }
+diff -ur ld.orig/Resolver.cpp ld/Resolver.cpp
+--- ld.orig/Resolver.cpp 2010-12-10 23:39:41.000000000 +0100
++++ ld/Resolver.cpp 2011-09-03 20:38:24.000000000 +0200
+@@ -58,7 +58,9 @@
+ #include "InputFiles.h"
+ #include "SymbolTable.h"
+ #include "Resolver.h"
++#ifdef LTO
+ #include "parsers/lto_file.h"
++#endif
+
+
+ namespace ld {
+@@ -1275,6 +1277,7 @@
+
+ void Resolver::linkTimeOptimize()
+ {
++#ifdef LTO
+ // only do work here if some llvm obj files where loaded
+ if ( ! _haveLLVMObjs )
+ return;
+@@ -1375,6 +1378,9 @@
+ // check new code does not override some dylib
+ this->checkDylibSymbolCollisions();
+ }
++#else
++ return;
++#endif
+ }
+
+
+diff -ur ld.orig/ld.cpp ld/ld.cpp
+--- ld.orig/ld.cpp 2011-09-03 20:24:07.000000000 +0200
++++ ld/ld.cpp 2011-09-03 20:40:06.000000000 +0200
+@@ -85,7 +85,9 @@
+ #include "parsers/archive_file.h"
+ #include "parsers/macho_relocatable_file.h"
+ #include "parsers/macho_dylib_file.h"
++#ifdef LTO
+ #include "parsers/lto_file.h"
++#endif
+ #include "parsers/opaque_section_file.h"
+
+
+diff -ur ld.orig/parsers/archive_file.cpp ld/parsers/archive_file.cpp
+--- ld.orig/parsers/archive_file.cpp 2010-09-29 02:26:13.000000000 +0200
++++ ld/parsers/archive_file.cpp 2011-09-03 21:01:55.000000000 +0200
+@@ -38,7 +38,9 @@
+ #include "Architectures.hpp"
+
+ #include "macho_relocatable_file.h"
++#ifdef LTO
+ #include "lto_file.h"
++#endif
+ #include "archive_file.h"
+
+
+@@ -87,8 +89,10 @@
+ private:
+ static bool validMachOFile(const uint8_t* fileContent, uint64_t fileLength,
+ const mach_o::relocatable::ParserOptions& opts);
++#ifdef LTO
+ static bool validLTOFile(const uint8_t* fileContent, uint64_t fileLength,
+ const mach_o::relocatable::ParserOptions& opts);
++#endif
+ static cpu_type_t architecture();
+
+
+@@ -232,12 +236,13 @@
+ return mach_o::relocatable::isObjectFile(fileContent, fileLength, opts);
+ }
+
++#ifdef LTO
+ template <typename A>
+ bool File<A>::validLTOFile(const uint8_t* fileContent, uint64_t fileLength, const mach_o::relocatable::ParserOptions& opts)
+ {
+ return lto::isObjectFile(fileContent, fileLength, opts.architecture, opts.subType);
+ }
+-
++#endif
+
+
+ template <typename A>
+@@ -256,7 +261,11 @@
+ if ( (p==start) && ((strcmp(memberName, SYMDEF_SORTED) == 0) || (strcmp(memberName, SYMDEF) == 0)) )
+ continue;
+ // archive is valid if first .o file is valid
+- return (validMachOFile(p->content(), p->contentSize(), opts) || validLTOFile(p->content(), p->contentSize(), opts));
++ return (validMachOFile(p->content(), p->contentSize(), opts)
++#ifdef LTO
++ || validLTOFile(p->content(), p->contentSize(), opts)
++#endif
++ );
+ }
+ // empty archive
+ return true;
+@@ -342,12 +351,14 @@
+ this->ordinal() + memberIndex, _objOpts);
+ if ( result != NULL )
+ return result;
++#ifdef LTO
+ // see if member is llvm bitcode file
+ result = lto::parse(member->content(), member->contentSize(),
+ mPath, member->modificationTime(), this->ordinal() + memberIndex,
+ _objOpts.architecture, _objOpts.subType, _logAllFiles);
+ if ( result != NULL )
+ return result;
++#endif
+
+ throwf("archive member '%s' with length %d is not mach-o or llvm bitcode", memberName, member->contentSize());
+ }
+--- other/ObjectDump.cpp.orig 2011-09-03 21:15:10.000000000 +0200
++++ other/ObjectDump.cpp 2011-09-03 21:14:37.000000000 +0200
+@@ -33,7 +33,9 @@
+
+ #include "MachOFileAbstraction.hpp"
+ #include "parsers/macho_relocatable_file.h"
++#ifdef LTO
+ #include "parsers/lto_file.h"
++#endif
+
+ static bool sDumpContent= true;
+ static bool sDumpStabs = false;
+@@ -1121,10 +1123,12 @@
+ if ( objResult != NULL )
+ return objResult;
+
++#ifdef LTO
+ // see if it is an llvm object file
+ objResult = lto::parse(p, fileLen, path, stat_buf.st_mtime, 0, sPreferredArch, sPreferredSubArch, false);
+ if ( objResult != NULL )
+ return objResult;
++#endif
+
+ throwf("not a mach-o object file: %s", path);
+ #else
diff --git a/sys-devel/binutils-apple/files/ld64-127.2-Makefile b/sys-devel/binutils-apple/files/ld64-127.2-Makefile
new file mode 100644
index 000000000000..74aef560a23e
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-127.2-Makefile
@@ -0,0 +1,50 @@
+CPPFLAGS += -Iinclude -Iabstraction -Ild -Ild/parsers -Iother -I.
+
+# some files generate warnings about applying offsetof to a non-POD type.
+# Upstream seems aware of that and ignores by setting
+# GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = NO in the xcode project.
+CXXFLAGS += -Wno-invalid-offsetof
+
+all: rebase unwinddump dyldinfo ld64 ObjectDump machocheck
+
+libprunetrie.a: other/PruneTrie.o other/prune_trie.h
+ $(AR) -s -r -c libprunetrie.a other/PruneTrie.o
+
+LD64LIBS=ld/parsers/archive_file.o ld/parsers/macho_relocatable_file.o \
+ ld/parsers/opaque_section_file.o \
+ ld/parsers/macho_dylib_file.o \
+ ld/passes/branch_island.o ld/passes/dylibs.o ld/passes/order_file.o \
+ ld/passes/branch_shim.o ld/passes/got.o ld/passes/tlvp.o \
+ ld/passes/compact_unwind.o ld/passes/huge.o \
+ ld/passes/dtrace_dof.o ld/passes/objc.o \
+ ld/passes/stubs/stubs.o \
+ ld/InputFiles.o ld/OutputFile.o ld/SymbolTable.o \
+ ld/Options.o ld/Resolver.o ld/debugline.o ld/ld.o
+
+ifeq ($(LTO),1)
+CPPFLAGS += -DLTO
+LTO_OBJ = ld/parsers/lto_file.o
+LIBLTO = -lLTO
+else
+LTO_OBJ =
+LIBLTO =
+endif
+
+ld64: libprunetrie.a version.o $(LD64LIBS) $(LTO_OBJ)
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) $(LIBLTO) -o $@ $^
+
+rebase: other/rebase.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
+
+dyldinfo: other/dyldinfo.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
+
+unwinddump: other/unwinddump.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
+
+ObjectDump: other/ObjectDump.o ld/debugline.o ld/parsers/macho_relocatable_file.o $(LTO_OBJ)
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) $(LIBLTO) -o $@ $^
+
+machocheck: other/machochecker.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
+
diff --git a/sys-devel/binutils-apple/files/ld64-127.2-extraneous-headers.patch b/sys-devel/binutils-apple/files/ld64-127.2-extraneous-headers.patch
new file mode 100644
index 000000000000..34d508063df1
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-127.2-extraneous-headers.patch
@@ -0,0 +1,12 @@
+Remove unused header that doesn't exist on older OS Xes.
+
+--- ld64-127.2/src/ld/parsers/libunwind/AddressSpace.hpp.orig 2015-01-27 23:24:49.000000000 +0100
++++ ld64-127.2/src/ld/parsers/libunwind/AddressSpace.hpp 2015-01-27 23:26:21.000000000 +0100
+@@ -37,7 +37,6 @@
+ #include <mach-o/getsect.h>
+ #include <mach-o/dyld_priv.h>
+ #include <mach/i386/thread_status.h>
+-#include <Availability.h>
+
+ #include "FileAbstraction.hpp"
+ #include "libunwind.h"
diff --git a/sys-devel/binutils-apple/files/ld64-127.2-lto.patch b/sys-devel/binutils-apple/files/ld64-127.2-lto.patch
new file mode 100644
index 000000000000..b9a3f14042c5
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-127.2-lto.patch
@@ -0,0 +1,214 @@
+--- src/ld/InputFiles.cpp
++++ src/ld/InputFiles.cpp
+@@ -58,7 +58,9 @@
+ #include "macho_relocatable_file.h"
+ #include "macho_dylib_file.h"
+ #include "archive_file.h"
++#ifdef LTO
+ #include "lto_file.h"
++#endif
+ #include "opaque_section_file.h"
+
+
+@@ -175,9 +177,11 @@
+ if ( result != NULL )
+ return result;
+
++#ifdef LTO
+ result = lto::archName(p, len);
+ if ( result != NULL )
+ return result;
++#endif
+
+ if ( strncmp((const char*)p, "!<arch>\n", 8) == 0 )
+ return "archive";
+@@ -264,10 +268,12 @@
+ if ( objResult != NULL )
+ return this->addObject(objResult, info, len);
+
++#if LTO
+ // see if it is an llvm object file
+ objResult = lto::parse(p, len, info.path, info.modTime, _nextInputOrdinal, _options.architecture(), _options.subArchitecture(), _options.logAllFiles());
+ if ( objResult != NULL )
+ return this->addObject(objResult, info, len);
++#endif
+
+ // see if it is a dynamic library
+ ld::dylib::File* dylibResult = mach_o::dylib::parse(p, len, info.path, info.modTime, _options, _nextInputOrdinal, info.options.fBundleLoader, indirectDylib);
+@@ -291,6 +297,7 @@
+ return this->addArchive(archiveResult, info, len);
+ }
+
++#ifdef LTO
+ // does not seem to be any valid linker input file, check LTO misconfiguration problems
+ if ( lto::archName((uint8_t*)p, len) != NULL ) {
+ if ( lto::libLTOisLoaded() ) {
+@@ -315,6 +322,7 @@
+ throwf("could not process llvm bitcode object file, because %s could not be loaded", libLTO);
+ }
+ }
++#endif
+
+ // error handling
+ if ( ((fat_header*)p)->magic == OSSwapBigToHostInt32(FAT_MAGIC) ) {
+--- src/ld/Options.cpp
++++ src/ld/Options.cpp
+@@ -36,10 +36,12 @@
+ #include "Architectures.hpp"
+ #include "MachOFileAbstraction.hpp"
+
++#ifdef LTO
+ // upward dependency on lto::version()
+ namespace lto {
+ extern const char* version();
+ }
++#endif
+
+ // magic to place command line in crash reports
+ const int crashreporterBufferSize = 2000;
+@@ -2766,9 +2768,11 @@
+ fprintf(stderr, "%s", ldVersionString);
+ // if only -v specified, exit cleanly
+ if ( argc == 2 ) {
++#ifdef LTO
+ const char* ltoVers = lto::version();
+ if ( ltoVers != NULL )
+ fprintf(stderr, "%s\n", ltoVers);
++#endif
+ exit(0);
+ }
+ }
+--- src/ld/Resolver.cpp
++++ src/ld/Resolver.cpp
+@@ -58,7 +58,9 @@
+ #include "InputFiles.h"
+ #include "SymbolTable.h"
+ #include "Resolver.h"
++#ifdef LTO
+ #include "parsers/lto_file.h"
++#endif
+
+
+ namespace ld {
+@@ -1315,6 +1317,7 @@
+
+ void Resolver::linkTimeOptimize()
+ {
++#ifdef LTO
+ // only do work here if some llvm obj files where loaded
+ if ( ! _haveLLVMObjs )
+ return;
+@@ -1415,6 +1418,9 @@
+ // check new code does not override some dylib
+ this->checkDylibSymbolCollisions();
+ }
++#else
++ return;
++#endif
+ }
+
+
+--- src/ld/ld.cpp
++++ src/ld/ld.cpp
+@@ -83,7 +83,9 @@
+ #include "parsers/archive_file.h"
+ #include "parsers/macho_relocatable_file.h"
+ #include "parsers/macho_dylib_file.h"
++#ifdef LTO
+ #include "parsers/lto_file.h"
++#endif
+ #include "parsers/opaque_section_file.h"
+
+
+--- src/ld/parsers/archive_file.cpp
++++ src/ld/parsers/archive_file.cpp
+@@ -39,7 +39,9 @@
+ #include "Architectures.hpp"
+
+ #include "macho_relocatable_file.h"
++#ifdef LTO
+ #include "lto_file.h"
++#endif
+ #include "archive_file.h"
+
+
+@@ -91,8 +93,10 @@
+ private:
+ static bool validMachOFile(const uint8_t* fileContent, uint64_t fileLength,
+ const mach_o::relocatable::ParserOptions& opts);
++#ifdef LTO
+ static bool validLTOFile(const uint8_t* fileContent, uint64_t fileLength,
+ const mach_o::relocatable::ParserOptions& opts);
++#endif
+ static cpu_type_t architecture();
+
+ class Entry : ar_hdr
+@@ -239,12 +243,13 @@
+ return mach_o::relocatable::isObjectFile(fileContent, fileLength, opts);
+ }
+
++#ifdef LTO
+ template <typename A>
+ bool File<A>::validLTOFile(const uint8_t* fileContent, uint64_t fileLength, const mach_o::relocatable::ParserOptions& opts)
+ {
+ return lto::isObjectFile(fileContent, fileLength, opts.architecture, opts.subType);
+ }
+-
++#endif
+
+
+ template <typename A>
+@@ -263,7 +268,11 @@
+ if ( (p==start) && ((strcmp(memberName, SYMDEF_SORTED) == 0) || (strcmp(memberName, SYMDEF) == 0)) )
+ continue;
+ // archive is valid if first .o file is valid
+- return (validMachOFile(p->content(), p->contentSize(), opts) || validLTOFile(p->content(), p->contentSize(), opts));
++ return (validMachOFile(p->content(), p->contentSize(), opts)
++#ifdef LTO
++ || validLTOFile(p->content(), p->contentSize(), opts)
++#endif
++ );
+ }
+ // empty archive
+ return true;
+@@ -363,6 +372,7 @@
+ _instantiatedEntries[member] = state;
+ return _instantiatedEntries[member];
+ }
++#ifdef LTO
+ // see if member is llvm bitcode file
+ result = lto::parse(member->content(), member->contentSize(),
+ mPath, member->modificationTime(), this->ordinal() + memberIndex,
+@@ -372,6 +382,7 @@
+ _instantiatedEntries[member] = state;
+ return _instantiatedEntries[member];
+ }
++#endif
+
+ throwf("archive member '%s' with length %d is not mach-o or llvm bitcode", memberName, member->contentSize());
+ }
+--- src/other/ObjectDump.cpp
++++ src/other/ObjectDump.cpp
+@@ -33,7 +33,9 @@
+
+ #include "MachOFileAbstraction.hpp"
+ #include "parsers/macho_relocatable_file.h"
++#ifdef LTO
+ #include "parsers/lto_file.h"
++#endif
+
+ static bool sDumpContent= true;
+ static bool sDumpStabs = false;
+@@ -1150,10 +1152,12 @@
+ if ( objResult != NULL )
+ return objResult;
+
++#ifdef LTO
+ // see if it is an llvm object file
+ objResult = lto::parse(p, fileLen, path, stat_buf.st_mtime, 0, sPreferredArch, sPreferredSubArch, false);
+ if ( objResult != NULL )
+ return objResult;
++#endif
+
+ throwf("not a mach-o object file: %s", path);
+ #else
diff --git a/sys-devel/binutils-apple/files/ld64-127.2-ppc-range-warning.patch b/sys-devel/binutils-apple/files/ld64-127.2-ppc-range-warning.patch
new file mode 100644
index 000000000000..c9f850823939
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-127.2-ppc-range-warning.patch
@@ -0,0 +1,16 @@
+Insipred by the comment here:
+http://bugs.freepascal.org/view.php?id=20879
+It looks like the PPC case is missing, hence add this. Without, we get
+linker errors for compiling packages like Python and TexLive.
+
+--- src/ld/OutputFile.cpp
++++ src/ld/OutputFile.cpp
+@@ -807,7 +807,7 @@
+ // is encoded in mach-o the same as:
+ // .long _foo + 0x40000000
+ // so if _foo lays out to 0xC0000100, the first is ok, but the second is not.
+- if ( (_options.architecture() == CPU_TYPE_ARM) || (_options.architecture() == CPU_TYPE_I386) ) {
++ if ( (_options.architecture() == CPU_TYPE_ARM) || (_options.architecture() == CPU_TYPE_I386) || (_options.architecture() == CPU_TYPE_POWERPC) ) {
+ // Unlikely userland code does funky stuff like this, so warn for them, but not warn for -preload
+ if ( _options.outputKind() != Options::kPreload ) {
+ warning("32-bit absolute address out of range (0x%08llX max is 4GB): from %s + 0x%08X (0x%08llX) to 0x%08llX",
diff --git a/sys-devel/binutils-apple/files/ld64-127.2-thread_state.patch b/sys-devel/binutils-apple/files/ld64-127.2-thread_state.patch
new file mode 100644
index 000000000000..e894bee0c8d0
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-127.2-thread_state.patch
@@ -0,0 +1,13 @@
+Include thread_status.h so that __darwin_i386_thread_state_t is known and will
+not generate warnings that it's declared inside parameter list.
+
+--- ld64-127.2/src/ld/HeaderAndLoadCommands.hpp.orig 2015-01-28 00:32:55.000000000 +0100
++++ ld64-127.2/src/ld/HeaderAndLoadCommands.hpp 2015-01-28 00:27:51.000000000 +0100
+@@ -29,6 +29,7 @@
+ #include <limits.h>
+ #include <unistd.h>
+ #include <mach-o/loader.h>
++#include <mach/i386/thread_status.h>
+
+ #include <vector>
+
diff --git a/sys-devel/binutils-apple/files/ld64-128.2-1010.patch b/sys-devel/binutils-apple/files/ld64-128.2-1010.patch
new file mode 100644
index 000000000000..dee69e7c858b
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-128.2-1010.patch
@@ -0,0 +1,20 @@
+Backport (just a diff really) of OS X 10.10 handling from 241.9.
+
+--- ld64-128.2/src/ld/Options.cpp 2015-01-30 17:16:48.000000000 +0100
++++ ld64-241.9/src/ld/Options.cpp 2015-01-30 17:11:57.000000000 +0100
+@@ -1241,7 +1348,14 @@
+ throw "-macosx_version_min argument missing";
+
+ if ( (strncmp(version, "10.", 3) == 0) && isdigit(version[3]) ) {
+- unsigned int minorVersion = version[3] - '0';
++ unsigned int minorVersion = 0;
++ for (int i=3; isdigit(version[i]); ++i) {
++ minorVersion = minorVersion*10 + (version[i] - '0');
++ }
++ if ( minorVersion > 255 ) {
++ warning("Mac OS X minor version > 255 in '%s'", version);
++ minorVersion = 255;
++ }
+ fMacVersionMin = (ld::MacVersionMin)(0x000A0000 | (minorVersion << 8));
+ }
+ else {
diff --git a/sys-devel/binutils-apple/files/ld64-128.2-Makefile b/sys-devel/binutils-apple/files/ld64-128.2-Makefile
new file mode 100644
index 000000000000..b02c82459449
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-128.2-Makefile
@@ -0,0 +1,47 @@
+CPPFLAGS += "-DCPU_SUBTYPE_X86_ALL=((cpu_subtype_t)3)" -Iinclude -Iabstraction -Ild -Ild/parsers -Iother -I.
+
+# dropped machocheck due to compilation failures
+all: rebase unwinddump dyldinfo ld64 ObjectDump
+
+libprunetrie.a: other/PruneTrie.o other/prune_trie.h
+ $(AR) -s -r -c libprunetrie.a other/PruneTrie.o
+
+LD64LIBS=ld/parsers/archive_file.o ld/parsers/macho_relocatable_file.o \
+ ld/parsers/opaque_section_file.o \
+ ld/parsers/macho_dylib_file.o \
+ ld/passes/branch_island.o ld/passes/dylibs.o ld/passes/order.o \
+ ld/passes/branch_shim.o ld/passes/got.o ld/passes/tlvp.o \
+ ld/passes/compact_unwind.o ld/passes/huge.o \
+ ld/passes/dtrace_dof.o ld/passes/objc.o \
+ ld/passes/stubs/stubs.o \
+ ld/InputFiles.o ld/OutputFile.o ld/SymbolTable.o \
+ ld/Options.o ld/Resolver.o ld/debugline.o ld/ld.o
+
+ifeq ($(LTO),1)
+CPPFLAGS += "-DLTO"
+LTO_OBJ = ld/parsers/lto_file.o
+LIBLTO = -lLTO
+else
+CPPFLAGS += "-ULTO"
+LTO_OBJ =
+LIBLTO =
+endif
+
+ld64: libprunetrie.a version.o $(LD64LIBS) $(LTO_OBJ)
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) $(LIBLTO) -o $@ $^
+
+rebase: other/rebase.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
+
+dyldinfo: other/dyldinfo.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
+
+unwinddump: other/unwinddump.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
+
+ObjectDump: other/ObjectDump.o ld/debugline.o ld/parsers/macho_relocatable_file.o $(LTO_OBJ)
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) $(LIBLTO) -o $@ $^
+
+machocheck: other/machochecker.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
+
diff --git a/sys-devel/binutils-apple/files/ld64-128.2-Makefile-2 b/sys-devel/binutils-apple/files/ld64-128.2-Makefile-2
new file mode 100644
index 000000000000..1d48ae9eaaf4
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-128.2-Makefile-2
@@ -0,0 +1,50 @@
+CPPFLAGS += -Iinclude -Iabstraction -Ild -Ild/parsers -Iother -I.
+
+# some files generate warnings about applying offsetof to a non-POD type.
+# Upstream seems aware of that and ignores by setting
+# GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = NO in the xcode project.
+CXXFLAGS += -Wno-invalid-offsetof
+
+all: rebase unwinddump dyldinfo ld64 ObjectDump machocheck
+
+libprunetrie.a: other/PruneTrie.o other/prune_trie.h
+ $(AR) -s -r -c libprunetrie.a other/PruneTrie.o
+
+LD64LIBS=ld/parsers/archive_file.o ld/parsers/macho_relocatable_file.o \
+ ld/parsers/opaque_section_file.o \
+ ld/parsers/macho_dylib_file.o \
+ ld/passes/branch_island.o ld/passes/dylibs.o ld/passes/order.o \
+ ld/passes/branch_shim.o ld/passes/got.o ld/passes/tlvp.o \
+ ld/passes/compact_unwind.o ld/passes/huge.o \
+ ld/passes/dtrace_dof.o ld/passes/objc.o \
+ ld/passes/stubs/stubs.o \
+ ld/InputFiles.o ld/OutputFile.o ld/SymbolTable.o \
+ ld/Options.o ld/Resolver.o ld/debugline.o ld/ld.o
+
+ifeq ($(LTO),1)
+CPPFLAGS += -DLTO
+LTO_OBJ = ld/parsers/lto_file.o
+LIBLTO = -lLTO
+else
+LTO_OBJ =
+LIBLTO =
+endif
+
+ld64: libprunetrie.a version.o $(LD64LIBS) $(LTO_OBJ)
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) $(LIBLTO) -o $@ $^
+
+rebase: other/rebase.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
+
+dyldinfo: other/dyldinfo.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
+
+unwinddump: other/unwinddump.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
+
+ObjectDump: other/ObjectDump.o ld/debugline.o ld/parsers/macho_relocatable_file.o $(LTO_OBJ)
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) $(LIBLTO) -o $@ $^
+
+machocheck: other/machochecker.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
+
diff --git a/sys-devel/binutils-apple/files/ld64-128.2-stdlib.patch b/sys-devel/binutils-apple/files/ld64-128.2-stdlib.patch
new file mode 100644
index 000000000000..8bbcb46cf9c5
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-128.2-stdlib.patch
@@ -0,0 +1,14 @@
+Patch by Linlin Yan <yanlinlin82@gmail.com>
+
+https://bugs.gentoo.org/show_bug.cgi?id=490932
+
+--- ld64-128.2/src/other/rebase.cpp
++++ ld64-128.2/src/other/rebase.cpp
+@@ -29,6 +29,7 @@
+ #include <limits.h>
+ #include <stdarg.h>
+ #include <stdio.h>
++#include <stdlib.h>
+ #include <fcntl.h>
+ #include <errno.h>
+ #include <unistd.h>
diff --git a/sys-devel/binutils-apple/files/ld64-136-Makefile b/sys-devel/binutils-apple/files/ld64-136-Makefile
new file mode 100644
index 000000000000..948c705503ae
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-136-Makefile
@@ -0,0 +1,48 @@
+CPPFLAGS += "-DCPU_SUBTYPE_X86_ALL=((cpu_subtype_t)3)" -Iinclude -Iabstraction -Ild -Ild/parsers -Iother -I.
+
+# dropped machocheck due to compilation failures
+all: rebase unwinddump dyldinfo ld64 ObjectDump
+
+libprunetrie.a: other/PruneTrie.o other/prune_trie.h
+ $(AR) -s -r -c libprunetrie.a other/PruneTrie.o
+
+LD64LIBS=ld/parsers/archive_file.o ld/parsers/macho_relocatable_file.o \
+ ld/parsers/opaque_section_file.o \
+ ld/parsers/macho_dylib_file.o \
+ ld/passes/branch_island.o ld/passes/dylibs.o ld/passes/order.o \
+ ld/passes/branch_shim.o ld/passes/got.o ld/passes/tlvp.o \
+ ld/passes/compact_unwind.o ld/passes/huge.o \
+ ld/passes/dtrace_dof.o ld/passes/objc.o \
+ ld/passes/stubs/stubs.o \
+ ld/InputFiles.o ld/OutputFile.o ld/SymbolTable.o \
+ ld/Snapshot.o \
+ ld/Options.o ld/Resolver.o ld/debugline.o ld/ld.o
+
+ifeq ($(LTO),1)
+CPPFLAGS += "-DLTO"
+LTO_OBJ = ld/parsers/lto_file.o
+LIBLTO = -lLTO
+else
+CPPFLAGS += "-ULTO"
+LTO_OBJ =
+LIBLTO =
+endif
+
+ld64: libprunetrie.a version.o $(LD64LIBS) $(LTO_OBJ)
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) $(LIBLTO) -o $@ $^
+
+rebase: other/rebase.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
+
+dyldinfo: other/dyldinfo.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
+
+unwinddump: other/unwinddump.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
+
+ObjectDump: other/ObjectDump.o ld/debugline.o ld/parsers/macho_relocatable_file.o $(LTO_OBJ)
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) $(LIBLTO) -o $@ $^
+
+machocheck: other/machochecker.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
+
diff --git a/sys-devel/binutils-apple/files/ld64-136-compile_stubs.h b/sys-devel/binutils-apple/files/ld64-136-compile_stubs.h
new file mode 100644
index 000000000000..8cd430adb9eb
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-136-compile_stubs.h
@@ -0,0 +1,53 @@
+static const char *compile_stubs =
+"#!/bin/csh\n"
+"\n"
+"# Attempt to find the architecture.\n"
+"# First look through the command line args.\n"
+"set arch=unknown\n"
+"set link_cmd=(`cat link_command`)\n"
+"while ( $#link_cmd > 0 )\n"
+" if ( \"$link_cmd[1]\" == \"-arch\" ) then\n"
+" set arch=$link_cmd[2]\n"
+" endif\n"
+" shift link_cmd\n"
+"end\n"
+"\n"
+"# look for an explicit arch file\n"
+"if ( \"$arch\" == \"unknown\" ) then\n"
+" if ( -e arch ) then\n"
+" set arch=`cat arch`\n"
+" endif\n"
+"endif\n"
+"\n"
+"if ( \"$arch\" == \"unknown\" ) then\n"
+"echo \"***** Unable to determine architecture.\"\n"
+"exit 1\n"
+"endif \n"
+"\n"
+"# Create .dylibs for each file in the dylib_stubs directory.\n"
+"if ( -e dylib_stubs ) then\n"
+" set files=`cd dylib_stubs ; echo *`\n"
+" mkdir -p dylibs\n"
+" foreach file ($files)\n"
+" if ( ! -e dylibs/$file ) then\n"
+" clang -arch $arch -c -fno-builtin -o tmp_object.o -x c dylib_stubs/$file\n"
+" ld -arch $arch -dylib -macosx_version_min 10.1 -no_version_load_command -o dylibs/$file tmp_object.o\n"
+" endif\n"
+" end\n"
+"endif\n"
+"\n"
+"# Create .frameworks for each file in the framework_stubs directory.\n"
+"if ( -e framework_stubs ) then\n"
+" set files=`cd framework_stubs ; echo *`\n"
+" foreach file ($files)\n"
+" if ( ! -e frameworks/$file.framework ) then\n"
+" clang -arch $arch -c -fno-builtin -o tmp_object.o -x c framework_stubs/$file\n"
+" mkdir -p frameworks/$file.framework\n"
+" ld -arch $arch -dylib -macosx_version_min 10.1 -no_version_load_command -o frameworks/$file.framework/$file tmp_object.o\n"
+" endif\n"
+" end\n"
+"endif\n"
+"\n"
+"# Clean up.\n"
+"rm -f tmp_object.o\n"
+;
diff --git a/sys-devel/binutils-apple/files/ld64-236.3-Makefile b/sys-devel/binutils-apple/files/ld64-236.3-Makefile
new file mode 100644
index 000000000000..1f35c8ff9f39
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-236.3-Makefile
@@ -0,0 +1,51 @@
+CPPFLAGS += -Iinclude -Iabstraction -Ild -Ild/parsers -Iother -I.
+
+# some files generate warnings about applying offsetof to a non-POD type.
+# Upstream seems aware of that and ignores by setting
+# GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = NO in the xcode project.
+CXXFLAGS += -Wno-invalid-offsetof
+
+all: rebase unwinddump dyldinfo ld64 ObjectDump machocheck
+
+libprunetrie.a: other/PruneTrie.o other/prune_trie.h
+ $(AR) -s -r -c libprunetrie.a other/PruneTrie.o
+
+LD64LIBS=ld/parsers/archive_file.o ld/parsers/macho_relocatable_file.o \
+ ld/parsers/opaque_section_file.o \
+ ld/parsers/macho_dylib_file.o \
+ ld/passes/branch_island.o ld/passes/dylibs.o ld/passes/order.o \
+ ld/passes/branch_shim.o ld/passes/got.o ld/passes/tlvp.o \
+ ld/passes/compact_unwind.o ld/passes/huge.o \
+ ld/passes/dtrace_dof.o ld/passes/objc.o \
+ ld/passes/stubs/stubs.o \
+ ld/InputFiles.o ld/OutputFile.o ld/SymbolTable.o \
+ ld/Snapshot.o \
+ ld/Options.o ld/Resolver.o ld/debugline.o ld/ld.o
+
+ifeq ($(LTO),1)
+CPPFLAGS += -DLTO
+LTO_OBJ = ld/parsers/lto_file.o
+LIBLTO = -lLTO
+else
+LTO_OBJ =
+LIBLTO =
+endif
+
+ld64: libprunetrie.a version.o $(LD64LIBS) $(LTO_OBJ)
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) $(LIBLTO) -o $@ $^
+
+rebase: other/rebase.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
+
+dyldinfo: other/dyldinfo.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
+
+unwinddump: other/unwinddump.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
+
+ObjectDump: other/ObjectDump.o ld/debugline.o ld/parsers/macho_relocatable_file.o $(LTO_OBJ)
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) $(LIBLTO) -o $@ $^
+
+machocheck: other/machochecker.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
+
diff --git a/sys-devel/binutils-apple/files/ld64-236.3-arm64-fixup.patch b/sys-devel/binutils-apple/files/ld64-236.3-arm64-fixup.patch
new file mode 100644
index 000000000000..b64e52906f4f
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-236.3-arm64-fixup.patch
@@ -0,0 +1,17 @@
+Use correct enum values (backport from 241.9).
+
+--- ld64-236.3/src/other/ObjectDump.cpp.orig 2014-11-12 21:17:01.000000000 +0100
++++ ld64-236.3/src/other/ObjectDump.cpp 2014-11-12 21:17:44.000000000 +0100
+@@ -995,10 +995,10 @@
+ case ld::Fixup::kindStoreTargetAddressARM64PageOff12:
+ printf("ARM64 store 12-bit page offset of %s", referenceTargetAtomName(ref));
+ break;
+- case ld::Fixup::kindStoreTargetAddressARM64TLVPage21:
++ case ld::Fixup::kindStoreTargetAddressARM64TLVPLoadPage21:
+ printf("ARM64 store 21-bit pcrel ADRP to TLV for %s", referenceTargetAtomName(ref));
+ break;
+- case ld::Fixup::kindStoreTargetAddressARM64TLVPageOff12:
++ case ld::Fixup::kindStoreTargetAddressARM64TLVPLoadPageOff12:
+ printf("ARM64 store 12-bit page offset of TLV of %s", referenceTargetAtomName(ref));
+ break;
+ case ld::Fixup::kindStoreTargetAddressARM64GOTLoadPage21:
diff --git a/sys-devel/binutils-apple/files/ld64-236.3-constant-types.patch b/sys-devel/binutils-apple/files/ld64-236.3-constant-types.patch
new file mode 100644
index 000000000000..c4c5e0d113c8
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-236.3-constant-types.patch
@@ -0,0 +1,61 @@
+Avoid error with gcc on 32bit platforms:
+ld/LinkEdit.hpp:1329: error: integer constant is too large for 'long' type
+
+--- ./ld64-236.3/src/ld/LinkEdit.hpp.orig 2015-01-14 18:00:49.000000000 +0100
++++ ./ld64-236.3/src/ld/LinkEdit.hpp 2015-01-14 18:02:23.000000000 +0100
+@@ -1326,7 +1326,7 @@
+ void FunctionStartsAtom<A>::encode() const
+ {
+ this->_encodedData.reserve(8192);
+- const uint64_t badAddress = 0xFFFFFFFFFFFFFFFF;
++ const uint64_t badAddress = 0xFFFFFFFFFFFFFFFFULL;
+ uint64_t addr = badAddress;
+ // delta compress all function addresses
+ for (std::vector<ld::Internal::FinalSection*>::iterator it = this->_state.sections.begin(); it != this->_state.sections.end(); ++it) {
+--- ./ld64-236.3/src/ld/Options.cpp.orig 2015-01-14 18:01:12.000000000 +0100
++++ ./ld64-236.3/src/ld/Options.cpp 2015-01-14 18:02:09.000000000 +0100
+@@ -4173,7 +4173,7 @@
+ switch (fArchitecture) {
+ case CPU_TYPE_I386:
+ case CPU_TYPE_ARM:
+- if ( fStackAddr > 0xFFFFFFFF )
++ if ( fStackAddr > 0xFFFFFFFFULL )
+ throw "-stack_addr must be < 4G for 32-bit processes";
+ break;
+ case CPU_TYPE_X86_64:
+@@ -4193,29 +4193,29 @@
+ if ( fStackSize > 0xFFFFFFFF )
+ throw "-stack_size must be < 4G for 32-bit processes";
+ if ( fStackAddr == 0 ) {
+- fStackAddr = 0xC0000000;
++ fStackAddr = 0xC0000000ULL;
+ }
+- if ( (fStackAddr > 0xB0000000) && ((fStackAddr-fStackSize) < 0xB0000000) )
++ if ( (fStackAddr > 0xB0000000ULL) && ((fStackAddr-fStackSize) < 0xB0000000ULL) )
+ warning("custom stack placement overlaps and will disable shared region");
+ break;
+ case CPU_TYPE_ARM:
+ if ( fStackSize > 0x2F000000 )
+ throw "-stack_size must be < 752MB";
+ if ( fStackAddr == 0 )
+- fStackAddr = 0x2F000000;
+- if ( fStackAddr > 0x30000000)
++ fStackAddr = 0x2F000000ULL;
++ if ( fStackAddr > 0x30000000ULL)
+ throw "-stack_addr must be < 0x30000000 for arm";
+ break;
+ case CPU_TYPE_X86_64:
+ if ( fStackAddr == 0 ) {
+- fStackAddr = 0x00007FFF5C000000LL;
++ fStackAddr = 0x00007FFF5C000000ULL;
+ }
+ break;
+ case CPU_TYPE_ARM64:
+ if ( fStackSize > 0x20000000 )
+ throw "-stack_size must be < 512MB";
+ if ( fStackAddr == 0 ) {
+- fStackAddr = 0x120000000;
++ fStackAddr = 0x120000000ULL;
+ }
+ break;
+ }
diff --git a/sys-devel/binutils-apple/files/ld64-236.3-crashreporter.patch b/sys-devel/binutils-apple/files/ld64-236.3-crashreporter.patch
new file mode 100644
index 000000000000..f8b42b459b6f
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-236.3-crashreporter.patch
@@ -0,0 +1,23 @@
+Allow to disable crash reporter
+
+diff -ur ld64-236.3/src/ld/Options.cpp ld64-236.3/src/ld/Options.cpp
+--- ld64-236.3/src/ld/Options.cpp 2014-08-29 16:40:18.000000000 +0200
++++ ld64-236.3/src/ld/Options.cpp 2014-08-29 16:35:36.000000000 +0200
+@@ -54,7 +54,7 @@
+ // magic to place command line in crash reports
+ const int crashreporterBufferSize = 2000;
+ static char crashreporterBuffer[crashreporterBufferSize];
+-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
++#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 && defined(SUPPORT_CRASHREPORTER)
+ #include <CrashReporterClient.h>
+ // hack until ld does not need to build on 10.6 anymore
+ struct crashreporter_annotations_t gCRAnnotations
+@@ -4564,7 +4564,7 @@
+ bool newLinker = false;
+
+ // build command line buffer in case ld crashes
+-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
++#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 && defined(SUPPORT_CRASHREPORTER)
+ CRSetCrashLogMessage(crashreporterBuffer);
+ #endif
+ const char* srcRoot = getenv("SRCROOT");
diff --git a/sys-devel/binutils-apple/files/ld64-236.3-gcc.patch b/sys-devel/binutils-apple/files/ld64-236.3-gcc.patch
new file mode 100644
index 000000000000..1e1f578ca354
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-236.3-gcc.patch
@@ -0,0 +1,1038 @@
+Provide c++11 headers from tr1 include directory and namespace.
+
+Work around weird namespacing bug in gcc-4.2.1 where class ld::Section
+conflicts with template mach_o::relocatable::Section by renaming the latter to
+MRFSection (could possibly be done using sed from ebuild or avoided by figuring
+out, what's actually going on with those namespaces).
+
+diff -ur ld64-236.3.orig/src/ld/InputFiles.h ld64-236.3/src/ld/InputFiles.h
+--- ld64-236.3.orig/src/ld/InputFiles.h 2014-04-05 00:42:29.000000000 +0200
++++ ld64-236.3/src/ld/InputFiles.h 2015-01-11 22:43:08.000000000 +0100
+@@ -46,6 +46,14 @@
+ #include <pthread.h>
+ #endif
+
++#ifdef __GLIBCXX__
++#include <tr1/unordered_map>
++#define UNORDERED_MAP tr1::unordered_map
++#else
++#include <unordered_map>
++#define UNORDERED_MAP unordered_map
++#endif
++
+ #include <vector>
+
+ #include "Options.h"
+@@ -107,7 +115,7 @@
+ static void parseWorkerThread(InputFiles *inputFiles);
+ void startThread(void (*threadFunc)(InputFiles *)) const;
+
+- typedef std::unordered_map<const char*, ld::dylib::File*, CStringHash, CStringEquals> InstallNameToDylib;
++ typedef std::UNORDERED_MAP<const char*, ld::dylib::File*, CStringHash, CStringEquals> InstallNameToDylib;
+
+ const Options& _options;
+ std::vector<ld::File*> _inputFiles;
+diff -ur ld64-236.3.orig/src/ld/LinkEditClassic.hpp ld64-236.3/src/ld/LinkEditClassic.hpp
+--- ld64-236.3.orig/src/ld/LinkEditClassic.hpp 2014-04-05 00:42:29.000000000 +0200
++++ ld64-236.3/src/ld/LinkEditClassic.hpp 2015-01-11 22:44:04.000000000 +0100
+@@ -31,8 +31,13 @@
+ #include <limits.h>
+ #include <unistd.h>
+
+-#include <vector>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_map>
++#define UNORDERED_MAP tr1::unordered_map
++#else
+ #include <unordered_map>
++#define UNORDERED_MAP unordered_map
++#endif
+
+ #include "Options.h"
+ #include "ld.hpp"
+@@ -92,7 +97,7 @@
+
+ private:
+ enum { kBufferSize = 0x01000000 };
+- typedef std::unordered_map<const char*, int32_t, CStringHash, CStringEquals> StringToOffset;
++ typedef std::UNORDERED_MAP<const char*, int32_t, CStringHash, CStringEquals> StringToOffset;
+
+ const uint32_t _pointerSize;
+ std::vector<char*> _fullBuffers;
+diff -ur ld64-236.3.orig/src/ld/Options.cpp ld64-236.3/src/ld/Options.cpp
+--- ld64-236.3.orig/src/ld/Options.cpp 2015-01-11 17:35:08.000000000 +0100
++++ ld64-236.3/src/ld/Options.cpp 2015-01-11 22:47:34.000000000 +0100
+@@ -4335,7 +4335,7 @@
+
+ // make sure all required exported symbols exist
+ std::vector<const char*> impliedExports;
+- for (NameSet::iterator it=fExportSymbols.regularBegin(); it != fExportSymbols.regularEnd(); ++it) {
++ for (NameSet::const_iterator it=fExportSymbols.regularBegin(); it != fExportSymbols.regularEnd(); ++it) {
+ const char* name = *it;
+ const int len = strlen(name);
+ if ( (strcmp(&name[len-3], ".eh") == 0) || (strncmp(name, ".objc_category_name_", 20) == 0) ) {
+@@ -4367,7 +4367,7 @@
+ }
+
+ // make sure all required re-exported symbols exist
+- for (NameSet::iterator it=fReExportSymbols.regularBegin(); it != fReExportSymbols.regularEnd(); ++it) {
++ for (NameSet::const_iterator it=fReExportSymbols.regularBegin(); it != fReExportSymbols.regularEnd(); ++it) {
+ fInitialUndefines.push_back(*it);
+ }
+
+diff -ur ld64-236.3.orig/src/ld/Options.h ld64-236.3/src/ld/Options.h
+--- ld64-236.3.orig/src/ld/Options.h 2014-04-05 00:42:29.000000000 +0200
++++ ld64-236.3/src/ld/Options.h 2015-01-11 22:44:00.000000000 +0100
+@@ -30,8 +30,17 @@
+ #include <mach/machine.h>
+
+ #include <vector>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_set>
++#include <tr1/unordered_map>
++#define UNORDERED_MAP tr1::unordered_map
++#define UNORDERED_SET tr1::unordered_set
++#else
+ #include <unordered_set>
+ #include <unordered_map>
++#define UNORDERED_MAP unordered_map
++#define UNORDERED_SET unordered_set
++#endif
+
+ #include "ld.hpp"
+ #include "Snapshot.h"
+@@ -376,8 +385,8 @@
+ const std::vector<SectionRename>& sectionRenames() const { return fSectionRenames; }
+
+ private:
+- typedef std::unordered_map<const char*, unsigned int, ld::CStringHash, ld::CStringEquals> NameToOrder;
+- typedef std::unordered_set<const char*, ld::CStringHash, ld::CStringEquals> NameSet;
++ typedef std::UNORDERED_MAP<const char*, unsigned int, ld::CStringHash, ld::CStringEquals> NameToOrder;
++ typedef std::UNORDERED_SET<const char*, ld::CStringHash, ld::CStringEquals> NameSet;
+ enum ExportMode { kExportDefault, kExportSome, kDontExportSome };
+ enum LibrarySearchMode { kSearchDylibAndArchiveInEachDir, kSearchAllDirsForDylibsThenAllDirsForArchives };
+ enum InterposeMode { kInterposeNone, kInterposeAllExternal, kInterposeSome };
+@@ -389,8 +398,8 @@
+ bool containsNonWildcard(const char*) const;
+ bool empty() const { return fRegular.empty() && fWildCard.empty(); }
+ bool hasWildCards() const { return !fWildCard.empty(); }
+- NameSet::iterator regularBegin() const { return fRegular.begin(); }
+- NameSet::iterator regularEnd() const { return fRegular.end(); }
++ NameSet::const_iterator regularBegin() const { return fRegular.begin(); }
++ NameSet::const_iterator regularEnd() const { return fRegular.end(); }
+ void remove(const NameSet&);
+ private:
+ static bool hasWildCards(const char*);
+diff -ur ld64-236.3.orig/src/ld/OutputFile.cpp ld64-236.3/src/ld/OutputFile.cpp
+--- ld64-236.3.orig/src/ld/OutputFile.cpp 2015-01-11 17:35:08.000000000 +0100
++++ ld64-236.3/src/ld/OutputFile.cpp 2015-01-12 00:24:43.000000000 +0100
+@@ -50,7 +50,13 @@
+ #include <vector>
+ #include <list>
+ #include <algorithm>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_set>
++#define UNORDERED_SET tr1::unordered_set
++#else
+ #include <unordered_set>
++#define UNORDERED_SET unordered_set
++#endif
+
+ #include <CommonCrypto/CommonDigest.h>
+ #include <AvailabilityMacros.h>
+@@ -4699,7 +4705,7 @@
+ const char* filename = NULL;
+ bool wroteStartSO = false;
+ state.stabs.reserve(atomsNeedingDebugNotes.size()*4);
+- std::unordered_set<const char*, CStringHash, CStringEquals> seenFiles;
++ std::UNORDERED_SET<const char*, CStringHash, CStringEquals> seenFiles;
+ for (std::vector<const ld::Atom*>::iterator it=atomsNeedingDebugNotes.begin(); it != atomsNeedingDebugNotes.end(); it++) {
+ const ld::Atom* atom = *it;
+ const ld::File* atomFile = atom->file();
+diff -ur ld64-236.3.orig/src/ld/Resolver.h ld64-236.3/src/ld/Resolver.h
+--- ld64-236.3.orig/src/ld/Resolver.h 2014-04-05 00:42:29.000000000 +0200
++++ ld64-236.3/src/ld/Resolver.h 2015-01-11 22:49:14.000000000 +0100
+@@ -42,7 +42,13 @@
+ #include <mach-o/dyld.h>
+
+ #include <vector>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_set>
++#define UNORDERED_SET tr1::unordered_set
++#else
+ #include <unordered_set>
++#define UNORDERED_SET unordered_set
++#endif
+
+ #include "Options.h"
+ #include "ld.hpp"
+@@ -103,7 +109,7 @@
+ void doLinkerOption(const std::vector<const char*>& linkerOption, const char* fileName);
+ void dumpAtoms();
+
+- typedef std::unordered_set<const char*, CStringHash, CStringEquals> StringSet;
++ typedef std::UNORDERED_SET<const char*, CStringHash, CStringEquals> StringSet;
+
+ class NotLive {
+ public:
+diff -ur ld64-236.3.orig/src/ld/SymbolTable.h ld64-236.3/src/ld/SymbolTable.h
+--- ld64-236.3.orig/src/ld/SymbolTable.h 2014-04-05 00:42:29.000000000 +0200
++++ ld64-236.3/src/ld/SymbolTable.h 2015-01-11 22:46:19.000000000 +0100
+@@ -42,7 +42,13 @@
+ #include <mach-o/dyld.h>
+
+ #include <vector>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_map>
++#define UNORDERED_MAP tr1::unordered_map
++#else
+ #include <unordered_map>
++#define UNORDERED_MAP unordered_map
++#endif
+
+ #include "Options.h"
+ #include "ld.hpp"
+@@ -57,38 +63,38 @@
+ typedef uint32_t IndirectBindingSlot;
+
+ private:
+- typedef std::unordered_map<const char*, IndirectBindingSlot, CStringHash, CStringEquals> NameToSlot;
++ typedef std::UNORDERED_MAP<const char*, IndirectBindingSlot, CStringHash, CStringEquals> NameToSlot;
+
+ class ContentFuncs {
+ public:
+ size_t operator()(const ld::Atom*) const;
+ bool operator()(const ld::Atom* left, const ld::Atom* right) const;
+ };
+- typedef std::unordered_map<const ld::Atom*, IndirectBindingSlot, ContentFuncs, ContentFuncs> ContentToSlot;
++ typedef std::UNORDERED_MAP<const ld::Atom*, IndirectBindingSlot, ContentFuncs, ContentFuncs> ContentToSlot;
+
+ class ReferencesHashFuncs {
+ public:
+ size_t operator()(const ld::Atom*) const;
+ bool operator()(const ld::Atom* left, const ld::Atom* right) const;
+ };
+- typedef std::unordered_map<const ld::Atom*, IndirectBindingSlot, ReferencesHashFuncs, ReferencesHashFuncs> ReferencesToSlot;
++ typedef std::UNORDERED_MAP<const ld::Atom*, IndirectBindingSlot, ReferencesHashFuncs, ReferencesHashFuncs> ReferencesToSlot;
+
+ class CStringHashFuncs {
+ public:
+ size_t operator()(const ld::Atom*) const;
+ bool operator()(const ld::Atom* left, const ld::Atom* right) const;
+ };
+- typedef std::unordered_map<const ld::Atom*, IndirectBindingSlot, CStringHashFuncs, CStringHashFuncs> CStringToSlot;
++ typedef std::UNORDERED_MAP<const ld::Atom*, IndirectBindingSlot, CStringHashFuncs, CStringHashFuncs> CStringToSlot;
+
+ class UTF16StringHashFuncs {
+ public:
+ size_t operator()(const ld::Atom*) const;
+ bool operator()(const ld::Atom* left, const ld::Atom* right) const;
+ };
+- typedef std::unordered_map<const ld::Atom*, IndirectBindingSlot, UTF16StringHashFuncs, UTF16StringHashFuncs> UTF16StringToSlot;
++ typedef std::UNORDERED_MAP<const ld::Atom*, IndirectBindingSlot, UTF16StringHashFuncs, UTF16StringHashFuncs> UTF16StringToSlot;
+
+ typedef std::map<IndirectBindingSlot, const char*> SlotToName;
+- typedef std::unordered_map<const char*, CStringToSlot*, CStringHash, CStringEquals> NameToMap;
++ typedef std::UNORDERED_MAP<const char*, CStringToSlot*, CStringHash, CStringEquals> NameToMap;
+
+ typedef std::vector<const ld::Atom *> DuplicatedSymbolAtomList;
+ typedef std::map<const char *, DuplicatedSymbolAtomList * > DuplicateSymbols;
+diff -ur ld64-236.3.orig/src/ld/ld.cpp ld64-236.3/src/ld/ld.cpp
+--- ld64-236.3.orig/src/ld/ld.cpp 2015-01-11 17:35:08.000000000 +0100
++++ ld64-236.3/src/ld/ld.cpp 2015-01-11 22:42:58.000000000 +0100
+@@ -54,7 +54,13 @@
+ #include <vector>
+ #include <list>
+ #include <algorithm>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_map>
++#define UNORDERED_MAP tr1::unordered_map
++#else
+ #include <unordered_map>
++#define UNORDERED_MAP unordered_map
++#endif
+ #include <cxxabi.h>
+
+ #include "Options.h"
+@@ -150,7 +156,7 @@
+ struct SectionEquals {
+ bool operator()(const ld::Section* left, const ld::Section* right) const;
+ };
+- typedef std::unordered_map<const ld::Section*, FinalSection*, SectionHash, SectionEquals> SectionInToOut;
++ typedef std::UNORDERED_MAP<const ld::Section*, FinalSection*, SectionHash, SectionEquals> SectionInToOut;
+
+
+ SectionInToOut _sectionInToFinalMap;
+diff -ur ld64-236.3.orig/src/ld/ld.hpp ld64-236.3/src/ld/ld.hpp
+--- ld64-236.3.orig/src/ld/ld.hpp 2014-04-05 00:42:29.000000000 +0200
++++ ld64-236.3/src/ld/ld.hpp 2015-01-11 22:42:46.000000000 +0100
+@@ -32,7 +32,13 @@
+ #include <assert.h>
+
+ #include <vector>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_set>
++#define UNORDERED_SET tr1::unordered_set
++#else
+ #include <unordered_set>
++#define UNORDERED_SET unordered_set
++#endif
+
+ #include "configure.h"
+
+@@ -821,7 +827,7 @@
+ bool operator()(const char* left, const char* right) const { return (strcmp(left, right) == 0); }
+ };
+
+-typedef std::unordered_set<const char*, ld::CStringHash, ld::CStringEquals> CStringSet;
++typedef std::UNORDERED_SET<const char*, ld::CStringHash, ld::CStringEquals> CStringSet;
+
+ class Internal
+ {
+diff -ur ld64-236.3.orig/src/ld/parsers/archive_file.cpp ld64-236.3/src/ld/parsers/archive_file.cpp
+--- ld64-236.3.orig/src/ld/parsers/archive_file.cpp 2015-01-11 17:35:08.000000000 +0100
++++ ld64-236.3/src/ld/parsers/archive_file.cpp 2015-01-11 22:41:37.000000000 +0100
+@@ -33,7 +33,13 @@
+ #include <set>
+ #include <map>
+ #include <algorithm>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_map>
++#define UNORDERED_MAP tr1::unordered_map
++#else
+ #include <unordered_map>
++#define UNORDERED_MAP unordered_map
++#endif
+
+ #include "MachOFileAbstraction.hpp"
+ #include "Architectures.hpp"
+@@ -116,7 +122,7 @@
+ struct MemberState { ld::relocatable::File* file; const Entry *entry; bool logged; bool loaded; uint32_t index;};
+ bool loadMember(MemberState& state, ld::File::AtomHandler& handler, const char *format, ...) const;
+
+- typedef std::unordered_map<const char*, const struct ranlib*, ld::CStringHash, ld::CStringEquals> NameToEntryMap;
++ typedef std::UNORDERED_MAP<const char*, const struct ranlib*, ld::CStringHash, ld::CStringEquals> NameToEntryMap;
+
+ typedef typename A::P P;
+ typedef typename A::P::E E;
+diff -ur ld64-236.3.orig/src/ld/parsers/lto_file.cpp ld64-236.3/src/ld/parsers/lto_file.cpp
+--- ld64-236.3.orig/src/ld/parsers/lto_file.cpp 2014-04-05 00:42:29.000000000 +0200
++++ ld64-236.3/src/ld/parsers/lto_file.cpp 2015-01-11 22:44:48.000000000 +0100
+@@ -33,8 +33,17 @@
+ #include <pthread.h>
+ #include <mach-o/dyld.h>
+ #include <vector>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_set>
++#include <tr1/unordered_map>
++#define UNORDERED_MAP tr1::unordered_map
++#define UNORDERED_SET tr1::unordered_set
++#else
+ #include <unordered_set>
+ #include <unordered_map>
++#define UNORDERED_MAP unordered_map
++#define UNORDERED_SET unordered_set
++#endif
+
+ #include "MachOFileAbstraction.hpp"
+ #include "Architectures.hpp"
+@@ -217,8 +226,8 @@
+ static void ltoDiagnosticHandler(lto_codegen_diagnostic_severity_t, const char*, void*);
+ #endif
+
+- typedef std::unordered_set<const char*, ld::CStringHash, ld::CStringEquals> CStringSet;
+- typedef std::unordered_map<const char*, Atom*, ld::CStringHash, ld::CStringEquals> CStringToAtom;
++ typedef std::UNORDERED_SET<const char*, ld::CStringHash, ld::CStringEquals> CStringSet;
++ typedef std::UNORDERED_MAP<const char*, Atom*, ld::CStringHash, ld::CStringEquals> CStringToAtom;
+
+ class AtomSyncer : public ld::File::AtomHandler {
+ public:
+diff -ur ld64-236.3.orig/src/ld/parsers/macho_dylib_file.cpp ld64-236.3/src/ld/parsers/macho_dylib_file.cpp
+--- ld64-236.3.orig/src/ld/parsers/macho_dylib_file.cpp 2015-01-11 17:35:08.000000000 +0100
++++ ld64-236.3/src/ld/parsers/macho_dylib_file.cpp 2015-01-11 22:45:17.000000000 +0100
+@@ -34,8 +34,17 @@
+ #include <vector>
+ #include <set>
+ #include <algorithm>
+-#include <unordered_map>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_set>
++#include <tr1/unordered_map>
++#define UNORDERED_MAP tr1::unordered_map
++#define UNORDERED_SET tr1::unordered_set
++#else
+ #include <unordered_set>
++#include <unordered_map>
++#define UNORDERED_MAP unordered_map
++#define UNORDERED_SET unordered_set
++#endif
+
+ #include "Architectures.hpp"
+ #include "MachOFileAbstraction.hpp"
+@@ -189,8 +198,8 @@
+ };
+ };
+ struct AtomAndWeak { ld::Atom* atom; bool weakDef; bool tlv; pint_t address; };
+- typedef std::unordered_map<const char*, AtomAndWeak, ld::CStringHash, ld::CStringEquals> NameToAtomMap;
+- typedef std::unordered_set<const char*, CStringHash, ld::CStringEquals> NameSet;
++ typedef std::UNORDERED_MAP<const char*, AtomAndWeak, ld::CStringHash, ld::CStringEquals> NameToAtomMap;
++ typedef std::UNORDERED_SET<const char*, CStringHash, ld::CStringEquals> NameSet;
+
+ struct Dependent { const char* path; File<A>* dylib; bool reExport; };
+
+@@ -548,14 +557,18 @@
+ if ( _s_logHashtable ) fprintf(stderr, "ld: building hashtable of %u toc entries for %s\n", dynamicInfo->nextdefsym(), this->path());
+ const macho_nlist<P>* start = &symbolTable[dynamicInfo->iextdefsym()];
+ const macho_nlist<P>* end = &start[dynamicInfo->nextdefsym()];
++#ifndef __GLIBCXX__
+ _atoms.reserve(dynamicInfo->nextdefsym()); // set initial bucket count
++#endif
+ for (const macho_nlist<P>* sym=start; sym < end; ++sym) {
+ this->addSymbol(&strings[sym->n_strx()], (sym->n_desc() & N_WEAK_DEF) != 0, false, sym->n_value());
+ }
+ }
+ else {
+ int32_t count = dynamicInfo->ntoc();
++#ifndef __GLIBCXX__
+ _atoms.reserve(count); // set initial bucket count
++#endif
+ if ( _s_logHashtable ) fprintf(stderr, "ld: building hashtable of %u entries for %s\n", count, this->path());
+ const struct dylib_table_of_contents* toc = (dylib_table_of_contents*)(fileContent + dynamicInfo->tocoff());
+ for (int32_t i = 0; i < count; ++i) {
+diff -ur ld64-236.3.orig/src/ld/parsers/macho_relocatable_file.cpp ld64-236.3/src/ld/parsers/macho_relocatable_file.cpp
+--- ld64-236.3.orig/src/ld/parsers/macho_relocatable_file.cpp 2014-04-05 00:42:29.000000000 +0200
++++ ld64-236.3/src/ld/parsers/macho_relocatable_file.cpp 2015-01-11 23:08:13.000000000 +0100
+@@ -62,7 +62,7 @@
+ // forward reference
+ template <typename A> class Parser;
+ template <typename A> class Atom;
+-template <typename A> class Section;
++template <typename A> class MRFSection;
+ template <typename A> class CFISection;
+ template <typename A> class CUSection;
+
+@@ -100,14 +100,14 @@
+ const uint8_t* fileContent() { return _fileContent; }
+ private:
+ friend class Atom<A>;
+- friend class Section<A>;
++ friend class MRFSection<A>;
+ friend class Parser<A>;
+ friend class CFISection<A>::OAS;
+
+ typedef typename A::P P;
+
+ const uint8_t* _fileContent;
+- Section<A>** _sectionsArray;
++ MRFSection<A>** _sectionsArray;
+ uint8_t* _atomsArray;
+ uint32_t _sectionsArrayCount;
+ uint32_t _atomsArrayCount;
+@@ -129,14 +129,14 @@
+
+
+ template <typename A>
+-class Section : public ld::Section
++class MRFSection : public ld::Section
+ {
+ public:
+ typedef typename A::P::uint_t pint_t;
+ typedef typename A::P P;
+ typedef typename A::P::E E;
+
+- virtual ~Section() { }
++ virtual ~MRFSection() { }
+ class File<A>& file() const { return _file; }
+ const macho_section<P>* machoSection() const { return _machOSection; }
+ uint32_t sectionNum(class Parser<A>&) const;
+@@ -160,10 +160,10 @@
+ static const char* makeSectionName(const macho_section<typename A::P>* s);
+
+ protected:
+- Section(File<A>& f, const macho_section<typename A::P>* s)
++ MRFSection(File<A>& f, const macho_section<typename A::P>* s)
+ : ld::Section(makeSegmentName(s), makeSectionName(s), sectionType(s)),
+ _file(f), _machOSection(s), _beginAtoms(NULL), _endAtoms(NULL), _hasAliases(false) { }
+- Section(File<A>& f, const char* segName, const char* sectName, ld::Section::Type t, bool hidden=false)
++ MRFSection(File<A>& f, const char* segName, const char* sectName, ld::Section::Type t, bool hidden=false)
+ : ld::Section(segName, sectName, t, hidden), _file(f), _machOSection(NULL),
+ _beginAtoms(NULL), _endAtoms(NULL), _hasAliases(false) { }
+
+@@ -186,11 +186,11 @@
+
+
+ template <typename A>
+-class CFISection : public Section<A>
++class CFISection : public MRFSection<A>
+ {
+ public:
+ CFISection(Parser<A>& parser, File<A>& f, const macho_section<typename A::P>* s)
+- : Section<A>(f, s) { }
++ : MRFSection<A>(f, s) { }
+ uint32_t cfiCount();
+
+ virtual ld::Atom::ContentType contentType() { return ld::Atom::typeCFI; }
+@@ -250,11 +250,11 @@
+
+
+ template <typename A>
+-class CUSection : public Section<A>
++class CUSection : public MRFSection<A>
+ {
+ public:
+ CUSection(Parser<A>& parser, File<A>& f, const macho_section<typename A::P>* s)
+- : Section<A>(f, s) { }
++ : MRFSection<A>(f, s) { }
+
+ typedef typename A::P::uint_t pint_t;
+ typedef typename A::P P;
+@@ -291,11 +291,11 @@
+
+
+ template <typename A>
+-class TentativeDefinitionSection : public Section<A>
++class TentativeDefinitionSection : public MRFSection<A>
+ {
+ public:
+ TentativeDefinitionSection(Parser<A>& parser, File<A>& f)
+- : Section<A>(f, "__DATA", "__comm/tent", ld::Section::typeTentativeDefs) {}
++ : MRFSection<A>(f, "__DATA", "__comm/tent", ld::Section::typeTentativeDefs) {}
+
+ virtual ld::Atom::ContentType contentType() { return ld::Atom::typeZeroFill; }
+ virtual bool addFollowOnFixups() const { return false; }
+@@ -313,11 +313,11 @@
+
+
+ template <typename A>
+-class AbsoluteSymbolSection : public Section<A>
++class AbsoluteSymbolSection : public MRFSection<A>
+ {
+ public:
+ AbsoluteSymbolSection(Parser<A>& parser, File<A>& f)
+- : Section<A>(f, "__DATA", "__abs", ld::Section::typeAbsoluteSymbols, true) {}
++ : MRFSection<A>(f, "__DATA", "__abs", ld::Section::typeAbsoluteSymbols, true) {}
+
+ virtual ld::Atom::ContentType contentType() { return ld::Atom::typeUnclassified; }
+ virtual bool dontDeadStrip() { return false; }
+@@ -339,7 +339,7 @@
+
+
+ template <typename A>
+-class SymboledSection : public Section<A>
++class SymboledSection : public MRFSection<A>
+ {
+ public:
+ SymboledSection(Parser<A>& parser, File<A>& f, const macho_section<typename A::P>* s);
+@@ -371,11 +371,11 @@
+
+
+ template <typename A>
+-class ImplicitSizeSection : public Section<A>
++class ImplicitSizeSection : public MRFSection<A>
+ {
+ public:
+ ImplicitSizeSection(Parser<A>& parser, File<A>& f, const macho_section<typename A::P>* s)
+- : Section<A>(f, s) { }
++ : MRFSection<A>(f, s) { }
+ virtual uint32_t computeAtomCount(class Parser<A>& parser, struct Parser<A>::LabelAndCFIBreakIterator& it, const struct Parser<A>::CFI_CU_InfoArrays&);
+ virtual uint32_t appendAtoms(class Parser<A>& parser, uint8_t* buffer, struct Parser<A>::LabelAndCFIBreakIterator& it, const struct Parser<A>::CFI_CU_InfoArrays&);
+ protected:
+@@ -709,8 +709,8 @@
+
+ public:
+ // methods for all atoms from mach-o object file
+- Section<A>& sect() const { return (Section<A>&)section(); }
+- File<A>& machofile() const { return ((Section<A>*)(this->_section))->file(); }
++ MRFSection<A>& sect() const { return (MRFSection<A>&)section(); }
++ File<A>& machofile() const { return ((MRFSection<A>*)(this->_section))->file(); }
+ void setFixupsRange(uint32_t s, uint32_t c);
+ void setUnwindInfoRange(uint32_t s, uint32_t c);
+ void extendUnwindInfoRange();
+@@ -727,7 +727,7 @@
+ typedef typename A::P::E E;
+ typedef typename A::P::uint_t pint_t;
+ // constuct via all attributes
+- Atom(Section<A>& sct, const char* nm, pint_t addr, uint64_t sz,
++ Atom(MRFSection<A>& sct, const char* nm, pint_t addr, uint64_t sz,
+ ld::Atom::Definition d, ld::Atom::Combine c, ld::Atom::Scope s,
+ ld::Atom::ContentType ct, ld::Atom::SymbolTableInclusion i,
+ bool dds, bool thumb, bool al, ld::Atom::Alignment a)
+@@ -737,7 +737,7 @@
+ _unwindInfoStartIndex(0), _fixupsCount(0),
+ _lineInfoCount(0), _unwindInfoCount(0) { }
+ // construct via symbol table entry
+- Atom(Section<A>& sct, Parser<A>& parser, const macho_nlist<P>& sym,
++ Atom(MRFSection<A>& sct, Parser<A>& parser, const macho_nlist<P>& sym,
+ uint64_t sz, bool alias=false)
+ : ld::Atom((ld::Section&)sct, parser.definitionFromSymbol(sym),
+ parser.combineFromSymbol(sym), parser.scopeFromSymbol(sym),
+@@ -760,7 +760,7 @@
+
+ private:
+ friend class Parser<A>;
+- friend class Section<A>;
++ friend class MRFSection<A>;
+ friend class CStringSection<A>;
+ friend class AbsoluteSymbolSection<A>;
+
+@@ -991,8 +991,8 @@
+ uint32_t undefinedStartIndex() { return _undefinedStartIndex; }
+ uint32_t undefinedEndIndex() { return _undefinedEndIndex; }
+ void addFixup(FixupInAtom f) { _allFixups.push_back(f); }
+- Section<A>* sectionForNum(unsigned int sectNum);
+- Section<A>* sectionForAddress(pint_t addr);
++ MRFSection<A>* sectionForNum(unsigned int sectNum);
++ MRFSection<A>* sectionForAddress(pint_t addr);
+ Atom<A>* findAtomByAddress(pint_t addr);
+ Atom<A>* findAtomByAddressOrNullIfStub(pint_t addr);
+ Atom<A>* findAtomByAddressOrLocalTargetOfStub(pint_t addr, uint32_t* offsetInAtom);
+@@ -1034,7 +1034,7 @@
+ : sortedSymbolIndexes(ssa), sortedSymbolCount(ssc), cfiStartsArray(cfisa),
+ cfiStartsCount(cfisc), fileHasOverlappingSymbols(ols),
+ newSection(false), cfiIndex(0), symIndex(0) {}
+- bool next(Parser<A>& parser, const Section<A>& sect, uint32_t sectNum, pint_t startAddr, pint_t endAddr,
++ bool next(Parser<A>& parser, const MRFSection<A>& sect, uint32_t sectNum, pint_t startAddr, pint_t endAddr,
+ pint_t* addr, pint_t* size, const macho_nlist<P>** sym);
+ pint_t peek(Parser<A>& parser, pint_t startAddr, pint_t endAddr);
+ void beginSection() { newSection = true; symIndex = 0; }
+@@ -1063,7 +1063,7 @@
+
+
+ private:
+- friend class Section<A>;
++ friend class MRFSection<A>;
+
+ enum SectionType { sectionTypeIgnore, sectionTypeLiteral4, sectionTypeLiteral8, sectionTypeLiteral16,
+ sectionTypeNonLazy, sectionTypeCFI, sectionTypeCString, sectionTypeCStringPointer,
+@@ -1404,7 +1404,7 @@
+ // was becuase of a label, the symbol). Returns false when no more chunks.
+ //
+ template <typename A>
+-bool Parser<A>::LabelAndCFIBreakIterator::next(Parser<A>& parser, const Section<A>& sect, uint32_t sectNum, pint_t startAddr, pint_t endAddr,
++bool Parser<A>::LabelAndCFIBreakIterator::next(Parser<A>& parser, const MRFSection<A>& sect, uint32_t sectNum, pint_t startAddr, pint_t endAddr,
+ pint_t* addr, pint_t* size, const macho_nlist<P>** symbol)
+ {
+ // may not be a label on start of section, but need atom demarcation there
+@@ -1590,7 +1590,7 @@
+ uint32_t sortedSymbolIndexes[_symbolsInSections];
+ this->makeSortedSymbolsArray(sortedSymbolIndexes, sortedSectionIndexes);
+
+- // allocate Section<A> object for each mach-o section
++ // allocate MRFSection<A> object for each mach-o section
+ makeSections();
+
+ // if it exists, do special early parsing of __compact_unwind section
+@@ -1687,7 +1687,7 @@
+ #endif
+ }
+
+- Section<A>** sections = _file->_sectionsArray;
++ MRFSection<A>** sections = _file->_sectionsArray;
+ uint32_t sectionsCount = _file->_sectionsArrayCount;
+
+ // figure out how many atoms will be allocated and allocate
+@@ -2208,11 +2208,11 @@
+ _file->_objConstraint = ld::File::objcConstraintRetainRelease;
+ if ( sect->size() > 8 ) {
+ warning("section %s/%s has unexpectedly large size %llu in %s",
+- sect->segname(), Section<A>::makeSectionName(sect), sect->size(), _file->path());
++ sect->segname(), MRFSection<A>::makeSectionName(sect), sect->size(), _file->path());
+ }
+ }
+ else {
+- warning("can't parse %s/%s section in %s", sect->segname(), Section<A>::makeSectionName(sect), _file->path());
++ warning("can't parse %s/%s section in %s", sect->segname(), MRFSection<A>::makeSectionName(sect), _file->path());
+ }
+ continue;
+ }
+@@ -2308,24 +2308,24 @@
+ // sort by address (mach-o object files don't aways have sections sorted)
+ ::qsort(machOSects, count, sizeof(MachOSectionAndSectionClass<P>), MachOSectionAndSectionClass<P>::sorter);
+
+- // we will synthesize a dummy Section<A> object for tentative definitions
++ // we will synthesize a dummy MRFSection<A> object for tentative definitions
+ if ( _tentativeDefinitionCount > 0 ) {
+ totalSectionsSize += sizeof(TentativeDefinitionSection<A>);
+ machOSects[count++].type = sectionTypeTentativeDefinitions;
+ }
+
+- // we will synthesize a dummy Section<A> object for Absolute symbols
++ // we will synthesize a dummy MRFSection<A> object for Absolute symbols
+ if ( _absoluteSymbolCount > 0 ) {
+ totalSectionsSize += sizeof(AbsoluteSymbolSection<A>);
+ machOSects[count++].type = sectionTypeAbsoluteSymbols;
+ }
+
+ // allocate one block for all Section objects as well as pointers to each
+- uint8_t* space = new uint8_t[totalSectionsSize+count*sizeof(Section<A>*)];
+- _file->_sectionsArray = (Section<A>**)space;
++ uint8_t* space = new uint8_t[totalSectionsSize+count*sizeof(MRFSection<A>*)];
++ _file->_sectionsArray = (MRFSection<A>**)space;
+ _file->_sectionsArrayCount = count;
+- Section<A>** objects = _file->_sectionsArray;
+- space += count*sizeof(Section<A>*);
++ MRFSection<A>** objects = _file->_sectionsArray;
++ space += count*sizeof(MRFSection<A>*);
+ for (uint32_t i=0; i < count; ++i) {
+ switch ( machOSects[i].type ) {
+ case sectionTypeIgnore:
+@@ -2413,7 +2413,7 @@
+
+
+ template <typename A>
+-Section<A>* Parser<A>::sectionForAddress(typename A::P::uint_t addr)
++MRFSection<A>* Parser<A>::sectionForAddress(typename A::P::uint_t addr)
+ {
+ for (uint32_t i=0; i < _file->_sectionsArrayCount; ++i ) {
+ const macho_section<typename A::P>* sect = _file->_sectionsArray[i]->machoSection();
+@@ -2440,7 +2440,7 @@
+ }
+
+ template <typename A>
+-Section<A>* Parser<A>::sectionForNum(unsigned int num)
++MRFSection<A>* Parser<A>::sectionForNum(unsigned int num)
+ {
+ for (uint32_t i=0; i < _file->_sectionsArrayCount; ++i ) {
+ const macho_section<typename A::P>* sect = _file->_sectionsArray[i]->machoSection();
+@@ -2456,7 +2456,7 @@
+ template <typename A>
+ Atom<A>* Parser<A>::findAtomByAddress(pint_t addr)
+ {
+- Section<A>* section = this->sectionForAddress(addr);
++ MRFSection<A>* section = this->sectionForAddress(addr);
+ return section->findAtomByAddress(addr);
+ }
+
+@@ -2513,7 +2513,7 @@
+ target.addend = 0;
+ return;
+ }
+- Section<A>* section = this->sectionForAddress(addr);
++ MRFSection<A>* section = this->sectionForAddress(addr);
+ target.atom = section->findAtomByAddress(addr);
+ target.addend = addr - target.atom->_objAddress;
+ target.weakImport = false;
+@@ -2561,7 +2561,7 @@
+ }
+ return;
+ }
+- Section<A>* section = this->sectionForNum(sectNum);
++ MRFSection<A>* section = this->sectionForNum(sectNum);
+ target.atom = section->findAtomByAddress(addr);
+ if ( target.atom == NULL ) {
+ typedef typename A::P::sint_t sint_t;
+@@ -3723,7 +3723,7 @@
+ }
+
+ template <typename A>
+-const char* Section<A>::makeSegmentName(const macho_section<typename A::P>* sect)
++const char* MRFSection<A>::makeSegmentName(const macho_section<typename A::P>* sect)
+ {
+ // mach-o section record only has room for 16-byte seg/sect names
+ // so a 16-byte name has no trailing zero
+@@ -3736,7 +3736,7 @@
+ }
+
+ template <typename A>
+-const char* Section<A>::makeSectionName(const macho_section<typename A::P>* sect)
++const char* MRFSection<A>::makeSectionName(const macho_section<typename A::P>* sect)
+ {
+ const char* name = sect->sectname();
+ if ( strlen(name) < 16 )
+@@ -3770,13 +3770,13 @@
+ }
+
+ template <typename A>
+-bool Section<A>::readable(const macho_section<typename A::P>* sect)
++bool MRFSection<A>::readable(const macho_section<typename A::P>* sect)
+ {
+ return true;
+ }
+
+ template <typename A>
+-bool Section<A>::writable(const macho_section<typename A::P>* sect)
++bool MRFSection<A>::writable(const macho_section<typename A::P>* sect)
+ {
+ // mach-o .o files do not contain segment permissions
+ // we just know TEXT is special
+@@ -3784,7 +3784,7 @@
+ }
+
+ template <typename A>
+-bool Section<A>::exectuable(const macho_section<typename A::P>* sect)
++bool MRFSection<A>::exectuable(const macho_section<typename A::P>* sect)
+ {
+ // mach-o .o files do not contain segment permissions
+ // we just know TEXT is special
+@@ -3793,7 +3793,7 @@
+
+
+ template <typename A>
+-ld::Section::Type Section<A>::sectionType(const macho_section<typename A::P>* sect)
++ld::Section::Type MRFSection<A>::sectionType(const macho_section<typename A::P>* sect)
+ {
+ switch ( sect->flags() & SECTION_TYPE ) {
+ case S_ZEROFILL:
+@@ -3871,7 +3871,7 @@
+
+
+ template <typename A>
+-Atom<A>* Section<A>::findContentAtomByAddress(pint_t addr, class Atom<A>* start, class Atom<A>* end)
++Atom<A>* MRFSection<A>::findContentAtomByAddress(pint_t addr, class Atom<A>* start, class Atom<A>* end)
+ {
+ // do a binary search of atom array
+ uint32_t atomCount = end - start;
+@@ -3903,7 +3903,7 @@
+ }
+
+ template <typename A>
+-ld::Atom::Alignment Section<A>::alignmentForAddress(pint_t addr)
++ld::Atom::Alignment MRFSection<A>::alignmentForAddress(pint_t addr)
+ {
+ const uint32_t sectionAlignment = this->_machOSection->align();
+ uint32_t modulus = (addr % (1 << sectionAlignment));
+@@ -3913,7 +3913,7 @@
+ }
+
+ template <typename A>
+-uint32_t Section<A>::sectionNum(class Parser<A>& parser) const
++uint32_t MRFSection<A>::sectionNum(class Parser<A>& parser) const
+ {
+ if ( _machOSection == NULL )
+ return 0;
+@@ -4481,7 +4481,7 @@
+ else {
+ const pint_t* content = (pint_t*)(this->file().fileContent() + this->_machOSection->offset() + reloc->r_address());
+ pint_t personalityAddr = *content;
+- Section<x86_64>* personalitySection = parser.sectionForAddress(personalityAddr);
++ MRFSection<x86_64>* personalitySection = parser.sectionForAddress(personalityAddr);
+ assert((personalitySection->type() == ld::Section::typeCode) && "personality column in __compact_unwind section is not pointer to function");
+ // atoms may not be constructed yet, so scan symbol table for labels
+ const char* name = parser.scanSymbolTableForAddress(personalityAddr);
+@@ -4501,7 +4501,7 @@
+ // support __LD, __compact_unwind personality entries which are pointer to personality non-lazy pointer
+ const pint_t* content = (pint_t*)(this->file().fileContent() + this->_machOSection->offset() + reloc->r_address());
+ pint_t nlPointerAddr = *content;
+- Section<x86>* nlSection = parser.sectionForAddress(nlPointerAddr);
++ MRFSection<x86>* nlSection = parser.sectionForAddress(nlPointerAddr);
+ if ( nlSection->type() == ld::Section::typeCode ) {
+ // personality function is defined in this .o file, so this is a direct reference to it
+ // atoms may not be constructed yet, so scan symbol table for labels
+@@ -4528,7 +4528,7 @@
+ else {
+ const pint_t* content = (pint_t*)(this->file().fileContent() + this->_machOSection->offset() + reloc->r_address());
+ pint_t personalityAddr = *content;
+- Section<arm64>* personalitySection = parser.sectionForAddress(personalityAddr);
++ MRFSection<arm64>* personalitySection = parser.sectionForAddress(personalityAddr);
+ assert((personalitySection->type() == ld::Section::typeCode) && "personality column in __compact_unwind section is not pointer to function");
+ // atoms may not be constructed yet, so scan symbol table for labels
+ const char* name = parser.scanSymbolTableForAddress(personalityAddr);
+@@ -4681,7 +4681,7 @@
+
+ template <typename A>
+ SymboledSection<A>::SymboledSection(Parser<A>& parser, File<A>& f, const macho_section<typename A::P>* s)
+- : Section<A>(f, s), _type(ld::Atom::typeUnclassified)
++ : MRFSection<A>(f, s), _type(ld::Atom::typeUnclassified)
+ {
+ switch ( s->flags() & SECTION_TYPE ) {
+ case S_ZEROFILL:
+@@ -4727,7 +4727,7 @@
+ if ( ! this->_file.canScatterAtoms() )
+ return true;
+ // call inherited
+- return Section<A>::dontDeadStrip();
++ return MRFSection<A>::dontDeadStrip();
+ }
+ return false;
+ }
+@@ -5572,7 +5572,7 @@
+
+
+ template <>
+-uint32_t Section<x86_64>::x86_64PcRelOffset(uint8_t r_type)
++uint32_t MRFSection<x86_64>::x86_64PcRelOffset(uint8_t r_type)
+ {
+ switch ( r_type ) {
+ case X86_64_RELOC_SIGNED:
+@@ -5589,7 +5589,7 @@
+
+
+ template <>
+-bool Section<x86_64>::addRelocFixup(class Parser<x86_64>& parser, const macho_relocation_info<P>* reloc)
++bool MRFSection<x86_64>::addRelocFixup(class Parser<x86_64>& parser, const macho_relocation_info<P>* reloc)
+ {
+ const macho_section<P>* sect = this->machoSection();
+ uint64_t srcAddr = sect->addr() + reloc->r_address();
+@@ -5796,7 +5796,7 @@
+
+
+ template <>
+-bool Section<x86>::addRelocFixup(class Parser<x86>& parser, const macho_relocation_info<P>* reloc)
++bool MRFSection<x86>::addRelocFixup(class Parser<x86>& parser, const macho_relocation_info<P>* reloc)
+ {
+ const macho_section<P>* sect = this->machoSection();
+ uint32_t srcAddr;
+@@ -6037,7 +6037,7 @@
+
+ #if SUPPORT_ARCH_arm_any
+ template <>
+-bool Section<arm>::addRelocFixup(class Parser<arm>& parser, const macho_relocation_info<P>* reloc)
++bool MRFSection<arm>::addRelocFixup(class Parser<arm>& parser, const macho_relocation_info<P>* reloc)
+ {
+ const macho_section<P>* sect = this->machoSection();
+ bool result = false;
+@@ -6495,7 +6495,7 @@
+
+ #if SUPPORT_ARCH_arm64
+ template <>
+-bool Section<arm64>::addRelocFixup(class Parser<arm64>& parser, const macho_relocation_info<P>* reloc)
++bool MRFSection<arm64>::addRelocFixup(class Parser<arm64>& parser, const macho_relocation_info<P>* reloc)
+ {
+ bool result = false;
+ Parser<arm64>::SourceLocation src;
+@@ -6893,7 +6893,7 @@
+
+ #if SUPPORT_ARCH_arm64
+ template <>
+-void Section<arm64>::addLOH(class Parser<arm64>& parser, int kind, int count, const uint64_t addrs[]) {
++void MRFSection<arm64>::addLOH(class Parser<arm64>& parser, int kind, int count, const uint64_t addrs[]) {
+ switch (kind) {
+ case LOH_ARM64_ADRP_ADRP:
+ case LOH_ARM64_ADRP_LDR:
+@@ -6948,18 +6948,18 @@
+ extra.info.delta2 = (count > 1) ? ((addrs[1] - lowestAddress) >> 2) : 0;
+ extra.info.delta3 = (count > 2) ? ((addrs[2] - lowestAddress) >> 2) : 0;
+ extra.info.delta4 = (count > 3) ? ((addrs[3] - lowestAddress) >> 2) : 0;
+- typename Parser<arm64>::SourceLocation src(inAtom, lowestAddress- inAtom->objectAddress());
++ Parser<arm64>::SourceLocation src(inAtom, lowestAddress- inAtom->objectAddress());
+ parser.addFixup(src, ld::Fixup::k1of1, ld::Fixup::kindLinkerOptimizationHint, extra.addend);
+ }
+ #endif
+
+ template <typename A>
+-void Section<A>::addLOH(class Parser<A>& parser, int kind, int count, const uint64_t addrs[]) {
++void MRFSection<A>::addLOH(class Parser<A>& parser, int kind, int count, const uint64_t addrs[]) {
+
+ }
+
+ template <typename A>
+-void Section<A>::makeFixups(class Parser<A>& parser, const struct Parser<A>::CFI_CU_InfoArrays&)
++void MRFSection<A>::makeFixups(class Parser<A>& parser, const struct Parser<A>::CFI_CU_InfoArrays&)
+ {
+ const macho_section<P>* sect = this->machoSection();
+ const macho_relocation_info<P>* relocs = (macho_relocation_info<P>*)(file().fileContent() + sect->reloff());
+@@ -6970,7 +6970,7 @@
+ ++r; // skip next
+ }
+ catch (const char* msg) {
+- throwf("in section %s,%s reloc %u: %s", sect->segname(), Section<A>::makeSectionName(sect), r, msg);
++ throwf("in section %s,%s reloc %u: %s", sect->segname(), MRFSection<A>::makeSectionName(sect), r, msg);
+ }
+ }
+
+diff -ur ld64-236.3.orig/src/ld/passes/dtrace_dof.cpp ld64-236.3/src/ld/passes/dtrace_dof.cpp
+--- ld64-236.3.orig/src/ld/passes/dtrace_dof.cpp 2014-04-05 00:42:29.000000000 +0200
++++ ld64-236.3/src/ld/passes/dtrace_dof.cpp 2015-01-12 00:27:58.000000000 +0100
+@@ -30,8 +30,17 @@
+
+ #include <vector>
+ #include <map>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_map>
++#include <tr1/unordered_set>
++#define UNORDERED_MAP tr1::unordered_map
++#define UNORDERED_SET tr1::unordered_set
++#else
+ #include <unordered_map>
+ #include <unordered_set>
++#define UNORDERED_MAP unordered_map
++#define UNORDERED_SET unordered_set
++#endif
+
+ #include "ld.hpp"
+ #include "MachOFileAbstraction.hpp"
+@@ -111,8 +120,8 @@
+ uint32_t offset;
+ const char* probeName;
+ };
+-typedef std::unordered_map<const char*, std::vector<DTraceProbeInfo>, CStringHash, CStringEquals> ProviderToProbes;
+-typedef std::unordered_set<const char*, CStringHash, CStringEquals> CStringSet;
++typedef std::UNORDERED_MAP<const char*, std::vector<DTraceProbeInfo>, CStringHash, CStringEquals> ProviderToProbes;
++typedef std::UNORDERED_SET<const char*, CStringHash, CStringEquals> CStringSet;
+
+
+
+diff -ur ld64-236.3.orig/src/ld/passes/order.cpp ld64-236.3/src/ld/passes/order.cpp
+--- ld64-236.3.orig/src/ld/passes/order.cpp 2014-04-05 00:42:29.000000000 +0200
++++ ld64-236.3/src/ld/passes/order.cpp 2015-01-11 22:45:57.000000000 +0100
+@@ -32,7 +32,13 @@
+ #include <vector>
+ #include <map>
+ #include <set>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_map>
++#define UNORDERED_MAP tr1::unordered_map
++#else
+ #include <unordered_map>
++#define UNORDERED_MAP unordered_map
++#endif
+
+ #include "ld.hpp"
+ #include "order.h"
+@@ -84,7 +90,7 @@
+ const Layout& _layout;
+ };
+
+- typedef std::unordered_map<const char*, const ld::Atom*, CStringHash, CStringEquals> NameToAtom;
++ typedef std::UNORDERED_MAP<const char*, const ld::Atom*, CStringHash, CStringEquals> NameToAtom;
+
+ typedef std::map<const ld::Atom*, const ld::Atom*> AtomToAtom;
+
+diff -ur ld64-236.3.orig/src/other/dyldinfo.cpp ld64-236.3/src/other/dyldinfo.cpp
+--- ld64-236.3.orig/src/other/dyldinfo.cpp 2014-04-05 00:42:29.000000000 +0200
++++ ld64-236.3/src/other/dyldinfo.cpp 2015-01-12 00:27:33.000000000 +0100
+@@ -33,7 +33,6 @@
+
+ #include <vector>
+ #include <set>
+-#include <unordered_set>
+
+ #include "configure.h"
+ #include "MachOFileAbstraction.hpp"
+diff -ur ld64-236.3.orig/src/other/machochecker.cpp ld64-236.3/src/other/machochecker.cpp
+--- ld64-236.3.orig/src/other/machochecker.cpp 2014-04-05 00:42:29.000000000 +0200
++++ ld64-236.3/src/other/machochecker.cpp 2015-01-11 22:46:37.000000000 +0100
+@@ -33,7 +33,13 @@
+
+ #include <vector>
+ #include <set>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_set>
++#define UNORDERED_SET tr1::unordered_set
++#else
+ #include <unordered_set>
++#define UNORDERED_SET unordered_set
++#endif
+
+ #include "configure.h"
+
+@@ -124,7 +130,7 @@
+ bool operator()(const char* left, const char* right) const { return (strcmp(left, right) == 0); }
+ };
+
+- typedef std::unordered_set<const char*, CStringHash, CStringEquals> StringSet;
++ typedef std::UNORDERED_SET<const char*, CStringHash, CStringEquals> StringSet;
+
+ MachOChecker(const uint8_t* fileContent, uint32_t fileLength, const char* path);
+ void checkMachHeader();
+diff -ur ld64-236.3.orig/src/other/unwinddump.cpp ld64-236.3/src/other/unwinddump.cpp
+--- ld64-236.3.orig/src/other/unwinddump.cpp 2014-04-05 00:42:29.000000000 +0200
++++ ld64-236.3/src/other/unwinddump.cpp 2015-01-11 23:58:00.000000000 +0100
+@@ -33,7 +33,6 @@
+
+ #include <vector>
+ #include <set>
+-#include <unordered_set>
+
+ #include "configure.h"
+ #include "MachOFileAbstraction.hpp"
diff --git a/sys-devel/binutils-apple/files/ld64-236.3-missing-cputypes.patch b/sys-devel/binutils-apple/files/ld64-236.3-missing-cputypes.patch
new file mode 100644
index 000000000000..29b50f628122
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-236.3-missing-cputypes.patch
@@ -0,0 +1,10 @@
+--- ld64-236.3/src/include/mach/machine.h.orig 2015-01-24 13:22:36.000000000 +0100
++++ ld64-236.3/src/include/mach/machine.h 2015-01-24 13:22:51.000000000 +0100
+@@ -233,6 +233,7 @@
+ */
+
+ #define CPU_SUBTYPE_I386_ALL ((cpu_subtype_t) 3)
++#define CPU_SUBTYPE_X86_ALL CPU_SUBTYPE_I386_ALL
+ #define CPU_SUBTYPE_X86_64_ALL CPU_SUBTYPE_I386_ALL
+ #define CPU_SUBTYPE_386 ((cpu_subtype_t) 3)
+ #define CPU_SUBTYPE_486 ((cpu_subtype_t) 4)
diff --git a/sys-devel/binutils-apple/files/ld64-236.3-noarm.patch b/sys-devel/binutils-apple/files/ld64-236.3-noarm.patch
new file mode 100644
index 000000000000..5a235ec85e32
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-236.3-noarm.patch
@@ -0,0 +1,1236 @@
+Fully conditionalise arm support so it can be disabled on 10.4.
+
+--- ld64-236.3/src/ld/HeaderAndLoadCommands.hpp.orig 2015-01-23 06:55:36.000000000 +0100
++++ ld64-236.3/src/ld/HeaderAndLoadCommands.hpp 2015-01-23 06:56:04.000000000 +0100
+@@ -605,8 +605,12 @@
+
+ template <> uint32_t HeaderAndLoadCommandsAtom<x86>::cpuType() const { return CPU_TYPE_I386; }
+ template <> uint32_t HeaderAndLoadCommandsAtom<x86_64>::cpuType() const { return CPU_TYPE_X86_64; }
++#if SUPPORT_ARCH_arm_any
+ template <> uint32_t HeaderAndLoadCommandsAtom<arm>::cpuType() const { return CPU_TYPE_ARM; }
++#endif
++#if SUPPORT_ARCH_arm64
+ template <> uint32_t HeaderAndLoadCommandsAtom<arm64>::cpuType() const { return CPU_TYPE_ARM64; }
++#endif
+
+
+
+@@ -625,17 +629,21 @@
+ return _state.cpuSubType;
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ uint32_t HeaderAndLoadCommandsAtom<arm>::cpuSubType() const
+ {
+ return _state.cpuSubType;
+ }
++#endif
+
++#if SUPPORT_ARCH_arm64
+ template <>
+ uint32_t HeaderAndLoadCommandsAtom<arm64>::cpuSubType() const
+ {
+ return CPU_SUBTYPE_ARM64_ALL;
+ }
++#endif
+
+
+
+--- ld64-236.3/src/ld/LinkEdit.hpp.orig 2015-01-23 06:55:36.000000000 +0100
++++ ld64-236.3/src/ld/LinkEdit.hpp 2015-01-23 06:56:04.000000000 +0100
+@@ -1595,6 +1595,7 @@
+ for (ld::Fixup::iterator fit = atom->fixupsBegin(); fit != atom->fixupsEnd(); ++fit) {
+ if ( fit->kind != ld::Fixup::kindLinkerOptimizationHint)
+ continue;
++#if SUPPORT_ARCH_arm64
+ ld::Fixup::LOH_arm64 extra;
+ extra.addend = fit->u.addend;
+ _encodedData.append_uleb128(extra.info.kind);
+@@ -1606,6 +1607,7 @@
+ _encodedData.append_uleb128((extra.info.delta3 << 2) + fit->offsetInAtom + address);
+ if ( extra.info.count > 2 )
+ _encodedData.append_uleb128((extra.info.delta4 << 2) + fit->offsetInAtom + address);
++#endif
+ }
+ }
+ }
+--- ld64-236.3/src/ld/Options.cpp.orig 2015-01-23 06:55:36.000000000 +0100
++++ ld64-236.3/src/ld/Options.cpp 2015-01-23 07:05:43.000000000 +0100
+@@ -567,8 +567,13 @@
+ #endif
+ }
+ break;
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
++#endif
++#if SUPPORT_ARCH_arm64
+ case CPU_TYPE_ARM64:
++#endif
++#if SUPPORT_ARCH_arm_any || SUPPORT_ARCH_arm64
+ if ( (fMacVersionMin == ld::macVersionUnset) && (fIOSVersionMin == ld::iOSVersionUnset) && (fOutputKind != Options::kObjectFile) ) {
+ #if defined(DEFAULT_IPHONEOS_MIN_VERSION)
+ warning("-ios_version_min not specified, assuming " DEFAULT_IPHONEOS_MIN_VERSION);
+@@ -579,6 +584,7 @@
+ #endif
+ }
+ break;
++#endif
+ }
+ #ifdef SUPPORT_SNAPSHOTS
+ fLinkSnapshot.recordArch(fArchitectureName);
+@@ -1649,9 +1655,11 @@
+ symbolStart = NULL;
+ }
+ else if ( strncmp(symbolStart, "arm:", 4) == 0 ) {
++#if SUPPORT_ARCH_arm_any
+ if ( fArchitecture == CPU_TYPE_ARM )
+ symbolStart = &symbolStart[4];
+ else
++#endif
+ symbolStart = NULL;
+ }
+ if ( symbolStart != NULL ) {
+@@ -3483,6 +3491,7 @@
+ #endif
+ }
+ break;
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ if ( (fOutputKind != Options::kObjectFile) && (fOutputKind != Options::kPreload) ) {
+ #if defined(DEFAULT_IPHONEOS_MIN_VERSION)
+@@ -3494,6 +3503,7 @@
+ #endif
+ }
+ break;
++#endif
+ default:
+ // architecture will be infered later by examining .o files
+ break;
+@@ -3516,12 +3526,14 @@
+ fMacVersionMin = ld::mac10_4;
+ }
+ break;
++#if SUPPORT_ARCH_arm64
+ case CPU_TYPE_ARM64:
+ if ( fIOSVersionMin < ld::iOS_7_0 ) {
+ //warning("-mios_version_min should be 7.0 or later for arm64");
+ fIOSVersionMin = ld::iOS_7_0;
+ }
+ break;
++#endif
+ }
+
+ // default to adding functions start for dynamic code, static code must opt-in
+@@ -3561,6 +3573,7 @@
+ fAllowTextRelocs = true;
+ fUndefinedTreatment = kUndefinedDynamicLookup;
+ break;
++#if SUPPORT_ARCH_arm64
+ case CPU_TYPE_ARM64:
+ // arm64 uses new MH_KEXT_BUNDLE type
+ fMakeCompressedDyldInfo = false;
+@@ -3569,6 +3582,8 @@
+ fKextsUseStubs = true;
+ fUndefinedTreatment = kUndefinedDynamicLookup;
+ break;
++#endif
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ if ( fIOSVersionMin >= ld::iOS_5_0 ) {
+ // iOS 5.0 and later use new MH_KEXT_BUNDLE type
+@@ -3580,6 +3595,7 @@
+ fUndefinedTreatment = kUndefinedDynamicLookup;
+ break;
+ }
++#endif
+ // else use object file
+ case CPU_TYPE_I386:
+ // use .o files
+@@ -3632,6 +3648,7 @@
+ if ( fSplitSegs && (fBaseWritableAddress-fBaseAddress != 0x10000000) )
+ fBaseWritableAddress = fBaseAddress + 0x10000000;
+ break;
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ if ( fOutputKind != Options::kDynamicLibrary ) {
+ fSplitSegs = false;
+@@ -3642,6 +3659,7 @@
+ fBaseWritableAddress = fBaseAddress + 0x08000000;
+ }
+ break;
++#endif
+ default:
+ fSplitSegs = false;
+ fBaseAddress = 0;
+@@ -3656,6 +3674,7 @@
+ break;
+ case CPU_TYPE_X86_64:
+ break;
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ switch ( fOutputKind ) {
+ case Options::kDynamicExecutable:
+@@ -3678,6 +3697,7 @@
+ fBaseAddress = 0;
+ }
+ break;
++#endif
+ }
+
+ // <rdar://problem/6138961> -r implies no prebinding for all architectures
+@@ -3723,6 +3743,7 @@
+ case CPU_TYPE_X86_64:
+ fPrebind = false;
+ break;
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ switch ( fOutputKind ) {
+ case Options::kDynamicExecutable:
+@@ -3740,6 +3761,7 @@
+ break;
+ }
+ break;
++#endif
+ }
+ }
+
+@@ -3766,10 +3788,12 @@
+ case CPU_TYPE_I386:
+ if ( fIOSVersionMin != ld::iOSVersionUnset ) // simulator never needs modules
+ break;
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ if ( fPrebind )
+ fNeedsModuleTable = true; // redo_prebinding requires a module table
+ break;
++#endif
+ }
+ }
+
+@@ -3993,7 +3993,9 @@
+ switch ( fArchitecture ) {
+ case CPU_TYPE_I386:
+ case CPU_TYPE_X86_64:
++#if SUPPORT_ARCH_arm64
+ case CPU_TYPE_ARM64:
++#endif
+ switch ( fOutputKind ) {
+ case Options::kObjectFile:
+ case Options::kStaticExecutable:
+@@ -4010,10 +4012,12 @@
+ break;
+ }
+ break;
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ fAddCompactUnwindEncoding = false;
+ fRemoveDwarfUnwindIfCompactExists = false;
+ break;
++#endif
+ case 0:
+ // if -arch is missing, assume we don't want compact unwind info
+ fAddCompactUnwindEncoding = false;
+@@ -3815,7 +3843,15 @@
+ // only iOS main executables should be encrypted
+ if ( fOutputKind != Options::kDynamicExecutable )
+ fEncryptable = false;
+- if ( (fArchitecture != CPU_TYPE_ARM) && (fArchitecture != CPU_TYPE_ARM64) )
++ if (
++#if SUPPORT_ARCH_arm_any
++ (fArchitecture != CPU_TYPE_ARM) &&
++#endif
++#if SUPPORT_ARCH_arm64
++ (fArchitecture != CPU_TYPE_ARM64) &&
++#endif
++ 1
++ )
+ fEncryptable = false;
+
+ // don't move inits in dyld because dyld wants certain
+@@ -3867,11 +3903,15 @@
+
+ // only ARM and x86_64 enforces that cpu-sub-types must match
+ switch ( fArchitecture ) {
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
++#endif
+ case CPU_TYPE_X86_64:
+ break;
+ case CPU_TYPE_I386:
++#if SUPPORT_ARCH_arm64
+ case CPU_TYPE_ARM64:
++#endif
+ fAllowCpuSubtypeMismatches = true;
+ break;
+ }
+@@ -3917,6 +3957,7 @@
+ fPositionIndependentExecutable = true;
+ }
+
++#if SUPPORT_ARCH_arm_any
+ // armv7 for iOS4.3 defaults to PIE
+ if ( (fArchitecture == CPU_TYPE_ARM)
+ && fArchSupportsThumb2
+@@ -3924,15 +3965,18 @@
+ && (fIOSVersionMin >= ld::iOS_4_3) ) {
+ fPositionIndependentExecutable = true;
+ }
++#endif
+
+ // -no_pie anywhere on command line disable PIE
+ if ( fDisablePositionIndependentExecutable )
+ fPositionIndependentExecutable = false;
+
++#if SUPPORT_ARCH_arm64
+ // arm64 is always PIE
+ if ( (fArchitecture == CPU_TYPE_ARM64) && (fOutputKind == kDynamicExecutable) ) {
+ fPositionIndependentExecutable = true;
+ }
++#endif
+
+ // set fOutputSlidable
+ switch ( fOutputKind ) {
+@@ -3958,9 +4002,11 @@
+ if ( fMacVersionMin >= ld::mac10_7 ) {
+ fTLVSupport = true;
+ }
++#if SUPPORT_ARCH_arm64
+ else if ( (fArchitecture == CPU_TYPE_ARM64) && (fIOSVersionMin >= 0x00080000) ) {
+ fTLVSupport = true;
+ }
++#endif
+
+ // default to adding version load command for dynamic code, static code must opt-in
+ switch ( fOutputKind ) {
+@@ -4149,6 +4195,7 @@
+ }
+
+ // <rdar://problem/12258065> ARM64 needs 16KB page size for user land code
++#if SUPPORT_ARCH_arm64
+ if ( fArchitecture == CPU_TYPE_ARM64 ) {
+ if ( fSegmentAlignment == 4096 ) {
+ switch ( fOutputKind ) {
+@@ -4166,6 +4213,7 @@
+ }
+ }
+ }
++#endif
+
+ // <rdar://problem/13624134> linker should not convert dwarf unwind if .o file has compact unwind section
+ switch ( fOutputKind ) {
+@@ -4267,12 +4315,16 @@
+ if ( fStackAddr != 0 ) {
+ switch (fArchitecture) {
+ case CPU_TYPE_I386:
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
++#endif
+ if ( fStackAddr > 0xFFFFFFFFULL )
+ throw "-stack_addr must be < 4G for 32-bit processes";
+ break;
+ case CPU_TYPE_X86_64:
++#if SUPPORT_ARCH_arm64
+ case CPU_TYPE_ARM64:
++#endif
+ break;
+ }
+ if ( (fStackAddr & -4096) != fStackAddr )
+@@ -4293,6 +4345,7 @@
+ if ( (fStackAddr > 0xB0000000ULL) && ((fStackAddr-fStackSize) < 0xB0000000ULL) )
+ warning("custom stack placement overlaps and will disable shared region");
+ break;
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ if ( fStackSize > 0x2F000000 )
+ throw "-stack_size must be < 752MB";
+@@ -4301,11 +4354,13 @@
+ if ( fStackAddr > 0x30000000ULL)
+ throw "-stack_addr must be < 0x30000000 for arm";
+ break;
++#endif
+ case CPU_TYPE_X86_64:
+ if ( fStackAddr == 0 ) {
+ fStackAddr = 0x00007FFF5C000000ULL;
+ }
+ break;
++#if SUPPORT_ARCH_arm64
+ case CPU_TYPE_ARM64:
+ if ( fStackSize > 0x20000000 )
+ throw "-stack_size must be < 512MB";
+@@ -4313,6 +4368,7 @@
+ fStackAddr = 0x120000000ULL;
+ }
+ break;
++#endif
+ }
+ if ( (fStackSize & -4096) != fStackSize )
+ throw "-stack_size must be multiples of 4K";
+@@ -4422,8 +4478,12 @@
+ alterObjC1ClassNamesToObjC2 = true;
+ break;
+ case CPU_TYPE_X86_64:
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
++#endif
++#if SUPPORT_ARCH_arm64
+ case CPU_TYPE_ARM64:
++#endif
+ alterObjC1ClassNamesToObjC2 = true;
+ break;
+ }
+@@ -4799,11 +4799,15 @@
+ // zero page size not specified on command line, set default
+ switch (fArchitecture) {
+ case CPU_TYPE_I386:
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
++#endif
+ // first 4KB for 32-bit architectures
+ fZeroPageSize = 0x1000;
+ break;
++#if SUPPORT_ARCH_arm64
+ case CPU_TYPE_ARM64:
++#endif
+ case CPU_TYPE_X86_64:
+ // first 4GB for x86_64 on all OS's
+ fZeroPageSize = 0x100000000ULL;
+@@ -4621,9 +4685,11 @@
+
+ // -force_cpusubtype_ALL is not supported for ARM
+ if ( fForceSubtypeAll ) {
++#if SUPPORT_ARCH_arm_any
+ if ( fArchitecture == CPU_TYPE_ARM ) {
+ warning("-force_cpusubtype_ALL will become unsupported for ARM architectures");
+ }
++#endif
+ }
+
+ // -reexported_symbols_list can only be used with -dynamiclib
+--- ld64-236.3/src/ld/OutputFile.cpp.orig 2015-01-23 06:55:36.000000000 +0100
++++ ld64-236.3/src/ld/OutputFile.cpp 2015-01-23 06:56:04.000000000 +0100
+@@ -629,7 +629,12 @@
+ // is encoded in mach-o the same as:
+ // .long _foo + 0x40000000
+ // so if _foo lays out to 0xC0000100, the first is ok, but the second is not.
+- if ( (_options.architecture() == CPU_TYPE_ARM) || (_options.architecture() == CPU_TYPE_I386) ) {
++ if (
++#if SUPPORT_ARCH_arm_any
++ (_options.architecture() == CPU_TYPE_ARM) ||
++#endif
++ (_options.architecture() == CPU_TYPE_I386) ||
++ 0) {
+ // Unlikely userland code does funky stuff like this, so warn for them, but not warn for -preload or -static
+ if ( (_options.outputKind() != Options::kPreload) && (_options.outputKind() != Options::kStaticExecutable) ) {
+ warning("32-bit absolute address out of range (0x%08llX max is 4GB): from %s + 0x%08X (0x%08llX) to 0x%08llX",
+@@ -1229,22 +1234,26 @@
+ return false;
+ const ld::Fixup* f;
+ switch ( fixup->kind ) {
++#if SUPPORT_ARCH_arm64
+ case ld::Fixup::kindStoreTargetAddressARM64Page21:
+ return !mustBeGOT;
+ case ld::Fixup::kindStoreTargetAddressARM64GOTLoadPage21:
+ case ld::Fixup::kindStoreTargetAddressARM64GOTLeaPage21:
+ return true;
++#endif
+ case ld::Fixup::kindSetTargetAddress:
+ f = fixup;
+ do {
+ ++f;
+ } while ( ! f->lastInCluster() );
+ switch (f->kind ) {
++#if SUPPORT_ARCH_arm64
+ case ld::Fixup::kindStoreARM64Page21:
+ return !mustBeGOT;
+ case ld::Fixup::kindStoreARM64GOTLoadPage21:
+ case ld::Fixup::kindStoreARM64GOTLeaPage21:
+ return true;
++#endif
+ default:
+ break;
+ }
+@@ -1261,22 +1270,26 @@
+ return false;
+ const ld::Fixup* f;
+ switch ( fixup->kind ) {
++#if SUPPORT_ARCH_arm64
+ case ld::Fixup::kindStoreTargetAddressARM64PageOff12:
+ return !mustBeGOT;
+ case ld::Fixup::kindStoreTargetAddressARM64GOTLoadPageOff12:
+ case ld::Fixup::kindStoreTargetAddressARM64GOTLeaPageOff12:
+ return true;
++#endif
+ case ld::Fixup::kindSetTargetAddress:
+ f = fixup;
+ do {
+ ++f;
+ } while ( ! f->lastInCluster() );
+ switch (f->kind ) {
++#if SUPPORT_ARCH_arm64
+ case ld::Fixup::kindStoreARM64PageOff12:
+ return !mustBeGOT;
+ case ld::Fixup::kindStoreARM64GOTLoadPageOff12:
+ case ld::Fixup::kindStoreARM64GOTLeaPageOff12:
+ return true;
++#endif
+ default:
+ break;
+ }
+@@ -1311,7 +1324,9 @@
+ std::map<uint32_t, const Fixup*> usedByHints;
+ for (ld::Fixup::iterator fit = atom->fixupsBegin(), end=atom->fixupsEnd(); fit != end; ++fit) {
+ uint8_t* fixUpLocation = &buffer[fit->offsetInAtom];
++#if SUPPORT_ARCH_arm64
+ ld::Fixup::LOH_arm64 lohExtra;
++#endif
+ switch ( (ld::Fixup::Kind)(fit->kind) ) {
+ case ld::Fixup::kindNone:
+ case ld::Fixup::kindNoneFollowOn:
+@@ -1570,6 +1585,7 @@
+ break;
+ case ld::Fixup::kindLinkerOptimizationHint:
+ // expand table of address/offsets used by hints
++#if SUPPORT_ARCH_arm64
+ lohExtra.addend = fit->u.addend;
+ usedByHints[fit->offsetInAtom + (lohExtra.info.delta1 << 2)] = NULL;
+ if ( lohExtra.info.count > 0 )
+@@ -1578,6 +1594,7 @@
+ usedByHints[fit->offsetInAtom + (lohExtra.info.delta3 << 2)] = NULL;
+ if ( lohExtra.info.count > 2 )
+ usedByHints[fit->offsetInAtom + (lohExtra.info.delta4 << 2)] = NULL;
++#endif
+ break;
+ case ld::Fixup::kindStoreTargetAddressLittleEndian32:
+ accumulator = addressOf(state, fit, &toTarget);
+@@ -2057,6 +2074,7 @@
+ //uint8_t loadSize, destReg;
+ //uint32_t scaledOffset;
+ //uint32_t imm12;
++#if SUPPORT_ARCH_arm64
+ ld::Fixup::LOH_arm64 alt;
+ alt.addend = fit->u.addend;
+ setInfo(state, atom, buffer, usedByHints, fit->offsetInAtom, (alt.info.delta1 << 2), &infoA);
+@@ -2415,6 +2433,7 @@
+ fprintf(stderr, "unknown hint kind %d alt.info.kind at 0x%08llX\n", alt.info.kind, infoA.instructionAddress);
+ break;
+ }
++#endif
+ }
+ // apply hints pass 2
+ for (ld::Fixup::iterator fit = atom->fixupsBegin(), end=atom->fixupsEnd(); fit != end; ++fit) {
+@@ -2422,6 +2441,7 @@
+ continue;
+ InstructionInfo infoA;
+ InstructionInfo infoB;
++#if SUPPORT_ARCH_arm64
+ ld::Fixup::LOH_arm64 alt;
+ alt.addend = fit->u.addend;
+ setInfo(state, atom, buffer, usedByHints, fit->offsetInAtom, (alt.info.delta1 << 2), &infoA);
+@@ -2453,6 +2473,7 @@
+ }
+ break;
+ }
++#endif
+ }
+ }
+
+@@ -2469,6 +2490,7 @@
+ for (uint8_t* p=from; p < to; ++p)
+ *p = 0x90;
+ break;
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ if ( thumb ) {
+ for (uint8_t* p=from; p < to; p += 2)
+@@ -2479,6 +2501,7 @@
+ OSWriteLittleInt32((uint32_t*)p, 0, 0xe1a00000);
+ }
+ break;
++#endif
+ default:
+ for (uint8_t* p=from; p < to; ++p)
+ *p = 0x00;
+@@ -2807,7 +2830,11 @@
+
+ // in -r mode, clarify symbolTableNotInFinalLinkedImages
+ if ( _options.outputKind() == Options::kObjectFile ) {
+- if ( (_options.architecture() == CPU_TYPE_X86_64) || (_options.architecture() == CPU_TYPE_ARM64) ) {
++ if ( (_options.architecture() == CPU_TYPE_X86_64) ||
++#if SUPPORT_ARCH_arm64
++ (_options.architecture() == CPU_TYPE_ARM64) ||
++#endif
++ 0 ) {
+ // x86_64 .o files need labels on anonymous literal strings
+ if ( (sect->type() == ld::Section::typeCString) && (atom->combine() == ld::Atom::combineByNameAndContent) ) {
+ (const_cast<ld::Atom*>(atom))->setSymbolTableInclusion(ld::Atom::symbolTableIn);
+@@ -4030,8 +4057,10 @@
+ if ( _options.sharedRegionEligible() ) {
+ // <rdar://problem/13287063> when range checking, ignore high byte of arm64 addends
+ uint64_t checkAddend = addend;
++#if SUPPORT_ARCH_arm64
+ if ( _options.architecture() == CPU_TYPE_ARM64 )
+ checkAddend &= 0x0FFFFFFFFFFFFFFFULL;
++#endif
+ if ( checkAddend != 0 ) {
+ // make sure the addend does not cause the pointer to point outside the target's segment
+ // if it does, update_dyld_shared_cache will not be able to put this dylib into the shared cache
+@@ -4238,12 +4267,17 @@
+
+ bool OutputFile::useExternalSectionReloc(const ld::Atom* atom, const ld::Atom* target, ld::Fixup* fixupWithTarget)
+ {
+- if ( (_options.architecture() == CPU_TYPE_X86_64) || (_options.architecture() == CPU_TYPE_ARM64) ) {
++ if ( (_options.architecture() == CPU_TYPE_X86_64) ||
++#if SUPPORT_ARCH_arm64
++ (_options.architecture() == CPU_TYPE_ARM64) ||
++#endif
++ 0) {
+ // x86_64 and ARM64 use external relocations for everthing that has a symbol
+ return ( target->symbolTableInclusion() != ld::Atom::symbolTableNotIn );
+ }
+
+ // <rdar://problem/9513487> support arm branch interworking in -r mode
++#if SUPPORT_ARCH_arm_any
+ if ( (_options.architecture() == CPU_TYPE_ARM) && (_options.outputKind() == Options::kObjectFile) ) {
+ if ( atom->isThumb() != target->isThumb() ) {
+ switch ( fixupWithTarget->kind ) {
+@@ -4257,6 +4291,7 @@
+ }
+ }
+ }
++#endif
+
+ if ( (_options.architecture() == CPU_TYPE_I386) && (_options.outputKind() == Options::kObjectFile) ) {
+ if ( target->contentType() == ld::Atom::typeTLV )
+@@ -4324,7 +4359,11 @@
+ bool minusTargetUsesExternalReloc = (minusTarget != NULL) && this->useExternalSectionReloc(atom, minusTarget, fixupWithMinusTarget);
+
+ // in x86_64 and arm64 .o files an external reloc means the content contains just the addend
+- if ( (_options.architecture() == CPU_TYPE_X86_64) ||(_options.architecture() == CPU_TYPE_ARM64) ) {
++ if ( (_options.architecture() == CPU_TYPE_X86_64) ||
++#if SUPPORT_ARCH_arm64
++ (_options.architecture() == CPU_TYPE_ARM64) ||
++#endif
++ 0 ) {
+ if ( targetUsesExternalReloc ) {
+ fixupWithTarget->contentAddendOnly = true;
+ fixupWithStore->contentAddendOnly = true;
+--- ld64-236.3/src/ld/parsers/archive_file.cpp.orig 2015-01-23 06:55:36.000000000 +0100
++++ ld64-236.3/src/ld/parsers/archive_file.cpp 2015-01-23 06:56:04.000000000 +0100
+@@ -232,8 +232,12 @@
+
+ template <> cpu_type_t File<x86>::architecture() { return CPU_TYPE_I386; }
+ template <> cpu_type_t File<x86_64>::architecture() { return CPU_TYPE_X86_64; }
++#if SUPPORT_ARCH_arm_any
+ template <> cpu_type_t File<arm>::architecture() { return CPU_TYPE_ARM; }
++#endif
++#if SUPPORT_ARCH_arm64
+ template <> cpu_type_t File<arm64>::architecture() { return CPU_TYPE_ARM64; }
++#endif
+
+
+ template <typename A>
+--- ld64-236.3/src/ld/parsers/macho_dylib_file.cpp.orig 2015-01-23 06:55:36.000000000 +0100
++++ ld64-236.3/src/ld/parsers/macho_dylib_file.cpp 2015-01-23 07:01:27.000000000 +0100
+@@ -250,11 +250,15 @@
+ bool File<A>::_s_logHashtable = false;
+
+ template <> const char* File<x86_64>::objCInfoSegmentName() { return "__DATA"; }
++#if SUPPORT_ARCH_arm_any
+ template <> const char* File<arm>::objCInfoSegmentName() { return "__DATA"; }
++#endif
+ template <typename A> const char* File<A>::objCInfoSegmentName() { return "__OBJC"; }
+
+ template <> const char* File<x86_64>::objCInfoSectionName() { return "__objc_imageinfo"; }
++#if SUPPORT_ARCH_arm_any
+ template <> const char* File<arm>::objCInfoSectionName() { return "__objc_imageinfo"; }
++#endif
+ template <typename A> const char* File<A>::objCInfoSectionName() { return "__image_info"; }
+
+ template <typename A>
+@@ -1006,6 +1010,7 @@
+ }
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ bool Parser<arm>::validFile(const uint8_t* fileContent, bool executableOrDyliborBundle)
+ {
+@@ -1032,9 +1037,11 @@
+ return false;
+ }
+ }
++#endif
+
+
+
++#if SUPPORT_ARCH_arm64
+ template <>
+ bool Parser<arm64>::validFile(const uint8_t* fileContent, bool executableOrDyliborBundle)
+ {
+@@ -1061,6 +1068,7 @@
+ return false;
+ }
+ }
++#endif
+
+
+ bool isDylibFile(const uint8_t* fileContent, cpu_type_t* result, cpu_subtype_t* subResult)
+@@ -1084,17 +1084,21 @@
+ *subResult = CPU_SUBTYPE_X86_ALL;
+ return true;
+ }
++#if SUPPORT_ARCH_arm_any
+ if ( Parser<arm>::validFile(fileContent, false) ) {
+ *result = CPU_TYPE_ARM;
+ const macho_header<Pointer32<LittleEndian> >* header = (const macho_header<Pointer32<LittleEndian> >*)fileContent;
+ *subResult = header->cpusubtype();
+ return true;
+ }
++#endif
++#if SUPPORT_ARCH_arm64
+ if ( Parser<arm64>::validFile(fileContent, false) ) {
+ *result = CPU_TYPE_ARM64;
+ *subResult = CPU_SUBTYPE_ARM64_ALL;
+ return true;
+ }
++#endif
+ #ifdef SUPPORT_ARCH_ppc
+ if ( Parser<ppc>::validFile(fileContent, false) ) {
+ *result = CPU_TYPE_POWERPC;
+@@ -1123,6 +1135,7 @@
+ return "x86_64";
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ const char* Parser<arm>::fileKind(const uint8_t* fileContent)
+ {
+@@ -1138,6 +1151,7 @@
+ }
+ return "arm???";
+ }
++#endif
+
+ #if SUPPORT_ARCH_arm64
+ template <>
+@@ -1163,9 +1177,11 @@
+ if ( Parser<x86>::validFile(fileContent, true) ) {
+ return Parser<x86>::fileKind(fileContent);
+ }
++#if SUPPORT_ARCH_arm_any
+ if ( Parser<arm>::validFile(fileContent, true) ) {
+ return Parser<arm>::fileKind(fileContent);
+ }
++#endif
+ #if SUPPORT_ARCH_arm64
+ if ( Parser<arm64>::validFile(fileContent, false) ) {
+ return Parser<arm64>::fileKind(fileContent);
+--- ld64-236.3/src/ld/parsers/macho_relocatable_file.cpp.orig 2015-01-23 06:55:36.000000000 +0100
++++ ld64-236.3/src/ld/parsers/macho_relocatable_file.cpp 2015-01-23 07:02:23.000000000 +0100
+@@ -861,6 +861,7 @@
+ }
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ void Atom<arm>::verifyAlignment(const macho_section<P>&) const
+ {
+@@ -869,6 +870,7 @@
+ warning("ARM function not 4-byte aligned: %s from %s", this->name(), this->file()->path());
+ }
+ }
++#endif
+
+ #if SUPPORT_ARCH_arm64
+ template <>
+@@ -1218,6 +1220,7 @@
+ return true;
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ bool Parser<arm>::validFile(const uint8_t* fileContent, bool subtypeMustMatch, cpu_subtype_t subtype)
+ {
+@@ -1238,8 +1241,10 @@
+ }
+ return true;
+ }
++#endif
+
+
++#if SUPPORT_ARCH_arm64
+ template <>
+ bool Parser<arm64>::validFile(const uint8_t* fileContent, bool subtypeMustMatch, cpu_subtype_t subtype)
+ {
+@@ -1252,6 +1257,7 @@
+ return false;
+ return true;
+ }
++#endif
+
+
+ template <>
+@@ -1276,6 +1282,7 @@
+ return "x86_64";
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ const char* Parser<arm>::fileKind(const uint8_t* fileContent)
+ {
+@@ -1291,6 +1298,7 @@
+ }
+ return "arm???";
+ }
++#endif
+
+ #if SUPPORT_ARCH_arm64
+ template <>
+@@ -1802,8 +1810,12 @@
+
+ template <> uint8_t Parser<x86>::loadCommandSizeMask() { return 0x03; }
+ template <> uint8_t Parser<x86_64>::loadCommandSizeMask() { return 0x07; }
++#if SUPPORT_ARCH_arm_any
+ template <> uint8_t Parser<arm>::loadCommandSizeMask() { return 0x03; }
++#endif
++#if SUPPORT_ARCH_arm64
+ template <> uint8_t Parser<arm64>::loadCommandSizeMask() { return 0x07; }
++#endif
+
+ template <typename A>
+ bool Parser<A>::parseLoadCommands()
+@@ -3921,8 +3933,10 @@
+ return 1 + (this->_machOSection - parser.firstMachOSection());
+ }
+
++#if SUPPORT_ARCH_arm_any
+ // arm does not have zero cost exceptions
+ template <> uint32_t CFISection<arm>::cfiCount() { return 0; }
++#endif
+
+ template <typename A>
+ uint32_t CFISection<A>::cfiCount()
+@@ -4050,6 +4064,7 @@
+
+
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ void CFISection<arm>::cfiParse(class Parser<arm>& parser, uint8_t* buffer,
+ libunwind::CFI_Atom_Info<CFISection<arm>::OAS>::CFI_Atom_Info cfiArray[],
+@@ -4058,6 +4073,7 @@
+ // arm does not use zero cost exceptions
+ assert(count == 0);
+ }
++#endif
+
+ template <>
+ void CFISection<arm64>::cfiParse(class Parser<arm64>& parser, uint8_t* buffer,
+@@ -4159,8 +4175,12 @@
+
+ template <> bool CFISection<x86_64>::bigEndian() { return false; }
+ template <> bool CFISection<x86>::bigEndian() { return false; }
++#if SUPPORT_ARCH_arm_any
+ template <> bool CFISection<arm>::bigEndian() { return false; }
++#endif
++#if SUPPORT_ARCH_arm64
+ template <> bool CFISection<arm64>::bigEndian() { return false; }
++#endif
+
+
+ template <>
+@@ -5077,11 +5097,13 @@
+ return ld::Fixup::kindStoreLittleEndian32;
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ ld::Fixup::Kind NonLazyPointerSection<arm>::fixupKind()
+ {
+ return ld::Fixup::kindStoreLittleEndian32;
+ }
++#endif
+
+ template <>
+ ld::Fixup::Kind NonLazyPointerSection<arm64>::fixupKind()
+@@ -7170,10 +7192,14 @@
+ return ( mach_o::relocatable::Parser<x86_64>::validFile(fileContent) );
+ case CPU_TYPE_I386:
+ return ( mach_o::relocatable::Parser<x86>::validFile(fileContent) );
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ return ( mach_o::relocatable::Parser<arm>::validFile(fileContent, opts.objSubtypeMustMatch, opts.subType) );
++#endif
++#if SUPPORT_ARCH_arm64
+ case CPU_TYPE_ARM64:
+ return ( mach_o::relocatable::Parser<arm64>::validFile(fileContent, opts.objSubtypeMustMatch, opts.subType) );
++#endif
+ }
+ return false;
+ }
+@@ -7194,17 +7220,21 @@
+ *subResult = CPU_SUBTYPE_X86_ALL;
+ return true;
+ }
++#if SUPPORT_ARCH_arm_any
+ if ( mach_o::relocatable::Parser<arm>::validFile(fileContent, false, 0) ) {
+ *result = CPU_TYPE_ARM;
+ const macho_header<Pointer32<LittleEndian> >* header = (const macho_header<Pointer32<LittleEndian> >*)fileContent;
+ *subResult = header->cpusubtype();
+ return true;
+ }
++#endif
++#if SUPPORT_ARCH_arm_any
+ if ( mach_o::relocatable::Parser<arm64>::validFile(fileContent, false, 0) ) {
+ *result = CPU_TYPE_ARM64;
+ *subResult = CPU_SUBTYPE_ARM64_ALL;
+ return true;
+ }
++#endif
+ return false;
+ }
+
+@@ -7219,9 +7249,11 @@
+ if ( mach_o::relocatable::Parser<x86>::validFile(fileContent) ) {
+ return mach_o::relocatable::Parser<x86>::fileKind(fileContent);
+ }
++#if SUPPORT_ARCH_arm_any
+ if ( mach_o::relocatable::Parser<arm>::validFile(fileContent, false, 0) ) {
+ return mach_o::relocatable::Parser<arm>::fileKind(fileContent);
+ }
++#endif
+ return NULL;
+ }
+
+@@ -7233,9 +7265,11 @@
+ if ( mach_o::relocatable::Parser<x86_64>::validFile(fileContent) ) {
+ return mach_o::relocatable::Parser<x86_64>::hasObjC2Categories(fileContent);
+ }
++#if SUPPORT_ARCH_arm_any
+ else if ( mach_o::relocatable::Parser<arm>::validFile(fileContent, false, 0) ) {
+ return mach_o::relocatable::Parser<arm>::hasObjC2Categories(fileContent);
+ }
++#endif
+ else if ( mach_o::relocatable::Parser<x86>::validFile(fileContent, false, 0) ) {
+ return mach_o::relocatable::Parser<x86>::hasObjC2Categories(fileContent);
+ }
+--- ld64-236.3/src/ld/passes/branch_island.cpp.orig 2015-01-23 06:55:36.000000000 +0100
++++ ld64-236.3/src/ld/passes/branch_island.cpp 2015-01-23 06:56:04.000000000 +0100
+@@ -284,6 +284,7 @@
+ static uint64_t textSizeWhenMightNeedBranchIslands(const Options& opts, bool seenThumbBranch)
+ {
+ switch ( opts.architecture() ) {
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ if ( ! seenThumbBranch )
+ return 32000000; // ARM can branch +/- 32MB
+@@ -292,6 +293,7 @@
+ else
+ return 4000000; // thumb1 can branch +/- 4MB
+ break;
++#endif
+ }
+ assert(0 && "unexpected architecture");
+ return 0x100000000LL;
+@@ -301,6 +303,7 @@
+ static uint64_t maxDistanceBetweenIslands(const Options& opts, bool seenThumbBranch)
+ {
+ switch ( opts.architecture() ) {
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ if ( ! seenThumbBranch )
+ return 30*1024*1024; // 2MB of branch islands per 32MB
+@@ -309,6 +312,7 @@
+ else
+ return 3500000; // 0.5MB of branch islands per 4MB
+ break;
++#endif
+ }
+ assert(0 && "unexpected architecture");
+ return 0x100000000LL;
+@@ -653,8 +657,10 @@
+
+ // only ARM needs branch islands
+ switch ( opts.architecture() ) {
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ break;
++#endif
+ default:
+ return;
+ }
+--- ld64-236.3/src/ld/passes/branch_shim.cpp.orig 2015-01-23 06:55:36.000000000 +0100
++++ ld64-236.3/src/ld/passes/branch_shim.cpp 2015-01-23 06:56:04.000000000 +0100
+@@ -276,6 +276,9 @@
+ //
+ void doPass(const Options& opts, ld::Internal& state)
+ {
++#if !SUPPORT_ARCH_arm_any
++ return;
++#else
+ // only make branch shims in final linked images
+ if ( opts.outputKind() == Options::kObjectFile )
+ return;
+@@ -386,6 +389,7 @@
+ // append all new shims to end of __text
+ sect->atoms.insert(sect->atoms.end(), shims.begin(), shims.end());
+ }
++#endif
+ }
+
+
+--- ld64-236.3/src/ld/passes/dtrace_dof.cpp.orig 2015-01-23 06:55:36.000000000 +0100
++++ ld64-236.3/src/ld/passes/dtrace_dof.cpp 2015-01-23 06:56:04.000000000 +0100
+@@ -179,8 +179,12 @@
+ switch ( opts.architecture() ) {
+ case CPU_TYPE_I386:
+ case CPU_TYPE_X86_64:
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
++#endif
++#if SUPPORT_ARCH_arm64
+ case CPU_TYPE_ARM64:
++#endif
+ storeKind = ld::Fixup::kindStoreLittleEndian32;
+ break;
+ default:
+--- ld64-236.3/src/ld/passes/stubs/stubs.cpp.orig 2015-01-23 06:55:36.000000000 +0100
++++ ld64-236.3/src/ld/passes/stubs/stubs.cpp 2015-01-23 06:56:04.000000000 +0100
+@@ -324,9 +324,11 @@
+ if ( _options.outputKind() != Options::kDynamicLibrary )
+ throwf("resolver functions (%s) can only be used in dylibs", atom->name());
+ if ( !_options.makeCompressedDyldInfo() ) {
++#if SUPPORT_ARCH_arm_any
+ if ( _options.architecture() == CPU_TYPE_ARM )
+ throwf("resolver functions (%s) can only be used when targeting iOS 4.2 or later", atom->name());
+ else
++#endif
+ throwf("resolver functions (%s) can only be used when targeting Mac OS X 10.6 or later", atom->name());
+ }
+ stubFor[atom] = NULL;
+@@ -354,6 +356,7 @@
+ throw "symbol dyld_stub_binding_helper not found, normally in crt1.o/dylib1.o/bundle1.o";
+
+ // disable arm close stubs in some cases
++#if SUPPORT_ARCH_arm_any
+ if ( _architecture == CPU_TYPE_ARM ) {
+ if ( codeSize > 4*1024*1024 )
+ _largeText = true;
+@@ -377,6 +380,7 @@
+ }
+ }
+ }
++#endif
+
+ // make stub atoms
+ for (std::map<const ld::Atom*,ld::Atom*>::iterator it = stubFor.begin(); it != stubFor.end(); ++it) {
+--- ld64-236.3/src/ld/Resolver.cpp.orig 2015-01-23 06:55:36.000000000 +0100
++++ ld64-236.3/src/ld/Resolver.cpp 2015-01-23 06:56:04.000000000 +0100
+@@ -396,6 +396,7 @@
+ // update cpu-sub-type
+ cpu_subtype_t nextObjectSubType = file.cpuSubType();
+ switch ( _options.architecture() ) {
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ if ( _options.subArchitecture() != nextObjectSubType ) {
+ if ( (_options.subArchitecture() == CPU_SUBTYPE_ARM_ALL) && _options.forceCpuSubtypeAll() ) {
+@@ -414,6 +415,7 @@
+ }
+ }
+ break;
++#endif
+
+ case CPU_TYPE_I386:
+ _internal.cpuSubType = CPU_SUBTYPE_I386_ALL;
+--- ld64-236.3/src/other/machochecker.cpp.orig 2015-01-23 06:55:36.000000000 +0100
++++ ld64-236.3/src/other/machochecker.cpp 2015-01-23 06:56:04.000000000 +0100
+@@ -252,6 +252,7 @@
+ return false;
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ bool MachOChecker<arm>::validFile(const uint8_t* fileContent)
+ {
+@@ -269,6 +270,7 @@
+ }
+ return false;
+ }
++#endif
+
+ #if SUPPORT_ARCH_arm64
+ template <>
+@@ -294,7 +296,9 @@
+ template <> uint8_t MachOChecker<ppc64>::loadCommandSizeMask() { return 0x07; }
+ template <> uint8_t MachOChecker<x86>::loadCommandSizeMask() { return 0x03; }
+ template <> uint8_t MachOChecker<x86_64>::loadCommandSizeMask() { return 0x07; }
++#if SUPPORT_ARCH_arm_any
+ template <> uint8_t MachOChecker<arm>::loadCommandSizeMask() { return 0x03; }
++#endif
+ #if SUPPORT_ARCH_arm64
+ template <> uint8_t MachOChecker<arm64>::loadCommandSizeMask() { return 0x07; }
+ #endif
+@@ -324,11 +328,13 @@
+ return threadInfo->thread_register(7);
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ arm::P::uint_t MachOChecker<arm>::getInitialStackPointer(const macho_thread_command<arm::P>* threadInfo)
+ {
+ return threadInfo->thread_register(13);
+ }
++#endif
+
+ #if SUPPORT_ARCH_arm64
+ template <>
+@@ -362,11 +368,13 @@
+ return threadInfo->thread_register(16);
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ arm::P::uint_t MachOChecker<arm>::getEntryPoint(const macho_thread_command<arm::P>* threadInfo)
+ {
+ return threadInfo->thread_register(15);
+ }
++#endif
+
+ #if SUPPORT_ARCH_arm64
+ template <>
+@@ -1025,6 +1033,7 @@
+ return fFirstWritableSegment->vmaddr();
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ arm::P::uint_t MachOChecker<arm>::relocBase()
+ {
+@@ -1033,6 +1042,7 @@
+ else
+ return fFirstSegment->vmaddr();
+ }
++#endif
+
+ #if SUPPORT_ARCH_arm64
+ template <>
+--- ld64-236.3/src/other/ObjectDump.cpp.orig 2015-01-23 06:55:36.000000000 +0100
++++ ld64-236.3/src/other/ObjectDump.cpp 2015-01-23 06:56:04.000000000 +0100
+@@ -806,6 +806,7 @@
+ case ld::Fixup::kindStoreThumbHigh16:
+ printf(", then store high-16 in Thumb movt");
+ break;
++#if SUPPORT_ARCH_arm64
+ case ld::Fixup::kindStoreARM64Branch26:
+ printf(", then store as ARM64 26-bit pcrel branch");
+ break;
+@@ -839,6 +840,7 @@
+ case ld::Fixup::kindStoreARM64PCRelToGOT:
+ printf(", then store as 32-bit delta to GOT entry");
+ break;
++#endif
+ case ld::Fixup::kindDtraceExtra:
+ printf("dtrace static probe extra info");
+ break;
+@@ -983,6 +985,7 @@
+ case ld::Fixup::kindSetTargetTLVTemplateOffsetLittleEndian64:
+ printf("tlv template offset of %s", referenceTargetAtomName(ref));
+ break;
++#if SUPPORT_ARCH_arm64
+ case ld::Fixup::kindStoreTargetAddressARM64Branch26:
+ printf("ARM64 store 26-bit pcrel branch to %s", referenceTargetAtomName(ref));
+ break;
+@@ -1010,6 +1013,7 @@
+ case ld::Fixup::kindStoreTargetAddressARM64GOTLeaPageOff12:
+ printf("ARM64 store 12-bit page offset of lea of %s", referenceTargetAtomName(ref));
+ break;
++#endif
+ //default:
+ // printf("unknown fixup");
+ // break;
+--- ld64-236.3/src/other/rebase.cpp.orig 2015-01-23 06:55:36.000000000 +0100
++++ ld64-236.3/src/other/rebase.cpp 2015-01-23 06:56:04.000000000 +0100
+@@ -160,9 +160,11 @@
+ case CPU_TYPE_X86_64:
+ fRebasers.push_back(new Rebaser<x86_64>(&p[fileOffset]));
+ break;
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ fRebasers.push_back(new Rebaser<arm>(&p[fileOffset]));
+ break;
++#endif
+ default:
+ throw "unknown file format";
+ }
+@@ -186,9 +188,11 @@
+ else if ( (OSSwapLittleToHostInt32(mh->magic) == MH_MAGIC_64) && (OSSwapLittleToHostInt32(mh->cputype) == CPU_TYPE_X86_64)) {
+ fRebasers.push_back(new Rebaser<x86_64>(mh));
+ }
++#if SUPPORT_ARCH_arm_any
+ else if ( (OSSwapLittleToHostInt32(mh->magic) == MH_MAGIC) && (OSSwapLittleToHostInt32(mh->cputype) == CPU_TYPE_ARM)) {
+ fRebasers.push_back(new Rebaser<arm>(mh));
+ }
++#endif
+ else {
+ throw "unknown file format";
+ }
+@@ -236,7 +240,9 @@
+ template <> cpu_type_t Rebaser<ppc64>::getArchitecture() const { return CPU_TYPE_POWERPC64; }
+ template <> cpu_type_t Rebaser<x86>::getArchitecture() const { return CPU_TYPE_I386; }
+ template <> cpu_type_t Rebaser<x86_64>::getArchitecture() const { return CPU_TYPE_X86_64; }
++#if SUPPORT_ARCH_arm_any
+ template <> cpu_type_t Rebaser<arm>::getArchitecture() const { return CPU_TYPE_ARM; }
++#endif
+
+ template <typename A>
+ uint64_t Rebaser<A>::getBaseAddress() const
+@@ -875,8 +881,10 @@
+ return "i386";
+ case CPU_TYPE_X86_64:
+ return "x86_64";
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ return "arm";
++#endif
+ }
+ return "unknown";
+ }
+@@ -969,6 +977,7 @@
+ else if ( arch == CPU_TYPE_X86_64 ) {
+ return 0x200000000ULL;
+ }
++#if SUPPORT_ARCH_arm_any
+ else if ( arch == CPU_TYPE_ARM ) {
+ // place dylibs below dyld
+ uint64_t topAddr = 0x2FE00000;
+@@ -977,6 +986,7 @@
+ throwf("total size of images (0x%X) does not fit below 0x2FE00000", totalSize);
+ return topAddr - totalSize;
+ }
++#endif
+ else
+ throw "unknown architecture";
+ }
+@@ -1043,7 +1053,9 @@
+ onlyArchs.insert(CPU_TYPE_POWERPC64);
+ onlyArchs.insert(CPU_TYPE_I386);
+ onlyArchs.insert(CPU_TYPE_X86_64);
++#if SUPPORT_ARCH_arm_any
+ onlyArchs.insert(CPU_TYPE_ARM);
++#endif
+ }
+
+ // scan files and collect sizes
+--- ld64-236.3/src/other/unwinddump.cpp.orig 2015-01-23 06:55:36.000000000 +0100
++++ ld64-236.3/src/other/unwinddump.cpp 2015-01-23 07:03:16.000000000 +0100
+@@ -97,7 +97,9 @@
+
+ template <> const char* UnwindPrinter<x86>::archName() { return "i386"; }
+ template <> const char* UnwindPrinter<x86_64>::archName() { return "x86_64"; }
++#if SUPPORT_ARCH_arm_any
+ template <> const char* UnwindPrinter<arm>::archName() { return "arm"; }
++#endif
+ #if SUPPORT_ARCH_arm64
+ template <> const char* UnwindPrinter<arm64>::archName() { return "arm64"; }
+ #endif
diff --git a/sys-devel/binutils-apple/files/ld64-236.3-nolto.patch b/sys-devel/binutils-apple/files/ld64-236.3-nolto.patch
new file mode 100644
index 000000000000..5d68c377ea0e
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-236.3-nolto.patch
@@ -0,0 +1,219 @@
+Allow to fully disable LTO
+
+--- ld64-236.3/src/ld/InputFiles.cpp
++++ ld64-236.3/src/ld/InputFiles.cpp
+@@ -59,7 +59,9 @@
+ #include "macho_relocatable_file.h"
+ #include "macho_dylib_file.h"
+ #include "archive_file.h"
++#ifdef LTO
+ #include "lto_file.h"
++#endif
+ #include "opaque_section_file.h"
+ #include "MachOFileAbstraction.hpp"
+ #include "Snapshot.h"
+@@ -187,9 +189,11 @@
+ if ( result != NULL )
+ return result;
+
++#ifdef LTO
+ result = lto::archName(p, len);
+ if ( result != NULL )
+ return result;
++#endif
+
+ if ( strncmp((const char*)p, "!<arch>\n", 8) == 0 )
+ return "archive";
+@@ -292,6 +296,7 @@
+ return objResult;
+ }
+
++#ifdef LTO
+ // see if it is an llvm object file
+ objResult = lto::parse(p, len, info.path, info.modTime, info.ordinal, _options.architecture(), _options.subArchitecture(), _options.logAllFiles(), _options.verboseOptimizationHints());
+ if ( objResult != NULL ) {
+@@ -299,6 +304,7 @@
+ OSAtomicIncrement32(&_totalObjectLoaded);
+ return objResult;
+ }
++#endif
+
+ // see if it is a dynamic library
+ ld::dylib::File* dylibResult = mach_o::dylib::parse(p, len, info.path, info.modTime, _options, info.ordinal, info.options.fBundleLoader, indirectDylib);
+@@ -322,6 +328,7 @@
+ return archiveResult;
+ }
+
++#ifdef LTO
+ // does not seem to be any valid linker input file, check LTO misconfiguration problems
+ if ( lto::archName((uint8_t*)p, len) != NULL ) {
+ if ( lto::libLTOisLoaded() ) {
+@@ -349,6 +356,7 @@
+ throwf("could not process llvm bitcode object file, because %s could not be loaded", libLTO);
+ }
+ }
++#endif
+
+ // error handling
+ if ( ((fat_header*)p)->magic == OSSwapBigToHostInt32(FAT_MAGIC) ) {
+--- ld64-236.3/src/ld/ld.cpp
++++ ld64-236.3/src/ld/ld.cpp
+@@ -91,7 +91,9 @@
+ #include "parsers/archive_file.h"
+ #include "parsers/macho_relocatable_file.h"
+ #include "parsers/macho_dylib_file.h"
++#ifdef LTO
+ #include "parsers/lto_file.h"
++#endif
+ #include "parsers/opaque_section_file.h"
+
+
+--- ld64-236.3/src/ld/Options.cpp
++++ ld64-236.3/src/ld/Options.cpp
+@@ -41,10 +41,13 @@
+ #include "MachOFileAbstraction.hpp"
+ #include "Snapshot.h"
+
++
++#ifdef LTO
+ // upward dependency on lto::version()
+ namespace lto {
+ extern const char* version();
+ }
++#endif
+
+ // magic to place command line in crash reports
+ const int crashreporterBufferSize = 2000;
+@@ -3179,9 +3182,11 @@
+ fprintf(stderr, "configured to support archs: %s\n", ALL_SUPPORTED_ARCHS);
+ // if only -v specified, exit cleanly
+ if ( argc == 2 ) {
++#ifdef LTO
+ const char* ltoVers = lto::version();
+ if ( ltoVers != NULL )
+ fprintf(stderr, "LTO support using: %s\n", ltoVers);
++#endif
+ exit(0);
+ }
+ }
+--- ld64-236.3/src/ld/parsers/archive_file.cpp
++++ ld64-236.3/src/ld/parsers/archive_file.cpp
+@@ -45,7 +45,9 @@
+ #include "Architectures.hpp"
+
+ #include "macho_relocatable_file.h"
++#ifdef LTO
+ #include "lto_file.h"
++#endif
+ #include "archive_file.h"
+
+
+@@ -97,8 +99,10 @@
+ private:
+ static bool validMachOFile(const uint8_t* fileContent, uint64_t fileLength,
+ const mach_o::relocatable::ParserOptions& opts);
++#ifdef LTO
+ static bool validLTOFile(const uint8_t* fileContent, uint64_t fileLength,
+ const mach_o::relocatable::ParserOptions& opts);
++#endif
+ static cpu_type_t architecture();
+
+ class Entry : ar_hdr
+@@ -242,11 +246,13 @@
+ return mach_o::relocatable::isObjectFile(fileContent, fileLength, opts);
+ }
+
++#ifdef LTO
+ template <typename A>
+ bool File<A>::validLTOFile(const uint8_t* fileContent, uint64_t fileLength, const mach_o::relocatable::ParserOptions& opts)
+ {
+ return lto::isObjectFile(fileContent, fileLength, opts.architecture, opts.subType);
+ }
++#endif
+
+
+
+@@ -267,7 +273,11 @@
+ if ( (p==start) && ((strcmp(memberName, SYMDEF_SORTED) == 0) || (strcmp(memberName, SYMDEF) == 0)) )
+ continue;
+ // archive is valid if first .o file is valid
+- return (validMachOFile(p->content(), p->contentSize(), opts) || validLTOFile(p->content(), p->contentSize(), opts));
++ return (validMachOFile(p->content(), p->contentSize(), opts)
++#ifdef LTO
++ || validLTOFile(p->content(), p->contentSize(), opts)
++#endif
++ );
+ }
+ // empty archive
+ return true;
+@@ -388,6 +398,7 @@
+ _instantiatedEntries[member] = state;
+ return _instantiatedEntries[member];
+ }
++#ifdef LTO
+ // see if member is llvm bitcode file
+ result = lto::parse(member->content(), member->contentSize(),
+ mPath, member->modificationTime(), ordinal,
+@@ -397,6 +408,7 @@
+ _instantiatedEntries[member] = state;
+ return _instantiatedEntries[member];
+ }
++#endif
+
+ throwf("archive member '%s' with length %d is not mach-o or llvm bitcode", memberName, member->contentSize());
+ }
+--- ld64-236.3/src/ld/Resolver.cpp
++++ ld64-236.3/src/ld/Resolver.cpp
+@@ -56,7 +56,9 @@
+ #include "InputFiles.h"
+ #include "SymbolTable.h"
+ #include "Resolver.h"
++#ifdef LTO
+ #include "parsers/lto_file.h"
++#endif
+
+
+ namespace ld {
+@@ -1438,6 +1440,7 @@
+
+ void Resolver::linkTimeOptimize()
+ {
++#ifdef LTO
+ // only do work here if some llvm obj files where loaded
+ if ( ! _haveLLVMObjs )
+ return;
+@@ -1535,6 +1538,9 @@
+ // check new code does not override some dylib
+ this->checkDylibSymbolCollisions();
+ }
++#else
++ return;
++#endif
+ }
+
+
+--- ld64-236.3/src/other/ObjectDump.cpp
++++ ld64-236.3/src/other/ObjectDump.cpp
+@@ -33,7 +33,9 @@
+
+ #include "MachOFileAbstraction.hpp"
+ #include "parsers/macho_relocatable_file.h"
++#ifdef LTO
+ #include "parsers/lto_file.h"
++#endif
+
+ static bool sDumpContent= true;
+ static bool sDumpStabs = false;
+@@ -1249,10 +1251,12 @@
+ if ( objResult != NULL )
+ return objResult;
+
++#ifdef LTO
+ // see if it is an llvm object file
+ objResult = lto::parse(p, fileLen, path, stat_buf.st_mtime, ld::File::Ordinal::NullOrdinal(), sPreferredArch, sPreferredSubArch, false, true);
+ if ( objResult != NULL )
+ return objResult;
++#endif
+
+ throwf("not a mach-o object file: %s", path);
+ #else
diff --git a/sys-devel/binutils-apple/files/ld64-236.3-noppc.patch b/sys-devel/binutils-apple/files/ld64-236.3-noppc.patch
new file mode 100644
index 000000000000..85e9d94b35e1
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-236.3-noppc.patch
@@ -0,0 +1,26 @@
+Allow to fully disable powerpc.
+
+--- ld64-236.3/src/ld/parsers/macho_dylib_file.cpp.orig 2015-01-23 17:59:55.000000000 +0100
++++ ld64-236.3/src/ld/parsers/macho_dylib_file.cpp 2015-01-23 18:00:04.000000000 +0100
+@@ -1095,17 +1095,21 @@
+ *subResult = CPU_SUBTYPE_ARM64_ALL;
+ return true;
+ }
++#ifdef SUPPORT_ARCH_ppc
+ if ( Parser<ppc>::validFile(fileContent, false) ) {
+ *result = CPU_TYPE_POWERPC;
+ const macho_header<Pointer32<BigEndian> >* header = (const macho_header<Pointer32<BigEndian> >*)fileContent;
+ *subResult = header->cpusubtype();
+ return true;
+ }
++#endif
++#ifdef SUPPORT_ARCH_ppc64
+ if ( Parser<ppc64>::validFile(fileContent, false) ) {
+ *result = CPU_TYPE_POWERPC64;
+ *subResult = CPU_SUBTYPE_POWERPC_ALL;
+ return true;
+ }
++#endif
+ return false;
+ }
+
diff --git a/sys-devel/binutils-apple/files/ld64-236.3-nosnapshots.patch b/sys-devel/binutils-apple/files/ld64-236.3-nosnapshots.patch
new file mode 100644
index 000000000000..aa75a03cbf74
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-236.3-nosnapshots.patch
@@ -0,0 +1,644 @@
+Allow to disable snapshot support because of missing Block API on OS X < 10.6.
+
+--- ld64-236.3/src/ld/ld.cpp.orig 2015-01-16 14:49:49.000000000 -0800
++++ ld64-236.3/src/ld/ld.cpp 2015-01-16 14:50:42.000000000 -0800
+@@ -1072,11 +1072,13 @@
+ // implement assert() function to print out a backtrace before aborting
+ void __assert_rtn(const char* func, const char* file, int line, const char* failedexpr)
+ {
++#ifdef SUPPORT_SNAPSHOTS
+ Snapshot *snapshot = Snapshot::globalSnapshot;
+
+ snapshot->setSnapshotMode(Snapshot::SNAPSHOT_DEBUG);
+ snapshot->createSnapshot();
+ snapshot->recordAssertionMessage("Assertion failed: (%s), function %s, file %s, line %d.\n", failedexpr, func, file, line);
++#endif
+
+ void* callStack[128];
+ int depth = ::backtrace(callStack, 128);
+@@ -1094,9 +1096,13 @@
+ }
+ long offset = (uintptr_t)callStack[i] - (uintptr_t)info.dli_saddr;
+ fprintf(stderr, "%d %p %s + %ld\n", i, callStack[i], symboName, offset);
++#ifdef SUPPORT_SNAPSHOTS
+ snapshot->recordAssertionMessage("%d %p %s + %ld\n", i, callStack[i], symboName, offset);
++#endif
+ }
++#ifdef SUPPORT_SNAPSHOTS
+ fprintf(stderr, "A linker snapshot was created at:\n\t%s\n", snapshot->rootDir());
++#endif
+ fprintf(stderr, "ld: Assertion failed: (%s), function %s, file %s, line %d.\n", failedexpr, func, file, line);
+ exit(1);
+ }
+--- ld64-236.3/src/ld/Options.cpp.orig 2015-01-16 14:49:49.000000000 -0800
++++ ld64-236.3/src/ld/Options.cpp 2015-01-16 14:50:42.000000000 -0800
+@@ -182,7 +182,11 @@
+ fGenerateDtraceDOF(true), fAllowBranchIslands(true),
+ fDebugInfoStripping(kDebugInfoMinimal), fTraceOutputFile(NULL),
+ fMacVersionMin(ld::macVersionUnset), fIOSVersionMin(ld::iOSVersionUnset),
+- fSaveTempFiles(false), fSnapshotRequested(false), fPipelineFifo(NULL),
++ fSaveTempFiles(false),
++#ifdef SUPPORT_SNAPSHOTS
++ fSnapshotRequested(false),
++#endif
++ fPipelineFifo(NULL),
+ fDependencyInfoPath(NULL), fDependencyFileDescriptor(-1)
+ {
+ this->checkForClassic(argc, argv);
+@@ -577,7 +581,9 @@
+ }
+ break;
+ }
++#ifdef SUPPORT_SNAPSHOTS
+ fLinkSnapshot.recordArch(fArchitectureName);
++#endif
+ // only use compressed LINKEDIT for:
+ // Mac OS X 10.6 or later
+ // iOS 3.1 or later
+@@ -1822,8 +1828,10 @@
+ //
+ void Options::parse(int argc, const char* argv[])
+ {
++#ifdef SUPPORT_SNAPSHOTS
+ // Store the original args in the link snapshot.
+ fLinkSnapshot.recordRawArgs(argc, argv);
++#endif
+
+ // pass one builds search list from -L and -F options
+ this->buildSearchPaths(argc, argv);
+@@ -1836,17 +1844,21 @@
+ const char* arg = argv[i];
+
+ if ( arg[0] == '-' ) {
++#ifdef SUPPORT_SNAPSHOTS
+ // by default, copy one arg to the snapshot link command, and do no file copying
+ int snapshotArgIndex = i;
+ int snapshotArgCount = -1; // -1 means compute count based on change in index
+ int snapshotFileArgIndex = -1; // -1 means no data file parameter to arg
++#endif
+
+ // Since we don't care about the files passed, just the option names, we do this here.
+ if (fPrintOptions)
+ fprintf (stderr, "[Logging ld64 options]\t%s\n", arg);
+
+ if ( (arg[1] == 'L') || (arg[1] == 'F') ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotArgCount = 0; // stripped out of link snapshot
++#endif
+ if (arg[2] == '\0')
+ ++i;
+ // previously handled by buildSearchPaths()
+@@ -1893,12 +1905,16 @@
+ fOutputKind = kKextBundle;
+ }
+ else if ( strcmp(arg, "-o") == 0 ) {
+- snapshotArgCount = 0;
+ fOutputFile = argv[++i];
++#ifdef SUPPORT_SNAPSHOTS
++ snapshotArgCount = 0;
+ fLinkSnapshot.setSnapshotName(fOutputFile);
++#endif
+ }
+ else if ( strncmp(arg, "-lazy-l", 7) == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotArgCount = 0;
++#endif
+ FileInfo info = findLibrary(&arg[7], true);
+ info.options.fLazyLoad = true;
+ info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
+@@ -1906,13 +1922,17 @@
+ fUsingLazyDylibLinking = true;
+ }
+ else if ( strcmp(arg, "-lto_library") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 1;
++#endif
+ fOverridePathlibLTO = argv[++i];
+ if ( fOverridePathlibLTO == NULL )
+ throw "missing argument to -lto_library";
+ }
+ else if ( (arg[1] == 'l') && (strncmp(arg,"-lazy_",6) !=0) ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotArgCount = 0;
++#endif
+ FileInfo info = findLibrary(&arg[2]);
+ info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
+ addLibrary(info);
+@@ -1920,8 +1940,10 @@
+ // This causes a dylib to be weakly bound at
+ // link time. This corresponds to weak_import.
+ else if ( strncmp(arg, "-weak-l", 7) == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ // SNAPSHOT FIXME: what should we do for link snapshots? (ignore for now)
+ snapshotArgCount = 0;
++#endif
+ FileInfo info = findLibrary(&arg[7]);
+ info.options.fWeakImport = true;
+ info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
+@@ -1979,12 +2001,16 @@
+ else if ( strcmp(arg, "-sectorder") == 0 ) {
+ if ( (argv[i+1]==NULL) || (argv[i+2]==NULL) || (argv[i+3]==NULL) )
+ throw "-sectorder missing <segment> <section> <file-path>";
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 3;
++#endif
+ parseSectionOrderFile(argv[i+1], argv[i+2], argv[i+3]);
+ i += 3;
+ }
+ else if ( strcmp(arg, "-order_file") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 1;
++#endif
+ parseOrderFile(argv[++i], false);
+ }
+ else if ( strcmp(arg, "-order_file_statistics") == 0 ) {
+@@ -1995,7 +2021,9 @@
+ else if ( (strcmp(arg, "-sectcreate") == 0) || (strcmp(arg, "-segcreate") == 0) ) {
+ if ( (argv[i+1]==NULL) || (argv[i+2]==NULL) || (argv[i+3]==NULL) )
+ throw "-sectcreate missing <segment> <section> <file-path>";
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 3;
++#endif
+ addSection(argv[i+1], argv[i+2], argv[i+3]);
+ i += 3;
+ }
+@@ -2024,7 +2052,9 @@
+ }
+ // Same as -@ from the FSF linker.
+ else if ( strcmp(arg, "-filelist") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotArgCount = 0;
++#endif
+ const char* path = argv[++i];
+ if ( (path == NULL) || (path[0] == '-') )
+ throw "-filelist missing <path>";
+@@ -2051,7 +2081,9 @@
+ }
+ }
+ else if ( strcmp(arg, "-interposable_list") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 1;
++#endif
+ fInterposeMode = kInterposeSome;
+ loadExportFile(argv[++i], "-interposable_list", fInterposeList);
+ }
+@@ -2060,14 +2092,18 @@
+ fInterposeMode = kInterposeNone;
+ }
+ else if ( strcmp(arg, "-exported_symbols_list") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 1;
++#endif
+ if ( fExportMode == kDontExportSome )
+ throw "can't use -exported_symbols_list and -unexported_symbols_list";
+ fExportMode = kExportSome;
+ loadExportFile(argv[++i], "-exported_symbols_list", fExportSymbols);
+ }
+ else if ( strcmp(arg, "-unexported_symbols_list") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 1;
++#endif
+ if ( fExportMode == kExportSome )
+ throw "can't use -unexported_symbols_list and -exported_symbols_list";
+ fExportMode = kDontExportSome;
+@@ -2086,14 +2122,18 @@
+ fDontExportSymbols.insert(argv[++i]);
+ }
+ else if ( strcmp(arg, "-non_global_symbols_no_strip_list") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 1;
++#endif
+ if ( fLocalSymbolHandling == kLocalSymbolsSelectiveExclude )
+ throw "can't use -non_global_symbols_no_strip_list and -non_global_symbols_strip_list";
+ fLocalSymbolHandling = kLocalSymbolsSelectiveInclude;
+ loadExportFile(argv[++i], "-non_global_symbols_no_strip_list", fLocalSymbolsIncluded);
+ }
+ else if ( strcmp(arg, "-non_global_symbols_strip_list") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 1;
++#endif
+ if ( fLocalSymbolHandling == kLocalSymbolsSelectiveInclude )
+ throw "can't use -non_global_symbols_no_strip_list and -non_global_symbols_strip_list";
+ fLocalSymbolHandling = kLocalSymbolsSelectiveExclude;
+@@ -2109,16 +2149,20 @@
+ }
+ // Similar to -weak-l but uses the absolute path name to the library.
+ else if ( strcmp(arg, "-weak_library") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ // SNAPSHOT FIXME: what should we do for link snapshots? (ignore for now)
+ snapshotArgCount = 0;
++#endif
+ FileInfo info = findFile(argv[++i]);
+ info.options.fWeakImport = true;
+ info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
+ addLibrary(info);
+ }
+ else if ( strcmp(arg, "-lazy_library") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ // SNAPSHOT FIXME: what should we do for link snapshots? (ignore for now)
+ snapshotArgCount = 0;
++#endif
+ FileInfo info = findFile(argv[++i]);
+ info.options.fLazyLoad = true;
+ info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
+@@ -2126,22 +2170,28 @@
+ fUsingLazyDylibLinking = true;
+ }
+ else if ( strcmp(arg, "-framework") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotArgCount = 0;
++#endif
+ FileInfo info = findFramework(argv[++i]);
+ info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
+ addLibrary(info);
+ }
+ else if ( strcmp(arg, "-weak_framework") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ // SNAPSHOT FIXME: what should we do for link snapshots? (ignore for now)
+ snapshotArgCount = 0;
++#endif
+ FileInfo info = findFramework(argv[++i]);
+ info.options.fWeakImport = true;
+ info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
+ addLibrary(info);
+ }
+ else if ( strcmp(arg, "-lazy_framework") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ // SNAPSHOT FIXME: what should we do for link snapshots? (ignore for now)
+ snapshotArgCount = 0;
++#endif
+ FileInfo info = findFramework(argv[++i]);
+ info.options.fLazyLoad = true;
+ info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
+@@ -2219,8 +2269,10 @@
+ // This should probably be deprecated when we respect -L and -F
+ // when searching for libraries.
+ else if ( strcmp(arg, "-dylib_file") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ // ignore for snapshot because a stub dylib will be created in the snapshot
+ snapshotArgCount = 0;
++#endif
+ addDylibOverride(argv[++i]);
+ }
+ // What to expand @executable_path to if found in dependent dylibs
+@@ -2277,7 +2329,9 @@
+ }
+ // ??? Deprecate when we get rid of basing at build time.
+ else if ( strcmp(arg, "-seg_addr_table") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 1;
++#endif
+ const char* name = argv[++i];
+ if ( name == NULL )
+ throw "-seg_addr_table missing argument";
+@@ -2341,7 +2395,9 @@
+ i += 2;
+ }
+ else if ( strcmp(arg, "-bundle_loader") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 1;
++#endif
+ fBundleLoader = argv[++i];
+ if ( (fBundleLoader == NULL) || (fBundleLoader[0] == '-') )
+ throw "-bundle_loader missing <path>";
+@@ -2573,7 +2629,9 @@
+ // previously handled by buildSearchPaths()
+ }
+ else if ( strcmp(arg, "-syslibroot") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotArgCount = 0;
++#endif
+ ++i;
+ // previously handled by buildSearchPaths()
+ }
+@@ -2584,7 +2642,9 @@
+ fUUIDMode = kUUIDRandom;
+ }
+ else if ( strcmp(arg, "-dtrace") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 1;
++#endif
+ const char* name = argv[++i];
+ if ( name == NULL )
+ throw "-dtrace missing argument";
+@@ -2607,7 +2667,9 @@
+ fAliases.push_back(pair);
+ }
+ else if ( strcmp(arg, "-alias_list") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 1;
++#endif
+ parseAliasFile(argv[++i]);
+ }
+ else if ( strcmp(arg, "-save-temps") == 0 ) {
+@@ -2638,48 +2700,60 @@
+ fDisablePositionIndependentExecutable = true;
+ }
+ else if ( strncmp(arg, "-reexport-l", 11) == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ // SNAPSHOT FIXME: what should we do for link snapshots? (ignore for now)
+ snapshotArgCount = 0;
++#endif
+ FileInfo info = findLibrary(&arg[11], true);
+ info.options.fReExport = true;
+ info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
+ addLibrary(info);
+ }
+ else if ( strcmp(arg, "-reexport_library") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ // SNAPSHOT FIXME: what should we do for link snapshots? (ignore for now)
+ snapshotArgCount = 0;
++#endif
+ FileInfo info = findFile(argv[++i]);
+ info.options.fReExport = true;
+ info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
+ addLibrary(info);
+ }
+ else if ( strcmp(arg, "-reexport_framework") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ // SNAPSHOT FIXME: what should we do for link snapshots? (ignore for now)
+ snapshotArgCount = 0;
++#endif
+ FileInfo info = findFramework(argv[++i]);
+ info.options.fReExport = true;
+ info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
+ addLibrary(info);
+ }
+ else if ( strncmp(arg, "-upward-l", 9) == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ // SNAPSHOT FIXME: what should we do for link snapshots? (ignore for now)
+ snapshotArgCount = 0;
++#endif
+ FileInfo info = findLibrary(&arg[9], true);
+ info.options.fUpward = true;
+ info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
+ addLibrary(info);
+ }
+ else if ( strcmp(arg, "-upward_library") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ // SNAPSHOT FIXME: what should we do for link snapshots? (ignore for now)
+ snapshotArgCount = 0;
++#endif
+ FileInfo info = findFile(argv[++i]);
+ info.options.fUpward = true;
+ info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
+ addLibrary(info);
+ }
+ else if ( strcmp(arg, "-upward_framework") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ // SNAPSHOT FIXME: what should we do for link snapshots? (ignore for now)
+ snapshotArgCount = 0;
++#endif
+ FileInfo info = findFramework(argv[++i]);
+ info.options.fUpward = true;
+ info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
+@@ -2733,7 +2807,9 @@
+ fMarkDeadStrippableDylib = true;
+ }
+ else if ( strcmp(arg, "-exported_symbols_order") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 1;
++#endif
+ loadSymbolOrderFile(argv[++i], fExportSymbolsOrder);
+ }
+ else if ( strcmp(arg, "-no_compact_linkedit") == 0 ) {
+@@ -2825,11 +2901,15 @@
+ fObjcCategoryMerging = false;
+ }
+ else if ( strcmp(arg, "-force_symbols_weak_list") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 1;
++#endif
+ loadExportFile(argv[++i], "-force_symbols_weak_list", fForceWeakSymbols);
+ }
+ else if ( strcmp(arg, "-force_symbols_not_weak_list") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 1;
++#endif
+ loadExportFile(argv[++i], "-force_symbols_not_weak_list", fForceNotWeakSymbols);
+ }
+ else if ( strcmp(arg, "-force_symbol_weak") == 0 ) {
+@@ -2845,7 +2925,9 @@
+ fForceNotWeakSymbols.insert(symbol);
+ }
+ else if ( strcmp(arg, "-reexported_symbols_list") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 1;
++#endif
+ if ( fExportMode == kExportSome )
+ throw "can't use -exported_symbols_list and -reexported_symbols_list";
+ loadExportFile(argv[++i], "-reexported_symbols_list", fReExportSymbols);
+@@ -2861,6 +2943,7 @@
+ else if ( strcmp(arg, "-page_align_data_atoms") == 0 ) {
+ fPageAlignDataAtoms = true;
+ }
++#ifdef SUPPORT_SNAPSHOTS
+ else if (strcmp(arg, "-debug_snapshot") == 0) {
+ fLinkSnapshot.setSnapshotMode(Snapshot::SNAPSHOT_DEBUG);
+ fSnapshotRequested = true;
+@@ -2873,6 +2956,7 @@
+ fLinkSnapshot.setSnapshotPath(path);
+ fSnapshotRequested = true;
+ }
++#endif
+ else if ( strcmp(arg, "-new_main") == 0 ) {
+ fEntryPointLoadCommandForceOn = true;
+ }
+@@ -2914,7 +2998,9 @@
+ fExportDynamic = true;
+ }
+ else if ( strcmp(arg, "-force_symbols_coalesce_list") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 1;
++#endif
+ loadExportFile(argv[++i], "-force_symbols_coalesce_list", fForceCoalesceSymbols);
+ }
+ else if ( strcmp(arg, "-add_linker_option") == 0 ) {
+@@ -2984,10 +3070,12 @@
+ throwf("unknown option: %s", arg);
+ }
+
++#ifdef SUPPORT_SNAPSHOTS
+ if (snapshotArgCount == -1)
+ snapshotArgCount = i-snapshotArgIndex+1;
+ if (snapshotArgCount > 0)
+ fLinkSnapshot.addSnapshotLinkArg(snapshotArgIndex, snapshotArgCount, snapshotFileArgIndex);
++#endif
+ }
+ else {
+ FileInfo info = findFile(arg);
+@@ -3006,8 +3096,10 @@
+ addLibrary(info);
+ }
+
++#ifdef SUPPORT_SNAPSHOTS
+ if (fSnapshotRequested)
+ fLinkSnapshot.createSnapshot();
++#endif
+ }
+
+
+@@ -3270,6 +3362,7 @@
+ if ( customDyldPath != NULL )
+ fDyldInstallPath = customDyldPath;
+
++#ifdef SUPPORT_SNAPSHOTS
+ const char* debugArchivePath = getenv("LD_DEBUG_SNAPSHOT");
+ if (debugArchivePath != NULL) {
+ fLinkSnapshot.setSnapshotMode(Snapshot::SNAPSHOT_DEBUG);
+@@ -3277,6 +3370,7 @@
+ fLinkSnapshot.setSnapshotPath(debugArchivePath);
+ fSnapshotRequested = true;
+ }
++#endif
+
+ const char* pipeFdString = getenv("LD_PIPELINE_FIFO");
+ if (pipeFdString != NULL) {
+@@ -4133,7 +4227,9 @@
+ if ( strcmp(&lastSlash[1], subUmbrella) == 0 ) {
+ info.options.fReExport = true;
+ found = true;
++#ifdef SUPPORT_SNAPSHOTS
+ fLinkSnapshot.recordSubUmbrella(info.path);
++#endif
+ break;
+ }
+ }
+@@ -4156,7 +4252,9 @@
+ if ( strncmp(&lastSlash[1], subLibrary, dot-lastSlash-1) == 0 ) {
+ info.options.fReExport = true;
+ found = true;
++#ifdef SUPPORT_SNAPSHOTS
+ fLinkSnapshot.recordSubLibrary(info.path);
++#endif
+ break;
+ }
+ }
+--- ld64-236.3/src/ld/Options.h.orig 2015-01-16 14:49:49.000000000 -0800
++++ ld64-236.3/src/ld/Options.h 2015-01-16 14:50:42.000000000 -0800
+@@ -48,7 +48,9 @@
+ extern void throwf (const char* format, ...) __attribute__ ((noreturn,format(printf, 1, 2)));
+ extern void warning(const char* format, ...) __attribute__((format(printf, 1, 2)));
+
++#ifdef SUPPORT_SNAPSHOTS
+ class Snapshot;
++#endif
+
+ class LibraryOptions
+ {
+@@ -362,7 +364,9 @@
+ bool forceWeakNonWildCard(const char* symbolName) const;
+ bool forceNotWeakNonWildcard(const char* symbolName) const;
+ bool forceCoalesce(const char* symbolName) const;
++#ifdef SUPPORT_SNAPSHOTS
+ Snapshot& snapshot() const { return fLinkSnapshot; }
++#endif
+ bool errorBecauseOfWarnings() const;
+ bool needsThreadLoadCommand() const { return fNeedsThreadLoadCommand; }
+ bool needsEntryPointLoadCommand() const { return fEntryPointLoadCommand; }
+@@ -640,8 +644,10 @@
+ std::vector< std::vector<const char*> > fLinkerOptions;
+ std::vector<SectionRename> fSectionRenames;
+ bool fSaveTempFiles;
++#ifdef SUPPORT_SNAPSHOTS
+ mutable Snapshot fLinkSnapshot;
+ bool fSnapshotRequested;
++#endif
+ const char* fPipelineFifo;
+ const char* fDependencyInfoPath;
+ mutable int fDependencyFileDescriptor;
+--- ld64-236.3/src/ld/Snapshot.cpp.orig 2015-01-16 14:51:58.000000000 -0800
++++ ld64-236.3/src/ld/Snapshot.cpp 2015-01-16 14:50:42.000000000 -0800
+@@ -6,6 +6,9 @@
+ // Copyright (c) 2011 Apple Inc. All rights reserved.
+ //
+
++#include "Snapshot.h"
++
++#ifdef SUPPORT_SNAPSHOTS
+ #include <string.h>
+ #include <unistd.h>
+ #include <stdio.h>
+@@ -17,7 +20,6 @@
+ #include <time.h>
+ #include <Block.h>
+
+-#include "Snapshot.h"
+ #include "Options.h"
+
+ #include "compile_stubs.h"
+@@ -538,3 +538,5 @@
+ }
+ }
+ }
++
++#endif /* SUPPORT_SNAPSHOT */
+--- ld64-236.3/src/ld/Snapshot.h.orig 2015-01-23 07:59:55.000000000 +0100
++++ ld64-236.3/src/ld/Snapshot.h 2015-01-23 07:58:14.000000000 +0100
+@@ -8,6 +8,8 @@
+
+ #ifndef ld64_Snapshot_h
+ #define ld64_Snapshot_h
++
++#ifdef SUPPORT_SNAPSHOTS
+ #include <stdint.h>
+ #include <string.h>
+ #include <map>
+@@ -151,3 +153,5 @@
+ };
+
+ #endif
++
++#endif
+--- ld64-236.3/src/ld/InputFiles.cpp.orig 2015-01-16 14:54:33.000000000 -0800
++++ ld64-236.3/src/ld/InputFiles.cpp 2015-01-16 14:55:37.000000000 -0800
+@@ -1101,7 +1101,9 @@
+ case ld::File::Reloc:
+ {
+ ld::relocatable::File* reloc = (ld::relocatable::File*)file;
++#ifdef SUPPORT_SNAPSHOTS
+ _options.snapshot().recordObjectFile(reloc->path());
++#endif
+ if ( _options.dumpDependencyInfo() )
+ _options.dumpDependency(Options::depObjectFile, reloc->path());
+ }
+@@ -1201,7 +1203,9 @@
+ if ( dylibFile->justInTimeforEachAtom(name, handler) ) {
+ // we found a definition in this dylib
+ // done, unless it is a weak definition in which case we keep searching
++#ifdef SUPPORT_SNAPSHOTS
+ _options.snapshot().recordDylibSymbol(dylibFile, name);
++#endif
+ if ( !dylibFile->hasWeakExternals() || !dylibFile->hasWeakDefinition(name)) {
+ return true;
+ }
+@@ -1215,7 +1219,9 @@
+ if ( archiveFile->justInTimeDataOnlyforEachAtom(name, handler) ) {
+ if ( _options.traceArchives() )
+ logArchive(archiveFile);
++#ifdef SUPPORT_SNAPSHOTS
+ _options.snapshot().recordArchive(archiveFile->path());
++#endif
+ // found data definition in static library, done
+ return true;
+ }
+@@ -1224,7 +1230,9 @@
+ if ( archiveFile->justInTimeforEachAtom(name, handler) ) {
+ if ( _options.traceArchives() )
+ logArchive(archiveFile);
++#ifdef SUPPORT_SNAPSHOTS
+ _options.snapshot().recordArchive(archiveFile->path());
++#endif
+ // found definition in static library, done
+ return true;
+ }
+@@ -1251,7 +1259,9 @@
+ if ( dylibFile->justInTimeforEachAtom(name, handler) ) {
+ // we found a definition in this dylib
+ // done, unless it is a weak definition in which case we keep searching
++#ifdef SUPPORT_SNAPSHOTS
+ _options.snapshot().recordDylibSymbol(dylibFile, name);
++#endif
+ if ( !dylibFile->hasWeakExternals() || !dylibFile->hasWeakDefinition(name)) {
+ return true;
+ }
diff --git a/sys-devel/binutils-apple/files/ld64-241.9-arm64-cputype.patch b/sys-devel/binutils-apple/files/ld64-241.9-arm64-cputype.patch
new file mode 100644
index 000000000000..dd0a6f22bc0b
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-241.9-arm64-cputype.patch
@@ -0,0 +1,17 @@
+Remove redefinitions of CPU types that cause warnings and mask that some
+platform isn't actually supported on a host version.
+
+diff -ur ld64-241.9/src/abstraction/MachOFileAbstraction.hpp work/ld64-241.9/src/abstraction/MachOFileAbstraction.hpp
+--- ld64-241.9/src/abstraction/MachOFileAbstraction.hpp 2014-11-04 00:30:51.000000000 +0100
++++ ld64-241.9/src/abstraction/MachOFileAbstraction.hpp 2015-01-22 21:31:58.000000000 +0100
+@@ -253,10 +253,6 @@
+
+
+
+-// hack until arm64 headers are worked out
+-#define CPU_TYPE_ARM64 (CPU_TYPE_ARM | CPU_ARCH_ABI64)
+-#define CPU_SUBTYPE_ARM64_ALL 0
+-#define CPU_SUBTYPE_ARM64_V8 1
+
+ #define ARM64_RELOC_UNSIGNED 0 // for pointers
+ #define ARM64_RELOC_SUBTRACTOR 1 // must be followed by a ARM64_RELOC_UNSIGNED
diff --git a/sys-devel/binutils-apple/files/ld64-241.9-atomic-volatile.patch b/sys-devel/binutils-apple/files/ld64-241.9-atomic-volatile.patch
new file mode 100644
index 000000000000..294b05fb88b4
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-241.9-atomic-volatile.patch
@@ -0,0 +1,27 @@
+OSAtmicAdd and friends don't expect volatile parameters on OS X < 10.5.
+
+diff -ur ld64-241.9/src/ld/InputFiles.h ld64-241.9/src/ld/InputFiles.h
+--- ld64-241.9/src/ld/InputFiles.h 2015-01-22 20:59:47.000000000 +0100
++++ ld64-241.9/src/ld/InputFiles.h 2015-01-22 20:19:51.000000000 +0100
+@@ -86,11 +86,16 @@
+ void createIndirectDylibs();
+
+ // for -print_statistics
+- volatile int64_t _totalObjectSize;
+- volatile int64_t _totalArchiveSize;
+- volatile int32_t _totalObjectLoaded;
+- volatile int32_t _totalArchivesLoaded;
+- volatile int32_t _totalDylibsLoaded;
++#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
++#define LD_ATOMIC_VOLATILE volatile
++#else
++#define LD_ATOMIC_VOLATILE
++#endif
++ LD_ATOMIC_VOLATILE int64_t _totalObjectSize;
++ LD_ATOMIC_VOLATILE int64_t _totalArchiveSize;
++ LD_ATOMIC_VOLATILE int32_t _totalObjectLoaded;
++ LD_ATOMIC_VOLATILE int32_t _totalArchivesLoaded;
++ LD_ATOMIC_VOLATILE int32_t _totalDylibsLoaded;
+
+
+ private:
diff --git a/sys-devel/binutils-apple/files/ld64-241.9-cc_md5.patch b/sys-devel/binutils-apple/files/ld64-241.9-cc_md5.patch
new file mode 100644
index 000000000000..833fec2b66e9
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-241.9-cc_md5.patch
@@ -0,0 +1,24 @@
+Provide CC_MD5 on OS X < 10.5.
+
+--- ld64-241.9/src/ld/OutputFile.cpp 2015-01-22 23:20:33.000000000 +0100
++++ ld64-241.9/src/ld/OutputFile.cpp 2015-01-22 23:26:02.000000000 +0100
+@@ -71,6 +71,19 @@
+ #include "LinkEdit.hpp"
+ #include "LinkEditClassic.hpp"
+
++#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
++/* CC_MD5 missing on < 10.5 - provide replacement */
++unsigned char *CC_MD5(const void *data, CC_LONG len, unsigned char *md) {
++ CC_MD5_CTX ctx;
++ if(md == NULL)
++ return NULL;
++
++ CC_MD5_Init(&ctx);
++ CC_MD5_Update(&ctx, data, len);
++ CC_MD5_Final(md, &ctx);
++ return md;
++}
++#endif
+
+ namespace ld {
+ namespace tool {
diff --git a/sys-devel/binutils-apple/files/ld64-241.9-extraneous-includes.patch b/sys-devel/binutils-apple/files/ld64-241.9-extraneous-includes.patch
new file mode 100644
index 000000000000..f1fbbd82ec37
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-241.9-extraneous-includes.patch
@@ -0,0 +1,13 @@
+Remove unneeded and sometimes missing headers.
+
+diff -ur ld64-241.9/src/ld/Options.cpp work/ld64-241.9/src/ld/Options.cpp
+--- ld64-241.9/src/ld/Options.cpp 2015-01-22 21:42:04.000000000 +0100
++++ ld64-241.9/src/ld/Options.cpp 2015-01-22 21:45:15.000000000 +0100
+@@ -31,7 +31,6 @@
+ #include <fcntl.h>
+ #include <errno.h>
+ #include <string.h>
+-#include <spawn.h>
+ #include <cxxabi.h>
+ #include <Availability.h>
+
diff --git a/sys-devel/binutils-apple/files/ld64-241.9-gcc.patch b/sys-devel/binutils-apple/files/ld64-241.9-gcc.patch
new file mode 100644
index 000000000000..06b735b242a5
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-241.9-gcc.patch
@@ -0,0 +1,1029 @@
+Provide c++11 headers from tr1 include directory and namespace.
+
+Work around weird namespacing bug in gcc-4.2.1 where class ld::Section
+conflicts with template mach_o::relocatable::Section by renaming the latter to
+MRFSection (could possibly be done using sed from ebuild or avoided by figuring
+out, what's actually going on with those namespaces).
+
+--- ./ld64-241.9/src/ld/InputFiles.h.gcc 2014-09-11 00:24:46.000000000 +0200
++++ ./ld64-241.9/src/ld/InputFiles.h 2015-01-12 22:12:18.000000000 +0100
+@@ -46,6 +46,14 @@
+ #include <pthread.h>
+ #endif
+
++#ifdef __GLIBCXX__
++#include <tr1/unordered_map>
++#define UNORDERED_MAP tr1::unordered_map
++#else
++#include <unordered_map>
++#define UNORDERED_MAP unordered_map
++#endif
++
+ #include <vector>
+
+ #include "Options.h"
+@@ -107,7 +115,7 @@
+ static void parseWorkerThread(InputFiles *inputFiles);
+ void startThread(void (*threadFunc)(InputFiles *)) const;
+
+- typedef std::unordered_map<const char*, ld::dylib::File*, CStringHash, CStringEquals> InstallNameToDylib;
++ typedef std::UNORDERED_MAP<const char*, ld::dylib::File*, CStringHash, CStringEquals> InstallNameToDylib;
+
+ const Options& _options;
+ std::vector<ld::File*> _inputFiles;
+--- ./ld64-241.9/src/ld/ld.cpp.gcc 2014-09-11 00:24:46.000000000 +0200
++++ ./ld64-241.9/src/ld/ld.cpp 2015-01-12 22:12:18.000000000 +0100
+@@ -54,7 +54,13 @@
+ #include <vector>
+ #include <list>
+ #include <algorithm>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_map>
++#define UNORDERED_MAP tr1::unordered_map
++#else
+ #include <unordered_map>
++#define UNORDERED_MAP unordered_map
++#endif
+ #include <cxxabi.h>
+
+ #include "Options.h"
+@@ -149,7 +155,7 @@
+ struct SectionEquals {
+ bool operator()(const ld::Section* left, const ld::Section* right) const;
+ };
+- typedef std::unordered_map<const ld::Section*, FinalSection*, SectionHash, SectionEquals> SectionInToOut;
++ typedef std::UNORDERED_MAP<const ld::Section*, FinalSection*, SectionHash, SectionEquals> SectionInToOut;
+
+
+ SectionInToOut _sectionInToFinalMap;
+--- ./ld64-241.9/src/ld/ld.hpp.gcc 2014-09-11 00:24:46.000000000 +0200
++++ ./ld64-241.9/src/ld/ld.hpp 2015-01-12 22:12:18.000000000 +0100
+@@ -32,7 +32,13 @@
+ #include <assert.h>
+
+ #include <vector>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_set>
++#define UNORDERED_SET tr1::unordered_set
++#else
+ #include <unordered_set>
++#define UNORDERED_SET unordered_set
++#endif
+
+ #include "configure.h"
+
+@@ -822,7 +828,7 @@
+ bool operator()(const char* left, const char* right) const { return (strcmp(left, right) == 0); }
+ };
+
+-typedef std::unordered_set<const char*, ld::CStringHash, ld::CStringEquals> CStringSet;
++typedef std::UNORDERED_SET<const char*, ld::CStringHash, ld::CStringEquals> CStringSet;
+
+ class Internal
+ {
+--- ./ld64-241.9/src/ld/LinkEditClassic.hpp.gcc 2014-09-11 00:24:46.000000000 +0200
++++ ./ld64-241.9/src/ld/LinkEditClassic.hpp 2015-01-12 22:12:18.000000000 +0100
+@@ -31,8 +31,13 @@
+ #include <limits.h>
+ #include <unistd.h>
+
+-#include <vector>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_map>
++#define UNORDERED_MAP tr1::unordered_map
++#else
+ #include <unordered_map>
++#define UNORDERED_MAP unordered_map
++#endif
+
+ #include "Options.h"
+ #include "ld.hpp"
+@@ -92,7 +97,7 @@
+
+ private:
+ enum { kBufferSize = 0x01000000 };
+- typedef std::unordered_map<const char*, int32_t, CStringHash, CStringEquals> StringToOffset;
++ typedef std::UNORDERED_MAP<const char*, int32_t, CStringHash, CStringEquals> StringToOffset;
+
+ const uint32_t _pointerSize;
+ std::vector<char*> _fullBuffers;
+--- ./ld64-241.9/src/ld/Options.cpp.gcc 2014-11-04 00:25:08.000000000 +0100
++++ ./ld64-241.9/src/ld/Options.cpp 2015-01-12 22:12:18.000000000 +0100
+@@ -4548,7 +4548,7 @@
+
+ // make sure all required exported symbols exist
+ std::vector<const char*> impliedExports;
+- for (NameSet::iterator it=fExportSymbols.regularBegin(); it != fExportSymbols.regularEnd(); ++it) {
++ for (NameSet::const_iterator it=fExportSymbols.regularBegin(); it != fExportSymbols.regularEnd(); ++it) {
+ const char* name = *it;
+ const int len = strlen(name);
+ if ( (strcmp(&name[len-3], ".eh") == 0) || (strncmp(name, ".objc_category_name_", 20) == 0) ) {
+@@ -4580,7 +4580,7 @@
+ }
+
+ // make sure all required re-exported symbols exist
+- for (NameSet::iterator it=fReExportSymbols.regularBegin(); it != fReExportSymbols.regularEnd(); ++it) {
++ for (NameSet::const_iterator it=fReExportSymbols.regularBegin(); it != fReExportSymbols.regularEnd(); ++it) {
+ fInitialUndefines.push_back(*it);
+ }
+
+--- ./ld64-241.9/src/ld/Options.h.gcc 2014-11-04 00:29:32.000000000 +0100
++++ ./ld64-241.9/src/ld/Options.h 2015-01-12 22:12:18.000000000 +0100
+@@ -30,8 +30,17 @@
+ #include <mach/machine.h>
+
+ #include <vector>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_set>
++#include <tr1/unordered_map>
++#define UNORDERED_MAP tr1::unordered_map
++#define UNORDERED_SET tr1::unordered_set
++#else
+ #include <unordered_set>
+ #include <unordered_map>
++#define UNORDERED_MAP unordered_map
++#define UNORDERED_SET unordered_set
++#endif
+
+ #include "ld.hpp"
+ #include "Snapshot.h"
+@@ -396,8 +405,8 @@
+ bool moveRwSymbol(const char* symName, const char* filePath, const char*& seg, bool& wildCardMatch) const;
+
+ private:
+- typedef std::unordered_map<const char*, unsigned int, ld::CStringHash, ld::CStringEquals> NameToOrder;
+- typedef std::unordered_set<const char*, ld::CStringHash, ld::CStringEquals> NameSet;
++ typedef std::UNORDERED_MAP<const char*, unsigned int, ld::CStringHash, ld::CStringEquals> NameToOrder;
++ typedef std::UNORDERED_SET<const char*, ld::CStringHash, ld::CStringEquals> NameSet;
+ enum ExportMode { kExportDefault, kExportSome, kDontExportSome };
+ enum LibrarySearchMode { kSearchDylibAndArchiveInEachDir, kSearchAllDirsForDylibsThenAllDirsForArchives };
+ enum InterposeMode { kInterposeNone, kInterposeAllExternal, kInterposeSome };
+@@ -410,8 +419,8 @@
+ bool containsNonWildcard(const char*) const;
+ bool empty() const { return fRegular.empty() && fWildCard.empty(); }
+ bool hasWildCards() const { return !fWildCard.empty(); }
+- NameSet::iterator regularBegin() const { return fRegular.begin(); }
+- NameSet::iterator regularEnd() const { return fRegular.end(); }
++ NameSet::const_iterator regularBegin() const { return fRegular.begin(); }
++ NameSet::const_iterator regularEnd() const { return fRegular.end(); }
+ void remove(const NameSet&);
+ private:
+ static bool hasWildCards(const char*);
+--- ./ld64-241.9/src/ld/OutputFile.cpp.gcc 2014-09-11 00:24:46.000000000 +0200
++++ ./ld64-241.9/src/ld/OutputFile.cpp 2015-01-12 22:12:18.000000000 +0100
+@@ -50,7 +50,13 @@
+ #include <vector>
+ #include <list>
+ #include <algorithm>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_set>
++#define UNORDERED_SET tr1::unordered_set
++#else
+ #include <unordered_set>
++#define UNORDERED_SET unordered_set
++#endif
+
+ #include <CommonCrypto/CommonDigest.h>
+ #include <AvailabilityMacros.h>
+@@ -4748,7 +4754,7 @@
+ const char* filename = NULL;
+ bool wroteStartSO = false;
+ state.stabs.reserve(atomsNeedingDebugNotes.size()*4);
+- std::unordered_set<const char*, CStringHash, CStringEquals> seenFiles;
++ std::UNORDERED_SET<const char*, CStringHash, CStringEquals> seenFiles;
+ for (std::vector<const ld::Atom*>::iterator it=atomsNeedingDebugNotes.begin(); it != atomsNeedingDebugNotes.end(); it++) {
+ const ld::Atom* atom = *it;
+ const ld::File* atomFile = atom->file();
+--- ./ld64-241.9/src/ld/parsers/archive_file.cpp.gcc 2014-09-11 00:24:46.000000000 +0200
++++ ./ld64-241.9/src/ld/parsers/archive_file.cpp 2015-01-12 22:12:18.000000000 +0100
+@@ -33,7 +33,13 @@
+ #include <set>
+ #include <map>
+ #include <algorithm>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_map>
++#define UNORDERED_MAP tr1::unordered_map
++#else
+ #include <unordered_map>
++#define UNORDERED_MAP unordered_map
++#endif
+
+ #include "MachOFileAbstraction.hpp"
+ #include "Architectures.hpp"
+@@ -112,7 +118,7 @@
+ struct MemberState { ld::relocatable::File* file; const Entry *entry; bool logged; bool loaded; uint32_t index;};
+ bool loadMember(MemberState& state, ld::File::AtomHandler& handler, const char *format, ...) const;
+
+- typedef std::unordered_map<const char*, const struct ranlib*, ld::CStringHash, ld::CStringEquals> NameToEntryMap;
++ typedef std::UNORDERED_MAP<const char*, const struct ranlib*, ld::CStringHash, ld::CStringEquals> NameToEntryMap;
+
+ typedef typename A::P P;
+ typedef typename A::P::E E;
+--- ./ld64-241.9/src/ld/parsers/lto_file.cpp.gcc 2014-11-04 00:59:51.000000000 +0100
++++ ./ld64-241.9/src/ld/parsers/lto_file.cpp 2015-01-12 22:12:18.000000000 +0100
+@@ -33,8 +33,17 @@
+ #include <pthread.h>
+ #include <mach-o/dyld.h>
+ #include <vector>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_set>
++#include <tr1/unordered_map>
++#define UNORDERED_MAP tr1::unordered_map
++#define UNORDERED_SET tr1::unordered_set
++#else
+ #include <unordered_set>
+ #include <unordered_map>
++#define UNORDERED_MAP unordered_map
++#define UNORDERED_SET unordered_set
++#endif
+
+ #include "MachOFileAbstraction.hpp"
+ #include "Architectures.hpp"
+@@ -218,8 +227,8 @@
+ static void ltoDiagnosticHandler(lto_codegen_diagnostic_severity_t, const char*, void*);
+ #endif
+
+- typedef std::unordered_set<const char*, ld::CStringHash, ld::CStringEquals> CStringSet;
+- typedef std::unordered_map<const char*, Atom*, ld::CStringHash, ld::CStringEquals> CStringToAtom;
++ typedef std::UNORDERED_SET<const char*, ld::CStringHash, ld::CStringEquals> CStringSet;
++ typedef std::UNORDERED_MAP<const char*, Atom*, ld::CStringHash, ld::CStringEquals> CStringToAtom;
+
+ class AtomSyncer : public ld::File::AtomHandler {
+ public:
+--- ./ld64-241.9/src/ld/parsers/macho_dylib_file.cpp.gcc 2014-09-11 00:24:46.000000000 +0200
++++ ./ld64-241.9/src/ld/parsers/macho_dylib_file.cpp 2015-01-12 22:12:18.000000000 +0100
+@@ -34,8 +34,17 @@
+ #include <vector>
+ #include <set>
+ #include <algorithm>
+-#include <unordered_map>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_set>
++#include <tr1/unordered_map>
++#define UNORDERED_MAP tr1::unordered_map
++#define UNORDERED_SET tr1::unordered_set
++#else
+ #include <unordered_set>
++#include <unordered_map>
++#define UNORDERED_MAP unordered_map
++#define UNORDERED_SET unordered_set
++#endif
+
+ #include "Architectures.hpp"
+ #include "MachOFileAbstraction.hpp"
+@@ -193,8 +202,8 @@
+ };
+ };
+ struct AtomAndWeak { ld::Atom* atom; bool weakDef; bool tlv; pint_t address; };
+- typedef std::unordered_map<const char*, AtomAndWeak, ld::CStringHash, ld::CStringEquals> NameToAtomMap;
+- typedef std::unordered_set<const char*, CStringHash, ld::CStringEquals> NameSet;
++ typedef std::UNORDERED_MAP<const char*, AtomAndWeak, ld::CStringHash, ld::CStringEquals> NameToAtomMap;
++ typedef std::UNORDERED_SET<const char*, CStringHash, ld::CStringEquals> NameSet;
+
+ struct Dependent { const char* path; File<A>* dylib; bool reExport; };
+
+@@ -562,14 +571,18 @@
+ if ( _s_logHashtable ) fprintf(stderr, "ld: building hashtable of %u toc entries for %s\n", dynamicInfo->nextdefsym(), this->path());
+ const macho_nlist<P>* start = &symbolTable[dynamicInfo->iextdefsym()];
+ const macho_nlist<P>* end = &start[dynamicInfo->nextdefsym()];
++#ifndef __GLIBCXX__
+ _atoms.reserve(dynamicInfo->nextdefsym()); // set initial bucket count
++#endif
+ for (const macho_nlist<P>* sym=start; sym < end; ++sym) {
+ this->addSymbol(&strings[sym->n_strx()], (sym->n_desc() & N_WEAK_DEF) != 0, false, sym->n_value());
+ }
+ }
+ else {
+ int32_t count = dynamicInfo->ntoc();
++#ifndef __GLIBCXX__
+ _atoms.reserve(count); // set initial bucket count
++#endif
+ if ( _s_logHashtable ) fprintf(stderr, "ld: building hashtable of %u entries for %s\n", count, this->path());
+ const struct dylib_table_of_contents* toc = (dylib_table_of_contents*)(fileContent + dynamicInfo->tocoff());
+ for (int32_t i = 0; i < count; ++i) {
+--- ./ld64-241.9/src/ld/parsers/macho_relocatable_file.cpp.gcc 2014-11-04 00:57:10.000000000 +0100
++++ ./ld64-241.9/src/ld/parsers/macho_relocatable_file.cpp 2015-01-12 22:22:53.000000000 +0100
+@@ -62,7 +62,7 @@
+ // forward reference
+ template <typename A> class Parser;
+ template <typename A> class Atom;
+-template <typename A> class Section;
++template <typename A> class MRFSection;
+ template <typename A> class CFISection;
+ template <typename A> class CUSection;
+
+@@ -102,14 +102,14 @@
+ const uint8_t* fileContent() { return _fileContent; }
+ private:
+ friend class Atom<A>;
+- friend class Section<A>;
++ friend class MRFSection<A>;
+ friend class Parser<A>;
+ friend class CFISection<A>::OAS;
+
+ typedef typename A::P P;
+
+ const uint8_t* _fileContent;
+- Section<A>** _sectionsArray;
++ MRFSection<A>** _sectionsArray;
+ uint8_t* _atomsArray;
+ uint8_t* _aliasAtomsArray;
+ uint32_t _sectionsArrayCount;
+@@ -134,14 +134,14 @@
+
+
+ template <typename A>
+-class Section : public ld::Section
++class MRFSection : public ld::Section
+ {
+ public:
+ typedef typename A::P::uint_t pint_t;
+ typedef typename A::P P;
+ typedef typename A::P::E E;
+
+- virtual ~Section() { }
++ virtual ~MRFSection() { }
+ class File<A>& file() const { return _file; }
+ const macho_section<P>* machoSection() const { return _machOSection; }
+ uint32_t sectionNum(class Parser<A>&) const;
+@@ -165,10 +165,10 @@
+ static const char* makeSectionName(const macho_section<typename A::P>* s);
+
+ protected:
+- Section(File<A>& f, const macho_section<typename A::P>* s)
++ MRFSection(File<A>& f, const macho_section<typename A::P>* s)
+ : ld::Section(makeSegmentName(s), makeSectionName(s), sectionType(s)),
+ _file(f), _machOSection(s), _beginAtoms(NULL), _endAtoms(NULL), _hasAliases(false) { }
+- Section(File<A>& f, const char* segName, const char* sectName, ld::Section::Type t, bool hidden=false)
++ MRFSection(File<A>& f, const char* segName, const char* sectName, ld::Section::Type t, bool hidden=false)
+ : ld::Section(segName, sectName, t, hidden), _file(f), _machOSection(NULL),
+ _beginAtoms(NULL), _endAtoms(NULL), _hasAliases(false) { }
+
+@@ -192,11 +192,11 @@
+
+
+ template <typename A>
+-class CFISection : public Section<A>
++class CFISection : public MRFSection<A>
+ {
+ public:
+ CFISection(Parser<A>& parser, File<A>& f, const macho_section<typename A::P>* s)
+- : Section<A>(f, s) { }
++ : MRFSection<A>(f, s) { }
+ uint32_t cfiCount(Parser<A>& parser);
+
+ virtual ld::Atom::ContentType contentType() { return ld::Atom::typeCFI; }
+@@ -256,11 +256,11 @@
+
+
+ template <typename A>
+-class CUSection : public Section<A>
++class CUSection : public MRFSection<A>
+ {
+ public:
+ CUSection(Parser<A>& parser, File<A>& f, const macho_section<typename A::P>* s)
+- : Section<A>(f, s) { }
++ : MRFSection<A>(f, s) { }
+
+ typedef typename A::P::uint_t pint_t;
+ typedef typename A::P P;
+@@ -297,11 +297,11 @@
+
+
+ template <typename A>
+-class TentativeDefinitionSection : public Section<A>
++class TentativeDefinitionSection : public MRFSection<A>
+ {
+ public:
+ TentativeDefinitionSection(Parser<A>& parser, File<A>& f)
+- : Section<A>(f, "__DATA", "__comm/tent", ld::Section::typeTentativeDefs) {}
++ : MRFSection<A>(f, "__DATA", "__comm/tent", ld::Section::typeTentativeDefs) {}
+
+ virtual ld::Atom::ContentType contentType() { return ld::Atom::typeZeroFill; }
+ virtual bool addFollowOnFixups() const { return false; }
+@@ -319,11 +319,11 @@
+
+
+ template <typename A>
+-class AbsoluteSymbolSection : public Section<A>
++class AbsoluteSymbolSection : public MRFSection<A>
+ {
+ public:
+ AbsoluteSymbolSection(Parser<A>& parser, File<A>& f)
+- : Section<A>(f, "__DATA", "__abs", ld::Section::typeAbsoluteSymbols, true) {}
++ : MRFSection<A>(f, "__DATA", "__abs", ld::Section::typeAbsoluteSymbols, true) {}
+
+ virtual ld::Atom::ContentType contentType() { return ld::Atom::typeUnclassified; }
+ virtual bool dontDeadStrip() { return false; }
+@@ -345,7 +345,7 @@
+
+
+ template <typename A>
+-class SymboledSection : public Section<A>
++class SymboledSection : public MRFSection<A>
+ {
+ public:
+ SymboledSection(Parser<A>& parser, File<A>& f, const macho_section<typename A::P>* s);
+@@ -377,11 +377,11 @@
+
+
+ template <typename A>
+-class ImplicitSizeSection : public Section<A>
++class ImplicitSizeSection : public MRFSection<A>
+ {
+ public:
+ ImplicitSizeSection(Parser<A>& parser, File<A>& f, const macho_section<typename A::P>* s)
+- : Section<A>(f, s) { }
++ : MRFSection<A>(f, s) { }
+ virtual uint32_t computeAtomCount(class Parser<A>& parser, struct Parser<A>::LabelAndCFIBreakIterator& it, const struct Parser<A>::CFI_CU_InfoArrays&);
+ virtual uint32_t appendAtoms(class Parser<A>& parser, uint8_t* buffer, struct Parser<A>::LabelAndCFIBreakIterator& it, const struct Parser<A>::CFI_CU_InfoArrays&);
+ protected:
+@@ -715,8 +715,8 @@
+
+ public:
+ // methods for all atoms from mach-o object file
+- Section<A>& sect() const { return (Section<A>&)section(); }
+- File<A>& machofile() const { return ((Section<A>*)(this->_section))->file(); }
++ MRFSection<A>& sect() const { return (MRFSection<A>&)section(); }
++ File<A>& machofile() const { return ((MRFSection<A>*)(this->_section))->file(); }
+ void setFixupsRange(uint32_t s, uint32_t c);
+ void setUnwindInfoRange(uint32_t s, uint32_t c);
+ void extendUnwindInfoRange();
+@@ -733,7 +733,7 @@
+ typedef typename A::P::E E;
+ typedef typename A::P::uint_t pint_t;
+ // constuct via all attributes
+- Atom(Section<A>& sct, const char* nm, pint_t addr, uint64_t sz,
++ Atom(MRFSection<A>& sct, const char* nm, pint_t addr, uint64_t sz,
+ ld::Atom::Definition d, ld::Atom::Combine c, ld::Atom::Scope s,
+ ld::Atom::ContentType ct, ld::Atom::SymbolTableInclusion i,
+ bool dds, bool thumb, bool al, ld::Atom::Alignment a)
+@@ -743,7 +743,7 @@
+ _unwindInfoStartIndex(0), _fixupsCount(0),
+ _lineInfoCount(0), _unwindInfoCount(0) { }
+ // construct via symbol table entry
+- Atom(Section<A>& sct, Parser<A>& parser, const macho_nlist<P>& sym,
++ Atom(MRFSection<A>& sct, Parser<A>& parser, const macho_nlist<P>& sym,
+ uint64_t sz, bool alias=false)
+ : ld::Atom((ld::Section&)sct, parser.definitionFromSymbol(sym),
+ parser.combineFromSymbol(sym), parser.scopeFromSymbol(sym),
+@@ -766,7 +766,7 @@
+
+ private:
+ friend class Parser<A>;
+- friend class Section<A>;
++ friend class MRFSection<A>;
+ friend class CStringSection<A>;
+ friend class AbsoluteSymbolSection<A>;
+
+@@ -1031,8 +1031,8 @@
+ uint32_t undefinedStartIndex() { return _undefinedStartIndex; }
+ uint32_t undefinedEndIndex() { return _undefinedEndIndex; }
+ void addFixup(FixupInAtom f) { _allFixups.push_back(f); }
+- Section<A>* sectionForNum(unsigned int sectNum);
+- Section<A>* sectionForAddress(pint_t addr);
++ MRFSection<A>* sectionForNum(unsigned int sectNum);
++ MRFSection<A>* sectionForAddress(pint_t addr);
+ Atom<A>* findAtomByAddress(pint_t addr);
+ Atom<A>* findAtomByAddressOrNullIfStub(pint_t addr);
+ Atom<A>* findAtomByAddressOrLocalTargetOfStub(pint_t addr, uint32_t* offsetInAtom);
+@@ -1074,7 +1074,7 @@
+ : sortedSymbolIndexes(ssa), sortedSymbolCount(ssc), cfiStartsArray(cfisa),
+ cfiStartsCount(cfisc), fileHasOverlappingSymbols(ols),
+ newSection(false), cfiIndex(0), symIndex(0) {}
+- bool next(Parser<A>& parser, const Section<A>& sect, uint32_t sectNum, pint_t startAddr, pint_t endAddr,
++ bool next(Parser<A>& parser, const MRFSection<A>& sect, uint32_t sectNum, pint_t startAddr, pint_t endAddr,
+ pint_t* addr, pint_t* size, const macho_nlist<P>** sym);
+ pint_t peek(Parser<A>& parser, pint_t startAddr, pint_t endAddr);
+ void beginSection() { newSection = true; symIndex = 0; }
+@@ -1103,7 +1103,7 @@
+
+
+ private:
+- friend class Section<A>;
++ friend class MRFSection<A>;
+
+ enum SectionType { sectionTypeIgnore, sectionTypeLiteral4, sectionTypeLiteral8, sectionTypeLiteral16,
+ sectionTypeNonLazy, sectionTypeCFI, sectionTypeCString, sectionTypeCStringPointer,
+@@ -1448,7 +1448,7 @@
+ // was becuase of a label, the symbol). Returns false when no more chunks.
+ //
+ template <typename A>
+-bool Parser<A>::LabelAndCFIBreakIterator::next(Parser<A>& parser, const Section<A>& sect, uint32_t sectNum, pint_t startAddr, pint_t endAddr,
++bool Parser<A>::LabelAndCFIBreakIterator::next(Parser<A>& parser, const MRFSection<A>& sect, uint32_t sectNum, pint_t startAddr, pint_t endAddr,
+ pint_t* addr, pint_t* size, const macho_nlist<P>** symbol)
+ {
+ // may not be a label on start of section, but need atom demarcation there
+@@ -1600,7 +1600,7 @@
+ }
+
+ template <>
+-typename arm::P::uint_t Parser<arm>::realAddr(typename arm::P::uint_t addr)
++arm::P::uint_t Parser<arm>::realAddr(arm::P::uint_t addr)
+ {
+ return addr & (-2);
+ }
+@@ -1646,7 +1646,7 @@
+ uint32_t sortedSymbolIndexes[_symbolsInSections];
+ this->makeSortedSymbolsArray(sortedSymbolIndexes, sortedSectionIndexes);
+
+- // allocate Section<A> object for each mach-o section
++ // allocate MRFSection<A> object for each mach-o section
+ makeSections();
+
+ // if it exists, do special early parsing of __compact_unwind section
+@@ -1743,7 +1743,7 @@
+ #endif
+ }
+
+- Section<A>** sections = _file->_sectionsArray;
++ MRFSection<A>** sections = _file->_sectionsArray;
+ uint32_t sectionsCount = _file->_sectionsArrayCount;
+
+ // figure out how many atoms will be allocated and allocate
+@@ -2306,11 +2306,11 @@
+ _file->_swiftVersion = ((flags >> 8) & 0xFF);
+ if ( sect->size() > 8 ) {
+ warning("section %s/%s has unexpectedly large size %llu in %s",
+- sect->segname(), Section<A>::makeSectionName(sect), sect->size(), _file->path());
++ sect->segname(), MRFSection<A>::makeSectionName(sect), sect->size(), _file->path());
+ }
+ }
+ else {
+- warning("can't parse %s/%s section in %s", sect->segname(), Section<A>::makeSectionName(sect), _file->path());
++ warning("can't parse %s/%s section in %s", sect->segname(), MRFSection<A>::makeSectionName(sect), _file->path());
+ }
+ continue;
+ }
+@@ -2406,24 +2406,24 @@
+ // sort by address (mach-o object files don't aways have sections sorted)
+ ::qsort(machOSects, count, sizeof(MachOSectionAndSectionClass<P>), MachOSectionAndSectionClass<P>::sorter);
+
+- // we will synthesize a dummy Section<A> object for tentative definitions
++ // we will synthesize a dummy MRFSection<A> object for tentative definitions
+ if ( _tentativeDefinitionCount > 0 ) {
+ totalSectionsSize += sizeof(TentativeDefinitionSection<A>);
+ machOSects[count++].type = sectionTypeTentativeDefinitions;
+ }
+
+- // we will synthesize a dummy Section<A> object for Absolute symbols
++ // we will synthesize a dummy MRFSection<A> object for Absolute symbols
+ if ( _absoluteSymbolCount > 0 ) {
+ totalSectionsSize += sizeof(AbsoluteSymbolSection<A>);
+ machOSects[count++].type = sectionTypeAbsoluteSymbols;
+ }
+
+ // allocate one block for all Section objects as well as pointers to each
+- uint8_t* space = new uint8_t[totalSectionsSize+count*sizeof(Section<A>*)];
+- _file->_sectionsArray = (Section<A>**)space;
++ uint8_t* space = new uint8_t[totalSectionsSize+count*sizeof(MRFSection<A>*)];
++ _file->_sectionsArray = (MRFSection<A>**)space;
+ _file->_sectionsArrayCount = count;
+- Section<A>** objects = _file->_sectionsArray;
+- space += count*sizeof(Section<A>*);
++ MRFSection<A>** objects = _file->_sectionsArray;
++ space += count*sizeof(MRFSection<A>*);
+ for (uint32_t i=0; i < count; ++i) {
+ switch ( machOSects[i].type ) {
+ case sectionTypeIgnore:
+@@ -2511,7 +2511,7 @@
+
+
+ template <typename A>
+-Section<A>* Parser<A>::sectionForAddress(typename A::P::uint_t addr)
++MRFSection<A>* Parser<A>::sectionForAddress(typename A::P::uint_t addr)
+ {
+ for (uint32_t i=0; i < _file->_sectionsArrayCount; ++i ) {
+ const macho_section<typename A::P>* sect = _file->_sectionsArray[i]->machoSection();
+@@ -2538,7 +2538,7 @@
+ }
+
+ template <typename A>
+-Section<A>* Parser<A>::sectionForNum(unsigned int num)
++MRFSection<A>* Parser<A>::sectionForNum(unsigned int num)
+ {
+ for (uint32_t i=0; i < _file->_sectionsArrayCount; ++i ) {
+ const macho_section<typename A::P>* sect = _file->_sectionsArray[i]->machoSection();
+@@ -2554,7 +2554,7 @@
+ template <typename A>
+ Atom<A>* Parser<A>::findAtomByAddress(pint_t addr)
+ {
+- Section<A>* section = this->sectionForAddress(addr);
++ MRFSection<A>* section = this->sectionForAddress(addr);
+ return section->findAtomByAddress(addr);
+ }
+
+@@ -2611,7 +2611,7 @@
+ target.addend = 0;
+ return;
+ }
+- Section<A>* section = this->sectionForAddress(addr);
++ MRFSection<A>* section = this->sectionForAddress(addr);
+ target.atom = section->findAtomByAddress(addr);
+ target.addend = addr - target.atom->_objAddress;
+ target.weakImport = false;
+@@ -2659,7 +2659,7 @@
+ }
+ return;
+ }
+- Section<A>* section = this->sectionForNum(sectNum);
++ MRFSection<A>* section = this->sectionForNum(sectNum);
+ target.atom = section->findAtomByAddress(addr);
+ if ( target.atom == NULL ) {
+ typedef typename A::P::sint_t sint_t;
+@@ -3867,7 +3867,7 @@
+ }
+
+ template <typename A>
+-const char* Section<A>::makeSegmentName(const macho_section<typename A::P>* sect)
++const char* MRFSection<A>::makeSegmentName(const macho_section<typename A::P>* sect)
+ {
+ // mach-o section record only has room for 16-byte seg/sect names
+ // so a 16-byte name has no trailing zero
+@@ -3880,7 +3880,7 @@
+ }
+
+ template <typename A>
+-const char* Section<A>::makeSectionName(const macho_section<typename A::P>* sect)
++const char* MRFSection<A>::makeSectionName(const macho_section<typename A::P>* sect)
+ {
+ const char* name = sect->sectname();
+ if ( strlen(name) < 16 )
+@@ -3914,13 +3914,13 @@
+ }
+
+ template <typename A>
+-bool Section<A>::readable(const macho_section<typename A::P>* sect)
++bool MRFSection<A>::readable(const macho_section<typename A::P>* sect)
+ {
+ return true;
+ }
+
+ template <typename A>
+-bool Section<A>::writable(const macho_section<typename A::P>* sect)
++bool MRFSection<A>::writable(const macho_section<typename A::P>* sect)
+ {
+ // mach-o .o files do not contain segment permissions
+ // we just know TEXT is special
+@@ -3928,7 +3928,7 @@
+ }
+
+ template <typename A>
+-bool Section<A>::exectuable(const macho_section<typename A::P>* sect)
++bool MRFSection<A>::exectuable(const macho_section<typename A::P>* sect)
+ {
+ // mach-o .o files do not contain segment permissions
+ // we just know TEXT is special
+@@ -3937,7 +3937,7 @@
+
+
+ template <typename A>
+-ld::Section::Type Section<A>::sectionType(const macho_section<typename A::P>* sect)
++ld::Section::Type MRFSection<A>::sectionType(const macho_section<typename A::P>* sect)
+ {
+ switch ( sect->flags() & SECTION_TYPE ) {
+ case S_ZEROFILL:
+@@ -4015,7 +4015,7 @@
+
+
+ template <typename A>
+-Atom<A>* Section<A>::findContentAtomByAddress(pint_t addr, class Atom<A>* start, class Atom<A>* end)
++Atom<A>* MRFSection<A>::findContentAtomByAddress(pint_t addr, class Atom<A>* start, class Atom<A>* end)
+ {
+ // do a binary search of atom array
+ uint32_t atomCount = end - start;
+@@ -4047,7 +4047,7 @@
+ }
+
+ template <typename A>
+-ld::Atom::Alignment Section<A>::alignmentForAddress(pint_t addr)
++ld::Atom::Alignment MRFSection<A>::alignmentForAddress(pint_t addr)
+ {
+ const uint32_t sectionAlignment = this->_machOSection->align();
+ uint32_t modulus = (addr % (1 << sectionAlignment));
+@@ -4057,7 +4057,7 @@
+ }
+
+ template <typename A>
+-uint32_t Section<A>::sectionNum(class Parser<A>& parser) const
++uint32_t MRFSection<A>::sectionNum(class Parser<A>& parser) const
+ {
+ if ( _machOSection == NULL )
+ return 0;
+@@ -4650,7 +4650,7 @@
+ // support __LD, __compact_unwind personality entries which are pointer to personality non-lazy pointer
+ const pint_t* content = (pint_t*)(this->file().fileContent() + this->_machOSection->offset() + reloc->r_address());
+ pint_t nlPointerAddr = *content;
+- Section<x86>* nlSection = parser.sectionForAddress(nlPointerAddr);
++ MRFSection<x86>* nlSection = parser.sectionForAddress(nlPointerAddr);
+ if ( nlSection->type() == ld::Section::typeCode ) {
+ // personality function is defined in this .o file, so this is a direct reference to it
+ // atoms may not be constructed yet, so scan symbol table for labels
+@@ -4677,7 +4677,7 @@
+ else {
+ const pint_t* content = (pint_t*)(this->file().fileContent() + this->_machOSection->offset() + reloc->r_address());
+ pint_t personalityAddr = *content;
+- Section<arm64>* personalitySection = parser.sectionForAddress(personalityAddr);
++ MRFSection<arm64>* personalitySection = parser.sectionForAddress(personalityAddr);
+ assert((personalitySection->type() == ld::Section::typeCode) && "personality column in __compact_unwind section is not pointer to function");
+ // atoms may not be constructed yet, so scan symbol table for labels
+ const char* name = parser.scanSymbolTableForAddress(personalityAddr);
+@@ -4831,7 +4831,7 @@
+
+ template <typename A>
+ SymboledSection<A>::SymboledSection(Parser<A>& parser, File<A>& f, const macho_section<typename A::P>* s)
+- : Section<A>(f, s), _type(ld::Atom::typeUnclassified)
++ : MRFSection<A>(f, s), _type(ld::Atom::typeUnclassified)
+ {
+ switch ( s->flags() & SECTION_TYPE ) {
+ case S_ZEROFILL:
+@@ -4877,7 +4877,7 @@
+ if ( ! this->_file.canScatterAtoms() )
+ return true;
+ // call inherited
+- return Section<A>::dontDeadStrip();
++ return MRFSection<A>::dontDeadStrip();
+ }
+ return false;
+ }
+@@ -5724,7 +5724,7 @@
+
+
+ template <>
+-uint32_t Section<x86_64>::x86_64PcRelOffset(uint8_t r_type)
++uint32_t MRFSection<x86_64>::x86_64PcRelOffset(uint8_t r_type)
+ {
+ switch ( r_type ) {
+ case X86_64_RELOC_SIGNED:
+@@ -5741,7 +5741,7 @@
+
+
+ template <>
+-bool Section<x86_64>::addRelocFixup(class Parser<x86_64>& parser, const macho_relocation_info<P>* reloc)
++bool MRFSection<x86_64>::addRelocFixup(class Parser<x86_64>& parser, const macho_relocation_info<P>* reloc)
+ {
+ const macho_section<P>* sect = this->machoSection();
+ uint64_t srcAddr = sect->addr() + reloc->r_address();
+@@ -5948,7 +5948,7 @@
+
+
+ template <>
+-bool Section<x86>::addRelocFixup(class Parser<x86>& parser, const macho_relocation_info<P>* reloc)
++bool MRFSection<x86>::addRelocFixup(class Parser<x86>& parser, const macho_relocation_info<P>* reloc)
+ {
+ const macho_section<P>* sect = this->machoSection();
+ uint32_t srcAddr;
+@@ -6189,7 +6189,7 @@
+
+ #if SUPPORT_ARCH_arm_any
+ template <>
+-bool Section<arm>::addRelocFixup(class Parser<arm>& parser, const macho_relocation_info<P>* reloc)
++bool MRFSection<arm>::addRelocFixup(class Parser<arm>& parser, const macho_relocation_info<P>* reloc)
+ {
+ const macho_section<P>* sect = this->machoSection();
+ bool result = false;
+@@ -6656,7 +6656,7 @@
+
+ #if SUPPORT_ARCH_arm64
+ template <>
+-bool Section<arm64>::addRelocFixup(class Parser<arm64>& parser, const macho_relocation_info<P>* reloc)
++bool MRFSection<arm64>::addRelocFixup(class Parser<arm64>& parser, const macho_relocation_info<P>* reloc)
+ {
+ bool result = false;
+ Parser<arm64>::SourceLocation src;
+@@ -7054,7 +7054,7 @@
+
+ #if SUPPORT_ARCH_arm64
+ template <>
+-void Section<arm64>::addLOH(class Parser<arm64>& parser, int kind, int count, const uint64_t addrs[]) {
++void MRFSection<arm64>::addLOH(class Parser<arm64>& parser, int kind, int count, const uint64_t addrs[]) {
+ switch (kind) {
+ case LOH_ARM64_ADRP_ADRP:
+ case LOH_ARM64_ADRP_LDR:
+@@ -7109,18 +7109,18 @@
+ extra.info.delta2 = (count > 1) ? ((addrs[1] - lowestAddress) >> 2) : 0;
+ extra.info.delta3 = (count > 2) ? ((addrs[2] - lowestAddress) >> 2) : 0;
+ extra.info.delta4 = (count > 3) ? ((addrs[3] - lowestAddress) >> 2) : 0;
+- typename Parser<arm64>::SourceLocation src(inAtom, lowestAddress- inAtom->objectAddress());
++ Parser<arm64>::SourceLocation src(inAtom, lowestAddress- inAtom->objectAddress());
+ parser.addFixup(src, ld::Fixup::k1of1, ld::Fixup::kindLinkerOptimizationHint, extra.addend);
+ }
+ #endif
+
+ template <typename A>
+-void Section<A>::addLOH(class Parser<A>& parser, int kind, int count, const uint64_t addrs[]) {
++void MRFSection<A>::addLOH(class Parser<A>& parser, int kind, int count, const uint64_t addrs[]) {
+
+ }
+
+ template <typename A>
+-void Section<A>::makeFixups(class Parser<A>& parser, const struct Parser<A>::CFI_CU_InfoArrays&)
++void MRFSection<A>::makeFixups(class Parser<A>& parser, const struct Parser<A>::CFI_CU_InfoArrays&)
+ {
+ const macho_section<P>* sect = this->machoSection();
+ const macho_relocation_info<P>* relocs = (macho_relocation_info<P>*)(file().fileContent() + sect->reloff());
+@@ -7131,7 +7131,7 @@
+ ++r; // skip next
+ }
+ catch (const char* msg) {
+- throwf("in section %s,%s reloc %u: %s", sect->segname(), Section<A>::makeSectionName(sect), r, msg);
++ throwf("in section %s,%s reloc %u: %s", sect->segname(), MRFSection<A>::makeSectionName(sect), r, msg);
+ }
+ }
+
+@@ -7157,7 +7157,7 @@
+ }
+ if ( !this->_altEntries.empty() && !this->addFollowOnFixups() ) {
+ if ( _altEntries.count(_beginAtoms) != 0 )
+- warning("N_ALT_ENTRY bit set on first atom in section %s/%s", sect->segname(), Section<A>::makeSectionName(sect));
++ warning("N_ALT_ENTRY bit set on first atom in section %s/%s", sect->segname(), MRFSection<A>::makeSectionName(sect));
+
+ Atom<A>* end = &_endAtoms[-1];
+ for(Atom<A>* p = _beginAtoms; p < end; ++p) {
+--- ./ld64-241.9/src/ld/passes/dtrace_dof.cpp.gcc 2014-09-11 00:24:46.000000000 +0200
++++ ./ld64-241.9/src/ld/passes/dtrace_dof.cpp 2015-01-12 22:12:18.000000000 +0100
+@@ -30,8 +30,17 @@
+
+ #include <vector>
+ #include <map>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_map>
++#include <tr1/unordered_set>
++#define UNORDERED_MAP tr1::unordered_map
++#define UNORDERED_SET tr1::unordered_set
++#else
+ #include <unordered_map>
+ #include <unordered_set>
++#define UNORDERED_MAP unordered_map
++#define UNORDERED_SET unordered_set
++#endif
+
+ #include "ld.hpp"
+ #include "MachOFileAbstraction.hpp"
+@@ -111,8 +120,8 @@
+ uint32_t offset;
+ const char* probeName;
+ };
+-typedef std::unordered_map<const char*, std::vector<DTraceProbeInfo>, CStringHash, CStringEquals> ProviderToProbes;
+-typedef std::unordered_set<const char*, CStringHash, CStringEquals> CStringSet;
++typedef std::UNORDERED_MAP<const char*, std::vector<DTraceProbeInfo>, CStringHash, CStringEquals> ProviderToProbes;
++typedef std::UNORDERED_SET<const char*, CStringHash, CStringEquals> CStringSet;
+
+
+
+--- ./ld64-241.9/src/ld/passes/order.cpp.gcc 2014-09-11 00:24:46.000000000 +0200
++++ ./ld64-241.9/src/ld/passes/order.cpp 2015-01-12 22:12:18.000000000 +0100
+@@ -32,7 +32,13 @@
+ #include <vector>
+ #include <map>
+ #include <set>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_map>
++#define UNORDERED_MAP tr1::unordered_map
++#else
+ #include <unordered_map>
++#define UNORDERED_MAP unordered_map
++#endif
+
+ #include "ld.hpp"
+ #include "order.h"
+@@ -85,7 +91,7 @@
+ ld::Internal& _state;
+ };
+
+- typedef std::unordered_map<const char*, const ld::Atom*, CStringHash, CStringEquals> NameToAtom;
++ typedef std::UNORDERED_MAP<const char*, const ld::Atom*, CStringHash, CStringEquals> NameToAtom;
+
+ typedef std::map<const ld::Atom*, const ld::Atom*> AtomToAtom;
+
+--- ./ld64-241.9/src/ld/Resolver.h.gcc 2014-09-11 00:24:46.000000000 +0200
++++ ./ld64-241.9/src/ld/Resolver.h 2015-01-12 22:12:18.000000000 +0100
+@@ -42,7 +42,13 @@
+ #include <mach-o/dyld.h>
+
+ #include <vector>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_set>
++#define UNORDERED_SET tr1::unordered_set
++#else
+ #include <unordered_set>
++#define UNORDERED_SET unordered_set
++#endif
+
+ #include "Options.h"
+ #include "ld.hpp"
+@@ -105,7 +111,7 @@
+ void doLinkerOption(const std::vector<const char*>& linkerOption, const char* fileName);
+ void dumpAtoms();
+
+- typedef std::unordered_set<const char*, CStringHash, CStringEquals> StringSet;
++ typedef std::UNORDERED_SET<const char*, CStringHash, CStringEquals> StringSet;
+
+ class NotLive {
+ public:
+--- ./ld64-241.9/src/ld/SymbolTable.h.gcc 2014-09-11 00:24:46.000000000 +0200
++++ ./ld64-241.9/src/ld/SymbolTable.h 2015-01-12 22:12:18.000000000 +0100
+@@ -42,7 +42,13 @@
+ #include <mach-o/dyld.h>
+
+ #include <vector>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_map>
++#define UNORDERED_MAP tr1::unordered_map
++#else
+ #include <unordered_map>
++#define UNORDERED_MAP unordered_map
++#endif
+
+ #include "Options.h"
+ #include "ld.hpp"
+@@ -57,38 +63,38 @@
+ typedef uint32_t IndirectBindingSlot;
+
+ private:
+- typedef std::unordered_map<const char*, IndirectBindingSlot, CStringHash, CStringEquals> NameToSlot;
++ typedef std::UNORDERED_MAP<const char*, IndirectBindingSlot, CStringHash, CStringEquals> NameToSlot;
+
+ class ContentFuncs {
+ public:
+ size_t operator()(const ld::Atom*) const;
+ bool operator()(const ld::Atom* left, const ld::Atom* right) const;
+ };
+- typedef std::unordered_map<const ld::Atom*, IndirectBindingSlot, ContentFuncs, ContentFuncs> ContentToSlot;
++ typedef std::UNORDERED_MAP<const ld::Atom*, IndirectBindingSlot, ContentFuncs, ContentFuncs> ContentToSlot;
+
+ class ReferencesHashFuncs {
+ public:
+ size_t operator()(const ld::Atom*) const;
+ bool operator()(const ld::Atom* left, const ld::Atom* right) const;
+ };
+- typedef std::unordered_map<const ld::Atom*, IndirectBindingSlot, ReferencesHashFuncs, ReferencesHashFuncs> ReferencesToSlot;
++ typedef std::UNORDERED_MAP<const ld::Atom*, IndirectBindingSlot, ReferencesHashFuncs, ReferencesHashFuncs> ReferencesToSlot;
+
+ class CStringHashFuncs {
+ public:
+ size_t operator()(const ld::Atom*) const;
+ bool operator()(const ld::Atom* left, const ld::Atom* right) const;
+ };
+- typedef std::unordered_map<const ld::Atom*, IndirectBindingSlot, CStringHashFuncs, CStringHashFuncs> CStringToSlot;
++ typedef std::UNORDERED_MAP<const ld::Atom*, IndirectBindingSlot, CStringHashFuncs, CStringHashFuncs> CStringToSlot;
+
+ class UTF16StringHashFuncs {
+ public:
+ size_t operator()(const ld::Atom*) const;
+ bool operator()(const ld::Atom* left, const ld::Atom* right) const;
+ };
+- typedef std::unordered_map<const ld::Atom*, IndirectBindingSlot, UTF16StringHashFuncs, UTF16StringHashFuncs> UTF16StringToSlot;
++ typedef std::UNORDERED_MAP<const ld::Atom*, IndirectBindingSlot, UTF16StringHashFuncs, UTF16StringHashFuncs> UTF16StringToSlot;
+
+ typedef std::map<IndirectBindingSlot, const char*> SlotToName;
+- typedef std::unordered_map<const char*, CStringToSlot*, CStringHash, CStringEquals> NameToMap;
++ typedef std::UNORDERED_MAP<const char*, CStringToSlot*, CStringHash, CStringEquals> NameToMap;
+
+ typedef std::vector<const ld::Atom *> DuplicatedSymbolAtomList;
+ typedef std::map<const char *, DuplicatedSymbolAtomList * > DuplicateSymbols;
+--- ./ld64-241.9/src/other/dyldinfo.cpp.gcc 2014-09-11 00:24:46.000000000 +0200
++++ ./ld64-241.9/src/other/dyldinfo.cpp 2015-01-12 22:12:18.000000000 +0100
+@@ -33,7 +33,6 @@
+
+ #include <vector>
+ #include <set>
+-#include <unordered_set>
+
+ #include "configure.h"
+ #include "MachOFileAbstraction.hpp"
+--- ./ld64-241.9/src/other/machochecker.cpp.gcc 2014-09-11 00:24:46.000000000 +0200
++++ ./ld64-241.9/src/other/machochecker.cpp 2015-01-12 22:12:18.000000000 +0100
+@@ -33,7 +33,13 @@
+
+ #include <vector>
+ #include <set>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_set>
++#define UNORDERED_SET tr1::unordered_set
++#else
+ #include <unordered_set>
++#define UNORDERED_SET unordered_set
++#endif
+
+ #include "configure.h"
+
+@@ -124,7 +130,7 @@
+ bool operator()(const char* left, const char* right) const { return (strcmp(left, right) == 0); }
+ };
+
+- typedef std::unordered_set<const char*, CStringHash, CStringEquals> StringSet;
++ typedef std::UNORDERED_SET<const char*, CStringHash, CStringEquals> StringSet;
+
+ MachOChecker(const uint8_t* fileContent, uint32_t fileLength, const char* path);
+ void checkMachHeader();
+--- ./ld64-241.9/src/other/unwinddump.cpp.gcc 2014-11-04 00:56:18.000000000 +0100
++++ ./ld64-241.9/src/other/unwinddump.cpp 2015-01-12 22:12:18.000000000 +0100
+@@ -33,7 +33,6 @@
+
+ #include <vector>
+ #include <set>
+-#include <unordered_set>
+
+ #include "configure.h"
+ #include "MachOFileAbstraction.hpp"
diff --git a/sys-devel/binutils-apple/files/ld64-241.9-get-comm-align.patch b/sys-devel/binutils-apple/files/ld64-241.9-get-comm-align.patch
new file mode 100644
index 000000000000..58579f007de7
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-241.9-get-comm-align.patch
@@ -0,0 +1,30 @@
+Provide macros [GS]ET_COMM_ALIGN if it's missing (<= 10.4).
+
+--- ld64-241.9/src/ld/parsers/macho_relocatable_file.cpp 2015-01-22 22:23:11.000000000 +0100
++++ ld64-241.9/src/ld/parsers/macho_relocatable_file.cpp 2015-01-22 22:28:03.000000000 +0100
+@@ -51,6 +51,10 @@
+ #include "macho_relocatable_file.h"
+
+
++/* missing on < 10.5 */
++#if !defined(GET_COMM_ALIGN)
++#define GET_COMM_ALIGN(n_desc) (((n_desc) >> 8) & 0x0f)
++#endif
+
+ extern void throwf(const char* format, ...) __attribute__ ((noreturn,format(printf, 1, 2)));
+ extern void warning(const char* format, ...) __attribute__((format(printf, 1, 2)));
+--- Gentoo/tmp/var/tmp/portage/sys-devel/binutils-apple-6.1/work/ld64-241.9/src/ld/LinkEditClassic.hpp 2015-01-22 22:29:14.000000000 +0100
++++ ld64-241.9/src/ld/LinkEditClassic.hpp 2015-01-22 22:31:23.000000000 +0100
+@@ -39,6 +39,12 @@
+ #define UNORDERED_MAP unordered_map
+ #endif
+
++#if !defined(SET_COMM_ALIGN)
++/* missing on < 10.5 */
++#define SET_COMM_ALIGN(n_desc,align) \
++ (n_desc) = (((n_desc) & 0xf0ff) | (((align) & 0x0f) << 8))
++#endif
++
+ #include "Options.h"
+ #include "ld.hpp"
+ #include "Architectures.hpp"
diff --git a/sys-devel/binutils-apple/files/ld64-241.9-lto-noremarks.patch b/sys-devel/binutils-apple/files/ld64-241.9-lto-noremarks.patch
new file mode 100644
index 000000000000..d4667ab63b8c
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-241.9-lto-noremarks.patch
@@ -0,0 +1,107 @@
+Shut up ld64 by default when using LTO.
+
+diff -ru ld64-241.9.orig/src/ld/Options.cpp ld64-241.9/src/ld/Options.cpp
+--- ld64-241.9.orig/src/ld/Options.cpp 2015-02-02 22:14:29.000000000 +0100
++++ ld64-241.9/src/ld/Options.cpp 2015-02-02 22:15:41.000000000 +0100
+@@ -183,6 +183,9 @@
+ fDebugInfoStripping(kDebugInfoMinimal), fTraceOutputFile(NULL),
+ fMacVersionMin(ld::macVersionUnset), fIOSVersionMin(ld::iOSVersionUnset),
+ fSaveTempFiles(false),
++#ifdef LTO
++ fVerboseLTORemarks(false),
++#endif
+ #ifdef SUPPORT_SNAPSHOTS
+ fSnapshotRequested(false),
+ #endif
+@@ -3138,6 +3141,11 @@
+ else if ( strcmp(arg, "-ignore_optimization_hints") == 0 ) {
+ fIgnoreOptimizationHints = true;
+ }
++#ifdef LTO
++ else if ( strcmp(arg, "-verbose_lto_remarks") == 0 ) {
++ fVerboseLTORemarks = true;
++ }
++#endif
+ else if ( strcmp(arg, "-no_dtrace_dof") == 0 ) {
+ fGenerateDtraceDOF = false;
+ }
+Only in ld64-241.9/src/ld: Options.cpp~
+diff -ru ld64-241.9.orig/src/ld/Options.h ld64-241.9/src/ld/Options.h
+--- ld64-241.9.orig/src/ld/Options.h 2015-02-02 22:14:29.000000000 +0100
++++ ld64-241.9/src/ld/Options.h 2015-02-02 22:16:36.000000000 +0100
+@@ -381,6 +381,9 @@
+ bool forceWeakNonWildCard(const char* symbolName) const;
+ bool forceNotWeakNonWildcard(const char* symbolName) const;
+ bool forceCoalesce(const char* symbolName) const;
++#ifdef LTO
++ bool verboseLTORemarks() const { return fVerboseLTORemarks; }
++#endif
+ #ifdef SUPPORT_SNAPSHOTS
+ Snapshot& snapshot() const { return fLinkSnapshot; }
+ #endif
+@@ -681,6 +684,9 @@
+ std::vector<SymbolsMove> fSymbolsMovesCode;
+ std::vector<SymbolsMove> fSymbolsMovesZeroFill;
+ bool fSaveTempFiles;
++#ifdef LTO
++ bool fVerboseLTORemarks;
++#endif
+ #ifdef SUPPORT_SNAPSHOTS
+ mutable Snapshot fLinkSnapshot;
+ bool fSnapshotRequested;
+Only in ld64-241.9/src/ld: Options.h~
+diff -ru ld64-241.9.orig/src/ld/Resolver.cpp ld64-241.9/src/ld/Resolver.cpp
+--- ld64-241.9.orig/src/ld/Resolver.cpp 2015-02-02 22:14:29.000000000 +0100
++++ ld64-241.9/src/ld/Resolver.cpp 2015-02-02 22:17:16.000000000 +0100
+@@ -1559,6 +1559,7 @@
+ optOpt.mcpu = _options.mcpuLTO();
+ optOpt.llvmOptions = &_options.llvmOptions();
+ optOpt.initialUndefines = &_options.initialUndefines();
++ optOpt.verboseLTORemarks = _options.verboseLTORemarks();
+
+ std::vector<const ld::Atom*> newAtoms;
+ std::vector<const char*> additionalUndefines;
+Only in ld64-241.9/src/ld: Resolver.cpp~
+diff -ru ld64-241.9.orig/src/ld/parsers/lto_file.cpp ld64-241.9/src/ld/parsers/lto_file.cpp
+--- ld64-241.9.orig/src/ld/parsers/lto_file.cpp 2015-02-02 22:14:29.000000000 +0100
++++ ld64-241.9/src/ld/parsers/lto_file.cpp 2015-02-02 22:18:27.000000000 +0100
+@@ -489,13 +489,17 @@
+
+
+ #if LTO_API_VERSION >= 7
+-void Parser::ltoDiagnosticHandler(lto_codegen_diagnostic_severity_t severity, const char* message, void*)
++void Parser::ltoDiagnosticHandler(lto_codegen_diagnostic_severity_t severity, const char* message, void* data)
+ {
+ switch ( severity ) {
+ #if LTO_API_VERSION >= 10
+ case LTO_DS_REMARK:
++ {
++ const OptimizeOptions* options = (const OptimizeOptions*)data;
++ if (options->verboseLTORemarks)
+ fprintf(stderr, "ld: LTO remark: %s\n", message);
+ break;
++ }
+ #endif
+ case LTO_DS_NOTE:
+ case LTO_DS_WARNING:
+@@ -530,7 +533,7 @@
+ // create optimizer and add each Reader
+ lto_code_gen_t generator = ::lto_codegen_create();
+ #if LTO_API_VERSION >= 7
+- lto_codegen_set_diagnostic_handler(generator, ltoDiagnosticHandler, NULL);
++ lto_codegen_set_diagnostic_handler(generator, ltoDiagnosticHandler, (void*)&options);
+ #endif
+
+ // <rdar://problem/12379604> The order that files are merged must match command line order
+Only in ld64-241.9/src/ld/parsers: lto_file.cpp~
+diff -ru ld64-241.9.orig/src/ld/parsers/lto_file.h ld64-241.9/src/ld/parsers/lto_file.h
+--- ld64-241.9.orig/src/ld/parsers/lto_file.h 2015-02-02 22:14:29.000000000 +0100
++++ ld64-241.9/src/ld/parsers/lto_file.h 2015-02-02 22:18:57.000000000 +0100
+@@ -61,6 +61,7 @@
+ const char* mcpu;
+ const std::vector<const char*>* llvmOptions;
+ const std::vector<const char*>* initialUndefines;
++ bool verboseLTORemarks;
+ };
+
+ extern bool optimize( const std::vector<const ld::Atom*>& allAtoms,
diff --git a/sys-devel/binutils-apple/files/ld64-241.9-noarm.patch b/sys-devel/binutils-apple/files/ld64-241.9-noarm.patch
new file mode 100644
index 000000000000..24d288467433
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-241.9-noarm.patch
@@ -0,0 +1,1288 @@
+Fully conditionalise arm support so it can be disabled on 10.4.
+
+diff -ur ld64-241.9/src/abstraction/MachOFileAbstraction.hpp ld64-241.9/src/abstraction/MachOFileAbstraction.hpp
+--- ld64-241.9/src/abstraction/MachOFileAbstraction.hpp 2014-11-04 00:30:51.000000000 +0100
++++ ld64-241.9/src/abstraction/MachOFileAbstraction.hpp 2015-01-22 05:53:13.000000000 +0100
+diff -ur ld64-241.9/src/ld/HeaderAndLoadCommands.hpp ld64-241.9/src/ld/HeaderAndLoadCommands.hpp
+--- ld64-241.9/src/ld/HeaderAndLoadCommands.hpp 2014-09-11 00:24:46.000000000 +0200
++++ ld64-241.9/src/ld/HeaderAndLoadCommands.hpp 2015-01-22 06:46:10.000000000 +0100
+@@ -607,8 +607,12 @@
+
+ template <> uint32_t HeaderAndLoadCommandsAtom<x86>::cpuType() const { return CPU_TYPE_I386; }
+ template <> uint32_t HeaderAndLoadCommandsAtom<x86_64>::cpuType() const { return CPU_TYPE_X86_64; }
++#if SUPPORT_ARCH_arm_any
+ template <> uint32_t HeaderAndLoadCommandsAtom<arm>::cpuType() const { return CPU_TYPE_ARM; }
++#endif
++#if SUPPORT_ARCH_arm64
+ template <> uint32_t HeaderAndLoadCommandsAtom<arm64>::cpuType() const { return CPU_TYPE_ARM64; }
++#endif
+
+
+
+@@ -627,17 +631,21 @@
+ return _state.cpuSubType;
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ uint32_t HeaderAndLoadCommandsAtom<arm>::cpuSubType() const
+ {
+ return _state.cpuSubType;
+ }
++#endif
+
++#if SUPPORT_ARCH_arm64
+ template <>
+ uint32_t HeaderAndLoadCommandsAtom<arm64>::cpuSubType() const
+ {
+ return CPU_SUBTYPE_ARM64_ALL;
+ }
++#endif
+
+
+
+diff -ur ld64-241.9/src/ld/LinkEdit.hpp ld64-241.9/src/ld/LinkEdit.hpp
+--- ld64-241.9/src/ld/LinkEdit.hpp 2015-01-22 20:59:47.000000000 +0100
++++ ld64-241.9/src/ld/LinkEdit.hpp 2015-01-22 05:32:47.000000000 +0100
+@@ -1595,6 +1595,7 @@
+ for (ld::Fixup::iterator fit = atom->fixupsBegin(); fit != atom->fixupsEnd(); ++fit) {
+ if ( fit->kind != ld::Fixup::kindLinkerOptimizationHint)
+ continue;
++#if SUPPORT_ARCH_arm64
+ ld::Fixup::LOH_arm64 extra;
+ extra.addend = fit->u.addend;
+ _encodedData.append_uleb128(extra.info.kind);
+@@ -1606,6 +1607,7 @@
+ _encodedData.append_uleb128((extra.info.delta3 << 2) + fit->offsetInAtom + address);
+ if ( extra.info.count > 2 )
+ _encodedData.append_uleb128((extra.info.delta4 << 2) + fit->offsetInAtom + address);
++#endif
+ }
+ }
+ }
+diff -ur ld64-241.9/src/ld/Options.cpp ld64-241.9/src/ld/Options.cpp
+--- ld64-241.9/src/ld/Options.cpp 2015-01-22 20:59:48.000000000 +0100
++++ ld64-241.9/src/ld/Options.cpp 2015-01-22 20:52:17.000000000 +0100
+@@ -580,8 +580,13 @@
+ #endif
+ }
+ break;
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
++#endif
++#if SUPPORT_ARCH_arm64
+ case CPU_TYPE_ARM64:
++#endif
++#if SUPPORT_ARCH_arm_any || SUPPORT_ARCH_arm64
+ if ( (fMacVersionMin == ld::macVersionUnset) && (fIOSVersionMin == ld::iOSVersionUnset) && (fOutputKind != Options::kObjectFile) ) {
+ #if defined(DEFAULT_IPHONEOS_MIN_VERSION)
+ warning("-ios_version_min not specified, assuming " DEFAULT_IPHONEOS_MIN_VERSION);
+@@ -592,6 +597,7 @@
+ #endif
+ }
+ break;
++#endif
+ }
+ #ifdef SUPPORT_SNAPSHOTS
+ fLinkSnapshot.recordArch(fArchitectureName);
+@@ -1683,9 +1689,11 @@
+ symbolStart = NULL;
+ }
+ else if ( strncmp(symbolStart, "arm:", 4) == 0 ) {
++#if SUPPORT_ARCH_arm_any
+ if ( fArchitecture == CPU_TYPE_ARM )
+ symbolStart = &symbolStart[4];
+ else
++#endif
+ symbolStart = NULL;
+ }
+ if ( symbolStart != NULL ) {
+@@ -3668,6 +3676,7 @@
+ #endif
+ }
+ break;
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ if ( (fOutputKind != Options::kObjectFile) && (fOutputKind != Options::kPreload) ) {
+ #if defined(DEFAULT_IPHONEOS_MIN_VERSION)
+@@ -3679,6 +3688,7 @@
+ #endif
+ }
+ break;
++#endif
+ default:
+ // architecture will be infered later by examining .o files
+ break;
+@@ -3701,12 +3711,14 @@
+ fMacVersionMin = ld::mac10_4;
+ }
+ break;
++#if SUPPORT_ARCH_arm64
+ case CPU_TYPE_ARM64:
+ if ( fIOSVersionMin < ld::iOS_7_0 ) {
+ //warning("-mios_version_min should be 7.0 or later for arm64");
+ fIOSVersionMin = ld::iOS_7_0;
+ }
+ break;
++#endif
+ }
+
+ // default to adding functions start for dynamic code, static code must opt-in
+@@ -3746,6 +3758,7 @@
+ fAllowTextRelocs = true;
+ fUndefinedTreatment = kUndefinedDynamicLookup;
+ break;
++#if SUPPORT_ARCH_arm64
+ case CPU_TYPE_ARM64:
+ // arm64 uses new MH_KEXT_BUNDLE type
+ fMakeCompressedDyldInfo = false;
+@@ -3754,6 +3767,8 @@
+ fKextsUseStubs = true;
+ fUndefinedTreatment = kUndefinedDynamicLookup;
+ break;
++#endif
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ if ( fIOSVersionMin >= ld::iOS_5_0 ) {
+ // iOS 5.0 and later use new MH_KEXT_BUNDLE type
+@@ -3765,6 +3780,7 @@
+ fUndefinedTreatment = kUndefinedDynamicLookup;
+ break;
+ }
++#endif
+ // else use object file
+ case CPU_TYPE_I386:
+ // use .o files
+@@ -3817,6 +3833,7 @@
+ if ( fSplitSegs && (fBaseWritableAddress-fBaseAddress != 0x10000000) )
+ fBaseWritableAddress = fBaseAddress + 0x10000000;
+ break;
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ if ( fOutputKind != Options::kDynamicLibrary ) {
+ fSplitSegs = false;
+@@ -3827,6 +3844,7 @@
+ fBaseWritableAddress = fBaseAddress + 0x08000000;
+ }
+ break;
++#endif
+ default:
+ fSplitSegs = false;
+ fBaseAddress = 0;
+@@ -3841,6 +3859,7 @@
+ break;
+ case CPU_TYPE_X86_64:
+ break;
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ switch ( fOutputKind ) {
+ case Options::kDynamicExecutable:
+@@ -3863,6 +3882,7 @@
+ fBaseAddress = 0;
+ }
+ break;
++#endif
+ }
+
+ // <rdar://problem/6138961> -r implies no prebinding for all architectures
+@@ -3908,6 +3928,7 @@
+ case CPU_TYPE_X86_64:
+ fPrebind = false;
+ break;
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ switch ( fOutputKind ) {
+ case Options::kDynamicExecutable:
+@@ -3925,6 +3946,7 @@
+ break;
+ }
+ break;
++#endif
+ }
+ }
+
+@@ -3951,10 +3973,12 @@
+ case CPU_TYPE_I386:
+ if ( fIOSVersionMin != ld::iOSVersionUnset ) // simulator never needs modules
+ break;
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ if ( fPrebind )
+ fNeedsModuleTable = true; // redo_prebinding requires a module table
+ break;
++#endif
+ }
+ }
+
+@@ -3993,7 +3993,9 @@
+ switch ( fArchitecture ) {
+ case CPU_TYPE_I386:
+ case CPU_TYPE_X86_64:
++#if SUPPORT_ARCH_arm64
+ case CPU_TYPE_ARM64:
++#endif
+ switch ( fOutputKind ) {
+ case Options::kObjectFile:
+ case Options::kStaticExecutable:
+@@ -4010,10 +4012,12 @@
+ break;
+ }
+ break;
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ fAddCompactUnwindEncoding = false;
+ fRemoveDwarfUnwindIfCompactExists = false;
+ break;
++#endif
+ case 0:
+ // if -arch is missing, assume we don't want compact unwind info
+ fAddCompactUnwindEncoding = false;
+@@ -4015,7 +4043,15 @@
+ fEncryptable = false;
+ break;
+ }
+- if ( (fArchitecture != CPU_TYPE_ARM) && (fArchitecture != CPU_TYPE_ARM64) )
++ if (
++#if SUPPORT_ARCH_arm_any
++ (fArchitecture != CPU_TYPE_ARM) &&
++#endif
++#if SUPPORT_ARCH_arm64
++ (fArchitecture != CPU_TYPE_ARM64) &&
++#endif
++ 1
++ )
+ fEncryptable = false;
+
+ // don't move inits in dyld because dyld wants certain
+@@ -4067,11 +4103,15 @@
+
+ // only ARM and x86_64 enforces that cpu-sub-types must match
+ switch ( fArchitecture ) {
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
++#endif
+ case CPU_TYPE_X86_64:
+ break;
+ case CPU_TYPE_I386:
++#if SUPPORT_ARCH_arm64
+ case CPU_TYPE_ARM64:
++#endif
+ fAllowCpuSubtypeMismatches = true;
+ break;
+ }
+@@ -4117,6 +4157,7 @@
+ fPositionIndependentExecutable = true;
+ }
+
++#if SUPPORT_ARCH_arm_any
+ // armv7 for iOS4.3 defaults to PIE
+ if ( (fArchitecture == CPU_TYPE_ARM)
+ && fArchSupportsThumb2
+@@ -4124,6 +4165,7 @@
+ && (fIOSVersionMin >= ld::iOS_4_3) ) {
+ fPositionIndependentExecutable = true;
+ }
++#endif
+
+ // Simulator defaults to PIE
+ if ( fTargetIOSSimulator && (fOutputKind == kDynamicExecutable) )
+@@ -4133,10 +4175,12 @@
+ if ( fDisablePositionIndependentExecutable )
+ fPositionIndependentExecutable = false;
+
++#if SUPPORT_ARCH_arm64
+ // arm64 is always PIE
+ if ( (fArchitecture == CPU_TYPE_ARM64) && (fOutputKind == kDynamicExecutable) ) {
+ fPositionIndependentExecutable = true;
+ }
++#endif
+
+ // set fOutputSlidable
+ switch ( fOutputKind ) {
+@@ -4162,9 +4206,11 @@
+ if ( fMacVersionMin >= ld::mac10_7 ) {
+ fTLVSupport = true;
+ }
++#if SUPPORT_ARCH_arm64
+ else if ( (fArchitecture == CPU_TYPE_ARM64) && (fIOSVersionMin >= ld::iOS_8_0) ) {
+ fTLVSupport = true;
+ }
++#endif
+
+ // default to adding version load command for dynamic code, static code must opt-in
+ switch ( fOutputKind ) {
+@@ -4369,9 +4415,15 @@
+ // <rdar://problem/12258065> ARM64 needs 16KB page size for user land code
+ // <rdar://problem/15974532> make armv7[s] use 16KB pages in user land code for iOS 8 or later
+ if ( fSegmentAlignment == 4096 ) {
+- if ( (fArchitecture == CPU_TYPE_ARM64)
+- || ((fArchitecture == CPU_TYPE_ARM) && (fIOSVersionMin >= ld::iOS_8_0) &&
+- ((fSubArchitecture == CPU_SUBTYPE_ARM_V7S) || (fSubArchitecture == CPU_SUBTYPE_ARM_V7))) ) {
++ if (
++#if SUPPORT_ARCH_arm64
++ (fArchitecture == CPU_TYPE_ARM64) ||
++#endif
++#if SUPPORT_ARCH_arm_any
++ ((fArchitecture == CPU_TYPE_ARM) && (fIOSVersionMin >= ld::iOS_8_0) &&
++ ((fSubArchitecture == CPU_SUBTYPE_ARM_V7S) || (fSubArchitecture == CPU_SUBTYPE_ARM_V7))) ||
++#endif
++ 0) {
+ switch ( fOutputKind ) {
+ case Options::kDynamicExecutable:
+ case Options::kDynamicLibrary:
+@@ -4488,12 +4540,16 @@
+ if ( fStackAddr != 0 ) {
+ switch (fArchitecture) {
+ case CPU_TYPE_I386:
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
++#endif
+ if ( fStackAddr > 0xFFFFFFFFULL )
+ throw "-stack_addr must be < 4G for 32-bit processes";
+ break;
+ case CPU_TYPE_X86_64:
++#if SUPPORT_ARCH_arm64
+ case CPU_TYPE_ARM64:
++#endif
+ break;
+ }
+ if ( (fStackAddr & -4096) != fStackAddr )
+@@ -4514,6 +4570,7 @@
+ if ( (fStackAddr > 0xB0000000ULL) && ((fStackAddr-fStackSize) < 0xB0000000ULL) )
+ warning("custom stack placement overlaps and will disable shared region");
+ break;
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ if ( fStackSize > 0x2F000000 )
+ throw "-stack_size must be < 752MB";
+@@ -4522,11 +4579,13 @@
+ if ( fStackAddr > 0x30000000ULL)
+ throw "-stack_addr must be < 0x30000000 for arm";
+ break;
++#endif
+ case CPU_TYPE_X86_64:
+ if ( fStackAddr == 0 ) {
+ fStackAddr = 0x00007FFF5C000000ULL;
+ }
+ break;
++#if SUPPORT_ARCH_arm64
+ case CPU_TYPE_ARM64:
+ if ( fStackSize > 0x20000000 )
+ throw "-stack_size must be < 512MB";
+@@ -4534,6 +4593,7 @@
+ fStackAddr = 0x120000000ULL;
+ }
+ break;
++#endif
+ }
+ if ( (fStackSize & -4096) != fStackSize )
+ throw "-stack_size must be multiples of 4K";
+@@ -4643,8 +4703,12 @@
+ alterObjC1ClassNamesToObjC2 = true;
+ break;
+ case CPU_TYPE_X86_64:
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
++#endif
++#if SUPPORT_ARCH_arm64
+ case CPU_TYPE_ARM64:
++#endif
+ alterObjC1ClassNamesToObjC2 = true;
+ break;
+ }
+@@ -4799,11 +4799,15 @@
+ // zero page size not specified on command line, set default
+ switch (fArchitecture) {
+ case CPU_TYPE_I386:
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
++#endif
+ // first 4KB for 32-bit architectures
+ fZeroPageSize = 0x1000;
+ break;
++#if SUPPORT_ARCH_arm64
+ case CPU_TYPE_ARM64:
++#endif
+ case CPU_TYPE_X86_64:
+ // first 4GB for x86_64 on all OS's
+ fZeroPageSize = 0x100000000ULL;
+@@ -4842,9 +4910,11 @@
+
+ // -force_cpusubtype_ALL is not supported for ARM
+ if ( fForceSubtypeAll ) {
++#if SUPPORT_ARCH_arm_any
+ if ( fArchitecture == CPU_TYPE_ARM ) {
+ warning("-force_cpusubtype_ALL will become unsupported for ARM architectures");
+ }
++#endif
+ }
+
+ // -reexported_symbols_list can only be used with -dynamiclib
+diff -ur ld64-241.9/src/ld/OutputFile.cpp ld64-241.9/src/ld/OutputFile.cpp
+--- ld64-241.9/src/ld/OutputFile.cpp 2015-01-22 20:59:47.000000000 +0100
++++ ld64-241.9/src/ld/OutputFile.cpp 2015-01-22 20:16:24.000000000 +0100
+@@ -631,7 +631,12 @@
+ // is encoded in mach-o the same as:
+ // .long _foo + 0x40000000
+ // so if _foo lays out to 0xC0000100, the first is ok, but the second is not.
+- if ( (_options.architecture() == CPU_TYPE_ARM) || (_options.architecture() == CPU_TYPE_I386) ) {
++ if (
++#if SUPPORT_ARCH_arm_any
++ (_options.architecture() == CPU_TYPE_ARM) ||
++#endif
++ (_options.architecture() == CPU_TYPE_I386) ||
++ 0) {
+ // Unlikely userland code does funky stuff like this, so warn for them, but not warn for -preload or -static
+ if ( (_options.outputKind() != Options::kPreload) && (_options.outputKind() != Options::kStaticExecutable) ) {
+ warning("32-bit absolute address out of range (0x%08llX max is 4GB): from %s + 0x%08X (0x%08llX) to 0x%08llX",
+@@ -1235,22 +1240,26 @@
+ return false;
+ const ld::Fixup* f;
+ switch ( fixup->kind ) {
++#if SUPPORT_ARCH_arm64
+ case ld::Fixup::kindStoreTargetAddressARM64Page21:
+ return !mustBeGOT;
+ case ld::Fixup::kindStoreTargetAddressARM64GOTLoadPage21:
+ case ld::Fixup::kindStoreTargetAddressARM64GOTLeaPage21:
+ return true;
++#endif
+ case ld::Fixup::kindSetTargetAddress:
+ f = fixup;
+ do {
+ ++f;
+ } while ( ! f->lastInCluster() );
+ switch (f->kind ) {
++#if SUPPORT_ARCH_arm64
+ case ld::Fixup::kindStoreARM64Page21:
+ return !mustBeGOT;
+ case ld::Fixup::kindStoreARM64GOTLoadPage21:
+ case ld::Fixup::kindStoreARM64GOTLeaPage21:
+ return true;
++#endif
+ default:
+ break;
+ }
+@@ -1267,22 +1276,26 @@
+ return false;
+ const ld::Fixup* f;
+ switch ( fixup->kind ) {
++#if SUPPORT_ARCH_arm64
+ case ld::Fixup::kindStoreTargetAddressARM64PageOff12:
+ return !mustBeGOT;
+ case ld::Fixup::kindStoreTargetAddressARM64GOTLoadPageOff12:
+ case ld::Fixup::kindStoreTargetAddressARM64GOTLeaPageOff12:
+ return true;
++#endif
+ case ld::Fixup::kindSetTargetAddress:
+ f = fixup;
+ do {
+ ++f;
+ } while ( ! f->lastInCluster() );
+ switch (f->kind ) {
++#if SUPPORT_ARCH_arm64
+ case ld::Fixup::kindStoreARM64PageOff12:
+ return !mustBeGOT;
+ case ld::Fixup::kindStoreARM64GOTLoadPageOff12:
+ case ld::Fixup::kindStoreARM64GOTLeaPageOff12:
+ return true;
++#endif
+ default:
+ break;
+ }
+@@ -1318,7 +1331,9 @@
+ std::map<uint32_t, const Fixup*> usedByHints;
+ for (ld::Fixup::iterator fit = atom->fixupsBegin(), end=atom->fixupsEnd(); fit != end; ++fit) {
+ uint8_t* fixUpLocation = &buffer[fit->offsetInAtom];
++#if SUPPORT_ARCH_arm64
+ ld::Fixup::LOH_arm64 lohExtra;
++#endif
+ switch ( (ld::Fixup::Kind)(fit->kind) ) {
+ case ld::Fixup::kindNone:
+ case ld::Fixup::kindNoneFollowOn:
+@@ -1580,6 +1595,7 @@
+ break;
+ case ld::Fixup::kindLinkerOptimizationHint:
+ // expand table of address/offsets used by hints
++#if SUPPORT_ARCH_arm64
+ lohExtra.addend = fit->u.addend;
+ usedByHints[fit->offsetInAtom + (lohExtra.info.delta1 << 2)] = NULL;
+ if ( lohExtra.info.count > 0 )
+@@ -1588,6 +1604,7 @@
+ usedByHints[fit->offsetInAtom + (lohExtra.info.delta3 << 2)] = NULL;
+ if ( lohExtra.info.count > 2 )
+ usedByHints[fit->offsetInAtom + (lohExtra.info.delta4 << 2)] = NULL;
++#endif
+ break;
+ case ld::Fixup::kindStoreTargetAddressLittleEndian32:
+ accumulator = addressOf(state, fit, &toTarget);
+@@ -2095,6 +2112,7 @@
+ //uint8_t loadSize, destReg;
+ //uint32_t scaledOffset;
+ //uint32_t imm12;
++#if SUPPORT_ARCH_arm64
+ ld::Fixup::LOH_arm64 alt;
+ alt.addend = fit->u.addend;
+ setInfo(state, atom, buffer, usedByHints, fit->offsetInAtom, (alt.info.delta1 << 2), &infoA);
+@@ -2453,6 +2471,7 @@
+ fprintf(stderr, "unknown hint kind %d alt.info.kind at 0x%08llX\n", alt.info.kind, infoA.instructionAddress);
+ break;
+ }
++#endif
+ }
+ // apply hints pass 2
+ for (ld::Fixup::iterator fit = atom->fixupsBegin(), end=atom->fixupsEnd(); fit != end; ++fit) {
+@@ -2460,6 +2479,7 @@
+ continue;
+ InstructionInfo infoA;
+ InstructionInfo infoB;
++#if SUPPORT_ARCH_arm64
+ ld::Fixup::LOH_arm64 alt;
+ alt.addend = fit->u.addend;
+ setInfo(state, atom, buffer, usedByHints, fit->offsetInAtom, (alt.info.delta1 << 2), &infoA);
+@@ -2491,6 +2511,7 @@
+ }
+ break;
+ }
++#endif
+ }
+ }
+ #endif // SUPPORT_ARCH_arm64
+@@ -2505,6 +2526,7 @@
+ for (uint8_t* p=from; p < to; ++p)
+ *p = 0x90;
+ break;
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ if ( thumb ) {
+ for (uint8_t* p=from; p < to; p += 2)
+@@ -2515,6 +2537,7 @@
+ OSWriteLittleInt32((uint32_t*)p, 0, 0xe1a00000);
+ }
+ break;
++#endif
+ default:
+ for (uint8_t* p=from; p < to; ++p)
+ *p = 0x00;
+@@ -2843,7 +2866,11 @@
+
+ // in -r mode, clarify symbolTableNotInFinalLinkedImages
+ if ( _options.outputKind() == Options::kObjectFile ) {
+- if ( (_options.architecture() == CPU_TYPE_X86_64) || (_options.architecture() == CPU_TYPE_ARM64) ) {
++ if ( (_options.architecture() == CPU_TYPE_X86_64) ||
++#if SUPPORT_ARCH_arm64
++ (_options.architecture() == CPU_TYPE_ARM64) ||
++#endif
++ 0 ) {
+ // x86_64 .o files need labels on anonymous literal strings
+ if ( (sect->type() == ld::Section::typeCString) && (atom->combine() == ld::Atom::combineByNameAndContent) ) {
+ (const_cast<ld::Atom*>(atom))->setSymbolTableInclusion(ld::Atom::symbolTableIn);
+@@ -4071,8 +4098,10 @@
+ if ( _options.sharedRegionEligible() ) {
+ // <rdar://problem/13287063> when range checking, ignore high byte of arm64 addends
+ uint64_t checkAddend = addend;
++#if SUPPORT_ARCH_arm64
+ if ( _options.architecture() == CPU_TYPE_ARM64 )
+ checkAddend &= 0x0FFFFFFFFFFFFFFFULL;
++#endif
+ if ( checkAddend != 0 ) {
+ // make sure the addend does not cause the pointer to point outside the target's segment
+ // if it does, update_dyld_shared_cache will not be able to put this dylib into the shared cache
+@@ -4279,12 +4308,17 @@
+
+ bool OutputFile::useExternalSectionReloc(const ld::Atom* atom, const ld::Atom* target, ld::Fixup* fixupWithTarget)
+ {
+- if ( (_options.architecture() == CPU_TYPE_X86_64) || (_options.architecture() == CPU_TYPE_ARM64) ) {
++ if ( (_options.architecture() == CPU_TYPE_X86_64) ||
++#if SUPPORT_ARCH_arm64
++ (_options.architecture() == CPU_TYPE_ARM64) ||
++#endif
++ 0) {
+ // x86_64 and ARM64 use external relocations for everthing that has a symbol
+ return ( target->symbolTableInclusion() != ld::Atom::symbolTableNotIn );
+ }
+
+ // <rdar://problem/9513487> support arm branch interworking in -r mode
++#if SUPPORT_ARCH_arm_any
+ if ( (_options.architecture() == CPU_TYPE_ARM) && (_options.outputKind() == Options::kObjectFile) ) {
+ if ( atom->isThumb() != target->isThumb() ) {
+ switch ( fixupWithTarget->kind ) {
+@@ -4298,6 +4332,7 @@
+ }
+ }
+ }
++#endif
+
+ if ( (_options.architecture() == CPU_TYPE_I386) && (_options.outputKind() == Options::kObjectFile) ) {
+ if ( target->contentType() == ld::Atom::typeTLV )
+@@ -4365,7 +4400,11 @@
+ bool minusTargetUsesExternalReloc = (minusTarget != NULL) && this->useExternalSectionReloc(atom, minusTarget, fixupWithMinusTarget);
+
+ // in x86_64 and arm64 .o files an external reloc means the content contains just the addend
+- if ( (_options.architecture() == CPU_TYPE_X86_64) ||(_options.architecture() == CPU_TYPE_ARM64) ) {
++ if ( (_options.architecture() == CPU_TYPE_X86_64) ||
++#if SUPPORT_ARCH_arm64
++ (_options.architecture() == CPU_TYPE_ARM64) ||
++#endif
++ 0 ) {
+ if ( targetUsesExternalReloc ) {
+ fixupWithTarget->contentAddendOnly = true;
+ fixupWithStore->contentAddendOnly = true;
+Only in ld64-241.9/src/ld: OutputFile.o
+diff -ur ld64-241.9/src/ld/Resolver.cpp ld64-241.9/src/ld/Resolver.cpp
+--- ld64-241.9/src/ld/Resolver.cpp 2015-01-22 20:59:47.000000000 +0100
++++ ld64-241.9/src/ld/Resolver.cpp 2015-01-22 20:30:28.000000000 +0100
+@@ -431,6 +431,7 @@
+ // update cpu-sub-type
+ cpu_subtype_t nextObjectSubType = file.cpuSubType();
+ switch ( _options.architecture() ) {
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ if ( _options.subArchitecture() != nextObjectSubType ) {
+ if ( (_options.subArchitecture() == CPU_SUBTYPE_ARM_ALL) && _options.forceCpuSubtypeAll() ) {
+@@ -449,6 +450,7 @@
+ }
+ }
+ break;
++#endif
+
+ case CPU_TYPE_I386:
+ _internal.cpuSubType = CPU_SUBTYPE_I386_ALL;
+diff -ur ld64-241.9/src/ld/parsers/archive_file.cpp ld64-241.9/src/ld/parsers/archive_file.cpp
+--- ld64-241.9/src/ld/parsers/archive_file.cpp 2015-01-22 20:59:47.000000000 +0100
++++ ld64-241.9/src/ld/parsers/archive_file.cpp 2015-01-22 05:57:03.000000000 +0100
+@@ -232,8 +232,12 @@
+
+ template <> cpu_type_t File<x86>::architecture() { return CPU_TYPE_I386; }
+ template <> cpu_type_t File<x86_64>::architecture() { return CPU_TYPE_X86_64; }
++#if SUPPORT_ARCH_arm_any
+ template <> cpu_type_t File<arm>::architecture() { return CPU_TYPE_ARM; }
++#endif
++#if SUPPORT_ARCH_arm64
+ template <> cpu_type_t File<arm64>::architecture() { return CPU_TYPE_ARM64; }
++#endif
+
+
+ template <typename A>
+diff -ur ld64-241.9/src/ld/parsers/macho_dylib_file.cpp ld64-241.9/src/ld/parsers/macho_dylib_file.cpp
+--- ld64-241.9/src/ld/parsers/macho_dylib_file.cpp 2015-01-22 20:59:47.000000000 +0100
++++ ld64-241.9/src/ld/parsers/macho_dylib_file.cpp 2015-01-22 06:07:53.000000000 +0100
+@@ -258,11 +258,15 @@
+ bool File<A>::_s_logHashtable = false;
+
+ template <> const char* File<x86_64>::objCInfoSegmentName() { return "__DATA"; }
++#if SUPPORT_ARCH_arm_any
+ template <> const char* File<arm>::objCInfoSegmentName() { return "__DATA"; }
++#endif
+ template <typename A> const char* File<A>::objCInfoSegmentName() { return "__OBJC"; }
+
+ template <> const char* File<x86_64>::objCInfoSectionName() { return "__objc_imageinfo"; }
++#if SUPPORT_ARCH_arm_any
+ template <> const char* File<arm>::objCInfoSectionName() { return "__objc_imageinfo"; }
++#endif
+ template <typename A> const char* File<A>::objCInfoSectionName() { return "__image_info"; }
+
+ template <typename A>
+@@ -1020,6 +1024,7 @@
+ }
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ bool Parser<arm>::validFile(const uint8_t* fileContent, bool executableOrDyliborBundle)
+ {
+@@ -1046,9 +1051,11 @@
+ return false;
+ }
+ }
++#endif
+
+
+
++#if SUPPORT_ARCH_arm64
+ template <>
+ bool Parser<arm64>::validFile(const uint8_t* fileContent, bool executableOrDyliborBundle)
+ {
+@@ -1075,6 +1082,7 @@
+ return false;
+ }
+ }
++#endif
+
+
+ bool isDylibFile(const uint8_t* fileContent, cpu_type_t* result, cpu_subtype_t* subResult)
+@@ -1090,17 +1098,21 @@
+ *subResult = CPU_SUBTYPE_X86_ALL;
+ return true;
+ }
++#if SUPPORT_ARCH_arm_any
+ if ( Parser<arm>::validFile(fileContent, false) ) {
+ *result = CPU_TYPE_ARM;
+ const macho_header<Pointer32<LittleEndian> >* header = (const macho_header<Pointer32<LittleEndian> >*)fileContent;
+ *subResult = header->cpusubtype();
+ return true;
+ }
++#endif
++#if SUPPORT_ARCH_arm64
+ if ( Parser<arm64>::validFile(fileContent, false) ) {
+ *result = CPU_TYPE_ARM64;
+ *subResult = CPU_SUBTYPE_ARM64_ALL;
+ return true;
+ }
++#endif
+ return false;
+ }
+
+@@ -1126,6 +1138,7 @@
+ return "x86_64";
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ const char* Parser<arm>::fileKind(const uint8_t* fileContent)
+ {
+@@ -1141,6 +1154,7 @@
+ }
+ return "arm???";
+ }
++#endif
+
+ #if SUPPORT_ARCH_arm64
+ template <>
+@@ -1166,9 +1180,11 @@
+ if ( Parser<x86>::validFile(fileContent, true) ) {
+ return Parser<x86>::fileKind(fileContent);
+ }
++#if SUPPORT_ARCH_arm_any
+ if ( Parser<arm>::validFile(fileContent, true) ) {
+ return Parser<arm>::fileKind(fileContent);
+ }
++#endif
+ #if SUPPORT_ARCH_arm64
+ if ( Parser<arm64>::validFile(fileContent, false) ) {
+ return Parser<arm64>::fileKind(fileContent);
+diff -ur ld64-241.9/src/ld/parsers/macho_relocatable_file.cpp ld64-241.9/src/ld/parsers/macho_relocatable_file.cpp
+--- ld64-241.9/src/ld/parsers/macho_relocatable_file.cpp 2015-01-22 20:59:47.000000000 +0100
++++ ld64-241.9/src/ld/parsers/macho_relocatable_file.cpp 2015-01-22 20:38:57.000000000 +0100
+@@ -867,6 +867,7 @@
+ }
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ void Atom<arm>::verifyAlignment(const macho_section<P>&) const
+ {
+@@ -875,6 +876,7 @@
+ warning("ARM function not 4-byte aligned: %s from %s", this->name(), this->file()->path());
+ }
+ }
++#endif
+
+ #if SUPPORT_ARCH_arm64
+ template <>
+@@ -1262,6 +1264,7 @@
+ return true;
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ bool Parser<arm>::validFile(const uint8_t* fileContent, bool subtypeMustMatch, cpu_subtype_t subtype)
+ {
+@@ -1282,8 +1285,10 @@
+ }
+ return true;
+ }
++#endif
+
+
++#if SUPPORT_ARCH_arm64
+ template <>
+ bool Parser<arm64>::validFile(const uint8_t* fileContent, bool subtypeMustMatch, cpu_subtype_t subtype)
+ {
+@@ -1296,6 +1301,7 @@
+ return false;
+ return true;
+ }
++#endif
+
+
+ template <>
+@@ -1320,6 +1326,7 @@
+ return "x86_64";
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ const char* Parser<arm>::fileKind(const uint8_t* fileContent)
+ {
+@@ -1335,6 +1342,7 @@
+ }
+ return "arm???";
+ }
++#endif
+
+ #if SUPPORT_ARCH_arm64
+ template <>
+@@ -1599,11 +1607,13 @@
+ return false;
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ arm::P::uint_t Parser<arm>::realAddr(arm::P::uint_t addr)
+ {
+ return addr & (-2);
+ }
++#endif
+
+ template <typename A>
+ typename A::P::uint_t Parser<A>::realAddr(typename A::P::uint_t addr)
+@@ -1867,8 +1877,12 @@
+
+ template <> uint8_t Parser<x86>::loadCommandSizeMask() { return 0x03; }
+ template <> uint8_t Parser<x86_64>::loadCommandSizeMask() { return 0x07; }
++#if SUPPORT_ARCH_arm_any
+ template <> uint8_t Parser<arm>::loadCommandSizeMask() { return 0x03; }
++#endif
++#if SUPPORT_ARCH_arm64
+ template <> uint8_t Parser<arm64>::loadCommandSizeMask() { return 0x07; }
++#endif
+
+ template <typename A>
+ bool Parser<A>::parseLoadCommands()
+@@ -4065,12 +4079,14 @@
+ return 1 + (this->_machOSection - parser.firstMachOSection());
+ }
+
++#if SUPPORT_ARCH_arm_any
+ // arm does not have zero cost exceptions
+ template <>
+ uint32_t CFISection<arm>::cfiCount(Parser<arm>& parser)
+ {
+ return 0;
+ }
++#endif
+
+ template <typename A>
+ uint32_t CFISection<A>::cfiCount(Parser<A>& parser)
+@@ -4198,6 +4214,7 @@
+
+
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ void CFISection<arm>::cfiParse(class Parser<arm>& parser, uint8_t* buffer,
+ libunwind::CFI_Atom_Info<CFISection<arm>::OAS>::CFI_Atom_Info cfiArray[],
+@@ -4206,6 +4223,7 @@
+ // arm does not use zero cost exceptions
+ assert(count == 0);
+ }
++#endif
+
+
+
+@@ -4310,8 +4328,12 @@
+
+ template <> bool CFISection<x86_64>::bigEndian() { return false; }
+ template <> bool CFISection<x86>::bigEndian() { return false; }
++#if SUPPORT_ARCH_arm_any
+ template <> bool CFISection<arm>::bigEndian() { return false; }
++#endif
++#if SUPPORT_ARCH_arm64
+ template <> bool CFISection<arm64>::bigEndian() { return false; }
++#endif
+
+
+ template <>
+@@ -5229,11 +5251,13 @@
+ return ld::Fixup::kindStoreLittleEndian32;
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ ld::Fixup::Kind NonLazyPointerSection<arm>::fixupKind()
+ {
+ return ld::Fixup::kindStoreLittleEndian32;
+ }
++#endif
+
+ template <>
+ ld::Fixup::Kind NonLazyPointerSection<arm64>::fixupKind()
+@@ -7346,10 +7370,14 @@
+ return ( mach_o::relocatable::Parser<x86_64>::validFile(fileContent) );
+ case CPU_TYPE_I386:
+ return ( mach_o::relocatable::Parser<x86>::validFile(fileContent) );
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ return ( mach_o::relocatable::Parser<arm>::validFile(fileContent, opts.objSubtypeMustMatch, opts.subType) );
++#endif
++#if SUPPORT_ARCH_arm64
+ case CPU_TYPE_ARM64:
+ return ( mach_o::relocatable::Parser<arm64>::validFile(fileContent, opts.objSubtypeMustMatch, opts.subType) );
++#endif
+ }
+ return false;
+ }
+@@ -7370,17 +7398,21 @@
+ *subResult = CPU_SUBTYPE_X86_ALL;
+ return true;
+ }
++#if SUPPORT_ARCH_arm_any
+ if ( mach_o::relocatable::Parser<arm>::validFile(fileContent, false, 0) ) {
+ *result = CPU_TYPE_ARM;
+ const macho_header<Pointer32<LittleEndian> >* header = (const macho_header<Pointer32<LittleEndian> >*)fileContent;
+ *subResult = header->cpusubtype();
+ return true;
+ }
++#endif
++#if SUPPORT_ARCH_arm_any
+ if ( mach_o::relocatable::Parser<arm64>::validFile(fileContent, false, 0) ) {
+ *result = CPU_TYPE_ARM64;
+ *subResult = CPU_SUBTYPE_ARM64_ALL;
+ return true;
+ }
++#endif
+ return false;
+ }
+
+@@ -7395,9 +7427,11 @@
+ if ( mach_o::relocatable::Parser<x86>::validFile(fileContent) ) {
+ return mach_o::relocatable::Parser<x86>::fileKind(fileContent);
+ }
++#if SUPPORT_ARCH_arm_any
+ if ( mach_o::relocatable::Parser<arm>::validFile(fileContent, false, 0) ) {
+ return mach_o::relocatable::Parser<arm>::fileKind(fileContent);
+ }
++#endif
+ return NULL;
+ }
+
+@@ -7409,9 +7443,11 @@
+ if ( mach_o::relocatable::Parser<x86_64>::validFile(fileContent) ) {
+ return mach_o::relocatable::Parser<x86_64>::hasObjC2Categories(fileContent);
+ }
++#if SUPPORT_ARCH_arm_any
+ else if ( mach_o::relocatable::Parser<arm>::validFile(fileContent, false, 0) ) {
+ return mach_o::relocatable::Parser<arm>::hasObjC2Categories(fileContent);
+ }
++#endif
+ else if ( mach_o::relocatable::Parser<x86>::validFile(fileContent, false, 0) ) {
+ return mach_o::relocatable::Parser<x86>::hasObjC2Categories(fileContent);
+ }
+diff -ur ld64-241.9/src/ld/passes/branch_island.cpp ld64-241.9/src/ld/passes/branch_island.cpp
+--- ld64-241.9/src/ld/passes/branch_island.cpp 2014-09-11 00:24:46.000000000 +0200
++++ ld64-241.9/src/ld/passes/branch_island.cpp 2015-01-22 06:23:52.000000000 +0100
+@@ -285,6 +285,7 @@
+ static uint64_t textSizeWhenMightNeedBranchIslands(const Options& opts, bool seenThumbBranch)
+ {
+ switch ( opts.architecture() ) {
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ if ( ! seenThumbBranch )
+ return 32000000; // ARM can branch +/- 32MB
+@@ -293,6 +294,7 @@
+ else
+ return 4000000; // thumb1 can branch +/- 4MB
+ break;
++#endif
+ }
+ assert(0 && "unexpected architecture");
+ return 0x100000000LL;
+@@ -302,6 +304,7 @@
+ static uint64_t maxDistanceBetweenIslands(const Options& opts, bool seenThumbBranch)
+ {
+ switch ( opts.architecture() ) {
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ if ( ! seenThumbBranch )
+ return 30*1024*1024; // 2MB of branch islands per 32MB
+@@ -310,6 +313,7 @@
+ else
+ return 3500000; // 0.5MB of branch islands per 4MB
+ break;
++#endif
+ }
+ assert(0 && "unexpected architecture");
+ return 0x100000000LL;
+@@ -654,8 +658,10 @@
+
+ // only ARM needs branch islands
+ switch ( opts.architecture() ) {
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ break;
++#endif
+ default:
+ return;
+ }
+diff -ur ld64-241.9/src/ld/passes/branch_shim.cpp ld64-241.9/src/ld/passes/branch_shim.cpp
+--- ld64-241.9/src/ld/passes/branch_shim.cpp 2014-09-11 00:24:46.000000000 +0200
++++ ld64-241.9/src/ld/passes/branch_shim.cpp 2015-01-22 06:33:01.000000000 +0100
+@@ -276,6 +276,9 @@
+ //
+ void doPass(const Options& opts, ld::Internal& state)
+ {
++#if !SUPPORT_ARCH_arm_any
++ return;
++#else
+ // only make branch shims in final linked images
+ if ( opts.outputKind() == Options::kObjectFile )
+ return;
+@@ -386,6 +389,7 @@
+ // append all new shims to end of __text
+ sect->atoms.insert(sect->atoms.end(), shims.begin(), shims.end());
+ }
++#endif
+ }
+
+
+diff -ur ld64-241.9/src/ld/passes/dtrace_dof.cpp ld64-241.9/src/ld/passes/dtrace_dof.cpp
+--- ld64-241.9/src/ld/passes/dtrace_dof.cpp 2015-01-22 20:59:47.000000000 +0100
++++ ld64-241.9/src/ld/passes/dtrace_dof.cpp 2015-01-22 06:33:51.000000000 +0100
+@@ -179,8 +179,12 @@
+ switch ( opts.architecture() ) {
+ case CPU_TYPE_I386:
+ case CPU_TYPE_X86_64:
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
++#endif
++#if SUPPORT_ARCH_arm64
+ case CPU_TYPE_ARM64:
++#endif
+ storeKind = ld::Fixup::kindStoreLittleEndian32;
+ break;
+ default:
+diff -ur ld64-241.9/src/ld/passes/stubs/stubs.cpp ld64-241.9/src/ld/passes/stubs/stubs.cpp
+--- ld64-241.9/src/ld/passes/stubs/stubs.cpp 2014-09-11 00:24:46.000000000 +0200
++++ ld64-241.9/src/ld/passes/stubs/stubs.cpp 2015-01-22 06:34:56.000000000 +0100
+@@ -324,9 +324,11 @@
+ if ( _options.outputKind() != Options::kDynamicLibrary )
+ throwf("resolver functions (%s) can only be used in dylibs", atom->name());
+ if ( !_options.makeCompressedDyldInfo() ) {
++#if SUPPORT_ARCH_arm_any
+ if ( _options.architecture() == CPU_TYPE_ARM )
+ throwf("resolver functions (%s) can only be used when targeting iOS 4.2 or later", atom->name());
+ else
++#endif
+ throwf("resolver functions (%s) can only be used when targeting Mac OS X 10.6 or later", atom->name());
+ }
+ stubFor[atom] = NULL;
+@@ -354,6 +356,7 @@
+ throw "symbol dyld_stub_binding_helper not found, normally in crt1.o/dylib1.o/bundle1.o";
+
+ // disable arm close stubs in some cases
++#if SUPPORT_ARCH_arm_any
+ if ( _architecture == CPU_TYPE_ARM ) {
+ if ( codeSize > 4*1024*1024 )
+ _largeText = true;
+@@ -377,6 +380,7 @@
+ }
+ }
+ }
++#endif
+
+ // make stub atoms
+ for (std::map<const ld::Atom*,ld::Atom*>::iterator it = stubFor.begin(); it != stubFor.end(); ++it) {
+diff -ur ld64-241.9/src/other/ObjectDump.cpp ld64-241.9/src/other/ObjectDump.cpp
+--- ld64-241.9/src/other/ObjectDump.cpp 2015-01-22 20:59:47.000000000 +0100
++++ ld64-241.9/src/other/ObjectDump.cpp 2015-01-22 05:32:46.000000000 +0100
+@@ -806,6 +806,7 @@
+ case ld::Fixup::kindStoreThumbHigh16:
+ printf(", then store high-16 in Thumb movt");
+ break;
++#if SUPPORT_ARCH_arm64
+ case ld::Fixup::kindStoreARM64Branch26:
+ printf(", then store as ARM64 26-bit pcrel branch");
+ break;
+@@ -845,6 +846,7 @@
+ case ld::Fixup::kindStoreARM64PCRelToGOT:
+ printf(", then store as 32-bit delta to GOT entry");
+ break;
++#endif
+ case ld::Fixup::kindDtraceExtra:
+ printf("dtrace static probe extra info");
+ break;
+@@ -989,6 +991,7 @@
+ case ld::Fixup::kindSetTargetTLVTemplateOffsetLittleEndian64:
+ printf("tlv template offset of %s", referenceTargetAtomName(ref));
+ break;
++#if SUPPORT_ARCH_arm64
+ case ld::Fixup::kindStoreTargetAddressARM64Branch26:
+ printf("ARM64 store 26-bit pcrel branch to %s", referenceTargetAtomName(ref));
+ break;
+@@ -1022,6 +1025,7 @@
+ case ld::Fixup::kindStoreTargetAddressARM64TLVPLoadNowLeaPageOff12:
+ printf("ARM64 store 12-bit page offset of lea for TLV of %s", referenceTargetAtomName(ref));
+ break;
++#endif
+ //default:
+ // printf("unknown fixup");
+ // break;
+diff -ur ld64-241.9/src/other/rebase.cpp ld64-241.9/src/other/rebase.cpp
+--- ld64-241.9/src/other/rebase.cpp 2014-09-11 00:24:46.000000000 +0200
++++ ld64-241.9/src/other/rebase.cpp 2015-01-22 05:46:29.000000000 +0100
+@@ -160,9 +160,11 @@
+ case CPU_TYPE_X86_64:
+ fRebasers.push_back(new Rebaser<x86_64>(&p[fileOffset]));
+ break;
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ fRebasers.push_back(new Rebaser<arm>(&p[fileOffset]));
+ break;
++#endif
+ default:
+ throw "unknown file format";
+ }
+@@ -186,9 +188,11 @@
+ else if ( (OSSwapLittleToHostInt32(mh->magic) == MH_MAGIC_64) && (OSSwapLittleToHostInt32(mh->cputype) == CPU_TYPE_X86_64)) {
+ fRebasers.push_back(new Rebaser<x86_64>(mh));
+ }
++#if SUPPORT_ARCH_arm_any
+ else if ( (OSSwapLittleToHostInt32(mh->magic) == MH_MAGIC) && (OSSwapLittleToHostInt32(mh->cputype) == CPU_TYPE_ARM)) {
+ fRebasers.push_back(new Rebaser<arm>(mh));
+ }
++#endif
+ else {
+ throw "unknown file format";
+ }
+@@ -236,7 +240,9 @@
+ template <> cpu_type_t Rebaser<ppc64>::getArchitecture() const { return CPU_TYPE_POWERPC64; }
+ template <> cpu_type_t Rebaser<x86>::getArchitecture() const { return CPU_TYPE_I386; }
+ template <> cpu_type_t Rebaser<x86_64>::getArchitecture() const { return CPU_TYPE_X86_64; }
++#if SUPPORT_ARCH_arm_any
+ template <> cpu_type_t Rebaser<arm>::getArchitecture() const { return CPU_TYPE_ARM; }
++#endif
+
+ template <typename A>
+ uint64_t Rebaser<A>::getBaseAddress() const
+@@ -875,8 +881,10 @@
+ return "i386";
+ case CPU_TYPE_X86_64:
+ return "x86_64";
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ return "arm";
++#endif
+ }
+ return "unknown";
+ }
+@@ -969,6 +977,7 @@
+ else if ( arch == CPU_TYPE_X86_64 ) {
+ return 0x200000000ULL;
+ }
++#if SUPPORT_ARCH_arm_any
+ else if ( arch == CPU_TYPE_ARM ) {
+ // place dylibs below dyld
+ uint64_t topAddr = 0x2FE00000;
+@@ -977,6 +986,7 @@
+ throwf("total size of images (0x%X) does not fit below 0x2FE00000", totalSize);
+ return topAddr - totalSize;
+ }
++#endif
+ else
+ throw "unknown architecture";
+ }
+@@ -1043,7 +1053,9 @@
+ onlyArchs.insert(CPU_TYPE_POWERPC64);
+ onlyArchs.insert(CPU_TYPE_I386);
+ onlyArchs.insert(CPU_TYPE_X86_64);
++#if SUPPORT_ARCH_arm_any
+ onlyArchs.insert(CPU_TYPE_ARM);
++#endif
+ }
+
+ // scan files and collect sizes
+diff -ur ld64-241.9/src/other/unwinddump.cpp ld64-241.9/src/other/unwinddump.cpp
+--- ld64-241.9/src/other/unwinddump.cpp 2015-01-22 20:59:47.000000000 +0100
++++ ld64-241.9/src/other/unwinddump.cpp 2015-01-22 05:45:28.000000000 +0100
+@@ -97,7 +97,9 @@
+
+ template <> const char* UnwindPrinter<x86>::archName() { return "i386"; }
+ template <> const char* UnwindPrinter<x86_64>::archName() { return "x86_64"; }
++#if SUPPORT_ARCH_arm_any
+ template <> const char* UnwindPrinter<arm>::archName() { return "arm"; }
++#endif
+ #if SUPPORT_ARCH_arm64
+ template <> const char* UnwindPrinter<arm64>::archName() { return "arm64"; }
+ #endif
+@@ -1072,7 +1074,9 @@
+ #if SUPPORT_ARCH_arm64
+ onlyArchs.insert(CPU_TYPE_ARM64);
+ #endif
++#if SUPPORT_ARCH_arm_any
+ onlyArchs.insert(CPU_TYPE_ARM);
++#endif
+ }
+
+ // process each file
+--- ld64-241.9/src/other/machochecker.cpp 2015-01-23 01:54:12.000000000 +0100
++++ ld64-241.9/src/other/machochecker.cpp 2015-01-23 01:57:11.000000000 +0100
+@@ -252,6 +252,7 @@
+ return false;
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ bool MachOChecker<arm>::validFile(const uint8_t* fileContent)
+ {
+@@ -269,6 +270,7 @@
+ }
+ return false;
+ }
++#endif
+
+ #if SUPPORT_ARCH_arm64
+ template <>
+@@ -294,7 +296,9 @@
+ template <> uint8_t MachOChecker<ppc64>::loadCommandSizeMask() { return 0x07; }
+ template <> uint8_t MachOChecker<x86>::loadCommandSizeMask() { return 0x03; }
+ template <> uint8_t MachOChecker<x86_64>::loadCommandSizeMask() { return 0x07; }
++#if SUPPORT_ARCH_arm_any
+ template <> uint8_t MachOChecker<arm>::loadCommandSizeMask() { return 0x03; }
++#endif
+ #if SUPPORT_ARCH_arm64
+ template <> uint8_t MachOChecker<arm64>::loadCommandSizeMask() { return 0x07; }
+ #endif
+@@ -324,11 +328,13 @@
+ return threadInfo->thread_register(7);
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ arm::P::uint_t MachOChecker<arm>::getInitialStackPointer(const macho_thread_command<arm::P>* threadInfo)
+ {
+ return threadInfo->thread_register(13);
+ }
++#endif
+
+ #if SUPPORT_ARCH_arm64
+ template <>
+@@ -362,11 +368,13 @@
+ return threadInfo->thread_register(16);
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ arm::P::uint_t MachOChecker<arm>::getEntryPoint(const macho_thread_command<arm::P>* threadInfo)
+ {
+ return threadInfo->thread_register(15);
+ }
++#endif
+
+ #if SUPPORT_ARCH_arm64
+ template <>
+@@ -1025,6 +1033,7 @@
+ return fFirstWritableSegment->vmaddr();
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ arm::P::uint_t MachOChecker<arm>::relocBase()
+ {
+@@ -1033,6 +1042,7 @@
+ else
+ return fFirstSegment->vmaddr();
+ }
++#endif
+
+ #if SUPPORT_ARCH_arm64
+ template <>
diff --git a/sys-devel/binutils-apple/files/ld64-241.9-nosnapshots.patch b/sys-devel/binutils-apple/files/ld64-241.9-nosnapshots.patch
new file mode 100644
index 000000000000..f484111ab34b
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-241.9-nosnapshots.patch
@@ -0,0 +1,644 @@
+Allow to disable snapshot support because of missing Block API on OS X < 10.6.
+
+--- ld64-241.9/src/ld/InputFiles.cpp.orig 2015-01-16 15:26:31.000000000 -0800
++++ ld64-241.9/src/ld/InputFiles.cpp 2015-01-16 15:26:54.000000000 -0800
+@@ -1144,7 +1144,9 @@
+ case ld::File::Reloc:
+ {
+ ld::relocatable::File* reloc = (ld::relocatable::File*)file;
++#ifdef SUPPORT_SNAPSHOTS
+ _options.snapshot().recordObjectFile(reloc->path());
++#endif
+ if ( _options.dumpDependencyInfo() )
+ _options.dumpDependency(Options::depObjectFile, reloc->path());
+ }
+@@ -1244,7 +1246,9 @@
+ if ( dylibFile->justInTimeforEachAtom(name, handler) ) {
+ // we found a definition in this dylib
+ // done, unless it is a weak definition in which case we keep searching
++#ifdef SUPPORT_SNAPSHOTS
+ _options.snapshot().recordDylibSymbol(dylibFile, name);
++#endif
+ if ( !dylibFile->hasWeakExternals() || !dylibFile->hasWeakDefinition(name)) {
+ return true;
+ }
+@@ -1258,7 +1262,9 @@
+ if ( archiveFile->justInTimeDataOnlyforEachAtom(name, handler) ) {
+ if ( _options.traceArchives() )
+ logArchive(archiveFile);
++#ifdef SUPPORT_SNAPSHOTS
+ _options.snapshot().recordArchive(archiveFile->path());
++#endif
+ // found data definition in static library, done
+ return true;
+ }
+@@ -1267,7 +1273,9 @@
+ if ( archiveFile->justInTimeforEachAtom(name, handler) ) {
+ if ( _options.traceArchives() )
+ logArchive(archiveFile);
++#ifdef SUPPORT_SNAPSHOTS
+ _options.snapshot().recordArchive(archiveFile->path());
++#endif
+ // found definition in static library, done
+ return true;
+ }
+@@ -1294,7 +1302,9 @@
+ if ( dylibFile->justInTimeforEachAtom(name, handler) ) {
+ // we found a definition in this dylib
+ // done, unless it is a weak definition in which case we keep searching
++#ifdef SUPPORT_SNAPSHOTS
+ _options.snapshot().recordDylibSymbol(dylibFile, name);
++#endif
+ if ( !dylibFile->hasWeakExternals() || !dylibFile->hasWeakDefinition(name)) {
+ return true;
+ }
+--- ld64-241.9/src/ld/ld.cpp.orig 2015-01-16 15:26:32.000000000 -0800
++++ ld64-241.9/src/ld/ld.cpp 2015-01-16 15:26:54.000000000 -0800
+@@ -1180,11 +1180,13 @@
+ // implement assert() function to print out a backtrace before aborting
+ void __assert_rtn(const char* func, const char* file, int line, const char* failedexpr)
+ {
++#ifdef SUPPORT_SNAPSHOTS
+ Snapshot *snapshot = Snapshot::globalSnapshot;
+
+ snapshot->setSnapshotMode(Snapshot::SNAPSHOT_DEBUG);
+ snapshot->createSnapshot();
+ snapshot->recordAssertionMessage("Assertion failed: (%s), function %s, file %s, line %d.\n", failedexpr, func, file, line);
++#endif
+
+ void* callStack[128];
+ int depth = ::backtrace(callStack, 128);
+@@ -1202,9 +1204,13 @@
+ }
+ long offset = (uintptr_t)callStack[i] - (uintptr_t)info.dli_saddr;
+ fprintf(stderr, "%d %p %s + %ld\n", i, callStack[i], symboName, offset);
++#ifdef SUPPORT_SNAPSHOTS
+ snapshot->recordAssertionMessage("%d %p %s + %ld\n", i, callStack[i], symboName, offset);
++#endif
+ }
++#ifdef SUPPORT_SNAPSHOTS
+ fprintf(stderr, "A linker snapshot was created at:\n\t%s\n", snapshot->rootDir());
++#endif
+ fprintf(stderr, "ld: Assertion failed: (%s), function %s, file %s, line %d.\n", failedexpr, func, file, line);
+ exit(1);
+ }
+--- ld64-241.9/src/ld/Options.cpp.orig 2015-01-16 15:26:32.000000000 -0800
++++ ld64-241.9/src/ld/Options.cpp 2015-01-16 15:27:26.000000000 -0800
+@@ -183,7 +183,11 @@
+ fMarkAppExtensionSafe(false), fCheckAppExtensionSafe(false), fForceLoadSwiftLibs(false),
+ fDebugInfoStripping(kDebugInfoMinimal), fTraceOutputFile(NULL),
+ fMacVersionMin(ld::macVersionUnset), fIOSVersionMin(ld::iOSVersionUnset),
+- fSaveTempFiles(false), fSnapshotRequested(false), fPipelineFifo(NULL),
++ fSaveTempFiles(false),
++#ifdef SUPPORT_SNAPSHOTS
++ fSnapshotRequested(false),
++#endif
++ fPipelineFifo(NULL),
+ fDependencyInfoPath(NULL), fDependencyFileDescriptor(-1)
+ {
+ this->checkForClassic(argc, argv);
+@@ -589,7 +593,9 @@
+ }
+ break;
+ }
++#ifdef SUPPORT_SNAPSHOTS
+ fLinkSnapshot.recordArch(fArchitectureName);
++#endif
+ // only use compressed LINKEDIT for:
+ // Mac OS X 10.6 or later
+ // iOS 3.1 or later
+@@ -1908,8 +1914,10 @@
+ //
+ void Options::parse(int argc, const char* argv[])
+ {
++#ifdef SUPPORT_SNAPSHOTS
+ // Store the original args in the link snapshot.
+ fLinkSnapshot.recordRawArgs(argc, argv);
++#endif
+
+ // pass one builds search list from -L and -F options
+ this->buildSearchPaths(argc, argv);
+@@ -1922,17 +1930,21 @@
+ const char* arg = argv[i];
+
+ if ( arg[0] == '-' ) {
++#ifdef SUPPORT_SNAPSHOTS
+ // by default, copy one arg to the snapshot link command, and do no file copying
+ int snapshotArgIndex = i;
+ int snapshotArgCount = -1; // -1 means compute count based on change in index
+ int snapshotFileArgIndex = -1; // -1 means no data file parameter to arg
++#endif
+
+ // Since we don't care about the files passed, just the option names, we do this here.
+ if (fPrintOptions)
+ fprintf (stderr, "[Logging ld64 options]\t%s\n", arg);
+
+ if ( (arg[1] == 'L') || (arg[1] == 'F') ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotArgCount = 0; // stripped out of link snapshot
++#endif
+ if (arg[2] == '\0')
+ ++i;
+ // previously handled by buildSearchPaths()
+@@ -1979,12 +1991,16 @@
+ fOutputKind = kKextBundle;
+ }
+ else if ( strcmp(arg, "-o") == 0 ) {
+- snapshotArgCount = 0;
+ fOutputFile = argv[++i];
++#ifdef SUPPORT_SNAPSHOTS
++ snapshotArgCount = 0;
+ fLinkSnapshot.setSnapshotName(fOutputFile);
++#endif
+ }
+ else if ( strncmp(arg, "-lazy-l", 7) == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotArgCount = 0;
++#endif
+ FileInfo info = findLibrary(&arg[7], true);
+ info.options.fLazyLoad = true;
+ info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
+@@ -1992,13 +2008,17 @@
+ fUsingLazyDylibLinking = true;
+ }
+ else if ( strcmp(arg, "-lto_library") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 1;
++#endif
+ fOverridePathlibLTO = argv[++i];
+ if ( fOverridePathlibLTO == NULL )
+ throw "missing argument to -lto_library";
+ }
+ else if ( (arg[1] == 'l') && (strncmp(arg,"-lazy_",6) !=0) ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotArgCount = 0;
++#endif
+ FileInfo info = findLibrary(&arg[2]);
+ info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
+ addLibrary(info);
+@@ -2006,8 +2026,10 @@
+ // This causes a dylib to be weakly bound at
+ // link time. This corresponds to weak_import.
+ else if ( strncmp(arg, "-weak-l", 7) == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ // SNAPSHOT FIXME: what should we do for link snapshots? (ignore for now)
+ snapshotArgCount = 0;
++#endif
+ FileInfo info = findLibrary(&arg[7]);
+ info.options.fWeakImport = true;
+ info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
+@@ -2065,12 +2087,16 @@
+ else if ( strcmp(arg, "-sectorder") == 0 ) {
+ if ( (argv[i+1]==NULL) || (argv[i+2]==NULL) || (argv[i+3]==NULL) )
+ throw "-sectorder missing <segment> <section> <file-path>";
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 3;
++#endif
+ parseSectionOrderFile(argv[i+1], argv[i+2], argv[i+3]);
+ i += 3;
+ }
+ else if ( strcmp(arg, "-order_file") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 1;
++#endif
+ parseOrderFile(argv[++i], false);
+ }
+ else if ( strcmp(arg, "-order_file_statistics") == 0 ) {
+@@ -2081,7 +2107,9 @@
+ else if ( (strcmp(arg, "-sectcreate") == 0) || (strcmp(arg, "-segcreate") == 0) ) {
+ if ( (argv[i+1]==NULL) || (argv[i+2]==NULL) || (argv[i+3]==NULL) )
+ throw "-sectcreate missing <segment> <section> <file-path>";
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 3;
++#endif
+ addSection(argv[i+1], argv[i+2], argv[i+3]);
+ i += 3;
+ }
+@@ -2110,7 +2138,9 @@
+ }
+ // Same as -@ from the FSF linker.
+ else if ( strcmp(arg, "-filelist") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotArgCount = 0;
++#endif
+ const char* path = argv[++i];
+ if ( (path == NULL) || (path[0] == '-') )
+ throw "-filelist missing <path>";
+@@ -2137,7 +2167,9 @@
+ }
+ }
+ else if ( strcmp(arg, "-interposable_list") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 1;
++#endif
+ fInterposeMode = kInterposeSome;
+ loadExportFile(argv[++i], "-interposable_list", fInterposeList);
+ }
+@@ -2146,14 +2178,18 @@
+ fInterposeMode = kInterposeNone;
+ }
+ else if ( strcmp(arg, "-exported_symbols_list") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 1;
++#endif
+ if ( fExportMode == kDontExportSome )
+ throw "can't use -exported_symbols_list and -unexported_symbols_list";
+ fExportMode = kExportSome;
+ loadExportFile(argv[++i], "-exported_symbols_list", fExportSymbols);
+ }
+ else if ( strcmp(arg, "-unexported_symbols_list") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 1;
++#endif
+ if ( fExportMode == kExportSome )
+ throw "can't use -unexported_symbols_list and -exported_symbols_list";
+ fExportMode = kDontExportSome;
+@@ -2172,14 +2208,18 @@
+ fDontExportSymbols.insert(argv[++i]);
+ }
+ else if ( strcmp(arg, "-non_global_symbols_no_strip_list") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 1;
++#endif
+ if ( fLocalSymbolHandling == kLocalSymbolsSelectiveExclude )
+ throw "can't use -non_global_symbols_no_strip_list and -non_global_symbols_strip_list";
+ fLocalSymbolHandling = kLocalSymbolsSelectiveInclude;
+ loadExportFile(argv[++i], "-non_global_symbols_no_strip_list", fLocalSymbolsIncluded);
+ }
+ else if ( strcmp(arg, "-non_global_symbols_strip_list") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 1;
++#endif
+ if ( fLocalSymbolHandling == kLocalSymbolsSelectiveInclude )
+ throw "can't use -non_global_symbols_no_strip_list and -non_global_symbols_strip_list";
+ fLocalSymbolHandling = kLocalSymbolsSelectiveExclude;
+@@ -2195,16 +2235,20 @@
+ }
+ // Similar to -weak-l but uses the absolute path name to the library.
+ else if ( strcmp(arg, "-weak_library") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ // SNAPSHOT FIXME: what should we do for link snapshots? (ignore for now)
+ snapshotArgCount = 0;
++#endif
+ FileInfo info = findFile(argv[++i]);
+ info.options.fWeakImport = true;
+ info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
+ addLibrary(info);
+ }
+ else if ( strcmp(arg, "-lazy_library") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ // SNAPSHOT FIXME: what should we do for link snapshots? (ignore for now)
+ snapshotArgCount = 0;
++#endif
+ FileInfo info = findFile(argv[++i]);
+ info.options.fLazyLoad = true;
+ info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
+@@ -2212,22 +2256,28 @@
+ fUsingLazyDylibLinking = true;
+ }
+ else if ( strcmp(arg, "-framework") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotArgCount = 0;
++#endif
+ FileInfo info = findFramework(argv[++i]);
+ info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
+ addLibrary(info);
+ }
+ else if ( strcmp(arg, "-weak_framework") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ // SNAPSHOT FIXME: what should we do for link snapshots? (ignore for now)
+ snapshotArgCount = 0;
++#endif
+ FileInfo info = findFramework(argv[++i]);
+ info.options.fWeakImport = true;
+ info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
+ addLibrary(info);
+ }
+ else if ( strcmp(arg, "-lazy_framework") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ // SNAPSHOT FIXME: what should we do for link snapshots? (ignore for now)
+ snapshotArgCount = 0;
++#endif
+ FileInfo info = findFramework(argv[++i]);
+ info.options.fLazyLoad = true;
+ info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
+@@ -2305,8 +2355,10 @@
+ // This should probably be deprecated when we respect -L and -F
+ // when searching for libraries.
+ else if ( strcmp(arg, "-dylib_file") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ // ignore for snapshot because a stub dylib will be created in the snapshot
+ snapshotArgCount = 0;
++#endif
+ addDylibOverride(argv[++i]);
+ }
+ // What to expand @executable_path to if found in dependent dylibs
+@@ -2363,7 +2415,9 @@
+ }
+ // ??? Deprecate when we get rid of basing at build time.
+ else if ( strcmp(arg, "-seg_addr_table") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 1;
++#endif
+ const char* name = argv[++i];
+ if ( name == NULL )
+ throw "-seg_addr_table missing argument";
+@@ -2427,7 +2481,9 @@
+ i += 2;
+ }
+ else if ( strcmp(arg, "-bundle_loader") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 1;
++#endif
+ fBundleLoader = argv[++i];
+ if ( (fBundleLoader == NULL) || (fBundleLoader[0] == '-') )
+ throw "-bundle_loader missing <path>";
+@@ -2659,7 +2715,9 @@
+ // previously handled by buildSearchPaths()
+ }
+ else if ( strcmp(arg, "-syslibroot") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotArgCount = 0;
++#endif
+ ++i;
+ // previously handled by buildSearchPaths()
+ }
+@@ -2670,7 +2728,9 @@
+ fUUIDMode = kUUIDRandom;
+ }
+ else if ( strcmp(arg, "-dtrace") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 1;
++#endif
+ const char* name = argv[++i];
+ if ( name == NULL )
+ throw "-dtrace missing argument";
+@@ -2693,7 +2753,9 @@
+ fAliases.push_back(pair);
+ }
+ else if ( strcmp(arg, "-alias_list") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 1;
++#endif
+ parseAliasFile(argv[++i]);
+ }
+ else if ( strcmp(arg, "-save-temps") == 0 ) {
+@@ -2724,48 +2786,60 @@
+ fDisablePositionIndependentExecutable = true;
+ }
+ else if ( strncmp(arg, "-reexport-l", 11) == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ // SNAPSHOT FIXME: what should we do for link snapshots? (ignore for now)
+ snapshotArgCount = 0;
++#endif
+ FileInfo info = findLibrary(&arg[11], true);
+ info.options.fReExport = true;
+ info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
+ addLibrary(info);
+ }
+ else if ( strcmp(arg, "-reexport_library") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ // SNAPSHOT FIXME: what should we do for link snapshots? (ignore for now)
+ snapshotArgCount = 0;
++#endif
+ FileInfo info = findFile(argv[++i]);
+ info.options.fReExport = true;
+ info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
+ addLibrary(info);
+ }
+ else if ( strcmp(arg, "-reexport_framework") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ // SNAPSHOT FIXME: what should we do for link snapshots? (ignore for now)
+ snapshotArgCount = 0;
++#endif
+ FileInfo info = findFramework(argv[++i]);
+ info.options.fReExport = true;
+ info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
+ addLibrary(info);
+ }
+ else if ( strncmp(arg, "-upward-l", 9) == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ // SNAPSHOT FIXME: what should we do for link snapshots? (ignore for now)
+ snapshotArgCount = 0;
++#endif
+ FileInfo info = findLibrary(&arg[9], true);
+ info.options.fUpward = true;
+ info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
+ addLibrary(info);
+ }
+ else if ( strcmp(arg, "-upward_library") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ // SNAPSHOT FIXME: what should we do for link snapshots? (ignore for now)
+ snapshotArgCount = 0;
++#endif
+ FileInfo info = findFile(argv[++i]);
+ info.options.fUpward = true;
+ info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
+ addLibrary(info);
+ }
+ else if ( strcmp(arg, "-upward_framework") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ // SNAPSHOT FIXME: what should we do for link snapshots? (ignore for now)
+ snapshotArgCount = 0;
++#endif
+ FileInfo info = findFramework(argv[++i]);
+ info.options.fUpward = true;
+ info.ordinal = ld::File::Ordinal::makeArgOrdinal((uint16_t)i);
+@@ -2819,7 +2893,9 @@
+ fMarkDeadStrippableDylib = true;
+ }
+ else if ( strcmp(arg, "-exported_symbols_order") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 1;
++#endif
+ loadSymbolOrderFile(argv[++i], fExportSymbolsOrder);
+ }
+ else if ( strcmp(arg, "-no_compact_linkedit") == 0 ) {
+@@ -2911,11 +2987,15 @@
+ fObjcCategoryMerging = false;
+ }
+ else if ( strcmp(arg, "-force_symbols_weak_list") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 1;
++#endif
+ loadExportFile(argv[++i], "-force_symbols_weak_list", fForceWeakSymbols);
+ }
+ else if ( strcmp(arg, "-force_symbols_not_weak_list") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 1;
++#endif
+ loadExportFile(argv[++i], "-force_symbols_not_weak_list", fForceNotWeakSymbols);
+ }
+ else if ( strcmp(arg, "-force_symbol_weak") == 0 ) {
+@@ -2931,7 +3011,9 @@
+ fForceNotWeakSymbols.insert(symbol);
+ }
+ else if ( strcmp(arg, "-reexported_symbols_list") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 1;
++#endif
+ if ( fExportMode == kExportSome )
+ throw "can't use -exported_symbols_list and -reexported_symbols_list";
+ loadExportFile(argv[++i], "-reexported_symbols_list", fReExportSymbols);
+@@ -2947,6 +3029,7 @@
+ else if ( strcmp(arg, "-page_align_data_atoms") == 0 ) {
+ fPageAlignDataAtoms = true;
+ }
++#ifdef SUPPORT_SNAPSHOTS
+ else if (strcmp(arg, "-debug_snapshot") == 0) {
+ fLinkSnapshot.setSnapshotMode(Snapshot::SNAPSHOT_DEBUG);
+ fSnapshotRequested = true;
+@@ -2959,6 +3042,7 @@
+ fLinkSnapshot.setSnapshotPath(path);
+ fSnapshotRequested = true;
+ }
++#endif
+ else if ( strcmp(arg, "-new_main") == 0 ) {
+ fEntryPointLoadCommandForceOn = true;
+ }
+@@ -2993,7 +3077,9 @@
+ fKextsUseStubs = true;
+ }
+ else if ( strcmp(argv[i], "-dependency_info") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotArgCount = 0;
++#endif
+ ++i;
+ // previously handled by buildSearchPaths()
+ }
+@@ -3001,7 +3087,9 @@
+ fExportDynamic = true;
+ }
+ else if ( strcmp(arg, "-force_symbols_coalesce_list") == 0 ) {
++#ifdef SUPPORT_SNAPSHOTS
+ snapshotFileArgIndex = 1;
++#endif
+ loadExportFile(argv[++i], "-force_symbols_coalesce_list", fForceCoalesceSymbols);
+ }
+ else if ( strcmp(arg, "-add_linker_option") == 0 ) {
+@@ -3158,10 +3246,12 @@
+ throwf("unknown option: %s", arg);
+ }
+
++#ifdef SUPPORT_SNAPSHOTS
+ if (snapshotArgCount == -1)
+ snapshotArgCount = i-snapshotArgIndex+1;
+ if (snapshotArgCount > 0)
+ fLinkSnapshot.addSnapshotLinkArg(snapshotArgIndex, snapshotArgCount, snapshotFileArgIndex);
++#endif
+ }
+ else {
+ FileInfo info = findFile(arg);
+@@ -3180,8 +3270,10 @@
+ addLibrary(info);
+ }
+
++#ifdef SUPPORT_SNAPSHOTS
+ if (fSnapshotRequested)
+ fLinkSnapshot.createSnapshot();
++#endif
+ }
+
+
+@@ -3452,6 +3544,7 @@
+ if ( customDyldPath != NULL )
+ fDyldInstallPath = customDyldPath;
+
++#ifdef SUPPORT_SNAPSHOTS
+ const char* debugArchivePath = getenv("LD_DEBUG_SNAPSHOT");
+ if (debugArchivePath != NULL) {
+ fLinkSnapshot.setSnapshotMode(Snapshot::SNAPSHOT_DEBUG);
+@@ -3459,6 +3552,7 @@
+ fLinkSnapshot.setSnapshotPath(debugArchivePath);
+ fSnapshotRequested = true;
+ }
++#endif
+
+ const char* pipeFdString = getenv("LD_PIPELINE_FIFO");
+ if (pipeFdString != NULL) {
+@@ -4351,7 +4445,9 @@
+ if ( strcmp(&lastSlash[1], subUmbrella) == 0 ) {
+ info.options.fReExport = true;
+ found = true;
++#ifdef SUPPORT_SNAPSHOTS
+ fLinkSnapshot.recordSubUmbrella(info.path);
++#endif
+ break;
+ }
+ }
+@@ -4374,7 +4470,9 @@
+ if ( strncmp(&lastSlash[1], subLibrary, dot-lastSlash-1) == 0 ) {
+ info.options.fReExport = true;
+ found = true;
++#ifdef SUPPORT_SNAPSHOTS
+ fLinkSnapshot.recordSubLibrary(info.path);
++#endif
+ break;
+ }
+ }
+--- ld64-241.9/src/ld/Options.h.orig 2015-01-16 15:26:32.000000000 -0800
++++ ld64-241.9/src/ld/Options.h 2015-01-16 15:26:54.000000000 -0800
+@@ -48,7 +48,9 @@
+ extern void throwf (const char* format, ...) __attribute__ ((noreturn,format(printf, 1, 2)));
+ extern void warning(const char* format, ...) __attribute__((format(printf, 1, 2)));
+
++#ifdef SUPPORT_SNAPSHOTS
+ class Snapshot;
++#endif
+
+ class LibraryOptions
+ {
+@@ -379,7 +381,9 @@
+ bool forceWeakNonWildCard(const char* symbolName) const;
+ bool forceNotWeakNonWildcard(const char* symbolName) const;
+ bool forceCoalesce(const char* symbolName) const;
++#ifdef SUPPORT_SNAPSHOTS
+ Snapshot& snapshot() const { return fLinkSnapshot; }
++#endif
+ bool errorBecauseOfWarnings() const;
+ bool needsThreadLoadCommand() const { return fNeedsThreadLoadCommand; }
+ bool needsEntryPointLoadCommand() const { return fEntryPointLoadCommand; }
+@@ -677,8 +681,10 @@
+ std::vector<SymbolsMove> fSymbolsMovesCode;
+ std::vector<SymbolsMove> fSymbolsMovesZeroFill;
+ bool fSaveTempFiles;
++#ifdef SUPPORT_SNAPSHOTS
+ mutable Snapshot fLinkSnapshot;
+ bool fSnapshotRequested;
++#endif
+ const char* fPipelineFifo;
+ const char* fDependencyInfoPath;
+ mutable int fDependencyFileDescriptor;
+--- ld64-241.9/src/ld/Snapshot.cpp.orig 2014-09-10 15:24:46.000000000 -0700
++++ ld64-241.9/src/ld/Snapshot.cpp 2015-01-16 15:26:54.000000000 -0800
+@@ -6,6 +6,7 @@
+ // Copyright (c) 2011 Apple Inc. All rights reserved.
+ //
+
++#ifdef SUPPORT_SNAPSHOTS
+ #include <string.h>
+ #include <unistd.h>
+ #include <stdio.h>
+@@ -536,3 +538,5 @@
+ }
+ }
+ }
++
++#endif /* SUPPORT_SNAPSHOTS */
+--- ld64-236.3/src/ld/Snapshot.h.orig 2015-01-23 07:59:55.000000000 +0100
++++ ld64-236.3/src/ld/Snapshot.h 2015-01-23 07:58:14.000000000 +0100
+@@ -8,6 +8,8 @@
+
+ #ifndef ld64_Snapshot_h
+ #define ld64_Snapshot_h
++
++#ifdef SUPPORT_SNAPSHOTS
+ #include <stdint.h>
+ #include <string.h>
+ #include <map>
+@@ -151,3 +153,5 @@
+ };
+
+ #endif
++
++#endif
diff --git a/sys-devel/binutils-apple/files/ld64-241.9-register-names.patch b/sys-devel/binutils-apple/files/ld64-241.9-register-names.patch
new file mode 100644
index 000000000000..6b855e5883bd
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-241.9-register-names.patch
@@ -0,0 +1,50 @@
+Force use of old register names on old OS X (< 10.5).
+
+diff -ur ld64-241.9/src/ld/parsers/libunwind/Registers.hpp ld64-241.9/src/ld/parsers/libunwind/Registers.hpp
+--- ld64-241.9/src/ld/parsers/libunwind/Registers.hpp 2014-09-11 00:24:46.000000000 +0200
++++ ld64-241.9/src/ld/parsers/libunwind/Registers.hpp 2015-01-22 22:16:23.000000000 +0100
+@@ -40,6 +40,44 @@
+ #include "libunwind.h"
+ #include "InternalMacros.h"
+
++#include <AvailabilityMacros.h>
++
++#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
++/* member names of i386_thread_state and x86_thread_state64 have changed and
++ * default of __DARWIN_UNIX03 activating those new names as well. Instead of
++ * defining __DARWIN_UNIX03 with all its unknown consequences, we use defines
++ * to make our source use the old names on an old system. */
++
++#define __esp esp
++#define __eip eip
++#define __ebp ebp
++#define __ebx ebx
++#define __ecx ecx
++#define __edx edx
++#define __esi esi
++#define __edi edi
++#define __esp esp
++#define __eax eax
++#define __rip rip
++#define __rsp rsp
++#define __rax rax
++#define __rdx rdx
++#define __rcx rcx
++#define __rbx rbx
++#define __rsi rsi
++#define __rdi rdi
++#define __rbp rbp
++#define __rsp rsp
++#define __r8 r8
++#define __r9 r9
++#define __r10 r10
++#define __r11 r11
++#define __r12 r12
++#define __r13 r13
++#define __r14 r14
++#define __r15 r15
++#endif
++
+ namespace libunwind {
+
+
diff --git a/sys-devel/binutils-apple/files/ld64-95.2.12-Makefile b/sys-devel/binutils-apple/files/ld64-95.2.12-Makefile
new file mode 100644
index 000000000000..8016434d3849
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-95.2.12-Makefile
@@ -0,0 +1,26 @@
+CPPFLAGS += -Iinclude -Iabstraction -Ild -Iother -I.
+
+# dropped machocheck due to compilation failures
+all: rebase unwinddump dyldinfo ObjectDump ld64
+
+libprunetrie.a: other/PruneTrie.o other/prune_trie.h
+ $(AR) -s -r -c libprunetrie.a other/PruneTrie.o
+
+ld64: libprunetrie.a ld/ld.o ld/Options.o ld/debugline.o version.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
+
+rebase: other/rebase.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
+
+dyldinfo: other/dyldinfo.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
+
+unwinddump: other/unwinddump.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
+
+ObjectDump: other/ObjectDump.o ld/debugline.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
+
+machocheck: other/machochecker.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
+
diff --git a/sys-devel/binutils-apple/files/ld64-95.2.12-darwin8-no-mlong-branch-warning.patch b/sys-devel/binutils-apple/files/ld64-95.2.12-darwin8-no-mlong-branch-warning.patch
new file mode 100644
index 000000000000..790fb97339c5
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-95.2.12-darwin8-no-mlong-branch-warning.patch
@@ -0,0 +1,15 @@
+The whole system (/usr/bin/crt0.o for example) is long-branch compiled,
+so *any* linkage operation causes this warning to be raised. Don't do
+it.
+
+--- ld/MachOReaderRelocatable.hpp
++++ ld/MachOReaderRelocatable.hpp
+@@ -4165,8 +4165,6 @@
+ if ( nextReloc->r_type() != PPC_RELOC_PAIR ) {
+ throw "PPC_RELOC_JBSR missing following pair";
+ }
+- if ( !fHasLongBranchStubs )
+- warning("object file compiled with -mlong-branch which is no longer needed. To remove this warning, recompile without -mlong-branch: %s", fPath);
+ fHasLongBranchStubs = true;
+ result = true;
+ if ( reloc->r_extern() ) {
diff --git a/sys-devel/binutils-apple/files/libunwind-30-Makefile b/sys-devel/binutils-apple/files/libunwind-30-Makefile
new file mode 100644
index 000000000000..cb502d94868d
--- /dev/null
+++ b/sys-devel/binutils-apple/files/libunwind-30-Makefile
@@ -0,0 +1,23 @@
+CPPFLAGS += -I../include
+
+all: libunwind.a
+
+OBJS=Registers.o unw_getcontext.o libuwind.o UnwindLevel1-gcc-ext.o UnwindLevel1.o Unwind-sjlj.o
+
+libunwind.a: $(OBJS)
+ libtool -static -o $@ $^
+
+libunwind.dylib: $(OBJS)
+ $(CXX) $(CXXFLAGS) -dynamiclib -single_module -compatibility_version 1 -o $@ $^
+
+Registers.o: Registers.s
+ $(CXX) $(CPPFLAGS) $(CFLAGS) -c -o $@ $^
+
+unw_getcontext.o: unw_getcontext.s
+ $(CXX) $(CPPFLAGS) $(CFLAGS) -c -o $@ $^
+
+libuwind.o: libuwind.cxx
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(DYLDINCS) -c -o $@ $^
+
+%.o: %.c
+ $(CXX) $(CPPFLAGS) $(CFLAGS) -c -o $@ $^
diff --git a/sys-devel/binutils-apple/metadata.xml b/sys-devel/binutils-apple/metadata.xml
new file mode 100644
index 000000000000..6b093e5ee839
--- /dev/null
+++ b/sys-devel/binutils-apple/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>prefix</herd>
+ <use>
+ <flag name="lto">Add support for Link-Time Optimization with LLVM</flag>
+ <flag name="libcxx">Add support for libcxx</flag>
+ </use>
+</pkgmetadata>
diff --git a/sys-devel/binutils-config/binutils-config-1.9-r4.ebuild b/sys-devel/binutils-config/binutils-config-1.9-r4.ebuild
new file mode 100644
index 000000000000..ee750bdffb6b
--- /dev/null
+++ b/sys-devel/binutils-config/binutils-config-1.9-r4.ebuild
@@ -0,0 +1,19 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+DESCRIPTION="Utility to change the binutils version being used"
+HOMEPAGE="http://www.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+RDEPEND="userland_GNU? ( >=sys-apps/findutils-4.2 )"
+
+src_install() {
+ newbin "${FILESDIR}"/${PN}-${PV} ${PN} || die
+ doman "${FILESDIR}"/${PN}.8
+}
diff --git a/sys-devel/binutils-config/binutils-config-2-r1.ebuild b/sys-devel/binutils-config/binutils-config-2-r1.ebuild
new file mode 100644
index 000000000000..ee750bdffb6b
--- /dev/null
+++ b/sys-devel/binutils-config/binutils-config-2-r1.ebuild
@@ -0,0 +1,19 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+DESCRIPTION="Utility to change the binutils version being used"
+HOMEPAGE="http://www.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+RDEPEND="userland_GNU? ( >=sys-apps/findutils-4.2 )"
+
+src_install() {
+ newbin "${FILESDIR}"/${PN}-${PV} ${PN} || die
+ doman "${FILESDIR}"/${PN}.8
+}
diff --git a/sys-devel/binutils-config/binutils-config-3-r3.ebuild b/sys-devel/binutils-config/binutils-config-3-r3.ebuild
new file mode 100644
index 000000000000..7b52c186da89
--- /dev/null
+++ b/sys-devel/binutils-config/binutils-config-3-r3.ebuild
@@ -0,0 +1,19 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+DESCRIPTION="Utility to change the binutils version being used"
+HOMEPAGE="http://www.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+RDEPEND="userland_GNU? ( !<sys-apps/findutils-4.2 )"
+
+src_install() {
+ newbin "${FILESDIR}"/${PN}-${PV} ${PN} || die
+ doman "${FILESDIR}"/${PN}.8
+}
diff --git a/sys-devel/binutils-config/binutils-config-4-r1.ebuild b/sys-devel/binutils-config/binutils-config-4-r1.ebuild
new file mode 100644
index 000000000000..2bf97f349b32
--- /dev/null
+++ b/sys-devel/binutils-config/binutils-config-4-r1.ebuild
@@ -0,0 +1,24 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+DESCRIPTION="Utility to change the binutils version being used"
+HOMEPAGE="http://www.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+# We also RDEPEND on sys-apps/findutils which is in base @system
+RDEPEND="sys-apps/gentoo-functions"
+
+S=${WORKDIR}
+
+src_install() {
+ newbin "${FILESDIR}"/${PN}-${PV} ${PN}
+ doman "${FILESDIR}"/${PN}.8
+}
diff --git a/sys-devel/binutils-config/binutils-config-4-r2.ebuild b/sys-devel/binutils-config/binutils-config-4-r2.ebuild
new file mode 100644
index 000000000000..6adeaa037a7c
--- /dev/null
+++ b/sys-devel/binutils-config/binutils-config-4-r2.ebuild
@@ -0,0 +1,24 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+DESCRIPTION="Utility to change the binutils version being used"
+HOMEPAGE="http://www.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+# We also RDEPEND on sys-apps/findutils which is in base @system
+RDEPEND="sys-apps/gentoo-functions"
+
+S=${WORKDIR}
+
+src_install() {
+ newbin "${FILESDIR}"/${PN}-${PV} ${PN}
+ doman "${FILESDIR}"/${PN}.8
+}
diff --git a/sys-devel/binutils-config/binutils-config-4-r3.ebuild b/sys-devel/binutils-config/binutils-config-4-r3.ebuild
new file mode 100644
index 000000000000..53956f13904b
--- /dev/null
+++ b/sys-devel/binutils-config/binutils-config-4-r3.ebuild
@@ -0,0 +1,24 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+DESCRIPTION="Utility to change the binutils version being used"
+HOMEPAGE="http://www.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+# We also RDEPEND on sys-apps/findutils which is in base @system
+RDEPEND="sys-apps/gentoo-functions"
+
+S=${WORKDIR}
+
+src_install() {
+ newbin "${FILESDIR}"/${PN}-${PV} ${PN}
+ doman "${FILESDIR}"/${PN}.8
+}
diff --git a/sys-devel/binutils-config/files/binutils-config-1.9 b/sys-devel/binutils-config/files/binutils-config-1.9
new file mode 100755
index 000000000000..8a371d44ce3e
--- /dev/null
+++ b/sys-devel/binutils-config/files/binutils-config-1.9
@@ -0,0 +1,410 @@
+#!/bin/bash
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# Format of /etc/env.d/binutils/:
+# config-TARGET: CURRENT=version for TARGET
+# TARGET-VER: has a TARGET and VER variable
+
+[[ -z ${ROOT} ]] && ROOT="/"
+[[ ${ROOT} != */ ]] && ROOT="${ROOT}/"
+[[ ${ROOT} != /* ]] && ROOT="${PWD}${ROOT}"
+
+cd /
+
+trap ":" INT QUIT TSTP
+
+argv0=${0##*/}
+source /etc/init.d/functions.sh || {
+ echo "${argv0}: Could not source /etc/init.d/functions.sh!" 1>&2
+ exit 1
+}
+esyslog() { :; }
+umask 022
+
+usage() {
+cat << USAGE_END
+
+Usage: ${HILITE}binutils-config${NORMAL} ${GOOD}[options]${NORMAL} ${BRACKET}[binutils profile]${NORMAL}
+
+${HILITE}General Options:${NORMAL}
+ ${GOOD}-c, --get-current-profile${NORMAL} Print current profile
+ ${GOOD}-l, --list-profiles${NORMAL} Print a list of available profiles
+ ${GOOD}-u, --uninstall${NORMAL} Remove all signs of specified target
+ ${GOOD}-d, --debug${NORMAL} Execute with debug output
+
+${HILITE}Arch Specific Cruft:${NORMAL}
+ ${GOOD}--amd64${NORMAL} Install extra amd64 links (x86_64)
+ ${GOOD}--arm${NORMAL} Install extra arm links (arm/armeb)
+ ${GOOD}--mips${NORMAL} Install extra mips links (mips/mipsel)
+ ${GOOD}--x86${NORMAL} Install extra x86 links (i[3-6]86)
+
+Profile names are of the form: ${BRACKET}<CTARGET>-<binutils version>${NORMAL}
+For example: ${BRACKET}i686-pc-linux-gnu-2.15.92.0.2${NORMAL}
+
+For more info, please see ${HILITE}binutils-config${NORMAL}(8).
+USAGE_END
+}
+
+switch_profile() {
+ unset TARGET VER LIBPATH FAKE_TARGETS
+ source "${ENV_D}/${PROFILE}"
+ if [[ -z ${TARGET} ]] ; then
+ eerror "${PROFILE} is invalid (no \$TARGET defined) :("
+ return 1
+ fi
+ if [[ -z ${VER} ]] ; then
+ eerror "${PROFILE} is invalid (no \$VER defined) :("
+ return 1
+ fi
+
+ #
+ # Older installs don't have 'FAKE_TARGETS' defined, so lets
+ # update these env.d entries so that we don't force the poor
+ # user to re-emerge their binutils just for 1 envvar :/
+ #
+ if [[ ${FAKE_TARGETS-poor user} == "poor user" ]] ; then
+ local targ=${TARGET/-*}
+ local FAKE_TARGETS=${TARGET}
+ case ${targ} in
+ mips|powerpc|sparc)
+ FAKE_TARGETS="${FAKE_TARGETS} ${TARGET/-/64-}";;
+ mips64|powerpc64|sparc64)
+ FAKE_TARGETS="${FAKE_TARGETS} ${TARGET/64-/-}";;
+ esac
+ echo "FAKE_TARGETS=\"${FAKE_TARGETS}\"" >> "${ENV_D}/${PROFILE}"
+ fi
+ local fake_targ_append="${TARGET#*-}"
+ FAKE_TARGETS="${FAKE_TARGETS} ${FAKE_TARGETS_USER// /-${fake_targ_append} }"
+
+ ebegin "Switching to ${PROFILE}"
+
+ #
+ # Generate binary symlinks
+ # On systems that do 32bit/64bit, we need to fake an
+ # extra set of binary names (${FAKE_TARGETS})
+ #
+ BINPATH=""
+ BINPATH_LINKS=""
+ if [[ ${TARGET} != ${HOST} ]] ; then
+ #
+ # Newer paths: /usr/${HOST}/${TARGET}/...
+ # Older paths: /usr/${TARGET}/...
+ #
+ if [[ -d ${ROOT}/usr/${HOST}/${TARGET}/binutils-bin/${VER} ]] ; then
+ BINPATH=/usr/${HOST}/${TARGET}/binutils-bin/${VER}
+ BINPATH_LINKS=/usr/libexec/gcc/${TARGET}
+ fi
+ fi
+ if [[ -z ${BINPATH} ]] ; then
+ BINPATH=/usr/${TARGET}/binutils-bin/${VER}
+ BINPATH_LINKS=/usr/${TARGET}/bin
+ fi
+ cd "${ROOT}/${BINPATH}" || exit 1
+ mkdir -p "${ROOT}/${BINPATH_LINKS}" "${ROOT}/usr/bin"
+ for x in * ; do
+ ln -sf "${BINPATH}/${x}" "${ROOT}/${BINPATH_LINKS}/${x}"
+ ln -sf "${BINPATH_LINKS}/${x}" "${ROOT}"/usr/bin/${TARGET}-${x}
+ for fake in ${FAKE_TARGETS} ; do
+ [[ -f ${ENV_D}/config-${fake} ]] && continue
+ ln -sf "${BINPATH_LINKS}/${x}" "${ROOT}"/usr/bin/${fake}-${x}
+ done
+ if [[ ${TARGET} == ${HOST} ]] ; then
+ ln -sf ${TARGET}-${x} "${ROOT}"/usr/bin/${x}
+ fi
+ done
+
+ #
+ # Generate library / ldscripts symlinks
+ #
+ LIBPATH=${LIBPATH:-/usr/lib/binutils/${TARGET}/${VER}}
+ cd "${ROOT}/${LIBPATH}" || exit 1
+ if [[ ${TARGET} == ${HOST} ]] ; then
+ dstlib=${ROOT}/usr/${HOST}/lib
+ else
+ dstlib=${ROOT}/usr/${HOST}/${TARGET}/lib
+ # Clean out old path
+ rm -rf "${ROOT}"/usr/${TARGET}/lib/ldscripts
+ rmdir "${ROOT}"/usr/${TARGET}/lib >& /dev/null
+ fi
+ # When upgrading, we need to clean up ldscripts and libs
+ rm -rf "${dstlib}/ldscripts" "${ROOT}/${BINPATH_LINKS}"/ldscripts
+ mkdir -p "${dstlib}"
+ ln -sf "${LIBPATH}/ldscripts" "${dstlib}"/ldscripts
+ find -L "${dstlib}" -type l -exec rm {} \;
+ for x in lib* ; do
+ ln -sf "${LIBPATH}/${x}" "${dstlib}/${x}"
+ done
+
+ #
+ # Generate include symlinks
+ #
+ INCPATH=${LIBPATH}/include
+ if [[ -d ${ROOT}/${INCPATH} ]] ; then
+ cd "${ROOT}/${INCPATH}" || exit 1
+ if [[ ${HOST} == ${TARGET} ]] ; then
+ mkdir -p "${ROOT}/usr/include"
+ for x in * ; do
+ ln -sf "${INCPATH}/${x}" "${ROOT}/usr/include/${x}"
+ done
+ else
+ # Clean out old path
+ find . -type f -exec rm -f "${ROOT}/usr/${TARGET}/usr/include/{}" \;
+ rmdir "${ROOT}/usr/${TARGET}/usr/include" >& /dev/null
+ rmdir "${ROOT}/usr/${TARGET}/usr" >& /dev/null
+ rmdir "${ROOT}/usr/${TARGET}" >& /dev/null
+ fi
+ fi
+
+ #
+ # Make sure proper paths get updated
+ #
+ if [[ ${TARGET} == ${HOST} ]] ; then
+ DATAPATH=/usr/share/binutils-data/${TARGET}/${VER}
+ [[ -d ${DATAPATH}/man ]] && \
+ echo "MANPATH=${DATAPATH}/man" > "${ROOT}"/etc/env.d/05binutils
+ [[ -d ${DATAPATH}/info ]] && \
+ echo "INFOPATH=${DATAPATH}/info" >> "${ROOT}"/etc/env.d/05binutils
+ # hmm, `ld` has this in SEARCH_DIR(), but ld.so does not ...
+ echo "LDPATH=/usr/${TARGET}/lib" >> "${ROOT}"/etc/env.d/05binutils
+ fi
+
+ eend 0
+
+ echo "CURRENT=${VER}" > "${ENV_D}/config-${TARGET}"
+
+ #
+ # Regen env.d if need/can be
+ #
+ if [[ ${ROOT} == "/" ]] && [[ ${TARGET} == ${HOST} ]] ; then
+ env-update
+ echo
+ ewarn "Please remember to run:"
+ echo
+ ewarn " # source /etc/profile"
+ echo
+ fi
+
+ return 0
+}
+
+uninstall_target() {
+ if [[ ${TARGET} == ${HOST} ]] ; then
+ eerror "${argv0}: Refusing to uninstall native binutils"
+ exit 1
+ fi
+
+ shopt -s nullglob
+ PROFILE=""
+
+ for PROFILE in "${ENV_D}"/${TARGET}-* ; do
+ ewarn "Removing all signs of ${PROFILE##*/}"
+ rm -f "${ENV_D}"/${PROFILE}
+ done
+ if [[ -z ${PROFILE} ]] && [[ ! -e ${ENV_D}/config-${TARGET} ]] ; then
+ eerror "${argv0}: No profiles exist for '${TARGET}'"
+ exit 1
+ fi
+
+ rm -f "${ENV_D}"/config-${TARGET}
+
+ # XXX: we still leave behind FAKE_TARGETS in /usr/bin ...
+ for x in addr2line ar as c++filt elf2flt flthdr gprof ld ld.real \
+ nm objcopy objdump ranlib readelf size strings strip ; do
+ rm -f "${ROOT}"/usr/bin/${TARGET}-${x}
+ rm -f "${ROOT}"/usr/{${HOST}/,}${TARGET}/bin/${x}
+ rm -f "${ROOT}"/usr/libexec/gcc/${TARGET}/${x}
+ done
+ for x in ansidecl.h bfd.h bfdlink.h dis-asm.h symcat.h ; do
+ rm -f "${ROOT}"/usr/{${HOST}/,}${TARGET}/{usr/,}include/${x}
+ done
+ for x in bfd iberty opcodes ; do
+ rm -f "${ROOT}"/usr/${HOST}/${TARGET}/lib/lib${x}{{-*,}.so,.a,.la}
+ done
+ # Delete broken symlinks
+ local destdir="${ROOT}/usr/${HOST}/${TARGET}"
+ rm -f "${destdir}"/lib/ldscripts
+ find -L "${destdir}"/lib -type l -exec rm {} \;
+ rmdir "${destdir}"/lib "${destdir}" 2>/dev/null
+ rmdir "${destdir}"/{bin,include,lib,usr} "${destdir}" 2>/dev/null
+ rmdir "${ROOT}"/var/db/pkg/cross-${TARGET} 2>/dev/null
+
+ rm -f "${ENV_D}"/${TARGET}-*
+}
+
+get_current_profile() {
+ if [[ ! -f ${ENV_D}/config-${PROFILE} ]] ; then
+ eerror "${argv0}: No binutils profile is active!"
+ return 1
+ fi
+
+ source "${ENV_D}/config-${PROFILE}"
+
+ if [[ -z ${CURRENT} ]] ; then
+ eerror "${argv0}: No binutils profile is active!"
+ return 1
+ fi
+
+ echo "${PROFILE}-${CURRENT}"
+
+ return 0
+}
+
+list_profiles() {
+ local i=1
+
+ set_HOST
+
+ if [[ ${ROOT} != / ]] ; then
+ echo "Using binutils-config info in ${ROOT}"
+ fi
+ target=
+ for x in "${ENV_D}"/* ; do
+ if [[ -f ${x} ]] && [[ ${x/\/config-} == ${x} ]] ; then
+ source "${x}"
+ if [[ ${target} != ${TARGET} ]] ; then
+ [[ -n ${target} ]] && echo
+ target=${TARGET}
+ fi
+
+ x=${x##*/}
+ if [[ -e ${ENV_D}/config-${TARGET} ]] ; then
+ source "${ENV_D}/config-${TARGET}"
+ if [[ ${VER} == ${CURRENT} ]] ; then
+ [[ ${TARGET} == ${HOST} ]] \
+ && x="${x} ${GOOD}*${NORMAL}" \
+ || x="${x} ${HILITE}*${NORMAL}"
+ fi
+ fi
+ echo " [${i}] ${x}"
+ ((++i))
+ fi
+ done
+}
+
+set_HOST() {
+ [[ -n ${HOST} ]] && return 0
+
+ if [[ -z ${CHOST} ]] ; then
+ HOST=$(portageq envvar CHOST)
+ else
+ HOST=${CHOST}
+ fi
+}
+
+ENV_D="${ROOT}etc/env.d/binutils"
+
+DEBUG="no"
+NEED_ACTION="yes"
+DOIT="switch_profile"
+PROFILE=""
+FAKE_TARGETS_USER=""
+HOST=""
+
+while [[ $# -gt 0 ]] ; do
+ x=$1
+ shift
+ case ${x} in
+ -c|--get-current-profile)
+ if [[ ${NEED_ACTION} == "yes" ]] ; then
+ NEED_ACTION="no"
+ DOIT="get_current_profile"
+ fi
+ ;;
+ -d|--debug)
+ DEBUG="yes"
+ ;;
+ -l|--list-profiles)
+ if [[ ${NEED_ACTION} == "yes" ]] ; then
+ NEED_ACTION="no"
+ DOIT="list_profiles"
+ fi
+ ;;
+ -u|--uninstall)
+ if [[ ${NEED_ACTION} == "yes" ]] ; then
+ NEED_ACTION="no"
+ DOIT="uninstall_target"
+ TARGET=$1
+ shift
+ fi
+ ;;
+ -h|--help)
+ usage
+ exit 0
+ ;;
+ -V|--version)
+ cvsver="$Id$"
+ cvsver=${cvsver##*binutils-config-}
+ bver=${cvsver%%,v *}
+ cvsver=${cvsver#* }
+ echo "binutils-config-${bver} (r${cvsver%% *})"
+ exit 0
+ ;;
+ --amd64|--arm|--mips|--x86)
+ if [[ ${NEED_ACTION} == "yes" ]] ; then
+ # Make sure we have a space after each target
+ NEED_ACTION="no"
+ [[ -z ${PROFILE} ]] && PROFILE="current"
+ case ${x} in
+ --amd64) FAKE_TARGETS_USER="x86_64 ";;
+ --arm) FAKE_TARGETS_USER="arm armeb ";;
+ --x86) FAKE_TARGETS_USER="i386 i486 i586 i686 ";;
+ --mips) FAKE_TARGETS_USER="mips mips64 mipsel mipsel64 ";;
+ esac
+ fi
+ ;;
+ -*)
+ eerror "${0##*/}: Invalid switch! Try '--help'."
+ exit 1
+ ;;
+ *)
+ if [[ -n ${PROFILE} ]] && [[ ${PROFILE} != "current" ]] ; then
+ eerror "${argv0}: Too many arguments! Run ${argv0} without parameters for help."
+ exit 1
+ fi
+
+ if [[ -z $(echo ${x} | tr -d '[:digit:]') ]] ; then
+ # User gave us a # representing the profile
+ i=1
+ for y in "${ENV_D}"/* ; do
+ [[ ${y/config-} != ${y} ]] && continue
+
+ if [[ -f ${y} ]] && [[ ${x} -eq ${i} ]] ; then
+ PROFILE=${y##*/}
+ NEED_ACTION="no"
+ break
+ fi
+ ((++i))
+ done
+ fi
+
+ if [[ -z ${PROFILE} ]] ; then
+ # User gave us a full HOST-ver
+ x=${x##*/}
+ if [[ ! -f ${ENV_D}/${x} ]] && [[ ! -f ${ENV_D}/config-${x} ]] ; then
+ # Maybe they just gave us a ver ...
+ set_HOST
+ if [[ -f ${ENV_D}/${HOST}-${x} ]] ; then
+ x=${HOST}-${x}
+ else
+ eerror "${argv0}: Could not locate '$x' in '${ENV_D}/'!"
+ exit 1
+ fi
+ fi
+ PROFILE=${x}
+ NEED_ACTION="no"
+ fi
+ ;;
+ esac
+done
+
+[[ ${NEED_ACTION} == "yes" ]] && usage && exit 1
+[[ ${DEBUG} == "yes" ]] && set -x
+
+[[ ${DOIT} != "list_profiles" ]] && set_HOST
+[[ -z ${PROFILE} ]] && PROFILE=${HOST}
+[[ ${PROFILE} == "current" ]] && PROFILE=$(PROFILE=${HOST} get_current_profile)
+eval ${DOIT}
+
+# vim:ts=4
diff --git a/sys-devel/binutils-config/files/binutils-config-2 b/sys-devel/binutils-config/files/binutils-config-2
new file mode 100755
index 000000000000..48b9d518ce27
--- /dev/null
+++ b/sys-devel/binutils-config/files/binutils-config-2
@@ -0,0 +1,434 @@
+#!/bin/bash
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# Format of /etc/env.d/binutils/:
+# config-TARGET: CURRENT=version for TARGET
+# TARGET-VER: has a TARGET and VER variable
+
+: ${ROOT:=/}
+[[ ${ROOT} != */ ]] && ROOT="${ROOT}/"
+[[ ${ROOT} != /* ]] && ROOT="${PWD}${ROOT}"
+
+cd /
+
+trap ":" INT QUIT TSTP
+
+argv0=${0##*/}
+source /etc/init.d/functions.sh || {
+ echo "${argv0}: Could not source /etc/init.d/functions.sh!" 1>&2
+ exit 1
+}
+esyslog() { :; }
+umask 022
+
+usage() {
+cat << USAGE_END
+
+Usage: ${HILITE}binutils-config${NORMAL} ${GOOD}[options]${NORMAL} ${BRACKET}[binutils profile]${NORMAL}
+
+${HILITE}General Options:${NORMAL}
+ ${GOOD}-c, --get-current-profile${NORMAL} Print current profile
+ ${GOOD}-l, --list-profiles${NORMAL} Print a list of available profiles
+ ${GOOD}-u, --uninstall${NORMAL} Remove all signs of specified target
+ ${GOOD}-d, --debug${NORMAL} Execute with debug output
+
+${HILITE}Arch Specific Cruft:${NORMAL}
+ ${GOOD}--amd64${NORMAL} Install extra amd64 links (x86_64)
+ ${GOOD}--arm${NORMAL} Install extra arm links (arm/armeb)
+ ${GOOD}--mips${NORMAL} Install extra mips links (mips/mipsel)
+ ${GOOD}--x86${NORMAL} Install extra x86 links (i[3-6]86)
+
+Profile names are of the form: ${BRACKET}<CTARGET>-<binutils version>${NORMAL}
+For example: ${BRACKET}i686-pc-linux-gnu-2.15.92.0.2${NORMAL}
+
+For more info, please see ${HILITE}binutils-config${NORMAL}(8).
+USAGE_END
+
+ exit ${1:-1}
+}
+
+mv_if_diff() {
+ if cmp -s "$1" "$2" ; then
+ rm -f "$1"
+ else
+ mv -f "$1" "$2"
+ fi
+}
+
+switch_profile() {
+ unset TARGET VER LIBPATH FAKE_TARGETS
+ source "${ENV_D}/${PROFILE}"
+ if [[ -z ${TARGET} ]] ; then
+ eerror "${PROFILE} is invalid (no \$TARGET defined) :("
+ return 1
+ fi
+ if [[ -z ${VER} ]] ; then
+ eerror "${PROFILE} is invalid (no \$VER defined) :("
+ return 1
+ fi
+
+ #
+ # Older installs don't have 'FAKE_TARGETS' defined, so lets
+ # update these env.d entries so that we don't force the poor
+ # user to re-emerge their binutils just for 1 envvar :/
+ #
+ if [[ ${FAKE_TARGETS-poor user} == "poor user" ]] ; then
+ local targ=${TARGET/-*}
+ local FAKE_TARGETS=${TARGET}
+ case ${targ} in
+ mips|powerpc|sparc)
+ FAKE_TARGETS="${FAKE_TARGETS} ${TARGET/-/64-}";;
+ mips64|powerpc64|sparc64)
+ FAKE_TARGETS="${FAKE_TARGETS} ${TARGET/64-/-}";;
+ esac
+ echo "FAKE_TARGETS=\"${FAKE_TARGETS}\"" >> "${ENV_D}/${PROFILE}"
+ fi
+ local fake_targ_append="${TARGET#*-}"
+ FAKE_TARGETS="${FAKE_TARGETS} ${FAKE_TARGETS_USER// /-${fake_targ_append} }"
+
+ ebegin "Switching to ${PROFILE}"
+
+ #
+ # Generate binary symlinks
+ # On systems that do 32bit/64bit, we need to fake an
+ # extra set of binary names (${FAKE_TARGETS})
+ #
+ BINPATH=""
+ BINPATH_LINKS=""
+ if [[ ${TARGET} != ${HOST} ]] ; then
+ #
+ # Newer paths: /usr/${HOST}/${TARGET}/...
+ # Older paths: /usr/${TARGET}/...
+ #
+ if [[ -d ${ROOT}/usr/${HOST}/${TARGET}/binutils-bin/${VER} ]] ; then
+ BINPATH=/usr/${HOST}/${TARGET}/binutils-bin/${VER}
+ BINPATH_LINKS=/usr/libexec/gcc/${TARGET}
+ fi
+ fi
+ if [[ -z ${BINPATH} ]] ; then
+ BINPATH=/usr/${TARGET}/binutils-bin/${VER}
+ BINPATH_LINKS=/usr/${TARGET}/bin
+ fi
+ cd "${ROOT}/${BINPATH}" || exit 1
+ mkdir -p "${ROOT}/${BINPATH_LINKS}" "${ROOT}/usr/bin"
+ for x in * ; do
+ ln -sf "${BINPATH}/${x}" "${ROOT}/${BINPATH_LINKS}/${x}"
+ ln -sf "${BINPATH_LINKS}/${x}" "${ROOT}"/usr/bin/${TARGET}-${x}
+ for fake in ${FAKE_TARGETS} ; do
+ [[ -f ${ENV_D}/config-${fake} ]] && continue
+ ln -sf "${BINPATH_LINKS}/${x}" "${ROOT}"/usr/bin/${fake}-${x}
+ done
+ if [[ ${TARGET} == ${HOST} ]] ; then
+ ln -sf ${TARGET}-${x} "${ROOT}"/usr/bin/${x}
+ fi
+ done
+
+ #
+ # Generate library / ldscripts symlinks
+ #
+ : ${LIBPATH:=/usr/lib/binutils/${TARGET}/${VER}}
+ cd "${ROOT}/${LIBPATH}" || exit 1
+ if [[ ${TARGET} == ${HOST} ]] ; then
+ dstlib=${ROOT}/usr/${HOST}/lib
+ else
+ dstlib=${ROOT}/usr/${HOST}/${TARGET}/lib
+ # Clean out old path
+ rm -rf "${ROOT}"/usr/${TARGET}/lib/ldscripts
+ rmdir "${ROOT}"/usr/${TARGET}/lib >& /dev/null
+ fi
+ # When upgrading, we need to clean up ldscripts and libs
+ rm -rf "${dstlib}/ldscripts" "${ROOT}/${BINPATH_LINKS}"/ldscripts
+ mkdir -p "${dstlib}"
+ ln -sf "${LIBPATH}/ldscripts" "${dstlib}"/ldscripts
+ find -L "${dstlib}" -type l -exec rm {} +
+ for x in lib* ; do
+ ln -sf "${LIBPATH}/${x}" "${dstlib}/${x}"
+ done
+
+ #
+ # Generate include symlinks
+ #
+ INCPATH=${LIBPATH}/include
+ if [[ -d ${ROOT}/${INCPATH} ]] ; then
+ cd "${ROOT}/${INCPATH}" || exit 1
+ if [[ ${HOST} == ${TARGET} ]] ; then
+ mkdir -p "${ROOT}/usr/include"
+ for x in * ; do
+ ln -sf "${INCPATH}/${x}" "${ROOT}/usr/include/${x}"
+ done
+ else
+ # Clean out old path -- cannot use '-exec {} +' syntax here
+ find . -type f -exec rm -f "${ROOT}/usr/${TARGET}/usr/include/{}" \;
+ rmdir "${ROOT}/usr/${TARGET}/usr/include" >& /dev/null
+ rmdir "${ROOT}/usr/${TARGET}/usr" >& /dev/null
+ rmdir "${ROOT}/usr/${TARGET}" >& /dev/null
+ fi
+ fi
+
+ #
+ # Make sure proper paths get updated
+ #
+ if [[ ${TARGET} == ${HOST} ]] ; then
+ DATAPATH=/usr/share/binutils-data/${TARGET}/${VER}
+ local e="${ROOT}"/etc/env.d/05binutils
+ local ee="${e}.tmp"
+ rm -f "${ee}"
+ [[ -d ${DATAPATH}/man ]] && echo "MANPATH=${DATAPATH}/man" >> "${ee}"
+ [[ -d ${DATAPATH}/info ]] && echo "INFOPATH=${DATAPATH}/info" >> "${ee}"
+ # hmm, `ld` has this in SEARCH_DIR(), but ld.so does not ...
+ if [[ -d ${ROOT}/etc/ld.so.conf.d ]] ; then
+ local l="${ROOT}"/etc/ld.so.conf.d/05binutils.conf
+ local ll="${l}.tmp"
+ echo "/usr/${TARGET}/lib" > "${ll}"
+ mv_if_diff "${ll}" "${l}"
+ else
+ echo "LDPATH=/usr/${TARGET}/lib" >> "${ee}"
+ fi
+ mv_if_diff "${ee}" "${e}"
+ fi
+
+ local c="${ENV_D}/config-${TARGET}"
+ local cc="${c}.tmp"
+ echo "CURRENT=${VER}" > "${cc}"
+ mv_if_diff "${cc}" "${c}"
+
+ eend 0
+
+ #
+ # Regen env.d if need/can be
+ #
+ if [[ ${ROOT} == "/" ]] && [[ ${TARGET} == ${HOST} ]] ; then
+ env-update
+ echo
+ ewarn "Please remember to run:"
+ echo
+ ewarn " # . /etc/profile"
+ echo
+ fi
+
+ return 0
+}
+
+uninstall_target() {
+ if [[ ${TARGET} == ${HOST} ]] ; then
+ eerror "${argv0}: Refusing to uninstall native binutils"
+ exit 1
+ fi
+
+ shopt -s nullglob
+ PROFILE=""
+
+ for PROFILE in "${ENV_D}"/${TARGET}-* ; do
+ ewarn "Removing all signs of ${PROFILE##*/}"
+ rm -f "${ENV_D}"/${PROFILE}
+ done
+ if [[ -z ${PROFILE} ]] && [[ ! -e ${ENV_D}/config-${TARGET} ]] ; then
+ eerror "${argv0}: No profiles exist for '${TARGET}'"
+ exit 1
+ fi
+
+ rm -f "${ENV_D}"/config-${TARGET} "${ROOT}"/etc/ld.so.conf.d/05binutils.conf
+
+ # XXX: we still leave behind FAKE_TARGETS in /usr/bin ...
+ for x in addr2line ar as c++filt elf2flt flthdr gprof ld ld.real \
+ nm objcopy objdump ranlib readelf size strings strip ; do
+ rm -f "${ROOT}"/usr/bin/${TARGET}-${x}
+ rm -f "${ROOT}"/usr/{${HOST}/,}${TARGET}/bin/${x}
+ rm -f "${ROOT}"/usr/libexec/gcc/${TARGET}/${x}
+ done
+ for x in ansidecl.h bfd.h bfdlink.h dis-asm.h symcat.h ; do
+ rm -f "${ROOT}"/usr/{${HOST}/,}${TARGET}/{usr/,}include/${x}
+ done
+ for x in bfd iberty opcodes ; do
+ rm -f "${ROOT}"/usr/${HOST}/${TARGET}/lib/lib${x}{{-*,}.so,.a,.la}
+ done
+ # Delete broken symlinks
+ local destdir="${ROOT}/usr/${HOST}/${TARGET}"
+ rm -f "${destdir}"/lib/ldscripts
+ find -L "${destdir}"/lib -type l -exec rm {} +
+ rmdir \
+ "${destdir}"/{bin,include,lib,usr} \
+ "${destdir}" \
+ "${ROOT}"/var/db/pkg/cross-${TARGET} \
+ 2>/dev/null
+
+ rm -f "${ENV_D}"/${TARGET}-*
+}
+
+get_current_profile() {
+ if [[ ! -f ${ENV_D}/config-${PROFILE} ]] ; then
+ eerror "${argv0}: No binutils profile is active!"
+ return 1
+ fi
+
+ source "${ENV_D}/config-${PROFILE}"
+
+ if [[ -z ${CURRENT} ]] ; then
+ eerror "${argv0}: No binutils profile is active!"
+ return 1
+ fi
+
+ echo "${PROFILE}-${CURRENT}"
+
+ return 0
+}
+
+list_profiles() {
+ local i=1
+
+ set_HOST
+
+ if [[ ${ROOT} != / ]] ; then
+ echo "Using binutils-config info in ${ROOT}"
+ fi
+ target=
+ for x in "${ENV_D}"/* ; do
+ if [[ -f ${x} ]] && [[ ${x/\/config-} == ${x} ]] ; then
+ source "${x}"
+ if [[ ${target} != ${TARGET} ]] ; then
+ [[ -n ${target} ]] && echo
+ target=${TARGET}
+ fi
+
+ x=${x##*/}
+ if [[ -e ${ENV_D}/config-${TARGET} ]] ; then
+ source "${ENV_D}/config-${TARGET}"
+ if [[ ${VER} == ${CURRENT} ]] ; then
+ [[ ${TARGET} == ${HOST} ]] \
+ && x="${x} ${GOOD}*${NORMAL}" \
+ || x="${x} ${HILITE}*${NORMAL}"
+ fi
+ fi
+ echo " [${i}] ${x}"
+ ((++i))
+ fi
+ done
+}
+
+set_HOST() {
+ [[ -n ${HOST} ]] && return 0
+
+ if [[ -z ${CHOST} ]] ; then
+ HOST=$(portageq envvar CHOST)
+ else
+ HOST=${CHOST}
+ fi
+}
+
+ENV_D="${ROOT}etc/env.d/binutils"
+
+DEBUG="no"
+NEED_ACTION="yes"
+DOIT="switch_profile"
+PROFILE=""
+FAKE_TARGETS_USER=""
+HOST=""
+
+while [[ $# -gt 0 ]] ; do
+ x=$1
+ shift
+ case ${x} in
+ -c|--get-current-profile)
+ if [[ ${NEED_ACTION} == "yes" ]] ; then
+ NEED_ACTION="no"
+ DOIT="get_current_profile"
+ fi
+ ;;
+ -d|--debug)
+ DEBUG="yes"
+ ;;
+ -l|--list-profiles)
+ if [[ ${NEED_ACTION} == "yes" ]] ; then
+ NEED_ACTION="no"
+ DOIT="list_profiles"
+ fi
+ ;;
+ -u|--uninstall)
+ if [[ ${NEED_ACTION} == "yes" ]] ; then
+ NEED_ACTION="no"
+ DOIT="uninstall_target"
+ TARGET=$1
+ shift
+ fi
+ ;;
+ -h|--help)
+ usage 0
+ ;;
+ -V|--version)
+ unset Header
+ cvsver="$Id$"
+ cvsver=${cvsver##*binutils-config-}
+ bver=${cvsver%%,v *}
+ cvsver=${cvsver#* }
+ echo "binutils-config-${bver} (r${cvsver%% *})"
+ exit 0
+ ;;
+ --amd64|--arm|--mips|--x86)
+ if [[ ${NEED_ACTION} == "yes" ]] ; then
+ # Make sure we have a space after each target
+ NEED_ACTION="no"
+ [[ -z ${PROFILE} ]] && PROFILE="current"
+ case ${x} in
+ --amd64) FAKE_TARGETS_USER="x86_64 ";;
+ --arm) FAKE_TARGETS_USER="arm armeb ";;
+ --x86) FAKE_TARGETS_USER="i386 i486 i586 i686 ";;
+ --mips) FAKE_TARGETS_USER="mips mips64 mipsel mipsel64 ";;
+ esac
+ fi
+ ;;
+ -*)
+ eerror "${0##*/}: Invalid switch! Try '--help'."
+ exit 1
+ ;;
+ *)
+ if [[ -n ${PROFILE} ]] && [[ ${PROFILE} != "current" ]] ; then
+ eerror "${argv0}: Too many arguments! Run ${argv0} without parameters for help."
+ exit 1
+ fi
+
+ if [[ -z $(echo ${x} | tr -d '[:digit:]') ]] ; then
+ # User gave us a # representing the profile
+ i=1
+ for y in "${ENV_D}"/* ; do
+ [[ ${y/config-} != ${y} ]] && continue
+
+ if [[ -f ${y} ]] && [[ ${x} -eq ${i} ]] ; then
+ PROFILE=${y##*/}
+ NEED_ACTION="no"
+ break
+ fi
+ ((++i))
+ done
+ fi
+
+ if [[ -z ${PROFILE} ]] ; then
+ # User gave us a full HOST-ver
+ x=${x##*/}
+ if [[ ! -f ${ENV_D}/${x} ]] && [[ ! -f ${ENV_D}/config-${x} ]] ; then
+ # Maybe they just gave us a ver ...
+ set_HOST
+ if [[ -f ${ENV_D}/${HOST}-${x} ]] ; then
+ x=${HOST}-${x}
+ else
+ eerror "${argv0}: Could not locate '$x' in '${ENV_D}/'!"
+ exit 1
+ fi
+ fi
+ PROFILE=${x}
+ NEED_ACTION="no"
+ fi
+ ;;
+ esac
+done
+
+[[ ${NEED_ACTION} == "yes" ]] && usage 1
+[[ ${DEBUG} == "yes" ]] && set -x
+
+[[ ${DOIT} != "list_profiles" ]] && set_HOST
+[[ -z ${PROFILE} ]] && PROFILE=${HOST}
+[[ ${PROFILE} == "current" ]] && PROFILE=$(PROFILE=${HOST} get_current_profile)
+eval ${DOIT}
+
+# vim:ts=4
diff --git a/sys-devel/binutils-config/files/binutils-config-3 b/sys-devel/binutils-config/files/binutils-config-3
new file mode 100755
index 000000000000..a9e941241701
--- /dev/null
+++ b/sys-devel/binutils-config/files/binutils-config-3
@@ -0,0 +1,509 @@
+#!/bin/bash
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# Format of /etc/env.d/binutils/:
+# config-TARGET: CURRENT=version for TARGET
+# TARGET-VER: has a TARGET and VER variable
+
+: ${ROOT:=/}
+[[ ${ROOT} != */ ]] && ROOT="${ROOT}/"
+[[ ${ROOT} != /* ]] && ROOT="${PWD%/}/${ROOT}"
+
+cd /
+
+trap ":" INT QUIT TSTP
+
+argv0=${0##*/}
+source /etc/init.d/functions.sh || {
+ echo "${argv0}: Could not source /etc/init.d/functions.sh!" 1>&2
+ exit 1
+}
+esyslog() { :; }
+die() { eerror "${argv0}: $*"; exit 1; }
+umask 022
+
+usage() {
+cat << USAGE_END
+Usage: ${HILITE}binutils-config${NORMAL} ${GOOD}[options]${NORMAL} ${BRACKET}[binutils profile]${NORMAL}
+
+${HILITE}General Options:${NORMAL}
+ ${GOOD}-c, --get-current-profile${NORMAL} Print current profile
+ ${GOOD}-l, --list-profiles${NORMAL} Print a list of available profiles
+ ${GOOD}-u, --uninstall${NORMAL} Remove all signs of specified target
+ ${GOOD}-d, --debug${NORMAL} Execute with debug output
+
+${HILITE}General Cruft:${NORMAL}
+ ${GOOD}--linker${NORMAL} <linker> Switch to specified linker (if supported)
+
+${HILITE}Arch Specific Cruft:${NORMAL}
+ ${GOOD}--amd64${NORMAL} Install extra amd64 links (x86_64)
+ ${GOOD}--arm${NORMAL} Install extra arm links (arm/armeb)
+ ${GOOD}--mips${NORMAL} Install extra mips links (mips/mipsel)
+ ${GOOD}--x86${NORMAL} Install extra x86 links (i[3-6]86)
+
+Profile names are of the form: ${BRACKET}<CTARGET>-<binutils version>${NORMAL}
+For example: ${BRACKET}i686-pc-linux-gnu-2.15.92.0.2${NORMAL}
+
+For more info, please see ${HILITE}binutils-config${NORMAL}(8).
+USAGE_END
+
+ exit ${1:-1}
+}
+
+mv_if_diff() {
+ if cmp -s "$1" "$2" ; then
+ rm -f "$1"
+ else
+ mv -f "$1" "$2"
+ fi
+}
+atomic_ln() {
+ local target=$1 linkdir=$2 linkname=$3 linktmp linkfull
+ linktmp="${linkdir}/.binutils-config.tmp.${linkname}"
+ linkfull="${linkdir}/${linkname}"
+ if [[ -d ${linkfull} ]] ; then
+ # if linking to a dir, we need a little magic to
+ # make it atomic since `mv -T` is not portable
+ rm -rf "${linktmp}"
+ mkdir -p "${linktmp}"
+ ln -sf "${target}" "${linktmp}/${linkname}"
+ mv "${linktmp}/${linkname}" "${linktmp}/../"
+ rmdir "${linktmp}"
+ else
+ # `ln` will expand into unlink();symlink(); which
+ # is not atomic for a small amount of time, but
+ # `mv` is a single rename() call
+ ln -sf "${target}" "${linktmp}"
+ mv "${linktmp}" "${linkfull}"
+ fi
+}
+
+setup_env() {
+ unset TARGET VER LIBPATH FAKE_TARGETS
+ source "${ENV_D}/${PROFILE}"
+ if [[ -z ${TARGET} ]] ; then
+ eerror "${PROFILE} is invalid (no \$TARGET defined) :("
+ return 1
+ fi
+ if [[ -z ${VER} ]] ; then
+ eerror "${PROFILE} is invalid (no \$VER defined) :("
+ return 1
+ fi
+
+ #
+ # Older installs don't have 'FAKE_TARGETS' defined, so lets
+ # update these env.d entries so that we don't force the poor
+ # user to re-emerge their binutils just for 1 envvar :/
+ #
+ if [[ ${FAKE_TARGETS-poor user} == "poor user" ]] ; then
+ local targ=${TARGET/-*}
+ local FAKE_TARGETS=${TARGET}
+ case ${targ} in
+ mips|powerpc|sparc)
+ FAKE_TARGETS="${FAKE_TARGETS} ${TARGET/-/64-}";;
+ mips64|powerpc64|sparc64)
+ FAKE_TARGETS="${FAKE_TARGETS} ${TARGET/64-/-}";;
+ esac
+ echo "FAKE_TARGETS=\"${FAKE_TARGETS}\"" >> "${ENV_D}/${PROFILE}"
+ fi
+ local fake_targ_append="${TARGET#*-}"
+ FAKE_TARGETS="${FAKE_TARGETS} ${FAKE_TARGETS_USER// /-${fake_targ_append} }"
+
+ #
+ # Generate binary symlinks
+ # On systems that do 32bit/64bit, we need to fake an
+ # extra set of binary names (${FAKE_TARGETS})
+ #
+ BINPATH=""
+ BINPATH_LINKS=""
+ if [[ ${TARGET} != ${HOST} ]] ; then
+ #
+ # Newer paths: /usr/${HOST}/${TARGET}/...
+ # Older paths: /usr/${TARGET}/...
+ #
+ if [[ -d ${ROOT}/usr/${HOST}/${TARGET}/binutils-bin/${VER} ]] ; then
+ BINPATH=/usr/${HOST}/${TARGET}/binutils-bin/${VER}
+ BINPATH_LINKS=/usr/libexec/gcc/${TARGET}
+ fi
+ fi
+ if [[ -z ${BINPATH} ]] ; then
+ BINPATH=/usr/${TARGET}/binutils-bin/${VER}
+ BINPATH_LINKS=/usr/${TARGET}/bin
+ fi
+}
+
+switch_profile() {
+ ebegin "Switching to ${PROFILE}"
+
+ setup_env || return 1
+
+ cd "${ROOT}/${BINPATH}" || exit 1
+ mkdir -p "${ROOT}/${BINPATH_LINKS}" "${ROOT}/usr/bin"
+ for x in * ; do
+ atomic_ln "${BINPATH}/${x}" "${ROOT}/${BINPATH_LINKS}" "${x}"
+ atomic_ln "${BINPATH_LINKS}/${x}" "${ROOT}/usr/bin/" "${TARGET}-${x}"
+ for fake in ${FAKE_TARGETS} ; do
+ [[ -f ${ENV_D}/config-${fake} ]] && continue
+ atomic_ln "${BINPATH_LINKS}/${x}" "${ROOT}/usr/bin" "${fake}-${x}"
+ done
+ if [[ ${TARGET} == ${HOST} ]] ; then
+ atomic_ln "${TARGET}-${x}" "${ROOT}/usr/bin" "${x}"
+ fi
+ done
+
+ #
+ # Generate library / ldscripts symlinks
+ #
+ : ${LIBPATH:=/usr/lib/binutils/${TARGET}/${VER}}
+ cd "${ROOT}/${LIBPATH}" || exit 1
+ if [[ ${TARGET} == ${HOST} ]] ; then
+ dstlib=${ROOT}/usr/${HOST}/lib
+ else
+ dstlib=${ROOT}/usr/${HOST}/${TARGET}/lib
+ fi
+ # When upgrading, we need to clean up ldscripts and libs
+ mkdir -p "${dstlib}"
+ rm -rf "${ROOT}/${BINPATH_LINKS}"/ldscripts
+ atomic_ln "${LIBPATH}/ldscripts" "${dstlib}" "ldscripts"
+ find -L "${dstlib}" -type l -exec rm -v {} +
+ for x in lib* ; do
+ atomic_ln "${LIBPATH}/${x}" "${dstlib}" "${x}"
+ done
+
+ #
+ # Generate include symlinks
+ #
+ INCPATH=${LIBPATH}/include
+ if [[ -d ${ROOT}/${INCPATH} ]] ; then
+ cd "${ROOT}/${INCPATH}" || exit 1
+ if [[ ${HOST} == ${TARGET} ]] ; then
+ mkdir -p "${ROOT}/usr/include"
+ for x in * ; do
+ atomic_ln "${INCPATH}/${x}" "${ROOT}/usr/include" "${x}"
+ done
+ else
+ # Clean out old path -- cannot use '-exec {} +' syntax here
+ find . -type f -exec rm -f "${ROOT}/usr/${TARGET}/usr/include/{}" \;
+ rmdir "${ROOT}/usr/${TARGET}/usr/include" >& /dev/null
+ rmdir "${ROOT}/usr/${TARGET}/usr" >& /dev/null
+ rmdir "${ROOT}/usr/${TARGET}" >& /dev/null
+ fi
+ fi
+
+ #
+ # Make sure proper paths get updated
+ #
+ if [[ ${TARGET} == ${HOST} ]] ; then
+ DATAPATH=/usr/share/binutils-data/${TARGET}/${VER}
+ local e="${ROOT}"/etc/env.d/05binutils
+ local ee="${e}.tmp"
+ rm -f "${ee}"
+ [[ -d ${DATAPATH}/man ]] && echo "MANPATH=${DATAPATH}/man" >> "${ee}"
+ [[ -d ${DATAPATH}/info ]] && echo "INFOPATH=${DATAPATH}/info" >> "${ee}"
+ # hmm, `ld` has this in SEARCH_DIR(), but ld.so does not ...
+ if [[ -d ${ROOT}/etc/ld.so.conf.d ]] ; then
+ local l="${ROOT}"/etc/ld.so.conf.d/05binutils.conf
+ local ll="${l}.tmp"
+ echo "/usr/${TARGET}/lib" > "${ll}"
+ mv_if_diff "${ll}" "${l}"
+ else
+ echo "LDPATH=/usr/${TARGET}/lib" >> "${ee}"
+ fi
+ mv_if_diff "${ee}" "${e}"
+ fi
+
+ local c="${ENV_D}/config-${TARGET}"
+ local cc="${c}.tmp"
+ echo "CURRENT=${VER}" > "${cc}"
+ mv_if_diff "${cc}" "${c}"
+
+ eend 0
+
+ #
+ # Regen env.d if need/can be
+ #
+ if [[ ${ROOT} == "/" ]] && [[ ${TARGET} == ${HOST} ]] ; then
+ env-update
+ echo
+ ewarn "Please remember to run:"
+ echo
+ ewarn " # . /etc/profile"
+ echo
+ fi
+
+ return 0
+}
+
+uninstall_target() {
+ : ${TARGET:=${UARG}}
+
+ if [[ ${TARGET} == ${HOST} ]] ; then
+ die "refusing to uninstall native binutils"
+ fi
+
+ shopt -s nullglob
+ PROFILE=""
+
+ for PROFILE in "${ENV_D}"/${TARGET}-* ; do
+ ewarn "Removing all signs of ${PROFILE##*/}"
+ rm -f "${ENV_D}"/${PROFILE}
+ done
+ if [[ -z ${PROFILE} ]] && [[ ! -e ${ENV_D}/config-${TARGET} ]] ; then
+ die "no profiles exist for '${TARGET}'"
+ fi
+
+ rm -f "${ENV_D}"/config-${TARGET} "${ROOT}"/etc/ld.so.conf.d/05binutils.conf
+
+ # XXX: we still leave behind FAKE_TARGETS in /usr/bin ...
+ local x
+ for x in \
+ addr2line ar as c++filt elf2flt elfedit flthdr gprof \
+ ld ld.{bfd,gold,real} \
+ nm objcopy objdump ranlib readelf size strings strip
+ do
+ x=(
+ "${ROOT}"/usr/bin/${TARGET}-${x}
+ "${ROOT}"/usr/{${HOST}/,}${TARGET}/bin/${x}
+ "${ROOT}"/usr/libexec/gcc/${TARGET}/${x}
+ )
+ rm -f "${x[@]}"
+ done
+ for x in ansidecl.h bfd.h bfdlink.h dis-asm.h symcat.h ; do
+ rm -f "${ROOT}"/usr/{${HOST}/,}${TARGET}/{usr/,}include/${x}
+ done
+ for x in bfd iberty opcodes ; do
+ rm -f "${ROOT}"/usr/${HOST}/${TARGET}/lib/lib${x}{{-*,}.so,.a,.la}
+ done
+ # Delete broken symlinks
+ local destdir="${ROOT}/usr/${HOST}/${TARGET}"
+ rm -f "${destdir}"/lib/ldscripts
+ find -L "${destdir}"/lib -type l -exec rm {} +
+ rmdir \
+ "${destdir}"/{bin,include,lib,usr} \
+ "${destdir}" \
+ "${ROOT}"/var/db/pkg/cross-${TARGET} \
+ "${ROOT}"/usr/{${HOST}/,}${TARGET}/bin \
+ "${ROOT}"/usr/libexec/gcc/${TARGET} \
+ 2>/dev/null
+
+ rm -f "${ENV_D}"/${TARGET}-*
+}
+
+set_current_profile() {
+ if [[ ! -f ${ENV_D}/config-${TARGET} ]] ; then
+ eerror "${argv0}: unable to locate a profile for target: ${TARGET}"
+ return 1
+ fi
+
+ source "${ENV_D}/config-${TARGET}"
+
+ if [[ -z ${CURRENT} ]] ; then
+ eerror "${argv0}: no binutils profile is active!"
+ return 1
+ fi
+
+ echo "${TARGET}-${CURRENT}"
+
+ return 0
+}
+get_current_profile() { echo "${PROFILE}" ; }
+
+list_profiles() {
+ local x i target
+
+ if [[ ${ROOT} != / ]] ; then
+ echo "Using binutils-config info in ${ROOT}"
+ fi
+
+ set -- "${ENV_D}"/*
+ target=
+ i=1
+
+ for x ; do
+ # skip broken links and config files
+ [[ -f ${x} ]] || continue
+ [[ ${x} == */config-* ]] && continue
+
+ source "${x}"
+ if [[ ${target} != ${TARGET} ]] ; then
+ [[ -n ${target} ]] && echo
+ target=${TARGET}
+ fi
+
+ x=${x##*/}
+ if [[ -e ${ENV_D}/config-${TARGET} ]] ; then
+ source "${ENV_D}/config-${TARGET}"
+ if [[ ${VER} == ${CURRENT} ]] ; then
+ [[ ${TARGET} == ${HOST} ]] \
+ && x="${x} ${GOOD}*${NORMAL}" \
+ || x="${x} ${HILITE}*${NORMAL}"
+ fi
+ fi
+
+ # We would align the [...] field like so:
+ #printf ' [%*ss] %s\n' ${##} "${i}" "${x}"
+ # but this breaks simple scripting: `binutils -l | awk '{print $2}'`
+
+ # Or we could align the target col like so:
+ #printf ' [%s]%*s %s\n' "${i}" $(( ${##} - ${#i} )) "" "${x}"
+ # but i'm not sold that it looks better
+
+ # So keep it simple ... only makes a diff anyways for crazy people
+ # like me which have 100+ binutils packages installed ...
+ echo " [$i] ${x}"
+ ((++i))
+ done
+}
+
+switch_linker() {
+ local bpath ld=$1
+
+ case ${ld} in
+ ld.*) ;;
+ *) die "not supported: linker must start with 'ld.'" ;;
+ esac
+
+ setup_env || return 1
+ bpath="${ROOT}/${BINPATH}"
+
+ # does this binutils even support the requested linker ?
+ if [[ ! -e ${bpath}/${ld} ]] ; then
+ die "sorry, but ${PROFILE} doesn't support the ${ld} linker"
+ fi
+
+ # switch it up
+ ebegin "Setting default linker to ${ld} for ${PROFILE}"
+ atomic_ln ${ld} "${bpath}" ld
+ eend $?
+}
+
+set_HOST() {
+ # Set HOST to CHOST if it isn't already set
+ : ${HOST:=${CHOST:-$(portageq envvar CHOST)}}
+}
+
+ENV_D="${ROOT}etc/env.d/binutils"
+
+DEBUG="no"
+NEED_ACTION="yes"
+DOIT="switch_profile"
+PROFILE="current"
+FAKE_TARGETS_USER=""
+HOST=""
+TARGET=""
+unset UARG
+
+select_action() {
+ if [[ ${NEED_ACTION} != "no" ]] ; then
+ NEED_ACTION="no"
+ DOIT=$1
+ else
+ die "one action at a time!"
+ fi
+}
+
+while [[ $# -gt 0 ]] ; do
+ x=$1
+ shift
+ case ${x} in
+ -c|--get-current-profile) select_action get_current_profile ;;
+ -l|--list|--list-profiles) select_action list_profiles ;;
+ -u|--uninstall) select_action uninstall_target ;;
+ --linker) select_action "switch_linker $1"; shift ;;
+ -d|--debug) DEBUG="yes" ;;
+ -h|--help) usage 0 ;;
+ -V|--version)
+ unset Header
+ cvsver="$Id$"
+ cvsver=${cvsver##*binutils-config-}
+ bver=${cvsver%%,v *}
+ cvsver=${cvsver#* }
+ echo "binutils-config-${bver} (r${cvsver%% *})"
+ exit 0
+ ;;
+ --amd64|--arm|--mips|--x86)
+ if [[ ${NEED_ACTION} == "yes" ]] ; then
+ # Make sure we have a space after each target
+ NEED_ACTION="no"
+ case ${x} in
+ --amd64) FAKE_TARGETS_USER="x86_64 ";;
+ --arm) FAKE_TARGETS_USER="arm armeb ";;
+ --x86) FAKE_TARGETS_USER="i386 i486 i586 i686 ";;
+ --mips) FAKE_TARGETS_USER="mips mips64 mipsel mipsel64 ";;
+ esac
+ fi
+ ;;
+ -*)
+ die "invalid switch! Try '--help'."
+ ;;
+ *)
+ if [[ ${UARG+set} == "set" ]] ; then
+ die "only one profile/target at a time please"
+ fi
+ NEED_ACTION="maybe"
+ UARG=${x}
+ ;;
+ esac
+done
+
+[[ ${NEED_ACTION} == "yes" ]] && usage 1
+[[ ${DEBUG} == "yes" ]] && set -x
+
+# All operations need to know the current HOST to figure out
+# what is a native target and what is a cross target
+set_HOST
+
+# All operations need to know the profile the user wants
+case ${DOIT} in
+switch_profile|switch_linker_*)
+ # decode user's profile choice
+ x=${UARG:-$(TARGET=${HOST} set_current_profile)}
+ PROFILE=""
+ if [[ -z $(echo ${x} | tr -d '[:digit:]') ]] ; then
+ # User gave us a # representing the profile
+ i=1
+ for y in "${ENV_D}"/* ; do
+ [[ ${y/config-} != ${y} ]] && continue
+
+ if [[ -f ${y} ]] && [[ ${x} -eq ${i} ]] ; then
+ PROFILE=${y##*/}
+ break
+ fi
+ ((++i))
+ done
+ fi
+
+ if [[ -z ${PROFILE} ]] ; then
+ # User gave us a full HOST-ver
+ x=${x##*/}
+ if [[ -f ${ENV_D}/${x} ]] ; then
+ # Valid HOST-ver yeah!
+ PROFILE=${x}
+ else
+ # Not a valid HOST-ver ...
+ if [[ ! -f ${ENV_D}/config-${x} ]] ; then
+ # Maybe they just gave us a ver ...
+ if [[ -f ${ENV_D}/${HOST}-${x} ]] ; then
+ x=${HOST}-${x}
+ else
+ die "could not locate '$x' in '${ENV_D}/'!"
+ fi
+ PROFILE=${x}
+ else
+ # Maybe they just gave us a target ... pick active profile
+ PROFILE=$(TARGET=${x} set_current_profile)
+ fi
+ fi
+ fi
+ ;;
+*)
+ # lookup current profile as the user gave us a target
+ PROFILE=$(TARGET=${UARG:-${HOST}} set_current_profile) || exit 1
+ ;;
+esac
+
+eval ${DOIT}
+
+# vim:ts=4
diff --git a/sys-devel/binutils-config/files/binutils-config-4 b/sys-devel/binutils-config/files/binutils-config-4
new file mode 100755
index 000000000000..18fc00d87110
--- /dev/null
+++ b/sys-devel/binutils-config/files/binutils-config-4
@@ -0,0 +1,465 @@
+#!/bin/bash
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# Format of /etc/env.d/binutils/:
+# config-TARGET: CURRENT=version for TARGET
+# TARGET-VER: has a TARGET and VER variable
+
+: ${ROOT:=/}
+[[ ${ROOT} != */ ]] && ROOT="${ROOT}/"
+[[ ${ROOT} != /* ]] && ROOT="${PWD%/}/${ROOT}"
+
+cd /
+
+trap ":" INT QUIT TSTP
+
+argv0=${0##*/}
+FUNCTIONS_SH="/lib/gentoo/functions.sh"
+source ${FUNCTIONS_SH} || {
+ echo "${argv0}: Could not source ${FUNCTIONS_SH}!" 1>&2
+ exit 1
+}
+esyslog() { :; }
+die() { eerror "${argv0}: $*"; exit 1; }
+umask 022
+
+usage() {
+cat << USAGE_END
+Usage: ${HILITE}binutils-config${NORMAL} ${GOOD}[options]${NORMAL} ${BRACKET}[binutils profile]${NORMAL}
+
+${HILITE}General Options:${NORMAL}
+ ${GOOD}-c, --get-current-profile${NORMAL} Print current profile
+ ${GOOD}-l, --list-profiles${NORMAL} Print a list of available profiles
+ ${GOOD}-u, --uninstall${NORMAL} Remove all signs of specified target
+ ${GOOD}-d, --debug${NORMAL} Execute with debug output
+
+${HILITE}General Cruft:${NORMAL}
+ ${GOOD}--linker${NORMAL} <linker> Switch to specified linker (if supported)
+
+Profile names are of the form: ${BRACKET}<CTARGET>-<binutils version>${NORMAL}
+For example: ${BRACKET}i686-pc-linux-gnu-2.15.92.0.2${NORMAL}
+
+For more info, please see ${HILITE}binutils-config${NORMAL}(8).
+USAGE_END
+
+ exit ${1:-1}
+}
+
+mv_if_diff() {
+ if cmp -s "$1" "$2" ; then
+ rm -f "$1"
+ else
+ mv -f "$1" "$2"
+ fi
+}
+atomic_ln() {
+ local target=$1 linkdir=$2 linkname=$3 linktmp linkfull
+ linktmp="${linkdir}/.binutils-config.tmp.${linkname}"
+ linkfull="${linkdir}/${linkname}"
+ if [[ -d ${linkfull} ]] ; then
+ # if linking to a dir, we need a little magic to
+ # make it atomic since `mv -T` is not portable
+ rm -rf "${linktmp}"
+ mkdir -p "${linktmp}"
+ ln -sf "${target}" "${linktmp}/${linkname}"
+ mv "${linktmp}/${linkname}" "${linktmp}/../"
+ rmdir "${linktmp}"
+ else
+ # `ln` will expand into unlink();symlink(); which
+ # is not atomic for a small amount of time, but
+ # `mv` is a single rename() call
+ ln -sf "${target}" "${linktmp}"
+ mv "${linktmp}" "${linkfull}"
+ fi
+}
+
+setup_env() {
+ unset TARGET VER LIBPATH
+ source "${ENV_D}/${PROFILE}"
+ if [[ -z ${TARGET} ]] ; then
+ eerror "${PROFILE} is invalid (no \$TARGET defined) :("
+ return 1
+ fi
+ if [[ -z ${VER} ]] ; then
+ eerror "${PROFILE} is invalid (no \$VER defined) :("
+ return 1
+ fi
+
+ #
+ # Generate binary symlinks
+ #
+ BINPATH=""
+ BINPATH_LINKS=""
+ if [[ ${TARGET} != ${HOST} ]] ; then
+ #
+ # Newer paths: /usr/${HOST}/${TARGET}/...
+ # Older paths: /usr/${TARGET}/...
+ #
+ if [[ -d ${ROOT}/usr/${HOST}/${TARGET}/binutils-bin/${VER} ]] ; then
+ BINPATH=/usr/${HOST}/${TARGET}/binutils-bin/${VER}
+ BINPATH_LINKS=/usr/libexec/gcc/${TARGET}
+ fi
+ fi
+ if [[ -z ${BINPATH} ]] ; then
+ BINPATH=/usr/${TARGET}/binutils-bin/${VER}
+ BINPATH_LINKS=/usr/${TARGET}/bin
+ fi
+}
+
+switch_profile() {
+ ebegin "Switching to ${PROFILE}"
+
+ setup_env || return 1
+
+ cd "${ROOT}/${BINPATH}" || exit 1
+ mkdir -p "${ROOT}/${BINPATH_LINKS}" "${ROOT}/usr/bin"
+ for x in * ; do
+ atomic_ln "${BINPATH}/${x}" "${ROOT}/${BINPATH_LINKS}" "${x}"
+ atomic_ln "${BINPATH_LINKS}/${x}" "${ROOT}/usr/bin" "${TARGET}-${x}"
+ if [[ ${TARGET} == ${HOST} ]] ; then
+ atomic_ln "${TARGET}-${x}" "${ROOT}/usr/bin" "${x}"
+ fi
+ done
+
+ #
+ # Generate library / ldscripts symlinks
+ #
+ : ${LIBPATH:=/usr/lib/binutils/${TARGET}/${VER}}
+ cd "${ROOT}/${LIBPATH}" || exit 1
+ if [[ ${TARGET} == ${HOST} ]] ; then
+ dstlib=${ROOT}/usr/${HOST}/lib
+ else
+ dstlib=${ROOT}/usr/${HOST}/${TARGET}/lib
+ fi
+ # When upgrading, we need to clean up ldscripts and libs
+ mkdir -p "${dstlib}"
+ rm -rf "${ROOT}/${BINPATH_LINKS}"/ldscripts
+ atomic_ln "${LIBPATH}/ldscripts" "${dstlib}" "ldscripts"
+ find -L "${dstlib}" -type l -exec rm -v {} +
+ for x in lib* ; do
+ atomic_ln "${LIBPATH}/${x}" "${dstlib}" "${x}"
+ done
+
+ #
+ # Generate include symlinks
+ #
+ INCPATH=${LIBPATH}/include
+ if [[ -d ${ROOT}/${INCPATH} ]] ; then
+ cd "${ROOT}/${INCPATH}" || exit 1
+ if [[ ${HOST} == ${TARGET} ]] ; then
+ mkdir -p "${ROOT}/usr/include"
+ for x in * ; do
+ atomic_ln "${INCPATH}/${x}" "${ROOT}/usr/include" "${x}"
+ done
+ else
+ # Clean out old path -- cannot use '-exec {} +' syntax here
+ find . -type f -exec rm -f "${ROOT}/usr/${TARGET}/usr/include/{}" \;
+ rmdir "${ROOT}/usr/${TARGET}/usr/include" >& /dev/null
+ rmdir "${ROOT}/usr/${TARGET}/usr" >& /dev/null
+ rmdir "${ROOT}/usr/${TARGET}" >& /dev/null
+ fi
+ fi
+
+ #
+ # Make sure proper paths get updated
+ #
+ if [[ ${TARGET} == ${HOST} ]] ; then
+ DATAPATH=/usr/share/binutils-data/${TARGET}/${VER}
+ local e="${ROOT}"/etc/env.d/05binutils
+ local ee="${e}.tmp"
+ rm -f "${ee}"
+ [[ -d ${ROOT}/${DATAPATH}/man ]] && echo "MANPATH=${DATAPATH}/man" >> "${ee}"
+ [[ -d ${ROOT}/${DATAPATH}/info ]] && echo "INFOPATH=${DATAPATH}/info" >> "${ee}"
+ # hmm, `ld` has this in SEARCH_DIR(), but ld.so does not ...
+ if [[ -d ${ROOT}/etc/ld.so.conf.d ]] ; then
+ local l="${ROOT}"/etc/ld.so.conf.d/05binutils.conf
+ local ll="${l}.tmp"
+ echo "/usr/${TARGET}/lib" > "${ll}"
+ mv_if_diff "${ll}" "${l}"
+ else
+ echo "LDPATH=/usr/${TARGET}/lib" >> "${ee}"
+ fi
+ mv_if_diff "${ee}" "${e}"
+ fi
+
+ local c="${ENV_D}/config-${TARGET}"
+ local cc="${c}.tmp"
+ echo "CURRENT=${VER}" > "${cc}"
+ mv_if_diff "${cc}" "${c}"
+
+ eend 0
+
+ #
+ # Regen env.d if need/can be
+ #
+ if [[ ${ROOT} == "/" ]] && [[ ${TARGET} == ${HOST} ]] ; then
+ env-update
+ echo
+ ewarn "Please remember to run:"
+ echo
+ ewarn " # . /etc/profile"
+ echo
+ fi
+
+ return 0
+}
+
+uninstall_target() {
+ : ${TARGET:=${UARG}}
+
+ if [[ ${TARGET} == ${HOST} ]] ; then
+ die "refusing to uninstall native binutils"
+ fi
+
+ shopt -s nullglob
+ PROFILE=""
+
+ for PROFILE in "${ENV_D}"/${TARGET}-* ; do
+ ewarn "Removing all signs of ${PROFILE##*/}"
+ rm -f "${ENV_D}"/${PROFILE}
+ done
+ if [[ -z ${PROFILE} ]] && [[ ! -e ${ENV_D}/config-${TARGET} ]] ; then
+ die "no profiles exist for '${TARGET}'"
+ fi
+
+ rm -f "${ENV_D}"/config-${TARGET}
+
+ local x
+ for x in \
+ addr2line ar as c++filt elf2flt elfedit flthdr gprof \
+ ld ld.{bfd,gold,real} \
+ nm objcopy objdump ranlib readelf size strings strip
+ do
+ x=(
+ "${ROOT}"/usr/bin/${TARGET}-${x}
+ "${ROOT}"/usr/{${HOST}/,}${TARGET}/bin/${x}
+ "${ROOT}"/usr/libexec/gcc/${TARGET}/${x}
+ )
+ rm -f "${x[@]}"
+ done
+ for x in ansidecl.h bfd.h bfdlink.h dis-asm.h symcat.h ; do
+ rm -f "${ROOT}"/usr/{${HOST}/,}${TARGET}/{usr/,}include/${x}
+ done
+ for x in bfd iberty opcodes ; do
+ rm -f "${ROOT}"/usr/${HOST}/${TARGET}/lib/lib${x}{{-*,}.so,.a,.la}
+ done
+ # Delete broken symlinks
+ local destdir="${ROOT}/usr/${HOST}/${TARGET}"
+ rm -f "${destdir}"/lib/ldscripts
+ find -L "${destdir}"/lib -type l -exec rm {} +
+ rmdir \
+ "${destdir}"/{bin,include,lib,usr} \
+ "${destdir}" \
+ "${ROOT}"/var/db/pkg/cross-${TARGET} \
+ "${ROOT}"/usr/{${HOST}/,}${TARGET}/bin \
+ "${ROOT}"/usr/libexec/gcc/${TARGET} \
+ 2>/dev/null
+
+ rm -f "${ENV_D}"/${TARGET}-*
+}
+
+set_current_profile() {
+ if [[ ! -f ${ENV_D}/config-${TARGET} ]] ; then
+ eerror "${argv0}: unable to locate a profile for target: ${TARGET}"
+ return 1
+ fi
+
+ source "${ENV_D}/config-${TARGET}"
+
+ if [[ -z ${CURRENT} ]] ; then
+ eerror "${argv0}: no binutils profile is active!"
+ return 1
+ fi
+
+ echo "${TARGET}-${CURRENT}"
+
+ return 0
+}
+get_current_profile() { echo "${PROFILE}" ; }
+
+list_profiles() {
+ local x i target
+
+ if [[ ${ROOT} != / ]] ; then
+ echo "Using binutils-config info in ${ROOT}"
+ fi
+
+ set -- "${ENV_D}"/*
+ target=
+ i=1
+
+ for x ; do
+ # skip broken links and config files
+ [[ -f ${x} ]] || continue
+ [[ ${x} == */config-* ]] && continue
+
+ source "${x}"
+ if [[ ${target} != ${TARGET} ]] ; then
+ [[ -n ${target} ]] && echo
+ target=${TARGET}
+ fi
+
+ x=${x##*/}
+ if [[ -e ${ENV_D}/config-${TARGET} ]] ; then
+ source "${ENV_D}/config-${TARGET}"
+ if [[ ${VER} == ${CURRENT} ]] ; then
+ [[ ${TARGET} == ${HOST} ]] \
+ && x="${x} ${GOOD}*${NORMAL}" \
+ || x="${x} ${HILITE}*${NORMAL}"
+ fi
+ fi
+
+ # We would align the [...] field like so:
+ #printf ' [%*ss] %s\n' ${##} "${i}" "${x}"
+ # but this breaks simple scripting: `binutils -l | awk '{print $2}'`
+
+ # Or we could align the target col like so:
+ #printf ' [%s]%*s %s\n' "${i}" $(( ${##} - ${#i} )) "" "${x}"
+ # but i'm not sold that it looks better
+
+ # So keep it simple ... only makes a diff anyways for crazy people
+ # like me which have 100+ binutils packages installed ...
+ echo " [$i] ${x}"
+ ((++i))
+ done
+}
+
+switch_linker() {
+ local bpath ld=$1
+
+ case ${ld} in
+ ld.*) ;;
+ *) die "not supported: linker must start with 'ld.'" ;;
+ esac
+
+ setup_env || return 1
+ bpath="${ROOT}/${BINPATH}"
+
+ # does this binutils even support the requested linker ?
+ if [[ ! -e ${bpath}/${ld} ]] ; then
+ die "sorry, but ${PROFILE} doesn't support the ${ld} linker"
+ fi
+
+ # switch it up
+ ebegin "Setting default linker to ${ld} for ${PROFILE}"
+ atomic_ln ${ld} "${bpath}" ld
+ eend $?
+}
+
+set_HOST() {
+ # Set HOST to CHOST if it isn't already set
+ : ${HOST:=${CHOST:-$(portageq envvar CHOST)}}
+}
+
+ENV_D="${ROOT}etc/env.d/binutils"
+
+DEBUG="no"
+NEED_ACTION="yes"
+DOIT="switch_profile"
+PROFILE="current"
+HOST=""
+TARGET=""
+unset UARG
+
+select_action() {
+ if [[ ${NEED_ACTION} != "no" ]] ; then
+ NEED_ACTION="no"
+ DOIT=$1
+ else
+ die "one action at a time!"
+ fi
+}
+
+while [[ $# -gt 0 ]] ; do
+ x=$1
+ shift
+ case ${x} in
+ -c|--get-current-profile) select_action get_current_profile ;;
+ -l|--list|--list-profiles) select_action list_profiles ;;
+ -u|--uninstall) select_action uninstall_target ;;
+ --linker) select_action "switch_linker $1"; shift ;;
+ -d|--debug) DEBUG="yes" ;;
+ -h|--help) usage 0 ;;
+ -V|--version)
+ unset Header
+ cvsver="$Id$"
+ cvsver=${cvsver##*binutils-config-}
+ bver=${cvsver%%,v *}
+ cvsver=${cvsver#* }
+ echo "binutils-config-${bver} (r${cvsver%% *})"
+ exit 0
+ ;;
+ -*)
+ die "invalid switch! Try '--help'."
+ ;;
+ *)
+ if [[ ${UARG+set} == "set" ]] ; then
+ die "only one profile/target at a time please"
+ fi
+ NEED_ACTION="maybe"
+ UARG=${x}
+ ;;
+ esac
+done
+
+[[ ${NEED_ACTION} == "yes" ]] && usage 1
+[[ ${DEBUG} == "yes" ]] && set -x
+
+# All operations need to know the current HOST to figure out
+# what is a native target and what is a cross target
+set_HOST
+
+# All operations need to know the profile the user wants
+case ${DOIT} in
+switch_profile|switch_linker_*)
+ # decode user's profile choice
+ x=${UARG:-$(TARGET=${HOST} set_current_profile)}
+ PROFILE=""
+ if [[ -z $(echo ${x} | tr -d '[:digit:]') ]] ; then
+ # User gave us a # representing the profile
+ i=1
+ for y in "${ENV_D}"/* ; do
+ [[ ${y/config-} != ${y} ]] && continue
+
+ if [[ -f ${y} ]] && [[ ${x} -eq ${i} ]] ; then
+ PROFILE=${y##*/}
+ break
+ fi
+ ((++i))
+ done
+ fi
+
+ if [[ -z ${PROFILE} ]] ; then
+ # User gave us a full HOST-ver
+ x=${x##*/}
+ if [[ -f ${ENV_D}/${x} ]] ; then
+ # Valid HOST-ver yeah!
+ PROFILE=${x}
+ else
+ # Not a valid HOST-ver ...
+ if [[ ! -f ${ENV_D}/config-${x} ]] ; then
+ # Maybe they just gave us a ver ...
+ if [[ -f ${ENV_D}/${HOST}-${x} ]] ; then
+ x=${HOST}-${x}
+ else
+ die "could not locate '$x' in '${ENV_D}/'!"
+ fi
+ PROFILE=${x}
+ else
+ # Maybe they just gave us a target ... pick active profile
+ PROFILE=$(TARGET=${x} set_current_profile)
+ fi
+ fi
+ fi
+ ;;
+*)
+ # lookup current profile as the user gave us a target
+ PROFILE=$(TARGET=${UARG:-${HOST}} set_current_profile) || exit 1
+ ;;
+esac
+
+eval ${DOIT}
+
+# vim:ts=4
diff --git a/sys-devel/binutils-config/files/binutils-config.8 b/sys-devel/binutils-config/files/binutils-config.8
new file mode 100644
index 000000000000..0d8adb5a70b2
--- /dev/null
+++ b/sys-devel/binutils-config/files/binutils-config.8
@@ -0,0 +1,77 @@
+.TH "BINUTILS-CONFIG" "8" "Jan 2005" "Gentoo" "Gentoo"
+.SH "NAME"
+binutils-config \- manage active versions of the binutils programs
+.SH "DESCRIPTION"
+The \fBbinutils-config\fR script allows you to switch between different
+versions of binutils when you have installed multiple copies (see
+USE=multislot). It also allows you to manage multiple cross-compiling
+targets simultaneously.
+
+Remember, you may have one version of binutils active per \fICTARGET\fR,
+and changing the version for one target has no bearing on any other. So
+changing an active cross-compiler will not break your native compiler
+(i.e. \fICHOST\fR).
+.SH "SYNOPSIS"
+\fBbinutils-config\fR [\fIcrufty options\fR] \fIPROFILE\fR
+
+\fBbinutils-config\fR \fB--get-current-profile\fR \fI[TARGET]\fR
+
+\fBbinutils-config\fR \fB--list-profiles\fR
+
+\fBbinutils-config\fR \fB--uninstall\fR \fITARGET\fR
+.SH "GENERIC OPTIONS"
+.TP
+\fBPROFILE\fR
+Change the system to use the specified binutils version. This may take the
+form of the list index number (the number shown on the left in the
+\fB\-\-list\-profiles\fR output), a full \fITARGET-VERSION\fR (useful when
+working with cross-compilers), just a \fITARGET\fR where the \fIVERSION\fR
+is picked from the active, or just a binutils \fIVERSION\fR where the
+\fITARGET\fR is assumed to be the native \fIHOST\fR value.
+.TP
+\fBTARGET\fR
+Similiar to \fBPROFILE\fR, but this is only the target and no version info
+(i.e. \fICTARGET\fR or \fICHOST\fR).
+.TP
+\fB\-c\fR, \fB\-\-get\-current\-profile\fR \fI[TARGET]\fR
+Display the active profile for \fITARGET\fR. If none is specified, the
+host system's \fITARGET\fR will be shown (i.e. \fICHOST\fR).
+.TP
+\fB\-l\fR, \fB\-\-list\-profiles\fR
+Show all the profiles that your system currently has installed and what
+versions are active. The active native version is noted with a bright green
+asterisk while the active cross-compiler versions are noted with a light blue
+asterisk.
+.TP
+\fB-u\fR, \fB\-\-uninstall\fR \fITARGET\fR
+This is really for internal use only. Used to remove all traces of the
+\fITARGET\fR binutils from your system.
+.SH "CRUFTY OPTIONS"
+.TP
+\fB\-\-gold\fR
+Change the default linker for the specified \fIPROFILE\fR to the [newer] gold
+linker. This only works if the binutils actually supports gold. Note that
+not all options supported by the bfd linker are supportd by the gold linker.
+.TP
+\fB\-\-bfd\fR
+Change the default linker for the specified \fIPROFILE\fR to the [older but
+stable] bfd linker. If unsure, stick to this one.
+.SH "REPORTING BUGS"
+Please report bugs via http://bugs.gentoo.org/
+.SH "SEE ALSO"
+.BR ar (1),
+.BR as (1),
+.BR ld (1),
+.BR nm (1),
+.BR objcopy (1),
+.BR ranlib (1),
+.BR readelf (1),
+.BR strings (1),
+.BR strip (1)
+.SH "FILES"
+.nf
+.BR /usr/bin/binutils-config
+.BR /etc/env.d/binutils/*
+.fi
+.SH "AUTHORS"
+Mike Frysinger <vapier@gentoo.org>
diff --git a/sys-devel/binutils-config/metadata.xml b/sys-devel/binutils-config/metadata.xml
new file mode 100644
index 000000000000..fb4199eb7afe
--- /dev/null
+++ b/sys-devel/binutils-config/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-devel/binutils-hppa64/Manifest b/sys-devel/binutils-hppa64/Manifest
new file mode 100644
index 000000000000..2f926d7adf58
--- /dev/null
+++ b/sys-devel/binutils-hppa64/Manifest
@@ -0,0 +1,18 @@
+DIST binutils-2.19.1-patches-1.2.tar.bz2 10544 SHA256 128c949a46e6c516b5ebb2dbb7be553db7d8f1ee174896d1b63adbd0950030b3 SHA512 6aa2c923748d5b80f8e495176f19d8df8defcaa53915835b57a1da7c7a78668cb63d3380dd027593c8909a35de61adf2ea3d0ace64eeb537171271a6c6cbf33e WHIRLPOOL 04b26a82b2021626d4402c3275776bd9f91139082ae799350f9605bfa7e72fd3d72aac7636fbeb0e1fcdb93b6e903b396320b439502462baad06a61b0a3960e6
+DIST binutils-2.19.1.tar.bz2 16306586 SHA256 2dbd2c554b70d915c5b32fcfd401d03afcbf202529059c7a80af3993885ad1c2 SHA512 22af3cf65ad2f76469440fb992e50a10895fcec1265b98781138db0fc40bf06565af86dc73ca0b97bee764ec797439a89b5dbca2a5da74f375af55383887c436 WHIRLPOOL 340c12072a60c8f7b4b930a857e87d9723bdd2b0c61bef5a06810e11406f3e7955632a93a59c68b60220a882ff99273af3a9995872aa7a11604dd04182ebc6a2
+DIST binutils-2.20.1-patches-1.1.tar.bz2 14913 SHA256 aa92fc88cf1a96c88c010aa95ae788c3fd95300d93caf210301a5783266f9062 SHA512 e4e7c8729fb4d96ccfa79e1d3bbed8d1962fa7d512afb6a54655c86c71039e747f1c30165bcf0a8a14da5383498731c30fb361c8e0672820771082b5193e84e0 WHIRLPOOL 322896623634269cef84dcdec8bd57607d2964ce3dca58b75942ab77b290d9553ba71d9ddb9af28addb62a240810cacef0fa343eb0ceed795036480523e47867
+DIST binutils-2.20.1.tar.bz2 17591527 SHA256 71d37c96451333c5c0b84b170169fdcb138bbb27397dc06281905d9717c8ed64 SHA512 b05c93eb9ba8db344fbdee3c5b36ed5a7ad1366f948d41af43286715c7345a2477e0808d25f7bbf81b54ab06c4d46356d44318d56efcdbef42236d1a694411fc WHIRLPOOL 6166462fce695914a32c3295dadb6782716bb6693ee0a2a5543cc925e4967f5bccf38a5a2c244703bb9990acd229d0588a9463c62cec042f24107854c631518e
+DIST binutils-2.21.1-patches-1.1.tar.bz2 9197 SHA256 2dcfdec5f18a5bf391a973b080228d5b80c5bfc2939b835f95c764a319b988d7 SHA512 6a0678504766961e77dd7960d86ea19e2eb17aea8c7b09e7fc507627021fb489c9e64a13f6e9025bf028a4f5afed26e5ee3390da20236a77d5c4e189795af8aa WHIRLPOOL 330f693c9a3cbb23cc2c5ca3ee69d538b8f4debdcc8ed201af40e99f2360de47561a089b18124d238c3fec724489abee643508536a69b03b861d3d8e7a0636fa
+DIST binutils-2.21.1.tar.bz2 18997755 SHA256 cdecfa69f02aa7b05fbcdf678e33137151f361313b2f3e48aba925f64eabf654 SHA512 3f550f6833a41e9b17d1f515eea0de8dc14aefb7dd69c65b821aa1336aea4c3f55b4457a1781ab7b32bda049798fef3cf989148e4acb0fca8baca5af74766f31 WHIRLPOOL 1025ac3714f2406ee5afcda3f7a23f788a35e354b928f4b11c7448150a5613f793c2aa471f4612c5015e89d5abbb61522a7a0265286fcf2788fbf1194fb60201
+DIST binutils-2.22-patches-1.2.tar.bz2 19283 SHA256 441a490f515fd2c9a8103114b16baba65f88eb02c754ad57ec0e86f3286729c1 SHA512 02b8820eee2d1cc3d28f89100f0718f9a4c2821c176b6c47974d23b8f25124a7f6f500b4a42eda55c2846912e91c6577444fad114e0ec11f475dc52402d63136 WHIRLPOOL 3e8faf1aea87d129f4acb2d7fa8891adde296ff3e99b60123f1b4b111d96e82743ead3e57d7ed9e8bb660789c2e37ef0e3cbace61d5e636993e08260ebdcc959
+DIST binutils-2.22.tar.bz2 19973532 SHA256 6c7af8ed1c8cf9b4b9d6e6fe09a3e1d3d479fe63984ba8b9b26bf356b6313ca9 SHA512 ffe8ef263ef99183e8cc823fe8487ff7d0f7bf9a8efd2853b5f4636aca0023850d13de4eac7d77a5f69413d8a50e6f95bb14569be53df86c0bce38034525ab74 WHIRLPOOL 8bea2f2082600587649a5f9fffada9c6cf14f42ebddd1e6a4b4d7be25446d7ad76e1335cf8cefe30c812ced408c9dacb55d0033e4b0eaff83efbbfb5ea5f60dc
+DIST binutils-2.23.1-patches-1.0.tar.xz 13396 SHA256 6d2ac4f83588e57968ce0e8e4450effb5aa79d46b9025ed2779cf91c8f99ec01 SHA512 f8a708798d32f81aceb3291411f7ef461a4f5b91ff204519799f3051789b1cbcac79bc282819227cf8dee875f47b727c51aba6f3a2ac73f53b132430c0fe9bdd WHIRLPOOL fbbcf9040047d5411ef002dd4e8079b6555b4ef2c079534f19ea8d105b2d62a8fce98eaf9b217d733414d0ddde1ab64b55d0c16bd142375a28187febde0c76eb
+DIST binutils-2.23.1.tar.bz2 21455321 SHA256 2ab2e5b03e086d12c6295f831adad46b3e1410a3a234933a2e8fac66cb2e7a19 SHA512 effecc9e6ef943055815a83dea546f2fe5b5d4483dadeda5753aae239bd7095d4696239240613a051d18011ed2521ae75c48292f970ba82b02e97bc72b0fa51f WHIRLPOOL 48f99ba30f0f7085cd7d889b727ba615be3aceb9da6a836d676eecee65c16e36257110d84bfe82a739064741b6b5279f97e43c93a08ca90896a10474b4ea65e8
+DIST binutils-2.23.2-patches-1.0.tar.xz 10884 SHA256 47df1338ee285548630dabb6e414cd7ffffaf068a56ea22a185608fcbd091703 SHA512 25d52694e653dd2642eb643ef3bd48a099876515d66b0b1ed8dfa5f60cadaa1bb92a589e370528ec52add7571c0ea1a98859bfde0821c73ec0ded492fff0915c WHIRLPOOL 2aba579641a1b8e701b25c9d0094c9991e151ddd0b02fae7273ca8c9e31fd344cbf3782c5a5f9960a9bee16b41bc898c8ad0ec76ba8ee396d28e878dac47ffc7
+DIST binutils-2.23.2.tar.bz2 21440347 SHA256 fe914e56fed7a9ec2eb45274b1f2e14b0d8b4f41906a5194eac6883cfe5c1097 SHA512 dec753bbba008f1526b89cf1bd85feba78f362f5333ffdf93953fd131eb755976dec82a0a4ba38c43d2434da007137780cfe674de5414be5cf7ce7fbc6af6d16 WHIRLPOOL 1be65f03569d599899c5b57ac7aedbf90b311f9a47c1883dc62c0717b0757ebfb33e17ab3def8d0b805daabba67cf554463f88675c9f552a6fd8dbe7ca77b442
+DIST binutils-2.24-patches-1.4.tar.xz 17488 SHA256 f018f140a52cddb1e4619b5caf4b4a37a27dfb29e8bf29ea5161ab13b33eed13 SHA512 dfd7c38cd978b7d6627579c338bf67641c799ce39936e3475dca3ecf5bade417e3f090253a2326582c64d5743a24f9078794f44e8fd41b6af728f1f375c91d3b WHIRLPOOL d6b414d5e5607fd8b2d0f52b508763110448cfbdcc08be6d7c1412043797bde8ed5fbd9a5ea4c141b7394b2cae0ac2ef24827f67813231129a507f49cbc40245
+DIST binutils-2.24.tar.bz2 22716802 SHA256 e5e8c5be9664e7f7f96e0d09919110ab5ad597794f5b1809871177a0f0f14137 SHA512 5ec95ad47d49b12c4558a8db0ca2109d3ee1955e3776057f3330c4506f8f4d1cf5e505fbf8a16b98403a0fcdeaaf986fe0a22be6456247dbdace63ce1f776b12 WHIRLPOOL 619634dfdc73b8f6e9933b4642f5f9faf147c388a6d39283cd7639d83f3d7a601981cf49a787c43c17a942c563f24dc8dcc682138b5d3102a5650e1b9d15bd50
+DIST binutils-2.25-patches-1.2.tar.xz 16480 SHA256 c5a65aefaf561e592961d22cf88e57dd304a73d3643581414b5a7c14667eef30 SHA512 5a8072c57ce393a50de8770885d6740b8835d656e357a12caf67c4ffbfce228f9a53ea0861199a1a08e2ca724702d0e013f3a9787b15de21178e99263fc43292 WHIRLPOOL 691cf14bfb2c1bb144db29917dea791c18eeb192f61325ef3265fed6c4ad870e23485c3505f74a688158bf862d6539aa5f036400dcf14b9c05a09327ab871133
+DIST binutils-2.25.1-patches-1.0.tar.xz 16472 SHA256 51ae9e098d7cfd0ae6db4971939062d4051077b1d743263f2d4c621591303e14 SHA512 1743969d531d18e5d458a165f1b05b3c3253b062a8908b722e11ed82144598eef0983d8e1bb4f132ad80b534a0d6b37cc2ffa0575e1ec303219d1e43d5f30f26 WHIRLPOOL 1afcde32383213cce48116dc5161da535372d9104acfb9b3b893859f58800d0833dc3d041492250e4ec9d981a98c2af4fa9f07aba3ca1f1770d334199bf34855
+DIST binutils-2.25.1.tar.bz2 24163561 SHA256 b5b14added7d78a8d1ca70b5cb75fef57ce2197264f4f5835326b0df22ac9f22 SHA512 0b36dda0e6d32cd25613c0e64b56b28312515c54d6a159efd3db9a86717f114ab0a0a1f69d08975084d55713ebaeab64e4085c9b3d1c3fa86712869f80eb954d WHIRLPOOL daa804331ee880296c2fe29fd9b8a52cc695629d4bbe0b9889d96ffc54d330f00fac3f3cb12b3aaf6b7505521ef499c53760912cd7c9bb54f2d5e288224bd1eb
+DIST binutils-2.25.tar.bz2 24049133 SHA256 22defc65cfa3ef2a3395faaea75d6331c6e62ea5dfacfed3e2ec17b08c882923 SHA512 49438970642f379978aba988e3d2e7b63dab6fd0b46d91f4100f083e87a84d242089daca58572245fe620457a77bbbe2d78588ff3fb79314e500d1a39bf96f30 WHIRLPOOL 92f963d6ffe7d2378726cb080e893f8c58c8b6de030e78da488d8c3fd157e064a90b62d9bd2f305707758aa016a9e48f0953425828a2a0432ddee8ffae89585f
diff --git a/sys-devel/binutils-hppa64/binutils-hppa64-2.19.1.ebuild b/sys-devel/binutils-hppa64/binutils-hppa64-2.19.1.ebuild
new file mode 100644
index 000000000000..742dbcecdbe0
--- /dev/null
+++ b/sys-devel/binutils-hppa64/binutils-hppa64-2.19.1.ebuild
@@ -0,0 +1,23 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+export CTARGET=hppa64-${CHOST#*-}
+
+PATCHVER="1.2"
+ELF2FLT_VER=""
+inherit toolchain-binutils
+
+DESCRIPTION="binutils package for building 64bit kernels on HPPA"
+
+KEYWORDS="-* hppa"
+
+src_install() {
+ toolchain-binutils_src_install
+
+ # tweak the default fake list a little bit
+ cd "${D}"/etc/env.d/binutils
+ sed -i '/FAKE_TARGETS=/s:"$: hppa64-linux":' ${CTARGET}-${BVER} || die
+}
diff --git a/sys-devel/binutils-hppa64/binutils-hppa64-2.20.1.ebuild b/sys-devel/binutils-hppa64/binutils-hppa64-2.20.1.ebuild
new file mode 100644
index 000000000000..7883f6a58259
--- /dev/null
+++ b/sys-devel/binutils-hppa64/binutils-hppa64-2.20.1.ebuild
@@ -0,0 +1,23 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+export CTARGET=hppa64-${CHOST#*-}
+
+PATCHVER="1.1"
+ELF2FLT_VER=""
+inherit toolchain-binutils
+
+DESCRIPTION="binutils package for building 64bit kernels on HPPA"
+
+KEYWORDS="-* hppa"
+
+src_install() {
+ toolchain-binutils_src_install
+
+ # tweak the default fake list a little bit
+ cd "${D}"/etc/env.d/binutils
+ sed -i '/FAKE_TARGETS=/s:"$: hppa64-linux":' ${CTARGET}-${BVER} || die
+}
diff --git a/sys-devel/binutils-hppa64/binutils-hppa64-2.21.1-r1.ebuild b/sys-devel/binutils-hppa64/binutils-hppa64-2.21.1-r1.ebuild
new file mode 100644
index 000000000000..e935622aff1d
--- /dev/null
+++ b/sys-devel/binutils-hppa64/binutils-hppa64-2.21.1-r1.ebuild
@@ -0,0 +1,23 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+export CTARGET=hppa64-${CHOST#*-}
+
+PATCHVER="1.1"
+ELF2FLT_VER=""
+inherit toolchain-binutils
+
+DESCRIPTION="binutils package for building 64bit kernels on HPPA"
+
+KEYWORDS="-* ~hppa"
+
+src_install() {
+ toolchain-binutils_src_install
+
+ # tweak the default fake list a little bit
+ cd "${D}"/etc/env.d/binutils
+ sed -i '/FAKE_TARGETS=/s:"$: hppa64-linux":' ${CTARGET}-${BVER} || die
+}
diff --git a/sys-devel/binutils-hppa64/binutils-hppa64-2.22.ebuild b/sys-devel/binutils-hppa64/binutils-hppa64-2.22.ebuild
new file mode 100644
index 000000000000..87b29dcb450b
--- /dev/null
+++ b/sys-devel/binutils-hppa64/binutils-hppa64-2.22.ebuild
@@ -0,0 +1,27 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+export CTARGET=hppa64-${CHOST#*-}
+
+PATCHVER="1.2"
+ELF2FLT_VER=""
+inherit toolchain-binutils
+
+DESCRIPTION="binutils package for building 64bit kernels on HPPA"
+
+KEYWORDS="-* hppa"
+
+# 66_all_binutils-2.22-warn-textrel.patch fails to apply with
+# patch-2.5.9, so require a version that for sure works
+DEPEND+=" >=sys-devel/patch-2.6.1"
+
+src_install() {
+ toolchain-binutils_src_install
+
+ # tweak the default fake list a little bit
+ cd "${D}"/etc/env.d/binutils
+ sed -i '/FAKE_TARGETS=/s:"$: hppa64-linux":' ${CTARGET}-${BVER} || die
+}
diff --git a/sys-devel/binutils-hppa64/binutils-hppa64-2.23.1.ebuild b/sys-devel/binutils-hppa64/binutils-hppa64-2.23.1.ebuild
new file mode 100644
index 000000000000..e017c5348817
--- /dev/null
+++ b/sys-devel/binutils-hppa64/binutils-hppa64-2.23.1.ebuild
@@ -0,0 +1,27 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+export CTARGET=hppa64-${CHOST#*-}
+
+PATCHVER="1.0"
+ELF2FLT_VER=""
+inherit toolchain-binutils
+
+DESCRIPTION="binutils package for building 64bit kernels on HPPA"
+
+KEYWORDS="-* hppa"
+
+# 66_all_binutils-2.22-warn-textrel.patch fails to apply with
+# patch-2.5.9, so require a version that for sure works
+DEPEND+=" >=sys-devel/patch-2.6.1"
+
+src_install() {
+ toolchain-binutils_src_install
+
+ # tweak the default fake list a little bit
+ cd "${D}"/etc/env.d/binutils
+ sed -i '/FAKE_TARGETS=/s:"$: hppa64-linux":' ${CTARGET}-${BVER} || die
+}
diff --git a/sys-devel/binutils-hppa64/binutils-hppa64-2.23.2.ebuild b/sys-devel/binutils-hppa64/binutils-hppa64-2.23.2.ebuild
new file mode 100644
index 000000000000..e017c5348817
--- /dev/null
+++ b/sys-devel/binutils-hppa64/binutils-hppa64-2.23.2.ebuild
@@ -0,0 +1,27 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+export CTARGET=hppa64-${CHOST#*-}
+
+PATCHVER="1.0"
+ELF2FLT_VER=""
+inherit toolchain-binutils
+
+DESCRIPTION="binutils package for building 64bit kernels on HPPA"
+
+KEYWORDS="-* hppa"
+
+# 66_all_binutils-2.22-warn-textrel.patch fails to apply with
+# patch-2.5.9, so require a version that for sure works
+DEPEND+=" >=sys-devel/patch-2.6.1"
+
+src_install() {
+ toolchain-binutils_src_install
+
+ # tweak the default fake list a little bit
+ cd "${D}"/etc/env.d/binutils
+ sed -i '/FAKE_TARGETS=/s:"$: hppa64-linux":' ${CTARGET}-${BVER} || die
+}
diff --git a/sys-devel/binutils-hppa64/binutils-hppa64-2.24.ebuild b/sys-devel/binutils-hppa64/binutils-hppa64-2.24.ebuild
new file mode 100644
index 000000000000..fd1dac563b84
--- /dev/null
+++ b/sys-devel/binutils-hppa64/binutils-hppa64-2.24.ebuild
@@ -0,0 +1,27 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+export CTARGET=hppa64-${CHOST#*-}
+
+PATCHVER="1.4"
+ELF2FLT_VER=""
+inherit toolchain-binutils
+
+DESCRIPTION="binutils package for building 64bit kernels on HPPA"
+
+KEYWORDS="-* hppa"
+
+# 66_all_binutils-2.22-warn-textrel.patch fails to apply with
+# patch-2.5.9, so require a version that for sure works
+DEPEND+=" >=sys-devel/patch-2.6.1"
+
+src_install() {
+ toolchain-binutils_src_install
+
+ # tweak the default fake list a little bit
+ cd "${D}"/etc/env.d/binutils
+ sed -i '/FAKE_TARGETS=/s:"$: hppa64-linux":' ${CTARGET}-${BVER} || die
+}
diff --git a/sys-devel/binutils-hppa64/binutils-hppa64-2.25.1.ebuild b/sys-devel/binutils-hppa64/binutils-hppa64-2.25.1.ebuild
new file mode 100644
index 000000000000..a0420ac0e2e5
--- /dev/null
+++ b/sys-devel/binutils-hppa64/binutils-hppa64-2.25.1.ebuild
@@ -0,0 +1,27 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+export CTARGET=hppa64-${CHOST#*-}
+
+PATCHVER="1.0"
+ELF2FLT_VER=""
+inherit toolchain-binutils
+
+DESCRIPTION="binutils package for building 64bit kernels on HPPA"
+
+KEYWORDS="-* ~hppa"
+
+# 66_all_binutils-2.22-warn-textrel.patch fails to apply with
+# patch-2.5.9, so require a version that for sure works
+DEPEND+=" >=sys-devel/patch-2.6.1"
+
+src_install() {
+ toolchain-binutils_src_install
+
+ # tweak the default fake list a little bit
+ cd "${D}"/etc/env.d/binutils
+ sed -i '/FAKE_TARGETS=/s:"$: hppa64-linux":' ${CTARGET}-${BVER} || die
+}
diff --git a/sys-devel/binutils-hppa64/binutils-hppa64-2.25.ebuild b/sys-devel/binutils-hppa64/binutils-hppa64-2.25.ebuild
new file mode 100644
index 000000000000..c3edacf80c12
--- /dev/null
+++ b/sys-devel/binutils-hppa64/binutils-hppa64-2.25.ebuild
@@ -0,0 +1,27 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+export CTARGET=hppa64-${CHOST#*-}
+
+PATCHVER="1.2"
+ELF2FLT_VER=""
+inherit toolchain-binutils
+
+DESCRIPTION="binutils package for building 64bit kernels on HPPA"
+
+KEYWORDS="-* ~hppa"
+
+# 66_all_binutils-2.22-warn-textrel.patch fails to apply with
+# patch-2.5.9, so require a version that for sure works
+DEPEND+=" >=sys-devel/patch-2.6.1"
+
+src_install() {
+ toolchain-binutils_src_install
+
+ # tweak the default fake list a little bit
+ cd "${D}"/etc/env.d/binutils
+ sed -i '/FAKE_TARGETS=/s:"$: hppa64-linux":' ${CTARGET}-${BVER} || die
+}
diff --git a/sys-devel/binutils-hppa64/metadata.xml b/sys-devel/binutils-hppa64/metadata.xml
new file mode 100644
index 000000000000..f2757929784c
--- /dev/null
+++ b/sys-devel/binutils-hppa64/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>hppa</herd>
+<longdescription>
+binutils for 64bit kernel on hppa.
+</longdescription>
+<use>
+ <flag name='multislot'>Allow for multiple versions of binutils to be emerged at once for same CTARGET</flag>
+ <flag name='multitarget'>Adds support to binutils for cross compiling (does not work with gas)</flag>
+</use>
+</pkgmetadata>
diff --git a/sys-devel/binutils/Manifest b/sys-devel/binutils/Manifest
new file mode 100644
index 000000000000..5ff4d7790ab5
--- /dev/null
+++ b/sys-devel/binutils/Manifest
@@ -0,0 +1,13 @@
+DIST binutils-2.21.1-patches-1.4.tar.bz2 20033 SHA256 51e50584a7364549649cc6c59f4a678b07595979811e8e2150264318c3b4493d SHA512 66b71031a782f9708dc5f8ac9171b2be0bbca102b44705155b292329e0664cc71b649f4d8fa50ad0d9123436c03b994da5a0fddc32e43bf2d50e74c68609e508 WHIRLPOOL 2bdc11027b3dcd27c766b4ca5f578a32838d15b3370b4093f1c30887200b82bfaa732df9af23f545d58bbbf373c9967a31fcbb19b3f9b855f0923143e77fa9f5
+DIST binutils-2.21.1.tar.bz2 18997755 SHA256 cdecfa69f02aa7b05fbcdf678e33137151f361313b2f3e48aba925f64eabf654 SHA512 3f550f6833a41e9b17d1f515eea0de8dc14aefb7dd69c65b821aa1336aea4c3f55b4457a1781ab7b32bda049798fef3cf989148e4acb0fca8baca5af74766f31 WHIRLPOOL 1025ac3714f2406ee5afcda3f7a23f788a35e354b928f4b11c7448150a5613f793c2aa471f4612c5015e89d5abbb61522a7a0265286fcf2788fbf1194fb60201
+DIST binutils-2.22-patches-1.5.tar.bz2 37350 SHA256 51cad7b3c2d18db0f7d2e4a3e46e37f00eb720cfa663ea396e16dcfbba12a07c SHA512 407490be54fec09faf26e8062cf28d2ea2d58df669642e7582fe51776726f00af8c18194a17438e18068c91b7634fca2d0f33c7231e847ba5141f901d9743ad7 WHIRLPOOL d62be803705d4e526324719fae69c06c303cc2500aeac04cb711eff383a2732ec3f47f9d91deef954c60877e08fed2c2659636dad07086ceaf12c8b899b075f1
+DIST binutils-2.22.tar.bz2 19973532 SHA256 6c7af8ed1c8cf9b4b9d6e6fe09a3e1d3d479fe63984ba8b9b26bf356b6313ca9 SHA512 ffe8ef263ef99183e8cc823fe8487ff7d0f7bf9a8efd2853b5f4636aca0023850d13de4eac7d77a5f69413d8a50e6f95bb14569be53df86c0bce38034525ab74 WHIRLPOOL 8bea2f2082600587649a5f9fffada9c6cf14f42ebddd1e6a4b4d7be25446d7ad76e1335cf8cefe30c812ced408c9dacb55d0033e4b0eaff83efbbfb5ea5f60dc
+DIST binutils-2.23.2-patches-1.0.tar.xz 10884 SHA256 47df1338ee285548630dabb6e414cd7ffffaf068a56ea22a185608fcbd091703 SHA512 25d52694e653dd2642eb643ef3bd48a099876515d66b0b1ed8dfa5f60cadaa1bb92a589e370528ec52add7571c0ea1a98859bfde0821c73ec0ded492fff0915c WHIRLPOOL 2aba579641a1b8e701b25c9d0094c9991e151ddd0b02fae7273ca8c9e31fd344cbf3782c5a5f9960a9bee16b41bc898c8ad0ec76ba8ee396d28e878dac47ffc7
+DIST binutils-2.23.2.tar.bz2 21440347 SHA256 fe914e56fed7a9ec2eb45274b1f2e14b0d8b4f41906a5194eac6883cfe5c1097 SHA512 dec753bbba008f1526b89cf1bd85feba78f362f5333ffdf93953fd131eb755976dec82a0a4ba38c43d2434da007137780cfe674de5414be5cf7ce7fbc6af6d16 WHIRLPOOL 1be65f03569d599899c5b57ac7aedbf90b311f9a47c1883dc62c0717b0757ebfb33e17ab3def8d0b805daabba67cf554463f88675c9f552a6fd8dbe7ca77b442
+DIST binutils-2.24-patches-1.4.tar.xz 17488 SHA256 f018f140a52cddb1e4619b5caf4b4a37a27dfb29e8bf29ea5161ab13b33eed13 SHA512 dfd7c38cd978b7d6627579c338bf67641c799ce39936e3475dca3ecf5bade417e3f090253a2326582c64d5743a24f9078794f44e8fd41b6af728f1f375c91d3b WHIRLPOOL d6b414d5e5607fd8b2d0f52b508763110448cfbdcc08be6d7c1412043797bde8ed5fbd9a5ea4c141b7394b2cae0ac2ef24827f67813231129a507f49cbc40245
+DIST binutils-2.24.tar.bz2 22716802 SHA256 e5e8c5be9664e7f7f96e0d09919110ab5ad597794f5b1809871177a0f0f14137 SHA512 5ec95ad47d49b12c4558a8db0ca2109d3ee1955e3776057f3330c4506f8f4d1cf5e505fbf8a16b98403a0fcdeaaf986fe0a22be6456247dbdace63ce1f776b12 WHIRLPOOL 619634dfdc73b8f6e9933b4642f5f9faf147c388a6d39283cd7639d83f3d7a601981cf49a787c43c17a942c563f24dc8dcc682138b5d3102a5650e1b9d15bd50
+DIST binutils-2.25-patches-1.1.tar.xz 11440 SHA256 fb357d6a6fcb348584f30236c5c541d946496472c6bbd45e72d2a60e1182fbce SHA512 a236973ebfd72a069fbb578206baef0d35e12fe7fd19dd5a8fe002088db86d15b149b3de3dfc88a7e58c39df1c354a1caf3e20efc757c080301fa29d083020d3 WHIRLPOOL 03f6f7217c38c856f475cbb561e538d6a8a4368f420295b914fa77d1fc8e05bb96e6678fcd5100290be5d3ab3859182e901387d8ff58014acee0e2a957e27e34
+DIST binutils-2.25-patches-1.2.tar.xz 16480 SHA256 c5a65aefaf561e592961d22cf88e57dd304a73d3643581414b5a7c14667eef30 SHA512 5a8072c57ce393a50de8770885d6740b8835d656e357a12caf67c4ffbfce228f9a53ea0861199a1a08e2ca724702d0e013f3a9787b15de21178e99263fc43292 WHIRLPOOL 691cf14bfb2c1bb144db29917dea791c18eeb192f61325ef3265fed6c4ad870e23485c3505f74a688158bf862d6539aa5f036400dcf14b9c05a09327ab871133
+DIST binutils-2.25.1-patches-1.0.tar.xz 16472 SHA256 51ae9e098d7cfd0ae6db4971939062d4051077b1d743263f2d4c621591303e14 SHA512 1743969d531d18e5d458a165f1b05b3c3253b062a8908b722e11ed82144598eef0983d8e1bb4f132ad80b534a0d6b37cc2ffa0575e1ec303219d1e43d5f30f26 WHIRLPOOL 1afcde32383213cce48116dc5161da535372d9104acfb9b3b893859f58800d0833dc3d041492250e4ec9d981a98c2af4fa9f07aba3ca1f1770d334199bf34855
+DIST binutils-2.25.1.tar.bz2 24163561 SHA256 b5b14added7d78a8d1ca70b5cb75fef57ce2197264f4f5835326b0df22ac9f22 SHA512 0b36dda0e6d32cd25613c0e64b56b28312515c54d6a159efd3db9a86717f114ab0a0a1f69d08975084d55713ebaeab64e4085c9b3d1c3fa86712869f80eb954d WHIRLPOOL daa804331ee880296c2fe29fd9b8a52cc695629d4bbe0b9889d96ffc54d330f00fac3f3cb12b3aaf6b7505521ef499c53760912cd7c9bb54f2d5e288224bd1eb
+DIST binutils-2.25.tar.bz2 24049133 SHA256 22defc65cfa3ef2a3395faaea75d6331c6e62ea5dfacfed3e2ec17b08c882923 SHA512 49438970642f379978aba988e3d2e7b63dab6fd0b46d91f4100f083e87a84d242089daca58572245fe620457a77bbbe2d78588ff3fb79314e500d1a39bf96f30 WHIRLPOOL 92f963d6ffe7d2378726cb080e893f8c58c8b6de030e78da488d8c3fd157e064a90b62d9bd2f305707758aa016a9e48f0953425828a2a0432ddee8ffae89585f
diff --git a/sys-devel/binutils/binutils-2.21.1-r1.ebuild b/sys-devel/binutils/binutils-2.21.1-r1.ebuild
new file mode 100644
index 000000000000..03c387ae8c22
--- /dev/null
+++ b/sys-devel/binutils/binutils-2.21.1-r1.ebuild
@@ -0,0 +1,11 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+PATCHVER="1.4"
+ELF2FLT_VER=""
+inherit toolchain-binutils
+
+KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 -sparc-fbsd -x86-fbsd"
diff --git a/sys-devel/binutils/binutils-2.22-r1.ebuild b/sys-devel/binutils/binutils-2.22-r1.ebuild
new file mode 100644
index 000000000000..bbff81ceb5a2
--- /dev/null
+++ b/sys-devel/binutils/binutils-2.22-r1.ebuild
@@ -0,0 +1,11 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+PATCHVER="1.5"
+ELF2FLT_VER=""
+inherit toolchain-binutils
+
+KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd -sparc-fbsd ~x86-fbsd"
diff --git a/sys-devel/binutils/binutils-2.23.2.ebuild b/sys-devel/binutils/binutils-2.23.2.ebuild
new file mode 100644
index 000000000000..26b91e739a31
--- /dev/null
+++ b/sys-devel/binutils/binutils-2.23.2.ebuild
@@ -0,0 +1,12 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+PATCHVER="1.0"
+ELF2FLT_VER=""
+inherit toolchain-binutils
+
+# See #464152
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 -amd64-fbsd -sparc-fbsd -x86-fbsd"
diff --git a/sys-devel/binutils/binutils-2.24-r3.ebuild b/sys-devel/binutils/binutils-2.24-r3.ebuild
new file mode 100644
index 000000000000..cb11f0f12498
--- /dev/null
+++ b/sys-devel/binutils/binutils-2.24-r3.ebuild
@@ -0,0 +1,9 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+PATCHVER="1.4"
+ELF2FLT_VER=""
+inherit toolchain-binutils
+
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 -amd64-fbsd -sparc-fbsd ~x86-fbsd"
diff --git a/sys-devel/binutils/binutils-2.25-r1.ebuild b/sys-devel/binutils/binutils-2.25-r1.ebuild
new file mode 100644
index 000000000000..9bc7025898b8
--- /dev/null
+++ b/sys-devel/binutils/binutils-2.25-r1.ebuild
@@ -0,0 +1,11 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+PATCHVER="1.2"
+ELF2FLT_VER=""
+inherit toolchain-binutils
+
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd -sparc-fbsd ~x86-fbsd"
diff --git a/sys-devel/binutils/binutils-2.25.1.ebuild b/sys-devel/binutils/binutils-2.25.1.ebuild
new file mode 100644
index 000000000000..57c5fa6f8060
--- /dev/null
+++ b/sys-devel/binutils/binutils-2.25.1.ebuild
@@ -0,0 +1,11 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+PATCHVER="1.0"
+ELF2FLT_VER=""
+inherit toolchain-binutils
+
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd -sparc-fbsd ~x86-fbsd"
diff --git a/sys-devel/binutils/binutils-2.25.ebuild b/sys-devel/binutils/binutils-2.25.ebuild
new file mode 100644
index 000000000000..7834524dd1c5
--- /dev/null
+++ b/sys-devel/binutils/binutils-2.25.ebuild
@@ -0,0 +1,11 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+PATCHVER="1.1"
+ELF2FLT_VER=""
+inherit toolchain-binutils
+
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd -sparc-fbsd ~x86-fbsd"
diff --git a/sys-devel/binutils/binutils-9999.ebuild b/sys-devel/binutils/binutils-9999.ebuild
new file mode 100644
index 000000000000..ebdfb0b4a986
--- /dev/null
+++ b/sys-devel/binutils/binutils-9999.ebuild
@@ -0,0 +1,7 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit toolchain-binutils
diff --git a/sys-devel/binutils/files/binutils-configure-LANG.patch b/sys-devel/binutils/files/binutils-configure-LANG.patch
new file mode 100644
index 000000000000..5521d196cf4a
--- /dev/null
+++ b/sys-devel/binutils/files/binutils-configure-LANG.patch
@@ -0,0 +1,65 @@
+The LANG vars aren't reset early enough so when sed tries to use [a-zA-Z] in
+option parsing, it may break.
+
+http://bugs.gentoo.org/103483
+http://bugs.gentoo.org/122216
+
+--- configure
++++ configure
+@@ -54,6 +54,19 @@
+ infodir='${prefix}/info'
+ mandir='${prefix}/man'
+
++# NLS nuisances.
++for as_var in \
++ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
++ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
++ LC_TELEPHONE LC_TIME
++do
++ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
++ eval $as_var=C; export $as_var
++ else
++ unset $as_var
++ fi
++done
++
+ # Initialize some other variables.
+ subdirs=
+ MFLAGS= MAKEFLAGS=
+@@ -452,16 +463,6 @@
+ esac
+ done
+
+-# NLS nuisances.
+-# Only set these to C if already set. These must not be set unconditionally
+-# because not all systems understand e.g. LANG=C (notably SCO).
+-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+-# Non-C LC_CTYPE values break the ctype check.
+-if test "${LANG+set}" = set; then LANG=C; export LANG; fi
+-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
+-
+ # confdefs.h avoids OS command line length limits that DEFS can exceed.
+ rm -rf conftest* confdefs.h
+ # AIX cpp loses on an empty file, so make sure it contains at least a newline.
+@@ -1850,6 +1850,19 @@
+ # Compiler output produced by configure, useful for debugging
+ # configure, is in ./config.log if it exists.
+
++# NLS nuisances.
++for as_var in \
++ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
++ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
++ LC_TELEPHONE LC_TIME
++do
++ if (set +x; test -z "`(eval \$as_var=C; export \$as_var) 2>&1`"); then
++ eval \$as_var=C; export \$as_var
++ else
++ unset \$as_var
++ fi
++done
++
+ ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+ for ac_option
+ do
diff --git a/sys-devel/binutils/metadata.xml b/sys-devel/binutils/metadata.xml
new file mode 100644
index 000000000000..fe53b7893442
--- /dev/null
+++ b/sys-devel/binutils/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>
+<use>
+<flag name='multislot'>Allow for multiple versions of binutils to be emerged at once for same CTARGET</flag>
+<flag name='multitarget'>Adds support to binutils for cross compiling (does not work with gas)</flag>
+</use>
+<upstream>
+<remote-id type="cpe">cpe:/a:gnu:binutils</remote-id>
+</upstream>
+</pkgmetadata>
diff --git a/sys-devel/bison/Manifest b/sys-devel/bison/Manifest
new file mode 100644
index 000000000000..b3c50b2c3b7b
--- /dev/null
+++ b/sys-devel/bison/Manifest
@@ -0,0 +1,5 @@
+DIST bison-1.875d.tar.bz2 882745 SHA256 37ff8d673e35838c195d614bc402573d1268c997796e79b831053f4a22e03808 SHA512 f84c6cf41a289ea7e0805cf9b0da6fe2d77f2e03a35c3db7d2e36e5186bba7c0853c3d518bd89f6cfa1030e346e046aa03b33974bb892dbd8f040e5ea2de1126 WHIRLPOOL 213e02b33b4cd65c4c8ad5a37b77cce75a366e1d5ad0837887763c75c5e30eb3d85b7ba8eb71ed86bb86fb3e23624a7c627558f492778ec29e6e79fd30e7c902
+DIST bison-2.4.3.tar.bz2 1652612 SHA256 935302ef194c7f0974fed913eaac8100be512094eab573cf0b67bdf7db1d3a05 SHA512 b789f55d9cb95c1b4fba004691ed9f79b76da55020c9b202e1704a02aab1ba43b9fc1015e29843ed552e6df6165cef9c6ebc8a29d15a21c6e194cad8a42ab055 WHIRLPOOL 0e0e61970a791e53afc6cc85f53cebf0050d885077dd9b2394d79549bac389ffa7e477e003525556858b6fa64c11ce93653bba1c861bd2acd67f85181e167558
+DIST bison-2.7.1.tar.xz 1781068 SHA256 b409adcbf245baadb68d2f66accf6fdca5e282cafec1b865f4b5e963ba8ea7fb SHA512 ac0c7ca57142bcb84af498f606acb86091984a00359294fbf721a4ca8112f9fcf26497f7dd2e65f527e04a6e1de94142ecb76602d407e548475970e5a566d370 WHIRLPOOL 171f6b18c3f205d746092bdd37bf113ab83944db468f81cbf5004573584c717b6fc1a10d112fe7178be222b51b746fed9da58a9065b7f2f7e65a15851500779e
+DIST bison-3.0.3.tar.xz 1971372 SHA256 5940efbdd6b5d80e55ec16a01d2322e2892da21863391049b9b692570649177c SHA512 6639ca0b2b5eb6862c97eb3d568267e417ebd24e78cd197e5770b217fb51fb26418703db25f38fd066a898085c30f1055e1a7d335a43f2d17c82bea64d09b54a WHIRLPOOL 59ac9cf65492e743e84443a245084501ee6c7a6c1616dfb71d9e5a382c492617980f991d1d174c078e6c56e9a947dcd4061a27d72c46b8fef27034961f0ef140
+DIST bison-3.0.4.tar.xz 1973796 SHA256 a72428c7917bdf9fa93cb8181c971b6e22834125848cf1d03ce10b1bb0716fe1 SHA512 bbdc23e7772e49da1c7c47e66d4e4efbfbfe9b21dbc59bf3ad9a6e573eecac6c9f52c7f11a64be9897e8deb99ef7ba015164aa8232aa391b901dd7db03632412 WHIRLPOOL 41da7b0aa18bf61f621d59d372dc2ca9e116f6fa0d5c8891b51a01dda6d9393005c76773dbefbadeb30884bb328379197d2026809d62d49d8e2022b9b49da244
diff --git a/sys-devel/bison/bison-1.875d.ebuild b/sys-devel/bison/bison-1.875d.ebuild
new file mode 100644
index 000000000000..77c9b968bc53
--- /dev/null
+++ b/sys-devel/bison/bison-1.875d.ebuild
@@ -0,0 +1,65 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit toolchain-funcs flag-o-matic eutils
+
+DESCRIPTION="A yacc-compatible parser generator"
+HOMEPAGE="http://www.gnu.org/software/bison/bison.html"
+SRC_URI="ftp://alpha.gnu.org/pub/gnu/bison/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
+IUSE="nls static"
+
+DEPEND="sys-devel/m4
+ nls? ( sys-devel/gettext )"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epatch "${FILESDIR}"/${PN}-1.32-extfix.patch
+}
+
+src_compile() {
+ # Bug 39842 says that bison segfaults when built on amd64 with
+ # optimizations. This will probably be fixed in a future gcc
+ # version, but for the moment just disable optimizations for that
+ # arch (04 Feb 2004 agriffis)
+ [ "$ARCH" == "amd64" ] && append-flags -O0
+
+ # Bug 29017 says that bison has compile-time issues with
+ # -march=k6* prior to 3.4CVS. Use -march=i586 instead
+ # (04 Feb 2004 agriffis)
+ #
+ if (( $(gcc-major-version) == 3 && $(gcc-minor-version) < 4 )) ; then
+ replace-cpu-flags k6 k6-1 k6-2 i586
+ fi
+
+ econf $(use_enable nls) || die
+ use static && append-ldflags -static
+ emake || die
+}
+
+src_install() {
+ make DESTDIR="${D}" \
+ datadir=/usr/share \
+ mandir=/usr/share/man \
+ infodir=/usr/share/info \
+ install || die
+
+ # This one is installed by dev-util/yacc
+ mv "${D}"/usr/bin/yacc "${D}"/usr/bin/yacc.bison || die
+
+ # We do not need this.
+ rm -f "${D}"/usr/lib/liby.a
+
+ dodoc AUTHORS NEWS ChangeLog README REFERENCES OChangeLog doc/FAQ
+}
+
+pkg_postinst() {
+ if [[ ! -e ${ROOT}/usr/bin/yacc ]] ; then
+ ln -s yacc.bison "${ROOT}"/usr/bin/yacc
+ fi
+}
diff --git a/sys-devel/bison/bison-2.4.3.ebuild b/sys-devel/bison/bison-2.4.3.ebuild
new file mode 100644
index 000000000000..03028eb5378f
--- /dev/null
+++ b/sys-devel/bison/bison-2.4.3.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="2"
+
+inherit flag-o-matic eutils
+
+DESCRIPTION="A yacc-compatible parser generator"
+HOMEPAGE="http://www.gnu.org/software/bison/bison.html"
+SRC_URI="mirror://gnu/bison/${P}.tar.bz2"
+
+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="nls static"
+
+RDEPEND="sys-devel/m4"
+DEPEND="${RDEPEND}
+ nls? ( sys-devel/gettext )"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-uclibc-sched_param-def.patch
+ epatch "${FILESDIR}"/${P}-no-gets.patch
+}
+
+src_configure() {
+ use static && append-ldflags -static
+ econf $(use_enable nls)
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die
+
+ # This one is installed by dev-util/yacc
+ mv "${D}"/usr/bin/yacc{,.bison} || die
+ mv "${D}"/usr/share/man/man1/yacc{,.bison}.1 || die
+
+ # We do not need this.
+ rm -r "${D}"/usr/lib* || die
+
+ dodoc AUTHORS NEWS ChangeLog README OChangeLog THANKS TODO
+}
+
+pkg_postinst() {
+ if [[ ! -e ${ROOT}/usr/bin/yacc ]] ; then
+ ln -s yacc.bison "${ROOT}"/usr/bin/yacc
+ fi
+}
diff --git a/sys-devel/bison/bison-2.7.1.ebuild b/sys-devel/bison/bison-2.7.1.ebuild
new file mode 100644
index 000000000000..04f7b63c0849
--- /dev/null
+++ b/sys-devel/bison/bison-2.7.1.ebuild
@@ -0,0 +1,59 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit flag-o-matic
+
+DESCRIPTION="A general-purpose (yacc-compatible) parser generator"
+HOMEPAGE="http://www.gnu.org/software/bison/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~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="nls static"
+
+RDEPEND=">=sys-devel/m4-1.4.16"
+DEPEND="${RDEPEND}
+ sys-devel/flex
+ nls? ( sys-devel/gettext )"
+
+DOCS="AUTHORS ChangeLog-2012 NEWS README THANKS TODO" # ChangeLog-1998 PACKAGING README-alpha README-release
+
+src_configure() {
+ use static && append-ldflags -static
+
+ econf \
+ $(use_enable nls)
+}
+
+src_install() {
+ default
+
+ # This one is installed by dev-util/yacc
+ mv "${ED}"/usr/bin/yacc{,.bison} || die
+ mv "${ED}"/usr/share/man/man1/yacc{,.bison}.1 || die
+
+ # We do not need liby.a
+ rm -r "${ED}"/usr/lib* || die
+
+ # Move to documentation directory and leave compressing for EAPI>=4
+ mv "${ED}"/usr/share/${PN}/README "${ED}"/usr/share/doc/${PF}/README.data
+}
+
+pkg_postinst() {
+ local f="${EROOT}/usr/bin/yacc"
+ if [[ ! -e ${f} ]] ; then
+ ln -s yacc.bison "${f}"
+ fi
+}
+
+pkg_postrm() {
+ # clean up the dead symlink when we get unmerged #377469
+ local f="${EROOT}/usr/bin/yacc"
+ if [[ -L ${f} && ! -e ${f} ]] ; then
+ rm -f "${f}"
+ fi
+}
diff --git a/sys-devel/bison/bison-3.0.3-r1.ebuild b/sys-devel/bison/bison-3.0.3-r1.ebuild
new file mode 100644
index 000000000000..5e1bafdf46a7
--- /dev/null
+++ b/sys-devel/bison/bison-3.0.3-r1.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit flag-o-matic
+
+DESCRIPTION="A general-purpose (yacc-compatible) parser generator"
+HOMEPAGE="http://www.gnu.org/software/bison/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~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="nls static"
+
+RDEPEND=">=sys-devel/m4-1.4.16"
+DEPEND="${RDEPEND}
+ sys-devel/flex
+ nls? ( sys-devel/gettext )"
+
+DOCS=( AUTHORS ChangeLog-2012 NEWS README THANKS TODO ) # ChangeLog-1998 PACKAGING README-alpha README-release
+
+src_configure() {
+ use static && append-ldflags -static
+
+ econf \
+ --docdir="${EPREFIX}"/usr/share/doc/${PF} \
+ $(use_enable nls)
+}
+
+src_install() {
+ default
+
+ # This one is installed by dev-util/yacc
+ mv "${ED}"/usr/bin/yacc{,.bison} || die
+ mv "${ED}"/usr/share/man/man1/yacc{,.bison}.1 || die
+
+ # We do not need liby.a
+ rm -r "${ED}"/usr/lib* || die
+
+ # Move to documentation directory and leave compressing for EAPI>=4
+ mv "${ED}"/usr/share/${PN}/README "${ED}"/usr/share/doc/${PF}/README.data
+}
+
+pkg_postinst() {
+ local f="${EROOT}/usr/bin/yacc"
+ if [[ ! -e ${f} ]] ; then
+ ln -s yacc.bison "${f}"
+ fi
+}
+
+pkg_postrm() {
+ # clean up the dead symlink when we get unmerged #377469
+ local f="${EROOT}/usr/bin/yacc"
+ if [[ -L ${f} && ! -e ${f} ]] ; then
+ rm -f "${f}"
+ fi
+}
diff --git a/sys-devel/bison/bison-3.0.4-r1.ebuild b/sys-devel/bison/bison-3.0.4-r1.ebuild
new file mode 100644
index 000000000000..fbc1fc9087e6
--- /dev/null
+++ b/sys-devel/bison/bison-3.0.4-r1.ebuild
@@ -0,0 +1,69 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit flag-o-matic eutils
+
+DESCRIPTION="A general-purpose (yacc-compatible) parser generator"
+HOMEPAGE="http://www.gnu.org/software/bison/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~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="examples nls static test"
+
+RDEPEND=">=sys-devel/m4-1.4.16"
+DEPEND="${RDEPEND}
+ sys-devel/flex
+ examples? ( dev-lang/perl )
+ nls? ( sys-devel/gettext )
+ test? ( dev-lang/perl )"
+
+DOCS=( AUTHORS ChangeLog-2012 NEWS README THANKS TODO ) # ChangeLog-1998 PACKAGING README-alpha README-release
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-optional-perl.patch #538300
+ touch doc/bison.1 #548778
+}
+
+src_configure() {
+ use static && append-ldflags -static
+
+ac_cv_path_PERL=true \
+ econf \
+ --docdir='$(datarootdir)'/doc/${PF} \
+ $(use_enable examples) \
+ $(use_enable nls)
+}
+
+src_install() {
+ default
+
+ # This one is installed by dev-util/yacc
+ mv "${ED}"/usr/bin/yacc{,.bison} || die
+ mv "${ED}"/usr/share/man/man1/yacc{,.bison}.1 || die
+
+ # We do not need liby.a
+ rm -r "${ED}"/usr/lib* || die
+
+ # Move to documentation directory and leave compressing for EAPI>=4
+ mv "${ED}"/usr/share/${PN}/README "${ED}"/usr/share/doc/${PF}/README.data
+}
+
+pkg_postinst() {
+ local f="${EROOT}/usr/bin/yacc"
+ if [[ ! -e ${f} ]] ; then
+ ln -s yacc.bison "${f}"
+ fi
+}
+
+pkg_postrm() {
+ # clean up the dead symlink when we get unmerged #377469
+ local f="${EROOT}/usr/bin/yacc"
+ if [[ -L ${f} && ! -e ${f} ]] ; then
+ rm -f "${f}"
+ fi
+}
diff --git a/sys-devel/bison/bison-3.0.4.ebuild b/sys-devel/bison/bison-3.0.4.ebuild
new file mode 100644
index 000000000000..5e1bafdf46a7
--- /dev/null
+++ b/sys-devel/bison/bison-3.0.4.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit flag-o-matic
+
+DESCRIPTION="A general-purpose (yacc-compatible) parser generator"
+HOMEPAGE="http://www.gnu.org/software/bison/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~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="nls static"
+
+RDEPEND=">=sys-devel/m4-1.4.16"
+DEPEND="${RDEPEND}
+ sys-devel/flex
+ nls? ( sys-devel/gettext )"
+
+DOCS=( AUTHORS ChangeLog-2012 NEWS README THANKS TODO ) # ChangeLog-1998 PACKAGING README-alpha README-release
+
+src_configure() {
+ use static && append-ldflags -static
+
+ econf \
+ --docdir="${EPREFIX}"/usr/share/doc/${PF} \
+ $(use_enable nls)
+}
+
+src_install() {
+ default
+
+ # This one is installed by dev-util/yacc
+ mv "${ED}"/usr/bin/yacc{,.bison} || die
+ mv "${ED}"/usr/share/man/man1/yacc{,.bison}.1 || die
+
+ # We do not need liby.a
+ rm -r "${ED}"/usr/lib* || die
+
+ # Move to documentation directory and leave compressing for EAPI>=4
+ mv "${ED}"/usr/share/${PN}/README "${ED}"/usr/share/doc/${PF}/README.data
+}
+
+pkg_postinst() {
+ local f="${EROOT}/usr/bin/yacc"
+ if [[ ! -e ${f} ]] ; then
+ ln -s yacc.bison "${f}"
+ fi
+}
+
+pkg_postrm() {
+ # clean up the dead symlink when we get unmerged #377469
+ local f="${EROOT}/usr/bin/yacc"
+ if [[ -L ${f} && ! -e ${f} ]] ; then
+ rm -f "${f}"
+ fi
+}
diff --git a/sys-devel/bison/files/bison-1.32-extfix.patch b/sys-devel/bison/files/bison-1.32-extfix.patch
new file mode 100644
index 000000000000..363d038d8a52
--- /dev/null
+++ b/sys-devel/bison/files/bison-1.32-extfix.patch
@@ -0,0 +1,28 @@
+2002-02-15 Gwenole Beauchesne <gbeauchesne@mandrakesoft.com>
+
+ * src/files (compute_exts_from_gf, compute_exts_from_src): Handle
+ the case where header_extension is the same as src_extension, aka
+ handle -d -o <file> where <file> doesn't have a known EXT to
+ transform. e.g. if <file> is <something>.yxx, set the
+ header_extension to <something>.yxx.h, as would do bison 1.28.
+
+--- bison-1.32/src/files.c.extfix Mon Jan 21 16:41:46 2002
++++ bison-1.32/src/files.c Fri Feb 15 15:40:43 2002
+@@ -288,6 +288,8 @@ compute_exts_from_gf (const char *ext)
+ src_extension = tr (src_extension, 'Y', 'C');
+ header_extension = tr (ext, 'y', 'h');
+ header_extension = tr (header_extension, 'Y', 'H');
++ if (!strcmp (header_extension, src_extension))
++ header_extension = concat2 (src_extension, ".h");
+ }
+
+ /* Computes extensions from the given c source file extension. */
+@@ -300,6 +302,8 @@ compute_exts_from_src (const char *ext)
+ src_extension = xstrdup (ext);
+ header_extension = tr (ext, 'c', 'h');
+ header_extension = tr (header_extension, 'C', 'H');
++ if (!strcmp (header_extension, src_extension))
++ header_extension = concat2 (src_extension, ".h");
+ }
+
+
diff --git a/sys-devel/bison/files/bison-2.4.3-no-gets.patch b/sys-devel/bison/files/bison-2.4.3-no-gets.patch
new file mode 100644
index 000000000000..a49a816f4761
--- /dev/null
+++ b/sys-devel/bison/files/bison-2.4.3-no-gets.patch
@@ -0,0 +1,22 @@
+hack until bizon pulls a newer gnulib version
+
+From 66712c23388e93e5c518ebc8515140fa0c807348 Mon Sep 17 00:00:00 2001
+From: Eric Blake <eblake@redhat.com>
+Date: Thu, 29 Mar 2012 13:30:41 -0600
+Subject: [PATCH] stdio: don't assume gets any more
+
+Gnulib intentionally does not have a gets module, and now that C11
+and glibc have dropped it, we should be more proactive about warning
+any user on a platform that still has a declaration of this dangerous
+interface.
+
+--- a/lib/stdio.in.h
++++ b/lib/stdio.in.h
+@@ -125,7 +125,6 @@
+ so any use of gets warrants an unconditional warning. Assume it is
+ always declared, since it is required by C89. */
+ #undef gets
+-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+
+ #if @GNULIB_FOPEN@
+ # if @REPLACE_FOPEN@
diff --git a/sys-devel/bison/files/bison-2.4.3-uclibc-sched_param-def.patch b/sys-devel/bison/files/bison-2.4.3-uclibc-sched_param-def.patch
new file mode 100644
index 000000000000..50652d8babc2
--- /dev/null
+++ b/sys-devel/bison/files/bison-2.4.3-uclibc-sched_param-def.patch
@@ -0,0 +1,19 @@
+uclibc defines __GLIBC__ but it does not expose struct shed_param as much as glibc
+and is not needed too per standard. gnulib attempts to use it but we have to account
+for it because in this case uclibc does not behave like glibc.
+
+-Khem
+
+http://bugs.gentoo.org/336484
+
+--- m4-1.4.14/lib/spawn.in.h
++++ m4-1.4.14/lib/spawn.in.h
+@@ -31,7 +31,7 @@
+
+ /* Get definitions of 'struct sched_param' and 'sigset_t'.
+ But avoid namespace pollution on glibc systems. */
+-#ifndef __GLIBC__
++#if !defined __GLIBC__ || defined __UCLIBC__
+ # include <sched.h>
+ # include <signal.h>
+ #endif
diff --git a/sys-devel/bison/files/bison-3.0.4-optional-perl.patch b/sys-devel/bison/files/bison-3.0.4-optional-perl.patch
new file mode 100644
index 000000000000..ba0bf7b2d5b3
--- /dev/null
+++ b/sys-devel/bison/files/bison-3.0.4-optional-perl.patch
@@ -0,0 +1,500 @@
+https://bugs.gentoo.org/538300
+
+From 3da25ddd011c169b9857ed2f6a2e82988f059ba5 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Fri, 3 Apr 2015 02:39:21 -0400
+Subject: [PATCH] make perl & examples optional
+
+The normal bison program does not require perl to build or run, so lets
+soften that requirement in the configure script. We now warn if its not
+found, and we make the examples logic depend on that.
+
+* configure.ac: Change AC_MSG_ERROR to AC_MSG_WARN for perl.
+Add an --enable-examples flag.
+* Makefile.am: Only include examples/local.mk when ENABLE_EXAMPLES.
+---
+ Makefile.am | 2 ++
+ configure.ac | 21 ++++++++++++++++++++-
+ 2 files changed, 22 insertions(+), 1 deletion(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index b6135cb..50ea0a0 100644
+#--- a/Makefile.am
+#+++ b/Makefile.am
+@@ -59,7 +59,9 @@ include data/local.mk
+ include djgpp/local.mk
+ include doc/local.mk
+ include etc/local.mk
++if ENABLE_EXAMPLES
+ include examples/local.mk
++endif
+ include lib/local.mk
+ include src/local.mk
+ include tests/local.mk
+diff --git a/configure.ac b/configure.ac
+index 6f20040..e67249b 100644
+#--- a/configure.ac
+#+++ b/configure.ac
+@@ -179,12 +179,31 @@ AC_DEFINE_UNQUOTED([M4_GNU_OPTION], ["$M4_GNU"], [Define to "-g" if GNU M4
+ supports -g, otherwise to "".])
+ AC_PATH_PROG([PERL], [perl])
+ if test -z "$PERL"; then
+- AC_MSG_ERROR([perl not found])
++ AC_MSG_WARN([perl required for the testsuites])
+ fi
+ AM_MISSING_PROG([HELP2MAN], [help2man])
+ AC_PATH_PROG([XSLTPROC], [xsltproc])
+ AC_SUBST([XSLTPROC])
+
++AC_ARG_ENABLE([examples],
++ [AC_HELP_STRING([--disable-examples],
++ [do not build and install examples])])
++# Enable the examles by default if perl is available.
++case $enable_examples in
++no) ;;
++yes)
++ if test -z "$PERL"; then
++ AC_MSG_ERROR([perl required for the examples])
++ fi
++ ;;
++*)
++ if test -n "$PERL"; then
++ enable_examples=yes
++ fi
++ ;;
++esac
++AM_CONDITIONAL([ENABLE_EXAMPLES], [test "xenable_examples" = xyes])
++
+ # Checks for header files.
+ AC_CHECK_HEADERS_ONCE([locale.h])
+
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -248,13 +248,29 @@
+ POST_UNINSTALL = :
+ build_triplet = @build@
+ host_triplet = @host@
+-check_PROGRAMS = $(am__EXEEXT_1) examples/mfcalc/mfcalc$(EXEEXT) \
+- examples/rpcalc/rpcalc$(EXEEXT)
++check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2)
+ @CROSS_COMPILING_FALSE@am__append_1 = $(top_srcdir)/doc/bison.help
+-@FLEX_CXX_WORKS_TRUE@am__append_2 = examples/calc++/calc++
+-@FLEX_CXX_WORKS_TRUE@am__append_3 = examples/calc++/calc++.test
+-@FLEX_CXX_WORKS_FALSE@am__append_4 = examples/calc++/calc++.test
+-@LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH_TRUE@am__append_5 = lib/uniwidth/width.c
++@ENABLE_EXAMPLES_TRUE@am__append_2 = $(extracted) \
++@ENABLE_EXAMPLES_TRUE@ examples/extracted.stamp \
++@ENABLE_EXAMPLES_TRUE@ $(calcxx_sources_generated) \
++@ENABLE_EXAMPLES_TRUE@ examples/calc++/calc++-parser.output \
++@ENABLE_EXAMPLES_TRUE@ examples/calc++/calc++-parser.stamp \
++@ENABLE_EXAMPLES_TRUE@ examples/calc++/calc++-scanner.cc \
++@ENABLE_EXAMPLES_TRUE@ examples/mfcalc/mfcalc.[ch] \
++@ENABLE_EXAMPLES_TRUE@ examples/mfcalc/mfcalc.output \
++@ENABLE_EXAMPLES_TRUE@ examples/rpcalc/rpcalc.[ch] \
++@ENABLE_EXAMPLES_TRUE@ examples/rpcalc/rpcalc.output
++@ENABLE_EXAMPLES_TRUE@am__append_3 = .yy .stamp
++@ENABLE_EXAMPLES_TRUE@@FLEX_CXX_WORKS_TRUE@am__append_4 = examples/calc++/calc++
++@ENABLE_EXAMPLES_TRUE@@FLEX_CXX_WORKS_TRUE@am__append_5 = examples/calc++/calc++.test
++@ENABLE_EXAMPLES_TRUE@@FLEX_CXX_WORKS_FALSE@am__append_6 = examples/calc++/calc++.test
++@ENABLE_EXAMPLES_TRUE@am__append_7 = $(mfcalc_sources) \
++@ENABLE_EXAMPLES_TRUE@ $(rpcalc_sources)
++@ENABLE_EXAMPLES_TRUE@am__append_8 = examples/mfcalc/mfcalc \
++@ENABLE_EXAMPLES_TRUE@ examples/rpcalc/rpcalc
++@ENABLE_EXAMPLES_TRUE@am__append_9 = examples/mfcalc/mfcalc.test \
++@ENABLE_EXAMPLES_TRUE@ examples/rpcalc/rpcalc.test
++@LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH_TRUE@am__append_10 = lib/uniwidth/width.c
+ bin_PROGRAMS = src/bison$(EXEEXT)
+ subdir = .
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+@@ -356,7 +372,7 @@
+ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+ DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
+- $(am__configure_deps) $(dist_noinst_SCRIPTS) \
++ $(am__configure_deps) $(am__dist_noinst_SCRIPTS_DIST) \
+ $(srcdir)/doc/version.texi $(srcdir)/doc/stamp-vti \
+ $(dist_doc_DATA) $(dist_m4sugar_DATA) $(dist_pkgdata_DATA) \
+ $(dist_xslt_DATA) $(am__DIST_COMMON)
+@@ -473,15 +489,18 @@
+ @ENABLE_YACC_TRUE@am_lib_liby_a_OBJECTS = lib/main.$(OBJEXT) \
+ @ENABLE_YACC_TRUE@ lib/yyerror.$(OBJEXT)
+ lib_liby_a_OBJECTS = $(am_lib_liby_a_OBJECTS)
+-@FLEX_CXX_WORKS_TRUE@am__EXEEXT_1 = examples/calc++/calc++$(EXEEXT)
++@ENABLE_EXAMPLES_TRUE@@FLEX_CXX_WORKS_TRUE@am__EXEEXT_1 = examples/calc++/calc++$(EXEEXT)
++@ENABLE_EXAMPLES_TRUE@am__EXEEXT_2 = examples/mfcalc/mfcalc$(EXEEXT) \
++@ENABLE_EXAMPLES_TRUE@ examples/rpcalc/rpcalc$(EXEEXT)
+ PROGRAMS = $(bin_PROGRAMS)
+-am__objects_2 = examples/calc++/examples_calc___calc__-calc++-driver.$(OBJEXT) \
+- examples/calc++/examples_calc___calc__-calc++-scanner.$(OBJEXT) \
+- examples/calc++/examples_calc___calc__-calc++.$(OBJEXT)
+-am__objects_3 = examples/calc++/examples_calc___calc__-calc++-parser.$(OBJEXT)
+-am__objects_4 = $(am__objects_2) $(am__objects_3)
+-@FLEX_CXX_WORKS_TRUE@nodist_examples_calc___calc___OBJECTS = \
+-@FLEX_CXX_WORKS_TRUE@ $(am__objects_4)
++@ENABLE_EXAMPLES_TRUE@am__objects_2 = examples/calc++/examples_calc___calc__-calc++-driver.$(OBJEXT) \
++@ENABLE_EXAMPLES_TRUE@ examples/calc++/examples_calc___calc__-calc++-scanner.$(OBJEXT) \
++@ENABLE_EXAMPLES_TRUE@ examples/calc++/examples_calc___calc__-calc++.$(OBJEXT)
++@ENABLE_EXAMPLES_TRUE@am__objects_3 = examples/calc++/examples_calc___calc__-calc++-parser.$(OBJEXT)
++@ENABLE_EXAMPLES_TRUE@am__objects_4 = $(am__objects_2) \
++@ENABLE_EXAMPLES_TRUE@ $(am__objects_3)
++@ENABLE_EXAMPLES_TRUE@@FLEX_CXX_WORKS_TRUE@nodist_examples_calc___calc___OBJECTS = \
++@ENABLE_EXAMPLES_TRUE@@FLEX_CXX_WORKS_TRUE@ $(am__objects_4)
+ examples_calc___calc___OBJECTS = \
+ $(nodist_examples_calc___calc___OBJECTS)
+ examples_calc___calc___LDADD = $(LDADD)
+@@ -490,17 +509,17 @@
+ examples_calc___calc___LINK = $(CXXLD) \
+ $(examples_calc___calc___CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+-am__objects_5 = \
+- examples/mfcalc/examples_mfcalc_mfcalc-mfcalc.$(OBJEXT)
+-am__objects_6 = $(am__objects_5)
+-nodist_examples_mfcalc_mfcalc_OBJECTS = $(am__objects_6)
++@ENABLE_EXAMPLES_TRUE@am__objects_5 = examples/mfcalc/examples_mfcalc_mfcalc-mfcalc.$(OBJEXT)
++@ENABLE_EXAMPLES_TRUE@am__objects_6 = $(am__objects_5)
++@ENABLE_EXAMPLES_TRUE@nodist_examples_mfcalc_mfcalc_OBJECTS = \
++@ENABLE_EXAMPLES_TRUE@ $(am__objects_6)
+ examples_mfcalc_mfcalc_OBJECTS = \
+ $(nodist_examples_mfcalc_mfcalc_OBJECTS)
+ examples_mfcalc_mfcalc_DEPENDENCIES =
+-am__objects_7 = \
+- examples/rpcalc/examples_rpcalc_rpcalc-rpcalc.$(OBJEXT)
+-am__objects_8 = $(am__objects_7)
+-nodist_examples_rpcalc_rpcalc_OBJECTS = $(am__objects_8)
++@ENABLE_EXAMPLES_TRUE@am__objects_7 = examples/rpcalc/examples_rpcalc_rpcalc-rpcalc.$(OBJEXT)
++@ENABLE_EXAMPLES_TRUE@am__objects_8 = $(am__objects_7)
++@ENABLE_EXAMPLES_TRUE@nodist_examples_rpcalc_rpcalc_OBJECTS = \
++@ENABLE_EXAMPLES_TRUE@ $(am__objects_8)
+ examples_rpcalc_rpcalc_OBJECTS = \
+ $(nodist_examples_rpcalc_rpcalc_OBJECTS)
+ examples_rpcalc_rpcalc_DEPENDENCIES =
+@@ -528,6 +547,7 @@
+ src_bison_DEPENDENCIES = lib/libbison.a $(am__DEPENDENCIES_1)
+ src_bison_LINK = $(CCLD) $(src_bison_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
++am__dist_noinst_SCRIPTS_DIST = examples/extexi examples/test
+ SCRIPTS = $(bin_SCRIPTS) $(dist_noinst_SCRIPTS) \
+ $(nodist_noinst_SCRIPTS)
+ AM_V_P = $(am__v_P_@AM_V@)
+@@ -2145,7 +2165,7 @@
+ djgpp/subpipe.h djgpp/testsuite.sed doc/refcard.tex \
+ $(top_srcdir)/doc/bison.help $(dist_man_MANS:.1=.x) $(FIGS_GV) \
+ $(FIGS_GV:.gv=.txt) $(FIGS_GV:.gv=.eps) $(FIGS_GV:.gv=.pdf) \
+- $(FIGS_GV:.gv=.png) doc/Doxyfile.in $(am__append_4) \
++ $(FIGS_GV:.gv=.png) doc/Doxyfile.in $(am__append_6) \
+ lib/alignof.h lib/alloca.in.h \
+ $(top_srcdir)/build-aux/announce-gen lib/argmatch.h \
+ lib/c-strcaseeq.h lib/calloc.c lib/cloexec.h lib/close.c \
+@@ -2249,27 +2269,20 @@
+ # a developer might naively reference .version in a test case while the bison
+ # executable still compiles with VERSION, and so the test case might fail or
+ # pass incorrectly.
+-BUILT_SOURCES = $(mfcalc_sources) $(rpcalc_sources) $(ALLOCA_H) \
+- lib/configmake.h $(ERRNO_H) lib/fcntl.h $(FLOAT_H) $(GETOPT_H) \
+- lib/inttypes.h lib/math.h $(SCHED_H) lib/signal.h \
+- lib/arg-nonnull.h lib/c++defs.h lib/warn-on-use.h lib/spawn.h \
+- $(STDBOOL_H) $(STDDEF_H) $(STDINT_H) lib/stdio.h lib/stdlib.h \
+- lib/string.h lib/sys/stat.h lib/sys/time.h lib/sys/types.h \
+- lib/sys/wait.h lib/time.h lib/unistd.h \
+- $(LIBUNISTRING_UNITYPES_H) $(LIBUNISTRING_UNIWIDTH_H) \
+- lib/wchar.h lib/wctype.h src/parse-gram.c src/parse-gram.h \
+- src/scan-code.c src/scan-gram.c src/scan-skel.c \
+- $(top_srcdir)/.version
++BUILT_SOURCES = $(am__append_7) $(ALLOCA_H) lib/configmake.h \
++ $(ERRNO_H) lib/fcntl.h $(FLOAT_H) $(GETOPT_H) lib/inttypes.h \
++ lib/math.h $(SCHED_H) lib/signal.h lib/arg-nonnull.h \
++ lib/c++defs.h lib/warn-on-use.h lib/spawn.h $(STDBOOL_H) \
++ $(STDDEF_H) $(STDINT_H) lib/stdio.h lib/stdlib.h lib/string.h \
++ lib/sys/stat.h lib/sys/time.h lib/sys/types.h lib/sys/wait.h \
++ lib/time.h lib/unistd.h $(LIBUNISTRING_UNITYPES_H) \
++ $(LIBUNISTRING_UNIWIDTH_H) lib/wchar.h lib/wctype.h \
++ src/parse-gram.c src/parse-gram.h src/scan-code.c \
++ src/scan-gram.c src/scan-skel.c $(top_srcdir)/.version
+ CLEANFILES = doc/refcard.pdf $(FIGS_GV:.gv=.eps) $(FIGS_GV:.gv=.pdf) \
+- $(FIGS_GV:.gv=.png) doc/Doxyfile $(extracted) \
+- examples/extracted.stamp $(calcxx_sources_generated) \
+- examples/calc++/calc++-parser.output \
+- examples/calc++/calc++-parser.stamp \
+- examples/calc++/calc++-scanner.cc examples/mfcalc/mfcalc.[ch] \
+- examples/mfcalc/mfcalc.output examples/rpcalc/rpcalc.[ch] \
+- examples/rpcalc/rpcalc.output lib/configmake.h \
+- lib/configmake.h-t lib/charset.alias lib/ref-add.sed \
+- lib/ref-del.sed
++ $(FIGS_GV:.gv=.png) doc/Doxyfile $(am__append_2) \
++ lib/configmake.h lib/configmake.h-t lib/charset.alias \
++ lib/ref-add.sed lib/ref-del.sed
+ DISTCLEANFILES = tests/atconfig $(check_SCRIPTS)
+ MOSTLYCLEANDIRS = lib/sys lib/sys
+ MOSTLYCLEANFILES = $(top_srcdir)/doc/*.t lib/core lib/*.stackdump \
+@@ -2289,10 +2302,9 @@
+ lib/unistd.h-t lib/unitypes.h lib/unitypes.h-t lib/uniwidth.h \
+ lib/uniwidth.h-t lib/wchar.h lib/wchar.h-t lib/wctype.h \
+ lib/wctype.h-t src/yacc
+-SUFFIXES = .gv .eps .pdf .png .yy .stamp
++SUFFIXES = .gv .eps .pdf .png $(am__append_3)
+ TESTS = $(dist_TESTS)
+-dist_TESTS = $(am__append_3) examples/mfcalc/mfcalc.test \
+- examples/rpcalc/rpcalc.test
++dist_TESTS = $(am__append_5) $(am__append_9)
+ noinst_LIBRARIES = lib/libbison.a
+ dist_pkgdata_DATA = \
+ data/README \
+@@ -2364,59 +2376,59 @@
+ -e 's,@top_srcdir\@,$(top_srcdir),g'
+
+ nodist_noinst_SCRIPTS = etc/bench.pl
+-dist_noinst_SCRIPTS = examples/extexi examples/test
+-TEST_LOG_COMPILER = $(top_srcdir)/examples/test
+-AM_CXXFLAGS = \
+- $(WARN_CXXFLAGS) $(WARN_CXXFLAGS_TEST) $(WERROR_CXXFLAGS)
+-
+-doc = $(top_srcdir)/doc/bison.texi
+-extexi = $(top_srcdir)/examples/extexi
+-@ENABLE_GCC_WARNINGS_TRUE@extexiFLAGS = --synclines
+-extract = VERSION="$(VERSION)" $(PERL) $(extexi) $(extexiFLAGS) $(doc) --
+-extracted = $(calcxx_extracted) $(mfcalc_extracted) \
+- $(rpcalc_extracted)
+-calcxx_sources_extracted = \
+- examples/calc++/calc++-driver.cc \
+- examples/calc++/calc++-driver.hh \
+- examples/calc++/calc++-scanner.ll \
+- examples/calc++/calc++.cc
+-
+-calcxx_extracted = \
+- $(calcxx_sources_extracted) \
+- examples/calc++/calc++-parser.yy
+-
+-calcxx_sources_generated = \
+- examples/calc++/calc++-parser.cc \
+- examples/calc++/calc++-parser.hh \
+- examples/calc++/location.hh \
+- examples/calc++/position.hh \
+- examples/calc++/stack.hh
+-
+-calcxx_sources = \
+- $(calcxx_sources_extracted) \
+- $(calcxx_sources_generated)
+-
+-@FLEX_CXX_WORKS_TRUE@nodist_examples_calc___calc___SOURCES = \
+-@FLEX_CXX_WORKS_TRUE@ $(calcxx_sources)
+-
+-@FLEX_CXX_WORKS_TRUE@examples_calc___calc___CPPFLAGS = -I$(top_builddir)/examples/calc++
+-@FLEX_CXX_WORKS_TRUE@examples_calc___calc___CXXFLAGS = $(AM_CXXFLAGS) $(FLEX_SCANNER_CXXFLAGS)
+-calcxxdir = $(docdir)/examples/calc++
+-calcxx_DATA = $(calcxx_extracted)
+-mfcalc_extracted = examples/mfcalc/calc.h examples/mfcalc/mfcalc.y
+-mfcalc_sources = $(mfcalc_extracted)
+-examples_mfcalc_mfcalc_LDADD = -lm
+-nodist_examples_mfcalc_mfcalc_SOURCES = $(mfcalc_sources)
+-examples_mfcalc_mfcalc_CPPFLAGS = -I$(top_builddir)/examples/mfcalc
+-mfcalcdir = $(docdir)/examples/mfcalc
+-mfcalc_DATA = $(mfcalc_extracted)
+-rpcalc_extracted = examples/rpcalc/rpcalc.y
+-rpcalc_sources = $(rpcalc_extracted)
+-examples_rpcalc_rpcalc_LDADD = -lm
+-nodist_examples_rpcalc_rpcalc_SOURCES = $(rpcalc_sources)
+-examples_rpcalc_rpcalc_CPPFLAGS = -I$(top_builddir)/examples/rpcalc
+-rpcalcdir = $(docdir)/examples/rpcalc
+-rpcalc_DATA = $(rpcalc_extracted)
++@ENABLE_EXAMPLES_TRUE@dist_noinst_SCRIPTS = examples/extexi examples/test
++@ENABLE_EXAMPLES_TRUE@TEST_LOG_COMPILER = $(top_srcdir)/examples/test
++@ENABLE_EXAMPLES_TRUE@AM_CXXFLAGS = \
++@ENABLE_EXAMPLES_TRUE@ $(WARN_CXXFLAGS) $(WARN_CXXFLAGS_TEST) $(WERROR_CXXFLAGS)
++
++@ENABLE_EXAMPLES_TRUE@doc = $(top_srcdir)/doc/bison.texi
++@ENABLE_EXAMPLES_TRUE@extexi = $(top_srcdir)/examples/extexi
++@ENABLE_EXAMPLES_TRUE@@ENABLE_GCC_WARNINGS_TRUE@extexiFLAGS = --synclines
++@ENABLE_EXAMPLES_TRUE@extract = VERSION="$(VERSION)" $(PERL) $(extexi) $(extexiFLAGS) $(doc) --
++@ENABLE_EXAMPLES_TRUE@extracted = $(calcxx_extracted) \
++@ENABLE_EXAMPLES_TRUE@ $(mfcalc_extracted) $(rpcalc_extracted)
++@ENABLE_EXAMPLES_TRUE@calcxx_sources_extracted = \
++@ENABLE_EXAMPLES_TRUE@ examples/calc++/calc++-driver.cc \
++@ENABLE_EXAMPLES_TRUE@ examples/calc++/calc++-driver.hh \
++@ENABLE_EXAMPLES_TRUE@ examples/calc++/calc++-scanner.ll \
++@ENABLE_EXAMPLES_TRUE@ examples/calc++/calc++.cc
++
++@ENABLE_EXAMPLES_TRUE@calcxx_extracted = \
++@ENABLE_EXAMPLES_TRUE@ $(calcxx_sources_extracted) \
++@ENABLE_EXAMPLES_TRUE@ examples/calc++/calc++-parser.yy
++
++@ENABLE_EXAMPLES_TRUE@calcxx_sources_generated = \
++@ENABLE_EXAMPLES_TRUE@ examples/calc++/calc++-parser.cc \
++@ENABLE_EXAMPLES_TRUE@ examples/calc++/calc++-parser.hh \
++@ENABLE_EXAMPLES_TRUE@ examples/calc++/location.hh \
++@ENABLE_EXAMPLES_TRUE@ examples/calc++/position.hh \
++@ENABLE_EXAMPLES_TRUE@ examples/calc++/stack.hh
++
++@ENABLE_EXAMPLES_TRUE@calcxx_sources = \
++@ENABLE_EXAMPLES_TRUE@ $(calcxx_sources_extracted) \
++@ENABLE_EXAMPLES_TRUE@ $(calcxx_sources_generated)
++
++@ENABLE_EXAMPLES_TRUE@@FLEX_CXX_WORKS_TRUE@nodist_examples_calc___calc___SOURCES = \
++@ENABLE_EXAMPLES_TRUE@@FLEX_CXX_WORKS_TRUE@ $(calcxx_sources)
++
++@ENABLE_EXAMPLES_TRUE@@FLEX_CXX_WORKS_TRUE@examples_calc___calc___CPPFLAGS = -I$(top_builddir)/examples/calc++
++@ENABLE_EXAMPLES_TRUE@@FLEX_CXX_WORKS_TRUE@examples_calc___calc___CXXFLAGS = $(AM_CXXFLAGS) $(FLEX_SCANNER_CXXFLAGS)
++@ENABLE_EXAMPLES_TRUE@calcxxdir = $(docdir)/examples/calc++
++@ENABLE_EXAMPLES_TRUE@calcxx_DATA = $(calcxx_extracted)
++@ENABLE_EXAMPLES_TRUE@mfcalc_extracted = examples/mfcalc/calc.h examples/mfcalc/mfcalc.y
++@ENABLE_EXAMPLES_TRUE@mfcalc_sources = $(mfcalc_extracted)
++@ENABLE_EXAMPLES_TRUE@examples_mfcalc_mfcalc_LDADD = -lm
++@ENABLE_EXAMPLES_TRUE@nodist_examples_mfcalc_mfcalc_SOURCES = $(mfcalc_sources)
++@ENABLE_EXAMPLES_TRUE@examples_mfcalc_mfcalc_CPPFLAGS = -I$(top_builddir)/examples/mfcalc
++@ENABLE_EXAMPLES_TRUE@mfcalcdir = $(docdir)/examples/mfcalc
++@ENABLE_EXAMPLES_TRUE@mfcalc_DATA = $(mfcalc_extracted)
++@ENABLE_EXAMPLES_TRUE@rpcalc_extracted = examples/rpcalc/rpcalc.y
++@ENABLE_EXAMPLES_TRUE@rpcalc_sources = $(rpcalc_extracted)
++@ENABLE_EXAMPLES_TRUE@examples_rpcalc_rpcalc_LDADD = -lm
++@ENABLE_EXAMPLES_TRUE@nodist_examples_rpcalc_rpcalc_SOURCES = $(rpcalc_sources)
++@ENABLE_EXAMPLES_TRUE@examples_rpcalc_rpcalc_CPPFLAGS = -I$(top_builddir)/examples/rpcalc
++@ENABLE_EXAMPLES_TRUE@rpcalcdir = $(docdir)/examples/rpcalc
++@ENABLE_EXAMPLES_TRUE@rpcalc_DATA = $(rpcalc_extracted)
+
+ # Implementation of bitsets.
+
+@@ -2441,7 +2453,7 @@
+ lib/progname.c lib/quotearg.c lib/sig-handler.c lib/size_max.h \
+ lib/spawn-pipe.h lib/spawn-pipe.c lib/w32spawn.h \
+ lib/glthread/threadlib.c lib/unistd.c lib/dup-safer.c \
+- lib/fd-safer.c lib/pipe-safer.c $(am__append_5) \
++ lib/fd-safer.c lib/pipe-safer.c $(am__append_10) \
+ lib/wait-process.h lib/wait-process.c lib/wctype-h.c \
+ lib/xmalloc.c lib/xalloc-die.c lib/xconcat-filename.c \
+ lib/xsize.h lib/xsize.c lib/xstrndup.h lib/xstrndup.c \
+@@ -5328,31 +5340,31 @@
+ # configure, because the former is way faster than the latter.
+ doc/Doxyfile: $(top_srcdir)/doc/Doxyfile.in
+ $(AM_V_GEN) $(edit) $(top_srcdir)/doc/Doxyfile.in >doc/Doxyfile
+-examples/extracted.stamp: $(doc) $(extexi)
+- $(AM_V_GEN)rm -f $@ $@.tmp
+- $(AM_V_at)touch $@.tmp
+- $(AM_V_at)$(extract) $(extracted)
+- $(AM_V_at)mv $@.tmp $@
+-
+-$(extracted): examples/extracted.stamp
+- @test -f $@ || rm -f examples/extracted.stamp
+- @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) examples/extracted.stamp
++@ENABLE_EXAMPLES_TRUE@examples/extracted.stamp: $(doc) $(extexi)
++@ENABLE_EXAMPLES_TRUE@ $(AM_V_GEN)rm -f $@ $@.tmp
++@ENABLE_EXAMPLES_TRUE@ $(AM_V_at)touch $@.tmp
++@ENABLE_EXAMPLES_TRUE@ $(AM_V_at)$(extract) $(extracted)
++@ENABLE_EXAMPLES_TRUE@ $(AM_V_at)mv $@.tmp $@
++
++@ENABLE_EXAMPLES_TRUE@$(extracted): examples/extracted.stamp
++@ENABLE_EXAMPLES_TRUE@ @test -f $@ || rm -f examples/extracted.stamp
++@ENABLE_EXAMPLES_TRUE@ @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) examples/extracted.stamp
+
+ # Don't depend on $(BISON) otherwise we would rebuild these files
+ # in srcdir, including during distcheck, which is forbidden.
+-examples/calc++/calc++-parser.stamp: $(BISON_IN)
+-.yy.stamp:
+- $(AM_V_YACC)rm -f $@
+- $(AM_V_at)touch $@.tmp
+- $(AM_V_at)$(YACCCOMPILE) -o $*.cc $<
+- $(AM_V_at)mv -f $@.tmp $@
+-
+-$(calcxx_sources_generated): examples/calc++/calc++-parser.stamp
+- @test -f $@ || rm -f examples/calc++/calc++-parser.stamp
+- @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) examples/calc++/calc++-parser.stamp
++@ENABLE_EXAMPLES_TRUE@examples/calc++/calc++-parser.stamp: $(BISON_IN)
++@ENABLE_EXAMPLES_TRUE@.yy.stamp:
++@ENABLE_EXAMPLES_TRUE@ $(AM_V_YACC)rm -f $@
++@ENABLE_EXAMPLES_TRUE@ $(AM_V_at)touch $@.tmp
++@ENABLE_EXAMPLES_TRUE@ $(AM_V_at)$(YACCCOMPILE) -o $*.cc $<
++@ENABLE_EXAMPLES_TRUE@ $(AM_V_at)mv -f $@.tmp $@
++
++@ENABLE_EXAMPLES_TRUE@$(calcxx_sources_generated): examples/calc++/calc++-parser.stamp
++@ENABLE_EXAMPLES_TRUE@ @test -f $@ || rm -f examples/calc++/calc++-parser.stamp
++@ENABLE_EXAMPLES_TRUE@ @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) examples/calc++/calc++-parser.stamp
+
+ # Avoid using BUILT_SOURCES which is too global.
+-$(examples_calc___calc___OBJECTS): $(calcxx_sources_generated)
++@ENABLE_EXAMPLES_TRUE@$(examples_calc___calc___OBJECTS): $(calcxx_sources_generated)
+
+ # We need the following in order to create <alloca.h> when the system
+ # doesn't have one that works with the given compiler.
+--- a/configure
++++ b/configure
+@@ -1693,6 +1693,8 @@
+ ALLOCA
+ GL_COND_LIBTOOL_FALSE
+ GL_COND_LIBTOOL_TRUE
++ENABLE_EXAMPLES_FALSE
++ENABLE_EXAMPLES_TRUE
+ XSLTPROC
+ HELP2MAN
+ PERL
+@@ -1837,6 +1839,7 @@
+ enable_threads
+ enable_gcc_warnings
+ enable_yacc
++enable_examples
+ enable_assert
+ with_gnu_ld
+ enable_rpath
+@@ -2493,6 +2496,7 @@
+ Also, issue synclines from the examples/ to
+ the corresponding source in the Texinfo doc.
+ --disable-yacc do not build a yacc command or an -ly library
++ --disable-examples do not build and install examples
+ --disable-assert turn off assertions
+ --disable-rpath do not hardcode runtime library paths
+ --disable-nls do not use Native Language Support
+@@ -8935,7 +8939,8 @@
+
+
+ if test -z "$PERL"; then
+- as_fn_error $? "perl not found" "$LINENO" 5
++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: perl required for the testsuites" >&5
++$as_echo "$as_me: WARNING: perl required for the testsuites" >&2;}
+ fi
+
+ HELP2MAN=${HELP2MAN-"${am_missing_run}help2man"}
+@@ -8982,6 +8987,34 @@
+
+
+
++# Check whether --enable-examples was given.
++if test "${enable_examples+set}" = set; then :
++ enableval=$enable_examples;
++fi
++
++# Enable the examles by default if perl is available.
++case $enable_examples in
++no) ;;
++yes)
++ if test -z "$PERL"; then
++ as_fn_error $? "perl required for the examples" "$LINENO" 5
++ fi
++ ;;
++*)
++ if test -n "$PERL"; then
++ enable_examples=yes
++ fi
++ ;;
++esac
++ if test "xenable_examples" = xyes; then
++ ENABLE_EXAMPLES_TRUE=
++ ENABLE_EXAMPLES_FALSE='#'
++else
++ ENABLE_EXAMPLES_TRUE='#'
++ ENABLE_EXAMPLES_FALSE=
++fi
++
++
+ # Checks for header files.
+
+
+@@ -38129,6 +38162,10 @@
+ as_fn_error $? "conditional \"FLEX_CXX_WORKS\" was never defined.
+ Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
++if test -z "${ENABLE_EXAMPLES_TRUE}" && test -z "${ENABLE_EXAMPLES_FALSE}"; then
++ as_fn_error $? "conditional \"ENABLE_EXAMPLES\" was never defined.
++Usually this means the macro was only invoked conditionally." "$LINENO" 5
++fi
+ if test -z "${GL_COND_LIBTOOL_TRUE}" && test -z "${GL_COND_LIBTOOL_FALSE}"; then
+ as_fn_error $? "conditional \"GL_COND_LIBTOOL\" was never defined.
+ Usually this means the macro was only invoked conditionally." "$LINENO" 5
+--
+2.3.4
diff --git a/sys-devel/bison/metadata.xml b/sys-devel/bison/metadata.xml
new file mode 100644
index 000000000000..96a2d586367d
--- /dev/null
+++ b/sys-devel/bison/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-devel/bmake/Manifest b/sys-devel/bmake/Manifest
new file mode 100644
index 000000000000..39b0f121dd61
--- /dev/null
+++ b/sys-devel/bmake/Manifest
@@ -0,0 +1,2 @@
+DIST bmake-20140214.tar.gz 508662 SHA256 2ec1771a800431c26361659ab0f96ec5c2536e85b46564eb69fa75a4b12886de SHA512 760d90652bdab5ac595a96974fd99147e5edb4cf0ab7bad477d77ad63184a3b487f253648b53767cf1d3eccfa5c57dd3dfc2b3256578231b646c4f409cc5d758 WHIRLPOOL c29f40f44f9447a2ce274d24ef9403bb42b616424c72194af96cba360eae73fa5ad89ff045f425e063419c8fd517c2dd463ca70fc8e2b0bb5864c4307a255db2
+DIST mk-20121010.tar.gz 71484 SHA256 7bf6cb980d077f725893b7b526f27b325f202fde04b8b4152e125e29f819d655 SHA512 57dab8846261b6ae84bc2f7ced2c05cb60b82b59d7983c7a318c2b5c173f0a0b2bf6289eefd0f5697a0d0a7095e3ae5ff3f07af32bce21be6d7068e7938f02f8 WHIRLPOOL 830158af62fd96ee02a3fba4f2402fb4e9f6cefa6f3bc2df624781fc7e3545b049780d1176280c073531f9e1e5c32db5ac6c6db9105f33b26d254dbb062c041e
diff --git a/sys-devel/bmake/bmake-20140214.ebuild b/sys-devel/bmake/bmake-20140214.ebuild
new file mode 100644
index 000000000000..2bd01f3bca61
--- /dev/null
+++ b/sys-devel/bmake/bmake-20140214.ebuild
@@ -0,0 +1,55 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=3
+
+inherit eutils
+
+MK_VER=20121010
+DESCRIPTION="NetBSD's portable make"
+HOMEPAGE="http://www.crufty.net/help/sjg/bmake.html"
+SRC_URI="http://void.crufty.net/ftp/pub/sjg/${P}.tar.gz
+ http://void.crufty.net/ftp/pub/sjg/mk-${MK_VER}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86 ~x64-freebsd"
+IUSE=""
+
+DEPEND=""
+RDEPEND=""
+
+S="${WORKDIR}/${PN}"
+
+src_configure() {
+ econf \
+ --with-mksrc=../mk \
+ --with-default-sys-path="${EPREFIX}"/usr/share/mk/${PN} \
+ --with-machine_arch=${ARCH}
+}
+
+src_compile() {
+ sh make-bootstrap.sh || die "bootstrap failed"
+}
+
+src_test() {
+ cd unit-tests
+ LC_ALL=C env -u A ${S}/bmake -r -m . > test.out 2>&1 \
+ || die "tests compilation failed"
+ sed -i \
+ -e "s:${S}/::g" \
+ -e "s:bmake\\[.\\]:make:g" \
+ -e "s:unit-tests/::g" \
+ test.out || die "Fixing values failed"
+ diff -u test.exp test.out
+ [[ $(diff -u test.exp test.out |wc -l) -gt 0 ]] && die "tests differ"
+}
+
+src_install() {
+ dobin ${PN} || die
+ newman ${PN}.cat1 ${PN}.1 || die
+ FORCE_BSD_MK=1 SYS_MK_DIR=. \
+ sh ../mk/install-mk -v -m 644 "${ED}"/usr/share/mk/${PN} \
+ || die "failed to install mk files"
+}
diff --git a/sys-devel/bmake/metadata.xml b/sys-devel/bmake/metadata.xml
new file mode 100644
index 000000000000..ecedda4aa2cc
--- /dev/null
+++ b/sys-devel/bmake/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>bsd</herd>
+</pkgmetadata>
diff --git a/sys-devel/boost-m4/Manifest b/sys-devel/boost-m4/Manifest
new file mode 100644
index 000000000000..1b3f5b98fd2a
--- /dev/null
+++ b/sys-devel/boost-m4/Manifest
@@ -0,0 +1 @@
+DIST boost-m4-0.4.tar.gz 38871 SHA256 abe1fbc30cdd1e938cd5b00cbcbfc370d159404f9014c6dce1976b093cd242e0 SHA512 f0ee9edbf20043679339bcb46a912d460a787635106559780d6a9a08dd685051a58667a0a1e26364709de10dde49f4b2fd348dbd6199a9da3099d75e665c1e95 WHIRLPOOL 8478f8f742004f3ef8ab11bb27c1c2d172fc9060a0ac6041a131f90369af9a8cc6db6ae0e1f108832d5e2c262aba98604b32601a89afecc4be135b7e1b4d18d3
diff --git a/sys-devel/boost-m4/boost-m4-0.4-r1.ebuild b/sys-devel/boost-m4/boost-m4-0.4-r1.ebuild
new file mode 100644
index 000000000000..7b45e7c27670
--- /dev/null
+++ b/sys-devel/boost-m4/boost-m4-0.4-r1.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit eutils vcs-snapshot
+
+DESCRIPTION="Another set of autoconf macros for compiling against boost"
+HOMEPAGE="http://github.com/tsuna/boost.m4"
+SRC_URI="${HOMEPAGE}/tarball/v${PV} -> ${P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE=""
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-gcc5.patch
+}
+
+# boost.m4 has a buildsystem, but the distributer didn't use make dist
+# so we'd have to eautoreconf to use it. Also, its ./configure script
+# DEPENDs on boost. For installing one file, bootstrapping the
+# buildsystem isn't worth it.
+src_configure() { :; }
+
+src_compile() { :; }
+
+src_install() {
+ insinto /usr/share/aclocal
+ doins build-aux/boost.m4
+
+ dodoc AUTHORS NEWS README THANKS
+}
diff --git a/sys-devel/boost-m4/boost-m4-0.4.ebuild b/sys-devel/boost-m4/boost-m4-0.4.ebuild
new file mode 100644
index 000000000000..9c1404b1b12f
--- /dev/null
+++ b/sys-devel/boost-m4/boost-m4-0.4.ebuild
@@ -0,0 +1,31 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit vcs-snapshot
+
+DESCRIPTION="Another set of autoconf macros for compiling against boost"
+HOMEPAGE="http://github.com/tsuna/boost.m4"
+SRC_URI="${HOMEPAGE}/tarball/v${PV} -> ${P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 ppc ppc64 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE=""
+
+# boost.m4 has a buildsystem, but the distributer didn't use make dist
+# so we'd have to eautoreconf to use it. Also, its ./configure script
+# DEPENDs on boost. For installing one file, bootstrapping the
+# buildsystem isn't worth it.
+src_configure() { :; }
+
+src_compile() { :; }
+
+src_install() {
+ insinto /usr/share/aclocal
+ doins build-aux/boost.m4
+
+ dodoc AUTHORS NEWS README THANKS
+}
diff --git a/sys-devel/boost-m4/files/boost-m4-0.4-gcc5.patch b/sys-devel/boost-m4/files/boost-m4-0.4-gcc5.patch
new file mode 100644
index 000000000000..a929957e8aa6
--- /dev/null
+++ b/sys-devel/boost-m4/files/boost-m4-0.4-gcc5.patch
@@ -0,0 +1,91 @@
+https://bugs.gentoo.org/549618
+Note: I dropped the last hunk from the upstream patch. It doesn't apply and
+is unnecessary since we build boost with --layout=system.
+
+From 32553aaf4d5090da19aa0ec33b936982c685009f Mon Sep 17 00:00:00 2001
+From: Akim Demaille <akim@lrde.epita.fr>
+Date: Wed, 26 Nov 2014 16:56:28 +0100
+Subject: [PATCH] boost.m4: cope with GCC 5
+
+Serial 24.
+
+There are two needed adjustments.
+
+One due to the output format which has changed:
+
+ $ cat conftest.cc
+ #include <boost/version.hpp>
+ boost-lib-version = BOOST_LIB_VERSION
+ $ g++-mp-4.9 -E conftest.cc $ g++-mp-5 -E conftest.cc
+ # 1 "conftest.cc" # 1 "conftest.cc"
+ # 1 "<built-in>" # 1 "<built-in>"
+ # 1 "<command-line>" # 1 "<command-line>"
+ # 1 "conftest.cc" # 1 "conftest.cc"
+ # 1 "/include/boost/version.hpp" 1 3 # 1 "/include/boost/version.hpp" 1 3
+ # 2 "conftest.cc" 2 # 2 "conftest.cc" 2
+ boost-lib-version = "1_56" ! boost-lib-version =
+ ! # 2 "conftest.cc" 3
+ ! "1_56"
+
+Since I fear that -P is not portable, let's play with tr and grep to
+get rid of all the # lines and glue the remaining lines together.
+
+The other one is that, finally, gcc 4.10 will actually be named gcc 5,
+so recognize this name.
+
+* build-aux/m4/boost.m4 (_BOOST_SED_CPP): Clean the preprocessor output
+before handing it to the sed command.
+(_BOOST_FIND_COMPILER_TAG): Support GCC 5.
+Improve accuracy of error messages by adding delimiters to bad strings.
+
+Signed-off-by: Benoit Sigoure <tsunanet@gmail.com>
+---
+ build-aux/boost.m4 | 25 ++++++++++++++++++++++---
+ 1 file changed, 22 insertions(+), 3 deletions(-)
+
+--- a/build-aux/boost.m4
++++ b/build-aux/boost.m4
+@@ -72,8 +72,25 @@ dnl strip `\n' with backquotes, not the `\r'. This results in
+ dnl boost_cv_lib_version='1_37\r' for instance, which breaks
+ dnl everything else.
+ dnl Cannot use 'dnl' after [$4] because a trailing dnl may break AC_CACHE_CHECK
++dnl
++dnl Beware that GCC 5, when expanding macros, may embed # line directives
++dnl a within single line:
++dnl
++dnl # 1 "conftest.cc"
++dnl # 1 "<built-in>"
++dnl # 1 "<command-line>"
++dnl # 1 "conftest.cc"
++dnl # 1 "/opt/local/include/boost/version.hpp" 1 3
++dnl # 2 "conftest.cc" 2
++dnl boost-lib-version =
++dnl # 2 "conftest.cc" 3
++dnl "1_56"
++dnl
++dnl So get rid of the # lines, and glue the remaining ones together.
+ (eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
++ grep -v '#' |
+ tr -d '\r' |
++ tr -s '\n' ' ' |
+ $SED -n -e "$1" >conftest.i 2>&1],
+ [$3],
+ [$4])
+@@ -208,7 +225,7 @@ AC_LANG_POP([C++])dnl
+ AC_CACHE_CHECK([for Boost's header version],
+ [boost_cv_lib_version],
+ [m4_pattern_allow([^BOOST_LIB_VERSION$])dnl
+- _BOOST_SED_CPP([/^boost-lib-version = /{s///;s/\"//g;p;q;}],
++ _BOOST_SED_CPP([[/^boost-lib-version = /{s///;s/[\" ]//g;p;q;}]],
+ [#include <boost/version.hpp>
+ boost-lib-version = BOOST_LIB_VERSION],
+ [boost_cv_lib_version=`cat conftest.i`])])
+@@ -216,7 +233,7 @@ boost-lib-version = BOOST_LIB_VERSION],
+ boost_major_version=`echo "$boost_cv_lib_version" | sed 's/_//;s/_.*//'`
+ case $boost_major_version in #(
+ '' | *[[!0-9]]*)
+- AC_MSG_ERROR([invalid value: boost_major_version=$boost_major_version])
++ AC_MSG_ERROR([invalid value: boost_major_version='$boost_major_version'])
+ ;;
+ esac
+ fi
diff --git a/sys-devel/boost-m4/metadata.xml b/sys-devel/boost-m4/metadata.xml
new file mode 100644
index 000000000000..614b1f21a1d7
--- /dev/null
+++ b/sys-devel/boost-m4/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>binki@gentoo.org</email>
+ <name>Nathan Phillip Brink</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">tsuna/boost.m4</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-devel/byfl/Manifest b/sys-devel/byfl/Manifest
new file mode 100644
index 000000000000..08f9c2538cd4
--- /dev/null
+++ b/sys-devel/byfl/Manifest
@@ -0,0 +1 @@
+DIST byfl-1.2-llvm-3.5.1.tar.gz 509555 SHA256 ab3325dcc71a6bbe4b0f7cdc75a8522cce29cf60e73e11b9791360a89c684b39 SHA512 a0f9a0656f70b172f1304de90312e5fb1fe998c9315463b86db35a2ccdbb45ded75a8776160a35223a24d0fe89a253740b1acde58ba2f1b77b9f27c71d5150fb WHIRLPOOL 6be2f6812fb33f72fc1c7a4664aadbc17f4f1872052e7a01269ab4921a744afdc5716a12cd2bd12410722397ccf00bc5994627f14932f442a5e4ea2aa806c6d3
diff --git a/sys-devel/byfl/byfl-1.2.ebuild b/sys-devel/byfl/byfl-1.2.ebuild
new file mode 100644
index 000000000000..17caf4750ec1
--- /dev/null
+++ b/sys-devel/byfl/byfl-1.2.ebuild
@@ -0,0 +1,44 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit autotools-utils flag-o-matic
+
+if [ "${PV}" = "9999" ]; then
+ LLVM_VERSION="3.6"
+ EGIT_REPO_URI="git://github.com/losalamos/${PN^b}.git http://github.com/losalamos/${PN}.git"
+ inherit git-2
+ KEYWORDS=""
+ AUTOTOOLS_AUTORECONF=1
+else
+ LLVM_VERSION="3.5.1"
+ MY_P="${P}-llvm-${LLVM_VERSION}"
+ SRC_URI="https://github.com/losalamos/Byfl/releases/download/v${MY_P#${PN}-}/${MY_P}.tar.gz"
+ KEYWORDS="~amd64 ~amd64-linux"
+fi
+
+DESCRIPTION="Compiler-based Application Analysis"
+HOMEPAGE="https://github.com/losalamos/Byfl"
+
+SLOT="0"
+LICENSE="BSD"
+IUSE="dragonegg hdf5 static-libs sqlite"
+
+RDEPEND="dragonegg? ( >=sys-devel/dragonegg-${LLVM_VERSION} )
+ >=sys-devel/clang-${LLVM_VERSION}
+ >=sys-devel/llvm-${LLVM_VERSION}
+ sys-devel/binutils
+ dev-lang/perl:=
+ dev-perl/Switch
+ hdf5? ( sci-libs/hdf5[cxx] )
+ sqlite? ( dev-db/sqlite:3 )"
+DEPEND="${RDEPEND}"
+
+src_configure() {
+ append-cxxflags -std=c++11
+ use dragonegg || export ax_cv_file_dragonegg_so=no
+ use sqlite || export ac_cv_lib_sqlite3_sqlite3_errstr=no
+ autotools-utils_src_configure H5CXX=$(usex hdf5 h5c++ no)
+}
diff --git a/sys-devel/byfl/byfl-9999.ebuild b/sys-devel/byfl/byfl-9999.ebuild
new file mode 100644
index 000000000000..17caf4750ec1
--- /dev/null
+++ b/sys-devel/byfl/byfl-9999.ebuild
@@ -0,0 +1,44 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit autotools-utils flag-o-matic
+
+if [ "${PV}" = "9999" ]; then
+ LLVM_VERSION="3.6"
+ EGIT_REPO_URI="git://github.com/losalamos/${PN^b}.git http://github.com/losalamos/${PN}.git"
+ inherit git-2
+ KEYWORDS=""
+ AUTOTOOLS_AUTORECONF=1
+else
+ LLVM_VERSION="3.5.1"
+ MY_P="${P}-llvm-${LLVM_VERSION}"
+ SRC_URI="https://github.com/losalamos/Byfl/releases/download/v${MY_P#${PN}-}/${MY_P}.tar.gz"
+ KEYWORDS="~amd64 ~amd64-linux"
+fi
+
+DESCRIPTION="Compiler-based Application Analysis"
+HOMEPAGE="https://github.com/losalamos/Byfl"
+
+SLOT="0"
+LICENSE="BSD"
+IUSE="dragonegg hdf5 static-libs sqlite"
+
+RDEPEND="dragonegg? ( >=sys-devel/dragonegg-${LLVM_VERSION} )
+ >=sys-devel/clang-${LLVM_VERSION}
+ >=sys-devel/llvm-${LLVM_VERSION}
+ sys-devel/binutils
+ dev-lang/perl:=
+ dev-perl/Switch
+ hdf5? ( sci-libs/hdf5[cxx] )
+ sqlite? ( dev-db/sqlite:3 )"
+DEPEND="${RDEPEND}"
+
+src_configure() {
+ append-cxxflags -std=c++11
+ use dragonegg || export ax_cv_file_dragonegg_so=no
+ use sqlite || export ac_cv_lib_sqlite3_sqlite3_errstr=no
+ autotools-utils_src_configure H5CXX=$(usex hdf5 h5c++ no)
+}
diff --git a/sys-devel/byfl/metadata.xml b/sys-devel/byfl/metadata.xml
new file mode 100644
index 000000000000..38efabe7241d
--- /dev/null
+++ b/sys-devel/byfl/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>ottxor@gentoo.org</email>
+ <name>Christoph Junghans</name>
+ </maintainer>
+ <use>
+ <flag name="dragonegg">Add support for non C languages through <pkg>sys-devel/dragonegg</pkg></flag>
+ </use>
+ <upstream>
+ <remote-id type="github">losalamos/Byfl</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-devel/clang/Manifest b/sys-devel/clang/Manifest
new file mode 100644
index 000000000000..ecbb390f06ba
--- /dev/null
+++ b/sys-devel/clang/Manifest
@@ -0,0 +1,12 @@
+DIST clang-2.8.tgz 5666777 SHA256 ed83481553e6a39a8a2953e89630d881d87833506f096a90f18d93ec2bdee0c1
+DIST clang-2.9.tgz 6243772 SHA256 70c41f3f782a71cbaa7bc8d6ea29fce4263ad3e8558dfecc6dc11cdef17909df SHA512 0046b716eae7c398a61fb733239f209b60bdd1817e6724730b9515e7ae765565a1e42a805cc06e6f1393d8254ebc845335b244aff825f3fcce551b958683d8f5 WHIRLPOOL 4c745b7c6a21035595307ba5e2d95c2262a5ca1d52cca413a822186b9d450fec384d514175cf384e35e7169ce41ac5152222fcc9cbee4af85695c78d7cd5492e
+DIST clang-3.0.tar.gz 7240578 SHA256 b64e72da356d7c3428cfd7ac620d49ec042c84eaee13c26024879f555f4e126d SHA512 0a31a2600cd4555424259331e0762f7fceeb5d828e7792983b2f8ae92bb75b3dc92cf84474e047deb5d4dab46062b4ac6273e6079159052debb76ae69927e517 WHIRLPOOL 521169cc588520090423cd1a2fa639da84e119281bf8260ea4b7b24fd2d8627806a281ddbbba5c378a736fc31279e25f10c4d3a3c81abd2c202970079a949ba5
+DIST clang-3.1.src.tar.gz 8158418 SHA256 ff63e215dcd3e2838ffdea38502f8d35bab17e487f3c3799579961e452d5a786 SHA512 14c033eda3e0c0a887a8410f6b6a1335e0f6bfa05950a903d302b06b95fd58b03894320e91e50fb4d330c5323be9e955d9054cee62d035e2753290354ea8f8cd WHIRLPOOL cdb578c287a417896d2d6fb297e96e44e8b951bad6e7d286b97bdd346b40dac6ffbb7015b39d69fa0f9e0994dede26612307b643f71480e3c8917199fe926357
+DIST clang-3.2.src.tar.gz 8805311 SHA256 2aaaf03f7c0f6b16fe97ecc81247dc2bf2d4bec7620a77cc74670b7e07ff5658 SHA512 99fc57d19b76c42af9821eaaa762056a926eb68178f6b7dd5e8bf092c9ee201a554b91d760d5a30a57f38102eae340e080ef8c6a39327f6881eda391b20b108d WHIRLPOOL 2cf88d1db0f108d8b8e8b0cf691cca18694ddb00b129dc8c1894fca67b5494a7f53f92ac9401d99ce687c9d8fb30dc267be1e68ee70edc542e998f5486ba8730
+DIST compiler-rt-3.1.src.tar.gz 1259340 SHA256 1bd4624e7465b05ea713198f19c1c235bae2d35a411c15a4648300bc74294f5c SHA512 a010ed625ca54383bcc08dba77c4a686aed1c74d70c237a3cd20eafe9c1208f644699a600cbf1d14239db1b05a6d55f026f511f5a1eeec0a68888683c653e6fe WHIRLPOOL 6e21d28b30b52a039d5f16fb5b96238f453b58d5fabffffe0cc181061f619aaec2925bbe9f8af3dfe1ac39002fa52943617f94c44fb21cfe72d7aea460c0de0c
+DIST compiler-rt-3.2.src.tar.gz 1463061 SHA256 4ac311df0eead459cbb0f0890c06b55dae529ab45827ac73fef40bec632994aa SHA512 ef4223bd2d6051ec93a0943973aa61e7aa3686ac72f9a688d58a8b71deba1a7e64dcf821e0c53937899bbd7ba49218fee4e3649f19362fe59677daee314c063b WHIRLPOOL 176643360f683ddca28e4c77dc4ceb03513cec5cea98455598c934ec3e23bd6949a74852e50e42207c7171eb8013afe366f3b8c92799af66a04739ccebe4ed4e
+DIST llvm-2.8-r1.tgz 9112527 SHA256 25addb742f1c6cc12877ed0ee924dda962d848368ee095be8e48342ae613d43b SHA512 8688d5cf415e8aef74cca6a14587af36234a6347e2238ac2c0d66805c42926b9399f36390e1a58a4081e902b0904adb818c1a360d5df572dfa893d6f79f5e35a WHIRLPOOL 0da9250e31242b55586c9138089e742aab5d414d5f3412ebf917ae8b9506f984c6134a932be93ec7e4c01c79f6c21d508cb0b2e0ec283419bd4ae4db745430ae
+DIST llvm-2.9.tgz 9574781 SHA256 661236cfa17428b48cfa9cbb9909f7569c64b8ecd219fd91dbc00e3b557b3779 SHA512 9cb0fa0bb8ac02661fd6f926001a15e0ad4a9660683421dc86b03f1cf5184142c5815f9f9283ee7cdf8d474e01177f83406122253342e0e95ddc878821660070 WHIRLPOOL f7b445b6b5d455f29ca68c342511b8b5e6eedec525af1cc60440c4de544df2332aa241bffca29eda5d2428a3f518e093a626bd45c7f8a9e0656d0f68aef5d9d1
+DIST llvm-3.0.tar.gz 10350539 SHA256 519eb11d3499ce99c6ffdb8718651fc91425ed7690eac91c8d6853474f7c0477 SHA512 602bb5590b70cb9138bc19d8c630c62bbabdcb2132215c921fe4bce4e3f74dfc66440b9dcd458ff55a86047cc9cc0417c6563715c133e0db222e4b88f07c13bb WHIRLPOOL 6f4ece3ec747352cd78b08d25c5b1cda91140eb6957d509161e45395e47c074f8d2102bfcaeabcdef8c1f6672f2cf06d88e290667666122da029391b3528d440
+DIST llvm-3.1.src.tar.gz 11077429 SHA256 1ea05135197b5400c1f88d00ff280d775ce778f8f9ea042e25a1e1e734a4b9ab SHA512 fb941094601043e405ccc57473414ef92437b09c200e71614f93d8e93b2a58cca8d78c385be037e064b0711cd6268802c774ce4a40fc0ea17bf576305304d2aa WHIRLPOOL c5c72e139296e1c186131f991010f52f958063a4fcfcb1f8527b53a2aaa7edcaca70ab6cf86c25d08640dcf6d720a865fda7dc7eb06cf1ce9c23fd37b5d597ef
+DIST llvm-3.2.src.tar.gz 12275252 SHA256 125090c4d26740f1d5e9838477c931ed7d9ad70d599ba265f46f3a42cb066343 SHA512 cc66171322dbbe40bcac0e0ea5b09df8ff52df63ded304f841f32f702270d6ab1512216413ee52498c3ebee8cd39c4cd23e3855d591944bc2ac0ae76f5be62cc WHIRLPOOL c3a39b2426293d0251b7769607ade873bb6bf8d54e7c8055773a9b75742bc8e39049fb71409a258c6f3d98775b78c280d4bfe4223ba91e5ed6ecae0eddf910e5
diff --git a/sys-devel/clang/clang-2.8-r3.ebuild b/sys-devel/clang/clang-2.8-r3.ebuild
new file mode 100644
index 000000000000..3a4b53a1fcc0
--- /dev/null
+++ b/sys-devel/clang/clang-2.8-r3.ebuild
@@ -0,0 +1,203 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=3
+
+RESTRICT_PYTHON_ABIS="3.*"
+SUPPORT_PYTHON_ABIS="1"
+
+inherit eutils multilib python
+
+DESCRIPTION="C language family frontend for LLVM"
+HOMEPAGE="http://clang.llvm.org/"
+# Fetching LLVM as well: see http://llvm.org/bugs/show_bug.cgi?id=4840
+# Drop the -> on 2.9
+SRC_URI="http://llvm.org/releases/${PV}/llvm-${PV}.tgz -> llvm-${PV}-r1.tgz
+ http://llvm.org/releases/${PV}/${P}.tgz"
+
+LICENSE="UoI-NCSA"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos"
+IUSE="debug multitarget +static-analyzer system-cxx-headers test"
+
+# Note: for LTO support, clang will depend on binutils with gold plugins, and LLVM built after that - http://llvm.org/docs/GoldPlugin.html
+DEPEND="static-analyzer? ( dev-lang/perl )"
+RDEPEND="~sys-devel/llvm-${PV}[debug=,multitarget=]"
+
+S="${WORKDIR}/llvm-${PV}"
+
+src_prepare() {
+ mv "${WORKDIR}"/clang-${PV} "${S}"/tools/clang || die "clang source directory not found"
+
+ # Same as llvm doc patches
+ epatch "${FILESDIR}"/${PN}-2.7-fixdoc.patch
+
+ # Upstream backport, r117774 and r117775
+ epatch "${FILESDIR}"/${P}-alignof.patch
+ # Upstream backport, r119348
+ epatch "${FILESDIR}"/${P}-gcc-4.4.4.patch
+
+ # Fix toolchain lookup for Darwin/Prefix.
+ epatch "${FILESDIR}"/${PN}-2.8-darwin-prefix.patch
+ sed -e "s|@GENTOO_PORTAGE_CHOST_ARCH@|${CHOST%%-darwin*}-darwin|g" \
+ -e "s|@GENTOO_PORTAGE_CHOST@|${CHOST}|g" \
+ -e "s|@GENTOO_PORTAGE_EPREFIX@|${EPREFIX}|g" \
+ -i tools/clang/lib/Driver/ToolChains.cpp \
+ || die "fixing toolchain lookup"
+
+ # multilib-strict
+ sed -e "/PROJ_headers/s#lib/clang#$(get_libdir)/clang#" \
+ -i tools/clang/lib/Headers/Makefile \
+ || die "clang Makefile failed"
+ # fix the static analyzer for in-tree install
+ sed -e 's/import ScanView/from clang \0/' \
+ -i tools/clang/tools/scan-view/scan-view \
+ || die "scan-view sed failed"
+ sed -e "/scanview.css\|sorttable.js/s#\$RealBin#${EPREFIX}/usr/share/${PN}#" \
+ -i tools/clang/tools/scan-build/scan-build \
+ || die "scan-build sed failed"
+ # Specify python version
+ python_convert_shebangs 2 tools/clang/tools/scan-view/scan-view
+
+ # From llvm src_prepare
+ einfo "Fixing install dirs"
+ sed -e 's,^PROJ_docsdir.*,PROJ_docsdir := $(PROJ_prefix)/share/doc/'${PF}, \
+ -e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \
+ -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/llvm, \
+ -i Makefile.config.in || die "Makefile.config sed failed"
+
+ einfo "Fixing rpath and CFLAGS"
+ sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/llvm, \
+ -e '/OmitFramePointer/s/-fomit-frame-pointer//' \
+ -i Makefile.rules || die "rpath sed failed"
+}
+
+src_configure() {
+ local CONF_FLAGS="--enable-shared"
+
+ if use debug; then
+ CONF_FLAGS="${CONF_FLAGS} --disable-optimized"
+ einfo "Note: Compiling LLVM in debug mode will create huge and slow binaries"
+ # ...and you probably shouldn't use tmpfs, unless it can hold 900MB
+ else
+ CONF_FLAGS="${CONF_FLAGS} \
+ --enable-optimized \
+ --with-optimize-option= \
+ --disable-assertions \
+ --disable-expensive-checks"
+ fi
+
+ # Setup the search path to include the Prefix includes
+ if use prefix ; then
+ CONF_FLAGS="${CONF_FLAGS} \
+ --with-c-include-dirs=${EPREFIX}/usr/include:/usr/include"
+ fi
+
+ if use multitarget; then
+ CONF_FLAGS="${CONF_FLAGS} --enable-targets=all"
+ else
+ CONF_FLAGS="${CONF_FLAGS} --enable-targets=host-only"
+ fi
+
+ if use amd64; then
+ CONF_FLAGS="${CONF_FLAGS} --enable-pic"
+ fi
+
+ # Skip llvm-gcc parts even if installed
+ CONF_FLAGS="${CONF_FLAGS} --with-llvmgccdir=/dev/null"
+
+ if use system-cxx-headers; then
+ # Try to get current gcc headers path
+ local CXX_PATH=$(gcc-config -L| cut -d: -f1)
+ CONF_FLAGS="${CONF_FLAGS} --with-c-include-dirs=/usr/include:${CXX_PATH}/include"
+ CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-root=${CXX_PATH}/include/g++-v4"
+ CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-arch=$CHOST"
+ if has_multilib_profile; then
+ CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-32bit-dir=32"
+ fi
+ fi
+
+ econf ${CONF_FLAGS} || die "econf failed"
+}
+
+src_compile() {
+ emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1 clang-only || die "emake failed"
+}
+
+src_test() {
+ cd "${S}"/test || die "cd failed"
+ emake site.exp || die "updating llvm site.exp failed"
+
+ cd "${S}"/tools/clang || die "cd clang failed"
+
+ echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
+ if ! emake -j1 VERBOSE=1 test; then
+ has test $FEATURES && die "Make test failed. See above for details."
+ has test $FEATURES || eerror "Make test failed. See above for details."
+ fi
+}
+
+src_install() {
+ cd "${S}"/tools/clang || die "cd clang failed"
+ emake KEEP_SYMBOLS=1 DESTDIR="${D}" install || die "install failed"
+
+ if use static-analyzer ; then
+ dobin tools/scan-build/ccc-analyzer
+ dosym ccc-analyzer /usr/bin/c++-analyzer
+ dobin tools/scan-build/scan-build
+
+ insinto /usr/share/${PN}
+ doins tools/scan-build/scanview.css
+ doins tools/scan-build/sorttable.js
+
+ cd tools/scan-view || die "cd scan-view failed"
+ dobin scan-view
+ install-scan-view() {
+ insinto "$(python_get_sitedir)"/clang
+ doins Reporter.py Resources ScanView.py startfile.py
+ touch "${ED}"/"$(python_get_sitedir)"/clang/__init__.py
+ }
+ python_execute_function install-scan-view
+ fi
+
+ # Fix install_names on Darwin. The build system is too complicated
+ # to just fix this, so we correct it post-install
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ for lib in libclang.dylib ; do
+ ebegin "fixing install_name of $lib"
+ install_name_tool -id "${EPREFIX}"/usr/lib/llvm/${lib} \
+ "${ED}"/usr/lib/llvm/${lib}
+ eend $?
+ done
+ for f in usr/bin/{c-index-test,clang} usr/lib/llvm/libclang.dylib ; do
+ ebegin "fixing references in ${f##*/}"
+ install_name_tool \
+ -change "@rpath/libclang.dylib" \
+ "${EPREFIX}"/usr/lib/llvm/libclang.dylib \
+ -change "${S}"/Release/lib/libLLVM-${PV}.dylib \
+ "${EPREFIX}"/usr/lib/llvm/libLLVM-${PV}.dylib \
+ -change "${S}"/Release/lib/libclang.dylib \
+ "${EPREFIX}"/usr/lib/llvm/libclang.dylib \
+ "${ED}"/$f
+ eend $?
+ done
+ fi
+}
+
+pkg_postinst() {
+ python_mod_optimize clang
+ if use system-cxx-headers; then
+ elog "C++ headers search path is hardcoded to the active gcc profile one"
+ elog "If you change the active gcc profile, or update gcc to a new version,"
+ elog "you will have to remerge this package to update the search path"
+ else
+ elog "If clang++ fails to find C++ headers on your system,"
+ elog "you can remerge clang with USE=system-cxx-headers to use C++ headers"
+ elog "from the active gcc profile"
+ fi
+}
+
+pkg_postrm() {
+ python_mod_cleanup clang
+}
diff --git a/sys-devel/clang/clang-2.9-r1.ebuild b/sys-devel/clang/clang-2.9-r1.ebuild
new file mode 100644
index 000000000000..b53bf23b279f
--- /dev/null
+++ b/sys-devel/clang/clang-2.9-r1.ebuild
@@ -0,0 +1,192 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=3
+
+RESTRICT_PYTHON_ABIS="3.*"
+SUPPORT_PYTHON_ABIS="1"
+
+inherit eutils multilib python
+
+DESCRIPTION="C language family frontend for LLVM"
+HOMEPAGE="http://clang.llvm.org/"
+# Fetching LLVM as well: see http://llvm.org/bugs/show_bug.cgi?id=4840
+SRC_URI="http://llvm.org/releases/${PV}/llvm-${PV}.tgz
+ http://llvm.org/releases/${PV}/${P}.tgz"
+
+LICENSE="UoI-NCSA"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos"
+IUSE="debug multitarget +static-analyzer +system-cxx-headers test"
+
+# Note: for LTO support, clang will depend on binutils with gold plugins, and LLVM built after that - http://llvm.org/docs/GoldPlugin.html
+DEPEND="static-analyzer? ( dev-lang/perl )"
+RDEPEND="~sys-devel/llvm-${PV}[debug=,multitarget=]"
+
+S="${WORKDIR}/llvm-${PV}"
+
+src_prepare() {
+ mv "${WORKDIR}"/clang-${PV} "${S}"/tools/clang || die "clang source directory not found"
+
+ # Workaround GCC versions' list (bug #377949)
+ epatch "${FILESDIR}"/${P}-gccversions.patch
+
+ # Same as llvm doc patches
+ epatch "${FILESDIR}"/${PN}-2.7-fixdoc.patch
+
+ # Fix toolchain lookup for Darwin/Prefix.
+ epatch "${FILESDIR}"/${PN}-2.9-darwin-prefix.patch
+ sed -e "s|@GENTOO_PORTAGE_CHOST_ARCH@|${CHOST%%-darwin*}-darwin|g" \
+ -e "s|@GENTOO_PORTAGE_CHOST@|${CHOST}|g" \
+ -e "s|@GENTOO_PORTAGE_EPREFIX@|${EPREFIX}|g" \
+ -i tools/clang/lib/Driver/ToolChains.cpp \
+ || die "fixing toolchain lookup"
+
+ # multilib-strict
+ sed -e "/PROJ_headers/s#lib/clang#$(get_libdir)/clang#" \
+ -i tools/clang/lib/Headers/Makefile \
+ || die "clang Makefile failed"
+ # fix the static analyzer for in-tree install
+ sed -e 's/import ScanView/from clang \0/' \
+ -i tools/clang/tools/scan-view/scan-view \
+ || die "scan-view sed failed"
+ sed -e "/scanview.css\|sorttable.js/s#\$RealBin#${EPREFIX}/usr/share/${PN}#" \
+ -i tools/clang/tools/scan-build/scan-build \
+ || die "scan-build sed failed"
+ # Specify python version
+ python_convert_shebangs 2 tools/clang/tools/scan-view/scan-view
+
+ # From llvm src_prepare
+ einfo "Fixing install dirs"
+ sed -e 's,^PROJ_docsdir.*,PROJ_docsdir := $(PROJ_prefix)/share/doc/'${PF}, \
+ -e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \
+ -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/llvm, \
+ -i Makefile.config.in || die "Makefile.config sed failed"
+
+ einfo "Fixing rpath and CFLAGS"
+ sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/llvm, \
+ -e '/OmitFramePointer/s/-fomit-frame-pointer//' \
+ -i Makefile.rules || die "rpath sed failed"
+}
+
+src_configure() {
+ local CONF_FLAGS="--enable-shared
+ --with-optimize-option=
+ $(use_enable !debug optimized)
+ $(use_enable debug assertions)
+ $(use_enable debug expensive-checks)"
+
+ # Setup the search path to include the Prefix includes
+ if use prefix ; then
+ CONF_FLAGS="${CONF_FLAGS} \
+ --with-c-include-dirs=${EPREFIX}/usr/include:/usr/include"
+ fi
+
+ if use multitarget; then
+ CONF_FLAGS="${CONF_FLAGS} --enable-targets=all"
+ else
+ CONF_FLAGS="${CONF_FLAGS} --enable-targets=host-only"
+ fi
+
+ if use amd64; then
+ CONF_FLAGS="${CONF_FLAGS} --enable-pic"
+ fi
+
+ # Skip llvm-gcc parts even if installed
+ CONF_FLAGS="${CONF_FLAGS} --with-llvmgccdir=/dev/null"
+
+ if use system-cxx-headers; then
+ # Try to get current gcc headers path
+ local CXX_PATH=$(gcc-config -L| cut -d: -f1)
+ CONF_FLAGS="${CONF_FLAGS} --with-c-include-dirs=/usr/include:${CXX_PATH}/include"
+ CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-root=${CXX_PATH}/include/g++-v4"
+ CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-arch=$CHOST"
+ if has_multilib_profile; then
+ CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-32bit-dir=32"
+ fi
+ fi
+
+ econf ${CONF_FLAGS} || die "econf failed"
+}
+
+src_compile() {
+ emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1 clang-only || die "emake failed"
+}
+
+src_test() {
+ cd "${S}"/test || die "cd failed"
+ emake site.exp || die "updating llvm site.exp failed"
+
+ cd "${S}"/tools/clang || die "cd clang failed"
+
+ echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
+ if ! emake -j1 VERBOSE=1 test; then
+ has test $FEATURES && die "Make test failed. See above for details."
+ has test $FEATURES || eerror "Make test failed. See above for details."
+ fi
+}
+
+src_install() {
+ cd "${S}"/tools/clang || die "cd clang failed"
+ emake KEEP_SYMBOLS=1 DESTDIR="${D}" install || die "install failed"
+
+ if use static-analyzer ; then
+ dobin tools/scan-build/ccc-analyzer
+ dosym ccc-analyzer /usr/bin/c++-analyzer
+ dobin tools/scan-build/scan-build
+
+ insinto /usr/share/${PN}
+ doins tools/scan-build/scanview.css
+ doins tools/scan-build/sorttable.js
+
+ cd tools/scan-view || die "cd scan-view failed"
+ dobin scan-view
+ install-scan-view() {
+ insinto "$(python_get_sitedir)"/clang
+ doins Reporter.py Resources ScanView.py startfile.py
+ touch "${ED}"/"$(python_get_sitedir)"/clang/__init__.py
+ }
+ python_execute_function install-scan-view
+ fi
+
+ # Fix install_names on Darwin. The build system is too complicated
+ # to just fix this, so we correct it post-install
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ for lib in libclang.dylib ; do
+ ebegin "fixing install_name of $lib"
+ install_name_tool -id "${EPREFIX}"/usr/lib/llvm/${lib} \
+ "${ED}"/usr/lib/llvm/${lib}
+ eend $?
+ done
+ for f in usr/bin/{c-index-test,clang} usr/lib/llvm/libclang.dylib ; do
+ ebegin "fixing references in ${f##*/}"
+ install_name_tool \
+ -change "@rpath/libclang.dylib" \
+ "${EPREFIX}"/usr/lib/llvm/libclang.dylib \
+ -change "@executable_path/../lib/libLLVM-${PV}.dylib" \
+ "${EPREFIX}"/usr/lib/llvm/libLLVM-${PV}.dylib \
+ -change "${S}"/Release/lib/libclang.dylib \
+ "${EPREFIX}"/usr/lib/llvm/libclang.dylib \
+ "${ED}"/$f
+ eend $?
+ done
+ fi
+}
+
+pkg_postinst() {
+ python_mod_optimize clang
+ if use system-cxx-headers; then
+ elog "C++ headers search path is hardcoded to the active gcc profile one"
+ elog "If you change the active gcc profile, or update gcc to a new version,"
+ elog "you will have to remerge this package to update the search path"
+ else
+ elog "If clang++ fails to find C++ headers on your system,"
+ elog "you can remerge clang with USE=system-cxx-headers to use C++ headers"
+ elog "from the active gcc profile"
+ fi
+}
+
+pkg_postrm() {
+ python_mod_cleanup clang
+}
diff --git a/sys-devel/clang/clang-3.0-r4.ebuild b/sys-devel/clang/clang-3.0-r4.ebuild
new file mode 100644
index 000000000000..3834aa49c83c
--- /dev/null
+++ b/sys-devel/clang/clang-3.0-r4.ebuild
@@ -0,0 +1,213 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=3
+
+RESTRICT_PYTHON_ABIS="3.*"
+SUPPORT_PYTHON_ABIS="1"
+
+inherit eutils multilib python
+
+DESCRIPTION="C language family frontend for LLVM"
+HOMEPAGE="http://clang.llvm.org/"
+# Fetching LLVM as well: see http://llvm.org/bugs/show_bug.cgi?id=4840
+SRC_URI="http://llvm.org/releases/${PV}/llvm-${PV}.tar.gz
+ http://llvm.org/releases/${PV}/${P}.tar.gz"
+
+LICENSE="UoI-NCSA"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos"
+IUSE="debug kernel_FreeBSD multitarget +static-analyzer system-cxx-headers test"
+
+DEPEND="static-analyzer? ( dev-lang/perl )"
+RDEPEND="~sys-devel/llvm-${PV}[debug=,multitarget=]"
+
+S=${WORKDIR}/llvm-${PV}.src
+
+src_prepare() {
+ mv "${WORKDIR}"/clang-${PV}.src "${S}"/tools/clang || die "clang source directory move failed"
+
+ # Same as llvm doc patches
+ epatch "${FILESDIR}"/${PN}-2.7-fixdoc.patch
+
+ # multilib-strict
+ sed -e "/PROJ_headers/s#lib/clang#$(get_libdir)/clang#" \
+ -i tools/clang/lib/Headers/Makefile \
+ || die "clang Makefile failed"
+ # Fix cxx_include_root path for Gentoo
+ epatch "${FILESDIR}"/${P/_*}-fix_cxx_include_root.patch
+ # fix the static analyzer for in-tree install
+ sed -e 's/import ScanView/from clang \0/' \
+ -i tools/clang/tools/scan-view/scan-view \
+ || die "scan-view sed failed"
+ sed -e "/scanview.css\|sorttable.js/s#\$RealBin#${EPREFIX}/usr/share/${PN}#" \
+ -i tools/clang/tools/scan-build/scan-build \
+ || die "scan-build sed failed"
+ # Set correct path for gold plugin
+ sed -e "/LLVMgold.so/s#lib/#$(get_libdir)/llvm/#" \
+ -i tools/clang/lib/Driver/Tools.cpp \
+ || die "gold plugin path sed failed"
+ # Properly detect Gentoo's binutils-apple version (committed in trunk)
+ epatch "${FILESDIR}"/${PN}-3.0-gentoo-binutils-apple.patch
+ # Specify python version
+ python_convert_shebangs 2 tools/clang/tools/scan-view/scan-view
+ python_convert_shebangs -r 2 test/Scripts
+
+ # From llvm src_prepare
+ einfo "Fixing install dirs"
+ sed -e 's,^PROJ_docsdir.*,PROJ_docsdir := $(PROJ_prefix)/share/doc/'${PF}, \
+ -e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \
+ -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/llvm, \
+ -i Makefile.config.in || die "Makefile.config sed failed"
+
+ einfo "Fixing rpath and CFLAGS"
+ sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/llvm, \
+ -e '/OmitFramePointer/s/-fomit-frame-pointer//' \
+ -i Makefile.rules || die "rpath sed failed"
+
+ # Use system llc (from llvm ebuild) for tests
+ sed -e "/^registered_targets =/s/os.path.join(llvm_tools_dir, 'llc')/'llc'/" \
+ -i tools/clang/test/lit.cfg || die "test path sed failed"
+
+ # AMD K10 CPUs + SSE4a support, bug #398357
+ epatch "${FILESDIR}"/${P}-recognize-amd-k10-enable-sse4a.patch
+
+ # Automatically select active system GCC's libraries, bug #406163
+ epatch "${FILESDIR}"/${P}-linux-runtime-gcc-detection.patch
+
+ # Fix search paths on FreeBSD, bug #409269
+ epatch "${FILESDIR}"/${P}-freebsd-runtime-gcc-detection.patch
+
+ # User patches
+ epatch_user
+}
+
+src_configure() {
+ local CONF_FLAGS="--enable-shared
+ --with-optimize-option=
+ $(use_enable !debug optimized)
+ $(use_enable debug assertions)
+ $(use_enable debug expensive-checks)"
+
+ # Setup the search path to include the Prefix includes
+ if use prefix ; then
+ CONF_FLAGS="${CONF_FLAGS} \
+ --with-c-include-dirs=${EPREFIX}/usr/include:/usr/include"
+ fi
+
+ if use multitarget; then
+ CONF_FLAGS="${CONF_FLAGS} --enable-targets=all"
+ else
+ CONF_FLAGS="${CONF_FLAGS} --enable-targets=host-only"
+ fi
+
+ if use amd64; then
+ CONF_FLAGS="${CONF_FLAGS} --enable-pic"
+ fi
+
+ if use system-cxx-headers; then
+ # Try to get current gcc headers path
+ local CXX_PATH=$(gcc-config -L| cut -d: -f1)
+ CONF_FLAGS="${CONF_FLAGS} --with-c-include-dirs=/usr/include:${CXX_PATH}/include"
+ CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-root=${CXX_PATH}/include/g++-v4"
+ CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-arch=$CHOST"
+ if has_multilib_profile; then
+ CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-32bit-dir=/32"
+ fi
+ fi
+
+ econf ${CONF_FLAGS} || die "econf failed"
+}
+
+src_compile() {
+ emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1 clang-only || die "emake failed"
+}
+
+src_test() {
+ cd "${S}"/test || die "cd failed"
+ emake site.exp || die "updating llvm site.exp failed"
+
+ cd "${S}"/tools/clang || die "cd clang failed"
+
+ # Broken test always assuming i386 host with multilib gcc 4.6.0
+ # http://llvm.org/bugs/show_bug.cgi?id=11094
+ rm -f test/Driver/linux-ld.c
+
+ echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
+
+ testing() {
+ if ! emake -j1 VERBOSE=1 test; then
+ has test $FEATURES && die "Make test failed. See above for details."
+ has test $FEATURES || eerror "Make test failed. See above for details."
+ fi
+ }
+ python_execute_function testing
+}
+
+src_install() {
+ cd "${S}"/tools/clang || die "cd clang failed"
+ emake KEEP_SYMBOLS=1 DESTDIR="${D}" install || die "install failed"
+
+ if use static-analyzer ; then
+ dobin tools/scan-build/ccc-analyzer
+ dosym ccc-analyzer /usr/bin/c++-analyzer
+ dobin tools/scan-build/scan-build
+
+ insinto /usr/share/${PN}
+ doins tools/scan-build/scanview.css
+ doins tools/scan-build/sorttable.js
+
+ cd tools/scan-view || die "cd scan-view failed"
+ dobin scan-view
+ install-scan-view() {
+ insinto "$(python_get_sitedir)"/clang
+ doins Reporter.py Resources ScanView.py startfile.py
+ touch "${ED}"/"$(python_get_sitedir)"/clang/__init__.py
+ }
+ python_execute_function install-scan-view
+ fi
+
+ # Fix install_names on Darwin. The build system is too complicated
+ # to just fix this, so we correct it post-install
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ for lib in libclang.dylib ; do
+ ebegin "fixing install_name of $lib"
+ install_name_tool -id "${EPREFIX}"/usr/lib/llvm/${lib} \
+ "${ED}"/usr/lib/llvm/${lib}
+ eend $?
+ done
+ for f in usr/bin/{c-index-test,clang} usr/lib/llvm/libclang.dylib ; do
+ ebegin "fixing references in ${f##*/}"
+ install_name_tool \
+ -change "@rpath/libclang.dylib" \
+ "${EPREFIX}"/usr/lib/llvm/libclang.dylib \
+ -change "@executable_path/../lib/libLLVM-${PV}.dylib" \
+ "${EPREFIX}"/usr/lib/llvm/libLLVM-${PV}.dylib \
+ -change "${S}"/Release/lib/libclang.dylib \
+ "${EPREFIX}"/usr/lib/llvm/libclang.dylib \
+ "${ED}"/$f
+ eend $?
+ done
+ fi
+
+ # Remove unnecessary headers on FreeBSD, bug #417171
+ use kernel_FreeBSD && rm "${ED}/usr/lib/clang/3.1/include/"{arm_neon,std,float,iso,limits,tgmath,varargs}*.h
+}
+
+pkg_postinst() {
+ python_mod_optimize clang
+ if use system-cxx-headers; then
+ elog "C++ headers search path is hardcoded to the active gcc profile one"
+ elog "If you change the active gcc profile, or update gcc to a new version,"
+ elog "you will have to remerge this package to update the search path"
+ else
+ elog "If clang++ fails to find C++ headers on your system,"
+ elog "you can remerge clang with USE=system-cxx-headers to use C++ headers"
+ elog "from the active gcc profile"
+ fi
+}
+
+pkg_postrm() {
+ python_mod_cleanup clang
+}
diff --git a/sys-devel/clang/clang-3.1-r5.ebuild b/sys-devel/clang/clang-3.1-r5.ebuild
new file mode 100644
index 000000000000..f98c99723b5f
--- /dev/null
+++ b/sys-devel/clang/clang-3.1-r5.ebuild
@@ -0,0 +1,204 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+RESTRICT_PYTHON_ABIS="3.*"
+SUPPORT_PYTHON_ABIS="1"
+
+inherit eutils multilib python
+
+DESCRIPTION="C language family frontend for LLVM"
+HOMEPAGE="http://clang.llvm.org/"
+# Fetching LLVM as well: see http://llvm.org/bugs/show_bug.cgi?id=4840
+SRC_URI="http://llvm.org/releases/${PV}/llvm-${PV}.src.tar.gz
+ http://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.gz
+ http://llvm.org/releases/${PV}/${P}.src.tar.gz"
+
+LICENSE="UoI-NCSA"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86 ~amd64-fbsd ~x64-freebsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
+IUSE="debug kernel_FreeBSD multitarget +static-analyzer test"
+
+DEPEND="static-analyzer? ( dev-lang/perl )"
+RDEPEND="~sys-devel/llvm-${PV}[debug=,multitarget=]"
+
+S=${WORKDIR}/llvm-${PV}.src
+
+src_prepare() {
+ mv "${WORKDIR}"/clang-${PV}.src "${S}"/tools/clang \
+ || die "clang source directory move failed"
+ mv "${WORKDIR}"/compiler-rt-${PV}.src "${S}"/projects/compiler-rt \
+ || die "compiler-rt source directory move failed"
+
+ # Same as llvm doc patches
+ epatch "${FILESDIR}"/${PN}-2.7-fixdoc.patch
+
+ # multilib-strict
+ sed -e "/PROJ_headers/s#lib/clang#$(get_libdir)/clang#" \
+ -i tools/clang/lib/Headers/Makefile \
+ || die "clang Makefile failed"
+ sed -e "/PROJ_resources/s#lib/clang#$(get_libdir)/clang#" \
+ -i tools/clang/runtime/compiler-rt/Makefile \
+ || die "compiler-rt Makefile failed"
+ # fix the static analyzer for in-tree install
+ sed -e 's/import ScanView/from clang \0/' \
+ -i tools/clang/tools/scan-view/scan-view \
+ || die "scan-view sed failed"
+ sed -e "/scanview.css\|sorttable.js/s#\$RealBin#${EPREFIX}/usr/share/${PN}#" \
+ -i tools/clang/tools/scan-build/scan-build \
+ || die "scan-build sed failed"
+ # Set correct path for gold plugin
+ sed -e "/LLVMgold.so/s#lib/#$(get_libdir)/llvm/#" \
+ -i tools/clang/lib/Driver/Tools.cpp \
+ || die "gold plugin path sed failed"
+ # Specify python version
+ python_convert_shebangs 2 tools/clang/tools/scan-view/scan-view
+ python_convert_shebangs -r 2 test/Scripts
+ python_convert_shebangs 2 projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
+
+ # From llvm src_prepare
+ einfo "Fixing install dirs"
+ sed -e 's,^PROJ_docsdir.*,PROJ_docsdir := $(PROJ_prefix)/share/doc/'${PF}, \
+ -e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \
+ -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/llvm, \
+ -i Makefile.config.in || die "Makefile.config sed failed"
+
+ einfo "Fixing rpath and CFLAGS"
+ sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/llvm, \
+ -e '/OmitFramePointer/s/-fomit-frame-pointer//' \
+ -i Makefile.rules || die "rpath sed failed"
+
+ # Use system llc (from llvm ebuild) for tests
+ sed -e "/^llc_props =/s/os.path.join(llvm_tools_dir, 'llc')/'llc'/" \
+ -i tools/clang/test/lit.cfg || die "test path sed failed"
+
+ # Automatically select active system GCC's libraries, bugs #406163 and #417913
+ epatch "${FILESDIR}"/${P}-gentoo-runtime-gcc-detection-v3.patch
+
+ # Fix search paths on FreeBSD, bug #409269
+ epatch "${FILESDIR}"/${P}-gentoo-freebsd-fix-lib-path.patch
+
+ # Fix regression caused by removal of USE=system-cxx-headers, bug #417541
+ epatch "${FILESDIR}"/${P}-gentoo-freebsd-fix-cxx-paths-v2.patch
+
+ # Increase recursion limit, bug #417545, upstream r155737
+ epatch "${FILESDIR}"/${P}-increase-parser-recursion-limit.patch
+
+ # Apply r600 OpenCL-related patches, bug #425688
+ epatch "${FILESDIR}"/cl-patches/llvm-*.patch
+ pushd tools/clang &>/dev/null || die
+ epatch "${FILESDIR}"/cl-patches/clang-*.patch
+ popd &>/dev/null || die
+
+ # User patches
+ epatch_user
+}
+
+src_configure() {
+ local CONF_FLAGS="--enable-shared
+ --with-optimize-option=
+ $(use_enable !debug optimized)
+ $(use_enable debug assertions)
+ $(use_enable debug expensive-checks)"
+
+ # Setup the search path to include the Prefix includes
+ if use prefix ; then
+ CONF_FLAGS="${CONF_FLAGS} \
+ --with-c-include-dirs=${EPREFIX}/usr/include:/usr/include"
+ fi
+
+ if use multitarget; then
+ CONF_FLAGS="${CONF_FLAGS} --enable-targets=all"
+ else
+ CONF_FLAGS="${CONF_FLAGS} --enable-targets=host,cpp"
+ fi
+
+ if use amd64; then
+ CONF_FLAGS="${CONF_FLAGS} --enable-pic"
+ fi
+
+ # clang prefers clang over gcc, so we may need to force that
+ tc-export CC CXX
+ econf ${CONF_FLAGS}
+}
+
+src_compile() {
+ emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1 clang-only
+}
+
+src_test() {
+ cd "${S}"/test || die "cd failed"
+ emake site.exp
+
+ cd "${S}"/tools/clang || die "cd clang failed"
+
+ echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
+
+ testing() {
+ if ! emake -j1 VERBOSE=1 test; then
+ has test $FEATURES && die "Make test failed. See above for details."
+ has test $FEATURES || eerror "Make test failed. See above for details."
+ fi
+ }
+ python_execute_function testing
+}
+
+src_install() {
+ cd "${S}"/tools/clang || die "cd clang failed"
+ emake KEEP_SYMBOLS=1 DESTDIR="${D}" install
+
+ if use static-analyzer ; then
+ dobin tools/scan-build/ccc-analyzer
+ dosym ccc-analyzer /usr/bin/c++-analyzer
+ dobin tools/scan-build/scan-build
+
+ insinto /usr/share/${PN}
+ doins tools/scan-build/scanview.css
+ doins tools/scan-build/sorttable.js
+
+ cd tools/scan-view || die "cd scan-view failed"
+ dobin scan-view
+ install-scan-view() {
+ insinto "$(python_get_sitedir)"/clang
+ doins Reporter.py Resources ScanView.py startfile.py
+ touch "${ED}"/"$(python_get_sitedir)"/clang/__init__.py
+ }
+ python_execute_function install-scan-view
+ fi
+
+ # Fix install_names on Darwin. The build system is too complicated
+ # to just fix this, so we correct it post-install
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ for lib in libclang.dylib ; do
+ ebegin "fixing install_name of $lib"
+ install_name_tool -id "${EPREFIX}"/usr/lib/llvm/${lib} \
+ "${ED}"/usr/lib/llvm/${lib}
+ eend $?
+ done
+ for f in usr/bin/{c-index-test,clang} usr/lib/llvm/libclang.dylib ; do
+ ebegin "fixing references in ${f##*/}"
+ install_name_tool \
+ -change "@rpath/libclang.dylib" \
+ "${EPREFIX}"/usr/lib/llvm/libclang.dylib \
+ -change "@executable_path/../lib/libLLVM-${PV}.dylib" \
+ "${EPREFIX}"/usr/lib/llvm/libLLVM-${PV}.dylib \
+ -change "${S}"/Release/lib/libclang.dylib \
+ "${EPREFIX}"/usr/lib/llvm/libclang.dylib \
+ "${ED}"/$f
+ eend $?
+ done
+ fi
+
+ # Remove unnecessary headers on FreeBSD, bug #417171
+ use kernel_FreeBSD && rm "${ED}"usr/$(get_libdir)/clang/${PV}/include/{arm_neon,std,float,iso,limits,tgmath,varargs}*.h
+}
+
+pkg_postinst() {
+ python_mod_optimize clang
+}
+
+pkg_postrm() {
+ python_mod_cleanup clang
+}
diff --git a/sys-devel/clang/clang-3.2.ebuild b/sys-devel/clang/clang-3.2.ebuild
new file mode 100644
index 000000000000..f0688050fc1a
--- /dev/null
+++ b/sys-devel/clang/clang-3.2.ebuild
@@ -0,0 +1,202 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 pypy )
+
+inherit eutils multilib python-r1
+
+DESCRIPTION="C language family frontend for LLVM"
+HOMEPAGE="http://clang.llvm.org/"
+# Fetching LLVM as well: see http://llvm.org/bugs/show_bug.cgi?id=4840
+SRC_URI="http://llvm.org/releases/${PV}/llvm-${PV}.src.tar.gz
+ http://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.gz
+ http://llvm.org/releases/${PV}/${P}.src.tar.gz"
+
+LICENSE="UoI-NCSA"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~arm ~x86 ~amd64-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
+IUSE="debug kernel_FreeBSD multitarget python +static-analyzer test"
+
+DEPEND="static-analyzer? ( dev-lang/perl )
+ ${PYTHON_DEPS}"
+RDEPEND="~sys-devel/llvm-${PV}[debug=,multitarget=]
+ ${PYTHON_DEPS}"
+
+S=${WORKDIR}/llvm-${PV}.src
+
+src_prepare() {
+ rm -f "${S}"/tools/clang "${S}"/projects/compiler-rt \
+ || die "symlinks removal failed"
+ mv "${WORKDIR}"/${P}.src "${S}"/tools/clang \
+ || die "clang source directory move failed"
+ mv "${WORKDIR}"/compiler-rt-${PV}.src "${S}"/projects/compiler-rt \
+ || die "compiler-rt source directory move failed"
+
+ # Same as llvm doc patches
+ epatch "${FILESDIR}"/${PN}-2.7-fixdoc.patch
+
+ # multilib-strict
+ sed -e "/PROJ_headers/s#lib/clang#$(get_libdir)/clang#" \
+ -i tools/clang/lib/Headers/Makefile \
+ || die "clang Makefile failed"
+ sed -e "/PROJ_resources/s#lib/clang#$(get_libdir)/clang#" \
+ -i tools/clang/runtime/compiler-rt/Makefile \
+ || die "compiler-rt Makefile failed"
+ # fix the static analyzer for in-tree install
+ sed -e 's/import ScanView/from clang \0/' \
+ -i tools/clang/tools/scan-view/scan-view \
+ || die "scan-view sed failed"
+ sed -e "/scanview.css\|sorttable.js/s#\$RealBin#${EPREFIX}/usr/share/${PN}#" \
+ -i tools/clang/tools/scan-build/scan-build \
+ || die "scan-build sed failed"
+ # Set correct path for gold plugin
+ sed -e "/LLVMgold.so/s#lib/#$(get_libdir)/llvm/#" \
+ -i tools/clang/lib/Driver/Tools.cpp \
+ || die "gold plugin path sed failed"
+
+ # From llvm src_prepare
+ einfo "Fixing install dirs"
+ sed -e 's,^PROJ_docsdir.*,PROJ_docsdir := $(PROJ_prefix)/share/doc/'${PF}, \
+ -e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \
+ -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/llvm, \
+ -i Makefile.config.in || die "Makefile.config sed failed"
+
+ einfo "Fixing rpath and CFLAGS"
+ sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/llvm, \
+ -e '/OmitFramePointer/s/-fomit-frame-pointer//' \
+ -i Makefile.rules || die "rpath sed failed"
+
+ # Use system llc (from llvm ebuild) for tests
+ sed -e "/^llc_props =/s/os.path.join(llvm_tools_dir, 'llc')/'llc'/" \
+ -i tools/clang/test/lit.cfg || die "test path sed failed"
+
+ # Automatically select active system GCC's libraries, bugs #406163 and #417913
+ epatch "${FILESDIR}"/${PN}-3.1-gentoo-runtime-gcc-detection-v3.patch
+
+ # Fix search paths on FreeBSD, bug #409269
+ epatch "${FILESDIR}"/${PN}-3.1-gentoo-freebsd-fix-lib-path.patch
+
+ # Fix regression caused by removal of USE=system-cxx-headers, bug #417541
+ # Needs to be updated for 3.2
+ #epatch "${FILESDIR}"/${PN}-3.1-gentoo-freebsd-fix-cxx-paths-v2.patch
+
+ # User patches
+ epatch_user
+}
+
+src_configure() {
+ local CONF_FLAGS="--enable-shared
+ --with-optimize-option=
+ $(use_enable !debug optimized)
+ $(use_enable debug assertions)
+ $(use_enable debug expensive-checks)"
+
+ # Setup the search path to include the Prefix includes
+ if use prefix ; then
+ CONF_FLAGS="${CONF_FLAGS} \
+ --with-c-include-dirs=${EPREFIX}/usr/include:/usr/include"
+ fi
+
+ if use multitarget; then
+ CONF_FLAGS="${CONF_FLAGS} --enable-targets=all"
+ else
+ CONF_FLAGS="${CONF_FLAGS} --enable-targets=host,cpp"
+ fi
+
+ if use amd64; then
+ CONF_FLAGS="${CONF_FLAGS} --enable-pic"
+ fi
+
+ # build with a suitable Python version
+ python_export_best
+
+ # clang prefers clang over gcc, so we may need to force that
+ tc-export CC CXX
+ econf ${CONF_FLAGS}
+}
+
+src_compile() {
+ emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1 clang-only
+}
+
+src_test() {
+ cd "${S}"/tools/clang || die "cd clang failed"
+
+ echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
+
+ if ! emake -j1 VERBOSE=1 test; then
+ has test $FEATURES && die "Make test failed. See above for details."
+ has test $FEATURES || eerror "Make test failed. See above for details."
+ fi
+}
+
+src_install() {
+ cd "${S}"/tools/clang || die "cd clang failed"
+ emake KEEP_SYMBOLS=1 DESTDIR="${D}" install
+
+ if use static-analyzer ; then
+ dobin tools/scan-build/ccc-analyzer
+ dosym ccc-analyzer /usr/bin/c++-analyzer
+ dobin tools/scan-build/scan-build
+
+ insinto /usr/share/${PN}
+ doins tools/scan-build/scanview.css
+ doins tools/scan-build/sorttable.js
+ fi
+
+ python_inst() {
+ if use static-analyzer ; then
+ pushd tools/scan-view >/dev/null || die
+
+ python_doscript scan-view
+
+ touch __init__.py || die
+ python_moduleinto clang
+ python_domodule __init__.py Reporter.py Resources ScanView.py startfile.py
+
+ popd >/dev/null || die
+ fi
+
+ if use python ; then
+ pushd bindings/python/clang >/dev/null || die
+
+ python_moduleinto clang
+ python_domodule __init__.py cindex.py enumerations.py
+
+ popd >/dev/null || die
+ fi
+
+ # AddressSanitizer symbolizer (currently separate)
+ python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
+ }
+ python_foreach_impl python_inst
+
+ # Fix install_names on Darwin. The build system is too complicated
+ # to just fix this, so we correct it post-install
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ for lib in libclang.dylib ; do
+ ebegin "fixing install_name of $lib"
+ install_name_tool -id "${EPREFIX}"/usr/lib/llvm/${lib} \
+ "${ED}"/usr/lib/llvm/${lib}
+ eend $?
+ done
+ for f in usr/bin/{c-index-test,clang} usr/lib/llvm/libclang.dylib ; do
+ ebegin "fixing references in ${f##*/}"
+ install_name_tool \
+ -change "@rpath/libclang.dylib" \
+ "${EPREFIX}"/usr/lib/llvm/libclang.dylib \
+ -change "@executable_path/../lib/libLLVM-${PV}.dylib" \
+ "${EPREFIX}"/usr/lib/llvm/libLLVM-${PV}.dylib \
+ -change "${S}"/Release/lib/libclang.dylib \
+ "${EPREFIX}"/usr/lib/llvm/libclang.dylib \
+ "${ED}"/$f
+ eend $?
+ done
+ fi
+
+ # Remove unnecessary headers on FreeBSD, bug #417171
+ use kernel_FreeBSD && rm "${ED}"usr/$(get_libdir)/clang/${PV}/include/{arm_neon,std,float,iso,limits,tgmath,varargs}*.h
+}
diff --git a/sys-devel/clang/clang-3.3-r100.ebuild b/sys-devel/clang/clang-3.3-r100.ebuild
new file mode 100644
index 000000000000..091c3f12edd5
--- /dev/null
+++ b/sys-devel/clang/clang-3.3-r100.ebuild
@@ -0,0 +1,36 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit multilib-build
+
+DESCRIPTION="C language family frontend for LLVM (meta-ebuild)"
+HOMEPAGE="http://clang.llvm.org/"
+SRC_URI=""
+
+LICENSE="UoI-NCSA"
+SLOT="0/${PV}"
+KEYWORDS="amd64 arm ppc x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos"
+IUSE="debug multitarget python +static-analyzer"
+
+RDEPEND="~sys-devel/llvm-${PV}[clang(-),debug=,multitarget?,python?,static-analyzer,${MULTILIB_USEDEP}]"
+
+# Please keep this package around since it's quite likely that we'll
+# return to separate LLVM & clang ebuilds when the cmake build system
+# is complete.
+
+pkg_postinst() {
+ if has_version ">=dev-util/ccache-3.1.9-r2" ; then
+ #add ccache links as clang might get installed after ccache
+ "${EROOT}"/usr/bin/ccache-config --install-links
+ fi
+}
+
+pkg_postrm() {
+ if has_version ">=dev-util/ccache-3.1.9-r2" && [[ -z ${REPLACED_BY_VERSION} ]]; then
+ # --remove-links would remove all links, --install-links updates them
+ "${EROOT}"/usr/bin/ccache-config --install-links
+ fi
+}
diff --git a/sys-devel/clang/clang-3.4.2-r100.ebuild b/sys-devel/clang/clang-3.4.2-r100.ebuild
new file mode 100644
index 000000000000..27c47517b000
--- /dev/null
+++ b/sys-devel/clang/clang-3.4.2-r100.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 multilib-build
+
+DESCRIPTION="C language family frontend for LLVM (meta-ebuild)"
+HOMEPAGE="http://clang.llvm.org/"
+SRC_URI=""
+
+LICENSE="UoI-NCSA"
+SLOT="0/3.4"
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos"
+IUSE="debug multitarget python +static-analyzer"
+
+RDEPEND="~sys-devel/llvm-${PV}[clang(-),debug=,multitarget?,python?,static-analyzer,${MULTILIB_USEDEP}]"
+
+# Please keep this package around since it's quite likely that we'll
+# return to separate LLVM & clang ebuilds when the cmake build system
+# is complete.
+
+pkg_postinst() {
+ if has_version ">=dev-util/ccache-3.1.9-r2" ; then
+ #add ccache links as clang might get installed after ccache
+ "${EROOT}"/usr/bin/ccache-config --install-links
+ fi
+}
+
+pkg_postrm() {
+ if has_version ">=dev-util/ccache-3.1.9-r2" && [[ -z ${REPLACED_BY_VERSION} ]]; then
+ # --remove-links would remove all links, --install-links updates them
+ "${EROOT}"/usr/bin/ccache-config --install-links
+ fi
+}
diff --git a/sys-devel/clang/clang-3.5.0-r100.ebuild b/sys-devel/clang/clang-3.5.0-r100.ebuild
new file mode 100644
index 000000000000..922981de9f64
--- /dev/null
+++ b/sys-devel/clang/clang-3.5.0-r100.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 multilib-build
+
+DESCRIPTION="C language family frontend for LLVM (meta-ebuild)"
+HOMEPAGE="http://clang.llvm.org/"
+SRC_URI=""
+
+LICENSE="UoI-NCSA"
+SLOT="0/3.5"
+KEYWORDS="amd64 arm ppc ppc64 x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos"
+IUSE="debug multitarget python +static-analyzer"
+
+RDEPEND="~sys-devel/llvm-${PV}[clang(-),debug=,multitarget?,python?,static-analyzer,${MULTILIB_USEDEP}]"
+
+# Please keep this package around since it's quite likely that we'll
+# return to separate LLVM & clang ebuilds when the cmake build system
+# is complete.
+
+pkg_postinst() {
+ if has_version ">=dev-util/ccache-3.1.9-r2" ; then
+ #add ccache links as clang might get installed after ccache
+ "${EROOT}"/usr/bin/ccache-config --install-links
+ fi
+}
+
+pkg_postrm() {
+ if has_version ">=dev-util/ccache-3.1.9-r2" && [[ -z ${REPLACED_BY_VERSION} ]]; then
+ # --remove-links would remove all links, --install-links updates them
+ "${EROOT}"/usr/bin/ccache-config --install-links
+ fi
+}
diff --git a/sys-devel/clang/clang-3.5.1-r100.ebuild b/sys-devel/clang/clang-3.5.1-r100.ebuild
new file mode 100644
index 000000000000..61310b2d3a68
--- /dev/null
+++ b/sys-devel/clang/clang-3.5.1-r100.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 multilib-build
+
+DESCRIPTION="C language family frontend for LLVM (meta-ebuild)"
+HOMEPAGE="http://clang.llvm.org/"
+SRC_URI=""
+
+LICENSE="UoI-NCSA"
+SLOT="0/3.5"
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos"
+IUSE="debug multitarget python +static-analyzer"
+
+RDEPEND="~sys-devel/llvm-${PV}[clang(-),debug=,multitarget?,python?,static-analyzer,${MULTILIB_USEDEP}]"
+
+# Please keep this package around since it's quite likely that we'll
+# return to separate LLVM & clang ebuilds when the cmake build system
+# is complete.
+
+pkg_postinst() {
+ if has_version ">=dev-util/ccache-3.1.9-r2" ; then
+ #add ccache links as clang might get installed after ccache
+ "${EROOT}"/usr/bin/ccache-config --install-links
+ fi
+}
+
+pkg_postrm() {
+ if has_version ">=dev-util/ccache-3.1.9-r2" && [[ -z ${REPLACED_BY_VERSION} ]]; then
+ # --remove-links would remove all links, --install-links updates them
+ "${EROOT}"/usr/bin/ccache-config --install-links
+ fi
+}
diff --git a/sys-devel/clang/clang-3.5.2-r100.ebuild b/sys-devel/clang/clang-3.5.2-r100.ebuild
new file mode 100644
index 000000000000..61310b2d3a68
--- /dev/null
+++ b/sys-devel/clang/clang-3.5.2-r100.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 multilib-build
+
+DESCRIPTION="C language family frontend for LLVM (meta-ebuild)"
+HOMEPAGE="http://clang.llvm.org/"
+SRC_URI=""
+
+LICENSE="UoI-NCSA"
+SLOT="0/3.5"
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos"
+IUSE="debug multitarget python +static-analyzer"
+
+RDEPEND="~sys-devel/llvm-${PV}[clang(-),debug=,multitarget?,python?,static-analyzer,${MULTILIB_USEDEP}]"
+
+# Please keep this package around since it's quite likely that we'll
+# return to separate LLVM & clang ebuilds when the cmake build system
+# is complete.
+
+pkg_postinst() {
+ if has_version ">=dev-util/ccache-3.1.9-r2" ; then
+ #add ccache links as clang might get installed after ccache
+ "${EROOT}"/usr/bin/ccache-config --install-links
+ fi
+}
+
+pkg_postrm() {
+ if has_version ">=dev-util/ccache-3.1.9-r2" && [[ -z ${REPLACED_BY_VERSION} ]]; then
+ # --remove-links would remove all links, --install-links updates them
+ "${EROOT}"/usr/bin/ccache-config --install-links
+ fi
+}
diff --git a/sys-devel/clang/clang-3.6.0-r100.ebuild b/sys-devel/clang/clang-3.6.0-r100.ebuild
new file mode 100644
index 000000000000..145a0f189b21
--- /dev/null
+++ b/sys-devel/clang/clang-3.6.0-r100.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 multilib-build
+
+DESCRIPTION="C language family frontend for LLVM (meta-ebuild)"
+HOMEPAGE="http://clang.llvm.org/"
+SRC_URI=""
+
+LICENSE="UoI-NCSA"
+SLOT="0/3.6"
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos"
+IUSE="debug multitarget python +static-analyzer"
+
+RDEPEND="~sys-devel/llvm-${PV}[clang(-),debug=,multitarget?,python?,static-analyzer,${MULTILIB_USEDEP}]"
+
+# Please keep this package around since it's quite likely that we'll
+# return to separate LLVM & clang ebuilds when the cmake build system
+# is complete.
+
+pkg_postinst() {
+ if has_version ">=dev-util/ccache-3.1.9-r2" ; then
+ #add ccache links as clang might get installed after ccache
+ "${EROOT}"/usr/bin/ccache-config --install-links
+ fi
+}
+
+pkg_postrm() {
+ if has_version ">=dev-util/ccache-3.1.9-r2" && [[ -z ${REPLACED_BY_VERSION} ]]; then
+ # --remove-links would remove all links, --install-links updates them
+ "${EROOT}"/usr/bin/ccache-config --install-links
+ fi
+}
diff --git a/sys-devel/clang/clang-3.6.1-r100.ebuild b/sys-devel/clang/clang-3.6.1-r100.ebuild
new file mode 100644
index 000000000000..145a0f189b21
--- /dev/null
+++ b/sys-devel/clang/clang-3.6.1-r100.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 multilib-build
+
+DESCRIPTION="C language family frontend for LLVM (meta-ebuild)"
+HOMEPAGE="http://clang.llvm.org/"
+SRC_URI=""
+
+LICENSE="UoI-NCSA"
+SLOT="0/3.6"
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos"
+IUSE="debug multitarget python +static-analyzer"
+
+RDEPEND="~sys-devel/llvm-${PV}[clang(-),debug=,multitarget?,python?,static-analyzer,${MULTILIB_USEDEP}]"
+
+# Please keep this package around since it's quite likely that we'll
+# return to separate LLVM & clang ebuilds when the cmake build system
+# is complete.
+
+pkg_postinst() {
+ if has_version ">=dev-util/ccache-3.1.9-r2" ; then
+ #add ccache links as clang might get installed after ccache
+ "${EROOT}"/usr/bin/ccache-config --install-links
+ fi
+}
+
+pkg_postrm() {
+ if has_version ">=dev-util/ccache-3.1.9-r2" && [[ -z ${REPLACED_BY_VERSION} ]]; then
+ # --remove-links would remove all links, --install-links updates them
+ "${EROOT}"/usr/bin/ccache-config --install-links
+ fi
+}
diff --git a/sys-devel/clang/clang-3.6.2-r100.ebuild b/sys-devel/clang/clang-3.6.2-r100.ebuild
new file mode 100644
index 000000000000..145a0f189b21
--- /dev/null
+++ b/sys-devel/clang/clang-3.6.2-r100.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 multilib-build
+
+DESCRIPTION="C language family frontend for LLVM (meta-ebuild)"
+HOMEPAGE="http://clang.llvm.org/"
+SRC_URI=""
+
+LICENSE="UoI-NCSA"
+SLOT="0/3.6"
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos"
+IUSE="debug multitarget python +static-analyzer"
+
+RDEPEND="~sys-devel/llvm-${PV}[clang(-),debug=,multitarget?,python?,static-analyzer,${MULTILIB_USEDEP}]"
+
+# Please keep this package around since it's quite likely that we'll
+# return to separate LLVM & clang ebuilds when the cmake build system
+# is complete.
+
+pkg_postinst() {
+ if has_version ">=dev-util/ccache-3.1.9-r2" ; then
+ #add ccache links as clang might get installed after ccache
+ "${EROOT}"/usr/bin/ccache-config --install-links
+ fi
+}
+
+pkg_postrm() {
+ if has_version ">=dev-util/ccache-3.1.9-r2" && [[ -z ${REPLACED_BY_VERSION} ]]; then
+ # --remove-links would remove all links, --install-links updates them
+ "${EROOT}"/usr/bin/ccache-config --install-links
+ fi
+}
diff --git a/sys-devel/clang/clang-9999-r100.ebuild b/sys-devel/clang/clang-9999-r100.ebuild
new file mode 100644
index 000000000000..f253e0b845c0
--- /dev/null
+++ b/sys-devel/clang/clang-9999-r100.ebuild
@@ -0,0 +1,36 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit multilib-build
+
+DESCRIPTION="C language family frontend for LLVM (meta-ebuild)"
+HOMEPAGE="http://clang.llvm.org/"
+SRC_URI=""
+
+LICENSE="UoI-NCSA"
+SLOT="0/${PV}"
+KEYWORDS=""
+IUSE="debug multitarget python +static-analyzer"
+
+RDEPEND="~sys-devel/llvm-${PV}[clang(-),debug=,multitarget?,python?,static-analyzer,${MULTILIB_USEDEP}]"
+
+# Please keep this package around since it's quite likely that we'll
+# return to separate LLVM & clang ebuilds when the cmake build system
+# is complete.
+
+pkg_postinst() {
+ if has_version ">=dev-util/ccache-3.1.9-r2" ; then
+ #add ccache links as clang might get installed after ccache
+ "${EROOT}"/usr/bin/ccache-config --install-links
+ fi
+}
+
+pkg_postrm() {
+ if has_version ">=dev-util/ccache-3.1.9-r2" && [[ -z ${REPLACED_BY_VERSION} ]]; then
+ # --remove-links would remove all links, --install-links updates them
+ "${EROOT}"/usr/bin/ccache-config --install-links
+ fi
+}
diff --git a/sys-devel/clang/clang-9999.ebuild b/sys-devel/clang/clang-9999.ebuild
new file mode 100644
index 000000000000..ef2a05bc7c0e
--- /dev/null
+++ b/sys-devel/clang/clang-9999.ebuild
@@ -0,0 +1,193 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 pypy )
+
+inherit subversion eutils multilib python-r1
+
+DESCRIPTION="C language family frontend for LLVM"
+HOMEPAGE="http://clang.llvm.org/"
+SRC_URI=""
+ESVN_REPO_URI="http://llvm.org/svn/llvm-project/cfe/trunk"
+
+LICENSE="UoI-NCSA"
+SLOT="0/${PV}"
+KEYWORDS=""
+IUSE="debug multitarget python +static-analyzer test"
+
+DEPEND="static-analyzer? ( dev-lang/perl )
+ ${PYTHON_DEPS}"
+RDEPEND="~sys-devel/llvm-${PV}[debug=,multitarget=]
+ ${PYTHON_DEPS}"
+
+S="${WORKDIR}/llvm"
+
+src_unpack() {
+ # Fetching LLVM and subprojects
+ ESVN_PROJECT=llvm subversion_fetch "http://llvm.org/svn/llvm-project/llvm/trunk"
+ ESVN_PROJECT=compiler-rt S="${S}"/projects/compiler-rt subversion_fetch "http://llvm.org/svn/llvm-project/compiler-rt/trunk"
+ ESVN_PROJECT=clang S="${S}"/tools/clang subversion_fetch
+}
+
+src_prepare() {
+ # Same as llvm doc patches
+ epatch "${FILESDIR}"/${PN}-2.7-fixdoc.patch
+
+ # multilib-strict
+ sed -e "/PROJ_headers\|HeaderDir/s#lib/clang#$(get_libdir)/clang#" \
+ -i tools/clang/lib/Headers/Makefile \
+ || die "clang Makefile sed failed"
+ sed -e "/PROJ_resources\|ResourceDir/s#lib/clang#$(get_libdir)/clang#" \
+ -i tools/clang/runtime/compiler-rt/Makefile \
+ || die "compiler-rt Makefile sed failed"
+ sed -e "s#/lib/#/lib{{(32|64)?}}/#" \
+ -i tools/clang/test/Preprocessor/iwithprefix.c \
+ || die "clang test sed failed"
+ # fix the static analyzer for in-tree install
+ sed -e 's/import ScanView/from clang \0/' \
+ -i tools/clang/tools/scan-view/scan-view \
+ || die "scan-view sed failed"
+ sed -e "/scanview.css\|sorttable.js/s#\$RealBin#${EPREFIX}/usr/share/${PN}#" \
+ -i tools/clang/tools/scan-build/scan-build \
+ || die "scan-build sed failed"
+ # Set correct path for gold plugin and coverage lib
+ sed -e "/LLVMgold.so/s#lib/#$(get_libdir)/llvm/#" \
+ -e "s#lib\(/libprofile_rt.a\)#$(get_libdir)/llvm\1#" \
+ -i tools/clang/lib/Driver/Tools.cpp \
+ || die "driver tools paths sed failed"
+
+ # From llvm src_prepare
+ einfo "Fixing install dirs"
+ sed -e 's,^PROJ_docsdir.*,PROJ_docsdir := $(PROJ_prefix)/share/doc/'${PF}, \
+ -e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \
+ -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/llvm, \
+ -i Makefile.config.in || die "Makefile.config sed failed"
+
+ einfo "Fixing rpath and CFLAGS"
+ sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/llvm, \
+ -e '/OmitFramePointer/s/-fomit-frame-pointer//' \
+ -i Makefile.rules || die "rpath sed failed"
+
+ # Use system llc (from llvm ebuild) for tests
+ sed -e "/^llc_props =/s/os.path.join(llvm_tools_dir, 'llc')/'llc'/" \
+ -i tools/clang/test/lit.cfg || die "test path sed failed"
+
+ # User patches
+ epatch_user
+}
+
+src_configure() {
+ # Update resource dir version after first RC
+ local CONF_FLAGS="--enable-shared
+ --with-optimize-option=
+ $(use_enable !debug optimized)
+ $(use_enable debug assertions)
+ $(use_enable debug expensive-checks)
+ --with-clang-resource-dir=../$(get_libdir)/clang/3.4"
+
+ # Setup the search path to include the Prefix includes
+ if use prefix ; then
+ CONF_FLAGS="${CONF_FLAGS} \
+ --with-c-include-dirs=${EPREFIX}/usr/include:/usr/include"
+ fi
+
+ if use multitarget; then
+ CONF_FLAGS="${CONF_FLAGS} --enable-targets=all"
+ else
+ CONF_FLAGS="${CONF_FLAGS} --enable-targets=host,cpp"
+ fi
+
+ if use amd64; then
+ CONF_FLAGS="${CONF_FLAGS} --enable-pic"
+ fi
+
+ # build with a suitable Python version
+ python_export_best
+
+ # clang prefers clang over gcc, so we may need to force that
+ tc-export CC CXX
+ econf ${CONF_FLAGS}
+}
+
+src_compile() {
+ emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1 clang-only
+}
+
+src_test() {
+ cd "${S}"/tools/clang || die "cd clang failed"
+
+ echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
+
+ if ! emake -j1 VERBOSE=1 test; then
+ has test $FEATURES && die "Make test failed. See above for details."
+ has test $FEATURES || eerror "Make test failed. See above for details."
+ fi
+}
+
+src_install() {
+ cd "${S}"/tools/clang || die "cd clang failed"
+ emake KEEP_SYMBOLS=1 DESTDIR="${D}" install
+
+ if use static-analyzer ; then
+ dobin tools/scan-build/ccc-analyzer
+ dosym ccc-analyzer /usr/bin/c++-analyzer
+ dobin tools/scan-build/scan-build
+
+ insinto /usr/share/${PN}
+ doins tools/scan-build/scanview.css
+ doins tools/scan-build/sorttable.js
+ fi
+
+ python_inst() {
+ if use static-analyzer ; then
+ pushd tools/scan-view >/dev/null || die
+
+ python_doscript scan-view
+
+ touch __init__.py || die
+ python_moduleinto clang
+ python_domodule __init__.py Reporter.py Resources ScanView.py startfile.py
+
+ popd >/dev/null || die
+ fi
+
+ if use python ; then
+ pushd bindings/python/clang >/dev/null || die
+
+ python_moduleinto clang
+ python_domodule __init__.py cindex.py enumerations.py
+
+ popd >/dev/null || die
+ fi
+
+ # AddressSanitizer symbolizer (currently separate)
+ python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
+ }
+ python_foreach_impl python_inst
+
+ # Fix install_names on Darwin. The build system is too complicated
+ # to just fix this, so we correct it post-install
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ for lib in libclang.dylib ; do
+ ebegin "fixing install_name of $lib"
+ install_name_tool -id "${EPREFIX}"/usr/lib/llvm/${lib} \
+ "${ED}"/usr/lib/llvm/${lib}
+ eend $?
+ done
+ for f in usr/bin/{c-index-test,clang} usr/lib/llvm/libclang.dylib ; do
+ ebegin "fixing references in ${f##*/}"
+ install_name_tool \
+ -change "@rpath/libclang.dylib" \
+ "${EPREFIX}"/usr/lib/llvm/libclang.dylib \
+ -change "@executable_path/../lib/libLLVM-${PV}.dylib" \
+ "${EPREFIX}"/usr/lib/llvm/libLLVM-${PV}.dylib \
+ -change "${S}"/Release/lib/libclang.dylib \
+ "${EPREFIX}"/usr/lib/llvm/libclang.dylib \
+ "${ED}"/$f
+ eend $?
+ done
+ fi
+}
diff --git a/sys-devel/clang/files/cl-patches/clang-0001-Add-r600-TargetInfo.patch b/sys-devel/clang/files/cl-patches/clang-0001-Add-r600-TargetInfo.patch
new file mode 100644
index 000000000000..929b5d37028f
--- /dev/null
+++ b/sys-devel/clang/files/cl-patches/clang-0001-Add-r600-TargetInfo.patch
@@ -0,0 +1,100 @@
+From 70cae83ffd093f183dec07c464db3c0bb6b92c10 Mon Sep 17 00:00:00 2001
+From: Tom Stellard <thomas.stellard@amd.com>
+Date: Fri, 2 Mar 2012 10:54:52 -0500
+Subject: [PATCH 1/3] Add r600 TargetInfo
+
+---
+ lib/Basic/Targets.cpp | 70 +++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 files changed, 70 insertions(+), 0 deletions(-)
+
+diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
+index 85dfd78..64dc01c 100644
+--- a/lib/Basic/Targets.cpp
++++ b/lib/Basic/Targets.cpp
+@@ -1068,6 +1068,73 @@ namespace {
+ }
+
+ namespace {
++
++class AMDGPUTargetInfo : public TargetInfo {
++public:
++
++ AMDGPUTargetInfo(const std::string& triple) : TargetInfo(triple) { }
++
++ virtual const char * getClobbers() const {
++ return "";
++ }
++
++ virtual void getGCCRegNames(const char * const *&Names,
++ unsigned &numNames) const {
++ Names = NULL;
++ numNames = 0;
++ }
++
++ virtual void getGCCRegAliases(const GCCRegAlias *&Aliases,
++ unsigned &NumAliases) const {
++ Aliases = NULL;
++ NumAliases = 0;
++ }
++
++ virtual bool validateAsmConstraint(const char *&Name,
++ TargetInfo::ConstraintInfo &info) const {
++ return true;
++ }
++
++ virtual void getTargetBuiltins(const Builtin::Info *&Records,
++ unsigned &NumRecords) const {
++ Records = NULL;
++ NumRecords = 0;
++ }
++};
++
++
++static const unsigned R600AddrSpaceMap[] = {
++ 1, // opencl_global
++ 3, // opencl_local
++ 2 // opencl_constant
++};
++
++class R600TargetInfo : public AMDGPUTargetInfo {
++public:
++ R600TargetInfo(const std::string& triple) : AMDGPUTargetInfo(triple) {
++ DescriptionString =
++ "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16"
++ "-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f80:32:32"
++ "-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64"
++ "-v96:128:128-v128:128:128-v192:256:256-v256:256:256"
++ "-v512:512:512-v1024:1024:1024-v2048:2048:2048"
++ "-n8:16:32:64";
++ AddrSpaceMap = &R600AddrSpaceMap;
++ }
++
++ virtual void getTargetDefines(const LangOptions &Opts,
++ MacroBuilder &Builder) const {
++ Builder.defineMacro("__R600__");
++ }
++
++ virtual const char * getVAListDeclaration() const {
++ return "";
++ }
++};
++
++} // end anonymous namespace
++
++namespace {
+ // MBlaze abstract base class
+ class MBlazeTargetInfo : public TargetInfo {
+ static const char * const GCCRegNames[];
+@@ -3963,6 +4030,9 @@ static TargetInfo *AllocateTarget(const std::string &T) {
+ case llvm::Triple::mblaze:
+ return new MBlazeTargetInfo(T);
+
++ case llvm::Triple::r600:
++ return new R600TargetInfo(T);
++
+ case llvm::Triple::sparc:
+ switch (os) {
+ case llvm::Triple::Linux:
+--
+1.7.7.6
+
diff --git a/sys-devel/clang/files/cl-patches/clang-0002-r600-Add-some-target-builtins.patch b/sys-devel/clang/files/cl-patches/clang-0002-r600-Add-some-target-builtins.patch
new file mode 100644
index 000000000000..0003a8d53560
--- /dev/null
+++ b/sys-devel/clang/files/cl-patches/clang-0002-r600-Add-some-target-builtins.patch
@@ -0,0 +1,111 @@
+From a014573ad193775b2301e39275a1ca0ac3bb5847 Mon Sep 17 00:00:00 2001
+From: Tom Stellard <thomas.stellard@amd.com>
+Date: Tue, 13 Mar 2012 13:54:51 -0400
+Subject: [PATCH 2/3] r600: Add some target builtins
+
+---
+ include/clang/Basic/BuiltinsR600.def | 32 ++++++++++++++++++++++++++++++++
+ include/clang/Basic/TargetBuiltins.h | 10 ++++++++++
+ lib/Basic/Targets.cpp | 12 ++++++++++--
+ 3 files changed, 52 insertions(+), 2 deletions(-)
+ create mode 100644 include/clang/Basic/BuiltinsR600.def
+
+diff --git a/include/clang/Basic/BuiltinsR600.def b/include/clang/Basic/BuiltinsR600.def
+new file mode 100644
+index 0000000..ce1f30e
+--- /dev/null
++++ b/include/clang/Basic/BuiltinsR600.def
+@@ -0,0 +1,32 @@
++//===--- BuiltinsR600.def - R600 Builtin function database -- --*- C++ -*-===//
++//
++// The LLVM Compiler Infrastructure
++//
++// This file is distributed under the University of Illinois Open Source
++// License. See LICENSE.TXT for details.
++//
++//===----------------------------------------------------------------------===//
++//
++// This file defines the R600-specific builtin function database. Users of
++// this file must define the BUILTIN macro to make use of this information.
++//
++//===----------------------------------------------------------------------===//
++//
++// Authors: Tom Stellard <thomas.stellard@amd.com>
++//
++
++// The format of this database matches clang/Basic/Builtins.def.
++
++BUILTIN(__builtin_r600_read_ngroups_x, "z", "nc")
++BUILTIN(__builtin_r600_read_ngroups_y, "z", "nc")
++BUILTIN(__builtin_r600_read_ngroups_z, "z", "nc")
++
++BUILTIN(__builtin_r600_read_tidig_x, "z", "nc")
++BUILTIN(__builtin_r600_read_tidig_y, "z", "nc")
++BUILTIN(__builtin_r600_read_tidig_z, "z", "nc")
++
++BUILTIN(__builtin_r600_read_tgid_x, "z", "nc")
++BUILTIN(__builtin_r600_read_tgid_y, "z", "nc")
++BUILTIN(__builtin_r600_read_tgid_z, "z", "nc")
++
++#undef BUILTIN
+diff --git a/include/clang/Basic/TargetBuiltins.h b/include/clang/Basic/TargetBuiltins.h
+index 7c04bf7..3460cd5 100644
+--- a/include/clang/Basic/TargetBuiltins.h
++++ b/include/clang/Basic/TargetBuiltins.h
+@@ -45,6 +45,16 @@ namespace clang {
+ };
+ }
+
++ /// R600 builtins
++ namespace R600 {
++ enum {
++ LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
++#define BUILTIN(ID, TYPE, ATTRS) BI##ID,
++#include "clang/Basic/BuiltinsR600.def"
++ LastTSBuiltin
++ };
++ }
++
+
+ /// X86 builtins
+ namespace X86 {
+diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
+index 64dc01c..03f1a18 100644
+--- a/lib/Basic/Targets.cpp
++++ b/lib/Basic/Targets.cpp
+@@ -1070,6 +1070,7 @@ namespace {
+ namespace {
+
+ class AMDGPUTargetInfo : public TargetInfo {
++ static const Builtin::Info BuiltinInfo[];
+ public:
+
+ AMDGPUTargetInfo(const std::string& triple) : TargetInfo(triple) { }
+@@ -1097,8 +1098,8 @@ public:
+
+ virtual void getTargetBuiltins(const Builtin::Info *&Records,
+ unsigned &NumRecords) const {
+- Records = NULL;
+- NumRecords = 0;
++ Records = BuiltinInfo;
++ NumRecords = clang::R600::LastTSBuiltin-Builtin::FirstTSBuiltin;
+ }
+ };
+
+@@ -1132,6 +1133,13 @@ public:
+ }
+ };
+
++const Builtin::Info AMDGPUTargetInfo::BuiltinInfo[] = {
++#define BUILTIN(ID, TYPE, ATTRS) { #ID, TYPE, ATTRS, 0, ALL_LANGUAGES },
++#define LIBBUILTIN(ID, TYPE, ATTRS, HEADER) { #ID, TYPE, ATTRS, HEADER,\
++ ALL_LANGUAGES },
++#include "clang/Basic/BuiltinsR600.def"
++};
++
+ } // end anonymous namespace
+
+ namespace {
+--
+1.7.7.6
+
diff --git a/sys-devel/clang/files/cl-patches/clang-0003-r600-Add-read_global_size-and-read_local_size-builti.patch b/sys-devel/clang/files/cl-patches/clang-0003-r600-Add-read_global_size-and-read_local_size-builti.patch
new file mode 100644
index 000000000000..e0c2d3bb6116
--- /dev/null
+++ b/sys-devel/clang/files/cl-patches/clang-0003-r600-Add-read_global_size-and-read_local_size-builti.patch
@@ -0,0 +1,31 @@
+From 2881b8189dcacc8ab6a336f0e107d72752c8c47e Mon Sep 17 00:00:00 2001
+From: Tom Stellard <thomas.stellard@amd.com>
+Date: Wed, 14 Mar 2012 11:20:08 -0400
+Subject: [PATCH 3/3] r600: Add read_global_size and read_local_size builtins
+
+---
+ include/clang/Basic/BuiltinsR600.def | 8 ++++++++
+ 1 files changed, 8 insertions(+), 0 deletions(-)
+
+diff --git a/include/clang/Basic/BuiltinsR600.def b/include/clang/Basic/BuiltinsR600.def
+index ce1f30e..c81758e 100644
+--- a/include/clang/Basic/BuiltinsR600.def
++++ b/include/clang/Basic/BuiltinsR600.def
+@@ -17,6 +17,14 @@
+
+ // The format of this database matches clang/Basic/Builtins.def.
+
++BUILTIN(__builtin_r600_read_global_size_x, "z", "nc")
++BUILTIN(__builtin_r600_read_global_size_y, "z", "nc")
++BUILTIN(__builtin_r600_read_global_size_z, "z", "nc")
++
++BUILTIN(__builtin_r600_read_local_size_x, "z", "nc")
++BUILTIN(__builtin_r600_read_local_size_y, "z", "nc")
++BUILTIN(__builtin_r600_read_local_size_z, "z", "nc")
++
+ BUILTIN(__builtin_r600_read_ngroups_x, "z", "nc")
+ BUILTIN(__builtin_r600_read_ngroups_y, "z", "nc")
+ BUILTIN(__builtin_r600_read_ngroups_z, "z", "nc")
+--
+1.7.7.6
+
diff --git a/sys-devel/clang/files/cl-patches/llvm-0001-r600-Add-some-intrinsic-definitions.patch b/sys-devel/clang/files/cl-patches/llvm-0001-r600-Add-some-intrinsic-definitions.patch
new file mode 100644
index 000000000000..9d99c9cff350
--- /dev/null
+++ b/sys-devel/clang/files/cl-patches/llvm-0001-r600-Add-some-intrinsic-definitions.patch
@@ -0,0 +1,64 @@
+From e25389b66b5ced3a2b5461077dcc9a505d334e3d Mon Sep 17 00:00:00 2001
+From: Tom Stellard <thomas.stellard@amd.com>
+Date: Tue, 13 Mar 2012 14:12:21 -0400
+Subject: [PATCH 1/2] r600: Add some intrinsic definitions
+
+---
+ include/llvm/Intrinsics.td | 1 +
+ include/llvm/IntrinsicsR600.td | 35 +++++++++++++++++++++++++++++++++++
+ 2 files changed, 36 insertions(+), 0 deletions(-)
+ create mode 100644 include/llvm/IntrinsicsR600.td
+
+diff --git a/include/llvm/Intrinsics.td b/include/llvm/Intrinsics.td
+index 069f907..e90dd85 100644
+--- a/include/llvm/Intrinsics.td
++++ b/include/llvm/Intrinsics.td
+@@ -441,3 +441,4 @@ include "llvm/IntrinsicsCellSPU.td"
+ include "llvm/IntrinsicsXCore.td"
+ include "llvm/IntrinsicsPTX.td"
+ include "llvm/IntrinsicsHexagon.td"
++include "llvm/IntrinsicsR600.td"
+diff --git a/include/llvm/IntrinsicsR600.td b/include/llvm/IntrinsicsR600.td
+new file mode 100644
+index 0000000..789fecb
+--- /dev/null
++++ b/include/llvm/IntrinsicsR600.td
+@@ -0,0 +1,35 @@
++//===- IntrinsicsR600.td - Defines R600 intrinsics ---------*- tablegen -*-===//
++//
++// The LLVM Compiler Infrastructure
++//
++// This file is distributed under the University of Illinois Open Source
++// License. See LICENSE.TXT for details.
++//
++//===----------------------------------------------------------------------===//
++//
++// This file defines all of the R600-specific intrinsics.
++//
++//===----------------------------------------------------------------------===//
++//
++// Authors: Tom Stellard <thomas.stellard@amd.com>
++//
++
++let TargetPrefix = "r600" in {
++
++class R600ReadPreloadRegisterIntrinsic<string name>
++ : Intrinsic<[llvm_i32_ty], [], [IntrNoMem]>,
++ GCCBuiltin<name>;
++
++multiclass R600ReadPreloadRegisterIntrinsic_xyz<string prefix> {
++ def _x : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_x")>;
++ def _y : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_y")>;
++ def _z : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_z")>;
++}
++
++defm int_r600_read_ngroups : R600ReadPreloadRegisterIntrinsic_xyz <
++ "__builtin_r600_read_ngroups">;
++defm int_r600_read_tgid : R600ReadPreloadRegisterIntrinsic_xyz <
++ "__builtin_r600_read_tgid">;
++defm int_r600_read_tidig : R600ReadPreloadRegisterIntrinsic_xyz <
++ "__builtin_r600_read_tidig">;
++} // End TargetPrefix = "r600"
+--
+1.7.7.6
+
diff --git a/sys-devel/clang/files/cl-patches/llvm-0002-r600-Add-get_global_size-and-get_local_size-intrinsi.patch b/sys-devel/clang/files/cl-patches/llvm-0002-r600-Add-get_global_size-and-get_local_size-intrinsi.patch
new file mode 100644
index 000000000000..db176dd56a1b
--- /dev/null
+++ b/sys-devel/clang/files/cl-patches/llvm-0002-r600-Add-get_global_size-and-get_local_size-intrinsi.patch
@@ -0,0 +1,27 @@
+From 17667fa3450470f7c89fc2ba4631d908cf510749 Mon Sep 17 00:00:00 2001
+From: Tom Stellard <thomas.stellard@amd.com>
+Date: Wed, 14 Mar 2012 11:19:35 -0400
+Subject: [PATCH 2/2] r600: Add get_global_size and get_local_size intrinsics
+
+---
+ include/llvm/IntrinsicsR600.td | 4 ++++
+ 1 files changed, 4 insertions(+), 0 deletions(-)
+
+diff --git a/include/llvm/IntrinsicsR600.td b/include/llvm/IntrinsicsR600.td
+index 789fecb..0473acb 100644
+--- a/include/llvm/IntrinsicsR600.td
++++ b/include/llvm/IntrinsicsR600.td
+@@ -26,6 +26,10 @@ multiclass R600ReadPreloadRegisterIntrinsic_xyz<string prefix> {
+ def _z : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_z")>;
+ }
+
++defm int_r600_read_global_size : R600ReadPreloadRegisterIntrinsic_xyz <
++ "__builtin_r600_read_global_size">;
++defm int_r600_read_local_size : R600ReadPreloadRegisterIntrinsic_xyz <
++ "__builtin_r600_read_local_size">;
+ defm int_r600_read_ngroups : R600ReadPreloadRegisterIntrinsic_xyz <
+ "__builtin_r600_read_ngroups">;
+ defm int_r600_read_tgid : R600ReadPreloadRegisterIntrinsic_xyz <
+--
+1.7.7.6
+
diff --git a/sys-devel/clang/files/clang-2.7-fixdoc.patch b/sys-devel/clang/files/clang-2.7-fixdoc.patch
new file mode 100644
index 000000000000..8058ec46bd8f
--- /dev/null
+++ b/sys-devel/clang/files/clang-2.7-fixdoc.patch
@@ -0,0 +1,53 @@
+diff -Naur llvm-2.7.orig//tools/clang/docs/Makefile llvm-2.7/tools/clang/docs/Makefile
+--- llvm-2.7.orig//tools/clang/docs/Makefile 2010-04-26 18:38:45.000000000 +0200
++++ llvm-2.7/tools/clang/docs/Makefile 2010-04-26 18:41:08.000000000 +0200
+@@ -46,13 +46,12 @@
+ # 'make generated BUILD_FOR_WEBSITE=1'
+ generated:: doxygen
+
+-install-html: $(PROJ_OBJ_DIR)/html.tar.gz
++install-html:
+ $(Echo) Installing HTML documentation
+ $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html
+ $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html/img
+ $(Verb) $(DataInstall) $(HTML) $(DESTDIR)$(PROJ_docsdir)/html
+ # $(Verb) $(DataInstall) $(IMAGES) $(DESTDIR)$(PROJ_docsdir)/html/img
+- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/html.tar.gz $(DESTDIR)$(PROJ_docsdir)
+
+ $(PROJ_OBJ_DIR)/html.tar.gz: $(HTML)
+ $(Echo) Packaging HTML documentation
+@@ -64,12 +63,11 @@
+ install-doxygen: doxygen
+ $(Echo) Installing doxygen documentation
+ $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html/doxygen
+- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/doxygen.tar.gz $(DESTDIR)$(PROJ_docsdir)
+ $(Verb) cd $(PROJ_OBJ_DIR)/doxygen && \
+ $(FIND) . -type f -exec \
+ $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/html/doxygen \;
+
+-doxygen: regendoc $(PROJ_OBJ_DIR)/doxygen.tar.gz
++doxygen: regendoc
+
+ regendoc:
+ $(Echo) Building doxygen documentation
+diff -Naur llvm-2.7.orig//tools/clang/docs/tools/Makefile llvm-2.7/tools/clang/docs/tools/Makefile
+--- llvm-2.7.orig//tools/clang/docs/tools/Makefile 2010-04-26 18:38:45.000000000 +0200
++++ llvm-2.7/tools/clang/docs/tools/Makefile 2010-04-26 18:41:29.000000000 +0200
+@@ -24,7 +24,7 @@
+ CLANG_VERSION := trunk
+
+ # If we are in BUILD_FOR_WEBSITE mode, default to the all target.
+-all:: html man ps
++all:: html man
+
+ clean:
+ rm -f pod2htm*.*~~ $(HTML) $(MAN) $(PS)
+@@ -58,7 +58,7 @@
+ ifdef ONLY_MAN_DOCS
+ INSTALL_TARGETS := install-man
+ else
+-INSTALL_TARGETS := install-html install-man install-ps
++INSTALL_TARGETS := install-html install-man
+ endif
+
+ .SUFFIXES:
diff --git a/sys-devel/clang/files/clang-2.8-alignof.patch b/sys-devel/clang/files/clang-2.8-alignof.patch
new file mode 100644
index 000000000000..a15f118caee6
--- /dev/null
+++ b/sys-devel/clang/files/clang-2.8-alignof.patch
@@ -0,0 +1,258 @@
+Index: include/llvm/ADT/StringMap.h
+===================================================================
+--- include/llvm/ADT/StringMap.h (révision 117773)
++++ include/llvm/ADT/StringMap.h (révision 117774)
+@@ -167,7 +167,7 @@
+
+ unsigned AllocSize = static_cast<unsigned>(sizeof(StringMapEntry))+
+ KeyLength+1;
+- unsigned Alignment = alignof<StringMapEntry>();
++ unsigned Alignment = alignOf<StringMapEntry>();
+
+ StringMapEntry *NewItem =
+ static_cast<StringMapEntry*>(Allocator.Allocate(AllocSize,Alignment));
+Index: include/llvm/Support/AlignOf.h
+===================================================================
+--- include/llvm/Support/AlignOf.h (révision 117773)
++++ include/llvm/Support/AlignOf.h (révision 117774)
+@@ -49,12 +49,12 @@
+
+ };
+
+-/// alignof - A templated function that returns the mininum alignment of
++/// alignOf - A templated function that returns the mininum alignment of
+ /// of a type. This provides no extra functionality beyond the AlignOf
+ /// class besides some cosmetic cleanliness. Example usage:
+-/// alignof<int>() returns the alignment of an int.
++/// alignOf<int>() returns the alignment of an int.
+ template <typename T>
+-static inline unsigned alignof() { return AlignOf<T>::Alignment; }
++static inline unsigned alignOf() { return AlignOf<T>::Alignment; }
+
+ } // end namespace llvm
+ #endif
+Index: include/llvm/Support/Allocator.h
+===================================================================
+--- include/llvm/Support/Allocator.h (révision 117773)
++++ include/llvm/Support/Allocator.h (révision 117774)
+@@ -201,7 +201,7 @@
+ char *End = Slab == Allocator.CurSlab ? Allocator.CurPtr :
+ (char *)Slab + Slab->Size;
+ for (char *Ptr = (char*)(Slab+1); Ptr < End; Ptr += sizeof(T)) {
+- Ptr = Allocator.AlignPtr(Ptr, alignof<T>());
++ Ptr = Allocator.AlignPtr(Ptr, alignOf<T>());
+ if (Ptr + sizeof(T) <= End)
+ reinterpret_cast<T*>(Ptr)->~T();
+ }
+Index: include/llvm/CodeGen/SlotIndexes.h
+===================================================================
+--- include/llvm/CodeGen/SlotIndexes.h (révision 117773)
++++ include/llvm/CodeGen/SlotIndexes.h (révision 117774)
+@@ -393,7 +393,7 @@
+ IndexListEntry *entry =
+ static_cast<IndexListEntry*>(
+ ileAllocator.Allocate(sizeof(IndexListEntry),
+- alignof<IndexListEntry>()));
++ alignOf<IndexListEntry>()));
+
+ new (entry) IndexListEntry(mi, index);
+
+Index: tools/clang/lib/Basic/IdentifierTable.cpp
+===================================================================
+--- tools/clang/lib/Basic/IdentifierTable.cpp (révision 117774)
++++ tools/clang/lib/Basic/IdentifierTable.cpp (révision 117775)
+@@ -390,7 +390,7 @@
+ unsigned Size = sizeof(MultiKeywordSelector) + nKeys*sizeof(IdentifierInfo *);
+ MultiKeywordSelector *SI =
+ (MultiKeywordSelector*)SelTabImpl.Allocator.Allocate(Size,
+- llvm::alignof<MultiKeywordSelector>());
++ llvm::alignOf<MultiKeywordSelector>());
+ new (SI) MultiKeywordSelector(nKeys, IIV);
+ SelTabImpl.Table.InsertNode(SI, InsertPos);
+ return Selector(SI);
+Index: tools/clang/lib/AST/ExprCXX.cpp
+===================================================================
+--- tools/clang/lib/AST/ExprCXX.cpp (révision 117774)
++++ tools/clang/lib/AST/ExprCXX.cpp (révision 117775)
+@@ -233,7 +233,7 @@
+ if (NumTemplateArgs != 0)
+ size += ExplicitTemplateArgumentList::sizeFor(NumTemplateArgs);
+
+- void *Mem = C.Allocate(size, llvm::alignof<UnresolvedLookupExpr>());
++ void *Mem = C.Allocate(size, llvm::alignOf<UnresolvedLookupExpr>());
+ UnresolvedLookupExpr *E = new (Mem) UnresolvedLookupExpr(EmptyShell());
+ E->HasExplicitTemplateArgs = NumTemplateArgs != 0;
+ return E;
+@@ -261,7 +261,7 @@
+ if (NumResults) {
+ Results = static_cast<DeclAccessPair *>(
+ C.Allocate(sizeof(DeclAccessPair) * NumResults,
+- llvm::alignof<DeclAccessPair>()));
++ llvm::alignOf<DeclAccessPair>()));
+ memcpy(Results, &*Begin.getIterator(),
+ NumResults * sizeof(DeclAccessPair));
+ }
+@@ -737,7 +737,7 @@
+ if (TemplateArgs)
+ size += ExplicitTemplateArgumentList::sizeFor(*TemplateArgs);
+
+- void *Mem = C.Allocate(size, llvm::alignof<CXXDependentScopeMemberExpr>());
++ void *Mem = C.Allocate(size, llvm::alignOf<CXXDependentScopeMemberExpr>());
+ return new (Mem) CXXDependentScopeMemberExpr(C, Base, BaseType,
+ IsArrow, OperatorLoc,
+ Qualifier, QualifierRange,
+@@ -756,7 +756,7 @@
+
+ std::size_t size = sizeof(CXXDependentScopeMemberExpr) +
+ ExplicitTemplateArgumentList::sizeFor(NumTemplateArgs);
+- void *Mem = C.Allocate(size, llvm::alignof<CXXDependentScopeMemberExpr>());
++ void *Mem = C.Allocate(size, llvm::alignOf<CXXDependentScopeMemberExpr>());
+ CXXDependentScopeMemberExpr *E
+ = new (Mem) CXXDependentScopeMemberExpr(C, 0, QualType(),
+ 0, SourceLocation(), 0,
+@@ -812,7 +812,7 @@
+ if (TemplateArgs)
+ size += ExplicitTemplateArgumentList::sizeFor(*TemplateArgs);
+
+- void *Mem = C.Allocate(size, llvm::alignof<UnresolvedMemberExpr>());
++ void *Mem = C.Allocate(size, llvm::alignOf<UnresolvedMemberExpr>());
+ return new (Mem) UnresolvedMemberExpr(C,
+ Dependent ? C.DependentTy : C.OverloadTy,
+ Dependent, HasUnresolvedUsing, Base, BaseType,
+@@ -826,7 +826,7 @@
+ if (NumTemplateArgs != 0)
+ size += ExplicitTemplateArgumentList::sizeFor(NumTemplateArgs);
+
+- void *Mem = C.Allocate(size, llvm::alignof<UnresolvedMemberExpr>());
++ void *Mem = C.Allocate(size, llvm::alignOf<UnresolvedMemberExpr>());
+ UnresolvedMemberExpr *E = new (Mem) UnresolvedMemberExpr(EmptyShell());
+ E->HasExplicitTemplateArgs = NumTemplateArgs != 0;
+ return E;
+Index: tools/clang/lib/AST/DeclObjC.cpp
+===================================================================
+--- tools/clang/lib/AST/DeclObjC.cpp (révision 117774)
++++ tools/clang/lib/AST/DeclObjC.cpp (révision 117775)
+@@ -711,7 +711,7 @@
+ void ObjCClassDecl::setClassList(ASTContext &C, ObjCInterfaceDecl*const*List,
+ const SourceLocation *Locs, unsigned Num) {
+ ForwardDecls = (ObjCClassRef*) C.Allocate(sizeof(ObjCClassRef)*Num,
+- llvm::alignof<ObjCClassRef>());
++ llvm::alignOf<ObjCClassRef>());
+ for (unsigned i = 0; i < Num; ++i)
+ new (&ForwardDecls[i]) ObjCClassRef(List[i], Locs[i]);
+
+Index: tools/clang/lib/AST/Stmt.cpp
+===================================================================
+--- tools/clang/lib/AST/Stmt.cpp (révision 117774)
++++ tools/clang/lib/AST/Stmt.cpp (révision 117775)
+@@ -416,7 +416,7 @@
+ Stmt *atFinallyStmt) {
+ unsigned Size = sizeof(ObjCAtTryStmt) +
+ (1 + NumCatchStmts + (atFinallyStmt != 0)) * sizeof(Stmt *);
+- void *Mem = Context.Allocate(Size, llvm::alignof<ObjCAtTryStmt>());
++ void *Mem = Context.Allocate(Size, llvm::alignOf<ObjCAtTryStmt>());
+ return new (Mem) ObjCAtTryStmt(atTryLoc, atTryStmt, CatchStmts, NumCatchStmts,
+ atFinallyStmt);
+ }
+@@ -426,7 +426,7 @@
+ bool HasFinally) {
+ unsigned Size = sizeof(ObjCAtTryStmt) +
+ (1 + NumCatchStmts + HasFinally) * sizeof(Stmt *);
+- void *Mem = Context.Allocate(Size, llvm::alignof<ObjCAtTryStmt>());
++ void *Mem = Context.Allocate(Size, llvm::alignOf<ObjCAtTryStmt>());
+ return new (Mem) ObjCAtTryStmt(EmptyShell(), NumCatchStmts, HasFinally);
+ }
+
+@@ -448,7 +448,7 @@
+ std::size_t Size = sizeof(CXXTryStmt);
+ Size += ((numHandlers + 1) * sizeof(Stmt));
+
+- void *Mem = C.Allocate(Size, llvm::alignof<CXXTryStmt>());
++ void *Mem = C.Allocate(Size, llvm::alignOf<CXXTryStmt>());
+ return new (Mem) CXXTryStmt(tryLoc, tryBlock, handlers, numHandlers);
+ }
+
+@@ -457,7 +457,7 @@
+ std::size_t Size = sizeof(CXXTryStmt);
+ Size += ((numHandlers + 1) * sizeof(Stmt));
+
+- void *Mem = C.Allocate(Size, llvm::alignof<CXXTryStmt>());
++ void *Mem = C.Allocate(Size, llvm::alignOf<CXXTryStmt>());
+ return new (Mem) CXXTryStmt(Empty, numHandlers);
+ }
+
+Index: tools/clang/lib/AST/Expr.cpp
+===================================================================
+--- tools/clang/lib/AST/Expr.cpp (révision 117774)
++++ tools/clang/lib/AST/Expr.cpp (révision 117775)
+@@ -257,7 +257,7 @@
+ if (TemplateArgs)
+ Size += ExplicitTemplateArgumentList::sizeFor(*TemplateArgs);
+
+- void *Mem = Context.Allocate(Size, llvm::alignof<DeclRefExpr>());
++ void *Mem = Context.Allocate(Size, llvm::alignOf<DeclRefExpr>());
+ return new (Mem) DeclRefExpr(Qualifier, QualifierRange, D, NameInfo,
+ TemplateArgs, T);
+ }
+@@ -271,7 +271,7 @@
+ if (NumTemplateArgs)
+ Size += ExplicitTemplateArgumentList::sizeFor(NumTemplateArgs);
+
+- void *Mem = Context.Allocate(Size, llvm::alignof<DeclRefExpr>());
++ void *Mem = Context.Allocate(Size, llvm::alignOf<DeclRefExpr>());
+ return new (Mem) DeclRefExpr(EmptyShell());
+ }
+
+@@ -432,7 +432,7 @@
+ // any concatenated string tokens.
+ void *Mem = C.Allocate(sizeof(StringLiteral)+
+ sizeof(SourceLocation)*(NumStrs-1),
+- llvm::alignof<StringLiteral>());
++ llvm::alignOf<StringLiteral>());
+ StringLiteral *SL = new (Mem) StringLiteral(Ty);
+
+ // OPTIMIZE: could allocate this appended to the StringLiteral.
+@@ -452,7 +452,7 @@
+ StringLiteral *StringLiteral::CreateEmpty(ASTContext &C, unsigned NumStrs) {
+ void *Mem = C.Allocate(sizeof(StringLiteral)+
+ sizeof(SourceLocation)*(NumStrs-1),
+- llvm::alignof<StringLiteral>());
++ llvm::alignOf<StringLiteral>());
+ StringLiteral *SL = new (Mem) StringLiteral(QualType());
+ SL->StrData = 0;
+ SL->ByteLength = 0;
+@@ -714,7 +714,7 @@
+ if (targs)
+ Size += ExplicitTemplateArgumentList::sizeFor(*targs);
+
+- void *Mem = C.Allocate(Size, llvm::alignof<MemberExpr>());
++ void *Mem = C.Allocate(Size, llvm::alignOf<MemberExpr>());
+ MemberExpr *E = new (Mem) MemberExpr(base, isarrow, memberdecl, nameinfo, ty);
+
+ if (hasQualOrFound) {
+Index: tools/clang/lib/AST/DeclCXX.cpp
+===================================================================
+--- tools/clang/lib/AST/DeclCXX.cpp (révision 117774)
++++ tools/clang/lib/AST/DeclCXX.cpp (révision 117775)
+@@ -1057,7 +1057,7 @@
+ unsigned NumIndices) {
+ void *Mem = Context.Allocate(sizeof(CXXBaseOrMemberInitializer) +
+ sizeof(VarDecl *) * NumIndices,
+- llvm::alignof<CXXBaseOrMemberInitializer>());
++ llvm::alignOf<CXXBaseOrMemberInitializer>());
+ return new (Mem) CXXBaseOrMemberInitializer(Context, Member, MemberLoc,
+ L, Init, R, Indices, NumIndices);
+ }
+Index: tools/clang/lib/Lex/TokenLexer.cpp
+===================================================================
+--- tools/clang/lib/Lex/TokenLexer.cpp (révision 117774)
++++ tools/clang/lib/Lex/TokenLexer.cpp (révision 117775)
+@@ -287,7 +287,7 @@
+ llvm::BumpPtrAllocator &Alloc = PP.getPreprocessorAllocator();
+ Token *Res =
+ static_cast<Token *>(Alloc.Allocate(sizeof(Token)*ResultToks.size(),
+- llvm::alignof<Token>()));
++ llvm::alignOf<Token>()));
+ if (NumTokens)
+ memcpy(Res, &ResultToks[0], NumTokens*sizeof(Token));
+ Tokens = Res;
diff --git a/sys-devel/clang/files/clang-2.8-darwin-prefix.patch b/sys-devel/clang/files/clang-2.8-darwin-prefix.patch
new file mode 100644
index 000000000000..555b8ee0bcc9
--- /dev/null
+++ b/sys-devel/clang/files/clang-2.8-darwin-prefix.patch
@@ -0,0 +1,127 @@
+This code looks as if it is written by Apple, lots of assumptions that
+only hold for them and their scenario.
+
+--- tools/clang/lib/Driver/ToolChains.cpp
++++ tools/clang/lib/Driver/ToolChains.cpp
+@@ -131,7 +131,7 @@
+ GCCVersion[2] = 1;
+
+ // Set up the tool chain paths to match gcc.
+- ToolChainDir = "i686-apple-darwin";
++ ToolChainDir = "@GENTOO_PORTAGE_CHOST@";
+ ToolChainDir += llvm::utostr(DarwinVersion[0]);
+ ToolChainDir += "/";
+ ToolChainDir += llvm::utostr(GCCVersion[0]);
+@@ -141,9 +141,9 @@
+ ToolChainDir += llvm::utostr(GCCVersion[2]);
+
+ // Try the next major version if that tool chain dir is invalid.
+- std::string Tmp = "/usr/lib/gcc/" + ToolChainDir;
++ std::string Tmp = "@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/" + ToolChainDir;
+ if (!llvm::sys::Path(Tmp).exists()) {
+- std::string Next = "i686-apple-darwin";
++ std::string Next = "@GENTOO_PORTAGE_CHOST_ARCH@";
+ Next += llvm::utostr(DarwinVersion[0] + 1);
+ Next += "/";
+ Next += llvm::utostr(GCCVersion[0]);
+@@ -155,7 +155,7 @@
+ // Use that if it exists, otherwise hope the user isn't linking.
+ //
+ // FIXME: Drop dependency on gcc's tool chain.
+- Tmp = "/usr/lib/gcc/" + Next;
++ Tmp = "@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/" + Next;
+ if (llvm::sys::Path(Tmp).exists())
+ ToolChainDir = Next;
+ }
+@@ -168,7 +168,7 @@
+ Path += "/x86_64";
+ getFilePaths().push_back(Path);
+
+- Path = "/usr/lib/gcc/";
++ Path = "@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/";
+ Path += ToolChainDir;
+ Path += "/x86_64";
+ getFilePaths().push_back(Path);
+@@ -179,7 +179,7 @@
+ Path += ToolChainDir;
+ getFilePaths().push_back(Path);
+
+- Path = "/usr/lib/gcc/";
++ Path = "@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/";
+ Path += ToolChainDir;
+ getFilePaths().push_back(Path);
+
+@@ -188,7 +188,7 @@
+ Path += ToolChainDir;
+ getProgramPaths().push_back(Path);
+
+- Path = "/usr/libexec/gcc/";
++ Path = "@GENTOO_PORTAGE_EPREFIX@/usr/libexec/gcc/";
+ Path += ToolChainDir;
+ getProgramPaths().push_back(Path);
+
+@@ -291,14 +291,14 @@
+
+ // FIXME: Derive these correctly.
+ if (getArchName() == "x86_64") {
+- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir +
++ CmdArgs.push_back(Args.MakeArgString("-L@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/" + ToolChainDir +
+ "/x86_64"));
+ // Intentionally duplicated for (temporary) gcc bug compatibility.
+- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir +
++ CmdArgs.push_back(Args.MakeArgString("-L@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/" + ToolChainDir +
+ "/x86_64"));
+ }
+
+- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/" + ToolChainDir));
++ CmdArgs.push_back(Args.MakeArgString("-L@GENTOO_PORTAGE_EPREFIX@/usr/lib/" + ToolChainDir));
+
+ Tmp = getDriver().Dir + "/../lib/gcc/" + ToolChainDir;
+ if (llvm::sys::Path(Tmp).exists())
+@@ -306,18 +306,18 @@
+ Tmp = getDriver().Dir + "/../lib/gcc";
+ if (llvm::sys::Path(Tmp).exists())
+ CmdArgs.push_back(Args.MakeArgString("-L" + Tmp));
+- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir));
++ CmdArgs.push_back(Args.MakeArgString("-L@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/" + ToolChainDir));
+ // Intentionally duplicated for (temporary) gcc bug compatibility.
+- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir));
++ CmdArgs.push_back(Args.MakeArgString("-L@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/" + ToolChainDir));
+ Tmp = getDriver().Dir + "/../lib/" + ToolChainDir;
+ if (llvm::sys::Path(Tmp).exists())
+ CmdArgs.push_back(Args.MakeArgString("-L" + Tmp));
+ Tmp = getDriver().Dir + "/../lib";
+ if (llvm::sys::Path(Tmp).exists())
+ CmdArgs.push_back(Args.MakeArgString("-L" + Tmp));
+- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir +
++ CmdArgs.push_back(Args.MakeArgString("-L@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/" + ToolChainDir +
+ "/../../../" + ToolChainDir));
+- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir +
++ CmdArgs.push_back(Args.MakeArgString("-L@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/" + ToolChainDir +
+ "/../../.."));
+ }
+
+@@ -386,22 +386,7 @@
+ P.eraseComponent(); // .../usr/bin -> ../usr
+ P.appendComponent("lib");
+ P.appendComponent("gcc");
+- switch (getTriple().getArch()) {
+- default:
+- assert(0 && "Invalid Darwin arch!");
+- case llvm::Triple::x86:
+- case llvm::Triple::x86_64:
+- P.appendComponent("i686-apple-darwin10");
+- break;
+- case llvm::Triple::arm:
+- case llvm::Triple::thumb:
+- P.appendComponent("arm-apple-darwin10");
+- break;
+- case llvm::Triple::ppc:
+- case llvm::Triple::ppc64:
+- P.appendComponent("powerpc-apple-darwin10");
+- break;
+- }
++ P.appendComponent("@GENTOO_PORTAGE_CHOST@");
+ P.appendComponent("4.2.1");
+
+ // Determine the arch specific GCC subdirectory.
diff --git a/sys-devel/clang/files/clang-2.8-gcc-4.4.4.patch b/sys-devel/clang/files/clang-2.8-gcc-4.4.4.patch
new file mode 100644
index 000000000000..f60d051e9d49
--- /dev/null
+++ b/sys-devel/clang/files/clang-2.8-gcc-4.4.4.patch
@@ -0,0 +1,16 @@
+Index: tools/clang/lib/Frontend/InitHeaderSearch.cpp
+===================================================================
+--- tools/clang/lib/Frontend/InitHeaderSearch.cpp (révision 119347)
++++ tools/clang/lib/Frontend/InitHeaderSearch.cpp (révision 119348)
+@@ -745,6 +745,11 @@
+ "/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.3/include/g++-v4",
+ "x86_64-pc-linux-gnu", "32", "", triple);
+
++ // Gentoo amd64 gcc 4.4.4
++ AddGnuCPlusPlusIncludePaths(
++ "/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.4/include/g++-v4",
++ "x86_64-pc-linux-gnu", "32", "", triple);
++
+ // Gentoo amd64 llvm-gcc trunk
+ AddGnuCPlusPlusIncludePaths(
+ "/usr/lib/llvm-gcc-4.2-9999/include/c++/4.2.1",
diff --git a/sys-devel/clang/files/clang-2.9-darwin-prefix.patch b/sys-devel/clang/files/clang-2.9-darwin-prefix.patch
new file mode 100644
index 000000000000..8f79e7f6f24e
--- /dev/null
+++ b/sys-devel/clang/files/clang-2.9-darwin-prefix.patch
@@ -0,0 +1,125 @@
+--- tools/clang/lib/Driver/ToolChains.cpp.orig 2011-03-21 22:29:27.000000000 +0100
++++ tools/clang/lib/Driver/ToolChains.cpp 2011-04-07 10:33:41.771314057 +0200
+@@ -139,7 +139,7 @@
+ GCCVersion[2] = 1;
+
+ // Set up the tool chain paths to match gcc.
+- ToolChainDir = "i686-apple-darwin";
++ ToolChainDir = "@GENTOO_PORTAGE_CHOST@";
+ ToolChainDir += llvm::utostr(DarwinVersion[0]);
+ ToolChainDir += "/";
+ ToolChainDir += llvm::utostr(GCCVersion[0]);
+@@ -149,10 +149,10 @@
+ ToolChainDir += llvm::utostr(GCCVersion[2]);
+
+ // Try the next major version if that tool chain dir is invalid.
+- std::string Tmp = "/usr/lib/gcc/" + ToolChainDir;
++ std::string Tmp = "@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/" + ToolChainDir;
+ bool Exists;
+ if (llvm::sys::fs::exists(Tmp, Exists) || Exists) {
+- std::string Next = "i686-apple-darwin";
++ std::string Next = "@GENTOO_PORTAGE_CHOST_ARCH@";
+ Next += llvm::utostr(DarwinVersion[0] + 1);
+ Next += "/";
+ Next += llvm::utostr(GCCVersion[0]);
+@@ -164,7 +164,7 @@
+ // Use that if it exists, otherwise hope the user isn't linking.
+ //
+ // FIXME: Drop dependency on gcc's tool chain.
+- Tmp = "/usr/lib/gcc/" + Next;
++ Tmp = "@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/" + Next;
+ if (!llvm::sys::fs::exists(Tmp, Exists) && Exists)
+ ToolChainDir = Next;
+ }
+@@ -177,7 +177,7 @@
+ Path += "/x86_64";
+ getFilePaths().push_back(Path);
+
+- Path = "/usr/lib/gcc/";
++ Path = "@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/";
+ Path += ToolChainDir;
+ Path += "/x86_64";
+ getFilePaths().push_back(Path);
+@@ -188,7 +188,7 @@
+ Path += ToolChainDir;
+ getFilePaths().push_back(Path);
+
+- Path = "/usr/lib/gcc/";
++ Path = "@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/";
+ Path += ToolChainDir;
+ getFilePaths().push_back(Path);
+
+@@ -197,7 +197,7 @@
+ Path += ToolChainDir;
+ getProgramPaths().push_back(Path);
+
+- Path = "/usr/libexec/gcc/";
++ Path = "@GENTOO_PORTAGE_EPREFIX@/usr/libexec/gcc/";
+ Path += ToolChainDir;
+ getProgramPaths().push_back(Path);
+
+@@ -300,14 +300,14 @@
+
+ // FIXME: Derive these correctly.
+ if (getArchName() == "x86_64") {
+- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir +
++ CmdArgs.push_back(Args.MakeArgString("-L@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/" + ToolChainDir +
+ "/x86_64"));
+ // Intentionally duplicated for (temporary) gcc bug compatibility.
+- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir +
++ CmdArgs.push_back(Args.MakeArgString("-L@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/" + ToolChainDir +
+ "/x86_64"));
+ }
+
+- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/" + ToolChainDir));
++ CmdArgs.push_back(Args.MakeArgString("-L@GENTOO_PORTAGE_EPREFIX@/usr/lib/" + ToolChainDir));
+
+ Tmp = getDriver().Dir + "/../lib/gcc/" + ToolChainDir;
+ bool Exists;
+@@ -316,18 +316,18 @@
+ Tmp = getDriver().Dir + "/../lib/gcc";
+ if (!llvm::sys::fs::exists(Tmp, Exists) && Exists)
+ CmdArgs.push_back(Args.MakeArgString("-L" + Tmp));
+- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir));
++ CmdArgs.push_back(Args.MakeArgString("-L@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/" + ToolChainDir));
+ // Intentionally duplicated for (temporary) gcc bug compatibility.
+- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir));
++ CmdArgs.push_back(Args.MakeArgString("-L@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/" + ToolChainDir));
+ Tmp = getDriver().Dir + "/../lib/" + ToolChainDir;
+ if (!llvm::sys::fs::exists(Tmp, Exists) && Exists)
+ CmdArgs.push_back(Args.MakeArgString("-L" + Tmp));
+ Tmp = getDriver().Dir + "/../lib";
+ if (!llvm::sys::fs::exists(Tmp, Exists) && Exists)
+ CmdArgs.push_back(Args.MakeArgString("-L" + Tmp));
+- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir +
++ CmdArgs.push_back(Args.MakeArgString("-L@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/" + ToolChainDir +
+ "/../../../" + ToolChainDir));
+- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir +
++ CmdArgs.push_back(Args.MakeArgString("-L@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/" + ToolChainDir +
+ "/../../.."));
+ }
+
+@@ -416,22 +416,7 @@
+ P.eraseComponent(); // .../usr/bin -> ../usr
+ P.appendComponent("lib");
+ P.appendComponent("gcc");
+- switch (getTriple().getArch()) {
+- default:
+- assert(0 && "Invalid Darwin arch!");
+- case llvm::Triple::x86:
+- case llvm::Triple::x86_64:
+- P.appendComponent("i686-apple-darwin10");
+- break;
+- case llvm::Triple::arm:
+- case llvm::Triple::thumb:
+- P.appendComponent("arm-apple-darwin10");
+- break;
+- case llvm::Triple::ppc:
+- case llvm::Triple::ppc64:
+- P.appendComponent("powerpc-apple-darwin10");
+- break;
+- }
++ P.appendComponent("@GENTOO_PORTAGE_CHOST@");
+ P.appendComponent("4.2.1");
+
+ // Determine the arch specific GCC subdirectory.
diff --git a/sys-devel/clang/files/clang-2.9-gccversions.patch b/sys-devel/clang/files/clang-2.9-gccversions.patch
new file mode 100644
index 000000000000..775a9e6b425b
--- /dev/null
+++ b/sys-devel/clang/files/clang-2.9-gccversions.patch
@@ -0,0 +1,12 @@
+--- a/llvm-2.9/tools/clang/lib/Driver/ToolChains.cpp 2011-08-10 15:05:32.969155113 -0400
++++ a/llvm-2.9/tools/clang/lib/Driver/ToolChains.cpp 2011-08-10 15:06:45.449159147 -0400
+@@ -1449,7 +1449,8 @@
+ GccTriple = "i586-suse-linux";
+ }
+
+- const char* GccVersions[] = {"4.5.2", "4.5.1", "4.5", "4.4.5", "4.4.4",
++ const char* GccVersions[] = {"4.6.2", "4.6.1", "4.6", "4.5.3", "4.5.2",
++ "4.5.1", "4.5", "4.4.6", "4.4.5", "4.4.4",
+ "4.4.3", "4.4", "4.3.4", "4.3.3", "4.3.2",
+ "4.3", "4.2.4", "4.2.3", "4.2.2", "4.2.1",
+ "4.2"};
diff --git a/sys-devel/clang/files/clang-3.0-fix_cxx_include_root.patch b/sys-devel/clang/files/clang-3.0-fix_cxx_include_root.patch
new file mode 100644
index 000000000000..e1beff3f1615
--- /dev/null
+++ b/sys-devel/clang/files/clang-3.0-fix_cxx_include_root.patch
@@ -0,0 +1,21 @@
+Bug #387309
+
+--- llvm/tools/clang/lib/Driver/ToolChains.cpp.orig 2011-11-09 23:10:04.000000000 +0100
++++ llvm/tools/clang/lib/Driver/ToolChains.cpp 2011-11-09 23:11:04.000000000 +0100
+@@ -1586,12 +1586,13 @@
+ // This is of the form /foo/bar/include/c++/4.5.2/
+ if (CxxIncludeRoot.back() == '/')
+ llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the /
++ llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the g++-v4
++ llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the include
+ StringRef Version = llvm::sys::path::filename(CxxIncludeRoot);
+ llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the version
+- llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the c++
+- llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the include
++ llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the ARCH
+ GccInstallPath = CxxIncludeRoot.str();
+- GccInstallPath.append("/lib/gcc/");
++ GccInstallPath.append("/");
+ GccInstallPath.append(CXX_INCLUDE_ARCH);
+ GccInstallPath.append("/");
+ GccInstallPath.append(Version);
diff --git a/sys-devel/clang/files/clang-3.0-freebsd-runtime-gcc-detection.patch b/sys-devel/clang/files/clang-3.0-freebsd-runtime-gcc-detection.patch
new file mode 100644
index 000000000000..5c016f551c11
--- /dev/null
+++ b/sys-devel/clang/files/clang-3.0-freebsd-runtime-gcc-detection.patch
@@ -0,0 +1,20 @@
+diff -upNr a/llvm-3.0.src/tools/clang/lib/Driver/ToolChains.cpp b/llvm-3.0.src/tools/clang/lib/Driver/ToolChains.cpp
+--- a/llvm-3.0.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-23 15:45:01.333127000 -0400
++++ b/llvm-3.0.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-23 16:16:26.023642076 -0400
+@@ -1215,6 +1215,16 @@ FreeBSD::FreeBSD(const HostInfo &Host, c
+ } else {
+ getFilePaths().push_back("/usr/lib");
+ }
++
++ llvm::OwningPtr<llvm::MemoryBuffer> File;
++ if (!llvm::MemoryBuffer::getFile("/etc/env.d/gcc/config-" + getDriver().DefaultHostTriple, File))
++ {
++ bool Exists;
++ StringRef Version = File.get()->getBuffer().rsplit('-').second.substr(0,5);
++ const std::string GentooPath = "/usr/lib/gcc/" + getDriver().DefaultHostTriple + "/" + Version.str();
++ if (!llvm::sys::fs::exists(GentooPath + "/crtbegin.o", Exists) && Exists)
++ getFilePaths().push_back(GentooPath);
++ }
+ }
+
+ Tool &FreeBSD::SelectTool(const Compilation &C, const JobAction &JA,
diff --git a/sys-devel/clang/files/clang-3.0-gentoo-binutils-apple.patch b/sys-devel/clang/files/clang-3.0-gentoo-binutils-apple.patch
new file mode 100644
index 000000000000..944ccaf4fa20
--- /dev/null
+++ b/sys-devel/clang/files/clang-3.0-gentoo-binutils-apple.patch
@@ -0,0 +1,29 @@
+http://llvm.org/bugs/show_bug.cgi?id=8339
+https://bugs.gentoo.org/show_bug.cgi?id=395013
+http://llvm.org/viewvc/llvm-project?view=rev&revision=151612
+
+Tweak version detection bit to cope with Gentoo's slightly different
+output for ld -v.
+
+--- autoconf/m4/link_options.m4
++++ autoconf/m4/link_options.m4
+@@ -10,7 +10,7 @@
+
+ # Check for ld64.
+ if (echo "$version_string" | grep -q "ld64"); then
+- llvm_cv_link_version=$(echo "$version_string" | sed -e "s#.*ld64-\([^ ]*\)#\1#")
++ llvm_cv_link_version=$(echo "$version_string" | sed -e "s#.*ld64-\([^ ]*\)\( (.*)\)\?#\1#")
+ else
+ llvm_cv_link_version=$(echo "$version_string" | sed -e "s#[^0-9]*\([0-9.]*\).*#\1#")
+ fi
+--- configure
++++ configure
+@@ -7528,7 +7528,7 @@
+
+ # Check for ld64.
+ if (echo "$version_string" | grep -q "ld64"); then
+- llvm_cv_link_version=$(echo "$version_string" | sed -e "s#.*ld64-\([^ ]*\)#\1#")
++ llvm_cv_link_version=$(echo "$version_string" | sed -e "s#.*ld64-\([^ ]*\)\( (.*)\)\?#\1#")
+ else
+ llvm_cv_link_version=$(echo "$version_string" | sed -e "s#[^0-9]*\([0-9.]*\).*#\1#")
+ fi
diff --git a/sys-devel/clang/files/clang-3.0-linux-runtime-gcc-detection.patch b/sys-devel/clang/files/clang-3.0-linux-runtime-gcc-detection.patch
new file mode 100644
index 000000000000..a1f7ce2a98fb
--- /dev/null
+++ b/sys-devel/clang/files/clang-3.0-linux-runtime-gcc-detection.patch
@@ -0,0 +1,43 @@
+diff -upNr a/llvm-3.0.src/tools/clang/lib/Driver/ToolChains.cpp b/llvm-3.0.src/tools/clang/lib/Driver/ToolChains.cpp
+--- a/llvm-3.0.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-23 15:39:01.070411000 -0400
++++ b/llvm-3.0.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-23 15:39:22.371785000 -0400
+@@ -1382,6 +1382,7 @@ enum LinuxDistro {
+ DebianSqueeze,
+ DebianWheezy,
+ Exherbo,
++ Gentoo,
+ RHEL4,
+ RHEL5,
+ RHEL6,
+@@ -1403,6 +1404,10 @@ enum LinuxDistro {
+ UnknownDistro
+ };
+
++static bool IsGentoo(enum LinuxDistro Distro) {
++ return Distro == Gentoo;
++}
++
+ static bool IsRedhat(enum LinuxDistro Distro) {
+ return Distro == Fedora13 || Distro == Fedora14 ||
+ Distro == Fedora15 || Distro == FedoraRawhide ||
+@@ -1433,7 +1438,9 @@ static LinuxDistro DetectLinuxDistro(llv
+ SmallVector<StringRef, 8> Lines;
+ Data.split(Lines, "\n");
+ for (unsigned int i = 0, s = Lines.size(); i < s; ++ i) {
+- if (Lines[i] == "DISTRIB_CODENAME=hardy")
++ if (Lines[i] == "DISTRIB_ID=\"Gentoo\"")
++ return Gentoo;
++ else if (Lines[i] == "DISTRIB_CODENAME=hardy")
+ return UbuntuHardy;
+ else if (Lines[i] == "DISTRIB_CODENAME=intrepid")
+ return UbuntuIntrepid;
+@@ -1597,6 +1604,9 @@ Linux::GCCInstallationDetector::GCCInsta
+ GccInstallPath.append("/");
+ GccInstallPath.append(CXX_INCLUDE_ARCH);
+ GccInstallPath.append("/");
++ llvm::OwningPtr<llvm::MemoryBuffer> File;
++ if (!llvm::MemoryBuffer::getFile("/etc/env.d/gcc/config-" + D.DefaultHostTriple, File))
++ Version = File.get()->getBuffer().rsplit('-').second.substr(0,5);
+ GccInstallPath.append(Version);
+ GccParentLibPath = GccInstallPath + "/../../..";
+ IsValid = true;
diff --git a/sys-devel/clang/files/clang-3.0-recognize-amd-k10-enable-sse4a.patch b/sys-devel/clang/files/clang-3.0-recognize-amd-k10-enable-sse4a.patch
new file mode 100644
index 000000000000..90f99abc344a
--- /dev/null
+++ b/sys-devel/clang/files/clang-3.0-recognize-amd-k10-enable-sse4a.patch
@@ -0,0 +1,82 @@
+--- llvm.orig/contrib/llvm/tools/clang/lib/Basic/Targets.cpp 2011/10/22 14:08:43 226633
++++ llvm/contrib/llvm/tools/clang/lib/Basic/Targets.cpp 2011/10/30 22:20:17 226951
+@@ -1282,6 +1282,7 @@
+ CK_K8SSE3,
+ CK_Opteron,
+ CK_OpteronSSE3,
++ CK_AMDFAM10,
+
+ /// This specification is deprecated and will be removed in the future.
+ /// Users should prefer \see CK_K8.
+@@ -1381,6 +1382,7 @@
+ .Case("k8-sse3", CK_K8SSE3)
+ .Case("opteron", CK_Opteron)
+ .Case("opteron-sse3", CK_OpteronSSE3)
++ .Case("amdfam10", CK_AMDFAM10)
+ .Case("x86-64", CK_x86_64)
+ .Case("geode", CK_Geode)
+ .Default(CK_Generic);
+@@ -1441,6 +1443,7 @@
+ case CK_K8SSE3:
+ case CK_Opteron:
+ case CK_OpteronSSE3:
++ case CK_AMDFAM10:
+ case CK_x86_64:
+ return true;
+ }
+@@ -1459,12 +1462,10 @@
+ Features["ssse3"] = false;
+ Features["sse41"] = false;
+ Features["sse42"] = false;
++ Features["sse4a"] = false;
+ Features["aes"] = false;
+ Features["avx"] = false;
+
+- // LLVM does not currently recognize this.
+- // Features["sse4a"] = false;
+-
+ // FIXME: This *really* should not be here.
+
+ // X86_64 always has SSE2.
+@@ -1561,6 +1562,11 @@
+ setFeatureEnabled(Features, "sse3", true);
+ setFeatureEnabled(Features, "3dnowa", true);
+ break;
++ case CK_AMDFAM10:
++ setFeatureEnabled(Features, "sse3", true);
++ setFeatureEnabled(Features, "sse4a", true);
++ setFeatureEnabled(Features, "3dnowa", true);
++ break;
+ case CK_C3_2:
+ setFeatureEnabled(Features, "mmx", true);
+ setFeatureEnabled(Features, "sse", true);
+@@ -1604,6 +1610,8 @@
+ else if (Name == "avx")
+ Features["avx"] = Features["sse"] = Features["sse2"] = Features["sse3"] =
+ Features["ssse3"] = Features["sse41"] = Features["sse42"] = true;
++ else if (Name == "sse4a")
++ Features["sse4a"] = true;
+ } else {
+ if (Name == "mmx")
+ Features["mmx"] = Features["3dnow"] = Features["3dnowa"] = false;
+@@ -1630,6 +1638,8 @@
+ Features["aes"] = false;
+ else if (Name == "avx")
+ Features["avx"] = false;
++ else if (Name == "sse4a")
++ Features["sse4a"] = false;
+ }
+
+ return true;
+@@ -1826,6 +1836,11 @@
+ Builder.defineMacro("__k8__");
+ Builder.defineMacro("__tune_k8__");
+ break;
++ case CK_AMDFAM10:
++ Builder.defineMacro("__amdfam10");
++ Builder.defineMacro("__amdfam10__");
++ Builder.defineMacro("__tune_amdfam10__");
++ break;
+ case CK_Geode:
+ Builder.defineMacro("__geode");
+ Builder.defineMacro("__geode__");
diff --git a/sys-devel/clang/files/clang-3.1-gentoo-freebsd-fix-cxx-paths-v2.patch b/sys-devel/clang/files/clang-3.1-gentoo-freebsd-fix-cxx-paths-v2.patch
new file mode 100644
index 000000000000..1053bf3642bc
--- /dev/null
+++ b/sys-devel/clang/files/clang-3.1-gentoo-freebsd-fix-cxx-paths-v2.patch
@@ -0,0 +1,188 @@
+diff --git a/a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp b/b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp
+index 1e282f2..1d6835b 100644
+--- a/a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp
++++ b/b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp
+@@ -2305,6 +2305,162 @@ void Linux::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
+ }
+ }
+
++void FreeBSD::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
++ ArgStringList &CC1Args) const {
++ const Driver &D = getDriver();
++
++ if (DriverArgs.hasArg(options::OPT_nostdinc))
++ return;
++
++ if (!DriverArgs.hasArg(options::OPT_nostdlibinc))
++ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/usr/local/include");
++
++ if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
++ llvm::sys::Path P(D.ResourceDir);
++ P.appendComponent("include");
++ addSystemInclude(DriverArgs, CC1Args, P.str());
++ }
++
++ if (DriverArgs.hasArg(options::OPT_nostdlibinc))
++ return;
++
++ // Check for configure-time C include directories.
++ StringRef CIncludeDirs(C_INCLUDE_DIRS);
++ if (CIncludeDirs != "") {
++ SmallVector<StringRef, 5> dirs;
++ CIncludeDirs.split(dirs, ":");
++ for (SmallVectorImpl<StringRef>::iterator I = dirs.begin(), E = dirs.end();
++ I != E; ++I) {
++ StringRef Prefix = llvm::sys::path::is_absolute(*I) ? D.SysRoot : "";
++ addExternCSystemInclude(DriverArgs, CC1Args, Prefix + *I);
++ }
++ return;
++ }
++
++ // Lacking those, try to detect the correct set of system includes for the
++ // target triple.
++
++ // Implement generic Debian multiarch support.
++ const StringRef X86_64MultiarchIncludeDirs[] = {
++ "/usr/include/x86_64-linux-gnu",
++
++ // FIXME: These are older forms of multiarch. It's not clear that they're
++ // in use in any released version of Debian, so we should consider
++ // removing them.
++ "/usr/include/i686-linux-gnu/64",
++ "/usr/include/i486-linux-gnu/64"
++ };
++ const StringRef X86MultiarchIncludeDirs[] = {
++ "/usr/include/i386-linux-gnu",
++
++ // FIXME: These are older forms of multiarch. It's not clear that they're
++ // in use in any released version of Debian, so we should consider
++ // removing them.
++ "/usr/include/x86_64-linux-gnu/32",
++ "/usr/include/i686-linux-gnu",
++ "/usr/include/i486-linux-gnu"
++ };
++ const StringRef ARMMultiarchIncludeDirs[] = {
++ "/usr/include/arm-linux-gnueabi"
++ };
++ const StringRef MIPSMultiarchIncludeDirs[] = {
++ "/usr/include/mips-linux-gnu"
++ };
++ const StringRef MIPSELMultiarchIncludeDirs[] = {
++ "/usr/include/mipsel-linux-gnu"
++ };
++ const StringRef PPCMultiarchIncludeDirs[] = {
++ "/usr/include/powerpc-linux-gnu"
++ };
++ const StringRef PPC64MultiarchIncludeDirs[] = {
++ "/usr/include/powerpc64-linux-gnu"
++ };
++ ArrayRef<StringRef> MultiarchIncludeDirs;
++ if (getTriple().getArch() == llvm::Triple::x86_64) {
++ MultiarchIncludeDirs = X86_64MultiarchIncludeDirs;
++ } else if (getTriple().getArch() == llvm::Triple::x86) {
++ MultiarchIncludeDirs = X86MultiarchIncludeDirs;
++ } else if (getTriple().getArch() == llvm::Triple::arm) {
++ MultiarchIncludeDirs = ARMMultiarchIncludeDirs;
++ } else if (getTriple().getArch() == llvm::Triple::mips) {
++ MultiarchIncludeDirs = MIPSMultiarchIncludeDirs;
++ } else if (getTriple().getArch() == llvm::Triple::mipsel) {
++ MultiarchIncludeDirs = MIPSELMultiarchIncludeDirs;
++ } else if (getTriple().getArch() == llvm::Triple::ppc) {
++ MultiarchIncludeDirs = PPCMultiarchIncludeDirs;
++ } else if (getTriple().getArch() == llvm::Triple::ppc64) {
++ MultiarchIncludeDirs = PPC64MultiarchIncludeDirs;
++ }
++ for (ArrayRef<StringRef>::iterator I = MultiarchIncludeDirs.begin(),
++ E = MultiarchIncludeDirs.end();
++ I != E; ++I) {
++ if (llvm::sys::fs::exists(D.SysRoot + *I)) {
++ addExternCSystemInclude(DriverArgs, CC1Args, D.SysRoot + *I);
++ break;
++ }
++ }
++
++ if (getTriple().getOS() == llvm::Triple::RTEMS)
++ return;
++
++ // Add an include of '/include' directly. This isn't provided by default by
++ // system GCCs, but is often used with cross-compiling GCCs, and harmless to
++ // add even when Clang is acting as-if it were a system compiler.
++ addExternCSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/include");
++
++ addExternCSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/usr/include");
++}
++
++/// \brief Helper to add the thre variant paths for a libstdc++ installation.
++/*static*/ bool FreeBSD::addLibStdCXXIncludePaths(Twine Base, Twine TargetArchDir,
++ const ArgList &DriverArgs,
++ ArgStringList &CC1Args) {
++ if (!llvm::sys::fs::exists(Base))
++ return false;
++ addSystemInclude(DriverArgs, CC1Args, Base);
++ addSystemInclude(DriverArgs, CC1Args, Base + "/" + TargetArchDir);
++ addSystemInclude(DriverArgs, CC1Args, Base + "/backward");
++ return true;
++}
++
++void FreeBSD::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
++ ArgStringList &CC1Args) const {
++ if (DriverArgs.hasArg(options::OPT_nostdlibinc) ||
++ DriverArgs.hasArg(options::OPT_nostdincxx))
++ return;
++
++ // Check if libc++ has been enabled and provide its include paths if so.
++ if (GetCXXStdlibType(DriverArgs) == ToolChain::CST_Libcxx) {
++ // libc++ is always installed at a fixed path on Linux currently.
++ addSystemInclude(DriverArgs, CC1Args,
++ getDriver().SysRoot + "/usr/include/c++/v1");
++ return;
++ }
++
++ // We need a detected GCC installation on Linux to provide libstdc++'s
++ // headers. We handled the libc++ case above.
++ if (!GCCInstallation.isValid())
++ return;
++
++ // By default, look for the C++ headers in an include directory adjacent to
++ // the lib directory of the GCC installation. Note that this is expect to be
++ // equivalent to '/usr/include/c++/X.Y' in almost all cases.
++ StringRef LibDir = GCCInstallation.getParentLibPath();
++ StringRef InstallDir = GCCInstallation.getInstallPath();
++ StringRef Version = GCCInstallation.getVersion();
++ if (!addLibStdCXXIncludePaths(LibDir + "/../include/c++/" + Version,
++ (GCCInstallation.getTriple().str() +
++ GCCInstallation.getMultiarchSuffix()),
++ DriverArgs, CC1Args)) {
++ // Gentoo is weird and places its headers inside the GCC install, so if the
++ // first attempt to find the headers fails, try this pattern.
++ addLibStdCXXIncludePaths(InstallDir + "/include/g++-v4",
++ (GCCInstallation.getTriple().str() +
++ GCCInstallation.getMultiarchSuffix()),
++ DriverArgs, CC1Args);
++ }
++}
++
+ /// DragonFly - DragonFly tool chain which can call as(1) and ld(1) directly.
+
+ DragonFly::DragonFly(const Driver &D, const llvm::Triple& Triple, const ArgList &Args)
+diff --git a/a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.h b/b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.h
+index eaa6be1..bba891e 100644
+--- a/a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.h
++++ b/b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.h
+@@ -489,6 +489,16 @@ public:
+
+ virtual Tool &SelectTool(const Compilation &C, const JobAction &JA,
+ const ActionList &Inputs) const;
++
++ virtual void AddClangSystemIncludeArgs(const ArgList &DriverArgs,
++ ArgStringList &CC1Args) const;
++ virtual void AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
++ ArgStringList &CC1Args) const;
++
++private:
++ static bool addLibStdCXXIncludePaths(Twine Base, Twine TargetArchDir,
++ const ArgList &DriverArgs,
++ ArgStringList &CC1Args);
+ };
+
+ class LLVM_LIBRARY_VISIBILITY NetBSD : public Generic_ELF {
diff --git a/sys-devel/clang/files/clang-3.1-gentoo-freebsd-fix-lib-path.patch b/sys-devel/clang/files/clang-3.1-gentoo-freebsd-fix-lib-path.patch
new file mode 100644
index 000000000000..702606f8a0ca
--- /dev/null
+++ b/sys-devel/clang/files/clang-3.1-gentoo-freebsd-fix-lib-path.patch
@@ -0,0 +1,20 @@
+This patch causes problem for multilib: GCCInstallation.getInstallPath() is
+empty in that case and 'clang -m32 foo.c' will put a -L with nothing after it
+but the .o file generated, effectively dropping it.
+With recent freebsd-lib versions, it is only needed for c++ with libstdc++,
+which is actually broken because clang++ cannot find the headers. it is fine
+with clang++ -stdlib=libc++.
+aballier@g.o
+
+diff -upNr a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp
+--- a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-24 04:08:48.393073000 -0400
++++ b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-24 04:11:38.113153421 -0400
+@@ -1635,6 +1635,8 @@ FreeBSD::FreeBSD(const Driver &D, const
+ getFilePaths().push_back(getDriver().SysRoot + "/usr/lib32");
+ else
+ getFilePaths().push_back(getDriver().SysRoot + "/usr/lib");
++
++ getFilePaths().push_back(GCCInstallation.getInstallPath());
+ }
+
+ Tool &FreeBSD::SelectTool(const Compilation &C, const JobAction &JA,
diff --git a/sys-devel/clang/files/clang-3.1-gentoo-runtime-gcc-detection-v3.patch b/sys-devel/clang/files/clang-3.1-gentoo-runtime-gcc-detection-v3.patch
new file mode 100644
index 000000000000..49f108533404
--- /dev/null
+++ b/sys-devel/clang/files/clang-3.1-gentoo-runtime-gcc-detection-v3.patch
@@ -0,0 +1,29 @@
+diff -upNr a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp
+--- a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-24 03:32:31.593191000 -0400
++++ b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-24 03:38:31.733163513 -0400
+@@ -1145,6 +1145,25 @@ Generic_GCC::GCCInstallationDetector::GC
+ Prefixes.push_back(D.InstalledDir + "/..");
+ }
+
++ llvm::OwningPtr<llvm::MemoryBuffer> File;
++ for (unsigned k = 0, ke = CandidateTripleAliases.size(); k < ke; ++k) {
++ if (!llvm::MemoryBuffer::getFile(D.SysRoot + "/etc/env.d/gcc/config-" + CandidateTripleAliases[k].str(), File))
++ {
++ bool Exists;
++ const std::string VersionText = File.get()->getBuffer().rsplit('-').second.substr(0,5).str();
++ const std::string GentooPath = D.SysRoot + "/usr/lib/gcc/" + CandidateTripleAliases[k].str() + "/" + VersionText;
++ if (!llvm::sys::fs::exists(GentooPath + "/crtbegin.o", Exists) && Exists)
++ {
++ Version = GCCVersion::Parse(VersionText);
++ GCCInstallPath = GentooPath;
++ GCCParentLibPath = GCCInstallPath + "/../../..";
++ GCCTriple.setTriple(CandidateTripleAliases[k]);
++ IsValid = true;
++ return;
++ }
++ }
++ }
++
+ // Loop over the various components which exist and select the best GCC
+ // installation available. GCC installs are ranked by version number.
+ Version = GCCVersion::Parse("0.0.0");
diff --git a/sys-devel/clang/files/clang-3.1-increase-parser-recursion-limit.patch b/sys-devel/clang/files/clang-3.1-increase-parser-recursion-limit.patch
new file mode 100644
index 000000000000..79f4f9f07871
--- /dev/null
+++ b/sys-devel/clang/files/clang-3.1-increase-parser-recursion-limit.patch
@@ -0,0 +1,15 @@
+Backported from r155737.
+
+diff --git a/llvm-3.1.src/tools/clang/include/clang/Parse/Parser.h b/llvm-3.1.src/tools/clang/include/clang/Parse/Parser.h
+index 0ae5dc8..2a7464f 100644
+--- a/llvm-3.1.src/tools/clang/include/clang/Parse/Parser.h
++++ b/llvm-3.1.src/tools/clang/include/clang/Parse/Parser.h
+@@ -451,7 +451,7 @@ private:
+ }
+ }
+
+- enum { MaxDepth = 256 };
++ enum { MaxDepth = 512 };
+
+ bool diagnoseOverflow();
+ bool diagnoseMissingClose();
diff --git a/sys-devel/clang/metadata.xml b/sys-devel/clang/metadata.xml
new file mode 100644
index 000000000000..466ad974778a
--- /dev/null
+++ b/sys-devel/clang/metadata.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>clang@gentoo.org</email>
+ <name>Gentoo clang support project</name>
+ </maintainer>
+ <longdescription>The goal of the Clang project is to create a new C, C++, Objective C and Objective C++ front-end for the LLVM compiler.
+
+Features and Goals
+
+Some of the goals for the project include the following:
+
+End-User Features:
+Fast compiles and low memory use
+Expressive diagnostics
+GCC compatibility
+Utility and Applications:
+
+Modular library based architecture
+Support diverse clients (refactoring, static analysis, code generation, etc)
+Allow tight integration with IDEs
+Use the LLVM BSD License
+Internal Design and Implementation:
+
+A real-world, production quality compiler
+A simple and hackable code base
+A single unified parser for C, Objective C, C++, and Objective C++
+Conformance with C/C++/ObjC and their variants</longdescription>
+ <use>
+ <flag name='multitarget'>Build all host targets (default: host only)</flag>
+ <flag name='static-analyzer'>Install the Clang static analyzer</flag>
+ <flag name='system-cxx-headers'>By default, clang++ searchs for C++ headers in a series of hardcoded paths. Enabling this flag will force it to use the active gcc profile ones</flag>
+ </use>
+</pkgmetadata>
diff --git a/sys-devel/cons/Manifest b/sys-devel/cons/Manifest
new file mode 100644
index 000000000000..3b4278a952f3
--- /dev/null
+++ b/sys-devel/cons/Manifest
@@ -0,0 +1 @@
+DIST cons-2.2.0.tgz 200338 RMD160 8397716617101ca39d4a6099d906b3590d4fb2bc SHA1 54185c1e6cdc1d9088e88242c29b67a7398ab8ca SHA256 05f21f341ef90a7f1d954a0f4429bac7afd05b94bc9fd282e1f0048a6c43c890
diff --git a/sys-devel/cons/cons-2.2.0.ebuild b/sys-devel/cons/cons-2.2.0.ebuild
new file mode 100644
index 000000000000..3384bb993e6b
--- /dev/null
+++ b/sys-devel/cons/cons-2.2.0.ebuild
@@ -0,0 +1,26 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+DESCRIPTION="Extensible perl-based build utility"
+SRC_URI="http://www.dsmit.com/cons/stable/${P}.tgz"
+HOMEPAGE="http://www.dsmit.com/cons/"
+
+SLOT="2.2"
+LICENSE="GPL-2"
+KEYWORDS="alpha ~amd64 ppc ~sparc x86"
+IUSE=""
+
+DEPEND="
+ dev-lang/perl
+ virtual/perl-Digest-MD5"
+RDEPEND="
+ ${DEPEND}
+ !sci-biology/emboss"
+
+src_install() {
+ dobin cons || die
+ dodoc CHANGES INSTALL MANIFEST README RELEASE TODO || die
+ dohtml *.html || die
+ doman cons.1.gz || die
+}
diff --git a/sys-devel/cons/metadata.xml b/sys-devel/cons/metadata.xml
new file mode 100644
index 000000000000..96a2d586367d
--- /dev/null
+++ b/sys-devel/cons/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-devel/crossdev/Manifest b/sys-devel/crossdev/Manifest
new file mode 100644
index 000000000000..16d46b84e996
--- /dev/null
+++ b/sys-devel/crossdev/Manifest
@@ -0,0 +1,32 @@
+DIST crossdev-20100814.tar.xz 17100 SHA256 29835bdd066beba420459314ee248b51e4467b4824abd66aad7c467ecd9532ba SHA512 cbe0cf59eb48a77888338e16c40bf4e6da74a3e21fed03cf01b7d6b7d27797ba79673e0448a9644a9806a465f1b014dea2087ad2cab0c57f07df43d10cef45a9 WHIRLPOOL 9170bc8ff4c7d261289011dfcfabf7c7452bcf4ff9b79ab3c976035f20f370f2f849250f81be115d5d85beccfa4159f04d1acd8880d4fd532d459423fcdc094f
+DIST crossdev-20101011.tar.xz 17444 SHA256 88934bdcec319c9a586efbfc2c2a2af8746494d79584b14853a6067e3ea87cdd SHA512 4e7210ecb75386106b2bb2ed89cd3e0f6dd35d8b225c18455e842d56a40b9c70569f7aa182fdd45c51251a6c2c0012f7999bc16c791b9fccdeddd5554cb5fc19 WHIRLPOOL de05eb286e04ffd1429d52a4b1ea4a8be556cb2b441b4428d1ea592c168e22c3089da150ecd3aaf12700a02e756c9626a15c952da146394e01eb5c3984493286
+DIST crossdev-20110310.tar.xz 17840 SHA256 db3355bcec9367945a7dc54e17d69b9d2da45ad495304285ec8742e14082228a SHA512 b3e22f264e860a306f5f8df2cfef8aafa4c8755cc1a30dd32f09d89a00ce1d6d377b5e9c7fecb5c6362b2ce0dd09c1280f57a0a1b856dacf7d195301aee5736f WHIRLPOOL e641df43f11e82f120893b5d131ba847d792e5f8ecc7849a3b9a14c2e355fd30618831949c8315360d15bb27e9531f45f469ebb9aa98b27b1f552888488fec17
+DIST crossdev-20110705.tar.xz 17984 SHA256 83c6edbaac2f266aa4480361dc8a43ebf2ce893b3efd644330d42f49a35b36f0 SHA512 e68e46394950da9da3cb2c37985a24e9146de618bb9b7a14adaba25d0ae1819a100a9d155df5b8e41e2197be22ed16296d645c33afdcffe83bb07437ca87c63d WHIRLPOOL 3da6011a318b97ae320c49548cc3709f1fcd60e08a44c4d551bd18f442db7293df44112d71090d430cad7e3eaed2cee61c8b2c1e3569eedbd9e857ab1db5d0fe
+DIST crossdev-20110819.tar.xz 18696 SHA256 26d2fddb95914a5bbb8626397a6d38f651b0f2e8e5b11071c73889a7243ab71f SHA512 699898635c7fc4be187b63daa703da4042c9b26878defb6a8c0618a512dec419ca1b67f8cdbfc4c4d47f52b5911e44e842b3a125b6b937a95222b1f059899449 WHIRLPOOL 46790a32ca20c12cbd037de3065269b82049531bfe0b5d9839a86a2f0569a1778995b92bcc4bcec50ef9009a131fd8724bb692ddb9cf790e20832738d11f6c79
+DIST crossdev-20111011.tar.xz 19156 SHA256 cf83790f635dbba42c28bea7661a1db73eee8626293fb6645f0f91a9e606134d SHA512 aa4f9090ce6facdf47ec336cbb5e0a5a78bdaac6ae355ecf262386e5572d0843a1edd52de5837d3a2e9a8b010cae91cf0aa92df39398aaf9fd60b45a799b5992 WHIRLPOOL d773e247077ed67d9d206e931256140925f02e81d1f3ed2601f3b32328de78a8c7998bb8e08778aee2dce24c57cacd4804cd53895e86db292ba7347feaa5b5e3
+DIST crossdev-20111018.tar.xz 19408 SHA256 276f790b273030a0efe72911f9638e18b377ffe6342d8edebf2845a07c8e8010 SHA512 2214f6ec074fa695653105e663027e4992927d9d4a2c8fe7c51f6f9b060b05f5d26bf944b29ea4ca380d971aec30c4ff5685f8f607ccba763139481055c85870 WHIRLPOOL da2e21ed60758034ee9b493832b28f823be527ac09c988e1cf519e4297096fa7ead618f1722ac2ff771ac098129c966469fd1046d5519387cb2fbce819e81f89
+DIST crossdev-20111118.tar.xz 19268 SHA256 75701ba4398213919bfaf806abba5f913dc7a6fbfc4a40cf8d24f3de29221c41 SHA512 58fb9fa4798060ffc935d793ce112a9f1a2f723a9e540fe18ed24d372f45bafed5bbc86bd3f1401970ed0cc944b256e3c096c833bbd852a3c8054ceba46cf644 WHIRLPOOL ce1786d89e072ec3f3f6c8fa2120c946abae0be572ecf108d1392451dfbecab51cec8dfddfca06bed90a5c008c6a4914dd31f2a88ed8c6d43e3b36602db6e9bb
+DIST crossdev-20111221.tar.xz 19360 SHA256 0f683fdd9898c080f807841850983e0cafe5d2fb97d508397e02f6826b7ec1c4 SHA512 10479e0b37389155297bc59ee48cec5ab78d5a7c25a71ed4417bfeed4949433ad3a97fde54b36e1703852625440a529276309cb099af1d7d1e491ef85c44e091 WHIRLPOOL 66dd1defb6dce1f1594a45ca755a2bef13a354b5d3668ecd07c250964496dc26f4fe0fe35631a728f0db7ab7ff89ed583d4aa30b5d6847cd8980114d7d83d9b9
+DIST crossdev-20120214.tar.xz 19796 SHA256 9e1b4bbfcd97f8cc1c0d0c3d4b6f9671728c78db787a7f4cb649a494e93cb82a SHA512 b7d161744b71d40cbd570c340afda1c151bfd34cc6c55b75db4cefa8e75ddfb89194cb07a6b1ac8d6adebc5bf1d823be2f12dd32f05783a0db0685b07146e6d8 WHIRLPOOL a41f814f43a943c210ab908de73ca352d53fd2824c071ce8e79c51d356987283e4932365eebf3667867f3c058cee981b4dd1a539492c755ba79a432de14ddd1f
+DIST crossdev-20120227.tar.xz 20244 SHA256 86bf155d47934e9548ad7c8dbd843830baef936d09c31523718355220947903a SHA512 1407f9021ef79c08c525c07e3dd855fc8a055c25ce81ca4e61e731390d7a29ffb4ca06c4881f220b9866a4e9bff75ef6098bba71551dd61a2f3079a38bfb2adb WHIRLPOOL 823b6fa9239485ed5c3c2673344f86b807ed4c49bcffb6547bbe2d3e7c95f738a5769f9e9ead0f4f167ca6a8f9de448d161cd5d584912b80c6d2839059880170
+DIST crossdev-20120228.tar.xz 20332 SHA256 e67e434e602ed72810605969da9adae0c3dc94359af07524b997a764cf99389a SHA512 f011055296cde961961ae84fc31aad15c6f3b6266fd1bf18db4855332a9699ceb5557badac01592c5cbc12c4b3821645611642e45a7bc1bf8e734cc065671454 WHIRLPOOL cd78207c652ce004566aa812a26377f43d0df006c63db90baf20ff3ff6fc8d2625f4b86d139c50de10153af2e66e042d5c7f1b65e71413a9b6a6f13af7b09358
+DIST crossdev-20120229.tar.xz 20564 SHA256 3d011e656438bf07e2b98db24186483de75f1d9d78dffefdcdabf4da5f8cd6d3 SHA512 d1b2d450761e913885f87f991f68013de9777549f56e05448f59b071612e857b68a44339358b86cb4438ad44d16dee2f5d7c8b0bbca0dc584e8e06eff4fe2e75 WHIRLPOOL 28c3e9e40aa31ac8a9ee22eb0e4b69b0e3243495d3e0095ba4112590eb92b1c6531434a8c0efdb5f56e15a2ed7d86df8cb6b7c69d7721d1aaaa65c615024416e
+DIST crossdev-20120301.tar.xz 20804 SHA256 e36b2409e01ebe49a4d94faba7256f7c0e9d8890773573bf68be1b0f9156aae8 SHA512 bd5d48b751803b05509186b89c6f85544b8e901066d57c191b0fa0b4deb5d67f7f86241ba915e75f8c345c5d24adb2314b51898626545a5c0692b8faec0e51bc WHIRLPOOL d3a9bcc1d62459d635e58bd11adc9bd8df633e906a4d0d4b9bff0664d7a1c5a8c5c116e97bf8290fed025694a5f966e56ad7a6e10c3d34411338c38f0f0cb057
+DIST crossdev-20120305.tar.xz 21216 SHA256 9dd395cd7faf8b3ab7261c9d7b704e08c5900843a57ea207d583254ee5346633 SHA512 f6a34c1a37308ee8116494081fe4717ed01740a0a560f7f8f2e89a9c3b206f25c7d13349e41992a59a62eda5e8c1c6867221c81551a9d056d58518efd70058ad WHIRLPOOL a5ea451fa859189e9e219be922484c4e3e75ae0188ee6af9f5c221448d2c8d1bb9b4a73efac96547498d0a18db6d5412a1ff114e1ddefe5087dd3bab4f14f123
+DIST crossdev-20120529.tar.xz 21232 SHA256 1a737417b6f283e1c3dcb30fd4bf2432f3670cf06c19146791f93969eb59b742 SHA512 aa2f9d26d87dcf8e2509f2ee7a9eb9792efe7267b1e3be02755b16a16406727077d98e62fe4edb209cf31fa19a6cca4e1b7cc1620345efd3ad521a1a3ebcf036 WHIRLPOOL d939c4defe684dcc9dee6ff3c1a673da66c1b791f9c5c5ecf660fea8ef4d8d189b58063f3ac0fdbc75c209b2285b2fde2930cb242661954a3841e4e835b594f5
+DIST crossdev-20120531.tar.xz 21380 SHA256 59e5594ed64b53d0e561d8d3618bfe0b4ea456fd189251ca049cdafb6cd163b6 SHA512 7b7a15aa009b18ae8f3e516bc9e4deda3454b743dcbf5cf8499943c0004133f31894ed257a450d484c8ca5ccc4484be429be04630431c9ddce2518c440769498 WHIRLPOOL b6e1fa49a2abec06f1042b77dc5e1d21ebbab4e4d7f23f2c71108f142001af2c7c811f55633c4b63f4439e93f181ff35f6111d4cb50c5f8376c5f0f3a7e5dd7e
+DIST crossdev-20120721.tar.xz 21580 SHA256 9055171f2ee36aa9d5413d842b08ce334102a8536d4b21465e755c0b2cef886f SHA512 4897fdf67e18c75b673a36d43626a4c519bd4cd3116372d103b956d933f1a39258918002ad37c3decd3df0d8b73b09f89fdb97bc9c2f7b2e403d815d9adc549b WHIRLPOOL 3a5306bfaa86a390b095da46366a0de2e9f642577c6ef658506210e1620cf2fc86e46edbdeaf525d5c7b82eb92f336f003c34a48c2420ef9879ce6a9562097d0
+DIST crossdev-20120913.tar.xz 21692 SHA256 23548f509edc2a3f82d1a8b0be0f299afffc49deedfa8cc32bde58b23aebe58d SHA512 f3b8be45a1392562eee07265cb7d4c9426dec4dfb19dd24765821918765a1a21dc31dc38ffdae0c6a4cf0af654bbb514d68900f96e32979d278cd9f958ca7900 WHIRLPOOL 375da4e2e585d780ec04ed4e8865063ec2c2c14a1027da1cdd0fbd671378def4b600426ec3c94d3d9bc56e892928bd70a1b2294088188a3b98dfe525c934763c
+DIST crossdev-20130628.tar.xz 21756 SHA256 c69a272e196513ec50c903dba0a06d7b0cba5b509f2adc7499aadd81b90a84e6 SHA512 8fe7959d59ebe9cb463a91c67416046619b93bdf802a00afdcdc50d2cd52850ed2229dd866ad61aa6b72d4a61a16bfe384e1d1529bd59ad63ba07cd0dfd96c44 WHIRLPOOL 5f8e5ba1696d9d6e2b7ae254b0e1dd7e8fae2b6de9290c189334d2f7ef670cd04c92635506cf583f12f5dea7f747fc7286ab20efb1f7374cba19ecdd5480aa22
+DIST crossdev-20131011.tar.xz 21872 SHA256 c9d24508aea1629db0ca64699c74ede8e37b73d095917ec1c6fe54be9d4246ce SHA512 93e9d227012a14565fe5d157cc3b03006ccd2cb6b99749e4085c3e9b92f79201b86597a1fc9d2de94a6f4e8fe35c90c94ca27f6bc4037d9dfd0f4d459fcb1382 WHIRLPOOL 6bceca55f864a0daed80c45414cdd2f30f50078692ff0ca0b810aaf06218495d40b61fb4bb475fc8a12caeb8495cfb34dc3741e05803f2812be059c0109fc942
+DIST crossdev-20131107.tar.xz 21960 SHA256 a158f13db46ae929b62c90b59da035493dc32da4ae3b7d931f0de675cf8066f7 SHA512 7fe08c2432c4eef59a9d7940fd55bdd6ea26fc6972a7bf38cff9dce42250f4c76e43d1f7a755aeece93998b08496efc02d0deafe0a65b36fb5d2ab338f43f97d WHIRLPOOL 765c2f3bd7d623d543bbf9e8473ef5e7f9ac879cca76fb1a1e4ae0cf99a2297ad983a38e513cccc1a727cab6573c9f87ee62c2768a20d2cff73831c08cdf7290
+DIST crossdev-20140118.tar.xz 21384 SHA256 8ba9ddb74022d6e3d481db5b02db21ea545d046e33a47b44e92ae369b4c218ee SHA512 ee27fc55bd8892fa454f6482d1276e0c6520f7987629b92cc7b96572eca51bb752c119f4f818783a579706afe7c9eabdfb8f0536e87cd888f0f76510ae51939d WHIRLPOOL c2018dfb4ab21d4eadbc9f6e4dd0fb532a8b4ac4530821262f28b8b969e3a7d7c14cd83bbd05e2c93eb73928bb8a4dfd074134d3a93700fe937c0fd1c3ef0fbb
+DIST crossdev-20140729.tar.xz 21436 SHA256 38a71317ae0a36cb3687a164bea369c65c3376abb59a2629ade4be5c17b92641 SHA512 02ffd476c96a70f856143e1b80f5c5bdcbb5b97469ef7d84541cb0dd1be40f50b11dba1844f8d529c638a8ab68c77eb28de61dffe9cff193f185443ba92c760f WHIRLPOOL cef1a107422f9b5ed0b09047c708ac7acd66fc5818cd7d5f94ab18566dbfb3601f8776d89cbf3a551cc1a0e7e20ec84109f827fe8c37f045f2c3c1c776ab46e3
+DIST crossdev-20140917.tar.xz 21884 SHA256 47ae779c1216e062c49e17a3ad8bd7b97ea255559f105f682ef3add64087d4b4 SHA512 1ec4756b56f4784481390a00a081e1e657aa7cc348aa5fe3e184935faed2fe2c135bf9955d9e88266d837bb42234b73ac11969ff77664aa521983646228da0e1 WHIRLPOOL 903377b95eeadcb6f88bd639051bdbfb16f7df7a010ad7e9aa39b55e424016a1cc54c6940ebb22d3562a5d22456ac74a74a3cc044a43028217e5caedc067859c
+DIST crossdev-20141030.tar.xz 21880 SHA256 b9e81e6204f53bfb7e32df4720d071e58dea137174c25a767670ff04df901c23 SHA512 23c0ed13d03e11f03d9d0011a72218e1e43c77020caeb2629773170cf7543b08f104a588d18a482a6256c48e5b4eb367ca7143fea4519bf4009e78068840ff8e WHIRLPOOL 3e1c909118a43b2c187f02dd8b4246cda974f0e4a521340efca79d0d3317a9412964443df125da4660ed61a20491986e20e8d1cbb7074ce6fcfc7cc90eef7be8
+DIST crossdev-20150521.tar.xz 22252 SHA256 99e487cc5c226dcde0254ebe249cd21dd93b2b7cffdf56ee4faefc8f2fe68d81 SHA512 a6be42ad3dcba0189bfc3aa11776d0841397f20258cb995b294a29dc7656121b18a638faf60540c1b8b25fbcac8306568d77443917aad1614caeef3c413e8e81 WHIRLPOOL f106bf827c85bc9ff4a76b01805f308073e73db4e314fc2f15f8b77401c81e744b61100c3121ce8468e4af0da775bbb063a7f6c450c03d8bc303ce1937d3ebea
+DIST crossdev-20150525.tar.xz 22264 SHA256 2a66d567c246f11b8a6a2b2856b55489f472561c8f31a8c90b0ea5f0c1561035 SHA512 8e7c8b3bf31ddd3c0cf8ccf819f64f0949f35c08df897e78d296987496115e8b1346adb745549cad9e508f79a0e3dae9d8db53eeb798583cc641887bfc625b5f WHIRLPOOL fb079ca2a412ab42e6c8d98fd159173b0c8cc5f3a27d29c5b089c38050297d4d907ae5a1d59fb9e129e7aa59d605d2a64300dabfcdc83684bca2fe1ccc04359c
+DIST crossdev-20150526.tar.xz 22260 SHA256 132d11c125254ceabde96eae423d04873e09addcba705466b7a6539652690656 SHA512 2c28c946173faffee76dd69c0bc171e3962dd06deb7791aa3354b018143a9b0156a53062a1a2dc581a71b4eee9f0b299ec05b9e4dd4eff9e8a4e3b113593606f WHIRLPOOL e023cc097857a8730805e3bbe6030725669b6e42b8f0316de9ce3238dab8dbd77ed8344520c3f0a0626b8e48f5b63893ad558251819b1bfde6b065dd55ea8611
+DIST crossdev-20150527.tar.xz 22252 SHA256 a0602acb52574fdd234a55ca1b15c419073d51a500abbd078673a84ddb150563 SHA512 589d6c0f42d950505c636fb18a294f587328952c952c63c6b8dbbe5d282f857f209130896fa1c5d2957342dc5163db4c03d5140c28cabc49ec2051ffe33c93af WHIRLPOOL ce596065de372b72350b345976db0417b48230da01b4b3e5f5028bee33e91cfc728f9f74370556bc4f35d155839d0a1a997e50c692addb80009c3f336e32a978
+DIST crossdev-20150602.tar.xz 22388 SHA256 7fef5b43f9ecbae0b9e1f7a993b53fc97b9bc1fa1d818aa46171c557c57aa23a SHA512 2cc9f2ba9bba037c909204b872b84e1087737f0804fe5f900a5d6e0b2948885aa17dc91d77ac3e38ce9752c56936fe5a92a77b6a264a029c98ef43e641bb7e8d WHIRLPOOL 5fd0e89c92c1ace214580bba200a5ff829a0547437949e0e4d39499305bd1ee75ddbe6ad32cbe1acc39392a8666d681b2c446bd10f257be788df5a7ed8a3a32d
+DIST crossdev-20150716.tar.xz 22152 SHA256 3988039ebc5363cba752a04ba00df18b0d8c1ac10be342880feda5f848a20a22 SHA512 8c41d9d5e6df8cc894e52b841f827b517a090edd0e281d181cc38d6ce472b75cb592eef487d1fdb99c31b6daf903d2636b625ebd5c8fa2fbbeadfb98e0e5cfbe WHIRLPOOL 39f3e941a2dcb5915f8e81725d8d8abaf3fd9dfa676d7c7096cb188b75c9af439c6e75b34207bd3404f9a1f15954999d8a42dfaf09646aa3c6a0925bf40fb963
diff --git a/sys-devel/crossdev/crossdev-20100814.ebuild b/sys-devel/crossdev/crossdev-20100814.ebuild
new file mode 100644
index 000000000000..8092d3b1d653
--- /dev/null
+++ b/sys-devel/crossdev/crossdev-20100814.ebuild
@@ -0,0 +1,32 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/crossdev.git"
+ inherit git-2
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+ KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="Gentoo Cross-toolchain generator"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=sys-apps/portage-2.1
+ app-shells/bash
+ !sys-devel/crossdev-wrappers"
+DEPEND="app-arch/xz-utils"
+
+src_install() {
+ emake install DESTDIR="${D}" || die
+}
diff --git a/sys-devel/crossdev/crossdev-20101011.ebuild b/sys-devel/crossdev/crossdev-20101011.ebuild
new file mode 100644
index 000000000000..8092d3b1d653
--- /dev/null
+++ b/sys-devel/crossdev/crossdev-20101011.ebuild
@@ -0,0 +1,32 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/crossdev.git"
+ inherit git-2
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+ KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="Gentoo Cross-toolchain generator"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=sys-apps/portage-2.1
+ app-shells/bash
+ !sys-devel/crossdev-wrappers"
+DEPEND="app-arch/xz-utils"
+
+src_install() {
+ emake install DESTDIR="${D}" || die
+}
diff --git a/sys-devel/crossdev/crossdev-20110310.ebuild b/sys-devel/crossdev/crossdev-20110310.ebuild
new file mode 100644
index 000000000000..8092d3b1d653
--- /dev/null
+++ b/sys-devel/crossdev/crossdev-20110310.ebuild
@@ -0,0 +1,32 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/crossdev.git"
+ inherit git-2
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+ KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="Gentoo Cross-toolchain generator"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=sys-apps/portage-2.1
+ app-shells/bash
+ !sys-devel/crossdev-wrappers"
+DEPEND="app-arch/xz-utils"
+
+src_install() {
+ emake install DESTDIR="${D}" || die
+}
diff --git a/sys-devel/crossdev/crossdev-20110705.ebuild b/sys-devel/crossdev/crossdev-20110705.ebuild
new file mode 100644
index 000000000000..8092d3b1d653
--- /dev/null
+++ b/sys-devel/crossdev/crossdev-20110705.ebuild
@@ -0,0 +1,32 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/crossdev.git"
+ inherit git-2
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+ KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="Gentoo Cross-toolchain generator"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=sys-apps/portage-2.1
+ app-shells/bash
+ !sys-devel/crossdev-wrappers"
+DEPEND="app-arch/xz-utils"
+
+src_install() {
+ emake install DESTDIR="${D}" || die
+}
diff --git a/sys-devel/crossdev/crossdev-20110819.ebuild b/sys-devel/crossdev/crossdev-20110819.ebuild
new file mode 100644
index 000000000000..8092d3b1d653
--- /dev/null
+++ b/sys-devel/crossdev/crossdev-20110819.ebuild
@@ -0,0 +1,32 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/crossdev.git"
+ inherit git-2
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+ KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="Gentoo Cross-toolchain generator"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=sys-apps/portage-2.1
+ app-shells/bash
+ !sys-devel/crossdev-wrappers"
+DEPEND="app-arch/xz-utils"
+
+src_install() {
+ emake install DESTDIR="${D}" || die
+}
diff --git a/sys-devel/crossdev/crossdev-20111011.ebuild b/sys-devel/crossdev/crossdev-20111011.ebuild
new file mode 100644
index 000000000000..dcb5f31d5a3c
--- /dev/null
+++ b/sys-devel/crossdev/crossdev-20111011.ebuild
@@ -0,0 +1,32 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/crossdev.git"
+ inherit git-2
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+ KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="Gentoo Cross-toolchain generator"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=sys-apps/portage-2.1
+ app-shells/bash
+ !sys-devel/crossdev-wrappers"
+DEPEND="app-arch/xz-utils"
+
+src_install() {
+ emake install DESTDIR="${D}" || die
+}
diff --git a/sys-devel/crossdev/crossdev-20111018.ebuild b/sys-devel/crossdev/crossdev-20111018.ebuild
new file mode 100644
index 000000000000..7e7ad0402372
--- /dev/null
+++ b/sys-devel/crossdev/crossdev-20111018.ebuild
@@ -0,0 +1,32 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/crossdev.git"
+ inherit git-2
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+ KEYWORDS="alpha amd64 arm hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="Gentoo Cross-toolchain generator"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=sys-apps/portage-2.1
+ app-shells/bash
+ !sys-devel/crossdev-wrappers"
+DEPEND="app-arch/xz-utils"
+
+src_install() {
+ emake install DESTDIR="${D}" || die
+}
diff --git a/sys-devel/crossdev/crossdev-20111118.ebuild b/sys-devel/crossdev/crossdev-20111118.ebuild
new file mode 100644
index 000000000000..8092d3b1d653
--- /dev/null
+++ b/sys-devel/crossdev/crossdev-20111118.ebuild
@@ -0,0 +1,32 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/crossdev.git"
+ inherit git-2
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+ KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="Gentoo Cross-toolchain generator"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=sys-apps/portage-2.1
+ app-shells/bash
+ !sys-devel/crossdev-wrappers"
+DEPEND="app-arch/xz-utils"
+
+src_install() {
+ emake install DESTDIR="${D}" || die
+}
diff --git a/sys-devel/crossdev/crossdev-20111221.ebuild b/sys-devel/crossdev/crossdev-20111221.ebuild
new file mode 100644
index 000000000000..8092d3b1d653
--- /dev/null
+++ b/sys-devel/crossdev/crossdev-20111221.ebuild
@@ -0,0 +1,32 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/crossdev.git"
+ inherit git-2
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+ KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="Gentoo Cross-toolchain generator"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=sys-apps/portage-2.1
+ app-shells/bash
+ !sys-devel/crossdev-wrappers"
+DEPEND="app-arch/xz-utils"
+
+src_install() {
+ emake install DESTDIR="${D}" || die
+}
diff --git a/sys-devel/crossdev/crossdev-20120214.ebuild b/sys-devel/crossdev/crossdev-20120214.ebuild
new file mode 100644
index 000000000000..dcb5f31d5a3c
--- /dev/null
+++ b/sys-devel/crossdev/crossdev-20120214.ebuild
@@ -0,0 +1,32 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/crossdev.git"
+ inherit git-2
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+ KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="Gentoo Cross-toolchain generator"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=sys-apps/portage-2.1
+ app-shells/bash
+ !sys-devel/crossdev-wrappers"
+DEPEND="app-arch/xz-utils"
+
+src_install() {
+ emake install DESTDIR="${D}" || die
+}
diff --git a/sys-devel/crossdev/crossdev-20120227.ebuild b/sys-devel/crossdev/crossdev-20120227.ebuild
new file mode 100644
index 000000000000..d2622ec44456
--- /dev/null
+++ b/sys-devel/crossdev/crossdev-20120227.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/crossdev.git"
+ inherit git-2
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+ KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="Gentoo Cross-toolchain generator"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=sys-apps/portage-2.1
+ app-shells/bash
+ !sys-devel/crossdev-wrappers"
+DEPEND="app-arch/xz-utils"
+
+src_install() {
+ default
+ if [[ "${PV}" == "99999999" ]] ; then
+ sed -i "s:@CDEVPV@:${EGIT_VERSION}:" "${ED}"/usr/bin/crossdev || die
+ fi
+}
diff --git a/sys-devel/crossdev/crossdev-20120228.ebuild b/sys-devel/crossdev/crossdev-20120228.ebuild
new file mode 100644
index 000000000000..d2622ec44456
--- /dev/null
+++ b/sys-devel/crossdev/crossdev-20120228.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/crossdev.git"
+ inherit git-2
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+ KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="Gentoo Cross-toolchain generator"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=sys-apps/portage-2.1
+ app-shells/bash
+ !sys-devel/crossdev-wrappers"
+DEPEND="app-arch/xz-utils"
+
+src_install() {
+ default
+ if [[ "${PV}" == "99999999" ]] ; then
+ sed -i "s:@CDEVPV@:${EGIT_VERSION}:" "${ED}"/usr/bin/crossdev || die
+ fi
+}
diff --git a/sys-devel/crossdev/crossdev-20120229.ebuild b/sys-devel/crossdev/crossdev-20120229.ebuild
new file mode 100644
index 000000000000..d2622ec44456
--- /dev/null
+++ b/sys-devel/crossdev/crossdev-20120229.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/crossdev.git"
+ inherit git-2
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+ KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="Gentoo Cross-toolchain generator"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=sys-apps/portage-2.1
+ app-shells/bash
+ !sys-devel/crossdev-wrappers"
+DEPEND="app-arch/xz-utils"
+
+src_install() {
+ default
+ if [[ "${PV}" == "99999999" ]] ; then
+ sed -i "s:@CDEVPV@:${EGIT_VERSION}:" "${ED}"/usr/bin/crossdev || die
+ fi
+}
diff --git a/sys-devel/crossdev/crossdev-20120301.ebuild b/sys-devel/crossdev/crossdev-20120301.ebuild
new file mode 100644
index 000000000000..d2622ec44456
--- /dev/null
+++ b/sys-devel/crossdev/crossdev-20120301.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/crossdev.git"
+ inherit git-2
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+ KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="Gentoo Cross-toolchain generator"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=sys-apps/portage-2.1
+ app-shells/bash
+ !sys-devel/crossdev-wrappers"
+DEPEND="app-arch/xz-utils"
+
+src_install() {
+ default
+ if [[ "${PV}" == "99999999" ]] ; then
+ sed -i "s:@CDEVPV@:${EGIT_VERSION}:" "${ED}"/usr/bin/crossdev || die
+ fi
+}
diff --git a/sys-devel/crossdev/crossdev-20120305.ebuild b/sys-devel/crossdev/crossdev-20120305.ebuild
new file mode 100644
index 000000000000..c5da1cfef1af
--- /dev/null
+++ b/sys-devel/crossdev/crossdev-20120305.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/crossdev.git"
+ inherit git-2
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+ KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="Gentoo Cross-toolchain generator"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=sys-apps/portage-2.1
+ app-shells/bash
+ !sys-devel/crossdev-wrappers"
+DEPEND="app-arch/xz-utils"
+
+src_install() {
+ default
+ if [[ "${PV}" == "99999999" ]] ; then
+ sed -i "s:@CDEVPV@:${EGIT_VERSION}:" "${ED}"/usr/bin/crossdev || die
+ fi
+}
diff --git a/sys-devel/crossdev/crossdev-20120529.ebuild b/sys-devel/crossdev/crossdev-20120529.ebuild
new file mode 100644
index 000000000000..d2622ec44456
--- /dev/null
+++ b/sys-devel/crossdev/crossdev-20120529.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/crossdev.git"
+ inherit git-2
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+ KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="Gentoo Cross-toolchain generator"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=sys-apps/portage-2.1
+ app-shells/bash
+ !sys-devel/crossdev-wrappers"
+DEPEND="app-arch/xz-utils"
+
+src_install() {
+ default
+ if [[ "${PV}" == "99999999" ]] ; then
+ sed -i "s:@CDEVPV@:${EGIT_VERSION}:" "${ED}"/usr/bin/crossdev || die
+ fi
+}
diff --git a/sys-devel/crossdev/crossdev-20120531.ebuild b/sys-devel/crossdev/crossdev-20120531.ebuild
new file mode 100644
index 000000000000..c5da1cfef1af
--- /dev/null
+++ b/sys-devel/crossdev/crossdev-20120531.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/crossdev.git"
+ inherit git-2
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+ KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="Gentoo Cross-toolchain generator"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=sys-apps/portage-2.1
+ app-shells/bash
+ !sys-devel/crossdev-wrappers"
+DEPEND="app-arch/xz-utils"
+
+src_install() {
+ default
+ if [[ "${PV}" == "99999999" ]] ; then
+ sed -i "s:@CDEVPV@:${EGIT_VERSION}:" "${ED}"/usr/bin/crossdev || die
+ fi
+}
diff --git a/sys-devel/crossdev/crossdev-20120721.ebuild b/sys-devel/crossdev/crossdev-20120721.ebuild
new file mode 100644
index 000000000000..c5da1cfef1af
--- /dev/null
+++ b/sys-devel/crossdev/crossdev-20120721.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/crossdev.git"
+ inherit git-2
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+ KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="Gentoo Cross-toolchain generator"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=sys-apps/portage-2.1
+ app-shells/bash
+ !sys-devel/crossdev-wrappers"
+DEPEND="app-arch/xz-utils"
+
+src_install() {
+ default
+ if [[ "${PV}" == "99999999" ]] ; then
+ sed -i "s:@CDEVPV@:${EGIT_VERSION}:" "${ED}"/usr/bin/crossdev || die
+ fi
+}
diff --git a/sys-devel/crossdev/crossdev-20120913.ebuild b/sys-devel/crossdev/crossdev-20120913.ebuild
new file mode 100644
index 000000000000..c5da1cfef1af
--- /dev/null
+++ b/sys-devel/crossdev/crossdev-20120913.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/crossdev.git"
+ inherit git-2
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+ KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="Gentoo Cross-toolchain generator"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=sys-apps/portage-2.1
+ app-shells/bash
+ !sys-devel/crossdev-wrappers"
+DEPEND="app-arch/xz-utils"
+
+src_install() {
+ default
+ if [[ "${PV}" == "99999999" ]] ; then
+ sed -i "s:@CDEVPV@:${EGIT_VERSION}:" "${ED}"/usr/bin/crossdev || die
+ fi
+}
diff --git a/sys-devel/crossdev/crossdev-20130628.ebuild b/sys-devel/crossdev/crossdev-20130628.ebuild
new file mode 100644
index 000000000000..c5da1cfef1af
--- /dev/null
+++ b/sys-devel/crossdev/crossdev-20130628.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/crossdev.git"
+ inherit git-2
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+ KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="Gentoo Cross-toolchain generator"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=sys-apps/portage-2.1
+ app-shells/bash
+ !sys-devel/crossdev-wrappers"
+DEPEND="app-arch/xz-utils"
+
+src_install() {
+ default
+ if [[ "${PV}" == "99999999" ]] ; then
+ sed -i "s:@CDEVPV@:${EGIT_VERSION}:" "${ED}"/usr/bin/crossdev || die
+ fi
+}
diff --git a/sys-devel/crossdev/crossdev-20131011.ebuild b/sys-devel/crossdev/crossdev-20131011.ebuild
new file mode 100644
index 000000000000..a346b54211d7
--- /dev/null
+++ b/sys-devel/crossdev/crossdev-20131011.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/crossdev.git"
+ inherit git-2
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+ KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="Gentoo Cross-toolchain generator"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=sys-apps/portage-2.1
+ app-shells/bash
+ !sys-devel/crossdev-wrappers"
+DEPEND="app-arch/xz-utils"
+
+src_install() {
+ default
+ if [[ "${PV}" == "99999999" ]] ; then
+ sed -i "s:@CDEVPV@:${EGIT_VERSION}:" "${ED}"/usr/bin/crossdev || die
+ fi
+}
diff --git a/sys-devel/crossdev/crossdev-20131107.ebuild b/sys-devel/crossdev/crossdev-20131107.ebuild
new file mode 100644
index 000000000000..a346b54211d7
--- /dev/null
+++ b/sys-devel/crossdev/crossdev-20131107.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/crossdev.git"
+ inherit git-2
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+ KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="Gentoo Cross-toolchain generator"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=sys-apps/portage-2.1
+ app-shells/bash
+ !sys-devel/crossdev-wrappers"
+DEPEND="app-arch/xz-utils"
+
+src_install() {
+ default
+ if [[ "${PV}" == "99999999" ]] ; then
+ sed -i "s:@CDEVPV@:${EGIT_VERSION}:" "${ED}"/usr/bin/crossdev || die
+ fi
+}
diff --git a/sys-devel/crossdev/crossdev-20140118.ebuild b/sys-devel/crossdev/crossdev-20140118.ebuild
new file mode 100644
index 000000000000..a346b54211d7
--- /dev/null
+++ b/sys-devel/crossdev/crossdev-20140118.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/crossdev.git"
+ inherit git-2
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+ KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="Gentoo Cross-toolchain generator"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=sys-apps/portage-2.1
+ app-shells/bash
+ !sys-devel/crossdev-wrappers"
+DEPEND="app-arch/xz-utils"
+
+src_install() {
+ default
+ if [[ "${PV}" == "99999999" ]] ; then
+ sed -i "s:@CDEVPV@:${EGIT_VERSION}:" "${ED}"/usr/bin/crossdev || die
+ fi
+}
diff --git a/sys-devel/crossdev/crossdev-20140729.ebuild b/sys-devel/crossdev/crossdev-20140729.ebuild
new file mode 100644
index 000000000000..ad0c72a50b39
--- /dev/null
+++ b/sys-devel/crossdev/crossdev-20140729.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/crossdev.git"
+ inherit git-2
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="Gentoo Cross-toolchain generator"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=sys-apps/portage-2.1
+ app-shells/bash
+ !sys-devel/crossdev-wrappers"
+DEPEND="app-arch/xz-utils"
+
+src_install() {
+ default
+ if [[ "${PV}" == "99999999" ]] ; then
+ sed -i "s:@CDEVPV@:${EGIT_VERSION}:" "${ED}"/usr/bin/crossdev || die
+ fi
+}
diff --git a/sys-devel/crossdev/crossdev-20140917.ebuild b/sys-devel/crossdev/crossdev-20140917.ebuild
new file mode 100644
index 000000000000..a346b54211d7
--- /dev/null
+++ b/sys-devel/crossdev/crossdev-20140917.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/crossdev.git"
+ inherit git-2
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+ KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="Gentoo Cross-toolchain generator"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=sys-apps/portage-2.1
+ app-shells/bash
+ !sys-devel/crossdev-wrappers"
+DEPEND="app-arch/xz-utils"
+
+src_install() {
+ default
+ if [[ "${PV}" == "99999999" ]] ; then
+ sed -i "s:@CDEVPV@:${EGIT_VERSION}:" "${ED}"/usr/bin/crossdev || die
+ fi
+}
diff --git a/sys-devel/crossdev/crossdev-20141030.ebuild b/sys-devel/crossdev/crossdev-20141030.ebuild
new file mode 100644
index 000000000000..a346b54211d7
--- /dev/null
+++ b/sys-devel/crossdev/crossdev-20141030.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/crossdev.git"
+ inherit git-2
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+ KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="Gentoo Cross-toolchain generator"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=sys-apps/portage-2.1
+ app-shells/bash
+ !sys-devel/crossdev-wrappers"
+DEPEND="app-arch/xz-utils"
+
+src_install() {
+ default
+ if [[ "${PV}" == "99999999" ]] ; then
+ sed -i "s:@CDEVPV@:${EGIT_VERSION}:" "${ED}"/usr/bin/crossdev || die
+ fi
+}
diff --git a/sys-devel/crossdev/crossdev-20150521.ebuild b/sys-devel/crossdev/crossdev-20150521.ebuild
new file mode 100644
index 000000000000..ad0c72a50b39
--- /dev/null
+++ b/sys-devel/crossdev/crossdev-20150521.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/crossdev.git"
+ inherit git-2
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="Gentoo Cross-toolchain generator"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=sys-apps/portage-2.1
+ app-shells/bash
+ !sys-devel/crossdev-wrappers"
+DEPEND="app-arch/xz-utils"
+
+src_install() {
+ default
+ if [[ "${PV}" == "99999999" ]] ; then
+ sed -i "s:@CDEVPV@:${EGIT_VERSION}:" "${ED}"/usr/bin/crossdev || die
+ fi
+}
diff --git a/sys-devel/crossdev/crossdev-20150525.ebuild b/sys-devel/crossdev/crossdev-20150525.ebuild
new file mode 100644
index 000000000000..ad0c72a50b39
--- /dev/null
+++ b/sys-devel/crossdev/crossdev-20150525.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/crossdev.git"
+ inherit git-2
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="Gentoo Cross-toolchain generator"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=sys-apps/portage-2.1
+ app-shells/bash
+ !sys-devel/crossdev-wrappers"
+DEPEND="app-arch/xz-utils"
+
+src_install() {
+ default
+ if [[ "${PV}" == "99999999" ]] ; then
+ sed -i "s:@CDEVPV@:${EGIT_VERSION}:" "${ED}"/usr/bin/crossdev || die
+ fi
+}
diff --git a/sys-devel/crossdev/crossdev-20150526.ebuild b/sys-devel/crossdev/crossdev-20150526.ebuild
new file mode 100644
index 000000000000..ad0c72a50b39
--- /dev/null
+++ b/sys-devel/crossdev/crossdev-20150526.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/crossdev.git"
+ inherit git-2
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="Gentoo Cross-toolchain generator"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=sys-apps/portage-2.1
+ app-shells/bash
+ !sys-devel/crossdev-wrappers"
+DEPEND="app-arch/xz-utils"
+
+src_install() {
+ default
+ if [[ "${PV}" == "99999999" ]] ; then
+ sed -i "s:@CDEVPV@:${EGIT_VERSION}:" "${ED}"/usr/bin/crossdev || die
+ fi
+}
diff --git a/sys-devel/crossdev/crossdev-20150527.ebuild b/sys-devel/crossdev/crossdev-20150527.ebuild
new file mode 100644
index 000000000000..ad0c72a50b39
--- /dev/null
+++ b/sys-devel/crossdev/crossdev-20150527.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/crossdev.git"
+ inherit git-2
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="Gentoo Cross-toolchain generator"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=sys-apps/portage-2.1
+ app-shells/bash
+ !sys-devel/crossdev-wrappers"
+DEPEND="app-arch/xz-utils"
+
+src_install() {
+ default
+ if [[ "${PV}" == "99999999" ]] ; then
+ sed -i "s:@CDEVPV@:${EGIT_VERSION}:" "${ED}"/usr/bin/crossdev || die
+ fi
+}
diff --git a/sys-devel/crossdev/crossdev-20150602.ebuild b/sys-devel/crossdev/crossdev-20150602.ebuild
new file mode 100644
index 000000000000..5721bc281c70
--- /dev/null
+++ b/sys-devel/crossdev/crossdev-20150602.ebuild
@@ -0,0 +1,36 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/crossdev.git"
+ inherit git-2
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+ KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="Gentoo Cross-toolchain generator"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=sys-apps/portage-2.1
+ >=app-portage/portage-utils-0.55
+ app-shells/bash
+ !sys-devel/crossdev-wrappers"
+DEPEND="app-arch/xz-utils"
+
+src_install() {
+ default
+ if [[ "${PV}" == "99999999" ]] ; then
+ sed -i "s:@CDEVPV@:${EGIT_VERSION}:" "${ED}"/usr/bin/crossdev || die
+ fi
+}
diff --git a/sys-devel/crossdev/crossdev-20150716.ebuild b/sys-devel/crossdev/crossdev-20150716.ebuild
new file mode 100644
index 000000000000..ebaf57449100
--- /dev/null
+++ b/sys-devel/crossdev/crossdev-20150716.ebuild
@@ -0,0 +1,36 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/crossdev.git"
+ inherit git-2
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="Gentoo Cross-toolchain generator"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=sys-apps/portage-2.1
+ >=app-portage/portage-utils-0.55
+ app-shells/bash
+ !sys-devel/crossdev-wrappers"
+DEPEND="app-arch/xz-utils"
+
+src_install() {
+ default
+ if [[ "${PV}" == "99999999" ]] ; then
+ sed -i "s:@CDEVPV@:${EGIT_VERSION}:" "${ED}"/usr/bin/crossdev || die
+ fi
+}
diff --git a/sys-devel/crossdev/crossdev-99999999.ebuild b/sys-devel/crossdev/crossdev-99999999.ebuild
new file mode 100644
index 000000000000..ebaf57449100
--- /dev/null
+++ b/sys-devel/crossdev/crossdev-99999999.ebuild
@@ -0,0 +1,36 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/crossdev.git"
+ inherit git-2
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+fi
+
+DESCRIPTION="Gentoo Cross-toolchain generator"
+HOMEPAGE="http://www.gentoo.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=sys-apps/portage-2.1
+ >=app-portage/portage-utils-0.55
+ app-shells/bash
+ !sys-devel/crossdev-wrappers"
+DEPEND="app-arch/xz-utils"
+
+src_install() {
+ default
+ if [[ "${PV}" == "99999999" ]] ; then
+ sed -i "s:@CDEVPV@:${EGIT_VERSION}:" "${ED}"/usr/bin/crossdev || die
+ fi
+}
diff --git a/sys-devel/crossdev/metadata.xml b/sys-devel/crossdev/metadata.xml
new file mode 100644
index 000000000000..33d712344513
--- /dev/null
+++ b/sys-devel/crossdev/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>embedded</herd>
+<herd>toolchain</herd>
+<maintainer>
+<email>vapier@gentoo.org</email>
+</maintainer>
+</pkgmetadata>
diff --git a/sys-devel/ct-ng/Manifest b/sys-devel/ct-ng/Manifest
new file mode 100644
index 000000000000..440460d00c6c
--- /dev/null
+++ b/sys-devel/ct-ng/Manifest
@@ -0,0 +1,3 @@
+DIST crosstool-ng-1.19.0.tar.bz2 1901456 SHA256 cd54f20bb8190533b21c9cf7f93c9073c22d59541f52774c3f3053264ba53a93 SHA512 ad9a1763a3178acf028f36c189d4588372c325d4494ec90cb4fccc5a889a89595cc85586f0380bed8238cff4ce07e49ef5f47779048da2956d3bf380bd4d2f17 WHIRLPOOL d2d1f03f05809e6c3607edd9901cfafae56a3158f8273736929a9a282ed5830d07efa116d8e606471fe598ed9cfdc0157627c4cef5e77ccdb55853632faf3a95
+DIST crosstool-ng-1.20.0.tar.bz2 2035181 SHA256 bfb1d251a3b5dbd262f6eb8416532b9920bb7f122ae4fb861a1824fe30c73464 SHA512 42aa93fbdfb2daa9055d7aeba7539a59960caad9d674fb3ca8ed74353da75a49a799896777cf9511a54b4d47de0cb5d206fd7c5200f19067f9c8090a46b39653 WHIRLPOOL 8b8a025567d5af29142c0809aca62230951b080db889b8f3073a87925d12d971e42bd42b42ff2221ea9fd85d229b43d24e15d0d736c5c696708e9b76651c2cb7
+DIST crosstool-ng-1.21.0.tar.bz2 19883048 SHA256 c64493dd033dee0eb25903e66cf53ff5113ee33d193a8ff1df7ebebe47bdac46 SHA512 ab2e341a920f43ef4c621579777b7e709b773dd38aeb68f2b1b567652497b912666ab841ff501f406c34b266e8dbe7859d67f63471972a2200044824848cf061 WHIRLPOOL 4d869c25741700afe4e9e398a8e124acd8cb513eba5609b85980c921966b08ac16ec2a884ed2a885fd44acdbbda01ff05623bce609152bcec5fa14b2c632202c
diff --git a/sys-devel/ct-ng/ct-ng-1.19.0-r1.ebuild b/sys-devel/ct-ng/ct-ng-1.19.0-r1.ebuild
new file mode 100644
index 000000000000..e953beb7ff14
--- /dev/null
+++ b/sys-devel/ct-ng/ct-ng-1.19.0-r1.ebuild
@@ -0,0 +1,44 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit autotools bash-completion-r1 eutils
+
+DESCRIPTION="crosstool-ng is a tool to build cross-compiling toolchains"
+HOMEPAGE="http://crosstool-ng.org"
+MY_P=${P/ct/crosstool}
+S=${WORKDIR}/${MY_P}
+SRC_URI="http://ymorin.is-a-geek.org/download/crosstool-ng/${MY_P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc"
+
+RDEPEND="net-misc/curl
+ dev-util/gperf
+ dev-vcs/cvs
+ dev-vcs/subversion"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-kconfig-respect-flags.patch
+
+ #Upstream provides ${S}/bootstrap which runs autoconf -Wall --force
+ #We'll use eautoconf to be portage friendly
+ eautoconf -Wall --force
+}
+
+src_configure () {
+ econf --with-install="/usr/bin/install"
+}
+
+src_install() {
+ emake DESTDIR="${D%/}" install
+ newbashcomp ${PN}.comp ${PN}
+ dodoc README TODO
+ use doc && mv "${D}"/usr/share/doc/crosstool-ng/"${PN}.${PVR}"/* \
+ "${D}"/usr/share/doc/"${PF}"
+ rm -rf "${D}"/usr/share/doc/crosstool-ng
+}
diff --git a/sys-devel/ct-ng/ct-ng-1.20.0-r1.ebuild b/sys-devel/ct-ng/ct-ng-1.20.0-r1.ebuild
new file mode 100644
index 000000000000..e953beb7ff14
--- /dev/null
+++ b/sys-devel/ct-ng/ct-ng-1.20.0-r1.ebuild
@@ -0,0 +1,44 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit autotools bash-completion-r1 eutils
+
+DESCRIPTION="crosstool-ng is a tool to build cross-compiling toolchains"
+HOMEPAGE="http://crosstool-ng.org"
+MY_P=${P/ct/crosstool}
+S=${WORKDIR}/${MY_P}
+SRC_URI="http://ymorin.is-a-geek.org/download/crosstool-ng/${MY_P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc"
+
+RDEPEND="net-misc/curl
+ dev-util/gperf
+ dev-vcs/cvs
+ dev-vcs/subversion"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-kconfig-respect-flags.patch
+
+ #Upstream provides ${S}/bootstrap which runs autoconf -Wall --force
+ #We'll use eautoconf to be portage friendly
+ eautoconf -Wall --force
+}
+
+src_configure () {
+ econf --with-install="/usr/bin/install"
+}
+
+src_install() {
+ emake DESTDIR="${D%/}" install
+ newbashcomp ${PN}.comp ${PN}
+ dodoc README TODO
+ use doc && mv "${D}"/usr/share/doc/crosstool-ng/"${PN}.${PVR}"/* \
+ "${D}"/usr/share/doc/"${PF}"
+ rm -rf "${D}"/usr/share/doc/crosstool-ng
+}
diff --git a/sys-devel/ct-ng/ct-ng-1.21.0.ebuild b/sys-devel/ct-ng/ct-ng-1.21.0.ebuild
new file mode 100644
index 000000000000..f63d6ec98e0d
--- /dev/null
+++ b/sys-devel/ct-ng/ct-ng-1.21.0.ebuild
@@ -0,0 +1,44 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit autotools bash-completion-r1 eutils
+
+DESCRIPTION="crosstool-ng is a tool to build cross-compiling toolchains"
+HOMEPAGE="http://crosstool-ng.org"
+MY_P=${P/ct/crosstool}
+S=${WORKDIR}
+SRC_URI="http://ymorin.is-a-geek.org/download/crosstool-ng/${MY_P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc"
+
+RDEPEND="net-misc/curl
+ dev-util/gperf
+ dev-vcs/cvs
+ dev-vcs/subversion"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-kconfig-respect-flags.patch
+
+ #Upstream provides ${S}/bootstrap which runs autoconf -Wall --force
+ #We'll use eautoconf to be portage friendly
+ eautoconf -Wall --force
+}
+
+src_configure () {
+ econf --with-install="/usr/bin/install"
+}
+
+src_install() {
+ emake DESTDIR="${D%/}" install
+ newbashcomp ${PN}.comp ${PN}
+ dodoc README TODO
+ use doc && mv "${D}"/usr/share/doc/crosstool-ng/"${PN}.${PVR}"/* \
+ "${D}"/usr/share/doc/"${PF}"
+ rm -rf "${D}"/usr/share/doc/crosstool-ng
+}
diff --git a/sys-devel/ct-ng/files/ct-ng-kconfig-respect-flags.patch b/sys-devel/ct-ng/files/ct-ng-kconfig-respect-flags.patch
new file mode 100644
index 000000000000..e6b48142a6df
--- /dev/null
+++ b/sys-devel/ct-ng/files/ct-ng-kconfig-respect-flags.patch
@@ -0,0 +1,14 @@
+diff -Naur crosstool-ng-1.15.3.orig//kconfig/Makefile crosstool-ng-1.15.3/kconfig/Makefile
+--- crosstool-ng-1.15.3.orig//kconfig/Makefile 2012-07-17 16:39:55.000000000 -0400
++++ crosstool-ng-1.15.3/kconfig/Makefile 2012-08-07 12:06:59.000000000 -0400
+@@ -6,8 +6,8 @@
+ @true # Just be silent, you fscking son of a fscking beach...
+
+ # Build flags
+-CFLAGS = -DCONFIG_=\"CT_\" -DPACKAGE="\"crosstool-NG $(VERSION)\""
+-LDFLAGS =
++CFLAGS += -DCONFIG_=\"CT_\" -DPACKAGE="\"crosstool-NG $(VERSION)\""
++#LDFLAGS =
+
+ # Compiler flags to use gettext
+ ifeq ($(gettext),)
diff --git a/sys-devel/ct-ng/metadata.xml b/sys-devel/ct-ng/metadata.xml
new file mode 100644
index 000000000000..ba79d94bdc79
--- /dev/null
+++ b/sys-devel/ct-ng/metadata.xml
@@ -0,0 +1,21 @@
+<?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>
+ <maintainer>
+ <email>hwoarang@gentoo.org</email>
+ <name>Markos Chandras</name>
+ </maintainer>
+ <longdescription lang="en">
+ crosstool-NG is a utility for building cross-compiling toolchains.
+ It will only build the toolchain. It is up to use how you want to
+ use it after that.
+
+ It is an alternative to sys-devel/crossdev.
+
+ For more information, see http://ymorin.is-a-geek.org/projects/crosstool
+ </longdescription>
+</pkgmetadata>
diff --git a/sys-devel/dev86/Manifest b/sys-devel/dev86/Manifest
new file mode 100644
index 000000000000..c5956c02ab29
--- /dev/null
+++ b/sys-devel/dev86/Manifest
@@ -0,0 +1,2 @@
+DIST Dev86src-0.16.19.tar.gz 713688 SHA256 33398b87ca85e2b69e4062cf59f2f7354af46da5edcba036c6f97bae17b8d00e SHA512 4077f7ac800330eb4658ffaa53dc8cc982792b1dcd7a59625cba4a5dac494117c6bd4ec5307bf02349ad6ae3d0c0903ab2e41123a8df94373e469092fa005cd3 WHIRLPOOL 87862b606be25f81c2c487534f36b20ac04d1df4303d644a46563e9f382686574dbe650c80265d44e53913f5bda7503c35cf056f7ffd8c5e559729e36c9db4d2
+DIST Dev86src-0.16.21.tar.gz 717215 SHA256 234b110e6df9b7f6843e2ee53473127c2211243a16748f229fc0127845f68d94 SHA512 6d35dc3c7f9735cf7967cdb2bc0f7bee967ae26667cd8cef56bbdf7d7855ef1d35057db4c0031ff86b9b95d3c8ee44aff408446115b35b6c10cf207a33838016 WHIRLPOOL a60b6c30bf4367e250942d2debe4baaf139908adf2f3b97139e3b29788d1ae8a1c97c63c016bf0c546336458de95e390b2db9e3d525ec4526f86250ad3538a8f
diff --git a/sys-devel/dev86/dev86-0.16.19.ebuild b/sys-devel/dev86/dev86-0.16.19.ebuild
new file mode 100644
index 000000000000..9f6a3b28c115
--- /dev/null
+++ b/sys-devel/dev86/dev86-0.16.19.ebuild
@@ -0,0 +1,78 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils multilib
+
+DESCRIPTION="Bruce's C compiler - Simple C compiler to generate 8086 code"
+HOMEPAGE="http://www.debath.co.uk/"
+SRC_URI="http://www.debath.co.uk/dev86/Dev86src-${PV}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE=""
+
+RDEPEND="sys-devel/bin86"
+DEPEND="${RDEPEND}
+ dev-util/gperf"
+
+STRIP_MASK="/usr/*/bcc/lib*.a /usr/*/i386/libc.a"
+
+src_prepare() {
+ # elksemu doesn't compile under amd64
+ if use amd64; then
+ einfo "Not compiling elksemu on amd64"
+ sed -i \
+ -e 's,alt-libs elksemu,alt-libs,' \
+ -e 's,install-lib install-emu,install-lib,' \
+ makefile.in || die
+ fi
+
+ epatch "${FILESDIR}"/dev86-pic.patch
+ epatch "${FILESDIR}"/${PN}-0.16.19-fortify.patch
+ epatch "${FILESDIR}"/${PN}-0.16.19-memmove.patch #354351
+ sed -i \
+ -e "s:-O2 -g:${CFLAGS}:" \
+ -e '/INEXE=/s:-s::' \
+ makefile.in || die
+ sed -i \
+ -e "s:/lib/:/$(get_libdir)/:" \
+ bcc/bcc.c || die
+ sed -i -e '/INSTALL_OPTS=/s:-s::' bin86/Makefile || die
+ sed -i -e '/install -m 755 -s/s:-s::' dis88/Makefile || die
+}
+
+src_compile() {
+ # Don't mess with CPPFLAGS as they tend to break compilation
+ # (bug #343655).
+ CPPFLAGS=""
+
+ # First `make` is also a config, so set all the path vars here
+ emake -j1 \
+ DIST="${D}" \
+ CC="$(tc-getCC)" \
+ LIBDIR="/usr/$(get_libdir)/bcc" \
+ INCLDIR="/usr/$(get_libdir)/bcc"
+
+ export PATH=${S}/bin:${PATH}
+ cd bin
+ ln -s ncc bcc
+ cd ..
+ cd bootblocks
+ ln -s ../bcc/version.h .
+ emake DIST="${D}"
+}
+
+src_install() {
+ emake -j1 install-all DIST="${D}"
+ dobin bootblocks/makeboot
+ # remove all the stuff supplied by bin86
+ cd "${D}"
+ rm usr/bin/{as,ld,nm,objdump,size}86 || die
+ rm usr/man/man1/{as,ld}86.1 || die
+ dodir /usr/share/man
+ mv usr/man usr/share/
+}
diff --git a/sys-devel/dev86/dev86-0.16.21.ebuild b/sys-devel/dev86/dev86-0.16.21.ebuild
new file mode 100644
index 000000000000..744d1137ab55
--- /dev/null
+++ b/sys-devel/dev86/dev86-0.16.21.ebuild
@@ -0,0 +1,77 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils multilib
+
+DESCRIPTION="Bruce's C compiler - Simple C compiler to generate 8086 code"
+HOMEPAGE="http://v3.sk/~lkundrak/dev86/"
+SRC_URI="http://v3.sk/~lkundrak/dev86/Dev86src-${PV}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~x86"
+IUSE=""
+
+RDEPEND="sys-devel/bin86"
+DEPEND="${RDEPEND}
+ dev-util/gperf"
+
+STRIP_MASK="/usr/*/bcc/lib*.a /usr/*/i386/libc.a"
+
+src_prepare() {
+ # elksemu doesn't compile under amd64
+ if use amd64; then
+ einfo "Not compiling elksemu on amd64"
+ sed -i \
+ -e 's,alt-libs elksemu,alt-libs,' \
+ -e 's,install-lib install-emu,install-lib,' \
+ makefile.in || die
+ fi
+
+ epatch "${FILESDIR}"/dev86-pic.patch
+ epatch "${FILESDIR}"/${PN}-0.16.19-fortify.patch
+ sed -i \
+ -e "s:-O2 -g:${CFLAGS}:" \
+ -e '/INEXE=/s:-s::' \
+ makefile.in || die
+ sed -i \
+ -e "s:/lib/:/$(get_libdir)/:" \
+ bcc/bcc.c || die
+ sed -i -e '/INSTALL_OPTS=/s:-s::' bin86/Makefile || die
+ sed -i -e '/install -m 755 -s/s:-s::' dis88/Makefile || die
+}
+
+src_compile() {
+ # Don't mess with CPPFLAGS as they tend to break compilation
+ # (bug #343655).
+ CPPFLAGS=""
+
+ # First `make` is also a config, so set all the path vars here
+ emake -j1 \
+ DIST="${D}" \
+ CC="$(tc-getCC)" \
+ LIBDIR="/usr/$(get_libdir)/bcc" \
+ INCLDIR="/usr/$(get_libdir)/bcc"
+
+ export PATH=${S}/bin:${PATH}
+ cd bin
+ ln -s ncc bcc
+ cd ..
+ cd bootblocks
+ ln -s ../bcc/version.h .
+ emake DIST="${D}"
+}
+
+src_install() {
+ emake -j1 install-all DIST="${D}"
+ dobin bootblocks/makeboot
+ # remove all the stuff supplied by bin86
+ cd "${D}"
+ rm usr/bin/{as,ld,nm,objdump,size}86 || die
+ rm usr/man/man1/{as,ld}86.1 || die
+ dodir /usr/share/man
+ mv usr/man usr/share/
+}
diff --git a/sys-devel/dev86/files/dev86-0.16.17-fortify.patch b/sys-devel/dev86/files/dev86-0.16.17-fortify.patch
new file mode 100644
index 000000000000..715d0c4ca687
--- /dev/null
+++ b/sys-devel/dev86/files/dev86-0.16.17-fortify.patch
@@ -0,0 +1,43 @@
+--- dev86-0.16.17/bcc/bcc.c
++++ dev86-0.16.17/bcc/bcc.c
+@@ -19,6 +19,7 @@
+ #ifdef __STDC__
+ #include <stdlib.h>
+ #ifndef MSDOS
++#include <limits.h>
+ #include <unistd.h>
+ #endif
+ #else
+@@ -596,12 +597,17 @@
+ }
+ }
+
+-void
+-command_reset()
+-{
+ #ifndef MAXPATHLEN
++#ifdef PATH_MAX
++#define MAXPATHLEN PATH_MAX
++#else
+ #define MAXPATHLEN 1024
+ #endif
++#endif
++
++void
++command_reset()
++{
+ char buf[MAXPATHLEN];
+ char ** prefix;
+ char * saved_cmd;
+@@ -1308,11 +1314,7 @@
+
+ for(d=s=ptr; d && *s; s=d)
+ {
+-#ifdef MAXPATHLEN
+ char buf[MAXPATHLEN];
+-#else
+- char buf[1024];
+-#endif
+
+ free(temp);
+ d=strchr(s, ':');
diff --git a/sys-devel/dev86/files/dev86-0.16.17-make382.patch b/sys-devel/dev86/files/dev86-0.16.17-make382.patch
new file mode 100644
index 000000000000..e7ce0651c6b3
--- /dev/null
+++ b/sys-devel/dev86/files/dev86-0.16.17-make382.patch
@@ -0,0 +1,11 @@
+--- libc/i386sys/Makefile
++++ libc/i386sys/Makefile
+@@ -12,7 +12,7 @@
+ DOBJ=opendir.o closedir.o readdir.o
+
+ ifeq ($(LIB_CPU)-$(LIB_OS),i386-ELKS)
+-OBJ=$(LOBJ3) $(LOBJ) $(EOBJ) $(DOBJ) setjmp3.o
++OBJ=$(LOBJ) $(LOBJ) $(EOBJ) $(DOBJ) setjmp3.o
+ SYSCALLS=syscalls
+
+ CFLAGS=$(ARCH) $(CCFLAGS) $(DEFS)
diff --git a/sys-devel/dev86/files/dev86-0.16.19-fortify.patch b/sys-devel/dev86/files/dev86-0.16.19-fortify.patch
new file mode 100644
index 000000000000..366808c96d20
--- /dev/null
+++ b/sys-devel/dev86/files/dev86-0.16.19-fortify.patch
@@ -0,0 +1,23 @@
+--- dev86-0.16.19/bcc/bcc.c
++++ dev86-0.16.19/bcc/bcc.c
+@@ -596,12 +597,17 @@
+ }
+ }
+
+-void
+-command_reset()
+-{
+ #ifndef MAXPATHLEN
++#ifdef PATH_MAX
++#define MAXPATHLEN PATH_MAX
++#else
+ #define MAXPATHLEN 1024
+ #endif
++#endif
++
++void
++command_reset()
++{
+ char buf[MAXPATHLEN];
+ char ** prefix;
+ char * saved_cmd;
diff --git a/sys-devel/dev86/files/dev86-0.16.19-memmove.patch b/sys-devel/dev86/files/dev86-0.16.19-memmove.patch
new file mode 100644
index 000000000000..12df3f672624
--- /dev/null
+++ b/sys-devel/dev86/files/dev86-0.16.19-memmove.patch
@@ -0,0 +1,17 @@
+https://bugs.gentoo.org/354351
+
+fix sniped from Debian:
+* Fix "FTBFS: ncc: illegal label": apply patch by dai that replaces strcpy
+ by memmove (closes: #591133).
+
+--- copt/copt.c
++++ copt/copt.c
+@@ -174,7 +174,7 @@
+ /* Delete leading white spaces */
+ for (cp = buf; *cp && isspace(*cp); cp++) ;
+ if (cp != buf && *cp)
+- strcpy(buf, cp);
++ memmove(buf, cp, strlen(cp) + 1);
+
+ return(buf);
+ }
diff --git a/sys-devel/dev86/files/dev86-pic.patch b/sys-devel/dev86/files/dev86-pic.patch
new file mode 100644
index 000000000000..439c2648b7d2
--- /dev/null
+++ b/sys-devel/dev86/files/dev86-pic.patch
@@ -0,0 +1,20 @@
+--- elksemu/elks.c.orig 2005-11-04 01:35:37.000000000 +0100
++++ elksemu/elks.c 2005-11-04 01:45:28.000000000 +0100
+@@ -129,8 +129,17 @@
+ static inline int vm86_mine(struct vm86_struct* v86)
+ {
+ int __res;
++#ifndef __PIC__
+ __asm__ __volatile__("int $0x80\n"
+ :"=a" (__res):"a" ((int)OLD_SYS_vm86), "b" ((int)v86));
++#else
++ __asm__ __volatile__(
++ "movl %%ebx,%%ecx\n\t"
++ "movl %2,%%ebx\n\t"
++ "int $0x80\n\t"
++ "movl %%ecx,%%ebx\n\t"
++ :"=a" (__res):"a" ((int)OLD_SYS_vm86), "r" ((int)v86) : "ecx");
++#endif
+ return __res;
+ }
+ #endif
diff --git a/sys-devel/dev86/metadata.xml b/sys-devel/dev86/metadata.xml
new file mode 100644
index 000000000000..756af1afbc6f
--- /dev/null
+++ b/sys-devel/dev86/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>maintainer-needed@gentoo.org</email>
+ </maintainer>
+ <longdescription>
+ Bruce's C compiler - Simple C compiler to generate 8086 code
+ </longdescription>
+</pkgmetadata>
diff --git a/sys-devel/distcc/Manifest b/sys-devel/distcc/Manifest
new file mode 100644
index 000000000000..6e94e6a899ea
--- /dev/null
+++ b/sys-devel/distcc/Manifest
@@ -0,0 +1,2 @@
+DIST distcc-3.1.tar.bz2 588820 SHA256 f55dbafd76bed3ce57e1bbcdab1329227808890d90f4c724fcd2d53f934ddd89 SHA512 0ca7167309badf5d36d2783bab398295b52c43fde0355cf1902032c70b27fc40c21729c98af0ee4c0aeea0c48755e4626308e9385d938b7822de27cdb048e7bd WHIRLPOOL 9152feab2b7def17606259293fe7af7815ec295defa0287b7e5c054f17b0cb73d07f6e721855fd06eec4fc838c44ff509db20fc89c47871f7f1349e08cd126bd
+DIST distcc-3.2rc1.tar.bz2 609904 SHA256 311671e844625d7fdb18dd3d096cd855751cfe8de13827682bcb7beff9133b30 SHA512 98b2e8423d724bbb6a615d946d170441a8e293310785f867d7a277b318c043a37b0af39ae8ed1f7a0667803de9db1d1925199bad85130cf9bd9cb347635125ee WHIRLPOOL d366abb05d10aa5a458acf7b57f5bf52fd4f5ff46c68494e28140eb944524e66d729ebef60190acb1d9b33a0fb8faea6b909509de67294c29dbebcf01d500a36
diff --git a/sys-devel/distcc/distcc-3.1-r10.ebuild b/sys-devel/distcc/distcc-3.1-r10.ebuild
new file mode 100644
index 000000000000..8203e217c7ee
--- /dev/null
+++ b/sys-devel/distcc/distcc-3.1-r10.ebuild
@@ -0,0 +1,174 @@
+# 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 fdo-mime flag-o-matic multilib python-single-r1 systemd toolchain-funcs user
+
+DESCRIPTION="Distribute compilation of C code across several machines on a network"
+HOMEPAGE="http://distcc.org/"
+SRC_URI="http://distcc.googlecode.com/files/${P}.tar.bz2"
+
+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="avahi gtk hardened ipv6 selinux xinetd"
+
+RESTRICT="test"
+
+CDEPEND="${PYTHON_DEPS}
+ dev-libs/popt
+ avahi? ( >=net-dns/avahi-0.6[dbus] )
+ gtk? ( x11-libs/gtk+:2 )"
+DEPEND="${CDEPEND}
+ virtual/pkgconfig"
+RDEPEND="${CDEPEND}
+ !net-misc/pump
+ >=sys-devel/gcc-config-1.4.1
+ selinux? ( sec-policy/selinux-distcc )
+ xinetd? ( sys-apps/xinetd )"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+DISTCC_LOG=""
+DCCC_PATH="/usr/$(get_libdir)/distcc/bin"
+DISTCC_VERBOSE="0"
+
+pkg_setup() {
+ enewuser distcc 240 -1 -1 daemon
+ python-single-r1_pkg_setup
+}
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}-3.0-xinetd.patch"
+ # bug #253786
+ epatch "${FILESDIR}/${PN}-3.0-fix-fortify.patch"
+ # bug #255188
+ epatch "${FILESDIR}/${P}-freedesktop.patch"
+ # bug #258364
+ epatch "${FILESDIR}/${P}-python.patch"
+ # bug #351979
+ epatch "${FILESDIR}/${P}-argc-fix.patch"
+ epatch_user
+
+ sed -i -e "/PATH/s:\$distcc_location:${DCCC_PATH}:" pump.in || die
+
+ # Bugs #120001, #167844 and probably more. See patch for description.
+ use hardened && epatch "${FILESDIR}/distcc-hardened.patch"
+}
+
+src_configure() {
+ local myconf="--disable-Werror --with-docdir=/usr/share/doc/${PF}"
+ # More legacy stuff?
+ [ "$(gcc-major-version)" = "2" ] && filter-lfs-flags
+
+ # --disable-rfc2553 b0rked, bug #254176
+ use ipv6 && myconf="${myconf} --enable-rfc2553"
+
+ econf \
+ $(use_with avahi) \
+ $(use_with gtk) \
+ ${myconf}
+}
+
+src_install() {
+ # In rare cases, parallel make install failed
+ MAKEOPTS+=" -j1"
+ default
+
+ dobin "${FILESDIR}/3.0/distcc-config"
+
+ newinitd "${FILESDIR}/${PV}/init" distccd
+ systemd_dounit "${FILESDIR}/distccd.service"
+ systemd_install_serviced "${FILESDIR}/distccd.service.conf"
+
+ cp "${FILESDIR}/3.1/conf" "${T}/distccd" || die
+ if use avahi; then
+ cat >> "${T}/distccd" <<-EOF
+
+ # Enable zeroconf support in distccd
+ DISTCCD_OPTS="\${DISTCCD_OPTS} --zeroconf"
+ EOF
+
+ sed -i '/ExecStart/ s|$| --zeroconf|' "${ED}"/usr/lib/systemd/system/distccd.service || die
+ fi
+ doconfd "${T}/distccd"
+
+ cat > "${T}/02distcc" <<-EOF
+ # This file is managed by distcc-config; use it to change these settings.
+ DISTCC_LOG="${DISTCC_LOG}"
+ DCCC_PATH="${DCCC_PATH}"
+ DISTCC_VERBOSE="${DISTCC_VERBOSE}"
+ EOF
+ doenvd "${T}/02distcc"
+
+ # create the masquerade directory
+ dodir "${DCCC_PATH}"
+ for f in cc c++ gcc g++; do
+ dosym /usr/bin/distcc "${DCCC_PATH}/${f}"
+ if [ "${f}" != "cc" ]; then
+ dosym /usr/bin/distcc "${DCCC_PATH}/${CTARGET:-${CHOST}}-${f}"
+ fi
+ done
+
+ # create the distccd pid directory
+ keepdir /var/run/distccd
+ fowners distcc:daemon /var/run/distccd
+
+ if use gtk; then
+ einfo "Renaming /usr/bin/distccmon-gnome to /usr/bin/distccmon-gui"
+ einfo "This is to have a little sensability in naming schemes between distccmon programs"
+ mv "${ED}/usr/bin/distccmon-gnome" "${ED}/usr/bin/distccmon-gui" || die
+ dosym distccmon-gui /usr/bin/distccmon-gnome
+ fi
+
+ if use xinetd; then
+ insinto /etc/xinetd.d
+ newins "doc/example/xinetd" distcc
+ fi
+
+ rm -rf "${D}/etc/default" || die
+ rm -f "${D}/etc/distcc/clients.allow" || die
+ rm -f "${D}/etc/distcc/commands.allow.sh" || die
+
+ python_fix_shebang "${ED}"
+ python_optimize "${ED}"/$(python_get_sitedir)
+}
+
+pkg_postinst() {
+ use gtk && fdo-mime_desktop_database_update
+
+ if use ipv6; then
+ elog
+ elog "IPv6 is not supported yet by ${P}."
+ fi
+ elog
+ elog "Tips on using distcc with Gentoo can be found at"
+ elog "http://www.gentoo.org/doc/en/distcc.xml"
+ elog
+ elog "How to use pump mode with Gentoo:"
+ elog "# distcc-config --set-hosts \"foo,cpp,lzo bar,cpp,lzo baz,cpp,lzo\""
+ elog "# pump emerge -u world"
+ elog
+ elog "To use the distccmon programs with Gentoo you should use this command:"
+ elog "# DISTCC_DIR=\"${DISTCC_DIR}\" distccmon-text 5"
+
+ if use gtk; then
+ elog "Or:"
+ elog "# DISTCC_DIR=\"${DISTCC_DIR}\" distccmon-gnome"
+ fi
+
+ elog
+ elog "***SECURITY NOTICE***"
+ elog "If you are upgrading distcc please make sure to run etc-update to"
+ elog "update your /etc/conf.d/distccd and /etc/init.d/distccd files with"
+ elog "added security precautions (the --listen and --allow directives)"
+ elog
+}
+
+pkg_postrm() {
+ use gtk && fdo-mime_desktop_database_update
+}
diff --git a/sys-devel/distcc/distcc-3.2_rc1-r3.ebuild b/sys-devel/distcc/distcc-3.2_rc1-r3.ebuild
new file mode 100644
index 000000000000..ed7e734872c2
--- /dev/null
+++ b/sys-devel/distcc/distcc-3.2_rc1-r3.ebuild
@@ -0,0 +1,207 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 )
+
+inherit autotools eutils fdo-mime flag-o-matic multilib python-single-r1 systemd toolchain-funcs user
+
+MY_P="${P/_}"
+DESCRIPTION="Distribute compilation of C code across several machines on a network"
+HOMEPAGE="http://distcc.org/"
+SRC_URI="http://distcc.googlecode.com/files/${MY_P}.tar.bz2"
+
+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="avahi crossdev gnome gssapi gtk hardened ipv6 selinux xinetd"
+
+RESTRICT="test"
+
+CDEPEND="${PYTHON_DEPS}
+ dev-libs/popt
+ avahi? ( >=net-dns/avahi-0.6[dbus] )
+ gnome? (
+ >=gnome-base/libgnome-2
+ >=gnome-base/libgnomeui-2
+ x11-libs/gtk+:2
+ x11-libs/pango
+ )
+ gssapi? ( net-libs/libgssglue )
+ gtk? ( x11-libs/gtk+:2 )"
+DEPEND="${CDEPEND}
+ virtual/pkgconfig"
+RDEPEND="${CDEPEND}
+ !net-misc/pump
+ >=sys-devel/gcc-config-1.4.1
+ selinux? ( sec-policy/selinux-distcc )
+ xinetd? ( sys-apps/xinetd )"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+S="${WORKDIR}/${MY_P}"
+
+DCCC_PATH="/usr/$(get_libdir)/distcc/bin"
+DISTCC_VERBOSE="0"
+
+pkg_setup() {
+ enewuser distcc 240 -1 -1 daemon
+ python-single-r1_pkg_setup
+}
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}-3.0-xinetd.patch"
+ # bug #253786
+ epatch "${FILESDIR}/${PN}-3.0-fix-fortify.patch"
+ # bug #255188
+ epatch "${FILESDIR}/${PN}-3.2_rc1-freedesktop.patch"
+ # bug #258364
+ epatch "${FILESDIR}/${PN}-3.2_rc1-python.patch"
+ # for net-libs/libgssglue
+ epatch "${FILESDIR}/${PN}-3.2_rc1-gssapi.patch"
+ # SOCKSv5 support needed for Portage, bug #537616
+ epatch "${FILESDIR}/${PN}-3.2_rc1-socks5.patch"
+ epatch_user
+
+ # Bugs #120001, #167844 and probably more. See patch for description.
+ use hardened && epatch "${FILESDIR}/distcc-hardened.patch"
+
+ sed -i \
+ -e "/PATH/s:\$distcc_location:${EPREFIX}${DCCC_PATH}:" \
+ -e "s:@PYTHON@:${EPYTHON}:" \
+ pump.in || die "sed failed"
+
+ sed \
+ -e "s:@EPREFIX@:${EPREFIX:-/}:" \
+ -e "s:@libdir@:/usr/$(get_libdir):" \
+ "${FILESDIR}/distcc-config-3.2_rc1" > "${T}/distcc-config" || die
+
+ eaclocal -Im4 --output=aclocal.m4
+ eautoconf
+}
+
+src_configure() {
+ local myconf="--disable-Werror --with-docdir=/usr/share/doc/${PF}"
+ # More legacy stuff?
+ [ "$(gcc-major-version)" = "2" ] && filter-lfs-flags
+
+ # --disable-rfc2553 b0rked, bug #254176
+ use ipv6 && myconf="${myconf} --enable-rfc2553"
+
+ econf \
+ $(use_with avahi) \
+ $(use_with gtk) \
+ $(use_with gnome) \
+ $(use_with gssapi auth) \
+ ${myconf}
+}
+
+src_install() {
+ default
+ python_optimize
+
+ dobin "${FILESDIR}/3.0/distcc-config"
+
+ newinitd "${FILESDIR}/3.1/init" distccd
+ systemd_dounit "${FILESDIR}/distccd.service"
+ systemd_install_serviced "${FILESDIR}/distccd.service.conf"
+
+ cp "${FILESDIR}/3.0/conf" "${T}/distccd" || die
+ if use avahi; then
+ cat >> "${T}/distccd" <<-EOF
+
+ # Enable zeroconf support in distccd
+ DISTCCD_OPTS="\${DISTCCD_OPTS} --zeroconf"
+ EOF
+
+ sed -i '/ExecStart/ s|$| --zeroconf|' "${ED}"/usr/lib/systemd/system/distccd.service || die
+ fi
+ doconfd "${T}/distccd" || die
+
+ cat > "${T}/02distcc" <<-EOF
+ # This file is managed by distcc-config; use it to change these settings.
+ # DISTCC_LOG and DISTCC_DIR should not be set.
+ DISTCC_VERBOSE="${DISTCC_VERBOSE:-0}"
+ DISTCC_FALLBACK="${DISTCC_FALLBACK:-1}"
+ DISTCC_SAVE_TEMPS="${DISTCC_SAVE_TEMPS:-0}"
+ DISTCC_TCP_CORK="${DISTCC_TCP_CORK}"
+ DISTCC_SSH="${DISTCC_SSH}"
+ UNCACHED_ERR_FD="${UNCACHED_ERR_FD}"
+ DISTCC_ENABLE_DISCREPANCY_EMAIL="${DISTCC_ENABLE_DISCREPANCY_EMAIL}"
+ DCC_EMAILLOG_WHOM_TO_BLAME="${DCC_EMAILLOG_WHOM_TO_BLAME}"
+ EOF
+ doenvd "${T}/02distcc" || die
+
+ keepdir "${DCCC_PATH}" || die
+
+ dobin "${T}/distcc-config" || die
+
+ # create the distccd pid directory
+ keepdir /var/run/distccd || die
+ fowners distcc:daemon /var/run/distccd || die
+
+ if use gnome || use gtk; then
+ einfo "Renaming /usr/bin/distccmon-gnome to /usr/bin/distccmon-gui"
+ einfo "This is to have a little sensability in naming schemes between distccmon programs"
+ mv "${ED}/usr/bin/distccmon-gnome" "${ED}/usr/bin/distccmon-gui" || die
+ dosym distccmon-gui /usr/bin/distccmon-gnome || die
+ fi
+
+ if use xinetd; then
+ insinto /etc/xinetd.d || die
+ newins "doc/example/xinetd" distcc || die
+ fi
+
+ rm -r "${ED}/etc/default" || die
+ rm "${ED}/etc/distcc/clients.allow" || die
+ rm "${ED}/etc/distcc/commands.allow.sh" || die
+}
+
+pkg_postinst() {
+ if [ -x "${EPREFIX}/usr/bin/distcc-config" ] ; then
+ if use crossdev; then
+ "${EPREFIX}/usr/bin/distcc-config" --update-masquerade-with-crossdev
+ else
+ "${EPREFIX}/usr/bin/distcc-config" --update-masquerade
+ fi
+ fi
+
+ use gnome && fdo-mime_desktop_database_update
+
+ elog
+ elog "Tips on using distcc with Gentoo can be found at"
+ elog "http://www.gentoo.org/doc/en/distcc.xml"
+ elog
+ elog "How to use pump mode with Gentoo:"
+ elog "# distcc-config --set-hosts \"foo,cpp,lzo bar,cpp,lzo baz,cpp,lzo\""
+ elog "# echo 'FEATURES=\"\${FEATURES} distcc distcc-pump\"' >> /etc/make.conf"
+ elog "# emerge -u world"
+ elog
+ elog "To use the distccmon programs with Gentoo you should use this command:"
+ elog "# DISTCC_DIR=\"${DISTCC_DIR:-${BUILD_PREFIX}/.distcc}\" distccmon-text 5"
+
+ if use gnome || use gtk; then
+ elog "Or:"
+ elog "# DISTCC_DIR=\"${DISTCC_DIR:-${BUILD_PREFIX}/.distcc}\" distccmon-gnome"
+ fi
+
+ elog
+ elog "***SECURITY NOTICE***"
+ elog "If you are upgrading distcc please make sure to run etc-update to"
+ elog "update your /etc/conf.d/distccd and /etc/init.d/distccd files with"
+ elog "added security precautions (the --listen and --allow directives)"
+ elog
+}
+
+pkg_postrm() {
+ # delete the masquerade directory
+ if [ ! -f "${EPREFIX}/usr/bin/distcc" ] ; then
+ einfo "Remove masquerade symbolic links."
+ rm "${EPREFIX}${DCCC_PATH}/"*{cc,c++,gcc,g++}
+ rmdir "${EPREFIX}${DCCC_PATH}"
+ fi
+
+ use gnome && fdo-mime_desktop_database_update
+}
diff --git a/sys-devel/distcc/files/2.18-r1/conf b/sys-devel/distcc/files/2.18-r1/conf
new file mode 100644
index 000000000000..783236aa410f
--- /dev/null
+++ b/sys-devel/distcc/files/2.18-r1/conf
@@ -0,0 +1,45 @@
+# /etc/conf.d/distccd: config file for /etc/init.d/distccd
+
+DISTCCD_OPTS=""
+
+# this is the distccd executable
+DISTCCD_EXEC="/usr/bin/distccd"
+
+# this is where distccd will store its pid file
+DISTCCD_PIDFILE="/var/run/distccd/distccd.pid"
+
+# set this option to run distccd with extra parameters
+# Default port is 3632. For most people the default is okay.
+DISTCCD_OPTS="${DISTCCD_OPTS} --port 3632"
+
+# Logging
+# You can change some logging options here:
+# --log-file FILE
+# --log-level LEVEL [critical,error,warning, notice, info, debug]
+#
+# Leaving --log-file blank will log to syslog
+# example: --log-file /dev/null --log-level warning
+# example: --log-level critical
+
+DISTCCD_OPTS="${DISTCCD_OPTS} --log-level critical"
+
+# SECURITY NOTICE:
+# It is HIGHLY recomended that you use the --listen option
+# for increased security. You can specify an IP to permit connections
+# from or a CIDR mask
+# --listen accepts only a single IP
+# --allow is now mandatory as of distcc-2.18.
+# example: --allow 192.168.0.0/24
+# example: --allow 192.168.0.5 --allow 192.168.0.150
+# example: --listen 192.168.0.2
+DISTCCD_OPTS="${DISTCCD_OPTS} --allow 192.168.0.0/24"
+#DISTCCD_OPTS="${DISTCCD_OPTS} --listen 192.168.0.2"
+
+# set this for niceness
+# Default is 15
+DISTCCD_NICE="15"
+
+#ifdef AVAHI
+# Enable zeroconf support in distccd
+DISTCCD_AVAHI="yes"
+#endif
diff --git a/sys-devel/distcc/files/2.18-r1/init b/sys-devel/distcc/files/2.18-r1/init
new file mode 100644
index 000000000000..7676e9827891
--- /dev/null
+++ b/sys-devel/distcc/files/2.18-r1/init
@@ -0,0 +1,39 @@
+#!/sbin/runscript
+# $Id$
+
+depend() {
+ local avahi
+#ifdef AVAHI
+ [ ${DISTCCD_AVAHI} = yes ] && avahi="avahi-daemon"
+#endif
+ need net ${avahi}
+ use ypbind
+}
+
+start() {
+ [ -e "${DISTCCD_PIDFILE}" ] && rm -f ${DISTCCD_PIDFILE} &>/dev/null
+
+ local args
+#ifdef AVAHI
+ [ ${DISTCCD_AVAHI} = yes ] && args="--zeroconf"
+#endif
+
+ ebegin "Starting distccd"
+ chown distcc `dirname ${DISTCCD_PIDFILE}` &>/dev/null
+ TMPDIR="${TMPDIR}" \
+ PATH="$(gcc-config --get-bin-path):${PATH}" \
+ /sbin/start-stop-daemon --start --quiet --startas ${DISTCCD_EXEC} \
+ --pidfile ${DISTCCD_PIDFILE} -- \
+ --pid-file ${DISTCCD_PIDFILE} -N ${DISTCCD_NICE} --user distcc \
+ ${args} ${DISTCCD_OPTS}
+
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping distccd"
+ start-stop-daemon --stop --quiet --pidfile "${DISTCCD_PIDFILE}"
+ rm -f "${DISTCCD_PIDFILE}"
+ eend $?
+}
+
diff --git a/sys-devel/distcc/files/2.18/conf b/sys-devel/distcc/files/2.18/conf
new file mode 100644
index 000000000000..3f6c3f07fa76
--- /dev/null
+++ b/sys-devel/distcc/files/2.18/conf
@@ -0,0 +1,40 @@
+# /etc/conf.d/distccd: config file for /etc/init.d/distccd
+
+DISTCCD_OPTS=""
+
+# this is the distccd executable
+DISTCCD_EXEC="/usr/bin/distccd"
+
+# this is where distccd will store its pid file
+DISTCCD_PIDFILE="/var/run/distccd/distccd.pid"
+
+# set this option to run distccd with extra parameters
+# Default port is 3632. For most people the default is okay.
+DISTCCD_OPTS="${DISTCCD_OPTS} --port 3632"
+
+# Logging
+# You can change some logging options here:
+# --log-file FILE
+# --log-level LEVEL [critical,error,warning, notice, info, debug]
+#
+# Leaving --log-file blank will log to syslog
+# example: --log-file /dev/null --log-level warning
+# example: --log-level critical
+
+DISTCCD_OPTS="${DISTCCD_OPTS} --log-level critical"
+
+# SECURITY NOTICE:
+# It is HIGHLY recomended that you use the --listen option
+# for increased security. You can specify an IP to permit connections
+# from or a CIDR mask
+# --listen accepts only a single IP
+# --allow is now mandatory as of distcc-2.18.
+# example: --allow 192.168.0.0/24
+# example: --allow 192.168.0.5 --allow 192.168.0.150
+# example: --listen 192.168.0.2
+DISTCCD_OPTS="${DISTCCD_OPTS} --allow 192.168.0.0/24"
+#DISTCCD_OPTS="${DISTCCD_OPTS} --listen 192.168.0.2"
+
+# set this for niceness
+# Default is 15
+DISTCCD_NICE="15"
diff --git a/sys-devel/distcc/files/2.18/init b/sys-devel/distcc/files/2.18/init
new file mode 100644
index 000000000000..f9bf8ed4b86f
--- /dev/null
+++ b/sys-devel/distcc/files/2.18/init
@@ -0,0 +1,30 @@
+#!/sbin/runscript
+# $Id$
+
+depend() {
+ need net
+ use ypbind
+}
+
+start() {
+ [ -e "${DISTCCD_PIDFILE}" ] && rm -f ${DISTCCD_PIDFILE} &>/dev/null
+
+ ebegin "Starting distccd"
+ chown distcc `dirname ${DISTCCD_PIDFILE}` &>/dev/null
+ TMPDIR="${TMPDIR}" \
+ PATH="$(gcc-config --get-bin-path):${PATH}" \
+ /sbin/start-stop-daemon --start --quiet --startas ${DISTCCD_EXEC} \
+ --pidfile ${DISTCCD_PIDFILE} -- \
+ --pid-file ${DISTCCD_PIDFILE} -N ${DISTCCD_NICE} --user distcc \
+ ${DISTCCD_OPTS}
+
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping distccd"
+ start-stop-daemon --stop --quiet --pidfile "${DISTCCD_PIDFILE}"
+ rm -f "${DISTCCD_PIDFILE}"
+ eend $?
+}
+
diff --git a/sys-devel/distcc/files/3.0/conf b/sys-devel/distcc/files/3.0/conf
new file mode 100644
index 000000000000..eb784c3ac88b
--- /dev/null
+++ b/sys-devel/distcc/files/3.0/conf
@@ -0,0 +1,40 @@
+# /etc/conf.d/distccd: config file for /etc/init.d/distccd
+
+DISTCCD_OPTS=""
+
+# this is the distccd executable
+DISTCCD_EXEC="/usr/bin/distccd"
+
+# this is where distccd will store its pid file
+DISTCCD_PIDFILE="/var/run/distccd/distccd.pid"
+
+# set this option to run distccd with extra parameters
+# Default port is 3632. For most people the default is okay.
+DISTCCD_OPTS="${DISTCCD_OPTS} --port 3632"
+
+# Logging
+# You can change some logging options here:
+# --log-file FILE
+# --log-level LEVEL [critical,error,warning, notice, info, debug]
+#
+# Leaving --log-file blank will log to syslog
+# example: --log-file /dev/null --log-level warning
+# example: --log-level critical
+
+DISTCCD_OPTS="${DISTCCD_OPTS} --log-level critical"
+
+# SECURITY NOTICE:
+# It is HIGHLY recomended that you use the --listen option
+# for increased security. You can specify an IP to permit connections
+# from or a CIDR mask
+# --listen accepts only a single IP
+# --allow is now mandatory as of distcc-2.18.
+# example: --allow 192.168.0.0/24
+# example: --allow 192.168.0.5 --allow 192.168.0.150
+# example: --listen 192.168.0.2
+DISTCCD_OPTS="${DISTCCD_OPTS} --allow 192.168.0.0/24"
+#DISTCCD_OPTS="${DISTCCD_OPTS} --listen 192.168.0.2"
+
+# set this for niceness
+# Default is 15
+DISTCCD_OPTS="${DISTCCD_OPTS} -N 15"
diff --git a/sys-devel/distcc/files/3.0/distcc-config b/sys-devel/distcc/files/3.0/distcc-config
new file mode 100644
index 000000000000..9aec95503633
--- /dev/null
+++ b/sys-devel/distcc/files/3.0/distcc-config
@@ -0,0 +1,123 @@
+#!/usr/bin/env python
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+import os, re, signal, sys
+from string import rstrip
+from subprocess import Popen
+
+options=[
+ '--get-hosts',
+ '--set-hosts',
+ '--get-verbose',
+ '--set-verbose',
+ '--get-log',
+ '--set-log',
+ '--help',
+ '--get-env',
+ '--set-env'
+]
+
+tmpcmdline=sys.argv[1:]
+cmdline=[]
+envfile = '/etc/env.d/02distcc'
+
+def exithandler(foo,bar):
+ os.kill(0,signal.SIGKILL)
+ sys.exit(1)
+
+signal.signal(signal.SIGINT,exithandler)
+
+def isroot(ret=0):
+ if os.getuid() != 0:
+ if ret == 0:
+ print '!!!',sys.argv[:1][0],tmpcmdline[0],'must be run as root'
+ sys.exit(1)
+ else:
+ retval = 0
+ else:
+ retval = 1
+ return retval
+
+def writeenv(var,value):
+ isroot()
+ distcc_env = []
+ distcc_env = open(envfile, 'r').readlines()
+ distcc_env_new = open(envfile, 'w')
+ for i in range(len(distcc_env)):
+ if re.compile(var+'="(.*)"').match(distcc_env[i]):
+ distcc_env[i] = var+'="'+value+'"\n'
+ distcc_env_new.write(distcc_env[i])
+ #print 'Set',var,'to:',value
+ Popen('/usr/sbin/env-update', shell=True)
+ print 'If you want to use these new settings in an existing shell,'
+ print 'you need to "source /etc/profile" to get the changes.'
+
+def readenv(var):
+ distcc_env = open(envfile, 'r').read()
+ match = re.compile(var+'="(.*)"').search(distcc_env)
+ if match:
+ print var+'='+match.group(1)
+ else:
+ print var,'not set.'
+
+def createdistccdir(dir):
+ if not os.path.exists(dir):
+ os.mkdir(dir)
+ os.chmod(dir, 0755)
+
+for x in tmpcmdline:
+ if not x:
+ continue
+ if x[0:2]=="--":
+ if not x in options:
+ print "!!! Error:",x,"is an invalid option."
+ sys.exit(1)
+ else:
+ cmdline = x
+
+if '--get-hosts' in tmpcmdline:
+ HOSTS_ENV = os.environ.get('DISTCC_HOSTS')
+ HOSTS_HOME = os.environ.get('HOME')+'/hosts'
+ if HOSTS_ENV:
+ print HOSTS_ENV
+ elif os.path.isfile(HOSTS_HOME) and os.path.getsize(HOSTS_HOME) != 0:
+ print rstrip(open(HOSTS_HOME, 'r').read())
+ elif os.path.exists('/etc/distcc/hosts'):
+ print rstrip(open('/etc/distcc/hosts', 'r').read())
+ else:
+ print 'No configuration file found. Setup your hosts with --set-hosts.'
+elif '--set-hosts' in tmpcmdline:
+ if isroot(1):
+ PATH = '/etc/distcc'
+ else:
+ PATH = os.environ.get('HOME')
+ createdistccdir(PATH)
+ open(PATH+'/hosts', 'w').write(cmdline + '\n')
+elif '--get-verbose' in tmpcmdline:
+ readenv('DISTCC_VERBOSE')
+elif '--set-verbose' in tmpcmdline:
+ writeenv('DISTCC_VERBOSE',tmpcmdline[1])
+elif '--get-log' in tmpcmdline:
+ readenv('DISTCC_LOG')
+elif '--set-log' in tmpcmdline:
+ writeenv('DISTCC_LOG',tmpcmdline[1])
+elif '--get-env' in tmpcmdline:
+ if len(tmpcmdline) == 1:
+ print rstrip(open(envfile, 'r').read())
+ elif len(tmpcmdline) == 2:
+ readenv(tmpcmdline[1])
+ else:
+ print '!!! Error: Specify only one variable.'
+elif '--set-env' in tmpcmdline:
+ if len(tmpcmdline) > 2 and len(tmpcmdline) <= 3:
+ isroot()
+ writeenv(tmpcmdline[1],tmpcmdline[2])
+ else:
+ print '!!! Error: Awaiting two parameters.'
+else:
+ print 'Usage: %s --set-hosts DISTCC_HOSTS | --get-hosts' % sys.argv[0]
+ print ' %s --set-verbose { 0 | 1 } | --get-verbose' % sys.argv[0]
+ print ' %s --set-log FILE | --get-log' % sys.argv[0]
+ print ' %s --set-env VARIABLE VALUE | --get-env [VARIABLE]' % sys.argv[0]
diff --git a/sys-devel/distcc/files/3.0/init b/sys-devel/distcc/files/3.0/init
new file mode 100755
index 000000000000..2740f2b5636a
--- /dev/null
+++ b/sys-devel/distcc/files/3.0/init
@@ -0,0 +1,32 @@
+#!/sbin/runscript
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+depend() {
+ need net
+ use avahi-daemon ypbind
+}
+
+start() {
+ ebegin "Starting distccd"
+
+ if [ ! -e /var/run/distccd ] ; then
+ mkdir -p /var/run/distccd
+ chown distcc:daemon /var/run/distccd
+ fi
+
+ # Load GCC_SPECS from profile.env bug #164818
+ GCC_SPECS="$(. /etc/profile.env; echo "${GCC_SPECS}")" \
+ PATH="$(gcc-config --get-bin-path):${PATH}" \
+ start-stop-daemon --start --quiet --exec "${DISTCCD_EXEC}" -- \
+ --daemon --pid-file "${DISTCCD_PIDFILE}" --user distcc \
+ ${DISTCCD_OPTS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping distccd"
+ start-stop-daemon --stop --quiet --pidfile "${DISTCCD_PIDFILE}"
+ eend $?
+}
diff --git a/sys-devel/distcc/files/3.1/conf b/sys-devel/distcc/files/3.1/conf
new file mode 100644
index 000000000000..4b1faf145b75
--- /dev/null
+++ b/sys-devel/distcc/files/3.1/conf
@@ -0,0 +1,35 @@
+# /etc/conf.d/distccd: config file for /etc/init.d/distccd
+
+# this is the distccd executable
+DISTCCD_EXEC="/usr/bin/distccd"
+
+# this is where distccd will store its pid file
+DISTCCD_PIDFILE="/var/run/distccd/distccd.pid"
+
+# Ports:
+# Default port is 3632. For most people the default is okay.
+#
+# Logging:
+# You can change some logging options here:
+# --log-file FILE
+# --log-level LEVEL [critical,error,warning, notice, info, debug]
+#
+# Leaving --log-file blank will log to syslog
+# example: --log-file /dev/null --log-level warning
+# example: --log-level critical
+#
+# Nice level:
+# The default nice level is 15. You can change it by adding: -N xx
+# where xx is the nice level.
+
+# SECURITY NOTICE:
+# It is HIGHLY recomended that you use the --listen option
+# for increased security. You can specify an IP to permit connections
+# from or a CIDR mask
+# --listen accepts only a single IP
+# --allow is now mandatory as of distcc-2.18.
+# example: --allow 192.168.0.0/24
+# example: --allow 192.168.0.5 --allow 192.168.0.150
+# example: --listen 192.168.0.2
+
+DISTCCD_OPTS="--port 3632 --log-level notice --log-file /var/log/distccd.log -N 15"
diff --git a/sys-devel/distcc/files/3.1/init b/sys-devel/distcc/files/3.1/init
new file mode 100755
index 000000000000..f7009f6e3101
--- /dev/null
+++ b/sys-devel/distcc/files/3.1/init
@@ -0,0 +1,32 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+depend() {
+ need net
+ use avahi-daemon ypbind
+}
+
+start() {
+ ebegin "Starting distccd"
+
+ if [ ! -e /var/run/distccd ] ; then
+ mkdir -p /var/run/distccd
+ chown distcc:daemon /var/run/distccd
+ fi
+
+ # Load PATH and GCC_SPECS from gcc-config, bug #262773
+ eval "$(gcc-config -E)"
+
+ start-stop-daemon --start --quiet --exec "${DISTCCD_EXEC}" --user distcc -- \
+ --daemon --pid-file "${DISTCCD_PIDFILE}" \
+ ${DISTCCD_OPTS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping distccd"
+ start-stop-daemon --stop --quiet --pidfile "${DISTCCD_PIDFILE}"
+ eend $?
+}
diff --git a/sys-devel/distcc/files/distcc-3.0-fix-fortify.patch b/sys-devel/distcc/files/distcc-3.0-fix-fortify.patch
new file mode 100644
index 000000000000..8edc330e324b
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-3.0-fix-fortify.patch
@@ -0,0 +1,11 @@
+diff -ru a/src/snprintf.h b/src/snprintf.h
+--- a/src/snprintf.h 2008-08-06 15:52:06.000000000 -0500
++++ b/src/snprintf.h 2009-01-04 15:19:22.000000000 -0600
+@@ -7,6 +7,7 @@
+ */
+
+ #include <stdarg.h>
++#include "config.h"
+
+ #ifdef __GNUC__
+ /** Use gcc attribute to check printf fns. a1 is the 1-based index of
diff --git a/sys-devel/distcc/files/distcc-3.0-gentoo.patch b/sys-devel/distcc/files/distcc-3.0-gentoo.patch
new file mode 100644
index 000000000000..e2464dfa5abc
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-3.0-gentoo.patch
@@ -0,0 +1,33 @@
+diff -Naur distcc-3.0.orig/include_server/c_extensions/distcc_pump_c_extensions_module.c distcc-3.0/include_server/c_extensions/distcc_pump_c_extensions_module.c
+--- distcc-3.0.orig/include_server/c_extensions/distcc_pump_c_extensions_module.c 2008-08-07 05:52:20.000000000 +0900
++++ distcc-3.0/include_server/c_extensions/distcc_pump_c_extensions_module.c 2008-10-14 22:34:38.000000000 +0900
+@@ -23,17 +23,18 @@
+
+ #include "Python.h"
+
+-static char *version = ".01";
++static const char *version = ".01";
+
+ /* To suppress compiler warnings */
+ #define UNUSED(v) ((void)&v)
+
+-char *rs_program_name = "distcc_include_server";
++const char *rs_program_name = "distcc_include_server";
+
+ #include "distcc.h"
+ #include "rpc.h"
+
+ static PyObject *distcc_pump_c_extensionsError;
++void initdistcc_pump_c_extensions(void);
+
+
+ /***********************************************************************
+@@ -385,7 +386,7 @@
+ PyObject *module;
+ PyObject *py_str;
+ distcc_pump_c_extensionsError = PyErr_NewException(
+- "distcc_pump_c_extensions.Error", NULL, NULL);
++ (char *)"distcc_pump_c_extensions.Error", NULL, NULL);
+
+ module = Py_InitModule4("distcc_pump_c_extensions",
+ methods,
diff --git a/sys-devel/distcc/files/distcc-3.0-svn617.patch b/sys-devel/distcc/files/distcc-3.0-svn617.patch
new file mode 100644
index 000000000000..54f55dcea15a
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-3.0-svn617.patch
@@ -0,0 +1,13 @@
+Index: src/arg.c
+===================================================================
+--- src/arg.c (revision 616)
++++ src/arg.c (revision 617)
+@@ -453,7 +453,7 @@
+ dest_argv[i] = strdup(opt);
+ if (!dest_argv[i]) return EXIT_OUT_OF_MEMORY;
+ i++;
+- if (strcmp(opt, "-MD") == 0 || strcmp(opt, "-MMD")) {
++ if (strcmp(opt, "-MD") == 0 || strcmp(opt, "-MMD") == 0) {
+ char *filename;
+ if (!comma) {
+ rs_log_warning("'-Wp,-MD' or '-Wp,-MMD' option is missing "
diff --git a/sys-devel/distcc/files/distcc-3.0-uninitialized.patch b/sys-devel/distcc/files/distcc-3.0-uninitialized.patch
new file mode 100644
index 000000000000..28b226b7966c
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-3.0-uninitialized.patch
@@ -0,0 +1,13 @@
+Index: src/where.c
+===================================================================
+--- src/where.c (revision 622)
++++ src/where.c (working copy)
+@@ -190,7 +190,7 @@
+ int dcc_lock_local_cpp(int *cpu_lock_fd)
+ {
+ int ret;
+- struct dcc_hostdef *chosen;
++ struct dcc_hostdef *chosen = NULL;
+ ret = dcc_lock_one(dcc_hostdef_local_cpp, &chosen, cpu_lock_fd);
+ dcc_note_state(DCC_PHASE_CPP, NULL, chosen->hostname);
+ return ret;
diff --git a/sys-devel/distcc/files/distcc-3.0-xinetd.patch b/sys-devel/distcc/files/distcc-3.0-xinetd.patch
new file mode 100644
index 000000000000..47877ad45b42
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-3.0-xinetd.patch
@@ -0,0 +1,15 @@
+diff -Naur distcc-3.0.orig/doc/example/xinetd distcc-3.0/doc/example/xinetd
+--- distcc-3.0.orig/doc/example/xinetd 2008-08-07 05:52:13.000000000 +0900
++++ distcc-3.0/doc/example/xinetd 2008-10-27 15:32:14.000000000 +0900
+@@ -19,10 +19,6 @@
+ socket_type = stream
+ wait = no
+ user = distcc
+- server = /usr/local/bin/distccd
++ server = /usr/bin/distccd
+ server_args = --inetd
+-
+- # This makes xinetd cope if there is no service listed in
+- # /etc/services
+- type = UNLISTED
+ }
diff --git a/sys-devel/distcc/files/distcc-3.1-argc-fix.patch b/sys-devel/distcc/files/distcc-3.1-argc-fix.patch
new file mode 100644
index 000000000000..d7f30b5567fa
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-3.1-argc-fix.patch
@@ -0,0 +1,17 @@
+this fixes virtualbox not compiling with distcc
+
+https://bugs.gentoo.org/show_bug.cgi?id=351979
+http://code.google.com/p/distcc/issues/detail?id=83
+http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=626926
+
+--- distcc-3.1.orig/source/src/arg.c
++++ distcc-3.1/source/src/arg.c
+@@ -515,6 +515,8 @@
+ }
+ free(argv);
+ *argv_ptr = argv = new_argv;
++ i += extra_args - 1;
++ argc += extra_args - 1;
+ }
+ }
+ return 0;
diff --git a/sys-devel/distcc/files/distcc-3.1-freedesktop.patch b/sys-devel/distcc/files/distcc-3.1-freedesktop.patch
new file mode 100644
index 000000000000..b23db21a2558
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-3.1-freedesktop.patch
@@ -0,0 +1,76 @@
+diff -Naur distcc-3.1.orig/Makefile.in distcc-3.1/Makefile.in
+--- distcc-3.1.orig/Makefile.in 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/Makefile.in 2009-02-02 00:40:20.000000000 +0900
+@@ -49,13 +49,14 @@
+ includedir = @includedir@
+ oldincludedir = /usr/include
+ docdir = @docdir@
+-pkgdatadir = $(datadir)/@PACKAGE_NAME@
++icondir = $(datadir)/pixmaps
++desktopdir = $(datadir)/applications
+
+ include_server_builddir = $(builddir)/_include_server
+
+ # These must be done from here, not from autoconf, because they can
+ # contain variable expansions written in Make syntax. Ew.
+-DIR_DEFS = -DSYSCONFDIR="\"${sysconfdir}\"" -DPKGDATADIR="\"${pkgdatadir}\""
++DIR_DEFS = -DSYSCONFDIR="\"${sysconfdir}\"" -DICONDIR="\"${icondir}\""
+
+ # arguments to pkgconfig
+ GNOME_PACKAGES = @GNOME_PACKAGES@
+@@ -1003,7 +1004,8 @@
+ @echo " documents $(DESTDIR)$(docdir)"
+ @echo " programs $(DESTDIR)$(bindir)"
+ @echo " system configuration $(DESTDIR)$(sysconfdir)"
+- @echo " shared data files $(DESTDIR)$(pkgdatadir)"
++ @echo " icons $(DESTDIR)$(icondir)"
++ @echo " .desktop file $(DESTDIR)$(desktopdir)"
+
+
+ # install-sh can't handle multiple arguments, but we don't need any
+@@ -1086,10 +1088,10 @@
+ done
+
+ install-gnome-data: $(gnome_data)
+- $(mkinstalldirs) "$(DESTDIR)$(pkgdatadir)"
+- for p in $(gnome_data); do \
+- $(INSTALL_DATA) "$$p" "$(DESTDIR)$(pkgdatadir)" || exit 1; \
+- done
++ $(mkinstalldirs) $(DESTDIR)$(icondir)
++ $(mkinstalldirs) $(DESTDIR)$(desktopdir)
++ $(INSTALL_DATA) gnome/distccmon-gnome-icon.png $(DESTDIR)$(icondir)
++ $(INSTALL_DATA) gnome/distccmon-gnome.desktop $(DESTDIR)$(desktopdir)
+
+ install-conf: $(conf_files) $(default_files)
+ $(mkinstalldirs) "$(DESTDIR)$(sysconfdir)/distcc"
+diff -Naur distcc-3.1.orig/gnome/distccmon-gnome.desktop distcc-3.1/gnome/distccmon-gnome.desktop
+--- distcc-3.1.orig/gnome/distccmon-gnome.desktop 2008-12-03 06:50:27.000000000 +0900
++++ distcc-3.1/gnome/distccmon-gnome.desktop 2009-02-02 00:40:55.000000000 +0900
+@@ -1,13 +1,11 @@
+ [Desktop Entry]
+-Version=0.9.4
+-Encoding=UTF-8
+ Exec=distccmon-gnome
+ Name=distcc monitor
+ GenericName=Distributed Compile Monitor
+ Comment=Graphical view of distributed compile tasks
+-Icon=distccmon-gnome-icon.png
++Icon=distccmon-gnome-icon
+ TryExec=distccmon-gnome
+ Terminal=false
+ Type=Application
+-Categories=GNOME;Application;Development;
++Categories=GNOME;Development;
+ StartupNotify=true
+diff -Naur distcc-3.1.orig/src/mon-gnome.c distcc-3.1/src/mon-gnome.c
+--- distcc-3.1.orig/src/mon-gnome.c 2008-12-03 06:50:25.000000000 +0900
++++ distcc-3.1/src/mon-gnome.c 2009-02-02 00:41:18.000000000 +0900
+@@ -599,7 +599,7 @@
+
+ #if GTK_CHECK_VERSION(2,2,0)
+ gtk_window_set_icon_from_file (GTK_WINDOW (mainwin),
+- PKGDATADIR "/distccmon-gnome-icon.png",
++ ICONDIR "/distccmon-gnome-icon.png",
+ NULL);
+ #endif
+
diff --git a/sys-devel/distcc/files/distcc-3.1-python.patch b/sys-devel/distcc/files/distcc-3.1-python.patch
new file mode 100644
index 000000000000..733357a53932
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-3.1-python.patch
@@ -0,0 +1,258 @@
+diff -Naur distcc-3.1.orig/bench/statistics.py distcc-3.1/bench/statistics.py
+--- distcc-3.1.orig/bench/statistics.py 2008-12-03 06:50:21.000000000 +0900
++++ distcc-3.1/bench/statistics.py 2009-03-17 01:29:26.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/env python2.2
++#! /usr/bin/env python
+
+ # benchmark -- automated system for testing distcc correctness
+ # and performance on various source trees.
+diff -Naur distcc-3.1.orig/configure distcc-3.1/configure
+--- distcc-3.1.orig/configure 2008-12-03 06:50:34.000000000 +0900
++++ distcc-3.1/configure 2009-03-17 01:31:09.000000000 +0900
+@@ -3629,7 +3629,7 @@
+ #
+ # NB: Cannot use AC_CONFIG_LIBOBJ_DIR here, because it's not present
+ # in autoconf 2.53.
+-for ac_prog in python2.5 python-2.5 python2.4 python-2.4 python
++for ac_prog in python
+ do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+ set dummy $ac_prog; ac_word=$2
+diff -Naur distcc-3.1.orig/configure.ac distcc-3.1/configure.ac
+--- distcc-3.1.orig/configure.ac 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/configure.ac 2009-03-17 01:29:04.000000000 +0900
+@@ -243,7 +243,7 @@
+ #
+ # NB: Cannot use AC_CONFIG_LIBOBJ_DIR here, because it's not present
+ # in autoconf 2.53.
+-AC_PATH_PROGS(PYTHON, [python2.5 python-2.5 python2.4 python-2.4 python])
++AC_PATH_PROGS(PYTHON, [python])
+ AC_ARG_VAR(PYTHON, [Python interpreter])
+ # Python 1 doesn't even support -V
+ if ! "$PYTHON" -V 2>&1 | grep "^Python" >/dev/null; then
+diff -Naur distcc-3.1.orig/include_server/basics.py distcc-3.1/include_server/basics.py
+--- distcc-3.1.orig/include_server/basics.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/basics.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python2.4
++#!/usr/bin/python
+ #
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/basics_test.py distcc-3.1/include_server/basics_test.py
+--- distcc-3.1.orig/include_server/basics_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/basics_test.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/c_extensions_test.py distcc-3.1/include_server/c_extensions_test.py
+--- distcc-3.1.orig/include_server/c_extensions_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/c_extensions_test.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python2.4
++#!/usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/cache_basics.py distcc-3.1/include_server/cache_basics.py
+--- distcc-3.1.orig/include_server/cache_basics.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/cache_basics.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/compiler_defaults.py distcc-3.1/include_server/compiler_defaults.py
+--- distcc-3.1.orig/include_server/compiler_defaults.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/compiler_defaults.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/compress_files.py distcc-3.1/include_server/compress_files.py
+--- distcc-3.1.orig/include_server/compress_files.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/compress_files.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/include_analyzer.py distcc-3.1/include_server/include_analyzer.py
+--- distcc-3.1.orig/include_server/include_analyzer.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/include_analyzer.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/include_analyzer_memoizing_node.py distcc-3.1/include_server/include_analyzer_memoizing_node.py
+--- distcc-3.1.orig/include_server/include_analyzer_memoizing_node.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/include_analyzer_memoizing_node.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/include_analyzer_memoizing_node_test.py distcc-3.1/include_server/include_analyzer_memoizing_node_test.py
+--- distcc-3.1.orig/include_server/include_analyzer_memoizing_node_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/include_analyzer_memoizing_node_test.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/include_analyzer_test.py distcc-3.1/include_server/include_analyzer_test.py
+--- distcc-3.1.orig/include_server/include_analyzer_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/include_analyzer_test.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/include_server.py distcc-3.1/include_server/include_server.py
+--- distcc-3.1.orig/include_server/include_server.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/include_server.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python2.4
++#!/usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/include_server_test.py distcc-3.1/include_server/include_server_test.py
+--- distcc-3.1.orig/include_server/include_server_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/include_server_test.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python2.4
++#!/usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/macro_eval.py distcc-3.1/include_server/macro_eval.py
+--- distcc-3.1.orig/include_server/macro_eval.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/macro_eval.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/macro_eval_test.py distcc-3.1/include_server/macro_eval_test.py
+--- distcc-3.1.orig/include_server/macro_eval_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/macro_eval_test.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/mirror_path.py distcc-3.1/include_server/mirror_path.py
+--- distcc-3.1.orig/include_server/mirror_path.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/mirror_path.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python2.4
++#!/usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/mirror_path_test.py distcc-3.1/include_server/mirror_path_test.py
+--- distcc-3.1.orig/include_server/mirror_path_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/mirror_path_test.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/parse_command.py distcc-3.1/include_server/parse_command.py
+--- distcc-3.1.orig/include_server/parse_command.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/parse_command.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/parse_command_test.py distcc-3.1/include_server/parse_command_test.py
+--- distcc-3.1.orig/include_server/parse_command_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/parse_command_test.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/parse_file.py distcc-3.1/include_server/parse_file.py
+--- distcc-3.1.orig/include_server/parse_file.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/parse_file.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/parse_file_test.py distcc-3.1/include_server/parse_file_test.py
+--- distcc-3.1.orig/include_server/parse_file_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/parse_file_test.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/run.py distcc-3.1/include_server/run.py
+--- distcc-3.1.orig/include_server/run.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/run.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/setup.py distcc-3.1/include_server/setup.py
+--- distcc-3.1.orig/include_server/setup.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/setup.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python2.4
++#!/usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/include_server/statistics.py distcc-3.1/include_server/statistics.py
+--- distcc-3.1.orig/include_server/statistics.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.1/include_server/statistics.py 2009-03-17 01:30:46.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+ #
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/test/onetest.py distcc-3.1/test/onetest.py
+--- distcc-3.1.orig/test/onetest.py 2008-12-03 06:50:22.000000000 +0900
++++ distcc-3.1/test/onetest.py 2009-03-17 01:29:44.000000000 +0900
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python2.4
++#!/usr/bin/python
+ #
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.1.orig/test/testdistcc.py distcc-3.1/test/testdistcc.py
+--- distcc-3.1.orig/test/testdistcc.py 2008-12-03 06:50:22.000000000 +0900
++++ distcc-3.1/test/testdistcc.py 2009-03-17 01:29:36.000000000 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/env python2.2
++#! /usr/bin/env python
+
+ # Copyright (C) 2002, 2003, 2004 by Martin Pool <mbp@samba.org>
+ # Copyright 2007 Google Inc.
diff --git a/sys-devel/distcc/files/distcc-3.2_rc1-freedesktop.patch b/sys-devel/distcc/files/distcc-3.2_rc1-freedesktop.patch
new file mode 100644
index 000000000000..8f0d8d77a12b
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-3.2_rc1-freedesktop.patch
@@ -0,0 +1,79 @@
+diff -Naur distcc-3.2rc1.orig/Makefile.in distcc-3.2rc1/Makefile.in
+--- distcc-3.2rc1.orig/Makefile.in 2011-10-26 11:07:15.000000000 +0900
++++ distcc-3.2rc1/Makefile.in 2011-10-27 16:57:46.815272689 +0900
+@@ -50,13 +50,14 @@
+ includedir = @includedir@
+ oldincludedir = /usr/include
+ docdir = @docdir@
+-pkgdatadir = $(datadir)/@PACKAGE_NAME@
++icondir = $(datadir)/pixmaps
++desktopdir = $(datadir)/applications
+
+ include_server_builddir = $(builddir)/_include_server
+
+ # These must be done from here, not from autoconf, because they can
+ # contain variable expansions written in Make syntax. Ew.
+-DIR_DEFS = -DSYSCONFDIR="\"${sysconfdir}\"" -DPKGDATADIR="\"${pkgdatadir}\""
++DIR_DEFS = -DSYSCONFDIR="\"${sysconfdir}\"" -DICONDIR="\"${icondir}\""
+
+ # arguments to pkgconfig
+ GNOME_PACKAGES = @GNOME_PACKAGES@
+@@ -1016,7 +1017,8 @@
+ @echo " documents $(DESTDIR)$(docdir)"
+ @echo " programs $(DESTDIR)$(bindir)"
+ @echo " system configuration $(DESTDIR)$(sysconfdir)"
+- @echo " shared data files $(DESTDIR)$(pkgdatadir)"
++ @echo " icons $(DESTDIR)$(icondir)"
++ @echo " .desktop file $(DESTDIR)$(desktopdir)"
+
+
+ # install-sh can't handle multiple arguments, but we don't need any
+@@ -1108,10 +1110,10 @@
+ done
+
+ install-gnome-data: $(gnome_data)
+- $(mkinstalldirs) "$(DESTDIR)$(pkgdatadir)"
+- for p in $(gnome_data); do \
+- $(INSTALL_DATA) "$$p" "$(DESTDIR)$(pkgdatadir)" || exit 1; \
+- done
++ $(mkinstalldirs) "$(DESTDIR)$(icondir)"
++ $(mkinstalldirs) "$(DESTDIR)$(desktopdir)"
++ $(INSTALL_DATA) gnome/distccmon-gnome-icon.png "$(DESTDIR)$(icondir)" || exit 1
++ $(INSTALL_DATA) gnome/distccmon-gnome.desktop "$(DESTDIR)$(desktopdir)" || exit 1
+
+ install-conf: $(conf_files) $(default_files)
+ $(mkinstalldirs) "$(DESTDIR)$(sysconfdir)/distcc"
+diff -Naur distcc-3.2rc1.orig/gnome/distccmon-gnome.desktop distcc-3.2rc1/gnome/distccmon-gnome.desktop
+--- distcc-3.2rc1.orig/gnome/distccmon-gnome.desktop 2011-04-06 03:58:58.000000000 +0900
++++ distcc-3.2rc1/gnome/distccmon-gnome.desktop 2011-10-27 17:01:50.792242592 +0900
+@@ -1,6 +1,4 @@
+ [Desktop Entry]
+-Version=0.9.4
+-Encoding=UTF-8
+ Exec=distccmon-gnome
+ Name=distcc monitor
+ Name[sv]=distcc vervakare
+@@ -8,9 +6,9 @@
+ GenericName[sv]=Distribuerad kompilerings-vervakare
+ Comment=Graphical view of distributed compile tasks
+ Comment[sv]=Grafisk vy av distribuerade kompileringsuppgifter
+-Icon=distccmon-gnome-icon.png
++Icon=distccmon-gnome-icon
+ TryExec=distccmon-gnome
+ Terminal=false
+ Type=Application
+-Categories=GNOME;Application;Development;
++Categories=GNOME;Development;
+ StartupNotify=true
+diff -Naur distcc-3.2rc1.orig/src/mon-gnome.c distcc-3.2rc1/src/mon-gnome.c
+--- distcc-3.2rc1.orig/src/mon-gnome.c 2008-12-03 06:50:25.000000000 +0900
++++ distcc-3.2rc1/src/mon-gnome.c 2011-10-27 16:54:50.220566026 +0900
+@@ -599,7 +599,7 @@
+
+ #if GTK_CHECK_VERSION(2,2,0)
+ gtk_window_set_icon_from_file (GTK_WINDOW (mainwin),
+- PKGDATADIR "/distccmon-gnome-icon.png",
++ ICONDIR "/distccmon-gnome-icon.png",
+ NULL);
+ #endif
+
diff --git a/sys-devel/distcc/files/distcc-3.2_rc1-gssapi.patch b/sys-devel/distcc/files/distcc-3.2_rc1-gssapi.patch
new file mode 100644
index 000000000000..73551f8a7b80
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-3.2_rc1-gssapi.patch
@@ -0,0 +1,36 @@
+diff -Naur distcc-3.2rc1.orig/configure.ac distcc-3.2rc1/configure.ac
+--- distcc-3.2rc1.orig/configure.ac 2011-10-21 13:40:55.000000000 +0900
++++ distcc-3.2rc1/configure.ac 2011-10-27 18:06:58.938922585 +0900
+@@ -15,6 +15,8 @@
+ AC_CONFIG_HEADERS(src/config.h)
+ AC_CANONICAL_HOST
+
++PKG_PROG_PKG_CONFIG
++
+ # FreeBSD installs its version of libpopt into /usr/local/, but does
+ # not put that on the default library and header path.
+ # Solaris doesn't even ship libpopt. We used to add that path if
+@@ -502,16 +504,17 @@
+ [provide mutual authentication services via the GSS-API])])
+
+ if test x"$with_auth" = xyes; then
+- AC_SEARCH_LIBS([gss_init_sec_context],
+- [gssapi gssapi_krb5],
+- AC_DEFINE(HAVE_GSSAPI, 1, [Define if the GSS_API is available])
++ PKG_CHECK_MODULES(GSSAPI, libgssglue,
++ [AC_DEFINE(HAVE_GSSAPI, 1, [Define if the GSS_API is available])
++ CFLAGS="$CFLAGS $GSSAPI_CFLAGS"
++ LIBS="$LIBS $GSSAPI_LIBS"
+ AUTH_COMMON_OBJS="src/auth_common.o"
+ AUTH_DISTCC_OBJS="src/auth_distcc.o"
+- AUTH_DISTCCD_OBJS="src/auth_distccd.o",
+- AC_MSG_FAILURE([--with-auth was given but no GSS-API library found])
++ AUTH_DISTCCD_OBJS="src/auth_distccd.o"],
++ [AC_MSG_FAILURE([--with-auth was given but no GSS-API library found])
+ AUTH_COMMON_OBJS=""
+ AUTH_DISTCC_OBJS=""
+- AUTH_DISTCCD_OBJS="")
++ AUTH_DISTCCD_OBJS=""])
+ fi
+
+ AC_SUBST(AUTH_COMMON_OBJS)
diff --git a/sys-devel/distcc/files/distcc-3.2_rc1-python.patch b/sys-devel/distcc/files/distcc-3.2_rc1-python.patch
new file mode 100644
index 000000000000..409b5a19d321
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-3.2_rc1-python.patch
@@ -0,0 +1,246 @@
+diff -Naur distcc-3.2rc1.orig/bench/statistics.py distcc-3.2rc1/bench/statistics.py
+--- distcc-3.2rc1.orig/bench/statistics.py 2008-12-03 06:50:21.000000000 +0900
++++ distcc-3.2rc1/bench/statistics.py 2011-10-27 17:05:08.418023081 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/env python2.2
++#! /usr/bin/env python
+
+ # benchmark -- automated system for testing distcc correctness
+ # and performance on various source trees.
+diff -Naur distcc-3.2rc1.orig/configure.ac distcc-3.2rc1/configure.ac
+--- distcc-3.2rc1.orig/configure.ac 2011-10-21 13:40:55.000000000 +0900
++++ distcc-3.2rc1/configure.ac 2011-10-27 17:05:31.179112690 +0900
+@@ -243,7 +243,7 @@
+ #
+ # NB: Cannot use AC_CONFIG_LIBOBJ_DIR here, because it's not present
+ # in autoconf 2.53.
+-AC_PATH_PROGS(PYTHON, [python2.6 python-2.6 python2.5 python-2.5 python2.4 python-2.4 python])
++AC_PATH_PROGS(PYTHON, [python])
+ AC_ARG_VAR(PYTHON, [Python interpreter])
+ # Python 1 doesn't even support -V
+ if ! "$PYTHON" -V 2>&1 | grep "^Python" >/dev/null; then
+diff -Naur distcc-3.2rc1.orig/include_server/basics.py distcc-3.2rc1/include_server/basics.py
+--- distcc-3.2rc1.orig/include_server/basics.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/basics.py 2011-10-27 17:05:08.421023097 +0900
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python2.4
++#!/usr/bin/python
+ #
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/basics_test.py distcc-3.2rc1/include_server/basics_test.py
+--- distcc-3.2rc1.orig/include_server/basics_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/basics_test.py 2011-10-27 17:05:08.421023097 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/c_extensions_test.py distcc-3.2rc1/include_server/c_extensions_test.py
+--- distcc-3.2rc1.orig/include_server/c_extensions_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/c_extensions_test.py 2011-10-27 17:05:08.421023097 +0900
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python2.4
++#!/usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/cache_basics.py distcc-3.2rc1/include_server/cache_basics.py
+--- distcc-3.2rc1.orig/include_server/cache_basics.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/cache_basics.py 2011-10-27 17:05:08.422023101 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/compiler_defaults.py distcc-3.2rc1/include_server/compiler_defaults.py
+--- distcc-3.2rc1.orig/include_server/compiler_defaults.py 2011-04-06 03:58:59.000000000 +0900
++++ distcc-3.2rc1/include_server/compiler_defaults.py 2011-10-27 17:05:08.422023101 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/compress_files.py distcc-3.2rc1/include_server/compress_files.py
+--- distcc-3.2rc1.orig/include_server/compress_files.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/compress_files.py 2011-10-27 17:05:08.422023101 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/include_analyzer.py distcc-3.2rc1/include_server/include_analyzer.py
+--- distcc-3.2rc1.orig/include_server/include_analyzer.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/include_analyzer.py 2011-10-27 17:05:08.422023101 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/include_analyzer_memoizing_node.py distcc-3.2rc1/include_server/include_analyzer_memoizing_node.py
+--- distcc-3.2rc1.orig/include_server/include_analyzer_memoizing_node.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/include_analyzer_memoizing_node.py 2011-10-27 17:05:08.422023101 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/include_analyzer_memoizing_node_test.py distcc-3.2rc1/include_server/include_analyzer_memoizing_node_test.py
+--- distcc-3.2rc1.orig/include_server/include_analyzer_memoizing_node_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/include_analyzer_memoizing_node_test.py 2011-10-27 17:05:08.423023105 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/include_analyzer_test.py distcc-3.2rc1/include_server/include_analyzer_test.py
+--- distcc-3.2rc1.orig/include_server/include_analyzer_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/include_analyzer_test.py 2011-10-27 17:05:08.423023105 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/include_server.py distcc-3.2rc1/include_server/include_server.py
+--- distcc-3.2rc1.orig/include_server/include_server.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/include_server.py 2011-10-27 17:05:08.423023105 +0900
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python2.4
++#!/usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/include_server_test.py distcc-3.2rc1/include_server/include_server_test.py
+--- distcc-3.2rc1.orig/include_server/include_server_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/include_server_test.py 2011-10-27 17:05:08.423023105 +0900
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python2.4
++#!/usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/macro_eval.py distcc-3.2rc1/include_server/macro_eval.py
+--- distcc-3.2rc1.orig/include_server/macro_eval.py 2011-04-06 03:58:59.000000000 +0900
++++ distcc-3.2rc1/include_server/macro_eval.py 2011-10-27 17:05:08.423023105 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/macro_eval_test.py distcc-3.2rc1/include_server/macro_eval_test.py
+--- distcc-3.2rc1.orig/include_server/macro_eval_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/macro_eval_test.py 2011-10-27 17:05:08.423023105 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/mirror_path.py distcc-3.2rc1/include_server/mirror_path.py
+--- distcc-3.2rc1.orig/include_server/mirror_path.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/mirror_path.py 2011-10-27 17:05:08.424023109 +0900
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python2.4
++#!/usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/mirror_path_test.py distcc-3.2rc1/include_server/mirror_path_test.py
+--- distcc-3.2rc1.orig/include_server/mirror_path_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/mirror_path_test.py 2011-10-27 17:05:08.424023109 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/parse_command.py distcc-3.2rc1/include_server/parse_command.py
+--- distcc-3.2rc1.orig/include_server/parse_command.py 2011-04-06 03:58:59.000000000 +0900
++++ distcc-3.2rc1/include_server/parse_command.py 2011-10-27 17:05:08.424023109 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/parse_command_test.py distcc-3.2rc1/include_server/parse_command_test.py
+--- distcc-3.2rc1.orig/include_server/parse_command_test.py 2011-04-06 03:58:59.000000000 +0900
++++ distcc-3.2rc1/include_server/parse_command_test.py 2011-10-27 17:05:08.424023109 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/parse_file.py distcc-3.2rc1/include_server/parse_file.py
+--- distcc-3.2rc1.orig/include_server/parse_file.py 2011-04-06 03:58:59.000000000 +0900
++++ distcc-3.2rc1/include_server/parse_file.py 2011-10-27 17:05:08.424023109 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/parse_file_test.py distcc-3.2rc1/include_server/parse_file_test.py
+--- distcc-3.2rc1.orig/include_server/parse_file_test.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/parse_file_test.py 2011-10-27 17:05:08.424023109 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/run.py distcc-3.2rc1/include_server/run.py
+--- distcc-3.2rc1.orig/include_server/run.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/run.py 2011-10-27 17:05:08.424023109 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/setup.py distcc-3.2rc1/include_server/setup.py
+--- distcc-3.2rc1.orig/include_server/setup.py 2011-04-06 03:58:59.000000000 +0900
++++ distcc-3.2rc1/include_server/setup.py 2011-10-27 17:05:08.425023113 +0900
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python2.4
++#!/usr/bin/python
+
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/include_server/statistics.py distcc-3.2rc1/include_server/statistics.py
+--- distcc-3.2rc1.orig/include_server/statistics.py 2008-12-03 06:50:31.000000000 +0900
++++ distcc-3.2rc1/include_server/statistics.py 2011-10-27 17:05:08.425023113 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python2.4
++#! /usr/bin/python
+ #
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/test/onetest.py distcc-3.2rc1/test/onetest.py
+--- distcc-3.2rc1.orig/test/onetest.py 2008-12-03 06:50:22.000000000 +0900
++++ distcc-3.2rc1/test/onetest.py 2011-10-27 17:05:08.432023140 +0900
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python2.4
++#!/usr/bin/python
+ #
+ # Copyright 2007 Google Inc.
+ #
+diff -Naur distcc-3.2rc1.orig/test/testdistcc.py distcc-3.2rc1/test/testdistcc.py
+--- distcc-3.2rc1.orig/test/testdistcc.py 2011-10-21 11:40:49.000000000 +0900
++++ distcc-3.2rc1/test/testdistcc.py 2011-10-27 17:05:08.432023140 +0900
+@@ -1,4 +1,4 @@
+-#! /usr/bin/env python2.2
++#! /usr/bin/env python
+
+ # Copyright (C) 2002, 2003, 2004 by Martin Pool <mbp@samba.org>
+ # Copyright 2007 Google Inc.
diff --git a/sys-devel/distcc/files/distcc-3.2_rc1-socks5.patch b/sys-devel/distcc/files/distcc-3.2_rc1-socks5.patch
new file mode 100644
index 000000000000..256a16ffd5ba
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-3.2_rc1-socks5.patch
@@ -0,0 +1,191 @@
+From fdd93b1e9545b66d1b3a2a1ec24d4c8613ee43fb Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Sat, 24 Jan 2015 23:59:21 +0100
+Subject: [PATCH] Support SOCKSv5 proxy
+
+Support using a SOCKSv5 proxy specified as DISTCC_SOCKS_PROXY.
+The variable can either a hostname, a host:port pair or an absolute path
+to a UNIX socket. When SOCKS is used, the hostname is passed to
+the proxy and therefore the name resolution is done remotely.
+---
+ src/clinet.c | 137 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 135 insertions(+), 2 deletions(-)
+
+diff --git a/src/clinet.c b/src/clinet.c
+index 010a884..4773d8b 100644
+--- a/src/clinet.c
++++ b/src/clinet.c
+@@ -31,6 +31,7 @@
+
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <stddef.h>
+ #include <unistd.h>
+ #include <string.h>
+ #include <fcntl.h>
+@@ -42,8 +43,10 @@
+ #include <sys/types.h>
+ #include <sys/socket.h>
+
++#include <arpa/inet.h>
+ #include <netinet/in.h>
+ #include <netinet/tcp.h>
++#include <sys/un.h>
+
+ #include <netdb.h>
+
+@@ -161,7 +164,7 @@ out_failed:
+ /**
+ * Open a socket to a tcp remote host with the specified port.
+ **/
+-int dcc_connect_by_name(const char *host, int port, int *p_fd)
++static int dcc_connect_by_name_real(const char *host, int port, int *p_fd)
+ {
+ struct addrinfo hints;
+ struct addrinfo *res;
+@@ -201,7 +204,7 @@ int dcc_connect_by_name(const char *host, int port, int *p_fd)
+ *
+ * @todo Don't try for too long to connect.
+ **/
+-int dcc_connect_by_name(const char *host, int port, int *p_fd)
++static int dcc_connect_by_name_real(const char *host, int port, int *p_fd)
+ {
+ struct sockaddr_in sock_out;
+ struct hostent *hp;
+@@ -224,3 +227,133 @@ int dcc_connect_by_name(const char *host, int port, int *p_fd)
+ }
+
+ #endif /* not ENABLE_RFC2553 */
++
++static int dcc_connect_via_socks5(const char *host, int port, int *p_fd, const char *proxy)
++{
++ int ret;
++ char *proxy_host, *proxy_it;
++ int proxy_port;
++ char buf[262];
++ int host_length;
++ struct sockaddr_in addr_buf;
++ int skip_bytes;
++
++ host_length = strlen(host);
++ if (host_length > 255) {
++ rs_log_error("hostname \"%s\" too long for SOCKSv5 (over 255 chars)", host);
++ return EXIT_CONNECT_FAILED;
++ }
++
++ if (proxy[0] == '/') { /* UNIX socket */
++ struct sockaddr_un unix_addr;
++
++ if (strlen(proxy) >= sizeof(unix_addr.sun_path))
++ {
++ rs_log_error("UNIX socket path \"%s\" too long", proxy);
++ return EXIT_CONNECT_FAILED;
++ }
++
++ unix_addr.sun_family = AF_UNIX;
++ strcpy(unix_addr.sun_path, proxy);
++
++ ret = dcc_connect_by_addr((struct sockaddr *) &unix_addr,
++ offsetof(struct sockaddr_un, sun_path) + strlen(proxy) + 1,
++ p_fd);
++
++ } else { /* hostname? IP address? */
++ proxy_host = strdup(proxy);
++ if (proxy_host == NULL) return EXIT_OUT_OF_MEMORY;
++
++ proxy_it = strrchr(proxy_host, ':');
++ if (proxy_it) {
++ *(proxy_it++) = 0;
++ proxy_port = atoi(proxy_it);
++
++ if (proxy_port <= 0) {
++ rs_log_error("invalid proxy port \"%s\"", proxy_it);
++ free(proxy_host);
++ return EXIT_CONNECT_FAILED;
++ }
++ }
++ else
++ proxy_port = 1080;
++
++ ret = dcc_connect_by_name_real(proxy_host, proxy_port, p_fd);
++ free(proxy_host);
++ }
++
++ if (ret != 0)
++ return ret;
++
++ /* connected to proxy, now identifier/method selection */
++ buf[0] = 0x05; /* SOCKSv5 */
++ buf[1] = 0x01; /* one method */
++ buf[2] = 0x00; /* NO AUTHENTICATION REQUIRED */
++ ret = dcc_writex(*p_fd, buf, 3);
++ if (ret != 0)
++ return ret;
++
++ /* wait for method selection */
++ ret = dcc_readx(*p_fd, buf, 2);
++ if (ret != 0)
++ return ret;
++ if (buf[0] != 0x05 || buf[1] != 0x00) { /* version, method */
++ rs_log_error("invalid proxy reply (version 0x%02x, method 0x%02x)",
++ buf[0], buf[1]);
++ return EXIT_CONNECT_FAILED;
++ }
++
++ /* send connect request */
++ buf[0] = 0x05; /* SOCKSv5 */
++ buf[1] = 0x01; /* CONNECT command */
++ buf[2] = 0x00; /* reserved */
++ buf[3] = 0x03; /* DOMAINNAME address type */
++ buf[4] = host_length;
++ memcpy(&buf[5], host, host_length);
++ addr_buf.sin_port = htons(port);
++ memcpy(&buf[5 + host_length], &addr_buf.sin_port, 2);
++ ret = dcc_writex(*p_fd, buf, 7 + host_length);
++ if (ret != 0)
++ return ret;
++
++ /* wait for the connection */
++ /* read first 4 bytes of reply + 2 extra bytes we know will be there */
++ ret = dcc_readx(*p_fd, buf, 6);
++ if (ret != 0)
++ return ret;
++ if (buf[0] != 0x05 || buf[2] != 0x00) { /* version, reserved */
++ rs_log_error("invalid proxy reply (version 0x%02x, reserved 0x%02x)",
++ buf[0], buf[2]);
++ return EXIT_CONNECT_FAILED;
++ }
++ if (buf[1] != 0x00) { /* reply */
++ rs_log_error("proxy connection failed, reason=0x%02x", buf[1]);
++ return EXIT_CONNECT_FAILED;
++ }
++
++ /* now read the remaining (packet size - 6) bytes */
++ switch (buf[3]) { /* address type */
++ case 0x01: skip_bytes = 4; break; /* IPv4 */
++ case 0x03: skip_bytes = buf[4] + 1; break; /* hostname with length field */
++ case 0x04: skip_bytes = 16; break; /* IPv6 */
++ default:
++ rs_log_error("invalid proxy reply (address type 0x%02x)", buf[3]);
++ return EXIT_CONNECT_FAILED;
++ }
++ ret = dcc_readx(*p_fd, buf, skip_bytes);
++ if (ret != 0)
++ return ret;
++
++ return 0;
++}
++
++int dcc_connect_by_name(const char *host, int port, int *p_fd)
++{
++ const char *proxy;
++
++ proxy = getenv("DISTCC_SOCKS_PROXY");
++ if (proxy)
++ return dcc_connect_via_socks5(host, port, p_fd, proxy);
++ else
++ return dcc_connect_by_name_real(host, port, p_fd);
++}
+--
+2.3.0
+
diff --git a/sys-devel/distcc/files/distcc-as-needed.patch b/sys-devel/distcc/files/distcc-as-needed.patch
new file mode 100644
index 000000000000..6678e4d78d1a
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-as-needed.patch
@@ -0,0 +1,17 @@
+Index: distcc-2.18.3/Makefile.in
+===================================================================
+--- distcc-2.18.3.orig/Makefile.in
++++ distcc-2.18.3/Makefile.in
+@@ -377,9 +377,9 @@ src/renderer.o: src/renderer.c
+ $(srcdir)/src/renderer.c
+
+ distccmon-gnome@EXEEXT@: $(mon_obj) $(gnome_obj)
+- $(CC) -o $@ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(LIBS) \
+- $(GNOME_CFLAGS) $(GNOME_LIBS) \
+- $(mon_obj) $(gnome_obj)
++ $(CC) -o $@ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \
++ $(mon_obj) $(gnome_obj) \
++ $(LIBS) $(GNOME_CFLAGS) $(GNOME_LIBS)
+
+
+ ## Dist targets
diff --git a/sys-devel/distcc/files/distcc-avahi-configure.patch b/sys-devel/distcc/files/distcc-avahi-configure.patch
new file mode 100644
index 000000000000..cc1097d643d1
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-avahi-configure.patch
@@ -0,0 +1,29 @@
+diff -ur distcc-2.18.3.old/configure.ac distcc-2.18.3/configure.ac
+--- distcc-2.18.3.old/configure.ac 2008-01-01 21:08:02.000000000 +0200
++++ distcc-2.18.3/configure.ac 2008-01-01 21:09:56.000000000 +0200
+@@ -387,14 +387,18 @@
+ [#include <sys/socket.h>])
+
+ dnl check for avahi
++AC_ARG_ENABLE(avahi, AC_HELP_STRING([--enable-avahi], [enable avahi support]), [], [enable_avahi=auto])
++ZEROCONF_DISTCC_OBJS=""
++ZEROCONF_DISTCCD_OBJS=""
+ PKG_CHECK_MODULES(AVAHI, [avahi-client >= 0.6.5],
+-[AC_DEFINE(HAVE_AVAHI, 1, [defined if Avahi is available])
+-CFLAGS="$CFLAGS $AVAHI_CFLAGS"
+-LIBS="$LIBS $AVAHI_LIBS"
+-ZEROCONF_DISTCC_OBJS="src/zeroconf.o src/gcc-id.o"
+-ZEROCONF_DISTCCD_OBJS="src/zeroconf-reg.o src/gcc-id.o"],
+-[ZEROCONF_DISTCC_OBJS=""
+-ZEROCONF_DISTCCD_OBJS=""])
++[if test x"${enable_avahi}" = x"yes" || test x"${enable_avahi}" = x"auto"; then
++ AC_DEFINE(HAVE_AVAHI, 1, [defined if Avahi is available])
++ CFLAGS="$CFLAGS $AVAHI_CFLAGS"
++ LIBS="$LIBS $AVAHI_LIBS"
++ ZEROCONF_DISTCC_OBJS="src/zeroconf.o src/gcc-id.o"
++ ZEROCONF_DISTCCD_OBJS="src/zeroconf-reg.o src/gcc-id.o"
++fi],
++[test x"${enable_avahi}" = x"yes" && AC_MSG_ERROR(avahi support needs avahi-client >= 0.6.5 installed)])
+ AC_SUBST(ZEROCONF_DISTCC_OBJS)
+ AC_SUBST(ZEROCONF_DISTCCD_OBJS)
+
diff --git a/sys-devel/distcc/files/distcc-config b/sys-devel/distcc/files/distcc-config
new file mode 100644
index 000000000000..c7e6622adc3b
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-config
@@ -0,0 +1,165 @@
+#!/usr/bin/env python
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+import os, re, signal, sys, commands, pwd
+from string import rstrip
+
+options=[
+ '--get-hosts',
+ '--set-hosts',
+ '--get-verbose',
+ '--set-verbose',
+ '--get-log',
+ '--set-log',
+ '--install',
+ '--help',
+ '--get-env',
+ '--set-env'
+]
+
+tmpcmdline=sys.argv[1:]
+cmdline=[]
+envfile = '/etc/env.d/02distcc'
+
+def exithandler(foo,bar):
+ os.kill(0,signal.SIGKILL)
+ sys.exit(1)
+
+signal.signal(signal.SIGINT,exithandler)
+
+def isroot(ret=0):
+ if os.getuid() != 0:
+ if ret == 0:
+ print '!!!',sys.argv[:1][0],tmpcmdline[0],'must be run as root'
+ sys.exit(1)
+ else:
+ retval = 0
+ else:
+ retval = 1
+ return retval
+
+def writeenv(var,value):
+ isroot()
+ distcc_env = []
+ distcc_env = open(envfile, 'r').readlines()
+ distcc_env_new = open(envfile, 'w')
+ for i in range(len(distcc_env)):
+ if re.compile(var+'="(.*)"').match(distcc_env[i]):
+ distcc_env[i] = var+'="'+value+'"\n'
+ distcc_env_new.write(distcc_env[i])
+ #print 'Set',var,'to:',value
+ os.popen('/usr/sbin/env-update')
+ print 'If you want to use these new settings in an existing shell,'
+ print 'you need to "source /etc/profile" to get the changes.'
+
+def readenv(var):
+ distcc_env = open(envfile, 'r').read()
+ match = re.compile(var+'="(.*)"').search(distcc_env)
+ if match:
+ print var+'='+match.group(1)
+ else:
+ print var,'not set.'
+
+def permissions(path,user,group):
+ for file in os.listdir(path):
+ #print 'Configuring',path+file+'...'
+ os.chown(path+file,user,group)
+
+def installlinks(chost=''):
+ for file in ['gcc', 'cc', 'c++', 'g++']:
+ path = '/usr/lib/distcc/bin/'
+ if not chost == '':
+ file = chost+'-'+file
+ if os.path.exists('/usr/bin/'+file):
+ #print 'Creating',path+file,'symlink...'
+ if not os.path.exists(path+file):
+ os.symlink('/usr/bin/distcc',path+file)
+ #else:
+ # print 'Already exists. Skipping...'
+
+def createdistccdir(dir):
+ if not os.path.exists(dir):
+ os.mkdir(dir)
+ os.chmod(dir, 1777)
+
+for x in tmpcmdline:
+ if not x:
+ continue
+ if x[0:2]=="--":
+ if not x in options:
+ print "!!! Error:",x,"is an invalid option."
+ sys.exit(1)
+ else:
+ cmdline = x
+
+if '--get-hosts' in tmpcmdline:
+ HOSTS_ENV = os.environ.get('DISTCC_HOSTS')
+ HOSTS_HOME = os.environ.get('HOME')+'/hosts'
+ if HOSTS_ENV:
+ print HOSTS_ENV
+ elif os.path.isfile(HOSTS_HOME) and os.path.getsize(HOSTS_HOME) != 0:
+ print HOSTS_HOME
+ elif os.path.exists('/etc/distcc/hosts'):
+ print rstrip(open('/etc/distcc/hosts', 'r').read())
+ else:
+ print 'No configuration file found. Setup your hosts with --set-hosts.'
+elif '--set-hosts' in tmpcmdline:
+ if isroot(1):
+ PATH = '/etc/distcc'
+ else:
+ PATH = os.environ.get('HOME')
+ createdistccdir(PATH)
+ open(PATH+'/hosts', 'w').write(cmdline + '\n')
+elif '--get-verbose' in tmpcmdline:
+ readenv('DISTCC_VERBOSE')
+elif '--set-verbose' in tmpcmdline:
+ writeenv('DISTCC_VERBOSE',tmpcmdline[1])
+elif '--get-log' in tmpcmdline:
+ readenv('DISTCC_LOG')
+elif '--set-log' in tmpcmdline:
+ writeenv('DISTCC_LOG',tmpcmdline[1])
+elif '--install' in tmpcmdline:
+ isroot()
+ print 'Creating',envfile+'...'
+ distcc_env = open(envfile, 'w')
+ distcc_env.write('# This file is managed by distcc-config; use it to change these settings.\n')
+ distcc_env.write('DISTCC_LOG=""\n')
+ distcc_env.write('DCCC_PATH="/usr/lib/distcc/bin"\n')
+ distcc_env.write('DISTCC_VERBOSE="0"\n')
+
+ if os.WEXITSTATUS(commands.getstatusoutput('/usr/sbin/useradd -u 240 -g daemon -s /bin/false -d /dev/null -c "distccd" distcc')[0]) == 9:
+ os.WEXITSTATUS(commands.getstatusoutput('/usr/sbin/usermod -g daemon -s /bin/false -d /dev/null -c "distccd" distcc')[0])
+
+ foobar = pwd.getpwnam('distcc')
+ user = foobar[2]
+ group = foobar[3]
+
+ makeconf = open('/etc/make.conf', 'r').read()
+ chost = re.compile('CHOST="(.*)"').search(makeconf).group(1)
+ print 'Creating symlinks...'
+ installlinks()
+ installlinks(chost)
+
+ print 'Checking permissions...'
+ permissions('/usr/lib/distcc/bin/',user,group)
+ permissions('/var/run/distccd/',user,group)
+elif '--get-env' in tmpcmdline:
+ if len(tmpcmdline) == 1:
+ print rstrip(open(envfile, 'r').read())
+ elif len(tmpcmdline) == 2:
+ readenv(tmpcmdline[1])
+ else:
+ print '!!! Error: Specify only one variable.'
+elif '--set-env' in tmpcmdline:
+ if len(tmpcmdline) > 2 and len(tmpcmdline) <= 3:
+ isroot()
+ writeenv(tmpcmdline[1],tmpcmdline[2])
+ else:
+ print '!!! Error: Awaiting two parameters.'
+else:
+ print 'Usage: /usr/bin/distcc-config --set-hosts DISTCC_HOSTS | --get-hosts'
+ print ' /usr/bin/distcc-config --set-verbose { 0 | 1 } | --get-verbose'
+ print ' /usr/bin/distcc-config --set-log FILE | --get-log'
+ print ' /usr/bin/distcc-config --set-env VARIABLE VALUE | --get-env [VARIABLE]'
diff --git a/sys-devel/distcc/files/distcc-config-3.2_rc1 b/sys-devel/distcc/files/distcc-config-3.2_rc1
new file mode 100644
index 000000000000..6f3bd27e40f0
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-config-3.2_rc1
@@ -0,0 +1,181 @@
+#!/usr/bin/env python2
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+import os, re, signal, subprocess, sys
+
+options=[
+ '--get-hosts',
+ '--set-hosts',
+ '--get-verbose',
+ '--set-verbose',
+ '--get-log',
+ '--set-log',
+ '--update-masquerade',
+ '--update-masquerade-with-crossdev',
+ '--help',
+ '--get-env',
+ '--set-env'
+]
+
+tmpcmdline=sys.argv[1:]
+cmdline=[]
+
+eprefix = '@EPREFIX@'
+bindir = os.path.join(eprefix, 'usr', 'bin')
+sbindir = os.path.join(eprefix, 'usr', 'sbin')
+libdir = os.path.join(eprefix, '@libdir@')
+sysconfdir = os.path.join(eprefix, 'etc')
+
+gcc_config = os.path.join(bindir, 'gcc-config')
+env_update = os.path.join(sbindir, 'env-update')
+envfile = os.path.join(sysconfdir, 'env.d', '02distcc')
+default_distcc_dir = os.path.join(sysconfdir, 'distcc')
+hostfile = os.path.join(default_distcc_dir, 'hosts')
+distcc_path = os.path.join(bindir, 'distcc')
+dccc_dir = os.path.join(libdir, 'distcc', 'bin')
+
+def exithandler(foo,bar):
+ os.kill(0,signal.SIGKILL)
+ sys.exit(1)
+
+signal.signal(signal.SIGINT,exithandler)
+
+def isroot(ret=0):
+ if os.getuid() != 0:
+ if ret == 0:
+ print('!!! %s %s must be run as root' % (sys.argv[:1][0],tmpcmdline[0]))
+ sys.exit(1)
+ else:
+ retval = 0
+ else:
+ retval = 1
+ return retval
+
+def writeenv(var,value):
+ isroot()
+ distcc_env = []
+ distcc_env = open(envfile, 'r').readlines()
+ distcc_env_new = open(envfile, 'w')
+ for i in range(len(distcc_env)):
+ if re.compile(var+'="(.*)"').match(distcc_env[i]):
+ distcc_env[i] = var+'="'+value+'"\n'
+ distcc_env_new.write(distcc_env[i])
+ #print('Set %s to: %s ' % (var,value))
+ subprocess.Popen(env_update, shell=True)
+ print('If you want to use these new settings in an existing shell,')
+ print('you need to "source /etc/profile" to get the changes.')
+
+def readenv(var):
+ distcc_env = open(envfile, 'r').read()
+ match = re.compile(var+'="(.*)"').search(distcc_env)
+ if match:
+ print(var+'='+match.group(1))
+ else:
+ print(var,'not set.')
+
+def installlink(chost='', version=''):
+ for file in ['gcc', 'cc', 'c++', 'g++']:
+ if not chost == '':
+ file = '%s-%s' % (chost,file)
+ if not version == '':
+ file = '%s-%s' % (file,version)
+ path = os.path.join(dccc_dir,file)
+ if os.path.exists(os.path.join(bindir,file)):
+ if not os.path.exists(path):
+ print('Creating %s symlink...' % (path))
+ os.symlink(distcc_path,path)
+ #else:
+ # print('Already exists. Skipping...')
+
+def installlinks():
+ p = subprocess.Popen([gcc_config+" -C -l"], shell=True, stdout=subprocess.PIPE)
+ lines = p.stdout.read().rstrip().split('\n')
+ for line in lines:
+ columns = line.split()
+ if len(columns) >= 2:
+ matches = re.match("(.*)-(.*)", columns[1])
+ chost = matches.group(1)
+ version = matches.group(2)
+ installlink(chost)
+ installlink(chost, version)
+
+def uninstalllinks():
+ for root, dirs, files in os.walk(dccc_dir):
+ for file in files:
+ os.remove(os.path.join(root, file))
+
+def createdistccdir(dir):
+ if not os.path.exists(dir):
+ os.mkdir(dir)
+ os.chmod(dir, 0o755)
+
+for x in tmpcmdline:
+ if not x:
+ continue
+ if x[0:2]=="--":
+ if not x in options:
+ print("!!! Error: %s is an invalid option." % (x))
+ sys.exit(1)
+ else:
+ cmdline = x
+
+if '--get-hosts' in tmpcmdline:
+ HOSTS_ENV = os.environ.get('DISTCC_HOSTS')
+ HOSTS_HOME = os.path.join(os.environ.get('HOME'), '.distcc', 'hosts')
+ if HOSTS_ENV:
+ print(HOSTS_ENV)
+ elif os.path.isfile(HOSTS_HOME) and os.path.getsize(HOSTS_HOME) != 0:
+ print(HOSTS_HOME)
+ elif os.path.exists(hostfile):
+ print(open(hostfile, 'r').read().rstrip())
+ else:
+ print('No configuration file found. Setup your hosts with --set-hosts.')
+elif '--set-hosts' in tmpcmdline:
+ if isroot(1):
+ PATH = default_distcc_dir
+ else:
+ PATH = os.path.join(os.environ.get('HOME'), '.distcc')
+ createdistccdir(PATH)
+ open(os.path.join(PATH, 'hosts'), 'w').write(cmdline + '\n')
+elif '--get-verbose' in tmpcmdline:
+ readenv('DISTCC_VERBOSE')
+elif '--set-verbose' in tmpcmdline:
+ writeenv('DISTCC_VERBOSE',tmpcmdline[1])
+elif '--get-log' in tmpcmdline:
+ readenv('DISTCC_LOG')
+elif '--set-log' in tmpcmdline:
+ writeenv('DISTCC_LOG',tmpcmdline[1])
+elif '--update-masquerade' in tmpcmdline:
+ isroot()
+ uninstalllinks()
+ print('Creating symlinks...')
+ installlink()
+ installlinks()
+elif '--update-masquerade-with-crossdev' in tmpcmdline:
+ isroot()
+ uninstalllinks()
+ print('Creating symlinks...')
+ installlinks()
+elif '--get-env' in tmpcmdline:
+ if len(tmpcmdline) == 1:
+ print(open(envfile, 'r').read().rstrip())
+ elif len(tmpcmdline) == 2:
+ readenv(tmpcmdline[1])
+ else:
+ print('!!! Error: Specify only one variable.')
+elif '--set-env' in tmpcmdline:
+ if len(tmpcmdline) > 2 and len(tmpcmdline) <= 3:
+ isroot()
+ writeenv(tmpcmdline[1],tmpcmdline[2])
+ else:
+ print('!!! Error: Awaiting two parameters.')
+else:
+ cmd = sys.argv[:1][0]
+ print('Usage: %s --set-hosts DISTCC_HOSTS | --get-hosts' % (cmd))
+ print(' %s --set-verbose { 0 | 1 } | --get-verbose' % (cmd))
+ print(' %s --set-log FILE | --get-log' % (cmd))
+ print(' %s --set-env VARIABLE VALUE | --get-env [VARIABLE]' % (cmd))
+ print(' %s --update-masquerade' % (cmd))
+ print(' %s --update-masquerade-with-crossdev' % (cmd))
diff --git a/sys-devel/distcc/files/distcc-create-dir.patch b/sys-devel/distcc/files/distcc-create-dir.patch
new file mode 100644
index 000000000000..8c818e1bd8ac
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-create-dir.patch
@@ -0,0 +1,56 @@
+* local directory is at mbp@sourcefrog.net--2004/distcc--devel--2--patch-183
+* comparing to mbp@sourcefrog.net--2004/distcc--devel--2--patch-183
+M ./src/tempfile.c
+
+* modified files
+
+--- orig/src/tempfile.c
++++ mod/src/tempfile.c
+@@ -145,7 +145,7 @@
+ int dcc_get_top_dir(char **path_ret)
+ {
+ char *env;
+- static char *cached;
++ static char *cached = NULL;
+ int ret;
+
+ if (cached) {
+@@ -154,22 +154,23 @@
+ }
+
+ if ((env = getenv("DISTCC_DIR"))) {
+- if ((cached = strdup(env)) == NULL) {
++
++ if ((cached = strdup(env)) == NULL)
+ return EXIT_OUT_OF_MEMORY;
+- } else {
++ else
+ *path_ret = cached;
+- return 0;
+- }
+- }
+
+- if ((env = getenv("HOME")) == NULL) {
+- rs_log_warning("HOME is not set; can't find distcc directory");
+- return EXIT_BAD_ARGUMENTS;
+- }
++ } else {
+
+- if (asprintf(path_ret, "%s/.distcc", env) == -1) {
+- rs_log_error("asprintf failed");
+- return EXIT_OUT_OF_MEMORY;
++ if ((env = getenv("HOME")) == NULL) {
++ rs_log_warning("HOME is not set; can't find distcc directory");
++ return EXIT_BAD_ARGUMENTS;
++ }
++
++ if (asprintf(path_ret, "%s/.distcc", env) == -1) {
++ rs_log_error("asprintf failed");
++ return EXIT_OUT_OF_MEMORY;
++ }
+ }
+
+ ret = dcc_mkdir(*path_ret);
+
+
+
diff --git a/sys-devel/distcc/files/distcc-freedesktop.patch b/sys-devel/distcc/files/distcc-freedesktop.patch
new file mode 100644
index 000000000000..26981097f2dc
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-freedesktop.patch
@@ -0,0 +1,84 @@
+* local directory is at mbp@sourcefrog.net--2004/distcc--devel--2--patch-183
+* comparing to mbp@sourcefrog.net--2004/distcc--devel--2--patch-183
+M src/mon-gnome.c
+M Makefile.in
+M gnome/distccmon-gnome.desktop
+
+* modified files
+
+--- orig/Makefile.in
++++ mod/Makefile.in
+@@ -45,11 +45,12 @@
+ includedir = @includedir@
+ oldincludedir = /usr/include
+ docdir = @docdir@
+-pkgdatadir = $(datadir)/@PACKAGE_NAME@
++icondir = $(datadir)/pixmaps
++desktopdir = $(datadir)/applications
+
+ # These must be done from here, not from autoconf, because they can
+ # contain variable expansions written in Make syntax. Ew.
+-DIR_DEFS = -DSYSCONFDIR="\"${sysconfdir}\"" -DPKGDATADIR="\"${pkgdatadir}\""
++DIR_DEFS = -DSYSCONFDIR="\"${sysconfdir}\"" -DICONDIR="\"${icondir}\""
+
+ # arguments to pkgconfig
+ GNOME_PACKAGES = @GNOME_PACKAGES@
+@@ -508,7 +509,8 @@
+ @echo " documents $(DESTDIR)$(docdir)"
+ @echo " programs $(DESTDIR)$(bindir)"
+ @echo " system configuration $(DESTDIR)$(sysconfdir)"
+- @echo " shared data files $(DESTDIR)$(pkgdatadir)"
++ @echo " icons $(DESTDIR)$(icondir)"
++ @echo " .desktop file $(DESTDIR)$(desktopdir)"
+
+
+ # install-sh can't handle multiple arguments, but we don't need any
+@@ -541,8 +543,8 @@
+ done
+
+ install-gnome-data: $(gnome_data)
+- $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
+- for p in $^; do \
+- $(INSTALL_DATA) $$p $(DESTDIR)$(pkgdatadir) || exit 1; \
+- done
++ $(mkinstalldirs) $(DESTDIR)$(icondir)
++ $(mkinstalldirs) $(DESTDIR)$(desktopdir)
++ $(INSTALL_DATA) gnome/distccmon-gnome-icon.png $(DESTDIR)$(icondir)
++ $(INSTALL_DATA) gnome/distccmon-gnome.desktop $(DESTDIR)$(desktopdir)
+
+
+
+--- orig/gnome/distccmon-gnome.desktop
++++ mod/gnome/distccmon-gnome.desktop
+@@ -1,13 +1,11 @@
+ [Desktop Entry]
+-Version=0.9.4
+-Encoding=UTF-8
+ Exec=distccmon-gnome
+ Name=distcc monitor
+ GenericName=Distributed Compile Monitor
+ Comment=Graphical view of distributed compile tasks
+-Icon=distccmon-gnome-icon.png
++Icon=distccmon-gnome-icon
+ TryExec=distccmon-gnome
+ Terminal=false
+ Type=Application
+-Categories=GNOME;Application;Development;
++Categories=GNOME;Development;
+ StartupNotify=true
+
+
+--- orig/src/mon-gnome.c
++++ mod/src/mon-gnome.c
+@@ -599,7 +599,7 @@
+
+ #if GTK_CHECK_VERSION(2,2,0)
+ gtk_window_set_icon_from_file (GTK_WINDOW (mainwin),
+- PKGDATADIR "/distccmon-gnome-icon.png",
++ ICONDIR "/distccmon-gnome-icon.png",
+ NULL);
+ #endif
+
+
+
+
diff --git a/sys-devel/distcc/files/distcc-gentoo-multilib-r1.patch b/sys-devel/distcc/files/distcc-gentoo-multilib-r1.patch
new file mode 100644
index 000000000000..8a7b37e878bb
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-gentoo-multilib-r1.patch
@@ -0,0 +1,146 @@
+diff -Naurp distcc-2.18.3.orig/src/distcc.c distcc-2.18.3/src/distcc.c
+--- distcc-2.18.3.orig/src/distcc.c 2004-10-01 17:47:07.000000000 -0700
++++ distcc-2.18.3/src/distcc.c 2005-01-30 22:15:43.883870942 -0800
+@@ -135,7 +135,106 @@ static void dcc_client_catch_signals(voi
+ signal(SIGHUP, &dcc_client_signalled);
+ }
+
++#define MAXNEWFLAGS 32
++#define MAXFLAGLEN 127
+
++static char **getNewArgv(char **argv, const char *newflagsStr) {
++ char **newargv;
++ char newflags[MAXNEWFLAGS][MAXFLAGLEN + 1];
++ unsigned newflagsCount = 0;
++ unsigned argc;
++ unsigned i;
++ char **p;
++
++ unsigned s, f; /* start/finish of each flag. f points to
++ * the char AFTER the end (ie the space/\0
++ */
++
++ /* Tokenize the flag list */
++ for(s=0; s < strlen(newflagsStr); s=f+1) {
++ /* Put s at the start of the next flag */
++ while(newflagsStr[s] == ' ' ||
++ newflagsStr[s] == '\t')
++ s++;
++ if(s == strlen(newflagsStr))
++ break;
++
++ f = s + 1;
++ while(newflagsStr[f] != ' ' &&
++ newflagsStr[f] != '\t' &&
++ newflagsStr[f] != '\0')
++ f++;
++
++ /* Detect overrun */
++ if(MAXFLAGLEN < f - s || MAXNEWFLAGS == newflagsCount)
++ return NULL;
++
++ strncpy(newflags[newflagsCount], newflagsStr + s, f - s);
++ newflags[newflagsCount][f - s]='\0';
++ newflagsCount++;
++ }
++
++ /* Calculate original argc and see if it contains -m{abi,32,64} */
++ for(argc=0, p=argv; *p; p++, argc++) {
++ if(newflagsCount && (strncmp(*p, "-m32", 4) == 0 ||
++ strncmp(*p, "-m64", 4) == 0 ||
++ strncmp(*p, "-mabi", 5) == 0)) {
++ /* Our command line sets the ABI, warn the user about this and ignore
++ newArgs by setting newflagsCount to 0.
++ */
++ newflagsCount = 0;
++ fprintf(stderr, "%s: %s detected on the command line overrides implicit %s added by the wrapper.\n", argv[0], *p, newflagsStr);
++ }
++ }
++
++ /* Allocate our array */
++ newargv = (char **)malloc(sizeof(char *) * (argc + newflagsCount + 1));
++
++ /* Make room for the original, new ones, and the NULL terminator */
++ if(!newargv)
++ return NULL;
++
++ /* Build argv */
++ newargv[0] = argv[0];
++
++ /* The newFlags come first since we want the environment to override them. */
++ for(i=1; i - 1 < newflagsCount; i++) {
++ newargv[i] = newflags[i - 1];
++ }
++
++ /* We just use the existing argv[i] as the start. */
++ for(; i - newflagsCount < argc; i++) {
++ newargv[i] = argv[i - newflagsCount];
++ }
++
++ /* And now cap it off... */
++ newargv[i] = NULL;
++
++ return newargv;
++}
++
++static char **getNewArgvFromEnv(char **argv) {
++ char **newargv = argv;
++
++ if(getenv("ABI")) {
++ char *envar = (char *)malloc(sizeof(char) * (strlen("CFLAGS_") + strlen(getenv("ABI")) + 1 ));
++
++ if(!envar)
++ return NULL;
++
++ /* We use CFLAGS_${ABI} for gcc, g++, g77, etc as they are
++ * the same no matter which compiler we are using.
++ */
++ sprintf(envar, "CFLAGS_%s", getenv("ABI"));
++
++ if(getenv(envar))
++ newargv = getNewArgv(argv, getenv(envar));
++
++ free(envar);
++ }
++
++ return newargv;
++}
+
+ /**
+ * distcc client entry point.
+@@ -150,6 +249,7 @@ int main(int argc, char **argv)
+ int status, sg_level, tweaked_path = 0;
+ char **compiler_args;
+ char *compiler_name;
++ char **newargv;
+ int ret;
+
+ dcc_client_catch_signals();
+@@ -183,7 +283,12 @@ int main(int argc, char **argv)
+ goto out;
+ }
+
+- dcc_find_compiler(argv, &compiler_args);
++ if(!(newargv = getNewArgvFromEnv(argv))) {
++ ret = EXIT_OUT_OF_MEMORY;
++ goto out;
++ }
++ dcc_find_compiler(newargv, &compiler_args);
++ if (newargv != argv) free(newargv);
+ /* compiler_args is now respectively either "cc -c hello.c" or
+ * "gcc -c hello.c" */
+
+@@ -200,7 +305,12 @@ int main(int argc, char **argv)
+ &tweaked_path)) != 0)
+ goto out;
+
+- dcc_copy_argv(argv, &compiler_args, 0);
++ if(!(newargv = getNewArgvFromEnv(argv))) {
++ ret = EXIT_OUT_OF_MEMORY;
++ goto out;
++ }
++ dcc_copy_argv(newargv, &compiler_args, 0);
++ if (newargv != argv) free(newargv);
+ compiler_args[0] = compiler_name;
+ }
+
diff --git a/sys-devel/distcc/files/distcc-gentoo-multilib.patch b/sys-devel/distcc/files/distcc-gentoo-multilib.patch
new file mode 100644
index 000000000000..02e0486c2a8b
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-gentoo-multilib.patch
@@ -0,0 +1,126 @@
+diff -Naur distcc-2.18.3-vanilla/src/distcc.c distcc-2.18.3/src/distcc.c
+--- distcc-2.18.3-vanilla/src/distcc.c 2004-10-01 17:47:07.000000000 -0700
++++ distcc-2.18.3/src/distcc.c 2004-12-28 01:04:51.017574246 -0800
+@@ -135,7 +135,86 @@
+ signal(SIGHUP, &dcc_client_signalled);
+ }
+
++#define MAXNEWFLAGS 32
++#define MAXFLAGLEN 127
+
++static char **getNewArgv(char **argv) {
++ char **newargv;
++ char newflags[MAXNEWFLAGS][MAXFLAGLEN + 1];
++ unsigned newflagsCount = 0;
++ unsigned argc;
++ unsigned i;
++ char **p;
++
++ if(getenv("ABI")) {
++ char *envar = (char *)malloc(sizeof(char) *
++ (strlen("CFLAGS_") + strlen(getenv("ABI")) + 1 ));
++ if(!envar)
++ return NULL;
++
++ /* We use CFLAGS_${ABI} for gcc, g++, g77, etc as they are
++ * the same no matter which compiler we are using.
++ */
++ sprintf(envar, "CFLAGS_%s", getenv("ABI"));
++
++ if(getenv(envar)) {
++ const char *newflagsStr = getenv(envar);
++ unsigned s, f; /* start/finish of each flag. f points to
++ * the char AFTER the end (ie the space/\0
++ */
++
++ /* Tokenize the flag list */
++ for(s=0; s < strlen(newflagsStr); s=f+1) {
++ /* Put s at the start of the next flag */
++ while(newflagsStr[s] == ' ' ||
++ newflagsStr[s] == '\t')
++ s++;
++ if(s == strlen(newflagsStr))
++ break;
++
++ f = s + 1;
++ while(newflagsStr[f] != ' ' &&
++ newflagsStr[f] != '\t' &&
++ newflagsStr[f] != '\0')
++ f++;
++
++ /* Detect overrun */
++ if(MAXFLAGLEN < f - s || MAXNEWFLAGS == newflagsCount)
++ return NULL;
++
++ strncpy(newflags[newflagsCount], newflagsStr + s, f - s);
++ newflagsCount++;
++ }
++ }
++
++ free(envar);
++ }
++
++ /* Calculate argc */
++ for(argc=0, p=argv; *p; p++, argc++);
++
++ /* Allocate our array */
++ newargv = (char **)malloc(sizeof(char *) * (argc + newflagsCount + 1));
++
++ /* Make room for the original, new ones, and the NULL terminator */
++ if(!newargv)
++ return NULL;
++
++ /* We just use the existing argv[i] as the start. */
++ for(i=0; i < argc; i++) {
++ newargv[i] = argv[i];
++ }
++
++ /* Now we want to append our newflags list. */
++ for(; i < argc + newflagsCount; i++) {
++ newargv[i] = newflags[i - argc];
++ }
++
++ /* And now cap it off... */
++ newargv[i] = NULL;
++
++ return newargv;
++}
+
+ /**
+ * distcc client entry point.
+@@ -150,6 +229,7 @@
+ int status, sg_level, tweaked_path = 0;
+ char **compiler_args;
+ char *compiler_name;
++ char **newargv;
+ int ret;
+
+ dcc_client_catch_signals();
+@@ -183,7 +263,12 @@
+ goto out;
+ }
+
+- dcc_find_compiler(argv, &compiler_args);
++ if(!(newargv = getNewArgv(argv))) {
++ ret = EXIT_OUT_OF_MEMORY;
++ goto out;
++ }
++ dcc_find_compiler(newargv, &compiler_args);
++ free(newargv);
+ /* compiler_args is now respectively either "cc -c hello.c" or
+ * "gcc -c hello.c" */
+
+@@ -200,7 +285,12 @@
+ &tweaked_path)) != 0)
+ goto out;
+
+- dcc_copy_argv(argv, &compiler_args, 0);
++ if(!(newargv = getNewArgv(argv))) {
++ ret = EXIT_OUT_OF_MEMORY;
++ goto out;
++ }
++ dcc_copy_argv(newargv, &compiler_args, 0);
++ free(newargv);
+ compiler_args[0] = compiler_name;
+ }
+
diff --git a/sys-devel/distcc/files/distcc-hardened.patch b/sys-devel/distcc/files/distcc-hardened.patch
new file mode 100644
index 000000000000..69b3a6516936
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-hardened.patch
@@ -0,0 +1,24 @@
+From: Gordon Malm <gengor@gentoo.org>
+
+Make distcc client pass -D__KERNEL__ macro. Hardened GCC uses this
+macro to determine if code intended to be run in-kernel is being compiled.
+If the code is kernel code, certain compile flags are not applied.
+
+When using distcc to build kernel code (modules, etc.) without this patch,
+the distccd host doesn't get passed -D__KERNEL__. Consequently, gcc on
+the distccd host applies all kinds of flags that it shouldn't.
+
+--- distcc-2.18.3/src/strip.c
++++ distcc-2.18.3-hardened/src/strip.c
+@@ -73,7 +73,10 @@ int dcc_strip_local_args(char **from, ch
+ /* skip through argv, copying all arguments but skipping ones that
+ * ought to be omitted */
+ for (from_i = to_i = 0; from[from_i]; from_i++) {
+- if (str_equal("-D", from[from_i])
++ if (str_equal("-D__KERNEL__", from[from_i])) {
++ to[to_i++] = from[from_i];
++ }
++ else if (str_equal("-D", from[from_i])
+ || str_equal("-I", from[from_i])
+ || str_equal("-U", from[from_i])
+ || str_equal("-L", from[from_i])
diff --git a/sys-devel/distcc/files/distcc-march-native.patch b/sys-devel/distcc/files/distcc-march-native.patch
new file mode 100644
index 000000000000..a5c9bb2e4da1
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-march-native.patch
@@ -0,0 +1,16 @@
+diff -ur distcc-2.18.3/src/arg.c distcc-modified/src/arg.c
+--- distcc-2.18.3/src/arg.c 2004-11-30 13:13:53.000000000 +0100
++++ distcc-modified/src/arg.c 2008-02-05 17:56:58.000000000 +0100
+@@ -171,6 +171,12 @@
+ to distribute it even if we could. */
+ rs_trace("%s implies -E (maybe) and must be local", a);
+ return EXIT_DISTCC_FAILED;
++ } else if (!strcmp(a, "-march=native")) {
++ rs_trace("-march=native generates code for local machine; must be local");
++ return EXIT_DISTCC_FAILED;
++ } else if (!strcmp(a, "-mtune=native")) {
++ rs_trace("-mtune=native optimizes for local machine; must be local");
++ return EXIT_DISTCC_FAILED;
+ } else if (str_startswith("-Wa,", a)) {
+ /* Look for assembler options that would produce output
+ * files and must be local.
diff --git a/sys-devel/distcc/files/distccd.service b/sys-devel/distcc/files/distccd.service
new file mode 100644
index 000000000000..3eb61396b84c
--- /dev/null
+++ b/sys-devel/distcc/files/distccd.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Distccd: A Distributed Compilation Server
+After=network.target
+
+[Service]
+User=distcc
+ExecStart=/usr/bin/distccd --verbose --no-detach --daemon --port 3632 -N 15 --allow $ALLOWED_SERVERS
+
+[Install]
+WantedBy=multi-user.target
diff --git a/sys-devel/distcc/files/distccd.service.conf b/sys-devel/distcc/files/distccd.service.conf
new file mode 100644
index 000000000000..a334c3724b96
--- /dev/null
+++ b/sys-devel/distcc/files/distccd.service.conf
@@ -0,0 +1,6 @@
+# --allow is now mandatory as of distcc-2.18.
+# example: --allow 192.168.0.0/24
+# example: --allow 192.168.0.5 --allow 192.168.0.150
+
+[Service]
+Environment="ALLOWED_SERVERS=127.0.0.1"
diff --git a/sys-devel/distcc/metadata.xml b/sys-devel/distcc/metadata.xml
new file mode 100644
index 000000000000..3dcc309a3965
--- /dev/null
+++ b/sys-devel/distcc/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>cluster</herd>
+ <longdescription lang="en">
+ Distcc is a program to distribute compilation of C code across several
+ machines on a network.
+ </longdescription>
+ <use>
+ <flag name="crossdev">Enable support for <pkg>sys-devel/crossdev</pkg></flag>
+ <flag name="gssapi">Enable support for <pkg>net-libs/libgssglue</pkg></flag>
+ </use>
+</pkgmetadata>
diff --git a/sys-devel/dragonegg/Manifest b/sys-devel/dragonegg/Manifest
new file mode 100644
index 000000000000..49adf4d62391
--- /dev/null
+++ b/sys-devel/dragonegg/Manifest
@@ -0,0 +1,4 @@
+DIST dragonegg-3.5.1.src.tar.xz 374928 SHA256 65e7974a34406463cdfb8c0badd4dfe293ebe771a3d00c4d674d73c8007706e6 SHA512 546bef95aeea39e677b7e20a6d3085e3acac199dbebac12aa38b0991dc6420a07dd4e80466fd5a91285411095b33b0a23a4973dc911667fb4cc3461ef3af5a22 WHIRLPOOL f389644ad8829fb4be37ec1472ef6f5e2ee0f5a52e61395180ba97b70d624c5480463a77d1b4899a9472ec9771bb9789f1d5521e65edc2a9e3ff4eba4fb41b99
+DIST dragonegg-3.6.0.src.tar.xz 375432 SHA256 42c952ac446893b17f971b7361c51f96ddd18ac4e532d7bd25242801e6b8fb07 SHA512 ddad6653c39d8d4f111d3540dd2824a678ff977683f8ea1f396ca6b63eaf41bfd3a1fa32cec3f02ff243672a870fdfb116a8e4a2e9b80746d2010c00b15291d2 WHIRLPOOL c00aa21abcce10473dd8d2a2b74caf1e67d50d241c6ae34b794376e3a7f9e9e2df85f6ef637781dd24ce9c96d3b04459672eb86604a436103dfb348d44523264
+DIST llvm-3.5.1.src.tar.xz 11869356 SHA256 bf3275d2d7890015c8d8f5e6f4f882f8cf3bf51967297ebe74111d6d8b53be15 SHA512 a643ff173627e813b26077829b1af801b75daa5dcea540c4f05366ed57ef6aeafaf8b3fe4208d4c1b303a048a90ddac48a23488480c165637ae9218de140ae55 WHIRLPOOL 798ad46bc21570d8e5b0caadf2c0b434382fd78bfea5a08097fa001019b749b828e56ffe330435e5f3556700e8b0bee29e4139a7ff6b2824bb83dcc8caba2606
+DIST llvm-3.6.0.src.tar.xz 12750908 SHA256 b39a69e501b49e8f73ff75c9ad72313681ee58d6f430bfad4d81846fe92eb9ce SHA512 ca492b7d86333f05930dc849c7a8beff981da51ca174cd844650b516d0a592a2c3837d5a8a9b62713c0f29292b845f27ef0ec361809e325c6b60cbbcd3f20357 WHIRLPOOL 4f9de6b8dd2514e7b55e8c6e6af2ab9d355ebf49f1bd113a652f71809d74060792a95f6cee5b8b3bd64d92586b46e7778f616027702c98eb726ee84375e4eea6
diff --git a/sys-devel/dragonegg/dragonegg-3.5.1.ebuild b/sys-devel/dragonegg/dragonegg-3.5.1.ebuild
new file mode 100644
index 000000000000..82e360494c0b
--- /dev/null
+++ b/sys-devel/dragonegg/dragonegg-3.5.1.ebuild
@@ -0,0 +1,56 @@
+# 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="GCC plugin that uses LLVM for optimization and code generation"
+HOMEPAGE="http://dragonegg.llvm.org/"
+SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz
+ test? ( http://llvm.org/releases/${PV}/llvm-${PV}.src.tar.xz )"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux"
+IUSE="test"
+
+DEPEND=">=sys-devel/gcc-4.5:*
+ =sys-devel/llvm-${PV}*"
+RDEPEND="${DEPEND}"
+
+S=${WORKDIR}/${P}.src
+
+pkg_pretend() {
+ # Bug #511640: gcc 4.9 removed a required header
+ if [[ ${MERGE_TYPE} != binary ]]; then
+ [[ $(gcc-version) > 4.8 || $(gcc-version) < 4.5 ]] && \
+ die 'The active compiler needs to be gcc 4.[5-8])'
+ fi
+}
+
+src_compile() {
+ # GCC: compiler to use plugin with
+ emake CC="$(tc-getCC)" GCC="$(tc-getCC)" CXX="$(tc-getCXX)" VERBOSE=1
+}
+
+src_test() {
+ # GCC languages are determined via locale-dependant gcc -v output
+ export LC_ALL=C
+
+ emake LIT_DIR="${WORKDIR}"/llvm-${PV}.src/utils/lit check
+}
+
+src_install() {
+ exeinto /usr/$(get_libdir)
+ doexe dragonegg.so
+
+ dodoc README
+}
+
+pkg_postinst() {
+ elog "To use dragonegg, run gcc as usual, with an extra command line argument:"
+ elog " -fplugin=/usr/$(get_libdir)/dragonegg.so"
+ elog "If you change the active gcc profile, or update gcc to a new version,"
+ elog "you will have to remerge this package to update the plugin"
+}
diff --git a/sys-devel/dragonegg/dragonegg-3.6.0.ebuild b/sys-devel/dragonegg/dragonegg-3.6.0.ebuild
new file mode 100644
index 000000000000..82e360494c0b
--- /dev/null
+++ b/sys-devel/dragonegg/dragonegg-3.6.0.ebuild
@@ -0,0 +1,56 @@
+# 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="GCC plugin that uses LLVM for optimization and code generation"
+HOMEPAGE="http://dragonegg.llvm.org/"
+SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz
+ test? ( http://llvm.org/releases/${PV}/llvm-${PV}.src.tar.xz )"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux"
+IUSE="test"
+
+DEPEND=">=sys-devel/gcc-4.5:*
+ =sys-devel/llvm-${PV}*"
+RDEPEND="${DEPEND}"
+
+S=${WORKDIR}/${P}.src
+
+pkg_pretend() {
+ # Bug #511640: gcc 4.9 removed a required header
+ if [[ ${MERGE_TYPE} != binary ]]; then
+ [[ $(gcc-version) > 4.8 || $(gcc-version) < 4.5 ]] && \
+ die 'The active compiler needs to be gcc 4.[5-8])'
+ fi
+}
+
+src_compile() {
+ # GCC: compiler to use plugin with
+ emake CC="$(tc-getCC)" GCC="$(tc-getCC)" CXX="$(tc-getCXX)" VERBOSE=1
+}
+
+src_test() {
+ # GCC languages are determined via locale-dependant gcc -v output
+ export LC_ALL=C
+
+ emake LIT_DIR="${WORKDIR}"/llvm-${PV}.src/utils/lit check
+}
+
+src_install() {
+ exeinto /usr/$(get_libdir)
+ doexe dragonegg.so
+
+ dodoc README
+}
+
+pkg_postinst() {
+ elog "To use dragonegg, run gcc as usual, with an extra command line argument:"
+ elog " -fplugin=/usr/$(get_libdir)/dragonegg.so"
+ elog "If you change the active gcc profile, or update gcc to a new version,"
+ elog "you will have to remerge this package to update the plugin"
+}
diff --git a/sys-devel/dragonegg/dragonegg-9999.ebuild b/sys-devel/dragonegg/dragonegg-9999.ebuild
new file mode 100644
index 000000000000..b5c4277edd8a
--- /dev/null
+++ b/sys-devel/dragonegg/dragonegg-9999.ebuild
@@ -0,0 +1,55 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit git-r3 multilib toolchain-funcs
+
+DESCRIPTION="GCC plugin that uses LLVM for optimization and code generation"
+HOMEPAGE="http://dragonegg.llvm.org/"
+SRC_URI=""
+EGIT_REPO_URI="http://llvm.org/git/dragonegg.git"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS=""
+IUSE=""
+
+DEPEND=">=sys-devel/gcc-4.5:*
+ ~sys-devel/llvm-${PV}"
+RDEPEND="${DEPEND}"
+
+src_unpack() {
+ if has test $FEATURES
+ then
+ EGIT_REPO_URI="http://llvm.org/git/llvm.git" EGIT_CHECKOUT_DIR="${WORKDIR}/llvm" git-r3_src_unpack
+ fi
+ git-r3_src_unpack
+}
+
+src_compile() {
+ # GCC: compiler to use plugin with
+ emake CC="$(tc-getCC)" GCC="$(tc-getCC)" CXX="$(tc-getCXX)" VERBOSE=1
+}
+
+src_test() {
+ # GCC languages are determined via locale-dependant gcc -v output
+ export LC_ALL=C
+
+ emake LIT_DIR="${WORKDIR}"/llvm/utils/lit check
+}
+
+src_install() {
+ # Install plugin in llvm lib directory
+ exeinto /usr/$(get_libdir)/llvm
+ doexe dragonegg.so
+
+ dodoc README
+}
+
+pkg_postinst() {
+ elog "To use dragonegg, run gcc as usual, with an extra command line argument:"
+ elog " -fplugin=/usr/$(get_libdir)/llvm/dragonegg.so"
+ elog "If you change the active gcc profile, or update gcc to a new version,"
+ elog "you will have to remerge this package to update the plugin"
+}
diff --git a/sys-devel/dragonegg/metadata.xml b/sys-devel/dragonegg/metadata.xml
new file mode 100644
index 000000000000..6b1e8db2293f
--- /dev/null
+++ b/sys-devel/dragonegg/metadata.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>voyageur@gentoo.org</email>
+ <name>Bernard Cafarelli</name>
+ </maintainer>
+ <longdescription>DragonEgg is a <pkg>sys-devel/gcc</pkg> plugin (dragonegg.so) that replaces gcc's optimizers and code generators with those from the LLVM project. It is a reimplementation of llvm-gcc that works with gcc-4.5 or later.</longdescription>
+</pkgmetadata>
diff --git a/sys-devel/dwz/Manifest b/sys-devel/dwz/Manifest
new file mode 100644
index 000000000000..07fbf0f95e09
--- /dev/null
+++ b/sys-devel/dwz/Manifest
@@ -0,0 +1 @@
+DIST dwz-0.9.tar.xz 90604 SHA256 b909699372a3a02227184ffd4a22118cb50b975f55df7368d8851de9bb6a4e98 SHA512 ce139fd37cfd8cd6e1b6d162fb4896527122f4cb25685eed73eb3dc9fe7aea5ab85d59fe4e299940f0bc5a7cc7c9fa54236581bd9dc4ffab3cc4d62f0f164cdc WHIRLPOOL 3d9840e725cffa9ec2aabb87c9601c867f3be15bbadb7cbb68a30dcd87792429d402ea01376fb0ee82e4f5c4133dde2a3e5488eb33a7bb583eba193655b0a015
diff --git a/sys-devel/dwz/dwz-0.9.ebuild b/sys-devel/dwz/dwz-0.9.ebuild
new file mode 100644
index 000000000000..a57abe878320
--- /dev/null
+++ b/sys-devel/dwz/dwz-0.9.ebuild
@@ -0,0 +1,23 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+DESCRIPTION="DWARF optimization and duplicate removal tool"
+HOMEPAGE="http://sourceware.org/git/?p=dwz.git;a=summary"
+SRC_URI="mirror://gentoo/${P}.tar.xz"
+
+LICENSE="GPL-2+ GPL-3+"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE=""
+
+DEPEND="dev-libs/elfutils"
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+ sed -i \
+ -e '/^CFLAGS/d' \
+ Makefile || die "sed failed"
+}
diff --git a/sys-devel/dwz/metadata.xml b/sys-devel/dwz/metadata.xml
new file mode 100644
index 000000000000..ff3a66e3fcda
--- /dev/null
+++ b/sys-devel/dwz/metadata.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>dev-zero@gentoo.org</email>
+ <name>Tiziano Müller</name>
+ </maintainer>
+ <longdescription>
+ The dwz package contains a program that attempts to optimize DWARF
+ debugging information contained in ELF shared libraries and ELF executables
+ for size, by replacing DWARF information representation with equivalent
+ smaller representation where possible and by reducing the amount of
+ duplication using techniques from DWARF standard appendix E - creating
+ DW_TAG_partial_unit compilation units (CUs) for duplicated information
+ and using DW_TAG_imported_unit to import it into each CU that needs it.
+ </longdescription>
+</pkgmetadata>
diff --git a/sys-devel/flex/Manifest b/sys-devel/flex/Manifest
new file mode 100644
index 000000000000..2acb71534bb8
--- /dev/null
+++ b/sys-devel/flex/Manifest
@@ -0,0 +1,5 @@
+DIST flex-2.5.35.tar.bz2 1256501 SHA256 0becbd4b2b36b99c67f8c22ab98f7f80c9860aec70f0350a0018f29a88704e7b SHA512 aa5aebbc7ccaa4697d7f0cfa3ba899dd3b327bc8551ba341c26bece7f9044951d0532e3ebf6ec63760204b4ff805f9f957d064e9a213ef8aac428e565de31343 WHIRLPOOL 5cb46a2cec84b1c6d25e22a1e4a6ac1a5100fcf32a488918f8bfe9236339ff2aac7f2dc35a590417fe1609d89511ab47de4ba4f7db17251b7408ea0f18e6894d
+DIST flex-2.5.37.tar.bz2 1303313 SHA256 17aa7b4ebf19a13bc2dff4115b416365c95f090061539a932a68092349ac052a SHA512 1f34285953a7f058e6a2dddc305fc82cfcaaa451d6d7777da17bf9cccbe4a08e480c8c28951fa5d2920e7c7adc40ccd0e51191b363c9a3c4137db5ded1cbbc2a WHIRLPOOL ee5a4dde9b373c57248df261a53ea951e12ccb3e6f2e6344c56c2d8393511389560b4843660edf2a0929e2ed6fc46ab8d832e36a8ee5fe4317ce85ccea14d6ca
+DIST flex-2.5.38.tar.xz 1349536 SHA256 3621e0217f6c2088411e5b6fd9f2d83f2fbf014dcdf24e80680f66e6dd93729c SHA512 98d4a722dcb23c0ebca997ef28ae40cebbe65e24adf8700ac9127404d1bcd0e30638d296d639afb092b65b4767f35f5ee0b0bf229ac040ef8029a04694d6d4c2 WHIRLPOOL 56e282bc56ef825a953d1211602de1a243164d09b9b794debffbd7c56830572d24910b20b44b8749173c9bc008bae99406320a5042a4054290b69320a1df3aed
+DIST flex-2.5.39.tar.xz 1347436 SHA256 c988bb3ab340aaba16df5a54ab98bb4760599975375c8ac9388a078b7f27e9e8 SHA512 488bfd40043851d6f069333090081cc09c8754cd098dd24655ea705dd381efc4e88080fe8060fe6c790f450695f1b209f7115b154723c203f43b00f4ccfa5bec WHIRLPOOL 6f46ed30ca3a3ac6449170171205031ab821a0d78aaed36c7faf59c12724f8787092ba1a3ea846e359791476da7f9bb007155caac60e696326445c75c5d70dd5
+DIST flex_2.5.35-10.diff.gz 41011 SHA256 1d57a2a73ae7b7d4bd95a7c3f5801ab39c0b2b55b5d838782da8d3801cc1a3b9 SHA512 ecb64cb5d27da0c82c99958640ee5f09afff4096a93817f68f3333f86a838ab4f21daf959bfc650b89e0d52a827c55265cb4c4a4f9efab050a8f91dd82258820 WHIRLPOOL 4fa27c32d81c766e657645816e4a24e46b126e5eb38ad38fc66a7d3d3e3100b76ec694898dcbcc486687f4ec9d89d517a670f7ca20de22586d2f0b56a7fe50cd
diff --git a/sys-devel/flex/files/flex-2.5.33-pic.patch b/sys-devel/flex/files/flex-2.5.33-pic.patch
new file mode 100644
index 000000000000..88ac8b3ce98a
--- /dev/null
+++ b/sys-devel/flex/files/flex-2.5.33-pic.patch
@@ -0,0 +1,12 @@
+--- Makefile.in 2007-02-06 12:27:32.000000000 +0100
++++ Makefile.in.new 2007-02-06 12:29:50.000000000 +0100
+@@ -993,7 +993,9 @@
+ ecs.o: ecs.c flexdef.h flexint.h
+ gen.o: gen.c flexdef.h flexint.h tables.h tables_shared.h
+ libmain.o: libmain.c
++ $(COMPILE) -fPIC -DPIC -o libmain.o -c libmain.c
+ libyywrap.o: libyywrap.c
++ $(COMPILE) -fPIC -DPIC -o libyywrap.o -c libyywrap.c
+ main.o: main.c flexdef.h flexint.h version.h options.h scanopt.h \
+ tables.h tables_shared.h
+ misc.o: misc.c flexdef.h flexint.h tables.h tables_shared.h
diff --git a/sys-devel/flex/files/flex-2.5.34-isatty.patch b/sys-devel/flex/files/flex-2.5.34-isatty.patch
new file mode 100644
index 000000000000..b397433c5c57
--- /dev/null
+++ b/sys-devel/flex/files/flex-2.5.34-isatty.patch
@@ -0,0 +1,53 @@
+Declare the isatty prototype all the time ... otherwise packages like
+doxygen and ttmkfdir fail to build.
+
+http://bugs.gentoo.org/119598
+
+--- flex/scan.c
++++ flex/scan.c
+@@ -4179,9 +4179,19 @@
+ yyfree((void *) b );
+ }
+
++#ifndef _UNISTD_H /* assume unistd.h has isatty() for us */
+-#ifndef __cplusplus
++#ifdef __cplusplus
++extern "C" {
++#endif
++#ifdef __THROW /* this is a gnuism */
++extern int isatty (int ) __THROW;
++#else
+ extern int isatty (int );
++#endif
+-#endif /* __cplusplus */
++#ifdef __cplusplus
++}
++#endif
++#endif
+
+ /* Initializes or reinitializes a buffer.
+ * This function is sometimes called more than once on the same buffer,
+--- flex/skel.c
++++ flex/skel.c
+@@ -2183,9 +2183,19 @@
+ "[[",
+ " m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],,",
+ " [[",
++ "#ifndef _UNISTD_H /* assume unistd.h has isatty() for us */",
+- "#ifndef __cplusplus",
++ "#ifdef __cplusplus",
++ "extern \"C\" {",
++ "#endif",
++ "#ifdef __THROW /* this is a gnuism */",
++ "extern int isatty M4_YY_PARAMS( int ) __THROW;",
++ "#else",
+ "extern int isatty M4_YY_PARAMS( int );",
++ "#endif",
+- "#endif /* __cplusplus */",
++ "#ifdef __cplusplus",
++ "}",
++ "#endif",
++ "#endif",
+ " ]])",
+ "]])",
+ "%endif",
diff --git a/sys-devel/flex/files/flex-2.5.35-gcc44.patch b/sys-devel/flex/files/flex-2.5.35-gcc44.patch
new file mode 100644
index 000000000000..69045bee9151
--- /dev/null
+++ b/sys-devel/flex/files/flex-2.5.35-gcc44.patch
@@ -0,0 +1,13 @@
+https://sourceforge.net/tracker/?func=detail&aid=2178663&group_id=97492&atid=618177
+
+diff -Naurp flex-2.5.35-orig/skel.c flex-2.5.35/skel.c
+--- flex-2.5.35-orig/skel.c 2009-03-25 22:21:16.000000000 -0600
++++ flex-2.5.35/skel.c 2009-03-25 22:22:22.000000000 -0600
+@@ -286,6 +286,7 @@ const char *skel[] = {
+ "#include <errno.h>",
+ "#include <cstdlib>",
+ "#include <cstring>",
++ "#include <cstdio>",
+ "/* end standard C++ headers. */",
+ "%endif",
+ "",
diff --git a/sys-devel/flex/files/flex-2.5.35-saneautotools.patch b/sys-devel/flex/files/flex-2.5.35-saneautotools.patch
new file mode 100644
index 000000000000..fd8487a71e83
--- /dev/null
+++ b/sys-devel/flex/files/flex-2.5.35-saneautotools.patch
@@ -0,0 +1,77 @@
+Index: flex-2.5.35/configure.in
+===================================================================
+--- flex-2.5.35.orig/configure.in
++++ flex-2.5.35/configure.in
+@@ -39,6 +39,7 @@ AM_GNU_GETTEXT_VERSION(0.12)
+ AC_PROG_YACC
+ AM_PROG_LEX
+ AC_PROG_CC
++AM_PROG_CC_C_O
+ AC_PROG_CXX
+ AC_PROG_LN_S
+ AC_PROG_RANLIB
+@@ -103,13 +104,6 @@ AC_HEADER_STDBOOL
+ AC_C_CONST
+ AC_TYPE_SIZE_T
+
+-# Checks for library functions.
+-
+-AC_FUNC_FORK
+-AC_FUNC_MALLOC
+-AC_FUNC_REALLOC
+-AC_CHECK_FUNCS([dup2 isascii memset pow regcomp setlocale strchr strtol])
+-
+ AC_CONFIG_FILES(
+ Makefile
+ doc/Makefile
+Index: flex-2.5.35/Makefile.am
+===================================================================
+--- flex-2.5.35.orig/Makefile.am
++++ flex-2.5.35/Makefile.am
+@@ -127,33 +127,6 @@ LIBS = @LIBINTL@ @LIBS@
+ skel.c: flex.skl mkskel.sh flexint.h tables_shared.h
+ sed 's/m4_/m4postproc_/g; s/m4preproc_/m4_/g' $(srcdir)/flex.skl | $(m4) -P -DFLEX_MAJOR_VERSION=`echo $(VERSION)|cut -f 1 -d .` -DFLEX_MINOR_VERSION=`echo $(VERSION)|cut -f 2 -d .` -DFLEX_SUBMINOR_VERSION=`echo $(VERSION)|cut -f 3 -d .` | sed 's/m4postproc_/m4_/g' | $(SHELL) $(srcdir)/mkskel.sh >skel.c
+
+-# Explicitly describe dependencies.
+-# You can recreate this with `gcc -I. -MM *.c'
+-buf.o: buf.c flexdef.h flexint.h
+-ccl.o: ccl.c flexdef.h flexint.h
+-dfa.o: dfa.c flexdef.h flexint.h tables.h tables_shared.h
+-ecs.o: ecs.c flexdef.h flexint.h
+-scanflags.o: scanflags.c flexdef.h flexint.h
+-gen.o: gen.c flexdef.h flexint.h tables.h tables_shared.h
+-libmain.o: libmain.c
+-libyywrap.o: libyywrap.c
+-main.o: main.c flexdef.h flexint.h version.h options.h scanopt.h \
+- tables.h tables_shared.h
+-misc.o: misc.c flexdef.h flexint.h tables.h tables_shared.h
+-nfa.o: nfa.c flexdef.h flexint.h
+-options.o: options.c options.h scanopt.h flexdef.h flexint.h
+-parse.o: parse.c flexdef.h flexint.h tables.h tables_shared.h
+-scan.o: scan.c flexdef.h flexint.h parse.h
+-scanopt.o: scanopt.c flexdef.h flexint.h scanopt.h
+-skel.o: skel.c flexdef.h flexint.h
+-sym.o: sym.c flexdef.h flexint.h
+-tables.o: tables.c flexdef.h flexint.h tables.h tables_shared.h
+-tables_shared.o: tables_shared.c flexdef.h flexint.h tables.h \
+- tables_shared.h
+-tblcmp.o: tblcmp.c flexdef.h flexint.h
+-yylex.o: yylex.c flexdef.h flexint.h parse.h
+-filter.o: filter.c flexdef.h flexint.h
+-
+ # Create the ChangeLog, but only if we're inside a cvs working directory
+
+ ChangeLog: $(srcdir)/tools/cvsauthors $(srcdir)/tools/cvs2cl.pl
+Index: flex-2.5.35/tests/test-pthread/Makefile.am
+===================================================================
+--- flex-2.5.35.orig/tests/test-pthread/Makefile.am
++++ flex-2.5.35/tests/test-pthread/Makefile.am
+@@ -27,7 +27,7 @@ CLEANFILES = scanner.c scanner.h parser.
+ OBJS = scanner.o # parser.o
+
+ AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
+-LDFLAGS = -lpthread
++LOADLIBES = -lpthread
+ #LFLAGS = --header="scanner.h"
+ #YFLAGS = --defines --output=parser.c
+
diff --git a/sys-devel/flex/files/flex-2.5.37-proto.patch b/sys-devel/flex/files/flex-2.5.37-proto.patch
new file mode 100644
index 000000000000..5d3c30ff18d2
--- /dev/null
+++ b/sys-devel/flex/files/flex-2.5.37-proto.patch
@@ -0,0 +1,27 @@
+From 0f9eb0b8455f843daebf0f3dababeee7f3cde48b Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Sat, 4 Aug 2012 15:46:38 -0400
+Subject: [PATCH] add prototype for lerrsf_fatal
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ flexdef.h | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/flexdef.h b/flexdef.h
+index 0e81410..046dd9a 100644
+--- a/flexdef.h
++++ b/flexdef.h
+@@ -908,6 +908,9 @@ extern void lerrif PROTO ((const char *, int));
+ /* Report an error message formatted with one string argument. */
+ extern void lerrsf PROTO ((const char *, const char *));
+
++/* Like lerrsf, but also exit after displaying message. */
++extern void lerrsf_fatal PROTO ((const char *, const char *));
++
+ /* Spit out a "#line" statement. */
+ extern void line_directive_out PROTO ((FILE *, int));
+
+--
+1.7.9.7
+
diff --git a/sys-devel/flex/files/flex-2.5.37-tests.patch b/sys-devel/flex/files/flex-2.5.37-tests.patch
new file mode 100644
index 000000000000..56d441a351e6
--- /dev/null
+++ b/sys-devel/flex/files/flex-2.5.37-tests.patch
@@ -0,0 +1,113 @@
+From 095b0bf0a730d46d301c0e2fb2e7af40caeb2c9b Mon Sep 17 00:00:00 2001
+From: Elias Pipping <pipping@users.sourceforge.net>
+Date: Mon, 6 Aug 2012 15:13:23 -0400
+Subject: [PATCH] Fix two tests to pass under bison 2.6
+
+Given that bison is moving forward with the %parse-param instead of
+YYPARSE_PARAM syntax, it makes sense to switch over to using the new style
+declaration. In particular, this means that flex scanners that use bison
+features will now require bison 2.6 or higher.
+
+Signed-off-by: Will Estes <westes575@gmail.com>
+---
+ tests/test-bison-yylloc/main.c | 2 --
+ tests/test-bison-yylloc/parser.y | 6 +++---
+ tests/test-bison-yylval/main.c | 2 --
+ tests/test-bison-yylval/parser.y | 6 ++----
+ 4 files changed, 5 insertions(+), 11 deletions(-)
+
+diff --git a/tests/test-bison-yylloc/main.c b/tests/test-bison-yylloc/main.c
+index 082c88c..24568a9 100644
+--- a/tests/test-bison-yylloc/main.c
++++ b/tests/test-bison-yylloc/main.c
+@@ -24,8 +24,6 @@
+ #include "parser.h"
+ #include "scanner.h"
+
+-extern int testparse(yyscan_t);
+-
+ int main ( int argc, char** argv )
+ {
+ yyscan_t scanner;
+diff --git a/tests/test-bison-yylloc/parser.y b/tests/test-bison-yylloc/parser.y
+index aaee976..e8f4e56 100644
+--- a/tests/test-bison-yylloc/parser.y
++++ b/tests/test-bison-yylloc/parser.y
+@@ -21,6 +21,8 @@
+ * PURPOSE.
+ */
+
++%parse-param { void* scanner }
++
+ /*
+ How to compile:
+ bison --defines --output-file="parser.c" --name-prefix="test" parser.y
+@@ -32,10 +34,8 @@
+ #include "config.h"
+
+ #define YYERROR_VERBOSE 1
+-#define YYPARSE_PARAM scanner
+ #define YYLEX_PARAM scanner
+
+-int yyerror(char* msg);
+ extern int testget_lineno(void*);
+
+
+@@ -89,7 +89,7 @@ line:
+
+ %%
+
+-int yyerror(char* msg) {
++int yyerror(void* scanner, char* msg) {
+ fprintf(stderr,"%s\n",msg);
+ return 0;
+ }
+diff --git a/tests/test-bison-yylval/main.c b/tests/test-bison-yylval/main.c
+index 165e672..30c4314 100644
+--- a/tests/test-bison-yylval/main.c
++++ b/tests/test-bison-yylval/main.c
+@@ -24,8 +24,6 @@
+ #include "parser.h"
+ #include "scanner.h"
+
+-extern int testparse(yyscan_t);
+-
+ int main ( int argc, char** argv )
+ {
+ yyscan_t scanner;
+diff --git a/tests/test-bison-yylval/parser.y b/tests/test-bison-yylval/parser.y
+index 77bac87..0ffdb89 100644
+--- a/tests/test-bison-yylval/parser.y
++++ b/tests/test-bison-yylval/parser.y
+@@ -25,6 +25,7 @@
+ How to compile:
+ bison --defines --output-file="parser.c" --name-prefix="test" parser.y
+ */
++%parse-param { void* scanner }
+ %{
+ #include <stdio.h>
+ #include <stdlib.h>
+@@ -32,11 +33,8 @@
+ #include "config.h"
+
+ #define YYERROR_VERBOSE 1
+-#define YYPARSE_PARAM scanner
+ #define YYLEX_PARAM scanner
+
+-int yyerror(char* msg);
+-
+
+ /* A dummy function. A check against seg-faults in yylval->str. */
+ int process_text(char* s) {
+@@ -76,7 +74,7 @@ starttag: LT TAGNAME GT { process_text($2); free($2);} ;
+ endtag: LTSLASH TAGNAME GT { process_text($2);free($2);} ;
+ %%
+
+-int yyerror(char* msg) {
++int yyerror(void* scanner, char* msg) {
+ fprintf(stderr,"%s\n",msg);
+ return 0;
+ }
+--
+1.7.9.7
+
diff --git a/sys-devel/flex/flex-2.5.35.ebuild b/sys-devel/flex/flex-2.5.35.ebuild
new file mode 100644
index 000000000000..8477cb9e20be
--- /dev/null
+++ b/sys-devel/flex/flex-2.5.35.ebuild
@@ -0,0 +1,43 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils flag-o-matic
+
+#DEB_VER=36
+DESCRIPTION="The Fast Lexical Analyzer"
+HOMEPAGE="http://flex.sourceforge.net/"
+SRC_URI="mirror://sourceforge/flex/${P}.tar.bz2"
+# mirror://debian/pool/main/f/flex/${PN}_${PV}-${DEB_VER}.diff.gz"
+
+LICENSE="FLEX"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc ~sparc-fbsd x86 ~x86-fbsd"
+IUSE="nls static test"
+
+RDEPEND="sys-devel/m4"
+DEPEND="${RDEPEND}
+ nls? ( sys-devel/gettext )
+ test? ( sys-devel/bison )"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ [[ -n ${DEB_VER} ]] && epatch "${WORKDIR}"/${PN}_${PV}-${DEB_VER}.diff
+ epatch "${FILESDIR}"/${PN}-2.5.34-isatty.patch #119598
+ epatch "${FILESDIR}"/${PN}-2.5.33-pic.patch
+ epatch "${FILESDIR}"/${PN}-2.5.35-gcc44.patch
+ sed -i 's:^LDFLAGS:LOADLIBES:' tests/test-pthread/Makefile.in #262989
+}
+
+src_compile() {
+ use static && append-ldflags -static
+ econf $(use_enable nls) || die
+ emake || die
+}
+
+src_install() {
+ emake install DESTDIR="${D}" || die "make install failed"
+ dodoc AUTHORS ChangeLog NEWS ONEWS README* THANKS TODO
+ dosym flex /usr/bin/lex
+}
diff --git a/sys-devel/flex/flex-2.5.35_p10.ebuild b/sys-devel/flex/flex-2.5.35_p10.ebuild
new file mode 100644
index 000000000000..2b58515fc0bc
--- /dev/null
+++ b/sys-devel/flex/flex-2.5.35_p10.ebuild
@@ -0,0 +1,50 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils flag-o-matic autotools
+
+if [[ ${PV} == *_p* ]]; then
+ DEB_DIFF=${PN}_${PV/_p/-}
+fi
+
+MY_P=${P%_p*}
+
+DESCRIPTION="The Fast Lexical Analyzer"
+HOMEPAGE="http://flex.sourceforge.net/"
+SRC_URI="mirror://sourceforge/flex/${MY_P}.tar.bz2
+ ${DEB_DIFF:+mirror://debian/pool/main/f/flex/${DEB_DIFF}.diff.gz}"
+
+LICENSE="FLEX"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE="nls static test"
+
+# We want bison explicitly and not yacc in general #381273
+RDEPEND="sys-devel/m4"
+DEPEND="${RDEPEND}
+ nls? ( sys-devel/gettext )
+ test? ( sys-devel/bison )"
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+ [[ -n ${DEB_DIFF} ]] && epatch "${WORKDIR}"/${DEB_DIFF}.diff
+ epatch "${FILESDIR}"/${PN}-2.5.35-gcc44.patch
+ epatch "${FILESDIR}"/${PN}-2.5.35-saneautotools.patch
+
+ eautoreconf
+}
+
+src_configure() {
+ use static && append-ldflags -static
+ econf $(use_enable nls)
+}
+
+src_install() {
+ emake install DESTDIR="${D}" || die "make install failed"
+ dodoc AUTHORS ChangeLog NEWS ONEWS README* THANKS TODO || die
+ dosym flex /usr/bin/lex
+}
diff --git a/sys-devel/flex/flex-2.5.37.ebuild b/sys-devel/flex/flex-2.5.37.ebuild
new file mode 100644
index 000000000000..dc37f634f0c2
--- /dev/null
+++ b/sys-devel/flex/flex-2.5.37.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils flag-o-matic toolchain-funcs
+
+if [[ ${PV} == *_p* ]] ; then
+ DEB_DIFF=${PN}_${PV/_p/-}
+fi
+MY_P=${P%_p*}
+
+DESCRIPTION="The Fast Lexical Analyzer"
+HOMEPAGE="http://flex.sourceforge.net/"
+SRC_URI="mirror://sourceforge/flex/${MY_P}.tar.bz2
+ ${DEB_DIFF:+mirror://debian/pool/main/f/flex/${DEB_DIFF}.diff.gz}"
+
+LICENSE="FLEX"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~arm-linux ~x86-linux"
+IUSE="nls static test"
+
+# We want bison explicitly and not yacc in general #381273
+RDEPEND="sys-devel/m4"
+DEPEND="${RDEPEND}
+ nls? ( sys-devel/gettext )
+ test? ( sys-devel/bison )"
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+ [[ -n ${DEB_DIFF} ]] && epatch "${WORKDIR}"/${DEB_DIFF}.diff
+ epatch "${FILESDIR}"/${P}-proto.patch
+ epatch "${FILESDIR}"/${P}-tests.patch #429954
+ sed -i "/^AR =/s:=.*:= $(tc-getAR):" Makefile.in || die #444086
+}
+
+src_configure() {
+ use static && append-ldflags -static
+ econf \
+ $(use_enable nls) \
+ --docdir="${EPREFIX}"/usr/share/doc/${PF}
+}
+
+src_install() {
+ emake install DESTDIR="${D}" || die
+ rm "${ED}"/usr/share/doc/${PF}/{COPYING,flex.pdf} || die
+ dodoc AUTHORS ChangeLog NEWS ONEWS README* THANKS TODO
+ dosym flex /usr/bin/lex
+}
diff --git a/sys-devel/flex/flex-2.5.38-r1.ebuild b/sys-devel/flex/flex-2.5.38-r1.ebuild
new file mode 100644
index 000000000000..7faf4211d8ba
--- /dev/null
+++ b/sys-devel/flex/flex-2.5.38-r1.ebuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit flag-o-matic
+
+DESCRIPTION="The Fast Lexical Analyzer"
+HOMEPAGE="http://flex.sourceforge.net/"
+SRC_URI="mirror://sourceforge/flex/${P}.tar.xz"
+
+LICENSE="FLEX"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~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="nls static test"
+
+# We want bison explicitly and not yacc in general #381273
+RDEPEND="sys-devel/m4"
+DEPEND="${RDEPEND}
+ app-arch/xz-utils
+ nls? ( sys-devel/gettext )
+ test? ( sys-devel/bison )"
+
+src_configure() {
+ use static && append-ldflags -static
+ # Do not install shared libs #503522
+ econf \
+ --disable-shared \
+ $(use_enable nls) \
+ --docdir='$(datarootdir)/doc/'${PF}
+}
+
+src_install() {
+ default
+ dodoc ONEWS
+ find "${ED}" -name '*.la' -delete
+ rm "${ED}"/usr/share/doc/${PF}/{COPYING,flex.pdf} || die
+ dosym flex /usr/bin/lex
+}
diff --git a/sys-devel/flex/flex-2.5.39-r1.ebuild b/sys-devel/flex/flex-2.5.39-r1.ebuild
new file mode 100644
index 000000000000..ae1708c435ca
--- /dev/null
+++ b/sys-devel/flex/flex-2.5.39-r1.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 eutils flag-o-matic multilib-minimal
+
+DESCRIPTION="The Fast Lexical Analyzer"
+HOMEPAGE="http://flex.sourceforge.net/"
+SRC_URI="mirror://sourceforge/flex/${P}.tar.xz"
+
+LICENSE="FLEX"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~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="nls static test"
+
+# We want bison explicitly and not yacc in general #381273
+RDEPEND="sys-devel/m4"
+DEPEND="${RDEPEND}
+ app-arch/xz-utils
+ nls? ( sys-devel/gettext )
+ test? ( sys-devel/bison )"
+
+src_configure() {
+ use static && append-ldflags -static
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ # Do not install shared libs #503522
+ ECONF_SOURCE=${S} \
+ econf \
+ --disable-shared \
+ $(use_enable nls) \
+ --docdir='$(datarootdir)/doc/'${PF}
+}
+
+multilib_src_compile() {
+ if multilib_is_native_abi; then
+ default
+ else
+ emake -f Makefile -f - lib <<< 'lib: $(lib_LTLIBRARIES)'
+ fi
+}
+
+multilib_src_test() {
+ multilib_is_native_abi && emake check
+}
+
+multilib_src_install() {
+ if multilib_is_native_abi; then
+ default
+ else
+ emake DESTDIR="${D}" install-libLTLIBRARIES install-includeHEADERS
+ fi
+}
+
+multilib_src_install_all() {
+ einstalldocs
+ dodoc ONEWS
+ prune_libtool_files --all
+ rm "${ED}"/usr/share/doc/${PF}/{COPYING,flex.pdf} || die
+ dosym flex /usr/bin/lex
+}
diff --git a/sys-devel/flex/flex-2.5.39.ebuild b/sys-devel/flex/flex-2.5.39.ebuild
new file mode 100644
index 000000000000..7faf4211d8ba
--- /dev/null
+++ b/sys-devel/flex/flex-2.5.39.ebuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit flag-o-matic
+
+DESCRIPTION="The Fast Lexical Analyzer"
+HOMEPAGE="http://flex.sourceforge.net/"
+SRC_URI="mirror://sourceforge/flex/${P}.tar.xz"
+
+LICENSE="FLEX"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~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="nls static test"
+
+# We want bison explicitly and not yacc in general #381273
+RDEPEND="sys-devel/m4"
+DEPEND="${RDEPEND}
+ app-arch/xz-utils
+ nls? ( sys-devel/gettext )
+ test? ( sys-devel/bison )"
+
+src_configure() {
+ use static && append-ldflags -static
+ # Do not install shared libs #503522
+ econf \
+ --disable-shared \
+ $(use_enable nls) \
+ --docdir='$(datarootdir)/doc/'${PF}
+}
+
+src_install() {
+ default
+ dodoc ONEWS
+ find "${ED}" -name '*.la' -delete
+ rm "${ED}"/usr/share/doc/${PF}/{COPYING,flex.pdf} || die
+ dosym flex /usr/bin/lex
+}
diff --git a/sys-devel/flex/metadata.xml b/sys-devel/flex/metadata.xml
new file mode 100644
index 000000000000..00f4c58c1f89
--- /dev/null
+++ b/sys-devel/flex/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">flex</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-devel/gcc-apple/Manifest b/sys-devel/gcc-apple/Manifest
new file mode 100644
index 000000000000..cffe6c874554
--- /dev/null
+++ b/sys-devel/gcc-apple/Manifest
@@ -0,0 +1,6 @@
+DIST gcc-5493.tar.gz 40601890 SHA256 acdb2cc0abf049bfda433806fc82e235c6b6c5f86a0e8fd54f62ed3a8606452f SHA512 a874134e9fb11131d958c475a8d9ffeb659b30509e11b47d80b2d1bf6d1f9ec0dbbd338ff5754dc8dece7af8b486d554860469d240eb37dd480ede9fd6afc8fc WHIRLPOOL 327c554ebdd8b23392264fc4d5b00ad5eec4b4888c952051ef84d11f18bee463ff4b87711ddd8ce14708aa0fcb57209043d6d27973dda4f8dcb7ba14590b70a3
+DIST gcc-5664.tar.gz 24688506 SHA256 9e1533b6a894e8cf90b0d56c353fc1175d0f14ec19e03c307726af4de883c987 SHA512 7676de5f8eece8b9ae3a119379df0ad9e5b53ea37ce6fc60fa12fcaaa903188b116b35d997e0baff2b7cac4bd3a8462bc52d6955d05de0ab399c6c11c87ff6d5 WHIRLPOOL e663055409299ba8d0cf57694dc7b8e665ffef7c79f37bd27d6f855c6264e5815f09654f75f8a9495e5a582fb360215939ee7a84abfd4bc6e8aa777edd892790
+DIST gcc-5666.3.tar.gz 19367320 SHA256 6c46f4376d11ada5be0cfc3894b9296edf574af3c616ab71803ea78edfd7015b SHA512 31cf52a00f31bcd7c47382888152cfe9851688c8fb7b1f236197b06b8acdd96b1943d327f8fab0fd305531c99a8fbf4865b2214dc2d1a236bb8ad39f710ce931 WHIRLPOOL 03711b56d38b2cb3b5af735802a82ef435cf42c3aa4fa74fa754b016edea447d011e626115fe59449def14ac34422788340165faab567b6fb992d1fe1684f93d
+DIST gcc-fortran-4.2.4.tar.bz2 905688 SHA256 6fc2056cd62921b2859381749710af765a46877bd46f9fe5ef6fab0671c47e04 SHA512 1a36587a3691b8d7ecd23938efcdfca42642b6b260a1c830f6d791bb1b8ac32953998c45d77eee2d557861d631431569503c796b61aeaea9ac5fffbce1982faa WHIRLPOOL 5db1f448b3c08985ee2d0b1a9101e72733f4859184892da67268650c1010c26487b5ff15670151e67fdde5e4bd9053ed2e98b1582d1f4f99375b1bcdaf94351a
+DIST libstdcxx-16.tar.gz 64695692 SHA256 a7d8041e50e110f5a503e188a05cb217f0c99c51f248a0a1387cc07a0b6f167f SHA512 2f0e8d694aaaf94fc2a0463ebd4a5775865421dedb431a6f6f701a8d33078e768bef232f72e2cf1f8e2d278eb60ff54030f5ad22b43eb0643d49bc4717e96b05 WHIRLPOOL fb90a1df90e60717906d227fb1dc2b8639fd063dbf6eec39d3a840dc8025c5384bd2c8b0a86158f8c072a1008ac2561e8e9f512ef4a4f84c081903154bb9d378
+DIST libstdcxx-39.tar.gz 117081330 SHA256 aad6c0b7aa80b8117af1868d502f7aa4d042e5f33cada853a8ba75980391c6bb SHA512 c640292c0f371069fbb635ed0385627c8abab869db93513922e19b25886864d093eef3684c49bf1ba82325f2d1d3cd1eb382ef6ea9dee039208fe99fe8653db6 WHIRLPOOL ae0eba85e393ea8f14369557712e26c6662e147dec6d8ec0da0919a8290a834c7a1c0150bcc48972f111a14fcfe1501362b2b0dc9dc57aeb8456a35b74d8457e
diff --git a/sys-devel/gcc-apple/files/gcc-apple-4.0.1_p5465-default-altivec.patch b/sys-devel/gcc-apple/files/gcc-apple-4.0.1_p5465-default-altivec.patch
new file mode 100644
index 000000000000..e7b0bbbf8078
--- /dev/null
+++ b/sys-devel/gcc-apple/files/gcc-apple-4.0.1_p5465-default-altivec.patch
@@ -0,0 +1,38 @@
+* reverse patch to gain 10.4 behaviour for AltiVec.
+
+--- gcc/config/rs6000/rs6000-c.c
++++ gcc/config/rs6000/rs6000-c.c
+@@ -245,22 +245,22 @@
+ builtin_define ("__bool=__attribute__((altivec(bool__))) unsigned");
+
+ /* APPLE LOCAL begin AltiVec */
++ builtin_define ("vector=vector");
++ builtin_define ("pixel=pixel");
++ builtin_define ("_Bool=_Bool");
++ builtin_define ("bool=bool");
++ init_vector_keywords (pfile);
++
++ /* Indicate that the compiler supports Apple AltiVec syntax,
++ including context-sensitive keywords. */
+ if (rs6000_altivec_pim)
+ {
+- builtin_define ("vector=vector");
+- builtin_define ("pixel=pixel");
+- builtin_define ("_Bool=_Bool");
+- builtin_define ("bool=bool");
+- init_vector_keywords (pfile);
+-
+- /* Indicate that the compiler supports Apple AltiVec syntax,
+- including context-sensitive keywords. */
+ builtin_define ("__APPLE_ALTIVEC__");
+ builtin_define ("vec_step(T)=(sizeof (__typeof__(T)) / sizeof (__typeof__(T) __attribute__((altivec(element__)))))");
+-
+- /* Enable context-sensitive macros. */
+- cpp_get_callbacks (pfile)->macro_to_expand = rs6000_macro_to_expand;
+ }
++
++ /* Enable context-sensitive macros. */
++ cpp_get_callbacks (pfile)->macro_to_expand = rs6000_macro_to_expand;
+ /* APPLE LOCAL end AltiVec */
+ }
+ if (TARGET_SPE)
diff --git a/sys-devel/gcc-apple/files/gcc-apple-4.2.1-arch-option.patch b/sys-devel/gcc-apple/files/gcc-apple-4.2.1-arch-option.patch
new file mode 100644
index 000000000000..94abba89306c
--- /dev/null
+++ b/sys-devel/gcc-apple/files/gcc-apple-4.2.1-arch-option.patch
@@ -0,0 +1,57 @@
+Description: Add dummy -arch option with simplistic check.
+Author: Heiko Przybyl <zuxez@cs.tu-berlin.de>
+
+diff -pruN gcc-5664.orig/gcc/gcc.c gcc-5664/gcc/gcc.c
+--- gcc-5664.orig/gcc/gcc.c 2010-09-21 22:28:11.000000000 +0200
++++ gcc-5664/gcc/gcc.c 2010-09-21 22:28:24.000000000 +0200
+@@ -88,6 +88,8 @@ compilation is specified by a string cal
+ #include "flags.h"
+ #include "opts.h"
+
++#include <mach-o/arch.h>
++
+ /* By default there is no special suffix for target executables. */
+ /* FIXME: when autoconf is fixed, remove the host check - dj */
+ #if defined(TARGET_EXECUTABLE_SUFFIX) && defined(HOST_EXECUTABLE_SUFFIX)
+--- gcc-5664/gcc/gcc.c.orig 2010-09-22 01:30:04.000000000 +0200
++++ gcc-5664/gcc/gcc.c 2010-09-22 01:36:52.000000000 +0200
+@@ -1401,6 +1401,39 @@ translate_options (int *argcp, const cha
+ nskip += 1;
+ else if (! strcmp (p, "Xassembler"))
+ nskip += 1;
++ /* GENTOO_PORTAGE Allow but filter -arch. */
++ if (! strcmp (p, "arch")) {
++ if (i + 1 == argc)
++ fatal ("argument to `-arch' is missing");
++ /* Check current arch vs. given arch if possible. */
++ const NXArchInfo *ai = NXGetLocalArchInfo();
++ if (ai) {
++ /* Returns the most generic setting */
++ /* aka "i386", "x86_64", "ppc", "ppc64", "arm". */
++ const NXArchInfo *gai = NXGetArchInfoFromCpuType(ai->cputype, CPU_SUBTYPE_MULTIPLE);
++ if (gai) {
++ const char *name = gai->name;
++#ifdef __LP64__
++ /* Make sure x64 on 32bit kernel is set correctly. */
++ if (gai->cputype == CPU_TYPE_I386) {
++ name = "x86_64";
++ }
++ else if (gai->cputype == CPU_TYPE_POWERPC) {
++ name = "ppc64";
++ }
++#endif
++ if (strcmp(name, argv[i + 1]) != 0) {
++ fatal ("`-arch %s' does not match current compiler arch `%s'",
++ argv[i + 1], name);
++ }
++ }
++ }
++
++ /* Skip argument. */
++ i += 2;
++ /* Don't add option to the new env. */
++ nskip = 0;
++ }
+
+ /* Watch out for an option at the end of the command line that
+ is missing arguments, and avoid skipping past the end of the
diff --git a/sys-devel/gcc-apple/files/gcc-apple-4.2.1-autoconf-m4-precious.patch b/sys-devel/gcc-apple/files/gcc-apple-4.2.1-autoconf-m4-precious.patch
new file mode 100644
index 000000000000..4873187c19d4
--- /dev/null
+++ b/sys-devel/gcc-apple/files/gcc-apple-4.2.1-autoconf-m4-precious.patch
@@ -0,0 +1,12 @@
+http://sourceware.org/ml/libffi-discuss/2009/msg00289.html
+
+--- libgomp/configure.ac
++++ libgomp/configure.ac
+@@ -110,6 +110,7 @@
+ m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
+ m4_define([_AC_ARG_VAR_PRECIOUS],[])
+ AC_PROG_CC
++m4_undefine([_AC_ARG_VAR_PRECIOUS])
+ m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
+
+ AC_SUBST(CFLAGS)
diff --git a/sys-devel/gcc-apple/files/gcc-apple-4.2.1-dsymutil.patch b/sys-devel/gcc-apple/files/gcc-apple-4.2.1-dsymutil.patch
new file mode 100644
index 000000000000..8da025d8c5d0
--- /dev/null
+++ b/sys-devel/gcc-apple/files/gcc-apple-4.2.1-dsymutil.patch
@@ -0,0 +1,20 @@
+Revert of dsymutil part of
+http://gcc.gnu.org/ml/gcc-patches/2006-09/msg00057.html
+See http://article.gmane.org/gmane.linux.gentoo.alt/4327
+
+--- gcc/config/darwin.h
++++ gcc/config/darwin.h
+@@ -326,12 +326,7 @@
+ "/* APPLE LOCAL nested functions 4357979 */"\
+ %{fnested-functions: -allow_stack_execute} \
+ %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %G %L}} \
+-"/* APPLE LOCAL begin mainline 4.3 2006-10-31 4370146 */"\
+- %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} %{F*} }}}}}}}}\n\
+-%{!fdump=*:%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
+-"/* APPLE LOCAL end mainline 4.3 2006-10-31 4370146 */"\
+- %{.c|.cc|.C|.cpp|.cp|.c++|.cxx|.CPP|.m|.mm: \
+- %{g*:%{!gstabs*:%{!g0: dsymutil %{o*:%*}%{!o:a.out}}}}}}}}}}}}"
++ %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} %{F*} }}}}}}}}"
+ /* APPLE LOCAL end mainline */
+
+ #ifdef TARGET_SYSTEM_ROOT
diff --git a/sys-devel/gcc-apple/files/gcc-apple-4.2.1-prefix-search-dirs-r1.patch b/sys-devel/gcc-apple/files/gcc-apple-4.2.1-prefix-search-dirs-r1.patch
new file mode 100644
index 000000000000..497248527d6d
--- /dev/null
+++ b/sys-devel/gcc-apple/files/gcc-apple-4.2.1-prefix-search-dirs-r1.patch
@@ -0,0 +1,39 @@
+In Prefix we are really self-providing, so don't look back!
+Original patch by Heiko Przybyl
+
+/usr/lib and /lib are not valid locations to search for startfiles,
+especially as they come BEFORE the prefix locations.
+
+--- gcc/gcc.c
++++ gcc/gcc.c
+@@ -1525,8 +1525,8 @@ static const char *gcc_libexec_prefix;
+ #endif
+
+ static const char *const standard_exec_prefix = STANDARD_EXEC_PREFIX;
+-static const char *const standard_exec_prefix_1 = "/usr/libexec/gcc/";
+-static const char *const standard_exec_prefix_2 = "/usr/lib/gcc/";
++static const char *const standard_exec_prefix_1 = "@GENTOO_PORTAGE_EPREFIX@/usr/libexec/gcc/";
++static const char *const standard_exec_prefix_2 = "@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/";
+ static const char *md_exec_prefix = MD_EXEC_PREFIX;
+
+ static const char *md_startfile_prefix = MD_STARTFILE_PREFIX;
+diff --git a/a/gcc/config/darwin.h b/b/gcc/config/darwin.h
+index 482cd4c..b971c64 100644
+--- gcc/config/darwin.h
++++ gcc/config/darwin.h
+@@ -24,6 +24,15 @@ Boston, MA 02110-1301, USA. */
+ #ifndef CONFIG_DARWIN_H
+ #define CONFIG_DARWIN_H
+
++#undef STANDARD_STARTFILE_PREFIX
++#define STANDARD_STARTFILE_PREFIX "@GENTOO_PORTAGE_TPREFIX@/usr/lib"
++
++#undef STANDARD_STARTFILE_PREFIX_1
++#define STANDARD_STARTFILE_PREFIX_1 "@GENTOO_PORTAGE_TPREFIX@/lib"
++
++#undef STANDARD_STARTFILE_PREFIX_2
++#define STANDARD_STARTFILE_PREFIX_2 STANDARD_STARTFILE_PREFIX_1
++
+ /* The definitions in this file are common to all processor types
+ running Darwin, which is the kernel for Mac OS X. Darwin is
+ basically a BSD user layer laid over a Mach kernel, then evolved
diff --git a/sys-devel/gcc-apple/files/gcc-apple-4.2.1-prefix-search-dirs.patch b/sys-devel/gcc-apple/files/gcc-apple-4.2.1-prefix-search-dirs.patch
new file mode 100644
index 000000000000..2cd947b4e82f
--- /dev/null
+++ b/sys-devel/gcc-apple/files/gcc-apple-4.2.1-prefix-search-dirs.patch
@@ -0,0 +1,27 @@
+In Prefix we are really self-providing, so don't look back!
+Patch by Heiko Przybyl
+
+--- gcc/gcc.c
++++ gcc/gcc.c
+@@ -1525,8 +1525,8 @@ static const char *gcc_libexec_prefix;
+ #endif
+
+ static const char *const standard_exec_prefix = STANDARD_EXEC_PREFIX;
+-static const char *const standard_exec_prefix_1 = "/usr/libexec/gcc/";
+-static const char *const standard_exec_prefix_2 = "/usr/lib/gcc/";
++static const char *const standard_exec_prefix_1 = "@GENTOO_PORTAGE_EPREFIX@/usr/libexec/gcc/";
++static const char *const standard_exec_prefix_2 = "@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/";
+ static const char *md_exec_prefix = MD_EXEC_PREFIX;
+
+ static const char *md_startfile_prefix = MD_STARTFILE_PREFIX;
+--- gcc/config/darwin.h
++++ gcc/config/darwin.h
+@@ -1286,7 +1286,7 @@ void add_framework_path (char *);
+ } \
+ } while (0)
+
+-#define SYSROOT_PRIORITY PREFIX_PRIORITY_FIRST
++#define SYSROOT_PRIORITY PREFIX_PRIORITY_LAST
+ /* APPLE LOCAL end isysroot 5083137 */
+
+ /* Every program on darwin links against libSystem which contains the pthread
diff --git a/sys-devel/gcc-apple/files/gcc-apple-4.2.1-texinfo.patch b/sys-devel/gcc-apple/files/gcc-apple-4.2.1-texinfo.patch
new file mode 100644
index 000000000000..f82fe60d2ee7
--- /dev/null
+++ b/sys-devel/gcc-apple/files/gcc-apple-4.2.1-texinfo.patch
@@ -0,0 +1,33 @@
+--- configure
++++ configure
+@@ -3748,7 +3748,7 @@
+ # For an installed makeinfo, we require it to be from texinfo 4.4 or
+ # higher, else we use the "missing" dummy.
+ if ${MAKEINFO} --version \
+- | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[4-9]|[5-9])' >/dev/null 2>&1; then
++ | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[4-9]|4\.[1-9][0-9]|[5-9])' >/dev/null 2>&1; then
+ :
+ else
+ MAKEINFO="$MISSING makeinfo"
+--- gcc/configure.ac
++++ gcc/configure.ac
+@@ -882,7 +882,7 @@
+ # that we can use it.
+ gcc_AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
+ [GNU texinfo.* \([0-9][0-9.]*\)],
+- [4.[4-9]*])
++ [4.[4-9]*|4.[1-9][0-9]])
+ if test $gcc_cv_prog_makeinfo_modern = no; then
+ MAKEINFO="$MISSING makeinfo"
+ AC_MSG_WARN([
+--- libgomp/configure.ac
++++ libgomp/configure.ac
+@@ -135,7 +135,7 @@
+ # that we can use it.
+ ACX_CHECK_PROG_VER([MAKEINFO], [makeinfo], [--version],
+ [GNU texinfo.* \([0-9][0-9.]*\)],
+- [4.[4-9]*])
++ [4.[4-9]*|4.[1-9][0-9]])
+ AM_CONDITIONAL(BUILD_INFO, test $gcc_cv_prog_makeinfo_modern = "yes")
+
+
diff --git a/sys-devel/gcc-apple/files/gcc-apple-4.2.1_p5646-gfortran.patch b/sys-devel/gcc-apple/files/gcc-apple-4.2.1_p5646-gfortran.patch
new file mode 100644
index 000000000000..61176c0f68b7
--- /dev/null
+++ b/sys-devel/gcc-apple/files/gcc-apple-4.2.1_p5646-gfortran.patch
@@ -0,0 +1,797 @@
+extracted diff from sources at:
+ http://r.research.att.com/src/gcc/
+compared to GNU GCC fortran 4.2.4
+and Apple GCC 5646
+
+with modification in disable_typechecking_for_spec_flag to allow linking
+to succeed (ld: duplicate symbol _disable_typechecking_for_spec_flag in
+libbackend.a(rs6000.o) and c-common.o)
+
+--- gcc-5646/gcc/fortran/Make-lang.in
++++ gcc-5646/gcc/fortran/Make-lang.in
+@@ -73,7 +73,7 @@
+ fortran/trans.o fortran/trans-array.o fortran/trans-common.o \
+ fortran/trans-const.o fortran/trans-decl.o fortran/trans-expr.o \
+ fortran/trans-intrinsic.o fortran/trans-io.o fortran/trans-openmp.o \
+- fortran/trans-stmt.o fortran/trans-types.o
++ fortran/trans-stmt.o fortran/trans-types.o fortran/fake.o
+
+ # GFORTRAN uses GMP for its internal arithmetics.
+ F95_LIBS = $(GMPLIBS) $(LIBS)
+@@ -106,7 +106,7 @@
+ f951$(exeext): $(F95_OBJS) \
+ $(BACKEND) $(LIBDEPS)
+ $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
+- $(F95_OBJS) $(BACKEND) $(F95_LIBS)
++ $(F95_OBJS) $(BACKEND) $(F95_LIBS) stub-objc.o
+
+ gt-fortran-trans.h : s-gtype; @true
+ #
+--- gcc-5646/gcc/fortran/fake.c
++++ gcc-5646/gcc/fortran/fake.c
+@@ -0,0 +1,29 @@
++#include <stdlib.h>
++#include <stdio.h>
++
++#define MK_FAKE(X) void X (void); void X (void) { fprintf(stderr, "** FATAL: call to an unsupported function!\n"); exit(1); }
++
++int c_language = 0; /* 0 is C which is the default */
++int disable_typechecking_for_spec_flag = 0;
++
++MK_FAKE(build_function_call)
++MK_FAKE(build_modify_expr)
++MK_FAKE(build_stmt)
++MK_FAKE(decl_attributes)
++MK_FAKE(decl_constant_value)
++MK_FAKE(flag_iasm_blocks)
++MK_FAKE(iasm_addr)
++MK_FAKE(iasm_build_bracket)
++MK_FAKE(iasm_force_constraint)
++MK_FAKE(iasm_get_register_var)
++MK_FAKE(iasm_in_operands)
++MK_FAKE(iasm_is_pseudo)
++MK_FAKE(iasm_print_operand)
++MK_FAKE(iasm_state)
++MK_FAKE(lookup_name)
++MK_FAKE(parse_in)
++MK_FAKE(pointer_int_sum)
++MK_FAKE(store_init_value)
++
++/* this is new in Xcode 3.2 and may cause problems */
++MK_FAKE(create_init_utf16_var)
+--- gcc-5646/gcc/doc/include/gpl_v3.texi
++++ gcc-5646/gcc/doc/include/gpl_v3.texi
+@@ -0,0 +1,733 @@
++@ignore
++@c Set file name and title for man page.
++@setfilename gpl
++@settitle GNU General Public License
++@c man begin SEEALSO
++gfdl(7), fsf-funding(7).
++@c man end
++@c man begin COPYRIGHT
++Copyright @copyright{} 2007 Free Software Foundation, Inc.
++
++Everyone is permitted to copy and distribute verbatim copies of this
++license document, but changing it is not allowed.
++@c man end
++@end ignore
++@node Copying
++@c man begin DESCRIPTION
++@unnumbered GNU General Public License
++@center Version 3, 29 June 2007
++
++@c This file is intended to be included in another file.
++
++@display
++Copyright @copyright{} 2007 Free Software Foundation, Inc. @url{http://fsf.org/}
++
++Everyone is permitted to copy and distribute verbatim copies of this
++license document, but changing it is not allowed.
++@end display
++
++@heading Preamble
++
++The GNU General Public License is a free, copyleft license for
++software and other kinds of works.
++
++The licenses for most software and other practical works are designed
++to take away your freedom to share and change the works. By contrast,
++the GNU General Public License is intended to guarantee your freedom
++to share and change all versions of a program--to make sure it remains
++free software for all its users. We, the Free Software Foundation,
++use the GNU General Public License for most of our software; it
++applies also to any other work released this way by its authors. You
++can apply it to your programs, too.
++
++When we speak of free software, we are referring to freedom, not
++price. Our General Public Licenses are designed to make sure that you
++have the freedom to distribute copies of free software (and charge for
++them if you wish), that you receive source code or can get it if you
++want it, that you can change the software or use pieces of it in new
++free programs, and that you know you can do these things.
++
++To protect your rights, we need to prevent others from denying you
++these rights or asking you to surrender the rights. Therefore, you
++have certain responsibilities if you distribute copies of the
++software, or if you modify it: responsibilities to respect the freedom
++of others.
++
++For example, if you distribute copies of such a program, whether
++gratis or for a fee, you must pass on to the recipients the same
++freedoms that you received. You must make sure that they, too,
++receive or can get the source code. And you must show them these
++terms so they know their rights.
++
++Developers that use the GNU GPL protect your rights with two steps:
++(1) assert copyright on the software, and (2) offer you this License
++giving you legal permission to copy, distribute and/or modify it.
++
++For the developers' and authors' protection, the GPL clearly explains
++that there is no warranty for this free software. For both users' and
++authors' sake, the GPL requires that modified versions be marked as
++changed, so that their problems will not be attributed erroneously to
++authors of previous versions.
++
++Some devices are designed to deny users access to install or run
++modified versions of the software inside them, although the
++manufacturer can do so. This is fundamentally incompatible with the
++aim of protecting users' freedom to change the software. The
++systematic pattern of such abuse occurs in the area of products for
++individuals to use, which is precisely where it is most unacceptable.
++Therefore, we have designed this version of the GPL to prohibit the
++practice for those products. If such problems arise substantially in
++other domains, we stand ready to extend this provision to those
++domains in future versions of the GPL, as needed to protect the
++freedom of users.
++
++Finally, every program is threatened constantly by software patents.
++States should not allow patents to restrict development and use of
++software on general-purpose computers, but in those that do, we wish
++to avoid the special danger that patents applied to a free program
++could make it effectively proprietary. To prevent this, the GPL
++assures that patents cannot be used to render the program non-free.
++
++The precise terms and conditions for copying, distribution and
++modification follow.
++
++@heading TERMS AND CONDITIONS
++
++@enumerate 0
++@item Definitions.
++
++``This License'' refers to version 3 of the GNU General Public License.
++
++``Copyright'' also means copyright-like laws that apply to other kinds
++of works, such as semiconductor masks.
++
++``The Program'' refers to any copyrightable work licensed under this
++License. Each licensee is addressed as ``you''. ``Licensees'' and
++``recipients'' may be individuals or organizations.
++
++To ``modify'' a work means to copy from or adapt all or part of the work
++in a fashion requiring copyright permission, other than the making of
++an exact copy. The resulting work is called a ``modified version'' of
++the earlier work or a work ``based on'' the earlier work.
++
++A ``covered work'' means either the unmodified Program or a work based
++on the Program.
++
++To ``propagate'' a work means to do anything with it that, without
++permission, would make you directly or secondarily liable for
++infringement under applicable copyright law, except executing it on a
++computer or modifying a private copy. Propagation includes copying,
++distribution (with or without modification), making available to the
++public, and in some countries other activities as well.
++
++To ``convey'' a work means any kind of propagation that enables other
++parties to make or receive copies. Mere interaction with a user
++through a computer network, with no transfer of a copy, is not
++conveying.
++
++An interactive user interface displays ``Appropriate Legal Notices'' to
++the extent that it includes a convenient and prominently visible
++feature that (1) displays an appropriate copyright notice, and (2)
++tells the user that there is no warranty for the work (except to the
++extent that warranties are provided), that licensees may convey the
++work under this License, and how to view a copy of this License. If
++the interface presents a list of user commands or options, such as a
++menu, a prominent item in the list meets this criterion.
++
++@item Source Code.
++
++The ``source code'' for a work means the preferred form of the work for
++making modifications to it. ``Object code'' means any non-source form
++of a work.
++
++A ``Standard Interface'' means an interface that either is an official
++standard defined by a recognized standards body, or, in the case of
++interfaces specified for a particular programming language, one that
++is widely used among developers working in that language.
++
++The ``System Libraries'' of an executable work include anything, other
++than the work as a whole, that (a) is included in the normal form of
++packaging a Major Component, but which is not part of that Major
++Component, and (b) serves only to enable use of the work with that
++Major Component, or to implement a Standard Interface for which an
++implementation is available to the public in source code form. A
++``Major Component'', in this context, means a major essential component
++(kernel, window system, and so on) of the specific operating system
++(if any) on which the executable work runs, or a compiler used to
++produce the work, or an object code interpreter used to run it.
++
++The ``Corresponding Source'' for a work in object code form means all
++the source code needed to generate, install, and (for an executable
++work) run the object code and to modify the work, including scripts to
++control those activities. However, it does not include the work's
++System Libraries, or general-purpose tools or generally available free
++programs which are used unmodified in performing those activities but
++which are not part of the work. For example, Corresponding Source
++includes interface definition files associated with source files for
++the work, and the source code for shared libraries and dynamically
++linked subprograms that the work is specifically designed to require,
++such as by intimate data communication or control flow between those
++subprograms and other parts of the work.
++
++The Corresponding Source need not include anything that users can
++regenerate automatically from other parts of the Corresponding Source.
++
++The Corresponding Source for a work in source code form is that same
++work.
++
++@item Basic Permissions.
++
++All rights granted under this License are granted for the term of
++copyright on the Program, and are irrevocable provided the stated
++conditions are met. This License explicitly affirms your unlimited
++permission to run the unmodified Program. The output from running a
++covered work is covered by this License only if the output, given its
++content, constitutes a covered work. This License acknowledges your
++rights of fair use or other equivalent, as provided by copyright law.
++
++You may make, run and propagate covered works that you do not convey,
++without conditions so long as your license otherwise remains in force.
++You may convey covered works to others for the sole purpose of having
++them make modifications exclusively for you, or provide you with
++facilities for running those works, provided that you comply with the
++terms of this License in conveying all material for which you do not
++control copyright. Those thus making or running the covered works for
++you must do so exclusively on your behalf, under your direction and
++control, on terms that prohibit them from making any copies of your
++copyrighted material outside their relationship with you.
++
++Conveying under any other circumstances is permitted solely under the
++conditions stated below. Sublicensing is not allowed; section 10
++makes it unnecessary.
++
++@item Protecting Users' Legal Rights From Anti-Circumvention Law.
++
++No covered work shall be deemed part of an effective technological
++measure under any applicable law fulfilling obligations under article
++11 of the WIPO copyright treaty adopted on 20 December 1996, or
++similar laws prohibiting or restricting circumvention of such
++measures.
++
++When you convey a covered work, you waive any legal power to forbid
++circumvention of technological measures to the extent such
++circumvention is effected by exercising rights under this License with
++respect to the covered work, and you disclaim any intention to limit
++operation or modification of the work as a means of enforcing, against
++the work's users, your or third parties' legal rights to forbid
++circumvention of technological measures.
++
++@item Conveying Verbatim Copies.
++
++You may convey verbatim copies of the Program's source code as you
++receive it, in any medium, provided that you conspicuously and
++appropriately publish on each copy an appropriate copyright notice;
++keep intact all notices stating that this License and any
++non-permissive terms added in accord with section 7 apply to the code;
++keep intact all notices of the absence of any warranty; and give all
++recipients a copy of this License along with the Program.
++
++You may charge any price or no price for each copy that you convey,
++and you may offer support or warranty protection for a fee.
++
++@item Conveying Modified Source Versions.
++
++You may convey a work based on the Program, or the modifications to
++produce it from the Program, in the form of source code under the
++terms of section 4, provided that you also meet all of these
++conditions:
++
++@enumerate a
++@item
++The work must carry prominent notices stating that you modified it,
++and giving a relevant date.
++
++@item
++The work must carry prominent notices stating that it is released
++under this License and any conditions added under section 7. This
++requirement modifies the requirement in section 4 to ``keep intact all
++notices''.
++
++@item
++You must license the entire work, as a whole, under this License to
++anyone who comes into possession of a copy. This License will
++therefore apply, along with any applicable section 7 additional terms,
++to the whole of the work, and all its parts, regardless of how they
++are packaged. This License gives no permission to license the work in
++any other way, but it does not invalidate such permission if you have
++separately received it.
++
++@item
++If the work has interactive user interfaces, each must display
++Appropriate Legal Notices; however, if the Program has interactive
++interfaces that do not display Appropriate Legal Notices, your work
++need not make them do so.
++@end enumerate
++
++A compilation of a covered work with other separate and independent
++works, which are not by their nature extensions of the covered work,
++and which are not combined with it such as to form a larger program,
++in or on a volume of a storage or distribution medium, is called an
++``aggregate'' if the compilation and its resulting copyright are not
++used to limit the access or legal rights of the compilation's users
++beyond what the individual works permit. Inclusion of a covered work
++in an aggregate does not cause this License to apply to the other
++parts of the aggregate.
++
++@item Conveying Non-Source Forms.
++
++You may convey a covered work in object code form under the terms of
++sections 4 and 5, provided that you also convey the machine-readable
++Corresponding Source under the terms of this License, in one of these
++ways:
++
++@enumerate a
++@item
++Convey the object code in, or embodied in, a physical product
++(including a physical distribution medium), accompanied by the
++Corresponding Source fixed on a durable physical medium customarily
++used for software interchange.
++
++@item
++Convey the object code in, or embodied in, a physical product
++(including a physical distribution medium), accompanied by a written
++offer, valid for at least three years and valid for as long as you
++offer spare parts or customer support for that product model, to give
++anyone who possesses the object code either (1) a copy of the
++Corresponding Source for all the software in the product that is
++covered by this License, on a durable physical medium customarily used
++for software interchange, for a price no more than your reasonable
++cost of physically performing this conveying of source, or (2) access
++to copy the Corresponding Source from a network server at no charge.
++
++@item
++Convey individual copies of the object code with a copy of the written
++offer to provide the Corresponding Source. This alternative is
++allowed only occasionally and noncommercially, and only if you
++received the object code with such an offer, in accord with subsection
++6b.
++
++@item
++Convey the object code by offering access from a designated place
++(gratis or for a charge), and offer equivalent access to the
++Corresponding Source in the same way through the same place at no
++further charge. You need not require recipients to copy the
++Corresponding Source along with the object code. If the place to copy
++the object code is a network server, the Corresponding Source may be
++on a different server (operated by you or a third party) that supports
++equivalent copying facilities, provided you maintain clear directions
++next to the object code saying where to find the Corresponding Source.
++Regardless of what server hosts the Corresponding Source, you remain
++obligated to ensure that it is available for as long as needed to
++satisfy these requirements.
++
++@item
++Convey the object code using peer-to-peer transmission, provided you
++inform other peers where the object code and Corresponding Source of
++the work are being offered to the general public at no charge under
++subsection 6d.
++
++@end enumerate
++
++A separable portion of the object code, whose source code is excluded
++from the Corresponding Source as a System Library, need not be
++included in conveying the object code work.
++
++A ``User Product'' is either (1) a ``consumer product'', which means any
++tangible personal property which is normally used for personal,
++family, or household purposes, or (2) anything designed or sold for
++incorporation into a dwelling. In determining whether a product is a
++consumer product, doubtful cases shall be resolved in favor of
++coverage. For a particular product received by a particular user,
++``normally used'' refers to a typical or common use of that class of
++product, regardless of the status of the particular user or of the way
++in which the particular user actually uses, or expects or is expected
++to use, the product. A product is a consumer product regardless of
++whether the product has substantial commercial, industrial or
++non-consumer uses, unless such uses represent the only significant
++mode of use of the product.
++
++``Installation Information'' for a User Product means any methods,
++procedures, authorization keys, or other information required to
++install and execute modified versions of a covered work in that User
++Product from a modified version of its Corresponding Source. The
++information must suffice to ensure that the continued functioning of
++the modified object code is in no case prevented or interfered with
++solely because modification has been made.
++
++If you convey an object code work under this section in, or with, or
++specifically for use in, a User Product, and the conveying occurs as
++part of a transaction in which the right of possession and use of the
++User Product is transferred to the recipient in perpetuity or for a
++fixed term (regardless of how the transaction is characterized), the
++Corresponding Source conveyed under this section must be accompanied
++by the Installation Information. But this requirement does not apply
++if neither you nor any third party retains the ability to install
++modified object code on the User Product (for example, the work has
++been installed in ROM).
++
++The requirement to provide Installation Information does not include a
++requirement to continue to provide support service, warranty, or
++updates for a work that has been modified or installed by the
++recipient, or for the User Product in which it has been modified or
++installed. Access to a network may be denied when the modification
++itself materially and adversely affects the operation of the network
++or violates the rules and protocols for communication across the
++network.
++
++Corresponding Source conveyed, and Installation Information provided,
++in accord with this section must be in a format that is publicly
++documented (and with an implementation available to the public in
++source code form), and must require no special password or key for
++unpacking, reading or copying.
++
++@item Additional Terms.
++
++``Additional permissions'' are terms that supplement the terms of this
++License by making exceptions from one or more of its conditions.
++Additional permissions that are applicable to the entire Program shall
++be treated as though they were included in this License, to the extent
++that they are valid under applicable law. If additional permissions
++apply only to part of the Program, that part may be used separately
++under those permissions, but the entire Program remains governed by
++this License without regard to the additional permissions.
++
++When you convey a copy of a covered work, you may at your option
++remove any additional permissions from that copy, or from any part of
++it. (Additional permissions may be written to require their own
++removal in certain cases when you modify the work.) You may place
++additional permissions on material, added by you to a covered work,
++for which you have or can give appropriate copyright permission.
++
++Notwithstanding any other provision of this License, for material you
++add to a covered work, you may (if authorized by the copyright holders
++of that material) supplement the terms of this License with terms:
++
++@enumerate a
++@item
++Disclaiming warranty or limiting liability differently from the terms
++of sections 15 and 16 of this License; or
++
++@item
++Requiring preservation of specified reasonable legal notices or author
++attributions in that material or in the Appropriate Legal Notices
++displayed by works containing it; or
++
++@item
++Prohibiting misrepresentation of the origin of that material, or
++requiring that modified versions of such material be marked in
++reasonable ways as different from the original version; or
++
++@item
++Limiting the use for publicity purposes of names of licensors or
++authors of the material; or
++
++@item
++Declining to grant rights under trademark law for use of some trade
++names, trademarks, or service marks; or
++
++@item
++Requiring indemnification of licensors and authors of that material by
++anyone who conveys the material (or modified versions of it) with
++contractual assumptions of liability to the recipient, for any
++liability that these contractual assumptions directly impose on those
++licensors and authors.
++@end enumerate
++
++All other non-permissive additional terms are considered ``further
++restrictions'' within the meaning of section 10. If the Program as you
++received it, or any part of it, contains a notice stating that it is
++governed by this License along with a term that is a further
++restriction, you may remove that term. If a license document contains
++a further restriction but permits relicensing or conveying under this
++License, you may add to a covered work material governed by the terms
++of that license document, provided that the further restriction does
++not survive such relicensing or conveying.
++
++If you add terms to a covered work in accord with this section, you
++must place, in the relevant source files, a statement of the
++additional terms that apply to those files, or a notice indicating
++where to find the applicable terms.
++
++Additional terms, permissive or non-permissive, may be stated in the
++form of a separately written license, or stated as exceptions; the
++above requirements apply either way.
++
++@item Termination.
++
++You may not propagate or modify a covered work except as expressly
++provided under this License. Any attempt otherwise to propagate or
++modify it is void, and will automatically terminate your rights under
++this License (including any patent licenses granted under the third
++paragraph of section 11).
++
++However, if you cease all violation of this License, then your license
++from a particular copyright holder is reinstated (a) provisionally,
++unless and until the copyright holder explicitly and finally
++terminates your license, and (b) permanently, if the copyright holder
++fails to notify you of the violation by some reasonable means prior to
++60 days after the cessation.
++
++Moreover, your license from a particular copyright holder is
++reinstated permanently if the copyright holder notifies you of the
++violation by some reasonable means, this is the first time you have
++received notice of violation of this License (for any work) from that
++copyright holder, and you cure the violation prior to 30 days after
++your receipt of the notice.
++
++Termination of your rights under this section does not terminate the
++licenses of parties who have received copies or rights from you under
++this License. If your rights have been terminated and not permanently
++reinstated, you do not qualify to receive new licenses for the same
++material under section 10.
++
++@item Acceptance Not Required for Having Copies.
++
++You are not required to accept this License in order to receive or run
++a copy of the Program. Ancillary propagation of a covered work
++occurring solely as a consequence of using peer-to-peer transmission
++to receive a copy likewise does not require acceptance. However,
++nothing other than this License grants you permission to propagate or
++modify any covered work. These actions infringe copyright if you do
++not accept this License. Therefore, by modifying or propagating a
++covered work, you indicate your acceptance of this License to do so.
++
++@item Automatic Licensing of Downstream Recipients.
++
++Each time you convey a covered work, the recipient automatically
++receives a license from the original licensors, to run, modify and
++propagate that work, subject to this License. You are not responsible
++for enforcing compliance by third parties with this License.
++
++An ``entity transaction'' is a transaction transferring control of an
++organization, or substantially all assets of one, or subdividing an
++organization, or merging organizations. If propagation of a covered
++work results from an entity transaction, each party to that
++transaction who receives a copy of the work also receives whatever
++licenses to the work the party's predecessor in interest had or could
++give under the previous paragraph, plus a right to possession of the
++Corresponding Source of the work from the predecessor in interest, if
++the predecessor has it or can get it with reasonable efforts.
++
++You may not impose any further restrictions on the exercise of the
++rights granted or affirmed under this License. For example, you may
++not impose a license fee, royalty, or other charge for exercise of
++rights granted under this License, and you may not initiate litigation
++(including a cross-claim or counterclaim in a lawsuit) alleging that
++any patent claim is infringed by making, using, selling, offering for
++sale, or importing the Program or any portion of it.
++
++@item Patents.
++
++A ``contributor'' is a copyright holder who authorizes use under this
++License of the Program or a work on which the Program is based. The
++work thus licensed is called the contributor's ``contributor version''.
++
++A contributor's ``essential patent claims'' are all patent claims owned
++or controlled by the contributor, whether already acquired or
++hereafter acquired, that would be infringed by some manner, permitted
++by this License, of making, using, or selling its contributor version,
++but do not include claims that would be infringed only as a
++consequence of further modification of the contributor version. For
++purposes of this definition, ``control'' includes the right to grant
++patent sublicenses in a manner consistent with the requirements of
++this License.
++
++Each contributor grants you a non-exclusive, worldwide, royalty-free
++patent license under the contributor's essential patent claims, to
++make, use, sell, offer for sale, import and otherwise run, modify and
++propagate the contents of its contributor version.
++
++In the following three paragraphs, a ``patent license'' is any express
++agreement or commitment, however denominated, not to enforce a patent
++(such as an express permission to practice a patent or covenant not to
++sue for patent infringement). To ``grant'' such a patent license to a
++party means to make such an agreement or commitment not to enforce a
++patent against the party.
++
++If you convey a covered work, knowingly relying on a patent license,
++and the Corresponding Source of the work is not available for anyone
++to copy, free of charge and under the terms of this License, through a
++publicly available network server or other readily accessible means,
++then you must either (1) cause the Corresponding Source to be so
++available, or (2) arrange to deprive yourself of the benefit of the
++patent license for this particular work, or (3) arrange, in a manner
++consistent with the requirements of this License, to extend the patent
++license to downstream recipients. ``Knowingly relying'' means you have
++actual knowledge that, but for the patent license, your conveying the
++covered work in a country, or your recipient's use of the covered work
++in a country, would infringe one or more identifiable patents in that
++country that you have reason to believe are valid.
++
++If, pursuant to or in connection with a single transaction or
++arrangement, you convey, or propagate by procuring conveyance of, a
++covered work, and grant a patent license to some of the parties
++receiving the covered work authorizing them to use, propagate, modify
++or convey a specific copy of the covered work, then the patent license
++you grant is automatically extended to all recipients of the covered
++work and works based on it.
++
++A patent license is ``discriminatory'' if it does not include within the
++scope of its coverage, prohibits the exercise of, or is conditioned on
++the non-exercise of one or more of the rights that are specifically
++granted under this License. You may not convey a covered work if you
++are a party to an arrangement with a third party that is in the
++business of distributing software, under which you make payment to the
++third party based on the extent of your activity of conveying the
++work, and under which the third party grants, to any of the parties
++who would receive the covered work from you, a discriminatory patent
++license (a) in connection with copies of the covered work conveyed by
++you (or copies made from those copies), or (b) primarily for and in
++connection with specific products or compilations that contain the
++covered work, unless you entered into that arrangement, or that patent
++license was granted, prior to 28 March 2007.
++
++Nothing in this License shall be construed as excluding or limiting
++any implied license or other defenses to infringement that may
++otherwise be available to you under applicable patent law.
++
++@item No Surrender of Others' Freedom.
++
++If conditions are imposed on you (whether by court order, agreement or
++otherwise) that contradict the conditions of this License, they do not
++excuse you from the conditions of this License. If you cannot convey
++a covered work so as to satisfy simultaneously your obligations under
++this License and any other pertinent obligations, then as a
++consequence you may not convey it at all. For example, if you agree
++to terms that obligate you to collect a royalty for further conveying
++from those to whom you convey the Program, the only way you could
++satisfy both those terms and this License would be to refrain entirely
++from conveying the Program.
++
++@item Use with the GNU Affero General Public License.
++
++Notwithstanding any other provision of this License, you have
++permission to link or combine any covered work with a work licensed
++under version 3 of the GNU Affero General Public License into a single
++combined work, and to convey the resulting work. The terms of this
++License will continue to apply to the part which is the covered work,
++but the special requirements of the GNU Affero General Public License,
++section 13, concerning interaction through a network will apply to the
++combination as such.
++
++@item Revised Versions of this License.
++
++The Free Software Foundation may publish revised and/or new versions
++of the GNU General Public License from time to time. Such new
++versions will be similar in spirit to the present version, but may
++differ in detail to address new problems or concerns.
++
++Each version is given a distinguishing version number. If the Program
++specifies that a certain numbered version of the GNU General Public
++License ``or any later version'' applies to it, you have the option of
++following the terms and conditions either of that numbered version or
++of any later version published by the Free Software Foundation. If
++the Program does not specify a version number of the GNU General
++Public License, you may choose any version ever published by the Free
++Software Foundation.
++
++If the Program specifies that a proxy can decide which future versions
++of the GNU General Public License can be used, that proxy's public
++statement of acceptance of a version permanently authorizes you to
++choose that version for the Program.
++
++Later license versions may give you additional or different
++permissions. However, no additional obligations are imposed on any
++author or copyright holder as a result of your choosing to follow a
++later version.
++
++@item Disclaimer of Warranty.
++
++THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
++APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
++HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM ``AS IS'' WITHOUT
++WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
++LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
++A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
++PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
++DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
++CORRECTION.
++
++@item Limitation of Liability.
++
++IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
++WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR
++CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
++INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
++ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT
++NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR
++LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM
++TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
++PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
++
++@item Interpretation of Sections 15 and 16.
++
++If the disclaimer of warranty and limitation of liability provided
++above cannot be given local legal effect according to their terms,
++reviewing courts shall apply local law that most closely approximates
++an absolute waiver of all civil liability in connection with the
++Program, unless a warranty or assumption of liability accompanies a
++copy of the Program in return for a fee.
++
++@end enumerate
++
++@heading END OF TERMS AND CONDITIONS
++
++@heading How to Apply These Terms to Your New Programs
++
++If you develop a new program, and you want it to be of the greatest
++possible use to the public, the best way to achieve this is to make it
++free software which everyone can redistribute and change under these
++terms.
++
++To do so, attach the following notices to the program. It is safest
++to attach them to the start of each source file to most effectively
++state the exclusion of warranty; and each file should have at least
++the ``copyright'' line and a pointer to where the full notice is found.
++
++@smallexample
++@var{one line to give the program's name and a brief idea of what it does.}
++Copyright (C) @var{year} @var{name of author}
++
++This program is free software: you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation, either version 3 of the License, or (at
++your option) any later version.
++
++This program 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
++General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with this program. If not, see @url{http://www.gnu.org/licenses/}.
++@end smallexample
++
++Also add information on how to contact you by electronic and paper mail.
++
++If the program does terminal interaction, make it output a short
++notice like this when it starts in an interactive mode:
++
++@smallexample
++@var{program} Copyright (C) @var{year} @var{name of author}
++This program comes with ABSOLUTELY NO WARRANTY; for details type @samp{show w}.
++This is free software, and you are welcome to redistribute it
++under certain conditions; type @samp{show c} for details.
++@end smallexample
++
++The hypothetical commands @samp{show w} and @samp{show c} should show
++the appropriate parts of the General Public License. Of course, your
++program's commands might be different; for a GUI interface, you would
++use an ``about box''.
++
++You should also get your employer (if you work as a programmer) or school,
++if any, to sign a ``copyright disclaimer'' for the program, if necessary.
++For more information on this, and how to apply and follow the GNU GPL, see
++@url{http://www.gnu.org/licenses/}.
++
++The GNU General Public License does not permit incorporating your
++program into proprietary programs. If your program is a subroutine
++library, you may consider it more useful to permit linking proprietary
++applications with the library. If this is what you want to do, use
++the GNU Lesser General Public License instead of this License. But
++first, please read @url{http://www.gnu.org/philosophy/why-not-lgpl.html}.
++@c man end
diff --git a/sys-devel/gcc-apple/files/gcc-apple-4.2.1_p5666-darwin14.patch b/sys-devel/gcc-apple/files/gcc-apple-4.2.1_p5666-darwin14.patch
new file mode 100644
index 000000000000..fb785b0ad9c4
--- /dev/null
+++ b/sys-devel/gcc-apple/files/gcc-apple-4.2.1_p5666-darwin14.patch
@@ -0,0 +1,148 @@
+https://537826.bugs.gentoo.org/attachment.cgi?id=394896
+https://bugs.gentoo.org/show_bug.cgi?id=537826
+Michael Weiser
+
+Backport of https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=218873 (as
+per https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61407) to correctly encode Mac
+OS X versions >10.9 into __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__.
+Extended to also encode patch level the way clang and Apple GCC 4.2.1 do.
+
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 has a much more generic
+patch. But it's not yet in-tree pending legal paperwork. Once that's done, we
+can backport that.
+
+--- gcc/libgcov.c
++++ gcc/libgcov.c
+@@ -34,6 +34,14 @@
+ #include "coretypes.h"
+ #include "tm.h"
+
++/* to deal with XBC headers from 10.10 */
++#ifndef __has_extension
++#define __has_extension(x) 0
++#endif
++#ifndef __has_feature
++#define __has_feature(x) 0
++#endif
++
+ /* APPLE LOCAL begin instant off 6414141 */
+ #if defined(__APPLE__) && !defined(__STATIC__) && !defined(__ppc__) && !defined(__ppc64__) && !defined(__arm__)
+ #include <vproc.h>
+--- gcc/config/darwin-driver.c.orig 2010-10-14 22:27:53.000000000 +0200
++++ gcc/config/darwin-driver.c 2015-01-25 21:15:09.000000000 +0100
+@@ -174,8 +174,6 @@
+ version_p = osversion + 1;
+ if (ISDIGIT (*version_p))
+ major_vers = major_vers * 10 + (*version_p++ - '0');
+- if (major_vers > 4 + 9)
+- goto parse_failed;
+ if (*version_p++ != '.')
+ goto parse_failed;
+ version_pend = strchr(version_p, '.');
+--- gcc/config/darwin-c.c.orig 2015-01-25 19:44:40.000000000 +0100
++++ gcc/config/darwin-c.c 2015-01-25 21:05:47.000000000 +0100
+@@ -930,31 +930,91 @@
+
+ /* Return the value of darwin_macosx_version_min suitable for the
+ __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro,
+- so '10.4.2' becomes 1042.
++ so '10.4.2' becomes 1042 and '10.10.2' becomes 101002.
++ Cap patch level to 9 in the old format.
+ Print a warning if the version number is not known. */
+ static const char *
+ /* APPLE LOCAL ARM 5683689 */
+ macosx_version_as_macro (void)
+ {
+- static char result[] = "1000";
++ static char result[7] = "1000";
++ int inputindex = 3, outputindex = 2;
+
++ /* make sure version starts with "10." - makes sure we can safely start
++ * parsing at inputindex == 3 */
+ if (strncmp (darwin_macosx_version_min, "10.", 3) != 0)
+ goto fail;
++
++ /* first character of minor version needs to be digit */
+ if (! ISDIGIT (darwin_macosx_version_min[3]))
+ goto fail;
+- result[2] = darwin_macosx_version_min[3];
+- if (darwin_macosx_version_min[4] != '\0')
++
++ result[outputindex++] = darwin_macosx_version_min[inputindex++];
++
++ if (ISDIGIT (darwin_macosx_version_min[inputindex])) {
++ /* Starting with OS X 10.10, the macro ends '00' rather than '0',
++ i.e. 10.10.x becomes 101000 rather than 10100. */
++ result[outputindex++] = darwin_macosx_version_min[inputindex++];
++ result[4] = '0';
++ result[5] = '0';
++ result[6] = '\0';
++ }
++
++ /* if we're out of input, leave patch level at 0 or 00 and finish */
++ if (darwin_macosx_version_min[inputindex] == '\0')
++ return result;
++
++ /* a dot *must* follow now */
++ if (darwin_macosx_version_min[inputindex++] != '.')
++ goto fail;
++
++ /* a digit must follow after the dot */
++ if (! ISDIGIT (darwin_macosx_version_min[inputindex]))
++ goto fail;
++
++ /* old-style macro */
++ if (outputindex == 3)
++ {
++ /* one-digit patch level */
++ if (darwin_macosx_version_min[inputindex + 1] == '\0')
+ {
+- if (darwin_macosx_version_min[4] != '.')
+- goto fail;
+- if (! ISDIGIT (darwin_macosx_version_min[5]))
+- goto fail;
+- if (darwin_macosx_version_min[6] != '\0')
+- goto fail;
+- result[3] = darwin_macosx_version_min[5];
++ result[outputindex] = darwin_macosx_version_min[inputindex];
++ return result;
+ }
+- else
+- result[3] = '0';
++
++ inputindex++;
++ if (! ISDIGIT (darwin_macosx_version_min[inputindex++]))
++ goto fail;
++
++ /* three digits? */
++ if (darwin_macosx_version_min[inputindex] != '\0')
++ goto fail;
++
++ /* no room for another digit. Traditional Apple GCC 4.2.1 doesn't accept
++ * it but current clang caps it to 9. We choose to be in line with clang. */
++ result[outputindex] = '9';
++ return result;
++ }
++
++ /* new-style macro */
++
++ /* leave a leading zero if only one digit is following */
++ if (darwin_macosx_version_min[inputindex + 1] == '\0') {
++ result[outputindex + 1] = darwin_macosx_version_min[inputindex];
++ return result;
++ }
++
++ result[outputindex++] = darwin_macosx_version_min[inputindex++];
++
++ /* a digit must follow now */
++ if (! ISDIGIT (darwin_macosx_version_min[inputindex]))
++ goto fail;
++
++ result[outputindex] = darwin_macosx_version_min[inputindex++];
++
++ /* no more input allowed */
++ if (darwin_macosx_version_min[inputindex] != '\0')
++ goto fail;
+
+ return result;
+
diff --git a/sys-devel/gcc-apple/files/gcc-apple-4.2.1_p5666-perl-5.18.patch b/sys-devel/gcc-apple/files/gcc-apple-4.2.1_p5666-perl-5.18.patch
new file mode 100644
index 000000000000..af3688aa48e5
--- /dev/null
+++ b/sys-devel/gcc-apple/files/gcc-apple-4.2.1_p5666-perl-5.18.patch
@@ -0,0 +1,11 @@
+--- a/contrib/texi2pod.pl
++++ b/contrib/texi2pod.pl
+@@ -337,7 +337,7 @@ while(<$inf>) {
+ $_ = "\n=item $1\n";
+ }
+ } else {
+- $_ = "\n=item $ic\n";
++ $_ = "\n=item Z\&LT;\&GT;$ic\n";
+ $ic =~ y/A-Ya-y/B-Zb-z/;
+ $ic =~ s/(\d+)/$1 + 1/eg;
+ }
diff --git a/sys-devel/gcc-apple/files/libstdc++-16.patch b/sys-devel/gcc-apple/files/libstdc++-16.patch
new file mode 100644
index 000000000000..81d075bface7
--- /dev/null
+++ b/sys-devel/gcc-apple/files/libstdc++-16.patch
@@ -0,0 +1,11 @@
+--- libstdc++-v3/include/bits/c++config
++++ libstdc++-v3/include/bits/c++config
+@@ -76,7 +76,7 @@
+ }
+ namespace std
+ {
+- using namespace __gnu_debug_def __attribute__ ((strong));
++ using namespace __gnu_debug_def;
+ }
+ #else
+ # define _GLIBCXX_STD std
diff --git a/sys-devel/gcc-apple/gcc-apple-4.0.1_p5493.ebuild b/sys-devel/gcc-apple/gcc-apple-4.0.1_p5493.ebuild
new file mode 100644
index 000000000000..582e2a3e8780
--- /dev/null
+++ b/sys-devel/gcc-apple/gcc-apple-4.0.1_p5493.ebuild
@@ -0,0 +1,261 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils toolchain prefix
+
+GCC_VERS=${PV/_p*/}
+APPLE_VERS=${PV/*_p/}
+DESCRIPTION="Apple branch of the GNU Compiler Collection, Developer Tools 3.1.3"
+HOMEPAGE="http://gcc.gnu.org"
+SRC_URI="http://www.opensource.apple.com/darwinsource/tarballs/other/gcc-${APPLE_VERS}.tar.gz"
+LICENSE="APSL-2 GPL-2"
+
+if is_crosscompile; then
+ SLOT="${CTARGET}-40"
+else
+ SLOT="40"
+fi
+
+KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
+
+IUSE="nls objc objc++ +cxx"
+
+RDEPEND=">=sys-libs/zlib-1.1.4
+ >=sys-libs/ncurses-5.2-r2
+ nls? ( sys-devel/gettext )"
+DEPEND="${RDEPEND}
+ >=sys-apps/texinfo-4.2-r4
+ >=sys-devel/bison-1.875
+ ${CATEGORY}/binutils-apple"
+
+S=${WORKDIR}/gcc-${APPLE_VERS}
+
+# TPREFIX is the prefix of the CTARGET installation
+export TPREFIX=${TPREFIX:-${EPREFIX}}
+
+LIBPATH=${EPREFIX}/usr/lib/gcc/${CTARGET}/${GCC_VERS}
+if is_crosscompile ; then
+ BINPATH=${EPREFIX}/usr/${CHOST}/${CTARGET}/gcc-bin/${GCC_VERS}
+else
+ BINPATH=${EPREFIX}/usr/${CTARGET}/gcc-bin/${GCC_VERS}
+fi
+STDCXX_INCDIR=${LIBPATH}/include/g++-v${GCC_VERS/\.*/}
+
+src_unpack() {
+ # override toolchain.eclass func
+ unpack ${A}
+}
+
+src_prepare() {
+ # we use our libtool
+ sed -i -e "s:/usr/bin/libtool:${EPREFIX}/usr/bin/${CTARGET}-libtool:" \
+ gcc/config/darwin.h || die "sed gcc/config/darwin.h failed"
+ # add prefixed Frameworks to default search paths (may want to change this
+ # in a cross-compile)
+ sed -i -e "/\"\/System\/Library\/Frameworks\"\,/i\ \ \"${EPREFIX}/Frameworks\"\, " \
+ gcc/config/darwin-c.c || die "sed gcc/config/darwin-c.c failed"
+
+ # Workaround deprecated "+Nc" syntax for GNU tail(1)
+ sed -i -e "s:tail +16c:tail -c +16:g" \
+ gcc/Makefile.in || die "sed gcc/Makefile.in failed."
+
+ epatch "${FILESDIR}"/${PN}-4.0.1_p5465-default-altivec.patch
+
+ epatch "${FILESDIR}"/${PN}-4.2.1-prefix-search-dirs.patch
+ eprefixify "${S}"/gcc/gcc.c
+}
+
+src_configure() {
+ local langs="c"
+ use cxx && langs="${langs},c++"
+ use objc && langs="${langs},objc"
+ use objc++ && langs="${langs/,objc/},objc,obj-c++" # need objc with objc++
+
+ local myconf="${myconf} \
+ --prefix=${EPREFIX}/usr \
+ --bindir=${BINPATH} \
+ --includedir=${LIBPATH}/include \
+ --datadir=${EPREFIX}/usr/share/gcc-data/${CTARGET}/${GCC_VERS} \
+ --mandir=${EPREFIX}/usr/share/gcc-data/${CTARGET}/${GCC_VERS}/man \
+ --infodir=${EPREFIX}/usr/share/gcc-data/${CTARGET}/${GCC_VERS}/info \
+ --with-gxx-include-dir=${STDCXX_INCDIR} \
+ --host=${CHOST}
+ --enable-version-specific-runtime-libs"
+
+ if is_crosscompile ; then
+ # Straight from the GCC install doc:
+ # "GCC has code to correctly determine the correct value for target
+ # for nearly all native systems. Therefore, we highly recommend you
+ # not provide a configure target when configuring a native compiler."
+ myconf="${myconf} --target=${CTARGET}"
+
+ # Tell compiler where to find what it needs
+ myconf="${myconf} --with-sysroot=${EPREFIX}/usr/${CTARGET}"
+
+ # Set this to something sane for both native and target
+ CFLAGS="-O2 -pipe"
+
+ local VAR="CFLAGS_"${CTARGET//-/_}
+ CXXFLAGS=${!VAR}
+ fi
+ [[ -n ${CBUILD} ]] && myconf="${myconf} --build=${CBUILD}"
+
+ # Native Language Support
+ if use nls ; then
+ myconf="${myconf} --enable-nls --without-included-gettext"
+ else
+ myconf="${myconf} --disable-nls"
+ fi
+
+ # reasonably sane globals (hopefully)
+ myconf="${myconf} \
+ --with-system-zlib \
+ --disable-checking \
+ --disable-werror"
+
+ # languages to build
+ myconf="${myconf} --enable-languages=${langs}"
+
+ # ???
+ myconf="${myconf} --enable-shared --enable-threads=posix"
+
+ # make clear we're in an offset
+ use prefix && myconf="${myconf} --with-local-prefix=${TPREFIX}/usr"
+
+ # we don't use a GNU linker, so tell GCC where to find the linker stuff we
+ # want it to use
+ myconf="${myconf} \
+ --with-as=${EPREFIX}/usr/bin/${CTARGET}-as \
+ --with-ld=${EPREFIX}/usr/bin/${CTARGET}-ld"
+
+ # make sure we never do multilib stuff, for that we need a different Prefix
+ [[ -z ${I_KNOW_WHAT_IM_DOING_I_WANT_APPLE_MULTILIB} ]] \
+ && myconf="${myconf} --disable-multilib"
+
+ # The produced libgcc_s.dylib is faulty if using a bit too much
+ # optimisation. Nail it down to something sane
+ CFLAGS="-O2 -pipe"
+ CXXFLAGS=${CFLAGS}
+
+ # http://gcc.gnu.org/ml/gcc-patches/2006-11/msg00765.html
+ # (won't hurt if already 64-bits, but is essential when coming from a
+ # multilib compiler -- the default)
+ [[ ${CTARGET} == powerpc64-* || ${CTARGET} == x86_64-* ]] && \
+ export CC="gcc -m64"
+
+ mkdir -p "${WORKDIR}"/build
+ cd "${WORKDIR}"/build
+ einfo "Configuring GCC with: ${myconf//--/\n\t--}"
+ "${S}"/configure ${myconf} || die "conf failed"
+}
+
+src_compile() {
+ cd "${WORKDIR}"/build || die
+ emake bootstrap || die "emake failed"
+}
+
+src_install() {
+ cd "${WORKDIR}"/build
+ # -jX doesn't work
+ emake -j1 DESTDIR="${D}" install || die
+
+ # Punt some tools which are really only useful while building gcc
+ find "${ED}" -name install-tools -prune -type d -exec rm -rf "{}" \;
+ # This one comes with binutils
+ find "${ED}" -name libiberty.a -exec rm -f "{}" \;
+
+ # Basic sanity check
+ if ! is_crosscompile ; then
+ local EXEEXT
+ eval $(grep ^EXEEXT= "${WORKDIR}"/build/gcc/config.log)
+ [[ -r ${D}${BINPATH}/gcc${EXEEXT} ]] || die "gcc not found in ${ED}"
+ fi
+
+ # create gcc-config entry
+ dodir /etc/env.d/gcc
+ local gcc_envd_base="/etc/env.d/gcc/${CHOST}-${GCC_VERS}"
+
+ gcc_envd_file="${ED}${gcc_envd_base}"
+
+ # phase PATH/ROOTPATH out ...
+ echo "PATH=\"${BINPATH}\"" > ${gcc_envd_file}
+ echo "ROOTPATH=\"${BINPATH}\"" >> ${gcc_envd_file}
+ echo "GCC_PATH=\"${BINPATH}\"" >> ${gcc_envd_file}
+
+ # we don't do multilib
+ LDPATH="${LIBPATH}"
+ echo "LDPATH=\"${LDPATH}\"" >> ${gcc_envd_file}
+ echo "MANPATH=\"${EPREFIX}/usr/share/gcc-data/${CHOST}/${GCC_VERS}/man\"" >> ${gcc_envd_file}
+ echo "INFOPATH=\"${EPREFIX}/usr/share/gcc-data/${CHOST}/${GCC_VERS}/info\"" >> ${gcc_envd_file}
+ echo "STDCXX_INCDIR=\"g++-v${GCC_VERS/\.*/}\"" >> ${gcc_envd_file}
+ is_crosscompile && echo "CTARGET=${CTARGET}" >> ${gcc_envd_file}
+
+ # Move <cxxabi.h> to compiler-specific directories
+ [[ -f ${D}${STDCXX_INCDIR}/cxxabi.h ]] && \
+ mv -f "${D}"${STDCXX_INCDIR}/cxxabi.h "${D}"${LIBPATH}/include/
+
+ # These should be symlinks
+ dodir /usr/bin
+ cd "${D}"${BINPATH}
+ for x in cpp gcc g++ c++ g77 gcj gcjh gfortran ; do
+ # For some reason, g77 gets made instead of ${CTARGET}-g77...
+ # this should take care of that
+ [[ -f ${x} ]] && mv ${x} ${CTARGET}-${x}
+
+ if [[ -f ${CTARGET}-${x} ]] && ! is_crosscompile ; then
+ ln -sf ${CTARGET}-${x} ${x}
+
+ # Create version-ed symlinks
+ dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
+ /usr/bin/${CTARGET}-${x}-${GCC_VERS}
+ dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
+ /usr/bin/${x}-${GCC_VERS}
+ fi
+
+ if [[ -f ${CTARGET}-${x}-${GCC_VERS} ]] ; then
+ rm -f ${CTARGET}-${x}-${GCC_VERS}
+ ln -sf ${CTARGET}-${x} ${CTARGET}-${x}-${GCC_VERS}
+ fi
+ done
+
+ # I do not know if this will break gcj stuff, so I'll only do it for
+ # objc for now; basically "ffi.h" is the correct file to include,
+ # but it gets installed in .../GCCVER/include and yet it does
+ # "#include <ffitarget.h>" which (correctly, as it's an "extra" file)
+ # is installed in .../GCCVER/include/libffi; the following fixes
+ # ffi.'s include of ffitarget.h - Armando Di Cianno <fafhrd@gentoo.org>
+ if [[ -d ${D}${LIBPATH}/include/libffi ]] ; then
+ mv -i "${D}"${LIBPATH}/include/libffi/* "${D}"${LIBPATH}/include || die
+ rm -r "${D}"${LIBPATH}/include/libffi || die
+ fi
+
+ # Now do the fun stripping stuff
+ env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${BINPATH}"
+ env RESTRICT="" CHOST=${CTARGET} prepstrip "${D}${LIBPATH}"
+ # gcc used to install helper binaries in lib/ but then moved to libexec/
+ [[ -d ${ED}/usr/libexec/gcc ]] && \
+ env RESTRICT="" CHOST=${CHOST} prepstrip "${ED}/usr/libexec/gcc/${CTARGET}/${GCC_VERS}"
+
+ # prune empty dirs left behind
+ find "${ED}" -type d | xargs rmdir >& /dev/null
+}
+
+pkg_postinst() {
+ # beware this also switches when it's on another branch version of GCC
+ gcc-config ${CTARGET}-${GCC_VERS}
+}
+
+pkg_postrm() {
+ # clean up the cruft left behind by cross-compilers
+ if is_crosscompile ; then
+ if [[ -z $(ls "${EROOT}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
+ rm -f "${EROOT}"/etc/env.d/gcc/config-${CTARGET}
+ rm -f "${EROOT}"/etc/env.d/??gcc-${CTARGET}
+ rm -f "${EROOT}"/usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
+ fi
+ return 0
+ fi
+}
diff --git a/sys-devel/gcc-apple/gcc-apple-4.2.1_p5664.ebuild b/sys-devel/gcc-apple/gcc-apple-4.2.1_p5664.ebuild
new file mode 100644
index 000000000000..5c54ace6e6ba
--- /dev/null
+++ b/sys-devel/gcc-apple/gcc-apple-4.2.1_p5664.ebuild
@@ -0,0 +1,332 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils toolchain flag-o-matic autotools prefix
+
+GCC_VERS=${PV/_p*/}
+APPLE_VERS="${PV/*_p/}"
+DESCRIPTION="Apple branch of the GNU Compiler Collection, Developer Tools 3.2.3"
+HOMEPAGE="http://gcc.gnu.org"
+SRC_URI="http://www.opensource.apple.com/darwinsource/tarballs/other/gcc-${APPLE_VERS}.tar.gz
+ http://www.opensource.apple.com/darwinsource/tarballs/other/libstdcxx-16.tar.gz
+ http://www.opensource.apple.com/darwinsource/tarballs/other/libstdcxx-39.tar.gz
+ fortran? ( mirror://gnu/gcc/gcc-4.2.4/gcc-fortran-4.2.4.tar.bz2 )"
+LICENSE="GPL-2 GPL-3"
+
+case ${CHOST} in
+ *-darwin1*|i?86-*-darwin9|powerpc-*-darwin9)
+ LIBSTDCXX_APPLE_VERSION=39
+ ;;
+ *)
+ # pre Leopard has no dtrace, which is required by 37.11 and above
+ # Leopard only has 32-bits version of dtrace
+ LIBSTDCXX_APPLE_VERSION=16
+ ;;
+esac
+
+if is_crosscompile; then
+ SLOT="${CTARGET}-42"
+else
+ SLOT="42"
+fi
+
+KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
+
+IUSE="fortran nls +openmp objc objc++ +cxx"
+
+RDEPEND=">=sys-libs/zlib-1.1.4
+ >=sys-libs/ncurses-5.2-r2
+ nls? ( sys-devel/gettext )
+ >=sys-devel/gcc-config-1.3.12-r4
+ fortran? (
+ >=dev-libs/gmp-4.2.1
+ >=dev-libs/mpfr-2.2.0_p10
+ )"
+DEPEND="${RDEPEND}
+ >=sys-apps/texinfo-4.2-r4
+ >=sys-devel/bison-1.875
+ ${CATEGORY}/binutils-apple
+ >=dev-libs/mpfr-2.2.0_p10"
+
+S=${WORKDIR}/gcc-${APPLE_VERS}
+
+# TPREFIX is the prefix of the CTARGET installation
+export TPREFIX=${TPREFIX:-${EPREFIX}}
+
+LIBPATH=${EPREFIX}/usr/lib/gcc/${CTARGET}/${GCC_VERS}
+if is_crosscompile ; then
+ BINPATH=${EPREFIX}/usr/${CHOST}/${CTARGET}/gcc-bin/${GCC_VERS}
+else
+ BINPATH=${EPREFIX}/usr/${CTARGET}/gcc-bin/${GCC_VERS}
+fi
+STDCXX_INCDIR=${LIBPATH}/include/g++-v${GCC_VERS/\.*/}
+
+src_unpack() {
+ # override toolchain.eclass func
+ unpack ${A}
+}
+
+src_prepare() {
+ # Support for fortran
+ if use fortran ; then
+ mv "${WORKDIR}"/gcc-4.2.4/gcc/fortran gcc/ || die
+ mv "${WORKDIR}"/gcc-4.2.4/libgfortran . || die
+ # from: substracted from http://r.research.att.com/tools/
+ epatch "${FILESDIR}"/${PN}-4.2.1_p5646-gfortran.patch
+ fi
+
+ # move in libstdc++
+ mv "${WORKDIR}"/libstdcxx-${LIBSTDCXX_APPLE_VERSION}/libstdcxx/libstdc++-v3 .
+ if [[ ${LIBSTDCXX_APPLE_VERSION} == 16 ]] ; then
+ epatch "${FILESDIR}"/libstdc++-${LIBSTDCXX_APPLE_VERSION}.patch # does it apply on 37?
+ sed -i -e 's/__block\([^_]\)/__blk\1/g' \
+ libstdc++-v3/include/ext/mt_allocator.h \
+ libstdc++-v3/src/mt_allocator.cc || die "conflict fix failed"
+ fi
+
+ # we use our libtool
+ sed -i -e "s:/usr/bin/libtool:${EPREFIX}/usr/bin/${CTARGET}-libtool:" \
+ gcc/config/darwin.h || die "sed gcc/config/darwin.h failed"
+ # add prefixed Frameworks to default search paths (may want to change this
+ # in a cross-compile)
+ sed -i -e "/\"\/System\/Library\/Frameworks\"\,/i\ \ \"${EPREFIX}/Frameworks\"\, " \
+ gcc/config/darwin-c.c || die "sed gcc/config/darwin-c.c failed"
+
+ # Workaround deprecated "+Nc" syntax for GNU tail(1)
+ sed -i -e "s:tail +16c:tail -c +16:g" \
+ gcc/Makefile.in || die "sed gcc/Makefile.in failed."
+
+ epatch "${FILESDIR}"/${PN}-4.0.1_p5465-default-altivec.patch
+
+ # dsymutil stuff breaks on 10.4/x86, revert it
+ [[ ${CHOST} == *86*-apple-darwin8 ]] && \
+ epatch "${FILESDIR}"/${PN}-${GCC_VERS}-dsymutil.patch
+
+ # bootstrapping might fail with host provided gcc on 10.4/x86
+ if ! is_crosscompile && ! echo "int main(){return 0;}" | gcc -o "${T}"/foo \
+ -mdynamic-no-pic -x c - >/dev/null 2>&1;
+ then
+ einfo "-mdynamic-no-pic doesn't work - disabling..."
+ echo "BOOT_CFLAGS=-g -O2" > config/mh-x86-darwin
+ XD=gcc/config/i386/x-darwin
+ awk 'BEGIN{x=1}{if ($0 ~ "use -mdynamic-no-pic to build x86")
+ {x=1-x} else if (x) print}' $XD > t && mv t $XD \
+ || die "Failed to rewrite $XD"
+ fi
+
+ epatch "${FILESDIR}"/${PN}-4.2.1-prefix-search-dirs.patch
+ eprefixify "${S}"/gcc/gcc.c
+
+ if use !bootstrap ; then
+ # this only occurs with up-to-date tools from the Prefix, and actually
+ # breaks the bootstrap since the autoconf needs a very recent automake
+ epatch "${FILESDIR}"/${PN}-${GCC_VERS}-texinfo.patch
+ epatch "${FILESDIR}"/${PN}-${GCC_VERS}-autoconf-m4-precious.patch
+ cd "${S}"/gcc && eautoconf
+ cd "${S}"/libgomp && eautoconf
+ fi
+
+ local BRANDING_GCC_PKGVERSION="$(sed -n -e '/^#define VERSUFFIX/s/^[^"]*"\([^"]\+\)".*$/\1/p' "${S}"/gcc/version.c)"
+ BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/(/(Gentoo ${PVR}, }
+ einfo "patching gcc version: ${GCC_VERS}${BRANDING_GCC_PKGVERSION}"
+
+ sed -i -e "s~VERSUFFIX \"[^\"]*~VERSUFFIX \"${BRANDING_GCC_PKGVERSION}~" \
+ "${S}"/gcc/version.c || die "failed to update VERSUFFIX with Gentoo branding"
+ sed -i -e 's~developer\.apple\.com\/bugreporter~bugs\.gentoo\.org\/~' \
+ "${S}"/gcc/version.c || die "Failed to change the bug URL"
+}
+
+src_configure() {
+ local langs="c"
+ use cxx && langs="${langs},c++"
+ use objc && langs="${langs},objc"
+ use objc++ && langs="${langs/,objc/},objc,obj-c++" # need objc with objc++
+ use fortran && langs="${langs},fortran"
+
+ local myconf="${myconf} \
+ --prefix=${EPREFIX}/usr \
+ --bindir=${BINPATH} \
+ --includedir=${LIBPATH}/include \
+ --datadir=${EPREFIX}/usr/share/gcc-data/${CTARGET}/${GCC_VERS} \
+ --mandir=${EPREFIX}/usr/share/gcc-data/${CTARGET}/${GCC_VERS}/man \
+ --infodir=${EPREFIX}/usr/share/gcc-data/${CTARGET}/${GCC_VERS}/info \
+ --with-gxx-include-dir=${STDCXX_INCDIR} \
+ --host=${CHOST}
+ --enable-version-specific-runtime-libs"
+
+ if is_crosscompile ; then
+ # Straight from the GCC install doc:
+ # "GCC has code to correctly determine the correct value for target
+ # for nearly all native systems. Therefore, we highly recommend you
+ # not provide a configure target when configuring a native compiler."
+ myconf="${myconf} --target=${CTARGET}"
+
+ # Tell compiler where to find what it needs
+ myconf="${myconf} --with-sysroot=${EPREFIX}/usr/${CTARGET}"
+
+ # Set this to something sane for both native and target
+ CFLAGS="-O2 -pipe"
+
+ local VAR="CFLAGS_"${CTARGET//-/_}
+ CXXFLAGS=${!VAR}
+ fi
+ [[ -n ${CBUILD} ]] && myconf="${myconf} --build=${CBUILD}"
+
+ # Native Language Support
+ if use nls ; then
+ myconf="${myconf} --enable-nls --without-included-gettext"
+ else
+ myconf="${myconf} --disable-nls"
+ fi
+
+ # reasonably sane globals (hopefully)
+ myconf="${myconf} \
+ --with-system-zlib \
+ --disable-checking \
+ --disable-werror"
+
+ # ???
+ myconf="${myconf} --enable-shared --enable-threads=posix"
+
+ # make clear we're in an offset
+ use prefix && myconf="${myconf} --with-local-prefix=${TPREFIX}/usr"
+
+ # we don't use a GNU linker, so tell GCC where to find the linker stuff we
+ # want it to use
+ myconf="${myconf} \
+ --with-as=${EPREFIX}/usr/bin/${CTARGET}-as \
+ --with-ld=${EPREFIX}/usr/bin/${CTARGET}-ld"
+
+ # make sure we never do multilib stuff, for that we need a different Prefix
+ [[ -z ${I_KNOW_WHAT_IM_DOING_I_WANT_APPLE_MULTILIB} ]] \
+ && myconf="${myconf} --disable-multilib"
+
+ myconf="${myconf} --enable-languages=${langs} $(use_enable openmp libgomp)"
+
+ # The produced libgcc_s.dylib is faulty if using a bit too much
+ # optimisation. Nail it down to something sane
+ CFLAGS="-O2 -pipe"
+ CXXFLAGS=${CFLAGS}
+
+ # http://gcc.gnu.org/ml/gcc-patches/2006-11/msg00765.html
+ # (won't hurt if already 64-bits, but is essential when coming from a
+ # multilib compiler -- the default)
+ [[ ${CTARGET} == powerpc64-* || ${CTARGET} == x86_64-* ]] && \
+ export CC="gcc -m64"
+
+ mkdir -p "${WORKDIR}"/build
+ cd "${WORKDIR}"/build
+ einfo "Configuring GCC with: ${myconf//--/\n\t--}"
+ "${S}"/configure ${myconf} || die "conf failed"
+}
+
+src_compile() {
+ cd "${WORKDIR}"/build || die
+ emake bootstrap || die "emake failed"
+}
+
+src_install() {
+ cd "${WORKDIR}"/build
+ # -jX doesn't work
+ emake -j1 DESTDIR="${D}" install || die
+
+ # Punt some tools which are really only useful while building gcc
+ find "${ED}" -name install-tools -prune -type d -exec rm -rf "{}" \;
+ # This one comes with binutils
+ find "${ED}" -name libiberty.a -exec rm -f "{}" \;
+
+ # Basic sanity check
+ if ! is_crosscompile ; then
+ local EXEEXT
+ eval $(grep ^EXEEXT= "${WORKDIR}"/build/gcc/config.log)
+ [[ -r ${D}${BINPATH}/gcc${EXEEXT} ]] || die "gcc not found in ${ED}"
+ fi
+
+ # create gcc-config entry
+ dodir /etc/env.d/gcc
+ local gcc_envd_base="/etc/env.d/gcc/${CHOST}-${GCC_VERS}"
+
+ gcc_envd_file="${ED}${gcc_envd_base}"
+
+ # phase PATH/ROOTPATH out ...
+ echo "PATH=\"${BINPATH}\"" > ${gcc_envd_file}
+ echo "ROOTPATH=\"${BINPATH}\"" >> ${gcc_envd_file}
+ echo "GCC_PATH=\"${BINPATH}\"" >> ${gcc_envd_file}
+
+ # we don't do multilib
+ LDPATH="${LIBPATH}"
+ echo "LDPATH=\"${LDPATH}\"" >> ${gcc_envd_file}
+ echo "MANPATH=\"${EPREFIX}/usr/share/gcc-data/${CHOST}/${GCC_VERS}/man\"" >> ${gcc_envd_file}
+ echo "INFOPATH=\"${EPREFIX}/usr/share/gcc-data/${CHOST}/${GCC_VERS}/info\"" >> ${gcc_envd_file}
+ echo "STDCXX_INCDIR=\"g++-v${GCC_VERS/\.*/}\"" >> ${gcc_envd_file}
+ is_crosscompile && echo "CTARGET=${CTARGET}" >> ${gcc_envd_file}
+
+ # Move <cxxabi.h> to compiler-specific directories
+ [[ -f ${D}${STDCXX_INCDIR}/cxxabi.h ]] && \
+ mv -f "${D}"${STDCXX_INCDIR}/cxxabi.h "${D}"${LIBPATH}/include/
+
+ # These should be symlinks
+ dodir /usr/bin
+ cd "${D}"${BINPATH}
+ for x in cpp gcc g++ c++ g77 gcj gcjh gfortran ; do
+ # For some reason, g77 gets made instead of ${CTARGET}-g77...
+ # this should take care of that
+ [[ -f ${x} ]] && mv ${x} ${CTARGET}-${x}
+
+ if [[ -f ${CTARGET}-${x} ]] && ! is_crosscompile ; then
+ ln -sf ${CTARGET}-${x} ${x}
+
+ # Create version-ed symlinks
+ dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
+ /usr/bin/${CTARGET}-${x}-${GCC_VERS}
+ dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
+ /usr/bin/${x}-${GCC_VERS}
+ fi
+
+ if [[ -f ${CTARGET}-${x}-${GCC_VERS} ]] ; then
+ rm -f ${CTARGET}-${x}-${GCC_VERS}
+ ln -sf ${CTARGET}-${x} ${CTARGET}-${x}-${GCC_VERS}
+ fi
+ done
+
+ # I do not know if this will break gcj stuff, so I'll only do it for
+ # objc for now; basically "ffi.h" is the correct file to include,
+ # but it gets installed in .../GCCVER/include and yet it does
+ # "#include <ffitarget.h>" which (correctly, as it's an "extra" file)
+ # is installed in .../GCCVER/include/libffi; the following fixes
+ # ffi.'s include of ffitarget.h - Armando Di Cianno <fafhrd@gentoo.org>
+ if [[ -d ${D}${LIBPATH}/include/libffi ]] ; then
+ mv -i "${D}"${LIBPATH}/include/libffi/* "${D}"${LIBPATH}/include || die
+ rm -r "${D}"${LIBPATH}/include/libffi || die
+ fi
+
+ # Now do the fun stripping stuff
+ env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${BINPATH}"
+ env RESTRICT="" CHOST=${CTARGET} prepstrip "${D}${LIBPATH}"
+ # gcc used to install helper binaries in lib/ but then moved to libexec/
+ [[ -d ${ED}/usr/libexec/gcc ]] && \
+ env RESTRICT="" CHOST=${CHOST} prepstrip "${ED}/usr/libexec/gcc/${CTARGET}/${GCC_VERS}"
+
+ # prune empty dirs left behind
+ find "${ED}" -type d | xargs rmdir >& /dev/null
+}
+
+pkg_postinst() {
+ # beware this also switches when it's on another branch version of GCC
+ gcc-config ${CTARGET}-${GCC_VERS}
+}
+
+pkg_postrm() {
+ # clean up the cruft left behind by cross-compilers
+ if is_crosscompile ; then
+ if [[ -z $(ls "${EROOT}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
+ rm -f "${EROOT}"/etc/env.d/gcc/config-${CTARGET}
+ rm -f "${EROOT}"/etc/env.d/??gcc-${CTARGET}
+ rm -f "${EROOT}"/usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
+ fi
+ return 0
+ fi
+}
diff --git a/sys-devel/gcc-apple/gcc-apple-4.2.1_p5666-r1.ebuild b/sys-devel/gcc-apple/gcc-apple-4.2.1_p5666-r1.ebuild
new file mode 100644
index 000000000000..16f64f4139c7
--- /dev/null
+++ b/sys-devel/gcc-apple/gcc-apple-4.2.1_p5666-r1.ebuild
@@ -0,0 +1,344 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils toolchain flag-o-matic autotools prefix
+
+GCC_VERS=${PV/_p*/}
+APPLE_VERS="${PV/*_p/}.3"
+DESCRIPTION="Apple branch of the GNU Compiler Collection, Developer Tools 4.0"
+HOMEPAGE="http://gcc.gnu.org"
+SRC_URI="http://www.opensource.apple.com/darwinsource/tarballs/other/gcc-${APPLE_VERS}.tar.gz
+ http://www.opensource.apple.com/darwinsource/tarballs/other/libstdcxx-16.tar.gz
+ http://www.opensource.apple.com/darwinsource/tarballs/other/libstdcxx-39.tar.gz
+ fortran? ( mirror://gnu/gcc/gcc-4.2.4/gcc-fortran-4.2.4.tar.bz2 )"
+LICENSE="GPL-2 GPL-3"
+
+case ${CHOST} in
+ *-darwin1*|i?86-*-darwin9|powerpc-*-darwin9)
+ LIBSTDCXX_APPLE_VERSION=39
+ ;;
+ *)
+ # pre Leopard has no dtrace, which is required by 37.11 and above
+ # Leopard only has 32-bits version of dtrace
+ LIBSTDCXX_APPLE_VERSION=16
+ ;;
+esac
+
+if is_crosscompile; then
+ SLOT="${CTARGET}-42"
+else
+ SLOT="42"
+fi
+
+KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
+
+IUSE="fortran nls +openmp objc objc++ +cxx"
+
+RDEPEND=">=sys-libs/zlib-1.1.4
+ >=sys-libs/ncurses-5.2-r2
+ nls? ( sys-devel/gettext )
+ >=sys-devel/gcc-config-1.3.12-r4
+ sys-libs/csu
+ fortran? (
+ >=dev-libs/gmp-4.2.1
+ >=dev-libs/mpfr-2.2.0_p10
+ )"
+DEPEND="${RDEPEND}
+ >=sys-apps/texinfo-4.2-r4
+ >=sys-devel/bison-1.875
+ ${CATEGORY}/binutils-apple
+ >=dev-libs/mpfr-2.2.0_p10"
+
+S=${WORKDIR}/gcc-${APPLE_VERS}
+
+# TPREFIX is the prefix of the CTARGET installation
+export TPREFIX=${TPREFIX:-${EPREFIX}}
+
+LIBPATH=${EPREFIX}/usr/lib/gcc/${CTARGET}/${GCC_VERS}
+if is_crosscompile ; then
+ BINPATH=${EPREFIX}/usr/${CHOST}/${CTARGET}/gcc-bin/${GCC_VERS}
+else
+ BINPATH=${EPREFIX}/usr/${CTARGET}/gcc-bin/${GCC_VERS}
+fi
+STDCXX_INCDIR=${LIBPATH}/include/g++-v${GCC_VERS/\.*/}
+
+src_unpack() {
+ # override toolchain.eclass func
+ unpack ${A}
+}
+
+src_prepare() {
+ # Support for fortran
+ if use fortran ; then
+ mv "${WORKDIR}"/gcc-4.2.4/gcc/fortran gcc/ || die
+ mv "${WORKDIR}"/gcc-4.2.4/libgfortran . || die
+ # from: substracted from http://r.research.att.com/tools/
+ epatch "${FILESDIR}"/${PN}-4.2.1_p5646-gfortran.patch
+ fi
+
+ # move in libstdc++
+ mv "${WORKDIR}"/libstdcxx-${LIBSTDCXX_APPLE_VERSION}/libstdcxx/libstdc++-v3 .
+ if [[ ${LIBSTDCXX_APPLE_VERSION} == 16 ]] ; then
+ epatch "${FILESDIR}"/libstdc++-${LIBSTDCXX_APPLE_VERSION}.patch # does it apply on 37?
+ sed -i -e 's/__block\([^_]\)/__blk\1/g' \
+ libstdc++-v3/include/ext/mt_allocator.h \
+ libstdc++-v3/src/mt_allocator.cc || die "conflict fix failed"
+ fi
+
+ # we use our libtool
+ sed -i -e "s:/usr/bin/libtool:${EPREFIX}/usr/bin/${CTARGET}-libtool:" \
+ gcc/config/darwin.h || die "sed gcc/config/darwin.h failed"
+ # add prefixed Frameworks to default search paths (may want to change this
+ # in a cross-compile)
+ sed -i -e "/\"\/System\/Library\/Frameworks\"\,/i\ \ \"${EPREFIX}/Frameworks\"\, " \
+ gcc/config/darwin-c.c || die "sed gcc/config/darwin-c.c failed"
+
+ # Workaround deprecated "+Nc" syntax for GNU tail(1)
+ sed -i -e "s:tail +16c:tail -c +16:g" \
+ gcc/Makefile.in || die "sed gcc/Makefile.in failed."
+
+ # default to AltiVec on PPC, like for older releases
+ epatch "${FILESDIR}"/${PN}-4.0.1_p5465-default-altivec.patch
+
+ # support -arch XXX if XXX is actually what the toolchain targets because
+ # some upstreams insist on setting it
+ epatch "${FILESDIR}"/${PN}-4.2.1-arch-option.patch
+
+ # dsymutil stuff breaks on 10.4/x86, revert it
+ [[ ${CHOST} == *86*-apple-darwin8 ]] && \
+ epatch "${FILESDIR}"/${PN}-${GCC_VERS}-dsymutil.patch
+
+ # Pseudo-support OS X 10.10
+ [[ ${CHOST} == *-darwin14 ]] && \
+ epatch "${FILESDIR}"/${P}-darwin14.patch
+
+ # bootstrapping might fail with host provided gcc on 10.4/x86
+ if ! is_crosscompile && ! echo "int main(){return 0;}" | gcc -o "${T}"/foo \
+ -mdynamic-no-pic -x c - >/dev/null 2>&1;
+ then
+ einfo "-mdynamic-no-pic doesn't work - disabling..."
+ echo "BOOT_CFLAGS=-g -O2" > config/mh-x86-darwin
+ XD=gcc/config/i386/x-darwin
+ awk 'BEGIN{x=1}{if ($0 ~ "use -mdynamic-no-pic to build x86")
+ {x=1-x} else if (x) print}' $XD > t && mv t $XD \
+ || die "Failed to rewrite $XD"
+ fi
+
+ epatch "${FILESDIR}"/${P}-perl-5.18.patch
+
+ epatch "${FILESDIR}"/${PN}-4.2.1-prefix-search-dirs.patch
+ eprefixify "${S}"/gcc/gcc.c
+
+ if use !bootstrap ; then
+ # this only occurs with up-to-date tools from the Prefix, and actually
+ # breaks the bootstrap since the autoconf needs a very recent automake
+ epatch "${FILESDIR}"/${PN}-${GCC_VERS}-texinfo.patch
+ epatch "${FILESDIR}"/${PN}-${GCC_VERS}-autoconf-m4-precious.patch
+ cd "${S}"/gcc && eautoconf
+ cd "${S}"/libgomp && eautoconf
+ fi
+
+ local BRANDING_GCC_PKGVERSION="$(sed -n -e '/^#define VERSUFFIX/s/^[^"]*"\([^"]\+\)".*$/\1/p' "${S}"/gcc/version.c)"
+ BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/(/(Gentoo ${PVR}, }
+ einfo "patching gcc version: ${GCC_VERS}${BRANDING_GCC_PKGVERSION}"
+
+ sed -i -e "s~VERSUFFIX \"[^\"]*~VERSUFFIX \"${BRANDING_GCC_PKGVERSION}~" \
+ "${S}"/gcc/version.c || die "failed to update VERSUFFIX with Gentoo branding"
+ sed -i -e 's~developer\.apple\.com\/bugreporter~bugs\.gentoo\.org\/~' \
+ "${S}"/gcc/version.c || die "Failed to change the bug URL"
+}
+
+src_configure() {
+ local langs="c"
+ use cxx && langs="${langs},c++"
+ use objc && langs="${langs},objc"
+ use objc++ && langs="${langs/,objc/},objc,obj-c++" # need objc with objc++
+ use fortran && langs="${langs},fortran"
+
+ local myconf="${myconf} \
+ --prefix=${EPREFIX}/usr \
+ --bindir=${BINPATH} \
+ --includedir=${LIBPATH}/include \
+ --datadir=${EPREFIX}/usr/share/gcc-data/${CTARGET}/${GCC_VERS} \
+ --mandir=${EPREFIX}/usr/share/gcc-data/${CTARGET}/${GCC_VERS}/man \
+ --infodir=${EPREFIX}/usr/share/gcc-data/${CTARGET}/${GCC_VERS}/info \
+ --with-gxx-include-dir=${STDCXX_INCDIR} \
+ --host=${CHOST} \
+ --enable-version-specific-runtime-libs"
+
+ if is_crosscompile ; then
+ # Straight from the GCC install doc:
+ # "GCC has code to correctly determine the correct value for target
+ # for nearly all native systems. Therefore, we highly recommend you
+ # not provide a configure target when configuring a native compiler."
+ myconf="${myconf} --target=${CTARGET}"
+
+ # Tell compiler where to find what it needs
+ myconf="${myconf} --with-sysroot=${EPREFIX}/usr/${CTARGET}"
+
+ # Set this to something sane for both native and target
+ CFLAGS="-O2 -pipe"
+
+ local VAR="CFLAGS_"${CTARGET//-/_}
+ CXXFLAGS=${!VAR}
+ fi
+ [[ -n ${CBUILD} ]] && myconf="${myconf} --build=${CBUILD}"
+
+ # Native Language Support
+ if use nls ; then
+ myconf="${myconf} --enable-nls --without-included-gettext"
+ else
+ myconf="${myconf} --disable-nls"
+ fi
+
+ # reasonably sane globals (hopefully)
+ myconf="${myconf} \
+ --with-system-zlib \
+ --disable-checking \
+ --disable-werror"
+
+ # ???
+ myconf="${myconf} --enable-shared --enable-threads=posix"
+
+ # make clear we're in an offset
+ use prefix && myconf="${myconf} --with-local-prefix=${TPREFIX}/usr"
+
+ # we don't use a GNU linker, so tell GCC where to find the linker stuff we
+ # want it to use
+ myconf="${myconf} \
+ --with-as=${EPREFIX}/usr/bin/${CTARGET}-as \
+ --with-ld=${EPREFIX}/usr/bin/${CTARGET}-ld"
+
+ # make sure we never do multilib stuff, for that we need a different Prefix
+ [[ -z ${I_KNOW_WHAT_IM_DOING_I_WANT_APPLE_MULTILIB} ]] \
+ && myconf="${myconf} --disable-multilib"
+
+ myconf="${myconf} --enable-languages=${langs} $(use_enable openmp libgomp)"
+
+ # The produced libgcc_s.dylib is faulty if using a bit too much
+ # optimisation. Nail it down to something sane
+ CFLAGS="-O2 -pipe"
+ CXXFLAGS=${CFLAGS}
+
+ # http://gcc.gnu.org/ml/gcc-patches/2006-11/msg00765.html
+ # (won't hurt if already 64-bits, but is essential when coming from a
+ # multilib compiler -- the default)
+ [[ ${CTARGET} == powerpc64-* || ${CTARGET} == x86_64-* ]] && \
+ export CC="${CC:-$(tc-getCC)} -m64"
+
+ mkdir -p "${WORKDIR}"/build
+ cd "${WORKDIR}"/build
+ einfo "Configuring GCC with: ${myconf//--/\n\t--}"
+ "${S}"/configure ${myconf} || die "conf failed"
+}
+
+src_compile() {
+ cd "${WORKDIR}"/build || die
+ emake bootstrap || die "emake failed"
+}
+
+src_install() {
+ cd "${WORKDIR}"/build
+ # -jX doesn't work
+ emake -j1 DESTDIR="${D}" install || die
+
+ # Punt some tools which are really only useful while building gcc
+ find "${ED}" -name install-tools -prune -type d -exec rm -rf "{}" \;
+ # This one comes with binutils
+ find "${ED}" -name libiberty.a -exec rm -f "{}" \;
+
+ # Basic sanity check
+ if ! is_crosscompile ; then
+ local EXEEXT
+ eval $(grep ^EXEEXT= "${WORKDIR}"/build/gcc/config.log)
+ [[ -r ${D}${BINPATH}/gcc${EXEEXT} ]] || die "gcc not found in ${ED}"
+ fi
+
+ # create gcc-config entry
+ dodir /etc/env.d/gcc
+ local gcc_envd_base="/etc/env.d/gcc/${CHOST}-${GCC_VERS}"
+
+ gcc_envd_file="${ED}${gcc_envd_base}"
+
+ # phase PATH/ROOTPATH out ...
+ echo "PATH=\"${BINPATH}\"" > ${gcc_envd_file}
+ echo "ROOTPATH=\"${BINPATH}\"" >> ${gcc_envd_file}
+ echo "GCC_PATH=\"${BINPATH}\"" >> ${gcc_envd_file}
+
+ # we don't do multilib
+ LDPATH="${LIBPATH}"
+ echo "LDPATH=\"${LDPATH}\"" >> ${gcc_envd_file}
+ echo "MANPATH=\"${EPREFIX}/usr/share/gcc-data/${CHOST}/${GCC_VERS}/man\"" >> ${gcc_envd_file}
+ echo "INFOPATH=\"${EPREFIX}/usr/share/gcc-data/${CHOST}/${GCC_VERS}/info\"" >> ${gcc_envd_file}
+ echo "STDCXX_INCDIR=\"g++-v${GCC_VERS/\.*/}\"" >> ${gcc_envd_file}
+ is_crosscompile && echo "CTARGET=${CTARGET}" >> ${gcc_envd_file}
+
+ # Move <cxxabi.h> to compiler-specific directories
+ [[ -f ${D}${STDCXX_INCDIR}/cxxabi.h ]] && \
+ mv -f "${D}"${STDCXX_INCDIR}/cxxabi.h "${D}"${LIBPATH}/include/
+
+ # These should be symlinks
+ dodir /usr/bin
+ cd "${D}"${BINPATH}
+ for x in cpp gcc g++ c++ g77 gcj gcjh gfortran ; do
+ # For some reason, g77 gets made instead of ${CTARGET}-g77...
+ # this should take care of that
+ [[ -f ${x} ]] && mv ${x} ${CTARGET}-${x}
+
+ if [[ -f ${CTARGET}-${x} ]] && ! is_crosscompile ; then
+ ln -sf ${CTARGET}-${x} ${x}
+
+ # Create version-ed symlinks
+ dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
+ /usr/bin/${CTARGET}-${x}-${GCC_VERS}
+ dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
+ /usr/bin/${x}-${GCC_VERS}
+ fi
+
+ if [[ -f ${CTARGET}-${x}-${GCC_VERS} ]] ; then
+ rm -f ${CTARGET}-${x}-${GCC_VERS}
+ ln -sf ${CTARGET}-${x} ${CTARGET}-${x}-${GCC_VERS}
+ fi
+ done
+
+ # I do not know if this will break gcj stuff, so I'll only do it for
+ # objc for now; basically "ffi.h" is the correct file to include,
+ # but it gets installed in .../GCCVER/include and yet it does
+ # "#include <ffitarget.h>" which (correctly, as it's an "extra" file)
+ # is installed in .../GCCVER/include/libffi; the following fixes
+ # ffi.'s include of ffitarget.h - Armando Di Cianno <fafhrd@gentoo.org>
+ if [[ -d ${D}${LIBPATH}/include/libffi ]] ; then
+ mv -i "${D}"${LIBPATH}/include/libffi/* "${D}"${LIBPATH}/include || die
+ rm -r "${D}"${LIBPATH}/include/libffi || die
+ fi
+
+ # Now do the fun stripping stuff
+ env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${BINPATH}"
+ env RESTRICT="" CHOST=${CTARGET} prepstrip "${D}${LIBPATH}"
+ # gcc used to install helper binaries in lib/ but then moved to libexec/
+ [[ -d ${ED}/usr/libexec/gcc ]] && \
+ env RESTRICT="" CHOST=${CHOST} prepstrip "${ED}/usr/libexec/gcc/${CTARGET}/${GCC_VERS}"
+
+ # prune empty dirs left behind
+ find "${ED}" -type d | xargs rmdir >& /dev/null
+}
+
+pkg_postinst() {
+ # beware this also switches when it's on another branch version of GCC
+ gcc-config ${CTARGET}-${GCC_VERS}
+}
+
+pkg_postrm() {
+ # clean up the cruft left behind by cross-compilers
+ if is_crosscompile ; then
+ if [[ -z $(ls "${EROOT}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
+ rm -f "${EROOT}"/etc/env.d/gcc/config-${CTARGET}
+ rm -f "${EROOT}"/etc/env.d/??gcc-${CTARGET}
+ rm -f "${EROOT}"/usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
+ fi
+ return 0
+ fi
+}
diff --git a/sys-devel/gcc-apple/gcc-apple-4.2.1_p5666-r2.ebuild b/sys-devel/gcc-apple/gcc-apple-4.2.1_p5666-r2.ebuild
new file mode 100644
index 000000000000..08cc75d850aa
--- /dev/null
+++ b/sys-devel/gcc-apple/gcc-apple-4.2.1_p5666-r2.ebuild
@@ -0,0 +1,375 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils toolchain flag-o-matic autotools prefix
+
+GCC_VERS=${PV/_p*/}
+APPLE_VERS="${PV/*_p/}.3"
+DESCRIPTION="Apple branch of the GNU Compiler Collection, Developer Tools 4.0"
+HOMEPAGE="http://gcc.gnu.org"
+SRC_URI="http://www.opensource.apple.com/darwinsource/tarballs/other/gcc-${APPLE_VERS}.tar.gz
+ http://www.opensource.apple.com/darwinsource/tarballs/other/libstdcxx-16.tar.gz
+ http://www.opensource.apple.com/darwinsource/tarballs/other/libstdcxx-39.tar.gz
+ fortran? ( mirror://gnu/gcc/gcc-4.2.4/gcc-fortran-4.2.4.tar.bz2 )"
+LICENSE="GPL-2 GPL-3"
+
+case ${CHOST} in
+ *-darwin1*|i?86-*-darwin9|powerpc-*-darwin9)
+ LIBSTDCXX_APPLE_VERSION=39
+ ;;
+ *)
+ # pre Leopard has no dtrace, which is required by 37.11 and above
+ # Leopard only has 32-bits version of dtrace
+ LIBSTDCXX_APPLE_VERSION=16
+ ;;
+esac
+
+if is_crosscompile; then
+ SLOT="${CTARGET}-42"
+else
+ SLOT="42"
+fi
+
+KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
+
+IUSE="fortran nls +openmp objc objc++ +cxx"
+
+RDEPEND=">=sys-libs/zlib-1.1.4
+ >=sys-libs/ncurses-5.2-r2
+ nls? ( sys-devel/gettext )
+ >=sys-devel/gcc-config-1.8-r1
+ sys-libs/csu
+ !<sys-apps/portage-2.2.14
+ fortran? (
+ >=dev-libs/gmp-4.2.1
+ >=dev-libs/mpfr-2.2.0_p10
+ )"
+DEPEND="${RDEPEND}
+ >=sys-apps/texinfo-4.2-r4
+ >=sys-devel/bison-1.875
+ ${CATEGORY}/binutils-apple
+ >=dev-libs/mpfr-2.2.0_p10"
+
+S=${WORKDIR}/gcc-${APPLE_VERS}
+
+# TPREFIX is the prefix of the CTARGET installation
+export TPREFIX=${TPREFIX:-${EPREFIX}}
+
+LIBPATH=${EPREFIX}/usr/lib/gcc/${CTARGET}/${GCC_VERS}
+if is_crosscompile ; then
+ BINPATH=${EPREFIX}/usr/${CHOST}/${CTARGET}/gcc-bin/${GCC_VERS}
+else
+ BINPATH=${EPREFIX}/usr/${CTARGET}/gcc-bin/${GCC_VERS}
+fi
+STDCXX_INCDIR=${LIBPATH}/include/g++-v${GCC_VERS/\.*/}
+
+do_bootstrap() {
+ is_crosscompile && return 1
+ [[ ${CHOST} != ${CBUILD} ]] && return 1
+ [[ ${EPREFIX} != ${TPREFIX} ]] && return 1
+ return 0
+}
+
+src_unpack() {
+ # override toolchain.eclass func
+ unpack ${A}
+}
+
+src_prepare() {
+ # Support for fortran
+ if use fortran ; then
+ mv "${WORKDIR}"/gcc-4.2.4/gcc/fortran gcc/ || die
+ mv "${WORKDIR}"/gcc-4.2.4/libgfortran . || die
+ # from: substracted from http://r.research.att.com/tools/
+ epatch "${FILESDIR}"/${PN}-4.2.1_p5646-gfortran.patch
+ fi
+
+ # move in libstdc++
+ mv "${WORKDIR}"/libstdcxx-${LIBSTDCXX_APPLE_VERSION}/libstdcxx/libstdc++-v3 .
+ if [[ ${LIBSTDCXX_APPLE_VERSION} == 16 ]] ; then
+ epatch "${FILESDIR}"/libstdc++-${LIBSTDCXX_APPLE_VERSION}.patch # does it apply on 37?
+ sed -i -e 's/__block\([^_]\)/__blk\1/g' \
+ libstdc++-v3/include/ext/mt_allocator.h \
+ libstdc++-v3/src/mt_allocator.cc || die "conflict fix failed"
+ fi
+
+ # we use our libtool
+ sed -i -e "s:/usr/bin/libtool:${EPREFIX}/usr/bin/${CTARGET}-libtool:" \
+ gcc/config/darwin.h || die "sed gcc/config/darwin.h failed"
+ # add prefixed Frameworks to default search paths (may want to change this
+ # in a cross-compile)
+ sed -i -e "/\"\/System\/Library\/Frameworks\"\,/i\ \ \"${EPREFIX}/Frameworks\"\, " \
+ gcc/config/darwin-c.c || die "sed gcc/config/darwin-c.c failed"
+
+ # Workaround deprecated "+Nc" syntax for GNU tail(1)
+ sed -i -e "s:tail +16c:tail -c +16:g" \
+ gcc/Makefile.in || die "sed gcc/Makefile.in failed."
+
+ # default to AltiVec on PPC, like for older releases
+ epatch "${FILESDIR}"/${PN}-4.0.1_p5465-default-altivec.patch
+
+ # support -arch XXX if XXX is actually what the toolchain targets because
+ # some upstreams insist on setting it
+ epatch "${FILESDIR}"/${PN}-4.2.1-arch-option.patch
+
+ # dsymutil stuff breaks on 10.4/x86, revert it
+ [[ ${CHOST} == *86*-apple-darwin8 ]] && \
+ epatch "${FILESDIR}"/${PN}-${GCC_VERS}-dsymutil.patch
+
+ # support OS X 10.10
+ epatch "${FILESDIR}"/${P}-darwin14.patch
+
+ # bootstrapping might fail with host provided gcc on 10.4/x86
+ if ! is_crosscompile && ! echo "int main(){return 0;}" | gcc -o "${T}"/foo \
+ -mdynamic-no-pic -x c - >/dev/null 2>&1;
+ then
+ einfo "-mdynamic-no-pic doesn't work - disabling..."
+ echo "BOOT_CFLAGS=-g -O2" > config/mh-x86-darwin
+ XD=gcc/config/i386/x-darwin
+ awk 'BEGIN{x=1}{if ($0 ~ "use -mdynamic-no-pic to build x86")
+ {x=1-x} else if (x) print}' $XD > t && mv t $XD \
+ || die "Failed to rewrite $XD"
+ fi
+
+ epatch "${FILESDIR}"/${P}-perl-5.18.patch
+
+ epatch "${FILESDIR}"/${PN}-4.2.1-prefix-search-dirs-r1.patch
+ eprefixify "${S}"/gcc/gcc.c
+ sed -i -e "s|@GENTOO_PORTAGE_TPREFIX@|${TPREFIX}|g" "${S}"/gcc/config/darwin.h
+
+ if use !bootstrap ; then
+ # this only occurs with up-to-date tools from the Prefix, and actually
+ # breaks the bootstrap since the autoconf needs a very recent automake
+ epatch "${FILESDIR}"/${PN}-${GCC_VERS}-texinfo.patch
+ epatch "${FILESDIR}"/${PN}-${GCC_VERS}-autoconf-m4-precious.patch
+ cd "${S}"/gcc && eautoconf
+ cd "${S}"/libgomp && eautoconf
+ fi
+
+ local BRANDING_GCC_PKGVERSION="$(sed -n -e '/^#define VERSUFFIX/s/^[^"]*"\([^"]\+\)".*$/\1/p' "${S}"/gcc/version.c)"
+ BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/(/(Gentoo ${PVR}, }
+ einfo "patching gcc version: ${GCC_VERS}${BRANDING_GCC_PKGVERSION}"
+
+ sed -i -e "s~VERSUFFIX \"[^\"]*~VERSUFFIX \"${BRANDING_GCC_PKGVERSION}~" \
+ "${S}"/gcc/version.c || die "failed to update VERSUFFIX with Gentoo branding"
+ sed -i -e 's~developer\.apple\.com\/bugreporter~bugs\.gentoo\.org\/~' \
+ "${S}"/gcc/version.c || die "Failed to change the bug URL"
+
+ # fix the install_names of all shared libraries for the target
+ # NOTE: do this after any automake-ing!
+ # Yes, patching generated files is bad. Talk to me once you've found a way to do this inside automake.
+ sed -i -e "s|-install_name \$(slibdir)|-install_name ${TPREFIX}/usr/${CTARGET}/lib/gcc|" "${S}"/gcc/config/t-slibgcc-darwin
+ sed -i -e "s|-rpath \$(toolexeclibdir)|-rpath ${TPREFIX}/usr/${CTARGET}/lib/gcc|" \
+ "${S}"/{libgomp,libstdc++-v3/src,libstdc++-v3/libsupc++}/Makefile.in
+}
+
+src_configure() {
+ local langs="c"
+ use cxx && langs="${langs},c++"
+ use objc && langs="${langs},objc"
+ use objc++ && langs="${langs/,objc/},objc,obj-c++" # need objc with objc++
+ use fortran && langs="${langs},fortran"
+
+ local myconf="${myconf} \
+ --prefix=${EPREFIX}/usr \
+ --bindir=${BINPATH} \
+ --includedir=${LIBPATH}/include \
+ --datadir=${EPREFIX}/usr/share/gcc-data/${CTARGET}/${GCC_VERS} \
+ --mandir=${EPREFIX}/usr/share/gcc-data/${CTARGET}/${GCC_VERS}/man \
+ --infodir=${EPREFIX}/usr/share/gcc-data/${CTARGET}/${GCC_VERS}/info \
+ --with-gxx-include-dir=${STDCXX_INCDIR} \
+ --host=${CHOST} \
+ --enable-version-specific-runtime-libs"
+
+ if is_crosscompile ; then
+ # Straight from the GCC install doc:
+ # "GCC has code to correctly determine the correct value for target
+ # for nearly all native systems. Therefore, we highly recommend you
+ # not provide a configure target when configuring a native compiler."
+ myconf="${myconf} --target=${CTARGET}"
+
+ # Tell compiler where to find what it needs
+ myconf="${myconf} --with-sysroot=${EPREFIX}/usr/${CTARGET}"
+
+ # Set this to something sane for both native and target
+ CFLAGS="-O2 -pipe"
+
+ local VAR="CFLAGS_"${CTARGET//-/_}
+ CXXFLAGS=${!VAR}
+ fi
+ [[ -n ${CBUILD} ]] && myconf="${myconf} --build=${CBUILD}"
+
+ # Native Language Support
+ if use nls ; then
+ myconf="${myconf} --enable-nls --without-included-gettext"
+ else
+ myconf="${myconf} --disable-nls"
+ fi
+
+ # reasonably sane globals (hopefully)
+ myconf="${myconf} \
+ --with-system-zlib \
+ --disable-checking \
+ --disable-werror"
+
+ # ???
+ myconf="${myconf} --enable-shared --enable-threads=posix"
+
+ # make clear we're in an offset
+ use prefix && myconf="${myconf} --with-local-prefix=${TPREFIX}/usr"
+
+ do_bootstrap || myconf="${myconf} --disable-bootstrap"
+
+ # we don't use a GNU linker, so tell GCC where to find the linker stuff we
+ # want it to use
+ myconf="${myconf} \
+ --with-as=${EPREFIX}/usr/bin/${CTARGET}-as \
+ --with-ld=${EPREFIX}/usr/bin/${CTARGET}-ld"
+
+ # make sure we never do multilib stuff, for that we need a different Prefix
+ [[ -z ${I_KNOW_WHAT_IM_DOING_I_WANT_APPLE_MULTILIB} ]] \
+ && myconf="${myconf} --disable-multilib"
+
+ myconf="${myconf} --enable-languages=${langs} $(use_enable openmp libgomp)"
+
+ # The produced libgcc_s.dylib is faulty if using a bit too much
+ # optimisation. Nail it down to something sane
+ CFLAGS="-O2 -pipe"
+ CXXFLAGS=${CFLAGS}
+
+ # http://gcc.gnu.org/ml/gcc-patches/2006-11/msg00765.html
+ # (won't hurt if already 64-bits, but is essential when coming from a
+ # multilib compiler -- the default)
+ [[ ${CTARGET} == powerpc64-* || ${CTARGET} == x86_64-* ]] && \
+ export CC="${CC:-$(tc-getCC)} -m64"
+
+ mkdir -p "${WORKDIR}"/build
+ cd "${WORKDIR}"/build
+ einfo "Configuring GCC with: ${myconf//--/\n\t--}"
+ "${S}"/configure ${myconf} || die "conf failed"
+}
+
+src_compile() {
+ cd "${WORKDIR}"/build || die
+ if ! do_bootstrap; then
+ GCC_MAKE_TARGET=${GCC_MAKE_TARGET-all}
+ else
+ GCC_MAKE_TARGET=${GCC_MAKE_TARGET-bootstrap}
+ fi
+ emake ${GCC_MAKE_TARGET} || die "emake failed"
+}
+
+src_install() {
+ cd "${WORKDIR}"/build
+ # -jX doesn't work
+ emake -j1 DESTDIR="${D}" install || die
+
+ # Punt some tools which are really only useful while building gcc
+ find "${ED}" -name install-tools -prune -type d -exec rm -rf "{}" \;
+ # This one comes with binutils
+ find "${ED}" -name libiberty.a -exec rm -f "{}" \;
+
+ # Basic sanity check
+ if ! is_crosscompile ; then
+ local EXEEXT
+ eval $(grep ^EXEEXT= "${WORKDIR}"/build/gcc/config.log)
+ [[ -r ${D}${BINPATH}/gcc${EXEEXT} ]] || die "gcc not found in ${ED}"
+ fi
+
+ # create gcc-config entry
+ dodir /etc/env.d/gcc
+ local gcc_envd_base="/etc/env.d/gcc/${CHOST}-${GCC_VERS}"
+
+ gcc_envd_file="${ED}${gcc_envd_base}"
+
+ # phase PATH/ROOTPATH out ...
+ echo "PATH=\"${BINPATH}\"" > ${gcc_envd_file}
+ echo "ROOTPATH=\"${BINPATH}\"" >> ${gcc_envd_file}
+ echo "GCC_PATH=\"${BINPATH}\"" >> ${gcc_envd_file}
+
+ # we don't do multilib
+ LDPATH="${LIBPATH}"
+ echo "LDPATH=\"${LDPATH}\"" >> ${gcc_envd_file}
+ echo "MANPATH=\"${EPREFIX}/usr/share/gcc-data/${CHOST}/${GCC_VERS}/man\"" >> ${gcc_envd_file}
+ echo "INFOPATH=\"${EPREFIX}/usr/share/gcc-data/${CHOST}/${GCC_VERS}/info\"" >> ${gcc_envd_file}
+ echo "STDCXX_INCDIR=\"g++-v${GCC_VERS/\.*/}\"" >> ${gcc_envd_file}
+ is_crosscompile && echo "CTARGET=${CTARGET}" >> ${gcc_envd_file}
+
+ # Move <cxxabi.h> to compiler-specific directories
+ [[ -f ${D}${STDCXX_INCDIR}/cxxabi.h ]] && \
+ mv -f "${D}"${STDCXX_INCDIR}/cxxabi.h "${D}"${LIBPATH}/include/
+
+ # These should be symlinks
+ dodir /usr/bin
+ cd "${D}"${BINPATH}
+ for x in cpp gcc g++ c++ g77 gcj gcjh gfortran ; do
+ # For some reason, g77 gets made instead of ${CTARGET}-g77...
+ # this should take care of that
+ [[ -f ${x} ]] && mv ${x} ${CTARGET}-${x}
+
+ if [[ -f ${CTARGET}-${x} ]] && ! is_crosscompile ; then
+ ln -sf ${CTARGET}-${x} ${x}
+
+ # Create version-ed symlinks
+ dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
+ /usr/bin/${CTARGET}-${x}-${GCC_VERS}
+ dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
+ /usr/bin/${x}-${GCC_VERS}
+ fi
+
+ if [[ -f ${CTARGET}-${x}-${GCC_VERS} ]] ; then
+ rm -f ${CTARGET}-${x}-${GCC_VERS}
+ ln -sf ${CTARGET}-${x} ${CTARGET}-${x}-${GCC_VERS}
+ fi
+ done
+
+ # I do not know if this will break gcj stuff, so I'll only do it for
+ # objc for now; basically "ffi.h" is the correct file to include,
+ # but it gets installed in .../GCCVER/include and yet it does
+ # "#include <ffitarget.h>" which (correctly, as it's an "extra" file)
+ # is installed in .../GCCVER/include/libffi; the following fixes
+ # ffi.'s include of ffitarget.h - Armando Di Cianno <fafhrd@gentoo.org>
+ if [[ -d ${D}${LIBPATH}/include/libffi ]] ; then
+ mv -i "${D}"${LIBPATH}/include/libffi/* "${D}"${LIBPATH}/include || die
+ rm -r "${D}"${LIBPATH}/include/libffi || die
+ fi
+
+ # Now do the fun stripping stuff
+ env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${BINPATH}"
+ env RESTRICT="" CHOST=${CTARGET} prepstrip "${D}${LIBPATH}"
+ # gcc used to install helper binaries in lib/ but then moved to libexec/
+ [[ -d ${ED}/usr/libexec/gcc ]] && \
+ env RESTRICT="" CHOST=${CHOST} prepstrip "${ED}/usr/libexec/gcc/${CTARGET}/${GCC_VERS}"
+
+ # prune empty dirs left behind
+ find "${ED}" -type d | xargs rmdir >& /dev/null
+
+ # The gcc runtime libs have an invalid install_name; this is correct,
+ # as they are copied to the right location by gcc-config later.
+ QA_IGNORE_INSTALL_NAME_FILES=()
+ pushd "${ED}/usr/lib/gcc/${CTARGET}/${GCC_VERS}" > /dev/null
+ for file in *.dylib; do
+ QA_IGNORE_INSTALL_NAME_FILES+=( "${file}" )
+ done
+ popd > /dev/null
+}
+
+pkg_postinst() {
+ # beware this also switches when it's on another branch version of GCC
+ gcc-config ${CTARGET}-${GCC_VERS}
+}
+
+pkg_postrm() {
+ # clean up the cruft left behind by cross-compilers
+ if is_crosscompile ; then
+ if [[ -z $(ls "${EROOT}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
+ rm -f "${EROOT}"/etc/env.d/gcc/config-${CTARGET}
+ rm -f "${EROOT}"/etc/env.d/??gcc-${CTARGET}
+ rm -f "${EROOT}"/usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
+ fi
+ return 0
+ fi
+}
diff --git a/sys-devel/gcc-apple/metadata.xml b/sys-devel/gcc-apple/metadata.xml
new file mode 100644
index 000000000000..0ab7bb4b1919
--- /dev/null
+++ b/sys-devel/gcc-apple/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>prefix</herd>
+ <use>
+ <flag name="multislot">Allow for SLOTs to include minor version (3.3.4
+ instead of just 3.3)</flag>
+ <flag name="objc">Build support for the Objective C code language</flag>
+ <flag name="objc++">Build support for the Objective C++ language</flag>
+ <flag name="regression-test">Run the testsuite and install the results (requires FEATURES=test)</flag>
+ </use>
+</pkgmetadata>
diff --git a/sys-devel/gcc-config/Manifest b/sys-devel/gcc-config/Manifest
new file mode 100644
index 000000000000..19618c3e2f30
--- /dev/null
+++ b/sys-devel/gcc-config/Manifest
@@ -0,0 +1,6 @@
+DIST gcc-config-1.6.tar.xz 14232 SHA256 ca6a94d685a60e9ae5b8ff32c3173929848455a123233709ca791e72b640bf77 SHA512 d44256f67ed398c997cd8ce7f0b6e9bf5e602ee214deef3f7d53affd27693230526645627f00126e8b3492e5b1c7360d771b6138fb7cbc8145467c3a7ba0839d WHIRLPOOL 1a612ee1f652b0b73b4110e956c1559a56083fb4d4813f63ab374c6bba071954a13710555ffa93eec3dee94257d8891baa86989a41c0b72f3aef0edfe43f2f02
+DIST gcc-config-1.7.1.tar.xz 14708 SHA256 5d69148957bc48db2bf107558724d8c40701f8d27d1cfc7636f02353e9c2f79a SHA512 ed4f8c188679969c3428409813c1e78ca9fbf86f81f9a3e42489eecffc5857352b7d1fc90433679890b7c89da458ff1e2607e7a6f3578c6f65d1beaf71194d00 WHIRLPOOL 5f96a64dad21ae755270000adc1933dc5d2ccd28f5e49ecd96c36da266b2d64cbf3772045e529ffe6fc15381de26757c7ef742093262593a05608d52f8a97a78
+DIST gcc-config-1.7.2.tar.xz 15004 SHA256 2d235dfc1ff749b46ae8342dc3d30d5628f22eecd1ea665d16f90e82da88e899 SHA512 3bc2964fa9ede507a778787434e3aa64ef691616063d7d55020878eab9a8bf08ed5a6530dd36e15348927db9ce2b7fe22fa2aeb0039549a6e69ca895c087169b WHIRLPOOL 2692bd8289ae224a3011fbef94e45e7b903138cfa11dad4e27eca7a239f67a682def5563745bdebdfe05359d909d3f49142b23bc13141d4fa8528085c3a19299
+DIST gcc-config-1.7.3.tar.xz 15088 SHA256 2c6cca69a028f157dc54e19ea10efc240e0d26824cd223b22c294c003ce9325e SHA512 88b585787b5ad79017b27e68dbca6b5de96784582ee657d18562b1994bc1c27a6609b3dfcbf30f39a02b0b2886a289a1ddc955281fc60fe974436d13aa685908 WHIRLPOOL a9a45b489e34756da66e4597ba9f4fa061b5431a82310317237293a0c519c72906d14d3c72b76483c1c674bf779ac606cf85f22a5e4a4065dd92b1b91215461a
+DIST gcc-config-1.7.tar.xz 14584 SHA256 b704cb3b98c7a8f478dcc932ae7e4ac4f4f8a847bebe35f97dc45fa7a29268ee SHA512 4ab78c662feab59bc55e40b9dc63b967c1551b6d084638e2a16866488510e7c34e0b30a0bedaeae9dd806c77f79d1e31ccb834c6112794e7fbb557756f59c43d WHIRLPOOL 50415916834dc9d097e78afbc09a32a023e3542dd6ebcf60cd6c12d0e8fc484a6d63f821c9d3acf958fdaf5ce209976521bf22d3adcd5d20fa522f1f2fd38bdb
+DIST gcc-config-1.8.tar.xz 15020 SHA256 2453e2a07521b12267ca62b9b860eb2d2bc606cad0f29bf42a1c9543673f5a1b SHA512 3b84af2d961a0527834759e047330dbab7bac0ff3d6aae103f14fca2d44bd612bd4a1005649e8b4198036231ed8a8319fb13326b4d2c40474826cf53f7bc0826 WHIRLPOOL 4899bc1da43a158cc486022f68661e5318db7e4e83afdb5d892fc7ce5098a4bdb059dbab3c50e632901e577cd8760b2386da3ee24f5e944db12d3e246d9c26b6
diff --git a/sys-devel/gcc-config/files/gcc-config-1.4.1 b/sys-devel/gcc-config/files/gcc-config-1.4.1
new file mode 100644
index 000000000000..30abe4c2a7f1
--- /dev/null
+++ b/sys-devel/gcc-config/files/gcc-config-1.4.1
@@ -0,0 +1,801 @@
+#!/bin/bash
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+trap ":" INT QUIT TSTP
+
+argv0=${0##*/}
+source /etc/init.d/functions.sh || {
+ echo "${argv0}: Could not source /etc/init.d/functions.sh!"
+ exit 1
+}
+esyslog() { :; }
+umask 022
+
+# *BSD are plain stupid ... copy a GNU extension but don't just copy it,
+# change it so it works differently. Wish Darwin did selective evolution
+# on software developers.
+SED=$(type -P gsed)
+SED=${SED:-$(type -P sed)}
+
+GENTOO_LIBDIR="@GENTOO_LIBDIR@"
+[[ ${GENTOO_LIBDIR} == @*@ ]] && GENTOO_LIBDIR="lib"
+
+usage() {
+cat << "USAGE_END"
+Usage: gcc-config [options] [CC Profile]
+Change the current cc/gcc profile, or give info about profiles.
+
+Options:
+ -C, --nocolor Disable color output
+ -O, --use-old Use the old profile if one was selected.
+ -f, --force Make sure all config files are regenerated.
+ -P, --use-portage-chost Only set to given profile if its CHOST is the
+ same as that set for portage in /etc/make.conf
+ (or one of other portage config files...).
+ -c, --get-current-profile Print current used gcc profile.
+ -l, --list-profiles Print a list of available profiles.
+ -S, --split-profile Split profiles into their components
+ -E, --print-environ Print environment that can be used to setup the
+ current gcc profile, or a specified one.
+ -B, --get-bin-path Print path where binaries of the given/current
+ profile are located.
+ -L, --get-lib-path Print path where libraries of the given/current
+ profile are located.
+ -X, --get-stdcxx-incdir Print path where g++ include files of the
+ given/current profile are located.
+
+Profile names are of the form: <CHOST>-<gcc version>
+For example: i686-pc-linux-gnu-3.2.1
+USAGE_END
+ exit $1
+}
+[[ $# -lt 1 ]] && usage 1
+
+try_real_hard_to_find_CHOST() {
+ #
+ # First we read make.conf
+ #
+
+ local varname=${1:-CHOST}
+ local conf=${ROOT}/etc/make.conf
+ local ret=$(source "${conf}" 2>/dev/null ; echo ${!varname})
+ if [[ -z ${ret} ]] ; then
+ # newer portage supports spaces between the var and =
+ # CHOST = "this-is-retarded"
+ ret=$(eval $(
+ sed -n \
+ -e 's:[[:space:]]::g' \
+ -e "/^${varname}=/p" \
+ "${conf}"
+ ) ; echo ${!varname}
+ )
+ fi
+
+ if [[ -n ${ret} ]] ; then
+ echo ${ret}
+ return 0
+ fi
+
+ #
+ # Then we try /etc/env.d/gcc/config-${CTARGET}
+ #
+ if [[ -s ${ROOT}/etc/env.d/gcc/config-${CTARGET} ]] ; then
+ ret=$(split_gcc_ver $(eval $(<"${ROOT}"/etc/env.d/gcc/config-${CTARGET}) ; echo ${CURRENT}))
+ echo ${ret% *}
+ fi
+}
+
+get_real_chost() {
+ [[ -n ${REAL_CHOST} ]] && return 0
+
+ # shortcut for switching compilers in a cross chroot
+ if [[ -n ${CHOST} && ${ROOT} != "/" ]] ; then
+ REAL_CHOST=${CHOST}
+ return 0
+ fi
+
+ # make sure portage isnt broken
+ if python -V &>/dev/null ; then
+ export REAL_CHOST=$(env -i portageq envvar CHOST 2>/dev/null)
+ else
+ ewarn "Python seems to be broken, attempting to locate CHOST ourselves ..."
+ export REAL_CHOST=$(try_real_hard_to_find_CHOST)
+ fi
+
+ if [[ -z ${REAL_CHOST} ]] ; then
+ eerror "${argv0}: Could not get portage CHOST!"
+ eerror "${argv0}: You should verify that CHOST is set in one of these places:"
+ eerror "${argv0}: - ${ROOT}/etc/make.conf"
+ eerror "${argv0}: - active environment"
+ exit 1
+ fi
+}
+
+is_cross_compiler() {
+ get_real_chost
+ [[ ${CC_COMP/${REAL_CHOST}} == ${CC_COMP} ]]
+}
+
+# bool files_exists(search_path, files)
+# Return shell true if the specified files exist.
+# Files with relative paths are searched for in search_path.
+# Both lists are : delimited.
+files_exist() {
+ local p f ret old_IFS
+ local paths=$1 files=$2
+
+ old_IFS=${IFS}
+ export IFS=":"
+
+ ret=0
+ for f in ${files} ; do
+ if [[ ${f} == /* ]] ; then
+ [[ ! -f ${f} ]] && ret=1 && break
+ else
+ # make sure the file exists in at least
+ # one of the specified paths
+ ret=1
+ for p in ${paths} ; do
+ [[ -f ${p}/${f} ]] && ret=0 && break
+ done
+ [[ ${ret} == 1 ]] && break
+ fi
+ done
+
+ export IFS=${old_IFS}
+ if [[ ${ret} == 1 ]] ; then
+ ewarn "Could not locate '${f}' in '${paths}'"
+ fi
+ return ${ret}
+}
+
+switch_profile() {
+ local MY_LDPATH=
+ local GCC_PROFILES=
+ local OLD_CC_COMP=
+ local GCC_PATH=
+
+ if [[ $(id -u) != "0" ]] ; then
+ eerror "${argv0}: Must be root."
+ exit 1
+ fi
+
+ if is_cross_compiler ; then
+ ebegin "Switching cross-compiler to ${CC_COMP}"
+ else
+ ebegin "Switching native-compiler to ${CC_COMP}"
+ fi
+
+ if ! is_cross_compiler ; then
+ # Order our profiles to have the default first ...
+ # We do this so that we can have them ordered with default
+ # first in /etc/ld.so.conf, as the logical is that all
+ # compilers for default CHOST will be used to compile stuff,
+ # and thus we want all their lib paths in /etc/ld.so.conf ...
+ get_real_chost
+ GCC_PROFILES=$(LC_ALL="C" ls -r ${GCC_ENV_D}/${REAL_CHOST}-*)
+ GCC_PROFILES="${GCC_ENV_D}/${CC_COMP} ${GCC_PROFILES}"
+
+ # Extract all LDPATH's for our CHOST
+ MY_LDPATH=""
+ for x in ${GCC_PROFILES} ; do
+ if [[ -f ${x} ]] ; then
+ LDPATH=$(source "${x}"; echo ${LDPATH})
+
+ # Handle LDPATH's that have multiple directories
+ local old_IFS=${IFS}
+ export IFS=":"
+ local sub_ldpath=
+ for sub_ldpath in ${LDPATH} ; do
+ if [[ -d ${sub_ldpath} ]] ; then
+ if [[ ${MY_LDPATH/:${sub_ldpath}} == ${MY_LDPATH} ]] ; then
+ MY_LDPATH="${MY_LDPATH}:${sub_ldpath}"
+ fi
+ fi
+ done
+ export IFS=${old_IFS}
+ fi
+ done
+ MY_LDPATH="${MY_LDPATH:1}" # trim leading :
+ fi
+
+ # Translate old PATH/ROOTPATH to GCC_PATH
+ cp -p "${GCC_ENV_D}/${CC_COMP}" "${GCC_ENV_D}/${CC_COMP}.gcc-config-ref" || return 1
+ GCC_PATH=$(
+ unset GCC_PATH PATH ROOTPATH
+ source "${GCC_ENV_D}/${CC_COMP}"
+ echo ${GCC_PATH:-${PATH:-${ROOTPATH}}}
+ )
+ ${SED} -i \
+ -e '/^PATH=/d' \
+ -e '/^ROOTPATH=/d' \
+ -e '/^GCC_PATH=/d' \
+ "${GCC_ENV_D}/${CC_COMP}" || return 1
+ echo "GCC_PATH=\"${GCC_PATH}\"" >> "${GCC_ENV_D}/${CC_COMP}" || return 1
+ touch -r "${GCC_ENV_D}/${CC_COMP}.gcc-config-ref" "${GCC_ENV_D}/${CC_COMP}" || return 1
+ rm -f "${GCC_ENV_D}/${CC_COMP}.gcc-config-ref" || return 1
+
+ # Setup things properly again for this profile
+ unset GCC_SPECS LDPATH
+ source "${GCC_ENV_D}/${CC_COMP}"
+ OLD_CC_COMP=$(get_current_profile)
+
+ # What kind of env.d entry are we going to generate ?
+ if is_cross_compiler ; then
+ echo "PATH=\"${GCC_PATH}\"" > "${ENV_D}/05gcc-${CTARGET}"
+ echo "ROOTPATH=\"${GCC_PATH}\"" >> "${ENV_D}/05gcc-${CTARGET}"
+ echo "CURRENT=${CC_COMP}" > "${GCC_ENV_D}/config-${CTARGET}"
+ else
+ # Pass all by default
+ awk '!/^(STDCXX_INCDIR|LDPATH|CC|CXX|CTARGET|GCCBITS|GCC_SPECS|GCC_PATH)=/ {print $0}' \
+ "${GCC_ENV_D}/${CC_COMP}" > "${ENV_D}/05gcc-${CTARGET}"
+ echo "LDPATH=\"${MY_LDPATH}\"" >> "${ENV_D}/05gcc-${CTARGET}"
+ echo "PATH=\"${GCC_PATH}\"" >> "${ENV_D}/05gcc-${CTARGET}"
+ echo "ROOTPATH=\"${GCC_PATH}\"" >> "${ENV_D}/05gcc-${CTARGET}"
+ if [[ -n ${GCC_SPECS} ]] ; then
+ if files_exist ${MY_LDPATH} ${GCC_SPECS} ; then
+ echo "GCC_SPECS=\"${GCC_SPECS}\"" >> "${ENV_D}/05gcc-${CTARGET}"
+ else
+ echo
+ ewarn "Your GCC spec configurations are broken."
+ ewarn "Please re-emerge gcc."
+ echo
+ fi
+ else
+ # People need to rebuild their gcc or setting GCC_SPECS to
+ # "" will cause issues again :(
+ if [[ ${ROOT} != "/" ]] ; then
+ echo "GCC_SPECS=\"\"" >> "${ENV_D}/05gcc-${CTARGET}"
+ else
+ if ! GCC_SPECS="" /usr/bin/gcc -v &>/dev/null ; then
+ echo
+ ewarn "Your gcc has a bug with GCC_SPECS."
+ ewarn "Please re-emerge gcc."
+ ewarn "http://bugs.gentoo.org/68395"
+ echo
+ else
+ echo "GCC_SPECS=\"\"" >> "${ENV_D}/05gcc-${CTARGET}"
+ fi
+ fi
+ fi
+
+ echo "CURRENT=${CC_COMP}" > "${GCC_ENV_D}/config-${CTARGET}"
+
+ # Help out the gcc wrapper
+ rm -f "${GCC_ENV_D}/NATIVE" "${GCC_ENV_D}/.NATIVE"
+ ln -sf ${CC_COMP} "${GCC_ENV_D}/.NATIVE"
+
+ # Punt old files
+ rm -f "${ENV_D}/05gcc"
+ rm -f "${ENV_D}/05gcc-${CTARGET}"-*
+ rm -f "${GCC_ENV_D}/config"
+ rm -f "${GCC_ENV_D}/config-${CTARGET}"-*
+ fi
+
+ # Find the bin wrapper
+ local wrapper
+ for wrapper in ${GENTOO_LIBDIR} lib lib64 lib32 lib ; do
+ wrapper="${ROOT}usr/${wrapper}/misc/gcc-config"
+ [[ -e ${wrapper} ]] && break
+ done
+
+ # Update the wrappers for this profile
+ for x in {,${CTARGET}-}{cpp,cc,gcc,c++,g++,f77,g77,gcj,gcjh,gcov,gdc,gdmd,gfortran} ; do
+ # Obviously don't want to touch native stuff for cross-compilers
+ [[ ${x} != ${CTARGET}-* ]] && is_cross_compiler && continue
+
+ # Make sure we have no stale wrappers
+ rm -f "${ROOT}/usr/bin/${x}"
+ [[ ${x:${#x}-3} == "gcc" || ${x:${#x}-3} == "g++" ]] \
+ && rm -f "${ROOT}/usr/bin/${x}"{32,64}
+
+ # Only install a wrapper if the binary exists ...
+ # We want to figure out the 'reference file' for each
+ # wrapper (the binary we're 'wrapping') so that we can
+ # sync mtimes together. This makes things like ccache
+ # happy. See Bug #70548 for more info.
+ local ref
+ case ${x} in
+ cc) ref=${ROOT}/${GCC_PATH}/gcc;;
+ f77) ref=${ROOT}/${GCC_PATH}/g77;;
+ *) ref=${ROOT}/${GCC_PATH}/${x};;
+ esac
+ if [[ -x ${ref} ]] ; then
+ cp -f "${wrapper}" "${ROOT}/usr/bin/${x}"
+ touch -r "${ref}" "${ROOT}/usr/bin/${x}"
+
+ # Install 32bit and 64bit wrappers if need be
+ # This should probably get folded back into the wrapper ...
+ if [[ ${x:${#x}-3} == "gcc" ]] || [[ ${x:${#x}-3} == "g++" ]] ; then
+ for bits in ${GCCBITS} ; do
+ cp -f "${wrapper}" "${ROOT}/usr/bin/${x}${bits}"
+ done
+ fi
+ fi
+ done
+ # legacy cruft, make sure we dont leave it laying around #143205
+ rm -f "${ROOT}/usr/bin/${CTARGET}-cc"
+ # Only install cpp if switching to a native one
+ if ! is_cross_compiler && [[ ${CTARGET} != *-solaris* ]] ; then
+ rm -f "${ROOT}/lib/cpp"
+ cp -f "${wrapper}" "${ROOT}/lib/cpp"
+ fi
+
+ # Relocate random crap
+ if ! is_cross_compiler ; then
+ if [[ -e ${ROOT}/usr/${GENTOO_LIBDIR}/pkgconfig/libgcj-${CC_COMP_VERSION}.pc ]] ; then
+ local mver=${CC_COMP_VERSION:0:3}
+ for x in "" "-${mver}" ; do
+ x="${ROOT}/usr/lib/pkgconfig/libgcj${x}.pc"
+ rm -f "${x}"
+ ln -s libgcj-${CC_COMP_VERSION}.pc "${x}"
+ done
+ fi
+ fi
+
+ # We need to make sure that libgcc_s.so / libunwind.so make it into /lib.
+ # On many systems (x86/amd64/etc...), this will probably never matter,
+ # but on other systems (arm/mips/etc...), this is quite critical.
+ # http://bugs.gentoo.org/60190
+ #
+ # The funky move magic is required for proper updating of in-use files.
+ if ! is_cross_compiler ; then
+ # Need to cut out extra paths in multilib case and pray the first path
+ # is the "root" multilib path ... maybe some day change this to use
+ # `gcc -print-file-name` ...
+ LDPATH=${LDPATH%%:*}
+ for multilib in $("${ROOT}/${GCC_PATH}"/gcc -print-multi-lib); do
+ multiarg=${multilib#*;}
+ multiarg=${multiarg/@/-}
+ multilibdir=${multilib%;*}
+ libdir="lib/"$("${ROOT}/${GCC_PATH}"/gcc ${multiarg} -print-multi-os-directory)
+ if mkdir -p "${ROOT}/${libdir}"/.gcc.config.new ; then
+ for gcclib in gcc_s unwind ; do
+ if [[ -n $(ls "${ROOT}/${LDPATH}/${multilibdir}"/lib${gcclib}.so.* 2>/dev/null) ]]; then
+ cp -pP "${ROOT}/${LDPATH}/${multilibdir}"/lib${gcclib}.so.* "${ROOT}/${libdir}"/.gcc.config.new/
+ # no need to sanity remove this as the `mv` should take
+ # care of it. we also need this step to be completly atomic
+ # for systems that have even `mv` linked against libgcc_s.so.
+ # http://bugs.gentoo.org/150257
+ #rm -f "${ROOT}/${libdir}"/lib${gcclib}.so*
+ mv -f "${ROOT}/${libdir}"/.gcc.config.new/* "${ROOT}/${libdir}"/
+ fi
+ done
+ rmdir "${ROOT}/${libdir}"/.gcc.config.new
+ fi
+ done
+ unset multilib
+ unset multilibdir
+ unset multiarg
+ unset libdir
+ fi
+
+ if [[ ${ROOT} == "/" ]] && [[ ${OLD_CC_COMP} != ${CC_COMP} || ${FORCE} == "yes" ]] ; then
+ # in case python is broken ...
+ if ! env-update ; then
+ echo ""
+ ewarn "env-update failed to work properly; making sure ld.so.conf paths"
+ ewarn "are setup properly. Please rerun gcc-config with the -f option."
+ echo ""
+ grep -h ^LDPATH= "${ROOT}"/etc/env.d/05gcc-${CTARGET} \
+ | sed -e 's:^LDPATH=::' -e 's:"::g' -e 's|:|\n|g' \
+ >> /etc/ld.so.conf
+ ldconfig
+ fi
+ fi
+
+ eend 0
+
+ if [[ ${ROOT} == "/" ]] && [[ ${OLD_CC_COMP} != ${CC_COMP} ]] ; then
+ echo
+ ewarn "If you intend to use the gcc from the new profile in an already"
+ ewarn "running shell, please remember to do:"
+ echo
+ ewarn " . /etc/profile"
+ echo
+ fi
+
+ return 0
+}
+
+get_current_profile() {
+ local conf="${GCC_ENV_D}/config"
+ if [[ ! -f ${conf} ]] ; then
+ conf="${GCC_ENV_D}/config-${CTARGET}"
+ elif [[ -n ${CC_COMP} ]] && is_cross_compiler ; then
+ conf="${conf}-${CC_COMP}"
+ fi
+
+ if [[ ! -f ${conf} ]] ; then
+ eerror "${argv0}: No gcc profile is active!"
+ return 1
+ fi
+
+ CURRENT=$(source "${conf}"; echo ${CURRENT})
+
+ if [[ -z ${CURRENT} ]] ; then
+ eerror "${argv0}: No gcc profile is active!"
+ return 1
+ elif [[ ! -f ${GCC_ENV_D}/${CURRENT} ]] ; then
+ eerror "${argv0}: Active gcc profile is invalid!"
+ return 1
+ fi
+
+ echo "${CURRENT}"
+
+ return 0
+}
+
+list_profiles() {
+ local i=0
+ local filter=
+
+ if [[ ${ROOT} != "/" ]] ; then
+ echo "Using gcc-config info in ${ROOT}"
+ fi
+
+ if [[ ! -f ${GCC_ENV_D}/config-${CTARGET} ]] ; then
+ if ! is_cross_compiler && [[ -e ${GCC_ENV_D}/config ]] ; then
+ [[ -w ${GCC_ENV_D}/config ]] && mv ${GCC_ENV_D}/config ${GCC_ENV_D}/config-${CTARGET}
+ else
+ eerror "${argv0}: No gcc profile is active; please select one!"
+ filter=${CTARGET}
+ fi
+ fi
+
+ eval $(grep -s ^CURRENT= "${GCC_ENV_D}"/config-${CTARGET})
+ CURRENT_NATIVE=${CURRENT}
+ local target=
+ for x in "${GCC_ENV_D}"/* ; do
+ if [[ -f ${x} ]] && [[ ${x/\/config} == ${x} ]] ; then
+ CTARGET=$(unset CTARGET; source "${x}"; echo ${CTARGET})
+
+ ((++i))
+
+ [[ -n ${filter} ]] && [[ ${filter} != ${CTARGET:-${REAL_CHOST}} ]] && continue
+
+ if [[ ${target} != ${CTARGET} ]] ; then
+ [[ -n ${target} ]] && echo
+ target=${CTARGET}
+ CTARGET=""
+ fi
+
+ x=${x##*/}
+ if [[ ${x} == ${CURRENT_NATIVE} ]] ; then
+ x="${x} ${GOOD}*${NORMAL}"
+ elif [[ -e ${GCC_ENV_D}/config-${target} ]] ; then
+ source "${GCC_ENV_D}/config-${target}"
+ [[ ${x} == ${CURRENT} ]] && x="${x} ${HILITE}*${NORMAL}"
+ fi
+ echo " [${i}] ${x}"
+ fi
+ done
+}
+
+print_environ() {
+ local GCC_PATH=
+ local ENV_CMD=
+ local SET_ELEMENT=
+
+ GCC_PATH=$(source "${GCC_ENV_D}/${CC_COMP}"; echo ${GCC_PATH:-${PATH}})
+
+ case ${SHELL} in
+ */csh|*/tcsh)
+ ENV_CMD="setenv"
+ SET_ELEMENT=" "
+ ;;
+ *)
+ ENV_CMD="export"
+ SET_ELEMENT="="
+ ;;
+ esac
+
+ (
+ PATH=${GCC_PATH}:${PATH}
+ for var in PATH GCC_SPECS ; do
+ echo "${ENV_CMD} ${var}${SET_ELEMENT}\"${!var}\""
+ done
+ )
+}
+
+get_bin_path() {
+ if [[ -e ${GCC_ENV_D}/${CC_COMP} ]] ; then
+ (
+ unset PATH GCC_PATH
+ source "${GCC_ENV_D}/${CC_COMP}"
+ echo "${GCC_PATH:-${PATH}}"
+ )
+ else
+ echo "no-config"
+ echo "${GCC_ENV_D}/${CC_COMP} doesnt exist" 1>&2
+ fi
+
+ return 0
+}
+
+get_lib_path() {
+ if [[ -e ${GCC_ENV_D}/${CC_COMP} ]] ; then
+ (
+ unset LDPATH
+ source "${GCC_ENV_D}/${CC_COMP}"
+ echo "${LDPATH}"
+ )
+ else
+ echo "no-config"
+ echo "${GCC_ENV_D}/${CC_COMP} doesnt exist" 1>&2
+ fi
+
+ return 0
+}
+
+get_stdcxx_incdir() {
+ # XXX: we should prob scrub this ...
+ if [[ -e ${GCC_ENV_D}/${CC_COMP} ]] ; then
+ (
+ unset LDPATH STDCXX_INCDIR
+ source "${GCC_ENV_D}/${CC_COMP}"
+ echo "${LDPATH}/include/${STDCXX_INCDIR}"
+ )
+ else
+ echo "no-config"
+ echo "${GCC_ENV_D}/${CC_COMP} doesnt exist" 1>&2
+ fi
+
+ return 0
+}
+
+split_gcc_ver() {
+ # Split up the gcc profile into components:
+ # TARGET-VER[-specs] -> TARGET VER [specs]
+ # arm-linux-3.3.6 -> arm-linux 3.3.6
+ # x86_64-linux-4.0.1-pre1234 -> x86_64-linux 4.0.1-pre1234
+ # sh-linux-3.4.4-hardened -> sh-linux 3.4.4 hardened
+ #
+ # So below we will start at the end and run a small state machine ...
+ # specs [3]
+ # accept everything
+ # specs -> version transition [3->2]
+ # when we find a version component
+ # version [2]
+ # accept only version components (see the regex)
+ # version -> target transition [2->1]
+ # when we hit a non version component
+ # target [1]
+ # accept everything we have left
+ #
+ echo "$@" | awk -F- '
+ function pushit(onme, pushee) {
+ return (onme == "" ? pushee : pushee"-"onme);
+ }
+ {
+ state=3
+ targ=""
+ ver=""
+ spec=""
+ for (i=NF; i > 0; --i) {
+ if (state >= 2) {
+ if ($i ~ /^(alpha|beta|pre|rc|p)?[[:digit:].]+$/) {
+ ver=pushit(ver, $i)
+ state=2
+ } else if (state == 3)
+ spec=pushit(spec, $i)
+ else
+ state=1
+ }
+ if (state == 1)
+ targ = pushit(targ, $i)
+ }
+
+ if (targ == "") {
+ if (ver == "") {
+ ver=spec
+ spec=""
+ }
+ targ=ver
+ ver=""
+ }
+ print targ " " ver (spec != "" ? " " spec : "")
+ }'
+}
+chop_gcc_ver_spec() {
+ local splitTED=$(split_gcc_ver $@) # target ver spec
+ splitTED=${splitTED#* } # ver spec
+ echo ${splitTED/ /-} # ver-spec
+}
+
+SET_X=false
+NEED_ACTION="yes"
+DOIT="switch_profile"
+CHECK_CHOST="no"
+FORCE="no"
+
+CC_COMP=
+[[ -z ${ROOT} ]] && ROOT="/"
+[[ ${ROOT:0-1} != "/" ]] && ROOT="${ROOT}/"
+ENV_D="${ROOT}etc/env.d"
+GCC_ENV_D="${ENV_D}/gcc"
+
+for x in "$@" ; do
+ case "${x}" in
+ # Only use specified compiler if one is not already selected.
+ -O|--use-old)
+ CTARGET=${CTARGET:-$(try_real_hard_to_find_CHOST)}
+ if get_current_profile &>/dev/null ; then
+ CC_COMP=$(get_current_profile)
+ else
+ eerror "No profile selected, unable to utilize --use-old"
+ exit 1
+ fi
+ ;;
+ -f|--force)
+ FORCE="yes"
+ ;;
+ -P|--use-portage-chost)
+ CHECK_CHOST="yes"
+ ;;
+ -c|--get-current-profile)
+ if [[ ${NEED_ACTION} == "yes" ]] ; then
+ NEED_ACTION="no"
+ DOIT="get_current_profile"
+ fi
+ ;;
+ -l|--list-profiles)
+ if [[ ${NEED_ACTION} == "yes" ]] ; then
+ NEED_ACTION="no"
+ DOIT="list_profiles"
+ fi
+ ;;
+ -S|--split-profile)
+ if [[ ( $1 != "-S" && $1 != "--split-profile" ) || $# -eq 1 ]] ; then
+ usage 1
+ fi
+ shift # push -S out
+ for x in "$@" ; do
+ split_gcc_ver ${x}
+ done
+ exit 0
+ ;;
+ -E|--print-environ)
+ if [[ ${NEED_ACTION} == "yes" ]] ; then
+ NEED_ACTION="no"
+ DOIT="print_environ"
+ fi
+ ;;
+ -B|--get-bin-path)
+ if [[ ${NEED_ACTION} == "yes" ]] ; then
+ NEED_ACTION="no"
+ DOIT="get_bin_path"
+ fi
+ ;;
+ -L|--get-lib-path)
+ if [[ ${NEED_ACTION} == "yes" ]] ; then
+ NEED_ACTION="no"
+ DOIT="get_lib_path"
+ fi
+ ;;
+ -X|--get-stdcxx-incdir)
+ if [[ ${NEED_ACTION} == "yes" ]] ; then
+ NEED_ACTION="no"
+ DOIT="get_stdcxx_incdir"
+ fi
+ ;;
+ -x|--debug)
+ SET_X=true
+ ;;
+ -C|--nocolor)
+ # nothing to do; functions.sh parsed this for us
+ ;;
+ -h|--help)
+ usage 0
+ ;;
+ -V|--version)
+ rcsfile="$RCSfile: gcc-config-1.4.1,v $"
+ rcsfile=${rcsfile#: }
+ rcsfile=${rcsfile%,v*}
+ cvsrev="$Revision: 1.12 $"
+ cvsrev=${cvsrev#: }
+ cvsdate="$Date: 2011/12/07 05:42:19 $"
+ cvsdate=${cvsdate#: }
+ echo "${rcsfile} (r${cvsrev% *} @ ${cvsdate% *})"
+ exit 0
+ ;;
+ -*)
+ eerror "${argv0}: Invalid switch! Run ${argv0} without parameters for help."
+ exit 1
+ ;;
+ *)
+ ${SET_X} && set -x
+ if [[ -z ${CC_COMP} ]] ; then
+ if [[ -z $(echo ${x} | tr -d '[:digit:]') ]] ; then
+ # User gave us a # representing the profile
+ i=1
+ for y in "${GCC_ENV_D}"/* ; do
+ [[ -f ${y} ]] || continue
+ [[ ${y/\/config} != ${y} ]] && continue
+
+ if [[ -f ${y} ]] && [[ ${x} == ${i} ]] ; then
+ CC_COMP=${y##*/}
+ break
+ fi
+ ((++i))
+ done
+ else
+ # User gave us a full HOST-gccver
+ x=${x##*/}
+ if [[ ${DOIT} == "get_current_profile" && -z $(ls "${GCC_ENV_D}"/${x}-* 2>/dev/null) ]] || \
+ [[ ${DOIT} != "get_current_profile" && ! -f ${GCC_ENV_D}/${x} ]]
+ then
+ # Maybe they just gave us a gccver ...
+ get_real_chost
+ if [[ -f ${GCC_ENV_D}/${REAL_CHOST}-${x} ]] ; then
+ x=${REAL_CHOST}-${x}
+ else
+ eerror "${argv0}: Could not locate '$x' in '${GCC_ENV_D}/' !"
+ exit 1
+ fi
+ fi
+ CC_COMP=${x}
+ fi
+ else
+ eerror "${argv0}: Too many arguments! Run ${argv0} without parameters for help."
+ exit 1
+ fi
+ ;;
+ esac
+done
+
+${SET_X} && set -x
+
+get_real_chost
+[[ ${DOIT} == "get_current_profile" ]] \
+ && CTARGET=${CTARGET:-${CC_COMP:-${REAL_CHOST}}} \
+ || CTARGET=${CTARGET:-${REAL_CHOST}}
+
+if [[ ${DOIT} == "switch_profile" ]] && [[ -z ${CC_COMP} ]] ; then
+ usage 1
+fi
+
+if [[ -z ${CC_COMP} ]] ; then
+ CC_COMP=$(get_current_profile)
+ if [[ $? -ne 0 ]] ; then
+ echo "${CC_COMP}"
+ list_profiles
+ exit 1
+ fi
+fi
+
+if [[ ${DOIT} != "get_current_profile" ]] ; then
+ GCC_LIB=$(
+ LDPATH=$(source "${GCC_ENV_D}/${CC_COMP}"; echo ${LDPATH})
+ echo ${LDPATH} | awk -F/ '{ print "/"$2"/"$3"/"$4"/" }'
+ )
+
+ CC_COMP_VERSION=$(chop_gcc_ver_spec ${CC_COMP})
+ CC_COMP_TARGET=${CC_COMP%-${CC_COMP_VERSION}*}
+
+ if [[ ! -d ${ROOT}/${GCC_LIB}/${CC_COMP_TARGET}/${CC_COMP_VERSION} ]]; then
+ CC_COMP_VERSION=${CC_COMP_VERSION%-*}
+ fi
+
+ if [[ ! -d ${ROOT}/${GCC_LIB}/${CC_COMP_TARGET}/${CC_COMP_VERSION} ]] || \
+ [[ ! -f ${GCC_ENV_D}/${CC_COMP} ]]
+ then
+ eerror "${argv0}: Profile does not exist or invalid setting for ${GCC_ENV_D}/${CC_COMP}" 1>&2
+ #exit 1
+ fi
+fi
+
+if [[ ${CHECK_CHOST} == "yes" ]] ; then
+ # Chosen CHOST are not the same as the real CHOST according to
+ # make.conf, and --use-portage-chost option was given, so do nothing
+ get_real_chost
+ CC_COMP_VERSION=$(chop_gcc_ver_spec ${CC_COMP})
+ CC_COMP_TARGET=${CC_COMP:0:${#CC_COMP}-${#CC_COMP_VERSION}-1}
+ [[ ${CC_COMP_TARGET} != ${REAL_CHOST} ]] && exit 0
+fi
+
+eval ${DOIT}
+
+# vim:ts=4
diff --git a/sys-devel/gcc-config/files/gcc-config-1.5 b/sys-devel/gcc-config/files/gcc-config-1.5
new file mode 100755
index 000000000000..14aee7db8313
--- /dev/null
+++ b/sys-devel/gcc-config/files/gcc-config-1.5
@@ -0,0 +1,740 @@
+#!/bin/bash
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# Format of /etc/env.d/gcc/:
+# config-TARGET: CURRENT=version for TARGET
+# TARGET-VER: has a TARGET and VER variable
+
+: ${ROOT:=/}
+[[ ${ROOT} != */ ]] && ROOT="${ROOT}/"
+[[ ${ROOT} != /* ]] && ROOT="${PWD}${ROOT}"
+
+cd /
+
+trap ":" INT QUIT TSTP
+
+argv0=${0##*/}
+source /etc/init.d/functions.sh || {
+ echo "${argv0}: Could not source /etc/init.d/functions.sh!" 1>&2
+ exit 1
+}
+esyslog() { :; }
+umask 022
+
+die_eerror() {
+ eerror "${argv0}: $*"
+ exit 1
+}
+
+# *BSD are plain stupid ... copy a GNU extension but don't just copy it,
+# change it so it works differently. Wish Darwin did selective evolution
+# on software developers.
+SED=$(type -P gsed)
+: ${SED:=$(type -P sed)}
+
+# Further pain: `tac` is not available everywhere #390179
+if ! type -P tac >/dev/null ; then
+ tac() { ${SED} -e '1!G;h;$!d' "$@" ; }
+fi
+
+GENTOO_LIBDIR="@GENTOO_LIBDIR@"
+[[ ${GENTOO_LIBDIR} == @*@ ]] && GENTOO_LIBDIR="lib"
+
+usage() {
+cat << "USAGE_END"
+Usage: gcc-config [options] [CC Profile]
+Change the current cc/gcc profile, or give info about profiles.
+
+Options:
+ -C, --nocolor Disable color output
+ -O, --use-old Use the old profile if one was selected.
+ -f, --force Make sure all config files are regenerated.
+ -P, --use-portage-chost Only set to given profile if its CHOST is the
+ same as that set in /etc/portage/make.conf
+ (or one of other portage config files...).
+ -c, --get-current-profile Print current used gcc profile.
+ -l, --list-profiles Print a list of available profiles.
+ -S, --split-profile Split profiles into their components
+ -E, --print-environ Print environment that can be used to setup the
+ current gcc profile, or a specified one.
+ -B, --get-bin-path Print path where binaries of the given/current
+ profile are located.
+ -L, --get-lib-path Print path where libraries of the given/current
+ profile are located.
+
+Profile names are of the form: <CHOST>-<gcc version>
+For example: i686-pc-linux-gnu-3.2.1
+USAGE_END
+ exit ${1:-1}
+}
+[[ $# -lt 1 ]] && usage 1
+
+# Usage: source_var <var> <file> [default value]
+source_var() {
+ unset $1
+ local val=$(source "$2"; echo ${!1})
+ : ${val:=$3}
+ eval $1=\"${val}\"
+}
+show_var() {
+ source_var "$@"
+ echo "${!1}"
+}
+
+try_real_hard_to_find_CHOST() {
+ #
+ # First we read make.conf
+ #
+
+ local varname=${1:-CHOST}
+ local conf=${ROOT}/etc/portage/make.conf
+ if [[ ! -e ${conf} && -e ${ROOT}/etc/make.conf ]] ; then
+ conf=${ROOT}/etc/make.conf
+ fi
+ local ret=$(source "${conf}" 2>/dev/null ; echo ${!varname})
+ if [[ -z ${ret} ]] ; then
+ # newer portage supports spaces between the var and =
+ # CHOST = "this-is-retarded"
+ ret=$(eval $(
+ sed -n \
+ -e 's:[[:space:]]::g' \
+ -e "/^${varname}=/p" \
+ "${conf}"
+ ) ; echo ${!varname}
+ )
+ fi
+
+ if [[ -n ${ret} ]] ; then
+ echo ${ret}
+ return 0
+ fi
+
+ #
+ # Then we try /etc/env.d/gcc/config-${CTARGET}
+ #
+ if [[ -s ${ROOT}/etc/env.d/gcc/config-${CTARGET} ]] ; then
+ ret=$(split_gcc_ver $(show_var CURRENT "${ROOT}"/etc/env.d/gcc/config-${CTARGET}))
+ echo ${ret% *}
+ fi
+}
+
+get_real_chost() {
+ [[ -n ${REAL_CHOST} ]] && return 0
+
+ # shortcut for switching compilers in a cross chroot
+ if [[ -n ${CHOST} && ${ROOT} != "/" ]] ; then
+ REAL_CHOST=${CHOST}
+ return 0
+ fi
+
+ # make sure portage isnt broken
+ if python -V &>/dev/null ; then
+ export REAL_CHOST=$(env -i portageq envvar CHOST 2>/dev/null)
+ else
+ ewarn "Python seems to be broken, attempting to locate CHOST ourselves ..."
+ export REAL_CHOST=$(try_real_hard_to_find_CHOST)
+ fi
+
+ if [[ -z ${REAL_CHOST} ]] ; then
+ eerror "${argv0}: Could not get portage CHOST!"
+ eerror "${argv0}: You should verify that CHOST is set in one of these places:"
+ eerror "${argv0}: - ${ROOT}/etc/portage/make.conf"
+ eerror "${argv0}: - active environment"
+ exit 1
+ fi
+}
+
+is_cross_compiler() {
+ get_real_chost
+ [[ ${CC_COMP/${REAL_CHOST}} == ${CC_COMP} ]]
+}
+
+convert_profile_paths() {
+ # Older gcc's used PATH= and ROOTPATH= in the env.d files.
+ # Newer one's only use GCC_PATH=. Convert old to new here.
+ cp -p "${GCC_ENV_D}/${CC_COMP}" "${GCC_ENV_D}/${CC_COMP}.gcc-config-ref" || return 1
+ GCC_PATH=$(
+ unset GCC_PATH PATH ROOTPATH
+ source "${GCC_ENV_D}/${CC_COMP}"
+ echo ${GCC_PATH:-${PATH:-${ROOTPATH}}}
+ )
+ ${SED} -i \
+ -e '/^PATH=/d' \
+ -e '/^ROOTPATH=/d' \
+ -e '/^GCC_PATH=/d' \
+ "${GCC_ENV_D}/${CC_COMP}" || return 1
+ echo "GCC_PATH=\"${GCC_PATH}\"" >> "${GCC_ENV_D}/${CC_COMP}" || return 1
+ touch -r "${GCC_ENV_D}/${CC_COMP}.gcc-config-ref" "${GCC_ENV_D}/${CC_COMP}" || return 1
+ rm -f "${GCC_ENV_D}/${CC_COMP}.gcc-config-ref" || return 1
+ return 0
+}
+
+update_wrappers() {
+ local CTARGET=$1
+
+ # Find the bin wrapper
+ local wrapper
+ for wrapper in ${GENTOO_LIBDIR} lib lib64 lib32 lib ; do
+ wrapper="${ROOT}usr/${wrapper}/misc/gcc-config"
+ [[ -e ${wrapper} ]] && break
+ done
+
+ # Update the wrappers for this profile. We maintain this list
+ # by hand as the tools that are available can come & go if the
+ # user re-emerges gcc with dif USE flags. We need to clean out
+ # the old wrappers if the functionality no longer exists.
+ # XXX: Future work: save the list of wrappers we generated in
+ # the generated env.d file so we can scrub things better.
+ # After that, we can use a dynamic list based on what tools are
+ # actually available in ${GCC_PATH}/.
+ for x in {,${CTARGET}-}{cpp,cc,gcc,c++,g++,f77,g77,gcj,gcjh,gcov,gdc,gdmd,gfortran,gccgo} ; do
+ # Obviously don't want to touch native stuff for cross-compilers
+ [[ ${x} != ${CTARGET}-* ]] && is_cross_compiler && continue
+
+ # Make sure we have no stale wrappers
+ rm -f "${ROOT}/usr/bin/${x}"
+ [[ ${x:${#x}-3} == "gcc" || ${x:${#x}-3} == "g++" ]] \
+ && rm -f "${ROOT}/usr/bin/${x}"{32,64}
+
+ # Only install a wrapper if the binary exists ...
+ # We want to figure out the 'reference file' for each
+ # wrapper (the binary we're 'wrapping') so that we can
+ # sync mtimes together. This makes things like ccache
+ # happy. See Bug #70548 for more info.
+ local ref
+ case ${x} in
+ cc) ref=gcc;;
+ f77) ref=g77;;
+ *) ref=${x};;
+ esac
+ ref="${ROOT}/${GCC_PATH}/${ref}"
+ if [[ -x ${ref} ]] ; then
+ cp -f "${wrapper}" "${ROOT}/usr/bin/${x}"
+ touch -r "${ref}" "${ROOT}/usr/bin/${x}"
+ fi
+ done
+ # legacy cruft, make sure we dont leave it laying around #143205
+ rm -f "${ROOT}/usr/bin/${CTARGET}-cc"
+
+ # install the canonical cpp wrapper
+ [[ ${CTARGET} == *-solaris* ]] && return 0
+ if ! is_cross_compiler ; then
+ cp -f "${wrapper}" "${ROOT}/lib/cpp"
+ touch -r "${ROOT}/usr/bin/${CTARGET}-cpp" "${ROOT}/lib/cpp"
+ fi
+}
+
+mv_if_diff() {
+ if cmp -s "$1" "$2" ; then
+ rm -f "$1"
+ return 0
+ else
+ mv -f "$1" "$2"
+ return 1
+ fi
+}
+
+switch_profile() {
+ local MY_LDPATH=
+ local GCC_PROFILES=
+ local OLD_CC_COMP=
+ local GCC_PATH=
+
+ [[ $(id -u) != "0" ]] && die_eerror "Must be root"
+
+ if is_cross_compiler ; then
+ ebegin "Switching cross-compiler to ${CC_COMP}"
+ else
+ ebegin "Switching native-compiler to ${CC_COMP}"
+ fi
+
+ if egrep -q '^(PATH|ROOTPATH)=' "${GCC_ENV_D}/${CC_COMP}" ; then
+ convert_profile_paths "${GCC_ENV_D}/${CC_COMP}" || return 1
+ fi
+ source_var GCC_PATH "${GCC_ENV_D}/${CC_COMP}"
+
+ # Setup things properly again for this profile
+ unset GCC_SPECS LDPATH
+ source "${GCC_ENV_D}/${CC_COMP}"
+ # Ignore active profile errors here since we're switching away
+ OLD_CC_COMP=$(get_current_profile 2>/dev/null)
+
+ # GCC_SPECS have long been stable, and people messing with
+ # them know better than to install bad paths, so don't bother
+ # with sanity checks.
+ local envd="${ENV_D}/05gcc-${CTARGET}"
+ cat <<-EOF > "${envd}.tmp"
+ PATH="${GCC_PATH}"
+ ROOTPATH="${GCC_PATH}"
+ GCC_SPECS="${GCC_SPECS}"
+ EOF
+ echo "CURRENT=${CC_COMP}" > "${GCC_ENV_D}/config-${CTARGET}"
+ if ! is_cross_compiler ; then
+ # Order our profiles to have the default first ...
+ # We do this so that we can have them ordered with default
+ # first in /etc/ld.so.conf, as the logical is that all
+ # compilers for default CHOST will be used to compile stuff,
+ # and thus we want all their lib paths in /etc/ld.so.conf ...
+ get_real_chost
+ MY_LDPATH=$(${SED} -n \
+ -e '/^LDPATH=/{s|LDPATH=||;s|"||g;s|:|\n|g;p}' \
+ "${GCC_ENV_D}"/${REAL_CHOST}-* \
+ "${GCC_ENV_D}"/${CC_COMP} | tac
+ )
+
+ # Pass all by default
+ awk '!/^(STDCXX_INCDIR|LDPATH|CC|CXX|CTARGET|GCCBITS|GCC_SPECS|GCC_PATH)=/ {print $0}' \
+ "${GCC_ENV_D}/${CC_COMP}" >> "${envd}.tmp"
+ if [[ -d ${ROOT}/etc/ld.so.conf.d ]] ; then
+ echo "${MY_LDPATH}" > "${ROOT}"/etc/ld.so.conf.d/05gcc-${CTARGET}.conf
+ else
+ echo "LDPATH=\"${MY_LDPATH}\"" >> "${envd}.tmp"
+ fi
+
+ # Punt old files; maybe globs too much, but oh well
+ rm -f \
+ "${GCC_ENV_D}/NATIVE" "${GCC_ENV_D}/.NATIVE" \
+ "${ENV_D}/05gcc" "${GCC_ENV_D}/config" \
+ "${ENV_D}/05gcc-${CTARGET}"-* "${GCC_ENV_D}/config-${CTARGET}"-*
+
+ # Help out the gcc wrapper
+ ln -sf ${CC_COMP} "${GCC_ENV_D}/.NATIVE"
+
+
+ # Relocate random crap
+ if [[ -e ${ROOT}/usr/${GENTOO_LIBDIR}/pkgconfig/libgcj-${CC_COMP_VERSION}.pc ]] ; then
+ local mver=${CC_COMP_VERSION:0:3}
+ for x in "" "-${mver}" ; do
+ x="${ROOT}/usr/lib/pkgconfig/libgcj${x}.pc"
+ rm -f "${x}"
+ ln -s libgcj-${CC_COMP_VERSION}.pc "${x}"
+ done
+ fi
+
+ # We need to make sure that libgcc_s.so / libunwind.so make it into /lib.
+ # On many systems (x86/amd64/etc...), this will probably never matter,
+ # but on other systems (arm/mips/etc...), this is quite critical.
+ # http://bugs.gentoo.org/60190
+ #
+ # The funky move magic is required for proper updating of in-use files.
+ #
+ # Need to cut out extra paths in multilib case and pray the first path
+ # is the "root" multilib path ... maybe some day change this to use
+ # `gcc -print-file-name` ...
+ LDPATH=${LDPATH%%:*}
+ for multilib in $("${ROOT}/${GCC_PATH}"/gcc -print-multi-lib); do
+ multiarg=${multilib#*;}
+ multiarg=${multiarg/@/-}
+ multilibdir=${multilib%;*}
+ libdir="lib/"$("${ROOT}/${GCC_PATH}"/gcc ${multiarg} -print-multi-os-directory)
+ if mkdir -p "${ROOT}/${libdir}"/.gcc.config.new ; then
+ for gcclib in gcc_s unwind ; do
+ if [[ -n $(ls "${ROOT}/${LDPATH}/${multilibdir}"/lib${gcclib}.so.* 2>/dev/null) ]]; then
+ cp -pP "${ROOT}/${LDPATH}/${multilibdir}"/lib${gcclib}.so.* "${ROOT}/${libdir}"/.gcc.config.new/
+ # no need to sanity remove this as the `mv` should take
+ # care of it. we also need this step to be completly atomic
+ # for systems that have even `mv` linked against libgcc_s.so.
+ # http://bugs.gentoo.org/150257
+ #rm -f "${ROOT}/${libdir}"/lib${gcclib}.so*
+ mv -f "${ROOT}/${libdir}"/.gcc.config.new/* "${ROOT}/${libdir}"/
+ fi
+ done
+ rmdir "${ROOT}/${libdir}"/.gcc.config.new
+ fi
+ done
+ unset multilib
+ unset multilibdir
+ unset multiarg
+ unset libdir
+ fi
+ mv_if_diff "${envd}.tmp" "${envd}"
+ local envd_changed=$?
+
+ update_wrappers ${CTARGET}
+
+ if [[ ${ROOT} == "/" ]] && \
+ [[ ${OLD_CC_COMP} != ${CC_COMP} || ${FORCE} == "yes" ]] && \
+ [[ ${envd_changed} -eq 1 ]]
+ then
+ # in case python is broken ...
+ if ! env-update ; then
+ echo ""
+ ewarn "env-update failed to work properly; making sure ld.so.conf paths"
+ ewarn "are setup properly. Please rerun gcc-config with the -f option."
+ echo ""
+ if [[ ! -d /etc/ld.so.conf.d ]] ; then
+ show_var LDPATH "${ROOT}"/etc/env.d/05gcc-${CTARGET} \
+ | sed -e 's|:|\n|g' >> /etc/ld.so.conf
+ fi
+ ldconfig
+ fi
+ else
+ envd_changed=0
+ fi
+
+ eend 0
+
+ if [[ ${envd_changed} -ne 0 ]] ; then
+ echo
+ ewarn "If you intend to use the gcc from the new profile in an already"
+ ewarn "running shell, please remember to do:"
+ echo
+ ewarn " . /etc/profile"
+ echo
+ fi
+
+ return 0
+}
+
+get_current_profile() {
+ local conf="${GCC_ENV_D}/config-${CTARGET}"
+ if [[ ! -f ${conf} ]] ; then
+ conf="${GCC_ENV_D}/config" # old name
+ elif [[ -n ${CC_COMP} ]] && is_cross_compiler ; then
+ conf="${conf}-${CC_COMP}"
+ fi
+
+ if [[ ! -f ${conf} ]] ; then
+ eerror "${argv0}: No gcc profile is active!"
+ return 1
+ fi
+
+ source_var CURRENT "${conf}"
+
+ if [[ -z ${CURRENT} ]] ; then
+ eerror "${argv0}: No gcc profile is active!"
+ return 1
+ elif [[ ! -f ${GCC_ENV_D}/${CURRENT} ]] ; then
+ eerror "${argv0}: Active gcc profile is invalid!"
+ return 1
+ fi
+
+ echo "${CURRENT}"
+
+ return 0
+}
+
+list_profiles() {
+ local i=0
+ local filter=
+
+ if [[ ${ROOT} != "/" ]] ; then
+ echo "Using gcc-config info in ${ROOT}"
+ fi
+
+ if [[ ! -f ${GCC_ENV_D}/config-${CTARGET} ]] ; then
+ if ! is_cross_compiler && [[ -e ${GCC_ENV_D}/config ]] ; then
+ [[ -w ${GCC_ENV_D}/config ]] && mv ${GCC_ENV_D}/config ${GCC_ENV_D}/config-${CTARGET}
+ else
+ # get_current_profile already warns
+ #eerror "${argv0}: No gcc profile is active; please select one!"
+ filter=${CTARGET}
+ fi
+ fi
+
+ source_var CURRENT "${GCC_ENV_D}"/config-${CTARGET}
+ CURRENT_NATIVE=${CURRENT}
+ local target=
+ for x in "${GCC_ENV_D}"/* ; do
+ [[ -f ${x} ]] || continue
+ [[ ${x} == */config* ]] && continue
+
+ source_var CTARGET "${x}"
+
+ ((++i))
+
+ [[ -n ${filter} ]] && [[ ${filter} != ${CTARGET} ]] && continue
+
+ if [[ ${target} != ${CTARGET} ]] ; then
+ [[ ${i} -gt 1 ]] && echo
+ target=${CTARGET}
+ CTARGET=""
+ fi
+
+ x=${x##*/}
+ if [[ ${x} == ${CURRENT_NATIVE} ]] ; then
+ x="${x} ${GOOD}*${NORMAL}"
+ elif [[ -e ${GCC_ENV_D}/config-${target} ]] ; then
+ source "${GCC_ENV_D}/config-${target}"
+ [[ ${x} == ${CURRENT} ]] && x="${x} ${HILITE}*${NORMAL}"
+ fi
+ echo " [${i}] ${x}"
+ done
+}
+
+print_environ() {
+ local GCC_PATH=
+ local ENV_CMD=
+ local SET_ELEMENT=
+
+ source_var GCC_PATH "${GCC_ENV_D}/${CC_COMP}" "${PATH}"
+
+ case ${SHELL} in
+ */csh|*/tcsh)
+ ENV_CMD="setenv"
+ SET_ELEMENT=" "
+ ;;
+ *)
+ ENV_CMD="export"
+ SET_ELEMENT="="
+ ;;
+ esac
+
+ (
+ PATH=${GCC_PATH}:${PATH}
+ for var in PATH GCC_SPECS ; do
+ echo "${ENV_CMD} ${var}${SET_ELEMENT}\"${!var}\""
+ done
+ )
+}
+
+get_bin_path() { show_var GCC_PATH "${GCC_ENV_D}/${CC_COMP}" ; }
+get_lib_path() { show_var LDPATH "${GCC_ENV_D}/${CC_COMP}" ; }
+
+split_gcc_ver() {
+ # Split up the gcc profile into components:
+ # TARGET-VER[-specs] -> TARGET VER [specs]
+ # arm-linux-3.3.6 -> arm-linux 3.3.6
+ # x86_64-linux-4.0.1-pre1234 -> x86_64-linux 4.0.1-pre1234
+ # sh-linux-3.4.4-hardened -> sh-linux 3.4.4 hardened
+ #
+ # So below we will start at the end and run a small state machine ...
+ # specs [3]
+ # accept everything
+ # specs -> version transition [3->2]
+ # when we find a version component
+ # version [2]
+ # accept only version components (see the regex)
+ # version -> target transition [2->1]
+ # when we hit a non version component
+ # target [1]
+ # accept everything we have left
+ #
+ echo "$@" | awk -F- '
+ function pushit(onme, pushee) {
+ return (onme == "" ? pushee : pushee"-"onme);
+ }
+ {
+ state=3
+ targ=""
+ ver=""
+ spec=""
+ for (i=NF; i > 0; --i) {
+ if (state >= 2) {
+ if ($i ~ /^(alpha|beta|pre|rc|p)?[[:digit:].]+$/) {
+ ver=pushit(ver, $i)
+ state=2
+ } else if (state == 3)
+ spec=pushit(spec, $i)
+ else
+ state=1
+ }
+ if (state == 1)
+ targ = pushit(targ, $i)
+ }
+
+ if (targ == "") {
+ if (ver == "") {
+ ver=spec
+ spec=""
+ }
+ targ=ver
+ ver=""
+ }
+ print targ " " ver (spec != "" ? " " spec : "")
+ }'
+}
+chop_gcc_ver_spec() {
+ local splitTED=$(split_gcc_ver $@) # target ver spec
+ splitTED=${splitTED#* } # ver spec
+ echo ${splitTED/ /-} # ver-spec
+}
+
+SET_X=false
+NEED_ACTION="yes"
+DOIT="switch_profile"
+CHECK_CHOST="no"
+FORCE="no"
+
+CC_COMP=
+ENV_D="${ROOT}etc/env.d"
+GCC_ENV_D="${ENV_D}/gcc"
+
+for x in "$@" ; do
+ case "${x}" in
+ # Only use specified compiler if one is not already selected.
+ -O|--use-old)
+ : ${CTARGET:=$(try_real_hard_to_find_CHOST)}
+ if get_current_profile &>/dev/null ; then
+ CC_COMP=$(get_current_profile)
+ else
+ die_eerror "No profile selected, unable to utilize --use-old"
+ fi
+ ;;
+ -f|--force)
+ FORCE="yes"
+ ;;
+ -P|--use-portage-chost)
+ CHECK_CHOST="yes"
+ ;;
+ -c|--get-current-profile)
+ if [[ ${NEED_ACTION} == "yes" ]] ; then
+ NEED_ACTION="no"
+ DOIT="get_current_profile"
+ fi
+ ;;
+ -l|--list-profiles)
+ if [[ ${NEED_ACTION} == "yes" ]] ; then
+ NEED_ACTION="no"
+ DOIT="list_profiles"
+ fi
+ ;;
+ -S|--split-profile)
+ if [[ ( $1 != "-S" && $1 != "--split-profile" ) || $# -eq 1 ]] ; then
+ usage 1
+ fi
+ shift # push -S out
+ for x in "$@" ; do
+ split_gcc_ver ${x}
+ done
+ exit 0
+ ;;
+ -E|--print-environ)
+ if [[ ${NEED_ACTION} == "yes" ]] ; then
+ NEED_ACTION="no"
+ DOIT="print_environ"
+ fi
+ ;;
+ -B|--get-bin-path)
+ if [[ ${NEED_ACTION} == "yes" ]] ; then
+ NEED_ACTION="no"
+ DOIT="get_bin_path"
+ fi
+ ;;
+ -L|--get-lib-path)
+ if [[ ${NEED_ACTION} == "yes" ]] ; then
+ NEED_ACTION="no"
+ DOIT="get_lib_path"
+ fi
+ ;;
+ -x|--debug)
+ SET_X=true
+ ;;
+ -C|--nocolor)
+ # nothing to do; functions.sh parsed this for us
+ ;;
+ -h|--help)
+ usage 0
+ ;;
+ -V|--version)
+ unset RCSfile Revision Date
+ rcsfile="$RCSfile: gcc-config-1.5,v $"
+ rcsfile=${rcsfile#: }
+ rcsfile=${rcsfile%,v*}
+ cvsrev="$Revision: 1.7 $"
+ cvsrev=${cvsrev#: }
+ cvsdate="$Date: 2011/12/07 05:42:19 $"
+ cvsdate=${cvsdate#: }
+ echo "${rcsfile} (r${cvsrev% *} @ ${cvsdate% *})"
+ exit 0
+ ;;
+ -*)
+ die_eerror "Invalid switch! Run ${argv0} without parameters for help."
+ ;;
+ *)
+ ${SET_X} && set -x
+ if [[ -z ${CC_COMP} ]] ; then
+ if [[ -z $(echo ${x} | tr -d '[:digit:]') ]] ; then
+ # User gave us a # representing the profile
+ i=1
+ for y in "${GCC_ENV_D}"/* ; do
+ [[ -f ${y} ]] || continue
+ [[ ${y} == */config* ]] && continue
+
+ if [[ -f ${y} ]] && [[ ${x} == ${i} ]] ; then
+ CC_COMP=${y##*/}
+ break
+ fi
+ ((++i))
+ done
+ if [[ -z ${CC_COMP} ]] ; then
+ die_eerror "Could not locate profile #$x !"
+ fi
+ else
+ # User gave us a full HOST-gccver
+ x=${x##*/}
+ if [[ ${DOIT} == "get_current_profile" && -z $(ls "${GCC_ENV_D}"/${x}-* 2>/dev/null) ]] || \
+ [[ ${DOIT} != "get_current_profile" && ! -f ${GCC_ENV_D}/${x} ]]
+ then
+ # Maybe they just gave us a gccver ...
+ get_real_chost
+ if [[ -f ${GCC_ENV_D}/${REAL_CHOST}-${x} ]] ; then
+ x=${REAL_CHOST}-${x}
+ else
+ die_eerror "Could not locate '$x' in '${GCC_ENV_D}/' !"
+ fi
+ fi
+ CC_COMP=${x}
+ fi
+ else
+ die_eerror "Too many arguments! Run ${argv0} without parameters for help."
+ fi
+ ;;
+ esac
+done
+
+${SET_X} && set -x
+
+if [[ ${DOIT} == "switch_profile" ]] && [[ -z ${CC_COMP} ]] ; then
+ usage 1
+fi
+
+get_real_chost
+[[ ${DOIT} == "get_current_profile" ]] \
+ && : ${CTARGET:=${CC_COMP:-${REAL_CHOST}}} \
+ || : ${CTARGET:=${REAL_CHOST}}
+
+if [[ -z ${CC_COMP} ]] ; then
+ CC_COMP=$(get_current_profile)
+ if [[ $? -ne 0 ]] ; then
+ echo "${CC_COMP}"
+ list_profiles
+ exit 1
+ fi
+fi
+
+if [[ ${DOIT} != "get_current_profile" ]] ; then
+ GCC_LIB=$(
+ show_var LDPATH "${GCC_ENV_D}/${CC_COMP}" | \
+ awk -F/ '{ print "/"$2"/"$3"/"$4"/" }'
+ )
+
+ CC_COMP_VERSION=$(chop_gcc_ver_spec ${CC_COMP})
+ CC_COMP_TARGET=${CC_COMP%-${CC_COMP_VERSION}*}
+
+ if [[ ! -d ${ROOT}/${GCC_LIB}/${CC_COMP_TARGET}/${CC_COMP_VERSION} ]]; then
+ CC_COMP_VERSION=${CC_COMP_VERSION%-*}
+ fi
+
+ if [[ ! -d ${ROOT}/${GCC_LIB}/${CC_COMP_TARGET}/${CC_COMP_VERSION} ]] || \
+ [[ ! -f ${GCC_ENV_D}/${CC_COMP} ]]
+ then
+ eerror "${argv0}: Profile does not exist or invalid setting for ${GCC_ENV_D}/${CC_COMP}" 1>&2
+ #exit 1
+ fi
+fi
+
+if [[ ${CHECK_CHOST} == "yes" ]] ; then
+ # Chosen CHOST are not the same as the real CHOST according to
+ # make.conf, and --use-portage-chost option was given, so do nothing
+ get_real_chost
+ CC_COMP_VERSION=$(chop_gcc_ver_spec ${CC_COMP})
+ CC_COMP_TARGET=${CC_COMP:0:${#CC_COMP}-${#CC_COMP_VERSION}-1}
+ [[ ${CC_COMP_TARGET} != ${REAL_CHOST} ]] && exit 0
+fi
+
+${DOIT}
+
+# vim:ts=4
diff --git a/sys-devel/gcc-config/files/gcc-config-1.5.1 b/sys-devel/gcc-config/files/gcc-config-1.5.1
new file mode 100755
index 000000000000..2b345076df3e
--- /dev/null
+++ b/sys-devel/gcc-config/files/gcc-config-1.5.1
@@ -0,0 +1,763 @@
+#!/bin/bash
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# Format of /etc/env.d/gcc/:
+# config-TARGET: CURRENT=version for TARGET
+# TARGET-VER: has a TARGET and VER variable
+
+: ${ROOT:=/}
+[[ ${ROOT} != */ ]] && ROOT="${ROOT}/"
+[[ ${ROOT} != /* ]] && ROOT="${PWD}${ROOT}"
+
+cd /
+
+trap ":" INT QUIT TSTP
+
+argv0=${0##*/}
+source /etc/init.d/functions.sh || {
+ echo "${argv0}: Could not source /etc/init.d/functions.sh!" 1>&2
+ exit 1
+}
+esyslog() { :; }
+umask 022
+
+die_eerror() {
+ eerror "${argv0}: $*"
+ exit 1
+}
+
+# *BSD are plain stupid ... copy a GNU extension but don't just copy it,
+# change it so it works differently. Wish Darwin did selective evolution
+# on software developers.
+SED=$(type -P gsed)
+: ${SED:=$(type -P sed)}
+
+# Further pain: `tac` is not available everywhere #390179
+if ! type -P tac >/dev/null ; then
+ tac() { ${SED} -e '1!G;h;$!d' "$@" ; }
+fi
+
+GENTOO_LIBDIR="@GENTOO_LIBDIR@"
+[[ ${GENTOO_LIBDIR} == @*@ ]] && GENTOO_LIBDIR="lib"
+
+usage() {
+cat << "USAGE_END"
+Usage: gcc-config [options] [CC Profile]
+Change the current cc/gcc profile, or give info about profiles.
+
+Options:
+ -C, --nocolor Disable color output
+ -O, --use-old Use the old profile if one was selected.
+ -f, --force Make sure all config files are regenerated.
+ -P, --use-portage-chost Only set to given profile if its CHOST is the
+ same as that set in /etc/portage/make.conf
+ (or one of other portage config files...).
+ -c, --get-current-profile Print current used gcc profile.
+ -l, --list-profiles Print a list of available profiles.
+ -S, --split-profile Split profiles into their components
+ -E, --print-environ Print environment that can be used to setup the
+ current gcc profile, or a specified one.
+ -B, --get-bin-path Print path where binaries of the given/current
+ profile are located.
+ -L, --get-lib-path Print path where libraries of the given/current
+ profile are located.
+
+Profile names are of the form: <CHOST>-<gcc version>
+For example: i686-pc-linux-gnu-3.2.1
+USAGE_END
+ exit ${1:-1}
+}
+[[ $# -lt 1 ]] && usage 1
+
+# Usage: source_var <var> <file> [default value]
+source_var() {
+ unset $1
+ local val=$(source "$2"; echo "${!1}")
+ : ${val:=$3}
+ eval $1=\"${val}\"
+}
+show_var() {
+ source_var "$@"
+ echo "${!1}"
+}
+
+try_real_hard_to_find_CHOST() {
+ #
+ # First we read make.conf
+ #
+
+ local varname=${1:-CHOST}
+ local conf=${ROOT}/etc/portage/make.conf
+ if [[ ! -e ${conf} && -e ${ROOT}/etc/make.conf ]] ; then
+ conf=${ROOT}/etc/make.conf
+ fi
+ local ret=$(source "${conf}" 2>/dev/null ; echo ${!varname})
+ if [[ -z ${ret} ]] ; then
+ # newer portage supports spaces between the var and =
+ # CHOST = "this-is-retarded"
+ ret=$(eval $(
+ sed -n \
+ -e 's:[[:space:]]::g' \
+ -e "/^${varname}=/p" \
+ "${conf}"
+ ) ; echo ${!varname}
+ )
+ fi
+
+ if [[ -n ${ret} ]] ; then
+ echo ${ret}
+ return 0
+ fi
+
+ #
+ # Then we try /etc/env.d/gcc/config-${CTARGET}
+ #
+ if [[ -s ${ROOT}/etc/env.d/gcc/config-${CTARGET} ]] ; then
+ ret=$(split_gcc_ver $(show_var CURRENT "${ROOT}"/etc/env.d/gcc/config-${CTARGET}))
+ echo ${ret% *}
+ fi
+}
+
+get_real_chost() {
+ [[ -n ${REAL_CHOST} ]] && return 0
+
+ # shortcut for switching compilers in a cross chroot
+ if [[ -n ${CHOST} && ${ROOT} != "/" ]] ; then
+ REAL_CHOST=${CHOST}
+ return 0
+ fi
+
+ # make sure portage isnt broken
+ if python -V &>/dev/null ; then
+ export REAL_CHOST=$(env -i portageq envvar CHOST 2>/dev/null)
+ else
+ ewarn "Python seems to be broken, attempting to locate CHOST ourselves ..."
+ export REAL_CHOST=$(try_real_hard_to_find_CHOST)
+ fi
+
+ if [[ -z ${REAL_CHOST} ]] ; then
+ eerror "${argv0}: Could not get portage CHOST!"
+ eerror "${argv0}: You should verify that CHOST is set in one of these places:"
+ eerror "${argv0}: - ${ROOT}/etc/portage/make.conf"
+ eerror "${argv0}: - active environment"
+ exit 1
+ fi
+}
+
+is_cross_compiler() {
+ get_real_chost
+ [[ ${CC_COMP/${REAL_CHOST}} == ${CC_COMP} ]]
+}
+
+convert_profile_paths() {
+ # Older gcc's used PATH= and ROOTPATH= in the env.d files.
+ # Newer one's only use GCC_PATH=. Convert old to new here.
+ cp -p "${GCC_ENV_D}/${CC_COMP}" "${GCC_ENV_D}/${CC_COMP}.gcc-config-ref" || return 1
+ GCC_PATH=$(
+ unset GCC_PATH PATH ROOTPATH
+ source "${GCC_ENV_D}/${CC_COMP}"
+ echo ${GCC_PATH:-${PATH:-${ROOTPATH}}}
+ )
+ ${SED} -i \
+ -e '/^PATH=/d' \
+ -e '/^ROOTPATH=/d' \
+ -e '/^GCC_PATH=/d' \
+ "${GCC_ENV_D}/${CC_COMP}" || return 1
+ echo "GCC_PATH=\"${GCC_PATH}\"" >> "${GCC_ENV_D}/${CC_COMP}" || return 1
+ touch -r "${GCC_ENV_D}/${CC_COMP}.gcc-config-ref" "${GCC_ENV_D}/${CC_COMP}" || return 1
+ rm -f "${GCC_ENV_D}/${CC_COMP}.gcc-config-ref" || return 1
+ return 0
+}
+
+update_wrappers() {
+ local CTARGET=$1
+
+ # Find the bin wrapper
+ local wrapper
+ for wrapper in ${GENTOO_LIBDIR} lib lib64 lib32 lib ; do
+ wrapper="${ROOT}usr/${wrapper}/misc/gcc-config"
+ [[ -e ${wrapper} ]] && break
+ done
+
+ # Update the wrappers for this profile. We maintain this list
+ # by hand as the tools that are available can come & go if the
+ # user re-emerges gcc with dif USE flags. We need to clean out
+ # the old wrappers if the functionality no longer exists.
+ # XXX: Future work: save the list of wrappers we generated in
+ # the generated env.d file so we can scrub things better.
+ # After that, we can use a dynamic list based on what tools are
+ # actually available in ${GCC_PATH}/.
+ for x in {,${CTARGET}-}{cpp,cc,gcc,c++,g++,f77,g77,gcj,gcjh,gcov,gdc,gdmd,gfortran,gccgo} ; do
+ # Obviously don't want to touch native stuff for cross-compilers
+ [[ ${x} != ${CTARGET}-* ]] && is_cross_compiler && continue
+
+ # Make sure we have no stale wrappers
+ rm -f "${ROOT}/usr/bin/${x}"
+ [[ ${x:${#x}-3} == "gcc" || ${x:${#x}-3} == "g++" ]] \
+ && rm -f "${ROOT}/usr/bin/${x}"{32,64}
+
+ # Only install a wrapper if the binary exists ...
+ # We want to figure out the 'reference file' for each
+ # wrapper (the binary we're 'wrapping') so that we can
+ # sync mtimes together. This makes things like ccache
+ # happy. See Bug #70548 for more info.
+ local ref
+ case ${x} in
+ cc) ref=gcc;;
+ f77) ref=g77;;
+ *) ref=${x};;
+ esac
+ ref="${ROOT}/${GCC_PATH}/${ref}"
+ if [[ -x ${ref} ]] ; then
+ cp -f "${wrapper}" "${ROOT}/usr/bin/${x}"
+ touch -r "${ref}" "${ROOT}/usr/bin/${x}"
+ fi
+ done
+ # legacy cruft, make sure we dont leave it laying around #143205
+ rm -f "${ROOT}/usr/bin/${CTARGET}-cc"
+
+ # install the canonical cpp wrapper
+ [[ ${CTARGET} == *-solaris* ]] && return 0
+ if ! is_cross_compiler ; then
+ cp -f "${wrapper}" "${ROOT}/lib/cpp"
+ touch -r "${ROOT}/usr/bin/${CTARGET}-cpp" "${ROOT}/lib/cpp"
+ fi
+}
+
+mv_if_diff() {
+ if cmp -s "$1" "$2" ; then
+ rm -f "$1"
+ return 0
+ else
+ mv -f "$1" "$2"
+ return 1
+ fi
+}
+
+switch_profile() {
+ local GCC_PROFILES=
+ local OLD_CC_COMP=
+ local GCC_PATH=
+
+ [[ $(id -u) != "0" ]] && die_eerror "Must be root"
+
+ if is_cross_compiler ; then
+ ebegin "Switching cross-compiler to ${CC_COMP}"
+ else
+ ebegin "Switching native-compiler to ${CC_COMP}"
+ fi
+
+ if egrep -q '^(PATH|ROOTPATH)=' "${GCC_ENV_D}/${CC_COMP}" ; then
+ convert_profile_paths "${GCC_ENV_D}/${CC_COMP}" || return 1
+ fi
+ source_var GCC_PATH "${GCC_ENV_D}/${CC_COMP}"
+
+ # Setup things properly again for this profile
+ unset GCC_SPECS LDPATH
+ source "${GCC_ENV_D}/${CC_COMP}"
+ # Ignore active profile errors here since we're switching away
+ OLD_CC_COMP=$(get_current_profile 2>/dev/null)
+
+ # GCC_SPECS have long been stable, and people messing with
+ # them know better than to install bad paths, so don't bother
+ # with sanity checks.
+ local envd="${ENV_D}/05gcc-${CTARGET}"
+ cat <<-EOF > "${envd}.tmp"
+ PATH="${GCC_PATH}"
+ ROOTPATH="${GCC_PATH}"
+ GCC_SPECS="${GCC_SPECS}"
+ EOF
+ echo "CURRENT=${CC_COMP}" > "${GCC_ENV_D}/config-${CTARGET}"
+ if ! is_cross_compiler ; then
+ # Regardless of the profile selected, keep the runtime lookup
+ # paths stable. Otherwise, all the apps that were built with
+ # a new compiler will start trying to use older versions of
+ # the libs, and life gets sad. We work off the assumption
+ # that every shared library gcc ships is ABI compatible (as
+ # is the point of SONAMEs). We don't have to worry about
+ # static libraries here as gcc itself will take care of
+ # linking against its own internal paths first. #297685
+ local MY_LDPATH
+ get_real_chost
+ MY_LDPATH=$(${SED} -n \
+ -e '/^LDPATH=/{s|LDPATH=||;s|"||g;s|:|\n|g;p}' \
+ "${GCC_ENV_D}"/${REAL_CHOST}-* | tac
+ )
+
+ # Pass all by default
+ awk '!/^(STDCXX_INCDIR|LDPATH|CC|CXX|CTARGET|GCCBITS|GCC_SPECS|GCC_PATH)=/ {print $0}' \
+ "${GCC_ENV_D}/${CC_COMP}" >> "${envd}.tmp"
+ if [[ -d ${ROOT}/etc/ld.so.conf.d ]] ; then
+ echo "${MY_LDPATH}" > "${ROOT}"/etc/ld.so.conf.d/05gcc-${CTARGET}.conf
+ else
+ echo "LDPATH=\"${MY_LDPATH}\"" >> "${envd}.tmp"
+ fi
+
+ # Punt old files; maybe globs too much, but oh well
+ rm -f \
+ "${GCC_ENV_D}/NATIVE" "${GCC_ENV_D}/.NATIVE" \
+ "${ENV_D}/05gcc" "${GCC_ENV_D}/config" \
+ "${ENV_D}/05gcc-${CTARGET}"-* "${GCC_ENV_D}/config-${CTARGET}"-*
+
+ # Help out the gcc wrapper
+ ln -sf ${CC_COMP} "${GCC_ENV_D}/.NATIVE"
+
+ # Relocate random crap
+ if [[ -e ${ROOT}/usr/${GENTOO_LIBDIR}/pkgconfig/libgcj-${CC_COMP_VERSION}.pc ]] ; then
+ local mver=${CC_COMP_VERSION:0:3}
+ for x in "" "-${mver}" ; do
+ x="${ROOT}/usr/lib/pkgconfig/libgcj${x}.pc"
+ rm -f "${x}"
+ ln -s libgcj-${CC_COMP_VERSION}.pc "${x}"
+ done
+ fi
+
+ # We need to make sure that libgcc_s.so / libunwind.so make it into /lib.
+ # On many systems (x86/amd64/etc...), this will probably never matter,
+ # but on other systems (arm/mips/etc...), this is quite critical.
+ # http://bugs.gentoo.org/60190
+ #
+ # The funky move magic is required for proper updating of in-use files.
+ #
+ # XXX: This fails when configuring the native target in a cross-compiled
+ # ROOT. Only way around that is to store the multilib configuration
+ # in the gcc profile when we compiled it and then read that instead
+ # of executing the gcc. Some day.
+ #
+ # We use the same ordering logic as mentioned in the MY_LDPATH setup.
+ # We get the libs from the latest version available.
+ local LATEST_GCC_PATH gcc LATEST_GCC_LDPATH
+
+ LATEST_GCC_PATH=$(gawk -F= '
+ $1 == "GCC_PATH" {
+ p = gensub("\"","","g",$2)
+ }
+ END { print p }
+ ' "${GCC_ENV_D}"/${REAL_CHOST}-*
+ )
+ gcc="${ROOT}${LATEST_GCC_PATH}/gcc"
+
+ local multilib
+ for multilib in $("${gcc}" -print-multi-lib); do
+ local multiarg=${multilib#*;}
+ multiarg=${multiarg/@/-}
+ local multilibdir=${multilib%;*}
+ local libdir="${ROOT}lib/"$("${gcc}" ${multiarg} -print-multi-os-directory)
+
+ mkdir -p "${libdir}"/.gcc.config.new || continue # !?!?!
+
+ local gcclib
+ for gcclib in gcc_s unwind ; do
+ # This assumes that we always have the .so symlink,
+ # but for now, that should be safe ...
+ gcclib=$("${gcc}" -print-file-name="lib${gcclib}.so")
+ if [[ ${gcclib} == */* ]] ; then
+ cp -pP "${ROOT}${gcclib}".* "${libdir}"/.gcc.config.new/
+ # no need to sanity remove this as the `mv` should take
+ # care of it. we also need this step to be completly atomic
+ # for systems that have even `mv` linked against libgcc_s.so.
+ # http://bugs.gentoo.org/150257
+ #rm -f "${libdir}"/lib${gcclib}.so*
+ mv -f "${libdir}"/.gcc.config.new/* "${libdir}"/
+ fi
+ done
+ rmdir "${libdir}"/.gcc.config.new
+ done
+ fi
+ mv_if_diff "${envd}.tmp" "${envd}"
+ local envd_changed=$?
+
+ update_wrappers ${CTARGET}
+
+ if [[ ${ROOT} == "/" ]] && \
+ [[ ${OLD_CC_COMP} != ${CC_COMP} || ${FORCE} == "yes" ]] && \
+ [[ ${envd_changed} -eq 1 ]]
+ then
+ # in case python is broken ...
+ if ! env-update ; then
+ echo ""
+ ewarn "env-update failed to work properly; making sure ld.so.conf paths"
+ ewarn "are setup properly. Please rerun gcc-config with the -f option."
+ echo ""
+ if [[ ! -d /etc/ld.so.conf.d ]] ; then
+ show_var LDPATH "${ROOT}"/etc/env.d/05gcc-${CTARGET} \
+ | sed -e 's|:|\n|g' >> /etc/ld.so.conf
+ fi
+ ldconfig
+ fi
+ else
+ envd_changed=0
+ fi
+
+ eend 0
+
+ if [[ ${envd_changed} -ne 0 ]] ; then
+ echo
+ ewarn "If you intend to use the gcc from the new profile in an already"
+ ewarn "running shell, please remember to do:"
+ echo
+ ewarn " . /etc/profile"
+ echo
+ fi
+
+ return 0
+}
+
+get_current_profile() {
+ local conf="${GCC_ENV_D}/config-${CTARGET}"
+ if [[ ! -f ${conf} ]] ; then
+ conf="${GCC_ENV_D}/config" # old name
+ elif [[ -n ${CC_COMP} ]] && is_cross_compiler ; then
+ conf="${conf}-${CC_COMP}"
+ fi
+
+ if [[ ! -f ${conf} ]] ; then
+ eerror "${argv0}: No gcc profile is active!"
+ return 1
+ fi
+
+ source_var CURRENT "${conf}"
+
+ if [[ -z ${CURRENT} ]] ; then
+ eerror "${argv0}: No gcc profile is active!"
+ return 1
+ elif [[ ! -f ${GCC_ENV_D}/${CURRENT} ]] ; then
+ eerror "${argv0}: Active gcc profile is invalid!"
+ return 1
+ fi
+
+ echo "${CURRENT}"
+
+ return 0
+}
+
+list_profiles() {
+ local i=0
+ local filter=
+
+ if [[ ${ROOT} != "/" ]] ; then
+ echo "Using gcc-config info in ${ROOT}"
+ fi
+
+ if [[ ! -f ${GCC_ENV_D}/config-${CTARGET} ]] ; then
+ if ! is_cross_compiler && [[ -e ${GCC_ENV_D}/config ]] ; then
+ [[ -w ${GCC_ENV_D}/config ]] && mv ${GCC_ENV_D}/config ${GCC_ENV_D}/config-${CTARGET}
+ else
+ # get_current_profile already warns
+ #eerror "${argv0}: No gcc profile is active; please select one!"
+ filter=${CTARGET}
+ fi
+ fi
+
+ source_var CURRENT "${GCC_ENV_D}"/config-${CTARGET}
+ CURRENT_NATIVE=${CURRENT}
+ local target=
+ for x in "${GCC_ENV_D}"/* ; do
+ [[ -f ${x} ]] || continue
+ [[ ${x} == */config* ]] && continue
+
+ source_var CTARGET "${x}"
+
+ ((++i))
+
+ [[ -n ${filter} ]] && [[ ${filter} != ${CTARGET} ]] && continue
+
+ if [[ ${target} != ${CTARGET} ]] ; then
+ [[ ${i} -gt 1 ]] && echo
+ target=${CTARGET}
+ CTARGET=""
+ fi
+
+ x=${x##*/}
+ if [[ ${x} == ${CURRENT_NATIVE} ]] ; then
+ x="${x} ${GOOD}*${NORMAL}"
+ elif [[ -e ${GCC_ENV_D}/config-${target} ]] ; then
+ source "${GCC_ENV_D}/config-${target}"
+ [[ ${x} == ${CURRENT} ]] && x="${x} ${HILITE}*${NORMAL}"
+ fi
+ echo " [${i}] ${x}"
+ done
+}
+
+print_environ() {
+ local ENV_CMD SET_ELEMENT
+ case ${SHELL} in
+ */csh|*/tcsh)
+ ENV_CMD="setenv"
+ SET_ELEMENT=" "
+ ;;
+ *)
+ ENV_CMD="export"
+ SET_ELEMENT="="
+ ;;
+ esac
+
+ local var
+ for var in GCC_SPECS GCC_PATH ; do
+ local ${var}
+ source_var ${var} "${GCC_ENV_D}/${CC_COMP}"
+ done
+
+ (
+ [[ -n ${GCC_PATH} ]] && PATH=${GCC_PATH}:${PATH}
+ for var in PATH GCC_SPECS ; do
+ echo "${ENV_CMD} ${var}${SET_ELEMENT}\"${!var}\""
+ done
+ )
+}
+
+get_bin_path() { show_var GCC_PATH "${GCC_ENV_D}/${CC_COMP}" ; }
+get_lib_path() { show_var LDPATH "${GCC_ENV_D}/${CC_COMP}" ; }
+
+split_gcc_ver() {
+ # Split up the gcc profile into components:
+ # TARGET-VER[-specs] -> TARGET VER [specs]
+ # arm-linux-3.3.6 -> arm-linux 3.3.6
+ # x86_64-linux-4.0.1-pre1234 -> x86_64-linux 4.0.1-pre1234
+ # sh-linux-3.4.4-hardened -> sh-linux 3.4.4 hardened
+ #
+ # So below we will start at the end and run a small state machine ...
+ # specs [3]
+ # accept everything
+ # specs -> version transition [3->2]
+ # when we find a version component
+ # version [2]
+ # accept only version components (see the regex)
+ # version -> target transition [2->1]
+ # when we hit a non version component
+ # target [1]
+ # accept everything we have left
+ #
+ echo "$@" | awk -F- '
+ function pushit(onme, pushee) {
+ return (onme == "" ? pushee : pushee"-"onme);
+ }
+ {
+ state=3
+ targ=""
+ ver=""
+ spec=""
+ for (i=NF; i > 0; --i) {
+ if (state >= 2) {
+ if ($i ~ /^(alpha|beta|pre|rc|p)?[[:digit:].]+$/) {
+ ver=pushit(ver, $i)
+ state=2
+ } else if (state == 3)
+ spec=pushit(spec, $i)
+ else
+ state=1
+ }
+ if (state == 1)
+ targ = pushit(targ, $i)
+ }
+
+ if (targ == "") {
+ if (ver == "") {
+ ver=spec
+ spec=""
+ }
+ targ=ver
+ ver=""
+ }
+ print targ " " ver (spec != "" ? " " spec : "")
+ }'
+}
+chop_gcc_ver_spec() {
+ local splitTED=$(split_gcc_ver "$@") # target ver spec
+ splitTED=${splitTED#* } # ver spec
+ echo ${splitTED/ /-} # ver-spec
+}
+
+SET_X=false
+NEED_ACTION="yes"
+DOIT="switch_profile"
+CHECK_CHOST="no"
+FORCE="no"
+
+CC_COMP=
+ENV_D="${ROOT}etc/env.d"
+GCC_ENV_D="${ENV_D}/gcc"
+
+for x in "$@" ; do
+ case "${x}" in
+ # Only use specified compiler if one is not already selected.
+ -O|--use-old)
+ : ${CTARGET:=$(try_real_hard_to_find_CHOST)}
+ if get_current_profile &>/dev/null ; then
+ CC_COMP=$(get_current_profile)
+ else
+ die_eerror "No profile selected, unable to utilize --use-old"
+ fi
+ ;;
+ -f|--force)
+ FORCE="yes"
+ ;;
+ -P|--use-portage-chost)
+ CHECK_CHOST="yes"
+ ;;
+ -c|--get-current-profile)
+ if [[ ${NEED_ACTION} == "yes" ]] ; then
+ NEED_ACTION="no"
+ DOIT="get_current_profile"
+ fi
+ ;;
+ -l|--list-profiles)
+ if [[ ${NEED_ACTION} == "yes" ]] ; then
+ NEED_ACTION="no"
+ DOIT="list_profiles"
+ fi
+ ;;
+ -S|--split-profile)
+ if [[ ( $1 != "-S" && $1 != "--split-profile" ) || $# -eq 1 ]] ; then
+ usage 1
+ fi
+ shift # push -S out
+ for x in "$@" ; do
+ split_gcc_ver ${x}
+ done
+ exit 0
+ ;;
+ -E|--print-environ)
+ if [[ ${NEED_ACTION} == "yes" ]] ; then
+ NEED_ACTION="no"
+ DOIT="print_environ"
+ fi
+ ;;
+ -B|--get-bin-path)
+ if [[ ${NEED_ACTION} == "yes" ]] ; then
+ NEED_ACTION="no"
+ DOIT="get_bin_path"
+ fi
+ ;;
+ -L|--get-lib-path)
+ if [[ ${NEED_ACTION} == "yes" ]] ; then
+ NEED_ACTION="no"
+ DOIT="get_lib_path"
+ fi
+ ;;
+ -x|--debug)
+ SET_X=true
+ ;;
+ -C|--nocolor)
+ # nothing to do; functions.sh parsed this for us
+ ;;
+ -h|--help)
+ usage 0
+ ;;
+ -V|--version)
+ unset RCSfile Revision Date
+ rcsfile="$RCSfile: gcc-config-1.5.1,v $"
+ rcsfile=${rcsfile#: }
+ rcsfile=${rcsfile%,v*}
+ cvsrev="$Revision: 1.2 $"
+ cvsrev=${cvsrev#: }
+ cvsdate="$Date: 2012/03/15 01:16:44 $"
+ cvsdate=${cvsdate#: }
+ echo "${rcsfile} (r${cvsrev% *} @ ${cvsdate% *})"
+ exit 0
+ ;;
+ -*)
+ die_eerror "Invalid switch! Run ${argv0} without parameters for help."
+ ;;
+ *)
+ ${SET_X} && set -x
+ if [[ -z ${CC_COMP} ]] ; then
+ if [[ -z $(echo ${x} | tr -d '[:digit:]') ]] ; then
+ # User gave us a # representing the profile
+ i=1
+ for y in "${GCC_ENV_D}"/* ; do
+ [[ -f ${y} ]] || continue
+ [[ ${y} == */config* ]] && continue
+
+ if [[ -f ${y} ]] && [[ ${x} == ${i} ]] ; then
+ CC_COMP=${y##*/}
+ break
+ fi
+ ((++i))
+ done
+ if [[ -z ${CC_COMP} ]] ; then
+ die_eerror "Could not locate profile #$x !"
+ fi
+ else
+ # User gave us a full HOST-gccver
+ x=${x##*/}
+ if [[ ${DOIT} == "get_current_profile" && -z $(ls "${GCC_ENV_D}"/${x}-* 2>/dev/null) ]] || \
+ [[ ${DOIT} != "get_current_profile" && ! -f ${GCC_ENV_D}/${x} ]]
+ then
+ # Maybe they just gave us a gccver ...
+ get_real_chost
+ if [[ -f ${GCC_ENV_D}/${REAL_CHOST}-${x} ]] ; then
+ x=${REAL_CHOST}-${x}
+ else
+ die_eerror "Could not locate '$x' in '${GCC_ENV_D}/' !"
+ fi
+ fi
+ CC_COMP=${x}
+ fi
+ else
+ die_eerror "Too many arguments! Run ${argv0} without parameters for help."
+ fi
+ ;;
+ esac
+done
+
+${SET_X} && set -x
+
+if [[ ${DOIT} == "switch_profile" ]] && [[ -z ${CC_COMP} ]] ; then
+ usage 1
+fi
+
+get_real_chost
+[[ ${DOIT} == "get_current_profile" ]] \
+ && : ${CTARGET:=${CC_COMP:-${REAL_CHOST}}} \
+ || : ${CTARGET:=${REAL_CHOST}}
+
+if [[ -z ${CC_COMP} ]] ; then
+ CC_COMP=$(get_current_profile)
+ if [[ $? -ne 0 ]] ; then
+ echo "${CC_COMP}"
+ list_profiles
+ exit 1
+ fi
+fi
+
+if [[ ${DOIT} != "get_current_profile" ]] ; then
+ GCC_LIB=$(get_lib_path | awk -F/ '{ print "/"$2"/"$3"/"$4"/" }')
+
+ # For people who insist on using funky version strings ("4.6.x"
+ # rather than "4.6.2"), allow them to manually specify it.
+ source_var GCC_VER "${GCC_ENV_D}/${CC_COMP}"
+
+ CC_COMP_VERSION=${GCC_VER:-$(chop_gcc_ver_spec ${CC_COMP})}
+ CC_COMP_TARGET=$(show_var CTARGET "${GCC_ENV_D}/${CC_COMP}")
+ if [[ -z ${CC_COMP_TARGET} ]] ; then
+ # Native configs don't have CTARGET in there.
+ CC_COMP_TARGET=${CC_COMP%-${CC_COMP_VERSION}*}
+ fi
+
+ if [[ ! -d ${ROOT}/${GCC_LIB}/${CC_COMP_TARGET}/${CC_COMP_VERSION} ]]; then
+ CC_COMP_VERSION=${CC_COMP_VERSION%-*}
+ fi
+
+ if [[ ! -d ${ROOT}/${GCC_LIB}/${CC_COMP_TARGET}/${CC_COMP_VERSION} ]] || \
+ [[ ! -f ${GCC_ENV_D}/${CC_COMP} ]]
+ then
+ eerror "${argv0}: Profile does not exist or invalid setting for ${GCC_ENV_D}/${CC_COMP}" 1>&2
+ #exit 1
+ fi
+fi
+
+if [[ ${CHECK_CHOST} == "yes" ]] ; then
+ # Chosen CHOST are not the same as the real CHOST according to
+ # make.conf, and --use-portage-chost option was given, so do nothing
+ get_real_chost
+ CC_COMP_VERSION=$(chop_gcc_ver_spec ${CC_COMP})
+ CC_COMP_TARGET=${CC_COMP:0:${#CC_COMP}-${#CC_COMP_VERSION}-1}
+ [[ ${CC_COMP_TARGET} != ${REAL_CHOST} ]] && exit 0
+fi
+
+${DOIT}
+
+# vim:ts=4
diff --git a/sys-devel/gcc-config/files/gcc-config-1.8-dont_source_functions_sh_from_etc_initd.patch b/sys-devel/gcc-config/files/gcc-config-1.8-dont_source_functions_sh_from_etc_initd.patch
new file mode 100644
index 000000000000..a4b7de2ffc54
--- /dev/null
+++ b/sys-devel/gcc-config/files/gcc-config-1.8-dont_source_functions_sh_from_etc_initd.patch
@@ -0,0 +1,47 @@
+--- gcc-config-1.8/gcc-config
++++ gcc-config-1.8/gcc-config
+@@ -15,8 +15,9 @@
+ trap ":" INT QUIT TSTP
+
+ argv0=${0##*/}
+-source /etc/init.d/functions.sh || {
+- echo "${argv0}: Could not source /etc/init.d/functions.sh!" 1>&2
++functions_script="/lib/gentoo/functions.sh"
++source ${functions_script} || {
++ echo "${argv0}: Could not source ${functions_script}!" 1>&2
+ exit 1
+ }
+ esyslog() { :; }
+
+From d45de09450ffb63b138bbb7f78cae43e1101e2ec Mon Sep 17 00:00:00 2001
+From: Ryan Hill <rhill@gentoo.org>
+Date: Tue, 12 May 2015 22:09:28 -0600
+Subject: [PATCH] Ignore whitespace when diffing test results.
+
+The amount of whitespace output by ebegin/eend from gentoo-functions
+is dynamic (seems to be dependent on terminal width). Since we can't
+predict this we have to ignore all whitespace differences.
+
+URL: https://bugs.gentoo.org/547586
+Reported-by: tka <tka@kamph.org>
+Signed-off-by: Ryan Hill <rhill@gentoo.org>
+---
+ tests/run_tests | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tests/run_tests b/tests/run_tests
+index 2ff7d77..397d667 100755
+--- a/tests/run_tests
++++ b/tests/run_tests
+@@ -44,7 +44,7 @@ cmp_log() {
+ args+=( -e "s|: line [0-9]*: |: |g" )
+ sed "${args[@]}" "${exp}" > "${exp}.tmp"
+ sed "${args[@]}" "${log}" > "${log}.tmp"
+- diff -u "${exp}.tmp" "${log}.tmp" > "${log}.diff"
++ diff -uw "${exp}.tmp" "${log}.tmp" > "${log}.diff"
+ ret=$?
+ rm "${exp}.tmp"
+ return ${ret}
+--
+2.4.4
+
diff --git a/sys-devel/gcc-config/files/wrapper-1.5.1.c b/sys-devel/gcc-config/files/wrapper-1.5.1.c
new file mode 100644
index 000000000000..e2e80290b2df
--- /dev/null
+++ b/sys-devel/gcc-config/files/wrapper-1.5.1.c
@@ -0,0 +1,372 @@
+/*
+ * Copyright 1999-2008 Gentoo Foundation
+ * Distributed under the terms of the GNU General Public License v2
+ * $Id$
+ * Author: Martin Schlemmer <azarah@gentoo.org>
+ * az's lackey: Mike Frysinger <vapier@gentoo.org>
+ */
+
+#ifdef DEBUG
+# define USE_DEBUG 1
+#else
+# define USE_DEBUG 0
+#endif
+
+#include <errno.h>
+#include <libgen.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#define GCC_CONFIG "/usr/bin/gcc-config"
+#define ENVD_BASE "/etc/env.d/05gcc"
+
+#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
+
+/* basename(3) is allowed to modify memory */
+#undef basename
+#define basename(path) \
+({ \
+ char *__path = path; \
+ char *__ret = strrchr(__path, '/'); \
+ __ret ? __ret + 1 : __path; \
+})
+
+struct wrapper_data {
+ char *name, *fullname, *bin, *path;
+};
+
+static const struct {
+ char *alias;
+ char *target;
+} wrapper_aliases[] = {
+ { "cc", "gcc" },
+ { "f77", "g77" },
+};
+
+#define wrapper_warn(fmt, ...) fprintf(stderr, "%s" fmt "\n", "gcc-config: ", ## __VA_ARGS__)
+#define wrapper_err(fmt, ...) ({ wrapper_warn("%s" fmt, "error: ", ## __VA_ARGS__); exit(1); })
+#define wrapper_errp(fmt, ...) wrapper_err(fmt ": %s", ## __VA_ARGS__, strerror(errno))
+#define wrapper_dbg(fmt, ...) ({ if (USE_DEBUG) wrapper_warn(fmt, ## __VA_ARGS__); })
+
+#define xmemwrap(func, proto, use) \
+static void *x ## func proto \
+{ \
+ void *ret = func use; \
+ if (!ret) \
+ wrapper_err(#func "%s", ": out of memory"); \
+ return ret; \
+}
+xmemwrap(malloc, (size_t size), (size))
+xmemwrap(calloc, (size_t nemb, size_t size), (nemb, size))
+xmemwrap(strdup, (const char *s), (s))
+
+/* check_for_target checks in path for the file we are seeking
+ * it returns 1 if found (with data->bin setup), 0 if not and
+ * negative on error
+ */
+static int check_for_target(char *path, struct wrapper_data *data)
+{
+ struct stat sbuf;
+ char str[PATH_MAX + 1];
+ size_t path_len = strlen(path);
+ size_t len = path_len + strlen(data->name) + 2;
+
+ if (sizeof(str) < len)
+ wrapper_warn("path too long: %s", path);
+
+ strcpy(str, path);
+ str[path_len] = '/';
+ str[path_len+1] = '\0';
+ strcat(str, data->name);
+
+ /* Stat possible file to check that
+ * 1) it exist and is a regular file, and
+ * 2) it is not the wrapper itself, and
+ * 3) it is in a /gcc-bin/ directory tree
+ */
+ if (strcmp(str, data->fullname) != 0 &&
+ strstr(str, "/gcc-bin/") != NULL &&
+ stat(str, &sbuf) == 0 &&
+ (S_ISREG(sbuf.st_mode) || S_ISLNK(sbuf.st_mode)))
+ {
+ wrapper_dbg("%s: found in %s", data->name, path);
+ data->bin = xstrdup(str);
+ return 1;
+ }
+
+ wrapper_dbg("%s: did not find in %s", data->name, path);
+ return 0;
+}
+
+static int find_target_in_path(struct wrapper_data *data)
+{
+ char *token = NULL, *state;
+ char *str;
+
+ if (data->path == NULL)
+ return 0;
+
+ /* Make a copy since strtok_r will modify path */
+ str = xstrdup(data->path);
+
+ /* Find the first file with suitable name in PATH. The idea here is
+ * that we do not want to bind ourselfs to something static like the
+ * default profile, or some odd environment variable, but want to be
+ * able to build something with a non default gcc by just tweaking
+ * the PATH ... */
+ token = strtok_r(str, ":", &state);
+ while (token != NULL) {
+ if (check_for_target(token, data))
+ return 1;
+ token = strtok_r(NULL, ":", &state);
+ }
+
+ wrapper_dbg("%s: did not find in PATH", data->name);
+ return 0;
+}
+
+/* find_target_in_envd parses /etc/env.d/05gcc, and tries to
+ * extract PATH, which is set to the current profile's bin
+ * directory ...
+ */
+static int find_target_in_envd(struct wrapper_data *data, int cross_compile)
+{
+ FILE *envfile = NULL;
+ char *token = NULL, *state;
+ char str[PATH_MAX + 1];
+ char *strp = str;
+ char envd_file[PATH_MAX + 1];
+
+ if (!cross_compile) {
+ /* for the sake of speed, we'll keep a symlink around for
+ * the native compiler. #190260
+ */
+ snprintf(envd_file, sizeof(envd_file)-1, "/etc/env.d/gcc/.NATIVE");
+ } else {
+ char *ctarget, *end = strrchr(data->name, '-');
+ if (end == NULL)
+ return 0;
+ ctarget = xstrdup(data->name);
+ ctarget[end - data->name] = '\0';
+ snprintf(envd_file, PATH_MAX, "%s-%s", ENVD_BASE, ctarget);
+ free(ctarget);
+ }
+
+ envfile = fopen(envd_file, "r");
+ if (envfile == NULL)
+ return 0;
+
+ while (fgets(strp, PATH_MAX, envfile) != NULL) {
+ /* Keep reading ENVD_FILE until we get a line that
+ * starts with 'GCC_PATH=' ... keep 'PATH=' around
+ * for older gcc versions.
+ */
+ if (strncmp(strp, "GCC_PATH=", strlen("GCC_PATH=")) &&
+ strncmp(strp, "PATH=", strlen("PATH=")))
+ continue;
+
+ token = strtok_r(strp, "=", &state);
+ if ((token != NULL) && token[0])
+ /* The second token should be the value of PATH .. */
+ token = strtok_r(NULL, "=", &state);
+ else
+ goto bail;
+
+ if ((token != NULL) && token[0]) {
+ strp = token;
+ /* A bash variable may be unquoted, quoted with " or
+ * quoted with ', so extract the value without those ..
+ */
+ token = strtok(strp, "\n\"\'");
+
+ while (token != NULL) {
+ if (check_for_target(token, data)) {
+ fclose(envfile);
+ return 1;
+ }
+
+ token = strtok(NULL, "\n\"\'");
+ }
+ }
+
+ strp = str;
+ }
+
+ bail:
+ fclose(envfile);
+ return (cross_compile ? 0 : find_target_in_envd(data, 1));
+}
+
+static void find_wrapper_target(struct wrapper_data *data)
+{
+ if (find_target_in_path(data))
+ return;
+
+ if (find_target_in_envd(data, 0))
+ return;
+
+ /* Only our wrapper is in PATH, so get the CC path using
+ * gcc-config and execute the real binary in there ...
+ */
+ FILE *inpipe = popen(GCC_CONFIG " --get-bin-path", "r");
+ if (inpipe == NULL)
+ wrapper_errp("could not open pipe");
+
+ char str[PATH_MAX + 1];
+ if (fgets(str, PATH_MAX, inpipe) == 0)
+ wrapper_errp("could not get compiler binary path");
+
+ /* chomp! */
+ size_t plen = strlen(str);
+ if (str[plen-1] == '\n')
+ str[plen-1] = '\0';
+
+ data->bin = xmalloc(plen + 1 + strlen(data->name) + 1);
+ sprintf(data->bin, "%s/%s", str, data->name);
+
+ pclose(inpipe);
+}
+
+/* This function modifies PATH to have gcc's bin path appended */
+static void modify_path(struct wrapper_data *data)
+{
+ char *newpath = NULL, *token = NULL, *state;
+ char dname_data[PATH_MAX + 1], str[PATH_MAX + 1];
+ char *str2 = dname_data, *dname = dname_data;
+ size_t len = 0;
+
+ if (data->bin == NULL)
+ return;
+
+ if (data->path == NULL)
+ return;
+
+ snprintf(str2, PATH_MAX + 1, "%s", data->bin);
+
+ if ((dname = dirname(str2)) == NULL)
+ return;
+
+ /* Make a copy since strtok_r will modify path */
+ snprintf(str, PATH_MAX + 1, "%s", data->path);
+
+ token = strtok_r(str, ":", &state);
+
+ /* Check if we already appended our bin location to PATH */
+ if ((token != NULL) && token[0])
+ if (!strcmp(token, dname))
+ return;
+
+ len = strlen(dname) + strlen(data->path) + 2 + strlen("PATH") + 1;
+
+ newpath = xmalloc(len);
+ memset(newpath, 0, len);
+
+ snprintf(newpath, len, "PATH=%s:%s", dname, data->path);
+ putenv(newpath);
+}
+
+static char *abi_flags[] = {
+ "-m32", "-m64", "-mabi",
+};
+static char **build_new_argv(char **argv, const char *newflags_str)
+{
+#define MAX_NEWFLAGS 32
+ char *newflags[MAX_NEWFLAGS];
+ char **retargv;
+ unsigned int argc, i;
+ char *state, *flags_tokenized;
+
+ retargv = argv;
+
+ /* make sure user hasn't specified any ABI flags already ...
+ * if they have, lets just get out of here ... this of course
+ * is by no means complete, it's merely a hack that works most
+ * of the time ...
+ */
+ for (argc = 0; argv[argc]; ++argc)
+ for (i = 0; i < ARRAY_SIZE(abi_flags); ++i)
+ if (!strncmp(argv[argc], abi_flags[i], strlen(abi_flags[i])))
+ return retargv;
+
+ /* Tokenize the flag list and put it into newflags array */
+ flags_tokenized = xstrdup(newflags_str);
+ i = 0;
+ newflags[i] = strtok_r(flags_tokenized, " \t\n", &state);
+ while (newflags[i] != NULL && i < MAX_NEWFLAGS-1)
+ newflags[++i] = strtok_r(NULL, " \t\n", &state);
+
+ /* allocate memory for our spiffy new argv */
+ retargv = xcalloc(argc + i + 1, sizeof(char*));
+ /* start building retargv */
+ retargv[0] = argv[0];
+ /* insert the ABI flags first so cmdline always overrides ABI flags */
+ memcpy(retargv+1, newflags, i * sizeof(char*));
+ /* copy over the old argv */
+ if (argc > 1)
+ memcpy(retargv+1+i, argv+1, (argc-1) * sizeof(char*));
+
+ return retargv;
+}
+
+int main(int argc, char *argv[])
+{
+ struct wrapper_data data;
+
+ memset(&data, 0, sizeof(data));
+
+ if (getenv("PATH"))
+ data.path = xstrdup(getenv("PATH"));
+
+ /* What should we find ? */
+ data.name = basename(argv[0]);
+
+ /* Allow for common compiler names like cc->gcc */
+ size_t i;
+ for (i = 0; i < ARRAY_SIZE(wrapper_aliases); ++i)
+ if (!strcmp(data.name, wrapper_aliases[i].alias))
+ data.name = wrapper_aliases[i].target;
+
+ /* What is the full name of our wrapper? */
+ data.fullname = xmalloc(strlen(data.name) + sizeof("/usr/bin/") + 1);
+ sprintf(data.fullname, "/usr/bin/%s", data.name);
+
+ find_wrapper_target(&data);
+
+ modify_path(&data);
+
+ free(data.path);
+ data.path = NULL;
+
+ /* Set argv[0] to the correct binary, else gcc can't find internal headers
+ * http://bugs.gentoo.org/8132
+ */
+ argv[0] = data.bin;
+
+ /* If $ABI is in env, add appropriate env flags */
+ char **newargv = argv;
+ if (getenv("ABI")) {
+ char envvar[50];
+
+ /* We use CFLAGS_${ABI} for gcc, g++, g77, etc as the flags that would
+ * be in there are the same no matter which compiler we are using.
+ */
+ snprintf(envvar, sizeof(envvar), "CFLAGS_%s", getenv("ABI"));
+ envvar[sizeof(envvar)-1] = '\0';
+
+ if (getenv(envvar))
+ newargv = build_new_argv(argv, getenv(envvar));
+ }
+
+ /* Ok, lets do it one more time ... */
+ execv(data.bin, newargv);
+
+ /* shouldn't have made it here if things worked ... */
+ wrapper_err("could not run/locate '%s'", data.name);
+
+ return 123;
+}
diff --git a/sys-devel/gcc-config/files/wrapper-1.5.2.c b/sys-devel/gcc-config/files/wrapper-1.5.2.c
new file mode 100644
index 000000000000..d83da3027c33
--- /dev/null
+++ b/sys-devel/gcc-config/files/wrapper-1.5.2.c
@@ -0,0 +1,315 @@
+/*
+ * Copyright 1999-2011 Gentoo Foundation
+ * Distributed under the terms of the GNU General Public License v2
+ * $Id$
+ * Author: Martin Schlemmer <azarah@gentoo.org>
+ * az's lackey: Mike Frysinger <vapier@gentoo.org>
+ */
+
+#ifdef DEBUG
+# define USE_DEBUG 1
+#else
+# define USE_DEBUG 0
+#endif
+
+#include <errno.h>
+#include <libgen.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#define GCC_CONFIG "/usr/bin/gcc-config"
+#define ENVD_BASE "/etc/env.d/05gcc"
+
+#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
+
+/* basename(3) is allowed to modify memory */
+#undef basename
+#define basename(path) \
+({ \
+ char *__path = path; \
+ char *__ret = strrchr(__path, '/'); \
+ __ret ? __ret + 1 : __path; \
+})
+
+struct wrapper_data {
+ const char *name;
+ char *fullname, *bin, *path;
+};
+
+static const struct {
+ const char *alias;
+ const char *target;
+} wrapper_aliases[] = {
+ { "cc", "gcc" },
+ { "f77", "gfortran" },
+ { "f95", "gfortran" },
+};
+
+#define wrapper_warn(fmt, ...) fprintf(stderr, "%s" fmt "\n", "gcc-config: ", ## __VA_ARGS__)
+#define wrapper_err(fmt, ...) ({ wrapper_warn("%s" fmt, "error: ", ## __VA_ARGS__); exit(1); })
+#define wrapper_errp(fmt, ...) wrapper_err(fmt ": %s", ## __VA_ARGS__, strerror(errno))
+#define wrapper_dbg(fmt, ...) ({ if (USE_DEBUG) wrapper_warn(fmt, ## __VA_ARGS__); })
+
+#define xmemwrap(func, proto, use) \
+static void *x ## func proto \
+{ \
+ void *ret = func use; \
+ if (!ret) \
+ wrapper_err(#func "%s", ": out of memory"); \
+ return ret; \
+}
+xmemwrap(malloc, (size_t size), (size))
+xmemwrap(strdup, (const char *s), (s))
+
+/* check_for_target checks in path for the file we are seeking
+ * it returns 1 if found (with data->bin setup), 0 if not and
+ * negative on error
+ */
+static int check_for_target(char *path, struct wrapper_data *data)
+{
+ struct stat sbuf;
+ char str[PATH_MAX + 1];
+ size_t path_len = strlen(path);
+ size_t len = path_len + strlen(data->name) + 2;
+
+ if (sizeof(str) < len)
+ wrapper_warn("path too long: %s", path);
+
+ strcpy(str, path);
+ str[path_len] = '/';
+ str[path_len+1] = '\0';
+ strcat(str, data->name);
+
+ /* Stat possible file to check that
+ * 1) it exist and is a regular file, and
+ * 2) it is not the wrapper itself, and
+ * 3) it is in a /gcc-bin/ directory tree
+ */
+ if (strcmp(str, data->fullname) != 0 &&
+ strstr(str, "/gcc-bin/") != NULL &&
+ stat(str, &sbuf) == 0 &&
+ (S_ISREG(sbuf.st_mode) || S_ISLNK(sbuf.st_mode)))
+ {
+ wrapper_dbg("%s: found in %s", data->name, path);
+ data->bin = xstrdup(str);
+ return 1;
+ }
+
+ wrapper_dbg("%s: did not find in %s", data->name, path);
+ return 0;
+}
+
+static int find_target_in_path(struct wrapper_data *data)
+{
+ char *token = NULL, *state = NULL;
+ char *str;
+
+ if (data->path == NULL)
+ return 0;
+
+ /* Make a copy since strtok_r will modify path */
+ str = xstrdup(data->path);
+
+ /* Find the first file with suitable name in PATH. The idea here is
+ * that we do not want to bind ourselfs to something static like the
+ * default profile, or some odd environment variable, but want to be
+ * able to build something with a non default gcc by just tweaking
+ * the PATH ... */
+ token = strtok_r(str, ":", &state);
+ while (token != NULL) {
+ if (check_for_target(token, data))
+ return 1;
+ token = strtok_r(NULL, ":", &state);
+ }
+
+ wrapper_dbg("%s: did not find in PATH", data->name);
+ return 0;
+}
+
+/* find_target_in_envd parses /etc/env.d/05gcc, and tries to
+ * extract PATH, which is set to the current profile's bin
+ * directory ...
+ */
+static int find_target_in_envd(struct wrapper_data *data, int cross_compile)
+{
+ FILE *envfile = NULL;
+ char *token = NULL, *state;
+ char str[PATH_MAX + 1];
+ char *strp = str;
+ char envd_file[PATH_MAX + 1];
+
+ if (!cross_compile) {
+ /* for the sake of speed, we'll keep a symlink around for
+ * the native compiler. #190260
+ */
+ snprintf(envd_file, sizeof(envd_file)-1, "/etc/env.d/gcc/.NATIVE");
+ } else {
+ char *ctarget, *end = strrchr(data->name, '-');
+ if (end == NULL)
+ return 0;
+ ctarget = xstrdup(data->name);
+ ctarget[end - data->name] = '\0';
+ snprintf(envd_file, PATH_MAX, "%s-%s", ENVD_BASE, ctarget);
+ free(ctarget);
+ }
+
+ envfile = fopen(envd_file, "r");
+ if (envfile == NULL)
+ return 0;
+
+ while (fgets(strp, PATH_MAX, envfile) != NULL) {
+ /* Keep reading ENVD_FILE until we get a line that
+ * starts with 'GCC_PATH=' ... keep 'PATH=' around
+ * for older gcc versions.
+ */
+ if (strncmp(strp, "GCC_PATH=", strlen("GCC_PATH=")) &&
+ strncmp(strp, "PATH=", strlen("PATH=")))
+ continue;
+
+ token = strtok_r(strp, "=", &state);
+ if ((token != NULL) && token[0])
+ /* The second token should be the value of PATH .. */
+ token = strtok_r(NULL, "=", &state);
+ else
+ goto bail;
+
+ if ((token != NULL) && token[0]) {
+ strp = token;
+ /* A bash variable may be unquoted, quoted with " or
+ * quoted with ', so extract the value without those ..
+ */
+ token = strtok(strp, "\n\"\'");
+
+ while (token != NULL) {
+ if (check_for_target(token, data)) {
+ fclose(envfile);
+ return 1;
+ }
+
+ token = strtok(NULL, "\n\"\'");
+ }
+ }
+
+ strp = str;
+ }
+
+ bail:
+ fclose(envfile);
+ return (cross_compile ? 0 : find_target_in_envd(data, 1));
+}
+
+static void find_wrapper_target(struct wrapper_data *data)
+{
+ if (find_target_in_path(data))
+ return;
+
+ if (find_target_in_envd(data, 0))
+ return;
+
+ /* Only our wrapper is in PATH, so get the CC path using
+ * gcc-config and execute the real binary in there ...
+ */
+ FILE *inpipe = popen(GCC_CONFIG " --get-bin-path", "r");
+ if (inpipe == NULL)
+ wrapper_errp("could not open pipe");
+
+ char str[PATH_MAX + 1];
+ if (fgets(str, PATH_MAX, inpipe) == 0)
+ wrapper_errp("could not get compiler binary path");
+
+ /* chomp! */
+ size_t plen = strlen(str);
+ if (str[plen-1] == '\n')
+ str[plen-1] = '\0';
+
+ data->bin = xmalloc(plen + 1 + strlen(data->name) + 1);
+ sprintf(data->bin, "%s/%s", str, data->name);
+
+ pclose(inpipe);
+}
+
+/* This function modifies PATH to have gcc's bin path appended */
+static void modify_path(struct wrapper_data *data)
+{
+ char *newpath = NULL, *token = NULL, *state;
+ char dname_data[PATH_MAX + 1], str[PATH_MAX + 1];
+ char *str2 = dname_data, *dname = dname_data;
+ size_t len = 0;
+
+ if (data->bin == NULL)
+ return;
+
+ if (data->path == NULL)
+ return;
+
+ snprintf(str2, PATH_MAX + 1, "%s", data->bin);
+
+ if ((dname = dirname(str2)) == NULL)
+ return;
+
+ /* Make a copy since strtok_r will modify path */
+ snprintf(str, PATH_MAX + 1, "%s", data->path);
+
+ token = strtok_r(str, ":", &state);
+
+ /* Check if we already appended our bin location to PATH */
+ if ((token != NULL) && token[0])
+ if (!strcmp(token, dname))
+ return;
+
+ len = strlen(dname) + strlen(data->path) + 2 + strlen("PATH") + 1;
+
+ newpath = xmalloc(len);
+ memset(newpath, 0, len);
+
+ snprintf(newpath, len, "PATH=%s:%s", dname, data->path);
+ putenv(newpath);
+}
+
+int main(int argc, char *argv[])
+{
+ struct wrapper_data data;
+
+ memset(&data, 0, sizeof(data));
+
+ if (getenv("PATH"))
+ data.path = xstrdup(getenv("PATH"));
+
+ /* What should we find ? */
+ data.name = basename(argv[0]);
+
+ /* Allow for common compiler names like cc->gcc */
+ size_t i;
+ for (i = 0; i < ARRAY_SIZE(wrapper_aliases); ++i)
+ if (!strcmp(data.name, wrapper_aliases[i].alias))
+ data.name = wrapper_aliases[i].target;
+
+ /* What is the full name of our wrapper? */
+ data.fullname = xmalloc(strlen(data.name) + sizeof("/usr/bin/") + 1);
+ sprintf(data.fullname, "/usr/bin/%s", data.name);
+
+ find_wrapper_target(&data);
+
+ modify_path(&data);
+
+ free(data.path);
+ data.path = NULL;
+
+ /* Set argv[0] to the correct binary, else gcc can't find internal headers
+ * http://bugs.gentoo.org/8132
+ */
+ argv[0] = data.bin;
+
+ /* Ok, lets do it one more time ... */
+ execv(data.bin, argv);
+
+ /* shouldn't have made it here if things worked ... */
+ wrapper_err("could not run/locate '%s'", data.name);
+
+ return 123;
+}
diff --git a/sys-devel/gcc-config/gcc-config-1.4.1-r1.ebuild b/sys-devel/gcc-config/gcc-config-1.4.1-r1.ebuild
new file mode 100644
index 000000000000..18d93072d918
--- /dev/null
+++ b/sys-devel/gcc-config/gcc-config-1.4.1-r1.ebuild
@@ -0,0 +1,59 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit flag-o-matic toolchain-funcs multilib
+
+# Version of .c wrapper to use
+W_VER="1.5.1"
+
+DESCRIPTION="Utility to change the gcc compiler being used"
+HOMEPAGE="http://www.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc ~sparc-fbsd x86 ~x86-fbsd"
+IUSE=""
+
+RDEPEND="!app-admin/eselect-compiler"
+
+S=${WORKDIR}
+
+src_unpack() {
+ cp "${FILESDIR}"/wrapper-${W_VER}.c "${S}"/wrapper.c || die
+}
+
+src_compile() {
+ strip-flags
+ emake CC="$(tc-getCC)" wrapper || die "compile wrapper"
+}
+
+src_install() {
+ newbin "${FILESDIR}"/${PN}-${PV} ${PN} || die "install gcc-config"
+ sed -i \
+ -e "s:@GENTOO_LIBDIR@:$(get_libdir):g" \
+ "${D}"/usr/bin/${PN}
+
+ exeinto /usr/$(get_libdir)/misc
+ newexe wrapper gcc-config || die "install wrapper"
+}
+
+pkg_postinst() {
+ # Scrub eselect-compiler remains
+ if [[ -e ${ROOT}/etc/env.d/05compiler ]] ; then
+ rm -f "${ROOT}"/etc/env.d/05compiler
+ fi
+
+ # Make sure old versions dont exist #79062
+ rm -f "${ROOT}"/usr/sbin/gcc-config
+
+ # Do we have a valid multi ver setup ?
+ if gcc-config --get-current-profile &>/dev/null ; then
+ # We not longer use the /usr/include/g++-v3 hacks, as
+ # it is not needed ...
+ [[ -L ${ROOT}/usr/include/g++ ]] && rm -f "${ROOT}"/usr/include/g++
+ [[ -L ${ROOT}/usr/include/g++-v3 ]] && rm -f "${ROOT}"/usr/include/g++-v3
+ gcc-config $(/usr/bin/gcc-config --get-current-profile)
+ fi
+}
diff --git a/sys-devel/gcc-config/gcc-config-1.5-r1.ebuild b/sys-devel/gcc-config/gcc-config-1.5-r1.ebuild
new file mode 100644
index 000000000000..1d6f41c3b44c
--- /dev/null
+++ b/sys-devel/gcc-config/gcc-config-1.5-r1.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit flag-o-matic toolchain-funcs multilib
+
+# Version of .c wrapper to use
+W_VER="1.5.2"
+
+DESCRIPTION="Utility to change the gcc compiler being used"
+HOMEPAGE="http://www.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 -sparc-fbsd -x86-fbsd"
+IUSE=""
+
+RDEPEND="!app-admin/eselect-compiler"
+
+S=${WORKDIR}
+
+src_unpack() {
+ cp "${FILESDIR}"/wrapper-${W_VER}.c "${S}"/wrapper.c || die
+}
+
+src_compile() {
+ strip-flags
+ emake CC="$(tc-getCC)" wrapper || die "compile wrapper"
+}
+
+src_install() {
+ newbin "${FILESDIR}"/${PN}-${PV} ${PN} || die "install gcc-config"
+ sed -i \
+ -e "s:@GENTOO_LIBDIR@:$(get_libdir):g" \
+ "${D}"/usr/bin/${PN}
+
+ exeinto /usr/$(get_libdir)/misc
+ newexe wrapper gcc-config || die "install wrapper"
+}
+
+pkg_postinst() {
+ # Scrub eselect-compiler remains
+ if [[ -e ${ROOT}/etc/env.d/05compiler ]] ; then
+ rm -f "${ROOT}"/etc/env.d/05compiler
+ fi
+
+ # Make sure old versions dont exist #79062
+ rm -f "${ROOT}"/usr/sbin/gcc-config
+
+ # We not longer use the /usr/include/g++-v3 hacks, as
+ # it is not needed ...
+ [[ -L ${ROOT}/usr/include/g++ ]] && rm -f "${ROOT}"/usr/include/g++
+ [[ -L ${ROOT}/usr/include/g++-v3 ]] && rm -f "${ROOT}"/usr/include/g++-v3
+
+ # Do we have a valid multi ver setup ?
+ local x
+ for x in $(gcc-config -C -l 2>/dev/null | awk '$NF == "*" { print $2 }') ; do
+ gcc-config ${x}
+ done
+}
diff --git a/sys-devel/gcc-config/gcc-config-1.5-r2.ebuild b/sys-devel/gcc-config/gcc-config-1.5-r2.ebuild
new file mode 100644
index 000000000000..0455d08ee1d6
--- /dev/null
+++ b/sys-devel/gcc-config/gcc-config-1.5-r2.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit flag-o-matic toolchain-funcs multilib
+
+# Version of .c wrapper to use
+W_VER="1.5.2"
+
+DESCRIPTION="Utility to change the gcc compiler being used"
+HOMEPAGE="http://www.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+RDEPEND="!app-admin/eselect-compiler"
+
+S=${WORKDIR}
+
+src_unpack() {
+ cp "${FILESDIR}"/wrapper-${W_VER}.c "${S}"/wrapper.c || die
+}
+
+src_compile() {
+ strip-flags
+ emake CC="$(tc-getCC)" wrapper || die "compile wrapper"
+}
+
+src_install() {
+ newbin "${FILESDIR}"/${PN}-${PV} ${PN} || die "install gcc-config"
+ sed -i \
+ -e "s:@GENTOO_LIBDIR@:$(get_libdir):g" \
+ "${D}"/usr/bin/${PN}
+
+ exeinto /usr/$(get_libdir)/misc
+ newexe wrapper gcc-config || die "install wrapper"
+}
+
+pkg_postinst() {
+ # Scrub eselect-compiler remains
+ if [[ -e ${ROOT}/etc/env.d/05compiler ]] ; then
+ rm -f "${ROOT}"/etc/env.d/05compiler
+ fi
+
+ # Make sure old versions dont exist #79062
+ rm -f "${ROOT}"/usr/sbin/gcc-config
+
+ # We not longer use the /usr/include/g++-v3 hacks, as
+ # it is not needed ...
+ [[ -L ${ROOT}/usr/include/g++ ]] && rm -f "${ROOT}"/usr/include/g++
+ [[ -L ${ROOT}/usr/include/g++-v3 ]] && rm -f "${ROOT}"/usr/include/g++-v3
+
+ # Do we have a valid multi ver setup ?
+ local x
+ for x in $(gcc-config -C -l 2>/dev/null | awk '$NF == "*" { print $2 }') ; do
+ gcc-config ${x}
+ done
+}
diff --git a/sys-devel/gcc-config/gcc-config-1.5.1-r1.ebuild b/sys-devel/gcc-config/gcc-config-1.5.1-r1.ebuild
new file mode 100644
index 000000000000..400bb566725a
--- /dev/null
+++ b/sys-devel/gcc-config/gcc-config-1.5.1-r1.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit flag-o-matic toolchain-funcs multilib
+
+# Version of .c wrapper to use
+W_VER="1.5.2"
+
+DESCRIPTION="Utility to change the gcc compiler being used"
+HOMEPAGE="http://www.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+RDEPEND="!app-admin/eselect-compiler"
+
+S=${WORKDIR}
+
+src_unpack() {
+ cp "${FILESDIR}"/wrapper-${W_VER}.c "${S}"/wrapper.c || die
+}
+
+src_compile() {
+ strip-flags
+ emake CC="$(tc-getCC)" wrapper || die "compile wrapper"
+}
+
+src_install() {
+ newbin "${FILESDIR}"/${PN}-${PV} ${PN} || die "install gcc-config"
+ sed -i \
+ -e "s:@GENTOO_LIBDIR@:$(get_libdir):g" \
+ "${D}"/usr/bin/${PN}
+
+ exeinto /usr/$(get_libdir)/misc
+ newexe wrapper gcc-config || die "install wrapper"
+}
+
+pkg_postinst() {
+ # Scrub eselect-compiler remains
+ if [[ -e ${ROOT}/etc/env.d/05compiler ]] ; then
+ rm -f "${ROOT}"/etc/env.d/05compiler
+ fi
+
+ # Make sure old versions dont exist #79062
+ rm -f "${ROOT}"/usr/sbin/gcc-config
+
+ # We not longer use the /usr/include/g++-v3 hacks, as
+ # it is not needed ...
+ [[ -L ${ROOT}/usr/include/g++ ]] && rm -f "${ROOT}"/usr/include/g++
+ [[ -L ${ROOT}/usr/include/g++-v3 ]] && rm -f "${ROOT}"/usr/include/g++-v3
+
+ # Do we have a valid multi ver setup ?
+ local x
+ for x in $(gcc-config -C -l 2>/dev/null | awk '$NF == "*" { print $2 }') ; do
+ gcc-config ${x}
+ done
+}
diff --git a/sys-devel/gcc-config/gcc-config-1.5.1.ebuild b/sys-devel/gcc-config/gcc-config-1.5.1.ebuild
new file mode 100644
index 000000000000..400bb566725a
--- /dev/null
+++ b/sys-devel/gcc-config/gcc-config-1.5.1.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit flag-o-matic toolchain-funcs multilib
+
+# Version of .c wrapper to use
+W_VER="1.5.2"
+
+DESCRIPTION="Utility to change the gcc compiler being used"
+HOMEPAGE="http://www.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+RDEPEND="!app-admin/eselect-compiler"
+
+S=${WORKDIR}
+
+src_unpack() {
+ cp "${FILESDIR}"/wrapper-${W_VER}.c "${S}"/wrapper.c || die
+}
+
+src_compile() {
+ strip-flags
+ emake CC="$(tc-getCC)" wrapper || die "compile wrapper"
+}
+
+src_install() {
+ newbin "${FILESDIR}"/${PN}-${PV} ${PN} || die "install gcc-config"
+ sed -i \
+ -e "s:@GENTOO_LIBDIR@:$(get_libdir):g" \
+ "${D}"/usr/bin/${PN}
+
+ exeinto /usr/$(get_libdir)/misc
+ newexe wrapper gcc-config || die "install wrapper"
+}
+
+pkg_postinst() {
+ # Scrub eselect-compiler remains
+ if [[ -e ${ROOT}/etc/env.d/05compiler ]] ; then
+ rm -f "${ROOT}"/etc/env.d/05compiler
+ fi
+
+ # Make sure old versions dont exist #79062
+ rm -f "${ROOT}"/usr/sbin/gcc-config
+
+ # We not longer use the /usr/include/g++-v3 hacks, as
+ # it is not needed ...
+ [[ -L ${ROOT}/usr/include/g++ ]] && rm -f "${ROOT}"/usr/include/g++
+ [[ -L ${ROOT}/usr/include/g++-v3 ]] && rm -f "${ROOT}"/usr/include/g++-v3
+
+ # Do we have a valid multi ver setup ?
+ local x
+ for x in $(gcc-config -C -l 2>/dev/null | awk '$NF == "*" { print $2 }') ; do
+ gcc-config ${x}
+ done
+}
diff --git a/sys-devel/gcc-config/gcc-config-1.6.ebuild b/sys-devel/gcc-config/gcc-config-1.6.ebuild
new file mode 100644
index 000000000000..e4912368f1a5
--- /dev/null
+++ b/sys-devel/gcc-config/gcc-config-1.6.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit unpacker toolchain-funcs multilib
+
+DESCRIPTION="utility to manage compilers"
+HOMEPAGE="http://cgit.gentoo.org/proj/gcc-config.git"
+SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+src_compile() {
+ emake CC="$(tc-getCC)" || die
+}
+
+src_install() {
+ emake \
+ DESTDIR="${D}" \
+ PV="${PV}" \
+ SUBLIBDIR="$(get_libdir)" \
+ install || die
+}
+
+pkg_postinst() {
+ # Scrub eselect-compiler remains
+ rm -f "${ROOT}"/etc/env.d/05compiler &
+
+ # Make sure old versions dont exist #79062
+ rm -f "${ROOT}"/usr/sbin/gcc-config &
+
+ # We not longer use the /usr/include/g++-v3 hacks, as
+ # it is not needed ...
+ rm -f "${ROOT}"/usr/include/g++{,-v3} &
+
+ # Do we have a valid multi ver setup ?
+ local x
+ for x in $(gcc-config -C -l 2>/dev/null | awk '$NF == "*" { print $2 }') ; do
+ gcc-config ${x}
+ done
+
+ wait
+}
diff --git a/sys-devel/gcc-config/gcc-config-1.7.1.ebuild b/sys-devel/gcc-config/gcc-config-1.7.1.ebuild
new file mode 100644
index 000000000000..c78f8225d49f
--- /dev/null
+++ b/sys-devel/gcc-config/gcc-config-1.7.1.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit unpacker toolchain-funcs multilib
+
+DESCRIPTION="utility to manage compilers"
+HOMEPAGE="http://cgit.gentoo.org/proj/gcc-config.git"
+SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+src_compile() {
+ emake CC="$(tc-getCC)" || die
+}
+
+src_install() {
+ emake \
+ DESTDIR="${D}" \
+ PV="${PV}" \
+ SUBLIBDIR="$(get_libdir)" \
+ install || die
+}
+
+pkg_postinst() {
+ # Scrub eselect-compiler remains
+ rm -f "${ROOT}"/etc/env.d/05compiler &
+
+ # Make sure old versions dont exist #79062
+ rm -f "${ROOT}"/usr/sbin/gcc-config &
+
+ # We not longer use the /usr/include/g++-v3 hacks, as
+ # it is not needed ...
+ rm -f "${ROOT}"/usr/include/g++{,-v3} &
+
+ # Do we have a valid multi ver setup ?
+ local x
+ for x in $(gcc-config -C -l 2>/dev/null | awk '$NF == "*" { print $2 }') ; do
+ gcc-config ${x}
+ done
+
+ wait
+}
diff --git a/sys-devel/gcc-config/gcc-config-1.7.2.ebuild b/sys-devel/gcc-config/gcc-config-1.7.2.ebuild
new file mode 100644
index 000000000000..c78f8225d49f
--- /dev/null
+++ b/sys-devel/gcc-config/gcc-config-1.7.2.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit unpacker toolchain-funcs multilib
+
+DESCRIPTION="utility to manage compilers"
+HOMEPAGE="http://cgit.gentoo.org/proj/gcc-config.git"
+SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+src_compile() {
+ emake CC="$(tc-getCC)" || die
+}
+
+src_install() {
+ emake \
+ DESTDIR="${D}" \
+ PV="${PV}" \
+ SUBLIBDIR="$(get_libdir)" \
+ install || die
+}
+
+pkg_postinst() {
+ # Scrub eselect-compiler remains
+ rm -f "${ROOT}"/etc/env.d/05compiler &
+
+ # Make sure old versions dont exist #79062
+ rm -f "${ROOT}"/usr/sbin/gcc-config &
+
+ # We not longer use the /usr/include/g++-v3 hacks, as
+ # it is not needed ...
+ rm -f "${ROOT}"/usr/include/g++{,-v3} &
+
+ # Do we have a valid multi ver setup ?
+ local x
+ for x in $(gcc-config -C -l 2>/dev/null | awk '$NF == "*" { print $2 }') ; do
+ gcc-config ${x}
+ done
+
+ wait
+}
diff --git a/sys-devel/gcc-config/gcc-config-1.7.3.ebuild b/sys-devel/gcc-config/gcc-config-1.7.3.ebuild
new file mode 100644
index 000000000000..5aa9044ae23a
--- /dev/null
+++ b/sys-devel/gcc-config/gcc-config-1.7.3.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit unpacker toolchain-funcs multilib
+
+DESCRIPTION="utility to manage compilers"
+HOMEPAGE="https://gitweb.gentoo.org/proj/gcc-config.git/"
+SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+src_compile() {
+ emake CC="$(tc-getCC)" || die
+}
+
+src_install() {
+ emake \
+ DESTDIR="${D}" \
+ PV="${PV}" \
+ SUBLIBDIR="$(get_libdir)" \
+ install || die
+}
+
+pkg_postinst() {
+ # Scrub eselect-compiler remains
+ rm -f "${ROOT}"/etc/env.d/05compiler &
+
+ # Make sure old versions dont exist #79062
+ rm -f "${ROOT}"/usr/sbin/gcc-config &
+
+ # We not longer use the /usr/include/g++-v3 hacks, as
+ # it is not needed ...
+ rm -f "${ROOT}"/usr/include/g++{,-v3} &
+
+ # Do we have a valid multi ver setup ?
+ local x
+ for x in $(gcc-config -C -l 2>/dev/null | awk '$NF == "*" { print $2 }') ; do
+ gcc-config ${x}
+ done
+
+ wait
+}
diff --git a/sys-devel/gcc-config/gcc-config-1.7.ebuild b/sys-devel/gcc-config/gcc-config-1.7.ebuild
new file mode 100644
index 000000000000..c78f8225d49f
--- /dev/null
+++ b/sys-devel/gcc-config/gcc-config-1.7.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit unpacker toolchain-funcs multilib
+
+DESCRIPTION="utility to manage compilers"
+HOMEPAGE="http://cgit.gentoo.org/proj/gcc-config.git"
+SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+src_compile() {
+ emake CC="$(tc-getCC)" || die
+}
+
+src_install() {
+ emake \
+ DESTDIR="${D}" \
+ PV="${PV}" \
+ SUBLIBDIR="$(get_libdir)" \
+ install || die
+}
+
+pkg_postinst() {
+ # Scrub eselect-compiler remains
+ rm -f "${ROOT}"/etc/env.d/05compiler &
+
+ # Make sure old versions dont exist #79062
+ rm -f "${ROOT}"/usr/sbin/gcc-config &
+
+ # We not longer use the /usr/include/g++-v3 hacks, as
+ # it is not needed ...
+ rm -f "${ROOT}"/usr/include/g++{,-v3} &
+
+ # Do we have a valid multi ver setup ?
+ local x
+ for x in $(gcc-config -C -l 2>/dev/null | awk '$NF == "*" { print $2 }') ; do
+ gcc-config ${x}
+ done
+
+ wait
+}
diff --git a/sys-devel/gcc-config/gcc-config-1.8-r1.ebuild b/sys-devel/gcc-config/gcc-config-1.8-r1.ebuild
new file mode 100644
index 000000000000..9a2485ad8c06
--- /dev/null
+++ b/sys-devel/gcc-config/gcc-config-1.8-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
+
+inherit eutils unpacker toolchain-funcs multilib
+
+DESCRIPTION="utility to manage compilers"
+HOMEPAGE="https://gitweb.gentoo.org/proj/gcc-config.git/"
+SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}-1.8-dont_source_functions_sh_from_etc_initd.patch" # 504118
+}
+
+src_compile() {
+ emake CC="$(tc-getCC)"
+}
+
+src_install() {
+ emake \
+ DESTDIR="${D}" \
+ PV="${PV}" \
+ SUBLIBDIR="$(get_libdir)" \
+ install
+}
+
+pkg_postinst() {
+ # Scrub eselect-compiler remains
+ rm -f "${ROOT}"/etc/env.d/05compiler &
+
+ # Make sure old versions dont exist #79062
+ rm -f "${ROOT}"/usr/sbin/gcc-config &
+
+ # We not longer use the /usr/include/g++-v3 hacks, as
+ # it is not needed ...
+ rm -f "${ROOT}"/usr/include/g++{,-v3} &
+
+ # Do we have a valid multi ver setup ?
+ local x
+ for x in $(gcc-config -C -l 2>/dev/null | awk '$NF == "*" { print $2 }') ; do
+ gcc-config ${x}
+ done
+
+ wait
+}
diff --git a/sys-devel/gcc-config/gcc-config-1.8.ebuild b/sys-devel/gcc-config/gcc-config-1.8.ebuild
new file mode 100644
index 000000000000..514f61f076af
--- /dev/null
+++ b/sys-devel/gcc-config/gcc-config-1.8.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit unpacker toolchain-funcs multilib
+
+DESCRIPTION="utility to manage compilers"
+HOMEPAGE="https://gitweb.gentoo.org/proj/gcc-config.git/"
+SRC_URI="mirror://gentoo/${P}.tar.xz
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+src_compile() {
+ emake CC="$(tc-getCC)" || die
+}
+
+src_install() {
+ emake \
+ DESTDIR="${D}" \
+ PV="${PV}" \
+ SUBLIBDIR="$(get_libdir)" \
+ install || die
+}
+
+pkg_postinst() {
+ # Scrub eselect-compiler remains
+ rm -f "${ROOT}"/etc/env.d/05compiler &
+
+ # Make sure old versions dont exist #79062
+ rm -f "${ROOT}"/usr/sbin/gcc-config &
+
+ # We not longer use the /usr/include/g++-v3 hacks, as
+ # it is not needed ...
+ rm -f "${ROOT}"/usr/include/g++{,-v3} &
+
+ # Do we have a valid multi ver setup ?
+ local x
+ for x in $(gcc-config -C -l 2>/dev/null | awk '$NF == "*" { print $2 }') ; do
+ gcc-config ${x}
+ done
+
+ wait
+}
diff --git a/sys-devel/gcc-config/metadata.xml b/sys-devel/gcc-config/metadata.xml
new file mode 100644
index 000000000000..fb4199eb7afe
--- /dev/null
+++ b/sys-devel/gcc-config/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-devel/gcc/Manifest b/sys-devel/gcc/Manifest
new file mode 100644
index 000000000000..466ed603a19e
--- /dev/null
+++ b/sys-devel/gcc/Manifest
@@ -0,0 +1,88 @@
+DIST bounds-checking-gcc-3.3.6-1.00-r2.patch.bz2 829688 SHA256 eacdaecd9c07b6573a6522ac776d8daad7658c4214a7fb0ff950cd47ff811ae6 SHA512 d4533d02289dcd2ee11952f83dc687d82624d6e31ddb548e4f54cde4ef9cced5a1aac5b64086441f8930274e31f20d0ee82850fe1257f96c08b05d406d3b2e26 WHIRLPOOL c9d39cef9408472634a689a61e914ea01e6f67294162d16fcd5b451d1b33aed86f842adca8e4995c863ca1ed7a4e5fc0ce68d99a78f1e765cc3caad06ecbf6e9
+DIST bounds-checking-gcc-3.4.4-1.00.1.patch.bz2 815566 SHA256 6568f904eb26ff4bc90e23792b3346aaf98c0ffe38a1abe853d823b3c2157e96 SHA512 da11cb354d5ec95c74081c2cbb29bcb49817a1f9d6875587b4a27f1c9fdea8f07eec8147b739bd18a4fa2365e5da50e4bca7d7531612fbf2514c50516d225ac2 WHIRLPOOL fedeb8ca85af5bcc924243cafde3a96f0ddf69df13a1e2c68a207c0dda3d598af59b49a92c35e104a16f70af86a0027a7630306d23aaf873f48149a64e86347f
+DIST ecj-4.3.jar 1377431 SHA256 9de193ea393ed50d868b730bad6916f7a8ef4ba80216f8606d3e1a0dd886e74b SHA512 c4be72186d81747f1adce5a50de303c24bd6ed9f401bfa8871b1b864fe7591392218b1937b10d0e76014de8e0b6a1d5c4280475976218141cd1878c4a35217ff WHIRLPOOL 9137d6aa5b0e34a596e8d3de8843b5478cec8cdd4113303d554120ba8c6d467e802414f861ff0d7ef1d85dbcb09d4ccc10668385460d1a476345e2de86798bce
+DIST ecj-4.5.jar 1470676 SHA256 98fd128f1d374d9e42fd9d4836bdd249c6d511ebc6c0df17fbc1b9df96c3d781 SHA512 d4e1bf7538ace56e3d69fa91da5bbd16c272923b4de0a9d8dee23ea2b75f9f38c603de72fc4061df49285c450b63f3df211cee5270e9fffc5447445d1a9c9e4e WHIRLPOOL db54206cfd5eba935e707b8d36ebac40f3c4ed3c1f06ede794288cbdd9c7da9d90c0898e8c98b383af276ea4c1b40c861ebd9e1fc1dce712946184321339d3ad
+DIST gcc-2.95.3-patches-1.4.tar.bz2 125654 SHA256 dbbefc926fb07b17eb18d4c8bfa8b8d1d956f4484c19e8afecb0ecb995232886 SHA512 7cc79439162ddf6f5dea4fd88e172e815684a34ed70e67f33c6acf4e1a687a748a78dee232d462adb5858cc3f9609e34cf1b8a75707947f4fcdf3d33251738e5 WHIRLPOOL d10f43b3081eaac83b6e22cb9aa863380415fe73da9e167b9b961b37419161d385e70b4f0fa9bb03399ecf77ff289b58cafd804a510d7366c21496c82ec416f3
+DIST gcc-2.95.3.tar.bz2 9848842 SHA256 cf91a6b4f41248895f06bcd0570a62d2417ee99d32e6e2c5f70490e0eb6af5e4 SHA512 683eafd1788a0021867797796444868100d244f72749dd8f014eb04495554ca43eba852179554710d516ff4b94527f40ff9c9189e007ef6fd958ec7293f17e4d WHIRLPOOL 7605984ae8bd948f116e319a47b668327d0e83c301e4391abb66a72a58868fc90e5c8d3298d9444d4852a0073f71a9f36389add96bc5b54364d7943b397bd027
+DIST gcc-3.3.6-patches-1.9.tar.bz2 51760 SHA256 9759a4dc139c9c739a179fdabff484c8b2d036707f0be03ca54fdb7f7d4ffdb4 SHA512 306220c537c5cd90af7638431e6547ee9a80199c384629b5fbda06c28b2d6168fcf1dd448c0e178b104f41e03a8ebda4f389489d205b9e66ade6637e4747196c WHIRLPOOL 0a49ae8fe42f24c8c0e1a9d7671c462219e501bbe2fb27c78a723889cb084632899403d78230e7618899d2cb639bdeada0d5c577949a87c1d249891cd22a5b01
+DIST gcc-3.3.6-uclibc-patches-1.0.tar.bz2 28882 SHA256 c007f38cb0c57291adf0b367f31e14c84dd1d6f48a388896eb63b6cd4328e418 SHA512 d060c1552d4f21b8b1cd6a6e56b9af4f62f61ce8ef4362afb1982b2ad9defe6a9648705cf780103d4f2061737553b6737c276d79b803b6b75ae94035bc881f0e WHIRLPOOL 524204cc41097f13e0de2ad8e99ff80d449c490d602625d24ddda6b874cf63194d62c22f98469f5ee89c8283df82a25fbc989db32a52f31f2a31928b5a522f2f
+DIST gcc-3.3.6.tar.bz2 23972413 SHA256 1c1aa533c67e9da5e55ed4f5736258dc753466bd716bdae3fb88fb66e6ff1d7f SHA512 576b88e2fa675314a79a85f180684fe5af370c596476a0bf02e33e8ae0e2be838417ea80675ce4194a8213792cf7ada50cae5131149e4b890ab61e0b8d50d0ed WHIRLPOOL 27372f9d12cdedaad38e75c3efea3430d6873d92f85ec0024e2cc5ad986c710ed940edecc926a4c25ce14d14cddc1aec3eb35ac2c29e8c85309685d525a99cf1
+DIST gcc-3.4.5-uclibc-patches-1.1.tar.bz2 70923 SHA256 5b92fac2afe835a127976fdb6602fb5628cf28e67dd19e8289768a3bb8631ec2 SHA512 c0534a374e2e0416d0792373f9d11526226f9ce1a98e771469efa68388b709c72672b8db8fe77901144a96a23e4fd9f9a99f1d278f1e8fffda8a6b01e3b770fa WHIRLPOOL 79a7bb14e220dad7ea818afae12839ff7cc624f128bbf7a29c8005478f6da9742ff08100088baeaf36c038f7ddadc4ec64e78d5283ed19efb4d3625916a3b00a
+DIST gcc-3.4.6-patches-1.8.tar.bz2 61940 SHA256 69822a3b93d8288a1e2c2536c738f0af5ccd286143000c43fecbf62c90861655 SHA512 14c12628e0ccdc47492890a46d45f9ef1df3970d1103116c3c3be76ecf1b3560088232819891662f44d621877b59ed38dab48053885bd34e6516d7de514f42d6 WHIRLPOOL 74e2046a4f04fe1127ae67f29ffdfcd5ff5e0ac27c62e03252a8e754a74bd8f9771d43a53818272f165bcbb38bdc5c15729910f63616fb8494e09dde15f8fd86
+DIST gcc-3.4.6.tar.bz2 28193401 SHA256 7791a601878b765669022b8b3409fba33cc72f9e39340fec8af6d0e6f72dec39 SHA512 d235e1223d5faf8f37f2d73db35edeff44c88974b09dfcf325f4b181b16d7124710d93b1b65b60206ce3525f062236ea0f338b3a5341d7ecbe196d8e90c3ff18 WHIRLPOOL 19fc447592f1feee56da74ee6d9436e0813e5a29ced37f8bf91836bbf0b1b9023fe2f717f8c3cf6dc84f11d2029cd87b65e9176b19727996420b589716cdfa45
+DIST gcc-4.0.4-patches-1.2.tar.bz2 41172 SHA256 d0c1c1f3579cf9105bd63f0a6396f67e6493131d7d2796ac882cade246122de7 SHA512 c4092fac461ffa3b73d59d6529af21ca8c833a1c232daf6a2319a2bc3eb1f1bc10b9af36cef83fd8f5fb23c38bd6d12c566652371164fcdb419840bff04277bf WHIRLPOOL 1ee8c89911af37c90343e1b584cc1b2983e8b9946ada6094b0cbc1f1e242b19ffdc93643d0b4dfafa1a5f09b0155bdc48173f61f93ee7baaf2b64598ed2c936d
+DIST gcc-4.0.4-uclibc-patches-1.0.tar.bz2 20164 SHA256 2f4386f423de421b1171c6312d82be3f646fa249df9672687bf8c37a72d8d1ab SHA512 67bdb8be3b7d173795ae3692f8f76fb6c236bfe3054112db30e3f0a56982685fe0b15e2c37f7d9e15e6198e4a41e47e1434a2befeee4e9e460e7bc9e0fa9d235 WHIRLPOOL f7cc0a984272187e88683683e7c484d6d40cf70efce4ded1ad5cae2849a6a51214280453eb60400d3b43a310a319b39dc8f7f88a5857d69ea91d73e0bfe6b663
+DIST gcc-4.0.4.tar.bz2 32642939 SHA256 f3fde051c96d2fc084f6f4d6114ce4c1a079fcd1247d947d50a3d1641acafc47 SHA512 194c12b5a1bc50c003f6fc849a4c0032388a960fb4b769bdb6e76cf330f04f880a0723661c991ec03742443c21ccba9af8599ae648a0777e0a5875c5fe7f6abd WHIRLPOOL 58749231707c5007f5907ef3916c9f2941bb42e0890d754c9e62692f5e049955a766bae502f233fa1ac084279432b15effa4b632a87c2c50db4f24c070ae9762
+DIST gcc-4.1.2-patches-1.5.tar.bz2 53576 SHA256 63663050343a4840707dd93a29d810f3e0f5be3a24847e5c0952a73ec8cdcc36 SHA512 3c7c15f740ec80aaa6f9c1ad77daeb2a2527f1719fbcc5d96d956e1fe1f24da961b1b030cf2bb631f1a0cc970f6462823e9a78441c9fd6b57f3645b04cd6a362 WHIRLPOOL 8970cb25abf1652af555fcc698cc574a28373462e01cdc7dc33d6850c6fa310e719ccb18c7cd8784e6fc0f6888e4d484547b6ad2ae1b1d82aab557ceafa50c82
+DIST gcc-4.1.2-uclibc-patches-1.0.tar.bz2 20980 SHA256 c6ed88711a727ed11847c9b9f1cef7023037bc80c0840eda5fca6d60fa02e35a SHA512 57789f4236a3085136afa83be3cef677bd813afd258d67bfdbecd2058f497cd459366d5515044c0208ab753946dc951dac6a3889752ca6dae836d837c22ce33b WHIRLPOOL 6a0eee923be11ad415eed56f4acc11480747aff92d97baf083526866d3c7eb63ca1fe51375fa70b9223f863a25e4487ebe9ce9da2acf1bbf6b55c6ad2d1a7010
+DIST gcc-4.1.2.tar.bz2 39707720 SHA256 cfc0efbcc6fcde0d416a32dfb246c9df022515a312683fac412578c4fd09a9bc SHA512 b97d3b72a3b0355611d5090b2c715b7a774f0e466a89326a0226c2809d12dfafb2d7c5a7af54bd5e00c135bbb6596f535e1a484740f7f1f691e8a57e6f0425cc WHIRLPOOL 5822040f7e96919bb906ce55e0bd19c4c85b3a47ce73f0a4b6d0da62ce9d7651b6cbeb6199dafc38582b206a98126e3efec8d54cc58c7f303ca708c9261bec57
+DIST gcc-4.2.4-patches-1.3.tar.bz2 24723 SHA256 d0f18d232be6ccf51d21252b4155a0c9f3d6991ed79f7fabc73de2a9c33fdece SHA512 fc1ad5debf0ba6a755758ff4e2e1b41f3ac753b4a9c600c1525ac99a8f204c511257ee57fa287ff8296fe563859c931f8d5ca252f85656dcf7436571c1c87a06 WHIRLPOOL 59ab8734e53479c293eb225a00d3e92e0c2445f132cd9b2ef59559c0abaedcecfec1066f09e4016b292cc76aa8bd69baa57d764ab8837a8f32630d78d840e3f9
+DIST gcc-4.2.4-uclibc-patches-1.0.tar.bz2 19167 SHA256 45fe49c144db3c23f928f0303a80071145361242566671afc96b6dfea5ece221 SHA512 5545cfe6bfa7ab9a69a474cc051cc8744380077dcc193afefeb455e959e408a5e4dfd1adde5357886c7f598835400273ef80ad5c14976c0552b44f5cd48704ed WHIRLPOOL baa4c6bc76deff38d3f85e7b91f53e6f3785e2d315cd835aa8d4a80b580f43c2fa21046df85f17d8c81f95a91c0fa782078963a2849ee1604f3202c9790b9d27
+DIST gcc-4.2.4.tar.bz2 44025458 SHA256 afba845e2d38547a63bd3976e90245c81ea176786f9e6966339c6d3761f1133a SHA512 c6e3e4fce1d27d0c56ab24f4809367d9329b620b7c124e88de190f2ea2ae57b5e06d0bda85c5a74237a4f94ddba53dc91faea0611fff7b19ad720edc312cb0d9 WHIRLPOOL 242177c7adc1538dfbf0b5519132902479c9a8f21158ed04bcf29a3616bbf98d0cf4def13e602ad0226e745875c327d33e8f45eae1b1e6de6d61e2a0ca1b0b90
+DIST gcc-4.3.6-patches-1.1.tar.bz2 75898 SHA256 919b4e78057764fc37b670e731a7d34dde2b8ec646d096fe69a25aa9b8abe7c8 SHA512 fb586f95a01f921e3364d506a19600ee4431280ecd00ea4ffed40ed67503e904773107b7a1ddf3e572d06d9ef358b3567b41f7edb3ea49217aca103342110b8c WHIRLPOOL 1b0bf0410596b20ddc46b81738f94321164e175d4e8ddd0e14a2d8ebbdd2c4ccf450ce030fe79f1ff44da5c7f0b10924dbfc51535e938c1968234b6e57a28693
+DIST gcc-4.3.6-uclibc-patches-1.0.tar.bz2 3021 SHA256 6ad4c3a5f6c359eaa2b6d1996cb2098c4265d00b7d3a33e9db880301b1166e69 SHA512 6b85bf4caf5662ae114e472199c2f77d1fef63c485c073643968b6e0575c13bfa4ce9a32191908f34e70d41fd9fb5b9bc2b527542d82dac881a0462bfe89b120 WHIRLPOOL a2855f10474da54173930eccdcd9a6afe8bfd54d2d612c4ee1060e0bd68d83cbaa7aef9efc5ec2c329ebdbe903c2bbd7ea589b2b391f896409b8f04df46617a0
+DIST gcc-4.3.6.tar.bz2 59756702 SHA256 f3765cd4dcceb4d42d46f0d53471d7cedbad50f2112f0312c1dcc9c41eea9810 SHA512 0cb43f523135c6d54b3b5e26de7044fe096c16e7c3af8e400b2b48c5e52b4b5aa56615b1eca5e326b0202cf34870daa6ac44ec9633762acafa4425552b4029ee WHIRLPOOL 43694948728163150276be24b386a6ba5c12ade91a3836059f2665e7670ed011216fb144e73fc79de8a16988f77a3d789f781ff595ea241a7f2ba88e4f624306
+DIST gcc-4.4.3-specs-0.2.0.tar.bz2 2004 SHA256 f6c7cb99beead66dd4d06f7004c5731a9360330cbe878ce79792c618e008eed2 SHA512 779ecb0a064d2138b54569c8ae501975b8a6b72e5a3acbf8597619a8db77ee42ef9b0e62608d5192a15e4393e7dfc009bb50b994782236faa744b2c46b5fe517 WHIRLPOOL 8a1e45aad9d306cb19de93c63b5854a97e629d90852feb6861dcfca042b6257705304fc13ad65655a4cb227d36b83fc6063648c94f270821574ee0e85307094e
+DIST gcc-4.4.7-patches-1.2.tar.bz2 23954 SHA256 0b071ed72b33906143e04e1c80c6589a8ad75bc40e693de36970e6d1a536ab4a SHA512 e83f075d66a7a966b0d2139af9b58967228ab0aace59f3fc94a19a351214a7d2783d3639c5c39a485d300ea245b4ca0134df062f267938dbba24377b1bfd9ab4 WHIRLPOOL 9190f3abf40dc10a2a5131fc6d1435bb3ea7e8989aa88325ed5cfd8f14da41ab0e6a6d8898b9c34e23c29434407621f60302048544bb0ef321042b0c12141089
+DIST gcc-4.4.7-uclibc-patches-1.0.tar.bz2 3016 SHA256 f68c52de7aa8b172f7b43c3b576902c3d02ceafdef954cbb76f4fa2e02dd66f2 SHA512 46a69cb8e2e3b97116d012b95a515953b2629be04228a2ac90fe628705e6bc3bdf05ee22e3ed7d5fd0fe6e60aad8f1f96f36e8dd3b231bdfd048e61c6cc15beb WHIRLPOOL f28c1d2b7ede7315e60eef0651580b716ed89f0cfbeac59705537f3cb70ee748eeb3913e0344a40421e27d2aebf3162466178acbc7c8a555e06bd4b3818fa43a
+DIST gcc-4.4.7.tar.bz2 63179340 SHA256 5ff75116b8f763fa0fb5621af80fc6fb3ea0f1b1a57520874982f03f26cd607f SHA512 5562a7319cfd8cc7c5261de9170f2cda86cbd3a231a444a5ec0ad3d8fd60af6f8bd86af8f201cebb7bddcd083d761834d1cbd652c68af0f5607d22a63439ed0e WHIRLPOOL 588dc683b0526d0d9f0b178cab54e30340741a49752097ad4fbbe2da4d7fef5e6d17e321a078726e2797604de280f8ad39309e05eaf6b4cfb0d1e7167c2a0aeb
+DIST gcc-4.5.4-patches-1.2.tar.bz2 22588 SHA256 45ea4e83e6c879d666fd38be5a4c7cce3e5ad756ebd402c664f65702dd2e4750 SHA512 f69c7be5195d4151c3ed1d3fb2913a77bea871554b03f1149ce700bb4cf553edc795cafd637c75305af6ed4079ec698122cac7836ff0f06189f9687ee5565f99 WHIRLPOOL e49f668c567c5427d12720d2d937092cbe323b023c786e25dde5babdcf8a1dfacab9deb82d7702cb67eba1eedb56d83fbe59f853102cad55b33e3d2ff213b270
+DIST gcc-4.5.4-uclibc-patches-1.0.tar.bz2 3019 SHA256 bcfaac58ee057ca9fdbee9295100379051b3b7df8abdf33f24da6cb3c75b4d20 SHA512 b6aa0a7d029a2a00b36fe8906d76b434fcdfc7191cbc8fffbcb8b89a66eba61ba6cd0cfdba94a79929487fbbad2163083b085476498f8be77ad473d078b0095a WHIRLPOOL f3cae558649cdbce9a7dbf0d006845d88349926d1e3d7a4717f2df5c413a1da236b9e35fe0618844578408825b6130533570146c525525a0df18223b3ebf479f
+DIST gcc-4.5.4.tar.bz2 66426133 SHA256 eef3f0456db8c3d992cbb51d5d32558190bc14f3bc19383dd93acc27acc6befc SHA512 78696b287d46aacd6f150920da376ea32f58ad9f0dafd2d3b7fa6dbdd8dd7afe659108d1dfaa5807617fc5248719f50b39c37ade0173ea5b9fec2091f4656115 WHIRLPOOL 1d3aa5f344171a75144118101bf475536940eeb80f73849827ee4103c52dfb6504d9b26e21fa0984c65c5e6267e02fa6e7f8ef539c44f45470790781080aadca
+DIST gcc-4.6.4-patches-1.3.tar.bz2 16443 SHA256 0ff58a1142164ccbcc172470945812343d467da3ba0cdfa338deef75252316b8 SHA512 ed904bb8438a23a2e1ec3aff28c4451128421426305ff07de50edbad51a066bee9d1a9042a9b26c36dbd57e1eb044a474088945d6d780c6e98d7563947fb9b9a WHIRLPOOL 0fbcb26fdde71415e492f86d5bdf4605ebea283192426f121f6d34c2401b093a06ef0eae61c64abee653621efb1611ef39902d535ee8742061af8459131632d5
+DIST gcc-4.6.4-piepatches-v0.5.2.tar.bz2 14888 SHA256 a6a853197fb0de66c07e6183e686dbdb1f4b55108efd4c8363662cb2b971f43c SHA512 2fd1993b0dc7fc2096e17198f70ff6328ac4d3b7c0db597e3bc119df10eb0b9744f8e6cc659ae1ddd8afdb14f94cb85fdd12033a5d76026c7f84aca44ce9c9b8 WHIRLPOOL 61babd71167114a3f8579e8fb4bba5ed0c217cff4f3760b89de8a67d69c05de43b49bd9f567e6417b69874a878ecdc0e98d807a0e25a9dc80ef5c67594e15a0d
+DIST gcc-4.6.4-uclibc-patches-1.0.tar.bz2 3010 SHA256 946334cc62c0afa2f50a435dffbed12fd32c170f0850bbdce47df188a1eb8918 SHA512 fd289089a30c768b0ec4e3459cf494bc5e9d4ecf87056dc183277c712f7d69ac4cf900950270d8eacfe686b4aa906e1ece87cae52f2cb00642e96c0b95dcf133 WHIRLPOOL 2ce7f308a21fb5072d08a640390eb3f453ad8d811df897b0f9d3e917eef4680fce6cce231159ffe96e371f3c299264eaa51cd110124a3a126f04fb6d8531639e
+DIST gcc-4.6.4.tar.bz2 72006076 SHA256 35af16afa0b67af9b8eb15cafb76d2bc5f568540552522f5dc2c88dd45d977e8 SHA512 b5a5395782e0b9e61cda052f6e00c8575d1aa0b7e8db9e34c06e4e45f12ff37b436018536b7fa69a04a4235b5b368895652e3ed8fab2fe11763f9782ed9161dc WHIRLPOOL ab1b035f43aec669640b36037e65ae0edceb3b13b1ce4f7900aeff5ee06686dc2d66c3dd81156f53c4e9a9a806e4becd4462f72a6c4ad7e646b632c10c23356c
+DIST gcc-4.7.4-patches-1.4.tar.bz2 18072 SHA256 cef0f9d5624fd583eddffe060fb882e2e3b7ed43e517e03df7b3472189237327 SHA512 9f5d68ba62aee909023542dcece81e4e448ea750254258107d4f70291d8ae99469c4518e42ffddbe6b622b258f463127be6e6ef7eaaeeeb0f59b3b719f3eadca WHIRLPOOL a5d76b577615de7a472f591bc031552f7b3e4dec7fb58385709235d763d416f47c2fa8ff4c73531ad023ee50dfd25b1e0c1752dbdca4ae19f736cc79428d63bd
+DIST gcc-4.7.4-piepatches-v0.5.5.tar.bz2 15358 SHA256 6b568bd204e3ffb177df1830e5a888be3987491b4183bdb6ad75ad83c642a348 SHA512 f5e078bf4c17f7b5be102f1e3358d91c72e80363b5e055a92461f78399a1bf27bf6cb690d41900719bb260b6529f5d1aac999e613fda6ac5e4efa27f622510e6 WHIRLPOOL 42e348d5925cf4d43697a6dc06c911cc617f89037949ce1d8f7aa0fa93405f460e7416d6cd00e8fb2aac54c6f26fcae00691917f1517fcfb6891925efa3d3400
+DIST gcc-4.7.4-uclibc-patches-1.0.tar.bz2 3019 SHA256 cbdfe2947f653e11ac391dded461416e5cef1ff8900cf8fe92672de797b4018b SHA512 c2e6c96b74365f8233f6106fa03d94075b60f6f77c683aa2e27aceb007da723243f8e3ddea8b178e6a0f7939b8e35615165534dc74e5050f87680ab261a31c52 WHIRLPOOL 53c8bd64336eb55d8e3d62a33267d3d99c0239d5c818985a9830fd776d766aabf4b0bce630949c5b522580566e2eeba1b59bfc1b8388dee7ec6c990512d2c499
+DIST gcc-4.7.4.tar.bz2 82935453 SHA256 92e61c6dc3a0a449e62d72a38185fda550168a86702dea07125ebd3ec3996282 SHA512 dfcb737073191e628231031a3571ec77ee760a59377630f4a6e4fdfa66f9ddad39fde47e3f0f227eb43cdf90e0d34cde5abdc9ac892c1e111a911062a66c9189 WHIRLPOOL df8408e80634ce28f105f9abcdcf38fba5c130795cbe48428527a68819abebc3bc7152bb6ad714e40c71450a08986b48ddd630c887e1b2faf07c3babfe720969
+DIST gcc-4.8.0-patches-1.3.tar.bz2 17577 SHA256 3b1a6996e6849734ffaaa1ad67b565da04481aa6341a56034402c85b1a3946b8 SHA512 e4e6da9598575142c3c4a772d11c128d3dd2be425684b4ca7207df12e72801910b045f49d12f0a02813935c79b3c528d8dcde518039495c04357f26240d5c6e7 WHIRLPOOL dd09d9d6bc004a3768d294f58551cc43029793edf6b520a581b86f039244e605e5800cfc0f2d560ae28e328557ddfde6a6eedcf618962535fed40b793d4d27ec
+DIST gcc-4.8.0-piepatches-v0.5.5.tar.bz2 14278 SHA256 644727a87c372c9e371b823a43432e39257716dcb9e49fb61b69692beb456639 SHA512 780d12fc33b491b964cc20029e9cb7648ce789e13d731bfe5305a130ce4d69da9f53f3acccf8d28cf0e8eafa41e90bd73fcffbc52f0d6d20b4ba89868267f777 WHIRLPOOL 8f82402850059124a049aa21a19cb7d83c4da27695a4c1eaa58bf0e45d638344737d66cbdb07ecd29215a48ec67cad79ae3685069d7574571d04f36ef972a853
+DIST gcc-4.8.0-uclibc-patches-1.0.tar.bz2 3010 SHA256 0300927d938d5d0baccf7cc63d6be71dbb73a5c9d1efaf9f06bace87d7267dcd SHA512 25b82b0860c14b876920a18257b6348161b768e9583eabb5179ed3a3d924bb74fef615ad458beff6c89bc4d0cf723bbd9702cd8bca9e73b60adc82c196def382 WHIRLPOOL 5ae9e33dc382c7d1816d92d0a6b55191f922dec9f023bab0bcb51cbb0ce267c27874670ddc484144c122a204319b55a7dbe0f10c6a13e6390c4015f134d8b712
+DIST gcc-4.8.0.tar.bz2 86663646 SHA256 b037fe5132b71ecad2ea7141ec92292b5d32427bf90fd90cde432b1d5abacc2c SHA512 8a59f1a67e557eb719961a217bdb6a05b4b3abfc792f4bddee536c46fc3cc8472126e0f7531fa473acfce525a59bbd581ade97d068caf7308dfb2296f8861826 WHIRLPOOL ad966de5e75c817ea4aec9076a16198e91108e1e67c413bda839235692cbd1626e85a5e76206b8889884790d4d282650662a3e0b024893a3422bf0bfc04b46a2
+DIST gcc-4.8.1-patches-1.2.tar.bz2 17431 SHA256 964aed7e2c317be99eacbd0f4e7e619094f47ab48eb8844935c9a2c0a89d6bd6 SHA512 fec4237249021bfe040c148a72bf74df7f939baeafb804c87d9f0897c41e660bd8053d338ea994810a3c44c76d5eaa9269292f88b3603ab0d0a925c5073657d1 WHIRLPOOL 6bf6e4fc75536d9b0477780ba64a9ab8f2d6bc1000fb34e21dfe40e26e49b8ef9469370fcc5360f72dc780e3a187319e2f18fbc24fae3f294ff6983b32931666
+DIST gcc-4.8.1-piepatches-v0.5.7.tar.bz2 14260 SHA256 3edd9c0592716a5cd544af470c61448a0c5cb81d15ce0bfcf77e660a15546e60 SHA512 e471c852340cac7acef4540d0e2c266039e284952ec14cdb39cc732fd3572fed47f4912389f658916d9cb300ecd29d52734f2b7c003ef7acb33567af0211688c WHIRLPOOL fb95580a4969f3b447a4097d0ff86d243c71546e145ed7c290110a55339c2367fee2cb3f36b6a8c64e0f07d04c7a512f191eb2d7ab9e93aa759a8fd01d514317
+DIST gcc-4.8.1-uclibc-patches-1.0.tar.bz2 3004 SHA256 365b114f9fff51950a20870edeca0679bd0942ae4fe5d68b8ddc8e488d550aeb SHA512 b79ef258b0dc82286a5e246f7e02c3fe54f4445fe0ce723263853ce1f92a0c9fad4c254e09664d31472de7a7a6eb8e96225bc3a5613dd572ff1037d8c1668220 WHIRLPOOL 76f7485a01c0e81f9c20108c94ea40bcb6f7e739d2f5632eed92c1a2f3778cd620df2b9a663520ca6978c468d0ab6548f491c4ce515924f1e666798f002fee71
+DIST gcc-4.8.1.tar.bz2 86753166 SHA256 545b44be3ad9f2c4e90e6880f5c9d4f0a8f0e5f67e1ffb0d45da9fa01bb05813 SHA512 1becc874aad77a469069b6d9da4158aae9e013e24afa9364fe4feff9a5094d0673ee7694b3840e892c860f73a56b3ece6174338a8214438c42b9f86dd6c35ea7 WHIRLPOOL c706fa4445bbf4b9503c78b7e03da6adeadc3c736d208edb65059ddf23a08875dfa1ac92ccaafb3dd72ecbceb15a0de5814c62104fb94f99032232fbc50ab82c
+DIST gcc-4.8.2-patches-1.3r1.tar.bz2 18855 SHA256 1718dd57ca9fbe445ede0abadacc73d652a3543a598728c901f98144640eb993 SHA512 9e62d9192728efba7b23f2a3b4263a1658373d3dfb027b8b056e3eed8c74a1b94834573eb786475dee754dacc65c1974b2a80035098b42d767bd654aba825754 WHIRLPOOL a0afb80efdac5a77438cd4df5c78f1871c829cd08006657ec9a8fe0b173ad46875d024e3dfbd84aa3e9ac7b0c945f00ad996f8bea2684f25f3d93ede6bf76a3c
+DIST gcc-4.8.2-piepatches-v0.5.8r1.tar.bz2 14061 SHA256 cf4a945642be8b591805b1089025bd466f4e70d849d9e6dae63848fa750f1b83 SHA512 8e86448c3e251367869a766dd1805d2cf43a8b7da32f15a23c1443ff669336d892ced4ca01b378e79e177b7838ed917c46d6eb992c768bcad76df35da721492c WHIRLPOOL 2aabe13aed7c89bf63f1c3fc605f44ff5edf2a8addbc2baf96ed4711154253f2dc35d54d72e5fb0c797c489a35febb898facddb4a17413110fb8e12d1e20e411
+DIST gcc-4.8.2-uclibc-patches-1.0.tar.bz2 3014 SHA256 040343c06826356b57aabf54bdf6f962cb6173d36c9a1cc63be1238f9a3c7877 SHA512 933894112b937ddbecb66028489f61ef19ac323cbce8d9a13fa32f4325e608feca53f3570a173141d30c9b9dbe1dc3ace6dbff4814cefc1721b2f7a0d1adfd4b WHIRLPOOL f17f3c14bbaf639afc2408d3b1f1132acb191a7953196970aa499087afa62fb28e3a9eb0d0b32e98effd8bca72d474bd3cc96c12b2668062b6c666332a734ecc
+DIST gcc-4.8.2.tar.bz2 85999682 SHA256 09dc2276c73424bbbfda1dbddc62bbbf900c9f185acf7f3e1d773ce2d7e3cdc8 SHA512 2a3927481707b3bb7171076b596d9b69084edac82460df6fb35395592dd1e8fc5665577702ca746d5b454dec68b1c4e31b9de6adc9865d482f4b8736ec648b10 WHIRLPOOL 5ebe564faf13634e7f2744dc13421ce0a3faa06b35d425f4b6983e74a4e93b4c21955823013f7a5530e7ea9e9d0ecfd68cb79950e94333ed3e44aaa4dfbdefe7
+DIST gcc-4.8.3-patches-1.1.tar.bz2 19882 SHA256 019cbe76f20f4e294b900ccb99a6b52553ed04fa0d2993798b3a07b0e4a8f90a SHA512 8512ec54fb2d482e08ca54042e11c6334d653ec850cc7c920ed95654575222ac0303caa35cd46e80f1985d86cd229f35e26e0eaca1ae623fd8d336940148801c WHIRLPOOL d7b8d6278b6f79aa00fcd29ed6142cad3002def33edb0be44e638d50cb3b1fa8da72fa62a7276c81c94cd873c872dd0e7fd602022420d9601fde8f2b04872ece
+DIST gcc-4.8.3-piepatches-v0.5.9.tar.bz2 13310 SHA256 d08e3770453edb728216243ecaf639ff7bc8aa77560fffdd561b2a0859d0b869 SHA512 d9d7dc4b7d8f52cce48dff36ee32db5346baed50968a1cacafa9a426849c5df5387061b26c8a0d2363bf91e5f55cb459cb4a176c5652690f914916047c0437f8 WHIRLPOOL 1e5cb3556b695de7f42ab44636194e86128f80bdffbe049fc1d4ee17b772bc1ea2089b3fe88bec60c52aab4bf5301344be27fd11be3c6cc8ef798d6441285c8b
+DIST gcc-4.8.3-uclibc-patches-1.0.tar.bz2 3014 SHA256 75f089ed44e33be8923f82eaa1d231f71d2cded475fb10938eded386647c5e04 SHA512 7e74fefae6136d2e132ee37905adbdf7f528d31a7bb67ed97bc99b6208f177a6105ef0f0e0c77eb87368359f7da49de768ff98ec07a569e19bfdd00f67a445a8 WHIRLPOOL 6fd766ba280fc0b96f1823315b5098a36d361dc9c8d179b2e262d72156508b70c560ef5095f3556bb5c922e495cc7eefb4bd5d970b2e4dff9e9ce654703fddc5
+DIST gcc-4.8.3.tar.bz2 86126808 SHA256 6a8e4f11b185f4fe2ed9d7fc053e80f8c7e73f800c045f51f9d8bea33f080f1e SHA512 2b40d231e8445f9c1654137df509f09ce1187b475138ca7f648f710d922a1718f740b2d8a37c26e16b5e27900c60358be98229ae884a6f1f70e9df44ad24d02b WHIRLPOOL 6dd3bd4b51bb9b8c52fb743bba28cde8612ff7090b71e56bf02d3613b91cd4c3c4dd91dbcb672985f22400d776870ba55550e1fc44afae9737092ceca5f83ebd
+DIST gcc-4.8.4-patches-1.6.tar.bz2 26041 SHA256 a7c543351ef7fe81a6c6a8cde7a0c8351935841b85a4799a2e0bd2dc9c6f4d7b SHA512 077e07f5af576ec05e4db7399eb4070da52b0060443ce1f73f2b9ac981318fb20abaf2e898a3b4c612dec3fe07b24ecd0fd0a0ecdd3609ad21bec77f67225aae WHIRLPOOL f9d5feb257c24a5222b8a52c4cd9d828e8efb3595acb5c0c7367a3980a473c065aae64600ec8fc29954f68fa628641d68b2663eec45ddbbbbcd27a7dc775f8a1
+DIST gcc-4.8.4-piepatches-v0.6.1.tar.bz2 14110 SHA256 558bd1babcd687979ef6269b8e4774a3a06b860bda44e0a8aafaaa55423574b4 SHA512 464c7c482a244f6e3d07beb0bbe6d007bb95502d76d08dbb9daca92bcdb4560571f85eb10a73f542a03d1c7ba90fd1e50cfb8220f933ef559ff6f7867bc8bbdc WHIRLPOOL cc3ab1819905a32dd5983d1fae5c6812343c1426ec3ef387c56eaf46c73c646e376ae6351a151bd5579393be5055a231cb94e29ab03051f729ad4c685e69b77f
+DIST gcc-4.8.4-uclibc-patches-1.0.tar.bz2 3004 SHA256 c7f9d3b7eba23a8042edad469a5e2a2a7ad613a7a6b6c658179409d7859edf41 SHA512 0e22e57731725f2d2a53c7137ee667a54ff92d30a7532660bc75220e2445452605e3e377b56b99bc3a62feb65d46b315f28aba3e075ffabd1e9d60e94e35b4af WHIRLPOOL 472cdbd2c7f77ce6505f6f5feb27d530edc5250d6e167ecd4a8ab1cd877abf4ae842f4785c55486bddb49e2e553c688c24a6d7e998cb211cde844b9867436c09
+DIST gcc-4.8.4.tar.bz2 86220648 SHA256 4a80aa23798b8e9b5793494b8c976b39b8d9aa2e53cd5ed5534aff662a7f8695 SHA512 b4c84ebd754c026029d706ef52c4242df4dcadc6a22cc5669b3aa37ac9dc25bc9cd9651fda83fb24dd5d17b1710e6865a35bb6c5cd9b95d0971717453935ae8e WHIRLPOOL b8b44413da420d083d0edcb846ad1b619971c399638e629089ca3bc8b6008a41bd38d688199f1451171d32443c37ab749f44a3763c5150f2147f729d4bd45a4b
+DIST gcc-4.8.5-patches-1.0.tar.bz2 23865 SHA256 0be07a40afb3a7cf8ed52cec11ed3e33bdc3a6576244993598950a8ff1d709bb SHA512 a6d98d44a7d707d6c545a5e7a89ad837d24717c45fd3e06cc28fc54480f4061f2a66962fcbd2406f88560e383c3da65c907606c2e194223bd0e11190b9749bee WHIRLPOOL f2b4ec090fffac515bace64fd6a4c7e8a098a0bee973dea1e378c0c8532b2de0a611f2a4add0e7f6ec1705ee1b0c8ab77d8733da38a1a679bdfab0c1dbf5de1c
+DIST gcc-4.8.5-piepatches-v0.6.1.tar.bz2 14104 SHA256 e4933788ab3daf641204eb3d9b3e26a87506264384208255b6cc4e95f8457955 SHA512 6b9bc8d5f649b34e7966d078c4477a71f1a9d10cc18465b1f5a0c30e704ccb4c43958741f6338da523919510c6bd01ff08c2251c0f6d4d0cbb6b64f39655f412 WHIRLPOOL 6d50f1a9e2eb0f886ec9594b6aa6c3d4b095d1b9d775f24df5da9615a671e463c1265ffc2a1248f5f72afa386504a02b6e4c5610b210a7eb07cf747b29e00ab7
+DIST gcc-4.8.5-uclibc-patches-1.0.tar.bz2 2976 SHA256 3654cc2bb47173b9d40650374c465a0798faab53be5ee4446389af1acd610a27 SHA512 5469128eab06525915c75241797ad9ec4b63072ebfd5e110319bf810633cf3fbed39bbda4f6a0c74e537b248e7642780ecbe2086ad10be6e66b7dd289fa6534f WHIRLPOOL d5e11a7d83d11455d84deaa464b8cde0865c730cc140daa5d7b0e700a79f188c6efba88b1c5704b20ede2dca701fb88cf581bada2f4352fbd0e0a5571c436612
+DIST gcc-4.8.5.tar.bz2 86165587 SHA256 22fb1e7e0f68a63cee631d85b20461d1ea6bda162f03096350e38c8d427ecf23 SHA512 47fdfeca0c0a624cdec9c4ae47137d056c918d5c386d4b96985bb3c8172aba377cb66cbcc30e80832fd244a7d98f562c20198056915c70cfef0977545073a8ea WHIRLPOOL 026253cd2f3706871dfe2525c0302b38b3f513f6a62666d0ba0ca2e62d6513f09ad5c1177f2a63ae3bad660fe60e7909b6930d26df2b367b9ec68e14552c6e11
+DIST gcc-4.9.0-patches-1.0.tar.bz2 19806 SHA256 153098c2b577671ca81c58208b0482d000dc409686b3e57f9e9167415776d5fe SHA512 15d0a67a14994f177864f88474cffde3fcb4720817df51fb5787ebf5966714de72611225fe0614b9a7af2fe40292face1fb6e8446432b43a3e03907324047b1f WHIRLPOOL 56d436639c5ef7d779d6aaa85109e5e13f94a42ececd5f32472efac28bf47b848f746d467bb0702cef4cb4bd65bbfd1833e93256136f586127a3025f2a104abb
+DIST gcc-4.9.0-piepatches-v0.6.0.tar.bz2 13471 SHA256 2c4db53e6d58872d082acb261055ce094a956ef95483472327e147c0b6fecd74 SHA512 072b2be02aab8bfd71c5388ea9f6a068d47c0cf409172670c5d9a25ab72accfd1db12d61719a675337a57a318f16294ff9dae0d7f2d304fb8a8b89c9ab42df93 WHIRLPOOL db1f5d8e1a6ce7787f6caffd6fa2b49ce88f1e2ddddaabe044e2ae93185b7b85db3f5fdff6d6bfc1178d7005a0c154c5d72dca17142362c622369793673fec0e
+DIST gcc-4.9.0-uclibc-patches-1.0.tar.bz2 2559 SHA256 723370aaea06f7bc2601acae802cf8c456c6c7e83f9c08f57a8013be410c9e87 SHA512 e0a1a09bf2bc6b76f4f6c35c5cb653b1b0c8fbc40528a60b9c692016cc2fba04b60ba40126879f8648af8bc0fa1b1f03fac9820274b47764932e7ff3f3c12883 WHIRLPOOL d03d30ce77f51c544f0ad9cacbbff9eacad1a93746c5cc63752a40dd08a92a1e069edaf08c2a81ccd23911cd59fe1f90cc1ba61789426c7646adce1e55d4bb67
+DIST gcc-4.9.0.tar.bz2 89677407 SHA256 b9b047a97bade9c1c89970bc8e211ff57b7b8998a1730a80a653d329f8ed1257 SHA512 5e02ea96ad2a43da85e03a81d0731842affd0a9fcb85566434d1a5add95d16df4808169490a1d618785e361834e669d37cb58654c9370d5060600e322eb2bb28 WHIRLPOOL fcef189c1c24fb787b2bd380c0dbb6b24f0e2fc8738447636c5aac6a75f92431fccb8e2e82cbc087ddd19ea8ad0dfda6b04159483acc47bd69db63a386749a55
+DIST gcc-4.9.1-patches-1.0.tar.bz2 18918 SHA256 5addded7684318fd7ad16dba5a1407c27938ba803cec29b5376c32aaf432a36e SHA512 ade6f02a5d26f201c9d5a01da1174f803309358e49e9b93c848a4239f90b6301bc863951af25daf0188d68088fe8a02653391453158c1846751ddf2f286ee9da WHIRLPOOL 3b5f0f39c925d379a2db35b5335ed3fd7d456fd19fdeb315c87ba307e3ab6e8e8ebf29f8db894c43e3ea26a4318d4ca7ff47c635351a7f38aaa2afc33e3016cc
+DIST gcc-4.9.1-piepatches-v0.6.0.tar.bz2 13473 SHA256 299c63324cad10492709f46b84c8d20e16b20b95eea9c1b80401becb2ea3960e SHA512 2d314ebacb82b85f04618f38ebb521747a58f6baba311c0fbc8164cff46093f8477ad0954c7b3a65f61b9085854aac15ec5d4ee35a6ca95b1570869570458e1e WHIRLPOOL 43b4634e1d5e796ef265ff54d73908f3de2de692a7ea4de47e75b1a81ad8401b77bab14ed8fedcb02b689a4930a0915e63f0d2a0a4943da17c108953afa3e2af
+DIST gcc-4.9.1-uclibc-patches-1.0.tar.bz2 2552 SHA256 7f9bdbd0755ef6c5635261ed8a63b976f3e00f7b261a71e8b1da0bfc81cb8673 SHA512 9f1450167b3c7e29af1a4adaf09efb79e8e8937a6a315f661cf5db2074402747aaf60c1551f8517e394cfae738732dcd74c7f9693adea9299f2a72341d21e59a WHIRLPOOL e4a3fc96e892ef8fa6dd99294edff6c3fd7294655d9761f187879582cbcc823b8eba6d616d51cdd899495525d4821e882ad15dc22c060511f44fe600771fd9a8
+DIST gcc-4.9.1.tar.bz2 89854120 SHA256 d334781a124ada6f38e63b545e2a3b8c2183049515a1abab6d513f109f1d717e SHA512 8598106a4b7c03bb4d6e29fa1bfa9ee6b6390d1f1bca86c1ccd27aed830ae1d126daa50c4041016cbfa76090dd66c51f1ce06958b8ccd6c3be51eae875125593 WHIRLPOOL 45c663aca6fe3212cf6ff34611df3041204b942aedf5005b133f6ab4c40c994d405a9356429a06279b533706960d8ef80f363dd4ee7e78848052e621c49ad681
+DIST gcc-4.9.2-patches-1.5.tar.bz2 24651 SHA256 140a825d625476c5c419a56578ead57cb47c18d8b9907784d0f2b0ec9ab1a8fa SHA512 b3447b6d3ed45779fe34a961fcd12b4d11700569adee3e9d604a52376982e3461c47a2275a2b203862542f2ac7d7b5938f1b04cb216d4684d9c79834cea22c27 WHIRLPOOL 661eb18b59517759e4b3a64ba6c32fccc502fd3e120fb7c869c781f85dc2de5f7232dff4f98ee60da1cdd59c32a6b14c6e3cf4efd67e0a0078e0bd9b7899343b
+DIST gcc-4.9.2-piepatches-v0.6.2.tar.bz2 14278 SHA256 f8876b172c2b4c5936b2cb18d3f092bfda8891bcdedcb569b63272a8530d81d0 SHA512 3f2d48743abba258ee6e298fc085f38d54c7b4cf4d431fe2efb83f718bdac3be916e67a3273aff1573db076decefbf4de3c4f706e102e6aafbce2371256048d8 WHIRLPOOL 76bbecad6d23793139040446721a5fb4711a9e272cf12545c51dd85c2d900e09e34dc0c260b80ad190a8072b475d779f5c6dd6b7891124bc4963b366f40989d3
+DIST gcc-4.9.2-uclibc-patches-1.0.tar.bz2 2540 SHA256 3ca63cba5edb01367352fcd558890a838630deb4c30f82f4c7e8074ad75e57fc SHA512 69f6f80e23efee0b937fca0f2056e17b4fe643817d2394bbfd16cbb453d74c76a0bb8727815f689a795897d9cd5e06ecc74d3d9ad45175fe837ad008eee09706 WHIRLPOOL 3946513e83960fe891267e103e434cae0616cd45b5e7eaff5f4f671741c1445941cf80b7497231cf50f137941c01859dbbac0a95745fb7ae663a3ee512bd7162
+DIST gcc-4.9.2.tar.bz2 89939747 SHA256 2020c98295856aa13fda0f2f3a4794490757fc24bcca918d52cc8b4917b972dd SHA512 e96cba06d572dbe7f382a2b00fd9297dcf9f9219d46a9ad0bd904dc36d5e7db3335e422640b79a27fed6fde91b0731732b94a0e2fbcd47344d6779f8ba1f4f9c WHIRLPOOL c4afdd0ec98e6f903044f1d3061fd96cf1e9bcbe2f90c388f5bc9ff8b2493b94367e84fdff7c2075ba37e2f950ecf2dba7c11786c653c2c7e86a5e8ff7d98e85
+DIST gcc-4.9.3-patches-1.1.tar.bz2 23426 SHA256 bc522080480fa1e189a9e6e49329f6c7b341d8e12140957ff43f8bdea530f49e SHA512 e78360f183027c44f1edab5dba1653e0088db6db094fbe102eeaa9f060ce0f8fc5b34b2ce31d2e1c40938d29dc4489bf20c003d27ae00d6acca38d6074080434 WHIRLPOOL b52fcb5cbc5797fbbda8bfb1187771706eda82e8a8706dd71c74cd51b88ea418afc481885c6bd4209d9c53a5877450721ac41752aa479609db304dd9bc672de4
+DIST gcc-4.9.3-piepatches-v0.6.2.tar.bz2 14261 SHA256 c92de44a4c79ffdd59fc78ebfb5262cd26171808e34f6cb77646c314fe4bc82e SHA512 26f273877926353758f922447c282a8bf30d42c3f34d35c04feee175506a1e06fe18cbc63bbb3a3f744cfa9b449feec3223af251c12f8784565ff90364dc65f2 WHIRLPOOL a9c5d1fc389630c4f46b82b9bccb0049fd3eefe77d11e2cb6f4227050df809932b12fa2ce9b6451d08af084ef03c003d007c5963ad99c26990a3fdfd801c7dbf
+DIST gcc-4.9.3-uclibc-patches-1.0.tar.bz2 2515 SHA256 dd19904d4ab005ef142056228f326e75b3d4d79b8056189a505129b5940a575c SHA512 825092620a3c554ef06219fd1152c3677f1456315563b9e65282a73096e75600389e93298ed76cad41ce3eeecc6a7009ca722585b93c04095bd2d0a06c4404e6 WHIRLPOOL 0c184a5cc74f80a61f354ee85bc5a0f5b44d93bc9fa2e1892fbfe899958cfa5263b8b72cc4f905bc69bd1cc90cf870a6056c4003ec493b815646a72a0fe2e44e
+DIST gcc-4.9.3.tar.bz2 90006707 SHA256 2332b2a5a321b57508b9031354a8503af6fdfb868b8c1748d33028d100a8b67e SHA512 9ac57377a6975fc7adac704ec81355262b9f537def6955576753b87715470a20ee6a2a3144a79cc8fcba3443f7b44c7337d79d704b522d053f54f79aa6b442df WHIRLPOOL 085e4cc1825b031652cbe9e098671f761acfeca64c6cc9b8ad2a8961c13fcac9e02b4538b44dc38181a355266f2c55c99ce5a1bff3f2860b870285cf3f0e84a5
+DIST gcc-5.1.0-patches-1.2.tar.bz2 23076 SHA256 151ac719599fd7b8bd9663e2f105fdd4a082411729c81fd38efb0f9724bf6b7d SHA512 eb509e25c0f4fe2d1b3d8dd191efbbd9336c899d1615d057bf68390ecbbf3e208e9ef8a89c0d225961fa9adff9577c6bfe84362b2b871fa59636a0c9d0799d44 WHIRLPOOL 1882b9b4de8ec49a38e0d3222fdae75a5c73c1e846e7fe88b2cea75a64359f6787881ee7126a338d604673a0c2214384600d2746f723017fe4c87d0421909582
+DIST gcc-5.1.0-piepatches-v0.6.3.tar.bz2 14363 SHA256 85841929655d9bfce92676acc681f29935b16b95ad260fa6726fadf6382fa81b SHA512 a3d5a7df114b17eba6d8de7cc1c20c67264a821a3032c04c80344ea74b18af7a8db000c353016ab9e0f795b4efd65dba39506ca28f11b5a8e3039984eca1fb8a WHIRLPOOL f72fd4260d2f85a4f95fe347b86e626f2df20aee7af26e6fce1a5437362cef3479af9938a240e97fd4ad821a143ebca55a9ba7579f95988c3dc5f68005f98a92
+DIST gcc-5.1.0-uclibc-patches-1.0.tar.bz2 2531 SHA256 1e8557d6b9952ff3e16d16b11b8e5dbae33bd37539d24d771436a7dc3a6e948f SHA512 e90aa58111368d5e6fbeb4818ecf5485ea4cefe5f3c4906c207c977b93e2b182f26987e955d03f988f59e5f056cdd71dde65f50ddb9909f8d1fac92383a3a6cf WHIRLPOOL bc04762db9b1324bd837c1e3fe440f787a7e38dae0e7eee099eefadda6a927f894246586608520a11fab138ffc825084b9d03e6e2065f8860accc2d3c803d778
+DIST gcc-5.1.0.tar.bz2 94954411 SHA256 b7dafdf89cbb0e20333dbf5b5349319ae06e3d1a30bf3515b5488f7e89dca5ad SHA512 30f6a94d3adb25bc51fcaddf32a6c41429f569eeb9ed64330445b1296f99998fbfa03277b375be4f7b2b80f519910ef88e4149db7cd9031e2c61a49f501bde94 WHIRLPOOL c824ab1b4a801d11ca184ab93b3d7ec195dc0d869204cda08d6239b22832b597431f7eac3e22ffb1f13c2e4a6ef85edb3a954ad5b7754c447aa3fa6fccc21e63
+DIST gcc-5.2.0-patches-1.0.tar.bz2 21214 SHA256 afc738cc07c845b72640e9ec2ea3c60b088e6878335dfac898893917cf3defbe SHA512 1ca7dc57eec6f4701beb4ab4f59cca05512eae86316e618c1af47a1373191aa1dfa276084b20a030bc6e354c1c497ffe0f81a1b52fa7ff4bf07543d1fb82ae07 WHIRLPOOL 0448ca8e9a2fe8f4732a6e82aa25977f0b3490731d3d4b3062f90ed235e29125a79abc8a2e9d3c2c34c64c636e11afbc2a788ebaaae8e5c6b07fc4c85f314754
+DIST gcc-5.2.0-piepatches-v0.6.3.tar.bz2 14365 SHA256 3fecd00c85d6106895752d790489a7d436408d5f338e441cf85f7190b8bcf538 SHA512 34e8de0172ab2b78693a177a5528d33f62bce7686976d8e7ec031b485343ed55d2005f4674fdf976db1108b239e3a87295dead8163511f3c6a7b442b724fa74e WHIRLPOOL 78eb16763038a4738934fe1754d75297360da28e890370af66c509887afdc76e3c5472dfd69ebc6ddade1098e6d4860901a0c13da5a58fcc253ceb21fbe6c02d
+DIST gcc-5.2.0-uclibc-patches-1.0.tar.bz2 2540 SHA256 ea39ee6ec3453039884c5e2bdfadc5a2848c8e7e72b5e4e54987a75808efac5d SHA512 50ff10d7dd1830a82fe7b35d28b626ab78a6c30c719a8a4940acf04b64269f5a6e3aa71bb3ea5a2aec17f898c10f30b4a29570ce23d3b996c52b4bc5c451f8eb WHIRLPOOL b200b0dca6485e2485d64cc4fd6896be0aee2727ee4a524b4411cf5d8b22fe5788615ecb162f5dd263822c1cdecf0959ea134ad10a19750ee78874e24b518a47
+DIST gcc-5.2.0.tar.bz2 95221552 SHA256 5f835b04b5f7dd4f4d2dc96190ec1621b8d89f2dc6f638f9f8bc1b1014ba8cad SHA512 844120349ec04465dcea52d8ec747f1cbbc9d76a39fe3d8ef5e6b93614e63d718862d60d0a1c1cbf59ffc7815562287d0a2e536a6b220cebcd0b8de4ba35e715 WHIRLPOOL 17cb8627c970d58b2526b01125a4578602bd3b5ba92b66395ffd9b4c6823eb412ea9d8a2995603d645d0f69d000e6e3f626b1467c4c31185a887cacf3a71429b
+DIST gdc-0.24-src.tar.bz2 1012099 SHA256 cc6a97c76c9e6db31e76ff97014d24b3d43e21f018a3c6218e3fb2a4500fc79a SHA512 9aec7e4b102e602dfb61cd09ea4b4a96af637ceb3d726235261d09ebd35dbd416abcbfe0e46918e48474bd241fe9bb29abc145a65aa834669295aaee4fca0686 WHIRLPOOL 22322b0c3e2d67b3b37bd7fa92a29c593688f934d4ffd62b9cc87eb63a44a4f8bbc9d75cadf11209c73bdc9942c9b4430036629d0eefcd04de9055c502b85f12
diff --git a/sys-devel/gcc/files/3.3.4/libffi-without-libgcj.patch b/sys-devel/gcc/files/3.3.4/libffi-without-libgcj.patch
new file mode 100644
index 000000000000..507d42f00e90
--- /dev/null
+++ b/sys-devel/gcc/files/3.3.4/libffi-without-libgcj.patch
@@ -0,0 +1,22 @@
+--- configure.in.old 2004-06-26 07:01:06.000000000 +0200
++++ configure.in 2004-06-26 07:02:55.000000000 +0200
+@@ -52,8 +52,7 @@
+ host_tools="texinfo byacc flex bison binutils ld gas gcc sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool grep diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils snavigator libtool gettext zip fastjar"
+
+ # libgcj represents the runtime libraries only used by gcj.
+-libgcj="target-libffi \
+- target-boehm-gc \
++libgcj="target-boehm-gc \
+ target-zlib \
+ target-qthreads \
+ target-libjava"
+@@ -66,7 +65,8 @@
+ target-newlib \
+ ${libstdcxx_version} \
+ target-libf2c \
+- ${libgcj}
++ ${libgcj} \
++ target-libffi \
+ target-libobjc"
+
+ # these tools are built using the target libs, and are intended to run only
diff --git a/sys-devel/gcc/files/3.4.3/libffi-nogcj-lib-path-fix.patch b/sys-devel/gcc/files/3.4.3/libffi-nogcj-lib-path-fix.patch
new file mode 100644
index 000000000000..b5195e4e9112
--- /dev/null
+++ b/sys-devel/gcc/files/3.4.3/libffi-nogcj-lib-path-fix.patch
@@ -0,0 +1,40 @@
+diff -ur gcc-3.4.3/libffi/Makefile.in gcc-3.4.3-ffi-fixes/libffi/Makefile.in
+--- gcc-3.4.3/libffi/Makefile.in 2003-11-22 08:41:32.000000000 -0500
++++ gcc-3.4.3-ffi-fixes/libffi/Makefile.in 2004-11-28 17:31:50.000000000 -0500
+@@ -89,7 +89,7 @@
+ libffi_basedir = @libffi_basedir@
+ tool_include_dir = @tool_include_dir@
+ toolexecdir = @toolexecdir@
+-toolexeclibdir = @toolexeclibdir@
++toolexeclibdir = @toolexeclibdir@/@gcc_version@
+
+ AUTOMAKE_OPTIONS = cygnus
+
+diff -ur gcc-3.4.3/libffi/configure gcc-3.4.3-ffi-fixes/libffi/configure
+--- gcc-3.4.3/libffi/configure 2004-05-18 05:08:39.000000000 -0400
++++ gcc-3.4.3-ffi-fixes/libffi/configure 2004-11-28 17:48:19.000000000 -0500
+@@ -3800,8 +3800,8 @@
+ toolexecdir='$(exec_prefix)/$(target_alias)'
+ toolexeclibdir='$(toolexecdir)/lib'
+ else
+- toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
+- toolexeclibdir='$(libdir)'
++ toolexecdir='$(libdir)/gcc/$(target_alias)'
++ toolexeclibdir='$(libdir)/gcc/$(target_alias)/$(gcc-version)'
+ fi
+ multi_os_directory=`$CC -print-multi-os-directory`
+ case $multi_os_directory in
+diff -ur gcc-3.4.3/libffi/configure.in gcc-3.4.3-ffi-fixes/libffi/configure.in
+--- gcc-3.4.3/libffi/configure.in 2004-04-27 01:10:19.000000000 -0400
++++ gcc-3.4.3-ffi-fixes/libffi/configure.in 2004-11-28 17:40:30.000000000 -0500
+@@ -225,8 +225,8 @@
+ toolexecdir='$(exec_prefix)/$(target_alias)'
+ toolexeclibdir='$(toolexecdir)/lib'
+ else
+- toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
+- toolexeclibdir='$(libdir)'
++ toolexecdir='$(libdir)/gcc/$(target_alias)'
++ toolexeclibdir='$(libdir)/gcc/$(target_alias)/$(gcc_version)'
+ fi
+ multi_os_directory=`$CC -print-multi-os-directory`
+ case $multi_os_directory in
diff --git a/sys-devel/gcc/files/3.4.3/libffi-without-libgcj.patch b/sys-devel/gcc/files/3.4.3/libffi-without-libgcj.patch
new file mode 100644
index 000000000000..b270a06ad80d
--- /dev/null
+++ b/sys-devel/gcc/files/3.4.3/libffi-without-libgcj.patch
@@ -0,0 +1,40 @@
+--- configure.in.orig 2004-08-03 00:53:36.000000000 +0200
++++ configure.in 2004-08-03 00:52:35.000000000 +0200
+@@ -136,8 +136,7 @@
+ host_tools="texinfo byacc flex bison binutils gas ld gcc sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils gettext zip fastjar"
+
+ # libgcj represents the runtime libraries only used by gcj.
+-libgcj="target-libffi \
+- target-boehm-gc \
++libgcj="target-boehm-gc \
+ target-zlib \
+ target-qthreads \
+ target-libjava"
+@@ -150,6 +150,7 @@
+ target-libstdc++-v3 \
+ target-libf2c \
+ ${libgcj} \
++ target-libffi \
+ target-libobjc"
+
+ # these tools are built using the target libraries, and are intended to
+--- configure~ 2004-08-28 02:31:04.000000000 +0200
++++ configure 2004-08-28 10:55:28.000000000 +0200
+@@ -876,8 +876,7 @@
+ host_tools="texinfo byacc flex bison binutils gas ld gcc sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils gettext zip fastjar"
+
+ # libgcj represents the runtime libraries only used by gcj.
+-libgcj="target-libffi \
+- target-boehm-gc \
++libgcj="target-boehm-gc \
+ target-zlib \
+ target-qthreads \
+ target-libjava"
+@@ -891,6 +890,7 @@
+ target-libstdc++-v3 \
+ target-libf2c \
+ ${libgcj} \
++ target-libffi \
+ target-libobjc"
+
+ # these tools are built using the target libraries, and are intended to
diff --git a/sys-devel/gcc/files/3.4.4/gcc-3.4.4-cross-compile.patch b/sys-devel/gcc/files/3.4.4/gcc-3.4.4-cross-compile.patch
new file mode 100644
index 000000000000..03895434d9ba
--- /dev/null
+++ b/sys-devel/gcc/files/3.4.4/gcc-3.4.4-cross-compile.patch
@@ -0,0 +1,63 @@
+Some notes on the 'bootstrap with or without libc headers' debate:
+http://linuxfromscratch.org/pipermail/lfs-dev/2005-July/052409.html
+http://gcc.gnu.org/ml/gcc/2005-07/msg01195.html
+
+--- gcc/config/sh/linux.h
++++ gcc/config/sh/linux.h
+@@ -145,6 +145,7 @@
+ /* Do code reading to identify a signal frame, and set the frame
+ state data appropriately. See unwind-dw2.c for the structs. */
+
++#ifndef inhibit_libc
+ #ifdef IN_LIBGCC2
+ #include <signal.h>
+ #include <sys/ucontext.h>
+@@ -295,6 +296,7 @@
+
+ #endif /* defined (__SH5__) */
+ #endif /* IN_LIBGCC2 */
++#endif /* inhibit_libc */
+
+ /* For SH3 and SH4, we use a slot of the unwind frame which correspond
+ to a fake register number 16 as a placeholder for the return address
+--- gcc/config/i386/linux.h
++++ gcc/config/i386/linux.h
+@@ -208,6 +208,7 @@
+ /* Do code reading to identify a signal frame, and set the frame
+ state data appropriately. See unwind-dw2.c for the structs. */
+
++#ifndef inhibit_libc
+ #ifdef IN_LIBGCC2
+ /* There's no sys/ucontext.h for some (all?) libc1, so no
+ signal-turned-exceptions for them. There's also no configure-run for
+@@ -272,3 +273,4 @@
+ } while (0)
+ #endif /* not USE_GNULIBC_1 */
+ #endif /* IN_LIBGCC2 */
++#endif /* inhibit_libc */
+--- gcc/config/alpha/linux.h
++++ gcc/config/alpha/linux.h
+@@ -73,6 +73,7 @@
+ /* Do code reading to identify a signal frame, and set the frame
+ state data appropriately. See unwind-dw2.c for the structs. */
+
++#ifndef inhibit_libc
+ #ifdef IN_LIBGCC2
+ #include <signal.h>
+ #include <sys/ucontext.h>
+@@ -122,3 +123,4 @@
+ (FS)->retaddr_column = 64; \
+ goto SUCCESS; \
+ } while (0)
++#endif /* inhibit_libc */
+--- gcc/config.gcc
++++ gcc/config.gcc
+@@ -321,7 +321,7 @@
+ need_64bit_hwint=yes
+ ;;
+ # Note the 'l'; we need to be able to match e.g. "shle" or "shl".
+-sh[123456789l]*-*-*)
++sh[123456789lbe]*-*-*)
+ cpu_type=sh
+ need_64bit_hwint=yes
+ ;;
diff --git a/sys-devel/gcc/files/4.1.0/gcc-4.1.0-cross-compile.patch b/sys-devel/gcc/files/4.1.0/gcc-4.1.0-cross-compile.patch
new file mode 100644
index 000000000000..523caa48a3c8
--- /dev/null
+++ b/sys-devel/gcc/files/4.1.0/gcc-4.1.0-cross-compile.patch
@@ -0,0 +1,40 @@
+Some notes on the 'bootstrap with or without libc headers' debate:
+http://linuxfromscratch.org/pipermail/lfs-dev/2005-July/052409.html
+http://gcc.gnu.org/ml/gcc/2005-07/msg01195.html
+
+--- gcc/unwind-dw2.c
++++ gcc/unwind-dw2.c
+@@ -253,9 +253,11 @@
+ }
+ #endif
+
++#ifndef inhibit_libc
+ #ifdef MD_UNWIND_SUPPORT
+ #include MD_UNWIND_SUPPORT
+ #endif
++#endif
+
+ /* Extract any interesting information from the CIE for the translation
+ unit F belongs to. Return a pointer to the byte after the augmentation,
+--- gcc/configure
++++ gcc/configure
+@@ -12857,7 +12857,7 @@ then
+ | powerpc*-*-*,powerpc64*-*-*)
+ CROSS="$CROSS -DNATIVE_CROSS" ;;
+ esac
+-elif test "x$TARGET_SYSTEM_ROOT" != x; then
++elif test "x$TARGET_SYSTEM_ROOT" != x -o $build != $host; then
+ SYSTEM_HEADER_DIR=$build_system_header_dir
+ fi
+
+--- gcc/configure.ac
++++ gcc/configure.ac
+@@ -1717,7 +1717,7 @@ then
+ | powerpc*-*-*,powerpc64*-*-*)
+ CROSS="$CROSS -DNATIVE_CROSS" ;;
+ esac
+-elif test "x$TARGET_SYSTEM_ROOT" != x; then
++elif test "x$TARGET_SYSTEM_ROOT" != x -o $build != $host; then
+ SYSTEM_HEADER_DIR=$build_system_header_dir
+ fi
+
diff --git a/sys-devel/gcc/files/4.1.0/gcc-4.1.0-fast-math-i386-Os-workaround.patch b/sys-devel/gcc/files/4.1.0/gcc-4.1.0-fast-math-i386-Os-workaround.patch
new file mode 100644
index 000000000000..6090d66d132d
--- /dev/null
+++ b/sys-devel/gcc/files/4.1.0/gcc-4.1.0-fast-math-i386-Os-workaround.patch
@@ -0,0 +1,64 @@
+workaround for lame stack packing on i386 ...
+
+ - build gcc with -Os (crtfastmath.o to be specific)
+ - crtfastmath.o is installed into gcc libdir
+ - run gcc with -ffast-math and get crtfastmath.o linked in
+ - resulting compiled app segfaults due to init code in
+ crtfastmath.o that has mis-aligned structure on stack
+
+http://bugs.gentoo.org/147020
+http://gcc.gnu.org/PR28621
+
+this is supposed to be fixed in current 4.1 branch, but i'm unable to get
+the fix to work so until i can figure out what i'm doing wrong, we'll use
+this workaround for now.
+
+--- gcc-4.1.1/gcc/config/i386/crtfastmath.c
++++ gcc-4.1.1/gcc/config/i386/crtfastmath.c
+@@ -37,6 +37,23 @@
+ #define FXSAVE (1 << 24)
+ #define SSE (1 << 25)
+
++struct
++{
++ unsigned short int cwd;
++ unsigned short int swd;
++ unsigned short int twd;
++ unsigned short int fop;
++ long int fip;
++ long int fcs;
++ long int foo;
++ long int fos;
++ long int mxcsr;
++ long int mxcsr_mask;
++ long int st_space[32];
++ long int xmm_space[32];
++ long int padding[56];
++} __attribute__ ((aligned (16))) fxsave;
++
+ static void __attribute__((constructor))
+ set_fast_math (void)
+ {
+@@ -75,22 +92,6 @@
+ if (edx & FXSAVE)
+ {
+ /* Check if DAZ is available. */
+- struct
+- {
+- unsigned short int cwd;
+- unsigned short int swd;
+- unsigned short int twd;
+- unsigned short int fop;
+- long int fip;
+- long int fcs;
+- long int foo;
+- long int fos;
+- long int mxcsr;
+- long int mxcsr_mask;
+- long int st_space[32];
+- long int xmm_space[32];
+- long int padding[56];
+- } __attribute__ ((aligned (16))) fxsave;
+
+ __builtin_memset (&fxsave, 0, sizeof (fxsave));
+
diff --git a/sys-devel/gcc/files/awk/fixlafiles.awk b/sys-devel/gcc/files/awk/fixlafiles.awk
new file mode 100644
index 000000000000..ad2c2b1bb09a
--- /dev/null
+++ b/sys-devel/gcc/files/awk/fixlafiles.awk
@@ -0,0 +1,314 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+#
+# Helper functions
+#
+function printn(string) {
+ printf("%s", string)
+}
+function einfo(string) {
+ printf(" \033[32;01m*\033[0m %s\n", string)
+}
+function einfon(string) {
+ printf(" \033[32;01m*\033[0m %s", string)
+}
+function ewarn(string) {
+ printf(" \033[33;01m*\033[0m %s\n", string)
+}
+function ewarnn(string) {
+ printf(" \033[33;01m*\033[0m %s", string)
+}
+function eerror(string) {
+ printf(" \033[31;01m*\033[0m %s\n", string)
+}
+
+#
+# assert(condition, errmsg)
+# assert that a condition is true. Otherwise exit.
+#
+function assert(condition, string) {
+ if (! condition) {
+ printf("%s:%d: assertion failed: %s\n",
+ FILENAME, FNR, string) > "/dev/stderr"
+ _assert_exit = 1
+ exit 1
+ }
+}
+
+#
+# system(command, return)
+# wrapper that normalizes return codes ...
+#
+function dosystem(command, ret) {
+ ret = 0
+ ret = system(command)
+ if (ret == 0)
+ return 1
+ else
+ return 0
+}
+
+BEGIN {
+ #
+ # Get our variables from environment
+ #
+ OLDVER = ENVIRON["OLDVER"]
+ OLDCHOST = ENVIRON["OLDCHOST"]
+
+ if (OLDVER == "") {
+ eerror("Could not get OLDVER!");
+ exit 1
+ }
+
+ # Setup some sane defaults
+ LIBCOUNT = 2
+ HAVE_GCC34 = 0
+ DIRLIST[1] = "/lib"
+ DIRLIST[2] = "/usr/lib"
+
+ #
+ # Walk /etc/ld.so.conf to discover all our library paths
+ #
+ pipe = "cat /etc/ld.so.conf | sort 2>/dev/null"
+ while(((pipe) | getline ldsoconf_data) > 0) {
+ if (ldsoconf_data !~ /^[[:space:]]*#/) {
+ if (ldsoconf_data == "") continue
+
+ # Remove any trailing comments
+ sub(/#.*$/, "", ldsoconf_data)
+ # Remove any trailing spaces
+ sub(/[[:space:]]+$/, "", ldsoconf_data)
+
+ # If there's more than one path per line, split
+ # it up as if they were sep lines
+ split(ldsoconf_data, nodes, /[:,[:space:]]/)
+
+ # Now add the rest from ld.so.conf
+ for (x in nodes) {
+ # wtf does this line do ?
+ sub(/=.*/, "", nodes[x])
+ # Prune trailing /
+ sub(/\/$/, "", nodes[x])
+
+ if (nodes[x] == "") continue
+
+ #
+ # Drop the directory if its a child directory of
+ # one that was already added ...
+ # For example, if we have:
+ # /usr/lib /usr/libexec /usr/lib/mozilla /usr/lib/nss
+ # We really just want to save /usr/lib /usr/libexec
+ #
+ CHILD = 0
+ for (y in DIRLIST) {
+ if (nodes[x] ~ "^" DIRLIST[y] "(/|$)") {
+ CHILD = 1
+ break
+ }
+ }
+ if (CHILD) continue
+
+ DIRLIST[++LIBCOUNT] = nodes[x]
+ }
+ }
+ }
+ close(pipe)
+
+ #
+ # Get line from gcc's output containing CHOST
+ #
+ pipe = "gcc -print-file-name=libgcc.a 2>/dev/null"
+ if ((!((pipe) | getline TMP_CHOST)) || (TMP_CHOST == "")) {
+ close(pipe)
+
+ # If we fail to get the CHOST, see if we can get the CHOST
+ # portage thinks we are using ...
+ pipe = "/usr/bin/portageq envvar 'CHOST'"
+ assert(((pipe) | getline CHOST), "(" pipe ") | getline CHOST")
+ } else {
+ # Check pre gcc-3.4.x versions
+ CHOST = gensub("^.+lib/gcc-lib/([^/]+)/[0-9]+.+$", "\\1", 1, TMP_CHOST)
+
+ if (CHOST == TMP_CHOST || CHOST == "") {
+ # Check gcc-3.4.x or later
+ CHOST = gensub("^.+lib/gcc/([^/]+)/[0-9]+.+$", "\\1", 1, TMP_CHOST);
+
+ if (CHOST == TMP_CHOST || CHOST == "")
+ CHOST = ""
+ else
+ HAVE_GCC34 = 1
+ }
+ }
+ close(pipe)
+
+ if (CHOST == "") {
+ eerror("Could not get gcc's CHOST!")
+ exit 1
+ }
+
+ if (OLDCHOST != "")
+ if (OLDCHOST == CHOST)
+ OLDCHOST = ""
+
+ GCCLIBPREFIX_OLD = "/usr/lib/gcc-lib/"
+ GCCLIBPREFIX_NEW = "/usr/lib/gcc/"
+
+ if (HAVE_GCC34)
+ GCCLIBPREFIX = GCCLIBPREFIX_NEW
+ else
+ GCCLIBPREFIX = GCCLIBPREFIX_OLD
+
+ GCCLIB = GCCLIBPREFIX CHOST
+
+ if (OLDCHOST != "") {
+ OLDGCCLIB1 = GCCLIBPREFIX_OLD OLDCHOST
+ OLDGCCLIB2 = GCCLIBPREFIX_NEW OLDCHOST
+ }
+
+ # Get current gcc's version
+ pipe = "gcc -dumpversion"
+ assert(((pipe) | getline NEWVER), "(" pipe ") | getline NEWVER)")
+ close(pipe)
+
+ if (NEWVER == "") {
+ eerror("Could not get gcc's version!")
+ exit 1
+ }
+
+ # Nothing to do ?
+ if ((OLDVER == NEWVER) && (OLDCHOST == ""))
+ exit 0
+
+ #
+ # Ok, now let's scan for the .la files and actually fix them up
+ #
+ for (x = 1; x <= LIBCOUNT; x++) {
+ # Do nothing if the target dir is gcc's internal library path
+ if (DIRLIST[x] ~ GCCLIBPREFIX_OLD ||
+ DIRLIST[x] ~ GCCLIBPREFIX_NEW)
+ continue
+
+ einfo(" [" x "/" LIBCOUNT "] Scanning " DIRLIST[x] " ...")
+
+ pipe = "find " DIRLIST[x] "/ -name '*.la' 2>/dev/null"
+ while (((pipe) | getline la_files) > 0) {
+
+ # Do nothing if the .la file is located in gcc's internal lib path
+ if (la_files ~ GCCLIBPREFIX_OLD ||
+ la_files ~ GCCLIBPREFIX_NEW)
+ continue
+
+ CHANGED = 0
+ CHOST_CHANGED = 0
+
+ # See if we need to fix the .la file
+ while ((getline la_data < (la_files)) > 0) {
+ if (OLDCHOST != "") {
+ if ((gsub(OLDGCCLIB1 "[/[:space:]]+",
+ GCCLIB, la_data) > 0) ||
+ (gsub(OLDGCCLIB2 "[/[:space:]]+",
+ GCCLIB, la_data) > 0)) {
+ CHANGED = 1
+ CHOST_CHANGED = 1
+ }
+ }
+ if (OLDVER != NEWVER) {
+ if ((gsub(GCCLIBPREFIX_OLD CHOST "/" OLDVER "[/[:space:]]*",
+ GCCLIB "/" NEWVER, la_data) > 0) ||
+ (gsub(GCCLIBPREFIX_NEW CHOST "/" OLDVER "[/[:space:]]*",
+ GCCLIB "/" NEWVER, la_data) > 0))
+ CHANGED = 1
+ }
+ }
+ close(la_files)
+
+ # Do the actual changes in a second loop, as we can then
+ # verify that CHOST_CHANGED among things is correct ...
+ if (CHANGED) {
+ ewarnn(" FIXING: " la_files " ...")
+
+ if (CHANGED)
+ printn("[")
+
+ # Clear the temp file (removing rather than '>foo' is better
+ # out of a security point of view?)
+ dosystem("rm -f " la_files ".new")
+
+ while ((getline la_data < (la_files)) > 0) {
+ if (OLDCHOST != "") {
+ tmpstr = gensub(OLDGCCLIB1 "([/[:space:]]+)",
+ GCCLIB "\\1", "g", la_data)
+ tmpstr = gensub(OLDGCCLIB2 "([/[:space:]]+)",
+ GCCLIB "\\1", "g", tmpstr)
+
+ if (la_data != tmpstr) {
+ printn("c")
+ la_data = tmpstr
+ }
+
+ if (CHOST_CHANGED > 0) {
+ # We try to be careful about CHOST changes outside
+ # the gcc library path (meaning we cannot match it
+ # via /GCCLIBPREFIX CHOST/) ...
+
+ # Catch:
+ #
+ # dependency_libs=' -L/usr/CHOST/{bin,lib}'
+ #
+ gsub("-L/usr/" OLDCHOST "/",
+ "-L/usr/" CHOST "/", la_data)
+ # Catch:
+ #
+ # dependency_libs=' -L/usr/lib/gcc-lib/CHOST/VER/../../../../CHOST/lib'
+ #
+ la_data = gensub("(" GCCLIB "/[^[:space:]]+)/" OLDCHOST "/",
+ "\\1/" CHOST "/", "g", la_data)
+ }
+ }
+
+ if (OLDVER != NEWVER) {
+ # Catch:
+ #
+ # dependency_libs=' -L/usr/lib/gcc/CHOST/VER'
+ #
+ tmpstr = gensub(GCCLIBPREFIX_OLD CHOST "/" OLDVER "([/[:space:]]+)",
+ GCCLIB "/" NEWVER "\\1", "g", la_data)
+ tmpstr = gensub(GCCLIBPREFIX_NEW CHOST "/" OLDVER "([/[:space:]]+)",
+ GCCLIB "/" NEWVER "\\1", "g", tmpstr)
+
+ if (la_data != tmpstr) {
+ # Catch:
+ #
+ # dependency_libs=' -L/usr/lib/gcc-lib/../../CHOST/lib'
+ #
+ # in cases where we have gcc34
+ tmpstr = gensub(GCCLIBPREFIX_OLD "(../../" CHOST "/lib)",
+ GCCLIBPREFIX "\\1", "g", tmpstr)
+ tmpstr = gensub(GCCLIBPREFIX_NEW "(../../" CHOST "/lib)",
+ GCCLIBPREFIX "\\1", "g", tmpstr)
+ printn("v")
+ la_data = tmpstr
+ }
+ }
+
+ print la_data >> (la_files ".new")
+ }
+
+ if (CHANGED)
+ print "]"
+
+ close(la_files)
+ close(la_files ".new")
+
+ assert(dosystem("mv -f " la_files ".new " la_files),
+ "dosystem(\"mv -f " la_files ".new " la_files "\")")
+ }
+ }
+
+ close(pipe)
+ }
+}
+
+# vim:ts=4
diff --git a/sys-devel/gcc/files/awk/fixlafiles.awk-no_gcc_la b/sys-devel/gcc/files/awk/fixlafiles.awk-no_gcc_la
new file mode 100644
index 000000000000..2776c72abbc5
--- /dev/null
+++ b/sys-devel/gcc/files/awk/fixlafiles.awk-no_gcc_la
@@ -0,0 +1,335 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+#
+# Helper functions
+#
+function printn(string) {
+ printf("%s", string)
+}
+function einfo(string) {
+ printf(" \033[32;01m*\033[0m %s\n", string)
+}
+function einfon(string) {
+ printf(" \033[32;01m*\033[0m %s", string)
+}
+function ewarn(string) {
+ printf(" \033[33;01m*\033[0m %s\n", string)
+}
+function ewarnn(string) {
+ printf(" \033[33;01m*\033[0m %s", string)
+}
+function eerror(string) {
+ printf(" \033[31;01m*\033[0m %s\n", string)
+}
+
+#
+# assert(condition, errmsg)
+# assert that a condition is true. Otherwise exit.
+#
+function assert(condition, string) {
+ if (! condition) {
+ printf("%s:%d: assertion failed: %s\n",
+ FILENAME, FNR, string) > "/dev/stderr"
+ _assert_exit = 1
+ exit 1
+ }
+}
+
+#
+# system(command, return)
+# wrapper that normalizes return codes ...
+#
+function dosystem(command, ret) {
+ ret = 0
+ ret = system(command)
+ if (ret == 0)
+ return 1
+ else
+ return 0
+}
+
+#
+# parse_ld_conf(config_file)
+#
+function parse_ld_conf(conf, pipe, ldsoconf_data, CHILD, y) {
+ pipe = "cd /etc; cat " conf " | sort 2>/dev/null"
+ while(((pipe) | getline ldsoconf_data) > 0) {
+ if (ldsoconf_data ~ /^[[:space:]]*#/)
+ continue
+ if (ldsoconf_data == "")
+ continue
+
+ # Handle the "include" keyword
+ if (ldsoconf_data ~ /^include /) {
+ sub(/^include /, "", ldsoconf_data)
+ parse_ld_conf(ldsoconf_data)
+ continue
+ }
+
+ # Remove any trailing comments
+ sub(/#.*$/, "", ldsoconf_data)
+ # Remove any trailing spaces
+ sub(/[[:space:]]+$/, "", ldsoconf_data)
+ # Eat duplicate slashes
+ sub(/\/\//, "/", ldsoconf_data)
+ # Prune trailing /
+ sub(/\/$/, "", ldsoconf_data)
+
+ #
+ # Drop the directory if its a child directory of
+ # one that was already added ...
+ # For example, if we have:
+ # /usr/lib /usr/libexec /usr/lib/mozilla /usr/lib/nss
+ # We really just want to save /usr/lib /usr/libexec
+ #
+ CHILD = 0
+ for (y in DIRLIST) {
+ if (ldsoconf_data ~ "^" DIRLIST[y] "(/|$)") {
+ CHILD = 1
+ break
+ }
+ }
+ if (CHILD) continue
+
+ DIRLIST[++LIBCOUNT] = ldsoconf_data
+ }
+ close(pipe)
+}
+
+BEGIN {
+ #
+ # Get our variables from environment
+ #
+ OLDVER = ENVIRON["OLDVER"]
+ OLDCHOST = ENVIRON["OLDCHOST"]
+
+ if (OLDVER == "") {
+ eerror("Could not get OLDVER!");
+ exit 1
+ }
+
+ # Setup some sane defaults
+ LIBCOUNT = 2
+ HAVE_GCC34 = 0
+ DIRLIST[1] = "/lib"
+ DIRLIST[2] = "/usr/lib"
+
+ #
+ # Walk /etc/ld.so.conf to discover all our library paths
+ #
+ parse_ld_conf("/etc/ld.so.conf")
+
+ #
+ # Get line from gcc's output containing CHOST
+ #
+ pipe = "gcc -print-file-name=libgcc.a 2>/dev/null"
+ if ((!((pipe) | getline TMP_CHOST)) || (TMP_CHOST == "")) {
+ close(pipe)
+
+ # If we fail to get the CHOST, see if we can get the CHOST
+ # portage thinks we are using ...
+ pipe = "/usr/bin/portageq envvar 'CHOST'"
+ assert(((pipe) | getline CHOST), "(" pipe ") | getline CHOST")
+ } else {
+ # Check pre gcc-3.4.x versions
+ CHOST = gensub("^.+lib/gcc-lib/([^/]+)/[0-9]+.+$", "\\1", 1, TMP_CHOST)
+
+ if (CHOST == TMP_CHOST || CHOST == "") {
+ # Check gcc-3.4.x or later
+ CHOST = gensub("^.+lib/gcc/([^/]+)/[0-9]+.+$", "\\1", 1, TMP_CHOST);
+
+ if (CHOST == TMP_CHOST || CHOST == "")
+ CHOST = ""
+ else
+ HAVE_GCC34 = 1
+ }
+ }
+ close(pipe)
+
+ if (CHOST == "") {
+ eerror("Could not get gcc's CHOST!")
+ exit 1
+ }
+
+ if (OLDCHOST != "")
+ if (OLDCHOST == CHOST)
+ OLDCHOST = ""
+
+ GCCLIBPREFIX_OLD = "/usr/lib/gcc-lib/"
+ GCCLIBPREFIX_NEW = "/usr/lib/gcc/"
+
+ if (HAVE_GCC34)
+ GCCLIBPREFIX = GCCLIBPREFIX_NEW
+ else
+ GCCLIBPREFIX = GCCLIBPREFIX_OLD
+
+ GCCLIB = GCCLIBPREFIX CHOST
+
+ if (OLDCHOST != "") {
+ OLDGCCLIB1 = GCCLIBPREFIX_OLD OLDCHOST
+ OLDGCCLIB2 = GCCLIBPREFIX_NEW OLDCHOST
+ }
+
+ # Get current gcc's version
+ pipe = "gcc -dumpversion"
+ assert(((pipe) | getline NEWVER), "(" pipe ") | getline NEWVER)")
+ close(pipe)
+
+ if (NEWVER == "") {
+ eerror("Could not get gcc's version!")
+ exit 1
+ }
+
+ # Nothing to do ?
+ # NB: Do not check for (OLDVER == NEWVER) anymore, as we might need to
+ # replace libstdc++.la ....
+ if ((OLDVER == "") && (OLDCHOST == ""))
+ exit 0
+
+ #
+ # Ok, now let's scan for the .la files and actually fix them up
+ #
+ for (x = 1; x <= LIBCOUNT; x++) {
+ # Do nothing if the target dir is gcc's internal library path
+ if (DIRLIST[x] ~ GCCLIBPREFIX_OLD ||
+ DIRLIST[x] ~ GCCLIBPREFIX_NEW)
+ continue
+
+ einfo(" [" x "/" LIBCOUNT "] Scanning " DIRLIST[x] " ...")
+
+ pipe = "find " DIRLIST[x] "/ -name '*.la' 2>/dev/null"
+ while (((pipe) | getline la_files) > 0) {
+
+ # Do nothing if the .la file is located in gcc's internal lib path
+ if (la_files ~ GCCLIBPREFIX_OLD ||
+ la_files ~ GCCLIBPREFIX_NEW)
+ continue
+
+ CHANGED = 0
+ CHOST_CHANGED = 0
+
+ # See if we need to fix the .la file
+ while ((getline la_data < (la_files)) > 0) {
+ if (OLDCHOST != "") {
+ if ((gsub(OLDGCCLIB1 "[/[:space:]]+",
+ GCCLIB, la_data) > 0) ||
+ (gsub(OLDGCCLIB2 "[/[:space:]]+",
+ GCCLIB, la_data) > 0)) {
+ CHANGED = 1
+ CHOST_CHANGED = 1
+ }
+ }
+ if (OLDVER != NEWVER) {
+ if ((gsub(GCCLIBPREFIX_OLD CHOST "/" OLDVER "[/[:space:]]*",
+ GCCLIB "/" NEWVER, la_data) > 0) ||
+ (gsub(GCCLIBPREFIX_NEW CHOST "/" OLDVER "[/[:space:]]*",
+ GCCLIB "/" NEWVER, la_data) > 0))
+ CHANGED = 1
+ }
+ # We now check if we have libstdc++.la, as we remove the
+ # libtool linker scripts for gcc ...
+ # We do this last, as we only match the new paths
+ if (gsub(GCCLIB "/" NEWVER "/libstdc\\+\\+\\.la",
+ "-lstdc++", la_data) > 0)
+ CHANGED = 1
+ }
+ close(la_files)
+
+ # Do the actual changes in a second loop, as we can then
+ # verify that CHOST_CHANGED among things is correct ...
+ if (CHANGED) {
+ ewarnn(" FIXING: " la_files " ...[")
+
+ # Clear the temp file (removing rather than '>foo' is better
+ # out of a security point of view?)
+ dosystem("rm -f " la_files ".new")
+
+ while ((getline la_data < (la_files)) > 0) {
+ if (OLDCHOST != "") {
+ tmpstr = gensub(OLDGCCLIB1 "([/[:space:]]+)",
+ GCCLIB "\\1", "g", la_data)
+ tmpstr = gensub(OLDGCCLIB2 "([/[:space:]]+)",
+ GCCLIB "\\1", "g", tmpstr)
+
+ if (la_data != tmpstr) {
+ printn("c")
+ la_data = tmpstr
+ }
+
+ if (CHOST_CHANGED > 0) {
+ # We try to be careful about CHOST changes outside
+ # the gcc library path (meaning we cannot match it
+ # via /GCCLIBPREFIX CHOST/) ...
+
+ # Catch:
+ #
+ # dependency_libs=' -L/usr/CHOST/{bin,lib}'
+ #
+ gsub("-L/usr/" OLDCHOST "/",
+ "-L/usr/" CHOST "/", la_data)
+ # Catch:
+ #
+ # dependency_libs=' -L/usr/lib/gcc-lib/CHOST/VER/../../../../CHOST/lib'
+ #
+ la_data = gensub("(" GCCLIB "/[^[:space:]]+)/" OLDCHOST "/",
+ "\\1/" CHOST "/", "g", la_data)
+ }
+ }
+
+ if (OLDVER != NEWVER) {
+ # Catch:
+ #
+ # dependency_libs=' -L/usr/lib/gcc/CHOST/VER'
+ #
+ tmpstr = gensub(GCCLIBPREFIX_OLD CHOST "/" OLDVER "([/[:space:]]+)",
+ GCCLIB "/" NEWVER "\\1", "g", la_data)
+ tmpstr = gensub(GCCLIBPREFIX_NEW CHOST "/" OLDVER "([/[:space:]]+)",
+ GCCLIB "/" NEWVER "\\1", "g", tmpstr)
+
+ if (la_data != tmpstr) {
+ # Catch:
+ #
+ # dependency_libs=' -L/usr/lib/gcc-lib/../../CHOST/lib'
+ #
+ # in cases where we have gcc34
+ tmpstr = gensub(GCCLIBPREFIX_OLD "(../../" CHOST "/lib)",
+ GCCLIBPREFIX "\\1", "g", tmpstr)
+ tmpstr = gensub(GCCLIBPREFIX_NEW "(../../" CHOST "/lib)",
+ GCCLIBPREFIX "\\1", "g", tmpstr)
+ printn("v")
+ la_data = tmpstr
+ }
+ }
+
+ # We now check if we have libstdc++.la, as we remove the
+ # libtool linker scripts for gcc and any referencese in any
+ # libtool linker scripts.
+ # We do this last, as we only match the new paths
+ tmpstr = gensub(GCCLIB "/" NEWVER "/libstdc\\+\\+\\.la",
+ "-lstdc++", "g", la_data);
+ if (la_data != tmpstr) {
+ printn("l")
+ la_data = tmpstr
+ }
+
+ print la_data >> (la_files ".new")
+ }
+
+ if (CHANGED)
+ print "]"
+
+ close(la_files)
+ close(la_files ".new")
+
+ assert(dosystem("mv -f " la_files ".new " la_files),
+ "dosystem(\"mv -f " la_files ".new " la_files "\")")
+ }
+ }
+
+ close(pipe)
+ }
+}
+
+# vim:ts=4
diff --git a/sys-devel/gcc/files/c89 b/sys-devel/gcc/files/c89
new file mode 100755
index 000000000000..cee0325f50f1
--- /dev/null
+++ b/sys-devel/gcc/files/c89
@@ -0,0 +1,20 @@
+#! /bin/sh
+
+# Call the appropriate C compiler with options to accept ANSI/ISO C
+# The following options are the same (as of gcc-2.95):
+# -ansi
+# -std=c89
+# -std=iso9899:1990
+
+for i; do
+ case "$i" in
+ -ansi|-std=c89|-std=iso9899:1990)
+ ;;
+ -std=*)
+ echo >&2 "`basename $0` called with non ANSI/ISO C90 option $i"
+ exit 1
+ ;;
+ esac
+done
+
+exec gcc -std=c89 -pedantic -U_FORTIFY_SOURCE "$@"
diff --git a/sys-devel/gcc/files/c99 b/sys-devel/gcc/files/c99
new file mode 100755
index 000000000000..c9542095e385
--- /dev/null
+++ b/sys-devel/gcc/files/c99
@@ -0,0 +1,21 @@
+#! /bin/sh
+
+# Call the appropriate C compiler with options to accept ANSI/ISO C
+# The following options are the same (as of gcc-3.3):
+# -std=c99
+# -std=c9x
+# -std=iso9899:1999
+# -std=iso9899:199x
+
+for i; do
+ case "$i" in
+ -std=c9[9x]|-std=iso9899:199[9x])
+ ;;
+ -ansi|-std=*)
+ echo >&2 "`basename $0` called with non ANSI/ISO C99 option $i"
+ exit 1
+ ;;
+ esac
+done
+
+exec gcc -std=c99 -pedantic -U_FORTIFY_SOURCE ${1+"$@"}
diff --git a/sys-devel/gcc/files/fix_libtool_files.sh b/sys-devel/gcc/files/fix_libtool_files.sh
new file mode 100644
index 000000000000..eb96df282824
--- /dev/null
+++ b/sys-devel/gcc/files/fix_libtool_files.sh
@@ -0,0 +1,67 @@
+#!/bin/sh
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+usage() {
+cat << "USAGE_END"
+Usage: fix_libtool_files.sh <old-gcc-version> [--oldarch <old-CHOST>]
+
+ Where <old-gcc-version> is the version number of the
+ previous gcc version. For example, if you updated to
+ gcc-3.2.1, and you had gcc-3.2 installed, run:
+
+ # fix_libtool_files.sh 3.2
+
+ If you updated to gcc-3.2.3, and the old CHOST was i586-pc-linux-gnu
+ but you now have CHOST as i686-pc-linux-gnu, run:
+
+ # fix_libtool_files.sh 3.2 --oldarch i586-pc-linux-gnu
+
+ Note that if only the CHOST and not the version changed, you can run
+ it with the current version and the '--oldarch <old-CHOST>' arguments,
+ and it will do the expected:
+
+ # fix_libtool_files.sh `gcc -dumpversion` --oldarch i586-pc-linux-gnu
+
+USAGE_END
+ exit 1
+}
+
+case $2 in
+--oldarch) [ $# -ne 3 ] && usage ;;
+*) [ $# -ne 1 ] && usage ;;
+esac
+
+ARGV1=$1
+ARGV2=$2
+ARGV3=$3
+
+. /etc/profile || exit 1
+
+if [ ${EUID:-0} -ne 0 ] ; then
+ echo "${0##*/}: Must be root."
+ exit 1
+fi
+
+# make sure the files come out sane
+umask 0022
+
+OLDCHOST=
+[ "${ARGV2}" = "--oldarch" ] && OLDCHOST=${ARGV3}
+
+AWKDIR="/usr/share/gcc-data"
+
+if [ ! -r "${AWKDIR}/fixlafiles.awk" ] ; then
+ echo "${0##*/}: ${AWKDIR}/fixlafiles.awk does not exist!"
+ exit 1
+fi
+
+OLDVER=${ARGV1}
+
+export OLDVER OLDCHOST
+
+echo "Scanning libtool files for hardcoded gcc library paths..."
+exec gawk -f "${AWKDIR}/fixlafiles.awk"
+
+# vim:ts=4
diff --git a/sys-devel/gcc/files/gcc-configure-LANG.patch b/sys-devel/gcc/files/gcc-configure-LANG.patch
new file mode 100644
index 000000000000..d1b1b0353662
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-configure-LANG.patch
@@ -0,0 +1,64 @@
+The LANG vars aren't reset early enough so when sed tries to use [a-zA-Z] in
+option parsing, it may break.
+
+http://bugs.gentoo.org/103483
+
+--- configure
++++ configure
+@@ -54,6 +54,19 @@
+ infodir='${prefix}/info'
+ mandir='${prefix}/man'
+
++# NLS nuisances.
++for as_var in \
++ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
++ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
++ LC_TELEPHONE LC_TIME
++do
++ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
++ eval $as_var=C; export $as_var
++ else
++ unset $as_var
++ fi
++done
++
+ # Initialize some other variables.
+ subdirs=
+ MFLAGS= MAKEFLAGS=
+@@ -452,16 +463,6 @@
+ esac
+ done
+
+-# NLS nuisances.
+-# Only set these to C if already set. These must not be set unconditionally
+-# because not all systems understand e.g. LANG=C (notably SCO).
+-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+-# Non-C LC_CTYPE values break the ctype check.
+-if test "${LANG+set}" = set; then LANG=C; export LANG; fi
+-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
+-
+ # confdefs.h avoids OS command line length limits that DEFS can exceed.
+ rm -rf conftest* confdefs.h
+ # AIX cpp loses on an empty file, so make sure it contains at least a newline.
+@@ -1850,6 +1850,19 @@
+ # Compiler output produced by configure, useful for debugging
+ # configure, is in ./config.log if it exists.
+
++# NLS nuisances.
++for as_var in \
++ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
++ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
++ LC_TELEPHONE LC_TIME
++do
++ if (set +x; test -z "`(eval \$as_var=C; export \$as_var) 2>&1`"); then
++ eval \$as_var=C; export \$as_var
++ else
++ unset \$as_var
++ fi
++done
++
+ ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+ for ac_option
+ do
diff --git a/sys-devel/gcc/files/gcc-configure-texinfo.patch b/sys-devel/gcc/files/gcc-configure-texinfo.patch
new file mode 100644
index 000000000000..ddc098ddbd58
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-configure-texinfo.patch
@@ -0,0 +1,16 @@
+Chances are quite good that the installed makeinfo is sufficient.
+So ignore false positives where the makeinfo installed is so new
+that it violates the cheesy version grep.
+
+http://bugs.gentoo.org/198182
+
+--- configure
++++ configure
+@@ -3573,6 +3573,6 @@
+ :
+ else
+- MAKEINFO="$MISSING makeinfo"
++ :
+ fi
+ ;;
+
diff --git a/sys-devel/gcc/files/gcc-spec-env-r1.patch b/sys-devel/gcc/files/gcc-spec-env-r1.patch
new file mode 100644
index 000000000000..a58926836e4e
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-spec-env-r1.patch
@@ -0,0 +1,87 @@
+2013-08-22 Magnus Granberg <zorry@gentoo.org>
+
+ * gcc/gcc.c (main): Add support for external spec file via the GCC_SPECS env var
+ and move the process of the user specifed specs.
+
+ This allows us to easily control pie/ssp defaults with gcc-config profiles.
+ Original patch by Rob Holland
+ Extended to support multiple entries separated by ':' by Kevin F. Quinn
+ Modified to use getenv instead of poisoned GET_ENVIRONMENT by Ryan Hill
+ Modified to process the GCC_SPECS env var befor DRIVER_SELF_SPECS by Magnus Granberg
+
+--- gcc-4.8-20130210/gcc/gcc.c 2013-02-05 16:55:31.000000000 +0100
++++ gcc-4.8-20130210-work/gcc/gcc.c 2013-07-26 02:32:14.625089864 +0200
+@@ -6427,6 +6428,48 @@ main (int argc, char **argv)
+ do_option_spec (option_default_specs[i].name,
+ option_default_specs[i].spec);
+
++#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS) || defined (WIN32))
++ /* Add specs listed in GCC_SPECS. Note; in the process of separating
++ * each spec listed, the string is overwritten at token boundaries
++ * (':') with '\0', an effect of strtok_r().
++ */
++ specs_file = getenv ("GCC_SPECS");
++ if (specs_file && (strlen(specs_file) > 0))
++ {
++ char *spec, *saveptr;
++ for (spec=strtok_r(specs_file,":",&saveptr);
++ spec!=NULL;
++ spec=strtok_r(NULL,":",&saveptr))
++ {
++ struct user_specs *user = (struct user_specs *)
++ xmalloc (sizeof (struct user_specs));
++ user->next = (struct user_specs *) 0;
++ user->filename = spec;
++ if (user_specs_tail)
++ user_specs_tail->next = user;
++ else
++ user_specs_head = user;
++ user_specs_tail = user;
++ }
++ }
++#endif
++ /* Process any user specified specs in the order given on the command
++ * line. */
++ for (uptr = user_specs_head; uptr; uptr = uptr->next)
++ {
++ char *filename = find_a_file (&startfile_prefixes, uptr->filename,
++ R_OK, true);
++ read_specs (filename ? filename : uptr->filename, false, true);
++ }
++ /* Process any user self specs. */
++ {
++ struct spec_list *sl;
++ for (sl = specs; sl; sl = sl->next)
++ if (sl->name_len == sizeof "self_spec" - 1
++ && !strcmp (sl->name, "self_spec"))
++ do_self_spec (*sl->ptr_spec);
++ }
++
+ /* Process DRIVER_SELF_SPECS, adding any new options to the end
+ of the command line. */
+
+@@ -6535,24 +6578,6 @@ main (int argc, char **argv)
+ PREFIX_PRIORITY_LAST, 0, 1);
+ }
+
+- /* Process any user specified specs in the order given on the command
+- line. */
+- for (uptr = user_specs_head; uptr; uptr = uptr->next)
+- {
+- char *filename = find_a_file (&startfile_prefixes, uptr->filename,
+- R_OK, true);
+- read_specs (filename ? filename : uptr->filename, false, true);
+- }
+-
+- /* Process any user self specs. */
+- {
+- struct spec_list *sl;
+- for (sl = specs; sl; sl = sl->next)
+- if (sl->name_len == sizeof "self_spec" - 1
+- && !strcmp (sl->name, "self_spec"))
+- do_self_spec (*sl->ptr_spec);
+- }
+-
+ if (compare_debug)
+ {
+ enum save_temps save;
diff --git a/sys-devel/gcc/files/gcc-spec-env.patch b/sys-devel/gcc/files/gcc-spec-env.patch
new file mode 100644
index 000000000000..57e7567e5460
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-spec-env.patch
@@ -0,0 +1,42 @@
+ Add support for external spec file via the GCC_SPECS env var. This
+ allows us to easily control pie/ssp defaults with gcc-config profiles.
+
+ Original patch by Rob Holland
+ Extended to support multiple entries separated by ':' by Kevin F. Quinn
+ Modified to use getenv instead of poisoned GET_ENVIRONMENT by Ryan Hill
+
+--- gcc-4/gcc/gcc.c
++++ gcc-4/gcc/gcc.c
+@@ -6482,6 +6482,32 @@
+
+ /* Process any user specified specs in the order given on the command
+ line. */
++#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS) || defined (WIN32))
++ /* Add specs listed in GCC_SPECS. Note; in the process of separating
++ * each spec listed, the string is overwritten at token boundaries
++ * (':') with '\0', an effect of strtok_r().
++ */
++ specs_file = getenv ("GCC_SPECS");
++ if (specs_file && (strlen(specs_file) > 0))
++ {
++ char *spec, *saveptr;
++ for (spec=strtok_r(specs_file,":",&saveptr);
++ spec!=NULL;
++ spec=strtok_r(NULL,":",&saveptr))
++ {
++ struct user_specs *user = (struct user_specs *)
++ xmalloc (sizeof (struct user_specs));
++
++ user->next = (struct user_specs *) 0;
++ user->filename = spec;
++ if (user_specs_tail)
++ user_specs_tail->next = user;
++ else
++ user_specs_head = user;
++ user_specs_tail = user;
++ }
++ }
++#endif
+ for (uptr = user_specs_head; uptr; uptr = uptr->next)
+ {
+ char *filename = find_a_file (&startfile_prefixes, uptr->filename,
diff --git a/sys-devel/gcc/gcc-2.95.3-r10.ebuild b/sys-devel/gcc/gcc-2.95.3-r10.ebuild
new file mode 100644
index 000000000000..46e9ce7f75aa
--- /dev/null
+++ b/sys-devel/gcc/gcc-2.95.3-r10.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+PATCH_VER="1.4"
+
+inherit eutils flag-o-matic toolchain
+
+KEYWORDS="~alpha ~ppc ~sparc ~x86"
+
+gcc2-flags() {
+ # Are we trying to compile with gcc3 ? CFLAGS and CXXFLAGS needs to be
+ # valid for gcc-2.95.3 ...
+ if [[ $(tc-arch) == "x86" || $(tc-arch) == "amd64" ]] ; then
+ CFLAGS=${CFLAGS//-mtune=/-mcpu=}
+ CXXFLAGS=${CXXFLAGS//-mtune=/-mcpu=}
+ fi
+
+ replace-cpu-flags k6-{2,3} k6
+ replace-cpu-flags athlon{,-{tbird,4,xp,mp}} i686
+
+ replace-cpu-flags pentium-mmx i586
+ replace-cpu-flags pentium{2,3,4} i686
+
+ replace-cpu-flags ev6{7,8} ev6
+}
+
+src_prepare() {
+ rm -rf texinfo
+ strip-linguas -u */po
+ gcc2-flags
+ toolchain_src_prepare
+}
diff --git a/sys-devel/gcc/gcc-3.3.6-r1.ebuild b/sys-devel/gcc/gcc-3.3.6-r1.ebuild
new file mode 100644
index 000000000000..5df1182429b4
--- /dev/null
+++ b/sys-devel/gcc/gcc-3.3.6-r1.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+PATCH_VER="1.9"
+UCLIBC_VER="1.0"
+HTB_VER="1.00-r2"
+
+inherit eutils toolchain
+
+# ia64 - broken static handling; USE=static emerge busybox
+KEYWORDS="~amd64 ~x86"
+
+# NOTE: we SHOULD be using at least binutils 2.15.90.0.1 everywhere for proper
+# .eh_frame ld optimisation and symbol visibility support, but it hasnt been
+# well tested in gentoo on any arch other than amd64!!
+RDEPEND=">=sys-devel/binutils-2.14.90.0.6-r1"
+DEPEND="${RDEPEND}
+ amd64? ( >=sys-devel/binutils-2.15.90.0.1.1-r1 )"
+
+src_prepare() {
+ toolchain_src_prepare
+
+ if [[ -n ${UCLIBC_VER} ]] && [[ ${CTARGET} == *-uclibc* ]] ; then
+ mv "${S}"/gcc-3.3.2/libstdc++-v3/config/os/uclibc "${S}"/libstdc++-v3/config/os/ || die
+ mv "${S}"/gcc-3.3.2/libstdc++-v3/config/locale/uclibc "${S}"/libstdc++-v3/config/locale/ || die
+ fi
+
+ # Anything useful and objc will require libffi. Seriously. Lets just force
+ # libffi to install with USE="objc", even though it normally only installs
+ # if you attempt to build gcj.
+ if use objc && ! use gcj ; then
+ epatch "${FILESDIR}"/3.3.4/libffi-without-libgcj.patch
+ #epatch "${FILESDIR}"/3.4.3/libffi-nogcj-lib-path-fix.patch
+ fi
+}
diff --git a/sys-devel/gcc/gcc-3.4.6-r2.ebuild b/sys-devel/gcc/gcc-3.4.6-r2.ebuild
new file mode 100644
index 000000000000..bcf8dc04b382
--- /dev/null
+++ b/sys-devel/gcc/gcc-3.4.6-r2.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+PATCH_VER="1.8"
+UCLIBC_VER="1.1"
+UCLIBC_GCC_VER="3.4.5"
+HTB_VER="1.00.1"
+HTB_GCC_VER="3.4.4"
+D_VER="0.24"
+
+inherit eutils toolchain
+
+KEYWORDS="-* alpha amd64 arm ~ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86 ~x86-fbsd"
+
+# we need a proper glibc version for the Scrt1.o provided to the pie-ssp specs
+# NOTE: we SHOULD be using at least binutils 2.15.90.0.1 everywhere for proper
+# .eh_frame ld optimisation and symbol visibility support, but it hasnt been
+# well tested in gentoo on any arch other than amd64!!
+RDEPEND=""
+DEPEND="${RDEPEND}
+ >=sys-devel/binutils-2.14.90.0.8-r1
+ amd64? ( >=sys-devel/binutils-2.15.90.0.1.1-r1 )"
+
+src_prepare() {
+ toolchain_src_prepare
+
+ # Anything useful and objc will require libffi. Seriously. Lets just force
+ # libffi to install with USE="objc", even though it normally only installs
+ # if you attempt to build gcj.
+ if use objc && ! use gcj ; then
+ epatch "${FILESDIR}"/3.4.3/libffi-without-libgcj.patch
+ #epatch ${FILESDIR}/3.4.3/libffi-nogcj-lib-path-fix.patch
+ fi
+
+ # Fix cross-compiling
+ epatch "${FILESDIR}"/3.4.4/gcc-3.4.4-cross-compile.patch
+
+ # Arch stuff
+ case $(tc-arch) in
+ amd64)
+ if is_multilib ; then
+ sed -i -e '/GLIBCXX_IS_NATIVE=/s:false:true:' libstdc++-v3/configure || die
+ fi
+ ;;
+ esac
+}
diff --git a/sys-devel/gcc/gcc-4.0.4.ebuild b/sys-devel/gcc/gcc-4.0.4.ebuild
new file mode 100644
index 000000000000..c3527f2a7c8d
--- /dev/null
+++ b/sys-devel/gcc/gcc-4.0.4.ebuild
@@ -0,0 +1,16 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+PATCH_VER="1.2"
+UCLIBC_VER="1.0"
+
+inherit toolchain
+
+KEYWORDS=""
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ >=${CATEGORY}/binutils-2.15.94"
diff --git a/sys-devel/gcc/gcc-4.1.2.ebuild b/sys-devel/gcc/gcc-4.1.2.ebuild
new file mode 100644
index 000000000000..6514ff4489fc
--- /dev/null
+++ b/sys-devel/gcc/gcc-4.1.2.ebuild
@@ -0,0 +1,30 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+PATCH_VER="1.5"
+UCLIBC_VER="1.0"
+D_VER="0.24"
+
+inherit eutils toolchain
+
+KEYWORDS="-* alpha amd64 arm hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ ppc? ( >=${CATEGORY}/binutils-2.17 )
+ ppc64? ( >=${CATEGORY}/binutils-2.17 )
+ >=${CATEGORY}/binutils-2.15.94"
+
+src_prepare() {
+ toolchain_src_prepare
+
+ use vanilla && return 0
+
+ # Fix cross-compiling
+ epatch "${FILESDIR}"/4.1.0/gcc-4.1.0-cross-compile.patch
+
+ epatch "${FILESDIR}"/4.1.0/gcc-4.1.0-fast-math-i386-Os-workaround.patch
+}
diff --git a/sys-devel/gcc/gcc-4.2.4-r1.ebuild b/sys-devel/gcc/gcc-4.2.4-r1.ebuild
new file mode 100644
index 000000000000..cd6cd1930bea
--- /dev/null
+++ b/sys-devel/gcc/gcc-4.2.4-r1.ebuild
@@ -0,0 +1,18 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+PATCH_VER="1.3"
+UCLIBC_VER="1.0"
+
+inherit toolchain
+
+KEYWORDS="~alpha ~amd64 ~arm hppa ~ia64 ~m68k ~ppc ~ppc64 ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ ppc? ( >=${CATEGORY}/binutils-2.17 )
+ ppc64? ( >=${CATEGORY}/binutils-2.17 )
+ >=${CATEGORY}/binutils-2.15.94"
diff --git a/sys-devel/gcc/gcc-4.3.6-r1.ebuild b/sys-devel/gcc/gcc-4.3.6-r1.ebuild
new file mode 100644
index 000000000000..98f9a0fb22fe
--- /dev/null
+++ b/sys-devel/gcc/gcc-4.3.6-r1.ebuild
@@ -0,0 +1,29 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+PATCH_VER="1.1"
+UCLIBC_VER="1.0"
+
+inherit toolchain
+
+KEYWORDS="alpha amd64 arm -hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86 ~x86-fbsd"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ ppc? ( >=${CATEGORY}/binutils-2.17 )
+ ppc64? ( >=${CATEGORY}/binutils-2.17 )
+ >=${CATEGORY}/binutils-2.15.94"
+if [[ ${CATEGORY} != cross-* ]] ; then
+ PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
+fi
+
+src_prepare() {
+ toolchain_src_prepare
+
+ use vanilla && return 0
+
+ sed -i 's/use_fixproto=yes/:/' gcc/config.gcc #PR33200
+}
diff --git a/sys-devel/gcc/gcc-4.4.7.ebuild b/sys-devel/gcc/gcc-4.4.7.ebuild
new file mode 100644
index 000000000000..63c82ea76c79
--- /dev/null
+++ b/sys-devel/gcc/gcc-4.4.7.ebuild
@@ -0,0 +1,31 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+PATCH_VER="1.2"
+UCLIBC_VER="1.0"
+
+inherit eutils toolchain
+
+KEYWORDS="alpha amd64 arm hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86 ~x86-fbsd"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ elibc_glibc? ( >=sys-libs/glibc-2.8 )
+ ppc? ( >=${CATEGORY}/binutils-2.17 )
+ ppc64? ( >=${CATEGORY}/binutils-2.17 )
+ >=${CATEGORY}/binutils-2.15.94"
+if [[ ${CATEGORY} != cross-* ]] ; then
+ PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
+fi
+
+src_prepare() {
+ toolchain_src_prepare
+ use vanilla && return 0
+
+ sed -i 's/use_fixproto=yes/:/' gcc/config.gcc #PR33200
+
+ [[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env.patch
+}
diff --git a/sys-devel/gcc/gcc-4.5.4.ebuild b/sys-devel/gcc/gcc-4.5.4.ebuild
new file mode 100644
index 000000000000..a9e0b682f609
--- /dev/null
+++ b/sys-devel/gcc/gcc-4.5.4.ebuild
@@ -0,0 +1,32 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+PATCH_VER="1.2"
+UCLIBC_VER="1.0"
+
+inherit eutils toolchain
+
+KEYWORDS="alpha amd64 arm hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-fbsd ~x86-fbsd"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ elibc_glibc? ( >=sys-libs/glibc-2.8 )
+ ppc? ( >=${CATEGORY}/binutils-2.17 )
+ ppc64? ( >=${CATEGORY}/binutils-2.17 )
+ >=${CATEGORY}/binutils-2.15.94"
+if [[ ${CATEGORY} != cross-* ]] ; then
+ PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
+fi
+
+src_prepare() {
+ toolchain_src_prepare
+
+ use vanilla && return 0
+
+ sed -i 's/use_fixproto=yes/:/' gcc/config.gcc #PR33200
+
+ [[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env.patch
+}
diff --git a/sys-devel/gcc/gcc-4.6.4.ebuild b/sys-devel/gcc/gcc-4.6.4.ebuild
new file mode 100644
index 000000000000..58b482fb5020
--- /dev/null
+++ b/sys-devel/gcc/gcc-4.6.4.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+PATCH_VER="1.3"
+UCLIBC_VER="1.0"
+
+# Hardened gcc 4 stuff
+PIE_VER="0.5.2"
+SPECS_VER="0.2.0"
+SPECS_GCC_VER="4.4.3"
+# arch/libc configurations known to be stable with {PIE,SSP}-by-default
+PIE_GLIBC_STABLE="x86 amd64 mips ppc ppc64 arm ia64"
+PIE_UCLIBC_STABLE="x86 arm amd64 ppc ppc64"
+SSP_STABLE="amd64 x86 mips ppc ppc64 arm"
+# uclibc need tls and nptl support for SSP support
+# uclibc need to be >= 0.9.32
+SSP_UCLIBC_STABLE="x86 amd64 ppc ppc64 arm"
+#end Hardened stuff
+
+inherit eutils toolchain
+
+KEYWORDS="alpha amd64 arm hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-fbsd ~x86-fbsd"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ elibc_glibc? ( >=sys-libs/glibc-2.8 )
+ >=${CATEGORY}/binutils-2.18"
+
+if [[ ${CATEGORY} != cross-* ]] ; then
+ PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
+fi
+
+src_prepare() {
+ if has_version '<sys-libs/glibc-2.12' ; then
+ ewarn "Your host glibc is too old; disabling automatic fortify."
+ ewarn "Please rebuild gcc after upgrading to >=glibc-2.12 #362315"
+ EPATCH_EXCLUDE+=" 10_all_default-fortify-source.patch"
+ fi
+
+ toolchain_src_prepare
+
+ use vanilla && return 0
+
+ [[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env.patch
+}
diff --git a/sys-devel/gcc/gcc-4.7.4.ebuild b/sys-devel/gcc/gcc-4.7.4.ebuild
new file mode 100644
index 000000000000..ff7df65a9471
--- /dev/null
+++ b/sys-devel/gcc/gcc-4.7.4.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+PATCH_VER="1.4"
+UCLIBC_VER="1.0"
+
+# Hardened gcc 4 stuff
+PIE_VER="0.5.5"
+SPECS_VER="0.2.0"
+SPECS_GCC_VER="4.4.3"
+# arch/libc configurations known to be stable with {PIE,SSP}-by-default
+PIE_GLIBC_STABLE="x86 amd64 ppc ppc64 arm ia64"
+PIE_UCLIBC_STABLE="x86 arm amd64 ppc ppc64"
+SSP_STABLE="amd64 x86 ppc ppc64 arm"
+# uclibc need tls and nptl support for SSP support
+# uclibc need to be >= 0.9.33
+SSP_UCLIBC_STABLE="x86 amd64 ppc ppc64 arm"
+#end Hardened stuff
+
+inherit eutils toolchain
+
+KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 -amd64-fbsd -x86-fbsd"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ elibc_glibc? ( >=sys-libs/glibc-2.8 )
+ >=${CATEGORY}/binutils-2.18"
+
+if [[ ${CATEGORY} != cross-* ]] ; then
+ PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
+fi
+
+src_prepare() {
+ if has_version '<sys-libs/glibc-2.12' ; then
+ ewarn "Your host glibc is too old; disabling automatic fortify."
+ ewarn "Please rebuild gcc after upgrading to >=glibc-2.12 #362315"
+ EPATCH_EXCLUDE+=" 10_all_default-fortify-source.patch"
+ fi
+
+ toolchain_src_prepare
+
+ use vanilla && return 0
+
+ [[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env.patch
+}
diff --git a/sys-devel/gcc/gcc-4.8.0.ebuild b/sys-devel/gcc/gcc-4.8.0.ebuild
new file mode 100644
index 000000000000..c85ca449ff5d
--- /dev/null
+++ b/sys-devel/gcc/gcc-4.8.0.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+PATCH_VER="1.3"
+UCLIBC_VER="1.0"
+
+# Hardened gcc 4 stuff
+PIE_VER="0.5.5"
+SPECS_VER="0.2.0"
+SPECS_GCC_VER="4.4.3"
+# arch/libc configurations known to be stable with {PIE,SSP}-by-default
+PIE_GLIBC_STABLE="x86 amd64 mips ppc ppc64 arm ia64"
+PIE_UCLIBC_STABLE="x86 arm amd64 mips ppc ppc64"
+SSP_STABLE="amd64 x86 mips ppc ppc64 arm"
+# uclibc need tls and nptl support for SSP support
+# uclibc need to be >= 0.9.33
+SSP_UCLIBC_STABLE="x86 amd64 mips ppc ppc64 arm"
+#end Hardened stuff
+
+inherit eutils toolchain
+
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ elibc_glibc? ( >=sys-libs/glibc-2.8 )
+ >=${CATEGORY}/binutils-2.20"
+
+if [[ ${CATEGORY} != cross-* ]] ; then
+ PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
+fi
+
+src_prepare() {
+ if has_version '<sys-libs/glibc-2.12' ; then
+ ewarn "Your host glibc is too old; disabling automatic fortify."
+ ewarn "Please rebuild gcc after upgrading to >=glibc-2.12 #362315"
+ EPATCH_EXCLUDE+=" 10_all_default-fortify-source.patch"
+ fi
+
+ toolchain_src_prepare
+
+ use vanilla && return 0
+
+ [[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env.patch
+}
diff --git a/sys-devel/gcc/gcc-4.8.1-r1.ebuild b/sys-devel/gcc/gcc-4.8.1-r1.ebuild
new file mode 100644
index 000000000000..5344c0f99ed4
--- /dev/null
+++ b/sys-devel/gcc/gcc-4.8.1-r1.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+PATCH_VER="1.2"
+UCLIBC_VER="1.0"
+
+# Hardened gcc 4 stuff
+PIE_VER="0.5.7"
+SPECS_VER="0.2.0"
+SPECS_GCC_VER="4.4.3"
+# arch/libc configurations known to be stable with {PIE,SSP}-by-default
+PIE_GLIBC_STABLE="x86 amd64 mips ppc ppc64 arm ia64"
+PIE_UCLIBC_STABLE="x86 arm amd64 mips ppc ppc64"
+SSP_STABLE="amd64 x86 mips ppc ppc64 arm"
+# uclibc need tls and nptl support for SSP support
+# uclibc need to be >= 0.9.33
+SSP_UCLIBC_STABLE="x86 amd64 mips ppc ppc64 arm"
+#end Hardened stuff
+
+inherit eutils toolchain
+
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ elibc_glibc? ( >=sys-libs/glibc-2.8 )
+ >=${CATEGORY}/binutils-2.20"
+
+if [[ ${CATEGORY} != cross-* ]] ; then
+ PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
+fi
+
+src_prepare() {
+ if has_version '<sys-libs/glibc-2.12' ; then
+ ewarn "Your host glibc is too old; disabling automatic fortify."
+ ewarn "Please rebuild gcc after upgrading to >=glibc-2.12 #362315"
+ EPATCH_EXCLUDE+=" 10_all_default-fortify-source.patch"
+ fi
+
+ toolchain_src_prepare
+
+ use vanilla && return 0
+ #Use -r1 for newer piepatchet that use DRIVER_SELF_SPECS for the hardened specs.
+ [[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env-r1.patch
+}
diff --git a/sys-devel/gcc/gcc-4.8.2.ebuild b/sys-devel/gcc/gcc-4.8.2.ebuild
new file mode 100644
index 000000000000..2de44990091a
--- /dev/null
+++ b/sys-devel/gcc/gcc-4.8.2.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+PATCH_VER="1.3r1"
+UCLIBC_VER="1.0"
+
+# Hardened gcc 4 stuff
+PIE_VER="0.5.8r1"
+SPECS_VER="0.2.0"
+SPECS_GCC_VER="4.4.3"
+# arch/libc configurations known to be stable with {PIE,SSP}-by-default
+PIE_GLIBC_STABLE="x86 amd64 mips ppc ppc64 arm ia64"
+PIE_UCLIBC_STABLE="x86 arm amd64 mips ppc ppc64"
+SSP_STABLE="amd64 x86 mips ppc ppc64 arm"
+# uclibc need tls and nptl support for SSP support
+# uclibc need to be >= 0.9.33
+SSP_UCLIBC_STABLE="x86 amd64 mips ppc ppc64 arm"
+#end Hardened stuff
+
+inherit eutils toolchain
+
+KEYWORDS="~alpha ~amd64 ~arm arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ elibc_glibc? ( >=sys-libs/glibc-2.8 )
+ >=${CATEGORY}/binutils-2.20"
+
+if [[ ${CATEGORY} != cross-* ]] ; then
+ PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
+fi
+
+src_prepare() {
+ if has_version '<sys-libs/glibc-2.12' ; then
+ ewarn "Your host glibc is too old; disabling automatic fortify."
+ ewarn "Please rebuild gcc after upgrading to >=glibc-2.12 #362315"
+ EPATCH_EXCLUDE+=" 10_all_default-fortify-source.patch"
+ fi
+
+ toolchain_src_prepare
+
+ use vanilla && return 0
+ #Use -r1 for newer piepatchet that use DRIVER_SELF_SPECS for the hardened specs.
+ [[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env-r1.patch
+}
diff --git a/sys-devel/gcc/gcc-4.8.3.ebuild b/sys-devel/gcc/gcc-4.8.3.ebuild
new file mode 100644
index 000000000000..40fb333bb190
--- /dev/null
+++ b/sys-devel/gcc/gcc-4.8.3.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+PATCH_VER="1.1"
+UCLIBC_VER="1.0"
+
+# Hardened gcc 4 stuff
+PIE_VER="0.5.9"
+SPECS_VER="0.2.0"
+SPECS_GCC_VER="4.4.3"
+# arch/libc configurations known to be stable with {PIE,SSP}-by-default
+PIE_GLIBC_STABLE="x86 amd64 mips ppc ppc64 arm ia64"
+PIE_UCLIBC_STABLE="x86 arm amd64 mips ppc ppc64"
+SSP_STABLE="amd64 x86 mips ppc ppc64 arm"
+# uclibc need tls and nptl support for SSP support
+# uclibc need to be >= 0.9.33
+SSP_UCLIBC_STABLE="x86 amd64 mips ppc ppc64 arm"
+#end Hardened stuff
+
+inherit eutils toolchain
+
+KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~x86-fbsd"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ elibc_glibc? ( >=sys-libs/glibc-2.8 )
+ >=${CATEGORY}/binutils-2.20"
+
+if [[ ${CATEGORY} != cross-* ]] ; then
+ PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
+fi
+
+src_prepare() {
+ if has_version '<sys-libs/glibc-2.12' ; then
+ ewarn "Your host glibc is too old; disabling automatic fortify."
+ ewarn "Please rebuild gcc after upgrading to >=glibc-2.12 #362315"
+ EPATCH_EXCLUDE+=" 10_all_default-fortify-source.patch"
+ fi
+
+ toolchain_src_prepare
+
+ use vanilla && return 0
+ #Use -r1 for newer piepatchet that use DRIVER_SELF_SPECS for the hardened specs.
+ [[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env-r1.patch
+}
diff --git a/sys-devel/gcc/gcc-4.8.4.ebuild b/sys-devel/gcc/gcc-4.8.4.ebuild
new file mode 100644
index 000000000000..6288602a9752
--- /dev/null
+++ b/sys-devel/gcc/gcc-4.8.4.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+PATCH_VER="1.6"
+UCLIBC_VER="1.0"
+
+# Hardened gcc 4 stuff
+PIE_VER="0.6.1"
+SPECS_VER="0.2.0"
+SPECS_GCC_VER="4.4.3"
+# arch/libc configurations known to be stable with {PIE,SSP}-by-default
+PIE_GLIBC_STABLE="x86 amd64 mips ppc ppc64 arm ia64"
+PIE_UCLIBC_STABLE="x86 arm amd64 mips ppc ppc64"
+SSP_STABLE="amd64 x86 mips ppc ppc64 arm"
+# uclibc need tls and nptl support for SSP support
+# uclibc need to be >= 0.9.33
+SSP_UCLIBC_STABLE="x86 amd64 mips ppc ppc64 arm"
+#end Hardened stuff
+
+inherit eutils toolchain
+
+KEYWORDS="alpha amd64 arm arm64 hppa ~ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~x86-fbsd"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ elibc_glibc? ( >=sys-libs/glibc-2.8 )
+ >=${CATEGORY}/binutils-2.20"
+
+if [[ ${CATEGORY} != cross-* ]] ; then
+ PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
+fi
+
+src_prepare() {
+ if has_version '<sys-libs/glibc-2.12' ; then
+ ewarn "Your host glibc is too old; disabling automatic fortify."
+ ewarn "Please rebuild gcc after upgrading to >=glibc-2.12 #362315"
+ EPATCH_EXCLUDE+=" 10_all_default-fortify-source.patch"
+ fi
+
+ toolchain_src_prepare
+
+ use vanilla && return 0
+ #Use -r1 for newer piepatchet that use DRIVER_SELF_SPECS for the hardened specs.
+ [[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env-r1.patch
+}
diff --git a/sys-devel/gcc/gcc-4.8.5.ebuild b/sys-devel/gcc/gcc-4.8.5.ebuild
new file mode 100644
index 000000000000..7e1a8dfd62ba
--- /dev/null
+++ b/sys-devel/gcc/gcc-4.8.5.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+PATCH_VER="1.0"
+UCLIBC_VER="1.0"
+
+# Hardened gcc 4 stuff
+PIE_VER="0.6.1"
+SPECS_VER="0.2.0"
+SPECS_GCC_VER="4.4.3"
+# arch/libc configurations known to be stable with {PIE,SSP}-by-default
+PIE_GLIBC_STABLE="x86 amd64 mips ppc ppc64 arm ia64"
+PIE_UCLIBC_STABLE="x86 arm amd64 mips ppc ppc64"
+SSP_STABLE="amd64 x86 mips ppc ppc64 arm"
+# uclibc need tls and nptl support for SSP support
+# uclibc need to be >= 0.9.33
+SSP_UCLIBC_STABLE="x86 amd64 mips ppc ppc64 arm"
+#end Hardened stuff
+
+inherit eutils toolchain
+
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ elibc_glibc? ( >=sys-libs/glibc-2.8 )
+ >=${CATEGORY}/binutils-2.20"
+
+if [[ ${CATEGORY} != cross-* ]] ; then
+ PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
+fi
+
+src_prepare() {
+ if has_version '<sys-libs/glibc-2.12' ; then
+ ewarn "Your host glibc is too old; disabling automatic fortify."
+ ewarn "Please rebuild gcc after upgrading to >=glibc-2.12 #362315"
+ EPATCH_EXCLUDE+=" 10_all_default-fortify-source.patch"
+ fi
+
+ toolchain_src_prepare
+
+ use vanilla && return 0
+ #Use -r1 for newer piepatchet that use DRIVER_SELF_SPECS for the hardened specs.
+ [[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env-r1.patch
+}
diff --git a/sys-devel/gcc/gcc-4.9.0.ebuild b/sys-devel/gcc/gcc-4.9.0.ebuild
new file mode 100644
index 000000000000..78274b682eb8
--- /dev/null
+++ b/sys-devel/gcc/gcc-4.9.0.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+PATCH_VER="1.0"
+UCLIBC_VER="1.0"
+
+# Hardened gcc 4 stuff
+PIE_VER="0.6.0"
+SPECS_VER="0.2.0"
+SPECS_GCC_VER="4.4.3"
+# arch/libc configurations known to be stable with {PIE,SSP}-by-default
+PIE_GLIBC_STABLE="x86 amd64 mips ppc ppc64 arm ia64"
+PIE_UCLIBC_STABLE="x86 arm amd64 mips ppc ppc64"
+SSP_STABLE="amd64 x86 mips ppc ppc64 arm"
+# uclibc need tls and nptl support for SSP support
+# uclibc need to be >= 0.9.33
+SSP_UCLIBC_STABLE="x86 amd64 mips ppc ppc64 arm"
+#end Hardened stuff
+
+inherit eutils toolchain
+
+KEYWORDS="~hppa"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ elibc_glibc? ( >=sys-libs/glibc-2.8 )
+ >=${CATEGORY}/binutils-2.20"
+
+if [[ ${CATEGORY} != cross-* ]] ; then
+ PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
+fi
+
+src_prepare() {
+ if has_version '<sys-libs/glibc-2.12' ; then
+ ewarn "Your host glibc is too old; disabling automatic fortify."
+ ewarn "Please rebuild gcc after upgrading to >=glibc-2.12 #362315"
+ EPATCH_EXCLUDE+=" 10_all_default-fortify-source.patch"
+ fi
+
+ toolchain_src_prepare
+
+ use vanilla && return 0
+ #Use -r1 for newer piepatchet that use DRIVER_SELF_SPECS for the hardened specs.
+ [[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env-r1.patch
+}
diff --git a/sys-devel/gcc/gcc-4.9.1.ebuild b/sys-devel/gcc/gcc-4.9.1.ebuild
new file mode 100644
index 000000000000..78274b682eb8
--- /dev/null
+++ b/sys-devel/gcc/gcc-4.9.1.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+PATCH_VER="1.0"
+UCLIBC_VER="1.0"
+
+# Hardened gcc 4 stuff
+PIE_VER="0.6.0"
+SPECS_VER="0.2.0"
+SPECS_GCC_VER="4.4.3"
+# arch/libc configurations known to be stable with {PIE,SSP}-by-default
+PIE_GLIBC_STABLE="x86 amd64 mips ppc ppc64 arm ia64"
+PIE_UCLIBC_STABLE="x86 arm amd64 mips ppc ppc64"
+SSP_STABLE="amd64 x86 mips ppc ppc64 arm"
+# uclibc need tls and nptl support for SSP support
+# uclibc need to be >= 0.9.33
+SSP_UCLIBC_STABLE="x86 amd64 mips ppc ppc64 arm"
+#end Hardened stuff
+
+inherit eutils toolchain
+
+KEYWORDS="~hppa"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ elibc_glibc? ( >=sys-libs/glibc-2.8 )
+ >=${CATEGORY}/binutils-2.20"
+
+if [[ ${CATEGORY} != cross-* ]] ; then
+ PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
+fi
+
+src_prepare() {
+ if has_version '<sys-libs/glibc-2.12' ; then
+ ewarn "Your host glibc is too old; disabling automatic fortify."
+ ewarn "Please rebuild gcc after upgrading to >=glibc-2.12 #362315"
+ EPATCH_EXCLUDE+=" 10_all_default-fortify-source.patch"
+ fi
+
+ toolchain_src_prepare
+
+ use vanilla && return 0
+ #Use -r1 for newer piepatchet that use DRIVER_SELF_SPECS for the hardened specs.
+ [[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env-r1.patch
+}
diff --git a/sys-devel/gcc/gcc-4.9.2.ebuild b/sys-devel/gcc/gcc-4.9.2.ebuild
new file mode 100644
index 000000000000..0e6c96900e32
--- /dev/null
+++ b/sys-devel/gcc/gcc-4.9.2.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+PATCH_VER="1.5"
+UCLIBC_VER="1.0"
+
+# Hardened gcc 4 stuff
+PIE_VER="0.6.2"
+SPECS_VER="0.2.0"
+SPECS_GCC_VER="4.4.3"
+# arch/libc configurations known to be stable with {PIE,SSP}-by-default
+PIE_GLIBC_STABLE="x86 amd64 mips ppc ppc64 arm ia64"
+PIE_UCLIBC_STABLE="x86 arm amd64 mips ppc ppc64"
+SSP_STABLE="amd64 x86 mips ppc ppc64 arm"
+# uclibc need tls and nptl support for SSP support
+# uclibc need to be >= 0.9.33
+SSP_UCLIBC_STABLE="x86 amd64 mips ppc ppc64 arm"
+#end Hardened stuff
+
+inherit eutils toolchain
+
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ elibc_glibc? ( >=sys-libs/glibc-2.8 )
+ >=${CATEGORY}/binutils-2.20"
+
+if [[ ${CATEGORY} != cross-* ]] ; then
+ PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
+fi
+
+src_prepare() {
+ if has_version '<sys-libs/glibc-2.12' ; then
+ ewarn "Your host glibc is too old; disabling automatic fortify."
+ ewarn "Please rebuild gcc after upgrading to >=glibc-2.12 #362315"
+ EPATCH_EXCLUDE+=" 10_all_default-fortify-source.patch"
+ fi
+
+ toolchain_src_prepare
+
+ use vanilla && return 0
+ #Use -r1 for newer piepatchet that use DRIVER_SELF_SPECS for the hardened specs.
+ [[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env-r1.patch
+}
diff --git a/sys-devel/gcc/gcc-4.9.3.ebuild b/sys-devel/gcc/gcc-4.9.3.ebuild
new file mode 100644
index 000000000000..f2a971c71421
--- /dev/null
+++ b/sys-devel/gcc/gcc-4.9.3.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+PATCH_VER="1.1"
+UCLIBC_VER="1.0"
+
+# Hardened gcc 4 stuff
+PIE_VER="0.6.2"
+SPECS_VER="0.2.0"
+SPECS_GCC_VER="4.4.3"
+# arch/libc configurations known to be stable with {PIE,SSP}-by-default
+PIE_GLIBC_STABLE="x86 amd64 mips ppc ppc64 arm ia64"
+PIE_UCLIBC_STABLE="x86 arm amd64 mips ppc ppc64"
+SSP_STABLE="amd64 x86 mips ppc ppc64 arm"
+# uclibc need tls and nptl support for SSP support
+# uclibc need to be >= 0.9.33
+SSP_UCLIBC_STABLE="x86 amd64 mips ppc ppc64 arm"
+#end Hardened stuff
+
+inherit eutils toolchain
+
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ elibc_glibc? ( >=sys-libs/glibc-2.8 )
+ >=${CATEGORY}/binutils-2.20"
+
+if [[ ${CATEGORY} != cross-* ]] ; then
+ PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
+fi
+
+src_prepare() {
+ if has_version '<sys-libs/glibc-2.12' ; then
+ ewarn "Your host glibc is too old; disabling automatic fortify."
+ ewarn "Please rebuild gcc after upgrading to >=glibc-2.12 #362315"
+ EPATCH_EXCLUDE+=" 10_all_default-fortify-source.patch"
+ fi
+
+ toolchain_src_prepare
+
+ use vanilla && return 0
+ #Use -r1 for newer piepatchet that use DRIVER_SELF_SPECS for the hardened specs.
+ [[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env-r1.patch
+}
diff --git a/sys-devel/gcc/gcc-5.1.0.ebuild b/sys-devel/gcc/gcc-5.1.0.ebuild
new file mode 100644
index 000000000000..27378f70d82e
--- /dev/null
+++ b/sys-devel/gcc/gcc-5.1.0.ebuild
@@ -0,0 +1,45 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+PATCH_VER="1.2"
+UCLIBC_VER="1.0"
+
+# Hardened gcc 4 stuff
+PIE_VER="0.6.3"
+SPECS_VER="0.2.0"
+SPECS_GCC_VER="4.4.3"
+# arch/libc configurations known to be stable with {PIE,SSP}-by-default
+PIE_GLIBC_STABLE="x86 amd64 mips ppc ppc64 arm ia64"
+PIE_UCLIBC_STABLE="x86 arm amd64 mips ppc ppc64"
+SSP_STABLE="amd64 x86 mips ppc ppc64 arm"
+# uclibc need tls and nptl support for SSP support
+# uclibc need to be >= 0.9.33
+SSP_UCLIBC_STABLE="x86 amd64 mips ppc ppc64 arm"
+#end Hardened stuff
+
+inherit toolchain
+
+#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ elibc_glibc? ( >=sys-libs/glibc-2.8 )
+ >=${CATEGORY}/binutils-2.20"
+
+if [[ ${CATEGORY} != cross-* ]] ; then
+ PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
+fi
+
+src_prepare() {
+ if has_version '<sys-libs/glibc-2.12' ; then
+ ewarn "Your host glibc is too old; disabling automatic fortify."
+ ewarn "Please rebuild gcc after upgrading to >=glibc-2.12 #362315"
+ EPATCH_EXCLUDE+=" 10_all_default-fortify-source.patch"
+ fi
+ is_crosscompile && EPATCH_EXCLUDE+=" 05_all_gcc-spec-env.patch"
+
+ toolchain_src_prepare
+}
diff --git a/sys-devel/gcc/gcc-5.2.0.ebuild b/sys-devel/gcc/gcc-5.2.0.ebuild
new file mode 100644
index 000000000000..9988210d41fa
--- /dev/null
+++ b/sys-devel/gcc/gcc-5.2.0.ebuild
@@ -0,0 +1,45 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+PATCH_VER="1.0"
+UCLIBC_VER="1.0"
+
+# Hardened gcc 4 stuff
+PIE_VER="0.6.3"
+SPECS_VER="0.2.0"
+SPECS_GCC_VER="4.4.3"
+# arch/libc configurations known to be stable with {PIE,SSP}-by-default
+PIE_GLIBC_STABLE="x86 amd64 mips ppc ppc64 arm ia64"
+PIE_UCLIBC_STABLE="x86 arm amd64 mips ppc ppc64"
+SSP_STABLE="amd64 x86 mips ppc ppc64 arm"
+# uclibc need tls and nptl support for SSP support
+# uclibc need to be >= 0.9.33
+SSP_UCLIBC_STABLE="x86 amd64 mips ppc ppc64 arm"
+#end Hardened stuff
+
+inherit toolchain
+
+#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ elibc_glibc? ( >=sys-libs/glibc-2.8 )
+ >=${CATEGORY}/binutils-2.20"
+
+if [[ ${CATEGORY} != cross-* ]] ; then
+ PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
+fi
+
+src_prepare() {
+ if has_version '<sys-libs/glibc-2.12' ; then
+ ewarn "Your host glibc is too old; disabling automatic fortify."
+ ewarn "Please rebuild gcc after upgrading to >=glibc-2.12 #362315"
+ EPATCH_EXCLUDE+=" 10_all_default-fortify-source.patch"
+ fi
+ is_crosscompile && EPATCH_EXCLUDE+=" 05_all_gcc-spec-env.patch"
+
+ toolchain_src_prepare
+}
diff --git a/sys-devel/gcc/metadata.xml b/sys-devel/gcc/metadata.xml
new file mode 100644
index 000000000000..a181266b55e0
--- /dev/null
+++ b/sys-devel/gcc/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>toolchain</herd>
+ <use>
+ <flag name="awt">Useful only when building GCJ, this enables Abstract Window Toolkit
+ (AWT) peer support on top of GTK+</flag>
+ <flag name="cilk">Support the Cilk Plus language (C/C++ based languages for parallel programming)</flag>
+ <flag name="d">Enable support for the D programming language</flag>
+ <flag name="fixed-point">Enable fixed-point arithmetic support for MIPS targets
+ in gcc (Warning: significantly increases compile time!)</flag>
+ <flag name="go">Build the GCC Go language frontend.</flag>
+ <flag name="graphite">Add support for the framework for loop
+ optimizations based on a polyhedral intermediate representation</flag>
+ <flag name="libssp">Build SSP support into a dedicated library rather than use the
+ code in the C library (DO NOT ENABLE THIS IF YOU DON'T KNOW WHAT IT DOES)</flag>
+ <flag name="mudflap">Add support for mudflap, a pointer use checking library</flag>
+ <flag name="multislot">Allow for SLOTs to include minor version (3.3.4
+ instead of just 3.3)</flag>
+ <flag name="nopie">Disable PIE support (NOT FOR GENERAL USE)</flag>
+ <flag name="nossp">Disable SSP support (NOT FOR GENERAL USE)</flag>
+ <flag name="objc">Build support for the Objective C code language</flag>
+ <flag name="objc++">Build support for the Objective C++ language</flag>
+ <flag name="objc-gc">Build support for the Objective C code language Garbage
+ Collector</flag>
+ <flag name="regression-test">Run the testsuite and install the results (requires FEATURES=test)</flag>
+ <flag name="sanitize">Build support various sanitizer functions (ASAN/TSAN/etc...)</flag>
+ </use>
+ <upstream>
+ <remote-id type="cpe">cpe:/a:gnu:gcc</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-devel/gdb-apple/Manifest b/sys-devel/gdb-apple/Manifest
new file mode 100644
index 000000000000..ffcf54bec7fc
--- /dev/null
+++ b/sys-devel/gdb-apple/Manifest
@@ -0,0 +1,12 @@
+DIST gdb-1344.tar.gz 17916770 SHA256 96c37c4bd4e8446e7f22411ca3972ccb240e5cfc256fe0593b012f12fdbcb7a1
+DIST gdb-1346.tar.gz 17913352 SHA256 1bda1693366e052150ce680d80a81df70cb8e61fe29fb3f9f3556e52ae141387
+DIST gdb-1461.2.tar.gz 17951571 SHA256 91d8cdbcd9cf36377d9c2d425921141085b5c79a6dce312a3dc0b6960f8e02f9
+DIST gdb-1518.tar.gz 17966113 SHA256 c3050f0be9cb60d86ffc5fd174da78bf986511a442526ef8b0eec1e77161f607
+DIST gdb-1705.tar.gz 17919005 SHA256 f0c4c145f2ef795c4742e0cd8b3f6a95f06c9985eee04a82260b62bdd8293d37
+DIST gdb-1708.tar.gz 17922049 SHA256 6ef5a8e09a28c78d3b7cee32b2886f72206ce519acaff5791fa08b90c9f0e327
+DIST gdb-1752.tar.gz 17922994 SHA256 8685227243cedc26954d175f28ed56ba5889410420aa888323e1eeaffb204ccf
+DIST gdb-563.tar.gz 17130626 SHA256 a41177e2edbac8982e01ca01dbd52bef65bd1604fb3a65278dd0f44509bb7179
+DIST gdb-768.tar.gz 17727326 SHA256 2342cbbf7c57dcc08011736c9823d5ca374156666ba73c4b67d9984ed944f24d
+DIST gdb-960.tar.gz 17875803 SHA256 921cb5317b934008bd5f7669cca811a0377c40b779277e9326198f4919f22d97
+DIST gdb-962.tar.gz 17876280 SHA256 b0b98aaf864797c6ffeab61b8a3d2b05d544d872969245825e257aa421f30700
+DIST gdb-966.tar.gz 17769429 SHA256 fc51d13dd4153e4ac6140fa5199699dc26387189fb0e37277bb50944410a445f
diff --git a/sys-devel/gdb-apple/files/gdb-apple-1344-darwin8.patch b/sys-devel/gdb-apple/files/gdb-apple-1344-darwin8.patch
new file mode 100644
index 000000000000..c95f02e0fe2e
--- /dev/null
+++ b/sys-devel/gdb-apple/files/gdb-apple-1344-darwin8.patch
@@ -0,0 +1,131 @@
+--- src/gdb/symfile.c.orig 2009-09-25 09:00:15 +0200
++++ src/gdb/symfile.c 2009-09-25 09:00:18 +0200
+@@ -67,7 +67,6 @@
+ #include <ctype.h>
+ #include <time.h>
+ #include <sys/time.h>
+-#include <libgen.h>
+
+ #include <sys/mman.h>
+
+--- src/gdb/utils.c.orig 2009-09-25 09:06:29 +0200
++++ src/gdb/utils.c 2009-09-25 09:46:24 +0200
+@@ -27,7 +27,6 @@
+ #include "gdb_string.h"
+ #include "event-top.h"
+ #include "exceptions.h"
+-#include <execinfo.h>
+
+ #ifdef TUI
+ #include "tui/tui.h" /* For tui_get_command_dimension. */
+@@ -878,6 +877,7 @@
+ target_terminal_ours ();
+ begin_line ();
+
++#if 0
+ /* APPLE LOCAL: Do a stack crawl of how we got here so we're more likely
+ to get useful bug reports. */
+ {
+@@ -886,6 +886,7 @@
+ fprintf (stderr, "gdb stack crawl at point of internal error:\n");
+ backtrace_symbols_fd (bt_buffer, count, STDERR_FILENO);
+ }
++#endif
+
+ /* Create a string containing the full error/warning message. Need
+ to call query with this full string, as otherwize the reason
+--- src/gdb/remote.c.orig 2009-09-25 09:31:58 +0200
++++ src/gdb/remote.c 2009-09-25 09:48:18 +0200
+@@ -61,7 +61,6 @@
+ #ifdef MACOSX_DYLD
+ #include "macosx-nat-dyld.h"
+ #endif
+-#include <execinfo.h>
+
+ /* Prototypes for local functions. */
+ static void cleanup_sigint_signal_handler (void *dummy);
+@@ -483,10 +482,12 @@
+ static void
+ remote_backtrace_self ()
+ {
++#if 0
+ void *bt_buffer[10];
+ int count = backtrace (bt_buffer, 10);
+ fprintf_filtered (gdb_stderr, "gdb stack crawl at point of invalid hex digit:\n");
+ backtrace_symbols_fd (bt_buffer, count, STDERR_FILENO);
++#endif
+ }
+
+ static void
+--- src/gdb/macosx/macosx-tdep.c.orig 2009-09-25 09:09:00 +0200
++++ src/gdb/macosx/macosx-tdep.c 2009-09-25 09:09:12 +0200
+@@ -61,7 +61,6 @@
+ #include "exceptions.h"
+
+ #include <dirent.h>
+-#include <libgen.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/param.h>
+--- src/gdb/macosx/macosx-nat-inferior.c.orig 2009-09-25 09:12:44 +0200
++++ src/gdb/macosx/macosx-nat-inferior.c 2009-09-25 09:13:24 +0200
+@@ -62,8 +62,10 @@
+ #include <semaphore.h>
+
+ #include <dlfcn.h>
++#if 0
+ #include <libproc.h>
+ #include <sys/proc_info.h>
++#endif
+
+ #include "macosx-nat-dyld.h"
+ #include "macosx-nat-inferior.h"
+@@ -3261,8 +3263,10 @@
+ int_flags |= RTLD_NOLOAD;
+ if (strstr (flags, "RTLD_NODELETE") != NULL)
+ int_flags |= RTLD_NODELETE;
++#ifdef RTLD_FIRST
+ if (strstr (flags, "RTLD_FIRST") != NULL)
+ int_flags |= RTLD_FIRST;
++#endif
+ }
+
+ /* If the user didn't pass in anything, set some sensible defaults. */
+--- src/gdb/macosx/macosx-nat-infthread.c.orig 2009-09-25 09:14:01 +0200
++++ src/gdb/macosx/macosx-nat-infthread.c 2009-09-25 09:14:19 +0200
+@@ -36,8 +36,10 @@
+ #include <sys/dir.h>
+ #include <inttypes.h>
+
++#if 0
+ #include <libproc.h>
+ #include <sys/proc_info.h>
++#endif
+
+ #include "macosx-nat-inferior.h"
+ #include "macosx-nat-inferior-util.h"
+--- src/gdb/macosx/macosx-nat-info.c.orig 2009-09-25 09:16:50 +0200
++++ src/gdb/macosx/macosx-nat-info.c 2009-09-25 09:31:12 +0200
+@@ -45,6 +45,22 @@
+ #include "macosx-nat-inferior.h"
+ #include "macosx-nat-inferior-debug.h"
+
++#ifdef __ppc__
++#ifndef __darwin_ppc_thread_state
++#define __darwin_ppc_thread_state ppc_thread_state
++#define __r0 r0
++#define __srr0 srr0
++#define __srr1 srr1
++#define __cr cr
++#define __xer xer
++#define __lr lr
++#define __ctr ctr
++#endif
++#ifndef __darwin_ppc_exception_state
++#define __darwin_ppc_exception_state ppc_exception_state
++#endif
++#endif
++
+ extern macosx_inferior_status *macosx_status;
+
+ #define CHECK_ARGS(what, args) \
diff --git a/sys-devel/gdb-apple/files/gdb-apple-1461-darwin8.patch b/sys-devel/gdb-apple/files/gdb-apple-1461-darwin8.patch
new file mode 100644
index 000000000000..40ef761e8f70
--- /dev/null
+++ b/sys-devel/gdb-apple/files/gdb-apple-1461-darwin8.patch
@@ -0,0 +1,128 @@
+--- gdb-1461.2/src/gdb/macosx/macosx-nat-inferior.c
++++ gdb-1461.2/src/gdb/macosx/macosx-nat-inferior.c
+@@ -60,13 +60,17 @@
+ #include <sys/sysctl.h>
+ #include <sys/proc.h>
+ #include <mach/mach_error.h>
++#if defined(TARGET_ARM)
+ #include <spawn.h>
++#endif
+
+ #include <semaphore.h>
+
+ #include <dlfcn.h>
++#if 0
+ #include <libproc.h>
+ #include <sys/proc_info.h>
++#endif
+
+ #include "macosx-nat-dyld.h"
+ #include "macosx-nat-inferior.h"
+--- gdb-1461.2/src/gdb/macosx/macosx-nat-info.c
++++ gdb-1461.2/src/gdb/macosx/macosx-nat-info.c
+@@ -45,6 +45,22 @@
+ #include "macosx-nat-inferior.h"
+ #include "macosx-nat-inferior-debug.h"
+
++#ifdef __ppc__
++#ifndef __darwin_ppc_thread_state
++#define __darwin_ppc_thread_state ppc_thread_state
++#define __r0 r0
++#define __srr0 srr0
++#define __srr1 srr1
++#define __cr cr
++#define __xer xer
++#define __lr lr
++#define __ctr ctr
++#endif
++#ifndef __darwin_ppc_exception_state
++#define __darwin_ppc_exception_state ppc_exception_state
++#endif
++#endif
++
+ extern macosx_inferior_status *macosx_status;
+
+ #define CHECK_ARGS(what, args) \
+--- gdb-1461.2/src/gdb/macosx/macosx-nat-infthread.c
++++ gdb-1461.2/src/gdb/macosx/macosx-nat-infthread.c
+@@ -36,8 +36,10 @@
+ #include <sys/dir.h>
+ #include <inttypes.h>
+
++#if 0
+ #include <libproc.h>
+ #include <sys/proc_info.h>
++#endif
+
+ #include "macosx-nat-inferior.h"
+ #include "macosx-nat-inferior-util.h"
+--- gdb-1461.2/src/gdb/macosx/macosx-tdep.c
++++ gdb-1461.2/src/gdb/macosx/macosx-tdep.c
+@@ -63,7 +63,6 @@
+ #include "gdbcore.h"
+
+ #include <dirent.h>
+-#include <libgen.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/param.h>
+--- gdb-1461.2/src/gdb/remote.c
++++ gdb-1461.2/src/gdb/remote.c
+@@ -62,7 +62,6 @@
+ #include "macosx-nat-dyld.h"
+ #include "macosx-nat-dyld-process.h"
+ #endif
+-#include <execinfo.h>
+
+ /* Prototypes for local functions. */
+ static void cleanup_sigint_signal_handler (void *dummy);
+@@ -474,11 +473,13 @@
+ static void
+ remote_backtrace_self (const char *message)
+ {
++#if 0
+ void *bt_buffer[100];
+ int count = backtrace (bt_buffer, 100);
+ if (message && message[0])
+ fprintf_filtered (gdb_stderr, "%s", message);
+ backtrace_symbols_fd (bt_buffer, count, STDERR_FILENO);
++#endif
+ }
+
+ static void
+--- gdb-1461.2/src/gdb/symfile.c
++++ gdb-1461.2/src/gdb/symfile.c
+@@ -67,7 +67,6 @@
+ #include <ctype.h>
+ #include <time.h>
+ #include <sys/time.h>
+-#include <libgen.h>
+
+ #include <sys/mman.h>
+
+--- gdb-1461.2/src/gdb/utils.c
++++ gdb-1461.2/src/gdb/utils.c
+@@ -27,7 +27,6 @@
+ #include "gdb_string.h"
+ #include "event-top.h"
+ #include "exceptions.h"
+-#include <execinfo.h>
+
+ #ifdef TUI
+ #include "tui/tui.h" /* For tui_get_command_dimension. */
+@@ -874,6 +873,7 @@
+ target_terminal_ours ();
+ begin_line ();
+
++#if 0
+ /* APPLE LOCAL: Do a stack crawl of how we got here so we're more likely
+ to get useful bug reports. */
+ {
+@@ -882,6 +882,7 @@
+ fprintf (stderr, "gdb stack crawl at point of internal error:\n");
+ backtrace_symbols_fd (bt_buffer, count, STDERR_FILENO);
+ }
++#endif
+
+ /* Create a string containing the full error/warning message. Need
+ to call query with this full string, as otherwize the reason
diff --git a/sys-devel/gdb-apple/files/gdb-apple-1461-dyld-info.patch b/sys-devel/gdb-apple/files/gdb-apple-1461-dyld-info.patch
new file mode 100644
index 000000000000..75b910432278
--- /dev/null
+++ b/sys-devel/gdb-apple/files/gdb-apple-1461-dyld-info.patch
@@ -0,0 +1,22 @@
+If dyld-info is not available, don't try to compile unreachable code
+using it either.
+
+--- gdb-1461.2/src/gdb/macosx/macosx-nat-dyld.c
++++ gdb-1461.2/src/gdb/macosx/macosx-nat-dyld.c
+@@ -731,7 +731,7 @@
+ {
+ #if !defined (TASK_DYLD_INFO) || !defined (NM_NEXTSTEP)
+ return 0;
+-#endif
++#else
+
+ if (target_is_remote () || value == NULL)
+ return 0;
+@@ -791,6 +791,7 @@
+ }
+ #endif /* NM_NEXTSTEP */
+ return 0;
++#endif
+ }
+
+ /* Searches the target address space for dyld itself, returning it in
diff --git a/sys-devel/gdb-apple/files/gdb-apple-1518-darwin8-9.patch b/sys-devel/gdb-apple/files/gdb-apple-1518-darwin8-9.patch
new file mode 100644
index 000000000000..a05169cec25d
--- /dev/null
+++ b/sys-devel/gdb-apple/files/gdb-apple-1518-darwin8-9.patch
@@ -0,0 +1,87 @@
+--- src/gdb/macosx/macosx-nat-dyld.c
++++ src/gdb/macosx/macosx-nat-dyld.c
+@@ -2083,7 +2083,9 @@
+ case MH_DYLIB:
+ case MH_DYLINKER:
+ case MH_BUNDLE:
++#ifdef MH_KEXT_BUNDLE
+ case MH_KEXT_BUNDLE:
++#endif
+ break;
+ case MH_FVMLIB:
+ case MH_PRELOAD:
+@@ -2412,7 +2414,9 @@
+ break;
+ case MH_DYLINKER:
+ case MH_BUNDLE:
++#ifdef MH_KEXT_BUNDLE
+ case MH_KEXT_BUNDLE:
++#endif
+ entry->reason = dyld_reason_dyld;
+ break;
+ default:
+--- src/gdb/macosx/macosx-nat-dyld-process.c
++++ src/gdb/macosx/macosx-nat-dyld-process.c
+@@ -407,7 +407,9 @@
+ case MH_DYLIB:
+ break;
+ case MH_BUNDLE:
++#ifdef MH_KEXT_BUNDLE
+ case MH_KEXT_BUNDLE:
++#endif
+ break;
+ default:
+ return;
+ return;
+--- src/gdb/macosx/macosx-nat-inferior.c
++++ src/gdb/macosx/macosx-nat-inferior.c
+@@ -2692,6 +2692,7 @@
+ if (tp->private == NULL || tp->private->app_thread_port == 0)
+ return NULL;
+
++#ifdef THREAD_IDENTIFIER_INFO_COUNT
+ thread_identifier_info_data_t tident;
+ unsigned int info_count;
+ kern_return_t kret;
+@@ -2719,6 +2720,7 @@
+ }
+ }
+ }
++#endif
+ return buf;
+ }
+
+--- src/gdb/macosx/macosx-nat-infthread.c
++++ src/gdb/macosx/macosx-nat-infthread.c
+@@ -809,6 +809,7 @@
+ print_stack_frame (get_selected_frame (NULL), 0, LOCATION);
+ switch_to_thread (current_ptid);
+
++#ifdef THREAD_IDENTIFIER_INFO_COUNT
+ thread_identifier_info_data_t tident;
+ info_count = THREAD_IDENTIFIER_INFO_COUNT;
+ kret = thread_info (tid, THREAD_IDENTIFIER_INFO, (thread_info_t) &tident,
+@@ -878,6 +879,7 @@
+ printf_filtered ("\tcurrent priority: %d\n", pth.pth_priority);
+ printf_filtered ("\tmax priority: %d\n", pth.pth_maxpriority);
+ }
++#endif
+
+ printf_filtered ("\tsuspend count: %d", info.suspend_count);
+
+@@ -1175,6 +1177,7 @@
+ ui_out_field_fmt (uiout, "mach-port-number", "0x%s",
+ paddr_nz (app_thread_name));
+
++#ifdef THREAD_IDENTIFIER_INFO_COUNT
+ thread_identifier_info_data_t tident;
+ info_count = THREAD_IDENTIFIER_INFO_COUNT;
+ kret = thread_info (tid, THREAD_IDENTIFIER_INFO, (thread_info_t) &tident,
+@@ -1207,6 +1210,7 @@
+ paddr_nz (struct_addr));
+ }
+ }
++#endif
+ }
+
+
diff --git a/sys-devel/gdb-apple/files/gdb-apple-1518-darwin8.patch b/sys-devel/gdb-apple/files/gdb-apple-1518-darwin8.patch
new file mode 100644
index 000000000000..f8ecc30be7f6
--- /dev/null
+++ b/sys-devel/gdb-apple/files/gdb-apple-1518-darwin8.patch
@@ -0,0 +1,128 @@
+--- src/gdb/macosx/macosx-nat-inferior.c
++++ src/gdb/macosx/macosx-nat-inferior.c
+@@ -60,13 +60,17 @@
+ #include <sys/sysctl.h>
+ #include <sys/proc.h>
+ #include <mach/mach_error.h>
++#if defined(TARGET_ARM)
+ #include <spawn.h>
++#endif
+
+ #include <semaphore.h>
+
+ #include <dlfcn.h>
++#if 0
+ #include <libproc.h>
+ #include <sys/proc_info.h>
++#endif
+
+ #include "macosx-nat-dyld.h"
+ #include "macosx-nat-inferior.h"
+--- src/gdb/macosx/macosx-nat-info.c
++++ src/gdb/macosx/macosx-nat-info.c
+@@ -45,6 +45,22 @@
+ #include "macosx-nat-inferior.h"
+ #include "macosx-nat-inferior-debug.h"
+
++#ifdef __ppc__
++#ifndef __darwin_ppc_thread_state
++#define __darwin_ppc_thread_state ppc_thread_state
++#define __r0 r0
++#define __srr0 srr0
++#define __srr1 srr1
++#define __cr cr
++#define __xer xer
++#define __lr lr
++#define __ctr ctr
++#endif
++#ifndef __darwin_ppc_exception_state
++#define __darwin_ppc_exception_state ppc_exception_state
++#endif
++#endif
++
+ extern macosx_inferior_status *macosx_status;
+
+ #define CHECK_ARGS(what, args) \
+--- src/gdb/macosx/macosx-nat-infthread.c
++++ src/gdb/macosx/macosx-nat-infthread.c
+@@ -36,8 +36,10 @@
+ #include <sys/dir.h>
+ #include <inttypes.h>
+
++#if 0
+ #include <libproc.h>
+ #include <sys/proc_info.h>
++#endif
+
+ #include "macosx-nat-inferior.h"
+ #include "macosx-nat-inferior-util.h"
+--- src/gdb/macosx/macosx-tdep.c
++++ src/gdb/macosx/macosx-tdep.c
+@@ -64,7 +64,6 @@
+ #include "gdbcore.h"
+
+ #include <dirent.h>
+-#include <libgen.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/param.h>
+--- src/gdb/remote.c
++++ src/gdb/remote.c
+@@ -63,7 +63,6 @@
+ #include "macosx-nat-dyld.h"
+ #include "macosx-nat-dyld-process.h"
+ #endif
+-#include <execinfo.h>
+
+ /* Prototypes for local functions. */
+ static void cleanup_sigint_signal_handler (void *dummy);
+@@ -475,11 +474,13 @@
+ static void
+ remote_backtrace_self (const char *message)
+ {
++#if 0
+ void *bt_buffer[100];
+ int count = backtrace (bt_buffer, 100);
+ if (message && message[0])
+ fprintf_filtered (gdb_stderr, "%s", message);
+ backtrace_symbols_fd (bt_buffer, count, STDERR_FILENO);
++#endif
+ }
+
+ static void
+--- src/gdb/symfile.c
++++ src/gdb/symfile.c
+@@ -67,7 +67,6 @@
+ #include <ctype.h>
+ #include <time.h>
+ #include <sys/time.h>
+-#include <libgen.h>
+
+ #include <sys/mman.h>
+
+--- src/gdb/utils.c
++++ src/gdb/utils.c
+@@ -28,7 +28,6 @@
+ #include "event-top.h"
+ #include "exceptions.h"
+ #include "bfd.h"
+-#include <execinfo.h>
+ #include <sys/resource.h>
+ #include <uuid/uuid.h>
+
+@@ -879,6 +878,7 @@
+ target_terminal_ours ();
+ begin_line ();
+
++#if 0
+ /* APPLE LOCAL: Do a stack crawl of how we got here so we're more likely
+ to get useful bug reports. */
+ {
+@@ -887,6 +887,7 @@
+ fprintf (stderr, "gdb stack crawl at point of internal error:\n");
+ backtrace_symbols_fd (bt_buffer, count, STDERR_FILENO);
+ }
++#endif
+
+ /* Create a string containing the full error/warning message. Need
+ to call query with this full string, as otherwize the reason
diff --git a/sys-devel/gdb-apple/files/gdb-apple-1518-task_dyld_info.patch b/sys-devel/gdb-apple/files/gdb-apple-1518-task_dyld_info.patch
new file mode 100644
index 000000000000..633a36a7a048
--- /dev/null
+++ b/sys-devel/gdb-apple/files/gdb-apple-1518-task_dyld_info.patch
@@ -0,0 +1,22 @@
+If dyld-info is not available, don't try to compile unreachable code
+using it either.
+
+--- gdb-1518/src/gdb/macosx/macosx-nat-dyld.c
++++ gdb-1518/src/gdb/macosx/macosx-nat-dyld.c
+@@ -779,7 +779,7 @@
+ {
+ #if !defined (TASK_DYLD_INFO)
+ return 0;
+-#endif
++#else
+ if (macosx_status->task == TASK_NULL)
+ return 0;
+
+@@ -799,6 +799,7 @@
+ task_dyld_info.all_image_info_size == 0)
+ return 0;
+ s->dyld_image_infos = task_dyld_info.all_image_info_addr;
++#endif /* TASK_DYLD_INFO */
+ }
+ #endif /* NM_NEXTSTEP */
+
diff --git a/sys-devel/gdb-apple/files/gdb-apple-1705-darwin8-10.patch b/sys-devel/gdb-apple/files/gdb-apple-1705-darwin8-10.patch
new file mode 100644
index 000000000000..32247431fe89
--- /dev/null
+++ b/sys-devel/gdb-apple/files/gdb-apple-1705-darwin8-10.patch
@@ -0,0 +1,11 @@
+--- src/gdb/macosx/macosx-nat-dyld.c
++++ src/gdb/macosx/macosx-nat-dyld.c
+@@ -788,7 +788,7 @@
+ }
+ else
+ {
+-#if defined (NM_NEXTSTEP)
++#if defined (NM_NEXTSTEP) && defined(TASK_DYLD_INFO_COUNT)
+ if (macosx_status->task == TASK_NULL)
+ return 0;
+
diff --git a/sys-devel/gdb-apple/files/gdb-apple-563-darwin7.patch b/sys-devel/gdb-apple/files/gdb-apple-563-darwin7.patch
new file mode 100644
index 000000000000..bd5061d41fc0
--- /dev/null
+++ b/sys-devel/gdb-apple/files/gdb-apple-563-darwin7.patch
@@ -0,0 +1,110 @@
+* Fabian Groffen <grobian@gentoo.org>
+ Mac OS X Panther (10.3) doesn't have mach_vm_size_t yet, and
+ apparently this was forseen in macosx-nat-inferior-debug.c. However,
+ macosx-nat-inferior-debug.h also uses the provided types, hence we
+ move the backwards-compatibility logic to the .h file.
+
+* Fabian Groffen <grobian@gentoo.org>
+ On Mac OS X Panther (10.3) an older version of the Launch Services is
+ available, which doesn't cover the requirements made by Xcode here.
+ Because it's for Xcode only, and we don't use it on Gentoo, we just
+ enable the functionality that doesn't compile on 10.3.
+
+--- gdb/macosx/macosx-nat-inferior-debug.c
++++ gdb/macosx/macosx-nat-inferior-debug.c
+@@ -53,24 +53,6 @@
+
+ #include <AvailabilityMacros.h>
+
+-#define MACH64 (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
+-
+-#if MACH64
+-
+-#include <mach/mach_vm.h>
+-
+-#else /* ! MACH64 */
+-
+-#define mach_vm_size_t vm_size_t
+-#define mach_vm_address_t vm_address_t
+-#define mach_vm_read vm_read
+-#define mach_vm_write vm_write
+-#define mach_vm_region vm_region
+-#define VM_REGION_BASIC_INFO_COUNT_64 VM_REGION_BASIC_INFO_COUNT
+-#define VM_REGION_BASIC_INFO_64 VM_REGION_BASIC_INFO
+-
+-#endif /* MACH64 */
+-
+ FILE *inferior_stderr = NULL;
+ int inferior_debug_flag = 0;
+ int timestamps_debug_flag = 0;
+--- gdb/macosx/macosx-nat-inferior-debug.h
++++ gdb/macosx/macosx-nat-inferior-debug.h
+@@ -6,6 +6,24 @@
+
+ #include "defs.h"
+
++#define MACH64 (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
++
++#if MACH64
++
++#include <mach/mach_vm.h>
++
++#else /* ! MACH64 */
++
++#define mach_vm_size_t vm_size_t
++#define mach_vm_address_t vm_address_t
++#define mach_vm_read vm_read
++#define mach_vm_write vm_write
++#define mach_vm_region vm_region
++#define VM_REGION_BASIC_INFO_COUNT_64 VM_REGION_BASIC_INFO_COUNT
++#define VM_REGION_BASIC_INFO_64 VM_REGION_BASIC_INFO
++
++#endif /* MACH64 */
++
+ extern FILE *inferior_stderr;
+ extern int inferior_debug_flag;
+
+--- gdb/macosx/macosx-tdep.c
++++ gdb/macosx/macosx-tdep.c
+@@ -413,6 +413,7 @@
+ } BabelAESelInfo;
+ #pragma options align=reset
+
++#if (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
+ static int
+ open_file_with_LS (const char *file_path, int lineno)
+ {
+@@ -538,7 +539,9 @@
+
+ return 1;
+ }
++#endif
+
++#if (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
+ /* Opens the file pointed to in ARGS with the default editor
+ given by LaunchServices. If ARGS is NULL, opens the current
+ source file & line. You can also supply file:line and it will
+@@ -609,6 +612,7 @@
+
+ open_file_with_LS (filename, line_no);
+ }
++#endif
+
+ void
+ _initialize_macosx_tdep ()
+@@ -618,13 +622,15 @@
+
+ add_info ("trampoline", info_trampoline_command,
+ "Resolve function for DYLD trampoline stub and/or Objective-C call");
++#if (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
+ c = add_com ("open", class_support, open_command, _("\
+ Open the named source file in an application determined by LaunchServices.\n\
+ With no arguments, open the currently selected source file.\n\
+ Also takes file:line to hilight the file at the given line."));
+ set_cmd_completer (c, filename_completer);
+ add_com_alias ("op", "open", class_support, 1);
+ add_com_alias ("ope", "open", class_support, 1);
++#endif
+
+ add_com ("flushstack", class_maintenance, stack_flush_command,
+ "Force gdb to flush its stack-frame cache (maintainer command)");
diff --git a/sys-devel/gdb-apple/files/gdb-apple-563-no-64bit.patch b/sys-devel/gdb-apple/files/gdb-apple-563-no-64bit.patch
new file mode 100644
index 000000000000..952f5b337871
--- /dev/null
+++ b/sys-devel/gdb-apple/files/gdb-apple-563-no-64bit.patch
@@ -0,0 +1,19 @@
+* Fabian Groffen <grobian@gentoo.org>
+ On Gentoo, when the user doesn't have a 64-bits capable CPU, we
+ compile GCC without multi-lib support. Hence, 64-bits defines are not
+ available so we better not use them if we don't have __ppc64__
+ defined.
+
+--- gdb/macosx/macosx-nat-dyld.c
++++ gdb/macosx/macosx-nat-dyld.c
+@@ -619,8 +619,10 @@
+ structures. */
+ if (header.cputype == CPU_TYPE_POWERPC || header.cputype == CPU_TYPE_I386)
+ osabi_seen_in_attached_dyld = GDB_OSABI_DARWIN;
++#if defined(__ppc64__)
+ if (header.cputype == CPU_TYPE_POWERPC64 || header.cputype == GDB_CPU_TYPE_X86_64)
+ osabi_seen_in_attached_dyld = GDB_OSABI_DARWIN64;
++#endif
+ }
+
+ /* Once we know the address at which dyld was loaded, we can try to
diff --git a/sys-devel/gdb-apple/files/gdb-apple-768-darwin-arch.patch b/sys-devel/gdb-apple/files/gdb-apple-768-darwin-arch.patch
new file mode 100644
index 000000000000..5442ba8ba636
--- /dev/null
+++ b/sys-devel/gdb-apple/files/gdb-apple-768-darwin-arch.patch
@@ -0,0 +1,15 @@
+* configure checks for /usr/bin/arch to determine whether "arch" is ok
+ to use, so don't rely on the path at runtime, since GNU arch doesn't
+ understand -arch at all (and only returns the current arch name)
+
+--- src/gdb/fork-child.c
++++ src/gdb/fork-child.c
+@@ -243,7 +243,7 @@
+ arch_string = "x86_64";
+ #endif
+ if (arch_string != NULL)
+- sprintf (shell_command, "%s exec arch -arch %s ", shell_command, arch_string);
++ sprintf (shell_command, "%s exec /usr/bin/arch -arch %s ", shell_command, arch_string);
+ else
+ strcat (shell_command, "exec ");
+ }
diff --git a/sys-devel/gdb-apple/files/gdb-apple-768-texinfo.patch b/sys-devel/gdb-apple/files/gdb-apple-768-texinfo.patch
new file mode 100644
index 000000000000..41153d8436de
--- /dev/null
+++ b/sys-devel/gdb-apple/files/gdb-apple-768-texinfo.patch
@@ -0,0 +1,10 @@
+--- src/Makefile.in
++++ src/Makefile.in
+@@ -280,6 +280,6 @@
+ then echo $$r/$(BUILD_SUBDIR)/texinfo/makeinfo/makeinfo ; \
+ else if (${CONFIGURED_MAKEINFO} --version \
+- | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[2-9]|[5-9])') >/dev/null 2>&1; \
++ | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[2-9]|4\.[1-9][0-9]|[5-9])') >/dev/null 2>&1; \
+ then echo ${CONFIGURED_MAKEINFO}; else echo $$s/missing makeinfo; fi; fi`
+
+ # This just becomes part of the MAKEINFO definition passed down to
diff --git a/sys-devel/gdb-apple/files/gdb-apple-962-darwin64.patch b/sys-devel/gdb-apple/files/gdb-apple-962-darwin64.patch
new file mode 100644
index 000000000000..4417cee76e4d
--- /dev/null
+++ b/sys-devel/gdb-apple/files/gdb-apple-962-darwin64.patch
@@ -0,0 +1,17 @@
+* todo: extend for powerpc64 also
+
+--- src/bfd/config.bfd.orig 2009-06-23 11:05:43 +0200
++++ src/bfd/config.bfd 2009-06-23 11:05:47 +0200
+@@ -500,6 +500,12 @@
+ targ_archs="bfd_i386_arch bfd_powerpc_arch bfd_rs6000_arch"
+ targ_underscore=yes
+ ;;
++ x86_64-*-darwin*)
++ targ_defvec=mach_o_le_vec
++ targ_selvecs="mach_o_le_vec mach_o_be_vec mach_o_fat_vec pef_vec pef_xlib_vec sym_vec"
++ targ_archs="bfd_i386_arch bfd_powerpc_arch bfd_rs6000_arch"
++ targ_underscore=yes
++ ;;
+ i[3-7]86-sequent-bsd*)
+ targ_defvec=i386dynix_vec
+ targ_underscore=yes
diff --git a/sys-devel/gdb-apple/files/gdb-apple-962-darwin8.patch b/sys-devel/gdb-apple/files/gdb-apple-962-darwin8.patch
new file mode 100644
index 000000000000..05a088b93fb3
--- /dev/null
+++ b/sys-devel/gdb-apple/files/gdb-apple-962-darwin8.patch
@@ -0,0 +1,15 @@
+* 10.4 doesn't have posix spawn, but fortunately it's only used on ARM
+ (iPhone), so we can still compile it
+
+--- src/gdb/macosx/macosx-nat-inferior.c
++++ src/gdb/macosx/macosx-nat-inferior.c
+@@ -58,7 +58,9 @@
+ #include <sys/sysctl.h>
+ #include <sys/proc.h>
+ #include <mach/mach_error.h>
++#ifdef TARGET_ARM
+ #include <spawn.h>
++#endif
+
+ #include "macosx-nat-dyld.h"
+ #include "macosx-nat-inferior.h"
diff --git a/sys-devel/gdb-apple/files/gdb-apple-962-demangle.patch b/sys-devel/gdb-apple/files/gdb-apple-962-demangle.patch
new file mode 100644
index 000000000000..a302ce56ec91
--- /dev/null
+++ b/sys-devel/gdb-apple/files/gdb-apple-962-demangle.patch
@@ -0,0 +1,22 @@
+in 32-bits mode this goes /just/ right, in 64-bits mode Portage aborts
+because objc_demangle is implicitly turned into a pointer
+
+--- src/gdb/maint.c.orig 2009-06-23 11:12:15 +0200
++++ src/gdb/maint.c 2009-06-23 11:19:58 +0200
+@@ -31,6 +31,7 @@
+ #include "symtab.h"
+ #include "gdbtypes.h"
+ #include "demangle.h"
++#include "objc-lang.h"
+ #include "gdbcore.h"
+ #include "expression.h" /* For language.h */
+ #include "language.h"
+@@ -167,7 +168,7 @@
+ switch (current_language->la_language)
+ {
+ case language_objc:
+- demangled = objc_demangle (args);
++ demangled = objc_demangle (args, 0);
+ break;
+ case language_objcplus:
+ case language_cplus:
diff --git a/sys-devel/gdb-apple/files/gdb-apple-no-global-gdbinit.patch b/sys-devel/gdb-apple/files/gdb-apple-no-global-gdbinit.patch
new file mode 100644
index 000000000000..0c132ec5b384
--- /dev/null
+++ b/sys-devel/gdb-apple/files/gdb-apple-no-global-gdbinit.patch
@@ -0,0 +1,23 @@
+Sourcing /etc/gdb.conf is annoying mainly because Apple put
+ set history save on
+in there, which means everywhere you run it, you end up with a
+.gdb_history file.
+
+--- src/gdb/main.c
++++ src/gdb/main.c
+@@ -675,6 +675,7 @@
+ memset (&cwdbuf, 0, sizeof (struct stat));
+ /* APPLE LOCAL end move inits up */
+ /* APPLE LOCAL begin global gdbinit */
++#ifdef WANT_GLOBAL_GDBINIT
+ memset (&globalbuf, 0, sizeof (struct stat));
+ stat (gdbinit_global, &globalbuf);
+ if (!inhibit_gdbinit)
+@@ -683,6 +684,7 @@
+ source_file (gdbinit_global, 0);
+ }
+ do_cleanups (ALL_CLEANUPS);
++#endif
+ /* APPLE LOCAL end global gdbinit */
+
+ /* APPLE LOCAL: Set the $_Xcode convenience variable at '0' before sourcing
diff --git a/sys-devel/gdb-apple/gdb-apple-1344.ebuild b/sys-devel/gdb-apple/gdb-apple-1344.ebuild
new file mode 100644
index 000000000000..52b47aed6fd3
--- /dev/null
+++ b/sys-devel/gdb-apple/gdb-apple-1344.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils flag-o-matic
+
+DESCRIPTION="Apple branch of the GNU Debugger, Developer Tools 3.2"
+HOMEPAGE="http://sourceware.org/gdb/"
+SRC_URI="http://www.opensource.apple.com/darwinsource/tarballs/other/gdb-${PV}.tar.gz"
+
+LICENSE="APSL-2 GPL-2"
+SLOT="0"
+
+KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
+
+IUSE="nls"
+
+RDEPEND=">=sys-libs/ncurses-5.2-r2
+ =dev-db/sqlite-3*"
+DEPEND="${RDEPEND}
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/gdb-${PV}/src
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-768-texinfo.patch
+ [[ ${CHOST} == *-darwin8 ]] && epatch "${FILESDIR}"/${PN}-1344-darwin8.patch
+
+ # for FSF gcc / gcc-apple:42
+ sed -e 's/-Wno-long-double//' -i gdb/config/*/macosx.mh
+}
+
+src_configure() {
+ replace-flags -O? -O2
+ econf \
+ --disable-werror \
+ $(use_enable nls) \
+ || die
+}
+
+src_install() {
+ emake DESTDIR="${D}" libdir=/nukeme includedir=/nukeme install || die
+ rm -R "${D}"/nukeme || die
+ rm -Rf "${ED}"/usr/${CHOST} || die
+ mv "${ED}"/usr/bin/gdb "${ED}"/
+ rm -f "${ED}"/usr/bin/*
+ mv "${ED}"/gdb "${ED}"/usr/bin/
+}
+
+pkg_postinst() {
+ if [[ ${CHOST} == *-darwin* && ${CHOST#*-darwin} -ge 9 ]] ; then
+ ewarn "Due to increased security measures in 10.5 and up, gdb is"
+ ewarn "not able to get a mach task port when installed by Prefix"
+ ewarn "Portage, unprivileged. To make gdb fully functional you'll"
+ ewarn "have to perform the following steps:"
+ ewarn " % sudo chgrp procmod ${EPREFIX}/usr/bin/gdb"
+ ewarn " % sudo chmod g+s ${EPREFIX}/usr/bin/gdb"
+ fi
+}
diff --git a/sys-devel/gdb-apple/gdb-apple-1346.ebuild b/sys-devel/gdb-apple/gdb-apple-1346.ebuild
new file mode 100644
index 000000000000..96e7e1ac7f99
--- /dev/null
+++ b/sys-devel/gdb-apple/gdb-apple-1346.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils flag-o-matic
+
+DESCRIPTION="Apple branch of the GNU Debugger, Developer Tools 3.2.1"
+HOMEPAGE="http://sourceware.org/gdb/"
+SRC_URI="http://www.opensource.apple.com/darwinsource/tarballs/other/gdb-${PV}.tar.gz"
+
+LICENSE="APSL-2 GPL-2"
+SLOT="0"
+
+KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
+
+IUSE="nls"
+
+RDEPEND=">=sys-libs/ncurses-5.2-r2
+ =dev-db/sqlite-3*"
+DEPEND="${RDEPEND}
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/gdb-${PV}/src
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-768-texinfo.patch
+ [[ ${CHOST} == *-darwin8 ]] && epatch "${FILESDIR}"/${PN}-1344-darwin8.patch
+
+ # for FSF gcc / gcc-apple:42
+ sed -e 's/-Wno-long-double//' -i gdb/config/*/macosx.mh
+}
+
+src_configure() {
+ replace-flags -O? -O2
+ econf \
+ --disable-werror \
+ $(use_enable nls) \
+ || die
+}
+
+src_install() {
+ emake DESTDIR="${D}" libdir=/nukeme includedir=/nukeme install || die
+ rm -R "${D}"/nukeme || die
+ rm -Rf "${ED}"/usr/${CHOST} || die
+ mv "${ED}"/usr/bin/gdb "${ED}"/
+ rm -f "${ED}"/usr/bin/*
+ mv "${ED}"/gdb "${ED}"/usr/bin/
+}
+
+pkg_postinst() {
+ if [[ ${CHOST} == *-darwin* && ${CHOST#*-darwin} -ge 9 ]] ; then
+ ewarn "Due to increased security measures in 10.5 and up, gdb is"
+ ewarn "not able to get a mach task port when installed by Prefix"
+ ewarn "Portage, unprivileged. To make gdb fully functional you'll"
+ ewarn "have to perform the following steps:"
+ ewarn " % sudo chgrp procmod ${EPREFIX}/usr/bin/gdb"
+ ewarn " % sudo chmod g+s ${EPREFIX}/usr/bin/gdb"
+ fi
+}
diff --git a/sys-devel/gdb-apple/gdb-apple-1461.ebuild b/sys-devel/gdb-apple/gdb-apple-1461.ebuild
new file mode 100644
index 000000000000..44400eff9033
--- /dev/null
+++ b/sys-devel/gdb-apple/gdb-apple-1461.ebuild
@@ -0,0 +1,65 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils flag-o-matic
+
+APPLE_PV=${PV}.2
+DESCRIPTION="Apple branch of the GNU Debugger, Developer Tools 3.2.2"
+HOMEPAGE="http://sourceware.org/gdb/"
+SRC_URI="http://www.opensource.apple.com/darwinsource/tarballs/other/gdb-${APPLE_PV}.tar.gz"
+
+LICENSE="APSL-2 GPL-2"
+SLOT="0"
+
+KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
+
+IUSE="nls"
+
+RDEPEND=">=sys-libs/ncurses-5.2-r2
+ =dev-db/sqlite-3*"
+DEPEND="${RDEPEND}
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/gdb-${APPLE_PV}/src
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-no-global-gdbinit.patch
+ epatch "${FILESDIR}"/${PN}-768-texinfo.patch
+ epatch "${FILESDIR}"/${P}-dyld-info.patch
+ [[ ${CHOST} == *-darwin8 ]] && epatch "${FILESDIR}"/${P}-darwin8.patch
+
+ # for FSF gcc / gcc-apple:42
+ sed -e 's/-Wno-long-double//' -i gdb/config/*/macosx.mh
+}
+
+src_configure() {
+ replace-flags -O? -O2
+ econf \
+ --disable-werror \
+ --disable-debug-symbols-framework \
+ $(use_enable nls) \
+ || die
+}
+
+src_install() {
+ emake DESTDIR="${D}" libdir=/nukeme includedir=/nukeme install || die
+ rm -R "${D}"/nukeme || die
+ rm -Rf "${ED}"/usr/${CHOST} || die
+ mv "${ED}"/usr/bin/gdb "${ED}"/
+ rm -f "${ED}"/usr/bin/*
+ mv "${ED}"/gdb "${ED}"/usr/bin/
+}
+
+pkg_postinst() {
+ if [[ ${CHOST} == *-darwin* && ${CHOST#*-darwin} -ge 9 ]] ; then
+ ewarn "Due to increased security measures in 10.5 and up, gdb is"
+ ewarn "not able to get a mach task port when installed by Prefix"
+ ewarn "Portage, unprivileged. To make gdb fully functional you'll"
+ ewarn "have to perform the following steps:"
+ ewarn " % sudo chgrp procmod ${EPREFIX}/usr/bin/gdb"
+ ewarn " % sudo chmod g+s ${EPREFIX}/usr/bin/gdb"
+ fi
+}
diff --git a/sys-devel/gdb-apple/gdb-apple-1518.ebuild b/sys-devel/gdb-apple/gdb-apple-1518.ebuild
new file mode 100644
index 000000000000..2359b2fed2c6
--- /dev/null
+++ b/sys-devel/gdb-apple/gdb-apple-1518.ebuild
@@ -0,0 +1,63 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils flag-o-matic
+
+APPLE_PV=${PV}
+DESCRIPTION="Apple branch of the GNU Debugger, Developer Tools 4.0"
+HOMEPAGE="http://sourceware.org/gdb/"
+SRC_URI="http://www.opensource.apple.com/darwinsource/tarballs/other/gdb-${APPLE_PV}.tar.gz"
+
+LICENSE="APSL-2 GPL-2"
+SLOT="0"
+
+KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
+
+IUSE="nls"
+
+RDEPEND=">=sys-libs/ncurses-5.2-r2
+ =dev-db/sqlite-3*"
+DEPEND="${RDEPEND}
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/gdb-${APPLE_PV}/src
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-no-global-gdbinit.patch
+ epatch "${FILESDIR}"/${PN}-768-texinfo.patch
+ epatch "${FILESDIR}"/${P}-task_dyld_info.patch
+ epatch "${FILESDIR}"/${P}-darwin8-9.patch
+ [[ ${CHOST} == *-darwin8 ]] && epatch "${FILESDIR}"/${P}-darwin8.patch
+}
+
+src_configure() {
+ replace-flags -O? -O2
+ econf \
+ --disable-werror \
+ --disable-debug-symbols-framework \
+ $(use_enable nls) \
+ || die
+}
+
+src_install() {
+ emake DESTDIR="${D}" libdir=/nukeme includedir=/nukeme install || die
+ rm -R "${D}"/nukeme || die
+ rm -Rf "${ED}"/usr/${CHOST} || die
+ mv "${ED}"/usr/bin/gdb "${ED}"/
+ rm -f "${ED}"/usr/bin/*
+ mv "${ED}"/gdb "${ED}"/usr/bin/
+}
+
+pkg_postinst() {
+ if [[ ${CHOST} == *-darwin* && ${CHOST#*-darwin} -ge 9 ]] ; then
+ ewarn "Due to increased security measures in 10.5 and up, gdb is"
+ ewarn "not able to get a mach task port when installed by Prefix"
+ ewarn "Portage, unprivileged. To make gdb fully functional you'll"
+ ewarn "have to perform the following steps:"
+ ewarn " % sudo chgrp procmod ${EPREFIX}/usr/bin/gdb"
+ ewarn " % sudo chmod g+s ${EPREFIX}/usr/bin/gdb"
+ fi
+}
diff --git a/sys-devel/gdb-apple/gdb-apple-1705.ebuild b/sys-devel/gdb-apple/gdb-apple-1705.ebuild
new file mode 100644
index 000000000000..bd5e1b6d0fbb
--- /dev/null
+++ b/sys-devel/gdb-apple/gdb-apple-1705.ebuild
@@ -0,0 +1,74 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils flag-o-matic
+
+APPLE_PV=${PV}
+DESCRIPTION="Apple branch of the GNU Debugger, Developer Tools 4.1"
+HOMEPAGE="http://sourceware.org/gdb/"
+SRC_URI="http://www.opensource.apple.com/darwinsource/tarballs/other/gdb-${APPLE_PV}.tar.gz"
+
+LICENSE="APSL-2 GPL-2"
+SLOT="0"
+
+KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
+
+IUSE="nls"
+
+RDEPEND=">=sys-libs/ncurses-5.2-r2
+ =dev-db/sqlite-3*"
+DEPEND="${RDEPEND}
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/gdb-${APPLE_PV}/src
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-no-global-gdbinit.patch
+ epatch "${FILESDIR}"/${PN}-768-texinfo.patch
+ epatch "${FILESDIR}"/${PN}-1518-darwin8-9.patch
+ epatch "${FILESDIR}"/${PN}-1705-darwin8-10.patch
+ [[ ${CHOST} == *-darwin8 ]] && epatch "${FILESDIR}"/${PN}-1518-darwin8.patch
+}
+
+src_configure() {
+ replace-flags -O? -O2
+ econf \
+ --disable-werror \
+ --disable-debug-symbols-framework \
+ $(use_enable nls) \
+ || die
+}
+
+src_compile() {
+ # unable to work around parallel make issue
+ emake -j2 || die
+}
+
+src_install() {
+ emake -j2 DESTDIR="${D}" libdir=/nukeme includedir=/nukeme install || die
+ rm -R "${D}"/nukeme || die
+ rm -Rf "${ED}"/usr/${CHOST} || die
+ mv "${ED}"/usr/bin/gdb "${ED}"/
+ rm -f "${ED}"/usr/bin/*
+ mv "${ED}"/gdb "${ED}"/usr/bin/
+}
+
+pkg_postinst() {
+ if [[ ${CHOST} == *-darwin* && ${CHOST#*-darwin} -ge 9 ]] ; then
+ ewarn "Due to increased security measures in 10.5 and up, gdb is"
+ ewarn "not able to get a mach task port when installed by Prefix"
+ ewarn "Portage, unprivileged. To make gdb fully functional you'll"
+ ewarn "have to perform the following steps:"
+ ewarn " % sudo chgrp procmod ${EPREFIX}/usr/bin/gdb"
+ ewarn " % sudo chmod g+s ${EPREFIX}/usr/bin/gdb"
+ fi
+ if use x86-macos || use x64-macos ; then
+ einfo "FSF gdb works on Intel-based OSX platforms, sometimes even"
+ einfo "better than gdb-apple. You can consider installing FSF gdb"
+ einfo "instead of gdb-apple, since the FSF version is surely more"
+ einfo "advanced than this old 6.8 version modified by Apple."
+ fi
+}
diff --git a/sys-devel/gdb-apple/gdb-apple-1708.ebuild b/sys-devel/gdb-apple/gdb-apple-1708.ebuild
new file mode 100644
index 000000000000..75c4feb094b8
--- /dev/null
+++ b/sys-devel/gdb-apple/gdb-apple-1708.ebuild
@@ -0,0 +1,74 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils flag-o-matic
+
+APPLE_PV=${PV}
+DESCRIPTION="Apple branch of the GNU Debugger, Developer Tools 4.2"
+HOMEPAGE="http://sourceware.org/gdb/"
+SRC_URI="http://www.opensource.apple.com/darwinsource/tarballs/other/gdb-${APPLE_PV}.tar.gz"
+
+LICENSE="APSL-2 GPL-2"
+SLOT="0"
+
+KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
+
+IUSE="nls"
+
+RDEPEND=">=sys-libs/ncurses-5.2-r2
+ =dev-db/sqlite-3*"
+DEPEND="${RDEPEND}
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/gdb-${APPLE_PV}/src
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-no-global-gdbinit.patch
+ epatch "${FILESDIR}"/${PN}-768-texinfo.patch
+ epatch "${FILESDIR}"/${PN}-1518-darwin8-9.patch
+ epatch "${FILESDIR}"/${PN}-1705-darwin8-10.patch
+ [[ ${CHOST} == *-darwin8 ]] && epatch "${FILESDIR}"/${PN}-1518-darwin8.patch
+}
+
+src_configure() {
+ replace-flags -O? -O2
+ econf \
+ --disable-werror \
+ --disable-debug-symbols-framework \
+ $(use_enable nls) \
+ || die
+}
+
+src_compile() {
+ # unable to work around parallel make issue
+ emake -j2 || die
+}
+
+src_install() {
+ emake -j2 DESTDIR="${D}" libdir=/nukeme includedir=/nukeme install || die
+ rm -R "${D}"/nukeme || die
+ rm -Rf "${ED}"/usr/${CHOST} || die
+ mv "${ED}"/usr/bin/gdb "${ED}"/
+ rm -f "${ED}"/usr/bin/*
+ mv "${ED}"/gdb "${ED}"/usr/bin/
+}
+
+pkg_postinst() {
+ if [[ ${CHOST} == *-darwin* && ${CHOST#*-darwin} -ge 9 ]] ; then
+ ewarn "Due to increased security measures in 10.5 and up, gdb is"
+ ewarn "not able to get a mach task port when installed by Prefix"
+ ewarn "Portage, unprivileged. To make gdb fully functional you'll"
+ ewarn "have to perform the following steps:"
+ ewarn " % sudo chgrp procmod ${EPREFIX}/usr/bin/gdb"
+ ewarn " % sudo chmod g+s ${EPREFIX}/usr/bin/gdb"
+ fi
+ if use x86-macos || use x64-macos ; then
+ einfo "FSF gdb works on Intel-based OSX platforms, sometimes even"
+ einfo "better than gdb-apple. You can consider installing FSF gdb"
+ einfo "instead of gdb-apple, since the FSF version is surely more"
+ einfo "advanced than this old 6.8 version modified by Apple."
+ fi
+}
diff --git a/sys-devel/gdb-apple/gdb-apple-1752.ebuild b/sys-devel/gdb-apple/gdb-apple-1752.ebuild
new file mode 100644
index 000000000000..b16018e62489
--- /dev/null
+++ b/sys-devel/gdb-apple/gdb-apple-1752.ebuild
@@ -0,0 +1,74 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils flag-o-matic
+
+APPLE_PV=${PV}
+DESCRIPTION="Apple branch of the GNU Debugger, Developer Tools 4.3"
+HOMEPAGE="http://sourceware.org/gdb/"
+SRC_URI="http://www.opensource.apple.com/darwinsource/tarballs/other/gdb-${APPLE_PV}.tar.gz"
+
+LICENSE="APSL-2 GPL-2"
+SLOT="0"
+
+KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
+
+IUSE="nls"
+
+RDEPEND=">=sys-libs/ncurses-5.2-r2
+ =dev-db/sqlite-3*"
+DEPEND="${RDEPEND}
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/gdb-${APPLE_PV}/src
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-no-global-gdbinit.patch
+ epatch "${FILESDIR}"/${PN}-768-texinfo.patch
+ epatch "${FILESDIR}"/${PN}-1518-darwin8-9.patch
+ epatch "${FILESDIR}"/${PN}-1705-darwin8-10.patch
+ [[ ${CHOST} == *-darwin8 ]] && epatch "${FILESDIR}"/${PN}-1518-darwin8.patch
+}
+
+src_configure() {
+ replace-flags -O? -O2
+ econf \
+ --disable-werror \
+ --disable-debug-symbols-framework \
+ $(use_enable nls) \
+ || die
+}
+
+src_compile() {
+ # unable to work around parallel make issue
+ emake -j2 || die
+}
+
+src_install() {
+ emake -j2 DESTDIR="${D}" libdir=/nukeme includedir=/nukeme install || die
+ rm -R "${D}"/nukeme || die
+ rm -Rf "${ED}"/usr/${CHOST} || die
+ mv "${ED}"/usr/bin/gdb "${ED}"/
+ rm -f "${ED}"/usr/bin/*
+ mv "${ED}"/gdb "${ED}"/usr/bin/
+}
+
+pkg_postinst() {
+ if [[ ${CHOST} == *-darwin* && ${CHOST#*-darwin} -ge 9 ]] ; then
+ ewarn "Due to increased security measures in 10.5 and up, gdb is"
+ ewarn "not able to get a mach task port when installed by Prefix"
+ ewarn "Portage, unprivileged. To make gdb fully functional you'll"
+ ewarn "have to perform the following steps:"
+ ewarn " % sudo chgrp procmod ${EPREFIX}/usr/bin/gdb"
+ ewarn " % sudo chmod g+s ${EPREFIX}/usr/bin/gdb"
+ fi
+ if use x86-macos || use x64-macos ; then
+ einfo "FSF gdb works on Intel-based OSX platforms, sometimes even"
+ einfo "better than gdb-apple. You can consider installing FSF gdb"
+ einfo "instead of gdb-apple, since the FSF version is surely more"
+ einfo "advanced than this old 6.8 version modified by Apple."
+ fi
+}
diff --git a/sys-devel/gdb-apple/gdb-apple-563.ebuild b/sys-devel/gdb-apple/gdb-apple-563.ebuild
new file mode 100644
index 000000000000..791c1779481c
--- /dev/null
+++ b/sys-devel/gdb-apple/gdb-apple-563.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils flag-o-matic
+
+DESCRIPTION="Apple branch of the GNU Debugger, Xcode 2.4"
+HOMEPAGE="http://sourceware.org/gdb/"
+SRC_URI="http://www.opensource.apple.com/darwinsource/tarballs/other/gdb-${PV}.tar.gz"
+
+LICENSE="APSL-2 GPL-2"
+SLOT="0"
+
+KEYWORDS="~ppc-macos ~x86-macos"
+
+IUSE="nls"
+
+RDEPEND=">=sys-libs/ncurses-5.2-r2
+ =dev-db/sqlite-3*"
+DEPEND="${RDEPEND}
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/gdb-${PV}/src
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-darwin7.patch
+ epatch "${FILESDIR}"/${P}-no-64bit.patch
+ epatch "${FILESDIR}"/${PN}-768-texinfo.patch
+
+ # for FSF gcc / gcc-apple:42
+ sed -e 's/-Wno-long-double//' -i gdb/config/*/macosx.mh
+}
+
+src_configure() {
+ replace-flags -O? -O2
+ econf \
+ --disable-werror \
+ $(use_enable nls) \
+ || die
+}
+
+src_install() {
+ emake DESTDIR="${D}" libdir=/nukeme includedir=/nukeme install || die
+ rm -r "${D}"/nukeme || die
+ rm -Rf "${ED}"/usr/${CHOST} || die
+ mv "${ED}"/usr/bin/gdb "${ED}"/
+ rm -f "${ED}"/usr/bin/*
+ mv "${ED}"/gdb "${ED}"/usr/bin/
+}
diff --git a/sys-devel/gdb-apple/gdb-apple-768-r1.ebuild b/sys-devel/gdb-apple/gdb-apple-768-r1.ebuild
new file mode 100644
index 000000000000..11205f7f1084
--- /dev/null
+++ b/sys-devel/gdb-apple/gdb-apple-768-r1.ebuild
@@ -0,0 +1,50 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils flag-o-matic
+
+DESCRIPTION="Apple branch of the GNU Debugger, 10.5"
+HOMEPAGE="http://sourceware.org/gdb/"
+SRC_URI="http://www.opensource.apple.com/darwinsource/tarballs/other/gdb-${PV}.tar.gz"
+
+LICENSE="APSL-2 GPL-2"
+SLOT="0"
+
+KEYWORDS="~ppc-macos ~x86-macos"
+
+IUSE="nls"
+
+RDEPEND=">=sys-libs/ncurses-5.2-r2
+ =dev-db/sqlite-3*"
+DEPEND="${RDEPEND}
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/gdb-${PV}/src
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-texinfo.patch
+ epatch "${FILESDIR}"/${P}-darwin-arch.patch
+
+ # for FSF gcc / gcc-apple:42
+ sed -e 's/-Wno-long-double//' -i gdb/config/*/macosx.mh
+}
+
+src_configure() {
+ replace-flags -O? -O2
+ econf \
+ --disable-werror \
+ $(use_enable nls) \
+ || die
+}
+
+src_install() {
+ emake DESTDIR="${D}" libdir=/nukeme includedir=/nukeme install || die
+ rm -r "${D}"/nukeme || die
+ rm -Rf "${ED}"/usr/${CHOST} || die
+ mv "${ED}"/usr/bin/gdb "${ED}"/
+ rm -f "${ED}"/usr/bin/*
+ mv "${ED}"/gdb "${ED}"/usr/bin/
+}
diff --git a/sys-devel/gdb-apple/gdb-apple-960.ebuild b/sys-devel/gdb-apple/gdb-apple-960.ebuild
new file mode 100644
index 000000000000..ba19a0d23763
--- /dev/null
+++ b/sys-devel/gdb-apple/gdb-apple-960.ebuild
@@ -0,0 +1,50 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils flag-o-matic
+
+DESCRIPTION="Apple branch of the GNU Debugger, Xcode Tools 3.1"
+HOMEPAGE="http://sourceware.org/gdb/"
+SRC_URI="http://www.opensource.apple.com/darwinsource/tarballs/other/gdb-${PV}.tar.gz"
+
+LICENSE="APSL-2 GPL-2"
+SLOT="0"
+
+KEYWORDS="~ppc-macos ~x86-macos"
+
+IUSE="nls"
+
+RDEPEND=">=sys-libs/ncurses-5.2-r2
+ =dev-db/sqlite-3*"
+DEPEND="${RDEPEND}
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/gdb-${PV}/src
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-768-texinfo.patch
+ epatch "${FILESDIR}"/${PN}-768-darwin-arch.patch
+
+ # for FSF gcc / gcc-apple:42
+ sed -e 's/-Wno-long-double//' -i gdb/config/*/macosx.mh
+}
+
+src_configure() {
+ replace-flags -O? -O2
+ econf \
+ --disable-werror \
+ $(use_enable nls) \
+ || die
+}
+
+src_install() {
+ emake DESTDIR="${D}" libdir=/nukeme includedir=/nukeme install || die
+ rm -r "$D"/nukeme || die
+ rm -Rf "${ED}"/usr/${CHOST} || die
+ mv "${ED}"/usr/bin/gdb "${ED}"/
+ rm -f "${ED}"/usr/bin/*
+ mv "${ED}"/gdb "${ED}"/usr/bin/
+}
diff --git a/sys-devel/gdb-apple/gdb-apple-962.ebuild b/sys-devel/gdb-apple/gdb-apple-962.ebuild
new file mode 100644
index 000000000000..87d30dd03219
--- /dev/null
+++ b/sys-devel/gdb-apple/gdb-apple-962.ebuild
@@ -0,0 +1,64 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils flag-o-matic
+
+DESCRIPTION="Apple branch of the GNU Debugger, Xcode Tools 3.1.2"
+HOMEPAGE="http://sourceware.org/gdb/"
+SRC_URI="http://www.opensource.apple.com/darwinsource/tarballs/other/gdb-${PV}.tar.gz"
+
+LICENSE="APSL-2 GPL-2"
+SLOT="0"
+
+KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
+
+IUSE="nls"
+
+RDEPEND=">=sys-libs/ncurses-5.2-r2
+ =dev-db/sqlite-3*"
+DEPEND="${RDEPEND}
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/gdb-${PV}/src
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-768-texinfo.patch
+ epatch "${FILESDIR}"/${PN}-768-darwin-arch.patch
+ epatch "${FILESDIR}"/${PN}-962-darwin8.patch
+ epatch "${FILESDIR}"/${PN}-962-darwin64.patch
+ epatch "${FILESDIR}"/${PN}-962-demangle.patch
+
+ # for FSF gcc / gcc-apple:42
+ sed -e 's/-Wno-long-double//' -i gdb/config/*/macosx.mh
+}
+
+src_configure() {
+ replace-flags -O? -O2
+ econf \
+ --disable-werror \
+ $(use_enable nls) \
+ || die
+}
+
+src_install() {
+ emake DESTDIR="${D}" libdir=/nukeme includedir=/nukeme install || die
+ rm -r "${D}"/nukeme || die
+ rm -Rf "${ED}"/usr/${CHOST} || die
+ mv "${ED}"/usr/bin/gdb "${ED}"/
+ rm -f "${ED}"/usr/bin/*
+ mv "${ED}"/gdb "${ED}"/usr/bin/
+}
+
+pkg_postinst() {
+ if [[ ${CHOST} == *-darwin* && ${CHOST#*-darwin} -ge 9 ]] ; then
+ elog "Due to increased security measures in 10.5 and up, gdb is"
+ elog "not able to get a mach task port when installed by Prefix"
+ elog "Portage, unprivileged. To make gdb fully functional you'll"
+ elog "have to perform the following steps:"
+ elog " % sudo chgrp procmod ${EPREFIX}/usr/bin/gdb"
+ elog " % sudo chmod g+s ${EPREFIX}/usr/bin/gdb"
+ fi
+}
diff --git a/sys-devel/gdb-apple/gdb-apple-966.ebuild b/sys-devel/gdb-apple/gdb-apple-966.ebuild
new file mode 100644
index 000000000000..b95b7348ce2d
--- /dev/null
+++ b/sys-devel/gdb-apple/gdb-apple-966.ebuild
@@ -0,0 +1,64 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils flag-o-matic
+
+DESCRIPTION="Apple branch of the GNU Debugger, Developer Tools 3.1.3"
+HOMEPAGE="http://sourceware.org/gdb/"
+SRC_URI="http://www.opensource.apple.com/darwinsource/tarballs/other/gdb-${PV}.tar.gz"
+
+LICENSE="APSL-2 GPL-2"
+SLOT="0"
+
+KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
+
+IUSE="nls"
+
+RDEPEND=">=sys-libs/ncurses-5.2-r2
+ =dev-db/sqlite-3*"
+DEPEND="${RDEPEND}
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/gdb-${PV}/src
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-768-texinfo.patch
+ epatch "${FILESDIR}"/${PN}-768-darwin-arch.patch
+ epatch "${FILESDIR}"/${PN}-962-darwin8.patch
+ epatch "${FILESDIR}"/${PN}-962-darwin64.patch
+ epatch "${FILESDIR}"/${PN}-962-demangle.patch
+
+ # for FSF gcc / gcc-apple:42
+ sed -e 's/-Wno-long-double//' -i gdb/config/*/macosx.mh
+}
+
+src_configure() {
+ replace-flags -O? -O2
+ econf \
+ --disable-werror \
+ $(use_enable nls) \
+ || die
+}
+
+src_install() {
+ emake DESTDIR="${D}" libdir=/nukeme includedir=/nukeme install || die
+ rm -R "${D}"/nukeme || die
+ rm -Rf "${ED}"/usr/${CHOST} || die
+ mv "${ED}"/usr/bin/gdb "${ED}"/
+ rm -f "${ED}"/usr/bin/*
+ mv "${ED}"/gdb "${ED}"/usr/bin/
+}
+
+pkg_postinst() {
+ if [[ ${CHOST} == *-darwin* && ${CHOST#*-darwin} -ge 9 ]] ; then
+ elog "Due to increased security measures in 10.5 and up, gdb is"
+ elog "not able to get a mach task port when installed by Prefix"
+ elog "Portage, unprivileged. To make gdb fully functional you'll"
+ elog "have to perform the following steps:"
+ elog " % sudo chgrp procmod ${EPREFIX}/usr/bin/gdb"
+ elog " % sudo chmod g+s ${EPREFIX}/usr/bin/gdb"
+ fi
+}
diff --git a/sys-devel/gdb-apple/metadata.xml b/sys-devel/gdb-apple/metadata.xml
new file mode 100644
index 000000000000..4561e552bd04
--- /dev/null
+++ b/sys-devel/gdb-apple/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-devel/gdb/Manifest b/sys-devel/gdb/Manifest
new file mode 100644
index 000000000000..511fe92cd6a9
--- /dev/null
+++ b/sys-devel/gdb/Manifest
@@ -0,0 +1,19 @@
+DIST gdb-7.5-patches-1.tar.xz 9208 SHA256 07d2e5cd96c3acf64710d3cd1098684aa7db7e9e448b5a49775650c2abcb9daf SHA512 775c4b5953e7f02a0bfdc1801fa220e3446bf5cc2153e49cbba7dc883740e64604fde1bd04b6916f47530c94ab6a5351e4d4151a5b1f6f3f3d15f42e9210c196 WHIRLPOOL 69d4079327dce6e8fa8522c155b1a55687a1e14949d6812700512efcc99b51bb1a2becb4c0562b0b5bbc2ee87718d89ea278fa7f7166fa8c88b346cd5968f636
+DIST gdb-7.5.1-patches-2.tar.xz 8720 SHA256 7b93f737eb90c981685b6eab8ab7cda7ee0a3637b0110450efa5900486cca9dc SHA512 ab04daff6c83738fb7dc96f3444d8b6ab0bc52dd380ee6079676ba9507201c4e19bf8a8dd092705c968e4109d0080216020ad4a03c963b15cd37c6da3e8804ac WHIRLPOOL 8c520dbfb3288ff19a8978f2c1e7687467e2362fa0385d1f62beb1b2081264b597b4ca45b16d0d658cfba7bd754e10f219d84bedcb8acd0c2be4d5c64b201aca
+DIST gdb-7.5.1.tar.bz2 21349391 SHA256 070b808d289fa8f0291738eeaccc0cd7700d476998781f572856155240d29d20 SHA512 23b240f0ca9376dfc2fdeb79e725a3784841d1f787db9f7ca62a5e2f824ddd8b2d5fb3450e19dd8fee79589e3b0a5fe638eaa35966363c78c82711731c26dc47 WHIRLPOOL b1bb3d5133efcdd3e842ba03bf2f8ebcd01f4cbda8333a6725cd4160604b592fb991c02c17b725ffbcea0b7e37de9ade380079d903541124b4b76fcbd5f9e754
+DIST gdb-7.5.tar.bz2 21327195 SHA256 d178c45c328369ae4f24f9a0ec53b7d009e2bfa1d41b7027280b24f58ae61932 SHA512 fcedba8a8ba50470e8c032801e99a43dae7fcaf7885b55beaf2d47bfb7b0b666cb5e3bb40d0b67e9a3ba50bd88faba0a255474ab38c2a0272e880d5c668e0506 WHIRLPOOL fa2d238380508cfe8c1ca9a0906e87d539b0470230da407c5c6a02cd9f2b63c727586a9651943ee9328bb44d782a66bb9fae7dd27e9bd31fd5cbd0161cc3514d
+DIST gdb-7.6-patches-3.tar.xz 13644 SHA256 5ec83531a6bab75d9e3a67431d724b936cadb06862810b3182ac13f8d9b0cd22 SHA512 23a6e597629ecc544f8646eda5a637752b04cb5ecb7797f88d342e0c38f0680419a3656d8718722e8eeb7165e9aa7696c2e5b889049e5b405415bb7c391fa350 WHIRLPOOL 5a9f5cc513768c3218353ee74605ae224d556a72b557763370cc059e75fc31d438b57521df2e9d8eb5d713bbfb8d308d6b2cdf7dbdb7838343b12afc9d81e619
+DIST gdb-7.6.1-patches-2.tar.xz 14136 SHA256 327948403616d1376cca2bfb0ff174b93bf0494390708864ef54bdd98bc4729f SHA512 f1364d5cc70ea3c131e48ec5cc7275bcf0f875b0dcbe663f507b0f5d082e7db38636fd9036db3da7b2e9794dbc7d42b24126d91fde9447f6f10fcc8b3aea7817 WHIRLPOOL aa738854e26da8469ae98fb681552a7f25777809027761bb788a42db73bfd7852a09e82a8bacb2870ffc52a5953bc398adc4e098c6d36f331cd23a9a9a75c6ed
+DIST gdb-7.6.1.tar.bz2 24338919 SHA256 e3dfa38a14a5457f9b8b26f7b5080ba5491bd10ae4d69bfe357cea87b7d162e4 SHA512 ca42f003073d35cde42b43efe12f42888b39f2fc4b55f7df9faca2c8381a9329f19bf9366fff0af3ae59711aafaf9b4a33a15cb73a531c0c046b8ada98ed774b WHIRLPOOL 0489854f52e5d3e8fa36f4deb629e9aa7e83fd0ce80fe9aef6a9284e348e52e5d71e655d403a856911b868891ee2ba07bacc707326ef68d68052b557d5aef963
+DIST gdb-7.6.2-patches-1.tar.xz 14136 SHA256 aeb45e64c4d1f70cf97cd89e66dfe72d219b140e583f602720f29b5fa6ea5145 SHA512 d56e8a613ca0f33ebe203aa85a39881b10a0a15c56ea51c7633b6f032628e207d31d1adfc8f0b7e83754da729baead0acbc83893f1d480c41ce02cad38b6b4ff WHIRLPOOL e9f5482619653c54ad95f4c9eb5310320345ef3b825e373b629b320b9d11f6acfe88e5d713faf98927da77f05d5a37edef61bfce09a4a3990c20135945930a2c
+DIST gdb-7.6.2.tar.bz2 24269334 SHA256 2f6a0e2ce1c66c9dedeb7f58a8d1298ad602ddcdaf15d23104e1f7832b96d0e8 SHA512 e72e9c2abb58cc08c38841380270fe783f26baf62798171d21cf0843e6c9a81d285f424dc6229ea7b1c6c957d999c8aa75c2bd15076817abb9caab28c4eb7666 WHIRLPOOL bff0c9b33401b5efdf9c87408b4e4ee635509b536f371b4104895844a86256451d684412d0fab6dfb8e5ea2108ac2e4e383a33f2966ed2a32c4dbbbf54a280f4
+DIST gdb-7.6.tar.bz2 24333590 SHA256 a410e8f35ee70cce83dbbf1da9e2a8373f271ac0e4b71db4336ae293fc7bdf1b SHA512 3b4f7f25ab8a8014a339966fd165dac6ac63df7d6403c338bbd38737bc0033d7e6461cdea2cd6dd095335a9d2a0ecd9d694e862b8d54d269dae577402e2b3ffe WHIRLPOOL c519955a9b6246e90b979783e5745e49de36b6fcd5b17360ae8db92283efb63117a592a03b92e173a11f986dfcc587e2d5c26f3aea49634f317f554ffe2f0e72
+DIST gdb-7.7-patches-1.tar.xz 9368 SHA256 89fd4da18dec37773121d8f0cb5403c7edb1b9ad81ccaa5bcf9cfc389e60ed83 SHA512 1afac04f426e8bda4def8694bf9aee7783a55681c06c823527ae6c2b9237fc9a20d4854a1fc2452b4c72bd8eb0e7b991d66167bbad76bb36334bda76d6d7d5d1 WHIRLPOOL 93766c32540223e81b54573aede9cd7995a28f80d2ded70fac519c310b3a9e7413028942d3a70bcd3ea831e4ee2c00da8547def64accf890b651d89c712068ce
+DIST gdb-7.7.1-patches-1.tar.xz 8600 SHA256 336cdcb2c90da0ca970dc21dc0285a8cb1fbcf81af63c49ee3f3d45c0aef7200 SHA512 427aba554e77ccfe9cdf5b0a833a1d64f1882e8f9e37d1288c5f2510cc63d154b4c22054a2a653d156e37044d7655937dee4a1a9cd0f9768abaafc8c34ae1cc0 WHIRLPOOL d5db4b874475724ac62bae9f1b33c566192570dd68195fe1c2065b7502a36b06f5a64079a88c63a965392d87e9b7a8eb0c709578297d6692fdce1ee933a867f4
+DIST gdb-7.7.1.tar.bz2 24849503 SHA256 0dbd5260406f1b0c70fcf027c6488527fadde0cd9bb574593491fe076eb03aa5 SHA512 887b9b726dae8f6e3e5e41574460a67e4f9002b0d47bc985dcf63bdf3518397a90b6a208cb5b19e5ed2341715ad75cfeed4df4fb423f39f74218e36bc87f1cab WHIRLPOOL 3b726d5f519167105248eb3a400be0d9bc70f72dbce9a04aa56a765b6c2ed9fc00a7c2e6ec72d0372f87bada1d74a40fc998c10a5322e2f3b5c8ea53c7ba6aa4
+DIST gdb-7.7.tar.bz2 24846320 SHA256 0404d1c6ee6b3ddd811722b5197944758d37b4591c216030effbac204f5a6c23 SHA512 42c8d312c0ca1042d1df7e115c541abc7453c20813b3f4f1fe52c62bc04b85d9116539d245e6404fa556260ba13f78f9a2ac35424eb7fd8ef9954cdbfc9581e0 WHIRLPOOL 8f1610e7f2023a5f273c15cdca6da40e22527d61f694e841c55c696d14e55d6abc3aa4144ffb995fe78448e69c50ea7ac9854aaab1ef2e2b8d551b975d35e8b7
+DIST gdb-7.8.1.tar.xz 17669136 SHA256 497722b58386f4428c3474281eb3ef1c872404998b6ace907edb3bba1fabdc35 SHA512 c40775e727a665300b45ec5d375424565671768cb73eee6793285a5b9a29db66072fc55d56bc1b4189cd38e0590573554e283661e4fbec23e4ad3d5b90542a87 WHIRLPOOL 845988be5a667eae2ca2f433399d51af3bf8219a692385477f6f7f37bae000a017f39db271f28cf101a0b92eb4b48fe79c7edd1da1b84a83f3a612e49b96e265
+DIST gdb-7.8.2.tar.xz 17678568 SHA256 605954d5747d5f08ea4b7f48e958d1ebbf39265e18f7f36738deeabb83744485 SHA512 face5bf1b4ce144fc8604fc84620beed956177a11fd632b4e41906fc7f632910b2b43a50e6cfdfd6cbd876ee527c813bddab8df29dc560a6c36694cdb8edc4e4 WHIRLPOOL b0e5adc8e98c8363c25b86a8f47d07863a97f215c74b4fe2fcce4e72ce82867bafea60cb51d26f3814e895a93e047ca962b19fb2557e9c74a0ab3d88b1e6ee1d
+DIST gdb-7.8.tar.xz 17664316 SHA256 49c4abe174f79f54e1f9e75210ffb590d9b497d5b5200b5398c0e073a4ecb875 SHA512 e3977393c3a9bc2860d845928f457f4696a87106ccf30569cb69a82893deeab9b05fd1cffa4316cc5cfdfd3ad11a2d5660ed07a9965fa3d696a0ec604702557f WHIRLPOOL fb97f1fbee170fccf462d25fd6b4a218a8126b75465b59e21322ff2cacf2707d6b037d593663a4f52ae293c72d012a69a65377ee6827de18da80159c829b672d
+DIST gdb-7.9.1.tar.xz 17867692 SHA256 cd9c543a411a05b2b647dd38936034b68c2b5d6f10e0d51dc168c166c973ba40 SHA512 eebdf88b24e52e792b8a4b89ea85790de72b462a7810b44975fdf4232c068f353b15506071f450102a9d4bcecdde8e93dc3748a10699b7f73f3e04fb2d9d8414 WHIRLPOOL fe7afb392f453fa5aab290da3b74118c4e3bbae6f4e276f2efd7f978e3987e031d92ecd90d35e0531901f1cf68b04a313df050b25bb3b632d1b6e62360acd591
+DIST gdb-7.9.tar.xz 17859428 SHA256 9b315651a16528f7af8c7d8284699fb0c965df316cc7339bb0b7bae335848392 SHA512 850202a477b486a75dc8196efead79c95bc675e348064a5eefee2a50215d40f62e9e052e9b8df29f997f91430f6e7454883652c701f5b1e688d9e2c575876c83 WHIRLPOOL 597cbe8b8c9da7e2188f6d207738fd9679c3a841fec9483f67ff91156d7886636b1da61bf1255155115655d87648278a0670ad381afde931c7c6ab6e762a9ecd
diff --git a/sys-devel/gdb/gdb-7.5.1.ebuild b/sys-devel/gdb/gdb-7.5.1.ebuild
new file mode 100644
index 000000000000..71a3cdb2e894
--- /dev/null
+++ b/sys-devel/gdb/gdb-7.5.1.ebuild
@@ -0,0 +1,178 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit flag-o-matic eutils
+
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
+
+RPM=
+MY_PV=${PV}
+case ${PV} in
+*.*.50.*)
+ # weekly snapshots
+ SRC_URI="ftp://sourceware.org/pub/gdb/snapshots/current/gdb-weekly-${PV}.tar.bz2"
+ ;;
+9999*)
+ # live git tree
+ EGIT_REPO_URI="git://sourceware.org/git/binutils-gdb.git"
+ inherit git-2
+ SRC_URI=""
+ ;;
+*)
+ # Normal upstream release
+ SRC_URI="mirror://gnu/gdb/${P}.tar.bz2
+ ftp://sourceware.org/pub/gdb/releases/${P}.tar.bz2"
+ ;;
+esac
+
+PATCH_VER="2"
+DESCRIPTION="GNU debugger"
+HOMEPAGE="http://sourceware.org/gdb/"
+SRC_URI="${SRC_URI} ${PATCH_VER:+mirror://gentoo/${P}-patches-${PATCH_VER}.tar.xz}"
+
+LICENSE="GPL-2 LGPL-2"
+SLOT="0"
+if [[ ${PV} != 9999* ]] ; then
+ KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sparc x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+fi
+IUSE="+client expat multitarget nls +python +server test vanilla zlib"
+
+RDEPEND="!dev-util/gdbserver
+ >=sys-libs/ncurses-5.2-r2
+ sys-libs/readline
+ expat? ( dev-libs/expat )
+ python? ( =dev-lang/python-2* )
+ zlib? ( sys-libs/zlib )"
+DEPEND="${RDEPEND}
+ app-arch/xz-utils
+ virtual/yacc
+ test? ( dev-util/dejagnu )
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/${PN}-${MY_PV}
+
+src_prepare() {
+ [[ -n ${RPM} ]] && rpm_spec_epatch "${WORKDIR}"/gdb.spec
+ ! use vanilla && [[ -n ${PATCH_VER} ]] && EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/patch
+ strip-linguas -u bfd/po opcodes/po
+}
+
+gdb_branding() {
+ printf "Gentoo ${PV} "
+ if ! use vanilla && [[ -n ${PATCH_VER} ]] ; then
+ printf "p${PATCH_VER}"
+ else
+ printf "vanilla"
+ fi
+}
+
+src_configure() {
+ strip-unsupported-flags
+
+ local sysroot="${EPREFIX}"/usr/${CTARGET}
+ local myconf=(
+ --with-pkgversion="$(gdb_branding)"
+ --with-bugurl='http://bugs.gentoo.org/'
+ --disable-werror
+ $(is_cross && echo \
+ --with-sysroot="${sysroot}" \
+ --includedir="${sysroot}/usr/include")
+ )
+
+ if use server && ! use client ; then
+ # just configure+build in the gdbserver subdir to speed things up
+ cd gdb/gdbserver
+ myconf+=( --program-transform-name='' )
+ else
+ # gdbserver only works for native targets (CHOST==CTARGET).
+ # it also doesn't support all targets, so rather than duplicate
+ # the target list (which changes between versions), use the
+ # "auto" value when things are turned on.
+ is_cross \
+ && myconf+=( --disable-gdbserver ) \
+ || myconf+=( $(use_enable server gdbserver auto) )
+ fi
+
+ if ! ( use server && ! use client ) ; then
+ # if we are configuring in the top level, then use all
+ # the additional global options
+ myconf+=(
+ --enable-64-bit-bfd
+ --disable-install-libbfd
+ --disable-install-libiberty
+ --with-system-readline
+ --with-separate-debug-dir="${EPREFIX}"/usr/lib/debug
+ $(use_with expat)
+ $(use_enable nls)
+ $(use multitarget && echo --enable-targets=all)
+ $(use_with python python "${EPREFIX}/usr/bin/python2")
+ $(use_with zlib)
+ )
+ fi
+
+ econf "${myconf[@]}"
+}
+
+src_test() {
+ emake check || ewarn "tests failed"
+}
+
+src_install() {
+ use server && ! use client && cd gdb/gdbserver
+ emake DESTDIR="${D}" install || die
+ use client && { find "${ED}"/usr -name libiberty.a -delete || die ; }
+ cd "${S}"
+
+ # Don't install docs when building a cross-gdb
+ if [[ ${CTARGET} != ${CHOST} ]] ; then
+ rm -r "${ED}"/usr/share
+ return 0
+ fi
+ # Install it by hand for now:
+ # http://sourceware.org/ml/gdb-patches/2011-12/msg00915.html
+ # Only install if it exists due to the twisted behavior (see
+ # notes in src_configure above).
+ [[ -e gdb/gdbserver/gdbreplay ]] && { dobin gdb/gdbserver/gdbreplay || die ; }
+
+ dodoc README
+ if use client ; then
+ docinto gdb
+ dodoc gdb/CONTRIBUTE gdb/README gdb/MAINTAINERS \
+ gdb/NEWS gdb/ChangeLog gdb/PROBLEMS
+ fi
+ docinto sim
+ dodoc sim/{ChangeLog,MAINTAINERS,README-HACKING}
+ if use server ; then
+ docinto gdbserver
+ dodoc gdb/gdbserver/{ChangeLog,README}
+ fi
+
+ if [[ -n ${PATCH_VER} ]] ; then
+ dodoc "${WORKDIR}"/extra/gdbinit.sample
+ fi
+
+ # Remove shared info pages
+ rm -f "${ED}"/usr/share/info/{annotate,bfd,configure,standards}.info*
+}
+
+pkg_postinst() {
+ # portage sucks and doesnt unmerge files in /etc
+ rm -vf "${EROOT}"/etc/skel/.gdbinit
+
+ if use prefix && [[ ${CHOST} == *-darwin* ]] ; then
+ ewarn "gdb is unable to get a mach task port when installed by Prefix"
+ ewarn "Portage, unprivileged. To make gdb fully functional you'll"
+ ewarn "have to perform the following steps:"
+ ewarn " % sudo chgrp procmod ${EPREFIX}/usr/bin/gdb"
+ ewarn " % sudo chmod g+s ${EPREFIX}/usr/bin/gdb"
+ fi
+}
diff --git a/sys-devel/gdb/gdb-7.5.ebuild b/sys-devel/gdb/gdb-7.5.ebuild
new file mode 100644
index 000000000000..99829db93390
--- /dev/null
+++ b/sys-devel/gdb/gdb-7.5.ebuild
@@ -0,0 +1,178 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit flag-o-matic eutils
+
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
+
+RPM=
+MY_PV=${PV}
+case ${PV} in
+*.*.50.*)
+ # weekly snapshots
+ SRC_URI="ftp://sourceware.org/pub/gdb/snapshots/current/gdb-weekly-${PV}.tar.bz2"
+ ;;
+9999*)
+ # live git tree
+ EGIT_REPO_URI="git://sourceware.org/git/binutils-gdb.git"
+ inherit git-2
+ SRC_URI=""
+ ;;
+*)
+ # Normal upstream release
+ SRC_URI="mirror://gnu/gdb/${P}.tar.bz2
+ ftp://sourceware.org/pub/gdb/releases/${P}.tar.bz2"
+ ;;
+esac
+
+PATCH_VER="1"
+DESCRIPTION="GNU debugger"
+HOMEPAGE="http://sourceware.org/gdb/"
+SRC_URI="${SRC_URI} ${PATCH_VER:+mirror://gentoo/${P}-patches-${PATCH_VER}.tar.xz}"
+
+LICENSE="GPL-2 LGPL-2"
+SLOT="0"
+if [[ ${PV} != 9999* ]] ; then
+ KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 s390 sparc x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~x86-linux ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+fi
+IUSE="+client expat multitarget nls +python +server test vanilla zlib"
+
+RDEPEND="!dev-util/gdbserver
+ >=sys-libs/ncurses-5.2-r2
+ sys-libs/readline
+ expat? ( dev-libs/expat )
+ python? ( =dev-lang/python-2* )
+ zlib? ( sys-libs/zlib )"
+DEPEND="${RDEPEND}
+ app-arch/xz-utils
+ virtual/yacc
+ test? ( dev-util/dejagnu )
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/${PN}-${MY_PV}
+
+src_prepare() {
+ [[ -n ${RPM} ]] && rpm_spec_epatch "${WORKDIR}"/gdb.spec
+ ! use vanilla && [[ -n ${PATCH_VER} ]] && EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/patch
+ strip-linguas -u bfd/po opcodes/po
+}
+
+gdb_branding() {
+ printf "Gentoo ${PV} "
+ if ! use vanilla && [[ -n ${PATCH_VER} ]] ; then
+ printf "p${PATCH_VER}"
+ else
+ printf "vanilla"
+ fi
+}
+
+src_configure() {
+ strip-unsupported-flags
+
+ local sysroot="${EPREFIX}"/usr/${CTARGET}
+ local myconf=(
+ --with-pkgversion="$(gdb_branding)"
+ --with-bugurl='http://bugs.gentoo.org/'
+ --disable-werror
+ $(is_cross && echo \
+ --with-sysroot="${sysroot}" \
+ --includedir="${sysroot}/usr/include")
+ )
+
+ if use server && ! use client ; then
+ # just configure+build in the gdbserver subdir to speed things up
+ cd gdb/gdbserver
+ myconf+=( --program-transform-name='' )
+ else
+ # gdbserver only works for native targets (CHOST==CTARGET).
+ # it also doesn't support all targets, so rather than duplicate
+ # the target list (which changes between versions), use the
+ # "auto" value when things are turned on.
+ is_cross \
+ && myconf+=( --disable-gdbserver ) \
+ || myconf+=( $(use_enable server gdbserver auto) )
+ fi
+
+ if ! ( use server && ! use client ) ; then
+ # if we are configuring in the top level, then use all
+ # the additional global options
+ myconf+=(
+ --enable-64-bit-bfd
+ --disable-install-libbfd
+ --disable-install-libiberty
+ --with-system-readline
+ --with-separate-debug-dir="${EPREFIX}"/usr/lib/debug
+ $(use_with expat)
+ $(use_enable nls)
+ $(use multitarget && echo --enable-targets=all)
+ $(use_with python python "${EPREFIX}/usr/bin/python2")
+ $(use_with zlib)
+ )
+ fi
+
+ econf "${myconf[@]}"
+}
+
+src_test() {
+ emake check || ewarn "tests failed"
+}
+
+src_install() {
+ use server && ! use client && cd gdb/gdbserver
+ emake DESTDIR="${D}" install || die
+ use client && { find "${ED}"/usr -name libiberty.a -delete || die ; }
+ cd "${S}"
+
+ # Don't install docs when building a cross-gdb
+ if [[ ${CTARGET} != ${CHOST} ]] ; then
+ rm -r "${ED}"/usr/share
+ return 0
+ fi
+ # Install it by hand for now:
+ # http://sourceware.org/ml/gdb-patches/2011-12/msg00915.html
+ # Only install if it exists due to the twisted behavior (see
+ # notes in src_configure above).
+ [[ -e gdb/gdbserver/gdbreplay ]] && { dobin gdb/gdbserver/gdbreplay || die ; }
+
+ dodoc README
+ if use client ; then
+ docinto gdb
+ dodoc gdb/CONTRIBUTE gdb/README gdb/MAINTAINERS \
+ gdb/NEWS gdb/ChangeLog gdb/PROBLEMS
+ fi
+ docinto sim
+ dodoc sim/{ChangeLog,MAINTAINERS,README-HACKING}
+ if use server ; then
+ docinto gdbserver
+ dodoc gdb/gdbserver/{ChangeLog,README}
+ fi
+
+ if [[ -n ${PATCH_VER} ]] ; then
+ dodoc "${WORKDIR}"/extra/gdbinit.sample
+ fi
+
+ # Remove shared info pages
+ rm -f "${ED}"/usr/share/info/{annotate,bfd,configure,standards}.info*
+}
+
+pkg_postinst() {
+ # portage sucks and doesnt unmerge files in /etc
+ rm -vf "${EROOT}"/etc/skel/.gdbinit
+
+ if use prefix && [[ ${CHOST} == *-darwin* ]] ; then
+ ewarn "gdb is unable to get a mach task port when installed by Prefix"
+ ewarn "Portage, unprivileged. To make gdb fully functional you'll"
+ ewarn "have to perform the following steps:"
+ ewarn " % sudo chgrp procmod ${EPREFIX}/usr/bin/gdb"
+ ewarn " % sudo chmod g+s ${EPREFIX}/usr/bin/gdb"
+ fi
+}
diff --git a/sys-devel/gdb/gdb-7.6.1.ebuild b/sys-devel/gdb/gdb-7.6.1.ebuild
new file mode 100644
index 000000000000..2b0d775da57a
--- /dev/null
+++ b/sys-devel/gdb/gdb-7.6.1.ebuild
@@ -0,0 +1,192 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit flag-o-matic eutils
+
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
+
+RPM=
+MY_PV=${PV}
+case ${PV} in
+*.*.50.*)
+ # weekly snapshots
+ SRC_URI="ftp://sourceware.org/pub/gdb/snapshots/current/gdb-weekly-${PV}.tar.bz2"
+ ;;
+9999*)
+ # live git tree
+ EGIT_REPO_URI="git://sourceware.org/git/binutils-gdb.git"
+ inherit git-2
+ SRC_URI=""
+ ;;
+*)
+ # Normal upstream release
+ SRC_URI="mirror://gnu/gdb/${P}.tar.bz2
+ ftp://sourceware.org/pub/gdb/releases/${P}.tar.bz2"
+ ;;
+esac
+
+PATCH_VER="2"
+DESCRIPTION="GNU debugger"
+HOMEPAGE="http://sourceware.org/gdb/"
+SRC_URI="${SRC_URI} ${PATCH_VER:+mirror://gentoo/${P}-patches-${PATCH_VER}.tar.xz}"
+
+LICENSE="GPL-2 LGPL-2"
+SLOT="0"
+if [[ ${PV} != 9999* ]] ; then
+ KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+fi
+IUSE="+client expat lzma multitarget nls +python +server test vanilla zlib"
+
+RDEPEND="!dev-util/gdbserver
+ >=sys-libs/ncurses-5.2-r2
+ sys-libs/readline
+ expat? ( dev-libs/expat )
+ lzma? ( app-arch/xz-utils )
+ python? ( =dev-lang/python-2* )
+ zlib? ( sys-libs/zlib )"
+DEPEND="${RDEPEND}
+ app-arch/xz-utils
+ virtual/yacc
+ test? ( dev-util/dejagnu )
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/${PN}-${MY_PV}
+
+src_prepare() {
+ [[ -n ${RPM} ]] && rpm_spec_epatch "${WORKDIR}"/gdb.spec
+ ! use vanilla && [[ -n ${PATCH_VER} ]] && EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/patch
+ strip-linguas -u bfd/po opcodes/po
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ # make sure we have a python-config that matches our install,
+ # such that the python check doesn't fail just because the
+ # gdb-provided copy isn't quite what our python installed
+ # version is
+ rm -f "${S}"/gdb/python/python-config.py || die
+ pushd "${S}"/gdb/python > /dev/null || die
+ ln -s "${EROOT}"/usr/bin/$(eselect python show --python2)-config \
+ python-config.py || die
+ popd > /dev/null || die
+ fi
+}
+
+gdb_branding() {
+ printf "Gentoo ${PV} "
+ if ! use vanilla && [[ -n ${PATCH_VER} ]] ; then
+ printf "p${PATCH_VER}"
+ else
+ printf "vanilla"
+ fi
+}
+
+src_configure() {
+ strip-unsupported-flags
+
+ local myconf=(
+ --with-pkgversion="$(gdb_branding)"
+ --with-bugurl='http://bugs.gentoo.org/'
+ --disable-werror
+ )
+ local sysroot="${EPREFIX}/usr/${CTARGET}"
+ is_cross && myconf+=(
+ --with-sysroot="${sysroot}"
+ --includedir="${sysroot}/usr/include"
+ )
+
+ if use server && ! use client ; then
+ # just configure+build in the gdbserver subdir to speed things up
+ cd gdb/gdbserver
+ myconf+=( --program-transform-name='' )
+ else
+ # gdbserver only works for native targets (CHOST==CTARGET).
+ # it also doesn't support all targets, so rather than duplicate
+ # the target list (which changes between versions), use the
+ # "auto" value when things are turned on.
+ is_cross \
+ && myconf+=( --disable-gdbserver ) \
+ || myconf+=( $(use_enable server gdbserver auto) )
+ fi
+
+ if ! ( use server && ! use client ) ; then
+ # if we are configuring in the top level, then use all
+ # the additional global options
+ myconf+=(
+ --enable-64-bit-bfd
+ --disable-install-libbfd
+ --disable-install-libiberty
+ --with-system-readline
+ --with-separate-debug-dir="${EPREFIX}"/usr/lib/debug
+ $(use_with expat)
+ $(use_with lzma)
+ $(use_enable nls)
+ $(use multitarget && echo --enable-targets=all)
+ $(use_with python python "${EPREFIX}/usr/bin/python2")
+ $(use_with zlib)
+ )
+ fi
+
+ econf "${myconf[@]}"
+}
+
+src_test() {
+ emake check || ewarn "tests failed"
+}
+
+src_install() {
+ use server && ! use client && cd gdb/gdbserver
+ emake DESTDIR="${D}" install || die
+ use client && { find "${ED}"/usr -name libiberty.a -delete || die ; }
+ cd "${S}"
+
+ # Don't install docs when building a cross-gdb
+ if [[ ${CTARGET} != ${CHOST} ]] ; then
+ rm -r "${ED}"/usr/share
+ return 0
+ fi
+ # Install it by hand for now:
+ # http://sourceware.org/ml/gdb-patches/2011-12/msg00915.html
+ # Only install if it exists due to the twisted behavior (see
+ # notes in src_configure above).
+ [[ -e gdb/gdbserver/gdbreplay ]] && { dobin gdb/gdbserver/gdbreplay || die ; }
+
+ dodoc README
+ if use client ; then
+ docinto gdb
+ dodoc gdb/CONTRIBUTE gdb/README gdb/MAINTAINERS \
+ gdb/NEWS gdb/ChangeLog gdb/PROBLEMS
+ fi
+ docinto sim
+ dodoc sim/{ChangeLog,MAINTAINERS,README-HACKING}
+ if use server ; then
+ docinto gdbserver
+ dodoc gdb/gdbserver/{ChangeLog,README}
+ fi
+
+ if [[ -n ${PATCH_VER} ]] ; then
+ dodoc "${WORKDIR}"/extra/gdbinit.sample
+ fi
+
+ # Remove shared info pages
+ rm -f "${ED}"/usr/share/info/{annotate,bfd,configure,standards}.info*
+}
+
+pkg_postinst() {
+ # portage sucks and doesnt unmerge files in /etc
+ rm -vf "${EROOT}"/etc/skel/.gdbinit
+
+ if use prefix && [[ ${CHOST} == *-darwin* ]] ; then
+ ewarn "gdb is unable to get a mach task port when installed by Prefix"
+ ewarn "Portage, unprivileged. To make gdb fully functional you'll"
+ ewarn "have to perform the following steps:"
+ ewarn " % sudo chgrp procmod ${EPREFIX}/usr/bin/gdb"
+ ewarn " % sudo chmod g+s ${EPREFIX}/usr/bin/gdb"
+ fi
+}
diff --git a/sys-devel/gdb/gdb-7.6.2.ebuild b/sys-devel/gdb/gdb-7.6.2.ebuild
new file mode 100644
index 000000000000..64c040c064b2
--- /dev/null
+++ b/sys-devel/gdb/gdb-7.6.2.ebuild
@@ -0,0 +1,192 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit flag-o-matic eutils
+
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
+
+RPM=
+MY_PV=${PV}
+case ${PV} in
+*.*.50.*)
+ # weekly snapshots
+ SRC_URI="ftp://sourceware.org/pub/gdb/snapshots/current/gdb-weekly-${PV}.tar.bz2"
+ ;;
+9999*)
+ # live git tree
+ EGIT_REPO_URI="git://sourceware.org/git/binutils-gdb.git"
+ inherit git-2
+ SRC_URI=""
+ ;;
+*)
+ # Normal upstream release
+ SRC_URI="mirror://gnu/gdb/${P}.tar.bz2
+ ftp://sourceware.org/pub/gdb/releases/${P}.tar.bz2"
+ ;;
+esac
+
+PATCH_VER="1"
+DESCRIPTION="GNU debugger"
+HOMEPAGE="http://sourceware.org/gdb/"
+SRC_URI="${SRC_URI} ${PATCH_VER:+mirror://gentoo/${P}-patches-${PATCH_VER}.tar.xz}"
+
+LICENSE="GPL-2 LGPL-2"
+SLOT="0"
+if [[ ${PV} != 9999* ]] ; then
+ KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sparc x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+fi
+IUSE="+client expat lzma multitarget nls +python +server test vanilla zlib"
+
+RDEPEND="!dev-util/gdbserver
+ >=sys-libs/ncurses-5.2-r2
+ sys-libs/readline
+ expat? ( dev-libs/expat )
+ lzma? ( app-arch/xz-utils )
+ python? ( =dev-lang/python-2* )
+ zlib? ( sys-libs/zlib )"
+DEPEND="${RDEPEND}
+ app-arch/xz-utils
+ virtual/yacc
+ test? ( dev-util/dejagnu )
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/${PN}-${MY_PV}
+
+src_prepare() {
+ [[ -n ${RPM} ]] && rpm_spec_epatch "${WORKDIR}"/gdb.spec
+ ! use vanilla && [[ -n ${PATCH_VER} ]] && EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/patch
+ strip-linguas -u bfd/po opcodes/po
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ # make sure we have a python-config that matches our install,
+ # such that the python check doesn't fail just because the
+ # gdb-provided copy isn't quite what our python installed
+ # version is
+ rm -f "${S}"/gdb/python/python-config.py || die
+ pushd "${S}"/gdb/python > /dev/null || die
+ ln -s "${EROOT}"/usr/bin/$(eselect python show --python2)-config \
+ python-config.py || die
+ popd > /dev/null || die
+ fi
+}
+
+gdb_branding() {
+ printf "Gentoo ${PV} "
+ if ! use vanilla && [[ -n ${PATCH_VER} ]] ; then
+ printf "p${PATCH_VER}"
+ else
+ printf "vanilla"
+ fi
+}
+
+src_configure() {
+ strip-unsupported-flags
+
+ local myconf=(
+ --with-pkgversion="$(gdb_branding)"
+ --with-bugurl='http://bugs.gentoo.org/'
+ --disable-werror
+ )
+ local sysroot="${EPREFIX}/usr/${CTARGET}"
+ is_cross && myconf+=(
+ --with-sysroot="${sysroot}"
+ --includedir="${sysroot}/usr/include"
+ )
+
+ if use server && ! use client ; then
+ # just configure+build in the gdbserver subdir to speed things up
+ cd gdb/gdbserver
+ myconf+=( --program-transform-name='' )
+ else
+ # gdbserver only works for native targets (CHOST==CTARGET).
+ # it also doesn't support all targets, so rather than duplicate
+ # the target list (which changes between versions), use the
+ # "auto" value when things are turned on.
+ is_cross \
+ && myconf+=( --disable-gdbserver ) \
+ || myconf+=( $(use_enable server gdbserver auto) )
+ fi
+
+ if ! ( use server && ! use client ) ; then
+ # if we are configuring in the top level, then use all
+ # the additional global options
+ myconf+=(
+ --enable-64-bit-bfd
+ --disable-install-libbfd
+ --disable-install-libiberty
+ --with-system-readline
+ --with-separate-debug-dir="${EPREFIX}"/usr/lib/debug
+ $(use_with expat)
+ $(use_with lzma)
+ $(use_enable nls)
+ $(use multitarget && echo --enable-targets=all)
+ $(use_with python python "${EPREFIX}/usr/bin/python2")
+ $(use_with zlib)
+ )
+ fi
+
+ econf "${myconf[@]}"
+}
+
+src_test() {
+ emake check || ewarn "tests failed"
+}
+
+src_install() {
+ use server && ! use client && cd gdb/gdbserver
+ emake DESTDIR="${D}" install || die
+ use client && { find "${ED}"/usr -name libiberty.a -delete || die ; }
+ cd "${S}"
+
+ # Don't install docs when building a cross-gdb
+ if [[ ${CTARGET} != ${CHOST} ]] ; then
+ rm -r "${ED}"/usr/share
+ return 0
+ fi
+ # Install it by hand for now:
+ # http://sourceware.org/ml/gdb-patches/2011-12/msg00915.html
+ # Only install if it exists due to the twisted behavior (see
+ # notes in src_configure above).
+ [[ -e gdb/gdbserver/gdbreplay ]] && { dobin gdb/gdbserver/gdbreplay || die ; }
+
+ dodoc README
+ if use client ; then
+ docinto gdb
+ dodoc gdb/CONTRIBUTE gdb/README gdb/MAINTAINERS \
+ gdb/NEWS gdb/ChangeLog gdb/PROBLEMS
+ fi
+ docinto sim
+ dodoc sim/{ChangeLog,MAINTAINERS,README-HACKING}
+ if use server ; then
+ docinto gdbserver
+ dodoc gdb/gdbserver/{ChangeLog,README}
+ fi
+
+ if [[ -n ${PATCH_VER} ]] ; then
+ dodoc "${WORKDIR}"/extra/gdbinit.sample
+ fi
+
+ # Remove shared info pages
+ rm -f "${ED}"/usr/share/info/{annotate,bfd,configure,standards}.info*
+}
+
+pkg_postinst() {
+ # portage sucks and doesnt unmerge files in /etc
+ rm -vf "${EROOT}"/etc/skel/.gdbinit
+
+ if use prefix && [[ ${CHOST} == *-darwin* ]] ; then
+ ewarn "gdb is unable to get a mach task port when installed by Prefix"
+ ewarn "Portage, unprivileged. To make gdb fully functional you'll"
+ ewarn "have to perform the following steps:"
+ ewarn " % sudo chgrp procmod ${EPREFIX}/usr/bin/gdb"
+ ewarn " % sudo chmod g+s ${EPREFIX}/usr/bin/gdb"
+ fi
+}
diff --git a/sys-devel/gdb/gdb-7.6.ebuild b/sys-devel/gdb/gdb-7.6.ebuild
new file mode 100644
index 000000000000..b589cf8d99c5
--- /dev/null
+++ b/sys-devel/gdb/gdb-7.6.ebuild
@@ -0,0 +1,181 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit flag-o-matic eutils
+
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
+
+RPM=
+MY_PV=${PV}
+case ${PV} in
+*.*.50.*)
+ # weekly snapshots
+ SRC_URI="ftp://sourceware.org/pub/gdb/snapshots/current/gdb-weekly-${PV}.tar.bz2"
+ ;;
+9999*)
+ # live git tree
+ EGIT_REPO_URI="git://sourceware.org/git/binutils-gdb.git"
+ inherit git-2
+ SRC_URI=""
+ ;;
+*)
+ # Normal upstream release
+ SRC_URI="mirror://gnu/gdb/${P}.tar.bz2
+ ftp://sourceware.org/pub/gdb/releases/${P}.tar.bz2"
+ ;;
+esac
+
+PATCH_VER="3"
+DESCRIPTION="GNU debugger"
+HOMEPAGE="http://sourceware.org/gdb/"
+SRC_URI="${SRC_URI} ${PATCH_VER:+mirror://gentoo/${P}-patches-${PATCH_VER}.tar.xz}"
+
+LICENSE="GPL-2 LGPL-2"
+SLOT="0"
+if [[ ${PV} != 9999* ]] ; then
+ KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+fi
+IUSE="+client expat lzma multitarget nls +python +server test vanilla zlib"
+
+RDEPEND="!dev-util/gdbserver
+ >=sys-libs/ncurses-5.2-r2
+ sys-libs/readline
+ expat? ( dev-libs/expat )
+ lzma? ( app-arch/xz-utils )
+ python? ( =dev-lang/python-2* )
+ zlib? ( sys-libs/zlib )"
+DEPEND="${RDEPEND}
+ app-arch/xz-utils
+ virtual/yacc
+ test? ( dev-util/dejagnu )
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/${PN}-${MY_PV}
+
+src_prepare() {
+ [[ -n ${RPM} ]] && rpm_spec_epatch "${WORKDIR}"/gdb.spec
+ ! use vanilla && [[ -n ${PATCH_VER} ]] && EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/patch
+ strip-linguas -u bfd/po opcodes/po
+}
+
+gdb_branding() {
+ printf "Gentoo ${PV} "
+ if ! use vanilla && [[ -n ${PATCH_VER} ]] ; then
+ printf "p${PATCH_VER}"
+ else
+ printf "vanilla"
+ fi
+}
+
+src_configure() {
+ strip-unsupported-flags
+
+ local myconf=(
+ --with-pkgversion="$(gdb_branding)"
+ --with-bugurl='http://bugs.gentoo.org/'
+ --disable-werror
+ )
+ local sysroot="${EPREFIX}/usr/${CTARGET}"
+ is_cross && myconf+=(
+ --with-sysroot="${sysroot}"
+ --includedir="${sysroot}/usr/include"
+ )
+
+ if use server && ! use client ; then
+ # just configure+build in the gdbserver subdir to speed things up
+ cd gdb/gdbserver
+ myconf+=( --program-transform-name='' )
+ else
+ # gdbserver only works for native targets (CHOST==CTARGET).
+ # it also doesn't support all targets, so rather than duplicate
+ # the target list (which changes between versions), use the
+ # "auto" value when things are turned on.
+ is_cross \
+ && myconf+=( --disable-gdbserver ) \
+ || myconf+=( $(use_enable server gdbserver auto) )
+ fi
+
+ if ! ( use server && ! use client ) ; then
+ # if we are configuring in the top level, then use all
+ # the additional global options
+ myconf+=(
+ --enable-64-bit-bfd
+ --disable-install-libbfd
+ --disable-install-libiberty
+ --with-system-readline
+ --with-separate-debug-dir="${EPREFIX}"/usr/lib/debug
+ $(use_with expat)
+ $(use_with lzma)
+ $(use_enable nls)
+ $(use multitarget && echo --enable-targets=all)
+ $(use_with python python "${EPREFIX}/usr/bin/python2")
+ $(use_with zlib)
+ )
+ fi
+
+ econf "${myconf[@]}"
+}
+
+src_test() {
+ emake check || ewarn "tests failed"
+}
+
+src_install() {
+ use server && ! use client && cd gdb/gdbserver
+ emake DESTDIR="${D}" install || die
+ use client && { find "${ED}"/usr -name libiberty.a -delete || die ; }
+ cd "${S}"
+
+ # Don't install docs when building a cross-gdb
+ if [[ ${CTARGET} != ${CHOST} ]] ; then
+ rm -r "${ED}"/usr/share
+ return 0
+ fi
+ # Install it by hand for now:
+ # http://sourceware.org/ml/gdb-patches/2011-12/msg00915.html
+ # Only install if it exists due to the twisted behavior (see
+ # notes in src_configure above).
+ [[ -e gdb/gdbserver/gdbreplay ]] && { dobin gdb/gdbserver/gdbreplay || die ; }
+
+ dodoc README
+ if use client ; then
+ docinto gdb
+ dodoc gdb/CONTRIBUTE gdb/README gdb/MAINTAINERS \
+ gdb/NEWS gdb/ChangeLog gdb/PROBLEMS
+ fi
+ docinto sim
+ dodoc sim/{ChangeLog,MAINTAINERS,README-HACKING}
+ if use server ; then
+ docinto gdbserver
+ dodoc gdb/gdbserver/{ChangeLog,README}
+ fi
+
+ if [[ -n ${PATCH_VER} ]] ; then
+ dodoc "${WORKDIR}"/extra/gdbinit.sample
+ fi
+
+ # Remove shared info pages
+ rm -f "${ED}"/usr/share/info/{annotate,bfd,configure,standards}.info*
+}
+
+pkg_postinst() {
+ # portage sucks and doesnt unmerge files in /etc
+ rm -vf "${EROOT}"/etc/skel/.gdbinit
+
+ if use prefix && [[ ${CHOST} == *-darwin* ]] ; then
+ ewarn "gdb is unable to get a mach task port when installed by Prefix"
+ ewarn "Portage, unprivileged. To make gdb fully functional you'll"
+ ewarn "have to perform the following steps:"
+ ewarn " % sudo chgrp procmod ${EPREFIX}/usr/bin/gdb"
+ ewarn " % sudo chmod g+s ${EPREFIX}/usr/bin/gdb"
+ fi
+}
diff --git a/sys-devel/gdb/gdb-7.7-r1.ebuild b/sys-devel/gdb/gdb-7.7-r1.ebuild
new file mode 100644
index 000000000000..08e6bfd9e836
--- /dev/null
+++ b/sys-devel/gdb/gdb-7.7-r1.ebuild
@@ -0,0 +1,192 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+PYTHON_COMPAT=( python{2_7,3_3,3_4} )
+
+inherit flag-o-matic eutils python-single-r1
+
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
+
+RPM=
+MY_PV=${PV}
+case ${PV} in
+*.*.50.*)
+ # weekly snapshots
+ SRC_URI="ftp://sourceware.org/pub/gdb/snapshots/current/gdb-weekly-${PV}.tar.bz2"
+ ;;
+9999*)
+ # live git tree
+ EGIT_REPO_URI="git://sourceware.org/git/binutils-gdb.git"
+ inherit git-2
+ SRC_URI=""
+ ;;
+*)
+ # Normal upstream release
+ SRC_URI="mirror://gnu/gdb/${P}.tar.bz2
+ ftp://sourceware.org/pub/gdb/releases/${P}.tar.bz2"
+ ;;
+esac
+
+PATCH_VER="1"
+DESCRIPTION="GNU debugger"
+HOMEPAGE="http://sourceware.org/gdb/"
+SRC_URI="${SRC_URI} ${PATCH_VER:+mirror://gentoo/${P}-patches-${PATCH_VER}.tar.xz}"
+
+LICENSE="GPL-2 LGPL-2"
+SLOT="0"
+if [[ ${PV} != 9999* ]] ; then
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+fi
+IUSE="+client expat lzma multitarget nls +python +server test vanilla zlib"
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+RDEPEND="!dev-util/gdbserver
+ >=sys-libs/ncurses-5.2-r2
+ sys-libs/readline
+ expat? ( dev-libs/expat )
+ lzma? ( app-arch/xz-utils )
+ python? ( ${PYTHON_DEPS} )
+ zlib? ( sys-libs/zlib )"
+DEPEND="${RDEPEND}
+ app-arch/xz-utils
+ virtual/yacc
+ test? ( dev-util/dejagnu )
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/${PN}-${MY_PV}
+
+pkg_setup() {
+ use python && python-single-r1_pkg_setup
+}
+
+src_prepare() {
+ [[ -n ${RPM} ]] && rpm_spec_epatch "${WORKDIR}"/gdb.spec
+ ! use vanilla && [[ -n ${PATCH_VER} ]] && EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/patch
+ epatch_user
+ strip-linguas -u bfd/po opcodes/po
+}
+
+gdb_branding() {
+ printf "Gentoo ${PV} "
+ if ! use vanilla && [[ -n ${PATCH_VER} ]] ; then
+ printf "p${PATCH_VER}"
+ else
+ printf "vanilla"
+ fi
+}
+
+src_configure() {
+ strip-unsupported-flags
+
+ local myconf=(
+ --with-pkgversion="$(gdb_branding)"
+ --with-bugurl='http://bugs.gentoo.org/'
+ --disable-werror
+ # Disable modules that are in a combined binutils/gdb tree. #490566
+ --disable-{binutils,etc,gas,gold,gprof,ld}
+ )
+ local sysroot="${EPREFIX}/usr/${CTARGET}"
+ is_cross && myconf+=(
+ --with-sysroot="${sysroot}"
+ --includedir="${sysroot}/usr/include"
+ )
+
+ if use server && ! use client ; then
+ # just configure+build in the gdbserver subdir to speed things up
+ cd gdb/gdbserver
+ myconf+=( --program-transform-name='' )
+ else
+ # gdbserver only works for native targets (CHOST==CTARGET).
+ # it also doesn't support all targets, so rather than duplicate
+ # the target list (which changes between versions), use the
+ # "auto" value when things are turned on.
+ is_cross \
+ && myconf+=( --disable-gdbserver ) \
+ || myconf+=( $(use_enable server gdbserver auto) )
+ fi
+
+ if ! ( use server && ! use client ) ; then
+ # if we are configuring in the top level, then use all
+ # the additional global options
+ myconf+=(
+ --enable-64-bit-bfd
+ --disable-install-libbfd
+ --disable-install-libiberty
+ # This only disables building in the readline subdir.
+ # For gdb itself, it'll use the system version.
+ --disable-readline
+ --with-system-readline
+ --with-separate-debug-dir="${EPREFIX}"/usr/lib/debug
+ $(use_with expat)
+ $(use_with lzma)
+ $(use_enable nls)
+ $(use multitarget && echo --enable-targets=all)
+ $(use_with python python "${EPYTHON}")
+ $(use_with zlib)
+ )
+ fi
+
+ econf "${myconf[@]}"
+}
+
+src_test() {
+ nonfatal emake check || ewarn "tests failed"
+}
+
+src_install() {
+ use server && ! use client && cd gdb/gdbserver
+ default
+ use client && find "${ED}"/usr -name libiberty.a -delete
+ cd "${S}"
+
+ # Don't install docs when building a cross-gdb
+ if [[ ${CTARGET} != ${CHOST} ]] ; then
+ rm -r "${ED}"/usr/share
+ return 0
+ fi
+ # Install it by hand for now:
+ # http://sourceware.org/ml/gdb-patches/2011-12/msg00915.html
+ # Only install if it exists due to the twisted behavior (see
+ # notes in src_configure above).
+ [[ -e gdb/gdbserver/gdbreplay ]] && dobin gdb/gdbserver/gdbreplay
+
+ if use client ; then
+ docinto gdb
+ dodoc gdb/CONTRIBUTE gdb/README gdb/MAINTAINERS \
+ gdb/NEWS gdb/ChangeLog gdb/PROBLEMS
+ fi
+ docinto sim
+ dodoc sim/{ChangeLog,MAINTAINERS,README-HACKING}
+ if use server ; then
+ docinto gdbserver
+ dodoc gdb/gdbserver/{ChangeLog,README}
+ fi
+
+ if [[ -n ${PATCH_VER} ]] ; then
+ dodoc "${WORKDIR}"/extra/gdbinit.sample
+ fi
+
+ # Remove shared info pages
+ rm -f "${ED}"/usr/share/info/{annotate,bfd,configure,standards}.info*
+}
+
+pkg_postinst() {
+ # portage sucks and doesnt unmerge files in /etc
+ rm -vf "${EROOT}"/etc/skel/.gdbinit
+
+ if use prefix && [[ ${CHOST} == *-darwin* ]] ; then
+ ewarn "gdb is unable to get a mach task port when installed by Prefix"
+ ewarn "Portage, unprivileged. To make gdb fully functional you'll"
+ ewarn "have to perform the following steps:"
+ ewarn " % sudo chgrp procmod ${EPREFIX}/usr/bin/gdb"
+ ewarn " % sudo chmod g+s ${EPREFIX}/usr/bin/gdb"
+ fi
+}
diff --git a/sys-devel/gdb/gdb-7.7.1.ebuild b/sys-devel/gdb/gdb-7.7.1.ebuild
new file mode 100644
index 000000000000..a962c2978b43
--- /dev/null
+++ b/sys-devel/gdb/gdb-7.7.1.ebuild
@@ -0,0 +1,202 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+PYTHON_COMPAT=( python{2_7,3_3,3_4} )
+
+inherit flag-o-matic eutils python-single-r1
+
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
+
+RPM=
+MY_PV=${PV}
+case ${PV} in
+*.*.50.*)
+ # weekly snapshots
+ SRC_URI="ftp://sourceware.org/pub/gdb/snapshots/current/gdb-weekly-${PV}.tar.bz2"
+ ;;
+9999*)
+ # live git tree
+ EGIT_REPO_URI="git://sourceware.org/git/binutils-gdb.git"
+ inherit git-2
+ SRC_URI=""
+ ;;
+*)
+ # Normal upstream release
+ SRC_URI="mirror://gnu/gdb/${P}.tar.bz2
+ ftp://sourceware.org/pub/gdb/releases/${P}.tar.bz2"
+ ;;
+esac
+
+PATCH_VER="1"
+DESCRIPTION="GNU debugger"
+HOMEPAGE="http://sourceware.org/gdb/"
+SRC_URI="${SRC_URI} ${PATCH_VER:+mirror://gentoo/${P}-patches-${PATCH_VER}.tar.xz}"
+
+LICENSE="GPL-2 LGPL-2"
+SLOT="0"
+if [[ ${PV} != 9999* ]] ; then
+ KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 sparc x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+fi
+IUSE="+client expat lzma multitarget nls +python +server test vanilla zlib"
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+RDEPEND="!dev-util/gdbserver
+ >=sys-libs/ncurses-5.2-r2
+ sys-libs/readline
+ expat? ( dev-libs/expat )
+ lzma? ( app-arch/xz-utils )
+ python? ( ${PYTHON_DEPS} )
+ zlib? ( sys-libs/zlib )"
+DEPEND="${RDEPEND}
+ app-arch/xz-utils
+ virtual/yacc
+ test? ( dev-util/dejagnu )
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/${PN}-${MY_PV}
+
+pkg_setup() {
+ use python && python-single-r1_pkg_setup
+}
+
+src_prepare() {
+ [[ -n ${RPM} ]] && rpm_spec_epatch "${WORKDIR}"/gdb.spec
+ ! use vanilla && [[ -n ${PATCH_VER} ]] && EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/patch
+ epatch_user
+ strip-linguas -u bfd/po opcodes/po
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ # make sure we have a python-config that matches our install,
+ # such that the python check doesn't fail just because the
+ # gdb-provided copy isn't quite what our python installed
+ # version is
+ rm -f "${S}"/gdb/python/python-config.py || die
+ pushd "${S}"/gdb/python > /dev/null || die
+ ln -s "${T}"/${EPYTHON}/bin/python-config python-config.py || die
+ popd > /dev/null || die
+ fi
+}
+
+gdb_branding() {
+ printf "Gentoo ${PV} "
+ if ! use vanilla && [[ -n ${PATCH_VER} ]] ; then
+ printf "p${PATCH_VER}"
+ else
+ printf "vanilla"
+ fi
+}
+
+src_configure() {
+ strip-unsupported-flags
+
+ local myconf=(
+ --with-pkgversion="$(gdb_branding)"
+ --with-bugurl='http://bugs.gentoo.org/'
+ --disable-werror
+ # Disable modules that are in a combined binutils/gdb tree. #490566
+ --disable-{binutils,etc,gas,gold,gprof,ld}
+ )
+ local sysroot="${EPREFIX}/usr/${CTARGET}"
+ is_cross && myconf+=(
+ --with-sysroot="${sysroot}"
+ --includedir="${sysroot}/usr/include"
+ )
+
+ if use server && ! use client ; then
+ # just configure+build in the gdbserver subdir to speed things up
+ cd gdb/gdbserver
+ myconf+=( --program-transform-name='' )
+ else
+ # gdbserver only works for native targets (CHOST==CTARGET).
+ # it also doesn't support all targets, so rather than duplicate
+ # the target list (which changes between versions), use the
+ # "auto" value when things are turned on.
+ is_cross \
+ && myconf+=( --disable-gdbserver ) \
+ || myconf+=( $(use_enable server gdbserver auto) )
+ fi
+
+ if ! ( use server && ! use client ) ; then
+ # if we are configuring in the top level, then use all
+ # the additional global options
+ myconf+=(
+ --enable-64-bit-bfd
+ --disable-install-libbfd
+ --disable-install-libiberty
+ # This only disables building in the readline subdir.
+ # For gdb itself, it'll use the system version.
+ --disable-readline
+ --with-system-readline
+ --with-separate-debug-dir="${EPREFIX}"/usr/lib/debug
+ $(use_with expat)
+ $(use_with lzma)
+ $(use_enable nls)
+ $(use multitarget && echo --enable-targets=all)
+ $(use_with python python "${EPYTHON}")
+ $(use_with zlib)
+ )
+ fi
+
+ econf "${myconf[@]}"
+}
+
+src_test() {
+ nonfatal emake check || ewarn "tests failed"
+}
+
+src_install() {
+ use server && ! use client && cd gdb/gdbserver
+ default
+ use client && find "${ED}"/usr -name libiberty.a -delete
+ cd "${S}"
+
+ # Don't install docs when building a cross-gdb
+ if [[ ${CTARGET} != ${CHOST} ]] ; then
+ rm -r "${ED}"/usr/share
+ return 0
+ fi
+ # Install it by hand for now:
+ # http://sourceware.org/ml/gdb-patches/2011-12/msg00915.html
+ # Only install if it exists due to the twisted behavior (see
+ # notes in src_configure above).
+ [[ -e gdb/gdbserver/gdbreplay ]] && dobin gdb/gdbserver/gdbreplay
+
+ if use client ; then
+ docinto gdb
+ dodoc gdb/CONTRIBUTE gdb/README gdb/MAINTAINERS \
+ gdb/NEWS gdb/ChangeLog gdb/PROBLEMS
+ fi
+ docinto sim
+ dodoc sim/{ChangeLog,MAINTAINERS,README-HACKING}
+ if use server ; then
+ docinto gdbserver
+ dodoc gdb/gdbserver/{ChangeLog,README}
+ fi
+
+ if [[ -n ${PATCH_VER} ]] ; then
+ dodoc "${WORKDIR}"/extra/gdbinit.sample
+ fi
+
+ # Remove shared info pages
+ rm -f "${ED}"/usr/share/info/{annotate,bfd,configure,standards}.info*
+}
+
+pkg_postinst() {
+ # portage sucks and doesnt unmerge files in /etc
+ rm -vf "${EROOT}"/etc/skel/.gdbinit
+
+ if use prefix && [[ ${CHOST} == *-darwin* ]] ; then
+ ewarn "gdb is unable to get a mach task port when installed by Prefix"
+ ewarn "Portage, unprivileged. To make gdb fully functional you'll"
+ ewarn "have to perform the following steps:"
+ ewarn " % sudo chgrp procmod ${EPREFIX}/usr/bin/gdb"
+ ewarn " % sudo chmod g+s ${EPREFIX}/usr/bin/gdb"
+ fi
+}
diff --git a/sys-devel/gdb/gdb-7.8.1.ebuild b/sys-devel/gdb/gdb-7.8.1.ebuild
new file mode 100644
index 000000000000..3ff1f0d52072
--- /dev/null
+++ b/sys-devel/gdb/gdb-7.8.1.ebuild
@@ -0,0 +1,206 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+PYTHON_COMPAT=( python{2_7,3_3,3_4} )
+
+inherit flag-o-matic eutils python-single-r1
+
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
+
+RPM=
+MY_PV=${PV}
+case ${PV} in
+*.*.50.*)
+ # weekly snapshots
+ SRC_URI="ftp://sourceware.org/pub/gdb/snapshots/current/gdb-weekly-${PV}.tar.bz2"
+ ;;
+9999*)
+ # live git tree
+ EGIT_REPO_URI="git://sourceware.org/git/binutils-gdb.git"
+ inherit git-2
+ SRC_URI=""
+ ;;
+*)
+ # Normal upstream release
+ SRC_URI="mirror://gnu/gdb/${P}.tar.xz
+ ftp://sourceware.org/pub/gdb/releases/${P}.tar.xz"
+ ;;
+esac
+
+PATCH_VER=""
+DESCRIPTION="GNU debugger"
+HOMEPAGE="http://sourceware.org/gdb/"
+SRC_URI="${SRC_URI} ${PATCH_VER:+mirror://gentoo/${P}-patches-${PATCH_VER}.tar.xz}"
+
+LICENSE="GPL-2 LGPL-2"
+SLOT="0"
+if [[ ${PV} != 9999* ]] ; then
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+fi
+IUSE="+client expat lzma multitarget nls +python +server test vanilla zlib"
+REQUIRED_USE="
+ python? ( ${PYTHON_REQUIRED_USE} )
+ || ( client server )
+"
+
+RDEPEND="server? ( !dev-util/gdbserver )
+ client? (
+ >=sys-libs/ncurses-5.2-r2
+ sys-libs/readline
+ expat? ( dev-libs/expat )
+ lzma? ( app-arch/xz-utils )
+ python? ( ${PYTHON_DEPS} )
+ zlib? ( sys-libs/zlib )
+ )"
+DEPEND="${RDEPEND}
+ app-arch/xz-utils
+ client? (
+ virtual/yacc
+ test? ( dev-util/dejagnu )
+ nls? ( sys-devel/gettext )
+ )"
+
+S=${WORKDIR}/${PN}-${MY_PV}
+
+pkg_setup() {
+ use python && python-single-r1_pkg_setup
+}
+
+src_prepare() {
+ [[ -n ${RPM} ]] && rpm_spec_epatch "${WORKDIR}"/gdb.spec
+ ! use vanilla && [[ -n ${PATCH_VER} ]] && EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/patch
+ epatch_user
+ strip-linguas -u bfd/po opcodes/po
+}
+
+gdb_branding() {
+ printf "Gentoo ${PV} "
+ if ! use vanilla && [[ -n ${PATCH_VER} ]] ; then
+ printf "p${PATCH_VER}"
+ else
+ printf "vanilla"
+ fi
+}
+
+src_configure() {
+ strip-unsupported-flags
+
+ local myconf=(
+ --with-pkgversion="$(gdb_branding)"
+ --with-bugurl='http://bugs.gentoo.org/'
+ --disable-werror
+ # Disable modules that are in a combined binutils/gdb tree. #490566
+ --disable-{binutils,etc,gas,gold,gprof,ld}
+ )
+ local sysroot="${EPREFIX}/usr/${CTARGET}"
+ is_cross && myconf+=(
+ --with-sysroot="${sysroot}"
+ --includedir="${sysroot}/usr/include"
+ --with-gdb-datadir="\${datadir}/gdb/${CTARGET}"
+ )
+
+ if use server && ! use client ; then
+ # just configure+build in the gdbserver subdir to speed things up
+ cd gdb/gdbserver
+ myconf+=( --program-transform-name='' )
+ else
+ # gdbserver only works for native targets (CHOST==CTARGET).
+ # it also doesn't support all targets, so rather than duplicate
+ # the target list (which changes between versions), use the
+ # "auto" value when things are turned on.
+ is_cross \
+ && myconf+=( --disable-gdbserver ) \
+ || myconf+=( $(use_enable server gdbserver auto) )
+ fi
+
+ if ! ( use server && ! use client ) ; then
+ # if we are configuring in the top level, then use all
+ # the additional global options
+ myconf+=(
+ --enable-64-bit-bfd
+ --disable-install-libbfd
+ --disable-install-libiberty
+ # This only disables building in the readline subdir.
+ # For gdb itself, it'll use the system version.
+ --disable-readline
+ --with-system-readline
+ --with-separate-debug-dir="${EPREFIX}"/usr/lib/debug
+ $(use_with expat)
+ $(use_with lzma)
+ $(use_enable nls)
+ $(use multitarget && echo --enable-targets=all)
+ $(use_with python python "${EPYTHON}")
+ $(use_with zlib)
+ )
+ fi
+
+ econf "${myconf[@]}"
+}
+
+src_test() {
+ nonfatal emake check || ewarn "tests failed"
+}
+
+src_install() {
+ use server && ! use client && cd gdb/gdbserver
+ default
+ use client && find "${ED}"/usr -name libiberty.a -delete
+ cd "${S}"
+
+ # Don't install docs when building a cross-gdb
+ if [[ ${CTARGET} != ${CHOST} ]] ; then
+ rm -r "${ED}"/usr/share/{doc,info,locale}
+ local f
+ for f in "${ED}"/usr/share/man/*/* ; do
+ if [[ ${f##*/} != ${CTARGET}-* ]] ; then
+ mv "${f}" "${f%/*}/${CTARGET}-${f##*/}" || die
+ fi
+ done
+ return 0
+ fi
+ # Install it by hand for now:
+ # http://sourceware.org/ml/gdb-patches/2011-12/msg00915.html
+ # Only install if it exists due to the twisted behavior (see
+ # notes in src_configure above).
+ [[ -e gdb/gdbserver/gdbreplay ]] && dobin gdb/gdbserver/gdbreplay
+
+ if use client ; then
+ docinto gdb
+ dodoc gdb/CONTRIBUTE gdb/README gdb/MAINTAINERS \
+ gdb/NEWS gdb/ChangeLog gdb/PROBLEMS
+ fi
+ docinto sim
+ dodoc sim/{ChangeLog,MAINTAINERS,README-HACKING}
+ if use server ; then
+ docinto gdbserver
+ dodoc gdb/gdbserver/{ChangeLog,README}
+ fi
+
+ if [[ -n ${PATCH_VER} ]] ; then
+ dodoc "${WORKDIR}"/extra/gdbinit.sample
+ fi
+
+ # Remove shared info pages
+ rm -f "${ED}"/usr/share/info/{annotate,bfd,configure,standards}.info*
+}
+
+pkg_postinst() {
+ # portage sucks and doesnt unmerge files in /etc
+ rm -vf "${EROOT}"/etc/skel/.gdbinit
+
+ if use prefix && [[ ${CHOST} == *-darwin* ]] ; then
+ ewarn "gdb is unable to get a mach task port when installed by Prefix"
+ ewarn "Portage, unprivileged. To make gdb fully functional you'll"
+ ewarn "have to perform the following steps:"
+ ewarn " % sudo chgrp procmod ${EPREFIX}/usr/bin/gdb"
+ ewarn " % sudo chmod g+s ${EPREFIX}/usr/bin/gdb"
+ fi
+}
diff --git a/sys-devel/gdb/gdb-7.8.2.ebuild b/sys-devel/gdb/gdb-7.8.2.ebuild
new file mode 100644
index 000000000000..1c1f9aba26b5
--- /dev/null
+++ b/sys-devel/gdb/gdb-7.8.2.ebuild
@@ -0,0 +1,206 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+PYTHON_COMPAT=( python{2_7,3_3,3_4} )
+
+inherit flag-o-matic eutils python-single-r1
+
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
+
+RPM=
+MY_PV=${PV}
+case ${PV} in
+*.*.50.*)
+ # weekly snapshots
+ SRC_URI="ftp://sourceware.org/pub/gdb/snapshots/current/gdb-weekly-${PV}.tar.bz2"
+ ;;
+9999*)
+ # live git tree
+ EGIT_REPO_URI="git://sourceware.org/git/binutils-gdb.git"
+ inherit git-2
+ SRC_URI=""
+ ;;
+*)
+ # Normal upstream release
+ SRC_URI="mirror://gnu/gdb/${P}.tar.xz
+ ftp://sourceware.org/pub/gdb/releases/${P}.tar.xz"
+ ;;
+esac
+
+PATCH_VER=""
+DESCRIPTION="GNU debugger"
+HOMEPAGE="http://sourceware.org/gdb/"
+SRC_URI="${SRC_URI} ${PATCH_VER:+mirror://gentoo/${P}-patches-${PATCH_VER}.tar.xz}"
+
+LICENSE="GPL-2 LGPL-2"
+SLOT="0"
+if [[ ${PV} != 9999* ]] ; then
+ KEYWORDS="~alpha ~amd64 ~arm arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+fi
+IUSE="+client expat lzma multitarget nls +python +server test vanilla zlib"
+REQUIRED_USE="
+ python? ( ${PYTHON_REQUIRED_USE} )
+ || ( client server )
+"
+
+RDEPEND="server? ( !dev-util/gdbserver )
+ client? (
+ >=sys-libs/ncurses-5.2-r2
+ sys-libs/readline
+ expat? ( dev-libs/expat )
+ lzma? ( app-arch/xz-utils )
+ python? ( ${PYTHON_DEPS} )
+ zlib? ( sys-libs/zlib )
+ )"
+DEPEND="${RDEPEND}
+ app-arch/xz-utils
+ client? (
+ virtual/yacc
+ test? ( dev-util/dejagnu )
+ nls? ( sys-devel/gettext )
+ )"
+
+S=${WORKDIR}/${PN}-${MY_PV}
+
+pkg_setup() {
+ use python && python-single-r1_pkg_setup
+}
+
+src_prepare() {
+ [[ -n ${RPM} ]] && rpm_spec_epatch "${WORKDIR}"/gdb.spec
+ ! use vanilla && [[ -n ${PATCH_VER} ]] && EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/patch
+ epatch_user
+ strip-linguas -u bfd/po opcodes/po
+}
+
+gdb_branding() {
+ printf "Gentoo ${PV} "
+ if ! use vanilla && [[ -n ${PATCH_VER} ]] ; then
+ printf "p${PATCH_VER}"
+ else
+ printf "vanilla"
+ fi
+}
+
+src_configure() {
+ strip-unsupported-flags
+
+ local myconf=(
+ --with-pkgversion="$(gdb_branding)"
+ --with-bugurl='http://bugs.gentoo.org/'
+ --disable-werror
+ # Disable modules that are in a combined binutils/gdb tree. #490566
+ --disable-{binutils,etc,gas,gold,gprof,ld}
+ )
+ local sysroot="${EPREFIX}/usr/${CTARGET}"
+ is_cross && myconf+=(
+ --with-sysroot="${sysroot}"
+ --includedir="${sysroot}/usr/include"
+ --with-gdb-datadir="\${datadir}/gdb/${CTARGET}"
+ )
+
+ if use server && ! use client ; then
+ # just configure+build in the gdbserver subdir to speed things up
+ cd gdb/gdbserver
+ myconf+=( --program-transform-name='' )
+ else
+ # gdbserver only works for native targets (CHOST==CTARGET).
+ # it also doesn't support all targets, so rather than duplicate
+ # the target list (which changes between versions), use the
+ # "auto" value when things are turned on.
+ is_cross \
+ && myconf+=( --disable-gdbserver ) \
+ || myconf+=( $(use_enable server gdbserver auto) )
+ fi
+
+ if ! ( use server && ! use client ) ; then
+ # if we are configuring in the top level, then use all
+ # the additional global options
+ myconf+=(
+ --enable-64-bit-bfd
+ --disable-install-libbfd
+ --disable-install-libiberty
+ # This only disables building in the readline subdir.
+ # For gdb itself, it'll use the system version.
+ --disable-readline
+ --with-system-readline
+ --with-separate-debug-dir="${EPREFIX}"/usr/lib/debug
+ $(use_with expat)
+ $(use_with lzma)
+ $(use_enable nls)
+ $(use multitarget && echo --enable-targets=all)
+ $(use_with python python "${EPYTHON}")
+ $(use_with zlib)
+ )
+ fi
+
+ econf "${myconf[@]}"
+}
+
+src_test() {
+ nonfatal emake check || ewarn "tests failed"
+}
+
+src_install() {
+ use server && ! use client && cd gdb/gdbserver
+ default
+ use client && find "${ED}"/usr -name libiberty.a -delete
+ cd "${S}"
+
+ # Don't install docs when building a cross-gdb
+ if [[ ${CTARGET} != ${CHOST} ]] ; then
+ rm -r "${ED}"/usr/share/{doc,info,locale}
+ local f
+ for f in "${ED}"/usr/share/man/*/* ; do
+ if [[ ${f##*/} != ${CTARGET}-* ]] ; then
+ mv "${f}" "${f%/*}/${CTARGET}-${f##*/}" || die
+ fi
+ done
+ return 0
+ fi
+ # Install it by hand for now:
+ # http://sourceware.org/ml/gdb-patches/2011-12/msg00915.html
+ # Only install if it exists due to the twisted behavior (see
+ # notes in src_configure above).
+ [[ -e gdb/gdbserver/gdbreplay ]] && dobin gdb/gdbserver/gdbreplay
+
+ if use client ; then
+ docinto gdb
+ dodoc gdb/CONTRIBUTE gdb/README gdb/MAINTAINERS \
+ gdb/NEWS gdb/ChangeLog gdb/PROBLEMS
+ fi
+ docinto sim
+ dodoc sim/{ChangeLog,MAINTAINERS,README-HACKING}
+ if use server ; then
+ docinto gdbserver
+ dodoc gdb/gdbserver/{ChangeLog,README}
+ fi
+
+ if [[ -n ${PATCH_VER} ]] ; then
+ dodoc "${WORKDIR}"/extra/gdbinit.sample
+ fi
+
+ # Remove shared info pages
+ rm -f "${ED}"/usr/share/info/{annotate,bfd,configure,standards}.info*
+}
+
+pkg_postinst() {
+ # portage sucks and doesnt unmerge files in /etc
+ rm -vf "${EROOT}"/etc/skel/.gdbinit
+
+ if use prefix && [[ ${CHOST} == *-darwin* ]] ; then
+ ewarn "gdb is unable to get a mach task port when installed by Prefix"
+ ewarn "Portage, unprivileged. To make gdb fully functional you'll"
+ ewarn "have to perform the following steps:"
+ ewarn " % sudo chgrp procmod ${EPREFIX}/usr/bin/gdb"
+ ewarn " % sudo chmod g+s ${EPREFIX}/usr/bin/gdb"
+ fi
+}
diff --git a/sys-devel/gdb/gdb-7.8.ebuild b/sys-devel/gdb/gdb-7.8.ebuild
new file mode 100644
index 000000000000..d07074fc4288
--- /dev/null
+++ b/sys-devel/gdb/gdb-7.8.ebuild
@@ -0,0 +1,199 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+PYTHON_COMPAT=( python{2_7,3_3,3_4} )
+
+inherit flag-o-matic eutils python-single-r1
+
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
+
+RPM=
+MY_PV=${PV}
+case ${PV} in
+*.*.50.*)
+ # weekly snapshots
+ SRC_URI="ftp://sourceware.org/pub/gdb/snapshots/current/gdb-weekly-${PV}.tar.bz2"
+ ;;
+9999*)
+ # live git tree
+ EGIT_REPO_URI="git://sourceware.org/git/binutils-gdb.git"
+ inherit git-2
+ SRC_URI=""
+ ;;
+*)
+ # Normal upstream release
+ SRC_URI="mirror://gnu/gdb/${P}.tar.xz
+ ftp://sourceware.org/pub/gdb/releases/${P}.tar.xz"
+ ;;
+esac
+
+PATCH_VER=""
+DESCRIPTION="GNU debugger"
+HOMEPAGE="http://sourceware.org/gdb/"
+SRC_URI="${SRC_URI} ${PATCH_VER:+mirror://gentoo/${P}-patches-${PATCH_VER}.tar.xz}"
+
+LICENSE="GPL-2 LGPL-2"
+SLOT="0"
+if [[ ${PV} != 9999* ]] ; then
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+fi
+IUSE="+client expat lzma multitarget nls +python +server test vanilla zlib"
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+RDEPEND="!dev-util/gdbserver
+ >=sys-libs/ncurses-5.2-r2
+ sys-libs/readline
+ expat? ( dev-libs/expat )
+ lzma? ( app-arch/xz-utils )
+ python? ( ${PYTHON_DEPS} )
+ zlib? ( sys-libs/zlib )"
+DEPEND="${RDEPEND}
+ app-arch/xz-utils
+ virtual/yacc
+ test? ( dev-util/dejagnu )
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/${PN}-${MY_PV}
+
+pkg_setup() {
+ use python && python-single-r1_pkg_setup
+}
+
+src_prepare() {
+ [[ -n ${RPM} ]] && rpm_spec_epatch "${WORKDIR}"/gdb.spec
+ ! use vanilla && [[ -n ${PATCH_VER} ]] && EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/patch
+ epatch_user
+ strip-linguas -u bfd/po opcodes/po
+}
+
+gdb_branding() {
+ printf "Gentoo ${PV} "
+ if ! use vanilla && [[ -n ${PATCH_VER} ]] ; then
+ printf "p${PATCH_VER}"
+ else
+ printf "vanilla"
+ fi
+}
+
+src_configure() {
+ strip-unsupported-flags
+
+ local myconf=(
+ --with-pkgversion="$(gdb_branding)"
+ --with-bugurl='http://bugs.gentoo.org/'
+ --disable-werror
+ # Disable modules that are in a combined binutils/gdb tree. #490566
+ --disable-{binutils,etc,gas,gold,gprof,ld}
+ )
+ local sysroot="${EPREFIX}/usr/${CTARGET}"
+ is_cross && myconf+=(
+ --with-sysroot="${sysroot}"
+ --includedir="${sysroot}/usr/include"
+ --with-gdb-datadir="\${datadir}/gdb/${CTARGET}"
+ )
+
+ if use server && ! use client ; then
+ # just configure+build in the gdbserver subdir to speed things up
+ cd gdb/gdbserver
+ myconf+=( --program-transform-name='' )
+ else
+ # gdbserver only works for native targets (CHOST==CTARGET).
+ # it also doesn't support all targets, so rather than duplicate
+ # the target list (which changes between versions), use the
+ # "auto" value when things are turned on.
+ is_cross \
+ && myconf+=( --disable-gdbserver ) \
+ || myconf+=( $(use_enable server gdbserver auto) )
+ fi
+
+ if ! ( use server && ! use client ) ; then
+ # if we are configuring in the top level, then use all
+ # the additional global options
+ myconf+=(
+ --enable-64-bit-bfd
+ --disable-install-libbfd
+ --disable-install-libiberty
+ # This only disables building in the readline subdir.
+ # For gdb itself, it'll use the system version.
+ --disable-readline
+ --with-system-readline
+ --with-separate-debug-dir="${EPREFIX}"/usr/lib/debug
+ $(use_with expat)
+ $(use_with lzma)
+ $(use_enable nls)
+ $(use multitarget && echo --enable-targets=all)
+ $(use_with python python "${EPYTHON}")
+ $(use_with zlib)
+ )
+ fi
+
+ econf "${myconf[@]}"
+}
+
+src_test() {
+ nonfatal emake check || ewarn "tests failed"
+}
+
+src_install() {
+ use server && ! use client && cd gdb/gdbserver
+ default
+ use client && find "${ED}"/usr -name libiberty.a -delete
+ cd "${S}"
+
+ # Don't install docs when building a cross-gdb
+ if [[ ${CTARGET} != ${CHOST} ]] ; then
+ rm -r "${ED}"/usr/share/{doc,info,locale}
+ local f
+ for f in "${ED}"/usr/share/man/*/* ; do
+ if [[ ${f##*/} != ${CTARGET}-* ]] ; then
+ mv "${f}" "${f%/*}/${CTARGET}-${f##*/}" || die
+ fi
+ done
+ return 0
+ fi
+ # Install it by hand for now:
+ # http://sourceware.org/ml/gdb-patches/2011-12/msg00915.html
+ # Only install if it exists due to the twisted behavior (see
+ # notes in src_configure above).
+ [[ -e gdb/gdbserver/gdbreplay ]] && dobin gdb/gdbserver/gdbreplay
+
+ if use client ; then
+ docinto gdb
+ dodoc gdb/CONTRIBUTE gdb/README gdb/MAINTAINERS \
+ gdb/NEWS gdb/ChangeLog gdb/PROBLEMS
+ fi
+ docinto sim
+ dodoc sim/{ChangeLog,MAINTAINERS,README-HACKING}
+ if use server ; then
+ docinto gdbserver
+ dodoc gdb/gdbserver/{ChangeLog,README}
+ fi
+
+ if [[ -n ${PATCH_VER} ]] ; then
+ dodoc "${WORKDIR}"/extra/gdbinit.sample
+ fi
+
+ # Remove shared info pages
+ rm -f "${ED}"/usr/share/info/{annotate,bfd,configure,standards}.info*
+}
+
+pkg_postinst() {
+ # portage sucks and doesnt unmerge files in /etc
+ rm -vf "${EROOT}"/etc/skel/.gdbinit
+
+ if use prefix && [[ ${CHOST} == *-darwin* ]] ; then
+ ewarn "gdb is unable to get a mach task port when installed by Prefix"
+ ewarn "Portage, unprivileged. To make gdb fully functional you'll"
+ ewarn "have to perform the following steps:"
+ ewarn " % sudo chgrp procmod ${EPREFIX}/usr/bin/gdb"
+ ewarn " % sudo chmod g+s ${EPREFIX}/usr/bin/gdb"
+ fi
+}
diff --git a/sys-devel/gdb/gdb-7.9.1.ebuild b/sys-devel/gdb/gdb-7.9.1.ebuild
new file mode 100644
index 000000000000..5c02bea1a5c4
--- /dev/null
+++ b/sys-devel/gdb/gdb-7.9.1.ebuild
@@ -0,0 +1,220 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+PYTHON_COMPAT=( python{2_7,3_3,3_4} )
+
+inherit flag-o-matic eutils python-single-r1
+
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
+
+RPM=
+MY_PV=${PV}
+case ${PV} in
+9999*)
+ # live git tree
+ EGIT_REPO_URI="git://sourceware.org/git/binutils-gdb.git"
+ inherit git-2
+ SRC_URI=""
+ ;;
+*.*.50.2???????)
+ # weekly snapshots
+ SRC_URI="ftp://sourceware.org/pub/gdb/snapshots/current/gdb-weekly-${PV}.tar.xz"
+ ;;
+*.*.*.*.*.*)
+ # fedora versions; note we swap the rpm & fedora core versions.
+ # gdb-6.8.50.20090302-8.fc11.src.rpm -> gdb-6.8.50.20090302.11.8.ebuild
+ # gdb-7.9-11.fc23.src.rpm -> gdb-7.9.23.11.ebuild
+ inherit versionator rpm
+ gvcr() { get_version_component_range "$@"; }
+ parse_fedora_ver() {
+ set -- $(get_version_components)
+ MY_PV=$(gvcr 1-$(( $# - 2 )))
+ RPM="${PN}-${MY_PV}-$(gvcr $#).fc$(gvcr $(( $# - 1 ))).src.rpm"
+ }
+ parse_fedora_ver
+ SRC_URI="mirror://fedora-dev/development/rawhide/source/SRPMS/g/${RPM}"
+ ;;
+*)
+ # Normal upstream release
+ SRC_URI="mirror://gnu/gdb/${P}.tar.xz
+ ftp://sourceware.org/pub/gdb/releases/${P}.tar.xz"
+ ;;
+esac
+
+PATCH_VER=""
+DESCRIPTION="GNU debugger"
+HOMEPAGE="http://sourceware.org/gdb/"
+SRC_URI="${SRC_URI} ${PATCH_VER:+mirror://gentoo/${P}-patches-${PATCH_VER}.tar.xz}"
+
+LICENSE="GPL-2 LGPL-2"
+SLOT="0"
+if [[ ${PV} != 9999* ]] ; then
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+fi
+IUSE="+client expat lzma multitarget nls +python +server test vanilla zlib"
+REQUIRED_USE="
+ python? ( ${PYTHON_REQUIRED_USE} )
+ || ( client server )
+"
+
+RDEPEND="server? ( !dev-util/gdbserver )
+ client? (
+ >=sys-libs/ncurses-5.2-r2
+ sys-libs/readline:0=
+ expat? ( dev-libs/expat )
+ lzma? ( app-arch/xz-utils )
+ python? ( ${PYTHON_DEPS} )
+ zlib? ( sys-libs/zlib )
+ )"
+DEPEND="${RDEPEND}
+ app-arch/xz-utils
+ client? (
+ virtual/yacc
+ test? ( dev-util/dejagnu )
+ nls? ( sys-devel/gettext )
+ )"
+
+S=${WORKDIR}/${PN}-${MY_PV}
+
+pkg_setup() {
+ use python && python-single-r1_pkg_setup
+}
+
+src_prepare() {
+ [[ -n ${RPM} ]] && rpm_spec_epatch "${WORKDIR}"/gdb.spec
+ ! use vanilla && [[ -n ${PATCH_VER} ]] && EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/patch
+ epatch_user
+ strip-linguas -u bfd/po opcodes/po
+}
+
+gdb_branding() {
+ printf "Gentoo ${PV} "
+ if ! use vanilla && [[ -n ${PATCH_VER} ]] ; then
+ printf "p${PATCH_VER}"
+ else
+ printf "vanilla"
+ fi
+}
+
+src_configure() {
+ strip-unsupported-flags
+
+ local myconf=(
+ --with-pkgversion="$(gdb_branding)"
+ --with-bugurl='http://bugs.gentoo.org/'
+ --disable-werror
+ # Disable modules that are in a combined binutils/gdb tree. #490566
+ --disable-{binutils,etc,gas,gold,gprof,ld}
+ )
+ local sysroot="${EPREFIX}/usr/${CTARGET}"
+ is_cross && myconf+=(
+ --with-sysroot="${sysroot}"
+ --includedir="${sysroot}/usr/include"
+ --with-gdb-datadir="\${datadir}/gdb/${CTARGET}"
+ )
+
+ if use server && ! use client ; then
+ # just configure+build in the gdbserver subdir to speed things up
+ cd gdb/gdbserver
+ myconf+=( --program-transform-name='' )
+ else
+ # gdbserver only works for native targets (CHOST==CTARGET).
+ # it also doesn't support all targets, so rather than duplicate
+ # the target list (which changes between versions), use the
+ # "auto" value when things are turned on.
+ is_cross \
+ && myconf+=( --disable-gdbserver ) \
+ || myconf+=( $(use_enable server gdbserver auto) )
+ fi
+
+ if ! ( use server && ! use client ) ; then
+ # if we are configuring in the top level, then use all
+ # the additional global options
+ myconf+=(
+ --enable-64-bit-bfd
+ --disable-install-libbfd
+ --disable-install-libiberty
+ # This only disables building in the readline subdir.
+ # For gdb itself, it'll use the system version.
+ --disable-readline
+ --with-system-readline
+ --with-separate-debug-dir="${EPREFIX}"/usr/lib/debug
+ $(use_with expat)
+ $(use_with lzma)
+ $(use_enable nls)
+ $(use multitarget && echo --enable-targets=all)
+ $(use_with python python "${EPYTHON}")
+ $(use_with zlib)
+ )
+ fi
+
+ econf "${myconf[@]}"
+}
+
+src_test() {
+ nonfatal emake check || ewarn "tests failed"
+}
+
+src_install() {
+ use server && ! use client && cd gdb/gdbserver
+ default
+ use client && find "${ED}"/usr -name libiberty.a -delete
+ cd "${S}"
+
+ # Don't install docs when building a cross-gdb
+ if [[ ${CTARGET} != ${CHOST} ]] ; then
+ rm -r "${ED}"/usr/share/{doc,info,locale}
+ local f
+ for f in "${ED}"/usr/share/man/*/* ; do
+ if [[ ${f##*/} != ${CTARGET}-* ]] ; then
+ mv "${f}" "${f%/*}/${CTARGET}-${f##*/}" || die
+ fi
+ done
+ return 0
+ fi
+ # Install it by hand for now:
+ # http://sourceware.org/ml/gdb-patches/2011-12/msg00915.html
+ # Only install if it exists due to the twisted behavior (see
+ # notes in src_configure above).
+ [[ -e gdb/gdbserver/gdbreplay ]] && dobin gdb/gdbserver/gdbreplay
+
+ if use client ; then
+ docinto gdb
+ dodoc gdb/CONTRIBUTE gdb/README gdb/MAINTAINERS \
+ gdb/NEWS gdb/ChangeLog gdb/PROBLEMS
+ fi
+ docinto sim
+ dodoc sim/{ChangeLog,MAINTAINERS,README-HACKING}
+ if use server ; then
+ docinto gdbserver
+ dodoc gdb/gdbserver/{ChangeLog,README}
+ fi
+
+ if [[ -n ${PATCH_VER} ]] ; then
+ dodoc "${WORKDIR}"/extra/gdbinit.sample
+ fi
+
+ # Remove shared info pages
+ rm -f "${ED}"/usr/share/info/{annotate,bfd,configure,standards}.info*
+}
+
+pkg_postinst() {
+ # portage sucks and doesnt unmerge files in /etc
+ rm -vf "${EROOT}"/etc/skel/.gdbinit
+
+ if use prefix && [[ ${CHOST} == *-darwin* ]] ; then
+ ewarn "gdb is unable to get a mach task port when installed by Prefix"
+ ewarn "Portage, unprivileged. To make gdb fully functional you'll"
+ ewarn "have to perform the following steps:"
+ ewarn " % sudo chgrp procmod ${EPREFIX}/usr/bin/gdb"
+ ewarn " % sudo chmod g+s ${EPREFIX}/usr/bin/gdb"
+ fi
+}
diff --git a/sys-devel/gdb/gdb-7.9.ebuild b/sys-devel/gdb/gdb-7.9.ebuild
new file mode 100644
index 000000000000..5c02bea1a5c4
--- /dev/null
+++ b/sys-devel/gdb/gdb-7.9.ebuild
@@ -0,0 +1,220 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+PYTHON_COMPAT=( python{2_7,3_3,3_4} )
+
+inherit flag-o-matic eutils python-single-r1
+
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
+
+RPM=
+MY_PV=${PV}
+case ${PV} in
+9999*)
+ # live git tree
+ EGIT_REPO_URI="git://sourceware.org/git/binutils-gdb.git"
+ inherit git-2
+ SRC_URI=""
+ ;;
+*.*.50.2???????)
+ # weekly snapshots
+ SRC_URI="ftp://sourceware.org/pub/gdb/snapshots/current/gdb-weekly-${PV}.tar.xz"
+ ;;
+*.*.*.*.*.*)
+ # fedora versions; note we swap the rpm & fedora core versions.
+ # gdb-6.8.50.20090302-8.fc11.src.rpm -> gdb-6.8.50.20090302.11.8.ebuild
+ # gdb-7.9-11.fc23.src.rpm -> gdb-7.9.23.11.ebuild
+ inherit versionator rpm
+ gvcr() { get_version_component_range "$@"; }
+ parse_fedora_ver() {
+ set -- $(get_version_components)
+ MY_PV=$(gvcr 1-$(( $# - 2 )))
+ RPM="${PN}-${MY_PV}-$(gvcr $#).fc$(gvcr $(( $# - 1 ))).src.rpm"
+ }
+ parse_fedora_ver
+ SRC_URI="mirror://fedora-dev/development/rawhide/source/SRPMS/g/${RPM}"
+ ;;
+*)
+ # Normal upstream release
+ SRC_URI="mirror://gnu/gdb/${P}.tar.xz
+ ftp://sourceware.org/pub/gdb/releases/${P}.tar.xz"
+ ;;
+esac
+
+PATCH_VER=""
+DESCRIPTION="GNU debugger"
+HOMEPAGE="http://sourceware.org/gdb/"
+SRC_URI="${SRC_URI} ${PATCH_VER:+mirror://gentoo/${P}-patches-${PATCH_VER}.tar.xz}"
+
+LICENSE="GPL-2 LGPL-2"
+SLOT="0"
+if [[ ${PV} != 9999* ]] ; then
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+fi
+IUSE="+client expat lzma multitarget nls +python +server test vanilla zlib"
+REQUIRED_USE="
+ python? ( ${PYTHON_REQUIRED_USE} )
+ || ( client server )
+"
+
+RDEPEND="server? ( !dev-util/gdbserver )
+ client? (
+ >=sys-libs/ncurses-5.2-r2
+ sys-libs/readline:0=
+ expat? ( dev-libs/expat )
+ lzma? ( app-arch/xz-utils )
+ python? ( ${PYTHON_DEPS} )
+ zlib? ( sys-libs/zlib )
+ )"
+DEPEND="${RDEPEND}
+ app-arch/xz-utils
+ client? (
+ virtual/yacc
+ test? ( dev-util/dejagnu )
+ nls? ( sys-devel/gettext )
+ )"
+
+S=${WORKDIR}/${PN}-${MY_PV}
+
+pkg_setup() {
+ use python && python-single-r1_pkg_setup
+}
+
+src_prepare() {
+ [[ -n ${RPM} ]] && rpm_spec_epatch "${WORKDIR}"/gdb.spec
+ ! use vanilla && [[ -n ${PATCH_VER} ]] && EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/patch
+ epatch_user
+ strip-linguas -u bfd/po opcodes/po
+}
+
+gdb_branding() {
+ printf "Gentoo ${PV} "
+ if ! use vanilla && [[ -n ${PATCH_VER} ]] ; then
+ printf "p${PATCH_VER}"
+ else
+ printf "vanilla"
+ fi
+}
+
+src_configure() {
+ strip-unsupported-flags
+
+ local myconf=(
+ --with-pkgversion="$(gdb_branding)"
+ --with-bugurl='http://bugs.gentoo.org/'
+ --disable-werror
+ # Disable modules that are in a combined binutils/gdb tree. #490566
+ --disable-{binutils,etc,gas,gold,gprof,ld}
+ )
+ local sysroot="${EPREFIX}/usr/${CTARGET}"
+ is_cross && myconf+=(
+ --with-sysroot="${sysroot}"
+ --includedir="${sysroot}/usr/include"
+ --with-gdb-datadir="\${datadir}/gdb/${CTARGET}"
+ )
+
+ if use server && ! use client ; then
+ # just configure+build in the gdbserver subdir to speed things up
+ cd gdb/gdbserver
+ myconf+=( --program-transform-name='' )
+ else
+ # gdbserver only works for native targets (CHOST==CTARGET).
+ # it also doesn't support all targets, so rather than duplicate
+ # the target list (which changes between versions), use the
+ # "auto" value when things are turned on.
+ is_cross \
+ && myconf+=( --disable-gdbserver ) \
+ || myconf+=( $(use_enable server gdbserver auto) )
+ fi
+
+ if ! ( use server && ! use client ) ; then
+ # if we are configuring in the top level, then use all
+ # the additional global options
+ myconf+=(
+ --enable-64-bit-bfd
+ --disable-install-libbfd
+ --disable-install-libiberty
+ # This only disables building in the readline subdir.
+ # For gdb itself, it'll use the system version.
+ --disable-readline
+ --with-system-readline
+ --with-separate-debug-dir="${EPREFIX}"/usr/lib/debug
+ $(use_with expat)
+ $(use_with lzma)
+ $(use_enable nls)
+ $(use multitarget && echo --enable-targets=all)
+ $(use_with python python "${EPYTHON}")
+ $(use_with zlib)
+ )
+ fi
+
+ econf "${myconf[@]}"
+}
+
+src_test() {
+ nonfatal emake check || ewarn "tests failed"
+}
+
+src_install() {
+ use server && ! use client && cd gdb/gdbserver
+ default
+ use client && find "${ED}"/usr -name libiberty.a -delete
+ cd "${S}"
+
+ # Don't install docs when building a cross-gdb
+ if [[ ${CTARGET} != ${CHOST} ]] ; then
+ rm -r "${ED}"/usr/share/{doc,info,locale}
+ local f
+ for f in "${ED}"/usr/share/man/*/* ; do
+ if [[ ${f##*/} != ${CTARGET}-* ]] ; then
+ mv "${f}" "${f%/*}/${CTARGET}-${f##*/}" || die
+ fi
+ done
+ return 0
+ fi
+ # Install it by hand for now:
+ # http://sourceware.org/ml/gdb-patches/2011-12/msg00915.html
+ # Only install if it exists due to the twisted behavior (see
+ # notes in src_configure above).
+ [[ -e gdb/gdbserver/gdbreplay ]] && dobin gdb/gdbserver/gdbreplay
+
+ if use client ; then
+ docinto gdb
+ dodoc gdb/CONTRIBUTE gdb/README gdb/MAINTAINERS \
+ gdb/NEWS gdb/ChangeLog gdb/PROBLEMS
+ fi
+ docinto sim
+ dodoc sim/{ChangeLog,MAINTAINERS,README-HACKING}
+ if use server ; then
+ docinto gdbserver
+ dodoc gdb/gdbserver/{ChangeLog,README}
+ fi
+
+ if [[ -n ${PATCH_VER} ]] ; then
+ dodoc "${WORKDIR}"/extra/gdbinit.sample
+ fi
+
+ # Remove shared info pages
+ rm -f "${ED}"/usr/share/info/{annotate,bfd,configure,standards}.info*
+}
+
+pkg_postinst() {
+ # portage sucks and doesnt unmerge files in /etc
+ rm -vf "${EROOT}"/etc/skel/.gdbinit
+
+ if use prefix && [[ ${CHOST} == *-darwin* ]] ; then
+ ewarn "gdb is unable to get a mach task port when installed by Prefix"
+ ewarn "Portage, unprivileged. To make gdb fully functional you'll"
+ ewarn "have to perform the following steps:"
+ ewarn " % sudo chgrp procmod ${EPREFIX}/usr/bin/gdb"
+ ewarn " % sudo chmod g+s ${EPREFIX}/usr/bin/gdb"
+ fi
+}
diff --git a/sys-devel/gdb/gdb-9999.ebuild b/sys-devel/gdb/gdb-9999.ebuild
new file mode 100644
index 000000000000..b45fc2e89d22
--- /dev/null
+++ b/sys-devel/gdb/gdb-9999.ebuild
@@ -0,0 +1,221 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+PYTHON_COMPAT=( python{2_7,3_3,3_4} )
+
+inherit flag-o-matic eutils python-single-r1
+
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
+
+RPM=
+MY_PV=${PV}
+case ${PV} in
+9999*)
+ # live git tree
+ EGIT_REPO_URI="git://sourceware.org/git/binutils-gdb.git"
+ inherit git-2
+ SRC_URI=""
+ ;;
+*.*.50.2???????)
+ # weekly snapshots
+ SRC_URI="ftp://sourceware.org/pub/gdb/snapshots/current/gdb-weekly-${PV}.tar.xz"
+ ;;
+*.*.*.*.*.*)
+ # fedora versions; note we swap the rpm & fedora core versions.
+ # gdb-6.8.50.20090302-8.fc11.src.rpm -> gdb-6.8.50.20090302.11.8.ebuild
+ # gdb-7.9-11.fc23.src.rpm -> gdb-7.9.23.11.ebuild
+ inherit versionator rpm
+ gvcr() { get_version_component_range "$@"; }
+ parse_fedora_ver() {
+ set -- $(get_version_components)
+ MY_PV=$(gvcr 1-$(( $# - 2 )))
+ RPM="${PN}-${MY_PV}-$(gvcr $#).fc$(gvcr $(( $# - 1 ))).src.rpm"
+ }
+ parse_fedora_ver
+ SRC_URI="mirror://fedora-dev/development/rawhide/source/SRPMS/g/${RPM}"
+ ;;
+*)
+ # Normal upstream release
+ SRC_URI="mirror://gnu/gdb/${P}.tar.xz
+ ftp://sourceware.org/pub/gdb/releases/${P}.tar.xz"
+ ;;
+esac
+
+PATCH_VER=""
+DESCRIPTION="GNU debugger"
+HOMEPAGE="http://sourceware.org/gdb/"
+SRC_URI="${SRC_URI} ${PATCH_VER:+mirror://gentoo/${P}-patches-${PATCH_VER}.tar.xz}"
+
+LICENSE="GPL-2 LGPL-2"
+SLOT="0"
+if [[ ${PV} != 9999* ]] ; then
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+fi
+IUSE="+client expat lzma multitarget nls +python +server test vanilla zlib"
+REQUIRED_USE="
+ python? ( ${PYTHON_REQUIRED_USE} )
+ || ( client server )
+"
+
+RDEPEND="server? ( !dev-util/gdbserver )
+ client? (
+ >=sys-libs/ncurses-5.2-r2
+ sys-libs/readline:0=
+ expat? ( dev-libs/expat )
+ lzma? ( app-arch/xz-utils )
+ python? ( ${PYTHON_DEPS} )
+ zlib? ( sys-libs/zlib )
+ )"
+DEPEND="${RDEPEND}
+ app-arch/xz-utils
+ client? (
+ virtual/yacc
+ test? ( dev-util/dejagnu )
+ nls? ( sys-devel/gettext )
+ )"
+
+S=${WORKDIR}/${PN}-${MY_PV}
+
+pkg_setup() {
+ use python && python-single-r1_pkg_setup
+}
+
+src_prepare() {
+ [[ -n ${RPM} ]] && rpm_spec_epatch "${WORKDIR}"/gdb.spec
+ ! use vanilla && [[ -n ${PATCH_VER} ]] && EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/patch
+ epatch_user
+ strip-linguas -u bfd/po opcodes/po
+}
+
+gdb_branding() {
+ printf "Gentoo ${PV} "
+ if ! use vanilla && [[ -n ${PATCH_VER} ]] ; then
+ printf "p${PATCH_VER}"
+ else
+ printf "vanilla"
+ fi
+ [[ -n ${EGIT_COMMIT} ]] && printf " ${EGIT_COMMIT}"
+}
+
+src_configure() {
+ strip-unsupported-flags
+
+ local myconf=(
+ --with-pkgversion="$(gdb_branding)"
+ --with-bugurl='http://bugs.gentoo.org/'
+ --disable-werror
+ # Disable modules that are in a combined binutils/gdb tree. #490566
+ --disable-{binutils,etc,gas,gold,gprof,ld}
+ )
+ local sysroot="${EPREFIX}/usr/${CTARGET}"
+ is_cross && myconf+=(
+ --with-sysroot="${sysroot}"
+ --includedir="${sysroot}/usr/include"
+ --with-gdb-datadir="\${datadir}/gdb/${CTARGET}"
+ )
+
+ if use server && ! use client ; then
+ # just configure+build in the gdbserver subdir to speed things up
+ cd gdb/gdbserver
+ myconf+=( --program-transform-name='' )
+ else
+ # gdbserver only works for native targets (CHOST==CTARGET).
+ # it also doesn't support all targets, so rather than duplicate
+ # the target list (which changes between versions), use the
+ # "auto" value when things are turned on.
+ is_cross \
+ && myconf+=( --disable-gdbserver ) \
+ || myconf+=( $(use_enable server gdbserver auto) )
+ fi
+
+ if ! ( use server && ! use client ) ; then
+ # if we are configuring in the top level, then use all
+ # the additional global options
+ myconf+=(
+ --enable-64-bit-bfd
+ --disable-install-libbfd
+ --disable-install-libiberty
+ # This only disables building in the readline subdir.
+ # For gdb itself, it'll use the system version.
+ --disable-readline
+ --with-system-readline
+ --with-separate-debug-dir="${EPREFIX}"/usr/lib/debug
+ $(use_with expat)
+ $(use_with lzma)
+ $(use_enable nls)
+ $(use multitarget && echo --enable-targets=all)
+ $(use_with python python "${EPYTHON}")
+ $(use_with zlib)
+ )
+ fi
+
+ econf "${myconf[@]}"
+}
+
+src_test() {
+ nonfatal emake check || ewarn "tests failed"
+}
+
+src_install() {
+ use server && ! use client && cd gdb/gdbserver
+ default
+ use client && find "${ED}"/usr -name libiberty.a -delete
+ cd "${S}"
+
+ # Don't install docs when building a cross-gdb
+ if [[ ${CTARGET} != ${CHOST} ]] ; then
+ rm -r "${ED}"/usr/share/{doc,info,locale}
+ local f
+ for f in "${ED}"/usr/share/man/*/* ; do
+ if [[ ${f##*/} != ${CTARGET}-* ]] ; then
+ mv "${f}" "${f%/*}/${CTARGET}-${f##*/}" || die
+ fi
+ done
+ return 0
+ fi
+ # Install it by hand for now:
+ # http://sourceware.org/ml/gdb-patches/2011-12/msg00915.html
+ # Only install if it exists due to the twisted behavior (see
+ # notes in src_configure above).
+ [[ -e gdb/gdbserver/gdbreplay ]] && dobin gdb/gdbserver/gdbreplay
+
+ if use client ; then
+ docinto gdb
+ dodoc gdb/CONTRIBUTE gdb/README gdb/MAINTAINERS \
+ gdb/NEWS gdb/ChangeLog gdb/PROBLEMS
+ fi
+ docinto sim
+ dodoc sim/{ChangeLog,MAINTAINERS,README-HACKING}
+ if use server ; then
+ docinto gdbserver
+ dodoc gdb/gdbserver/{ChangeLog,README}
+ fi
+
+ if [[ -n ${PATCH_VER} ]] ; then
+ dodoc "${WORKDIR}"/extra/gdbinit.sample
+ fi
+
+ # Remove shared info pages
+ rm -f "${ED}"/usr/share/info/{annotate,bfd,configure,standards}.info*
+}
+
+pkg_postinst() {
+ # portage sucks and doesnt unmerge files in /etc
+ rm -vf "${EROOT}"/etc/skel/.gdbinit
+
+ if use prefix && [[ ${CHOST} == *-darwin* ]] ; then
+ ewarn "gdb is unable to get a mach task port when installed by Prefix"
+ ewarn "Portage, unprivileged. To make gdb fully functional you'll"
+ ewarn "have to perform the following steps:"
+ ewarn " % sudo chgrp procmod ${EPREFIX}/usr/bin/gdb"
+ ewarn " % sudo chmod g+s ${EPREFIX}/usr/bin/gdb"
+ fi
+}
diff --git a/sys-devel/gdb/metadata.xml b/sys-devel/gdb/metadata.xml
new file mode 100644
index 000000000000..688bfcb910e8
--- /dev/null
+++ b/sys-devel/gdb/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='client'>Install the main "gdb" program (most people want this)</flag>
+ <flag name='lzma'>Support lzma compression in ELF debug info</flag>
+ <flag name='multitarget'>Support all known targets in one gdb binary</flag>
+ <flag name='python'>Enable support for the new internal scripting language, as well as extended pretty printers</flag>
+ <flag name='server'>Install the "gdbserver" program (useful for embedded/remote targets)</flag>
+</use>
+<upstream>
+ <remote-id type="cpe">cpe:/a:gnu:gdb</remote-id>
+</upstream>
+</pkgmetadata>
diff --git a/sys-devel/gettext/Manifest b/sys-devel/gettext/Manifest
new file mode 100644
index 000000000000..caeed8c20afd
--- /dev/null
+++ b/sys-devel/gettext/Manifest
@@ -0,0 +1,3 @@
+DIST gettext-0.19.4.tar.gz 17717034 SHA256 8ac9f1ed1a5f8c4e656a2f37f5ba6b9ee04c4df79a575e876b0b6946aa417f3f SHA512 274e00fe0149468e3073562f8f3b292597e9dbd82dfe8d068e4a1983914d25b603bb26f3fa4aa10e9fcd65826e3552c1871218342270927481e95eb64288ad97 WHIRLPOOL 2eb56c47d76f63b6557ae825538a35ae59f3f77da35321688547d9c420f47879c79ca1ab8ebd6bc6b4a3a8ce59ed620648884cd46455f6218213587f76967918
+DIST gettext-0.19.5.1.tar.gz 18353792 SHA256 a198d53b0c1fb11421ead197b7e76b144e887c9ef5a685323e92cbc950227731 SHA512 c2c1dc51d9c24c92b86619ec613b87266eae08a21280855e5b0d44c09e7efc8390341ded85dd85270c5a933ee21a6179373cc5cf275b6bc80cb510c7830d0ef4 WHIRLPOOL 2a2143edc4f3fdb37109aeb762072aa49f88045d55913ae282d203d5a7b3e848df5318c9e4f5e44f63a9f9a7c61c6018900df55b3bdfe06fa975a709322656d6
+DIST gettext-0.19.5.tar.gz 18352722 SHA256 1258814ba174e4783194be2dc93648bd630d4dda166eae034e4ad54489dcf73a SHA512 10b435bba4fcdcf15be3182b3c9756eef5b6ef6ec1416c1b12af35345fc1668c26dce81081e2616b7e2b0d174051fddd6fe6266e4709652a751a91fcf241e610 WHIRLPOOL 94db59cc7a1f3bf833e23a9c9aa25524c571b9585928d083438e7357d034236493584c0137f0c2bb58120f2e55f35055bc36731736162d9ad3e01aa6a1cf270e
diff --git a/sys-devel/gettext/gettext-0.19.4.ebuild b/sys-devel/gettext/gettext-0.19.4.ebuild
new file mode 100644
index 000000000000..f48d1f489cb9
--- /dev/null
+++ b/sys-devel/gettext/gettext-0.19.4.ebuild
@@ -0,0 +1,142 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit flag-o-matic eutils multilib toolchain-funcs mono-env libtool java-pkg-opt-2 multilib-minimal
+
+DESCRIPTION="GNU locale utilities"
+HOMEPAGE="http://www.gnu.org/software/gettext/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-3 LGPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE="acl -cvs doc emacs git java nls +cxx ncurses openmp static-libs elibc_glibc elibc_musl"
+
+# only runtime goes multilib
+DEPEND=">=virtual/libiconv-0-r1[${MULTILIB_USEDEP}]
+ dev-libs/libxml2
+ dev-libs/expat
+ acl? ( virtual/acl )
+ ncurses? ( sys-libs/ncurses )
+ java? ( >=virtual/jdk-1.4 )"
+RDEPEND="${DEPEND}
+ !git? ( cvs? ( dev-vcs/cvs ) )
+ git? ( dev-vcs/git )
+ java? ( >=virtual/jre-1.4 )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<=app-emulation/emul-linux-x86-baselibs-20131008-r11
+ )"
+PDEPEND="emacs? ( app-emacs/po-mode )"
+
+MULTILIB_WRAPPED_HEADERS=(
+ # only installed for native ABI
+ /usr/include/gettext-po.h
+)
+
+src_prepare() {
+ java-pkg-opt-2_src_prepare
+ epunt_cxx
+ elibtoolize
+}
+
+multilib_src_configure() {
+ local myconf=(
+ # switches common to runtime and top-level
+ --cache-file="${BUILD_DIR}"/config.cache
+ --docdir="/usr/share/doc/${PF}"
+
+ $(use_enable cxx libasprintf)
+ $(use_enable java)
+ $(use_enable static-libs static)
+ )
+
+ # Build with --without-included-gettext (on glibc systems)
+ if use elibc_glibc || use elibc_musl ; then
+ myconf+=(
+ --without-included-gettext
+ $(use_enable nls)
+ )
+ else
+ myconf+=(
+ --with-included-gettext
+ --enable-nls
+ )
+ fi
+ use cxx || export CXX=$(tc-getCC)
+
+ # Should be able to drop this hack in next release. #333887
+ tc-is-cross-compiler && export gl_cv_func_working_acl_get_file=yes
+
+ local ECONF_SOURCE=${S}
+ if ! multilib_is_native_abi ; then
+ # for non-native ABIs, we build runtime only
+ ECONF_SOURCE+=/gettext-runtime
+ else
+ # remaining switches
+ myconf+=(
+ # Emacs support is now in a separate package
+ --without-emacs
+ --without-lispdir
+ # glib depends on us so avoid circular deps
+ --with-included-glib
+ # libcroco depends on glib which ... ^^^
+ --with-included-libcroco
+ # this will _disable_ libunistring (since it is not bundled),
+ # see bug #326477
+ --with-included-libunistring
+
+ $(use_enable acl)
+ $(use_enable ncurses curses)
+ $(use_enable openmp)
+ $(use_with git)
+ $(usex git --without-cvs $(use_with cvs))
+ )
+ fi
+
+ econf "${myconf[@]}"
+}
+
+multilib_src_install() {
+ default
+
+ if multilib_is_native_abi ; then
+ dosym msgfmt /usr/bin/gmsgfmt #43435
+ dobin gettext-tools/misc/gettextize
+
+ [[ ${USERLAND} == "BSD" ]] && gen_usr_ldscript -a intl
+ fi
+}
+
+multilib_src_install_all() {
+ use nls || rm -r "${D}"/usr/share/locale
+ use static-libs || prune_libtool_files --all
+
+ rm -f "${D}"/usr/share/locale/locale.alias "${D}"/usr/lib/charset.alias
+
+ if use java ; then
+ java-pkg_dojar "${D}"/usr/share/${PN}/*.jar
+ rm -f "${D}"/usr/share/${PN}/*.jar
+ rm -f "${D}"/usr/share/${PN}/*.class
+ if use doc ; then
+ java-pkg_dojavadoc "${D}"/usr/share/doc/${PF}/javadoc2
+ rm -rf "${D}"/usr/share/doc/${PF}/javadoc2
+ fi
+ fi
+
+ if use doc ; then
+ dohtml "${D}"/usr/share/doc/${PF}/*.html
+ else
+ rm -rf "${D}"/usr/share/doc/${PF}/{csharpdoc,examples,javadoc2,javadoc1}
+ fi
+ rm -f "${D}"/usr/share/doc/${PF}/*.html
+
+ dodoc AUTHORS ChangeLog NEWS README THANKS
+}
+
+pkg_preinst() {
+ java-pkg-opt-2_pkg_preinst
+}
diff --git a/sys-devel/gettext/gettext-0.19.5.1.ebuild b/sys-devel/gettext/gettext-0.19.5.1.ebuild
new file mode 100644
index 000000000000..c54e8ddae8ad
--- /dev/null
+++ b/sys-devel/gettext/gettext-0.19.5.1.ebuild
@@ -0,0 +1,142 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit flag-o-matic eutils multilib toolchain-funcs mono-env libtool java-pkg-opt-2 multilib-minimal
+
+DESCRIPTION="GNU locale utilities"
+HOMEPAGE="http://www.gnu.org/software/gettext/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-3 LGPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE="acl -cvs doc emacs git java nls +cxx ncurses openmp static-libs elibc_glibc elibc_musl"
+
+# only runtime goes multilib
+DEPEND=">=virtual/libiconv-0-r1[${MULTILIB_USEDEP}]
+ dev-libs/libxml2
+ dev-libs/expat
+ acl? ( virtual/acl )
+ ncurses? ( sys-libs/ncurses )
+ java? ( >=virtual/jdk-1.4 )"
+RDEPEND="${DEPEND}
+ !git? ( cvs? ( dev-vcs/cvs ) )
+ git? ( dev-vcs/git )
+ java? ( >=virtual/jre-1.4 )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<=app-emulation/emul-linux-x86-baselibs-20131008-r11
+ )"
+PDEPEND="emacs? ( app-emacs/po-mode )"
+
+MULTILIB_WRAPPED_HEADERS=(
+ # only installed for native ABI
+ /usr/include/gettext-po.h
+)
+
+src_prepare() {
+ java-pkg-opt-2_src_prepare
+ epunt_cxx
+ elibtoolize
+}
+
+multilib_src_configure() {
+ local myconf=(
+ # switches common to runtime and top-level
+ --cache-file="${BUILD_DIR}"/config.cache
+ --docdir="/usr/share/doc/${PF}"
+
+ $(use_enable cxx libasprintf)
+ $(use_enable java)
+ $(use_enable static-libs static)
+ )
+
+ # Build with --without-included-gettext (on glibc systems)
+ if use elibc_glibc || use elibc_musl ; then
+ myconf+=(
+ --without-included-gettext
+ $(use_enable nls)
+ )
+ else
+ myconf+=(
+ --with-included-gettext
+ --enable-nls
+ )
+ fi
+ use cxx || export CXX=$(tc-getCC)
+
+ # Should be able to drop this hack in next release. #333887
+ tc-is-cross-compiler && export gl_cv_func_working_acl_get_file=yes
+
+ local ECONF_SOURCE=${S}
+ if ! multilib_is_native_abi ; then
+ # for non-native ABIs, we build runtime only
+ ECONF_SOURCE+=/gettext-runtime
+ else
+ # remaining switches
+ myconf+=(
+ # Emacs support is now in a separate package
+ --without-emacs
+ --without-lispdir
+ # glib depends on us so avoid circular deps
+ --with-included-glib
+ # libcroco depends on glib which ... ^^^
+ --with-included-libcroco
+ # this will _disable_ libunistring (since it is not bundled),
+ # see bug #326477
+ --with-included-libunistring
+
+ $(use_enable acl)
+ $(use_enable ncurses curses)
+ $(use_enable openmp)
+ $(use_with git)
+ $(usex git --without-cvs $(use_with cvs))
+ )
+ fi
+
+ econf "${myconf[@]}"
+}
+
+multilib_src_install() {
+ default
+
+ if multilib_is_native_abi ; then
+ dosym msgfmt /usr/bin/gmsgfmt #43435
+ dobin gettext-tools/misc/gettextize
+
+ [[ ${USERLAND} == "BSD" ]] && gen_usr_ldscript -a intl
+ fi
+}
+
+multilib_src_install_all() {
+ use nls || rm -r "${D}"/usr/share/locale
+ use static-libs || prune_libtool_files --all
+
+ rm -f "${D}"/usr/share/locale/locale.alias "${D}"/usr/lib/charset.alias
+
+ if use java ; then
+ java-pkg_dojar "${D}"/usr/share/${PN}/*.jar
+ rm -f "${D}"/usr/share/${PN}/*.jar
+ rm -f "${D}"/usr/share/${PN}/*.class
+ if use doc ; then
+ java-pkg_dojavadoc "${D}"/usr/share/doc/${PF}/javadoc2
+ rm -rf "${D}"/usr/share/doc/${PF}/javadoc2
+ fi
+ fi
+
+ if use doc ; then
+ dohtml "${D}"/usr/share/doc/${PF}/*.html
+ else
+ rm -rf "${D}"/usr/share/doc/${PF}/{csharpdoc,examples,javadoc2,javadoc1}
+ fi
+ rm -f "${D}"/usr/share/doc/${PF}/*.html
+
+ dodoc AUTHORS ChangeLog NEWS README THANKS
+}
+
+pkg_preinst() {
+ java-pkg-opt-2_pkg_preinst
+}
diff --git a/sys-devel/gettext/gettext-0.19.5.ebuild b/sys-devel/gettext/gettext-0.19.5.ebuild
new file mode 100644
index 000000000000..c54e8ddae8ad
--- /dev/null
+++ b/sys-devel/gettext/gettext-0.19.5.ebuild
@@ -0,0 +1,142 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit flag-o-matic eutils multilib toolchain-funcs mono-env libtool java-pkg-opt-2 multilib-minimal
+
+DESCRIPTION="GNU locale utilities"
+HOMEPAGE="http://www.gnu.org/software/gettext/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-3 LGPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE="acl -cvs doc emacs git java nls +cxx ncurses openmp static-libs elibc_glibc elibc_musl"
+
+# only runtime goes multilib
+DEPEND=">=virtual/libiconv-0-r1[${MULTILIB_USEDEP}]
+ dev-libs/libxml2
+ dev-libs/expat
+ acl? ( virtual/acl )
+ ncurses? ( sys-libs/ncurses )
+ java? ( >=virtual/jdk-1.4 )"
+RDEPEND="${DEPEND}
+ !git? ( cvs? ( dev-vcs/cvs ) )
+ git? ( dev-vcs/git )
+ java? ( >=virtual/jre-1.4 )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<=app-emulation/emul-linux-x86-baselibs-20131008-r11
+ )"
+PDEPEND="emacs? ( app-emacs/po-mode )"
+
+MULTILIB_WRAPPED_HEADERS=(
+ # only installed for native ABI
+ /usr/include/gettext-po.h
+)
+
+src_prepare() {
+ java-pkg-opt-2_src_prepare
+ epunt_cxx
+ elibtoolize
+}
+
+multilib_src_configure() {
+ local myconf=(
+ # switches common to runtime and top-level
+ --cache-file="${BUILD_DIR}"/config.cache
+ --docdir="/usr/share/doc/${PF}"
+
+ $(use_enable cxx libasprintf)
+ $(use_enable java)
+ $(use_enable static-libs static)
+ )
+
+ # Build with --without-included-gettext (on glibc systems)
+ if use elibc_glibc || use elibc_musl ; then
+ myconf+=(
+ --without-included-gettext
+ $(use_enable nls)
+ )
+ else
+ myconf+=(
+ --with-included-gettext
+ --enable-nls
+ )
+ fi
+ use cxx || export CXX=$(tc-getCC)
+
+ # Should be able to drop this hack in next release. #333887
+ tc-is-cross-compiler && export gl_cv_func_working_acl_get_file=yes
+
+ local ECONF_SOURCE=${S}
+ if ! multilib_is_native_abi ; then
+ # for non-native ABIs, we build runtime only
+ ECONF_SOURCE+=/gettext-runtime
+ else
+ # remaining switches
+ myconf+=(
+ # Emacs support is now in a separate package
+ --without-emacs
+ --without-lispdir
+ # glib depends on us so avoid circular deps
+ --with-included-glib
+ # libcroco depends on glib which ... ^^^
+ --with-included-libcroco
+ # this will _disable_ libunistring (since it is not bundled),
+ # see bug #326477
+ --with-included-libunistring
+
+ $(use_enable acl)
+ $(use_enable ncurses curses)
+ $(use_enable openmp)
+ $(use_with git)
+ $(usex git --without-cvs $(use_with cvs))
+ )
+ fi
+
+ econf "${myconf[@]}"
+}
+
+multilib_src_install() {
+ default
+
+ if multilib_is_native_abi ; then
+ dosym msgfmt /usr/bin/gmsgfmt #43435
+ dobin gettext-tools/misc/gettextize
+
+ [[ ${USERLAND} == "BSD" ]] && gen_usr_ldscript -a intl
+ fi
+}
+
+multilib_src_install_all() {
+ use nls || rm -r "${D}"/usr/share/locale
+ use static-libs || prune_libtool_files --all
+
+ rm -f "${D}"/usr/share/locale/locale.alias "${D}"/usr/lib/charset.alias
+
+ if use java ; then
+ java-pkg_dojar "${D}"/usr/share/${PN}/*.jar
+ rm -f "${D}"/usr/share/${PN}/*.jar
+ rm -f "${D}"/usr/share/${PN}/*.class
+ if use doc ; then
+ java-pkg_dojavadoc "${D}"/usr/share/doc/${PF}/javadoc2
+ rm -rf "${D}"/usr/share/doc/${PF}/javadoc2
+ fi
+ fi
+
+ if use doc ; then
+ dohtml "${D}"/usr/share/doc/${PF}/*.html
+ else
+ rm -rf "${D}"/usr/share/doc/${PF}/{csharpdoc,examples,javadoc2,javadoc1}
+ fi
+ rm -f "${D}"/usr/share/doc/${PF}/*.html
+
+ dodoc AUTHORS ChangeLog NEWS README THANKS
+}
+
+pkg_preinst() {
+ java-pkg-opt-2_pkg_preinst
+}
diff --git a/sys-devel/gettext/metadata.xml b/sys-devel/gettext/metadata.xml
new file mode 100644
index 000000000000..757fc753a66a
--- /dev/null
+++ b/sys-devel/gettext/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="cvs">When running `autopoint`, use cvs to store the internal development files;
+ this requires cvs at runtime, but will be faster/smaller than raw archives</flag>
+ <flag name="git">When running `autopoint`, use git to store the internal development files;
+ this requires git at runtime, but will be faster/smaller than raw archives</flag>
+</use>
+</pkgmetadata>
diff --git a/sys-devel/gnuconfig/Manifest b/sys-devel/gnuconfig/Manifest
new file mode 100644
index 000000000000..772c0b92f6ff
--- /dev/null
+++ b/sys-devel/gnuconfig/Manifest
@@ -0,0 +1,7 @@
+DIST gnuconfig-20130516.tar.bz2 51563 SHA256 8af7190bbb63e8abd5e255e71bbff73b245c034325d10d67a2d3966a947c109f SHA512 bfb6c2eb2fb786bb3824c1ade93e1451a24ac0f6b9918c3c15c1d15de826f6e2d0fca49a6ebe64c5de82ff5b99b564dc09c13b0aafde2ae801431dfcf8ffaf22 WHIRLPOOL 83add41d228022e7caa37b12a87d4075ab45cb0ab50685889e24968ef604fa9eb2f7a996196ea160ae46b7a684498be2a722e532162deaf7529b8fda0d93edc8
+DIST gnuconfig-20131128.tar.bz2 45245 SHA256 69027e90f35296473da1bb9bb6ad2c013d0a05af4c4b4416d10ad135d092fce2 SHA512 67ec289b0f2e09c6a97c2141734f906db3d589aaabfa7cccb73720145a53c6a0a3ea26b143b236df43594392196b56429deab926e188cae74267fde71edb3986 WHIRLPOOL c36da74b8b0c96f6c698d2c5b67f0563d0ae653bfbe788371bea57a5adf7d21c147bb89f79ad69b007eb9bee6ceb0ee265cd898fe6c79c15740459250953f9aa
+DIST gnuconfig-20140212.tar.bz2 44808 SHA256 57fd592676c549d4e4772273ec35b0cfe73b6b4b26b63c0a69260895a4e673ec SHA512 5c3b49733aa96a9418420d4232c01c02179cde4150104dee10713b963345e57feda3ba69b40016685370fd0d0d092f57c86a4b1ef0480b6403054666505d56ce WHIRLPOOL f09ac7cc01931ff7fda26ed56692bb0e6ba0a53096593fa90c95c0fdb98f2defb17a88cf72a18da5c5ae47842e866c23a83114a1c7043f3cdb9a2ccff06ebcfb
+DIST gnuconfig-20140728.tar.bz2 45239 SHA256 a597514a41df7299a070948c9e6a7e14c03a356b14b4719b25be7d8f93debb3a SHA512 7f6c68de16a1f82430cf68d55a8cf5ef8e5d4dd546221c4674112683e5c1fd7525623c8164bbca5f07911eb778b298e1391dd5438fdcab7dc155b5f55fab7e7d WHIRLPOOL d61a162f4c621833c10470254c4fb7acb4f74692e3657835f9d73a63c62df383c0d51e822ed65d9feee9ea887632e4c2d43551c124adf44e1615804ee184928c
+DIST gnuconfig-20150304.tar.bz2 46130 SHA256 6308cdb0aad50e24ab8afd39552582acb41ea8e45b0b0389b3b649b82640b7dd SHA512 937697dea538ba30dde6b3f1fa56963e0233d57418c86572ff4e25faf4ec0288cc1dbd96d05392bc317d70f99b9bc6965cf56263fd698035d2df99f4d9da597b WHIRLPOOL 4854791a0d43237fbd0274c118a7297d096af034f85a881aa7c6096f31093c32967b1051d7a04aa7d635817afc0c87208872a6d207d2d9e3a7e8cff6b6a27787
+DIST gnuconfig-20150308.tar.bz2 46295 SHA256 83b68fc5e3627f0f590dddbd7a2937d078be3daa5803fadebc8f9b5dd375536c SHA512 e09741289a92f68a88f8516622760ce627776e3484f740574ad84ba9e7ef2780abf237c85dc04bc731e7e4ccf9b301a880ef19947867d5618f7c95a1ec50c804 WHIRLPOOL 6b9b9d55c9c16d2613004042e1a20061b9df56542a842a3ff79b84682b4aeb8e7df496e77869ebfe26f3bc25eb1cf547840b997a3febc84ee68a221798ed3d0a
+DIST gnuconfig-20150727.tar.bz2 46599 SHA256 38b0fc0467ebdede37ebe895aeb8bd8544755c6872ef034624d5fa53668aa215 SHA512 b183e4552ebed029a41be04cf08ad80f67e0a687a73a236cc581dcb35f68bfdbad5a4553cf232b8f9422f6b50dd4ecaa1bbfc60e79db7a492e8fee51479f7361 WHIRLPOOL d60c1645e42220dda60b5112c6e35400139db8083fb888a0bc00470381da8ebd37feea4e491991f92ce51de421073f79bd0ce0f30128362f2517afe39a47d843
diff --git a/sys-devel/gnuconfig/files/99999999/0002-Add-x32-support-to-config.guess.patch b/sys-devel/gnuconfig/files/99999999/0002-Add-x32-support-to-config.guess.patch
new file mode 100644
index 000000000000..2c69f57878eb
--- /dev/null
+++ b/sys-devel/gnuconfig/files/99999999/0002-Add-x32-support-to-config.guess.patch
@@ -0,0 +1,44 @@
+From 8474d78c459f4ec8f8930094faeaacb2b77bf68f Mon Sep 17 00:00:00 2001
+From: "H.J. Lu" <hongjiu.lu@intel.com>
+Date: Fri, 20 Dec 2013 14:36:01 -0500
+Subject: [PATCH] Add x32 support to config.guess
+
+GCC on Linux/x86-64 may be configured for x32:
+
+https://sites.google.com/site/x32abi/
+
+by default and the Linux/x32 target should be x86_64-VENDOR-linux-gnux32.
+This patch adds x32 support to config.guess. OK to install?
+
+URL: http://gcc.gnu.org/ml/gcc-patches/2012-08/msg01083.html
+---
+ config.guess | 13 ++++++++++++-
+ 1 file changed, 12 insertions(+), 1 deletion(-)
+
+diff --git a/config.guess b/config.guess
+index fddac42..17a4f70 100755
+--- a/config.guess
++++ b/config.guess
+@@ -1038,7 +1038,18 @@ EOF
+ echo ${UNAME_MACHINE}-dec-linux-${LIBC}
+ exit ;;
+ x86_64:Linux:*:*)
+- echo ${UNAME_MACHINE}-pc-linux-${LIBC}
++ eval $set_cc_for_build
++ X86_64_ABI=
++ # If there is a compiler, see if it is configured for 32-bit objects.
++ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
++ if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
++ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
++ grep IS_X32 >/dev/null
++ then
++ X86_64_ABI=x32
++ fi
++ fi
++ echo ${UNAME_MACHINE}-pc-linux-${LIBC}${X86_64_ABI}
+ exit ;;
+ xtensa*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+--
+2.4.4
+
diff --git a/sys-devel/gnuconfig/files/99999999/0002-add-ps2-targets-to-config.sub.patch b/sys-devel/gnuconfig/files/99999999/0002-add-ps2-targets-to-config.sub.patch
new file mode 100644
index 000000000000..88e43cd8ac2b
--- /dev/null
+++ b/sys-devel/gnuconfig/files/99999999/0002-add-ps2-targets-to-config.sub.patch
@@ -0,0 +1,59 @@
+From 582f9caf95b3ccf36e6248be3b5b414546b0a03e Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Thu, 9 Oct 2008 15:51:35 -0400
+Subject: [PATCH] add ps2 targets to config.sub
+
+---
+ config.sub | 22 ++++++++++++++++++++--
+ 1 file changed, 20 insertions(+), 2 deletions(-)
+
+diff --git a/config.sub b/config.sub
+index 88307c1..7ee2b4c 100755
+--- a/config.sub
++++ b/config.sub
+@@ -258,7 +258,7 @@ case $basic_machine in
+ | be32 | be64 \
+ | bfin \
+ | c4x | c8051 | clipper \
+- | d10v | d30v | dlx | dsp16xx \
++ | d10v | d30v | dlx | dsp16xx | dvp \
+ | e2k | epiphany \
+ | fido | fr30 | frv | ft32 \
+ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+@@ -823,6 +823,24 @@ case $basic_machine in
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
++ mipsEE* | ee | ps2)
++ basic_machine=mips64r5900el-scei
++ case $os in
++ -linux*)
++ ;;
++ *)
++ os=-elf
++ ;;
++ esac
++ ;;
++ iop)
++ basic_machine=mipsel-scei
++ os=-irx
++ ;;
++ dvp)
++ basic_machine=dvp-scei
++ os=-elf
++ ;;
+ mips3*-*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ ;;
+@@ -1389,7 +1407,7 @@ case $os in
+ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
+ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+- | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
++ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -irx* \
+ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+--
+2.3.1
+
diff --git a/sys-devel/gnuconfig/gnuconfig-20130516.ebuild b/sys-devel/gnuconfig/gnuconfig-20130516.ebuild
new file mode 100644
index 000000000000..29eda87863be
--- /dev/null
+++ b/sys-devel/gnuconfig/gnuconfig-20130516.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="2"
+
+inherit eutils
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://git.savannah.gnu.org/config.git
+ http://git.savannah.gnu.org/r/config.git"
+
+ inherit git-2
+else
+ SRC_URI="mirror://gentoo/${P}.tar.bz2"
+ KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~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"
+fi
+
+DESCRIPTION="Updated config.sub and config.guess file from GNU"
+HOMEPAGE="http://savannah.gnu.org/projects/config"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+S=${WORKDIR}
+
+maint_pkg_create() {
+ cd "${S}"
+
+ local ver=$(gawk '{ gsub(/-/, "", $1); print $1; exit }' ChangeLog)
+ [[ ${#ver} != 8 ]] && die "invalid version '${ver}'"
+
+ cp "${FILESDIR}"/${PV}/*.patch . || die
+
+ local tar="${T}/gnuconfig-${ver}.tar.bz2"
+ tar -jcf ${tar} . || die "creating tar failed"
+ einfo "Packaged tar now available:"
+ einfo "$(du -b ${tar})"
+}
+
+src_unpack() {
+ if [[ ${PV} == "99999999" ]] ; then
+ git-2_src_unpack
+ maint_pkg_create
+ else
+ unpack ${A}
+ fi
+}
+
+src_prepare() {
+ epatch "${WORKDIR}"/*.patch
+ use elibc_uclibc && sed -i 's:linux-gnu:linux-uclibc:' testsuite/config-guess.data #180637
+}
+
+src_compile() { :;}
+
+src_test() {
+ emake check
+}
+
+src_install() {
+ insinto /usr/share/${PN}
+ doins config.{sub,guess} || die
+ fperms +x /usr/share/${PN}/config.{sub,guess}
+ dodoc ChangeLog
+}
diff --git a/sys-devel/gnuconfig/gnuconfig-20131128.ebuild b/sys-devel/gnuconfig/gnuconfig-20131128.ebuild
new file mode 100644
index 000000000000..722cf7046a78
--- /dev/null
+++ b/sys-devel/gnuconfig/gnuconfig-20131128.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="2"
+
+inherit eutils
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://git.savannah.gnu.org/config.git
+ http://git.savannah.gnu.org/r/config.git"
+
+ inherit git-2
+else
+ SRC_URI="mirror://gentoo/${P}.tar.bz2"
+ KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+fi
+
+DESCRIPTION="Updated config.sub and config.guess file from GNU"
+HOMEPAGE="http://savannah.gnu.org/projects/config"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+S=${WORKDIR}
+
+maint_pkg_create() {
+ cd "${S}"
+
+ local ver=$(gawk '{ gsub(/-/, "", $1); print $1; exit }' ChangeLog)
+ [[ ${#ver} != 8 ]] && die "invalid version '${ver}'"
+
+ cp "${FILESDIR}"/${PV}/*.patch . || die
+
+ local tar="${T}/gnuconfig-${ver}.tar.bz2"
+ tar -jcf ${tar} ./* || die "creating tar failed"
+ einfo "Packaged tar now available:"
+ einfo "$(du -b ${tar})"
+}
+
+src_unpack() {
+ if [[ ${PV} == "99999999" ]] ; then
+ git-2_src_unpack
+ maint_pkg_create
+ else
+ unpack ${A}
+ fi
+}
+
+src_prepare() {
+ epatch "${WORKDIR}"/*.patch
+ use elibc_uclibc && sed -i 's:linux-gnu:linux-uclibc:' testsuite/config-guess.data #180637
+}
+
+src_compile() { :;}
+
+src_test() {
+ emake check
+}
+
+src_install() {
+ insinto /usr/share/${PN}
+ doins config.{sub,guess} || die
+ fperms +x /usr/share/${PN}/config.{sub,guess}
+ dodoc ChangeLog
+}
diff --git a/sys-devel/gnuconfig/gnuconfig-20140212.ebuild b/sys-devel/gnuconfig/gnuconfig-20140212.ebuild
new file mode 100644
index 000000000000..722cf7046a78
--- /dev/null
+++ b/sys-devel/gnuconfig/gnuconfig-20140212.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="2"
+
+inherit eutils
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://git.savannah.gnu.org/config.git
+ http://git.savannah.gnu.org/r/config.git"
+
+ inherit git-2
+else
+ SRC_URI="mirror://gentoo/${P}.tar.bz2"
+ KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+fi
+
+DESCRIPTION="Updated config.sub and config.guess file from GNU"
+HOMEPAGE="http://savannah.gnu.org/projects/config"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+S=${WORKDIR}
+
+maint_pkg_create() {
+ cd "${S}"
+
+ local ver=$(gawk '{ gsub(/-/, "", $1); print $1; exit }' ChangeLog)
+ [[ ${#ver} != 8 ]] && die "invalid version '${ver}'"
+
+ cp "${FILESDIR}"/${PV}/*.patch . || die
+
+ local tar="${T}/gnuconfig-${ver}.tar.bz2"
+ tar -jcf ${tar} ./* || die "creating tar failed"
+ einfo "Packaged tar now available:"
+ einfo "$(du -b ${tar})"
+}
+
+src_unpack() {
+ if [[ ${PV} == "99999999" ]] ; then
+ git-2_src_unpack
+ maint_pkg_create
+ else
+ unpack ${A}
+ fi
+}
+
+src_prepare() {
+ epatch "${WORKDIR}"/*.patch
+ use elibc_uclibc && sed -i 's:linux-gnu:linux-uclibc:' testsuite/config-guess.data #180637
+}
+
+src_compile() { :;}
+
+src_test() {
+ emake check
+}
+
+src_install() {
+ insinto /usr/share/${PN}
+ doins config.{sub,guess} || die
+ fperms +x /usr/share/${PN}/config.{sub,guess}
+ dodoc ChangeLog
+}
diff --git a/sys-devel/gnuconfig/gnuconfig-20140728.ebuild b/sys-devel/gnuconfig/gnuconfig-20140728.ebuild
new file mode 100644
index 000000000000..77131df9ed10
--- /dev/null
+++ b/sys-devel/gnuconfig/gnuconfig-20140728.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="2"
+
+inherit eutils
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://git.savannah.gnu.org/config.git
+ http://git.savannah.gnu.org/r/config.git"
+
+ inherit git-2
+else
+ SRC_URI="mirror://gentoo/${P}.tar.bz2"
+ KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+fi
+
+DESCRIPTION="Updated config.sub and config.guess file from GNU"
+HOMEPAGE="http://savannah.gnu.org/projects/config"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+S=${WORKDIR}
+
+maint_pkg_create() {
+ cd "${S}"
+
+ local ver=$(gawk '{ gsub(/-/, "", $1); print $1; exit }' ChangeLog)
+ [[ ${#ver} != 8 ]] && die "invalid version '${ver}'"
+
+ cp "${FILESDIR}"/${PV}/*.patch . || die
+
+ local tar="${T}/gnuconfig-${ver}.tar.bz2"
+ tar -jcf ${tar} ./* || die "creating tar failed"
+ einfo "Packaged tar now available:"
+ einfo "$(du -b ${tar})"
+}
+
+src_unpack() {
+ if [[ ${PV} == "99999999" ]] ; then
+ git-2_src_unpack
+ maint_pkg_create
+ else
+ unpack ${A}
+ fi
+}
+
+src_prepare() {
+ epatch "${WORKDIR}"/*.patch
+ use elibc_uclibc && sed -i 's:linux-gnu:linux-uclibc:' testsuite/config-guess.data #180637
+}
+
+src_compile() { :;}
+
+src_test() {
+ emake check
+}
+
+src_install() {
+ insinto /usr/share/${PN}
+ doins config.{sub,guess} || die
+ fperms +x /usr/share/${PN}/config.{sub,guess}
+ dodoc ChangeLog
+}
diff --git a/sys-devel/gnuconfig/gnuconfig-20150304.ebuild b/sys-devel/gnuconfig/gnuconfig-20150304.ebuild
new file mode 100644
index 000000000000..77131df9ed10
--- /dev/null
+++ b/sys-devel/gnuconfig/gnuconfig-20150304.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="2"
+
+inherit eutils
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://git.savannah.gnu.org/config.git
+ http://git.savannah.gnu.org/r/config.git"
+
+ inherit git-2
+else
+ SRC_URI="mirror://gentoo/${P}.tar.bz2"
+ KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+fi
+
+DESCRIPTION="Updated config.sub and config.guess file from GNU"
+HOMEPAGE="http://savannah.gnu.org/projects/config"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+S=${WORKDIR}
+
+maint_pkg_create() {
+ cd "${S}"
+
+ local ver=$(gawk '{ gsub(/-/, "", $1); print $1; exit }' ChangeLog)
+ [[ ${#ver} != 8 ]] && die "invalid version '${ver}'"
+
+ cp "${FILESDIR}"/${PV}/*.patch . || die
+
+ local tar="${T}/gnuconfig-${ver}.tar.bz2"
+ tar -jcf ${tar} ./* || die "creating tar failed"
+ einfo "Packaged tar now available:"
+ einfo "$(du -b ${tar})"
+}
+
+src_unpack() {
+ if [[ ${PV} == "99999999" ]] ; then
+ git-2_src_unpack
+ maint_pkg_create
+ else
+ unpack ${A}
+ fi
+}
+
+src_prepare() {
+ epatch "${WORKDIR}"/*.patch
+ use elibc_uclibc && sed -i 's:linux-gnu:linux-uclibc:' testsuite/config-guess.data #180637
+}
+
+src_compile() { :;}
+
+src_test() {
+ emake check
+}
+
+src_install() {
+ insinto /usr/share/${PN}
+ doins config.{sub,guess} || die
+ fperms +x /usr/share/${PN}/config.{sub,guess}
+ dodoc ChangeLog
+}
diff --git a/sys-devel/gnuconfig/gnuconfig-20150308.ebuild b/sys-devel/gnuconfig/gnuconfig-20150308.ebuild
new file mode 100644
index 000000000000..77131df9ed10
--- /dev/null
+++ b/sys-devel/gnuconfig/gnuconfig-20150308.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="2"
+
+inherit eutils
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://git.savannah.gnu.org/config.git
+ http://git.savannah.gnu.org/r/config.git"
+
+ inherit git-2
+else
+ SRC_URI="mirror://gentoo/${P}.tar.bz2"
+ KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+fi
+
+DESCRIPTION="Updated config.sub and config.guess file from GNU"
+HOMEPAGE="http://savannah.gnu.org/projects/config"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+S=${WORKDIR}
+
+maint_pkg_create() {
+ cd "${S}"
+
+ local ver=$(gawk '{ gsub(/-/, "", $1); print $1; exit }' ChangeLog)
+ [[ ${#ver} != 8 ]] && die "invalid version '${ver}'"
+
+ cp "${FILESDIR}"/${PV}/*.patch . || die
+
+ local tar="${T}/gnuconfig-${ver}.tar.bz2"
+ tar -jcf ${tar} ./* || die "creating tar failed"
+ einfo "Packaged tar now available:"
+ einfo "$(du -b ${tar})"
+}
+
+src_unpack() {
+ if [[ ${PV} == "99999999" ]] ; then
+ git-2_src_unpack
+ maint_pkg_create
+ else
+ unpack ${A}
+ fi
+}
+
+src_prepare() {
+ epatch "${WORKDIR}"/*.patch
+ use elibc_uclibc && sed -i 's:linux-gnu:linux-uclibc:' testsuite/config-guess.data #180637
+}
+
+src_compile() { :;}
+
+src_test() {
+ emake check
+}
+
+src_install() {
+ insinto /usr/share/${PN}
+ doins config.{sub,guess} || die
+ fperms +x /usr/share/${PN}/config.{sub,guess}
+ dodoc ChangeLog
+}
diff --git a/sys-devel/gnuconfig/gnuconfig-20150727.ebuild b/sys-devel/gnuconfig/gnuconfig-20150727.ebuild
new file mode 100644
index 000000000000..4a8bb5d152d0
--- /dev/null
+++ b/sys-devel/gnuconfig/gnuconfig-20150727.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://git.savannah.gnu.org/config.git
+ http://git.savannah.gnu.org/r/config.git"
+
+ inherit git-2
+else
+ SRC_URI="mirror://gentoo/${P}.tar.bz2"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+fi
+
+DESCRIPTION="Updated config.sub and config.guess file from GNU"
+HOMEPAGE="http://savannah.gnu.org/projects/config"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+S=${WORKDIR}
+
+maint_pkg_create() {
+ cd "${S}"
+
+ local ver=$(gawk '{ gsub(/-/, "", $1); print $1; exit }' ChangeLog)
+ [[ ${#ver} != 8 ]] && die "invalid version '${ver}'"
+
+ cp "${FILESDIR}"/${PV}/*.patch . || die
+
+ local tar="${T}/gnuconfig-${ver}.tar.bz2"
+ tar -jcf ${tar} ./* || die "creating tar failed"
+ einfo "Packaged tar now available:"
+ einfo "$(du -b ${tar})"
+}
+
+src_unpack() {
+ if [[ ${PV} == "99999999" ]] ; then
+ git-2_src_unpack
+ maint_pkg_create
+ else
+ unpack ${A}
+ fi
+}
+
+src_prepare() {
+ epatch "${WORKDIR}"/*.patch
+ use elibc_uclibc && sed -i 's:linux-gnu:linux-uclibc:' testsuite/config-guess.data #180637
+}
+
+src_compile() { :;}
+
+src_test() {
+ emake check
+}
+
+src_install() {
+ insinto /usr/share/${PN}
+ doins config.{sub,guess} || die
+ fperms +x /usr/share/${PN}/config.{sub,guess}
+ dodoc ChangeLog
+}
diff --git a/sys-devel/gnuconfig/gnuconfig-99999999.ebuild b/sys-devel/gnuconfig/gnuconfig-99999999.ebuild
new file mode 100644
index 000000000000..4a8bb5d152d0
--- /dev/null
+++ b/sys-devel/gnuconfig/gnuconfig-99999999.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="git://git.savannah.gnu.org/config.git
+ http://git.savannah.gnu.org/r/config.git"
+
+ inherit git-2
+else
+ SRC_URI="mirror://gentoo/${P}.tar.bz2"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+fi
+
+DESCRIPTION="Updated config.sub and config.guess file from GNU"
+HOMEPAGE="http://savannah.gnu.org/projects/config"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+S=${WORKDIR}
+
+maint_pkg_create() {
+ cd "${S}"
+
+ local ver=$(gawk '{ gsub(/-/, "", $1); print $1; exit }' ChangeLog)
+ [[ ${#ver} != 8 ]] && die "invalid version '${ver}'"
+
+ cp "${FILESDIR}"/${PV}/*.patch . || die
+
+ local tar="${T}/gnuconfig-${ver}.tar.bz2"
+ tar -jcf ${tar} ./* || die "creating tar failed"
+ einfo "Packaged tar now available:"
+ einfo "$(du -b ${tar})"
+}
+
+src_unpack() {
+ if [[ ${PV} == "99999999" ]] ; then
+ git-2_src_unpack
+ maint_pkg_create
+ else
+ unpack ${A}
+ fi
+}
+
+src_prepare() {
+ epatch "${WORKDIR}"/*.patch
+ use elibc_uclibc && sed -i 's:linux-gnu:linux-uclibc:' testsuite/config-guess.data #180637
+}
+
+src_compile() { :;}
+
+src_test() {
+ emake check
+}
+
+src_install() {
+ insinto /usr/share/${PN}
+ doins config.{sub,guess} || die
+ fperms +x /usr/share/${PN}/config.{sub,guess}
+ dodoc ChangeLog
+}
diff --git a/sys-devel/gnuconfig/metadata.xml b/sys-devel/gnuconfig/metadata.xml
new file mode 100644
index 000000000000..59c5b7bb0175
--- /dev/null
+++ b/sys-devel/gnuconfig/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>
+<longdescription>
+Updated config.{sub,guess} files from upstream cvs to properly detect various system types.
+</longdescription>
+</pkgmetadata>
diff --git a/sys-devel/heirloom-devtools/Manifest b/sys-devel/heirloom-devtools/Manifest
new file mode 100644
index 000000000000..815e76ee3c18
--- /dev/null
+++ b/sys-devel/heirloom-devtools/Manifest
@@ -0,0 +1 @@
+DIST heirloom-devtools-070527.tar.bz2 381054 SHA256 9f233d8b78e4351fe9dd2d50d83958a0e5af36f54e9818521458a08e058691ba SHA512 1f1f10a7b49402053172cc028bbd939a46fcf933994cb867fa40e8c5bbd7b1291575b3bac254cd79dc4fce3e3a2c88fe0f890449888fda16169c8e6a2540f055 WHIRLPOOL 145d36f42b180e480afe4bcefa0c59de44787ba9eef73782588834d8b15300b9ef12bde77b47eef992229fdfed8cef9da49b993f50023aa15262166bebe57104
diff --git a/sys-devel/heirloom-devtools/files/heirloom-devtools-070527-64-bit.patch b/sys-devel/heirloom-devtools/files/heirloom-devtools-070527-64-bit.patch
new file mode 100644
index 000000000000..d6c3cd7a5488
--- /dev/null
+++ b/sys-devel/heirloom-devtools/files/heirloom-devtools-070527-64-bit.patch
@@ -0,0 +1,39 @@
+--- a/make/vroot/lock.cc 2007/01/18 15:06:32 1.1
++++ b/make/vroot/lock.cc 2007/10/01 11:44:26 1.2
+@@ -31,7 +31,7 @@
+ /*
+ * Portions Copyright (c) 2007 Gunnar Ritter, Freiburg i. Br., Germany
+ *
+- * Sccsid @(#)lock.cc 1.4 (gritter) 01/13/07
++ * Sccsid @(#)lock.cc 1.5 (gritter) 10/1/07
+ */
+
+ #include <avo/intl.h> /* for NOCATGETS */
+@@ -53,7 +53,7 @@
+ extern int sys_nerr;
+ #endif
+
+-static void file_lock_error(char *msg, char *file, char *str, int arg1, int arg2);
++static void file_lock_error(char *msg, char *file, char *str, const char *arg1, const char *arg2);
+
+ #define BLOCK_INTERUPTS sigfillset(&newset) ; \
+ sigprocmask(SIG_SETMASK, &newset, &oldset)
+@@ -123,7 +123,7 @@
+
+ if (errno != EEXIST) {
+ file_lock_error(msg, name, NOCATGETS("symlink(%s, %s)"),
+- (int) name, (int) lockname);
++ name, lockname);
+ fprintf(stderr, "%s", msg);
+ return errno;
+ }
+@@ -171,7 +171,8 @@
+ * Format a message telling why the lock could not be created.
+ */
+ static void
+-file_lock_error(char *msg, char *file, char *str, int arg1, int arg2)
++file_lock_error(char *msg, char *file, char *str,
++ const char *arg1, const char *arg2)
+ {
+ int len;
+
diff --git a/sys-devel/heirloom-devtools/files/heirloom-devtools-070527-solaris.patch b/sys-devel/heirloom-devtools/files/heirloom-devtools-070527-solaris.patch
new file mode 100644
index 000000000000..c6b394208762
--- /dev/null
+++ b/sys-devel/heirloom-devtools/files/heirloom-devtools-070527-solaris.patch
@@ -0,0 +1,230 @@
+diff --git a/make/include/mksh/defs.h b/make/include/mksh/defs.h
+index 1992205..8065a77 100644
+--- a/make/include/mksh/defs.h
++++ b/make/include/mksh/defs.h
+@@ -63,7 +63,6 @@
+ #include <widec.h>
+ #endif
+
+-#ifndef __sun
+ /*
+ * Definition of wchar functions.
+ */
+@@ -90,7 +89,6 @@
+ # define wscmp(x,y) wcscmp(x,y)
+ # undef wsncmp
+ # define wsncmp(x,y,z) wcsncmp(x,y,z)
+-#endif
+
+ #if defined (__FreeBSD__) || defined (__APPLE__) || defined (__hpux)
+ extern "C" { wchar_t *wcsdup(const wchar_t *s); }
+diff --git a/make/makestate/lock.c b/make/makestate/lock.c
+index cdf7562..aa6083e 100644
+--- a/make/makestate/lock.c
++++ b/make/makestate/lock.c
+@@ -42,18 +42,6 @@
+ #include <sys/errno.h>
+ #include <errno.h> /* errno */
+
+-#if defined(_LP64)
+-/*
+- * The symbols _sys_errlist and _sys_nerr are not visible in the
+- * LP64 libc. Use strerror(3C) instead.
+- */
+-#else /* #_LP64 */
+-#if defined (__sun) || defined (__hpux)
+-extern char * sys_errlist[];
+-extern int sys_nerr;
+-#endif
+-#endif /* #_LP64 */
+-
+ static void file_lock_error(char *, char *, const char *, char *, char *);
+
+ /*
+@@ -167,16 +155,7 @@ file_lock_error(char * msg, char * file, const char * str, char * arg1,
+ len = strlen(msg);
+ sprintf(&msg[len], str, arg1, arg2);
+ strcat(msg, " failed - ");
+-#if defined(_LP64)
+ /* Needs to be changed to use strerror(3C) instead. */
+ len = strlen(msg);
+ sprintf(&msg[len], "errno %d", errno);
+-#else /* #_LP64 */
+- if (errno < sys_nerr) {
+- strcat(msg, sys_errlist[errno]);
+- } else {
+- len = strlen(msg);
+- sprintf(&msg[len], "errno %d", errno);
+- }
+-#endif /* #_LP64 */
+ }
+diff --git a/make/mksh/macro.cc b/make/mksh/macro.cc
+index 6ddb624..23b0315 100644
+--- a/make/mksh/macro.cc
++++ b/make/mksh/macro.cc
+@@ -43,6 +43,7 @@
+ /*
+ * Included files
+ */
++#include <alloca.h>
+ #include <wordexp.h>
+ #include <mksh/dosys.h> /* sh_command2string() */
+ #include <mksh/i18n.h> /* get_char_semantics_value() */
+@@ -1403,13 +1404,6 @@ found_it:;
+ new_value = ALLOC_WC(length);
+ new_value_allocated = true;
+ WCSTOMBS(mbs_buffer, old_vr);
+-#ifdef __sun
+- wsprintf(new_value,
+- NOCATGETS("/usr/arch/%s/%s:%s"),
+- ha->string_mb + 1,
+- ta->string_mb + 1,
+- mbs_buffer);
+-#else
+ char * mbs_new_value = (char *)getmem(length);
+ sprintf(mbs_new_value,
+ NOCATGETS("/usr/arch/%s/%s:%s"),
+@@ -1418,7 +1412,6 @@ found_it:;
+ mbs_buffer);
+ MBSTOWCS(new_value, mbs_new_value);
+ retmem_mb(mbs_new_value);
+-#endif
+ }
+ if (new_value[0] != 0) {
+ setvar_daemon(virtual_root,
+diff --git a/make/mksh/misc.cc b/make/mksh/misc.cc
+index 11122cf..d617591 100644
+--- a/make/mksh/misc.cc
++++ b/make/mksh/misc.cc
+@@ -382,30 +382,7 @@ setup_char_semantics(void)
+ char *
+ errmsg(int errnum)
+ {
+-#ifndef __sun
+ return strerror(errnum);
+-#else // __sun
+-
+- extern int sys_nerr;
+-#ifdef SUN4_x
+- extern char *sys_errlist[];
+-#endif
+- char *errbuf;
+-
+- if ((errnum < 0) || (errnum > sys_nerr)) {
+- errbuf = getmem(6+1+11+1);
+- sprintf(errbuf, "Error %d", errnum);
+- return errbuf;
+- } else {
+-#ifdef SUN4_x
+- return(sys_errlist[errnum]);
+-#endif
+-#ifdef SUN5_0
+- return strerror(errnum);
+-#endif
+-
+- }
+-#endif // !__sun
+ }
+
+ extern const char *progname;
+diff --git a/make/src/implicit.cc b/make/src/implicit.cc
+index 2d388cc..a1cee7e 100644
+--- a/make/src/implicit.cc
++++ b/make/src/implicit.cc
+@@ -43,10 +43,13 @@
+ /*
+ * Included files
+ */
++#include <cstdio>
+ #include <mk/defs.h>
+ #include <mksh/macro.h> /* expand_value() */
+ #include <mksh/misc.h> /* retmem() */
+
++using std::printf;
++
+ /*
+ * Defined macros
+ */
+@@ -97,8 +100,6 @@ extern void add_target_to_chain(Name target, Chain * query);
+ * recursion_level Used for tracing
+ */
+
+-extern int printf (const char *, ...);
+-
+ static Boolean actual_doname = false;
+
+ /* /tolik/
+diff --git a/make/src/nse_printdep.cc b/make/src/nse_printdep.cc
+index 6201a18..38826d2 100644
+--- a/make/src/nse_printdep.cc
++++ b/make/src/nse_printdep.cc
+@@ -37,9 +37,12 @@
+ /*
+ * Included files
+ */
++#include <cstdio>
+ #include <mk/defs.h>
+ #include <mksh/misc.h> /* get_prop() */
+
++using std::printf;
++
+ /*
+ * File table of contents
+ */
+@@ -59,7 +62,6 @@ static void print_rule(register Name target);
+ static void print_rec_info(Name target);
+ static Boolean is_out_of_date(Property line);
+ extern void depvar_print_results (void);
+-extern int printf (const char *, ...);
+ extern int _flsbuf (unsigned int, FILE *);
+
+ /*
+diff --git a/make/vroot/lock.cc b/make/vroot/lock.cc
+index 1d6239b..1a20bc0 100644
+--- a/make/vroot/lock.cc
++++ b/make/vroot/lock.cc
+@@ -48,11 +48,6 @@
+ #include <signal.h>
+ #include <errno.h> /* errno */
+
+-#if defined(sun) || defined(HP_UX)
+-extern char *sys_errlist[];
+-extern int sys_nerr;
+-#endif
+-
+ static void file_lock_error(char *msg, char *file, char *str, int arg1, int arg2);
+
+ #define BLOCK_INTERUPTS sigfillset(&newset) ; \
+@@ -179,20 +174,6 @@ file_lock_error(char *msg, char *file, char *str, int arg1, int arg2)
+ len = strlen(msg);
+ sprintf(&msg[len], str, arg1, arg2);
+ strcat(msg, " failed - ");
+-#ifdef __sun
+- if (errno < sys_nerr) {
+-#ifdef SUN4_x
+- strcat(msg, sys_errlist[errno]);
+-#endif
+-#ifdef SUN5_0
+- strcat(msg, strerror(errno));
+-#endif
+- } else {
+- len = strlen(msg);
+- sprintf(&msg[len], NOCATGETS("errno %d"), errno);
+- }
+-#else
+ strcat(msg, strerror(errno));
+-#endif
+ }
+
+diff --git a/sccs/src/vc.c b/sccs/src/vc.c
+index d7f7187..1c0ffb1 100644
+--- a/sccs/src/vc.c
++++ b/sccs/src/vc.c
+@@ -37,6 +37,7 @@
+ */
+ /* from OpenSolaris "sccs:cmd/vc.c" */
+ # include <defines.h>
++# include <limits.h>
+ # include <locale.h>
+
+
diff --git a/sys-devel/heirloom-devtools/heirloom-devtools-070527-r1.ebuild b/sys-devel/heirloom-devtools/heirloom-devtools-070527-r1.ebuild
new file mode 100644
index 000000000000..7dd30a9eaae2
--- /dev/null
+++ b/sys-devel/heirloom-devtools/heirloom-devtools-070527-r1.ebuild
@@ -0,0 +1,57 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit eutils flag-o-matic toolchain-funcs
+
+DESCRIPTION="Original UNIX development tools"
+HOMEPAGE="http://heirloom.sourceforge.net/devtools.html"
+SRC_URI="http://downloads.sourceforge.net/project/heirloom/${PN}/${PV}/${P}.tar.bz2"
+
+LICENSE="BSD BSD-4 CDDL"
+SLOT="0"
+KEYWORDS="~amd64 ~x64-solaris"
+IUSE=""
+
+DEPEND="app-shells/heirloom-sh"
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+
+ sed -i \
+ -e 's:^\(SHELL =\) \(.*\):\1 /bin/jsh:' \
+ -e 's:^\(POSIX_SHELL =\) \(.*\):\1 /bin/sh:' \
+ -e "s:^\(PREFIX=\)\(.*\):\1${EPREFIX}\2:" \
+ -e "s:^\(SUSBIN=\)\(.*\):\1${EPREFIX}\2:" \
+ -e "s:^\(LDFLAGS=\):\1${LDFLAGS}:" \
+ -e "s:^\(CFLAGS=\)\(.*\):\1${CFLAGS}:" \
+ -e 's:^\(STRIP=\)\(.*\):\1true:' \
+ -e "s:^\(CXX = \)\(.*\):\1$(tc-getCXX):" \
+ -e "s:^\(INSTALL=\)\(.*\):\1$(which install):" \
+ ./mk.config
+
+ echo "CC=$(tc-getCC)" >> "./mk.config"
+
+ epatch "${FILESDIR}/${P}-solaris.patch"
+ epatch "${FILESDIR}/${P}-64-bit.patch"
+
+ epatch_user
+
+}
+
+src_compile() {
+ emake -j1
+}
+
+src_install() {
+ emake ROOT="${D}" install
+}
+
+pkg_postinst() {
+ elog "You may want to add /usr/5bin or /usr/ucb to \$PATH"
+ elog "to enable using the apps of heirloom toolchest by default."
+ elog "Man pages are installed in /usr/share/man/5man/"
+ elog "You may need to set \$MANPATH to access them."
+}
diff --git a/sys-devel/heirloom-devtools/heirloom-devtools-999999.ebuild b/sys-devel/heirloom-devtools/heirloom-devtools-999999.ebuild
new file mode 100644
index 000000000000..ac8f3aeaaf84
--- /dev/null
+++ b/sys-devel/heirloom-devtools/heirloom-devtools-999999.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit cvs flag-o-matic toolchain-funcs
+
+ECVS_AUTH="pserver"
+ECVS_USER="anonymous"
+ECVS_SERVER="heirloom.cvs.sourceforge.net:/cvsroot/heirloom"
+ECVS_MODULE="heirloom-devtools"
+ECVS_PASS=""
+ECVS_CVS_OPTIONS="-dP"
+
+DESCRIPTION="Original UNIX development tools"
+HOMEPAGE="http://heirloom.sourceforge.net/devtools.html"
+SRC_URI=""
+
+LICENSE="BSD BSD-4 CDDL"
+SLOT="0"
+KEYWORDS=""
+IUSE=""
+
+DEPEND="app-shells/heirloom-sh"
+RDEPEND="${DEPEND}"
+
+S="${WORKDIR}/${PN}"
+
+src_prepare() {
+
+ sed -i \
+ -e 's:^\(SHELL =\) \(.*\):\1 /bin/jsh:' \
+ -e 's:^\(POSIX_SHELL =\) \(.*\):\1 /bin/sh:' \
+ -e "s:^\(PREFIX=\)\(.*\):\1${EPREFIX}\2:" \
+ -e "s:^\(SUSBIN=\)\(.*\):\1${EPREFIX}\2:" \
+ -e "s:^\(LDFLAGS=\):\1${LDFLAGS}:" \
+ -e "s:^\(CFLAGS=\)\(.*\):\1${CFLAGS}:" \
+ -e 's:^\(STRIP=\)\(.*\):\1true:' \
+ -e "s:^\(CXX = \)\(.*\):\1$(tc-getCXX):" \
+ -e "s:^\(INSTALL=\)\(.*\):\1$(which install):" \
+ ./mk.config
+
+ echo "CC=$(tc-getCC)" >> "./mk.config"
+
+}
+
+src_compile() {
+ emake -j1
+}
+
+src_install() {
+ emake ROOT="${D}" install
+}
+
+pkg_postinst() {
+ elog "You may want to add /usr/5bin or /usr/ucb to \$PATH"
+ elog "to enable using the apps of heirloom toolchest by default."
+ elog "Man pages are installed in /usr/share/man/5man/"
+ elog "You may need to set \$MANPATH to access them."
+}
diff --git a/sys-devel/heirloom-devtools/metadata.xml b/sys-devel/heirloom-devtools/metadata.xml
new file mode 100644
index 000000000000..e63e3c3865da
--- /dev/null
+++ b/sys-devel/heirloom-devtools/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>ryao@gentoo.org</email>
+ <name>Richard Yao</name>
+ </maintainer>
+</pkgmetadata>
diff --git a/sys-devel/icecream/Manifest b/sys-devel/icecream/Manifest
new file mode 100644
index 000000000000..485868f39b07
--- /dev/null
+++ b/sys-devel/icecream/Manifest
@@ -0,0 +1,2 @@
+DIST icecc-0.9.7.tar.bz2 379527 SHA256 ba01c19e946d5a142ad9f912c24086ee12e7ca4927d64860787eb4bcd100657f SHA512 023a77d6df33af9837a87218272dc61d68f3782ad59dc8783ec3ca47cbb38619dbcaa25ac7e6654c6cacbd79477c3403b0a73aca595c6fe20aa9a39268f4f2e2 WHIRLPOOL cf822cc6667ceda286b41c4fd172092f51d75cb2c5d1ca3db0dd32796580128808881f09053f209d7f9165ccecf9e97093925fca1ae54597b2a775485d82004f
+DIST icecc-1.0.0.tar.bz2 485534 SHA256 c2897fac52711b8442ec40403c874bc50a10184131bb7006529087dfe469c85c SHA512 4292ecef6232112c3f4531cb2290a55f70c5c24095fef0865af2526d49fc10a043ffb06d22552e161f671c18ff1ab62795c3a63e2c8cb26f869cf65d0938af2a WHIRLPOOL 3c6e79756bd290e03fbfcd5fd5e38dbb700e0a7b1206c2a608914123a9f317f1d9896332c79909754fda6fc9c515a29dba6b4c485a505d1ca0fde315c35cd3ce
diff --git a/sys-devel/icecream/files/0.9.6-crosscompile.patch b/sys-devel/icecream/files/0.9.6-crosscompile.patch
new file mode 100644
index 000000000000..990072bbb8fd
--- /dev/null
+++ b/sys-devel/icecream/files/0.9.6-crosscompile.patch
@@ -0,0 +1,12 @@
+diff -urN icecc-0.9.6.old//client/icecc-create-env icecc-0.9.6//client/icecc-create-env
+--- icecc-0.9.6.old//client/icecc-create-env 2010-09-18 12:10:08.143391700 +0200
++++ icecc-0.9.6//client/icecc-create-env 2010-09-18 12:10:46.574391700 +0200
+@@ -97,7 +97,7 @@
+
+ add_file $added_gcc /usr/bin/gcc
+ add_file $added_gxx /usr/bin/g++
+-add_file /usr/bin/as
++add_file `$added_gcc -print-prog-name=as` /usr/bin/as
+
+ if test "$is_darwin" = 1; then
+ # add dynamic linker
diff --git a/sys-devel/icecream/files/0.9.6-symlinks.patch b/sys-devel/icecream/files/0.9.6-symlinks.patch
new file mode 100644
index 000000000000..279ee0cc0f99
--- /dev/null
+++ b/sys-devel/icecream/files/0.9.6-symlinks.patch
@@ -0,0 +1,19 @@
+diff -urN icecc-0.9.6//client/Makefile.am icecc-0.9.6.new//client/Makefile.am
+--- icecc-0.9.6//client/Makefile.am 2010-09-11 13:43:53.922000148 +0200
++++ icecc-0.9.6.new//client/Makefile.am 2010-09-11 13:44:39.950000148 +0200
+@@ -7,15 +7,3 @@
+ noinst_HEADERS = client.h md5.h util.h
+
+ EXTRA_DIST = icecc-create-env
+-
+-install-exec-local:
+- $(mkinstalldirs) $(DESTDIR)$(bindir)
+- for link in g++ gcc c++ cc icerun; do \
+- rm -f $(DESTDIR)$(bindir)/$$link ;\
+- $(LN_S) icecc $(DESTDIR)$(bindir)/$$link ;\
+- done
+-
+-uninstall-local:
+- for link in g++ gcc c++ cc; do \
+- rm $(DESTDIR)$(bindir)/$$link ;\
+- done
diff --git a/sys-devel/icecream/files/0.9.7-automake.patch b/sys-devel/icecream/files/0.9.7-automake.patch
new file mode 100644
index 000000000000..6905a2a34158
--- /dev/null
+++ b/sys-devel/icecream/files/0.9.7-automake.patch
@@ -0,0 +1,32 @@
+Backport upstream patch to fix automake-1.12 issues
+
+https://bugs.gentoo.org/show_bug.cgi?id=397715
+https://bugs.gentoo.org/show_bug.cgi?id=399259
+--- client/Makefile.am
++++ client/Makefile.am
+@@ -1,10 +1,11 @@
+ INCLUDES = -I$(srcdir)/../services
+
+ bin_PROGRAMS = icecc
+-pkglib_SCRIPTS = icecc-create-env
++pkglibexec_SCRIPTS = icecc-create-env
+ icecc_SOURCES = main.cpp arg.cpp cpp.cpp local.cpp remote.cpp util.cpp md5.c safeguard.cpp
+ icecc_LDADD = ../services/libicecc.la $(LIBRSYNC)
+ noinst_HEADERS = client.h md5.h util.h
++AM_CPPFLAGS = -DPLIBDIR=\"$(pkglibexecdir)\"
+
+ EXTRA_DIST = icecc-create-env
+
+--- configure.in
++++ configure.in
+@@ -246,10 +246,6 @@
+ KDE_EXPAND_MAKEVAR(mybindir, bindir)
+ AC_DEFINE_UNQUOTED(BINDIR, "$mybindir", [Where to look for icecc])
+
+-myopkglibdir='${libdir}/'"$PACKAGE"
+-KDE_EXPAND_MAKEVAR(mypkglibdir, myopkglibdir)
+-AC_DEFINE_UNQUOTED(PLIBDIR, "$mypkglibdir", [Where to look for icecc-create-env])
+-
+ myorundir='${localstatedir}/run'
+ KDE_EXPAND_MAKEVAR(myrundir, myorundir)
+ AC_DEFINE_UNQUOTED(RUNDIR, "$myrundir", [Where to place pid files])
diff --git a/sys-devel/icecream/files/0.9.7-glibc2.16.patch b/sys-devel/icecream/files/0.9.7-glibc2.16.patch
new file mode 100644
index 000000000000..7ccbd735a46f
--- /dev/null
+++ b/sys-devel/icecream/files/0.9.7-glibc2.16.patch
@@ -0,0 +1,16 @@
+Fix building with glibc-2.16
+
+https://bugs.gentoo.org/show_bug.cgi?id=425248
+
+Patch written by Kacper Kowalik <xarthisius@gentoo.org>
+--- a/daemon/workit.cpp
++++ b/daemon/workit.cpp
+@@ -26,6 +26,7 @@
+ #include "exitcode.h"
+ #include "logging.h"
+ #include <sys/select.h>
++#include <sys/resource.h>
+ #include <algorithm>
+
+ #ifdef __FreeBSD__
+
diff --git a/sys-devel/icecream/files/icecream b/sys-devel/icecream/files/icecream
new file mode 100644
index 000000000000..257a76c61c51
--- /dev/null
+++ b/sys-devel/icecream/files/icecream
@@ -0,0 +1,44 @@
+#!/sbin/runscript
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+depend() {
+ need net
+}
+
+start() {
+ local basedir=${ICECREAM_BASEDIR:-"/var/cache/icecream"}
+ local netname=${ICECREAM_NETNAME:+"-n ${ICECREAM_NETNAME}"}
+ local logfile=${ICECREAM_LOG_FILE:+"-l ${ICECREAM_LOG_FILE}"}
+ local nice=${ICECREAM_NICE_LEVEL:+"--nice ${ICECREAM_NICE_LEVEL}"}
+ local scheduler=${ICECREAM_SCHEDULER_HOST:+"-s ${ICECREAM_SCHEDULER_HOST}"}
+ local maxjobs=${ICECREAM_MAX_JOBS:+"-m ${ICECREAM_MAX_JOBS}"}
+ local verbosity=${ICECREAM_VERBOSITY:-"-v"}
+
+ if [[ "${ICECREAM_RUN_SCHEDULER}" == "yes" ]]; then
+ local slogfile=${ICECREAM_SCHEDULER_LOG_FILE:-"/var/log/icecc_scheduler"}
+ touch ${slogfile} && chown icecream:icecream ${slogfile}
+ slogfile=${slogfile:+"-l ${slogfile}"}
+ ebegin "Starting Distributed Compiler Scheduler"
+ start-stop-daemon -u icecream --start --quiet --exec /usr/sbin/scheduler -- -d ${slogfile} ${netname} ${verbosity}
+ eend ${?}
+ fi
+
+ [[ ! -d ${basedir} ]] && mkdir -p ${basedir} && chown icecream:icecream ${basedir}
+ ebegin "Starting Distributed Compiler Daemon"
+ start-stop-daemon --start --quiet --exec /usr/sbin/iceccd -- -d ${logfile} ${nice} ${scheduler} ${netname} -u icecream -b "${basedir}" ${maxjobs} ${verbosity}
+ eend ${?}
+}
+
+stop() {
+ ebegin "Stopping Distributed Compiler Daemon"
+ start-stop-daemon --stop --quiet --name iceccd
+ eend ${?}
+
+ if [[ "${ICECREAM_RUN_SCHEDULER}" == "yes" ]]; then
+ ebegin "Stopping Distributed Compiler Scheduler"
+ start-stop-daemon --stop --quiet --name scheduler
+ eend ${?}
+ fi
+}
diff --git a/sys-devel/icecream/files/icecream-1.0.0-libcap-ng.patch b/sys-devel/icecream/files/icecream-1.0.0-libcap-ng.patch
new file mode 100644
index 000000000000..3dc0e3713b0a
--- /dev/null
+++ b/sys-devel/icecream/files/icecream-1.0.0-libcap-ng.patch
@@ -0,0 +1,8 @@
+--- a/services/icecc.pc.in
++++ b/services/icecc.pc.in
+@@ -11,4 +11,5 @@ Version: @VERSION@
+ Requires:
+ Conflicts:
+ Libs: -L${libdir} -licecc
++Libs.private: @CAPNG_LDADD@
+ Cflags: -I${includedir}
diff --git a/sys-devel/icecream/files/icecream-conf.d-verbosity.patch b/sys-devel/icecream/files/icecream-conf.d-verbosity.patch
new file mode 100644
index 000000000000..1ee93c5741a2
--- /dev/null
+++ b/sys-devel/icecream/files/icecream-conf.d-verbosity.patch
@@ -0,0 +1,18 @@
+--- a/suse/sysconfig.icecream
++++ b/suse/sysconfig.icecream
+@@ -39,6 +39,15 @@
+ #
+ ## Type: string
+ ## Path: Applications/icecream
++## Default: -v
++#
++# icecream's level of verbosity ([-v[v[v]]])
++#
++ICECREAM_VERBOSITY="-v"
++
++#
++## Type: string
++## Path: Applications/icecream
+ ## Defaut: ""
+ #
+ # Identification for the network the scheduler and daemon run on.
diff --git a/sys-devel/icecream/files/icecream-config b/sys-devel/icecream/files/icecream-config
new file mode 100644
index 000000000000..6ed24c743772
--- /dev/null
+++ b/sys-devel/icecream/files/icecream-config
@@ -0,0 +1,69 @@
+#!/bin/sh
+#
+# icecream-config - helper script for icecream and its ebuild
+#
+# Copyright 2003-2010 Superlucidity Services, LLC
+# This program licensed under the GNU GPL version 2.
+#
+# This script developed by Zachary T Welch at Superlucidity Services, LLC
+# it was cloned from the distcc-config script to make ccache-config
+# and then modified by Marcus Furlong to configure icecream too.
+#
+# Additional features to come; this provides a starting point
+
+# this should be getopt'd someday (override with ICEC_QUIET=1)
+ICECC_VERBOSE=1
+
+icecc_echo() {
+ [ -z "${ICECC_QUIET}" -a -n "${ICECC_VERBOSE}" ] && echo "$*"
+}
+
+###
+# the following functions manage the icecream symlinks
+# they allow the user or other scripts (namely gcc-config) to
+# automatically update icecream's links when upgrading toolchains
+#
+icecc_remove_link() {
+ local t="/usr/lib/icecc/bin/${1}"
+ if [ -L ${t} ]; then
+ icecc_echo "Removing ${t}..."
+ rm -f "${t}"
+ fi
+}
+icecc_install_link() {
+ # Search the PATH for the specified compiler
+ # then create shadow link in /usr/lib/icecc/bin to icecc
+
+ if [ -n "$(type -p ${1})" ]; then
+ # first be sure any old link is removed
+ ICECC_QUIET=1 icecc_remove_link "${1}"
+
+ # then create the new link
+ local t="/usr/lib/icecc/bin/${1}"
+ icecc_echo "Creating icecream shadow link: ${t}..."
+ ln -s /usr/bin/icecc "${t}"
+ fi
+}
+icecc_links() {
+ local a
+ for a in gcc cc c++ g++ ; do
+ [ -n "${2}" ] && a="${2}-${a}"
+ eval "icecc_${1}_link" "${a}"
+ done
+}
+
+###
+# main routine
+
+case "${1}" in
+ --install-links )
+ icecc_links install "${2}"
+ ;;
+ --remove-links )
+ icecc_links remove "${2}"
+ ;;
+ * )
+ echo "usage: ${0} {--install-links|--remove-links} [ CHOST ]"
+ ;;
+esac
+
diff --git a/sys-devel/icecream/files/icecream-create-env b/sys-devel/icecream/files/icecream-create-env
new file mode 100644
index 000000000000..dafdc13b4331
--- /dev/null
+++ b/sys-devel/icecream/files/icecream-create-env
@@ -0,0 +1,82 @@
+#!/bin/sh
+#
+# icecream-create-env - helper script to create icecc environments(mostly for cross-compiling)
+#
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+#
+# Please note, this script has been designed to work with Gentoo's crossdev, it may or may
+# not work with cross-toolchains that were build differently.
+#
+#
+# Usage: "./icecream-create-env" creates a native environment(similar to icecc --build-native)
+# "./icecream-create-env prefix" creates a cross-compile environment using the cross-toolchain created by crossdev
+# Example:
+# "emerge crossdev && crossdev -t sparc-unknown-linux-gnu && icecream-create-env sparc-unknown-linux"
+
+if [ `id -u` -ne 0 ]
+then
+ echo "Only the superuser can execute this script."
+ exit 1
+fi
+
+# param 1 = CHOST
+prefix="${1}"
+
+if [ -z "${prefix}" ]
+then
+ prefix="`gcc -dumpmachine`"
+fi
+
+gccbin=`which ${prefix}-gcc 2>/dev/null`
+if [ ! -e "${gccbin}" ]
+then
+ echo "Can't find ${prefix}-gcc!"
+ exit 1
+fi
+
+gxxbin=`which ${prefix}-g++ 2>/dev/null`
+if [ ! -e "${gxxbin}" ]
+then
+ echo "Can't find ${prefix}-g++!"
+ exit 2
+fi
+
+version="`${prefix}-gcc -dumpversion`"
+
+tmpdir=`mktemp -d`
+tmpfile=`mktemp`
+
+target=`gcc -dumpmachine`
+if [ "x${target}" = "x${prefix}" ]
+then
+ /usr/libexec/icecc/icecc-create-env \
+ /usr/${prefix}/gcc-bin/${version}/gcc \
+ /usr/${prefix}/gcc-bin/${version}/g++ \
+ | tee ${tmpfile}
+else
+ /usr/libexec/icecc/icecc-create-env \
+ /usr/${target}/${prefix}/gcc-bin/${version}/${prefix}-gcc \
+ /usr/${target}/${prefix}/gcc-bin/${version}/${prefix}-g++ \
+ | tee ${tmpfile}
+fi
+
+# figure out the name of the archive
+icecc_envname=`grep "creating" ${tmpfile} | awk '{print $2}'`
+
+echo "Testing icecc environment..."
+tar -x -z -f ${icecc_envname} -C ${tmpdir}
+touch ${tmpdir}/empty.c
+chroot ${tmpdir}/ /usr/bin/gcc -c /empty.c
+tested=${?}
+rm ${tmpdir}/empty.c
+
+if [ "${tested}" -ne 0 ]
+then
+ echo ""
+ echo "Creating icecc environment failed. Please see error message(s) above! The temporary directory is: ${tmpdir}/"
+else
+ echo ""
+ echo "Icecc environment has been created. It has been saved as ${icecc_envname}!"
+fi
+
diff --git a/sys-devel/icecream/files/icecream-gentoo-multilib.patch b/sys-devel/icecream/files/icecream-gentoo-multilib.patch
new file mode 100644
index 000000000000..94c6a41b3af6
--- /dev/null
+++ b/sys-devel/icecream/files/icecream-gentoo-multilib.patch
@@ -0,0 +1,59 @@
+Index: services/job.h
+===================================================================
+--- services/job.h (revision 843731)
++++ services/job.h (working copy)
+@@ -57,6 +57,10 @@
+
+ unsigned int argumentFlags() const;
+
++ const ArgumentsList getFlags() {
++ return m_flags;
++ }
++
+ void setFlags( const ArgumentsList &flags ) {
+ m_flags = flags;
+ }
+Index: client/main.cpp
+===================================================================
+--- client/main.cpp (revision 843731)
++++ client/main.cpp (working copy)
+@@ -218,6 +218,39 @@
+
+ local |= analyse_argv( argv, job );
+
++ /* honour Gentoo's ${CFLAGS_${ABI}} environment variable */
++ if (getenv("ABI") != NULL) {
++ char* envar = (char*) malloc(sizeof(char) *
++ (strlen("CFLAGS_") + strlen(getenv("ABI")) + 1));
++
++ if (!envar)
++ return 1;
++
++ /* We use CFLAGS_${ABI} for gcc, g++, g77, etc as they are
++ * the same no matter which compiler we are using.
++ */
++ sprintf(envar, "CFLAGS_%s", getenv("ABI"));
++
++ if (getenv(envar)) {
++ ArgumentsList args = job.getFlags();
++
++ char* pch = strtok(getenv(envar)," \t");
++ while (pch != NULL) {
++ #if CLIENT_DEBUG
++ log_info() << "adding CFLAG '" << pch << "' as specified in environment variable ${CFLAGS_${ABI}}" << endl;
++ #endif
++ args.append(pch, Arg_Remote);
++ pch = strtok(NULL, " \t");
++ }
++
++ job.setFlags(args);
++
++ free(pch);
++ }
++
++ free(envar);
++ }
++
+ /* if ICECC is set to no, then run job locally */
+ char* icecc = getenv("ICECC");
+ if ( icecc && !strcasecmp(icecc, "no") )
diff --git a/sys-devel/icecream/files/icecream-r2 b/sys-devel/icecream/files/icecream-r2
new file mode 100644
index 000000000000..b3b23e0f15fa
--- /dev/null
+++ b/sys-devel/icecream/files/icecream-r2
@@ -0,0 +1,45 @@
+#!/sbin/runscript
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+depend() {
+ need net
+}
+
+start() {
+ local basedir=${ICECREAM_BASEDIR:-"/var/cache/icecream"}
+ local netname=${ICECREAM_NETNAME:+"-n ${ICECREAM_NETNAME}"}
+ local logfile=${ICECREAM_LOG_FILE:+"-l ${ICECREAM_LOG_FILE}"}
+ local nice=${ICECREAM_NICE_LEVEL:+"--nice ${ICECREAM_NICE_LEVEL}"}
+ local scheduler=${ICECREAM_SCHEDULER_HOST:+"-s ${ICECREAM_SCHEDULER_HOST}"}
+ local maxjobs=${ICECREAM_MAX_JOBS:+"-m ${ICECREAM_MAX_JOBS}"}
+ local verbosity=${ICECREAM_VERBOSITY:-"-v"}
+
+ [[ ! -d /var/log/icecream/ ]] && mkdir -p /var/log/icecream/ && chown icecream:icecream /var/log/icecream/
+ if [[ "${ICECREAM_RUN_SCHEDULER}" == "yes" ]]; then
+ local slogfile=${ICECREAM_SCHEDULER_LOG_FILE:-"/var/log/icecc_scheduler"}
+ touch ${slogfile} && chown icecream:icecream ${slogfile}
+ slogfile=${slogfile:+"-l ${slogfile}"}
+ ebegin "Starting Distributed Compiler Scheduler"
+ start-stop-daemon -u icecream --start --quiet --exec /usr/sbin/icecc-scheduler -- -d ${slogfile} ${netname} ${verbosity}
+ eend ${?}
+ fi
+
+ [[ ! -d ${basedir} ]] && mkdir -p ${basedir} && chown icecream:icecream ${basedir}
+ ebegin "Starting Distributed Compiler Daemon"
+ start-stop-daemon --start --quiet --exec /usr/sbin/iceccd -- -d ${logfile} ${nice} ${scheduler} ${netname} -u icecream -b "${basedir}" ${maxjobs} ${verbosity}
+ eend ${?}
+}
+
+stop() {
+ ebegin "Stopping Distributed Compiler Daemon"
+ start-stop-daemon --stop --quiet --name iceccd
+ eend ${?}
+
+ if [[ "${ICECREAM_RUN_SCHEDULER}" == "yes" ]]; then
+ ebegin "Stopping Distributed Compiler Scheduler"
+ start-stop-daemon --stop --quiet --name icecc-scheduler
+ eend ${?}
+ fi
+}
diff --git a/sys-devel/icecream/icecream-0.9.7-r1.ebuild b/sys-devel/icecream/icecream-0.9.7-r1.ebuild
new file mode 100644
index 000000000000..52f92ba87763
--- /dev/null
+++ b/sys-devel/icecream/icecream-0.9.7-r1.ebuild
@@ -0,0 +1,87 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit autotools base user
+
+MY_P=icecc-${PV}
+
+DESCRIPTION="icecc is a program for distributed compiling of C(++) code across several machines; based on distcc"
+HOMEPAGE="http://en.opensuse.org/Icecream"
+SRC_URI="ftp://ftp.suse.com/pub/projects/${PN}/${MY_P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~hppa ~ppc ~sparc ~x86"
+IUSE=""
+
+S=${WORKDIR}/${MY_P}
+
+PATCHES=(
+ "${FILESDIR}/0.9.6-symlinks.patch"
+ "${FILESDIR}/0.9.6-crosscompile.patch"
+ "${FILESDIR}/${PV}-automake.patch"
+ "${FILESDIR}/${PV}-glibc2.16.patch"
+ "${FILESDIR}/${PN}-conf.d-verbosity.patch"
+ "${FILESDIR}/${PN}-gentoo-multilib.patch"
+)
+
+pkg_setup() {
+ enewgroup icecream
+ enewuser icecream -1 -1 /var/cache/icecream icecream
+}
+
+src_prepare() {
+ base_src_prepare
+ sed -i -e "s/Defaut/Default/g" suse/sysconfig.icecream || die #275761
+ eautoreconf
+}
+
+src_install() {
+ default
+
+ dosbin "${FILESDIR}"/icecream-config
+ dosbin "${FILESDIR}"/icecream-create-env
+
+ newconfd suse/sysconfig.icecream icecream
+ doinitd "${FILESDIR}"/icecream
+
+ diropts -m0755
+ keepdir /usr/lib/icecc/bin
+}
+
+pkg_postinst() {
+ ebegin "Scanning for compiler front-ends..."
+ /usr/sbin/icecream-config --install-links
+ /usr/sbin/icecream-config --install-links "${CHOST}"
+ eend ${?}
+
+ elog
+ elog "If you have compiled binutils/gcc/glibc with processor-specific flags"
+ elog "(as normal using Gentoo), there is a greater chance that your compiler"
+ elog "won't work on other machines. The best would be to build gcc, glibc and"
+ elog "binutils without those flags and then copy the needed files into your"
+ elog "tarball for distribution to other machines. This tarball can be created"
+ elog "by running /usr/bin/icecc --build-native, and used by setting"
+ elog "ICECC_VERSION in /etc/conf.d/icecream"
+ elog ' ICECC_VERSION=<filename_of_archive_containing_your_environment>'
+ elog
+ elog "To use icecream with portage add the following line to /etc/make.conf"
+ elog ' PREROOTPATH=/usr/lib/icecc/bin'
+ elog
+ elog "To use icecream with normal make use (e.g. in /etc/profile)"
+ elog ' PATH=/usr/lib/icecc/bin:$PATH'
+ elog
+ elog "N.B. To use icecream with ccache, the ccache PATH should come first:"
+ elog ' PATH=/usr/lib/ccache/bin:/usr/lib/icecc/bin:$PATH'
+ elog
+ elog "Don't forget to open the following ports in your firewall(s):"
+ elog " TCP/10245 on the daemon computers (required)"
+ elog " TCP/8765 for the the scheduler computer (required)"
+ elog " TCP/8766 for the telnet interface to the scheduler (optional)"
+ elog " UDP/8765 for broadcast to find the scheduler (optional)"
+ elog
+ elog "Further usage instructions: ${HOMEPAGE}"
+}
diff --git a/sys-devel/icecream/icecream-1.0.0-r1.ebuild b/sys-devel/icecream/icecream-1.0.0-r1.ebuild
new file mode 100644
index 000000000000..2186746a1eec
--- /dev/null
+++ b/sys-devel/icecream/icecream-1.0.0-r1.ebuild
@@ -0,0 +1,52 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+MY_P="${P/icecream/icecc}"
+
+inherit base eutils user
+
+DESCRIPTION="icecc is a program for distributed compiling of C(++) code across several machines; based on distcc"
+HOMEPAGE="https://github.com/icecc/icecream"
+SRC_URI="ftp://ftp.suse.com/pub/projects/${PN}/${MY_P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~hppa ~ppc ~sparc ~x86"
+IUSE=""
+
+RDEPEND="
+ sys-libs/libcap-ng
+"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}/${MY_P}"
+
+PATCHES=(
+ "${FILESDIR}/${P}-libcap-ng.patch"
+)
+
+pkg_setup() {
+ enewgroup icecream
+ enewuser icecream -1 -1 /var/cache/icecream icecream
+}
+
+src_configure() {
+ econf \
+ --enable-shared --disable-static \
+ --enable-clang-wrappers \
+ --enable-clang-rewrite-includes
+}
+
+src_install() {
+ default
+ prune_libtool_files --all
+
+ newconfd suse/sysconfig.icecream icecream
+ newinitd "${FILESDIR}"/icecream-r2 icecream
+
+ insinto /etc/logrotate.d
+ newins suse/logrotate icecream
+}
diff --git a/sys-devel/icecream/metadata.xml b/sys-devel/icecream/metadata.xml
new file mode 100644
index 000000000000..64c49c8ac03e
--- /dev/null
+++ b/sys-devel/icecream/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>cluster</herd>
+ <herd>suse</herd>
+ <upstream>
+ <remote-id type="github">icecc/icecream</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-devel/kgcc64/Manifest b/sys-devel/kgcc64/Manifest
new file mode 100644
index 000000000000..685777dde8fc
--- /dev/null
+++ b/sys-devel/kgcc64/Manifest
@@ -0,0 +1,34 @@
+DIST gcc-3.4.6-patches-1.2.tar.bz2 54757 SHA256 43253a8defa6111bd6f107178cc46f425ec81efe0eb26b730c11c422a4d4de26 SHA512 9945cf8e2cc92cc29a0c5c5c455398e57870fcbe281510357cf166cf4bb7458065be4d3048094615a99ab3c3f6eededfb58ec55742bbbe50bb887aa854b6f9d5 WHIRLPOOL 7da5f1609b61f5c2a4f28bf2b013e700c382f172cd3ad1e9413fa11d1a800d64dda5eedcab6ac232c21c6a7d72083f12060a0729f5906a42a7a896dc3d11135b
+DIST gcc-3.4.6.tar.bz2 28193401 SHA256 7791a601878b765669022b8b3409fba33cc72f9e39340fec8af6d0e6f72dec39 SHA512 d235e1223d5faf8f37f2d73db35edeff44c88974b09dfcf325f4b181b16d7124710d93b1b65b60206ce3525f062236ea0f338b3a5341d7ecbe196d8e90c3ff18 WHIRLPOOL 19fc447592f1feee56da74ee6d9436e0813e5a29ced37f8bf91836bbf0b1b9023fe2f717f8c3cf6dc84f11d2029cd87b65e9176b19727996420b589716cdfa45
+DIST gcc-4.1.2-patches-1.0.1.tar.bz2 43294 SHA256 311cef339fd021c72086cdef361e0aa6409a4a62d21fddaa7a5171bc1545085a SHA512 79f1d47d364462325a927b35b66bbdc68c100dbb6c86a6dd524d0e1cd09b7135c3789e80b71539cec63befbeea1a0e9b456b53ab0a5580b64509f78231d3fdc5 WHIRLPOOL 709cd322c03d0292475ae46a62ce3c09b7c245b866dbf07ef05725c535531e6933f2c9fb51ec69166f300573912fcf608ca9219dc41e14fd6adc18cd62727a7c
+DIST gcc-4.1.2.tar.bz2 39707720 SHA256 cfc0efbcc6fcde0d416a32dfb246c9df022515a312683fac412578c4fd09a9bc SHA512 b97d3b72a3b0355611d5090b2c715b7a774f0e466a89326a0226c2809d12dfafb2d7c5a7af54bd5e00c135bbb6596f535e1a484740f7f1f691e8a57e6f0425cc WHIRLPOOL 5822040f7e96919bb906ce55e0bd19c4c85b3a47ce73f0a4b6d0da62ce9d7651b6cbeb6199dafc38582b206a98126e3efec8d54cc58c7f303ca708c9261bec57
+DIST gcc-4.2.4-patches-1.0.tar.bz2 21809 SHA256 3e077b6d4e9d51a30094aff35c4045bef859fc20c7a341f772da059b8bc6be85 SHA512 20eb3fa790e5cc1bd66c9ad1915c73c20ae8977d6789addaf4863184e6d5c25ab9b0f2c40e3ad08a6859825b2e97bf0839e0a616730362072aa35e8ae158a427 WHIRLPOOL 84d87cb1dc412e7f5318000264336b329f6f827af0769121370184fb96f4f37184cd1de2630743270d6ef63736fbc905fc68b76e86d799738daf690a94254551
+DIST gcc-4.2.4.tar.bz2 44025458 SHA256 afba845e2d38547a63bd3976e90245c81ea176786f9e6966339c6d3761f1133a SHA512 c6e3e4fce1d27d0c56ab24f4809367d9329b620b7c124e88de190f2ea2ae57b5e06d0bda85c5a74237a4f94ddba53dc91faea0611fff7b19ad720edc312cb0d9 WHIRLPOOL 242177c7adc1538dfbf0b5519132902479c9a8f21158ed04bcf29a3616bbf98d0cf4def13e602ad0226e745875c327d33e8f45eae1b1e6de6d61e2a0ca1b0b90
+DIST gcc-4.3.5-patches-1.1.tar.bz2 74719 SHA256 caebc997ecb83d2dcf736404b66de32e8dd324015d76a0ae9335d373e2f6229a SHA512 9c0e13e1186259f3410bc1cccf198d4bd9f1a2fec7d121ca8dfa0a90312b40f4610d216c8012525440045b83347dc2e05ac3f1584a08a54e5d384c56563bf4e3 WHIRLPOOL 41bb988b423a842619e0b77be9cce7ae798dbdd8c0034e8ef13a50dc93345018a6a66937528b66771fa755e78338507aa4e694728bdd7cfdfa651247945b13dd
+DIST gcc-4.3.5.tar.bz2 59347925 SHA256 10c6e745c39dbdc950cfa16ba8e3603cb52c5bd9d4d7e665c9a13a6f62407e6b SHA512 3c4074102b49c9783ecabb183f37741ff878ebc481c4e42661de913d1453fb72f074cfbfafacfb2d7fe6ea662da3c706855fc43afaca26de0c599b8121b60803 WHIRLPOOL 851c422087b23ec923c76398e601a5b36245f64973811a6d85992bcc1c67d906862b4dee38aa9ca5badc4f27b20c24096c0b798f27b3470f006e16f8b263d6c5
+DIST gcc-4.4.5-patches-1.2.tar.bz2 22319 SHA256 5cef67eeee0ce89f1471b3a6a75e0acbd4a54e78efc335b0bb66ac17e7cb7349 SHA512 ea3d0ac7b6a31d32ecf94fdd27b210ad97136cb7a1544f748ba936cc70c2c3964162b67ddf581ebef7eb57dd495bc5058759f4240e2a27392359015a4c22e331 WHIRLPOOL d4df74933f556acbc6709366757b505c349c3e428f1d609d986218972913eedf1225682c8f03560a62e9b564d75f506636beec3aa1d093567cb715aec1f975e4
+DIST gcc-4.4.5.tar.bz2 63081552 SHA256 a945eb6cf694a55f83af904f4a3fb41ee07b9d021826dfe66991dfa7f0ea97ce SHA512 d98ed79b13b58dc2e83d988514bd9a4dfe0dd4c8538efdfbaf0ec1f58c0aa990c39f97699f43b32d09f6022aacda2552e226c82de8c7b816a15708537f32662e WHIRLPOOL 6a7307fe034b16643fe333ee6e2bac228a44e8872d2c66a7aef9bc58b852fd107ba86df257528878a40eea86a6bda487f86ab5d62cd4e43443c76f174189dfb5
+DIST gcc-4.4.6-patches-1.0.tar.bz2 25346 SHA256 150a6503145e3a52b19419b66c8224808a8c1b2f813bdf552f6b1e4cf6b80310 SHA512 3074afcd36f5d0ba4a2ae53d5742dd269c36284bfa345564bd0de7d95111b15b43e5c8f86ecd577257d769baca976d02dc2fc31e4f8c5bdca2b989efc92c009b WHIRLPOOL 385cae48cdf3fa26d03c4ef3a10f0efdd0b2dada36d061d6b2fae229a9b91fdaa4f5d105816eb89feacebf0313eaefc94f6175f94c32c574bff517bde226a4d1
+DIST gcc-4.4.6.tar.bz2 63135296 SHA256 57c718899e19277cbce9df3b0940a319e63c4630df6134185a45f157f24e8a0b SHA512 a4ecc77e227c523b65988ecc3db4243bd96794d7373a4c3e7c15b5c60944f204be1d8a045a964bbe5ce0bb6d6136c09336eff0059a1970c0404f5585bf8688d7 WHIRLPOOL 26f8b2bdd09408f8abee99b16723b072b99f38d999eda8ae809778035914a09d47a2ef5c23b883961a1aa360fdc6d6520d4164873d73f510606f2bbb677b848b
+DIST gcc-4.5.3-patches-1.4.tar.bz2 22869 SHA256 96e7ee4805ceb19cc27ca9ef0f79c061f18c716ca33338a738c135cfe89f145c SHA512 5361914ba7142a22c12f7f415840be1645a8e6531ee7310a4ef476537b3f81e71fe69a11ac51d6016b0599ab5eef06b024cdf47e03cc11a5e1e5b031a63e2851 WHIRLPOOL 39399a559ca8270761e41387e43572e93643d0c2bb4c4b230f79934c8b1bf371d73e7181adc414b044198c7d36bc1c7979b381e2b9f88dbe64cfaa19648fd165
+DIST gcc-4.5.3.tar.bz2 66374586 SHA256 0a8847af44a9b33813b199997a73139517c96adfd519eaf24c79d4d9d09f65de SHA512 42c03aa0d16a52e95d1857d859ddd0a4923c232b90481ee52b02bc9a3976bc6e5e502e94af3fc76ac054572a420303c47e409c72f816416aeffd74c4bcd443d3 WHIRLPOOL faad2337eaae059cde6a2f42227f29a6c2855e6cbf16894a178e446b7668b7f68e23a7968926473974ec9aff3680cebbebfc01af0a60474ff90cf1fad3e96a11
+DIST gcc-4.5.4-patches-1.2.tar.bz2 22588 SHA256 45ea4e83e6c879d666fd38be5a4c7cce3e5ad756ebd402c664f65702dd2e4750 SHA512 f69c7be5195d4151c3ed1d3fb2913a77bea871554b03f1149ce700bb4cf553edc795cafd637c75305af6ed4079ec698122cac7836ff0f06189f9687ee5565f99 WHIRLPOOL e49f668c567c5427d12720d2d937092cbe323b023c786e25dde5babdcf8a1dfacab9deb82d7702cb67eba1eedb56d83fbe59f853102cad55b33e3d2ff213b270
+DIST gcc-4.5.4.tar.bz2 66426133 SHA256 eef3f0456db8c3d992cbb51d5d32558190bc14f3bc19383dd93acc27acc6befc SHA512 78696b287d46aacd6f150920da376ea32f58ad9f0dafd2d3b7fa6dbdd8dd7afe659108d1dfaa5807617fc5248719f50b39c37ade0173ea5b9fec2091f4656115 WHIRLPOOL 1d3aa5f344171a75144118101bf475536940eeb80f73849827ee4103c52dfb6504d9b26e21fa0984c65c5e6267e02fa6e7f8ef539c44f45470790781080aadca
+DIST gcc-4.6.3-patches-1.9.tar.bz2 20439 SHA256 985aa2a7adb15121cb4b2ed7af054a948e6aea882d959d814109078dbc912719 SHA512 d6ac0df52deb3c2c2f2e1bb2354e8fec8ac26a3c6fa15bf47c9cd8424f87faee0646878263ecd489f1fcef1e62896150f82f770792340a0722d72d793f5f5a62 WHIRLPOOL 64238ee4ddba510341bd3fc38bb92a360517b5b1b94754d9430970ec9cf38cf95d907b3c2829043dca00f7c7b9bc26554242717a6e0382370520a7db0d0ba246
+DIST gcc-4.6.3.tar.bz2 71999439 SHA256 e8f5853d4eec2f5ebaf8a72ae4d53c436aacf98153b2499f8635b48c4718a093 SHA512 efedecc1a6d1c36eb91cbecfae9a4414d01051e99965de8a284d1164df3cad13fa99a6dd5a4ceaa03ef63a66884eaf729b49d602ac82088f788bab045ce1eb26 WHIRLPOOL a50059cc5ec5bcf7c7d7108e38087c2168ff0c6817d06b709be901a87007f84cd231ebae0752cdc94fa99c93ecd30ba810d3213aba9f3639292b1e831818ec0c
+DIST gcc-4.6.4-patches-1.0.tar.bz2 18687 SHA256 f751e2e701c48bc30d3047b87b5d08fb15095de3bb5b83c9662c08f5e5449a92 SHA512 8dd580faa9bcffcdeb1843a8d3d3bd8db492891d855c17bba3cc019673d814a5d24a927055694307be6438cb2c041bc799646a483c019f3840e4e1ca33b7ccb5 WHIRLPOOL 695fd821f347062bed01305fa1aca8c0cf4085391ad63f31df4afa3f4eaeb57eba7cebae02caac788dc9b290a57d675e66667ee3e15522d7d2909cbcbf1e6982
+DIST gcc-4.6.4.tar.bz2 72006076 SHA256 35af16afa0b67af9b8eb15cafb76d2bc5f568540552522f5dc2c88dd45d977e8 SHA512 b5a5395782e0b9e61cda052f6e00c8575d1aa0b7e8db9e34c06e4e45f12ff37b436018536b7fa69a04a4235b5b368895652e3ed8fab2fe11763f9782ed9161dc WHIRLPOOL ab1b035f43aec669640b36037e65ae0edceb3b13b1ce4f7900aeff5ee06686dc2d66c3dd81156f53c4e9a9a806e4becd4462f72a6c4ad7e646b632c10c23356c
+DIST gcc-4.7.3-patches-1.3.tar.bz2 42559 SHA256 082cf644967bd83a145c0699d212d2e3703365483b08d43b3c1e50961602f029 SHA512 3a962d5301aaaebdf18b49e4d603b1dfd13d1bc0e874d66f7d0840058dc4588cc081df0b1da05bc6e293cb76bdb7fef1f4e76261f1c15820c8008a4f9814fa13 WHIRLPOOL cdd782784d730c8d6de48e74a30f980581d37818e6a3ca5d6ffa30ed9b822fd3fed2232fbdcb5eb01359675d9030a95ea2adf9ed6abba52d6725e07bc3152b44
+DIST gcc-4.7.3.tar.bz2 82904224 SHA256 2f7c37eb4fc14422ff2358a9ef59c974a75ab41204ef0e49fc34ab1d8981a9c3 SHA512 5671a2dd3b6ac0d23f305cb11a796aebd823c1462b873136b412e660966143f4e07439bd8926c1443b78442beb6ae370ef91d819ec615920294875b722b7b0bd WHIRLPOOL cb3408e3e251833f38ae7cf2388a1ddce864614fe1c68de9729a1a9a1f8f028ab92c0f2b863e7fa3ac16dbf443306ac864e74c9cce90690230c081ee2ac309d3
+DIST gcc-4.7.4-patches-1.0.tar.bz2 40785 SHA256 bd54097be04a28f50890cffb0f00c6794f1196496c55264711e036ef82173eea SHA512 223dfe74cb784e6e6d53f8a8ccf939a938be17fe039676d4750f0b3f767cc0c967fd69c3fce054983cad1739901c7cbb262c3e61b9ada0d56af1815a69f6bb7b WHIRLPOOL 2aba0ac3948012a353bd3e0cb9cfd3251633dc69c0254607026540f0ae38f06258f8e4e633075589d0c590b17eb9326187eff89b1c9d451bf16a3afd67b26c6a
+DIST gcc-4.7.4.tar.bz2 82935453 SHA256 92e61c6dc3a0a449e62d72a38185fda550168a86702dea07125ebd3ec3996282 SHA512 dfcb737073191e628231031a3571ec77ee760a59377630f4a6e4fdfa66f9ddad39fde47e3f0f227eb43cdf90e0d34cde5abdc9ac892c1e111a911062a66c9189 WHIRLPOOL df8408e80634ce28f105f9abcdcf38fba5c130795cbe48428527a68819abebc3bc7152bb6ad714e40c71450a08986b48ddd630c887e1b2faf07c3babfe720969
+DIST gcc-4.8.1-patches-1.2.tar.bz2 17431 SHA256 964aed7e2c317be99eacbd0f4e7e619094f47ab48eb8844935c9a2c0a89d6bd6 SHA512 fec4237249021bfe040c148a72bf74df7f939baeafb804c87d9f0897c41e660bd8053d338ea994810a3c44c76d5eaa9269292f88b3603ab0d0a925c5073657d1 WHIRLPOOL 6bf6e4fc75536d9b0477780ba64a9ab8f2d6bc1000fb34e21dfe40e26e49b8ef9469370fcc5360f72dc780e3a187319e2f18fbc24fae3f294ff6983b32931666
+DIST gcc-4.8.1.tar.bz2 86753166 SHA256 545b44be3ad9f2c4e90e6880f5c9d4f0a8f0e5f67e1ffb0d45da9fa01bb05813 SHA512 1becc874aad77a469069b6d9da4158aae9e013e24afa9364fe4feff9a5094d0673ee7694b3840e892c860f73a56b3ece6174338a8214438c42b9f86dd6c35ea7 WHIRLPOOL c706fa4445bbf4b9503c78b7e03da6adeadc3c736d208edb65059ddf23a08875dfa1ac92ccaafb3dd72ecbceb15a0de5814c62104fb94f99032232fbc50ab82c
+DIST gcc-4.8.2-patches-1.0.tar.bz2 15931 SHA256 868723027ed356a9ea69771e3232aa534ad77b2c82526cf1ff928678b1770376 SHA512 fc465d985d3414a4f34c2eede17b79dbe14a176aa02e4e9890c2f94c920a1806394f572bc0fb622b09ed8e1488dffeb22bb6215eca87b3da5d22c98a9c835903 WHIRLPOOL 106e1d15d083f2811776507b4e8a3b25a1e68d9c50d8340cd60b58b975f4a20561412d5b4089d5951fce6ea9aa17494da8169b7a74dc5dd7533f609cb7e8ddb9
+DIST gcc-4.8.2.tar.bz2 85999682 SHA256 09dc2276c73424bbbfda1dbddc62bbbf900c9f185acf7f3e1d773ce2d7e3cdc8 SHA512 2a3927481707b3bb7171076b596d9b69084edac82460df6fb35395592dd1e8fc5665577702ca746d5b454dec68b1c4e31b9de6adc9865d482f4b8736ec648b10 WHIRLPOOL 5ebe564faf13634e7f2744dc13421ce0a3faa06b35d425f4b6983e74a4e93b4c21955823013f7a5530e7ea9e9d0ecfd68cb79950e94333ed3e44aaa4dfbdefe7
+DIST gcc-4.8.3-patches-1.1.tar.bz2 19882 SHA256 019cbe76f20f4e294b900ccb99a6b52553ed04fa0d2993798b3a07b0e4a8f90a SHA512 8512ec54fb2d482e08ca54042e11c6334d653ec850cc7c920ed95654575222ac0303caa35cd46e80f1985d86cd229f35e26e0eaca1ae623fd8d336940148801c WHIRLPOOL d7b8d6278b6f79aa00fcd29ed6142cad3002def33edb0be44e638d50cb3b1fa8da72fa62a7276c81c94cd873c872dd0e7fd602022420d9601fde8f2b04872ece
+DIST gcc-4.8.3.tar.bz2 86126808 SHA256 6a8e4f11b185f4fe2ed9d7fc053e80f8c7e73f800c045f51f9d8bea33f080f1e SHA512 2b40d231e8445f9c1654137df509f09ce1187b475138ca7f648f710d922a1718f740b2d8a37c26e16b5e27900c60358be98229ae884a6f1f70e9df44ad24d02b WHIRLPOOL 6dd3bd4b51bb9b8c52fb743bba28cde8612ff7090b71e56bf02d3613b91cd4c3c4dd91dbcb672985f22400d776870ba55550e1fc44afae9737092ceca5f83ebd
+DIST gcc-4.9.1-patches-1.0.tar.bz2 18918 SHA256 5addded7684318fd7ad16dba5a1407c27938ba803cec29b5376c32aaf432a36e SHA512 ade6f02a5d26f201c9d5a01da1174f803309358e49e9b93c848a4239f90b6301bc863951af25daf0188d68088fe8a02653391453158c1846751ddf2f286ee9da WHIRLPOOL 3b5f0f39c925d379a2db35b5335ed3fd7d456fd19fdeb315c87ba307e3ab6e8e8ebf29f8db894c43e3ea26a4318d4ca7ff47c635351a7f38aaa2afc33e3016cc
+DIST gcc-4.9.1.tar.bz2 89854120 SHA256 d334781a124ada6f38e63b545e2a3b8c2183049515a1abab6d513f109f1d717e SHA512 8598106a4b7c03bb4d6e29fa1bfa9ee6b6390d1f1bca86c1ccd27aed830ae1d126daa50c4041016cbfa76090dd66c51f1ce06958b8ccd6c3be51eae875125593 WHIRLPOOL 45c663aca6fe3212cf6ff34611df3041204b942aedf5005b133f6ab4c40c994d405a9356429a06279b533706960d8ef80f363dd4ee7e78848052e621c49ad681
+DIST gcc-4.9.2-patches-1.2.tar.bz2 19658 SHA256 8cc5f7a82aca3fdee3c4f8b3542ba7a4431dfe5e511b6c11232d830bfa01d998 SHA512 9fca6ee31c817d667f01954bc517a4c4d5bd13b796253f111ef87a5a0eab01ae9b19c8f60c9074fbdfc81763886bc05fa2aae4cb3c5cbe01901e4a5791cecf6f WHIRLPOOL ea46cf1f779aff553beb28a4118a223af10ec44ff67cfdbc50514202b40799ccf641bb8d45e67c3935eaf231b03c738ca965bd16b2c2569b6f184a240d3bc56f
+DIST gcc-4.9.2.tar.bz2 89939747 SHA256 2020c98295856aa13fda0f2f3a4794490757fc24bcca918d52cc8b4917b972dd SHA512 e96cba06d572dbe7f382a2b00fd9297dcf9f9219d46a9ad0bd904dc36d5e7db3335e422640b79a27fed6fde91b0731732b94a0e2fbcd47344d6779f8ba1f4f9c WHIRLPOOL c4afdd0ec98e6f903044f1d3061fd96cf1e9bcbe2f90c388f5bc9ff8b2493b94367e84fdff7c2075ba37e2f950ecf2dba7c11786c653c2c7e86a5e8ff7d98e85
diff --git a/sys-devel/kgcc64/kgcc64-3.4.6.ebuild b/sys-devel/kgcc64/kgcc64-3.4.6.ebuild
new file mode 100644
index 000000000000..e824f0497620
--- /dev/null
+++ b/sys-devel/kgcc64/kgcc64-3.4.6.ebuild
@@ -0,0 +1,73 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+case ${CHOST} in
+ hppa*) CTARGET=hppa64-${CHOST#*-};;
+ mips*) CTARGET=${CHOST/mips/mips64};;
+ powerpc*) CTARGET=${CHOST/powerpc/powerpc64};;
+ s390*) CTARGET=${CHOST/s390/s390x};;
+ sparc*) CTARGET=${CHOST/sparc/sparc64};;
+ i?86*) CTARGET=x86_64-${CHOST#*-};;
+esac
+export CTARGET
+TOOLCHAIN_ALLOWED_LANGS="c"
+GCC_TARGET_NO_MULTILIB=true
+
+PATCH_VER="1.2"
+GCC_FILESDIR=${FILESDIR/${PN}/gcc}
+
+inherit eutils toolchain
+
+DESCRIPTION="64bit kernel compiler"
+
+KEYWORDS="-* ~hppa ~mips ~ppc ~s390 sparc"
+
+# unlike every other target, hppa has not unified the 32/64 bit
+# ports in binutils yet
+DEPEND="hppa? ( sys-devel/binutils-hppa64 )
+ !sys-devel/gcc-hppa64
+ !sys-devel/gcc-mips64
+ !sys-devel/gcc-powerpc64
+ !sys-devel/gcc-sparc64"
+
+src_prepare() {
+ toolchain_src_prepare
+ epatch "${GCC_FILESDIR}"/3.4.4/gcc-3.4.4-cross-compile.patch
+
+ # Arch stuff
+ case $(tc-arch) in
+ mips)
+ # Patch forward-ported from a gcc-3.0.x patch that adds -march=r10000 and
+ # -mtune=r10000 support to gcc (Allows the compiler to generate code to
+ # take advantage of R10k's second ALU, perform shifts, etc..
+ epatch "${GCC_FILESDIR}"/3.4.2/gcc-3.4.x-mips-add-march-r10k.patch
+
+ # This is a very special patch -- it allows us to build kernels on SGI IP28
+ # (Indigo2 Impact R10000) systems.
+ # Unless you're building an IP28 kernel, you really don't need care about what
+ # this patch does, because if you are, you are probably already aware of what
+ # it does.
+ # All that said, the abilities of this patch are disabled by default and need
+ # to be enabled by passing -mr10k-cache-barrier.
+ # The option also accepts a flag, which are highlighted below:
+ # -mr10k-cache-barrier=1 - Protect stores only (IP28)
+ # -mr10k-cache-barrier=2 - Protect stores and loads (IP32 R10K)
+ epatch "${GCC_FILESDIR}"/3.4.2/gcc-3.4.2-mips-ip28_cache_barriers-v4.patch
+ ;;
+ esac
+}
+
+pkg_postinst() {
+ cd "${ROOT}"/usr/bin
+ local x
+ for x in gcc cpp ; do
+ cat <<-EOF >${CTARGET%%-*}-linux-${x}
+ #!/bin/sh
+ exec ${CTARGET}-${x} "\$@"
+ EOF
+ chmod a+rx ${CTARGET%%-*}-linux-${x}
+ done
+}
diff --git a/sys-devel/kgcc64/kgcc64-4.1.2.ebuild b/sys-devel/kgcc64/kgcc64-4.1.2.ebuild
new file mode 100644
index 000000000000..cda5c9871caa
--- /dev/null
+++ b/sys-devel/kgcc64/kgcc64-4.1.2.ebuild
@@ -0,0 +1,54 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+case ${CHOST} in
+ hppa*) CTARGET=hppa64-${CHOST#*-};;
+ mips*) CTARGET=${CHOST/mips/mips64};;
+ powerpc*) CTARGET=${CHOST/powerpc/powerpc64};;
+ s390*) CTARGET=${CHOST/s390/s390x};;
+ sparc*) CTARGET=${CHOST/sparc/sparc64};;
+ i?86*) CTARGET=x86_64-${CHOST#*-};;
+esac
+export CTARGET
+TOOLCHAIN_ALLOWED_LANGS="c"
+GCC_TARGET_NO_MULTILIB=true
+
+PATCH_VER="1.0.1"
+GCC_FILESDIR=${FILESDIR/${PN}/gcc}
+
+inherit eutils toolchain
+
+DESCRIPTION="64bit kernel compiler"
+
+KEYWORDS="-* hppa ~mips ppc ~s390 sparc"
+
+# unlike every other target, hppa has not unified the 32/64 bit
+# ports in binutils yet
+DEPEND="hppa? ( sys-devel/binutils-hppa64 )
+ !sys-devel/gcc-hppa64
+ !sys-devel/gcc-mips64
+ !sys-devel/gcc-powerpc64
+ !sys-devel/gcc-sparc64"
+
+src_prepare() {
+ toolchain_src_prepare
+ # Fix cross-compiling
+ epatch "${GCC_FILESDIR}"/4.1.0/gcc-4.1.0-cross-compile.patch
+}
+
+pkg_postinst() {
+ toolchain_pkg_postinst
+
+ cd "${ROOT}"/usr/bin
+ local x
+ for x in gcc cpp ; do
+ cat <<-EOF >${CTARGET%%-*}-linux-${x}
+ #!/bin/sh
+ exec ${CTARGET}-${x} "\$@"
+ EOF
+ chmod a+rx ${CTARGET%%-*}-linux-${x}
+ done
+}
diff --git a/sys-devel/kgcc64/kgcc64-4.2.4.ebuild b/sys-devel/kgcc64/kgcc64-4.2.4.ebuild
new file mode 100644
index 000000000000..a3a7e1906eae
--- /dev/null
+++ b/sys-devel/kgcc64/kgcc64-4.2.4.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+case ${CHOST} in
+ hppa*) CTARGET=hppa64-${CHOST#*-};;
+ mips*) CTARGET=${CHOST/mips/mips64};;
+ powerpc*) CTARGET=${CHOST/powerpc/powerpc64};;
+ s390*) CTARGET=${CHOST/s390/s390x};;
+ sparc*) CTARGET=${CHOST/sparc/sparc64};;
+ i?86*) CTARGET=x86_64-${CHOST#*-};;
+esac
+export CTARGET
+TOOLCHAIN_ALLOWED_LANGS="c"
+GCC_TARGET_NO_MULTILIB=true
+
+PATCH_VER="1.0"
+GCC_FILESDIR=${FILESDIR/${PN}/gcc}
+
+inherit eutils toolchain
+
+DESCRIPTION="64bit kernel compiler"
+
+KEYWORDS="-* hppa ~mips ppc ~s390 ~sparc"
+
+# unlike every other target, hppa has not unified the 32/64 bit
+# ports in binutils yet
+DEPEND="hppa? ( sys-devel/binutils-hppa64 )
+ !sys-devel/gcc-hppa64
+ !sys-devel/gcc-mips64
+ !sys-devel/gcc-powerpc64
+ !sys-devel/gcc-sparc64"
+
+pkg_postinst() {
+ toolchain_pkg_postinst
+
+ cd "${ROOT}"/usr/bin
+ local x
+ for x in gcc cpp ; do
+ cat <<-EOF >${CTARGET%%-*}-linux-${x}
+ #!/bin/sh
+ exec ${CTARGET}-${x} "\$@"
+ EOF
+ chmod a+rx ${CTARGET%%-*}-linux-${x}
+ done
+}
diff --git a/sys-devel/kgcc64/kgcc64-4.3.5.ebuild b/sys-devel/kgcc64/kgcc64-4.3.5.ebuild
new file mode 100644
index 000000000000..3dca9c203d0c
--- /dev/null
+++ b/sys-devel/kgcc64/kgcc64-4.3.5.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+case ${CHOST} in
+ hppa*) CTARGET=hppa64-${CHOST#*-};;
+ mips*) CTARGET=${CHOST/mips/mips64};;
+ powerpc*) CTARGET=${CHOST/powerpc/powerpc64};;
+ s390*) CTARGET=${CHOST/s390/s390x};;
+ sparc*) CTARGET=${CHOST/sparc/sparc64};;
+ i?86*) CTARGET=x86_64-${CHOST#*-};;
+esac
+export CTARGET
+TOOLCHAIN_ALLOWED_LANGS="c"
+GCC_TARGET_NO_MULTILIB=true
+
+PATCH_VER="1.1"
+GCC_FILESDIR=${FILESDIR/${PN}/gcc}
+
+inherit eutils toolchain
+
+DESCRIPTION="64bit kernel compiler"
+
+# Works on mips and sparc; all other archs, refer to bug #228115
+KEYWORDS="-hppa ~mips ~sparc"
+
+# unlike every other target, hppa has not unified the 32/64 bit
+# ports in binutils yet
+DEPEND="hppa? ( sys-devel/binutils-hppa64 )
+ !sys-devel/gcc-hppa64
+ !sys-devel/gcc-mips64
+ !sys-devel/gcc-powerpc64
+ !sys-devel/gcc-sparc64"
+
+pkg_postinst() {
+ toolchain_pkg_postinst
+
+ cd "${ROOT}"/usr/bin
+ local x
+ for x in gcc cpp ; do
+ cat <<-EOF >${CTARGET%%-*}-linux-${x}
+ #!/bin/sh
+ exec ${CTARGET}-${x} "\$@"
+ EOF
+ chmod a+rx ${CTARGET%%-*}-linux-${x}
+ done
+}
diff --git a/sys-devel/kgcc64/kgcc64-4.4.5.ebuild b/sys-devel/kgcc64/kgcc64-4.4.5.ebuild
new file mode 100644
index 000000000000..946aa7c1b7bd
--- /dev/null
+++ b/sys-devel/kgcc64/kgcc64-4.4.5.ebuild
@@ -0,0 +1,55 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+case ${CHOST} in
+ hppa*) CTARGET=hppa64-${CHOST#*-};;
+ mips*) CTARGET=${CHOST/mips/mips64};;
+ powerpc*) CTARGET=${CHOST/powerpc/powerpc64};;
+ s390*) CTARGET=${CHOST/s390/s390x};;
+ sparc*) CTARGET=${CHOST/sparc/sparc64};;
+ i?86*) CTARGET=x86_64-${CHOST#*-};;
+esac
+export CTARGET
+TOOLCHAIN_ALLOWED_LANGS="c"
+GCC_TARGET_NO_MULTILIB=true
+
+PATCH_VER="1.2"
+GCC_FILESDIR=${FILESDIR/${PN}/gcc}
+
+inherit eutils toolchain
+
+DESCRIPTION="64bit kernel compiler"
+
+# Works on mips and sparc; all other archs, refer to bug #228115
+KEYWORDS="hppa sparc"
+
+RDEPEND=">=dev-libs/gmp-4.2.1
+ >=dev-libs/mpfr-2.3.2
+ >=sys-devel/gcc-config-1.4"
+# unlike every other target, hppa has not unified the 32/64 bit
+# ports in binutils yet
+DEPEND="${RDEPEND}
+ hppa? ( sys-devel/binutils-hppa64 )
+ !sys-devel/gcc-hppa64
+ !sys-devel/gcc-mips64
+ !sys-devel/gcc-powerpc64
+ !sys-devel/gcc-sparc64
+ >=sys-apps/texinfo-4.8
+ >=sys-devel/bison-1.875"
+
+pkg_postinst() {
+ toolchain_pkg_postinst
+
+ cd "${ROOT}"/usr/bin
+ local x
+ for x in gcc cpp ; do
+ cat <<-EOF >${CTARGET%%-*}-linux-${x}
+ #!/bin/sh
+ exec ${CTARGET}-${x} "\$@"
+ EOF
+ chmod a+rx ${CTARGET%%-*}-linux-${x}
+ done
+}
diff --git a/sys-devel/kgcc64/kgcc64-4.4.6.ebuild b/sys-devel/kgcc64/kgcc64-4.4.6.ebuild
new file mode 100644
index 000000000000..e7843e61f033
--- /dev/null
+++ b/sys-devel/kgcc64/kgcc64-4.4.6.ebuild
@@ -0,0 +1,55 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+case ${CHOST} in
+ hppa*) CTARGET=hppa64-${CHOST#*-};;
+ mips*) CTARGET=${CHOST/mips/mips64};;
+ powerpc*) CTARGET=${CHOST/powerpc/powerpc64};;
+ s390*) CTARGET=${CHOST/s390/s390x};;
+ sparc*) CTARGET=${CHOST/sparc/sparc64};;
+ i?86*) CTARGET=x86_64-${CHOST#*-};;
+esac
+export CTARGET
+TOOLCHAIN_ALLOWED_LANGS="c"
+GCC_TARGET_NO_MULTILIB=true
+
+PATCH_VER="1.0"
+GCC_FILESDIR=${FILESDIR/${PN}/gcc}
+
+inherit eutils toolchain
+
+DESCRIPTION="64bit kernel compiler"
+
+# Works on mips and sparc; all other archs, refer to bug #228115
+KEYWORDS="~hppa ~sparc"
+
+RDEPEND=">=dev-libs/gmp-4.2.1
+ >=dev-libs/mpfr-2.3.2
+ >=sys-devel/gcc-config-1.4"
+# unlike every other target, hppa has not unified the 32/64 bit
+# ports in binutils yet
+DEPEND="${RDEPEND}
+ hppa? ( sys-devel/binutils-hppa64 )
+ !sys-devel/gcc-hppa64
+ !sys-devel/gcc-mips64
+ !sys-devel/gcc-powerpc64
+ !sys-devel/gcc-sparc64
+ >=sys-apps/texinfo-4.8
+ >=sys-devel/bison-1.875"
+
+pkg_postinst() {
+ toolchain_pkg_postinst
+
+ cd "${ROOT}"/usr/bin
+ local x
+ for x in gcc cpp ; do
+ cat <<-EOF >${CTARGET%%-*}-linux-${x}
+ #!/bin/sh
+ exec ${CTARGET}-${x} "\$@"
+ EOF
+ chmod a+rx ${CTARGET%%-*}-linux-${x}
+ done
+}
diff --git a/sys-devel/kgcc64/kgcc64-4.5.3.ebuild b/sys-devel/kgcc64/kgcc64-4.5.3.ebuild
new file mode 100644
index 000000000000..32988cff0a59
--- /dev/null
+++ b/sys-devel/kgcc64/kgcc64-4.5.3.ebuild
@@ -0,0 +1,56 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+case ${CHOST} in
+ hppa*) CTARGET=hppa64-${CHOST#*-};;
+ mips*) CTARGET=${CHOST/mips/mips64};;
+ powerpc*) CTARGET=${CHOST/powerpc/powerpc64};;
+ s390*) CTARGET=${CHOST/s390/s390x};;
+ sparc*) CTARGET=${CHOST/sparc/sparc64};;
+ i?86*) CTARGET=x86_64-${CHOST#*-};;
+esac
+export CTARGET
+TOOLCHAIN_ALLOWED_LANGS="c"
+GCC_TARGET_NO_MULTILIB=true
+
+PATCH_VER="1.4"
+GCC_FILESDIR=${FILESDIR/${PN}/gcc}
+
+inherit eutils toolchain
+
+DESCRIPTION="64bit kernel compiler"
+
+# Works on mips and sparc; all other archs, refer to bug #228115
+KEYWORDS="hppa sparc"
+
+RDEPEND=">=dev-libs/gmp-4.3.2
+ >=dev-libs/mpfr-2.4.2
+ >=dev-libs/mpc-0.8.1
+ >=sys-devel/gcc-config-1.4"
+# unlike every other target, hppa has not unified the 32/64 bit
+# ports in binutils yet
+DEPEND="${RDEPEND}
+ hppa? ( sys-devel/binutils-hppa64 )
+ !sys-devel/gcc-hppa64
+ !sys-devel/gcc-mips64
+ !sys-devel/gcc-powerpc64
+ !sys-devel/gcc-sparc64
+ >=sys-apps/texinfo-4.8
+ >=sys-devel/bison-1.875"
+
+pkg_postinst() {
+ toolchain_pkg_postinst
+
+ cd "${ROOT}"/usr/bin
+ local x
+ for x in gcc cpp ; do
+ cat <<-EOF >${CTARGET%%-*}-linux-${x}
+ #!/bin/sh
+ exec ${CTARGET}-${x} "\$@"
+ EOF
+ chmod a+rx ${CTARGET%%-*}-linux-${x}
+ done
+}
diff --git a/sys-devel/kgcc64/kgcc64-4.5.4.ebuild b/sys-devel/kgcc64/kgcc64-4.5.4.ebuild
new file mode 100644
index 000000000000..2f8dfdaaa1e6
--- /dev/null
+++ b/sys-devel/kgcc64/kgcc64-4.5.4.ebuild
@@ -0,0 +1,56 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+case ${CHOST} in
+ hppa*) CTARGET=hppa64-${CHOST#*-};;
+ mips*) CTARGET=${CHOST/mips/mips64};;
+ powerpc*) CTARGET=${CHOST/powerpc/powerpc64};;
+ s390*) CTARGET=${CHOST/s390/s390x};;
+ sparc*) CTARGET=${CHOST/sparc/sparc64};;
+ i?86*) CTARGET=x86_64-${CHOST#*-};;
+esac
+export CTARGET
+TOOLCHAIN_ALLOWED_LANGS="c"
+GCC_TARGET_NO_MULTILIB=true
+
+PATCH_VER="1.2"
+GCC_FILESDIR=${FILESDIR/${PN}/gcc}
+
+inherit eutils toolchain
+
+DESCRIPTION="64bit kernel compiler"
+
+# Works on mips and sparc; all other archs, refer to bug #228115
+KEYWORDS="~hppa ~sparc"
+
+RDEPEND=">=dev-libs/gmp-4.3.2
+ >=dev-libs/mpfr-2.4.2
+ >=dev-libs/mpc-0.8.1
+ >=sys-devel/gcc-config-1.4"
+# unlike every other target, hppa has not unified the 32/64 bit
+# ports in binutils yet
+DEPEND="${RDEPEND}
+ hppa? ( sys-devel/binutils-hppa64 )
+ !sys-devel/gcc-hppa64
+ !sys-devel/gcc-mips64
+ !sys-devel/gcc-powerpc64
+ !sys-devel/gcc-sparc64
+ >=sys-apps/texinfo-4.8
+ >=sys-devel/bison-1.875"
+
+pkg_postinst() {
+ toolchain_pkg_postinst
+
+ cd "${ROOT}"/usr/bin
+ local x
+ for x in gcc cpp ; do
+ cat <<-EOF >${CTARGET%%-*}-linux-${x}
+ #!/bin/sh
+ exec ${CTARGET}-${x} "\$@"
+ EOF
+ chmod a+rx ${CTARGET%%-*}-linux-${x}
+ done
+}
diff --git a/sys-devel/kgcc64/kgcc64-4.6.3.ebuild b/sys-devel/kgcc64/kgcc64-4.6.3.ebuild
new file mode 100644
index 000000000000..40251aafafa3
--- /dev/null
+++ b/sys-devel/kgcc64/kgcc64-4.6.3.ebuild
@@ -0,0 +1,56 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+case ${CHOST} in
+ hppa*) CTARGET=hppa64-${CHOST#*-};;
+ mips*) CTARGET=${CHOST/mips/mips64};;
+ powerpc*) CTARGET=${CHOST/powerpc/powerpc64};;
+ s390*) CTARGET=${CHOST/s390/s390x};;
+ sparc*) CTARGET=${CHOST/sparc/sparc64};;
+ i?86*) CTARGET=x86_64-${CHOST#*-};;
+esac
+export CTARGET
+TOOLCHAIN_ALLOWED_LANGS="c"
+GCC_TARGET_NO_MULTILIB=true
+
+PATCH_VER="1.9"
+GCC_FILESDIR=${FILESDIR/${PN}/gcc}
+
+inherit eutils toolchain
+
+DESCRIPTION="64bit kernel compiler"
+
+# Works on mips and sparc; all other archs, refer to bug #228115
+KEYWORDS="hppa ~sparc"
+
+RDEPEND=">=dev-libs/gmp-4.3.2
+ >=dev-libs/mpfr-2.4.2
+ >=dev-libs/mpc-0.8.1
+ >=sys-devel/gcc-config-1.4"
+# unlike every other target, hppa has not unified the 32/64 bit
+# ports in binutils yet
+DEPEND="${RDEPEND}
+ hppa? ( sys-devel/binutils-hppa64 )
+ !sys-devel/gcc-hppa64
+ !sys-devel/gcc-mips64
+ !sys-devel/gcc-powerpc64
+ !sys-devel/gcc-sparc64
+ >=sys-apps/texinfo-4.8
+ >=sys-devel/bison-1.875"
+
+pkg_postinst() {
+ toolchain_pkg_postinst
+
+ cd "${ROOT}"/usr/bin
+ local x
+ for x in gcc cpp ; do
+ cat <<-EOF >${CTARGET%%-*}-linux-${x}
+ #!/bin/sh
+ exec ${CTARGET}-${x} "\$@"
+ EOF
+ chmod a+rx ${CTARGET%%-*}-linux-${x}
+ done
+}
diff --git a/sys-devel/kgcc64/kgcc64-4.6.4.ebuild b/sys-devel/kgcc64/kgcc64-4.6.4.ebuild
new file mode 100644
index 000000000000..ecc185c6ff1e
--- /dev/null
+++ b/sys-devel/kgcc64/kgcc64-4.6.4.ebuild
@@ -0,0 +1,56 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+case ${CHOST} in
+ hppa*) CTARGET=hppa64-${CHOST#*-};;
+ mips*) CTARGET=${CHOST/mips/mips64};;
+ powerpc*) CTARGET=${CHOST/powerpc/powerpc64};;
+ s390*) CTARGET=${CHOST/s390/s390x};;
+ sparc*) CTARGET=${CHOST/sparc/sparc64};;
+ i?86*) CTARGET=x86_64-${CHOST#*-};;
+esac
+export CTARGET
+TOOLCHAIN_ALLOWED_LANGS="c"
+GCC_TARGET_NO_MULTILIB=true
+
+PATCH_VER="1.0"
+GCC_FILESDIR=${FILESDIR/${PN}/gcc}
+
+inherit eutils toolchain
+
+DESCRIPTION="64bit kernel compiler"
+
+# Works on mips and sparc; all other archs, refer to bug #228115
+KEYWORDS="~hppa ~sparc"
+
+RDEPEND=">=dev-libs/gmp-4.3.2
+ >=dev-libs/mpfr-2.4.2
+ >=dev-libs/mpc-0.8.1
+ >=sys-devel/gcc-config-1.4"
+# unlike every other target, hppa has not unified the 32/64 bit
+# ports in binutils yet
+DEPEND="${RDEPEND}
+ hppa? ( sys-devel/binutils-hppa64 )
+ !sys-devel/gcc-hppa64
+ !sys-devel/gcc-mips64
+ !sys-devel/gcc-powerpc64
+ !sys-devel/gcc-sparc64
+ >=sys-apps/texinfo-4.8
+ >=sys-devel/bison-1.875"
+
+pkg_postinst() {
+ toolchain_pkg_postinst
+
+ cd "${ROOT}"/usr/bin
+ local x
+ for x in gcc cpp ; do
+ cat <<-EOF >${CTARGET%%-*}-linux-${x}
+ #!/bin/sh
+ exec ${CTARGET}-${x} "\$@"
+ EOF
+ chmod a+rx ${CTARGET%%-*}-linux-${x}
+ done
+}
diff --git a/sys-devel/kgcc64/kgcc64-4.7.3.ebuild b/sys-devel/kgcc64/kgcc64-4.7.3.ebuild
new file mode 100644
index 000000000000..b21a54e3b69d
--- /dev/null
+++ b/sys-devel/kgcc64/kgcc64-4.7.3.ebuild
@@ -0,0 +1,56 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+case ${CHOST} in
+ hppa*) CTARGET=hppa64-${CHOST#*-};;
+ mips*) CTARGET=${CHOST/mips/mips64};;
+ powerpc*) CTARGET=${CHOST/powerpc/powerpc64};;
+ s390*) CTARGET=${CHOST/s390/s390x};;
+ sparc*) CTARGET=${CHOST/sparc/sparc64};;
+ i?86*) CTARGET=x86_64-${CHOST#*-};;
+esac
+export CTARGET
+TOOLCHAIN_ALLOWED_LANGS="c"
+GCC_TARGET_NO_MULTILIB=true
+
+PATCH_VER="1.3"
+GCC_FILESDIR=${FILESDIR/${PN}/gcc}
+
+inherit eutils toolchain
+
+DESCRIPTION="64bit kernel compiler"
+
+# Works on mips and sparc; all other archs, refer to bug #228115
+KEYWORDS="hppa sparc"
+
+RDEPEND=">=dev-libs/gmp-4.3.2
+ >=dev-libs/mpfr-2.4.2
+ >=dev-libs/mpc-0.8.1
+ >=sys-devel/gcc-config-1.4"
+# unlike every other target, hppa has not unified the 32/64 bit
+# ports in binutils yet
+DEPEND="${RDEPEND}
+ hppa? ( sys-devel/binutils-hppa64 )
+ !sys-devel/gcc-hppa64
+ !sys-devel/gcc-mips64
+ !sys-devel/gcc-powerpc64
+ !sys-devel/gcc-sparc64
+ >=sys-apps/texinfo-4.8
+ >=sys-devel/bison-1.875"
+
+pkg_postinst() {
+ toolchain_pkg_postinst
+
+ cd "${ROOT}"/usr/bin
+ local x
+ for x in gcc cpp ; do
+ cat <<-EOF >${CTARGET%%-*}-linux-${x}
+ #!/bin/sh
+ exec ${CTARGET}-${x} "\$@"
+ EOF
+ chmod a+rx ${CTARGET%%-*}-linux-${x}
+ done
+}
diff --git a/sys-devel/kgcc64/kgcc64-4.7.4.ebuild b/sys-devel/kgcc64/kgcc64-4.7.4.ebuild
new file mode 100644
index 000000000000..9002ad40d854
--- /dev/null
+++ b/sys-devel/kgcc64/kgcc64-4.7.4.ebuild
@@ -0,0 +1,63 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+case ${CHOST} in
+ hppa*) CTARGET=hppa64-${CHOST#*-};;
+ mips*) CTARGET=${CHOST/mips/mips64};;
+ powerpc*) CTARGET=${CHOST/powerpc/powerpc64};;
+ s390*) CTARGET=${CHOST/s390/s390x};;
+ sparc*) CTARGET=${CHOST/sparc/sparc64};;
+ i?86*) CTARGET=x86_64-${CHOST#*-};;
+esac
+export CTARGET
+TOOLCHAIN_ALLOWED_LANGS="c"
+GCC_TARGET_NO_MULTILIB=true
+
+PATCH_VER="1.0"
+GCC_FILESDIR=${FILESDIR/${PN}/gcc}
+
+inherit eutils toolchain
+
+DESCRIPTION="64bit kernel compiler"
+
+# Works on mips and sparc; all other archs, refer to bug #228115
+KEYWORDS="~hppa ~mips ~sparc"
+
+RDEPEND=">=dev-libs/gmp-4.3.2
+ >=dev-libs/mpfr-2.4.2
+ >=dev-libs/mpc-0.8.1
+ >=sys-devel/gcc-config-1.4"
+# unlike every other target, hppa has not unified the 32/64 bit
+# ports in binutils yet
+DEPEND="${RDEPEND}
+ hppa? ( sys-devel/binutils-hppa64 )
+ !sys-devel/gcc-hppa64
+ !sys-devel/gcc-mips64
+ !sys-devel/gcc-powerpc64
+ !sys-devel/gcc-sparc64
+ >=sys-apps/texinfo-4.8
+ >=sys-devel/bison-1.875"
+
+src_prepare() {
+ EPATCH_EXCLUDE+=" 10_all_default-fortify-source.patch"
+ EPATCH_EXCLUDE+=" 90_all_gcc-4.7-x32.patch"
+
+ toolchain_src_prepare
+}
+
+pkg_postinst() {
+ toolchain_pkg_postinst
+
+ cd "${ROOT}"/usr/bin
+ local x
+ for x in gcc cpp ; do
+ cat <<-EOF >${CTARGET%%-*}-linux-${x}
+ #!/bin/sh
+ exec ${CTARGET}-${x} "\$@"
+ EOF
+ chmod a+rx ${CTARGET%%-*}-linux-${x}
+ done
+}
diff --git a/sys-devel/kgcc64/kgcc64-4.8.1.ebuild b/sys-devel/kgcc64/kgcc64-4.8.1.ebuild
new file mode 100644
index 000000000000..2f8dfdaaa1e6
--- /dev/null
+++ b/sys-devel/kgcc64/kgcc64-4.8.1.ebuild
@@ -0,0 +1,56 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+case ${CHOST} in
+ hppa*) CTARGET=hppa64-${CHOST#*-};;
+ mips*) CTARGET=${CHOST/mips/mips64};;
+ powerpc*) CTARGET=${CHOST/powerpc/powerpc64};;
+ s390*) CTARGET=${CHOST/s390/s390x};;
+ sparc*) CTARGET=${CHOST/sparc/sparc64};;
+ i?86*) CTARGET=x86_64-${CHOST#*-};;
+esac
+export CTARGET
+TOOLCHAIN_ALLOWED_LANGS="c"
+GCC_TARGET_NO_MULTILIB=true
+
+PATCH_VER="1.2"
+GCC_FILESDIR=${FILESDIR/${PN}/gcc}
+
+inherit eutils toolchain
+
+DESCRIPTION="64bit kernel compiler"
+
+# Works on mips and sparc; all other archs, refer to bug #228115
+KEYWORDS="~hppa ~sparc"
+
+RDEPEND=">=dev-libs/gmp-4.3.2
+ >=dev-libs/mpfr-2.4.2
+ >=dev-libs/mpc-0.8.1
+ >=sys-devel/gcc-config-1.4"
+# unlike every other target, hppa has not unified the 32/64 bit
+# ports in binutils yet
+DEPEND="${RDEPEND}
+ hppa? ( sys-devel/binutils-hppa64 )
+ !sys-devel/gcc-hppa64
+ !sys-devel/gcc-mips64
+ !sys-devel/gcc-powerpc64
+ !sys-devel/gcc-sparc64
+ >=sys-apps/texinfo-4.8
+ >=sys-devel/bison-1.875"
+
+pkg_postinst() {
+ toolchain_pkg_postinst
+
+ cd "${ROOT}"/usr/bin
+ local x
+ for x in gcc cpp ; do
+ cat <<-EOF >${CTARGET%%-*}-linux-${x}
+ #!/bin/sh
+ exec ${CTARGET}-${x} "\$@"
+ EOF
+ chmod a+rx ${CTARGET%%-*}-linux-${x}
+ done
+}
diff --git a/sys-devel/kgcc64/kgcc64-4.8.2.ebuild b/sys-devel/kgcc64/kgcc64-4.8.2.ebuild
new file mode 100644
index 000000000000..ecc185c6ff1e
--- /dev/null
+++ b/sys-devel/kgcc64/kgcc64-4.8.2.ebuild
@@ -0,0 +1,56 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+case ${CHOST} in
+ hppa*) CTARGET=hppa64-${CHOST#*-};;
+ mips*) CTARGET=${CHOST/mips/mips64};;
+ powerpc*) CTARGET=${CHOST/powerpc/powerpc64};;
+ s390*) CTARGET=${CHOST/s390/s390x};;
+ sparc*) CTARGET=${CHOST/sparc/sparc64};;
+ i?86*) CTARGET=x86_64-${CHOST#*-};;
+esac
+export CTARGET
+TOOLCHAIN_ALLOWED_LANGS="c"
+GCC_TARGET_NO_MULTILIB=true
+
+PATCH_VER="1.0"
+GCC_FILESDIR=${FILESDIR/${PN}/gcc}
+
+inherit eutils toolchain
+
+DESCRIPTION="64bit kernel compiler"
+
+# Works on mips and sparc; all other archs, refer to bug #228115
+KEYWORDS="~hppa ~sparc"
+
+RDEPEND=">=dev-libs/gmp-4.3.2
+ >=dev-libs/mpfr-2.4.2
+ >=dev-libs/mpc-0.8.1
+ >=sys-devel/gcc-config-1.4"
+# unlike every other target, hppa has not unified the 32/64 bit
+# ports in binutils yet
+DEPEND="${RDEPEND}
+ hppa? ( sys-devel/binutils-hppa64 )
+ !sys-devel/gcc-hppa64
+ !sys-devel/gcc-mips64
+ !sys-devel/gcc-powerpc64
+ !sys-devel/gcc-sparc64
+ >=sys-apps/texinfo-4.8
+ >=sys-devel/bison-1.875"
+
+pkg_postinst() {
+ toolchain_pkg_postinst
+
+ cd "${ROOT}"/usr/bin
+ local x
+ for x in gcc cpp ; do
+ cat <<-EOF >${CTARGET%%-*}-linux-${x}
+ #!/bin/sh
+ exec ${CTARGET}-${x} "\$@"
+ EOF
+ chmod a+rx ${CTARGET%%-*}-linux-${x}
+ done
+}
diff --git a/sys-devel/kgcc64/kgcc64-4.8.3.ebuild b/sys-devel/kgcc64/kgcc64-4.8.3.ebuild
new file mode 100644
index 000000000000..71a8f1afb1b1
--- /dev/null
+++ b/sys-devel/kgcc64/kgcc64-4.8.3.ebuild
@@ -0,0 +1,56 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+case ${CHOST} in
+ hppa*) CTARGET=hppa64-${CHOST#*-};;
+ mips*) CTARGET=${CHOST/mips/mips64};;
+ powerpc*) CTARGET=${CHOST/powerpc/powerpc64};;
+ s390*) CTARGET=${CHOST/s390/s390x};;
+ sparc*) CTARGET=${CHOST/sparc/sparc64};;
+ i?86*) CTARGET=x86_64-${CHOST#*-};;
+esac
+export CTARGET
+TOOLCHAIN_ALLOWED_LANGS="c"
+GCC_TARGET_NO_MULTILIB=true
+
+PATCH_VER="1.1"
+GCC_FILESDIR=${FILESDIR/${PN}/gcc}
+
+inherit eutils toolchain
+
+DESCRIPTION="64bit kernel compiler"
+
+# Works on mips and sparc; all other archs, refer to bug #228115
+KEYWORDS="hppa ~sparc"
+
+RDEPEND=">=dev-libs/gmp-4.3.2
+ >=dev-libs/mpfr-2.4.2
+ >=dev-libs/mpc-0.8.1
+ >=sys-devel/gcc-config-1.4"
+# unlike every other target, hppa has not unified the 32/64 bit
+# ports in binutils yet
+DEPEND="${RDEPEND}
+ hppa? ( sys-devel/binutils-hppa64 )
+ !sys-devel/gcc-hppa64
+ !sys-devel/gcc-mips64
+ !sys-devel/gcc-powerpc64
+ !sys-devel/gcc-sparc64
+ >=sys-apps/texinfo-4.8
+ >=sys-devel/bison-1.875"
+
+pkg_postinst() {
+ toolchain_pkg_postinst
+
+ cd "${ROOT}"/usr/bin
+ local x
+ for x in gcc cpp ; do
+ cat <<-EOF >${CTARGET%%-*}-linux-${x}
+ #!/bin/sh
+ exec ${CTARGET}-${x} "\$@"
+ EOF
+ chmod a+rx ${CTARGET%%-*}-linux-${x}
+ done
+}
diff --git a/sys-devel/kgcc64/kgcc64-4.9.1.ebuild b/sys-devel/kgcc64/kgcc64-4.9.1.ebuild
new file mode 100644
index 000000000000..32867f327207
--- /dev/null
+++ b/sys-devel/kgcc64/kgcc64-4.9.1.ebuild
@@ -0,0 +1,56 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+case ${CHOST} in
+ hppa*) CTARGET=hppa64-${CHOST#*-};;
+ mips*) CTARGET=${CHOST/mips/mips64};;
+ powerpc*) CTARGET=${CHOST/powerpc/powerpc64};;
+ s390*) CTARGET=${CHOST/s390/s390x};;
+ sparc*) CTARGET=${CHOST/sparc/sparc64};;
+ i?86*) CTARGET=x86_64-${CHOST#*-};;
+esac
+export CTARGET
+TOOLCHAIN_ALLOWED_LANGS="c"
+GCC_TARGET_NO_MULTILIB=true
+
+PATCH_VER="1.0"
+GCC_FILESDIR=${FILESDIR/${PN}/gcc}
+
+inherit eutils toolchain
+
+DESCRIPTION="64bit kernel compiler"
+
+# Works on mips and sparc; all other archs, refer to bug #228115
+KEYWORDS="~hppa"
+
+RDEPEND=">=dev-libs/gmp-4.3.2
+ >=dev-libs/mpfr-2.4.2
+ >=dev-libs/mpc-0.8.1
+ >=sys-devel/gcc-config-1.4"
+# unlike every other target, hppa has not unified the 32/64 bit
+# ports in binutils yet
+DEPEND="${RDEPEND}
+ hppa? ( sys-devel/binutils-hppa64 )
+ !sys-devel/gcc-hppa64
+ !sys-devel/gcc-mips64
+ !sys-devel/gcc-powerpc64
+ !sys-devel/gcc-sparc64
+ >=sys-apps/texinfo-4.8
+ >=sys-devel/bison-1.875"
+
+pkg_postinst() {
+ toolchain_pkg_postinst
+
+ cd "${ROOT}"/usr/bin
+ local x
+ for x in gcc cpp ; do
+ cat <<-EOF >${CTARGET%%-*}-linux-${x}
+ #!/bin/sh
+ exec ${CTARGET}-${x} "\$@"
+ EOF
+ chmod a+rx ${CTARGET%%-*}-linux-${x}
+ done
+}
diff --git a/sys-devel/kgcc64/kgcc64-4.9.2.ebuild b/sys-devel/kgcc64/kgcc64-4.9.2.ebuild
new file mode 100644
index 000000000000..52d8d573d1a6
--- /dev/null
+++ b/sys-devel/kgcc64/kgcc64-4.9.2.ebuild
@@ -0,0 +1,56 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+case ${CHOST} in
+ hppa*) CTARGET=hppa64-${CHOST#*-};;
+ mips*) CTARGET=${CHOST/mips/mips64};;
+ powerpc*) CTARGET=${CHOST/powerpc/powerpc64};;
+ s390*) CTARGET=${CHOST/s390/s390x};;
+ sparc*) CTARGET=${CHOST/sparc/sparc64};;
+ i?86*) CTARGET=x86_64-${CHOST#*-};;
+esac
+export CTARGET
+TOOLCHAIN_ALLOWED_LANGS="c"
+GCC_TARGET_NO_MULTILIB=true
+
+PATCH_VER="1.2"
+GCC_FILESDIR=${FILESDIR/${PN}/gcc}
+
+inherit eutils toolchain
+
+DESCRIPTION="64bit kernel compiler"
+
+# Works on mips and sparc; all other archs, refer to bug #228115
+KEYWORDS="~hppa ~mips"
+
+RDEPEND=">=dev-libs/gmp-4.3.2
+ >=dev-libs/mpfr-2.4.2
+ >=dev-libs/mpc-0.8.1
+ >=sys-devel/gcc-config-1.4"
+# unlike every other target, hppa has not unified the 32/64 bit
+# ports in binutils yet
+DEPEND="${RDEPEND}
+ hppa? ( sys-devel/binutils-hppa64 )
+ !sys-devel/gcc-hppa64
+ !sys-devel/gcc-mips64
+ !sys-devel/gcc-powerpc64
+ !sys-devel/gcc-sparc64
+ >=sys-apps/texinfo-4.8
+ >=sys-devel/bison-1.875"
+
+pkg_postinst() {
+ toolchain_pkg_postinst
+
+ cd "${ROOT}"/usr/bin
+ local x
+ for x in gcc cpp ; do
+ cat <<-EOF >${CTARGET%%-*}-linux-${x}
+ #!/bin/sh
+ exec ${CTARGET}-${x} "\$@"
+ EOF
+ chmod a+rx ${CTARGET%%-*}-linux-${x}
+ done
+}
diff --git a/sys-devel/kgcc64/metadata.xml b/sys-devel/kgcc64/metadata.xml
new file mode 100644
index 000000000000..b97a1e08f5bd
--- /dev/null
+++ b/sys-devel/kgcc64/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>toolchain</herd>
+<use>
+<flag name='multislot'>Allow for SLOTs to include minor version (eg. 3.3.4 instead
+of just 3.3)</flag>
+<flag name="regression-test">Run the testsuite and install the results (requires FEATURES=test)</flag>
+</use>
+</pkgmetadata>
+
diff --git a/sys-devel/libtool/Manifest b/sys-devel/libtool/Manifest
new file mode 100644
index 000000000000..ba9189f74af6
--- /dev/null
+++ b/sys-devel/libtool/Manifest
@@ -0,0 +1,4 @@
+DIST libtool-2.4.2.tar.xz 868760 SHA256 1d7b6862c1ed162e327f083a6f78f40eae29218f0db8c38393d61dab764c4407 SHA512 34f2d4a32beb4d85cfefd9c2c4ff33b0117e9e89c6599c303a7b850c43be5ed090b2f530388b8c8154e8f3f693abd2079180dca9afc948feb800b2e009bed169 WHIRLPOOL 300697c30b6cf693463338ee3bfe10b9ccce2c496b319862182124828caf7b667a7e9cf21f287572ec1fed8abe529a14d171da2983369522faf3eed5513a1af5
+DIST libtool-2.4.4.tar.xz 957476 SHA256 a8295b5853bf82a46635c944031e84970f2aa79c19df7a0c28f3ec8e11c07f6c SHA512 1ff24aa88962e0aae82e1fff41df7863f925627a506c6a663a79afa23729272aa4e5816889dd4697d5286d42483bcee2cc7352514768f1bd28ea546476074a84 WHIRLPOOL def0381a3608b52f8f5e9b83d297643d48d3e695117199b10b4ae3d6f5b11f3d3a36c4b6572b7659061c3fee77e46da4f5e3cfffa594063fed0fe382869c3539
+DIST libtool-2.4.5.tar.xz 971620 SHA256 84aac136513b009278896ffa255e4d685bcdb0cb0e5363be36adad64c986177e SHA512 67ceb387e33fbf0ffe6df422cd26939e305a365bb22674ce064ed7f7d6602054682515b014e290c70587b7f9b6f85f00fac31d6f000b4b022daaa2b343c17327 WHIRLPOOL 4a5171a8f23d50b78eb70bbd2ff9497fe2a970933392c65c41ab44600838cdc744e4e9ddfef37ac009cf5784de8c7b1ef061f8156919b7417e78529978afe7ed
+DIST libtool-2.4.6.tar.xz 973080 SHA256 7c87a8c2c8c0fc9cd5019e402bed4292462d00a718a7cd5f11218153bf28b26f SHA512 a6eef35f3cbccf2c9e2667f44a476ebc80ab888725eb768e91a3a6c33b8c931afc46eb23efaee76c8696d3e4eed74ab1c71157bcb924f38ee912c8a90a6521a4 WHIRLPOOL f6e1ea25cc8dd853f0de53c045bcd1166cfede9cb0e890079c2c05e6cbdb5e705e137f83ba32f7e16691b9c9108e9cfb2d14ed030cea07b6eacbe3f1ae18a73b
diff --git a/sys-devel/libtool/files/1.5.20/libtool-1.5.20-use-linux-version-in-fbsd.patch b/sys-devel/libtool/files/1.5.20/libtool-1.5.20-use-linux-version-in-fbsd.patch
new file mode 100644
index 000000000000..cc9d8b82d61c
--- /dev/null
+++ b/sys-devel/libtool/files/1.5.20/libtool-1.5.20-use-linux-version-in-fbsd.patch
@@ -0,0 +1,38 @@
+Force linux-style versioning when generating shared libraries on
+Gentoo/FreeBSD hosts only.
+
+Patch by Diego Petten
+
+http://bugs.gentoo.org/109105
+
+--- libtool-1.5.20/libtool.m4
++++ libtool-1.5.20/libtool.m4
+@@ -1375,7 +1375,14 @@ freebsd* | dragonfly*)
+ *) objformat=elf ;;
+ esac
+ fi
+- version_type=freebsd-$objformat
++ # Handle Gentoo/FreeBSD as it was Linux
++ case $host_vendor in
++ gentoo)
++ version_type=linux ;;
++ *)
++ version_type=freebsd-$objformat ;;
++ esac
++
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+@@ -1386,6 +1392,12 @@ freebsd* | dragonfly*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+ need_version=yes
+ ;;
++ linux)
++ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
++ soname_spec='${libname}${release}${shared_ext}$major'
++ need_lib_prefix=no
++ need_version=no
++ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
diff --git a/sys-devel/libtool/files/libtool-2.4.3-use-linux-version-in-fbsd.patch b/sys-devel/libtool/files/libtool-2.4.3-use-linux-version-in-fbsd.patch
new file mode 100644
index 000000000000..8244eaa7e3e7
--- /dev/null
+++ b/sys-devel/libtool/files/libtool-2.4.3-use-linux-version-in-fbsd.patch
@@ -0,0 +1,38 @@
+Force linux-style versioning when generating shared libraries on
+Gentoo/FreeBSD hosts only.
+
+Patch by Diego Elio Pettenò
+
+http://bugs.gentoo.org/109105
+
+--- a/m4/libtool.m4
++++ b/m4/libtool.m4
+@@ -1375,7 +1375,14 @@
+ *) objformat=elf ;;
+ esac
+ fi
+- version_type=freebsd-$objformat
++ # Handle Gentoo/FreeBSD as it was Linux
++ case $host_vendor in
++ gentoo)
++ version_type=linux ;;
++ *)
++ version_type=freebsd-$objformat ;;
++ esac
++
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+@@ -1386,6 +1392,12 @@
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+ need_version=yes
+ ;;
++ linux)
++ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
++ soname_spec='${libname}${release}${shared_ext}$major'
++ need_lib_prefix=no
++ need_version=no
++ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
diff --git a/sys-devel/libtool/files/libtool-2.4.6-fuse-ld.patch b/sys-devel/libtool/files/libtool-2.4.6-fuse-ld.patch
new file mode 100644
index 000000000000..eb8ee07b6c9a
--- /dev/null
+++ b/sys-devel/libtool/files/libtool-2.4.6-fuse-ld.patch
@@ -0,0 +1,34 @@
+From 2f258b87ce4415edede1b2a84a3a7dbcf44555c2 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Mon, 16 Mar 2015 18:17:31 -0400
+Subject: [PATCH] libtool: pass through -fuse-ld flags
+
+Starting with gcc-4.8, there's a -fuse-ld flag that can be used to select
+between bfd & gold. Make sure we pass it through to the linking stage.
+
+* build-aux/ltmain.in (func_mode_link): Pass -fuse-ld=* flags through.
+---
+ build-aux/ltmain.in | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
+index d5cf07a..0fc8279 100644
+--- a/build-aux/ltmain.in
++++ b/build-aux/ltmain.in
+@@ -5360,10 +5360,12 @@ func_mode_link ()
+ # -tp=* Portland pgcc target processor selection
+ # --sysroot=* for sysroot support
+ # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
++ # -fuse-ld=* Linker select flags for GCC
+ # -stdlib=* select c++ std lib with clang
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
+- -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*)
++ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
++ -fuse-ld=*)
+ func_quote_for_eval "$arg"
+ arg=$func_quote_for_eval_result
+ func_append compile_command " $arg"
+--
+2.3.2
+
diff --git a/sys-devel/libtool/libtool-2.4.2-r1.ebuild b/sys-devel/libtool/libtool-2.4.2-r1.ebuild
new file mode 100644
index 000000000000..976c063084d2
--- /dev/null
+++ b/sys-devel/libtool/libtool-2.4.2-r1.ebuild
@@ -0,0 +1,96 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+LIBTOOLIZE="true" #225559
+WANT_LIBTOOL="none"
+inherit eutils autotools multilib unpacker multilib-minimal
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://git.savannah.gnu.org/${PN}.git
+ http://git.savannah.gnu.org/r/${PN}.git"
+ inherit git-2
+else
+ SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
+ KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+fi
+
+DESCRIPTION="A shared library tool for developers"
+HOMEPAGE="http://www.gnu.org/software/libtool/"
+
+LICENSE="GPL-2"
+SLOT="2"
+IUSE="static-libs test vanilla"
+
+RDEPEND="sys-devel/gnuconfig
+ !<sys-devel/autoconf-2.62:2.5
+ !<sys-devel/automake-1.11.1:1.11
+ !=sys-devel/libtool-2*:1.5
+ abi_x86_32? (
+ !<=app-emulation/emul-linux-x86-baselibs-20140406-r2
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ )"
+DEPEND="${RDEPEND}
+ test? ( !<sys-devel/binutils-2.20 )
+ app-arch/xz-utils"
+[[ ${PV} == "9999" ]] && DEPEND+=" sys-apps/help2man"
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ git-2_src_unpack
+ cd "${S}"
+ ./bootstrap || die
+ else
+ unpacker_src_unpack
+ fi
+}
+
+src_prepare() {
+ use vanilla && return 0
+
+ cd libltdl/m4
+ epatch "${FILESDIR}"/1.5.20/${PN}-1.5.20-use-linux-version-in-fbsd.patch #109105
+ cd ..
+ AT_NOELIBTOOLIZE=yes eautoreconf
+ cd ..
+ AT_NOELIBTOOLIZE=yes eautoreconf
+ epunt_cxx
+}
+
+multilib_src_configure() {
+ # the libtool script uses bash code in it and at configure time, tries
+ # to find a bash shell. if /bin/sh is bash, it uses that. this can
+ # cause problems for people who switch /bin/sh on the fly to other
+ # shells, so just force libtool to use /bin/bash all the time.
+ export CONFIG_SHELL=/bin/bash
+ ECONF_SOURCE="${S}" \
+ econf $(use_enable static-libs static)
+}
+
+multilib_src_install_all() {
+ dodoc AUTHORS ChangeLog* NEWS README THANKS TODO doc/PLATFORMS
+
+ # While the libltdl.la file is not used directly, the m4 ltdl logic
+ # keys off of its existence when searching for ltdl support. #293921
+ #use static-libs || find "${D}" -name libltdl.la -delete
+
+ # Building libtool with --disable-static will cause the installed
+ # helper to not build static objects by default. This is undesirable
+ # for crappy packages that utilize the system libtool, so undo that.
+ sed -i -e '1,/^build_old_libs=/{/^build_old_libs=/{s:=.*:=yes:}}' "${D}"/usr/bin/libtool || die
+
+ local x
+ for x in $(find "${D}" -name config.guess -o -name config.sub) ; do
+ ln -sf /usr/share/gnuconfig/${x##*/} "${x}" || die
+ done
+}
+
+pkg_preinst() {
+ preserve_old_lib /usr/$(get_libdir)/libltdl.so.3
+}
+
+pkg_postinst() {
+ preserve_old_lib_notify /usr/$(get_libdir)/libltdl.so.3
+}
diff --git a/sys-devel/libtool/libtool-2.4.4.ebuild b/sys-devel/libtool/libtool-2.4.4.ebuild
new file mode 100644
index 000000000000..987e4abd9e07
--- /dev/null
+++ b/sys-devel/libtool/libtool-2.4.4.ebuild
@@ -0,0 +1,77 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+LIBTOOLIZE="true" #225559
+WANT_LIBTOOL="none"
+inherit eutils autotools multilib unpacker
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://git.savannah.gnu.org/${PN}.git
+ http://git.savannah.gnu.org/r/${PN}.git"
+ inherit git-2
+else
+ SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
+ KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+fi
+
+DESCRIPTION="A shared library tool for developers"
+HOMEPAGE="http://www.gnu.org/software/libtool/"
+
+LICENSE="GPL-2"
+SLOT="2"
+IUSE="vanilla"
+
+# Pull in libltdl directly until we convert packages to the new dep.
+RDEPEND="sys-devel/gnuconfig
+ >=sys-devel/autoconf-2.69
+ >=sys-devel/automake-1.13
+ dev-libs/libltdl:0"
+DEPEND="${RDEPEND}
+ app-arch/xz-utils"
+[[ ${PV} == "9999" ]] && DEPEND+=" sys-apps/help2man"
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ git-2_src_unpack
+ cd "${S}"
+ ./bootstrap || die
+ else
+ unpacker_src_unpack
+ fi
+}
+
+src_prepare() {
+ use vanilla && return 0
+
+ epatch "${FILESDIR}"/${PN}-2.4.3-use-linux-version-in-fbsd.patch #109105
+ pushd libltdl >/dev/null
+ AT_NOELIBTOOLIZE=yes eautoreconf
+ popd >/dev/null
+ AT_NOELIBTOOLIZE=yes eautoreconf
+ epunt_cxx
+}
+
+src_configure() {
+ # the libtool script uses bash code in it and at configure time, tries
+ # to find a bash shell. if /bin/sh is bash, it uses that. this can
+ # cause problems for people who switch /bin/sh on the fly to other
+ # shells, so just force libtool to use /bin/bash all the time.
+ export CONFIG_SHELL=/bin/bash
+ ECONF_SOURCE=${S} econf --disable-ltdl-install
+}
+
+src_test() {
+ emake check
+}
+
+src_install() {
+ default
+
+ local x
+ while read -d $'\0' -r x ; do
+ ln -sf "${EPREFIX}"/usr/share/gnuconfig/${x##*/} "${x}" || die
+ done < <(find "${ED}" '(' -name config.guess -o -name config.sub ')' -print0)
+}
diff --git a/sys-devel/libtool/libtool-2.4.5.ebuild b/sys-devel/libtool/libtool-2.4.5.ebuild
new file mode 100644
index 000000000000..3aeb045abfbc
--- /dev/null
+++ b/sys-devel/libtool/libtool-2.4.5.ebuild
@@ -0,0 +1,77 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+LIBTOOLIZE="true" #225559
+WANT_LIBTOOL="none"
+inherit eutils autotools multilib unpacker
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://git.savannah.gnu.org/${PN}.git
+ http://git.savannah.gnu.org/r/${PN}.git"
+ inherit git-2
+else
+ SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+fi
+
+DESCRIPTION="A shared library tool for developers"
+HOMEPAGE="http://www.gnu.org/software/libtool/"
+
+LICENSE="GPL-2"
+SLOT="2"
+IUSE="vanilla"
+
+# Pull in libltdl directly until we convert packages to the new dep.
+RDEPEND="sys-devel/gnuconfig
+ >=sys-devel/autoconf-2.69
+ >=sys-devel/automake-1.13
+ dev-libs/libltdl:0"
+DEPEND="${RDEPEND}
+ app-arch/xz-utils"
+[[ ${PV} == "9999" ]] && DEPEND+=" sys-apps/help2man"
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ git-2_src_unpack
+ cd "${S}"
+ ./bootstrap || die
+ else
+ unpacker_src_unpack
+ fi
+}
+
+src_prepare() {
+ use vanilla && return 0
+
+ epatch "${FILESDIR}"/${PN}-2.4.3-use-linux-version-in-fbsd.patch #109105
+ pushd libltdl >/dev/null
+ AT_NOELIBTOOLIZE=yes eautoreconf
+ popd >/dev/null
+ AT_NOELIBTOOLIZE=yes eautoreconf
+ epunt_cxx
+}
+
+src_configure() {
+ # the libtool script uses bash code in it and at configure time, tries
+ # to find a bash shell. if /bin/sh is bash, it uses that. this can
+ # cause problems for people who switch /bin/sh on the fly to other
+ # shells, so just force libtool to use /bin/bash all the time.
+ export CONFIG_SHELL=/bin/bash
+ ECONF_SOURCE=${S} econf --disable-ltdl-install
+}
+
+src_test() {
+ emake check
+}
+
+src_install() {
+ default
+
+ local x
+ while read -d $'\0' -r x ; do
+ ln -sf "${EPREFIX}"/usr/share/gnuconfig/${x##*/} "${x}" || die
+ done < <(find "${ED}" '(' -name config.guess -o -name config.sub ')' -print0)
+}
diff --git a/sys-devel/libtool/libtool-2.4.6-r1.ebuild b/sys-devel/libtool/libtool-2.4.6-r1.ebuild
new file mode 100644
index 000000000000..2e17e918cd37
--- /dev/null
+++ b/sys-devel/libtool/libtool-2.4.6-r1.ebuild
@@ -0,0 +1,78 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+LIBTOOLIZE="true" #225559
+WANT_LIBTOOL="none"
+inherit eutils autotools multilib unpacker
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://git.savannah.gnu.org/${PN}.git
+ http://git.savannah.gnu.org/r/${PN}.git"
+ inherit git-2
+else
+ SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+fi
+
+DESCRIPTION="A shared library tool for developers"
+HOMEPAGE="http://www.gnu.org/software/libtool/"
+
+LICENSE="GPL-2"
+SLOT="2"
+IUSE="vanilla"
+
+# Pull in libltdl directly until we convert packages to the new dep.
+RDEPEND="sys-devel/gnuconfig
+ >=sys-devel/autoconf-2.69
+ >=sys-devel/automake-1.13
+ dev-libs/libltdl:0"
+DEPEND="${RDEPEND}
+ app-arch/xz-utils"
+[[ ${PV} == "9999" ]] && DEPEND+=" sys-apps/help2man"
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ git-2_src_unpack
+ cd "${S}"
+ ./bootstrap || die
+ else
+ unpacker_src_unpack
+ fi
+}
+
+src_prepare() {
+ use vanilla && return 0
+
+ epatch "${FILESDIR}"/${PN}-2.4.3-use-linux-version-in-fbsd.patch #109105
+ epatch "${FILESDIR}"/${P}-fuse-ld.patch
+ pushd libltdl >/dev/null
+ AT_NOELIBTOOLIZE=yes eautoreconf
+ popd >/dev/null
+ AT_NOELIBTOOLIZE=yes eautoreconf
+ epunt_cxx
+}
+
+src_configure() {
+ # the libtool script uses bash code in it and at configure time, tries
+ # to find a bash shell. if /bin/sh is bash, it uses that. this can
+ # cause problems for people who switch /bin/sh on the fly to other
+ # shells, so just force libtool to use /bin/bash all the time.
+ export CONFIG_SHELL=/bin/bash
+ ECONF_SOURCE=${S} econf --disable-ltdl-install
+}
+
+src_test() {
+ emake check
+}
+
+src_install() {
+ default
+
+ local x
+ while read -d $'\0' -r x ; do
+ ln -sf "${EPREFIX}"/usr/share/gnuconfig/${x##*/} "${x}" || die
+ done < <(find "${ED}" '(' -name config.guess -o -name config.sub ')' -print0)
+}
diff --git a/sys-devel/libtool/libtool-2.4.6.ebuild b/sys-devel/libtool/libtool-2.4.6.ebuild
new file mode 100644
index 000000000000..987e4abd9e07
--- /dev/null
+++ b/sys-devel/libtool/libtool-2.4.6.ebuild
@@ -0,0 +1,77 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+LIBTOOLIZE="true" #225559
+WANT_LIBTOOL="none"
+inherit eutils autotools multilib unpacker
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://git.savannah.gnu.org/${PN}.git
+ http://git.savannah.gnu.org/r/${PN}.git"
+ inherit git-2
+else
+ SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
+ KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+fi
+
+DESCRIPTION="A shared library tool for developers"
+HOMEPAGE="http://www.gnu.org/software/libtool/"
+
+LICENSE="GPL-2"
+SLOT="2"
+IUSE="vanilla"
+
+# Pull in libltdl directly until we convert packages to the new dep.
+RDEPEND="sys-devel/gnuconfig
+ >=sys-devel/autoconf-2.69
+ >=sys-devel/automake-1.13
+ dev-libs/libltdl:0"
+DEPEND="${RDEPEND}
+ app-arch/xz-utils"
+[[ ${PV} == "9999" ]] && DEPEND+=" sys-apps/help2man"
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ git-2_src_unpack
+ cd "${S}"
+ ./bootstrap || die
+ else
+ unpacker_src_unpack
+ fi
+}
+
+src_prepare() {
+ use vanilla && return 0
+
+ epatch "${FILESDIR}"/${PN}-2.4.3-use-linux-version-in-fbsd.patch #109105
+ pushd libltdl >/dev/null
+ AT_NOELIBTOOLIZE=yes eautoreconf
+ popd >/dev/null
+ AT_NOELIBTOOLIZE=yes eautoreconf
+ epunt_cxx
+}
+
+src_configure() {
+ # the libtool script uses bash code in it and at configure time, tries
+ # to find a bash shell. if /bin/sh is bash, it uses that. this can
+ # cause problems for people who switch /bin/sh on the fly to other
+ # shells, so just force libtool to use /bin/bash all the time.
+ export CONFIG_SHELL=/bin/bash
+ ECONF_SOURCE=${S} econf --disable-ltdl-install
+}
+
+src_test() {
+ emake check
+}
+
+src_install() {
+ default
+
+ local x
+ while read -d $'\0' -r x ; do
+ ln -sf "${EPREFIX}"/usr/share/gnuconfig/${x##*/} "${x}" || die
+ done < <(find "${ED}" '(' -name config.guess -o -name config.sub ')' -print0)
+}
diff --git a/sys-devel/libtool/libtool-9999.ebuild b/sys-devel/libtool/libtool-9999.ebuild
new file mode 100644
index 000000000000..dd79ff7f4dde
--- /dev/null
+++ b/sys-devel/libtool/libtool-9999.ebuild
@@ -0,0 +1,75 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+LIBTOOLIZE="true" #225559
+WANT_LIBTOOL="none"
+inherit eutils autotools multilib unpacker
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://git.savannah.gnu.org/${PN}.git
+ http://git.savannah.gnu.org/r/${PN}.git"
+ inherit git-2
+else
+ SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+fi
+
+DESCRIPTION="A shared library tool for developers"
+HOMEPAGE="http://www.gnu.org/software/libtool/"
+
+LICENSE="GPL-2"
+SLOT="2"
+IUSE="vanilla"
+
+RDEPEND="sys-devel/gnuconfig
+ >=sys-devel/autoconf-2.69
+ >=sys-devel/automake-1.13"
+DEPEND="${RDEPEND}
+ app-arch/xz-utils"
+[[ ${PV} == "9999" ]] && DEPEND+=" sys-apps/help2man"
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ git-2_src_unpack
+ cd "${S}"
+ ./bootstrap || die
+ else
+ unpacker_src_unpack
+ fi
+}
+
+src_prepare() {
+ use vanilla && return 0
+
+ epatch "${FILESDIR}"/${PN}-2.4.3-use-linux-version-in-fbsd.patch #109105
+ pushd libltdl >/dev/null
+ AT_NOELIBTOOLIZE=yes eautoreconf
+ popd >/dev/null
+ AT_NOELIBTOOLIZE=yes eautoreconf
+ epunt_cxx
+}
+
+src_configure() {
+ # the libtool script uses bash code in it and at configure time, tries
+ # to find a bash shell. if /bin/sh is bash, it uses that. this can
+ # cause problems for people who switch /bin/sh on the fly to other
+ # shells, so just force libtool to use /bin/bash all the time.
+ export CONFIG_SHELL=/bin/bash
+ ECONF_SOURCE=${S} econf --disable-ltdl-install
+}
+
+src_test() {
+ emake check
+}
+
+src_install() {
+ default
+
+ local x
+ while read -d $'\0' -r x ; do
+ ln -sf "${EPREFIX}"/usr/share/gnuconfig/${x##*/} "${x}" || die
+ done < <(find "${ED}" '(' -name config.guess -o -name config.sub ')' -print0)
+}
diff --git a/sys-devel/libtool/metadata.xml b/sys-devel/libtool/metadata.xml
new file mode 100644
index 000000000000..96a2d586367d
--- /dev/null
+++ b/sys-devel/libtool/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-devel/llvm/Manifest b/sys-devel/llvm/Manifest
new file mode 100644
index 000000000000..3a4091767129
--- /dev/null
+++ b/sys-devel/llvm/Manifest
@@ -0,0 +1,42 @@
+DIST cfe-3.3.src.tar.gz 9425539 SHA256 b1b55de4ab3a57d3e0331a83e0284610191c77d924e3446498d9113d08dfb996 SHA512 06773f43f7d3529f06edb029f7de398f06a700a0f2476e00c4727e70c291028221bfac23625dfd2c220d6ac91a21670848187a934b99a21801c695127371afcc WHIRLPOOL 8b97b527f19015dd3283b9e174615170e639793f64c635ccc4ee4d8216f8de759fd0121a8ef3513fa1c6ad19b31aa3529091ffb44a01ee858edfef400881596a
+DIST cfe-3.4.2.src.tar.gz 10612313 SHA256 5ba6f5772f8d00f445209356a7daf83c5bca2da5acd10de517ad2359ae95bc10 SHA512 e01fa8e312e9b3b7b3cb572ac21349161aaa50078ecfe7bded273b75db4a0c44acde524f8fdfcbeec54c61eeeb8339e9917d1f205a8fda18e34fe7ccbe89c36d WHIRLPOOL 153208b1a60bb5fbe92a7162cb26bbe70d591e7db9dcf06fcd54efc539bbff0403ec88e64236969c9f256e5586bc333840bd6178fd158577d6fe228d9edd4dcd
+DIST cfe-3.5.0.src.tar.xz 8233432 SHA256 fc80992e004b06f6c7afb612de1cdaa9ac9d25811c55f94fcf7331d9b81cdb8b SHA512 b26a5e2cd81c150607c23b22fafc0d9c7f12b83b45e476b8e75bf5e99d42be7c98ffeac7349df664f01b00900864a01429860b298e48961861377a4b2daf3e49 WHIRLPOOL 5dd8b6fe97933b74f1668b1d753c16cd3bcd05ccf72aac1283aa449caf93f5ba88ae79e7668f7e79b554e1421549a87af21c86cf92657c1b4d77744165718ce7
+DIST cfe-3.5.1.src.tar.xz 8268140 SHA256 6773f3f9cf815631cc7e779ec134ddd228dc8e9a250e1ea3a910610c59eb8f5c SHA512 bd904586f6155c05d2f7ddd05b86c28feae883cdc60e2cb3b48d4ae0ce55916064bcea414a46518d0fb73618f18a3f3fca6cc4cad81083428a2221299f5c5c7f WHIRLPOOL eca619b84ae6dfbca4b3d46601419d2c5a0cd77d643336c560d4bc358f4a2b0f7123d3e87248119c3e447143859da20b9b2e94721ebb14053627f0a158d843f5
+DIST cfe-3.5.2.src.tar.xz 8268008 SHA256 4feb575f74fb3a74b6245400460230141bf610f235ef3a25008cfe6137828620 SHA512 2ad9a7daa8e62cdbf47b001aa6b937a06ae7e6396dcd1832797e2d98036522443ccfca9f1253e16d531a99d1edf237fcd2b457c55491ff68ca4534a2396ca52f WHIRLPOOL 51789ba2a3193d404b26d26b999fc47f1bc4b56b45048078cc51e4ff5c31d834d360ee0c2d16096c060f85acab6de9055dc375569348ae3307e4b280406f2d9e
+DIST cfe-3.6.0.src.tar.xz 8640776 SHA256 be0e69378119fe26f0f2f74cffe82b7c26da840c9733fe522ed3c1b66b11082d SHA512 dc137bdf9c2c5adb25498c995f0b944016699267156a595cc1fe6127f6961d45162275023d194db42691d80fa8fc74f56abad9c145ef1ff492881f547ca76cfe WHIRLPOOL 0df122c9d32dba5a00a97bec4a54b7b7bd8241ef625357bcf9997e3670e7c4775becec971f572073f3ffad86c7ccf616a94c06926ef9b0528248e34958e9b43f
+DIST cfe-3.6.1.src.tar.xz 8616132 SHA256 74f92d0c93b86678b015e87655f59474b2f657769680efdeb3c0524ffbd2dad7 SHA512 a96944bccfd9341be7adafdcc40367d458e85e7e74b0d2f3a7ea18edf1454d04a232c2d0003d6449c52f81d1e235b434acc1bb63eb5f7d16f8f4a43b70826743 WHIRLPOOL 1b4b8bb33fc7dbaeb03f32ba3544580bf0424889705b9d5130127be4d514c6d2aae5e224d71e20595a31441fc4bdd7bbf647e99e57d2c1e17fff3cff9022faa1
+DIST cfe-3.6.2.src.tar.xz 8617576 SHA256 ae9180466a23acb426d12444d866b266ff2289b266064d362462e44f8d4699f3 SHA512 ed837c48f38d8998efd675b56477c8681dcedfcf3f71bba65930f145501289bebb6fe6a6d9de336548f94c381d016b99f10c58e046b885449755d44ac782de03 WHIRLPOOL a17419cea329999c8662c0008dbd0391ed5f52045d0175488979e7620f6a9a21b08e451a5e21d3bf944597bb37934a8228fa89c09d773882359822d59bd447a8
+DIST clang-tools-extra-3.4.src.tar.gz 230729 SHA256 ba85187551ae97fe1c8ab569903beae5ff0900e21233e5eb5389f6ceab1028b4 SHA512 9656678acea490fd5674b2d47ad30ec69e5aedb450924e566a90418c94ce6483faa254e7dde0d5163cb0643153113d27b6b000fea7bba08f0ba55741b35873b1 WHIRLPOOL c41ec11d0b88678c56d77d285c4383a39cabab16aae8a4457666014e0927aa4b04cf77e73af0275e6bfc603a9531598eca98ab61d5d81288e2920682088d9eaf
+DIST clang-tools-extra-3.5.0.src.tar.xz 216256 SHA256 2981beb378afb5aa5c50ed017720a42a33e77e902c7086ad2d412ef4fa931f69 SHA512 5ff2cc5d143b78fbe6645486f02e50f738a92aaf6b8e85cfc6f91e659684686b12e61fc8f00b814b4372c5ed2c2b1be5eca61ea696fbe074b815877b799534ee WHIRLPOOL 10b5afc550fa6a8c33739fbf9268e934732b2892842d398152676e66ab90aed3c6e1bae02bc1b8aa0a9a917b6b450f60950317a9eda3f9e377971cbe00164b11
+DIST clang-tools-extra-3.5.1.src.tar.xz 215776 SHA256 e8d011250389cfc36eb51557ca25ae66ab08173e8d53536a0747356105d72906 SHA512 eefacd6857584c9a3186815a7d015a595f32cd926f6c221245d388b8cb9266c52e0980a8e94f01f49c452510fdd42e659b02f116619d3d0e35170566f0704712 WHIRLPOOL a3d14e21f201cc02649833edd67ba04f17c88486fbf399327dbb76d21e151b956a4f58cd7446b8563f72fa1cee06a8bd4abbc53234761a3a69fc1afc99ced87d
+DIST clang-tools-extra-3.5.2.src.tar.xz 215804 SHA256 f21a374d74b194d8c984546266491b518859b5f12ed9abd49337b8060d3fc004 SHA512 6a8e662d2704147296c13626fbc5885911c646c67404f12eacc67ee2995221445bf4f6122b271b9cb3a56b716f550a651024822f72358d400b9052bf50423669 WHIRLPOOL 088d2725a88a439a1a2c4048e0eaf540587078078bd1c9823a4804200265cab4d32606abf5e72be76da45ea4aa6e7a7201a2bdbddc78d5f9e0024b0d7b59e222
+DIST clang-tools-extra-3.6.0.src.tar.xz 248688 SHA256 3aa949ba82913490a75697287d9ee8598c619fae0aa6bb8fddf0095ff51bc812 SHA512 52e0cd3cce3047bb98d52e5c03ac4a8c549fcdc628f57492727f3e7659b2d4bd29ad98ab4ebab387233911fbb098861ec020b28c051e6b2c17d73dd490beebf3 WHIRLPOOL 423f018a2943d16ac605d36bece61046423974c2ffbcc7e4a9aebc5efbb2444ecead70e46bc05f51f4fedbfef338d177b5b16969e8fb0df0bbc911200ce483ae
+DIST clang-tools-extra-3.6.1.src.tar.xz 248592 SHA256 f4ee70d870d550a9147ac6a548ce7daf7d9e6897348bf411f43c572966fb92b6 SHA512 3273f8c1fa1683de231d0c0b9371d4b7537381e939fe38996e70a8005a1e6185da459ace2f260fad41df4840b459448ed1498c2fd576dd560005117a54e2ccb9 WHIRLPOOL b35c2118efff758358ed9945384218327767a48ae18acdaf2233a5b97e1dc5a682023ddf78d989d1278119c277aecec596c37c5dab8ea2b16a1c9348eb40d9e6
+DIST clang-tools-extra-3.6.2.src.tar.xz 248624 SHA256 6a0ec627d398f501ddf347060f7a2ccea4802b2494f1d4fd7bda3e0442d04feb SHA512 1b7710a7deee30cefb6a3b4edb026a96d8935a0c6f3056ccdb7a45564d10baf01a4f6722ae853ad9a3bad17e8de32a3c0ec99c5cf6144647a5e182809d403f7a WHIRLPOOL 3dc8888c302bac84f53b673784dec092a2c59ea2985d9983e87f057b9aa7b5d3e34cf13d2b0f1f60ea44f342b8167377204a510036872a087037cf02335c19cd
+DIST compiler-rt-3.3.src.tar.gz 1568034 SHA256 0e2f3180d6316e6c43f064fdd406c5c6515e682c5f31c57c28335b68c7525423 SHA512 3e86aa8ab9810b4fbac54a40fc93a717a55c642520858c0db215a5324c1e495b4d8fcec9620251cca8e4e5f9afa34bc14364d7f785880a0700469d0201827929 WHIRLPOOL fcfd06bc860dfd901a7576cd4309f863e9d4363e36ab4c67e9e08fe3c8a37d627ee95eb96b9ed53eb6047dec06e73181b3c3e1555b1b49f1e893e6382f21ddc1
+DIST compiler-rt-3.4.src.tar.gz 1858593 SHA256 f37c89b1383ce462d47537a0245ac798600887a9be9f63073e16b79ed536ab5c SHA512 70efffaf12ff7c15befa87ce808489c6f6b6eb421d0ab5d8ecd525239efc8aab850c7ed34b31a993ff5e499657b72598619945cc4461fe3e5359e9a94aaac0c8 WHIRLPOOL ad558b5877a01e476d30d2757959ab04be0c385b2fe3442bcc578bf36c6f3214cd78b4adda24fcb1f3b2b84353db213b82e8d7d4c40e66c3f57aed3a49322dbc
+DIST compiler-rt-3.5.0.src.tar.xz 1088352 SHA256 a4b3e655832bf8d9a357ea2c771db347237460e131988cbb96cda40ff39a8136 SHA512 862cce2d6b398bd1a8399496a547e6ab976a31f676528beebfbea5fd7dc54aa72e1c25deefa12f6167096521eba74090565b0168806451da02ddac04e922fc48 WHIRLPOOL 248acf997d70d7904aa79bf83e0c02ba4e5f8c2812c03f44a8e1e31b845a654f250c09ec6a123f9245d0db8713e8cc5a4087b9ce785af4f5eb7e55d9dbd362a2
+DIST compiler-rt-3.5.1.src.tar.xz 1092452 SHA256 adf4b526f33e681aff5961f0821f5b514d3fc375410008842640b56a2e6a837a SHA512 3a4f093972b080f439c81c8b08793c311cea71afeda7ba7b4e32f19378b1cb420da7b594fa9f6a6f7826570438f67d42d3243c4b3503e1cf8a7dcedf52e8e590 WHIRLPOOL edbf11837139b48207fc6f82ecad39fbc6983cf5bd1441cbe6d50e5e484566b63c5afa2fc64cd29fb8560f07015a98c00b58c926ca7e9af47b7eea92133d0db4
+DIST compiler-rt-3.5.2.src.tar.xz 1093000 SHA256 542d7aadd21e7fe35bea0a7912bc965f08a1a566746cebcca76f96dcfeb74dc3 SHA512 319a8a1dbe07eb4f1fcccfe79a1fa445f348fb854a441500e89fa0a128e45716b65d06347f19a63de32e9294cd2331e914ae0d5fe8224f0b2452c39b79ac96ff WHIRLPOOL 6e9286c56a60a515006c8232ca01622ae844185a5f31fb49bce632868862c5e560619f1c45da66878b5322a764f91a284cd296e9f13105d6f74e055a17321d93
+DIST compiler-rt-3.6.0.src.tar.xz 1140616 SHA256 7f49fb79e5adcdce7dddaf973f1db130228dfb19e37a99a7f5365a6948b26b11 SHA512 2758bc2b78dcfb9b6509b83ebc4ebc86907ca3dc2a5f151f580771c674b934432cae055e342ed73096a08331b2f7b129ff65629b27932458b1877aeb554b6328 WHIRLPOOL 1836b59c2369457aac79dc113b9a76623da30195a460afd0e25997aa21855991cdee78d5aec12b45d05d7d14e42d5fc7678f1c169b5a7fd500681a34d02d4468
+DIST compiler-rt-3.6.1.src.tar.xz 1128460 SHA256 fcbf610c77be6047f11ca10c4725610417beba832565115a9e2fcfe2897b649f SHA512 121c048fe60bccccd4a188a18613c94e1e1d9abd8fbae6405d23418f0c9b3562fff72fe77aea9bc0f8632ec9ad89503b9c67fcab5bf378001f90ad7492a1845a WHIRLPOOL fabbf5a63734f879d1698cd65846beb1cfa8559009b37bf5b5f4e239e62c9a9014d484233674cf357fb7aabb04ac8df840e832c764caf4b4a3b662ff0a51115e
+DIST compiler-rt-3.6.2.src.tar.xz 1128080 SHA256 0f2ff37d80a64575fecd8cf0d5c50f7ac1f837ddf700d1855412bb7547431d87 SHA512 7dafcc5bd4822475de649d8a84ae51af3c4ed4d0958f76b1b55ba79219638f3e78eb94a1986c6e9ba0e7f1ccf3ec834d546b5ca60e8b08083fea5880ecdf17a3 WHIRLPOOL dd77e7df43c9028a6873ed903da67560fdb04968013016a7f0ad2d2e9a81b3a3d890b95e4f49a6bdef349806d6507defcd80a0a9fb50c1c9f778e7eff42dbc5d
+DIST llvm-2.8-r1.tgz 9112527 SHA256 25addb742f1c6cc12877ed0ee924dda962d848368ee095be8e48342ae613d43b SHA512 8688d5cf415e8aef74cca6a14587af36234a6347e2238ac2c0d66805c42926b9399f36390e1a58a4081e902b0904adb818c1a360d5df572dfa893d6f79f5e35a WHIRLPOOL 0da9250e31242b55586c9138089e742aab5d414d5f3412ebf917ae8b9506f984c6134a932be93ec7e4c01c79f6c21d508cb0b2e0ec283419bd4ae4db745430ae
+DIST llvm-2.9.tgz 9574781 SHA256 661236cfa17428b48cfa9cbb9909f7569c64b8ecd219fd91dbc00e3b557b3779 SHA512 9cb0fa0bb8ac02661fd6f926001a15e0ad4a9660683421dc86b03f1cf5184142c5815f9f9283ee7cdf8d474e01177f83406122253342e0e95ddc878821660070 WHIRLPOOL f7b445b6b5d455f29ca68c342511b8b5e6eedec525af1cc60440c4de544df2332aa241bffca29eda5d2428a3f518e093a626bd45c7f8a9e0656d0f68aef5d9d1
+DIST llvm-3.0.tar.gz 10350539 SHA256 519eb11d3499ce99c6ffdb8718651fc91425ed7690eac91c8d6853474f7c0477 SHA512 602bb5590b70cb9138bc19d8c630c62bbabdcb2132215c921fe4bce4e3f74dfc66440b9dcd458ff55a86047cc9cc0417c6563715c133e0db222e4b88f07c13bb WHIRLPOOL 6f4ece3ec747352cd78b08d25c5b1cda91140eb6957d509161e45395e47c074f8d2102bfcaeabcdef8c1f6672f2cf06d88e290667666122da029391b3528d440
+DIST llvm-3.1.src.tar.gz 11077429 SHA256 1ea05135197b5400c1f88d00ff280d775ce778f8f9ea042e25a1e1e734a4b9ab SHA512 fb941094601043e405ccc57473414ef92437b09c200e71614f93d8e93b2a58cca8d78c385be037e064b0711cd6268802c774ce4a40fc0ea17bf576305304d2aa WHIRLPOOL c5c72e139296e1c186131f991010f52f958063a4fcfcb1f8527b53a2aaa7edcaca70ab6cf86c25d08640dcf6d720a865fda7dc7eb06cf1ce9c23fd37b5d597ef
+DIST llvm-3.2-manpages.tar.bz2 25962 SHA256 159eaaaf59a2cee66f6aa0bbc93ca4c9fa37a9a25d4116f085556cdbc32f75ca SHA512 75ce41827f99b9e08f0c3e374c49f8a231653bca28bea158ece551e5934bc61ae21bfaf158490f83b05c1a7926b95c8832c0eb023280dcafa671e7d551efa17e WHIRLPOOL 58382b3e92b2ef8b1f5a7ebf2d893852253976b781b2b2acd11dfd914fad9776f59ddc5559d3986832a00fde88539db6a5882aa69a6f3ceca90337a59420acc1
+DIST llvm-3.2.src.tar.gz 12275252 SHA256 125090c4d26740f1d5e9838477c931ed7d9ad70d599ba265f46f3a42cb066343 SHA512 cc66171322dbbe40bcac0e0ea5b09df8ff52df63ded304f841f32f702270d6ab1512216413ee52498c3ebee8cd39c4cd23e3855d591944bc2ac0ae76f5be62cc WHIRLPOOL c3a39b2426293d0251b7769607ade873bb6bf8d54e7c8055773a9b75742bc8e39049fb71409a258c6f3d98775b78c280d4bfe4223ba91e5ed6ecae0eddf910e5
+DIST llvm-3.3-manpages.tar.bz2 27098 SHA256 46bb22d63d5fe7dd04e1a7bb7e16c03d93f2ed51d31540cfb9d97ed70059aa77 SHA512 6f24b66b13025d0606908f91ad9b4fc6de1b4aac2d97d261f6b989065476cf153d2f84792f8dd4972b95fb1a45a3931c328df3bcf8ce5ab21170a7a912a39783 WHIRLPOOL 31b9c3635b698f404b75b87c7891b4b6be9cbeb6062bcb6fba5476b0b3069a486ba60c27ab2b12b8a2da9404f666617162041860f023951050a9fc4c7d27748a
+DIST llvm-3.3.src.tar.gz 13602421 SHA256 68766b1e70d05a25e2f502e997a3cb3937187a3296595cf6e0977d5cd6727578 SHA512 1b7f7c5e907a68f642dcbe48fdff9585cb1504022bc9d386f310ebe5d25103d0d5f7cf0abf19e0e3fd666970160a98c90033754e2b79b2fac0cf866c984f8038 WHIRLPOOL a89c0b470fde562a3402e7878b91bc0573d433ca0a60e62c9c46946d7948a4fb657b116b6bac032555e29c70d82c751876adb398fe240f5c8d0a9a2378ce1866
+DIST llvm-3.4-manpages.tar.bz2 33753 SHA256 dc2616104cf333dd9ef56b2d31f9a36e81303e2c5756ff8bc221e05b46f7e1cb SHA512 8e438a9392c9b896ccb2b1460a8f57ffa01633e3a6bba61e2bf2f718d970ff96c17d63b0bc0d4da1162e1d1dc4cb9b2a9e9a14a722e8a5b5d2f205f037ae665d WHIRLPOOL 1c037a9972442937f84bc3147d77d4bbc6d6c0812c3025f3107c2ee5f6259afab990f6e1bca564237fdca8089e2372df4b7ca45cbdea686fbf891f92d1bfbbe6
+DIST llvm-3.4.2.src.tar.gz 15938155 SHA256 17038d47069ad0700c063caed76f0c7259628b0e79651ce2b540d506f2f1efd7 SHA512 6c1453f7d9d9110257db3574cc4f6227fed8938705cbb09851ac09a868089b48f1556a1b6e758aff6d97520b08b5605d3ed20411ad9dd22cdc573d62176905f0 WHIRLPOOL f8b4d5167469e6f350ec41aede04e7b756e18f3d8e78b3270beb5791310a7b9b13c69e57c8bcfefbd0a78efc0c40e3b75a9a158eac72c025b7c77146e8dfaf7c
+DIST llvm-3.5.0-manpages.tar.bz2 35314 SHA256 724e752a60016dce8cc536658906d3646c600e977374e0ea692a5d0fe2d4a021 SHA512 d99d6096d7f21a81923297584fe5eeb23e0d83d4538fe376615c92fffc8aff3189999f7ab3c537b5aa5d6bc2c22c53eb05717d48c7ab99c42315b8665bac62c3 WHIRLPOOL 68ced06ee6678c5333c662eb1cc0da744c5a184b12dd059c1b77ec200b1d3cc231f270b9d9b6e177d728776894277b3f9061338aa55620c90474eb97915b7819
+DIST llvm-3.5.0.src.tar.xz 11735940 SHA256 28e199f368ef0a4666708f31c7991ad3bcc3a578342b0306526dd35f07595c03 SHA512 b4d0f325dbdb0a8f10e5fd031954ef4b1971d8f99f4e4b53834801a2b74a7acde3f77c655c8355b407424b363edfb10f71d85fc370356dc52af5c636a1bba197 WHIRLPOOL 561520823468b61c63df8e13f876b7ac586eb1e52c256e9a36370e5d46e8cef3937655c36fbb51eebd3680fab67412e7c777479477fc728e7a8f35420e573ef1
+DIST llvm-3.5.1.src.tar.xz 11869356 SHA256 bf3275d2d7890015c8d8f5e6f4f882f8cf3bf51967297ebe74111d6d8b53be15 SHA512 a643ff173627e813b26077829b1af801b75daa5dcea540c4f05366ed57ef6aeafaf8b3fe4208d4c1b303a048a90ddac48a23488480c165637ae9218de140ae55 WHIRLPOOL 798ad46bc21570d8e5b0caadf2c0b434382fd78bfea5a08097fa001019b749b828e56ffe330435e5f3556700e8b0bee29e4139a7ff6b2824bb83dcc8caba2606
+DIST llvm-3.5.2.src.tar.xz 11876128 SHA256 44196156d5749eb4b4224fe471a29cc3984df92570a4a89fa859f7394fc0c575 SHA512 0f6a83cc61a385387e7baf8fb8f0d9f18e3fd00d2d389a3c7e2c3792be7d82ed095506cac52c24e65ae3c1f94456a441d39440feef6125e25ef18447ec9dd406 WHIRLPOOL b41de51907d6d2c2d04a4c498b44f0ed560cc710e6e2d8678f5ef93a9009d140bc7c2406f4b25d5b901fd026689d48edce77a2e435687b489b835156a512e256
+DIST llvm-3.6.0-manpages.tar.bz2 35140 SHA256 53b14a7896f6db547fa692b43fb5b08898b251699ec505a2b9d9c9c3b632eed7 SHA512 2efe21ecaf10ced3e078e7675918f5b7fe6cfa3ba6371906f832690858024c57f4868a3af54b6de18c980d6008992d08ae21bc2a678ef12652a0a0eabad52a15 WHIRLPOOL f6bfc9ec0432566b70ab16aa99628a64e0d9f325db72a37cb1b04d6a3521625b37b858770ac1c9e313612d9475d7832f683fbbc2c3acad97c99daeb39383df45
+DIST llvm-3.6.0.src.tar.xz 12750908 SHA256 b39a69e501b49e8f73ff75c9ad72313681ee58d6f430bfad4d81846fe92eb9ce SHA512 ca492b7d86333f05930dc849c7a8beff981da51ca174cd844650b516d0a592a2c3837d5a8a9b62713c0f29292b845f27ef0ec361809e325c6b60cbbcd3f20357 WHIRLPOOL 4f9de6b8dd2514e7b55e8c6e6af2ab9d355ebf49f1bd113a652f71809d74060792a95f6cee5b8b3bd64d92586b46e7778f616027702c98eb726ee84375e4eea6
+DIST llvm-3.6.1-manpages.tar.bz2 38338 SHA256 b27c6198e09b11421841a7184d4e8a0f8878d4f1313405da28d643134a55688a SHA512 a47aeb0b4632329eaaa1d6c774446fea5822d7692d81533a9a5c5de1c6a3b37fdd6b7c1fc6433339649f4d3a53a753065e73afb30fd84f253ad31d5fb3d48662 WHIRLPOOL 022b214b6340365490915b5c873e515bf16be90d04cd32f09024a3607c23edc2c2e241d295102f045bd08a442c4e5aaf134ac89f7e59a027ec1633330a95989b
+DIST llvm-3.6.1.src.tar.xz 12798852 SHA256 2f00c615913aa0b56607ee1548936e60ad2aa89e6d56f23fb032a4463366fc7a SHA512 fa07d0fe6c527d86c0b91b1b62597f949d777e3609e4e8ca2ea5e07931e1ebc7a363273cc705cf4a13b45e7ab00716b76de26688d077c1b51341d9dd2972de3f WHIRLPOOL c6340956e9935c0e4a986f1a8da9458ca3b3a7bdff376d33c7a3c60bc5154fb5820bfaf43fb4118f28ab9b0f356f436672fd2f984bc629eeee01233b703030fb
+DIST llvm-3.6.2.src.tar.xz 12802380 SHA256 f60dc158bfda6822de167e87275848969f0558b3134892ff54fced87e4667b94 SHA512 42b44ce69cfb96e2dc12dc2246f0de8ff983a99741206e2c46ccf074b3248aaab9c0f22c6baad802de851d06f202f40db9dd62fe38aab4479b3f70026c936b36 WHIRLPOOL 1a15e16793fe4120f1c14a5334362c36db26745c493e7289281351b7c18c523d781ff9425dddfe1a2add9ea1e8aebb92f2313787da5f286259b55b0884b3039f
diff --git a/sys-devel/llvm/files/cl-patches/0001-r600-Add-some-intrinsic-definitions.patch b/sys-devel/llvm/files/cl-patches/0001-r600-Add-some-intrinsic-definitions.patch
new file mode 100644
index 000000000000..9d99c9cff350
--- /dev/null
+++ b/sys-devel/llvm/files/cl-patches/0001-r600-Add-some-intrinsic-definitions.patch
@@ -0,0 +1,64 @@
+From e25389b66b5ced3a2b5461077dcc9a505d334e3d Mon Sep 17 00:00:00 2001
+From: Tom Stellard <thomas.stellard@amd.com>
+Date: Tue, 13 Mar 2012 14:12:21 -0400
+Subject: [PATCH 1/2] r600: Add some intrinsic definitions
+
+---
+ include/llvm/Intrinsics.td | 1 +
+ include/llvm/IntrinsicsR600.td | 35 +++++++++++++++++++++++++++++++++++
+ 2 files changed, 36 insertions(+), 0 deletions(-)
+ create mode 100644 include/llvm/IntrinsicsR600.td
+
+diff --git a/include/llvm/Intrinsics.td b/include/llvm/Intrinsics.td
+index 069f907..e90dd85 100644
+--- a/include/llvm/Intrinsics.td
++++ b/include/llvm/Intrinsics.td
+@@ -441,3 +441,4 @@ include "llvm/IntrinsicsCellSPU.td"
+ include "llvm/IntrinsicsXCore.td"
+ include "llvm/IntrinsicsPTX.td"
+ include "llvm/IntrinsicsHexagon.td"
++include "llvm/IntrinsicsR600.td"
+diff --git a/include/llvm/IntrinsicsR600.td b/include/llvm/IntrinsicsR600.td
+new file mode 100644
+index 0000000..789fecb
+--- /dev/null
++++ b/include/llvm/IntrinsicsR600.td
+@@ -0,0 +1,35 @@
++//===- IntrinsicsR600.td - Defines R600 intrinsics ---------*- tablegen -*-===//
++//
++// The LLVM Compiler Infrastructure
++//
++// This file is distributed under the University of Illinois Open Source
++// License. See LICENSE.TXT for details.
++//
++//===----------------------------------------------------------------------===//
++//
++// This file defines all of the R600-specific intrinsics.
++//
++//===----------------------------------------------------------------------===//
++//
++// Authors: Tom Stellard <thomas.stellard@amd.com>
++//
++
++let TargetPrefix = "r600" in {
++
++class R600ReadPreloadRegisterIntrinsic<string name>
++ : Intrinsic<[llvm_i32_ty], [], [IntrNoMem]>,
++ GCCBuiltin<name>;
++
++multiclass R600ReadPreloadRegisterIntrinsic_xyz<string prefix> {
++ def _x : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_x")>;
++ def _y : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_y")>;
++ def _z : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_z")>;
++}
++
++defm int_r600_read_ngroups : R600ReadPreloadRegisterIntrinsic_xyz <
++ "__builtin_r600_read_ngroups">;
++defm int_r600_read_tgid : R600ReadPreloadRegisterIntrinsic_xyz <
++ "__builtin_r600_read_tgid">;
++defm int_r600_read_tidig : R600ReadPreloadRegisterIntrinsic_xyz <
++ "__builtin_r600_read_tidig">;
++} // End TargetPrefix = "r600"
+--
+1.7.7.6
+
diff --git a/sys-devel/llvm/files/cl-patches/0002-r600-Add-get_global_size-and-get_local_size-intrinsi.patch b/sys-devel/llvm/files/cl-patches/0002-r600-Add-get_global_size-and-get_local_size-intrinsi.patch
new file mode 100644
index 000000000000..db176dd56a1b
--- /dev/null
+++ b/sys-devel/llvm/files/cl-patches/0002-r600-Add-get_global_size-and-get_local_size-intrinsi.patch
@@ -0,0 +1,27 @@
+From 17667fa3450470f7c89fc2ba4631d908cf510749 Mon Sep 17 00:00:00 2001
+From: Tom Stellard <thomas.stellard@amd.com>
+Date: Wed, 14 Mar 2012 11:19:35 -0400
+Subject: [PATCH 2/2] r600: Add get_global_size and get_local_size intrinsics
+
+---
+ include/llvm/IntrinsicsR600.td | 4 ++++
+ 1 files changed, 4 insertions(+), 0 deletions(-)
+
+diff --git a/include/llvm/IntrinsicsR600.td b/include/llvm/IntrinsicsR600.td
+index 789fecb..0473acb 100644
+--- a/include/llvm/IntrinsicsR600.td
++++ b/include/llvm/IntrinsicsR600.td
+@@ -26,6 +26,10 @@ multiclass R600ReadPreloadRegisterIntrinsic_xyz<string prefix> {
+ def _z : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_z")>;
+ }
+
++defm int_r600_read_global_size : R600ReadPreloadRegisterIntrinsic_xyz <
++ "__builtin_r600_read_global_size">;
++defm int_r600_read_local_size : R600ReadPreloadRegisterIntrinsic_xyz <
++ "__builtin_r600_read_local_size">;
+ defm int_r600_read_ngroups : R600ReadPreloadRegisterIntrinsic_xyz <
+ "__builtin_r600_read_ngroups">;
+ defm int_r600_read_tgid : R600ReadPreloadRegisterIntrinsic_xyz <
+--
+1.7.7.6
+
diff --git a/sys-devel/llvm/files/clang-3.1-gentoo-runtime-gcc-detection-v3.patch b/sys-devel/llvm/files/clang-3.1-gentoo-runtime-gcc-detection-v3.patch
new file mode 100644
index 000000000000..49f108533404
--- /dev/null
+++ b/sys-devel/llvm/files/clang-3.1-gentoo-runtime-gcc-detection-v3.patch
@@ -0,0 +1,29 @@
+diff -upNr a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp
+--- a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-24 03:32:31.593191000 -0400
++++ b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-24 03:38:31.733163513 -0400
+@@ -1145,6 +1145,25 @@ Generic_GCC::GCCInstallationDetector::GC
+ Prefixes.push_back(D.InstalledDir + "/..");
+ }
+
++ llvm::OwningPtr<llvm::MemoryBuffer> File;
++ for (unsigned k = 0, ke = CandidateTripleAliases.size(); k < ke; ++k) {
++ if (!llvm::MemoryBuffer::getFile(D.SysRoot + "/etc/env.d/gcc/config-" + CandidateTripleAliases[k].str(), File))
++ {
++ bool Exists;
++ const std::string VersionText = File.get()->getBuffer().rsplit('-').second.substr(0,5).str();
++ const std::string GentooPath = D.SysRoot + "/usr/lib/gcc/" + CandidateTripleAliases[k].str() + "/" + VersionText;
++ if (!llvm::sys::fs::exists(GentooPath + "/crtbegin.o", Exists) && Exists)
++ {
++ Version = GCCVersion::Parse(VersionText);
++ GCCInstallPath = GentooPath;
++ GCCParentLibPath = GCCInstallPath + "/../../..";
++ GCCTriple.setTriple(CandidateTripleAliases[k]);
++ IsValid = true;
++ return;
++ }
++ }
++ }
++
+ // Loop over the various components which exist and select the best GCC
+ // installation available. GCC installs are ranked by version number.
+ Version = GCCVersion::Parse("0.0.0");
diff --git a/sys-devel/llvm/files/clang-3.3-gcc-header-path.patch b/sys-devel/llvm/files/clang-3.3-gcc-header-path.patch
new file mode 100644
index 000000000000..dc9a4f7bb79c
--- /dev/null
+++ b/sys-devel/llvm/files/clang-3.3-gcc-header-path.patch
@@ -0,0 +1,90 @@
+Backport handling of 'g++-vX.Y' header location.
+
+Fixes: https://bugs.gentoo.org/show_bug.cgi?id=487584
+---
+ tools/clang/lib/Driver/ToolChains.cpp | 20 ++++++++++++--------
+ tools/clang/lib/Driver/ToolChains.h | 3 +++
+ 2 files changed, 15 insertions(+), 8 deletions(-)
+
+diff --git a/tools/clang/lib/Driver/ToolChains.cpp b/tools/clang/lib/Driver/ToolChains.cpp
+index 7c9e9c0..e38d42d 100644
+--- a/tools/clang/lib/Driver/ToolChains.cpp
++++ b/tools/clang/lib/Driver/ToolChains.cpp
+@@ -917,17 +917,19 @@ Darwin_Generic_GCC::ComputeEffectiveClangTriple(const ArgList &Args,
+ /// This is the primary means of forming GCCVersion objects.
+ /*static*/
+ Generic_GCC::GCCVersion Linux::GCCVersion::Parse(StringRef VersionText) {
+- const GCCVersion BadVersion = { VersionText.str(), -1, -1, -1, "" };
++ const GCCVersion BadVersion = { VersionText.str(), -1, -1, -1, "", "", "" };
+ std::pair<StringRef, StringRef> First = VersionText.split('.');
+ std::pair<StringRef, StringRef> Second = First.second.split('.');
+
+- GCCVersion GoodVersion = { VersionText.str(), -1, -1, -1, "" };
++ GCCVersion GoodVersion = { VersionText.str(), -1, -1, -1, "", "", "" };
+ if (First.first.getAsInteger(10, GoodVersion.Major) ||
+ GoodVersion.Major < 0)
+ return BadVersion;
++ GoodVersion.MajorStr = First.first.str();
+ if (Second.first.getAsInteger(10, GoodVersion.Minor) ||
+ GoodVersion.Minor < 0)
+ return BadVersion;
++ GoodVersion.MinorStr = Second.first.str();
+
+ // First look for a number prefix and parse that if present. Otherwise just
+ // stash the entire patch string in the suffix, and leave the number
+@@ -945,7 +947,7 @@ Generic_GCC::GCCVersion Linux::GCCVersion::Parse(StringRef VersionText) {
+ if (PatchText.slice(0, EndNumber).getAsInteger(10, GoodVersion.Patch) ||
+ GoodVersion.Patch < 0)
+ return BadVersion;
+- GoodVersion.PatchSuffix = PatchText.substr(EndNumber).str();
++ GoodVersion.PatchSuffix = PatchText.substr(EndNumber);
+ }
+ }
+
+@@ -2590,11 +2592,11 @@ void Linux::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
+ // equivalent to '/usr/include/c++/X.Y' in almost all cases.
+ StringRef LibDir = GCCInstallation.getParentLibPath();
+ StringRef InstallDir = GCCInstallation.getInstallPath();
+- StringRef Version = GCCInstallation.getVersion().Text;
+ StringRef TripleStr = GCCInstallation.getTriple().str();
++ const GCCVersion &Version = GCCInstallation.getVersion();
+
+ if (addLibStdCXXIncludePaths(LibDir.str() + "/../include",
+- "/c++/" + Version.str(),
++ "/c++/" + Version.Text,
+ TripleStr,
+ GCCInstallation.getMultiarchSuffix(),
+ DriverArgs, CC1Args))
+@@ -2602,10 +2604,12 @@ void Linux::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
+
+ const std::string IncludePathCandidates[] = {
+ // Gentoo is weird and places its headers inside the GCC install, so if the
+- // first attempt to find the headers fails, try this pattern.
+- InstallDir.str() + "/include/g++-v4",
++ // first attempt to find the headers fails, try these patterns.
++ InstallDir.str() + "/include/g++-v" + Version.MajorStr + "." +
++ Version.MinorStr,
++ InstallDir.str() + "/include/g++-v" + Version.MajorStr,
+ // Android standalone toolchain has C++ headers in yet another place.
+- LibDir.str() + "/../" + TripleStr.str() + "/include/c++/" + Version.str(),
++ LibDir.str() + "/../" + TripleStr.str() + "/include/c++/" + Version.Text,
+ // Freescale SDK C++ headers are directly in <sysroot>/usr/include/c++,
+ // without a subdirectory corresponding to the gcc version.
+ LibDir.str() + "/../include/c++",
+diff --git a/tools/clang/lib/Driver/ToolChains.h b/tools/clang/lib/Driver/ToolChains.h
+index 3afd8dd..04cf467 100644
+--- a/tools/clang/lib/Driver/ToolChains.h
++++ b/tools/clang/lib/Driver/ToolChains.h
+@@ -48,6 +48,9 @@ protected:
+ /// \brief The parsed major, minor, and patch numbers.
+ int Major, Minor, Patch;
+
++ /// \brief The text of the parsed major, and major+minor versions.
++ std::string MajorStr, MinorStr;
++
+ /// \brief Any textual suffix on the patch number.
+ std::string PatchSuffix;
+
+--
+1.8.3.2
+
diff --git a/sys-devel/llvm/files/clang-3.3-gentoo-install.patch b/sys-devel/llvm/files/clang-3.3-gentoo-install.patch
new file mode 100644
index 000000000000..5519fbc9132b
--- /dev/null
+++ b/sys-devel/llvm/files/clang-3.3-gentoo-install.patch
@@ -0,0 +1,71 @@
+From 1a539a8868070e49966c6b5f5e4b9f1257acd7dc Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <gentoo@mgorny.alt.pl>
+Date: Fri, 19 Jul 2013 10:23:57 +0200
+Subject: [PATCH] clang gentoo install
+
+---
+ tools/clang/lib/Driver/Tools.cpp | 4 ++--
+ tools/clang/tools/scan-build/scan-build | 4 ++--
+ tools/clang/tools/scan-view/scan-view | 2 +-
+ 3 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/tools/clang/lib/Driver/Tools.cpp b/tools/clang/lib/Driver/Tools.cpp
+index e014980..6e60513 100644
+--- a/tools/clang/lib/Driver/Tools.cpp
++++ b/tools/clang/lib/Driver/Tools.cpp
+@@ -219,7 +219,7 @@ static void addProfileRT(const ToolChain &TC, const ArgList &Args,
+ // libprofile_rt.so. We used to use the -l:libprofile_rt.a syntax, but that is
+ // not supported by old linkers.
+ std::string ProfileRT =
+- std::string(TC.getDriver().Dir) + "/../lib/libprofile_rt.a";
++ "-l:libprofile_rt.a";
+
+ CmdArgs.push_back(Args.MakeArgString(ProfileRT));
+ }
+@@ -6177,7 +6177,7 @@ void gnutools::Link::ConstructJob(Compilation &C, const JobAction &JA,
+ // forward.
+ if (D.IsUsingLTO(Args) || Args.hasArg(options::OPT_use_gold_plugin)) {
+ CmdArgs.push_back("-plugin");
+- std::string Plugin = ToolChain.getDriver().Dir + "/../lib/LLVMgold.so";
++ std::string Plugin = ToolChain.getDriver().Dir + "/../@libdir@/LLVMgold.so";
+ CmdArgs.push_back(Args.MakeArgString(Plugin));
+
+ // Try to pass driver level flags relevant to LTO code generation down to
+diff --git a/tools/clang/tools/scan-build/scan-build b/tools/clang/tools/scan-build/scan-build
+index 22d5289..dcb4822 100755
+--- a/tools/clang/tools/scan-build/scan-build
++++ b/tools/clang/tools/scan-build/scan-build
+@@ -410,7 +410,7 @@ sub CopyFiles {
+
+ my $Dir = shift;
+
+- my $JS = Cwd::realpath("$RealBin/sorttable.js");
++ my $JS = Cwd::realpath("@EPREFIX@/usr/share/llvm/sorttable.js");
+
+ DieDiag("Cannot find 'sorttable.js'.\n")
+ if (! -r $JS);
+@@ -420,7 +420,7 @@ sub CopyFiles {
+ DieDiag("Could not copy 'sorttable.js' to '$Dir'.\n")
+ if (! -r "$Dir/sorttable.js");
+
+- my $CSS = Cwd::realpath("$RealBin/scanview.css");
++ my $CSS = Cwd::realpath("@EPREFIX@/usr/share/llvm/scanview.css");
+
+ DieDiag("Cannot find 'scanview.css'.\n")
+ if (! -r $CSS);
+diff --git a/tools/clang/tools/scan-view/scan-view b/tools/clang/tools/scan-view/scan-view
+index fb27da6..1f8ddb8 100755
+--- a/tools/clang/tools/scan-view/scan-view
++++ b/tools/clang/tools/scan-view/scan-view
+@@ -54,7 +54,7 @@ def start_browser(port, options):
+ webbrowser.open(url)
+
+ def run(port, options, root):
+- import ScanView
++ from clang import ScanView
+ try:
+ print 'Starting scan-view at: http://%s:%d'%(options.host,
+ port)
+--
+1.8.3.2
+
diff --git a/sys-devel/llvm/files/clang-3.4-darwin_build_fix.patch b/sys-devel/llvm/files/clang-3.4-darwin_build_fix.patch
new file mode 100644
index 000000000000..113b04bc6637
--- /dev/null
+++ b/sys-devel/llvm/files/clang-3.4-darwin_build_fix.patch
@@ -0,0 +1,47 @@
+Our (gcc/binutils) toolchain doesn't do ARM targets, hence we will get
+"unable to interface with target machine" errors while building if we
+attempt to. Disable those targets.
+
+Patch by Reza Jelveh from
+https://github.com/fishman/timebomb-gentoo-osx-overlay/blob/master/sys-devel/llvm/files/llvm-3.4-fix_darwin_build.patch
+
+--- a/projects/compiler-rt/make/platform/clang_darwin_embedded.mk
++++ b/projects/compiler-rt/make/platform/clang_darwin_embedded.mk
+@@ -27,20 +27,20 @@ UniversalArchs :=
+ # Soft-float version of the runtime. No floating-point instructions will be used
+ # and the ABI (out of necessity) passes floating values in normal registers:
+ # non-VFP variant of the AAPCS.
+-Configs += soft_static
+-UniversalArchs.soft_static := armv6m armv7m armv7em armv7
++# Configs += soft_static
++# UniversalArchs.soft_static := armv6m armv7m armv7em armv7
+
+ # Hard-float version of the runtime. On ARM VFP instructions and registers are
+ # allowed, and floating point values get passed in them. VFP variant of the
+ # AAPCS.
+ Configs += hard_static
+-UniversalArchs.hard_static := armv7em armv7 i386 x86_64
++UniversalArchs.hard_static := i386 x86_64
+
+-Configs += soft_pic
+-UniversalArchs.soft_pic := armv6m armv7m armv7em armv7
++# Configs += soft_pic
++# UniversalArchs.soft_pic := armv6m armv7m armv7em armv7
+
+ Configs += hard_pic
+-UniversalArchs.hard_pic := armv7em armv7 i386 x86_64
++UniversalArchs.hard_pic := i386 x86_64
+
+ CFLAGS := -Wall -Werror -Oz -fomit-frame-pointer -ffreestanding
+
+--- a/tools/clang/runtime/compiler-rt/Makefile
++++ b/tools/clang/runtime/compiler-rt/Makefile
+@@ -85,7 +85,7 @@ RuntimeLibrary.darwin.Configs := \
+ profile_osx.a profile_ios.a \
+ ubsan_osx.a
+ RuntimeLibrary.darwin_embedded.Configs := \
+- soft_static.a hard_static.a soft_pic.a hard_pic.a
++ hard_static.a hard_pic.a
+
+ # Support building compiler-rt with relocatable SDKs.
+ #
diff --git a/sys-devel/llvm/files/clang-3.4-darwin_prefix-include-paths.patch b/sys-devel/llvm/files/clang-3.4-darwin_prefix-include-paths.patch
new file mode 100644
index 000000000000..f5f1d9e387e9
--- /dev/null
+++ b/sys-devel/llvm/files/clang-3.4-darwin_prefix-include-paths.patch
@@ -0,0 +1,18 @@
+--- tools/clang/lib/Frontend/InitHeaderSearch.cpp
++++ tools/clang/lib/Frontend/InitHeaderSearch.cpp
+@@ -233,6 +233,7 @@
+ case llvm::Triple::Bitrig:
+ break;
+ default:
++ AddPath("@GENTOO_PORTAGE_EPREFIX@/usr/include", System, false);
+ // FIXME: temporary hack: hard-coded paths.
+ AddPath("/usr/local/include", System, false);
+ break;
+@@ -505,6 +506,7 @@
+ // Add the default framework include paths on Darwin.
+ if (HSOpts.UseStandardSystemIncludes) {
+ if (triple.isOSDarwin()) {
++ AddPath("@GENTOO_PORTAGE_EPREFIX@/Frameworks", System, true);
+ AddPath("/System/Library/Frameworks", System, true);
+ AddPath("/Library/Frameworks", System, true);
+ }
diff --git a/sys-devel/llvm/files/clang-3.4-gentoo-install.patch b/sys-devel/llvm/files/clang-3.4-gentoo-install.patch
new file mode 100644
index 000000000000..0a1d9eb3c353
--- /dev/null
+++ b/sys-devel/llvm/files/clang-3.4-gentoo-install.patch
@@ -0,0 +1,80 @@
+From a12fc090b3b43fe25c7de50c09782611e3834aeb Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Sat, 14 Jun 2014 19:35:33 +0200
+Subject: [PATCH] clang gentoo fixes
+
+---
+ tools/clang/lib/Driver/Tools.cpp | 6 +++---
+ tools/clang/tools/scan-build/scan-build | 4 ++--
+ tools/clang/tools/scan-view/scan-view | 2 +-
+ 3 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/tools/clang/lib/Driver/Tools.cpp b/tools/clang/lib/Driver/Tools.cpp
+index b013eb5..dbbcacb 100644
+--- a/tools/clang/lib/Driver/Tools.cpp
++++ b/tools/clang/lib/Driver/Tools.cpp
+@@ -222,7 +222,7 @@ static void addProfileRT(const ToolChain &TC, const ArgList &Args,
+ // libprofile_rt.so. We used to use the -l:libprofile_rt.a syntax, but that is
+ // not supported by old linkers.
+ std::string ProfileRT =
+- std::string(TC.getDriver().Dir) + "/../lib/libprofile_rt.a";
++ "-l:libprofile_rt.a";
+
+ CmdArgs.push_back(Args.MakeArgString(ProfileRT));
+ }
+@@ -5911,7 +5911,7 @@ void freebsd::Link::ConstructJob(Compilation &C, const JobAction &JA,
+ // forward.
+ if (D.IsUsingLTO(Args)) {
+ CmdArgs.push_back("-plugin");
+- std::string Plugin = ToolChain.getDriver().Dir + "/../lib/LLVMgold.so";
++ std::string Plugin = ToolChain.getDriver().Dir + "/../@libdir@/LLVMgold.so";
+ CmdArgs.push_back(Args.MakeArgString(Plugin));
+
+ // Try to pass driver level flags relevant to LTO code generation down to
+@@ -6534,7 +6534,7 @@ void gnutools::Link::ConstructJob(Compilation &C, const JobAction &JA,
+ // forward.
+ if (D.IsUsingLTO(Args)) {
+ CmdArgs.push_back("-plugin");
+- std::string Plugin = ToolChain.getDriver().Dir + "/../lib/LLVMgold.so";
++ std::string Plugin = ToolChain.getDriver().Dir + "/../@libdir@/LLVMgold.so";
+ CmdArgs.push_back(Args.MakeArgString(Plugin));
+
+ // Try to pass driver level flags relevant to LTO code generation down to
+diff --git a/tools/clang/tools/scan-build/scan-build b/tools/clang/tools/scan-build/scan-build
+index 0f119f6..58f78d9 100755
+--- a/tools/clang/tools/scan-build/scan-build
++++ b/tools/clang/tools/scan-build/scan-build
+@@ -419,7 +419,7 @@ sub CopyFiles {
+
+ my $Dir = shift;
+
+- my $JS = Cwd::realpath("$RealBin/sorttable.js");
++ my $JS = Cwd::realpath("@EPREFIX@/usr/share/llvm/sorttable.js");
+
+ DieDiag("Cannot find 'sorttable.js'.\n")
+ if (! -r $JS);
+@@ -429,7 +429,7 @@ sub CopyFiles {
+ DieDiag("Could not copy 'sorttable.js' to '$Dir'.\n")
+ if (! -r "$Dir/sorttable.js");
+
+- my $CSS = Cwd::realpath("$RealBin/scanview.css");
++ my $CSS = Cwd::realpath("@EPREFIX@/usr/share/llvm/scanview.css");
+
+ DieDiag("Cannot find 'scanview.css'.\n")
+ if (! -r $CSS);
+diff --git a/tools/clang/tools/scan-view/scan-view b/tools/clang/tools/scan-view/scan-view
+index fb27da6..1f8ddb8 100755
+--- a/tools/clang/tools/scan-view/scan-view
++++ b/tools/clang/tools/scan-view/scan-view
+@@ -54,7 +54,7 @@ def start_browser(port, options):
+ webbrowser.open(url)
+
+ def run(port, options, root):
+- import ScanView
++ from clang import ScanView
+ try:
+ print 'Starting scan-view at: http://%s:%d'%(options.host,
+ port)
+--
+2.0.0
+
diff --git a/sys-devel/llvm/files/clang-3.5-gentoo-install.patch b/sys-devel/llvm/files/clang-3.5-gentoo-install.patch
new file mode 100644
index 000000000000..5d4261d0b48b
--- /dev/null
+++ b/sys-devel/llvm/files/clang-3.5-gentoo-install.patch
@@ -0,0 +1,57 @@
+---
+ tools/clang/lib/Driver/Tools.cpp | 2 +-
+ tools/clang/tools/scan-build/scan-build | 4 ++--
+ tools/clang/tools/scan-view/scan-view | 2 +-
+ 3 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/tools/clang/lib/Driver/Tools.cpp b/tools/clang/lib/Driver/Tools.cpp
+index 187ed38..55bcd99 100644
+--- a/tools/clang/lib/Driver/Tools.cpp
++++ b/tools/clang/lib/Driver/Tools.cpp
+@@ -1404,7 +1404,7 @@ static void AddGoldPlugin(const ToolChain &ToolChain, const ArgList &Args,
+ // as gold requires -plugin to come before any -plugin-opt that -Wl might
+ // forward.
+ CmdArgs.push_back("-plugin");
+- std::string Plugin = ToolChain.getDriver().Dir + "/../lib/LLVMgold.so";
++ std::string Plugin = ToolChain.getDriver().Dir + "/../@libdir@/LLVMgold.so";
+ CmdArgs.push_back(Args.MakeArgString(Plugin));
+
+ // Try to pass driver level flags relevant to LTO code generation down to
+diff --git a/tools/clang/tools/scan-build/scan-build b/tools/clang/tools/scan-build/scan-build
+index 0f119f6..58f78d9 100755
+--- a/tools/clang/tools/scan-build/scan-build
++++ b/tools/clang/tools/scan-build/scan-build
+@@ -419,7 +419,7 @@
+
+ my $Dir = shift;
+
+- my $JS = Cwd::realpath("$RealBin/sorttable.js");
++ my $JS = Cwd::realpath("@EPREFIX@/usr/share/llvm/sorttable.js");
+
+ DieDiag("Cannot find 'sorttable.js'.\n")
+ if (! -r $JS);
+@@ -429,7 +429,7 @@
+ DieDiag("Could not copy 'sorttable.js' to '$Dir'.\n")
+ if (! -r "$Dir/sorttable.js");
+
+- my $CSS = Cwd::realpath("$RealBin/scanview.css");
++ my $CSS = Cwd::realpath("@EPREFIX@/usr/share/llvm/scanview.css");
+
+ DieDiag("Cannot find 'scanview.css'.\n")
+ if (! -r $CSS);
+diff --git a/tools/clang/tools/scan-view/scan-view b/tools/clang/tools/scan-view/scan-view
+index fb27da6..1f8ddb8 100755
+--- a/tools/clang/tools/scan-view/scan-view
++++ b/tools/clang/tools/scan-view/scan-view
+@@ -54,7 +54,7 @@ def start_browser(port, options):
+ webbrowser.open(url)
+
+ def run(port, options, root):
+- import ScanView
++ from clang import ScanView
+ try:
+ print 'Starting scan-view at: http://%s:%d'%(options.host,
+ port)
+--
+1.8.4.4
+
diff --git a/sys-devel/llvm/files/clang-3.5-gentoo-runtime-gcc-detection-v3.patch b/sys-devel/llvm/files/clang-3.5-gentoo-runtime-gcc-detection-v3.patch
new file mode 100644
index 000000000000..1f81af0b7ff0
--- /dev/null
+++ b/sys-devel/llvm/files/clang-3.5-gentoo-runtime-gcc-detection-v3.patch
@@ -0,0 +1,42 @@
+From 916572e1243633ddf913c8f32771a3a7f70fd853 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Fri, 5 Sep 2014 16:49:35 +0200
+Subject: [PATCH] Support obtaining active toolchain from gcc-config.
+
+---
+ tools/clang/lib/Driver/ToolChains.cpp | 19 +++++++++++++++++++
+ 1 file changed, 19 insertions(+)
+
+diff --git a/tools/clang/lib/Driver/ToolChains.cpp b/tools/clang/lib/Driver/ToolChains.cpp
+index b46f69d..2d4374d 100644
+--- a/tools/clang/lib/Driver/ToolChains.cpp
++++ b/tools/clang/lib/Driver/ToolChains.cpp
+@@ -1253,6 +1253,25 @@ Generic_GCC::GCCInstallationDetector::init(
+ Prefixes.push_back("/usr");
+ }
+
++ for (unsigned k = 0, ke = CandidateTripleAliases.size(); k < ke; ++k) {
++ llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> File =
++ llvm::MemoryBuffer::getFile(D.SysRoot + "/etc/env.d/gcc/config-" + CandidateTripleAliases[k].str());
++ if (File)
++ {
++ const std::string VersionText = File.get()->getBuffer().rsplit('-').second.substr(0,5).str();
++ const std::string GentooPath = D.SysRoot + "/usr/lib/gcc/" + CandidateTripleAliases[k].str() + "/" + VersionText;
++ if (llvm::sys::fs::exists(GentooPath + "/crtbegin.o"))
++ {
++ Version = GCCVersion::Parse(VersionText);
++ GCCInstallPath = GentooPath;
++ GCCParentLibPath = GCCInstallPath + "/../../..";
++ GCCTriple.setTriple(CandidateTripleAliases[k]);
++ IsValid = true;
++ return;
++ }
++ }
++ }
++
+ // Loop over the various components which exist and select the best GCC
+ // installation available. GCC installs are ranked by version number.
+ Version = GCCVersion::Parse("0.0.0");
+--
+2.1.0
+
diff --git a/sys-devel/llvm/files/clang-3.6-fbsd-gcc49.patch b/sys-devel/llvm/files/clang-3.6-fbsd-gcc49.patch
new file mode 100644
index 000000000000..31f5fc2b7f99
--- /dev/null
+++ b/sys-devel/llvm/files/clang-3.6-fbsd-gcc49.patch
@@ -0,0 +1,25 @@
+Fix build fails with using gcc-4.9 on Gentoo/FreeBSD
+https://bugs.gentoo.org/show_bug.cgi?id=548444
+
+diff --git a/llvm-3.6.0.src/tools/clang/lib/Driver/MSVCToolChain.cpp b/llvm-3.6.0.src/tools/clang/lib/Driver/MSVCToolChain.cpp
+index d6bd5c3..372f76f 100644
+--- a/llvm-3.6.0.src/tools/clang/lib/Driver/MSVCToolChain.cpp
++++ b/llvm-3.6.0.src/tools/clang/lib/Driver/MSVCToolChain.cpp
+@@ -22,6 +22,8 @@
+ #include "llvm/Support/FileSystem.h"
+ #include "llvm/Support/Process.h"
+
++#include <cstdio>
++
+ // Include the necessary headers to interface with the Windows registry and
+ // environment.
+ #if defined(LLVM_ON_WIN32)
+@@ -212,7 +214,7 @@ bool MSVCToolChain::getWindowsSDKDir(std::string &path, int &major,
+ "SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\$VERSION",
+ "InstallationFolder", path, &sdkVersion);
+ if (!sdkVersion.empty())
+- ::sscanf(sdkVersion.c_str(), "v%d.%d", &major, &minor);
++ std::sscanf(sdkVersion.c_str(), "v%d.%d", &major, &minor);
+ return hasSDKDir && !path.empty();
+ }
+
diff --git a/sys-devel/llvm/files/clang-3.6-gentoo-install.patch b/sys-devel/llvm/files/clang-3.6-gentoo-install.patch
new file mode 100644
index 000000000000..6d76ba9660ce
--- /dev/null
+++ b/sys-devel/llvm/files/clang-3.6-gentoo-install.patch
@@ -0,0 +1,48 @@
+---
+ tools/clang/lib/Driver/Tools.cpp | 2 +-
+ tools/clang/tools/scan-build/scan-build | 4 ++--
+ tools/clang/tools/scan-view/scan-view | 2 +-
+ 3 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/tools/clang/lib/Driver/Tools.cpp b/tools/clang/lib/Driver/Tools.cpp
+index 187ed38..55bcd99 100644
+--- a/tools/clang/lib/Driver/Tools.cpp
++++ b/tools/clang/lib/Driver/Tools.cpp
+diff --git a/tools/clang/tools/scan-build/scan-build b/tools/clang/tools/scan-build/scan-build
+index 0f119f6..58f78d9 100755
+--- a/tools/clang/tools/scan-build/scan-build
++++ b/tools/clang/tools/scan-build/scan-build
+@@ -419,7 +419,7 @@
+
+ my $Dir = shift;
+
+- my $JS = Cwd::realpath("$RealBin/sorttable.js");
++ my $JS = Cwd::realpath("@EPREFIX@/usr/share/llvm/sorttable.js");
+
+ DieDiag("Cannot find 'sorttable.js'.\n")
+ if (! -r $JS);
+@@ -429,7 +429,7 @@
+ DieDiag("Could not copy 'sorttable.js' to '$Dir'.\n")
+ if (! -r "$Dir/sorttable.js");
+
+- my $CSS = Cwd::realpath("$RealBin/scanview.css");
++ my $CSS = Cwd::realpath("@EPREFIX@/usr/share/llvm/scanview.css");
+
+ DieDiag("Cannot find 'scanview.css'.\n")
+ if (! -r $CSS);
+diff --git a/tools/clang/tools/scan-view/scan-view b/tools/clang/tools/scan-view/scan-view
+index fb27da6..1f8ddb8 100755
+--- a/tools/clang/tools/scan-view/scan-view
++++ b/tools/clang/tools/scan-view/scan-view
+@@ -54,7 +54,7 @@ def start_browser(port, options):
+ webbrowser.open(url)
+
+ def run(port, options, root):
+- import ScanView
++ from clang import ScanView
+ try:
+ print 'Starting scan-view at: http://%s:%d'%(options.host,
+ port)
+--
+1.8.4.4
+
diff --git a/sys-devel/llvm/files/cmake/0002-cmake-Support-overriding-Sphinx-HTML-doc-install-dir.patch b/sys-devel/llvm/files/cmake/0002-cmake-Support-overriding-Sphinx-HTML-doc-install-dir.patch
new file mode 100644
index 000000000000..3e57f0dcaa68
--- /dev/null
+++ b/sys-devel/llvm/files/cmake/0002-cmake-Support-overriding-Sphinx-HTML-doc-install-dir.patch
@@ -0,0 +1,36 @@
+From 2ec240a76253839cd1c5dc2e964f55698ae468fc Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Mon, 8 Jun 2015 06:43:00 +0200
+Subject: [PATCH 2/4] cmake: Support overriding Sphinx HTML doc install
+ directory
+
+Provide ${PROJECT}_INSTALL_HTML variables (e.g. LLVM_INSTALL_HTML) to
+override Sphinx HTML doc install directory.
+
+Fixes: https://llvm.org/bugs/show_bug.cgi?id=23780
+---
+ cmake/modules/AddSphinxTarget.cmake | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/cmake/modules/AddSphinxTarget.cmake b/cmake/modules/AddSphinxTarget.cmake
+index 045dc23..9c9c444 100644
+--- a/cmake/modules/AddSphinxTarget.cmake
++++ b/cmake/modules/AddSphinxTarget.cmake
+@@ -53,8 +53,12 @@ function (add_sphinx_target builder project)
+ DESTINATION share/man/man1)
+
+ elseif (builder STREQUAL html)
+- install(DIRECTORY "${SPHINX_BUILD_DIR}"
+- DESTINATION "share/doc/${project}")
++ string(TOUPPER "${project}" project_upper)
++ set(${project_upper}_INSTALL_HTML "share/doc/${project}/html"
++ CACHE STRING "HTML documentation install directory for ${project}")
++
++ install(DIRECTORY "${SPHINX_BUILD_DIR}/"
++ DESTINATION "${${project_upper}_INSTALL_HTML}")
+ else()
+ message(WARNING Installation of ${builder} not supported)
+ endif()
+--
+2.4.3
+
diff --git a/sys-devel/llvm/files/cmake/0003-cmake-Add-an-ordering-dep-between-HTML-man-Sphinx-ta.patch b/sys-devel/llvm/files/cmake/0003-cmake-Add-an-ordering-dep-between-HTML-man-Sphinx-ta.patch
new file mode 100644
index 000000000000..b1c74c69443f
--- /dev/null
+++ b/sys-devel/llvm/files/cmake/0003-cmake-Add-an-ordering-dep-between-HTML-man-Sphinx-ta.patch
@@ -0,0 +1,32 @@
+From 4f7092ba05cccfeea7d26177d93f3d7a57d9bce2 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Mon, 8 Jun 2015 14:29:03 +0200
+Subject: [PATCH 3/4] cmake: Add an ordering dep between HTML & man Sphinx
+ targets
+
+Add a dependency between HTML & manpage Sphinx targets to prevent two
+instances of Sphinx from running in parallel, and therefore solves race
+conditions reusing the same doctree directory.
+
+Fixes: https://llvm.org/bugs/show_bug.cgi?id=23781
+---
+ docs/CMakeLists.txt | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
+index da27627..63309a6 100644
+--- a/docs/CMakeLists.txt
++++ b/docs/CMakeLists.txt
+@@ -100,6 +100,9 @@ if (LLVM_ENABLE_SPHINX)
+
+ if (${SPHINX_OUTPUT_MAN})
+ add_sphinx_target(man llvm)
++ if (${SPHINX_OUTPUT_HTML})
++ add_dependencies(docs-llvm-html docs-llvm-man)
++ endif()
+ endif()
+
+ endif()
+--
+2.4.3
+
diff --git a/sys-devel/llvm/files/cmake/0004-cmake-Do-not-install-libgtest.patch b/sys-devel/llvm/files/cmake/0004-cmake-Do-not-install-libgtest.patch
new file mode 100644
index 000000000000..92ca2e47e81b
--- /dev/null
+++ b/sys-devel/llvm/files/cmake/0004-cmake-Do-not-install-libgtest.patch
@@ -0,0 +1,28 @@
+From d9f80393cfd4e586242ac3efd4e6ba6b49ce39ae Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Tue, 9 Jun 2015 11:58:52 +0200
+Subject: [PATCH 4/4] cmake: Do not install libgtest
+
+libgtest is an internal test dependency, and should not be installed to
+the live system as a part of LLVM.
+---
+ utils/unittest/CMakeLists.txt | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/utils/unittest/CMakeLists.txt b/utils/unittest/CMakeLists.txt
+index b34e22a..3fe5884 100644
+--- a/utils/unittest/CMakeLists.txt
++++ b/utils/unittest/CMakeLists.txt
+@@ -41,6 +41,9 @@ if (PTHREAD_LIBRARY_PATH)
+ list(APPEND LIBS pthread)
+ endif()
+
++# Delay building until the tests pull it in, and avoid installing it
++set(EXCLUDE_FROM_ALL ON)
++
+ add_llvm_library(gtest
+ googletest/src/gtest-all.cc
+
+--
+2.4.3
+
diff --git a/sys-devel/llvm/files/cmake/clang-0001-Install-clang-runtime-into-usr-lib-without-suffix.patch b/sys-devel/llvm/files/cmake/clang-0001-Install-clang-runtime-into-usr-lib-without-suffix.patch
new file mode 100644
index 000000000000..904a72a358a9
--- /dev/null
+++ b/sys-devel/llvm/files/cmake/clang-0001-Install-clang-runtime-into-usr-lib-without-suffix.patch
@@ -0,0 +1,52 @@
+From b28503def986bcbc388a04be0d51cbe80bc59506 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Tue, 9 Jun 2015 12:11:50 +0200
+Subject: [PATCH] Install clang runtime into /usr/lib (without suffix)
+
+---
+ lib/Driver/Driver.cpp | 3 +--
+ lib/Frontend/CompilerInvocation.cpp | 3 +--
+ lib/Headers/CMakeLists.txt | 2 +-
+ 3 files changed, 3 insertions(+), 5 deletions(-)
+
+diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
+index a04a1f8..418d46a 100644
+--- a/tools/clang/lib/Driver/Driver.cpp
++++ b/tools/clang//lib/Driver/Driver.cpp
+@@ -66,8 +66,7 @@ Driver::Driver(StringRef ClangExecutable, StringRef DefaultTargetTriple,
+ if (ClangResourceDir != "") {
+ llvm::sys::path::append(P, ClangResourceDir);
+ } else {
+- StringRef ClangLibdirSuffix(CLANG_LIBDIR_SUFFIX);
+- llvm::sys::path::append(P, "..", Twine("lib") + ClangLibdirSuffix, "clang",
++ llvm::sys::path::append(P, "..", "lib", "clang",
+ CLANG_VERSION_STRING);
+ }
+ ResourceDir = P.str();
+diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp
+index 9485767..0b9ecbd 100644
+--- a/tools/clang/lib/Frontend/CompilerInvocation.cpp
++++ b/tools/clang/lib/Frontend/CompilerInvocation.cpp
+@@ -1053,8 +1053,7 @@ std::string CompilerInvocation::GetResourcesPath(const char *Argv0,
+ if (ClangResourceDir != "") {
+ llvm::sys::path::append(P, ClangResourceDir);
+ } else {
+- StringRef ClangLibdirSuffix(CLANG_LIBDIR_SUFFIX);
+- llvm::sys::path::append(P, "..", Twine("lib") + ClangLibdirSuffix, "clang",
++ llvm::sys::path::append(P, "..", "lib", "clang",
+ CLANG_VERSION_STRING);
+ }
+
+diff --git a/lib/Headers/CMakeLists.txt b/lib/Headers/CMakeLists.txt
+index 29a738e..3769d23 100644
+--- a/tools/clang/lib/Headers/CMakeLists.txt
++++ b/tools/clang/lib/Headers/CMakeLists.txt
+@@ -93,4 +93,4 @@ set_target_properties(clang-headers PROPERTIES FOLDER "Misc")
+ install(
+ FILES ${files} ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
++ DESTINATION lib/clang/${CLANG_VERSION}/include)
+--
+2.4.3
+
diff --git a/sys-devel/llvm/files/cmake/clang-0002-cmake-Make-CLANG_LIBDIR_SUFFIX-overridable.patch b/sys-devel/llvm/files/cmake/clang-0002-cmake-Make-CLANG_LIBDIR_SUFFIX-overridable.patch
new file mode 100644
index 000000000000..0b93deba0b58
--- /dev/null
+++ b/sys-devel/llvm/files/cmake/clang-0002-cmake-Make-CLANG_LIBDIR_SUFFIX-overridable.patch
@@ -0,0 +1,28 @@
+From d07632abe23d55eec2aae303a142a97765a77d32 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Tue, 9 Jun 2015 12:20:06 +0200
+Subject: [PATCH 2/2] cmake: Make CLANG_LIBDIR_SUFFIX overridable
+
+Make CLANG_LIBDIR_SUFFIX a cache variable so that it can be explicitly
+overriden. It is used purely to find the LLVMgold.so plugin, so we want
+to set it to native suffix.
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 357286b..647f976 100644
+--- a/tools/clang/CMakeLists.txt
++++ b/tools/clang/CMakeLists.txt
+@@ -203,7 +203,7 @@ set(CLANG_VENDOR_UTI "org.llvm.clang" CACHE STRING
+ "Vendor-specific uti.")
+
+ # The libdir suffix must exactly match whatever LLVM's configuration used.
+-set(CLANG_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}")
++set(CLANG_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING "")
+
+ set(CLANG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+ set(CLANG_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
+--
+2.4.3
+
diff --git a/sys-devel/llvm/files/cmake/compiler-rt-0001-cmake-Install-compiler-rt-into-usr-lib-without-suffi.patch b/sys-devel/llvm/files/cmake/compiler-rt-0001-cmake-Install-compiler-rt-into-usr-lib-without-suffi.patch
new file mode 100644
index 000000000000..93538009d291
--- /dev/null
+++ b/sys-devel/llvm/files/cmake/compiler-rt-0001-cmake-Install-compiler-rt-into-usr-lib-without-suffi.patch
@@ -0,0 +1,25 @@
+From 8bd62a681744d3c31a0837c0f84f99ea4987e017 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Tue, 9 Jun 2015 12:17:57 +0200
+Subject: [PATCH] cmake: Install compiler-rt into /usr/lib (without suffix)
+
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 0d8a880..5ae98a9 100644
+--- a/projects/compiler-rt/CMakeLists.txt
++++ b/projects/compiler-rt/CMakeLists.txt
+@@ -52,7 +52,7 @@ if (NOT COMPILER_RT_STANDALONE_BUILD)
+ # Setup the paths where compiler-rt runtimes and headers should be stored.
+ set(COMPILER_RT_OUTPUT_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION})
+ set(COMPILER_RT_EXEC_OUTPUT_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
+- set(COMPILER_RT_INSTALL_PATH lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION})
++ set(COMPILER_RT_INSTALL_PATH lib/clang/${CLANG_VERSION})
+ option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests."
+ ${LLVM_INCLUDE_TESTS})
+ option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered"
+--
+2.4.3
+
diff --git a/sys-devel/llvm/files/llvm-2.6-commandguide-nops.patch b/sys-devel/llvm/files/llvm-2.6-commandguide-nops.patch
new file mode 100644
index 000000000000..583fdf95f952
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-2.6-commandguide-nops.patch
@@ -0,0 +1,30 @@
+--- docs/CommandGuide/Makefile.orig 2009-10-26 16:54:33.000000000 +0100
++++ docs/CommandGuide/Makefile 2009-10-26 17:32:03.000000000 +0100
+@@ -19,7 +19,7 @@
+ DST_PS_DIR=ps/
+
+ # If we are in BUILD_FOR_WEBSITE mode, default to the all target.
+-all:: html man ps
++all:: html man
+
+ clean:
+ rm -f pod2htm*.*~~ $(HTML) $(MAN) $(PS)
+@@ -81,7 +81,7 @@
+ MAN_DIR := $(PROJ_mandir)/man1
+ PS_DIR := $(PROJ_docsdir)/ps
+
+-install-local:: $(HTML) $(INSTALL_MANS) $(PS)
++install-local:: $(HTML) $(INSTALL_MANS)
+ $(Echo) Installing HTML CommandGuide Documentation
+ $(Verb) $(MKDIR) $(HTML_DIR)
+ $(Verb) $(DataInstall) $(HTML) $(HTML_DIR)
+@@ -90,9 +90,6 @@
+ $(Echo) Installing MAN CommandGuide Documentation
+ $(Verb) $(MKDIR) $(MAN_DIR)
+ $(Verb) $(DataInstall) $(INSTALL_MANS) $(MAN_DIR)
+- $(Echo) Installing PS CommandGuide Documentation
+- $(Verb) $(MKDIR) $(PS_DIR)
+- $(Verb) $(DataInstall) $(PS) $(PS_DIR)
+
+ uninstall-local::
+ $(Echo) Uninstalling CommandGuide Documentation
diff --git a/sys-devel/llvm/files/llvm-2.7-nodoctargz.patch b/sys-devel/llvm/files/llvm-2.7-nodoctargz.patch
new file mode 100644
index 000000000000..cce09eb20fc8
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-2.7-nodoctargz.patch
@@ -0,0 +1,47 @@
+--- docs/Makefile.orig 2010-04-26 15:00:58.000000000 +0200
++++ docs/Makefile 2010-04-26 15:03:12.000000000 +0200
+@@ -46,13 +46,12 @@
+ # 'make generated BUILD_FOR_WEBSITE=1'
+ generated:: doxygen ocamldoc
+
+-install-html: $(PROJ_OBJ_DIR)/html.tar.gz
++install-html:
+ $(Echo) Installing HTML documentation
+ $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html
+ $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html/img
+ $(Verb) $(DataInstall) $(HTML) $(DESTDIR)$(PROJ_docsdir)/html
+ $(Verb) $(DataInstall) $(IMAGES) $(DESTDIR)$(PROJ_docsdir)/html/img
+- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/html.tar.gz $(DESTDIR)$(PROJ_docsdir)
+
+ $(PROJ_OBJ_DIR)/html.tar.gz: $(HTML)
+ $(Echo) Packaging HTML documentation
+@@ -64,12 +63,11 @@
+ install-doxygen: doxygen
+ $(Echo) Installing doxygen documentation
+ $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html/doxygen
+- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/doxygen.tar.gz $(DESTDIR)$(PROJ_docsdir)
+ $(Verb) cd $(PROJ_OBJ_DIR)/doxygen && \
+ $(FIND) . -type f -exec \
+ $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/html/doxygen \;
+
+-doxygen: regendoc $(PROJ_OBJ_DIR)/doxygen.tar.gz
++doxygen: regendoc
+
+ regendoc:
+ $(Echo) Building doxygen documentation
+@@ -95,7 +93,6 @@
+ install-ocamldoc: ocamldoc
+ $(Echo) Installing ocamldoc documentation
+ $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html
+- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(DESTDIR)$(PROJ_docsdir)
+ $(Verb) cd $(PROJ_OBJ_DIR)/ocamldoc && \
+ $(FIND) . -type f -exec \
+ $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html \;
+@@ -105,7 +102,6 @@
+ $(Verb) $(RM) -rf $(PROJ_OBJ_DIR)/ocamldoc.tar*
+ $(Verb) $(TAR) cf $(PROJ_OBJ_DIR)/ocamldoc.tar ocamldoc
+ $(Verb) $(GZIP) $(PROJ_OBJ_DIR)/ocamldoc.tar
+- $(Verb) $(CP) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(PROJ_OBJ_DIR)/ocamldoc/html/
+
+ regen-ocamldoc:
+ $(Echo) Building ocamldoc documentation
diff --git a/sys-devel/llvm/files/llvm-2.8-alignof.patch b/sys-devel/llvm/files/llvm-2.8-alignof.patch
new file mode 100644
index 000000000000..ae7f314d2d26
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-2.8-alignof.patch
@@ -0,0 +1,59 @@
+Index: include/llvm/ADT/StringMap.h
+===================================================================
+--- include/llvm/ADT/StringMap.h (révision 117773)
++++ include/llvm/ADT/StringMap.h (révision 117774)
+@@ -167,7 +167,7 @@
+
+ unsigned AllocSize = static_cast<unsigned>(sizeof(StringMapEntry))+
+ KeyLength+1;
+- unsigned Alignment = alignof<StringMapEntry>();
++ unsigned Alignment = alignOf<StringMapEntry>();
+
+ StringMapEntry *NewItem =
+ static_cast<StringMapEntry*>(Allocator.Allocate(AllocSize,Alignment));
+Index: include/llvm/Support/AlignOf.h
+===================================================================
+--- include/llvm/Support/AlignOf.h (révision 117773)
++++ include/llvm/Support/AlignOf.h (révision 117774)
+@@ -49,12 +49,12 @@
+
+ };
+
+-/// alignof - A templated function that returns the mininum alignment of
++/// alignOf - A templated function that returns the mininum alignment of
+ /// of a type. This provides no extra functionality beyond the AlignOf
+ /// class besides some cosmetic cleanliness. Example usage:
+-/// alignof<int>() returns the alignment of an int.
++/// alignOf<int>() returns the alignment of an int.
+ template <typename T>
+-static inline unsigned alignof() { return AlignOf<T>::Alignment; }
++static inline unsigned alignOf() { return AlignOf<T>::Alignment; }
+
+ } // end namespace llvm
+ #endif
+Index: include/llvm/Support/Allocator.h
+===================================================================
+--- include/llvm/Support/Allocator.h (révision 117773)
++++ include/llvm/Support/Allocator.h (révision 117774)
+@@ -201,7 +201,7 @@
+ char *End = Slab == Allocator.CurSlab ? Allocator.CurPtr :
+ (char *)Slab + Slab->Size;
+ for (char *Ptr = (char*)(Slab+1); Ptr < End; Ptr += sizeof(T)) {
+- Ptr = Allocator.AlignPtr(Ptr, alignof<T>());
++ Ptr = Allocator.AlignPtr(Ptr, alignOf<T>());
+ if (Ptr + sizeof(T) <= End)
+ reinterpret_cast<T*>(Ptr)->~T();
+ }
+Index: include/llvm/CodeGen/SlotIndexes.h
+===================================================================
+--- include/llvm/CodeGen/SlotIndexes.h (révision 117773)
++++ include/llvm/CodeGen/SlotIndexes.h (révision 117774)
+@@ -393,7 +393,7 @@
+ IndexListEntry *entry =
+ static_cast<IndexListEntry*>(
+ ileAllocator.Allocate(sizeof(IndexListEntry),
+- alignof<IndexListEntry>()));
++ alignOf<IndexListEntry>()));
+
+ new (entry) IndexListEntry(mi, index);
+
diff --git a/sys-devel/llvm/files/llvm-2.8-darwin8.patch b/sys-devel/llvm/files/llvm-2.8-darwin8.patch
new file mode 100644
index 000000000000..284ab47c805a
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-2.8-darwin8.patch
@@ -0,0 +1,15 @@
+Avoid like in Makefile.rules
+ld: -rpath can only be used when targeting Mac OS X 10.5 or later
+
+--- unittests/Makefile.unittest
++++ unittests/Makefile.unittest
+@@ -37,7 +37,9 @@
+ ifeq ($(ENABLE_SHARED), 1)
+ # Add the absolute path to the dynamic library. This is ok because
+ # we'll never install unittests.
++ifneq ($(DARWIN_MAJVERS),4)
+ LD.Flags += $(RPATH) -Wl,$(SharedLibDir)
++endif
+ # Also set {DYLD,LD}_LIBRARY_PATH because OSX ignores the rpath most
+ # of the time.
+ Run.Shared := $(SHLIBPATH_VAR)="$(SharedLibDir)$${$(SHLIBPATH_VAR):+:}$$$(SHLIBPATH_VAR)"
diff --git a/sys-devel/llvm/files/llvm-2.9-Operator.h-c++0x.patch b/sys-devel/llvm/files/llvm-2.9-Operator.h-c++0x.patch
new file mode 100644
index 000000000000..b95d7d772ace
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-2.9-Operator.h-c++0x.patch
@@ -0,0 +1,57 @@
+--- llvm/trunk/include/llvm/Operator.h 2011/02/07 16:40:21 125006
++++ llvm/trunk/include/llvm/Operator.h 2011/05/08 01:59:22 131062
+@@ -186,28 +186,46 @@
+ };
+
+ class AddOperator
+- : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Add> {};
++ : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Add> {
++ ~AddOperator(); // DO NOT IMPLEMENT
++};
+ class SubOperator
+- : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Sub> {};
++ : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Sub> {
++ ~SubOperator(); // DO NOT IMPLEMENT
++};
+ class MulOperator
+- : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Mul> {};
++ : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Mul> {
++ ~MulOperator(); // DO NOT IMPLEMENT
++};
+ class ShlOperator
+- : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Shl> {};
++ : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Shl> {
++ ~ShlOperator(); // DO NOT IMPLEMENT
++};
+
+
+ class SDivOperator
+- : public ConcreteOperator<PossiblyExactOperator, Instruction::SDiv> {};
++ : public ConcreteOperator<PossiblyExactOperator, Instruction::SDiv> {
++ ~SDivOperator(); // DO NOT IMPLEMENT
++};
+ class UDivOperator
+- : public ConcreteOperator<PossiblyExactOperator, Instruction::UDiv> {};
++ : public ConcreteOperator<PossiblyExactOperator, Instruction::UDiv> {
++ ~UDivOperator(); // DO NOT IMPLEMENT
++};
+ class AShrOperator
+- : public ConcreteOperator<PossiblyExactOperator, Instruction::AShr> {};
++ : public ConcreteOperator<PossiblyExactOperator, Instruction::AShr> {
++ ~AShrOperator(); // DO NOT IMPLEMENT
++};
+ class LShrOperator
+- : public ConcreteOperator<PossiblyExactOperator, Instruction::LShr> {};
++ : public ConcreteOperator<PossiblyExactOperator, Instruction::LShr> {
++ ~LShrOperator(); // DO NOT IMPLEMENT
++};
+
+
+
+ class GEPOperator
+ : public ConcreteOperator<Operator, Instruction::GetElementPtr> {
++ ~GEPOperator(); // DO NOT IMPLEMENT
++
+ enum {
+ IsInBounds = (1 << 0)
+ };
diff --git a/sys-devel/llvm/files/llvm-2.9-gcc4.7.patch b/sys-devel/llvm/files/llvm-2.9-gcc4.7.patch
new file mode 100644
index 000000000000..a48ad961c9be
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-2.9-gcc4.7.patch
@@ -0,0 +1,14 @@
+---
+ Intercept.cpp | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/lib/ExecutionEngine/JIT/Intercept.cpp 2012-05-17 16:11:46.956180361 +0200
++++ b/lib/ExecutionEngine/JIT/Intercept.cpp 2012-05-17 16:14:35.256184996 +0200
+@@ -52,6 +52,7 @@
+ #include <sys/stat.h>
+ #endif
+ #include <fcntl.h>
++#include <unistd.h>
+ /* stat functions are redirecting to __xstat with a version number. On x86-64
+ * linking with libc_nonshared.a and -Wl,--export-dynamic doesn't make 'stat'
+ * available as an exported symbol, so we have to add it explicitly.
diff --git a/sys-devel/llvm/files/llvm-2.9-nodoctargz.patch b/sys-devel/llvm/files/llvm-2.9-nodoctargz.patch
new file mode 100644
index 000000000000..9507817b45e8
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-2.9-nodoctargz.patch
@@ -0,0 +1,39 @@
+--- docs/Makefile.orig 2011-02-28 21:30:46.000000000 +0100
++++ docs/Makefile 2011-02-28 21:35:22.000000000 +0100
+@@ -53,13 +53,12 @@
+ # 'make generated BUILD_FOR_WEBSITE=1'
+ generated:: $(generated_targets)
+
+-install-html: $(PROJ_OBJ_DIR)/html.tar.gz
++install-html:
+ $(Echo) Installing HTML documentation
+ $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html
+ $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html/img
+ $(Verb) $(DataInstall) $(HTML) $(DESTDIR)$(PROJ_docsdir)/html
+ $(Verb) $(DataInstall) $(IMAGES) $(DESTDIR)$(PROJ_docsdir)/html/img
+- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/html.tar.gz $(DESTDIR)$(PROJ_docsdir)
+
+ $(PROJ_OBJ_DIR)/html.tar.gz: $(HTML)
+ $(Echo) Packaging HTML documentation
+@@ -71,12 +70,11 @@
+ install-doxygen: doxygen
+ $(Echo) Installing doxygen documentation
+ $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html/doxygen
+- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/doxygen.tar.gz $(DESTDIR)$(PROJ_docsdir)
+ $(Verb) cd $(PROJ_OBJ_DIR)/doxygen && \
+ $(FIND) . -type f -exec \
+ $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/html/doxygen \;
+
+-doxygen: regendoc $(PROJ_OBJ_DIR)/doxygen.tar.gz
++doxygen: regendoc
+
+ regendoc:
+ $(Echo) Building doxygen documentation
+@@ -102,7 +100,6 @@
+ install-ocamldoc: ocamldoc
+ $(Echo) Installing ocamldoc documentation
+ $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html
+- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(DESTDIR)$(PROJ_docsdir)
+ $(Verb) cd $(PROJ_OBJ_DIR)/ocamldoc && \
+ $(FIND) . -type f -exec \
+ $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html \;
diff --git a/sys-devel/llvm/files/llvm-3.0-PPCCompilationCallbackC_static.patch b/sys-devel/llvm/files/llvm-3.0-PPCCompilationCallbackC_static.patch
new file mode 100644
index 000000000000..04e40245c671
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.0-PPCCompilationCallbackC_static.patch
@@ -0,0 +1,27 @@
+https://bugs.gentoo.org/show_bug.cgi?id=403519
+http://llvm.org/viewvc/llvm-project?view=rev&revision=153938
+
+--- llvm/trunk/lib/Target/PowerPC/PPCJITInfo.cpp 2011/06/15 15:29:47 133059
++++ llvm/trunk/lib/Target/PowerPC/PPCJITInfo.cpp 2012/04/03 06:59:28 153938
+@@ -291,9 +291,10 @@
+ }
+ #endif
+
+-extern "C" void *PPCCompilationCallbackC(unsigned *StubCallAddrPlus4,
+- unsigned *OrigCallAddrPlus4,
+- bool is64Bit) {
++extern "C" {
++static void* LLVM_ATTRIBUTE_USED PPCCompilationCallbackC(unsigned *StubCallAddrPlus4,
++ unsigned *OrigCallAddrPlus4,
++ bool is64Bit) {
+ // Adjust the pointer to the address of the call instruction in the stub
+ // emitted by emitFunctionStub, rather than the instruction after it.
+ unsigned *StubCallAddr = StubCallAddrPlus4 - 1;
+@@ -337,6 +338,7 @@
+ // stack after we restore all regs.
+ return Target;
+ }
++}
+
+
+
diff --git a/sys-devel/llvm/files/llvm-3.0-PPC_macro.patch b/sys-devel/llvm/files/llvm-3.0-PPC_macro.patch
new file mode 100644
index 000000000000..c485e9ba6847
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.0-PPC_macro.patch
@@ -0,0 +1,43 @@
+Index: llvm-3.0-3.0/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.h
+===================================================================
+--- llvm-3.0-3.0.orig/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.h 2011-07-25 23:24:55.000000000 +0000
++++ llvm-3.0-3.0/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.h 2011-12-02 13:06:48.000000000 +0000
+@@ -34,6 +34,10 @@
+
+ } // End llvm namespace
+
++// Generated files will use "namespace PPC". To avoid symbol clash,
++// undefine PPC here. PPC may be predefined on some hosts.
++#undef PPC
++
+ // Defines symbolic names for PowerPC registers. This defines a mapping from
+ // register name to register number.
+ //
+Index: llvm-3.0-3.0/lib/Target/PowerPC/MCTargetDesc/PPCPredicates.h
+===================================================================
+--- llvm-3.0-3.0.orig/lib/Target/PowerPC/MCTargetDesc/PPCPredicates.h 2011-07-26 00:24:13.000000000 +0000
++++ llvm-3.0-3.0/lib/Target/PowerPC/MCTargetDesc/PPCPredicates.h 2011-12-02 13:06:48.000000000 +0000
+@@ -14,6 +14,10 @@
+ #ifndef LLVM_TARGET_POWERPC_PPCPREDICATES_H
+ #define LLVM_TARGET_POWERPC_PPCPREDICATES_H
+
++// Generated files will use "namespace PPC". To avoid symbol clash,
++// undefine PPC here. PPC may be predefined on some hosts.
++#undef PPC
++
+ namespace llvm {
+ namespace PPC {
+ /// Predicate - These are "(BI << 5) | BO" for various predicates.
+Index: llvm-3.0-3.0/lib/Target/PowerPC/MCTargetDesc/PPCFixupKinds.h
+===================================================================
+--- llvm-3.0-3.0.orig/lib/Target/PowerPC/MCTargetDesc/PPCFixupKinds.h 2011-07-25 19:53:23.000000000 +0000
++++ llvm-3.0-3.0/lib/Target/PowerPC/MCTargetDesc/PPCFixupKinds.h 2011-12-02 16:21:23.000000000 +0000
+@@ -12,6 +12,8 @@
+
+ #include "llvm/MC/MCFixup.h"
+
++#undef PPC
++
+ namespace llvm {
+ namespace PPC {
+ enum Fixups {
diff --git a/sys-devel/llvm/files/llvm-3.0-gold_LTO_link.patch b/sys-devel/llvm/files/llvm-3.0-gold_LTO_link.patch
new file mode 100644
index 000000000000..031448d2888a
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.0-gold_LTO_link.patch
@@ -0,0 +1,10 @@
+--- tools/gold/Makefile 2011/11/23 03:03:21 145094
++++ tools/gold/Makefile 2011/11/23 03:07:25 145095
+@@ -24,6 +24,6 @@
+ # Because off_t is used in the public API, the largefile parts are required for
+ # ABI compatibility.
+ CXXFLAGS+=-I$(BINUTILS_INCDIR) -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
+-CXXFLAGS+=$(SharedLibDir)/$(SharedPrefix)LTO$(SHLIBEXT)
++CXXFLAGS+=-L$(SharedLibDir)/$(SharedPrefix) -lLTO
+
+ include $(LEVEL)/Makefile.common
diff --git a/sys-devel/llvm/files/llvm-3.0-ocaml_install.patch b/sys-devel/llvm/files/llvm-3.0-ocaml_install.patch
new file mode 100644
index 000000000000..18f5cf6c373c
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.0-ocaml_install.patch
@@ -0,0 +1,16 @@
+https://bugs.gentoo.org/show_bug.cgi?id=393023
+http://llvm.org/bugs/show_bug.cgi?id=11177
+
+Index: llvm-3.0-3.0/bindings/ocaml/llvm/Makefile
+===================================================================
+--- llvm-3.0-3.0.orig/bindings/ocaml/llvm/Makefile 2011-11-15 12:17:02.785987852 +0100
++++ llvm-3.0-3.0/bindings/ocaml/llvm/Makefile 2011-11-15 12:20:12.661983615 +0100
+@@ -30,7 +30,7 @@
+ $(OcamlDir)/META.llvm: META.llvm
+ $(Verb) $(CP) -f $< $@
+
+-install-meta:: $(ObjDir)/META.llvm
++install-meta:: $(ObjDir)/../META.llvm
+ $(Echo) "Install $(BuildMode) $(DestMETA)"
+ $(Verb) $(MKDIR) $(PROJ_libocamldir)
+ $(Verb) $(DataInstall) META.llvm "$(DestMETA)"
diff --git a/sys-devel/llvm/files/llvm-3.0-set_soname.patch b/sys-devel/llvm/files/llvm-3.0-set_soname.patch
new file mode 100644
index 000000000000..69ba74dddad8
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.0-set_soname.patch
@@ -0,0 +1,12 @@
+https://bugs.gentoo.org/show_bug.cgi?id=409267
+http://llvm.org/bugs/show_bug.cgi?id=12334
+--- tools/llvm-shlib/Makefile.orig 2012-03-26 18:14:13.071797115 +0200
++++ tools/llvm-shlib/Makefile 2012-03-26 17:31:12.491196254 +0200
+@@ -67,6 +67,7 @@
+ # Include everything from the .a's into the shared library.
+ LLVMLibsOptions := -Wl,--whole-archive $(LLVMLibsOptions) \
+ -Wl,--no-whole-archive
++ LLVMLibsOptions += -Wl,--soname,lib$(LIBRARYNAME)$(SHLIBEXT)
+ endif
+
+ ifeq ($(HOST_OS),Linux)
diff --git a/sys-devel/llvm/files/llvm-3.1-ExecutionEngine_tests_xfail_arm.patch b/sys-devel/llvm/files/llvm-3.1-ExecutionEngine_tests_xfail_arm.patch
new file mode 100644
index 000000000000..05a20e673a87
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.1-ExecutionEngine_tests_xfail_arm.patch
@@ -0,0 +1,27 @@
+diff -Naur llvm-3.1.src/test/ExecutionEngine/2002-12-16-ArgTest.ll llvm.src/test/ExecutionEngine/2002-12-16-ArgTest.ll
+--- llvm-3.1.src/test/ExecutionEngine/2002-12-16-ArgTest.ll 2012-04-12 22:13:57.000000000 +0200
++++ llvm.src/test/ExecutionEngine/2002-12-16-ArgTest.ll 2012-10-08 15:06:30.000000000 +0200
+@@ -1,4 +1,5 @@
+ ; RUN: %lli %s > /dev/null
++; XFAIL: arm
+
+ @.LC0 = internal global [10 x i8] c"argc: %d\0A\00" ; <[10 x i8]*> [#uses=1]
+
+diff -Naur llvm-3.1.src/test/ExecutionEngine/test-fp-no-external-funcs.ll llvm.src/test/ExecutionEngine/test-fp-no-external-funcs.ll
+--- llvm-3.1.src/test/ExecutionEngine/test-fp-no-external-funcs.ll 2012-04-12 22:13:57.000000000 +0200
++++ llvm.src/test/ExecutionEngine/test-fp-no-external-funcs.ll 2012-10-08 15:06:30.000000000 +0200
+@@ -1,4 +1,5 @@
+ ; RUN: %lli %s > /dev/null
++; XFAIL: arm
+
+ define double @test(double* %DP, double %Arg) {
+ %D = load double* %DP ; <double> [#uses=1]
+diff -Naur llvm-3.1.src/test/ExecutionEngine/test-fp.ll llvm.src/test/ExecutionEngine/test-fp.ll
+--- llvm-3.1.src/test/ExecutionEngine/test-fp.ll 2012-04-12 22:13:57.000000000 +0200
++++ llvm.src/test/ExecutionEngine/test-fp.ll 2012-10-08 15:06:30.000000000 +0200
+@@ -1,4 +1,5 @@
+ ; RUN: %lli %s > /dev/null
++; XFAIL: arm
+
+ define double @test(double* %DP, double %Arg) {
+ %D = load double* %DP ; <double> [#uses=1]
diff --git a/sys-devel/llvm/files/llvm-3.1-docs-pod-markup-fixes.patch b/sys-devel/llvm/files/llvm-3.1-docs-pod-markup-fixes.patch
new file mode 100644
index 000000000000..cd8a62a037d2
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.1-docs-pod-markup-fixes.patch
@@ -0,0 +1,28 @@
+--- llvm-3.1.src/docs/CommandGuide/lit.pod~ 2012-03-27 03:01:14.000000000 +0900
++++ llvm-3.1.src/docs/CommandGuide/lit.pod 2013-01-23 12:47:30.297510832 +0900
+@@ -386,8 +386,6 @@
+ ********************
+ PASS: D (4 of 4)
+
+-=back
+-
+ =head2 LIT EXAMPLE TESTS
+
+ The B<lit> distribution contains several example implementations of test suites
+--- llvm-3.1.src/docs/CommandGuide/llvm-cov.pod~ 2011-11-29 08:39:25.000000000 +0900
++++ llvm-3.1.src/docs/CommandGuide/llvm-cov.pod 2013-01-23 13:44:32.184212441 +0900
+@@ -18,12 +18,12 @@
+
+ =over
+
+-=item B<-gcno=filename]
++=item B<-gcno=filename>
+
+ This option selects input description file generated by compiler while instrumenting
+ program.
+
+-=item B<-gcda=filename]
++=item B<-gcda=filename>
+
+ This option selects coverage data file generated by instrumented compiler.
+
diff --git a/sys-devel/llvm/files/llvm-3.1-fix_debug_line_info.patch b/sys-devel/llvm/files/llvm-3.1-fix_debug_line_info.patch
new file mode 100644
index 000000000000..de2d46b618c3
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.1-fix_debug_line_info.patch
@@ -0,0 +1,65 @@
+From 737fdba46f2b2b7d39bc728d15ea2334c44779e0 Mon Sep 17 00:00:00 2001
+From: Ben Longbons <b.r.longbons@gmail.com>
+Date: Fri, 29 Jun 2012 12:58:34 -0700
+Subject: [PATCH] Revert "Patch to set is_stmt a little better for prologue
+ lines in a function."
+
+This meants that the debugger could find meaningful line information.
+
+This reverts commit 60b35f408bc3194e7ea4e96367c0b42dc5e7f850.
+---
+ lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 7 ++-----
+ test/DebugInfo/X86/ending-run.ll | 6 ++----
+ 2 files changed, 4 insertions(+), 9 deletions(-)
+
+diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+index 3e79a6d..24aedfb 100644
+--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
++++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+@@ -1093,15 +1093,12 @@ void DwarfDebug::beginInstruction(const MachineInstr *MI) {
+ if (!MI->isDebugValue()) {
+ DebugLoc DL = MI->getDebugLoc();
+ if (DL != PrevInstLoc && (!DL.isUnknown() || UnknownLocations)) {
+- unsigned Flags = 0;
++ unsigned Flags = DWARF2_FLAG_IS_STMT;
+ PrevInstLoc = DL;
+ if (DL == PrologEndLoc) {
+ Flags |= DWARF2_FLAG_PROLOGUE_END;
+ PrologEndLoc = DebugLoc();
+ }
+- if (PrologEndLoc.isUnknown())
+- Flags |= DWARF2_FLAG_IS_STMT;
+-
+ if (!DL.isUnknown()) {
+ const MDNode *Scope = DL.getScope(Asm->MF->getFunction()->getContext());
+ recordSourceLine(DL.getLine(), DL.getCol(), Scope, Flags);
+@@ -1382,7 +1379,7 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) {
+ MF->getFunction()->getContext());
+ recordSourceLine(FnStartDL.getLine(), FnStartDL.getCol(),
+ FnStartDL.getScope(MF->getFunction()->getContext()),
+- 0);
++ DWARF2_FLAG_IS_STMT);
+ }
+ }
+
+diff --git a/test/DebugInfo/X86/ending-run.ll b/test/DebugInfo/X86/ending-run.ll
+index 6935c47..0cd3de1 100644
+--- a/test/DebugInfo/X86/ending-run.ll
++++ b/test/DebugInfo/X86/ending-run.ll
+@@ -1,11 +1,9 @@
+ ; RUN: llc -mtriple=x86_64-apple-darwin %s -o %t -filetype=obj
+ ; RUN: llvm-dwarfdump %t | FileCheck %s
+
+-; Check that the line table starts at 7, not 4, but that the first
+-; statement isn't until line 8.
++; Check that the line table starts at 7, not 4.
+
+-; CHECK-NOT: 0x0000000000000000 7 0 1 0 is_stmt
+-; CHECK: 0x0000000000000000 7 0 1 0
++; CHECK: 0x0000000000000000 7 0 1 0 is_stmt
+ ; CHECK: 0x0000000000000004 8 18 1 0 is_stmt prologue_end
+
+ define i32 @callee(i32 %x) nounwind uwtable ssp {
+--
+1.7.10
+
diff --git a/sys-devel/llvm/files/llvm-3.1-ivybridge_support.patch b/sys-devel/llvm/files/llvm-3.1-ivybridge_support.patch
new file mode 100644
index 000000000000..a03ec422467c
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.1-ivybridge_support.patch
@@ -0,0 +1,13 @@
+--- llvm/trunk/lib/Support/Host.cpp 2012/04/23 22:22:46 155401
++++ llvm/trunk/lib/Support/Host.cpp 2012/04/23 22:41:39 155402
+@@ -230,6 +230,10 @@
+ case 45:
+ return "corei7-avx";
+
++ // Ivy Bridge:
++ case 58:
++ return "core-avx-i";
++
+ case 28: // Intel Atom processor. All processors are manufactured using
+ // the 45 nm process
+ return "atom";
diff --git a/sys-devel/llvm/files/llvm-3.2-nodoctargz.patch b/sys-devel/llvm/files/llvm-3.2-nodoctargz.patch
new file mode 100644
index 000000000000..3a622b53daa9
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.2-nodoctargz.patch
@@ -0,0 +1,45 @@
+--- docs/Makefile.orig 2012-04-30 17:00:01.000000000 +0200
++++ docs/Makefile 2012-04-30 17:15:52.000000000 +0200
+@@ -52,11 +52,10 @@
+ # 'make generated BUILD_FOR_WEBSITE=1'
+ generated:: $(generated_targets)
+
+-install-html: $(PROJ_OBJ_DIR)/html.tar.gz
++install-html:
+ $(Echo) Installing HTML documentation
+ $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html
+ $(Verb) $(DataInstall) $(HTML) $(DESTDIR)$(PROJ_docsdir)/html
+- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/html.tar.gz $(DESTDIR)$(PROJ_docsdir)
+
+ $(PROJ_OBJ_DIR)/html.tar.gz: $(HTML)
+ $(Echo) Packaging HTML documentation
+@@ -68,12 +67,11 @@
+ install-doxygen: doxygen
+ $(Echo) Installing doxygen documentation
+ $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html/doxygen
+- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/doxygen.tar.gz $(DESTDIR)$(PROJ_docsdir)
+ $(Verb) cd $(PROJ_OBJ_DIR)/doxygen && \
+ $(FIND) . -type f -exec \
+ $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/html/doxygen \;
+
+-doxygen: regendoc $(PROJ_OBJ_DIR)/doxygen.tar.gz
++doxygen: regendoc
+
+ regendoc:
+ $(Echo) Building doxygen documentation
+@@ -99,7 +97,6 @@
+ install-ocamldoc: ocamldoc
+ $(Echo) Installing ocamldoc documentation
+ $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html
+- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(DESTDIR)$(PROJ_docsdir)
+ $(Verb) cd $(PROJ_OBJ_DIR)/ocamldoc && \
+ $(FIND) . -type f -exec \
+ $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html \;
+@@ -109,7 +106,6 @@
+ $(Verb) $(RM) -rf $(PROJ_OBJ_DIR)/ocamldoc.tar*
+ $(Verb) $(TAR) cf $(PROJ_OBJ_DIR)/ocamldoc.tar ocamldoc
+ $(Verb) $(GZIPBIN) $(PROJ_OBJ_DIR)/ocamldoc.tar
+- $(Verb) $(CP) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(PROJ_OBJ_DIR)/ocamldoc/html/
+
+ regen-ocamldoc:
+ $(Echo) Building ocamldoc documentation
diff --git a/sys-devel/llvm/files/llvm-3.3-R600_debug.patch b/sys-devel/llvm/files/llvm-3.3-R600_debug.patch
new file mode 100644
index 000000000000..b104273fb43c
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.3-R600_debug.patch
@@ -0,0 +1,22 @@
+Fixes compilation of llvm-3.3 on gcc-4.6 and 4.7 when VIDEO_CARDS=radeon
+
+This issue is caused because although Q is a multiset the original code tries to get
+a set iterator which can't be converted in a multiset one.
+
+The fix is as simple as just using a multiset iterator.
+
+Patch by Francisco Blas Izquierdo Riera (klondike)
+Consider the changes in the Public Domain
+https://bugs.gentoo.org/show_bug.cgi?id=474096
+
+--- lib/Target/R600/R600MachineScheduler.cpp
++++ lib/Target/R600/R600MachineScheduler.cpp
+@@ -290,7 +290,7 @@
+ SUnit *R600SchedStrategy::PopInst(std::multiset<SUnit *, CompareSUnit> &Q) {
+ if (Q.empty())
+ return NULL;
+- for (std::set<SUnit *, CompareSUnit>::iterator It = Q.begin(), E = Q.end();
++ for (std::multiset<SUnit *, CompareSUnit>::iterator It = Q.begin(), E = Q.end();
+ It != E; ++It) {
+ SUnit *SU = *It;
+ InstructionsGroupCandidate.push_back(SU->getInstr());
diff --git a/sys-devel/llvm/files/llvm-3.3-cmake-modulepath.patch b/sys-devel/llvm/files/llvm-3.3-cmake-modulepath.patch
new file mode 100644
index 000000000000..754ae46ffb1c
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.3-cmake-modulepath.patch
@@ -0,0 +1,24 @@
+--- cmake/modules/LLVMConfig.cmake.in.old 2013-12-30 14:40:54.888983600 +0100
++++ cmake/modules/LLVMConfig.cmake.in 2013-12-30 14:44:15.448970509 +0100
+@@ -39,16 +39,10 @@
+ set(LLVM_LIBRARY_DIRS ${LLVM_INSTALL_PREFIX}/lib)
+ set(LLVM_DEFINITIONS "-D__STDC_LIMIT_MACROS" "-D__STDC_CONSTANT_MACROS")
+
+-# We try to include using the current setting of CMAKE_MODULE_PATH,
+-# which suppossedly was filled by the user with the directory where
+-# this file was installed:
+-include( LLVM-Config OPTIONAL RESULT_VARIABLE LLVMCONFIG_INCLUDED )
+-
+-# If failed, we assume that this is an un-installed build:
+-if( NOT LLVMCONFIG_INCLUDED )
+- set(CMAKE_MODULE_PATH
++# For some reasons without it it fails on Gentoo, see bug #496480
++set(CMAKE_MODULE_PATH
+ ${CMAKE_MODULE_PATH}
+- "@LLVM_SOURCE_DIR@/cmake/modules")
+- include( LLVM-Config )
+-endif()
++ "@LLVM_INSTALL_PREFIX@/share/llvm/cmake")
++
++include(LLVM-Config)
+
diff --git a/sys-devel/llvm/files/llvm-3.3-gentoo-install.patch b/sys-devel/llvm/files/llvm-3.3-gentoo-install.patch
new file mode 100644
index 000000000000..e477be505244
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.3-gentoo-install.patch
@@ -0,0 +1,141 @@
+From 378109dbae7e4772d9b096384904c638a6a34028 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <gentoo@mgorny.alt.pl>
+Date: Fri, 19 Jul 2013 10:10:52 +0200
+Subject: [PATCH 1/2] gentoo install fixes
+
+---
+ Makefile.config.in | 6 +++---
+ Makefile.rules | 7 +++----
+ tools/gold/Makefile | 2 +-
+ tools/llvm-config/BuildVariables.inc.in | 2 ++
+ tools/llvm-config/Makefile | 4 ++++
+ tools/llvm-config/llvm-config.cpp | 5 +++--
+ utils/FileCheck/Makefile | 2 +-
+ 7 files changed, 17 insertions(+), 11 deletions(-)
+
+diff --git a/Makefile.config.in b/Makefile.config.in
+index fd4f6ef..5634ecc 100644
+--- a/Makefile.config.in
++++ b/Makefile.config.in
+@@ -95,10 +95,10 @@ PROJ_internal_prefix := $(prefix)
+ endif
+
+ PROJ_bindir := $(PROJ_prefix)/bin
+-PROJ_libdir := $(PROJ_prefix)/lib
++PROJ_libdir := $(PROJ_prefix)/$(GENTOO_LIBDIR)/llvm
+ PROJ_datadir := $(PROJ_prefix)/share
+-PROJ_docsdir := $(PROJ_prefix)/docs/llvm
+-PROJ_etcdir := $(PROJ_prefix)/etc/llvm
++PROJ_docsdir := $(PROJ_prefix)/share/doc/@PF@
++PROJ_etcdir := @EPREFIX@/etc/llvm
+ PROJ_includedir := $(PROJ_prefix)/include
+ PROJ_infodir := $(PROJ_prefix)/info
+ PROJ_mandir := $(PROJ_prefix)/share/man
+diff --git a/Makefile.rules b/Makefile.rules
+index f0c542b..db252f7 100644
+--- a/Makefile.rules
++++ b/Makefile.rules
+@@ -276,7 +276,7 @@ ifeq ($(ENABLE_OPTIMIZED),1)
+ # Don't use -fomit-frame-pointer on Darwin or FreeBSD.
+ ifneq ($(HOST_OS),FreeBSD)
+ ifneq ($(HOST_OS),Darwin)
+- OmitFramePointer := -fomit-frame-pointer
++ OmitFramePointer :=
+ endif
+ endif
+
+@@ -639,7 +638,7 @@ endif
+ ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
+ ifneq ($(HOST_OS), Darwin)
+ ifdef TOOLNAME
+- LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib'
++ LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib' $(RPATH) -Wl,'$(PROJ_libdir)'
+ ifdef EXAMPLE_TOOL
+ LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(DynamicFlag)
+ else
+@@ -648,7 +647,7 @@ ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
+ endif
+ else
+ ifneq ($(DARWIN_MAJVERS),4)
+- LD.Flags += $(RPATH) -Wl,@executable_path/../lib
++ LD.Flags += $(RPATH) -Wl,@executable_path/../lib -Wl,'$(PROJ_libdir)'
+ endif
+ ifeq ($(RC_XBS),YES)
+ TempFile := $(shell mkdir -p ${OBJROOT}/dSYMs ; mktemp ${OBJROOT}/dSYMs/llvm-lto.XXXXXX)
+diff --git a/tools/gold/Makefile b/tools/gold/Makefile
+index 496e31c..d36b340 100644
+--- a/tools/gold/Makefile
++++ b/tools/gold/Makefile
+@@ -24,7 +24,7 @@ include $(LEVEL)/Makefile.config
+ # Because off_t is used in the public API, the largefile parts are required for
+ # ABI compatibility.
+ CXXFLAGS += -I$(BINUTILS_INCDIR) -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
+-LDFLAGS += -L$(SharedLibDir)/$(SharedPrefix)
++LDFLAGS += -L$(PROJ_libdir)
+
+ include $(LEVEL)/Makefile.common
+
+diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in
+index fe87afb..fd9f2c6 100644
+--- a/tools/llvm-config/BuildVariables.inc.in
++++ b/tools/llvm-config/BuildVariables.inc.in
+@@ -25,3 +25,5 @@
+ #define LLVM_BUILDMODE "@LLVM_BUILDMODE@"
+ #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
+ #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"
++#define LLVM_RPATH "@LLVM_RPATH@"
++#define LLVM_LIBDIR "@LLVM_LIBDIR@"
+diff --git a/tools/llvm-config/Makefile b/tools/llvm-config/Makefile
+index b20b6bf..fc56781 100644
+--- a/tools/llvm-config/Makefile
++++ b/tools/llvm-config/Makefile
+@@ -55,6 +55,10 @@ $(ObjDir)/BuildVariables.inc: $(BUILDVARIABLES_SRCPATH) Makefile $(ObjDir)/.dir
+ >> temp.sed
+ $(Verb) $(ECHO) 's/@LLVM_TARGETS_BUILT@/$(subst /,\/,$(TARGETS_TO_BUILD))/' \
+ >> temp.sed
++ $(Verb) $(ECHO) 's/@LLVM_RPATH@/$(subst /,\/,$(RPATH))/' \
++ >> temp.sed
++ $(Verb) $(ECHO) 's/@LLVM_LIBDIR@/$(subst /,\/,$(GENTOO_LIBDIR))/' \
++ >> temp.sed
+ $(Verb) $(SED) -f temp.sed < $< > $@
+ $(Verb) $(RM) temp.sed
+
+diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
+index 7edf5ec..4541c28 100644
+--- a/tools/llvm-config/llvm-config.cpp
++++ b/tools/llvm-config/llvm-config.cpp
+@@ -250,7 +250,7 @@ int main(int argc, char **argv) {
+ ActivePrefix = CurrentExecPrefix;
+ ActiveIncludeDir = ActivePrefix + "/include";
+ ActiveBinDir = ActivePrefix + "/bin";
+- ActiveLibDir = ActivePrefix + "/lib";
++ ActiveLibDir = ActivePrefix + "/" LLVM_LIBDIR "/llvm";
+ ActiveIncludeOption = "-I" + ActiveIncludeDir;
+ }
+
+@@ -277,7 +277,8 @@ int main(int argc, char **argv) {
+ } else if (Arg == "--cxxflags") {
+ OS << ActiveIncludeOption << ' ' << LLVM_CXXFLAGS << '\n';
+ } else if (Arg == "--ldflags") {
+- OS << "-L" << ActiveLibDir << ' ' << LLVM_LDFLAGS
++ OS << "-L" << ActiveLibDir << ' '
++ << LLVM_RPATH << " -Wl," << ActiveLibDir << ' ' << LLVM_LDFLAGS
+ << ' ' << LLVM_SYSTEM_LIBS << '\n';
+ } else if (Arg == "--libs") {
+ PrintLibs = true;
+diff --git a/utils/FileCheck/Makefile b/utils/FileCheck/Makefile
+index 268b7bc..e7674f9 100644
+--- a/utils/FileCheck/Makefile
++++ b/utils/FileCheck/Makefile
+@@ -15,7 +15,7 @@ USEDLIBS = LLVMSupport.a
+ TOOL_NO_EXPORTS = 1
+
+ # Don't install this utility
+-NO_INSTALL = 1
++#NO_INSTALL = 1
+
+ include $(LEVEL)/Makefile.common
+
+--
+1.8.3.2
+
diff --git a/sys-devel/llvm/files/llvm-3.3-insecure-rpath.patch b/sys-devel/llvm/files/llvm-3.3-insecure-rpath.patch
new file mode 100644
index 000000000000..659f23783810
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.3-insecure-rpath.patch
@@ -0,0 +1,30 @@
+From d23d21bc76693dd2a43b5d76c68972ac01a055ba Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <gentoo@mgorny.alt.pl>
+Date: Sat, 20 Jul 2013 15:56:56 +0200
+Subject: [PATCH] Remove insecure RUNPATHs.
+
+LLVM seems to build fine without them, and they were removed for 3.4
+already.
+---
+ Makefile.rules | 5 -----
+ 1 file changed, 5 deletions(-)
+
+diff --git a/Makefile.rules b/Makefile.rules
+index db252f7..a29481b 100644
+--- a/Makefile.rules
++++ b/Makefile.rules
+@@ -639,11 +639,6 @@ ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
+ ifneq ($(HOST_OS), Darwin)
+ ifdef TOOLNAME
+ LD.Flags += $(RPATH) -Wl,'$(PROJ_libdir)'
+- ifdef EXAMPLE_TOOL
+- LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(DynamicFlag)
+- else
+- LD.Flags += $(RPATH) -Wl,$(ToolDir) $(DynamicFlag)
+- endif
+ endif
+ else
+ ifneq ($(DARWIN_MAJVERS),4)
+--
+1.8.3.2
+
diff --git a/sys-devel/llvm/files/llvm-3.3-r2-gentoo-install.patch b/sys-devel/llvm/files/llvm-3.3-r2-gentoo-install.patch
new file mode 100644
index 000000000000..c5bd8b8695b0
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.3-r2-gentoo-install.patch
@@ -0,0 +1,117 @@
+From a554809b6bdbe29b1f775c89104c1088300685ef Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Sat, 28 Dec 2013 10:30:28 +0100
+Subject: [PATCH] Update for gentoo install layout.
+
+---
+ Makefile.config.in | 6 +++---
+ Makefile.rules | 8 ++++----
+ tools/llvm-config/BuildVariables.inc.in | 1 +
+ tools/llvm-config/Makefile | 2 ++
+ tools/llvm-config/llvm-config.cpp | 2 +-
+ utils/FileCheck/Makefile | 2 +-
+ 6 files changed, 12 insertions(+), 9 deletions(-)
+
+diff --git a/Makefile.config.in b/Makefile.config.in
+index fd4f6ef..b63786c 100644
+--- a/Makefile.config.in
++++ b/Makefile.config.in
+@@ -95,10 +95,10 @@ PROJ_internal_prefix := $(prefix)
+ endif
+
+ PROJ_bindir := $(PROJ_prefix)/bin
+-PROJ_libdir := $(PROJ_prefix)/lib
++PROJ_libdir := $(PROJ_prefix)/$(GENTOO_LIBDIR)
+ PROJ_datadir := $(PROJ_prefix)/share
+-PROJ_docsdir := $(PROJ_prefix)/docs/llvm
+-PROJ_etcdir := $(PROJ_prefix)/etc/llvm
++PROJ_docsdir := $(PROJ_prefix)/share/doc/@PF@
++PROJ_etcdir := @EPREFIX@/etc/llvm
+ PROJ_includedir := $(PROJ_prefix)/include
+ PROJ_infodir := $(PROJ_prefix)/info
+ PROJ_mandir := $(PROJ_prefix)/share/man
+diff --git a/Makefile.rules b/Makefile.rules
+index f0c542b..6cc19fd 100644
+--- a/Makefile.rules
++++ b/Makefile.rules
+@@ -276,7 +276,7 @@ ifeq ($(ENABLE_OPTIMIZED),1)
+ # Don't use -fomit-frame-pointer on Darwin or FreeBSD.
+ ifneq ($(HOST_OS),FreeBSD)
+ ifneq ($(HOST_OS),Darwin)
+- OmitFramePointer := -fomit-frame-pointer
++ OmitFramePointer :=
+ endif
+ endif
+
+@@ -601,7 +601,7 @@ endif
+ ifdef SHARED_LIBRARY
+ ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
+ ifneq ($(HOST_OS),Darwin)
+- LD.Flags += $(RPATH) -Wl,'$$ORIGIN'
++ LD.Flags +=
+ endif
+ endif
+ endif
+@@ -641,9 +641,9 @@ ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
+ ifdef TOOLNAME
+ LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib'
+ ifdef EXAMPLE_TOOL
+- LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(DynamicFlag)
++ LD.Flags += $(DynamicFlag)
+ else
+- LD.Flags += $(RPATH) -Wl,$(ToolDir) $(DynamicFlag)
++ LD.Flags += $(DynamicFlag)
+ endif
+ endif
+ else
+diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in
+index fe87afb..908acd4 100644
+--- a/tools/llvm-config/BuildVariables.inc.in
++++ b/tools/llvm-config/BuildVariables.inc.in
+@@ -25,3 +25,4 @@
+ #define LLVM_BUILDMODE "@LLVM_BUILDMODE@"
+ #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
+ #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"
++#define LLVM_LIBDIR "@LLVM_LIBDIR@"
+diff --git a/tools/llvm-config/Makefile b/tools/llvm-config/Makefile
+index b20b6bf..0aeba45 100644
+--- a/tools/llvm-config/Makefile
++++ b/tools/llvm-config/Makefile
+@@ -55,6 +55,8 @@ $(ObjDir)/BuildVariables.inc: $(BUILDVARIABLES_SRCPATH) Makefile $(ObjDir)/.dir
+ >> temp.sed
+ $(Verb) $(ECHO) 's/@LLVM_TARGETS_BUILT@/$(subst /,\/,$(TARGETS_TO_BUILD))/' \
+ >> temp.sed
++ $(Verb) $(ECHO) 's/@LLVM_LIBDIR@/$(subst /,\/,$(GENTOO_LIBDIR))/' \
++ >> temp.sed
+ $(Verb) $(SED) -f temp.sed < $< > $@
+ $(Verb) $(RM) temp.sed
+
+diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
+index 7edf5ec..c09b702 100644
+--- a/tools/llvm-config/llvm-config.cpp
++++ b/tools/llvm-config/llvm-config.cpp
+@@ -250,7 +250,7 @@ int main(int argc, char **argv) {
+ ActivePrefix = CurrentExecPrefix;
+ ActiveIncludeDir = ActivePrefix + "/include";
+ ActiveBinDir = ActivePrefix + "/bin";
+- ActiveLibDir = ActivePrefix + "/lib";
++ ActiveLibDir = ActivePrefix + "/" LLVM_LIBDIR;
+ ActiveIncludeOption = "-I" + ActiveIncludeDir;
+ }
+
+diff --git a/utils/FileCheck/Makefile b/utils/FileCheck/Makefile
+index 268b7bc..e7674f9 100644
+--- a/utils/FileCheck/Makefile
++++ b/utils/FileCheck/Makefile
+@@ -15,7 +15,7 @@ USEDLIBS = LLVMSupport.a
+ TOOL_NO_EXPORTS = 1
+
+ # Don't install this utility
+-NO_INSTALL = 1
++#NO_INSTALL = 1
+
+ include $(LEVEL)/Makefile.common
+
+--
+1.8.5.2
+
diff --git a/sys-devel/llvm/files/llvm-3.4-cmake-configparser.patch b/sys-devel/llvm/files/llvm-3.4-cmake-configparser.patch
new file mode 100644
index 000000000000..cda8bdc4e1ab
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.4-cmake-configparser.patch
@@ -0,0 +1,35 @@
+From 773560acfad511769017e971991c0305dbc0323d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Wed, 11 Jun 2014 09:40:26 +0200
+Subject: [PATCH] Avoid using external configparser in favor of built-in
+ ConfigParser.
+
+We only support Python 2 anyway, and configparser-3.2 is known to break
+the build. Since some packages actually force version 3.2, and we do not
+to pull in extra dependencies, forcing built-in seems to be the best
+option.
+
+Fixes: https://bugs.gentoo.org/show_bug.cgi?id=500856
+---
+ utils/llvm-build/llvmbuild/componentinfo.py | 5 +----
+ 1 file changed, 1 insertion(+), 4 deletions(-)
+
+diff --git a/utils/llvm-build/llvmbuild/componentinfo.py b/utils/llvm-build/llvmbuild/componentinfo.py
+index eda3a48..c963ef1 100644
+--- a/utils/llvm-build/llvmbuild/componentinfo.py
++++ b/utils/llvm-build/llvmbuild/componentinfo.py
+@@ -3,10 +3,7 @@ Descriptor objects for entities that are part of the LLVM project.
+ """
+
+ from __future__ import absolute_import
+-try:
+- import configparser
+-except:
+- import ConfigParser as configparser
++import ConfigParser as configparser
+ import sys
+
+ from llvmbuild.util import *
+--
+2.0.0
+
diff --git a/sys-devel/llvm/files/llvm-3.4-fix_varargs.patch b/sys-devel/llvm/files/llvm-3.4-fix_varargs.patch
new file mode 100644
index 000000000000..377c4da79d2f
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.4-fix_varargs.patch
@@ -0,0 +1,148 @@
+https://bugs.gentoo.org/show_bug.cgi?id=497298
+http://llvm.org/bugs/show_bug.cgi?id=18346
+
+SVN revisions:
+http://llvm.org/viewvc/llvm-project?view=revision&revision=197503
+http://llvm.org/viewvc/llvm-project?view=revision&revision=197505
+http://llvm.org/viewvc/llvm-project?view=revision&revision=197520
+
+diff -Naur llvm-3.4.orig/lib/Target/X86/X86ISelLowering.cpp llvm-3.4/lib/Target/X86/X86ISelLowering.cpp
+--- llvm-3.4.orig/lib/Target/X86/X86ISelLowering.cpp 2014-01-08 11:22:23.373060109 +0100
++++ llvm-3.4/lib/Target/X86/X86ISelLowering.cpp 2014-01-08 11:23:58.517125907 +0100
+@@ -15226,9 +15226,15 @@
+ MBB->addSuccessor(EndMBB);
+ }
+
++ // Make sure the last operand is EFLAGS, which gets clobbered by the branch
++ // that was just emitted, but clearly shouldn't be "saved".
++ assert((MI->getNumOperands() <= 3 ||
++ !MI->getOperand(MI->getNumOperands() - 1).isReg() ||
++ MI->getOperand(MI->getNumOperands() - 1).getReg() == X86::EFLAGS)
++ && "Expected last argument to be EFLAGS");
+ unsigned MOVOpc = Subtarget->hasFp256() ? X86::VMOVAPSmr : X86::MOVAPSmr;
+ // In the XMM save block, save all the XMM argument registers.
+- for (int i = 3, e = MI->getNumOperands(); i != e; ++i) {
++ for (int i = 3, e = MI->getNumOperands() - 1; i != e; ++i) {
+ int64_t Offset = (i - 3) * 16 + VarArgsFPOffset;
+ MachineMemOperand *MMO =
+ F->getMachineMemOperand(
+diff -Naur llvm-3.4.orig/lib/Target/X86/X86InstrCompiler.td llvm-3.4/lib/Target/X86/X86InstrCompiler.td
+--- llvm-3.4.orig/lib/Target/X86/X86InstrCompiler.td 2014-01-08 11:22:23.374060109 +0100
++++ llvm-3.4/lib/Target/X86/X86InstrCompiler.td 2014-01-08 11:23:39.654112857 +0100
+@@ -72,7 +72,7 @@
+
+
+ // x86-64 va_start lowering magic.
+-let usesCustomInserter = 1 in {
++let usesCustomInserter = 1, Defs = [EFLAGS] in {
+ def VASTART_SAVE_XMM_REGS : I<0, Pseudo,
+ (outs),
+ (ins GR8:$al,
+@@ -81,7 +81,8 @@
+ "#VASTART_SAVE_XMM_REGS $al, $regsavefi, $offset",
+ [(X86vastart_save_xmm_regs GR8:$al,
+ imm:$regsavefi,
+- imm:$offset)]>;
++ imm:$offset),
++ (implicit EFLAGS)]>;
+
+ // The VAARG_64 pseudo-instruction takes the address of the va_list,
+ // and places the address of the next argument into a register.
+diff -Naur llvm-3.4.orig/test/CodeGen/X86/vaargs.ll llvm-3.4/test/CodeGen/X86/vaargs.ll
+--- llvm-3.4.orig/test/CodeGen/X86/vaargs.ll 1970-01-01 01:00:00.000000000 +0100
++++ llvm-3.4/test/CodeGen/X86/vaargs.ll 2014-01-08 11:23:53.451122402 +0100
+@@ -0,0 +1,67 @@
++; RUN: llc -mcpu=corei7-avx %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=NO-FLAGS
++target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
++target triple = "x86_64-apple-macosx10.9.0"
++
++%struct.__va_list_tag = type { i32, i32, i8*, i8* }
++
++; Check that vastart gets the right thing.
++define i32 @sum(i32 %count, ...) nounwind optsize ssp uwtable {
++; CHECK: testb %al, %al
++; CHECK-NEXT: je
++; CHECK-NEXT: ## BB#{{[0-9]+}}:
++; CHECK-NEXT: vmovaps %xmm0, 48(%rsp)
++; CHECK-NEXT: vmovaps %xmm1, 64(%rsp)
++; CHECK-NEXT: vmovaps %xmm2, 80(%rsp)
++; CHECK-NEXT: vmovaps %xmm3, 96(%rsp)
++; CHECK-NEXT: vmovaps %xmm4, 112(%rsp)
++; CHECK-NEXT: vmovaps %xmm5, 128(%rsp)
++; CHECK-NEXT: vmovaps %xmm6, 144(%rsp)
++; CHECK-NEXT: vmovaps %xmm7, 160(%rsp)
++
++; Check that [EFLAGS] hasn't been pulled in.
++; NO-FLAGS-NOT: %flags
++
++ %ap = alloca [1 x %struct.__va_list_tag], align 16
++ %1 = bitcast [1 x %struct.__va_list_tag]* %ap to i8*
++ call void @llvm.va_start(i8* %1)
++ %2 = icmp sgt i32 %count, 0
++ br i1 %2, label %.lr.ph, label %._crit_edge
++
++.lr.ph: ; preds = %0
++ %3 = getelementptr inbounds [1 x %struct.__va_list_tag]* %ap, i64 0, i64 0, i32 0
++ %4 = getelementptr inbounds [1 x %struct.__va_list_tag]* %ap, i64 0, i64 0, i32 2
++ %.pre = load i32* %3, align 16
++ br label %5
++
++; <label>:5 ; preds = %.lr.ph, %13
++ %6 = phi i32 [ %.pre, %.lr.ph ], [ %14, %13 ]
++ %.01 = phi i32 [ %count, %.lr.ph ], [ %15, %13 ]
++ %7 = icmp ult i32 %6, 41
++ br i1 %7, label %8, label %10
++
++; <label>:8 ; preds = %5
++ %9 = add i32 %6, 8
++ store i32 %9, i32* %3, align 16
++ br label %13
++
++; <label>:10 ; preds = %5
++ %11 = load i8** %4, align 8
++ %12 = getelementptr i8* %11, i64 8
++ store i8* %12, i8** %4, align 8
++ br label %13
++
++; <label>:13 ; preds = %10, %8
++ %14 = phi i32 [ %6, %10 ], [ %9, %8 ]
++ %15 = add nsw i32 %.01, 1
++ %16 = icmp sgt i32 %15, 0
++ br i1 %16, label %5, label %._crit_edge
++
++._crit_edge: ; preds = %13, %0
++ %.0.lcssa = phi i32 [ %count, %0 ], [ %15, %13 ]
++ call void @llvm.va_end(i8* %1)
++ ret i32 %.0.lcssa
++}
++
++declare void @llvm.va_start(i8*) nounwind
++
++declare void @llvm.va_end(i8*) nounwind
+diff -Naur llvm-3.4.orig/test/CodeGen/X86/vastart-defs-eflags.ll llvm-3.4/test/CodeGen/X86/vastart-defs-eflags.ll
+--- llvm-3.4.orig/test/CodeGen/X86/vastart-defs-eflags.ll 1970-01-01 01:00:00.000000000 +0100
++++ llvm-3.4/test/CodeGen/X86/vastart-defs-eflags.ll 2014-01-08 11:23:39.654112857 +0100
+@@ -0,0 +1,23 @@
++; RUN: llc %s -o - | FileCheck %s
++
++target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
++target triple = "x86_64-apple-macosx10.10.0"
++
++; Check that vastart handling doesn't get between testb and je for the branch.
++define i32 @check_flag(i32 %flags, ...) nounwind {
++entry:
++; CHECK: {{^}} testb $2, %bh
++; CHECK-NOT: test
++; CHECK: {{^}} je
++ %and = and i32 %flags, 512
++ %tobool = icmp eq i32 %and, 0
++ br i1 %tobool, label %if.end, label %if.then
++
++if.then: ; preds = %entry
++ br label %if.end
++
++if.end: ; preds = %entry, %if.then
++ %hasflag = phi i32 [ 1, %if.then ], [ 0, %entry ]
++ ret i32 %hasflag
++}
++
diff --git a/sys-devel/llvm/files/llvm-3.4-gentoo-install.patch b/sys-devel/llvm/files/llvm-3.4-gentoo-install.patch
new file mode 100644
index 000000000000..a2ba7dee47ed
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.4-gentoo-install.patch
@@ -0,0 +1,96 @@
+From b8846d389ff5e2b768a114f752cf39788accba26 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Mon, 19 Aug 2013 13:22:46 +0200
+Subject: [PATCH] gentoo install fixes
+
+---
+ Makefile.config.in | 6 +++---
+ Makefile.rules | 6 +++---
+ tools/llvm-config/BuildVariables.inc.in | 2 ++
+ tools/llvm-config/Makefile | 4 ++++
+ tools/llvm-config/llvm-config.cpp | 5 +++--
+ utils/FileCheck/Makefile | 2 +-
+ 7 files changed, 17 insertions(+), 10 deletions(-)
+
+diff --git a/Makefile.config.in b/Makefile.config.in
+index dcca45f..e75ae2e 100644
+--- a/Makefile.config.in
++++ b/Makefile.config.in
+@@ -95,10 +95,10 @@ PROJ_internal_prefix := $(prefix)
+ endif
+
+ PROJ_bindir := $(PROJ_prefix)/bin
+-PROJ_libdir := $(PROJ_prefix)/lib
++PROJ_libdir := $(PROJ_prefix)/$(GENTOO_LIBDIR)
+ PROJ_datadir := $(PROJ_prefix)/share
+-PROJ_docsdir := $(PROJ_prefix)/docs/llvm
+-PROJ_etcdir := $(PROJ_prefix)/etc/llvm
++PROJ_docsdir := $(PROJ_prefix)/share/doc/@PF@
++PROJ_etcdir := @EPREFIX@/etc/llvm
+ PROJ_includedir := $(PROJ_prefix)/include
+ PROJ_infodir := $(PROJ_prefix)/info
+ PROJ_mandir := $(PROJ_prefix)/share/man
+diff --git a/Makefile.rules b/Makefile.rules
+index e53598b..217f754 100644
+--- a/Makefile.rules
++++ b/Makefile.rules
+@@ -275,7 +275,7 @@ ifeq ($(ENABLE_OPTIMIZED),1)
+ BuildMode := Release
+ # Don't use -fomit-frame-pointer on Darwin or FreeBSD.
+ ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin Darwin DragonFly FreeBSD GNU/kFreeBSD))
+- OmitFramePointer := -fomit-frame-pointer
++ OmitFramePointer :=
+ endif
+
+ CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
+diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in
+index fe87afb..fd9f2c6 100644
+--- a/tools/llvm-config/BuildVariables.inc.in
++++ b/tools/llvm-config/BuildVariables.inc.in
+@@ -25,3 +25,4 @@
+ #define LLVM_BUILDMODE "@LLVM_BUILDMODE@"
+ #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
+ #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"
++#define LLVM_LIBDIR "@LLVM_LIBDIR@"
+diff --git a/tools/llvm-config/Makefile b/tools/llvm-config/Makefile
+index b20b6bf..fc56781 100644
+--- a/tools/llvm-config/Makefile
++++ b/tools/llvm-config/Makefile
+@@ -55,6 +55,8 @@ $(ObjDir)/BuildVariables.inc: $(BUILDVARIABLES_SRCPATH) Makefile $(ObjDir)/.dir
+ >> temp.sed
+ $(Verb) $(ECHO) 's/@LLVM_TARGETS_BUILT@/$(subst /,\/,$(TARGETS_TO_BUILD))/' \
+ >> temp.sed
++ $(Verb) $(ECHO) 's/@LLVM_LIBDIR@/$(subst /,\/,$(GENTOO_LIBDIR))/' \
++ >> temp.sed
+ $(Verb) $(SED) -f temp.sed < $< > $@
+ $(Verb) $(RM) temp.sed
+
+diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
+index 3924e2e..f439c60 100644
+--- a/tools/llvm-config/llvm-config.cpp
++++ b/tools/llvm-config/llvm-config.cpp
+@@ -250,7 +250,7 @@ int main(int argc, char **argv) {
+ ActivePrefix = CurrentExecPrefix;
+ ActiveIncludeDir = ActivePrefix + "/include";
+ ActiveBinDir = ActivePrefix + "/bin";
+- ActiveLibDir = ActivePrefix + "/lib";
++ ActiveLibDir = ActivePrefix + "/" LLVM_LIBDIR;
+ ActiveIncludeOption = "-I" + ActiveIncludeDir;
+ }
+
+diff --git a/utils/FileCheck/Makefile b/utils/FileCheck/Makefile
+index 268b7bc..e7674f9 100644
+--- a/utils/FileCheck/Makefile
++++ b/utils/FileCheck/Makefile
+@@ -15,7 +15,7 @@ USEDLIBS = LLVMSupport.a
+ TOOL_NO_EXPORTS = 1
+
+ # Don't install this utility
+-NO_INSTALL = 1
++#NO_INSTALL = 1
+
+ include $(LEVEL)/Makefile.common
+
+--
+1.8.4.2
+
diff --git a/sys-devel/llvm/files/llvm-3.5-gcc-4.9.patch b/sys-devel/llvm/files/llvm-3.5-gcc-4.9.patch
new file mode 100644
index 000000000000..7da657f457d9
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.5-gcc-4.9.patch
@@ -0,0 +1,43 @@
+commit 080fb498017d17af2e4d7563608c7d8a848f20da
+Author: Sanjoy Das <sanjoy at azulsystems.com>
+Date: Thu Jun 19 15:38:02 2014 -0700
+
+ Fix the --enable-shared build.
+
+ Currently a build configured with ./configure --enable-shared breaks
+ with an undefined "llvm::cl::parser<llvm::PassInfo
+ const*>::getOption(unsigned int) const" symbol when linking opt. This
+ body for this symbol gets emitted into Pass.o (along with the destructor
+ for PassNameParser), but gets linked into libLLVM-3.5svn.so with local
+ visibility, causing the link error.
+
+ This fix uses the existing EXTERN_TEMPLATE machinery to force a globally
+ visible definition for the functions in parser<const PassInfo *> into
+ Pass.o.
+
+diff --git a/include/llvm/IR/LegacyPassNameParser.h b/include/llvm/IR/LegacyPassNameParser.h
+index e2e4912..a07e3fd 100644
+--- a/include/llvm/IR/LegacyPassNameParser.h
++++ b/include/llvm/IR/LegacyPassNameParser.h
+@@ -95,6 +95,8 @@ private:
+ }
+ };
+
++EXTERN_TEMPLATE_INSTANTIATION(class cl::parser<const PassInfo *>);
++
+ ///===----------------------------------------------------------------------===//
+ /// FilteredPassNameParser class - Make use of the pass registration
+ /// mechanism to automatically add a command line argument to opt for
+diff --git a/lib/IR/Pass.cpp b/lib/IR/Pass.cpp
+index 91d86ae..00ce223 100644
+--- a/lib/IR/Pass.cpp
++++ b/lib/IR/Pass.cpp
+@@ -234,6 +234,8 @@ PassNameParser::~PassNameParser() {
+ // attempting to remove the registration listener is an error.
+ }
+
++TEMPLATE_INSTANTIATION(class cl::parser<const PassInfo *>);
++
+ //===----------------------------------------------------------------------===//
+ // AnalysisUsage Class Implementation
+ //
diff --git a/sys-devel/llvm/files/llvm-3.5-gentoo-install.patch b/sys-devel/llvm/files/llvm-3.5-gentoo-install.patch
new file mode 100644
index 000000000000..7a8c9f7dfc1c
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.5-gentoo-install.patch
@@ -0,0 +1,83 @@
+From b8846d389ff5e2b768a114f752cf39788accba26 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Mon, 19 Aug 2013 13:22:46 +0200
+Subject: [PATCH] gentoo install fixes
+
+---
+ Makefile.config.in | 6 +++---
+ Makefile.rules | 6 +++---
+ tools/llvm-config/BuildVariables.inc.in | 2 ++
+ tools/llvm-config/Makefile | 4 ++++
+ tools/llvm-config/llvm-config.cpp | 5 +++--
+ utils/FileCheck/Makefile | 2 +-
+ 7 files changed, 17 insertions(+), 10 deletions(-)
+
+diff --git a/Makefile.config.in b/Makefile.config.in
+index dcca45f..e75ae2e 100644
+--- a/Makefile.config.in
++++ b/Makefile.config.in
+@@ -95,10 +95,10 @@ PROJ_internal_prefix := $(prefix)
+ endif
+
+ PROJ_bindir := $(PROJ_prefix)/bin
+-PROJ_libdir := $(PROJ_prefix)/lib
++PROJ_libdir := $(PROJ_prefix)/$(GENTOO_LIBDIR)
+ PROJ_datadir := $(PROJ_prefix)/share
+-PROJ_docsdir := $(PROJ_prefix)/docs/llvm
+-PROJ_etcdir := $(PROJ_prefix)/etc/llvm
++PROJ_docsdir := $(PROJ_prefix)/share/doc/@PF@
++PROJ_etcdir := @EPREFIX@/etc/llvm
+ PROJ_includedir := $(PROJ_prefix)/include
+ PROJ_infodir := $(PROJ_prefix)/info
+ PROJ_mandir := $(PROJ_prefix)/share/man
+diff --git a/Makefile.rules b/Makefile.rules
+index e53598b..217f754 100644
+--- a/Makefile.rules
++++ b/Makefile.rules
+@@ -275,7 +275,7 @@ ifeq ($(ENABLE_OPTIMIZED),1)
+ BuildMode := Release
+ # Don't use -fomit-frame-pointer on Darwin or FreeBSD.
+ ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin Darwin DragonFly FreeBSD GNU/kFreeBSD))
+- OmitFramePointer := -fomit-frame-pointer
++ OmitFramePointer :=
+ endif
+
+ CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
+diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in
+index fe87afb..fd9f2c6 100644
+--- a/tools/llvm-config/BuildVariables.inc.in
++++ b/tools/llvm-config/BuildVariables.inc.in
+@@ -25,3 +25,4 @@
+ #define LLVM_BUILDMODE "@LLVM_BUILDMODE@"
+ #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
+ #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"
++#define LLVM_LIBDIR "@LLVM_LIBDIR@"
+diff --git a/tools/llvm-config/Makefile b/tools/llvm-config/Makefile
+index b20b6bf..fc56781 100644
+--- a/tools/llvm-config/Makefile
++++ b/tools/llvm-config/Makefile
+@@ -55,6 +55,8 @@ $(ObjDir)/BuildVariables.inc: $(BUILDVARIABLES_SRCPATH) Makefile $(ObjDir)/.dir
+ >> temp.sed
+ $(Verb) $(ECHO) 's/@LLVM_TARGETS_BUILT@/$(subst /,\/,$(TARGETS_TO_BUILD))/' \
+ >> temp.sed
++ $(Verb) $(ECHO) 's/@LLVM_LIBDIR@/$(subst /,\/,$(GENTOO_LIBDIR))/' \
++ >> temp.sed
+ $(Verb) $(SED) -f temp.sed < $< > $@
+ $(Verb) $(RM) temp.sed
+
+diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
+index 3924e2e..f439c60 100644
+--- a/tools/llvm-config/llvm-config.cpp
++++ b/tools/llvm-config/llvm-config.cpp
+@@ -250,7 +250,7 @@ int main(int argc, char **argv) {
+ ActivePrefix = CurrentExecPrefix;
+ ActiveIncludeDir = ActivePrefix + "/include";
+ ActiveBinDir = ActivePrefix + "/bin";
+- ActiveLibDir = ActivePrefix + "/lib";
++ ActiveLibDir = ActivePrefix + "/" LLVM_LIBDIR;
+ ActiveIncludeOption = "-I" + ActiveIncludeDir;
+ }
+
+--
+1.8.4.2
+
diff --git a/sys-devel/llvm/files/llvm-3.5.0-fix_LLVMExports_cmake.patch b/sys-devel/llvm/files/llvm-3.5.0-fix_LLVMExports_cmake.patch
new file mode 100644
index 000000000000..9fbd7b73f169
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.5.0-fix_LLVMExports_cmake.patch
@@ -0,0 +1,39 @@
+Index: cmake/modules/Makefile
+===================================================================
+--- cmake/modules/Makefile (revision 217451)
++++ cmake/modules/Makefile (working copy)
+@@ -33,6 +33,16 @@
+ LLVM_ENABLE_RTTI := 0
+ endif
+
++LLVM_LIBS_TO_EXPORT := $(subst -l,,$(shell $(LLVM_CONFIG) --libs $(LINK_COMPONENTS) || echo Error))
++
++ifeq ($(LLVM_LIBS_TO_EXPORT),Error)
++$(error llvm-config --libs failed)
++endif
++
++ifndef LLVM_LIBS_TO_EXPORT
++$(error LLVM_LIBS_TO_EXPORT cannot be empty)
++endif
++
+ OBJMODS := LLVMConfig.cmake LLVMConfigVersion.cmake LLVMExports.cmake
+
+ $(PROJ_OBJ_DIR)/LLVMConfig.cmake: LLVMConfig.cmake.in $(LLVMBuildCMakeFrag)
+@@ -45,7 +55,7 @@
+ -e 's/@LLVM_VERSION_PATCH@/'"$(LLVM_VERSION_PATCH)"'/' \
+ -e 's/@PACKAGE_VERSION@/'"$(LLVMVersion)"'/' \
+ -e 's/@LLVM_COMMON_DEPENDS@//' \
+- -e 's/@LLVM_AVAILABLE_LIBS@/'"$(subst -l,,$(LLVMConfigLibs))"'/' \
++ -e 's/@LLVM_AVAILABLE_LIBS@/'"$(LLVM_LIBS_TO_EXPORT)"'/' \
+ -e 's/@LLVM_ALL_TARGETS@/'"$(ALL_TARGETS)"'/' \
+ -e 's/@LLVM_TARGETS_TO_BUILD@/'"$(TARGETS_TO_BUILD)"'/' \
+ -e 's/@LLVM_TARGETS_WITH_JIT@/'"$(TARGETS_WITH_JIT)"'/' \
+@@ -83,7 +93,7 @@
+ $(Echo) 'Generating LLVM CMake target exports file'
+ $(Verb) ( \
+ echo '# LLVM CMake target exports. Do not include directly.' && \
+- for lib in $(subst -l,,$(LLVMConfigLibs)); do \
++ for lib in $(LLVM_LIBS_TO_EXPORT); do \
+ echo 'add_library('"$$lib"' STATIC IMPORTED)' && \
+ echo 'set_property(TARGET '"$$lib"' PROPERTY IMPORTED_LOCATION "'"$(PROJ_libdir)/lib$$lib.a"'")' ; \
+ done && \
diff --git a/sys-devel/llvm/files/llvm-3.5.2-gcc-5.1.patch b/sys-devel/llvm/files/llvm-3.5.2-gcc-5.1.patch
new file mode 100644
index 000000000000..7cb2817561c1
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.5.2-gcc-5.1.patch
@@ -0,0 +1,14 @@
+Index: include/llvm/ADT/IntrusiveRefCntPtr.h
+===================================================================
+--- include/llvm/ADT/IntrusiveRefCntPtr.h (revision 218294)
++++ include/llvm/ADT/IntrusiveRefCntPtr.h (revision 218295)
+@@ -197,6 +197,9 @@
+ private:
+ void retain() { if (Obj) IntrusiveRefCntPtrInfo<T>::retain(Obj); }
+ void release() { if (Obj) IntrusiveRefCntPtrInfo<T>::release(Obj); }
++
++ template <typename X>
++ friend class IntrusiveRefCntPtr;
+ };
+
+ template<class T, class U>
diff --git a/sys-devel/llvm/files/llvm-3.6-gentoo-install.patch b/sys-devel/llvm/files/llvm-3.6-gentoo-install.patch
new file mode 100644
index 000000000000..c4d0db2c0743
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.6-gentoo-install.patch
@@ -0,0 +1,82 @@
+From bb016afeba4d9e886e776565a508634a261111a2 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Wed, 31 Dec 2014 11:26:12 +0100
+Subject: [PATCH] gentoo build fixes
+
+---
+ Makefile.config.in | 6 +++---
+ Makefile.rules | 2 +-
+ tools/llvm-config/BuildVariables.inc.in | 1 +
+ tools/llvm-config/Makefile | 2 ++
+ tools/llvm-config/llvm-config.cpp | 2 +-
+ 5 files changed, 8 insertions(+), 5 deletions(-)
+
+diff --git a/Makefile.config.in b/Makefile.config.in
+index d34a2d5..a26cd08 100644
+--- a/Makefile.config.in
++++ b/Makefile.config.in
+@@ -99,10 +99,10 @@ PROJ_internal_prefix := $(prefix)
+ endif
+
+ PROJ_bindir := $(PROJ_prefix)/bin
+-PROJ_libdir := $(PROJ_prefix)/lib
++PROJ_libdir := $(PROJ_prefix)/$(GENTOO_LIBDIR)
+ PROJ_datadir := $(PROJ_prefix)/share
+-PROJ_docsdir := $(PROJ_prefix)/docs/llvm
+-PROJ_etcdir := $(PROJ_prefix)/etc/llvm
++PROJ_docsdir := $(PROJ_prefix)/share/doc/@PF@
++PROJ_etcdir := @EPREFIX@/etc/llvm
+ PROJ_includedir := $(PROJ_prefix)/include
+ PROJ_infodir := $(PROJ_prefix)/info
+ PROJ_mandir := $(PROJ_prefix)/share/man
+diff --git a/Makefile.rules b/Makefile.rules
+index c8c971f..d1258b1 100644
+--- a/Makefile.rules
++++ b/Makefile.rules
+@@ -283,7 +283,7 @@ ifeq ($(ENABLE_OPTIMIZED),1)
+ BuildMode := Release
+ # Don't use -fomit-frame-pointer on Darwin or FreeBSD.
+ ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin Darwin DragonFly FreeBSD GNU/kFreeBSD))
+- OmitFramePointer := -fomit-frame-pointer
++ OmitFramePointer :=
+ endif
+
+ CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
+diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in
+index 3f51f49..513ea89 100644
+--- a/tools/llvm-config/BuildVariables.inc.in
++++ b/tools/llvm-config/BuildVariables.inc.in
+@@ -26,3 +26,4 @@
+ #define LLVM_LIBDIR_SUFFIX "@LLVM_LIBDIR_SUFFIX@"
+ #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
+ #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"
++#define LLVM_LIBDIR "@LLVM_LIBDIR@"
+diff --git a/tools/llvm-config/Makefile b/tools/llvm-config/Makefile
+index 1ff8b6f..5d73c6e 100644
+--- a/tools/llvm-config/Makefile
++++ b/tools/llvm-config/Makefile
+@@ -65,6 +65,8 @@ $(ObjDir)/BuildVariables.inc: $(BUILDVARIABLES_SRCPATH) Makefile $(ObjDir)/.dir
+ >> temp.sed
+ $(Verb) $(ECHO) 's/@LLVM_TARGETS_BUILT@/$(subst /,\/,$(TARGETS_TO_BUILD))/' \
+ >> temp.sed
++ $(Verb) $(ECHO) 's/@LLVM_LIBDIR@/$(subst /,\/,$(GENTOO_LIBDIR))/' \
++ >> temp.sed
+ $(Verb) $(SED) -f temp.sed < $< > $@
+ $(Verb) $(RM) temp.sed
+
+diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
+index 224035a..57180ac 100644
+--- a/tools/llvm-config/llvm-config.cpp
++++ b/tools/llvm-config/llvm-config.cpp
+@@ -265,7 +265,7 @@ int main(int argc, char **argv) {
+ ActivePrefix = CurrentExecPrefix;
+ ActiveIncludeDir = ActivePrefix + "/include";
+ ActiveBinDir = ActivePrefix + "/bin";
+- ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
++ ActiveLibDir = ActivePrefix + "/" LLVM_LIBDIR;
+ ActiveIncludeOption = "-I" + ActiveIncludeDir;
+ }
+
+--
+2.2.1
+
diff --git a/sys-devel/llvm/files/llvm-3.6.0-ocaml-ctypes-0.4.0.patch b/sys-devel/llvm/files/llvm-3.6.0-ocaml-ctypes-0.4.0.patch
new file mode 100644
index 000000000000..154c9cc25f77
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.6.0-ocaml-ctypes-0.4.0.patch
@@ -0,0 +1,35 @@
+diff -Naur llvm-3.6.0.src.orig/bindings/ocaml/executionengine/llvm_executionengine.ml llvm-3.6.0.src/bindings/ocaml/executionengine/llvm_executionengine.ml
+--- llvm-3.6.0.src.orig/bindings/ocaml/executionengine/llvm_executionengine.ml 2015-03-17 11:49:27.274824345 +0100
++++ llvm-3.6.0.src/bindings/ocaml/executionengine/llvm_executionengine.ml 2015-03-17 11:49:40.333829421 +0100
+@@ -43,11 +43,11 @@
+ = "llvm_ee_run_static_dtors"
+ external data_layout : llexecutionengine -> Llvm_target.DataLayout.t
+ = "llvm_ee_get_data_layout"
+-external add_global_mapping_ : Llvm.llvalue -> int64 -> llexecutionengine -> unit
++external add_global_mapping_ : Llvm.llvalue -> nativeint -> llexecutionengine -> unit
+ = "llvm_ee_add_global_mapping"
+-external get_global_value_address_ : string -> llexecutionengine -> int64
++external get_global_value_address_ : string -> llexecutionengine -> nativeint
+ = "llvm_ee_get_global_value_address"
+-external get_function_address_ : string -> llexecutionengine -> int64
++external get_function_address_ : string -> llexecutionengine -> nativeint
+ = "llvm_ee_get_function_address"
+
+ let add_global_mapping llval ptr ee =
+@@ -55,14 +55,14 @@
+
+ let get_global_value_address name typ ee =
+ let vptr = get_global_value_address_ name ee in
+- if Int64.to_int vptr <> 0 then
++ if Nativeint.to_int vptr <> 0 then
+ let open Ctypes in !@ (coerce (ptr void) (ptr typ) (ptr_of_raw_address vptr))
+ else
+ raise (Error ("Value " ^ name ^ " not found"))
+
+ let get_function_address name typ ee =
+ let fptr = get_function_address_ name ee in
+- if Int64.to_int fptr <> 0 then
++ if Nativeint.to_int fptr <> 0 then
+ let open Ctypes in coerce (ptr void) typ (ptr_of_raw_address fptr)
+ else
+ raise (Error ("Function " ^ name ^ " not found"))
diff --git a/sys-devel/llvm/files/llvm-3.7-nodoctargz.patch b/sys-devel/llvm/files/llvm-3.7-nodoctargz.patch
new file mode 100644
index 000000000000..86905234779f
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.7-nodoctargz.patch
@@ -0,0 +1,49 @@
+--- docs/Makefile.orig 2012-04-30 17:00:01.000000000 +0200
++++ docs/Makefile 2012-04-30 17:15:52.000000000 +0200
+@@ -52,11 +52,10 @@
+ # 'make generated BUILD_FOR_WEBSITE=1'
+ generated:: $(generated_targets)
+
+-install-html: $(PROJ_OBJ_DIR)/html.tar.gz
++install-html:
+ $(Echo) Installing HTML documentation
+ $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html
+ $(Verb) $(DataInstall) $(HTML) $(DESTDIR)$(PROJ_docsdir)/html
+- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/html.tar.gz $(DESTDIR)$(PROJ_docsdir)
+
+ $(PROJ_OBJ_DIR)/html.tar.gz: $(HTML)
+ $(Echo) Packaging HTML documentation
+@@ -68,12 +67,11 @@
+
+ install-doxygen: doxygen
+ $(Echo) Installing doxygen documentation
+- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/doxygen.tar.gz $(DESTDIR)$(PROJ_docsdir)
+ $(Verb) cd $(PROJ_OBJ_DIR)/doxygen/html && \
+ for DIR in $$($(FIND) . -type d); do \
+ DESTSUB="$(DESTDIR)$(PROJ_docsdir)/html/doxygen/$$(echo $$DIR | cut -c 3-)"; \
+ $(MKDIR) $$DESTSUB && \
+ $(FIND) $$DIR -maxdepth 1 -type f -exec $(DataInstall) {} $$DESTSUB \; ; \
+ if [ $$? != 0 ]; then exit 1; fi \
+ done
+
+-doxygen: regendoc $(PROJ_OBJ_DIR)/doxygen.tar.gz
++doxygen: regendoc
+
+ regendoc:
+ $(Echo) Building doxygen documentation
+@@ -99,7 +97,6 @@
+ install-ocamldoc: ocamldoc
+ $(Echo) Installing ocamldoc documentation
+ $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html
+- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(DESTDIR)$(PROJ_docsdir)
+ $(Verb) cd $(PROJ_OBJ_DIR)/ocamldoc && \
+ $(FIND) . -type f -exec \
+ $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html \;
+@@ -109,7 +106,6 @@
+ $(Verb) $(RM) -rf $(PROJ_OBJ_DIR)/ocamldoc.tar*
+ $(Verb) $(TAR) cf $(PROJ_OBJ_DIR)/ocamldoc.tar ocamldoc
+ $(Verb) $(GZIPBIN) $(PROJ_OBJ_DIR)/ocamldoc.tar
+- $(Verb) $(CP) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(PROJ_OBJ_DIR)/ocamldoc/html/
+
+ regen-ocamldoc:
+ $(Echo) Building ocamldoc documentation
diff --git a/sys-devel/llvm/llvm-2.8-r2.ebuild b/sys-devel/llvm/llvm-2.8-r2.ebuild
new file mode 100644
index 000000000000..ed5e5427de51
--- /dev/null
+++ b/sys-devel/llvm/llvm-2.8-r2.ebuild
@@ -0,0 +1,168 @@
+# 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="Low Level Virtual Machine"
+HOMEPAGE="http://llvm.org/"
+# Upstream silently re-released the tarball...
+# drop the -> in 2.9
+SRC_URI="http://llvm.org/releases/${PV}/${P}.tgz -> ${P}-r1.tgz"
+
+LICENSE="UoI-NCSA"
+SLOT="0"
+KEYWORDS="amd64 ppc x86 ~amd64-linux ~x86-linux ~ppc-macos"
+IUSE="debug +libffi multitarget ocaml test udis86"
+
+DEPEND="dev-lang/perl
+ >=sys-devel/make-3.79
+ >=sys-devel/flex-2.5.4
+ >=sys-devel/bison-1.875d
+ || ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1 )
+ || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-3.2.3 )
+ libffi? ( virtual/libffi )
+ ocaml? ( dev-lang/ocaml )
+ udis86? ( dev-libs/udis86[pic(+)] )"
+RDEPEND="dev-lang/perl"
+
+S=${WORKDIR}/${PN}-${PV/_pre*}
+
+pkg_setup() {
+ # need to check if the active compiler is ok
+
+ broken_gcc=" 3.2.2 3.2.3 3.3.2 4.1.1 "
+ broken_gcc_x86=" 3.4.0 3.4.2 "
+ broken_gcc_amd64=" 3.4.6 "
+
+ gcc_vers=$(gcc-fullversion)
+
+ if [[ ${broken_gcc} == *" ${version} "* ]] ; then
+ elog "Your version of gcc is known to miscompile llvm."
+ elog "Check http://www.llvm.org/docs/GettingStarted.html for"
+ elog "possible solutions."
+ die "Your currently active version of gcc is known to miscompile llvm"
+ fi
+
+ if [[ ${CHOST} == i*86-* && ${broken_gcc_x86} == *" ${version} "* ]] ; then
+ elog "Your version of gcc is known to miscompile llvm on x86"
+ elog "architectures. Check"
+ elog "http://www.llvm.org/docs/GettingStarted.html for possible"
+ elog "solutions."
+ die "Your currently active version of gcc is known to miscompile llvm"
+ fi
+
+ if [[ ${CHOST} == x86_64-* && ${broken_gcc_amd64} == *" ${version} "* ]];
+ then
+ elog "Your version of gcc is known to miscompile llvm in amd64"
+ elog "architectures. Check"
+ elog "http://www.llvm.org/docs/GettingStarted.html for possible"
+ elog "solutions."
+ die "Your currently active version of gcc is known to miscompile llvm"
+ fi
+}
+
+src_prepare() {
+ # unfortunately ./configure won't listen to --mandir and the-like, so take
+ # care of this.
+ einfo "Fixing install dirs"
+ sed -e 's,^PROJ_docsdir.*,PROJ_docsdir := $(PROJ_prefix)/share/doc/'${PF}, \
+ -e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \
+ -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/${PN}, \
+ -i Makefile.config.in || die "Makefile.config sed failed"
+ sed -e 's,$ABS_RUN_DIR/lib,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \
+ -i tools/llvm-config/llvm-config.in.in || die "llvm-config sed failed"
+
+ einfo "Fixing rpath and CFLAGS"
+ sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \
+ -e '/OmitFramePointer/s/-fomit-frame-pointer//' \
+ -i Makefile.rules || die "rpath sed failed"
+
+ epatch "${FILESDIR}"/${PN}-2.7-nodoctargz.patch
+ epatch "${FILESDIR}"/${PN}-2.6-commandguide-nops.patch
+ epatch "${FILESDIR}"/${PN}-2.8-darwin8.patch
+ # Upstream backport, r117774
+ epatch "${FILESDIR}"/${P}-alignof.patch
+
+ # Additional unistd.h include for GCC 4.7
+ epatch "${FILESDIR}"/${PN}-2.9-gcc4.7.patch
+
+ # User patches
+ epatch_user
+}
+
+src_configure() {
+ local CONF_FLAGS="--enable-shared"
+
+ if use debug; then
+ CONF_FLAGS="${CONF_FLAGS} --disable-optimized"
+ einfo "Note: Compiling LLVM in debug mode will create huge and slow binaries"
+ # ...and you probably shouldn't use tmpfs, unless it can hold 900MB
+ else
+ CONF_FLAGS="${CONF_FLAGS} \
+ --enable-optimized \
+ --with-optimize-option= \
+ --disable-assertions \
+ --disable-expensive-checks"
+ fi
+
+ if use multitarget; then
+ CONF_FLAGS="${CONF_FLAGS} --enable-targets=all"
+ else
+ CONF_FLAGS="${CONF_FLAGS} --enable-targets=host-only"
+ fi
+
+ if use amd64; then
+ CONF_FLAGS="${CONF_FLAGS} --enable-pic"
+ fi
+
+ CONF_FLAGS="${CONF_FLAGS} \
+ --with-llvmgccdir=/dev/null \
+ --with-llvmgcc=nope \
+ --with-llvmgxx=nope"
+
+ if use ocaml; then
+ CONF_FLAGS="${CONF_FLAGS} --enable-bindings=ocaml"
+ else
+ CONF_FLAGS="${CONF_FLAGS} --enable-bindings=none"
+ fi
+
+ if use udis86; then
+ CONF_FLAGS="${CONF_FLAGS} --with-udis86"
+ fi
+ CONF_FLAGS="${CONF_FLAGS} $(use_enable libffi)"
+ econf ${CONF_FLAGS} || die "econf failed"
+}
+
+src_compile() {
+ emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1 || die "emake failed"
+}
+
+src_install() {
+ emake KEEP_SYMBOLS=1 DESTDIR="${D}" install || die "install failed"
+
+ # Fix install_names on Darwin. The build system is too complicated
+ # to just fix this, so we correct it post-install
+ local lib= f= odylib=
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ for lib in lib{EnhancedDisassembly,LLVM-${PV},BugpointPasses,LLVMHello,LTO,profile_rt}.dylib ; do
+ # libEnhancedDisassembly is Darwin10 only, so non-fatal
+ [[ -f ${ED}/usr/lib/${PN}/${lib} ]] || continue
+ ebegin "fixing install_name of $lib"
+ install_name_tool \
+ -id "${EPREFIX}"/usr/lib/${PN}/${lib} \
+ "${ED}"/usr/lib/${PN}/${lib}
+ eend $?
+ done
+ for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}/libLTO.dylib ; do
+ odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${PV}.dylib)
+ ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
+ install_name_tool \
+ -change "${odylib}" \
+ "${EPREFIX}"/usr/lib/${PN}/libLLVM-${PV}.dylib \
+ "${f}"
+ eend $?
+ done
+ fi
+}
diff --git a/sys-devel/llvm/llvm-2.9-r2.ebuild b/sys-devel/llvm/llvm-2.9-r2.ebuild
new file mode 100644
index 000000000000..515e38739f5d
--- /dev/null
+++ b/sys-devel/llvm/llvm-2.9-r2.ebuild
@@ -0,0 +1,175 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+inherit eutils flag-o-matic multilib toolchain-funcs pax-utils
+
+DESCRIPTION="Low Level Virtual Machine"
+HOMEPAGE="http://llvm.org/"
+SRC_URI="http://llvm.org/releases/${PV}/${P}.tgz"
+
+LICENSE="UoI-NCSA"
+SLOT="0"
+KEYWORDS="amd64 ~ppc x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos"
+IUSE="debug +libffi multitarget ocaml test udis86 vim-syntax"
+
+DEPEND="dev-lang/perl
+ >=sys-devel/make-3.79
+ >=sys-devel/flex-2.5.4
+ >=sys-devel/bison-1.875d
+ || ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1 )
+ || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-3.2.3 )
+ libffi? ( virtual/pkgconfig
+ virtual/libffi )
+ ocaml? ( dev-lang/ocaml )
+ udis86? ( dev-libs/udis86[pic(+)] )"
+RDEPEND="dev-lang/perl
+ libffi? ( virtual/libffi )
+ vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )"
+
+S=${WORKDIR}/${PN}-${PV/_pre*}
+
+pkg_setup() {
+ # need to check if the active compiler is ok
+
+ broken_gcc=" 3.2.2 3.2.3 3.3.2 4.1.1 "
+ broken_gcc_x86=" 3.4.0 3.4.2 "
+ broken_gcc_amd64=" 3.4.6 "
+
+ gcc_vers=$(gcc-fullversion)
+
+ if [[ ${broken_gcc} == *" ${version} "* ]] ; then
+ elog "Your version of gcc is known to miscompile llvm."
+ elog "Check http://www.llvm.org/docs/GettingStarted.html for"
+ elog "possible solutions."
+ die "Your currently active version of gcc is known to miscompile llvm"
+ fi
+
+ if [[ ${CHOST} == i*86-* && ${broken_gcc_x86} == *" ${version} "* ]] ; then
+ elog "Your version of gcc is known to miscompile llvm on x86"
+ elog "architectures. Check"
+ elog "http://www.llvm.org/docs/GettingStarted.html for possible"
+ elog "solutions."
+ die "Your currently active version of gcc is known to miscompile llvm"
+ fi
+
+ if [[ ${CHOST} == x86_64-* && ${broken_gcc_amd64} == *" ${version} "* ]];
+ then
+ elog "Your version of gcc is known to miscompile llvm in amd64"
+ elog "architectures. Check"
+ elog "http://www.llvm.org/docs/GettingStarted.html for possible"
+ elog "solutions."
+ die "Your currently active version of gcc is known to miscompile llvm"
+ fi
+}
+
+src_prepare() {
+ # unfortunately ./configure won't listen to --mandir and the-like, so take
+ # care of this.
+ einfo "Fixing install dirs"
+ sed -e 's,^PROJ_docsdir.*,PROJ_docsdir := $(PROJ_prefix)/share/doc/'${PF}, \
+ -e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \
+ -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/${PN}, \
+ -i Makefile.config.in || die "Makefile.config sed failed"
+ sed -e 's,$ABS_RUN_DIR/lib,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \
+ -i tools/llvm-config/llvm-config.in.in || die "llvm-config sed failed"
+
+ einfo "Fixing rpath and CFLAGS"
+ sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \
+ -e '/OmitFramePointer/s/-fomit-frame-pointer//' \
+ -i Makefile.rules || die "rpath sed failed"
+
+ epatch "${FILESDIR}"/${PN}-2.6-commandguide-nops.patch
+ epatch "${FILESDIR}"/${PN}-2.9-nodoctargz.patch
+
+ # Upstream commit r131062
+ epatch "${FILESDIR}"/${P}-Operator.h-c++0x.patch
+
+ # Additional unistd.h include for GCC 4.7
+ epatch "${FILESDIR}"/${P}-gcc4.7.patch
+
+ # User patches
+ epatch_user
+}
+
+src_configure() {
+ local CONF_FLAGS="--enable-shared
+ --with-optimize-option=
+ $(use_enable !debug optimized)
+ $(use_enable debug assertions)
+ $(use_enable debug expensive-checks)"
+
+ if use multitarget; then
+ CONF_FLAGS="${CONF_FLAGS} --enable-targets=all"
+ else
+ CONF_FLAGS="${CONF_FLAGS} --enable-targets=host-only"
+ fi
+
+ if use amd64; then
+ CONF_FLAGS="${CONF_FLAGS} --enable-pic"
+ fi
+
+ CONF_FLAGS="${CONF_FLAGS} \
+ --with-llvmgccdir=/dev/null \
+ --with-llvmgcc=nope \
+ --with-llvmgxx=nope"
+
+ if use ocaml; then
+ CONF_FLAGS="${CONF_FLAGS} --enable-bindings=ocaml"
+ else
+ CONF_FLAGS="${CONF_FLAGS} --enable-bindings=none"
+ fi
+
+ if use udis86; then
+ CONF_FLAGS="${CONF_FLAGS} --with-udis86"
+ fi
+
+ if use libffi; then
+ append-cppflags "$(pkg-config --cflags libffi)"
+ fi
+ CONF_FLAGS="${CONF_FLAGS} $(use_enable libffi)"
+ econf ${CONF_FLAGS} || die "econf failed"
+}
+
+src_compile() {
+ emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1 || die "emake failed"
+
+ pax-mark m Release/bin/lli
+ if use test; then
+ pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests
+ fi
+}
+
+src_install() {
+ emake KEEP_SYMBOLS=1 DESTDIR="${D}" install || die "install failed"
+
+ if use vim-syntax; then
+ insinto /usr/share/vim/vimfiles/syntax
+ doins utils/vim/*.vim
+ fi
+
+ # Fix install_names on Darwin. The build system is too complicated
+ # to just fix this, so we correct it post-install
+ local lib= f= odylib=
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ for lib in lib{EnhancedDisassembly,LLVM-${PV},LTO}.dylib {BugpointPasses,LLVMHello,profile_rt}.dylib ; do
+ # libEnhancedDisassembly is Darwin10 only, so non-fatal
+ [[ -f ${ED}/usr/lib/${PN}/${lib} ]] || continue
+ ebegin "fixing install_name of $lib"
+ install_name_tool \
+ -id "${EPREFIX}"/usr/lib/${PN}/${lib} \
+ "${ED}"/usr/lib/${PN}/${lib}
+ eend $?
+ done
+ for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}/libLTO.dylib ; do
+ odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${PV}.dylib)
+ ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
+ install_name_tool \
+ -change "${odylib}" \
+ "${EPREFIX}"/usr/lib/${PN}/libLLVM-${PV}.dylib \
+ "${f}"
+ eend $?
+ done
+ fi
+}
diff --git a/sys-devel/llvm/llvm-3.0-r2.ebuild b/sys-devel/llvm/llvm-3.0-r2.ebuild
new file mode 100644
index 000000000000..a0caca12b07d
--- /dev/null
+++ b/sys-devel/llvm/llvm-3.0-r2.ebuild
@@ -0,0 +1,181 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+PYTHON_DEPEND="2"
+inherit eutils flag-o-matic multilib toolchain-funcs python pax-utils
+
+DESCRIPTION="Low Level Virtual Machine"
+HOMEPAGE="http://llvm.org/"
+SRC_URI="http://llvm.org/releases/${PV}/${P}.tar.gz"
+
+LICENSE="UoI-NCSA"
+SLOT="0"
+KEYWORDS="amd64 ~ppc x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos"
+IUSE="debug gold +libffi multitarget ocaml test udis86 vim-syntax"
+
+DEPEND="dev-lang/perl
+ >=sys-devel/make-3.79
+ >=sys-devel/flex-2.5.4
+ >=sys-devel/bison-1.875d
+ || ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1 )
+ || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-3.2.3 )
+ gold? ( >=sys-devel/binutils-2.22[cxx] )
+ libffi? ( virtual/pkgconfig
+ virtual/libffi )
+ ocaml? ( dev-lang/ocaml )
+ udis86? ( dev-libs/udis86[pic(+)] )"
+RDEPEND="dev-lang/perl
+ libffi? ( virtual/libffi )
+ vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )"
+
+S=${WORKDIR}/${P}.src
+
+pkg_setup() {
+ # Required for test and build
+ python_set_active_version 2
+ python_pkg_setup
+
+ # need to check if the active compiler is ok
+
+ broken_gcc=" 3.2.2 3.2.3 3.3.2 4.1.1 "
+ broken_gcc_x86=" 3.4.0 3.4.2 "
+ broken_gcc_amd64=" 3.4.6 "
+
+ gcc_vers=$(gcc-fullversion)
+
+ if [[ ${broken_gcc} == *" ${version} "* ]] ; then
+ elog "Your version of gcc is known to miscompile llvm."
+ elog "Check http://www.llvm.org/docs/GettingStarted.html for"
+ elog "possible solutions."
+ die "Your currently active version of gcc is known to miscompile llvm"
+ fi
+
+ if [[ ${CHOST} == i*86-* && ${broken_gcc_x86} == *" ${version} "* ]] ; then
+ elog "Your version of gcc is known to miscompile llvm on x86"
+ elog "architectures. Check"
+ elog "http://www.llvm.org/docs/GettingStarted.html for possible"
+ elog "solutions."
+ die "Your currently active version of gcc is known to miscompile llvm"
+ fi
+
+ if [[ ${CHOST} == x86_64-* && ${broken_gcc_amd64} == *" ${version} "* ]];
+ then
+ elog "Your version of gcc is known to miscompile llvm in amd64"
+ elog "architectures. Check"
+ elog "http://www.llvm.org/docs/GettingStarted.html for possible"
+ elog "solutions."
+ die "Your currently active version of gcc is known to miscompile llvm"
+ fi
+}
+
+src_prepare() {
+ # unfortunately ./configure won't listen to --mandir and the-like, so take
+ # care of this.
+ einfo "Fixing install dirs"
+ sed -e 's,^PROJ_docsdir.*,PROJ_docsdir := $(PROJ_prefix)/share/doc/'${PF}, \
+ -e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \
+ -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/${PN}, \
+ -i Makefile.config.in || die "Makefile.config sed failed"
+ sed -e 's,$ABS_RUN_DIR/lib,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \
+ -i tools/llvm-config/llvm-config.in.in || die "llvm-config sed failed"
+
+ einfo "Fixing rpath and CFLAGS"
+ sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \
+ -e '/OmitFramePointer/s/-fomit-frame-pointer//' \
+ -i Makefile.rules || die "rpath sed failed"
+
+ # Specify python version
+ python_convert_shebangs -r 2 test/Scripts
+
+ epatch "${FILESDIR}"/${PN}-2.6-commandguide-nops.patch
+ epatch "${FILESDIR}"/${PN}-2.9-nodoctargz.patch
+ epatch "${FILESDIR}"/${P}-ocaml_install.patch
+ epatch "${FILESDIR}"/${P}-PPC_macro.patch
+ epatch "${FILESDIR}"/${P}-PPCCompilationCallbackC_static.patch
+ epatch "${FILESDIR}"/${P}-gold_LTO_link.patch
+ epatch "${FILESDIR}"/${P}-set_soname.patch
+
+ # User patches
+ epatch_user
+}
+
+src_configure() {
+ local CONF_FLAGS="--enable-shared
+ --with-optimize-option=
+ $(use_enable !debug optimized)
+ $(use_enable debug assertions)
+ $(use_enable debug expensive-checks)"
+
+ if use multitarget; then
+ CONF_FLAGS="${CONF_FLAGS} --enable-targets=all"
+ else
+ CONF_FLAGS="${CONF_FLAGS} --enable-targets=host-only"
+ fi
+
+ if use amd64; then
+ CONF_FLAGS="${CONF_FLAGS} --enable-pic"
+ fi
+
+ if use gold; then
+ CONF_FLAGS="${CONF_FLAGS} --with-binutils-include=${EPREFIX}/usr/include/"
+ fi
+ if use ocaml; then
+ CONF_FLAGS="${CONF_FLAGS} --enable-bindings=ocaml"
+ else
+ CONF_FLAGS="${CONF_FLAGS} --enable-bindings=none"
+ fi
+
+ if use udis86; then
+ CONF_FLAGS="${CONF_FLAGS} --with-udis86"
+ fi
+
+ if use libffi; then
+ append-cppflags "$(pkg-config --cflags libffi)"
+ fi
+ CONF_FLAGS="${CONF_FLAGS} $(use_enable libffi)"
+ econf ${CONF_FLAGS} || die "econf failed"
+}
+
+src_compile() {
+ emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1 || die "emake failed"
+
+ pax-mark m Release/bin/lli
+ if use test; then
+ pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests
+ fi
+}
+
+src_install() {
+ emake KEEP_SYMBOLS=1 DESTDIR="${D}" install || die "install failed"
+
+ if use vim-syntax; then
+ insinto /usr/share/vim/vimfiles/syntax
+ doins utils/vim/*.vim
+ fi
+
+ # Fix install_names on Darwin. The build system is too complicated
+ # to just fix this, so we correct it post-install
+ local lib= f= odylib=
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ for lib in lib{EnhancedDisassembly,LLVM-${PV},LTO,profile_rt}.dylib {BugpointPasses,LLVMHello}.dylib ; do
+ # libEnhancedDisassembly is Darwin10 only, so non-fatal
+ [[ -f ${ED}/usr/lib/${PN}/${lib} ]] || continue
+ ebegin "fixing install_name of $lib"
+ install_name_tool \
+ -id "${EPREFIX}"/usr/lib/${PN}/${lib} \
+ "${ED}"/usr/lib/${PN}/${lib}
+ eend $?
+ done
+ for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}/libLTO.dylib ; do
+ odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${PV}.dylib)
+ ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
+ install_name_tool \
+ -change "${odylib}" \
+ "${EPREFIX}"/usr/lib/${PN}/libLLVM-${PV}.dylib \
+ "${f}"
+ eend $?
+ done
+ fi
+}
diff --git a/sys-devel/llvm/llvm-3.1-r2.ebuild b/sys-devel/llvm/llvm-3.1-r2.ebuild
new file mode 100644
index 000000000000..fd9ce132d8ea
--- /dev/null
+++ b/sys-devel/llvm/llvm-3.1-r2.ebuild
@@ -0,0 +1,191 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+PYTHON_DEPEND="2"
+inherit eutils flag-o-matic multilib toolchain-funcs python pax-utils
+
+DESCRIPTION="Low Level Virtual Machine"
+HOMEPAGE="http://llvm.org/"
+SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.gz"
+
+LICENSE="UoI-NCSA"
+SLOT="0"
+KEYWORDS="amd64 arm ppc x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
+IUSE="debug gold +libffi multitarget ocaml test udis86 vim-syntax"
+
+DEPEND="dev-lang/perl
+ >=sys-devel/make-3.79
+ >=sys-devel/flex-2.5.4
+ >=sys-devel/bison-1.875d
+ || ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1 )
+ || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-3.2.3 )
+ gold? ( >=sys-devel/binutils-2.22[cxx] )
+ libffi? ( virtual/pkgconfig
+ virtual/libffi )
+ ocaml? ( dev-lang/ocaml )
+ udis86? ( dev-libs/udis86[pic(+)] )"
+RDEPEND="dev-lang/perl
+ libffi? ( virtual/libffi )
+ vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )"
+
+S=${WORKDIR}/${P}.src
+
+pkg_setup() {
+ # Required for test and build
+ python_set_active_version 2
+ python_pkg_setup
+
+ # need to check if the active compiler is ok
+
+ broken_gcc=" 3.2.2 3.2.3 3.3.2 4.1.1 "
+ broken_gcc_x86=" 3.4.0 3.4.2 "
+ broken_gcc_amd64=" 3.4.6 "
+
+ gcc_vers=$(gcc-fullversion)
+
+ if [[ ${broken_gcc} == *" ${version} "* ]] ; then
+ elog "Your version of gcc is known to miscompile llvm."
+ elog "Check http://www.llvm.org/docs/GettingStarted.html for"
+ elog "possible solutions."
+ die "Your currently active version of gcc is known to miscompile llvm"
+ fi
+
+ if [[ ${CHOST} == i*86-* && ${broken_gcc_x86} == *" ${version} "* ]] ; then
+ elog "Your version of gcc is known to miscompile llvm on x86"
+ elog "architectures. Check"
+ elog "http://www.llvm.org/docs/GettingStarted.html for possible"
+ elog "solutions."
+ die "Your currently active version of gcc is known to miscompile llvm"
+ fi
+
+ if [[ ${CHOST} == x86_64-* && ${broken_gcc_amd64} == *" ${version} "* ]];
+ then
+ elog "Your version of gcc is known to miscompile llvm in amd64"
+ elog "architectures. Check"
+ elog "http://www.llvm.org/docs/GettingStarted.html for possible"
+ elog "solutions."
+ die "Your currently active version of gcc is known to miscompile llvm"
+ fi
+}
+
+src_prepare() {
+ # unfortunately ./configure won't listen to --mandir and the-like, so take
+ # care of this.
+ einfo "Fixing install dirs"
+ sed -e 's,^PROJ_docsdir.*,PROJ_docsdir := $(PROJ_prefix)/share/doc/'${PF}, \
+ -e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \
+ -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/${PN}, \
+ -i Makefile.config.in || die "Makefile.config sed failed"
+ sed -e "/ActiveLibDir = ActivePrefix/s/lib/$(get_libdir)\/${PN}/" \
+ -i tools/llvm-config/llvm-config.cpp || die "llvm-config sed failed"
+
+ einfo "Fixing rpath and CFLAGS"
+ sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \
+ -e '/OmitFramePointer/s/-fomit-frame-pointer//' \
+ -i Makefile.rules || die "rpath sed failed"
+ if use gold; then
+ sed -e 's,\$(SharedLibDir),'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \
+ -i tools/gold/Makefile || die "gold rpath sed failed"
+ fi
+
+ # Specify python version
+ python_convert_shebangs -r 2 test/Scripts
+
+ epatch "${FILESDIR}"/${PN}-2.6-commandguide-nops.patch
+ epatch "${FILESDIR}"/${PN}-2.9-nodoctargz.patch
+ epatch "${FILESDIR}"/${PN}-3.0-PPC_macro.patch
+ epatch "${FILESDIR}"/${P}-ivybridge_support.patch
+ epatch "${FILESDIR}"/${P}-fix_debug_line_info.patch
+ epatch "${FILESDIR}"/${P}-ExecutionEngine_tests_xfail_arm.patch
+ epatch "${FILESDIR}"/${P}-docs-pod-markup-fixes.patch
+
+ # Apply r600 OpenCL-related patches, bug #425688
+ epatch "${FILESDIR}"/cl-patches/*.patch
+
+ # User patches
+ epatch_user
+}
+
+src_configure() {
+ local CONF_FLAGS="--enable-shared
+ --with-optimize-option=
+ $(use_enable !debug optimized)
+ $(use_enable debug assertions)
+ $(use_enable debug expensive-checks)"
+
+ if use multitarget; then
+ CONF_FLAGS="${CONF_FLAGS} --enable-targets=all"
+ else
+ CONF_FLAGS="${CONF_FLAGS} --enable-targets=host,cpp"
+ fi
+
+ if use amd64; then
+ CONF_FLAGS="${CONF_FLAGS} --enable-pic"
+ fi
+
+ if use gold; then
+ CONF_FLAGS="${CONF_FLAGS} --with-binutils-include=${EPREFIX}/usr/include/"
+ fi
+ if use ocaml; then
+ CONF_FLAGS="${CONF_FLAGS} --enable-bindings=ocaml"
+ else
+ CONF_FLAGS="${CONF_FLAGS} --enable-bindings=none"
+ fi
+
+ if use udis86; then
+ CONF_FLAGS="${CONF_FLAGS} --with-udis86"
+ fi
+
+ if use libffi; then
+ append-cppflags "$(pkg-config --cflags libffi)"
+ fi
+ CONF_FLAGS="${CONF_FLAGS} $(use_enable libffi)"
+
+ # llvm prefers clang over gcc, so we may need to force that
+ tc-export CC CXX
+ econf ${CONF_FLAGS}
+}
+
+src_compile() {
+ emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1
+
+ pax-mark m Release/bin/lli
+ if use test; then
+ pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests
+ fi
+}
+
+src_install() {
+ emake KEEP_SYMBOLS=1 DESTDIR="${D}" install
+
+ if use vim-syntax; then
+ insinto /usr/share/vim/vimfiles/syntax
+ doins utils/vim/*.vim
+ fi
+
+ # Fix install_names on Darwin. The build system is too complicated
+ # to just fix this, so we correct it post-install
+ local lib= f= odylib=
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ for lib in lib{EnhancedDisassembly,LLVM-${PV},LTO,profile_rt}.dylib {BugpointPasses,LLVMHello}.dylib ; do
+ # libEnhancedDisassembly is Darwin10 only, so non-fatal
+ [[ -f ${ED}/usr/lib/${PN}/${lib} ]] || continue
+ ebegin "fixing install_name of $lib"
+ install_name_tool \
+ -id "${EPREFIX}"/usr/lib/${PN}/${lib} \
+ "${ED}"/usr/lib/${PN}/${lib}
+ eend $?
+ done
+ for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}/libLTO.dylib ; do
+ odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${PV}.dylib)
+ ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
+ install_name_tool \
+ -change "${odylib}" \
+ "${EPREFIX}"/usr/lib/${PN}/libLLVM-${PV}.dylib \
+ "${f}"
+ eend $?
+ done
+ fi
+}
diff --git a/sys-devel/llvm/llvm-3.2.ebuild b/sys-devel/llvm/llvm-3.2.ebuild
new file mode 100644
index 000000000000..ffd5153077b3
--- /dev/null
+++ b/sys-devel/llvm/llvm-3.2.ebuild
@@ -0,0 +1,206 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+# pypy gives me around 1700 unresolved tests due to open file limit
+# being exceeded. probably GC does not close them fast enough.
+PYTHON_COMPAT=( python2_7 )
+
+inherit eutils flag-o-matic multilib python-any-r1 toolchain-funcs pax-utils
+
+DESCRIPTION="Low Level Virtual Machine"
+HOMEPAGE="http://llvm.org/"
+SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.gz
+ !doc? ( http://dev.gentoo.org/~voyageur/distfiles/${P}-manpages.tar.bz2 )"
+
+LICENSE="UoI-NCSA"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~arm ~ppc ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos"
+IUSE="debug doc gold +libffi multitarget ocaml test udis86 vim-syntax"
+
+DEPEND="dev-lang/perl
+ >=sys-devel/make-3.79
+ >=sys-devel/flex-2.5.4
+ >=sys-devel/bison-1.875d
+ || ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1 )
+ || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-3.2.3 )
+ doc? ( dev-python/sphinx )
+ gold? ( >=sys-devel/binutils-2.22[cxx] )
+ libffi? ( virtual/pkgconfig
+ virtual/libffi )
+ ocaml? ( dev-lang/ocaml )
+ udis86? ( dev-libs/udis86[pic(+)] )
+ ${PYTHON_DEPS}"
+RDEPEND="dev-lang/perl
+ libffi? ( virtual/libffi )
+ vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )"
+
+S=${WORKDIR}/${P}.src
+
+pkg_setup() {
+ # Required for test and build
+ python-any-r1_pkg_setup
+
+ # need to check if the active compiler is ok
+
+ broken_gcc=" 3.2.2 3.2.3 3.3.2 4.1.1 "
+ broken_gcc_x86=" 3.4.0 3.4.2 "
+ broken_gcc_amd64=" 3.4.6 "
+
+ gcc_vers=$(gcc-fullversion)
+
+ if [[ ${broken_gcc} == *" ${version} "* ]] ; then
+ elog "Your version of gcc is known to miscompile llvm."
+ elog "Check http://www.llvm.org/docs/GettingStarted.html for"
+ elog "possible solutions."
+ die "Your currently active version of gcc is known to miscompile llvm"
+ fi
+
+ if [[ ${CHOST} == i*86-* && ${broken_gcc_x86} == *" ${version} "* ]] ; then
+ elog "Your version of gcc is known to miscompile llvm on x86"
+ elog "architectures. Check"
+ elog "http://www.llvm.org/docs/GettingStarted.html for possible"
+ elog "solutions."
+ die "Your currently active version of gcc is known to miscompile llvm"
+ fi
+
+ if [[ ${CHOST} == x86_64-* && ${broken_gcc_amd64} == *" ${version} "* ]];
+ then
+ elog "Your version of gcc is known to miscompile llvm in amd64"
+ elog "architectures. Check"
+ elog "http://www.llvm.org/docs/GettingStarted.html for possible"
+ elog "solutions."
+ die "Your currently active version of gcc is known to miscompile llvm"
+ fi
+}
+
+src_prepare() {
+ # unfortunately ./configure won't listen to --mandir and the-like, so take
+ # care of this.
+ einfo "Fixing install dirs"
+ sed -e 's,^PROJ_docsdir.*,PROJ_docsdir := $(PROJ_prefix)/share/doc/'${PF}, \
+ -e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \
+ -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/${PN}, \
+ -i Makefile.config.in || die "Makefile.config sed failed"
+ sed -e "/ActiveLibDir = ActivePrefix/s/lib/$(get_libdir)\/${PN}/" \
+ -i tools/llvm-config/llvm-config.cpp || die "llvm-config sed failed"
+
+ einfo "Fixing rpath and CFLAGS"
+ sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \
+ -e '/OmitFramePointer/s/-fomit-frame-pointer//' \
+ -i Makefile.rules || die "rpath sed failed"
+ if use gold; then
+ sed -e 's,\$(SharedLibDir),'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \
+ -i tools/gold/Makefile || die "gold rpath sed failed"
+ fi
+
+ # FileCheck is needed at least for dragonegg tests
+ sed -e "/NO_INSTALL = 1/s/^/#/" -i utils/FileCheck/Makefile \
+ || die "FileCheck Makefile sed failed"
+
+ epatch "${FILESDIR}"/${PN}-3.2-nodoctargz.patch
+ epatch "${FILESDIR}"/${PN}-3.0-PPC_macro.patch
+
+ # User patches
+ epatch_user
+}
+
+src_configure() {
+ local CONF_FLAGS="--enable-shared
+ --with-optimize-option=
+ $(use_enable !debug optimized)
+ $(use_enable debug assertions)
+ $(use_enable debug expensive-checks)"
+
+ if use multitarget; then
+ CONF_FLAGS="${CONF_FLAGS} --enable-targets=all"
+ else
+ CONF_FLAGS="${CONF_FLAGS} --enable-targets=host,cpp"
+ fi
+
+ if use amd64; then
+ CONF_FLAGS="${CONF_FLAGS} --enable-pic"
+ fi
+
+ if use gold; then
+ CONF_FLAGS="${CONF_FLAGS} --with-binutils-include=${EPREFIX}/usr/include/"
+ fi
+ if use ocaml; then
+ CONF_FLAGS="${CONF_FLAGS} --enable-bindings=ocaml"
+ else
+ CONF_FLAGS="${CONF_FLAGS} --enable-bindings=none"
+ fi
+
+ if use udis86; then
+ CONF_FLAGS="${CONF_FLAGS} --with-udis86"
+ fi
+
+ if use libffi; then
+ append-cppflags "$(pkg-config --cflags libffi)"
+ fi
+ CONF_FLAGS="${CONF_FLAGS} $(use_enable libffi)"
+
+ # llvm prefers clang over gcc, so we may need to force that
+ tc-export CC CXX
+ econf ${CONF_FLAGS}
+}
+
+src_compile() {
+ emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1
+
+ if use doc; then
+ emake -C docs -f Makefile.sphinx man
+ emake -C docs -f Makefile.sphinx html
+ fi
+
+ pax-mark m Release/bin/lli
+ if use test; then
+ pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests
+ pax-mark m unittests/ExecutionEngine/MCJIT/Release/MCJITTests
+ pax-mark m unittests/Support/Release/SupportTests
+ fi
+}
+
+src_install() {
+ emake KEEP_SYMBOLS=1 DESTDIR="${D}" install
+
+ if use doc; then
+ doman docs/_build/man/*.1
+ dohtml -r docs/_build/html/
+ else
+ doman "${WORKDIR}"/${P}-manpages/*.1
+ fi
+
+ if use vim-syntax; then
+ insinto /usr/share/vim/vimfiles/syntax
+ doins utils/vim/*.vim
+ fi
+
+ # Fix install_names on Darwin. The build system is too complicated
+ # to just fix this, so we correct it post-install
+ local lib= f= odylib= libpv=${PV}
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ eval $(grep PACKAGE_VERSION= configure)
+ [[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION}
+ for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt}.dylib {BugpointPasses,LLVMHello}.dylib ; do
+ # libEnhancedDisassembly is Darwin10 only, so non-fatal
+ [[ -f ${ED}/usr/lib/${PN}/${lib} ]] || continue
+ ebegin "fixing install_name of $lib"
+ install_name_tool \
+ -id "${EPREFIX}"/usr/lib/${PN}/${lib} \
+ "${ED}"/usr/lib/${PN}/${lib}
+ eend $?
+ done
+ for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}/libLTO.dylib ; do
+ odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${libpv}.dylib)
+ ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
+ install_name_tool \
+ -change "${odylib}" \
+ "${EPREFIX}"/usr/lib/${PN}/libLLVM-${libpv}.dylib \
+ "${f}"
+ eend $?
+ done
+ fi
+}
diff --git a/sys-devel/llvm/llvm-3.3-r3.ebuild b/sys-devel/llvm/llvm-3.3-r3.ebuild
new file mode 100644
index 000000000000..cdcfea39012d
--- /dev/null
+++ b/sys-devel/llvm/llvm-3.3-r3.ebuild
@@ -0,0 +1,500 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 pypy )
+
+inherit cmake-utils eutils flag-o-matic multilib multilib-minimal \
+ python-r1 toolchain-funcs pax-utils check-reqs
+
+DESCRIPTION="Low Level Virtual Machine"
+HOMEPAGE="http://llvm.org/"
+SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.gz
+ clang? ( http://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.gz
+ http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.gz )
+ !doc? ( http://dev.gentoo.org/~voyageur/distfiles/${P}-manpages.tar.bz2 )"
+
+LICENSE="UoI-NCSA"
+SLOT="0/${PV}"
+KEYWORDS="amd64 arm ppc ppc64 x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos"
+IUSE="clang debug doc gold +libffi multitarget ocaml python
+ +static-analyzer test udis86 xml video_cards_radeon
+ kernel_Darwin kernel_FreeBSD"
+
+COMMON_DEPEND="
+ sys-libs/zlib:0=
+ clang? (
+ python? ( ${PYTHON_DEPS} )
+ static-analyzer? (
+ dev-lang/perl:*
+ ${PYTHON_DEPS}
+ )
+ xml? ( dev-libs/libxml2:2= )
+ )
+ gold? ( >=sys-devel/binutils-2.22:*[cxx] )
+ libffi? ( >=virtual/libffi-3.0.13-r1:0=[${MULTILIB_USEDEP}] )
+ ocaml? ( dev-lang/ocaml:0= )
+ udis86? ( >=dev-libs/udis86-1.7-r2:0=[pic(+),${MULTILIB_USEDEP}] )"
+DEPEND="${COMMON_DEPEND}
+ dev-lang/perl
+ >=sys-devel/make-3.81
+ >=sys-devel/flex-2.5.4
+ >=sys-devel/bison-1.875d
+ || ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1
+ ( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx )
+ )
+ || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-3.2.3 )
+ clang? ( xml? ( virtual/pkgconfig ) )
+ doc? ( dev-python/sphinx )
+ libffi? ( virtual/pkgconfig )
+ ${PYTHON_DEPS}"
+RDEPEND="${COMMON_DEPEND}
+ clang? ( !<=sys-devel/clang-3.3-r99
+ !>=sys-devel/clang-9999 )
+ abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r2
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )"
+
+# pypy gives me around 1700 unresolved tests due to open file limit
+# being exceeded. probably GC does not close them fast enough.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+ test? ( || ( $(python_gen_useflags 'python*') ) )"
+
+S=${WORKDIR}/${P}.src
+
+# Some people actually override that in make.conf. That sucks since
+# we need to run install per-directory, and ninja can't do that...
+# so why did it call itself ninja in the first place?
+CMAKE_MAKEFILE_GENERATOR=emake
+
+pkg_pretend() {
+ # in megs
+ # !clang !debug !multitarget -O2 400
+ # !clang !debug multitarget -O2 550
+ # clang !debug !multitarget -O2 950
+ # clang !debug multitarget -O2 1200
+ # !clang debug multitarget -O2 5G
+ # clang !debug multitarget -O0 -g 12G
+ # clang debug multitarget -O2 16G
+ # clang debug multitarget -O0 -g 14G
+
+ local build_size=550
+ use clang && build_size=1200
+
+ if use debug; then
+ ewarn "USE=debug is known to increase the size of package considerably"
+ ewarn "and cause the tests to fail."
+ ewarn
+
+ (( build_size *= 14 ))
+ elif is-flagq '-g?(gdb)?([1-9])'; then
+ ewarn "The C++ compiler -g option is known to increase the size of the package"
+ ewarn "considerably. If you run out of space, please consider removing it."
+ ewarn
+
+ (( build_size *= 10 ))
+ fi
+
+ # Multiply by number of ABIs :).
+ local abis=( $(multilib_get_enabled_abis) )
+ (( build_size *= ${#abis[@]} ))
+
+ local CHECKREQS_DISK_BUILD=${build_size}M
+ check-reqs_pkg_pretend
+}
+
+pkg_setup() {
+ pkg_pretend
+
+ # need to check if the active compiler is ok
+
+ broken_gcc=( 3.2.2 3.2.3 3.3.2 4.1.1 )
+ broken_gcc_x86=( 3.4.0 3.4.2 )
+ broken_gcc_amd64=( 3.4.6 )
+
+ gcc_vers=$(gcc-fullversion)
+
+ if has "${gcc_vers}" "${broken_gcc[@]}"; then
+ elog "Your version of gcc is known to miscompile llvm."
+ elog "Check http://www.llvm.org/docs/GettingStarted.html for"
+ elog "possible solutions."
+ die "Your currently active version of gcc is known to miscompile llvm"
+ fi
+
+ if use abi_x86_32 && has "${gcc_vers}" "${broken_gcc_x86[@]}"; then
+ elog "Your version of gcc is known to miscompile llvm on x86"
+ elog "architectures. Check"
+ elog "http://www.llvm.org/docs/GettingStarted.html for possible"
+ elog "solutions."
+ die "Your currently active version of gcc is known to miscompile llvm"
+ fi
+
+ if use abi_x86_64 && has "${gcc_vers}" "${broken_gcc_amd64[@]}"; then
+ elog "Your version of gcc is known to miscompile llvm in amd64"
+ elog "architectures. Check"
+ elog "http://www.llvm.org/docs/GettingStarted.html for possible"
+ elog "solutions."
+ die "Your currently active version of gcc is known to miscompile llvm"
+ fi
+}
+
+src_unpack() {
+ default
+
+ rm -f "${S}"/tools/clang "${S}"/projects/compiler-rt \
+ || die "symlinks removal failed"
+
+ if use clang; then
+ mv "${WORKDIR}"/cfe-${PV}.src "${S}"/tools/clang \
+ || die "clang source directory move failed"
+ mv "${WORKDIR}"/compiler-rt-${PV}.src "${S}"/projects/compiler-rt \
+ || die "compiler-rt source directory move failed"
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-3.2-nodoctargz.patch
+ epatch "${FILESDIR}"/${P}-R600_debug.patch
+ epatch "${FILESDIR}"/${PN}-3.3-r2-gentoo-install.patch
+
+ # Hack cmake search path for Gentoo, bug #496480
+ epatch "${FILESDIR}"/${PN}-3.3-cmake-modulepath.patch
+
+ if use clang; then
+ # Automatically select active system GCC's libraries, bugs #406163 and #417913
+ epatch "${FILESDIR}"/clang-3.1-gentoo-runtime-gcc-detection-v3.patch
+
+ epatch "${FILESDIR}"/clang-3.3-gentoo-install.patch
+
+ # backport support for g++-X.Y header location
+ epatch "${FILESDIR}"/clang-3.3-gcc-header-path.patch
+ fi
+
+ local sub_files=(
+ Makefile.config.in
+ Makefile.rules
+ tools/llvm-config/llvm-config.cpp
+ )
+ use clang && sub_files+=(
+ tools/clang/lib/Driver/Tools.cpp
+ tools/clang/tools/scan-build/scan-build
+ )
+
+ # unfortunately ./configure won't listen to --mandir and the-like, so take
+ # care of this.
+ # note: we're setting the main libdir intentionally.
+ # where per-ABI is appropriate, we use $(GENTOO_LIBDIR) make.
+ einfo "Fixing install dirs"
+ sed -e "s,@libdir@,$(get_libdir),g" \
+ -e "s,@PF@,${PF},g" \
+ -e "s,@EPREFIX@,${EPREFIX},g" \
+ -i "${sub_files[@]}" \
+ || die "install paths sed failed"
+
+ # User patches
+ epatch_user
+
+ python_setup
+}
+
+multilib_src_configure() {
+ # disable timestamps since they confuse ccache
+ local conf_flags=(
+ --disable-timestamps
+ --enable-keep-symbols
+ --enable-shared
+ --with-optimize-option=
+ $(use_enable !debug optimized)
+ $(use_enable debug assertions)
+ $(use_enable debug expensive-checks)
+ $(use_enable libffi)
+ )
+
+ if use clang; then
+ conf_flags+=( --with-clang-resource-dir=../lib/clang/${PV} )
+ fi
+ # well, it's used only by clang executable c-index-test
+ if multilib_is_native_abi && use clang && use xml; then
+ conf_flags+=( XML2CONFIG="$(tc-getPKG_CONFIG) libxml-2.0" )
+ else
+ conf_flags+=( ac_cv_prog_XML2CONFIG="" )
+ fi
+
+ local targets bindings
+ if use multitarget; then
+ targets='all'
+ else
+ targets='host,cpp'
+ fi
+ conf_flags+=( --enable-targets=${targets} )
+
+ if use video_cards_radeon; then
+ conf_flags+=( --enable-experimental-targets=R600 )
+ fi
+
+ if multilib_is_native_abi; then
+ use gold && conf_flags+=( --with-binutils-include="${EPREFIX}"/usr/include/ )
+ # extra commas don't hurt
+ use ocaml && bindings+=',ocaml'
+ fi
+
+ [[ ${bindings} ]] || bindings='none'
+ conf_flags+=( --enable-bindings=${bindings} )
+
+ if use udis86; then
+ conf_flags+=( --with-udis86 )
+ fi
+
+ if use libffi; then
+ local CPPFLAGS=${CPPFLAGS}
+ append-cppflags "$(pkg-config --cflags libffi)"
+ fi
+
+ # llvm prefers clang over gcc, so we may need to force that
+ tc-export CC CXX
+
+ ECONF_SOURCE=${S} \
+ econf "${conf_flags[@]}"
+
+ multilib_is_native_abi && cmake_configure
+}
+
+cmake_configure() {
+ # sadly, cmake doesn't seem to have host autodetection
+ # but it's fairly easy to steal this from configured autotools
+ local targets=$(sed -n -e 's/^TARGETS_TO_BUILD=//p' Makefile.config || die)
+ local libdir=$(get_libdir)
+
+ # cmake doesn't have R600 in 3.3
+ targets=${targets/R600 /}
+
+ local mycmakeargs=(
+ -DLLVM_TARGETS_TO_BUILD="${targets// /;}"
+ -DLLVM_LIBDIR_SUFFIX=${libdir#lib}
+ )
+
+ BUILD_DIR=${S%/}_cmake \
+ cmake-utils_src_configure
+}
+
+set_makeargs() {
+ MAKEARGS=(
+ VERBOSE=1
+ REQUIRES_RTTI=1
+ GENTOO_LIBDIR=$(get_libdir)
+ )
+
+ # for tests, we want it all! otherwise, we may use a little filtering...
+ # adding ONLY_TOOLS also disables unittest building...
+ if [[ ${EBUILD_PHASE_FUNC} != src_test ]]; then
+ local tools=( llvm-config )
+ use clang && tools+=( clang )
+
+ if multilib_is_native_abi; then
+ tools+=(
+ opt llvm-as llvm-dis llc llvm-ar llvm-nm llvm-link lli
+ llvm-extract llvm-mc llvm-bcanalyzer llvm-diff macho-dump
+ llvm-objdump llvm-readobj llvm-rtdyld llvm-dwarfdump llvm-cov
+ llvm-size llvm-stress llvm-mcmarkup llvm-symbolizer obj2yaml
+ yaml2obj lto llvm-prof llvm-ranlib bugpoint
+ )
+
+ # those tools require 'lto' built first, so we need to delay
+ # building them to a second run
+ if [[ ${1} != -1 ]]; then
+ use gold && tools+=( gold )
+ fi
+ fi
+
+ MAKEARGS+=(
+ # filter tools + disable unittests implicitly
+ ONLY_TOOLS="${tools[*]}"
+
+ # this disables unittests & docs from clang
+ BUILD_CLANG_ONLY=YES
+ )
+ fi
+}
+
+multilib_src_compile() {
+ local MAKEARGS
+ set_makeargs -1
+ emake "${MAKEARGS[@]}"
+
+ if multilib_is_native_abi; then
+ set_makeargs
+ emake -C tools "${MAKEARGS[@]}"
+
+ if use doc; then
+ emake -C "${S}"/docs -f Makefile.sphinx man
+ use clang && emake -C "${S}"/tools/clang/docs/tools \
+ BUILD_FOR_WEBSITE=1 DST_MAN_DIR="${T}"/ man
+ emake -C "${S}"/docs -f Makefile.sphinx html
+ fi
+ fi
+
+ if use debug; then
+ pax-mark m Debug+Asserts+Checks/bin/llvm-rtdyld
+ pax-mark m Debug+Asserts+Checks/bin/lli
+ else
+ pax-mark m Release/bin/llvm-rtdyld
+ pax-mark m Release/bin/lli
+ fi
+}
+
+multilib_src_test() {
+ local MAKEARGS
+ set_makeargs
+
+ # build the remaining tools & unittests
+ emake "${MAKEARGS[@]}"
+
+ pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests
+ pax-mark m unittests/ExecutionEngine/MCJIT/Release/MCJITTests
+ pax-mark m unittests/Support/Release/SupportTests
+
+ emake "${MAKEARGS[@]}" check
+ use clang && emake "${MAKEARGS[@]}" -C tools/clang test
+}
+
+src_install() {
+ local MULTILIB_WRAPPED_HEADERS=(
+ /usr/include/llvm/Config/config.h
+ /usr/include/llvm/Config/llvm-config.h
+ )
+
+ use clang && MULTILIB_WRAPPED_HEADERS+=(
+ /usr/include/clang/Config/config.h
+ )
+
+ multilib-minimal_src_install
+
+ # Remove unnecessary headers on FreeBSD, bug #417171
+ use kernel_FreeBSD && use clang && rm "${ED}"usr/lib/clang/${PV}/include/{std,float,iso,limits,tgmath,varargs}*.h
+}
+
+multilib_src_install() {
+ local MAKEARGS
+ set_makeargs
+
+ emake "${MAKEARGS[@]}" DESTDIR="${D}" install
+
+ # Preserve ABI-variant of llvm-config.
+ dodir /tmp
+ mv "${ED}"/usr/bin/llvm-config "${ED}"/tmp/"${CHOST}"-llvm-config || die
+
+ if ! multilib_is_native_abi; then
+ # Drop all the executables since LLVM doesn't like to
+ # clobber when installing.
+ rm -r "${ED}"/usr/bin || die
+
+ # Backwards compat, will be happily removed someday.
+ dosym "${CHOST}"-llvm-config /tmp/llvm-config.${ABI}
+ else
+ # Move files back.
+ mv "${ED}"/tmp/*llvm-config* "${ED}"/usr/bin || die
+ # Create a symlink for host's llvm-config.
+ dosym "${CHOST}"-llvm-config /usr/bin/llvm-config
+
+ # Install docs.
+ if use doc; then
+ doman "${S}"/docs/_build/man/*.1
+ use clang && doman "${T}"/clang.1
+ dohtml -r "${S}"/docs/_build/html/
+ else
+ doman "${WORKDIR}"/${P}-manpages/*.1
+ fi
+
+ # Symlink the gold plugin.
+ if use gold; then
+ dodir /usr/${CHOST}/binutils-bin/lib/bfd-plugins
+ dosym ../../../../$(get_libdir)/LLVMgold.so \
+ /usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so
+ fi
+
+ # install cmake modules
+ emake -C "${S%/}"_cmake/cmake/modules DESTDIR="${D}" install
+ fi
+
+ # Fix install_names on Darwin. The build system is too complicated
+ # to just fix this, so we correct it post-install
+ local lib= f= odylib= libpv=${PV}
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ eval $(grep PACKAGE_VERSION= configure)
+ [[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION}
+ for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib LLVMHello.dylib ; do
+ # libEnhancedDisassembly is Darwin10 only, so non-fatal
+ # + omit clang libs if not enabled
+ [[ -f ${ED}/usr/lib/${lib} ]] || continue
+
+ ebegin "fixing install_name of $lib"
+ install_name_tool \
+ -id "${EPREFIX}"/usr/lib/${lib} \
+ "${ED}"/usr/lib/${lib}
+ eend $?
+ done
+ for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/lib{LTO,clang}.dylib ; do
+ # omit clang libs if not enabled
+ [[ -f ${ED}/usr/lib/${lib} ]] || continue
+
+ odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${libpv}.dylib)
+ ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
+ install_name_tool \
+ -change "${odylib}" \
+ "${EPREFIX}"/usr/lib/libLLVM-${libpv}.dylib \
+ -change "@rpath/libclang.dylib" \
+ "${EPREFIX}"/usr/lib/libclang.dylib \
+ -change "${S}"/Release/lib/libclang.dylib \
+ "${EPREFIX}"/usr/lib/libclang.dylib \
+ "${f}"
+ eend $?
+ done
+ fi
+}
+
+multilib_src_install_all() {
+ insinto /usr/share/vim/vimfiles/syntax
+ doins utils/vim/*.vim
+
+ if use clang; then
+ cd tools/clang || die
+
+ if use static-analyzer ; then
+ dobin tools/scan-build/ccc-analyzer
+ dosym ccc-analyzer /usr/bin/c++-analyzer
+ dobin tools/scan-build/scan-build
+
+ insinto /usr/share/${PN}
+ doins tools/scan-build/scanview.css
+ doins tools/scan-build/sorttable.js
+ fi
+
+ python_inst() {
+ if use static-analyzer ; then
+ pushd tools/scan-view >/dev/null || die
+
+ python_doscript scan-view
+
+ touch __init__.py || die
+ python_moduleinto clang
+ python_domodule __init__.py Reporter.py Resources ScanView.py startfile.py
+
+ popd >/dev/null || die
+ fi
+
+ if use python ; then
+ pushd bindings/python/clang >/dev/null || die
+
+ python_moduleinto clang
+ python_domodule __init__.py cindex.py enumerations.py
+
+ popd >/dev/null || die
+ fi
+
+ # AddressSanitizer symbolizer (currently separate)
+ python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
+ }
+ python_foreach_impl python_inst
+ fi
+}
diff --git a/sys-devel/llvm/llvm-3.4.2.ebuild b/sys-devel/llvm/llvm-3.4.2.ebuild
new file mode 100644
index 000000000000..0469f83f66c8
--- /dev/null
+++ b/sys-devel/llvm/llvm-3.4.2.ebuild
@@ -0,0 +1,543 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 pypy )
+# this causes some issues so make it optional for now.
+# 3.5 will have CMakeFiles support in autotools.
+WANT_CMAKE=cmake
+
+inherit cmake-utils eutils flag-o-matic multibuild multilib \
+ multilib-minimal python-r1 toolchain-funcs pax-utils check-reqs prefix
+
+DESCRIPTION="Low Level Virtual Machine"
+HOMEPAGE="http://llvm.org/"
+SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.gz
+ clang? ( http://llvm.org/releases/${PV}/compiler-rt-3.4.src.tar.gz
+ http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.gz
+ http://llvm.org/releases/${PV}/clang-tools-extra-3.4.src.tar.gz )
+ !doc? ( http://dev.gentoo.org/~mgorny/dist/${PN}-3.4-manpages.tar.bz2 )"
+
+LICENSE="UoI-NCSA"
+SLOT="0/3.4"
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="clang debug doc gold +libffi multitarget ncurses ocaml python
+ +static-analyzer test udis86 xml video_cards_radeon
+ kernel_Darwin kernel_FreeBSD"
+
+COMMON_DEPEND="
+ sys-libs/zlib:0=
+ clang? (
+ python? ( ${PYTHON_DEPS} )
+ static-analyzer? (
+ dev-lang/perl:*
+ ${PYTHON_DEPS}
+ )
+ xml? ( dev-libs/libxml2:2= )
+ )
+ gold? ( >=sys-devel/binutils-2.22:*[cxx] )
+ libffi? ( >=virtual/libffi-3.0.13-r1:0=[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.9-r3:5=[${MULTILIB_USEDEP}] )
+ ocaml? ( dev-lang/ocaml:0= )
+ udis86? ( >=dev-libs/udis86-1.7-r2:0=[pic(+),${MULTILIB_USEDEP}] )"
+DEPEND="${COMMON_DEPEND}
+ dev-lang/perl
+ >=sys-devel/make-3.81
+ >=sys-devel/flex-2.5.4
+ >=sys-devel/bison-1.875d
+ || ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1 >=sys-devel/llvm-3.3
+ ( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx )
+ )
+ || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-5.1 )
+ clang? ( xml? ( virtual/pkgconfig ) )
+ doc? ( dev-python/sphinx )
+ libffi? ( virtual/pkgconfig )
+ ${PYTHON_DEPS}"
+RDEPEND="${COMMON_DEPEND}
+ clang? ( !<=sys-devel/clang-${PV}-r99
+ !>=sys-devel/clang-9999 )
+ abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r2
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )"
+PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )"
+
+# pypy gives me around 1700 unresolved tests due to open file limit
+# being exceeded. probably GC does not close them fast enough.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+ test? ( || ( $(python_gen_useflags 'python*') ) )"
+
+S=${WORKDIR}/${P}.src
+
+# Some people actually override that in make.conf. That sucks since
+# we need to run install per-directory, and ninja can't do that...
+# so why did it call itself ninja in the first place?
+CMAKE_MAKEFILE_GENERATOR=emake
+
+MULTILIB_CHOST_TOOLS=(
+ /usr/bin/llvm-config
+)
+
+pkg_pretend() {
+ # in megs
+ # !clang !debug !multitarget -O2 400
+ # !clang !debug multitarget -O2 550
+ # clang !debug !multitarget -O2 950
+ # clang !debug multitarget -O2 1200
+ # !clang debug multitarget -O2 5G
+ # clang !debug multitarget -O0 -g 12G
+ # clang debug multitarget -O2 16G
+ # clang debug multitarget -O0 -g 14G
+
+ local build_size=550
+ use clang && build_size=1200
+
+ if use debug; then
+ ewarn "USE=debug is known to increase the size of package considerably"
+ ewarn "and cause the tests to fail."
+ ewarn
+
+ (( build_size *= 14 ))
+ elif is-flagq '-g?(gdb)?([1-9])'; then
+ ewarn "The C++ compiler -g option is known to increase the size of the package"
+ ewarn "considerably. If you run out of space, please consider removing it."
+ ewarn
+
+ (( build_size *= 10 ))
+ fi
+
+ # Multiply by number of ABIs :).
+ local abis=( $(multilib_get_enabled_abis) )
+ (( build_size *= ${#abis[@]} ))
+
+ local CHECKREQS_DISK_BUILD=${build_size}M
+ check-reqs_pkg_pretend
+}
+
+pkg_setup() {
+ pkg_pretend
+
+ # need to check if the active compiler is ok
+
+ broken_gcc=( 3.2.2 3.2.3 3.3.2 4.1.1 )
+ broken_gcc_x86=( 3.4.0 3.4.2 )
+ broken_gcc_amd64=( 3.4.6 )
+
+ gcc_vers=$(gcc-fullversion)
+
+ if has "${gcc_vers}" "${broken_gcc[@]}"; then
+ elog "Your version of gcc is known to miscompile llvm."
+ elog "Check http://www.llvm.org/docs/GettingStarted.html for"
+ elog "possible solutions."
+ die "Your currently active version of gcc is known to miscompile llvm"
+ fi
+
+ if use abi_x86_32 && has "${gcc_vers}" "${broken_gcc_x86[@]}"; then
+ elog "Your version of gcc is known to miscompile llvm on x86"
+ elog "architectures. Check"
+ elog "http://www.llvm.org/docs/GettingStarted.html for possible"
+ elog "solutions."
+ die "Your currently active version of gcc is known to miscompile llvm"
+ fi
+
+ if use abi_x86_64 && has "${gcc_vers}" "${broken_gcc_amd64[@]}"; then
+ elog "Your version of gcc is known to miscompile llvm in amd64"
+ elog "architectures. Check"
+ elog "http://www.llvm.org/docs/GettingStarted.html for possible"
+ elog "solutions."
+ die "Your currently active version of gcc is known to miscompile llvm"
+ fi
+}
+
+src_unpack() {
+ default
+
+ rm -f "${S}"/tools/clang "${S}"/projects/compiler-rt \
+ || die "symlinks removal failed"
+
+ if use clang; then
+ mv "${WORKDIR}"/cfe-${PV}.src "${S}"/tools/clang \
+ || die "clang source directory move failed"
+ mv "${WORKDIR}"/compiler-rt-3.4 "${S}"/projects/compiler-rt \
+ || die "compiler-rt source directory move failed"
+ mv "${WORKDIR}"/clang-tools-extra-3.4 "${S}"/tools/clang/tools/extra \
+ || die "clang-tools-extra source directory move failed"
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-3.2-nodoctargz.patch
+ epatch "${FILESDIR}"/${PN}-3.4-gentoo-install.patch
+ # Hack cmake search path for Gentoo, bug #496480
+ epatch "${FILESDIR}"/${PN}-3.3-cmake-modulepath.patch
+ # Use built-in ConfigParser to avoid failures with configparser-3.2
+ # https://bugs.gentoo.org/show_bug.cgi?id=500856
+ epatch "${FILESDIR}"/${PN}-3.4-cmake-configparser.patch
+
+ if use clang; then
+ # Automatically select active system GCC's libraries, bugs #406163 and #417913
+ epatch "${FILESDIR}"/clang-3.1-gentoo-runtime-gcc-detection-v3.patch
+
+ epatch "${FILESDIR}"/clang-3.4-gentoo-install.patch
+ epatch "${FILESDIR}"/clang-3.4-darwin_build_fix.patch
+ epatch "${FILESDIR}"/clang-3.4-darwin_prefix-include-paths.patch
+ eprefixify tools/clang/lib/Frontend/InitHeaderSearch.cpp
+ fi
+
+ if use prefix && use clang; then
+ sed -i -e "/^CFLAGS /s@-Werror@-I${EPREFIX}/usr/include@" \
+ projects/compiler-rt/make/platform/clang_*.mk || die
+ fi
+
+ local sub_files=(
+ Makefile.config.in
+ Makefile.rules
+ tools/llvm-config/llvm-config.cpp
+ )
+ use clang && sub_files+=(
+ tools/clang/lib/Driver/Tools.cpp
+ tools/clang/tools/scan-build/scan-build
+ )
+
+ # unfortunately ./configure won't listen to --mandir and the-like, so take
+ # care of this.
+ # note: we're setting the main libdir intentionally.
+ # where per-ABI is appropriate, we use $(GENTOO_LIBDIR) make.
+ einfo "Fixing install dirs"
+ sed -e "s,@libdir@,$(get_libdir),g" \
+ -e "s,@PF@,${PF},g" \
+ -e "s,@EPREFIX@,${EPREFIX},g" \
+ -i "${sub_files[@]}" \
+ || die "install paths sed failed"
+
+ if use clang; then
+ # constantly fails for a long time, likely due to our patches
+ rm tools/clang/test/Driver/cross-linux.c || die
+ fi
+
+ # User patches
+ epatch_user
+
+ python_setup
+}
+
+multilib_src_configure() {
+ # disable timestamps since they confuse ccache
+ local conf_flags=(
+ --disable-timestamps
+ --enable-keep-symbols
+ --enable-shared
+ --with-optimize-option=
+ $(use_enable !debug optimized)
+ $(use_enable debug assertions)
+ $(use_enable debug expensive-checks)
+ $(use_enable ncurses terminfo)
+ $(use_enable libffi)
+ )
+
+ if use clang; then
+ conf_flags+=( --with-clang-resource-dir=../lib/clang/${PV} )
+ fi
+ # well, it's used only by clang executable c-index-test
+ if multilib_is_native_abi && use clang && use xml; then
+ conf_flags+=( XML2CONFIG="$(tc-getPKG_CONFIG) libxml-2.0" )
+ else
+ conf_flags+=( ac_cv_prog_XML2CONFIG="" )
+ fi
+
+ local targets bindings
+ if use multitarget; then
+ targets='all'
+ else
+ targets='host,cpp'
+ use video_cards_radeon && targets+=',r600'
+ fi
+ conf_flags+=( --enable-targets=${targets} )
+
+ if multilib_is_native_abi; then
+ use gold && conf_flags+=( --with-binutils-include="${EPREFIX}"/usr/include/ )
+ # extra commas don't hurt
+ use ocaml && bindings+=',ocaml'
+ fi
+
+ [[ ${bindings} ]] || bindings='none'
+ conf_flags+=( --enable-bindings=${bindings} )
+
+ if use udis86; then
+ conf_flags+=( --with-udis86 )
+ fi
+
+ if use libffi; then
+ local CPPFLAGS=${CPPFLAGS}
+ append-cppflags "$(pkg-config --cflags libffi)"
+ fi
+
+ # llvm prefers clang over gcc, so we may need to force that
+ tc-export CC CXX
+
+ ECONF_SOURCE=${S} \
+ econf "${conf_flags[@]}"
+
+ multilib_is_native_abi && cmake_configure
+}
+
+cmake_configure() {
+ # sadly, cmake doesn't seem to have host autodetection
+ # but it's fairly easy to steal this from configured autotools
+ local targets=$(sed -n -e 's/^TARGETS_TO_BUILD=//p' Makefile.config || die)
+ local libdir=$(get_libdir)
+ local mycmakeargs=(
+ # just the stuff needed to get correct cmake modules
+ $(cmake-utils_use ncurses LLVM_ENABLE_TERMINFO)
+
+ -DLLVM_TARGETS_TO_BUILD="${targets// /;}"
+ -DLLVM_LIBDIR_SUFFIX=${libdir#lib}
+ )
+
+ BUILD_DIR=${S%/}_cmake \
+ cmake-utils_src_configure
+}
+
+set_makeargs() {
+ MAKEARGS=(
+ VERBOSE=1
+ REQUIRES_RTTI=1
+ GENTOO_LIBDIR=$(get_libdir)
+ )
+
+ # for tests, we want it all! otherwise, we may use a little filtering...
+ # adding ONLY_TOOLS also disables unittest building...
+ if [[ ${EBUILD_PHASE_FUNC} != src_test ]]; then
+ local tools=( llvm-config )
+ use clang && tools+=( clang )
+
+ if multilib_is_native_abi; then
+ tools+=(
+ opt llvm-as llvm-dis llc llvm-ar llvm-nm llvm-link lli
+ llvm-extract llvm-mc llvm-bcanalyzer llvm-diff macho-dump
+ llvm-objdump llvm-readobj llvm-rtdyld llvm-dwarfdump llvm-cov
+ llvm-size llvm-stress llvm-mcmarkup llvm-symbolizer obj2yaml
+ yaml2obj lto bugpoint
+ )
+
+ # the build system runs explicitly specified tools in parallel,
+ # so we need to split it into two runs
+ if [[ ${1} != -1 ]]; then
+ # those require lto
+ tools+=( llvm-lto )
+ use gold && tools+=( gold )
+
+ # those require clang :)
+ # we need to explicitly specify all its tools
+ # since we're passing BUILD_CLANG_ONLY
+ use clang && tools+=(
+ clang/tools/{clang-check,clang-format,extra}
+ )
+ fi
+ fi
+
+ MAKEARGS+=(
+ # filter tools + disable unittests implicitly
+ ONLY_TOOLS="${tools[*]}"
+
+ # this disables unittests & docs from clang
+ BUILD_CLANG_ONLY=YES
+ )
+ fi
+}
+
+multilib_src_compile() {
+ local MAKEARGS
+ set_makeargs -1
+ emake "${MAKEARGS[@]}"
+
+ if multilib_is_native_abi; then
+ set_makeargs
+ emake -C tools "${MAKEARGS[@]}"
+
+ if use doc; then
+ emake -C "${S}"/docs -f Makefile.sphinx man
+ use clang && emake -C "${S}"/tools/clang/docs/tools \
+ BUILD_FOR_WEBSITE=1 DST_MAN_DIR="${T}"/ man
+ emake -C "${S}"/docs -f Makefile.sphinx html
+ fi
+ fi
+
+ if use debug; then
+ pax-mark m Debug+Asserts+Checks/bin/llvm-rtdyld
+ pax-mark m Debug+Asserts+Checks/bin/lli
+ pax-mark m Debug+Asserts+Checks/bin/lli-child-target
+ else
+ pax-mark m Release/bin/llvm-rtdyld
+ pax-mark m Release/bin/lli
+ pax-mark m Release/bin/lli-child-target
+ fi
+}
+
+multilib_src_test() {
+ local MAKEARGS
+ set_makeargs
+
+ # build the remaining tools & unittests
+ emake "${MAKEARGS[@]}"
+
+ pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests
+ pax-mark m unittests/ExecutionEngine/MCJIT/Release/MCJITTests
+ pax-mark m unittests/Support/Release/SupportTests
+
+ # respect TMPDIR!
+ local -x LIT_PRESERVES_TMP=1
+ emake "${MAKEARGS[@]}" check
+ use clang && emake "${MAKEARGS[@]}" -C tools/clang test
+}
+
+src_install() {
+ local MULTILIB_WRAPPED_HEADERS=(
+ /usr/include/llvm/Config/config.h
+ /usr/include/llvm/Config/llvm-config.h
+ )
+
+ use clang && MULTILIB_WRAPPED_HEADERS+=(
+ /usr/include/clang/Config/config.h
+ )
+
+ multilib-minimal_src_install
+
+ # Remove unnecessary headers on FreeBSD, bug #417171
+ use kernel_FreeBSD && use clang && rm "${ED}"usr/lib/clang/${PV}/include/{std,float,iso,limits,tgmath,varargs}*.h
+}
+
+multilib_src_install() {
+ local MAKEARGS
+ set_makeargs
+
+ local root=${D}/_${ABI}
+
+ emake "${MAKEARGS[@]}" DESTDIR="${root}" install
+ multibuild_merge_root "${root}" "${D}"
+
+ if ! multilib_is_native_abi; then
+ # Backwards compat, will be happily removed someday.
+ dosym "${CHOST}"-llvm-config /usr/bin/llvm-config.${ABI}
+ else
+ # Install docs.
+ if use doc; then
+ doman "${S}"/docs/_build/man/*.1
+ use clang && doman "${T}"/clang.1
+ dohtml -r "${S}"/docs/_build/html/
+ else
+ if ! use clang; then
+ rm "${WORKDIR}"/${PN}-3.4-manpages/clang.1 || die
+ fi
+ doman "${WORKDIR}"/${PN}-3.4-manpages/*.1
+ fi
+
+ # Symlink the gold plugin.
+ if use gold; then
+ dodir /usr/${CHOST}/binutils-bin/lib/bfd-plugins
+ dosym ../../../../$(get_libdir)/LLVMgold.so \
+ /usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so
+ fi
+
+ # install cmake modules
+ if use cmake; then
+ emake -C "${S%/}"_cmake/cmake/modules DESTDIR="${D}" install
+ fi
+ fi
+
+ # Fix install_names on Darwin. The build system is too complicated
+ # to just fix this, so we correct it post-install
+ local lib= f= odylib= ndylib= libpv=${PV}
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ eval $(grep PACKAGE_VERSION= configure)
+ [[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION}
+ libpvminor=${libpv%.[0-9]*}
+ for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib LLVMHello.dylib clang/${libpv}/lib/darwin/libclang_rt.asan_{osx,iossim}_dynamic.dylib; do
+ # libEnhancedDisassembly is Darwin10 only, so non-fatal
+ # + omit clang libs if not enabled
+ [[ -f ${ED}/usr/lib/${lib} ]] || continue
+
+ ebegin "fixing install_name of $lib"
+ install_name_tool \
+ -id "${EPREFIX}"/usr/lib/${lib} \
+ "${ED}"/usr/lib/${lib}
+ eend $?
+ done
+ for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/lib*.dylib "${ED}"/usr/lib/clang/${libpv}/lib/darwin/*.dylib ; do
+ # omit clang libs if not enabled
+ [[ -f "${f}" ]] || continue
+
+ scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | \
+ while read odylib ; do
+ ndylib=
+ case ${odylib} in
+ */libclang.dylib)
+ ndylib="${EPREFIX}"/usr/lib/libclang.dylib
+ ;;
+ */libLLVM-${libpv}.dylib)
+ ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpv}.dylib
+ ;;
+ */libLLVM-${libpvminor}.dylib)
+ ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpvminor}.dylib
+ ;;
+ */libLTO.dylib)
+ ndylib="${EPREFIX}"/usr/lib/libLTO.dylib
+ ;;
+ esac
+ if [[ -n ${ndylib} ]] ; then
+ ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
+ install_name_tool \
+ -change "${odylib}" "${ndylib}" \
+ "${f}"
+ eend $?
+ fi
+ done
+ done
+ fi
+}
+
+multilib_src_install_all() {
+ insinto /usr/share/vim/vimfiles/syntax
+ doins utils/vim/*.vim
+
+ if use clang; then
+ cd tools/clang || die
+
+ if use static-analyzer ; then
+ dobin tools/scan-build/ccc-analyzer
+ dosym ccc-analyzer /usr/bin/c++-analyzer
+ dobin tools/scan-build/scan-build
+
+ insinto /usr/share/${PN}
+ doins tools/scan-build/scanview.css
+ doins tools/scan-build/sorttable.js
+ fi
+
+ python_inst() {
+ if use static-analyzer ; then
+ pushd tools/scan-view >/dev/null || die
+
+ python_doscript scan-view
+
+ touch __init__.py || die
+ python_moduleinto clang
+ python_domodule __init__.py Reporter.py Resources ScanView.py startfile.py
+
+ popd >/dev/null || die
+ fi
+
+ if use python ; then
+ pushd bindings/python/clang >/dev/null || die
+
+ python_moduleinto clang
+ python_domodule __init__.py cindex.py enumerations.py
+
+ popd >/dev/null || die
+ fi
+
+ # AddressSanitizer symbolizer (currently separate)
+ python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
+ }
+ python_foreach_impl python_inst
+ fi
+}
diff --git a/sys-devel/llvm/llvm-3.5.0.ebuild b/sys-devel/llvm/llvm-3.5.0.ebuild
new file mode 100644
index 000000000000..d194efb959f8
--- /dev/null
+++ b/sys-devel/llvm/llvm-3.5.0.ebuild
@@ -0,0 +1,530 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 pypy )
+
+inherit eutils flag-o-matic multibuild multilib \
+ multilib-minimal python-r1 toolchain-funcs pax-utils check-reqs prefix
+
+DESCRIPTION="Low Level Virtual Machine"
+HOMEPAGE="http://llvm.org/"
+SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz
+ clang? ( http://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.xz
+ http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.xz
+ http://llvm.org/releases/${PV}/clang-tools-extra-${PV}.src.tar.xz )
+ !doc? ( http://dev.gentoo.org/~voyageur/distfiles/${P}-manpages.tar.bz2 )"
+
+LICENSE="UoI-NCSA"
+SLOT="0/3.5"
+KEYWORDS="amd64 arm ppc ppc64 ~sparc x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="clang debug doc gold libedit +libffi multitarget ncurses ocaml python
+ +static-analyzer test xml video_cards_radeon
+ kernel_Darwin kernel_FreeBSD"
+
+COMMON_DEPEND="
+ sys-libs/zlib:0=
+ clang? (
+ python? ( ${PYTHON_DEPS} )
+ static-analyzer? (
+ dev-lang/perl:*
+ ${PYTHON_DEPS}
+ )
+ xml? ( dev-libs/libxml2:2= )
+ )
+ gold? ( >=sys-devel/binutils-2.22:*[cxx] )
+ libedit? ( dev-libs/libedit:0=[${MULTILIB_USEDEP}] )
+ libffi? ( >=virtual/libffi-3.0.13-r1:0=[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.9-r3:5=[${MULTILIB_USEDEP}] )
+ ocaml? ( dev-lang/ocaml:0= )"
+# configparser-3.2 breaks the build (3.3 or none at all are fine)
+DEPEND="${COMMON_DEPEND}
+ app-arch/xz-utils
+ dev-lang/perl
+ >=sys-devel/make-3.81
+ >=sys-devel/flex-2.5.4
+ >=sys-devel/bison-1.875d
+ || ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1
+ ( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx )
+ )
+ || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-5.1 )
+ clang? ( xml? ( virtual/pkgconfig ) )
+ doc? ( dev-python/sphinx )
+ libffi? ( virtual/pkgconfig )
+ !!<dev-python/configparser-3.3.0.2
+ ${PYTHON_DEPS}"
+RDEPEND="${COMMON_DEPEND}
+ clang? ( !<=sys-devel/clang-${PV}-r99
+ !>=sys-devel/clang-9999 )
+ abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r2
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )"
+PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )"
+
+# pypy gives me around 1700 unresolved tests due to open file limit
+# being exceeded. probably GC does not close them fast enough.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+ test? ( || ( $(python_gen_useflags 'python*') ) )"
+
+S=${WORKDIR}/${P}.src
+
+# Some people actually override that in make.conf. That sucks since
+# we need to run install per-directory, and ninja can't do that...
+# so why did it call itself ninja in the first place?
+CMAKE_MAKEFILE_GENERATOR=emake
+
+pkg_pretend() {
+ # in megs
+ # !clang !debug !multitarget -O2 400
+ # !clang !debug multitarget -O2 550
+ # clang !debug !multitarget -O2 950
+ # clang !debug multitarget -O2 1200
+ # !clang debug multitarget -O2 5G
+ # clang !debug multitarget -O0 -g 12G
+ # clang debug multitarget -O2 16G
+ # clang debug multitarget -O0 -g 14G
+
+ local build_size=550
+ use clang && build_size=1200
+
+ if use debug; then
+ ewarn "USE=debug is known to increase the size of package considerably"
+ ewarn "and cause the tests to fail."
+ ewarn
+
+ (( build_size *= 14 ))
+ elif is-flagq '-g?(gdb)?([1-9])'; then
+ ewarn "The C++ compiler -g option is known to increase the size of the package"
+ ewarn "considerably. If you run out of space, please consider removing it."
+ ewarn
+
+ (( build_size *= 10 ))
+ fi
+
+ # Multiply by number of ABIs :).
+ local abis=( $(multilib_get_enabled_abis) )
+ (( build_size *= ${#abis[@]} ))
+
+ local CHECKREQS_DISK_BUILD=${build_size}M
+ check-reqs_pkg_pretend
+
+ if [[ ${MERGE_TYPE} != binary ]]; then
+ echo 'int main() {return 0;}' > "${T}"/test.cxx || die
+ ebegin "Trying to build a C++11 test program"
+ if ! $(tc-getCXX) -std=c++11 -o /dev/null "${T}"/test.cxx; then
+ eerror "LLVM-${PV} requires C++11-capable C++ compiler. Your current compiler"
+ eerror "does not seem to support -std=c++11 option. Please upgrade your compiler"
+ eerror "to gcc-4.7 or an equivalent version supporting C++11."
+ die "Currently active compiler does not support -std=c++11"
+ fi
+ eend ${?}
+ fi
+}
+
+pkg_setup() {
+ pkg_pretend
+}
+
+src_unpack() {
+ default
+
+ rm -f "${S}"/tools/clang "${S}"/projects/compiler-rt \
+ || die "symlinks removal failed"
+
+ if use clang; then
+ mv "${WORKDIR}"/cfe-${PV}.src "${S}"/tools/clang \
+ || die "clang source directory move failed"
+ mv "${WORKDIR}"/compiler-rt-${PV}.src "${S}"/projects/compiler-rt \
+ || die "compiler-rt source directory move failed"
+ mv "${WORKDIR}"/clang-tools-extra-${PV}.src "${S}"/tools/clang/tools/extra \
+ || die "clang-tools-extra source directory move failed"
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-3.2-nodoctargz.patch
+ epatch "${FILESDIR}"/${PN}-3.5-gcc-4.9.patch
+ epatch "${FILESDIR}"/${PN}-3.5-gentoo-install.patch
+
+ epatch "${FILESDIR}"/${P}-fix_LLVMExports_cmake.patch
+
+ if use clang; then
+ # Automatically select active system GCC's libraries, bugs #406163 and #417913
+ epatch "${FILESDIR}"/clang-3.5-gentoo-runtime-gcc-detection-v3.patch
+
+ epatch "${FILESDIR}"/clang-3.5-gentoo-install.patch
+ epatch "${FILESDIR}"/clang-3.4-darwin_prefix-include-paths.patch
+ eprefixify tools/clang/lib/Frontend/InitHeaderSearch.cpp
+ fi
+
+ if use prefix && use clang; then
+ sed -i -e "/^CFLAGS /s@-Werror@-I${EPREFIX}/usr/include@" \
+ projects/compiler-rt/make/platform/clang_*.mk || die
+ fi
+
+ local sub_files=(
+ Makefile.config.in
+ Makefile.rules
+ tools/llvm-config/llvm-config.cpp
+ )
+ use clang && sub_files+=(
+ tools/clang/lib/Driver/Tools.cpp
+ tools/clang/tools/scan-build/scan-build
+ )
+
+ # unfortunately ./configure won't listen to --mandir and the-like, so take
+ # care of this.
+ # note: we're setting the main libdir intentionally.
+ # where per-ABI is appropriate, we use $(GENTOO_LIBDIR) make.
+ einfo "Fixing install dirs"
+ sed -e "s,@libdir@,$(get_libdir),g" \
+ -e "s,@PF@,${PF},g" \
+ -e "s,@EPREFIX@,${EPREFIX},g" \
+ -i "${sub_files[@]}" \
+ || die "install paths sed failed"
+
+ if use clang; then
+ # constantly fails for a long time, likely due to our patches
+ rm tools/clang/test/Driver/cross-linux.c || die
+ fi
+
+ # User patches
+ epatch_user
+
+ python_setup
+}
+
+multilib_src_configure() {
+ # disable timestamps since they confuse ccache
+ local conf_flags=(
+ --disable-timestamps
+ --enable-keep-symbols
+ --enable-shared
+ --with-optimize-option=
+ $(tc-is-static-only && echo --disable-shared)
+ $(use_enable !debug optimized)
+ $(use_enable debug assertions)
+ $(use_enable debug expensive-checks)
+ $(use_enable libedit)
+ $(use_enable ncurses terminfo)
+ $(use_enable libffi)
+ )
+
+ # well, it's used only by clang executable c-index-test
+ if multilib_is_native_abi && use clang && use xml; then
+ conf_flags+=( XML2CONFIG="$(tc-getPKG_CONFIG) libxml-2.0" )
+ else
+ conf_flags+=( ac_cv_prog_XML2CONFIG="" )
+ fi
+
+ local targets bindings
+ if use multitarget; then
+ targets='all'
+ else
+ targets='host,cpp'
+ use video_cards_radeon && targets+=',r600'
+ fi
+ conf_flags+=( --enable-targets=${targets} )
+
+ if multilib_is_native_abi; then
+ use gold && conf_flags+=( --with-binutils-include="${EPREFIX}"/usr/include/ )
+ # extra commas don't hurt
+ use ocaml && bindings+=',ocaml'
+ fi
+
+ [[ ${bindings} ]] || bindings='none'
+ conf_flags+=( --enable-bindings=${bindings} )
+
+ if use libffi; then
+ local CPPFLAGS=${CPPFLAGS}
+ append-cppflags "$(pkg-config --cflags libffi)"
+ fi
+
+ # llvm prefers clang over gcc, so we may need to force that
+ tc-export CC CXX
+
+ ECONF_SOURCE=${S} \
+ econf "${conf_flags[@]}"
+}
+
+set_makeargs() {
+ MAKEARGS=(
+ VERBOSE=1
+ REQUIRES_RTTI=1
+ GENTOO_LIBDIR=$(get_libdir)
+ )
+
+ # for tests, we want it all! otherwise, we may use a little filtering...
+ # adding ONLY_TOOLS also disables unittest building...
+ if [[ ${EBUILD_PHASE_FUNC} != src_test ]]; then
+ local tools=( llvm-config )
+ use clang && tools+=( clang )
+
+ if multilib_is_native_abi; then
+ tools+=(
+ opt llvm-as llvm-dis llc llvm-ar llvm-nm llvm-link lli
+ llvm-extract llvm-mc llvm-bcanalyzer llvm-diff macho-dump
+ llvm-objdump llvm-readobj llvm-rtdyld llvm-dwarfdump llvm-cov
+ llvm-size llvm-stress llvm-mcmarkup llvm-profdata
+ llvm-symbolizer obj2yaml yaml2obj lto bugpoint
+ )
+
+ # the build system runs explicitly specified tools in parallel,
+ # so we need to split it into two runs
+ if [[ ${1} != -1 ]]; then
+ # those require lto
+ tools+=( llvm-lto )
+ use gold && tools+=( gold )
+
+ # those require clang :)
+ # we need to explicitly specify all its tools
+ # since we're passing BUILD_CLANG_ONLY
+ use clang && tools+=(
+ clang/tools/{clang-check,clang-format,extra}
+ )
+ fi
+ fi
+
+ MAKEARGS+=(
+ # filter tools + disable unittests implicitly
+ ONLY_TOOLS="${tools[*]}"
+
+ # this disables unittests & docs from clang
+ BUILD_CLANG_ONLY=YES
+ )
+ fi
+}
+
+multilib_src_compile() {
+ local MAKEARGS
+ set_makeargs -1
+ emake "${MAKEARGS[@]}"
+
+ if multilib_is_native_abi; then
+ set_makeargs
+ emake -C tools "${MAKEARGS[@]}"
+
+ if use doc; then
+ emake -C "${S}"/docs -f Makefile.sphinx man
+ use clang && emake -C "${S}"/tools/clang/docs/tools \
+ BUILD_FOR_WEBSITE=1 DST_MAN_DIR="${T}"/ man
+ emake -C "${S}"/docs -f Makefile.sphinx html
+ fi
+ fi
+
+ if use debug; then
+ pax-mark m Debug+Asserts+Checks/bin/llvm-rtdyld
+ pax-mark m Debug+Asserts+Checks/bin/lli
+ pax-mark m Debug+Asserts+Checks/bin/lli-child-target
+ else
+ pax-mark m Release/bin/llvm-rtdyld
+ pax-mark m Release/bin/lli
+ pax-mark m Release/bin/lli-child-target
+ fi
+}
+
+multilib_src_test() {
+ local MAKEARGS
+ set_makeargs
+
+ # build the remaining tools & unittests
+ emake "${MAKEARGS[@]}"
+
+ pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests
+ pax-mark m unittests/ExecutionEngine/MCJIT/Release/MCJITTests
+ pax-mark m unittests/Support/Release/SupportTests
+
+ # respect TMPDIR!
+ local -x LIT_PRESERVES_TMP=1
+ emake "${MAKEARGS[@]}" check
+ use clang && emake "${MAKEARGS[@]}" -C tools/clang test
+}
+
+src_install() {
+ local MULTILIB_CHOST_TOOLS=(
+ /usr/bin/llvm-config
+ )
+
+ local MULTILIB_WRAPPED_HEADERS=(
+ /usr/include/llvm/Config/config.h
+ /usr/include/llvm/Config/llvm-config.h
+ )
+
+ if use clang; then
+ # note: magic applied below
+ MULTILIB_CHOST_TOOLS+=(
+ /usr/bin/clang
+ /usr/bin/clang++
+ /usr/bin/clang-${PV}
+ /usr/bin/clang++-${PV}
+ )
+
+ MULTILIB_WRAPPED_HEADERS+=(
+ /usr/include/clang/Config/config.h
+ )
+ fi
+
+ multilib-minimal_src_install
+
+ # Remove unnecessary headers on FreeBSD, bug #417171
+ use kernel_FreeBSD && use clang && rm "${ED}"usr/lib/clang/${PV}/include/{std,float,iso,limits,tgmath,varargs}*.h
+}
+
+multilib_src_install() {
+ local MAKEARGS
+ set_makeargs
+
+ local root=${D}/_${ABI}
+
+ emake "${MAKEARGS[@]}" DESTDIR="${root}" install
+ multibuild_merge_root "${root}" "${D}"
+
+ if ! multilib_is_native_abi; then
+ # Backwards compat, will be happily removed someday.
+ dosym "${CHOST}"-llvm-config /usr/bin/llvm-config.${ABI}
+ else
+ # Install docs.
+ if use doc; then
+ doman "${S}"/docs/_build/man/*.1
+ use clang && doman "${T}"/clang.1
+ dohtml -r "${S}"/docs/_build/html/
+ else
+ if ! use clang; then
+ rm "${WORKDIR}"/${P}-manpages/clang.1 || die
+ fi
+ doman "${WORKDIR}"/${P}-manpages/*.1
+ fi
+
+ # Symlink the gold plugin.
+ if use gold; then
+ dodir /usr/${CHOST}/binutils-bin/lib/bfd-plugins
+ dosym ../../../../$(get_libdir)/LLVMgold.so \
+ /usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so
+ fi
+ fi
+
+ # apply CHOST and PV to clang executables
+ # they're statically linked so we don't have to worry about the lib
+ if use clang; then
+ local clang_tools=( clang clang++ )
+ local i
+
+ # append ${PV} and symlink back
+ # TODO: use alternatives.eclass? does that make any sense?
+ # maybe with USE=-clang on :0 and USE=clang on older
+ for i in "${clang_tools[@]}"; do
+ mv "${ED%/}/usr/bin/${i}"{,-${PV}} || die
+ dosym "${i}"-${PV} /usr/bin/${i}
+ done
+
+ # now prepend ${CHOST} and let the multilib-build.eclass symlink it
+ if ! multilib_is_native_abi; then
+ # non-native? let's replace it with a simple wrapper
+ for i in "${clang_tools[@]}"; do
+ rm "${ED%/}/usr/bin/${i}-${PV}" || die
+ cat > "${T}"/wrapper.tmp <<-_EOF_
+ #!${EPREFIX}/bin/sh
+ exec "${i}-${PV}" $(get_abi_CFLAGS) "\${@}"
+ _EOF_
+ newbin "${T}"/wrapper.tmp "${i}-${PV}"
+ done
+ fi
+ fi
+
+ # Fix install_names on Darwin. The build system is too complicated
+ # to just fix this, so we correct it post-install
+ local lib= f= odylib= ndylib= libpv=${PV}
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ eval $(grep PACKAGE_VERSION= configure)
+ [[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION}
+ libpvminor=${libpv%.[0-9]*}
+ for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib LLVMHello.dylib clang/${libpv}/lib/darwin/libclang_rt.asan_{osx,iossim}_dynamic.dylib; do
+ # libEnhancedDisassembly is Darwin10 only, so non-fatal
+ # + omit clang libs if not enabled
+ [[ -f ${ED}/usr/lib/${lib} ]] || continue
+
+ ebegin "fixing install_name of $lib"
+ install_name_tool \
+ -id "${EPREFIX}"/usr/lib/${lib} \
+ "${ED}"/usr/lib/${lib}
+ eend $?
+ done
+ for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/lib*.dylib "${ED}"/usr/lib/clang/${libpv}/lib/darwin/*.dylib ; do
+ # omit clang libs if not enabled
+ [[ -f "${f}" ]] || continue
+
+ scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | \
+ while read odylib ; do
+ ndylib=
+ case ${odylib} in
+ */libclang.dylib)
+ ndylib="${EPREFIX}"/usr/lib/libclang.dylib
+ ;;
+ */libLLVM-${libpv}.dylib)
+ ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpv}.dylib
+ ;;
+ */libLLVM-${libpvminor}.dylib)
+ ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpvminor}.dylib
+ ;;
+ */libLTO.dylib)
+ ndylib="${EPREFIX}"/usr/lib/libLTO.dylib
+ ;;
+ esac
+ if [[ -n ${ndylib} ]] ; then
+ ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
+ install_name_tool \
+ -change "${odylib}" "${ndylib}" \
+ "${f}"
+ eend $?
+ fi
+ done
+ done
+ fi
+}
+
+multilib_src_install_all() {
+ insinto /usr/share/vim/vimfiles/syntax
+ doins utils/vim/*.vim
+
+ if use clang; then
+ cd tools/clang || die
+
+ if use static-analyzer ; then
+ dobin tools/scan-build/ccc-analyzer
+ dosym ccc-analyzer /usr/bin/c++-analyzer
+ dobin tools/scan-build/scan-build
+
+ insinto /usr/share/${PN}
+ doins tools/scan-build/scanview.css
+ doins tools/scan-build/sorttable.js
+ fi
+
+ python_inst() {
+ if use static-analyzer ; then
+ pushd tools/scan-view >/dev/null || die
+
+ python_doscript scan-view
+
+ touch __init__.py || die
+ python_moduleinto clang
+ python_domodule __init__.py Reporter.py Resources ScanView.py startfile.py
+
+ popd >/dev/null || die
+ fi
+
+ if use python ; then
+ pushd bindings/python/clang >/dev/null || die
+
+ python_moduleinto clang
+ python_domodule __init__.py cindex.py enumerations.py
+
+ popd >/dev/null || die
+ fi
+
+ # AddressSanitizer symbolizer (currently separate)
+ python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
+ }
+ python_foreach_impl python_inst
+ fi
+}
diff --git a/sys-devel/llvm/llvm-3.5.1.ebuild b/sys-devel/llvm/llvm-3.5.1.ebuild
new file mode 100644
index 000000000000..14a9e2b5c9d1
--- /dev/null
+++ b/sys-devel/llvm/llvm-3.5.1.ebuild
@@ -0,0 +1,530 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 pypy )
+
+inherit eutils flag-o-matic multibuild multilib \
+ multilib-minimal python-r1 toolchain-funcs pax-utils check-reqs prefix
+
+DESCRIPTION="Low Level Virtual Machine"
+HOMEPAGE="http://llvm.org/"
+SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz
+ clang? ( http://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.xz
+ http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.xz
+ http://llvm.org/releases/${PV}/clang-tools-extra-${PV}.src.tar.xz )
+ !doc? ( http://dev.gentoo.org/~voyageur/distfiles/${PN}-3.5.0-manpages.tar.bz2 )"
+
+LICENSE="UoI-NCSA"
+SLOT="0/3.5"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="clang debug doc gold libedit +libffi multitarget ncurses ocaml python
+ +static-analyzer test xml video_cards_radeon
+ kernel_Darwin kernel_FreeBSD"
+
+COMMON_DEPEND="
+ sys-libs/zlib:0=
+ clang? (
+ python? ( ${PYTHON_DEPS} )
+ static-analyzer? (
+ dev-lang/perl:*
+ ${PYTHON_DEPS}
+ )
+ xml? ( dev-libs/libxml2:2= )
+ )
+ gold? ( >=sys-devel/binutils-2.22:*[cxx] )
+ libedit? ( dev-libs/libedit:0=[${MULTILIB_USEDEP}] )
+ libffi? ( >=virtual/libffi-3.0.13-r1:0=[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.9-r3:5=[${MULTILIB_USEDEP}] )
+ ocaml? ( dev-lang/ocaml:0= )"
+# configparser-3.2 breaks the build (3.3 or none at all are fine)
+DEPEND="${COMMON_DEPEND}
+ app-arch/xz-utils
+ dev-lang/perl
+ >=sys-devel/make-3.81
+ >=sys-devel/flex-2.5.4
+ >=sys-devel/bison-1.875d
+ || ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1
+ ( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx )
+ )
+ || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-5.1 )
+ clang? ( xml? ( virtual/pkgconfig ) )
+ doc? ( dev-python/sphinx )
+ libffi? ( virtual/pkgconfig )
+ !!<dev-python/configparser-3.3.0.2
+ ${PYTHON_DEPS}"
+RDEPEND="${COMMON_DEPEND}
+ clang? ( !<=sys-devel/clang-${PV}-r99
+ !>=sys-devel/clang-9999 )
+ abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r2
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )"
+PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )"
+
+# pypy gives me around 1700 unresolved tests due to open file limit
+# being exceeded. probably GC does not close them fast enough.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+ test? ( || ( $(python_gen_useflags 'python*') ) )"
+
+S=${WORKDIR}/${P}.src
+
+# Some people actually override that in make.conf. That sucks since
+# we need to run install per-directory, and ninja can't do that...
+# so why did it call itself ninja in the first place?
+CMAKE_MAKEFILE_GENERATOR=emake
+
+pkg_pretend() {
+ # in megs
+ # !clang !debug !multitarget -O2 400
+ # !clang !debug multitarget -O2 550
+ # clang !debug !multitarget -O2 950
+ # clang !debug multitarget -O2 1200
+ # !clang debug multitarget -O2 5G
+ # clang !debug multitarget -O0 -g 12G
+ # clang debug multitarget -O2 16G
+ # clang debug multitarget -O0 -g 14G
+
+ local build_size=550
+ use clang && build_size=1200
+
+ if use debug; then
+ ewarn "USE=debug is known to increase the size of package considerably"
+ ewarn "and cause the tests to fail."
+ ewarn
+
+ (( build_size *= 14 ))
+ elif is-flagq '-g?(gdb)?([1-9])'; then
+ ewarn "The C++ compiler -g option is known to increase the size of the package"
+ ewarn "considerably. If you run out of space, please consider removing it."
+ ewarn
+
+ (( build_size *= 10 ))
+ fi
+
+ # Multiply by number of ABIs :).
+ local abis=( $(multilib_get_enabled_abis) )
+ (( build_size *= ${#abis[@]} ))
+
+ local CHECKREQS_DISK_BUILD=${build_size}M
+ check-reqs_pkg_pretend
+
+ if [[ ${MERGE_TYPE} != binary ]]; then
+ echo 'int main() {return 0;}' > "${T}"/test.cxx || die
+ ebegin "Trying to build a C++11 test program"
+ if ! $(tc-getCXX) -std=c++11 -o /dev/null "${T}"/test.cxx; then
+ eerror "LLVM-${PV} requires C++11-capable C++ compiler. Your current compiler"
+ eerror "does not seem to support -std=c++11 option. Please upgrade your compiler"
+ eerror "to gcc-4.7 or an equivalent version supporting C++11."
+ die "Currently active compiler does not support -std=c++11"
+ fi
+ eend ${?}
+ fi
+}
+
+pkg_setup() {
+ pkg_pretend
+}
+
+src_unpack() {
+ default
+
+ rm -f "${S}"/tools/clang "${S}"/projects/compiler-rt \
+ || die "symlinks removal failed"
+
+ if use clang; then
+ mv "${WORKDIR}"/cfe-${PV}.src "${S}"/tools/clang \
+ || die "clang source directory move failed"
+ mv "${WORKDIR}"/compiler-rt-${PV}.src "${S}"/projects/compiler-rt \
+ || die "compiler-rt source directory move failed"
+ mv "${WORKDIR}"/clang-tools-extra-${PV}.src "${S}"/tools/clang/tools/extra \
+ || die "clang-tools-extra source directory move failed"
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-3.2-nodoctargz.patch
+ epatch "${FILESDIR}"/${PN}-3.5-gcc-4.9.patch
+ epatch "${FILESDIR}"/${PN}-3.5-gentoo-install.patch
+ # Make ocaml warnings non-fatal, bug #537308
+ sed -e "/RUN/s/-warn-error A//" -i test/Bindings/Ocaml/*ml || die
+
+ if use clang; then
+ # Automatically select active system GCC's libraries, bugs #406163 and #417913
+ epatch "${FILESDIR}"/clang-3.5-gentoo-runtime-gcc-detection-v3.patch
+
+ epatch "${FILESDIR}"/clang-3.5-gentoo-install.patch
+ epatch "${FILESDIR}"/clang-3.4-darwin_prefix-include-paths.patch
+ eprefixify tools/clang/lib/Frontend/InitHeaderSearch.cpp
+ fi
+
+ if use prefix && use clang; then
+ sed -i -e "/^CFLAGS /s@-Werror@-I${EPREFIX}/usr/include@" \
+ projects/compiler-rt/make/platform/clang_*.mk || die
+ fi
+
+ local sub_files=(
+ Makefile.config.in
+ Makefile.rules
+ tools/llvm-config/llvm-config.cpp
+ )
+ use clang && sub_files+=(
+ tools/clang/lib/Driver/Tools.cpp
+ tools/clang/tools/scan-build/scan-build
+ )
+
+ # unfortunately ./configure won't listen to --mandir and the-like, so take
+ # care of this.
+ # note: we're setting the main libdir intentionally.
+ # where per-ABI is appropriate, we use $(GENTOO_LIBDIR) make.
+ einfo "Fixing install dirs"
+ sed -e "s,@libdir@,$(get_libdir),g" \
+ -e "s,@PF@,${PF},g" \
+ -e "s,@EPREFIX@,${EPREFIX},g" \
+ -i "${sub_files[@]}" \
+ || die "install paths sed failed"
+
+ if use clang; then
+ # constantly fails for a long time, likely due to our patches
+ rm tools/clang/test/Driver/cross-linux.c || die
+ fi
+
+ # User patches
+ epatch_user
+
+ python_setup
+}
+
+multilib_src_configure() {
+ # disable timestamps since they confuse ccache
+ local conf_flags=(
+ --disable-timestamps
+ --enable-keep-symbols
+ --enable-shared
+ --with-optimize-option=
+ $(tc-is-static-only && echo --disable-shared)
+ $(use_enable !debug optimized)
+ $(use_enable debug assertions)
+ $(use_enable debug expensive-checks)
+ $(use_enable libedit)
+ $(use_enable ncurses terminfo)
+ $(use_enable libffi)
+ )
+
+ # well, it's used only by clang executable c-index-test
+ if multilib_is_native_abi && use clang && use xml; then
+ conf_flags+=( XML2CONFIG="$(tc-getPKG_CONFIG) libxml-2.0" )
+ else
+ conf_flags+=( ac_cv_prog_XML2CONFIG="" )
+ fi
+
+ local targets bindings
+ if use multitarget; then
+ targets='all'
+ else
+ targets='host,cpp'
+ use video_cards_radeon && targets+=',r600'
+ fi
+ conf_flags+=( --enable-targets=${targets} )
+
+ if multilib_is_native_abi; then
+ use gold && conf_flags+=( --with-binutils-include="${EPREFIX}"/usr/include/ )
+ # extra commas don't hurt
+ use ocaml && bindings+=',ocaml'
+ fi
+
+ [[ ${bindings} ]] || bindings='none'
+ conf_flags+=( --enable-bindings=${bindings} )
+
+ if use libffi; then
+ local CPPFLAGS=${CPPFLAGS}
+ append-cppflags "$(pkg-config --cflags libffi)"
+ fi
+
+ # llvm prefers clang over gcc, so we may need to force that
+ tc-export CC CXX
+
+ ECONF_SOURCE=${S} \
+ econf "${conf_flags[@]}"
+}
+
+set_makeargs() {
+ MAKEARGS=(
+ VERBOSE=1
+ REQUIRES_RTTI=1
+ GENTOO_LIBDIR=$(get_libdir)
+ )
+
+ # for tests, we want it all! otherwise, we may use a little filtering...
+ # adding ONLY_TOOLS also disables unittest building...
+ if [[ ${EBUILD_PHASE_FUNC} != src_test ]]; then
+ local tools=( llvm-config )
+ use clang && tools+=( clang )
+
+ if multilib_is_native_abi; then
+ tools+=(
+ opt llvm-as llvm-dis llc llvm-ar llvm-nm llvm-link lli
+ llvm-extract llvm-mc llvm-bcanalyzer llvm-diff macho-dump
+ llvm-objdump llvm-readobj llvm-rtdyld llvm-dwarfdump llvm-cov
+ llvm-size llvm-stress llvm-mcmarkup llvm-profdata
+ llvm-symbolizer obj2yaml yaml2obj lto bugpoint
+ )
+
+ # the build system runs explicitly specified tools in parallel,
+ # so we need to split it into two runs
+ if [[ ${1} != -1 ]]; then
+ # those require lto
+ tools+=( llvm-lto )
+ use gold && tools+=( gold )
+
+ # those require clang :)
+ # we need to explicitly specify all its tools
+ # since we're passing BUILD_CLANG_ONLY
+ use clang && tools+=(
+ clang/tools/{clang-check,clang-format,extra}
+ )
+ fi
+ fi
+
+ MAKEARGS+=(
+ # filter tools + disable unittests implicitly
+ ONLY_TOOLS="${tools[*]}"
+
+ # this disables unittests & docs from clang
+ BUILD_CLANG_ONLY=YES
+ )
+ fi
+}
+
+multilib_src_compile() {
+ local MAKEARGS
+ set_makeargs -1
+ emake "${MAKEARGS[@]}"
+
+ if multilib_is_native_abi; then
+ set_makeargs
+ emake -C tools "${MAKEARGS[@]}"
+
+ if use doc; then
+ emake -C "${S}"/docs -f Makefile.sphinx man
+ use clang && emake -C "${S}"/tools/clang/docs/tools \
+ BUILD_FOR_WEBSITE=1 DST_MAN_DIR="${T}"/ man
+ emake -C "${S}"/docs -f Makefile.sphinx html
+ fi
+ fi
+
+ if use debug; then
+ pax-mark m Debug+Asserts+Checks/bin/llvm-rtdyld
+ pax-mark m Debug+Asserts+Checks/bin/lli
+ pax-mark m Debug+Asserts+Checks/bin/lli-child-target
+ else
+ pax-mark m Release/bin/llvm-rtdyld
+ pax-mark m Release/bin/lli
+ pax-mark m Release/bin/lli-child-target
+ fi
+}
+
+multilib_src_test() {
+ local MAKEARGS
+ set_makeargs
+
+ # build the remaining tools & unittests
+ emake "${MAKEARGS[@]}"
+
+ pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests
+ pax-mark m unittests/ExecutionEngine/MCJIT/Release/MCJITTests
+ pax-mark m unittests/Support/Release/SupportTests
+
+ # respect TMPDIR!
+ local -x LIT_PRESERVES_TMP=1
+ emake "${MAKEARGS[@]}" check
+ use clang && emake "${MAKEARGS[@]}" -C tools/clang test
+}
+
+src_install() {
+ local MULTILIB_CHOST_TOOLS=(
+ /usr/bin/llvm-config
+ )
+
+ local MULTILIB_WRAPPED_HEADERS=(
+ /usr/include/llvm/Config/config.h
+ /usr/include/llvm/Config/llvm-config.h
+ )
+
+ if use clang; then
+ # note: magic applied below
+ MULTILIB_CHOST_TOOLS+=(
+ /usr/bin/clang
+ /usr/bin/clang++
+ /usr/bin/clang-${PV}
+ /usr/bin/clang++-${PV}
+ )
+
+ MULTILIB_WRAPPED_HEADERS+=(
+ /usr/include/clang/Config/config.h
+ )
+ fi
+
+ multilib-minimal_src_install
+
+ # Remove unnecessary headers on FreeBSD, bug #417171
+ use kernel_FreeBSD && use clang && rm "${ED}"usr/lib/clang/${PV}/include/{std,float,iso,limits,tgmath,varargs}*.h
+}
+
+multilib_src_install() {
+ local MAKEARGS
+ set_makeargs
+
+ local root=${D}/_${ABI}
+
+ emake "${MAKEARGS[@]}" DESTDIR="${root}" install
+ multibuild_merge_root "${root}" "${D}"
+
+ if ! multilib_is_native_abi; then
+ # Backwards compat, will be happily removed someday.
+ dosym "${CHOST}"-llvm-config /usr/bin/llvm-config.${ABI}
+ else
+ # Install docs.
+ if use doc; then
+ doman "${S}"/docs/_build/man/*.1
+ use clang && doman "${T}"/clang.1
+ dohtml -r "${S}"/docs/_build/html/
+ else
+ if ! use clang; then
+ rm "${WORKDIR}"/${PN}-3.5.0-manpages/clang.1 || die
+ fi
+ doman "${WORKDIR}"/${PN}-3.5.0-manpages/*.1
+ fi
+
+ # Symlink the gold plugin.
+ if use gold; then
+ dodir /usr/${CHOST}/binutils-bin/lib/bfd-plugins
+ dosym ../../../../$(get_libdir)/LLVMgold.so \
+ /usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so
+ fi
+ fi
+
+ # apply CHOST and PV to clang executables
+ # they're statically linked so we don't have to worry about the lib
+ if use clang; then
+ local clang_tools=( clang clang++ )
+ local i
+
+ # append ${PV} and symlink back
+ # TODO: use alternatives.eclass? does that make any sense?
+ # maybe with USE=-clang on :0 and USE=clang on older
+ for i in "${clang_tools[@]}"; do
+ mv "${ED%/}/usr/bin/${i}"{,-${PV}} || die
+ dosym "${i}"-${PV} /usr/bin/${i}
+ done
+
+ # now prepend ${CHOST} and let the multilib-build.eclass symlink it
+ if ! multilib_is_native_abi; then
+ # non-native? let's replace it with a simple wrapper
+ for i in "${clang_tools[@]}"; do
+ rm "${ED%/}/usr/bin/${i}-${PV}" || die
+ cat > "${T}"/wrapper.tmp <<-_EOF_
+ #!${EPREFIX}/bin/sh
+ exec "${i}-${PV}" $(get_abi_CFLAGS) "\${@}"
+ _EOF_
+ newbin "${T}"/wrapper.tmp "${i}-${PV}"
+ done
+ fi
+ fi
+
+ # Fix install_names on Darwin. The build system is too complicated
+ # to just fix this, so we correct it post-install
+ local lib= f= odylib= ndylib= libpv=${PV}
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ eval $(grep PACKAGE_VERSION= configure)
+ [[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION}
+ libpvminor=${libpv%.[0-9]*}
+ for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib LLVMHello.dylib clang/${libpv}/lib/darwin/libclang_rt.asan_{osx,iossim}_dynamic.dylib; do
+ # libEnhancedDisassembly is Darwin10 only, so non-fatal
+ # + omit clang libs if not enabled
+ [[ -f ${ED}/usr/lib/${lib} ]] || continue
+
+ ebegin "fixing install_name of $lib"
+ install_name_tool \
+ -id "${EPREFIX}"/usr/lib/${lib} \
+ "${ED}"/usr/lib/${lib}
+ eend $?
+ done
+ for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/lib*.dylib "${ED}"/usr/lib/clang/${libpv}/lib/darwin/*.dylib ; do
+ # omit clang libs if not enabled
+ [[ -f "${f}" ]] || continue
+
+ scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | \
+ while read odylib ; do
+ ndylib=
+ case ${odylib} in
+ */libclang.dylib)
+ ndylib="${EPREFIX}"/usr/lib/libclang.dylib
+ ;;
+ */libLLVM-${libpv}.dylib)
+ ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpv}.dylib
+ ;;
+ */libLLVM-${libpvminor}.dylib)
+ ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpvminor}.dylib
+ ;;
+ */libLTO.dylib)
+ ndylib="${EPREFIX}"/usr/lib/libLTO.dylib
+ ;;
+ esac
+ if [[ -n ${ndylib} ]] ; then
+ ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
+ install_name_tool \
+ -change "${odylib}" "${ndylib}" \
+ "${f}"
+ eend $?
+ fi
+ done
+ done
+ fi
+}
+
+multilib_src_install_all() {
+ insinto /usr/share/vim/vimfiles/syntax
+ doins utils/vim/*.vim
+
+ if use clang; then
+ cd tools/clang || die
+
+ if use static-analyzer ; then
+ dobin tools/scan-build/ccc-analyzer
+ dosym ccc-analyzer /usr/bin/c++-analyzer
+ dobin tools/scan-build/scan-build
+
+ insinto /usr/share/${PN}
+ doins tools/scan-build/scanview.css
+ doins tools/scan-build/sorttable.js
+ fi
+
+ python_inst() {
+ if use static-analyzer ; then
+ pushd tools/scan-view >/dev/null || die
+
+ python_doscript scan-view
+
+ touch __init__.py || die
+ python_moduleinto clang
+ python_domodule __init__.py Reporter.py Resources ScanView.py startfile.py
+
+ popd >/dev/null || die
+ fi
+
+ if use python ; then
+ pushd bindings/python/clang >/dev/null || die
+
+ python_moduleinto clang
+ python_domodule __init__.py cindex.py enumerations.py
+
+ popd >/dev/null || die
+ fi
+
+ # AddressSanitizer symbolizer (currently separate)
+ python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
+ }
+ python_foreach_impl python_inst
+ fi
+}
diff --git a/sys-devel/llvm/llvm-3.5.2.ebuild b/sys-devel/llvm/llvm-3.5.2.ebuild
new file mode 100644
index 000000000000..4d3aa2ccce2f
--- /dev/null
+++ b/sys-devel/llvm/llvm-3.5.2.ebuild
@@ -0,0 +1,532 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 pypy )
+
+inherit eutils flag-o-matic multibuild multilib \
+ multilib-minimal python-r1 toolchain-funcs pax-utils check-reqs prefix
+
+DESCRIPTION="Low Level Virtual Machine"
+HOMEPAGE="http://llvm.org/"
+SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz
+ clang? ( http://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.xz
+ http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.xz
+ http://llvm.org/releases/${PV}/clang-tools-extra-${PV}.src.tar.xz )
+ !doc? ( http://dev.gentoo.org/~voyageur/distfiles/${PN}-3.5.0-manpages.tar.bz2 )"
+
+LICENSE="UoI-NCSA"
+SLOT="0/3.5"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="clang debug doc gold libedit +libffi multitarget ncurses ocaml python
+ +static-analyzer test xml video_cards_radeon
+ kernel_Darwin kernel_FreeBSD"
+
+COMMON_DEPEND="
+ sys-libs/zlib:0=
+ clang? (
+ python? ( ${PYTHON_DEPS} )
+ static-analyzer? (
+ dev-lang/perl:*
+ ${PYTHON_DEPS}
+ )
+ xml? ( dev-libs/libxml2:2= )
+ )
+ gold? ( >=sys-devel/binutils-2.22:*[cxx] )
+ libedit? ( dev-libs/libedit:0=[${MULTILIB_USEDEP}] )
+ libffi? ( >=virtual/libffi-3.0.13-r1:0=[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.9-r3:5=[${MULTILIB_USEDEP}] )
+ ocaml? ( dev-lang/ocaml:0= )"
+# configparser-3.2 breaks the build (3.3 or none at all are fine)
+DEPEND="${COMMON_DEPEND}
+ app-arch/xz-utils
+ dev-lang/perl
+ >=sys-devel/make-3.81
+ >=sys-devel/flex-2.5.4
+ >=sys-devel/bison-1.875d
+ || ( >=sys-devel/gcc-3.0 >=sys-devel/llvm-3.3
+ ( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx )
+ )
+ || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-5.1 )
+ kernel_Darwin? ( sys-libs/libcxx )
+ clang? ( xml? ( virtual/pkgconfig ) )
+ doc? ( dev-python/sphinx )
+ libffi? ( virtual/pkgconfig )
+ !!<dev-python/configparser-3.3.0.2
+ ${PYTHON_DEPS}"
+RDEPEND="${COMMON_DEPEND}
+ clang? ( !<=sys-devel/clang-${PV}-r99
+ !>=sys-devel/clang-9999 )
+ abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r2
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )"
+PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )"
+
+# pypy gives me around 1700 unresolved tests due to open file limit
+# being exceeded. probably GC does not close them fast enough.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+ test? ( || ( $(python_gen_useflags 'python*') ) )"
+
+S=${WORKDIR}/${P}.src
+
+# Some people actually override that in make.conf. That sucks since
+# we need to run install per-directory, and ninja can't do that...
+# so why did it call itself ninja in the first place?
+CMAKE_MAKEFILE_GENERATOR=emake
+
+pkg_pretend() {
+ # in megs
+ # !clang !debug !multitarget -O2 400
+ # !clang !debug multitarget -O2 550
+ # clang !debug !multitarget -O2 950
+ # clang !debug multitarget -O2 1200
+ # !clang debug multitarget -O2 5G
+ # clang !debug multitarget -O0 -g 12G
+ # clang debug multitarget -O2 16G
+ # clang debug multitarget -O0 -g 14G
+
+ local build_size=550
+ use clang && build_size=1200
+
+ if use debug; then
+ ewarn "USE=debug is known to increase the size of package considerably"
+ ewarn "and cause the tests to fail."
+ ewarn
+
+ (( build_size *= 14 ))
+ elif is-flagq '-g?(gdb)?([1-9])'; then
+ ewarn "The C++ compiler -g option is known to increase the size of the package"
+ ewarn "considerably. If you run out of space, please consider removing it."
+ ewarn
+
+ (( build_size *= 10 ))
+ fi
+
+ # Multiply by number of ABIs :).
+ local abis=( $(multilib_get_enabled_abis) )
+ (( build_size *= ${#abis[@]} ))
+
+ local CHECKREQS_DISK_BUILD=${build_size}M
+ check-reqs_pkg_pretend
+
+ if [[ ${MERGE_TYPE} != binary ]]; then
+ echo 'int main() {return 0;}' > "${T}"/test.cxx || die
+ ebegin "Trying to build a C++11 test program"
+ if ! $(tc-getCXX) -std=c++11 -o /dev/null "${T}"/test.cxx; then
+ eerror "LLVM-${PV} requires C++11-capable C++ compiler. Your current compiler"
+ eerror "does not seem to support -std=c++11 option. Please upgrade your compiler"
+ eerror "to gcc-4.7 or an equivalent version supporting C++11."
+ die "Currently active compiler does not support -std=c++11"
+ fi
+ eend ${?}
+ fi
+}
+
+pkg_setup() {
+ pkg_pretend
+}
+
+src_unpack() {
+ default
+
+ rm -f "${S}"/tools/clang "${S}"/projects/compiler-rt \
+ || die "symlinks removal failed"
+
+ if use clang; then
+ mv "${WORKDIR}"/cfe-${PV}.src "${S}"/tools/clang \
+ || die "clang source directory move failed"
+ mv "${WORKDIR}"/compiler-rt-${PV}.src "${S}"/projects/compiler-rt \
+ || die "compiler-rt source directory move failed"
+ mv "${WORKDIR}"/clang-tools-extra-${PV}.src "${S}"/tools/clang/tools/extra \
+ || die "clang-tools-extra source directory move failed"
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-3.2-nodoctargz.patch
+ epatch "${FILESDIR}"/${PN}-3.5-gcc-4.9.patch
+ epatch "${FILESDIR}"/${PN}-3.5-gentoo-install.patch
+ epatch "${FILESDIR}"/${P}-gcc-5.1.patch
+ # Make ocaml warnings non-fatal, bug #537308
+ sed -e "/RUN/s/-warn-error A//" -i test/Bindings/Ocaml/*ml || die
+
+ if use clang; then
+ # Automatically select active system GCC's libraries, bugs #406163 and #417913
+ epatch "${FILESDIR}"/clang-3.5-gentoo-runtime-gcc-detection-v3.patch
+
+ epatch "${FILESDIR}"/clang-3.5-gentoo-install.patch
+ epatch "${FILESDIR}"/clang-3.4-darwin_prefix-include-paths.patch
+ eprefixify tools/clang/lib/Frontend/InitHeaderSearch.cpp
+ fi
+
+ if use prefix && use clang; then
+ sed -i -e "/^CFLAGS /s@-Werror@-I${EPREFIX}/usr/include@" \
+ projects/compiler-rt/make/platform/clang_*.mk || die
+ fi
+
+ local sub_files=(
+ Makefile.config.in
+ Makefile.rules
+ tools/llvm-config/llvm-config.cpp
+ )
+ use clang && sub_files+=(
+ tools/clang/lib/Driver/Tools.cpp
+ tools/clang/tools/scan-build/scan-build
+ )
+
+ # unfortunately ./configure won't listen to --mandir and the-like, so take
+ # care of this.
+ # note: we're setting the main libdir intentionally.
+ # where per-ABI is appropriate, we use $(GENTOO_LIBDIR) make.
+ einfo "Fixing install dirs"
+ sed -e "s,@libdir@,$(get_libdir),g" \
+ -e "s,@PF@,${PF},g" \
+ -e "s,@EPREFIX@,${EPREFIX},g" \
+ -i "${sub_files[@]}" \
+ || die "install paths sed failed"
+
+ if use clang; then
+ # constantly fails for a long time, likely due to our patches
+ rm tools/clang/test/Driver/cross-linux.c || die
+ fi
+
+ # User patches
+ epatch_user
+
+ python_setup
+}
+
+multilib_src_configure() {
+ # disable timestamps since they confuse ccache
+ local conf_flags=(
+ --disable-timestamps
+ --enable-keep-symbols
+ --enable-shared
+ --with-optimize-option=
+ $(tc-is-static-only && echo --disable-shared)
+ $(use_enable !debug optimized)
+ $(use_enable debug assertions)
+ $(use_enable debug expensive-checks)
+ $(use_enable libedit)
+ $(use_enable ncurses terminfo)
+ $(use_enable libffi)
+ )
+
+ # well, it's used only by clang executable c-index-test
+ if multilib_is_native_abi && use clang && use xml; then
+ conf_flags+=( XML2CONFIG="$(tc-getPKG_CONFIG) libxml-2.0" )
+ else
+ conf_flags+=( ac_cv_prog_XML2CONFIG="" )
+ fi
+
+ local targets bindings
+ if use multitarget; then
+ targets='all'
+ else
+ targets='host,cpp'
+ use video_cards_radeon && targets+=',r600'
+ fi
+ conf_flags+=( --enable-targets=${targets} )
+
+ if multilib_is_native_abi; then
+ use gold && conf_flags+=( --with-binutils-include="${EPREFIX}"/usr/include/ )
+ # extra commas don't hurt
+ use ocaml && bindings+=',ocaml'
+ fi
+
+ [[ ${bindings} ]] || bindings='none'
+ conf_flags+=( --enable-bindings=${bindings} )
+
+ if use libffi; then
+ local CPPFLAGS=${CPPFLAGS}
+ append-cppflags "$(pkg-config --cflags libffi)"
+ fi
+
+ # llvm prefers clang over gcc, so we may need to force that
+ tc-export CC CXX
+
+ ECONF_SOURCE=${S} \
+ econf "${conf_flags[@]}"
+}
+
+set_makeargs() {
+ MAKEARGS=(
+ VERBOSE=1
+ REQUIRES_RTTI=1
+ GENTOO_LIBDIR=$(get_libdir)
+ )
+
+ # for tests, we want it all! otherwise, we may use a little filtering...
+ # adding ONLY_TOOLS also disables unittest building...
+ if [[ ${EBUILD_PHASE_FUNC} != src_test ]]; then
+ local tools=( llvm-config )
+ use clang && tools+=( clang )
+
+ if multilib_is_native_abi; then
+ tools+=(
+ opt llvm-as llvm-dis llc llvm-ar llvm-nm llvm-link lli
+ llvm-extract llvm-mc llvm-bcanalyzer llvm-diff macho-dump
+ llvm-objdump llvm-readobj llvm-rtdyld llvm-dwarfdump llvm-cov
+ llvm-size llvm-stress llvm-mcmarkup llvm-profdata
+ llvm-symbolizer obj2yaml yaml2obj lto bugpoint
+ )
+
+ # the build system runs explicitly specified tools in parallel,
+ # so we need to split it into two runs
+ if [[ ${1} != -1 ]]; then
+ # those require lto
+ tools+=( llvm-lto )
+ use gold && tools+=( gold )
+
+ # those require clang :)
+ # we need to explicitly specify all its tools
+ # since we're passing BUILD_CLANG_ONLY
+ use clang && tools+=(
+ clang/tools/{clang-check,clang-format,extra}
+ )
+ fi
+ fi
+
+ MAKEARGS+=(
+ # filter tools + disable unittests implicitly
+ ONLY_TOOLS="${tools[*]}"
+
+ # this disables unittests & docs from clang
+ BUILD_CLANG_ONLY=YES
+ )
+ fi
+}
+
+multilib_src_compile() {
+ local MAKEARGS
+ set_makeargs -1
+ emake "${MAKEARGS[@]}"
+
+ if multilib_is_native_abi; then
+ set_makeargs
+ emake -C tools "${MAKEARGS[@]}"
+
+ if use doc; then
+ emake -C "${S}"/docs -f Makefile.sphinx man
+ use clang && emake -C "${S}"/tools/clang/docs/tools \
+ BUILD_FOR_WEBSITE=1 DST_MAN_DIR="${T}"/ man
+ emake -C "${S}"/docs -f Makefile.sphinx html
+ fi
+ fi
+
+ if use debug; then
+ pax-mark m Debug+Asserts+Checks/bin/llvm-rtdyld
+ pax-mark m Debug+Asserts+Checks/bin/lli
+ pax-mark m Debug+Asserts+Checks/bin/lli-child-target
+ else
+ pax-mark m Release/bin/llvm-rtdyld
+ pax-mark m Release/bin/lli
+ pax-mark m Release/bin/lli-child-target
+ fi
+}
+
+multilib_src_test() {
+ local MAKEARGS
+ set_makeargs
+
+ # build the remaining tools & unittests
+ emake "${MAKEARGS[@]}"
+
+ pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests
+ pax-mark m unittests/ExecutionEngine/MCJIT/Release/MCJITTests
+ pax-mark m unittests/Support/Release/SupportTests
+
+ # respect TMPDIR!
+ local -x LIT_PRESERVES_TMP=1
+ emake "${MAKEARGS[@]}" check
+ use clang && emake "${MAKEARGS[@]}" -C tools/clang test
+}
+
+src_install() {
+ local MULTILIB_CHOST_TOOLS=(
+ /usr/bin/llvm-config
+ )
+
+ local MULTILIB_WRAPPED_HEADERS=(
+ /usr/include/llvm/Config/config.h
+ /usr/include/llvm/Config/llvm-config.h
+ )
+
+ if use clang; then
+ # note: magic applied below
+ MULTILIB_CHOST_TOOLS+=(
+ /usr/bin/clang
+ /usr/bin/clang++
+ /usr/bin/clang-${PV}
+ /usr/bin/clang++-${PV}
+ )
+
+ MULTILIB_WRAPPED_HEADERS+=(
+ /usr/include/clang/Config/config.h
+ )
+ fi
+
+ multilib-minimal_src_install
+
+ # Remove unnecessary headers on FreeBSD, bug #417171
+ use kernel_FreeBSD && use clang && rm "${ED}"usr/lib/clang/${PV}/include/{std,float,iso,limits,tgmath,varargs}*.h
+}
+
+multilib_src_install() {
+ local MAKEARGS
+ set_makeargs
+
+ local root=${D}/_${ABI}
+
+ emake "${MAKEARGS[@]}" DESTDIR="${root}" install
+ multibuild_merge_root "${root}" "${D}"
+
+ if ! multilib_is_native_abi; then
+ # Backwards compat, will be happily removed someday.
+ dosym "${CHOST}"-llvm-config /usr/bin/llvm-config.${ABI}
+ else
+ # Install docs.
+ if use doc; then
+ doman "${S}"/docs/_build/man/*.1
+ use clang && doman "${T}"/clang.1
+ dohtml -r "${S}"/docs/_build/html/
+ else
+ if ! use clang; then
+ rm "${WORKDIR}"/${PN}-3.5.0-manpages/clang.1 || die
+ fi
+ doman "${WORKDIR}"/${PN}-3.5.0-manpages/*.1
+ fi
+
+ # Symlink the gold plugin.
+ if use gold; then
+ dodir /usr/${CHOST}/binutils-bin/lib/bfd-plugins
+ dosym ../../../../$(get_libdir)/LLVMgold.so \
+ /usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so
+ fi
+ fi
+
+ # apply CHOST and PV to clang executables
+ # they're statically linked so we don't have to worry about the lib
+ if use clang; then
+ local clang_tools=( clang clang++ )
+ local i
+
+ # append ${PV} and symlink back
+ # TODO: use alternatives.eclass? does that make any sense?
+ # maybe with USE=-clang on :0 and USE=clang on older
+ for i in "${clang_tools[@]}"; do
+ mv "${ED%/}/usr/bin/${i}"{,-${PV}} || die
+ dosym "${i}"-${PV} /usr/bin/${i}
+ done
+
+ # now prepend ${CHOST} and let the multilib-build.eclass symlink it
+ if ! multilib_is_native_abi; then
+ # non-native? let's replace it with a simple wrapper
+ for i in "${clang_tools[@]}"; do
+ rm "${ED%/}/usr/bin/${i}-${PV}" || die
+ cat > "${T}"/wrapper.tmp <<-_EOF_
+ #!${EPREFIX}/bin/sh
+ exec "${i}-${PV}" $(get_abi_CFLAGS) "\${@}"
+ _EOF_
+ newbin "${T}"/wrapper.tmp "${i}-${PV}"
+ done
+ fi
+ fi
+
+ # Fix install_names on Darwin. The build system is too complicated
+ # to just fix this, so we correct it post-install
+ local lib= f= odylib= ndylib= libpv=${PV}
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ eval $(grep PACKAGE_VERSION= configure)
+ [[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION}
+ libpvminor=${libpv%.[0-9]*}
+ for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib LLVMHello.dylib clang/${libpv}/lib/darwin/libclang_rt.asan_{osx,iossim}_dynamic.dylib; do
+ # libEnhancedDisassembly is Darwin10 only, so non-fatal
+ # + omit clang libs if not enabled
+ [[ -f ${ED}/usr/lib/${lib} ]] || continue
+
+ ebegin "fixing install_name of $lib"
+ install_name_tool \
+ -id "${EPREFIX}"/usr/lib/${lib} \
+ "${ED}"/usr/lib/${lib}
+ eend $?
+ done
+ for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/lib*.dylib "${ED}"/usr/lib/clang/${libpv}/lib/darwin/*.dylib ; do
+ # omit clang libs if not enabled
+ [[ -f "${f}" ]] || continue
+
+ scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | \
+ while read odylib ; do
+ ndylib=
+ case ${odylib} in
+ */libclang.dylib)
+ ndylib="${EPREFIX}"/usr/lib/libclang.dylib
+ ;;
+ */libLLVM-${libpv}.dylib)
+ ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpv}.dylib
+ ;;
+ */libLLVM-${libpvminor}.dylib)
+ ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpvminor}.dylib
+ ;;
+ */libLTO.dylib)
+ ndylib="${EPREFIX}"/usr/lib/libLTO.dylib
+ ;;
+ esac
+ if [[ -n ${ndylib} ]] ; then
+ ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
+ install_name_tool \
+ -change "${odylib}" "${ndylib}" \
+ "${f}"
+ eend $?
+ fi
+ done
+ done
+ fi
+}
+
+multilib_src_install_all() {
+ insinto /usr/share/vim/vimfiles/syntax
+ doins utils/vim/*.vim
+
+ if use clang; then
+ cd tools/clang || die
+
+ if use static-analyzer ; then
+ dobin tools/scan-build/ccc-analyzer
+ dosym ccc-analyzer /usr/bin/c++-analyzer
+ dobin tools/scan-build/scan-build
+
+ insinto /usr/share/${PN}
+ doins tools/scan-build/scanview.css
+ doins tools/scan-build/sorttable.js
+ fi
+
+ python_inst() {
+ if use static-analyzer ; then
+ pushd tools/scan-view >/dev/null || die
+
+ python_doscript scan-view
+
+ touch __init__.py || die
+ python_moduleinto clang
+ python_domodule __init__.py Reporter.py Resources ScanView.py startfile.py
+
+ popd >/dev/null || die
+ fi
+
+ if use python ; then
+ pushd bindings/python/clang >/dev/null || die
+
+ python_moduleinto clang
+ python_domodule __init__.py cindex.py enumerations.py
+
+ popd >/dev/null || die
+ fi
+
+ # AddressSanitizer symbolizer (currently separate)
+ python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
+ }
+ python_foreach_impl python_inst
+ fi
+}
diff --git a/sys-devel/llvm/llvm-3.6.0.ebuild b/sys-devel/llvm/llvm-3.6.0.ebuild
new file mode 100644
index 000000000000..830367ca280a
--- /dev/null
+++ b/sys-devel/llvm/llvm-3.6.0.ebuild
@@ -0,0 +1,534 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 pypy )
+
+inherit eutils flag-o-matic multibuild multilib \
+ multilib-minimal python-r1 toolchain-funcs pax-utils check-reqs prefix
+
+DESCRIPTION="Low Level Virtual Machine"
+HOMEPAGE="http://llvm.org/"
+SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz
+ clang? ( http://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.xz
+ http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.xz
+ http://llvm.org/releases/${PV}/clang-tools-extra-${PV}.src.tar.xz )
+ !doc? ( http://dev.gentoo.org/~voyageur/distfiles/${P}-manpages.tar.bz2 )"
+
+LICENSE="UoI-NCSA"
+SLOT="0/3.6"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="clang debug doc gold libedit +libffi multitarget ncurses ocaml python
+ +static-analyzer test xml video_cards_radeon
+ kernel_Darwin kernel_FreeBSD"
+
+COMMON_DEPEND="
+ sys-libs/zlib:0=
+ clang? (
+ python? ( ${PYTHON_DEPS} )
+ static-analyzer? (
+ dev-lang/perl:*
+ ${PYTHON_DEPS}
+ )
+ xml? ( dev-libs/libxml2:2= )
+ )
+ gold? ( >=sys-devel/binutils-2.22:*[cxx] )
+ libedit? ( dev-libs/libedit:0=[${MULTILIB_USEDEP}] )
+ libffi? ( >=virtual/libffi-3.0.13-r1:0=[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.9-r3:5=[${MULTILIB_USEDEP}] )
+ ocaml? (
+ dev-lang/ocaml:0=
+ dev-ml/findlib
+ dev-ml/ocaml-ctypes )"
+# configparser-3.2 breaks the build (3.3 or none at all are fine)
+DEPEND="${COMMON_DEPEND}
+ app-arch/xz-utils
+ dev-lang/perl
+ >=sys-devel/make-3.81
+ >=sys-devel/flex-2.5.4
+ >=sys-devel/bison-1.875d
+ || ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1
+ ( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx )
+ )
+ || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-5.1 )
+ clang? ( xml? ( virtual/pkgconfig ) )
+ doc? ( dev-python/sphinx )
+ libffi? ( virtual/pkgconfig )
+ !!<dev-python/configparser-3.3.0.2
+ ocaml? ( test? ( dev-ml/ounit ) )
+ ${PYTHON_DEPS}"
+RDEPEND="${COMMON_DEPEND}
+ clang? ( !<=sys-devel/clang-${PV}-r99
+ !>=sys-devel/clang-9999 )
+ abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r2
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )"
+PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )"
+
+# pypy gives me around 1700 unresolved tests due to open file limit
+# being exceeded. probably GC does not close them fast enough.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+ test? ( || ( $(python_gen_useflags 'python*') ) )"
+
+S=${WORKDIR}/${P/_}.src
+
+# Some people actually override that in make.conf. That sucks since
+# we need to run install per-directory, and ninja can't do that...
+# so why did it call itself ninja in the first place?
+CMAKE_MAKEFILE_GENERATOR=emake
+
+pkg_pretend() {
+ # in megs
+ # !clang !debug !multitarget -O2 400
+ # !clang !debug multitarget -O2 550
+ # clang !debug !multitarget -O2 950
+ # clang !debug multitarget -O2 1200
+ # !clang debug multitarget -O2 5G
+ # clang !debug multitarget -O0 -g 12G
+ # clang debug multitarget -O2 16G
+ # clang debug multitarget -O0 -g 14G
+
+ local build_size=550
+ use clang && build_size=1200
+
+ if use debug; then
+ ewarn "USE=debug is known to increase the size of package considerably"
+ ewarn "and cause the tests to fail."
+ ewarn
+
+ (( build_size *= 14 ))
+ elif is-flagq '-g?(gdb)?([1-9])'; then
+ ewarn "The C++ compiler -g option is known to increase the size of the package"
+ ewarn "considerably. If you run out of space, please consider removing it."
+ ewarn
+
+ (( build_size *= 10 ))
+ fi
+
+ # Multiply by number of ABIs :).
+ local abis=( $(multilib_get_enabled_abis) )
+ (( build_size *= ${#abis[@]} ))
+
+ local CHECKREQS_DISK_BUILD=${build_size}M
+ check-reqs_pkg_pretend
+
+ if [[ ${MERGE_TYPE} != binary ]]; then
+ echo 'int main() {return 0;}' > "${T}"/test.cxx || die
+ ebegin "Trying to build a C++11 test program"
+ if ! $(tc-getCXX) -std=c++11 -o /dev/null "${T}"/test.cxx; then
+ eerror "LLVM-${PV} requires C++11-capable C++ compiler. Your current compiler"
+ eerror "does not seem to support -std=c++11 option. Please upgrade your compiler"
+ eerror "to gcc-4.7 or an equivalent version supporting C++11."
+ die "Currently active compiler does not support -std=c++11"
+ fi
+ eend ${?}
+ fi
+}
+
+pkg_setup() {
+ pkg_pretend
+}
+
+src_unpack() {
+ default
+
+ rm -f "${S}"/tools/clang "${S}"/projects/compiler-rt \
+ || die "symlinks removal failed"
+
+ if use clang; then
+ mv "${WORKDIR}"/cfe-${PV/_}.src "${S}"/tools/clang \
+ || die "clang source directory move failed"
+ mv "${WORKDIR}"/compiler-rt-${PV/_}.src "${S}"/projects/compiler-rt \
+ || die "compiler-rt source directory move failed"
+ mv "${WORKDIR}"/clang-tools-extra-${PV/_}.src "${S}"/tools/clang/tools/extra \
+ || die "clang-tools-extra source directory move failed"
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-3.2-nodoctargz.patch
+ epatch "${FILESDIR}"/${PN}-3.5-gcc-4.9.patch
+ epatch "${FILESDIR}"/${PN}-3.6-gentoo-install.patch
+ # Make ocaml warnings non-fatal, bug #537308
+ sed -e "/RUN/s/-warn-error A//" -i test/Bindings/OCaml/*ml || die
+
+ if use clang; then
+ # Automatically select active system GCC's libraries, bugs #406163 and #417913
+ epatch "${FILESDIR}"/clang-3.5-gentoo-runtime-gcc-detection-v3.patch
+
+ epatch "${FILESDIR}"/clang-3.6-gentoo-install.patch
+ epatch "${FILESDIR}"/clang-3.4-darwin_prefix-include-paths.patch
+ eprefixify tools/clang/lib/Frontend/InitHeaderSearch.cpp
+ fi
+
+ if use prefix && use clang; then
+ sed -i -e "/^CFLAGS /s@-Werror@-I${EPREFIX}/usr/include@" \
+ projects/compiler-rt/make/platform/clang_*.mk || die
+ fi
+
+ local sub_files=(
+ Makefile.config.in
+ Makefile.rules
+ tools/llvm-config/llvm-config.cpp
+ )
+ use clang && sub_files+=(
+ tools/clang/lib/Driver/Tools.cpp
+ tools/clang/tools/scan-build/scan-build
+ )
+
+ # unfortunately ./configure won't listen to --mandir and the-like, so take
+ # care of this.
+ # note: we're setting the main libdir intentionally.
+ # where per-ABI is appropriate, we use $(GENTOO_LIBDIR) make.
+ einfo "Fixing install dirs"
+ sed -e "s,@libdir@,$(get_libdir),g" \
+ -e "s,@PF@,${PF},g" \
+ -e "s,@EPREFIX@,${EPREFIX},g" \
+ -i "${sub_files[@]}" \
+ || die "install paths sed failed"
+
+ if use clang; then
+ # constantly fails for a long time, likely due to our patches
+ rm tools/clang/test/Driver/cross-linux.c || die
+ fi
+
+ # User patches
+ epatch_user
+
+ python_setup
+}
+
+multilib_src_configure() {
+ # disable timestamps since they confuse ccache
+ local conf_flags=(
+ --disable-timestamps
+ --enable-keep-symbols
+ --enable-shared
+ --with-optimize-option=
+ $(tc-is-static-only && echo --disable-shared)
+ $(use_enable !debug optimized)
+ $(use_enable debug assertions)
+ $(use_enable debug expensive-checks)
+ $(use_enable libedit)
+ $(use_enable ncurses terminfo)
+ $(use_enable libffi)
+ )
+
+ # well, it's used only by clang executable c-index-test
+ if multilib_is_native_abi && use clang && use xml; then
+ conf_flags+=( XML2CONFIG="$(tc-getPKG_CONFIG) libxml-2.0" )
+ else
+ conf_flags+=( ac_cv_prog_XML2CONFIG="" )
+ fi
+
+ local targets bindings
+ if use multitarget; then
+ targets='all'
+ else
+ targets='host,cpp'
+ use video_cards_radeon && targets+=',r600'
+ fi
+ conf_flags+=( --enable-targets=${targets} )
+
+ if multilib_is_native_abi; then
+ use gold && conf_flags+=( --with-binutils-include="${EPREFIX}"/usr/include/ )
+ # extra commas don't hurt
+ use ocaml && bindings+=',ocaml'
+ fi
+
+ [[ ${bindings} ]] || bindings='none'
+ conf_flags+=( --enable-bindings=${bindings} )
+
+ if use libffi; then
+ local CPPFLAGS=${CPPFLAGS}
+ append-cppflags "$(pkg-config --cflags libffi)"
+ fi
+
+ # llvm prefers clang over gcc, so we may need to force that
+ tc-export CC CXX
+
+ ECONF_SOURCE=${S} \
+ econf "${conf_flags[@]}"
+}
+
+set_makeargs() {
+ MAKEARGS=(
+ VERBOSE=1
+ REQUIRES_RTTI=1
+ GENTOO_LIBDIR=$(get_libdir)
+ )
+
+ # for tests, we want it all! otherwise, we may use a little filtering...
+ # adding ONLY_TOOLS also disables unittest building...
+ if [[ ${EBUILD_PHASE_FUNC} != src_test ]]; then
+ local tools=( llvm-config )
+ use clang && tools+=( clang )
+
+ if multilib_is_native_abi; then
+ tools+=(
+ opt llvm-as llvm-dis llc llvm-ar llvm-nm llvm-link lli
+ llvm-extract llvm-mc llvm-bcanalyzer llvm-diff macho-dump
+ llvm-objdump llvm-readobj llvm-rtdyld llvm-dwarfdump llvm-cov
+ llvm-size llvm-stress llvm-mcmarkup llvm-profdata
+ llvm-symbolizer obj2yaml yaml2obj lto bugpoint
+ )
+
+ # the build system runs explicitly specified tools in parallel,
+ # so we need to split it into two runs
+ if [[ ${1} != -1 ]]; then
+ # those require lto
+ tools+=( llvm-lto )
+ use gold && tools+=( gold )
+
+ # those require clang :)
+ # we need to explicitly specify all its tools
+ # since we're passing BUILD_CLANG_ONLY
+ use clang && tools+=(
+ clang/tools/{clang-check,clang-format,extra}
+ )
+ fi
+ fi
+
+ MAKEARGS+=(
+ # filter tools + disable unittests implicitly
+ ONLY_TOOLS="${tools[*]}"
+
+ # this disables unittests & docs from clang
+ BUILD_CLANG_ONLY=YES
+ )
+ fi
+}
+
+multilib_src_compile() {
+ local MAKEARGS
+ set_makeargs -1
+ emake "${MAKEARGS[@]}"
+
+ if multilib_is_native_abi; then
+ set_makeargs
+ emake -C tools "${MAKEARGS[@]}"
+
+ if use doc; then
+ emake -C "${S}"/docs -f Makefile.sphinx man
+ use clang && emake -C "${S}"/tools/clang/docs/tools \
+ BUILD_FOR_WEBSITE=1 DST_MAN_DIR="${T}"/ man
+ emake -C "${S}"/docs -f Makefile.sphinx html
+ fi
+ fi
+
+ if use debug; then
+ pax-mark m Debug+Asserts+Checks/bin/llvm-rtdyld
+ pax-mark m Debug+Asserts+Checks/bin/lli
+ pax-mark m Debug+Asserts+Checks/bin/lli-child-target
+ else
+ pax-mark m Release/bin/llvm-rtdyld
+ pax-mark m Release/bin/lli
+ pax-mark m Release/bin/lli-child-target
+ fi
+}
+
+multilib_src_test() {
+ local MAKEARGS
+ set_makeargs
+
+ # build the remaining tools & unittests
+ emake "${MAKEARGS[@]}"
+
+ pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests
+ pax-mark m unittests/ExecutionEngine/MCJIT/Release/MCJITTests
+ pax-mark m unittests/Support/Release/SupportTests
+
+ # respect TMPDIR!
+ local -x LIT_PRESERVES_TMP=1
+ emake "${MAKEARGS[@]}" check
+ use clang && emake "${MAKEARGS[@]}" -C tools/clang test
+}
+
+src_install() {
+ local MULTILIB_CHOST_TOOLS=(
+ /usr/bin/llvm-config
+ )
+
+ local MULTILIB_WRAPPED_HEADERS=(
+ /usr/include/llvm/Config/config.h
+ /usr/include/llvm/Config/llvm-config.h
+ )
+
+ if use clang; then
+ # note: magic applied below
+ MULTILIB_CHOST_TOOLS+=(
+ /usr/bin/clang
+ /usr/bin/clang++
+ /usr/bin/clang-${PV}
+ /usr/bin/clang++-${PV}
+ )
+
+ MULTILIB_WRAPPED_HEADERS+=(
+ /usr/include/clang/Config/config.h
+ )
+ fi
+
+ multilib-minimal_src_install
+
+ # Remove unnecessary headers on FreeBSD, bug #417171
+ use kernel_FreeBSD && use clang && rm "${ED}"usr/lib/clang/${PV}/include/{std,float,iso,limits,tgmath,varargs}*.h
+}
+
+multilib_src_install() {
+ local MAKEARGS
+ set_makeargs
+
+ local root=${D}/_${ABI}
+
+ emake "${MAKEARGS[@]}" DESTDIR="${root}" install
+ multibuild_merge_root "${root}" "${D}"
+
+ if ! multilib_is_native_abi; then
+ # Backwards compat, will be happily removed someday.
+ dosym "${CHOST}"-llvm-config /usr/bin/llvm-config.${ABI}
+ else
+ # Install docs.
+ if use doc; then
+ doman "${S}"/docs/_build/man/*.1
+ use clang && doman "${T}"/clang.1
+ dohtml -r "${S}"/docs/_build/html/
+ else
+ if ! use clang; then
+ rm "${WORKDIR}"/${P}-manpages/clang.1 || die
+ fi
+ doman "${WORKDIR}"/${P}-manpages/*.1
+ fi
+
+ # Symlink the gold plugin.
+ if use gold; then
+ dodir /usr/${CHOST}/binutils-bin/lib/bfd-plugins
+ dosym ../../../../$(get_libdir)/LLVMgold.so \
+ /usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so
+ fi
+ fi
+
+ # apply CHOST and PV to clang executables
+ # they're statically linked so we don't have to worry about the lib
+ if use clang; then
+ local clang_tools=( clang clang++ )
+ local i
+
+ # append ${PV} and symlink back
+ # TODO: use alternatives.eclass? does that make any sense?
+ # maybe with USE=-clang on :0 and USE=clang on older
+ for i in "${clang_tools[@]}"; do
+ mv "${ED%/}/usr/bin/${i}"{,-${PV}} || die
+ dosym "${i}"-${PV} /usr/bin/${i}
+ done
+
+ # now prepend ${CHOST} and let the multilib-build.eclass symlink it
+ if ! multilib_is_native_abi; then
+ # non-native? let's replace it with a simple wrapper
+ for i in "${clang_tools[@]}"; do
+ rm "${ED%/}/usr/bin/${i}-${PV}" || die
+ cat > "${T}"/wrapper.tmp <<-_EOF_
+ #!${EPREFIX}/bin/sh
+ exec "${i}-${PV}" $(get_abi_CFLAGS) "\${@}"
+ _EOF_
+ newbin "${T}"/wrapper.tmp "${i}-${PV}"
+ done
+ fi
+ fi
+
+ # Fix install_names on Darwin. The build system is too complicated
+ # to just fix this, so we correct it post-install
+ local lib= f= odylib= ndylib= libpv=${PV}
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ eval $(grep PACKAGE_VERSION= configure)
+ [[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION}
+ libpvminor=${libpv%.[0-9]*}
+ for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib LLVMHello.dylib clang/${libpv}/lib/darwin/libclang_rt.asan_{osx,iossim}_dynamic.dylib; do
+ # libEnhancedDisassembly is Darwin10 only, so non-fatal
+ # + omit clang libs if not enabled
+ [[ -f ${ED}/usr/lib/${lib} ]] || continue
+
+ ebegin "fixing install_name of $lib"
+ install_name_tool \
+ -id "${EPREFIX}"/usr/lib/${lib} \
+ "${ED}"/usr/lib/${lib}
+ eend $?
+ done
+ for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/lib*.dylib "${ED}"/usr/lib/clang/${libpv}/lib/darwin/*.dylib ; do
+ # omit clang libs if not enabled
+ [[ -f "${f}" ]] || continue
+
+ scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | \
+ while read odylib ; do
+ ndylib=
+ case ${odylib} in
+ */libclang.dylib)
+ ndylib="${EPREFIX}"/usr/lib/libclang.dylib
+ ;;
+ */libLLVM-${libpv}.dylib)
+ ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpv}.dylib
+ ;;
+ */libLLVM-${libpvminor}.dylib)
+ ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpvminor}.dylib
+ ;;
+ */libLTO.dylib)
+ ndylib="${EPREFIX}"/usr/lib/libLTO.dylib
+ ;;
+ esac
+ if [[ -n ${ndylib} ]] ; then
+ ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
+ install_name_tool \
+ -change "${odylib}" "${ndylib}" \
+ "${f}"
+ eend $?
+ fi
+ done
+ done
+ fi
+}
+
+multilib_src_install_all() {
+ insinto /usr/share/vim/vimfiles/syntax
+ doins utils/vim/*.vim
+
+ if use clang; then
+ cd tools/clang || die
+
+ if use static-analyzer ; then
+ dobin tools/scan-build/ccc-analyzer
+ dosym ccc-analyzer /usr/bin/c++-analyzer
+ dobin tools/scan-build/scan-build
+
+ insinto /usr/share/${PN}
+ doins tools/scan-build/scanview.css
+ doins tools/scan-build/sorttable.js
+ fi
+
+ python_inst() {
+ if use static-analyzer ; then
+ pushd tools/scan-view >/dev/null || die
+
+ python_doscript scan-view
+
+ touch __init__.py || die
+ python_moduleinto clang
+ python_domodule __init__.py Reporter.py Resources ScanView.py startfile.py
+
+ popd >/dev/null || die
+ fi
+
+ if use python ; then
+ pushd bindings/python/clang >/dev/null || die
+
+ python_moduleinto clang
+ python_domodule __init__.py cindex.py enumerations.py
+
+ popd >/dev/null || die
+ fi
+
+ # AddressSanitizer symbolizer (currently separate)
+ python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
+ }
+ python_foreach_impl python_inst
+ fi
+}
diff --git a/sys-devel/llvm/llvm-3.6.1.ebuild b/sys-devel/llvm/llvm-3.6.1.ebuild
new file mode 100644
index 000000000000..73a32beb863f
--- /dev/null
+++ b/sys-devel/llvm/llvm-3.6.1.ebuild
@@ -0,0 +1,541 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 pypy )
+
+inherit eutils flag-o-matic multibuild multilib \
+ multilib-minimal python-r1 toolchain-funcs pax-utils check-reqs prefix
+
+DESCRIPTION="Low Level Virtual Machine"
+HOMEPAGE="http://llvm.org/"
+SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz
+ clang? ( http://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.xz
+ http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.xz
+ http://llvm.org/releases/${PV}/clang-tools-extra-${PV}.src.tar.xz )
+ !doc? ( http://dev.gentoo.org/~voyageur/distfiles/${P}-manpages.tar.bz2 )"
+
+LICENSE="UoI-NCSA"
+SLOT="0/3.6"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="clang debug doc gold libedit +libffi multitarget ncurses ocaml python
+ +static-analyzer test xml video_cards_radeon
+ kernel_Darwin kernel_FreeBSD"
+
+COMMON_DEPEND="
+ sys-libs/zlib:0=
+ clang? (
+ python? ( ${PYTHON_DEPS} )
+ static-analyzer? (
+ dev-lang/perl:*
+ ${PYTHON_DEPS}
+ )
+ xml? ( dev-libs/libxml2:2= )
+ )
+ gold? ( >=sys-devel/binutils-2.22:*[cxx] )
+ libedit? ( dev-libs/libedit:0=[${MULTILIB_USEDEP}] )
+ libffi? ( >=virtual/libffi-3.0.13-r1:0=[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.9-r3:5=[${MULTILIB_USEDEP}] )
+ ocaml? (
+ dev-lang/ocaml:0=
+ dev-ml/findlib
+ dev-ml/ocaml-ctypes )"
+# configparser-3.2 breaks the build (3.3 or none at all are fine)
+DEPEND="${COMMON_DEPEND}
+ app-arch/xz-utils
+ dev-lang/perl
+ >=sys-devel/make-3.81
+ >=sys-devel/flex-2.5.4
+ >=sys-devel/bison-1.875d
+ || ( >=sys-devel/gcc-3.0 >=sys-devel/llvm-3.5
+ ( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx )
+ )
+ || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-5.1 )
+ kernel_Darwin? ( sys-libs/libcxx )
+ clang? ( xml? ( virtual/pkgconfig ) )
+ doc? ( dev-python/sphinx )
+ libffi? ( virtual/pkgconfig )
+ !!<dev-python/configparser-3.3.0.2
+ ocaml? ( test? ( dev-ml/ounit ) )
+ ${PYTHON_DEPS}"
+RDEPEND="${COMMON_DEPEND}
+ clang? ( !<=sys-devel/clang-${PV}-r99
+ !>=sys-devel/clang-9999 )
+ abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r2
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )"
+PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )"
+
+# pypy gives me around 1700 unresolved tests due to open file limit
+# being exceeded. probably GC does not close them fast enough.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+ test? ( || ( $(python_gen_useflags 'python*') ) )"
+
+S=${WORKDIR}/${P/_}.src
+
+# Some people actually override that in make.conf. That sucks since
+# we need to run install per-directory, and ninja can't do that...
+# so why did it call itself ninja in the first place?
+CMAKE_MAKEFILE_GENERATOR=emake
+
+pkg_pretend() {
+ # in megs
+ # !clang !debug !multitarget -O2 400
+ # !clang !debug multitarget -O2 550
+ # clang !debug !multitarget -O2 950
+ # clang !debug multitarget -O2 1200
+ # !clang debug multitarget -O2 5G
+ # clang !debug multitarget -O0 -g 12G
+ # clang debug multitarget -O2 16G
+ # clang debug multitarget -O0 -g 14G
+
+ local build_size=550
+ use clang && build_size=1200
+
+ if use debug; then
+ ewarn "USE=debug is known to increase the size of package considerably"
+ ewarn "and cause the tests to fail."
+ ewarn
+
+ (( build_size *= 14 ))
+ elif is-flagq '-g?(gdb)?([1-9])'; then
+ ewarn "The C++ compiler -g option is known to increase the size of the package"
+ ewarn "considerably. If you run out of space, please consider removing it."
+ ewarn
+
+ (( build_size *= 10 ))
+ fi
+
+ # Multiply by number of ABIs :).
+ local abis=( $(multilib_get_enabled_abis) )
+ (( build_size *= ${#abis[@]} ))
+
+ local CHECKREQS_DISK_BUILD=${build_size}M
+ check-reqs_pkg_pretend
+
+ if [[ ${MERGE_TYPE} != binary ]]; then
+ echo 'int main() {return 0;}' > "${T}"/test.cxx || die
+ ebegin "Trying to build a C++11 test program"
+ if ! $(tc-getCXX) -std=c++11 -o /dev/null "${T}"/test.cxx; then
+ eerror "LLVM-${PV} requires C++11-capable C++ compiler. Your current compiler"
+ eerror "does not seem to support -std=c++11 option. Please upgrade your compiler"
+ eerror "to gcc-4.7 or an equivalent version supporting C++11."
+ die "Currently active compiler does not support -std=c++11"
+ fi
+ eend ${?}
+ fi
+}
+
+pkg_setup() {
+ pkg_pretend
+}
+
+src_unpack() {
+ default
+
+ rm -f "${S}"/tools/clang "${S}"/projects/compiler-rt \
+ || die "symlinks removal failed"
+
+ if use clang; then
+ mv "${WORKDIR}"/cfe-${PV/_}.src "${S}"/tools/clang \
+ || die "clang source directory move failed"
+ mv "${WORKDIR}"/compiler-rt-${PV/_}.src "${S}"/projects/compiler-rt \
+ || die "compiler-rt source directory move failed"
+ mv "${WORKDIR}"/clang-tools-extra-${PV/_}.src "${S}"/tools/clang/tools/extra \
+ || die "clang-tools-extra source directory move failed"
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-3.2-nodoctargz.patch
+ epatch "${FILESDIR}"/${PN}-3.5-gcc-4.9.patch
+ epatch "${FILESDIR}"/${PN}-3.6-gentoo-install.patch
+ epatch "${FILESDIR}"/${PN}-3.6.0-ocaml-ctypes-0.4.0.patch
+ # Make ocaml warnings non-fatal, bug #537308
+ sed -e "/RUN/s/-warn-error A//" -i test/Bindings/OCaml/*ml || die
+
+ if use clang; then
+ # Automatically select active system GCC's libraries, bugs #406163 and #417913
+ epatch "${FILESDIR}"/clang-3.5-gentoo-runtime-gcc-detection-v3.patch
+
+ epatch "${FILESDIR}"/clang-3.6-gentoo-install.patch
+ epatch "${FILESDIR}"/clang-3.4-darwin_prefix-include-paths.patch
+ eprefixify tools/clang/lib/Frontend/InitHeaderSearch.cpp
+
+ # Fix build fails with using gcc-4.9 on Gentoo/FreeBSD, bug #548444
+ epatch "${FILESDIR}"/clang-3.6-fbsd-gcc49.patch
+ fi
+
+ if use prefix && use clang; then
+ sed -i -e "/^CFLAGS /s@-Werror@-I${EPREFIX}/usr/include@" \
+ projects/compiler-rt/make/platform/clang_*.mk || die
+ fi
+
+ local sub_files=(
+ Makefile.config.in
+ Makefile.rules
+ tools/llvm-config/llvm-config.cpp
+ )
+ use clang && sub_files+=(
+ tools/clang/lib/Driver/Tools.cpp
+ tools/clang/tools/scan-build/scan-build
+ )
+
+ # unfortunately ./configure won't listen to --mandir and the-like, so take
+ # care of this.
+ # note: we're setting the main libdir intentionally.
+ # where per-ABI is appropriate, we use $(GENTOO_LIBDIR) make.
+ einfo "Fixing install dirs"
+ sed -e "s,@libdir@,$(get_libdir),g" \
+ -e "s,@PF@,${PF},g" \
+ -e "s,@EPREFIX@,${EPREFIX},g" \
+ -i "${sub_files[@]}" \
+ || die "install paths sed failed"
+
+ if use clang; then
+ # constantly fails for a long time, likely due to our patches
+ rm tools/clang/test/Driver/cross-linux.c || die
+ fi
+
+ # User patches
+ epatch_user
+
+ python_setup
+}
+
+multilib_src_configure() {
+ # disable timestamps since they confuse ccache
+ local conf_flags=(
+ --disable-timestamps
+ --enable-keep-symbols
+ --enable-shared
+ --with-optimize-option=
+ $(tc-is-static-only && echo --disable-shared)
+ $(use_enable !debug optimized)
+ $(use_enable debug assertions)
+ $(use_enable debug expensive-checks)
+ $(use_enable libedit)
+ $(use_enable ncurses terminfo)
+ $(use_enable libffi)
+ )
+
+ # well, it's used only by clang executable c-index-test
+ if multilib_is_native_abi && use clang && use xml; then
+ conf_flags+=( XML2CONFIG="$(tc-getPKG_CONFIG) libxml-2.0" )
+ else
+ conf_flags+=( ac_cv_prog_XML2CONFIG="" )
+ fi
+
+ local targets bindings
+ if use multitarget; then
+ targets='all'
+ else
+ targets='host,cpp'
+ use video_cards_radeon && targets+=',r600'
+ fi
+ conf_flags+=( --enable-targets=${targets} )
+
+ if multilib_is_native_abi; then
+ use gold && conf_flags+=( --with-binutils-include="${EPREFIX}"/usr/include/ )
+ # extra commas don't hurt
+ use ocaml && bindings+=',ocaml'
+ fi
+
+ [[ ${bindings} ]] || bindings='none'
+ conf_flags+=( --enable-bindings=${bindings} )
+
+ if use libffi; then
+ local CPPFLAGS=${CPPFLAGS}
+ append-cppflags "$(pkg-config --cflags libffi)"
+ fi
+
+ # Enable large file support, bug #550708
+ append-lfs-flags
+ # llvm prefers clang over gcc, so we may need to force that
+ tc-export CC CXX
+
+ ECONF_SOURCE=${S} \
+ econf "${conf_flags[@]}"
+}
+
+set_makeargs() {
+ MAKEARGS=(
+ VERBOSE=1
+ REQUIRES_RTTI=1
+ GENTOO_LIBDIR=$(get_libdir)
+ )
+
+ # for tests, we want it all! otherwise, we may use a little filtering...
+ # adding ONLY_TOOLS also disables unittest building...
+ if [[ ${EBUILD_PHASE_FUNC} != src_test ]]; then
+ local tools=( llvm-config )
+ use clang && tools+=( clang )
+
+ if multilib_is_native_abi; then
+ tools+=(
+ opt llvm-as llvm-dis llc llvm-ar llvm-nm llvm-link lli
+ llvm-extract llvm-mc llvm-bcanalyzer llvm-diff macho-dump
+ llvm-objdump llvm-readobj llvm-rtdyld llvm-dwarfdump llvm-cov
+ llvm-size llvm-stress llvm-mcmarkup llvm-profdata
+ llvm-symbolizer obj2yaml yaml2obj lto bugpoint
+ )
+
+ # the build system runs explicitly specified tools in parallel,
+ # so we need to split it into two runs
+ if [[ ${1} != -1 ]]; then
+ # those require lto
+ tools+=( llvm-lto )
+ use gold && tools+=( gold )
+
+ # those require clang :)
+ # we need to explicitly specify all its tools
+ # since we're passing BUILD_CLANG_ONLY
+ use clang && tools+=(
+ clang/tools/{clang-check,clang-format,extra}
+ )
+ fi
+ fi
+
+ MAKEARGS+=(
+ # filter tools + disable unittests implicitly
+ ONLY_TOOLS="${tools[*]}"
+
+ # this disables unittests & docs from clang
+ BUILD_CLANG_ONLY=YES
+ )
+ fi
+}
+
+multilib_src_compile() {
+ local MAKEARGS
+ set_makeargs -1
+ emake "${MAKEARGS[@]}"
+
+ if multilib_is_native_abi; then
+ set_makeargs
+ emake -C tools "${MAKEARGS[@]}"
+
+ if use doc; then
+ emake -C "${S}"/docs -f Makefile.sphinx man
+ use clang && emake -C "${S}"/tools/clang/docs/tools \
+ BUILD_FOR_WEBSITE=1 DST_MAN_DIR="${T}"/ man
+ emake -C "${S}"/docs -f Makefile.sphinx html
+ fi
+ fi
+
+ if use debug; then
+ pax-mark m Debug+Asserts+Checks/bin/llvm-rtdyld
+ pax-mark m Debug+Asserts+Checks/bin/lli
+ pax-mark m Debug+Asserts+Checks/bin/lli-child-target
+ else
+ pax-mark m Release/bin/llvm-rtdyld
+ pax-mark m Release/bin/lli
+ pax-mark m Release/bin/lli-child-target
+ fi
+}
+
+multilib_src_test() {
+ local MAKEARGS
+ set_makeargs
+
+ # build the remaining tools & unittests
+ emake "${MAKEARGS[@]}"
+
+ pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests
+ pax-mark m unittests/ExecutionEngine/MCJIT/Release/MCJITTests
+ pax-mark m unittests/Support/Release/SupportTests
+
+ # respect TMPDIR!
+ local -x LIT_PRESERVES_TMP=1
+ emake "${MAKEARGS[@]}" check
+ use clang && emake "${MAKEARGS[@]}" -C tools/clang test
+}
+
+src_install() {
+ local MULTILIB_CHOST_TOOLS=(
+ /usr/bin/llvm-config
+ )
+
+ local MULTILIB_WRAPPED_HEADERS=(
+ /usr/include/llvm/Config/config.h
+ /usr/include/llvm/Config/llvm-config.h
+ )
+
+ if use clang; then
+ # note: magic applied below
+ MULTILIB_CHOST_TOOLS+=(
+ /usr/bin/clang
+ /usr/bin/clang++
+ /usr/bin/clang-${PV}
+ /usr/bin/clang++-${PV}
+ )
+
+ MULTILIB_WRAPPED_HEADERS+=(
+ /usr/include/clang/Config/config.h
+ )
+ fi
+
+ multilib-minimal_src_install
+
+ # Remove unnecessary headers on FreeBSD, bug #417171
+ use kernel_FreeBSD && use clang && rm "${ED}"usr/lib/clang/${PV}/include/{std,float,iso,limits,tgmath,varargs}*.h
+}
+
+multilib_src_install() {
+ local MAKEARGS
+ set_makeargs
+
+ local root=${D}/_${ABI}
+
+ emake "${MAKEARGS[@]}" DESTDIR="${root}" install
+ multibuild_merge_root "${root}" "${D}"
+
+ if ! multilib_is_native_abi; then
+ # Backwards compat, will be happily removed someday.
+ dosym "${CHOST}"-llvm-config /usr/bin/llvm-config.${ABI}
+ else
+ # Install docs.
+ if use doc; then
+ doman "${S}"/docs/_build/man/*.1
+ use clang && doman "${T}"/clang.1
+ dohtml -r "${S}"/docs/_build/html/
+ else
+ if ! use clang; then
+ rm "${WORKDIR}"/${P}-manpages/clang.1 || die
+ fi
+ doman "${WORKDIR}"/${P}-manpages/*.1
+ fi
+
+ # Symlink the gold plugin.
+ if use gold; then
+ dodir /usr/${CHOST}/binutils-bin/lib/bfd-plugins
+ dosym ../../../../$(get_libdir)/LLVMgold.so \
+ /usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so
+ fi
+ fi
+
+ # apply CHOST and PV to clang executables
+ # they're statically linked so we don't have to worry about the lib
+ if use clang; then
+ local clang_tools=( clang clang++ )
+ local i
+
+ # append ${PV} and symlink back
+ # TODO: use alternatives.eclass? does that make any sense?
+ # maybe with USE=-clang on :0 and USE=clang on older
+ for i in "${clang_tools[@]}"; do
+ mv "${ED%/}/usr/bin/${i}"{,-${PV}} || die
+ dosym "${i}"-${PV} /usr/bin/${i}
+ done
+
+ # now prepend ${CHOST} and let the multilib-build.eclass symlink it
+ if ! multilib_is_native_abi; then
+ # non-native? let's replace it with a simple wrapper
+ for i in "${clang_tools[@]}"; do
+ rm "${ED%/}/usr/bin/${i}-${PV}" || die
+ cat > "${T}"/wrapper.tmp <<-_EOF_
+ #!${EPREFIX}/bin/sh
+ exec "${i}-${PV}" $(get_abi_CFLAGS) "\${@}"
+ _EOF_
+ newbin "${T}"/wrapper.tmp "${i}-${PV}"
+ done
+ fi
+ fi
+
+ # Fix install_names on Darwin. The build system is too complicated
+ # to just fix this, so we correct it post-install
+ local lib= f= odylib= ndylib= libpv=${PV}
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ eval $(grep PACKAGE_VERSION= configure)
+ [[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION}
+ libpvminor=${libpv%.[0-9]*}
+ for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib LLVMHello.dylib clang/${libpv}/lib/darwin/libclang_rt.asan_{osx,iossim}_dynamic.dylib; do
+ # libEnhancedDisassembly is Darwin10 only, so non-fatal
+ # + omit clang libs if not enabled
+ [[ -f ${ED}/usr/lib/${lib} ]] || continue
+
+ ebegin "fixing install_name of $lib"
+ install_name_tool \
+ -id "${EPREFIX}"/usr/lib/${lib} \
+ "${ED}"/usr/lib/${lib}
+ eend $?
+ done
+ for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/lib*.dylib "${ED}"/usr/lib/clang/${libpv}/lib/darwin/*.dylib ; do
+ # omit clang libs if not enabled
+ [[ -f "${f}" ]] || continue
+
+ scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | \
+ while read odylib ; do
+ ndylib=
+ case ${odylib} in
+ */libclang.dylib)
+ ndylib="${EPREFIX}"/usr/lib/libclang.dylib
+ ;;
+ */libLLVM-${libpv}.dylib)
+ ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpv}.dylib
+ ;;
+ */libLLVM-${libpvminor}.dylib)
+ ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpvminor}.dylib
+ ;;
+ */libLTO.dylib)
+ ndylib="${EPREFIX}"/usr/lib/libLTO.dylib
+ ;;
+ esac
+ if [[ -n ${ndylib} ]] ; then
+ ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
+ install_name_tool \
+ -change "${odylib}" "${ndylib}" \
+ "${f}"
+ eend $?
+ fi
+ done
+ done
+ fi
+}
+
+multilib_src_install_all() {
+ insinto /usr/share/vim/vimfiles/syntax
+ doins utils/vim/*.vim
+
+ if use clang; then
+ cd tools/clang || die
+
+ if use static-analyzer ; then
+ dobin tools/scan-build/ccc-analyzer
+ dosym ccc-analyzer /usr/bin/c++-analyzer
+ dobin tools/scan-build/scan-build
+
+ insinto /usr/share/${PN}
+ doins tools/scan-build/scanview.css
+ doins tools/scan-build/sorttable.js
+ fi
+
+ python_inst() {
+ if use static-analyzer ; then
+ pushd tools/scan-view >/dev/null || die
+
+ python_doscript scan-view
+
+ touch __init__.py || die
+ python_moduleinto clang
+ python_domodule __init__.py Reporter.py Resources ScanView.py startfile.py
+
+ popd >/dev/null || die
+ fi
+
+ if use python ; then
+ pushd bindings/python/clang >/dev/null || die
+
+ python_moduleinto clang
+ python_domodule __init__.py cindex.py enumerations.py
+
+ popd >/dev/null || die
+ fi
+
+ # AddressSanitizer symbolizer (currently separate)
+ python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
+ }
+ python_foreach_impl python_inst
+ fi
+}
diff --git a/sys-devel/llvm/llvm-3.6.2.ebuild b/sys-devel/llvm/llvm-3.6.2.ebuild
new file mode 100644
index 000000000000..e8085c497902
--- /dev/null
+++ b/sys-devel/llvm/llvm-3.6.2.ebuild
@@ -0,0 +1,541 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 pypy )
+
+inherit eutils flag-o-matic multibuild multilib \
+ multilib-minimal python-r1 toolchain-funcs pax-utils check-reqs prefix
+
+DESCRIPTION="Low Level Virtual Machine"
+HOMEPAGE="http://llvm.org/"
+SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz
+ clang? ( http://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.xz
+ http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.xz
+ http://llvm.org/releases/${PV}/clang-tools-extra-${PV}.src.tar.xz )
+ !doc? ( http://dev.gentoo.org/~voyageur/distfiles/${PN}-3.6.1-manpages.tar.bz2 )"
+
+LICENSE="UoI-NCSA"
+SLOT="0/3.6"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="clang debug doc gold libedit +libffi multitarget ncurses ocaml python
+ +static-analyzer test xml video_cards_radeon
+ kernel_Darwin kernel_FreeBSD"
+
+COMMON_DEPEND="
+ sys-libs/zlib:0=
+ clang? (
+ python? ( ${PYTHON_DEPS} )
+ static-analyzer? (
+ dev-lang/perl:*
+ ${PYTHON_DEPS}
+ )
+ xml? ( dev-libs/libxml2:2= )
+ )
+ gold? ( >=sys-devel/binutils-2.22:*[cxx] )
+ libedit? ( dev-libs/libedit:0=[${MULTILIB_USEDEP}] )
+ libffi? ( >=virtual/libffi-3.0.13-r1:0=[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.9-r3:5=[${MULTILIB_USEDEP}] )
+ ocaml? (
+ dev-lang/ocaml:0=
+ dev-ml/findlib
+ dev-ml/ocaml-ctypes )"
+# configparser-3.2 breaks the build (3.3 or none at all are fine)
+DEPEND="${COMMON_DEPEND}
+ app-arch/xz-utils
+ dev-lang/perl
+ >=sys-devel/make-3.81
+ >=sys-devel/flex-2.5.4
+ >=sys-devel/bison-1.875d
+ || ( >=sys-devel/gcc-3.0 >=sys-devel/llvm-3.5
+ ( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx )
+ )
+ || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-5.1 )
+ kernel_Darwin? ( sys-libs/libcxx )
+ clang? ( xml? ( virtual/pkgconfig ) )
+ doc? ( dev-python/sphinx )
+ libffi? ( virtual/pkgconfig )
+ !!<dev-python/configparser-3.3.0.2
+ ocaml? ( test? ( dev-ml/ounit ) )
+ ${PYTHON_DEPS}"
+RDEPEND="${COMMON_DEPEND}
+ clang? ( !<=sys-devel/clang-${PV}-r99
+ !>=sys-devel/clang-9999 )
+ abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r2
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )"
+PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )"
+
+# pypy gives me around 1700 unresolved tests due to open file limit
+# being exceeded. probably GC does not close them fast enough.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+ test? ( || ( $(python_gen_useflags 'python*') ) )"
+
+S=${WORKDIR}/${P/_}.src
+
+# Some people actually override that in make.conf. That sucks since
+# we need to run install per-directory, and ninja can't do that...
+# so why did it call itself ninja in the first place?
+CMAKE_MAKEFILE_GENERATOR=emake
+
+pkg_pretend() {
+ # in megs
+ # !clang !debug !multitarget -O2 400
+ # !clang !debug multitarget -O2 550
+ # clang !debug !multitarget -O2 950
+ # clang !debug multitarget -O2 1200
+ # !clang debug multitarget -O2 5G
+ # clang !debug multitarget -O0 -g 12G
+ # clang debug multitarget -O2 16G
+ # clang debug multitarget -O0 -g 14G
+
+ local build_size=550
+ use clang && build_size=1200
+
+ if use debug; then
+ ewarn "USE=debug is known to increase the size of package considerably"
+ ewarn "and cause the tests to fail."
+ ewarn
+
+ (( build_size *= 14 ))
+ elif is-flagq '-g?(gdb)?([1-9])'; then
+ ewarn "The C++ compiler -g option is known to increase the size of the package"
+ ewarn "considerably. If you run out of space, please consider removing it."
+ ewarn
+
+ (( build_size *= 10 ))
+ fi
+
+ # Multiply by number of ABIs :).
+ local abis=( $(multilib_get_enabled_abis) )
+ (( build_size *= ${#abis[@]} ))
+
+ local CHECKREQS_DISK_BUILD=${build_size}M
+ check-reqs_pkg_pretend
+
+ if [[ ${MERGE_TYPE} != binary ]]; then
+ echo 'int main() {return 0;}' > "${T}"/test.cxx || die
+ ebegin "Trying to build a C++11 test program"
+ if ! $(tc-getCXX) -std=c++11 -o /dev/null "${T}"/test.cxx; then
+ eerror "LLVM-${PV} requires C++11-capable C++ compiler. Your current compiler"
+ eerror "does not seem to support -std=c++11 option. Please upgrade your compiler"
+ eerror "to gcc-4.7 or an equivalent version supporting C++11."
+ die "Currently active compiler does not support -std=c++11"
+ fi
+ eend ${?}
+ fi
+}
+
+pkg_setup() {
+ pkg_pretend
+}
+
+src_unpack() {
+ default
+
+ rm -f "${S}"/tools/clang "${S}"/projects/compiler-rt \
+ || die "symlinks removal failed"
+
+ if use clang; then
+ mv "${WORKDIR}"/cfe-${PV/_}.src "${S}"/tools/clang \
+ || die "clang source directory move failed"
+ mv "${WORKDIR}"/compiler-rt-${PV/_}.src "${S}"/projects/compiler-rt \
+ || die "compiler-rt source directory move failed"
+ mv "${WORKDIR}"/clang-tools-extra-${PV/_}.src "${S}"/tools/clang/tools/extra \
+ || die "clang-tools-extra source directory move failed"
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-3.2-nodoctargz.patch
+ epatch "${FILESDIR}"/${PN}-3.5-gcc-4.9.patch
+ epatch "${FILESDIR}"/${PN}-3.6-gentoo-install.patch
+ epatch "${FILESDIR}"/${PN}-3.6.0-ocaml-ctypes-0.4.0.patch
+ # Make ocaml warnings non-fatal, bug #537308
+ sed -e "/RUN/s/-warn-error A//" -i test/Bindings/OCaml/*ml || die
+
+ if use clang; then
+ # Automatically select active system GCC's libraries, bugs #406163 and #417913
+ epatch "${FILESDIR}"/clang-3.5-gentoo-runtime-gcc-detection-v3.patch
+
+ epatch "${FILESDIR}"/clang-3.6-gentoo-install.patch
+ epatch "${FILESDIR}"/clang-3.4-darwin_prefix-include-paths.patch
+ eprefixify tools/clang/lib/Frontend/InitHeaderSearch.cpp
+
+ # Fix build fails with using gcc-4.9 on Gentoo/FreeBSD, bug #548444
+ epatch "${FILESDIR}"/clang-3.6-fbsd-gcc49.patch
+ fi
+
+ if use prefix && use clang; then
+ sed -i -e "/^CFLAGS /s@-Werror@-I${EPREFIX}/usr/include@" \
+ projects/compiler-rt/make/platform/clang_*.mk || die
+ fi
+
+ local sub_files=(
+ Makefile.config.in
+ Makefile.rules
+ tools/llvm-config/llvm-config.cpp
+ )
+ use clang && sub_files+=(
+ tools/clang/lib/Driver/Tools.cpp
+ tools/clang/tools/scan-build/scan-build
+ )
+
+ # unfortunately ./configure won't listen to --mandir and the-like, so take
+ # care of this.
+ # note: we're setting the main libdir intentionally.
+ # where per-ABI is appropriate, we use $(GENTOO_LIBDIR) make.
+ einfo "Fixing install dirs"
+ sed -e "s,@libdir@,$(get_libdir),g" \
+ -e "s,@PF@,${PF},g" \
+ -e "s,@EPREFIX@,${EPREFIX},g" \
+ -i "${sub_files[@]}" \
+ || die "install paths sed failed"
+
+ if use clang; then
+ # constantly fails for a long time, likely due to our patches
+ rm tools/clang/test/Driver/cross-linux.c || die
+ fi
+
+ # User patches
+ epatch_user
+
+ python_setup
+}
+
+multilib_src_configure() {
+ # disable timestamps since they confuse ccache
+ local conf_flags=(
+ --disable-timestamps
+ --enable-keep-symbols
+ --enable-shared
+ --with-optimize-option=
+ $(tc-is-static-only && echo --disable-shared)
+ $(use_enable !debug optimized)
+ $(use_enable debug assertions)
+ $(use_enable debug expensive-checks)
+ $(use_enable libedit)
+ $(use_enable ncurses terminfo)
+ $(use_enable libffi)
+ )
+
+ # well, it's used only by clang executable c-index-test
+ if multilib_is_native_abi && use clang && use xml; then
+ conf_flags+=( XML2CONFIG="$(tc-getPKG_CONFIG) libxml-2.0" )
+ else
+ conf_flags+=( ac_cv_prog_XML2CONFIG="" )
+ fi
+
+ local targets bindings
+ if use multitarget; then
+ targets='all'
+ else
+ targets='host,cpp'
+ use video_cards_radeon && targets+=',r600'
+ fi
+ conf_flags+=( --enable-targets=${targets} )
+
+ if multilib_is_native_abi; then
+ use gold && conf_flags+=( --with-binutils-include="${EPREFIX}"/usr/include/ )
+ # extra commas don't hurt
+ use ocaml && bindings+=',ocaml'
+ fi
+
+ [[ ${bindings} ]] || bindings='none'
+ conf_flags+=( --enable-bindings=${bindings} )
+
+ if use libffi; then
+ local CPPFLAGS=${CPPFLAGS}
+ append-cppflags "$(pkg-config --cflags libffi)"
+ fi
+
+ # Enable large file support, bug #550708
+ append-lfs-flags
+ # llvm prefers clang over gcc, so we may need to force that
+ tc-export CC CXX
+
+ ECONF_SOURCE=${S} \
+ econf "${conf_flags[@]}"
+}
+
+set_makeargs() {
+ MAKEARGS=(
+ VERBOSE=1
+ REQUIRES_RTTI=1
+ GENTOO_LIBDIR=$(get_libdir)
+ )
+
+ # for tests, we want it all! otherwise, we may use a little filtering...
+ # adding ONLY_TOOLS also disables unittest building...
+ if [[ ${EBUILD_PHASE_FUNC} != src_test ]]; then
+ local tools=( llvm-config )
+ use clang && tools+=( clang )
+
+ if multilib_is_native_abi; then
+ tools+=(
+ opt llvm-as llvm-dis llc llvm-ar llvm-nm llvm-link lli
+ llvm-extract llvm-mc llvm-bcanalyzer llvm-diff macho-dump
+ llvm-objdump llvm-readobj llvm-rtdyld llvm-dwarfdump llvm-cov
+ llvm-size llvm-stress llvm-mcmarkup llvm-profdata
+ llvm-symbolizer obj2yaml yaml2obj lto bugpoint
+ )
+
+ # the build system runs explicitly specified tools in parallel,
+ # so we need to split it into two runs
+ if [[ ${1} != -1 ]]; then
+ # those require lto
+ tools+=( llvm-lto )
+ use gold && tools+=( gold )
+
+ # those require clang :)
+ # we need to explicitly specify all its tools
+ # since we're passing BUILD_CLANG_ONLY
+ use clang && tools+=(
+ clang/tools/{clang-check,clang-format,extra}
+ )
+ fi
+ fi
+
+ MAKEARGS+=(
+ # filter tools + disable unittests implicitly
+ ONLY_TOOLS="${tools[*]}"
+
+ # this disables unittests & docs from clang
+ BUILD_CLANG_ONLY=YES
+ )
+ fi
+}
+
+multilib_src_compile() {
+ local MAKEARGS
+ set_makeargs -1
+ emake "${MAKEARGS[@]}"
+
+ if multilib_is_native_abi; then
+ set_makeargs
+ emake -C tools "${MAKEARGS[@]}"
+
+ if use doc; then
+ emake -C "${S}"/docs -f Makefile.sphinx man
+ use clang && emake -C "${S}"/tools/clang/docs/tools \
+ BUILD_FOR_WEBSITE=1 DST_MAN_DIR="${T}"/ man
+ emake -C "${S}"/docs -f Makefile.sphinx html
+ fi
+ fi
+
+ if use debug; then
+ pax-mark m Debug+Asserts+Checks/bin/llvm-rtdyld
+ pax-mark m Debug+Asserts+Checks/bin/lli
+ pax-mark m Debug+Asserts+Checks/bin/lli-child-target
+ else
+ pax-mark m Release/bin/llvm-rtdyld
+ pax-mark m Release/bin/lli
+ pax-mark m Release/bin/lli-child-target
+ fi
+}
+
+multilib_src_test() {
+ local MAKEARGS
+ set_makeargs
+
+ # build the remaining tools & unittests
+ emake "${MAKEARGS[@]}"
+
+ pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests
+ pax-mark m unittests/ExecutionEngine/MCJIT/Release/MCJITTests
+ pax-mark m unittests/Support/Release/SupportTests
+
+ # respect TMPDIR!
+ local -x LIT_PRESERVES_TMP=1
+ emake "${MAKEARGS[@]}" check
+ use clang && emake "${MAKEARGS[@]}" -C tools/clang test
+}
+
+src_install() {
+ local MULTILIB_CHOST_TOOLS=(
+ /usr/bin/llvm-config
+ )
+
+ local MULTILIB_WRAPPED_HEADERS=(
+ /usr/include/llvm/Config/config.h
+ /usr/include/llvm/Config/llvm-config.h
+ )
+
+ if use clang; then
+ # note: magic applied below
+ MULTILIB_CHOST_TOOLS+=(
+ /usr/bin/clang
+ /usr/bin/clang++
+ /usr/bin/clang-${PV}
+ /usr/bin/clang++-${PV}
+ )
+
+ MULTILIB_WRAPPED_HEADERS+=(
+ /usr/include/clang/Config/config.h
+ )
+ fi
+
+ multilib-minimal_src_install
+
+ # Remove unnecessary headers on FreeBSD, bug #417171
+ use kernel_FreeBSD && use clang && rm "${ED}"usr/lib/clang/${PV}/include/{std,float,iso,limits,tgmath,varargs}*.h
+}
+
+multilib_src_install() {
+ local MAKEARGS
+ set_makeargs
+
+ local root=${D}/_${ABI}
+
+ emake "${MAKEARGS[@]}" DESTDIR="${root}" install
+ multibuild_merge_root "${root}" "${D}"
+
+ if ! multilib_is_native_abi; then
+ # Backwards compat, will be happily removed someday.
+ dosym "${CHOST}"-llvm-config /usr/bin/llvm-config.${ABI}
+ else
+ # Install docs.
+ if use doc; then
+ doman "${S}"/docs/_build/man/*.1
+ use clang && doman "${T}"/clang.1
+ dohtml -r "${S}"/docs/_build/html/
+ else
+ if ! use clang; then
+ rm "${WORKDIR}"/${PN}-3.6.1-manpages/clang.1 || die
+ fi
+ doman "${WORKDIR}"/${PN}-3.6.1-manpages/*.1
+ fi
+
+ # Symlink the gold plugin.
+ if use gold; then
+ dodir /usr/${CHOST}/binutils-bin/lib/bfd-plugins
+ dosym ../../../../$(get_libdir)/LLVMgold.so \
+ /usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so
+ fi
+ fi
+
+ # apply CHOST and PV to clang executables
+ # they're statically linked so we don't have to worry about the lib
+ if use clang; then
+ local clang_tools=( clang clang++ )
+ local i
+
+ # append ${PV} and symlink back
+ # TODO: use alternatives.eclass? does that make any sense?
+ # maybe with USE=-clang on :0 and USE=clang on older
+ for i in "${clang_tools[@]}"; do
+ mv "${ED%/}/usr/bin/${i}"{,-${PV}} || die
+ dosym "${i}"-${PV} /usr/bin/${i}
+ done
+
+ # now prepend ${CHOST} and let the multilib-build.eclass symlink it
+ if ! multilib_is_native_abi; then
+ # non-native? let's replace it with a simple wrapper
+ for i in "${clang_tools[@]}"; do
+ rm "${ED%/}/usr/bin/${i}-${PV}" || die
+ cat > "${T}"/wrapper.tmp <<-_EOF_
+ #!${EPREFIX}/bin/sh
+ exec "${i}-${PV}" $(get_abi_CFLAGS) "\${@}"
+ _EOF_
+ newbin "${T}"/wrapper.tmp "${i}-${PV}"
+ done
+ fi
+ fi
+
+ # Fix install_names on Darwin. The build system is too complicated
+ # to just fix this, so we correct it post-install
+ local lib= f= odylib= ndylib= libpv=${PV}
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ eval $(grep PACKAGE_VERSION= configure)
+ [[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION}
+ libpvminor=${libpv%.[0-9]*}
+ for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib LLVMHello.dylib clang/${libpv}/lib/darwin/libclang_rt.asan_{osx,iossim}_dynamic.dylib; do
+ # libEnhancedDisassembly is Darwin10 only, so non-fatal
+ # + omit clang libs if not enabled
+ [[ -f ${ED}/usr/lib/${lib} ]] || continue
+
+ ebegin "fixing install_name of $lib"
+ install_name_tool \
+ -id "${EPREFIX}"/usr/lib/${lib} \
+ "${ED}"/usr/lib/${lib}
+ eend $?
+ done
+ for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/lib*.dylib "${ED}"/usr/lib/clang/${libpv}/lib/darwin/*.dylib ; do
+ # omit clang libs if not enabled
+ [[ -f "${f}" ]] || continue
+
+ scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | \
+ while read odylib ; do
+ ndylib=
+ case ${odylib} in
+ */libclang.dylib)
+ ndylib="${EPREFIX}"/usr/lib/libclang.dylib
+ ;;
+ */libLLVM-${libpv}.dylib)
+ ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpv}.dylib
+ ;;
+ */libLLVM-${libpvminor}.dylib)
+ ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpvminor}.dylib
+ ;;
+ */libLTO.dylib)
+ ndylib="${EPREFIX}"/usr/lib/libLTO.dylib
+ ;;
+ esac
+ if [[ -n ${ndylib} ]] ; then
+ ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
+ install_name_tool \
+ -change "${odylib}" "${ndylib}" \
+ "${f}"
+ eend $?
+ fi
+ done
+ done
+ fi
+}
+
+multilib_src_install_all() {
+ insinto /usr/share/vim/vimfiles/syntax
+ doins utils/vim/*.vim
+
+ if use clang; then
+ cd tools/clang || die
+
+ if use static-analyzer ; then
+ dobin tools/scan-build/ccc-analyzer
+ dosym ccc-analyzer /usr/bin/c++-analyzer
+ dobin tools/scan-build/scan-build
+
+ insinto /usr/share/${PN}
+ doins tools/scan-build/scanview.css
+ doins tools/scan-build/sorttable.js
+ fi
+
+ python_inst() {
+ if use static-analyzer ; then
+ pushd tools/scan-view >/dev/null || die
+
+ python_doscript scan-view
+
+ touch __init__.py || die
+ python_moduleinto clang
+ python_domodule __init__.py Reporter.py Resources ScanView.py startfile.py
+
+ popd >/dev/null || die
+ fi
+
+ if use python ; then
+ pushd bindings/python/clang >/dev/null || die
+
+ python_moduleinto clang
+ python_domodule __init__.py cindex.py enumerations.py
+
+ popd >/dev/null || die
+ fi
+
+ # AddressSanitizer symbolizer (currently separate)
+ python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
+ }
+ python_foreach_impl python_inst
+ fi
+}
diff --git a/sys-devel/llvm/llvm-9999.ebuild b/sys-devel/llvm/llvm-9999.ebuild
new file mode 100644
index 000000000000..aa013b67f400
--- /dev/null
+++ b/sys-devel/llvm/llvm-9999.ebuild
@@ -0,0 +1,487 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+: ${CMAKE_MAKEFILE_GENERATOR:=ninja}
+PYTHON_COMPAT=( python2_7 pypy )
+
+inherit check-reqs cmake-utils eutils flag-o-matic git-r3 multilib \
+ multilib-minimal python-r1 toolchain-funcs pax-utils
+
+DESCRIPTION="Low Level Virtual Machine"
+HOMEPAGE="http://llvm.org/"
+SRC_URI=""
+EGIT_REPO_URI="http://llvm.org/git/llvm.git
+ https://github.com/llvm-mirror/llvm.git"
+
+LICENSE="UoI-NCSA"
+SLOT="0/${PV}"
+KEYWORDS=""
+IUSE="clang debug +doc gold libedit +libffi lldb multitarget ncurses ocaml
+ python +static-analyzer test xml video_cards_radeon kernel_Darwin"
+
+COMMON_DEPEND="
+ sys-libs/zlib:0=
+ clang? (
+ python? ( ${PYTHON_DEPS} )
+ static-analyzer? (
+ dev-lang/perl:*
+ ${PYTHON_DEPS}
+ )
+ xml? ( dev-libs/libxml2:2= )
+ )
+ gold? ( >=sys-devel/binutils-2.22:*[cxx] )
+ libedit? ( dev-libs/libedit:0=[${MULTILIB_USEDEP}] )
+ libffi? ( >=virtual/libffi-3.0.13-r1:0=[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.9-r3:5=[${MULTILIB_USEDEP}] )
+ ocaml? (
+ dev-lang/ocaml:0=
+ dev-ml/findlib
+ dev-ml/ocaml-ctypes )"
+# configparser-3.2 breaks the build (3.3 or none at all are fine)
+DEPEND="${COMMON_DEPEND}
+ dev-lang/perl
+ >=sys-devel/make-3.81
+ >=sys-devel/flex-2.5.4
+ >=sys-devel/bison-1.875d
+ || ( >=sys-devel/gcc-3.0 >=sys-devel/llvm-3.5
+ ( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx )
+ )
+ || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-5.1 )
+ kernel_Darwin? ( sys-libs/libcxx )
+ clang? ( xml? ( virtual/pkgconfig ) )
+ doc? ( dev-python/sphinx )
+ libffi? ( virtual/pkgconfig )
+ lldb? ( dev-lang/swig )
+ !!<dev-python/configparser-3.3.0.2
+ ocaml? ( test? ( dev-ml/ounit ) )
+ ${PYTHON_DEPS}"
+RDEPEND="${COMMON_DEPEND}
+ clang? ( !<=sys-devel/clang-${PV}-r99 )
+ abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r2
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )"
+PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )"
+
+# pypy gives me around 1700 unresolved tests due to open file limit
+# being exceeded. probably GC does not close them fast enough.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+ lldb? ( clang )
+ test? ( || ( $(python_gen_useflags 'python*') ) )"
+
+pkg_pretend() {
+ # in megs
+ # !clang !debug !multitarget -O2 400
+ # !clang !debug multitarget -O2 550
+ # clang !debug !multitarget -O2 950
+ # clang !debug multitarget -O2 1200
+ # !clang debug multitarget -O2 5G
+ # clang !debug multitarget -O0 -g 12G
+ # clang debug multitarget -O2 16G
+ # clang debug multitarget -O0 -g 14G
+
+ local build_size=550
+ use clang && build_size=1200
+
+ if use debug; then
+ ewarn "USE=debug is known to increase the size of package considerably"
+ ewarn "and cause the tests to fail."
+ ewarn
+
+ (( build_size *= 14 ))
+ elif is-flagq '-g?(gdb)?([1-9])'; then
+ ewarn "The C++ compiler -g option is known to increase the size of the package"
+ ewarn "considerably. If you run out of space, please consider removing it."
+ ewarn
+
+ (( build_size *= 10 ))
+ fi
+
+ # Multiply by number of ABIs :).
+ local abis=( $(multilib_get_enabled_abis) )
+ (( build_size *= ${#abis[@]} ))
+
+ local CHECKREQS_DISK_BUILD=${build_size}M
+ check-reqs_pkg_pretend
+
+ if [[ ${MERGE_TYPE} != binary ]]; then
+ echo 'int main() {return 0;}' > "${T}"/test.cxx || die
+ ebegin "Trying to build a C++11 test program"
+ if ! $(tc-getCXX) -std=c++11 -o /dev/null "${T}"/test.cxx; then
+ eerror "LLVM-${PV} requires C++11-capable C++ compiler. Your current compiler"
+ eerror "does not seem to support -std=c++11 option. Please upgrade your compiler"
+ eerror "to gcc-4.7 or an equivalent version supporting C++11."
+ die "Currently active compiler does not support -std=c++11"
+ fi
+ eend ${?}
+ fi
+}
+
+pkg_setup() {
+ pkg_pretend
+}
+
+src_unpack() {
+ if use clang; then
+ git-r3_fetch "http://llvm.org/git/compiler-rt.git
+ https://github.com/llvm-mirror/compiler-rt.git"
+ git-r3_fetch "http://llvm.org/git/clang.git
+ https://github.com/llvm-mirror/clang.git"
+ git-r3_fetch "http://llvm.org/git/clang-tools-extra.git
+ https://github.com/llvm-mirror/clang-tools-extra.git"
+ fi
+ if use lldb; then
+ git-r3_fetch "http://llvm.org/git/lldb.git
+ https://github.com/llvm-mirror/lldb.git"
+ fi
+ git-r3_fetch
+
+ if use clang; then
+ git-r3_checkout http://llvm.org/git/compiler-rt.git \
+ "${S}"/projects/compiler-rt
+ git-r3_checkout http://llvm.org/git/clang.git \
+ "${S}"/tools/clang
+ git-r3_checkout http://llvm.org/git/clang-tools-extra.git \
+ "${S}"/tools/clang/tools/extra
+ fi
+ if use lldb; then
+ git-r3_checkout http://llvm.org/git/lldb.git \
+ "${S}"/tools/lldb
+ fi
+ git-r3_checkout
+}
+
+src_prepare() {
+ # Make ocaml warnings non-fatal, bug #537308
+ sed -e "/RUN/s/-warn-error A//" -i test/Bindings/OCaml/*ml || die
+
+ # Make it possible to override Sphinx HTML install dirs
+ # https://llvm.org/bugs/show_bug.cgi?id=23780
+ epatch "${FILESDIR}"/cmake/0002-cmake-Support-overriding-Sphinx-HTML-doc-install-dir.patch
+
+ # Prevent race conditions with parallel Sphinx runs
+ # https://llvm.org/bugs/show_bug.cgi?id=23781
+ epatch "${FILESDIR}"/cmake/0003-cmake-Add-an-ordering-dep-between-HTML-man-Sphinx-ta.patch
+
+ # Prevent installing libgtest
+ # https://llvm.org/bugs/show_bug.cgi?id=18341
+ epatch "${FILESDIR}"/cmake/0004-cmake-Do-not-install-libgtest.patch
+
+ if use clang; then
+ # Automatically select active system GCC's libraries, bugs #406163 and #417913
+ epatch "${FILESDIR}"/clang-3.5-gentoo-runtime-gcc-detection-v3.patch
+
+ epatch "${FILESDIR}"/clang-3.6-gentoo-install.patch
+
+ sed -i -e "s^@EPREFIX@^${EPREFIX}^" \
+ tools/clang/tools/scan-build/scan-build || die
+
+ # Install clang runtime into /usr/lib/clang
+ # https://llvm.org/bugs/show_bug.cgi?id=23792
+ epatch "${FILESDIR}"/cmake/clang-0001-Install-clang-runtime-into-usr-lib-without-suffix.patch
+ epatch "${FILESDIR}"/cmake/compiler-rt-0001-cmake-Install-compiler-rt-into-usr-lib-without-suffi.patch
+
+ # Make it possible to override CLANG_LIBDIR_SUFFIX
+ # (that is used only to find LLVMgold.so)
+ # https://llvm.org/bugs/show_bug.cgi?id=23793
+ epatch "${FILESDIR}"/cmake/clang-0002-cmake-Make-CLANG_LIBDIR_SUFFIX-overridable.patch
+ fi
+
+ if use lldb; then
+ # Do not install dummy readline.so module from
+ # https://llvm.org/bugs/show_bug.cgi?id=18841
+ sed -e 's/add_subdirectory(readline)/#&/' \
+ -i tools/lldb/scripts/Python/modules/CMakeLists.txt || die
+ fi
+
+ # User patches
+ epatch_user
+
+ python_setup
+
+ # Native libdir is used to hold LLVMgold.so
+ NATIVE_LIBDIR=$(get_libdir)
+}
+
+multilib_src_configure() {
+ local targets
+ if use multitarget; then
+ targets=all
+ else
+ targets='host;CppBackend'
+ use video_cards_radeon && targets+=';AMDGPU'
+ fi
+
+ local ffi_cflags ffi_ldflags
+ if use libffi; then
+ ffi_cflags=$(pkg-config --cflags-only-I libffi)
+ ffi_ldflags=$(pkg-config --libs-only-L libffi)
+ fi
+
+ local libdir=$(get_libdir)
+ local mycmakeargs=(
+ "${mycmakeargs[@]}"
+ -DLLVM_LIBDIR_SUFFIX=${libdir#lib}
+
+ -DBUILD_SHARED_LIBS=ON
+ -DLLVM_ENABLE_TIMESTAMPS=OFF
+ -DLLVM_TARGETS_TO_BUILD="${targets}"
+ -DLLVM_BUILD_TESTS=$(usex test)
+
+ -DLLVM_ENABLE_FFI=$(usex libffi)
+ -DLLVM_ENABLE_TERMINFO=$(usex ncurses)
+ -DLLVM_ENABLE_ASSERTIONS=$(usex debug)
+ -DLLVM_ENABLE_EH=ON
+ -DLLVM_ENABLE_RTTI=ON
+
+ -DWITH_POLLY=OFF # TODO
+
+ -DLLVM_HOST_TRIPLE="${CHOST}"
+
+ -DFFI_INCLUDE_DIR="${ffi_cflags#-I}"
+ -DFFI_LIBRARY_DIR="${ffi_ldflags#-L}"
+
+ -DHAVE_HISTEDIT_H=$(usex libedit)
+ )
+
+ if use lldb; then
+ mycmakeargs+=(
+ -DLLDB_DISABLE_LIBEDIT=$(usex !libedit)
+ -DLLDB_DISABLE_CURSES=$(usex !ncurses)
+ -DLLDB_ENABLE_TERMINFO=$(usex ncurses)
+ )
+ fi
+
+ if ! multilib_is_native_abi || ! use ocaml; then
+ mycmakeargs+=(
+ -DOCAMLFIND=NO
+ )
+ fi
+# Note: go bindings have no CMake rules at the moment
+# but let's kill the check in case they are introduced
+# if ! multilib_is_native_abi || ! use go; then
+ mycmakeargs+=(
+ -DGO_EXECUTABLE=GO_EXECUTABLE-NOTFOUND
+ )
+# fi
+
+ if multilib_is_native_abi; then
+ mycmakeargs+=(
+ -DLLVM_BUILD_DOCS=$(usex doc)
+ -DLLVM_ENABLE_SPHINX=$(usex doc)
+ -DLLVM_ENABLE_DOXYGEN=OFF
+ -DLLVM_INSTALL_HTML="${EPREFIX}/usr/share/doc/${PF}/html"
+ )
+
+ if use clang; then
+ mycmakeargs+=(
+ -DCLANG_INSTALL_HTML="${EPREFIX}/usr/share/doc/${PF}/clang"
+ )
+ fi
+
+ if use gold; then
+ mycmakeargs+=(
+ -DLLVM_BINUTILS_INCDIR="${EPREFIX}"/usr/include
+ )
+ fi
+
+ if use lldb; then
+ mycmakeargs+=(
+ -DLLDB_DISABLE_PYTHON=$(usex !python)
+ )
+ fi
+
+ else
+ if use clang; then
+ mycmakeargs+=(
+ # disable compiler-rt on non-native ABI because:
+ # 1. it fails to configure because of -m32
+ # 2. it is shared between ABIs so no point building
+ # it multiple times
+ -DLLVM_EXTERNAL_COMPILER_RT_BUILD=OFF
+ -DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_BUILD=OFF
+ )
+ fi
+ if use lldb; then
+ mycmakeargs+=(
+ # only run swig on native abi
+ -DLLDB_DISABLE_PYTHON=ON
+ )
+ fi
+ fi
+
+ if use clang; then
+ mycmakeargs+=(
+ -DCLANG_ENABLE_ARCMT=$(usex static-analyzer)
+ -DCLANG_ENABLE_STATIC_ANALYZER=$(usex static-analyzer)
+ -DCLANG_LIBDIR_SUFFIX="${NATIVE_LIBDIR#lib}"
+ )
+
+ # -- not needed when compiler-rt is built with host compiler --
+ # cmake passes host C*FLAGS to compiler-rt build
+ # which is performed using clang, so we need to filter out
+ # some flags clang does not support
+ # (if you know some more flags that don't work, let us know)
+ #filter-flags -msahf -frecord-gcc-switches
+ fi
+
+ cmake-utils_src_configure
+}
+
+multilib_src_compile() {
+ cmake-utils_src_compile
+
+ pax-mark m "${BUILD_DIR}"/bin/llvm-rtdyld
+ pax-mark m "${BUILD_DIR}"/bin/lli
+ pax-mark m "${BUILD_DIR}"/bin/lli-child-target
+
+ if use test; then
+ pax-mark m "${BUILD_DIR}"/unittests/ExecutionEngine/Orc/OrcJITTests
+ pax-mark m "${BUILD_DIR}"/unittests/ExecutionEngine/MCJIT/MCJITTests
+ pax-mark m "${BUILD_DIR}"/unittests/Support/SupportTests
+ fi
+}
+
+multilib_src_test() {
+ # respect TMPDIR!
+ local -x LIT_PRESERVES_TMP=1
+ local test_targets=( check )
+ # clang tests won't work on non-native ABI because we skip compiler-rt
+ multilib_is_native_abi && use clang && test_targets+=( check-clang )
+ cmake-utils_src_make "${test_targets[@]}"
+}
+
+src_install() {
+ local MULTILIB_CHOST_TOOLS=(
+ /usr/bin/llvm-config
+ )
+
+ local MULTILIB_WRAPPED_HEADERS=(
+ /usr/include/llvm/Config/config.h
+ /usr/include/llvm/Config/llvm-config.h
+ )
+
+ if use clang; then
+ # note: magic applied in multilib_src_install()!
+ CLANG_VERSION=3.8
+
+ MULTILIB_CHOST_TOOLS+=(
+ /usr/bin/clang
+ /usr/bin/clang++
+ /usr/bin/clang-cl
+ /usr/bin/clang-${CLANG_VERSION}
+ /usr/bin/clang++-${CLANG_VERSION}
+ /usr/bin/clang-cl-${CLANG_VERSION}
+ )
+
+ MULTILIB_WRAPPED_HEADERS+=(
+ /usr/include/clang/Config/config.h
+ )
+ fi
+
+ multilib-minimal_src_install
+}
+
+multilib_src_install() {
+ cmake-utils_src_install
+
+ if multilib_is_native_abi; then
+ # Install docs.
+ #use doc && dohtml -r "${S}"/docs/_build/html/
+
+ # Symlink the gold plugin.
+ if use gold; then
+ dodir "/usr/${CHOST}/binutils-bin/lib/bfd-plugins"
+ dosym "../../../../$(get_libdir)/LLVMgold.so" \
+ "/usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so"
+ fi
+ fi
+
+ # apply CHOST and CLANG_VERSION to clang executables
+ # they're statically linked so we don't have to worry about the lib
+ if use clang; then
+ local clang_tools=( clang clang++ clang-cl )
+ local i
+
+ # cmake gives us:
+ # - clang-X.Y
+ # - clang -> clang-X.Y
+ # - clang++, clang-cl -> clang
+ # we want to have:
+ # - clang-X.Y
+ # - clang++-X.Y, clang-cl-X.Y -> clang-X.Y
+ # - clang, clang++, clang-cl -> clang*-X.Y
+ # so we need to fix the two tools
+ for i in "${clang_tools[@]:1}"; do
+ rm "${ED%/}/usr/bin/${i}" || die
+ dosym "clang-${CLANG_VERSION}" "/usr/bin/${i}-${CLANG_VERSION}"
+ dosym "${i}-${CLANG_VERSION}" "/usr/bin/${i}"
+ done
+
+ # now prepend ${CHOST} and let the multilib-build.eclass symlink it
+ if ! multilib_is_native_abi; then
+ # non-native? let's replace it with a simple wrapper
+ for i in "${clang_tools[@]}"; do
+ rm "${ED%/}/usr/bin/${i}-${CLANG_VERSION}" || die
+ cat > "${T}"/wrapper.tmp <<-_EOF_
+ #!${EPREFIX}/bin/sh
+ exec "${i}-${CLANG_VERSION}" $(get_abi_CFLAGS) "\${@}"
+ _EOF_
+ newbin "${T}"/wrapper.tmp "${i}-${CLANG_VERSION}"
+ done
+ fi
+ fi
+}
+
+multilib_src_install_all() {
+ insinto /usr/share/vim/vimfiles
+ doins -r utils/vim/*/
+ # some users may find it useful
+ dodoc utils/vim/vimrc
+
+ if use clang; then
+ pushd tools/clang >/dev/null || die
+
+ if use static-analyzer ; then
+ pushd tools/scan-build >/dev/null || die
+
+ dobin ccc-analyzer scan-build
+ dosym ccc-analyzer /usr/bin/c++-analyzer
+ doman scan-build.1
+
+ insinto /usr/share/llvm
+ doins scanview.css sorttable.js
+
+ popd >/dev/null || die
+ fi
+
+ python_inst() {
+ if use static-analyzer ; then
+ pushd tools/scan-view >/dev/null || die
+
+ python_doscript scan-view
+
+ touch __init__.py || die
+ python_moduleinto clang
+ python_domodule *.py Resources
+
+ popd >/dev/null || die
+ fi
+
+ if use python ; then
+ pushd bindings/python/clang >/dev/null || die
+
+ python_moduleinto clang
+ python_domodule *.py
+
+ popd >/dev/null || die
+ fi
+
+ # AddressSanitizer symbolizer (currently separate)
+ python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
+ }
+ python_foreach_impl python_inst
+ popd >/dev/null || die
+ fi
+}
diff --git a/sys-devel/llvm/metadata.xml b/sys-devel/llvm/metadata.xml
new file mode 100644
index 000000000000..53210f753014
--- /dev/null
+++ b/sys-devel/llvm/metadata.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>voyageur@gentoo.org</email>
+ <name>Bernard Cafarelli</name>
+ </maintainer>
+ <maintainer>
+ <email>mgorny@gentoo.org</email>
+ <name>Michał Górny</name>
+ </maintainer>
+ <longdescription>Low Level Virtual Machine (LLVM) is:
+ 1. A compilation strategy designed to enable effective program optimization across the entire lifetime of a program. LLVM supports effective optimization at compile time, link-time (particularly interprocedural), run-time and offline (i.e., after software is installed), while remaining transparent to developers and maintaining compatibility with existing build scripts.
+ 2. A virtual instruction set - LLVM is a low-level object code representation that uses simple RISC-like instructions, but provides rich, language-independent, type information and dataflow (SSA) information about operands. This combination enables sophisticated transformations on object code, while remaining light-weight enough to be attached to the executable. This combination is key to allowing link-time, run-time, and offline transformations.
+ 3. A compiler infrastructure - LLVM is also a collection of source code that implements the language and compilation strategy. The primary components of the LLVM infrastructure are a GCC-based C and C++ front-end, a link-time optimization framework with a growing set of global and interprocedural analyses and transformations, static back-ends for many popular (and some obscure) architectures, a back-end which emits portable C code, and a Just-In-Time compilers for several architectures.
+ 4. LLVM does not imply things that you would expect from a high-level virtual machine. It does not require garbage collection or run-time code generation (In fact, LLVM makes a great static compiler!). Note that optional LLVM components can be used to build high-level virtual machines and other systems that need these services.</longdescription>
+ <use>
+ <flag name='clang'>Build the clang C/C++ compiler</flag>
+ <flag name='cmake'>Enable cmake support (experimental)</flag>
+ <flag name='doc'>Build and install the HTML documentation and regenerate the man pages</flag>
+ <flag name='gold'>Build the gold linker plugin</flag>
+ <flag name='lldb'>Build the lldb debugger</flag>
+ <flag name='multitarget'>Build all host targets (default: host only)</flag>
+ <flag name='ncurses'>Support querying terminal properties using ncurses' terminfo</flag>
+ <flag name='static-analyzer'>Install the Clang static analyzer (requires USE=clang)</flag>
+ <flag name='udis86'>Enable support for <pkg>dev-libs/udis86</pkg> disassembler library</flag>
+ </use>
+</pkgmetadata>
diff --git a/sys-devel/m4/Manifest b/sys-devel/m4/Manifest
new file mode 100644
index 000000000000..a2caf523c174
--- /dev/null
+++ b/sys-devel/m4/Manifest
@@ -0,0 +1,2 @@
+DIST m4-1.4.16.tar.xz 1005264 SHA256 d5b5d51cf8f5b18f3bac39bc2f6b1e61f34d400136ae1a87d075e26a38028d5d SHA512 1123671ab3e0b1b13a4a08035e792a93af0d7d0a5b9027982fe7b5104488a0746906068a0f4774c1f1bc2648ba1bc74d690836e90ff9391464278e4ccbc7edf0 WHIRLPOOL 0438098dab71f6a66c2b18aed2941ef9a2152a8061c2f9903373a1348b261354429806c2bd313f55c7aaa612fe4c2f7628a1fff3c80819565df2a3b664485c23
+DIST m4-1.4.17.tar.xz 1149088 SHA256 f0543c3beb51fa6b3337d8025331591e0e18d8ec2886ed391f1aade43477d508 SHA512 406e6e97c3f5c5f3c8055bac748d4fe8c2e861d97e84ab6d840a2caa7df04f523cc662d6d51f6afae7d6c219d03693c7ae0c1e669a80246a3ceb5e8342b82389 WHIRLPOOL 69a9f9129dd2f2fd0f5d61771cbac2208f10aa83e0d42fe4213eb10283cc68ce1a96717aece99e92890a4135eb7e201c638d4d9bc17ac10026b0989f3a64940e
diff --git a/sys-devel/m4/files/m4-1.4.16-fix-test-readlink.patch b/sys-devel/m4/files/m4-1.4.16-fix-test-readlink.patch
new file mode 100644
index 000000000000..bb887c4b2305
--- /dev/null
+++ b/sys-devel/m4/files/m4-1.4.16-fix-test-readlink.patch
@@ -0,0 +1,11 @@
+--- tests/test-readlink.h
++++ tests/test-readlink.h
+@@ -38,7 +38,7 @@
+ ASSERT (errno == ENOENT);
+ errno = 0;
+ ASSERT (func ("", buf, sizeof buf) == -1);
+- ASSERT (errno == ENOENT);
++ ASSERT (errno == ENOENT || errno == EINVAL);
+ errno = 0;
+ ASSERT (func (".", buf, sizeof buf) == -1);
+ ASSERT (errno == EINVAL);
diff --git a/sys-devel/m4/files/m4-1.4.16-no-gets.patch b/sys-devel/m4/files/m4-1.4.16-no-gets.patch
new file mode 100644
index 000000000000..bb8069b8e766
--- /dev/null
+++ b/sys-devel/m4/files/m4-1.4.16-no-gets.patch
@@ -0,0 +1,24 @@
+https://bugs.gentoo.org/424978
+
+hack until m4 pulls a newer gnulib version
+
+From 66712c23388e93e5c518ebc8515140fa0c807348 Mon Sep 17 00:00:00 2001
+From: Eric Blake <eblake@redhat.com>
+Date: Thu, 29 Mar 2012 13:30:41 -0600
+Subject: [PATCH] stdio: don't assume gets any more
+
+Gnulib intentionally does not have a gets module, and now that C11
+and glibc have dropped it, we should be more proactive about warning
+any user on a platform that still has a declaration of this dangerous
+interface.
+
+--- a/lib/stdio.in.h
++++ b/lib/stdio.in.h
+@@ -125,7 +125,6 @@
+ so any use of gets warrants an unconditional warning. Assume it is
+ always declared, since it is required by C89. */
+ #undef gets
+-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+
+ #if @GNULIB_FOPEN@
+ # if @REPLACE_FOPEN@
diff --git a/sys-devel/m4/m4-1.4.16.ebuild b/sys-devel/m4/m4-1.4.16.ebuild
new file mode 100644
index 000000000000..d294758daab9
--- /dev/null
+++ b/sys-devel/m4/m4-1.4.16.ebuild
@@ -0,0 +1,55 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils
+
+DESCRIPTION="GNU macro processor"
+HOMEPAGE="http://www.gnu.org/software/m4/m4.html"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~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="examples"
+
+# remember: cannot dep on autoconf since it needs us
+DEPEND="app-arch/xz-utils"
+RDEPEND=""
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-fix-test-readlink.patch #376639
+ epatch "${FILESDIR}"/${P}-no-gets.patch #424978
+
+ # Disable gnulib build test that has no impact on the source.
+ echo 'exit 0' > tests/test-update-copyright.sh || die
+}
+
+src_configure() {
+ # Disable automagic dependency over libsigsegv; see bug #278026
+ export ac_cv_libsigsegv=no
+
+ local myconf=""
+ [[ ${USERLAND} != "GNU" ]] && myconf="--program-prefix=g"
+ econf --enable-changeword ${myconf}
+}
+
+src_test() {
+ [[ -d /none ]] && die "m4 tests will fail with /none/" #244396
+ emake check || die
+}
+
+src_install() {
+ emake install DESTDIR="${D}" || die
+ # autoconf-2.60 for instance, first checks gm4, then m4. If we don't have
+ # gm4, it might find gm4 from outside the prefix on for instance Darwin
+ use prefix && dosym /usr/bin/m4 /usr/bin/gm4
+ dodoc BACKLOG ChangeLog NEWS README* THANKS TODO
+ if use examples ; then
+ docinto examples
+ dodoc examples/*
+ rm -f "${ED}"/usr/share/doc/${PF}/examples/Makefile*
+ fi
+}
diff --git a/sys-devel/m4/m4-1.4.17.ebuild b/sys-devel/m4/m4-1.4.17.ebuild
new file mode 100644
index 000000000000..265d7ee829ac
--- /dev/null
+++ b/sys-devel/m4/m4-1.4.17.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+DESCRIPTION="GNU macro processor"
+HOMEPAGE="http://www.gnu.org/software/m4/m4.html"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~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="examples"
+
+# remember: cannot dep on autoconf since it needs us
+DEPEND="app-arch/xz-utils"
+RDEPEND=""
+
+src_prepare() {
+ # Disable gnulib build test that has no impact on the source.
+ # Re-enable w/next version bump (and gnulib is updated). #554728
+ [[ ${PV} != "1.4.17" ]] && die "re-enable test #554728"
+ echo 'exit 0' > tests/test-update-copyright.sh || die
+}
+
+src_configure() {
+ # Disable automagic dependency over libsigsegv; see bug #278026
+ export ac_cv_libsigsegv=no
+
+ local myconf=""
+ [[ ${USERLAND} != "GNU" ]] && myconf="--program-prefix=g"
+ econf --enable-changeword ${myconf}
+}
+
+src_test() {
+ [[ -d /none ]] && die "m4 tests will fail with /none/" #244396
+ emake check
+}
+
+src_install() {
+ default
+ # autoconf-2.60 for instance, first checks gm4, then m4. If we don't have
+ # gm4, it might find gm4 from outside the prefix on for instance Darwin
+ use prefix && dosym /usr/bin/m4 /usr/bin/gm4
+ if use examples ; then
+ docinto examples
+ dodoc examples/*
+ rm -f "${ED}"/usr/share/doc/${PF}/examples/Makefile*
+ fi
+}
diff --git a/sys-devel/m4/metadata.xml b/sys-devel/m4/metadata.xml
new file mode 100644
index 000000000000..96a2d586367d
--- /dev/null
+++ b/sys-devel/m4/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-devel/make/Manifest b/sys-devel/make/Manifest
new file mode 100644
index 000000000000..67dadb7a6807
--- /dev/null
+++ b/sys-devel/make/Manifest
@@ -0,0 +1,5 @@
+DIST make-3.80.tar.bz2 920645 SHA256 a99b39e7b04c333724f48c38fede709481cfb69fafe7e32ae4285b7fadf92f1b
+DIST make-3.81.tar.bz2 1151445 SHA256 f3e69023771e23908f5d5592954d8271d3d6af09693cecfd29cee6fde8550dc8 SHA512 f38b8219a966b4756149a13435f5b9dc760814aa62c6add8e1760e602f65a83cd0a45ed457a5dbdd2fab91043af4de2c60e62154f95c6b625af3703c824eb653 WHIRLPOOL 39d33b8b9136a3a8cf732fe8f437729ab5d487dc3e6dca0cad6dcdea256eec799d19c6c8d2591c3b526e7bd4fdd901ca7eb1d9e77e525454a3e52e17fd181ce7
+DIST make-3.82.tar.bz2 1242186 SHA256 e2c1a73f179c40c71e2fe8abf8a8a0688b8499538512984da4a76958d0402966 SHA512 3260be0d1a9a7c5eb0dbb87179a9a9521fdfc7809ca51f13ee5a37ba5e63d21ad50a4249ec7d3929a9d0ce8c8f6cf302558743964f0f7ff742efe283b91df9de WHIRLPOOL 0b6b5f95f33e0e5584cddad234afb2350bbf62f2a9c280703345100eba7867d80412cbe1b22f429eb32db43dd37e665e0f136d0262ee3f030cf384f77e99d1cb
+DIST make-4.0.tar.bz2 1341927 SHA256 e60686c7afede62cc8c86ad3012cf081ea4887daf9d223ce7115703b2bb2dbdb SHA512 82de265963cd08701491e02a4917cd2097762657257a9508119e5847050d0cb15580c163159463e822860435c5910190677d8e4aba644ba75df2895f26117376 WHIRLPOOL 96984c0493651bf27db3ddd6fadde25678e512d4d134fd7063cc5cd54bff6228543c98463835940e19e1cc79a67e22067c889efd460b355438670a4d42ce0d09
+DIST make-4.1.tar.bz2 1327342 SHA256 0bc7613389650ee6a24554b52572a272f7356164fd2c4132b0bcf13123e4fca5 SHA512 3fcaf06660b7a5019937b81ee69fe54cdfe0a24d66286fc5cc6a34fa996d76dfe6fd5bc49ee59b727ae2b24ddca261ada0fdb5873ba2b38dcc63647ad3cdb193 WHIRLPOOL 992ae4e6dc5e82bb4dc1b5c0840fbc519769114e61233c2d1cf9badfd0cf52a618fde290cef6cdc13d6c098aea9a67c414655513acefb1d44b031e14fe43d544
diff --git a/sys-devel/make/files/3.80-memory.patch b/sys-devel/make/files/3.80-memory.patch
new file mode 100644
index 000000000000..663acf52d77c
--- /dev/null
+++ b/sys-devel/make/files/3.80-memory.patch
@@ -0,0 +1,77 @@
+Index: variable.h
+===================================================================
+RCS file: /cvsroot/make/make/variable.h,v
+retrieving revision 1.24
+diff -u -B -b -r1.24 variable.h
+--- variable.h 8 Aug 2002 00:11:19 -0000 1.24
++++ variable.h 25 Oct 2002 21:37:32 -0000
+@@ -107,6 +107,8 @@
+ extern char *expand_argument PARAMS ((char *str, char *end));
+ extern char *variable_expand_string PARAMS ((char *line, char *string,
+ long length));
++extern void install_variable_buffer PARAMS ((char **bufp, unsigned int *lenp));
++extern void restore_variable_buffer PARAMS ((char *buf, unsigned int len));
+
+ /* function.c */
+ extern int handle_function PARAMS ((char **op, char **stringp));
+Index: expand.c
+===================================================================
+RCS file: /cvsroot/make/make/expand.c,v
+retrieving revision 1.33
+diff -u -B -b -r1.33 expand.c
+--- expand.c 14 Oct 2002 21:54:04 -0000 1.33
++++ expand.c 25 Oct 2002 21:37:32 -0000
+@@ -545,3 +545,28 @@
+
+ return value;
+ }
++
++/* Install a new variable_buffer context, returning the current one for
++ safe-keeping. */
++
++void
++install_variable_buffer (char **bufp, unsigned int *lenp)
++{
++ *bufp = variable_buffer;
++ *lenp = variable_buffer_length;
++
++ variable_buffer = 0;
++ initialize_variable_output ();
++}
++
++/* Restore a previously-saved variable_buffer setting (free the current one).
++ */
++
++void
++restore_variable_buffer (char *buf, unsigned int len)
++{
++ free (variable_buffer);
++
++ variable_buffer = buf;
++ variable_buffer_length = len;
++}
+Index: function.c
+===================================================================
+RCS file: /cvsroot/make/make/function.c,v
+retrieving revision 1.71
+diff -u -B -b -r1.71 function.c
+--- function.c 14 Oct 2002 21:54:04 -0000 1.71
++++ function.c 25 Oct 2002 21:37:32 -0000
+@@ -1196,7 +1196,17 @@
+ static char *
+ func_eval (char *o, char **argv, const char *funcname)
+ {
++ char *buf;
++ unsigned int len;
++
++ /* Eval the buffer. Pop the current variable buffer setting so that the
++ eval'd code can use its own without conflicting. */
++
++ install_variable_buffer (&buf, &len);
++
+ eval_buffer (argv[0]);
++
++ restore_variable_buffer (buf, len);
+
+ return o;
+ } \ No newline at end of file
diff --git a/sys-devel/make/files/make-3.80-conditional-eval.patch b/sys-devel/make/files/make-3.80-conditional-eval.patch
new file mode 100644
index 000000000000..f4c1581f316f
--- /dev/null
+++ b/sys-devel/make/files/make-3.80-conditional-eval.patch
@@ -0,0 +1,157 @@
+Fix from upstream
+
+https://savannah.gnu.org/bugs/index.php?func=detailitem&item_id=1516
+http://bugs.gentoo.org/123317
+
+Index: read.c
+===================================================================
+RCS file: /cvsroot/make/make/read.c,v
+retrieving revision 1.124
+retrieving revision 1.125
+diff -u -p -r1.124 -r1.125
+--- read.c 14 Oct 2002 21:54:04 -0000 1.124
++++ read.c 25 Oct 2002 22:01:47 -0000 1.125
+@@ -272,6 +272,34 @@ read_all_makefiles (char **makefiles)
+ return read_makefiles;
+ }
+
++/* Install a new conditional and return the previous one. */
++
++static struct conditionals *
++install_conditionals (struct conditionals *new)
++{
++ struct conditionals *save = conditionals;
++
++ bzero ((char *) new, sizeof (*new));
++ conditionals = new;
++
++ return save;
++}
++
++/* Free the current conditionals and reinstate a saved one. */
++
++static void
++restore_conditionals (struct conditionals *saved)
++{
++ /* Free any space allocated by conditional_line. */
++ if (conditionals->ignoring)
++ free (conditionals->ignoring);
++ if (conditionals->seen_else)
++ free (conditionals->seen_else);
++
++ /* Restore state. */
++ conditionals = saved;
++}
++
+ static int
+ eval_makefile (char *filename, int flags)
+ {
+@@ -388,6 +416,8 @@ int
+ eval_buffer (char *buffer)
+ {
+ struct ebuffer ebuf;
++ struct conditionals *saved;
++ struct conditionals new;
+ const struct floc *curfile;
+ int r;
+
+@@ -402,8 +432,12 @@ eval_buffer (char *buffer)
+ curfile = reading_file;
+ reading_file = &ebuf.floc;
+
++ saved = install_conditionals (&new);
++
+ r = eval (&ebuf, 1);
+
++ restore_conditionals (saved);
++
+ reading_file = curfile;
+
+ return r;
+@@ -412,13 +446,8 @@ eval_buffer (char *buffer)
+
+ /* Read file FILENAME as a makefile and add its contents to the data base.
+
+- SET_DEFAULT is true if we are allowed to set the default goal.
++ SET_DEFAULT is true if we are allowed to set the default goal. */
+
+- FILENAME is added to the `read_makefiles' chain.
+-
+- Returns 0 if a file was not found or not read.
+- Returns 1 if FILENAME was found and read.
+- Returns 2 if FILENAME was read, and we kept a reference (don't free it). */
+
+ static int
+ eval (struct ebuffer *ebuf, int set_default)
+@@ -782,9 +811,7 @@ eval (struct ebuffer *ebuf, int set_defa
+
+ /* Save the state of conditionals and start
+ the included makefile with a clean slate. */
+- save = conditionals;
+- bzero ((char *) &new_conditionals, sizeof new_conditionals);
+- conditionals = &new_conditionals;
++ save = install_conditionals (&new_conditionals);
+
+ /* Record the rules that are waiting so they will determine
+ the default goal before those in the included makefile. */
+@@ -810,14 +837,8 @@ eval (struct ebuffer *ebuf, int set_defa
+ }
+ }
+
+- /* Free any space allocated by conditional_line. */
+- if (conditionals->ignoring)
+- free (conditionals->ignoring);
+- if (conditionals->seen_else)
+- free (conditionals->seen_else);
+-
+- /* Restore state. */
+- conditionals = save;
++ /* Restore conditional state. */
++ restore_conditionals (save);
+
+ goto rule_complete;
+ }
+Index: tests/scripts/functions/eval
+===================================================================
+RCS file: /cvsroot/make/make/tests/scripts/functions/eval,v
+retrieving revision 1.1
+retrieving revision 1.2
+diff -u -p -r1.1 -r1.2
+--- tests/scripts/functions/eval 8 Jul 2002 02:26:48 -0000 1.1
++++ tests/scripts/functions/eval 25 Oct 2002 22:01:47 -0000 1.2
+@@ -57,4 +57,35 @@ $answer = "A = A B = B\n";
+
+ &compare_output($answer,&get_logfile(1));
+
++# Test to make sure eval'ing inside conditionals works properly
++
++$makefile3 = &get_tmpfile;
++
++open(MAKEFILE,"> $makefile3");
++
++print MAKEFILE <<'EOF';
++FOO = foo
++
++all:: ; @echo it
++
++define Y
++ all:: ; @echo worked
++endef
++
++ifdef BAR
++$(eval $(Y))
++endif
++
++EOF
++
++close(MAKEFILE);
++
++&run_make_with_options($makefile3, "", &get_logfile);
++$answer = "it\n";
++&compare_output($answer,&get_logfile(1));
++
++&run_make_with_options($makefile3, "BAR=1", &get_logfile);
++$answer = "it\nworked\n";
++&compare_output($answer,&get_logfile(1));
++
+ 1;
diff --git a/sys-devel/make/files/make-3.80-parallel-build-failure.patch b/sys-devel/make/files/make-3.80-parallel-build-failure.patch
new file mode 100644
index 000000000000..717e0f3556ce
--- /dev/null
+++ b/sys-devel/make/files/make-3.80-parallel-build-failure.patch
@@ -0,0 +1,59 @@
+http://lists.gnu.org/archive/html/bug-make/2005-07/msg00050.html
+http://lists.gnu.org/archive/html/bug-make/2005-08/msg00019.html
+http://bugs.gentoo.org/107613
+
+2005-08-07 Paul D. Smith <psmith@gnu.org>
+
+ Fix a bug reported by Michael Matz <matz@suse.de>: patch included.
+ If make is running in parallel without -k and two jobs die in a
+ row, but not too close to each other, then make will quit without
+ waiting for the rest of the jobs to die.
+
+ * main.c (die): Don't reset err before calling reap_children() the
+ second time: we still want it to be in the error condition.
+ * job.c (reap_children): Use a static variable, rather than err,
+ to control whether or not the error message should be printed.
+
+Index: job.c
+===================================================================
+RCS file: /cvsroot/make/make/job.c,v
+retrieving revision 1.166
+retrieving revision 1.167
+diff -u -p -r1.166 -r1.167
+--- job.c 26 Jun 2005 03:31:30 -0000 1.166
++++ job.c 8 Aug 2005 05:08:00 -0000 1.167
+@@ -475,9 +479,14 @@ reap_children (int block, int err)
+
+ if (err && block)
+ {
+- /* We might block for a while, so let the user know why. */
++ static int printed = 0;
++
++ /* We might block for a while, so let the user know why.
++ Only print this message once no matter how many jobs are left. */
+ fflush (stdout);
+- error (NILF, _("*** Waiting for unfinished jobs...."));
++ if (!printed)
++ error (NILF, _("*** Waiting for unfinished jobs...."));
++ printed = 1;
+ }
+
+ /* We have one less dead child to reap. As noted in
+Index: main.c
+===================================================================
+RCS file: /cvsroot/make/make/main.c,v
+retrieving revision 1.210
+retrieving revision 1.211
+diff -u -p -r1.210 -r1.211
+--- main.c 12 Jul 2005 04:35:13 -0000 1.210
++++ main.c 8 Aug 2005 05:08:00 -0000 1.211
+@@ -2990,7 +2996,8 @@ die (int status)
+ print_version ();
+
+ /* Wait for children to die. */
+- for (err = (status != 0); job_slots_used > 0; err = 0)
++ err = (status != 0);
++ while (job_slots_used > 0)
+ reap_children (1, err);
+
+ /* Let the remote job module clean up its state. */
diff --git a/sys-devel/make/files/make-3.81-jobserver.patch b/sys-devel/make/files/make-3.81-jobserver.patch
new file mode 100644
index 000000000000..cd787ca769d2
--- /dev/null
+++ b/sys-devel/make/files/make-3.81-jobserver.patch
@@ -0,0 +1,19 @@
+related to bug #193258, but this is the final patch that Fedora went with
+
+--- make-3.81/main.c 2007-09-24 15:28:34.000000000 +0200
++++ make-3.81-pm/main.c 2007-09-24 15:32:50.000000000 +0200
+@@ -1669,8 +1669,12 @@ main (int argc, char **argv, char **envp
+
+ if (job_slots > 0)
+ {
+- close (job_fds[0]);
+- close (job_fds[1]);
++ if (restarts == 0)
++ {
++ close (job_fds[0]);
++ close (job_fds[1]);
++ }
++
+ job_fds[0] = job_fds[1] = -1;
+ free (jobserver_fds->list);
+ free (jobserver_fds);
diff --git a/sys-devel/make/files/make-3.81-long-cmdline.patch b/sys-devel/make/files/make-3.81-long-cmdline.patch
new file mode 100644
index 000000000000..9ceb5e8195e2
--- /dev/null
+++ b/sys-devel/make/files/make-3.81-long-cmdline.patch
@@ -0,0 +1,100 @@
+http://bugs.gentoo.org/301116
+
+tweaked a little to avoid regenerating autotools
+
+2009-07-29 Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de>
+
+ * configure.in: Check for sys/user.h and linux/binfmts.h
+ headers.
+ * job.c: Include them if available.
+ (construct_command_argv_internal): When constructing the command
+ line with 'sh -c', use multiple arguments together with eval
+ expansion to evade the Linux per-argument length limit
+ MAX_ARG_STRLEN if it is defined.
+ Problem reported against Automake by Xan Lopez <xan <at> gnome.org>.
+
+--- job.c.orig 2010-01-15 18:36:53.000000000 +0200
++++ job.c 2010-01-15 18:41:09.000000000 +0200
+@@ -29,6 +29,15 @@
+
+ #include <string.h>
+
++#if defined(__linux__) /* defined (HAVE_LINUX_BINFMTS_H) && defined (HAVE_SYS_USER_H) */
++#include <sys/user.h>
++#include <unistd.h>
++#ifndef PAGE_SIZE
++#define PAGE_SIZE sysconf(_SC_PAGE_SIZE)
++#endif
++#include <linux/binfmts.h>
++#endif
++
+ /* Default shell to use. */
+ #ifdef WINDOWS32
+ #include <windows.h>
+@@ -2697,9 +2702,19 @@
+ #endif
+ unsigned int line_len = strlen (line);
+
++#ifdef MAX_ARG_STRLEN
++ static char eval_line[] = "eval\\ \\\"set\\ x\\;\\ shift\\;\\ ";
++#define ARG_NUMBER_DIGITS 5
++#define EVAL_LEN (sizeof(eval_line)-1 + shell_len + 4 \
++ + (7 + ARG_NUMBER_DIGITS) * 2 * line_len / (MAX_ARG_STRLEN - 2))
++#else
++#define EVAL_LEN 0
++#endif
+ char *new_line = (char *) alloca (shell_len + (sizeof (minus_c) - 1)
+- + (line_len * 2) + 1);
++ + (line_len*2) + 1 + EVAL_LEN);
++
+ char *command_ptr = NULL; /* used for batch_mode_shell mode */
++ char *args_ptr;
+
+ # ifdef __EMX__ /* is this necessary? */
+ if (!unixy_shell)
+@@ -2712,6 +2727,30 @@
+ bcopy (minus_c, ap, sizeof (minus_c) - 1);
+ ap += sizeof (minus_c) - 1;
+ command_ptr = ap;
++
++#if !defined (WINDOWS32) && defined (MAX_ARG_STRLEN)
++ if (unixy_shell && line_len > MAX_ARG_STRLEN)
++ {
++ unsigned j;
++ memcpy (ap, eval_line, sizeof (eval_line) - 1);
++ ap += sizeof (eval_line) - 1;
++ for (j = 1; j <= 2 * line_len / (MAX_ARG_STRLEN - 2); j++)
++ ap += sprintf (ap, "\\$\\{%u\\}", j);
++ *ap++ = '\\';
++ *ap++ = '"';
++ *ap++ = ' ';
++ /* Copy only the first word of SHELL to $0. */
++ for (p = shell; *p != '\0'; ++p)
++ {
++ if (isspace ((unsigned char)*p))
++ break;
++ *ap++ = *p;
++ }
++ *ap++ = ' ';
++ }
++#endif
++ args_ptr = ap;
++
+ for (p = line; *p != '\0'; ++p)
+ {
+ if (restp != NULL && *p == '\n')
+@@ -2760,6 +2799,14 @@
+ }
+ #endif
+ *ap++ = *p;
++
++#if !defined (WINDOWS32) && defined (MAX_ARG_STRLEN)
++ if (unixy_shell && line_len > MAX_ARG_STRLEN && (ap - args_ptr > MAX_ARG_STRLEN - 2))
++ {
++ *ap++ = ' ';
++ args_ptr = ap;
++ }
++#endif
+ }
+ if (ap == new_line + shell_len + sizeof (minus_c) - 1)
+ /* Line was empty. */
diff --git a/sys-devel/make/files/make-3.81-tests-lang.patch b/sys-devel/make/files/make-3.81-tests-lang.patch
new file mode 100644
index 000000000000..f4e514712a0e
--- /dev/null
+++ b/sys-devel/make/files/make-3.81-tests-lang.patch
@@ -0,0 +1,55 @@
+Fix from upstream for running tests when LC_ALL is set to non-C
+
+http://bugs.gentoo.org/149147
+
+Index: make/tests/run_make_tests.pl
+===================================================================
+RCS file: /cvsroot/make/make/tests/run_make_tests.pl,v
+retrieving revision 1.22
+retrieving revision 1.23
+diff -u -p -r1.22 -r1.23
+--- make/tests/run_make_tests.pl 8 Mar 2006 20:15:09 -0000 1.22
++++ make/tests/run_make_tests.pl 1 Oct 2006 05:38:38 -0000 1.23
+@@ -228,11 +228,6 @@ sub set_more_defaults
+ local($string);
+ local($index);
+
+- # Make sure we're in the C locale for those systems that support it,
+- # so sorting, etc. is predictable.
+- #
+- $ENV{LANG} = 'C';
+-
+ # find the type of the port. We do this up front to have a single
+ # point of change if it needs to be tweaked.
+ #
+Index: make/tests/test_driver.pl
+===================================================================
+RCS file: /cvsroot/make/make/tests/test_driver.pl,v
+retrieving revision 1.19
+retrieving revision 1.20
+diff -u -p -r1.19 -r1.20
+--- make/tests/test_driver.pl 10 Mar 2006 02:20:45 -0000 1.19
++++ make/tests/test_driver.pl 1 Oct 2006 05:38:38 -0000 1.20
+@@ -78,9 +78,9 @@ sub resetENV
+ sub toplevel
+ {
+ # Pull in benign variables from the user's environment
+- #
++
+ foreach (# UNIX-specific things
+- 'TZ', 'LANG', 'TMPDIR', 'HOME', 'USER', 'LOGNAME', 'PATH',
++ 'TZ', 'TMPDIR', 'HOME', 'USER', 'LOGNAME', 'PATH',
+ # Purify things
+ 'PURIFYOPTIONS',
+ # Windows NT-specific stuff
+@@ -92,6 +92,10 @@ sub toplevel
+ $makeENV{$_} = $ENV{$_} if $ENV{$_};
+ }
+
++ # Make sure our compares are not foiled by locale differences
++
++ $makeENV{LC_ALL} = 'C';
++
+ # Replace the environment with the new one
+ #
+ %origENV = %ENV;
diff --git a/sys-devel/make/files/make-3.81-tests-recursion.patch b/sys-devel/make/files/make-3.81-tests-recursion.patch
new file mode 100644
index 000000000000..490e2a912cd8
--- /dev/null
+++ b/sys-devel/make/files/make-3.81-tests-recursion.patch
@@ -0,0 +1,14 @@
+http://bugs.gentoo.org/329153
+https://savannah.gnu.org/bugs/index.php?29968
+
+--- tests/scripts/features/recursion 2005/02/10 00:10:58 1.2
++++ tests/scripts/features/recursion 2010/07/01 07:16:00 1.3
+@@ -16,7 +16,7 @@
+ @echo MAKELEVEL = $(MAKELEVEL)
+ @echo THE END
+ ',
+- ('CFLAGS=-O -w' . ($parallel_jobs ? '-j 2' : '')),
++ ('CFLAGS=-O -w' . ($parallel_jobs ? ' -j 2' : '')),
+ ($vos
+ ? "#MAKE#: Entering directory `#PWD#'
+ make 'CFLAGS=-O' -f #MAKEFILE# foo
diff --git a/sys-devel/make/files/make-3.82-MAKEFLAGS-reexec.patch b/sys-devel/make/files/make-3.82-MAKEFLAGS-reexec.patch
new file mode 100644
index 000000000000..a2f59657d4ca
--- /dev/null
+++ b/sys-devel/make/files/make-3.82-MAKEFLAGS-reexec.patch
@@ -0,0 +1,14 @@
+http://bugs.gentoo.org/331975
+https://savannah.gnu.org/bugs/?30723
+
+--- main.c 2010/07/19 07:10:53 1.243
++++ main.c 2010/08/10 07:35:34 1.244
+@@ -2093,7 +2093,7 @@
+ const char *pv = define_makeflags (1, 1);
+ char *p = alloca (sizeof ("MAKEFLAGS=") + strlen (pv) + 1);
+ sprintf (p, "MAKEFLAGS=%s", pv);
+- putenv (p);
++ putenv (allocated_variable_expand (p));
+ }
+
+ if (ISDB (DB_BASIC))
diff --git a/sys-devel/make/files/make-3.82-archives-many-objs.patch b/sys-devel/make/files/make-3.82-archives-many-objs.patch
new file mode 100644
index 000000000000..abdcd3228014
--- /dev/null
+++ b/sys-devel/make/files/make-3.82-archives-many-objs.patch
@@ -0,0 +1,60 @@
+http://bugs.gentoo.org/334889
+https://savannah.gnu.org/bugs/?30612
+
+revision 1.194
+date: 2010-08-13 22:50:14 -0400; author: psmith; state: Exp; lines: +9 -6; commitid: 4UaslPqQHZTs5wKu;
+- Fix Savannah bug #30612: handling of archive references with >1 object
+
+Index: read.c
+===================================================================
+RCS file: /sources/make/make/read.c,v
+retrieving revision 1.193
+retrieving revision 1.194
+diff -u -p -r1.193 -r1.194
+--- read.c 13 Jul 2010 01:20:42 -0000 1.193
++++ read.c 14 Aug 2010 02:50:14 -0000 1.194
+@@ -3028,7 +3028,7 @@ parse_file_seq (char **stringp, unsigned
+ {
+ /* This looks like the first element in an open archive group.
+ A valid group MUST have ')' as the last character. */
+- const char *e = p + nlen;
++ const char *e = p;
+ do
+ {
+ e = next_token (e);
+@@ -3084,19 +3084,19 @@ parse_file_seq (char **stringp, unsigned
+ Go to the next item in the string. */
+ if (flags & PARSEFS_NOGLOB)
+ {
+- NEWELT (concat (2, prefix, tp));
++ NEWELT (concat (2, prefix, tmpbuf));
+ continue;
+ }
+
+ /* If we get here we know we're doing glob expansion.
+ TP is a string in tmpbuf. NLEN is no longer used.
+ We may need to do more work: after this NAME will be set. */
+- name = tp;
++ name = tmpbuf;
+
+ /* Expand tilde if applicable. */
+- if (tp[0] == '~')
++ if (tmpbuf[0] == '~')
+ {
+- tildep = tilde_expand (tp);
++ tildep = tilde_expand (tmpbuf);
+ if (tildep != 0)
+ name = tildep;
+ }
+@@ -3152,7 +3152,10 @@ parse_file_seq (char **stringp, unsigned
+ else
+ {
+ /* We got a chain of items. Attach them. */
+- (*newp)->next = found;
++ if (*newp)
++ (*newp)->next = found;
++ else
++ *newp = found;
+
+ /* Find and set the new end. Massage names if necessary. */
+ while (1)
diff --git a/sys-devel/make/files/make-3.82-construct-command-line.patch b/sys-devel/make/files/make-3.82-construct-command-line.patch
new file mode 100644
index 000000000000..c504c45291ba
--- /dev/null
+++ b/sys-devel/make/files/make-3.82-construct-command-line.patch
@@ -0,0 +1,71 @@
+https://savannah.gnu.org/bugs/?23922
+
+From 6f3684710a0f832533191f8657a57bc2fbba90ba Mon Sep 17 00:00:00 2001
+From: eliz <eliz>
+Date: Sat, 7 May 2011 08:29:13 +0000
+Subject: [PATCH] job.c (construct_command_argv_internal): Don't assume
+ shellflags is always non-NULL. Escape-protect characters
+ special to the shell when copying the value of SHELL into
+ new_line. Fixes Savannah bug #23922.
+
+---
+ ChangeLog | 7 +++++++
+ job.c | 23 ++++++++++++++++-------
+ 2 files changed, 23 insertions(+), 7 deletions(-)
+
+diff --git a/job.c b/job.c
+index 67b402d..c2ce84d 100644
+--- a/job.c
++++ b/job.c
+@@ -2844,12 +2844,12 @@ construct_command_argv_internal (char *line, char **restp, char *shell,
+
+ unsigned int shell_len = strlen (shell);
+ unsigned int line_len = strlen (line);
+- unsigned int sflags_len = strlen (shellflags);
++ unsigned int sflags_len = shellflags ? strlen (shellflags) : 0;
+ char *command_ptr = NULL; /* used for batch_mode_shell mode */
+ char *new_line;
+
+ # ifdef __EMX__ /* is this necessary? */
+- if (!unixy_shell)
++ if (!unixy_shell && shellflags)
+ shellflags[0] = '/'; /* "/c" */
+ # endif
+
+@@ -2911,19 +2911,28 @@ construct_command_argv_internal (char *line, char **restp, char *shell,
+
+ new_argv = xmalloc (4 * sizeof (char *));
+ new_argv[0] = xstrdup(shell);
+- new_argv[1] = xstrdup(shellflags);
++ new_argv[1] = xstrdup(shellflags ? shellflags : "");
+ new_argv[2] = line;
+ new_argv[3] = NULL;
+ return new_argv;
+ }
+
+- new_line = alloca (shell_len + 1 + sflags_len + 1
++ new_line = alloca ((shell_len*2) + 1 + sflags_len + 1
+ + (line_len*2) + 1);
+ ap = new_line;
+- memcpy (ap, shell, shell_len);
+- ap += shell_len;
++ /* Copy SHELL, escaping any characters special to the shell. If
++ we don't escape them, construct_command_argv_internal will
++ recursively call itself ad nauseam, or until stack overflow,
++ whichever happens first. */
++ for (p = shell; *p != '\0'; ++p)
++ {
++ if (strchr (sh_chars, *p) != 0)
++ *(ap++) = '\\';
++ *(ap++) = *p;
++ }
+ *(ap++) = ' ';
+- memcpy (ap, shellflags, sflags_len);
++ if (shellflags)
++ memcpy (ap, shellflags, sflags_len);
+ ap += sflags_len;
+ *(ap++) = ' ';
+ command_ptr = ap;
+--
+1.7.12
+
diff --git a/sys-devel/make/files/make-3.82-copy-on-expand.patch b/sys-devel/make/files/make-3.82-copy-on-expand.patch
new file mode 100644
index 000000000000..3f202b4db96b
--- /dev/null
+++ b/sys-devel/make/files/make-3.82-copy-on-expand.patch
@@ -0,0 +1,58 @@
+fix from upstream cvs
+
+----------------------------
+revision 1.58
+date: 2011-08-29 12:20:19 -0400; author: psmith; state: Exp; lines: +7 -13; commitid: MdH0jSxpuIy7mqxv;
+Save strings we're expanding in case an embedded eval causes them
+to be freed (if they're the value of a variable that's reset for example).
+See Savannah patch #7534
+
+Index: expand.c
+===================================================================
+RCS file: /sources/make/make/expand.c,v
+retrieving revision 1.57
+retrieving revision 1.58
+diff -u -p -r1.57 -r1.58
+--- expand.c 7 May 2011 20:03:49 -0000 1.57
++++ expand.c 29 Aug 2011 16:20:19 -0000 1.58
+@@ -197,7 +197,7 @@ variable_expand_string (char *line, cons
+ {
+ struct variable *v;
+ const char *p, *p1;
+- char *abuf = NULL;
++ char *save;
+ char *o;
+ unsigned int line_offset;
+
+@@ -212,16 +212,11 @@ variable_expand_string (char *line, cons
+ return (variable_buffer);
+ }
+
+- /* If we want a subset of the string, allocate a temporary buffer for it.
+- Most of the functions we use here don't work with length limits. */
+- if (length > 0 && string[length] != '\0')
+- {
+- abuf = xmalloc(length+1);
+- memcpy(abuf, string, length);
+- abuf[length] = '\0';
+- string = abuf;
+- }
+- p = string;
++ /* We need a copy of STRING: due to eval, it's possible that it will get
++ freed as we process it (it might be the value of a variable that's reset
++ for example). Also having a nil-terminated string is handy. */
++ save = length < 0 ? xstrdup (string) : xstrndup (string, length);
++ p = save;
+
+ while (1)
+ {
+@@ -411,8 +406,7 @@ variable_expand_string (char *line, cons
+ ++p;
+ }
+
+- if (abuf)
+- free (abuf);
++ free (save);
+
+ variable_buffer_output (o, "", 1);
+ return (variable_buffer + line_offset);
diff --git a/sys-devel/make/files/make-3.82-darwin-library_search-dylib.patch b/sys-devel/make/files/make-3.82-darwin-library_search-dylib.patch
new file mode 100644
index 000000000000..de7e4f615212
--- /dev/null
+++ b/sys-devel/make/files/make-3.82-darwin-library_search-dylib.patch
@@ -0,0 +1,17 @@
+Fixed default libpatttern on Darwin, imported from prefix overlay.
+Got merged upstream:
+https://savannah.gnu.org/bugs/?37197
+--- default.c.orig 2009-05-02 12:25:24 +0200
++++ default.c 2009-05-02 12:25:58 +0200
+@@ -509,7 +509,11 @@
+ #ifdef __MSDOS__
+ ".LIBPATTERNS", "lib%.a $(DJDIR)/lib/lib%.a",
+ #else
++#ifdef __APPLE__
++ ".LIBPATTERNS", "lib%.dylib lib%.a",
++#else
+ ".LIBPATTERNS", "lib%.so lib%.a",
++#endif
+ #endif
+ #endif
+
diff --git a/sys-devel/make/files/make-3.82-glob-speedup.patch b/sys-devel/make/files/make-3.82-glob-speedup.patch
new file mode 100644
index 000000000000..c826c2c0e1fa
--- /dev/null
+++ b/sys-devel/make/files/make-3.82-glob-speedup.patch
@@ -0,0 +1,104 @@
+change from upstream to speed up by skipping unused globs
+https://bugs.gentoo.org/382845
+
+http://cvs.savannah.gnu.org/viewvc/make/read.c?root=make&r1=1.198&r2=1.200
+
+Revision 1.200
+Sat May 7 14:36:12 2011 UTC (4 months, 1 week ago) by psmith
+Branch: MAIN
+Changes since 1.199: +1 -1 lines
+Inverted the boolean test from what I wanted it to be. Added a
+regression test to make sure this continues to work.
+
+Revision 1.199
+Mon May 2 00:18:06 2011 UTC (4 months, 2 weeks ago) by psmith
+Branch: MAIN
+Changes since 1.198: +35 -25 lines
+Avoid invoking glob() unless the filename has potential globbing
+characters in it, for performance improvements.
+
+--- a/read.c 2011/04/29 15:27:39 1.198
++++ b/read.c 2011/05/07 14:36:12 1.200
+@@ -2901,6 +2901,7 @@
+ const char *name;
+ const char **nlist = 0;
+ char *tildep = 0;
++ int globme = 1;
+ #ifndef NO_ARCHIVES
+ char *arname = 0;
+ char *memname = 0;
+@@ -3109,32 +3110,40 @@
+ }
+ #endif /* !NO_ARCHIVES */
+
+- switch (glob (name, GLOB_NOSORT|GLOB_ALTDIRFUNC, NULL, &gl))
+- {
+- case GLOB_NOSPACE:
+- fatal (NILF, _("virtual memory exhausted"));
+-
+- case 0:
+- /* Success. */
+- i = gl.gl_pathc;
+- nlist = (const char **)gl.gl_pathv;
+- break;
+-
+- case GLOB_NOMATCH:
+- /* If we want only existing items, skip this one. */
+- if (flags & PARSEFS_EXISTS)
+- {
+- i = 0;
+- break;
+- }
+- /* FALLTHROUGH */
+-
+- default:
+- /* By default keep this name. */
++ /* glob() is expensive: don't call it unless we need to. */
++ if (!(flags & PARSEFS_EXISTS) && strpbrk (name, "?*[") == NULL)
++ {
++ globme = 0;
+ i = 1;
+ nlist = &name;
+- break;
+- }
++ }
++ else
++ switch (glob (name, GLOB_NOSORT|GLOB_ALTDIRFUNC, NULL, &gl))
++ {
++ case GLOB_NOSPACE:
++ fatal (NILF, _("virtual memory exhausted"));
++
++ case 0:
++ /* Success. */
++ i = gl.gl_pathc;
++ nlist = (const char **)gl.gl_pathv;
++ break;
++
++ case GLOB_NOMATCH:
++ /* If we want only existing items, skip this one. */
++ if (flags & PARSEFS_EXISTS)
++ {
++ i = 0;
++ break;
++ }
++ /* FALLTHROUGH */
++
++ default:
++ /* By default keep this name. */
++ i = 1;
++ nlist = &name;
++ break;
++ }
+
+ /* For each matched element, add it to the list. */
+ while (i-- > 0)
+@@ -3174,7 +3183,8 @@
+ #endif /* !NO_ARCHIVES */
+ NEWELT (concat (2, prefix, nlist[i]));
+
+- globfree (&gl);
++ if (globme)
++ globfree (&gl);
+
+ #ifndef NO_ARCHIVES
+ if (arname)
diff --git a/sys-devel/make/files/make-3.82-intermediate-parallel.patch b/sys-devel/make/files/make-3.82-intermediate-parallel.patch
new file mode 100644
index 000000000000..df9b8d475b95
--- /dev/null
+++ b/sys-devel/make/files/make-3.82-intermediate-parallel.patch
@@ -0,0 +1,62 @@
+https://savannah.gnu.org/bugs/?30653
+https://bugs.gentoo.org/431250
+
+From d1ba0ee36b2bdd91434b5df90f0f4cceda7d6979 Mon Sep 17 00:00:00 2001
+From: psmith <psmith>
+Date: Mon, 10 Sep 2012 02:36:05 +0000
+Subject: [PATCH] Force intermediate targets to be considered if their
+ non-intermediate parent needs to be remade. Fixes Savannah
+ bug #30653.
+
+---
+ ChangeLog | 4 ++++
+ remake.c | 4 ++++
+ tests/scripts/features/parallelism | 17 +++++++++++++++++
+ 3 files changed, 25 insertions(+)
+
+diff --git a/remake.c b/remake.c
+index c0bf709..b1ddd23 100644
+--- a/remake.c
++++ b/remake.c
+@@ -612,6 +612,10 @@ update_file_1 (struct file *file, unsigned int depth)
+ d->file->dontcare = file->dontcare;
+ }
+
++ /* We may have already considered this file, when we didn't know
++ we'd need to update it. Force update_file() to consider it and
++ not prune it. */
++ d->file->considered = !considered;
+
+ dep_status |= update_file (d->file, depth);
+
+diff --git a/tests/scripts/features/parallelism b/tests/scripts/features/parallelism
+index d4250f0..76d24a7 100644
+--- a/tests/scripts/features/parallelism
++++ b/tests/scripts/features/parallelism
+@@ -214,6 +214,23 @@ rm main.x");
+ rmfiles(qw(foo.y foo.y.in main.bar));
+ }
+
++# Ensure intermediate/secondary files are not pruned incorrectly.
++# See Savannah bug #30653
++
++utouch(-15, 'file2');
++utouch(-10, 'file4');
++utouch(-5, 'file1');
++
++run_make_test(q!
++.INTERMEDIATE: file3
++file4: file3 ; @mv -f $< $@
++file3: file2 ; touch $@
++file2: file1 ; @touch $@
++!,
++ '--no-print-directory -j2', "touch file3");
++
++#rmfiles('file1', 'file2', 'file3', 'file4');
++
+ if ($all_tests) {
+ # Jobserver FD handling is messed up in some way.
+ # Savannah bug #28189
+--
+1.7.12
+
diff --git a/sys-devel/make/files/make-3.82-long-command-line.patch b/sys-devel/make/files/make-3.82-long-command-line.patch
new file mode 100644
index 000000000000..9266786e4da7
--- /dev/null
+++ b/sys-devel/make/files/make-3.82-long-command-line.patch
@@ -0,0 +1,54 @@
+https://savannah.gnu.org/bugs/?36451
+
+From a95796de3a491d8acfc8ea94c217b90531161786 Mon Sep 17 00:00:00 2001
+From: psmith <psmith>
+Date: Sun, 9 Sep 2012 23:25:07 +0000
+Subject: [PATCH] Keep the command line on the heap to avoid stack overflow.
+ Fixes Savannah bug #36451.
+
+---
+ ChangeLog | 3 +++
+ job.c | 13 +++++++++----
+ 2 files changed, 12 insertions(+), 4 deletions(-)
+
+diff --git a/job.c b/job.c
+index 754576b..f7b7d51 100644
+--- a/job.c
++++ b/job.c
+@@ -2984,8 +2984,8 @@ construct_command_argv_internal (char *line, char **restp, char *shell,
+ return new_argv;
+ }
+
+- new_line = alloca ((shell_len*2) + 1 + sflags_len + 1
+- + (line_len*2) + 1);
++ new_line = xmalloc ((shell_len*2) + 1 + sflags_len + 1
++ + (line_len*2) + 1);
+ ap = new_line;
+ /* Copy SHELL, escaping any characters special to the shell. If
+ we don't escape them, construct_command_argv_internal will
+@@ -3052,8 +3052,11 @@ construct_command_argv_internal (char *line, char **restp, char *shell,
+ *ap++ = *p;
+ }
+ if (ap == new_line + shell_len + sflags_len + 2)
+- /* Line was empty. */
+- return 0;
++ {
++ /* Line was empty. */
++ free (new_line);
++ return 0;
++ }
+ *ap = '\0';
+
+ #ifdef WINDOWS32
+@@ -3194,6 +3197,8 @@ construct_command_argv_internal (char *line, char **restp, char *shell,
+ fatal (NILF, _("%s (line %d) Bad shell context (!unixy && !batch_mode_shell)\n"),
+ __FILE__, __LINE__);
+ #endif
++
++ free (new_line);
+ }
+ #endif /* ! AMIGA */
+
+--
+1.7.12
+
diff --git a/sys-devel/make/files/make-3.82-memory-corruption.patch b/sys-devel/make/files/make-3.82-memory-corruption.patch
new file mode 100644
index 000000000000..b28c07353ec2
--- /dev/null
+++ b/sys-devel/make/files/make-3.82-memory-corruption.patch
@@ -0,0 +1,37 @@
+--- function.c 2011/04/18 01:25:20 1.121
++++ function.c 2011/05/02 12:35:01 1.122
+@@ -706,7 +706,7 @@
+ const char *word_iterator = argv[0];
+ char buf[20];
+
+- while (find_next_token (&word_iterator, (unsigned int *) 0) != 0)
++ while (find_next_token (&word_iterator, NULL) != 0)
+ ++i;
+
+ sprintf (buf, "%d", i);
+@@ -1133,21 +1133,14 @@
+
+ /* Find the maximum number of words we'll have. */
+ t = argv[0];
+- wordi = 1;
+- while (*t != '\0')
++ wordi = 0;
++ while ((p = find_next_token (&t, NULL)) != 0)
+ {
+- char c = *(t++);
+-
+- if (! isspace ((unsigned char)c))
+- continue;
+-
++ ++t;
+ ++wordi;
+-
+- while (isspace ((unsigned char)*t))
+- ++t;
+ }
+
+- words = xmalloc (wordi * sizeof (char *));
++ words = xmalloc ((wordi == 0 ? 1 : wordi) * sizeof (char *));
+
+ /* Now assign pointers to each string in the array. */
+ t = argv[0];
diff --git a/sys-devel/make/files/make-3.82-oneshell.patch b/sys-devel/make/files/make-3.82-oneshell.patch
new file mode 100644
index 000000000000..fbade127ce61
--- /dev/null
+++ b/sys-devel/make/files/make-3.82-oneshell.patch
@@ -0,0 +1,24 @@
+fix from upstream cvs
+
+----------------------------
+revision 1.245
+date: 2010-08-13 22:50:14 -0400; author: psmith; state: Exp; lines: +1 -1; commitid: 4UaslPqQHZTs5wKu;
+- Add oneshell to $(.FEATURES) (forgot that!)
+
+Index: main.c
+===================================================================
+RCS file: /sources/make/make/main.c,v
+retrieving revision 1.244
+retrieving revision 1.245
+diff -u -p -r1.244 -r1.245
+--- main.c 10 Aug 2010 07:35:34 -0000 1.244
++++ main.c 14 Aug 2010 02:50:14 -0000 1.245
+@@ -1138,7 +1138,7 @@ main (int argc, char **argv, char **envp
+ a macro and some compilers (MSVC) don't like conditionals in macros. */
+ {
+ const char *features = "target-specific order-only second-expansion"
+- " else-if shortest-stem undefine"
++ " else-if shortest-stem undefine oneshell"
+ #ifndef NO_ARCHIVES
+ " archives"
+ #endif
diff --git a/sys-devel/make/files/make-3.82-parallel-remake.patch b/sys-devel/make/files/make-3.82-parallel-remake.patch
new file mode 100644
index 000000000000..a19fe7b7d629
--- /dev/null
+++ b/sys-devel/make/files/make-3.82-parallel-remake.patch
@@ -0,0 +1,39 @@
+fix from upstream cvs
+
+----------------------------
+revision 1.247
+date: 2011-09-18 19:39:26 -0400; author: psmith; state: Exp; lines: +5 -3; commitid: 07NxO4T5PiWC82Av;
+When we re-exec the master makefile in a jobserver environment, ensure
+that MAKEFLAGS is set properly so the re-exec'd make runs in parallel.
+See Savannah bug #33873.
+
+Index: main.c
+===================================================================
+RCS file: /sources/make/make/main.c,v
+retrieving revision 1.246
+retrieving revision 1.247
+diff -u -p -r1.246 -r1.247
+--- main.c 29 Aug 2010 23:05:27 -0000 1.246
++++ main.c 18 Sep 2011 23:39:26 -0000 1.247
+@@ -2089,6 +2089,11 @@ main (int argc, char **argv, char **envp
+
+ ++restarts;
+
++ /* If we're re-exec'ing the first make, put back the number of
++ job slots so define_makefiles() will get it right. */
++ if (master_job_slots)
++ job_slots = master_job_slots;
++
+ /* Reset makeflags in case they were changed. */
+ {
+ const char *pv = define_makeflags (1, 1);
+@@ -2825,9 +2830,6 @@ define_makeflags (int all, int makefile)
+ && (*(unsigned int *) cs->value_ptr ==
+ *(unsigned int *) cs->noarg_value))
+ ADD_FLAG ("", 0); /* Optional value omitted; see below. */
+- else if (cs->c == 'j')
+- /* Special case for `-j'. */
+- ADD_FLAG ("1", 1);
+ else
+ {
+ char *buf = alloca (30);
diff --git a/sys-devel/make/files/make-4.0-char-cast.patch b/sys-devel/make/files/make-4.0-char-cast.patch
new file mode 100644
index 000000000000..86505be5da47
--- /dev/null
+++ b/sys-devel/make/files/make-4.0-char-cast.patch
@@ -0,0 +1,46 @@
+http://savannah.gnu.org/bugs/?40371
+http://git.savannah.gnu.org/cgit/make.git/commit/?id=9d58570c
+
+From 9d58570c77240fed53d1f88217877f8e778f4bb2 Mon Sep 17 00:00:00 2001
+From: Paul Smith <psmith@gnu.org>
+Date: Sat, 26 Oct 2013 04:10:17 +0000
+Subject: * makeint.h (STOP_SET): [SV 40371] Cast to unsigned char.
+
+* tests/scripts/misc/utf8: Test variable names with characters >127.
+Fix suggested by Robert Bogomip <bob.bogo@milohedge.com>
+---
+diff --git a/makeint.h b/makeint.h
+index 77f51e0..c591427 100644
+--- a/makeint.h
++++ b/makeint.h
+@@ -415,7 +415,7 @@ extern int unixy_shell;
+ # define MAP_VMSCOMMA 0x0000
+ #endif
+
+-#define STOP_SET(_v,_m) ANY_SET (stopchar_map[(int)(_v)],(_m))
++#define STOP_SET(_v,_m) ANY_SET (stopchar_map[(unsigned char)(_v)],(_m))
+
+ #if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT)
+ # define SET_STACK_SIZE
+diff --git a/tests/scripts/misc/utf8 b/tests/scripts/misc/utf8
+new file mode 100644
+index 0000000..2adcd07
+--- a/dev/null
++++ b/tests/scripts/misc/utf8
+@@ -0,0 +1,14 @@
++# -*-perl-*-
++$description = "Test utf8 handling.";
++
++$details = "";
++
++# Variable names containing UTF8 characters
++run_make_test("
++\xe2\x96\xaa := hello
++\$(info \$(\xe2\x96\xaa))
++all:
++",
++ '', "hello\n#MAKE#: Nothing to be done for 'all'.");
++
++1;
+--
+cgit v0.9.0.2
diff --git a/sys-devel/make/files/make-4.1-fix_null_returns_from_ttyname.patch b/sys-devel/make/files/make-4.1-fix_null_returns_from_ttyname.patch
new file mode 100644
index 000000000000..f6be5c9f06af
--- /dev/null
+++ b/sys-devel/make/files/make-4.1-fix_null_returns_from_ttyname.patch
@@ -0,0 +1,53 @@
+From 292da6f6867b75a5af7ddbb639a1feae022f438f Mon Sep 17 00:00:00 2001
+From: Paul Smith <psmith@gnu.org>
+Date: Mon, 20 Oct 2014 05:54:56 +0000
+Subject: * main.c (main): [SV 43434] Handle NULL returns from ttyname().
+
+---
+diff --git a/main.c b/main.c
+index b2d169c..0cdb8a8 100644
+--- a/main.c
++++ b/main.c
+@@ -1429,13 +1429,18 @@ main (int argc, char **argv, char **envp)
+ #ifdef HAVE_ISATTY
+ if (isatty (fileno (stdout)))
+ if (! lookup_variable (STRING_SIZE_TUPLE ("MAKE_TERMOUT")))
+- define_variable_cname ("MAKE_TERMOUT", TTYNAME (fileno (stdout)),
+- o_default, 0)->export = v_export;
+-
++ {
++ const char *tty = TTYNAME (fileno (stdout));
++ define_variable_cname ("MAKE_TERMOUT", tty ? tty : DEFAULT_TTYNAME,
++ o_default, 0)->export = v_export;
++ }
+ if (isatty (fileno (stderr)))
+ if (! lookup_variable (STRING_SIZE_TUPLE ("MAKE_TERMERR")))
+- define_variable_cname ("MAKE_TERMERR", TTYNAME (fileno (stderr)),
+- o_default, 0)->export = v_export;
++ {
++ const char *tty = TTYNAME (fileno (stderr));
++ define_variable_cname ("MAKE_TERMERR", tty ? tty : DEFAULT_TTYNAME,
++ o_default, 0)->export = v_export;
++ }
+ #endif
+
+ /* Reset in case the switches changed our minds. */
+diff --git a/makeint.h b/makeint.h
+index 6223936..2009f41 100644
+--- a/makeint.h
++++ b/makeint.h
+@@ -436,10 +436,11 @@ extern struct rlimit stack_limit;
+ /* The number of bytes needed to represent the largest integer as a string. */
+ #define INTSTR_LENGTH CSTRLEN ("18446744073709551616")
+
++#define DEFAULT_TTYNAME "true"
+ #ifdef HAVE_TTYNAME
+ # define TTYNAME(_f) ttyname (_f)
+ #else
+-# define TTYNAME(_f) "true"
++# define TTYNAME(_f) DEFAULT_TTYNAME
+ #endif
+
+
+--
+cgit v0.9.0.2
diff --git a/sys-devel/make/make-3.80-r4.ebuild b/sys-devel/make/make-3.80-r4.ebuild
new file mode 100644
index 000000000000..38854b2e174d
--- /dev/null
+++ b/sys-devel/make/make-3.80-r4.ebuild
@@ -0,0 +1,43 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils flag-o-matic
+
+DESCRIPTION="Standard tool to compile source trees"
+HOMEPAGE="http://www.gnu.org/software/make/make.html"
+SRC_URI="mirror://gnu//make/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
+IUSE="nls static"
+
+DEPEND="nls? ( sys-devel/gettext )"
+RDEPEND=""
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epatch "${FILESDIR}"/${PV}-memory.patch
+ epatch "${FILESDIR}"/${P}-parallel-build-failure.patch
+ epatch "${FILESDIR}"/${P}-conditional-eval.patch #123317
+}
+
+src_compile() {
+ use static && append-ldflags -static
+ econf \
+ $(use_enable nls) \
+ --program-prefix=g \
+ || die
+ emake || die
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die "make install failed"
+ dodoc AUTHORS ChangeLog NEWS README*
+ if [[ ${USERLAND} == "GNU" ]] ; then
+ dosym gmake /usr/bin/make
+ dosym gmake.1 /usr/share/man/man1/make.1
+ fi
+}
diff --git a/sys-devel/make/make-3.81-r2.ebuild b/sys-devel/make/make-3.81-r2.ebuild
new file mode 100644
index 000000000000..f4683e0dc6e8
--- /dev/null
+++ b/sys-devel/make/make-3.81-r2.ebuild
@@ -0,0 +1,46 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit flag-o-matic eutils
+
+DESCRIPTION="Standard tool to compile source trees"
+HOMEPAGE="http://www.gnu.org/software/make/make.html"
+SRC_URI="mirror://gnu//make/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+IUSE="nls static"
+
+DEPEND="nls? ( sys-devel/gettext )"
+RDEPEND="nls? ( virtual/libintl )"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epatch "${FILESDIR}"/${P}-tests-lang.patch
+ epatch "${FILESDIR}"/${P}-long-cmdline.patch #301116
+ epatch "${FILESDIR}"/${P}-tests-recursion.patch #329153
+ epatch "${FILESDIR}"/${P}-jobserver.patch #193258
+}
+
+src_compile() {
+ use static && append-ldflags -static
+ econf \
+ $(use_enable nls) \
+ --program-prefix=g \
+ || die
+ emake || die
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die "make install failed"
+ dodoc AUTHORS ChangeLog NEWS README*
+ if [[ ${USERLAND} == "GNU" ]] ; then
+ # we install everywhere as 'gmake' but on GNU systems,
+ # symlink 'make' to 'gmake'
+ dosym gmake /usr/bin/make
+ dosym gmake.1 /usr/share/man/man1/make.1
+ fi
+}
diff --git a/sys-devel/make/make-3.82-r4.ebuild b/sys-devel/make/make-3.82-r4.ebuild
new file mode 100644
index 000000000000..79f2c14b3c0d
--- /dev/null
+++ b/sys-devel/make/make-3.82-r4.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 flag-o-matic eutils
+
+DESCRIPTION="Standard tool to compile source trees"
+HOMEPAGE="http://www.gnu.org/software/make/make.html"
+SRC_URI="mirror://gnu//make/${P}.tar.bz2"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~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="nls static"
+
+DEPEND="nls? ( sys-devel/gettext )"
+RDEPEND="nls? ( virtual/libintl )"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-archives-many-objs.patch #334889
+ epatch "${FILESDIR}"/${P}-MAKEFLAGS-reexec.patch #31975
+ epatch "${FILESDIR}"/${P}-memory-corruption.patch #355907
+ epatch "${FILESDIR}"/${P}-glob-speedup.patch #382845
+ epatch "${FILESDIR}"/${P}-copy-on-expand.patch
+ epatch "${FILESDIR}"/${P}-oneshell.patch
+ epatch "${FILESDIR}"/${P}-parallel-remake.patch
+ epatch "${FILESDIR}"/${P}-intermediate-parallel.patch #431250
+ epatch "${FILESDIR}"/${P}-construct-command-line.patch
+ epatch "${FILESDIR}"/${P}-long-command-line.patch
+ epatch "${FILESDIR}"/${P}-darwin-library_search-dylib.patch
+}
+
+src_configure() {
+ use static && append-ldflags -static
+ econf \
+ --program-prefix=g \
+ $(use_enable nls)
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die
+ dodoc AUTHORS ChangeLog NEWS README*
+ if [[ ${USERLAND} == "GNU" ]] ; then
+ # we install everywhere as 'gmake' but on GNU systems,
+ # symlink 'make' to 'gmake'
+ dosym gmake /usr/bin/make
+ dosym gmake.1 /usr/share/man/man1/make.1
+ fi
+}
diff --git a/sys-devel/make/make-4.0-r1.ebuild b/sys-devel/make/make-4.0-r1.ebuild
new file mode 100644
index 000000000000..5e9857c593e6
--- /dev/null
+++ b/sys-devel/make/make-4.0-r1.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit flag-o-matic eutils
+
+DESCRIPTION="Standard tool to compile source trees"
+HOMEPAGE="http://www.gnu.org/software/make/make.html"
+SRC_URI="mirror://gnu//make/${P}.tar.bz2"
+
+LICENSE="GPL-3+"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~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="guile nls static"
+
+CDEPEND="guile? ( >=dev-scheme/guile-1.8 )"
+DEPEND="${CDEPEND}
+ nls? ( sys-devel/gettext )"
+RDEPEND="${CDEPEND}
+ nls? ( virtual/libintl )"
+
+src_prepare() {
+ epatch \
+ "${FILESDIR}"/${PN}-3.82-darwin-library_search-dylib.patch \
+ "${FILESDIR}"/${P}-char-cast.patch
+}
+
+src_configure() {
+ use static && append-ldflags -static
+ econf \
+ --program-prefix=g \
+ $(use_with guile) \
+ $(use_enable nls)
+}
+
+src_install() {
+ emake DESTDIR="${D}" install
+ dodoc AUTHORS ChangeLog NEWS README*
+ if [[ ${USERLAND} == "GNU" ]] ; then
+ # we install everywhere as 'gmake' but on GNU systems,
+ # symlink 'make' to 'gmake'
+ dosym gmake /usr/bin/make
+ dosym gmake.1 /usr/share/man/man1/make.1
+ fi
+}
diff --git a/sys-devel/make/make-4.1-r1.ebuild b/sys-devel/make/make-4.1-r1.ebuild
new file mode 100644
index 000000000000..6bad17dfaab0
--- /dev/null
+++ b/sys-devel/make/make-4.1-r1.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 flag-o-matic eutils
+
+DESCRIPTION="Standard tool to compile source trees"
+HOMEPAGE="http://www.gnu.org/software/make/make.html"
+SRC_URI="mirror://gnu//make/${P}.tar.bz2"
+
+LICENSE="GPL-3+"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~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="guile nls static"
+
+CDEPEND="guile? ( >=dev-scheme/guile-1.8 )"
+DEPEND="${CDEPEND}
+ nls? ( sys-devel/gettext )"
+RDEPEND="${CDEPEND}
+ nls? ( virtual/libintl )"
+
+src_prepare() {
+ epatch \
+ "${FILESDIR}"/${PN}-3.82-darwin-library_search-dylib.patch \
+ "${FILESDIR}"/${P}-fix_null_returns_from_ttyname.patch
+}
+
+src_configure() {
+ use static && append-ldflags -static
+ econf \
+ --program-prefix=g \
+ $(use_with guile) \
+ $(use_enable nls)
+}
+
+src_install() {
+ emake DESTDIR="${D}" install
+ dodoc AUTHORS NEWS README*
+ if [[ ${USERLAND} == "GNU" ]] ; then
+ # we install everywhere as 'gmake' but on GNU systems,
+ # symlink 'make' to 'gmake'
+ dosym gmake /usr/bin/make
+ dosym gmake.1 /usr/share/man/man1/make.1
+ fi
+}
diff --git a/sys-devel/make/metadata.xml b/sys-devel/make/metadata.xml
new file mode 100644
index 000000000000..96a2d586367d
--- /dev/null
+++ b/sys-devel/make/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-devel/metadata.xml b/sys-devel/metadata.xml
new file mode 100644
index 000000000000..dd5a911e46a2
--- /dev/null
+++ b/sys-devel/metadata.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE catmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<catmetadata>
+ <longdescription lang="en">
+ The sys-devel category contains various core system development tools
+ and libraries.
+ </longdescription>
+ <longdescription lang="es">
+ La categoría sys-devel contiene paquetes esenciales para el desarrollo
+ de software.
+ </longdescription>
+ <longdescription lang="de">
+ Die Kategorie sys-devel enthält essentielle Entwicklungswerkzeuge und
+ Bibliotheken.
+ </longdescription>
+ <longdescription lang="ja">
+ sys-develカテゴリにはコアシステム開発ツールとライブラリが含まれます。
+ </longdescription>
+ <longdescription lang="nl">
+ De sys-devel categorie bevat essentiele ontwikkelgereedschappen en
+ bibliotheken.
+ </longdescription>
+ <longdescription lang="vi">
+ Nhóm sys-devel chứa các phần mềm và thư viện phát triển hệ thống cốt lõi.
+ </longdescription>
+ <longdescription lang="it">
+ La categoria sys-devel contiene gli strumenti e le librerie essenziali per lo sviluppo del software e la compilazione del sistema.
+ </longdescription>
+ <longdescription lang="pt">
+ A categoria sys-devel contém várias ferramentas e bibliotecas
+ de desenvolvimento essenciais para o sistema.
+ </longdescription>
+ <longdescription lang="pl">
+ Kategoria sys-devel zawiera programy i biblioteki służące do rozwijania
+ systemu.
+ </longdescription>
+</catmetadata>
+
diff --git a/sys-devel/multilib-gcc-wrapper/metadata.xml b/sys-devel/multilib-gcc-wrapper/metadata.xml
new file mode 100644
index 000000000000..db10fdd285dd
--- /dev/null
+++ b/sys-devel/multilib-gcc-wrapper/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>mgorny@gentoo.org</email>
+ <name>Michał Górny</name>
+ </maintainer>
+ <maintainer>
+ <email>multilib@gentoo.org</email>
+ <name>gx86 multilib team</name>
+ </maintainer>
+</pkgmetadata>
diff --git a/sys-devel/multilib-gcc-wrapper/multilib-gcc-wrapper-0.ebuild b/sys-devel/multilib-gcc-wrapper/multilib-gcc-wrapper-0.ebuild
new file mode 100644
index 000000000000..5accd38b9423
--- /dev/null
+++ b/sys-devel/multilib-gcc-wrapper/multilib-gcc-wrapper-0.ebuild
@@ -0,0 +1,72 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils multilib
+
+DESCRIPTION="Wrappers for gcc tools to be used on non-native CHOSTs"
+HOMEPAGE="http://www.gentoo.org"
+SRC_URI=""
+
+LICENSE="public-domain"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE=""
+
+RDEPEND="sys-devel/gcc:="
+
+S=${WORKDIR}
+
+mkwrap() {
+ einfo " ${2}"
+
+ cat > "${T}"/wrapper <<-_EOF_
+ #!${EPREFIX}/bin/sh
+ exec ${1} $(get_abi_CFLAGS) "\${@}"
+ _EOF_
+
+ newbin "${T}"/wrapper "${2}"
+}
+
+src_install() {
+ local host_prefix=${CHOST}
+ # stolen from sys-devel/gcc-config
+ # TODO: check if all of them actually support $(get_ABI_CFLAGS)
+ local tools=(
+ cpp cc gcc c++ g++ f77 g77 gcj gcjh gdc gdmd gfortran gccgo
+ )
+
+ cd "${EROOT%/}"/usr/bin || die
+ eshopts_push -s nullglob
+
+ # same as toolchain.eclass
+ : ${TARGET_DEFAULT_ABI:=${DEFAULT_ABI}}
+ : ${TARGET_MULTILIB_ABIS:=${MULTILIB_ABIS}}
+ local ABI t e
+ for ABI in $(get_all_abis TARGET); do
+ [[ ${ABI} == ${TARGET_DEFAULT_ABI} ]] && continue
+
+ einfo "Creating wrappers for ${ABI} ..."
+ for t in "${tools[@]}"; do
+ # look for both plain *-gcc and e.g. *-gcc-4.8.3
+ # (but avoid *-gcc-nm)
+ # note: nullglob applied above
+ for e in ${host_prefix}[-]${t}{,-[0-9]*}; do
+ local newname=$(get_abi_CHOST)-${e#${host_prefix}-}
+
+ einfo " ${newname}"
+
+ cat > "${T}"/wrapper <<-_EOF_
+ #!${EPREFIX}/bin/sh
+ exec ${e} $(get_abi_CFLAGS) "\${@}"
+ _EOF_
+
+ newbin "${T}"/wrapper "${newname}"
+ done
+ done
+ done
+
+ eshopts_pop
+}
diff --git a/sys-devel/native-cctools/files/aix-2/ld b/sys-devel/native-cctools/files/aix-2/ld
new file mode 100644
index 000000000000..d4b637c03836
--- /dev/null
+++ b/sys-devel/native-cctools/files/aix-2/ld
@@ -0,0 +1,139 @@
+#! /usr/bin/env /bin/ksh
+# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
+# $Id$
+
+# Upon '-soname' and similar flags, create a "shared library" on AIX being an
+# archive file containing an Import File and the shared object file, as in:
+# http://lists.gnu.org/archive/html/libtool/2011-01/msg00023.html
+# with updates in:
+# http://lists.gnu.org/archive/html/libtool/2011-02/msg00000.html
+#
+# This helper script is meant not depend on anything Gentoo specific.
+
+ld=/usr/ccs/bin/ld
+ar=/usr/ccs/bin/ar
+strip=/usr/ccs/bin/strip
+dump=/usr/sbin/dump
+awk=/usr/bin/awk
+rm=/usr/bin/rm
+mkdir=/usr/bin/mkdir
+mv=/usr/bin/mv
+ln=/usr/bin/ln
+
+oldargs=
+output=
+soname=
+newargs=
+OBJECT_MODE=${OBJECT_MODE:-32}
+
+while [[ $# -gt 0 ]]
+do
+ arg=$1
+ shift
+ oldargs="${oldargs} '${arg}'"
+ case ${arg} in
+ -o)
+ newargs="${newargs} -o '$1'"
+ output=$1
+ oldargs="${oldargs} '$1'"
+ shift
+ ;;
+ -bM:SRE)
+ newargs="${newargs} '-G' '-bernotok'"
+ ;;
+ -soname=*)
+ soname=${arg#-soname=}
+ ;;
+ -h*)
+ soname=${arg#-h}
+ ;;
+ -soname|-h)
+ soname=$1
+ shift
+ ;;
+ -b32)
+ newargs="${newargs} '${arg}'"
+ OBJECT_MODE=32
+ ;;
+ -b64)
+ newargs="${newargs} '${arg}'"
+ OBJECT_MODE=64
+ ;;
+ *)
+ newargs="${newargs} '${arg}'"
+ ;;
+ esac
+done
+
+if [[ -z ${output} || -z ${soname} ]]; then
+ eval "exec ${ld} ${oldargs}"
+ exit 1
+fi
+
+# Running ld against the orginal target file to retain
+# ld error message when there's a problem with it:
+eval "${ld} -o '${output}' ${newargs}" || exit 1
+
+workdir="${output}.$$"
+
+${rm} -rf "${workdir}" || exit 1
+trap "${rm} -rf '${workdir}'" 0
+
+case ${soname} in
+*\(*\))
+ shro=${soname#*\(}
+ shro=${shro%\)}
+ shri=${shro%.*}.imp
+ ;;
+*\[*\])
+ shro=${soname#*\[}
+ shro=${shro%\]}
+ shri=${shro%.*}.imp
+ ;;
+none) # loadable only module, not linkable: no import file
+ shro='shr.o'
+ soname="${output##*/}(${shro})"
+ shri=
+ ;;
+auto)
+ shro='shr.o'
+ soname=${output##*/}
+ if [[ ${soname} == lib*.so* ]]; then
+ # linkable library: need import file
+ shri=${shro%.*}.imp
+ else
+ # loadable only module, not linkable: no import file
+ shri=
+ fi
+ soname="${soname}(${shro})"
+ ;;
+*)
+ shro='shr.o'
+ shri=${shro%.*}.imp
+ soname="${soname}(${shro})"
+ ;;
+esac
+
+export OBJECT_MODE
+
+${mkdir} "${workdir}" || exit 1
+${strip} -e "${output}" || exit 1
+if [[ -n ${shri} ]]; then
+ ${dump} -Tv "${output}" > "${workdir}"/syms || exit 1
+ ${awk} '
+ BEGIN {
+ print "#! '"${soname}"'"
+ print "# '"${OBJECT_MODE}"'"
+ }
+ {
+ if ($4 == "EXP" || $4 == "ImpExp") {
+ print $8
+ } else
+ if ($4 == "wEXP") {
+ print $8" weak"
+ }
+ }' <"${workdir}"/syms > "${workdir}"/${shri} || exit 1
+fi
+${mv} "${output}" "${workdir}/${shro}" || exit 1
+${ar} rc "${output}" ${shri:+"${workdir}/${shri}"} "${workdir}/${shro}" || exit 1
+exit 0
diff --git a/sys-devel/native-cctools/files/aix-2/mkexpfile b/sys-devel/native-cctools/files/aix-2/mkexpfile
new file mode 100644
index 000000000000..4e79e4647b06
--- /dev/null
+++ b/sys-devel/native-cctools/files/aix-2/mkexpfile
@@ -0,0 +1,70 @@
+#! /bin/sh
+
+nm="${0%mkexpfile}nm"
+showwith=
+expfile="ld.aix.exports.$$"
+srcobjs=
+
+# /bin/sort does not allow TMPDIR to be longer than 85 characters
+test ${#TMPDIR} -le 85 || TMPDIR=/tmp export TMPDIR
+
+while test $# -gt 0
+do
+ arg=$1
+ shift
+
+ case ${arg} in
+ --) for arg in "$@"
+ do
+ srcobjs="${srcobjs} '${arg}'"
+ done
+ break
+ ;;
+ --show-with=*) showwith="${arg#--show-with=}" ;;
+ -o) expfile="${1}"; shift ;;
+ -o*) expfile="${arg#-o}"; ;;
+ *) srcobjs="${srcobjs} '${arg}'" ;;
+ esac
+done
+
+/bin/rm -f "${expfile}" || exit 1
+
+if ! type "${nm}" >/dev/null 2>&1
+then
+ case ${nm} in
+ *-nm) nm=${nm##*/} ;; # use "powerpc-ibm-aix7.1.0.0-nm" from PATH
+ */nm|nm) nm=/usr/ccs/bin/nm ;; # native anyway
+ esac
+ type "${nm}" >/dev/null || exit 1 # let 'type' yell when necessary
+fi
+
+if "${nm}" -V 2>&1 | /bin/grep 'GNU' >/dev/null
+then
+ eval "${nm}" -Bpg ${srcobjs} |
+ /bin/awk '{
+ if ((($2 == "T") || ($2 == "D") || ($2 == "B") || ($2 == "W")) && (substr($3,1,1) != ".")) {
+ if ($2 == "W") {
+ print $3 " weak"
+ } else {
+ print $3
+ }
+ }
+ }' |
+ /bin/sort -u > "${expfile}" || exit 1
+else
+ eval "${nm}" -PCpgl ${srcobjs} |
+ /bin/awk '{
+ if ((($2 == "T") || ($2 == "D") || ($2 == "B") || ($2 == "W") || ($2 == "V") || ($2 == "Z")) && (substr($1,1,1) != ".")) {
+ if (($2 == "W") || ($2 == "V") || ($2 == "Z")) {
+ print $1 " weak"
+ } else {
+ print $1
+ }
+ }
+ }' |
+ /bin/sort -u > "${expfile}" || exit 1
+fi
+
+echo "${showwith}${expfile}"
+
+exit 0
diff --git a/sys-devel/native-cctools/files/aix-2/nm b/sys-devel/native-cctools/files/aix-2/nm
new file mode 100644
index 000000000000..5ba1d650d23a
--- /dev/null
+++ b/sys-devel/native-cctools/files/aix-2/nm
@@ -0,0 +1,6 @@
+#! /bin/sh
+
+# /usr/bin/sort (used by nm) cannot work with TMPDIR longer than 85 characters.
+test ${#TMPDIR} -le 85 || TMPDIR=/tmp export TMPDIR
+
+exec /usr/ccs/bin/nm ${1+"$@"}
diff --git a/sys-devel/native-cctools/files/ld-aix-1 b/sys-devel/native-cctools/files/ld-aix-1
new file mode 100644
index 000000000000..cec06a47bd37
--- /dev/null
+++ b/sys-devel/native-cctools/files/ld-aix-1
@@ -0,0 +1,141 @@
+#! /usr/bin/env /bin/ksh
+# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
+# $Id$
+
+# Upon '-soname' and similar flags, create a "shared library" on AIX being an
+# archive file containing an Import File and the shared object file, as in:
+# http://lists.gnu.org/archive/html/libtool/2011-01/msg00023.html
+# with updates in:
+# http://lists.gnu.org/archive/html/libtool/2011-02/msg00000.html
+#
+# This helper script is meant not depend on anything Gentoo specific.
+
+ld=/usr/ccs/bin/ld
+ar=/usr/ccs/bin/ar
+strip=/usr/ccs/bin/strip
+dump=/usr/sbin/dump
+awk=/usr/bin/awk
+rm=/usr/bin/rm
+mkdir=/usr/bin/mkdir
+mv=/usr/bin/mv
+ln=/usr/bin/ln
+
+oldargs=
+output=
+soname=
+newargs=
+OBJECT_MODE=${OBJECT_MODE:-32}
+
+while [[ $# -gt 0 ]]
+do
+ arg=$1
+ shift
+ oldargs="${oldargs} '${arg}'"
+ case ${arg} in
+ -o)
+ newargs="${newargs} -o '$1'"
+ output=$1
+ oldargs="${oldargs} '$1'"
+ shift
+ ;;
+ -bM:SRE)
+ newargs="${newargs} '-G' '-bernotok'"
+ ;;
+ -soname=*)
+ soname=${arg#-soname=}
+ ;;
+ -h*)
+ soname=${arg#-h}
+ ;;
+ -soname|-h)
+ soname=$1
+ shift
+ ;;
+ -b32)
+ newargs="${newargs} '${arg}'"
+ OBJECT_MODE=32
+ ;;
+ -b64)
+ newargs="${newargs} '${arg}'"
+ OBJECT_MODE=64
+ ;;
+ *)
+ newargs="${newargs} '${arg}'"
+ ;;
+ esac
+done
+
+if [[ -z ${output} || -z ${soname} ]]; then
+ eval "exec ${ld} ${oldargs}"
+ exit 1
+fi
+
+# Running ld against the orginal target file to retain
+# ld error message when there's a problem with it:
+eval "${ld} -o '${output}' ${newargs}" || exit 1
+
+workdir="${output}.$$"
+
+${rm} -rf "${workdir}" || exit 1
+trap "${rm} -rf '${workdir}'" 0
+
+case ${soname} in
+*\(*\))
+ shro=${soname#*\(}
+ shro=${shro%\)}
+ shri=${shro%.*}.imp
+ ;;
+*\[*\])
+ shro=${soname#*\[}
+ shro=${shro%\]}
+ shri=${shro%.*}.imp
+ ;;
+none) # loadable only module, not linkable: no import file
+ shro='shr.o'
+ soname="${output##*/}(${shro})"
+ shri=
+ ;;
+auto)
+ shro='shr.o'
+ soname=${output##*/}
+ if [[ ${soname} == lib*.so* ]]; then
+ # linkable library: need import file
+ shri=${shro%.*}.imp
+ else
+ # loadable only module, not linkable: no import file
+ shri=
+ fi
+ soname="${soname}(${shro})"
+ ;;
+*)
+ shro='shr.o'
+ shri=${shro%.*}.imp
+ soname="${soname}(${shro})"
+ ;;
+esac
+
+export OBJECT_MODE
+
+${mkdir} "${workdir}" || exit 1
+${strip} -e "${output}" || exit 1
+if [[ -n ${shri} ]]; then
+ ${dump} -Tv "${output}" > "${workdir}"/syms || exit 1
+ ${awk} '
+ BEGIN {
+ print "#! '"${soname}"'"
+ print "# '"${OBJECT_MODE}"'"
+ }
+ {
+ if ($6 != "SECdef") {
+ if ($4 == "EXP" || $4 == "ImpExp") {
+ print $8
+ } else
+ if ($4 == "wEXP") {
+ print $8" weak"
+ }
+ }
+ }' <"${workdir}"/syms > "${workdir}"/${shri} || exit 1
+fi
+${mv} "${output}" "${workdir}/${shro}" || exit 1
+${ar} rc "${output}" ${shri:+"${workdir}/${shri}"} "${workdir}/${shro}" || exit 1
+exit 0
diff --git a/sys-devel/native-cctools/files/ld-aix-2 b/sys-devel/native-cctools/files/ld-aix-2
new file mode 100644
index 000000000000..1741665d4191
--- /dev/null
+++ b/sys-devel/native-cctools/files/ld-aix-2
@@ -0,0 +1,139 @@
+#! /usr/bin/env /bin/ksh
+# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
+# $Id$
+
+# Upon '-soname' and similar flags, create a "shared library" on AIX being an
+# archive file containing an Import File and the shared object file, as in:
+# http://lists.gnu.org/archive/html/libtool/2011-01/msg00023.html
+# with updates in:
+# http://lists.gnu.org/archive/html/libtool/2011-02/msg00000.html
+#
+# This helper script is meant not depend on anything Gentoo specific.
+
+ld=/usr/ccs/bin/ld
+ar=/usr/ccs/bin/ar
+strip=/usr/ccs/bin/strip
+dump=/usr/sbin/dump
+awk=/usr/bin/awk
+rm=/usr/bin/rm
+mkdir=/usr/bin/mkdir
+mv=/usr/bin/mv
+ln=/usr/bin/ln
+
+oldargs=
+output=
+soname=
+newargs=
+OBJECT_MODE=${OBJECT_MODE:-32}
+
+while [[ $# -gt 0 ]]
+do
+ arg=$1
+ shift
+ oldargs="${oldargs} '${arg}'"
+ case ${arg} in
+ -o)
+ newargs="${newargs} -o '$1'"
+ output=$1
+ oldargs="${oldargs} '$1'"
+ shift
+ ;;
+ -bM:SRE)
+ newargs="${newargs} '-G' '-bernotok'"
+ ;;
+ -soname=*)
+ soname=${arg#-soname=}
+ ;;
+ -h*)
+ soname=${arg#-h}
+ ;;
+ -soname|-h)
+ soname=$1
+ shift
+ ;;
+ -b32)
+ newargs="${newargs} '${arg}'"
+ OBJECT_MODE=32
+ ;;
+ -b64)
+ newargs="${newargs} '${arg}'"
+ OBJECT_MODE=64
+ ;;
+ *)
+ newargs="${newargs} '${arg}'"
+ ;;
+ esac
+done
+
+if [[ -z ${output} || -z ${soname} ]]; then
+ eval "exec ${ld} ${oldargs}"
+ exit 1
+fi
+
+# Running ld against the orginal target file to retain
+# ld error message when there's a problem with it:
+eval "${ld} -o '${output}' ${newargs}" || exit 1
+
+workdir="${output}.$$"
+
+${rm} -rf "${workdir}" || exit 1
+trap "${rm} -rf '${workdir}'" 0
+
+case ${soname} in
+*\(*\))
+ shro=${soname#*\(}
+ shro=${shro%\)}
+ shri=${shro%.*}.imp
+ ;;
+*\[*\])
+ shro=${soname#*\[}
+ shro=${shro%\]}
+ shri=${shro%.*}.imp
+ ;;
+none) # loadable only module, not linkable: no import file
+ shro='shr.o'
+ soname="${output##*/}(${shro})"
+ shri=
+ ;;
+auto)
+ shro='shr.o'
+ soname=${output##*/}
+ if [[ ${soname} == lib*.so* ]]; then
+ # linkable library: need import file
+ shri=${shro%.*}.imp
+ else
+ # loadable only module, not linkable: no import file
+ shri=
+ fi
+ soname="${soname}(${shro})"
+ ;;
+*)
+ shro='shr.o'
+ shri=${shro%.*}.imp
+ soname="${soname}(${shro})"
+ ;;
+esac
+
+export OBJECT_MODE
+
+${mkdir} "${workdir}" || exit 1
+${strip} -e "${output}" || exit 1
+if [[ -n ${shri} ]]; then
+ ${dump} -Tv "${output}" > "${workdir}"/syms || exit 1
+ ${awk} '
+ BEGIN {
+ print "#! '"${soname}"'"
+ print "# '"${OBJECT_MODE}"'"
+ }
+ {
+ if ($4 == "EXP" || $4 == "ImpExp") {
+ print $8
+ } else
+ if ($4 == "wEXP") {
+ print $8" weak"
+ }
+ }' <"${workdir}"/syms > "${workdir}"/${shri} || exit 1
+fi
+${mv} "${output}" "${workdir}/${shro}" || exit 1
+${ar} rc "${output}" ${shri:+"${workdir}/${shri}"} "${workdir}/${shro}" || exit 1
+exit 0
diff --git a/sys-devel/native-cctools/metadata.xml b/sys-devel/native-cctools/metadata.xml
new file mode 100644
index 000000000000..46dee96f4e7a
--- /dev/null
+++ b/sys-devel/native-cctools/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-devel/native-cctools/native-cctools-1.ebuild b/sys-devel/native-cctools/native-cctools-1.ebuild
new file mode 100644
index 000000000000..7ff280f4d83d
--- /dev/null
+++ b/sys-devel/native-cctools/native-cctools-1.ebuild
@@ -0,0 +1,108 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils
+
+DESCRIPTION="Host OS native assembler as and static linker ld"
+HOMEPAGE="http://prefix.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-2" # actually, we don't know, the wrapper is
+SLOT="0"
+
+LD_AIX_V=1
+
+KEYWORDS="~ppc-aix ~x86-interix ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
+
+IUSE=""
+
+DEPEND="sys-devel/binutils-config"
+RDEPEND="${DEPEND}"
+
+src_install() {
+ LIBPATH=/usr/$(get_libdir)/binutils/${CHOST}/native-${PV}
+ BINPATH=/usr/${CHOST}/binutils-bin/native-${PV}
+
+ keepdir ${LIBPATH} || die
+ dodir ${BINPATH} || die
+
+ # allow for future hosts with different paths
+ nativepath=""
+ wrappers=()
+ case ${CHOST} in
+ *-solaris*)
+ nativepath=/usr/sfw/bin
+ ;;
+ *-aix*)
+ nativepath=/usr/ccs/bin
+ wrappers=("${wrappers[@]}" "ld=${FILESDIR}/ld-aix-${LD_AIX_V}")
+ ;;
+ *-apple-darwin*|*-netbsd*|*-openbsd*)
+ nativepath=/usr/bin
+ ;;
+ *-interix*)
+ nativepath=/opt/gcc.3.3/bin
+ ;;
+ *)
+ die "Don't know where the native linker for your platform is"
+ ;;
+ esac
+
+ what="addr2line as ar c++filt gprof ld nm objcopy objdump \
+ ranlib readelf elfdump size strings strip"
+ # Darwin things
+ what="${what} install_name_tool ld64 libtool lipo nmedit \
+ otool otool64 pagestuff redo_prebinding segedit"
+
+ # copy from the host os
+ cd "${ED}${BINPATH}"
+ for b in ${what} ; do
+ if [[ ${CHOST} == *-darwin* && ${b} == libtool ]] ; then
+ echo "linking darwin libtool ${nativepath}/${b}"
+ ln -s "${nativepath}/${b}" "${b}"
+ elif [[ -x ${nativepath}/g${b} ]] ; then
+ einfo "linking ${nativepath}/g${b}"
+ ln -s "${nativepath}/g${b}" "${b}"
+ elif [[ -x ${nativepath}/${b} ]] ; then
+ einfo "linking ${nativepath}/${b}"
+ ln -s "${nativepath}/${b}" "${b}"
+ else
+ ewarn "skipping ${b} (not in ${nativepath})"
+ fi
+ done
+
+ # post fix for Darwin's ranlib (doesn't like it when its called other than
+ # that, as libtool and ranlib are one tool)
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ rm -f ranlib
+ cat <<-EOF > ranlib
+ #!/usr/bin/env bash
+ exec ${nativepath}/ranlib "\$@"
+ EOF
+ chmod 755 ranlib
+ fi
+
+ exeinto ${BINPATH}
+ local wrapper source target
+ for wrapper in "${wrappers[@]}" ; do
+ source=${wrapper#*=}
+ target=${wrapper%%=*}
+ newexe "${source}" "${target}" || die
+ done
+ # Generate an env.d entry for this binutils
+ insinto /etc/env.d/binutils
+ cat <<-EOF > "${T}"/env.d
+ TARGET="${CHOST}"
+ VER="native-${PV}"
+ LIBPATH="${EPREFIX}/${LIBPATH}"
+ FAKE_TARGETS="${CHOST}"
+ EOF
+ newins "${T}"/env.d ${CHOST}-native-${PV}
+}
+
+pkg_postinst() {
+ binutils-config ${CHOST}-native-${PV}
+}
diff --git a/sys-devel/native-cctools/native-cctools-2.ebuild b/sys-devel/native-cctools/native-cctools-2.ebuild
new file mode 100644
index 000000000000..6a97fad33a27
--- /dev/null
+++ b/sys-devel/native-cctools/native-cctools-2.ebuild
@@ -0,0 +1,108 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils
+
+DESCRIPTION="Host OS native assembler as and static linker ld"
+HOMEPAGE="http://prefix.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-2" # actually, we don't know, the wrapper is
+SLOT="0"
+
+LD_AIX_V=2
+
+KEYWORDS="~ppc-aix ~x86-interix ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
+
+IUSE=""
+
+DEPEND="sys-devel/binutils-config"
+RDEPEND="${DEPEND}"
+
+src_install() {
+ LIBPATH=/usr/$(get_libdir)/binutils/${CHOST}/native-${PV}
+ BINPATH=/usr/${CHOST}/binutils-bin/native-${PV}
+
+ keepdir ${LIBPATH} || die
+ dodir ${BINPATH} || die
+
+ # allow for future hosts with different paths
+ nativepath=""
+ wrappers=()
+ case ${CHOST} in
+ *-solaris*)
+ nativepath=/usr/sfw/bin
+ ;;
+ *-aix*)
+ nativepath=/usr/ccs/bin
+ wrappers=("${wrappers[@]}" "ld=${FILESDIR}/ld-aix-${LD_AIX_V}")
+ ;;
+ *-apple-darwin*|*-netbsd*|*-openbsd*)
+ nativepath=/usr/bin
+ ;;
+ *-interix*)
+ nativepath=/opt/gcc.3.3/bin
+ ;;
+ *)
+ die "Don't know where the native linker for your platform is"
+ ;;
+ esac
+
+ what="addr2line as ar c++filt gprof ld nm objcopy objdump \
+ ranlib readelf elfdump size strings strip"
+ # Darwin things
+ what="${what} install_name_tool ld64 libtool lipo nmedit \
+ otool otool64 pagestuff redo_prebinding segedit"
+
+ # copy from the host os
+ cd "${ED}${BINPATH}"
+ for b in ${what} ; do
+ if [[ ${CHOST} == *-darwin* && ${b} == libtool ]] ; then
+ echo "linking darwin libtool ${nativepath}/${b}"
+ ln -s "${nativepath}/${b}" "${b}"
+ elif [[ -x ${nativepath}/g${b} ]] ; then
+ einfo "linking ${nativepath}/g${b}"
+ ln -s "${nativepath}/g${b}" "${b}"
+ elif [[ -x ${nativepath}/${b} ]] ; then
+ einfo "linking ${nativepath}/${b}"
+ ln -s "${nativepath}/${b}" "${b}"
+ else
+ ewarn "skipping ${b} (not in ${nativepath})"
+ fi
+ done
+
+ # post fix for Darwin's ranlib (doesn't like it when its called other than
+ # that, as libtool and ranlib are one tool)
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ rm -f ranlib
+ cat <<-EOF > ranlib
+ #!/usr/bin/env bash
+ exec ${nativepath}/ranlib "\$@"
+ EOF
+ chmod 755 ranlib
+ fi
+
+ exeinto ${BINPATH}
+ local wrapper source target
+ for wrapper in "${wrappers[@]}" ; do
+ source=${wrapper#*=}
+ target=${wrapper%%=*}
+ newexe "${source}" "${target}" || die
+ done
+ # Generate an env.d entry for this binutils
+ insinto /etc/env.d/binutils
+ cat <<-EOF > "${T}"/env.d
+ TARGET="${CHOST}"
+ VER="native-${PV}"
+ LIBPATH="${EPREFIX}/${LIBPATH}"
+ FAKE_TARGETS="${CHOST}"
+ EOF
+ newins "${T}"/env.d ${CHOST}-native-${PV}
+}
+
+pkg_postinst() {
+ binutils-config ${CHOST}-native-${PV}
+}
diff --git a/sys-devel/native-cctools/native-cctools-4.ebuild b/sys-devel/native-cctools/native-cctools-4.ebuild
new file mode 100644
index 000000000000..a1d4cec553b7
--- /dev/null
+++ b/sys-devel/native-cctools/native-cctools-4.ebuild
@@ -0,0 +1,111 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils
+
+DESCRIPTION="Host OS native assembler as and static linker ld"
+HOMEPAGE="http://prefix.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-2" # actually, we don't know, the wrapper is
+SLOT="0"
+
+AIX_V='aix-2'
+
+KEYWORDS="~ppc-aix ~x86-interix ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
+
+IUSE=""
+
+DEPEND="sys-devel/binutils-config"
+RDEPEND="${DEPEND}"
+
+src_install() {
+ LIBPATH=/usr/$(get_libdir)/binutils/${CHOST}/native-${PV}
+ BINPATH=/usr/${CHOST}/binutils-bin/native-${PV}
+
+ keepdir ${LIBPATH} || die
+ dodir ${BINPATH} || die
+
+ # allow for future hosts with different paths
+ nativepath=""
+ wrappers=()
+ case ${CHOST} in
+ *-solaris*)
+ nativepath=/usr/sfw/bin
+ ;;
+ *-aix*)
+ nativepath=/usr/ccs/bin
+ wrappers=("${wrappers[@]}" "ld=${FILESDIR}/${AIX_V}/ld")
+ wrappers=("${wrappers[@]}" "nm=${FILESDIR}/${AIX_V}/nm")
+ wrappers=("${wrappers[@]}" "mkexpfile=${FILESDIR}/${AIX_V}/mkexpfile")
+ ;;
+ *-apple-darwin*|*-netbsd*|*-openbsd*)
+ nativepath=/usr/bin
+ ;;
+ *-interix*)
+ nativepath=/opt/gcc.3.3/bin
+ ;;
+ *)
+ die "Don't know where the native linker for your platform is"
+ ;;
+ esac
+
+ what="addr2line as ar c++filt gprof ld nm objcopy objdump \
+ ranlib readelf elfdump size strings strip"
+ # Darwin things
+ what="${what} install_name_tool ld64 libtool lipo nmedit \
+ otool otool64 pagestuff redo_prebinding segedit"
+
+ # copy from the host os
+ cd "${ED}${BINPATH}"
+ for b in ${what} ; do
+ if [[ ${CHOST} == *-darwin* && ${b} == libtool ]] ; then
+ echo "linking darwin libtool ${nativepath}/${b}"
+ ln -s "${nativepath}/${b}" "${b}"
+ elif [[ -x ${nativepath}/g${b} ]] ; then
+ einfo "linking ${nativepath}/g${b}"
+ ln -s "${nativepath}/g${b}" "${b}"
+ elif [[ -x ${nativepath}/${b} ]] ; then
+ einfo "linking ${nativepath}/${b}"
+ ln -s "${nativepath}/${b}" "${b}"
+ else
+ ewarn "skipping ${b} (not in ${nativepath})"
+ fi
+ done
+
+ # post fix for Darwin's ranlib (doesn't like it when its called other than
+ # that, as libtool and ranlib are one tool)
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ rm -f ranlib
+ cat <<-EOF > ranlib
+ #!/usr/bin/env bash
+ exec ${nativepath}/ranlib "\$@"
+ EOF
+ chmod 755 ranlib
+ fi
+
+ exeinto ${BINPATH}
+ local wrapper source target
+ for wrapper in "${wrappers[@]}" ; do
+ source=${wrapper#*=}
+ target=${wrapper%%=*}
+ rm -f "${target}"
+ newexe "${source}" "${target}" || die
+ done
+ # Generate an env.d entry for this binutils
+ insinto /etc/env.d/binutils
+ cat <<-EOF > "${T}"/env.d
+ TARGET="${CHOST}"
+ VER="native-${PV}"
+ LIBPATH="${EPREFIX}/${LIBPATH}"
+ FAKE_TARGETS="${CHOST}"
+ EOF
+ newins "${T}"/env.d ${CHOST}-native-${PV}
+}
+
+pkg_postinst() {
+ binutils-config ${CHOST}-native-${PV}
+}
diff --git a/sys-devel/parity/Manifest b/sys-devel/parity/Manifest
new file mode 100644
index 000000000000..25bed230ce70
--- /dev/null
+++ b/sys-devel/parity/Manifest
@@ -0,0 +1,3 @@
+DIST parity-1.2.4.tar.gz 456408 SHA256 13d781a5f606244f53d980bdb362f30bbdb67d29e8d93075c893fc7ee13fc496
+DIST parity-1.2.5.tar.gz 559411 SHA256 950d7888c7bf0cd6ad8955b4781d2fafcbdae2b009d13f80929b12a1af9cc4df SHA512 daadf80582b7fa8914f7899e4055185885164210f9a970ff178c3846da83058e3bd70c1db10406e3bcaef05148e87226846cb39e30cbbd1e0821176a8f65c32b WHIRLPOOL 90f3803b0fd62b5a8d198a3c2c95eb23a7db62ad80b49ec71daf7eb834f51f5af37a1efaba9bcaa7d54170655c527d95b4e399c4038993f0b17a9dba3dbe2fe6
+DIST parity-1.2.6.tar.gz 559357 SHA256 a0b9fb69e6bbef5f2b4a6ef84910c23b8cac5649456ef1834d0517a06d2c3537 SHA512 fe043feef71db20cf759fd1b5eb8e855f5f78b278f48e9d4afdd2c06fc6c6ae861439cde3829728d3548e072cb065aea5d4048da7ad8bc49f5bc7fcebf7ad430 WHIRLPOOL 98662c7f37b3eb4040ac49e1135d4fa6bbea8a4473094ee5d9f12c79fa81886dbf4ccd3037d56f55ee707a0d749be6898b6826e8f7126b426608011d79a042fe
diff --git a/sys-devel/parity/files/parity-1.2.6-debugging.patch b/sys-devel/parity/files/parity-1.2.6-debugging.patch
new file mode 100644
index 000000000000..709f46ee9734
--- /dev/null
+++ b/sys-devel/parity/files/parity-1.2.6-debugging.patch
@@ -0,0 +1,17 @@
+--- parity.runtime/diagnose.c.orig 2012-09-28 17:12:54 +0200
++++ parity.runtime/diagnose.c 2012-09-28 17:11:14 +0200
+@@ -745,9 +745,11 @@
+ CloseHandle(hCore);
+ }
+
+- // abort on fatal exceptions
+- TerminateProcess(GetCurrentProcess(), 1);
+- ExitProcess(1);
++ if (!IsDebuggerPresent()) {
++ // abort on fatal exceptions
++ TerminateProcess(GetCurrentProcess(), 1);
++ ExitProcess(1);
++ }
+ return EXCEPTION_CONTINUE_SEARCH;
+ }
+
diff --git a/sys-devel/parity/metadata.xml b/sys-devel/parity/metadata.xml
new file mode 100644
index 000000000000..8aa8bfe87304
--- /dev/null
+++ b/sys-devel/parity/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>haubi@gentoo.org</email>
+ <name>Michael Haubenwallner</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="sourceforge">parity</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-devel/parity/parity-1.2.4.ebuild b/sys-devel/parity/parity-1.2.4.ebuild
new file mode 100644
index 000000000000..0c0490e9cc4d
--- /dev/null
+++ b/sys-devel/parity/parity-1.2.4.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="An Interix to native Win32 Cross-Compiler Tool (requires Visual Studio)"
+HOMEPAGE="http://www.sourceforge.net/projects/parity/"
+
+if [[ ${PV} == 9999 ]]; then
+ inherit subversion
+ ESVN_REPO_URI="https://parity.svn.sf.net/svnroot/parity/trunk"
+ ESVN_BOOTSTRAP="confix --bootstrap"
+ ESVN_PROJECT="${PN}"
+ KEYWORDS=""
+
+ DEPEND="dev-util/confix"
+else
+ SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+ KEYWORDS="~x86-interix ~x86-winnt"
+fi
+
+LICENSE="LGPL-3"
+SLOT="0"
+IUSE=""
+
+pkg_setup() {
+ if [ -z "${MSSDK}" ]; then
+ einfo "NOTE: When using Visual Studio 2008, the Platform SDK is no longer"
+ einfo "installed alongside with the other components, but has it's own"
+ einfo "root directory, most likely something like this:"
+ einfo ""
+ einfo " C:\\Program Files\\Microsoft SDKs\\Windows\\v6.0A"
+ einfo ""
+ einfo "To make parity find it's paths correctly, please set MSSDK to the"
+ einfo "value correspoding to the above example for your system."
+ fi
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die "emake install failed"
+
+ # create i586-pc-winnt*-g[++|cc|..] links..
+ local exeext=
+
+ [[ -f ${ED}/usr/bin/parity.gnu.gcc.exe ]] && exeext=.exe
+
+ # create cross compiler syms
+ dosym /usr/bin/parity.gnu.gcc${exeext} /usr/bin/i586-pc-winnt$(uname -r)-gcc
+ dosym /usr/bin/parity.gnu.gcc${exeext} /usr/bin/i586-pc-winnt$(uname -r)-c++
+ dosym /usr/bin/parity.gnu.gcc${exeext} /usr/bin/i586-pc-winnt$(uname -r)-g++
+ dosym /usr/bin/parity.gnu.ld${exeext} /usr/bin/i586-pc-winnt$(uname -r)-ld
+
+ # we don't need the header files installed by parity... private
+ # header files are supported with a patch from 2.1.0-r1 onwards,
+ # so they won't be there anymore, but -f does the job in any case.
+ rm -f "${ED}"/usr/include/*.h
+}
diff --git a/sys-devel/parity/parity-1.2.5.ebuild b/sys-devel/parity/parity-1.2.5.ebuild
new file mode 100644
index 000000000000..0c0490e9cc4d
--- /dev/null
+++ b/sys-devel/parity/parity-1.2.5.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="An Interix to native Win32 Cross-Compiler Tool (requires Visual Studio)"
+HOMEPAGE="http://www.sourceforge.net/projects/parity/"
+
+if [[ ${PV} == 9999 ]]; then
+ inherit subversion
+ ESVN_REPO_URI="https://parity.svn.sf.net/svnroot/parity/trunk"
+ ESVN_BOOTSTRAP="confix --bootstrap"
+ ESVN_PROJECT="${PN}"
+ KEYWORDS=""
+
+ DEPEND="dev-util/confix"
+else
+ SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+ KEYWORDS="~x86-interix ~x86-winnt"
+fi
+
+LICENSE="LGPL-3"
+SLOT="0"
+IUSE=""
+
+pkg_setup() {
+ if [ -z "${MSSDK}" ]; then
+ einfo "NOTE: When using Visual Studio 2008, the Platform SDK is no longer"
+ einfo "installed alongside with the other components, but has it's own"
+ einfo "root directory, most likely something like this:"
+ einfo ""
+ einfo " C:\\Program Files\\Microsoft SDKs\\Windows\\v6.0A"
+ einfo ""
+ einfo "To make parity find it's paths correctly, please set MSSDK to the"
+ einfo "value correspoding to the above example for your system."
+ fi
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die "emake install failed"
+
+ # create i586-pc-winnt*-g[++|cc|..] links..
+ local exeext=
+
+ [[ -f ${ED}/usr/bin/parity.gnu.gcc.exe ]] && exeext=.exe
+
+ # create cross compiler syms
+ dosym /usr/bin/parity.gnu.gcc${exeext} /usr/bin/i586-pc-winnt$(uname -r)-gcc
+ dosym /usr/bin/parity.gnu.gcc${exeext} /usr/bin/i586-pc-winnt$(uname -r)-c++
+ dosym /usr/bin/parity.gnu.gcc${exeext} /usr/bin/i586-pc-winnt$(uname -r)-g++
+ dosym /usr/bin/parity.gnu.ld${exeext} /usr/bin/i586-pc-winnt$(uname -r)-ld
+
+ # we don't need the header files installed by parity... private
+ # header files are supported with a patch from 2.1.0-r1 onwards,
+ # so they won't be there anymore, but -f does the job in any case.
+ rm -f "${ED}"/usr/include/*.h
+}
diff --git a/sys-devel/parity/parity-1.2.6.ebuild b/sys-devel/parity/parity-1.2.6.ebuild
new file mode 100644
index 000000000000..d39305bcddb7
--- /dev/null
+++ b/sys-devel/parity/parity-1.2.6.ebuild
@@ -0,0 +1,63 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit eutils
+
+if [[ ${PV} == 9999 ]]; then
+ inherit subversion
+ ESVN_REPO_URI="https://parity.svn.sf.net/svnroot/parity/trunk"
+ ESVN_BOOTSTRAP="confix --bootstrap"
+ ESVN_PROJECT="${PN}"
+ : ${KEYWORDS=""}
+
+ DEPEND="dev-util/confix"
+else
+ SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+ KEYWORDS="~x86-interix"
+fi
+DESCRIPTION="An Interix to native Win32 Cross-Compiler Tool (requires Visual Studio)"
+HOMEPAGE="http://www.sourceforge.net/projects/parity/"
+
+LICENSE="LGPL-3"
+SLOT="0"
+IUSE=""
+
+pkg_setup() {
+ if [ -z "${MSSDK}" ]; then
+ einfo "NOTE: When using Visual Studio 2008, the Platform SDK is no longer"
+ einfo "installed alongside with the other components, but has it's own"
+ einfo "root directory, most likely something like this:"
+ einfo ""
+ einfo " C:\\Program Files\\Microsoft SDKs\\Windows\\v6.0A"
+ einfo ""
+ einfo "To make parity find it's paths correctly, please set MSSDK to the"
+ einfo "value correspoding to the above example for your system."
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-debugging.patch
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die "emake install failed"
+
+ # create i586-pc-winnt*-g[++|cc|..] links..
+ local exeext=
+
+ [[ -f ${ED}/usr/bin/parity.gnu.gcc.exe ]] && exeext=.exe
+
+ # create cross compiler syms
+ dosym /usr/bin/parity.gnu.gcc${exeext} /usr/bin/i586-pc-winnt$(uname -r)-gcc
+ dosym /usr/bin/parity.gnu.gcc${exeext} /usr/bin/i586-pc-winnt$(uname -r)-c++
+ dosym /usr/bin/parity.gnu.gcc${exeext} /usr/bin/i586-pc-winnt$(uname -r)-g++
+ dosym /usr/bin/parity.gnu.ld${exeext} /usr/bin/i586-pc-winnt$(uname -r)-ld
+
+ # we don't need the header files installed by parity... private
+ # header files are supported with a patch from 2.1.0-r1 onwards,
+ # so they won't be there anymore, but -f does the job in any case.
+ rm -f "${ED}"/usr/include/*.h
+}
diff --git a/sys-devel/parity/parity-9999.ebuild b/sys-devel/parity/parity-9999.ebuild
new file mode 100644
index 000000000000..4ef00d50b81a
--- /dev/null
+++ b/sys-devel/parity/parity-9999.ebuild
@@ -0,0 +1,57 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+if [[ ${PV} == 9999 ]]; then
+ inherit subversion
+ ESVN_REPO_URI="http://svn.code.sf.net/p/parity/code/trunk"
+ ESVN_BOOTSTRAP="confix --bootstrap"
+ ESVN_PROJECT="${PN}"
+ : ${KEYWORDS=""}
+
+ DEPEND="dev-util/confix"
+else
+ SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+ KEYWORDS="~x86-interix"
+fi
+DESCRIPTION="An Interix to native Win32 Cross-Compiler Tool (requires Visual Studio)"
+HOMEPAGE="http://www.sourceforge.net/projects/parity/"
+
+LICENSE="LGPL-3"
+SLOT="0"
+IUSE=""
+
+pkg_setup() {
+ if [ -z "${MSSDK}" ]; then
+ einfo "NOTE: When using Visual Studio 2008, the Platform SDK is no longer"
+ einfo "installed alongside with the other components, but has it's own"
+ einfo "root directory, most likely something like this:"
+ einfo ""
+ einfo " C:\\Program Files\\Microsoft SDKs\\Windows\\v6.0A"
+ einfo ""
+ einfo "To make parity find it's paths correctly, please set MSSDK to the"
+ einfo "value correspoding to the above example for your system."
+ fi
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die "emake install failed"
+
+ # create i586-pc-winnt*-g[++|cc|..] links..
+ local exeext=
+
+ [[ -f ${ED}/usr/bin/parity.gnu.gcc.exe ]] && exeext=.exe
+
+ # create cross compiler syms
+ dosym /usr/bin/parity.gnu.gcc${exeext} /usr/bin/i586-pc-winnt$(uname -r)-gcc
+ dosym /usr/bin/parity.gnu.gcc${exeext} /usr/bin/i586-pc-winnt$(uname -r)-c++
+ dosym /usr/bin/parity.gnu.gcc${exeext} /usr/bin/i586-pc-winnt$(uname -r)-g++
+ dosym /usr/bin/parity.gnu.ld${exeext} /usr/bin/i586-pc-winnt$(uname -r)-ld
+
+ # we don't need the header files installed by parity... private
+ # header files are supported with a patch from 2.1.0-r1 onwards,
+ # so they won't be there anymore, but -f does the job in any case.
+ rm -f "${ED}"/usr/include/*.h
+}
diff --git a/sys-devel/patch/Manifest b/sys-devel/patch/Manifest
new file mode 100644
index 000000000000..f45c742b5d25
--- /dev/null
+++ b/sys-devel/patch/Manifest
@@ -0,0 +1,3 @@
+DIST patch-2.7.3.tar.xz 684764 SHA256 d09022de9d629561bf4dad44625ef4b1ead15178b210412113531730cdb6f19d SHA512 8d2e3010cfb3283913edb87cbf8d3c474811dc0d288fcb6b87b8ce62296ae95c16dd3b59f21345905d4ffbc572d0be985612eebf90f0e9ee390ca53613402836 WHIRLPOOL 7b4e5471e22c24d97ebac94939582d5d3d311f057e97b43f39def297b7c2db723f5558d66d10c3b289caea241b931dea49beabfe0ec03c0c6d0f91bc526ad52c
+DIST patch-2.7.4.tar.xz 714392 SHA256 0eacbb07ce106fe4dcbfbe6c052e55b50bf3df8e1bb16228c9da77b6659ff109 SHA512 7842ad925c6223b1e106844d403a66151fd511a51bf2c78f3c15aa15f5e923f9b58d139bc098aca7c7c6d07e78c01dba729a7e85e93c1c7d18f3150314be0a6f WHIRLPOOL 71c5643345b6c573afe59b13a9c69c0076b38bbd3448220f645b4bb0fc629dc598e37242770de52fa4f1fb949a90375e1b9dca2d43188342562385ad77512d84
+DIST patch-2.7.5.tar.xz 727704 SHA256 fd95153655d6b95567e623843a0e77b81612d502ecf78a489a4aed7867caa299 SHA512 6620ac8101f60c0b456ce339fa5e371f40be0b391e2e9728f34f3625f9907e516de61dac2f91bc76e6fd28a9bd1224efc3ba827cfaa606d857730c1af4195a0f WHIRLPOOL 27e209cd99b0e3366c7e094e54581510fb3018202fc79d6a906e14e87efae1b7b7548fcafb70af6f5db59f08237fd0f5363789d719ff3452925bd99dc41a9cdb
diff --git a/sys-devel/patch/metadata.xml b/sys-devel/patch/metadata.xml
new file mode 100644
index 000000000000..96a2d586367d
--- /dev/null
+++ b/sys-devel/patch/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-devel/patch/patch-2.7.3.ebuild b/sys-devel/patch/patch-2.7.3.ebuild
new file mode 100644
index 000000000000..7f8abcef7a61
--- /dev/null
+++ b/sys-devel/patch/patch-2.7.3.ebuild
@@ -0,0 +1,30 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit flag-o-matic eutils
+
+DESCRIPTION="Utility to apply diffs to files"
+HOMEPAGE="http://www.gnu.org/software/patch/patch.html"
+SRC_URI="mirror://gnu/patch/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~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="static test xattr"
+
+RDEPEND="xattr? ( sys-apps/attr )"
+DEPEND="${RDEPEND}
+ test? ( sys-apps/ed )"
+
+src_configure() {
+ use static && append-ldflags -static
+
+ # Do not let $ED mess up the search for `ed` 470210.
+ ac_cv_path_ED=$(type -P ed) \
+ econf \
+ $(use_enable xattr) \
+ --program-prefix="$(use userland_BSD && echo g)"
+}
diff --git a/sys-devel/patch/patch-2.7.4.ebuild b/sys-devel/patch/patch-2.7.4.ebuild
new file mode 100644
index 000000000000..a7aab5abe302
--- /dev/null
+++ b/sys-devel/patch/patch-2.7.4.ebuild
@@ -0,0 +1,30 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit flag-o-matic eutils
+
+DESCRIPTION="Utility to apply diffs to files"
+HOMEPAGE="http://www.gnu.org/software/patch/patch.html"
+SRC_URI="mirror://gnu/patch/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~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="static test xattr"
+
+RDEPEND="xattr? ( sys-apps/attr )"
+DEPEND="${RDEPEND}
+ test? ( sys-apps/ed )"
+
+src_configure() {
+ use static && append-ldflags -static
+
+ # Do not let $ED mess up the search for `ed` 470210.
+ ac_cv_path_ED=$(type -P ed) \
+ econf \
+ $(use_enable xattr) \
+ --program-prefix="$(use userland_BSD && echo g)"
+}
diff --git a/sys-devel/patch/patch-2.7.5.ebuild b/sys-devel/patch/patch-2.7.5.ebuild
new file mode 100644
index 000000000000..d484a508ccf4
--- /dev/null
+++ b/sys-devel/patch/patch-2.7.5.ebuild
@@ -0,0 +1,30 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit flag-o-matic eutils
+
+DESCRIPTION="Utility to apply diffs to files"
+HOMEPAGE="http://www.gnu.org/software/patch/patch.html"
+SRC_URI="mirror://gnu/patch/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~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="static test xattr"
+
+RDEPEND="xattr? ( sys-apps/attr )"
+DEPEND="${RDEPEND}
+ test? ( sys-apps/ed )"
+
+src_configure() {
+ use static && append-ldflags -static
+
+ # Do not let $ED mess up the search for `ed` 470210.
+ ac_cv_path_ED=$(type -P ed) \
+ econf \
+ $(use_enable xattr) \
+ --program-prefix="$(use userland_BSD && echo g)"
+}
diff --git a/sys-devel/pmake/Manifest b/sys-devel/pmake/Manifest
new file mode 100644
index 000000000000..334990d84e5b
--- /dev/null
+++ b/sys-devel/pmake/Manifest
@@ -0,0 +1,3 @@
+DIST pmake_1.111-3.1.debian.tar.gz 32176 SHA256 964101c5c06f32161398bf6efa0c52e59763523bd633fded6eb165ec3d025da7 SHA512 a5743c0b0478119cf8ac01b0182f14cf213b275078b1cd2badee9ac26a3b40660bf4fd430af079fdaa7bc8117ed8a1cdf855166e34e151204e34e7d2b67beee3 WHIRLPOOL 155682e807d06b9df0a8ce37f1e98250246ea7cda12f7342cf25388b08f4e5d4b1cb3aa4922a4dbd37f6ffcba0918ae32d37686f91abeca6517cfafe0bffedac
+DIST pmake_1.111-3.3.debian.tar.gz 31648 SHA256 2bf161316e0e97ea90a9fe1d53d6dbd262351145a805890aa88faa91aa458366 SHA512 b22a1d9e371712732f196d91ac3eb9239fa98ee8ee05754576e7a5878cab88976cb10bb6be90706df5ac738373f519468403c23f6a3ff3860a2968b3222a66ed WHIRLPOOL a07f64bbff44293d796afdda5ebd61f697060a749b2eb1eea66dba4850e91481a9d5ade9a71a1b24dd08dba4a36dc5ff86e08fe2a70cce221fb7302ebafbeaa7
+DIST pmake_1.111.orig.tar.gz 264383 SHA256 dde37ac618f19a7cce174754c207e90501cab362b51f904bcfb20dfb24a13539 SHA512 ad48708ea014d6a38ad36303504c52992b51a1e815564f1710849d859b1fc3cd58c4a1a71f54ec902c9b69112e9cd1e1a64282ff738439cdb209a4f75c364c22 WHIRLPOOL c3038682686acc4c32e25efb3db623b06f7f1d6df5813389319cc32151207f0cb93e44bedd82e7486907cbb9f0950a4a80c811eb1b6a148083bef23f613a7ec2
diff --git a/sys-devel/pmake/files/pmake-1.111.1-ldflags.patch b/sys-devel/pmake/files/pmake-1.111.1-ldflags.patch
new file mode 100644
index 000000000000..d6047d48994b
--- /dev/null
+++ b/sys-devel/pmake/files/pmake-1.111.1-ldflags.patch
@@ -0,0 +1,13 @@
+Index: pmake/Makefile.boot
+===================================================================
+--- pmake.orig/Makefile.boot
++++ pmake/Makefile.boot
+@@ -36,7 +36,7 @@ LIBOBJ= lst.lib/lstAppend.o lst.lib/lstA
+
+ bmake: ${OBJ} ${LIBOBJ}
+ # @echo 'make of make and make.0 started.'
+- ${CC} ${CFLAGS} ${OBJ} ${LIBOBJ} -o bmake ${LIBS}
++ ${CC} ${LDFLAGS} ${CFLAGS} ${OBJ} ${LIBOBJ} -o bmake ${LIBS}
+ @ls -l $@
+ # nroff -h -man make.1 > make.0
+ # @echo 'make of make and make.0 completed.'
diff --git a/sys-devel/pmake/files/pmake-1.98-skipdots.patch b/sys-devel/pmake/files/pmake-1.98-skipdots.patch
new file mode 100644
index 000000000000..6783a9799919
--- /dev/null
+++ b/sys-devel/pmake/files/pmake-1.98-skipdots.patch
@@ -0,0 +1,12 @@
+diff -urN pmake-2.0.orig/dir.c pmake-2.0/dir.c
+--- pmake-2.0.orig/dir.c 2005-02-08 09:26:28.932978574 -0500
++++ pmake-2.0/dir.c 2005-02-08 09:36:18.208704201 -0500
+@@ -1528,6 +1528,8 @@
+ Hash_InitTable (&p->files, -1);
+
+ while ((dp = readdir (d)) != (struct dirent *) NULL) {
++ if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, ".."))
++ continue;
+ #if defined(sun) && defined(d_ino) /* d_ino is a sunos4 #define for d_fileno */
+ /*
+ * The sun directory library doesn't check for a 0 inode
diff --git a/sys-devel/pmake/metadata.xml b/sys-devel/pmake/metadata.xml
new file mode 100644
index 000000000000..ecedda4aa2cc
--- /dev/null
+++ b/sys-devel/pmake/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>bsd</herd>
+</pkgmetadata>
diff --git a/sys-devel/pmake/pmake-1.111.3.1.ebuild b/sys-devel/pmake/pmake-1.111.3.1.ebuild
new file mode 100644
index 000000000000..d110c5d1c9d0
--- /dev/null
+++ b/sys-devel/pmake/pmake-1.111.3.1.ebuild
@@ -0,0 +1,81 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit eutils toolchain-funcs versionator
+
+MY_P="${PN}-$(get_version_component_range 1-2)"
+DEBIAN_SOURCE="${PN}_$(get_version_component_range 1-2).orig.tar.gz"
+DEBIAN_PATCH="${PN}_$(replace_version_separator 2 '-').debian.tar.gz"
+
+DESCRIPTION="BSD build tool to create programs in parallel. Debian's version of NetBSD's make"
+HOMEPAGE="http://www.netbsd.org/"
+SRC_URI="mirror://debian/pool/main/p/pmake/${DEBIAN_SOURCE}
+ mirror://debian/pool/main/p/pmake/${DEBIAN_PATCH}"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="alpha amd64 arm ia64 ~mips ppc ppc64 sparc x86 ~amd64-linux ~x86-linux"
+IUSE=""
+
+RDEPEND=""
+DEPEND=""
+
+S="${WORKDIR}/${PN}"
+
+src_prepare() {
+ EPATCH_FORCE="yes" \
+ EPATCH_OPTS="-g0 -E --no-backup-if-mismatch -p1" \
+ EPATCH_SUFFIX="diff" \
+ epatch "${WORKDIR}/debian/patches"
+
+ # pmake makes the assumption that . and .. are the first two
+ # entries in a directory, which doesn't always appear to be the
+ # case on ext3... (05 Apr 2004 agriffis)
+ epatch "${FILESDIR}/${PN}-1.98-skipdots.patch"
+
+ # Don't ignore ldflags
+ epatch "${FILESDIR}/${PN}-1.111.1-ldflags.patch"
+}
+
+src_compile() {
+ # The following CFLAGS are almost directly from Red Hat 8.0 and
+ # debian/rules, so assume it's okay to void out the __COPYRIGHT
+ # and __RCSID. I've checked the source and don't see the point,
+ # but whatever... (07 Feb 2004 agriffis)
+ CFLAGS="${CFLAGS} -Wall -Wno-unused -D_GNU_SOURCE \
+ -DHAVE_STRERROR -DHAVE_STRDUP -DHAVE_SETENV \
+ -D__COPYRIGHT\(x\)= -D__RCSID\(x\)= -I. \
+ -DMACHINE=\\\"gentoo\\\" -DMACHINE_ARCH=\\\"$(tc-arch-kernel)\\\" \
+ -D_PATH_DEFSHELLDIR=\\\"${EPREFIX}/bin\\\" \
+ -D_PATH_DEFSYSPATH=\\\"${EPREFIX}/usr/share/mk\\\" \
+ -DHAVE_VSNPRINTF"
+ if [[ "${USERLAND}" == "GNU" ]]; then
+ CFLAGS="${CFLAGS} -D_PATH_DEFSYSPATH=\\\"${EPREFIX}/usr/share/mk/${PN}\\\""
+ fi
+
+ emake -f Makefile.boot \
+ CC="$(tc-getCC)" \
+ CFLAGS="${CFLAGS}"
+}
+
+src_install() {
+ # Don't install these on BSD, else they conflict
+ if [[ "${USERLAND}" == "GNU" ]]; then
+ insinto /usr/share/mk/${PN}
+ doins mk/*
+ fi
+
+ newbin bmake pmake
+ dobin mkdep
+ mv make.1 pmake.1
+ doman mkdep.1 pmake.1
+ dodoc PSD.doc/tutorial.ms
+
+ if [[ "${USERLAND}" == "BSD" ]]; then
+ dosym pmake /usr/bin/make
+ dosym pmake.1.gz /usr/share/man/man1/make.1.gz
+ fi
+}
diff --git a/sys-devel/pmake/pmake-1.111.3.3.ebuild b/sys-devel/pmake/pmake-1.111.3.3.ebuild
new file mode 100644
index 000000000000..a1ae1d5c1232
--- /dev/null
+++ b/sys-devel/pmake/pmake-1.111.3.3.ebuild
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit eutils toolchain-funcs versionator linux-info
+
+MY_P="${PN}-$(get_version_component_range 1-2)"
+DEBIAN_SOURCE="${PN}_$(get_version_component_range 1-2).orig.tar.gz"
+DEBIAN_PATCH="${PN}_$(replace_version_separator 2 '-').debian.tar.gz"
+
+DESCRIPTION="BSD build tool to create programs in parallel. Debian's version of NetBSD's make"
+HOMEPAGE="http://www.netbsd.org/"
+SRC_URI="mirror://debian/pool/main/p/pmake/${DEBIAN_SOURCE}
+ mirror://debian/pool/main/p/pmake/${DEBIAN_PATCH}"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="alpha amd64 arm ia64 ~mips ppc ppc64 sparc x86 ~amd64-linux ~x86-linux"
+IUSE=""
+
+RDEPEND=""
+DEPEND=""
+
+S="${WORKDIR}/${PN}"
+
+src_prepare() {
+ EPATCH_FORCE="yes" \
+ EPATCH_OPTS="-g0 -E --no-backup-if-mismatch -p1" \
+ EPATCH_SUFFIX="diff" \
+ epatch "${WORKDIR}/debian/patches"
+
+ # pmake makes the assumption that . and .. are the first two
+ # entries in a directory, which doesn't always appear to be the
+ # case on ext3... (05 Apr 2004 agriffis)
+ epatch "${FILESDIR}/${PN}-1.98-skipdots.patch"
+
+ # Don't ignore ldflags
+ epatch "${FILESDIR}/${PN}-1.111.1-ldflags.patch"
+}
+
+src_compile() {
+ # The following CFLAGS are almost directly from Red Hat 8.0 and
+ # debian/rules, so assume it's okay to void out the __COPYRIGHT
+ # and __RCSID. I've checked the source and don't see the point,
+ # but whatever... (07 Feb 2004 agriffis)
+ CFLAGS="${CFLAGS} -Wall -Wno-unused -D_GNU_SOURCE \
+ -DHAVE_STRERROR -DHAVE_STRDUP -DHAVE_SETENV \
+ -D__COPYRIGHT\(x\)= -D__RCSID\(x\)= -I. \
+ -DMACHINE=\\\"gentoo\\\" -DMACHINE_ARCH=\\\"$(tc-arch-kernel)\\\" \
+ -D_PATH_DEFSHELLDIR=\\\"${EPREFIX}/bin\\\" \
+ -D_PATH_DEFSYSPATH=\\\"${EPREFIX}/usr/share/mk\\\" \
+ -DHAVE_VSNPRINTF"
+ if [[ "${USERLAND}" == "GNU" ]]; then
+ CFLAGS="${CFLAGS} -D_PATH_DEFSYSPATH=\\\"${EPREFIX}/usr/share/mk/${PN}\\\""
+ fi
+
+ emake -f Makefile.boot \
+ CC="$(tc-getCC)" \
+ CFLAGS="${CFLAGS}"
+}
+
+src_install() {
+ # Don't install these on BSD, else they conflict
+ if [[ "${USERLAND}" == "GNU" ]]; then
+ insinto /usr/share/mk/${PN}
+ doins mk/*
+ fi
+
+ newbin bmake pmake
+ dobin mkdep
+ mv make.1 pmake.1
+ doman mkdep.1 pmake.1
+ dodoc PSD.doc/tutorial.ms
+
+ if [[ "${USERLAND}" == "BSD" ]]; then
+ dosym pmake /usr/bin/make
+ dosym pmake.1.gz /usr/share/man/man1/make.1.gz
+ fi
+}
diff --git a/sys-devel/prelink/Manifest b/sys-devel/prelink/Manifest
new file mode 100644
index 000000000000..283f1e20ee68
--- /dev/null
+++ b/sys-devel/prelink/Manifest
@@ -0,0 +1,4 @@
+DIST prelink-20110511.tar.bz2 924501 SHA256 038725b6e3125dc163bca6c6bd348958ca117510d6d2603f06431fee59b4e0fe SHA512 4ae8a8a9fc29c98954e43eb606bef5e4d6eeca6ea9cec855f13e640e1090dd99543c60da240bc8f68b01e1ec94a6860863772378b1b13191faf42912fb8d51ec WHIRLPOOL 8e8dc9247bfd9425527f7246aa2e61ff351a7701729c22f04bddce46ac37fe109a2c777cc880a40a55a28a0072337e5e8f8e410616b537180486c757f2dad161
+DIST prelink-20111012.tar.bz2 926500 SHA256 b86df2e6c051176da711a85982b80d87c8ce8e053e04bd0ffb2f9ba817f62aaf SHA512 51e57337b528728e916a69c2fc6a21503882d43317d927c1c3990193b929e7d0a91e04411647fd798f4f2467a87dc5482a8f8f95650546bb2336d42e563e66cf WHIRLPOOL e4c0b2ec05694ea56dd365b725f19d8b263a6392426ac47d4cefa49326a32b6174026416b98acb5a56a2644c2094db6f4c4c3523de3b74d33c09ac42e235ae66
+DIST prelink-20120628.tar.bz2 917485 SHA256 46548d655e9d764260b735ecdd1c8b0673756224f5fd9a4f14fef1cdb6bad44d SHA512 ee45d0c916fe8dd8e358ba1bae2ea0af41f7ae45a77b2c126236f93035bd335797834714fd9d7841a3e6987855a12adf5c8c954c72155e51319786ac21ed42ef WHIRLPOOL 06f34a15363924576bfa8c54180a78993589c3fd51c6a4cd7a58c823c4a5738591bc9332173e3312a557b1af4c1c71bc1f02982145fd9af5ad1f7063be58a205
+DIST prelink-20130503.tar.bz2 928040 SHA256 6339c7605e9b6f414d1be32530c9c8011f38820d36431c8a62e8674ca37140f0 SHA512 69138a695e3e535deacd8224f6f8364ff64b8868b87b516d1f3392d9df968f77265177e9fede09c38f16aa878f9fd57a9ec39f0d9deabc0c9c01609b11156ba3 WHIRLPOOL 51b4234009c6ac6e6f45f09e3513feb5efe1dbf9d705b55f88d0443fe386bacbe04fa4a4e5d60caf40ef0a98a5557eb2e9f3a11549ec01c0200c324cb948ab34
diff --git a/sys-devel/prelink/files/prelink-20061201-prelink-conf.patch b/sys-devel/prelink/files/prelink-20061201-prelink-conf.patch
new file mode 100644
index 000000000000..9397088c5cd8
--- /dev/null
+++ b/sys-devel/prelink/files/prelink-20061201-prelink-conf.patch
@@ -0,0 +1,31 @@
+--- doc/prelink.conf.orig 2008-08-29 08:18:59.000000000 -0400
++++ doc/prelink.conf 2008-08-29 08:21:48.000000000 -0400
+@@ -16,8 +16,11 @@
+ -b *.a
+ -b *.js
+ -b /lib/modules
+--b /usr/lib/locale
+--b /usr/X11R6/lib{,64}/X11/xfig
++-b /usr/lib{,32,64}/locale
++-b /usr/lib{,32,64}/wine
++-b /usr/lib{,32,64}/valgrind
++-b /usr/X11R6/lib{,32,64}/X11/xfig
++-b /usr/src
+ -l /bin
+ -l /usr/bin
+ -l /sbin
+@@ -27,9 +30,9 @@
+ -l /usr/games
+ -l /usr/libexec
+ -l /var/ftp/bin
+--l /lib{,64}
+--l /usr/lib{,64}
+--l /usr/X11R6/lib{,64}
+--l /usr/kerberos/lib{,64}
++-l /lib{,32,64}
++-l /usr/lib{,32,64}
++-l /usr/X11R6/lib{,32,64}
++-l /usr/kerberos/lib{,32,64}
+ -l /usr/X11R6/LessTif
+--l /var/ftp/lib{,64}
++-l /var/ftp/lib{,32,64}
diff --git a/sys-devel/prelink/files/prelink-20130503-libiberty-md5.patch b/sys-devel/prelink/files/prelink-20130503-libiberty-md5.patch
new file mode 100644
index 000000000000..36b8bcecb312
--- /dev/null
+++ b/sys-devel/prelink/files/prelink-20130503-libiberty-md5.patch
@@ -0,0 +1,61 @@
+From 8eeb9da6d017761037bf757780ea544dfeabbad8 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Tue, 31 Jul 2012 09:02:35 +0000
+Subject: [PATCH] libiberty/md5: fix strict alias warnings
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Current libiberty md5 code triggers these warnings with gcc-4.7.1 for me:
+
+libiberty/md5.c: In function ‘md5_finish_ctx’:
+libiberty/md5.c:117:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
+libiberty/md5.c:118:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
+
+The change below fixes things for me. The optimized output (-O2) is the same
+before/after my change on x86_64-linux. I imagine it'll be the same for most
+targets. It seems simpler than using a union on the md5_ctx buffer since these
+are the only two locations in the code where this occurs.
+---
+ libiberty/ChangeLog | 5 +++++
+ libiberty/md5.c | 12 ++++++++----
+ 2 files changed, 13 insertions(+), 4 deletions(-)
+
+2012-07-31 Mike Frysinger <vapier@gentoo.org>
+
+ * md5.c (md5_finish_ctx): Declare swap_bytes. Assign SWAP() output
+ to swap_bytes, and then call memcpy to move it to ctx->buffer.
+
+diff --git a/libiberty/md5.c b/libiberty/md5.c
+index 0db8fc8..8cc0cb5 100644
+--- a/src/md5.c
++++ b/src/md5.c
+@@ -103,6 +103,7 @@ md5_finish_ctx (struct md5_ctx *ctx, void *resbuf)
+ {
+ /* Take yet unprocessed bytes into account. */
+ md5_uint32 bytes = ctx->buflen;
++ md5_uint32 swap_bytes;
+ size_t pad;
+
+ /* Now count remaining bytes. */
+@@ -113,10 +114,13 @@ md5_finish_ctx (struct md5_ctx *ctx, void *resbuf)
+ pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes;
+ memcpy (&ctx->buffer[bytes], fillbuf, pad);
+
+- /* Put the 64-bit file length in *bits* at the end of the buffer. */
+- *(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP (ctx->total[0] << 3);
+- *(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP ((ctx->total[1] << 3) |
+- (ctx->total[0] >> 29));
++ /* Put the 64-bit file length in *bits* at the end of the buffer.
++ Use memcpy to avoid aliasing problems. On most systems, this
++ will be optimized away to the same code. */
++ swap_bytes = SWAP (ctx->total[0] << 3);
++ memcpy (&ctx->buffer[bytes + pad], &swap_bytes, sizeof (swap_bytes));
++ swap_bytes = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29));
++ memcpy (&ctx->buffer[bytes + pad + 4], &swap_bytes, sizeof (swap_bytes));
+
+ /* Process last bytes. */
+ md5_process_block (ctx->buffer, bytes + pad + 8, ctx);
+--
+1.8.2.1
+
diff --git a/sys-devel/prelink/files/prelink-20130503-prelink-conf.patch b/sys-devel/prelink/files/prelink-20130503-prelink-conf.patch
new file mode 100644
index 000000000000..9233a4114827
--- /dev/null
+++ b/sys-devel/prelink/files/prelink-20130503-prelink-conf.patch
@@ -0,0 +1,39 @@
+--- a/doc/prelink.conf
++++ b/doc/prelink.conf
+@@ -5,6 +5,7 @@
+ # If a directory name is prefixed with `-h ', symbolic links in a
+ # directory hierarchy are followed.
+ # Directories or files with `-b ' prefix will be blacklisted.
++-c /etc/prelink.conf.d/*.conf
+ -b *.la
+ -b *.png
+ -b *.py
+@@ -16,8 +16,11 @@
+ -b *.a
+ -b *.js
+ -b /lib/modules
+--b /usr/lib/locale
+--b /usr/X11R6/lib{,64}/X11/xfig
++-b /usr/lib{,x32,32,64}/locale
++-b /usr/lib{,x32,32,64}/wine
++-b /usr/lib{,x32,32,64}/valgrind
++-b /usr/X11R6/lib{,x32,32,64}/X11/xfig
++-b /usr/src
+ -l /bin
+ -l /usr/bin
+ -l /sbin
+@@ -27,9 +30,9 @@
+ -l /usr/games
+ -l /usr/libexec
+ -l /var/ftp/bin
+--l /lib{,64}
+--l /usr/lib{,64}
+--l /usr/X11R6/lib{,64}
+--l /usr/kerberos/lib{,64}
++-l /lib{,x32,32,64}
++-l /usr/lib{,x32,32,64}
++-l /usr/X11R6/lib{,x32,32,64}
++-l /usr/kerberos/lib{,x32,32,64}
+ -l /usr/X11R6/LessTif
+--l /var/ftp/lib{,64}
++-l /var/ftp/lib{,x32,32,64}
diff --git a/sys-devel/prelink/files/prelink-armhf-dynamic-linker.patch b/sys-devel/prelink/files/prelink-armhf-dynamic-linker.patch
new file mode 100644
index 000000000000..896101040b5b
--- /dev/null
+++ b/sys-devel/prelink/files/prelink-armhf-dynamic-linker.patch
@@ -0,0 +1,12 @@
+diff -urNp prelink_orig/src/arch-arm.c prelink/src/arch-arm.c
+--- prelink_orig/src/arch-arm.c 2011-08-26 03:20:49.000000000 -0400
++++ prelink/src/arch-arm.c 2012-11-28 23:59:28.030164736 -0500
+@@ -832,7 +832,7 @@ PL_ARCH = {
+ .R_COPY = R_ARM_COPY,
+ .R_RELATIVE = R_ARM_RELATIVE,
+ .rtype_class_valid = RTYPE_CLASS_VALID,
+- .dynamic_linker = "/lib/ld-linux.so.3",
++ .dynamic_linker = "/lib/ld-linux-armhf.so.3",
+ .adjust_dyn = arm_adjust_dyn,
+ .adjust_rel = arm_adjust_rel,
+ .adjust_rela = arm_adjust_rela,
diff --git a/sys-devel/prelink/files/prelink.confd b/sys-devel/prelink/files/prelink.confd
new file mode 100644
index 000000000000..6b89b8c1f1fd
--- /dev/null
+++ b/sys-devel/prelink/files/prelink.confd
@@ -0,0 +1,43 @@
+# For an in depth prelinking guide, please see:
+# http://www.gentoo.org/doc/en/prelink-howto.xml
+
+# Control prelinking behavior in the cronjob.
+# yes - automatically prelink the system
+# no - automatically un-prelink the system
+# "" - do nothing at all (user manages)
+# (if you change this from yes to no prelink -ua
+# will be run next night to undo prelinking)
+PRELINKING=""
+
+# Options to pass to prelink
+# -m Try to conserve virtual memory by allowing overlapping
+# assigned virtual memory slots for libraries which
+# never appear together in one binary
+# -R Randomize virtual memory slot assignments for libraries.
+# This makes it slightly harder for various buffer overflow
+# attacks, since library addresses will be different on each
+# host using -R.
+PRELINK_OPTS=-mR
+
+# How often should full prelink be run (in days)
+# Normally, prelink will be run in quick mode, every
+# $PRELINK_FULL_TIME_INTERVAL days it will be run
+# in normal mode. Comment it out if it should be run
+# in normal mode always.
+PRELINK_FULL_TIME_INTERVAL=14
+
+# How often should prelink run (in days) even if
+# no packages have been upgraded via portage.
+# If $PRELINK_FULL_TIME_INTERVAL days have not elapsed
+# yet since last normal mode prelinking, last
+# quick mode prelinking happened less than
+# $PRELINK_NOEMER_CHECK_INTERVAL days ago
+# and no packages have been upgraded by portage
+# since last quick mode prelinking, prelink
+# will not do anything.
+# Change to
+# PRELINK_NOEMER_CHECK_INTERVAL=0
+# if you want to disable the portage database timestamp
+# check (especially if you don't use portage
+# exclusively to upgrade system libraries and/or binaries).
+PRELINK_NOEMER_CHECK_INTERVAL=7
diff --git a/sys-devel/prelink/files/prelink.cron b/sys-devel/prelink/files/prelink.cron
new file mode 100644
index 000000000000..a3edc429fee7
--- /dev/null
+++ b/sys-devel/prelink/files/prelink.cron
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+. /etc/conf.d/prelink
+log="/var/log/prelink.log"
+
+case $PRELINKING in
+ yes|no);;
+ *) exit 0;;
+esac
+
+ionice -c3 -p $$ >/dev/null 2>&1
+renice +19 -p $$ >/dev/null 2>&1
+
+if [ "$PRELINKING" != yes ]; then
+ sed -ri '/^[[:space:]]*#?[[:space:]]*KDE_IS_PRELINKED=/s:.*:#KDE_IS_PRELINKED=1:' /etc/env.d/*kde* 2>/dev/null
+ if [ -f /etc/prelink.cache ]; then
+ echo /usr/sbin/prelink -uav > ${log}
+ /usr/sbin/prelink -uav >> ${log} 2>&1 \
+ || echo Prelink failed with return value $? >> ${log}
+ rm -f /etc/prelink.cache
+ # Restart init if needed
+ [ -n "$(find `ldd /sbin/init | awk 'NF == 4 { print $3 }'` /sbin/init -ctime -1 2>/dev/null )" ] && /sbin/telinit u
+ fi
+ exit 0
+fi
+
+sed -ri '/^[[:space:]]*#?[[:space:]]*KDE_IS_PRELINKED=/s:.*:KDE_IS_PRELINKED=1:' /etc/env.d/*kde* 2>/dev/null
+
+if [ ! -f /etc/prelink.cache -o -f /var/lib/misc/prelink.force ] \
+ || grep -q '^prelink-ELF0.[0-2]' /etc/prelink.cache; then
+ # If cache does not exist or is from older prelink versions or
+ # if we were asked to explicitely, force full prelinking
+ rm -f /etc/prelink.cache /var/lib/misc/prelink.force
+ PRELINK_OPTS="$PRELINK_OPTS -f"
+ date > /var/lib/misc/prelink.full
+ cp -a /var/lib/misc/prelink.full /var/lib/misc/prelink.quick
+elif [ -n "$PRELINK_FULL_TIME_INTERVAL" \
+ -a "`find /var/lib/misc/prelink.full -mtime -${PRELINK_FULL_TIME_INTERVAL} 2>/dev/null`" \
+ = /var/lib/misc/prelink.full ]; then
+ # If no more than PRELINK_NOEMER_CHECK_INTERVAL days elapsed from last prelink
+ # (be it full or quick) and no packages have been upgraded via rpm since then,
+ # don't do anything.
+ [ "`find /var/lib/misc/prelink.quick -mtime -${PRELINK_NOEMER_CHECK_INTERVAL:-7} 2>/dev/null`" \
+ -a -f /var/cache/edb/counter \
+ -a /var/cache/edb/counter -ot /var/lib/misc/prelink.quick ] && exit 0
+ date > /var/lib/misc/prelink.quick
+ # If prelink without -q has been run in the last
+ # PRELINK_FULL_TIME_INTERVAL days, just use quick mode
+ PRELINK_OPTS="$PRELINK_OPTS -q"
+else
+ date > /var/lib/misc/prelink.full
+ cp -a /var/lib/misc/prelink.full /var/lib/misc/prelink.quick
+fi
+
+echo /usr/sbin/prelink -av $PRELINK_OPTS > ${log}
+/usr/sbin/prelink -av $PRELINK_OPTS >> ${log} 2>&1 \
+ || echo Prelink failed with return value $? >> ${log}
+# Restart init if needed
+[ -n "$(find `ldd /sbin/init | awk 'NF == 4 { print $3 }'` /sbin/init -ctime -1 2>/dev/null )" ] && /sbin/telinit u
+
+exit 0
diff --git a/sys-devel/prelink/metadata.xml b/sys-devel/prelink/metadata.xml
new file mode 100644
index 000000000000..fb4199eb7afe
--- /dev/null
+++ b/sys-devel/prelink/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-devel/prelink/prelink-20110511.ebuild b/sys-devel/prelink/prelink-20110511.ebuild
new file mode 100644
index 000000000000..36da2f13a86d
--- /dev/null
+++ b/sys-devel/prelink/prelink-20110511.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 eutils flag-o-matic
+
+DESCRIPTION="Modifies ELFs to avoid runtime symbol resolutions resulting in faster load times"
+HOMEPAGE="http://people.redhat.com/jakub/prelink"
+
+SRC_URI="mirror://gentoo/${P}.tar.bz2"
+#SRC_URI="http://people.redhat.com/jakub/prelink/${P}.tar.bz2"
+#
+# if not available rip the distfile with rpm2targz from
+# http://mirrors.kernel.org/fedora/development/rawhide/source/SRPMS/prelink-[ver].src.rpm
+
+# track http://pkgs.fedoraproject.org/gitweb/?p=prelink.git;a=summary for
+# version bumps
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 -arm ppc ppc64 x86"
+IUSE=""
+
+DEPEND=">=dev-libs/elfutils-0.100[static-libs(+)]
+ !dev-libs/libelf
+ >=sys-libs/glibc-2.8"
+RDEPEND="${DEPEND}
+ >=sys-devel/binutils-2.18"
+
+S=${WORKDIR}/${PN}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-20061201-prelink-conf.patch
+
+ sed -i -e 's:undosyslibs.sh::' testsuite/Makefile.in #254201
+ sed -i -e '/^CC=/s: : -Wl,--disable-new-dtags :' testsuite/functions.sh #100147
+
+ # older GCCs don't support this flag
+ # sed it from the Makefile then add it back to CFLAGS so we can use
+ # strip-unsupported-flags
+ sed -i -e 's:-Wno-pointer-sign::' src/Makefile.in #325269
+ append-cflags -Wno-pointer-sign
+ strip-unsupported-flags
+}
+
+src_install() {
+ default
+
+ insinto /etc
+ doins doc/prelink.conf
+
+ exeinto /etc/cron.daily
+ newexe "${FILESDIR}"/prelink.cron prelink
+ newconfd "${FILESDIR}"/prelink.confd prelink
+
+ dodir /var/{lib/misc,log}
+ touch "${D}/var/lib/misc/prelink.full"
+ touch "${D}/var/lib/misc/prelink.quick"
+ touch "${D}/var/lib/misc/prelink.force"
+ touch "${D}/var/log/prelink.log"
+}
+
+pkg_postinst() {
+ echo
+ elog "You may wish to read the Gentoo Linux Prelink Guide, which can be"
+ elog "found online at:"
+ elog
+ elog " https://wiki.gentoo.org/wiki/Prelink"
+ elog
+ elog "Please edit /etc/conf.d/prelink to enable and configure prelink"
+ echo
+ touch "${ROOT}/var/lib/misc/prelink.force"
+}
diff --git a/sys-devel/prelink/prelink-20111012.ebuild b/sys-devel/prelink/prelink-20111012.ebuild
new file mode 100644
index 000000000000..ac6413fc74d7
--- /dev/null
+++ b/sys-devel/prelink/prelink-20111012.ebuild
@@ -0,0 +1,81 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils flag-o-matic
+
+DESCRIPTION="Modifies ELFs to avoid runtime symbol resolutions resulting in faster load times"
+HOMEPAGE="http://people.redhat.com/jakub/prelink"
+
+#SRC_URI="mirror://gentoo/${P}.tar.bz2"
+SRC_URI="http://people.redhat.com/jakub/prelink/${P}.tar.bz2"
+#
+# if not available rip the distfile with rpm2targz from
+# http://mirrors.kernel.org/fedora/development/rawhide/source/SRPMS/prelink-[ver].src.rpm
+
+# track http://pkgs.fedoraproject.org/gitweb/?p=prelink.git;a=summary for
+# version bumps
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 -arm ~ppc ~ppc64 ~x86"
+IUSE=""
+
+DEPEND=">=dev-libs/elfutils-0.100[static-libs(+)]
+ !dev-libs/libelf
+ >=sys-libs/glibc-2.8"
+RDEPEND="${DEPEND}
+ >=sys-devel/binutils-2.18"
+
+S=${WORKDIR}/${PN}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-20061201-prelink-conf.patch
+
+ sed -i -e 's:undosyslibs.sh::' testsuite/Makefile.in #254201
+ sed -i -e '/^CC=/s: : -Wl,--disable-new-dtags :' testsuite/functions.sh #100147
+ # >=binutils-2.22 --no-copy-dt-needed-entries is the default
+ # --copy-dt-needed-entries was renamed from --add-needed in 2.21, use the
+ # former so we don't have to bump the dep
+ sed -i \
+ -e '/CCLINK=/s:\(CCLINK="$(CC)\):\1 -Wl,--add-needed :' \
+ -e '/CXXLINK=/s:\(CXXLINK="$(CXX)\):\1 -Wl,--add-needed :' \
+ testsuite/Makefile.in
+
+ has_version 'dev-libs/elfutils[threads]' && append-ldflags -pthread
+ # older GCCs don't support this flag
+ sed -i -e 's:-Wno-pointer-sign::' src/Makefile.in #325269
+ append-cflags -Wno-pointer-sign
+ strip-unsupported-flags
+}
+
+src_install() {
+ default
+
+ insinto /etc
+ doins doc/prelink.conf
+
+ exeinto /etc/cron.daily
+ newexe "${FILESDIR}"/prelink.cron prelink
+ newconfd "${FILESDIR}"/prelink.confd prelink
+
+ dodir /var/{lib/misc,log}
+ touch "${D}/var/lib/misc/prelink.full"
+ touch "${D}/var/lib/misc/prelink.quick"
+ touch "${D}/var/lib/misc/prelink.force"
+ touch "${D}/var/log/prelink.log"
+}
+
+pkg_postinst() {
+ echo
+ elog "You may wish to read the Gentoo Linux Prelink Guide, which can be"
+ elog "found online at:"
+ elog
+ elog " https://wiki.gentoo.org/wiki/Prelink"
+ elog
+ elog "Please edit /etc/conf.d/prelink to enable and configure prelink"
+ echo
+ touch "${ROOT}/var/lib/misc/prelink.force"
+}
diff --git a/sys-devel/prelink/prelink-20120628.ebuild b/sys-devel/prelink/prelink-20120628.ebuild
new file mode 100644
index 000000000000..32bedf4cd224
--- /dev/null
+++ b/sys-devel/prelink/prelink-20120628.ebuild
@@ -0,0 +1,91 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit autotools eutils flag-o-matic
+
+DESCRIPTION="Modifies ELFs to avoid runtime symbol resolutions resulting in faster load times"
+HOMEPAGE="http://people.redhat.com/jakub/prelink"
+
+SRC_URI="mirror://gentoo/${P}.tar.bz2"
+#SRC_URI="http://people.redhat.com/jakub/prelink/${P}.tar.bz2"
+
+# if not available on jakub's dev space extract the distfile with rpm2tarbz2 from
+# http://mirrors.kernel.org/fedora/development/rawhide/source/SRPMS/prelink-[ver].src.rpm
+#
+# track http://pkgs.fedoraproject.org/cgit/prelink.git/ for updates
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 -arm ~ppc ~ppc64 ~x86"
+IUSE="selinux"
+
+DEPEND=">=dev-libs/elfutils-0.100[static-libs(+)]
+ selinux? ( sys-libs/libselinux[static-libs(+)] )
+ !dev-libs/libelf
+ >=sys-libs/glibc-2.8"
+RDEPEND="${DEPEND}
+ >=sys-devel/binutils-2.18"
+
+S=${WORKDIR}/${PN}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-20061201-prelink-conf.patch
+
+ sed -i -e 's:AM_CONFIG_HEADER:AC_CONFIG_HEADERS:' configure.in || die #469126
+
+ sed -i -e '/^CC=/s: : -Wl,--disable-new-dtags :' testsuite/functions.sh #100147
+ # >=binutils-2.22 --no-copy-dt-needed-entries is the default
+ # --copy-dt-needed-entries was renamed from --add-needed in 2.21, use the
+ # former so we don't have to bump the dep
+ sed -i \
+ -e '/CCLINK=/s:\(CCLINK="$(CC)\):\1 -Wl,--add-needed :' \
+ -e '/CXXLINK=/s:\(CXXLINK="$(CXX)\):\1 -Wl,--add-needed :' \
+ testsuite/Makefile.am
+
+ # older GCCs don't support this flag
+ sed -i -e 's:-Wno-pointer-sign::' src/Makefile.am #325269
+ append-cflags -Wno-pointer-sign
+ strip-unsupported-flags
+
+ has_version 'dev-libs/elfutils[threads]' && append-ldflags -pthread
+
+ eautoreconf # prevent maintainer mode
+
+ # have to do this after eautoreconf or automake barfs on the trailing
+ # backslash of the previous line
+ sed -i -e 's:undosyslibs.sh::' testsuite/Makefile.in # 254201
+
+ export ac_cv_{header_selinux_selinux_h,lib_selinux_is_selinux_enabled}=$(usex selinux)
+}
+
+src_install() {
+ default
+
+ insinto /etc
+ doins doc/prelink.conf
+
+ exeinto /etc/cron.daily
+ newexe "${FILESDIR}"/prelink.cron prelink
+ newconfd "${FILESDIR}"/prelink.confd prelink
+
+ dodir /var/{lib/misc,log}
+ touch "${D}/var/lib/misc/prelink.full"
+ touch "${D}/var/lib/misc/prelink.quick"
+ touch "${D}/var/lib/misc/prelink.force"
+ touch "${D}/var/log/prelink.log"
+}
+
+pkg_postinst() {
+ echo
+ elog "You may wish to read the Gentoo Linux Prelink Guide, which can be"
+ elog "found online at:"
+ elog
+ elog " https://wiki.gentoo.org/wiki/Prelink"
+ elog
+ elog "Please edit /etc/conf.d/prelink to enable and configure prelink"
+ echo
+ touch "${ROOT}/var/lib/misc/prelink.force"
+}
diff --git a/sys-devel/prelink/prelink-20130503.ebuild b/sys-devel/prelink/prelink-20130503.ebuild
new file mode 100644
index 000000000000..66f2b56608a2
--- /dev/null
+++ b/sys-devel/prelink/prelink-20130503.ebuild
@@ -0,0 +1,84 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit autotools eutils flag-o-matic
+
+DESCRIPTION="Modifies ELFs to avoid runtime symbol resolutions resulting in faster load times"
+HOMEPAGE="http://people.redhat.com/jakub/prelink"
+
+SRC_URI="mirror://gentoo/${P}.tar.bz2"
+#SRC_URI="http://people.redhat.com/jakub/prelink/${P}.tar.bz2"
+
+# if not available on jakub's dev space extract the distfile with rpm2tarbz2 from
+# http://mirrors.kernel.org/fedora/development/rawhide/source/SRPMS/p/prelink-[ver].src.rpm
+#
+# track http://pkgs.fedoraproject.org/cgit/prelink.git/ for updates
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 -arm ppc ppc64 x86"
+IUSE="selinux"
+
+DEPEND=">=dev-libs/elfutils-0.100[static-libs(+)]
+ selinux? ( sys-libs/libselinux[static-libs(+)] )
+ !dev-libs/libelf
+ >=sys-libs/glibc-2.8"
+RDEPEND="${DEPEND}
+ >=sys-devel/binutils-2.18"
+
+S=${WORKDIR}/${PN}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-20130503-prelink-conf.patch
+ epatch "${FILESDIR}"/${PN}-20130503-libiberty-md5.patch
+ epatch "${FILESDIR}"/${PN}-armhf-dynamic-linker.patch
+
+ sed -i -e 's:AM_CONFIG_HEADER:AC_CONFIG_HEADERS:' configure.in || die #469126
+
+ sed -i -e '/^CC=/s: : -Wl,--disable-new-dtags :' testsuite/functions.sh #100147
+ # >=binutils-2.22 --no-copy-dt-needed-entries is the default
+ # --copy-dt-needed-entries was renamed from --add-needed in 2.21, use the
+ # former so we don't have to bump the dep
+ sed -i \
+ -e '/CCLINK=/s:CCLINK="$(CC):& -Wl,--add-needed :' \
+ -e '/CXXLINK=/s:CXXLINK="$(CXX):& -Wl,--add-needed :' \
+ testsuite/Makefile.am
+
+ has_version 'dev-libs/elfutils[threads]' && append-ldflags -pthread
+
+ eautoreconf # prevent maintainer mode
+
+ # have to do this after eautoreconf or automake barfs on the trailing
+ # backslash of the previous line
+ sed -i -e 's:undosyslibs.sh::' testsuite/Makefile.in #254201
+
+ export ac_cv_{header_selinux_selinux_h,lib_selinux_is_selinux_enabled}=$(usex selinux)
+}
+
+src_install() {
+ default
+
+ insinto /etc
+ doins doc/prelink.conf
+
+ exeinto /etc/cron.daily
+ newexe "${FILESDIR}"/prelink.cron prelink
+ newconfd "${FILESDIR}"/prelink.confd prelink
+
+ dodir /var/{lib/misc,log}
+ touch "${ED}"/var/lib/misc/prelink.{full,quick,force}
+ touch "${ED}"/var/log/prelink.log
+}
+
+pkg_postinst() {
+ if [ -z "${REPLACING_VERSIONS}" ] ; then
+ elog "You may wish to read the Gentoo Linux Prelink Guide, which can be"
+ elog "found online at:"
+ elog " https://wiki.gentoo.org/wiki/Prelink"
+ elog "Please edit /etc/conf.d/prelink to enable and configure prelink"
+ fi
+ touch "${EROOT}/var/lib/misc/prelink.force"
+}
diff --git a/sys-devel/qconf/Manifest b/sys-devel/qconf/Manifest
new file mode 100644
index 000000000000..23f9859cd51d
--- /dev/null
+++ b/sys-devel/qconf/Manifest
@@ -0,0 +1 @@
+DIST qconf-1.5_pre717.tar.bz2 42010 SHA256 16ece50ac3f9533cf05d7abb44a025503ef8a3ea985fb70ba4c2224f27fdf903
diff --git a/sys-devel/qconf/metadata.xml b/sys-devel/qconf/metadata.xml
new file mode 100644
index 000000000000..1aecc7ea300a
--- /dev/null
+++ b/sys-devel/qconf/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>pva@gentoo.org</email>
+<name>Peter Volkov</name>
+</maintainer>
+</pkgmetadata>
diff --git a/sys-devel/qconf/qconf-1.5_pre717-r1.ebuild b/sys-devel/qconf/qconf-1.5_pre717-r1.ebuild
new file mode 100644
index 000000000000..a7b8ac604e0f
--- /dev/null
+++ b/sys-devel/qconf/qconf-1.5_pre717-r1.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="2"
+
+inherit multilib qt4-r2
+
+DESCRIPTION="./configure like generator for qmake-based projects"
+HOMEPAGE="http://delta.affinix.com/qconf/"
+SRC_URI="http://delta.affinix.com/download/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~arm hppa ppc ppc64 sparc x86 ~x86-fbsd"
+IUSE=""
+
+DEPEND="dev-qt/qtcore:4"
+RDEPEND="${DEPEND}"
+
+src_configure() {
+ # Fake ./configure. Fails on unknown options
+ ./configure \
+ --prefix=/usr/ \
+ --qtdir=/usr/$(get_libdir)/ || die "./configure failed"
+
+ [ ! -f Makefile ] && die "./configure failed"
+
+ eqmake4
+}
+
+src_install() {
+ dobin qconf || die
+ dodoc README TODO || die
+ insinto /usr/share/${PN}
+ doins -r conf modules
+ insinto /usr/share/doc/${PF}/examples
+ doins examples/*
+}
diff --git a/sys-devel/remake/Manifest b/sys-devel/remake/Manifest
new file mode 100644
index 000000000000..0885604e1137
--- /dev/null
+++ b/sys-devel/remake/Manifest
@@ -0,0 +1,5 @@
+DIST remake-3.81+dbg-0.2.tar.bz2 1311308 SHA256 c7600bd96084e7fdfd667d50e889b652bf69f933799ac207def021a1820c5097
+DIST remake-3.81+dbg-0.3.tar.bz2 1078924 SHA256 55647ac9d23ca6f634c77eeefacbb45dd0e16cac50b402d3b35f0d44e71745a3 SHA512 a86ed989ed6c616da0a9850560b88c1a2f8ac277fa4c8abdb2a40543cf63c3180810d5c6a822d7dd6988a53cd36eef18d857e4958787fca2ed616d14186c36b1 WHIRLPOOL 79461f07dcbbfe7178b96f10bf6513c4c53a38c417e0119dfdc25ecd2539ebd3fd6ecd3aa8affaa0b2cf74e3416334fa23871fc738e4cb1dfaf09729be704db2
+DIST remake-3.82+dbg-0.4.tar.bz2 1360407 SHA256 2c08b996805aa709e8cbd6a75ac3e3952fc03622a1407c450b60bf4fc19e4275 SHA512 5f75e7826e4258c33e3844d72d685f1c1d252c352b40c0d6a7a3e5155097496640ff72542786452fa40079060b4c0cb514bda7147521c7170f42003ba8c0aa77 WHIRLPOOL 81b0fc2e7ef8b5c55f93bc77de7bcb9f21b819e36a4eb393faa53b5876dd5115e98f62da46c693ad93b554a5f087cf69fd3edcc8895a710d10cf44a94f7119e4
+DIST remake-3.82+dbg0.9.tar.bz2 1152677 SHA256 491c6da004a3517a6c76d62017279374fd594f5c09c823b4de53e81180c4041a SHA512 94682e9d0317088456dac683d67be320fe10bb06a3384969fafefe091558b215105ba3c96a7c1d4e0d970ea2dc5c4f535a704256fe7a4eaa87bec11d78d074cf WHIRLPOOL a4caad6c8acb74e8284946db7fe5ebd3bdf806a2e79309030d5ebbad132a161d32d9bfc6a567237793080b285cc928ef7c88a4a97b921d8eeffe041ca75a8e81
+DIST remake-4.1+dbg1.1.tar.bz2 1254246 SHA256 42eb79a8418e327255341a55ccbdf358eed42c4e15ffb39052c1627de83521fe SHA512 e0dfb0f7a3f05968c3597e73f2fd486929893546a8f993e99ae73c6400050d1faa5baed1b0588d399bfc6e58e8504f857c8734e39a02efd875b522b26dfaa421 WHIRLPOOL ec018e16450ead020758cb004a70da15c168f00e51451dd23bbc1388e7c71401675543385f929b5ec54618a3d8023887aea19a25ff7e9808e42a5acf8afd86c1
diff --git a/sys-devel/remake/metadata.xml b/sys-devel/remake/metadata.xml
new file mode 100644
index 000000000000..cd565ccf05d4
--- /dev/null
+++ b/sys-devel/remake/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">bashdb</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-devel/remake/remake-3.81.0.2.ebuild b/sys-devel/remake/remake-3.81.0.2.ebuild
new file mode 100644
index 000000000000..47b19e7ca148
--- /dev/null
+++ b/sys-devel/remake/remake-3.81.0.2.ebuild
@@ -0,0 +1,23 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+MY_P="${PN}-${PV:0:4}+dbg-${PV:5}"
+
+DESCRIPTION="patched version of GNU make that adds improved error reporting, tracing, and a debugger"
+HOMEPAGE="http://bashdb.sourceforge.net/remake/"
+SRC_URI="mirror://sourceforge/bashdb/${MY_P}.tar.bz2"
+
+LICENSE="GPL-1"
+SLOT="0"
+KEYWORDS="amd64 ppc x86"
+IUSE=""
+
+S=${WORKDIR}/${MY_P}
+
+src_install() {
+ emake install DESTDIR="${D}" || die "make install failed"
+ dodoc AUTHORS INSTALL NEWS README
+ # fix collide with the real make's info pages
+ rm -f "${D}"/usr/share/info/make.*
+}
diff --git a/sys-devel/remake/remake-3.81.0.3.ebuild b/sys-devel/remake/remake-3.81.0.3.ebuild
new file mode 100644
index 000000000000..a5583862daba
--- /dev/null
+++ b/sys-devel/remake/remake-3.81.0.3.ebuild
@@ -0,0 +1,23 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+MY_P="${PN}-${PV:0:4}+dbg-${PV:5}"
+
+DESCRIPTION="patched version of GNU make that adds improved error reporting, tracing, and a debugger"
+HOMEPAGE="http://bashdb.sourceforge.net/remake/"
+SRC_URI="mirror://sourceforge/bashdb/${MY_P}.tar.bz2"
+
+LICENSE="GPL-1"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE=""
+
+S=${WORKDIR}/${MY_P}
+
+src_install() {
+ emake install DESTDIR="${D}" || die "make install failed"
+ dodoc AUTHORS INSTALL NEWS README
+ # fix collide with the real make's info pages
+ rm -f "${D}"/usr/share/info/make.*
+}
diff --git a/sys-devel/remake/remake-3.82.0.4.ebuild b/sys-devel/remake/remake-3.82.0.4.ebuild
new file mode 100644
index 000000000000..4c2b68a27e84
--- /dev/null
+++ b/sys-devel/remake/remake-3.82.0.4.ebuild
@@ -0,0 +1,26 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+MY_P="${PN}-${PV:0:4}+dbg-${PV:5}"
+
+DESCRIPTION="patched version of GNU make that adds improved error reporting, tracing, and a debugger"
+HOMEPAGE="http://bashdb.sourceforge.net/remake/"
+SRC_URI="mirror://sourceforge/bashdb/${MY_P}.tar.bz2"
+
+LICENSE="GPL-1"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE="readline"
+
+RDEPEND="readline? ( sys-libs/readline )"
+DEPEND="${RDEPEND}"
+
+S=${WORKDIR}/${MY_P}
+
+src_install() {
+ emake install DESTDIR="${D}" || die
+ dodoc AUTHORS INSTALL NEWS README
+ # fix collide with the real make's info pages
+ rm -f "${D}"/usr/share/info/make.*
+}
diff --git a/sys-devel/remake/remake-3.82.0.9.ebuild b/sys-devel/remake/remake-3.82.0.9.ebuild
new file mode 100644
index 000000000000..04593c558747
--- /dev/null
+++ b/sys-devel/remake/remake-3.82.0.9.ebuild
@@ -0,0 +1,27 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+MY_P="${PN}-${PV:0:4}+dbg${PV:5}"
+
+DESCRIPTION="patched version of GNU make that adds improved error reporting, tracing, and a debugger"
+HOMEPAGE="http://bashdb.sourceforge.net/remake/"
+SRC_URI="mirror://sourceforge/bashdb/${MY_P}.tar.bz2"
+
+LICENSE="GPL-1"
+SLOT="0"
+KEYWORDS="amd64 ~hppa ppc x86"
+IUSE="readline"
+
+RDEPEND="readline? ( sys-libs/readline )"
+DEPEND="${RDEPEND}"
+
+S=${WORKDIR}/${MY_P}
+
+src_install() {
+ default
+ # fix collide with the real make's info pages
+ rm -f "${D}"/usr/share/info/make.*
+}
diff --git a/sys-devel/remake/remake-4.1.1.1.ebuild b/sys-devel/remake/remake-4.1.1.1.ebuild
new file mode 100644
index 000000000000..6f67c70f162c
--- /dev/null
+++ b/sys-devel/remake/remake-4.1.1.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_P="${PN}-${PV:0:3}+dbg${PV:4}"
+
+DESCRIPTION="patched version of GNU make that adds improved error reporting, tracing, and a debugger"
+HOMEPAGE="http://bashdb.sourceforge.net/remake/"
+SRC_URI="mirror://sourceforge/bashdb/${MY_P}.tar.bz2"
+
+LICENSE="GPL-1"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+IUSE="readline"
+
+RDEPEND="readline? ( sys-libs/readline:0= )"
+DEPEND="${RDEPEND}"
+
+S=${WORKDIR}/${MY_P}
+
+src_configure() {
+ use readline || export vl_cv_lib_readline=no
+ default
+}
+
+src_install() {
+ default
+ # delete files GNU make owns and remake doesn't care about.
+ rm -r "${ED}"/usr/include || die
+}
diff --git a/sys-devel/smatch/Manifest b/sys-devel/smatch/Manifest
new file mode 100644
index 000000000000..8de2302191c9
--- /dev/null
+++ b/sys-devel/smatch/Manifest
@@ -0,0 +1,2 @@
+DIST smatch-1.57.tar.gz 491677 SHA256 3ca08158f066887aa821da45962e4999ca60b459f3f13eb5ffc4d68c4b94cadb SHA512 031f417c97d58b617b2e375a28f509f71eb2735212a98aee0e21880a28842078ad3c24b5375a03f73d75fec582a9d187ed6a00a0512c4792e5ffce82dfd79b99 WHIRLPOOL 6eb43af471ba08c106fe05dc786422b16b20cb94bf9af2afdde3e9ccea6985bc5c3b39922e135d55b7a1b341187a77a9565b2ef27ff47f7214b6472b10b6d7c0
+DIST smatch-1.59.tar.gz 495530 SHA256 9c300600aace39fe67fde59421a159d6dffdc5d8ef074762a6a6a7c78e87d472 SHA512 5e18f48dbbe11255a06b427205aefd1f8f5a11bb0b238f9134b89e6f5cb838fcae649a4e87a4a04473a33077c94e88aab46b06e33cc87cfe451fa83b5846ccc7 WHIRLPOOL 5f8c115370acd876cb41c360dcb8916ca1a725aa3714b89261ab69122976440f01b20f8874ffd7dc93ac79479db69ce246a3d5cd8bbedf5c52f430eff0195522
diff --git a/sys-devel/smatch/files/smatch-1.57-restrict.patch b/sys-devel/smatch/files/smatch-1.57-restrict.patch
new file mode 100644
index 000000000000..2f0dc98d496a
--- /dev/null
+++ b/sys-devel/smatch/files/smatch-1.57-restrict.patch
@@ -0,0 +1,14 @@
+send upstream already
+
+diff --git a/parse.c b/parse.c
+index 5dd9a06..bf5894d 100644
+--- a/parse.c
++++ b/parse.c
+@@ -419,6 +419,7 @@ static struct init_keyword {
+ /* Ignored for now.. */
+ { "restrict", NS_TYPEDEF, .op = &restrict_op},
+ { "__restrict", NS_TYPEDEF, .op = &restrict_op},
++ { "__restrict__", NS_TYPEDEF, .op = &restrict_op},
+
+ /* Storage class */
+ { "auto", NS_TYPEDEF, .op = &auto_op },
diff --git a/sys-devel/smatch/metadata.xml b/sys-devel/smatch/metadata.xml
new file mode 100644
index 000000000000..f8824b4cf31c
--- /dev/null
+++ b/sys-devel/smatch/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>kernel-misc</herd>
+ <herd>toolchain</herd>
+</pkgmetadata>
diff --git a/sys-devel/smatch/smatch-1.57-r1.ebuild b/sys-devel/smatch/smatch-1.57-r1.ebuild
new file mode 100644
index 000000000000..9dd86fb90fdb
--- /dev/null
+++ b/sys-devel/smatch/smatch-1.57-r1.ebuild
@@ -0,0 +1,55 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit multilib toolchain-funcs eutils
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://repo.or.cz/${PN}.git
+ http://repo.or.cz/r/${PN}.git"
+ inherit git-2
+fi
+
+DESCRIPTION="static analysis tool for C"
+HOMEPAGE="http://smatch.sourceforge.net/"
+
+if [[ ${PV} == "9999" ]] ; then
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ # The repo.or.cz site does not produce stable tarballs,
+ # so we have to cache our own copy of the snapshot.
+ #SRC_URI="http://repo.or.cz/w/smatch.git/snapshot/${PV}.tar.gz -> ${P}.tar.gz"
+ SRC_URI="mirror://gentoo/${P}.tar.gz"
+ KEYWORDS="~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+fi
+
+LICENSE="OSL-1.1"
+SLOT="0"
+IUSE=""
+
+RDEPEND="dev-db/sqlite"
+DEPEND="${RDEPEND}"
+
+S=${WORKDIR}/${PN}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-restrict.patch
+ sed -i \
+ -e '/^PREFIX=/s:=.*:=/usr:' \
+ -e '/^CFLAGS =/{s:=:+=:;s:-O2 -finline-functions:${CPPFLAGS}:}' \
+ Makefile || die
+}
+
+src_compile() {
+ emake PREFIX=/usr V=1 CC="$(tc-getCC)" smatch
+}
+
+src_install() {
+ # default install target installs a lot of sparse cruft
+ dobin smatch
+ insinto /usr/share/smatch/smatch_data
+ doins smatch_data/*
+ dodoc FAQ README
+}
diff --git a/sys-devel/smatch/smatch-1.57.ebuild b/sys-devel/smatch/smatch-1.57.ebuild
new file mode 100644
index 000000000000..3d64cce3dc1c
--- /dev/null
+++ b/sys-devel/smatch/smatch-1.57.ebuild
@@ -0,0 +1,54 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit multilib toolchain-funcs
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://repo.or.cz/${PN}.git
+ http://repo.or.cz/r/${PN}.git"
+ inherit git-2
+fi
+
+DESCRIPTION="static analysis tool for C"
+HOMEPAGE="http://smatch.sourceforge.net/"
+
+if [[ ${PV} == "9999" ]] ; then
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ # The repo.or.cz site does not produce stable tarballs,
+ # so we have to cache our own copy of the snapshot.
+ #SRC_URI="http://repo.or.cz/w/smatch.git/snapshot/${PV}.tar.gz -> ${P}.tar.gz"
+ SRC_URI="mirror://gentoo/${P}.tar.gz"
+ KEYWORDS="~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+fi
+
+LICENSE="OSL-1.1"
+SLOT="0"
+IUSE=""
+
+RDEPEND="dev-db/sqlite"
+DEPEND="${RDEPEND}"
+
+S=${WORKDIR}/${PN}
+
+src_prepare() {
+ sed -i \
+ -e '/^PREFIX=/s:=.*:=/usr:' \
+ -e '/^CFLAGS =/{s:=:+=:;s:-O2 -finline-functions:${CPPFLAGS}:}' \
+ Makefile || die
+}
+
+src_compile() {
+ emake PREFIX=/usr V=1 CC="$(tc-getCC)" smatch
+}
+
+src_install() {
+ # default install target installs a lot of sparse cruft
+ dobin smatch
+ insinto /usr/share/smatch/smatch_data
+ doins smatch_data/*
+ dodoc FAQ README
+}
diff --git a/sys-devel/smatch/smatch-1.59.ebuild b/sys-devel/smatch/smatch-1.59.ebuild
new file mode 100644
index 000000000000..79565bb1f7b7
--- /dev/null
+++ b/sys-devel/smatch/smatch-1.59.ebuild
@@ -0,0 +1,64 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit toolchain-funcs
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://repo.or.cz/${PN}.git
+ http://repo.or.cz/r/${PN}.git"
+ inherit git-2
+else
+ SRC_URI="http://repo.or.cz/w/smatch.git/snapshot/${PV}.tar.gz -> ${P}.tar.gz
+ mirror://gentoo/${P}.tar.gz"
+ KEYWORDS="~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+fi
+
+DESCRIPTION="static analysis tool for C"
+HOMEPAGE="http://smatch.sourceforge.net/"
+
+LICENSE="OSL-1.1"
+SLOT="0"
+IUSE=""
+
+RDEPEND="dev-db/sqlite"
+DEPEND="${RDEPEND}"
+
+S=${WORKDIR}/${PN}
+
+src_prepare() {
+ sed -i \
+ -e '/^CFLAGS =/{s:=:+=:;s:-O2 -finline-functions:${CPPFLAGS}:}' \
+ Makefile || die
+}
+
+_emake() {
+ # gtk/llvm/xml is used by sparse which we don't install
+ emake \
+ PREFIX="${EPREFIX}/usr" \
+ V=1 \
+ AR="$(tc-getAR)" \
+ CC="$(tc-getCC)" \
+ LD='$(CC)' \
+ HAVE_GTK2=no \
+ HAVE_LLVM=no \
+ HAVE_LIBXML=no \
+ "$@"
+}
+
+src_compile() {
+ _emake smatch
+}
+
+src_test() {
+ _emake check
+}
+
+src_install() {
+ # default install target installs a lot of sparse cruft
+ dobin smatch
+ insinto /usr/share/smatch/smatch_data
+ doins smatch_data/*
+ dodoc FAQ README
+}
diff --git a/sys-devel/smatch/smatch-9999.ebuild b/sys-devel/smatch/smatch-9999.ebuild
new file mode 100644
index 000000000000..79565bb1f7b7
--- /dev/null
+++ b/sys-devel/smatch/smatch-9999.ebuild
@@ -0,0 +1,64 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit toolchain-funcs
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://repo.or.cz/${PN}.git
+ http://repo.or.cz/r/${PN}.git"
+ inherit git-2
+else
+ SRC_URI="http://repo.or.cz/w/smatch.git/snapshot/${PV}.tar.gz -> ${P}.tar.gz
+ mirror://gentoo/${P}.tar.gz"
+ KEYWORDS="~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+fi
+
+DESCRIPTION="static analysis tool for C"
+HOMEPAGE="http://smatch.sourceforge.net/"
+
+LICENSE="OSL-1.1"
+SLOT="0"
+IUSE=""
+
+RDEPEND="dev-db/sqlite"
+DEPEND="${RDEPEND}"
+
+S=${WORKDIR}/${PN}
+
+src_prepare() {
+ sed -i \
+ -e '/^CFLAGS =/{s:=:+=:;s:-O2 -finline-functions:${CPPFLAGS}:}' \
+ Makefile || die
+}
+
+_emake() {
+ # gtk/llvm/xml is used by sparse which we don't install
+ emake \
+ PREFIX="${EPREFIX}/usr" \
+ V=1 \
+ AR="$(tc-getAR)" \
+ CC="$(tc-getCC)" \
+ LD='$(CC)' \
+ HAVE_GTK2=no \
+ HAVE_LLVM=no \
+ HAVE_LIBXML=no \
+ "$@"
+}
+
+src_compile() {
+ _emake smatch
+}
+
+src_test() {
+ _emake check
+}
+
+src_install() {
+ # default install target installs a lot of sparse cruft
+ dobin smatch
+ insinto /usr/share/smatch/smatch_data
+ doins smatch_data/*
+ dodoc FAQ README
+}
diff --git a/sys-devel/sparse/Manifest b/sys-devel/sparse/Manifest
new file mode 100644
index 000000000000..1331c789b4db
--- /dev/null
+++ b/sys-devel/sparse/Manifest
@@ -0,0 +1,3 @@
+DIST sparse-0.4.3.tar.bz2 172431 SHA256 9059bc649ca8c9309e542d0015091ccf72ac9e3300db0adb4eba838cdcc82f9c SHA512 ff3dbd3e28b1a95dc9d6abf9a4ffdfaa0f470047b8232bd50930839432ae66a2249adb861c880e8eef1a906b007fd7d1c1ef8683c48c763eb523aedc9e1df631 WHIRLPOOL d2fad751e0d9594b467a457843a8beb153d9744683cfe9112ae38484f25eb2bb1784fa58d8ec1c6c5341450e966478e42c16027de271452804e5607c0c393354
+DIST sparse-0.4.4.tar.bz2 174074 SHA256 57ce3b7e33567e67dc0b5c74142aff60a8a78257664a2160c3e3d345d00765af SHA512 5cd5e660ea863170e86f1abaa040434c43a5cc7e92560f1bcbcce9ce906ae7355c066168bfc1dcc551e41e4c0f864122be288ed69eb1c4cda8b7c0825b5b647f WHIRLPOOL 2e61fcbee4e2f603d80db37f69050c130aef9d5df5e43dc475504a29e5d53eed3d599499fc5e3ca9139535f68a7f19e701ee3003f2b20ffe16681ffa524b05d0
+DIST sparse-0.5.0.tar.xz 187576 SHA256 921fcf918c6778d1359f3886ac8cb4cf632faa6242627bc2ae2db75e983488d5 SHA512 0cb70a74034c4bc4d5340ab7d19288a438f4b6d0c4c63ac95d1f4cc3c5fdfe1370a27a607605a6f0c85ea6f371141c55abfdb4438d9e87b2d544fff5674f7ce4 WHIRLPOOL 328027ab5fab473d5819659bb91ab6d655cebc6cf5ec5f5c102217fc11aee5c0e5e56e694260784a315f14b7ce84c25a19b5cd70e98db92cfa9ba19f7e7c8944
diff --git a/sys-devel/sparse/files/sparse-0.4.3-gentoo.patch b/sys-devel/sparse/files/sparse-0.4.3-gentoo.patch
new file mode 100644
index 000000000000..6f46687d78b3
--- /dev/null
+++ b/sys-devel/sparse/files/sparse-0.4.3-gentoo.patch
@@ -0,0 +1,49 @@
+diff --git a/Makefile b/Makefile
+index 74905df..1f2b2b6 100644
+--- a/Makefile
++++ b/Makefile
+@@ -4,7 +4,7 @@ OS = linux
+
+
+ CC = gcc
+-CFLAGS = -O2 -finline-functions -fno-strict-aliasing -g
++CFLAGS ?= -O2 -finline-functions -fno-strict-aliasing -g
+ CFLAGS += -Wall -Wwrite-strings
+ LDFLAGS += -g
+ AR = ar
+@@ -21,7 +21,8 @@ HAVE_GCC_DEP:=$(shell touch .gcc-test.c && \
+ echo 'yes'; rm -f .gcc-test.d .gcc-test.o .gcc-test.c)
+ HAVE_GTK2:=$(shell pkg-config --exists gtk+-2.0 2>/dev/null && echo 'yes')
+
+-CFLAGS += -DGCC_BASE=\"$(shell $(CC) --print-file-name=)\"
++GCC_BASE = $(shell $(CC) --print-file-name=)
++CFLAGS += -DGCC_BASE=\"$(GCC_BASE)\"
+
+ ifeq ($(HAVE_GCC_DEP),yes)
+ CFLAGS += -Wp,-MD,$(@D)/.$(@F).d
+@@ -113,7 +114,9 @@ SED_PC_CMD = 's|@version@|$(VERSION)|g; \
+
+ all: $(PROGRAMS) sparse.pc
+
+-install: $(INST_PROGRAMS) $(LIBS) $(LIB_H) sparse.pc
++all-installable: $(INST_PROGRAMS) $(LIBS) $(LIB_H) sparse.pc
++
++install: all-installable
+ $(Q)install -d $(DESTDIR)$(BINDIR)
+ $(Q)install -d $(DESTDIR)$(LIBDIR)
+ $(Q)install -d $(DESTDIR)$(MAN1DIR)
+diff --git a/parse.h b/parse.h
+index 6b21e23..b26bd03 100644
+--- a/parse.h
++++ b/parse.h
+@@ -35,10 +35,6 @@ struct statement {
+ struct /* declaration */ {
+ struct symbol_list *declaration;
+ };
+- struct /* label_arg */ {
+- struct symbol *label;
+- struct statement *label_statement;
+- };
+ struct {
+ struct expression *expression;
+ struct expression *context;
diff --git a/sys-devel/sparse/metadata.xml b/sys-devel/sparse/metadata.xml
new file mode 100644
index 000000000000..8dcee38b5a85
--- /dev/null
+++ b/sys-devel/sparse/metadata.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>kernel-misc</herd>
+ <herd>toolchain</herd>
+ <use>
+ <flag name='gtk'>
+ Build the test-inspect utility (requires
+ <pkg>x11-libs/gtk+</pkg> version 2)
+ </flag>
+ <flag name='llvm'>Build the sparse-llvm utility</flag>
+ <flag name='xml'>
+ Build the c2xml utility (requires <pkg>dev-libs/libxml2</pkg>).
+ </flag>
+ </use>
+</pkgmetadata>
diff --git a/sys-devel/sparse/sparse-0.4.3.ebuild b/sys-devel/sparse/sparse-0.4.3.ebuild
new file mode 100644
index 000000000000..0190d1bd14c3
--- /dev/null
+++ b/sys-devel/sparse/sparse-0.4.3.ebuild
@@ -0,0 +1,65 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="2"
+
+inherit eutils multilib flag-o-matic toolchain-funcs
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://git.kernel.org/pub/scm/devel/sparse/sparse.git"
+ inherit git
+fi
+
+DESCRIPTION="C semantic parser"
+HOMEPAGE="http://sparse.wiki.kernel.org/index.php/Main_Page"
+
+if [[ ${PV} == "9999" ]] ; then
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://kernel/software/devel/sparse/dist/${P}.tar.bz2"
+ KEYWORDS="amd64 arm hppa ia64 ppc ppc64 s390 sh sparc x86"
+fi
+
+LICENSE="OSL-1.1"
+SLOT="0"
+IUSE="gtk xml test"
+
+RDEPEND="gtk? ( x11-libs/gtk+:2 )
+ xml? ( dev-libs/libxml2 )"
+DEPEND="${RDEPEND}
+ gtk? ( virtual/pkgconfig )
+ xml? ( virtual/pkgconfig )"
+
+src_prepare() {
+ # http://cgit.gentoo.org/proj/sparse.git
+ epatch "${FILESDIR}"/${P}-gentoo.patch
+}
+
+mymake() {
+ usex() { use $1 && echo ${2:-yes} || echo ${3:-no} ; }
+
+ emake \
+ V=1 \
+ CC="$(tc-getCC)" \
+ GCC_BASE="$(gcc-config -L | cut -d : -f1)" \
+ HAVE_LIBXML=$(usex xml) \
+ HAVE_GTK2=$(usex gtk) \
+ PREFIX=/usr \
+ LIBDIR="/usr/$(get_libdir)" \
+ DESTDIR="${D}" \
+ "$@" \
+ || die
+}
+
+src_compile() {
+ append-flags -fno-strict-aliasing
+
+ mymake \
+ $(use test && echo all) all-installable
+}
+
+src_install() {
+ mymake install
+ dodoc FAQ README
+}
diff --git a/sys-devel/sparse/sparse-0.4.4.ebuild b/sys-devel/sparse/sparse-0.4.4.ebuild
new file mode 100644
index 000000000000..87dec030e74f
--- /dev/null
+++ b/sys-devel/sparse/sparse-0.4.4.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils multilib toolchain-funcs
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://git.kernel.org/pub/scm/devel/sparse/sparse.git"
+ inherit git-2
+fi
+
+DESCRIPTION="C semantic parser"
+HOMEPAGE="http://sparse.wiki.kernel.org/index.php/Main_Page"
+
+if [[ ${PV} == "9999" ]] ; then
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://kernel/software/devel/sparse/dist/${P}.tar.bz2"
+ KEYWORDS="~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+fi
+
+LICENSE="OSL-1.1"
+SLOT="0"
+IUSE="gtk test xml"
+
+RDEPEND="gtk? ( x11-libs/gtk+:2 )
+ xml? ( dev-libs/libxml2 )"
+DEPEND="${RDEPEND}
+ gtk? ( virtual/pkgconfig )
+ xml? ( virtual/pkgconfig )"
+
+src_prepare() {
+ tc-export AR CC PKG_CONFIG
+ sed -i \
+ -e '/^PREFIX=/s:=.*:=/usr:' \
+ -e "/^LIBDIR=/s:/lib:/$(get_libdir):" \
+ -e '/^CFLAGS =/{s:=:+= $(CPPFLAGS):;s:-O2 -finline-functions::}' \
+ -e "s:pkg-config:${PKG_CONFIG}:" \
+ Makefile || die
+ export MAKEOPTS+=" V=1 AR=${AR} CC=${CC} HAVE_GTK2=$(usex gtk) HAVE_LIBXML=$(usex xml)"
+}
+
+src_compile() {
+ emake $(usex test all all-installable)
+}
diff --git a/sys-devel/sparse/sparse-0.5.0.ebuild b/sys-devel/sparse/sparse-0.5.0.ebuild
new file mode 100644
index 000000000000..d7539cd1515b
--- /dev/null
+++ b/sys-devel/sparse/sparse-0.5.0.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils multilib toolchain-funcs
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://git.kernel.org/pub/scm/devel/sparse/sparse.git"
+ inherit git-2
+fi
+
+DESCRIPTION="C semantic parser"
+HOMEPAGE="http://sparse.wiki.kernel.org/index.php/Main_Page"
+
+if [[ ${PV} == "9999" ]] ; then
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://kernel/software/devel/sparse/dist/${P}.tar.xz"
+ KEYWORDS="~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+fi
+
+LICENSE="OSL-1.1"
+SLOT="0"
+IUSE="gtk llvm test xml"
+
+RDEPEND="gtk? ( x11-libs/gtk+:2 )
+ llvm? ( >=sys-devel/llvm-3.0 )
+ xml? ( dev-libs/libxml2 )"
+DEPEND="${RDEPEND}
+ gtk? ( virtual/pkgconfig )
+ xml? ( virtual/pkgconfig )"
+
+src_prepare() {
+ tc-export AR CC PKG_CONFIG
+ sed -i \
+ -e '/^PREFIX=/s:=.*:=/usr:' \
+ -e "/^LIBDIR=/s:/lib:/$(get_libdir):" \
+ -e '/^CFLAGS =/{s:=:+= $(CPPFLAGS):;s:-O2 -finline-functions::}' \
+ -e "s:pkg-config:${PKG_CONFIG}:" \
+ Makefile || die
+ export MAKEOPTS+=" V=1 AR=${AR} CC=${CC} HAVE_GTK2=$(usex gtk) HAVE_LLVM=$(usex llvm) HAVE_LIBXML=$(usex xml)"
+}
+
+src_compile() {
+ emake $(usex test all all-installable)
+}
diff --git a/sys-devel/sparse/sparse-9999.ebuild b/sys-devel/sparse/sparse-9999.ebuild
new file mode 100644
index 000000000000..d7539cd1515b
--- /dev/null
+++ b/sys-devel/sparse/sparse-9999.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils multilib toolchain-funcs
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://git.kernel.org/pub/scm/devel/sparse/sparse.git"
+ inherit git-2
+fi
+
+DESCRIPTION="C semantic parser"
+HOMEPAGE="http://sparse.wiki.kernel.org/index.php/Main_Page"
+
+if [[ ${PV} == "9999" ]] ; then
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ SRC_URI="mirror://kernel/software/devel/sparse/dist/${P}.tar.xz"
+ KEYWORDS="~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+fi
+
+LICENSE="OSL-1.1"
+SLOT="0"
+IUSE="gtk llvm test xml"
+
+RDEPEND="gtk? ( x11-libs/gtk+:2 )
+ llvm? ( >=sys-devel/llvm-3.0 )
+ xml? ( dev-libs/libxml2 )"
+DEPEND="${RDEPEND}
+ gtk? ( virtual/pkgconfig )
+ xml? ( virtual/pkgconfig )"
+
+src_prepare() {
+ tc-export AR CC PKG_CONFIG
+ sed -i \
+ -e '/^PREFIX=/s:=.*:=/usr:' \
+ -e "/^LIBDIR=/s:/lib:/$(get_libdir):" \
+ -e '/^CFLAGS =/{s:=:+= $(CPPFLAGS):;s:-O2 -finline-functions::}' \
+ -e "s:pkg-config:${PKG_CONFIG}:" \
+ Makefile || die
+ export MAKEOPTS+=" V=1 AR=${AR} CC=${CC} HAVE_GTK2=$(usex gtk) HAVE_LLVM=$(usex llvm) HAVE_LIBXML=$(usex xml)"
+}
+
+src_compile() {
+ emake $(usex test all all-installable)
+}
diff --git a/sys-devel/systemd-m4/metadata.xml b/sys-devel/systemd-m4/metadata.xml
new file mode 100644
index 000000000000..1971a4bde18a
--- /dev/null
+++ b/sys-devel/systemd-m4/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>mgorny@gentoo.org</email>
+ <name>Michał Górny</name>
+ </maintainer>
+ <upstream>
+ <maintainer status="active">
+ <email>mgorny@gentoo.org</email>
+ <name>Michał Górny</name>
+ </maintainer>
+ <bugs-to>https://bitbucket.org/mgorny/systemd-m4/issues/</bugs-to>
+ <remote-id type="bitbucket">mgorny/systemd-m4</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-devel/systemd-m4/systemd-m4-9999.ebuild b/sys-devel/systemd-m4/systemd-m4-9999.ebuild
new file mode 100644
index 000000000000..359f2828878d
--- /dev/null
+++ b/sys-devel/systemd-m4/systemd-m4-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 LIVE
+AUTOTOOLS_AUTORECONF=yes
+EGIT_REPO_URI="http://bitbucket.org/mgorny/${PN}.git"
+
+inherit git-r3
+#endif
+
+inherit autotools-utils
+
+DESCRIPTION="autoconf macros for packages using systemd"
+HOMEPAGE="https://bitbucket.org/mgorny/systemd-m4/"
+SRC_URI="https://www.bitbucket.org/mgorny/${PN}/downloads/${P}.tar.bz2"
+
+LICENSE="BSD-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+#if LIVE
+
+KEYWORDS=
+SRC_URI=
+#endif
diff --git a/sys-devel/ucpp/Manifest b/sys-devel/ucpp/Manifest
new file mode 100644
index 000000000000..afbf97ec6bb8
--- /dev/null
+++ b/sys-devel/ucpp/Manifest
@@ -0,0 +1 @@
+DIST ucpp-1.3.4.tar.xz 274488 SHA256 6eab925e49f5635962a2152b15536b92d861b409b18337317c122ee065133d25 SHA512 f9ea88e8f53e728a5b0fcb9084d6d6e140737b00fe350a9c6bc53ef2bb5f7b09d3c9d9a4a2147f635d796247e1b920fd3fea0cdce3ec3f4578694162c2f4c2a6 WHIRLPOOL aea8570a422e222f0fe4aa053e755c1484c2f308486ee4b15d630f2bed79806c2efaa0b07bffbe067f0cdd36aec5222592ba2c8e5cfeb4f18f0bc35cfd87cc6b
diff --git a/sys-devel/ucpp/metadata.xml b/sys-devel/ucpp/metadata.xml
new file mode 100644
index 000000000000..94f0af2341ee
--- /dev/null
+++ b/sys-devel/ucpp/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>openoffice</herd>
+ <herd>sci</herd>
+</pkgmetadata>
diff --git a/sys-devel/ucpp/ucpp-1.3.4.ebuild b/sys-devel/ucpp/ucpp-1.3.4.ebuild
new file mode 100644
index 000000000000..ec58884c6e87
--- /dev/null
+++ b/sys-devel/ucpp/ucpp-1.3.4.ebuild
@@ -0,0 +1,28 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils
+
+DESCRIPTION="A quick and light preprocessor, but anyway fully compliant to C99"
+HOMEPAGE="http://code.google.com/p/ucpp/"
+SRC_URI="http://dev.gentooexperimental.org/~scarabeus/${P}.tar.xz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="amd64 ~arm ppc x86 ~amd64-linux"
+IUSE="static-libs"
+
+src_configure() {
+ econf \
+ --disable-werror \
+ $(use_enable static-libs static)
+}
+
+src_install() {
+ default
+
+ prune_libtool_files --all
+}
diff --git a/sys-devel/ucpp/ucpp-9999.ebuild b/sys-devel/ucpp/ucpp-9999.ebuild
new file mode 100644
index 000000000000..5f0eed12f385
--- /dev/null
+++ b/sys-devel/ucpp/ucpp-9999.ebuild
@@ -0,0 +1,32 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+EGIT_REPO_URI="git://github.com/scarabeusiv/ucpp.git"
+inherit eutils git-2 autotools
+
+DESCRIPTION="A quick and light preprocessor, but anyway fully compliant to C99"
+HOMEPAGE="http://code.google.com/p/ucpp/"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS=""
+IUSE="static-libs"
+
+src_prepare() {
+ eautoreconf
+}
+
+src_configure() {
+ econf \
+ --disable-werror \
+ $(use_enable static-libs static)
+}
+
+src_install() {
+ default
+
+ prune_libtool_files --all
+}