summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /eclass
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'eclass')
-rw-r--r--eclass/ELT-patches/aixrtl/1.5.0-cmds-c11
-rw-r--r--eclass/ELT-patches/aixrtl/1.5.0-cmds-cxx11
-rw-r--r--eclass/ELT-patches/aixrtl/1.5.0-expsym-c14
-rw-r--r--eclass/ELT-patches/aixrtl/1.5.0-expsym-cxx14
-rw-r--r--eclass/ELT-patches/aixrtl/1.5.0-noundef-c11
-rw-r--r--eclass/ELT-patches/aixrtl/1.5.0-noundef-cxx11
-rw-r--r--eclass/ELT-patches/aixrtl/1.5.0-soname12
-rw-r--r--eclass/ELT-patches/aixrtl/1.5.0-usertl-c10
-rw-r--r--eclass/ELT-patches/aixrtl/1.5.0-usertl-cxx10
-rw-r--r--eclass/ELT-patches/aixrtl/1.5.22-cmds-c11
-rw-r--r--eclass/ELT-patches/aixrtl/1.5.22-cmds-cxx11
-rw-r--r--eclass/ELT-patches/aixrtl/2.0.0-fpic-c12
-rw-r--r--eclass/ELT-patches/aixrtl/2.0.0-fpic-cxx12
-rw-r--r--eclass/ELT-patches/aixrtl/2.2.0-cmds-c11
-rw-r--r--eclass/ELT-patches/aixrtl/2.2.0-cmds-cxx11
-rw-r--r--eclass/ELT-patches/aixrtl/2.2.0-expsym-c14
-rw-r--r--eclass/ELT-patches/aixrtl/2.2.0-expsym-cxx14
-rw-r--r--eclass/ELT-patches/aixrtl/2.2.0-noundef-c11
-rw-r--r--eclass/ELT-patches/aixrtl/2.2.0-noundef-cxx11
-rw-r--r--eclass/ELT-patches/aixrtl/2.2.0-usertl-cxx10
-rw-r--r--eclass/ELT-patches/aixrtl/2.2.8-cmds-c11
-rw-r--r--eclass/ELT-patches/aixrtl/2.2.8-cmds-cxx11
-rw-r--r--eclass/ELT-patches/aixrtl/2.4.0-expsym-c14
-rw-r--r--eclass/ELT-patches/aixrtl/2.4.0-expsym-cxx14
-rw-r--r--eclass/ELT-patches/aixrtl/2.4.2.418-cmds-c11
-rw-r--r--eclass/ELT-patches/aixrtl/2.4.2.418-cmds-cxx11
-rw-r--r--eclass/ELT-patches/aixrtl/2.4.2.418-soname10
-rw-r--r--eclass/ELT-patches/aixrtl/2.4.4-with-svr411
-rw-r--r--eclass/ELT-patches/as-needed/1.530
-rw-r--r--eclass/ELT-patches/as-needed/1.5.2638
-rw-r--r--eclass/ELT-patches/as-needed/2.2.638
-rw-r--r--eclass/ELT-patches/as-needed/2.4.238
-rw-r--r--eclass/ELT-patches/cross/link-ROOT20
-rw-r--r--eclass/ELT-patches/darwin-conf/1.524
-rw-r--r--eclass/ELT-patches/darwin-conf/1.5b33
-rw-r--r--eclass/ELT-patches/darwin-conf/2.2.429
-rw-r--r--eclass/ELT-patches/darwin-conf/2.2.643
-rw-r--r--eclass/ELT-patches/darwin-ltconf/1.2.066
-rw-r--r--eclass/ELT-patches/darwin-ltconf/1.3.067
-rw-r--r--eclass/ELT-patches/darwin-ltmain/1.2.040
-rw-r--r--eclass/ELT-patches/darwin-ltmain/1.3.064
-rw-r--r--eclass/ELT-patches/deplibs/1.518
-rw-r--r--eclass/ELT-patches/deplibs/2.1b18
-rw-r--r--eclass/ELT-patches/fbsd-conf/00broken-libglade33
-rw-r--r--eclass/ELT-patches/fbsd-conf/1.4.032
-rw-r--r--eclass/ELT-patches/fbsd-conf/1.5.10120
-rw-r--r--eclass/ELT-patches/fbsd-conf/1.5.18116
-rw-r--r--eclass/ELT-patches/fbsd-conf/1.5.20116
-rw-r--r--eclass/ELT-patches/fbsd-conf/1.5.20b61
-rw-r--r--eclass/ELT-patches/fbsd-conf/1.9f60
-rw-r--r--eclass/ELT-patches/fbsd-ltconf/1.2.026
-rw-r--r--eclass/ELT-patches/fbsd-ltconf/1.3.032
-rw-r--r--eclass/ELT-patches/fbsd-ltconf/1.4a32
-rw-r--r--eclass/ELT-patches/fbsd-ltconf/1.4a-GCC3.032
-rw-r--r--eclass/ELT-patches/fix-relink/1.4.063
-rw-r--r--eclass/ELT-patches/fix-relink/1.4.362
-rw-r--r--eclass/ELT-patches/fix-relink/1.5.051
-rw-r--r--eclass/ELT-patches/gold-conf/2.2.610
-rw-r--r--eclass/ELT-patches/hardcode-relink/1.3d8
-rw-r--r--eclass/ELT-patches/hardcode/1.3d21
-rw-r--r--eclass/ELT-patches/hardcode/2.1b36
-rw-r--r--eclass/ELT-patches/hc-flag-ld/1.518
-rw-r--r--eclass/ELT-patches/hpux-conf/1.5.22-syslibpath24
-rw-r--r--eclass/ELT-patches/install-sh/1.514
-rw-r--r--eclass/ELT-patches/install-sh/1.5.414
-rw-r--r--eclass/ELT-patches/install-sh/1.5.614
-rw-r--r--eclass/ELT-patches/irix-ltmain/2.2.630
-rw-r--r--eclass/ELT-patches/ltmain/1.518
-rw-r--r--eclass/ELT-patches/max_cmd_len/1.5.033
-rw-r--r--eclass/ELT-patches/max_cmd_len/1.5.1433
-rw-r--r--eclass/ELT-patches/max_cmd_len/1.5.2033
-rw-r--r--eclass/ELT-patches/mint-conf/2.2.615
-rw-r--r--eclass/ELT-patches/no-lc/1.3d13
-rw-r--r--eclass/ELT-patches/no-lc/1.5.2211
-rw-r--r--eclass/ELT-patches/nocxx/nocxx-2.64.patch13
-rw-r--r--eclass/ELT-patches/nocxx/nocxx.patch15
-rw-r--r--eclass/ELT-patches/portage/1.2.07
-rw-r--r--eclass/ELT-patches/portage/1.3.0c66
-rw-r--r--eclass/ELT-patches/portage/1.3.371
-rw-r--r--eclass/ELT-patches/portage/1.4.074
-rw-r--r--eclass/ELT-patches/portage/1.5.1077
-rw-r--r--eclass/ELT-patches/portage/2.269
-rw-r--r--eclass/ELT-patches/relink-prog/1.3d24
-rw-r--r--eclass/ELT-patches/relink-prog/2.1b24
-rw-r--r--eclass/ELT-patches/relink/1.4.0a99
-rw-r--r--eclass/ELT-patches/relink/1.4.0a-GCC3.0-199
-rw-r--r--eclass/ELT-patches/relink/1.4.0a-GCC3.0-2100
-rw-r--r--eclass/ELT-patches/relink/1.4.1124
-rw-r--r--eclass/ELT-patches/relink/1.4.299
-rw-r--r--eclass/ELT-patches/relink/1.4.3111
-rw-r--r--eclass/ELT-patches/rem-int-dep/1.3.511
-rw-r--r--eclass/ELT-patches/sed/1.3.414
-rw-r--r--eclass/ELT-patches/sed/1.4.014
-rw-r--r--eclass/ELT-patches/sed/1.5.616
-rw-r--r--eclass/ELT-patches/sol2-conf/2.4.214
-rw-r--r--eclass/ELT-patches/sol2-ltmain/2.4.211
-rw-r--r--eclass/ELT-patches/sys-lib-dlsearch/2.421
-rw-r--r--eclass/ELT-patches/target-nm/2.4.245
-rw-r--r--eclass/ELT-patches/test/1.4.0291
-rw-r--r--eclass/ELT-patches/test/1.4.2578
-rw-r--r--eclass/ELT-patches/tmp/1.3.515
-rw-r--r--eclass/ELT-patches/uclibc-conf/1.2.048
-rw-r--r--eclass/ELT-patches/uclibc-conf/1.3.0c48
-rw-r--r--eclass/ELT-patches/uclibc-ltconf/1.2.036
-rw-r--r--eclass/ELT-patches/uclibc-ltconf/1.3.039
-rw-r--r--eclass/alternatives.eclass143
-rw-r--r--eclass/ant-tasks.eclass180
-rw-r--r--eclass/apache-2.eclass631
-rw-r--r--eclass/apache-module.eclass239
-rw-r--r--eclass/aspell-dict.eclass66
-rw-r--r--eclass/autotools-multilib.eclass90
-rw-r--r--eclass/autotools-utils.eclass403
-rw-r--r--eclass/autotools.eclass607
-rw-r--r--eclass/base.eclass194
-rw-r--r--eclass/bash-completion-r1.eclass134
-rw-r--r--eclass/bash-completion.eclass101
-rw-r--r--eclass/bitcoincore.eclass309
-rw-r--r--eclass/bsdmk.eclass85
-rw-r--r--eclass/bzr.eclass341
-rw-r--r--eclass/cannadic.eclass150
-rw-r--r--eclass/cdrom.eclass247
-rw-r--r--eclass/check-reqs.eclass355
-rw-r--r--eclass/chromium.eclass266
-rw-r--r--eclass/clutter.eclass72
-rw-r--r--eclass/cmake-multilib.eclass74
-rw-r--r--eclass/cmake-utils.eclass751
-rw-r--r--eclass/common-lisp-3.eclass211
-rw-r--r--eclass/common-lisp-common-2.eclass80
-rw-r--r--eclass/common-lisp-common-3.eclass82
-rw-r--r--eclass/common-lisp-common.eclass209
-rw-r--r--eclass/common-lisp.eclass78
-rw-r--r--eclass/confutils.eclass478
-rw-r--r--eclass/cron.eclass161
-rw-r--r--eclass/cuda.eclass134
-rw-r--r--eclass/cvs.eclass583
-rw-r--r--eclass/darcs.eclass205
-rw-r--r--eclass/db-use.eclass116
-rw-r--r--eclass/db.eclass188
-rw-r--r--eclass/depend.apache.eclass317
-rw-r--r--eclass/depend.php.eclass258
-rw-r--r--eclass/distutils-r1.eclass822
-rw-r--r--eclass/distutils.eclass594
-rw-r--r--eclass/elisp-common.eclass415
-rw-r--r--eclass/elisp.eclass204
-rw-r--r--eclass/embassy.eclass92
-rw-r--r--eclass/emboss-r1.eclass133
-rw-r--r--eclass/emul-linux-x86.eclass96
-rw-r--r--eclass/enlightenment.eclass199
-rw-r--r--eclass/eutils.eclass1794
-rw-r--r--eclass/fcaps.eclass217
-rw-r--r--eclass/fdo-mime.eclass38
-rw-r--r--eclass/findlib.eclass59
-rw-r--r--eclass/fixheadtails.eclass44
-rw-r--r--eclass/flag-o-matic.eclass673
-rw-r--r--eclass/font-ebdftopcf.eclass46
-rw-r--r--eclass/font.eclass250
-rw-r--r--eclass/fortran-2.eclass256
-rw-r--r--eclass/fox.eclass230
-rw-r--r--eclass/freebsd.eclass267
-rw-r--r--eclass/freedict.eclass50
-rw-r--r--eclass/games-mods.eclass319
-rw-r--r--eclass/games.eclass391
-rw-r--r--eclass/gdesklets.eclass165
-rw-r--r--eclass/ghc-package.eclass339
-rw-r--r--eclass/git-2.eclass604
-rw-r--r--eclass/git-r3.eclass988
-rw-r--r--eclass/gkrellm-plugin.eclass83
-rw-r--r--eclass/gnat.eclass457
-rw-r--r--eclass/gnatbuild.eclass795
-rw-r--r--eclass/gnome-games.eclass116
-rw-r--r--eclass/gnome-python-common-r1.eclass106
-rw-r--r--eclass/gnome.org.eclass49
-rw-r--r--eclass/gnome2-utils.eclass502
-rw-r--r--eclass/gnome2.eclass263
-rw-r--r--eclass/gnuconfig.eclass99
-rw-r--r--eclass/gnustep-2.eclass27
-rw-r--r--eclass/gnustep-base.eclass268
-rw-r--r--eclass/go-mono.eclass137
-rw-r--r--eclass/golang-base.eclass78
-rw-r--r--eclass/golang-build.eclass71
-rw-r--r--eclass/golang-vcs-snapshot.eclass56
-rw-r--r--eclass/golang-vcs.eclass153
-rw-r--r--eclass/gpe.eclass115
-rw-r--r--eclass/gst-plugins-bad.eclass43
-rw-r--r--eclass/gst-plugins-base.eclass31
-rw-r--r--eclass/gst-plugins-good.eclass42
-rw-r--r--eclass/gst-plugins-ugly.eclass31
-rw-r--r--eclass/gst-plugins10.eclass299
-rw-r--r--eclass/gstreamer.eclass279
-rw-r--r--eclass/gtk-sharp-module.eclass547
-rw-r--r--eclass/haskell-cabal.eclass774
-rw-r--r--eclass/horde.eclass184
-rw-r--r--eclass/intel-sdp.eclass521
-rw-r--r--eclass/java-ant-2.eclass522
-rw-r--r--eclass/java-mvn-src.eclass65
-rw-r--r--eclass/java-osgi.eclass292
-rw-r--r--eclass/java-pkg-2.eclass158
-rw-r--r--eclass/java-pkg-opt-2.eclass67
-rw-r--r--eclass/java-pkg-simple.eclass209
-rw-r--r--eclass/java-utils-2.eclass2826
-rw-r--r--eclass/java-virtuals-2.eclass55
-rw-r--r--eclass/java-vm-2.eclass396
-rw-r--r--eclass/kde4-base.eclass922
-rw-r--r--eclass/kde4-functions.eclass413
-rw-r--r--eclass/kde4-meta-pkg.eclass24
-rw-r--r--eclass/kde4-meta.eclass630
-rw-r--r--eclass/kde5-functions.eclass239
-rw-r--r--eclass/kde5.eclass553
-rw-r--r--eclass/kernel-2.eclass1347
-rw-r--r--eclass/l10n.eclass119
-rw-r--r--eclass/latex-package.eclass238
-rw-r--r--eclass/leechcraft.eclass85
-rw-r--r--eclass/libtool.eclass513
-rw-r--r--eclass/linux-info.eclass923
-rw-r--r--eclass/linux-mod.eclass741
-rw-r--r--eclass/makeedit.eclass37
-rw-r--r--eclass/mercurial.eclass197
-rw-r--r--eclass/mono-env.eclass45
-rw-r--r--eclass/mono.eclass81
-rw-r--r--eclass/mount-boot.eclass157
-rw-r--r--eclass/mozconfig-3.eclass104
-rw-r--r--eclass/mozconfig-v5.31.eclass218
-rw-r--r--eclass/mozconfig-v5.34.eclass232
-rw-r--r--eclass/mozconfig-v5.36.eclass232
-rw-r--r--eclass/mozconfig-v5.38.eclass231
-rw-r--r--eclass/mozconfig-v6.38.eclass239
-rw-r--r--eclass/mozconfig-v6.39.eclass240
-rw-r--r--eclass/mozcoreconf-2.eclass274
-rw-r--r--eclass/mozcoreconf-v3.eclass261
-rw-r--r--eclass/mozextension.eclass88
-rw-r--r--eclass/mozilla-launcher.eclass123
-rw-r--r--eclass/mozlinguas.eclass315
-rw-r--r--eclass/multibuild.eclass269
-rw-r--r--eclass/multilib-build.eclass659
-rw-r--r--eclass/multilib-minimal.eclass124
-rw-r--r--eclass/multilib.eclass451
-rw-r--r--eclass/multiprocessing.eclass273
-rw-r--r--eclass/myspell-r2.eclass118
-rw-r--r--eclass/myspell.eclass257
-rw-r--r--eclass/mysql-cmake.eclass534
-rw-r--r--eclass/mysql-multilib.eclass1113
-rw-r--r--eclass/mysql-v2.eclass921
-rw-r--r--eclass/mysql_fx.eclass306
-rw-r--r--eclass/mythtv-plugins.eclass129
-rw-r--r--eclass/mythtv.eclass48
-rw-r--r--eclass/netsurf.eclass178
-rw-r--r--eclass/nsplugins.eclass80
-rw-r--r--eclass/nvidia-driver.eclass188
-rw-r--r--eclass/oasis.eclass121
-rw-r--r--eclass/obs-download.eclass43
-rw-r--r--eclass/obs-service.eclass112
-rw-r--r--eclass/office-ext-r1.eclass230
-rw-r--r--eclass/openib.eclass155
-rw-r--r--eclass/pam.eclass262
-rw-r--r--eclass/pax-utils.eclass189
-rw-r--r--eclass/perl-app.eclass35
-rw-r--r--eclass/perl-module.eclass547
-rw-r--r--eclass/php-ext-pecl-r2.eclass105
-rw-r--r--eclass/php-ext-source-r2.eclass377
-rw-r--r--eclass/php-lib-r1.eclass61
-rw-r--r--eclass/php-pear-lib-r1.eclass97
-rw-r--r--eclass/php-pear-r1.eclass118
-rw-r--r--eclass/phpconfutils.eclass458
-rw-r--r--eclass/portability.eclass156
-rw-r--r--eclass/prefix.eclass52
-rw-r--r--eclass/python-any-r1.eclass326
-rw-r--r--eclass/python-r1.eclass656
-rw-r--r--eclass/python-single-r1.eclass468
-rw-r--r--eclass/python-utils-r1.eclass1315
-rw-r--r--eclass/python.eclass3181
-rw-r--r--eclass/qmail.eclass536
-rw-r--r--eclass/qmake-utils.eclass323
-rw-r--r--eclass/qt4-build-multilib.eclass835
-rw-r--r--eclass/qt4-build.eclass804
-rw-r--r--eclass/qt4-r2.eclass138
-rw-r--r--eclass/qt5-build.eclass787
-rw-r--r--eclass/readme.gentoo.eclass130
-rw-r--r--eclass/rpm.eclass127
-rw-r--r--eclass/ruby-fakegem.eclass532
-rw-r--r--eclass/ruby-ng-gnome2.eclass93
-rw-r--r--eclass/ruby-ng.eclass724
-rw-r--r--eclass/ruby-single.eclass90
-rw-r--r--eclass/ruby-utils.eclass83
-rw-r--r--eclass/s6.eclass119
-rw-r--r--eclass/savedconfig.eclass155
-rw-r--r--eclass/scons-utils.eclass235
-rw-r--r--eclass/scsh.eclass73
-rw-r--r--eclass/selinux-policy-2.eclass357
-rw-r--r--eclass/sgml-catalog.eclass101
-rw-r--r--eclass/ssl-cert.eclass250
-rw-r--r--eclass/stardict.eclass60
-rw-r--r--eclass/subversion.eclass525
-rw-r--r--eclass/sword-module.eclass34
-rw-r--r--eclass/systemd.eclass387
-rwxr-xr-xeclass/tests/autotools_eaclocal_amflags.sh32
-rwxr-xr-xeclass/tests/distutils-r1.sh33
-rwxr-xr-xeclass/tests/eutils_eshopts.sh44
-rwxr-xr-xeclass/tests/eutils_estack.sh53
-rwxr-xr-xeclass/tests/eutils_evar.sh100
-rwxr-xr-xeclass/tests/eutils_path_exists.sh36
-rwxr-xr-xeclass/tests/flag-o-matic.sh149
-rwxr-xr-xeclass/tests/git-r3.sh204
-rwxr-xr-xeclass/tests/git-r3_GIT_DIR.sh61
-rwxr-xr-xeclass/tests/git-r3_subrepos.sh38
-rwxr-xr-xeclass/tests/linux-info_get_running_version.sh39
-rwxr-xr-xeclass/tests/multiprocessing.sh43
-rwxr-xr-xeclass/tests/multiprocessing_makeopts_jobs.sh39
-rwxr-xr-xeclass/tests/python-utils-r1.sh170
-rwxr-xr-xeclass/tests/savedconfig.sh79
-rwxr-xr-xeclass/tests/scons-utils.sh64
-rw-r--r--eclass/tests/tests-common.sh147
-rwxr-xr-xeclass/tests/toolchain-funcs.sh115
-rwxr-xr-xeclass/tests/toolchain.sh83
-rwxr-xr-xeclass/tests/versionator_version_compare.sh200
-rw-r--r--eclass/texlive-common.eclass170
-rw-r--r--eclass/texlive-module.eclass401
-rw-r--r--eclass/toolchain-binutils.eclass498
-rw-r--r--eclass/toolchain-funcs.eclass839
-rw-r--r--eclass/toolchain.eclass2263
-rw-r--r--eclass/twisted-r1.eclass236
-rw-r--r--eclass/udev.eclass115
-rw-r--r--eclass/unpacker.eclass462
-rw-r--r--eclass/user.eclass466
-rw-r--r--eclass/vala.eclass149
-rw-r--r--eclass/vcs-snapshot.eclass78
-rw-r--r--eclass/vdr-plugin-2.eclass656
-rw-r--r--eclass/versionator.eclass510
-rw-r--r--eclass/vim-doc.eclass73
-rw-r--r--eclass/vim-plugin.eclass157
-rw-r--r--eclass/vim-spell.eclass127
-rw-r--r--eclass/virtualx.eclass199
-rw-r--r--eclass/virtuoso.eclass131
-rw-r--r--eclass/vmware-bundle.eclass83
-rw-r--r--eclass/waf-utils.eclass129
-rw-r--r--eclass/webapp.eclass581
-rw-r--r--eclass/wxwidgets.eclass145
-rw-r--r--eclass/x-modular.eclass621
-rw-r--r--eclass/xemacs-elisp-common.eclass311
-rw-r--r--eclass/xemacs-elisp.eclass55
-rw-r--r--eclass/xemacs-packages.eclass68
-rw-r--r--eclass/xfconf.eclass154
-rw-r--r--eclass/xorg-2.eclass605
342 files changed, 76926 insertions, 0 deletions
diff --git a/eclass/ELT-patches/aixrtl/1.5.0-cmds-c b/eclass/ELT-patches/aixrtl/1.5.0-cmds-c
new file mode 100644
index 00000000000..9be05686ad7
--- /dev/null
+++ b/eclass/ELT-patches/aixrtl/1.5.0-cmds-c
@@ -0,0 +1,11 @@
+--- configure
++++ configure
+@@ -7234,7 +7235,7 @@
+ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+- archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag"
++ archive_expsym_cmds='eval `echo "$soname" | sed -e "s,^,: ,; s,(,; membnam=,; s,\.o),,"`~rm -f -r $lib.d~mkdir -p $lib.d~$CC -o $lib.d/$membnam.o $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags -shared $wl-G$allow_undefined_flag $wl'$exp_sym_flag':$export_symbols~$STRIP -e $lib.d/$membnam.o~( echo "#! $soname"; if test $membnam = shr_64; then echo "# 64"; else echo "# 32"; fi; cat $export_symbols ) > $lib.d/$membnam.imp~$AR $AR_FLAGS $lib $lib.d/$membnam.o $lib.d/$membnam.imp~rm -f -r $lib.d'
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
diff --git a/eclass/ELT-patches/aixrtl/1.5.0-cmds-cxx b/eclass/ELT-patches/aixrtl/1.5.0-cmds-cxx
new file mode 100644
index 00000000000..13ffb7ac4c0
--- /dev/null
+++ b/eclass/ELT-patches/aixrtl/1.5.0-cmds-cxx
@@ -0,0 +1,11 @@
+--- configure
++++ configure
+@@ -10041,7 +10043,7 @@
+
+ hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+- archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag"
++ archive_expsym_cmds_CXX='eval `echo "$soname" | sed -e "s,^,: ,; s,(,; membnam=,; s,\.o),,"`~rm -f -r $lib.d~mkdir -p $lib.d~$CC -o $lib.d/$membnam.o $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags -shared $wl-G$allow_undefined_flag $wl'$exp_sym_flag':$export_symbols~$STRIP -e $lib.d/$membnam.o~( echo "#! $soname"; if test $membnam = shr_64; then echo "# 64"; else echo "# 32"; fi; cat $export_symbols ) > $lib.d/$membnam.imp~$AR $AR_FLAGS $lib $lib.d/$membnam.o $lib.d/$membnam.imp~rm -f -r $lib.d'
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib'
diff --git a/eclass/ELT-patches/aixrtl/1.5.0-expsym-c b/eclass/ELT-patches/aixrtl/1.5.0-expsym-c
new file mode 100644
index 00000000000..2b54887d8fc
--- /dev/null
+++ b/eclass/ELT-patches/aixrtl/1.5.0-expsym-c
@@ -0,0 +1,14 @@
+--- configure
++++ configure
+@@ -7113,9 +7113,9 @@
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+- export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
++ export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols'
+ else
+- export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
++ export_symbols_cmds='`echo $NM | sed -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | 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 } } }'\'' | sort -u > $export_symbols'
+ fi
+ aix_use_runtimelinking=no
+
diff --git a/eclass/ELT-patches/aixrtl/1.5.0-expsym-cxx b/eclass/ELT-patches/aixrtl/1.5.0-expsym-cxx
new file mode 100644
index 00000000000..9b6bdc2f952
--- /dev/null
+++ b/eclass/ELT-patches/aixrtl/1.5.0-expsym-cxx
@@ -0,0 +1,14 @@
+--- configure
++++ configure
+@@ -11217,9 +11217,9 @@
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+- export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
++ export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols'
+ else
+- export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
++ export_symbols_cmds_CXX='`echo $NM | sed -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | 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 } } }'\'' | sort -u > $export_symbols'
+ fi
+ ;;
+ pw32*)
diff --git a/eclass/ELT-patches/aixrtl/1.5.0-noundef-c b/eclass/ELT-patches/aixrtl/1.5.0-noundef-c
new file mode 100644
index 00000000000..c893f9c6ab7
--- /dev/null
+++ b/eclass/ELT-patches/aixrtl/1.5.0-noundef-c
@@ -0,0 +1,11 @@
+--- configure
++++ configure
+@@ -7189,7 +7190,7 @@
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+- allow_undefined_flag='-berok'
++ no_undefined_flag=' ${wl}-bernotok'
+ # Determine the default libpath from the value encoded in an empty executable.
+ cat >conftest.$ac_ext <<_ACEOF
+ #line $LINENO "configure"
diff --git a/eclass/ELT-patches/aixrtl/1.5.0-noundef-cxx b/eclass/ELT-patches/aixrtl/1.5.0-noundef-cxx
new file mode 100644
index 00000000000..dc01fcab6dd
--- /dev/null
+++ b/eclass/ELT-patches/aixrtl/1.5.0-noundef-cxx
@@ -0,0 +1,11 @@
+--- configure
++++ configure
+@@ -9995,7 +9997,7 @@
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+- allow_undefined_flag_CXX='-berok'
++ no_undefined_flag_CXX=' ${wl}-bernotok'
+ # Determine the default libpath from the value encoded in an empty executable.
+ cat >conftest.$ac_ext <<_ACEOF
+ #line $LINENO "configure"
diff --git a/eclass/ELT-patches/aixrtl/1.5.0-soname b/eclass/ELT-patches/aixrtl/1.5.0-soname
new file mode 100644
index 00000000000..113fe2d84e1
--- /dev/null
+++ b/eclass/ELT-patches/aixrtl/1.5.0-soname
@@ -0,0 +1,12 @@
+--- configure
++++ configure
+@@ -14426,7 +14426,8 @@
+ # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+ # instead of lib<name>.a to let people know that these are not
+ # typical AIX shared libraries.
+- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
++ library_names_spec='$libname$release$shared_ext$major $libname$shared_ext'
++ [ "${OBJECT_MODE:-32}" = '64' ] && soname_spec='$libname$release$shared_ext$major(shr_64.o)' || soname_spec='$libname$release$shared_ext$major(shr.o)'
+ else
+ # We preserve .a as extension for shared libraries through AIX4.2
+ # and later when we are not doing run time linking.
diff --git a/eclass/ELT-patches/aixrtl/1.5.0-usertl-c b/eclass/ELT-patches/aixrtl/1.5.0-usertl-c
new file mode 100644
index 00000000000..b5ff1866c89
--- /dev/null
+++ b/eclass/ELT-patches/aixrtl/1.5.0-usertl-c
@@ -0,0 +1,10 @@
+--- configure
++++ configure
+@@ -7130,6 +7130,7 @@
+ fi
+ done
+ esac
++ aix_use_runtimelinking=yes
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
diff --git a/eclass/ELT-patches/aixrtl/1.5.0-usertl-cxx b/eclass/ELT-patches/aixrtl/1.5.0-usertl-cxx
new file mode 100644
index 00000000000..36c84e9809b
--- /dev/null
+++ b/eclass/ELT-patches/aixrtl/1.5.0-usertl-cxx
@@ -0,0 +1,10 @@
+--- configure
++++ configure
+@@ -9936,6 +9937,7 @@
+ esac
+ done
+ esac
++ aix_use_runtimelinking=yes
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
diff --git a/eclass/ELT-patches/aixrtl/1.5.22-cmds-c b/eclass/ELT-patches/aixrtl/1.5.22-cmds-c
new file mode 100644
index 00000000000..a97485a3c12
--- /dev/null
+++ b/eclass/ELT-patches/aixrtl/1.5.22-cmds-c
@@ -0,0 +1,11 @@
+--- configure
++++ configure
+@@ -8679,7 +8679,7 @@
+ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+- archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
++ archive_expsym_cmds='eval `echo "$soname" | sed -e "s,^,: ,; s,(,; membnam=,; s,\.o),,"`~rm -f -r $lib.d~mkdir -p $lib.d~$CC -o $lib.d/$membnam.o $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags -shared $wl-G$allow_undefined_flag $wl'$exp_sym_flag':$export_symbols~$STRIP -e $lib.d/$membnam.o~( echo "#! $soname"; if test $membnam = shr_64; then echo "# 64"; else echo "# 32"; fi; cat $export_symbols ) > $lib.d/$membnam.imp~$AR $AR_FLAGS $lib $lib.d/$membnam.o $lib.d/$membnam.imp~rm -f -r $lib.d'
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
diff --git a/eclass/ELT-patches/aixrtl/1.5.22-cmds-cxx b/eclass/ELT-patches/aixrtl/1.5.22-cmds-cxx
new file mode 100644
index 00000000000..222a0f71691
--- /dev/null
+++ b/eclass/ELT-patches/aixrtl/1.5.22-cmds-cxx
@@ -0,0 +1,11 @@
+--- configure
++++ configure
+@@ -11731,7 +11731,7 @@
+
+ hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+- archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
++ archive_expsym_cmds_CXX='eval `echo "$soname" | sed -e "s,^,: ,; s,(,; membnam=,; s,\.o),,"`~rm -f -r $lib.d~mkdir -p $lib.d~$CC -o $lib.d/$membnam.o $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags -shared $wl-G$allow_undefined_flag $wl'$exp_sym_flag':$export_symbols~$STRIP -e $lib.d/$membnam.o~( echo "#! $soname"; if test $membnam = shr_64; then echo "# 64"; else echo "# 32"; fi; cat $export_symbols ) > $lib.d/$membnam.imp~$AR $AR_FLAGS $lib $lib.d/$membnam.o $lib.d/$membnam.imp~rm -f -r $lib.d'
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib'
diff --git a/eclass/ELT-patches/aixrtl/2.0.0-fpic-c b/eclass/ELT-patches/aixrtl/2.0.0-fpic-c
new file mode 100644
index 00000000000..bb3cb42bbee
--- /dev/null
+++ b/eclass/ELT-patches/aixrtl/2.0.0-fpic-c
@@ -0,0 +1,12 @@
+--- configure
++++ configure
+@@ -1,6 +1,9 @@
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static='-Bstatic'
++ lt_prog_compiler_pic='-fPIC'
++ else
++ lt_prog_compiler_pic='-fPIC'
+ fi
+ ;;
+
diff --git a/eclass/ELT-patches/aixrtl/2.0.0-fpic-cxx b/eclass/ELT-patches/aixrtl/2.0.0-fpic-cxx
new file mode 100644
index 00000000000..532bbcf421e
--- /dev/null
+++ b/eclass/ELT-patches/aixrtl/2.0.0-fpic-cxx
@@ -0,0 +1,12 @@
+--- configure
++++ configure
+@@ -1,6 +1,9 @@
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static_CXX='-Bstatic'
++ lt_prog_compiler_pic_CXX='-fPIC'
++ else
++ lt_prog_compiler_pic_CXX='-fPIC'
+ fi
+ ;;
+
diff --git a/eclass/ELT-patches/aixrtl/2.2.0-cmds-c b/eclass/ELT-patches/aixrtl/2.2.0-cmds-c
new file mode 100644
index 00000000000..6c2cd7ea5b5
--- /dev/null
+++ b/eclass/ELT-patches/aixrtl/2.2.0-cmds-c
@@ -0,0 +1,11 @@
+--- configure
++++ configure
+@@ -8619,7 +8619,7 @@
+ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+- archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
++ archive_expsym_cmds='eval `echo "$soname" | sed -e "s,^,: ,; s,(,; membnam=,; s,\.o),,"`~rm -f -r $lib.d~mkdir -p $lib.d~$CC -o $lib.d/$membnam.o $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags -shared $wl-G$allow_undefined_flag $wl'$exp_sym_flag':$export_symbols~$STRIP -e $lib.d/$membnam.o~( echo "#! $soname"; if test $membnam = shr_64; then echo "# 64"; else echo "# 32"; fi; cat $export_symbols ) > $lib.d/$membnam.imp~$AR $AR_FLAGS $lib $lib.d/$membnam.o $lib.d/$membnam.imp~rm -f -r $lib.d'
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
diff --git a/eclass/ELT-patches/aixrtl/2.2.0-cmds-cxx b/eclass/ELT-patches/aixrtl/2.2.0-cmds-cxx
new file mode 100644
index 00000000000..af3c7b7c5a3
--- /dev/null
+++ b/eclass/ELT-patches/aixrtl/2.2.0-cmds-cxx
@@ -0,0 +1,11 @@
+--- configure
++++ configure
+@@ -13946,7 +13947,7 @@
+
+ hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+- archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
++ archive_expsym_cmds_CXX='eval `echo "$soname" | sed -e "s,^,: ,; s,(,; membnam=,; s,\.o),,"`~rm -f -r $lib.d~mkdir -p $lib.d~$CC -o $lib.d/$membnam.o $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags -shared $wl-G$allow_undefined_flag $wl'$exp_sym_flag':$export_symbols~$STRIP -e $lib.d/$membnam.o~( echo "#! $soname"; if test $membnam = shr_64; then echo "# 64"; else echo "# 32"; fi; cat $export_symbols ) > $lib.d/$membnam.imp~$AR $AR_FLAGS $lib $lib.d/$membnam.o $lib.d/$membnam.imp~rm -f -r $lib.d'
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib'
diff --git a/eclass/ELT-patches/aixrtl/2.2.0-expsym-c b/eclass/ELT-patches/aixrtl/2.2.0-expsym-c
new file mode 100644
index 00000000000..196a5a36e60
--- /dev/null
+++ b/eclass/ELT-patches/aixrtl/2.2.0-expsym-c
@@ -0,0 +1,14 @@
+--- configure
++++ configure
+@@ -8475,9 +8475,9 @@
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+- export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
++ export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols'
+ else
+- export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
++ export_symbols_cmds='`echo $NM | sed -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | 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 } } }'\'' | sort -u > $export_symbols'
+ fi
+ aix_use_runtimelinking=no
+
diff --git a/eclass/ELT-patches/aixrtl/2.2.0-expsym-cxx b/eclass/ELT-patches/aixrtl/2.2.0-expsym-cxx
new file mode 100644
index 00000000000..ee4d163989d
--- /dev/null
+++ b/eclass/ELT-patches/aixrtl/2.2.0-expsym-cxx
@@ -0,0 +1,14 @@
+--- configure
++++ configure
+@@ -15506,9 +15506,9 @@
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+- export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
++ export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols'
+ else
+- export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
++ export_symbols_cmds_CXX='`echo $NM | sed -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | 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 } } }'\'' | sort -u > $export_symbols'
+ fi
+ ;;
+ pw32*)
diff --git a/eclass/ELT-patches/aixrtl/2.2.0-noundef-c b/eclass/ELT-patches/aixrtl/2.2.0-noundef-c
new file mode 100644
index 00000000000..d9520cbbd73
--- /dev/null
+++ b/eclass/ELT-patches/aixrtl/2.2.0-noundef-c
@@ -0,0 +1,11 @@
+--- configure
++++ configure
+@@ -8558,7 +8558,7 @@
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+- allow_undefined_flag='-berok'
++ no_undefined_flag=' ${wl}-bernotok'
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ cat >conftest.$ac_ext <<_ACEOF
diff --git a/eclass/ELT-patches/aixrtl/2.2.0-noundef-cxx b/eclass/ELT-patches/aixrtl/2.2.0-noundef-cxx
new file mode 100644
index 00000000000..37d02dba8c6
--- /dev/null
+++ b/eclass/ELT-patches/aixrtl/2.2.0-noundef-cxx
@@ -0,0 +1,11 @@
+--- configure
++++ configure
+@@ -13884,7 +13885,7 @@
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+- allow_undefined_flag_CXX='-berok'
++ no_undefined_flag_CXX=' ${wl}-bernotok'
+ # Determine the default libpath from the value encoded in an empty
+ # executable.
+ cat >conftest.$ac_ext <<_ACEOF
diff --git a/eclass/ELT-patches/aixrtl/2.2.0-usertl-cxx b/eclass/ELT-patches/aixrtl/2.2.0-usertl-cxx
new file mode 100644
index 00000000000..c59a093c94f
--- /dev/null
+++ b/eclass/ELT-patches/aixrtl/2.2.0-usertl-cxx
@@ -0,0 +1,10 @@
+--- configure
++++ configure
+@@ -13819,6 +13819,7 @@
+ done
+ ;;
+ esac
++ aix_use_runtimelinking=yes
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
diff --git a/eclass/ELT-patches/aixrtl/2.2.8-cmds-c b/eclass/ELT-patches/aixrtl/2.2.8-cmds-c
new file mode 100644
index 00000000000..e1e09347b21
--- /dev/null
+++ b/eclass/ELT-patches/aixrtl/2.2.8-cmds-c
@@ -0,0 +1,11 @@
+--- configure
++++ configure
+@@ -9214,7 +9214,7 @@
+ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+- archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
++ archive_expsym_cmds='eval `echo "$soname" | sed -e "s,^,: ,; s,(,; membnam=,; s,\.o),,"`~rm -f -r $lib.d~mkdir -p $lib.d~$CC -o $lib.d/$membnam.o $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags -shared $wl-G$allow_undefined_flag $wl'$exp_sym_flag':$export_symbols~$STRIP -e $lib.d/$membnam.o~( echo "#! $soname"; if test $membnam = shr_64; then echo "# 64"; else echo "# 32"; fi; cat $export_symbols ) > $lib.d/$membnam.imp~$AR $AR_FLAGS $lib $lib.d/$membnam.o $lib.d/$membnam.imp~rm -f -r $lib.d'
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
diff --git a/eclass/ELT-patches/aixrtl/2.2.8-cmds-cxx b/eclass/ELT-patches/aixrtl/2.2.8-cmds-cxx
new file mode 100644
index 00000000000..7a31f661d44
--- /dev/null
+++ b/eclass/ELT-patches/aixrtl/2.2.8-cmds-cxx
@@ -0,0 +1,11 @@
+--- configure
++++ configure
+@@ -13307,7 +13307,7 @@
+
+ hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+- archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
++ archive_expsym_cmds_CXX='eval `echo "$soname" | sed -e "s,^,: ,; s,(,; membnam=,; s,\.o),,"`~rm -f -r $lib.d~mkdir -p $lib.d~$CC -o $lib.d/$membnam.o $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags -shared $wl-G$allow_undefined_flag $wl'$exp_sym_flag':$export_symbols~$STRIP -e $lib.d/$membnam.o~( echo "#! $soname"; if test $membnam = shr_64; then echo "# 64"; else echo "# 32"; fi; cat $export_symbols ) > $lib.d/$membnam.imp~$AR $AR_FLAGS $lib $lib.d/$membnam.o $lib.d/$membnam.imp~rm -f -r $lib.d'
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib'
diff --git a/eclass/ELT-patches/aixrtl/2.4.0-expsym-c b/eclass/ELT-patches/aixrtl/2.4.0-expsym-c
new file mode 100644
index 00000000000..6860317739a
--- /dev/null
+++ b/eclass/ELT-patches/aixrtl/2.4.0-expsym-c
@@ -0,0 +1,14 @@
+--- configure
++++ configure
+@@ -9660,9 +9660,9 @@
+ # Also, AIX nm treats weak defined symbols like other global
+ # defined symbols, whereas GNU nm marks them as "W".
+ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+- export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
++ export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols'
+ else
+- export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
++ export_symbols_cmds='`echo $NM | sed -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | 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 } } }'\'' | sort -u > $export_symbols'
+ fi
+ aix_use_runtimelinking=no
+
diff --git a/eclass/ELT-patches/aixrtl/2.4.0-expsym-cxx b/eclass/ELT-patches/aixrtl/2.4.0-expsym-cxx
new file mode 100644
index 00000000000..ca9fd97be52
--- /dev/null
+++ b/eclass/ELT-patches/aixrtl/2.4.0-expsym-cxx
@@ -0,0 +1,14 @@
+--- configure
++++ configure
+@@ -15711,9 +15711,9 @@
+ # Also, AIX nm treats weak defined symbols like other global defined
+ # symbols, whereas GNU nm marks them as "W".
+ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+- export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
++ export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols'
+ else
+- export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
++ export_symbols_cmds_CXX='`echo $NM | sed -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | 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 } } }'\'' | sort -u > $export_symbols'
+ fi
+ ;;
+ pw32*)
diff --git a/eclass/ELT-patches/aixrtl/2.4.2.418-cmds-c b/eclass/ELT-patches/aixrtl/2.4.2.418-cmds-c
new file mode 100644
index 00000000000..d92ce344b4f
--- /dev/null
+++ b/eclass/ELT-patches/aixrtl/2.4.2.418-cmds-c
@@ -0,0 +1,11 @@
+--- configure
++++ configure
+@@ -9214,7 +9214,7 @@
+ fi
+
+ hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath"
+- archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag
++ archive_expsym_cmds='eval `echo "$soname" | $SED -e "s,^,: ,; s,(,; membnam=,; s,\.o),,"`~$RM -r $lib.d~$MKDIR $lib.d~$CC -o $lib.d/$membnam.o $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags -shared $wl-G$allow_undefined_flag $wl'$exp_sym_flag':$export_symbols~$STRIP -e $lib.d/$membnam.o~( echo "#! $soname"; if test $membnam = shr_64; then echo "# 64"; else echo "# 32"; fi; cat $export_symbols ) > $lib.d/$membnam.imp~$AR $AR_FLAGS $lib $lib.d/$membnam.o $lib.d/$membnam.imp~$RM -r $lib.d'
+ else
+ if test ia64 = "$host_cpu"; then
+ hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib'
diff --git a/eclass/ELT-patches/aixrtl/2.4.2.418-cmds-cxx b/eclass/ELT-patches/aixrtl/2.4.2.418-cmds-cxx
new file mode 100644
index 00000000000..851be276398
--- /dev/null
+++ b/eclass/ELT-patches/aixrtl/2.4.2.418-cmds-cxx
@@ -0,0 +1,11 @@
+--- configure
++++ configure
+@@ -13307,7 +13307,7 @@
+
+ hardcode_libdir_flag_spec_CXX='$wl-blibpath:$libdir:'"$aix_libpath"
+
+- archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag
++ archive_expsym_cmds_CXX='eval `echo "$soname" | sed -e "s,^,: ,; s,(,; membnam=,; s,\.o),,"`~$RM -r $lib.d~$MKDIR $lib.d~$CC -o $lib.d/$membnam.o $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags -shared $wl-G$allow_undefined_flag $wl'$exp_sym_flag':$export_symbols~$STRIP -e $lib.d/$membnam.o~( echo "#! $soname"; if test $membnam = shr_64; then echo "# 64"; else echo "# 32"; fi; cat $export_symbols ) > $lib.d/$membnam.imp~$AR $AR_FLAGS $lib $lib.d/$membnam.o $lib.d/$membnam.imp~$RM -r $lib.d'
+ else
+ if test ia64 = "$host_cpu"; then
+ hardcode_libdir_flag_spec_CXX='$wl-R $libdir:/usr/lib:/lib'
diff --git a/eclass/ELT-patches/aixrtl/2.4.2.418-soname b/eclass/ELT-patches/aixrtl/2.4.2.418-soname
new file mode 100644
index 00000000000..de3e93e8ae5
--- /dev/null
+++ b/eclass/ELT-patches/aixrtl/2.4.2.418-soname
@@ -0,0 +1,10 @@
+--- configure
++++ configure
+@@ -14426,6 +14426,7 @@
+ # instead of lib<name>.a to let people know that these are not
+ # typical AIX shared libraries.
+ library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
++ [ "${OBJECT_MODE:-32}" = '64' ] && soname_spec='$libname$release$shared_ext$major(shr_64.o)' || soname_spec='$libname$release$shared_ext$major(shr.o)'
+ else
+ # We preserve .a as extension for shared libraries through AIX4.2
+ # and later when we are not doing run time linking.
diff --git a/eclass/ELT-patches/aixrtl/2.4.4-with-svr4 b/eclass/ELT-patches/aixrtl/2.4.4-with-svr4
new file mode 100644
index 00000000000..f356ea9883a
--- /dev/null
+++ b/eclass/ELT-patches/aixrtl/2.4.4-with-svr4
@@ -0,0 +1,11 @@
+--- configure
++++ configure
+@@ -10835,7 +10835,7 @@
+ if ${lt_cv_with_aix_soname+:} false; then :
+ $as_echo_n "(cached) " >&6
+ else
+- lt_cv_with_aix_soname=aix
++ lt_cv_with_aix_soname=svr4
+ fi
+
+ with_aix_soname=$lt_cv_with_aix_soname
diff --git a/eclass/ELT-patches/as-needed/1.5 b/eclass/ELT-patches/as-needed/1.5
new file mode 100644
index 00000000000..01759c93f90
--- /dev/null
+++ b/eclass/ELT-patches/as-needed/1.5
@@ -0,0 +1,30 @@
+--- ltmain.sh.orig 2006-03-29 15:45:36.000000000 +0200
++++ ltmain.sh 2006-03-29 16:39:30.000000000 +0200
+@@ -1754,6 +1754,11 @@
+ arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+ ;;
+
++ -Wl,--as-needed|-Wl,--no-as-needed)
++ deplibs="$deplibs $arg"
++ continue
++ ;;
++
+ -Wl,*)
+ args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
+ arg=
+@@ -2094,6 +2099,15 @@
+ lib=
+ found=no
+ case $deplib in
++ -Wl,--as-needed|-Wl,--no-as-needed)
++ if test "$linkmode,$pass" = "prog,link"; then
++ compile_deplibs="$deplib $compile_deplibs"
++ finalize_deplibs="$deplib $finalize_deplibs"
++ else
++ deplibs="$deplib $deplibs"
++ fi
++ continue
++ ;;
+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
diff --git a/eclass/ELT-patches/as-needed/1.5.26 b/eclass/ELT-patches/as-needed/1.5.26
new file mode 100644
index 00000000000..6836c55e143
--- /dev/null
+++ b/eclass/ELT-patches/as-needed/1.5.26
@@ -0,0 +1,38 @@
+--- ltmain.sh.orig 2009-04-18 16:51:52.000000000 +0200
++++ ltmain.sh 2009-04-18 16:55:05.000000000 +0200
+@@ -1812,10 +1812,15 @@
+ done
+ IFS="$save_ifs"
+ arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+ ;;
+
++ -Wl,--as-needed|-Wl,--no-as-needed)
++ deplibs="$deplibs $arg"
++ continue
++ ;;
++
+ -Wl,*)
+ args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
+ arg=
+ save_ifs="$IFS"; IFS=','
+ for flag in $args; do
+@@ -2152,10 +2157,19 @@
+ fi
+ for deplib in $libs; do
+ lib=
+ found=no
+ case $deplib in
++ -Wl,--as-needed|-Wl,--no-as-needed)
++ if test "$linkmode,$pass" = "prog,link"; then
++ compile_deplibs="$deplib $compile_deplibs"
++ finalize_deplibs="$deplib $finalize_deplibs"
++ else
++ deplibs="$deplib $deplibs"
++ fi
++ continue
++ ;;
+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
diff --git a/eclass/ELT-patches/as-needed/2.2.6 b/eclass/ELT-patches/as-needed/2.2.6
new file mode 100644
index 00000000000..7e71de4618d
--- /dev/null
+++ b/eclass/ELT-patches/as-needed/2.2.6
@@ -0,0 +1,38 @@
+--- ltmain.sh.orig 2009-04-18 14:37:16.000000000 +0200
++++ ltmain.sh 2009-04-18 14:40:08.000000000 +0200
+@@ -4721,10 +4721,15 @@
+ IFS="$save_ifs"
+ func_stripname ' ' '' "$arg"
+ arg=$func_stripname_result
+ ;;
+
++ -Wl,--as-needed|-Wl,--no-as-needed)
++ deplibs="$deplibs $arg"
++ continue
++ ;;
++
+ -Wl,*)
+ func_stripname '-Wl,' '' "$arg"
+ args=$func_stripname_result
+ arg=
+ save_ifs="$IFS"; IFS=','
+@@ -5075,10 +5080,19 @@
+
+ for deplib in $libs; do
+ lib=
+ found=no
+ case $deplib in
++ -Wl,--as-needed|-Wl,--no-as-needed)
++ if test "$linkmode,$pass" = "prog,link"; then
++ compile_deplibs="$deplib $compile_deplibs"
++ finalize_deplibs="$deplib $finalize_deplibs"
++ else
++ deplibs="$deplib $deplibs"
++ fi
++ continue
++ ;;
+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
diff --git a/eclass/ELT-patches/as-needed/2.4.2 b/eclass/ELT-patches/as-needed/2.4.2
new file mode 100644
index 00000000000..526877a6d35
--- /dev/null
+++ b/eclass/ELT-patches/as-needed/2.4.2
@@ -0,0 +1,38 @@
+--- ltmain.sh.orig 2012-08-19 10:18:57.929178597 +0200
++++ ltmain.sh 2012-08-19 10:31:43.409388998 +0200
+@@ -5798,10 +5798,15 @@
+ IFS="$save_ifs"
+ func_stripname ' ' '' "$arg"
+ arg=$func_stripname_result
+ ;;
+
++ -Wl,--as-needed|-Wl,--no-as-needed)
++ deplibs="$deplibs $arg"
++ continue
++ ;;
++
+ -Wl,*)
+ func_stripname '-Wl,' '' "$arg"
+ args=$func_stripname_result
+ arg=
+ save_ifs="$IFS"; IFS=','
+@@ -6158,10 +6163,19 @@
+
+ for deplib in $libs; do
+ lib=
+ found=no
+ case $deplib in
++ -Wl,--as-needed|-Wl,--no-as-needed)
++ if test "$linkmode,$pass" = "prog,link"; then
++ compile_deplibs="$deplib $compile_deplibs"
++ finalize_deplibs="$deplib $finalize_deplibs"
++ else
++ deplibs="$deplib $deplibs"
++ fi
++ continue
++ ;;
+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
+ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
diff --git a/eclass/ELT-patches/cross/link-ROOT b/eclass/ELT-patches/cross/link-ROOT
new file mode 100644
index 00000000000..3c7d99be1f2
--- /dev/null
+++ b/eclass/ELT-patches/cross/link-ROOT
@@ -0,0 +1,20 @@
+--- libltdl/config/ltmain.sh 2008-09-07 19:56:33.000000000 +0200
++++ libltdl/config/ltmain.sh.new 2009-02-15 20:37:47.000000000 +0100
+@@ -5768,7 +5768,7 @@
+ test "$hardcode_direct_absolute" = no; then
+ add="$libdir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+- add_dir="-L$libdir"
++ add_dir="-L$ROOT/$libdir"
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ case :$finalize_shlibpath: in
+@@ -5785,7 +5785,7 @@
+ fi
+ else
+ # We cannot seem to hardcode it, guess we'll fake it.
+- add_dir="-L$libdir"
++ add_dir="-L$ROOT/$libdir"
+ # Try looking first in the location we're being installed to.
+ if test -n "$inst_prefix_dir"; then
+ case $libdir in
diff --git a/eclass/ELT-patches/darwin-conf/1.5 b/eclass/ELT-patches/darwin-conf/1.5
new file mode 100644
index 00000000000..46d9e5a885e
--- /dev/null
+++ b/eclass/ELT-patches/darwin-conf/1.5
@@ -0,0 +1,24 @@
+In Gentoo Prefix we go by Apple's convention to give modules the .bundle
+extension.
+http://developer.apple.com/documentation/DeveloperTools/Conceptual/XcodeBuildSystem/500-Linking/bs_linking.html
+(Above link was removed by Apple, the link below contains a copy:
+http://disanji.net/iOS_Doc/#documentation/DeveloperTools/Conceptual/XcodeBuildSystem/500-Linking/bs_linking.html,
+in case it disappears also, the relevant quote:
+
+Bundle. Bundles are executable files that can be loaded at runtime by
+other products. Plug-ins are implemented using bundles. The term bundle
+in this context refers to the binary itself, not to a structured
+hierarchy. Bundles have the .bundle extension; for example,
+MyBundle.bundle.)
+
+--- configure.orig 2009-05-22 12:05:31 +0200
++++ configure 2009-05-22 12:05:39 +0200
+@@ -15461,7 +15461,7 @@
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+- shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
++ shrext_cmds='`test .$module = .yes && echo .bundle || echo .dylib`'
+ # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+ if test "$GCC" = yes; then
+ sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
diff --git a/eclass/ELT-patches/darwin-conf/1.5b b/eclass/ELT-patches/darwin-conf/1.5b
new file mode 100644
index 00000000000..65633a81841
--- /dev/null
+++ b/eclass/ELT-patches/darwin-conf/1.5b
@@ -0,0 +1,33 @@
+In Gentoo Prefix we go by Apple's convention to give modules the .bundle
+extension.
+http://developer.apple.com/documentation/DeveloperTools/Conceptual/XcodeBuildSystem/500-Linking/bs_linking.html
+(Above link was removed by Apple, the link below contains a copy:
+http://disanji.net/iOS_Doc/#documentation/DeveloperTools/Conceptual/XcodeBuildSystem/500-Linking/bs_linking.html,
+in case it disappears also, the relevant quote:
+
+Bundle. Bundles are executable files that can be loaded at runtime by
+other products. Plug-ins are implemented using bundles. The term bundle
+in this context refers to the binary itself, not to a structured
+hierarchy. Bundles have the .bundle extension; for example,
+MyBundle.bundle.)
+
+--- configure
++++ configure
+@@ -10570,7 +10570,7 @@
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+- shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
++ shrext_cmds='`test .$module = .yes && echo .bundle || echo .dylib`'
+
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+@@ -14213,7 +14213,7 @@
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+- shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
++ shrext_cmds='`test .$module = .yes && echo .bundle || echo .dylib`'
+
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+ ;;
diff --git a/eclass/ELT-patches/darwin-conf/2.2.4 b/eclass/ELT-patches/darwin-conf/2.2.4
new file mode 100644
index 00000000000..5ad829343f7
--- /dev/null
+++ b/eclass/ELT-patches/darwin-conf/2.2.4
@@ -0,0 +1,29 @@
+In Gentoo Prefix we go by Apple's convention to give modules the .bundle
+extension.
+http://developer.apple.com/documentation/DeveloperTools/Conceptual/XcodeBuildSystem/500-Linking/bs_linking.html
+(Above link was removed by Apple, the link below contains a copy:
+http://disanji.net/iOS_Doc/#documentation/DeveloperTools/Conceptual/XcodeBuildSystem/500-Linking/bs_linking.html,
+in case it disappears also, the relevant quote:
+
+Bundle. Bundles are executable files that can be loaded at runtime by
+other products. Plug-ins are implemented using bundles. The term bundle
+in this context refers to the binary itself, not to a structured
+hierarchy. Bundles have the .bundle extension; for example,
+MyBundle.bundle.)
+
+--- configure
++++ configure
+@@ -12172,11 +12172,11 @@
+ version_type=darwin
+ need_lib_prefix=no
+ need_version=no
+- library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
++ library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+- shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
++ shrext_cmds='`test .$module = .yes && echo .bundle || echo .dylib`'
+
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
diff --git a/eclass/ELT-patches/darwin-conf/2.2.6 b/eclass/ELT-patches/darwin-conf/2.2.6
new file mode 100644
index 00000000000..669a68d09a1
--- /dev/null
+++ b/eclass/ELT-patches/darwin-conf/2.2.6
@@ -0,0 +1,43 @@
+In Gentoo Prefix we go by Apple's convention to give modules the .bundle
+extension.
+http://developer.apple.com/documentation/DeveloperTools/Conceptual/XcodeBuildSystem/500-Linking/bs_linking.html
+(Above link was removed by Apple, the link below contains a copy:
+http://disanji.net/iOS_Doc/#documentation/DeveloperTools/Conceptual/XcodeBuildSystem/500-Linking/bs_linking.html,
+in case it disappears also, the relevant quote:
+
+Bundle. Bundles are executable files that can be loaded at runtime by
+other products. Plug-ins are implemented using bundles. The term bundle
+in this context refers to the binary itself, not to a structured
+hierarchy. Bundles have the .bundle extension; for example,
+MyBundle.bundle.)
+
+--- configure
++++ configure
+@@ -11455,11 +11455,11 @@
+ version_type=darwin
+ need_lib_prefix=no
+ need_version=no
+- library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
++ library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+- shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
++ shrext_cmds='`test .$module = .yes && echo .bundle || echo .dylib`'
+
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+@@ -15321,11 +15331,11 @@
+ version_type=darwin
+ need_lib_prefix=no
+ need_version=no
+- library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
++ library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+- shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
++ shrext_cmds='`test .$module = .yes && echo .bundle || echo .dylib`'
+
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+ ;;
diff --git a/eclass/ELT-patches/darwin-ltconf/1.2.0 b/eclass/ELT-patches/darwin-ltconf/1.2.0
new file mode 100644
index 00000000000..da9f7e484db
--- /dev/null
+++ b/eclass/ELT-patches/darwin-ltconf/1.2.0
@@ -0,0 +1,66 @@
+--- ltconfig-1.2 Wed May 19 09:17:36 1999
++++ ltconfig Wed Oct 6 14:29:08 2004
+@@ -459,6 +459,11 @@
+ os2*)
+ # We can build DLLs from non-PIC.
+ ;;
++ darwin* | rhapsody*)
++ # PIC is the default on this platform
++ # Common symbols not allowed in MH_DYLIB files
++ pic_flag='-fno-common'
++ ;;
+ amigaos*)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+@@ -785,6 +790,23 @@
+ hardcode_shlibpath_var=no
+ ;;
+
++ darwin* | rhapsody*)
++ case "$host_os" in
++ rhapsody* | darwin1.[012])
++ allow_undefined_flag='-undefined suppress'
++ ;;
++ *) # Darwin 1.3 on
++ allow_undefined_flag='-flat_namespace -undefined suppress'
++ ;;
++ esac
++ archive_cmds='$nonopt $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs $linkopts $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)'
++ # We need to add '_' to the symbols in $export_symbols first
++ #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols $lib'
++ hardcode_direct=yes
++ hardcode_shlibpath_var=no
++ whole_archive_flag_spec='-all_load $convenience'
++ ;;
++
+ hpux9*)
+ archive_cmds='$rm $objdir/$soname;$LD -b +s +b $install_libdir -o $objdir/$soname$libobjs;mv $objdir/$soname $lib'
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+@@ -1134,6 +1156,27 @@
+ version_type=sunos
+ library_names_spec='${libname}${release}.so.$versuffix'
+ shlibpath_var=LD_LIBRARY_PATH
++ ;;
++
++darwin* | rhapsody*)
++ dynamic_linker="$host_os dyld"
++ version_type=darwin
++ need_lib_prefix=no
++ need_version=no
++ deplibs_check_method='file_magic Mach-O dynamically linked shared library'
++ file_magic_cmd='/usr/bin/file -L'
++ case "$host_os" in
++ rhapsody* | darwin1.[012])
++ file_magic_test_file='/System/Library/Frameworks/System.framework/System'
++ ;;
++ *) # Darwin 1.3 on
++ file_magic_test_file='/usr/lib/libSystem.dylib'
++ ;;
++ esac
++ library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)'
++ soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)'
++ shlibpath_overrides_runpath=yes
++ shlibpath_var=DYLD_LIBRARY_PATH
+ ;;
+
+ hpux9* | hpux10*)
diff --git a/eclass/ELT-patches/darwin-ltconf/1.3.0 b/eclass/ELT-patches/darwin-ltconf/1.3.0
new file mode 100644
index 00000000000..49ae67df411
--- /dev/null
+++ b/eclass/ELT-patches/darwin-ltconf/1.3.0
@@ -0,0 +1,67 @@
+--- ltconfig.darwin 2000-02-02 19:53:22.000000000 -0500
++++ ltconfig 2004-09-23 20:25:11.000000000 -0400
+@@ -678,6 +678,11 @@
+ cygwin* | mingw* | os2*)
+ # We can build DLLs from non-PIC.
+ ;;
++ darwin* | rhapsody*)
++ # PIC is the default on this platform
++ # Common symbols not allowed in MH_DYLIB files
++ pic_flag='-fno-common'
++ ;;
+ amigaos*)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+@@ -1361,6 +1372,23 @@
+ hardcode_shlibpath_var=no
+ ;;
+
++ darwin* | rhapsody*)
++ case "$host_os" in
++ rhapsody* | darwin1.[012])
++ allow_undefined_flag='-undefined suppress'
++ ;;
++ *) # Darwin 1.3 on
++ allow_undefined_flag='-flat_namespace -undefined suppress'
++ ;;
++ esac
++ archive_cmds='$nonopt $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs $linkopts $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)'
++ # We need to add '_' to the symbols in $export_symbols first
++ #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols $lib'
++ hardcode_direct=yes
++ hardcode_shlibpath_var=no
++ whole_archive_flag_spec='-all_load $convenience'
++ ;;
++
+ hpux9* | hpux10* | hpux11*)
+ case "$host_os" in
+ hpux9*) archive_cmds='$rm $objdir/$soname~$LD -b +b $install_libdir -o $objdir/$soname $libobjs $deplibs $linkopts~test $objdir/$soname = $lib || mv $objdir/$soname $lib' ;;
+@@ -1897,6 +1931,27 @@
+ esac
+ ;;
+
++darwin* | rhapsody*)
++ dynamic_linker="$host_os dyld"
++ version_type=darwin
++ need_lib_prefix=no
++ need_version=no
++ deplibs_check_method='file_magic Mach-O dynamically linked shared library'
++ file_magic_cmd='/usr/bin/file -L'
++ case "$host_os" in
++ rhapsody* | darwin1.[012])
++ file_magic_test_file='/System/Library/Frameworks/System.framework/System'
++ ;;
++ *) # Darwin 1.3 on
++ file_magic_test_file='/usr/lib/libSystem.dylib'
++ ;;
++ esac
++ library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)'
++ soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)'
++ shlibpath_overrides_runpath=yes
++ shlibpath_var=DYLD_LIBRARY_PATH
++ ;;
++
+ gnu*)
+ version_type=linux
+ need_lib_prefix=no
+
diff --git a/eclass/ELT-patches/darwin-ltmain/1.2.0 b/eclass/ELT-patches/darwin-ltmain/1.2.0
new file mode 100644
index 00000000000..aaab86a7233
--- /dev/null
+++ b/eclass/ELT-patches/darwin-ltmain/1.2.0
@@ -0,0 +1,40 @@
+--- ltmain.sh-1.2 Wed May 19 09:17:36 1999
++++ ltmain.sh Wed Oct 6 14:38:37 2004
+@@ -967,6 +967,16 @@
+ versuffix="$current.$revision"
+ ;;
+
++ darwin)
++ # Like Linux, but with the current version available in
++ # verstring for coding it into the library header
++ major=.`expr $current - $age`
++ versuffix="$major.$age.$revision"
++ # Darwin ld doesn't like 0 for these options...
++ minor_current=`expr $current + 1`
++ verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
++ ;;
++
+ *)
+ $echo "$modename: unknown library version type \`$version_type'" 1>&2
+ echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+@@ -1000,9 +1010,17 @@
+ allow_undefined_flag="$no_undefined_flag"
+ fi
+
+- # Add libc to deplibs on all systems.
+- dependency_libs="$deplibs"
+- deplibs="$deplibs -lc"
++ case "$version_type" in
++ rhapsody|darwin)
++ # Rhapsody C library is in the System framework
++ deplibs="$deplibs -framework System"
++ ;;
++ *)
++ # Add libc to deplibs on all other systems.
++ dependency_libs="$deplibs"
++ deplibs="$deplibs -lc"
++ ;;
++ esac
+
+ if test "$build_libtool_libs" = yes; then
+ # Get the real and link names of the library.
diff --git a/eclass/ELT-patches/darwin-ltmain/1.3.0 b/eclass/ELT-patches/darwin-ltmain/1.3.0
new file mode 100644
index 00000000000..7148efb9932
--- /dev/null
+++ b/eclass/ELT-patches/darwin-ltmain/1.3.0
@@ -0,0 +1,64 @@
+--- ltmain.sh.darwin 2000-02-02 19:53:22.000000000 -0500
++++ ltmain.sh 2004-09-23 20:25:11.000000000 -0400
+@@ -24,6 +24,8 @@
+ # configuration script generated by Autoconf, you may include it under
+ # the same distribution terms that you use for the rest of that program.
+
++_S_=${LIBTOOL_CMD_SEP-\~}
++
+ # Check that we have a working $echo.
+ if test "X$1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+@@ -1079,6 +1079,11 @@
+ # These systems don't actually have c library (as such)
+ continue
+ ;;
++ *-*-rhapsody* | *-*-darwin1.[012])
++ # Rhapsody C library is in the System framework
++ deplibs="$deplibs -framework System"
++ continue
++ ;;
+ esac
+ elif test "$arg" = "-lm"; then
+ case "$host" in
+@@ -1086,6 +1091,11 @@
+ # These systems don't actually have math library (as such)
+ continue
+ ;;
++ *-*-rhapsody* | *-*-darwin1.[012])
++ # Rhapsody math library is in the System framework
++ deplibs="$deplibs -framework System"
++ continue
++ ;;
+ esac
+ fi
+ deplibs="$deplibs $arg"
+@@ -1753,6 +1763,16 @@
+ versuffix="-$major-$age-$revision"
+ ;;
+
++ darwin)
++ # Like Linux, but with the current version available in
++ # verstring for coding it into the library header
++ major=.`expr $current - $age`
++ versuffix="$major.$age.$revision"
++ # Darwin ld doesn't like 0 for these options...
++ minor_current=`expr $current + 1`
++ verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
++ ;;
++
+ *)
+ $echo "$modename: unknown library version type \`$version_type'" 1>&2
+ echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+@@ -1795,6 +1824,10 @@
+ *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
+ # these systems don't actually have a c library (as such)!
+ ;;
++ *-*-rhapsody* | *-*-darwin1.[012])
++ # Rhapsody C library is in the System framework
++ deplibs="$deplibs -framework System"
++ ;;
+ *)
+ # Add libc to deplibs on all other systems.
+ deplibs="$deplibs -lc"
+
diff --git a/eclass/ELT-patches/deplibs/1.5 b/eclass/ELT-patches/deplibs/1.5
new file mode 100644
index 00000000000..36c507ade3f
--- /dev/null
+++ b/eclass/ELT-patches/deplibs/1.5
@@ -0,0 +1,18 @@
+--- libtool.orig 2009-07-15 16:25:32 +0200
++++ libtool 2009-07-15 16:51:56 +0200
+@@ -3319,7 +3319,14 @@
+ ;;
+ esac
+ if grep "^installed=no" $deplib > /dev/null; then
+- path="$absdir/$objdir"
++ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
++ eval library_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
++ for library_name in ${library_names}; do :; done
++ if test $mode = relink && test -f "${inst_prefix_dir}${libdir}/${library_name}"; then
++ path="${inst_prefix_dir}${libdir}"
++ else
++ path="$absdir/$objdir"
++ fi
+ else
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+ if test -z "$libdir"; then
diff --git a/eclass/ELT-patches/deplibs/2.1b b/eclass/ELT-patches/deplibs/2.1b
new file mode 100644
index 00000000000..3df590df7f6
--- /dev/null
+++ b/eclass/ELT-patches/deplibs/2.1b
@@ -0,0 +1,18 @@
+--- ltmain-release-2-1b.in 2009-06-22 15:33:26.000000000 +0200
++++ ltmain-release-2-1b.in.new 2009-07-15 16:59:45.000000000 +0200
+@@ -4946,7 +4946,14 @@
+ fi
+ ;;
+ *)
+- path="-L$absdir/$objdir"
++ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
++ eval library_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
++ for library_name in ${library_names}; do :; done
++ if test $mode = relink && test -f "${inst_prefix_dir}${libdir}/${library_name}"; then
++ path="-L${inst_prefix_dir}${libdir}"
++ else
++ path="-L$absdir/$objdir"
++ fi
+ ;;
+ esac
+ else
diff --git a/eclass/ELT-patches/fbsd-conf/00broken-libglade b/eclass/ELT-patches/fbsd-conf/00broken-libglade
new file mode 100644
index 00000000000..df3c4384c44
--- /dev/null
+++ b/eclass/ELT-patches/fbsd-conf/00broken-libglade
@@ -0,0 +1,33 @@
+Index: tiff-3.8.2/configure
+===================================================================
+--- tiff-3.8.2.orig/configure
++++ tiff-3.8.2/configure
+@@ -8199,7 +8199,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}'
+@@ -8210,6 +8216,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 \ No newline at end of file
diff --git a/eclass/ELT-patches/fbsd-conf/1.4.0 b/eclass/ELT-patches/fbsd-conf/1.4.0
new file mode 100644
index 00000000000..b986f8d8f51
--- /dev/null
+++ b/eclass/ELT-patches/fbsd-conf/1.4.0
@@ -0,0 +1,32 @@
+Index: expat-1.95.8/configure
+===================================================================
+--- expat-1.95.8.orig/configure
++++ expat-1.95.8/configure
+@@ -5479,7 +5479,13 @@ freebsd1*)
+
+ freebsd*)
+ objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+- version_type=freebsd-$objformat
++ case $host_vendor in
++ gentoo)
++ version_type=linux ;;
++ *)
++ version_type=freebsd-$objformat ;;
++ esac
++
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
+@@ -5490,6 +5496,12 @@ freebsd*)
+ library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix'
+ need_version=yes
+ ;;
++ linux)
++ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}.so'
++ soname_spec='${libname}${release}.so$major'
++ need_lib_prefix=no
++ need_version=no
++ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
diff --git a/eclass/ELT-patches/fbsd-conf/1.5.10 b/eclass/ELT-patches/fbsd-conf/1.5.10
new file mode 100644
index 00000000000..90c63475bcc
--- /dev/null
+++ b/eclass/ELT-patches/fbsd-conf/1.5.10
@@ -0,0 +1,120 @@
+Index: libiconv-1.10/configure
+===================================================================
+--- libiconv-1.10.orig/configure
++++ libiconv-1.10/configure
+@@ -8902,7 +8902,14 @@ kfreebsd*-gnu)
+
+ freebsd*)
+ objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+- version_type=freebsd-$objformat
++ # Gentoo/FreeBSD uses linux-style versioning to be user-friendly.
++ 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}'
+@@ -8913,6 +8920,12 @@ freebsd*)
+ 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
+@@ -12620,7 +12633,14 @@ kfreebsd*-gnu)
+
+ freebsd*)
+ objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+- version_type=freebsd-$objformat
++ # Gentoo/FreeBSD uses linux-style versioning to be user-friendly.
++ 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}'
+@@ -12631,6 +12651,12 @@ freebsd*)
+ 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
+@@ -15784,7 +15810,14 @@ kfreebsd*-gnu)
+
+ freebsd*)
+ objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+- version_type=freebsd-$objformat
++ # Gentoo/FreeBSD uses linux-style versioning to be user-friendly.
++ 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}'
+@@ -15795,6 +15828,12 @@ freebsd*)
+ 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
+@@ -18150,7 +18189,14 @@ kfreebsd*-gnu)
+
+ freebsd*)
+ objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+- version_type=freebsd-$objformat
++ # Gentoo/FreeBSD uses linux-style versioning to be user-friendly.
++ 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}'
+@@ -18161,6 +18207,12 @@ freebsd*)
+ 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/eclass/ELT-patches/fbsd-conf/1.5.18 b/eclass/ELT-patches/fbsd-conf/1.5.18
new file mode 100644
index 00000000000..0636cebfcfa
--- /dev/null
+++ b/eclass/ELT-patches/fbsd-conf/1.5.18
@@ -0,0 +1,116 @@
+Index: libtool-1.5.18/configure
+===================================================================
+--- libtool-1.5.18.orig/configure
++++ libtool-1.5.18/configure
+@@ -8433,7 +8433,13 @@ freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+- version_type=freebsd-$objformat
++ 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}'
+@@ -8444,6 +8450,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
+@@ -12205,7 +12217,13 @@ freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+- version_type=freebsd-$objformat
++ 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}'
+@@ -12216,6 +12234,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
+@@ -15461,7 +15485,13 @@ freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+- version_type=freebsd-$objformat
++ 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}'
+@@ -15472,6 +15502,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
+@@ -17929,7 +17965,13 @@ freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+- version_type=freebsd-$objformat
++ 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}'
+@@ -17940,6 +17982,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/eclass/ELT-patches/fbsd-conf/1.5.20 b/eclass/ELT-patches/fbsd-conf/1.5.20
new file mode 100644
index 00000000000..e17920f8f80
--- /dev/null
+++ b/eclass/ELT-patches/fbsd-conf/1.5.20
@@ -0,0 +1,116 @@
+Index: libtool-1.5.20/configure
+===================================================================
+--- libtool-1.5.20.orig/configure
++++ libtool-1.5.20/configure
+@@ -8441,7 +8441,13 @@ freebsd* | dragonfly*)
+ *) objformat=elf ;;
+ esac
+ fi
+- version_type=freebsd-$objformat
++ 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}'
+@@ -8452,6 +8458,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
+@@ -12228,7 +12240,13 @@ freebsd* | dragonfly*)
+ *) objformat=elf ;;
+ esac
+ fi
+- version_type=freebsd-$objformat
++ 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}'
+@@ -12239,6 +12257,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
+@@ -15492,7 +15516,13 @@ freebsd* | dragonfly*)
+ *) objformat=elf ;;
+ esac
+ fi
+- version_type=freebsd-$objformat
++ 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}'
+@@ -15503,6 +15533,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
+@@ -17968,7 +18004,13 @@ freebsd* | dragonfly*)
+ *) objformat=elf ;;
+ esac
+ fi
+- version_type=freebsd-$objformat
++ 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}'
+@@ -17979,6 +18021,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/eclass/ELT-patches/fbsd-conf/1.5.20b b/eclass/ELT-patches/fbsd-conf/1.5.20b
new file mode 100644
index 00000000000..0659b1c3cb5
--- /dev/null
+++ b/eclass/ELT-patches/fbsd-conf/1.5.20b
@@ -0,0 +1,61 @@
+Index: tiff-3.8.2/configure
+===================================================================
+--- tiff-3.8.2.orig/configure
++++ tiff-3.8.2/configure
+@@ -8199,7 +8199,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}'
+@@ -8210,6 +8216,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
+@@ -19253,7 +19265,13 @@ freebsd* | dragonfly*)
+ *) objformat=elf ;;
+ esac
+ fi
+- version_type=freebsd-$objformat
++ 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}'
+@@ -19264,6 +19282,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/eclass/ELT-patches/fbsd-conf/1.9f b/eclass/ELT-patches/fbsd-conf/1.9f
new file mode 100644
index 00000000000..f16ddb874c1
--- /dev/null
+++ b/eclass/ELT-patches/fbsd-conf/1.9f
@@ -0,0 +1,60 @@
+Index: libtorrent-0.10.0/configure
+===================================================================
+--- libtorrent-0.10.0.orig/configure
++++ libtorrent-0.10.0/configure
+@@ -8173,7 +8173,13 @@ kfreebsd*-gnu)
+
+ freebsd*)
+ objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || $ECHO aout`
+- version_type=freebsd-$objformat
++ 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}'
+@@ -8184,6 +8190,12 @@ freebsd*)
+ 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
+@@ -12461,7 +12473,13 @@ kfreebsd*-gnu)
+
+ freebsd*)
+ objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || $ECHO aout`
+- version_type=freebsd-$objformat
++ 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}'
+@@ -12472,6 +12490,12 @@ freebsd*)
+ 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/eclass/ELT-patches/fbsd-ltconf/1.2.0 b/eclass/ELT-patches/fbsd-ltconf/1.2.0
new file mode 100644
index 00000000000..7d2f554f253
--- /dev/null
+++ b/eclass/ELT-patches/fbsd-ltconf/1.2.0
@@ -0,0 +1,26 @@
+Index: jpeg-6b/ltconfig
+===================================================================
+--- jpeg-6b.orig/ltconfig
++++ jpeg-6b/ltconfig
+@@ -1126,9 +1126,18 @@ amigaos*)
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done'
+ ;;
+
+-freebsd2* | freebsd3*)
+- version_type=sunos
+- library_names_spec='${libname}${release}.so.$versuffix $libname.so'
++freebsd[234567]*)
++ case $host_vendor in
++ gentoo)
++ version_type=linux
++ library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major ${libname}.so'
++ soname_spec='${libname}${release}.so.$major'
++ ;;
++ *)
++ version_type=sunos
++ library_names_spec='${libname}${release}.so.$versuffix $libname.so'
++ ;;
++ esac
+ finish_cmds='PATH="$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
diff --git a/eclass/ELT-patches/fbsd-ltconf/1.3.0 b/eclass/ELT-patches/fbsd-ltconf/1.3.0
new file mode 100644
index 00000000000..69aa94e678f
--- /dev/null
+++ b/eclass/ELT-patches/fbsd-ltconf/1.3.0
@@ -0,0 +1,32 @@
+Index: libtool-1.3.5/ltconfig
+===================================================================
+--- libtool-1.3.5.orig/ltconfig
++++ libtool-1.3.5/ltconfig
+@@ -1888,7 +1888,13 @@ freebsd1*)
+
+ freebsd*)
+ objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+- version_type=freebsd-$objformat
++ case $host_vendor in
++ gentoo)
++ version_type=linux ;;
++ *)
++ version_type=freebsd-$objformat ;;
++ esac
++
+ case "$version_type" in
+ freebsd-elf*)
+ deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'
+@@ -1903,6 +1909,12 @@ freebsd*)
+ library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix'
+ need_version=yes
+ ;;
++ linux)
++ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}.so'
++ soname_spec='${libname}${release}.so$major'
++ need_lib_prefix=no
++ need_version=no
++ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case "$host_os" in
diff --git a/eclass/ELT-patches/fbsd-ltconf/1.4a b/eclass/ELT-patches/fbsd-ltconf/1.4a
new file mode 100644
index 00000000000..00084070dfb
--- /dev/null
+++ b/eclass/ELT-patches/fbsd-ltconf/1.4a
@@ -0,0 +1,32 @@
+Index: binutils-2.16.1/ltconfig
+===================================================================
+--- binutils-2.16.1.orig/ltconfig
++++ binutils-2.16.1/ltconfig
+@@ -1129,7 +1129,13 @@ freebsd1*)
+
+ freebsd*)
+ objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+- version_type=freebsd-$objformat
++ case $host_vendor in
++ gentoo)
++ version_type=linux ;;
++ *)
++ version_type=freebsd-$objformat ;;
++ esac
++
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
+@@ -1141,6 +1147,12 @@ freebsd*)
+ library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix'
+ need_version=yes
+ ;;
++ linux)
++ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}.so'
++ soname_spec='${libname}${release}.so$major'
++ need_lib_prefix=no
++ need_version=no
++ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
diff --git a/eclass/ELT-patches/fbsd-ltconf/1.4a-GCC3.0 b/eclass/ELT-patches/fbsd-ltconf/1.4a-GCC3.0
new file mode 100644
index 00000000000..e88bb4582ae
--- /dev/null
+++ b/eclass/ELT-patches/fbsd-ltconf/1.4a-GCC3.0
@@ -0,0 +1,32 @@
+Index: binutils-2.16.1/ltconfig
+===================================================================
+--- binutils-2.16.1.orig/ltconfig
++++ binutils-2.16.1/ltconfig
+@@ -1129,7 +1129,13 @@ freebsd1*)
+
+ freebsd*)
+ objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
+- version_type=freebsd-$objformat
++ case $host_vendor in
++ gentoo)
++ version_type=linux ;;
++ *)
++ version_type=freebsd-$objformat ;;
++ esac
++
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
+@@ -1141,6 +1147,12 @@ freebsd*)
+ library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix'
+ need_version=yes
+ ;;
++ linux)
++ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}.so'
++ soname_spec='${libname}${release}.so$major'
++ need_lib_prefix=no
++ need_version=no
++ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
diff --git a/eclass/ELT-patches/fix-relink/1.4.0 b/eclass/ELT-patches/fix-relink/1.4.0
new file mode 100644
index 00000000000..1b12c9b1a36
--- /dev/null
+++ b/eclass/ELT-patches/fix-relink/1.4.0
@@ -0,0 +1,63 @@
+--- ltmain.sh 2003-09-24 18:22:17.528129376 +0200
++++ ltmain.sh 2003-09-24 18:23:17.101072912 +0200
+@@ -1582,6 +1582,8 @@
+ # Only check for convenience libraries
+ deplibs="$lib $deplibs"
+ tmp_libs=
++ # PKGW
++ dependency_libs=
+ for deplib in $dependency_libs; do
+ #echo "Adding $deplib to \$deplibs"
+ deplibs="$deplib $deplibs"
+@@ -1699,6 +1701,8 @@
+ fi
+
+ tmp_libs=
++ #PKGW
++ dependency_libs=
+ for deplib in $dependency_libs; do
+ case $deplib in
+ -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
+@@ -1860,6 +1864,16 @@
+ add="$dir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ add_dir="-L$dir"
++ # Try looking first in the location we're being installed to.
++ if test -n "$inst_prefix_dir"; then
++ case "$libdir" in
++ [\\/]*)
++ # Add the install location to the beginning, minimising possiblilty
++ # of linking to older version of the lib already installed.
++ add_dir="-L$inst_prefix_dir$libdir $add_dir"
++ ;;
++ esac
++ fi
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ add_shlibpath="$dir"
+@@ -1918,6 +1932,16 @@
+ else
+ # We cannot seem to hardcode it, guess we'll fake it.
+ add_dir="-L$libdir"
++ # Try looking first in the location we're being installed to.
++ if test -n "$inst_prefix_dir"; then
++ case "$libdir" in
++ [\\/]*)
++ # Add the install location to the beginning, minimising possiblilty
++ # of linking to older version of the lib already installed.
++ add_dir="-L$inst_prefix_dir$libdir $add_dir"
++ ;;
++ esac
++ fi
+ add="-l$name"
+ fi
+
+@@ -2117,7 +2141,7 @@
+ -L*)
+ case " $tmp_libs " in
+ *" $deplib "*) ;;
+- *) tmp_libs="$tmp_libs $deplib" ;;
++ *) tmp_libs="$deplib $tmp_libs" ;;
+ esac
+ ;;
+ *) tmp_libs="$tmp_libs $deplib" ;;
diff --git a/eclass/ELT-patches/fix-relink/1.4.3 b/eclass/ELT-patches/fix-relink/1.4.3
new file mode 100644
index 00000000000..959fe1dd76f
--- /dev/null
+++ b/eclass/ELT-patches/fix-relink/1.4.3
@@ -0,0 +1,62 @@
+--- ltmain.sh 2003-09-24 19:48:39.367370072 +0200
++++ ltmain.sh 2003-09-24 19:49:31.773403144 +0200
+@@ -1593,6 +1593,8 @@
+ convenience="$convenience $ladir/$objdir/$old_library"
+ old_convenience="$old_convenience $ladir/$objdir/$old_library"
+ tmp_libs=
++ # PKGW
++ dependency_libs=
+ for deplib in $dependency_libs; do
+ deplibs="$deplib $deplibs"
+ if test "X$duplicate_deps" = "Xyes" ; then
+@@ -1710,6 +1712,8 @@
+ fi
+
+ tmp_libs=
++ #PKGW
++ dependency_libs=
+ for deplib in $dependency_libs; do
+ case $deplib in
+ -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
+@@ -1871,6 +1875,16 @@
+ add="$dir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ add_dir="-L$dir"
++ # Try looking first in the location we're being installed to.
++ if test -n "$inst_prefix_dir"; then
++ case "$libdir" in
++ [\\/]*)
++ # Add the install location to the beginning, minimising possiblilty
++ # of linking to older version of the lib already installed.
++ add_dir="-L$inst_prefix_dir$libdir $add_dir"
++ ;;
++ esac
++ fi
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ add_shlibpath="$dir"
+@@ -1938,11 +1952,13 @@
+ else
+ # We cannot seem to hardcode it, guess we'll fake it.
+ # Try looking first in the location we're being installed to.
+- add_dir=
++ add_dir="-L$dir"
+ if test -n "$inst_prefix_dir"; then
+ case "$libdir" in
+ [\\/]*)
+- add_dir="-L$inst_prefix_dir$libdir"
++ # Add the install location to the beginning, minimising possiblilty
++ # of linking to older version of the lib already installed.
++ add_dir="-L$inst_prefix_dir$libdir $add_dir"
+ ;;
+ esac
+ fi
+@@ -2146,7 +2162,7 @@
+ -L*)
+ case " $tmp_libs " in
+ *" $deplib "*) ;;
+- *) tmp_libs="$tmp_libs $deplib" ;;
++ *) tmp_libs="$deplib $tmp_libs" ;;
+ esac
+ ;;
+ *) tmp_libs="$tmp_libs $deplib" ;;
diff --git a/eclass/ELT-patches/fix-relink/1.5.0 b/eclass/ELT-patches/fix-relink/1.5.0
new file mode 100644
index 00000000000..29b7db7b1dd
--- /dev/null
+++ b/eclass/ELT-patches/fix-relink/1.5.0
@@ -0,0 +1,51 @@
+--- ltmain.sh 2003-09-24 18:18:14.961005184 +0200
++++ ltmain.sh 2003-09-24 18:20:11.204333512 +0200
+@@ -2022,6 +2022,8 @@
+ convenience="$convenience $ladir/$objdir/$old_library"
+ old_convenience="$old_convenience $ladir/$objdir/$old_library"
+ tmp_libs=
++ # PKGW
++ dependency_libs=
+ for deplib in $dependency_libs; do
+ deplibs="$deplib $deplibs"
+ if test "X$duplicate_deps" = "Xyes" ; then
+@@ -2143,6 +2145,8 @@
+ fi
+
+ tmp_libs=
++ #PKGW
++ dependency_libs=
+ for deplib in $dependency_libs; do
+ case $deplib in
+ -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
+@@ -2359,7 +2363,9 @@
+ if test -n "$inst_prefix_dir"; then
+ case "$libdir" in
+ [\\/]*)
+- add_dir="$add_dir -L$inst_prefix_dir$libdir"
++ # Add the install location to the beginning, minimising possiblilty
++ # of linking to older version of the lib already installed.
++ add_dir="-L$inst_prefix_dir$libdir $add_dir"
+ ;;
+ esac
+ fi
+@@ -2431,7 +2437,9 @@
+ if test -n "$inst_prefix_dir"; then
+ case "$libdir" in
+ [\\/]*)
+- add_dir="$add_dir -L$inst_prefix_dir$libdir"
++ # Add the install location to the beginning, minimising possiblilty
++ # of linking to older version of the lib already installed.
++ add_dir="-L$inst_prefix_dir$libdir $add_dir"
+ ;;
+ esac
+ fi
+@@ -2691,7 +2699,7 @@
+ -L*)
+ case " $tmp_libs " in
+ *" $deplib "*) ;;
+- *) tmp_libs="$tmp_libs $deplib" ;;
++ *) tmp_libs="$deplib $tmp_libs" ;;
+ esac
+ ;;
+ *) tmp_libs="$tmp_libs $deplib" ;;
diff --git a/eclass/ELT-patches/gold-conf/2.2.6 b/eclass/ELT-patches/gold-conf/2.2.6
new file mode 100644
index 00000000000..048cbad0118
--- /dev/null
+++ b/eclass/ELT-patches/gold-conf/2.2.6
@@ -0,0 +1,10 @@
+--- configure.orig
++++ configure
+@@ -9933,6 +9933,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
+ fi
+ supports_anon_versioning=no
+ case `$LD -v 2>&1` in
++ *GNU\ gold*) supports_anon_versioning=yes ;;
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
diff --git a/eclass/ELT-patches/hardcode-relink/1.3d b/eclass/ELT-patches/hardcode-relink/1.3d
new file mode 100644
index 00000000000..dc7819f447e
--- /dev/null
+++ b/eclass/ELT-patches/hardcode-relink/1.3d
@@ -0,0 +1,8 @@
+--- ltmain.sh
++++ ltmain.sh
+@@ -2208,4 +2208,4 @@
+ relink)
+- if test "$hardcode_direct" = yes; then
++ if false && test "$hardcode_direct" = yes; then
+ add="$dir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
diff --git a/eclass/ELT-patches/hardcode/1.3d b/eclass/ELT-patches/hardcode/1.3d
new file mode 100644
index 00000000000..7408b372aec
--- /dev/null
+++ b/eclass/ELT-patches/hardcode/1.3d
@@ -0,0 +1,21 @@
+http://lists.gnu.org/archive/html/bug-libtool/2008-03/msg00124.html
+
+but this patch disables hardcoding independent of inst_prefix_dir at all,
+for both hardcode_direct=yes and hardcode_minus_L=yes.
+
+If you update this patch, please also update libtool/files/libtool-1.3d-hardcode.patch
+
+--- ltmain.in.orig 2008-04-16 15:54:04.000000000 +0200
++++ ltmain.in 2008-04-16 16:21:04.000000000 +0200
+@@ -1900,9 +1900,9 @@
+ add_dir=
+ add=
+ # Finalize command for both is simple: just hardcode it.
+- if test "$hardcode_direct" = yes; then
++ if false && test "$hardcode_direct" = yes; then
+ add="$libdir/$linklib"
+- elif test "$hardcode_minus_L" = yes; then
++ elif false && test "$hardcode_minus_L" = yes; then
+ add_dir="-L$libdir"
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
diff --git a/eclass/ELT-patches/hardcode/2.1b b/eclass/ELT-patches/hardcode/2.1b
new file mode 100644
index 00000000000..48571f39379
--- /dev/null
+++ b/eclass/ELT-patches/hardcode/2.1b
@@ -0,0 +1,36 @@
+Hardcoding library path does not work with DESTDIR installs.
+
+Affects any platform with 'hardcode_direct=yes' or 'hardcode_minus_L=yes'.
+According to libtool.m4 (as of libtool-1.5.26), these are:
+ *-aix*
+ *-hpux9
+ hppa-hpux* (not hppa64 or ia64)
+ *-netbsd
+ *-openbsd
+ *-freebsd
+ *-dragonfly
+ *-newsos6
+ *-os2
+ *-amigaos
+ *-sunos4
+ *-sysv4
+It definitely is required for aix (to support DESTDIR),
+although it should help for others too...
+
+--- ../../libtool.orig 2009-07-16 18:06:59 +0200
++++ ../../libtool 2009-07-16 18:07:45 +0200
+@@ -6298,13 +6298,13 @@
+ add_dir=
+ add=
+ # Finalize command for both is simple: just hardcode it.
+ if test "$hardcode_direct" = yes &&
+ test "$hardcode_direct_absolute" = no; then
+ add="$libdir/$linklib"
+- elif test "$hardcode_minus_L" = yes; then
++ elif false && test "$hardcode_minus_L" = yes; then
+ add_dir="-L$libdir"
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ case :$finalize_shlibpath: in
+ *":$libdir:"*) ;;
+ *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
diff --git a/eclass/ELT-patches/hc-flag-ld/1.5 b/eclass/ELT-patches/hc-flag-ld/1.5
new file mode 100644
index 00000000000..bf88873c8f1
--- /dev/null
+++ b/eclass/ELT-patches/hc-flag-ld/1.5
@@ -0,0 +1,18 @@
+http://lists.gnu.org/archive/html/libtool/2006-01/msg00012.html
+
+--- ltmain.sh.orig 2007-11-19 17:07:34.946648000 +0100
++++ ltmain.sh 2007-11-19 17:07:57.785975000 +0100
+@@ -3915,8 +3915,11 @@
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ if test -n "$hardcode_libdir_flag_spec_ld"; then
+- eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
+- else
++ case $archive_cmds in
++ *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
++ *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
++ esac
++ else
+ eval dep_rpath=\"$hardcode_libdir_flag_spec\"
+ fi
+ fi
diff --git a/eclass/ELT-patches/hpux-conf/1.5.22-syslibpath b/eclass/ELT-patches/hpux-conf/1.5.22-syslibpath
new file mode 100644
index 00000000000..27fef4873ea
--- /dev/null
+++ b/eclass/ELT-patches/hpux-conf/1.5.22-syslibpath
@@ -0,0 +1,24 @@
+must not search /usr/local in prefix
+
+--- configure.orig 2007-12-02 19:14:55 +0100
++++ configure 2007-12-02 19:14:59 +0100
+@@ -8920,9 +8920,17 @@
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ if test "X$HPUX_IA64_MODE" = X32; then
+- sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
++ if test "$GCC" = yes; then
++ sys_lib_search_path_spec="${sys_lib_search_path_spec} /usr/lib/hpux32"
++ else
++ sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
++ fi
+ else
+- sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
++ if test "$GCC" = yes; then
++ sys_lib_search_path_spec="${sys_lib_search_path_spec} /usr/lib/hpux64"
++ else
++ sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
++ fi
+ fi
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
diff --git a/eclass/ELT-patches/install-sh/1.5 b/eclass/ELT-patches/install-sh/1.5
new file mode 100644
index 00000000000..1b8b20bebda
--- /dev/null
+++ b/eclass/ELT-patches/install-sh/1.5
@@ -0,0 +1,14 @@
+--- install-sh 2007-07-04 14:36:49 +0100
++++ install-sh 2007-09-14 11:00:41 +0100
+@@ -192,7 +192,10 @@
+
+ if [ x"$dir_arg" != x ]
+ then
+- $doit $instcmd $dst &&
++ { $doit $instcmd "$dst" || lasterr=$?
++ # It's ok for mkdir to fail if the directory already exists.
++ test -d "$dst" || { (exit ${lasterr-1}); exit; }
++ } &&
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi &&
diff --git a/eclass/ELT-patches/install-sh/1.5.4 b/eclass/ELT-patches/install-sh/1.5.4
new file mode 100644
index 00000000000..0b1c22043bf
--- /dev/null
+++ b/eclass/ELT-patches/install-sh/1.5.4
@@ -0,0 +1,14 @@
+--- install-sh 2006-03-25 20:04:46 +0000
++++ install-sh 2007-09-14 10:53:29 +0100
+@@ -246,7 +246,10 @@
+ fi
+
+ if test -n "$dir_arg"; then
+- $doit $mkdircmd "$dst" \
++ { $doit $mkdircmd "$dst" || lasterr=$?
++ # It's ok for mkdir to fail if the directory already exists.
++ test -d "$dst" || { (exit ${lasterr-1}); exit; }
++ } \
+ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
+ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
+ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
diff --git a/eclass/ELT-patches/install-sh/1.5.6 b/eclass/ELT-patches/install-sh/1.5.6
new file mode 100644
index 00000000000..d107740d1b2
--- /dev/null
+++ b/eclass/ELT-patches/install-sh/1.5.6
@@ -0,0 +1,14 @@
+--- install-sh 2006-03-14 12:57:54 -0300
++++ install-sh 2008-06-19 22:23:04 -0300
+@@ -240,7 +240,10 @@
+ fi
+
+ if test -n "$dir_arg"; then
+- $doit $instcmd "$dst" \
++ { $doit $instcmd "$dst" || lasterr=$?
++ # It's ok for mkdir to fail if the directory already exists.
++ test -d "$dst" || { (exit ${lasterr-1}); exit; }
++ } \
+ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
+ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
+ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
diff --git a/eclass/ELT-patches/irix-ltmain/2.2.6 b/eclass/ELT-patches/irix-ltmain/2.2.6
new file mode 100644
index 00000000000..70916377b5e
--- /dev/null
+++ b/eclass/ELT-patches/irix-ltmain/2.2.6
@@ -0,0 +1,30 @@
+I notice that $EPREFIX/usr/share/libtool/config/ltmain.sh also has this
+stray increment - so I'd assume that this is a bug in libtool (which is
+perhaps trying to fix a deprecated behaviour of old IRIX versions?).
+
+http://bugs.gentoo.org/show_bug.cgi?id=301520
+
+
+--- ltmain.sh.dist 2010-01-19 14:04:22.101603800 +0000
++++ ltmain.sh 2010-01-19 14:08:29.361500240 +0000
+@@ -6225,7 +6225,6 @@ func_mode_link ()
+ current=$func_arith_result
+ age="$number_minor"
+ revision="$number_minor"
+- lt_irix_increment=no
+ ;;
+ esac
+ ;;
+@@ -6297,11 +6296,7 @@ func_mode_link ()
+ ;;
+
+ irix | nonstopux)
+- if test "X$lt_irix_increment" = "Xno"; then
+- func_arith $current - $age
+- else
+- func_arith $current - $age + 1
+- fi
++ func_arith $current - $age
+ major=$func_arith_result
+
+ case $version_type in
diff --git a/eclass/ELT-patches/ltmain/1.5 b/eclass/ELT-patches/ltmain/1.5
new file mode 100644
index 00000000000..39abee03efa
--- /dev/null
+++ b/eclass/ELT-patches/ltmain/1.5
@@ -0,0 +1,18 @@
+--- ltmain.sh 2007-09-15 07:35:19 +0100
++++ ltmain.sh 2004-01-25 12:40:26 +0000
+@@ -1854,6 +1840,15 @@
+ lib=
+ found=no
+ case $deplib in
++ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
++ if test "$linkmode,$pass" = "prog,link"; then
++ compile_deplibs="$deplib $compile_deplibs"
++ finalize_deplibs="$deplib $finalize_deplibs"
++ else
++ deplibs="$deplib $deplibs"
++ fi
++ continue
++ ;;
+ -l*)
+ if test "$linkmode" != lib && test "$linkmode" != prog; then
+ $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
diff --git a/eclass/ELT-patches/max_cmd_len/1.5.0 b/eclass/ELT-patches/max_cmd_len/1.5.0
new file mode 100644
index 00000000000..6d5f88b5966
--- /dev/null
+++ b/eclass/ELT-patches/max_cmd_len/1.5.0
@@ -0,0 +1,33 @@
+--- ltmain.sh 2004-02-11 20:55:14.587581248 +0200
++++ ltmain.sh 2004-02-11 21:15:33.467283368 +0200
+@@ -117,6 +117,30 @@
+ execute_dlfiles=
+ lo2o="s/\\.lo\$/.${objext}/"
+ o2lo="s/\\.${objext}\$/.lo/"
++
++if test -z "$max_cmd_len"; then
++ i=0
++ testring="ABCD"
++ new_result=
++
++ # If test is not a shell built-in, we'll probably end up computing a
++ # maximum length that is only half of the actual maximum length, but
++ # we can't tell.
++ while (test "X"`$SHELL $0 --fallback-echo "X$testring" 2>/dev/null` \
++ = "XX$testring") >/dev/null 2>&1 &&
++ new_result=`expr "X$testring" : ".*" 2>&1` &&
++ max_cmd_len="$new_result" &&
++ test $i != 17 # 1/2 MB should be enough
++ do
++ i=`expr $i + 1`
++ testring="$testring$testring"
++ done
++ testring=
++ # Add a significant safety factor because C++ compilers can tack on massive
++ # amounts of additional arguments before passing them to the linker.
++ # It appears as though 1/2 is a usable value.
++ max_cmd_len=`expr $max_cmd_len \/ 2`
++fi
+
+ #####################################
+ # Shell function definitions:
diff --git a/eclass/ELT-patches/max_cmd_len/1.5.14 b/eclass/ELT-patches/max_cmd_len/1.5.14
new file mode 100644
index 00000000000..8f299e8b956
--- /dev/null
+++ b/eclass/ELT-patches/max_cmd_len/1.5.14
@@ -0,0 +1,33 @@
+--- ltmain.sh
++++ ltmain.sh
+@@ -136,6 +136,30 @@
+ lo2o="s/\\.lo\$/.${objext}/"
+ o2lo="s/\\.${objext}\$/.lo/"
+ quote_scanset='[[~#^*{};<>?'"'"' ]'
++
++if test -z "$max_cmd_len"; then
++ i=0
++ testring="ABCD"
++ new_result=
++
++ # If test is not a shell built-in, we'll probably end up computing a
++ # maximum length that is only half of the actual maximum length, but
++ # we can't tell.
++ while (test "X"`$SHELL $0 --fallback-echo "X$testring" 2>/dev/null` \
++ = "XX$testring") >/dev/null 2>&1 &&
++ new_result=`expr "X$testring" : ".*" 2>&1` &&
++ max_cmd_len="$new_result" &&
++ test "$i" != 17 # 1/2 MB should be enough
++ do
++ i=`expr $i + 1`
++ testring="$testring$testring"
++ done
++ testring=
++ # Add a significant safety factor because C++ compilers can tack on massive
++ # amounts of additional arguments before passing them to the linker.
++ # It appears as though 1/2 is a usable value.
++ max_cmd_len=`expr $max_cmd_len \/ 2`
++fi
+
+ #####################################
+ # Shell function definitions:
diff --git a/eclass/ELT-patches/max_cmd_len/1.5.20 b/eclass/ELT-patches/max_cmd_len/1.5.20
new file mode 100644
index 00000000000..76dc21364a5
--- /dev/null
+++ b/eclass/ELT-patches/max_cmd_len/1.5.20
@@ -0,0 +1,33 @@
+--- ltmain.sh
++++ ltmain.sh
+@@ -136,6 +136,30 @@
+ execute_dlfiles=
+ lo2o="s/\\.lo\$/.${objext}/"
+ o2lo="s/\\.${objext}\$/.lo/"
++
++if test -z "$max_cmd_len"; then
++ i=0
++ testring="ABCD"
++ new_result=
++
++ # If test is not a shell built-in, we'll probably end up computing a
++ # maximum length that is only half of the actual maximum length, but
++ # we can't tell.
++ while (test "X"`$SHELL $0 --fallback-echo "X$testring" 2>/dev/null` \
++ = "XX$testring") >/dev/null 2>&1 &&
++ new_result=`expr "X$testring" : ".*" 2>&1` &&
++ max_cmd_len="$new_result" &&
++ test "$i" != 17 # 1/2 MB should be enough
++ do
++ i=`expr $i + 1`
++ testring="$testring$testring"
++ done
++ testring=
++ # Add a significant safety factor because C++ compilers can tack on massive
++ # amounts of additional arguments before passing them to the linker.
++ # It appears as though 1/2 is a usable value.
++ max_cmd_len=`expr $max_cmd_len \/ 2`
++fi
+
+ #####################################
+ # Shell function definitions:
diff --git a/eclass/ELT-patches/mint-conf/2.2.6 b/eclass/ELT-patches/mint-conf/2.2.6
new file mode 100644
index 00000000000..34f2e5f28c5
--- /dev/null
+++ b/eclass/ELT-patches/mint-conf/2.2.6
@@ -0,0 +1,15 @@
+Calculating the max args here takes hours.
+
+--- configure
++++ configure
+@@ -7351,6 +7351,10 @@
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
++ mint*)
++ lt_cv_sys_max_cmd_len=8192;
++ ;;
++
+ amigaos*)
+ # On AmigaOS with pdksh, this test takes hours, literally.
+ # So we just punt and use a minimum line length of 8192.
diff --git a/eclass/ELT-patches/no-lc/1.3d b/eclass/ELT-patches/no-lc/1.3d
new file mode 100644
index 00000000000..de20b0ceed3
--- /dev/null
+++ b/eclass/ELT-patches/no-lc/1.3d
@@ -0,0 +1,13 @@
+--- release-1-3d.orig 2009-12-03 17:05:15.608916799 +0100
++++ release-1-3d 2009-12-14 22:01:06.634927600 +0100
+@@ -1035,6 +1035,10 @@
+ esac
+ elif test "$arg" = "-lm"; then
+ case $host in
++ *-*-hpux*)
++ # Compiler inserts libc in the correct place for threads to work
++ test "X$arg" = "X-lc" && continue
++ ;;
+ *-*-cygwin* | *-*-pw32* | *-*-beos*)
+ # These systems don't actually have math library (as such)
+ continue
diff --git a/eclass/ELT-patches/no-lc/1.5.22 b/eclass/ELT-patches/no-lc/1.5.22
new file mode 100644
index 00000000000..786284d4974
--- /dev/null
+++ b/eclass/ELT-patches/no-lc/1.5.22
@@ -0,0 +1,11 @@
+--- release-1-5-22.orig 2009-12-03 17:05:15.605534999 +0100
++++ release-1-5-22 2009-12-14 21:56:58.884956366 +0100
+@@ -1573,7 +1573,7 @@
+ # Causes problems with __ctype
+ test "X$arg" = "X-lc" && continue
+ ;;
+- *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
++ *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX* | *-*-hpux*)
+ # Compiler inserts libc in the correct place for threads to work
+ test "X$arg" = "X-lc" && continue
+ ;;
diff --git a/eclass/ELT-patches/nocxx/nocxx-2.64.patch b/eclass/ELT-patches/nocxx/nocxx-2.64.patch
new file mode 100644
index 00000000000..4b10e469718
--- /dev/null
+++ b/eclass/ELT-patches/nocxx/nocxx-2.64.patch
@@ -0,0 +1,13 @@
+--- a/configure
++++ b/configure
+@@ -5148,8 +5148,8 @@
+ else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+ $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+-as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check
+-See \`config.log' for more details" "$LINENO" 5; }
++$as_echo "See \`config.log' for more details." >&5;
++$ac_echo "C++ sucks, ignoring ..." >&5; }
+ fi
+
+ ac_ext=c
diff --git a/eclass/ELT-patches/nocxx/nocxx.patch b/eclass/ELT-patches/nocxx/nocxx.patch
new file mode 100644
index 00000000000..4b326924e18
--- /dev/null
+++ b/eclass/ELT-patches/nocxx/nocxx.patch
@@ -0,0 +1,15 @@
+--- a/configure
++++ b/configure
+@@ -5148,10 +5148,8 @@
+ :
+ else
+ { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+-See \`config.log' for more details." >&5
+-echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+-See \`config.log' for more details." >&2;}
+- { (exit 1); exit 1; }; }
++See \`config.log' for more details." >&5;}
++ { echo "C++ sucks, ignoring ..." >&5; }; }
+ fi
+
+ ac_ext=cc
diff --git a/eclass/ELT-patches/portage/1.2.0 b/eclass/ELT-patches/portage/1.2.0
new file mode 100644
index 00000000000..70b02619c60
--- /dev/null
+++ b/eclass/ELT-patches/portage/1.2.0
@@ -0,0 +1,7 @@
+# Dummy patch, not needed by libtool-1.2
+
+--- ltmain.sh
++++ ltmain.sh
+@@ -32,1 +32,1 @@
+-PACKAGE=libtool
++PACKAGE=libtool
diff --git a/eclass/ELT-patches/portage/1.3.0c b/eclass/ELT-patches/portage/1.3.0c
new file mode 100644
index 00000000000..ad071aed2f0
--- /dev/null
+++ b/eclass/ELT-patches/portage/1.3.0c
@@ -0,0 +1,66 @@
+--- ltmain.sh 2005-09-02 22:19:17.000000000 +0200
++++ ltmain.sh 2005-09-02 22:20:55.000000000 +0200
+@@ -3769,9 +3769,50 @@
+ $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+ exit 1
+ fi
+- newdependency_libs="$newdependency_libs $libdir/$name"
++ # We do not want portage's install root ($D) present. Check only for
++ # this if the .la is being installed.
++ if test "$installed" = yes && test "$D"; then
++ eval mynewdependency_lib=`echo "$libdir/$name" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
++ else
++ mynewdependency_lib="$libdir/$name"
++ fi
++ # Do not add duplicates
++ if test "$mynewdependency_lib"; then
++ my_little_ninja_foo_1=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
++ if test -z "$my_little_ninja_foo_1"; then
++ newdependency_libs="$newdependency_libs $mynewdependency_lib"
++ fi
++ fi
++ ;;
++ *)
++ if test "$installed" = yes; then
++ # Rather use S=WORKDIR if our version of portage supports it.
++ # This is because some ebuild (gcc) do not use $S as buildroot.
++ if test "$WORKDIR"; then
++ S="$WORKDIR"
++ fi
++ # We do not want portage's build root ($S) present.
++ my_little_ninja_foo_2=`echo $deplib |$EGREP -e "$S"`
++ # We do not want portage's install root ($D) present.
++ my_little_ninja_foo_3=`echo $deplib |$EGREP -e "$D"`
++ if test -n "$my_little_ninja_foo_2" && test "$S"; then
++ mynewdependency_lib=""
++ elif test -n "$my_little_ninja_foo_3" && test "$D"; then
++ eval mynewdependency_lib=`echo "$deplib" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
++ else
++ mynewdependency_lib="$deplib"
++ fi
++ else
++ mynewdependency_lib="$deplib"
++ fi
++ # Do not add duplicates
++ if test "$mynewdependency_lib"; then
++ my_little_ninja_foo_4=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
++ if test -z "$my_little_ninja_foo_4"; then
++ newdependency_libs="$newdependency_libs $mynewdependency_lib"
++ fi
++ fi
+ ;;
+- *) newdependency_libs="$newdependency_libs $deplib" ;;
+ esac
+ done
+ dependency_libs="$newdependency_libs"
+@@ -3799,6 +3840,10 @@
+ dlprefiles="$newdlprefiles"
+ fi
+ $rm $output
++ # Do not add duplicates
++ if test "$installed" = yes && test "$D"; then
++ install_libdir=`echo "$install_libdir" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
++ fi
+ $echo > $output "\
+ # $outputname - a libtool library file
+ # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
diff --git a/eclass/ELT-patches/portage/1.3.3 b/eclass/ELT-patches/portage/1.3.3
new file mode 100644
index 00000000000..731076bce48
--- /dev/null
+++ b/eclass/ELT-patches/portage/1.3.3
@@ -0,0 +1,71 @@
+--- ltmain.sh 2005-05-13 10:53:28.000000000 +0200
++++ ltmain.sh 2005-05-13 11:44:15.000000000 +0200
+@@ -3078,6 +3078,68 @@
+ break
+ fi
+ output="$output_objdir/$outputname"i
++ # Replace all uninstalled libtool libraries with the installed ones
++ newdependency_libs=
++ for deplib in $dependency_libs; do
++ case $deplib in
++ *.la)
++ name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
++ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
++ if test -z "$libdir"; then
++ $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
++ exit $EXIT_FAILURE
++ fi
++ # We do not want portage's install root ($D) present. Check only for
++ # this if the .la is being installed.
++ if test "$installed" = yes && test "$D"; then
++ eval mynewdependency_lib=`echo "$libdir/$name" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
++ else
++ mynewdependency_lib="$libdir/$name"
++ fi
++ # Do not add duplicates
++ if test "$mynewdependency_lib"; then
++ my_little_ninja_foo_1=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
++ if test -z "$my_little_ninja_foo_1"; then
++ newdependency_libs="$newdependency_libs $mynewdependency_lib"
++ fi
++ fi
++ ;;
++ *)
++ if test "$installed" = yes; then
++ # Rather use S=WORKDIR if our version of portage supports it.
++ # This is because some ebuild (gcc) do not use $S as buildroot.
++ if test "$WORKDIR"; then
++ S="$WORKDIR"
++ fi
++ # We do not want portage's build root ($S) present.
++ my_little_ninja_foo_2=`echo $deplib |$EGREP -e "$S"`
++ # We do not want portage's install root ($D) present.
++ my_little_ninja_foo_3=`echo $deplib |$EGREP -e "$D"`
++ if test -n "$my_little_ninja_foo_2" && test "$S"; then
++ mynewdependency_lib=""
++ elif test -n "$my_little_ninja_foo_3" && test "$D"; then
++ eval mynewdependency_lib=`echo "$deplib" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
++ else
++ mynewdependency_lib="$deplib"
++ fi
++ else
++ mynewdependency_lib="$deplib"
++ fi
++ # Do not add duplicates
++ if test "$mynewdependency_lib"; then
++ my_little_ninja_foo_4=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
++ if test -z "$my_little_ninja_foo_4"; then
++ newdependency_libs="$newdependency_libs $mynewdependency_lib"
++ fi
++ fi
++ ;;
++ esac
++ done
++ dependency_libs="$newdependency_libs"
++ fi
++ # Do not add duplicates
++ if test "$installed" = yes && test "$D"; then
++ install_libdir=`echo "$install_libdir" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
+ fi
+ $rm $output
+ $echo > $output "\
diff --git a/eclass/ELT-patches/portage/1.4.0 b/eclass/ELT-patches/portage/1.4.0
new file mode 100644
index 00000000000..5566a39af49
--- /dev/null
+++ b/eclass/ELT-patches/portage/1.4.0
@@ -0,0 +1,74 @@
+Note that if you update this patch, please update this one as well:
+
+ eclass/ELT-patches/portage/1.4.1
+
+The file name can stay 1.4.1, as it will still apply to all versions. Only
+when a new version of libtool comes out that it do not apply to, then the
+name should be bumped, but the patch content should stay fairly the same.
+
+--- ltmain.sh Wed Apr 3 01:19:37 2002
++++ ltmain.sh Sun May 26 19:50:52 2002
+@@ -3940,9 +3940,50 @@
+ $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+ exit 1
+ fi
+- newdependency_libs="$newdependency_libs $libdir/$name"
++ # We do not want portage's install root ($D) present. Check only for
++ # this if the .la is being installed.
++ if test "$installed" = yes && test "$D"; then
++ eval mynewdependency_lib=`echo "$libdir/$name" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
++ else
++ mynewdependency_lib="$libdir/$name"
++ fi
++ # Do not add duplicates
++ if test "$mynewdependency_lib"; then
++ my_little_ninja_foo_1=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
++ if test -z "$my_little_ninja_foo_1"; then
++ newdependency_libs="$newdependency_libs $mynewdependency_lib"
++ fi
++ fi
++ ;;
++ *)
++ if test "$installed" = yes; then
++ # Rather use S=WORKDIR if our version of portage supports it.
++ # This is because some ebuild (gcc) do not use $S as buildroot.
++ if test "$WORKDIR"; then
++ S="$WORKDIR"
++ fi
++ # We do not want portage's build root ($S) present.
++ my_little_ninja_foo_2=`echo $deplib |$EGREP -e "$S"`
++ # We do not want portage's install root ($D) present.
++ my_little_ninja_foo_3=`echo $deplib |$EGREP -e "$D"`
++ if test -n "$my_little_ninja_foo_2" && test "$S"; then
++ mynewdependency_lib=""
++ elif test -n "$my_little_ninja_foo_3" && test "$D"; then
++ eval mynewdependency_lib=`echo "$deplib" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
++ else
++ mynewdependency_lib="$deplib"
++ fi
++ else
++ mynewdependency_lib="$deplib"
++ fi
++ # Do not add duplicates
++ if test "$mynewdependency_lib"; then
++ my_little_ninja_foo_4=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
++ if test -z "$my_little_ninja_foo_4"; then
++ newdependency_libs="$newdependency_libs $mynewdependency_lib"
++ fi
++ fi
+ ;;
+- *) newdependency_libs="$newdependency_libs $deplib" ;;
+ esac
+ done
+ dependency_libs="$newdependency_libs"
+@@ -3975,6 +4005,10 @@
+ case $host,$output,$installed,$module,$dlname in
+ *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
+ esac
++ # Do not add duplicates
++ if test "$installed" = yes && test "$D"; then
++ install_libdir=`echo "$install_libdir" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
++ fi
+ $echo > $output "\
+ # $outputname - a libtool library file
+ # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
diff --git a/eclass/ELT-patches/portage/1.5.10 b/eclass/ELT-patches/portage/1.5.10
new file mode 100644
index 00000000000..f33d906ed51
--- /dev/null
+++ b/eclass/ELT-patches/portage/1.5.10
@@ -0,0 +1,77 @@
+Note that if you update this patch, please update this one as well:
+
+ eclass/ELT-patches/portage/1.4.1
+
+The file name can stay 1.4.1, as it will still apply to all versions. Only
+when a new version of libtool comes out that it do not apply to, then the
+name should be bumped, but the patch content should stay fairly the same.
+
+--- ltmain.sh Wed Apr 3 01:19:37 2002
++++ ltmain.sh Sun May 26 19:50:52 2002
+@@ -3940,9 +3940,53 @@
+ $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+ exit 1
+ fi
+- newdependency_libs="$newdependency_libs $libdir/$name"
++ if test "x$EGREP" = x ; then
++ EGREP=egrep
++ fi
++ # We do not want portage's install root ($D) present. Check only for
++ # this if the .la is being installed.
++ if test "$installed" = yes && test "$D"; then
++ eval mynewdependency_lib=`echo "$libdir/$name" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
++ else
++ mynewdependency_lib="$libdir/$name"
++ fi
++ # Do not add duplicates
++ if test "$mynewdependency_lib"; then
++ my_little_ninja_foo_1=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
++ if test -z "$my_little_ninja_foo_1"; then
++ newdependency_libs="$newdependency_libs $mynewdependency_lib"
++ fi
++ fi
++ ;;
++ *)
++ if test "$installed" = yes; then
++ # Rather use S=WORKDIR if our version of portage supports it.
++ # This is because some ebuild (gcc) do not use $S as buildroot.
++ if test "$WORKDIR"; then
++ S="$WORKDIR"
++ fi
++ # We do not want portage's build root ($S) present.
++ my_little_ninja_foo_2=`echo $deplib |$EGREP -e "$S"`
++ # We do not want portage's install root ($D) present.
++ my_little_ninja_foo_3=`echo $deplib |$EGREP -e "$D"`
++ if test -n "$my_little_ninja_foo_2" && test "$S"; then
++ mynewdependency_lib=""
++ elif test -n "$my_little_ninja_foo_3" && test "$D"; then
++ eval mynewdependency_lib=`echo "$deplib" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
++ else
++ mynewdependency_lib="$deplib"
++ fi
++ else
++ mynewdependency_lib="$deplib"
++ fi
++ # Do not add duplicates
++ if test "$mynewdependency_lib"; then
++ my_little_ninja_foo_4=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
++ if test -z "$my_little_ninja_foo_4"; then
++ newdependency_libs="$newdependency_libs $mynewdependency_lib"
++ fi
++ fi
+ ;;
+- *) newdependency_libs="$newdependency_libs $deplib" ;;
+ esac
+ done
+ dependency_libs="$newdependency_libs"
+@@ -3975,6 +4005,10 @@
+ case $host,$output,$installed,$module,$dlname in
+ *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
+ esac
++ # Do not add duplicates
++ if test "$installed" = yes && test "$D"; then
++ install_libdir=`echo "$install_libdir" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
++ fi
+ $echo > $output "\
+ # $outputname - a libtool library file
+ # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
diff --git a/eclass/ELT-patches/portage/2.2 b/eclass/ELT-patches/portage/2.2
new file mode 100644
index 00000000000..1f724e7984e
--- /dev/null
+++ b/eclass/ELT-patches/portage/2.2
@@ -0,0 +1,69 @@
+--- ltmain.sh
++++ ltmain.sh
+@@ -7410,9 +7410,53 @@
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+ test -z "$libdir" && \
+ func_fatal_error "\`$deplib' is not a valid libtool archive"
+- newdependency_libs="$newdependency_libs $libdir/$name"
++ if test "x$EGREP" = x ; then
++ EGREP=egrep
++ fi
++ # We do not want portage's install root ($D) present. Check only for
++ # this if the .la is being installed.
++ if test "$installed" = yes && test "$D"; then
++ eval mynewdependency_lib=`echo "$libdir/$name" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
++ else
++ mynewdependency_lib="$libdir/$name"
++ fi
++ # Do not add duplicates
++ if test "$mynewdependency_lib"; then
++ my_little_ninja_foo_1=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
++ if test -z "$my_little_ninja_foo_1"; then
++ newdependency_libs="$newdependency_libs $mynewdependency_lib"
++ fi
++ fi
++ ;;
++ *)
++ if test "$installed" = yes; then
++ # Rather use S=WORKDIR if our version of portage supports it.
++ # This is because some ebuild (gcc) do not use $S as buildroot.
++ if test "$WORKDIR"; then
++ S="$WORKDIR"
++ fi
++ # We do not want portage's build root ($S) present.
++ my_little_ninja_foo_2=`echo $deplib |$EGREP -e "$S"`
++ # We do not want portage's install root ($D) present.
++ my_little_ninja_foo_3=`echo $deplib |$EGREP -e "$D"`
++ if test -n "$my_little_ninja_foo_2" && test "$S"; then
++ mynewdependency_lib=""
++ elif test -n "$my_little_ninja_foo_3" && test "$D"; then
++ eval mynewdependency_lib=`echo "$deplib" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
++ else
++ mynewdependency_lib="$deplib"
++ fi
++ else
++ mynewdependency_lib="$deplib"
++ fi
++ # Do not add duplicates
++ if test "$mynewdependency_lib"; then
++ my_little_ninja_foo_4=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
++ if test -z "$my_little_ninja_foo_4"; then
++ newdependency_libs="$newdependency_libs $mynewdependency_lib"
++ fi
++ fi
+ ;;
+- *) newdependency_libs="$newdependency_libs $deplib" ;;
+ esac
+ done
+ dependency_libs="$newdependency_libs"
+@@ -7476,6 +7520,10 @@
+ case $host,$output,$installed,$module,$dlname in
+ *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
+ esac
++ # Do not add duplicates
++ if test "$installed" = yes && test "$D"; then
++ install_libdir=`echo "$install_libdir" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
++ fi
+ $ECHO > $output "\
+ # $outputname - a libtool library file
+ # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
diff --git a/eclass/ELT-patches/relink-prog/1.3d b/eclass/ELT-patches/relink-prog/1.3d
new file mode 100644
index 00000000000..ccb6cb811c5
--- /dev/null
+++ b/eclass/ELT-patches/relink-prog/1.3d
@@ -0,0 +1,24 @@
+--- ltmain.sh
++++ ltmain.sh
+@@ -3203,6 +3203,12 @@
+ add_dir="$add_dir -L$inst_prefix_dir$libdir"
+ ;;
+ esac
++ else
++ case $libdir in
++ [\\/]*)
++ add_dir="$add_dir -L\\\"\\\${D}\\\"$libdir"
++ ;;
++ esac
+ fi
+ add="-l$name"
+ fi
+@@ -6630,7 +6636,7 @@
+ esac
+ fi
+ libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
+- if test -n "$libdir" && test ! -f "$libfile"; then
++ if test -n "$libdir" && test ! -f "${D}$libfile"; then
+ $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
+ finalize=no
+ fi
diff --git a/eclass/ELT-patches/relink-prog/2.1b b/eclass/ELT-patches/relink-prog/2.1b
new file mode 100644
index 00000000000..71a0970d5b4
--- /dev/null
+++ b/eclass/ELT-patches/relink-prog/2.1b
@@ -0,0 +1,24 @@
+--- ltmain-v2.2.6.in 2009-06-22 15:33:27.000000000 +0200
++++ ltmain-v2.2.6.in.new 2009-07-16 16:21:04.000000000 +0200
+@@ -1742,7 +1742,7 @@
+ func_source "$lib"
+ fi
+ libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
+- if test -n "$libdir" && test ! -f "$libfile"; then
++ if test -n "$libdir" && test ! -f "${D}$libfile"; then
+ func_warning "\`$lib' has not been installed in \`$libdir'"
+ finalize=no
+ fi
+@@ -5351,6 +5351,12 @@
+ add_dir="$add_dir -L$inst_prefix_dir$libdir"
+ ;;
+ esac
++ else
++ case $libdir in
++ [\\/]*)
++ add_dir="$add_dir -L\\\"\\\${D}\\\"$libdir"
++ ;;
++ esac
+ fi
+ add="-l$name"
+ fi
diff --git a/eclass/ELT-patches/relink/1.4.0a b/eclass/ELT-patches/relink/1.4.0a
new file mode 100644
index 00000000000..382d76087e6
--- /dev/null
+++ b/eclass/ELT-patches/relink/1.4.0a
@@ -0,0 +1,99 @@
+--- ltmain.sh Wed Oct 3 02:05:35 2001
++++ ltmain.sh Wed Oct 3 05:16:14 2001
+@@ -754,6 +754,7 @@
+ linker_flags=
+ dllsearchpath=
+ lib_search_path=`pwd`
++ inst_prefix_dir=
+
+ avoid_version=no
+ dlfiles=
+@@ -884,6 +885,11 @@
+ prev=
+ continue
+ ;;
++ inst_prefix)
++ inst_prefix_dir="$arg"
++ prev=
++ continue
++ ;;
+ release)
+ release="-$arg"
+ prev=
+@@ -985,6 +991,11 @@
+ continue
+ ;;
+
++ -inst-prefix-dir)
++ prev=inst_prefix
++ continue
++ ;;
++
+ # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+ # so, if we see these flags be careful not to treat them like -L
+ -L[A-Z][A-Z]*:*)
+@@ -1866,6 +1877,7 @@
+
+ if test "$linkmode" = prog || test "$mode" = relink; then
+ add_shlibpath=
++ add_prefix_dir=
+ add_dir=
+ add=
+ # Finalize command for both is simple: just hardcode it.
+@@ -1886,10 +1898,22 @@
+ add="-l$name"
+ fi
+
++ if test -n "$inst_prefix_dir"; then
++ case "$libdir" in
++ [\\/]*)
++ add_prefix_dir="-L$inst_prefix_dir$libdir"
++ ;;
++ esac
++ fi
++
++ # add_prefix_dir must be appended instead, otherwise it can
++ # possibly be overrided by any hardcoded -L/... path in deplibs
+ if test "$linkmode" = prog; then
++ test -n "$add_prefix_dir" && finalize_deplibs="$finalize_deplibs $add_prefix_dir"
+ test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+ test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+ else
++ test -n "$add_prefix_dir" && deplibs="$deplibs $add_prefix_dir"
+ test -n "$add_dir" && deplibs="$add_dir $deplibs"
+ test -n "$add" && deplibs="$add $deplibs"
+ fi
+@@ -3856,7 +3880,7 @@
+ fi
+ done
+ # Quote the link command for shipping.
+- relink_command="($relink_command; cd `pwd`; $SHELL $0 --mode=relink $libtool_args)"
++ relink_command="($relink_command; cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
+ relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+
+ # Only create the output if not a dry run.
+@@ -4157,6 +4181,24 @@
+ dir="$dir$objdir"
+
+ if test -n "$relink_command"; then
++ # Determine the prefix the user has applied to our future dir.
++ inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"`
++
++ # Don't allow the user to place us outside of our expected
++ # location b/c this prevents finding dependent libraries that
++ # are installed to the same prefix.
++ if test "$inst_prefix_dir" = "$destdir"; then
++ $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
++ exit 1
++ fi
++
++ if test -n "$inst_prefix_dir"; then
++ # Stick the inst_prefix_dir data into the link command.
++ relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
++ else
++ relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"`
++ fi
++
+ $echo "$modename: warning: relinking \`$file'" 1>&2
+ $show "$relink_command"
+ if $run eval "$relink_command"; then :
diff --git a/eclass/ELT-patches/relink/1.4.0a-GCC3.0-1 b/eclass/ELT-patches/relink/1.4.0a-GCC3.0-1
new file mode 100644
index 00000000000..6bf45e58c57
--- /dev/null
+++ b/eclass/ELT-patches/relink/1.4.0a-GCC3.0-1
@@ -0,0 +1,99 @@
+--- ltmain.sh Wed Oct 3 02:05:35 2001
++++ ltmain.sh Wed Oct 3 05:16:14 2001
+@@ -754,6 +754,7 @@
+ linker_flags=
+ dllsearchpath=
+ lib_search_path=`pwd`
++ inst_prefix_dir=
+
+ avoid_version=no
+ dlfiles=
+@@ -884,6 +885,11 @@
+ prev=
+ continue
+ ;;
++ inst_prefix)
++ inst_prefix_dir="$arg"
++ prev=
++ continue
++ ;;
+ release)
+ release="-$arg"
+ prev=
+@@ -985,6 +991,11 @@
+ continue
+ ;;
+
++ -inst-prefix-dir)
++ prev=inst_prefix
++ continue
++ ;;
++
+ # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+ # so, if we see these flags be careful not to treat them like -L
+ -L[A-Z][A-Z]*:*)
+@@ -1866,6 +1877,7 @@
+
+ if test "$linkmode" = prog || test "$mode" = relink; then
+ add_shlibpath=
++ add_prefix_dir=
+ add_dir=
+ add=
+ # Finalize command for both is simple: just hardcode it.
+@@ -1886,10 +1898,22 @@
+ add="-l$name"
+ fi
+
++ if test -n "$inst_prefix_dir"; then
++ case "$libdir" in
++ [\\/]*)
++ add_prefix_dir="-L$inst_prefix_dir$libdir"
++ ;;
++ esac
++ fi
++
++ # add_prefix_dir must be appended instead, otherwise it can
++ # possibly be overrided by any hardcoded -L/... path in deplibs
+ if test "$linkmode" = prog; then
++ test -n "$add_prefix_dir" && finalize_deplibs="$finalize_deplibs $add_prefix_dir"
+ test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+ test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+ else
++ test -n "$add_prefix_dir" && deplibs="$deplibs $add_prefix_dir"
+ test -n "$add_dir" && deplibs="$add_dir $deplibs"
+ test -n "$add" && deplibs="$add $deplibs"
+ fi
+@@ -3856,7 +3880,7 @@
+ for tag in $taglist; do
+ tagopts="$tagopts --tag $tag"
+ done
+- relink_command="(cd `pwd`; $SHELL $0$tagopts --mode=relink $libtool_args)"
++ relink_command="(cd `pwd`; $SHELL $0$tagopts --mode=relink $libtool_args @inst_prefix_dir@)"
+ relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+
+ # Only create the output if not a dry run.
+@@ -4157,6 +4181,24 @@
+ dir="$dir$objdir"
+
+ if test -n "$relink_command"; then
++ # Determine the prefix the user has applied to our future dir.
++ inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"`
++
++ # Don't allow the user to place us outside of our expected
++ # location b/c this prevents finding dependent libraries that
++ # are installed to the same prefix.
++ if test "$inst_prefix_dir" = "$destdir"; then
++ $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
++ exit 1
++ fi
++
++ if test -n "$inst_prefix_dir"; then
++ # Stick the inst_prefix_dir data into the link command.
++ relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
++ else
++ relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"`
++ fi
++
+ $echo "$modename: warning: relinking \`$file'" 1>&2
+ $show "$relink_command"
+ if $run eval "$relink_command"; then :
diff --git a/eclass/ELT-patches/relink/1.4.0a-GCC3.0-2 b/eclass/ELT-patches/relink/1.4.0a-GCC3.0-2
new file mode 100644
index 00000000000..55103a42e20
--- /dev/null
+++ b/eclass/ELT-patches/relink/1.4.0a-GCC3.0-2
@@ -0,0 +1,100 @@
+--- ltmain.sh Wed Oct 3 02:05:35 2001
++++ ltmain.sh Wed Oct 3 05:16:14 2001
+@@ -754,6 +754,7 @@
+ linker_flags=
+ dllsearchpath=
+ lib_search_path=`pwd`
++ inst_prefix_dir=
+
+ avoid_version=no
+ dlfiles=
+@@ -884,6 +885,11 @@
+ prev=
+ continue
+ ;;
++ inst_prefix)
++ inst_prefix_dir="$arg"
++ prev=
++ continue
++ ;;
+ release)
+ release="-$arg"
+ prev=
+@@ -985,6 +991,11 @@
+ continue
+ ;;
+
++ -inst-prefix-dir)
++ prev=inst_prefix
++ continue
++ ;;
++
+ # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+ # so, if we see these flags be careful not to treat them like -L
+ -L[A-Z][A-Z]*:*)
+@@ -1866,6 +1877,7 @@
+
+ if test "$linkmode" = prog || test "$mode" = relink; then
+ add_shlibpath=
++ add_prefix_dir=
+ add_dir=
+ add=
+ # Finalize command for both is simple: just hardcode it.
+@@ -1886,10 +1898,22 @@
+ add="-l$name"
+ fi
+
+- if test $linkmode = prog; then
++ if test -n "$inst_prefix_dir"; then
++ case "$libdir" in
++ [\\/]*)
++ add_prefix_dir="-L$inst_prefix_dir$libdir"
++ ;;
++ esac
++ fi
++
++ # add_prefix_dir must be appended instead, otherwise it can
++ # possibly be overrided by any hardcoded -L/... path in deplibs
++ if test "$linkmode" = prog; then
++ test -n "$add_prefix_dir" && finalize_deplibs="$finalize_deplibs $add_prefix_dir"
+ test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+ test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+ else
++ test -n "$add_prefix_dir" && deplibs="$deplibs $add_prefix_dir"
+ test -n "$add_dir" && deplibs="$add_dir $deplibs"
+ test -n "$add" && deplibs="$add $deplibs"
+ fi
+@@ -3856,7 +3880,7 @@
+ for tag in $taglist; do
+ tagopts="$tagopts --tag $tag"
+ done
+- relink_command="(cd `pwd`; $SHELL $0$tagopts --mode=relink $libtool_args)"
++ relink_command="(cd `pwd`; $SHELL $0$tagopts --mode=relink $libtool_args @inst_prefix_dir@)"
+ relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+
+ # Only create the output if not a dry run.
+@@ -4157,6 +4181,24 @@
+ dir="$dir$objdir"
+
+ if test -n "$relink_command"; then
++ # Determine the prefix the user has applied to our future dir.
++ inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"`
++
++ # Don't allow the user to place us outside of our expected
++ # location b/c this prevents finding dependent libraries that
++ # are installed to the same prefix.
++ if test "$inst_prefix_dir" = "$destdir"; then
++ $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
++ exit 1
++ fi
++
++ if test -n "$inst_prefix_dir"; then
++ # Stick the inst_prefix_dir data into the link command.
++ relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
++ else
++ relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"`
++ fi
++
+ $echo "$modename: warning: relinking \`$file'" 1>&2
+ $show "$relink_command"
+ if $run eval "$relink_command"; then :
diff --git a/eclass/ELT-patches/relink/1.4.1 b/eclass/ELT-patches/relink/1.4.1
new file mode 100644
index 00000000000..f34863f685e
--- /dev/null
+++ b/eclass/ELT-patches/relink/1.4.1
@@ -0,0 +1,124 @@
+--- ltmain.sh Sun Aug 12 18:08:05 2001
++++ ltmain.sh Tue Aug 28 18:55:13 2001
+@@ -827,6 +827,7 @@
+ linker_flags=
+ dllsearchpath=
+ lib_search_path=`pwd`
++ inst_prefix_dir=
+
+ avoid_version=no
+ dlfiles=
+@@ -959,6 +960,11 @@
+ prev=
+ continue
+ ;;
++ inst_prefix)
++ inst_prefix_dir="$arg"
++ prev=
++ continue
++ ;;
+ release)
+ release="-$arg"
+ prev=
+@@ -1167,6 +1173,11 @@
+ continue
+ ;;
+
++ -inst-prefix-dir)
++ prev=inst_prefix
++ continue
++ ;;
++
+ # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+ # so, if we see these flags be careful not to treat them like -L
+ -L[A-Z][A-Z]*:*)
+@@ -2231,7 +2242,16 @@
+ if test "$hardcode_direct" = yes; then
+ add="$libdir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+- add_dir="-L$libdir"
++ # Try looking first in the location we're being installed to.
++ add_dir=
++ if test -n "$inst_prefix_dir"; then
++ case "$libdir" in
++ [\\/]*)
++ add_dir="-L$inst_prefix_dir$libdir"
++ ;;
++ esac
++ fi
++ add_dir="$add_dir -L$libdir"
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ case :$finalize_shlibpath: in
+@@ -2241,7 +2261,16 @@
+ add="-l$name"
+ else
+ # We cannot seem to hardcode it, guess we'll fake it.
+- add_dir="-L$libdir"
++ # Try looking first in the location we're being installed to.
++ add_dir=
++ if test -n "$inst_prefix_dir"; then
++ case "$libdir" in
++ [\\/]*)
++ add_dir="-L$inst_prefix_dir$libdir"
++ ;;
++ esac
++ fi
++ add_dir="$add_dir -L$libdir"
+ add="-l$name"
+ fi
+
+@@ -4321,7 +4350,7 @@
+ fi
+ done
+ # Quote the link command for shipping.
+- relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args"
++ relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@"
+ relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+
+ # Only create the output if not a dry run.
+@@ -4622,12 +4651,30 @@
+ dir="$dir$objdir"
+
+ if test -n "$relink_command"; then
++ # Determine the prefix the user has applied to our future dir.
++ inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"`
++
++ # Don't allow the user to place us outside of our expected
++ # location b/c this prevents finding dependent libraries that
++ # are installed to the same prefix.
++ if test "$inst_prefix_dir" = "$destdir"; then
++ $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
++ exit 1
++ fi
++
++ if test -n "$inst_prefix_dir"; then
++ # Stick the inst_prefix_dir data into the link command.
++ relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
++ else
++ relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"`
++ fi
++
+ $echo "$modename: warning: relinking \`$file'" 1>&2
+ $show "$relink_command"
+ if $run eval "$relink_command"; then :
+ else
+ $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+- continue
++ exit 1
+ fi
+ fi
+
+@@ -4782,7 +4829,11 @@
+ if test "$finalize" = yes && test -z "$run"; then
+ tmpdir="/tmp"
+ test -n "$TMPDIR" && tmpdir="$TMPDIR"
+- tmpdir="$tmpdir/libtool-$$"
++ tmpdir=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null`
++ if test $? = 0 ; then :
++ else
++ tmpdir="$tmpdir/libtool-$$"
++ fi
+ if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
+ else
+ $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
diff --git a/eclass/ELT-patches/relink/1.4.2 b/eclass/ELT-patches/relink/1.4.2
new file mode 100644
index 00000000000..17a630b7cfe
--- /dev/null
+++ b/eclass/ELT-patches/relink/1.4.2
@@ -0,0 +1,99 @@
+--- ltmain.sh Wed Oct 3 02:05:35 2001
++++ ltmain.sh Wed Oct 3 05:16:14 2001
+@@ -754,6 +754,7 @@
+ linker_flags=
+ dllsearchpath=
+ lib_search_path=`pwd`
++ inst_prefix_dir=
+
+ avoid_version=no
+ dlfiles=
+@@ -884,6 +885,11 @@
+ prev=
+ continue
+ ;;
++ inst_prefix)
++ inst_prefix_dir="$arg"
++ prev=
++ continue
++ ;;
+ release)
+ release="-$arg"
+ prev=
+@@ -985,6 +991,11 @@
+ continue
+ ;;
+
++ -inst-prefix-dir)
++ prev=inst_prefix
++ continue
++ ;;
++
+ # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+ # so, if we see these flags be careful not to treat them like -L
+ -L[A-Z][A-Z]*:*)
+@@ -1866,6 +1877,7 @@
+
+ if test "$linkmode" = prog || test "$mode" = relink; then
+ add_shlibpath=
++ add_prefix_dir=
+ add_dir=
+ add=
+ # Finalize command for both is simple: just hardcode it.
+@@ -1886,10 +1898,22 @@
+ add="-l$name"
+ fi
+
++ if test -n "$inst_prefix_dir"; then
++ case "$libdir" in
++ [\\/]*)
++ add_prefix_dir="-L$inst_prefix_dir$libdir"
++ ;;
++ esac
++ fi
++
++ # add_prefix_dir must be appended instead, otherwise it can
++ # possibly be overrided by any hardcoded -L/... path in deplibs
+ if test "$linkmode" = prog; then
++ test -n "$add_prefix_dir" && finalize_deplibs="$finalize_deplibs $add_prefix_dir"
+ test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+ test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+ else
++ test -n "$add_prefix_dir" && deplibs="$deplibs $add_prefix_dir"
+ test -n "$add_dir" && deplibs="$add_dir $deplibs"
+ test -n "$add" && deplibs="$add $deplibs"
+ fi
+@@ -3856,7 +3880,7 @@
+ fi
+ done
+ # Quote the link command for shipping.
+- relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args)"
++ relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
+ relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+
+ # Only create the output if not a dry run.
+@@ -4157,6 +4181,24 @@
+ dir="$dir$objdir"
+
+ if test -n "$relink_command"; then
++ # Determine the prefix the user has applied to our future dir.
++ inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"`
++
++ # Don't allow the user to place us outside of our expected
++ # location b/c this prevents finding dependent libraries that
++ # are installed to the same prefix.
++ if test "$inst_prefix_dir" = "$destdir"; then
++ $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
++ exit 1
++ fi
++
++ if test -n "$inst_prefix_dir"; then
++ # Stick the inst_prefix_dir data into the link command.
++ relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
++ else
++ relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"`
++ fi
++
+ $echo "$modename: warning: relinking \`$file'" 1>&2
+ $show "$relink_command"
+ if $run eval "$relink_command"; then :
diff --git a/eclass/ELT-patches/relink/1.4.3 b/eclass/ELT-patches/relink/1.4.3
new file mode 100644
index 00000000000..3ed5fe3784a
--- /dev/null
+++ b/eclass/ELT-patches/relink/1.4.3
@@ -0,0 +1,111 @@
+--- ltmain.sh Mon Feb 4 15:12:15 2002
++++ ltmain.sh Mon Feb 4 15:12:15 2002
+@@ -745,6 +745,7 @@
+ linker_flags=
+ dllsearchpath=
+ lib_search_path=`pwd`
++ inst_prefix_dir=
+
+ avoid_version=no
+ dlfiles=
+@@ -875,6 +876,11 @@
+ prev=
+ continue
+ ;;
++ inst_prefix)
++ inst_prefix_dir="$arg"
++ prev=
++ continue
++ ;;
+ release)
+ release="-$arg"
+ prev=
+@@ -976,6 +982,11 @@
+ continue
+ ;;
+
++ -inst-prefix-dir)
++ prev=inst_prefix
++ continue
++ ;;
++
+ # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+ # so, if we see these flags be careful not to treat them like -L
+ -L[A-Z][A-Z]*:*)
+@@ -1851,7 +1862,16 @@
+ if test "$hardcode_direct" = yes; then
+ add="$libdir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+- add_dir="-L$libdir"
++ # Try looking first in the location we're being installed to.
++ add_dir=
++ if test -n "$inst_prefix_dir"; then
++ case "$libdir" in
++ [\\/]*)
++ add_dir="-L$inst_prefix_dir$libdir"
++ ;;
++ esac
++ fi
++ add_dir="$add_dir -L$libdir"
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ case :$finalize_shlibpath: in
+@@ -1861,7 +1881,16 @@
+ add="-l$name"
+ else
+ # We cannot seem to hardcode it, guess we'll fake it.
+- add_dir="-L$libdir"
++ # Try looking first in the location we're being installed to.
++ add_dir=
++ if test -n "$inst_prefix_dir"; then
++ case "$libdir" in
++ [\\/]*)
++ add_dir="-L$inst_prefix_dir$libdir"
++ ;;
++ esac
++ fi
++ add_dir="$add_dir -L$libdir"
+ add="-l$name"
+ fi
+
+@@ -3823,7 +3852,7 @@
+ fi
+ done
+ # Quote the link command for shipping.
+- relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args)"
++ relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
+ relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+
+ # Only create the output if not a dry run.
+@@ -4124,12 +4153,30 @@
+ dir="$dir$objdir"
+
+ if test -n "$relink_command"; then
++ # Determine the prefix the user has applied to our future dir.
++ inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"`
++
++ # Don't allow the user to place us outside of our expected
++ # location b/c this prevents finding dependent libraries that
++ # are installed to the same prefix.
++ if test "$inst_prefix_dir" = "$destdir"; then
++ $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
++ exit 1
++ fi
++
++ if test -n "$inst_prefix_dir"; then
++ # Stick the inst_prefix_dir data into the link command.
++ relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
++ else
++ relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"`
++ fi
++
+ $echo "$modename: warning: relinking \`$file'" 1>&2
+ $show "$relink_command"
+ if $run eval "$relink_command"; then :
+ else
+ $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+- continue
++ exit 1
+ fi
+ fi
+
diff --git a/eclass/ELT-patches/rem-int-dep/1.3.5 b/eclass/ELT-patches/rem-int-dep/1.3.5
new file mode 100644
index 00000000000..4302623607b
--- /dev/null
+++ b/eclass/ELT-patches/rem-int-dep/1.3.5
@@ -0,0 +1,11 @@
+--- ltmain.sh 2002-11-01 19:56:50.000000000 -0600
++++ ltmain.sh 2002-11-01 19:57:03.000000000 -0600
+@@ -4551,6 +4551,8 @@
+ if test "$installed" = yes && test "$D"; then
+ install_libdir="`echo "$install_libdir" |sed -e "s:$D::g" -e 's://:/:g'`"
+ fi
++ # Removing @REM_INT_DEP@ from dependency_libs in .la
++ dependency_libs=`echo $dependency_libs | $Xsed -e 's%\([^ ]*lib@REM_INT_DEP@\.\(so\|la\|a\)\)\|\(-l@REM_INT_DEP@\)%%g'`
+ \$echo > \$output "\\
+ # \$outputname - a libtool library file
+ # Generated by \$PROGRAM - GNU \$PACKAGE \$VERSION\$TIMESTAMP
diff --git a/eclass/ELT-patches/sed/1.3.4 b/eclass/ELT-patches/sed/1.3.4
new file mode 100644
index 00000000000..c88ff727a7e
--- /dev/null
+++ b/eclass/ELT-patches/sed/1.3.4
@@ -0,0 +1,14 @@
+--- ltmain.sh 2005-05-13 11:48:24.000000000 +0200
++++ ltmain.sh 2005-05-13 11:48:42.000000000 +0200
+@@ -47,6 +47,11 @@
+ exit 0
+ fi
+
++# define variables for historic ltconfig's generated by Libtool 1.3
++test -z "$SED" && SED=sed
++test -z "$EGREP" && EGREP=egrep
++test -z "$LTCC" && LTCC=${CC-gcc}
++
+ # The name of this program.
+ progname=`$echo "$0" | sed 's%^.*/%%'`
+ modename="$progname"
diff --git a/eclass/ELT-patches/sed/1.4.0 b/eclass/ELT-patches/sed/1.4.0
new file mode 100644
index 00000000000..9c51ac2de0f
--- /dev/null
+++ b/eclass/ELT-patches/sed/1.4.0
@@ -0,0 +1,14 @@
+--- ltmain.sh 2003-02-13 14:54:24.000000000 +0100
++++ ltmain.sh 2003-02-13 15:24:49.000000000 +0100
+@@ -48,6 +48,11 @@ EOF
+ exit 0
+ fi
+
++# define variables for historic ltconfig's generated by Libtool 1.3
++test -z "$SED" && SED=sed
++test -z "$EGREP" && EGREP=egrep
++test -z "$LTCC" && LTCC=${CC-gcc}
++
+ # The name of this program.
+ progname=`$echo "$0" | ${SED} 's%^.*/%%'`
+ modename="$progname"
diff --git a/eclass/ELT-patches/sed/1.5.6 b/eclass/ELT-patches/sed/1.5.6
new file mode 100644
index 00000000000..5efd5310dcf
--- /dev/null
+++ b/eclass/ELT-patches/sed/1.5.6
@@ -0,0 +1,16 @@
+--- ltmain.sh 2005-04-16 16:50:02.000000000 +0200
++++ ltmain.sh 2005-04-16 16:46:46.000000000 +0200
+@@ -39,6 +39,13 @@
+ if [ "x$SED" = x ] ; then
+ SED=sed
+ fi
++# Same for EGREP, and just to be sure, do LTCC as well
++if test "x$EGREP" = x ; then
++ EGREP=egrep
++fi
++if test "x$LTCC" = x ; then
++ LTCC=${CC-gcc}
++fi
+
+ # The name of this program:
+ progname=`echo "$progpath" | $SED $basename`
diff --git a/eclass/ELT-patches/sol2-conf/2.4.2 b/eclass/ELT-patches/sol2-conf/2.4.2
new file mode 100644
index 00000000000..a57f22c9ca3
--- /dev/null
+++ b/eclass/ELT-patches/sol2-conf/2.4.2
@@ -0,0 +1,14 @@
+Unbreak x86_64-pc-solaris2.1[01], it IS 64-bits too. Without this,
+libtool thinks the linker is called ld_sol2.
+
+--- configure
++++ configure
+@@ -1383,7 +1383,7 @@
+ case $lt_cv_prog_gnu_ld in
+ yes*)
+ case $host in
+- i?86-*-solaris*)
++ i?86-*-solaris*|x86_64-*-solaris*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ sparc*-*-solaris*)
diff --git a/eclass/ELT-patches/sol2-ltmain/2.4.2 b/eclass/ELT-patches/sol2-ltmain/2.4.2
new file mode 100644
index 00000000000..ad35ed88db4
--- /dev/null
+++ b/eclass/ELT-patches/sol2-ltmain/2.4.2
@@ -0,0 +1,11 @@
+--- libltdl/config/ltmain.sh
++++ libltdl/config/ltmain.sh
+@@ -1180,7 +1180,7 @@
+ test "$opt_debug" = : || func_append preserve_args " --debug"
+
+ case $host in
+- *cygwin* | *mingw* | *pw32* | *cegcc*)
++ *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2*)
+ # don't eliminate duplications in $postdeps and $predeps
+ opt_duplicate_compiler_generated_deps=:
+ ;;
diff --git a/eclass/ELT-patches/sys-lib-dlsearch/2.4 b/eclass/ELT-patches/sys-lib-dlsearch/2.4
new file mode 100644
index 00000000000..89eb6992e39
--- /dev/null
+++ b/eclass/ELT-patches/sys-lib-dlsearch/2.4
@@ -0,0 +1,21 @@
+the linux target parses /etc/ld.so.conf to see what paths are
+searched at runtime, and hardcodes /lib /usr/lib as a fallback.
+this works poorly when cross-compiling, so tweak the behavior:
+ - search $SYSROOT/etc/ld.so.conf
+ - default to Gentoo's notion of the active multilib
+
+--- a/configure
++++ b/configure
+@@ -10405,9 +10405,9 @@
+ hardcode_into_libs=yes
+
+ # Append ld.so.conf contents to the search path
+- if test -f /etc/ld.so.conf; then
+- lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+- sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
++ if test -f "$SYSROOT"/etc/ld.so.conf; then
++ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < "$SYSROOT"/etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
++ sys_lib_dlsearch_path_spec="/@GENTOO_LIBDIR@ /usr/@GENTOO_LIBDIR@ $lt_ld_extra"
+ fi
+
+ # We used to test for /lib/ld.so.1 and disable shared libraries on
diff --git a/eclass/ELT-patches/target-nm/2.4.2 b/eclass/ELT-patches/target-nm/2.4.2
new file mode 100644
index 00000000000..1f22220b6fd
--- /dev/null
+++ b/eclass/ELT-patches/target-nm/2.4.2
@@ -0,0 +1,45 @@
+https://bugs.gentoo.org/465558
+
+From a4629ebff263dcb2e05feb9e41df649ea5ce3f78 Mon Sep 17 00:00:00 2001
+From: Peter Rosin <peda@lysator.liu.se>
+Date: Sun, 28 Apr 2013 09:16:56 +0200
+Subject: [PATCH] libtool: break all the way out when a good nm is found
+
+The current code tries to locate a compatible nm tool. It starts with
+a prefixed nm tool (great!) and includes a plain nm too (that's fine).
+The problem is that the code searches for the prefixed nm before the
+plain nm (normally fine), but doesn't break once it has found a valid
+match, and the plain nm ends up the winner.
+
+Report and analysis by Mike Frysinger.
+
+* m4/libtool.m4 (LT_PATH_NM): Break all the way out on a good match.
+
+Signed-off-by: Peter Rosin <peda@lysator.liu.se>
+---
+ m4/libtool.m4 | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/m4/libtool.m4 b/m4/libtool.m4
+index 3f50b0c..d7013c5 100644
+--- a/m4/libtool.m4
++++ b/m4/libtool.m4
+@@ -3397,13 +3397,13 @@ else
+ case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+ */dev/null* | *'Invalid file or object type'*)
+ lt_cv_path_NM="$tmp_nm -B"
+- break
++ break 2
+ ;;
+ *)
+ case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+ */dev/null*)
+ lt_cv_path_NM="$tmp_nm -p"
+- break
++ break 2
+ ;;
+ *)
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+--
+1.8.2.1
+
diff --git a/eclass/ELT-patches/test/1.4.0 b/eclass/ELT-patches/test/1.4.0
new file mode 100644
index 00000000000..d6f442f0e38
--- /dev/null
+++ b/eclass/ELT-patches/test/1.4.0
@@ -0,0 +1,291 @@
+--- ltmain.sh Tue May 29 19:16:03 2001
++++ ltmain.sh Tue May 29 21:26:50 2001
+@@ -459,7 +459,7 @@
+ pic_mode=default
+ ;;
+ esac
+- if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then
++ if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+ # non-PIC code in shared libraries is not supported
+ pic_mode=default
+ fi
+@@ -1343,7 +1343,7 @@
+ ;;
+ esac
+ for pass in $passes; do
+- if test $linkmode = prog; then
++ if test "$linkmode" = prog; then
+ # Determine which files to process
+ case $pass in
+ dlopen)
+@@ -1360,11 +1360,11 @@
+ found=no
+ case $deplib in
+ -l*)
+- if test $linkmode = oldlib && test $linkmode = obj; then
++ if test "$linkmode" = oldlib && test "$linkmode" = obj; then
+ $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
+ continue
+ fi
+- if test $pass = conv; then
++ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+@@ -1384,7 +1384,7 @@
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+- test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
++ test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+ fi
+ continue
+ fi
+@@ -1393,16 +1393,16 @@
+ case $linkmode in
+ lib)
+ deplibs="$deplib $deplibs"
+- test $pass = conv && continue
++ test "$pass" = conv && continue
+ newdependency_libs="$deplib $newdependency_libs"
+ newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+ ;;
+ prog)
+- if test $pass = conv; then
++ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+- if test $pass = scan; then
++ if test "$pass" = scan; then
+ deplibs="$deplib $deplibs"
+ newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+ else
+@@ -1417,7 +1417,7 @@
+ continue
+ ;; # -L
+ -R*)
+- if test $pass = link; then
++ if test "$pass" = link; then
+ dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
+ # Make sure the xrpath contains only unique directories.
+ case "$xrpath " in
+@@ -1430,7 +1430,7 @@
+ ;;
+ *.la) lib="$deplib" ;;
+ *.$libext)
+- if test $pass = conv; then
++ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+@@ -1451,7 +1451,7 @@
+ continue
+ ;;
+ prog)
+- if test $pass != link; then
++ if test "$pass" != link; then
+ deplibs="$deplib $deplibs"
+ else
+ compile_deplibs="$deplib $compile_deplibs"
+@@ -1462,7 +1462,7 @@
+ esac # linkmode
+ ;; # *.$libext
+ *.lo | *.$objext)
+- if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
++ if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+ # If there is no dlopen support or we're linking statically,
+ # we need to preload.
+ newdlprefiles="$newdlprefiles $deplib"
+@@ -1512,13 +1512,13 @@
+
+ if test "$linkmode,$pass" = "lib,link" ||
+ test "$linkmode,$pass" = "prog,scan" ||
+- { test $linkmode = oldlib && test $linkmode = obj; }; then
++ { test "$linkmode" = oldlib && test "$linkmode" = obj; }; then
+ # Add dl[pre]opened files of deplib
+ test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
+ test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
+ fi
+
+- if test $pass = conv; then
++ if test "$pass" = conv; then
+ # Only check for convenience libraries
+ deplibs="$lib $deplibs"
+ if test -z "$libdir"; then
+@@ -1537,7 +1537,7 @@
+ esac
+ tmp_libs="$tmp_libs $deplib"
+ done
+- elif test $linkmode != prog && test $linkmode != lib; then
++ elif test "$linkmode" != prog && test "$linkmode" != lib; then
+ $echo "$modename: \`$lib' is not a convenience library" 1>&2
+ exit 1
+ fi
+@@ -1555,7 +1555,7 @@
+ fi
+
+ # This library was specified with -dlopen.
+- if test $pass = dlopen; then
++ if test "$pass" = dlopen; then
+ if test -z "$libdir"; then
+ $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
+ exit 1
+@@ -1604,7 +1604,7 @@
+ name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+
+ # This library was specified with -dlpreopen.
+- if test $pass = dlpreopen; then
++ if test "$pass" = dlpreopen; then
+ if test -z "$libdir"; then
+ $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
+ exit 1
+@@ -1623,7 +1623,7 @@
+
+ if test -z "$libdir"; then
+ # Link the convenience library
+- if test $linkmode = lib; then
++ if test "$linkmode" = lib; then
+ deplibs="$dir/$old_library $deplibs"
+ elif test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$dir/$old_library $compile_deplibs"
+@@ -1634,7 +1634,7 @@
+ continue
+ fi
+
+- if test $linkmode = prog && test $pass != link; then
++ if test "$linkmode" = prog && test "$pass" != link; then
+ newlib_search_path="$newlib_search_path $ladir"
+ deplibs="$lib $deplibs"
+
+@@ -1671,7 +1671,7 @@
+ # Link against this shared library
+
+ if test "$linkmode,$pass" = "prog,link" ||
+- { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
++ { test "$linkmode" = lib && test "$hardcode_into_libs" = yes; }; then
+ # Hardcode the library path.
+ # Skip directories that are in the system default run-time
+ # search path.
+@@ -1693,7 +1693,7 @@
+ esac
+ ;;
+ esac
+- if test $linkmode = prog; then
++ if test "$linkmode" = prog; then
+ # We need to hardcode the library path
+ if test -n "$shlibpath_var"; then
+ # Make sure the rpath contains only unique directories.
+@@ -1777,7 +1777,7 @@
+ linklib=$newlib
+ fi # test -n $old_archive_from_expsyms_cmds
+
+- if test $linkmode = prog || test "$mode" != relink; then
++ if test "$linkmode" = prog || test "$mode" != relink; then
+ add_shlibpath=
+ add_dir=
+ add=
+@@ -1826,7 +1826,7 @@
+ *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
+ esac
+ fi
+- if test $linkmode = prog; then
++ if test "$linkmode" = prog; then
+ test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+ test -n "$add" && compile_deplibs="$add $compile_deplibs"
+ else
+@@ -1843,7 +1843,7 @@
+ fi
+ fi
+
+- if test $linkmode = prog || test "$mode" = relink; then
++ if test "$linkmode" = prog || test "$mode" = relink; then
+ add_shlibpath=
+ add_dir=
+ add=
+@@ -1865,7 +1865,7 @@
+ add="-l$name"
+ fi
+
+- if test $linkmode = prog; then
++ if test "$linkmode" = prog; then
+ test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+ test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+ else
+@@ -1873,7 +1873,7 @@
+ test -n "$add" && deplibs="$add $deplibs"
+ fi
+ fi
+- elif test $linkmode = prog; then
++ elif test "$linkmode" = prog; then
+ if test "$alldeplibs" = yes &&
+ { test "$deplibs_check_method" = pass_all ||
+ { test "$build_libtool_libs" = yes &&
+@@ -1932,9 +1932,9 @@
+ fi
+ fi # link shared/static library?
+
+- if test $linkmode = lib; then
++ if test "$linkmode" = lib; then
+ if test -n "$dependency_libs" &&
+- { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
++ { test "$hardcode_into_libs" != yes || test $build_old_libs = yes ||
+ test $link_static = yes; }; then
+ # Extract -R from dependency_libs
+ temp_deplibs=
+@@ -1964,7 +1964,7 @@
+ tmp_libs="$tmp_libs $deplib"
+ done
+
+- if test $link_all_deplibs != no; then
++ if test "$link_all_deplibs" != no; then
+ # Add the search paths of all dependency libraries
+ for deplib in $dependency_libs; do
+ case $deplib in
+@@ -2007,15 +2007,15 @@
+ fi # link_all_deplibs != no
+ fi # linkmode = lib
+ done # for deplib in $libs
+- if test $pass = dlpreopen; then
++ if test "$pass" = dlpreopen; then
+ # Link the dlpreopened libraries before other libraries
+ for deplib in $save_deplibs; do
+ deplibs="$deplib $deplibs"
+ done
+ fi
+- if test $pass != dlopen; then
+- test $pass != scan && dependency_libs="$newdependency_libs"
+- if test $pass != conv; then
++ if test "$pass" != dlopen; then
++ test "$pass" != scan && dependency_libs="$newdependency_libs"
++ if test "$pass" != conv; then
+ # Make sure lib_search_path contains only unique directories.
+ lib_search_path=
+ for dir in $newlib_search_path; do
+@@ -2073,7 +2073,7 @@
+ deplibs=
+ fi
+ done # for pass
+- if test $linkmode = prog; then
++ if test "$linkmode" = prog; then
+ dlfiles="$newdlfiles"
+ dlprefiles="$newdlprefiles"
+ fi
+@@ -2410,7 +2410,7 @@
+ ;;
+ *)
+ # Add libc to deplibs on all other systems if necessary.
+- if test $build_libtool_need_lc = "yes"; then
++ if test "$build_libtool_need_lc" = "yes"; then
+ deplibs="$deplibs -lc"
+ fi
+ ;;
+@@ -2683,7 +2683,7 @@
+
+ # Test again, we may have decided not to build it any more
+ if test "$build_libtool_libs" = yes; then
+- if test $hardcode_into_libs = yes; then
++ if test "$hardcode_into_libs" = yes; then
+ # Hardcode the library paths
+ hardcode_libdirs=
+ dep_rpath=
diff --git a/eclass/ELT-patches/test/1.4.2 b/eclass/ELT-patches/test/1.4.2
new file mode 100644
index 00000000000..8ae65ef0028
--- /dev/null
+++ b/eclass/ELT-patches/test/1.4.2
@@ -0,0 +1,578 @@
+--- ltmain.sh 2001-09-10 19:40:18.000000000 -0400
++++ ltmain.sh 2002-07-11 14:49:35.000000000 -0400
+@@ -467,7 +467,7 @@ if test -z "$show_help"; then
+ pic_mode=default
+ ;;
+ esac
+- if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then
++ if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+ # non-PIC code in shared libraries is not supported
+ pic_mode=default
+ fi
+@@ -1303,11 +1303,11 @@ compiler."
+ output_objdir="$output_objdir/$objdir"
+ fi
+ # Create the object directory.
+- if test ! -d $output_objdir; then
++ if test ! -d "$output_objdir"; then
+ $show "$mkdir $output_objdir"
+ $run $mkdir $output_objdir
+ status=$?
+- if test $status -ne 0 && test ! -d $output_objdir; then
++ if test "$status" -ne 0 && test ! -d "$output_objdir"; then
+ exit $status
+ fi
+ fi
+@@ -1366,7 +1366,7 @@ compiler."
+ ;;
+ esac
+ for pass in $passes; do
+- if test $linkmode = prog; then
++ if test "$linkmode" = prog; then
+ # Determine which files to process
+ case $pass in
+ dlopen)
+@@ -1383,11 +1383,11 @@ compiler."
+ found=no
+ case $deplib in
+ -l*)
+- if test $linkmode = oldlib && test $linkmode = obj; then
++ if test "$linkmode" = oldlib && test "$linkmode" = obj; then
+ $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
+ continue
+ fi
+- if test $pass = conv; then
++ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+@@ -1407,7 +1407,7 @@ compiler."
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+- test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
++ test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+ fi
+ continue
+ fi
+@@ -1416,16 +1416,16 @@ compiler."
+ case $linkmode in
+ lib)
+ deplibs="$deplib $deplibs"
+- test $pass = conv && continue
++ test "$pass" = conv && continue
+ newdependency_libs="$deplib $newdependency_libs"
+ newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+ ;;
+ prog)
+- if test $pass = conv; then
++ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+- if test $pass = scan; then
++ if test "$pass" = scan; then
+ deplibs="$deplib $deplibs"
+ newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+ else
+@@ -1440,7 +1440,7 @@ compiler."
+ continue
+ ;; # -L
+ -R*)
+- if test $pass = link; then
++ if test "$pass" = link; then
+ dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
+ # Make sure the xrpath contains only unique directories.
+ case "$xrpath " in
+@@ -1453,7 +1453,7 @@ compiler."
+ ;;
+ *.la) lib="$deplib" ;;
+ *.$libext)
+- if test $pass = conv; then
++ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+@@ -1474,7 +1474,7 @@ compiler."
+ continue
+ ;;
+ prog)
+- if test $pass != link; then
++ if test "$pass" != link; then
+ deplibs="$deplib $deplibs"
+ else
+ compile_deplibs="$deplib $compile_deplibs"
+@@ -1485,7 +1485,7 @@ compiler."
+ esac # linkmode
+ ;; # *.$libext
+ *.lo | *.$objext)
+- if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
++ if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+ # If there is no dlopen support or we're linking statically,
+ # we need to preload.
+ newdlprefiles="$newdlprefiles $deplib"
+@@ -1501,7 +1501,7 @@ compiler."
+ continue
+ ;;
+ esac # case $deplib
+- if test $found = yes || test -f "$lib"; then :
++ if test "$found" = yes || test -f "$lib"; then :
+ else
+ $echo "$modename: cannot find the library \`$lib'" 1>&2
+ exit 1
+@@ -1535,13 +1535,13 @@ compiler."
+
+ if test "$linkmode,$pass" = "lib,link" ||
+ test "$linkmode,$pass" = "prog,scan" ||
+- { test $linkmode = oldlib && test $linkmode = obj; }; then
++ { test "$linkmode" = oldlib && test "$linkmode" = obj; }; then
+ # Add dl[pre]opened files of deplib
+ test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
+ test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
+ fi
+
+- if test $pass = conv; then
++ if test "$pass" = conv; then
+ # Only check for convenience libraries
+ deplibs="$lib $deplibs"
+ if test -z "$libdir"; then
+@@ -1560,7 +1560,7 @@ compiler."
+ esac
+ tmp_libs="$tmp_libs $deplib"
+ done
+- elif test $linkmode != prog && test $linkmode != lib; then
++ elif test "$linkmode" != prog && test "$linkmode" != lib; then
+ $echo "$modename: \`$lib' is not a convenience library" 1>&2
+ exit 1
+ fi
+@@ -1578,7 +1578,7 @@ compiler."
+ fi
+
+ # This library was specified with -dlopen.
+- if test $pass = dlopen; then
++ if test "$pass" = dlopen; then
+ if test -z "$libdir"; then
+ $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
+ exit 1
+@@ -1627,7 +1627,7 @@ compiler."
+ name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+
+ # This library was specified with -dlpreopen.
+- if test $pass = dlpreopen; then
++ if test "$pass" = dlpreopen; then
+ if test -z "$libdir"; then
+ $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
+ exit 1
+@@ -1646,7 +1646,7 @@ compiler."
+
+ if test -z "$libdir"; then
+ # Link the convenience library
+- if test $linkmode = lib; then
++ if test "$linkmode" = lib; then
+ deplibs="$dir/$old_library $deplibs"
+ elif test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$dir/$old_library $compile_deplibs"
+@@ -1657,7 +1657,7 @@ compiler."
+ continue
+ fi
+
+- if test $linkmode = prog && test $pass != link; then
++ if test "$linkmode" = prog && test "$pass" != link; then
+ newlib_search_path="$newlib_search_path $ladir"
+ deplibs="$lib $deplibs"
+
+@@ -1673,7 +1673,7 @@ compiler."
+ -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
+ esac
+ # Need to link against all dependency_libs?
+- if test $linkalldeplibs = yes; then
++ if test "$linkalldeplibs" = yes; then
+ deplibs="$deplib $deplibs"
+ else
+ # Need to hardcode shared library paths
+@@ -1694,7 +1694,7 @@ compiler."
+ # Link against this shared library
+
+ if test "$linkmode,$pass" = "prog,link" ||
+- { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
++ { test "$linkmode" = lib && test "$hardcode_into_libs" = yes; }; then
+ # Hardcode the library path.
+ # Skip directories that are in the system default run-time
+ # search path.
+@@ -1716,7 +1716,7 @@ compiler."
+ esac
+ ;;
+ esac
+- if test $linkmode = prog; then
++ if test "$linkmode" = prog; then
+ # We need to hardcode the library path
+ if test -n "$shlibpath_var"; then
+ # Make sure the rpath contains only unique directories.
+@@ -1798,9 +1798,9 @@ compiler."
+ # make sure the library variables are pointing to the new library
+ dir=$output_objdir
+ linklib=$newlib
+- fi # test -n $old_archive_from_expsyms_cmds
++ fi # test -n "$old_archive_from_expsyms_cmds"
+
+- if test $linkmode = prog || test "$mode" != relink; then
++ if test "$linkmode" = prog || test "$mode" != relink; then
+ add_shlibpath=
+ add_dir=
+ add=
+@@ -1849,7 +1849,7 @@ compiler."
+ *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
+ esac
+ fi
+- if test $linkmode = prog; then
++ if test "$linkmode" = prog; then
+ test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+ test -n "$add" && compile_deplibs="$add $compile_deplibs"
+ else
+@@ -1866,7 +1866,7 @@ compiler."
+ fi
+ fi
+
+- if test $linkmode = prog || test "$mode" = relink; then
++ if test "$linkmode" = prog || test "$mode" = relink; then
+ add_shlibpath=
+ add_dir=
+ add=
+@@ -1888,7 +1888,7 @@ compiler."
+ add="-l$name"
+ fi
+
+- if test $linkmode = prog; then
++ if test "$linkmode" = prog; then
+ test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+ test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+ else
+@@ -1896,7 +1896,7 @@ compiler."
+ test -n "$add" && deplibs="$add $deplibs"
+ fi
+ fi
+- elif test $linkmode = prog; then
++ elif test "$linkmode" = prog; then
+ if test "$alldeplibs" = yes &&
+ { test "$deplibs_check_method" = pass_all ||
+ { test "$build_libtool_libs" = yes &&
+@@ -1955,10 +1955,10 @@ compiler."
+ fi
+ fi # link shared/static library?
+
+- if test $linkmode = lib; then
++ if test "$linkmode" = lib; then
+ if test -n "$dependency_libs" &&
+- { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
+- test $link_static = yes; }; then
++ { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes ||
++ test "$link_static" = yes; }; then
+ # Extract -R from dependency_libs
+ temp_deplibs=
+ for libdir in $dependency_libs; do
+@@ -1987,7 +1987,7 @@ compiler."
+ tmp_libs="$tmp_libs $deplib"
+ done
+
+- if test $link_all_deplibs != no; then
++ if test "$link_all_deplibs" != no; then
+ # Add the search paths of all dependency libraries
+ for deplib in $dependency_libs; do
+ case $deplib in
+@@ -2030,15 +2030,15 @@ compiler."
+ fi # link_all_deplibs != no
+ fi # linkmode = lib
+ done # for deplib in $libs
+- if test $pass = dlpreopen; then
++ if test "$pass" = dlpreopen; then
+ # Link the dlpreopened libraries before other libraries
+ for deplib in $save_deplibs; do
+ deplibs="$deplib $deplibs"
+ done
+ fi
+- if test $pass != dlopen; then
+- test $pass != scan && dependency_libs="$newdependency_libs"
+- if test $pass != conv; then
++ if test "$pass" != dlopen; then
++ test "$pass" != scan && dependency_libs="$newdependency_libs"
++ if test "$pass" != conv; then
+ # Make sure lib_search_path contains only unique directories.
+ lib_search_path=
+ for dir in $newlib_search_path; do
+@@ -2096,7 +2096,7 @@ compiler."
+ deplibs=
+ fi
+ done # for pass
+- if test $linkmode = prog; then
++ if test "$linkmode" = prog; then
+ dlfiles="$newdlfiles"
+ dlprefiles="$newdlprefiles"
+ fi
+@@ -2173,7 +2173,7 @@ compiler."
+ fi
+
+ set dummy $rpath
+- if test $# -gt 2; then
++ if test "$#" -gt 2; then
+ $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
+ fi
+ install_libdir="$2"
+@@ -2240,7 +2240,7 @@ compiler."
+ ;;
+ esac
+
+- if test $age -gt $current; then
++ if test "$age" -gt "$current"; then
+ $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit 1
+@@ -2279,7 +2279,7 @@ compiler."
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$revision
+- while test $loop != 0; do
++ while test "$loop" -ne 0; do
+ iface=`expr $revision - $loop`
+ loop=`expr $loop - 1`
+ verstring="sgi$major.$iface:$verstring"
+@@ -2302,7 +2302,7 @@ compiler."
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$age
+- while test $loop != 0; do
++ while test "$loop" -ne 0; do
+ iface=`expr $current - $loop`
+ loop=`expr $loop - 1`
+ verstring="$verstring:${iface}.0"
+@@ -2403,7 +2403,7 @@ compiler."
+ *) finalize_rpath="$finalize_rpath $libdir" ;;
+ esac
+ done
+- if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
++ if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
+ dependency_libs="$temp_xrpath $dependency_libs"
+ fi
+ fi
+@@ -2446,7 +2446,7 @@ compiler."
+ ;;
+ *)
+ # Add libc to deplibs on all other systems if necessary.
+- if test $build_libtool_need_lc = "yes"; then
++ if test "$build_libtool_need_lc" = "yes"; then
+ deplibs="$deplibs -lc"
+ fi
+ ;;
+@@ -2487,7 +2487,7 @@ compiler."
+ EOF
+ $rm conftest
+ $CC -o conftest conftest.c $deplibs
+- if test $? -eq 0 ; then
++ if test "$?" -eq 0 ; then
+ ldd_output=`ldd conftest`
+ for i in $deplibs; do
+ name="`expr $i : '-l\(.*\)'`"
+@@ -2521,7 +2521,7 @@ EOF
+ $rm conftest
+ $CC -o conftest conftest.c $i
+ # Did it work?
+- if test $? -eq 0 ; then
++ if test "$?" -eq 0 ; then
+ ldd_output=`ldd conftest`
+ libname=`eval \\$echo \"$libname_spec\"`
+ deplib_matches=`eval \\$echo \"$library_names_spec\"`
+@@ -2692,7 +2692,7 @@ EOF
+ echo "*** automatically added whenever a program is linked with this library"
+ echo "*** or is declared to -dlopen it."
+
+- if test $allow_undefined = no; then
++ if test "$allow_undefined" = no; then
+ echo
+ echo "*** Since this library must not contain undefined symbols,"
+ echo "*** because either the platform does not support them or"
+@@ -2719,7 +2719,7 @@ EOF
+
+ # Test again, we may have decided not to build it any more
+ if test "$build_libtool_libs" = yes; then
+- if test $hardcode_into_libs = yes; then
++ if test "$hardcode_into_libs" = yes; then
+ # Hardcode the library paths
+ hardcode_libdirs=
+ dep_rpath=
+@@ -2850,7 +2850,7 @@ EOF
+ $show "mkdir $gentop"
+ $run mkdir "$gentop"
+ status=$?
+- if test $status -ne 0 && test ! -d "$gentop"; then
++ if test "$status" -ne 0 && test ! -d "$gentop"; then
+ exit $status
+ fi
+ generated="$generated $gentop"
+@@ -2869,7 +2869,7 @@ EOF
+ $show "mkdir $xdir"
+ $run mkdir "$xdir"
+ status=$?
+- if test $status -ne 0 && test ! -d "$xdir"; then
++ if test "$status" -ne 0 && test ! -d "$xdir"; then
+ exit $status
+ fi
+ $show "(cd $xdir && $AR x $xabs)"
+@@ -2989,7 +2989,7 @@ EOF
+ $show "mkdir $gentop"
+ $run mkdir "$gentop"
+ status=$?
+- if test $status -ne 0 && test ! -d "$gentop"; then
++ if test "$status" -ne 0 && test ! -d "$gentop"; then
+ exit $status
+ fi
+ generated="$generated $gentop"
+@@ -3008,7 +3008,7 @@ EOF
+ $show "mkdir $xdir"
+ $run mkdir "$xdir"
+ status=$?
+- if test $status -ne 0 && test ! -d "$xdir"; then
++ if test "$status" -ne 0 && test ! -d "$xdir"; then
+ exit $status
+ fi
+ $show "(cd $xdir && $AR x $xabs)"
+@@ -3403,7 +3403,7 @@ static const void *lt_preloaded_setup()
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
+ fi
+
+- if test $need_relink = no || test "$build_libtool_libs" != yes; then
++ if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
+ # Replace the output file specification.
+ compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+ link_command="$compile_command$compile_rpath"
+@@ -3528,7 +3528,7 @@ static const void *lt_preloaded_setup()
+ relink_command="$var=\"$var_value\"; export $var; $relink_command"
+ fi
+ done
+- relink_command="cd `pwd`; $relink_command"
++ relink_command="(cd `pwd`; $relink_command)"
+ relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+ fi
+
+@@ -3771,7 +3771,7 @@ fi\
+ $show "mkdir $gentop"
+ $run mkdir "$gentop"
+ status=$?
+- if test $status -ne 0 && test ! -d "$gentop"; then
++ if test "$status" -ne 0 && test ! -d "$gentop"; then
+ exit $status
+ fi
+ generated="$generated $gentop"
+@@ -3791,7 +3791,7 @@ fi\
+ $show "mkdir $xdir"
+ $run mkdir "$xdir"
+ status=$?
+- if test $status -ne 0 && test ! -d "$xdir"; then
++ if test "$status" -ne 0 && test ! -d "$xdir"; then
+ exit $status
+ fi
+ $show "(cd $xdir && $AR x $xabs)"
+@@ -3858,7 +3858,7 @@ fi\
+ fi
+ done
+ # Quote the link command for shipping.
+- relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args"
++ relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args)"
+ relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+
+ # Only create the output if not a dry run.
+@@ -3948,7 +3948,7 @@ dlpreopen='$dlprefiles'
+
+ # Directory that this library needs to be installed in:
+ libdir='$install_libdir'"
+- if test "$installed" = no && test $need_relink = yes; then
++ if test "$installed" = no && test "$need_relink" = yes; then
+ $echo >> $output "\
+ relink_command=\"$relink_command\""
+ fi
+@@ -4084,7 +4084,7 @@ relink_command=\"$relink_command\""
+
+ # Not a directory, so check to see that there is only one file specified.
+ set dummy $files
+- if test $# -gt 2; then
++ if test "$#" -gt 2; then
+ $echo "$modename: \`$dest' is not a directory" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+@@ -4186,7 +4186,7 @@ relink_command=\"$relink_command\""
+ $run eval "$striplib $destdir/$realname" || exit $?
+ fi
+
+- if test $# -gt 0; then
++ if test "$#" -gt 0; then
+ # Delete the old symlinks, and create new ones.
+ for linkname
+ do
+@@ -4444,7 +4444,7 @@ relink_command=\"$relink_command\""
+ fi
+
+ # Exit here if they wanted silent mode.
+- test "$show" = ":" && exit 0
++ test "$show" = : && exit 0
+
+ echo "----------------------------------------------------------------------"
+ echo "Libraries have been installed in:"
+@@ -4610,7 +4610,7 @@ relink_command=\"$relink_command\""
+ fi
+
+ # Now prepare to actually exec the command.
+- exec_cmd='"$cmd"$args'
++ exec_cmd="\$cmd$args"
+ else
+ # Display what would be done.
+ if test -n "$shlibpath_var"; then
+@@ -4660,10 +4660,10 @@ relink_command=\"$relink_command\""
+ objdir="$dir/$objdir"
+ fi
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+- test $mode = uninstall && objdir="$dir"
++ test "$mode" = uninstall && objdir="$dir"
+
+ # Remember objdir for removal later, being careful to avoid duplicates
+- if test $mode = clean; then
++ if test "$mode" = clean; then
+ case " $rmdirs " in
+ *" $objdir "*) ;;
+ *) rmdirs="$rmdirs $objdir" ;;
+@@ -4695,9 +4695,9 @@ relink_command=\"$relink_command\""
+ rmfiles="$rmfiles $objdir/$n"
+ done
+ test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
+- test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
++ test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
+
+- if test $mode = uninstall; then
++ if test "$mode" = uninstall; then
+ if test -n "$library_names"; then
+ # Do each command in the postuninstall commands.
+ eval cmds=\"$postuninstall_cmds\"
+@@ -4706,7 +4706,7 @@ relink_command=\"$relink_command\""
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd"
+- if test $? != 0 && test "$rmforce" != yes; then
++ if test "$?" -ne 0 && test "$rmforce" != yes; then
+ exit_status=1
+ fi
+ done
+@@ -4721,7 +4721,7 @@ relink_command=\"$relink_command\""
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd"
+- if test $? != 0 && test "$rmforce" != yes; then
++ if test "$?" -ne 0 && test "$rmforce" != yes; then
+ exit_status=1
+ fi
+ done
+@@ -4741,7 +4741,7 @@ relink_command=\"$relink_command\""
+
+ *)
+ # Do a test to see if this is a libtool program.
+- if test $mode = clean &&
++ if test "$mode" = clean &&
+ (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ relink_command=
+ . $dir/$file
diff --git a/eclass/ELT-patches/tmp/1.3.5 b/eclass/ELT-patches/tmp/1.3.5
new file mode 100644
index 00000000000..29b70e09378
--- /dev/null
+++ b/eclass/ELT-patches/tmp/1.3.5
@@ -0,0 +1,15 @@
+--- ltmain.sh Fri Jul 7 18:49:44 2000
++++ ltmain.sh Fri May 26 21:53:15 2000
+@@ -3462,7 +3462,11 @@
+ if test "$finalize" = yes && test -z "$run"; then
+ tmpdir="/tmp"
+ test -n "$TMPDIR" && tmpdir="$TMPDIR"
+- tmpdir="$tmpdir/libtool-$$"
++ tmpdir=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null`
++ if test $? = 0 ; then :
++ else
++ tmpdir="$tmpdir/libtool-$$"
++ fi
+ if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
+ else
+ $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
diff --git a/eclass/ELT-patches/uclibc-conf/1.2.0 b/eclass/ELT-patches/uclibc-conf/1.2.0
new file mode 100644
index 00000000000..acd804c8f40
--- /dev/null
+++ b/eclass/ELT-patches/uclibc-conf/1.2.0
@@ -0,0 +1,48 @@
+--- configure.libltdl~ Fri Jun 11 08:54:04 2004
++++ configure Fri Jun 11 08:56:33 2004
+@@ -1978,6 +1978,11 @@
+ lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc*.so`
++ ;;
++
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
+@@ -3030,7 +3035,7 @@
+
+ # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+ case $host_os in
+-linux-gnu*) ;;
++linux-gnu*|linux-uclibc*) ;;
+ linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+ esac
+
+@@ -4504,6 +4509,24 @@
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
++linux-uclibc*)
++ version_type=linux
++ need_lib_prefix=no
++ need_version=no
++ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
++ soname_spec='${libname}${release}.so$major'
++ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
++ shlibpath_var=LD_LIBRARY_PATH
++ shlibpath_overrides_runpath=no
++ # This implies no fast_install, which is unacceptable.
++ # Some rework will be needed to allow for fast_install
++ # before this can be enabled.
++ # Note: copied from linux-gnu, and may not be appropriate.
++ hardcode_into_libs=yes
++ # Assume using the uClibc dynamic linker.
++ dynamic_linker="uClibc ld.so"
++ ;;
++
+ netbsd*)
+ version_type=sunos
+ need_lib_prefix=no
diff --git a/eclass/ELT-patches/uclibc-conf/1.3.0c b/eclass/ELT-patches/uclibc-conf/1.3.0c
new file mode 100644
index 00000000000..03efc5dc9c8
--- /dev/null
+++ b/eclass/ELT-patches/uclibc-conf/1.3.0c
@@ -0,0 +1,48 @@
+--- configure.libltdl~ Fri Jun 11 08:54:04 2004
++++ configure Fri Jun 11 08:56:33 2004
+@@ -1978,6 +1978,11 @@
+ lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc*.so`
++ ;;
++
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
+@@ -3030,7 +3035,7 @@
+
+ # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+ case "$host_os" in
+-linux-gnu*) ;;
++linux-gnu*|linux-uclibc*) ;;
+ linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+ esac
+
+@@ -4504,6 +4509,24 @@
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
++linux-uclibc*)
++ version_type=linux
++ need_lib_prefix=no
++ need_version=no
++ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
++ soname_spec='${libname}${release}.so$major'
++ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
++ shlibpath_var=LD_LIBRARY_PATH
++ shlibpath_overrides_runpath=no
++ # This implies no fast_install, which is unacceptable.
++ # Some rework will be needed to allow for fast_install
++ # before this can be enabled.
++ # Note: copied from linux-gnu, and may not be appropriate.
++ hardcode_into_libs=yes
++ # Assume using the uClibc dynamic linker.
++ dynamic_linker="uClibc ld.so"
++ ;;
++
+ netbsd*)
+ version_type=sunos
+ need_lib_prefix=no
diff --git a/eclass/ELT-patches/uclibc-ltconf/1.2.0 b/eclass/ELT-patches/uclibc-ltconf/1.2.0
new file mode 100644
index 00000000000..bbc6bc96571
--- /dev/null
+++ b/eclass/ELT-patches/uclibc-ltconf/1.2.0
@@ -0,0 +1,36 @@
+--- ltconfig.uclibc 2004-01-14 22:07:42.000000000 +0100
++++ ltconfig 2004-03-10 15:43:37.000000000 +0100
+@@ -603,6 +603,7 @@
+ # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+ case $host_os in
+ linux-gnu*) ;;
++linux-uclibc*) ;;
+ linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+ esac
+
+@@ -1259,6 +1260,25 @@
+ fi
+ ;;
+
++linux-uclibc*)
++ version_type=linux
++ need_lib_prefix=no
++ need_version=no
++ library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major $libname.so'
++ soname_spec='${libname}${release}.so.$major'
++ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
++ shlibpath_var=LD_LIBRARY_PATH
++ shlibpath_overrides_runpath=no
++ deplibs_check_method=pass_all
++ # This implies no fast_install, which is unacceptable.
++ # Some rework will be needed to allow for fast_install
++ # before this can be enabled.
++ # Note: copied from linux-gnu, and may not be appropriate.
++ hardcode_into_libs=yes
++ # Assume using the uClibc dynamic linker.
++ dynamic_linker="uClibc ld.so"
++ ;;
++
+ netbsd* | openbsd*)
+ version_type=sunos
+ library_names_spec='${libname}${release}.so.$versuffix'
diff --git a/eclass/ELT-patches/uclibc-ltconf/1.3.0 b/eclass/ELT-patches/uclibc-ltconf/1.3.0
new file mode 100644
index 00000000000..0a5a9ead8f0
--- /dev/null
+++ b/eclass/ELT-patches/uclibc-ltconf/1.3.0
@@ -0,0 +1,39 @@
+--- ltconfig.uclibc 2004-01-14 22:07:42.000000000 +0100
++++ ltconfig 2004-03-10 15:43:37.000000000 +0100
+@@ -603,6 +603,7 @@
+ # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+ case $host_os in
+ linux-gnu*) ;;
++linux-uclibc*) ;;
+ linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+ esac
+
+@@ -1259,6 +1260,28 @@
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
++linux-uclibc*)
++ version_type=linux
++ need_lib_prefix=no
++ need_version=no
++ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
++ soname_spec='${libname}${release}.so$major'
++ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
++ shlibpath_var=LD_LIBRARY_PATH
++ shlibpath_overrides_runpath=no
++ # deplibs_check_method=pass_all
++ deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
++ file_magic_cmd=/usr/bin/file
++ file_magic_test_file=`echo /lib/libuClibc-*.so`
++ # This implies no fast_install, which is unacceptable.
++ # Some rework will be needed to allow for fast_install
++ # before this can be enabled.
++ # Note: copied from linux-gnu, and may not be appropriate.
++ hardcode_into_libs=yes
++ # Assume using the uClibc dynamic linker.
++ dynamic_linker="uClibc ld.so"
++ ;;
++
+ netbsd*)
+ need_lib_prefix=no
+ need_version=no
diff --git a/eclass/alternatives.eclass b/eclass/alternatives.eclass
new file mode 100644
index 00000000000..62633dc63e2
--- /dev/null
+++ b/eclass/alternatives.eclass
@@ -0,0 +1,143 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @ECLASS: alternatives.eclass
+# @AUTHOR:
+# Original author: Alastair Tse <liquidx@gentoo.org> (03 Oct 2003)
+# @BLURB: Creates symlink to the latest version of multiple slotted packages.
+# @DESCRIPTION:
+# When a package is SLOT'ed, very often we need to have a symlink to the
+# latest version. However, depending on the order the user has merged them,
+# more often than not, the symlink maybe clobbered by the older versions.
+#
+# This eclass provides a convenience function that needs to be given a
+# list of alternatives (descending order of recent-ness) and the symlink.
+# It will choose the latest version it can find installed and create
+# the desired symlink.
+#
+# There are two ways to use this eclass. First is by declaring two variables
+# $SOURCE and $ALTERNATIVES where $SOURCE is the symlink to be created and
+# $ALTERNATIVES is a list of alternatives. Second way is the use the function
+# alternatives_makesym() like the example below.
+# @EXAMPLE:
+# pkg_postinst() {
+# alternatives_makesym "/usr/bin/python" "/usr/bin/python2.3" "/usr/bin/python2.2"
+# }
+#
+# The above example will create a symlink at /usr/bin/python to either
+# /usr/bin/python2.3 or /usr/bin/python2.2. It will choose python2.3 over
+# python2.2 if both exist.
+#
+# Alternatively, you can use this function:
+#
+# pkg_postinst() {
+# alternatives_auto_makesym "/usr/bin/python" "/usr/bin/python[0-9].[0-9]"
+# }
+#
+# This will use bash pathname expansion to fill a list of alternatives it can
+# link to. It is probably more robust against version upgrades. You should
+# consider using this unless you are want to do something special.
+
+# @ECLASS-VARIABLE: SOURCE
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# The symlink to be created
+
+# @ECLASS-VARIABLE: ALTERNATIVES
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# The list of alternatives
+
+# @FUNCTION: alternatives_auto_makesym
+# @DESCRIPTION:
+# automatic deduction based on a symlink and a regex mask
+alternatives_auto_makesym() {
+ has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}"
+ local SYMLINK REGEX ALT myregex
+ SYMLINK=$1
+ REGEX=$2
+ if [ "${REGEX:0:1}" != "/" ]
+ then
+ #not an absolute path:
+ #inherit the root directory of our main link path for our regex search
+ myregex="${SYMLINK%/*}/${REGEX}"
+ else
+ myregex=${REGEX}
+ fi
+
+ # sort a space delimited string by converting it to a multiline list
+ # and then run sort -r over it.
+ # make sure we use ${EROOT} because otherwise stage-building will break
+ ALT="$(for i in $(echo ${EROOT}${myregex}); do echo ${i#${EROOT}}; done | sort -r)"
+ alternatives_makesym ${SYMLINK} ${ALT}
+}
+
+alternatives_makesym() {
+ has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
+ local ALTERNATIVES=""
+ local SYMLINK=""
+ local alt pref
+
+ # usage: alternatives_makesym <resulting symlink> [alternative targets..]
+ # make sure it is in the prefix, allow it already to be in the prefix
+ SYMLINK=${EPREFIX}/${1#${EPREFIX}}
+ # this trick removes the trailing / from ${ROOT}
+ pref=${ROOT%/}
+ shift
+ ALTERNATIVES=$@
+
+ # step through given alternatives from first to last
+ # and if one exists, link it and finish.
+
+ for alt in ${ALTERNATIVES}; do
+ alt=${EPREFIX}/${alt#${EPREFIX}}
+ if [ -f "${pref}${alt}" ]; then
+ #are files in same directory?
+ if [ "${alt%/*}" = "${SYMLINK%/*}" ]
+ then
+ #yes; strip leading dirname from alt to create relative symlink
+ einfo "Linking ${alt} to ${pref}${SYMLINK} (relative)"
+ ln -sf ${alt##*/} ${pref}${SYMLINK}
+ else
+ #no; keep absolute path
+ einfo "Linking ${alt} to ${pref}${SYMLINK} (absolute)"
+ ln -sf ${pref}${alt} ${pref}${SYMLINK}
+ fi
+ break
+ fi
+ done
+
+ # report any errors
+ if [ ! -L ${pref}${SYMLINK} ]; then
+ ewarn "Unable to establish ${pref}${SYMLINK} symlink"
+ else
+ # we need to check for either the target being in relative path form
+ # or absolute path form
+ if [ ! -f "`dirname ${pref}${SYMLINK}`/`readlink ${pref}${SYMLINK}`" -a \
+ ! -f "`readlink ${pref}${SYMLINK}`" ]; then
+ ewarn "Removing dead symlink ${pref}${SYMLINK}"
+ rm -f ${pref}${SYMLINK}
+ fi
+ fi
+}
+
+# @FUNCTION: alernatives-pkg_postinst
+# @DESCRIPTION:
+# The alternatives pkg_postinst, this function will be exported
+alternatives_pkg_postinst() {
+ if [ -n "${ALTERNATIVES}" -a -n "${SOURCE}" ]; then
+ alternatives_makesym ${SOURCE} ${ALTERNATIVES}
+ fi
+}
+
+# @FUNCTION: alternatives_pkg_postrm
+# @DESCRIPTION:
+# The alternatives pkg_postrm, this function will be exported
+alternatives_pkg_postrm() {
+ if [ -n "${ALTERNATIVES}" -a -n "${SOURCE}" ]; then
+ alternatives_makesym ${SOURCE} ${ALTERNATIVES}
+ fi
+}
+
+EXPORT_FUNCTIONS pkg_postinst pkg_postrm
diff --git a/eclass/ant-tasks.eclass b/eclass/ant-tasks.eclass
new file mode 100644
index 00000000000..fe9405d1da1
--- /dev/null
+++ b/eclass/ant-tasks.eclass
@@ -0,0 +1,180 @@
+# Eclass for building dev-java/ant-* packages
+#
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2 or later
+# Author Vlastimil Babka <caster@gentoo.org>
+# $Id$
+
+# @ECLASS: ant-tasks.eclass
+# @MAINTAINER:
+# java@gentoo.org
+# @AUTHOR:
+# Vlastimil Babka <caster@gentoo.org>
+# @BLURB: Eclass for building dev-java/ant-* packages
+# @DESCRIPTION:
+# This eclass provides functionality and default ebuild variables for building
+# dev-java/ant-* packages easily.
+
+
+# we set ant-core dep ourselves, restricted
+JAVA_ANT_DISABLE_ANT_CORE_DEP=true
+# rewriting build.xml for are the testcases has no reason atm
+JAVA_PKG_BSFIX_ALL=no
+inherit versionator java-pkg-2 java-ant-2
+
+EXPORT_FUNCTIONS src_unpack src_compile src_install
+
+# @ECLASS-VARIABLE: ANT_TASK_JDKVER
+# @DESCRIPTION:
+# Affects the >=virtual/jdk version set in DEPEND string. Defaults to 1.5, can
+# be overriden from ebuild BEFORE inheriting this eclass.
+ANT_TASK_JDKVER=${ANT_TASK_JDKVER-1.5}
+
+# @ECLASS-VARIABLE: ANT_TASK_JREVER
+# @DESCRIPTION:
+# Affects the >=virtual/jre version set in DEPEND string. Defaults to 1.5, can
+# be overriden from ebuild BEFORE inheriting this eclass.
+ANT_TASK_JREVER=${ANT_TASK_JREVER-1.5}
+
+# @ECLASS-VARIABLE: ANT_TASK_NAME
+# @DESCRIPTION:
+# The name of this ant task as recognized by ant's build.xml, derived from $PN
+# by removing the ant- prefix. Read-only.
+ANT_TASK_NAME="${PN#ant-}"
+
+# @ECLASS-VARIABLE: ANT_TASK_DEPNAME
+# @DESCRIPTION:
+# Specifies JAVA_PKG_NAME (PN{-SLOT} used with java-pkg_jar-from) of the package
+# that this one depends on. Defaults to the name of ant task, ebuild can
+# override it before inheriting this eclass.
+ANT_TASK_DEPNAME=${ANT_TASK_DEPNAME-${ANT_TASK_NAME}}
+
+# @ECLASS-VARIABLE: ANT_TASK_DISABLE_VM_DEPS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# If set, no JDK/JRE deps are added.
+
+# @VARIABLE: ANT_TASK_PV
+# @INTERNAL
+# Version of ant-core this task is intended to register and thus load with.
+ANT_TASK_PV="${PV}"
+
+# special care for beta/RC releases
+if [[ ${PV} == *beta2* ]]; then
+ MY_PV=${PV/_beta2/beta}
+ UPSTREAM_PREFIX="http://people.apache.org/dist/ant/v1.7.1beta2/src"
+ GENTOO_PREFIX="http://dev.gentoo.org/~caster/distfiles"
+ ANT_TASK_PV=$(get_version_component_range 1-3)
+elif [[ ${PV} == *_rc* ]]; then
+ MY_PV=${PV/_rc/RC}
+ UPSTREAM_PREFIX="http://dev.gentoo.org/~caster/distfiles"
+ GENTOO_PREFIX="http://dev.gentoo.org/~caster/distfiles"
+ ANT_TASK_PV=$(get_version_component_range 1-3)
+else
+ # default for final releases
+ MY_PV=${PV}
+ UPSTREAM_PREFIX="mirror://apache/ant/source"
+ case ${PV} in
+ 1.9.*)
+ GENTOO_PREFIX="http://dev.gentoo.org/~tomwij/files/dist"
+ ;;
+ 1.8.4)
+ GENTOO_PREFIX="http://dev.gentoo.org/~sera/distfiles"
+ ;;
+ *)
+ GENTOO_PREFIX="http://dev.gentoo.org/~caster/distfiles"
+ ;;
+ esac
+fi
+
+# source/workdir name
+MY_P="apache-ant-${MY_PV}"
+
+# Default values for standard ebuild variables, can be overriden from ebuild.
+DESCRIPTION="Apache Ant's optional tasks depending on ${ANT_TASK_DEPNAME}"
+HOMEPAGE="http://ant.apache.org/"
+SRC_URI="${UPSTREAM_PREFIX}/${MY_P}-src.tar.bz2
+ ${GENTOO_PREFIX}/ant-${PV}-gentoo.tar.bz2"
+LICENSE="Apache-2.0"
+SLOT="0"
+
+RDEPEND="~dev-java/ant-core-${PV}:0"
+DEPEND="${RDEPEND}"
+
+if [[ -z "${ANT_TASK_DISABLE_VM_DEPS}" ]]; then
+ RDEPEND+=" >=virtual/jre-${ANT_TASK_JREVER}"
+ DEPEND+=" >=virtual/jdk-${ANT_TASK_JDKVER}"
+fi
+
+# we need direct blockers with old ant-tasks for file collisions - bug #252324
+if version_is_at_least 1.7.1 ; then
+ DEPEND+=" !dev-java/ant-tasks"
+fi
+
+# Would run the full ant test suite for every ant task
+RESTRICT="test"
+
+S="${WORKDIR}/${MY_P}"
+
+# @FUNCTION: ant-tasks_src_unpack
+# @USAGE: [ base ] [ jar-dep ] [ all ]
+# @DESCRIPTION:
+# The function Is split into two parts, defaults to both of them ('all').
+#
+# base: performs the unpack, build.xml replacement and symlinks ant.jar from
+# ant-core
+#
+# jar-dep: symlinks the jar file(s) from dependency package
+ant-tasks_src_unpack() {
+ [[ -z "${1}" ]] && ant-tasks_src_unpack all
+
+ while [[ -n "${1}" ]]; do
+ case ${1} in
+ base)
+ unpack ${A}
+ cd "${S}"
+
+ # replace build.xml with our modified for split building
+ mv -f "${WORKDIR}"/build.xml .
+
+ cd lib
+ # remove bundled xerces
+ rm -f *.jar
+
+ # ant.jar to build against
+ java-pkg_jar-from --build-only ant-core ant.jar;;
+ jar-dep)
+ # get jar from the dependency package
+ if [[ -n "${ANT_TASK_DEPNAME}" ]]; then
+ java-pkg_jar-from ${ANT_TASK_DEPNAME}
+ fi;;
+ all)
+ ant-tasks_src_unpack base jar-dep;;
+ esac
+ shift
+ done
+
+}
+
+# @FUNCTION: ant-tasks_src_compile
+# @DESCRIPTION:
+# Compiles the jar with installed ant-core.
+ant-tasks_src_compile() {
+ ANT_TASKS="none" eant -Dbuild.dep=${ANT_TASK_NAME} jar-dep
+}
+
+# @FUNCTION: ant-tasks_src_install
+# @DESCRIPTION:
+# Installs the jar and registers its presence for the ant launcher script.
+# Version param ensures it won't get loaded (thus break) when ant-core is
+# updated to newer version.
+ant-tasks_src_install() {
+ java-pkg_dojar build/lib/${PN}.jar
+ java-pkg_register-ant-task --version "${ANT_TASK_PV}"
+
+ # create the compatibility symlink
+ if version_is_at_least 1.7.1_beta2; then
+ dodir /usr/share/ant/lib
+ dosym /usr/share/${PN}/lib/${PN}.jar /usr/share/ant/lib/${PN}.jar
+ fi
+}
diff --git a/eclass/apache-2.eclass b/eclass/apache-2.eclass
new file mode 100644
index 00000000000..549b43abcd6
--- /dev/null
+++ b/eclass/apache-2.eclass
@@ -0,0 +1,631 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @ECLASS: apache-2.eclass
+# @MAINTAINER:
+# polynomial-c@gentoo.org
+# @BLURB: Provides a common set of functions for apache-2.x ebuilds
+# @DESCRIPTION:
+# This eclass handles apache-2.x ebuild functions such as LoadModule generation
+# and inter-module dependency checking.
+
+inherit autotools eutils flag-o-matic multilib ssl-cert user toolchain-funcs versionator
+
+[[ ${CATEGORY}/${PN} != www-servers/apache ]] \
+ && die "Do not use this eclass with anything else than www-servers/apache ebuilds!"
+
+case ${EAPI:-0} in
+ 0|1|2|3|4)
+ die "This eclass requires >=EAPI-5"
+ ;;
+esac
+
+# settings which are version specific go in here:
+case $(get_version_component_range 1-2) in
+ 2.4)
+ DEFAULT_MPM_THREADED="event" #509922
+ RDEPEND=">=dev-libs/apr-1.5.1
+ !www-apache/mod_macro" #492578 #477702
+ ;;
+ *)
+ DEFAULT_MPM_THREADED="worker"
+ RDEPEND=">=dev-libs/apr-1.4.5" #368651
+ ;;
+esac
+
+# ==============================================================================
+# INTERNAL VARIABLES
+# ==============================================================================
+
+# @ECLASS-VARIABLE: GENTOO_PATCHNAME
+# @DESCRIPTION:
+# This internal variable contains the prefix for the patch tarball.
+# Defaults to the full name and version (including revision) of the package.
+# If you want to override this in an ebuild, use:
+# ORIG_PR="(revision of Gentoo stuff you want)"
+# GENTOO_PATCHNAME="gentoo-${PN}-${PV}${ORIG_PR:+-${ORIG_PR}}"
+[[ -n "$GENTOO_PATCHNAME" ]] || GENTOO_PATCHNAME="gentoo-${PF}"
+
+# @ECLASS-VARIABLE: GENTOO_PATCHDIR
+# @DESCRIPTION:
+# This internal variable contains the working directory where patches and config
+# files are located.
+# Defaults to the patchset name appended to the working directory.
+[[ -n "$GENTOO_PATCHDIR" ]] || GENTOO_PATCHDIR="${WORKDIR}/${GENTOO_PATCHNAME}"
+
+# @VARIABLE: GENTOO_DEVELOPER
+# @DESCRIPTION:
+# This variable needs to be set in the ebuild and contains the name of the
+# gentoo developer who created the patch tarball
+
+# @VARIABLE: GENTOO_PATCHSTAMP
+# @DESCRIPTION:
+# This variable needs to be set in the ebuild and contains the date the patch
+# tarball was created at in YYYYMMDD format
+
+# @VARIABLE: GENTOO_PATCH_A
+# @DESCRIPTION:
+# This variable should contain the entire filename of patch tarball.
+# Defaults to the name of the patchset, with a datestamp.
+[[ -n "$GENTOO_PATCH_A" ]] || GENTOO_PATCH_A="${GENTOO_PATCHNAME}-${GENTOO_PATCHSTAMP}.tar.bz2"
+
+SRC_URI="mirror://apache/httpd/httpd-${PV}.tar.bz2
+ http://dev.gentoo.org/~${GENTOO_DEVELOPER}/dist/apache/${GENTOO_PATCH_A}"
+
+# @VARIABLE: IUSE_MPMS_FORK
+# @DESCRIPTION:
+# This variable needs to be set in the ebuild and contains a list of forking
+# (i.e. non-threaded) MPMs
+
+# @VARIABLE: IUSE_MPMS_THREAD
+# @DESCRIPTION:
+# This variable needs to be set in the ebuild and contains a list of threaded
+# MPMs
+
+# @VARIABLE: IUSE_MODULES
+# @DESCRIPTION:
+# This variable needs to be set in the ebuild and contains a list of available
+# built-in modules
+
+IUSE_MPMS="${IUSE_MPMS_FORK} ${IUSE_MPMS_THREAD}"
+IUSE="${IUSE} debug doc ldap selinux ssl static suexec threads"
+
+for module in ${IUSE_MODULES} ; do
+ IUSE="${IUSE} apache2_modules_${module}"
+done
+
+for mpm in ${IUSE_MPMS} ; do
+ IUSE="${IUSE} apache2_mpms_${mpm}"
+done
+
+DEPEND="dev-lang/perl
+ =dev-libs/apr-1*
+ =dev-libs/apr-util-1*[ldap?]
+ dev-libs/libpcre
+ apache2_modules_deflate? ( sys-libs/zlib )
+ apache2_modules_mime? ( app-misc/mime-types )
+ ldap? ( =net-nds/openldap-2* )
+ ssl? ( >=dev-libs/openssl-0.9.8m:0= )
+ !=www-servers/apache-1*"
+RDEPEND+=" ${DEPEND}
+ selinux? ( sec-policy/selinux-apache )"
+PDEPEND="~app-admin/apache-tools-${PV}"
+
+S="${WORKDIR}/httpd-${PV}"
+
+# ==============================================================================
+# INTERNAL FUNCTIONS
+# ==============================================================================
+
+# @ECLASS-VARIABLE: MY_MPM
+# @DESCRIPTION:
+# This internal variable contains the selected MPM after a call to setup_mpm()
+
+# @FUNCTION: setup_mpm
+# @DESCRIPTION:
+# This internal function makes sure that only one of APACHE2_MPMS was selected
+# or a default based on USE=threads is selected if APACHE2_MPMS is empty
+setup_mpm() {
+ MY_MPM=""
+ for x in ${IUSE_MPMS} ; do
+ if use apache2_mpms_${x} ; then
+ if [[ -z "${MY_MPM}" ]] ; then
+ MY_MPM=${x}
+ elog
+ elog "Selected MPM: ${MY_MPM}"
+ elog
+ else
+ eerror "You have selected more then one mpm USE-flag."
+ eerror "Only one MPM is supported."
+ die "more then one mpm was specified"
+ fi
+ fi
+ done
+
+ if [[ -z "${MY_MPM}" ]] ; then
+ if use threads ; then
+ MY_MPM=${DEFAULT_MPM_THREADED}
+ elog
+ elog "Selected default threaded MPM: ${MY_MPM}"
+ elog
+ else
+ MY_MPM=prefork
+ elog
+ elog "Selected default MPM: ${MY_MPM}"
+ elog
+ fi
+ fi
+
+ if has ${MY_MPM} ${IUSE_MPMS_THREAD} && ! use threads ; then
+ eerror "You have selected a threaded MPM but USE=threads is disabled"
+ die "invalid use flag combination"
+ fi
+
+ if has ${MY_MPM} ${IUSE_MPMS_FORK} && use threads ; then
+ eerror "You have selected a non-threaded MPM but USE=threads is enabled"
+ die "invalid use flag combination"
+ fi
+}
+
+# @VARIABLE: MODULE_CRITICAL
+# @DESCRIPTION:
+# This variable needs to be set in the ebuild and contains a space-separated
+# list of modules critical for the default apache. A user may still
+# disable these modules for custom minimal installation at their own risk.
+
+# @FUNCTION: check_module_critical
+# @DESCRIPTION:
+# This internal function warns the user about modules critical for the default
+# apache configuration.
+check_module_critical() {
+ local unsupported=0
+
+ for m in ${MODULE_CRITICAL} ; do
+ if ! has ${m} ${MY_MODS[@]} ; then
+ ewarn "Module '${m}' is required in the default apache configuration."
+ unsupported=1
+ fi
+ done
+
+ if [[ ${unsupported} -ne 0 ]] ; then
+ ewarn
+ ewarn "You have disabled one or more required modules"
+ ewarn "for the default apache configuration."
+ ewarn "Although this is not an error, please be"
+ ewarn "aware that this setup is UNSUPPORTED."
+ ewarn
+ fi
+}
+
+# @VARIABLE: MODULE_DEPENDS
+# @DESCRIPTION:
+# This variable needs to be set in the ebuild and contains a space-separated
+# list of dependency tokens each with a module and the module it depends on
+# separated by a colon
+
+# @FUNCTION: check_module_depends
+# @DESCRIPTION:
+# This internal function makes sure that all inter-module dependencies are
+# satisfied with the current module selection
+check_module_depends() {
+ local err=0
+
+ for m in ${MY_MODS[@]} ; do
+ for dep in ${MODULE_DEPENDS} ; do
+ if [[ "${m}" == "${dep%:*}" ]] ; then
+ if ! use apache2_modules_${dep#*:} ; then
+ eerror "Module '${m}' depends on '${dep#*:}'"
+ err=1
+ fi
+ fi
+ done
+ done
+
+ if [[ ${err} -ne 0 ]] ; then
+ die "invalid use flag combination"
+ fi
+}
+
+# @ECLASS-VARIABLE: MY_CONF
+# @DESCRIPTION:
+# This internal variable contains the econf options for the current module
+# selection after a call to setup_modules()
+
+# @ECLASS-VARIABLE: MY_MODS
+# @DESCRIPTION:
+# This internal variable contains a sorted, space separated list of currently
+# selected modules after a call to setup_modules()
+
+# @FUNCTION: setup_modules
+# @DESCRIPTION:
+# This internal function selects all built-in modules based on USE flags and
+# APACHE2_MODULES USE_EXPAND flags
+setup_modules() {
+ local mod_type=
+
+ if use static ; then
+ mod_type="static"
+ else
+ mod_type="shared"
+ fi
+
+ MY_CONF=( --enable-so=static )
+ MY_MODS=()
+
+ if use ldap ; then
+ MY_CONF+=( --enable-authnz_ldap=${mod_type} --enable-ldap=${mod_type} )
+ MY_MODS+=( ldap authnz_ldap )
+ else
+ MY_CONF+=( --disable-authnz_ldap --disable-ldap )
+ fi
+
+ if use ssl ; then
+ MY_CONF+=( --with-ssl="${EPREFIX}"/usr --enable-ssl=${mod_type} )
+ MY_MODS+=( ssl )
+ else
+ MY_CONF+=( --without-ssl --disable-ssl )
+ fi
+
+ if use suexec ; then
+ elog "You can manipulate several configure options of suexec"
+ elog "through the following environment variables:"
+ elog
+ elog " SUEXEC_SAFEPATH: Default PATH for suexec (default: '${EPREFIX}/usr/local/bin:${EPREFIX}/usr/bin:${EPREFIX}/bin')"
+ elog " SUEXEC_LOGFILE: Path to the suexec logfile (default: '${EPREFIX}/var/log/apache2/suexec_log')"
+ elog " SUEXEC_CALLER: Name of the user Apache is running as (default: apache)"
+ elog " SUEXEC_DOCROOT: Directory in which suexec will run scripts (default: '${EPREFIX}/var/www')"
+ elog " SUEXEC_MINUID: Minimum UID, which is allowed to run scripts via suexec (default: 1000)"
+ elog " SUEXEC_MINGID: Minimum GID, which is allowed to run scripts via suexec (default: 100)"
+ elog " SUEXEC_USERDIR: User subdirectories (like /home/user/html) (default: public_html)"
+ elog " SUEXEC_UMASK: Umask for the suexec process (default: 077)"
+ elog
+
+ MY_CONF+=( --with-suexec-safepath="${SUEXEC_SAFEPATH:-${EPREFIX}/usr/local/bin:${EPREFIX}/usr/bin:${EPREFIX}/bin}" )
+ MY_CONF+=( --with-suexec-logfile="${SUEXEC_LOGFILE:-${EPREFIX}/var/log/apache2/suexec_log}" )
+ MY_CONF+=( --with-suexec-bin="${EPREFIX}/usr/sbin/suexec" )
+ MY_CONF+=( --with-suexec-userdir=${SUEXEC_USERDIR:-public_html} )
+ MY_CONF+=( --with-suexec-caller=${SUEXEC_CALLER:-apache} )
+ MY_CONF+=( --with-suexec-docroot="${SUEXEC_DOCROOT:-${EPREFIX}/var/www}" )
+ MY_CONF+=( --with-suexec-uidmin=${SUEXEC_MINUID:-1000} )
+ MY_CONF+=( --with-suexec-gidmin=${SUEXEC_MINGID:-100} )
+ MY_CONF+=( --with-suexec-umask=${SUEXEC_UMASK:-077} )
+ MY_CONF+=( --enable-suexec=${mod_type} )
+ MY_MODS+=( suexec )
+ else
+ MY_CONF+=( --disable-suexec )
+ fi
+
+ for x in ${IUSE_MODULES} ; do
+ if use apache2_modules_${x} ; then
+ MY_CONF+=( --enable-${x}=${mod_type} )
+ MY_MODS+=( ${x} )
+ else
+ MY_CONF+=( --disable-${x} )
+ fi
+ done
+
+ # sort and uniquify MY_MODS
+ MY_MODS=( $(echo ${MY_MODS[@]} | tr ' ' '\n' | sort -u) )
+ check_module_depends
+ check_module_critical
+}
+
+# @VARIABLE: MODULE_DEFINES
+# @DESCRIPTION:
+# This variable needs to be set in the ebuild and contains a space-separated
+# list of tokens each mapping a module to a runtime define which can be
+# specified in APACHE2_OPTS in /etc/conf.d/apache2 to enable this particular
+# module.
+
+# @FUNCTION: generate_load_module
+# @DESCRIPTION:
+# This internal function generates the LoadModule lines for httpd.conf based on
+# the current module selection and MODULE_DEFINES
+generate_load_module() {
+ local endit=0 mod_lines= mod_dir="${ED}/usr/$(get_libdir)/apache2/modules"
+
+ if use static; then
+ sed -i -e "/%%LOAD_MODULE%%/d" \
+ "${GENTOO_PATCHDIR}"/conf/httpd.conf
+ return
+ fi
+
+ for m in ${MY_MODS[@]} ; do
+ if [[ -e "${mod_dir}/mod_${m}.so" ]] ; then
+ for def in ${MODULE_DEFINES} ; do
+ if [[ "${m}" == "${def%:*}" ]] ; then
+ mod_lines="${mod_lines}\n<IfDefine ${def#*:}>"
+ endit=1
+ fi
+ done
+
+ mod_lines="${mod_lines}\nLoadModule ${m}_module modules/mod_${m}.so"
+
+ if [[ ${endit} -ne 0 ]] ; then
+ mod_lines="${mod_lines}\n</IfDefine>"
+ endit=0
+ fi
+ fi
+ done
+
+ sed -i -e "s:%%LOAD_MODULE%%:${mod_lines}:" \
+ "${GENTOO_PATCHDIR}"/conf/httpd.conf
+}
+
+# @FUNCTION: check_upgrade
+# @DESCRIPTION:
+# This internal function checks if the previous configuration file for built-in
+# modules exists in ROOT and prevents upgrade in this case. Users are supposed
+# to convert this file to the new APACHE2_MODULES USE_EXPAND variable and remove
+# it afterwards.
+check_upgrade() {
+ if [[ -e "${EROOT}"etc/apache2/apache2-builtin-mods ]]; then
+ eerror "The previous configuration file for built-in modules"
+ eerror "(${EROOT}etc/apache2/apache2-builtin-mods) exists on your"
+ eerror "system."
+ eerror
+ eerror "Please read http://www.gentoo.org/doc/en/apache-upgrading.xml"
+ eerror "for detailed information how to convert this file to the new"
+ eerror "APACHE2_MODULES USE_EXPAND variable."
+ eerror
+ die "upgrade not possible with existing ${ROOT}etc/apache2/apache2-builtin-mods"
+ fi
+}
+
+# ==============================================================================
+# EXPORTED FUNCTIONS
+# ==============================================================================
+
+# @FUNCTION: apache-2_pkg_setup
+# @DESCRIPTION:
+# This function selects built-in modules, the MPM and other configure options,
+# creates the apache user and group and informs about CONFIG_SYSVIPC being
+# needed (we don't depend on kernel sources and therefore cannot check).
+apache-2_pkg_setup() {
+ check_upgrade
+
+ # setup apache user and group
+ enewgroup apache 81
+ enewuser apache 81 -1 /var/www apache
+
+ setup_mpm
+ setup_modules
+
+ if use debug; then
+ MY_CONF+=( --enable-maintainer-mode --enable-exception-hook )
+ fi
+
+ elog "Please note that you need SysV IPC support in your kernel."
+ elog "Make sure CONFIG_SYSVIPC=y is set."
+ elog
+
+ if use userland_BSD; then
+ elog "On BSD systems you need to add the following line to /boot/loader.conf:"
+ elog " accf_http_load=\"YES\""
+ elog
+ fi
+}
+
+# @FUNCTION: apache-2_src_prepare
+# @DESCRIPTION:
+# This function applies patches, configures a custom file-system layout and
+# rebuilds the configure scripts.
+apache-2_src_prepare() {
+ #fix prefix in conf files etc (bug #433736)
+ use !prefix || sed -e "s@/\(usr\|var\|etc\|run\)/@${EPREFIX}&@g" \
+ -i "${GENTOO_PATCHDIR}"/conf/httpd.conf "${GENTOO_PATCHDIR}"/scripts/* \
+ "${GENTOO_PATCHDIR}"/docs/*.example "${GENTOO_PATCHDIR}"/patches/*.layout \
+ "${GENTOO_PATCHDIR}"/init/* "${GENTOO_PATCHDIR}"/conf/vhosts.d/* \
+ "${GENTOO_PATCHDIR}"/conf/modules.d/* || die
+
+ # 03_all_gentoo-apache-tools.patch injects -Wl,-z,now, which is not a good
+ # idea for everyone
+ case ${CHOST} in
+ *-linux-gnu|*-solaris*|*-freebsd*)
+ # do nothing, these use GNU binutils
+ :
+ ;;
+ *-darwin*)
+ sed -i -e 's/-Wl,-z,now/-Wl,-bind_at_load/g' \
+ "${GENTOO_PATCHDIR}"/patches/03_all_gentoo_apache-tools.patch
+ ;;
+ *)
+ # patch it out to be like upstream
+ sed -i -e 's/-Wl,-z,now//g' \
+ "${GENTOO_PATCHDIR}"/patches/03_all_gentoo_apache-tools.patch
+ ;;
+ esac
+
+ # Use correct multilib libdir in gentoo patches
+ sed -i -e "s:/usr/lib:/usr/$(get_libdir):g" \
+ "${GENTOO_PATCHDIR}"/{conf/httpd.conf,init/*,patches/config.layout} \
+ || die "libdir sed failed"
+
+ epatch "${GENTOO_PATCHDIR}"/patches/*.patch
+
+ # setup the filesystem layout config
+ cat "${GENTOO_PATCHDIR}"/patches/config.layout >> "${S}"/config.layout || \
+ die "Failed preparing config.layout!"
+ sed -i -e "s:version:${PF}:g" "${S}"/config.layout
+
+ # apache2.8 instead of httpd.8 (bug #194828)
+ mv docs/man/{httpd,apache2}.8
+ sed -i -e 's/httpd\.8/apache2.8/g' Makefile.in
+
+ # patched-in MPMs need the build environment rebuilt
+ sed -i -e '/sinclude/d' configure.in
+ AT_M4DIR=build eautoreconf
+
+ # ${T} must be not group-writable, else grsec TPE will block it
+ chmod g-w "${T}"
+
+ # This package really should upgrade to using pcre's .pc file.
+ cat <<-\EOF >"${T}"/pcre-config
+ #!/bin/sh
+ [ "${flag}" = "--version" ] && set -- --modversion
+ exec ${PKG_CONFIG} libpcre "$@"
+ EOF
+ chmod a+x "${T}"/pcre-config
+}
+
+# @FUNCTION: apache-2_src_configure
+# @DESCRIPTION:
+# This function adds compiler flags and runs econf and emake based on MY_MPM and
+# MY_CONF
+apache-2_src_configure() {
+ tc-export PKG_CONFIG
+
+ # Sanity check in case people have bad mounts/TPE settings. #500928
+ if ! "${T}"/pcre-config --help >/dev/null ; then
+ eerror "Could not execute ${T}/pcre-config; do you have bad mount"
+ eerror "permissions in ${T} or have TPE turned on in your kernel?"
+ die "check your runtime settings #500928"
+ fi
+
+ # Instead of filtering --as-needed (bug #128505), append --no-as-needed
+ # Thanks to Harald van Dijk
+ append-ldflags $(no-as-needed)
+
+ # peruser MPM debugging with -X is nearly impossible
+ if has peruser ${IUSE_MPMS} && use apache2_mpms_peruser ; then
+ use debug && append-flags -DMPM_PERUSER_DEBUG
+ fi
+
+ # econf overwrites the stuff from config.layout, so we have to put them into
+ # our myconf line too
+ ac_cv_path_PKGCONFIG=${PKG_CONFIG} \
+ econf \
+ --includedir="${EPREFIX}"/usr/include/apache2 \
+ --libexecdir="${EPREFIX}"/usr/$(get_libdir)/apache2/modules \
+ --datadir="${EPREFIX}"/var/www/localhost \
+ --sysconfdir="${EPREFIX}"/etc/apache2 \
+ --localstatedir="${EPREFIX}"/var \
+ --with-mpm=${MY_MPM} \
+ --with-apr="${SYSROOT}${EPREFIX}"/usr \
+ --with-apr-util="${SYSROOT}${EPREFIX}"/usr \
+ --with-pcre="${T}"/pcre-config \
+ --with-z="${EPREFIX}"/usr \
+ --with-port=80 \
+ --with-program-name=apache2 \
+ --enable-layout=Gentoo \
+ "${MY_CONF[@]}"
+
+ sed -i -e 's:apache2\.conf:httpd.conf:' include/ap_config_auto.h
+}
+
+# @FUNCTION: apache-2_src_install
+# @DESCRIPTION:
+# This function runs `emake install' and generates, installs and adapts the gentoo
+# specific configuration files found in the tarball
+apache-2_src_install() {
+ emake DESTDIR="${D}" MKINSTALLDIRS="mkdir -p" install
+
+ # install our configuration files
+ keepdir /etc/apache2/vhosts.d
+ keepdir /etc/apache2/modules.d
+
+ generate_load_module
+ insinto /etc/apache2
+ doins -r "${GENTOO_PATCHDIR}"/conf/*
+ use apache2_modules_mime_magic && doins docs/conf/magic
+
+ insinto /etc/logrotate.d
+ newins "${GENTOO_PATCHDIR}"/scripts/apache2-logrotate apache2
+
+ # generate a sane default APACHE2_OPTS
+ APACHE2_OPTS="-D DEFAULT_VHOST -D INFO"
+ use doc && APACHE2_OPTS="${APACHE2_OPTS} -D MANUAL"
+ use ssl && APACHE2_OPTS="${APACHE2_OPTS} -D SSL -D SSL_DEFAULT_VHOST"
+ use suexec && APACHE2_OPTS="${APACHE2_OPTS} -D SUEXEC"
+ if has negotiation ${APACHE2_MODULES} && use apache2_modules_negotiation; then
+ APACHE2_OPTS="${APACHE2_OPTS} -D LANGUAGE"
+ fi
+
+ sed -i -e "s:APACHE2_OPTS=\".*\":APACHE2_OPTS=\"${APACHE2_OPTS}\":" \
+ "${GENTOO_PATCHDIR}"/init/apache2.confd || die "sed failed"
+
+ newconfd "${GENTOO_PATCHDIR}"/init/apache2.confd apache2
+ newinitd "${GENTOO_PATCHDIR}"/init/apache2.initd apache2
+
+ # install apache2ctl wrapper for our init script if available
+ if test -e "${GENTOO_PATCHDIR}"/scripts/apache2ctl; then
+ exeinto /usr/sbin
+ doexe "${GENTOO_PATCHDIR}"/scripts/apache2ctl
+ else
+ dosym /etc/init.d/apache2 /usr/sbin/apache2ctl
+ fi
+
+ # provide legacy symlink for apxs, bug 177697
+ dosym apxs /usr/sbin/apxs2
+
+ # install some documentation
+ dodoc ABOUT_APACHE CHANGES LAYOUT README README.platforms VERSIONING
+ dodoc "${GENTOO_PATCHDIR}"/docs/*
+
+ # drop in a convenient link to the manual
+ if use doc ; then
+ sed -i -e "s:VERSION:${PVR}:" "${ED}/etc/apache2/modules.d/00_apache_manual.conf"
+ docompress -x /usr/share/doc/${PF}/manual # 503640
+ else
+ rm -f "${ED}/etc/apache2/modules.d/00_apache_manual.conf"
+ rm -Rf "${ED}/usr/share/doc/${PF}/manual"
+ fi
+
+ # the default icons and error pages get stored in
+ # /usr/share/apache2/{error,icons}
+ dodir /usr/share/apache2
+ mv -f "${ED}/var/www/localhost/error" "${ED}/usr/share/apache2/error"
+ mv -f "${ED}/var/www/localhost/icons" "${ED}/usr/share/apache2/icons"
+ rm -rf "${ED}/var/www/localhost/"
+ eend $?
+
+ # set some sane permissions for suexec
+ if use suexec ; then
+ fowners 0:${SUEXEC_CALLER:-apache} /usr/sbin/suexec
+ fperms 4710 /usr/sbin/suexec
+ # provide legacy symlink for suexec, bug 177697
+ dosym /usr/sbin/suexec /usr/sbin/suexec2
+ fi
+
+ # empty dirs
+ for i in /var/lib/dav /var/log/apache2 /var/cache/apache2 ; do
+ keepdir ${i}
+ fowners apache:apache ${i}
+ fperms 0750 ${i}
+ done
+}
+
+# @FUNCTION: apache-2_pkg_postinst
+# @DESCRIPTION:
+# This function creates test certificates if SSL is enabled and installs the
+# default index.html to /var/www/localhost if it does not exist. We do this here
+# because the default webroot is a copy of the files that exist elsewhere and we
+# don't want them to be managed/removed by portage when apache is upgraded.
+apache-2_pkg_postinst() {
+ if use ssl && [[ ! -e "${EROOT}/etc/ssl/apache2/server.pem" ]]; then
+ SSL_ORGANIZATION="${SSL_ORGANIZATION:-Apache HTTP Server}"
+ install_cert /etc/ssl/apache2/server
+ ewarn
+ ewarn "The location of SSL certificates has changed. If you are"
+ ewarn "upgrading from ${CATEGORY}/${PN}-2.2.13 or earlier (or remerged"
+ ewarn "*any* apache version), you might want to move your old"
+ ewarn "certificates from /etc/apache2/ssl/ to /etc/ssl/apache2/ and"
+ ewarn "update your config files."
+ ewarn
+ fi
+
+ if [[ ! -e "${EROOT}/var/www/localhost" ]] ; then
+ mkdir -p "${EROOT}/var/www/localhost/htdocs"
+ echo "<html><body><h1>It works!</h1></body></html>" > "${EROOT}/var/www/localhost/htdocs/index.html"
+ fi
+
+ echo
+ elog "Attention: cgi and cgid modules are now handled via APACHE2_MODULES flags"
+ elog "in make.conf. Make sure to enable those in order to compile them."
+ elog "In general, you should use 'cgid' with threaded MPMs and 'cgi' otherwise."
+ echo
+
+}
+
+EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_install pkg_postinst
diff --git a/eclass/apache-module.eclass b/eclass/apache-module.eclass
new file mode 100644
index 00000000000..16fbddd7923
--- /dev/null
+++ b/eclass/apache-module.eclass
@@ -0,0 +1,239 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @ECLASS: apache-module.eclass
+# @MAINTAINER:
+# apache-devs@gentoo.org
+# @BLURB: Provides a common set of functions for apache modules
+# @DESCRIPTION:
+# This eclass handles apache modules in a sane way.
+#
+# To make use of this eclass simply call one of the need/want_apache functions
+# described in depend.apache.eclass. Make sure you use the need/want_apache call
+# after you have defined DEPEND and RDEPEND. Also note that you can not rely on
+# the automatic RDEPEND=DEPEND that portage does if you use this eclass.
+#
+# See Bug 107127 for more information.
+#
+# @EXAMPLE:
+#
+# Here is a simple example of an ebuild for mod_foo:
+#
+# @CODE
+# APACHE2_MOD_CONF="42_mod_foo"
+# APACHE2_MOD_DEFINE="FOO"
+# need_apache2
+# @CODE
+#
+# A more complicated example for a module with non-standard locations:
+#
+# @CODE
+# APXS2_S="${S}/apache22/src"
+# APACHE2_MOD_FILE="${APXS2_S}/${PN}.so"
+# APACHE2_MOD_CONF="42_${PN}"
+# APACHE2_MOD_DEFINE="FOO"
+# DOCFILES="docs/*.html"
+# need_apache2_2
+# @CODE
+#
+# A basic module configuration which just loads the module into apache:
+#
+# @CODE
+# <IfDefine FOO>
+# LoadModule foo_module modules/mod_foo.so
+# </IfDefine>
+# @CODE
+
+inherit depend.apache
+
+# ==============================================================================
+# PUBLIC VARIABLES
+# ==============================================================================
+
+# @VARIABLE: APXS2_S
+# @DESCRIPTION:
+# Path to temporary build directory. (Defaults to `${S}/src' if it exists,
+# `${S}' otherwise)
+
+# @VARIABLE: APXS2_ARGS
+# @DESCRIPTION:
+# Arguments to pass to the apxs tool. (Defaults to `-c ${PN}.c')
+
+# @VARIABLE: APACHE2_EXECFILES
+# @DESCRIPTION:
+# List of files that will be installed into ${APACHE_MODULE_DIR} beside
+# ${APACHE2_MOD_FILE}. In addition, this function also sets the executable
+# permission on those files.
+
+# @VARIABLE: APACHE2_MOD_CONF
+# @DESCRIPTION:
+# Module configuration file installed by src_install (minus the .conf suffix and
+# relative to ${FILESDIR}).
+
+# @VARIABLE: APACHE2_MOD_DEFINE
+# @DESCRIPTION:
+# Name of define (e.g. FOO) to use in conditional loading of the installed
+# module/its config file, multiple defines should be space separated.
+
+# @VARIABLE: APACHE2_MOD_FILE
+# @DESCRIPTION:
+# Name of the module that src_install installs minus the .so suffix. (Defaults
+# to `${APXS2_S}/.libs/${PN}.so')
+
+# @VARIABLE: APACHE2_VHOST_CONF
+# @DESCRIPTION:
+# Virtual host configuration file installed by src_install (minus the .conf
+# suffix and relative to ${FILESDIR}).
+
+# @VARIABLE: DOCFILES
+# @DESCRIPTION:
+# If the exported src_install() is being used, and ${DOCFILES} is non-zero, some
+# sed-fu is applied to split out html documentation (if any) from normal
+# documentation, and dodoc'd or dohtml'd.
+
+# ==============================================================================
+# INTERNAL FUNCTIONS
+# ==============================================================================
+
+# Internal function to construct the default ${APXS2_S} path if required.
+apache_cd_dir() {
+ debug-print-function $FUNCNAME $*
+
+ local CD_DIR="${APXS2_S}"
+
+ if [[ -z "${CD_DIR}" ]] ; then
+ if [[ -d "${S}/src" ]] ; then
+ CD_DIR="${S}/src"
+ else
+ CD_DIR="${S}"
+ fi
+ fi
+
+ debug-print $FUNCNAME "CD_DIR=${CD_DIR}"
+ echo "${CD_DIR}"
+}
+
+# Internal function to construct the default ${APACHE2_MOD_FILE} if required.
+apache_mod_file() {
+ debug-print-function $FUNCNAME $*
+
+ local MOD_FILE="${APACHE2_MOD_FILE:-$(apache_cd_dir)/.libs/${PN}.so}"
+
+ debug-print $FUNCNAME "MOD_FILE=${MOD_FILE}"
+ echo "${MOD_FILE}"
+}
+
+# Internal function for picking out html files from ${DOCFILES}. It takes an
+# optional first argument `html'; if the first argument is equals `html', only
+# html files are returned, otherwise normal (non-html) docs are returned.
+apache_doc_magic() {
+ debug-print-function $FUNCNAME $*
+
+ local DOCS=
+
+ if [[ -n "${DOCFILES}" ]] ; then
+ if [[ "x$1" == "xhtml" ]] ; then
+ DOCS="`echo ${DOCFILES} | sed -e 's/ /\n/g' | sed -e '/^[^ ]*.html$/ !d'`"
+ else
+ DOCS="`echo ${DOCFILES} | sed 's, *[^ ]*\+.html, ,g'`"
+ fi
+ fi
+
+ debug-print $FUNCNAME "DOCS=${DOCS}"
+ echo "${DOCS}"
+}
+
+# ==============================================================================
+# EXPORTED FUNCTIONS
+# ==============================================================================
+
+# @FUNCTION: apache-module_src_compile
+# @DESCRIPTION:
+# The default action is to call ${APXS} with the value of ${APXS2_ARGS}. If a
+# module requires a different build setup than this, use ${APXS} in your own
+# src_compile routine.
+apache-module_src_compile() {
+ debug-print-function $FUNCNAME $*
+
+ local CD_DIR=$(apache_cd_dir)
+ cd "${CD_DIR}" || die "cd ${CD_DIR} failed"
+
+ APXS2_ARGS="${APXS2_ARGS:--c ${PN}.c}"
+ ${APXS} ${APXS2_ARGS} || die "${APXS} ${APXS2_ARGS} failed"
+}
+
+# @FUNCTION: apache-module_src_install
+# @DESCRIPTION:
+# This installs the files into apache's directories. The module is installed
+# from a directory chosen as above (apache_cd_dir). In addition, this function
+# can also set the executable permission on files listed in
+# ${APACHE2_EXECFILES}. The configuration file name is listed in
+# ${APACHE2_MOD_CONF} without the .conf extensions, so if you configuration is
+# 55_mod_foo.conf, APACHE2_MOD_CONF would be 55_mod_foo. ${DOCFILES} contains
+# the list of files you want filed as documentation.
+apache-module_src_install() {
+ debug-print-function $FUNCNAME $*
+
+ local CD_DIR=$(apache_cd_dir)
+ pushd "${CD_DIR}" >/dev/null || die "cd ${CD_DIR} failed"
+
+ local MOD_FILE=$(apache_mod_file)
+
+ exeinto "${APACHE_MODULESDIR}"
+ doexe ${MOD_FILE} || die "internal ebuild error: '${MOD_FILE}' not found"
+ [[ -n "${APACHE2_EXECFILES}" ]] && doexe ${APACHE2_EXECFILES}
+
+ if [[ -n "${APACHE2_MOD_CONF}" ]] ; then
+ insinto "${APACHE_MODULES_CONFDIR}"
+ set -- ${APACHE2_MOD_CONF}
+ newins "${FILESDIR}/${1}.conf" "$(basename ${2:-$1}).conf" \
+ || die "internal ebuild error: '${FILESDIR}/${1}.conf' not found"
+ fi
+
+ if [[ -n "${APACHE2_VHOST_CONF}" ]] ; then
+ insinto "${APACHE_VHOSTS_CONFDIR}"
+ set -- ${APACHE2_VHOST_CONF}
+ newins "${FILESDIR}/${1}.conf" "$(basename ${2:-$1}).conf " \
+ || die "internal ebuild error: '${FILESDIR}/${1}.conf' not found"
+ fi
+
+ cd "${S}"
+
+ if [[ -n "${DOCFILES}" ]] ; then
+ local OTHER_DOCS=$(apache_doc_magic)
+ local HTML_DOCS=$(apache_doc_magic html)
+
+ [[ -n "${OTHER_DOCS}" ]] && dodoc ${OTHER_DOCS}
+ [[ -n "${HTML_DOCS}" ]] && dohtml ${HTML_DOCS}
+ fi
+
+ popd >/dev/null
+}
+
+# @FUNCTION: apache-module_pkg_postinst
+# @DESCRIPTION:
+# This prints out information about the installed module and how to enable it.
+apache-module_pkg_postinst() {
+ debug-print-function $FUNCNAME $*
+
+ if [[ -n "${APACHE2_MOD_DEFINE}" ]] ; then
+ local my_opts="-D ${APACHE2_MOD_DEFINE// / -D }"
+
+ einfo
+ einfo "To enable ${PN}, you need to edit your /etc/conf.d/apache2 file and"
+ einfo "add '${my_opts}' to APACHE2_OPTS."
+ einfo
+ fi
+
+ if [[ -n "${APACHE2_MOD_CONF}" ]] ; then
+ set -- ${APACHE2_MOD_CONF}
+ einfo
+ einfo "Configuration file installed as"
+ einfo " ${APACHE_MODULES_CONFDIR}/$(basename ${2:-$1}).conf"
+ einfo "You may want to edit it before turning the module on in /etc/conf.d/apache2"
+ einfo
+ fi
+}
+
+EXPORT_FUNCTIONS src_compile src_install pkg_postinst
diff --git a/eclass/aspell-dict.eclass b/eclass/aspell-dict.eclass
new file mode 100644
index 00000000000..6207f6a15fc
--- /dev/null
+++ b/eclass/aspell-dict.eclass
@@ -0,0 +1,66 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @ECLASS: aspell-dict.eclass
+# @MAINTAINER:
+# maintainer-needed@gentoo.org
+# @AUTHOR:
+# Original author: Seemant Kulleen
+# @BLURB: An eclass to streamline the construction of ebuilds for new aspell dicts
+# @DESCRIPTION:
+# The aspell-dict eclass is designed to streamline the construction of
+# ebuilds for the new aspell dictionaries (from gnu.org) which support
+# aspell-0.50. Support for aspell-0.60 has been added by Sergey Ulanov.
+
+# @ECLASS-VARIABLE: ASPELL_LANG
+# @REQUIRED
+# @DESCRIPTION:
+# Which language is the dictionary for? It's used for the DESCRIPTION of the
+# package.
+
+# @ECLASS-VARIABLE: ASPOSTFIX
+# @REQUIRED
+# @DESCRIPTION:
+# What major version of aspell is this dictionary for?
+
+EXPORT_FUNCTIONS src_compile src_install
+
+#MY_P=${PN}-${PV%.*}-${PV#*.*.}
+MY_P=${P%.*}-${PV##*.}
+MY_P=aspell${ASPOSTFIX}-${MY_P/aspell-/}
+SPELLANG=${PN/aspell-/}
+S="${WORKDIR}/${MY_P}"
+DESCRIPTION="${ASPELL_LANG} language dictionary for aspell"
+HOMEPAGE="http://aspell.net"
+SRC_URI="mirror://gnu/aspell/dict/${SPELLANG}/${MY_P}.tar.bz2"
+
+IUSE=""
+SLOT="0"
+
+if [ x${ASPOSTFIX} = x6 ] ; then
+ RDEPEND=">=app-text/aspell-0.60"
+ DEPEND="${RDEPEND}"
+else
+ RDEPEND=">=app-text/aspell-0.50"
+ DEPEND="${RDEPEND}"
+fi
+
+# @FUNCTION: aspell-dict_src_compile
+# @DESCRIPTION:
+# The aspell-dict src_compile function which is exported.
+aspell-dict_src_compile() {
+ ./configure || die
+ emake || die
+}
+
+# @FUNCTION: aspell-dict_src_install
+# @DESCRIPTION:
+# The aspell-dict src_install function which is exported.
+aspell-dict_src_install() {
+ make DESTDIR="${D}" install || die
+
+ for doc in README info ; do
+ [ -s "$doc" ] && dodoc $doc
+ done
+}
diff --git a/eclass/autotools-multilib.eclass b/eclass/autotools-multilib.eclass
new file mode 100644
index 00000000000..758a6191ced
--- /dev/null
+++ b/eclass/autotools-multilib.eclass
@@ -0,0 +1,90 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @ECLASS: autotools-multilib.eclass
+# @MAINTAINER:
+# gx86-multilib team <multilib@gentoo.org>
+# @AUTHOR:
+# Author: Michał Górny <mgorny@gentoo.org>
+# @BLURB: autotools-utils wrapper for multilib builds
+# @DESCRIPTION:
+# The autotools-multilib.eclass provides a glue between
+# autotools-utils.eclass(5) and multilib-minimal.eclass(5), aiming
+# to provide a convenient way to build packages using autotools
+# for multiple ABIs.
+#
+# Inheriting this eclass sets IUSE and exports default multilib_src_*()
+# sub-phases that call autotools-utils phase functions for each ABI
+# enabled. The multilib_src_*() functions can be defined in ebuild just
+# like in multilib-minimal.
+
+# EAPI=4 is required for meaningful MULTILIB_USEDEP.
+case ${EAPI:-0} in
+ 4|5) ;;
+ *) die "EAPI=${EAPI} is not supported" ;;
+esac
+
+inherit autotools-utils eutils multilib-build multilib-minimal
+
+EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
+
+# Note: _at_args[@] passing is a backwards compatibility measure.
+# Don't use it in new packages.
+
+autotools-multilib_src_prepare() {
+ autotools-utils_src_prepare "${@}"
+
+ [[ ${AUTOTOOLS_IN_SOURCE_BUILD} ]] && multilib_copy_sources
+}
+
+multilib_src_configure() {
+ [[ ${AUTOTOOLS_IN_SOURCE_BUILD} ]] && local ECONF_SOURCE=${BUILD_DIR}
+ autotools-utils_src_configure "${_at_args[@]}"
+}
+
+autotools-multilib_src_configure() {
+ local _at_args=( "${@}" )
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_compile() {
+ emake "${_at_args[@]}"
+}
+
+autotools-multilib_src_compile() {
+ local _at_args=( "${@}" )
+
+ multilib-minimal_src_compile
+}
+
+multilib_src_test() {
+ autotools-utils_src_test "${_at_args[@]}"
+}
+
+autotools-multilib_src_test() {
+ local _at_args=( "${@}" )
+
+ multilib-minimal_src_test
+}
+
+multilib_src_install() {
+ emake DESTDIR="${D}" "${_at_args[@]}" install
+}
+
+multilib_src_install_all() {
+ einstalldocs
+
+ # Remove libtool files and unnecessary static libs
+ local prune_ltfiles=${AUTOTOOLS_PRUNE_LIBTOOL_FILES}
+ if [[ ${prune_ltfiles} != none ]]; then
+ prune_libtool_files ${prune_ltfiles:+--${prune_ltfiles}}
+ fi
+}
+
+autotools-multilib_src_install() {
+ local _at_args=( "${@}" )
+
+ multilib-minimal_src_install
+}
diff --git a/eclass/autotools-utils.eclass b/eclass/autotools-utils.eclass
new file mode 100644
index 00000000000..de3c65a7830
--- /dev/null
+++ b/eclass/autotools-utils.eclass
@@ -0,0 +1,403 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @ECLASS: autotools-utils.eclass
+# @MAINTAINER:
+# Maciej Mrozowski <reavertm@gentoo.org>
+# Michał Górny <mgorny@gentoo.org>
+# @BLURB: common ebuild functions for autotools-based packages
+# @DESCRIPTION:
+# autotools-utils.eclass is autotools.eclass(5) and base.eclass(5) wrapper
+# providing all inherited features along with econf arguments as Bash array,
+# out of source build with overridable build dir location, static archives
+# handling, libtool files removal.
+#
+# Please note that autotools-utils does not support mixing of its phase
+# functions with regular econf/emake calls. If necessary, please call
+# autotools-utils_src_compile instead of the latter.
+#
+# @EXAMPLE:
+# Typical ebuild using autotools-utils.eclass:
+#
+# @CODE
+# EAPI="2"
+#
+# inherit autotools-utils
+#
+# DESCRIPTION="Foo bar application"
+# HOMEPAGE="http://example.org/foo/"
+# SRC_URI="mirror://sourceforge/foo/${P}.tar.bz2"
+#
+# LICENSE="LGPL-2.1"
+# KEYWORDS=""
+# SLOT="0"
+# IUSE="debug doc examples qt4 static-libs tiff"
+#
+# CDEPEND="
+# media-libs/libpng:0
+# qt4? (
+# dev-qt/qtcore:4
+# dev-qt/qtgui:4
+# )
+# tiff? ( media-libs/tiff:0 )
+# "
+# RDEPEND="${CDEPEND}
+# !media-gfx/bar
+# "
+# DEPEND="${CDEPEND}
+# doc? ( app-doc/doxygen )
+# "
+#
+# # bug 123456
+# AUTOTOOLS_IN_SOURCE_BUILD=1
+#
+# DOCS=(AUTHORS ChangeLog README "Read me.txt" TODO)
+#
+# PATCHES=(
+# "${FILESDIR}/${P}-gcc44.patch" # bug 123458
+# "${FILESDIR}/${P}-as-needed.patch"
+# "${FILESDIR}/${P}-unbundle_libpng.patch"
+# )
+#
+# src_configure() {
+# local myeconfargs=(
+# $(use_enable debug)
+# $(use_with qt4)
+# $(use_enable threads multithreading)
+# $(use_with tiff)
+# )
+# autotools-utils_src_configure
+# }
+#
+# src_compile() {
+# autotools-utils_src_compile
+# use doc && autotools-utils_src_compile docs
+# }
+#
+# src_install() {
+# use doc && HTML_DOCS=("${BUILD_DIR}/apidocs/html/")
+# autotools-utils_src_install
+# if use examples; then
+# dobin "${BUILD_DIR}"/foo_example{1,2,3} \\
+# || die 'dobin examples failed'
+# fi
+# }
+#
+# @CODE
+
+# Keep variable names synced with cmake-utils and the other way around!
+
+case ${EAPI:-0} in
+ 2|3|4|5) ;;
+ *) die "EAPI=${EAPI} is not supported" ;;
+esac
+
+# @ECLASS-VARIABLE: AUTOTOOLS_AUTORECONF
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Set to a non-empty value before calling inherit to enable running autoreconf
+# in src_prepare() and adding autotools dependencies.
+#
+# This is usually necessary when using live sources or applying patches
+# modifying configure.ac or Makefile.am files. Note that in the latter case
+# setting this variable is obligatory even though the eclass will work without
+# it (to add the necessary dependencies).
+#
+# The eclass will try to determine the correct autotools to run including a few
+# external tools: gettext, glib-gettext, intltool, gtk-doc, gnome-doc-prepare.
+# If your tool is not supported, please open a bug and we'll add support for it.
+#
+# Note that dependencies are added for autoconf, automake and libtool only.
+# If your package needs one of the external tools listed above, you need to add
+# appropriate packages to DEPEND yourself.
+[[ ${AUTOTOOLS_AUTORECONF} ]] || : ${AUTOTOOLS_AUTO_DEPEND:=no}
+
+inherit autotools eutils libtool
+
+EXPORT_FUNCTIONS src_prepare src_configure src_compile src_install src_test
+
+# @ECLASS-VARIABLE: BUILD_DIR
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Build directory, location where all autotools generated files should be
+# placed. For out of source builds it defaults to ${WORKDIR}/${P}_build.
+#
+# This variable has been called AUTOTOOLS_BUILD_DIR formerly.
+# It is set under that name for compatibility.
+
+# @ECLASS-VARIABLE: AUTOTOOLS_IN_SOURCE_BUILD
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Set to enable in-source build.
+
+# @ECLASS-VARIABLE: ECONF_SOURCE
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Specify location of autotools' configure script. By default it uses ${S}.
+
+# @ECLASS-VARIABLE: DOCS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Array containing documents passed to dodoc command.
+#
+# In EAPIs 4+, can list directories as well.
+#
+# Example:
+# @CODE
+# DOCS=( NEWS README )
+# @CODE
+
+# @ECLASS-VARIABLE: HTML_DOCS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Array containing documents passed to dohtml command.
+#
+# Example:
+# @CODE
+# HTML_DOCS=( doc/html/ )
+# @CODE
+
+# @ECLASS-VARIABLE: PATCHES
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# PATCHES array variable containing all various patches to be applied.
+#
+# Example:
+# @CODE
+# PATCHES=( "${FILESDIR}"/${P}-mypatch.patch )
+# @CODE
+
+# @ECLASS-VARIABLE: AUTOTOOLS_PRUNE_LIBTOOL_FILES
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Sets the mode of pruning libtool files. The values correspond to
+# prune_libtool_files parameters, with leading dashes stripped.
+#
+# Defaults to pruning the libtool files when static libraries are not
+# installed or can be linked properly without them. Libtool files
+# for modules (plugins) will be kept in case plugin loader needs them.
+#
+# If set to 'modules', the .la files for modules will be removed
+# as well. This is often the preferred option.
+#
+# If set to 'all', all .la files will be removed unconditionally. This
+# option is discouraged and shall be used only if 'modules' does not
+# remove the files.
+#
+# If set to 'none', no .la files will be pruned ever. Use in corner
+# cases only.
+
+# Determine using IN or OUT source build
+_check_build_dir() {
+ : ${ECONF_SOURCE:=${S}}
+ # Respect both the old variable and the new one, depending
+ # on which one was set by the ebuild.
+ if [[ ! ${BUILD_DIR} && ${AUTOTOOLS_BUILD_DIR} ]]; then
+ eqawarn "The AUTOTOOLS_BUILD_DIR variable has been renamed to BUILD_DIR."
+ eqawarn "Please migrate the ebuild to use the new one."
+
+ # In the next call, both variables will be set already
+ # and we'd have to know which one takes precedence.
+ _RESPECT_AUTOTOOLS_BUILD_DIR=1
+ fi
+
+ if [[ ${_RESPECT_AUTOTOOLS_BUILD_DIR} ]]; then
+ BUILD_DIR=${AUTOTOOLS_BUILD_DIR:-${WORKDIR}/${P}_build}
+ else
+ if [[ -n ${AUTOTOOLS_IN_SOURCE_BUILD} ]]; then
+ : ${BUILD_DIR:=${ECONF_SOURCE}}
+ else
+ : ${BUILD_DIR:=${WORKDIR}/${P}_build}
+ fi
+ fi
+
+ # Backwards compatibility for getting the value.
+ AUTOTOOLS_BUILD_DIR=${BUILD_DIR}
+ echo ">>> Working in BUILD_DIR: \"${BUILD_DIR}\""
+}
+
+# @FUNCTION: autotools-utils_src_prepare
+# @DESCRIPTION:
+# The src_prepare function.
+#
+# Supporting PATCHES array and user patches. See base.eclass(5) for reference.
+autotools-utils_src_prepare() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local want_autoreconf=${AUTOTOOLS_AUTORECONF}
+
+ [[ ${PATCHES} ]] && epatch "${PATCHES[@]}"
+
+ at_checksum() {
+ find '(' -name 'Makefile.am' \
+ -o -name 'configure.ac' \
+ -o -name 'configure.in' ')' \
+ -exec cksum {} + | sort -k2
+ }
+
+ [[ ! ${want_autoreconf} ]] && local checksum=$(at_checksum)
+ epatch_user
+ if [[ ! ${want_autoreconf} ]]; then
+ if [[ ${checksum} != $(at_checksum) ]]; then
+ einfo 'Will autoreconfigure due to user patches applied.'
+ want_autoreconf=yep
+ fi
+ fi
+
+ [[ ${want_autoreconf} ]] && eautoreconf
+ elibtoolize --patch-only
+}
+
+# @FUNCTION: autotools-utils_src_configure
+# @DESCRIPTION:
+# The src_configure function. For out of source build it creates build
+# directory and runs econf there. Configuration parameters defined
+# in myeconfargs are passed here to econf. Additionally following USE
+# flags are known:
+#
+# IUSE="static-libs" passes --enable-shared and either --disable-static/--enable-static
+# to econf respectively.
+
+# @VARIABLE: myeconfargs
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Optional econf arguments as Bash array. Should be defined before calling src_configure.
+# @CODE
+# src_configure() {
+# local myeconfargs=(
+# --disable-readline
+# --with-confdir="/etc/nasty foo confdir/"
+# $(use_enable debug cnddebug)
+# $(use_enable threads multithreading)
+# )
+# autotools-utils_src_configure
+# }
+# @CODE
+autotools-utils_src_configure() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ [[ -z ${myeconfargs+1} || $(declare -p myeconfargs) == 'declare -a'* ]] \
+ || die 'autotools-utils.eclass: myeconfargs has to be an array.'
+
+ [[ ${EAPI} == 2 ]] && ! use prefix && EPREFIX=
+
+ # Common args
+ local econfargs=()
+
+ _check_build_dir
+ if "${ECONF_SOURCE}"/configure --help 2>&1 | grep -q '^ *--docdir='; then
+ econfargs+=(
+ --docdir="${EPREFIX}"/usr/share/doc/${PF}
+ )
+ fi
+
+ # Handle static-libs found in IUSE, disable them by default
+ if in_iuse static-libs; then
+ econfargs+=(
+ --enable-shared
+ $(use_enable static-libs static)
+ )
+ fi
+
+ # Append user args
+ econfargs+=("${myeconfargs[@]}")
+
+ mkdir -p "${BUILD_DIR}" || die
+ pushd "${BUILD_DIR}" > /dev/null || die
+ econf "${econfargs[@]}" "$@"
+ popd > /dev/null || die
+}
+
+# @FUNCTION: autotools-utils_src_compile
+# @DESCRIPTION:
+# The autotools src_compile function, invokes emake in specified BUILD_DIR.
+autotools-utils_src_compile() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ _check_build_dir
+ pushd "${BUILD_DIR}" > /dev/null || die
+ emake "$@" || die 'emake failed'
+ popd > /dev/null || die
+}
+
+# @FUNCTION: autotools-utils_src_install
+# @DESCRIPTION:
+# The autotools src_install function. Runs emake install, unconditionally
+# removes unnecessary static libs (based on shouldnotlink libtool property)
+# and removes unnecessary libtool files when static-libs USE flag is defined
+# and unset.
+#
+# DOCS and HTML_DOCS arrays are supported. See base.eclass(5) for reference.
+autotools-utils_src_install() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ _check_build_dir
+ pushd "${BUILD_DIR}" > /dev/null || die
+ emake DESTDIR="${D}" "$@" install || die "emake install failed"
+ popd > /dev/null || die
+
+ # Move docs installed by autotools (in EAPI < 4).
+ if [[ ${EAPI} == [23] ]] \
+ && path_exists "${D}${EPREFIX}"/usr/share/doc/${PF}/*; then
+ if [[ $(find "${D}${EPREFIX}"/usr/share/doc/${PF}/* -type d) ]]; then
+ eqawarn "autotools-utils: directories in docdir require at least EAPI 4"
+ else
+ mkdir "${T}"/temp-docdir
+ mv "${D}${EPREFIX}"/usr/share/doc/${PF}/* "${T}"/temp-docdir/ \
+ || die "moving docs to tempdir failed"
+
+ dodoc "${T}"/temp-docdir/* || die "docdir dodoc failed"
+ rm -r "${T}"/temp-docdir || die
+ fi
+ fi
+
+ # XXX: support installing them from builddir as well?
+ if declare -p DOCS &>/dev/null; then
+ # an empty list == don't install anything
+ if [[ ${DOCS[@]} ]]; then
+ if [[ ${EAPI} == [23] ]]; then
+ dodoc "${DOCS[@]}" || die
+ else
+ # dies by itself
+ dodoc -r "${DOCS[@]}"
+ fi
+ fi
+ else
+ local f
+ # same list as in PMS
+ for f in README* ChangeLog AUTHORS NEWS TODO CHANGES \
+ THANKS BUGS FAQ CREDITS CHANGELOG; do
+ if [[ -s ${f} ]]; then
+ dodoc "${f}" || die "(default) dodoc ${f} failed"
+ fi
+ done
+ fi
+ if [[ ${HTML_DOCS} ]]; then
+ dohtml -r "${HTML_DOCS[@]}" || die "dohtml failed"
+ fi
+
+ # Remove libtool files and unnecessary static libs
+ local prune_ltfiles=${AUTOTOOLS_PRUNE_LIBTOOL_FILES}
+ if [[ ${prune_ltfiles} != none ]]; then
+ prune_libtool_files ${prune_ltfiles:+--${prune_ltfiles}}
+ fi
+}
+
+# @FUNCTION: autotools-utils_src_test
+# @DESCRIPTION:
+# The autotools src_test function. Runs emake check in build directory.
+autotools-utils_src_test() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ _check_build_dir
+ pushd "${BUILD_DIR}" > /dev/null || die
+
+ if make -ni check "${@}" &>/dev/null; then
+ emake check "${@}" || die 'emake check failed.'
+ elif make -ni test "${@}" &>/dev/null; then
+ emake test "${@}" || die 'emake test failed.'
+ fi
+
+ popd > /dev/null || die
+}
diff --git a/eclass/autotools.eclass b/eclass/autotools.eclass
new file mode 100644
index 00000000000..22f2f39a3c8
--- /dev/null
+++ b/eclass/autotools.eclass
@@ -0,0 +1,607 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @ECLASS: autotools.eclass
+# @MAINTAINER:
+# base-system@gentoo.org
+# @BLURB: Regenerates auto* build scripts
+# @DESCRIPTION:
+# This eclass is for safely handling autotooled software packages that need to
+# regenerate their build scripts. All functions will abort in case of errors.
+
+# Note: We require GNU m4, as does autoconf. So feel free to use any features
+# from the GNU version of m4 without worrying about other variants (i.e. BSD).
+
+if [[ ${__AUTOTOOLS_AUTO_DEPEND+set} == "set" ]] ; then
+ # See if we were included already, but someone changed the value
+ # of AUTOTOOLS_AUTO_DEPEND on us. We could reload the entire
+ # eclass at that point, but that adds overhead, and it's trivial
+ # to re-order inherit in eclasses/ebuilds instead. #409611
+ if [[ ${__AUTOTOOLS_AUTO_DEPEND} != ${AUTOTOOLS_AUTO_DEPEND} ]] ; then
+ die "AUTOTOOLS_AUTO_DEPEND changed value between inherits; please inherit autotools.eclass first! ${__AUTOTOOLS_AUTO_DEPEND} -> ${AUTOTOOLS_AUTO_DEPEND}"
+ fi
+fi
+
+if [[ -z ${_AUTOTOOLS_ECLASS} ]]; then
+_AUTOTOOLS_ECLASS=1
+
+inherit libtool
+
+# @ECLASS-VARIABLE: WANT_AUTOCONF
+# @DESCRIPTION:
+# The major version of autoconf your package needs
+: ${WANT_AUTOCONF:=latest}
+
+# @ECLASS-VARIABLE: WANT_AUTOMAKE
+# @DESCRIPTION:
+# The major version of automake your package needs
+: ${WANT_AUTOMAKE:=latest}
+
+# @ECLASS-VARIABLE: WANT_LIBTOOL
+# @DESCRIPTION:
+# Do you want libtool? Valid values here are "latest" and "none".
+: ${WANT_LIBTOOL:=latest}
+
+# @ECLASS-VARIABLE: _LATEST_AUTOMAKE
+# @INTERNAL
+# @DESCRIPTION:
+# CONSTANT!
+# The latest major version/slot of automake available on each arch. #312315
+# We should list both the latest stable, and the latest unstable. #465732
+# This way the stable builds will still work, but the unstable are allowed
+# to build & test things for us ahead of time (if they have it installed).
+# If a newer slot is stable on any arch, and is NOT reflected in this list,
+# then circular dependencies may arise during emerge @system bootstraps.
+# Do NOT change this variable in your ebuilds!
+# If you want to force a newer minor version, you can specify the correct
+# WANT value by using a colon: <PV>:<WANT_AUTOMAKE>
+_LATEST_AUTOMAKE=( 1.15:1.15 )
+
+_automake_atom="sys-devel/automake"
+_autoconf_atom="sys-devel/autoconf"
+if [[ -n ${WANT_AUTOMAKE} ]]; then
+ case ${WANT_AUTOMAKE} in
+ # Even if the package doesn't use automake, we still need to depend
+ # on it because we run aclocal to process m4 macros. This matches
+ # the autoreconf tool, so this requirement is correct. #401605
+ none) ;;
+ latest)
+ # Use SLOT deps if we can. For EAPI=0, we get pretty close.
+ if [[ ${EAPI:-0} != 0 ]] ; then
+ _automake_atom="|| ( `printf '>=sys-devel/automake-%s:%s ' ${_LATEST_AUTOMAKE[@]/:/ }` )"
+ else
+ _automake_atom="|| ( `printf '>=sys-devel/automake-%s ' ${_LATEST_AUTOMAKE[@]/%:*}` )"
+ fi
+ ;;
+ *) _automake_atom="=sys-devel/automake-${WANT_AUTOMAKE}*" ;;
+ esac
+ export WANT_AUTOMAKE
+fi
+
+if [[ -n ${WANT_AUTOCONF} ]] ; then
+ case ${WANT_AUTOCONF} in
+ none) _autoconf_atom="" ;; # some packages don't require autoconf at all
+ 2.1) _autoconf_atom="=sys-devel/autoconf-${WANT_AUTOCONF}*" ;;
+ # if you change the "latest" version here, change also autotools_env_setup
+ latest|2.5) _autoconf_atom=">=sys-devel/autoconf-2.69" ;;
+ *) die "Invalid WANT_AUTOCONF value '${WANT_AUTOCONF}'" ;;
+ esac
+ export WANT_AUTOCONF
+fi
+
+_libtool_atom=">=sys-devel/libtool-2.4"
+if [[ -n ${WANT_LIBTOOL} ]] ; then
+ case ${WANT_LIBTOOL} in
+ none) _libtool_atom="" ;;
+ latest) ;;
+ *) die "Invalid WANT_LIBTOOL value '${WANT_LIBTOOL}'" ;;
+ esac
+ export WANT_LIBTOOL
+fi
+
+# Force people (nicely) to upgrade to a newer version of gettext as
+# older ones are known to be crappy. #496454
+AUTOTOOLS_DEPEND="!<sys-devel/gettext-0.18.1.1-r3
+ ${_automake_atom}
+ ${_autoconf_atom}
+ ${_libtool_atom}"
+RDEPEND=""
+
+# @ECLASS-VARIABLE: AUTOTOOLS_AUTO_DEPEND
+# @DESCRIPTION:
+# Set to 'no' to disable automatically adding to DEPEND. This lets
+# ebuilds former conditional depends by using ${AUTOTOOLS_DEPEND} in
+# their own DEPEND string.
+: ${AUTOTOOLS_AUTO_DEPEND:=yes}
+if [[ ${AUTOTOOLS_AUTO_DEPEND} != "no" ]] ; then
+ DEPEND=${AUTOTOOLS_DEPEND}
+fi
+__AUTOTOOLS_AUTO_DEPEND=${AUTOTOOLS_AUTO_DEPEND} # See top of eclass
+
+unset _automake_atom _autoconf_atom
+
+# @ECLASS-VARIABLE: AM_OPTS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Additional options to pass to automake during
+# eautoreconf call.
+
+# @ECLASS-VARIABLE: AT_NOEAUTOMAKE
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Don't run eautomake command if set to 'yes'; only used to workaround
+# broken packages. Generally you should, instead, fix the package to
+# not call AM_INIT_AUTOMAKE if it doesn't actually use automake.
+
+# @ECLASS-VARIABLE: AT_NOELIBTOOLIZE
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Don't run elibtoolize command if set to 'yes',
+# useful when elibtoolize needs to be ran with
+# particular options
+
+# @ECLASS-VARIABLE: AT_M4DIR
+# @DESCRIPTION:
+# Additional director(y|ies) aclocal should search
+: ${AT_M4DIR:=}
+
+# @ECLASS-VARIABLE: AT_SYS_M4DIR
+# @INTERNAL
+# @DESCRIPTION:
+# For system integrators, a list of additional aclocal search paths.
+# This variable gets eval-ed, so you can use variables in the definition
+# that may not be valid until eautoreconf & friends are run.
+: ${AT_SYS_M4DIR:=}
+
+# @FUNCTION: eautoreconf
+# @DESCRIPTION:
+# This function mimes the behavior of autoreconf, but uses the different
+# eauto* functions to run the tools. It doesn't accept parameters, but
+# the directory with include files can be specified with AT_M4DIR variable.
+#
+# Should do a full autoreconf - normally what most people will be interested in.
+# Also should handle additional directories specified by AC_CONFIG_SUBDIRS.
+eautoreconf() {
+ local x g
+
+ # Subdirs often share a common build dir #529404. If so, we can't safely
+ # run in parallel because many tools clobber the content in there. Libtool
+ # and automake both `rm && cp` while aclocal reads the output. We might be
+ # able to handle this if we split the steps and grab locks on the dirs the
+ # tools actually write to. Then we'd run all the common tools that use
+ # those inputs. Doing this in bash does not scale easily.
+ # If we do re-enable parallel support, make sure #426512 is handled.
+ if [[ -z ${AT_NO_RECURSIVE} ]] ; then
+ # Take care of subdirs
+ for x in $(autotools_check_macro_val AC_CONFIG_SUBDIRS) ; do
+ if [[ -d ${x} ]] ; then
+ pushd "${x}" >/dev/null
+ # Avoid unsafe nested multijob_finish_one for bug #426512.
+ AT_NOELIBTOOLIZE="yes" eautoreconf || die
+ popd >/dev/null
+ fi
+ done
+ fi
+
+ einfo "Running eautoreconf in '${PWD}' ..."
+
+ local m4dirs=$(autotools_check_macro_val AC_CONFIG_{AUX,MACRO}_DIR)
+ [[ -n ${m4dirs} ]] && mkdir -p ${m4dirs}
+
+ # Run all the tools before aclocal so we can gather the .m4 files.
+ local i tools=(
+ # <tool> <was run> <command>
+ glibgettext false "autotools_run_tool glib-gettextize --copy --force"
+ gettext false "autotools_run_tool --at-missing autopoint --force"
+ # intltool must come after autopoint.
+ intltool false "autotools_run_tool intltoolize --automake --copy --force"
+ gtkdoc false "autotools_run_tool --at-missing gtkdocize --copy"
+ gnomedoc false "autotools_run_tool --at-missing gnome-doc-prepare --copy --force"
+ libtool false "_elibtoolize --install --copy --force"
+ )
+ for (( i = 0; i < ${#tools[@]}; i += 3 )) ; do
+ if _at_uses_${tools[i]} ; then
+ tools[i+1]=true
+ ${tools[i+2]}
+ fi
+ done
+
+ # Generate aclocal.m4 with our up-to-date m4 files.
+ local rerun_aclocal=false
+ eaclocal
+
+ # Check to see if we had macros expanded by other macros or in other
+ # m4 files that we couldn't detect early. This is uncommon, but some
+ # packages do this, so we have to handle it correctly.
+ for (( i = 0; i < ${#tools[@]}; i += 3 )) ; do
+ if ! ${tools[i+1]} && _at_uses_${tools[i]} ; then
+ ${tools[i+2]}
+ rerun_aclocal=true
+ fi
+ done
+ ${rerun_aclocal} && eaclocal
+
+ if [[ ${WANT_AUTOCONF} = 2.1 ]] ; then
+ eautoconf
+ else
+ eautoconf --force
+ fi
+ eautoheader
+ [[ ${AT_NOEAUTOMAKE} != "yes" ]] && FROM_EAUTORECONF="yes" eautomake ${AM_OPTS}
+
+ if [[ ${AT_NOELIBTOOLIZE} != "yes" ]] ; then
+ # Call it here to prevent failures due to elibtoolize called _before_
+ # eautoreconf.
+ elibtoolize --force "${PWD}"
+ fi
+
+ return 0
+}
+
+# @FUNCTION: _at_uses_pkg
+# @USAGE: <macros>
+# @INTERNAL
+# See if the specified macros are enabled.
+_at_uses_pkg() {
+ if [[ -n $(autotools_check_macro "$@") ]] ; then
+ return 0
+ else
+ # If the trace didn't find it (perhaps because aclocal.m4 hasn't
+ # been generated yet), cheat, but be conservative.
+ local macro args=()
+ for macro ; do
+ args+=( -e "^[[:space:]]*${macro}\>" )
+ done
+ egrep -q "${args[@]}" configure.??
+ fi
+}
+_at_uses_autoheader() { _at_uses_pkg A{C,M}_CONFIG_HEADER{S,}; }
+_at_uses_automake() { _at_uses_pkg AM_INIT_AUTOMAKE; }
+_at_uses_gettext() { _at_uses_pkg AM_GNU_GETTEXT_VERSION; }
+_at_uses_glibgettext() { _at_uses_pkg AM_GLIB_GNU_GETTEXT; }
+_at_uses_intltool() { _at_uses_pkg {AC,IT}_PROG_INTLTOOL; }
+_at_uses_gtkdoc() { _at_uses_pkg GTK_DOC_CHECK; }
+_at_uses_gnomedoc() { _at_uses_pkg GNOME_DOC_INIT; }
+_at_uses_libtool() { _at_uses_pkg A{C,M}_PROG_LIBTOOL LT_INIT; }
+
+# @FUNCTION: eaclocal_amflags
+# @DESCRIPTION:
+# Extract the ACLOCAL_AMFLAGS value from the Makefile.am and try to handle
+# (most) of the crazy crap that people throw at us.
+eaclocal_amflags() {
+ local aclocal_opts amflags_file
+
+ for amflags_file in GNUmakefile.am Makefile.am GNUmakefile.in Makefile.in ; do
+ [[ -e ${amflags_file} ]] || continue
+ # setup the env in case the pkg does something crazy
+ # in their ACLOCAL_AMFLAGS. like run a shell script
+ # which turns around and runs autotools. #365401
+ # or split across multiple lines. #383525
+ autotools_env_setup
+ aclocal_opts=$(sed -n \
+ "/^ACLOCAL_AMFLAGS[[:space:]]*=/{ \
+ # match the first line
+ s:[^=]*=::p; \
+ # then gobble up all escaped lines
+ : nextline /\\\\$/{ n; p; b nextline; } \
+ }" ${amflags_file})
+ eval aclocal_opts=\""${aclocal_opts}"\"
+ break
+ done
+
+ echo ${aclocal_opts}
+}
+
+# @FUNCTION: eaclocal
+# @DESCRIPTION:
+# These functions runs the autotools using autotools_run_tool with the
+# specified parametes. The name of the tool run is the same of the function
+# without e prefix.
+# They also force installing the support files for safety.
+# Respects AT_M4DIR for additional directories to search for macro's.
+eaclocal() {
+ [[ ! -f aclocal.m4 || -n $(grep -e 'generated.*by aclocal' aclocal.m4) ]] && \
+ autotools_run_tool --at-m4flags aclocal "$@" $(eaclocal_amflags)
+}
+
+# @FUNCTION: _elibtoolize
+# @DESCRIPTION:
+# Runs libtoolize.
+#
+# Note the '_' prefix: avoid collision with elibtoolize() from libtool.eclass.
+_elibtoolize() {
+ local LIBTOOLIZE=${LIBTOOLIZE:-$(type -P glibtoolize > /dev/null && echo glibtoolize || echo libtoolize)}
+
+ [[ -f GNUmakefile.am || -f Makefile.am ]] && set -- "$@" --automake
+
+ autotools_run_tool ${LIBTOOLIZE} "$@"
+}
+
+# @FUNCTION: eautoheader
+# @DESCRIPTION:
+# Runs autoheader.
+eautoheader() {
+ _at_uses_autoheader || return 0
+ autotools_run_tool --at-no-fail --at-m4flags autoheader "$@"
+}
+
+# @FUNCTION: eautoconf
+# @DESCRIPTION:
+# Runs autoconf.
+eautoconf() {
+ if [[ ! -f configure.ac && ! -f configure.in ]] ; then
+ echo
+ eerror "No configure.{ac,in} present in '${PWD}'!"
+ echo
+ die "No configure.{ac,in} present!"
+ fi
+ if [[ ${WANT_AUTOCONF} != "2.1" && -e configure.in ]] ; then
+ eqawarn "This package has a configure.in file which has long been deprecated. Please"
+ eqawarn "update it to use configure.ac instead as newer versions of autotools will die"
+ eqawarn "when it finds this file. See https://bugs.gentoo.org/426262 for details."
+ fi
+
+ autotools_run_tool --at-m4flags autoconf "$@"
+}
+
+# @FUNCTION: eautomake
+# @DESCRIPTION:
+# Runs automake.
+eautomake() {
+ local extra_opts=()
+ local makefile_name
+
+ # Run automake if:
+ # - a Makefile.am type file exists
+ # - the configure script is using the AM_INIT_AUTOMAKE directive
+ for makefile_name in {GNUmakefile,{M,m}akefile}.am "" ; do
+ [[ -f ${makefile_name} ]] && break
+ done
+
+ _automake_version() {
+ autotools_run_tool --at-output automake --version 2>/dev/null |
+ sed -n -e '1{s:.*(GNU automake) ::p;q}'
+ }
+
+ if [[ -z ${makefile_name} ]] ; then
+ _at_uses_automake || return 0
+
+ elif [[ -z ${FROM_EAUTORECONF} && -f ${makefile_name%.am}.in ]]; then
+ local used_automake
+ local installed_automake
+
+ installed_automake=$(WANT_AUTOMAKE= _automake_version)
+ used_automake=$(head -n 1 < ${makefile_name%.am}.in | \
+ sed -e 's:.*by automake \(.*\) from .*:\1:')
+
+ if [[ ${installed_automake} != ${used_automake} ]]; then
+ ewarn "Automake used for the package (${used_automake}) differs from" \
+ "the installed version (${installed_automake})."
+ ewarn "Forcing a full rebuild of the autotools to workaround."
+ eautoreconf
+ return 0
+ fi
+ fi
+
+ [[ -f INSTALL && -f AUTHORS && -f ChangeLog && -f NEWS && -f README ]] \
+ || extra_opts+=( --foreign )
+
+ # Older versions of automake do not support --force-missing. But we want
+ # to use this whenever possible to update random bundled files #133489.
+ case $(_automake_version) in
+ 1.4|1.4[.-]*) ;;
+ *) extra_opts+=( --force-missing ) ;;
+ esac
+
+ autotools_run_tool automake --add-missing --copy "${extra_opts[@]}" "$@"
+}
+
+# @FUNCTION: eautopoint
+# @DESCRIPTION:
+# Runs autopoint (from the gettext package).
+eautopoint() {
+ autotools_run_tool autopoint "$@"
+}
+
+# @FUNCTION: config_rpath_update
+# @USAGE: [destination]
+# @DESCRIPTION:
+# Some packages utilize the config.rpath helper script, but don't
+# use gettext directly. So we have to copy it in manually since
+# we can't let `autopoint` do it for us.
+config_rpath_update() {
+ local dst src=$(type -P gettext | sed 's:bin/gettext:share/gettext/config.rpath:')
+
+ [[ $# -eq 0 ]] && set -- $(find -name config.rpath)
+ [[ $# -eq 0 ]] && return 0
+
+ einfo "Updating all config.rpath files"
+ for dst in "$@" ; do
+ einfo " ${dst}"
+ cp "${src}" "${dst}" || die
+ done
+}
+
+# @FUNCTION: autotools_env_setup
+# @INTERNAL
+# @DESCRIPTION:
+# Process the WANT_AUTO{CONF,MAKE} flags.
+autotools_env_setup() {
+ # We do the "latest" → version switch here because it solves
+ # possible order problems, see bug #270010 as an example.
+ if [[ ${WANT_AUTOMAKE} == "latest" ]]; then
+ local pv
+ for pv in ${_LATEST_AUTOMAKE[@]/#*:} ; do
+ # has_version respects ROOT, but in this case, we don't want it to,
+ # thus "ROOT=/" prefix:
+ ROOT=/ has_version "=sys-devel/automake-${pv}*" && export WANT_AUTOMAKE="${pv}"
+ done
+ [[ ${WANT_AUTOMAKE} == "latest" ]] && \
+ die "Cannot find the latest automake! Tried ${_LATEST_AUTOMAKE[*]}"
+ fi
+ [[ ${WANT_AUTOCONF} == "latest" ]] && export WANT_AUTOCONF=2.5
+}
+
+# @FUNCTION: autotools_run_tool
+# @USAGE: [--at-no-fail] [--at-m4flags] [--at-missing] [--at-output] <autotool> [tool-specific flags]
+# @INTERNAL
+# @DESCRIPTION:
+# Run the specified autotool helper, but do logging and error checking
+# around it in the process.
+autotools_run_tool() {
+ # Process our own internal flags first
+ local autofail=true m4flags=false missing_ok=false return_output=false
+ while [[ -n $1 ]] ; do
+ case $1 in
+ --at-no-fail) autofail=false;;
+ --at-m4flags) m4flags=true;;
+ --at-missing) missing_ok=true;;
+ --at-output) return_output=true;;
+ # whatever is left goes to the actual tool
+ *) break;;
+ esac
+ shift
+ done
+
+ if [[ ${EBUILD_PHASE} != "unpack" && ${EBUILD_PHASE} != "prepare" ]]; then
+ ewarn "QA Warning: running $1 in ${EBUILD_PHASE} phase"
+ fi
+
+ if ${missing_ok} && ! type -P ${1} >/dev/null ; then
+ einfo "Skipping '$*' due $1 not installed"
+ return 0
+ fi
+
+ autotools_env_setup
+
+ local STDERR_TARGET="${T}/$1.out"
+ # most of the time, there will only be one run, but if there are
+ # more, make sure we get unique log filenames
+ if [[ -e ${STDERR_TARGET} ]] ; then
+ local i=1
+ while :; do
+ STDERR_TARGET="${T}/$1-${i}.out"
+ [[ -e ${STDERR_TARGET} ]] || break
+ : $(( i++ ))
+ done
+ fi
+
+ if ${m4flags} ; then
+ set -- "${1}" $(autotools_m4dir_include) "${@:2}" $(autotools_m4sysdir_include)
+ fi
+
+ # If the caller wants to probe something, then let them do it directly.
+ if ${return_output} ; then
+ "$@"
+ return
+ fi
+
+ printf "***** $1 *****\n***** PWD: ${PWD}\n***** $*\n\n" > "${STDERR_TARGET}"
+
+ ebegin "Running $@"
+ "$@" >> "${STDERR_TARGET}" 2>&1
+ if ! eend $? && ${autofail} ; then
+ echo
+ eerror "Failed Running $1 !"
+ eerror
+ eerror "Include in your bugreport the contents of:"
+ eerror
+ eerror " ${STDERR_TARGET}"
+ echo
+ die "Failed Running $1 !"
+ fi
+}
+
+# Internal function to check for support
+
+# Keep a list of all the macros we might use so that we only
+# have to run the trace code once. Order doesn't matter.
+ALL_AUTOTOOLS_MACROS=(
+ A{C,M}_PROG_LIBTOOL LT_INIT
+ A{C,M}_CONFIG_HEADER{S,}
+ AC_CONFIG_SUBDIRS
+ AC_CONFIG_AUX_DIR AC_CONFIG_MACRO_DIR
+ AM_INIT_AUTOMAKE
+ AM_GLIB_GNU_GETTEXT
+ AM_GNU_GETTEXT_VERSION
+ {AC,IT}_PROG_INTLTOOL
+ GTK_DOC_CHECK
+ GNOME_DOC_INIT
+)
+autotools_check_macro() {
+ [[ -f configure.ac || -f configure.in ]] || return 0
+
+ # We can run in multiple dirs, so we have to cache the trace
+ # data in $PWD rather than an env var.
+ local trace_file=".__autoconf_trace_data"
+ if [[ ! -e ${trace_file} ]] || [[ ! aclocal.m4 -ot ${trace_file} ]] ; then
+ WANT_AUTOCONF="2.5" autoconf \
+ $(autotools_m4dir_include) \
+ ${ALL_AUTOTOOLS_MACROS[@]/#/--trace=} > ${trace_file} 2>/dev/null
+ fi
+
+ local macro args=()
+ for macro ; do
+ has ${macro} ${ALL_AUTOTOOLS_MACROS[@]} || die "internal error: add ${macro} to ALL_AUTOTOOLS_MACROS"
+ args+=( -e ":${macro}:" )
+ done
+ grep "${args[@]}" ${trace_file}
+}
+
+# @FUNCTION: autotools_check_macro_val
+# @USAGE: <macro> [macros]
+# @INTERNAL
+# @DESCRIPTION:
+# Look for a macro and extract its value.
+autotools_check_macro_val() {
+ local macro scan_out
+
+ for macro ; do
+ autotools_check_macro "${macro}" | \
+ gawk -v macro="${macro}" \
+ '($0 !~ /^[[:space:]]*(#|dnl)/) {
+ if (match($0, macro ":(.*)$", res))
+ print res[1]
+ }' | uniq
+ done
+
+ return 0
+}
+
+_autotools_m4dir_include() {
+ local x include_opts flag
+
+ # Use the right flag to autoconf based on the version #448986
+ [[ ${WANT_AUTOCONF} == "2.1" ]] \
+ && flag="l" \
+ || flag="I"
+
+ for x in "$@" ; do
+ case ${x} in
+ # We handle it below
+ -${flag}) ;;
+ *)
+ [[ ! -d ${x} ]] && ewarn "autotools.eclass: '${x}' does not exist"
+ include_opts+=" -${flag} ${x}"
+ ;;
+ esac
+ done
+
+ echo ${include_opts}
+}
+autotools_m4dir_include() { _autotools_m4dir_include ${AT_M4DIR} ; }
+autotools_m4sysdir_include() {
+ # First try to use the paths the system integrator has set up.
+ local paths=( $(eval echo ${AT_SYS_M4DIR}) )
+
+ if [[ ${#paths[@]} -eq 0 && -n ${SYSROOT} ]] ; then
+ # If they didn't give us anything, then default to the SYSROOT.
+ # This helps when cross-compiling.
+ local path="${SYSROOT}/usr/share/aclocal"
+ [[ -d ${path} ]] && paths+=( "${path}" )
+ fi
+ _autotools_m4dir_include "${paths[@]}"
+}
+
+fi
diff --git a/eclass/base.eclass b/eclass/base.eclass
new file mode 100644
index 00000000000..fffdacb76c6
--- /dev/null
+++ b/eclass/base.eclass
@@ -0,0 +1,194 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @ECLASS: base.eclass
+# @MAINTAINER:
+# QA Team <qa@gentoo.org>
+# @AUTHOR:
+# Original author: Dan Armak <danarmak@gentoo.org>
+# @BLURB: The base eclass defines some default functions and variables.
+# @DESCRIPTION:
+# The base eclass defines some default functions and variables.
+
+if [[ -z ${_BASE_ECLASS} ]]; then
+_BASE_ECLASS=1
+
+inherit eutils
+
+BASE_EXPF="src_unpack src_compile src_install"
+case "${EAPI:-0}" in
+ 2|3|4|5) BASE_EXPF+=" src_prepare src_configure" ;;
+ *) ;;
+esac
+
+EXPORT_FUNCTIONS ${BASE_EXPF}
+
+# @ECLASS-VARIABLE: DOCS
+# @DESCRIPTION:
+# Array containing documents passed to dodoc command.
+#
+# DOCS=( "${S}/doc/document.txt" "${S}/doc/doc_folder/" )
+
+# @ECLASS-VARIABLE: HTML_DOCS
+# @DESCRIPTION:
+# Array containing documents passed to dohtml command.
+#
+# HTML_DOCS=( "${S}/doc/document.html" "${S}/doc/html_folder/" )
+
+# @ECLASS-VARIABLE: PATCHES
+# @DESCRIPTION:
+# PATCHES array variable containing all various patches to be applied.
+# This variable is expected to be defined in global scope of ebuild.
+# Make sure to specify the full path. This variable is utilised in
+# src_unpack/src_prepare phase based on EAPI.
+#
+# NOTE: if using patches folders with special file suffixes you have to
+# define one additional variable EPATCH_SUFFIX="something"
+#
+# PATCHES=( "${FILESDIR}/mypatch.patch" "${FILESDIR}/patches_folder/" )
+
+
+# @FUNCTION: base_src_unpack
+# @DESCRIPTION:
+# The base src_unpack function, which is exported.
+# Calls also src_prepare with eapi older than 2.
+base_src_unpack() {
+ debug-print-function $FUNCNAME "$@"
+
+ pushd "${WORKDIR}" > /dev/null
+
+ if [[ $(type -t unpacker_src_unpack) == "function" ]] ; then
+ unpacker_src_unpack
+ elif [[ -n ${A} ]] ; then
+ unpack ${A}
+ fi
+ has src_prepare ${BASE_EXPF} || base_src_prepare
+
+ popd > /dev/null
+}
+
+# @FUNCTION: base_src_prepare
+# @DESCRIPTION:
+# The base src_prepare function, which is exported
+# EAPI is greater or equal to 2. Here the PATCHES array is evaluated.
+base_src_prepare() {
+ debug-print-function $FUNCNAME "$@"
+ debug-print "$FUNCNAME: PATCHES=$PATCHES"
+
+ local patches_failed=0
+
+ pushd "${S}" > /dev/null
+ if [[ "$(declare -p PATCHES 2>/dev/null 2>&1)" == "declare -a"* ]]; then
+ for x in "${PATCHES[@]}"; do
+ debug-print "$FUNCNAME: applying patch from ${x}"
+ if [[ -d "${x}" ]]; then
+ # Use standardized names and locations with bulk patching
+ # Patch directory is ${WORKDIR}/patch
+ # See epatch() in eutils.eclass for more documentation
+ EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch}
+
+ # in order to preserve normal EPATCH_SOURCE value that can
+ # be used other way than with base eclass store in local
+ # variable and restore later
+ oldval=${EPATCH_SOURCE}
+ EPATCH_SOURCE=${x}
+ EPATCH_FORCE=yes
+ epatch
+ EPATCH_SOURCE=${oldval}
+ elif [[ -f "${x}" ]]; then
+ epatch "${x}"
+ else
+ ewarn "QA: File or directory \"${x}\" does not exist."
+ ewarn "QA: Check your PATCHES array or add missing file/directory."
+ patches_failed=1
+ fi
+ done
+ [[ ${patches_failed} -eq 1 ]] && die "Some patches failed. See above messages."
+ else
+ for x in ${PATCHES}; do
+ debug-print "$FUNCNAME: patching from ${x}"
+ epatch "${x}"
+ done
+ fi
+
+ # Apply user patches
+ debug-print "$FUNCNAME: applying user patches"
+ epatch_user
+
+ popd > /dev/null
+}
+
+# @FUNCTION: base_src_configure
+# @DESCRIPTION:
+# The base src_configure function, which is exported when
+# EAPI is greater or equal to 2. Runs basic econf.
+base_src_configure() {
+ debug-print-function $FUNCNAME "$@"
+
+ # there is no pushd ${S} so we can override its place where to run
+ [[ -x ${ECONF_SOURCE:-.}/configure ]] && econf "$@"
+}
+
+# @FUNCTION: base_src_compile
+# @DESCRIPTION:
+# The base src_compile function, calls src_configure with
+# EAPI older than 2.
+base_src_compile() {
+ debug-print-function $FUNCNAME "$@"
+
+ has src_configure ${BASE_EXPF} || base_src_configure
+ base_src_make "$@"
+}
+
+# @FUNCTION: base_src_make
+# @DESCRIPTION:
+# Actual function that runs emake command.
+base_src_make() {
+ debug-print-function $FUNCNAME "$@"
+
+ if [[ -f Makefile || -f GNUmakefile || -f makefile ]]; then
+ emake "$@" || die "died running emake, $FUNCNAME"
+ fi
+}
+
+# @FUNCTION: base_src_install
+# @DESCRIPTION:
+# The base src_install function. Runs make install and
+# installs documents and html documents from DOCS and HTML_DOCS
+# arrays.
+base_src_install() {
+ debug-print-function $FUNCNAME "$@"
+
+ emake DESTDIR="${D}" "$@" install || die "died running make install, $FUNCNAME"
+ base_src_install_docs
+}
+
+# @FUNCTION: base_src_install_docs
+# @DESCRIPTION:
+# Actual function that install documentation from
+# DOCS and HTML_DOCS arrays.
+base_src_install_docs() {
+ debug-print-function $FUNCNAME "$@"
+
+ local x
+
+ pushd "${S}" > /dev/null
+
+ if [[ "$(declare -p DOCS 2>/dev/null 2>&1)" == "declare -a"* ]]; then
+ for x in "${DOCS[@]}"; do
+ debug-print "$FUNCNAME: docs: creating document from ${x}"
+ dodoc "${x}" || die "dodoc failed"
+ done
+ fi
+ if [[ "$(declare -p HTML_DOCS 2>/dev/null 2>&1)" == "declare -a"* ]]; then
+ for x in "${HTML_DOCS[@]}"; do
+ debug-print "$FUNCNAME: docs: creating html document from ${x}"
+ dohtml -r "${x}" || die "dohtml failed"
+ done
+ fi
+
+ popd > /dev/null
+}
+
+fi
diff --git a/eclass/bash-completion-r1.eclass b/eclass/bash-completion-r1.eclass
new file mode 100644
index 00000000000..25519736122
--- /dev/null
+++ b/eclass/bash-completion-r1.eclass
@@ -0,0 +1,134 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @ECLASS: bash-completion-r1.eclass
+# @MAINTAINER:
+# mgorny@gentoo.org
+# @BLURB: A few quick functions to install bash-completion files
+# @EXAMPLE:
+#
+# @CODE
+# EAPI=5
+#
+# src_configure() {
+# econf \
+# --with-bash-completion-dir="$(get_bashcompdir)"
+# }
+#
+# src_install() {
+# default
+#
+# newbashcomp contrib/${PN}.bash-completion ${PN}
+# }
+# @CODE
+
+inherit toolchain-funcs
+
+case ${EAPI:-0} in
+ 0|1|2|3|4|5) ;;
+ *) die "EAPI ${EAPI} unsupported (yet)."
+esac
+
+# @FUNCTION: _bash-completion-r1_get_bashdir
+# @INTERNAL
+# @DESCRIPTION:
+# First argument is name of the string in bash-completion.pc
+# Second argument is the fallback directory if the string is not found
+# @EXAMPLE:
+# _bash-completion-r1_get_bashdir completionsdir /usr/share/bash-completion
+_bash-completion-r1_get_bashdir() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ if $(tc-getPKG_CONFIG) --exists bash-completion &>/dev/null; then
+ local path="$($(tc-getPKG_CONFIG) --variable=$1 bash-completion)"
+ # we need to return unprefixed, so strip from what pkg-config returns
+ # to us, bug #477692
+ echo "${path#${EPREFIX}}"
+ else
+ echo $2
+ fi
+}
+
+# @FUNCTION: _bash-completion-r1_get_bashcompdir
+# @INTERNAL
+# @DESCRIPTION:
+# Get unprefixed bash-completion completions directory.
+_bash-completion-r1_get_bashcompdir() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ _bash-completion-r1_get_bashdir completionsdir /usr/share/bash-completion/completions
+}
+
+# @FUNCTION: _bash-completion-r1_get_helpersdir
+# @INTERNAL
+# @DESCRIPTION:
+# Get unprefixed bash-completion helpers directory.
+_bash-completion-r1_get_bashhelpersdir() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ _bash-completion-r1_get_bashdir helpersdir /usr/share/bash-completion/helpers
+}
+
+# @FUNCTION: get_bashcompdir
+# @DESCRIPTION:
+# Get the bash-completion completions directory.
+get_bashcompdir() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ echo "${EPREFIX}$(_bash-completion-r1_get_bashcompdir)"
+}
+
+# @FUNCTION: get_bashhelpersdir
+# @INTERNAL
+# @DESCRIPTION:
+# Get the bash-completion helpers directory.
+get_bashhelpersdir() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ echo "${EPREFIX}$(_bash-completion-r1_get_bashhelpersdir)"
+}
+
+# @FUNCTION: dobashcomp
+# @USAGE: file [...]
+# @DESCRIPTION:
+# Install bash-completion files passed as args. Has EAPI-dependant failure
+# behavior (like doins).
+dobashcomp() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ (
+ insinto "$(_bash-completion-r1_get_bashcompdir)"
+ doins "${@}"
+ )
+}
+
+# @FUNCTION: newbashcomp
+# @USAGE: file newname
+# @DESCRIPTION:
+# Install bash-completion file under a new name. Has EAPI-dependant failure
+# behavior (like newins).
+newbashcomp() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ (
+ insinto "$(_bash-completion-r1_get_bashcompdir)"
+ newins "${@}"
+ )
+}
+
+# @FUNCTION: bashcomp_alias
+# @USAGE: <basename> <alias>...
+# @DESCRIPTION:
+# Alias <basename> completion to one or more commands (<alias>es).
+bashcomp_alias() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ [[ ${#} -lt 2 ]] && die "Usage: ${FUNCNAME} <basename> <alias>..."
+ local base=${1} f
+ shift
+
+ for f; do
+ dosym "${base}" "$(_bash-completion-r1_get_bashcompdir)/${f}"
+ done
+}
diff --git a/eclass/bash-completion.eclass b/eclass/bash-completion.eclass
new file mode 100644
index 00000000000..846e8c8e634
--- /dev/null
+++ b/eclass/bash-completion.eclass
@@ -0,0 +1,101 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# DEPRECATED
+# This eclass has been superseded by bash-completion-r1 eclass.
+# Please modify your ebuilds to use that one instead.
+
+# @ECLASS: bash-completion.eclass
+# @MAINTAINER:
+# shell-tools@gentoo.org.
+# @AUTHOR:
+# Original author: Aaron Walker <ka0ttic@gentoo.org>
+# @BLURB: An Interface for installing contributed bash-completion scripts
+# @DESCRIPTION:
+# Simple eclass that provides an interface for installing
+# contributed (ie not included in bash-completion proper)
+# bash-completion scripts.
+#
+# Note: this eclass has been deprecated in favor of bash-completion-r1. Please
+# use that one instead.
+
+# @ECLASS-VARIABLE: BASHCOMPLETION_NAME
+# @DESCRIPTION:
+# Install the completion script with this name (see also dobashcompletion)
+
+# @ECLASS-VARIABLE: BASHCOMPFILES
+# @DESCRIPTION:
+# Space delimited list of files to install if dobashcompletion is called without
+# arguments.
+
+inherit eutils
+
+EXPORT_FUNCTIONS pkg_postinst
+
+IUSE="bash-completion"
+
+# Allow eclass to be inherited by eselect without a circular dependency
+if [[ ${CATEGORY}/${PN} != app-admin/eselect ]]; then
+ RDEPEND="bash-completion? ( app-admin/eselect )"
+fi
+PDEPEND="bash-completion? ( app-shells/bash-completion )"
+
+# @FUNCTION: dobashcompletion
+# @USAGE: [file] [new_file]
+# @DESCRIPTION:
+# The first argument is the location of the bash-completion script to install,
+# and is required if BASHCOMPFILES is not set. The second argument is the name
+# the script will be installed as. If BASHCOMPLETION_NAME is set, it overrides
+# the second argument. If no second argument is given and BASHCOMPLETION_NAME
+# is not set, it will default to ${PN}.
+dobashcompletion() {
+ local f
+
+ eqawarn "bash-completion.eclass has been deprecated."
+ eqawarn "Please update your ebuilds to use bash-completion-r1 instead."
+
+ if [[ -z ${1} && -z ${BASHCOMPFILES} ]]; then
+ die "Usage: dobashcompletion [file] [new file]"
+ fi
+
+ if use bash-completion; then
+ insinto /usr/share/bash-completion
+ if [[ -n ${1} ]]; then
+ [[ -z ${BASHCOMPLETION_NAME} ]] && BASHCOMPLETION_NAME="${2:-${PN}}"
+ newins "${1}" "${BASHCOMPLETION_NAME}" || die "Failed to install ${1}"
+ else
+ set -- ${BASHCOMPFILES}
+ for f in "$@"; do
+ if [[ -e ${f} ]]; then
+ doins "${f}" || die "Failed to install ${f}"
+ fi
+ done
+ fi
+ fi
+}
+
+# @FUNCTION: bash-completion_pkg_postinst
+# @DESCRIPTION:
+# The bash-completion pkg_postinst function, which is exported
+bash-completion_pkg_postinst() {
+ local f
+
+ if use bash-completion ; then
+ elog "The following bash-completion scripts have been installed:"
+ if [[ -n ${BASHCOMPLETION_NAME} ]]; then
+ elog " ${BASHCOMPLETION_NAME}"
+ else
+ set -- ${BASHCOMPFILES}
+ for f in "$@"; do
+ elog " $(basename ${f})"
+ done
+ fi
+ elog
+ elog "To enable command-line completion on a per-user basis run:"
+ elog " eselect bashcomp enable <script>"
+ elog
+ elog "To enable command-line completion system-wide run:"
+ elog " eselect bashcomp enable --global <script>"
+ fi
+}
diff --git a/eclass/bitcoincore.eclass b/eclass/bitcoincore.eclass
new file mode 100644
index 00000000000..69ed9d69d6c
--- /dev/null
+++ b/eclass/bitcoincore.eclass
@@ -0,0 +1,309 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+#
+# @ECLASS: bitcoincore.eclass
+# @MAINTAINER:
+# Luke Dashjr <luke_gentoo_bitcoin@dashjr.org>
+# @BLURB: common code for Bitcoin Core ebuilds
+# @DESCRIPTION:
+# This eclass is used in Bitcoin Core ebuilds (bitcoin-qt, bitcoind,
+# libbitcoinconsensus) to provide a single common place for the common ebuild
+# stuff.
+#
+# The eclass provides all common dependencies as well as common use flags.
+
+has "${EAPI:-0}" 5 || die "EAPI=${EAPI} not supported"
+
+if [[ ! ${_BITCOINCORE_ECLASS} ]]; then
+
+in_bcc_iuse() {
+ local liuse=( ${BITCOINCORE_IUSE} )
+ has "${1}" "${liuse[@]#[+-]}"
+}
+
+in_bcc_policy() {
+ local liuse=( ${BITCOINCORE_POLICY_PATCHES} )
+ has "${1}" "${liuse[@]#[+-]}"
+}
+
+DB_VER="4.8"
+inherit autotools db-use eutils
+
+if [ -z "$BITCOINCORE_COMMITHASH" ]; then
+ inherit git-2
+fi
+
+fi
+
+EXPORT_FUNCTIONS src_prepare src_test src_install
+
+if in_bcc_iuse ljr || in_bcc_iuse 1stclassmsg || in_bcc_iuse zeromq || [ -n "$BITCOINCORE_POLICY_PATCHES" ]; then
+ EXPORT_FUNCTIONS pkg_pretend
+fi
+
+if [[ ! ${_BITCOINCORE_ECLASS} ]]; then
+
+# @ECLASS-VARIABLE: BITCOINCORE_COMMITHASH
+# @DESCRIPTION:
+# Set this variable before the inherit line, to the upstream commit hash.
+
+# @ECLASS-VARIABLE: BITCOINCORE_IUSE
+# @DESCRIPTION:
+# Set this variable before the inherit line, to the USE flags supported.
+
+# @ECLASS-VARIABLE: BITCOINCORE_LJR_DATE
+# @DESCRIPTION:
+# Set this variable before the inherit line, to the datestamp of the ljr
+# patchset.
+
+# @ECLASS-VARIABLE: BITCOINCORE_POLICY_PATCHES
+# @DESCRIPTION:
+# Set this variable before the inherit line, to a space-delimited list of
+# supported policies.
+
+MyPV="${PV/_/}"
+MyPN="bitcoin"
+MyP="${MyPN}-${MyPV}"
+
+# These are expected to change in future versions
+DOCS="${DOCS} doc/README.md doc/release-notes.md"
+OPENSSL_DEPEND="dev-libs/openssl:0[-bindist]"
+WALLET_DEPEND="sys-libs/db:$(db_ver_to_slot "${DB_VER}")[cxx]"
+[ -n "${BITCOINCORE_LJR_PV}" ] || BITCOINCORE_LJR_PV="${PV}"
+
+case "${PV}" in
+0.10*)
+ BITCOINCORE_SERIES="0.10.x"
+ LIBSECP256K1_DEPEND="=dev-libs/libsecp256k1-0.0.0_pre20141212"
+ case "${PVR}" in
+ 0.10.2)
+ BITCOINCORE_RBF_DIFF="16f45600c8c372a738ffef544292864256382601...a23678edc70204599299459a206709a00e039db7"
+ BITCOINCORE_RBF_PATCHFILE="${MyPN}-rbf-v0.10.2.patch"
+ ;;
+ *)
+ BITCOINCORE_RBF_DIFF="16f45600c8c372a738ffef544292864256382601...4890416cde655559eba09d3fd6f79db7d0d6314a"
+ BITCOINCORE_RBF_PATCHFILE="${MyPN}-rbf-v0.10.2-r1.patch"
+ ;;
+ esac
+ BITCOINCORE_XT_DIFF="047a89831760ff124740fe9f58411d57ee087078...d4084b62c42c38bfe302d712b98909ab26ecce2f"
+ ;;
+0.11*)
+ BITCOINCORE_SERIES="0.11.x"
+ LIBSECP256K1_DEPEND="=dev-libs/libsecp256k1-0.0.0_pre20150423"
+ BITCOINCORE_RBF_DIFF="5f032c75eefb0fe8ff79ed9595da1112c05f5c4a...660b96d24916b8ef4e0677e5d6162e24e2db447e"
+ BITCOINCORE_RBF_PATCHFILE="${MyPN}-rbf-v0.11.0rc3.patch"
+ ;;
+9999*)
+ BITCOINCORE_SERIES="9999"
+ LIBSECP256K1_DEPEND=">dev-libs/libsecp256k1-0.0.0_pre20150422"
+ ;;
+*)
+ die "Unrecognised version"
+ ;;
+esac
+
+LJR_PV() { echo "${BITCOINCORE_LJR_PV}.${1}${BITCOINCORE_LJR_DATE}"; }
+LJR_PATCHDIR="${MyPN}-$(LJR_PV ljr).patches"
+LJR_PATCH() { echo "${WORKDIR}/${LJR_PATCHDIR}/${MyPN}-$(LJR_PV ljr).$@.patch"; }
+LJR_PATCH_DESC="http://luke.dashjr.org/programs/${MyPN}/files/${MyPN}d/luke-jr/${BITCOINCORE_SERIES}/$(LJR_PV ljr)/${MyPN}-$(LJR_PV ljr).desc.txt"
+
+HOMEPAGE="https://github.com/bitcoin/bitcoin"
+
+if [ -z "$BITCOINCORE_COMMITHASH" ]; then
+ EGIT_PROJECT='bitcoin'
+ EGIT_REPO_URI="git://github.com/bitcoin/bitcoin.git https://github.com/bitcoin/bitcoin.git"
+else
+ SRC_URI="https://github.com/${MyPN}/${MyPN}/archive/${BITCOINCORE_COMMITHASH}.tar.gz -> ${MyPN}-v${PV}${BITCOINCORE_SRC_SUFFIX}.tgz"
+ if [ -z "${BITCOINCORE_NO_SYSLIBS}" ]; then
+ SRC_URI="${SRC_URI} http://luke.dashjr.org/programs/${MyPN}/files/${MyPN}d/luke-jr/${BITCOINCORE_SERIES}/$(LJR_PV ljr)/${LJR_PATCHDIR}.txz -> ${LJR_PATCHDIR}.tar.xz"
+ fi
+ if in_bcc_iuse xt; then
+ BITCOINXT_PATCHFILE="${MyPN}xt-v${PV}.patch"
+ SRC_URI="${SRC_URI} xt? ( https://github.com/bitcoinxt/bitcoinxt/compare/${BITCOINCORE_XT_DIFF}.diff -> ${BITCOINXT_PATCHFILE} )"
+ fi
+ if in_bcc_policy rbf; then
+ SRC_URI="${SRC_URI} bitcoin_policy_rbf? ( https://github.com/petertodd/bitcoin/compare/${BITCOINCORE_RBF_DIFF}.diff -> ${BITCOINCORE_RBF_PATCHFILE} )"
+ fi
+ S="${WORKDIR}/${MyPN}-${BITCOINCORE_COMMITHASH}"
+fi
+
+bitcoincore_policy_iuse() {
+ local mypolicy iuse_def new_BITCOINCORE_IUSE=
+ for mypolicy in ${BITCOINCORE_POLICY_PATCHES}; do
+ if [[ "${mypolicy:0:1}" =~ ^[+-] ]]; then
+ iuse_def=${mypolicy:0:1}
+ mypolicy="${mypolicy:1}"
+ else
+ iuse_def=
+ fi
+ new_BITCOINCORE_IUSE="$new_BITCOINCORE_IUSE ${iuse_def}bitcoin_policy_${mypolicy}"
+ done
+ echo $new_BITCOINCORE_IUSE
+}
+IUSE="$IUSE $BITCOINCORE_IUSE $(bitcoincore_policy_iuse)"
+if in_bcc_policy rbf && in_bcc_iuse xt; then
+ REQUIRED_USE="${REQUIRED_USE} bitcoin_policy_rbf? ( !xt )"
+fi
+
+BITCOINCORE_COMMON_DEPEND="
+ ${OPENSSL_DEPEND}
+"
+if [ "${BITCOINCORE_NEED_LIBSECP256K1}" = "1" ]; then
+ BITCOINCORE_COMMON_DEPEND="${BITCOINCORE_COMMON_DEPEND} $LIBSECP256K1_DEPEND"
+fi
+if [ "${PN}" != "libbitcoinconsensus" ]; then
+ BITCOINCORE_COMMON_DEPEND="${BITCOINCORE_COMMON_DEPEND} >=dev-libs/boost-1.52.0[threads(+)]"
+fi
+bitcoincore_common_depend_use() {
+ in_bcc_iuse "$1" || return
+ BITCOINCORE_COMMON_DEPEND="${BITCOINCORE_COMMON_DEPEND} $1? ( $2 )"
+}
+bitcoincore_common_depend_use upnp net-libs/miniupnpc
+bitcoincore_common_depend_use wallet "${WALLET_DEPEND}"
+bitcoincore_common_depend_use zeromq net-libs/zeromq
+RDEPEND="${RDEPEND} ${BITCOINCORE_COMMON_DEPEND}"
+DEPEND="${DEPEND} ${BITCOINCORE_COMMON_DEPEND}
+ >=app-shells/bash-4.1
+ sys-apps/sed
+"
+if [ "${BITCOINCORE_NEED_LEVELDB}" = "1" ]; then
+ RDEPEND="${RDEPEND} virtual/bitcoin-leveldb"
+fi
+if in_bcc_iuse ljr && [ "$BITCOINCORE_SERIES" = "0.10.x" ]; then
+ DEPEND="${DEPEND} ljr? ( dev-vcs/git )"
+fi
+
+bitcoincore_policymsg() {
+ local USEFlag="bitcoin_policy_$1"
+ in_iuse "${USEFlag}" || return
+ if use "${USEFlag}"; then
+ [ -n "$2" ] && einfo "$2"
+ else
+ [ -n "$3" ] && einfo "$3"
+ fi
+ bitcoincore_policymsg_flag=true
+}
+
+bitcoincore_pkg_pretend() {
+ bitcoincore_policymsg_flag=false
+ if use_if_iuse ljr || use_if_iuse 1stclassmsg || use_if_iuse xt || use_if_iuse zeromq; then
+ einfo "Extra functionality improvements to Bitcoin Core are enabled."
+ bitcoincore_policymsg_flag=true
+ fi
+ bitcoincore_policymsg cltv \
+ "CLTV policy is enabled: Your node will recognise and assist OP_CHECKLOCKTIMEVERIFY (BIP65) transactions." \
+ "CLTV policy is disabled: Your node will not recognise OP_CHECKLOCKTIMEVERIFY (BIP65) transactions."
+ bitcoincore_policymsg cpfp \
+ "CPFP policy is enabled: If you mine, you will give consideration to child transaction fees to pay for their parents." \
+ "CPFP policy is disabled: If you mine, you will ignore transactions unless they have sufficient fee themselves, even if child transactions offer a fee to cover their cost."
+ bitcoincore_policymsg dcmp \
+ "Data Carrier Multi-Push policy is enabled: Your node will assist transactions with at most a single multiple-'push' data carrier output." \
+ "Data Carrier Multi-Push policy is disabled: Your node will assist transactions with at most a single data carrier output with only a single 'push'."
+ bitcoincore_policymsg rbf \
+ "Replace By Fee policy is enabled: Your node will preferentially mine and relay transactions paying the highest fee, regardless of receive order." \
+ "Replace By Fee policy is disabled: Your node will only accept the first transaction seen consuming a conflicting input, regardless of fee offered by later ones."
+ bitcoincore_policymsg spamfilter \
+ "Enhanced spam filter is enabled: A blacklist (seen as controversial by some) will be used by your node. This may impact your ability to use some services (see link for a list)." \
+ "Enhanced spam filter is disabled: Your node will not be checking for notorious spammers, and may assist them."
+ $bitcoincore_policymsg_flag && einfo "For more information on any of the above, see ${LJR_PATCH_DESC}"
+}
+
+bitcoincore_prepare() {
+ if [ -n "${BITCOINCORE_NO_SYSLIBS}" ]; then
+ true
+ elif [ "${PV}" = "9999" ]; then
+ epatch "${FILESDIR}/${PV}-syslibs.patch"
+ else
+ epatch "$(LJR_PATCH syslibs)"
+ fi
+ if use_if_iuse ljr; then
+ if [ "${BITCOINCORE_SERIES}" = "0.10.x" ]; then
+ # Regular epatch won't work with binary files
+ local patchfile="$(LJR_PATCH ljrF)"
+ einfo "Applying ${patchfile##*/} ..."
+ git apply --whitespace=nowarn "${patchfile}" || die
+ else
+ epatch "$(LJR_PATCH ljrF)"
+ fi
+ fi
+ if use_if_iuse 1stclassmsg; then
+ epatch "$(LJR_PATCH 1stclassmsg)"
+ fi
+ if use_if_iuse xt; then
+ epatch "${DISTDIR}/${BITCOINXT_PATCHFILE}"
+ fi
+ use_if_iuse zeromq && epatch "$(LJR_PATCH zeromq)"
+ for mypolicy in ${BITCOINCORE_POLICY_PATCHES}; do
+ mypolicy="${mypolicy#[-+]}"
+ use bitcoin_policy_${mypolicy} || continue
+ case "${mypolicy}" in
+ rbf)
+ epatch "${DISTDIR}/${BITCOINCORE_RBF_PATCHFILE}"
+ ;;
+ *)
+ epatch "$(LJR_PATCH ${mypolicy})"
+ ;;
+ esac
+ done
+}
+
+bitcoincore_autoreconf() {
+ eautoreconf
+ rm -r src/leveldb || die
+ rm -r src/secp256k1 || die
+}
+
+bitcoincore_src_prepare() {
+ bitcoincore_prepare
+ bitcoincore_autoreconf
+}
+
+bitcoincore_conf() {
+ local my_econf=
+ if use_if_iuse upnp; then
+ my_econf="${my_econf} --with-miniupnpc --enable-upnp-default"
+ else
+ my_econf="${my_econf} --without-miniupnpc --disable-upnp-default"
+ fi
+ if use_if_iuse test; then
+ my_econf="${my_econf} --enable-tests"
+ else
+ my_econf="${my_econf} --disable-tests"
+ fi
+ if use_if_iuse wallet; then
+ my_econf="${my_econf} --enable-wallet"
+ else
+ my_econf="${my_econf} --disable-wallet"
+ fi
+ if [ -z "${BITCOINCORE_NO_SYSLIBS}" ]; then
+ my_econf="${my_econf} --disable-util-cli --disable-util-tx"
+ else
+ my_econf="${my_econf} --without-utils"
+ fi
+ if [ "${BITCOINCORE_NEED_LEVELDB}" = "1" ]; then
+ # Passing --with-system-leveldb fails if leveldb is not installed, so only use it for targets that use LevelDB
+ my_econf="${my_econf} --with-system-leveldb"
+ fi
+ econf \
+ --disable-ccache \
+ --disable-static \
+ --with-system-libsecp256k1 \
+ --without-libs \
+ --without-daemon \
+ --without-gui \
+ ${my_econf} \
+ "$@"
+}
+
+bitcoincore_src_test() {
+ emake check
+}
+
+bitcoincore_src_install() {
+ default
+ [ "${PN}" = "libbitcoinconsensus" ] || rm "${D}/usr/bin/test_bitcoin"
+}
+
+_BITCOINCORE_ECLASS=1
+fi
diff --git a/eclass/bsdmk.eclass b/eclass/bsdmk.eclass
new file mode 100644
index 00000000000..5a02d052341
--- /dev/null
+++ b/eclass/bsdmk.eclass
@@ -0,0 +1,85 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @ECLASS: bsdmk.eclass
+# @MAINTAINER:
+# Otavio R. Piske "AngusYoung" <angusyoung@gentoo.org>
+# Diego Pettenò <flameeyes@gentoo.org>
+# Benigno B. Junior <bbj@gentoo.org>
+# @BLURB: Some functions for BSDmake
+
+inherit toolchain-funcs portability flag-o-matic
+
+EXPORT_FUNCTIONS src_compile src_install
+
+RDEPEND=""
+# this should actually be BDEPEND, but this works.
+DEPEND="virtual/pmake"
+
+ESED="/usr/bin/sed"
+
+# @ECLASS-VARIABLE: mymakeopts
+# @DESCRIPTION:
+# Options for bsd-make
+
+# @FUNCTION: append-opt
+# @USAGE: < options >
+# @DESCRIPTION:
+# append options to enable or disable features
+append-opt() {
+ mymakeopts="${mymakeopts} $@"
+}
+
+# @FUNCTION: mkmake
+# @USAGE: [ options ]
+# @DESCRIPTION:
+# calls bsd-make command with the given options, passing ${mymakeopts} to
+# enable ports to useflags bridge.
+mkmake() {
+ [[ -z ${BMAKE} ]] && BMAKE="$(get_bmake)"
+
+ tc-export CC CXX LD RANLIB
+
+ ${BMAKE} ${MAKEOPTS} ${EXTRA_EMAKE} ${mymakeopts} NO_WERROR= STRIP= "$@"
+}
+
+# @FUNCTION: mkinstall
+# @USAGE: [ options ]
+# @DESCRIPTION:
+# Calls "bsd-make install" with the given options, passing ${mamakeopts} to
+# enable ports to useflags bridge
+mkinstall() {
+ [[ -z ${BMAKE} ]] && BMAKE="$(get_bmake)"
+
+ # STRIP= will replace the default value of -s, leaving to portage the
+ # task of stripping executables.
+ ${BMAKE} ${mymakeopts} NO_WERROR= STRIP= MANSUBDIR= DESTDIR="${D}" "$@" install
+}
+
+# @FUNCTION: dummy_mk
+# @USAGE: < dirnames >
+# @DESCRIPTION:
+# removes the specified subdirectories and creates a dummy makefile in them
+# useful to remove the need for "minimal" patches
+dummy_mk() {
+ for dir in $@; do
+ [ -d ${dir} ] || ewarn "dummy_mk called on a non-existing directory: $dir"
+ [ -f ${dir}/Makefile ] || ewarn "dummy_mk called on a directory without Makefile: $dir"
+ echo ".include <bsd.lib.mk>" > ${dir}/Makefile
+ done
+}
+
+# @FUNCTION: bsdmk_src_compile
+# @DESCRIPTION:
+# The bsdmk src_compile function, which is exported
+bsdmk_src_compile() {
+ mkmake "$@" || die "make failed"
+}
+
+# @FUNCTION: bsdmk_src_install
+# @DESCRIPTION:
+# The bsdmk src_install function, which is exported
+bsdmk_src_install() {
+ mkinstall || die "install failed"
+}
diff --git a/eclass/bzr.eclass b/eclass/bzr.eclass
new file mode 100644
index 00000000000..9b457f2b6d7
--- /dev/null
+++ b/eclass/bzr.eclass
@@ -0,0 +1,341 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+#
+# @ECLASS: bzr.eclass
+# @MAINTAINER:
+# Bazaar team <bazaar@gentoo.org>
+# @AUTHOR:
+# Jorge Manuel B. S. Vicetto <jmbsvicetto@gentoo.org>
+# Mark Lee <bzr-gentoo-overlay@lazymalevolence.com>
+# Ulrich Müller <ulm@gentoo.org>
+# Christian Faulhammer <fauli@gentoo.org>
+# @BLURB: generic fetching functions for the Bazaar VCS
+# @DESCRIPTION:
+# The bzr.eclass provides functions to fetch, unpack, patch, and
+# bootstrap sources from repositories of the Bazaar distributed version
+# control system. The eclass was originally derived from git.eclass.
+#
+# Note: Just set EBZR_REPO_URI to the URI of the branch and src_unpack()
+# of this eclass will export the branch to ${WORKDIR}/${P}.
+
+inherit eutils
+
+EBZR="bzr.eclass"
+
+case "${EAPI:-0}" in
+ 0|1) EXPORT_FUNCTIONS src_unpack ;;
+ *) EXPORT_FUNCTIONS src_unpack src_prepare ;;
+esac
+
+DEPEND=">=dev-vcs/bzr-2.0.1"
+case "${EAPI:-0}" in
+ 0|1) ;;
+ *) [[ ${EBZR_REPO_URI%%:*} = sftp ]] \
+ && DEPEND=">=dev-vcs/bzr-2.0.1[sftp]" ;;
+esac
+
+# @ECLASS-VARIABLE: EBZR_STORE_DIR
+# @DESCRIPTION:
+# The directory to store all fetched Bazaar live sources.
+: ${EBZR_STORE_DIR:=${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}/bzr-src}
+
+# @ECLASS-VARIABLE: EBZR_UNPACK_DIR
+# @DESCRIPTION:
+# The working directory where the sources are copied to.
+: ${EBZR_UNPACK_DIR:=${WORKDIR}/${P}}
+
+# @ECLASS-VARIABLE: EBZR_INIT_REPO_CMD
+# @DESCRIPTION:
+# The Bazaar command to initialise a shared repository.
+: ${EBZR_INIT_REPO_CMD:="bzr init-repository --no-trees"}
+
+# @ECLASS-VARIABLE: EBZR_FETCH_CMD
+# @DESCRIPTION:
+# The Bazaar command to fetch the sources.
+: ${EBZR_FETCH_CMD:="bzr branch --no-tree"}
+
+# @ECLASS-VARIABLE: EBZR_UPDATE_CMD
+# @DESCRIPTION:
+# The Bazaar command to update the sources.
+: ${EBZR_UPDATE_CMD:="bzr pull"}
+
+# @ECLASS-VARIABLE: EBZR_EXPORT_CMD
+# @DESCRIPTION:
+# The Bazaar command to export a branch.
+: ${EBZR_EXPORT_CMD:="bzr export"}
+
+# @ECLASS-VARIABLE: EBZR_CHECKOUT_CMD
+# @DESCRIPTION:
+# The Bazaar command to checkout a branch.
+: ${EBZR_CHECKOUT_CMD:="bzr checkout --lightweight -q"}
+
+# @ECLASS-VARIABLE: EBZR_REVNO_CMD
+# @DESCRIPTION:
+# The Bazaar command to list a revision number of the branch.
+: ${EBZR_REVNO_CMD:="bzr revno"}
+
+# @ECLASS-VARIABLE: EBZR_OPTIONS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# The options passed to the fetch and update commands.
+
+# @ECLASS-VARIABLE: EBZR_REPO_URI
+# @DEFAULT_UNSET
+# @REQUIRED
+# @DESCRIPTION:
+# The repository URI for the source package.
+#
+# Note: If the ebuild uses an sftp:// URI, then in EAPI 0 or 1 it must
+# make sure that dev-vcs/bzr was built with USE="sftp". In EAPI 2 or
+# later, the eclass will depend on dev-vcs/bzr[sftp].
+
+# @ECLASS-VARIABLE: EBZR_INITIAL_URI
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# The URI used for initial branching of the source repository. If this
+# variable is set, the initial branch will be cloned from the location
+# specified, followed by a pull from ${EBZR_REPO_URI}. This is intended
+# for special cases, e.g. when download from the original repository is
+# slow, but a fast mirror exists but may be out of date.
+#
+# Normally, this variable needs not be set.
+
+# @ECLASS-VARIABLE: EBZR_BOOTSTRAP
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Bootstrap script or command like autogen.sh or etc.
+
+# @ECLASS-VARIABLE: EBZR_PATCHES
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# bzr.eclass can apply patches in bzr_bootstrap(). You can use regular
+# expressions in this variable like *.diff or *.patch and the like.
+# Note: These patches will be applied before EBZR_BOOTSTRAP is processed.
+#
+# Patches are searched both in ${PWD} and ${FILESDIR}. If not found in
+# either location, the installation dies.
+
+# @ECLASS-VARIABLE: EBZR_PROJECT
+# @DESCRIPTION:
+# The project name of your ebuild. Normally, the branch will be stored
+# in the ${EBZR_STORE_DIR}/${EBZR_PROJECT} directory.
+#
+# If EBZR_BRANCH is set (see below), then a shared repository will be
+# created in that directory, and the branch will be located in
+# ${EBZR_STORE_DIR}/${EBZR_PROJECT}/${EBZR_BRANCH}.
+: ${EBZR_PROJECT:=${PN}}
+
+# @ECLASS-VARIABLE: EBZR_BRANCH
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# The directory where to store the branch within a shared repository,
+# relative to ${EBZR_STORE_DIR}/${EBZR_PROJECT}.
+#
+# This variable should be set if there are several live ebuilds for
+# different branches of the same upstream project. The branches can
+# then share the same repository in EBZR_PROJECT, which will save both
+# data traffic volume and disk space.
+#
+# If there is only a live ebuild for one single branch, EBZR_BRANCH
+# needs not be set. In this case, the branch will be stored in a
+# stand-alone repository directly in EBZR_PROJECT.
+
+# @ECLASS-VARIABLE: EBZR_REVISION
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Revision to fetch, defaults to the latest
+# (see http://bazaar-vcs.org/BzrRevisionSpec or bzr help revisionspec).
+
+# @ECLASS-VARIABLE: EBZR_OFFLINE
+# @DESCRIPTION:
+# Set this variable to a non-empty value to disable automatic updating
+# of a bzr source tree. This is intended to be set outside the ebuild
+# by users.
+: ${EBZR_OFFLINE=${EVCS_OFFLINE}}
+
+# @ECLASS-VARIABLE: EBZR_WORKDIR_CHECKOUT
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# If this variable is set to a non-empty value, EBZR_CHECKOUT_CMD will
+# be used instead of EBZR_EXPORT_CMD to copy the sources to WORKDIR.
+
+# @FUNCTION: bzr_initial_fetch
+# @USAGE: <repository URI> <branch directory>
+# @DESCRIPTION:
+# Internal function, retrieves the source code from a repository for the
+# first time, using ${EBZR_FETCH_CMD}.
+bzr_initial_fetch() {
+ local repo_uri=$1 branch_dir=$2
+
+ if [[ -n "${EBZR_OFFLINE}" ]]; then
+ ewarn "EBZR_OFFLINE cannot be used when there is no local branch yet."
+ fi
+
+ # fetch branch
+ einfo "bzr branch start -->"
+ einfo " repository: ${repo_uri} => ${branch_dir}"
+
+ ${EBZR_FETCH_CMD} ${EBZR_OPTIONS} "${repo_uri}" "${branch_dir}" \
+ || die "${EBZR}: can't branch from ${repo_uri}"
+}
+
+# @FUNCTION: bzr_update
+# @USAGE: <repository URI> <branch directory>
+# @DESCRIPTION:
+# Internal function, updates the source code from a repository, using
+# ${EBZR_UPDATE_CMD}.
+bzr_update() {
+ local repo_uri=$1 branch_dir=$2
+
+ if [[ -n "${EBZR_OFFLINE}" ]]; then
+ einfo "skipping bzr pull -->"
+ einfo " repository: ${repo_uri}"
+ else
+ # update branch
+ einfo "bzr pull start -->"
+ einfo " repository: ${repo_uri}"
+
+ pushd "${branch_dir}" > /dev/null \
+ || die "${EBZR}: can't chdir to ${branch_dir}"
+ ${EBZR_UPDATE_CMD} ${EBZR_OPTIONS} "${repo_uri}" \
+ || die "${EBZR}: can't pull from ${repo_uri}"
+ popd > /dev/null
+ fi
+}
+
+# @FUNCTION: bzr_fetch
+# @DESCRIPTION:
+# Wrapper function to fetch sources from a Bazaar repository with
+# bzr branch or bzr pull, depending on whether there is an existing
+# working copy.
+bzr_fetch() {
+ local repo_dir branch_dir
+ local save_sandbox_write=${SANDBOX_WRITE}
+
+ [[ -n ${EBZR_REPO_URI} ]] || die "${EBZR}: EBZR_REPO_URI is empty"
+
+ if [[ ! -d ${EBZR_STORE_DIR} ]] ; then
+ addwrite /
+ mkdir -p "${EBZR_STORE_DIR}" \
+ || die "${EBZR}: can't mkdir ${EBZR_STORE_DIR}"
+ SANDBOX_WRITE=${save_sandbox_write}
+ fi
+
+ pushd "${EBZR_STORE_DIR}" > /dev/null \
+ || die "${EBZR}: can't chdir to ${EBZR_STORE_DIR}"
+
+ repo_dir=${EBZR_STORE_DIR}/${EBZR_PROJECT}
+ branch_dir=${repo_dir}${EBZR_BRANCH:+/${EBZR_BRANCH}}
+
+ addwrite "${EBZR_STORE_DIR}"
+
+ if [[ ! -d ${branch_dir}/.bzr ]]; then
+ if [[ ${repo_dir} != "${branch_dir}" && ! -d ${repo_dir}/.bzr ]]; then
+ einfo "creating shared bzr repository: ${repo_dir}"
+ ${EBZR_INIT_REPO_CMD} "${repo_dir}" \
+ || die "${EBZR}: can't create shared repository"
+ fi
+
+ if [[ -z ${EBZR_INITIAL_URI} ]]; then
+ bzr_initial_fetch "${EBZR_REPO_URI}" "${branch_dir}"
+ else
+ # Workaround for faster initial download. This clones the
+ # branch from a fast server (which may be out of date), and
+ # subsequently pulls from the slow original repository.
+ bzr_initial_fetch "${EBZR_INITIAL_URI}" "${branch_dir}"
+ if [[ ${EBZR_REPO_URI} != "${EBZR_INITIAL_URI}" ]]; then
+ EBZR_UPDATE_CMD="${EBZR_UPDATE_CMD} --remember --overwrite" \
+ EBZR_OFFLINE="" \
+ bzr_update "${EBZR_REPO_URI}" "${branch_dir}"
+ fi
+ fi
+ else
+ bzr_update "${EBZR_REPO_URI}" "${branch_dir}"
+ fi
+
+ # Restore sandbox environment
+ SANDBOX_WRITE=${save_sandbox_write}
+
+ cd "${branch_dir}" || die "${EBZR}: can't chdir to ${branch_dir}"
+
+ # Save revision number in environment. #311101
+ export EBZR_REVNO=$(${EBZR_REVNO_CMD})
+
+ if [[ -n ${EBZR_WORKDIR_CHECKOUT} ]]; then
+ einfo "checking out ..."
+ ${EBZR_CHECKOUT_CMD} ${EBZR_REVISION:+-r ${EBZR_REVISION}} \
+ . "${EBZR_UNPACK_DIR}" || die "${EBZR}: checkout failed"
+ else
+ einfo "exporting ..."
+ ${EBZR_EXPORT_CMD} ${EBZR_REVISION:+-r ${EBZR_REVISION}} \
+ "${EBZR_UNPACK_DIR}" . || die "${EBZR}: export failed"
+ fi
+ einfo \
+ "revision ${EBZR_REVISION:-${EBZR_REVNO}} is now in ${EBZR_UNPACK_DIR}"
+
+ popd > /dev/null
+}
+
+# @FUNCTION: bzr_bootstrap
+# @DESCRIPTION:
+# Apply patches in ${EBZR_PATCHES} and run ${EBZR_BOOTSTRAP} if specified.
+bzr_bootstrap() {
+ local patch lpatch
+
+ pushd "${S}" > /dev/null || die "${EBZR}: can't chdir to ${S}"
+
+ if [[ -n ${EBZR_PATCHES} ]] ; then
+ einfo "apply patches -->"
+
+ for patch in ${EBZR_PATCHES} ; do
+ if [[ -f ${patch} ]] ; then
+ epatch ${patch}
+ else
+ # This loop takes care of wildcarded patches given via
+ # EBZR_PATCHES in an ebuild
+ for lpatch in "${FILESDIR}"/${patch} ; do
+ if [[ -f ${lpatch} ]] ; then
+ epatch ${lpatch}
+ else
+ die "${EBZR}: ${patch} is not found"
+ fi
+ done
+ fi
+ done
+ fi
+
+ if [[ -n ${EBZR_BOOTSTRAP} ]] ; then
+ einfo "begin bootstrap -->"
+
+ if [[ -f ${EBZR_BOOTSTRAP} ]] && [[ -x ${EBZR_BOOTSTRAP} ]] ; then
+ einfo " bootstrap with a file: ${EBZR_BOOTSTRAP}"
+ "./${EBZR_BOOTSTRAP}" \
+ || die "${EBZR}: can't execute EBZR_BOOTSTRAP"
+ else
+ einfo " bootstrap with commands: ${EBZR_BOOTSTRAP}"
+ "${EBZR_BOOTSTRAP}" \
+ || die "${EBZR}: can't eval EBZR_BOOTSTRAP"
+ fi
+ fi
+
+ popd > /dev/null
+}
+
+# @FUNCTION: bzr_src_unpack
+# @DESCRIPTION:
+# Default src_unpack(), calls bzr_fetch. For EAPIs 0 and 1, also calls
+# bzr_src_prepare.
+bzr_src_unpack() {
+ bzr_fetch
+ case "${EAPI:-0}" in
+ 0|1) bzr_src_prepare ;;
+ esac
+}
+
+# @FUNCTION: bzr_src_prepare
+# @DESCRIPTION:
+# Default src_prepare(), calls bzr_bootstrap.
+bzr_src_prepare() {
+ bzr_bootstrap
+}
diff --git a/eclass/cannadic.eclass b/eclass/cannadic.eclass
new file mode 100644
index 00000000000..015e13451a6
--- /dev/null
+++ b/eclass/cannadic.eclass
@@ -0,0 +1,150 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @ECLASS: cannadic.eclass
+# @AUTHOR:
+# Original author: Mamoru KOMACHI <usata@gentoo.org>
+# @BLURB: Function for Canna compatible dictionaries
+# @DESCRIPTION:
+# The cannadic eclass is used for installation and setup of Canna
+# compatible dictionaries within the Portage system.
+
+
+EXPORT_FUNCTIONS src_install pkg_setup pkg_postinst pkg_postrm
+
+IUSE=""
+
+HOMEPAGE="http://canna.sourceforge.jp/" # you need to change this!
+SRC_URI="mirror://gentoo/${P}.tar.gz"
+
+LICENSE="public-domain"
+SLOT="0"
+
+S="${WORKDIR}"
+
+DICSDIRFILE="${FILESDIR}/*.dics.dir"
+CANNADICS="${CANNADICS}" # (optional)
+DOCS="README*"
+
+# You don't need to modify these
+#local cannadir dicsdir
+cannadir="${ROOT}/var/lib/canna/dic/canna"
+dicsdir="${ROOT}/var/lib/canna/dic/dics.d"
+
+# @FUNCTION: cannadic_pkg_setup
+# @DESCRIPTION:
+# Sets up cannadic dir
+cannadic_pkg_setup() {
+
+ keepdir $cannadir
+ fowners bin:bin $cannadir
+ fperms 0775 $cannadir
+}
+
+# @FUNCTION: cannadic-install
+# @DESCRIPTION:
+# Installs dictionaries to cannadir
+cannadic-install() {
+
+ insinto $cannadir
+ insopts -m0664 -o bin -g bin
+ doins "$@"
+}
+
+# @FUNCTION: dicsdir-install
+# @DESCRIPTION:
+# Installs dics.dir from ${DICSDIRFILE}
+dicsdir-install() {
+
+ insinto ${dicsdir}
+ doins ${DICSDIRFILE}
+}
+
+# @FUNCTION: cannadic_src_install
+# @DESCRIPTION:
+# Installs all dictionaries under ${WORKDIR}
+# plus dics.dir and docs
+cannadic_src_install() {
+
+ for f in *.c[btl]d *.t ; do
+ cannadic-install $f
+ done 2>/dev/null
+
+ dicsdir-install || die
+
+ dodoc ${DOCS}
+}
+
+# @FUNCTION: update-cannadic-dir
+# @DESCRIPTION:
+# Updates dics.dir for Canna Server, script for this part taken from Debian GNU/Linux
+#
+# compiles dics.dir files for Canna Server
+# Copyright 2001 ISHIKAWA Mutsumi
+# Licensed under the GNU General Public License, version 2. See the file
+# /usr/portage/license/GPL-2 or <http://www.gnu.org/copyleft/gpl.txt>.
+update-cannadic-dir() {
+
+ einfo
+ einfo "Updating dics.dir for Canna ..."
+ einfo
+
+ # write new dics.dir file in case we are interrupted
+ cat >${cannadir}/dics.dir.update-new<<-EOF
+ # dics.dir -- automatically generated file by Portage.
+ # DO NOT EDIT BY HAND.
+ EOF
+
+ for file in ${dicsdir}/*.dics.dir ; do
+ echo "# $file" >> ${cannadir}/dics.dir.update-new
+ cat $file >> ${cannadir}/dics.dir.update-new
+ einfo "Added $file."
+ done
+
+ mv ${cannadir}/dics.dir.update-new ${cannadir}/dics.dir
+
+ einfo
+ einfo "Done."
+ einfo
+}
+
+# @FUNCTION: cannadic_pkg_postinst
+# @DESCRIPTION:
+# Updates dics.dir and print out notice after install
+cannadic_pkg_postinst() {
+ update-cannadic-dir
+ einfo
+ einfo "Please restart cannaserver to fit the changes."
+ einfo "You need to modify your config file (~/.canna) to enable dictionaries."
+
+ if [ -n "${CANNADICS}" ] ; then
+ einfo "e.g) add $(for d in ${CANNADICS}; do
+ echo -n "\"$d\" "
+ done)to section use-dictionary()."
+ einfo "For details, see documents under /usr/share/doc/${PF}"
+ fi
+
+ einfo "If you do not have ~/.canna, you can find sample files in /usr/share/canna."
+ ewarn "If you are upgrading from existing dictionary, you may need to recreate"
+ ewarn "user dictionary if you have one."
+ einfo
+}
+
+# @FUNCTION: cannadic_pkg_postrm
+# @DESCRIPTION:
+# Updates dics.dir and print out notice after uninstall
+cannadic_pkg_postrm() {
+ update-cannadic-dir
+ einfo
+ einfo "Please restart cannaserver to fit changes."
+ einfo "and modify your config file (~/.canna) to disable dictionary."
+
+ if [ -n "${CANNADICS}" ] ; then
+ einfo "e.g) delete $(for d in ${CANNADICS}; do
+ echo -n "\"$d\" "
+ done)from section use-dictionary()."
+ fi
+
+ einfo
+}
diff --git a/eclass/cdrom.eclass b/eclass/cdrom.eclass
new file mode 100644
index 00000000000..76e6b4974e3
--- /dev/null
+++ b/eclass/cdrom.eclass
@@ -0,0 +1,247 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @ECLASS: cdrom.eclass
+# @MAINTAINER:
+# games@gentoo.org
+# @BLURB: Functions for CD-ROM handling
+# @DESCRIPTION:
+# Acquire cd(s) for those lovely cd-based emerges. Yes, this violates
+# the whole 'non-interactive' policy, but damnit I want CD support!
+#
+# With these cdrom functions we handle all the user interaction and
+# standardize everything. All you have to do is call cdrom_get_cds()
+# and when the function returns, you can assume that the cd has been
+# found at CDROM_ROOT.
+
+if [[ -z ${_CDROM_ECLASS} ]]; then
+_CDROM_ECLASS=1
+
+inherit portability
+
+# @ECLASS-VARIABLE: CDROM_OPTIONAL
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# By default, the eclass sets PROPERTIES="interactive" on the assumption
+# that people will be using these. If your package optionally supports
+# disc based installed, then set this to "yes", and we'll set things
+# conditionally based on USE=cdinstall.
+if [[ ${CDROM_OPTIONAL} == "yes" ]] ; then
+ IUSE="cdinstall"
+ PROPERTIES="cdinstall? ( interactive )"
+else
+ PROPERTIES="interactive"
+fi
+
+# @FUNCTION: cdrom_get_cds
+# @USAGE: <file on cd1> [file on cd2] [file on cd3] [...]
+# @DESCRIPTION:
+# The function will attempt to locate a cd based upon a file that is on
+# the cd. The more files you give this function, the more cds the cdrom
+# functions will handle.
+#
+# Normally the cdrom functions will refer to the cds as 'cd #1', 'cd #2',
+# etc... If you want to give the cds better names, then just export
+# the appropriate CDROM_NAME variable before calling cdrom_get_cds().
+# Use CDROM_NAME for one cd, or CDROM_NAME_# for multiple cds. You can
+# also use the CDROM_NAME_SET bash array.
+#
+# For those multi cd ebuilds, see the cdrom_load_next_cd() function.
+cdrom_get_cds() {
+ # first we figure out how many cds we're dealing with by
+ # the # of files they gave us
+ local cdcnt=0
+ local f=
+ for f in "$@" ; do
+ ((++cdcnt))
+ export CDROM_CHECK_${cdcnt}="$f"
+ done
+ export CDROM_TOTAL_CDS=${cdcnt}
+ export CDROM_CURRENT_CD=1
+
+ # now we see if the user gave use CD_ROOT ...
+ # if they did, let's just believe them that it's correct
+ if [[ -n ${CD_ROOT}${CD_ROOT_1} ]] ; then
+ local var=
+ cdcnt=0
+ while [[ ${cdcnt} -lt ${CDROM_TOTAL_CDS} ]] ; do
+ ((++cdcnt))
+ var="CD_ROOT_${cdcnt}"
+ [[ -z ${!var} ]] && var="CD_ROOT"
+ if [[ -z ${!var} ]] ; then
+ eerror "You must either use just the CD_ROOT"
+ eerror "or specify ALL the CD_ROOT_X variables."
+ eerror "In this case, you will need" \
+ "${CDROM_TOTAL_CDS} CD_ROOT_X variables."
+ die "could not locate CD_ROOT_${cdcnt}"
+ fi
+ done
+ export CDROM_ROOT=${CD_ROOT_1:-${CD_ROOT}}
+ einfo "Found CD #${CDROM_CURRENT_CD} root at ${CDROM_ROOT}"
+ export CDROM_SET=-1
+ for f in ${CDROM_CHECK_1//:/ } ; do
+ ((++CDROM_SET))
+ [[ -e ${CDROM_ROOT}/${f} ]] && break
+ done
+ export CDROM_MATCH=${f}
+ return
+ fi
+
+ # User didn't help us out so lets make sure they know they can
+ # simplify the whole process ...
+ if [[ ${CDROM_TOTAL_CDS} -eq 1 ]] ; then
+ einfo "This ebuild will need the ${CDROM_NAME:-cdrom for ${PN}}"
+ echo
+ einfo "If you do not have the CD, but have the data files"
+ einfo "mounted somewhere on your filesystem, just export"
+ einfo "the variable CD_ROOT so that it points to the"
+ einfo "directory containing the files."
+ echo
+ einfo "For example:"
+ einfo "export CD_ROOT=/mnt/cdrom"
+ echo
+ else
+ if [[ -n ${CDROM_NAME_SET} ]] ; then
+ # Translate the CDROM_NAME_SET array into CDROM_NAME_#
+ cdcnt=0
+ while [[ ${cdcnt} -lt ${CDROM_TOTAL_CDS} ]] ; do
+ ((++cdcnt))
+ export CDROM_NAME_${cdcnt}="${CDROM_NAME_SET[$((${cdcnt}-1))]}"
+ done
+ fi
+
+ einfo "This package will need access to ${CDROM_TOTAL_CDS} cds."
+ cdcnt=0
+ while [[ ${cdcnt} -lt ${CDROM_TOTAL_CDS} ]] ; do
+ ((++cdcnt))
+ var="CDROM_NAME_${cdcnt}"
+ [[ ! -z ${!var} ]] && einfo " CD ${cdcnt}: ${!var}"
+ done
+ echo
+ einfo "If you do not have the CDs, but have the data files"
+ einfo "mounted somewhere on your filesystem, just export"
+ einfo "the following variables so they point to the right place:"
+ einfon ""
+ cdcnt=0
+ while [[ ${cdcnt} -lt ${CDROM_TOTAL_CDS} ]] ; do
+ ((++cdcnt))
+ echo -n " CD_ROOT_${cdcnt}"
+ done
+ echo
+ einfo "Or, if you have all the files in the same place, or"
+ einfo "you only have one cdrom, you can export CD_ROOT"
+ einfo "and that place will be used as the same data source"
+ einfo "for all the CDs."
+ echo
+ einfo "For example:"
+ einfo "export CD_ROOT_1=/mnt/cdrom"
+ echo
+ fi
+
+ export CDROM_SET=""
+ export CDROM_CURRENT_CD=0
+ cdrom_load_next_cd
+}
+
+# @FUNCTION: cdrom_load_next_cd
+# @DESCRIPTION:
+# Some packages are so big they come on multiple CDs. When you're done
+# reading files off a CD and want access to the next one, just call this
+# function. Again, all the messy details of user interaction are taken
+# care of for you. Once this returns, just read the variable CDROM_ROOT
+# for the location of the mounted CD. Note that you can only go forward
+# in the CD list, so make sure you only call this function when you're
+# done using the current CD.
+cdrom_load_next_cd() {
+ local var
+ ((++CDROM_CURRENT_CD))
+
+ unset CDROM_ROOT
+ var=CD_ROOT_${CDROM_CURRENT_CD}
+ [[ -z ${!var} ]] && var="CD_ROOT"
+ if [[ -z ${!var} ]] ; then
+ var="CDROM_CHECK_${CDROM_CURRENT_CD}"
+ _cdrom_locate_file_on_cd ${!var}
+ else
+ export CDROM_ROOT=${!var}
+ fi
+
+ einfo "Found CD #${CDROM_CURRENT_CD} root at ${CDROM_ROOT}"
+}
+
+# this is used internally by the cdrom_get_cds() and cdrom_load_next_cd()
+# functions. this should *never* be called from an ebuild.
+# all it does is try to locate a give file on a cd ... if the cd isn't
+# found, then a message asking for the user to insert the cdrom will be
+# displayed and we'll hang out here until:
+# (1) the file is found on a mounted cdrom
+# (2) the user hits CTRL+C
+_cdrom_locate_file_on_cd() {
+ local mline=""
+ local showedmsg=0 showjolietmsg=0
+
+ while [[ -z ${CDROM_ROOT} ]] ; do
+ local i=0
+ local -a cdset=(${*//:/ })
+ if [[ -n ${CDROM_SET} ]] ; then
+ cdset=(${cdset[${CDROM_SET}]})
+ fi
+
+ while [[ -n ${cdset[${i}]} ]] ; do
+ local dir=$(dirname ${cdset[${i}]})
+ local file=$(basename ${cdset[${i}]})
+
+ local point= node= fs= foo=
+ while read point node fs foo ; do
+ [[ " cd9660 iso9660 udf " != *" ${fs} "* ]] && \
+ ! [[ ${fs} == "subfs" && ",${opts}," == *",fs=cdfss,"* ]] \
+ && continue
+ point=${point//\040/ }
+ [[ ! -d ${point}/${dir} ]] && continue
+ [[ -z $(find "${point}/${dir}" -maxdepth 1 -iname "${file}") ]] \
+ && continue
+ export CDROM_ROOT=${point}
+ export CDROM_SET=${i}
+ export CDROM_MATCH=${cdset[${i}]}
+ return
+ done <<< "$(get_mounts)"
+
+ ((++i))
+ done
+
+ echo
+ if [[ ${showedmsg} -eq 0 ]] ; then
+ if [[ ${CDROM_TOTAL_CDS} -eq 1 ]] ; then
+ if [[ -z ${CDROM_NAME} ]] ; then
+ einfo "Please insert+mount the cdrom for ${PN} now !"
+ else
+ einfo "Please insert+mount the ${CDROM_NAME} cdrom now !"
+ fi
+ else
+ if [[ -z ${CDROM_NAME_1} ]] ; then
+ einfo "Please insert+mount cd #${CDROM_CURRENT_CD}" \
+ "for ${PN} now !"
+ else
+ local var="CDROM_NAME_${CDROM_CURRENT_CD}"
+ einfo "Please insert+mount the ${!var} cdrom now !"
+ fi
+ fi
+ showedmsg=1
+ fi
+ einfo "Press return to scan for the cd again"
+ einfo "or hit CTRL+C to abort the emerge."
+ echo
+ if [[ ${showjolietmsg} -eq 0 ]] ; then
+ showjolietmsg=1
+ else
+ ewarn "If you are having trouble with the detection"
+ ewarn "of your CD, it is possible that you do not have"
+ ewarn "Joliet support enabled in your kernel. Please"
+ ewarn "check that CONFIG_JOLIET is enabled in your kernel."
+ fi
+ read || die "something is screwed with your system"
+ done
+}
+
+fi
diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass
new file mode 100644
index 00000000000..edf60cfabf5
--- /dev/null
+++ b/eclass/check-reqs.eclass
@@ -0,0 +1,355 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @ECLASS: check-reqs.eclass
+# @MAINTAINER:
+# QA Team <qa@gentoo.org>
+# @AUTHOR:
+# Bo Ørsted Andresen <zlin@gentoo.org>
+# Original Author: Ciaran McCreesh <ciaranm@gentoo.org>
+# @BLURB: Provides a uniform way of handling ebuild which have very high build requirements
+# @DESCRIPTION:
+# This eclass provides a uniform way of handling ebuilds which have very high
+# build requirements in terms of memory or disk space. It provides a function
+# which should usually be called during pkg_setup().
+#
+# The chosen action only happens when the system's resources are detected
+# correctly and only if they are below the threshold specified by the package.
+#
+# @CODE
+# # need this much memory (does *not* check swap)
+# CHECKREQS_MEMORY="256M"
+#
+# # need this much temporary build space
+# CHECKREQS_DISK_BUILD="2G"
+#
+# # install will need this much space in /usr
+# CHECKREQS_DISK_USR="1G"
+#
+# # install will need this much space in /var
+# CHECKREQS_DISK_VAR="1024M"
+#
+# @CODE
+#
+# If you don't specify a value for, say, CHECKREQS_MEMORY, then the test is not
+# carried out.
+#
+# These checks should probably mostly work on non-Linux, and they should
+# probably degrade gracefully if they don't. Probably.
+
+inherit eutils
+
+# @ECLASS-VARIABLE: CHECKREQS_MEMORY
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# How much RAM is needed? Eg.: CHECKREQS_MEMORY=15M
+
+# @ECLASS-VARIABLE: CHECKREQS_DISK_BUILD
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# How much diskspace is needed to build the package? Eg.: CHECKREQS_DISK_BUILD=2T
+
+# @ECLASS-VARIABLE: CHECKREQS_DISK_USR
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# How much space in /usr is needed to install the package? Eg.: CHECKREQS_DISK_USR=15G
+
+# @ECLASS-VARIABLE: CHECKREQS_DISK_VAR
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# How much space is needed in /var? Eg.: CHECKREQS_DISK_VAR=3000M
+
+EXPORT_FUNCTIONS pkg_setup
+case "${EAPI:-0}" in
+ 0|1|2|3) ;;
+ 4|5) EXPORT_FUNCTIONS pkg_pretend ;;
+ *) die "EAPI=${EAPI} is not supported" ;;
+esac
+
+# @FUNCTION: check_reqs
+# @DESCRIPTION:
+# Obsolete function executing all the checks and priting out results
+check_reqs() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ echo
+ ewarn "QA: Package calling old ${FUNCNAME} function."
+ ewarn "QA: Please file a bug against the package."
+ ewarn "QA: It should call check-reqs_pkg_pretend and check-reqs_pkg_setup"
+ ewarn "QA: and possibly use EAPI=4 or later."
+ echo
+
+ check-reqs_pkg_setup "$@"
+}
+
+# @FUNCTION: check-reqs_pkg_setup
+# @DESCRIPTION:
+# Exported function running the resources checks in pkg_setup phase.
+# It should be run in both phases to ensure condition changes between
+# pkg_pretend and pkg_setup won't affect the build.
+check-reqs_pkg_setup() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ check-reqs_prepare
+ check-reqs_run
+ check-reqs_output
+}
+
+# @FUNCTION: check-reqs_pkg_pretend
+# @DESCRIPTION:
+# Exported function running the resources checks in pkg_pretend phase.
+check-reqs_pkg_pretend() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ check-reqs_pkg_setup "$@"
+}
+
+# @FUNCTION: check-reqs_prepare
+# @DESCRIPTION:
+# Internal function that checks the variables that should be defined.
+check-reqs_prepare() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ if [[ -z ${CHECKREQS_MEMORY} &&
+ -z ${CHECKREQS_DISK_BUILD} &&
+ -z ${CHECKREQS_DISK_USR} &&
+ -z ${CHECKREQS_DISK_VAR} ]]; then
+ eerror "Set some check-reqs eclass variables if you want to use it."
+ eerror "If you are user and see this message file a bug against the package."
+ die "${FUNCNAME}: check-reqs eclass called but not actualy used!"
+ fi
+}
+
+# @FUNCTION: check-reqs_run
+# @DESCRIPTION:
+# Internal function that runs the check based on variable settings.
+check-reqs_run() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ # some people are *censored*
+ unset CHECKREQS_FAILED
+
+ # use != in test, because MERGE_TYPE only exists in EAPI 4 and later
+ if [[ ${MERGE_TYPE} != binary ]]; then
+ [[ -n ${CHECKREQS_MEMORY} ]] && \
+ check-reqs_memory \
+ ${CHECKREQS_MEMORY}
+
+ [[ -n ${CHECKREQS_DISK_BUILD} ]] && \
+ check-reqs_disk \
+ "${T}" \
+ "${CHECKREQS_DISK_BUILD}"
+ fi
+
+ if [[ ${MERGE_TYPE} != buildonly ]]; then
+ [[ -n ${CHECKREQS_DISK_USR} ]] && \
+ check-reqs_disk \
+ "${EROOT}/usr" \
+ "${CHECKREQS_DISK_USR}"
+
+ [[ -n ${CHECKREQS_DISK_VAR} ]] && \
+ check-reqs_disk \
+ "${EROOT}/var" \
+ "${CHECKREQS_DISK_VAR}"
+ fi
+}
+
+# @FUNCTION: check-reqs_get_mebibytes
+# @DESCRIPTION:
+# Internal function that returns number in mebibytes.
+# Returns 1024 for 1G or 1048576 for 1T.
+check-reqs_get_mebibytes() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ [[ -z ${1} ]] && die "Usage: ${FUNCNAME} [size]"
+
+ local unit=${1:(-1)}
+ local size=${1%[GMT]}
+
+ case ${unit} in
+ G) echo $((1024 * size)) ;;
+ [M0-9]) echo ${size} ;;
+ T) echo $((1024 * 1024 * size)) ;;
+ *)
+ die "${FUNCNAME}: Unknown unit: ${unit}"
+ ;;
+ esac
+}
+
+# @FUNCTION: check-reqs_get_number
+# @DESCRIPTION:
+# Internal function that returns the numerical value without the unit.
+# Returns "1" for "1G" or "150" for "150T".
+check-reqs_get_number() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ [[ -z ${1} ]] && die "Usage: ${FUNCNAME} [size]"
+
+ local unit=${1:(-1)}
+ local size=${1%[GMT]}
+
+ # Check for unset units and warn about them.
+ # Backcompat.
+ if [[ ${size} == ${1} ]]; then
+ ewarn "QA: Package does not specify unit for the size check"
+ ewarn "QA: Assuming mebibytes."
+ ewarn "QA: File bug against the package. It should specify the unit."
+ fi
+
+ echo ${size}
+}
+
+# @FUNCTION: check-reqs_get_unit
+# @DESCRIPTION:
+# Internal function that return the unit without the numerical value.
+# Returns "GiB" for "1G" or "TiB" for "150T".
+check-reqs_get_unit() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ [[ -z ${1} ]] && die "Usage: ${FUNCNAME} [size]"
+
+ local unit=${1:(-1)}
+
+ case ${unit} in
+ G) echo "GiB" ;;
+ [M0-9]) echo "MiB" ;;
+ T) echo "TiB" ;;
+ *)
+ die "${FUNCNAME}: Unknown unit: ${unit}"
+ ;;
+ esac
+}
+
+# @FUNCTION: check-reqs_output
+# @DESCRIPTION:
+# Internal function that prints the warning and dies if required based on
+# the test results.
+check-reqs_output() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local msg="ewarn"
+
+ [[ ${EBUILD_PHASE} == "pretend" && -z ${I_KNOW_WHAT_I_AM_DOING} ]] && msg="eerror"
+ if [[ -n ${CHECKREQS_FAILED} ]]; then
+ ${msg}
+ ${msg} "Space constrains set in the ebuild were not met!"
+ ${msg} "The build will most probably fail, you should enhance the space"
+ ${msg} "as per failed tests."
+ ${msg}
+
+ [[ ${EBUILD_PHASE} == "pretend" && -z ${I_KNOW_WHAT_I_AM_DOING} ]] && \
+ die "Build requirements not met!"
+ fi
+}
+
+# @FUNCTION: check-reqs_memory
+# @DESCRIPTION:
+# Internal function that checks size of RAM.
+check-reqs_memory() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ [[ -z ${1} ]] && die "Usage: ${FUNCNAME} [size]"
+
+ local size=${1}
+ local actual_memory
+
+ check-reqs_start_phase \
+ ${size} \
+ "RAM"
+
+ if [[ -r /proc/meminfo ]] ; then
+ actual_memory=$(awk '/MemTotal/ { print $2 }' /proc/meminfo)
+ else
+ actual_memory=$(sysctl hw.physmem 2>/dev/null )
+ [[ "$?" == "0" ]] &&
+ actual_memory=$(echo $actual_memory | sed -e 's/^[^:=]*[:=]//' )
+ fi
+ if [[ -n ${actual_memory} ]] ; then
+ if [[ ${actual_memory} -lt $((1024 * $(check-reqs_get_mebibytes ${size}))) ]] ; then
+ eend 1
+ check-reqs_unsatisfied \
+ ${size} \
+ "RAM"
+ else
+ eend 0
+ fi
+ else
+ eend 1
+ ewarn "Couldn't determine amount of memory, skipping..."
+ fi
+}
+
+# @FUNCTION: check-reqs_disk
+# @DESCRIPTION:
+# Internal function that checks space on the harddrive.
+check-reqs_disk() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ [[ -z ${2} ]] && die "Usage: ${FUNCNAME} [path] [size]"
+
+ local path=${1}
+ local size=${2}
+ local space_megs
+
+ check-reqs_start_phase \
+ ${size} \
+ "disk space at \"${path}\""
+
+ space_megs=$(df -Pm "${1}" 2>/dev/null | awk 'FNR == 2 {print $4}')
+
+ if [[ $? == 0 && -n ${space_megs} ]] ; then
+ if [[ ${space_megs} -lt $(check-reqs_get_mebibytes ${size}) ]] ; then
+ eend 1
+ check-reqs_unsatisfied \
+ ${size} \
+ "disk space at \"${path}\""
+ else
+ eend 0
+ fi
+ else
+ eend 1
+ ewarn "Couldn't determine disk space, skipping..."
+ fi
+}
+
+# @FUNCTION: check-reqs_start_phase
+# @DESCRIPTION:
+# Internal function that inform about started check
+check-reqs_start_phase() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ [[ -z ${2} ]] && die "Usage: ${FUNCNAME} [size] [location]"
+
+ local size=${1}
+ local location=${2}
+ local sizeunit="$(check-reqs_get_number ${size}) $(check-reqs_get_unit ${size})"
+
+ ebegin "Checking for at least ${sizeunit} ${location}"
+}
+
+# @FUNCTION: check-reqs_unsatisfied
+# @DESCRIPTION:
+# Internal function that inform about check result.
+# It has different output between pretend and setup phase,
+# where in pretend phase it is fatal.
+check-reqs_unsatisfied() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ [[ -z ${2} ]] && die "Usage: ${FUNCNAME} [size] [location]"
+
+ local msg="ewarn"
+ local size=${1}
+ local location=${2}
+ local sizeunit="$(check-reqs_get_number ${size}) $(check-reqs_get_unit ${size})"
+
+ [[ ${EBUILD_PHASE} == "pretend" && -z ${I_KNOW_WHAT_I_AM_DOING} ]] && msg="eerror"
+ ${msg} "There is NOT at least ${sizeunit} ${location}"
+
+ # @ECLASS-VARIABLE: CHECKREQS_FAILED
+ # @DESCRIPTION:
+ # @INTERNAL
+ # If set the checks failed and eclass should abort the build.
+ # Internal, do not set yourself.
+ CHECKREQS_FAILED="true"
+}
diff --git a/eclass/chromium.eclass b/eclass/chromium.eclass
new file mode 100644
index 00000000000..cd641251a31
--- /dev/null
+++ b/eclass/chromium.eclass
@@ -0,0 +1,266 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @ECLASS: chromium.eclass
+# @MAINTAINER:
+# Chromium Herd <chromium@gentoo.org>
+# @AUTHOR:
+# Mike Gilbert <floppym@gentoo.org>
+# @BLURB: Shared functions for chromium and google-chrome
+
+inherit eutils fdo-mime gnome2-utils linux-info
+
+if [[ ${CHROMIUM_EXPORT_PHASES} != no ]]; then
+ EXPORT_FUNCTIONS pkg_preinst pkg_postinst pkg_postrm
+fi
+
+if [[ ${PN} == chromium ]]; then
+ IUSE+=" custom-cflags"
+fi
+
+# @FUNCTION: chromium_suid_sandbox_check_kernel_config
+# @USAGE:
+# @DESCRIPTION:
+# Ensures the system kernel supports features needed for SUID sandbox to work.
+chromium_suid_sandbox_check_kernel_config() {
+ has "${EAPI:-0}" 0 1 2 3 && die "EAPI=${EAPI} is not supported"
+
+ if [[ "${MERGE_TYPE}" == "source" || "${MERGE_TYPE}" == "binary" ]]; then
+ # Warn if the kernel does not support features needed for sandboxing.
+ # Bug #363987.
+ ERROR_PID_NS="PID_NS is required for sandbox to work"
+ ERROR_NET_NS="NET_NS is required for sandbox to work"
+ ERROR_USER_NS="USER_NS is required for sandbox to work"
+ ERROR_SECCOMP_FILTER="SECCOMP_FILTER is required for sandbox to work"
+ CONFIG_CHECK="~PID_NS ~NET_NS ~SECCOMP_FILTER ~USER_NS"
+ check_extra_config
+ fi
+}
+
+# @ECLASS-VARIABLE: CHROMIUM_LANGS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# List of language packs available for this package.
+
+_chromium_set_linguas_IUSE() {
+ [[ ${EAPI:-0} == 0 ]] && die "EAPI=${EAPI} is not supported"
+
+ local lang
+ for lang in ${CHROMIUM_LANGS}; do
+ # Default to enabled since we bundle them anyway.
+ # USE-expansion will take care of disabling the langs the user has not
+ # selected via LINGUAS.
+ IUSE+=" +linguas_${lang}"
+ done
+}
+
+if [[ ${CHROMIUM_LANGS} ]]; then
+ _chromium_set_linguas_IUSE
+fi
+
+_chromium_crlang() {
+ local x
+ for x in "$@"; do
+ case $x in
+ es_LA) echo es-419 ;;
+ *) echo "${x/_/-}" ;;
+ esac
+ done
+}
+
+_chromium_syslang() {
+ local x
+ for x in "$@"; do
+ case $x in
+ es-419) echo es_LA ;;
+ *) echo "${x/-/_}" ;;
+ esac
+ done
+}
+
+_chromium_strip_pak() {
+ local x
+ for x in "$@"; do
+ echo "${x%.pak}"
+ done
+}
+
+# @FUNCTION: chromium_remove_language_paks
+# @USAGE:
+# @DESCRIPTION:
+# Removes pak files from the current directory for languages that the user has
+# not selected via the LINGUAS variable.
+# Also performs QA checks to ensure CHROMIUM_LANGS has been set correctly.
+chromium_remove_language_paks() {
+ local crlangs=$(_chromium_crlang ${CHROMIUM_LANGS})
+ local present_crlangs=$(_chromium_strip_pak *.pak)
+ local present_langs=$(_chromium_syslang ${present_crlangs})
+ local lang
+
+ # Look for missing pak files.
+ for lang in ${crlangs}; do
+ if ! has ${lang} ${present_crlangs}; then
+ eqawarn "LINGUAS warning: no .pak file for ${lang} (${lang}.pak not found)"
+ fi
+ done
+
+ # Look for extra pak files.
+ # Remove pak files that the user does not want.
+ for lang in ${present_langs}; do
+ if [[ ${lang} == en_US ]]; then
+ continue
+ fi
+ if ! has ${lang} ${CHROMIUM_LANGS}; then
+ eqawarn "LINGUAS warning: no ${lang} in LANGS"
+ continue
+ fi
+ if ! use linguas_${lang}; then
+ rm "$(_chromium_crlang ${lang}).pak" || die
+ fi
+ done
+}
+
+chromium_pkg_preinst() {
+ gnome2_icon_savelist
+}
+
+chromium_pkg_postinst() {
+ fdo-mime_desktop_database_update
+ gnome2_icon_cache_update
+
+ # For more info see bug #292201, bug #352263, bug #361859.
+ if ! has_version x11-themes/gnome-icon-theme &&
+ ! has_version x11-themes/oxygen-icons ; then
+ elog
+ elog "Depending on your desktop environment, you may need"
+ elog "to install additional packages to get icons on the Downloads page."
+ elog
+ elog "For KDE, the required package is kde-apps/oxygen-icons."
+ elog
+ elog "For other desktop environments, try one of the following:"
+ elog " - x11-themes/gnome-icon-theme"
+ elog " - x11-themes/tango-icon-theme"
+ fi
+
+ # For more info see bug #359153.
+ elog
+ elog "Some web pages may require additional fonts to display properly."
+ elog "Try installing some of the following packages if some characters"
+ elog "are not displayed properly:"
+ elog " - media-fonts/arphicfonts"
+ elog " - media-fonts/bitstream-cyberbit"
+ elog " - media-fonts/droid"
+ elog " - media-fonts/ipamonafont"
+ elog " - media-fonts/ja-ipafonts"
+ elog " - media-fonts/takao-fonts"
+ elog " - media-fonts/wqy-microhei"
+ elog " - media-fonts/wqy-zenhei"
+}
+
+chromium_pkg_postrm() {
+ gnome2_icon_cache_update
+}
+
+chromium_pkg_die() {
+ if [[ "${EBUILD_PHASE}" != "compile" ]]; then
+ return
+ fi
+
+ # Prevent user problems like bug #348235.
+ eshopts_push -s extglob
+ if is-flagq '-g?(gdb)?([1-9])'; then
+ ewarn
+ ewarn "You have enabled debug info (i.e. -g or -ggdb in your CFLAGS/CXXFLAGS)."
+ ewarn "This produces very large build files causes the linker to consume large"
+ ewarn "amounts of memory."
+ ewarn
+ ewarn "Please try removing -g{,gdb} before reporting a bug."
+ ewarn
+ fi
+ eshopts_pop
+
+ # ccache often causes bogus compile failures, especially when the cache gets
+ # corrupted.
+ if has ccache ${FEATURES}; then
+ ewarn
+ ewarn "You have enabled ccache. Please try disabling ccache"
+ ewarn "before reporting a bug."
+ ewarn
+ fi
+
+ # No ricer bugs.
+ if use_if_iuse custom-cflags; then
+ ewarn
+ ewarn "You have enabled the custom-cflags USE flag."
+ ewarn "Please disable it before reporting a bug."
+ ewarn
+ fi
+
+ # If the system doesn't have enough memory, the compilation is known to
+ # fail. Print info about memory to recognize this condition.
+ einfo
+ einfo "$(grep MemTotal /proc/meminfo)"
+ einfo "$(grep SwapTotal /proc/meminfo)"
+ einfo
+}
+
+# @VARIABLE: EGYP_CHROMIUM_COMMAND
+# @DESCRIPTION:
+# Path to the gyp_chromium script.
+: ${EGYP_CHROMIUM_COMMAND:=build/gyp_chromium}
+
+# @VARIABLE: EGYP_CHROMIUM_DEPTH
+# @DESCRIPTION:
+# Depth for egyp_chromium.
+: ${EGYP_CHROMIUM_DEPTH:=.}
+
+# @FUNCTION: egyp_chromium
+# @USAGE: [gyp arguments]
+# @DESCRIPTION:
+# Calls EGYP_CHROMIUM_COMMAND with depth EGYP_CHROMIUM_DEPTH and given
+# arguments. The full command line is echoed for logging.
+egyp_chromium() {
+ set -- "${EGYP_CHROMIUM_COMMAND}" --depth="${EGYP_CHROMIUM_DEPTH}" "$@"
+ echo "$@"
+ "$@"
+}
+
+# @FUNCTION: gyp_use
+# @USAGE: <USE flag> [GYP flag] [true suffix] [false suffix]
+# @DESCRIPTION:
+# If USE flag is set, echo -D[GYP flag]=[true suffix].
+#
+# If USE flag is not set, echo -D[GYP flag]=[false suffix].
+#
+# [GYP flag] defaults to use_[USE flag] with hyphens converted to underscores.
+#
+# [true suffix] defaults to 1. [false suffix] defaults to 0.
+gyp_use() {
+ local gypflag="-D${2:-use_${1//-/_}}="
+ usex "$1" "${gypflag}" "${gypflag}" "${3-1}" "${4-0}"
+}
+
+# @FUNCTION: chromium_bundled_v8_version
+# @USAGE: [path to version.cc]
+# @DESCRIPTION:
+# Outputs the version of v8 parsed from a (bundled) copy of the source code.
+chromium_bundled_v8_version() {
+ local vf=${1:-v8/src/version.cc}
+ local major minor build patch
+ major=$(sed -ne 's/#define MAJOR_VERSION *\([0-9]*\)/\1/p' "${vf}")
+ minor=$(sed -ne 's/#define MINOR_VERSION *\([0-9]*\)/\1/p' "${vf}")
+ build=$(sed -ne 's/#define BUILD_NUMBER *\([0-9]*\)/\1/p' "${vf}")
+ patch=$(sed -ne 's/#define PATCH_LEVEL *\([0-9]*\)/\1/p' "${vf}")
+ echo "${major}.${minor}.${build}.${patch}"
+}
+
+# @FUNCTION: chromium_installed_v8_version
+# @USAGE:
+# @DESCRIPTION:
+# Outputs the version of dev-lang/v8 currently installed on the host system.
+chromium_installed_v8_version() {
+ local cpf=$(best_version dev-lang/v8)
+ local pvr=${cpf#dev-lang/v8-}
+ echo "${pvr%-r*}"
+}
diff --git a/eclass/clutter.eclass b/eclass/clutter.eclass
new file mode 100644
index 00000000000..7451c173b6b
--- /dev/null
+++ b/eclass/clutter.eclass
@@ -0,0 +1,72 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @ECLASS: clutter.eclass
+# @MAINTAINER:
+# GNOME Herd <gnome@gentoo.org>
+# @AUTHOR:
+# Nirbheek Chauhan <nirbheek@gentoo.org>
+# @BLURB: Sets SRC_URI, LICENSE, etc and exports src_install
+
+inherit versionator
+
+HOMEPAGE="http://www.clutter-project.org/"
+
+RV=($(get_version_components))
+SRC_URI="http://www.clutter-project.org/sources/${PN}/${RV[0]}.${RV[1]}/${P}.tar.bz2"
+
+# All official clutter packages use LGPL-2.1 or later
+LICENSE="${LICENSE:-LGPL-2.1+}"
+
+# This will be used by all clutter packages
+DEPEND="virtual/pkgconfig"
+
+# @ECLASS-VARIABLE: CLUTTER_LA_PUNT
+# @DESCRIPTION:
+# Set to anything except 'no' to remove *all* .la files before installing.
+# Not to be used without due consideration, sometimes .la files *are* needed.
+CLUTTER_LA_PUNT="${CLUTTER_LA_PUNT:-"no"}"
+
+# @ECLASS-VARIABLE: DOCS
+# @DESCRIPTION:
+# This variable holds relative paths of files to be dodoc-ed.
+# By default, it contains the standard list of autotools doc files
+DOCS="${DOCS:-AUTHORS ChangeLog NEWS README TODO}"
+
+# @ECLASS-VARIABLE: EXAMPLES
+# @DESCRIPTION:
+# This variable holds relative paths of files to be added as examples when the
+# "examples" USE-flag exists, and is switched on. Bash expressions can be used
+# since the variable is eval-ed before substitution. Empty by default.
+EXAMPLES="${EXAMPLES:-""}"
+
+# @FUNCTION: clutter_src_install
+# @DESCRIPTION:
+# Runs emake install, dodoc, and installs examples
+clutter_src_install() {
+ emake DESTDIR="${D}" install || die "emake install failed"
+ dodoc ${DOCS} || die "dodoc failed"
+
+ # examples
+ if has examples ${IUSE} && use examples; then
+ insinto /usr/share/doc/${PF}/examples
+
+ # We use eval to be able to use globs and other bash expressions
+ for example in $(eval echo ${EXAMPLES}); do
+ # If directory
+ if [[ ${example: -1} == "/" ]]; then
+ doins -r ${example} || die "doins ${example} failed!"
+ else
+ doins ${example} || die "doins ${example} failed!"
+ fi
+ done
+ fi
+
+ # Delete all .la files
+ if [[ "${CLUTTER_LA_PUNT}" != "no" ]]; then
+ find "${D}" -name '*.la' -exec rm -f '{}' + || die
+ fi
+}
+
+EXPORT_FUNCTIONS src_install
diff --git a/eclass/cmake-multilib.eclass b/eclass/cmake-multilib.eclass
new file mode 100644
index 00000000000..deec3f6eb59
--- /dev/null
+++ b/eclass/cmake-multilib.eclass
@@ -0,0 +1,74 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @ECLASS: cmake-multilib.eclass
+# @MAINTAINER:
+# gx86-multilib team <multilib@gentoo.org>
+# @AUTHOR:
+# Author: Michał Górny <mgorny@gentoo.org>
+# @BLURB: cmake-utils wrapper for multilib builds
+# @DESCRIPTION:
+# The cmake-multilib.eclass provides a glue between cmake-utils.eclass(5)
+# and multilib-minimal.eclass(5), aiming to provide a convenient way
+# to build packages using cmake for multiple ABIs.
+#
+# Inheriting this eclass sets IUSE and exports default multilib_src_*()
+# sub-phases that call cmake-utils phase functions for each ABI enabled.
+# The multilib_src_*() functions can be defined in ebuild just like
+# in multilib-minimal, yet they ought to call appropriate cmake-utils
+# phase rather than 'default'.
+
+# EAPI=5 is required for meaningful MULTILIB_USEDEP.
+case ${EAPI:-0} in
+ 5) ;;
+ *) die "EAPI=${EAPI} is not supported" ;;
+esac
+
+if [[ ${CMAKE_IN_SOURCE_BUILD} ]]; then
+ die "${ECLASS}: multilib support requires out-of-source builds."
+fi
+
+inherit cmake-utils multilib-minimal
+
+EXPORT_FUNCTIONS src_configure src_compile src_test src_install
+
+cmake-multilib_src_configure() {
+ local _cmake_args=( "${@}" )
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ cmake-utils_src_configure "${_cmake_args[@]}"
+}
+
+cmake-multilib_src_compile() {
+ local _cmake_args=( "${@}" )
+
+ multilib-minimal_src_compile
+}
+
+multilib_src_compile() {
+ cmake-utils_src_compile "${_cmake_args[@]}"
+}
+
+cmake-multilib_src_test() {
+ local _cmake_args=( "${@}" )
+
+ multilib-minimal_src_test
+}
+
+multilib_src_test() {
+ cmake-utils_src_test "${_cmake_args[@]}"
+}
+
+cmake-multilib_src_install() {
+ local _cmake_args=( "${@}" )
+
+ multilib-minimal_src_install
+}
+
+multilib_src_install() {
+ cmake-utils_src_install "${_cmake_args[@]}"
+}
diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
new file mode 100644
index 00000000000..9e2b0886b7c
--- /dev/null
+++ b/eclass/cmake-utils.eclass
@@ -0,0 +1,751 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @ECLASS: cmake-utils.eclass
+# @MAINTAINER:
+# kde@gentoo.org
+# @AUTHOR:
+# Tomáš Chvátal <scarabeus@gentoo.org>
+# Maciej Mrozowski <reavertm@gentoo.org>
+# (undisclosed contributors)
+# Original author: Zephyrus (zephyrus@mirach.it)
+# @BLURB: common ebuild functions for cmake-based packages
+# @DESCRIPTION:
+# The cmake-utils eclass makes creating ebuilds for cmake-based packages much easier.
+# It provides all inherited features (DOCS, HTML_DOCS, PATCHES) along with out-of-source
+# builds (default), in-source builds and an implementation of the well-known use_enable
+# and use_with functions for CMake.
+
+if [[ -z ${_CMAKE_UTILS_ECLASS} ]]; then
+_CMAKE_UTILS_ECLASS=1
+
+
+# @ECLASS-VARIABLE: BUILD_DIR
+# @DESCRIPTION:
+# Build directory where all cmake processed files should be generated.
+# For in-source build it's fixed to ${CMAKE_USE_DIR}.
+# For out-of-source build it can be overridden, by default it uses
+# ${WORKDIR}/${P}_build.
+#
+# This variable has been called CMAKE_BUILD_DIR formerly.
+# It is set under that name for compatibility.
+
+# @ECLASS-VARIABLE: CMAKE_BINARY
+# @DESCRIPTION:
+# Eclass can use different cmake binary than the one provided in by system.
+: ${CMAKE_BINARY:=cmake}
+
+# @ECLASS-VARIABLE: CMAKE_BUILD_TYPE
+# @DESCRIPTION:
+# Set to override default CMAKE_BUILD_TYPE. Only useful for packages
+# known to make use of "if (CMAKE_BUILD_TYPE MATCHES xxx)".
+# If about to be set - needs to be set before invoking cmake-utils_src_configure.
+# You usualy do *NOT* want nor need to set it as it pulls CMake default build-type
+# specific compiler flags overriding make.conf.
+: ${CMAKE_BUILD_TYPE:=Gentoo}
+
+# @ECLASS-VARIABLE: CMAKE_IN_SOURCE_BUILD
+# @DESCRIPTION:
+# Set to enable in-source build.
+
+# @ECLASS-VARIABLE: CMAKE_MAKEFILE_GENERATOR
+# @DESCRIPTION:
+# Specify a makefile generator to be used by cmake.
+# At this point only "emake" and "ninja" are supported.
+: ${CMAKE_MAKEFILE_GENERATOR:=emake}
+
+# @ECLASS-VARIABLE: CMAKE_MIN_VERSION
+# @DESCRIPTION:
+# Specify the minimum required CMake version.
+: ${CMAKE_MIN_VERSION:=2.8.12}
+
+# @ECLASS-VARIABLE: CMAKE_REMOVE_MODULES
+# @DESCRIPTION:
+# Do we want to remove anything? yes or whatever else for no
+: ${CMAKE_REMOVE_MODULES:=yes}
+CMAKE_REMOVE_MODULES="${CMAKE_REMOVE_MODULES:-yes}"
+
+# @ECLASS-VARIABLE: CMAKE_REMOVE_MODULES_LIST
+# @DESCRIPTION:
+# Space-separated list of CMake modules that will be removed in $S during src_prepare,
+# in order to force packages to use the system version.
+: ${CMAKE_REMOVE_MODULES_LIST:=FindBLAS FindLAPACK}
+
+# @ECLASS-VARIABLE: CMAKE_USE_DIR
+# @DESCRIPTION:
+# Sets the directory where we are working with cmake.
+# For example when application uses autotools and only one
+# plugin needs to be done by cmake.
+# By default it uses ${S}.
+
+# @ECLASS-VARIABLE: CMAKE_VERBOSE
+# @DESCRIPTION:
+# Set to OFF to disable verbose messages during compilation
+: ${CMAKE_VERBOSE:=ON}
+
+# @ECLASS-VARIABLE: CMAKE_WARN_UNUSED_CLI
+# @DESCRIPTION:
+# Warn about variables that are declared on the command line
+# but not used. Might give false-positives.
+# "no" to disable (default) or anything else to enable.
+: ${CMAKE_WARN_UNUSED_CLI:=no}
+
+# @ECLASS-VARIABLE: PREFIX
+# @DESCRIPTION:
+# Eclass respects PREFIX variable, though it's not recommended way to set
+# install/lib/bin prefixes.
+# Use -DCMAKE_INSTALL_PREFIX=... CMake variable instead.
+: ${PREFIX:=/usr}
+
+# @ECLASS-VARIABLE: WANT_CMAKE
+# @DESCRIPTION:
+# Specify if cmake-utils eclass should depend on cmake optionally or not.
+# This is useful when only part of application is using cmake build system.
+# Valid values are: always [default], optional (where the value is the useflag
+# used for optionality)
+: ${WANT_CMAKE:=always}
+
+# @ECLASS-VARIABLE: CMAKE_EXTRA_CACHE_FILE
+# @DESCRIPTION:
+# Specifies an extra cache file to pass to cmake. This is the analog of EXTRA_ECONF
+# for econf and is needed to pass TRY_RUN results when cross-compiling.
+# Should be set by user in a per-package basis in /etc/portage/package.env.
+
+CMAKEDEPEND=""
+case ${WANT_CMAKE} in
+ always)
+ ;;
+ *)
+ IUSE+=" ${WANT_CMAKE}"
+ CMAKEDEPEND+="${WANT_CMAKE}? ( "
+ ;;
+esac
+inherit toolchain-funcs multilib flag-o-matic eutils
+
+case ${EAPI} in
+ 2|3|4|5) : ;;
+ *) die "EAPI=${EAPI:-0} is not supported" ;;
+esac
+
+CMAKE_EXPF="src_prepare src_configure src_compile src_test src_install"
+EXPORT_FUNCTIONS ${CMAKE_EXPF}
+
+case ${CMAKE_MAKEFILE_GENERATOR} in
+ emake)
+ CMAKEDEPEND+=" sys-devel/make"
+ ;;
+ ninja)
+ CMAKEDEPEND+=" dev-util/ninja"
+ ;;
+ *)
+ eerror "Unknown value for \${CMAKE_MAKEFILE_GENERATOR}"
+ die "Value ${CMAKE_MAKEFILE_GENERATOR} is not supported"
+ ;;
+esac
+
+if [[ ${PN} != cmake ]]; then
+ CMAKEDEPEND+=" >=dev-util/cmake-${CMAKE_MIN_VERSION}"
+fi
+
+CMAKEDEPEND+=" userland_GNU? ( >=sys-apps/findutils-4.4.0 )"
+
+[[ ${WANT_CMAKE} = always ]] || CMAKEDEPEND+=" )"
+
+DEPEND="${CMAKEDEPEND}"
+unset CMAKEDEPEND
+
+# Internal functions used by cmake-utils_use_*
+_use_me_now() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local uper capitalised x
+ [[ -z $2 ]] && die "cmake-utils_use-$1 <USE flag> [<flag name>]"
+ if [[ ! -z $3 ]]; then
+ # user specified the use name so use it
+ echo "-D$1$3=$(use $2 && echo ON || echo OFF)"
+ else
+ # use all various most used combinations
+ uper=$(echo ${2} | tr '[:lower:]' '[:upper:]')
+ capitalised=$(echo ${2} | sed 's/\<\(.\)\([^ ]*\)/\u\1\L\2/g')
+ for x in $2 $uper $capitalised; do
+ echo "-D$1$x=$(use $2 && echo ON || echo OFF) "
+ done
+ fi
+}
+_use_me_now_inverted() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local uper capitalised x
+ [[ -z $2 ]] && die "cmake-utils_use-$1 <USE flag> [<flag name>]"
+ if [[ ! -z $3 ]]; then
+ # user specified the use name so use it
+ echo "-D$1$3=$(use $2 && echo OFF || echo ON)"
+ else
+ # use all various most used combinations
+ uper=$(echo ${2} | tr '[:lower:]' '[:upper:]')
+ capitalised=$(echo ${2} | sed 's/\<\(.\)\([^ ]*\)/\u\1\L\2/g')
+ for x in $2 $uper $capitalised; do
+ echo "-D$1$x=$(use $2 && echo OFF || echo ON) "
+ done
+ fi
+}
+
+# Determine using IN or OUT source build
+_check_build_dir() {
+ : ${CMAKE_USE_DIR:=${S}}
+ if [[ -n ${CMAKE_IN_SOURCE_BUILD} ]]; then
+ # we build in source dir
+ BUILD_DIR="${CMAKE_USE_DIR}"
+ else
+ # Respect both the old variable and the new one, depending
+ # on which one was set by the ebuild.
+ if [[ ! ${BUILD_DIR} && ${CMAKE_BUILD_DIR} ]]; then
+ eqawarn "The CMAKE_BUILD_DIR variable has been renamed to BUILD_DIR."
+ eqawarn "Please migrate the ebuild to use the new one."
+
+ # In the next call, both variables will be set already
+ # and we'd have to know which one takes precedence.
+ _RESPECT_CMAKE_BUILD_DIR=1
+ fi
+
+ if [[ ${_RESPECT_CMAKE_BUILD_DIR} ]]; then
+ BUILD_DIR=${CMAKE_BUILD_DIR:-${WORKDIR}/${P}_build}
+ else
+ : ${BUILD_DIR:=${WORKDIR}/${P}_build}
+ fi
+ fi
+
+ # Backwards compatibility for getting the value.
+ CMAKE_BUILD_DIR=${BUILD_DIR}
+
+ mkdir -p "${BUILD_DIR}"
+ echo ">>> Working in BUILD_DIR: \"$BUILD_DIR\""
+}
+
+# Determine which generator to use
+_generator_to_use() {
+ local generator_name
+
+ case ${CMAKE_MAKEFILE_GENERATOR} in
+ ninja)
+ generator_name="Ninja"
+ ;;
+ emake)
+ generator_name="Unix Makefiles"
+ ;;
+ *)
+ eerror "Unknown value for \${CMAKE_MAKEFILE_GENERATOR}"
+ die "Value ${CMAKE_MAKEFILE_GENERATOR} is not supported"
+ ;;
+ esac
+
+ echo ${generator_name}
+}
+
+# @FUNCTION: comment_add_subdirectory
+# @USAGE: <subdirectory>
+# @DESCRIPTION:
+# Comment out an add_subdirectory call in CMakeLists.txt in the current directory
+comment_add_subdirectory() {
+ if [[ -z ${1} ]]; then
+ die "comment_add_subdirectory must be passed the directory name to comment"
+ fi
+
+ if [[ -e "CMakeLists.txt" ]]; then
+ sed -e "/add_subdirectory[[:space:]]*([[:space:]]*${1//\//\\/}[[:space:]]*)/s/^/#DONOTCOMPILE /" \
+ -i CMakeLists.txt || die "failed to comment add_subdirectory(${1})"
+ fi
+}
+
+# @FUNCTION: cmake-utils_use_with
+# @USAGE: <USE flag> [flag name]
+# @DESCRIPTION:
+# Based on use_with. See ebuild(5).
+#
+# `cmake-utils_use_with foo FOO` echoes -DWITH_FOO=ON if foo is enabled
+# and -DWITH_FOO=OFF if it is disabled.
+cmake-utils_use_with() { _use_me_now WITH_ "$@" ; }
+
+# @FUNCTION: cmake-utils_use_enable
+# @USAGE: <USE flag> [flag name]
+# @DESCRIPTION:
+# Based on use_enable. See ebuild(5).
+#
+# `cmake-utils_use_enable foo FOO` echoes -DENABLE_FOO=ON if foo is enabled
+# and -DENABLE_FOO=OFF if it is disabled.
+cmake-utils_use_enable() { _use_me_now ENABLE_ "$@" ; }
+
+# @FUNCTION: cmake-utils_use_find_package
+# @USAGE: <USE flag> [flag name]
+# @DESCRIPTION:
+# Based on use_enable. See ebuild(5).
+#
+# `cmake-utils_use_find_package foo LibFoo` echoes -DCMAKE_DISABLE_FIND_PACKAGE_LibFoo=OFF
+# if foo is enabled and -DCMAKE_DISABLE_FIND_PACKAGE_LibFoo=ON if it is disabled.
+# This can be used to make find_package optional.
+cmake-utils_use_find_package() { _use_me_now_inverted CMAKE_DISABLE_FIND_PACKAGE_ "$@" ; }
+
+# @FUNCTION: cmake-utils_use_disable
+# @USAGE: <USE flag> [flag name]
+# @DESCRIPTION:
+# Based on inversion of use_enable. See ebuild(5).
+#
+# `cmake-utils_use_enable foo FOO` echoes -DDISABLE_FOO=OFF if foo is enabled
+# and -DDISABLE_FOO=ON if it is disabled.
+cmake-utils_use_disable() { _use_me_now_inverted DISABLE_ "$@" ; }
+
+# @FUNCTION: cmake-utils_use_no
+# @USAGE: <USE flag> [flag name]
+# @DESCRIPTION:
+# Based on use_disable. See ebuild(5).
+#
+# `cmake-utils_use_no foo FOO` echoes -DNO_FOO=OFF if foo is enabled
+# and -DNO_FOO=ON if it is disabled.
+cmake-utils_use_no() { _use_me_now_inverted NO_ "$@" ; }
+
+# @FUNCTION: cmake-utils_use_want
+# @USAGE: <USE flag> [flag name]
+# @DESCRIPTION:
+# Based on use_enable. See ebuild(5).
+#
+# `cmake-utils_use_want foo FOO` echoes -DWANT_FOO=ON if foo is enabled
+# and -DWANT_FOO=OFF if it is disabled.
+cmake-utils_use_want() { _use_me_now WANT_ "$@" ; }
+
+# @FUNCTION: cmake-utils_use_build
+# @USAGE: <USE flag> [flag name]
+# @DESCRIPTION:
+# Based on use_enable. See ebuild(5).
+#
+# `cmake-utils_use_build foo FOO` echoes -DBUILD_FOO=ON if foo is enabled
+# and -DBUILD_FOO=OFF if it is disabled.
+cmake-utils_use_build() { _use_me_now BUILD_ "$@" ; }
+
+# @FUNCTION: cmake-utils_use_has
+# @USAGE: <USE flag> [flag name]
+# @DESCRIPTION:
+# Based on use_enable. See ebuild(5).
+#
+# `cmake-utils_use_has foo FOO` echoes -DHAVE_FOO=ON if foo is enabled
+# and -DHAVE_FOO=OFF if it is disabled.
+cmake-utils_use_has() { _use_me_now HAVE_ "$@" ; }
+
+# @FUNCTION: cmake-utils_use_use
+# @USAGE: <USE flag> [flag name]
+# @DESCRIPTION:
+# Based on use_enable. See ebuild(5).
+#
+# `cmake-utils_use_use foo FOO` echoes -DUSE_FOO=ON if foo is enabled
+# and -DUSE_FOO=OFF if it is disabled.
+cmake-utils_use_use() { _use_me_now USE_ "$@" ; }
+
+# @FUNCTION: cmake-utils_use
+# @USAGE: <USE flag> [flag name]
+# @DESCRIPTION:
+# Based on use_enable. See ebuild(5).
+#
+# `cmake-utils_use foo FOO` echoes -DFOO=ON if foo is enabled
+# and -DFOO=OFF if it is disabled.
+cmake-utils_use() { _use_me_now "" "$@" ; }
+
+# @FUNCTION: cmake-utils_useno
+# @USAGE: <USE flag> [flag name]
+# @DESCRIPTION:
+# Based on use_enable. See ebuild(5).
+#
+# `cmake-utils_useno foo NOFOO` echoes -DNOFOO=OFF if foo is enabled
+# and -DNOFOO=ON if it is disabled.
+cmake-utils_useno() { _use_me_now_inverted "" "$@" ; }
+
+# Internal function for modifying hardcoded definitions.
+# Removes dangerous definitions that override Gentoo settings.
+_modify-cmakelists() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ # Only edit the files once
+ grep -qs "<<< Gentoo configuration >>>" "${CMAKE_USE_DIR}"/CMakeLists.txt && return 0
+
+ # Comment out all set (<some_should_be_user_defined_variable> value)
+ # TODO Add QA checker - inform when variable being checked for below is set in CMakeLists.txt
+ find "${CMAKE_USE_DIR}" -name CMakeLists.txt \
+ -exec sed -i -e '/^[[:space:]]*[sS][eE][tT][[:space:]]*([[:space:]]*CMAKE_BUILD_TYPE.*)/{s/^/#IGNORE /g}' {} + \
+ -exec sed -i -e '/^[[:space:]]*[sS][eE][tT][[:space:]]*([[:space:]]*CMAKE_COLOR_MAKEFILE.*)/{s/^/#IGNORE /g}' {} + \
+ -exec sed -i -e '/^[[:space:]]*[sS][eE][tT][[:space:]]*([[:space:]]*CMAKE_INSTALL_PREFIX.*)/{s/^/#IGNORE /g}' {} + \
+ -exec sed -i -e '/^[[:space:]]*[sS][eE][tT][[:space:]]*([[:space:]]*CMAKE_VERBOSE_MAKEFILE.*)/{s/^/#IGNORE /g}' {} + \
+ || die "${LINENO}: failed to disable hardcoded settings"
+
+ # NOTE Append some useful summary here
+ cat >> "${CMAKE_USE_DIR}"/CMakeLists.txt <<- _EOF_
+
+ MESSAGE(STATUS "<<< Gentoo configuration >>>
+ Build type \${CMAKE_BUILD_TYPE}
+ Install path \${CMAKE_INSTALL_PREFIX}
+ Compiler flags:
+ C \${CMAKE_C_FLAGS}
+ C++ \${CMAKE_CXX_FLAGS}
+ Linker flags:
+ Executable \${CMAKE_EXE_LINKER_FLAGS}
+ Module \${CMAKE_MODULE_LINKER_FLAGS}
+ Shared \${CMAKE_SHARED_LINKER_FLAGS}\n")
+ _EOF_
+}
+
+enable_cmake-utils_src_prepare() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ pushd "${S}" > /dev/null
+
+ debug-print "$FUNCNAME: PATCHES=$PATCHES"
+ [[ ${PATCHES[@]} ]] && epatch "${PATCHES[@]}"
+
+ debug-print "$FUNCNAME: applying user patches"
+ epatch_user
+
+ popd > /dev/null
+}
+
+# @VARIABLE: mycmakeargs
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Optional cmake defines as a bash array. Should be defined before calling
+# src_configure.
+# @CODE
+# src_configure() {
+# local mycmakeargs=(
+# $(cmake-utils_use_with openconnect)
+# )
+#
+# cmake-utils_src_configure
+# }
+# @CODE
+
+enable_cmake-utils_src_configure() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ [[ "${CMAKE_REMOVE_MODULES}" == "yes" ]] && {
+ local name
+ for name in ${CMAKE_REMOVE_MODULES_LIST} ; do
+ find "${S}" -name ${name}.cmake -exec rm -v {} +
+ done
+ }
+
+ _check_build_dir
+
+ # check if CMakeLists.txt exist and if no then die
+ if [[ ! -e ${CMAKE_USE_DIR}/CMakeLists.txt ]] ; then
+ eerror "Unable to locate CMakeLists.txt under:"
+ eerror "\"${CMAKE_USE_DIR}/CMakeLists.txt\""
+ eerror "Consider not inheriting the cmake eclass."
+ die "FATAL: Unable to find CMakeLists.txt"
+ fi
+
+ # Remove dangerous things.
+ _modify-cmakelists
+
+ # Fix xdg collision with sandbox
+ export XDG_CONFIG_HOME="${T}"
+
+ # @SEE CMAKE_BUILD_TYPE
+ if [[ ${CMAKE_BUILD_TYPE} = Gentoo ]]; then
+ # Handle release builds
+ if ! has debug ${IUSE//+} || ! use debug; then
+ local CPPFLAGS=${CPPFLAGS}
+ append-cppflags -DNDEBUG
+ fi
+ fi
+
+ # Prepare Gentoo override rules (set valid compiler, append CPPFLAGS etc.)
+ local build_rules=${BUILD_DIR}/gentoo_rules.cmake
+ cat > "${build_rules}" <<- _EOF_
+ SET (CMAKE_AR $(type -P $(tc-getAR)) CACHE FILEPATH "Archive manager" FORCE)
+ SET (CMAKE_ASM_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> ${CFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "ASM compile command" FORCE)
+ SET (CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C compile command" FORCE)
+ SET (CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <DEFINES> ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C++ compile command" FORCE)
+ SET (CMAKE_Fortran_COMPILE_OBJECT "<CMAKE_Fortran_COMPILER> <DEFINES> ${FCFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "Fortran compile command" FORCE)
+ SET (CMAKE_RANLIB $(type -P $(tc-getRANLIB)) CACHE FILEPATH "Archive index generator" FORCE)
+ SET (PKG_CONFIG_EXECUTABLE $(type -P $(tc-getPKG_CONFIG)) CACHE FILEPATH "pkg-config executable" FORCE)
+ _EOF_
+
+ local toolchain_file=${BUILD_DIR}/gentoo_toolchain.cmake
+ cat > ${toolchain_file} <<- _EOF_
+ SET (CMAKE_C_COMPILER $(tc-getCC))
+ SET (CMAKE_CXX_COMPILER $(tc-getCXX))
+ SET (CMAKE_Fortran_COMPILER $(tc-getFC))
+ _EOF_
+
+ if tc-is-cross-compiler; then
+ local sysname
+ case "${KERNEL:-linux}" in
+ Cygwin) sysname="CYGWIN_NT-5.1" ;;
+ HPUX) sysname="HP-UX" ;;
+ linux) sysname="Linux" ;;
+ Winnt) sysname="Windows" ;;
+ *) sysname="${KERNEL}" ;;
+ esac
+
+ cat >> "${toolchain_file}" <<- _EOF_
+ SET (CMAKE_SYSTEM_NAME "${sysname}")
+ _EOF_
+
+ if [ "${SYSROOT:-/}" != "/" ] ; then
+ # When cross-compiling with a sysroot (e.g. with crossdev's emerge wrappers)
+ # we need to tell cmake to use libs/headers from the sysroot but programs from / only.
+ cat >> "${toolchain_file}" <<- _EOF_
+ set(CMAKE_FIND_ROOT_PATH "${SYSROOT}")
+ set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+ set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+ set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+ _EOF_
+ fi
+ fi
+
+ has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
+
+ if [[ ${EPREFIX} ]]; then
+ cat >> "${build_rules}" <<- _EOF_
+ # in Prefix we need rpath and must ensure cmake gets our default linker path
+ # right ... except for Darwin hosts
+ IF (NOT APPLE)
+ SET (CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE)
+ SET (CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH "${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)"
+ CACHE STRING "" FORCE)
+
+ ELSE ()
+
+ SET(CMAKE_PREFIX_PATH "${EPREFIX}${PREFIX}" CACHE STRING "" FORCE)
+ SET(CMAKE_SKIP_BUILD_RPATH OFF CACHE BOOL "" FORCE)
+ SET(CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE)
+ SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE CACHE BOOL "")
+ SET(CMAKE_INSTALL_RPATH "${EPREFIX}${PREFIX}/lib;${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)" CACHE STRING "" FORCE)
+ SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE CACHE BOOL "" FORCE)
+ SET(CMAKE_INSTALL_NAME_DIR "${EPREFIX}${PREFIX}/lib" CACHE STRING "" FORCE)
+
+ ENDIF (NOT APPLE)
+ _EOF_
+ fi
+
+ # Common configure parameters (invariants)
+ local common_config=${BUILD_DIR}/gentoo_common_config.cmake
+ local libdir=$(get_libdir)
+ cat > "${common_config}" <<- _EOF_
+ SET (LIB_SUFFIX ${libdir/lib} CACHE STRING "library path suffix" FORCE)
+ SET (CMAKE_INSTALL_LIBDIR ${libdir} CACHE PATH "Output directory for libraries")
+ _EOF_
+ [[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]] && echo 'SET (CMAKE_COLOR_MAKEFILE OFF CACHE BOOL "pretty colors during make" FORCE)' >> "${common_config}"
+
+ # Convert mycmakeargs to an array, for backwards compatibility
+ # Make the array a local variable since <=portage-2.1.6.x does not
+ # support global arrays (see bug #297255).
+ if [[ $(declare -p mycmakeargs 2>&-) != "declare -a mycmakeargs="* ]]; then
+ local mycmakeargs_local=(${mycmakeargs})
+ else
+ local mycmakeargs_local=("${mycmakeargs[@]}")
+ fi
+
+ if [[ ${CMAKE_WARN_UNUSED_CLI} == no ]] ; then
+ local warn_unused_cli="--no-warn-unused-cli"
+ else
+ local warn_unused_cli=""
+ fi
+
+ # Common configure parameters (overridable)
+ # NOTE CMAKE_BUILD_TYPE can be only overriden via CMAKE_BUILD_TYPE eclass variable
+ # No -DCMAKE_BUILD_TYPE=xxx definitions will be in effect.
+ local cmakeargs=(
+ ${warn_unused_cli}
+ -C "${common_config}"
+ -G "$(_generator_to_use)"
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX}${PREFIX}"
+ "${mycmakeargs_local[@]}"
+ -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}"
+ -DCMAKE_INSTALL_DO_STRIP=OFF
+ -DCMAKE_USER_MAKE_RULES_OVERRIDE="${build_rules}"
+ -DCMAKE_TOOLCHAIN_FILE="${toolchain_file}"
+ "${MYCMAKEARGS}"
+ )
+
+ if [[ -n "${CMAKE_EXTRA_CACHE_FILE}" ]] ; then
+ cmakeargs+=( -C "${CMAKE_EXTRA_CACHE_FILE}" )
+ fi
+
+ pushd "${BUILD_DIR}" > /dev/null
+ debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: mycmakeargs is ${mycmakeargs_local[*]}"
+ echo "${CMAKE_BINARY}" "${cmakeargs[@]}" "${CMAKE_USE_DIR}"
+ "${CMAKE_BINARY}" "${cmakeargs[@]}" "${CMAKE_USE_DIR}" || die "cmake failed"
+ popd > /dev/null
+}
+
+enable_cmake-utils_src_compile() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ cmake-utils_src_make "$@"
+}
+
+_ninjaopts_from_makeopts() {
+ if [[ ${NINJAOPTS+set} == set ]]; then
+ return 0
+ fi
+ local ninjaopts=()
+ set -- ${MAKEOPTS}
+ while (( $# )); do
+ case $1 in
+ -j|-l|-k)
+ ninjaopts+=( $1 $2 )
+ shift 2
+ ;;
+ -j*|-l*|-k*)
+ ninjaopts+=( $1 )
+ shift 1
+ ;;
+ *) shift ;;
+ esac
+ done
+ export NINJAOPTS="${ninjaopts[*]}"
+}
+
+# @FUNCTION: ninja_src_make
+# @INTERNAL
+# @DESCRIPTION:
+# Build the package using ninja generator
+ninja_src_make() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ [[ -e build.ninja ]] || die "build.ninja not found. Error during configure stage."
+
+ _ninjaopts_from_makeopts
+
+ if [[ "${CMAKE_VERBOSE}" != "OFF" ]]; then
+ set -- ninja ${NINJAOPTS} -v "$@"
+ else
+ set -- ninja ${NINJAOPTS} "$@"
+ fi
+
+ echo "$@"
+ "$@" || die
+}
+
+# @FUNCTION: emake_src_make
+# @INTERNAL
+# @DESCRIPTION:
+# Build the package using make generator
+emake_src_make() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ [[ -e Makefile ]] || die "Makefile not found. Error during configure stage."
+
+ if [[ "${CMAKE_VERBOSE}" != "OFF" ]]; then
+ emake VERBOSE=1 "$@" || die
+ else
+ emake "$@" || die
+ fi
+
+}
+
+# @FUNCTION: cmake-utils_src_make
+# @DESCRIPTION:
+# Function for building the package. Automatically detects the build type.
+# All arguments are passed to emake.
+cmake-utils_src_make() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ _check_build_dir
+ pushd "${BUILD_DIR}" > /dev/null
+
+ ${CMAKE_MAKEFILE_GENERATOR}_src_make "$@"
+
+ popd > /dev/null
+}
+
+enable_cmake-utils_src_test() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ _check_build_dir
+ pushd "${BUILD_DIR}" > /dev/null
+ [[ -e CTestTestfile.cmake ]] || { echo "No tests found. Skipping."; return 0 ; }
+
+ [[ -n ${TEST_VERBOSE} ]] && myctestargs+=( --extra-verbose --output-on-failure )
+
+ if ctest "${myctestargs[@]}" "$@" ; then
+ einfo "Tests succeeded."
+ popd > /dev/null
+ return 0
+ else
+ if [[ -n "${CMAKE_YES_I_WANT_TO_SEE_THE_TEST_LOG}" ]] ; then
+ # on request from Diego
+ eerror "Tests failed. Test log ${BUILD_DIR}/Testing/Temporary/LastTest.log follows:"
+ eerror "--START TEST LOG--------------------------------------------------------------"
+ cat "${BUILD_DIR}/Testing/Temporary/LastTest.log"
+ eerror "--END TEST LOG----------------------------------------------------------------"
+ die "Tests failed."
+ else
+ die "Tests failed. When you file a bug, please attach the following file: \n\t${BUILD_DIR}/Testing/Temporary/LastTest.log"
+ fi
+
+ # die might not die due to nonfatal
+ popd > /dev/null
+ return 1
+ fi
+}
+
+enable_cmake-utils_src_install() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ _check_build_dir
+ pushd "${BUILD_DIR}" > /dev/null
+ DESTDIR="${D}" ${CMAKE_MAKEFILE_GENERATOR} install "$@" || die "died running ${CMAKE_MAKEFILE_GENERATOR} install"
+ popd > /dev/null
+
+ pushd "${S}" > /dev/null
+ einstalldocs
+ popd > /dev/null
+}
+
+# @FUNCTION: cmake-utils_src_prepare
+# @DESCRIPTION:
+# Apply ebuild and user patches.
+cmake-utils_src_prepare() {
+ _execute_optionally "src_prepare" "$@"
+}
+
+# @FUNCTION: cmake-utils_src_configure
+# @DESCRIPTION:
+# General function for configuring with cmake. Default behaviour is to start an
+# out-of-source build.
+cmake-utils_src_configure() {
+ _execute_optionally "src_configure" "$@"
+}
+
+# @FUNCTION: cmake-utils_src_compile
+# @DESCRIPTION:
+# General function for compiling with cmake.
+# Automatically detects the build type. All arguments are passed to emake.
+cmake-utils_src_compile() {
+ _execute_optionally "src_compile" "$@"
+}
+
+# @FUNCTION: cmake-utils_src_test
+# @DESCRIPTION:
+# Function for testing the package. Automatically detects the build type.
+cmake-utils_src_test() {
+ _execute_optionally "src_test" "$@"
+}
+
+# @FUNCTION: cmake-utils_src_install
+# @DESCRIPTION:
+# Function for installing the package. Automatically detects the build type.
+cmake-utils_src_install() {
+ _execute_optionally "src_install" "$@"
+}
+
+# Optionally executes phases based on WANT_CMAKE variable/USE flag.
+_execute_optionally() {
+ local phase="$1" ; shift
+ if [[ ${WANT_CMAKE} = always ]]; then
+ enable_cmake-utils_${phase} "$@"
+ else
+ use ${WANT_CMAKE} && enable_cmake-utils_${phase} "$@"
+ fi
+}
+
+fi
diff --git a/eclass/common-lisp-3.eclass b/eclass/common-lisp-3.eclass
new file mode 100644
index 00000000000..ef6531ba313
--- /dev/null
+++ b/eclass/common-lisp-3.eclass
@@ -0,0 +1,211 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @ECLASS: common-lisp-3.eclass
+# @MAINTAINER:
+# Common Lisp project <common-lisp@gentoo.org>
+# @BLURB: functions to support the installation of Common Lisp libraries
+# @DESCRIPTION:
+# Since Common Lisp libraries share similar structure, this eclass aims
+# to provide a simple way to write ebuilds with these characteristics.
+
+inherit eutils
+
+# CL packages in the overlay don't have their tarballs on the mirrors
+# so it's useless to mirror them
+RESTRICT="mirror"
+
+# @ECLASS-VARIABLE: CLSOURCEROOT
+# @DESCRIPTION:
+# Default path of Common Lisp libraries sources. Sources will
+# be installed into ${CLSOURCEROOT}/${CLPACKAGE}.
+CLSOURCEROOT="${ROOT%/}"/usr/share/common-lisp/source
+
+# @ECLASS-VARIABLE: CLSYSTEMROOT
+# @DESCRIPTION:
+# Default path to find any asdf file. Any asdf files will be
+# symlinked in ${CLSYSTEMROOT}/${CLSYSTEM} as they may be in
+# an arbitrarily deeply nested directory under ${CLSOURCEROOT}/${CLPACKAGE}.
+CLSYSTEMROOT="${ROOT%/}"/usr/share/common-lisp/systems
+
+# @ECLASS-VARIABLE: CLPACKAGE
+# @DESCRIPTION:
+# Default package name. To override, set these after inheriting this eclass.
+CLPACKAGE="${PN}"
+
+PDEPEND="virtual/commonlisp"
+
+EXPORT_FUNCTIONS src_compile src_install
+
+# @FUNCTION: common-lisp-3_src_compile
+# @DESCRIPTION:
+# Since there's nothing to build in most cases, default doesn't do
+# anything.
+common-lisp-3_src_compile() { true; }
+
+# @FUNCTION: absolute-path-p
+# @DESCRIPTION:
+# Returns true if ${1} is an absolute path.
+absolute-path-p() {
+ [[ $# -eq 1 ]] || die "${FUNCNAME[0]} must receive one argument"
+ [[ ${1} == /* ]]
+}
+
+# @FUNCTION: common-lisp-install-one-source
+# @DESCRIPTION:
+# Installs ${2} source file in ${3} inside CLSOURCEROOT/CLPACKAGE.
+common-lisp-install-one-source() {
+ [[ $# -eq 3 ]] || die "${FUNCNAME[0]} must receive exactly three arguments"
+
+ local fpredicate=${1}
+ local source=${2}
+ local target="${CLSOURCEROOT}/${CLPACKAGE}/${3}"
+
+ if absolute-path-p "${source}" ; then
+ die "Cannot install files with absolute path: ${source}"
+ fi
+
+ if ${fpredicate} "${source}" ; then
+ insinto "${target}"
+ doins "${source}" || die "Failed to install ${source} into $(dirname "${target}")"
+ fi
+}
+
+# @FUNCTION: lisp-file-p
+# @DESCRIPTION:
+# Returns true if ${1} is lisp source file.
+lisp-file-p() {
+ [[ $# -eq 1 ]] || die "${FUNCNAME[0]} must receive one argument"
+
+ [[ ${1} =~ \.(lisp|lsp|cl)$ ]]
+}
+
+# @FUNCTION: common-lisp-get-fpredicate
+# @DESCRIPTION:
+# Outputs the corresponding predicate to check files of type ${1}.
+common-lisp-get-fpredicate() {
+ [[ $# -eq 1 ]] || die "${FUNCNAME[0]} must receive one argument"
+
+ local ftype=${1}
+ case ${ftype} in
+ "lisp") echo "lisp-file-p" ;;
+ "all" ) echo "true" ;;
+ * ) die "Unknown filetype specifier ${ftype}" ;;
+ esac
+}
+
+# @FUNCTION: common-lisp-install-sources
+# @USAGE: common-lisp-install-sources path [<other_paths>...]
+# @DESCRIPTION:
+# Recursively install lisp sources of type ${2} if ${1} is -t or
+# Lisp by default. When given a directory, it will be recursively
+# scanned for Lisp source files with suffixes: .lisp, .lsp or .cl.
+common-lisp-install-sources() {
+ local ftype="lisp"
+ if [[ ${1} == "-t" ]] ; then
+ ftype=${2}
+ shift ; shift
+ fi
+
+ [[ $# -ge 1 ]] || die "${FUNCNAME[0]} must receive one non-option argument"
+
+ local fpredicate=$(common-lisp-get-fpredicate "${ftype}")
+
+ for path in "${@}" ; do
+ if [[ -f ${path} ]] ; then
+ common-lisp-install-one-source ${fpredicate} "${path}" "$(dirname "${path}")"
+ elif [[ -d ${path} ]] ; then
+ common-lisp-install-sources -t ${ftype} $(find "${path}" -type f)
+ else
+ die "${path} it neither a regular file nor a directory"
+ fi
+ done
+}
+
+# @FUNCTION: common-lisp-install-one-asdf
+# @DESCRIPTION:
+# Installs ${1} asdf file in CLSOURCEROOT/CLPACKAGE and symlinks it in
+# CLSYSTEMROOT.
+common-lisp-install-one-asdf() {
+ [[ $# != 1 ]] && die "${FUNCNAME[0]} must receive exactly one argument"
+
+ # the suffix «.asd» is optional
+ local source=${1/.asd}.asd
+ common-lisp-install-one-source true "${source}" "$(dirname "${source}")"
+ local target="${CLSOURCEROOT%/}/${CLPACKAGE}/${source}"
+ dosym "${target}" "${CLSYSTEMROOT%/}/$(basename ${target})"
+}
+
+# @FUNCTION: common-lisp-install-asdf
+# @USAGE: common-lisp-install-asdf path [<other_paths>...]
+# @DESCRIPTION:
+# Installs all ASDF files and creates symlinks in CLSYSTEMROOT.
+# When given a directory, it will be recursively scanned for ASDF
+# files with extension .asd.
+common-lisp-install-asdf() {
+ dodir "${CLSYSTEMROOT}"
+
+ [[ $# = 0 ]] && set - ${CLSYSTEMS}
+ [[ $# = 0 ]] && set - $(find . -type f -name \*.asd)
+ for sys in "${@}" ; do
+ common-lisp-install-one-asdf ${sys}
+ done
+}
+
+# @FUNCTION: common-lisp-3_src_install
+# @DESCRIPTION:
+# Recursively install Lisp sources, asdf files and most common doc files.
+common-lisp-3_src_install() {
+ common-lisp-install-sources .
+ common-lisp-install-asdf
+ for i in AUTHORS README* HEADER TODO* CHANGELOG Change[lL]og CHANGES BUGS CONTRIBUTORS *NEWS* ; do
+ [[ -f ${i} ]] && dodoc ${i}
+ done
+}
+
+# @FUNCTION: common-lisp-export-impl-args
+# @USAGE: common-lisp-export-impl-args <lisp-implementation>
+# @DESCRIPTION:
+# Export a few variables containing the switches necessary
+# to make the CL implementation perform basic functions:
+# * CL_NORC: don't load syste-wide or user-specific initfiles
+# * CL_LOAD: load a certain file
+# * CL_EVAL: eval a certain expression at startup
+common-lisp-export-impl-args() {
+ if [[ $# != 1 ]]; then
+ eerror "Usage: ${FUNCNAME[0]} lisp-implementation"
+ die "${FUNCNAME[0]}: wrong number of arguments: $#"
+ fi
+ case ${1} in
+ clisp)
+ CL_NORC="-norc"
+ CL_LOAD="-i"
+ CL_EVAL="-x"
+ ;;
+ clozure | ccl | openmcl)
+ CL_NORC="--no-init"
+ CL_LOAD="--load"
+ CL_EVAL="--eval"
+ ;;
+ cmucl)
+ CL_NORC="-nositeinit -noinit"
+ CL_LOAD="-load"
+ CL_EVAL="-eval"
+ ;;
+ ecl)
+ CL_NORC="-norc"
+ CL_LOAD="-load"
+ CL_EVAL="-eval"
+ ;;
+ sbcl)
+ CL_NORC="--sysinit /dev/null --userinit /dev/null"
+ CL_LOAD="--load"
+ CL_EVAL="--eval"
+ ;;
+ *)
+ die ${1} is not supported by ${0}
+ ;;
+ esac
+ export CL_NORC CL_LOAD CL_EVAL
+}
diff --git a/eclass/common-lisp-common-2.eclass b/eclass/common-lisp-common-2.eclass
new file mode 100644
index 00000000000..49fa9503fb7
--- /dev/null
+++ b/eclass/common-lisp-common-2.eclass
@@ -0,0 +1,80 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+#
+# Author Matthew Kennedy <mkennedy@gentoo.org>
+#
+# Sundry code common to many Common Lisp related ebuilds.
+
+# Some handy constants
+
+inherit eutils multilib
+
+CLSOURCEROOT=/usr/share/common-lisp/source/
+CLSYSTEMROOT=/usr/share/common-lisp/systems/
+
+# Many of our Common Lisp ebuilds are either inspired by, or actually
+# use packages and files from the Debian project's archives.
+
+do-debian-credits() {
+ docinto debian
+ for i in copyright README.Debian changelog; do
+ test -f $i && dodoc "${S}"/debian/${i}
+ done
+ docinto .
+}
+
+# BIG FAT HACK: Since the Portage emerge step kills file timestamp
+# information, we need to compensate by ensuring all FASL files are
+# more recent than their source files.
+
+# The following `impl-*-timestamp-hack' functions SHOULD NOT be used
+# outside of this eclass.
+
+impl-save-timestamp-hack() {
+ local impl=$1
+ dodir /usr/share/${impl}
+ tar cpjf "${D}"/usr/share/${impl}/portage-timestamp-compensate -C "${D}"/usr/$(get_libdir)/${impl} .
+}
+
+impl-restore-timestamp-hack() {
+ local impl=$1
+ tar xjpfo /usr/share/${impl}/portage-timestamp-compensate -C /usr/$(get_libdir)/${impl}
+}
+
+impl-remove-timestamp-hack() {
+ local impl=$1
+ rm -rf /usr/$(get_libdir)/${impl} &>/dev/null || true
+}
+
+standard-impl-postinst() {
+ local impl=$1
+ unregister-common-lisp-implementation cmucl
+ case ${impl} in
+ cmucl|sbcl)
+ impl-restore-timestamp-hack ${impl}
+ ;;
+ *)
+ ;;
+ esac
+ register-common-lisp-implementation ${impl}
+}
+
+standard-impl-postrm() {
+ local impl=$1 impl_binary=$2
+ if [ ! -x ${impl_binary} ]; then
+ case ${impl} in
+ cmucl|sbcl)
+ impl-remove-timestamp-hack ${impl}
+ ;;
+ *)
+ ;;
+ esac
+ rm -rf /var/cache/common-lisp-controller/*/${impl}
+ fi
+}
+
+# Local Variables: ***
+# mode: shell-script ***
+# tab-width: 4 ***
+# End: ***
diff --git a/eclass/common-lisp-common-3.eclass b/eclass/common-lisp-common-3.eclass
new file mode 100644
index 00000000000..b652b8397c8
--- /dev/null
+++ b/eclass/common-lisp-common-3.eclass
@@ -0,0 +1,82 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+#
+# Author Matthew Kennedy <mkennedy@gentoo.org>
+#
+# Sundry code common to many Common Lisp related ebuilds. Some
+# implementation use the Portage time stamp hack to ensure their
+# installed files have the right modification time relative to each
+# other.
+
+inherit eutils multilib
+
+CLSOURCEROOT=/usr/share/common-lisp/source/
+CLSYSTEMROOT=/usr/share/common-lisp/systems/
+
+# Many of our Common Lisp ebuilds are either inspired by, or actually
+# use packages and files from the Debian project's archives.
+
+do-debian-credits() {
+ docinto debian
+ for i in copyright README.Debian changelog; do
+ test -f $i && dodoc "${S}"/debian/${i}
+ done
+ docinto .
+}
+
+# BIG FAT HACK: Since the Portage emerge step kills file timestamp
+# information, we need to compensate by ensuring all FASL files are
+# more recent than their source files.
+
+# The following `impl-*-timestamp-hack' functions SHOULD NOT be used
+# outside of this eclass.
+
+# Bug http://bugs.gentoo.org/show_bug.cgi?id=16162 should remove the
+# need for this hack.
+
+impl-save-timestamp-hack() {
+ local impl=$1
+ dodir /usr/share/${impl}
+ tar cpjf "${D}"/usr/share/${impl}/portage-timestamp-compensate -C "${D}"/usr/$(get_libdir)/${impl} .
+}
+
+impl-restore-timestamp-hack() {
+ local impl=$1
+ tar xjpfo /usr/share/${impl}/portage-timestamp-compensate -C /usr/$(get_libdir)/${impl}
+}
+
+impl-remove-timestamp-hack() {
+ local impl=$1
+ rm -rf /usr/$(get_libdir)/${impl} &>/dev/null || true
+}
+
+standard-impl-postinst() {
+ local impl=$1
+ case ${impl} in
+ cmucl|sbcl)
+ impl-restore-timestamp-hack ${impl}
+ ;;
+ *)
+ ;;
+ esac
+}
+
+standard-impl-postrm() {
+ local impl=$1 impl_binary=$2
+ if [ ! -x ${impl_binary} ]; then
+ case ${impl} in
+ cmucl|sbcl)
+ impl-remove-timestamp-hack ${impl}
+ ;;
+ *)
+ ;;
+ esac
+ rm -rf /var/cache/common-lisp-controller/*/${impl}
+ fi
+}
+
+# Local Variables: ***
+# mode: shell-script ***
+# tab-width: 4 ***
+# End: ***
diff --git a/eclass/common-lisp-common.eclass b/eclass/common-lisp-common.eclass
new file mode 100644
index 00000000000..7350573238a
--- /dev/null
+++ b/eclass/common-lisp-common.eclass
@@ -0,0 +1,209 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+#
+# Author Matthew Kennedy <mkennedy@gentoo.org>
+#
+# Sundry code common to many Common Lisp related ebuilds.
+
+# Some handy constants
+
+inherit eutils multilib
+
+CLFASLROOT=/usr/$(get_libdir)/common-lisp/
+CLSOURCEROOT=/usr/share/common-lisp/source/
+CLSYSTEMROOT=/usr/share/common-lisp/systems/
+
+# Many of our Common Lisp ebuilds are either inspired by, or actually
+# use packages and files from the Debian project's archives.
+
+do-debian-credits() {
+ docinto debian
+ for i in copyright README.Debian changelog; do
+ # be silent, since all files are not always present
+ dodoc "${S}"/debian/${i} &>/dev/null || true
+ done
+ docinto .
+}
+
+# Most of the code below is from Debian's Common Lisp Controller
+# package
+
+register-common-lisp-implementation() {
+ PROGNAME=$(basename $0)
+ # first check if there is at least a compiler-name:
+ if [ -z "$1" ] ; then
+ cat <<EOF
+usage: $PROGNAME compiler-name
+
+registers a Common Lisp compiler to the
+Common-Lisp-Controller system.
+EOF
+ exit 1
+ fi
+ IMPL=$1
+ FILE="/usr/$(get_libdir)/common-lisp/bin/$IMPL.sh"
+ if [ ! -f "$FILE" ] ; then
+ cat <<EOF
+$PROGNAME: I cannot find the script $FILE for the implementation $IMPL
+EOF
+ exit 2
+ fi
+ if [ ! -r "$FILE" ] ; then
+ cat <<EOF
+$PROGNAME: I cannot read the script $FILE for the implementation $IMPL
+EOF
+ exit 2
+ fi
+ # install CLC into the lisp
+ sh "$FILE" install-clc || (echo "Installation of CLC failed" >&2 ; exit 3)
+ mkdir /usr/$(get_libdir)/common-lisp/$IMPL &>/dev/null || true
+ chown cl-builder:cl-builder /usr/$(get_libdir)/common-lisp/$IMPL
+
+ # now recompile the stuff
+ for i in /usr/share/common-lisp/systems/*.asd ; do
+ if [ -f $i -a -r $i ] ; then
+ i=${i%.asd}
+ package=${i##*/}
+ clc-autobuild-check $IMPL $package
+ if [ $? = 0 ]; then
+ echo recompiling package $package for implementation $IMPL
+ /usr/bin/clc-send-command --quiet recompile $package $IMPL
+ fi
+ fi
+ done
+ for i in /usr/share/common-lisp/systems/*.system ; do
+ if [ -f $i -a -r $i ] ; then
+ i=${i%.system}
+ package=${i##*/}
+ clc-autobuild-check $IMPL $package
+ if [ $? = 0 ]; then
+ echo recompiling package $package for implementation $IMPL
+ /usr/bin/clc-send-command --quiet recompile $package $IMPL
+ fi
+ fi
+ done
+ echo "$PROGNAME: Compiler $IMPL installed"
+}
+
+unregister-common-lisp-implementation() {
+ PROGNAME=$(basename $0)
+ if [ `id -u` != 0 ] ; then
+ echo $PROGNAME: you need to be root to run this program
+ exit 1
+ fi
+ if [ -z "$1" ] ; then
+ cat <<EOF
+usage: $PROGNAME compiler-name
+
+un-registers a Common Lisp compiler to the
+Common-Lisp-Controller system.
+EOF
+ exit 1
+ fi
+ IMPL=$1
+ IMPL_BIN="/usr/$(get_libdir)/common-lisp/bin/$IMPL.sh"
+ if [ ! -f "$IMPL_BIN" ] ; then
+ cat <<EOF
+$PROGNAME: No implementation of the name $IMPL is registered
+Cannot find the file $IMPL_BIN
+
+Maybe you already removed it?
+EOF
+ exit 0
+ fi
+ if [ ! -r "$IMPL_BIN" ] ; then
+ cat <<EOF
+$PROGNAME: No implementation of the name $IMPL is registered
+Cannot read the file $IMPL_BIN
+
+Maybe you already removed it?
+EOF
+ exit 0
+ fi
+ # Uninstall the CLC
+ sh $IMPL_BIN remove-clc || echo "De-installation of CLC failed" >&2
+ clc-autobuild-impl $IMPL inherit
+ # Just remove the damn subtree
+ (cd / ; rm -rf "/usr/$(get_libdir)/common-lisp/$IMPL/" ; true )
+ echo "$PROGNAME: Common Lisp implementation $IMPL uninstalled"
+}
+
+reregister-all-common-lisp-implementations() {
+ # Rebuilds all common lisp implementations
+ # Written by Kevin Rosenberg <kmr@debian.org>
+ # GPL-2 license
+ local clc_bin_dir=/usr/$(get_libdir)/common-lisp/bin
+ local opt=$(shopt nullglob); shopt -s nullglob
+ cd $clc_bin_dir
+ for impl_bin in *.sh; do
+ impl=$(echo $impl_bin | sed 's/\(.*\).sh/\1/')
+ unregister-common-lisp-implementation $impl
+ register-common-lisp-implementation $impl
+ done
+ cd - >/dev/null
+ [[ $opt = *off ]] && shopt -u nullglob
+}
+
+# BIG FAT HACK: Since the Portage emerge step kills file timestamp
+# information, we need to compensate by ensuring all FASL files are
+# more recent than their source files.
+
+# The following `impl-*-timestamp-hack' functions SHOULD NOT be used
+# outside of this eclass.
+
+impl-save-timestamp-hack() {
+ local impl=$1
+ dodir /usr/share/${impl}
+ tar cpjf "${D}"/usr/share/${impl}/portage-timestamp-compensate -C "${D}"/usr/$(get_libdir)/${impl} .
+}
+
+impl-restore-timestamp-hack() {
+ local impl=$1
+ tar xjpfo /usr/share/${impl}/portage-timestamp-compensate -C /usr/$(get_libdir)/${impl}
+}
+
+impl-remove-timestamp-hack() {
+ local impl=$1
+ rm -rf /usr/$(get_libdir)/${impl} &>/dev/null || true
+}
+
+test-in() {
+ local symbol=$1
+ shift
+ for i in $@; do
+ if [ $i == ${symbol} ]; then
+ return 0 # true
+ fi
+ done
+ false
+}
+
+standard-impl-postinst() {
+ local impl=$1
+ rm -rf /usr/$(get_libdir)/common-lisp/${impl}/* &>/dev/null || true
+ chown cl-builder:cl-builder /usr/$(get_libdir)/common-lisp/${impl}
+ if test-in ${impl} cmucl sbcl; then
+ impl-restore-timestamp-hack ${impl}
+ fi
+ chown -R root:0 /usr/$(get_libdir)/${impl}
+ /usr/bin/clc-autobuild-impl ${impl} yes
+ register-common-lisp-implementation ${impl}
+}
+
+standard-impl-postrm() {
+ local impl=$1 impl_binary=$2
+ # Since we keep our own time stamps we must manually remove them
+ # here.
+ if [ ! -x ${impl_binary} ]; then
+ if test-in ${impl} cmucl sbcl; then
+ impl-remove-timestamp-hack ${impl}
+ fi
+ rm -rf /usr/$(get_libdir)/common-lisp/${impl}/*
+ fi
+}
+
+# Local Variables: ***
+# mode: shell-script ***
+# tab-width: 4 ***
+# End: ***
diff --git a/eclass/common-lisp.eclass b/eclass/common-lisp.eclass
new file mode 100644
index 00000000000..a67c4c2f5fc
--- /dev/null
+++ b/eclass/common-lisp.eclass
@@ -0,0 +1,78 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+#
+# Author Matthew Kennedy <mkennedy@gentoo.org>
+#
+# This eclass supports the common-lisp-controller installation of many
+# Common Lisp libraries
+
+inherit common-lisp-common
+
+CLPACKAGE=
+DEPEND="dev-lisp/common-lisp-controller"
+
+EXPORT_FUNCTIONS pkg_preinst pkg_postinst pkg_postrm
+
+common-lisp_pkg_postinst() {
+ if [ -z "${CLPACKAGE}" ]; then
+ die "CLPACKAGE was empty or undefined upon call to pkg_prerm"
+ else
+ for package in ${CLPACKAGE}; do
+ einfo "Registering Common Lisp source for ${package}"
+ register-common-lisp-source ${package}
+ done
+ fi
+}
+
+common-lisp_pkg_postrm() {
+ if [ -z "${CLPACKAGE}" ]; then
+ die "CLPACKAGE was empty or undefined upon call to pkg_prerm"
+ else
+ for package in ${CLPACKAGE}; do
+ if [ ! -d ${CLSOURCEROOT}/${package} ]; then
+ einfo "Unregistering Common Lisp source for ${package}"
+# rm -rf ${CLFASLROOT}/*/${package}
+ unregister-common-lisp-source ${package}
+ fi
+ done
+ fi
+}
+
+#
+# In pkg_preinst, we remove the FASL files for the previous version of
+# the source.
+#
+common-lisp_pkg_preinst() {
+ if [ -z "${CLPACKAGE}" ]; then
+ die "CLPACKAGE was empty or undefined upon call to pkg_preinst"
+ else
+ for package in ${CLPACKAGE}; do
+ einfo "Removing FASL files for previous version of Common Lisp package ${package}"
+ rm -rf ${CLFASLROOT}/*/${package} || true
+ done
+ fi
+}
+
+common-lisp-install() {
+ insinto ${CLSOURCEROOT}/${CLPACKAGE}
+ doins $@
+}
+
+common-lisp-system-symlink() {
+ dodir ${CLSYSTEMROOT}/`dirname ${CLPACKAGE}`
+ if [ $# -eq 0 ]; then
+ dosym ${CLSOURCEROOT}/${CLPACKAGE}/${CLPACKAGE}.asd \
+ ${CLSYSTEMROOT}/${CLPACKAGE}.asd
+ else
+ for package in "$@" ; do
+ dosym ${CLSOURCEROOT}/$CLPACKAGE/${package}.asd \
+ ${CLSYSTEMROOT}/${package}.asd
+ done
+ fi
+}
+
+# Local Variables: ***
+# mode: shell-script ***
+# tab-width: 4 ***
+# End: ***
diff --git a/eclass/confutils.eclass b/eclass/confutils.eclass
new file mode 100644
index 00000000000..764ee31ebef
--- /dev/null
+++ b/eclass/confutils.eclass
@@ -0,0 +1,478 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @ECLASS: confutils.eclass
+# @MAINTAINER:
+# Benedikt Böhm <hollow@gentoo.org>
+# @BLURB: utility functions to help with configuring a package
+# @DESCRIPTION:
+# The confutils eclass contains functions to handle use flag dependencies and
+# extended --with-*/--enable-* magic.
+#
+# Based on the PHP5 eclass by Stuart Herbert <stuart@stuartherbert.com>
+
+inherit eutils
+
+# @VARIABLE: EBUILD_SUPPORTS_SHAREDEXT
+# @DESCRIPTION:
+# Set this variable to 1 if your ebuild supports shared extensions. You need to
+# call confutils_init() in pkg_setup() if you use this variable.
+if [[ ${EBUILD_SUPPORTS_SHAREDEXT} == 1 ]]; then
+ IUSE="sharedext"
+fi
+
+# @FUNCTION: confutils_init
+# @USAGE: [value]
+# @DESCRIPTION:
+# Call this function from your pkg_setup() function to initialize this eclass
+# if EBUILD_SUPPORTS_SHAREDEXT is enabled. If no value is given `shared' is used
+# by default.
+confutils_init() {
+ if [[ ${EBUILD_SUPPORTS_SHAREDEXT} == 1 ]] && use sharedext; then
+ shared="=${1:-shared}"
+ else
+ shared=
+ fi
+}
+
+# @FUNCTION: confutils_require_one
+# @USAGE: <flag> [more flags ...]
+# @DESCRIPTION:
+# Use this function to ensure exactly one of the specified USE flags have been
+# enabled
+confutils_require_one() {
+ local required_flags="$@"
+ local success=0
+
+ for flag in ${required_flags}; do
+ use ${flag} && ((success++))
+ done
+
+ [[ ${success} -eq 1 ]] && return
+
+ echo
+ eerror "You *must* enable *exactly* one of the following USE flags:"
+ eerror " ${required_flags}"
+ eerror
+ eerror "You can do this by enabling *one* of these flag in /etc/portage/package.use:"
+
+ set -- ${required_flags}
+ eerror " =${CATEGORY}/${PN}-${PVR} ${1}"
+ shift
+
+ for flag in $@; do
+ eerror " OR =${CATEGORY}/${PN}-${PVR} ${flag}"
+ done
+
+ echo
+ die "Missing or conflicting USE flags"
+}
+
+# @FUNCTION: confutils_require_any
+# @USAGE: <flag> [more flags ...]
+# @DESCRIPTION:
+# Use this function to ensure one or more of the specified USE flags have been
+# enabled
+confutils_require_any() {
+ local required_flags="$@"
+ local success=0
+
+ for flag in ${required_flags}; do
+ use ${flag} && success=1
+ done
+
+ [[ ${success} -eq 1 ]] && return
+
+ echo
+ eerror "You *must* enable one or more of the following USE flags:"
+ eerror " ${required_flags}"
+ eerror
+ eerror "You can do this by enabling these flags in /etc/portage/package.use:"
+ eerror " =${CATEGORY}/${PN}-${PVR} ${required_flags}"
+ echo
+ die "Missing USE flags"
+}
+
+# @FUNCTION: confutils_require_built_with_all
+# @USAGE: <foreign> <flag> [more flags ...]
+# @DESCRIPTION:
+# Use this function to ensure all of the specified USE flags have been enabled
+# in the specified foreign package
+confutils_require_built_with_all() {
+ local foreign=$1 && shift
+ local required_flags="$@"
+
+ built_with_use ${foreign} ${required_flags} && return
+
+ echo
+ eerror "You *must* enable all of the following USE flags in ${foreign}:"
+ eerror " ${required_flags}"
+ eerror
+ eerror "You can do this by enabling these flags in /etc/portage/package.use:"
+ eerror " ${foreign} ${required_flags}"
+ echo
+ die "Missing USE flags in ${foreign}"
+}
+
+# @FUNCTION: confutils_require_built_with_any
+# @USAGE: <foreign> <flag> [more flags ...]
+# @DESCRIPTION:
+# Use this function to ensure one or more of the specified USE flags have been
+# enabled in the specified foreign package
+confutils_require_built_with_any() {
+ local foreign=$1 && shift
+ local required_flags="$@"
+ local success=0
+
+ for flag in ${required_flags}; do
+ built_with_use ${foreign} ${flag} && success=1
+ done
+
+ [[ ${success} -eq 1 ]] && return
+
+ echo
+ eerror "You *must* enable one or more of the following USE flags in ${foreign}:"
+ eerror " ${required_flags}"
+ eerror
+ eerror "You can do this by enabling these flags in /etc/portage/package.use:"
+ eerror " ${foreign} ${required_flags}"
+ echo
+ die "Missing USE flags in ${foreign}"
+}
+
+# @FUNCTION: confutils_use_conflict
+# @USAGE: <enabled flag> <conflicting flag> [more conflicting flags ...]
+# @DESCRIPTION:
+# Use this function to automatically complain to the user if conflicting USE
+# flags have been enabled
+confutils_use_conflict() {
+ use $1 || return
+
+ local my_flag="$1" && shift
+ local my_present=
+ local my_remove=
+
+ for flag in "$@"; do
+ if use ${flag}; then
+ my_present="${my_present} ${flag}"
+ my_remove="${my_remove} -${flag}"
+ fi
+ done
+
+ [[ -z "${my_present}" ]] && return
+
+ echo
+ eerror "USE flag '${my_flag}' conflicts with these USE flag(s):"
+ eerror " ${my_present}"
+ eerror
+ eerror "You must disable these conflicting flags before you can emerge this package."
+ eerror "You can do this by disabling these flags in /etc/portage/package.use:"
+ eerror " =${CATEGORY}/${PN}-${PVR} ${my_remove}"
+ eerror
+ eerror "You could disable this flag instead in /etc/portage/package.use:"
+ eerror " =${CATEGORY}/${PN}-${PVR} -${my_flag}"
+ echo
+ die "Conflicting USE flags"
+}
+
+# @FUNCTION: confutils_use_depend_all
+# @USAGE: <enabled flag> <needed flag> [more needed flags ...]
+# @DESCRIPTION:
+# Use this function to automatically complain to the user if a USE flag depends
+# on another USE flag that hasn't been enabled
+confutils_use_depend_all() {
+ use $1 || return
+
+ local my_flag="$1" && shift
+ local my_missing=
+
+ for flag in "$@"; do
+ use ${flag} || my_missing="${my_missing} ${flag}"
+ done
+
+ [[ -z "${my_missing}" ]] && return
+
+ echo
+ eerror "USE flag '${my_flag}' needs these additional flag(s) set:"
+ eerror " ${my_missing}"
+ eerror
+ eerror "You can do this by enabling these flags in /etc/portage/package.use:"
+ eerror " =${CATEGORY}/${PN}-${PVR} ${my_missing}"
+ eerror
+ eerror "You could disable this flag instead in /etc/portage/package.use:"
+ eerror " =${CATEGORY}/${PN}-${PVR} -${my_flag}"
+ echo
+ die "Need missing USE flags"
+}
+
+# @FUNCTION: confutils_use_depend_any
+# @USAGE: <enabled flag> <needed flag> [more needed flags ...]
+# @DESCRIPTION:
+# Use this function to automatically complain to the user if a USE flag depends
+# on another USE flag that hasn't been enabled
+confutils_use_depend_any() {
+ use $1 || return
+
+ local my_flag="$1" && shift
+ local my_found=
+ local my_missing=
+
+ for flag in "$@"; do
+ if use ${flag}; then
+ my_found="${my_found} ${flag}"
+ else
+ my_missing="${my_missing} ${flag}"
+ fi
+ done
+
+ [[ -n "${my_found}" ]] && return
+
+ echo
+ eerror "USE flag '${my_flag}' needs one or more of these additional flag(s) set:"
+ eerror " ${my_missing}"
+ eerror
+ eerror "You can do this by enabling one of these flags in /etc/portage/package.use:"
+ eerror " =${CATEGORY}/${PN}-${PVR} ${my_missing}"
+ eerror
+ eerror "You could disable this flag instead in /etc/portage/package.use:"
+ eerror " =${CATEGORY}/${PN}-${PVR} -${my_flag}"
+ echo
+ die "Need missing USE flag(s)"
+}
+
+# @FUNCTION: confutils_use_depend_built_with_all
+# @USAGE: <enabled flag> <foreign> <needed flag> [more needed flags ...]
+# @DESCRIPTION:
+# Use this function to automatically complain to the user if a USE flag depends
+# on a USE flag in another package that hasn't been enabled
+confutils_use_depend_built_with_all() {
+ use $1 || return
+
+ local my_flag="$1" && shift
+ local foreign=$1 && shift
+ local required_flags="$@"
+
+ built_with_use ${foreign} ${required_flags} && return
+
+ echo
+ eerror "USE flag '${my_flag}' needs the following USE flags in ${foreign}:"
+ eerror " ${required_flags}"
+ eerror
+ eerror "You can do this by enabling these flags in /etc/portage/package.use:"
+ eerror " ${foreign} ${required_flags}"
+ eerror
+ eerror "You could disable this flag instead in /etc/portage/package.use:"
+ eerror " =${CATEGORY}/${PN}-${PVR} -${my_flag}"
+ echo
+ die "Missing USE flags in ${foreign}"
+}
+
+# @FUNCTION: confutils_use_depend_built_with_any
+# @USAGE: <enabled flag> <foreign> <needed flag> [more needed flags ...]
+# @DESCRIPTION:
+# Use this function to automatically complain to the user if a USE flag depends
+# on a USE flag in another package that hasn't been enabled
+confutils_use_depend_built_with_any() {
+ use $1 || return
+
+ local my_flag="$1" && shift
+ local foreign=$1 && shift
+ local required_flags="$@"
+ local success=0
+
+ for flag in ${required_flags}; do
+ built_with_use ${foreign} ${flag} && success=1
+ done
+
+ [[ ${success} -eq 1 ]] && return
+
+ echo
+ eerror "USE flag '${my_flag}' needs one or more of the following USE flags in ${foreign}:"
+ eerror " ${required_flags}"
+ eerror
+ eerror "You can do this by enabling these flags in /etc/portage/package.use:"
+ eerror " ${foreign} ${required_flags}"
+ eerror
+ eerror "You could disable this flag instead in /etc/portage/package.use:"
+ eerror " =${CATEGORY}/${PN}-${PVR} -${my_flag}"
+ echo
+ die "Missing USE flags in ${foreign}"
+}
+
+
+# internal function constructs the configure values for optional shared module
+# support and extra arguments
+_confutils_shared_suffix() {
+ local my_shared=
+
+ if [[ "$1" == "1" ]]; then
+ if [[ -n "${shared}" ]]; then
+ my_shared="${shared}"
+ if [[ -n "$2" ]]; then
+ my_shared="${my_shared},$2"
+ fi
+ elif [[ -n "$2" ]]; then
+ my_shared="=$2"
+ fi
+ else
+ if [[ -n "$2" ]]; then
+ my_shared="=$2"
+ fi
+ fi
+
+ echo "${my_shared}"
+}
+
+# @FUNCTION: enable_extension_disable
+# @USAGE: <extension> <flag> [msg]
+# @DESCRIPTION:
+# Use this function to disable an extension that is enabled by default. This is
+# provided for those rare configure scripts that don't support a --enable for
+# the corresponding --disable.
+enable_extension_disable() {
+ local my_msg=${3:-$1}
+
+ if use "$2" ; then
+ einfo " Enabling ${my_msg}"
+ else
+ my_conf="${my_conf} --disable-$1"
+ einfo " Disabling ${my_msg}"
+ fi
+}
+
+# @FUNCTION: enable_extension_enable
+# @USAGE: <extension> <flag> [shared] [extra conf] [msg]
+# @DESCRIPTION:
+# This function is like use_enable(), except that it knows about enabling
+# modules as shared libraries, and it supports passing additional data with the
+# switch.
+enable_extension_enable() {
+ local my_shared=$(_confutils_shared_suffix $3 $4)
+ local my_msg=${5:-$1}
+
+ if use $2; then
+ my_conf="${my_conf} --enable-${1}${my_shared}"
+ einfo " Enabling ${my_msg}"
+ else
+ my_conf="${my_conf} --disable-$1"
+ einfo " Disabling ${my_msg}"
+ fi
+}
+
+# @FUNCTION: enable_extension_enableonly
+# @USAGE: <extension> <flag> [shared] [extra conf] [msg]
+# @DESCRIPTION:
+# This function is like use_enable(), except that it knows about enabling
+# modules as shared libraries, and it supports passing additional data with the
+# switch. This function is provided for those rare configure scripts that support
+# --enable but not the corresponding --disable.
+enable_extension_enableonly() {
+ local my_shared=$(_confutils_shared_suffix $3 $4)
+ local my_msg=${5:-$1}
+
+ if use $2 ; then
+ my_conf="${my_conf} --enable-${1}${my_shared}"
+ einfo " Enabling ${my_msg}"
+ else
+ # note: we deliberately do *not* use a --disable switch here
+ einfo " Disabling ${my_msg}"
+ fi
+}
+
+# @FUNCTION: enable_extension_without
+# @USAGE: <extension> <flag> [msg]
+# @DESCRIPTION:
+# Use this function to disable an extension that is enabled by default. This
+# function is provided for those rare configure scripts that support --without
+# but not the corresponding --with
+enable_extension_without() {
+ local my_msg=${3:-$1}
+
+ if use "$2"; then
+ einfo " Enabling ${my_msg}"
+ else
+ my_conf="${my_conf} --without-$1"
+ einfo " Disabling ${my_msg}"
+ fi
+}
+
+# @FUNCTION: enable_extension_with
+# @USAGE: <extension> <flag> [shared] [extra conf] [msg]
+# @DESCRIPTION:
+# This function is like use_with(), except that it knows about enabling modules
+# as shared libraries, and it supports passing additional data with the switch.
+enable_extension_with() {
+ local my_shared=$(_confutils_shared_suffix $3 $4)
+ local my_msg=${5:-$1}
+
+ if use $2; then
+ my_conf="${my_conf} --with-${1}${my_shared}"
+ einfo " Enabling ${my_msg}"
+ else
+ my_conf="${my_conf} --without-$1"
+ einfo " Disabling ${my_msg}"
+ fi
+}
+
+# @FUNCTION: enable_extension_withonly
+# @USAGE: <extension> <flag> [shared] [extra conf] [msg]
+# @DESCRIPTION:
+# This function is like use_with(), except that it knows about enabling modules
+# as shared libraries, and it supports passing additional data with the switch.
+# This function is provided for those rare configure scripts that support --enable
+# but not the corresponding --disable.
+enable_extension_withonly() {
+ local my_shared=$(_confutils_shared_suffix $3 $4)
+ local my_msg=${5:-$1}
+
+ if use $2; then
+ my_conf="${my_conf} --with-${1}${my_shared}"
+ einfo " Enabling ${my_msg}"
+ else
+ # note: we deliberately do *not* use a --without switch here
+ einfo " Disabling ${my_msg}"
+ fi
+}
+
+# @FUNCTION: enable_extension_enable_built_with
+# @USAGE: <foreign> <flag> <extension> [shared] [extra conf] [msg]
+# @DESCRIPTION:
+# This function is like enable_extension_enable(), except that it
+# enables/disables modules based on a USE flag in a foreign package.
+enable_extension_enable_built_with() {
+ local my_shared=$(_confutils_shared_suffix $4 $5)
+ local my_msg=${6:-$3}
+
+ if built_with_use $1 $2; then
+ my_conf="${my_conf} --enable-${3}${my_shared}"
+ einfo " Enabling ${my_msg}"
+ else
+ my_conf="${my_conf} --disable-$3"
+ einfo " Disabling ${my_msg}"
+ fi
+}
+
+# @FUNCTION: enable_extension_with_built_with ()
+# @USAGE: <foreign> <flag> <extension> [shared] [extra conf] [msg]
+# @DESCRIPTION:
+# This function is like enable_extension_with(), except that it
+# enables/disables modules based on a USE flag in a foreign package.
+enable_extension_with_built_with() {
+ # legacy workaround
+ if [[ "$4" != "0" && "$4" != "1" ]]; then
+ enable_extension_with_built_with "$1" "$2" "$3" 0 "$4" "$5"
+ return
+ fi
+
+ local my_shared=$(_confutils_shared_suffix $4 $5)
+ local my_msg=${6:-$3}
+
+ if built_with_use $1 $2; then
+ my_conf="${my_conf} --with-${3}${my_shared}"
+ einfo " Enabling ${my_msg}"
+ else
+ my_conf="${my_conf} --disable-$3"
+ einfo " Disabling ${my_msg}"
+ fi
+}
diff --git a/eclass/cron.eclass b/eclass/cron.eclass
new file mode 100644
index 00000000000..1d97df3f73c
--- /dev/null
+++ b/eclass/cron.eclass
@@ -0,0 +1,161 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @ECLASS: cron
+# @MAINTAINER:
+# cron-bugs@gentoo.org
+# @AUTHOR:
+# Original Author: Aaron Walker <ka0ttic@gentoo.org>
+# @BLURB: Some functions for cron
+# @DESCRIPTION:
+# Purpose: The main motivation for this eclass was to simplify
+# the jungle known as src_install() in cron ebuilds. Using these
+# functions also ensures that permissions are *always* reset,
+# preventing the accidental installation of files with wrong perms.
+#
+# NOTE on defaults: the default settings in the below functions were
+# chosen based on the most common setting among cron ebuilds.
+#
+# Please assign any bugs regarding this eclass to cron-bugs@gentoo.org.
+
+inherit eutils flag-o-matic
+
+EXPORT_FUNCTIONS pkg_postinst
+
+SLOT="0"
+
+DEPEND=">=sys-apps/sed-4.0.5"
+
+RDEPEND=">=sys-process/cronbase-0.3.2"
+for pn in vixie-cron bcron cronie dcron fcron; do
+ [[ ${pn} == "${PN}" ]] || RDEPEND="${RDEPEND} !sys-process/${pn}"
+done
+
+# @FUNCTION: docrondir
+# @USAGE: [ dir ] [ perms ]
+# @DESCRIPTION:
+# Creates crontab directory
+#
+# Both arguments are optional. Everything after 'dir' is considered
+# the permissions (same format as insopts).
+#
+# ex: docrondir /some/dir -m 0770 -o root -g cron
+# docrondir /some/dir (uses default perms)
+# docrondir -m0700 (uses default dir)
+
+docrondir() {
+ # defaults
+ local perms="-m0750 -o root -g cron" dir="/var/spool/cron/crontabs"
+
+ if [[ -n $1 ]] ; then
+ case "$1" in
+ */*)
+ dir=$1
+ shift
+ [[ -n $1 ]] && perms="$@"
+ ;;
+ *)
+ perms="$@"
+ ;;
+ esac
+ fi
+
+ diropts ${perms}
+ keepdir ${dir}
+
+ # reset perms to default
+ diropts -m0755
+}
+
+# @FUNCTION: docron
+# @USAGE: [ exe ] [ perms ]
+# @DESCRIPTION:
+# Install cron executable
+#
+# Both arguments are optional.
+#
+# ex: docron -m 0700 -o root -g root ('exe' defaults to "cron")
+# docron crond -m 0110
+
+docron() {
+ local cron="cron" perms="-m 0750 -o root -g wheel"
+
+ if [[ -n $1 ]] ; then
+ case "$1" in
+ -*)
+ perms="$@"
+ ;;
+ *)
+ cron=$1
+ shift
+ [[ -n $1 ]] && perms="$@"
+ ;;
+ esac
+ fi
+
+ exeopts ${perms}
+ exeinto /usr/sbin
+ doexe ${cron} || die "failed to install ${cron}"
+
+ # reset perms to default
+ exeopts -m0755
+}
+
+# @FUNCTION: docrontab
+# @USAGE: [ exe ] [ perms ]
+# @DESCRIPTION:
+# Install crontab executable
+#
+# Uses same semantics as docron.
+
+docrontab() {
+ local crontab="crontab" perms="-m 4750 -o root -g cron"
+
+ if [[ -n $1 ]] ; then
+ case "$1" in
+ -*)
+ perms="$@"
+ ;;
+ *)
+ crontab=$1
+ shift
+ [[ -n $1 ]] && perms="$@"
+ ;;
+ esac
+ fi
+
+ exeopts ${perms}
+ exeinto /usr/bin
+ doexe ${crontab} || die "failed to install ${crontab}"
+
+ # reset perms to default
+ exeopts -m0755
+
+ # users expect /usr/bin/crontab to exist...
+ if [[ "${crontab##*/}" != "crontab" ]] ; then
+ dosym ${crontab##*/} /usr/bin/crontab || \
+ die "failed to create /usr/bin/crontab symlink"
+ fi
+}
+
+# @FUNCTION: cron_pkg_postinst
+# @DESCRIPTION:
+# Outputs a message about system crontabs
+# daemons that have a true system crontab set CRON_SYSTEM_CRONTAB="yes"
+cron_pkg_postinst() {
+ echo
+ # daemons that have a true system crontab set CRON_SYSTEM_CRONTAB="yes"
+ if [ "${CRON_SYSTEM_CRONTAB:-no}" != "yes" ] ; then
+ einfo "To activate /etc/cron.{hourly|daily|weekly|monthly} please run:"
+ einfo " crontab /etc/crontab"
+ einfo
+ einfo "!!! That will replace root's current crontab !!!"
+ einfo
+ fi
+
+ einfo "You may wish to read the Gentoo Linux Cron Guide, which can be"
+ einfo "found online at:"
+ einfo " http://www.gentoo.org/doc/en/cron-guide.xml"
+ echo
+}
diff --git a/eclass/cuda.eclass b/eclass/cuda.eclass
new file mode 100644
index 00000000000..932353e3309
--- /dev/null
+++ b/eclass/cuda.eclass
@@ -0,0 +1,134 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit flag-o-matic toolchain-funcs versionator
+
+# @ECLASS: cuda.eclass
+# @MAINTAINER:
+# Justin Lecher <jlec@gentoo.org>
+# @BLURB: Common functions for cuda packages
+# @DESCRIPTION:
+# This eclass contains functions to be used with cuda package. Currently it is
+# setting and/or sanitizing NVCCFLAGS, the compiler flags for nvcc. This is
+# automatically done and exported in src_prepare() or manually by calling
+# cuda_sanatize.
+# @EXAMPLE:
+# inherit cuda
+
+# @ECLASS-VARIABLE: NVCCFLAGS
+# @DESCRIPTION:
+# nvcc compiler flags (see nvcc --help), which should be used like
+# CFLAGS for c compiler
+: ${NVCCFLAGS:=-O2}
+
+# @ECLASS-VARIABLE: CUDA_VERBOSE
+# @DESCRIPTION:
+# Being verbose during compilation to see underlying commands
+: ${CUDA_VERBOSE:=true}
+
+# @FUNCTION: cuda_gccdir
+# @USAGE: [-f]
+# @RETURN: gcc bindir compatible with current cuda, optionally (-f) prefixed with "--compiler-bindir="
+# @DESCRIPTION:
+# Helper for determination of the latest gcc bindir supported by
+# then current nvidia cuda toolkit.
+#
+# Example:
+# @CODE
+# cuda_gccdir -f
+# -> --compiler-bindir="/usr/x86_64-pc-linux-gnu/gcc-bin/4.6.3"
+# @CODE
+cuda_gccdir() {
+ local gcc_bindir ver args="" flag ret
+
+ # Currently we only support the gnu compiler suite
+ if [[ $(tc-getCXX) != *g++* ]]; then
+ ewarn "Currently we only support the gnu compiler suite"
+ return 2
+ fi
+
+ while [ "$1" ]; do
+ case $1 in
+ -f)
+ flag="--compiler-bindir="
+ ;;
+ *)
+ ;;
+ esac
+ shift
+ done
+
+ if ! args=$(cuda-config -s); then
+ eerror "Could not execute cuda-config"
+ eerror "Make sure >=dev-util/nvidia-cuda-toolkit-4.2.9-r1 is installed"
+ die "cuda-config not found"
+ else
+ args=$(version_sort ${args})
+ if [[ -z ${args} ]]; then
+ die "Could not determine supported gcc versions from cuda-config"
+ fi
+ fi
+
+ for ver in ${args}; do
+ has_version "=sys-devel/gcc-${ver}*" && \
+ gcc_bindir="$(ls -d ${EPREFIX}/usr/*pc-linux-gnu/gcc-bin/${ver}* | tail -n 1)"
+ done
+
+ if [[ -n ${gcc_bindir} ]]; then
+ if [[ -n ${flag} ]]; then
+ ret="${flag}\"${gcc_bindir}\""
+ else
+ ret="${gcc_bindir}"
+ fi
+ echo ${ret}
+ return 0
+ else
+ eerror "Only gcc version(s) ${args} are supported,"
+ eerror "of which none is installed"
+ die "Only gcc version(s) ${args} are supported"
+ return 1
+ fi
+}
+
+# @FUNCTION: cuda_sanitize
+# @DESCRIPTION:
+# Correct NVCCFLAGS by adding the necessary reference to gcc bindir and
+# passing CXXFLAGS to underlying compiler without disturbing nvcc.
+cuda_sanitize() {
+ local rawldflags=$(raw-ldflags)
+ # Be verbose if wanted
+ [[ "${CUDA_VERBOSE}" == true ]] && NVCCFLAGS+=" -v"
+
+ # Tell nvcc where to find a compatible compiler
+ NVCCFLAGS+=" $(cuda_gccdir -f)"
+
+ # Tell nvcc which flags should be used for underlying C compiler
+ NVCCFLAGS+=" --compiler-options=\"${CXXFLAGS}\" --linker-options=\"${rawldflags// /,}\""
+
+ debug-print "Using ${NVCCFLAGS} for cuda"
+ export NVCCFLAGS
+}
+
+# @FUNCTION: cuda_pkg_setup
+# @DESCRIPTION:
+# Call cuda_src_prepare for EAPIs not supporting src_prepare
+cuda_pkg_setup() {
+ cuda_src_prepare
+}
+
+# @FUNCTION: cuda_src_prepare
+# @DESCRIPTION:
+# Sanitise and export NVCCFLAGS by default
+cuda_src_prepare() {
+ cuda_sanitize
+}
+
+
+case "${EAPI:-0}" in
+ 0|1)
+ EXPORT_FUNCTIONS pkg_setup ;;
+ 2|3|4|5)
+ EXPORT_FUNCTIONS src_prepare ;;
+ *) die "EAPI=${EAPI} is not supported" ;;
+esac
diff --git a/eclass/cvs.eclass b/eclass/cvs.eclass
new file mode 100644
index 00000000000..b9c8a818b6c
--- /dev/null
+++ b/eclass/cvs.eclass
@@ -0,0 +1,583 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @ECLASS: cvs.eclass
+# @MAINTAINER:
+# vapier@gentoo.org (and anyone who wants to help)
+# @BLURB: This eclass provides generic cvs fetching functions
+# @DESCRIPTION:
+# This eclass provides the generic cvs fetching functions. To use this from an
+# ebuild, set the ECLASS VARIABLES as specified below in your ebuild before
+# inheriting. Then either leave the default src_unpack or extend over
+# cvs_src_unpack. If you find that you need to call the cvs_* functions
+# directly, I'd be interested to hear about it.
+
+if [[ -z ${_CVS_ECLASS} ]]; then
+_CVS_ECLASS=1
+
+inherit eutils
+
+# TODO:
+
+# Implement more auth types (gserver?, kserver?)
+
+# Support additional remote shells with `ext' authentication (does
+# anyone actually need to use it with anything other than SSH?)
+
+
+# Users shouldn't change these settings! The ebuild/eclass inheriting
+# this eclass will take care of that. If you want to set the global
+# KDE cvs ebuilds' settings, see the comments in kde-source.eclass.
+
+# @ECLASS-VARIABLE: ECVS_CVS_COMPRESS
+# @DESCRIPTION:
+# Set the default compression level. Has no effect when ECVS_CVS_COMMAND
+# is defined by ebuild/user.
+: ${ECVS_CVS_COMPRESS:=-z1}
+
+# @ECLASS-VARIABLE: ECVS_CVS_OPTIONS
+# @DESCRIPTION:
+# Additional options to the cvs commands. Has no effect when ECVS_CVS_COMMAND
+# is defined by ebuild/user.
+: ${ECVS_CVS_OPTIONS:=-q -f}
+
+# @ECLASS-VARIABLE: ECVS_CVS_COMMAND
+# @DESCRIPTION:
+# CVS command to run
+#
+# You can set, for example, "cvs -t" for extensive debug information
+# on the cvs connection. The default of "cvs -q -f -z4" means to be
+# quiet, to disregard the ~/.cvsrc config file and to use maximum
+# compression.
+: ${ECVS_CVS_COMMAND:=cvs ${ECVS_CVS_OPTIONS} ${ECVS_CVS_COMPRESS}}
+
+# @ECLASS-VARIABLE: ECVS_UP_OPTS
+# @DESCRIPTION:
+# CVS options given after the cvs update command. Don't remove "-dP" or things
+# won't work.
+: ${ECVS_UP_OPTS:=-dP}
+
+# @ECLASS-VARIABLE: ECVS_CO_OPTS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# CVS options given after the cvs checkout command.
+
+# @ECLASS-VARIABLE: ECVS_OFFLINE
+# @DESCRIPTION:
+# Set this variable to a non-empty value to disable the automatic updating of
+# a CVS source tree. This is intended to be set outside the cvs source
+# tree by users.
+: ${ECVS_OFFLINE:=${EVCS_OFFLINE}}
+
+# @ECLASS-VARIABLE: ECVS_LOCAL
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# If this is set, the CVS module will be fetched non-recursively.
+# Refer to the information in the CVS man page regarding the -l
+# command option (not the -l global option).
+
+# @ECLASS-VARIABLE: ECVS_LOCALNAME
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Local name of checkout directory
+#
+# This is useful if the module on the server is called something
+# common like 'driver' or is nested deep in a tree, and you don't like
+# useless empty directories.
+#
+# WARNING: Set this only from within ebuilds! If set in your shell or
+# some such, things will break because the ebuild won't expect it and
+# have e.g. a wrong $S setting.
+
+# @ECLASS-VARIABLE: ECVS_TOP_DIR
+# @DESCRIPTION:
+# The directory under which CVS modules are checked out.
+: ${ECVS_TOP_DIR:="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/cvs-src"}
+
+# @ECLASS-VARIABLE: ECVS_SERVER
+# @DESCRIPTION:
+# CVS path
+#
+# The format is "server:/dir", e.g. "anoncvs.kde.org:/home/kde".
+# Remove the other parts of the full CVSROOT, which might look like
+# ":pserver:anonymous@anoncvs.kde.org:/home/kde"; this is generated
+# using other settings also.
+#
+# Set this to "offline" to disable fetching (i.e. to assume the module
+# is already checked out in ECVS_TOP_DIR).
+: ${ECVS_SERVER:="offline"}
+
+# @ECLASS-VARIABLE: ECVS_MODULE
+# @REQUIRED
+# @DESCRIPTION:
+# The name of the CVS module to be fetched
+#
+# This must be set when cvs_src_unpack is called. This can include
+# several directory levels, i.e. "foo/bar/baz"
+#[[ -z ${ECVS_MODULE} ]] && die "$ECLASS: error: ECVS_MODULE not set, cannot continue"
+
+# @ECLASS-VARIABLE: ECVS_DATE
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# The date of the checkout. See the -D date_spec option in the cvs
+# man page for more details.
+
+# @ECLASS-VARIABLE: ECVS_BRANCH
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# The name of the branch/tag to use
+#
+# The default is "HEAD". The following default _will_ reset your
+# branch checkout to head if used.
+#: ${ECVS_BRANCH:="HEAD"}
+
+# @ECLASS-VARIABLE: ECVS_AUTH
+# @DESCRIPTION:
+# Authentication method to use
+#
+# Possible values are "pserver" and "ext". If `ext' authentication is
+# used, the remote shell to use can be specified in CVS_RSH (SSH is
+# used by default). Currently, the only supported remote shell for
+# `ext' authentication is SSH.
+#
+# Armando Di Cianno <fafhrd@gentoo.org> 2004/09/27
+# - Added "no" as a server type, which uses no AUTH method, nor
+# does it login
+# e.g.
+# "cvs -danoncvs@savannah.gnu.org:/cvsroot/backbone co System"
+# ( from gnustep-apps/textedit )
+: ${ECVS_AUTH:="pserver"}
+
+# @ECLASS-VARIABLE: ECVS_USER
+# @DESCRIPTION:
+# Username to use for authentication on the remote server.
+: ${ECVS_USER:="anonymous"}
+
+# @ECLASS-VARIABLE: ECVS_PASS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Password to use for authentication on the remote server
+
+# @ECLASS-VARIABLE: ECVS_SSH_HOST_KEY
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# If SSH is used for `ext' authentication, use this variable to
+# specify the host key of the remote server. The format of the value
+# should be the same format that is used for the SSH known hosts file.
+#
+# WARNING: If a SSH host key is not specified using this variable, the
+# remote host key will not be verified.
+
+# @ECLASS-VARIABLE: ECVS_CLEAN
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Set this to get a clean copy when updating (passes the
+# -C option to cvs update)
+
+# @ECLASS-VARIABLE: ECVS_RUNAS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Specifies an alternate (non-root) user to use to run cvs. Currently
+# b0rked and wouldn't work with portage userpriv anyway without
+# special magic.
+
+# : ${ECVS_RUNAS:=$(whoami)}
+
+# add cvs to deps
+# ssh is used for ext auth
+# sudo is used to run as a specified user
+DEPEND="dev-vcs/cvs"
+
+[[ -n ${ECVS_RUNAS} ]] && DEPEND+=" app-admin/sudo"
+
+if [[ ${ECVS_AUTH} == "ext" ]] ; then
+ #default to ssh
+ [[ -z ${CVS_RSH} ]] && export CVS_RSH="ssh"
+ if [[ ${CVS_RSH} != "ssh" ]] ; then
+ die "Support for ext auth with clients other than ssh has not been implemented yet"
+ fi
+ DEPEND+=" net-misc/openssh"
+fi
+
+# called from cvs_src_unpack
+cvs_fetch() {
+ has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
+
+ # Make these options local variables so that the global values are
+ # not affected by modifications in this function.
+
+ local ECVS_COMMAND=${ECVS_COMMAND}
+ local ECVS_UP_OPTS=${ECVS_UP_OPTS}
+ local ECVS_CO_OPTS=${ECVS_CO_OPTS}
+
+ debug-print-function ${FUNCNAME} "$@"
+
+ # Update variables that are modified by ebuild parameters, which
+ # should be effective every time cvs_fetch is called, and not just
+ # every time cvs.eclass is inherited
+
+ # Handle parameter for local (non-recursive) fetching
+
+ if [[ -n ${ECVS_LOCAL} ]] ; then
+ ECVS_UP_OPTS+=" -l"
+ ECVS_CO_OPTS+=" -l"
+ fi
+
+ # Handle ECVS_BRANCH option
+ #
+ # Because CVS auto-switches branches, we just have to pass the
+ # correct -rBRANCH option when updating.
+
+ if [[ -n ${ECVS_BRANCH} ]] ; then
+ ECVS_UP_OPTS+=" -r${ECVS_BRANCH}"
+ ECVS_CO_OPTS+=" -r${ECVS_BRANCH}"
+ fi
+
+ # Handle ECVS_LOCALNAME, which specifies the local directory name
+ # to use. Note that the -d command option is not equivalent to
+ # the global -d option.
+
+ if [[ ${ECVS_LOCALNAME} != "${ECVS_MODULE}" ]] ; then
+ ECVS_CO_OPTS+=" -d ${ECVS_LOCALNAME}"
+ fi
+
+ if [[ -n ${ECVS_CLEAN} ]] ; then
+ ECVS_UP_OPTS+=" -C"
+ fi
+
+ if [[ -n ${ECVS_DATE} ]] ; then
+ ECVS_CO_OPTS+=" -D ${ECVS_DATE}"
+ ECVS_UP_OPTS+=" -D ${ECVS_DATE}"
+ fi
+
+ # It would be easiest to always be in "run-as mode", logic-wise,
+ # if sudo didn't ask for a password even when sudo'ing to `whoami`.
+
+ if [[ -z ${ECVS_RUNAS} ]] ; then
+ run=""
+ else
+ run="sudo -u ${ECVS_RUNAS}"
+ fi
+
+ # Create the top dir if needed
+
+ if [[ ! -d ${ECVS_TOP_DIR} ]] ; then
+ # Note that the addwrite statements in this block are only
+ # there to allow creating ECVS_TOP_DIR; we allow writing
+ # inside it separately.
+
+ # This is because it's simpler than trying to find out the
+ # parent path of the directory, which would need to be the
+ # real path and not a symlink for things to work (so we can't
+ # just remove the last path element in the string)
+
+ debug-print "${FUNCNAME}: checkout mode. creating cvs directory"
+ addwrite /foobar
+ addwrite /
+ ${run} mkdir -p "/${ECVS_TOP_DIR}"
+ export SANDBOX_WRITE="${SANDBOX_WRITE//:\/foobar:\/}"
+ fi
+
+ # In case ECVS_TOP_DIR is a symlink to a dir, get the real path,
+ # otherwise addwrite() doesn't work.
+
+ cd -P "${ECVS_TOP_DIR}" >/dev/null
+ ECVS_TOP_DIR=$(pwd)
+
+ # Disable the sandbox for this dir
+ addwrite "${ECVS_TOP_DIR}"
+
+ # Chown the directory and all of its contents
+ if [[ -n ${ECVS_RUNAS} ]] ; then
+ ${run} chown -R "${ECVS_RUNAS}" "/${ECVS_TOP_DIR}"
+ fi
+
+ # Determine the CVS command mode (checkout or update)
+ if [[ ! -d ${ECVS_TOP_DIR}/${ECVS_LOCALNAME}/CVS ]] ; then
+ mode=checkout
+ else
+ mode=update
+ fi
+
+ # Our server string (i.e. CVSROOT) without the password so it can
+ # be put in Root
+ local connection="${ECVS_AUTH}"
+ if [[ ${ECVS_AUTH} == "no" ]] ; then
+ local server="${ECVS_USER}@${ECVS_SERVER}"
+ else
+ [[ -n ${ECVS_PROXY} ]] && connection+=";proxy=${ECVS_PROXY}"
+ [[ -n ${ECVS_PROXY_PORT} ]] && connection+=";proxyport=${ECVS_PROXY_PORT}"
+ local server=":${connection}:${ECVS_USER}@${ECVS_SERVER}"
+ fi
+
+ # Switch servers automagically if needed
+ if [[ ${mode} == "update" ]] ; then
+ cd "/${ECVS_TOP_DIR}/${ECVS_LOCALNAME}"
+ local oldserver=$(${run} cat CVS/Root)
+ if [[ ${server} != "${oldserver}" ]] ; then
+ einfo "Changing the CVS server from ${oldserver} to ${server}:"
+ debug-print "${FUNCNAME}: Changing the CVS server from ${oldserver} to ${server}:"
+
+ einfo "Searching for CVS directories ..."
+ local cvsdirs=$(${run} find . -iname CVS -print)
+ debug-print "${FUNCNAME}: CVS directories found:"
+ debug-print "${cvsdirs}"
+
+ einfo "Modifying CVS directories ..."
+ local x
+ for x in ${cvsdirs} ; do
+ debug-print "In ${x}"
+ ${run} echo "${server}" > "${x}/Root"
+ done
+ fi
+ fi
+
+ # Prepare a cvspass file just for this session, we don't want to
+ # mess with ~/.cvspass
+ touch "${T}/cvspass"
+ export CVS_PASSFILE="${T}/cvspass"
+ if [[ -n ${ECVS_RUNAS} ]] ; then
+ chown "${ECVS_RUNAS}" "${T}/cvspass"
+ fi
+
+ # The server string with the password in it, for login (only used for pserver)
+ cvsroot_pass=":${connection}:${ECVS_USER}:${ECVS_PASS}@${ECVS_SERVER}"
+
+ # Ditto without the password, for checkout/update after login, so
+ # that the CVS/Root files don't contain the password in plaintext
+ if [[ ${ECVS_AUTH} == "no" ]] ; then
+ cvsroot_nopass="${ECVS_USER}@${ECVS_SERVER}"
+ else
+ cvsroot_nopass=":${connection}:${ECVS_USER}@${ECVS_SERVER}"
+ fi
+
+ # Commands to run
+ cmdlogin="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_pass}\" login"
+ cmdupdate="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_nopass}\" update ${ECVS_UP_OPTS} ${ECVS_LOCALNAME}"
+ cmdcheckout="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_nopass}\" checkout ${ECVS_CO_OPTS} ${ECVS_MODULE}"
+
+ # Execute commands
+
+ cd "${ECVS_TOP_DIR}"
+ if [[ ${ECVS_AUTH} == "pserver" ]] ; then
+ einfo "Running ${cmdlogin}"
+ eval ${cmdlogin} || die "cvs login command failed"
+ if [[ ${mode} == "update" ]] ; then
+ einfo "Running ${cmdupdate}"
+ eval ${cmdupdate} || die "cvs update command failed"
+ elif [[ ${mode} == "checkout" ]] ; then
+ einfo "Running ${cmdcheckout}"
+ eval ${cmdcheckout} || die "cvs checkout command failed"
+ fi
+ elif [[ ${ECVS_AUTH} == "ext" || ${ECVS_AUTH} == "no" ]] ; then
+ # Hack to support SSH password authentication
+
+ # Backup environment variable values
+ local CVS_ECLASS_ORIG_CVS_RSH="${CVS_RSH}"
+
+ if [[ ${SSH_ASKPASS+set} == "set" ]] ; then
+ local CVS_ECLASS_ORIG_SSH_ASKPASS="${SSH_ASKPASS}"
+ else
+ unset CVS_ECLASS_ORIG_SSH_ASKPASS
+ fi
+
+ if [[ ${DISPLAY+set} == "set" ]] ; then
+ local CVS_ECLASS_ORIG_DISPLAY="${DISPLAY}"
+ else
+ unset CVS_ECLASS_ORIG_DISPLAY
+ fi
+
+ if [[ ${CVS_RSH} == "ssh" ]] ; then
+ # Force SSH to use SSH_ASKPASS by creating python wrapper
+
+ export CVS_RSH="${T}/cvs_sshwrapper"
+ cat > "${CVS_RSH}"<<EOF
+#!${EPREFIX}/usr/bin/python
+import fcntl
+import os
+import sys
+try:
+ fd = os.open('/dev/tty', 2)
+ TIOCNOTTY=0x5422
+ try:
+ fcntl.ioctl(fd, TIOCNOTTY)
+ except:
+ pass
+ os.close(fd)
+except:
+ pass
+newarglist = sys.argv[:]
+EOF
+
+ # disable X11 forwarding which causes .xauth access violations
+ # - 20041205 Armando Di Cianno <fafhrd@gentoo.org>
+ echo "newarglist.insert(1, '-oClearAllForwardings=yes')" \
+ >> "${CVS_RSH}"
+ echo "newarglist.insert(1, '-oForwardX11=no')" \
+ >> "${CVS_RSH}"
+
+ # Handle SSH host key checking
+
+ local CVS_ECLASS_KNOWN_HOSTS="${T}/cvs_ssh_known_hosts"
+ echo "newarglist.insert(1, '-oUserKnownHostsFile=${CVS_ECLASS_KNOWN_HOSTS}')" \
+ >> "${CVS_RSH}"
+
+ if [[ -z ${ECVS_SSH_HOST_KEY} ]] ; then
+ ewarn "Warning: The SSH host key of the remote server will not be verified."
+ einfo "A temporary known hosts list will be used."
+ local CVS_ECLASS_STRICT_HOST_CHECKING="no"
+ touch "${CVS_ECLASS_KNOWN_HOSTS}"
+ else
+ local CVS_ECLASS_STRICT_HOST_CHECKING="yes"
+ echo "${ECVS_SSH_HOST_KEY}" > "${CVS_ECLASS_KNOWN_HOSTS}"
+ fi
+
+ echo -n "newarglist.insert(1, '-oStrictHostKeyChecking=" \
+ >> "${CVS_RSH}"
+ echo "${CVS_ECLASS_STRICT_HOST_CHECKING}')" \
+ >> "${CVS_RSH}"
+ echo "os.execv('${EPREFIX}/usr/bin/ssh', newarglist)" \
+ >> "${CVS_RSH}"
+
+ chmod a+x "${CVS_RSH}"
+
+ # Make sure DISPLAY is set (SSH will not use SSH_ASKPASS
+ # if DISPLAY is not set)
+
+ : ${DISPLAY:="DISPLAY"}
+ export DISPLAY
+
+ # Create a dummy executable to echo ${ECVS_PASS}
+
+ export SSH_ASKPASS="${T}/cvs_sshechopass"
+ if [[ ${ECVS_AUTH} != "no" ]] ; then
+ echo -en "#!/bin/bash\necho \"${ECVS_PASS}\"\n" \
+ > "${SSH_ASKPASS}"
+ else
+ echo -en "#!/bin/bash\nreturn\n" \
+ > "${SSH_ASKPASS}"
+ fi
+ chmod a+x "${SSH_ASKPASS}"
+ fi
+
+ if [[ ${mode} == "update" ]] ; then
+ einfo "Running ${cmdupdate}"
+ eval ${cmdupdate} || die "cvs update command failed"
+ elif [[ ${mode} == "checkout" ]] ; then
+ einfo "Running ${cmdcheckout}"
+ eval ${cmdcheckout} || die "cvs checkout command failed"
+ fi
+
+ # Restore environment variable values
+ export CVS_RSH="${CVS_ECLASS_ORIG_CVS_RSH}"
+ if [[ ${CVS_ECLASS_ORIG_SSH_ASKPASS+set} == "set" ]] ; then
+ export SSH_ASKPASS="${CVS_ECLASS_ORIG_SSH_ASKPASS}"
+ else
+ unset SSH_ASKPASS
+ fi
+
+ if [[ ${CVS_ECLASS_ORIG_DISPLAY+set} == "set" ]] ; then
+ export DISPLAY="${CVS_ECLASS_ORIG_DISPLAY}"
+ else
+ unset DISPLAY
+ fi
+ fi
+
+ # Restore ownership. Not sure why this is needed, but someone
+ # added it in the orig ECVS_RUNAS stuff.
+ if [[ -n ${ECVS_RUNAS} ]] ; then
+ chown $(whoami) "${T}/cvspass"
+ fi
+
+}
+
+# @FUNCTION: cvs_src_unpack
+# @DESCRIPTION:
+# The cvs src_unpack function, which will be exported
+cvs_src_unpack() {
+
+ debug-print-function ${FUNCNAME} "$@"
+
+ debug-print "${FUNCNAME}: init:
+ ECVS_CVS_COMMAND=${ECVS_CVS_COMMAND}
+ ECVS_UP_OPTS=${ECVS_UP_OPTS}
+ ECVS_CO_OPTS=${ECVS_CO_OPTS}
+ ECVS_TOP_DIR=${ECVS_TOP_DIR}
+ ECVS_SERVER=${ECVS_SERVER}
+ ECVS_USER=${ECVS_USER}
+ ECVS_PASS=${ECVS_PASS}
+ ECVS_MODULE=${ECVS_MODULE}
+ ECVS_LOCAL=${ECVS_LOCAL}
+ ECVS_RUNAS=${ECVS_RUNAS}
+ ECVS_LOCALNAME=${ECVS_LOCALNAME}"
+
+ [[ -z ${ECVS_MODULE} ]] && die "ERROR: CVS module not set, cannot continue."
+
+ local ECVS_LOCALNAME=${ECVS_LOCALNAME:-${ECVS_MODULE}}
+
+ local sanitized_pn=$(echo "${PN}" | LC_ALL=C sed -e 's:[^A-Za-z0-9_]:_:g')
+ local offline_pkg_var="ECVS_OFFLINE_${sanitized_pn}"
+ if [[ -n ${!offline_pkg_var}${ECVS_OFFLINE} ]] || [[ ${ECVS_SERVER} == "offline" ]] ; then
+ # We're not required to fetch anything; the module already
+ # exists and shouldn't be updated.
+ if [[ -d ${ECVS_TOP_DIR}/${ECVS_LOCALNAME} ]] ; then
+ debug-print "${FUNCNAME}: offline mode"
+ else
+ debug-print "${FUNCNAME}: Offline mode specified but directory ${ECVS_TOP_DIR}/${ECVS_LOCALNAME} not found, exiting with error"
+ die "ERROR: Offline mode specified, but directory ${ECVS_TOP_DIR}/${ECVS_LOCALNAME} not found. Aborting."
+ fi
+ elif [[ -n ${ECVS_SERVER} ]] ; then # ECVS_SERVER!=offline --> real fetching mode
+ einfo "Fetching CVS module ${ECVS_MODULE} into ${ECVS_TOP_DIR} ..."
+ cvs_fetch
+ else # ECVS_SERVER not set
+ die "ERROR: CVS server not specified, cannot continue."
+ fi
+
+ einfo "Copying ${ECVS_MODULE} from ${ECVS_TOP_DIR} ..."
+ debug-print "Copying module ${ECVS_MODULE} local_mode=${ECVS_LOCAL} from ${ECVS_TOP_DIR} ..."
+
+ # This is probably redundant, but best to make sure.
+ mkdir -p "${WORKDIR}/${ECVS_LOCALNAME}"
+
+ if [[ -n ${ECVS_LOCAL} ]] ; then
+ cp -f "${ECVS_TOP_DIR}/${ECVS_LOCALNAME}"/* "${WORKDIR}/${ECVS_LOCALNAME}"
+ else
+ cp -Rf "${ECVS_TOP_DIR}/${ECVS_LOCALNAME}" "${WORKDIR}/${ECVS_LOCALNAME}/.."
+ fi
+
+ # Not exactly perfect, but should be pretty close #333773
+ export ECVS_VERSION=$(
+ find "${ECVS_TOP_DIR}/${ECVS_LOCALNAME}/" -ipath '*/CVS/Entries' -exec cat {} + | \
+ LC_ALL=C sort | \
+ sha1sum | \
+ awk '{print $1}'
+ )
+
+ # If the directory is empty, remove it; empty directories cannot
+ # exist in cvs. This happens when, for example, kde-source
+ # requests module/doc/subdir which doesn't exist. Still create
+ # the empty directory in workdir though.
+ if [[ $(ls -A "${ECVS_TOP_DIR}/${ECVS_LOCALNAME}") == "CVS" ]] ; then
+ debug-print "${FUNCNAME}: removing empty CVS directory ${ECVS_LOCALNAME}"
+ rm -rf "${ECVS_TOP_DIR}/${ECVS_LOCALNAME}"
+ fi
+
+ # Implement some of base_src_unpack's functionality; note however
+ # that base.eclass may not have been inherited!
+ if [[ -n ${PATCHES} ]] ; then
+ debug-print "${FUNCNAME}: PATCHES=${PATCHES,} S=${S}, autopatching"
+ cd "${S}"
+ epatch ${PATCHES}
+ # Make sure we don't try to apply patches more than once,
+ # since cvs_src_unpack is usually called several times from
+ # e.g. kde-source_src_unpack
+ export PATCHES=""
+ fi
+
+ einfo "CVS module ${ECVS_MODULE} is now in ${WORKDIR}"
+}
+
+EXPORT_FUNCTIONS src_unpack
+
+fi
diff --git a/eclass/darcs.eclass b/eclass/darcs.eclass
new file mode 100644
index 00000000000..1fc1b28b052
--- /dev/null
+++ b/eclass/darcs.eclass
@@ -0,0 +1,205 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @ECLASS: darcs.eclass
+# @MAINTAINER:
+# "Gentoo's Haskell Language team" <haskell@gentoo.org>
+# Sergei Trofimovich <slyfox@gentoo.org>
+# @AUTHOR:
+# Original Author: Jeffrey Yasskin <jyasskin@mail.utexas.edu>
+# <rphillips@gentoo.org> (tla eclass author)
+# Andres Loeh <kosmikus@gentoo.org> (darcs.eclass author)
+# Alexander Vershilov <alexander.vershilov@gmail.com> (various contributions)
+# @BLURB: This eclass provides functions for fetch and unpack darcs repositories
+# @DESCRIPTION:
+# This eclass provides the generic darcs fetching functions.
+#
+# Define the EDARCS_REPOSITORY variable at least.
+# The ${S} variable is set to ${WORKDIR}/${P}.
+
+# TODO:
+
+# support for tags
+
+inherit eutils # eshopts_{push,pop}
+
+# Don't download anything other than the darcs repository
+SRC_URI=""
+
+# You shouldn't change these settings yourself! The ebuild/eclass inheriting
+# this eclass will take care of that.
+
+# --- begin ebuild-configurable settings
+
+# darcs command to run
+# @ECLASS-VARIABLE: EDARCS_DARCS_CMD
+# @DESCRIPTION:
+# Path to darcs binary.
+: ${EDARCS_DARCS_CMD:=darcs}
+
+# darcs commands with command-specific options
+
+# @ECLASS-VARIABLE: EDARCS_GET_CMD
+# @DESCRIPTION:
+# First fetch darcs command.
+: ${EDARCS_GET_CMD:=get --lazy}
+
+# @ECLASS-VARIABLE: EDARCS_UPDATE_CMD
+# @DESCRIPTION:
+# Repo update darcs command.
+: ${EDARCS_UPDATE_CMD:=pull}
+
+# @ECLASS-VARIABLE: EDARCS_OPTIONS
+# @DESCRIPTION:
+# Options to pass to both the "get" and "update" commands
+: ${EDARCS_OPTIONS:=--set-scripts-executable}
+
+# @ECLASS-VARIABLE: EDARCS_TOP_DIR
+# @DESCRIPTION:
+# Where the darcs repositories are stored/accessed
+: ${EDARCS_TOP_DIR:=${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/darcs-src}
+
+# @ECLASS-VARIABLE: EDARCS_REPOSITORY
+# @DESCRIPTION:
+# The URI to the repository.
+: ${EDARCS_REPOSITORY:=}
+
+# @ECLASS-VARIABLE: EDARCS_OFFLINE
+# @DESCRIPTION:
+# Set this variable to a non-empty value to disable the automatic updating of
+# a darcs repository. This is intended to be set outside the darcs source
+# tree by users. Defaults to EVCS_OFFLINE value.
+: ${EDARCS_OFFLINE:=${EVCS_OFFLINE}}
+
+# @ECLASS-VARIABLE: EDARCS_CLEAN
+# @DESCRIPTION:
+# Set this to something to get a clean copy when updating
+# (removes the working directory, then uses EDARCS_GET_CMD to
+# re-download it.)
+: ${EDARCS_CLEAN:=}
+
+# --- end ebuild-configurable settings ---
+
+DEPEND="dev-vcs/darcs
+ net-misc/rsync"
+
+# @FUNCTION: darcs_patchcount
+# @DESCRIPTION:
+# Internal function to determine amount of patches in repository.
+darcs_patchcount() {
+ set -- $(HOME="${EDARCS_TOP_DIR}" ${EDARCS_DARCS_CMD} show repo --repodir="${EDARCS_TOP_DIR}/${EDARCS_LOCALREPO}" | grep "Num Patches")
+ # handle string like: " Num Patches: 3860"
+ echo ${3}
+}
+
+# @FUNCTION: darcs_fetch
+# @DESCRIPTION:
+# Internal function is called from darcs_src_unpack
+darcs_fetch() {
+ # The local directory to store the repository (useful to ensure a
+ # unique local name); relative to EDARCS_TOP_DIR
+ [[ -z ${EDARCS_LOCALREPO} ]] && [[ -n ${EDARCS_REPOSITORY} ]] \
+ && EDARCS_LOCALREPO=${EDARCS_REPOSITORY%/} \
+ && EDARCS_LOCALREPO=${EDARCS_LOCALREPO##*/}
+
+ debug-print-function ${FUNCNAME} $*
+
+ if [[ -n ${EDARCS_CLEAN} ]]; then
+ addwrite "${EDARCS_TOP_DIR}/${EDARCS_LOCALREPO}"
+ rm -rf "${EDARCS_TOP_DIR}/${EDARCS_LOCALREPO}"
+ fi
+
+ # create the top dir if needed
+ if [[ ! -d ${EDARCS_TOP_DIR} ]]; then
+ # note that the addwrite statements in this block are only there to allow creating EDARCS_TOP_DIR;
+ # we've already allowed writing inside it
+ # this is because it's simpler than trying to find out the parent path of the directory, which
+ # would need to be the real path and not a symlink for things to work (so we can't just remove
+ # the last path element in the string)
+ debug-print "${FUNCNAME}: checkout mode. creating darcs directory"
+ addwrite /foobar
+ addwrite /
+ mkdir -p "${EDARCS_TOP_DIR}"
+ export SANDBOX_WRITE="${SANDBOX_WRITE//:\/foobar:\/}"
+ fi
+
+ # in case EDARCS_DARCS_DIR is a symlink to a dir, get the real
+ # dir's path, otherwise addwrite() doesn't work.
+ pushd .
+ cd -P "${EDARCS_TOP_DIR}" > /dev/null
+ EDARCS_TOP_DIR="`/bin/pwd`"
+
+ # disable the sandbox for this dir
+ addwrite "${EDARCS_TOP_DIR}"
+
+ # determine checkout or update mode and change to the right directory.
+ if [[ ! -d "${EDARCS_TOP_DIR}/${EDARCS_LOCALREPO}/_darcs" ]]; then
+ mode=get
+ cd "${EDARCS_TOP_DIR}"
+ else
+ mode=update
+ cd "${EDARCS_TOP_DIR}/${EDARCS_LOCALREPO}"
+ fi
+
+ # commands to run
+ local cmdget="${EDARCS_DARCS_CMD} ${EDARCS_GET_CMD} ${EDARCS_OPTIONS} --repo-name=${EDARCS_LOCALREPO} ${EDARCS_REPOSITORY}"
+ local cmdupdate="${EDARCS_DARCS_CMD} ${EDARCS_UPDATE_CMD} --all ${EDARCS_OPTIONS} ${EDARCS_REPOSITORY}"
+
+ if [[ ${mode} == "get" ]]; then
+ einfo "Running ${cmdget}"
+ HOME="${EDARCS_TOP_DIR}" ${cmdget} || die "darcs get command failed"
+ elif [[ -n ${EDARCS_OFFLINE} ]] ; then
+ einfo "Offline update"
+ elif [[ ${mode} == "update" ]]; then
+ einfo "Running ${cmdupdate}"
+ HOME="${EDARCS_TOP_DIR}" ${cmdupdate} || die "darcs update command failed"
+ fi
+
+ export EDARCS_PATCHCOUNT=$(darcs_patchcount)
+ einfo " patches in repo: ${EDARCS_PATCHCOUNT}"
+
+ popd
+}
+
+# @FUNCTION: darcs_src_unpack
+# @DESCRIPTION:
+# src_upack function
+darcs_src_unpack() {
+ # The local directory to store the repository (useful to ensure a
+ # unique local name); relative to EDARCS_TOP_DIR
+ [[ -z ${EDARCS_LOCALREPO} ]] && [[ -n ${EDARCS_REPOSITORY} ]] \
+ && EDARCS_LOCALREPO=${EDARCS_REPOSITORY%/} \
+ && EDARCS_LOCALREPO=${EDARCS_LOCALREPO##*/}
+
+ debug-print-function ${FUNCNAME} $*
+
+ debug-print "${FUNCNAME}: init:
+ EDARCS_DARCS_CMD=${EDARCS_DARCS_CMD}
+ EDARCS_GET_CMD=${EDARCS_GET_CMD}
+ EDARCS_UPDATE_CMD=${EDARCS_UPDATE_CMD}
+ EDARCS_OPTIONS=${EDARCS_OPTIONS}
+ EDARCS_TOP_DIR=${EDARCS_TOP_DIR}
+ EDARCS_REPOSITORY=${EDARCS_REPOSITORY}
+ EDARCS_LOCALREPO=${EDARCS_LOCALREPO}
+ EDARCS_CLEAN=${EDARCS_CLEAN}"
+
+ einfo "Fetching darcs repository ${EDARCS_REPOSITORY} into ${EDARCS_TOP_DIR}..."
+ darcs_fetch
+
+ einfo "Copying ${EDARCS_LOCALREPO} from ${EDARCS_TOP_DIR}..."
+ debug-print "Copying ${EDARCS_LOCALREPO} from ${EDARCS_TOP_DIR}..."
+
+ # probably redundant, but best to make sure
+ # Use ${WORKDIR}/${P} rather than ${S} so user can point ${S} to something inside.
+ mkdir -p "${WORKDIR}/${P}"
+
+ eshopts_push -s dotglob # get any dotfiles too.
+ rsync -rlpgo "${EDARCS_TOP_DIR}/${EDARCS_LOCALREPO}"/* "${WORKDIR}/${P}"
+ eshopts_pop
+
+ einfo "Darcs repository contents are now in ${WORKDIR}/${P}"
+
+}
+
+EXPORT_FUNCTIONS src_unpack
diff --git a/eclass/db-use.eclass b/eclass/db-use.eclass
new file mode 100644
index 00000000000..5a19b059984
--- /dev/null
+++ b/eclass/db-use.eclass
@@ -0,0 +1,116 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+# This is a common location for functions that aid the use of sys-libs/db
+#
+# Bugs: maintainer-needed@gentoo.org
+
+inherit versionator multilib
+
+#Convert a version to a db slot
+db_ver_to_slot() {
+ if [ $# -ne 1 ]; then
+ eerror "Function db_ver_to_slot needs one argument" >&2
+ eerror "args given:" >&2
+ for f in $@
+ do
+ eerror " - \"$@\"" >&2
+ done
+ return 1
+ fi
+ # 5.0.x uses 5.0 as slot value, so this replacement will break it;
+ # older sys-libs/db might have been using this but it's no longer
+ # the case, so make it work for latest rather than older stuff.
+ # echo -n "${1/.0/}"
+ echo -n "$1"
+}
+
+#Find the version that correspond to the given atom
+db_findver() {
+ has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
+ if [ $# -ne 1 ]; then
+ eerror "Function db_findver needs one argument" >&2
+ eerror "args given:" >&2
+ for f in $@
+ do
+ eerror " - \"$@\"" >&2
+ done
+ return 1
+ fi
+
+ PKG="$(best_version $1)"
+ VER="$(get_version_component_range 1-2 "${PKG/*db-/}")"
+ if [ -d "${EPREFIX}"/usr/include/db$(db_ver_to_slot "$VER") ]; then
+ #einfo "Found db version ${VER}" >&2
+ echo -n "$VER"
+ return 0
+ else
+ return 1
+ fi
+}
+
+# Get the include dir for berkeley db.
+# This function has two modes. Without any arguments it will give the best
+# version available. With arguments that form the versions of db packages
+# to test for, it will aim to find the library corresponding to it.
+
+db_includedir() {
+ has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
+ if [ $# -eq 0 ]; then
+ VER="$(db_findver sys-libs/db)" || return 1
+ VER="$(db_ver_to_slot "$VER")"
+ echo "include version ${VER}" >&2
+ if [ -d "${EPREFIX}/usr/include/db${VER}" ]; then
+ echo -n "${EPREFIX}/usr/include/db${VER}"
+ return 0
+ else
+ eerror "sys-libs/db package requested, but headers not found" >&2
+ return 1
+ fi
+ else
+ #arguments given
+ for x in $@
+ do
+ if VER=$(db_findver "=sys-libs/db-${x}*") &&
+ [ -d "${EPREFIX}/usr/include/db$(db_ver_to_slot $VER)" ]; then
+ echo -n "${EPREFIX}/usr/include/db$(db_ver_to_slot $VER)"
+ return 0
+ fi
+ done
+ eerror "No suitable db version found"
+ return 1
+ fi
+}
+
+
+# Get the library name for berkeley db. Something like "db-4.2" will be the
+# outcome. This function has two modes. Without any arguments it will give
+# the best version available. With arguments that form the versions of db
+# packages to test for, it will aim to find the library corresponding to it.
+
+db_libname() {
+ has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
+ if [ $# -eq 0 ]; then
+ VER="$(db_findver sys-libs/db)" || return 1
+ if [ -e "${EPREFIX}/usr/$(get_libdir)/libdb-${VER}$(get_libname)" ]; then
+ echo -n "db-${VER}"
+ return 0
+ else
+ eerror "sys-libs/db package requested, but library not found" >&2
+ return 1
+ fi
+ else
+ #arguments given
+ for x in $@
+ do
+ if VER=$(db_findver "=sys-libs/db-${x}*"); then
+ if [ -e "${EPREFIX}/usr/$(get_libdir)/libdb-${VER}$(get_libname)" ]; then
+ echo -n "db-${VER}"
+ return 0
+ fi
+ fi
+ done
+ eerror "No suitable db version found" >&2
+ return 1
+ fi
+}
diff --git a/eclass/db.eclass b/eclass/db.eclass
new file mode 100644
index 00000000000..b3c395902c7
--- /dev/null
+++ b/eclass/db.eclass
@@ -0,0 +1,188 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+# This is a common location for functions used in the sys-libs/db ebuilds
+#
+# Bugs: maintainer-needed@gentoo.org
+
+inherit eutils multilib
+
+IUSE="doc test examples"
+
+EXPORT_FUNCTIONS src_test
+
+DEPEND="test? ( >=dev-lang/tcl-8.4 )"
+
+RDEPEND=""
+
+db_fix_so() {
+ LIB="${ROOT}/usr/$(get_libdir)"
+
+ cd "${LIB}"
+
+ # first clean up old symlinks
+ find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*so' -exec rm \{} \;
+ find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*so.[23]' -exec rm \{} \;
+ find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*a' -exec rm \{} \;
+
+ # now rebuild all the correct ones
+ for ext in so a; do
+ for name in libdb libdb_{cxx,tcl,java,sql,stl}; do
+ target=`find . -maxdepth 1 -type f -name "${name}-*.${ext}" |sort -n |tail -n 1`
+ [ -n "${target}" ] && ln -sf ${target//.\//} ${name}.${ext}
+ done;
+ done;
+
+ # db[23] gets some extra-special stuff
+ if [ -f libdb1.so.2 ]; then
+ ln -sf libdb1.so.2 libdb.so.2
+ ln -sf libdb1.so.2 libdb1.so
+ ln -sf libdb1.so.2 libdb-1.so
+ fi
+ # what do we do if we ever get 3.3 ?
+ for i in libdb libdb_{cxx,tcl,java,sql,stl}; do
+ if [ -f $i-3.2.so ]; then
+ ln -sf $i-3.2.so $i-3.so
+ ln -sf $i-3.2.so $i.so.3
+ fi
+ done
+
+ # do the same for headers now
+ # but since there are only two of them, just overwrite them
+ cd "${ROOT}"/usr/include
+ target=`find . -maxdepth 1 -type d -name 'db[0-9]*' | sort -n |cut -d/ -f2- | tail -n1`
+ if [ -n "${target}" ] && [ -e "${target}/db.h" ] && ( ! [[ -e db.h ]] || [[ -h db.h ]] ); then
+ einfo "Creating db.h symlinks to ${target}"
+ ln -sf "${target}"/db.h .
+ ln -sf "${target}"/db_185.h .
+ elif [ ! -e "${target}/db.h" ]; then
+ if [ -n "${target}" ]; then
+ ewarn "Could not find ${target}/db.h"
+ elif [ -h db.h ]; then
+ einfo "Apparently you just removed the last instance of $PN. Removing the symlinks"
+ rm -f db.h db_185.h
+ fi
+ fi
+}
+
+db_src_install_doc() {
+ # not everybody wants this wad of documentation as it is primarily API docs
+ if use doc; then
+ dodir /usr/share/doc/${PF}/html
+ mv "${D}"/usr/docs/* "${D}"/usr/share/doc/${PF}/html/
+ rm -rf "${D}"/usr/docs
+ else
+ rm -rf "${D}"/usr/docs
+ fi
+
+ db_src_install_examples
+}
+
+db_src_install_examples() {
+ if use examples ; then
+ local langs="c cxx stl"
+ [[ "${IUSE/java}" != "${IUSE}" ]] \
+ && use java \
+ && langs="${langs} java"
+ for i in $langs ; do
+ destdir="/usr/share/doc/${PF}/"
+ src="${S}/../examples_${i}/"
+ if [ -f "${src}" ]; then
+ dodir "${destdir}"
+ cp -ra "${src}" "${D}${destdir}/"
+ fi
+ done
+ fi
+}
+
+db_src_install_usrbinslot() {
+ # slot all program names to avoid overwriting
+ for fname in "${D}"/usr/bin/db*
+ do
+ dn="$(dirname "${fname}")"
+ bn="$(basename "${fname}")"
+ bn="${bn/db/db${SLOT}}"
+ mv "${fname}" "${dn}/${bn}" || \
+ die "Failed to rename ${fname} to ${dn}/${bn}"
+ done
+}
+
+db_src_install_headerslot() {
+ # install all headers in a slotted location
+ dodir /usr/include/db${SLOT}
+ mv "${D}"/usr/include/*.h "${D}"/usr/include/db${SLOT}/
+}
+
+db_src_install_usrlibcleanup() {
+ LIB="${D}/usr/$(get_libdir)"
+ # Clean out the symlinks so that they will not be recorded in the
+ # contents (bug #60732)
+
+ if [ "${D}" = "" ]; then
+ die "Calling clean_links while \$D not defined"
+ fi
+
+ if [ -e "${LIB}"/libdb.a ] && [ ! -e "${LIB}"/libdb-${SLOT}.a ]; then
+ einfo "Moving libdb.a to a versioned name"
+ mv "${LIB}/libdb.a" "${LIB}/libdb-${SLOT}.a"
+ fi
+
+ if [ -e "${LIB}"/libdb_cxx.a ] && [ ! -e "${LIB}"/libdb_cxx-${SLOT}.a ]; then
+ einfo "Moving libdb_cxx.a to a versioned name"
+ mv "${LIB}/libdb_cxx.a" "${LIB}/libdb_cxx-${SLOT}.a"
+ fi
+
+ find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*so' -exec rm \{} \;
+ find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*so.[23]' -exec rm \{} \;
+ einfo "removing unversioned static archives"
+ find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*a' -exec rm \{} \;
+
+ rm -f \
+ "${D}"/usr/include/{db,db_185}.h \
+ "${LIB}"/libdb{,_{cxx,sql,stl,java,tcl}}.a
+}
+
+db_src_test() {
+ if [[ $UID -eq 0 ]]; then
+ M="You must run the testsuite as non-root, skipping"
+ ewarn "${M}"
+ elog "${M}"
+ return 0
+ fi
+
+ if use tcl; then
+ einfo "Running sys-libs/db testsuite"
+ ewarn "This can take 6+ hours on modern machines"
+ # Fix stuff that fails with relative paths, and upstream moving files
+ # around...
+ local test_parallel=''
+ for t in \
+ "${S}"/test/parallel.tcl \
+ "${S}"/../test/parallel.tcl \
+ "${S}"/test/tcl/parallel.tcl \
+ "${S}"/../test/tcl/parallel.tcl \
+ ; do
+ [[ -f "${t}" ]] && test_parallel="${t}" && break
+ done
+
+ sed -ri \
+ -e '/regsub .test_path ./s,(regsub),#\1,g' \
+ -e '/regsub .src_root ./s,(regsub),#\1,g' \
+ -e '/regsub .tcl_utils ./s,(regsub),#\1,g' \
+ "${test_parallel}"
+ cd "${S}"
+ for t in \
+ ../test/test.tcl \
+ ../test/tcl/test.tcl \
+ ; do
+ [[ -f "${t}" ]] && testbase="${t}" && break
+ done
+ echo "source ${t}" > testrunner.tcl
+ echo "run_parallel $(makeopts_jobs) run_std" >> testrunner.tcl
+
+ tclsh testrunner.tcl
+ egrep -qs '^FAIL' ALL.OUT* && die "Some tests failed, please see ${S}/ALL.OUT*"
+ else
+ eerror "You must have USE=tcl to run the sys-libs/db testsuite."
+ fi
+}
diff --git a/eclass/depend.apache.eclass b/eclass/depend.apache.eclass
new file mode 100644
index 00000000000..22a8216a02d
--- /dev/null
+++ b/eclass/depend.apache.eclass
@@ -0,0 +1,317 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @ECLASS: depend.apache.eclass
+# @MAINTAINER:
+# apache-devs@gentoo.org
+# @BLURB: Functions to allow ebuilds to depend on apache
+# @DESCRIPTION:
+# This eclass handles depending on apache in a sane way and provides information
+# about where certain binaries and configuration files are located.
+#
+# To make use of this eclass simply call one of the need/want_apache functions
+# described below. Make sure you use the need/want_apache call after you have
+# defined DEPEND and RDEPEND. Also note that you can not rely on the automatic
+# RDEPEND=DEPEND that portage does if you use this eclass.
+#
+# See Bug 107127 for more information.
+#
+# @EXAMPLE:
+#
+# Here is an example of an ebuild depending on apache:
+#
+# @CODE
+# DEPEND="virtual/Perl-CGI"
+# RDEPEND="${DEPEND}"
+# need_apache2
+# @CODE
+#
+# Another example which demonstrates non-standard IUSE options for optional
+# apache support:
+#
+# @CODE
+# DEPEND="server? ( virtual/Perl-CGI )"
+# RDEPEND="${DEPEND}"
+# want_apache2 server
+#
+# pkg_setup() {
+# depend.apache_pkg_setup server
+# }
+# @CODE
+
+inherit multilib
+
+# ==============================================================================
+# INTERNAL VARIABLES
+# ==============================================================================
+
+# @ECLASS-VARIABLE: APACHE_VERSION
+# @DESCRIPTION:
+# Stores the version of apache we are going to be ebuilding.
+# This variable is set by the want/need_apache functions.
+
+# @ECLASS-VARIABLE: APXS
+# @DESCRIPTION:
+# Path to the apxs tool.
+# This variable is set by the want/need_apache functions.
+
+# @ECLASS-VARIABLE: APACHE_BIN
+# @DESCRIPTION:
+# Path to the apache binary.
+# This variable is set by the want/need_apache functions.
+
+# @ECLASS-VARIABLE: APACHE_CTL
+# @DESCRIPTION:
+# Path to the apachectl tool.
+# This variable is set by the want/need_apache functions.
+
+# @ECLASS-VARIABLE: APACHE_BASEDIR
+# @DESCRIPTION:
+# Path to the server root directory.
+# This variable is set by the want/need_apache functions.
+
+# @ECLASS-VARIABLE: APACHE_CONFDIR
+# @DESCRIPTION:
+# Path to the configuration file directory.
+# This variable is set by the want/need_apache functions.
+
+# @ECLASS-VARIABLE: APACHE_MODULES_CONFDIR
+# @DESCRIPTION:
+# Path where module configuration files are kept.
+# This variable is set by the want/need_apache functions.
+
+# @ECLASS-VARIABLE: APACHE_VHOSTS_CONFDIR
+# @DESCRIPTION:
+# Path where virtual host configuration files are kept.
+# This variable is set by the want/need_apache functions.
+
+# @ECLASS-VARIABLE: APACHE_MODULESDIR
+# @DESCRIPTION:
+# Path where we install modules.
+# This variable is set by the want/need_apache functions.
+
+# @ECLASS-VARIABLE: APACHE_DEPEND
+# @DESCRIPTION:
+# Dependencies for Apache
+APACHE_DEPEND="www-servers/apache"
+
+# @ECLASS-VARIABLE: APACHE2_DEPEND
+# @DESCRIPTION:
+# Dependencies for Apache 2.x
+APACHE2_DEPEND="=www-servers/apache-2*"
+
+# @ECLASS-VARIABLE: APACHE2_2_DEPEND
+# @DESCRIPTION:
+# Dependencies for Apache 2.2.x
+APACHE2_2_DEPEND="=www-servers/apache-2.2*"
+
+# @ECLASS-VARIABLE: APACHE2_4_DEPEND
+# @DESCRIPTION:
+# Dependencies for Apache 2.4.x
+APACHE2_4_DEPEND="=www-servers/apache-2.4*"
+
+
+# ==============================================================================
+# INTERNAL FUNCTIONS
+# ==============================================================================
+
+_init_apache2() {
+ debug-print-function $FUNCNAME $*
+
+ # WARNING: Do not use these variables with anything that is put
+ # into the dependency cache (DEPEND/RDEPEND/etc)
+ APACHE_VERSION="2"
+ APXS="/usr/sbin/apxs2"
+ APACHE_BIN="/usr/sbin/apache2"
+ APACHE_CTL="/usr/sbin/apache2ctl"
+ APACHE_INCLUDEDIR="/usr/include/apache2"
+ APACHE_BASEDIR="/usr/$(get_libdir)/apache2"
+ APACHE_CONFDIR="/etc/apache2"
+ APACHE_MODULES_CONFDIR="${APACHE_CONFDIR}/modules.d"
+ APACHE_VHOSTS_CONFDIR="${APACHE_CONFDIR}/vhosts.d"
+ APACHE_MODULESDIR="${APACHE_BASEDIR}/modules"
+}
+
+_init_no_apache() {
+ debug-print-function $FUNCNAME $*
+ APACHE_VERSION="0"
+}
+
+# ==============================================================================
+# PUBLIC FUNCTIONS
+# ==============================================================================
+
+# @FUNCTION: depend.apache_pkg_setup
+# @USAGE: [myiuse]
+# @DESCRIPTION:
+# An ebuild calls this in pkg_setup() to initialize variables for optional
+# apache-2.x support. If the myiuse parameter is not given it defaults to
+# apache2.
+depend.apache_pkg_setup() {
+ debug-print-function $FUNCNAME $*
+
+ if [[ "${EBUILD_PHASE}" != "setup" ]]; then
+ die "$FUNCNAME() should be called in pkg_setup()"
+ fi
+
+ local myiuse=${1:-apache2}
+ if has ${myiuse} ${IUSE}; then
+ if use ${myiuse}; then
+ _init_apache2
+ else
+ _init_no_apache
+ fi
+ fi
+}
+
+# @FUNCTION: want_apache
+# @USAGE: [myiuse]
+# @DESCRIPTION:
+# An ebuild calls this to get the dependency information for optional apache
+# support. If the myiuse parameter is not given it defaults to apache2.
+# An ebuild should additionally call depend.apache_pkg_setup() in pkg_setup()
+# with the same myiuse parameter.
+want_apache() {
+ debug-print-function $FUNCNAME $*
+ want_apache2 "$@"
+}
+
+# @FUNCTION: want_apache2
+# @USAGE: [myiuse]
+# @DESCRIPTION:
+# An ebuild calls this to get the dependency information for optional apache-2.x
+# support. If the myiuse parameter is not given it defaults to apache2.
+# An ebuild should additionally call depend.apache_pkg_setup() in pkg_setup()
+# with the same myiuse parameter.
+want_apache2() {
+ debug-print-function $FUNCNAME $*
+
+ local myiuse=${1:-apache2}
+ IUSE="${IUSE} ${myiuse}"
+ DEPEND="${DEPEND} ${myiuse}? ( ${APACHE2_DEPEND} )"
+ RDEPEND="${RDEPEND} ${myiuse}? ( ${APACHE2_DEPEND} )"
+}
+
+# @FUNCTION: want_apache2_2
+# @USAGE: [myiuse]
+# @DESCRIPTION:
+# An ebuild calls this to get the dependency information for optional
+# apache-2.2.x support. If the myiuse parameter is not given it defaults to
+# apache2.
+# An ebuild should additionally call depend.apache_pkg_setup() in pkg_setup()
+# with the same myiuse parameter.
+want_apache2_2() {
+ debug-print-function $FUNCNAME $*
+
+ local myiuse=${1:-apache2}
+ IUSE="${IUSE} ${myiuse}"
+ DEPEND="${DEPEND} ${myiuse}? ( ${APACHE2_2_DEPEND} )"
+ RDEPEND="${RDEPEND} ${myiuse}? ( ${APACHE2_2_DEPEND} )"
+}
+
+# @FUNCTION: need_apache
+# @DESCRIPTION:
+# An ebuild calls this to get the dependency information for apache.
+need_apache() {
+ debug-print-function $FUNCNAME $*
+ need_apache2
+}
+
+# @FUNCTION: need_apache2
+# @DESCRIPTION:
+# An ebuild calls this to get the dependency information for apache-2.x.
+need_apache2() {
+ debug-print-function $FUNCNAME $*
+
+ DEPEND="${DEPEND} ${APACHE2_DEPEND}"
+ RDEPEND="${RDEPEND} ${APACHE2_DEPEND}"
+ _init_apache2
+}
+
+# @FUNCTION: need_apache2_2
+# @DESCRIPTION:
+# An ebuild calls this to get the dependency information for apache-2.2.x.
+need_apache2_2() {
+ debug-print-function $FUNCNAME $*
+
+ DEPEND="${DEPEND} ${APACHE2_2_DEPEND}"
+ RDEPEND="${RDEPEND} ${APACHE2_2_DEPEND}"
+ _init_apache2
+}
+
+# @FUNCTION: need_apache2_4
+# @DESCRIPTION:
+# An ebuild calls this to get the dependency information for apache-2.4.x.
+need_apache2_4() {
+ debug-print-function $FUNCNAME $*
+
+ DEPEND="${DEPEND} ${APACHE2_4_DEPEND}"
+ RDEPEND="${RDEPEND} ${APACHE2_4_DEPEND}"
+ _init_apache2
+}
+
+# @FUNCTION: has_apache
+# @DESCRIPTION:
+# An ebuild calls this to get runtime variables for an indirect apache
+# dependency without USE-flag, in which case want_apache does not work.
+# DO NOT call this function in global scope.
+has_apache() {
+ debug-print-function $FUNCNAME $*
+
+ if has_version '>=www-servers/apache-2'; then
+ _init_apache2
+ else
+ _init_no_apache
+ fi
+}
+
+# @FUNCTION: has_apache_threads
+# @USAGE: [myflag]
+# @DESCRIPTION:
+# An ebuild calls this to make sure thread-safety is enabled if apache has been
+# built with a threaded MPM. If the myflag parameter is not given it defaults to
+# threads.
+has_apache_threads() {
+ debug-print-function $FUNCNAME $*
+
+ if ! built_with_use www-servers/apache threads; then
+ return
+ fi
+
+ local myflag="${1:-threads}"
+
+ if ! use ${myflag}; then
+ echo
+ eerror "You need to enable USE flag '${myflag}' to build a thread-safe version"
+ eerror "of ${CATEGORY}/${PN} for use with www-servers/apache"
+ die "Need missing USE flag '${myflag}'"
+ fi
+}
+
+# @FUNCTION: has_apache_threads_in
+# @USAGE: <myforeign> [myflag]
+# @DESCRIPTION:
+# An ebuild calls this to make sure thread-safety is enabled in a foreign
+# package if apache has been built with a threaded MPM. If the myflag parameter
+# is not given it defaults to threads.
+has_apache_threads_in() {
+ debug-print-function $FUNCNAME $*
+
+ if ! built_with_use www-servers/apache threads; then
+ return
+ fi
+
+ local myforeign="$1"
+ local myflag="${2:-threads}"
+
+ if ! built_with_use ${myforeign} ${myflag}; then
+ echo
+ eerror "You need to enable USE flag '${myflag}' in ${myforeign} to"
+ eerror "build a thread-safe version of ${CATEGORY}/${PN} for use"
+ eerror "with www-servers/apache"
+ die "Need missing USE flag '${myflag}' in ${myforeign}"
+ fi
+}
+
+EXPORT_FUNCTIONS pkg_setup
diff --git a/eclass/depend.php.eclass b/eclass/depend.php.eclass
new file mode 100644
index 00000000000..c29cda22ca2
--- /dev/null
+++ b/eclass/depend.php.eclass
@@ -0,0 +1,258 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @DEAD
+# @ECLASS: depend.php.eclass
+# @MAINTAINER:
+# Gentoo PHP team <php-bugs@gentoo.org>
+# @AUTHOR:
+# Author: Stuart Herbert <stuart@gentoo.org>
+# Author: Luca Longinotti <chtekk@gentoo.org>
+# Author: Jakub Moc <jakub@gentoo.org> (documentation)
+# @BLURB: Functions to allow ebuilds to depend on php5 and check for specific features.
+# @DESCRIPTION:
+# This eclass provides functions that allow ebuilds to depend on php5 and check
+# for specific PHP features, SAPIs etc. Also provides dodoc-php wrapper to install
+# documentation for PHP packages to php-specific location.
+# This eclass is deprecated and is set to be removed 30 days after bug 552836 is resolved
+
+inherit eutils multilib
+
+# PHP5-only depend functions
+
+# @FUNCTION: need_php5
+# @DESCRIPTION:
+# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP5
+# (with any SAPI).
+need_php5() {
+ DEPEND="${DEPEND} =dev-lang/php-5*"
+ RDEPEND="${RDEPEND} =dev-lang/php-5*"
+ PHP_VERSION="5"
+ PHP_SHARED_CAT="php5"
+}
+
+# common settings go in here
+uses_php5() {
+ # cache this
+ libdir=$(get_libdir)
+
+ PHPIZE="/usr/${libdir}/php5/bin/phpize"
+ PHPCONFIG="/usr/${libdir}/php5/bin/php-config"
+ PHPCLI="/usr/${libdir}/php5/bin/php"
+ PHPCGI="/usr/${libdir}/php5/bin/php-cgi"
+ PHP_PKG="$(best_version =dev-lang/php-5*)"
+ PHPPREFIX="/usr/${libdir}/php5"
+ EXT_DIR="$(${PHPCONFIG} --extension-dir 2>/dev/null)"
+
+ einfo
+ einfo "Using ${PHP_PKG}"
+ einfo
+}
+
+# general PHP depend functions
+
+# @FUNCTION: need_php_httpd
+# @DESCRIPTION:
+# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP
+# (any version) with either cgi or apache2 SAPI.
+need_php_httpd() {
+ DEPEND="${DEPEND} virtual/httpd-php"
+ RDEPEND="${RDEPEND} virtual/httpd-php"
+}
+
+# @FUNCTION: need_php
+# @DESCRIPTION:
+# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP
+# (any version with any SAPI).
+need_php() {
+ DEPEND="${DEPEND} dev-lang/php"
+ RDEPEND="${RDEPEND} dev-lang/php"
+ PHP_SHARED_CAT="php"
+}
+
+# @FUNCTION: has_php
+# @DESCRIPTION:
+# Call this function from your pkg_setup, src_compile, src_install etc. if you
+# need to know which PHP version is being used and where the PHP binaries/data
+# are installed.
+has_php() {
+ # Detect which PHP version we have installed
+ if has_version '=dev-lang/php-5*' ; then
+ PHP_VERSION="5"
+ else
+ die "Unable to find an installed dev-lang/php package"
+ fi
+
+ # If we get here, then PHP_VERSION tells us which version of PHP we
+ # want to use
+ uses_php${PHP_VERSION}
+}
+
+# @FUNCTION: require_php_with_use
+# @USAGE: <list of USE flags>
+# @DESCRIPTION:
+# Call this function from pkg_setup if your package requires PHP compiled
+# with specific USE flags. Returns if all of the listed USE flags are enabled.
+# Dies if any of the listed USE flags are disabled.
+
+# @VARIABLE: PHPCHECKNODIE
+# @DESCRIPTION:
+# You can set PHPCHECKNODIE to non-empty value in your ebuild to chain multiple
+# require_php_with_(any)_use checks without making the ebuild die on every failure.
+# This is useful in cases when certain PHP features are only required if specific
+# USE flag(s) are enabled for that ebuild.
+# @CODE
+# Example:
+#
+# local flags="pcre session snmp sockets wddx"
+# use mysql && flags="${flags} mysql"
+# use postgres && flags="${flags} postgres"
+# if ! PHPCHECKNODIE="yes" require_php_with_use ${flags} \
+# || ! PHPCHECKNODIE="yes" require_php_with_any_use gd gd-external ; then
+# die "Re-install ${PHP_PKG} with ${flags} and either gd or gd-external"
+# fi
+# @CODE
+require_php_with_use() {
+ has_php
+
+ local missing_use=""
+ local x
+
+ einfo "Checking for required PHP feature(s) ..."
+
+ for x in $@ ; do
+ case $x in
+ pcre|spl|reflection|mhash)
+ eqawarn "require_php_with_use MUST NOT check for the pcre, spl, mhash or reflection USE flag."
+ eqawarn "These USE flags are removed from >=dev-lang/php-5.3 and your ebuild will break"
+ eqawarn "if you check the USE flags against PHP 5.3 ebuilds."
+ eqawarn "Please use USE dependencies from EAPI 2 instead"
+ ;;
+ esac
+
+ if ! built_with_use =${PHP_PKG} ${x} ; then
+ einfo " Discovered missing USE flag: ${x}"
+ missing_use="${missing_use} ${x}"
+ fi
+ done
+
+ if [[ -z "${missing_use}" ]] ; then
+ if [[ -z "${PHPCHECKNODIE}" ]] ; then
+ return
+ else
+ return 0
+ fi
+ fi
+
+ if [[ -z "${PHPCHECKNODIE}" ]] ; then
+ eerror
+ eerror "${PHP_PKG} needs to be re-installed with all of the following"
+ eerror "USE flags enabled:"
+ eerror
+ eerror " $@"
+ eerror
+ die "Missing PHP USE flags found"
+ else
+ return 1
+ fi
+}
+
+
+# ========================================================================
+# require_*() functions
+#
+# These functions die() if PHP was built without the required features
+# ========================================================================
+
+# @FUNCTION: require_php_cgi
+# @DESCRIPTION:
+# Determines which installed PHP version has the CGI SAPI enabled.
+# Useful for anything which needs to run PHP scripts depending on the CGI SAPI.
+# @RETURN: die if feature is missing
+require_php_cgi() {
+ # If PHP_PKG is set, then we have remembered our PHP settings
+ # from last time
+ if [[ -n ${PHP_PKG} ]] ; then
+ return
+ fi
+
+ local PHP_PACKAGE_FOUND=""
+
+ if has_version '=dev-lang/php-5*' ; then
+ PHP_PACKAGE_FOUND="1"
+ pkg="$(best_version '=dev-lang/php-5*')"
+ if built_with_use =${pkg} cgi ; then
+ PHP_VERSION="5"
+ fi
+ fi
+
+ if [[ -z ${PHP_PACKAGE_FOUND} ]] ; then
+ die "Unable to find an installed dev-lang/php package"
+ fi
+
+ if [[ -z ${PHP_VERSION} ]] ; then
+ die "No PHP CGI installed. Re-emerge dev-lang/php with USE=cgi."
+ fi
+
+ # If we get here, then PHP_VERSION tells us which version of PHP we
+ # want to use
+ uses_php${PHP_VERSION}
+}
+
+# ========================================================================
+# Misc functions
+#
+# These functions provide miscellaneous checks and functionality.
+# ========================================================================
+
+# @FUNCTION: dodoc-php
+# @USAGE: <list of docs>
+# @DESCRIPTION:
+# Alternative to dodoc function for use in our PHP eclasses and ebuilds.
+# Stored here because depend.php gets always sourced everywhere in the PHP
+# ebuilds and eclasses. It simply is dodoc with a changed path to the docs.
+# NOTE: No support for docinto is provided!
+dodoc-php() {
+if [[ $# -lt 1 ]] ; then
+ echo "$0: at least one argument needed" 1>&2
+ exit 1
+fi
+
+phpdocdir="/usr/share/doc/${CATEGORY}/${PF}/"
+
+for x in $@ ; do
+ if [[ -s "${x}" ]] ; then
+ insinto "${phpdocdir}"
+ doins "${x}"
+ gzip -f -9 "${D}/${phpdocdir}/${x##*/}"
+ elif [[ ! -e "${x}" ]] ; then
+ echo "dodoc-php: ${x} does not exist" 1>&2
+ fi
+done
+}
+
+# @FUNCTION: dohtml-php
+# @USAGE: <list of html docs>
+# @DESCRIPTION:
+# Alternative to dohtml function for use in our PHP eclasses and ebuilds.
+# Stored here because depend.php gets always sourced everywhere in the PHP
+# ebuilds and eclasses. It simply is dohtml with a changed path to the docs.
+# NOTE: No support for [-a|-A|-p|-x] options is provided!
+dohtml-php() {
+if [[ $# -lt 1 ]] ; then
+ echo "$0: at least one argument needed" 1>&2
+ exit 1
+fi
+
+phphtmldir="/usr/share/doc/${CATEGORY}/${PF}/html"
+
+for x in $@ ; do
+ if [[ -s "${x}" ]] ; then
+ insinto "${phphtmldir}"
+ doins "${x}"
+ elif [[ ! -e "${x}" ]] ; then
+ echo "dohtml-php: ${x} does not exist" 1>&2
+ fi
+done
+}
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
new file mode 100644
index 00000000000..e6be0524f0d
--- /dev/null
+++ b/eclass/distutils-r1.eclass
@@ -0,0 +1,822 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @ECLASS: distutils-r1
+# @MAINTAINER:
+# Python team <python@gentoo.org>
+# @AUTHOR:
+# Author: Michał Górny <mgorny@gentoo.org>
+# Based on the work of: Krzysztof Pawlik <nelchael@gentoo.org>
+# @BLURB: A simple eclass to build Python packages using distutils.
+# @DESCRIPTION:
+# A simple eclass providing functions to build Python packages using
+# the distutils build system. It exports phase functions for all
+# the src_* phases. Each of the phases runs two pseudo-phases:
+# python_..._all() (e.g. python_prepare_all()) once in ${S}, then
+# python_...() (e.g. python_prepare()) for each implementation
+# (see: python_foreach_impl() in python-r1).
+#
+# In distutils-r1_src_prepare(), the 'all' function is run before
+# per-implementation ones (because it creates the implementations),
+# per-implementation functions are run in a random order.
+#
+# In remaining phase functions, the per-implementation functions are run
+# before the 'all' one, and they are ordered from the least to the most
+# preferred implementation (so that 'better' files overwrite 'worse'
+# ones).
+#
+# If the ebuild doesn't specify a particular pseudo-phase function,
+# the default one will be used (distutils-r1_...). Defaults are provided
+# for all per-implementation pseudo-phases, python_prepare_all()
+# and python_install_all(); whenever writing your own pseudo-phase
+# functions, you should consider calling the defaults (and especially
+# distutils-r1_python_prepare_all).
+#
+# Please note that distutils-r1 sets RDEPEND and DEPEND unconditionally
+# for you.
+#
+# Also, please note that distutils-r1 will always inherit python-r1
+# as well. Thus, all the variables defined and documented there are
+# relevant to the packages using distutils-r1.
+#
+# For more information, please see the wiki:
+# https://wiki.gentoo.org/wiki/Project:Python/distutils-r1
+
+case "${EAPI:-0}" in
+ 0|1|2|3)
+ die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
+ ;;
+ 4|5)
+ ;;
+ *)
+ die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
+ ;;
+esac
+
+# @ECLASS-VARIABLE: DISTUTILS_OPTIONAL
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# If set to a non-null value, distutils part in the ebuild will
+# be considered optional. No dependencies will be added and no phase
+# functions will be exported.
+#
+# If you enable DISTUTILS_OPTIONAL, you have to set proper dependencies
+# for your package (using ${PYTHON_DEPS}) and to either call
+# distutils-r1 default phase functions or call the build system
+# manually.
+
+# @ECLASS-VARIABLE: DISTUTILS_SINGLE_IMPL
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# If set to a non-null value, the ebuild will support setting a single
+# Python implementation only. It will effectively replace the python-r1
+# eclass inherit with python-single-r1.
+#
+# Note that inheriting python-single-r1 will cause pkg_setup()
+# to be exported. It must be run in order for the eclass functions
+# to function properly.
+
+if [[ ! ${_DISTUTILS_R1} ]]; then
+
+inherit eutils toolchain-funcs
+
+if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
+ inherit multiprocessing python-r1
+else
+ inherit python-single-r1
+fi
+
+fi
+
+if [[ ! ${DISTUTILS_OPTIONAL} ]]; then
+ EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
+fi
+
+if [[ ! ${_DISTUTILS_R1} ]]; then
+
+if [[ ! ${DISTUTILS_OPTIONAL} ]]; then
+ RDEPEND=${PYTHON_DEPS}
+ DEPEND=${PYTHON_DEPS}
+ REQUIRED_USE=${PYTHON_REQUIRED_USE}
+fi
+
+# @ECLASS-VARIABLE: PATCHES
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# An array containing patches to be applied to the sources before
+# copying them.
+#
+# If unset, no custom patches will be applied.
+#
+# Please note, however, that at some point the eclass may apply
+# additional distutils patches/quirks independently of this variable.
+#
+# Example:
+# @CODE
+# PATCHES=( "${FILESDIR}"/${P}-make-gentoo-happy.patch )
+# @CODE
+
+# @ECLASS-VARIABLE: DOCS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# An array containing documents installed using dodoc. The files listed
+# there must exist in the directory from which
+# distutils-r1_python_install_all() is run (${S} by default).
+#
+# If unset, the function will instead look up files matching default
+# filename pattern list (from the Package Manager Specification),
+# and install those found.
+#
+# Example:
+# @CODE
+# DOCS=( NEWS README )
+# @CODE
+
+# @ECLASS-VARIABLE: HTML_DOCS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# An array containing documents installed using dohtml. The files
+# and directories listed there must exist in the directory from which
+# distutils-r1_python_install_all() is run (${S} by default).
+#
+# If unset, no HTML docs will be installed.
+#
+# Example:
+# @CODE
+# HTML_DOCS=( doc/html/. )
+# @CODE
+
+# @ECLASS-VARIABLE: EXAMPLES
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# An array containing examples installed into 'examples' doc
+# subdirectory. The files and directories listed there must exist
+# in the directory from which distutils-r1_python_install_all() is run
+# (${S} by default).
+#
+# The 'examples' subdirectory will be marked not to be compressed
+# automatically.
+#
+# If unset, no examples will be installed.
+#
+# Example:
+# @CODE
+# EXAMPLES=( examples/. demos/. )
+# @CODE
+
+# @ECLASS-VARIABLE: DISTUTILS_IN_SOURCE_BUILD
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# If set to a non-null value, in-source builds will be enabled.
+# If unset, the default is to use in-source builds when python_prepare()
+# is declared, and out-of-source builds otherwise.
+#
+# If in-source builds are used, the eclass will create a copy of package
+# sources for each Python implementation in python_prepare_all(),
+# and work on that copy afterwards.
+#
+# If out-of-source builds are used, the eclass will instead work
+# on the sources directly, prepending setup.py arguments with
+# 'build --build-base ${BUILD_DIR}' to enforce keeping & using built
+# files in the specific root.
+
+# @ECLASS-VARIABLE: DISTUTILS_ALL_SUBPHASE_IMPLS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# An array of patterns specifying which implementations can be used
+# for *_all() sub-phase functions. If undefined, defaults to '*'
+# (allowing any implementation). If multiple values are specified,
+# implementations matching any of the patterns will be accepted.
+#
+# If the restriction needs to apply conditionally to a USE flag,
+# the variable should be set conditionally as well (e.g. in an early
+# phase function or other convenient location).
+#
+# Please remember to add a matching || block to REQUIRED_USE,
+# to ensure that at least one implementation matching the patterns will
+# be enabled.
+#
+# Example:
+# @CODE
+# REQUIRED_USE="doc? ( || ( $(python_gen_useflags 'python2*') ) )"
+#
+# pkg_setup() {
+# use doc && DISTUTILS_ALL_SUBPHASE_IMPLS=( 'python2*' )
+# }
+# @CODE
+
+# @ECLASS-VARIABLE: mydistutilsargs
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# An array containing options to be passed to setup.py.
+#
+# Example:
+# @CODE
+# python_configure_all() {
+# mydistutilsargs=( --enable-my-hidden-option )
+# }
+# @CODE
+
+# @FUNCTION: esetup.py
+# @USAGE: [<args>...]
+# @DESCRIPTION:
+# Run setup.py using currently selected Python interpreter
+# (if ${PYTHON} is set; fallback 'python' otherwise).
+#
+# setup.py will be passed the following, in order:
+# 1. ${mydistutilsargs[@]}
+# 2. additional arguments passed to the esetup.py function.
+#
+# Please note that setup.py will respect defaults (unless overriden
+# via command-line options) from setup.cfg that is created
+# in distutils-r1_python_compile and in distutils-r1_python_install.
+#
+# This command dies on failure.
+esetup.py() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ set -- "${PYTHON:-python}" setup.py "${mydistutilsargs[@]}" "${@}"
+
+ echo "${@}" >&2
+ "${@}" || die
+}
+
+# @FUNCTION: distutils_install_for_testing
+# @USAGE: [<args>...]
+# @DESCRIPTION:
+# Install the package into a temporary location for running tests.
+# Update PYTHONPATH appropriately and set TEST_DIR to the test
+# installation root. The Python packages will be installed in 'lib'
+# subdir, and scripts in 'scripts' subdir (like in BUILD_DIR).
+#
+# Please note that this function should be only used if package uses
+# namespaces (and therefore proper install needs to be done to enforce
+# PYTHONPATH) or tests rely on the results of install command.
+# For most of the packages, tests built in BUILD_DIR are good enough.
+distutils_install_for_testing() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ # A few notes:
+ # 1) because of namespaces, we can't use 'install --root',
+ # 2) 'install --home' is terribly broken on pypy, so we need
+ # to override --install-lib and --install-scripts,
+ # 3) non-root 'install' complains about PYTHONPATH and missing dirs,
+ # so we need to set it properly and mkdir them,
+ # 4) it runs a bunch of commands which write random files to cwd,
+ # in order to avoid that, we add the necessary path overrides
+ # in _distutils-r1_create_setup_cfg.
+
+ TEST_DIR=${BUILD_DIR}/test
+ local bindir=${TEST_DIR}/scripts
+ local libdir=${TEST_DIR}/lib
+ PYTHONPATH=${libdir}:${PYTHONPATH}
+
+ local add_args=(
+ install
+ --home="${TEST_DIR}"
+ --install-lib="${libdir}"
+ --install-scripts="${bindir}"
+ )
+
+ mkdir -p "${libdir}" || die
+ esetup.py "${add_args[@]}" "${@}"
+}
+
+# @FUNCTION: _distutils-r1_disable_ez_setup
+# @INTERNAL
+# @DESCRIPTION:
+# Stub out ez_setup.py and distribute_setup.py to prevent packages
+# from trying to download a local copy of setuptools.
+_distutils-r1_disable_ez_setup() {
+ local stub="def use_setuptools(*args, **kwargs): pass"
+ if [[ -f ez_setup.py ]]; then
+ echo "${stub}" > ez_setup.py || die
+ fi
+ if [[ -f distribute_setup.py ]]; then
+ echo "${stub}" > distribute_setup.py || die
+ fi
+}
+
+# @FUNCTION: distutils-r1_python_prepare_all
+# @DESCRIPTION:
+# The default python_prepare_all(). It applies the patches from PATCHES
+# array, then user patches and finally calls python_copy_sources to
+# create copies of resulting sources for each Python implementation.
+#
+# At some point in the future, it may also apply eclass-specific
+# distutils patches and/or quirks.
+distutils-r1_python_prepare_all() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ [[ ${PATCHES} ]] && epatch "${PATCHES[@]}"
+
+ epatch_user
+
+ # by default, use in-source build if python_prepare() is used
+ if [[ ! ${DISTUTILS_IN_SOURCE_BUILD+1} ]]; then
+ if declare -f python_prepare >/dev/null; then
+ DISTUTILS_IN_SOURCE_BUILD=1
+ fi
+ fi
+
+ _distutils-r1_disable_ez_setup
+
+ if [[ ${DISTUTILS_IN_SOURCE_BUILD} && ! ${DISTUTILS_SINGLE_IMPL} ]]
+ then
+ # create source copies for each implementation
+ python_copy_sources
+ fi
+
+ _DISTUTILS_DEFAULT_CALLED=1
+}
+
+# @FUNCTION: distutils-r1_python_prepare
+# @DESCRIPTION:
+# The default python_prepare(). A no-op.
+distutils-r1_python_prepare() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ :
+}
+
+# @FUNCTION: distutils-r1_python_configure
+# @DESCRIPTION:
+# The default python_configure(). A no-op.
+distutils-r1_python_configure() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ :
+}
+
+# @FUNCTION: _distutils-r1_create_setup_cfg
+# @INTERNAL
+# @DESCRIPTION:
+# Create implementation-specific configuration file for distutils,
+# setting proper build-dir (and install-dir) paths.
+_distutils-r1_create_setup_cfg() {
+ cat > "${HOME}"/.pydistutils.cfg <<-_EOF_ || die
+ [build]
+ build-base = ${BUILD_DIR}
+
+ # using a single directory for them helps us export
+ # ${PYTHONPATH} and ebuilds find the sources independently
+ # of whether the package installs extensions or not
+ #
+ # note: due to some packages (wxpython) relying on separate
+ # platlib & purelib dirs, we do not set --build-lib (which
+ # can not be overriden with --build-*lib)
+ build-platlib = %(build-base)s/lib
+ build-purelib = %(build-base)s/lib
+
+ # make the ebuild writer lives easier
+ build-scripts = %(build-base)s/scripts
+
+ [egg_info]
+ egg-base = ${BUILD_DIR}
+
+ # this is needed by distutils_install_for_testing since
+ # setuptools like to create .egg files for install --home.
+ [bdist_egg]
+ dist-dir = ${BUILD_DIR}/dist
+ _EOF_
+
+ # we can't refer to ${D} before src_install()
+ if [[ ${EBUILD_PHASE} == install ]]; then
+ cat >> "${HOME}"/.pydistutils.cfg <<-_EOF_ || die
+
+ # installation paths -- allow calling extra install targets
+ # without the default 'install'
+ [install]
+ compile = True
+ optimize = 2
+ root = ${D}
+ _EOF_
+
+ if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
+ cat >> "${HOME}"/.pydistutils.cfg <<-_EOF_ || die
+ install-scripts = $(python_get_scriptdir)
+ _EOF_
+ fi
+ fi
+}
+
+# @FUNCTION: _distutils-r1_copy_egg_info
+# @INTERNAL
+# @DESCRIPTION:
+# Copy egg-info files to the ${BUILD_DIR} (that's going to become
+# egg-base in esetup.py). This way, we respect whatever's in upstream
+# egg-info.
+_distutils-r1_copy_egg_info() {
+ mkdir -p "${BUILD_DIR}" || die
+ # stupid freebsd can't do 'cp -t ${BUILD_DIR} {} +'
+ find -name '*.egg-info' -type d -exec cp -pr {} "${BUILD_DIR}"/ ';' || die
+}
+
+# @FUNCTION: distutils-r1_python_compile
+# @USAGE: [additional-args...]
+# @DESCRIPTION:
+# The default python_compile(). Runs 'esetup.py build'. Any parameters
+# passed to this function will be appended to setup.py invocation,
+# i.e. passed as options to the 'build' command.
+#
+# This phase also sets up initial setup.cfg with build directories
+# and copies upstream egg-info files if supplied.
+distutils-r1_python_compile() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ _distutils-r1_create_setup_cfg
+ _distutils-r1_copy_egg_info
+
+ esetup.py build "${@}"
+}
+
+# @FUNCTION: _distutils-r1_wrap_scripts
+# @USAGE: <path> <bindir>
+# @INTERNAL
+# @DESCRIPTION:
+# Moves and wraps all installed scripts/executables as necessary.
+_distutils-r1_wrap_scripts() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ [[ ${#} -eq 2 ]] || die "usage: ${FUNCNAME} <path> <bindir>"
+ local path=${1}
+ local bindir=${2}
+
+ local PYTHON_SCRIPTDIR
+ python_export PYTHON_SCRIPTDIR
+
+ local f python_files=() non_python_files=()
+
+ if [[ -d ${path}${PYTHON_SCRIPTDIR} ]]; then
+ for f in "${path}${PYTHON_SCRIPTDIR}"/*; do
+ [[ -d ${f} ]] && die "Unexpected directory: ${f}"
+ debug-print "${FUNCNAME}: found executable at ${f#${path}/}"
+
+ local shebang
+ read -r shebang < "${f}"
+ if [[ ${shebang} == '#!'*${EPYTHON}* ]]; then
+ debug-print "${FUNCNAME}: matching shebang: ${shebang}"
+ python_files+=( "${f}" )
+ else
+ debug-print "${FUNCNAME}: non-matching shebang: ${shebang}"
+ non_python_files+=( "${f}" )
+ fi
+
+ mkdir -p "${path}${bindir}" || die
+ done
+
+ for f in "${python_files[@]}"; do
+ local basename=${f##*/}
+
+ debug-print "${FUNCNAME}: installing wrapper at ${bindir}/${basename}"
+ _python_ln_rel "${path}${EPREFIX}"/usr/lib/python-exec/python-exec2 \
+ "${path}${bindir}/${basename}" || die
+ done
+
+ for f in "${non_python_files[@]}"; do
+ local basename=${f##*/}
+
+ debug-print "${FUNCNAME}: moving ${f#${path}/} to ${bindir}/${basename}"
+ mv "${f}" "${path}${bindir}/${basename}" || die
+ done
+ fi
+}
+
+# @FUNCTION: distutils-r1_python_install
+# @USAGE: [additional-args...]
+# @DESCRIPTION:
+# The default python_install(). Runs 'esetup.py install', doing
+# intermediate root install and handling script wrapping afterwards.
+# Any parameters passed to this function will be appended
+# to the setup.py invocation (i.e. as options to the 'install' command).
+#
+# This phase updates the setup.cfg file with install directories.
+distutils-r1_python_install() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local args=( "${@}" )
+
+ # enable compilation for the install phase.
+ local -x PYTHONDONTWRITEBYTECODE=
+
+ # re-create setup.cfg with install paths
+ _distutils-r1_create_setup_cfg
+
+ # python likes to compile any module it sees, which triggers sandbox
+ # failures if some packages haven't compiled their modules yet.
+ addpredict "${EPREFIX}/usr/$(get_libdir)/${EPYTHON}"
+ addpredict /usr/lib/portage/pym
+ addpredict /usr/local # bug 498232
+
+ if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
+ # user may override --install-scripts
+ # note: this is poor but distutils argv parsing is dumb
+ local mydistutilsargs=( "${mydistutilsargs[@]}" )
+ local scriptdir=${EPREFIX}/usr/bin
+
+ # construct a list of mydistutilsargs[0] args[0] args[1]...
+ local arg arg_vars
+ [[ ${mydistutilsargs[@]} ]] && eval arg_vars+=(
+ 'mydistutilsargs['{0..$(( ${#mydistutilsargs[@]} - 1 ))}']'
+ )
+ [[ ${args[@]} ]] && eval arg_vars+=(
+ 'args['{0..$(( ${#args[@]} - 1 ))}']'
+ )
+
+ set -- "${arg_vars[@]}"
+ while [[ ${@} ]]; do
+ local arg_var=${1}
+ shift
+ local a=${!arg_var}
+
+ case "${a}" in
+ --install-scripts=*)
+ scriptdir=${a#--install-scripts=}
+ unset "${arg_var}"
+ ;;
+ --install-scripts)
+ scriptdir=${!1}
+ unset "${arg_var}" "${1}"
+ shift
+ ;;
+ esac
+ done
+ fi
+
+ local root=${D}/_${EPYTHON}
+ [[ ${DISTUTILS_SINGLE_IMPL} ]] && root=${D}
+
+ esetup.py install --root="${root}" "${args[@]}"
+
+ local forbidden_package_names=( examples test tests )
+ local p
+ for p in "${forbidden_package_names[@]}"; do
+ if [[ -d ${root}$(python_get_sitedir)/${p} ]]; then
+ die "Package installs '${p}' package which is forbidden and likely a bug in the build system."
+ fi
+ done
+ if [[ -d ${root}/usr/$(get_libdir)/pypy/share ]]; then
+ eqawarn "Package installs 'share' in PyPy prefix, see bug #465546."
+ fi
+
+ if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
+ _distutils-r1_wrap_scripts "${root}" "${scriptdir}"
+ multibuild_merge_root "${root}" "${D}"
+ fi
+}
+
+# @FUNCTION: distutils-r1_python_install_all
+# @DESCRIPTION:
+# The default python_install_all(). It installs the documentation.
+distutils-r1_python_install_all() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ einstalldocs
+
+ if declare -p EXAMPLES &>/dev/null; then
+ local INSDESTTREE=/usr/share/doc/${PF}/examples
+ doins -r "${EXAMPLES[@]}"
+ docompress -x "${INSDESTTREE}"
+ fi
+
+ _DISTUTILS_DEFAULT_CALLED=1
+}
+
+# @FUNCTION: distutils-r1_run_phase
+# @USAGE: [<argv>...]
+# @INTERNAL
+# @DESCRIPTION:
+# Run the given command.
+#
+# If out-of-source builds are used, the phase function is run in source
+# directory, with BUILD_DIR pointing at the build directory
+# and PYTHONPATH having an entry for the module build directory.
+#
+# If in-source builds are used, the command is executed in the directory
+# holding the per-implementation copy of sources. BUILD_DIR points
+# to the 'build' subdirectory.
+distutils-r1_run_phase() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ if [[ ${DISTUTILS_IN_SOURCE_BUILD} ]]; then
+ if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
+ cd "${BUILD_DIR}" || die
+ fi
+ local BUILD_DIR=${BUILD_DIR}/build
+ fi
+ local -x PYTHONPATH="${BUILD_DIR}/lib:${PYTHONPATH}"
+
+ # We need separate home for each implementation, for .pydistutils.cfg.
+ if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
+ local -x HOME=${HOME}/${EPYTHON}
+ mkdir -p "${HOME}" || die
+ fi
+
+ # Set up build environment, bug #513664.
+ local -x AR=${AR} CC=${CC} CPP=${CPP} CXX=${CXX}
+ tc-export AR CC CPP CXX
+
+ # How to build Python modules in different worlds...
+ local ldopts
+ case "${CHOST}" in
+ # provided by haubi, 2014-07-08
+ *-aix*) ldopts='-shared -Wl,-berok';; # good enough
+ # provided by grobian, 2014-06-22, bug #513664 c7
+ *-darwin*) ldopts='-bundle -undefined dynamic_lookup';;
+ *) ldopts='-shared';;
+ esac
+
+ local -x LDSHARED="${CC} ${ldopts}" LDCXXSHARED="${CXX} ${ldopts}"
+
+ "${@}"
+
+ cd "${_DISTUTILS_INITIAL_CWD}" || die
+}
+
+# @FUNCTION: _distutils-r1_run_common_phase
+# @USAGE: [<argv>...]
+# @INTERNAL
+# @DESCRIPTION:
+# Run the given command, restoring the state for a most preferred Python
+# implementation matching DISTUTILS_ALL_SUBPHASE_IMPLS.
+#
+# If in-source build is used, the command will be run in the copy
+# of sources made for the selected Python interpreter.
+_distutils-r1_run_common_phase() {
+ local DISTUTILS_ORIG_BUILD_DIR=${BUILD_DIR}
+
+ if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
+ local best_impl patterns=( "${DISTUTILS_ALL_SUBPHASE_IMPLS[@]-*}" )
+ _distutils_try_impl() {
+ local pattern
+ for pattern in "${patterns[@]}"; do
+ if [[ ${EPYTHON} == ${pattern} ]]; then
+ best_impl=${MULTIBUILD_VARIANT}
+ fi
+ done
+ }
+ python_foreach_impl _distutils_try_impl
+
+ local PYTHON_COMPAT=( "${best_impl}" )
+ fi
+
+ _distutils-r1_run_foreach_impl "${@}"
+}
+
+# @FUNCTION: _distutils-r1_run_foreach_impl
+# @INTERNAL
+# @DESCRIPTION:
+# Run the given phase for each implementation if multiple implementations
+# are enabled, once otherwise.
+_distutils-r1_run_foreach_impl() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ if [[ ${DISTUTILS_NO_PARALLEL_BUILD} ]]; then
+ eqawarn "DISTUTILS_NO_PARALLEL_BUILD is no longer meaningful. Now all builds"
+ eqawarn "are non-parallel. Please remove it from the ebuild."
+
+ unset DISTUTILS_NO_PARALLEL_BUILD # avoid repeated warnings
+ fi
+
+ # store for restoring after distutils-r1_run_phase.
+ local _DISTUTILS_INITIAL_CWD=${PWD}
+ set -- distutils-r1_run_phase "${@}"
+
+ if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
+ python_foreach_impl "${@}"
+ else
+ if [[ ! ${EPYTHON} ]]; then
+ die "EPYTHON unset, python-single-r1_pkg_setup not called?!"
+ fi
+ local BUILD_DIR=${BUILD_DIR:-${S}}
+ BUILD_DIR=${BUILD_DIR%%/}_${EPYTHON}
+
+ "${@}"
+ fi
+}
+
+distutils-r1_src_prepare() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local _DISTUTILS_DEFAULT_CALLED
+
+ # common preparations
+ if declare -f python_prepare_all >/dev/null; then
+ python_prepare_all
+ else
+ distutils-r1_python_prepare_all
+ fi
+
+ if [[ ! ${_DISTUTILS_DEFAULT_CALLED} ]]; then
+ eqawarn "QA warning: python_prepare_all() didn't call distutils-r1_python_prepare_all"
+ fi
+
+ if declare -f python_prepare >/dev/null; then
+ _distutils-r1_run_foreach_impl python_prepare
+ fi
+}
+
+distutils-r1_src_configure() {
+ python_export_utf8_locale
+
+ if declare -f python_configure >/dev/null; then
+ _distutils-r1_run_foreach_impl python_configure
+ fi
+
+ if declare -f python_configure_all >/dev/null; then
+ _distutils-r1_run_common_phase python_configure_all
+ fi
+}
+
+distutils-r1_src_compile() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ if declare -f python_compile >/dev/null; then
+ _distutils-r1_run_foreach_impl python_compile
+ else
+ _distutils-r1_run_foreach_impl distutils-r1_python_compile
+ fi
+
+ if declare -f python_compile_all >/dev/null; then
+ _distutils-r1_run_common_phase python_compile_all
+ fi
+}
+
+_clean_egg_info() {
+ # Work around for setuptools test behavior (bug 534058).
+ # https://bitbucket.org/pypa/setuptools/issue/292
+ rm -rf "${BUILD_DIR}"/lib/*.egg-info
+}
+
+distutils-r1_src_test() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ if declare -f python_test >/dev/null; then
+ _distutils-r1_run_foreach_impl python_test
+ _distutils-r1_run_foreach_impl _clean_egg_info
+ fi
+
+ if declare -f python_test_all >/dev/null; then
+ _distutils-r1_run_common_phase python_test_all
+ fi
+}
+
+distutils-r1_src_install() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ if declare -f python_install >/dev/null; then
+ _distutils-r1_run_foreach_impl python_install
+ else
+ _distutils-r1_run_foreach_impl distutils-r1_python_install
+ fi
+
+ local _DISTUTILS_DEFAULT_CALLED
+
+ if declare -f python_install_all >/dev/null; then
+ _distutils-r1_run_common_phase python_install_all
+ else
+ _distutils-r1_run_common_phase distutils-r1_python_install_all
+ fi
+
+ if [[ ! ${_DISTUTILS_DEFAULT_CALLED} ]]; then
+ eqawarn "QA warning: python_install_all() didn't call distutils-r1_python_install_all"
+ fi
+}
+
+# -- distutils.eclass functions --
+
+distutils_get_intermediate_installation_image() {
+ die "${FUNCNAME}() is invalid for distutils-r1"
+}
+
+distutils_src_unpack() {
+ die "${FUNCNAME}() is invalid for distutils-r1, and you don't want it in EAPI ${EAPI} anyway"
+}
+
+distutils_src_prepare() {
+ die "${FUNCNAME}() is invalid for distutils-r1, you probably want: ${FUNCNAME/_/-r1_}"
+}
+
+distutils_src_compile() {
+ die "${FUNCNAME}() is invalid for distutils-r1, you probably want: ${FUNCNAME/_/-r1_}"
+}
+
+distutils_src_test() {
+ die "${FUNCNAME}() is invalid for distutils-r1, you probably want: ${FUNCNAME/_/-r1_}"
+}
+
+distutils_src_install() {
+ die "${FUNCNAME}() is invalid for distutils-r1, you probably want: ${FUNCNAME/_/-r1_}"
+}
+
+distutils_pkg_postinst() {
+ die "${FUNCNAME}() is invalid for distutils-r1, and pkg_postinst is unnecessary"
+}
+
+distutils_pkg_postrm() {
+ die "${FUNCNAME}() is invalid for distutils-r1, and pkg_postrm is unnecessary"
+}
+
+_DISTUTILS_R1=1
+fi
diff --git a/eclass/distutils.eclass b/eclass/distutils.eclass
new file mode 100644
index 00000000000..5f5a06950d8
--- /dev/null
+++ b/eclass/distutils.eclass
@@ -0,0 +1,594 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @ECLASS: distutils.eclass
+# @MAINTAINER:
+# Gentoo Python Project <python@gentoo.org>
+# @BLURB: Eclass for packages with build systems using Distutils
+# @DESCRIPTION:
+# The distutils eclass defines phase functions for packages with build systems using Distutils.
+#
+# This eclass is DEPRECATED. Please use distutils-r1 instead.
+
+if [[ -z "${_PYTHON_ECLASS_INHERITED}" ]]; then
+ inherit python
+fi
+
+inherit multilib
+
+case "${EAPI:-0}" in
+ 0|1)
+ EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_postinst pkg_postrm
+ ;;
+ *)
+ EXPORT_FUNCTIONS src_prepare src_compile src_install pkg_postinst pkg_postrm
+ ;;
+esac
+
+if [[ -z "$(declare -p PYTHON_DEPEND 2> /dev/null)" ]]; then
+ DEPEND="dev-lang/python"
+ RDEPEND="${DEPEND}"
+fi
+
+ if has "${EAPI:-0}" 0 1 && [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
+ ewarn
+ ewarn "\"${EBUILD}\":"
+ ewarn "Deprecation Warning: Usage of distutils.eclass in packages supporting installation"
+ ewarn "for multiple Python ABIs in EAPI <=1 is deprecated."
+ ewarn "The ebuild should to be fixed. Please report a bug, if it has not been already reported."
+ ewarn
+ elif has "${EAPI:-0}" 0 1 2 && [[ -z "${SUPPORT_PYTHON_ABIS}" ]]; then
+ ewarn
+ ewarn "\"${EBUILD}\":"
+ ewarn "Deprecation Warning: Usage of distutils.eclass in packages not supporting installation"
+ ewarn "for multiple Python ABIs in EAPI <=2 is deprecated."
+ ewarn "The ebuild should to be fixed. Please report a bug, if it has not been already reported."
+ ewarn
+ fi
+
+# 'python' variable is deprecated. Use PYTHON() instead.
+if has "${EAPI:-0}" 0 1 2 && [[ -z "${SUPPORT_PYTHON_ABIS}" ]]; then
+ python="python"
+else
+ python="die"
+fi
+
+# @ECLASS-VARIABLE: DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES
+# @DESCRIPTION:
+# Set this to use separate source directories for each enabled version of Python.
+
+# @ECLASS-VARIABLE: DISTUTILS_SETUP_FILES
+# @DESCRIPTION:
+# Array of paths to setup files.
+# Syntax:
+# [current_working_directory|]path_to_setup_file
+
+# @ECLASS-VARIABLE: DISTUTILS_GLOBAL_OPTIONS
+# @DESCRIPTION:
+# Array of global options passed to setup files.
+# Syntax in EAPI <4:
+# global_option
+# Syntax in EAPI >=4:
+# Python_ABI_pattern global_option
+
+# @ECLASS-VARIABLE: DISTUTILS_SRC_TEST
+# @DESCRIPTION:
+# Type of test command used by distutils_src_test().
+# IUSE and DEPEND are automatically adjusted, unless DISTUTILS_DISABLE_TEST_DEPENDENCY is set.
+# Valid values:
+# setup.py
+# nosetests
+# py.test
+# trial [arguments]
+
+# @ECLASS-VARIABLE: DISTUTILS_DISABLE_TEST_DEPENDENCY
+# @DESCRIPTION:
+# Disable modification of IUSE and DEPEND caused by setting of DISTUTILS_SRC_TEST.
+
+if [[ -n "${DISTUTILS_SRC_TEST}" && ! "${DISTUTILS_SRC_TEST}" =~ ^(setup\.py|nosetests|py\.test|trial(\ .*)?)$ ]]; then
+ die "'DISTUTILS_SRC_TEST' variable has unsupported value '${DISTUTILS_SRC_TEST}'"
+fi
+
+if [[ -z "${DISTUTILS_DISABLE_TEST_DEPENDENCY}" ]]; then
+ if [[ "${DISTUTILS_SRC_TEST}" == "nosetests" ]]; then
+ IUSE="test"
+ DEPEND+="${DEPEND:+ }test? ( dev-python/nose )"
+ elif [[ "${DISTUTILS_SRC_TEST}" == "py.test" ]]; then
+ IUSE="test"
+ DEPEND+="${DEPEND:+ }test? ( dev-python/pytest )"
+ # trial requires an argument, which is usually equal to "${PN}".
+ elif [[ "${DISTUTILS_SRC_TEST}" =~ ^trial(\ .*)?$ ]]; then
+ IUSE="test"
+ DEPEND+="${DEPEND:+ }test? ( dev-python/twisted-core )"
+ fi
+fi
+
+if [[ -n "${DISTUTILS_SRC_TEST}" ]]; then
+ EXPORT_FUNCTIONS src_test
+fi
+
+# Scheduled for deletion on 2011-06-01.
+if [[ -n "${DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS}" ]]; then
+ eerror "Use PYTHON_NONVERSIONED_EXECUTABLES=(\".*\") instead of DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS variable."
+ die "DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS variable is banned"
+fi
+
+# @ECLASS-VARIABLE: DOCS
+# @DESCRIPTION:
+# Additional documentation files installed by distutils_src_install().
+
+_distutils_get_build_dir() {
+ if _python_package_supporting_installation_for_multiple_python_abis && [[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then
+ echo "build-${PYTHON_ABI}"
+ else
+ echo "build"
+ fi
+}
+
+_distutils_get_PYTHONPATH() {
+ if _python_package_supporting_installation_for_multiple_python_abis && [[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then
+ ls -d build-${PYTHON_ABI}/lib* 2> /dev/null
+ else
+ ls -d build/lib* 2> /dev/null
+ fi
+}
+
+_distutils_hook() {
+ if [[ "$#" -ne 1 ]]; then
+ die "${FUNCNAME}() requires 1 argument"
+ fi
+ if [[ "$(type -t "distutils_src_${EBUILD_PHASE}_$1_hook")" == "function" ]]; then
+ "distutils_src_${EBUILD_PHASE}_$1_hook"
+ fi
+}
+
+_distutils_prepare_global_options() {
+ local element option pattern
+
+ if [[ -n "$(declare -p DISTUTILS_GLOBAL_OPTIONS 2> /dev/null)" && "$(declare -p DISTUTILS_GLOBAL_OPTIONS)" != "declare -a DISTUTILS_GLOBAL_OPTIONS="* ]]; then
+ die "DISTUTILS_GLOBAL_OPTIONS should be indexed array"
+ fi
+
+ if has "${EAPI:-0}" 0 1 2 3; then
+ _DISTUTILS_GLOBAL_OPTIONS=("${DISTUTILS_GLOBAL_OPTIONS[@]}")
+ else
+ _DISTUTILS_GLOBAL_OPTIONS=()
+
+ for element in "${DISTUTILS_GLOBAL_OPTIONS[@]}"; do
+ if [[ ! "${element}" =~ ^[^[:space:]]+\ . ]]; then
+ die "Element '${element}' of DISTUTILS_GLOBAL_OPTIONS array has invalid syntax"
+ fi
+ pattern="${element%% *}"
+ option="${element#* }"
+ if _python_check_python_abi_matching "${PYTHON_ABI}" "${pattern}"; then
+ _DISTUTILS_GLOBAL_OPTIONS+=("${option}")
+ fi
+ done
+ fi
+}
+
+_distutils_prepare_current_working_directory() {
+ if [[ "$1" == *"|"*"|"* ]]; then
+ die "Element '$1' of DISTUTILS_SETUP_FILES array has invalid syntax"
+ fi
+
+ if [[ "$1" == *"|"* ]]; then
+ echo "${_BOLD}[${1%|*}]${_NORMAL}"
+ pushd "${1%|*}" > /dev/null || die "Entering directory '${1%|*}' failed"
+ fi
+}
+
+_distutils_restore_current_working_directory() {
+ if [[ "$1" == *"|"* ]]; then
+ popd > /dev/null || die "Leaving directory '${1%|*}' failed"
+ fi
+}
+
+# @FUNCTION: distutils_src_unpack
+# @DESCRIPTION:
+# The distutils src_unpack function. This function is exported.
+distutils_src_unpack() {
+ if ! has "${EAPI:-0}" 0 1; then
+ die "${FUNCNAME}() cannot be used in this EAPI"
+ fi
+
+ if [[ "${EBUILD_PHASE}" != "unpack" ]]; then
+ die "${FUNCNAME}() can be used only in src_unpack() phase"
+ fi
+
+ unpack ${A}
+ cd "${S}"
+
+ distutils_src_prepare
+}
+
+# @FUNCTION: distutils_src_prepare
+# @DESCRIPTION:
+# The distutils src_prepare function. This function is exported.
+distutils_src_prepare() {
+ if ! has "${EAPI:-0}" 0 1 && [[ "${EBUILD_PHASE}" != "prepare" ]]; then
+ die "${FUNCNAME}() can be used only in src_prepare() phase"
+ fi
+
+ _python_check_python_pkg_setup_execution
+
+ local distribute_setup_existence="0" ez_setup_existence="0"
+
+ if [[ "$#" -ne 0 ]]; then
+ die "${FUNCNAME}() does not accept arguments"
+ fi
+
+ # Delete ez_setup files to prevent packages from installing Setuptools on their own.
+ [[ -d ez_setup || -f ez_setup.py ]] && ez_setup_existence="1"
+ rm -fr ez_setup*
+ if [[ "${ez_setup_existence}" == "1" ]]; then
+ echo "def use_setuptools(*args, **kwargs): pass" > ez_setup.py
+ fi
+
+ # Delete distribute_setup files to prevent packages from installing Distribute on their own.
+ [[ -d distribute_setup || -f distribute_setup.py ]] && distribute_setup_existence="1"
+ rm -fr distribute_setup*
+ if [[ "${distribute_setup_existence}" == "1" ]]; then
+ echo "def use_setuptools(*args, **kwargs): pass" > distribute_setup.py
+ fi
+
+ if [[ -n "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then
+ python_copy_sources
+ fi
+}
+
+# @FUNCTION: distutils_src_compile
+# @DESCRIPTION:
+# The distutils src_compile function. This function is exported.
+# In ebuilds of packages supporting installation for multiple versions of Python, this function
+# calls distutils_src_compile_pre_hook() and distutils_src_compile_post_hook(), if they are defined.
+distutils_src_compile() {
+ if [[ "${EBUILD_PHASE}" != "compile" ]]; then
+ die "${FUNCNAME}() can be used only in src_compile() phase"
+ fi
+
+ _python_check_python_pkg_setup_execution
+ _python_set_color_variables
+
+ local setup_file
+
+ if _python_package_supporting_installation_for_multiple_python_abis; then
+ distutils_building() {
+ _distutils_hook pre
+
+ _distutils_prepare_global_options
+
+ for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
+ _distutils_prepare_current_working_directory "${setup_file}"
+
+ echo ${_BOLD}"$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "$(_distutils_get_build_dir)" "$@"${_NORMAL}
+ "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "$(_distutils_get_build_dir)" "$@" || return "$?"
+
+ _distutils_restore_current_working_directory "${setup_file}"
+ done
+
+ _distutils_hook post
+ }
+ python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} distutils_building "$@"
+ unset -f distutils_building
+ else
+ _distutils_prepare_global_options
+
+ for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
+ _distutils_prepare_current_working_directory "${setup_file}"
+
+ echo ${_BOLD}"$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@"${_NORMAL}
+ "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" || die "Building failed"
+
+ _distutils_restore_current_working_directory "${setup_file}"
+ done
+ fi
+}
+
+_distutils_src_test_hook() {
+ if [[ "$#" -ne 1 ]]; then
+ die "${FUNCNAME}() requires 1 arguments"
+ fi
+
+ if ! _python_package_supporting_installation_for_multiple_python_abis; then
+ return
+ fi
+
+ if [[ "$(type -t "distutils_src_test_pre_hook")" == "function" ]]; then
+ eval "python_execute_$1_pre_hook() {
+ distutils_src_test_pre_hook
+ }"
+ fi
+
+ if [[ "$(type -t "distutils_src_test_post_hook")" == "function" ]]; then
+ eval "python_execute_$1_post_hook() {
+ distutils_src_test_post_hook
+ }"
+ fi
+}
+
+# @FUNCTION: distutils_src_test
+# @DESCRIPTION:
+# The distutils src_test function. This function is exported, when DISTUTILS_SRC_TEST variable is set.
+# In ebuilds of packages supporting installation for multiple versions of Python, this function
+# calls distutils_src_test_pre_hook() and distutils_src_test_post_hook(), if they are defined.
+distutils_src_test() {
+ if [[ "${EBUILD_PHASE}" != "test" ]]; then
+ die "${FUNCNAME}() can be used only in src_test() phase"
+ fi
+
+ _python_check_python_pkg_setup_execution
+ _python_set_color_variables
+
+ local arguments setup_file
+
+ if [[ "${DISTUTILS_SRC_TEST}" == "setup.py" ]]; then
+ if _python_package_supporting_installation_for_multiple_python_abis; then
+ distutils_testing() {
+ _distutils_hook pre
+
+ _distutils_prepare_global_options
+
+ for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
+ _distutils_prepare_current_working_directory "${setup_file}"
+
+ echo ${_BOLD}PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") test "$@"${_NORMAL}
+ PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") test "$@" || return "$?"
+
+ _distutils_restore_current_working_directory "${setup_file}"
+ done
+
+ _distutils_hook post
+ }
+ python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} distutils_testing "$@"
+ unset -f distutils_testing
+ else
+ _distutils_prepare_global_options
+
+ for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
+ _distutils_prepare_current_working_directory "${setup_file}"
+
+ echo ${_BOLD}PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@"${_NORMAL}
+ PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@" || die "Testing failed"
+
+ _distutils_restore_current_working_directory "${setup_file}"
+ done
+ fi
+ elif [[ "${DISTUTILS_SRC_TEST}" == "nosetests" ]]; then
+ _distutils_src_test_hook nosetests
+
+ python_execute_nosetests -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} -- "$@"
+ elif [[ "${DISTUTILS_SRC_TEST}" == "py.test" ]]; then
+ _distutils_src_test_hook py.test
+
+ python_execute_py.test -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} -- "$@"
+ # trial requires an argument, which is usually equal to "${PN}".
+ elif [[ "${DISTUTILS_SRC_TEST}" =~ ^trial(\ .*)?$ ]]; then
+ if [[ "${DISTUTILS_SRC_TEST}" == "trial "* ]]; then
+ arguments="${DISTUTILS_SRC_TEST#trial }"
+ else
+ arguments="${PN}"
+ fi
+
+ _distutils_src_test_hook trial
+
+ python_execute_trial -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} -- ${arguments} "$@"
+ else
+ die "'DISTUTILS_SRC_TEST' variable has unsupported value '${DISTUTILS_SRC_TEST}'"
+ fi
+}
+
+# @FUNCTION: distutils_src_install
+# @DESCRIPTION:
+# The distutils src_install function. This function is exported.
+# In ebuilds of packages supporting installation for multiple versions of Python, this function
+# calls distutils_src_install_pre_hook() and distutils_src_install_post_hook(), if they are defined.
+# It also installs some standard documentation files (AUTHORS, Change*, CHANGELOG, CONTRIBUTORS,
+# KNOWN_BUGS, MAINTAINERS, NEWS, README*, TODO).
+distutils_src_install() {
+ if [[ "${EBUILD_PHASE}" != "install" ]]; then
+ die "${FUNCNAME}() can be used only in src_install() phase"
+ fi
+
+ _python_check_python_pkg_setup_execution
+ _python_initialize_prefix_variables
+ _python_set_color_variables
+
+ local default_docs doc line nspkg_pth_file nspkg_pth_files=() setup_file
+
+ if _python_package_supporting_installation_for_multiple_python_abis; then
+ distutils_installation() {
+ _distutils_hook pre
+
+ _distutils_prepare_global_options
+
+ for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
+ _distutils_prepare_current_working_directory "${setup_file}"
+
+ echo ${_BOLD}"$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") install --no-compile --root="${T}/images/${PYTHON_ABI}" "$@"${_NORMAL}
+ "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") install --no-compile --root="${T}/images/${PYTHON_ABI}" "$@" || return "$?"
+
+ _distutils_restore_current_working_directory "${setup_file}"
+ done
+
+ _distutils_hook post
+ }
+ python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} distutils_installation "$@"
+ unset -f distutils_installation
+
+ python_merge_intermediate_installation_images "${T}/images"
+ else
+ # Mark the package to be rebuilt after a Python upgrade.
+ python_need_rebuild
+
+ _distutils_prepare_global_options
+
+ for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
+ _distutils_prepare_current_working_directory "${setup_file}"
+
+ echo ${_BOLD}"$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@"${_NORMAL}
+ "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" || die "Installation failed"
+
+ _distutils_restore_current_working_directory "${setup_file}"
+ done
+ fi
+
+ while read -d $'\0' -r nspkg_pth_file; do
+ nspkg_pth_files+=("${nspkg_pth_file}")
+ done < <(find "${ED}" -name "*-nspkg.pth" -type f -print0)
+
+ if [[ "${#nspkg_pth_files[@]}" -gt 0 ]]; then
+ einfo
+ einfo "Python namespaces:"
+ for nspkg_pth_file in "${nspkg_pth_files[@]}"; do
+ einfo " '${nspkg_pth_file#${ED%/}}':"
+ while read -r line; do
+ einfo " $(echo "${line}" | sed -e "s/.*types\.ModuleType('\([^']\+\)').*/\1/")"
+ done < "${nspkg_pth_file}"
+ #if ! has "${EAPI:-0}" 0 1 2 3; then
+ # rm -f "${nspkg_pth_file}" || die "Deletion of '${nspkg_pth_file}' failed"
+ #fi
+ done
+ einfo
+ fi
+
+ if [[ -e "${ED}usr/local" ]]; then
+ die "Illegal installation into /usr/local"
+ fi
+
+ default_docs="AUTHORS Change* CHANGELOG CONTRIBUTORS KNOWN_BUGS MAINTAINERS NEWS README* TODO"
+
+ for doc in ${default_docs}; do
+ [[ -s "${doc}" ]] && dodoc "${doc}"
+ done
+
+ if has "${EAPI:-0}" 0 1 2 3; then
+ if [[ -n "${DOCS}" ]]; then
+ dodoc ${DOCS} || die "dodoc failed"
+ fi
+ else
+ if [[ -n "${DOCS}" ]]; then
+ dodoc -r ${DOCS} || die "dodoc failed"
+ fi
+ fi
+
+ DISTUTILS_SRC_INSTALL_EXECUTED="1"
+}
+
+# @FUNCTION: distutils_pkg_postinst
+# @DESCRIPTION:
+# The distutils pkg_postinst function. This function is exported.
+# When PYTHON_MODNAME variable is set, then this function calls python_mod_optimize() with modules
+# specified in PYTHON_MODNAME variable. Otherwise it calls python_mod_optimize() with module, whose
+# name is equal to name of current package, if this module exists.
+distutils_pkg_postinst() {
+ if [[ "${EBUILD_PHASE}" != "postinst" ]]; then
+ die "${FUNCNAME}() can be used only in pkg_postinst() phase"
+ fi
+
+ _python_check_python_pkg_setup_execution
+ _python_initialize_prefix_variables
+
+ if [[ -z "${DISTUTILS_SRC_INSTALL_EXECUTED}" ]]; then
+ die "${FUNCNAME}() called illegally"
+ fi
+
+ local pylibdir pymod
+
+ if [[ "$#" -ne 0 ]]; then
+ die "${FUNCNAME}() does not accept arguments"
+ fi
+
+ if [[ -z "$(declare -p PYTHON_MODNAME 2> /dev/null)" ]]; then
+ for pylibdir in "${EROOT}"usr/$(get_libdir)/python* "${EROOT}"usr/share/jython-*/Lib; do
+ if [[ -d "${pylibdir}/site-packages/${PN}" ]]; then
+ PYTHON_MODNAME="${PN}"
+ fi
+ done
+ fi
+
+ if [[ -n "${PYTHON_MODNAME}" ]]; then
+ if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis; then
+ python_mod_optimize ${PYTHON_MODNAME}
+ else
+ for pymod in ${PYTHON_MODNAME}; do
+ python_mod_optimize "$(python_get_sitedir)/${pymod}"
+ done
+ fi
+ fi
+}
+
+# @FUNCTION: distutils_pkg_postrm
+# @DESCRIPTION:
+# The distutils pkg_postrm function. This function is exported.
+# When PYTHON_MODNAME variable is set, then this function calls python_mod_cleanup() with modules
+# specified in PYTHON_MODNAME variable. Otherwise it calls python_mod_cleanup() with module, whose
+# name is equal to name of current package, if this module exists.
+distutils_pkg_postrm() {
+ if [[ "${EBUILD_PHASE}" != "postrm" ]]; then
+ die "${FUNCNAME}() can be used only in pkg_postrm() phase"
+ fi
+
+ _python_check_python_pkg_setup_execution
+ _python_initialize_prefix_variables
+
+ if [[ -z "${DISTUTILS_SRC_INSTALL_EXECUTED}" ]]; then
+ die "${FUNCNAME}() called illegally"
+ fi
+
+ local pylibdir pymod
+
+ if [[ "$#" -ne 0 ]]; then
+ die "${FUNCNAME}() does not accept arguments"
+ fi
+
+ if [[ -z "$(declare -p PYTHON_MODNAME 2> /dev/null)" ]]; then
+ for pylibdir in "${EROOT}"usr/$(get_libdir)/python* "${EROOT}"usr/share/jython-*/Lib; do
+ if [[ -d "${pylibdir}/site-packages/${PN}" ]]; then
+ PYTHON_MODNAME="${PN}"
+ fi
+ done
+ fi
+
+ if [[ -n "${PYTHON_MODNAME}" ]]; then
+ if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis; then
+ python_mod_cleanup ${PYTHON_MODNAME}
+ else
+ for pymod in ${PYTHON_MODNAME}; do
+ for pylibdir in "${EROOT}"usr/$(get_libdir)/python*; do
+ if [[ -d "${pylibdir}/site-packages/${pymod}" ]]; then
+ python_mod_cleanup "${pylibdir#${EROOT%/}}/site-packages/${pymod}"
+ fi
+ done
+ done
+ fi
+ fi
+}
+
+# @FUNCTION: distutils_get_intermediate_installation_image
+# @DESCRIPTION:
+# Print path to intermediate installation image.
+#
+# This function can be used only in distutils_src_install_pre_hook() and distutils_src_install_post_hook().
+distutils_get_intermediate_installation_image() {
+ if [[ "${EBUILD_PHASE}" != "install" ]]; then
+ die "${FUNCNAME}() can be used only in src_install() phase"
+ fi
+
+ if ! _python_package_supporting_installation_for_multiple_python_abis; then
+ die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+ fi
+
+ _python_check_python_pkg_setup_execution
+
+ if [[ ! "${FUNCNAME[1]}" =~ ^distutils_src_install_(pre|post)_hook$ ]]; then
+ die "${FUNCNAME}() can be used only in distutils_src_install_pre_hook() and distutils_src_install_post_hook()"
+ fi
+
+ if [[ "$#" -ne 0 ]]; then
+ die "${FUNCNAME}() does not accept arguments"
+ fi
+
+ echo "${T}/images/${PYTHON_ABI}"
+}
diff --git a/eclass/elisp-common.eclass b/eclass/elisp-common.eclass
new file mode 100644
index 00000000000..15177886d6b
--- /dev/null
+++ b/eclass/elisp-common.eclass
@@ -0,0 +1,415 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+#
+# @ECLASS: elisp-common.eclass
+# @MAINTAINER:
+# Gentoo GNU Emacs project <emacs@gentoo.org>
+# @AUTHOR:
+# Matthew Kennedy <mkennedy@gentoo.org>
+# Jeremy Maitin-Shepard <jbms@attbi.com>
+# Mamoru Komachi <usata@gentoo.org>
+# Christian Faulhammer <fauli@gentoo.org>
+# Ulrich Müller <ulm@gentoo.org>
+# @BLURB: Emacs-related installation utilities
+# @DESCRIPTION:
+#
+# Usually you want to use this eclass for (optional) GNU Emacs support
+# of your package. This is NOT for XEmacs!
+#
+# Many of the steps here are sometimes done by the build system of your
+# package (especially compilation), so this is mainly for standalone
+# elisp files you gathered from somewhere else.
+#
+# When relying on the emacs USE flag, you need to add
+#
+# @CODE
+# emacs? ( virtual/emacs )
+# @CODE
+#
+# to your DEPEND/RDEPEND line and use the functions provided here to
+# bring the files to the correct locations.
+#
+# If your package requires a minimum Emacs version, e.g. Emacs 24, then
+# the dependency should be on >=virtual/emacs-24 instead. Because the
+# user can select the Emacs executable with eselect, you should also
+# make sure that the active Emacs version is sufficient. This can be
+# tested with function elisp-need-emacs(), which would typically be
+# called from pkg_setup(), as in the following example:
+#
+# @CODE
+# elisp-need-emacs 24 || die "Emacs version too low"
+# @CODE
+#
+# Please note that such tests should be limited to packages that are
+# known to fail with lower Emacs versions; the standard case is to
+# depend on virtual/emacs without version.
+#
+# @ROFF .SS
+# src_compile() usage:
+#
+# An elisp file is compiled by the elisp-compile() function defined
+# here and simply takes the source files as arguments. The case of
+# interdependent elisp files is also supported, since the current
+# directory is added to the load-path which makes sure that all files
+# are loadable.
+#
+# @CODE
+# elisp-compile *.el
+# @CODE
+#
+# Function elisp-make-autoload-file() can be used to generate a file
+# with autoload definitions for the lisp functions. It takes the output
+# file name (default: "${PN}-autoloads.el") and a list of directories
+# (default: working directory) as its arguments. Use of this function
+# requires that the elisp source files contain magic ";;;###autoload"
+# comments. See the Emacs Lisp Reference Manual (node "Autoload") for
+# a detailed explanation.
+#
+# @ROFF .SS
+# src_install() usage:
+#
+# The resulting compiled files (.elc) should be put in a subdirectory of
+# /usr/share/emacs/site-lisp/ which is named after the first argument
+# of elisp-install(). The following parameters are the files to be put
+# in that directory. Usually the subdirectory should be ${PN}, you can
+# choose something else, but remember to tell elisp-site-file-install()
+# (see below) the change, as it defaults to ${PN}.
+#
+# @CODE
+# elisp-install ${PN} *.el *.elc
+# @CODE
+#
+# To let the Emacs support be activated by Emacs on startup, you need
+# to provide a site file (shipped in ${FILESDIR}) which contains the
+# startup code (have a look in the documentation of your software).
+# Normally this would look like this:
+#
+# @CODE
+# (add-to-list 'load-path "@SITELISP@")
+# (add-to-list 'auto-mode-alist '("\\.csv\\'" . csv-mode))
+# (autoload 'csv-mode "csv-mode" "Major mode for csv files." t)
+# @CODE
+#
+# If your Emacs support files are installed in a subdirectory of
+# /usr/share/emacs/site-lisp/ (which is strongly recommended), you need
+# to extend Emacs' load-path as shown in the first non-comment line.
+# The elisp-site-file-install() function of this eclass will replace
+# "@SITELISP@" and "@SITEETC@" by the actual paths.
+#
+# The next line tells Emacs to load the mode opening a file ending
+# with ".csv" and load functions depending on the context and needed
+# features. Be careful though. Commands as "load-library" or "require"
+# bloat the editor as they are loaded on every startup. When having
+# many Emacs support files, users may be annoyed by the start-up time.
+# Also avoid keybindings as they might interfere with the user's
+# settings. Give a hint in pkg_postinst(), which should be enough.
+# The guiding principle is that emerging your package should not by
+# itself cause a change of standard Emacs behaviour.
+#
+# The naming scheme for this site-init file matches the shell pattern
+# "[1-8][0-9]*-gentoo*.el", where the two digits at the beginning define
+# the loading order (numbers below 10 or above 89 are reserved for
+# internal use). So if your initialisation depends on another Emacs
+# package, your site file's number must be higher! If there are no such
+# interdependencies then the number should be 50. Otherwise, numbers
+# divisible by 10 are preferred.
+#
+# Best practice is to define a SITEFILE variable in the global scope of
+# your ebuild (e.g., right after S or RDEPEND):
+#
+# @CODE
+# SITEFILE="50${PN}-gentoo.el"
+# @CODE
+#
+# Which is then installed by
+#
+# @CODE
+# elisp-site-file-install "${FILESDIR}/${SITEFILE}"
+# @CODE
+#
+# in src_install(). Any characters after the "-gentoo" part and before
+# the extension will be stripped from the destination file's name.
+# For example, a file "50${PN}-gentoo-${PV}.el" will be installed as
+# "50${PN}-gentoo.el". If your subdirectory is not named ${PN}, give
+# the differing name as second argument.
+#
+# @ROFF .SS
+# pkg_postinst() / pkg_postrm() usage:
+#
+# After that you need to recreate the start-up file of Emacs after
+# emerging and unmerging by using
+#
+# @CODE
+# pkg_postinst() {
+# elisp-site-regen
+# }
+#
+# pkg_postrm() {
+# elisp-site-regen
+# }
+# @CODE
+#
+# When having optional Emacs support, you should prepend "use emacs &&"
+# to above calls of elisp-site-regen().
+# Don't use "has_version virtual/emacs"! When unmerging the state of
+# the emacs USE flag is taken from the package database and not from the
+# environment, so it is no problem when you unset USE=emacs between
+# merge and unmerge of a package.
+
+# @ECLASS-VARIABLE: SITELISP
+# @DESCRIPTION:
+# Directory where packages install Emacs Lisp files.
+SITELISP=/usr/share/emacs/site-lisp
+
+# @ECLASS-VARIABLE: SITEETC
+# @DESCRIPTION:
+# Directory where packages install miscellaneous (not Lisp) files.
+SITEETC=/usr/share/emacs/etc
+
+# @ECLASS-VARIABLE: EMACS
+# @DESCRIPTION:
+# Path of Emacs executable.
+EMACS=${EPREFIX}/usr/bin/emacs
+
+# @ECLASS-VARIABLE: EMACSFLAGS
+# @DESCRIPTION:
+# Flags for executing Emacs in batch mode.
+# These work for Emacs versions 18-24, so don't change them.
+EMACSFLAGS="-batch -q --no-site-file"
+
+# @ECLASS-VARIABLE: BYTECOMPFLAGS
+# @DESCRIPTION:
+# Emacs flags used for byte-compilation in elisp-compile().
+BYTECOMPFLAGS="-L ."
+
+# @FUNCTION: elisp-emacs-version
+# @RETURN: exit status of Emacs
+# @DESCRIPTION:
+# Output version of currently active Emacs.
+
+elisp-emacs-version() {
+ local version ret
+ # The following will work for at least versions 18-24.
+ echo "(princ emacs-version)" >"${T}"/emacs-version.el
+ version=$(
+ # EMACS could be a microemacs variant that ignores the -batch
+ # option and would therefore hang, waiting for user interaction.
+ # Redirecting stdin and unsetting TERM and DISPLAY will cause
+ # most of them to exit with an error.
+ unset TERM DISPLAY
+ ${EMACS} ${EMACSFLAGS} -l "${T}"/emacs-version.el </dev/null
+ )
+ ret=$?
+ rm -f "${T}"/emacs-version.el
+ if [[ ${ret} -ne 0 ]]; then
+ eerror "elisp-emacs-version: Failed to run ${EMACS}"
+ return ${ret}
+ fi
+ if [[ -z ${version} ]]; then
+ eerror "elisp-emacs-version: Could not determine Emacs version"
+ return 1
+ fi
+ echo "${version}"
+}
+
+# @FUNCTION: elisp-need-emacs
+# @USAGE: <version>
+# @RETURN: 0 if true, 1 if false, 2 if trouble
+# @DESCRIPTION:
+# Test if the eselected Emacs version is at least the major version
+# of GNU Emacs specified as argument.
+
+elisp-need-emacs() {
+ local need_emacs=$1 have_emacs
+ have_emacs=$(elisp-emacs-version) || return 2
+ einfo "Emacs version: ${have_emacs}"
+ if [[ ${have_emacs} =~ XEmacs|Lucid ]]; then
+ eerror "This package needs GNU Emacs."
+ return 1
+ fi
+ if ! [[ ${have_emacs%%.*} -ge ${need_emacs%%.*} ]]; then
+ eerror "This package needs at least Emacs ${need_emacs%%.*}."
+ eerror "Use \"eselect emacs\" to select the active version."
+ return 1
+ fi
+ return 0
+}
+
+# @FUNCTION: elisp-compile
+# @USAGE: <list of elisp files>
+# @DESCRIPTION:
+# Byte-compile Emacs Lisp files.
+#
+# This function uses GNU Emacs to byte-compile all ".el" specified by
+# its arguments. The resulting byte-code (".elc") files are placed in
+# the same directory as their corresponding source file.
+#
+# The current directory is added to the load-path. This will ensure
+# that interdependent Emacs Lisp files are visible between themselves,
+# in case they require or load one another.
+
+elisp-compile() {
+ ebegin "Compiling GNU Emacs Elisp files"
+ ${EMACS} ${EMACSFLAGS} ${BYTECOMPFLAGS} -f batch-byte-compile "$@"
+ eend $? "elisp-compile: batch-byte-compile failed" || die
+}
+
+# @FUNCTION: elisp-make-autoload-file
+# @USAGE: [output file] [list of directories]
+# @DESCRIPTION:
+# Generate a file with autoload definitions for the lisp functions.
+
+elisp-make-autoload-file() {
+ local f="${1:-${PN}-autoloads.el}" null="" page=$'\f'
+ shift
+ ebegin "Generating autoload file for GNU Emacs"
+
+ cat >"${f}" <<-EOF
+ ;;; ${f##*/} --- autoloads for ${PN}
+
+ ;;; Commentary:
+ ;; Automatically generated by elisp-common.eclass
+ ;; DO NOT EDIT THIS FILE
+
+ ;;; Code:
+ ${page}
+ ;; Local ${null}Variables:
+ ;; version-control: never
+ ;; no-byte-compile: t
+ ;; no-update-autoloads: t
+ ;; End:
+
+ ;;; ${f##*/} ends here
+ EOF
+
+ ${EMACS} ${EMACSFLAGS} \
+ --eval "(setq make-backup-files nil)" \
+ --eval "(setq generated-autoload-file (expand-file-name \"${f}\"))" \
+ -f batch-update-autoloads "${@-.}"
+
+ eend $? "elisp-make-autoload-file: batch-update-autoloads failed" || die
+}
+
+# @FUNCTION: elisp-install
+# @USAGE: <subdirectory> <list of files>
+# @DESCRIPTION:
+# Install files in SITELISP directory.
+
+elisp-install() {
+ local subdir="$1"
+ shift
+ ebegin "Installing Elisp files for GNU Emacs support"
+ ( # subshell to avoid pollution of calling environment
+ insinto "${SITELISP}/${subdir}"
+ doins "$@"
+ )
+ eend $? "elisp-install: doins failed" || die
+}
+
+# @FUNCTION: elisp-site-file-install
+# @USAGE: <site-init file> [subdirectory]
+# @DESCRIPTION:
+# Install Emacs site-init file in SITELISP directory. Automatically
+# inserts a standard comment header with the name of the package (unless
+# it is already present). Tokens @SITELISP@ and @SITEETC@ are replaced
+# by the path to the package's subdirectory in SITELISP and SITEETC,
+# respectively.
+
+elisp-site-file-install() {
+ local sf="${1##*/}" my_pn="${2:-${PN}}" ret
+ local header=";;; ${PN} site-lisp configuration"
+
+ [[ ${sf} == [0-9][0-9]*-gentoo*.el ]] \
+ || ewarn "elisp-site-file-install: bad name of site-init file"
+ [[ ${sf%-gentoo*.el} != "${sf}" ]] && sf="${sf%-gentoo*.el}-gentoo.el"
+ sf="${T}/${sf}"
+ ebegin "Installing site initialisation file for GNU Emacs"
+ [[ $1 = "${sf}" ]] || cp "$1" "${sf}"
+ sed -i -e "1{:x;/^\$/{n;bx;};/^;.*${PN}/I!s:^:${header}\n\n:;1s:^:\n:;}" \
+ -e "s:@SITELISP@:${EPREFIX}${SITELISP}/${my_pn}:g" \
+ -e "s:@SITEETC@:${EPREFIX}${SITEETC}/${my_pn}:g;\$q" "${sf}"
+ ( # subshell to avoid pollution of calling environment
+ insinto "${SITELISP}/site-gentoo.d"
+ doins "${sf}"
+ )
+ ret=$?
+ rm -f "${sf}"
+ eend ${ret} "elisp-site-file-install: doins failed" || die
+}
+
+# @FUNCTION: elisp-site-regen
+# @DESCRIPTION:
+# Regenerate the site-gentoo.el file, based on packages' site
+# initialisation files in the /usr/share/emacs/site-lisp/site-gentoo.d/
+# directory.
+
+elisp-site-regen() {
+ local sitelisp=${ROOT}${EPREFIX}${SITELISP}
+ local sf i ret=0 null="" page=$'\f'
+ local -a sflist
+
+ if [[ ${EBUILD_PHASE} = *rm && ! -e ${sitelisp}/site-gentoo.el ]]; then
+ ewarn "Refusing to create site-gentoo.el in ${EBUILD_PHASE} phase."
+ return 0
+ fi
+
+ [[ -d ${sitelisp} ]] \
+ || die "elisp-site-regen: Directory ${sitelisp} does not exist"
+
+ [[ -d ${T} ]] \
+ || die "elisp-site-regen: Temporary directory ${T} does not exist"
+
+ ebegin "Regenerating site-gentoo.el for GNU Emacs (${EBUILD_PHASE})"
+
+ for sf in "${sitelisp}"/site-gentoo.d/[0-9][0-9]*.el; do
+ [[ -r ${sf} ]] && sflist+=("${sf}")
+ done
+
+ cat <<-EOF >"${T}"/site-gentoo.el || ret=$?
+ ;;; site-gentoo.el --- site initialisation for Gentoo-installed packages
+
+ ;;; Commentary:
+ ;; Automatically generated by elisp-common.eclass
+ ;; DO NOT EDIT THIS FILE
+
+ ;;; Code:
+ EOF
+ # Use sed instead of cat here, since files may miss a trailing newline.
+ sed '$q' "${sflist[@]}" </dev/null >>"${T}"/site-gentoo.el || ret=$?
+ cat <<-EOF >>"${T}"/site-gentoo.el || ret=$?
+
+ ${page}
+ (provide 'site-gentoo)
+
+ ;; Local ${null}Variables:
+ ;; no-byte-compile: t
+ ;; buffer-read-only: t
+ ;; End:
+
+ ;;; site-gentoo.el ends here
+ EOF
+
+ if [[ ${ret} -ne 0 ]]; then
+ eend ${ret} "elisp-site-regen: Writing site-gentoo.el failed."
+ die
+ elif cmp -s "${sitelisp}"/site-gentoo.el "${T}"/site-gentoo.el; then
+ # This prevents outputting unnecessary text when there
+ # was actually no change.
+ # A case is a remerge where we have doubled output.
+ rm -f "${T}"/site-gentoo.el
+ eend
+ einfo "... no changes."
+ else
+ mv "${T}"/site-gentoo.el "${sitelisp}"/site-gentoo.el
+ eend $? "elisp-site-regen: Replacing site-gentoo.el failed" || die
+ case ${#sflist[@]} in
+ 0) [[ ${PN} = emacs-common-gentoo ]] \
+ || ewarn "... Huh? No site initialisation files found." ;;
+ 1) einfo "... ${#sflist[@]} site initialisation file included." ;;
+ *) einfo "... ${#sflist[@]} site initialisation files included." ;;
+ esac
+ fi
+
+ return 0
+}
diff --git a/eclass/elisp.eclass b/eclass/elisp.eclass
new file mode 100644
index 00000000000..6f1a6afdb14
--- /dev/null
+++ b/eclass/elisp.eclass
@@ -0,0 +1,204 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+#
+# @ECLASS: elisp.eclass
+# @MAINTAINER:
+# Gentoo GNU Emacs project <emacs@gentoo.org>
+# @AUTHOR:
+# Matthew Kennedy <mkennedy@gentoo.org>
+# Jeremy Maitin-Shepard <jbms@attbi.com>
+# Christian Faulhammer <fauli@gentoo.org>
+# Ulrich Müller <ulm@gentoo.org>
+# @BLURB: Eclass for Emacs Lisp packages
+# @DESCRIPTION:
+#
+# This eclass is designed to install elisp files of Emacs related
+# packages into the site-lisp directory. The majority of elisp packages
+# will only need to define the standard ebuild variables (like SRC_URI)
+# and optionally SITEFILE for successful installation.
+#
+# Emacs support for other than pure elisp packages is handled by
+# elisp-common.eclass where you won't have a dependency on Emacs itself.
+# All elisp-* functions are documented there.
+#
+# If the package's source is a single (in whatever way) compressed elisp
+# file with the file name ${P}.el, then this eclass will move ${P}.el to
+# ${PN}.el in src_unpack().
+
+# @ECLASS-VARIABLE: NEED_EMACS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# If you need anything different from Emacs 23, use the NEED_EMACS
+# variable before inheriting elisp.eclass. Set it to the major version
+# your package uses and the dependency will be adjusted.
+
+# @ECLASS-VARIABLE: ELISP_PATCHES
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Space separated list of patches to apply after unpacking the sources.
+# Patch files are searched for in the current working dir, WORKDIR, and
+# FILESDIR.
+
+# @ECLASS-VARIABLE: ELISP_REMOVE
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Space separated list of files to remove after unpacking the sources.
+
+# @ECLASS-VARIABLE: SITEFILE
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Name of package's site-init file. The filename must match the shell
+# pattern "[1-8][0-9]*-gentoo.el"; numbers below 10 and above 89 are
+# reserved for internal use. "50${PN}-gentoo.el" is a reasonable choice
+# in most cases.
+
+# @ECLASS-VARIABLE: ELISP_TEXINFO
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Space separated list of Texinfo sources. Respective GNU Info files
+# will be generated in src_compile() and installed in src_install().
+
+# @ECLASS-VARIABLE: DOCS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# DOCS="blah.txt ChangeLog" is automatically used to install the given
+# files by dodoc in src_install().
+
+inherit elisp-common eutils
+
+case "${EAPI:-0}" in
+ 0|1) EXPORT_FUNCTIONS src_{unpack,compile,install} \
+ pkg_{setup,postinst,postrm} ;;
+ *) EXPORT_FUNCTIONS src_{unpack,prepare,configure,compile,install} \
+ pkg_{setup,postinst,postrm} ;;
+esac
+
+DEPEND=">=virtual/emacs-${NEED_EMACS:-23}"
+RDEPEND="${DEPEND}"
+
+# @FUNCTION: elisp_pkg_setup
+# @DESCRIPTION:
+# Test if the eselected Emacs version is sufficient to fulfil the major
+# version requirement of the NEED_EMACS variable.
+
+elisp_pkg_setup() {
+ elisp-need-emacs "${NEED_EMACS:-23}"
+ case $? in
+ 0) ;;
+ 1) die "Emacs version too low" ;;
+ *) die "Could not determine Emacs version" ;;
+ esac
+}
+
+# @FUNCTION: elisp_src_unpack
+# @DESCRIPTION:
+# Unpack the sources; also handle the case of a single *.el file in
+# WORKDIR for packages distributed that way. For EAPIs without
+# src_prepare, call elisp_src_prepare.
+
+elisp_src_unpack() {
+ [[ -n ${A} ]] && unpack ${A}
+ if [[ -f ${P}.el ]]; then
+ # the "simple elisp" case with a single *.el file in WORKDIR
+ mv ${P}.el ${PN}.el || die
+ [[ -d ${S} ]] || S=${WORKDIR}
+ fi
+
+ case "${EAPI:-0}" in
+ 0|1) [[ -d ${S} ]] && cd "${S}"
+ elisp_src_prepare ;;
+ esac
+}
+
+# @FUNCTION: elisp_src_prepare
+# @DESCRIPTION:
+# Apply any patches listed in ELISP_PATCHES. Patch files are searched
+# for in the current working dir, WORKDIR, and FILESDIR.
+
+elisp_src_prepare() {
+ local patch
+ for patch in ${ELISP_PATCHES}; do
+ if [[ -f ${patch} ]]; then
+ epatch "${patch}"
+ elif [[ -f ${WORKDIR}/${patch} ]]; then
+ epatch "${WORKDIR}/${patch}"
+ elif [[ -f ${FILESDIR}/${patch} ]]; then
+ epatch "${FILESDIR}/${patch}"
+ else
+ die "Cannot find ${patch}"
+ fi
+ done
+
+ # apply any user patches
+ epatch_user
+
+ if [[ -n ${ELISP_REMOVE} ]]; then
+ rm ${ELISP_REMOVE} || die
+ fi
+}
+
+# @FUNCTION: elisp_src_configure
+# @DESCRIPTION:
+# Do nothing, because Emacs packages seldomly bring a full build system.
+
+elisp_src_configure() { :; }
+
+# @FUNCTION: elisp_src_compile
+# @DESCRIPTION:
+# Call elisp-compile to byte-compile all Emacs Lisp (*.el) files.
+# If ELISP_TEXINFO lists any Texinfo sources, call makeinfo to generate
+# GNU Info files from them.
+
+elisp_src_compile() {
+ elisp-compile *.el
+ if [[ -n ${ELISP_TEXINFO} ]]; then
+ makeinfo ${ELISP_TEXINFO} || die
+ fi
+}
+
+# @FUNCTION: elisp_src_install
+# @DESCRIPTION:
+# Call elisp-install to install all Emacs Lisp (*.el and *.elc) files.
+# If the SITEFILE variable specifies a site-init file, install it with
+# elisp-site-file-install. Also install any GNU Info files listed in
+# ELISP_TEXINFO and documentation listed in the DOCS variable.
+
+elisp_src_install() {
+ elisp-install ${PN} *.el *.elc
+ if [[ -n ${SITEFILE} ]]; then
+ elisp-site-file-install "${FILESDIR}/${SITEFILE}"
+ fi
+ if [[ -n ${ELISP_TEXINFO} ]]; then
+ set -- ${ELISP_TEXINFO}
+ set -- ${@##*/}
+ doinfo ${@/%.*/.info*} || die
+ fi
+ if [[ -n ${DOCS} ]]; then
+ dodoc ${DOCS} || die
+ fi
+ if declare -f readme.gentoo_create_doc >/dev/null; then
+ readme.gentoo_create_doc
+ fi
+}
+
+# @FUNCTION: elisp_pkg_postinst
+# @DESCRIPTION:
+# Call elisp-site-regen, in order to collect the site initialisation for
+# all installed Emacs Lisp packages in the site-gentoo.el file.
+
+elisp_pkg_postinst() {
+ elisp-site-regen
+ if declare -f readme.gentoo_print_elog >/dev/null; then
+ readme.gentoo_print_elog
+ fi
+}
+
+# @FUNCTION: elisp_pkg_postrm
+# @DESCRIPTION:
+# Call elisp-site-regen, in order to collect the site initialisation for
+# all installed Emacs Lisp packages in the site-gentoo.el file.
+
+elisp_pkg_postrm() {
+ elisp-site-regen
+}
diff --git a/eclass/embassy.eclass b/eclass/embassy.eclass
new file mode 100644
index 00000000000..a8f8e85180f
--- /dev/null
+++ b/eclass/embassy.eclass
@@ -0,0 +1,92 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# Author Olivier Fisette <ribosome@gentoo.org>
+
+# This eclass is used to install EMBASSY programs (EMBOSS add-ons).
+
+# The inheriting ebuild should provide a "DESCRIPTION", "KEYWORDS" and, if
+# necessary, add "(R|P)DEPEND"encies. Additionnaly, the inheriting ebuild's
+# name must begin by "embassy-". Also, before inheriting, the ebuild should
+# specify what version of EMBOSS is required by setting EBOV.
+
+inherit eutils multilib
+
+# The EMBASSY package name, retrieved from the inheriting ebuild's name
+EN=${PN:8}
+# The full name and version of the EMBASSY package (excluding the Gentoo
+# revision number)
+EF="$(echo ${EN} | tr "[:lower:]" "[:upper:]")-${PV}"
+
+HOMEPAGE="http://emboss.sourceforge.net/"
+LICENSE="LGPL-2 GPL-2"
+SRC_URI="ftp://emboss.open-bio.org/pub/EMBOSS/EMBOSS-${EBOV}.tar.gz
+ ftp://emboss.open-bio.org/pub/EMBOSS/${EF}.tar.gz"
+
+SLOT="0"
+IUSE="X png"
+
+DEPEND="=sci-biology/emboss-${EBOV}*
+ !<sci-biology/emboss-${EBOV}
+ X? ( x11-libs/libX11 )
+ png? ( sys-libs/zlib
+ media-libs/libpng
+ >=media-libs/gd-1.8
+ )"
+
+S=${WORKDIR}/EMBOSS-${EBOV}/embassy/${EF}
+
+embassy_src_unpack() {
+ unpack ${A}
+ mkdir EMBOSS-${EBOV}/embassy
+ mv ${EF} EMBOSS-${EBOV}/embassy/
+ cp /usr/$(get_libdir)/libplplot.la EMBOSS-${EBOV}/plplot/
+ cp /usr/$(get_libdir)/libeplplot.la EMBOSS-${EBOV}/plplot/
+ cp /usr/$(get_libdir)/libajax.la EMBOSS-${EBOV}/ajax/
+ cp /usr/$(get_libdir)/libajaxg.la EMBOSS-${EBOV}/ajax/
+ cp /usr/$(get_libdir)/libnucleus.la EMBOSS-${EBOV}/nucleus/
+ if [ -e "${FILESDIR}"/${PF}.patch ]; then
+ cd "${S}"
+ epatch "${FILESDIR}"/${PF}.patch
+ fi
+}
+
+embassy_src_compile() {
+ local PREFIX="${ROOT}/usr"
+ local EXTRA_CONF
+ ! use X && EXTRA_CONF="${EXTRA_CONF} --without-x"
+ ! use png && EXTRA_CONF="${EXTRA_CONF} --without-pngdriver"
+ ./configure \
+ "--bindir=${PREFIX}/bin" \
+ "--sbindir=${PREFIX}/sbin" \
+ "--libexecdir=${PREFIX}/libexec" \
+ "--sysconfdir=${ROOT}/etc" \
+ "--sharedstatedir=${ROOT}/var" \
+ "--localstatedir=${ROOT}/var" \
+ "--libdir=${PREFIX}/$(get_libdir)" \
+ "--includedir=${PREFIX}/include" \
+ "--datarootdir=${PREFIX}/share" \
+ "--datadir=${PREFIX}/share" \
+ "--infodir=${PREFIX}/share/info" \
+ "--localedir=${PREFIX}/share/locale" \
+ "--mandir=${PREFIX}/share/man" \
+ ${EXTRA_CONF} || die
+ emake || die "Before reporting this error as a bug, please make sure you compiled
+ EMBOSS and the EMBASSY packages with the same \"USE\" flags. Failure to
+ do so may prevent the compilation of some EMBASSY packages, or cause
+ runtime problems with some EMBASSY programs. For example, if you
+ compile EMBOSS with \"png\" support and then try to build DOMAINATRIX
+ without \"png\" support, compilation will fail when linking the binaries."
+}
+
+embassy_src_install() {
+ emake DESTDIR="${D}" install || die "Install failed"
+ dodoc AUTHORS ChangeLog NEWS README
+ dodir /usr/share
+ mv "${D}"/usr/local/share/* "${D}"/usr/share/
+ rmdir "${D}"/usr/local/share
+ rmdir "${D}"/usr/local
+}
+
+EXPORT_FUNCTIONS src_unpack src_compile src_install
diff --git a/eclass/emboss-r1.eclass b/eclass/emboss-r1.eclass
new file mode 100644
index 00000000000..3a494b9b068
--- /dev/null
+++ b/eclass/emboss-r1.eclass
@@ -0,0 +1,133 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @ECLASS: emboss-r1.eclass
+# @MAINTAINER:
+# sci-biology@gentoo.org
+# jlec@gentoo.org
+# ted.tanberry@gmail.com
+# @AUTHOR:
+# Original author: Author Olivier Fisette <ofisette@gmail.com>
+# Next gen author: Justin Lecher <jlec@gentoo.org>
+# Next gen author: Ted Tanberry <ted.tanberry@gmail.com>
+# @BLURB: Use this to easy install EMBOSS and EMBASSY programs (EMBOSS add-ons).
+# @DESCRIPTION:
+# The inheriting ebuild must set at least EAPI=5 and provide EBO_DESCRIPTION before the inherit line.
+# KEYWORDS should be set. Additionally "(R|P)DEPEND"encies and other standard
+# ebuild variables can be extended (FOO+=" bar").
+#
+# Example:
+#
+# EAPI="5"
+#
+# EBO_DESCRIPTION="applications from the CBS group"
+#
+# inherit emboss-r1
+
+# @ECLASS-VARIABLE: EBO_DESCRIPTION
+# @DESCRIPTION:
+# Should be set. Completes the generic description of the embassy module as follows:
+#
+# EMBOSS integrated version of ${EBO_DESCRIPTION},
+# e.g.
+# "EMBOSS integrated version of applications from the CBS group"
+#
+# Defaults to the upstream name of the module.
+
+# @ECLASS-VARIABLE: EBO_EXTRA_ECONF
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Extra config options passed to econf.
+
+case ${EAPI:-0} in
+ 5) ;;
+ *) die "this eclass doesn't support < EAPI 5" ;;
+esac
+
+inherit autotools-utils eutils flag-o-matic
+
+HOMEPAGE="http://emboss.sourceforge.net/"
+LICENSE="LGPL-2 GPL-2"
+
+SLOT="0"
+IUSE="mysql pdf png postgres static-libs X"
+
+DEPEND="
+ dev-libs/expat
+ dev-libs/libpcre:3
+ sci-libs/plplot
+ sys-libs/zlib
+ mysql? ( virtual/mysql )
+ pdf? ( media-libs/libharu )
+ png? ( media-libs/gd[png] )
+ postgres? ( dev-db/postgresql:= )
+ X? ( x11-libs/libXt )"
+RDEPEND="${DEPEND}"
+
+if [[ ${PN} == embassy-* ]]; then
+ EMBASSY_PACKAGE=yes
+ # The EMBASSY package name, retrieved from the inheriting ebuild's name
+ EN=${PN:8}
+ # The full name and version of the EMBASSY package (excluding the Gentoo
+ # revision number)
+ EF=$(echo ${EN} | tr "[:lower:]" "[:upper:]")-${PV}
+ : ${EBO_DESCRIPTION:=${EN}}
+ DESCRIPTION="EMBOSS integrated version of ${EBO_DESCRIPTION}"
+ SRC_URI="ftp://emboss.open-bio.org/pub/EMBOSS/${EF}.tar.gz -> embassy-${EN}-${PVR}.tar.gz"
+ DEPEND+=" >=sci-biology/emboss-6.6.0[mysql=,pdf=,png=,postgres=,static-libs=,X=]"
+
+ S="${WORKDIR}"/${EF}
+fi
+
+# @FUNCTION: emboss_src_prepare
+# @DESCRIPTION:
+# Does the following things
+#
+# 1. Renames configure.in to configure.ac, if possible
+# 2. Applies ${PATCHES[@]} and runs autotools via autotools-utils.eclass
+#
+
+emboss-r1_src_prepare() {
+ if [[ -e configure.in ]]; then
+ mv configure.{in,ac} || die
+ fi
+
+ autotools-utils_src_prepare
+}
+
+# @FUNCTION: emboss_src_configure
+# @DESCRIPTION:
+# runs econf with following options.
+#
+# $(use_with X x)
+# $(use_with png pngdriver)
+# $(use_with pdf hpdf)
+# $(use_with mysql mysql)
+# $(use_with postgres postgresql)
+# $(use_enabl