From bc9660ce32733b86e7e48d1d615cabc8efb17e05 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 2 Feb 2012 17:58:02 -0500 Subject: [PATCH] eclass/*: pull in portage/ eclasses Pull in all the eclasses that we don't have in portage-stable/. BUG=chromium-os:26016 TEST=build_packages+build_image boots x86 TEST=`cbuildbot amd64-generic-full` works TEST=`cbuildbot arm-generic-full` works TEST=`cbuildbot x86-generic-full` works TEST=`cbuildbot chromiumos-sdk` works Change-Id: I96cb773a19f2344d3df21235f347b2c7158fd143 Reviewed-on: https://gerrit.chromium.org/gerrit/16153 Reviewed-by: David James Commit-Ready: Mike Frysinger Tested-by: Mike Frysinger --- .../portage-stable/eclass/alternatives.eclass | 138 + .../portage-stable/eclass/ant-tasks.eclass | 182 ++ .../portage-stable/eclass/aolserver.eclass | 7 + .../portage-stable/eclass/apache-2.eclass | 581 ++++ .../eclass/apache-module.eclass | 237 ++ .../portage-stable/eclass/aspell-dict.eclass | 67 + .../eclass/bash-completion.eclass | 66 + .../portage-stable/eclass/bsdmk.eclass | 83 + .../portage-stable/eclass/bzr.eclass | 309 ++ .../portage-stable/eclass/cannadic.eclass | 153 + .../portage-stable/eclass/ccc.eclass | 8 + .../portage-stable/eclass/check-kernel.eclass | 7 + .../portage-stable/eclass/check-reqs.eclass | 207 ++ .../portage-stable/eclass/clutter.eclass | 64 + .../eclass/common-lisp-common-2.eclass | 80 + .../eclass/common-lisp-common-3.eclass | 82 + .../eclass/common-lisp-common.eclass | 209 ++ .../portage-stable/eclass/common-lisp.eclass | 78 + .../portage-stable/eclass/confutils.eclass | 480 +++ .../portage-stable/eclass/cron.eclass | 162 + .../portage-stable/eclass/cvs.eclass | 566 ++++ .../portage-stable/eclass/darcs.eclass | 158 + .../portage-stable/eclass/db-use.eclass | 109 + .../portage-stable/eclass/db.eclass | 130 + .../portage-stable/eclass/db4-fix.eclass | 7 + .../eclass/depend.apache.eclass | 300 ++ .../portage-stable/eclass/depend.php.eclass | 663 ++++ .../portage-stable/eclass/ebook.eclass | 7 + .../portage-stable/eclass/eclipse-ext.eclass | 242 ++ .../portage-stable/eclass/elisp-common.eclass | 367 +++ .../portage-stable/eclass/elisp.eclass | 140 + .../portage-stable/eclass/embassy-2.10.eclass | 7 + .../portage-stable/eclass/embassy-2.9.eclass | 7 + .../portage-stable/eclass/embassy.eclass | 93 + .../portage-stable/eclass/emul-libs.eclass | 7 + .../eclass/emul-linux-x86.eclass | 49 + .../eclass/enlightenment.eclass | 178 ++ .../portage-stable/eclass/fdo-mime.eclass | 35 + .../portage-stable/eclass/findlib.eclass | 56 + .../portage-stable/eclass/fixheadtails.eclass | 44 + .../portage-stable/eclass/flag-o-matic.eclass | 746 +++++ .../eclass/font-ebdftopcf.eclass | 46 + .../portage-stable/eclass/font.eclass | 184 ++ .../portage-stable/eclass/fortran.eclass | 216 ++ .../portage-stable/eclass/fox.eclass | 236 ++ .../portage-stable/eclass/freebsd.eclass | 125 + .../portage-stable/eclass/freedict.eclass | 51 + .../portage-stable/eclass/games-etmod.eclass | 7 + .../portage-stable/eclass/games-ggz.eclass | 75 + .../portage-stable/eclass/games-mods.eclass | 319 ++ .../portage-stable/eclass/games-q3mod.eclass | 144 + .../eclass/games-ut2k4mod.eclass | 7 + .../portage-stable/eclass/games.eclass | 219 ++ .../portage-stable/eclass/gdesklets.eclass | 205 ++ .../portage-stable/eclass/gems.eclass | 130 + .../portage-stable/eclass/ghc-package.eclass | 341 ++ .../portage-stable/eclass/git.eclass | 470 +++ .../eclass/gkrellm-plugin.eclass | 83 + .../portage-stable/eclass/gnat.eclass | 457 +++ .../portage-stable/eclass/gnatbuild.eclass | 693 +++++ .../eclass/gnome-python-common.eclass | 114 + .../portage-stable/eclass/gnome2-utils.eclass | 223 ++ .../portage-stable/eclass/gnome2.eclass | 150 + .../portage-stable/eclass/gnuconfig.eclass | 103 + .../portage-stable/eclass/gnustep-2.eclass | 23 + .../portage-stable/eclass/gnustep-base.eclass | 231 ++ .../portage-stable/eclass/go-mono.eclass | 132 + .../portage-stable/eclass/gpe.eclass | 116 + .../eclass/gst-plugins-bad.eclass | 121 + .../eclass/gst-plugins-base.eclass | 134 + .../eclass/gst-plugins-good.eclass | 117 + .../eclass/gst-plugins-ugly.eclass | 116 + .../portage-stable/eclass/gst-plugins.eclass | 17 + .../eclass/gst-plugins10.eclass | 81 + .../eclass/gtk-sharp-component.eclass | 7 + .../eclass/gtk-sharp-module.eclass | 534 ++++ .../eclass/haskell-cabal.eclass | 361 +++ .../portage-stable/eclass/horde.eclass | 176 ++ .../portage-stable/eclass/iiimf.eclass | 7 + .../portage-stable/eclass/java-ant-2.eclass | 491 +++ .../portage-stable/eclass/java-gnome.eclass | 7 + .../portage-stable/eclass/java-mvn-src.eclass | 65 + .../portage-stable/eclass/java-osgi.eclass | 292 ++ .../portage-stable/eclass/java-pkg-2.eclass | 174 ++ .../eclass/java-pkg-opt-2.eclass | 66 + .../eclass/java-pkg-simple.eclass | 205 ++ .../portage-stable/eclass/java-utils-2.eclass | 2772 +++++++++++++++++ .../portage-stable/eclass/java-utils.eclass | 7 + .../eclass/java-virtuals-2.eclass | 44 + .../portage-stable/eclass/java-vm-2.eclass | 214 ++ .../portage-stable/eclass/java.eclass | 16 + .../portage-stable/eclass/kde-dist.eclass | 7 + .../eclass/kde-functions.eclass | 7 + .../portage-stable/eclass/kde-meta.eclass | 7 + .../portage-stable/eclass/kde-source.eclass | 8 + .../portage-stable/eclass/kde.eclass | 7 + .../portage-stable/eclass/kde4-base.eclass | 726 +++++ .../eclass/kde4-functions.eclass | 523 ++++ .../portage-stable/eclass/kde4-meta.eclass | 712 +++++ .../portage-stable/eclass/kernel.eclass | 8 + .../eclass/latex-package.eclass | 232 ++ .../portage-stable/eclass/linux-mod.eclass | 756 +++++ .../portage-stable/eclass/mailer.eclass | 48 + .../portage-stable/eclass/makeedit.eclass | 37 + .../portage-stable/eclass/matrox.eclass | 7 + .../portage-stable/eclass/mercurial.eclass | 127 + .../portage-stable/eclass/mono.eclass | 80 + .../portage-stable/eclass/mount-boot.eclass | 80 + .../portage-stable/eclass/mozconfig-2.eclass | 67 + .../portage-stable/eclass/mozconfig-3.eclass | 71 + .../portage-stable/eclass/mozconfig.eclass | 7 + .../eclass/mozcoreconf-2.eclass | 288 ++ .../portage-stable/eclass/mozcoreconf.eclass | 272 ++ .../portage-stable/eclass/mozextension.eclass | 54 + .../eclass/mozilla-launcher.eclass | 123 + .../portage-stable/eclass/myspell.eclass | 258 ++ .../portage-stable/eclass/mysql.eclass | 1162 +++++++ .../portage-stable/eclass/mysql_fx.eclass | 211 ++ .../eclass/mythtv-plugins.eclass | 123 + .../portage-stable/eclass/mythtv.eclass | 47 + .../portage-stable/eclass/nsplugins.eclass | 47 + .../eclass/nvidia-driver.eclass | 113 + .../portage-stable/eclass/pam.eclass | 242 ++ .../portage-stable/eclass/pax-utils.eclass | 155 + .../portage-stable/eclass/pcmcia.eclass | 7 + .../portage-stable/eclass/perl-app.eclass | 26 + .../eclass/php-common-r1.eclass | 296 ++ .../eclass/php-ext-base-r1.eclass | 175 ++ .../eclass/php-ext-pecl-r1.eclass | 90 + .../eclass/php-ext-source-r1.eclass | 135 + .../portage-stable/eclass/php-ezc.eclass | 52 + .../portage-stable/eclass/php-lib-r1.eclass | 65 + .../eclass/php-pear-lib-r1.eclass | 94 + .../portage-stable/eclass/php-pear-r1.eclass | 107 + .../portage-stable/eclass/php-pear.eclass | 25 + .../portage-stable/eclass/php5_1-sapi.eclass | 7 + .../portage-stable/eclass/php5_2-sapi.eclass | 734 +++++ .../portage-stable/eclass/phpconfutils.eclass | 463 +++ .../portage-stable/eclass/poppler.eclass | 197 ++ .../portage-stable/eclass/portability.eclass | 168 + .../portage-stable/eclass/prefix.eclass | 52 + .../portage-stable/eclass/qmail.eclass | 528 ++++ .../portage-stable/eclass/qt3.eclass | 141 + .../portage-stable/eclass/qt4-build.eclass | 716 +++++ .../portage-stable/eclass/qt4.eclass | 305 ++ .../portage-stable/eclass/rox-0install.eclass | 91 + .../portage-stable/eclass/rox.eclass | 315 ++ .../portage-stable/eclass/rpm.eclass | 100 + .../portage-stable/eclass/ruby-fakegem.eclass | 339 ++ .../portage-stable/eclass/ruby-gnome2.eclass | 80 + .../eclass/ruby-ng-gnome2.eclass | 61 + .../portage-stable/eclass/ruby-ng.eclass | 441 +++ .../portage-stable/eclass/ruby.eclass | 268 ++ .../portage-stable/eclass/savedconfig.eclass | 139 + .../portage-stable/eclass/scsh.eclass | 74 + .../eclass/selinux-policy-2.eclass | 103 + .../portage-stable/eclass/sgml-catalog.eclass | 82 + .../portage-stable/eclass/ssl-cert.eclass | 244 ++ .../portage-stable/eclass/stardict.eclass | 58 + .../portage-stable/eclass/subversion.eclass | 551 ++++ .../portage-stable/eclass/sword-module.eclass | 34 + .../portage-stable/eclass/tetex-2.eclass | 7 + .../portage-stable/eclass/tetex-3.eclass | 215 ++ .../portage-stable/eclass/tetex.eclass | 248 ++ .../eclass/texlive-common.eclass | 125 + .../eclass/texlive-module.eclass | 332 ++ .../portage-stable/eclass/tla.eclass | 204 ++ .../eclass/toolchain-binutils.eclass | 399 +++ .../eclass/toolchain-funcs.eclass | 765 +++++ .../portage-stable/eclass/toolchain.eclass | 2584 +++++++++++++++ .../portage-stable/eclass/twisted.eclass | 118 + .../portage-stable/eclass/unipatch-001.eclass | 7 + .../portage-stable/eclass/vdr-plugin.eclass | 613 ++++ .../portage-stable/eclass/vim-doc.eclass | 72 + .../portage-stable/eclass/vim-plugin.eclass | 145 + .../portage-stable/eclass/vim-spell.eclass | 127 + .../portage-stable/eclass/virtualx.eclass | 150 + .../portage-stable/eclass/virtuoso.eclass | 144 + .../portage-stable/eclass/vmware-mod.eclass | 121 + .../portage-stable/eclass/vmware.eclass | 412 +++ .../portage-stable/eclass/webapp.eclass | 566 ++++ .../portage-stable/eclass/wxwidgets.eclass | 285 ++ .../portage-stable/eclass/x-modular.eclass | 657 ++++ .../portage-stable/eclass/x11.eclass | 7 + .../eclass/xemacs-elisp-common.eclass | 146 + .../portage-stable/eclass/xemacs-elisp.eclass | 55 + .../eclass/xemacs-packages.eclass | 47 + .../portage-stable/eclass/xfce4.eclass | 15 + .../portage-stable/eclass/xfce42.eclass | 7 + .../portage-stable/eclass/xfce44.eclass | 13 + .../portage-stable/eclass/xfconf.eclass | 140 + .../portage-stable/eclass/xmms-plugin.eclass | 8 + .../portage-stable/eclass/zproduct.eclass | 141 + 193 files changed, 41085 insertions(+) create mode 100644 sdk_container/src/third_party/portage-stable/eclass/alternatives.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/ant-tasks.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/aolserver.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/apache-2.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/apache-module.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/aspell-dict.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/bash-completion.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/bsdmk.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/bzr.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/cannadic.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/ccc.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/check-kernel.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/check-reqs.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/clutter.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/common-lisp-common-2.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/common-lisp-common-3.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/common-lisp-common.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/common-lisp.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/confutils.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/cron.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/cvs.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/darcs.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/db-use.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/db.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/db4-fix.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/depend.apache.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/depend.php.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/ebook.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/eclipse-ext.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/elisp-common.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/elisp.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/embassy-2.10.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/embassy-2.9.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/embassy.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/emul-libs.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/emul-linux-x86.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/enlightenment.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/fdo-mime.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/findlib.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/fixheadtails.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/flag-o-matic.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/font-ebdftopcf.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/font.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/fortran.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/fox.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/freebsd.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/freedict.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/games-etmod.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/games-ggz.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/games-mods.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/games-q3mod.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/games-ut2k4mod.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/games.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/gdesklets.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/gems.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/ghc-package.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/git.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/gkrellm-plugin.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/gnat.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/gnatbuild.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/gnome-python-common.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/gnome2-utils.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/gnome2.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/gnuconfig.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/gnustep-2.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/gnustep-base.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/go-mono.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/gpe.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/gst-plugins-bad.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/gst-plugins-base.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/gst-plugins-good.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/gst-plugins-ugly.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/gst-plugins.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/gst-plugins10.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/gtk-sharp-component.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/gtk-sharp-module.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/haskell-cabal.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/horde.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/iiimf.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/java-ant-2.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/java-gnome.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/java-mvn-src.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/java-osgi.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/java-pkg-2.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/java-pkg-opt-2.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/java-pkg-simple.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/java-utils-2.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/java-utils.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/java-virtuals-2.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/java-vm-2.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/java.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/kde-dist.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/kde-functions.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/kde-meta.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/kde-source.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/kde.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/kde4-base.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/kde4-functions.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/kde4-meta.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/kernel.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/latex-package.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/linux-mod.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/mailer.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/makeedit.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/matrox.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/mercurial.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/mono.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/mount-boot.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/mozconfig-2.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/mozconfig-3.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/mozconfig.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/mozcoreconf-2.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/mozcoreconf.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/mozextension.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/mozilla-launcher.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/myspell.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/mysql.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/mysql_fx.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/mythtv-plugins.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/mythtv.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/nsplugins.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/nvidia-driver.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/pam.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/pax-utils.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/pcmcia.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/perl-app.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/php-common-r1.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/php-ext-base-r1.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/php-ext-pecl-r1.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/php-ext-source-r1.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/php-ezc.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/php-lib-r1.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/php-pear-lib-r1.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/php-pear-r1.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/php-pear.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/php5_1-sapi.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/php5_2-sapi.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/phpconfutils.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/poppler.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/portability.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/prefix.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/qmail.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/qt3.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/qt4-build.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/qt4.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/rox-0install.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/rox.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/rpm.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/ruby-fakegem.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/ruby-gnome2.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/ruby-ng-gnome2.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/ruby-ng.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/ruby.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/savedconfig.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/scsh.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/selinux-policy-2.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/sgml-catalog.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/ssl-cert.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/stardict.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/subversion.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/sword-module.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/tetex-2.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/tetex-3.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/tetex.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/texlive-common.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/texlive-module.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/tla.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/toolchain-binutils.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/toolchain-funcs.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/toolchain.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/twisted.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/unipatch-001.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/vdr-plugin.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/vim-doc.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/vim-plugin.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/vim-spell.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/virtualx.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/virtuoso.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/vmware-mod.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/vmware.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/webapp.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/wxwidgets.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/x-modular.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/x11.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/xemacs-elisp-common.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/xemacs-elisp.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/xemacs-packages.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/xfce4.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/xfce42.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/xfce44.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/xfconf.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/xmms-plugin.eclass create mode 100644 sdk_container/src/third_party/portage-stable/eclass/zproduct.eclass diff --git a/sdk_container/src/third_party/portage-stable/eclass/alternatives.eclass b/sdk_container/src/third_party/portage-stable/eclass/alternatives.eclass new file mode 100644 index 0000000000..38a1c27465 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/alternatives.eclass @@ -0,0 +1,138 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/alternatives.eclass,v 1.15 2008/09/10 08:10:31 pva Exp $ + +# @ECLASS: alternatives.eclass +# @MAINTAINER: +# +# Original author : Alastair Tse (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 +# @DESCRIPTION: +# The symlink to be created + +# @ECLASS-VARIABLE: ALTERNATIVES +# @DESCRIPTION: +# The list of alternatives + +# @FUNCTION: alternatives_auto_makesym +# @DESCRIPTION: +# automatic deduction based on a symlink and a regex mask +alternatives_auto_makesym() { + 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 ${ROOT} because otherwise stage-building will break + ALT="$(for i in $(echo ${ROOT}${myregex}); do echo ${i#${ROOT}}; done | sort -r)" + alternatives_makesym ${SYMLINK} ${ALT} +} + +alternatives_makesym() { + local ALTERNATIVES="" + local SYMLINK="" + local alt pref + + # usage: alternatives_makesym [alternative targets..] + SYMLINK=$1 + # this trick removes the trailing / from ${ROOT} + pref=$(echo ${ROOT} | sed 's:/$::') + shift + ALTERNATIVES=$@ + + # step through given alternatives from first to last + # and if one exists, link it and finish. + + for alt in ${ALTERNATIVES}; do + 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/sdk_container/src/third_party/portage-stable/eclass/ant-tasks.eclass b/sdk_container/src/third_party/portage-stable/eclass/ant-tasks.eclass new file mode 100644 index 0000000000..41e273e24c --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/ant-tasks.eclass @@ -0,0 +1,182 @@ +# Eclass for building dev-java/ant-* packages +# +# Copyright 2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License, v2 or later +# Author Vlastimil Babka +# $Header: /var/cvsroot/gentoo-x86/eclass/ant-tasks.eclass,v 1.8 2009/02/08 16:12:16 serkan Exp $ + +# 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-begin +# @eclass-shortdesc Eclass for building dev-java/ant-* packages +# @eclass-maintainer java@gentoo.org +# +# This eclass provides functionality and default ebuild variables for building +# dev-java/ant-* packages easily. +# +# ----------------------------------------------------------------------------- + +# ----------------------------------------------------------------------------- +# @variable-preinherit ANT_TASK_JDKVER +# @variable-default 1.4 +# +# Affects the >=virtual/jdk version set in DEPEND string. Defaults to 1.4, can +# be overriden from ebuild BEFORE inheriting this eclass. +# ----------------------------------------------------------------------------- +ANT_TASK_JDKVER=${ANT_TASK_JDKVER-1.4} + +# ----------------------------------------------------------------------------- +# @variable-preinherit ANT_TASK_JREVER +# @variable-default 1.4 +# +# Affects the >=virtual/jre version set in DEPEND string. Defaults to 1.4, can +# be overriden from ebuild BEFORE inheriting this eclass. +# ----------------------------------------------------------------------------- +ANT_TASK_JREVER=${ANT_TASK_JREVER-1.4} + +# ----------------------------------------------------------------------------- +# @variable-internal ANT_TASK_NAME +# @variable-default the rest of $PN after "ant-" +# +# The name of this ant task as recognized by ant's build.xml, derived from $PN. +# ----------------------------------------------------------------------------- +ANT_TASK_NAME="${PN#ant-}" + +# ----------------------------------------------------------------------------- +# @variable-preinherit ANT_TASK_DEPNAME +# @variable-default $ANT_TASK_NAME +# +# 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}} + +# ----------------------------------------------------------------------------- +# @variable-internal ANT_TASK_PV +# @variable-default Just the number in $PV without any beta/RC suffixes +# +# 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" + GENTOO_PREFIX="mirror://gentoo" +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" +IUSE="" + +RDEPEND=">=virtual/jre-${ANT_TASK_JREVER} + ~dev-java/ant-core-${PV}" +DEPEND=">=virtual/jdk-${ANT_TASK_JDKVER} + ${RDEPEND}" + +# we need direct blockers with old ant-tasks for file collisions - bug #252324 +if version_is_at_least 1.7.1 ; then + DEPEND="${DEPEND} + !dev-java/ant-tasks" +fi + +# Would run the full ant test suite for every ant task +RESTRICT="test" + +S="${WORKDIR}/${MY_P}" + +# ------------------------------------------------------------------------------ +# @eclass-src_unpack +# +# 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 + +} + +# ------------------------------------------------------------------------------ +# @eclass-src_compile +# +# Compiles the jar with installed ant-core. +# ------------------------------------------------------------------------------ +ant-tasks_src_compile() { + ANT_TASKS="none" eant -Dbuild.dep=${ANT_TASK_NAME} jar-dep +} + +# ------------------------------------------------------------------------------ +# @eclass-src_install +# +# 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/sdk_container/src/third_party/portage-stable/eclass/aolserver.eclass b/sdk_container/src/third_party/portage-stable/eclass/aolserver.eclass new file mode 100644 index 0000000000..e7fb181f47 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/aolserver.eclass @@ -0,0 +1,7 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/aolserver.eclass,v 1.9 2009/11/30 04:19:36 abcd Exp $ + +# @DEAD +# To be removed on 2011/11/30. +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" diff --git a/sdk_container/src/third_party/portage-stable/eclass/apache-2.eclass b/sdk_container/src/third_party/portage-stable/eclass/apache-2.eclass new file mode 100644 index 0000000000..3e383c1a1f --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/apache-2.eclass @@ -0,0 +1,581 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/apache-2.eclass,v 1.20 2010/03/05 09:01:07 hollow Exp $ + +EAPI="2" + +# @ECLASS: apache-2.eclass +# @MAINTAINER: +# apache-devs@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 + +# ============================================================================== +# 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 + ldap? ( =net-nds/openldap-2* ) + selinux? ( sec-policy/selinux-apache ) + ssl? ( >=dev-libs/openssl-0.9.8f ) + !=www-servers/apache-1*" +RDEPEND="${DEPEND}" +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=worker + 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 + ebeep 10 + 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" + + if use ldap ; then + MY_CONF="${MY_CONF} --enable-authnz_ldap=${mod_type} --enable-ldap=${mod_type}" + MY_MODS="${MY_MODS} ldap authnz_ldap" + else + MY_CONF="${MY_CONF} --disable-authnz_ldap --disable-ldap" + fi + + if use ssl ; then + MY_CONF="${MY_CONF} --with-ssl=/usr --enable-ssl=${mod_type}" + MY_MODS="${MY_MODS} ssl" + else + MY_CONF="${MY_CONF} --without-ssl --disable-ssl" + fi + + if use threads || has ${MY_MPM} ${IUSE_MPMS_THREAD} ; then + MY_CONF="${MY_CONF} --enable-cgid=${mod_type}" + MY_MODS="${MY_MODS} cgid" + else + MY_CONF="${MY_CONF} --enable-cgi=${mod_type}" + MY_MODS="${MY_MODS} cgi" + 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: /usr/local/bin:/usr/bin:/bin)" + elog " SUEXEC_LOGFILE: Path to the suexec logfile (default: /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: /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="${MY_CONF} --with-suexec-safepath=${SUEXEC_SAFEPATH:-/usr/local/bin:/usr/bin:/bin}" + MY_CONF="${MY_CONF} --with-suexec-logfile=${SUEXEC_LOGFILE:-/var/log/apache2/suexec_log}" + MY_CONF="${MY_CONF} --with-suexec-bin=/usr/sbin/suexec" + MY_CONF="${MY_CONF} --with-suexec-userdir=${SUEXEC_USERDIR:-public_html}" + MY_CONF="${MY_CONF} --with-suexec-caller=${SUEXEC_CALLER:-apache}" + MY_CONF="${MY_CONF} --with-suexec-docroot=${SUEXEC_DOCROOT:-/var/www}" + MY_CONF="${MY_CONF} --with-suexec-uidmin=${SUEXEC_MINUID:-1000}" + MY_CONF="${MY_CONF} --with-suexec-gidmin=${SUEXEC_MINGID:-100}" + MY_CONF="${MY_CONF} --with-suexec-umask=${SUEXEC_UMASK:-077}" + MY_CONF="${MY_CONF} --enable-suexec=${mod_type}" + MY_MODS="${MY_MODS} suexec" + else + MY_CONF="${MY_CONF} --disable-suexec" + fi + + for x in ${IUSE_MODULES} ; do + if use apache2_modules_${x} ; then + MY_CONF="${MY_CONF} --enable-${x}=${mod_type}" + MY_MODS="${MY_MODS} ${x}" + else + MY_CONF="${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="${D}/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" + 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" + 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 "${ROOT}"etc/apache2/apache2-builtin-mods ]]; then + eerror "The previous configuration file for built-in modules" + eerror "(${ROOT}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="${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() { + # 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_GNUCONF_UPDATE=yes AT_M4DIR=build eautoreconf +} + +# @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() { + # 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 + econf \ + --includedir=/usr/include/apache2 \ + --libexecdir=/usr/$(get_libdir)/apache2/modules \ + --datadir=/var/www/localhost \ + --sysconfdir=/etc/apache2 \ + --localstatedir=/var \ + --with-mpm=${MY_MPM} \ + --with-apr=/usr \ + --with-apr-util=/usr \ + --with-pcre=/usr \ + --with-z=/usr \ + --with-port=80 \ + --with-program-name=apache2 \ + --enable-layout=Gentoo \ + ${MY_CONF} || die "econf failed!" + + 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() { + make DESTDIR="${D}" install || die "make install failed" + + # 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 hasq 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 /usr/sbin/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}:" "${D}/etc/apache2/modules.d/00_apache_manual.conf" + else + rm -f "${D}/etc/apache2/modules.d/00_apache_manual.conf" + rm -Rf "${D}/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 "${D}/var/www/localhost/error" "${D}/usr/share/apache2/error" + mv -f "${D}/var/www/localhost/icons" "${D}/usr/share/apache2/icons" + rm -rf "${D}/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 0755 ${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 "${ROOT}/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 "${ROOT}/var/www/localhost" ]] ; then + mkdir -p "${ROOT}/var/www/localhost/htdocs" + echo "

It works!

" > "${ROOT}/var/www/localhost/htdocs/index.html" + fi +} + +EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_install pkg_postinst diff --git a/sdk_container/src/third_party/portage-stable/eclass/apache-module.eclass b/sdk_container/src/third_party/portage-stable/eclass/apache-module.eclass new file mode 100644 index 0000000000..4868ad86a0 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/apache-module.eclass @@ -0,0 +1,237 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/apache-module.eclass,v 1.23 2008/03/23 12:11:52 hollow Exp $ + +# @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 +# +# LoadModule foo_module modules/mod_foo.so +# +# @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) + cd "${CD_DIR}" || 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 +} + +# @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 $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/sdk_container/src/third_party/portage-stable/eclass/aspell-dict.eclass b/sdk_container/src/third_party/portage-stable/eclass/aspell-dict.eclass new file mode 100644 index 0000000000..6334fd913e --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/aspell-dict.eclass @@ -0,0 +1,67 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/aspell-dict.eclass,v 1.41 2009/01/10 16:16:19 pva Exp $ + +# @ECLASS: aspell-dict.eclass +# @MAINTAINER: +# app-dicts@gentoo.org +# +# 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 +# @DESCRIPTION: +# Which language is the dictionary for? It's used for the DESCRIPTION of the +# package. + +# @ECLASS-VARIABLE: ASPOSTFIX +# @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 + +PROVIDE="virtual/aspell-dict" + +# @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/sdk_container/src/third_party/portage-stable/eclass/bash-completion.eclass b/sdk_container/src/third_party/portage-stable/eclass/bash-completion.eclass new file mode 100644 index 0000000000..c37c75d96a --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/bash-completion.eclass @@ -0,0 +1,66 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/bash-completion.eclass,v 1.23 2010/01/02 00:07:46 ulm Exp $ + +# @ECLASS: bash-completion.eclass +# @MAINTAINER: +# shell-tools@gentoo.org. +# +# Original author: Aaron Walker +# @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. + +# @ECLASS-VARIABLE: BASH_COMPLETION_NAME +# @DESCRIPTION: +# Install the completion script with this name (see also dobashcompletion) + +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: +# First arg, , is required and is the location of the bash-completion +# script to install. If the variable BASH_COMPLETION_NAME is set in the +# ebuild, dobashcompletion will install as +# /usr/share/bash-completion/$BASH_COMPLETION_NAME. If it is not set, +# dobashcompletion will check if a second arg [new_file] was passed, installing as +# the specified name. Failing both these checks, dobashcompletion will +# install the file as /usr/share/bash-completion/${PN}. +dobashcompletion() { + [[ -z "$1" ]] && die "usage: dobashcompletion " + [[ -z "${BASH_COMPLETION_NAME}" ]] && BASH_COMPLETION_NAME="${2:-${PN}}" + + if use bash-completion ; then + insinto /usr/share/bash-completion + newins "$1" "${BASH_COMPLETION_NAME}" || die "Failed to install $1" + fi +} + +# @FUNCTION: bash-completion_pkg_postinst +# @DESCRIPTION: +# The bash-completion pkg_postinst function, which is exported +bash-completion_pkg_postinst() { + if use bash-completion ; then + elog "In the case that you haven't yet enabled command-line completion" + elog "for ${PN}, you can run:" + elog + elog " eselect bashcomp enable ${BASH_COMPLETION_NAME:-${PN}}" + elog + elog "to install locally, or" + elog + elog " eselect bashcomp enable --global ${BASH_COMPLETION_NAME:-${PN}}" + elog + elog "to install system-wide." + fi +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/bsdmk.eclass b/sdk_container/src/third_party/portage-stable/eclass/bsdmk.eclass new file mode 100644 index 0000000000..d46a76bc82 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/bsdmk.eclass @@ -0,0 +1,83 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/bsdmk.eclass,v 1.9 2008/08/08 21:16:24 aballier Exp $ + +# @ECLASS: bsdmk.eclass +# @MAINTAINER: +# Otavio R. Piske "AngusYoung" +# Diego Pettenò +# Benigno B. Junior +# @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 + echo ".include " > ${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/sdk_container/src/third_party/portage-stable/eclass/bzr.eclass b/sdk_container/src/third_party/portage-stable/eclass/bzr.eclass new file mode 100644 index 0000000000..01e34e5fc9 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/bzr.eclass @@ -0,0 +1,309 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/bzr.eclass,v 1.8 2010/03/05 09:35:23 fauli Exp $ +# +# @ECLASS: bzr.eclass +# @MAINTAINER: +# Jorge Manuel B. S. Vicetto , +# Ulrich Mueller , +# Christian Faulhammer , +# Mark Lee , +# and anyone who wants to help +# @BLURB: This eclass provides support to use the Bazaar VCS +# @DESCRIPTION: +# The bzr.eclass provides support for apps using the Bazaar VCS +# (distributed version control system). +# The eclass was originally derived from the git eclass. +# +# Note: Just set EBZR_REPO_URI to the URI of the branch and the src_unpack() +# of this eclass will put an export of the branch in ${WORKDIR}/${PN}. + +inherit eutils + +EBZR="bzr.eclass" + +case "${EAPI:-0}" in + 0|1) EXPORT_FUNCTIONS src_unpack ;; + *) EXPORT_FUNCTIONS src_unpack src_prepare ;; +esac + +HOMEPAGE="http://bazaar-vcs.org/" +DESCRIPTION="Based on the ${EBZR} eclass" + +DEPEND=">=dev-vcs/bzr-1.5" + +# @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_FETCH_CMD +# @DESCRIPTION: +# The Bazaar command to fetch the sources. +EBZR_FETCH_CMD="bzr checkout --lightweight" + +# @ECLASS-VARIABLE: EBZR_UPDATE_CMD +# @DESCRIPTION: +# The Bazaar command to update the sources. +EBZR_UPDATE_CMD="bzr update" + +# @ECLASS-VARIABLE: EBZR_DIFF_CMD +# @DESCRIPTION: +# The Bazaar command to get the diff output. +EBZR_DIFF_CMD="bzr diff" + +# @ECLASS-VARIABLE: EBZR_EXPORT_CMD +# @DESCRIPTION: +# The Bazaar command to export a branch. +EBZR_EXPORT_CMD="bzr export" + +# @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 +# @DESCRIPTION: +# The options passed to the fetch and update commands. +EBZR_OPTIONS="${EBZR_OPTIONS:-}" + +# @ECLASS-VARIABLE: EBZR_REPO_URI +# @DESCRIPTION: +# The repository URI for the source package. +# +# @CODE +# Supported protocols: +# - http:// +# - https:// +# - sftp:// +# - rsync:// +# - lp: +# @CODE +# +# Note: lp: seems to be an alias for https://launchpad.net +EBZR_REPO_URI="${EBZR_REPO_URI:-}" + +# @ECLASS-VARIABLE: EBZR_BOOTSTRAP +# @DESCRIPTION: +# Bootstrap script or command like autogen.sh or etc. +EBZR_BOOTSTRAP="${EBZR_BOOTSTRAP:-}" + +# @ECLASS-VARIABLE: EBZR_PATCHES +# @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 bei applied before EBZR_BOOTSTRAP is processed. +# +# Patches are searched both in ${PWD} and ${FILESDIR}, if not found in either +# location, the installation dies. +EBZR_PATCHES="${EBZR_PATCHES:-}" + +# @ECLASS-VARIABLE: EBZR_REVISION +# @DESCRIPTION: +# Revision to fetch, defaults to the latest +# (see http://bazaar-vcs.org/BzrRevisionSpec or bzr help revisionspec). +# If you set this to a non-empty value, then it is recommended not to +# use a lightweight checkout (see also EBZR_FETCH_CMD). +EBZR_REVISION="${EBZR_REVISION:-}" + +# @ECLASS-VARIABLE: EBZR_CACHE_DIR +# @DESCRIPTION: +# The directory to store the source for the package, relative to +# EBZR_STORE_DIR. +# +# default: ${PN} +EBZR_CACHE_DIR="${EBZR_CACHE_DIR:-${PN}}" + +# @ECLASS-VARIABLE: EBZR_OFFLINE +# @DESCRIPTION: +# Set this variable to a non-empty value to disable the automatic updating of +# a bzr source tree. This is intended to be set outside the ebuild by users. +EBZR_OFFLINE="${EBZR_OFFLINE:-${ESCM_OFFLINE}}" + +# @FUNCTION: bzr_initial_fetch +# @DESCRIPTION: +# Retrieves the source code from a repository for the first time, via +# ${EBZR_FETCH_CMD}. +bzr_initial_fetch() { + local repository="${1}"; + local branch_dir="${2}"; + + # fetch branch + einfo "bzr fetch start -->" + einfo " repository: ${repository} => ${branch_dir}" + + ${EBZR_FETCH_CMD} ${EBZR_OPTIONS} "${repository}" "${branch_dir}" \ + || die "${EBZR}: can't branch from ${repository}." +} + +# @FUNCTION: bzr_update +# @DESCRIPTION: +# Updates the source code from a repository, via ${EBZR_UPDATE_CMD}. +bzr_update() { + local repository="${1}"; + + if [[ -n "${EBZR_OFFLINE}" ]]; then + einfo "skipping bzr update -->" + einfo " repository: ${repository}" + else + # update branch + einfo "bzr update start -->" + einfo " repository: ${repository}" + + pushd "${EBZR_BRANCH_DIR}" > /dev/null + ${EBZR_UPDATE_CMD} ${EBZR_OPTIONS} \ + || die "${EBZR}: can't update from ${repository}." + popd > /dev/null + fi +} + +# @FUNCTION: bzr_fetch +# @DESCRIPTION: +# Wrapper function to fetch sources from a Bazaar repository via bzr +# fetch or bzr update, depending on whether there is an existing +# working copy in ${EBZR_BRANCH_DIR}. +bzr_fetch() { + local EBZR_BRANCH_DIR + + # EBZR_REPO_URI is empty. + [[ ${EBZR_REPO_URI} ]] || die "${EBZR}: EBZR_REPO_URI is empty." + + # check for the protocol or pull from a local repo. + if [[ -z ${EBZR_REPO_URI%%:*} ]] ; then + case ${EBZR_REPO_URI%%:*} in + # lp: seems to be an alias to https://launchpad.net + http|https|rsync|lp) + ;; + sftp) + if ! built_with_use --missing true dev-vcs/bzr sftp; then + eerror "To fetch sources from ${EBZR_REPO_URI} you need SFTP" + eerror "support in dev-vcs/bzr." + die "Please, rebuild dev-vcs/bzr with the sftp USE flag enabled." + fi + ;; + *) + die "${EBZR}: fetch from ${EBZR_REPO_URI%:*} is not yet implemented." + ;; + esac + fi + + if [[ ! -d ${EBZR_STORE_DIR} ]] ; then + debug-print "${FUNCNAME}: initial branch. Creating bzr directory" + local save_sandbox_write=${SANDBOX_WRITE} + 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}" + + EBZR_BRANCH_DIR="${EBZR_STORE_DIR}/${EBZR_CACHE_DIR}" + + addwrite "${EBZR_STORE_DIR}" + addwrite "${EBZR_BRANCH_DIR}" + + debug-print "${FUNCNAME}: EBZR_OPTIONS = ${EBZR_OPTIONS}" + + # Run bzr_initial_fetch() only if the branch has not been pulled + # before or if the existing local copy is a full checkout (as did + # an older version of bzr.eclass) + if [[ ! -d ${EBZR_BRANCH_DIR} ]] ; then + bzr_initial_fetch "${EBZR_REPO_URI}" "${EBZR_BRANCH_DIR}" + elif [[ ${EBZR_FETCH_CMD} == *lightweight* \ + && -d ${EBZR_BRANCH_DIR}/.bzr/repository ]]; then + einfo "Re-fetching the branch to save space..." + rm -rf "${EBZR_BRANCH_DIR}" + bzr_initial_fetch "${EBZR_REPO_URI}" "${EBZR_BRANCH_DIR}" + else + bzr_update "${EBZR_REPO_URI}" "${EBZR_BRANCH_DIR}" + fi + + cd "${EBZR_BRANCH_DIR}" + + einfo "exporting ..." + + if [[ -z ${EBZR_REVISION} ]]; then + rsync -rlpgo --exclude=".bzr/" . "${WORKDIR}/${P}" \ + || die "${EBZR}: export failed" + else + # revisions of a lightweight checkout are only available when online + [[ -z ${EBZR_OFFLINE} || -d ${EBZR_BRANCH_DIR}/.bzr/repository ]] \ + || die "${EBZR}: No support for revisions when off-line" + ${EBZR_EXPORT_CMD} -r "${EBZR_REVISION}" "${WORKDIR}/${P}" \ + || die "${EBZR}: export failed" + fi + + 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 + + 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(). Includes bzr_fetch() and bootstrap(). +bzr_src_unpack() { + if ! [ -z ${EBZR_BRANCH} ]; then + # This test will go away on 01 Jul 2010 + eerror "This ebuild uses EBZR_BRANCH which is not supported anymore" + eerror "by the bzr.eclass. Please report this to the ebuild's maintainer." + die "EBZR_BRANCH still defined" + fi + bzr_fetch || die "${EBZR}: unknown problem in bzr_fetch()." + case "${EAPI:-0}" in + 0|1) bzr_src_prepare ;; + esac +} + +# @FUNCTION: bzr_src_prepare +# @DESCRIPTION: +# Default src_prepare(). Executes bzr_bootstrap() for patch +# application and Make file generation (if needed). +bzr_src_prepare() { + bzr_bootstrap || die "${EBZR}: unknown problem in bzr_bootstrap()." +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/cannadic.eclass b/sdk_container/src/third_party/portage-stable/eclass/cannadic.eclass new file mode 100644 index 0000000000..be603e185d --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/cannadic.eclass @@ -0,0 +1,153 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/cannadic.eclass,v 1.15 2008/09/10 08:15:48 pva Exp $ + +# @ECLASS: cannadic.eclass +# @MAINTAINER: +# ??? +# +# Original author: Mamoru KOMACHI +# @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="" + +DESCRIPTION="Based on the $ECLASS eclass" +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 . +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/sdk_container/src/third_party/portage-stable/eclass/ccc.eclass b/sdk_container/src/third_party/portage-stable/eclass/ccc.eclass new file mode 100644 index 0000000000..703f2fb189 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/ccc.eclass @@ -0,0 +1,8 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/ccc.eclass,v 1.23 2010/01/11 20:26:53 armin76 Exp $ + +# @DEAD +# To be removed on 2012/01/11 +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" + diff --git a/sdk_container/src/third_party/portage-stable/eclass/check-kernel.eclass b/sdk_container/src/third_party/portage-stable/eclass/check-kernel.eclass new file mode 100644 index 0000000000..fcc442f0d9 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/check-kernel.eclass @@ -0,0 +1,7 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/check-kernel.eclass,v 1.9 2009/11/30 04:19:36 abcd Exp $ + +# @DEAD +# To be removed on 2011/11/30. +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" diff --git a/sdk_container/src/third_party/portage-stable/eclass/check-reqs.eclass b/sdk_container/src/third_party/portage-stable/eclass/check-reqs.eclass new file mode 100644 index 0000000000..c21be0dc36 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/check-reqs.eclass @@ -0,0 +1,207 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/check-reqs.eclass,v 1.6 2008/04/11 13:52:55 zlin Exp $ + +# @ECLASS: check-reqs.eclass +# @MAINTAINER: +# Bo Ørsted Andresen +# +# Original Author: Ciaran McCreesh +# @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(). +# +# From a user perspective, the variable CHECKREQS_ACTION can be set to: +# * "warn" (default), which will display a warning and wait for 15s +# * "error", which will make the ebuild error out +# * "ignore", which will not take any action +# +# 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. +# +# For ebuild authors: only use this eclass if you reaaalllllly have stupidly +# high build requirements. At an absolute minimum, you shouldn't be using this +# unless the ebuild needs >256MBytes RAM or >1GByte temporary or install space. +# The code should look something like: +# +# @CODE +# pkg_setup() { +# # values in MBytes +# +# # need this much memory (does *not* check swap) +# CHECKREQS_MEMORY="256" +# +# # need this much temporary build space +# CHECKREQS_DISK_BUILD="2048" +# +# # install will need this much space in /usr +# CHECKREQS_DISK_USR="1024" +# +# # install will need this much space in /var +# CHECKREQS_DISK_VAR="1024" +# +# # go! +# check_reqs +# } +# @CODE +# +# Alternatively, the check_reqs_conditional function can be used to carry out +# alternate actions (e.g. using a much slower but far less memory intensive +# build option that gives the same end result). +# +# You should *not* override the user's CHECKREQS_ACTION setting, nor should you +# attempt to provide a value if it is unset. Note that the environment variables +# are used rather than parameters for a few reasons: +# * easier to do if use blah ; then things +# * we might add in additional requirements things later +# 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 +# @DESCRIPTION: +# How much RAM is needed in MB? + +# @ECLASS-VARIABLE: CHECKREQS_DISK_BUILD +# @DESCRIPTION: +# How much diskspace is needed to build the package? In MB + +# @ECLASS-VARIABLE: CHECKREQS_DISK_USR +# @DESCRIPTION: +# How much space in /usr is needed to install the package? In MB + +# @ECLASS-VARIABLE: CHECKREQS_DISK_VAR +# @DESCRIPTION: +# How much space is needed in /var? In MB + +# @FUNCTION: check_reqs +# @DESCRIPTION: +# Checks the requirements given in the specific variables. If not reached, +# either prints a warning or dies. +check_reqs() { + [[ -n "${1}" ]] && die "Usage: check_reqs" + + export CHECKREQS_NEED_SLEEP="" CHECKREQS_NEED_DIE="" + if [[ "$CHECKREQS_ACTION" != "ignore" ]] ; then + [[ -n "$CHECKREQS_MEMORY" ]] && check_build_memory + [[ -n "$CHECKREQS_DISK_BUILD" ]] && check_build_disk \ + "${T}" "\${T}" "${CHECKREQS_DISK_BUILD}" + [[ -n "$CHECKREQS_DISK_USR" ]] && check_build_disk \ + "${ROOT}/usr" "\${ROOT}/usr" "${CHECKREQS_DISK_USR}" + [[ -n "$CHECKREQS_DISK_VAR" ]] && check_build_disk \ + "${ROOT}/var" "\${ROOT}/var" "${CHECKREQS_DISK_VAR}" + fi + + if [[ -n "${CHECKREQS_NEED_SLEEP}" ]] ; then + echo + ewarn "Bad things may happen! You may abort the build by pressing ctrl+c in" + ewarn "the next 15 seconds." + ewarn " " + einfo "To make this kind of warning a fatal error, add a line to /etc/make.conf" + einfo "setting CHECKREQS_ACTION=\"error\". To skip build requirements checking," + einfo "set CHECKREQS_ACTION=\"ignore\"." + epause 15 + fi + + if [[ -n "${CHECKREQS_NEED_DIE}" ]] ; then + eerror "Bailing out as specified by CHECKREQS_ACTION" + die "Build requirements not met" + fi +} + +# @FUNCTION: check_reqs_conditional +# @RETURN: True if requirements check passed, else False +# @DESCRIPTION: +# Checks the requirements given in the specific variables +check_reqs_conditional() { + [[ -n "${1}" ]] && die "Usage: check_reqs" + + export CHECKREQS_NEED_SLEEP="" CHECKREQS_NEED_DIE="" + if [[ "$CHECKREQS_ACTION" != "ignore" ]] ; then + [[ -n "$CHECKREQS_MEMORY" ]] && check_build_memory + [[ -n "$CHECKREQS_DISK_BUILD" ]] && check_build_disk \ + "${T}" "\${T}" "${CHECKREQS_DISK_BUILD}" + [[ -n "$CHECKREQS_DISK_USR" ]] && check_build_disk \ + "${ROOT}/usr" "\${ROOT}/usr" "${CHECKREQS_DISK_USR}" + [[ -n "$CHECKREQS_DISK_VAR" ]] && check_build_disk \ + "${ROOT}/var" "\${ROOT}/var" "${CHECKREQS_DISK_VAR}" + fi + + [[ -z "${CHECKREQS_NEED_SLEEP}" && -z "${CHECKREQS_NEED_DIE}" ]] +} + +# internal use only! +check_build_memory() { + [[ -n "${1}" ]] && die "Usage: check_build_memory" + check_build_msg_begin "${CHECKREQS_MEMORY}" "MBytes" "RAM" + if [[ -r /proc/meminfo ]] ; then + actual_memory=$(sed -n -e '/MemTotal:/s/^[^:]*: *\([0-9]\+\) kB/\1/p' \ + /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 * ${CHECKREQS_MEMORY})) ]] ; then + eend 1 + check_build_msg_ick "${CHECKREQS_MEMORY}" "MBytes" "RAM" + else + eend 0 + fi + else + eend 1 + ewarn "Couldn't determine amount of memory, skipping ..." + fi +} + +# internal use only! +check_build_disk() { + [[ -z "${3}" ]] && die "Usage: check_build_disk where name needed" + check_build_msg_begin "${3}" "MBytes" \ + "disk space at ${2}" + actual_space=$(df -Pm ${1} 2>/dev/null | sed -n \ + '$s/\(\S\+\s\+\)\{3\}\([0-9]\+\).*/\2/p' 2>/dev/null ) + if [[ "$?" == "0" && -n "${actual_space}" ]] ; then + if [[ ${actual_space} -lt ${3} ]] ; then + eend 1 + check_build_msg_ick "${3}" "MBytes" \ + "disk space at ${2}" + else + eend 0 + fi + else + eend 1 + ewarn "Couldn't figure out disk space, skipping ..." + fi +} + +# internal use only! +check_build_msg_begin() { + ebegin "Checking for at least ${1}${2} ${3}" +} + +# internal use only! +check_build_msg_skip() { + ewarn "Skipping check for at least ${1}${2} ${3}" +} + +# internal use only! +check_build_msg_ick() { + if [[ "${CHECKREQS_ACTION}" == "error" ]] ; then + eerror "Don't have at least ${1}${2} ${3}" + echo + export CHECKREQS_NEED_DIE="yes" + else + ewarn "Don't have at least ${1}${2} ${3}" + echo + export CHECKREQS_NEED_SLEEP="yes" + fi +} + diff --git a/sdk_container/src/third_party/portage-stable/eclass/clutter.eclass b/sdk_container/src/third_party/portage-stable/eclass/clutter.eclass new file mode 100644 index 0000000000..06332704ef --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/clutter.eclass @@ -0,0 +1,64 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/clutter.eclass,v 1.1 2010/02/26 21:15:55 nirbheek Exp $ + +# +# @ECLASS: clutter.eclass +# @MAINTAINER: GNOME Herd +# +# @BLURB: Sets SRC_URI, LICENSE, etc and exports src_install +# +# Authors: +# Nirbheek Chauhan +# + +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 +LICENSE="LGPL-2" + +# This will be used by all clutter packages +DEPEND="dev-util/pkgconfig" + +# @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 +# @USAGE: +# @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 hasq 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 +} + +EXPORT_FUNCTIONS src_install diff --git a/sdk_container/src/third_party/portage-stable/eclass/common-lisp-common-2.eclass b/sdk_container/src/third_party/portage-stable/eclass/common-lisp-common-2.eclass new file mode 100644 index 0000000000..574be2027f --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/common-lisp-common-2.eclass @@ -0,0 +1,80 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/common-lisp-common-2.eclass,v 1.3 2009/09/18 15:35:50 hkbst Exp $ +# +# Author Matthew Kennedy +# +# Sundry code common to many Common Lisp related ebuilds. + +# Some handy constants + +inherit eutils + +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/sdk_container/src/third_party/portage-stable/eclass/common-lisp-common-3.eclass b/sdk_container/src/third_party/portage-stable/eclass/common-lisp-common-3.eclass new file mode 100644 index 0000000000..f493ab7dbc --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/common-lisp-common-3.eclass @@ -0,0 +1,82 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/common-lisp-common-3.eclass,v 1.2 2009/09/18 15:35:50 hkbst Exp $ +# +# Author Matthew Kennedy +# +# 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 + +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/sdk_container/src/third_party/portage-stable/eclass/common-lisp-common.eclass b/sdk_container/src/third_party/portage-stable/eclass/common-lisp-common.eclass new file mode 100644 index 0000000000..0f3dc0cd06 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/common-lisp-common.eclass @@ -0,0 +1,209 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/common-lisp-common.eclass,v 1.13 2009/09/18 15:35:50 hkbst Exp $ +# +# Author Matthew Kennedy +# +# Sundry code common to many Common Lisp related ebuilds. + +# Some handy constants + +inherit eutils + +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 <&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 <&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 + # 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/sdk_container/src/third_party/portage-stable/eclass/common-lisp.eclass b/sdk_container/src/third_party/portage-stable/eclass/common-lisp.eclass new file mode 100644 index 0000000000..35408d6f34 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/common-lisp.eclass @@ -0,0 +1,78 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/common-lisp.eclass,v 1.13 2005/07/11 15:08:06 swegener Exp $ +# +# Author Matthew Kennedy +# +# 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/sdk_container/src/third_party/portage-stable/eclass/confutils.eclass b/sdk_container/src/third_party/portage-stable/eclass/confutils.eclass new file mode 100644 index 0000000000..38f104272a --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/confutils.eclass @@ -0,0 +1,480 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/confutils.eclass,v 1.22 2008/02/27 09:53:04 hollow Exp $ + +# @ECLASS: confutils.eclass +# @MAINTAINER: +# Benedikt Böhm +# @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 + +inherit eutils + +DESCRIPTION="Based on the ${ECLASS} eclass" + +# @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: [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: [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: [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: [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: [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: [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: [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: [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: [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: [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: [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: [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: [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: [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: [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: [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: [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/sdk_container/src/third_party/portage-stable/eclass/cron.eclass b/sdk_container/src/third_party/portage-stable/eclass/cron.eclass new file mode 100644 index 0000000000..0ac655a07a --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/cron.eclass @@ -0,0 +1,162 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/cron.eclass,v 1.12 2008/06/26 10:51:41 bangert Exp $ + +# @ECLASS: cron +# @MAINTAINER: +# cron-bugs@gentoo.org +# +# Original Author: Aaron Walker +# @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="!virtual/cron + virtual/mta + >=sys-process/cronbase-0.3.2" + +PROVIDE="virtual/cron" + +# @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/sdk_container/src/third_party/portage-stable/eclass/cvs.eclass b/sdk_container/src/third_party/portage-stable/eclass/cvs.eclass new file mode 100644 index 0000000000..ca5ee5270d --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/cvs.eclass @@ -0,0 +1,566 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/cvs.eclass,v 1.70 2008/04/27 07:00:40 ulm Exp $ + +# @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. + +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_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. + +# @ECLASS-VARIABLE: ECVS_CVS_COMPRESS +# @DESCRIPTION: +# Set the compression level. +[[ -z ${ECVS_CVS_COMPRESS} ]] && ECVS_CVS_COMPRESS="-z1" + +# @ECLASS-VARIABLE: ECVS_CVS_OPTIONS +# @DESCRIPTION: +# Additional options to the cvs commands. +[[ -z ${ECVS_CVS_OPTIONS} ]] && ECVS_CVS_OPTIONS="-q -f" + +# @ECLASS-VARIABLE: ECVS_CVS_COMMAND +# @DESCRIPTION: +# The cvs command. +[[ -z ${ECVS_CVS_COMMAND} ]] && 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. +[ -z "$ECVS_UP_OPTS" ] && ECVS_UP_OPTS="-dP" + +# @ECLASS-VARIABLE: ECVS_CO_OPTS +# @DESCRIPTION: +# CVS options given after the cvs checkout command. +[ -z "$ECVS_CO_OPTS" ] && ECVS_CO_OPTS="" + + +# @ECLASS-VARIABLE: ECVS_LOCAL +# @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 +# @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. +[ -z "$ECVS_TOP_DIR" ] && 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). +[ -z "$ECVS_SERVER" ] && ECVS_SERVER="offline" + +# @ECLASS-VARIABLE: ECVS_MODULE +# @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_BRANCH +# @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. + +#[ -z "$ECVS_BRANCH" ] && 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 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 ) +[ -z "$ECVS_AUTH" ] && ECVS_AUTH="pserver" + +# @ECLASS-VARIABLE: ECVS_USER +# @DESCRIPTION: +# Username to use for authentication on the remote server. +[ -z "$ECVS_USER" ] && ECVS_USER="anonymous" + +# @ECLASS-VARIABLE: ECVS_PASS +# @DESCRIPTION: +# Password to use for authentication on the remote server +[ -z "$ECVS_PASS" ] && ECVS_PASS="" + +# @ECLASS-VARIABLE: ECVS_SSH_HOST_KEY +# @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 +# @DESCRIPTION: +# Set this to get a clean copy when updating (passes the +# -C option to cvs update) + +# @ECLASS-VARIABLE: ECVS_RUNAS +# @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. + +# [ -z "$ECVS_RUNAS" ] && ECVS_RUNAS="`whoami`" + +# ECVS_SUBDIR -- deprecated, do not use +[ -n "$ECVS_SUBDIR" ] && die "ERROR: deprecated ECVS_SUBDIR defined. Please fix this ebuild." + +# add cvs to deps +# ssh is used for ext auth +# sudo is used to run as a specified user +DEPEND="dev-util/cvs" + +[ -n "$ECVS_RUNAS" ] && DEPEND="$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="${DEPEND} net-misc/openssh" +fi + +# called from cvs_src_unpack +cvs_fetch() { + + # 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="$ECVS_UP_OPTS -l" + ECVS_CO_OPTS="$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="$ECVS_UP_OPTS -r$ECVS_BRANCH" + ECVS_CO_OPTS="$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="$ECVS_CO_OPTS -d $ECVS_LOCALNAME" + fi + + + if [ -n "$ECVS_CLEAN" ]; then + ECVS_UP_OPTS="$ECVS_UP_OPTS -C" + 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="`/bin/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 + if [ "$ECVS_AUTH" == "no" ] + then + local server="${ECVS_USER}@${ECVS_SERVER}" + else + local connection="${ECVS_AUTH}" + [[ -n ${ECVS_PROXY} ]] && connection="${connection};proxy=${ECVS_PROXY}" + [[ -n ${ECVS_PROXY_PORT} ]] && connection="${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 ..." + 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 + cvsroot_pass=":${ECVS_AUTH}:${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=":${ECVS_AUTH}:${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}"< + 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('/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) + + [ -z "${DISPLAY}" ] && 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}" + + if [ -z "$ECVS_LOCALNAME" ]; then + ECVS_LOCALNAME="$ECVS_MODULE" + fi + + 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 [ "${!offline_pkg_var}" == "1" -o "$ECVS_OFFLINE" == "1" -o "$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 + + # 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 diff --git a/sdk_container/src/third_party/portage-stable/eclass/darcs.eclass b/sdk_container/src/third_party/portage-stable/eclass/darcs.eclass new file mode 100644 index 0000000000..02e8ad17fb --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/darcs.eclass @@ -0,0 +1,158 @@ +# Copyright 2004 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/darcs.eclass,v 1.7 2008/05/14 18:13:14 kolmodin Exp $ +# +# darcs eclass author: Andres Loeh +# tla eclass author: +# Original Author: Jeffrey Yasskin +# +# Originally derived from the tla eclass, which is derived from the +# cvs eclass. +# +# This eclass provides the generic darcs fetching functions. +# to use from an ebuild, set the 'ebuild-configurable settings' below in your +# ebuild before inheriting. then either leave the default src_unpack or extend +# over darcs_src_unpack. + +# Most of the time, you will define only $EDARCS_REPOSITORY in your +# ebuild. + +# TODO: support for tags, ... + +# 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 +[ -z "$EDARCS_DARCS_CMD" ] && EDARCS_DARCS_CMD="darcs" + +# darcs commands with command-specific options +[ -z "$EDARCS_GET_CMD" ] && EDARCS_GET_CMD="get --partial" +[ -z "$EDARCS_UPDATE_CMD" ] && EDARCS_UPDATE_CMD="pull" + +# options to pass to both the "get" and "update" commands +[ -z "$EDARCS_OPTIONS" ] && EDARCS_OPTIONS="--set-scripts-executable" + +# Where the darcs repositories are stored/accessed +[ -z "$EDARCS_TOP_DIR" ] && EDARCS_TOP_DIR="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/darcs-src" + +# The URI to the repository. +[ -z "$EDARCS_REPOSITORY" ] && EDARCS_REPOSITORY="" + + +# EDARCS_CLEAN: set this to something to get a clean copy when updating +# (removes the working directory, then uses $EDARCS_GET_CMD to +# re-download it.) + +# --- end ebuild-configurable settings --- + +# add darcs to deps +DEPEND="dev-util/darcs" + +# 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 + 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" + eval $cmdget || die "darcs get command failed" + elif [ "${mode}" == "update" ]; then + einfo "Running $cmdupdate" + eval $cmdupdate || die "darcs update command failed" + fi + + popd +} + + +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##*/} + local EDARCS_SHOPT + + 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}" + + EDARCS_SHOPT=$(shopt -p dotglob) + shopt -s dotglob # get any dotfiles too. + rsync -rlpgo --exclude="_darcs/" "$EDARCS_TOP_DIR/$EDARCS_LOCALREPO"/* "${WORKDIR}/${P}" + eval ${EDARCS_SHOPT} # reset shopt + + einfo "Darcs repository contents are now in ${WORKDIR}/${P}" + +} + +EXPORT_FUNCTIONS src_unpack diff --git a/sdk_container/src/third_party/portage-stable/eclass/db-use.eclass b/sdk_container/src/third_party/portage-stable/eclass/db-use.eclass new file mode 100644 index 0000000000..8d81602464 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/db-use.eclass @@ -0,0 +1,109 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/db-use.eclass,v 1.8 2009/11/24 05:24:20 robbat2 Exp $ +# This is a common location for functions that aid the use of sys-libs/db +# +# Bugs: pauldv@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 + echo -n "${1/.0/}" +} + +#Find the version that correspond to the given atom +db_findver() { + 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 /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() { + 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 "/usr/include/db${VER}" ]; then + echo -n "/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 "/usr/include/db$(db_ver_to_slot $VER)" ]; then + echo -n "/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() { + if [ $# -eq 0 ]; then + VER="$(db_findver sys-libs/db)" || return 1 + if [ -e "/usr/$(get_libdir)/libdb-${VER}.so" ]; 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 "/usr/$(get_libdir)/libdb-${VER}.so" ]; then + echo -n "db-${VER}" + return 0 + fi + fi + done + eerror "No suitable db version found" >&2 + return 1 + fi +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/db.eclass b/sdk_container/src/third_party/portage-stable/eclass/db.eclass new file mode 100644 index 0000000000..02e5fb0182 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/db.eclass @@ -0,0 +1,130 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/db.eclass,v 1.31 2009/07/29 20:25:25 pauldv Exp $ +# This is a common location for functions used in the sys-libs/db ebuilds +# +# Bugs: pauldv@gentoo.org + +IUSE="doc test" + +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 libdb_tcl libdb_java; 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 libdb_tcl libdb_java; 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 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_usrbinslot() { + # slot all program names to avoid overwriting + for fname in ${D}/usr/bin/db_* + do + mv ${fname} ${fname//\/db_/\/db${SLOT}_} + 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.h ${D}/usr/include/db_185.h ${LIB}/libdb.a ${LIB}/libdb_cxx.a +} + +db_src_test() { + if useq tcl; then + einfo "Running sys-libs/db testsuite" + ewarn "This can take 6+ hours on modern machines" + cd ${S} + echo 'source ../test/test.tcl' >testrunner.tcl + echo '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/sdk_container/src/third_party/portage-stable/eclass/db4-fix.eclass b/sdk_container/src/third_party/portage-stable/eclass/db4-fix.eclass new file mode 100644 index 0000000000..0a0b2ed97d --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/db4-fix.eclass @@ -0,0 +1,7 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/db4-fix.eclass,v 1.7 2009/11/30 04:19:36 abcd Exp $ + +# @DEAD +# To be removed on 2011/11/30. +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" diff --git a/sdk_container/src/third_party/portage-stable/eclass/depend.apache.eclass b/sdk_container/src/third_party/portage-stable/eclass/depend.apache.eclass new file mode 100644 index 0000000000..a8d06e8b3f --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/depend.apache.eclass @@ -0,0 +1,300 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/depend.apache.eclass,v 1.45 2009/05/26 16:41:56 arfrever Exp $ + +# @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*" + +# ============================================================================== +# 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: 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: [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/sdk_container/src/third_party/portage-stable/eclass/depend.php.eclass b/sdk_container/src/third_party/portage-stable/eclass/depend.php.eclass new file mode 100644 index 0000000000..003ac46a41 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/depend.php.eclass @@ -0,0 +1,663 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/depend.php.eclass,v 1.25 2008/02/26 16:26:08 armin76 Exp $ + +# Author: Stuart Herbert +# Author: Luca Longinotti +# Author: Jakub Moc (documentation) + +# @ECLASS: depend.php.eclass +# @MAINTAINER: +# Gentoo PHP team +# @BLURB: Functions to allow ebuilds to depend on php[45] and check for specific features. +# @DESCRIPTION: +# This eclass provides functions that allow ebuilds to depend on php[45] and check +# for specific PHP features, SAPIs etc. Also provides dodoc-php wrapper to install +# documentation for PHP packages to php-specific location. + + +inherit eutils phpconfutils + +# PHP4-only depend functions + +# @FUNCTION: need_php4_cli +# @DESCRIPTION: +# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP4 +# with cli SAPI. +need_php4_cli() { + DEPEND="${DEPEND} =virtual/php-4*" + RDEPEND="${RDEPEND} =virtual/php-4*" + PHP_VERSION="4" +} + +# @FUNCTION: need_php4_httpd +# @DESCRIPTION: +# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP4 +# with either cgi or apache2 SAPI. +need_php4_httpd() { + DEPEND="${DEPEND} =virtual/httpd-php-4*" + RDEPEND="${RDEPEND} =virtual/httpd-php-4*" + PHP_VERSION="4" +} + +# @FUNCTION: need_php4 +# @DESCRIPTION: +# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP4 +# (with any SAPI). +need_php4() { + DEPEND="${DEPEND} =dev-lang/php-4*" + RDEPEND="${RDEPEND} =dev-lang/php-4*" + PHP_VERSION="4" + PHP_SHARED_CAT="php4" +} + +# common settings go in here +uses_php4() { + # cache this + libdir=$(get_libdir) + + PHPIZE="/usr/${libdir}/php4/bin/phpize" + PHPCONFIG="/usr/${libdir}/php4/bin/php-config" + PHPCLI="/usr/${libdir}/php4/bin/php" + PHPCGI="/usr/${libdir}/php4/bin/php-cgi" + PHP_PKG="$(best_version =dev-lang/php-4*)" + PHPPREFIX="/usr/${libdir}/php4" + EXT_DIR="$(${PHPCONFIG} --extension-dir 2>/dev/null)" + + einfo + einfo "Using ${PHP_PKG}" + einfo +} + +# PHP5-only depend functions + +# @FUNCTION: need_php5_cli +# @DESCRIPTION: +# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP5 +# with cli SAPI. +need_php5_cli() { + DEPEND="${DEPEND} =virtual/php-5*" + RDEPEND="${RDEPEND} =virtual/php-5*" + PHP_VERSION="5" +} + +# @FUNCTION: need_php5_httpd +# @DESCRIPTION: +# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP5 +# with either cgi or apache2 SAPI. +need_php5_httpd() { + DEPEND="${DEPEND} =virtual/httpd-php-5*" + RDEPEND="${RDEPEND} =virtual/httpd-php-5*" + PHP_VERSION="5" +} + +# @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_cli +# @DESCRIPTION: +# Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP +# (any version) with cli SAPI. +need_php_cli() { + DEPEND="${DEPEND} virtual/php" + RDEPEND="${RDEPEND} virtual/php" +} + +# @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: need_php_by_category +# @DESCRIPTION: +# Set this after setting DEPEND/RDEPEND in your ebuild to depend on PHP version +# determined by ${CATEGORY} - any PHP version, PHP4 or PHP5 for dev-php, dev-php4 and +# dev-php5, respectively. +need_php_by_category() { + case "${CATEGORY}" in + dev-php) need_php ;; + dev-php4) need_php4 ;; + dev-php5) need_php5 ;; + *) die "Version of PHP required by packages in category ${CATEGORY} unknown" + esac +} + + +# @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" + elif has_version '=dev-lang/php-4*' ; then + PHP_VERSION="4" + 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_sapi_from +# @USAGE: +# @DESCRIPTION: +# Call this function from pkg_setup if your package only works with +# specific SAPI(s) and specify a list of PHP SAPI USE flags that are +# required (one or more from cli, cgi, apache2) as arguments. +# Returns if any of the listed SAPIs have been installed, dies if none +# of them is available. +# +# Unfortunately, if you want to be really sure that the required SAPI is +# provided by PHP, you will have to use this function or similar ones (like +# require_php_cli or require_php_cgi) in pkg_setup until we are able to +# depend on USE flags being enabled. The above described need_php[45]_cli +# and need_php[45]_httpd functions cannot guarantee these requirements. +# See Bug 2272 for details. +require_php_sapi_from() { + has_php + + local has_sapi="0" + local x + + einfo "Checking for compatible SAPI(s)" + + for x in $@ ; do + if built_with_use =${PHP_PKG} ${x} || phpconfutils_built_with_use =${PHP_PKG} ${x} ; then + einfo " Discovered compatible SAPI ${x}" + has_sapi="1" + fi + done + + if [[ "${has_sapi}" == "1" ]] ; then + return + fi + + eerror + eerror "${PHP_PKG} needs to be re-installed with one of the following" + eerror "USE flags enabled:" + eerror + eerror " $@" + eerror + die "No compatible PHP SAPIs found" +} + +# @FUNCTION: require_php_with_use +# @USAGE: +# @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 + if ! built_with_use =${PHP_PKG} ${x} && ! phpconfutils_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 +} + +# @FUNCTION: require_php_with_any_use +# @USAGE: +# @DESCRIPTION: +# Call this function from pkg_setup if your package requires PHP compiled with +# any of specified USE flags. Returns if any of the listed USE flags are enabled. +# Dies if all of the listed USE flags are disabled. +require_php_with_any_use() { + has_php + + local missing_use="" + local x + + einfo "Checking for required PHP feature(s) ..." + + for x in $@ ; do + if built_with_use =${PHP_PKG} ${x} || phpconfutils_built_with_use =${PHP_PKG} ${x} ; then + einfo " USE flag ${x} is enabled, ok ..." + return + else + 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 any of the following" + eerror "USE flags enabled:" + eerror + eerror " $@" + eerror + die "Missing PHP USE flags found" + else + return 1 + fi +} + +# ======================================================================== +# has_*() functions +# +# These functions return 0 if the condition is satisfied, 1 otherwise +# ======================================================================== + +# @FUNCTION: has_zts +# @DESCRIPTION: +# Check if our PHP was compiled with ZTS (Zend Thread Safety) enabled. +# @RETURN: 0 if true, 1 otherwise +has_zts() { + has_php + + if built_with_use =${PHP_PKG} apache2 threads || phpconfutils_built_with_use =${PHP_PKG} apache2 threads ; then + return 0 + fi + + return 1 +} + +# @FUNCTION: has_debug +# @DESCRIPTION: +# Check if our PHP was built with debug support enabled. +# @RETURN: 0 if true, 1 otherwise +has_debug() { + has_php + + if built_with_use =${PHP_PKG} debug || phpconfutils_built_with_use =${PHP_PKG} debug ; then + return 0 + fi + + return 1 +} + +# @FUNCTION: has_concurrentmodphp +# @DESCRIPTION: +# Check if our PHP was built with the concurrentmodphp support enabled. +# @RETURN: 0 if true, 1 otherwise +has_concurrentmodphp() { + has_php + + if built_with_use =${PHP_PKG} apache2 concurrentmodphp || phpconfutils_built_with_use =${PHP_PKG} apache2 concurrentmodphp ; then + return 0 + fi + + return 1 +} + +# ======================================================================== +# require_*() functions +# +# These functions die() if PHP was built without the required features +# ======================================================================== + +# @FUNCTION: require_pdo +# @DESCRIPTION: +# Require a PHP built with PDO support (PHP5 only). +# This function is now redundant and DEPRECATED since +# pdo-external use flag and pecl-pdo-* ebuilds were removed. +# You should use require_php_with_use pdo instead now. +# @RETURN: die if feature is missing +require_pdo() { + has_php + + # Do we have PHP5 installed? + if [[ "${PHP_VERSION}" == "4" ]] ; then + eerror + eerror "This package requires PDO." + eerror "PDO is only available for PHP 5." + eerror "You must install >=dev-lang/php-5.1 with USE=\"pdo\"." + eerror "pdo USE flags turned on." + eerror + die "PHP 5 not installed" + fi + + # Was PHP5 compiled with internal PDO support? + if built_with_use =${PHP_PKG} pdo || phpconfutils_built_with_use =${PHP_PKG} pdo ; then + return + else + eerror + eerror "No PDO extension for PHP found." + eerror "Please note that PDO only exists for PHP 5." + eerror "Please install a PDO extension for PHP 5." + eerror "You must install >=dev-lang/php-5.1 with USE=\"pdo\"." + eerror + die "No PDO extension for PHP 5 found" + fi +} + +# @FUNCTION: require_php_cli +# @DESCRIPTION: +# Determines which installed PHP version has the CLI SAPI enabled. +# Useful for PEAR stuff, or anything which needs to run PHP script +# depending on the CLI SAPI. +# @RETURN: die if feature is missing +require_php_cli() { + # 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="" + + # Detect which PHP version we have installed + if has_version '=dev-lang/php-4*' ; then + PHP_PACKAGE_FOUND="1" + pkg="$(best_version '=dev-lang/php-4*')" + if built_with_use =${pkg} cli || phpconfutils_built_with_use =${pkg} cli ; then + PHP_VERSION="4" + fi + fi + + if has_version '=dev-lang/php-5*' ; then + PHP_PACKAGE_FOUND="1" + pkg="$(best_version '=dev-lang/php-5*')" + if built_with_use =${pkg} cli || phpconfutils_built_with_use =${pkg} cli ; 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 CLI installed. Re-emerge dev-lang/php with USE=cli." + 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_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="" + + # Detect which PHP version we have installed + if has_version '=dev-lang/php-4*' ; then + PHP_PACKAGE_FOUND="1" + pkg="$(best_version '=dev-lang/php-4*')" + if built_with_use =${pkg} cgi || phpconfutils_built_with_use =${pkg} cgi ; then + PHP_VERSION="4" + fi + fi + + 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 || phpconfutils_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} +} + +# @FUNCTION: require_sqlite +# @DESCRIPTION: +# Require a PHP built with SQLite support +# @RETURN: die if feature is missing +require_sqlite() { + has_php + + # Has our PHP been built with SQLite support? + if built_with_use =${PHP_PKG} sqlite || phpconfutils_built_with_use =${PHP_PKG} sqlite ; then + return + fi + + # Do we have pecl-sqlite installed for PHP4? + if [[ "${PHP_VERSION}" == "4" ]] ; then + if has_version 'dev-php4/pecl-sqlite' ; then + return + fi + fi + + # If we get here, then we don't have any SQLite support for PHP installed + eerror + eerror "No SQLite extension for PHP found." + eerror "Please install an SQLite extension for PHP," + eerror "this is done best by simply adding the" + eerror "'sqlite' USE flag when emerging dev-lang/php." + eerror + die "No SQLite extension for PHP found" +} + +# @FUNCTION: require_gd +# @DESCRIPTION: +# Require a PHP built with GD support +# @RETURN: die if feature is missing +require_gd() { + has_php + + # Do we have the internal GD support installed? + if built_with_use =${PHP_PKG} gd || phpconfutils_built_with_use =${PHP_PKG} gd ; then + return + fi + + # Ok, maybe GD was built using the external library support? + if built_with_use =${PHP_PKG} gd-external || phpconfutils_built_with_use =${PHP_PKG} gd-external ; then + return + fi + + # If we get here, then we have no GD support + eerror + eerror "No GD support for PHP found." + eerror "Please install the GD support for PHP," + eerror "you must install dev-lang/php with either" + eerror "the 'gd' or the 'gd-external' USE flags" + eerror "turned on." + eerror + die "No GD support found for PHP" +} + +# ======================================================================== +# Misc functions +# +# These functions provide miscellaneous checks and functionality. +# ======================================================================== + +# @FUNCTION: php_binary_extension +# @DESCRIPTION: +# Executes some checks needed when installing a binary PHP extension. +php_binary_extension() { + has_php + + local PUSE_ENABLED="" + + # Binary extensions do not support the change of PHP + # API version, so they can't be installed when USE flags + # are enabled which change the PHP API version, they also + # don't provide correctly versioned symbols for our use + + if has_debug ; then + eerror + eerror "You cannot install binary PHP extensions" + eerror "when the 'debug' USE flag is enabled!" + eerror "Please reemerge dev-lang/php with the" + eerror "'debug' USE flag turned off." + eerror + PUSE_ENABLED="1" + fi + + if has_concurrentmodphp ; then + eerror + eerror "You cannot install binary PHP extensions when" + eerror "the 'concurrentmodphp' USE flag is enabled!" + eerror "Please reemerge dev-lang/php with the" + eerror "'concurrentmodphp' USE flag turned off." + eerror + PUSE_ENABLED="1" + fi + + if [[ -n ${PUSE_ENABLED} ]] ; then + die "'debug' and/or 'concurrentmodphp' USE flags turned on!" + fi +} + +# @FUNCTION: dodoc-php +# @USAGE: +# @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: +# @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/sdk_container/src/third_party/portage-stable/eclass/ebook.eclass b/sdk_container/src/third_party/portage-stable/eclass/ebook.eclass new file mode 100644 index 0000000000..bc30336d4a --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/ebook.eclass @@ -0,0 +1,7 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/ebook.eclass,v 1.27 2009/11/30 04:19:36 abcd Exp $ + +# @DEAD +# To be removed on 2011/11/30. +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" diff --git a/sdk_container/src/third_party/portage-stable/eclass/eclipse-ext.eclass b/sdk_container/src/third_party/portage-stable/eclass/eclipse-ext.eclass new file mode 100644 index 0000000000..6c33a21bee --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/eclipse-ext.eclass @@ -0,0 +1,242 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/eclipse-ext.eclass,v 1.13 2006/04/17 03:47:44 nichoj Exp $ + +# Original Author: Karl Trygve Kalleberg +# Maintainers: +# Development Tools Team +# Java Team + +inherit eutils multilib + + +# Must be listed in oldest->newest order! +known_eclipse_slots="2 3 3.1" + +# These should not be reinitialized if previously set +# (check allows require-slot in pkg_setup) + +[ -z "${eclipse_ext_type}" ] && \ + eclipse_ext_type="source" + +[ -z "${eclipse_ext_slot}" ] && \ + eclipse_ext_slot="0" + +[ -z "${eclipse_ext_basedir}" ] && \ + eclipse_ext_basedir="/usr/$(get_libdir)/eclipse-extensions-${eclipse_ext_slot}/eclipse" + +[ -z "${eclipse_ext_platformdir}" ] && \ + eclipse_ext_platformdir="/usr/$(get_libdir)/eclipse-${eclipse_ext_slot}" + +# --------------------------------------------------------------------------- +# @private _find-optimum-slot +# +# Look for a given SLOT. If not found return the least highest SLOT +# available. +# +# @param $1 - SLOT of Eclipse SDK that is most desired +# @return 0 - all is well, non-zero otherwise +# --------------------------------------------------------------------------- +function _find-optimum-slot { + local found=false + + for x in ${known_eclipse_slots} ; do + if [ "$1" == "$x" ] ; then + found=true + fi + if [ "${found}" == "true" ] && [ -d /usr/$(get_libdir)/eclipse-${x} ] ; then + echo $x + return 0 + fi + done + echo "" + return 1 +} + +# --------------------------------------------------------------------------- +# @public require-slot +# +# Ensure that an Eclipse SDK is actually available for the given slot; +# sets internal state to install for selected slot. +# +# @param $1 - SLOT of Eclipse SDK that required for this ebuild +# alternatively +# @return 0 - all is well, non-zero otherwise +# --------------------------------------------------------------------------- +function eclipse-ext_require-slot { + + local slot=$(_find-optimum-slot $1) + + if [ -z "${slot}" ] ; then + eerror "Cannot find any Eclipse SDK supporting slot $1" + return 1 + fi + + if [ "${slot}" != "$1" ] ; then + ewarn "Slot $1 could not be satisfied, installing for ${slot} instead" + fi + + eclipse_ext_slot=${slot} + eclipse_ext_basedir="/usr/$(get_libdir)/eclipse-extensions-${eclipse_ext_slot}/eclipse" + eclipse_ext_platformdir="/usr/$(get_libdir)/eclipse-${eclipse_ext_slot}" + + return 0 +} + +# --------------------------------------------------------------------------- +# @public create-plugin-layout +# +# Create directory infrastructure for binary-only plugins so that the installed +# Eclipse SDK will see them. Sets internal state for installing as source or +# binary. +# +# @param $1 - type of ebuild, "source" or "binary" +# @return - nothing +# --------------------------------------------------------------------------- +function eclipse-ext_create-ext-layout { + local type=$1 + if [ "${type}" == "binary" ] ; then + eclipse_ext_basedir="/opt/eclipse-extensions-${eclipse_ext_slot}/eclipse" + dodir ${eclipse_ext_basedir}/{features,plugins} + touch ${D}/${eclipse_ext_basedir}/.eclipseextension + else + eclipse_ext_basedir="/usr/$(get_libdir)/eclipse-extensions-${eclipse_ext_slot}/eclipse" + dodir ${eclipse_ext_basedir}/{features,plugins} + touch ${D}/${eclipse_ext_basedir}/.eclipseextension + fi +} + +# --------------------------------------------------------------------------- +# @public install-features +# +# Installs one or multiple features into the plugin directory for the required +# Eclipse SDK. +# +# Note: You must call require-slot prior to calling install-features. If your +# ebuild is for a binary-only plugin, you must also call create-plugin-layout +# prior to calling install-features. +# +# @param $* - feature directories +# @return 0 - if all is well +# 1 - if require-slot was not called +# --------------------------------------------------------------------------- +function eclipse-ext_install-features { + if [ ${eclipse_ext_slot} == 0 ] ; then + eerror "You must call require-slot prior to calling ${FUNCNAME}!" + return 1 + fi + + for x in $* ; do + if [ -d "$x" ] && [ -f $x/feature.xml ] ; then + cp -a $x ${D}/${eclipse_ext_basedir}/features + else + eerror "$x not a feature directory!" + fi + done +} + +# --------------------------------------------------------------------------- +# @public install-plugins +# +# Installs one or multiple plugins into the plugin directory for the required +# Eclipse SDK. +# +# Note: You must call require-slot prior to calling install-features. If your +# ebuild is for a binary-only plugin, you must also call create-plugin-layout +# prior to calling install-features. +# +# @param $* - plugin directories +# @return - nothing +# --------------------------------------------------------------------------- + +function eclipse-ext_install-plugins { + if [ ${eclipse_ext_slot} == 0 ] ; then + eerror "You must call require-slot prior to calling ${FUNCNAME}!" + return 1 + fi + + for x in $* ; do + if [ -d "$x" ] && ( [ -f "$x/plugin.xml" ] || [ -f "$x/fragment.xml" ] ) ; then + cp -a $x ${D}/${eclipse_ext_basedir}/plugins + else + eerror "$x not a plugin directory!" + fi + done +} + +# TODO really should have a page hosted on gentoo's infra +function eclipse-ext_pkg_postinst() { + einfo "For tips, tricks and general info on running Eclipse on Gentoo, go to:" + einfo "http://gentoo-wiki.com/Eclipse" +} + +# --------------------------------------------------------------------------- +# @public get-classpath +# +# Tries to parse out a classpath string from a build.properties file. Is very +# stupid: Assumes it's a one-liner on the form classpath = comma:separated: +# +# @param $1 - name of the file (typically build.properties) +# @param $2 - name of the one-liner env var (default 'classpath') +# @return - echo of space-separated classpath entries. +# --------------------------------------------------------------------------- + +eclipse-ext_get-classpath() { + local file=$1 + local envvar="classpath" + + if [ "$1" == "build.properties" ] ; then + if [ ! -z "$2" ] ; then + envvar="$2" + fi + fi + + echo "$(cat ${FILESDIR}/build.properties-${PV} | sed "s/.*=//" | tr ';' ' ')" +} + +_path-dissecter() { + echo $1 | sed -r "s/.*\/([^/]+)_([0-9.]+)\/(.*)/\\${2}/" +} + +_get-plugin-name() { + _path-dissecter $1 1 +} + +_get-plugin-version() { + _path-dissecter $1 2 +} + +_get-plugin-content() { + _path-dissecter $1 3 +} + +# --------------------------------------------------------------------------- +# @public resolve-jars +# +# Takes a space-separated list of plugin_version/subdirs/file.jar entries and +# tries to resolve the version for the plugin against the chosen eclipse version +# (set by require-slot). +# +# Note: You must call require-slot prior to calling resolve-jars. +# +# @param $1 - string with space-separated plugin/jarfile +# @return - echo of :-separated resolved files +# --------------------------------------------------------------------------- +eclipse-ext_resolve-jars() { + local resolved="" + + for x in $1 ; do + local jarfile=$(_get-plugin-content $x) + local name="$(_get-plugin-name $x)" + local x=$(echo ${eclipse_ext_platformdir}/plugins/${name}_*/${jarfile}) + if [ -f ${x} ] ; then + resolved="${resolved}:$x" + else + : + #echo "Warning: did not find ${name}" + fi + done + echo ${resolved} +} + +EXPORT_FUNCTIONS pkg_postinst diff --git a/sdk_container/src/third_party/portage-stable/eclass/elisp-common.eclass b/sdk_container/src/third_party/portage-stable/eclass/elisp-common.eclass new file mode 100644 index 0000000000..7b21db63ac --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/elisp-common.eclass @@ -0,0 +1,367 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/elisp-common.eclass,v 1.65 2009/12/29 20:15:12 ulm Exp $ +# +# Copyright 2002-2004 Matthew Kennedy +# Copyright 2003 Jeremy Maitin-Shepard +# Copyright 2004-2005 Mamoru Komachi +# Copyright 2007-2008 Christian Faulhammer +# Copyright 2007-2009 Ulrich Müller +# +# @ECLASS: elisp-common.eclass +# @MAINTAINER: +# Feel free to contact the Emacs team through if you +# have problems, suggestions or questions. +# @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 +# +# emacs? ( virtual/emacs ) +# +# to your DEPEND/RDEPEND line and use the functions provided here to +# bring the files to the correct locations. +# +# .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. +# +# elisp-compile *.el || die +# +# 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. +# +# .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}. +# +# elisp-install ${PN} *.el *.elc || die +# +# 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: +# +# (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) +# +# 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 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! +# +# Best practice is to define a SITEFILE variable in the global scope of +# your ebuild (e.g., right after S or RDEPEND): +# +# SITEFILE="50${PN}-gentoo.el" +# +# Which is then installed by +# +# elisp-site-file-install "${FILESDIR}/${SITEFILE}" || die +# +# 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. +# +# .SS +# pkg_postinst() / pkg_postrm() usage: +# +# After that you need to recreate the start-up file of Emacs after +# emerging and unmerging by using +# +# pkg_postinst() { +# elisp-site-regen +# } +# +# pkg_postrm() { +# elisp-site-regen +# } +# +# 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. +# +# .SS +# Miscellaneous functions: +# +# elisp-emacs-version() outputs the version of the currently active Emacs. + +# @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-23, 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-compile +# @USAGE: +# @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" +} + +elisp-comp() { + die "Function elisp-comp is not supported any more, see bug 235442" +} + +# @FUNCTION: elisp-emacs-version +# @DESCRIPTION: +# Output version of currently active Emacs. + +elisp-emacs-version() { + # The following will work for at least versions 18-23. + echo "(princ emacs-version)" >"${T}"/emacs-version.el + ${EMACS} ${EMACSFLAGS} -l "${T}"/emacs-version.el + rm -f "${T}"/emacs-version.el +} + +# @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 ${P} + + ;;; 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" +} + +# @FUNCTION: elisp-install +# @USAGE: +# @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" +} + +# @FUNCTION: elisp-site-file-install +# @USAGE: [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="${T}/${sf/%-gentoo*.el/-gentoo.el}" + 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" +} + +# @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. +# +# Note: Before December 2007, site initialisation files were installed +# in /usr/share/emacs/site-lisp/. For backwards compatibility, this +# location is still supported when generating site-gentoo.el. + +elisp-site-regen() { + local sitelisp=${ROOT}${EPREFIX}${SITELISP} + local sf i line null="" page=$'\f' + local -a sflist + + if [ ! -d "${sitelisp}" ]; then + eerror "elisp-site-regen: Directory ${sitelisp} does not exist" + return 1 + fi + + if [ ! -d "${T}" ]; then + eerror "elisp-site-regen: Temporary directory ${T} does not exist" + return 1 + fi + + einfon "Regenerating site-gentoo.el for GNU Emacs (${EBUILD_PHASE}) ..." + + # Until January 2009, elisp-common.eclass sometimes created an + # auxiliary file for backwards compatibility. Remove any such file. + rm -f "${sitelisp}"/00site-gentoo.el + + # set nullglob option, there may be a directory without matching files + local old_shopts=$(shopt -p nullglob) + shopt -s nullglob + + for sf in "${sitelisp}"/[0-9][0-9]*-gentoo.el \ + "${sitelisp}"/site-gentoo.d/[0-9][0-9]*.el + do + [ -r "${sf}" ] || continue + # sort files by their basename. straight insertion sort. + for ((i=${#sflist[@]}; i>0; i--)); do + [[ ${sf##*/} < ${sflist[i-1]##*/} ]] || break + sflist[i]=${sflist[i-1]} + done + sflist[i]=${sf} + done + + eval "${old_shopts}" + + cat <<-EOF >"${T}"/site-gentoo.el + ;;; 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[@]}" >"${T}"/site-gentoo.el + cat <<-EOF >>"${T}"/site-gentoo.el + + (provide 'site-gentoo) + + ${page} + ;; Local ${null}Variables: + ;; no-byte-compile: t + ;; buffer-read-only: t + ;; End: + + ;;; site-gentoo.el ends here + EOF + + if 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. + echo " no changes." + else + mv "${T}"/site-gentoo.el "${sitelisp}"/site-gentoo.el + echo + case ${#sflist[@]} in + 0) ewarn "... Huh? No site initialisation files found." ;; + 1) einfo "... ${#sflist[@]} site initialisation file included." ;; + *) einfo "... ${#sflist[@]} site initialisation files included." ;; + esac + fi + + # cleanup + rm -f "${T}"/site-gentoo.el + + return 0 +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/elisp.eclass b/sdk_container/src/third_party/portage-stable/eclass/elisp.eclass new file mode 100644 index 0000000000..3238c559cf --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/elisp.eclass @@ -0,0 +1,140 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/elisp.eclass,v 1.44 2010/01/30 22:54:00 ulm Exp $ +# +# Copyright 2002-2003 Matthew Kennedy +# Copyright 2003 Jeremy Maitin-Shepard +# Copyright 2007-2009 Christian Faulhammer +# Copyright 2007-2010 Ulrich Müller +# +# @ECLASS: elisp.eclass +# @MAINTAINER: +# Feel free to contact the Emacs team through if you +# have problems, suggestions or questions. +# @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 +# @DESCRIPTION: +# If you need anything different from Emacs 21, 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 +# @DESCRIPTION: +# Any patches to apply after unpacking the sources. Patches are searched +# both in ${PWD} and ${FILESDIR}. + +# @ECLASS-VARIABLE: SITEFILE +# @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 +# @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 +# @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:-21}" +RDEPEND="${DEPEND}" +IUSE="" + +elisp_pkg_setup() { + local need_emacs=${NEED_EMACS:-21} + local have_emacs=$(elisp-emacs-version) + if [ "${have_emacs%%.*}" -lt "${need_emacs%%.*}" ]; then + eerror "This package needs at least Emacs ${need_emacs%%.*}." + eerror "Use \"eselect emacs\" to select the active version." + die "Emacs version ${have_emacs} is too low." + fi + einfo "Emacs version: ${have_emacs}" +} + +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 +} + +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 +} + +elisp_src_configure() { :; } + +elisp_src_compile() { + elisp-compile *.el || die + if [ -n "${ELISP_TEXINFO}" ]; then + makeinfo ${ELISP_TEXINFO} || die + fi +} + +elisp_src_install() { + elisp-install ${PN} *.el *.elc || die + if [ -n "${SITEFILE}" ]; then + elisp-site-file-install "${FILESDIR}/${SITEFILE}" || die + fi + if [ -n "${ELISP_TEXINFO}" ]; then + set -- ${ELISP_TEXINFO} + doinfo ${@/%.*/.info*} || die + fi + if [ -n "${DOCS}" ]; then + dodoc ${DOCS} || die + fi +} + +elisp_pkg_postinst() { + elisp-site-regen +} + +elisp_pkg_postrm() { + elisp-site-regen +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/embassy-2.10.eclass b/sdk_container/src/third_party/portage-stable/eclass/embassy-2.10.eclass new file mode 100644 index 0000000000..db05f42329 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/embassy-2.10.eclass @@ -0,0 +1,7 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/embassy-2.10.eclass,v 1.8 2009/11/30 04:19:36 abcd Exp $ + +# @DEAD +# To be removed on 2011/11/30. +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" diff --git a/sdk_container/src/third_party/portage-stable/eclass/embassy-2.9.eclass b/sdk_container/src/third_party/portage-stable/eclass/embassy-2.9.eclass new file mode 100644 index 0000000000..9ebc79bfb6 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/embassy-2.9.eclass @@ -0,0 +1,7 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/embassy-2.9.eclass,v 1.10 2009/11/30 04:19:36 abcd Exp $ + +# @DEAD +# To be removed on 2011/11/30. +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" diff --git a/sdk_container/src/third_party/portage-stable/eclass/embassy.eclass b/sdk_container/src/third_party/portage-stable/eclass/embassy.eclass new file mode 100644 index 0000000000..92c0659546 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/embassy.eclass @@ -0,0 +1,93 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/embassy.eclass,v 1.17 2008/11/03 22:17:50 ribosome Exp $ + +# Author Olivier Fisette + +# 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}" + +DESCRIPTION="Based on the $ECLASS eclass" +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}* + !=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/sdk_container/src/third_party/portage-stable/eclass/emul-libs.eclass b/sdk_container/src/third_party/portage-stable/eclass/emul-libs.eclass new file mode 100644 index 0000000000..a7d016728e --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/emul-libs.eclass @@ -0,0 +1,7 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/emul-libs.eclass,v 1.9 2010/01/14 21:46:51 abcd Exp $ + +# @DEAD +# Scheduled for removal on 2012/01/14. +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" diff --git a/sdk_container/src/third_party/portage-stable/eclass/emul-linux-x86.eclass b/sdk_container/src/third_party/portage-stable/eclass/emul-linux-x86.eclass new file mode 100644 index 0000000000..9085e36578 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/emul-linux-x86.eclass @@ -0,0 +1,49 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/emul-linux-x86.eclass,v 1.5 2010/02/22 20:52:52 pacho Exp $ + +# +# Original Author: Mike Doty +# Adapted from emul-libs.eclass +# Purpose: Providing a template for the app-emulation/emul-linux-* packages +# + +EXPORT_FUNCTIONS src_unpack src_install + +SRC_URI="mirror://gentoo/${PN}-${PV}.tar.bz2" + +DESCRIPTION="Provides precompiled 32bit libraries" +#HOMEPAGE="http://amd64.gentoo.org/emul/content.xml" +HOMEPAGE="http://dev.gentoo.org/~pacho/emul.html" + +RESTRICT="strip" +S=${WORKDIR} + +SLOT="0" +IUSE="" + +DEPEND=">=sys-apps/findutils-4.2.26" +RDEPEND="" + +emul-linux-x86_src_unpack() { + unpack ${A} + cd "${S}" + + ALLOWED=${ALLOWED:-^${S}/etc/env.d} + find "${S}" ! -type d ! -name '*.so*' | egrep -v "${ALLOWED}" | xargs -d $'\n' rm -f || die 'failed to remove everything but *.so*' +} + +emul-linux-x86_src_install() { + for dir in etc/env.d etc/revdep-rebuild ; do + if [[ -d "${S}"/${dir} ]] ; then + for f in "${S}"/${dir}/* ; do + mv -f "$f"{,-emul} + done + fi + done + + # remove void directories + find "${S}" -depth -type d -print0 | xargs -0 rmdir 2&>/dev/null + + cp -pPR "${S}"/* "${D}"/ || die "copying files failed!" +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/enlightenment.eclass b/sdk_container/src/third_party/portage-stable/eclass/enlightenment.eclass new file mode 100644 index 0000000000..c874826587 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/enlightenment.eclass @@ -0,0 +1,178 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/enlightenment.eclass,v 1.81 2010/02/28 10:52:06 tommy Exp $ +# +# Author: vapier@gentoo.org + +inherit eutils libtool + +# E_STATE's: +# release [default] +# KEYWORDS arch +# SRC_URI $P.tar.gz +# S $WORKDIR/$P +# +# snap $PV has .200##### datestamp or .### counter +# KEYWORDS ~arch +# SRC_URI $P.tar.bz2 +# S $WORKDIR/$P +# +# live $PV has a 9999 marker +# KEYWORDS "" +# SRC_URI cvs/svn/etc... up +# S $WORKDIR/$E_S_APPEND +# +# Overrides: +# KEYWORDS EKEY_STATE +# SRC_URI EURI_STATE +# S EURI_STATE + +#E_LIVE_DEFAULT_CVS="cvs.sourceforge.net:/cvsroot/enlightenment" +E_LIVE_SERVER_DEFAULT_CVS="anoncvs.enlightenment.org:/var/cvs/e" +E_LIVE_SERVER_DEFAULT_SVN="http://svn.enlightenment.org/svn/e/trunk" + +E_STATE="release" +if [[ ${PV/9999} != ${PV} ]] ; then + E_LIVE_SERVER=${E_LIVE_SERVER:-${E_LIVE_SERVER_DEFAULT_SVN}} + E_STATE="live" + WANT_AUTOTOOLS="yes" + + # force people to opt-in to legacy cvs + if [[ -n ${ECVS_MODULE} ]] ; then + ECVS_SERVER=${ECVS_SERVER:-${E_LIVE_SERVER_DEFAULT_CVS}} + E_LIVE_SOURCE="cvs" + E_S_APPEND=${ECVS_MODULE} + inherit cvs + else + ESVN_URI_APPEND=${ESVN_URI_APPEND:-${PN}} + ESVN_PROJECT="enlightenment/${ESVN_SUB_PROJECT}" + ESVN_REPO_URI=${ESVN_SERVER:-${E_LIVE_SERVER_DEFAULT_SVN}}/${ESVN_SUB_PROJECT}/${ESVN_URI_APPEND} + E_S_APPEND=${ESVN_URI_APPEND} + E_LIVE_SOURCE="svn" + inherit subversion + fi +elif [[ -n ${E_SNAP_DATE} ]] ; then + E_STATE="snap" +else + E_STATE="release" +fi +if [[ ${WANT_AUTOTOOLS} == "yes" ]] ; then + WANT_AUTOCONF=${E_WANT_AUTOCONF:-latest} + WANT_AUTOMAKE=${E_WANT_AUTOMAKE:-latest} + inherit autotools +fi + +ENLIGHTENMENT_EXPF="pkg_setup src_unpack src_compile src_install pkg_postinst" +case "${EAPI:-0}" in + 2|3|4) ENLIGHTENMENT_EXPF+=" src_prepare src_configure" ;; + *) ;; +esac +EXPORT_FUNCTIONS ${ENLIGHTENMENT_EXPF} + +DESCRIPTION="A DR17 production" +HOMEPAGE="http://www.enlightenment.org/" +case ${EURI_STATE:-${E_STATE}} in + release) SRC_URI="mirror://sourceforge/enlightenment/${P}.tar.gz";; + snap) SRC_URI="http://download.enlightenment.org/snapshots/${E_SNAP_DATE}/${P}.tar.bz2";; + live) SRC_URI="";; +esac + +LICENSE="BSD" +SLOT="0" +case ${EKEY_STATE:-${E_STATE}} in + release) KEYWORDS="alpha amd64 arm hppa ia64 mips ppc ppc64 sh sparc x86 ~x86-fbsd";; + snap) KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd";; + live) KEYWORDS="";; +esac +IUSE="nls doc" + +DEPEND="doc? ( app-doc/doxygen )" +RDEPEND="nls? ( sys-devel/gettext )" + +# gettext (via `autopoint`) needs to run cvs #245073 +[[ ${E_STATE} == "live" ]] && DEPEND="${DEPEND} dev-util/cvs" + +case ${EURI_STATE:-${E_STATE}} in + release) S=${WORKDIR}/${P};; + snap) S=${WORKDIR}/${P};; + live) S=${WORKDIR}/${E_S_APPEND};; +esac + +enlightenment_warning_msg() { + if [[ -n ${E_LIVE_SERVER} ]] ; then + einfo "Using user server for live sources: ${E_LIVE_SERVER}" + fi + if [[ ${E_STATE} == "snap" ]] ; then + ewarn "Please do not contact the E team about bugs in Gentoo." + ewarn "Only contact enlightenment@gentoo.org via e-mail or bugzilla." + ewarn "Remember, this stuff is DEV only code so dont cry when" + ewarn "I break you :)." + elif [[ ${E_STATE} == "live" ]] ; then + eerror "This is a LIVE SOURCES ebuild." + eerror "That means there are NO promises it will work." + eerror "If it fails to build, FIX THE CODE YOURSELF" + eerror "before reporting any issues." + fi +} + +enlightenment_die() { + enlightenment_warning_msg + die "$@"$'\n'"!!! SEND BUG REPORTS TO enlightenment@gentoo.org NOT THE E TEAM" +} + +enlightenment_pkg_setup() { + : enlightenment_warning_msg +} + +enlightenment_src_unpack() { + if [[ ${E_STATE} == "live" ]] ; then + case ${E_LIVE_SOURCE} in + cvs) cvs_src_unpack;; + svn) subversion_src_unpack;; + *) die "eek!";; + esac + else + unpack ${A} + fi + hasq src_prepare ${ENLIGHTENMENT_EXPF} || enlightenment_src_prepare +} + +enlightenment_src_prepare() { + [[ -s gendoc ]] && chmod a+rx gendoc + if [[ ${WANT_AUTOTOOLS} == "yes" ]] ; then + [[ -d po ]] && eautopoint -f + # autotools require README, when README.in is around, but README + # is created later in configure step + [[ -f README.in ]] && touch README + eautoreconf + fi + epunt_cxx + elibtoolize +} + +enlightenment_src_configure() { + # gstreamer sucks, work around it doing stupid stuff + export GST_REGISTRY="${S}/registry.xml" + + econf ${MY_ECONF} +} + +enlightenment_src_compile() { + hasq src_configure ${ENLIGHTENMENT_EXPF} || enlightenment_src_configure + emake || enlightenment_die "emake failed" + use doc && [[ -x ./gendoc ]] && { ./gendoc || enlightenment_die "gendoc failed" ; } +} + +enlightenment_src_install() { + emake install DESTDIR="${D}" || enlightenment_die + find "${D}" '(' -name CVS -o -name .svn -o -name .git ')' -type d -exec rm -rf '{}' \; 2>/dev/null + for d in AUTHORS ChangeLog NEWS README TODO ${EDOCS}; do + [[ -f ${d} ]] && dodoc ${d} + done + use doc && [[ -d doc ]] && dohtml -r doc/* +} + +enlightenment_pkg_postinst() { + : enlightenment_warning_msg +} + diff --git a/sdk_container/src/third_party/portage-stable/eclass/fdo-mime.eclass b/sdk_container/src/third_party/portage-stable/eclass/fdo-mime.eclass new file mode 100644 index 0000000000..fcf9cfa1c6 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/fdo-mime.eclass @@ -0,0 +1,35 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/fdo-mime.eclass,v 1.8 2008/12/23 01:28:49 solar Exp $ + +# @ECLASS: fdo-mime.eclass +# @MAINTAINER: freedesktop-bugs@gentoo.org +# +# +# Original author: foser +# @BLURB: Utility eclass to update the desktop mime info as laid out in the freedesktop specs & implementations + + +# @FUNCTION: fdo-mime_desktop_database_update +# @DESCRIPTION: +# Updates the desktop database. +# Generates a list of mimetypes linked to applications that can handle them +fdo-mime_desktop_database_update() { + if [ -x "/usr/bin/update-desktop-database" ] + then + einfo "Updating desktop mime database ..." + "/usr/bin/update-desktop-database" -q "${ROOT}/usr/share/applications" + fi +} + +# @FUNCTION: fdo-mime_mime_database_update +# @DESCRIPTION: +# Update the mime database. +# Creates a general list of mime types from several sources +fdo-mime_mime_database_update() { + if [ -x "/usr/bin/update-mime-database" ] + then + einfo "Updating shared mime info database ..." + "/usr/bin/update-mime-database" "${ROOT}/usr/share/mime" + fi +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/findlib.eclass b/sdk_container/src/third_party/portage-stable/eclass/findlib.eclass new file mode 100644 index 0000000000..a824627a81 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/findlib.eclass @@ -0,0 +1,56 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/findlib.eclass,v 1.9 2009/02/08 21:30:12 maekke Exp $ + +# @ECLASS: findlib.eclass +# @MAINTAINER: +# ml@gentoo.org +# +# Original author : Matthieu Sozeau (retired) +# +# Changes: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/findlib.eclass?view=log +# @BLURB: ocamlfind (a.k.a. findlib) eclass +# @DESCRIPTION: +# ocamlfind (a.k.a. findlib) eclass + + + +# From this findlib version there is proper stublibs support. +DEPEND=">=dev-ml/findlib-1.0.4-r1" +[[ ${FINDLIB_USE} ]] && DEPEND="${FINDLIB_USE}? ( ${DEPEND} )" + +check_ocamlfind() { + if [ ! -x /usr/bin/ocamlfind ] + then + eerror "In findlib.eclass: could not find the ocamlfind executable" + eerror "Please report this bug on gentoo's bugzilla, assigning to ml@gentoo.org" + die "ocamlfind executabled not found" + fi +} + +# @FUNCTION: findlib_src_preinst +# @DESCRIPTION: +# Prepare the image for a findlib installation. +# We use the stublibs style, so no ld.conf needs to be +# updated when a package installs C shared libraries. +findlib_src_preinst() { + check_ocamlfind + + # destdir is the ocaml sitelib + local destdir=`ocamlfind printconf destdir` + + dodir ${destdir} || die "dodir failed" + export OCAMLFIND_DESTDIR=${D}${destdir} + + # stublibs style + dodir ${destdir}/stublibs || die "dodir failed" + export OCAMLFIND_LDCONF=ignore +} + +# @FUNCTION: findlib_src_install +# @DESCRIPTION: +# Install with a properly setup findlib +findlib_src_install() { + findlib_src_preinst + make DESTDIR="${D}" "$@" install || die "make failed" +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/fixheadtails.eclass b/sdk_container/src/third_party/portage-stable/eclass/fixheadtails.eclass new file mode 100644 index 0000000000..6b65ce0fd2 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/fixheadtails.eclass @@ -0,0 +1,44 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/fixheadtails.eclass,v 1.11 2008/02/19 05:27:25 vapier Exp $ +# +# Original author John Mylchreest + +# @ECLASS: fixheadtails.eclass +# @MAINTAINER: +# base-system@gentoo.org +# @BLURB: functions to replace obsolete head/tail with POSIX compliant ones + +DEPEND=">=sys-apps/sed-4" + +__do_sed_fix() { + einfo " - fixed $1" + sed -i \ + -e 's/head \+-\([0-9]\)/head -n \1/g' \ + -e 's/tail \+\([-+][0-9]\+\)c/tail -c \1/g' \ + -e 's/tail \+\([-+][0-9]\)/tail -n \1/g' ${1} || \ + die "sed ${1} failed" +} + +# @FUNCTION: ht_fix_file +# @USAGE: +# @DESCRIPTION: +# Fix all the specified files. +ht_fix_file() { + local i + einfo "Replacing obsolete head/tail with POSIX compliant ones" + for i in "$@" ; do + __do_sed_fix "$i" + done +} + +# @FUNCTION: ht_fix_all +# @DESCRIPTION: +# Find and fix all files in the current directory as needed. +ht_fix_all() { + local MATCHES + MATCHES=$(grep -l -s -i -R -e "head -[ 0-9]" -e "tail [+-][ 0-9]" * | sort -u) + [[ -n ${MATCHES} ]] \ + && ht_fix_file ${MATCHES} \ + || einfo "No need for ht_fix_all anymore !" +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/flag-o-matic.eclass b/sdk_container/src/third_party/portage-stable/eclass/flag-o-matic.eclass new file mode 100644 index 0000000000..b63eca4fa2 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/flag-o-matic.eclass @@ -0,0 +1,746 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.146 2010/02/17 18:20:49 ssuominen Exp $ + +# @ECLASS: flag-o-matic.eclass +# @MAINTAINER: +# toolchain@gentoo.org +# @BLURB: common functions to manipulate and query toolchain flags +# @DESCRIPTION: +# This eclass contains a suite of functions to help developers sanely +# and safely manage toolchain flags in their builds. + +inherit eutils toolchain-funcs multilib + +################ DEPRECATED functions ################ +# The following are still present to avoid breaking existing +# code more than necessary; however they are deprecated. Please +# use gcc-specs-* from toolchain-funcs.eclass instead, if you +# need to know which hardened techs are active in the compiler. +# See bug #100974 +# +# has_hardened +# has_pie +# has_pic +# has_ssp_all +# has_ssp + + +# {C,CXX,F,FC}FLAGS that we allow in strip-flags +# Note: shell globs and character lists are allowed +setup-allowed-flags() { + if [[ -z ${ALLOWED_FLAGS} ]] ; then + export ALLOWED_FLAGS="-pipe" + export ALLOWED_FLAGS="${ALLOWED_FLAGS} -O -O0 -O1 -O2 -mcpu -march -mtune" + export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fstack-protector -fstack-protector-all" + export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fbounds-checking -fno-strict-overflow" + export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fno-PIE -fno-pie -fno-unit-at-a-time" + export ALLOWED_FLAGS="${ALLOWED_FLAGS} -g -g[0-9] -ggdb -ggdb[0-9] -gstabs -gstabs+" + export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fno-ident" + export ALLOWED_FLAGS="${ALLOWED_FLAGS} -W* -w" + fi + # allow a bunch of flags that negate features / control ABI + ALLOWED_FLAGS="${ALLOWED_FLAGS} -fno-stack-protector -fno-stack-protector-all \ + -fno-strict-aliasing -fno-bounds-checking -fstrict-overflow -fno-omit-frame-pointer" + ALLOWED_FLAGS="${ALLOWED_FLAGS} -mregparm -mno-app-regs -mapp-regs \ + -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-ssse3 -mno-sse4 -mno-sse4.1 \ + -mno-sse4.2 -mno-avx -mno-aes -mno-pclmul -mno-sse4a -mno-3dnow \ + -mno-popcnt -mno-abm \ + -mips1 -mips2 -mips3 -mips4 -mips32 -mips64 -mips16 -mplt \ + -msoft-float -mno-soft-float -mhard-float -mno-hard-float -mfpu \ + -mieee -mieee-with-inexact -mschedule \ + -mtls-direct-seg-refs -mno-tls-direct-seg-refs \ + -mflat -mno-flat -mno-faster-structs -mfaster-structs \ + -m32 -m64 -mabi -mlittle-endian -mbig-endian -EL -EB -fPIC \ + -mlive-g0 -mcmodel -mstack-bias -mno-stack-bias \ + -msecure-plt -m*-toc -D* -U*" + + # {C,CXX,F,FC}FLAGS that we are think is ok, but needs testing + # NOTE: currently -Os have issues with gcc3 and K6* arch's + export UNSTABLE_FLAGS="-Os -O3 -freorder-blocks" + return 0 +} + +# inverted filters for hardened compiler. This is trying to unpick +# the hardened compiler defaults. +_filter-hardened() { + local f + for f in "$@" ; do + case "${f}" in + # Ideally we should only concern ourselves with PIE flags, + # not -fPIC or -fpic, but too many places filter -fPIC without + # thinking about -fPIE. + -fPIC|-fpic|-fPIE|-fpie|-Wl,pie|-pie) + gcc-specs-pie || continue + is-flagq -nopie || append-flags -nopie;; + -fstack-protector) + gcc-specs-ssp || continue + is-flagq -fno-stack-protector || append-flags $(test-flags -fno-stack-protector);; + -fstack-protector-all) + gcc-specs-ssp-to-all || continue + is-flagq -fno-stack-protector-all || append-flags $(test-flags -fno-stack-protector-all);; + -fno-strict-overflow) + gcc-specs-nostrict || continue + is-flagq -fstrict-overflow || append-flags $(test-flags -fstrict-overflow);; + esac + done +} + +# Remove occurrences of strings from variable given in $1 +# Strings removed are matched as globs, so for example +# '-O*' would remove -O1, -O2 etc. +_filter-var() { + local f x VAR VAL + declare -a new + + VAR=$1 + shift + eval VAL=\${${VAR}} + for f in ${VAL}; do + for x in "$@"; do + # Note this should work with globs like -O* + [[ ${f} == ${x} ]] && continue 2 + done + eval new\[\${\#new\[@]}]=\${f} + done + eval export ${VAR}=\${new\[*]} +} + +# @FUNCTION: filter-flags +# @USAGE: +# @DESCRIPTION: +# Remove particular from {C,CPP,CXX,F,FC}FLAGS. Accepts shell globs. +filter-flags() { + _filter-hardened "$@" + _filter-var CFLAGS "$@" + _filter-var CPPFLAGS "$@" + _filter-var CXXFLAGS "$@" + _filter-var FFLAGS "$@" + _filter-var FCFLAGS "$@" + return 0 +} + +# @FUNCTION: filter-lfs-flags +# @DESCRIPTION: +# Remove flags that enable Large File Support. +filter-lfs-flags() { + [[ -n $@ ]] && die "filter-lfs-flags takes no arguments" + filter-flags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE +} + +# @FUNCTION: append-cppflags +# @USAGE: +# @DESCRIPTION: +# Add extra to the current CPPFLAGS. +append-cppflags() { + [[ -z $* ]] && return 0 + export CPPFLAGS="${CPPFLAGS} $*" + return 0 +} + +# @FUNCTION: append-cflags +# @USAGE: +# @DESCRIPTION: +# Add extra to the current CFLAGS. +append-cflags() { + [[ -z $* ]] && return 0 + export CFLAGS="${CFLAGS} $*" + return 0 +} + +# @FUNCTION: append-cxxflags +# @USAGE: +# @DESCRIPTION: +# Add extra to the current CXXFLAGS. +append-cxxflags() { + [[ -z $* ]] && return 0 + export CXXFLAGS="${CXXFLAGS} $*" + return 0 +} + +# @FUNCTION: append-fflags +# @USAGE: +# @DESCRIPTION: +# Add extra to the current {F,FC}FLAGS. +append-fflags() { + [[ -z $* ]] && return 0 + export FFLAGS="${FFLAGS} $*" + export FCFLAGS="${FCFLAGS} $*" + return 0 +} + +# @FUNCTION: append-lfs-flags +# @DESCRIPTION: +# Add flags that enable Large File Support. +append-lfs-flags() { + [[ -n $@ ]] && die "append-lfs-flags takes no arguments" + append-cppflags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE +} + +# @FUNCTION: append-flags +# @USAGE: +# @DESCRIPTION: +# Add extra to your current {C,CXX,F,FC}FLAGS. +append-flags() { + [[ -z $* ]] && return 0 + append-cflags "$@" + append-cxxflags "$@" + append-fflags "$@" + return 0 +} + +# @FUNCTION: replace-flags +# @USAGE: +# @DESCRIPTION: +# Replace the flag with . Accepts shell globs for . +replace-flags() { + [[ $# != 2 ]] \ + && echo && eerror "Usage: replace-flags " \ + && die "replace-flags takes 2 arguments, not $#" + + local f fset + declare -a new_CFLAGS new_CXXFLAGS new_FFLAGS new_FCFLAGS + + for fset in CFLAGS CXXFLAGS FFLAGS FCFLAGS; do + # Looping over the flags instead of using a global + # substitution ensures that we're working with flag atoms. + # Otherwise globs like -O* have the potential to wipe out the + # list of flags. + for f in ${!fset}; do + # Note this should work with globs like -O* + [[ ${f} == ${1} ]] && f=${2} + eval new_${fset}\[\${\#new_${fset}\[@]}]=\${f} + done + eval export ${fset}=\${new_${fset}\[*]} + done + + return 0 +} + +# @FUNCTION: replace-cpu-flags +# @USAGE: +# @DESCRIPTION: +# Replace cpu flags (like -march/-mcpu/-mtune) that select the cpu +# with flags that select the cpu. Accepts shell globs for . +replace-cpu-flags() { + local newcpu="$#" ; newcpu="${!newcpu}" + while [ $# -gt 1 ] ; do + # quote to make sure that no globbing is done (particularly on + # ${oldcpu}) prior to calling replace-flags + replace-flags "-march=${1}" "-march=${newcpu}" + replace-flags "-mcpu=${1}" "-mcpu=${newcpu}" + replace-flags "-mtune=${1}" "-mtune=${newcpu}" + shift + done + return 0 +} + +_is_flagq() { + local x + for x in ${!1} ; do + [[ ${x} == $2 ]] && return 0 + done + return 1 +} + +# @FUNCTION: is-flagq +# @USAGE: +# @DESCRIPTION: +# Returns shell true if is in {C,CXX,F,FC}FLAGS, else returns shell false. Accepts shell globs. +is-flagq() { + [[ -n $2 ]] && die "Usage: is-flag " + _is_flagq CFLAGS $1 || _is_flagq CXXFLAGS $1 || _is_flagq FFLAGS $1 || _is_flagq FCFLAGS $1 +} + +# @FUNCTION: is-flag +# @USAGE: +# @DESCRIPTION: +# Echo's "true" if flag is set in {C,CXX,F,FC}FLAGS. Accepts shell globs. +is-flag() { + is-flagq "$@" && echo true +} + +# @FUNCTION: is-ldflagq +# @USAGE: +# @DESCRIPTION: +# Returns shell true if is in LDFLAGS, else returns shell false. Accepts shell globs. +is-ldflagq() { + [[ -n $2 ]] && die "Usage: is-ldflag " + _is_flagq LDFLAGS $1 +} + +# @FUNCTION: is-ldflag +# @USAGE: +# @DESCRIPTION: +# Echo's "true" if flag is set in LDFLAGS. Accepts shell globs. +is-ldflag() { + is-ldflagq "$@" && echo true +} + +# @FUNCTION: filter-mfpmath +# @USAGE: +# @DESCRIPTION: +# Remove specified math types from the fpmath flag. For example, if the user +# has -mfpmath=sse,386, running `filter-mfpmath sse` will leave the user with +# -mfpmath=386. +filter-mfpmath() { + local orig_mfpmath new_math prune_math + + # save the original -mfpmath flag + orig_mfpmath=$(get-flag -mfpmath) + # get the value of the current -mfpmath flag + new_math=$(get-flag mfpmath) + new_math=" ${new_math//,/ } " + # figure out which math values are to be removed + prune_math="" + for prune_math in "$@" ; do + new_math=${new_math/ ${prune_math} / } + done + new_math=$(echo ${new_math}) + new_math=${new_math// /,} + + if [[ -z ${new_math} ]] ; then + # if we're removing all user specified math values are + # slated for removal, then we just filter the flag + filter-flags ${orig_mfpmath} + else + # if we only want to filter some of the user specified + # math values, then we replace the current flag + replace-flags ${orig_mfpmath} -mfpmath=${new_math} + fi + return 0 +} + +# @FUNCTION: strip-flags +# @DESCRIPTION: +# Strip C[XX]FLAGS of everything except known good/safe flags. +strip-flags() { + local x y flag NEW_CFLAGS NEW_CXXFLAGS NEW_FFLAGS NEW_FCFLAGS + + setup-allowed-flags + + local NEW_CFLAGS="" + local NEW_CXXFLAGS="" + local NEW_FFLAGS="" + local NEW_FCFLAGS="" + + # Allow unstable C[XX]FLAGS if we are using unstable profile ... + if has "~$(tc-arch)" ${ACCEPT_KEYWORDS} ; then + ALLOWED_FLAGS="${ALLOWED_FLAGS} ${UNSTABLE_FLAGS}" + fi + + set -f # disable pathname expansion + + for x in ${CFLAGS}; do + for y in ${ALLOWED_FLAGS}; do + flag=${x%%=*} + if [ "${flag%%${y}}" = "" ] ; then + NEW_CFLAGS="${NEW_CFLAGS} ${x}" + break + fi + done + done + + for x in ${CXXFLAGS}; do + for y in ${ALLOWED_FLAGS}; do + flag=${x%%=*} + if [ "${flag%%${y}}" = "" ] ; then + NEW_CXXFLAGS="${NEW_CXXFLAGS} ${x}" + break + fi + done + done + + for x in ${FFLAGS}; do + for y in ${ALLOWED_FLAGS}; do + flag=${x%%=*} + if [ "${flag%%${y}}" = "" ] ; then + NEW_FFLAGS="${NEW_FFLAGS} ${x}" + break + fi + done + done + + for x in ${FCFLAGS}; do + for y in ${ALLOWED_FLAGS}; do + flag=${x%%=*} + if [ "${flag%%${y}}" = "" ] ; then + NEW_FCFLAGS="${NEW_FCFLAGS} ${x}" + break + fi + done + done + + # In case we filtered out all optimization flags fallback to -O2 + if [ "${CFLAGS/-O}" != "${CFLAGS}" -a "${NEW_CFLAGS/-O}" = "${NEW_CFLAGS}" ]; then + NEW_CFLAGS="${NEW_CFLAGS} -O2" + fi + if [ "${CXXFLAGS/-O}" != "${CXXFLAGS}" -a "${NEW_CXXFLAGS/-O}" = "${NEW_CXXFLAGS}" ]; then + NEW_CXXFLAGS="${NEW_CXXFLAGS} -O2" + fi + if [ "${FFLAGS/-O}" != "${FFLAGS}" -a "${NEW_FFLAGS/-O}" = "${NEW_FFLAGS}" ]; then + NEW_FFLAGS="${NEW_FFLAGS} -O2" + fi + if [ "${FCFLAGS/-O}" != "${FCFLAGS}" -a "${NEW_FCFLAGS/-O}" = "${NEW_FCFLAGS}" ]; then + NEW_FCFLAGS="${NEW_FCFLAGS} -O2" + fi + + set +f # re-enable pathname expansion + + export CFLAGS="${NEW_CFLAGS}" + export CXXFLAGS="${NEW_CXXFLAGS}" + export FFLAGS="${NEW_FFLAGS}" + export FCFLAGS="${NEW_FCFLAGS}" + return 0 +} + +test-flag-PROG() { + local comp=$1 + local flags="$2" + + [[ -z ${comp} || -z ${flags} ]] && \ + return 1 + + local PROG=$(tc-get${comp}) + ${PROG} ${flags} -S -o /dev/null -xc /dev/null \ + > /dev/null 2>&1 +} + +# @FUNCTION: test-flag-CC +# @USAGE: +# @DESCRIPTION: +# Returns shell true if is supported by the C compiler, else returns shell false. +test-flag-CC() { test-flag-PROG "CC" "$1"; } + +# @FUNCTION: test-flag-CXX +# @USAGE: +# @DESCRIPTION: +# Returns shell true if is supported by the C++ compiler, else returns shell false. +test-flag-CXX() { test-flag-PROG "CXX" "$1"; } + +# @FUNCTION: test-flag-F77 +# @USAGE: +# @DESCRIPTION: +# Returns shell true if is supported by the Fortran 77 compiler, else returns shell false. +test-flag-F77() { test-flag-PROG "F77" "$1"; } + +# @FUNCTION: test-flag-FC +# @USAGE: +# @DESCRIPTION: +# Returns shell true if is supported by the Fortran 90 compiler, else returns shell false. +test-flag-FC() { test-flag-PROG "FC" "$1"; } + +test-flags-PROG() { + local comp=$1 + local flags + local x + + shift + + [[ -z ${comp} ]] && return 1 + + x="" + for x in "$@" ; do + test-flag-${comp} "${x}" && flags="${flags}${flags:+ }${x}" + done + + echo "${flags}" + + # Just bail if we dont have any flags + [[ -n ${flags} ]] +} + +# @FUNCTION: test-flags-CC +# @USAGE: +# @DESCRIPTION: +# Returns shell true if are supported by the C compiler, else returns shell false. +test-flags-CC() { test-flags-PROG "CC" "$@"; } + +# @FUNCTION: test-flags-CXX +# @USAGE: +# @DESCRIPTION: +# Returns shell true if are supported by the C++ compiler, else returns shell false. +test-flags-CXX() { test-flags-PROG "CXX" "$@"; } + +# @FUNCTION: test-flags-F77 +# @USAGE: +# @DESCRIPTION: +# Returns shell true if are supported by the Fortran 77 compiler, else returns shell false. +test-flags-F77() { test-flags-PROG "F77" "$@"; } + +# @FUNCTION: test-flags-FC +# @USAGE: +# @DESCRIPTION: +# Returns shell true if are supported by the Fortran 90 compiler, else returns shell false. +test-flags-FC() { test-flags-PROG "FC" "$@"; } + +# @FUNCTION: test-flags +# @USAGE: +# @DESCRIPTION: +# Short-hand that should hopefully work for both C and C++ compiler, but +# its really only present due to the append-flags() abomination. +test-flags() { test-flags-CC "$@"; } + +# @FUNCTION: test_flag +# @DESCRIPTION: +# DEPRICIATED, use test-flags() +test_flag() { + ewarn "test_flag: deprecated, please use test-flags()!" >&2 + + test-flags-CC "$@" +} + +# @FUNCTION: test_version_info +# @USAGE: +# @DESCRIPTION: +# Returns shell true if the current C compiler version matches , else returns shell false. +# Accepts shell globs. +test_version_info() { + if [[ $($(tc-getCC) --version 2>&1) == *$1* ]]; then + return 0 + else + return 1 + fi +} + +# @FUNCTION: strip-unsupported-flags +# @DESCRIPTION: +# Strip {C,CXX,F,FC}FLAGS of any flags not supported by the active toolchain. +strip-unsupported-flags() { + export CFLAGS=$(test-flags-CC ${CFLAGS}) + export CXXFLAGS=$(test-flags-CXX ${CXXFLAGS}) + export FFLAGS=$(test-flags-F77 ${FFLAGS}) + export FCFLAGS=$(test-flags-FC ${FCFLAGS}) +} + +# @FUNCTION: get-flag +# @USAGE: +# @DESCRIPTION: +# Find and echo the value for a particular flag. Accepts shell globs. +get-flag() { + local f findflag="$1" + + # this code looks a little flaky but seems to work for + # everything we want ... + # for example, if CFLAGS="-march=i686": + # `get-flag -march` == "-march=i686" + # `get-flag march` == "i686" + for f in ${CFLAGS} ${CXXFLAGS} ${FFLAGS} ${FCFLAGS} ; do + if [ "${f/${findflag}}" != "${f}" ] ; then + printf "%s\n" "${f/-${findflag}=}" + return 0 + fi + done + return 1 +} + +# @FUNCTION: has_hardened +# @DESCRIPTION: +# DEPRECATED - use gcc-specs-relro or gcc-specs-now from toolchain-funcs +has_hardened() { + ewarn "has_hardened: deprecated, please use gcc-specs-{relro,now}()!" >&2 + + test_version_info Hardened && return 0 + # The specs file wont exist unless gcc has GCC_SPECS support + [[ -f ${GCC_SPECS} && ${GCC_SPECS} != ${GCC_SPECS/hardened/} ]] +} + +# @FUNCTION: has_pic +# @DESCRIPTION: +# DEPRECATED - use gcc-specs-pie from toolchain-funcs +# indicate whether PIC is set +has_pic() { + ewarn "has_pic: deprecated, please use gcc-specs-pie()!" >&2 + + [[ ${CFLAGS/-fPIC} != ${CFLAGS} || \ + ${CFLAGS/-fpic} != ${CFLAGS} ]] || \ + gcc-specs-pie +} + +# @FUNCTION: has_pie +# @DESCRIPTION: +# DEPRECATED - use gcc-specs-pie from toolchain-funcs +# indicate whether PIE is set +has_pie() { + ewarn "has_pie: deprecated, please use gcc-specs-pie()!" >&2 + + [[ ${CFLAGS/-fPIE} != ${CFLAGS} || \ + ${CFLAGS/-fpie} != ${CFLAGS} ]] || \ + gcc-specs-pie +} + +# @FUNCTION: has_ssp_all +# @DESCRIPTION: +# DEPRECATED - use gcc-specs-ssp from toolchain-funcs +# indicate whether code for SSP is being generated for all functions +has_ssp_all() { + ewarn "has_ssp_all: deprecated, please use gcc-specs-ssp()!" >&2 + + # note; this matches only -fstack-protector-all + [[ ${CFLAGS/-fstack-protector-all} != ${CFLAGS} || \ + -n $(echo | $(tc-getCC) ${CFLAGS} -E -dM - | grep __SSP_ALL__) ]] || \ + gcc-specs-ssp-to-all +} + +# @FUNCTION: has_ssp +# @DESCRIPTION: +# DEPRECATED - use gcc-specs-ssp from toolchain-funcs +# indicate whether code for SSP is being generated +has_ssp() { + ewarn "has_ssp: deprecated, please use gcc-specs-ssp()!" >&2 + + # note; this matches both -fstack-protector and -fstack-protector-all + [[ ${CFLAGS/-fstack-protector} != ${CFLAGS} || \ + -n $(echo | $(tc-getCC) ${CFLAGS} -E -dM - | grep __SSP__) ]] || \ + gcc-specs-ssp +} + +# @FUNCTION: has_m64 +# @DESCRIPTION: +# This doesn't test if the flag is accepted, it tests if the flag actually +# WORKS. Non-multilib gcc will take both -m32 and -m64. If the flag works +# return code is 0, else the return code is 1. +has_m64() { + # this doesnt test if the flag is accepted, it tests if the flag + # actually -WORKS-. non-multilib gcc will take both -m32 and -m64! + # please dont replace this function with test_flag in some future + # clean-up! + + local temp="$(emktemp)" + echo "int main() { return(0); }" > "${temp}".c + MY_CC=$(tc-getCC) + ${MY_CC/ .*/} -m64 -o "$(emktemp)" "${temp}".c > /dev/null 2>&1 + local ret=$? + rm -f "${temp}".c + [[ ${ret} != 1 ]] && return 0 + return 1 +} + +# @FUNCTION: has_m32 +# @DESCRIPTION: +# This doesn't test if the flag is accepted, it tests if the flag actually +# WORKS. Non-mulilib gcc will take both -m32 and -64. If the flag works return +# code is 0, else return code is 1. +has_m32() { + # this doesnt test if the flag is accepted, it tests if the flag + # actually -WORKS-. non-multilib gcc will take both -m32 and -m64! + # please dont replace this function with test_flag in some future + # clean-up! + + [ "$(tc-arch)" = "amd64" ] && has_multilib_profile && return 0 + + local temp=$(emktemp) + echo "int main() { return(0); }" > "${temp}".c + MY_CC=$(tc-getCC) + ${MY_CC/ .*/} -m32 -o "$(emktemp)" "${temp}".c > /dev/null 2>&1 + local ret=$? + rm -f "${temp}".c + [[ ${ret} != 1 ]] && return 0 + return 1 +} + +# @FUNCTION: replace-sparc64-flags +# @DESCRIPTION: +# Sets mcpu to v8 and uses the original value as mtune if none specified. +replace-sparc64-flags() { + local SPARC64_CPUS="ultrasparc3 ultrasparc v9" + + if [ "${CFLAGS/mtune}" != "${CFLAGS}" ]; then + for x in ${SPARC64_CPUS}; do + CFLAGS="${CFLAGS/-mcpu=${x}/-mcpu=v8}" + done + else + for x in ${SPARC64_CPUS}; do + CFLAGS="${CFLAGS/-mcpu=${x}/-mcpu=v8 -mtune=${x}}" + done + fi + + if [ "${CXXFLAGS/mtune}" != "${CXXFLAGS}" ]; then + for x in ${SPARC64_CPUS}; do + CXXFLAGS="${CXXFLAGS/-mcpu=${x}/-mcpu=v8}" + done + else + for x in ${SPARC64_CPUS}; do + CXXFLAGS="${CXXFLAGS/-mcpu=${x}/-mcpu=v8 -mtune=${x}}" + done + fi + + export CFLAGS CXXFLAGS +} + +# @FUNCTION: append-ldflags +# @USAGE: +# @DESCRIPTION: +# Add extra to the current LDFLAGS. +append-ldflags() { + [[ -z $* ]] && return 0 + local flag + for flag in "$@"; do + [[ ${flag} == -l* ]] && \ + ewarn "Appending a library link instruction (${flag}); libraries to link to should not be passed through LDFLAGS" + done + + export LDFLAGS="${LDFLAGS} $*" + return 0 +} + +# @FUNCTION: filter-ldflags +# @USAGE: +# @DESCRIPTION: +# Remove particular from LDFLAGS. Accepts shell globs. +filter-ldflags() { + _filter-var LDFLAGS "$@" + return 0 +} + +# @FUNCTION: raw-ldflags +# @USAGE: +# @DESCRIPTION: +# Turn C style ldflags (-Wl,-foo) into straight ldflags - the results +# are suitable for passing directly to 'ld'; note LDFLAGS is usually passed +# to gcc where it needs the '-Wl,'. +raw-ldflags() { + local x input="$@" + [[ -z ${input} ]] && input=${LDFLAGS} + set -- + for x in ${input} ; do + x=${x#-Wl,} + set -- "$@" ${x//,/ } + done + echo "$@" +} + +# @FUNCTION: no-as-needed +# @RETURN: Flag to disable asneeded behavior for use with append-ldflags. +no-as-needed() { + case $($(tc-getLD) -v 2>&1 + +# font-ebdftopcf.eclass +# Eclass to make PCF font generator from BDF uniform and optimal +# The manpage for this eclass is in media-gfx/ebdftopcf. + +# inherit this eclass after font.eclass + +# if USE="-X", this eclass is basically a no-op, since bdftopcf requires Xorg. +IUSE="X" + +# Variable declarations +DEPEND="X? ( media-gfx/ebdftopcf )" +RDEPEND="" + +use X && FONT_SUFFIX="pcf.gz" +use X || FONT_SUFFIX="bdf" + +# +# Public functions +# +ebdftopcf() { + local bdffiles + bdffiles="$@" + [ -z "$bdffiles" ] && die "No BDF files specified." + emake -f /usr/share/ebdftopcf/Makefile.ebdftopcf \ + BDFFILES="${bdffiles}" \ + BDFTOPCF_PARAMS="${BDFTOPCF_PARAMS}" \ + || die "Failed to build PCF files" +} + +# +# Public inheritable functions +# +font-ebdftopcf_src_compile() { + if use X; then + [ -z "${BDFFILES}" ] && BDFFILES="$(find . -name '*.bdf')" + ebdftopcf ${BDFFILES} + fi +} + +EXPORT_FUNCTIONS src_compile diff --git a/sdk_container/src/third_party/portage-stable/eclass/font.eclass b/sdk_container/src/third_party/portage-stable/eclass/font.eclass new file mode 100644 index 0000000000..431a318686 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/font.eclass @@ -0,0 +1,184 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/font.eclass,v 1.48 2010/02/09 17:15:08 scarabeus Exp $ + +# @ECLASS: font.eclass +# @MAINTAINER: +# fonts@gentoo.org + +# Author: Tomáš Chvátal +# Author: foser +# @BLURB: Eclass to make font installation uniform + +inherit eutils + +EXPORT_FUNCTIONS pkg_setup src_install pkg_postinst pkg_postrm + +# @ECLASS-VARIABLE: FONT_SUFFIX +# @DESCRIPTION: +# Space delimited list of font suffixes to install +FONT_SUFFIX=${FONT_SUFFIX:=} + +# @ECLASS-VARIABLE: FONT_S +# @DESCRIPTION: +# Dir containing the fonts +FONT_S=${FONT_S:=${S}} + +# @ECLASS-VARIABLE: FONT_PN +# @DESCRIPTION: +# Last part of $FONTDIR +FONT_PN=${FONT_PN:=${PN}} + +# @ECLASS-VARIABLE: FONTDIR +# @DESCRIPTION: +# This is where the fonts are installed +FONTDIR=${FONTDIR:-/usr/share/fonts/${FONT_PN}} + +# @ECLASS-VARIABLE: FONT_CONF +# @DESCRIPTION: +# Array, which element(s) is(are) path(s) of fontconfig-2.4 file(s) to install +FONT_CONF=( "" ) + +# @ECLASS-VARIABLE: DOCS +# @DESCRIPTION: +# Docs to install +DOCS=${DOCS:-} + +IUSE="X" + +DEPEND="X? ( + x11-apps/mkfontdir + media-fonts/encodings + ) + >=media-libs/fontconfig-2.4.0" + +# @FUNCTION: font_xfont_config +# @DESCRIPTION: +# Creates the Xfont files. +font_xfont_config() { + # create Xfont files + if has X ${IUSE//+} && use X ; then + ebegin "Creating fonts.scale & fonts.dir" + rm -f "${ED}${FONTDIR}"/fonts.{dir,scale} + mkfontscale "${ED}${FONTDIR}" + mkfontdir \ + -e ${EPREFIX}/usr/share/fonts/encodings \ + -e ${EPREFIX}/usr/share/fonts/encodings/large \ + "${ED}${FONTDIR}" + eend $? + if [ -e "${FONT_S}/fonts.alias" ] ; then + doins "${FONT_S}/fonts.alias" + fi + fi +} + +# @FUNCTION: font_fontconfig +# @DESCRIPTION: +# Installs the fontconfig config files of FONT_CONF. +font_fontconfig() { + local conffile + if [[ -n ${FONT_CONF[@]} ]]; then + insinto /etc/fonts/conf.avail/ + for conffile in "${FONT_CONF[@]}"; do + [[ -e ${conffile} ]] && doins ${conffile} + done + fi +} + +# @FUNCTION: font_src_install +# @DESCRIPTION: +# The font src_install function. +font_src_install() { + local suffix commondoc + + pushd "${FONT_S}" > /dev/null + + insinto "${FONTDIR}" + + for suffix in ${FONT_SUFFIX}; do + doins *.${suffix} + done + + rm -f fonts.{dir,scale} encodings.dir + + font_xfont_config + font_fontconfig + + popd > /dev/null + + [[ -n ${DOCS} ]] && { dodoc ${DOCS} || die "docs installation failed" ; } + + # install common docs + for commondoc in COPYRIGHT README{,.txt} NEWS AUTHORS BUGS ChangeLog FONTLOG.txt; do + [[ -s ${commondoc} ]] && dodoc ${commondoc} + done +} + +# @FUNCTION: font_pkg_setup +# @DESCRIPTION: +# The font pkg_setup function. +# Collision portection and Prefix compat for eapi < 3. +font_pkg_setup() { + # Prefix compat + case ${EAPI:-0} in + 0|1|2) + if ! use prefix; then + EPREFIX= + ED=${D} + EROOT=${ROOT} + [[ ${EROOT} = */ ]] || EROOT+="/" + fi + ;; + esac + + # make sure we get no collisions + # setup is not the nicest place, but preinst doesn't cut it + [[ -e "${EROOT}/${FONTDIR}/fonts.cache-1" ]] && rm -f "${EROOT}/${FONTDIR}/fonts.cache-1" +} + +# @FUNCTION: font_pkg_postinst +# @DESCRIPTION: +# The font pkg_postinst function. +# Update global font cache and fix permissions. +font_pkg_postinst() { + # unreadable font files = fontconfig segfaults + find "${EROOT}"usr/share/fonts/ -type f '!' -perm 0644 -print0 \ + | xargs -0 chmod -v 0644 2>/dev/null + + if [[ -n ${FONT_CONF[@]} ]]; then + local conffile + echo + elog "The following fontconfig configuration files have been installed:" + elog + for conffile in "${FONT_CONF[@]}"; do + if [[ -e ${EROOT}etc/fonts/conf.avail/$(basename ${conffile}) ]]; then + elog " $(basename ${conffile})" + fi + done + elog + elog "Use \`eselect fontconfig\` to enable/disable them." + echo + fi + + if [[ ${ROOT} == / ]]; then + ebegin "Updating global fontcache" + fc-cache -fs + eend $? + fi +} + +# @FUNCTION: font_pkg_postrm +# @DESCRIPTION: +# The font pkg_postrm function. +# Updates global font cache +font_pkg_postrm() { + # unreadable font files = fontconfig segfaults + find "${EROOT}"usr/share/fonts/ -type f '!' -perm 0644 -print0 \ + | xargs -0 chmod -v 0644 2>/dev/null + + if [[ ${ROOT} == / ]]; then + ebegin "Updating global fontcache" + fc-cache -fs + eend $? + fi +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/fortran.eclass b/sdk_container/src/third_party/portage-stable/eclass/fortran.eclass new file mode 100644 index 0000000000..fcd091c791 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/fortran.eclass @@ -0,0 +1,216 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/fortran.eclass,v 1.21 2009/03/07 10:02:33 maekke Exp $ +# +# Author: Danny van Dyk +# + +inherit eutils autotools + +DESCRIPTION="Based on the ${ECLASS} eclass" + +IUSE="debug" + +#DEPEND="virtual/fortran" # Let's aim for this... + +# Which Fortran Compiler has been selected ? +export FORTRANC + +# These are the options to ./configure / econf that enable the usage +# of a specific Fortran Compiler. If your package uses a different +# option that the one listed here, overwrite it in your ebuild. +g77_CONF="--with-f77" +f2c_CONF="--with-f2c" + +# This function prints the necessary options for the currently selected +# Fortran Compiler. +fortran_conf() { + echo $(eval echo \${$(echo -n ${FORTRANC})_CONF}) +} + +# need_fortran(): +# profiles = ... +# +# profile: +# * gfortran - GCC Fortran 95 +# * g77 - GCC Fortran 77 +# * f2c - Fortran 2 C Translator +# * ifc - Intel Fortran Compiler +# * f95 - Sun Studio Fortran Compiler +# +# Checks if at least one of is installed. +# Checks also if F77 (the fortran compiler to use) is available +# on the System. +need_fortran() { + if [ -z "$*" ]; then + eerror "Call need_fortran with at least one argument !" + fi + local AVAILABLE + local PROFILE + for PROFILE in $@; do + case ${PROFILE} in + gfortran) + if [ -x "$(type -P gfortran 2> /dev/null)" ]; then + AVAILABLE="${AVAILABLE} gfortran" + fi + ;; + g77) + if [ -x "$(type -P g77 2> /dev/null)" ]; then + AVAILABLE="${AVAILABLE} g77" + fi + ;; + f2c) + if [ -x "$(type -P f2c 2> /dev/null)" ]; then + AVAILABLE="${AVAILABLE} f2c" + fi + ;; + ifc) + case ${ARCH} in + x86|ia64|amd64) + if [ -x "$(type -P ifort 2> /dev/null)" ]; then + AVAILABLE="${AVAILABLE} ifort" + elif [ -x "$(type -P ifc 2> /dev/null)" ]; then + AVAILABLE="${AVAILABLE} ifc" + fi + ;; + *) + ;; + esac + ;; + f95) + case ${ARCH} in + x86|amd64) + if [ -x "$(type -P f95 2> /dev/null)" ]; then + AVAILABLE="${AVAILABLE} f95" + fi + ;; + *) + ;; + esac + ;; + esac + done + AVAILABLE="${AVAILABLE/^[[:space:]]}" + use debug && echo ${AVAILABLE} + if [ -z "${AVAILABLE}" ]; then + eerror "None of the needed Fortran Compilers ($@) is installed." + eerror "To install one of these, choose one of the following steps:" + i=1 + for PROFILE in $@; do + case ${PROFILE} in + gfortran) + eerror "[${i}] USE=\"fortran\" emerge =sys-devel/gcc-4*" + ;; + g77) + eerror "[${i}] USE=\"fortran\" emerge =sys-devel/gcc-3*" + ;; + f2c) + eerror "[${i}] emerge dev-lang/f2c" + ;; + ifc) + case ${ARCH} in + x86|ia64) + eerror "[${i}] emerge dev-lang/ifc" + ;; + *) + ;; + esac + ;; + f95) + case ${ARCH} in + x86|amd64) + eerror "[${i}] emerge dev-lang/sunstudio" + ;; + *) + ;; + esac + ;; + esac + i=$((i + 1)) + done + die "Install a Fortran Compiler !" + else + einfo "You need one of these Fortran Compilers: $@" + einfo "Installed are: ${AVAILABLE}" + if [ -n "${F77}" -o -n "${FC}" -o -n "${F2C}" ]; then + if [ -n "${F77}" ]; then + FC="${F77}" # F77 overwrites FC + fi + if [ -n "${FC}" -a -n "${F2C}" ]; then + ewarn "Using ${FC} and f2c is impossible. Disabling F2C !" + F2C="" # Disabling f2c + MY_FORTRAN="$(basename ${FC})" # set MY_FORTRAN to filename of + # the Fortran Compiler + else + if [ -n "${F2C}" ]; then + MY_FORTRAN="$(basename ${F2C})" + elif [ -n "${FC}" ]; then + MY_FORTRAN="$(basename ${FC})" + else + MY_FORTRAN="$(basename ${F77})" + fi + fi + fi + + # default to gfortran if available, g77 if not + use debug && echo "MY_FORTRAN: \"${MY_FORTRAN}\"" + if hasq gfortran ${AVAILABLE}; then + MY_FORTRAN=${MY_FORTRAN:=gfortran} + elif hasq g77 ${AVAILABLE}; then + MY_FORTRAN=${MY_FORTRAN:=g77} + else + # Default to the first valid Fortran compiler + for i in ${AVAILABLE}; do + MY_FORTRAN=$i + break + done + fi + use debug && echo "MY_FORTRAN: \"${MY_FORTRAN}\"" + + if ! hasq ${MY_FORTRAN} ${AVAILABLE}; then + eerror "Current Fortran Compiler is set to ${MY_FORTRAN}, which is not usable with this package !" + die "Wrong Fortran Compiler !" + fi + + case ${MY_FORTRAN} in + gfortran|g77|ifc|ifort|f2c|f95) + FORTRANC="${MY_FORTRAN}" + esac + fi + use debug && echo "FORTRANC: \"${FORTRANC}\"" +} + +# patch_fortran(): +# Apply necessary patches for ${FORTRANC} +patch_fortran() { + if [[ -z "${FORTRANC}" || ! -d "${FILESDIR}" ]]; then + return + fi + local PATCHES=$(find ${FILESDIR} -name "${P}-${FORTRANC}-*") + einfo "Applying patches for selected FORTRAN compiler: ${FORTRANC}" + local PATCH + if [ -n "${PATCHES}" ]; then + for PATCH in ${PATCHES}; do + epatch ${PATCH} + done + eautoreconf + fi +} + +# fortran_pkg_setup(): +# Set FORTRAN to indicate the list of Fortran Compiler that +# can be used for the ebuild. +# If not set in ebuild, FORTRAN will default to f77 +fortran_pkg_setup() { + need_fortran ${FORTRAN:="gfortran g77"} +} + +# fortran_src_unpack(): +# Run patch_fortran if no new src_unpack() is defined. +fortran_src_unpack() { + unpack ${A} + cd "${S}" + patch_fortran +} + +EXPORT_FUNCTIONS pkg_setup src_unpack diff --git a/sdk_container/src/third_party/portage-stable/eclass/fox.eclass b/sdk_container/src/third_party/portage-stable/eclass/fox.eclass new file mode 100644 index 0000000000..9fccc28a73 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/fox.eclass @@ -0,0 +1,236 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/fox.eclass,v 1.8 2008/10/12 12:31:36 mabi Exp $ + +# fox eclass +# +# This eclass allows building SLOT-able FOX Toolkit installations +# (x11-libs/fox: headers, libs, and docs), which are by design +# parallel-installable, while installing only one version of the utils +# (dev-util/reswrap) and apps (app-editors/adie, sci-calculators/calculator, +# x11-misc/pathfinder, and x11-misc/shutterbug). +# +# Version numbering follows the kernel-style odd-even minor version +# designation. Even-number minor versions are API stable, which patch +# releases aimed mostly at the library; apps generally won't need to be +# bumped for a patch release. +# +# Odd-number versions are development branches with their own SLOT and +# are API unstable; changes are made to the apps, and likely need to be +# bumped together with the library. +# +# Here are sample [R]DEPENDs for the fox apps +# fox versions that do not use this eclass are blocked in INCOMPAT_DEP below +# 1.0: '=x11-libs/fox-1.0*' +# 1.2: '=x11-libs/fox-1.2*' +# 1.4: '=x11-libs/fox-1.4*' +# 1.5: '~x11-libs/fox-${PV}' +# 1.6: '=x11-libs/fox-${FOXVER}*' +# +# Some concepts borrowed from gst-plugins and gtk-sharp-component eclasses + +inherit eutils libtool versionator + + +FOX_PV="${FOX_PV:-${PV}}" +PVP=(${FOX_PV//[-\._]/ }) +FOXVER="${PVP[0]}.${PVP[1]}" + +if [ "${FOXVER}" != "1.0" ] ; then + FOXVER_SUFFIX="-${FOXVER}" +fi + +DESCRIPTION="C++ based Toolkit for developing Graphical User Interfaces easily and effectively" +HOMEPAGE="http://www.fox-toolkit.org/" +SRC_URI="http://www.fox-toolkit.org/ftp/fox-${FOX_PV}.tar.gz" + +IUSE="debug doc profile" + +# from fox-1.0 +FOX_APPS="adie calculator pathfinder" +# from fox-1.2+ +if [ "${FOXVER}" != "1.0" ] ; then + FOX_APPS="${FOX_APPS} shutterbug" + FOX_CHART="chart" +fi + +if [ "${PN}" != fox ] ; then + FOX_COMPONENT="${FOX_COMPONENT:-${PN}}" +fi + +if [ "${FOXVER}" != "1.0" ] && [ -z "${FOX_COMPONENT}" ] ; then + DOXYGEN_DEP="doc? ( app-doc/doxygen )" +fi + +if [ "${PN}" != reswrap ] ; then + RESWRAP_DEP="dev-util/reswrap" +fi + +# These versions are not compatible with new fox layout +# and will cause collissions - we need to block them +INCOMPAT_DEP="!= 1.2) + if use doc && [ "${FOXVER}" != "1.0" ] && [ -z "${FOX_COMPONENT}" ] ; then + cd ${S}/doc + make docs || die "doxygen error" + fi +} + +fox_src_install () { + cd ${S}/${FOX_COMPONENT} + + make install \ + DESTDIR=${D} \ + htmldir=/usr/share/doc/${PF}/html \ + artdir=/usr/share/doc/${PF}/html/art \ + screenshotsdir=/usr/share/doc/${PF}/html/screenshots \ + || die "install error" + + # create desktop menu items for apps + case ${FOX_COMPONENT} in + adie) + newicon big_gif.gif adie.gif + make_desktop_entry adie "Adie Text Editor" adie.gif + ;; + calculator) + newicon bigcalc.gif foxcalc.gif + make_desktop_entry calculator "FOX Calculator" foxcalc.gif + ;; + pathfinder) + newicon iconpath.gif pathfinder.gif + make_desktop_entry PathFinder "PathFinder" pathfinder.gif "FileManager" + ;; + shutterbug) + doicon shutterbug.gif + make_desktop_entry shutterbug "ShutterBug" shutterbug.gif "Graphics" + ;; + esac + + for doc in ADDITIONS AUTHORS LICENSE_ADDENDUM README TRACING ; do + [ -f $doc ] && dodoc $doc + done + + # remove documentation if USE=-doc + if ( ! use doc ) && [ -d ${D}/usr/share/doc/${PF}/html ] ; then + rm -fr ${D}/usr/share/doc/${PF}/html + fi + + # install class reference docs (FOXVER >= 1.2) if USE=doc + if use doc && [ "${FOXVER}" != "1.0" ] && [ -z "${FOX_COMPONENT}" ] ; then + dohtml -r ${S}/doc/ref + fi + + # slot fox-config where present (FOXVER >= 1.2) + if [ -f ${D}/usr/bin/fox-config ] ; then + mv ${D}/usr/bin/fox-config ${D}/usr/bin/fox-${FOXVER}-config + fi +} + +fox_pkg_postinst() { + if [ -z "${FOX_COMPONENT}" ] ; then + echo + einfo "Multiple versions of the FOX Toolkit library may now be installed" + einfo "in parallel SLOTs on the same system." + einfo + einfo "The reswrap utility and the applications included in the FOX Toolkit" + einfo "(adie, calculator, pathfinder, shutterbug) are now available as" + einfo "separate ebuilds." + echo + if [ "${FOXVER}" != "1.0" ] ; then + einfo "The fox-config script has been installed as fox-${FOXVER}-config." + einfo "The fox-wrapper package is used to direct calls to fox-config" + einfo "to the correct versioned script, based on the WANT_FOX variable." + einfo "For example:" + einfo + einfo " WANT_FOX=\"${FOXVER}\" fox-config " + einfo + epause + fi + fi +} + +EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_postinst diff --git a/sdk_container/src/third_party/portage-stable/eclass/freebsd.eclass b/sdk_container/src/third_party/portage-stable/eclass/freebsd.eclass new file mode 100644 index 0000000000..6793b2a918 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/freebsd.eclass @@ -0,0 +1,125 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/freebsd.eclass,v 1.14 2009/05/22 15:23:35 aballier Exp $ +# +# Diego Pettenò + +inherit versionator eutils flag-o-matic bsdmk + +LICENSE="BSD" +HOMEPAGE="http://www.freebsd.org/" + +# Define global package names +LIB="freebsd-lib-${PV}" +BIN="freebsd-bin-${PV}" +CONTRIB="freebsd-contrib-${PV}" +SHARE="freebsd-share-${PV}" +UBIN="freebsd-ubin-${PV}" +USBIN="freebsd-usbin-${PV}" +CRYPTO="freebsd-crypto-${PV}" +LIBEXEC="freebsd-libexec-${PV}" +SBIN="freebsd-sbin-${PV}" +GNU="freebsd-gnu-${PV}" +ETC="freebsd-etc-${PV}" +SYS="freebsd-sys-${PV}" +INCLUDE="freebsd-include-${PV}" +RESCUE="freebsd-rescue-${PV}" + +# Release version (5.3, 5.4, 6.0, etc) +RV="$(get_version_component_range 1-2)" + +if [[ ${PN} != "freebsd-share" ]] && [[ ${PN} != freebsd-sources ]]; then + IUSE="profile" +fi + +#unalias -a +alias install-info='/usr/bin/bsdinstall-info' + +EXPORT_FUNCTIONS src_compile src_install src_unpack + +# doperiodic ... +doperiodic() { + local kind=$1 + shift + + ( # dont want to pollute calling env + insinto /etc/periodic/${kind} + insopts -m 0755 + doins "$@" + ) +} + +freebsd_get_bmake() { + local bmake + bmake=$(get_bmake) + [[ ${CBUILD} == *-freebsd* ]] || bmake="${bmake} -m /usr/share/mk/freebsd" + + echo "${bmake}" +} + +freebsd_do_patches() { + if [[ ${#PATCHES[@]} -gt 1 ]] ; then + for x in "${PATCHES[@]}"; do + epatch "${x}" + done + else + for x in ${PATCHES} ; do + epatch "${x}" + done + fi +} + +freebsd_rename_libraries() { + ebegin "Renaming libraries" + # We don't use libtermcap, we use libncurses + find "${S}" -name Makefile -print0 | xargs -0 \ + sed -i -e 's:-ltermcap:-lncurses:g; s:{LIBTERMCAP}:{LIBNCURSES}:g' + # flex provides libfl, not libl + find "${S}" -name Makefile -print0 | xargs -0 \ + sed -i -e 's:-ll:-lfl:g; s:{LIBL}:{LIBFL}:g' + + eend $? +} + +freebsd_src_unpack() { + unpack ${A} + cd "${S}" + + dummy_mk ${REMOVE_SUBDIRS} + + freebsd_do_patches + freebsd_rename_libraries +} + +freebsd_src_compile() { + use profile && filter-flags "-fomit-frame-pointer" + use profile || \ + case "${RV}" in + 5.*) mymakeopts="${mymakeopts} NOPROFILE= " ;; + 6.*|7.*) mymakeopts="${mymakeopts} NO_PROFILE= " ;; + esac + + mymakeopts="${mymakeopts} NO_MANCOMPRESS= NO_INFOCOMPRESS=" + + # Many things breaks when using ricer flags here + [[ -z "${NOFLAGSTRIP}" ]] && strip-flags + + # Make sure to use FreeBSD definitions while crosscompiling + [[ -z "${BMAKE}" ]] && BMAKE="$(freebsd_get_bmake)" + + bsdmk_src_compile +} + +freebsd_src_install() { + use profile || \ + case "${RV}" in + 5.*) mymakeopts="${mymakeopts} NOPROFILE= " ;; + 6.*|7.*) mymakeopts="${mymakeopts} NO_PROFILE= " ;; + esac + + mymakeopts="${mymakeopts} NO_MANCOMPRESS= NO_INFOCOMPRESS=" + + [[ -z "${BMAKE}" ]] && BMAKE="$(freebsd_get_bmake)" + + bsdmk_src_install +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/freedict.eclass b/sdk_container/src/third_party/portage-stable/eclass/freedict.eclass new file mode 100644 index 0000000000..5d1e1b2ce1 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/freedict.eclass @@ -0,0 +1,51 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/freedict.eclass,v 1.18 2008/03/29 02:08:46 philantrop Exp $ + +# @ECLASS: freedict.eclass +# @MAINTAINER: +# app-dicts@gentoo.org +# +# Original author: Seemant Kulleen +# +# @BLURB: Ease the installation of freedict translation dictionaries +# @DESCRIPTION: +# This eclass exists to ease the installation of freedict translation +# dictionaries. The only variables which need to be defined in the actual +# ebuilds are FORLANG and TOLANG for the source and target languages, +# respectively. + +# @ECLASS-VARIABLE: FORLANG +# @DESCRIPTION: +# Please see above for a description. + +# @ECLASS-VARIABLE: TOLANG +# @DESCRIPTION: +# Please see above for a description. + +inherit eutils + +IUSE="" + +MY_P=${PN/freedict-/} + +S="${WORKDIR}" +DESCRIPTION="Freedict for language translation from ${FORLANG} to ${TOLANG}" +HOMEPAGE="http://www.freedict.de" +SRC_URI="http://freedict.sourceforge.net/download/linux/${MY_P}.tar.gz" + +SLOT="0" +LICENSE="GPL-2" + +DEPEND="app-text/dictd" + +# @FUNCTION: freedict_src_install +# @DESCRIPTION: +# The freedict src_install function, which is exported +freedict_src_install() { + insinto /usr/$(get_libdir)/dict + doins ${MY_P}.dict.dz + doins ${MY_P}.index +} + +EXPORT_FUNCTIONS src_install diff --git a/sdk_container/src/third_party/portage-stable/eclass/games-etmod.eclass b/sdk_container/src/third_party/portage-stable/eclass/games-etmod.eclass new file mode 100644 index 0000000000..389b382d80 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/games-etmod.eclass @@ -0,0 +1,7 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/games-etmod.eclass,v 1.15 2009/11/30 04:19:36 abcd Exp $ + +# @DEAD +# To be removed on 2011/11/30. +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" diff --git a/sdk_container/src/third_party/portage-stable/eclass/games-ggz.eclass b/sdk_container/src/third_party/portage-stable/eclass/games-ggz.eclass new file mode 100644 index 0000000000..0d09179871 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/games-ggz.eclass @@ -0,0 +1,75 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/games-ggz.eclass,v 1.5 2009/02/01 17:44:23 mr_bones_ Exp $ + +inherit base + +# For GGZ Gaming Zone packages + +case ${EAPI:-0} in + 0|1) EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm ;; + 2) EXPORT_FUNCTIONS src_configure src_compile src_install pkg_postinst pkg_postrm ;; +esac + +HOMEPAGE="http://www.ggzgamingzone.org/" +SRC_URI="mirror://ggz/${PV}/${P}.tar.gz" + +GGZ_MODDIR="/usr/share/ggz/modules" + +games-ggz_src_configure() { + econf \ + --disable-dependency-tracking \ + --enable-noregistry="${GGZ_MODDIR}" \ + $(has debug ${IUSE} && ! use debug && echo --disable-debug) \ + "$@" || die +} + +games-ggz_src_compile() { + case ${EAPI:-0} in + 0|1) games-ggz_src_configure "$@" ;; + esac + emake || die "emake failed" +} + +games-ggz_src_install() { + emake DESTDIR="${D}" install || die "emake install failed" + local f + for f in AUTHORS ChangeLog NEWS QuickStart.GGZ README* TODO ; do + [[ -f ${f} ]] && dodoc ${f} + done +} + +# Update ggz.modules with the .dsc files from ${GGZ_MODDIR}. +games-ggz_update_modules() { + [[ ${EBUILD_PHASE} == "postinst" ]] || [[ ${EBUILD_PHASE} == "postrm" ]] \ + || die "${FUNCNAME} can only be used in pkg_postinst or pkg_postrm" + + # ggz-config needs libggz, so it could be broken + ggz-config -h &> /dev/null || return 1 + + local confdir=${ROOT}/etc + local moddir=${ROOT}/${GGZ_MODDIR} + local dsc rval=0 + + mkdir -p "${confdir}" + echo -n > "${confdir}"/ggz.modules + if [[ -d ${moddir} ]] ; then + ebegin "Installing GGZ modules" + cd "${moddir}" + find . -type f -name '*.dsc' | while read dsc ; do + DESTDIR=${ROOT} ggz-config -Dim "${dsc}" || ((rval++)) + done + eend ${rval} + fi + return ${rval} +} + +# Register new modules +games-ggz_pkg_postinst() { + games-ggz_update_modules +} + +# Unregister old modules +games-ggz_pkg_postrm() { + games-ggz_update_modules +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/games-mods.eclass b/sdk_container/src/third_party/portage-stable/eclass/games-mods.eclass new file mode 100644 index 0000000000..3d9315ba4c --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/games-mods.eclass @@ -0,0 +1,319 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/games-mods.eclass,v 1.42 2009/10/12 00:53:51 nyhm Exp $ + +# Variables to specify in an ebuild which uses this eclass: +# GAME - (doom3, quake4 or ut2004, etc), unless ${PN} starts with e.g. "doom3-" +# MOD_DESC - Description for the mod +# MOD_NAME - Creates a command-line wrapper and desktop icon for the mod +# MOD_DIR - Subdirectory name for the mod, if applicable +# MOD_ICON - Custom icon for the mod, instead of the default + +inherit eutils games + +EXPORT_FUNCTIONS src_install pkg_postinst + +[[ -z ${GAME} ]] && GAME=${PN%%-*} + +case ${GAME} in + doom3) + GAME_PKGS="games-fps/doom3" + GAME_DIRS=( "${GAMES_PREFIX_OPT}"/doom3 ) + GAME_NAME="Doom 3" + GAME_BIN="doom3" + GAME_ICON="doom3" + DED_PKGS="" + DED_BIN="doom3-ded" + DED_OPTS="+set dedicated 1 +exec server.cfg" + DED_CFG_DIR=".doom3" + SELECT_MOD="+set fs_game " + ;; + enemy-territory) + GAME_PKGS="games-fps/enemy-territory" + GAME_DIRS=( "${GAMES_PREFIX_OPT}"/enemy-territory ) + GAME_NAME="Enemy Territory" + GAME_BIN="et" + GAME_ICON="ET" + DED_PKGS="" + DED_BIN="et-ded" + DED_OPTS="+set dedicated 1 +exec server.cfg" + DED_CFG_DIR=".etwolf" + SELECT_MOD="+set fs_game " + ;; + quake3) + GAME_PKGS="games-fps/quake3 games-fps/quake3-bin" + GAME_DIRS=( "${GAMES_DATADIR}"/quake3 "${GAMES_PREFIX_OPT}"/quake3 ) + GAME_NAME="Quake III" + GAME_BIN="quake3" + GAME_ICON="quake3" + DED_PKGS="" + DED_BIN="quake3-ded" + DED_OPTS="+set dedicated 1 +exec server.cfg" + DED_CFG_DIR=".q3a" + SELECT_MOD="+set fs_game " + ;; + quake4) + GAME_PKGS="games-fps/quake4-bin" + GAME_DIRS=( "${GAMES_PREFIX_OPT}"/quake4 ) + GAME_NAME="Quake 4" + GAME_BIN="quake4" + GAME_ICON="/usr/share/pixmaps/quake4.bmp" + DED_PKGS="" + DED_BIN="quake4-ded" + DED_OPTS="+set dedicated 1 +exec server.cfg" + DED_CFG_DIR=".quake4" + SELECT_MOD="+set fs_game " + ;; + ut2003) + GAME_PKGS="games-fps/ut2003" + GAME_DIRS=( "${GAMES_PREFIX_OPT}"/ut2003 ) + GAME_NAME="UT2003" + GAME_BIN="ut2003" + GAME_ICON="ut2003" + DED_PKGS="" + DED_BIN="ucc" + DED_OPTS="" + DED_CFG_DIR="" + SELECT_MOD="-mod=" + ;; + ut2004) + GAME_PKGS="games-fps/ut2004" + GAME_DIRS=( "${GAMES_PREFIX_OPT}"/{ut2004,ut2004-ded} ) + GAME_NAME="UT2004" + GAME_BIN="ut2004" + GAME_ICON="ut2004" + DED_PKGS="games-server/ut2004-ded" + DED_BIN="ut2004-ded" + DED_OPTS="" + DED_CFG_DIR="" + SELECT_MOD="-mod=" + ;; + *) + eerror "This game is either not supported or you must set the GAME" + eerror "variable to the proper game." + die "games-mods.eclass: unsupported GAME" + ;; +esac + +MOD_BIN="${GAME_BIN}-${PN/${GAME}-}" +MOD_DED_BIN="${MOD_BIN}-ded" + +games-mods_get_rdepend() { + local pkgs + + if [[ ${1} == "--ded" ]] ; then + pkgs=( ${DED_PKGS} ${GAME_PKGS} ) + else + pkgs=( ${GAME_PKGS} ) + fi + + [[ ${#pkgs[@]} -gt 1 ]] && echo -n "|| ( " + + case ${EAPI:-0} in + 0|1) echo -n "${pkgs[@]}" ;; + 2) + local p + if [[ ${1} == "--ded" ]] ; then + echo -n "${DED_PKGS}" + for p in ${GAME_PKGS} ; do + echo -n " ${p}[dedicated]" + done + else + for p in ${GAME_PKGS} ; do + echo -n " || ( ${p}[opengl] ${p}[-dedicated] )" + done + fi + ;; + esac + + [[ ${#pkgs[@]} -gt 1 ]] && echo -n " )" +} + +DESCRIPTION="${GAME_NAME} ${MOD_NAME} - ${MOD_DESC}" + +SLOT="0" +IUSE="dedicated opengl" +RESTRICT="mirror strip" + +DEPEND="app-arch/unzip" +RDEPEND="dedicated? ( $(games-mods_get_rdepend --ded) ) + opengl? ( $(games-mods_get_rdepend) ) + !dedicated? ( !opengl? ( $(games-mods_get_rdepend) ) )" + +S=${WORKDIR} + +INS_DIR=${GAMES_DATADIR}/${GAME} + +games-mods_use_opengl() { + [[ -z ${MOD_DIR} ]] && return 1 + + if use opengl || ! use dedicated ; then + # Use opengl by default + return 0 + fi + + return 1 +} + +games-mods_use_dedicated() { + [[ -z ${MOD_DIR} ]] && return 1 + + use dedicated && return 0 || return 1 +} + +games-mods_dosyms() { + # We are installing everything for these mods into ${INS_DIR}, + # ${GAMES_DATADIR}/${GAME} in most cases, and symlinking it + # into ${GAMES_PREFIX_OPT}/${GAME} for each game. This should + # allow us to support both binary and source-based games easily. + local dir + for dir in "${GAME_DIRS[@]}" ; do + [[ -z ${dir} || ${INS_DIR} == ${dir} ]] && continue + pushd "${D}/${INS_DIR}" > /dev/null || die "pushd failed" + local i + for i in * ; do + if [[ -d ${i} ]] ; then + if [[ ${i} == ${MOD_DIR} ]] ; then + dosym "${INS_DIR}/${i}" "${dir}/${i}" \ + || die "dosym ${i} failed" + else + local f + while read f ; do + dosym "${INS_DIR}/${f}" "${dir}/${f}" \ + || die "dosym ${f} failed" + done < <(find "${i}" -type f) + fi + elif [[ -f ${i} ]] ; then + dosym "${INS_DIR}/${i}" "${dir}/${i}" \ + || die "dosym ${i} failed" + else + die "${i} shouldn't be there" + fi + done + popd > /dev/null || die "popd failed" + done +} + +games-mods_make_initd() { + cat < "${T}"/${MOD_DED_BIN} +#!/sbin/runscript +$(head -n 2 ${PORTDIR}/header.txt) +# Generated by games-mods.eclass + +depend() { + need net +} + +start() { + ebegin "Starting ${MOD_DED_BIN}" + start-stop-daemon --start --quiet --background --make-pidfile \\ + --pidfile /var/run/${MOD_DED_BIN}.pid \\ + --chuid \${${MOD_DED_BIN//-/_}_user}:\${${MOD_DED_BIN//-/_}_group} \\ + --env HOME="\${${MOD_DED_BIN//-/_}_home}" \\ + --exec "${GAMES_BINDIR}/${MOD_DED_BIN}" \\ + -- \${${MOD_DED_BIN//-/_}_opts} + eend \$? +} + +stop() { + ebegin "Stopping ${MOD_DED_BIN}" + start-stop-daemon --stop \\ + --pidfile /var/run/${MOD_DED_BIN}.pid + eend \$? +} +EOF + + doinitd "${T}"/${MOD_DED_BIN} || die "doinitd failed" +} + +games-mods_make_confd() { + cat <<-EOF > "${T}"/${MOD_DED_BIN} + # User and group the server should run as + ${MOD_DED_BIN//-/_}_user="${GAMES_USER_DED}" + ${MOD_DED_BIN//-/_}_group="${GAMES_GROUP}" + + # Directory to use for HOME + ${MOD_DED_BIN//-/_}_home="${GAMES_PREFIX}" + + # Any extra options you want to pass to the dedicated server + ${MOD_DED_BIN//-/_}_opts="" + EOF + + doconfd "${T}"/${MOD_DED_BIN} || die "doconfd failed" +} + +games-mods_src_install() { + if games-mods_use_opengl ; then + if [[ -n ${MOD_ICON} ]] ; then + # Install custom icon + local ext=${MOD_ICON##*.} + if [[ -f ${MOD_ICON} ]] ; then + newicon "${MOD_ICON}" ${PN}.${ext} || die "newicon failed" + else + newicon ${MOD_DIR}/"${MOD_ICON}" ${PN}.${ext} \ + || die "newicon failed" + fi + case ${ext} in + bmp|ico) + MOD_ICON=/usr/share/pixmaps/${PN}.${ext} + ;; + *) + MOD_ICON=${PN} + ;; + esac + else + # Use the game's standard icon + MOD_ICON=${GAME_ICON} + fi + + games_make_wrapper ${MOD_BIN} "${GAME_BIN} ${SELECT_MOD}${MOD_DIR}" + make_desktop_entry ${MOD_BIN} "${GAME_NAME} - ${MOD_NAME}" "${MOD_ICON}" + # Since only quake3 has both a binary and a source-based install, + # we only look for quake3 here. + case ${GAME} in + quake3) + if has_version games-fps/quake3-bin ; then + games_make_wrapper ${GAME_BIN}-bin-${PN/${GAME}-} \ + "${GAME_BIN}-bin ${SELECT_MOD}${MOD_DIR}" + fi + make_desktop_entry ${GAME_BIN}-bin-${PN/${GAME}-} \ + "${GAME_NAME} - ${MOD_NAME} (binary)" "${MOD_ICON}" + ;; + esac + fi + + # We expect anything not wanted to have been deleted by the ebuild + insinto "${INS_DIR}" + doins -r * || die "doins -r failed" + games-mods_dosyms + + if games-mods_use_dedicated ; then + if [[ -f ${FILESDIR}/server.cfg ]] ; then + insinto "${GAMES_SYSCONFDIR}"/${GAME}/${MOD_DIR} + doins "${FILESDIR}"/server.cfg || die "doins server.cfg failed" + dosym "${GAMES_SYSCONFDIR}"/${GAME}/${MOD_DIR}/server.cfg \ + "${GAMES_PREFIX}"/${DED_CFG_DIR}/${MOD_DIR}/server.cfg \ + || die "dosym server.cfg failed" + fi + games_make_wrapper ${MOD_DED_BIN} \ + "\"${GAMES_BINDIR}/${DED_BIN}\" ${SELECT_MOD}${MOD_DIR} ${DED_OPTS}" + games-mods_make_initd + games-mods_make_confd + fi + + prepgamesdirs +} + +games-mods_pkg_postinst() { + games_pkg_postinst + if games-mods_use_opengl ; then + elog "To play this mod run:" + elog " ${MOD_BIN}" + fi + if games-mods_use_dedicated ; then + elog "To launch a dedicated server run:" + elog " ${MOD_DED_BIN}" + elog "To launch the server at startup run:" + elog " rc-update add ${MOD_DED_BIN} default" + fi +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/games-q3mod.eclass b/sdk_container/src/third_party/portage-stable/eclass/games-q3mod.eclass new file mode 100644 index 0000000000..3440889a3f --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/games-q3mod.eclass @@ -0,0 +1,144 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/games-q3mod.eclass,v 1.36 2007/03/07 15:23:39 wolf31o2 Exp $ + +inherit games + +EXPORT_FUNCTIONS src_install pkg_postinst + +DESCRIPTION="Quake III - ${MOD_DESC}" + +SLOT="0" +KEYWORDS="-* amd64 ~ppc x86" +IUSE="dedicated" + +DEPEND="app-arch/unzip" +RDEPEND="|| ( games-fps/quake3 games-fps/quake3-bin ) + amd64? ( app-emulation/emul-linux-x86-baselibs ) + dedicated? ( app-misc/screen )" + +S=${WORKDIR} + +games-q3mod_src_install() { + [[ -z ${MOD_NAME} ]] && die "what is the name of this q3mod ?" + + local bdir=${GAMES_PREFIX_OPT}/quake3 + local mdir=${bdir}/${MOD_NAME} + MOD_BINS=${MOD_BINS:-${MOD_NAME}} + + if [[ -d ${MOD_NAME} ]] ; then + dodir "${bdir}" + mv ${MOD_NAME} "${D}/${bdir}/" + fi + if [[ -d baseq3 ]] ; then + dodir "${bdir}" + mv baseq3 "${D}/${bdir}/" + fi + if [[ ! -z $(ls "${S}"/* 2> /dev/null) ]] ; then + dodir "${mdir}" + mv "${S}"/* "${D}/${mdir}/" + fi + + if use dedicated; then + games-q3mod_make_q3ded_exec + newgamesbin "${T}"/q3${MOD_NAME}-ded.bin q3${MOD_BINS}-ded + fi + games-q3mod_make_quake3_exec + newgamesbin "${T}"/quake3-${MOD_NAME}.bin quake3-${MOD_BINS} + + if use dedicated; then + games-q3mod_make_init.d + newinitd "${T}"/q3${MOD_NAME}-ded.init.d q3${MOD_BINS}-ded + games-q3mod_make_conf.d + newconfd "${T}"/q3${MOD_NAME}-ded.conf.d q3${MOD_BINS}-ded + fi + + dodir "${GAMES_SYSCONFDIR}"/quake3 + + dodir "${bdir}"/q3a-homedir + dosym "${bdir}"/q3a-homedir "${GAMES_PREFIX}"/.q3a + keepdir "${bdir}"/q3a-homedir + prepgamesdirs + chmod g+rw "${D}/${mdir}" "${D}/${bdir}"/q3a-homedir + chmod -R g+rw "${D}/${GAMES_SYSCONFDIR}"/quake3 +} + +games-q3mod_pkg_postinst() { + local samplecfg=${FILESDIR}/server.cfg + local realcfg=${GAMES_PREFIX_OPT}/quake3/${MOD_NAME}/server.cfg + if [[ -e ${samplecfg} ]] && [[ ! -e ${realcfg} ]] ; then + cp "${samplecfg}" "${realcfg}" + fi + + einfo "To play this mod: quake3-${MOD_BINS}" + use dedicated && \ + einfo "To launch a dedicated server: q3${MOD_BINS}-ded" && \ + einfo "To launch server at startup: /etc/init.d/q3${MOD_NAME}-ded" + + games_pkg_postinst +} + +games-q3mod_make_q3ded_exec() { +cat << EOF > "${T}"/q3${MOD_NAME}-ded.bin +#!/bin/sh +exec "${GAMES_BINDIR}"/q3ded-bin +set fs_game ${MOD_NAME} +set dedicated 1 +exec server.cfg \${@} +EOF +} + +games-q3mod_make_quake3_exec() { +cat << EOF > "${T}"/quake3-${MOD_NAME}.bin +#!/bin/sh +exec "${GAMES_BINDIR}"/quake3-bin +set fs_game ${MOD_NAME} \${@} +EOF +} + +games-q3mod_make_init.d() { +cat << EOF > "${T}"/q3${MOD_NAME}-ded.init.d +#!/sbin/runscript +$(<"${PORTDIR}"/header.txt) + +depend() { + need net +} + +start() { + ebegin "Starting ${MOD_NAME} dedicated" + screen -A -m -d -S q3${MOD_BINS}-ded su - ${GAMES_USER_DED} -c "${GAMES_BINDIR}/q3${MOD_BINS}-ded \${${MOD_NAME}_OPTS}" + eend \$? +} + +stop() { + ebegin "Stopping ${MOD_NAME} dedicated" + local pid=\`screen -list | grep q3${MOD_BINS}-ded | awk -F . '{print \$1}' | sed -e s/.//\` + if [[ -z "\${pid}" ]] ; then + eend 1 "Lost screen session" + else + pid=\`pstree -p \${pid} | sed -e 's:^.*q3ded::'\` + pid=\${pid:1:\${#pid}-2} + if [[ -z "\${pid}" ]] ; then + eend 1 "Lost q3ded session" + else + kill \${pid} + eend \$? "Could not kill q3ded" + fi + fi +} + +status() { + screen -list | grep q3${MOD_BINS}-ded +} +EOF +} + +games-q3mod_make_conf.d() { + if [[ -e ${FILESDIR}/${MOD_NAME}.conf.d ]] ; then + cp "${FILESDIR}"/${MOD_NAME}.conf.d "${T}"/q3${MOD_NAME}-ded.conf.d + return 0 + fi +cat << EOF > "${T}"/q3${MOD_NAME}-ded.conf.d +$(<"${PORTDIR}"/header.txt) + +# Any extra options you want to pass to the dedicated server +${MOD_NAME}_OPTS="+set vm_game 0 +set sv_pure 1 +set bot_enable 0 +set com_hunkmegs 64 +set net_port 27960" +EOF +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/games-ut2k4mod.eclass b/sdk_container/src/third_party/portage-stable/eclass/games-ut2k4mod.eclass new file mode 100644 index 0000000000..d4fd8b1457 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/games-ut2k4mod.eclass @@ -0,0 +1,7 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/games-ut2k4mod.eclass,v 1.12 2009/11/30 04:19:36 abcd Exp $ + +# @DEAD +# To be removed on 2011/11/30. +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" diff --git a/sdk_container/src/third_party/portage-stable/eclass/games.eclass b/sdk_container/src/third_party/portage-stable/eclass/games.eclass new file mode 100644 index 0000000000..5f8300a5f9 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/games.eclass @@ -0,0 +1,219 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/games.eclass,v 1.141 2010/01/03 19:13:44 scarabeus Exp $ + +# devlist: {vapier,wolf31o2,mr_bones_}@gentoo.org -> games@gentoo.org +# +# This is the games eclass for standardizing the install of games ... +# you better have a *good* reason why you're *not* using games.eclass +# in a games-* ebuild + +inherit base multilib toolchain-funcs eutils + +case ${EAPI:-0} in + 0|1) EXPORT_FUNCTIONS pkg_setup src_compile pkg_preinst pkg_postinst ;; + 2) EXPORT_FUNCTIONS pkg_setup src_configure src_compile pkg_preinst pkg_postinst ;; +esac + +DESCRIPTION="Based on the ${ECLASS} eclass" + +export GAMES_PREFIX=${GAMES_PREFIX:-/usr/games} +export GAMES_PREFIX_OPT=${GAMES_PREFIX_OPT:-/opt} +export GAMES_DATADIR=${GAMES_DATADIR:-/usr/share/games} +export GAMES_DATADIR_BASE=${GAMES_DATADIR_BASE:-/usr/share} # some packages auto append 'games' +export GAMES_SYSCONFDIR=${GAMES_SYSCONFDIR:-/etc/games} +export GAMES_STATEDIR=${GAMES_STATEDIR:-/var/games} +export GAMES_LOGDIR=${GAMES_LOGDIR:-/var/log/games} +export GAMES_BINDIR=${GAMES_BINDIR:-${GAMES_PREFIX}/bin} +export GAMES_ENVD="90games" +# if you want to use a different user/group than games.games, +# just add these two variables to your environment (aka /etc/profile) +export GAMES_USER=${GAMES_USER:-root} +export GAMES_USER_DED=${GAMES_USER_DED:-games} +export GAMES_GROUP=${GAMES_GROUP:-games} + +games_get_libdir() { + echo ${GAMES_PREFIX}/$(get_libdir) +} + +egamesconf() { + econf \ + --prefix="${GAMES_PREFIX}" \ + --libdir="$(games_get_libdir)" \ + --datadir="${GAMES_DATADIR}" \ + --sysconfdir="${GAMES_SYSCONFDIR}" \ + --localstatedir="${GAMES_STATEDIR}" \ + "$@" +} + +gameswrapper() { + # dont want to pollute calling env + ( + into "${GAMES_PREFIX}" + cmd=$1 + shift + ${cmd} "$@" + ) +} + +dogamesbin() { gameswrapper ${FUNCNAME/games} "$@"; } +dogamessbin() { gameswrapper ${FUNCNAME/games} "$@"; } +dogameslib() { gameswrapper ${FUNCNAME/games} "$@"; } +dogameslib.a() { gameswrapper ${FUNCNAME/games} "$@"; } +dogameslib.so() { gameswrapper ${FUNCNAME/games} "$@"; } +newgamesbin() { gameswrapper ${FUNCNAME/games} "$@"; } +newgamessbin() { gameswrapper ${FUNCNAME/games} "$@"; } + +games_make_wrapper() { gameswrapper ${FUNCNAME/games_} "$@"; } + +gamesowners() { chown ${GAMES_USER}:${GAMES_GROUP} "$@"; } +gamesperms() { chmod u+rw,g+r-w,o-rwx "$@"; } +prepgamesdirs() { + local dir f mode + for dir in \ + "${GAMES_PREFIX}" "${GAMES_PREFIX_OPT}" "${GAMES_DATADIR}" \ + "${GAMES_SYSCONFDIR}" "${GAMES_STATEDIR}" "$(games_get_libdir)" \ + "${GAMES_BINDIR}" "$@" + do + [[ ! -d ${D}/${dir} ]] && continue + ( + gamesowners -R "${D}/${dir}" + find "${D}/${dir}" -type d -print0 | xargs -0 chmod 750 + mode=o-rwx,g+r,g-w + [[ ${dir} = ${GAMES_STATEDIR} ]] && mode=o-rwx,g+r + find "${D}/${dir}" -type f -print0 | xargs -0 chmod $mode + + # common trees should not be games owned #264872 + if [[ ${dir} == "${GAMES_PREFIX_OPT}" ]] ; then + fowners root:root "${dir}" + fperms 755 "${dir}" + for d in $(get_libdir) bin ; do + fowners root:root "${dir}/${d}" + fperms 755 "${dir}/${d}" + done + fi + ) &>/dev/null + + f=$(find "${D}/${dir}" -perm +4000 -a -uid 0 2>/dev/null) + if [[ -n ${f} ]] ; then + eerror "A game was detected that is setuid root!" + eerror "${f}" + die "refusing to merge a setuid root game" + fi + done + [[ -d ${D}/${GAMES_BINDIR} ]] || return 0 + find "${D}/${GAMES_BINDIR}" -maxdepth 1 -type f -exec chmod 750 '{}' \; +} + +gamesenv() { + local d libdirs + + for d in $(get_all_libdirs) ; do + libdirs="${libdirs}:${GAMES_PREFIX}/${d}" + done + + # Wish we could use doevnd here, but we dont want the env + # file to be tracked in the CONTENTS of every game + cat <<-EOF > "${ROOT}"/etc/env.d/${GAMES_ENVD} + LDPATH="${libdirs:1}" + PATH="${GAMES_BINDIR}" + EOF +} + +games_pkg_setup() { + tc-export CC CXX + [[ ${GAMES_CHECK_LICENSE} == "yes" ]] && check_license ${LICENSE} + + enewgroup "${GAMES_GROUP}" 35 + [[ ${GAMES_USER} != "root" ]] \ + && enewuser "${GAMES_USER}" 35 -1 "${GAMES_PREFIX}" "${GAMES_GROUP}" + [[ ${GAMES_USER_DED} != "root" ]] \ + && enewuser "${GAMES_USER_DED}" 36 /bin/bash "${GAMES_PREFIX}" "${GAMES_GROUP}" + + # Dear portage team, we are so sorry. Lots of love, games team. + # See Bug #61680 + [[ ${USERLAND} != "GNU" ]] && return 0 + [[ $(getent passwd "${GAMES_USER_DED}" | cut -f7 -d:) == "/bin/false" ]] \ + && usermod -s /bin/bash "${GAMES_USER_DED}" +} + +games_src_configure() { + [[ -x ./configure ]] && egamesconf +} + +games_src_compile() { + case ${EAPI:-0} in + 0|1) games_src_configure ;; + esac + base_src_make +} + +games_pkg_preinst() { + local f + + while read f ; do + if [[ -e ${ROOT}/${GAMES_STATEDIR}/${f} ]] ; then + cp -p \ + "${ROOT}/${GAMES_STATEDIR}/${f}" \ + "${D}/${GAMES_STATEDIR}/${f}" \ + || die "cp failed" + # make the date match the rest of the install + touch "${D}/${GAMES_STATEDIR}/${f}" + fi + done < <(find "${D}/${GAMES_STATEDIR}" -type f -printf '%P\n' 2>/dev/null) +} + +# pkg_postinst function ... create env.d entry and warn about games group +games_pkg_postinst() { + gamesenv + if [[ -z "${GAMES_SHOW_WARNING}" ]] ; then + ewarn "Remember, in order to play games, you have to" + ewarn "be in the '${GAMES_GROUP}' group." + echo + case ${CHOST} in + *-darwin*) ewarn "Just run 'niutil -appendprop / /groups/games users '";; + *-freebsd*|*-dragonfly*) ewarn "Just run 'pw groupmod ${GAMES_GROUP} -m '";; + *) ewarn "Just run 'gpasswd -a ${GAMES_GROUP}', then have re-login.";; + esac + echo + einfo "For more info about Gentoo gaming in general, see our website:" + einfo " http://games.gentoo.org/" + echo + fi +} + +# Unpack .uz2 files for UT2003/UT2004 +# $1: directory or file to unpack +games_ut_unpack() { + local ut_unpack="$1" + local f= + + if [[ -z ${ut_unpack} ]] ; then + die "You must provide an argument to games_ut_unpack" + fi + if [[ -f ${ut_unpack} ]] ; then + uz2unpack "${ut_unpack}" "${ut_unpack/.uz2/}" &>/dev/null \ + || die "uncompressing file ${ut_unpack}" + fi + if [[ -d ${ut_unpack} ]] ; then + while read f ; do + uz2unpack "${ut_unpack}/${f}" "${ut_unpack}/${f%.uz2}" &>/dev/null \ + || die "uncompressing file ${f}" + rm -f "${ut_unpack}/${f}" || die "deleting compressed file ${f}" + done < <(find "${ut_unpack}" -maxdepth 1 -name '*.uz2' -printf '%f\n' 2>/dev/null) + fi +} + +# Unpacks .umod/.ut2mod/.ut4mod files for UT/UT2003/UT2004 +# Usage: games_umod_unpack $1 +# oh, and don't forget to set 'dir' and 'Ddir' +games_umod_unpack() { + local umod=$1 + mkdir -p "${Ddir}"/System + cp "${dir}"/System/{ucc-bin,{Manifest,Def{ault,User}}.ini,{Engine,Core,zlib,ogg,vorbis}.so,{Engine,Core}.int} "${Ddir}"/System + cd "${Ddir}"/System + UT_DATA_PATH=${Ddir}/System ./ucc-bin umodunpack -x "${S}/${umod}" -nohomedir &> /dev/null \ + || die "uncompressing file ${umod}" + rm -f "${Ddir}"/System/{ucc-bin,{Manifest,Def{ault,User},User,UT200{3,4}}.ini,{Engine,Core,zlib,ogg,vorbis}.so,{Engine,Core}.int,ucc.log} &>/dev/null \ + || die "Removing temporary files" +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/gdesklets.eclass b/sdk_container/src/third_party/portage-stable/eclass/gdesklets.eclass new file mode 100644 index 0000000000..df0b643a50 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/gdesklets.eclass @@ -0,0 +1,205 @@ +# Copyright 2004-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License, v2 or later +# $Header: /var/cvsroot/gentoo-x86/eclass/gdesklets.eclass,v 1.18 2009/05/13 02:11:24 nixphoeni Exp $ +# +# Authors: Joe Sapp +# Mike Gardiner +# +# Usage: +# As a writer for an ebuild for gDesklets, you should set a few things: +# +# DESKLET_NAME: The name of the desklet. +# DOCS: Anything (like a README) that should be dodoc'd. +# S: *Optional* The package's base directory. +# Usually ${WORKDIR}/${DESKLET_NAME} if it was packaged +# correctly (hence, this is the default). +# RDEPEND: *Optional* Set if the desklet requires a minimum version +# of gDesklets greater than 0.34 or other packages. + +inherit eutils multilib python + + +MY_PN="${DESKLET_NAME}" +MY_P="${MY_PN}-${PV}" +S="${WORKDIR}/${DESKLET_NAME}" + +SRC_URI="http://gdesklets.de/files/desklets/${MY_PN}/${MY_P}.tar.gz" + +# Ebuild writer shouldn't need to touch these (except maybe $RDEPEND) +SLOT="0" +IUSE="" +RDEPEND=">=gnome-extra/gdesklets-core-0.34.3-r1" + +GDESKLETS_INST_DIR="${ROOT}usr/$(get_libdir)/gdesklets" + +gdesklets_src_install() { + + debug-print-function $FUNCNAME $* + + # Disable compilation of included python modules (Controls) + python_disable_pyc + + # Do not remove - see bugs 126890 and 128289 + addwrite "${ROOT}/root/.gnome2" + + has_version ">=gnome-extra/gdesklets-core-0.33.1" || \ + GDESKLETS_INST_DIR="/usr/share/gdesklets" + + # This should be done by the gdesklets-core ebuild + # It makes the Displays or Controls directory in the + # global installation directory if it doesn't exist + [[ -d "${GDESKLETS_INST_DIR}/Displays" ]] || \ + dodir "${GDESKLETS_INST_DIR}/Displays" + + # The displays only need to be readable + insopts -m0744 + + # Check to see if DISPLAY is set for the + # gdesklets-control-getid script to run without + # error + [ -z "${DISPLAY}" ] && DISPLAY="" + export DISPLAY + + debug-print-section sensor_install + # First, install the Sensor (if there is one) + if [[ -n "${SENSOR_NAME}" ]]; then + for SENS in ${SENSOR_NAME[@]}; do + einfo "Installing Sensor ${SENS}" + /usr/bin/python "Install_${SENS}_Sensor.bin" \ + --nomsg "${D}${GDESKLETS_INST_DIR}/Sensors" || \ + die "Couldn't Install Sensor" + + chown -R root:0 "${D}${GDESKLETS_INST_DIR}/Sensors/${SENSOR_NAME}" + done # for in ${SENSOR_NAME} + fi # if -n "${SENSOR_NAME}" + + debug-print-section display_install + # This finds the Displays + DISPLAY_FILES=(`find . -iname "*.display"`) + + DESKLET_INSDIR="" + + # There is most likely only one display per package + if [[ -n "${DISPLAY_FILES[@]}" ]]; then + # Base installation directory for displays from this desklet + DESKLET_INSDIR="${GDESKLETS_INST_DIR}/Displays/${DESKLET_NAME}" + + # This creates the subdirectory of ${DESKLET_NAME} + # in the global Displays directory + [[ -d "${DESKLET_INSDIR}" ]] || \ + dodir "${DESKLET_INSDIR}" + + # For each of the Display files, there may be + # scripts included inline which don't necessarily + # follow any naming scheme. + # So for each of them, determine what those scripts are + # and install them. + for DSP in ${DISPLAY_FILES[@]}; do + + cd `dirname ${DSP}` + einfo "Installing Display `basename ${DSP} .display`" + debug-print "Installing ${DSP} into ${DESKLET_INSDIR}" + DSP=`basename ${DSP}` + insinto "${DESKLET_INSDIR}" + doins "${DSP}" + + SCRIPTS=$(grep "script .*uri" ${DSP} | \ + sed -e "s:.*.*: :g") + + # For each one of the scripts, change to its + # base directory and change the install location + # so it gets installed at the proper place + # relative to the display. + for SCR in ${SCRIPTS[@]}; do + + insinto "${DESKLET_INSDIR}/`dirname ${SCR}`" + doins "${SCR}" + debug-print "Installed ${SCR} into ${DESKLET_INSDIR}/`dirname ${SCR}`" + + done # for in ${SCRIPTS} + + # Install the graphics for this display. + # If there are multiple displays in this + # directory, this will be done more than + # once. It's the only solution I can + # come up with for now... + GFX=(`find . \ + -iname "*.png" -o -iname "*.svg" \ + -o -iname "*.jpg" -o -iname "*.gif" \ + -o -iname "*.xcf"`) + + for G in ${GFX[@]}; do + + insinto "${DESKLET_INSDIR}/`dirname ${G}`" + doins "${G}" + debug-print "Installed ${G} into ${DESKLET_INSDIR}/`dirname ${G}`" + + done # for in ${GFX} + + cd "${S}" + + done # for in ${DISPLAY_FILES} + + fi + + debug-print-section control_install + + CONTROL_INSDIR="" + + # Make sure that it only finds Controls and not Sensors + # If it uses a Sensor, it shouldn't use a Control (since + # Sensors are deprecated). + if [[ -z "${SENSOR_NAME}" ]]; then + + # Base installation directory for Controls + CONTROL_INSDIR="${GDESKLETS_INST_DIR}/Controls" + + CONTROL_INITS=$(find . -iname "__init__.py") + + # There are possibly multiple Controls packaged with the display. + # For each __init__.py found, there must be a Control associated with it. + for CTRL in ${CONTROL_INITS[@]}; do + + cd `dirname ${CTRL}` + CTRL_NAME=$( "${GDESKLETS_INST_DIR}/gdesklets-control-getid" `pwd` ) + einfo "Installing Control ${CTRL_NAME}" + # This creates the subdirectory of ${CTRL_NAME} + # in the global Controls directory + [[ -d "${CONTROL_INSDIR}/${CTRL_NAME}" ]] || \ + dodir "${CONTROL_INSDIR}/${CTRL_NAME}" + + insinto "${CONTROL_INSDIR}/${CTRL_NAME}" + + doins -r *.py + + cd "${S}" + + done # for in ${CONTROL_INITS} + + fi # if no Sensors + + # Install any remaining graphics and other files + # that are sitting in ${S}. + + GFX=$(find . -maxdepth 1 \ + -iname "*.png" -o -iname "*.svg" \ + -o -iname "*.jpg" -o -iname "*.gif" \ + -o -iname "*.xcf") + + if [[ -n "${GFX}" ]]; then + + # Install to the Displays directory of the Desklet + insinto "${GDESKLETS_INST_DIR}/Displays/${DESKLET_NAME}" + doins "${GFX}" + debug-print "Installed ${GFX} into ${GDESKLETS_INST_DIR}/Displays/${DESKLET_NAME}" + + fi # if -n "${GFX}" + + # Install some docs if so requested + [[ -n "${DOCS}" ]] && dodoc ${DOCS} && \ + debug-print "Installed ${DOCS}" + +} + + +EXPORT_FUNCTIONS src_install diff --git a/sdk_container/src/third_party/portage-stable/eclass/gems.eclass b/sdk_container/src/third_party/portage-stable/eclass/gems.eclass new file mode 100644 index 0000000000..67acbfede5 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/gems.eclass @@ -0,0 +1,130 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/gems.eclass,v 1.32 2009/11/29 19:10:01 flameeyes Exp $ + +# @ECLASS: gems.eclass +# @MAINTAINER: +# ruby@gentoo.org +# +# Original Author: Rob Cakebread +# +# @BLURB: Eclass helping with the installation of RubyGems +# @DESCRIPTION: +# See http://dev.gentoo.org/~pythonhead/ruby/gems.html for notes on using gems with Portage. + +# @ECLASS-VARIABLE: USE_RUBY +# @DESCRIPTION: +# Ruby versions the gem is compatible to. The eclass will install the gem for +# versions that are compatible and installed on the system. Format: rubyDD where +# DD is the two-digit version suffix (e.g.: USE_RUBY="ruby19" for Ruby 1.9.1) + +inherit eutils ruby + +SRC_URI="mirror://rubygems/${P}.gem" + +IUSE="doc" + +DEPEND=" + || ( >=dev-ruby/rubygems-1.3.1 =dev-lang/ruby-1.9* ) + !=1.3.0 needs a path fix + local gte13=$(/usr/bin/${ruby_version} -rubygems -e 'puts Gem::RubyGemsVersion >= "1.3.0"') + + /usr/bin/${ruby_version} /usr/bin/gem install ${GEM_SRC} \ + --version ${PV} ${myconf} --local --install-dir "${D}/${GEMSDIR}" \ + --sandbox-fix --no-user-install || die "gem (>=1.3.0) install failed" + + if [[ -d "${D}/${GEMSDIR}/bin" ]] ; then + exeinto /usr/bin + for exe in "${D}"/${GEMSDIR}/bin/* ; do + if [ "$num_ruby_slots" -ge 2 ] ; then + # Ensures that the exe file gets run using the currently + # selected version of ruby. + sed -i -e 's@^#!/usr/bin/ruby.*$@#!/usr/bin/ruby@' "${exe}" + fi + doexe "${exe}" || die + done + fi + done +} + +EXPORT_FUNCTIONS src_unpack src_compile src_install diff --git a/sdk_container/src/third_party/portage-stable/eclass/ghc-package.eclass b/sdk_container/src/third_party/portage-stable/eclass/ghc-package.eclass new file mode 100644 index 0000000000..03f85e3754 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/ghc-package.eclass @@ -0,0 +1,341 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.27 2009/03/23 20:06:19 kolmodin Exp $ +# +# Author: Andres Loeh +# Maintained by: Haskell herd +# +# This eclass helps with the Glasgow Haskell Compiler's package +# configuration utility. + +inherit versionator + +# promote /opt/ghc/bin to a better position in the search path +PATH="/usr/bin:/opt/ghc/bin:${PATH}" + +# for later configuration using environment variables/ +# returns the name of the ghc executable +ghc-getghc() { + type -P ghc +} + +# returns the name of the ghc-pkg executable +ghc-getghcpkg() { + type -P ghc-pkg +} + +# returns the name of the ghc-pkg binary (ghc-pkg +# itself usually is a shell script, and we have to +# bypass the script under certain circumstances); +# for Cabal, we add an empty global package config file, +# because for some reason the global package file +# must be specified +ghc-getghcpkgbin() { + if version_is_at_least "6.10" "$(ghc-version)"; then + # the ghc-pkg executable changed name in ghc 6.10, as it no longer needs + # the wrapper script with the static flags + echo '[]' > "${T}/empty.conf" + echo "$(ghc-libdir)/ghc-pkg" "--global-conf=${T}/empty.conf" + elif ghc-cabal; then + echo '[]' > "${T}/empty.conf" + echo "$(ghc-libdir)/ghc-pkg.bin" "--global-conf=${T}/empty.conf" + else + echo "$(ghc-libdir)/ghc-pkg.bin" + fi +} + +# returns the version of ghc +_GHC_VERSION_CACHE="" +ghc-version() { + if [[ -z "${_GHC_VERSION_CACHE}" ]]; then + _GHC_VERSION_CACHE="$($(ghc-getghc) --numeric-version)" + fi + echo "${_GHC_VERSION_CACHE}" +} + +# this function can be used to determine if ghc itself +# uses the Cabal package format; it has nothing to do +# with the Cabal libraries ... ghc uses the Cabal package +# format since version 6.4 +ghc-cabal() { + version_is_at_least "6.4" "$(ghc-version)" +} + +# return the best version of the Cabal library that is available +ghc-bestcabalversion() { + local cabalversion + if ghc-cabal; then + # We ask portage, not ghc, so that we only pick up + # portage-installed cabal versions. + cabalversion="$(ghc-extractportageversion dev-haskell/cabal)" + echo "Cabal-${cabalversion}" + else + # older ghc's don't support package versioning + echo Cabal + fi +} + +# check if a standalone Cabal version is available for the +# currently used ghc; takes minimal version of Cabal as +# an optional argument +ghc-sanecabal() { + local f + local version + if [[ -z "$1" ]]; then version="1.0.1"; else version="$1"; fi + for f in $(ghc-confdir)/cabal-*; do + [[ -f "${f}" ]] && version_is_at_least "${version}" "${f#*cabal-}" && return + done + return 1 +} + +# checks if ghc and ghc-bin are installed in the same version +# (if they're both installed); if this is not the case, we +# unfortunately cannot trust portage's dependency resolution +ghc-saneghc() { + local ghcversion + local ghcbinversion + if [[ "${PN}" == "ghc" || "${PN}" == "ghc-bin" ]]; then + return + fi + if has_version dev-lang/ghc && has_version dev-lang/ghc-bin; then + ghcversion="$(ghc-extractportageversion dev-lang/ghc)" + ghcbinversion="$(ghc-extractportageversion dev-lang/ghc-bin)" + if [[ "${ghcversion}" != "${ghcbinversion}" ]]; then + return 1 + fi + fi + return +} + +# extract the version of a portage-installed package +ghc-extractportageversion() { + local pkg + local version + pkg="$(best_version $1)" + version="${pkg#$1-}" + version="${version%-r*}" + version="${version%_pre*}" + echo "${version}" +} + +# returns the library directory +_GHC_LIBDIR_CACHE="" +ghc-libdir() { + if [[ -z "${_GHC_LIBDIR_CACHE}" ]]; then + _GHC_LIBDIR_CACHE="$($(ghc-getghc) --print-libdir)" + fi + echo "${_GHC_LIBDIR_CACHE}" +} + +# returns the (Gentoo) library configuration directory +ghc-confdir() { + echo "$(ghc-libdir)/gentoo" +} + +# returns the name of the local (package-specific) +# package configuration file +ghc-localpkgconf() { + echo "${PF}.conf" +} + +# make a ghci foo.o file from a libfoo.a file +ghc-makeghcilib() { + local outfile + outfile="$(dirname $1)/$(basename $1 | sed 's:^lib\?\(.*\)\.a$:\1.o:')" + ld --relocatable --discard-all --output="${outfile}" --whole-archive "$1" +} + +# tests if a ghc package exists +ghc-package-exists() { + local describe_flag + if version_is_at_least "6.4" "$(ghc-version)"; then + describe_flag="describe" + else + describe_flag="--show-package" + fi + + $(ghc-getghcpkg) "${describe_flag}" "$1" > /dev/null 2>&1 +} + +# creates a local (package-specific) package +# configuration file; the arguments should be +# uninstalled package description files, each +# containing a single package description; if +# no arguments are given, the resulting file is +# empty +ghc-setup-pkg() { + local localpkgconf + localpkgconf="${S}/$(ghc-localpkgconf)" + echo '[]' > "${localpkgconf}" + local update_flag + if version_is_at_least "6.4" "$(ghc-version)"; then + update_flag="update -" + else + update_flag="--update-package" + fi + for pkg in $*; do + $(ghc-getghcpkgbin) -f "${localpkgconf}" ${update_flag} --force \ + < "${pkg}" || die "failed to register ${pkg}" + done +} + +# fixes the library and import directories path +# of the package configuration file +ghc-fixlibpath() { + sed -i "s|$1|$(ghc-libdir)|g" "${S}/$(ghc-localpkgconf)" + if [[ -n "$2" ]]; then + sed -i "s|$2|$(ghc-libdir)/imports|g" "${S}/$(ghc-localpkgconf)" + fi +} + +# moves the local (package-specific) package configuration +# file to its final destination +ghc-install-pkg() { + mkdir -p "${D}/$(ghc-confdir)" + cat "${S}/$(ghc-localpkgconf)" | sed "s|${D}||g" \ + > "${D}/$(ghc-confdir)/$(ghc-localpkgconf)" +} + +# registers all packages in the local (package-specific) +# package configuration file +ghc-register-pkg() { + local localpkgconf + localpkgconf="$(ghc-confdir)/$1" + local update_flag + local describe_flag + if version_is_at_least "6.4" "$(ghc-version)"; then + update_flag="update -" + describe_flag="describe" + else + update_flag="--update-package" + describe_flag="--show-package" + fi + if [[ -f "${localpkgconf}" ]]; then + for pkg in $(ghc-listpkg "${localpkgconf}"); do + ebegin "Registering ${pkg} " + $(ghc-getghcpkgbin) -f "${localpkgconf}" "${describe_flag}" "${pkg}" \ + | $(ghc-getghcpkg) ${update_flag} --force > /dev/null + eend $? + done + fi +} + +# re-adds all available .conf files to the global +# package conf file, to be used on a ghc reinstallation +ghc-reregister() { + einfo "Re-adding packages (may cause several harmless warnings) ..." + PATH="/usr/bin:${PATH}" CONFDIR="$(ghc-confdir)" + if [ -d "${CONFDIR}" ]; then + pushd "${CONFDIR}" > /dev/null + for conf in *.conf; do + PATH="/usr/bin:${PATH}" ghc-register-pkg "${conf}" + done + popd > /dev/null + fi +} + +# unregisters a package configuration file +# protected are all packages that are still contained in +# another package configuration file +ghc-unregister-pkg() { + local localpkgconf + local i + local pkg + local protected + local unregister_flag + localpkgconf="$(ghc-confdir)/$1" + + if version_is_at_least "6.4" "$(ghc-version)"; then + unregister_flag="unregister" + else + unregister_flag="--remove-package" + fi + + for i in $(ghc-confdir)/*.conf; do + [[ "${i}" != "${localpkgconf}" ]] && protected="${protected} $(ghc-listpkg ${i})" + done + # protected now contains the packages that cannot be unregistered yet + + if [[ -f "${localpkgconf}" ]]; then + for pkg in $(ghc-reverse "$(ghc-listpkg ${localpkgconf})"); do + if $(ghc-elem "${pkg}" "${protected}"); then + einfo "Package ${pkg} is protected." + elif ! ghc-package-exists "${pkg}"; then + : + # einfo "Package ${pkg} is not installed for ghc-$(ghc-version)." + else + ebegin "Unregistering ${pkg} " + $(ghc-getghcpkg) "${unregister_flag}" "${pkg}" --force > /dev/null + eend $? + fi + done + fi +} + +# help-function: reverse a list +ghc-reverse() { + local result + local i + for i in $1; do + result="${i} ${result}" + done + echo "${result}" +} + +# help-function: element-check +ghc-elem() { + local i + for i in $2; do + [[ "$1" == "${i}" ]] && return 0 + done + return 1 +} + +# show the packages in a package configuration file +ghc-listpkg() { + local ghcpkgcall + local i + for i in $*; do + if ghc-cabal; then + echo $($(ghc-getghcpkg) list -f "${i}") \ + | sed \ + -e "s|^.*${i}:\([^:]*\).*$|\1|" \ + -e "s|/.*$||" \ + -e "s|,| |g" -e "s|[(){}]||g" + else + echo $($(ghc-getghcpkgbin) -l -f "${i}") \ + | cut -f2 -d':' \ + | sed 's:,: :g' + fi + done +} + +# exported function: check if we have a consistent ghc installation +ghc-package_pkg_setup() { + if ! ghc-saneghc; then + eerror "You have inconsistent versions of dev-lang/ghc and dev-lang/ghc-bin" + eerror "installed. Portage currently cannot work correctly with this setup." + eerror "There are several possibilities to work around this problem:" + eerror "(1) Up/downgrade ghc-bin to the same version as ghc." + eerror "(2) Unmerge ghc-bin." + eerror "(3) Unmerge ghc." + eerror "You probably want option 1 or 2." + die "Inconsistent versions of ghc and ghc-bin." + fi +} + +# exported function: registers the package-specific package +# configuration file +ghc-package_pkg_postinst() { + ghc-register-pkg "$(ghc-localpkgconf)" +} + +# exported function: unregisters the package-specific package +# configuration file; a package contained therein is unregistered +# only if it the same package is not also contained in another +# package configuration file ... +ghc-package_pkg_prerm() { + ghc-unregister-pkg "$(ghc-localpkgconf)" +} + +EXPORT_FUNCTIONS pkg_setup pkg_postinst pkg_prerm diff --git a/sdk_container/src/third_party/portage-stable/eclass/git.eclass b/sdk_container/src/third_party/portage-stable/eclass/git.eclass new file mode 100644 index 0000000000..308870915e --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/git.eclass @@ -0,0 +1,470 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/git.eclass,v 1.58 2011/12/14 23:40:18 vapier Exp $ + +# @DEPRECATED +# This eclass has been superseded by git-2 eclass. +# Please modify your ebuilds to use that one instead. + +# @ECLASS: git.eclass +# @MAINTAINER: +# Donnie Berkholz +# @BLURB: Fetching and unpacking of git repositories +# @DESCRIPTION: +# The git eclass provides functions to fetch, patch and bootstrap +# software sources from git repositories and is based on the subversion eclass. +# It is necessary to define at least the EGIT_REPO_URI variable. +# @THANKS TO: +# Fernando J. Pereda + +inherit eutils + +EGIT="git.eclass" + +# We DEPEND on a not too ancient git version +DEPEND=">=dev-vcs/git-1.6" + +EXPORTED_FUNCTIONS="src_unpack" +case "${EAPI:-0}" in + 4|3|2) EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare" ;; + 1|0) ;; + *) die "EAPI=${EAPI} is not supported" ;; +esac +EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS} + +# define some nice defaults but only if nothing is set already +: ${HOMEPAGE:=http://git-scm.com/} + +# @ECLASS-VARIABLE: EGIT_QUIET +# @DESCRIPTION: +# Set to non-empty value to supress some eclass messages. +: ${EGIT_QUIET:=${ESCM_QUIET}} + +# @ECLASS-VARIABLE: EGIT_STORE_DIR +# @DESCRIPTION: +# Storage directory for git sources. +# Can be redefined. +: ${EGIT_STORE_DIR:="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/git-src"} + +# @ECLASS-VARIABLE: EGIT_UNPACK_DIR +# @DESCRIPTION: +# Directory to unpack git sources in. + +# @ECLASS-VARIABLE: EGIT_HAS_SUBMODULES +# @DESCRIPTION: +# Set this to non-empty value to enable submodule support (slower). +: ${EGIT_HAS_SUBMODULES:=} + +# @ECLASS-VARIABLE: EGIT_FETCH_CMD +# @DESCRIPTION: +# Command for cloning the repository. +: ${EGIT_FETCH_CMD:="git clone"} + +# @ECLASS-VARIABLE: EGIT_UPDATE_CMD +# @DESCRIPTION: +# Git fetch command. +if [[ -n ${EGIT_HAS_SUBMODULES} ]]; then + EGIT_UPDATE_CMD="git pull -f -u" +else + EGIT_UPDATE_CMD="git fetch -f -u" +fi + +# @ECLASS-VARIABLE: EGIT_DIFFSTAT_CMD +# @DESCRIPTION: +# Git command for diffstat. +EGIT_DIFFSTAT_CMD="git --no-pager diff --stat" + +# @ECLASS-VARIABLE: EGIT_OPTIONS +# @DESCRIPTION: +# This variable value is passed to clone and fetch. +: ${EGIT_OPTIONS:=} + +# @ECLASS-VARIABLE: EGIT_MASTER +# @DESCRIPTION: +# Variable for specifying master branch. +# Usefull when upstream don't have master branch. +: ${EGIT_MASTER:=master} + +# @ECLASS-VARIABLE: EGIT_REPO_URI +# @DESCRIPTION: +# URI for the repository +# e.g. http://foo, git://bar +# Supported protocols: +# http:// +# https:// +# git:// +# git+ssh:// +# rsync:// +# ssh:// +eval X="\$${PN//[-+]/_}_LIVE_REPO" +if [[ ${X} = "" ]]; then + : ${EGIT_REPO_URI:=} +else + EGIT_REPO_URI="${X}" +fi +# @ECLASS-VARIABLE: EGIT_PROJECT +# @DESCRIPTION: +# Project name, it must be unique across EGIT_STORE_DIR. +# Git eclass will check out the git repository into ${EGIT_STORE_DIR}/${EGIT_PROJECT}/${EGIT_REPO_URI##*/} +# Default is ${PN}. +: ${EGIT_PROJECT:=${PN}} + +# @ECLASS-VARIABLE: EGIT_BOOTSTRAP +# @DESCRIPTION: +# bootstrap script or command like autogen.sh or etc... +: ${EGIT_BOOTSTRAP:=} + +# @ECLASS-VARIABLE: EGIT_OFFLINE +# @DESCRIPTION: +# Set this variable to a non-empty value to disable the automatic updating of +# an GIT source tree. This is intended to be set outside the git source +# tree by users. +: ${EGIT_OFFLINE:=${ESCM_OFFLINE}} + +# @ECLASS-VARIABLE: EGIT_PATCHES +# @DESCRIPTION: +# Similar to PATCHES array from base.eclass +# Only difference is that this patches are applied before bootstrap. +# Please take note that this variable should be bash array. + +# @ECLASS-VARIABLE: EGIT_BRANCH +# @DESCRIPTION: +# git eclass can fetch any branch in git_fetch(). +eval X="\$${PN//[-+]/_}_LIVE_BRANCH" +if [[ "${X}" = "" ]]; then + : ${EGIT_BRANCH:=master} +else + EGIT_BRANCH="${X}" +fi + +# @ECLASS-VARIABLE: EGIT_COMMIT +# @DESCRIPTION: +# git eclass can checkout any commit. +eval X="\$${PN//[-+]/_}_LIVE_COMMIT" +if [[ "${X}" = "" ]]; then + : ${EGIT_COMMIT:=${EGIT_BRANCH}} +else + EGIT_COMMIT="${X}" +fi + +# @ECLASS-VARIABLE: EGIT_REPACK +# @DESCRIPTION: +# Set to non-empty value to repack objects to save disk space. However this can +# take a long time with VERY big repositories. +: ${EGIT_REPACK:=} + +# @ECLASS-VARIABLE: EGIT_PRUNE +# @DESCRIPTION: +# Set to non-empty value to prune loose objects on each fetch. This is useful +# if upstream rewinds and rebases branches often. +: ${EGIT_PRUNE:=} + +# @FUNCTION: git_submodules +# @DESCRIPTION: +# Internal function wrapping the submodule initialisation and update +git_submodules() { + if [[ -n ${EGIT_HAS_SUBMODULES} ]]; then + debug-print "git submodule init" + git submodule init + debug-print "git submodule sync" + git submodule sync + debug-print "git submodule update" + git submodule update + fi +} + +# @FUNCTION: git_branch +# @DESCRIPTION: +# Internal function that changes branch for the repo based on EGIT_TREE and +# EGIT_BRANCH variables. +git_branch() { + local branchname=branch-${EGIT_BRANCH} src=origin/${EGIT_BRANCH} + if [[ "${EGIT_COMMIT}" != "${EGIT_BRANCH}" ]]; then + branchname=tree-${EGIT_COMMIT} + src=${EGIT_COMMIT} + fi + debug-print "git checkout -b ${branchname} ${src}" + git checkout -b ${branchname} ${src} &> /dev/null + + unset branchname src +} + +# @FUNCTION: git_fetch +# @DESCRIPTION: +# Gets repository from EGIT_REPO_URI and store it in specified EGIT_STORE_DIR +git_fetch() { + debug-print-function ${FUNCNAME} "$@" + + eqawarn "git.eclass is deprecated." + eqawarn "Please update your ebuilds to use git-2 instead. For details, see" + eqawarn "http://archives.gentoo.org/gentoo-dev/msg_b7ba363cae580845819ae3501fb157e9.xml" + + local GIT_DIR EGIT_CLONE_DIR oldsha1 cursha1 extra_clone_opts upstream_branch + [[ -z ${EGIT_HAS_SUBMODULES} ]] && export GIT_DIR + + # choose if user wants elog or just einfo. + if [[ -n ${EGIT_QUIET} ]]; then + elogcmd="einfo" + else + elogcmd="elog" + fi + + # If we have same branch and the tree we can do --depth 1 clone + # which outputs into really smaller data transfers. + # Sadly we can do shallow copy for now because quite a few packages need .git + # folder. + #[[ ${EGIT_COMMIT} = ${EGIT_BRANCH} ]] && \ + # EGIT_FETCH_CMD="${EGIT_FETCH_CMD} --depth 1" + if [[ -n ${EGIT_TREE} ]] ; then + EGIT_COMMIT=${EGIT_TREE} + ewarn "QA: Usage of deprecated EGIT_TREE variable detected." + ewarn "QA: Use EGIT_COMMIT variable instead." + fi + + # EGIT_REPO_URI is empty. + [[ -z ${EGIT_REPO_URI} ]] && die "${EGIT}: EGIT_REPO_URI is empty." + + # check for the protocol or pull from a local repo. + if [[ -z ${EGIT_REPO_URI%%:*} ]] ; then + case ${EGIT_REPO_URI%%:*} in + git*|http|https|rsync|ssh) ;; + *) die "${EGIT}: protocol for fetch from "${EGIT_REPO_URI%:*}" is not yet implemented in eclass." ;; + esac + fi + + # initial clone, we have to create master git storage directory and play + # nicely with sandbox + if [[ ! -d ${EGIT_STORE_DIR} ]] ; then + debug-print "${FUNCNAME}: initial clone. creating git directory" + addwrite / + mkdir -m 775 -p "${EGIT_STORE_DIR}" \ + || die "${EGIT}: can't mkdir ${EGIT_STORE_DIR}." + export SANDBOX_WRITE="${SANDBOX_WRITE%%:/}" + fi + + cd -P "${EGIT_STORE_DIR}" || die "${EGIT}: can't chdir to ${EGIT_STORE_DIR}" + EGIT_STORE_DIR=${PWD} + + # allow writing into EGIT_STORE_DIR + addwrite "${EGIT_STORE_DIR}" + + [[ -z ${EGIT_REPO_URI##*/} ]] && EGIT_REPO_URI="${EGIT_REPO_URI%/}" + EGIT_CLONE_DIR="${EGIT_PROJECT}" + + debug-print "${FUNCNAME}: EGIT_OPTIONS = \"${EGIT_OPTIONS}\"" + + GIT_DIR="${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}" + # we also have to remove all shallow copied repositories + # and fetch them again + if [[ -e "${GIT_DIR}/shallow" ]]; then + rm -rf "${GIT_DIR}" + einfo "The ${EGIT_CLONE_DIR} was shallow copy. Refetching." + fi + # repack from bare copy to normal one + if [[ -n ${EGIT_HAS_SUBMODULES} ]] && [[ -d ${GIT_DIR} && ! -d ${GIT_DIR}/.git ]]; then + rm -rf "${GIT_DIR}" + einfo "The ${EGIT_CLONE_DIR} was bare copy. Refetching." + fi + if [[ -z ${EGIT_HAS_SUBMODULES} ]] && [[ -d ${GIT_DIR} && -d ${GIT_DIR}/.git ]]; then + rm -rf "${GIT_DIR}" + einfo "The ${EGIT_CLONE_DIR} was not a bare copy. Refetching." + fi + + if [[ -n ${EGIT_HAS_SUBMODULES} ]]; then + upstream_branch=origin/${EGIT_BRANCH} + else + upstream_branch=${EGIT_BRANCH} + extra_clone_opts=--bare + fi + + if [[ ! -d ${GIT_DIR} ]] ; then + # first clone + ${elogcmd} "GIT NEW clone -->" + ${elogcmd} " repository: ${EGIT_REPO_URI}" + + debug-print "${EGIT_FETCH_CMD} ${extra_clone_opts} ${EGIT_OPTIONS} \"${EGIT_REPO_URI}\" ${GIT_DIR}" + ${EGIT_FETCH_CMD} ${extra_clone_opts} ${EGIT_OPTIONS} "${EGIT_REPO_URI}" ${GIT_DIR} \ + || die "${EGIT}: can't fetch from ${EGIT_REPO_URI}." + + pushd "${GIT_DIR}" &> /dev/null + cursha1=$(git rev-parse ${upstream_branch}) + ${elogcmd} " at the commit: ${cursha1}" + + git_submodules + popd &> /dev/null + elif [[ -n ${EGIT_OFFLINE} ]] ; then + pushd "${GIT_DIR}" &> /dev/null + cursha1=$(git rev-parse ${upstream_branch}) + ${elogcmd} "GIT offline update -->" + ${elogcmd} " repository: ${EGIT_REPO_URI}" + ${elogcmd} " at the commit: ${cursha1}" + popd &> /dev/null + else + pushd "${GIT_DIR}" &> /dev/null + # Git urls might change, so unconditionally set it here + git config remote.origin.url "${EGIT_REPO_URI}" + + # fetch updates + ${elogcmd} "GIT update -->" + ${elogcmd} " repository: ${EGIT_REPO_URI}" + + oldsha1=$(git rev-parse ${upstream_branch}) + + if [[ -n ${EGIT_HAS_SUBMODULES} ]]; then + debug-print "${EGIT_UPDATE_CMD} ${EGIT_OPTIONS}" + # fix branching + git checkout ${EGIT_MASTER} + for x in $(git branch |grep -v "* ${EGIT_MASTER}" |tr '\n' ' '); do + git branch -D ${x} + done + ${EGIT_UPDATE_CMD} ${EGIT_OPTIONS} \ + || die "${EGIT}: can't update from ${EGIT_REPO_URI}." + else + debug-print "${EGIT_UPDATE_CMD} ${EGIT_OPTIONS} origin ${EGIT_BRANCH}:${EGIT_BRANCH}" + ${EGIT_UPDATE_CMD} ${EGIT_OPTIONS} origin ${EGIT_BRANCH}:${EGIT_BRANCH} \ + || die "${EGIT}: can't update from ${EGIT_REPO_URI}." + fi + + git_submodules + cursha1=$(git rev-parse ${upstream_branch}) + + # write out message based on the revisions + if [[ "${oldsha1}" != "${cursha1}" ]]; then + ${elogcmd} " updating from commit: ${oldsha1}" + ${elogcmd} " to commit: ${cursha1}" + else + ${elogcmd} " at the commit: ${cursha1}" + # @ECLASS-VARIABLE: LIVE_FAIL_FETCH_IF_REPO_NOT_UPDATED + # @DESCRIPTION: + # If this variable is set to TRUE in make.conf or somewhere in + # enviroment the package will fail if there is no update, thus in + # combination with --keep-going it would lead in not-updating + # pakcages that are up-to-date. + # TODO: this can lead to issues if more projects/packages use same repo + [[ ${LIVE_FAIL_FETCH_IF_REPO_NOT_UPDATED} = true ]] && \ + debug-print "${FUNCNAME}: Repository \"${EGIT_REPO_URI}\" is up-to-date. Skipping." && \ + die "${EGIT}: Repository \"${EGIT_REPO_URI}\" is up-to-date. Skipping." + fi + ${EGIT_DIFFSTAT_CMD} ${oldsha1}..${upstream_branch} + popd &> /dev/null + fi + + pushd "${GIT_DIR}" &> /dev/null + if [[ -n ${EGIT_REPACK} ]] || [[ -n ${EGIT_PRUNE} ]]; then + ebegin "Garbage collecting the repository" + local args + [[ -n ${EGIT_PRUNE} ]] && args='--prune' + git gc ${args} + eend $? + fi + popd &> /dev/null + + # export the git version + export EGIT_VERSION="${cursha1}" + + # log the repo state + [[ "${EGIT_COMMIT}" != "${EGIT_BRANCH}" ]] && ${elogcmd} " commit: ${EGIT_COMMIT}" + ${elogcmd} " branch: ${EGIT_BRANCH}" + ${elogcmd} " storage directory: \"${GIT_DIR}\"" + + if [[ -n ${EGIT_HAS_SUBMODULES} ]]; then + pushd "${GIT_DIR}" &> /dev/null + debug-print "rsync -rlpgo . \"${EGIT_UNPACK_DIR:-${S}}\"" + time rsync -rlpgo . "${EGIT_UNPACK_DIR:-${S}}" + popd &> /dev/null + else + unset GIT_DIR + debug-print "git clone -l -s -n \"${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}\" \"${EGIT_UNPACK_DIR:-${S}}\"" + git clone -l -s -n "${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}" "${EGIT_UNPACK_DIR:-${S}}" + fi + + pushd "${EGIT_UNPACK_DIR:-${S}}" &> /dev/null + git_branch + # submodules always reqire net (thanks to branches changing) + [[ -z ${EGIT_OFFLINE} ]] && git_submodules + popd &> /dev/null + + echo ">>> Unpacked to ${EGIT_UNPACK_DIR:-${S}}" +} + +# @FUNCTION: git_bootstrap +# @DESCRIPTION: +# Runs bootstrap command if EGIT_BOOTSTRAP variable contains some value +# Remember that what ever gets to the EGIT_BOOTSTRAP variable gets evaled by bash. +git_bootstrap() { + debug-print-function ${FUNCNAME} "$@" + + if [[ -n ${EGIT_BOOTSTRAP} ]] ; then + pushd "${S}" > /dev/null + einfo "Starting bootstrap" + + if [[ -f ${EGIT_BOOTSTRAP} ]]; then + # we have file in the repo which we should execute + debug-print "$FUNCNAME: bootstraping with file \"${EGIT_BOOTSTRAP}\"" + + if [[ -x ${EGIT_BOOTSTRAP} ]]; then + eval "./${EGIT_BOOTSTRAP}" \ + || die "${EGIT}: bootstrap script failed" + else + eerror "\"${EGIT_BOOTSTRAP}\" is not executable." + eerror "Report upstream, or bug ebuild maintainer to remove bootstrap command." + die "${EGIT}: \"${EGIT_BOOTSTRAP}\" is not executable." + fi + else + # we execute some system command + debug-print "$FUNCNAME: bootstraping with commands \"${EGIT_BOOTSTRAP}\"" + + eval "${EGIT_BOOTSTRAP}" \ + || die "${EGIT}: bootstrap commands failed." + + fi + + einfo "Bootstrap finished" + popd > /dev/null + fi +} + +# @FUNCTION: git_apply_patches +# @DESCRIPTION: +# Apply patches from EGIT_PATCHES bash array. +# Preferred is using the variable as bash array but for now it allows to write +# it also as normal space separated string list. (This part of code should be +# removed when all ebuilds get converted on bash array). +git_apply_patches() { + debug-print-function ${FUNCNAME} "$@" + + pushd "${EGIT_UNPACK_DIR:-${S}}" > /dev/null + if [[ ${#EGIT_PATCHES[@]} -gt 1 ]] ; then + for i in "${EGIT_PATCHES[@]}"; do + debug-print "$FUNCNAME: git_autopatch: patching from ${i}" + epatch "${i}" + done + elif [[ -n ${EGIT_PATCHES} ]]; then + # no need for loop if space separated string is passed. + debug-print "$FUNCNAME: git_autopatch: patching from ${EGIT_PATCHES}" + epatch "${EGIT_PATCHES}" + fi + + popd > /dev/null +} + +# @FUNCTION: git_src_unpack +# @DESCRIPTION: +# src_upack function, calls src_prepare one if EAPI!=2. +git_src_unpack() { + debug-print-function ${FUNCNAME} "$@" + + git_fetch || die "${EGIT}: unknown problem in git_fetch()." + + has src_prepare ${EXPORTED_FUNCTIONS} || git_src_prepare +} + +# @FUNCTION: git_src_prepare +# @DESCRIPTION: +# src_prepare function for git stuff. Patches, bootstrap... +git_src_prepare() { + debug-print-function ${FUNCNAME} "$@" + + git_apply_patches + git_bootstrap +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/gkrellm-plugin.eclass b/sdk_container/src/third_party/portage-stable/eclass/gkrellm-plugin.eclass new file mode 100644 index 0000000000..03f6892204 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/gkrellm-plugin.eclass @@ -0,0 +1,83 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/gkrellm-plugin.eclass,v 1.3 2007/04/23 19:35:05 swegener Exp $ + +# +# Original Author: Jim Ramsay +# +# Purpose: +# Provides common methods used by (almost) all gkrellm plugins: +# - Sets up default dependencies +# - Adds pkg_setup check to ensure gkrellm was built with USE="X" (bug +# 167227) +# - Provides utility routines in lieu of hard-coding the plugin directories. +# - Provides the most common src_install method to avoid code duplication. +# +# Utility Routines: +# gkrellm-plugin_dir - Returns the gkrellm-2 plugin directory +# gkrellm-plugin_server_dir - Returns the gkrellm-2 server plugin directory +# +# Environment: +# For src_install: +# PLUGIN_SO - The name of the plugin's .so file which will be installed in +# the plugin dir. Defaults to "${PN}.so". +# PLUGIN_DOCS - An optional list of docs to be installed. Defaults to +# unset. +# PLUGIN_SERVER_SO - The name of the plugin's server plugin .so portion. +# Defaults to unset. +# Important: This will also cause the pkg_setup check to be skipped, so +# you need to check 'build_with_use app-admin/gkrellm X' in your +# src_compile and only compile the GUI portion if that returns true. (see +# x11-plugins/gkrelltop as an example) +# +# Changelog: +# 12 March 2007: Jim Ramsay +# - Added server plugin support +# 09 March 2007: Jim Ramsay +# - Initial commit +# + +inherit multilib eutils + +RDEPEND="=app-admin/gkrellm-2*" +DEPEND="${RDEPEND} + dev-util/pkgconfig" + +gkrellm-plugin_dir() { + echo /usr/$(get_libdir)/gkrellm2/plugins +} + +gkrellm-plugin_server_dir() { + echo /usr/$(get_libdir)/gkrellm2/plugins-gkrellmd +} + +gkrellm-plugin_pkg_setup() { + if [[ -z "${PLUGIN_SERVER_SO}" ]] && + ! built_with_use app-admin/gkrellm X; then + eerror "This plugin requires the X frontend of gkrellm." + eerror "Please re-emerge app-admin/gkrellm with USE=\"X\"" + die "Please re-emerge app-admin/gkrellm with USE=\"X\"" + fi +} + +gkrellm-plugin_src_install() { + if built_with_use app-admin/gkrellm X; then + insinto $(gkrellm-plugin_dir) + doins ${PLUGIN_SO:-${PN}.so} || die "Plugin shared library was not installed" + fi + + if [[ -n "${PLUGIN_SERVER_SO}" ]]; then + insinto $(gkrellm-plugin_server_dir) + doins ${PLUGIN_SERVER_SO} || die "Server plugin shared library was not installed" + fi + + DDOCS="README* Change* AUTHORS FAQ TODO INSTALL" + + for doc in ${DDOCS}; do + [ -s "$doc" ] && dodoc $doc + done + + [ -n "${PLUGIN_DOCS}" ] && dodoc ${PLUGIN_DOCS} +} + +EXPORT_FUNCTIONS pkg_setup src_install diff --git a/sdk_container/src/third_party/portage-stable/eclass/gnat.eclass b/sdk_container/src/third_party/portage-stable/eclass/gnat.eclass new file mode 100644 index 0000000000..21a85d9596 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/gnat.eclass @@ -0,0 +1,457 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/gnat.eclass,v 1.39 2010/01/13 15:06:11 scarabeus Exp $ +# +# Author: George Shapovalov +# Belongs to: ada herd +# +# This eclass provides the framework for ada lib installation with the split and +# SLOTted gnat compilers (gnat-xxx, gnatbuild.eclass). Each lib gets built once +# for every installed gnat compiler. Activation of a particular bunary module is +# performed by eselect-gnat, when the active compiler gets switched +# +# The ebuilds should define the lib_compile and lib_install functions that are +# called from the (exported) gnat_src_compile function of eclass. These +# functions should operate similarly to the starndard src_compile and +# src_install. The only difference, that they should use $SL variable instead of +# $S (this is where the working copy of source is held) and $DL instead of $D as +# its installation point. + +inherit flag-o-matic eutils + +# The environment is set locally in src_compile and src_install functions +# by the common code sourced here and in gnat-eselect module. +# This is the standard location for this code (belongs to eselect-gnat, +# since eselect should work even in the absense of portage tree and we can +# guarantee to some extent presence of gnat-eselect when anything gnat-related +# gets processed. See #192505) +# +# Note! +# It may not be safe to source this at top level. Only source inside local +# functions! +GnatCommon="/usr/share/gnat/lib/gnat-common.bash" + +# !!NOTE!! +# src_install should not be exported! +# Instead gnat_src_install should be explicitly called from within src_install. +EXPORT_FUNCTIONS pkg_setup pkg_postinst src_compile + +DESCRIPTION="Common procedures for building Ada libs using split gnat compilers" + +# make sure we have an appropriately recent eselect-gnat installed, as we are +# using some common code here. +DEPEND=">=app-admin/eselect-gnat-1.3" + + +# ---------------------------------- +# Globals + +# Lib install locations +# +# Gnat profile dependent files go under ${LibTop}/${Gnat_Profile}/${PN} +# and common files go under SpecsDir, DataDir.. +# In order not to pollute PATH and LDPATH attempt should be mabe to install +# binaries and what makes sence for individual packages under +# ${AdalibLibTop}/${Gnat_Profile}/bin +PREFIX=/usr +AdalibSpecsDir=${PREFIX}/include/ada +AdalibDataDir=${PREFIX}/share/ada +AdalibLibTop=${PREFIX}/$(get_libdir)/ada + +# build-time locations +# SL is a "localized" S, - location where sources are copied for +#bi profile-specific build +SL=${WORKDIR}/LocalSource + +# DL* are "localized destinations" where ARCH/SLOT dependent stuff should be +# installed in lib_install. There are three: +# +DL=${WORKDIR}/LocalDest +# a generic location for the lib (.a, .so) files +# +DLbin=${WORKDIR}/LocalBinDest +# binaries that should be in the PATH, will be moved to common Ada bin dir +# +DLgpr=${WORKDIR}/LocalGPRDest +# gpr's should go here. + +# file containing environment formed by gnat-eselect (build-time) +BuildEnv=${WORKDIR}/BuildEnv + +# environment for installed lib. Profile-specific stuff should use %DL% as a top +# of their location. This (%DL%) will be substituted with a proper location upon +# install +LibEnv=${WORKDIR}/LibEnv + + +# env file prepared by gnat.eselect only lists new settings for env vars +# we need to change that to prepend, rather than replace action.. +# Takes one argument - the file to expand. This file should contain only +# var=value like lines.. (commenst are Ok) +expand_BuildEnv() { + local line + for line in $(cat $1); do + EnvVar=$(echo ${line}|cut -d"=" -f1) + if [[ "${EnvVar}" == "PATH" ]] ; then + echo "export ${line}:\${${EnvVar}}" >> $1.tmp + else + echo "export ${line}" >> $1.tmp + fi + done + mv $1.tmp $1 +} + + +# ------------------------------------ +# Dependency processing related stuff + +# A simple wrapper to get the relevant part of the DEPEND +# params: +# $1 - should contain dependency specification analogous to DEPEND, +# if omitted, DEPEND is processed +get_ada_dep() { + [[ -z "$1" ]] && DEP="${DEPEND}" || DEP="$1" + local TempStr + for fn in $DEP; do # here $DEP should *not* be in "" + [[ $fn =~ "virtual/ada" ]] && TempStr=${fn/*virtual\//} + # above match should be to full virtual/ada, as simply "ada" is a common + # part of ${PN}, even for some packages under dev-ada + done +# debug-print-function $FUNCNAME "TempStr=${TempStr:0:8}" + [[ -n ${TempStr} ]] && echo ${TempStr:0:8} +} + +# This function is used to check whether the requested gnat profile matches the +# requested Ada standard +# !!ATTN!! +# This must match dependencies as specified in vitrual/ada !!! +# +# params: +# $1 - the requested gnat profile in usual form (e.g. x86_64-pc-linux-gnu-gnat-gcc-4.1) +# $2 - Ada standard specification, as would be specified in DEPEND. +# Valid values: ada-1995, ada-2005, ada +# +# This used to treat ada-1995 and ada alike, but some packages (still +# requested by users) no longer compile with new compilers (not the +# standard issue, but rather compiler becoming stricter most of the time). +# Plus there are some "intermediary versions", not fully 2005 compliant +# but already causing problems. Therefore, now we do exact matching. +belongs_to_standard() { +# debug-print-function $FUNCNAME $* + . ${GnatCommon} || die "failed to source gnat-common lib" + local GnatSlot=$(get_gnat_SLOT $1) + local ReducedSlot=${GnatSlot//\./} + # + if [[ $2 == 'ada' ]] ; then +# debug-print-function "ada or ada-1995 match" + return 0 # no restrictions imposed + elif [[ "$2" == 'ada-1995' ]] ; then + if [[ $(get_gnat_Pkg $1) == "gcc" ]]; then +# debug-print-function "got gcc profile, GnatSlot=${ReducedSlot}" + [[ ${ReducedSlot} -le "42" ]] && return 0 || return 1 + elif [[ $(get_gnat_Pkg $1) == "gpl" ]]; then +# debug-print-function "got gpl profile, GnatSlot=${ReducedSlot}" + [[ ${ReducedSlot} -lt "41" ]] && return 0 || return 1 + else + return 1 # unknown compiler encountered + fi + elif [[ "$2" == 'ada-2005' ]] ; then + if [[ $(get_gnat_Pkg $1) == "gcc" ]]; then +# debug-print-function "got gcc profile, GnatSlot=${ReducedSlot}" + [[ ${ReducedSlot} -ge "43" ]] && return 0 || return 1 + elif [[ $(get_gnat_Pkg $1) == "gpl" ]]; then +# debug-print-function "got gpl profile, GnatSlot=${ReducedSlot}" + [[ ${ReducedSlot} -ge "41" ]] && return 0 || return 1 + else + return 1 # unknown compiler encountered + fi + else + return 1 # unknown standard requested, check spelling! + fi +} + + +# ------------------------------------ +# Helpers +# + + +# The purpose of this one is to remove all parts of the env entry specific to a +# given lib. Usefull when some lib wants to act differently upon detecting +# itself installed.. +# +# params: +# $1 - name of env var to process +# $2 (opt) - name of the lib to filter out (defaults to ${PN}) +filter_env_var() { + local entries=(${!1//:/ }) + local libName=${2:-${PN}} + local env_str + for entry in ${entries[@]} ; do + # this simply checks if $libname is a substring of the $entry, should + # work fine with all the present libs + if [[ ${entry/${libName}/} == ${entry} ]] ; then + env_str="${env_str}:${entry}" + fi + done + echo ${env_str} +} + +# A simpler helper, for the libs that need to extract active gnat location +# Returns a first entry for a specified env var. Relies on the (presently true) +# convention that first gnat's entries are listed and then of the other +# installed libs. +# +# params: +# $1 - name of env var to process +get_gnat_value() { + local entries=(${!1//:/ }) + echo ${entries[0]} +} + + +# Returns a name of active gnat profile. Performs some validity checks. No input +# parameters, analyzes the system setup directly. +get_active_profile() { + # get common code and settings + . ${GnatCommon} || die "failed to source gnat-common lib" + + local profiles=( $(get_env_list) ) + + if [[ ${profiles[@]} == "${MARKER}*" ]]; then + return + # returning empty string + fi + + if (( 1 == ${#profiles[@]} )); then + local active=${profiles[0]#${MARKER}} + else + die "${ENVDIR} contains multiple gnat profiles, please cleanup!" + fi + + if [[ -f ${SPECSDIR}/${active} ]]; then + echo ${active} + else + die "The profile active in ${ENVDIR} does not correspond to any installed gnat!" + fi +} + + + +# ------------------------------------ +# Functions + +# Checks the gnat backend SLOT and filters flags correspondingly +# To be called from scr_compile for each profile, before actual compilation +# Parameters: +# $1 - gnat profile, e.g. x86_64-pc-linux-gnu-gnat-gcc-3.4 +gnat_filter_flags() { + debug-print-function $FUNCNAME $* + + # We only need to filter so severely if backends < 3.4 is detected, which + # means basically gnat-3.15 + GnatProfile=$1 + if [ -z ${GnatProfile} ]; then + # should not get here! + die "please specify a valid gnat profile for flag stripping!" + fi + + local GnatSLOT="${GnatProfile//*-/}" + if [[ ${GnatSLOT} < 3.4 ]] ; then + filter-mfpmath sse 387 + + filter-flags -mmmx -msse -mfpmath -frename-registers \ + -fprefetch-loop-arrays -falign-functions=4 -falign-jumps=4 \ + -falign-loops=4 -msse2 -frerun-loop-opt -maltivec -mabi=altivec \ + -fsigned-char -fno-strict-aliasing -pipe + + export ADACFLAGS=${ADACFLAGS:-${CFLAGS}} + export ADACFLAGS=${ADACFLAGS//-Os/-O2} + export ADACFLAGS=${ADACFLAGS//pentium-mmx/i586} + export ADACFLAGS=${ADACFLAGS//pentium[234]/i686} + export ADACFLAGS=${ADACFLAGS//k6-[23]/k6} + export ADACFLAGS=${ADACFLAGS//athlon-tbird/i686} + export ADACFLAGS=${ADACFLAGS//athlon-4/i686} + export ADACFLAGS=${ADACFLAGS//athlon-[xm]p/i686} + # gcc-2.8.1 has no amd64 support, so the following two are safe + export ADACFLAGS=${ADACFLAGS//athlon64/i686} + export ADACFLAGS=${ADACFLAGS//athlon/i686} + else + export ADACFLAGS=${ADACFLAGS:-${CFLAGS}} + fi + + export ADAMAKEFLAGS=${ADAMAKEFLAGS:-"-cargs ${ADACFLAGS} -margs"} + export ADABINDFLAGS=${ADABINDFLAGS:-""} +} + +gnat_pkg_setup() { + debug-print-function $FUNCNAME $* + + # check whether all the primary compilers are installed + . ${GnatCommon} || die "failed to source gnat-common lib" + for fn in $(cat ${PRIMELIST}); do + if [[ ! -f ${SPECSDIR}/${fn} ]]; then + elog "The ${fn} Ada compiler profile is specified as primary, but is not installed." + elog "Please rectify the situation before emerging Ada library!" + elog "Please either install again all the missing compilers listed" + elog "as primary, or edit /etc/ada/primary_compilers and update the" + elog "list of primary compilers there." + einfo "" + ewarn "If you do the latter, please don't forget to rebuild all" + ewarn "affected libs!" + die "Primary compiler is missing" + fi + done + + export ADAC=${ADAC:-gnatgcc} + export ADAMAKE=${ADAMAKE:-gnatmake} + export ADABIND=${ADABIND:-gnatbind} +} + + +gnat_pkg_postinst() { + einfo "Updating gnat configuration to pick up ${PN} library..." + eselect gnat update + elog "The environment has been set up to make gnat automatically find files" + elog "for the installed library. In order to immediately activate these" + elog "settings please run:" + elog + #elog "env-update" + elog "source /etc/profile" + einfo + einfo "Otherwise the settings will become active next time you login" +} + + + + +# standard lib_compile plug. Adapted from base.eclass +lib_compile() { + debug-print-function $FUNCNAME $* + [ -z "$1" ] && lib_compile all + + cd ${SL} + + while [ "$1" ]; do + case $1 in + configure) + debug-print-section configure + econf || die "died running econf, $FUNCNAME:configure" + ;; + make) + debug-print-section make + emake || die "died running emake, $FUNCNAME:make" + ;; + all) + debug-print-section all + lib_compile configure make + ;; + esac + shift + done +} + +# Cycles through installed gnat profiles and calls lib_compile and then +# lib_install in turn. +# Use this function to build/install profile-specific binaries. The code +# building/installing common stuff (docs, etc) can go before/after, as needed, +# so that it is called only once.. +# +# lib_compile and lib_install are passed the active gnat profile name - may be used or +# discarded as needed.. +gnat_src_compile() { + debug-print-function $FUNCNAME $* + + # We source the eselect-gnat module and use its functions directly, instead of + # duplicating code or trying to violate sandbox in some way.. + . ${GnatCommon} || die "failed to source gnat-common lib" + + compilers=( $(find_primary_compilers ) ) + if [[ -n ${compilers[@]} ]] ; then + local i + local AdaDep=$(get_ada_dep) + for (( i = 0 ; i < ${#compilers[@]} ; i = i + 1 )) ; do + if $(belongs_to_standard ${compilers[${i}]} ${AdaDep}); then + einfo "compiling for gnat profile ${compilers[${i}]}" + + # copy sources + mkdir "${DL}" "${DLbin}" "${DLgpr}" + cp -dpR "${S}" "${SL}" + + # setup environment + # As eselect-gnat also manages the libs, this will ensure the right + # lib profiles are activated too (in case we depend on some Ada lib) + generate_envFile ${compilers[${i}]} ${BuildEnv} && \ + expand_BuildEnv "${BuildEnv}" && \ + . "${BuildEnv}" || die "failed to switch to ${compilers[${i}]}" + # many libs (notably xmlada and gtkada) do not like to see + # themselves installed. Need to strip them from ADA_*_PATH + # NOTE: this should not be done in pkg_setup, as we setup + # environment right above + export ADA_INCLUDE_PATH=$(filter_env_var ADA_INCLUDE_PATH) + export ADA_OBJECTS_PATH=$(filter_env_var ADA_OBJECTS_PATH) + + # call compilation callback + cd "${SL}" + gnat_filter_flags ${compilers[${i}]} + lib_compile ${compilers[${i}]} || die "failed compiling for ${compilers[${i}]}" + + # call install callback + cd "${SL}" + lib_install ${compilers[${i}]} || die "failed installing profile-specific part for ${compilers[${i}]}" + # move installed and cleanup + mv "${DL}" "${DL}-${compilers[${i}]}" + mv "${DLbin}" "${DLbin}-${compilers[${i}]}" + mv "${DLgpr}" "${DLgpr}-${compilers[${i}]}" + rm -rf "${SL}" + else + einfo "skipping gnat profile ${compilers[${i}]}" + fi + done + else + ewarn "Please note!" + elog "Treatment of installed Ada compilers has recently changed!" + elog "Libs are now being built only for \"primary\" compilers." + elog "Please list gnat profiles (as reported by \"eselect gnat list\")" + elog "that you want to regularly use (i.e., not just for testing)" + elog "in ${PRIMELIST}, one per line." + die "please make sure you have at least one gnat compiler installed and set as primary!" + fi +} + + +# This function simply moves gnat-profile-specific stuff into proper locations. +# Use src_install in ebuild to install the rest of the package +gnat_src_install() { + debug-print-function $FUNCNAME $* + + # prep lib specs directory + . ${GnatCommon} || die "failed to source gnat-common lib" + dodir ${SPECSDIR}/${PN} + + compilers=( $(find_primary_compilers) ) + if [[ -n ${compilers[@]} ]] ; then + local i + local AdaDep=$(get_ada_dep) + for (( i = 0 ; i < ${#compilers[@]} ; i = i + 1 )) ; do + if $(belongs_to_standard ${compilers[${i}]} ${AdaDep}); then + debug-print-section "installing for gnat profile ${compilers[${i}]}" + + local DLlocation=${AdalibLibTop}/${compilers[${i}]} + dodir ${DLlocation} + cp -dpR "${DL}-${compilers[${i}]}" "${D}/${DLlocation}/${PN}" + cp -dpR "${DLbin}-${compilers[${i}]}" "${D}/${DLlocation}"/bin + cp -dpR "${DLgpr}-${compilers[${i}]}" "${D}/${DLlocation}"/gpr + # create profile-specific specs file + cp ${LibEnv} "${D}/${SPECSDIR}/${PN}/${compilers[${i}]}" + sed -i -e "s:%DL%:${DLlocation}/${PN}:g" "${D}/${SPECSDIR}/${PN}/${compilers[${i}]}" + sed -i -e "s:%DLbin%:${DLlocation}/bin:g" "${D}/${SPECSDIR}/${PN}/${compilers[${i}]}" + sed -i -e "s:%DLgpr%:${DLlocation}/gpr:g" "${D}/${SPECSDIR}/${PN}/${compilers[${i}]}" + else + einfo "skipping gnat profile ${compilers[${i}]}" + fi + done + else + die "please make sure you have at least one gnat compiler installed!" + fi +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/gnatbuild.eclass b/sdk_container/src/third_party/portage-stable/eclass/gnatbuild.eclass new file mode 100644 index 0000000000..69c5bd353b --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/gnatbuild.eclass @@ -0,0 +1,693 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/gnatbuild.eclass,v 1.50 2010/01/22 13:27:36 george Exp $ +# +# Author: George Shapovalov +# Belongs to: ada herd +# +# Notes: +# HOMEPAGE and LICENSE are set in appropriate ebuild, as +# gnat is developed by FSF and AdaCore "in parallel" +# +# The following vars can be set in ebuild before inheriting this eclass. They +# will be respected: +# SLOT +# BOOT_SLOT - where old bootstrap is used as it works fine + + +inherit eutils versionator toolchain-funcs flag-o-matic multilib autotools \ + libtool fixheadtails gnuconfig pax-utils + +EXPORT_FUNCTIONS pkg_setup pkg_postinst pkg_postrm src_unpack src_compile src_install + +DESCRIPTION="Based on the ${ECLASS} eclass" + +IUSE="nls" +# multilib is supported via profiles now, multilib usevar is deprecated + +DEPEND=">=app-admin/eselect-gnat-1.3" +RDEPEND="app-admin/eselect-gnat" + +# Note! +# It may not be safe to source this at top level. Only source inside local +# functions! +GnatCommon="/usr/share/gnat/lib/gnat-common.bash" + +#---->> globals and SLOT <<---- + +# just a check, this location seems to vary too much, easier to track it in +# ebuild +#[ -z "${GNATSOURCE}" ] && die "please set GNATSOURCE in ebuild! (before inherit)" + +# versioning +# because of gnatpro/gnatgpl we need to track both gcc and gnat versions + +# these simply default to $PV +GNATMAJOR=$(get_version_component_range 1) +GNATMINOR=$(get_version_component_range 2) +GNATBRANCH=$(get_version_component_range 1-2) +GNATRELEASE=$(get_version_component_range 1-3) +# this one is for the gnat-gpl which is versioned by gcc backend and ACT version +# number added on top +ACT_Ver=$(get_version_component_range 4) + +# GCCVER and SLOT logic +# +# I better define vars for package names, as there was discussion on proper +# naming and it may change +PN_GnatGCC="gnat-gcc" +PN_GnatGpl="gnat-gpl" + +# ATTN! GCCVER stands for the provided backend gcc, not the one on the system +# so tc-* functions are of no use here. The present versioning scheme makes +# GCCVER basically a part of PV, but *this may change*!! +# +# GCCVER can be set in the ebuild. +[[ -z ${GCCVER} ]] && GCCVER="${GNATRELEASE}" + + +# finally extract GCC version strings +GCCMAJOR=$(get_version_component_range 1 "${GCCVER}") +GCCMINOR=$(get_version_component_range 2 "${GCCVER}") +GCCBRANCH=$(get_version_component_range 1-2 "${GCCVER}") +GCCRELEASE=$(get_version_component_range 1-3 "${GCCVER}") + +# SLOT logic, make it represent gcc backend, as this is what matters most +# There are some special cases, so we allow it to be defined in the ebuild +# ATTN!! If you set SLOT in the ebuild, don't forget to make sure that +# BOOT_SLOT is also set properly! +[[ -z ${SLOT} ]] && SLOT="${GCCBRANCH}" + +# possible future crosscompilation support +export CTARGET=${CTARGET:-${CHOST}} + +is_crosscompile() { + [[ ${CHOST} != ${CTARGET} ]] +} + +# Bootstrap CTARGET and SLOT logic. For now BOOT_TARGET=CHOST is "guaranteed" by +# profiles, so mostly watch out for the right SLOT used in the bootstrap. +# As above, with SLOT, it may need to be defined in the ebuild +BOOT_TARGET=${CTARGET} +[[ -z ${BOOT_SLOT} ]] && BOOT_SLOT=${SLOT} + +# set our install locations +PREFIX=${GNATBUILD_PREFIX:-/usr} # not sure we need this hook, but may be.. +LIBPATH=${PREFIX}/$(get_libdir)/${PN}/${CTARGET}/${SLOT} +LIBEXECPATH=${PREFIX}/libexec/${PN}/${CTARGET}/${SLOT} +INCLUDEPATH=${LIBPATH}/include +BINPATH=${PREFIX}/${CTARGET}/${PN}-bin/${SLOT} +DATAPATH=${PREFIX}/share/${PN}-data/${CTARGET}/${SLOT} +# ATTN! the one below should match the path defined in eselect-gnat module +CONFIG_PATH="/usr/share/gnat/eselect" +gnat_profile="${CTARGET}-${PN}-${SLOT}" +gnat_config_file="${CONFIG_PATH}/${gnat_profile}" + + +# ebuild globals +if [[ ${PN} == "${PN_GnatPro}" ]] && [[ ${GNATMAJOR} == "3" ]]; then + DEPEND="x86? ( >=app-shells/tcsh-6.0 )" +fi +S="${WORKDIR}/gcc-${GCCVER}" + +# bootstrap globals, common to src_unpack and src_compile +GNATBOOT="${WORKDIR}/usr" +GNATBUILD="${WORKDIR}/build" + +# necessary for detecting lib locations and creating env.d entry +#XGCC="${GNATBUILD}/gcc/xgcc -B${GNATBUILD}/gcc" + +#----<< globals and SLOT >>---- + +# set SRC_URI's in ebuilds for now + +#----<< support checks >>---- +# skipping this section - do not care about hardened/multilib for now + +#---->> specs + env.d logic <<---- +# TODO!!! +# set MANPATH, etc.. +#----<< specs + env.d logic >>---- + + +#---->> some helper functions <<---- +is_multilib() { + [[ ${GCCMAJOR} < 3 ]] && return 1 + case ${CTARGET} in + mips64*|powerpc64*|s390x*|sparc64*|x86_64*) + has_multilib_profile || use multilib ;; + *) false ;; + esac +} + +# adapted from toolchain, +# left only basic multilib functionality and cut off mips stuff + +create_specs_file() { + einfo "Creating a vanilla gcc specs file" + "${WORKDIR}"/build/gcc/xgcc -dumpspecs > "${WORKDIR}"/build/vanilla.specs +} + + +# eselect stuff taken straight from toolchain.eclass and greatly simplified +add_profile_eselect_conf() { + local gnat_config_file=$1 + local abi=$2 + local var + + echo >> "${D}/${gnat_config_file}" + if ! is_multilib ; then + echo " ctarget=${CTARGET}" >> "${D}/${gnat_config_file}" + else + echo "[${abi}]" >> "${D}/${gnat_config_file}" + var="CTARGET_${abi}" + if [[ -n ${!var} ]] ; then + echo " ctarget=${!var}" >> "${D}/${gnat_config_file}" + else + var="CHOST_${abi}" + if [[ -n ${!var} ]] ; then + echo " ctarget=${!var}" >> "${D}/${gnat_config_file}" + else + echo " ctarget=${CTARGET}" >> "${D}/${gnat_config_file}" + fi + fi + fi + + var="CFLAGS_${abi}" + if [[ -n ${!var} ]] ; then + echo " cflags=${!var}" >> "${D}/${gnat_config_file}" + fi +} + + +create_eselect_conf() { + local abi + + dodir ${CONFIG_PATH} + + echo "[global]" > "${D}/${gnat_config_file}" + echo " version=${CTARGET}-${SLOT}" >> "${D}/${gnat_config_file}" + echo " binpath=${BINPATH}" >> "${D}/${gnat_config_file}" + echo " libexecpath=${LIBEXECPATH}" >> "${D}/${gnat_config_file}" + echo " ldpath=${LIBPATH}" >> "${D}/${gnat_config_file}" + echo " manpath=${DATAPATH}/man" >> "${D}/${gnat_config_file}" + echo " infopath=${DATAPATH}/info" >> "${D}/${gnat_config_file}" + echo " bin_prefix=${CTARGET}" >> "${D}/${gnat_config_file}" + + for abi in $(get_all_abis) ; do + add_profile_eselect_conf "${D}/${gnat_config_file}" "${abi}" + done +} + + + +should_we_eselect_gnat() { + # we only want to switch compilers if installing to / or /tmp/stage1root + [[ ${ROOT} == "/" ]] || return 1 + + # if the current config is invalid, we definitely want a new one + # Note: due to bash quirkiness, the following must not be 1 line + local curr_config + curr_config=$(eselect --no-color gnat show | grep ${CTARGET} | awk '{ print $1 }') || return 0 + [[ -z ${curr_config} ]] && return 0 + + # The logic is basically "try to keep the same profile if possible" + + if [[ ${curr_config} == ${CTARGET}-${PN}-${SLOT} ]] ; then + return 0 + else + elog "The current gcc config appears valid, so it will not be" + elog "automatically switched for you. If you would like to" + elog "switch to the newly installed gcc version, do the" + elog "following:" + echo + elog "eselect gnat set " + echo + ebeep + return 1 + fi +} + +# active compiler selection, called from pkg_postinst +do_gnat_config() { + eselect gnat set ${CTARGET}-${PN}-${SLOT} &> /dev/null + + elog "The following gnat profile has been activated:" + elog "${CTARGET}-${PN}-${SLOT}" + elog "" + elog "The compiler has been installed as gnatgcc, and the coverage testing" + elog "tool as gnatgcov." + elog "" + elog "Ada handling in Gentoo allows you to have multiple gnat variants" + elog "installed in parallel and automatically manage Ada libs." + elog "Please take a look at the Ada project page for some documentation:" + elog "http://www.gentoo.org/proj/en/prog_lang/ada/index.xml" +} + + +# Taken straight from the toolchain.eclass. Only removed the "obsolete hunk" +# +# The purpose of this DISGUSTING gcc multilib hack is to allow 64bit libs +# to live in lib instead of lib64 where they belong, with 32bit libraries +# in lib32. This hack has been around since the beginning of the amd64 port, +# and we're only now starting to fix everything that's broken. Eventually +# this should go away. +# +# Travis Tilley (03 Sep 2004) +# +disgusting_gcc_multilib_HACK() { + local config + local libdirs + if has_multilib_profile ; then + case $(tc-arch) in + amd64) + config="i386/t-linux64" + libdirs="../$(get_abi_LIBDIR amd64) ../$(get_abi_LIBDIR x86)" \ + ;; + ppc64) + config="rs6000/t-linux64" + libdirs="../$(get_abi_LIBDIR ppc64) ../$(get_abi_LIBDIR ppc)" \ + ;; + esac + else + die "Your profile is no longer supported by portage." + fi + + einfo "updating multilib directories to be: ${libdirs}" + sed -i -e "s:^MULTILIB_OSDIRNAMES.*:MULTILIB_OSDIRNAMES = ${libdirs}:" "${S}"/gcc/config/${config} +} + + +#---->> pkg_* <<---- +gnatbuild_pkg_setup() { + debug-print-function ${FUNCNAME} $@ + + # Setup variables which would normally be in the profile + if is_crosscompile ; then + multilib_env ${CTARGET} + fi + + # we dont want to use the installed compiler's specs to build gnat! + unset GCC_SPECS +} + +gnatbuild_pkg_postinst() { + if should_we_eselect_gnat; then + do_gnat_config + else + eselect gnat update + fi + + # if primary compiler list is empty, add this profile to the list, so + # that users are not left without active compilers (making sure that + # libs are getting built for at least one) + elog + . ${GnatCommon} || die "failed to source common code" + if [[ ! -f ${PRIMELIST} ]] || [[ ! -s ${PRIMELIST} ]]; then + echo "${gnat_profile}" > ${PRIMELIST} + elog "The list of primary compilers was empty and got assigned ${gnat_profile}." + fi + elog "Please edit ${PRIMELIST} and list there gnat profiles intended" + elog "for common use." +} + + +gnatbuild_pkg_postrm() { + # "eselect gnat update" now removes the env.d file if the corresponding + # gnat profile was unmerged + eselect gnat update + elog "If you just unmerged the last gnat in this SLOT, your active gnat" + elog "profile got unset. Please check what eselect gnat show tells you" + elog "and set the desired profile" +} +#---->> pkg_* <<---- + +#---->> src_* <<---- + +# common unpack stuff +gnatbuild_src_unpack() { + debug-print-function ${FUNCNAME} $@ + [ -z "$1" ] && gnatbuild_src_unpack all + + while [ "$1" ]; do + case $1 in + base_unpack) + unpack ${A} + pax-mark E $(find ${GNATBOOT} -name gnat1) + + cd "${S}" + # patching gcc sources, following the toolchain + if [[ -d "${FILESDIR}"/${SLOT} ]] ; then + EPATCH_MULTI_MSG="Applying Gentoo patches ..." \ + epatch "${FILESDIR}"/${SLOT}/*.patch + fi + # Replacing obsolete head/tail with POSIX compliant ones + ht_fix_file */configure + + if ! is_crosscompile && is_multilib && \ + [[ ( $(tc-arch) == "amd64" || $(tc-arch) == "ppc64" ) && -z ${SKIP_MULTILIB_HACK} ]] ; then + disgusting_gcc_multilib_HACK || die "multilib hack failed" + fi + + # Fixup libtool to correctly generate .la files with portage + cd "${S}" + elibtoolize --portage --shallow --no-uclibc + + gnuconfig_update + # update configure files + einfo "Fixing misc issues in configure files" + for f in $(grep -l 'autoconf version 2.13' $(find "${S}" -name configure)) ; do + ebegin " Updating ${f}" + patch "${f}" "${FILESDIR}"/gcc-configure-LANG.patch >& "${T}"/configure-patch.log \ + || eerror "Please file a bug about this" + eend $? + done + +# this is only needed for gnat-gpl-4.1 and breaks for gnat-gcc, so +# this block was moved to corresponding ebuild +# pushd "${S}"/gnattools &> /dev/null +# eautoconf +# popd &> /dev/null + ;; + + common_prep) + # Prepare the gcc source directory + cd "${S}/gcc" + touch cstamp-h.in + touch ada/[es]info.h + touch ada/nmake.ad[bs] + # set the compiler name to gnatgcc + for i in `find ada/ -name '*.ad[sb]'`; do \ + sed -i -e "s/\"gcc\"/\"gnatgcc\"/g" ${i}; \ + done + # add -fPIC flag to shared libs for 3.4* backend + if [ "3.4" == "${GCCBRANCH}" ] ; then + cd ada + epatch "${FILESDIR}"/gnat-Make-lang.in.patch + fi + + # gcc sources as of 4.3 seem to have a common omission of $(DESTDIR), + # that leads to make install trying to rm -f file on live system. + # As we do not need this rm, we simply remove the whole line + sed -i -e "/\$(RM) \$(bindir)/d" "${S}"/gcc/ada/Make-lang.in + + mkdir -p "${GNATBUILD}" + ;; + + all) + gnatbuild_src_unpack base_unpack common_prep + ;; + esac + shift + done +} + +# it would be nice to split configure and make steps +# but both need to operate inside specially tuned evironment +# so just do sections for now (as in eclass section of handbook) +# sections are: configure, make-tools, bootstrap, +# gnatlib_and_tools, gnatlib-shared +gnatbuild_src_compile() { + debug-print-function ${FUNCNAME} $@ + if [[ -z "$1" ]]; then + gnatbuild_src_compile all + return $? + fi + + if [[ "all" == "$1" ]] + then # specialcasing "all" to avoid scanning sources unnecessarily + gnatbuild_src_compile configure make-tools \ + bootstrap gnatlib_and_tools gnatlib-shared + + else + # Set some paths to our bootstrap compiler. + export PATH="${GNATBOOT}/bin:${PATH}" + # !ATTN! the bootstrap compilers have a very simplystic structure, + # so many paths are not identical to the installed ones. + # Plus it was simplified even more in new releases. + if [[ ${BOOT_SLOT} > 4.1 ]] ; then + GNATLIB="${GNATBOOT}/lib" + else + GNATLIB="${GNATBOOT}/lib/gnatgcc/${BOOT_TARGET}/${BOOT_SLOT}" + fi + + export CC="${GNATBOOT}/bin/gnatgcc" + export INCLUDE_DIR="${GNATLIB}/include" + export LIB_DIR="${GNATLIB}" + export LDFLAGS="-L${GNATLIB}" + + # additional vars from gnuada and elsewhere + #export LD_RUN_PATH="${LIBPATH}" + export LIBRARY_PATH="${GNATLIB}" + #export LD_LIBRARY_PATH="${GNATLIB}" +# export COMPILER_PATH="${GNATBOOT}/bin/" + + export ADA_OBJECTS_PATH="${GNATLIB}/adalib" + export ADA_INCLUDE_PATH="${GNATLIB}/adainclude" + +# einfo "CC=${CC}, +# ADA_INCLUDE_PATH=${ADA_INCLUDE_PATH}, +# LDFLAGS=${LDFLAGS}, +# PATH=${PATH}" + + while [ "$1" ]; do + case $1 in + configure) + debug-print-section configure + # Configure gcc + local confgcc + + # some cross-compile logic from toolchain + confgcc="${confgcc} --host=${CHOST}" + if is_crosscompile || tc-is-cross-compiler ; then + confgcc="${confgcc} --target=${CTARGET}" + fi + [[ -n ${CBUILD} ]] && confgcc="${confgcc} --build=${CBUILD}" + + # Native Language Support + if use nls ; then + confgcc="${confgcc} --enable-nls --without-included-gettext" + else + confgcc="${confgcc} --disable-nls" + fi + + # reasonably sane globals (from toolchain) + confgcc="${confgcc} \ + --with-system-zlib \ + --disable-checking \ + --disable-werror \ + --disable-libunwind-exceptions" + + # ACT's gnat-gpl does not like libada for whatever reason.. + if [[ ${PN} == ${PN_GnatGpl} ]]; then + einfo "ACT's gnat-gpl does not like libada, disabling" + confgcc="${confgcc} --disable-libada" + else + confgcc="${confgcc} --enable-libada" + fi + + # multilib support + if is_multilib ; then + confgcc="${confgcc} --enable-multilib" + else + confgcc="${confgcc} --disable-multilib" + fi + +# einfo "confgcc=${confgcc}" + + cd "${GNATBUILD}" + CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" "${S}"/configure \ + --prefix=${PREFIX} \ + --bindir=${BINPATH} \ + --includedir=${INCLUDEPATH} \ + --libdir="${LIBPATH}" \ + --libexecdir="${LIBEXECPATH}" \ + --datadir=${DATAPATH} \ + --mandir=${DATAPATH}/man \ + --infodir=${DATAPATH}/info \ + --program-prefix=gnat \ + --enable-languages="c,ada" \ + --with-gcc \ + --enable-threads=posix \ + --enable-shared \ + --with-system-zlib \ + ${confgcc} || die "configure failed" + ;; + + make-tools) + debug-print-section make-tools + # Compile helper tools + cd "${GNATBOOT}" + cp "${S}"/gcc/ada/xtreeprs.adb . + cp "${S}"/gcc/ada/xsinfo.adb . + cp "${S}"/gcc/ada/xeinfo.adb . + cp "${S}"/gcc/ada/xnmake.adb . + gnatmake xtreeprs && \ + gnatmake xsinfo && \ + gnatmake xeinfo && \ + gnatmake xnmake || die "building helper tools" + ;; + + bootstrap) + debug-print-section bootstrap + # and, finally, the build itself + cd "${GNATBUILD}" + emake bootstrap || die "bootstrap failed" + ;; + + gnatlib_and_tools) + debug-print-section gnatlib_and_tools + einfo "building gnatlib_and_tools" + cd "${GNATBUILD}" + emake -j1 -C gcc gnatlib_and_tools || \ + die "gnatlib_and_tools failed" + ;; + + gnatlib-shared) + debug-print-section gnatlib-shared + einfo "building shared lib" + cd "${GNATBUILD}" + rm -f gcc/ada/rts/*.{o,ali} || die + #otherwise make tries to reuse already compiled (without -fPIC) objs.. + emake -j1 -C gcc gnatlib-shared LIBRARY_VERSION="${GCCBRANCH}" || \ + die "gnatlib-shared failed" + ;; + + esac + shift + done # while + fi # "all" == "$1" +} +# -- end gnatbuild_src_compile + + +gnatbuild_src_install() { + debug-print-function ${FUNCNAME} $@ + + if [[ -z "$1" ]] ; then + gnatbuild_src_install all + return $? + fi + + while [ "$1" ]; do + case $1 in + install) # runs provided make install + debug-print-section install + + # Looks like we need an access to the bootstrap compiler here too + # as gnat apparently wants to compile something during the installation + # The spotted obuser was xgnatugn, used to process gnat_ugn_urw.texi, + # during preparison of the docs. + export PATH="${GNATBOOT}/bin:${PATH}" + GNATLIB="${GNATBOOT}/lib/gnatgcc/${BOOT_TARGET}/${BOOT_SLOT}" + + export CC="${GNATBOOT}/bin/gnatgcc" + export INCLUDE_DIR="${GNATLIB}/include" + export LIB_DIR="${GNATLIB}" + export LDFLAGS="-L${GNATLIB}" + export ADA_OBJECTS_PATH="${GNATLIB}/adalib" + export ADA_INCLUDE_PATH="${GNATLIB}/adainclude" + + # Do not allow symlinks in /usr/lib/gcc/${CHOST}/${MY_PV}/include as + # this can break the build. + for x in "${GNATBUILD}"/gcc/include/* ; do + if [ -L ${x} ] ; then + rm -f ${x} + fi + done + # Remove generated headers, as they can cause things to break + # (ncurses, openssl, etc). (from toolchain.eclass) + for x in $(find "${WORKDIR}"/build/gcc/include/ -name '*.h') ; do + grep -q 'It has been auto-edited by fixincludes from' "${x}" \ + && rm -f "${x}" + done + + + cd "${GNATBUILD}" + make DESTDIR="${D}" install || die + + #make a convenience info link + dosym ${DATAPATH}/info/gnat_ugn_unw.info ${DATAPATH}/info/gnat.info + ;; + + move_libs) + debug-print-section move_libs + + # first we need to remove some stuff to make moving easier + rm -rf "${D}${LIBPATH}"/{32,include,libiberty.a} + # gcc insists on installing libs in its own place + mv "${D}${LIBPATH}/gcc/${CTARGET}/${GCCRELEASE}"/* "${D}${LIBPATH}" + mv "${D}${LIBEXECPATH}/gcc/${CTARGET}/${GCCRELEASE}"/* "${D}${LIBEXECPATH}" + + # libgcc_s and, with gcc>=4.0, other libs get installed in multilib specific locations by gcc + # we pull everything together to simplify working environment + if has_multilib_profile ; then + case $(tc-arch) in + amd64) + mv "${D}${LIBPATH}"/../$(get_abi_LIBDIR amd64)/* "${D}${LIBPATH}" + mv "${D}${LIBPATH}"/../$(get_abi_LIBDIR x86)/* "${D}${LIBPATH}"/32 + ;; + ppc64) + # not supported yet, will have to be adjusted when we + # actually build gnat for that arch + ;; + esac + fi + + # force gnatgcc to use its own specs - versions prior to 3.4.6 read specs + # from system gcc location. Do the simple wrapper trick for now + # !ATTN! change this if eselect-gnat starts to follow eselect-compiler + if [[ ${GCCVER} < 3.4.6 ]] ; then + # gcc 4.1 uses builtin specs. What about 4.0? + cd "${D}${BINPATH}" + mv gnatgcc gnatgcc_2wrap + cat > gnatgcc << EOF +#! /bin/bash +# wrapper to cause gnatgcc read appropriate specs and search for the right .h +# files (in case no matching gcc is installed) +BINDIR=\$(dirname \$0) +# The paths in the next line have to be absolute, as gnatgcc may be called from +# any location +\${BINDIR}/gnatgcc_2wrap -specs="${LIBPATH}/specs" -I"${LIBPATH}/include" \$@ +EOF + chmod a+x gnatgcc + fi + + # earlier gnat's generate some Makefile's at generic location, need to + # move to avoid collisions + [ -f "${D}${PREFIX}"/share/gnat/Makefile.generic ] && + mv "${D}${PREFIX}"/share/gnat/Makefile.* "${D}${DATAPATH}" + + # use gid of 0 because some stupid ports don't have + # the group 'root' set to gid 0 (toolchain.eclass) + chown -R root:0 "${D}${LIBPATH}" + ;; + + cleanup) + debug-print-section cleanup + + rm -rf "${D}${LIBPATH}"/{gcc,install-tools,../lib{32,64}} + rm -rf "${D}${LIBEXECPATH}"/{gcc,install-tools} + + # this one is installed by gcc and is a duplicate even here anyway + rm -f "${D}${BINPATH}/${CTARGET}-gcc-${GCCRELEASE}" + + # remove duplicate docs + rm -f "${D}${DATAPATH}"/info/{dir,gcc,cpp}* + rm -rf "${D}${DATAPATH}"/man/man7/ + ;; + + prep_env) + # instead of putting junk under /etc/env.d/gnat we recreate env files as + # needed with eselect + create_eselect_conf + ;; + + all) + gnatbuild_src_install install move_libs cleanup prep_env + ;; + esac + shift + done # while +} +# -- end gnatbuild_src_install diff --git a/sdk_container/src/third_party/portage-stable/eclass/gnome-python-common.eclass b/sdk_container/src/third_party/portage-stable/eclass/gnome-python-common.eclass new file mode 100644 index 0000000000..e45082bdb4 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/gnome-python-common.eclass @@ -0,0 +1,114 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/gnome-python-common.eclass,v 1.9 2010/02/09 10:06:36 grobian Exp $ + +# Original Author: Arun Raghavan (based on the +# gnome-python-desktop eclass by Jim Ramsay ) +# +# Purpose: Provides common functionality required for building the gnome-python* +# bindings +# +# Important environment variables: +# +# G_PY_PN: Which gnome-python* package bindings we're working with. Defaults to +# gnome-python if unset. +# +# G_PY_BINDINGS: The actual '--enable-' name, which by default is ${PN} +# excluding the -python at the end. May be overridden if necessary. +# +# EXAMPLES: The set of example files to be installed if the 'examples' USE flag +# is set. +# +# The naming convention for all bindings is as follows: +# dev-python/-python +# +# So, for example, with the bonobo bindings, the original package is libbonobo +# and the packages is named dev-python/libbonobo-python + +inherit versionator python autotools gnome2 + +G_PY_PN=${G_PY_PN:-gnome-python} +G_PY_BINDINGS=${G_PY_BINDINGS:-${PN%-python}} + +PVP="$(get_version_component_range 1-2)" +SRC_URI="mirror://gnome/sources/${G_PY_PN}/${PVP}/${G_PY_PN}-${PV}.tar.bz2" +HOMEPAGE="http://pygtk.org/" + +RESTRICT="${RESTRICT} test" + +GCONF_DEBUG="no" +DOCS="AUTHORS ChangeLog NEWS README" + +if [[ ${G_PY_PN} != "gnome-python" ]]; then + DOCS="${DOCS} MAINTAINERS" +fi + +S="${WORKDIR}/${G_PY_PN}-${PV}" + +# add blockers, we can probably remove them later on +if [[ ${G_PY_PN} == "gnome-python-extras" ]]; then + RDEPEND="!<=dev-python/gnome-python-extras-2.19.1-r2" +fi + +RDEPEND="${RDEPEND} ~dev-python/${G_PY_PN}-base-${PV}" +DEPEND="${RDEPEND} + dev-util/pkgconfig" + +# Enable the required bindings as specified by the G_PY_BINDINGS variable +gnome-python-common_pkg_setup() { + G2CONF="${G2CONF} --disable-allbindings" + for binding in ${G_PY_BINDINGS}; do + G2CONF="${G2CONF} --enable-${binding}" + done +} + +gnome-python-common_src_unpack() { + gnome2_src_unpack + + # disable pyc compiling + if [[ -f py-compile ]]; then + rm py-compile + ln -s $(type -P true) py-compile + fi +} + +# Do a regular gnome2 src_install and then install examples if required. +# Set the variable EXAMPLES to provide the set of examples to be installed. +# (to install a directory recursively, specify it with a trailing '/' - for +# example, foo/bar/) +gnome-python-common_src_install() { + # The .pc file is installed by respective gnome-python*-base package + sed -i '/^pkgconfig_DATA/d' Makefile || die "sed failed" + sed -i '/^pkgconfigdir/d' Makefile || die "sed failed" + + gnome2_src_install + + if hasq examples ${IUSE} && use examples; then + insinto /usr/share/doc/${PF}/examples + + for example in ${EXAMPLES}; do + if [[ ${example: -1} = "/" ]]; then + doins -r ${example} + else + doins ${example} + fi + done + fi + + # Python does not need these, bug #299243 + find "${D%/}${EPREFIX}$(python_get_sitedir)" -name "*.la" -delete \ + || die "failed to remove la files" + +} + +gnome-python-common_pkg_postinst() { + python_version + python_need_rebuild + python_mod_optimize /usr/$(get_libdir)/python${PYVER}/site-packages/gtk-2.0 +} + +gnome-python-common_pkg_postrm() { + python_mod_cleanup +} + +EXPORT_FUNCTIONS pkg_setup src_unpack src_install pkg_postinst pkg_postrm diff --git a/sdk_container/src/third_party/portage-stable/eclass/gnome2-utils.eclass b/sdk_container/src/third_party/portage-stable/eclass/gnome2-utils.eclass new file mode 100644 index 0000000000..7f9ef898ba --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/gnome2-utils.eclass @@ -0,0 +1,223 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/gnome2-utils.eclass,v 1.13 2008/10/22 21:04:53 eva Exp $ + +# +# gnome2-utils.eclass +# +# Set of auxiliary functions used to perform actions commonly needed by packages +# using the GNOME framework. +# +# Maintained by Gentoo's GNOME herd +# + + + +# Path to gconftool-2 +: ${GCONFTOOL_BIN:="${ROOT}usr/bin/gconftool-2"} + +# Directory where scrollkeeper-update should do its work +: ${SCROLLKEEPER_DIR:="${ROOT}var/lib/scrollkeeper"} + +# Path to scrollkeeper-update +: ${SCROLLKEEPER_UPDATE_BIN:="${ROOT}usr/bin/scrollkeeper-update"} + + + +DEPEND=">=sys-apps/sed-4" + + + +# Find the GConf schemas that are about to be installed and save their location +# in the GNOME2_ECLASS_SCHEMAS environment variable +gnome2_gconf_savelist() { + pushd "${D}" &> /dev/null + export GNOME2_ECLASS_SCHEMAS=$(find 'etc/gconf/schemas/' -name '*.schemas' 2> /dev/null) + popd &> /dev/null +} + + +# Applies any schema files installed by the current ebuild to Gconf's database +# using gconftool-2 +gnome2_gconf_install() { + local F + + if [[ ! -x "${GCONFTOOL_BIN}" ]]; then + return + fi + + if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then + einfo "No GNOME 2 GConf schemas found" + return + fi + + # We are ready to install the GCONF Scheme now + unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL + export GCONF_CONFIG_SOURCE="$("${GCONFTOOL_BIN}" --get-default-source | sed "s;:/;:${ROOT};")" + + einfo "Installing GNOME 2 GConf schemas" + + for F in ${GNOME2_ECLASS_SCHEMAS}; do + if [[ -e "${ROOT}${F}" ]]; then + # echo "DEBUG::gconf install ${F}" + "${GCONFTOOL_BIN}" --makefile-install-rule "${ROOT}${F}" 1>/dev/null + fi + done + + # have gconf reload the new schemas + pids=$(pgrep -x gconfd-2) + if [[ $? == 0 ]] ; then + ebegin "Reloading GConf schemas" + kill -HUP ${pids} + eend $? + fi +} + + +# Removes schema files previously installed by the current ebuild from Gconf's +# database. +gnome2_gconf_uninstall() { + local F + + if [[ ! -x "${GCONFTOOL_BIN}" ]]; then + return + fi + + if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then + einfo "No GNOME 2 GConf schemas found" + return + fi + + unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL + export GCONF_CONFIG_SOURCE="$("${GCONFTOOL_BIN}" --get-default-source | sed "s;:/;:${ROOT};")" + + einfo "Uninstalling GNOME 2 GConf schemas" + + for F in ${GNOME2_ECLASS_SCHEMAS}; do + if [[ -e "${ROOT}${F}" ]]; then + # echo "DEBUG::gconf uninstall ${F}" + "${GCONFTOOL_BIN}" --makefile-uninstall-rule "${ROOT}${F}" 1>/dev/null + fi + done + + # have gconf reload the new schemas + pids=$(pgrep -x gconfd-2) + if [[ $? == 0 ]] ; then + ebegin "Reloading GConf schemas" + kill -HUP ${pids} + eend $? + fi +} + + +# Find the icons that are about to be installed and save their location +# in the GNOME2_ECLASS_ICONS environment variable +# That function should be called from pkg_preinst +gnome2_icon_savelist() { + pushd "${D}" &> /dev/null + export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null) + popd &> /dev/null +} + + +# Updates Gtk+ icon cache files under /usr/share/icons if the current ebuild +# have installed anything under that location. +gnome2_icon_cache_update() { + local updater="$(type -p gtk-update-icon-cache 2> /dev/null)" + + if [[ ! -x "${updater}" ]] ; then + debug-print "${updater} is not executable" + return + fi + + if [[ -z "${GNOME2_ECLASS_ICONS}" ]]; then + return + fi + + + ebegin "Updating icons cache" + + local retval=0 + local fails=( ) + + for dir in ${GNOME2_ECLASS_ICONS} + do + if [[ -f "${ROOT}${dir}/index.theme" ]] ; then + local rv=0 + + "${updater}" -qf "${ROOT}${dir}" + rv=$? + + if [[ ! $rv -eq 0 ]] ; then + debug-print "Updating cache failed on ${ROOT}${dir}" + + # Add to the list of failures + fails[$(( ${#fails[@]} + 1 ))]="${ROOT}${dir}" + + retval=2 + fi + fi + done + + eend ${retval} + + for f in "${fails[@]}" ; do + eerror "Failed to update cache with icon $f" + done +} + + +# Workaround applied to Makefile rules in order to remove redundant +# calls to scrollkeeper-update and sandbox violations. +gnome2_omf_fix() { + local omf_makefiles filename + + omf_makefiles="$@" + + if [[ -f ${S}/omf.make ]] ; then + omf_makefiles="${omf_makefiles} ${S}/omf.make" + fi + + # testing fixing of all makefiles found + # The sort is important to ensure .am is listed before the respective .in for + # maintainer mode regeneration not kicking in due to .am being newer than .in + for filename in $(find ./ -name "Makefile.in" -o -name "Makefile.am" |sort) ; do + omf_makefiles="${omf_makefiles} ${filename}" + done + + ebegin "Fixing OMF Makefiles" + + local retval=0 + local fails=( ) + + for omf in ${omf_makefiles} ; do + local rv=0 + + sed -i -e 's:scrollkeeper-update:true:' "${omf}" + retval=$? + + if [[ ! $rv -eq 0 ]] ; then + debug-print "updating of ${omf} failed" + + # Add to the list of failures + fails[$(( ${#fails[@]} + 1 ))]=$omf + + retval=2 + fi + done + + eend $retval + + for f in "${fails[@]}" ; do + eerror "Failed to update OMF Makefile $f" + done +} + + +# Updates the global scrollkeeper database. +gnome2_scrollkeeper_update() { + if [[ -x "${SCROLLKEEPER_UPDATE_BIN}" ]]; then + einfo "Updating scrollkeeper database ..." + "${SCROLLKEEPER_UPDATE_BIN}" -q -p "${SCROLLKEEPER_DIR}" + fi +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/gnome2.eclass b/sdk_container/src/third_party/portage-stable/eclass/gnome2.eclass new file mode 100644 index 0000000000..44d75f659f --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/gnome2.eclass @@ -0,0 +1,150 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/gnome2.eclass,v 1.86 2009/02/17 16:05:33 dang Exp $ + +# +# gnome2.eclass +# +# Exports portage base functions used by ebuilds written for packages using the +# GNOME framework. For additional functions, see gnome2-utils.eclass. +# +# Maintained by Gentoo's GNOME herd +# + + +inherit fdo-mime libtool gnome.org gnome2-utils + +case "${EAPI:-0}" in + 0|1) + EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_postrm + ;; + *) + EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install pkg_preinst pkg_postinst pkg_postrm + ;; +esac + +# Extra configure opts passed to econf +G2CONF=${G2CONF:-""} + +# Extra options passed to elibtoolize +ELTCONF=${ELTCONF:-""} + +# Should we use EINSTALL instead of DESTDIR +USE_EINSTALL=${USE_EINSTALL:-""} + +# Run scrollkeeper for this package? +SCROLLKEEPER_UPDATE=${SCROLLKEEPER_UPDATE:-"1"} + + + +if [[ ${GCONF_DEBUG} != "no" ]]; then + IUSE="debug" +fi + + + +gnome2_src_unpack() { + unpack ${A} + cd "${S}" + has ${EAPI:-0} 0 1 && gnome2_src_prepare +} + +gnome2_src_prepare() { + # Prevent scrollkeeper access violations + gnome2_omf_fix + + # Run libtoolize + elibtoolize ${ELTCONF} +} + +gnome2_src_configure() { + # Update the GNOME configuration options + if [[ ${GCONF_DEBUG} != 'no' ]] ; then + if use debug ; then + G2CONF="${G2CONF} --enable-debug=yes" + fi + fi + + # Prevent a QA warning + if has doc ${IUSE} ; then + G2CONF="${G2CONF} $(use_enable doc gtk-doc)" + fi + + # Avoid sandbox violations caused by misbehaving packages (bug #128289) + addwrite "/root/.gnome2" + + # GST_REGISTRY is to work around gst-inspect trying to read/write /root + GST_REGISTRY="${S}/registry.xml" econf "$@" ${G2CONF} || die "configure failed" +} + +gnome2_src_compile() { + has ${EAPI:-0} 0 1 && gnome2_src_configure "$@" + emake || die "compile failure" +} + +gnome2_src_install() { + # if this is not present, scrollkeeper-update may segfault and + # create bogus directories in /var/lib/ + local sk_tmp_dir="/var/lib/scrollkeeper" + dodir "${sk_tmp_dir}" + + # we must delay gconf schema installation due to sandbox + export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL="1" + + if [[ -z "${USE_EINSTALL}" || "${USE_EINSTALL}" = "0" ]]; then + debug-print "Installing with 'make install'" + emake DESTDIR="${D}" "scrollkeeper_localstate_dir=${D}${sk_tmp_dir} " "$@" install || die "install failed" + else + debug-print "Installing with 'einstall'" + einstall "scrollkeeper_localstate_dir=${D}${sk_tmp_dir} " "$@" || die "einstall failed" + fi + + unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL + + # Manual document installation + [[ -n "${DOCS}" ]] && dodoc ${DOCS} + + # Do not keep /var/lib/scrollkeeper because: + # 1. The scrollkeeper database is regenerated at pkg_postinst() + # 2. ${D}/var/lib/scrollkeeper contains only indexes for the current pkg + # thus it makes no sense if pkg_postinst ISN'T run for some reason. + if [[ -z "$(find "${D}" -name '*.omf')" ]]; then + export SCROLLKEEPER_UPDATE="0" + fi + rm -rf "${D}${sk_tmp_dir}" + + # Make sure this one doesn't get in the portage db + rm -fr "${D}/usr/share/applications/mimeinfo.cache" +} + +gnome2_pkg_preinst() { + gnome2_gconf_savelist + gnome2_icon_savelist +} + +gnome2_pkg_postinst() { + gnome2_gconf_install + fdo-mime_desktop_database_update + fdo-mime_mime_database_update + gnome2_icon_cache_update + + if [[ "${SCROLLKEEPER_UPDATE}" = "1" ]]; then + gnome2_scrollkeeper_update + fi +} + +#gnome2_pkg_prerm() { +# gnome2_gconf_uninstall +#} + +gnome2_pkg_postrm() { + fdo-mime_desktop_database_update + fdo-mime_mime_database_update + gnome2_icon_cache_update + + if [[ "${SCROLLKEEPER_UPDATE}" = "1" ]]; then + gnome2_scrollkeeper_update + fi +} + +# pkg_prerm diff --git a/sdk_container/src/third_party/portage-stable/eclass/gnuconfig.eclass b/sdk_container/src/third_party/portage-stable/eclass/gnuconfig.eclass new file mode 100644 index 0000000000..112d6213c2 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/gnuconfig.eclass @@ -0,0 +1,103 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/gnuconfig.eclass,v 1.33 2006/06/21 19:35:28 vapier Exp $ +# +# THIS ECLASS IS DEAD: It has been integrated into portage +# +# Author: Will Woods +# +# This eclass is used to automatically update files that typically come with +# automake to the newest version available on the system. The most common use +# of this is to update config.guess and config.sub when configure dies from +# misguessing your canonical system name (CHOST). It can also be used to update +# other files that come with automake, e.g. depcomp, mkinstalldirs, etc. +# +# usage: gnuconfig_update [file1 file2 ...] +# if called without arguments, config.guess and config.sub will be updated. +# All files in the source tree ($S) with the given name(s) will be replaced +# with the newest available versions chosen from the list of locations in +# gnuconfig_findnewest(), below. +# +# gnuconfig_update should generally be called from src_unpack() + + +DEPEND="sys-devel/gnuconfig" + +DESCRIPTION="Based on the ${ECLASS} eclass" + +# Wrapper function for gnuconfig_do_update. If no arguments are given, update +# config.sub and config.guess (old default behavior), otherwise update the +# named files. +gnuconfig_update() { + +# hmm some packages (like binutils gcc glibc) still use this ... +# echo +# ewarn "QA Notice: Please stop using me, portage updates files for you." +# echo + + local startdir # declared here ... used in gnuconfig_do_update + + if [[ $1 == /* ]] ; then + startdir=$1 + shift + else + startdir=${S} + fi + + if [[ $# -gt 0 ]] ; then + gnuconfig_do_update "$@" + else + gnuconfig_do_update config.sub config.guess + fi + + return $? +} + +# Copy the newest available version of specified files over any old ones in the +# source dir. This function shouldn't be called directly - use gnuconfig_update +# +# Note that since bash using dynamic scoping, startdir is available here from +# the gnuconfig_update function +gnuconfig_do_update() { + local configsubs_dir target targetlist file + + [[ $# -eq 0 ]] && die "do not call gnuconfig_do_update; use gnuconfig_update" + + configsubs_dir=$(gnuconfig_findnewest) + einfo "Using GNU config files from ${configsubs_dir}" + for file in "$@" ; do + if [[ ! -r ${configsubs_dir}/${file} ]] ; then + eerror "Can't read ${configsubs_dir}/${file}, skipping.." + continue + fi + targetlist=$(find "${startdir}" -name "${file}") + if [[ -n ${targetlist} ]] ; then + for target in ${targetlist} ; do + [[ -L ${target} ]] && rm -f "${target}" + einfo " Updating ${target/$startdir\//}" + cp -f "${configsubs_dir}/${file}" "${target}" + eend $? + done + else + ewarn " No ${file} found in ${startdir}, skipping ..." + fi + done + + return 0 +} + +# this searches the standard locations for the newest config.{sub|guess}, and +# returns the directory where they can be found. +gnuconfig_findnewest() { + local locations=" + /usr/share/gnuconfig/config.sub + /usr/share/automake-1.9/config.sub + /usr/share/automake-1.8/config.sub + /usr/share/automake-1.7/config.sub + /usr/share/automake-1.6/config.sub + /usr/share/automake-1.5/config.sub + /usr/share/automake-1.4/config.sub + /usr/share/libtool/config.sub + " + grep -s '^timestamp' ${locations} | sort -n -t\' -k2 | tail -n 1 | sed 's,/config.sub:.*$,,' +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/gnustep-2.eclass b/sdk_container/src/third_party/portage-stable/eclass/gnustep-2.eclass new file mode 100644 index 0000000000..2e29ed9c8f --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/gnustep-2.eclass @@ -0,0 +1,23 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/gnustep-2.eclass,v 1.4 2009/11/25 10:11:40 voyageur Exp $ + +inherit gnustep-base + +# Eclass for GNUstep Apps, Frameworks, and Bundles build +# +# maintainer: GNUstep Herd + +DEPEND=">=gnustep-base/gnustep-make-2.0 + virtual/gnustep-back" +RDEPEND="${DEPEND} + debug? ( >=sys-devel/gdb-6.0 )" + +# The following gnustep-based EXPORT_FUNCTIONS are available: +# * gnustep-base_pkg_setup +# * gnustep-base_src_unpack (EAPI 0|1 only) +# * gnustep-base_src_prepare (EAPI>=2 only) +# * gnustep-base_src_configure (EAPI>=2 only) +# * gnustep-base_src_compile +# * gnustep-base_src_install +# * gnustep-base_pkg_postinst diff --git a/sdk_container/src/third_party/portage-stable/eclass/gnustep-base.eclass b/sdk_container/src/third_party/portage-stable/eclass/gnustep-base.eclass new file mode 100644 index 0000000000..cad1f1e2cd --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/gnustep-base.eclass @@ -0,0 +1,231 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/gnustep-base.eclass,v 1.14 2009/12/05 16:10:30 grobian Exp $ + +inherit eutils flag-o-matic + +# Inner gnustep eclass, should only be inherited directly by gnustep-base +# packages +# +# maintainer: GNUstep Herd + +# IUSE variables across all GNUstep packages +# "debug": enable code for debugging +# "doc": build and install documentation, if available +IUSE="debug doc" + +# packages needed to build any base gnustep package +GNUSTEP_CORE_DEPEND="doc? ( virtual/texi2dvi dev-tex/latex2html app-text/texi2html )" + +# Where to install GNUstep +GNUSTEP_PREFIX="${EPREFIX}/usr/GNUstep" + +# GNUstep environment array +typeset -a GS_ENV + +# Ebuild function overrides +gnustep-base_pkg_setup() { + if test_version_info 3.3 ; then + strip-unsupported-flags + elif test_version_info 3.4 ; then + # strict-aliasing is known to break obj-c stuff in gcc-3.4* + filter-flags -fstrict-aliasing + fi + + # known to break ObjC (bug 86089) + filter-flags -fomit-frame-pointer +} + +gnustep-base_src_unpack() { + unpack ${A} + cd "${S}" + + gnustep-base_src_prepare +} + +gnustep-base_src_prepare() { + if [[ -f ./GNUmakefile ]] ; then + # Kill stupid includes that are simply overdone or useless on normal + # Gentoo, but (may) cause major headaches on Prefixed Gentoo. If this + # only removes a part of a path it's good that it bails out, as we want + # to know when they use some direct include. + ebegin "Cleaning paths from GNUmakefile" + sed -i \ + -e 's|-I/usr/X11R6/include||g' \ + -e 's|-I/usr/include||g' \ + -e 's|-L/usr/X11R6/lib||g' \ + -e 's|-L/usr/lib||g' \ + GNUmakefile + eend $? + fi +} + +gnustep-base_src_configure() { + egnustep_env + if [[ -x ./configure ]] ; then + econf || die "configure failed" + fi +} + +gnustep-base_src_compile() { + egnustep_env + case ${EAPI:-0} in + 0|1) gnustep-base_src_configure ;; + esac + + egnustep_make +} + +gnustep-base_src_install() { + egnustep_env + egnustep_install + if use doc ; then + egnustep_env + egnustep_doc + fi + egnustep_install_config +} + +gnustep-base_pkg_postinst() { + [[ $(type -t gnustep_config_script) != "function" ]] && return 0 + + elog "To use this package, as *user* you should run:" + elog " ${GNUSTEP_SYSTEM_TOOLS}/Gentoo/config-${PN}.sh" +} + +# Clean/reset an ebuild to the installed GNUstep environment +egnustep_env() { + # Get additional variables + GNUSTEP_SH_EXPORT_ALL_VARIABLES="true" + + if [[ -f ${GNUSTEP_PREFIX}/System/Library/Makefiles/GNUstep.sh ]] ; then + # Reset GNUstep variables + source "${GNUSTEP_PREFIX}"/System/Library/Makefiles/GNUstep-reset.sh + source "${GNUSTEP_PREFIX}"/System/Library/Makefiles/GNUstep.sh + + # Needed to run installed GNUstep apps in sandbox + addpredict "/root/GNUstep" + + # Set rpath in ldflags when available + case ${CHOST} in + *-linux-gnu|*-solaris*) + is-ldflagq -Wl,-rpath="${GNUSTEP_SYSTEM_LIBRARIES}" \ + || append-ldflags \ + -Wl,-rpath="${GNUSTEP_SYSTEM_LIBRARIES}" + ;; + esac + + # Set up env vars for make operations + GS_ENV=( AUXILIARY_LDFLAGS="${LDFLAGS}" \ + ADDITIONAL_NATIVE_LIB_DIRS="${GNUSTEP_SYSTEM_LIBRARIES}" \ + DESTDIR="${D}" \ + HOME="${T}" \ + GNUSTEP_USER_DIR="${T}" \ + GNUSTEP_USER_DEFAULTS_DIR="${T}"/Defaults \ + GNUSTEP_INSTALLATION_DOMAIN=SYSTEM \ + TAR_OPTIONS="${TAR_OPTIONS} --no-same-owner" \ + messages=yes ) + + # Parallel-make support was added in gnustep-make 2.2.0 + has_version " "${T}"/${cfile} +#!/usr/bin/env bash +gnustep_append_default() { + if [[ -z $1 || -z $2 || -z $3 ]]; then + echo "warning: invalid script invocation" + return + fi + dom=$1 + key=$2 + val=$3 + cur=$(defaults read ${dom} ${key}) 2> /dev/null + if [[ -z $cur ]] ; then + echo " * setting ${dom} ${key}" + defaults write ${dom} ${key} "( ${val} )" + elif [[ ${cur} != *${val}* ]] ; then + echo " * adding ${val} to ${dom} ${key}" + echo "${cur%)\'}, \"${val}\" )'" | defaults write + else + echo " * ${val} already present in ${dom} ${key}" + fi +} + +gnustep_set_default() { + if [[ -z $1 || -z $2 || -z $3 ]]; then + echo "warning: invalid script invocation" + return + fi + dom=$1 + key=$2 + val=$3 + echo " * setting ${dom} ${key}" + defaults write ${dom} ${key} ${val} +} + +EOF + + echo "echo \"Applying ${P} default configuration ...\"" >> "${T}"/${cfile} + + gnustep_config_script | \ + while read line ; do + echo "${line}" >> "${T}"/${cfile} + done + echo 'echo "done"' >> "${T}"/${cfile} + + exeinto ${GNUSTEP_SYSTEM_TOOLS#${EPREFIX}}/Gentoo + doexe "${T}"/${cfile} +} + +case ${EAPI:-0} in + 0|1) EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst ;; + 2) EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_compile src_install pkg_postinst ;; +esac diff --git a/sdk_container/src/third_party/portage-stable/eclass/go-mono.eclass b/sdk_container/src/third_party/portage-stable/eclass/go-mono.eclass new file mode 100644 index 0000000000..38ab829960 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/go-mono.eclass @@ -0,0 +1,132 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/go-mono.eclass,v 1.8 2010/01/03 19:10:49 scarabeus Exp $ + +# @ECLASS: go-mono.eclass +# @MAINTAINER: +# dotnet@gentoo.org +# @BLURB: Common functionality for go-mono.org apps +# @DESCRIPTION: +# Common functionality needed by all go-mono.org apps. + + +inherit base versionator mono + + +PRE_URI="http://mono.ximian.com/monobuild/preview/sources" + +SVN_PN="${PN/mono-debugger/debugger}" + +ESVN_STORE_DIR="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}/svn-src/mono" + +GO_MONO_SUB_BRANCH=${GO_MONO_SUB_BRANCH} + +if [[ "${PV%_rc*}" != "${PV}" ]] +then + GO_MONO_P="${P%_rc*}" + SRC_URI="${PRE_URI}/${PN}/${GO_MONO_P}.tar.bz2 -> ${P}.tar.bz2" + S="${WORKDIR}/${GO_MONO_P}" +elif [[ "${PV%_pre*}" != "${PV}" ]] +then + GO_MONO_P="${P%_pre*}" + SRC_URI="${PRE_URI}/${PN}/${GO_MONO_P}.tar.bz2 -> ${P}.tar.bz2" + S="${WORKDIR}/${GO_MONO_P}" +elif [[ "${PV}" == "9999" ]] +then + GO_MONO_P=${P} + ESVN_REPO_URI="svn://anonsvn.mono-project.com/source/trunk/${SVN_PN}" + SRC_URI="" + inherit autotools subversion +elif [[ "${PV%.9999}" != "${PV}" ]] +then + GO_MONO_P=${P} + ESVN_REPO_URI="svn://anonsvn.mono-project.com/source/branches/mono-$(get_version_component_range 1)-$(get_version_component_range 2)${GO_MONO_SUB_BRANCH}/${SVN_PN}" + SRC_URI="" + inherit autotools subversion +else + GO_MONO_P=${P} + SRC_URI="http://ftp.novell.com/pub/mono/sources/${PN}/${P}.tar.bz2" +fi + + +NO_MONO_DEPEND=( "dev-lang/mono" "dev-dotnet/libgdiplus" ) + +if [[ "$(get_version_component_range 3)" != "9999" ]] +then + GO_MONO_REL_PV="$(get_version_component_range 1-2)" + +else + GO_MONO_REL_PV="${PV}" +fi + +if ! has "${CATEGORY}/${PN}" "${NO_MONO_DEPEND[@]}" +then + RDEPEND="=dev-lang/mono-${GO_MONO_REL_PV}*" + DEPEND="${RDEPEND}" +fi + +DEPEND="${DEPEND} + >=dev-util/pkgconfig-0.23 + userland_GNU? ( >=sys-apps/findutils-4.4.0 )" + +# @FUNCTION: go-mono_src_unpack +# @DESCRIPTION: Runs default() +go-mono_src_unpack() { + if [[ "${PV%.9999}" != "${PV}" || "${PV}" == "9999" ]] + then + default + subversion_src_unpack + else + default + fi +} + +# @FUNCTION: go-mono_src_prepare +# @DESCRIPTION: Runs autopatch from base.eclass, if PATCHES is set. +go-mono_src_prepare() { + if [[ "${PV%.9999}" != "${PV}" || "${PV}" == "9999" ]] + then + base_src_prepare + [[ "$EAUTOBOOTSTRAP" != "no" ]] && eautoreconf + else + base_src_prepare + fi +} + +# @FUNCTION: go-mono_src_configure +# @DESCRIPTION: Runs econf, disabling static libraries and dependency-tracking. +go-mono_src_configure() { + econf --disable-dependency-tracking \ + --disable-static \ + "$@" +} + +# @FUNCTION: go-mono_src_configure +# @DESCRIPTION: Runs default() +go-mono_src_compile() { + emake "$@" || die "emake failed" +} + +# @ECLASS-VARIABLE: DOCS +# @DESCRIPTION: Insert path of docs you want installed. If more than one, +# consider using an array. + +# @FUNCTION: go-mono_src_install +# @DESCRIPTION: Rune emake, installs common doc files, if DOCS is +# set, installs those. Gets rid of .la files. +go-mono_src_install () { + emake -j1 DESTDIR="${D}" "$@" install || die "install failed" + mono_multilib_comply + local commondoc=( AUTHORS ChangeLog README TODO ) + for docfile in "${commondoc[@]}" + do + [[ -e "${docfile}" ]] && dodoc "${docfile}" + done + if [[ "${DOCS[@]}" ]] + then + dodoc "${DOCS[@]}" || die "dodoc DOCS failed" + fi + find "${D}" -name '*.la' -exec rm -rf '{}' '+' || die "la removal failed" +} + +EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install diff --git a/sdk_container/src/third_party/portage-stable/eclass/gpe.eclass b/sdk_container/src/third_party/portage-stable/eclass/gpe.eclass new file mode 100644 index 0000000000..b24ba7beb5 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/gpe.eclass @@ -0,0 +1,116 @@ +# Copyright 2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/gpe.eclass,v 1.2 2009/06/05 22:53:46 miknix Exp $ +# +# @ECLASS: gpe.eclass +# @MAINTAINER: +# +# Original Authors: +# Rene Wagner +# Ned Ludd +# Angelo Arrifano +# +# @BLURB: Provides common functionality for the G Palmtop Environment. +# @DESCRIPTION: Provides common functionality for the G Palmtop Environment. +# +# Thanks to: +# loki_val for EAPI->EAPI2 patch +# Betelgeuse for multiple suggestions. +# +# Based on: +# gnome2.eclass and gpe.bbclass (the latter from OpenEmbedded) + +inherit libtool toolchain-funcs + +case "${EAPI:-0}" in + 0|1) + EXPORT_FUNCTIONS src_unpack src_compile src_install + ;; + *) + EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install + ;; +esac + +# @ECLASS-VARIABLE: ELTCONF +# @DESCRIPTION: +# Extra options passed to elibtoolize on gnome2 eclass. +ELTCONF="" + +# @ECLASS-VARIABLE: GPE_DOCS +# @DESCRIPTION: +# Documentation files to be installed with dodoc. +GPE_DOCS="" + +[[ -z "${GPE_MIRROR}" ]] && GPE_MIRROR="http://gpe.linuxtogo.org/download/source" +[[ -z "${GPE_TARBALL_SUFFIX}" ]] && GPE_TARBALL_SUFFIX="gz" +SRC_URI="${GPE_MIRROR}/${P}.tar.${GPE_TARBALL_SUFFIX}" + +HOMEPAGE="http://gpe.linuxtogo.org" + +IUSE="nls" +GPECONF="${GPECONF} --enable-debug=no --disable-debug" + +RDEPEND="" +DEPEND=" + >=dev-util/intltool-0.29 + >=dev-util/pkgconfig-0.12.0" + +# @FUNCTION: gpe_src_unpack +# @DESCRIPTION: Unpacks and applies some required patches for GPE. +gpe_src_unpack() { + unpack ${A} + cd "${S}" + has "${EAPI:-0}" 0 1 && gpe_src_prepare "$@" +} + +# Do not call, use gpe_src_unpack() instead. +gpe_src_prepare() { + # let portage handle stripping. + # sort is needed, see #272161 . + for file in $(find . -name 'Makefile*' | sort) ; do + sed -i -e s/'install -s'/'install'/g \ + -e s/'install -Ds'/'install -D'/g \ + -e 's/$(INSTALL) -s/$(INSTALL) /g' \ + -e 's;strip ;#strip ;g' \ + ${file} \ + ||die "Sedding ${file} failed." + done + [[ -f configure ]] && elibtoolize +} + +# @FUNCTION: gpe_src_configure +# @DESCRIPTION: Configures a GPE package in a cross-compile aware environment. +gpe_src_configure() { + tc-export CC + [[ -f configure ]] && econf "$@" ${GPECONF} +} + +# @FUNCTION: gpe_src_compile +# @DESCRIPTION: (Cross-)Compiles a GPE package. +gpe_src_compile() { + tc-export CC + has "${EAPI:-0}" 0 1 && gpe_src_configure "$@" + emake PREFIX=/usr || die "emake failed" +} + +# @FUNCTION: gpe_src_install +# @DESCRIPTION: Installs a GPE package in the correct way. +gpe_src_install() { + local use_nls=yes + + use nls || use_nls=no + + if [ -f configure ]; then + einstall "$@" || die "einstall failed" + else + emake STRIP=true DESTDIR=${D} PREFIX=/usr \ + ENABLE_NLS=${use_nls} "$@" install || die "emake install failed" + fi + + use nls || rm -rf ${D}/usr/share/locale + + # manual document installation + if [[ "${GPE_DOCS}" ]]; then + dodoc ${GPE_DOCS} || die "dodoc failed" + fi +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/gst-plugins-bad.eclass b/sdk_container/src/third_party/portage-stable/eclass/gst-plugins-bad.eclass new file mode 100644 index 0000000000..4e95cc3e2c --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/gst-plugins-bad.eclass @@ -0,0 +1,121 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/gst-plugins-bad.eclass,v 1.24 2009/11/09 02:43:05 leio Exp $ + +# +# Original Author: Saleem Abdulrasool +# Based on the work of foser and zaheerm +# Purpose: This elcass is designed to help package external gst-plugins per +# plugin rather than in a single package. +# + +# This list is current to gst-plugins-bad-0.10.4 except for: +# gst_v4l2 - moved to gst-plugins-bad-0.10.5 (not in >=gst-plugins-bad-0.10.4) +# But it must stay in this list until all + +# gst-plugins eclass +# +# eclass to make external gst-plugins emergable on a per-plugin basis +# to solve the problem with gst-plugins generating far too much unneeded deps +# +# 3rd party applications using gstreamer now should depend on a set of plugins as +# defined in the source, in case of spider usage obtain recommended plugins to use from +# Gentoo developers responsible for gstreamer , the application developer +# or the gstreamer team. + +inherit eutils gst-plugins10 + + +### +# variable declarations +### + +MY_PN=gst-plugins-base +MY_P=${MY_PN}-${PV} +# All relevant configure options for gst-plugins +# need a better way to extract these +# gst-plugins-base 0.9 +my_gst_plugins_base="x xvideo xshm gst_v4l alsa cdparanoia gnome_vfs +gio libvisual ogg oggtest theora vorbis vorbistest examples freetypetest pango" + +#SRC_URI="mirror://gnome/sources/gst-plugins/${PV_MAJ_MIN}/${MY_P}.tar.bz2" +SRC_URI="http://gstreamer.freedesktop.org/src/gst-plugins-base/${MY_P}.tar.bz2" + +S=${WORKDIR}/${MY_P} + +# added to remove circular deps +# 6/2/2006 - zaheerm +if [ "${PN}" != "${MY_PN}" ]; then +RDEPEND=">=media-libs/gst-plugins-base-${PV}" +DEPEND="${RDEPEND} + ~media-libs/gst-plugins-base-${PV} + >=sys-apps/sed-4 + dev-util/pkgconfig" +RESTRICT=test +fi + +### +# public functions +### + +gst-plugins-base_src_configure() { + + # disable any external plugin besides the plugin we want + local plugin gst_conf + + einfo "Configuring to build ${GST_PLUGINS_BUILD} plugin(s) ..." + + for plugin in ${GST_PLUGINS_BUILD}; do + my_gst_plugins_base=${my_gst_plugins_base/${plugin}/} + done + for plugin in ${my_gst_plugins_base}; do + gst_conf="${gst_conf} --disable-${plugin} " + done + for plugin in ${GST_PLUGINS_BUILD}; do + gst_conf="${gst_conf} --enable-${plugin} " + done + + cd ${S} + econf ${@} --with-package-name="Gentoo GStreamer Ebuild" --with-package-origin="http://www.gentoo.org" ${gst_conf} || die "./configure failure" + +} + +### +# public inheritable functions +### + +gst-plugins-base_src_unpack() { + +# local makefiles + + unpack ${A} + + # Link with the syswide installed gst-libs if needed + gst-plugins10_find_plugin_dir + sed -e "s:\$(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces:${ROOT}/usr/$(get_libdir)/libgstinterfaces:" \ + -e "s:\${top_builddir}/gst-libs/gst/interfaces/libgstinterfaces:${ROOT}/usr/$(get_libdir)/libgstinterfaces:" \ + -e "s:\$(top_builddir)/gst-libs/gst/audio/libgstaudio:${ROOT}/usr/$(get_libdir)/libgstaudio:" \ + -e "s:\${top_builddir}/gst-libs/gst/audio/libgstaudio:${ROOT}/usr/$(get_libdir)/libgstaudio:" \ + -e "s:\$(top_builddir)/gst-libs/gst/cdda/libgstcdda:${ROOT}/usr/$(get_libdir)/libgstcdda:" \ + -e "s:\${top_builddir}/gst-libs/gst/cdda/libgstcdda:${ROOT}/usr/$(get_libdir)/libgstcdda:" \ + -e "s:\$(top_builddir)/gst-libs/gst/riff/libgstriff:${ROOT}/usr/$(get_libdir)/libgstriff:" \ + -e "s:\${top_builddir}/gst-libs/gst/riff/libgstriff:${ROOT}/usr/$(get_libdir)/libgstriff:" \ + -e "s:\$(top_builddir)/gst-libs/gst/tag/libgsttag:${ROOT}/usr/$(get_libdir)/libgsttag:" \ + -e "s:\${top_builddir}/gst-libs/gst/tag/libgsttag:${ROOT}/usr/$(get_libdir)/libgsttag:" \ + -e "s:\$(top_builddir)/gst-libs/gst/video/libgstvideo:${ROOT}/usr/$(get_libdir)/libgstvideo:" \ + -e "s:\${top_builddir}/gst-libs/gst/video/libgstvideo:${ROOT}/usr/$(get_libdir)/libgstvideo:" \ + -e "s:\$(top_builddir)/gst-libs/gst/netbuffer/libgstnetbuffer:${ROOT}/usr/$(get_libdir)/libgstnetbuffer:" \ + -e "s:\${top_builddir}/gst-libs/gst/netbuffer/libgstnetbuffer:${ROOT}/usr/$(get_libdir)/libgstnetbuffer:" \ + -e "s:\$(top_builddir)/gst-libs/gst/rtp/libgstrtp:${ROOT}/usr/$(get_libdir)/libgstrtp:" \ + -e "s:\${top_builddir}/gst-libs/gst/rtp/libgstrtp:${ROOT}/usr/$(get_libdir)/libgstrtp:" \ + -i Makefile.in +# cd ${S} + + # Remove generation of any other Makefiles except the plugin's Makefile +# if [ -d "${S}/sys/${GST_PLUGINS_BUILD_DIR}" ]; then +# makefiles="Makefile sys/Makefile sys/${GST_PLUGINS_BUILD_DIR}/Makefile" +# elif [ -d "${S}/ext/${GST_PLUGINS_BUILD_DIR}" ]; then +# makefiles="Makefile ext/Makefile ext/${GST_PLUGINS_BUILD_DIR}/Makefile" +# fi +# sed -e "s:ac_config_files=.*:ac_config_files='${makefiles}':" \ +# -i ${S}/configure + +} + +gst-plugins-base_src_compile() { + + gst-plugins-base_src_configure ${@} + + gst-plugins10_find_plugin_dir + emake || die "compile failure" + +} + +gst-plugins-base_src_install() { + + gst-plugins10_find_plugin_dir + einstall || die + + [[ -e README ]] && dodoc README +} + + +EXPORT_FUNCTIONS src_unpack src_compile src_install diff --git a/sdk_container/src/third_party/portage-stable/eclass/gst-plugins-good.eclass b/sdk_container/src/third_party/portage-stable/eclass/gst-plugins-good.eclass new file mode 100644 index 0000000000..e8183e7f85 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/gst-plugins-good.eclass @@ -0,0 +1,117 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/gst-plugins-good.eclass,v 1.18 2009/05/16 22:08:09 tester Exp $ + +# Author : foser , zaheerm + +# gst-plugins-good eclass +# +# eclass to make external gst-plugins emergable on a per-plugin basis +# to solve the problem with gst-plugins generating far too much unneeded deps +# +# 3rd party applications using gstreamer now should depend on a set of plugins as +# defined in the source, obtain recommended plugins to use from +# Gentoo developers responsible for gstreamer , the application developer +# or the gstreamer team. + +inherit eutils gst-plugins10 + + +### +# variable declarations +### + +MY_PN=gst-plugins-good +MY_P=${MY_PN}-${PV} +# All relevant configure options for gst-plugins +# need a better way to extract these +# gst-plugins-base 0.9 + +# This list is current to gst-plugins-good-0.10.6 +my_gst_plugins_good="gconf gconftool oss aalib aalibtest cairo cdio esd esdtest +flac jpeg ladspa libcaca libdv libpng dv1394 shout2 shout2test speex annodex hal +x taglib gdk_pixbuf gst_v4l2 sunaudio xshm xvideo zlib wavpack soup pulse bz2" + +#SRC_URI="mirror://gnome/sources/gst-plugins/${PV_MAJ_MIN}/${MY_P}.tar.bz2" +SRC_URI="http://gstreamer.freedesktop.org/src/gst-plugins-good/${MY_P}.tar.bz2" + +S=${WORKDIR}/${MY_P} +# added to remove circular deps +# 6/2/2006 - zaheerm +if [ "${PN}" != "${MY_PN}" ]; then +RDEPEND="=media-libs/gst-plugins-base-0.10*" +DEPEND="${RDEPEND} + >=sys-apps/sed-4 + dev-util/pkgconfig" +RESTRICT=test +fi + +### +# public functions +### + +gst-plugins-good_src_configure() { + + # disable any external plugin besides the plugin we want + local plugin gst_conf + + einfo "Configuring to build ${GST_PLUGINS_BUILD} plugin(s) ..." + + for plugin in ${GST_PLUGINS_BUILD}; do + my_gst_plugins_good=${my_gst_plugins_good/${plugin}/} + done + for plugin in ${my_gst_plugins_good}; do + gst_conf="${gst_conf} --disable-${plugin} " + done + for plugin in ${GST_PLUGINS_BUILD}; do + gst_conf="${gst_conf} --enable-${plugin} " + done + + cd ${S} + econf ${@} --with-package-name="Gentoo GStreamer Ebuild" --with-package-origin="http://www.gentoo.org" ${gst_conf} || die "./configure failure" + +} + +### +# public inheritable functions +### + +gst-plugins-good_src_unpack() { + +# local makefiles + + unpack ${A} + + # Link with the syswide installed gst-libs if needed +# gst-plugins10_find_plugin_dir +# cd ${S} + + # Remove generation of any other Makefiles except the plugin's Makefile +# if [ -d "${S}/sys/${GST_PLUGINS_BUILD_DIR}" ]; then +# makefiles="Makefile sys/Makefile sys/${GST_PLUGINS_BUILD_DIR}/Makefile" +# elif [ -d "${S}/ext/${GST_PLUGINS_BUILD_DIR}" ]; then +# makefiles="Makefile ext/Makefile ext/${GST_PLUGINS_BUILD_DIR}/Makefile" +# fi +# sed -e "s:ac_config_files=.*:ac_config_files='${makefiles}':" \ +# -i ${S}/configure + +} + +gst-plugins-good_src_compile() { + + gst-plugins-good_src_configure ${@} + + gst-plugins10_find_plugin_dir + emake || die "compile failure" + +} + +gst-plugins-good_src_install() { + + gst-plugins10_find_plugin_dir + einstall || die + + [[ -e README ]] && dodoc README +} + +EXPORT_FUNCTIONS src_unpack src_compile src_install diff --git a/sdk_container/src/third_party/portage-stable/eclass/gst-plugins-ugly.eclass b/sdk_container/src/third_party/portage-stable/eclass/gst-plugins-ugly.eclass new file mode 100644 index 0000000000..d153f21111 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/gst-plugins-ugly.eclass @@ -0,0 +1,116 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/gst-plugins-ugly.eclass,v 1.17 2009/11/16 06:04:12 leio Exp $ + +# Author : foser + +# gst-plugins-ugly eclass +# +# eclass to make external gst-plugins emergable on a per-plugin basis +# to solve the problem with gst-plugins generating far too much unneeded deps +# +# 3rd party applications using gstreamer now should depend on a set of plugins as +# defined in the source, in case of spider usage obtain recommended plugins to use from +# Gentoo developers responsible for gstreamer , the application developer +# or the gstreamer team. + +inherit eutils gst-plugins10 + + +### +# variable declarations +### + +MY_PN=gst-plugins-ugly +MY_P=${MY_PN}-${PV} +# All relevant configure options for gst-plugins-ugly +# need a better way to extract these. +# Not necessary since -ugly-0.10.13: id3tag dvdnav +my_gst_plugins_ugly="a52dec amrnb amrwb cdio dvdread dvdnav lame id3tag mad +mpeg2dec sidplay twolame x264" + +#SRC_URI="mirror://gnome/sources/gst-plugins/${PV_MAJ_MIN}/${MY_P}.tar.bz2" +SRC_URI="http://gstreamer.freedesktop.org/src/gst-plugins-ugly/${MY_P}.tar.bz2" + +S=${WORKDIR}/${MY_P} + +# added to remove circular deps +# 6/2/2006 - zaheerm +if [ "${PN}" != "${MY_PN}" ]; then +RDEPEND="=media-libs/gst-plugins-base-0.10*" +DEPEND="${RDEPEND} + >=sys-apps/sed-4 + dev-util/pkgconfig" +RESTRICT=test +fi + +### +# public functions +### + +gst-plugins-ugly_src_configure() { + + # disable any external plugin besides the plugin we want + local plugin gst_conf + + einfo "Configuring to build ${GST_PLUGINS_BUILD} plugin(s) ..." + + for plugin in ${GST_PLUGINS_BUILD}; do + my_gst_plugins_ugly=${my_gst_plugins_ugly/${plugin}/} + done + for plugin in ${my_gst_plugins_ugly}; do + gst_conf="${gst_conf} --disable-${plugin} " + done + for plugin in ${GST_PLUGINS_BUILD}; do + gst_conf="${gst_conf} --enable-${plugin} " + done + + cd ${S} + econf ${@} --with-package-name="Gentoo GStreamer Ebuild" --with-package-origin="http://www.gentoo.org" ${gst_conf} || die "./configure failure" + +} + +### +# public inheritable functions +### + +gst-plugins-ugly_src_unpack() { + +# local makefiles + + unpack ${A} + + # Link with the syswide installed gst-libs if needed +# gst-plugins10_find_plugin_dir +# cd ${S} + + # Remove generation of any other Makefiles except the plugin's Makefile +# if [ -d "${S}/sys/${GST_PLUGINS_BUILD_DIR}" ]; then +# makefiles="Makefile sys/Makefile sys/${GST_PLUGINS_BUILD_DIR}/Makefile" +# elif [ -d "${S}/ext/${GST_PLUGINS_BUILD_DIR}" ]; then +# makefiles="Makefile ext/Makefile ext/${GST_PLUGINS_BUILD_DIR}/Makefile" +# fi +# sed -e "s:ac_config_files=.*:ac_config_files='${makefiles}':" \ +# -i ${S}/configure + +} + +gst-plugins-ugly_src_compile() { + + gst-plugins-ugly_src_configure ${@} + + gst-plugins10_find_plugin_dir + emake || die "compile failure" + +} + +gst-plugins-ugly_src_install() { + + gst-plugins10_find_plugin_dir + einstall || die + + [[ -e README ]] && dodoc README +} + + +EXPORT_FUNCTIONS src_unpack src_compile src_install diff --git a/sdk_container/src/third_party/portage-stable/eclass/gst-plugins.eclass b/sdk_container/src/third_party/portage-stable/eclass/gst-plugins.eclass new file mode 100644 index 0000000000..ff9285ad1c --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/gst-plugins.eclass @@ -0,0 +1,17 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/gst-plugins.eclass,v 1.35 2009/11/30 04:19:36 abcd Exp $ + +# @DEAD +# To be removed on 2011/11/30. +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" + +PVP=(${PV//[-\._]/ }) +PV_MAJ_MIN=${PVP[0]}.${PVP[1]} +SLOT=${PV_MAJ_MIN} + +gst-plugins_pkg_postrm() { + gst-register-${SLOT} +} + +EXPORT_FUNCTIONS pkg_postrm diff --git a/sdk_container/src/third_party/portage-stable/eclass/gst-plugins10.eclass b/sdk_container/src/third_party/portage-stable/eclass/gst-plugins10.eclass new file mode 100644 index 0000000000..d82970ca25 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/gst-plugins10.eclass @@ -0,0 +1,81 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/gst-plugins10.eclass,v 1.2 2006/01/01 01:14:59 swegener Exp $ + +# Author : foser + +# gst-plugins eclass +# +# eclass to make external gst-plugins emergable on a per-plugin basis +# to solve the problem with gst-plugins generating far too much unneeded deps +# +# 3rd party applications using gstreamer now should depend on a set of plugins as +# defined in the source, in case of spider usage obtain recommended plugins to use from +# Gentoo developers responsible for gstreamer , the application developer +# or the gstreamer team. + +inherit eutils + + +### +# variable declarations +### + +# Create a major/minor combo for our SLOT and executables suffix +PVP=(${PV//[-\._]/ }) +#PV_MAJ_MIN=${PVP[0]}.${PVP[1]} +PV_MAJ_MIN=0.10 + +# Extract the plugin to build from the ebuild name +# May be set by an ebuild and contain more than one indentifier, space seperated +# (only src_configure can handle mutiple plugins at this time) +GST_PLUGINS_BUILD=${PN/gst-plugins-/} + +# Actual build dir, is the same as the configure switch name most of the time +GST_PLUGINS_BUILD_DIR=${PN/gst-plugins-/} + +# general common gst-plugins ebuild entries +DESCRIPTION="${BUILD_GST_PLUGINS} plugin for gstreamer" +HOMEPAGE="http://gstreamer.freedesktop.org/" +LICENSE="GPL-2" + +#SRC_URI="mirror://gnome/sources/gst-plugins/${PV_MAJ_MIN}/${MY_P}.tar.bz2" +SLOT=${PV_MAJ_MIN} +### +# internal functions +### + +gst-plugins10_find_plugin_dir() { + + if [ ! -d ${S}/ext/${GST_PLUGINS_BUILD_DIR} ]; then + if [ ! -d ${S}/sys/${GST_PLUGINS_BUILD_DIR} ]; then + ewarn "No such plugin directory" + die + fi + einfo "Building system plugin ..." + cd ${S}/sys/${GST_PLUGINS_BUILD_DIR} + else + einfo "Building external plugin ..." + cd ${S}/ext/${GST_PLUGINS_BUILD_DIR} + fi + +} + +### +# public functions +### + +gst-plugins10_remove_unversioned_binaries() { + + # remove the unversioned binaries gstreamer provide + # this is to prevent these binaries to be owned by several SLOTs + + cd ${D}/usr/bin + for gst_bins in `ls *-${PV_MAJ_MIN}` + do + rm ${gst_bins/-${PV_MAJ_MIN}/} + einfo "Removed ${gst_bins/-${PV_MAJ_MIN}/}" + done + +} + diff --git a/sdk_container/src/third_party/portage-stable/eclass/gtk-sharp-component.eclass b/sdk_container/src/third_party/portage-stable/eclass/gtk-sharp-component.eclass new file mode 100644 index 0000000000..af55cd6eb6 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/gtk-sharp-component.eclass @@ -0,0 +1,7 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/gtk-sharp-component.eclass,v 1.31 2009/11/30 04:19:36 abcd Exp $ + +# @DEAD +# To be removed 2011/11/30. +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" diff --git a/sdk_container/src/third_party/portage-stable/eclass/gtk-sharp-module.eclass b/sdk_container/src/third_party/portage-stable/eclass/gtk-sharp-module.eclass new file mode 100644 index 0000000000..d0a3650804 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/gtk-sharp-module.eclass @@ -0,0 +1,534 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/gtk-sharp-module.eclass,v 1.26 2010/01/03 19:10:49 scarabeus Exp $ + +# @ECLASS: gtk-sharp-module.eclass +# @MAINTAINER: +# dotnet@gentoo.org +# @BLURB: Manages the modules of the gtk-, gnome-, and gnome-desktop-sharp tarballs +# @DESCRIPTION: +# This eclass provides phase functions and helper functions for the modules +# of the gtk-sharp, gnome-sharp and gnome-desktop-sharp tarballs. +# PLEASE TAKE NOTE: ONLY FOR EAPI-2 EBUILDS + +WANT_AUTOMAKE=none +WANT_AUTOCONF=none + +inherit eutils mono multilib libtool autotools base versionator + +# @ECLASS-VARIABLE: GTK_SHARP_MODULE +# @DESCRIPTION: +# The name of the Gtk# module. +# Default value: ${PN/-sharp/} +GTK_SHARP_MODULE=${GTK_SHARP_MODULE:=${PN/-sharp/}} + +# @ECLASS-VARIABLE: GTK_SHARP_MODULE_DIR +# @DESCRIPTION: +# The subdirectory of S in which GTK_SHARP_MODULE is installed. +# Default value: ${PN/-sharp/} +GTK_SHARP_MODULE_DIR=${GTK_SHARP_MODULE_DIR:=${PN/-sharp/}} + +# @ECLASS-VARIABLE: GTK_SHARP_REQUIRED_VERSION +# @DESCRIPTION: +# The version of the gtk-sharp tarball this package requires. +# Optional. +GTK_SHARP_REQUIRED_VERSION="${GTK_SHARP_REQUIRED_VERSION}" + +# @ECLASS-VARIABLE: gapi_users_list +# @DESCRIPTION: +# List of modules that use one of gapi2-codegen, gapi2-fixup or gapi2-parser +# No ebuild-serviceable parts inside. +gapi_users_list="art gnome gnomevfs ${gnome_desktop_sharp_module_list} atk gtk gdk glade pango" + +# @ECLASS-VARIABLE: PV_MAJOR +# @DESCRIPTION: +# The first two components of the PV variable. +PV_MAJOR=$(get_version_component_range 1-2) + +# @FUNCTION: add_bdepend +# @USAGE: +# @DESCRIPTION: +# Adds to the DEPEND variable +add_bdepend() { + [[ ${#@} -eq 1 ]] || die "${FUNCNAME} needs ONE (1) argument" + DEPEND="${DEPEND} $@" +} + +# @FUNCTION: add_rdepend +# @USAGE: +# @DESCRIPTION: +# Adds to the RDEPEND variable +add_rdepend() { + [[ ${#@} -eq 1 ]] || die "${FUNCNAME} needs ONE (1) argument" + RDEPEND="${RDEPEND} $@" +} + +# @FUNCTION: add_depend +# @USAGE: +# @DESCRIPTION: +# Adds to the DEPEND and RDEPEND variables +add_depend() { + [[ ${#@} -eq 1 ]] || die "${FUNCNAME} needs ONE (1) argument" + DEPEND="${DEPEND} $@" + RDEPEND="${RDEPEND} $@" +} + +# @ECLASS-VARIABLE: TARBALL +# @DESCRIPTION: +# The GtkSharp modules are currently divided into three seperate tarball +# distributions. The TARBALL variable holds the name of the tarball +# to which GTK_SHARP_MODULE belongs. +case ${GTK_SHARP_MODULE} in + glib|glade|gtk|gdk|atk|pango|gtk-dotnet|gtk-gapi|gtk-docs) + TARBALL="gtk-sharp" + case ${PVR} in + 2.12.*) + SRC_URI="mirror://gentoo/${TARBALL}-2.12.7.patch.bz2" + #Upstream: https://bugzilla.novell.com/show_bug.cgi?id=$bugno + #Upstream bug #470390 for the gtk-sharp-2.12.7.patch + PATCHES=( + "${WORKDIR}/${TARBALL}-2.12.7.patch" + ) + EAUTORECONF="YES" + add_bdepend "=sys-devel/automake-1.10*" + add_bdepend ">=sys-devel/autoconf-2.61" + ;; + esac + ;; + art|gnome|gnomevfs|gconf) + TARBALL="gnome-sharp" + add_depend "=dev-dotnet/gtk-sharp-${GTK_SHARP_REQUIRED_VERSION}*" + has "${GTK_SHARP_MODULE}" "${gapi_users_list}" && \ + add_bdepend "=dev-dotnet/gtk-sharp-gapi-${GTK_SHARP_REQUIRED_VERSION}*" + case ${PVR} in + 2.24.1*) + SRC_URI="mirror://gentoo/${TARBALL}-2.24.1.patch.bz2" + # Upstream bug: https://bugzilla.novell.com/show_bug.cgi?id=483251 + PATCHES=( + "${WORKDIR}/${TARBALL}-2.24.1.patch" + ) + EAUTORECONF="YES" + add_bdepend "=sys-devel/automake-1.10*" + add_bdepend ">=sys-devel/autoconf-2.61" + ;; + esac + ;; + gnome-desktop|gnome-print|gnome-panel|gtkhtml|gtksourceview|nautilusburn|rsvg|vte|wnck) + TARBALL="gnome-desktop-sharp" + add_depend "=dev-dotnet/gtk-sharp-${GTK_SHARP_REQUIRED_VERSION}*" + add_depend "=dev-dotnet/gnome-sharp-2.24*" + add_bdepend "=dev-dotnet/gtk-sharp-gapi-${GTK_SHARP_REQUIRED_VERSION}*" + ;; + *) + eerror "Huh? Sonny boy, looks like your GTK_SHARP_MODULE is not on the approved list. BAILING!" + die "How did we get here!!?" + ;; +esac + +case ${PF} in + #gtk-sharp tarball + gtk-sharp-docs*) + add_depend ">=virtual/monodoc-2.0" + ;; + gtk-sharp-gapi*) + add_rdepend "!<=dev-dotnet/gtk-sharp-2.12.7:2" + add_depend "dev-perl/XML-LibXML" + ;; + gtk-sharp-*) + add_bdepend "~dev-dotnet/gtk-sharp-gapi-${PV}" + add_depend "~dev-dotnet/glib-sharp-${PV}" + add_depend "~dev-dotnet/atk-sharp-${PV}" + add_depend "~dev-dotnet/gdk-sharp-${PV}" + add_depend "~dev-dotnet/pango-sharp-${PV}" + ;; + gdk-sharp-*) + add_bdepend "~dev-dotnet/gtk-sharp-gapi-${PV}" + add_depend "~dev-dotnet/glib-sharp-${PV}" + add_depend "x11-libs/gtk+:2" + add_depend "~dev-dotnet/pango-sharp-${PV}" + add_rdepend "!<=dev-dotnet/gtk-sharp-2.12.7:2" + ;; + atk-sharp-*) + add_bdepend "~dev-dotnet/gtk-sharp-gapi-${PV}" + add_depend "~dev-dotnet/glib-sharp-${PV}" + add_depend "dev-libs/atk" + add_rdepend "!<=dev-dotnet/gtk-sharp-2.12.7:2" + ;; + glib-sharp-*) + add_rdepend "!<=dev-dotnet/gtk-sharp-2.12.7:2" + add_depend "dev-libs/glib:2" + ;; + pango-sharp-*) + add_bdepend "~dev-dotnet/gtk-sharp-gapi-${PV}" + add_depend "~dev-dotnet/glib-sharp-${PV}" + add_depend "x11-libs/pango" + add_rdepend "!<=dev-dotnet/gtk-sharp-2.12.7:2" + ;; + gtk-dotnet-*) + add_depend "~dev-dotnet/glib-sharp-${PV}" + add_depend "~dev-dotnet/gdk-sharp-${PV}" + add_depend "~dev-dotnet/pango-sharp-${PV}" + add_depend "~dev-dotnet/gtk-sharp-${PV}" + add_depend "dev-lang/mono[-minimal]" + add_rdepend "!<=dev-dotnet/gtk-sharp-2.12.7:2" + ;; + glade-sharp-*) + add_bdepend "~dev-dotnet/gtk-sharp-gapi-${PV}" + add_depend "~dev-dotnet/glib-sharp-${PV}" + add_depend "~dev-dotnet/atk-sharp-${PV}" + add_depend "~dev-dotnet/gdk-sharp-${PV}" + add_depend "~dev-dotnet/gtk-sharp-${PV}" + add_depend "~dev-dotnet/pango-sharp-${PV}" + add_depend ">=gnome-base/libglade-2.3.6" + ;; + #gnome-sharp tarball + art-sharp-*) + add_depend ">=media-libs/libart_lgpl-2.3.20" + ;; + gnome-sharp-*) + add_depend ">=gnome-base/libgnomeui-${PV_MAJOR}" + add_depend "~dev-dotnet/gnomevfs-sharp-${PV}" + add_depend "~dev-dotnet/art-sharp-${PV}" + add_depend ">=gnome-base/libgnomecanvas-${GNOMECANVAS_REQUIRED_VERSION}" + add_depend ">=x11-libs/gtk+-2.14.0" + ;; + gconf-sharp-*) + add_depend ">=gnome-base/gconf-${PV_MAJOR}" + add_depend "=dev-dotnet/glade-sharp-${GTK_SHARP_REQUIRED_VERSION}*" + add_depend "~dev-dotnet/gnome-sharp-${PV}" + add_depend "~dev-dotnet/art-sharp-${PV}" + ;; + gnomevfs-sharp-*) + add_depend ">=gnome-base/gnome-vfs-${PV_MAJOR}" + ;; + #gnome-desktop-sharp tarball + gnome-desktop-sharp-*) + # NOTE: libgnome-desktop-2.so has been known to make binary- + # incompatible changes, requiring .so bumps. gnome-desktop-sharp + # is locked to a specific .so.n version, so strict dependencies + # may be required in the future (as it has in the past). + add_depend ">=gnome-base/gnome-desktop-${PV_MAJOR}" + ;; + gnome-panel-sharp-*) + add_depend ">=gnome-base/gnome-panel-${PV_MAJOR}" + ;; + gnome-print-sharp-*) + add_depend ">=gnome-base/libgnomeprint-${API_VERSION}" + ;; + gtkhtml-sharp-*) + #NOTE: gtkhtml dependency must follow gtkhtml-sharp version. + #i.e. gtkhtml-sharp-2.24.0 >=gtkhtml-3.24 + # gtkhtml-sharp-2.16.0 >=gtkhtml-3.16 + # See bug 249540 for unpleasant side effects. + add_depend ">=gnome-extra/gtkhtml-$(($(get_version_component_range 1) + 1 )).$(get_version_component_range 2)" + ;; + gtksourceview-sharp-*) + add_depend ">=x11-libs/gtksourceview-${GTKSOURCEVIEW_REQUIRED_VERSION}:2.0" + ;; + nautilusburn-sharp-*) + add_depend ">=gnome-extra/nautilus-cd-burner-2.24.0" + ;; + rsvg-sharp-*) + add_depend ">=gnome-base/librsvg-${RSVG_REQUIRED_VERSION}" + ;; + vte-sharp-*) + add_depend ">=x11-libs/vte-${VTE_REQUIRED_VERSION}" + ;; + wnck-sharp-*) + add_depend ">=x11-libs/libwnck-${PV_MAJOR}" + ;; +esac + +# @ECLASS-VARIABLE: DESCRIPTION +# @DESCRIPTION: +# Default value: GtkSharp's ${GTK_SHARP_MODULE} module of the ${TARBALL} tarball +DESCRIPTION="GtkSharp's ${GTK_SHARP_MODULE} module of the ${TARBALL} tarball" +# @ECLASS-VARIABLE: HOMEPAGE +# @DESCRIPTION: +# Default value: http://www.mono-project.com/GtkSharp +HOMEPAGE="http://www.mono-project.com/GtkSharp" +# @ECLASS-VARIABLE: DESCRIPTION +# @DESCRIPTION: +# Default value: LGPL-2.1 +LICENSE="LGPL-2.1" + +add_depend ">=dev-lang/mono-2.0.1" +add_bdepend ">=sys-apps/sed-4" +add_bdepend ">=dev-util/pkgconfig-0.23" +add_bdepend ">=app-shells/bash-3.1" + +IUSE="debug" +# @ECLASS-VARIABLE: S +# @DESCRIPTION: +# Default value: ${WORKDIR}/${TARBALL}-${PV} +S="${WORKDIR}/${TARBALL}-${PV}" +# @ECLASS-VARIABLE: SRC_URI +# @DESCRIPTION: +# Default value: mirror://gnome/sources/${TARBALL}/${PV_MAJOR}/${TARBALL}-${PV}.tar.bz2 +SRC_URI="${SRC_URI} + mirror://gnome/sources/${TARBALL}/${PV_MAJOR}/${TARBALL}-${PV}.tar.bz2" + +# @FUNCTION: get_sharp_apis +# @USAGE: +# @RETURN: .NET API files +# @DESCRIPTION: +# Given a valid pkg-config package, will return a list of API xml files. +# can be either --prefixed or --bare. If prefixed, each API file +# will be prefixed with -I: +get_sharp_apis() { + [[ ${#@} -eq 2 ]] || die "${FUNCNAME} needs two arguments" + get_sharp_assemblies "$@" +} + +# @FUNCTION: get_sharp_assemblies +# @USAGE: +# @RETURN: .NET .dll assemblies +# @DESCRIPTION: +# Given a valid pkg-config package, will return a list of .dll assemblies. +# can be either --prefixed or --bare. If prefixed, each .dll file +# will be prefixed with -r: +get_sharp_assemblies() { + [[ ${#@} -eq 2 ]] || die "${FUNCNAME} needs two arguments" + local string config=libs prefix="-r:" + local -a rvalue + [[ "${FUNCNAME[1]}" = "get_sharp_apis" ]] && config=cflags && prefix="-I:" + for string in $(pkg-config --${config} ${2} 2> /dev/null) + do + rvalue+=( ${string#-?:} ) + done + + case $1 in + --bare) + : + ;; + --prefixed) + for (( i=0 ; i< ${#rvalue[@]} ; i++ )) + do + rvalue[$i]=${prefix}${rvalue[$i]} + done + ;; + *) + die "${FUNCNAME}: Unknown parameter" + ;; + esac + echo "${rvalue[@]}" +} + +# @FUNCTION: phase_hook +# @USAGE: +# Looks for functions named _caller_suffix and executes them. +# _caller_suffix is the calling function with the prefix +# gtk-sharp-module removed. +phase_hook() { + [[ ${#@} -eq 1 ]] || die "${FUNCNAME} needs one argument" + if [[ "$(type -t ${1}${FUNCNAME[1]#gtk-sharp-module})" = "function" ]] + then + ebegin "Phase-hook: Running ${1}${FUNCNAME[1]#gtk-sharp-module}" + ${1}${FUNCNAME[1]#gtk-sharp-module} + eend 0 + fi +} + +# @FUNCTION: ac_path_prog_override +# @USAGE: [path] +# @DESCRIPTION: +# Override AC_PATH_PROG() autoconf macros. Path will be set to " " if +# not specified. +ac_path_prog_override() { + if [[ ${#@} -lt 1 || ${#@} -gt 2 ]] + then + eerror "${FUNCNAME[0]} requires at least one parameter and takes at most two:" + eerror "AC_PATH_PROG(PARAM1, param2)" + die "${FUNCNAME[0]} requires at least one parameter and takes at most two:" + fi + export ac_cv_path_${1}="${2:- }" +} + + +# @FUNCTION: pkg_check_modules_override +# @USAGE: [package1] [package2] +# @DESCRIPTION: +# Will export the appropriate variables to override PKG_CHECK_MODULES autoconf +# macros, with the string " " by default. If packages are specified, they will +# be looked up with pkg-config and the appropriate LIBS and CFLAGS substituted. +# LIBS and CFLAGS can also be specified per-package with the following syntax: +# @CODE +# package=LIBS%CFLAGS +# @CODE +# = and % have no effect unless both are specified. +# Here is an example: +# @CODE +# pkg_check_modules_override GASH "gtk+-2.0=-jule%" gobject-2.0 +# @CODE +# The above example will do: +# export GASH_CFLAGS+=" -jule" +# export GASH_LIBS+=" " +# export GASH_CFLAGS+=" $(pkg-config --cflags gobject-2.0)" +# export GASH_LIBS+=" $(pkg-config --libs gobject-2.0)" +# +# NOTE: If a package is not found, the string " " will be inserted in place of +# _CFLAGS and _LIBS +pkg_check_modules_override() { + local package + local group="${1}" + local packages="${*:2}" + export ${group}_CFLAGS=" " + export ${group}_LIBS=" " + + if [[ ${#@} -lt 1 ]] + then + eerror "${FUNCNAME[0]} requires at least one parameter: GROUP" + eerror "PKG_CHECK_MODULES(GROUP, package1 package2 etc)" + die "${FUNCNAME[0]} requires at least one parameter: GROUP" + fi + + for package in $packages + do + if [[ ${package/=} != ${package} && ${package/\%} != ${package} ]] + then + package_cflag_libs=${package##*=} + export ${group}_CFLAGS+=" ${package_cflag_libs%%\%*}" + export ${group}_LIBS+=" ${package_cflag_libs##*\%}" + else + if pkg-config --exists $package + then + export ${group}_CFLAGS+=" $(pkg-config --cflags $package)" + export ${group}_LIBS+=" $(pkg-config --libs $package)" + else + export ${group}_CFLAGS+=" " + export ${group}_LIBS+=" " + fi + fi + done +} + +# @FUNCTION: gtk-sharp-tarball-post_src_prepare +# @DESCRIPTION: +# Runs a M-m-m-monster sed on GTK_SHARP_MODULE_DIR to convert references to +# local assemblies to the installed ones. Is only called by src_prepare when +# $GTK_SHARP_MODULE is a member of $gtk_sharp_module_list. +gtk-sharp-tarball-post_src_prepare() { + cd "${S}/${GTK_SHARP_MODULE_DIR}" + sed -i \ + -e "s; \$(srcdir)/../glib/glib-api.xml; $(get_sharp_apis --bare glib-sharp-2.0);" \ + -e "s; ../pango/pango-api.xml; $(get_sharp_apis --bare pango-sharp-2.0);" \ + -e "s; ../atk/atk-api.xml; $(get_sharp_apis --bare atk-sharp-2.0);" \ + -e "s; ../gdk/gdk-api.xml; $(get_sharp_apis --bare gdk-sharp-2.0);" \ + -e "s; ../gtk/gtk-api.xml; $(get_sharp_apis --bare gtk-sharp-2.0);" \ + -e "s; \.\./glib/glib-sharp.dll; $(get_sharp_assemblies --bare glib-sharp-2.0);g" \ + -e "s; \.\./pango/pango-sharp.dll; $(get_sharp_assemblies --bare pango-sharp-2.0);g" \ + -e "s; \.\./atk/atk-sharp.dll; $(get_sharp_assemblies --bare atk-sharp-2.0);g" \ + -e "s; \.\./gdk/gdk-sharp.dll; $(get_sharp_assemblies --bare gdk-sharp-2.0);g" \ + -e "s; \.\./gtk/gtk-sharp.dll; $(get_sharp_assemblies --bare gtk-sharp-2.0);g" \ + -e "s;\$(RUNTIME) \$(top_builddir)/parser/gapi-fixup.exe;/usr/bin/gapi2-fixup;" \ + -e "s;\$(RUNTIME) \$(top_builddir)/generator/gapi_codegen.exe;/usr/bin/gapi2-codegen;" \ + -e "s:\$(SYMBOLS) \$(top_builddir)/parser/gapi-fixup.exe:\$(SYMBOLS):" \ + -e "s:\$(INCLUDE_API) \$(top_builddir)/generator/gapi_codegen.exe:\$(INCLUDE_API):" \ + $(find . -name Makefile.in) || die "failed to fix ${TARBALL}-tarball makefiles" +} + +# @FUNCTION: gnome-sharp-tarball-post_src_prepare +# @DESCRIPTION: +# Runs a M-m-m-monster sed on GTK_SHARP_MODULE_DIR to convert references to +# local assemblies to the installed ones. Is only called by src_prepare when +# $GTK_SHARP_MODULE is a member of $gnome_sharp_module_list. +gnome-sharp-tarball-post_src_prepare() { + cd "${S}/${GTK_SHARP_MODULE_DIR}" + sed -i \ + -e "s; ../gnomevfs/gnome-vfs-api.xml; $(get_sharp_apis --bare gnome-vfs-sharp-2.0);" \ + -e "s; ../art/art-api.xml; $(get_sharp_apis --bare art-sharp-2.0);" \ + -e "s; \.\./art/art-sharp.dll; $(get_sharp_assemblies --bare art-sharp-2.0);g" \ + -e "s; \.\./gnomevfs/gnome-vfs-sharp.dll; $(get_sharp_assemblies --bare gnome-vfs-sharp-2.0);g" \ + -e "s;/r:\$(top_builddir)/art/art-sharp.dll;$(get_sharp_assemblies --prefixed art-sharp-2.0);" \ + -e "s;/r:\$(top_builddir)/gnome/gnome-sharp.dll;$(get_sharp_assemblies --prefixed gnome-sharp-2.0);" \ + $(find . -name Makefile.in) || die "failed to fix ${TARBALL}-tarball makefiles" +} + +# @FUNCTION: gtk-sharp-module_src_prepare +# @DESCRIPTION: +# Runs autopatch from base.eclass, eautoreconf if EAUTORECONF is set to any +# value. +# Contains a phase_hook, runs very last. +# phase_hook prefix trigger: ${TARBALL}-tarball-post +# Is exported. +gtk-sharp-module_src_prepare() { + base_src_prepare +# @ECLASS-VARIABLE: EAUTORECONF +# @DESCRIPTION: +# If set, EAUTORECONF will be run during src_prepare. + [[ ${EAUTORECONF} ]] && eautoreconf + phase_hook ${TARBALL}-tarball-post + elibtoolize +} + +# @FUNCTION: gtk-sharp-tarball_src_configure +# @DESCRIPTION: +# Sets some environment variables that will allow us to make the dependencies +# for each ebuild be only its own dependencies, without patching configure. +# Is only called by gtk-sharp-module_src_configure when $GTK_SHARP_MODULE +# is a member of $gtk_sharp_module_list. +gtk-sharp-tarball_src_configure() { + pkg_check_modules_override GLIB gobject-2.0 + pkg_check_modules_override GIO gio-2.0 + pkg_check_modules_override PANGO pango + pkg_check_modules_override ATK atk + pkg_check_modules_override GTK gtk+-2.0 + pkg_check_modules_override GLADE libglade-2.0 +} + +# @FUNCTION: gnome-sharp-tarball_src_configure +# @DESCRIPTION: +# Sets some environment variables that will allow us to make the dependencies +# for each ebuild be only its own dependencies. Without patching configure. +# Is only called by gtk-sharp-module_src_configure when $GTK_SHARP_MODULE +# is a member of $gnome_sharp_module_list. +gnome-sharp-tarball_src_configure() { + pkg_check_modules_override GLADESHARP glade-sharp-2.0 + pkg_check_modules_override GAPI gapi-2.0 + ac_path_prog_override GAPI_PARSER /usr/bin/gapi2-parser + ac_path_prog_override GAPI_CODEGEN /usr/bin/gapi2-codegen + ac_path_prog_override GAPI_FIXUP /usr/bin/gapi2-fixup +} + +# @FUNCTION: gtk-sharp-module_src_configure +# @USAGE: [econf-arguments] +# @DESCRIPTION: +# Calls econf with some default values. +# Contains a phase_hook, run before econf. +# phase_hook prefix trigger: ${TARBALL}-tarball +# Is exported. +gtk-sharp-module_src_configure() { + phase_hook ${TARBALL}-tarball + econf --disable-static \ + --disable-dependency-tracking \ + --disable-maintainer-mode \ + $(use debug &&echo "--enable-debug" ) \ + ${@} || die "econf failed" +} + +# @FUNCTION: gtk-sharp-module_src_compile +# @DESCRIPTION: +# Calls emake in the subdir of the module. +# Sets CSC=/usr/bin/gmcs. Deletes top_srcdir Makefiles to prevent recursing in +# case we missed some dll references. +# Is exported. +gtk-sharp-module_src_compile() { + rm -f "${S}"/Makefile* &> /dev/null + cd "${S}/${GTK_SHARP_MODULE_DIR}" + emake CSC=/usr/bin/gmcs || die "emake failed" +} + +# @FUNCTION: gtk-sharp-module_src_install +# @DESCRIPTION: +# Installs the module. Fixes up lib paths so they're multilib-safe. +# Gets rid of .la files. +# Is exported. +gtk-sharp-module_src_install() { + cd "${S}/${GTK_SHARP_MODULE_DIR}" + emake DESTDIR="${D}" install || die "emake install failed" + mono_multilib_comply + find "${D}" -type f -name '*.la' -exec rm -rf '{}' '+' || die "la removal failed" + [[ $(find "${D}" -type f|wc -l) -lt 3 ]] && die "Too few files. This smells like a failed install." +} + +EXPORT_FUNCTIONS src_prepare src_configure src_compile src_install diff --git a/sdk_container/src/third_party/portage-stable/eclass/haskell-cabal.eclass b/sdk_container/src/third_party/portage-stable/eclass/haskell-cabal.eclass new file mode 100644 index 0000000000..083a895cdd --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/haskell-cabal.eclass @@ -0,0 +1,361 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.18 2010/01/26 20:50:40 kolmodin Exp $ +# +# Original authors: Andres Loeh +# Duncan Coutts +# Maintained by: Haskell herd +# +# This eclass is for packages that make use of the +# Haskell Common Architecture for Building Applications +# and Libraries (cabal). +# +# Basic instructions: +# +# Before inheriting the eclass, set CABAL_FEATURES to +# reflect the tools and features that the package makes +# use of. +# +# Currently supported features: +# haddock -- for documentation generation +# alex -- lexer/scanner generator +# happy -- parser generator +# c2hs -- C interface generator +# cpphs -- C preprocessor clone written in Haskell +# profile -- if package supports to build profiling-enabled libraries +# bootstrap -- only used for the cabal package itself +# bin -- the package installs binaries +# lib -- the package installs libraries +# nocabaldep -- don't add dependency on cabal. +# only used for packages that _must_ not pull the dependency +# on cabal, but still use this eclass (e.g. haskell-updater). +# +# Dependencies on other cabal packages have to be specified +# correctly. +# +# Cabal libraries should usually be SLOTted with "${PV}". +# +# Many Cabal packages require S to be manually set. +# +# Conforming Cabal packages don't require any function definitions +# in the ebuild. +# +# Special flags to Cabal Configure can now be set by using +# CABAL_CONFIGURE_FLAGS + +inherit ghc-package multilib + + +for feature in ${CABAL_FEATURES}; do + case ${feature} in + haddock) CABAL_USE_HADDOCK=yes;; + alex) CABAL_USE_ALEX=yes;; + happy) CABAL_USE_HAPPY=yes;; + c2hs) CABAL_USE_C2HS=yes;; + cpphs) CABAL_USE_CPPHS=yes;; + profile) CABAL_USE_PROFILE=yes;; + bootstrap) CABAL_BOOTSTRAP=yes;; + bin) CABAL_HAS_BINARIES=yes;; + lib) CABAL_HAS_LIBRARIES=yes;; + nocabaldep) CABAL_FROM_GHC=yes;; + *) CABAL_UNKNOWN="${CABAL_UNKNOWN} ${feature}";; + esac +done + +if [[ -n "${CABAL_USE_HADDOCK}" ]]; then + IUSE="${IUSE} doc" + DEPEND="${DEPEND} doc? ( dev-haskell/haddock )" +fi + +if [[ -n "${CABAL_USE_ALEX}" ]]; then + DEPEND="${DEPEND} dev-haskell/alex" + cabalconf="${cabalconf} --with-alex=/usr/bin/alex" +fi + +if [[ -n "${CABAL_USE_HAPPY}" ]]; then + DEPEND="${DEPEND} dev-haskell/happy" + cabalconf="${cabalconf} --with-happy=/usr/bin/happy" +fi + +if [[ -n "${CABAL_USE_C2HS}" ]]; then + DEPEND="${DEPEND} dev-haskell/c2hs" + cabalconf="${cabalconf} --with-c2hs=/usr/bin/c2hs" +fi + +if [[ -n "${CABAL_USE_CPPHS}" ]]; then + DEPEND="${DEPEND} dev-haskell/cpphs" + cabalconf="${cabalconf} --with-cpphs=/usr/bin/cpphs" +fi + +if [[ -n "${CABAL_USE_PROFILE}" ]]; then + IUSE="${IUSE} profile" +fi + +# We always use a standalone version of Cabal, rather than the one that comes +# with GHC. But of course we can't depend on cabal when building cabal itself. +if [[ -z ${CABAL_MIN_VERSION} ]]; then + CABAL_MIN_VERSION=1.1.4 +fi +if [[ -z "${CABAL_BOOTSTRAP}" && -z "${CABAL_FROM_GHC}" ]]; then + DEPEND="${DEPEND} >=dev-haskell/cabal-${CABAL_MIN_VERSION}" +fi + +# Libraries require GHC to be installed. +if [[ -n "${CABAL_HAS_LIBRARIES}" ]]; then + RDEPEND="${RDEPEND} dev-lang/ghc" +fi + +# returns the version of cabal currently in use +_CABAL_VERSION_CACHE="" +cabal-version() { + if [[ -z "${_CABAL_VERSION_CACHE}" ]]; then + if [[ "${CABAL_BOOTSTRAP}" ]]; then + # We're bootstrapping cabal, so the cabal version is the version + # of this package itself. + _CABAL_VERSION_CACHE="${PV}" + elif [[ "${CABAL_FROM_GHC}" ]]; then + # We can't assume there's a version of Cabal installed by ebuild as + # this might be a first time install of GHC (for packages that + # use the shipped Cabal like haskell-updater). + + # The user is likely to only have one version of Cabal, provided + # by GHC. Note that dev-haskell/cabal can be a dummy package, only + # using the version provided by GHC. If the user has another version + # of Cabal too (more recent than the one GHC provides through + # dev-haskell/cabal, or possibly older if he used an old + # Cabal package) the most recent is used (expected to be the last + # one in the ghc-pkg output). + _CABAL_VERSION_CACHE="$(ghc-pkg field Cabal version | tail -n 1)" + + # Strip out the "version: " prefix + _CABAL_VERSION_CACHE="${_CABAL_VERSION_CACHE#"version: "}" + else + # We ask portage, not ghc, so that we only pick up + # portage-installed cabal versions. + _CABAL_VERSION_CACHE="$(ghc-extractportageversion dev-haskell/cabal)" + fi + fi + echo "${_CABAL_VERSION_CACHE}" +} + +cabal-bootstrap() { + local setupmodule + local cabalpackage + if [[ -f "${S}/Setup.lhs" ]]; then + setupmodule="${S}/Setup.lhs" + else + if [[ -f "${S}/Setup.hs" ]]; then + setupmodule="${S}/Setup.hs" + else + die "No Setup.lhs or Setup.hs found" + fi + fi + + # We build the setup program using the latest version of + # cabal that we have installed + if version_is_at_least "6.4" "$(ghc-version)"; then + cabalpackage=Cabal-$(cabal-version) + else + # older ghc's don't support package versioning + cabalpackage=Cabal + fi + einfo "Using cabal-$(cabal-version)." + $(ghc-getghc) -package "${cabalpackage}" --make "${setupmodule}" -o setup \ + || die "compiling ${setupmodule} failed" +} + +cabal-mksetup() { + local setupdir + + if [[ -n $1 ]]; then + setupdir=$1 + else + setupdir=${S} + fi + + rm -f "${setupdir}"/Setup.{lhs,hs} + + echo 'import Distribution.Simple; main = defaultMainWithHooks defaultUserHooks' \ + > $setupdir/Setup.hs +} + +cabal-haddock() { + ./setup haddock || die "setup haddock failed" +} + +cabal-configure() { + if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then + cabalconf="${cabalconf} --with-haddock=/usr/bin/haddock" + fi + if [[ -n "${CABAL_USE_PROFILE}" ]] && use profile; then + cabalconf="${cabalconf} --enable-library-profiling" + fi + # Building GHCi libs on ppc64 causes "TOC overflow". + if use ppc64; then + cabalconf="${cabalconf} --disable-library-for-ghci" + fi + + if version_is_at_least "1.4" "$(cabal-version)"; then + # disable executable stripping for the executables, as portage will + # strip by itself, and pre-stripping gives a QA warning. + # cabal versions previous to 1.4 does not strip executables, and does + # not accept the flag. + # this fixes numerous bugs, amongst them; + # bug #251881, bug #251882, bug #251884, bug #251886, bug #299494 + cabalconf="${cabalconf} --disable-executable-stripping" + fi + + if version_is_at_least "1.2.0" "$(cabal-version)"; then + cabalconf="${cabalconf} --docdir=/usr/share/doc/${PF}" + # As of Cabal 1.2, configure is quite quiet. For diagnostic purposes + # it's better if the configure chatter is in the build logs: + cabalconf="${cabalconf} --verbose" + fi + # Note: with Cabal-1.1.6.x we do not have enough control + # to put the docs into the right place. They're currently going + # into /usr/share/${P}/ghc-x.y/doc/ + # rather than /usr/share/doc/${PF}/ + # Because we can only set the datadir, not the docdir. + + ./setup configure \ + --ghc --prefix=/usr \ + --with-compiler="$(ghc-getghc)" \ + --with-hc-pkg="$(ghc-getghcpkg)" \ + --prefix=/usr \ + --libdir=/usr/$(get_libdir) \ + --libsubdir=${P}/ghc-$(ghc-version) \ + --datadir=/usr/share/ \ + --datasubdir=${P}/ghc-$(ghc-version) \ + ${cabalconf} \ + ${CABAL_CONFIGURE_FLAGS} \ + "$@" || die "setup configure failed" +} + +cabal-build() { + unset LANG LC_ALL LC_MESSAGES + ./setup build \ + || die "setup build failed" +} + +cabal-copy() { + ./setup copy \ + --destdir="${D}" \ + || die "setup copy failed" + + # cabal is a bit eager about creating dirs, + # so remove them if they are empty + rmdir "${D}/usr/bin" 2> /dev/null + + # GHC 6.4 has a bug in get/setPermission and Cabal 1.1.1 has + # no workaround. + # set the +x permission on executables + if [[ -d "${D}/usr/bin" ]] ; then + chmod +x "${D}/usr/bin/"* + fi + # TODO: do we still need this? +} + +cabal-pkg() { + # This does not actually register since we're using true instead + # of ghc-pkg. So it just leaves the .installed-pkg-config and we can + # register that ourselves (if it exists). + local result + local err + + if [[ -n ${CABAL_HAS_LIBRARIES} ]]; then + if version_is_at_least "1.2.0" "$(cabal-version)"; then + # Newer cabal can generate a package conf for us: + ./setup register --gen-pkg-config="${T}/${P}.conf" + ghc-setup-pkg "${T}/${P}.conf" + ghc-install-pkg + else + # With older cabal we have to hack it by replacing its ghc-pkg + # with true and then just picking up the .installed-pkg-config + # file and registering that ourselves (if it exists). + sed -i "s|$(ghc-getghcpkg)|$(type -P true)|" .setup-config + ./setup register || die "setup register failed" + if [[ -f .installed-pkg-config ]]; then + ghc-setup-pkg .installed-pkg-config + ghc-install-pkg + else + die "setup register has not generated a package configuration file" + fi + fi + fi +} + +# Some cabal libs are bundled along with some versions of ghc +# eg filepath-1.0 comes with ghc-6.6.1 +# by putting CABAL_CORE_LIB_GHC_PV="6.6.1" in an ebuild we are declaring that +# when building with this version of ghc, the ebuild is a dummy that is it will +# install no files since the package is already included with ghc. +# However portage still records the dependency and we can upgrade the package +# to a later one that's not included with ghc. +# You can also put a space separated list, eg CABAL_CORE_LIB_GHC_PV="6.6 6.6.1". +cabal-is-dummy-lib() { + for version in ${CABAL_CORE_LIB_GHC_PV[*]}; do + [[ "$(ghc-version)" == "$version" ]] && return 0 + done + return 1 +} + +# exported function: check if cabal is correctly installed for +# the currently active ghc (we cannot guarantee this with portage) +haskell-cabal_pkg_setup() { + ghc-package_pkg_setup + if [[ -z "${CABAL_BOOTSTRAP}" && -z "${CABAL_FROM_GHC}" ]] && ! ghc-sanecabal "${CABAL_MIN_VERSION}"; then + eerror "The package dev-haskell/cabal is not correctly installed for" + eerror "the currently active version of ghc ($(ghc-version)). Please" + eerror "run ghc-updater or haskell-updater or re-build dev-haskell/cabal." + die "cabal is not correctly installed" + fi + if [[ -z "${CABAL_HAS_BINARIES}" ]] && [[ -z "${CABAL_HAS_LIBRARIES}" ]]; then + eerror "QA: Neither bin nor lib are in CABAL_FEATURES." + fi + if [[ -n "${CABAL_UNKNOWN}" ]]; then + ewarn "Unknown entry in CABAL_FEATURES: ${CABAL_UNKNOWN}" + fi + if cabal-is-dummy-lib; then + einfo "${P} is included in ghc-${CABAL_CORE_LIB_GHC_PV}, nothing to install." + fi +} + +# exported function: cabal-style bootstrap configure and compile +cabal_src_compile() { + if ! cabal-is-dummy-lib; then + cabal-bootstrap + cabal-configure + cabal-build + + if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then + cabal-haddock + fi + fi +} + +haskell-cabal_src_compile() { + cabal_src_compile +} + +# exported function: cabal-style copy and register +cabal_src_install() { + if cabal-is-dummy-lib; then + # create a dummy local package conf file for the sake of ghc-updater + dodir "$(ghc-confdir)" + echo '[]' > "${D}/$(ghc-confdir)/$(ghc-localpkgconf)" + else + cabal-copy + cabal-pkg + + if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then + if ! version_is_at_least "1.1.6" "$(cabal-version)"; then + dohtml -r dist/doc/html/* + fi + fi + fi +} +haskell-cabal_src_install() { + cabal_src_install +} + +EXPORT_FUNCTIONS pkg_setup src_compile src_install diff --git a/sdk_container/src/third_party/portage-stable/eclass/horde.eclass b/sdk_container/src/third_party/portage-stable/eclass/horde.eclass new file mode 100644 index 0000000000..9e80b5781b --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/horde.eclass @@ -0,0 +1,176 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/horde.eclass,v 1.37 2008/08/08 13:21:56 wrobel Exp $ +# +# Help manage the horde project http://www.horde.org/ +# +# Author: Mike Frysinger +# CVS additions by Chris Aniszczyk +# SNAP additions by Jonathan Polansky +# +# This eclass provides generic functions to make the writing of horde +# ebuilds fairly trivial since there are many horde applications and +# they all share the same basic install process. + +# EHORDE_SNAP +# This variable tracks whether the user is using a snapshot version +# +# EHORDE_SNAP_BRANCH +# You set this via the ebuild to whatever branch you wish to grab a +# snapshot of. Typically this is 'HEAD' or 'RELENG'. +# +# EHORDE_CVS +# This variable tracks whether the user is using a cvs version + +inherit webapp eutils +[[ ${PN} != ${PN/-cvs} ]] && inherit cvs + +IUSE="vhosts" + +EXPORT_FUNCTIONS pkg_setup src_unpack src_install pkg_postinst + +[[ -z ${HORDE_PN} ]] && HORDE_PN="${PN/horde-}" +[[ -z ${HORDE_MAJ} ]] && HORDE_MAJ="" + +EHORDE_CVS="false" +EHORDE_SNAP="false" +if [[ ${PN} != ${PN/-cvs} ]] ; then + EHORDE_CVS="true" + HORDE_PN=${HORDE_PN/-cvs} + + ECVS_SERVER="anoncvs.horde.org:/repository" + ECVS_MODULE="${HORDE_PN}" + ECVS_TOP_DIR="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/cvs-src/${PN}" + ECVS_USER="cvsread" + ECVS_PASS="horde" + + SRC_URI="" + S=${WORKDIR}/${HORDE_PN} + +elif [[ ${PN} != ${PN/-snap} ]] ; then + EHORDE_SNAP="true" + EHORDE_SNAP_BRANCH=${EHORDE_SNAP_BRANCH:-HEAD} + SNAP_PV=${PV:0:4}-${PV:4:2}-${PV:6:2} + + HORDE_PN=${HORDE_PN/-snap} + + SRC_URI="http://ftp.horde.org/pub/snaps/${SNAP_PV}/${HORDE_PN}-${EHORDE_SNAP_BRANCH}-${SNAP_PV}.tar.gz" + S=${WORKDIR}/${HORDE_PN} + +else + SRC_URI="http://ftp.horde.org/pub/${HORDE_PN}/${HORDE_PN}${HORDE_MAJ}-${PV/_/-}.tar.gz" + S=${WORKDIR}/${HORDE_PN}${HORDE_MAJ}-${PV/_/-} +fi +HOMEPAGE="http://www.horde.org/${HORDE_PN}" + +LICENSE="LGPL-2" + +# INSTALL_DIR is used by webapp.eclass when USE=-vhosts +INSTALL_DIR="/horde" +[[ ${HORDE_PN} != "horde" && ${HORDE_PN} != "horde-groupware" && ${HORDE_PN} != "horde-webmail" ]] && INSTALL_DIR="${INSTALL_DIR}/${HORDE_PN}" + +HORDE_APPLICATIONS="${HORDE_APPLICATIONS} ." + +horde_pkg_setup() { + webapp_pkg_setup + + if [[ ! -z ${HORDE_PHP_FEATURES} ]] ; then + local param + if [[ ${HORDE_PHP_FEATURES:0:2} = "-o" ]] ; then + param="-o" + HORDE_PHP_FEATURES=${HORDE_PHP_FEATURES:2} + fi + if ! built_with_use ${param} dev-lang/php ${HORDE_PHP_FEATURES} ; then + echo + if [[ ${param} == "-o" ]] ; then + eerror "You MUST re-emerge php with at least one of" + else + eerror "You MUST re-emerge php with all of" + fi + eerror "the following options in your USE:" + eerror " ${HORDE_PHP_FEATURES}" + die "current php install cannot support ${HORDE_PN}" + fi + fi +} + +horde_src_unpack() { + if [[ ${EHORDE_CVS} = "true" ]] ; then + cvs_src_unpack + else + unpack ${A} + fi + cd "${S}" + + [[ -n ${EHORDE_PATCHES} ]] && epatch ${EHORDE_PATCHES} + + for APP in ${HORDE_APPLICATIONS} + do + [[ -f ${APP}/test.php ]] && chmod 000 ${APP}/test.php + done +} + +horde_src_install() { + webapp_src_preinst + + local destdir=${MY_HTDOCSDIR} + + # Work-around when dealing with CVS sources + [[ ${EHORDE_CVS} = "true" ]] && cd ${HORDE_PN} + + # Install docs and then delete them (except for CREDITS which + # many horde apps include in their help page #121003) + dodoc README docs/* + mv docs/CREDITS "${T}"/ + rm -rf COPYING LICENSE README docs/* + mv "${T}"/CREDITS docs/ + + dodir ${destdir} + cp -r . "${D}"/${destdir}/ || die "install files" + + for APP in ${HORDE_APPLICATIONS} + do + for DISTFILE in ${APP}/config/*.dist + do + if [[ -f ${DISTFILE/.dist/} ]] ; then + webapp_configfile "${MY_HTDOCSDIR}"/${DISTFILE/.dist/} + fi + done + if [[ -f ${APP}/config/conf.php ]] ; then + webapp_serverowned "${MY_HTDOCSDIR}"/${APP}/config/conf.php + webapp_configfile "${MY_HTDOCSDIR}"/${APP}/config/conf.php + fi + done + + [[ -n ${HORDE_RECONFIG} ]] && webapp_hook_script ${HORDE_RECONFIG} + [[ -n ${HORDE_POSTINST} ]] && webapp_postinst_txt en ${HORDE_POSTINST} + + webapp_src_install +} + +horde_pkg_postinst() { + if [[ -e ${ROOT}/usr/share/doc/${PF}/INSTALL.gz ]] ; then + einfo "Please read /usr/share/doc/${PF}/INSTALL.gz" + fi + einfo "Before this package will work, you have to setup" + einfo "the configuration files. Please review the" + einfo "config/ subdirectory of ${HORDE_PN} in the webroot." + if [[ ${HORDE_PN} != "horde" && ${HORDE_PN} != "horde-groupware" && ${HORDE_PN} != "horde-webmail" ]] ; then + ewarn + ewarn "Make sure ${HORDE_PN} is accounted for in horde's root" + ewarn " config/registry.php" + fi + if [[ ${EHORDE_CVS} = "true" ]] ; then + ewarn + ewarn "Use these CVS versions at your own risk." + ewarn "They tend to break things when working with" + ewarn "the non CVS versions of horde." + fi + if use vhosts ; then + echo + ewarn "When installing horde into a vhost dir, you will" + ewarn "need to use the -d option so that it is installed" + ewarn "into the proper location." + fi + webapp_pkg_postinst +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/iiimf.eclass b/sdk_container/src/third_party/portage-stable/eclass/iiimf.eclass new file mode 100644 index 0000000000..05bb9c7b59 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/iiimf.eclass @@ -0,0 +1,7 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/iiimf.eclass,v 1.16 2009/11/30 04:19:36 abcd Exp $ + +# @DEAD +# To be removed on 2011/11/30. +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" diff --git a/sdk_container/src/third_party/portage-stable/eclass/java-ant-2.eclass b/sdk_container/src/third_party/portage-stable/eclass/java-ant-2.eclass new file mode 100644 index 0000000000..a8be8b4f57 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/java-ant-2.eclass @@ -0,0 +1,491 @@ +# eclass for ant based Java packages +# +# Copyright (c) 2004-2005, Thomas Matthijs +# Copyright (c) 2004-2005, Gentoo Foundation +# Changes: +# May 2007: +# Made bsfix make one pass for all things and add some glocal targets for +# setting up the whole thing. Contributed by kiorky +# (kiorky@cryptelium.net). +# December 2006: +# I pretty much rewrote the logic of the bsfix functions +# and xml-rewrite.py because they were so slow +# Petteri Räty (betelgeuse@gentoo.org) +# +# Licensed under the GNU General Public License, v2 +# +# $Header: /var/cvsroot/gentoo-x86/eclass/java-ant-2.eclass,v 1.48 2010/02/12 23:51:44 caster Exp $ + +inherit java-utils-2 + +# This eclass provides functionality for Java packages which use +# ant to build. In particular, it will attempt to fix build.xml files, so that +# they use the appropriate 'target' and 'source' attributes. + +# ----------------------------------------------------------------------------- +# @variable-preinherit WANT_ANT_TASKS +# @variable-default "" +# +# Please see the description in java-utils-2.eclass. +#WANT_ANT_TASKS + +# ----------------------------------------------------------------------------- +# @variable-preinherit JAVA_ANT_DISABLE_ANT_CORE_DEP +# @variable-default unset for java-pkg-2, true for java-pkg-opt-2 +# +# Setting this variable non-empty before inheriting java-ant-2 disables adding +# dev-java/ant-core into DEPEND. + +# construct ant-speficic DEPEND +JAVA_ANT_E_DEPEND="" +# add ant-core into DEPEND, unless disabled +if [[ -z "${JAVA_ANT_DISABLE_ANT_CORE_DEP}" ]]; then + JAVA_ANT_E_DEPEND="${JAVA_ANT_E_DEPEND} >=dev-java/ant-core-1.7.0" +fi + +# add ant tasks specified in WANT_ANT_TASKS to DEPEND +local ANT_TASKS_DEPEND; +ANT_TASKS_DEPEND="$(java-pkg_ant-tasks-depend)" +# check that java-pkg_ant-tasks-depend didn't fail +if [[ $? != 0 ]]; then + eerror "${ANT_TASKS_DEPEND}" + die "java-pkg_ant-tasks-depend() failed" +fi + +# We need some tools from javatoolkit. We also need portage 2.1 for phase hooks +# and ant dependencies constructed above. +JAVA_ANT_E_DEPEND="${JAVA_ANT_E_DEPEND} + ${ANT_TASKS_DEPEND} + ${JAVA_PKG_PORTAGE_DEP} + >=dev-java/javatoolkit-0.3.0-r2" + +# this eclass must be inherited after java-pkg-2 or java-pkg-opt-2 +# if it's java-pkg-opt-2, ant dependencies are pulled based on USE flag +if hasq java-pkg-opt-2 ${INHERITED}; then + JAVA_ANT_E_DEPEND="${JAVA_PKG_OPT_USE}? ( ${JAVA_ANT_E_DEPEND} )" +elif ! hasq java-pkg-2 ${INHERITED}; then + eerror "java-ant-2 eclass can only be inherited AFTER java-pkg-2 or java-pkg-opt-2" +fi + +DEPEND="${JAVA_ANT_E_DEPEND}" + +# ------------------------------------------------------------------------------ +# @global JAVA_PKG_BSFIX +# +# Should we attempt to 'fix' ant build files to include the source/target +# attributes when calling javac? +# +# default: on +# ------------------------------------------------------------------------------ +JAVA_PKG_BSFIX=${JAVA_PKG_BSFIX:-"on"} + +# ------------------------------------------------------------------------------ +# @global JAVA_PKG_BSFIX_ALL +# +# If we're fixing build files, should we try to fix all the ones we can find? +# +# default: yes +# ------------------------------------------------------------------------------ +JAVA_PKG_BSFIX_ALL=${JAVA_PKG_BSFIX_ALL:-"yes"} + +# ------------------------------------------------------------------------------ +# @global JAVA_PKG_BSFIX_NAME +# +# Filename of build files to fix/search for +# +# default: build.xml +# ------------------------------------------------------------------------------ +JAVA_PKG_BSFIX_NAME=${JAVA_PKG_BSFIX_NAME:-"build.xml"} + +# ------------------------------------------------------------------------------ +# @global JAVA_PKG_BSFIX_TARGETS_TAGS +# +# Targets to fix the 'source' attribute in +# +# default: javac xjavac javac.preset +# ------------------------------------------------------------------------------ +JAVA_PKG_BSFIX_TARGET_TAGS=${JAVA_PKG_BSFIX_TARGET_TAGS:-"javac xjavac javac.preset"} + +# ------------------------------------------------------------------------------ +# @global JAVA_PKG_BSFIX_SOURCE_TAGS +# +# Targets to fix the 'target' attribute in +# +# default: javacdoc javac xjavac javac.preset +# ------------------------------------------------------------------------------ +JAVA_PKG_BSFIX_SOURCE_TAGS=${JAVA_PKG_BSFIX_SOURCE_TAGS:-"javadoc javac xjavac javac.preset"} + +# ------------------------------------------------------------------------------ +# @global JAVA_ANT_CLASSPATH_TAGS +# +# Targets to add the classpath attribute to +# +# default: javac xjavac +# ------------------------------------------------------------------------------ +JAVA_ANT_CLASSPATH_TAGS="javac xjavac" + +# ------------------------------------------------------------------------------ +# @global JAVA_ANT_IGNORE_SYSTEM_CLASSES +# +# Rewrites available tasks to ignore ant classpath. +# +# default: off +# ------------------------------------------------------------------------------ + +case "${EAPI:-0}" in + 0|1) : ;; + *) EXPORT_FUNCTIONS src_configure ;; +esac + +# ------------------------------------------------------------------------------ +# @eclass-src_configure +# +# src_configure rewrites the build.xml files +# ------------------------------------------------------------------------------ +java-ant-2_src_configure() { + # eant will call us unless called by Portage + [[ -e "${T}/java-ant-2_src_configure-run" ]] && return + + [[ "${JAVA_ANT_IGNORE_SYSTEM_CLASSES}" ]] \ + && java-ant_ignore-system-classes "${S}/build.xml" + + java-ant_bsfix + touch "${T}/java-ant-2_src_configure-run" +} + +# ------------------------------------------------------------------------------ +# @private java-ant_bsfix +# +# Attempts to fix build files. The following variables will affect its behavior +# as listed above: +# JAVA_PKG_BSFIX +# JAVA_PKG_BSFIX_ALL +# JAVA_PKG_BSFIX_NAME, +# ------------------------------------------------------------------------------ +java-ant_bsfix() { + debug-print-function ${FUNCNAME} $* + + [[ "${JAVA_PKG_BSFIX}" != "on" ]] && return + if ! java-pkg_needs-vm; then + echo "QA Notice: Package is using java-ant, but doesn't depend on a Java VM" + fi + + pushd "${S}" >/dev/null + + local find_args="" + [[ "${JAVA_PKG_BSFIX_ALL}" == "yes" ]] || find_args="-maxdepth 1" + + find_args="${find_args} -type f -name ${JAVA_PKG_BSFIX_NAME// / -o -name } " + + # This voodoo is done for paths with spaces + local bsfix_these + while read line; do + [[ -z ${line} ]] && continue + bsfix_these="${bsfix_these} '${line}'" + done <<-EOF + $(find . ${find_args}) + EOF + + [[ "${bsfix_these// /}" ]] && eval java-ant_bsfix_files ${bsfix_these} + + popd > /dev/null +} + +_bsfix_die() { + if has_version dev-python/pyxml; then + eerror "If the output above contains:" + eerror "ImportError:" + eerror "/usr/lib/python2.4/site-packages/_xmlplus/parsers/pyexpat.so:" + eerror "undefined symbol: PyUnicodeUCS2_DecodeUTF8" + eerror "Try re-emerging dev-python/pyxml" + die ${1} " Look at the eerror message above" + else + die ${1} + fi +} + +# ------------------------------------------------------------------------------ +# @public java-ant_bsfix_files +# +# Attempts to fix named build files. The following variables will affect its behavior +# as listed above: +# JAVA_PKG_BSFIX_SOURCE_TAGS +# JAVA_PKG_BSFIX_TARGET_TAGS +# JAVA_ANT_REWRITE_CLASSPATH +# JAVA_ANT_JAVADOC_INPUT_DIRS: Where we can find java sources for javadoc +# input. Can be a space separated list of +# directories +# JAVA_ANT_BSFIX_EXTRA_ARGS: You can use this to pass extra variables to the +# rewriter if you know what you are doing. +# +# If JAVA_ANT_JAVADOC_INPUT_DIRS is set, we will turn on the adding of a basic +# javadoc target to the ant's build.xml with the javadoc xml-rewriter feature. +# Then we will set EANT DOC TARGET to the added javadoc target +# NOTE: the variable JAVA_ANT_JAVADOC_OUTPUT_DIR points where we will +# generate the javadocs. This is a read-only variable, dont change it. + +# When changing this function, make sure that it works with paths with spaces in +# them. +# ------------------------------------------------------------------------------ +java-ant_bsfix_files() { + debug-print-function ${FUNCNAME} $* + + [[ ${#} = 0 ]] && die "${FUNCNAME} called without arguments" + + local want_source="$(java-pkg_get-source)" + local want_target="$(java-pkg_get-target)" + + debug-print "${FUNCNAME}: target: ${want_target} source: ${want_source}" + + if [ -z "${want_source}" -o -z "${want_target}" ]; then + eerror "Could not find valid -source/-target values" + eerror "Please file a bug about this on bugs.gentoo.org" + die "Could not find valid -source/-target values" + else + local files + + for file in "${@}"; do + debug-print "${FUNCNAME}: ${file}" + + if [[ -n "${JAVA_PKG_DEBUG}" ]]; then + cp "${file}" "${file}.orig" || die "failed to copy ${file}" + fi + + if [[ ! -w "${file}" ]]; then + chmod u+w "${file}" || die "chmod u+w ${file} failed" + fi + + files="${files} -f '${file}'" + done + + # Play nice with paludis + if [[ $(type -t quiet_mode) = function ]] && quiet_mode; then + local output=">/dev/null" + fi + + # for javadoc target and all in one pass, we need the new rewriter. + local rewriter3="/usr/share/javatoolkit/xml-rewrite-3.py" + if [[ ! -f ${rewriter3} ]]; then + rewriter3="/usr/$(get_libdir)/javatoolkit/bin/xml-rewrite-3.py" + fi + + local rewriter4="/usr/$(get_libdir)/javatoolkit/bin/build-xml-rewrite" + + if [[ -x ${rewriter4} && ${JAVA_ANT_ENCODING} ]]; then + [[ ${JAVA_ANT_REWRITE_CLASSPATH} ]] && local gcp="-g" + [[ ${JAVA_ANT_ENCODING} ]] && local enc="-e ${JAVA_ANT_ENCODING}" + eval echo "cElementTree rewriter" ${output} + debug-print "${rewriter4} extra args: ${gcp} ${enc}" + ${rewriter4} ${gcp} ${enc} \ + -c "${JAVA_PKG_BSFIX_SOURCE_TAGS}" source ${want_source} \ + -c "${JAVA_PKG_BSFIX_TARGET_TAGS}" target ${want_target} \ + "${@}" || die "build-xml-rewrite failed" + elif [[ ! -f ${rewriter3} ]]; then + debug-print "Using second generation rewriter" + eval echo "Rewriting source attributes" ${output} + eval xml-rewrite-2.py ${files} \ + -c -e ${JAVA_PKG_BSFIX_SOURCE_TAGS// / -e } \ + -a source -v ${want_source} ${output} || _bsfix_die "xml-rewrite2 failed: ${file}" + + eval echo "Rewriting target attributes" ${output} + eval xml-rewrite-2.py ${files} \ + -c -e ${JAVA_PKG_BSFIX_TARGET_TAGS// / -e } \ + -a target -v ${want_target} ${output} || _bsfix_die "xml-rewrite2 failed: ${file}" + + eval echo "Rewriting nowarn attributes" ${output} + eval xml-rewrite-2.py ${files} \ + -c -e ${JAVA_PKG_BSFIX_TARGET_TAGS// / -e } \ + -a nowarn -v yes ${output} || _bsfix_die "xml-rewrite2 failed: ${file}" + + if [[ ${JAVA_ANT_REWRITE_CLASSPATH} ]]; then + eval echo "Adding gentoo.classpath to javac tasks" ${output} + eval xml-rewrite-2.py ${files} \ + -c -e javac -e xjavac -a classpath -v \ + '\${gentoo.classpath}' \ + || _bsfix_die "xml-rewrite2 failed" + fi + else + debug-print "Using third generation rewriter" + eval echo "Rewriting attributes" ${output} + local bsfix_extra_args="" + # WARNING KEEP THE ORDER, ESPECIALLY FOR CHANGED ATTRIBUTES! + if [[ -n ${JAVA_ANT_REWRITE_CLASSPATH} ]]; then + local cp_tags="${JAVA_ANT_CLASSPATH_TAGS// / -e }" + bsfix_extra_args="${bsfix_extra_args} -g -e ${cp_tags}" + bsfix_extra_args="${bsfix_extra_args} -a classpath -v '\${gentoo.classpath}'" + fi + if [[ -n ${JAVA_ANT_JAVADOC_INPUT_DIRS} ]]; then + if [[ -n ${JAVA_ANT_JAVADOC_OUTPUT_DIR} ]]; then + die "Do not define JAVA_ANT_JAVADOC_OUTPUT_DIR!" + fi + # Where will our generated javadoc go. + readonly JAVA_ANT_JAVADOC_OUTPUT_DIR="${WORKDIR}/gentoo_javadoc" + mkdir -p "${JAVA_ANT_JAVADOC_OUTPUT_DIR}" || die + + if hasq doc ${IUSE}; then + if use doc; then + if [[ -z ${EANT_DOC_TARGET} ]]; then + EANT_DOC_TARGET="gentoojavadoc" + else + die "You can't use javadoc adding and set EANT_DOC_TARGET too." + fi + + for dir in ${JAVA_ANT_JAVADOC_INPUT_DIRS};do + if [[ ! -d ${dir} ]]; then + eerror "This dir: ${dir} doesnt' exists" + die "You must specify directories for javadoc input/output dirs." + fi + done + bsfix_extra_args="${bsfix_extra_args} --javadoc --source-directory " + # filter third/double spaces + JAVA_ANT_JAVADOC_INPUT_DIRS=${JAVA_ANT_JAVADOC_INPUT_DIRS// /} + JAVA_ANT_JAVADOC_INPUT_DIRS=${JAVA_ANT_JAVADOC_INPUT_DIRS// /} + bsfix_extra_args="${bsfix_extra_args} ${JAVA_ANT_JAVADOC_INPUT_DIRS// / --source-directory }" + bsfix_extra_args="${bsfix_extra_args} --output-directory ${JAVA_ANT_JAVADOC_OUTPUT_DIR}" + fi + else + die "You need to have doc in IUSE when using JAVA_ANT_JAVADOC_INPUT_DIRS" + fi + fi + + [[ -n ${JAVA_ANT_BSFIX_EXTRA_ARGS} ]] \ + && bsfix_extra_args="${bsfix_extra_args} ${JAVA_ANT_BSFIX_EXTRA_ARGS}" + + debug-print "bsfix_extra_args: ${bsfix_extra_args}" + + eval ${rewriter3} ${files} \ + -c --source-element ${JAVA_PKG_BSFIX_SOURCE_TAGS// / --source-element } \ + --source-attribute source --source-value ${want_source} \ + --target-element ${JAVA_PKG_BSFIX_TARGET_TAGS// / --target-element } \ + --target-attribute target --target-value ${want_target} \ + --target-attribute nowarn --target-value yes \ + ${bsfix_extra_args} \ + ${output} || _bsfix_die "xml-rewrite2 failed: ${file}" + fi + + if [[ -n "${JAVA_PKG_DEBUG}" ]]; then + for file in "${@}"; do + diff -NurbB "${file}.orig" "${file}" + done + fi + fi + return 0 # so that the 1 for diff doesn't get reported +} + + +# ------------------------------------------------------------------------------ +# @public java-ant_bsfix_one +# +# Attempts to fix named build file. The following variables will affect its behavior +# as listed above: +# JAVA_PKG_BSFIX_SOURCE_TAGS +# JAVA_PKG_BSFIX_TARGET_TAGS +# ------------------------------------------------------------------------------ +java-ant_bsfix_one() { + debug-print-function ${FUNCNAME} $* + + if [ -z "${1}" ]; then + eerror "${FUNCNAME} needs one argument" + die "${FUNCNAME} needs one argument" + fi + + java-ant_bsfix_files "${1}" +} + +# ------------------------------------------------------------------------------ +# @public java-ant_rewrite-classpath +# +# Adds 'classpath="${gentoo.classpath}"' to specified build file. +# Affected by: +# JAVA_ANT_CLASSPATH_TAGS +# @param $1 - the file to rewrite (defaults to build.xml) +# ------------------------------------------------------------------------------ +java-ant_rewrite-classpath() { + debug-print-function ${FUNCNAME} $* + + local file="${1}" + [[ -z "${1}" ]] && file=build.xml + [[ ${#} -gt 1 ]] && die "${FUNCNAME} currently can only rewrite one file." + + echo "Adding gentoo.classpath to ${file}" + debug-print "java-ant_rewrite-classpath: ${file}" + + cp "${file}" "${file}.orig" || die "failed to copy ${file}" + + chmod u+w "${file}" + + java-ant_xml-rewrite -f "${file}" --change \ + -e ${JAVA_ANT_CLASSPATH_TAGS// / -e } -a classpath -v '${gentoo.classpath}' + + if [[ -n "${JAVA_PKG_DEBUG}" ]]; then + diff -NurbB "${file}.orig" "${file}" + fi +} + +# ------------------------------------------------------------------------------ +# @public java-ant_ignore-system-classes +# +# Makes the available task ignore classes in the system classpath +# @param $1 - the file to rewrite (defaults to build.xml) +# ------------------------------------------------------------------------------ +java-ant_ignore-system-classes() { + debug-print-function ${FUNCNAME} $* + local file=${1:-build.xml} + echo "Changing ignoresystemclasses to true for available tasks in ${file}" + java-ant_xml-rewrite -f "${file}" --change \ + -e available -a ignoresystemclasses -v "true" +} + +# ------------------------------------------------------------------------------ +# @public java-ant_xml-rewrite +# Run the right xml-rewrite binary with the given arguments +# ------------------------------------------------------------------------------ +java-ant_xml-rewrite() { + local gen2="/usr/bin/xml-rewrite-2.py" + local gen2_1="/usr/$(get_libdir)/javatoolkit/bin/xml-rewrite-2.py" + # gen1 is deprecated + if [[ -x "${gen2}" ]]; then + ${gen2} "${@}" || die "${gen2} failed" + elif [[ -x "${gen2_1}" ]]; then + ${gen2_1} "${@}" || die "${gen2_1} failed" + else + eerror "No binary for rewriting found." + eerror "Do you have dev-java/javatoolkit installed?" + die "xml-rewrite not found" + fi +} + +# ------------------------------------------------------------------------------ +# @public java-ant_rewrite-bootclasspath +# +# Adds bootclasspath to javac-like tasks in build.xml filled with jars of a +# bootclasspath package of given version. +# +# Affected by: +# JAVA_PKG_BSFIX_TARGET_TAGS - the tags of javac tasks +# +# @param $1 - the version of bootclasspath (e.g. 1.5), 'auto' for bootclasspath +# of the current JDK +# @param $2 - path to desired build.xml file, defaults to 'build.xml' +# @param $3 - (optional) what to prepend the bootclasspath with (to override) +# @param $4 - (optional) what to append to the bootclasspath +# ------------------------------------------------------------------------------ + +java-ant_rewrite-bootclasspath() { + local version="${1}" + local file="${2-build.xml}" + local extra_before="${3}" + local extra_after="${4}" + + local bcp="$(java-pkg_get-bootclasspath "${version}")" + + if [[ -n "${extra_before}" ]]; then + bcp="${extra_before}:${bcp}" + fi + if [[ -n "${extra_after}" ]]; then + bcp="${bcp}:${extra_after}" + fi + + java-ant_xml-rewrite -f "${file}" -c -e ${JAVA_PKG_BSFIX_TARGET_TAGS// / -e } \ + -a bootclasspath -v "${bcp}" +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/java-gnome.eclass b/sdk_container/src/third_party/portage-stable/eclass/java-gnome.eclass new file mode 100644 index 0000000000..dbaec3556f --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/java-gnome.eclass @@ -0,0 +1,7 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/java-gnome.eclass,v 1.5 2009/11/30 04:19:36 abcd Exp $ + +# @DEAD +# To be removed on 2011/11/30. +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" diff --git a/sdk_container/src/third_party/portage-stable/eclass/java-mvn-src.eclass b/sdk_container/src/third_party/portage-stable/eclass/java-mvn-src.eclass new file mode 100644 index 0000000000..fa37a9ccaa --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/java-mvn-src.eclass @@ -0,0 +1,65 @@ +# Eclass for Java packages from bare sources exported by Maven +# +# Copyright (c) 2004-2009, Gentoo Foundation +# +# Licensed under the GNU General Public License, v2 +# +# $Header: /var/cvsroot/gentoo-x86/eclass/java-mvn-src.eclass,v 1.1 2010/01/16 18:48:39 weaver Exp $ + +inherit java-pkg-simple + +# ----------------------------------------------------------------------------- +# @eclass-begin +# @eclass-summary Eclass for Java packages from bare sources exported by Maven +# +# This class is intended to build pure Java packages from the sources exported +# from the source:jar goal of Maven 2. These archives contain bare Java source +# files, with no build instructions or additional resource files. They are +# unsuitable for packages that require resources besides compiled class files. +# The benefit is that for artifacts developed with Maven, these source files +# are often released together with binary packages, whereas the full build +# environment might be contained in some revision control system or not +# available at all. +# ----------------------------------------------------------------------------- + +# ----------------------------------------------------------------------------- +# @variable-external GROUP_ID +# @variable-default ${PN} +# +# The groupId of the artifact, in dotted notation. +# ----------------------------------------------------------------------------- +: ${GROUP_ID:=${PN}} + +# ----------------------------------------------------------------------------- +# @variable-external ARTIFACT_ID +# @variable-default ${PN} +# +# The artifactId of the artifact. +# ----------------------------------------------------------------------------- +: ${ARTIFACT_ID:=${PN}} + +# ----------------------------------------------------------------------------- +# @variable-external MAVEN2_REPOSITORIES +# @variable-default http://repo2.maven.org/maven2 http://download.java.net/maven/2 +# +# The repositories to search for the artifacts. Must follow Maven2 layout. +# ----------------------------------------------------------------------------- +: ${MAVEN2_REPOSITORIES:="http://repo2.maven.org/maven2 http://download.java.net/maven/2"} + +# ----------------------------------------------------------------------------- +# @variable-internal RELATIVE_SRC_URI +# +# The path of the source artifact relative to the root of the repository. +# Will be set by the eclass to follow Maven 2 repository layout. +# ----------------------------------------------------------------------------- +RELATIVE_SRC_URI=${GROUP_ID//./\/}/${ARTIFACT_ID}/${PV}/${ARTIFACT_ID}-${PV}-sources.jar + +# Look for source jar in all listed repositories +for repo in ${MAVEN2_REPOSITORIES}; do + SRC_URI="${SRC_URI} ${repo}/${RELATIVE_SRC_URI}" +done +unset repo + +# ------------------------------------------------------------------------------ +# @eclass-end +# ------------------------------------------------------------------------------ diff --git a/sdk_container/src/third_party/portage-stable/eclass/java-osgi.eclass b/sdk_container/src/third_party/portage-stable/eclass/java-osgi.eclass new file mode 100644 index 0000000000..c2f3296b5b --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/java-osgi.eclass @@ -0,0 +1,292 @@ +# Base eclass for Java packages that needs to be OSGi compliant +# +# Copyright (c) 2007, Jean-Noël Rivasseau +# Copyright (c) 2007, Gentoo Foundation +# +# Licensed under the GNU General Public License, v2 +# +# $Header: /var/cvsroot/gentoo-x86/eclass/java-osgi.eclass,v 1.5 2009/01/12 22:58:36 maekke Exp $ + +# ----------------------------------------------------------------------------- +# @eclass-begin +# @eclass-shortdesc Java OSGi eclass +# @eclass-maintainer java@gentoo.org +# +# This eclass provides functionality which is used by +# packages that need to be OSGi compliant. This means +# that the generated jars will have special headers in their manifests. +# Currently this is used only by Eclipse-3.3 - later +# we could extend this so that Gentoo Java system would be +# fully OSGi compliant. +# +# ----------------------------------------------------------------------------- + +inherit java-utils-2 + +# We define _OSGI_T so that it does not contain a slash at the end. +# According to Paludis guys, there is currently a proposal for EAPIs that +# would require all variables to end with a slash. + +_OSGI_T="${T/%\//}" + +# must get Diego to commit something like this to portability.eclass +_canonicalise() { + if type -p realpath > /dev/null; then + realpath "${@}" + elif type -p readlink > /dev/null; then + readlink -f "${@}" + else + # can't die, subshell + eerror "No readlink nor realpath found, cannot canonicalise" + fi +} + +# ----------------------------------------------------------------------------- +# @ebuild-function _java-osgi_plugin +# +# This is an internal function, not to be called directly. +# +# @example +# _java-osgi_plugin "JSch" +# +# @param $1 - bundle name +# +# ------------------------------------------------------------------------------ + +_java-osgi_plugin() { + # We hardcode Gentoo as the vendor name + + cat > "${_OSGI_T}/tmp_jar/plugin.properties" <<-EOF + bundleName="${1}" + vendorName="Gentoo" + EOF +} + +# ----------------------------------------------------------------------------- +# @ebuild-function _java-osgi_makejar +# +# This is an internal function, not to be called directly. +# +# @example +# _java-osgi_makejar "dist/${PN}.jar" "com.jcraft.jsch" "JSch" "com.jcraft.jsch, com.jcraft.jsch.jce;x-internal:=true" +# +# @param $1 - name of jar to repackage with OSGi +# @param $2 - bundle symbolic name +# @param $3 - bundle name +# @param $4 - export-package header +# +# ------------------------------------------------------------------------------ + +_java-osgi_makejar() { + debug-print-function ${FUNCNAME} "$@" + + (( ${#} < 4 )) && die "Four arguments are needed for _java-osgi_makejar()" + + local absoluteJarPath="$(_canonicalise ${1})" + local jarName="$(basename ${1})" + + mkdir "${_OSGI_T}/tmp_jar" || die "Unable to create directory ${_OSGI_T}/tmp_jar" + [[ -d "${_OSGI_T}/osgi" ]] || mkdir "${_OSGI_T}/osgi" || die "Unable to create directory ${_OSGI_T}/osgi" + + cd "${_OSGI_T}/tmp_jar" && jar xf "${absoluteJarPath}" && cd - > /dev/null \ + || die "Unable to uncompress correctly the original jar" + + cat > "${_OSGI_T}/tmp_jar/META-INF/MANIFEST.MF" <<-EOF + Manifest-Version: 1.0 + Bundle-ManifestVersion: 2 + Bundle-Name: %bundleName + Bundle-Vendor: %vendorName + Bundle-Localization: plugin + Bundle-SymbolicName: ${2} + Bundle-Version: ${PV} + Export-Package: ${4} + EOF + + _java-osgi_plugin "${3}" + + jar cfm "${_OSGI_T}/osgi/${jarName}" "${_OSGI_T}/tmp_jar/META-INF/MANIFEST.MF" \ + -C "${_OSGI_T}/tmp_jar/" . > /dev/null || die "Unable to recreate the OSGi compliant jar" + rm -rf "${_OSGI_T}/tmp_jar" +} + +# ----------------------------------------------------------------------------- +# @ebuild-function java-osgi_dojar +# +# Rewrites a jar, and produce an OSGi compliant jar from arguments given on the command line. +# The arguments given correspond to the minimal set of headers +# that must be present on a Manifest file of an OSGi package. +# If you need more headers, you should use the *-fromfile functions below, +# that create the Manifest from a file. +# It will call java-pkg_dojar at the end. +# +# @example +# java-osgi_dojar "dist/${PN}.jar" "com.jcraft.jsch" "JSch" "com.jcraft.jsch, com.jcraft.jsch.jce;x-internal:=true" +# +# @param $1 - name of jar to repackage with OSGi +# @param $2 - bundle symbolic name +# @param $3 - bundle name +# @param $4 - export-package-header +# +# ------------------------------------------------------------------------------ + +java-osgi_dojar() { + debug-print-function ${FUNCNAME} "$@" + local jarName="$(basename ${1})" + _java-osgi_makejar "$@" + java-pkg_dojar "${_OSGI_T}/osgi/${jarName}" +} + +# ----------------------------------------------------------------------------- +# @ebuild-function java-osgi_newjar +# +# Rewrites a jar, and produce an OSGi compliant jar. +# The arguments given correspond to the minimal set of headers +# that must be present on a Manifest file of an OSGi package. +# If you need more headers, you should use the *-fromfile functions below, +# that create the Manifest from a file. +# It will call java-pkg_newjar at the end. +# +# @example +# java-osgi_newjar "dist/${PN}.jar" "com.jcraft.jsch" "JSch" "com.jcraft.jsch, com.jcraft.jsch.jce;x-internal:=true" +# +# @param $1 - name of jar to repackage with OSGi +# @param $2 (optional) - name of the target jar. It will default to package name if not specified. +# @param $3 - bundle symbolic name +# @param $4 - bundle name +# @param $5 - export-package header +# +# ------------------------------------------------------------------------------ + +java-osgi_newjar() { + debug-print-function ${FUNCNAME} "$@" + local jarName="$(basename $1)" + + if (( ${#} > 4 )); then + _java-osgi_makejar "${1}" "${3}" "${4}" "${5}" + java-pkg_newjar "${_OSGI_T}/osgi/${jarName}" "${2}" + else + _java-osgi_makejar "$@" + java-pkg_newjar "${_OSGI_T}/osgi/${jarName}" + fi +} + +# ----------------------------------------------------------------------------- +# @ebuild-function _java-osgi_makejar-fromfile +# +# This is an internal function, not to be called directly. +# +# @example +# _java-osgi_makejar-fromfile "dist/${PN}.jar" "${FILESDIR}/MANIFEST.MF" "JSch" 1 +# +# @param $1 - name of jar to repackage with OSGi +# @param $2 - path to the Manifest file +# @param $3 - bundle name +# @param $4 - automatic version rewriting (0 or 1) +# +# ------------------------------------------------------------------------------ + +_java-osgi_makejar-fromfile() { + debug-print-function ${FUNCNAME} "$@" + + ((${#} < 4)) && die "Four arguments are needed for _java-osgi_makejar-fromfile()" + + local absoluteJarPath="$(_canonicalise ${1})" + local jarName="$(basename ${1})" + + mkdir "${_OSGI_T}/tmp_jar" || die "Unable to create directory ${_OSGI_T}/tmp_jar" + [[ -d "${_OSGI_T}/osgi" ]] || mkdir "${_OSGI_T}/osgi" || die "Unable to create directory ${_OSGI_T}/osgi" + + cd "${_OSGI_T}/tmp_jar" && jar xf "${absoluteJarPath}" && cd - > /dev/null \ + || die "Unable to uncompress correctly the original jar" + + [[ -e "${2}" ]] || die "Manifest file ${2} not found" + + # We automatically change the version if automatic version rewriting is on + + if (( ${4} )); then + cat "${2}" | sed "s/Bundle-Version:.*/Bundle-Version: ${PV}/" > \ + "${_OSGI_T}/tmp_jar/META-INF/MANIFEST.MF" + else + cat "${2}" > "${_OSGI_T}/tmp_jar/META-INF/MANIFEST.MF" + fi + + _java-osgi_plugin "${3}" + + jar cfm "${_OSGI_T}/osgi/${jarName}" "${_OSGI_T}/tmp_jar/META-INF/MANIFEST.MF" \ + -C "${_OSGI_T}/tmp_jar/" . > /dev/null || die "Unable to recreate the OSGi compliant jar" + rm -rf "${_OSGI_T}/tmp_jar" +} + +# ----------------------------------------------------------------------------- +# @ebuild-function java-osgi_newjar-fromfile() +# +# This function produces an OSGi compliant jar from a given manifest file. +# The Manifest Bundle-Version header will be replaced by the current version +# of the package, unless the --no-auto-version option is given. +# It will call java-pkg_newjar at the end. +# +# @example +# java-osgi_newjar-fromfile "dist/${PN}.jar" "${FILESDIR}/MANIFEST.MF" "Standard Widget Toolkit for GTK 2.0" +# +# @param $opt +# --no-auto-version - This option disables automatic rewriting of the +# version in the Manifest file# +# @param $1 - name of jar to repackage with OSGi +# @param $2 (optional) - name of the target jar. It will default to package name if not specified. +# @param $3 - path to the Manifest file +# @param $4 - bundle name +# +# ------------------------------------------------------------------------------ + +java-osgi_newjar-fromfile() { + debug-print-function ${FUNCNAME} "$@" + local versionRewriting=1 + + if [[ "${1}" == "--no-auto-version" ]]; then + versionRewriting=0 + shift + fi + local jarName="$(basename ${1})" + + if (( ${#} > 3 )); then + _java-osgi_makejar-fromfile "${1}" "${3}" "${4}" "${versionRewriting}" + java-pkg_newjar "${_OSGI_T}/osgi/${jarName}" "${2}" + else + _java-osgi_makejar-fromfile "$@" "${versionRewriting}" + java-pkg_newjar "${_OSGI_T}/osgi/${jarName}" + fi +} + +# ----------------------------------------------------------------------------- +# @ebuild-function java-osgi_dojar-fromfile() +# +# This function produces an OSGi compliant jar from a given manifestfile. +# The Manifest Bundle-Version header will be replaced by the current version +# of the package, unless the --no-auto-version option is given. +# It will call java-pkg_dojar at the end. +# +# @example +# java-osgi_dojar-fromfile "dist/${PN}.jar" "${FILESDIR}/MANIFEST.MF" "Standard Widget Toolkit for GTK 2.0" +# +# @param $opt +# --no-auto-version - This option disables automatic rewriting of the +# version in the Manifest file +# @param $1 - name of jar to repackage with OSGi +# @param $2 - path to the Manifest file +# @param $3 - bundle name +# +# ------------------------------------------------------------------------------ + +java-osgi_dojar-fromfile() { + debug-print-function ${FUNCNAME} "$@" + local versionRewriting=1 + + if [[ "${1}" == "--no-auto-version" ]]; then + versionRewriting=0 + shift + fi + local jarName="$(basename ${1})" + + _java-osgi_makejar-fromfile "$@" "${versionRewriting}" + java-pkg_dojar "${_OSGI_T}/osgi/${jarName}" +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/java-pkg-2.eclass b/sdk_container/src/third_party/portage-stable/eclass/java-pkg-2.eclass new file mode 100644 index 0000000000..e2732e62a5 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/java-pkg-2.eclass @@ -0,0 +1,174 @@ +# Eclass for Java packages +# +# Copyright (c) 2004-2005, Thomas Matthijs +# Copyright (c) 2004-2005, Gentoo Foundation +# +# Licensed under the GNU General Public License, v2 +# +# $Header: /var/cvsroot/gentoo-x86/eclass/java-pkg-2.eclass,v 1.35 2010/02/01 09:38:44 caster Exp $ + +inherit java-utils-2 + +# ----------------------------------------------------------------------------- +# @eclass-begin +# @eclass-summary Eclass for Java Packages +# +# This eclass should be inherited for pure Java packages, or by packages which +# need to use Java. +# ----------------------------------------------------------------------------- + +# ------------------------------------------------------------------------------ +# @IUSE +# +# Use JAVA_PKG_IUSE instead of IUSE for doc, source and examples so that +# the eclass can automatically add the needed dependencies for the java-pkg_do* +# functions. +# +# ------------------------------------------------------------------------------ +IUSE="${JAVA_PKG_IUSE}" + +# ------------------------------------------------------------------------------ +# @depend +# +# Java packages need java-config, and a fairly new release of Portage. +# +# JAVA_PKG_E_DEPEND is defined in java-utils.eclass. +# ------------------------------------------------------------------------------ +DEPEND="${JAVA_PKG_E_DEPEND}" + +# ------------------------------------------------------------------------------ +# @rdepend +# +# Nothing special for RDEPEND... just the same as DEPEND. +# ------------------------------------------------------------------------------ +RDEPEND="${DEPEND}" + +# Commons packages follow the same rules so do it here +if [[ ${CATEGORY} = dev-java && ${PN} = commons-* ]]; then + HOMEPAGE="http://commons.apache.org/${PN#commons-}/" + SRC_URI="mirror://apache/${PN/-///}/source/${P}-src.tar.gz" +fi + +case "${EAPI:-0}" in + 0|1) EXPORT_FUNCTIONS pkg_setup src_compile pkg_preinst ;; + *) EXPORT_FUNCTIONS pkg_setup src_prepare src_compile pkg_preinst ;; +esac + +# ------------------------------------------------------------------------------ +# @eclass-pkg_setup +# +# pkg_setup initializes the Java environment +# ------------------------------------------------------------------------------ +java-pkg-2_pkg_setup() { + java-pkg_init + java-pkg_ensure-test +} + +# ------------------------------------------------------------------------------ +# @eclass-src_prepare +# +# wrapper for java-utils-2_src_prepare +# ------------------------------------------------------------------------------ +java-pkg-2_src_prepare() { + java-utils-2_src_prepare +} + +# ------------------------------------------------------------------------------ +# @eclass-src_compile +# +# Default src_compile for java packages +# variables: +# EANT_BUILD_XML - controls the location of the build.xml (default: ./build.xml) +# EANT_FILTER_COMPILER - Calls java-pkg_filter-compiler with the value +# EANT_BUILD_TARGET - the ant target/targets to execute (default: jar) +# EANT_DOC_TARGET - the target to build extra docs under the doc use flag +# (default: javadoc; declare empty to disable completely) +# EANT_GENTOO_CLASSPATH - @see eant documention in java-utils-2.eclass +# EANT_EXTRA_ARGS - extra arguments to pass to eant +# EANT_ANT_TASKS - modifies the ANT_TASKS variable in the eant environment +# param: Parameters are passed to ant verbatim +# ------------------------------------------------------------------------------ +java-pkg-2_src_compile() { + if [[ -e "${EANT_BUILD_XML:=build.xml}" ]]; then + [[ "${EANT_FILTER_COMPILER}" ]] && \ + java-pkg_filter-compiler ${EANT_FILTER_COMPILER} + local antflags="${EANT_BUILD_TARGET:=jar}" + if hasq doc ${IUSE} && [[ -n "${EANT_DOC_TARGET=javadoc}" ]]; then + antflags="${antflags} $(use_doc ${EANT_DOC_TARGET})" + fi + local tasks + [[ ${EANT_ANT_TASKS} ]] && tasks="${ANT_TASKS} ${EANT_ANT_TASKS}" + ANT_TASKS="${tasks:-${ANT_TASKS}}" \ + eant ${antflags} -f "${EANT_BUILD_XML}" ${EANT_EXTRA_ARGS} "${@}" + else + echo "${FUNCNAME}: ${EANT_BUILD_XML} not found so nothing to do." + fi +} + +java-pkg-2_supports-test() { + python << EOF +from xml.dom.minidom import parse +import sys +dom = parse("${1}") +for elem in dom.getElementsByTagName('target'): + if elem.getAttribute('name') == 'test': + sys.exit(0) +sys.exit(1) +EOF + return $? +} + +java-pkg-2_src_test() { + [[ -e "${EANT_BUILD_XML:=build.xml}" ]] || return + + if [[ ${EANT_TEST_TARGET} ]] || java-pkg-2_supports-test ${EANT_BUILD_XML}; then + local opts task + + if [[ ${EANT_TEST_JUNIT_INTO} ]]; then + java-pkg_jar-from --into "${EANT_TEST_JUNIT_INTO}" junit + fi + + ANT_TASKS=${EANT_TEST_ANT_TASKS:-${ANT_TASKS:-${EANT_ANT_TASKS}}} + + if [[ ${DEPEND} = *dev-java/ant-junit* ]]; then + + if [[ ${ANT_TASKS} && "${ANT_TASKS}" != none ]]; then + ANT_TASKS="${ANT_TASKS} ant-junit" + else + ANT_TASKS="ant-junit" + fi + + task=true + fi + + if [[ ${task} ]] || [[ ${DEPEND} = *dev-java/junit* ]]; then + opts="-Djunit.jar=\"$(java-pkg_getjar junit junit.jar)\"" + if [[ ${EANT_TEST_GENTOO_CLASSPATH} ]]; then + EANT_GENTOO_CLASSPATH="${EANT_TEST_GENTOO_CLASSPATH},junit" + elif [[ ${EANT_GENTOO_CLASSPATH} ]]; then + EANT_GENTOO_CLASSPATH+=',junit' + else + EANT_GENTOO_CLASSPATH=junit + fi + fi + + eant ${opts} -f "${EANT_BUILD_XML}" \ + ${EANT_EXTRA_ARGS} ${EANT_TEST_EXTRA_ARGS} ${EANT_TEST_TARGET:-test} + + else + echo "${FUNCNAME}: No test target in ${EANT_BUILD_XML}" + fi +} + +# ------------------------------------------------------------------------------ +# @eclass-pkg_preinst +# +# wrapper for java-utils-2_pkg_preinst +# ------------------------------------------------------------------------------ +java-pkg-2_pkg_preinst() { + java-utils-2_pkg_preinst +} + +# ------------------------------------------------------------------------------ +# @eclass-end +# ------------------------------------------------------------------------------ diff --git a/sdk_container/src/third_party/portage-stable/eclass/java-pkg-opt-2.eclass b/sdk_container/src/third_party/portage-stable/eclass/java-pkg-opt-2.eclass new file mode 100644 index 0000000000..055466f2dc --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/java-pkg-opt-2.eclass @@ -0,0 +1,66 @@ +# Eclass for optional Java packages +# +# Copyright (c) 2004-2005, Thomas Matthijs +# Copyright (c) 2004-2005, Gentoo Foundation +# +# Licensed under the GNU General Public License, v2 +# +# Major changes: +# 20070805: +# Removed phase hooks because Portage does proper env saving now. +# +# +# $Header: /var/cvsroot/gentoo-x86/eclass/java-pkg-opt-2.eclass,v 1.14 2010/02/01 09:38:44 caster Exp $ + +inherit java-utils-2 + +# ------------------------------------------------------------------------------ +# @eclass-begin +# @eclass-summary Eclass for packages with optional Java support +# ------------------------------------------------------------------------------ + +# ------------------------------------------------------------------------------ +# @ebuild-variable JAVA_PKG_OPT_USE +# +# USE flag to control if optional Java stuff is build. Defaults to 'java'. +# ------------------------------------------------------------------------------ +JAVA_PKG_OPT_USE=${JAVA_PKG_OPT_USE:-java} + +# ------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ +DEPEND="${JAVA_PKG_OPT_USE}? ( ${JAVA_PKG_E_DEPEND} )" +RDEPEND="${DEPEND}" + +# ------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ +# See java-pkg-2.eclass for JAVA_PKG_IUSE documentation +IUSE="${JAVA_PKG_IUSE} ${JAVA_PKG_OPT_USE}" + +case "${EAPI:-0}" in + 0|1) EXPORT_FUNCTIONS pkg_setup pkg_preinst ;; + *) EXPORT_FUNCTIONS pkg_setup src_prepare pkg_preinst ;; +esac + +# ------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ +java-pkg-opt-2_pkg_setup() { + use ${JAVA_PKG_OPT_USE} && java-pkg_init +} + +# ------------------------------------------------------------------------------ +# @eclass-src_prepare +# +# wrapper for java-utils-2_src_prepare +# ------------------------------------------------------------------------------ +java-pkg-opt-2_src_prepare() { + use ${JAVA_PKG_OPT_USE} && java-utils-2_src_prepare +} + +# ------------------------------------------------------------------------------ +# @eclass-pkg_preinst +# +# wrapper for java-utils-2_pkg_preinst +# ------------------------------------------------------------------------------ +java-pkg-opt-2_pkg_preinst() { + use ${JAVA_PKG_OPT_USE} && java-utils-2_pkg_preinst +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/java-pkg-simple.eclass b/sdk_container/src/third_party/portage-stable/eclass/java-pkg-simple.eclass new file mode 100644 index 0000000000..aea850e079 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/java-pkg-simple.eclass @@ -0,0 +1,205 @@ +# Eclass for simple bare-source Java packages +# +# Copyright (c) 2004-2009, Gentoo Foundation +# +# Licensed under the GNU General Public License, v2 +# +# $Header: /var/cvsroot/gentoo-x86/eclass/java-pkg-simple.eclass,v 1.1 2010/01/16 18:48:39 weaver Exp $ + +inherit java-utils-2 + +if ! hasq java-pkg-2 ${INHERITED}; then + eerror "java-pkg-simple eclass can only be inherited AFTER java-pkg-2" +fi + +# ----------------------------------------------------------------------------- +# @eclass-begin +# @eclass-summary Eclass for Java sources without build instructions +# +# This class is intended to build pure Java packages from Java sources +# without the use of any build instructions shipped with the sources. +# There is no support for resources besides the generated class files, +# or for generating source files, or for controlling the META-INF of +# the resulting jar, although these issues may be addressed by an +# ebuild by putting corresponding files into the target directory +# before calling the src_compile function of this eclass. +# ----------------------------------------------------------------------------- + +EXPORT_FUNCTIONS src_compile src_install + +# We are only interested in finding all java source files, wherever they may be. +S="${WORKDIR}" + +# ----------------------------------------------------------------------------- +# @variable-external JAVA_GENTOO_CLASSPATH +# @variable-default "" +# +# Comma or space separated list of java packages to include in the +# class path. The packages will also be registered as runtime +# dependencies of this new package. Dependencies will be calculated +# transitively. See "java-config -l" for appropriate package names. +# ----------------------------------------------------------------------------- +# JAVA_GENTOO_CLASSPATH + +# ----------------------------------------------------------------------------- +# @variable-external JAVA_CLASSPATH_EXTRA +# @variable-default "" +# +# Extra list of colon separated path elements to be put on the +# classpath when compiling sources. +# ----------------------------------------------------------------------------- +# JAVA_CLASSPATH_EXTRA + +# ----------------------------------------------------------------------------- +# @variable-external JAVA_SRC_DIR +# @variable-default "" +# +# Directories relative to ${S} which contain the sources of the +# application. The default of "" will be treated mostly as ${S} +# itself. For the generated source package (if source is listed in +# ${JAVA_PKG_IUSE}), it is important that these directories are +# actually the roots of the corresponding source trees. +# ----------------------------------------------------------------------------- +# JAVA_SRC_DIR + +# ----------------------------------------------------------------------------- +# @variable-external JAVA_ENCODING +# @variable-default UTF-8 +# +# The character encoding used in the source files +# ----------------------------------------------------------------------------- +: ${JAVA_ENCODING:=UTF-8} + +# ----------------------------------------------------------------------------- +# @variable-external JAVAC_ARGS +# @variable-default "" +# +# Additional arguments to be passed to javac +# ----------------------------------------------------------------------------- +# JAVAC_ARGS + +# ----------------------------------------------------------------------------- +# @variable-external JAVADOC_ARGS +# @variable-default "" +# +# Additional arguments to be passed to javadoc +# ----------------------------------------------------------------------------- +# JAVADOC_ARGS + +# ------------------------------------------------------------------------------ +# @eclass-src_compile +# +# src_compile for simple bare source java packages. Finds all *.java +# sources in ${JAVA_SRC_DIR}, compiles them with the classpath +# calculated from ${JAVA_GENTOO_CLASSPATH}, and packages the resulting +# classes to ${PN}.jar. +# +# variables: +# JAVA_GENTOO_CLASSPATH - list java packages to put on the classpath. +# JAVA_ENCODING - encoding of source files, used by javac and javadoc +# JAVA_SRC_DIR - directories containing source files, relative to ${S} +# JAVAC_ARGS - additional arguments to be passed to javac +# JAVADOC_ARGS - additional arguments to be passed to javadoc +# ------------------------------------------------------------------------------ +java-pkg-simple_src_compile() { + local sources=sources.lst classes=target/classes apidoc=target/api + + # QA checks + [[ "$(find . -name build.xml -o -name pom.xml)" ]] && + java-pkg_announce-qa-violation "Package ships with a build file, use that instead of java-pkg-simple!" + + # gather sources + find ${JAVA_SRC_DIR:-*} -name \*.java > ${sources} + mkdir -p ${classes} || die "Could not create target directory" + + # compile + local classpath="${JAVA_CLASSPATH_EXTRA}" dependency + for dependency in ${JAVA_GENTOO_CLASSPATH}; do + classpath="${classpath}:$(java-pkg_getjars ${dependency})" \ + || die "getjars failed for ${dependency}" + done + while [[ $classpath = *::* ]]; do classpath="${classpath//::/:}"; done + classpath=${classpath%:} + classpath=${classpath#:} + debug-print "CLASSPATH=${classpath}" + java-pkg-simple_verbose-cmd \ + ejavac -d ${classes} -encoding ${JAVA_ENCODING} \ + ${classpath:+-classpath ${classpath}} ${JAVAC_ARGS} \ + @${sources} + + # javadoc + if hasq doc ${JAVA_PKG_IUSE} && use doc; then + mkdir -p ${apidoc} + java-pkg-simple_verbose-cmd \ + javadoc -d ${apidoc} \ + -encoding ${JAVA_ENCODING} -docencoding UTF-8 -charset UTF-8 \ + ${classpath:+-classpath ${classpath}} ${JAVADOC_ARGS:- -quiet} \ + @${sources} || die "javadoc failed" + fi + + # package + local jar_args="cf ${PN}.jar" + if [[ -e ${classes}/META-INF/MANIFEST.MF ]]; then + jar_args="cfm ${PN}.jar ${classes}/META-INF/MANIFEST.MF" + fi + java-pkg-simple_verbose-cmd \ + jar ${jar_args} -C ${classes} . || die "jar failed" +} + +# ------------------------------------------------------------------------------ +# @eclass-src_install +# +# src_install for simple single jar java packages. Simply packages the +# contents from the target directory and installs it as ${PN}.jar. If +# the file target/META-INF/MANIFEST.MF exists, it is used as the +# manifest of the created jar. +# ------------------------------------------------------------------------------ +java-pkg-simple_src_install() { + local sources=sources.lst classes=target/classes apidoc=target/api + + # main jar + java-pkg-simple_verbose-cmd \ + java-pkg_dojar ${PN}.jar + + # javadoc + if hasq doc ${JAVA_PKG_IUSE} && use doc; then + java-pkg-simple_verbose-cmd \ + java-pkg_dojavadoc ${apidoc} + fi + + # dosrc + if hasq source ${JAVA_PKG_IUSE} && use source; then + local srcdirs="" + if [[ ${JAVA_SRC_DIR} ]]; then + local parent child + for parent in ${JAVA_SRC_DIR}; do + for child in ${parent}/*; do + srcdirs="${srcdirs} ${child}" + done + done + else + # take all directories actually containing any sources + srcdirs="$(cut -d/ -f1 ${sources} | sort -u)" + fi + java-pkg-simple_verbose-cmd \ + java-pkg_dosrc ${srcdirs} + fi +} + +# ------------------------------------------------------------------------------ +# @internal-function java-pkg-simple_verbose-cmd +# +# Print a command before executing it. To give user some feedback +# about what is going on, where the time is being spent, and also to +# help debugging ebuilds. +# +# @param $@ - command to be called and its arguments +# ------------------------------------------------------------------------------ +java-pkg-simple_verbose-cmd() { + echo "$*" + "$@" +} + +# ------------------------------------------------------------------------------ +# @eclass-end +# ------------------------------------------------------------------------------ diff --git a/sdk_container/src/third_party/portage-stable/eclass/java-utils-2.eclass b/sdk_container/src/third_party/portage-stable/eclass/java-utils-2.eclass new file mode 100644 index 0000000000..7384f662be --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/java-utils-2.eclass @@ -0,0 +1,2772 @@ +# Base eclass for Java packages +# +# Copyright (c) 2004-2005, Thomas Matthijs +# Copyright (c) 2004, Karl Trygve Kalleberg +# Copyright (c) 2004-2005, Gentoo Foundation +# +# Licensed under the GNU General Public License, v2 +# +# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.132 2010/02/12 23:51:44 caster Exp $ + +# ----------------------------------------------------------------------------- +# @eclass-begin +# @eclass-shortdesc Java Utility eclass +# @eclass-maintainer java@gentoo.org +# +# This eclass provides functionality which is used by +# java-pkg.eclass and java-pkg-opt.eclass as well as from ebuilds. +# +# @warning +# You probably don't want to inherit this directly from an ebuild. Instead, +# you should inherit java-ant for Ant-based Java packages, java-pkg for other +# Java packages, or java-pkg-opt for packages that have optional Java support. +# +# ----------------------------------------------------------------------------- + +inherit eutils versionator multilib + +IUSE="elibc_FreeBSD" + +# ----------------------------------------------------------------------------- +# @section-begin variables +# @section-title Variables +# +# Summary of variables which control the behavior of building Java packges. +# ----------------------------------------------------------------------------- + +# Make sure we use java-config-2 +export WANT_JAVA_CONFIG="2" + +# ----------------------------------------------------------------------------- +# @variable-external WANT_ANT_TASKS +# @variable-default "" +# +# An $IFS separated list of ant tasks. +# Ebuild can specify this variable before inheriting java-ant-2 eclass to +# determine ANT_TASKS it needs. They will be automatically translated to +# DEPEND variable and ANT_TASKS variable. JAVA_PKG_FORCE_ANT_TASKS can override +# ANT_TASKS set by WANT_ANT_TASKS, but not the DEPEND due to caching. +# Ebuilds that need to depend conditionally on certain tasks and specify them +# differently for different eant calls can't use this simplified approach. +# You also cannot specify version or anything else than ant-*. +# +# @example WANT_ANT_TASKS="ant-junit ant-trax" +# +# @seealso JAVA_PKG_FORCE_ANT_TASKS +# ----------------------------------------------------------------------------- +#WANT_ANT_TASKS + +# ----------------------------------------------------------------------------- +# @variable-internal JAVA_PKG_PORTAGE_DEP +# +# The version of portage we need to function properly. Previously it was +# portage with phase hooks support but now we use a version with proper env +# saving. For EAPI 2 we have new enough stuff so let's have cleaner deps. +# ----------------------------------------------------------------------------- +has "${EAPI}" 0 1 && JAVA_PKG_PORTAGE_DEP=">=sys-apps/portage-2.1.2.7" + +# ----------------------------------------------------------------------------- +# @variable-internal JAVA_PKG_E_DEPEND +# +# This is a convience variable to be used from the other java eclasses. This is +# the version of java-config we want to use. Usually the latest stable version +# so that ebuilds can use new features without depending on specific versions. +# ----------------------------------------------------------------------------- +JAVA_PKG_E_DEPEND=">=dev-java/java-config-2.1.9-r1 ${JAVA_PKG_PORTAGE_DEP}" +has source ${JAVA_PKG_IUSE} && JAVA_PKG_E_DEPEND="${JAVA_PKG_E_DEPEND} source? ( app-arch/zip )" + +# ----------------------------------------------------------------------------- +# @variable-preinherit JAVA_PKG_WANT_BOOTCLASSPATH +# +# The version of bootclasspath the package needs to work. Translates to a proper +# dependency. The bootclasspath has to be obtained by java-ant_rewrite-bootclasspath +# ----------------------------------------------------------------------------- + +if [[ -n "${JAVA_PKG_WANT_BOOTCLASSPATH}" ]]; then + if [[ "${JAVA_PKG_WANT_BOOTCLASSPATH}" == "1.5" ]]; then + JAVA_PKG_E_DEPEND="${JAVA_PKG_E_DEPEND} >=dev-java/gnu-classpath-0.98-r1:0.98" + else + eerror "Unknown value of JAVA_PKG_WANT_BOOTCLASSPATH" + # since die in global scope doesn't work, this will make repoman fail + JAVA_PKG_E_DEPEND="${JAVA_PKG_E_DEPEND} BAD_JAVA_PKG_WANT_BOOTCLASSPATH" + fi +fi + +# ----------------------------------------------------------------------------- +# @variable-external JAVA_PKG_ALLOW_VM_CHANGE +# @variable-default yes +# +# Allow this eclass to change the active VM? +# If your system VM isn't sufficient for the package, the build will fail. +# @note This is useful for testing specific VMs. +# ----------------------------------------------------------------------------- +JAVA_PKG_ALLOW_VM_CHANGE=${JAVA_PKG_ALLOW_VM_CHANGE:="yes"} + +# ----------------------------------------------------------------------------- +# @variable-external JAVA_PKG_FORCE_VM +# +# Explicitly set a particular VM to use. If its not valid, it'll fall back to +# whatever /etc/java-config-2/build/jdk.conf would elect to use. +# +# Should only be used for testing and debugging. +# +# @example Use sun-jdk-1.5 to emerge foo +# JAVA_PKG_FORCE_VM=sun-jdk-1.5 emerge foo +# +# ----------------------------------------------------------------------------- + +# ----------------------------------------------------------------------------- +# @variable-external JAVA_PKG_WANT_SOURCE +# +# Specify a specific VM version to compile for to use for -source. +# Normally this is determined from DEPEND. +# See java-pkg_get-source function below. +# +# Should only be used for testing and debugging. +# +# @seealso java-pkg_get-source +# +# @example Use 1.4 source to emerge baz +# JAVA_PKG_WANT_SOURCE=1.4 emerge baz +# ----------------------------------------------------------------------------- + +# ----------------------------------------------------------------------------- +# @variable-external JAVA_PKG_WANT_TARGET +# +# Same as JAVA_PKG_WANT_SOURCE above but for -target. +# See java-pkg_get-target function below. +# +# Should only be used for testing and debugging. +# +# @seealso java-pkg_get-target +# +# @example emerge bar to be compatible with 1.3 +# JAVA_PKG_WANT_TARGET=1.3 emerge bar +# ----------------------------------------------------------------------------- + +# ----------------------------------------------------------------------------- +# @variable-internal JAVA_PKG_COMPILER_DIR +# @default /usr/share/java-config-2/compiler +# +# Directory where compiler settings are saved, without trailing slash. +# Probably shouldn't touch this variable. +# ----------------------------------------------------------------------------- +JAVA_PKG_COMPILER_DIR=${JAVA_PKG_COMPILER_DIR:="/usr/share/java-config-2/compiler"} + + +# ----------------------------------------------------------------------------- +# @variable-internal JAVA_PKG_COMPILERS_CONF +# @variable-default /etc/java-config-2/build/compilers.conf +# +# Path to file containing information about which compiler to use. +# Can be overloaded, but it should be overloaded for testing. +# ----------------------------------------------------------------------------- +JAVA_PKG_COMPILERS_CONF=${JAVA_PKG_COMPILERS_CONF:="/etc/java-config-2/build/compilers.conf"} + +# ----------------------------------------------------------------------------- +# @variable-external JAVA_PKG_FORCE_COMPILER +# +# Explicitly set a list of compilers to use. This is normally read from +# JAVA_PKG_COMPILERS_CONF. +# +# @note This should only be used internally or for testing. +# @example Use jikes and javac, in that order +# JAVA_PKG_FORCE_COMPILER="jikes javac" +# ----------------------------------------------------------------------------- + +# ----------------------------------------------------------------------------- +# @variable-external JAVA_PKG_FORCE_ANT_TASKS +# +# An $IFS separated list of ant tasks. Can be set in environment before calling +# emerge/ebuild to override variables set in ebuild, mainly for testing before +# putting the resulting (WANT_)ANT_TASKS into ebuild. Affects only ANT_TASKS in +# eant() call, not the dependencies specified in WANT_ANT_TASKS. +# +# @example JAVA_PKG_FORCE_ANT_TASKS="ant-junit ant-trax" \ +# ebuild foo.ebuild compile +# +# @seealso WANT_ANT_TASKS +# ----------------------------------------------------------------------------- + +# TODO document me +JAVA_PKG_QA_VIOLATIONS=0 + +# ----------------------------------------------------------------------------- +# @section-end variables +# ----------------------------------------------------------------------------- + + +# ----------------------------------------------------------------------------- +# @section-begin install +# @section-summary Install functions +# +# These are used to install Java-related things, such as jars, Javadocs, JNI +# libraries, etc. +# ----------------------------------------------------------------------------- + +# ----------------------------------------------------------------------------- +# @ebuild-function java-pkg_doexamples +# +# Installs given arguments to /usr/share/doc/${PF}/examples +# If you give it only one parameter and it is a directory it will install +# everything in that directory to the examples directory. +# +# @example +# java-pkg_doexamples demo +# java-pkg_doexamples demo/* examples/* +# +# @param --subdir - If the examples need a certain directory structure +# @param $* - list of files to install +# ------------------------------------------------------------------------------ +java-pkg_doexamples() { + debug-print-function ${FUNCNAME} $* + + [[ ${#} -lt 1 ]] && die "At least one argument needed" + + java-pkg_check-phase install + + local dest=/usr/share/doc/${PF}/examples + if [[ ${1} == --subdir ]]; then + local dest=${dest}/${2} + dodir ${dest} + shift 2 + fi + + if [[ ${#} = 1 && -d ${1} ]]; then + ( # dont want to pollute calling env + insinto "${dest}" + doins -r ${1}/* + ) || die "Installing examples failed" + else + ( # dont want to pollute calling env + insinto "${dest}" + doins -r "$@" + ) || die "Installing examples failed" + fi +} + +# ----------------------------------------------------------------------------- +# @ebuild-function java-pkg_dojar +# +# Installs any number of jars. +# Jar's will be installed into /usr/share/${PN}(-${SLOT})/lib/ by default. +# You can use java-pkg_jarinto to change this path. +# You should never install a jar with a package version in the filename. +# Instead, use java-pkg_newjar defined below. +# +# @example +# java-pkg_dojar dist/${PN}.jar dist/${PN}-core.jar +# +# @param $* - list of jars to install +# ------------------------------------------------------------------------------ +java-pkg_dojar() { + debug-print-function ${FUNCNAME} $* + + [[ ${#} -lt 1 ]] && die "At least one argument needed" + + java-pkg_check-phase install + java-pkg_init_paths_ + + # Create JARDEST if it doesn't exist + dodir ${JAVA_PKG_JARDEST} + + local jar + # for each jar + for jar in "${@}"; do + local jar_basename=$(basename "${jar}") + + java-pkg_check-versioned-jar ${jar_basename} + + # check if it exists + if [[ -e "${jar}" ]] ; then + # Don't overwrite if jar has already been installed with the same + # name + local dest="${D}${JAVA_PKG_JARDEST}/${jar_basename}" + if [[ -e "${dest}" ]]; then + ewarn "Overwriting ${dest}" + fi + + # install it into JARDEST if it's a non-symlink + if [[ ! -L "${jar}" ]] ; then + #but first check class version when in strict mode. + is-java-strict && java-pkg_verify-classes "${jar}" + + INSDESTTREE="${JAVA_PKG_JARDEST}" \ + doins "${jar}" || die "failed to install ${jar}" + java-pkg_append_ JAVA_PKG_CLASSPATH "${JAVA_PKG_JARDEST}/${jar_basename}" + debug-print "installed ${jar} to ${D}${JAVA_PKG_JARDEST}" + # make a symlink to the original jar if it's symlink + else + # TODO use dosym, once we find something that could use it + # -nichoj + ln -s "$(readlink "${jar}")" "${D}${JAVA_PKG_JARDEST}/${jar_basename}" + debug-print "${jar} is a symlink, linking accordingly" + fi + else + die "${jar} does not exist" + fi + done + + java-pkg_do_write_ +} + +# ------------------------------------------------------------------------------ +# @internal-function depend-java-query +# +# Wrapper for the depend-java-query binary to enable passing USE in env. +# Using env variables keeps this eclass working with java-config versions that +# do not handle use flags. +# ------------------------------------------------------------------------------ + +depend-java-query() { + # Used to have a which call here but it caused endless loops for some people + # that had some weird bashrc voodoo for which. + USE="${USE}" /usr/bin/depend-java-query "${@}" +} + +# ------------------------------------------------------------------------------ +# @ebuild-function java-pkg_regjar +# +# Records an already installed jar in the package.env +# This would mostly be used if the package has make or a custom script to +# install things. +# +# Example: +# java-pkg_regjar ${D}/opt/foo/lib/foo.jar +# +# WARNING: +# if you want to use shell expansion, you have to use ${D}/... as the for in +# this function will not be able to expand the path, here's an example: +# +# java-pkg_regjar /opt/my-java/lib/*.jar +# +# will not work, because: +# * the `for jar in "$@"` can't expand the path to jar file names, as they +# don't exist yet +# * all `if ...` inside for will fail - the file '/opt/my-java/lib/*.jar' +# doesn't exist +# +# you have to use it as: +# +# java-pkg_regjar ${D}/opt/my-java/lib/*.jar +# +# @param $@ - jars to record +# ------------------------------------------------------------------------------ +# TODO should we be making sure the jar is present on ${D} or wherever? +java-pkg_regjar() { + debug-print-function ${FUNCNAME} $* + + java-pkg_check-phase install + + [[ ${#} -lt 1 ]] && die "at least one argument needed" + + java-pkg_init_paths_ + + local jar jar_dir jar_file + for jar in "${@}"; do + # TODO use java-pkg_check-versioned-jar + if [[ -e "${jar}" || -e "${D}${jar}" ]]; then + [[ -d "${jar}" || -d "${D}${jar}" ]] \ + && die "Called ${FUNCNAME} on a directory $*" + + #check that class version correct when in strict mode + is-java-strict && java-pkg_verify-classes "${jar}" + + # nelchael: we should strip ${D} in this case too, here's why: + # imagine such call: + # java-pkg_regjar ${D}/opt/java/*.jar + # such call will fall into this case (-e ${jar}) and will + # record paths with ${D} in package.env + java-pkg_append_ JAVA_PKG_CLASSPATH "${jar#${D}}" + else + if [[ ${jar} = *\** ]]; then + eerror "The argument ${jar} to ${FUNCNAME}" + eerror "has * in it. If you want it to glob in" + eerror '${D} add ${D} to the argument.' + fi + debug-print "${jar} or ${D}${jar} not found" + die "${jar} does not exist" + fi + done + + java-pkg_do_write_ +} + +# ------------------------------------------------------------------------------ +# @ebuild-function java-pkg_newjar +# +# Installs a jar with a new name +# +# @example: install a versioned jar without the version +# java-pkg_newjar dist/${P}.jar ${PN}.jar +# +# @param $1 - jar to install +# @param $2 - new name for jar - defaults to ${PN}.jar if not specified +# ------------------------------------------------------------------------------ +java-pkg_newjar() { + debug-print-function ${FUNCNAME} $* + + local original_jar="${1}" + local new_jar="${2:-${PN}.jar}" + local new_jar_dest="${T}/${new_jar}" + + [[ -z ${original_jar} ]] && die "Must specify a jar to install" + [[ ! -f ${original_jar} ]] \ + && die "${original_jar} does not exist or is not a file!" + + rm -f "${new_jar_dest}" || die "Failed to remove ${new_jar_dest}" + cp "${original_jar}" "${new_jar_dest}" \ + || die "Failed to copy ${original_jar} to ${new_jar_dest}" + java-pkg_dojar "${new_jar_dest}" +} + +# ------------------------------------------------------------------------------ +# @ebuild-function java-pkg_addcp +# +# Add something to the package's classpath. For jars, you should use dojar, +# newjar, or regjar. This is typically used to add directories to the classpath. +# +# TODO add example +# @param $@ - value to append to JAVA_PKG_CLASSPATH +# ------------------------------------------------------------------------------ +java-pkg_addcp() { + java-pkg_append_ JAVA_PKG_CLASSPATH "${@}" + java-pkg_do_write_ +} + +# ------------------------------------------------------------------------------ +# @ebuild-function java-pkg_doso +# +# Installs any number of JNI libraries +# They will be installed into /usr/lib by default, but java-pkg_sointo +# can be used change this path +# +# Example: +# java-pkg_doso *.so +# +# @param $@ - JNI libraries to install +# ------------------------------------------------------------------------------ +java-pkg_doso() { + debug-print-function ${FUNCNAME} $* + + java-pkg_check-phase install + + [[ ${#} -lt 1 ]] && die "${FUNCNAME} requires at least one argument" + + java-pkg_init_paths_ + + local lib + # for each lib + for lib in "$@" ; do + # if the lib exists... + if [[ -e "${lib}" ]] ; then + # install if it isn't a symlink + if [[ ! -L "${lib}" ]] ; then + INSDESTTREE="${JAVA_PKG_LIBDEST}" \ + INSOPTIONS="${LIBOPTIONS}" \ + doins "${lib}" || die "failed to install ${lib}" + java-pkg_append_ JAVA_PKG_LIBRARY "${JAVA_PKG_LIBDEST}" + debug-print "Installing ${lib} to ${JAVA_PKG_LIBDEST}" + # otherwise make a symlink to the symlink's origin + else + dosym "$(readlink "${lib}")" "${JAVA_PKG_LIBDEST}/${lib##*/}" + debug-print "${lib} is a symlink, linking accordantly" + fi + # otherwise die + else + die "${lib} does not exist" + fi + done + + java-pkg_do_write_ +} + +# ------------------------------------------------------------------------------ +# @ebuild-function java-pkg_regso +# +# Registers an already JNI library in package.env. +# +# Example: +# java-pkg_regso *.so /path/*.so +# +# @param $@ - JNI libraries to register +# ------------------------------------------------------------------------------ +java-pkg_regso() { + debug-print-function ${FUNCNAME} $* + + java-pkg_check-phase install + + [[ ${#} -lt 1 ]] && die "${FUNCNAME} requires at least one argument" + + java-pkg_init_paths_ + + local lib target_dir + for lib in "$@" ; do + # Check the absolute path of the lib + if [[ -e "${lib}" ]] ; then + target_dir="$(java-pkg_expand_dir_ ${lib})" + java-pkg_append_ JAVA_PKG_LIBRARY "/${target_dir#${D}}" + # Check the path of the lib relative to ${D} + elif [[ -e "${D}${lib}" ]]; then + target_dir="$(java-pkg_expand_dir_ ${D}${lib})" + java-pkg_append_ JAVA_PKG_LIBRARY "${target_dir}" + else + die "${lib} does not exist" + fi + done + + java-pkg_do_write_ +} + +# ------------------------------------------------------------------------------ +# @ebuild-function java-pkg_jarinto +# +# Changes the path jars are installed into +# +# @param $1 - new location to install jars into. +# ----------------------------------------------------------------------------- +java-pkg_jarinto() { + debug-print-function ${FUNCNAME} $* + + JAVA_PKG_JARDEST="${1}" +} + +# ------------------------------------------------------------------------------ +# @ebuild-function java-pkg_sointo +# +# Changes the path that JNI libraries are installed into. +# +# @param $1 - new location to install JNI libraries into. +# ------------------------------------------------------------------------------ +java-pkg_sointo() { + debug-print-function ${FUNCNAME} $* + + JAVA_PKG_LIBDEST="${1}" +} + +# ------------------------------------------------------------------------------ +# @ebuild-function java-pkg_dohtml +# +# Install Javadoc HTML documentation +# +# @example +# java-pkg_dohtml dist/docs/ +# +# ------------------------------------------------------------------------------ +java-pkg_dohtml() { + debug-print-function ${FUNCNAME} $* + + [[ ${#} -lt 1 ]] && die "At least one argument required for ${FUNCNAME}" + + # from /usr/lib/portage/bin/dohtml -h + # -f Set list of allowed extensionless file names. + dohtml -f package-list "$@" + + # this probably shouldn't be here but it provides + # a reasonable way to catch # docs for all of the + # old ebuilds. + java-pkg_recordjavadoc +} + +# ------------------------------------------------------------------------------ +# @ebuild-function java-pkg_dojavadoc +# +# Installs javadoc documentation. This should be controlled by the doc use flag. +# +# @param $1: optional --symlink creates to symlink like this for html +# documentation bundles. +# @param $2: - The javadoc root directory. +# +# @example: +# java-pkg_dojavadoc docs/api +# java-pkg_dojavadoc --symlink apidocs docs/api +# +# ------------------------------------------------------------------------------ +java-pkg_dojavadoc() { + debug-print-function ${FUNCNAME} $* + + # For html documentation bundles that link to Javadoc + local symlink + if [[ ${1} = --symlink ]]; then + symlink=${2} + shift 2 + fi + + local dir="$1" + local dest=/usr/share/doc/${PF}/html + + # QA checks + + java-pkg_check-phase install + + [[ -z "${dir}" ]] && die "Must specify a directory!" + [[ ! -d "${dir}" ]] && die "${dir} does not exist, or isn't a directory!" + if [[ ! -e "${dir}/index.html" ]]; then + local msg="No index.html in javadoc directory" + ewarn "${msg}" + is-java-strict && die "${msg}" + fi + + if [[ -e ${D}/${dest}/api ]]; then + eerror "${dest} already exists. Will not overwrite." + die "${dest}" + fi + + # Renaming to match our directory layout + + local dir_to_install="${dir}" + if [[ "$(basename "${dir}")" != "api" ]]; then + dir_to_install="${T}/api" + # TODO use doins + cp -r "${dir}" "${dir_to_install}" || die "cp failed" + fi + + # Actual installation + + java-pkg_dohtml -r "${dir_to_install}" + + # Let's make a symlink to the directory we have everything else under + dosym ${dest}/api "${JAVA_PKG_SHAREPATH}/api" || die + + if [[ ${symlink} ]]; then + debug-print "symlinking ${dest}/{api,${symlink}}" + dosym ${dest}/{api,${symlink}} || die + fi +} + +# ------------------------------------------------------------------------------ +# @ebuild-function java-pkg_dosrc +# +# Installs a zip containing the source for a package, so it can used in +# from IDEs like eclipse and netbeans. +# +# Ebuild needs to DEPEND on app-arch/zip to use this. +# +# It also should be controlled by USE=source. +# +# @example: +# java-pkg_dosrc src/* +# +# ------------------------------------------------------------------------------ +# TODO change so it the arguments it takes are the base directories containing +# source -nichoj +# TODO should we be able to handle multiple calls to dosrc? -nichoj +# TODO maybe we can take an existing zip/jar? -nichoj +# FIXME apparently this fails if you give it an empty directories +java-pkg_dosrc() { + debug-print-function ${FUNCNAME} $* + + [ ${#} -lt 1 ] && die "At least one argument needed" + + java-pkg_check-phase install + + [[ ${#} -lt 1 ]] && die "At least one argument needed" + + if ! [[ ${DEPEND} = *app-arch/zip* ]]; then + local msg="${FUNCNAME} called without app-arch/zip in DEPEND" + java-pkg_announce-qa-violation ${msg} + fi + + java-pkg_init_paths_ + + local zip_name="${PN}-src.zip" + local zip_path="${T}/${zip_name}" + local dir + for dir in "${@}"; do + local dir_parent=$(dirname "${dir}") + local dir_name=$(basename "${dir}") + pushd ${dir_parent} > /dev/null || die "problem entering ${dir_parent}" + zip -q -r ${zip_path} ${dir_name} -i '*.java' + local result=$? + # 12 means zip has nothing to do + if [[ ${result} != 12 && ${result} != 0 ]]; then + die "failed to zip ${dir_name}" + fi + popd >/dev/null + done + + # Install the zip + INSDESTTREE=${JAVA_PKG_SOURCESPATH} \ + doins ${zip_path} || die "Failed to install source" + + JAVA_SOURCES="${JAVA_PKG_SOURCESPATH}/${zip_name}" + java-pkg_do_write_ +} + +# ------------------------------------------------------------------------------ +# @ebuild-function java-pkg_dolauncher +# +# Make a wrapper script to lauch/start this package +# If necessary, the wrapper will switch to the appropriate VM. +# +# Can be called without parameters if the package installs only one jar +# that has the Main-class attribute set. The wrapper will be named ${PN}. +# +# @param $1 - filename of launcher to create +# @param $2 - options, as follows: +# --main the.main.class.too.start +# --jar /the/jar/too/launch.jar or just .jar +# --java_args 'Extra arguments to pass to java' +# --pkg_args 'Extra arguments to pass to the package' +# --pwd Directory the launcher changes to before executing java +# -into Directory to install the launcher to, instead of /usr/bin +# -pre Prepend contents of this file to the launcher +# ------------------------------------------------------------------------------ +java-pkg_dolauncher() { + debug-print-function ${FUNCNAME} $* + + java-pkg_check-phase install + java-pkg_init_paths_ + + if [[ ${#} = 0 ]]; then + local name="${PN}" + else + local name="${1}" + shift + fi + + # TODO rename to launcher + local target="${T}/${name}" + local var_tmp="${T}/launcher_variables_tmp" + local target_dir pre + + # Process the other the rest of the arguments + while [[ -n "${1}" && -n "${2}" ]]; do + local var="${1}" value="${2}" + if [[ "${var:0:2}" == "--" ]]; then + local var=${var:2} + echo "gjl_${var}=\"${value}\"" >> "${var_tmp}" + local gjl_${var}="${value}" + elif [[ "${var}" == "-into" ]]; then + target_dir="${value}" + elif [[ "${var}" == "-pre" ]]; then + pre="${value}" + fi + shift 2 + done + + # Test if no --jar and --main arguments were given and + # in that case check if the package only installs one jar + # and use that jar. + if [[ -z "${gjl_jar}" && -z "${gjl_main}" ]]; then + local cp="${JAVA_PKG_CLASSPATH}" + if [[ "${cp/:}" = "${cp}" && "${cp%.jar}" != "${cp}" ]]; then + echo "gjl_jar=\"${JAVA_PKG_CLASSPATH}\"" >> "${var_tmp}" + else + local msg="Not enough information to create a launcher given." + msg="${msg} Please give --jar or --main argument to ${FUNCNAME}." + die "${msg}" + fi + fi + + # Write the actual script + echo "#!/bin/bash" > "${target}" + if [[ -n "${pre}" ]]; then + if [[ -f "${pre}" ]]; then + cat "${pre}" >> "${target}" + else + die "-pre specified file '${pre}' does not exist" + fi + fi + echo "gjl_package=${JAVA_PKG_NAME}" >> "${target}" + cat "${var_tmp}" >> "${target}" + rm -f "${var_tmp}" + echo "source /usr/share/java-config-2/launcher/launcher.bash" >> "${target}" + + if [[ -n "${target_dir}" ]]; then + DESTTREE="${target_dir}" dobin "${target}" + local ret=$? + return ${ret} + else + dobin "${target}" + fi +} + +# ------------------------------------------------------------------------------ +# Install war files. +# TODO document +# ------------------------------------------------------------------------------ +java-pkg_dowar() { + debug-print-function ${FUNCNAME} $* + + # Check for arguments + [[ ${#} -lt 1 ]] && die "At least one argument needed" + java-pkg_check-phase install + + java-pkg_init_paths_ + + local war + for war in $* ; do + local warpath + # TODO evaluate if we want to handle symlinks differently -nichoj + # Check for symlink + if [[ -L "${war}" ]] ; then + cp "${war}" "${T}" + warpath="${T}$(basename "${war}")" + # Check for directory + # TODO evaluate if we want to handle directories differently -nichoj + elif [[ -d "${war}" ]] ; then + echo "dowar: warning, skipping directory ${war}" + continue + else + warpath="${war}" + fi + + # Install those files like you mean it + INSOPTIONS="-m 0644" \ + INSDESTTREE=${JAVA_PKG_WARDEST} \ + doins ${warpath} + done +} + +# ------------------------------------------------------------------------------ +# @internal-function java-pkg_recordjavadoc +# Scan for JavaDocs, and record their existence in the package.env file +# +# TODO make sure this in the proper section +# ------------------------------------------------------------------------------ +java-pkg_recordjavadoc() +{ + debug-print-function ${FUNCNAME} $* + # the find statement is important + # as some packages include multiple trees of javadoc + JAVADOC_PATH="$(find ${D}/usr/share/doc/ -name allclasses-frame.html -printf '%h:')" + # remove $D - TODO: check this is ok with all cases of the above + JAVADOC_PATH="${JAVADOC_PATH//${D}}" + if [[ -n "${JAVADOC_PATH}" ]] ; then + debug-print "javadocs found in ${JAVADOC_PATH%:}" + java-pkg_do_write_ + else + debug-print "No javadocs found" + fi +} + +# ------------------------------------------------------------------------------ +# @section-end install +# ------------------------------------------------------------------------------ + +# ------------------------------------------------------------------------------ +# @begin-section query +# Use these to build the classpath for building a package. +# ------------------------------------------------------------------------------ + +# ------------------------------------------------------------------------------ +# @ebuild-function java-pkg_jar-from +# +# Makes a symlink to a jar from a certain package +# A lot of java packages include dependencies in a lib/ directory +# You can use this function to replace these bundled dependencies. +# The dependency is recorded into package.env DEPEND line, unless "--build-only" +# is passed as the very first argument, for jars that have to be present only +# at build time and are not needed on runtime (junit testing etc). +# +# Example: get all jars from xerces slot 2 +# java-pkg_jar-from xerces-2 +# Example: get a specific jar from xerces slot 2 +# java-pkg_jar-from xerces-2 xml-apis.jar +# Example: get a specific jar from xerces slot 2, and name it diffrently +# java-pkg_jar-from xerces-2 xml-apis.jar xml.jar +# Example: get junit.jar which is needed only for building +# java-pkg_jar-from --build-only junit junit.jar +# +# @param $opt +# --build-only - makes the jar(s) not added into package.env DEPEND line. +# (assumed automatically when called inside src_test) +# --with-dependencies - get jars also from requested package's dependencies +# transitively. +# --virtual - Packages passed to this function are to be handled as virtuals +# and will not have individual jar dependencies recorded. +# --into $dir - symlink jar(s) into $dir (must exist) instead of . +# @param $1 - Package to get jars from, or comma-separated list of packages in +# case other parameters are not used. +# @param $2 - jar from package. If not specified, all jars will be used. +# @param $3 - When a single jar is specified, destination filename of the +# symlink. Defaults to the name of the jar. +# ------------------------------------------------------------------------------ +# TODO could probably be cleaned up a little +java-pkg_jar-from() { + debug-print-function ${FUNCNAME} $* + + local build_only="" + local destdir="." + local deep="" + local virtual="" + local record_jar="" + + [[ "${EBUILD_PHASE}" == "test" ]] && build_only="build" + + while [[ "${1}" == --* ]]; do + if [[ "${1}" = "--build-only" ]]; then + build_only="build" + elif [[ "${1}" = "--with-dependencies" ]]; then + deep="--with-dependencies" + elif [[ "${1}" = "--virtual" ]]; then + virtual="true" + elif [[ "${1}" = "--into" ]]; then + destdir="${2}" + shift + else + die "java-pkg_jar-from called with unknown parameter: ${1}" + fi + shift + done + + local target_pkg="${1}" target_jar="${2}" destjar="${3}" + + [[ -z ${target_pkg} ]] && die "Must specify a package" + + if [[ "${EAPI}" == "1" ]]; then + target_pkg="${target_pkg//:/-}" + fi + + # default destjar to the target jar + [[ -z "${destjar}" ]] && destjar="${target_jar}" + + local error_msg="There was a problem getting the classpath for ${target_pkg}." + local classpath + classpath="$(java-config ${deep} --classpath=${target_pkg})" + [[ $? != 0 ]] && die ${error_msg} + + # When we have commas this functions is called to bring jars from multiple + # packages. This affects recording of dependencencies performed later + # which expects one package only, so we do it here. + if [[ ${target_pkg} = *,* ]]; then + for pkg in ${target_pkg//,/ }; do + java-pkg_ensure-dep "${build_only}" "${pkg}" + [[ -z "${build_only}" ]] && java-pkg_record-jar_ "${pkg}" + done + # setting this disables further record-jar_ calls later + record_jar="true" + else + java-pkg_ensure-dep "${build_only}" "${target_pkg}" + fi + + # Record the entire virtual as a dependency so that + # no jars are missed. + if [[ -z "${build_only}" && -n "${virtual}" ]]; then + java-pkg_record-jar_ "${target_pkg}" + # setting this disables further record-jars_ calls later + record_jar="true" + fi + + pushd ${destdir} > /dev/null \ + || die "failed to change directory to ${destdir}" + + local jar + for jar in ${classpath//:/ }; do + local jar_name=$(basename "${jar}") + if [[ ! -f "${jar}" ]] ; then + debug-print "${jar} from ${target_pkg} does not exist" + die "Installation problems with jars in ${target_pkg} - is it installed?" + fi + # If no specific target jar was indicated, link it + if [[ -z "${target_jar}" ]] ; then + [[ -f "${target_jar}" ]] && rm "${target_jar}" + ln -snf "${jar}" \ + || die "Failed to make symlink from ${jar} to ${jar_name}" + if [[ -z "${record_jar}" ]]; then + if [[ -z "${build_only}" ]]; then + java-pkg_record-jar_ "${target_pkg}" "${jar}" + else + java-pkg_record-jar_ --build-only "${target_pkg}" "${jar}" + fi + fi + # otherwise, if the current jar is the target jar, link it + elif [[ "${jar_name}" == "${target_jar}" ]] ; then + [[ -f "${destjar}" ]] && rm "${destjar}" + ln -snf "${jar}" "${destjar}" \ + || die "Failed to make symlink from ${jar} to ${destjar}" + if [[ -z "${record_jar}" ]]; then + if [[ -z "${build_only}" ]]; then + java-pkg_record-jar_ "${target_pkg}" "${jar}" + else + java-pkg_record-jar_ --build-only "${target_jar}" "${jar}" + fi + fi + popd > /dev/null + return 0 + fi + done + popd > /dev/null + # if no target was specified, we're ok + if [[ -z "${target_jar}" ]] ; then + return 0 + # otherwise, die bitterly + else + die "Failed to find ${target_jar:-jar} in ${target_pkg}" + fi +} + +# ------------------------------------------------------------------------------ +# @ebuild-function java-pkg_jarfrom +# +# See java-pkg_jar-from +# ------------------------------------------------------------------------------ +java-pkg_jarfrom() { + java-pkg_jar-from "$@" +} + +# ------------------------------------------------------------------------------ +# @ebuild-function java-pkg_getjars +# +# Get the classpath provided by any number of packages +# Among other things, this can be passed to 'javac -classpath' or 'ant -lib'. +# The providing packages are recorded as dependencies into package.env DEPEND +# line, unless "--build-only" is passed as the very first argument, for jars +# that have to be present only at build time and are not needed on runtime +# (junit testing etc). +# +# Example: Get the classpath for xerces-2 and xalan, +# java-pkg_getjars xerces-2,xalan +# Example Return: +# /usr/share/xerces-2/lib/xml-apis.jar:/usr/share/xerces-2/lib/xmlParserAPIs.jar:/usr/share/xalan/lib/xalan.jar +# +# @param $opt +# --build-only - makes the jar(s) not added into package.env DEPEND line. +# (assumed automatically when called inside src_test) +# --with-dependencies - get jars also from requested package's dependencies +# transitively. +# @param $1 - list of packages to get jars from +# (passed to java-config --classpath) +# ------------------------------------------------------------------------------ +java-pkg_getjars() { + debug-print-function ${FUNCNAME} $* + + local build_only="" + local deep="" + + [[ "${EBUILD_PHASE}" == "test" ]] && build_only="build" + + while [[ "${1}" == --* ]]; do + if [[ "${1}" = "--build-only" ]]; then + build_only="build" + elif [[ "${1}" = "--with-dependencies" ]]; then + deep="--with-dependencies" + else + die "java-pkg_jar-from called with unknown parameter: ${1}" + fi + shift + done + + [[ ${#} -ne 1 ]] && die "${FUNCNAME} takes only one argument besides --*" + + + local pkgs="${1}" + + if [[ "${EAPI}" == "1" ]]; then + pkgs="${pkgs//:/-}" + fi + + jars="$(java-config ${deep} --classpath=${pkgs})" + [[ $? != 0 ]] && die "java-config --classpath=${pkgs} failed" + debug-print "${pkgs}:${jars}" + + for pkg in ${pkgs//,/ }; do + java-pkg_ensure-dep "${build_only}" "${pkg}" + done + + for pkg in ${pkgs//,/ }; do + if [[ -z "${build_only}" ]]; then + java-pkg_record-jar_ "${pkg}" + else + java-pkg_record-jar_ --build-only "${pkg}" + fi + done + + echo "${jars}" +} + +# ------------------------------------------------------------------------------ +# @ebuild-function java-pkg_getjar +# +# Get the filename of a single jar from a package +# The providing package is recorded as runtime dependency into package.env +# DEPEND line, unless "--build-only" is passed as the very first argument, for +# jars that have to be present only at build time and are not needed on runtime +# (junit testing etc). +# +# @example +# java-pkg_getjar xerces-2 xml-apis.jar +# @example-return +# /usr/share/xerces-2/lib/xml-apis.jar +# +# @param $opt +# --build-only - makes the jar not added into package.env DEPEND line. +# --virtual - Packages passed to this function are to be handled as virtuals +# and will not have individual jar dependencies recorded. +# @param $1 - package to use +# @param $2 - jar to get +# ------------------------------------------------------------------------------ +java-pkg_getjar() { + debug-print-function ${FUNCNAME} $* + + local build_only="" + local virtual="" + local record_jar="" + + [[ "${EBUILD_PHASE}" == "test" ]] && build_only="build" + + while [[ "${1}" == --* ]]; do + if [[ "${1}" = "--build-only" ]]; then + build_only="build" + elif [[ "${1}" == "--virtual" ]]; then + virtual="true" + else + die "java-pkg_getjar called with unknown parameter: ${1}" + fi + shift + done + + [[ ${#} -ne 2 ]] && die "${FUNCNAME} takes only two arguments besides --*" + + local pkg="${1}" target_jar="${2}" jar + + if [[ "${EAPI}" == "1" ]]; then + pkg="${pkg//:/-}" + fi + + [[ -z ${pkg} ]] && die "Must specify package to get a jar from" + [[ -z ${target_jar} ]] && die "Must specify jar to get" + + local error_msg="Could not find classpath for ${pkg}. Are you sure its installed?" + local classpath + classpath=$(java-config --classpath=${pkg}) + [[ $? != 0 ]] && die ${error_msg} + + java-pkg_ensure-dep "${build_only}" "${pkg}" + + # Record the package(Virtual) as a dependency and then set build_only + # So that individual jars are not recorded. + if [[ -n "${virtual}" ]]; then + if [[ -z "${build_only}" ]]; then + java-pkg_record-jar_ "${pkg}" + else + java-pkg_record-jar_ --build-only "${pkg}" + fi + record_jar="true" + fi + + for jar in ${classpath//:/ }; do + if [[ ! -f "${jar}" ]] ; then + die "Installation problem with jar ${jar} in ${pkg} - is it installed?" + fi + + if [[ "$(basename ${jar})" == "${target_jar}" ]] ; then + # Only record jars that aren't build-only + if [[ -z "${record_jar}" ]]; then + if [[ -z "${build_only}" ]]; then + java-pkg_record-jar_ "${pkg}" "${jar}" + else + java-pkg_record-jar_ --build-only "${pkg}" "${jar}" + fi + fi + echo "${jar}" + return 0 + fi + done + + die "Could not find ${target_jar} in ${pkg}" + return 1 +} + +# ------------------------------------------------------------------------------ +# @ebuild-function java-pkg_register-dependency +# +# Registers runtime dependency on a package, list of packages, or a single jar +# from a package, into package.env DEPEND line. Can only be called in +# src_install phase. +# Intended for binary packages where you don't need to symlink the jars or get +# their classpath during build. As such, the dependencies only need to be +# specified in ebuild's RDEPEND, and should be omitted in DEPEND. +# +# @param $1 - comma-separated list of packages, or a single package +# @param $2 - if param $1 is a single package, optionally specify the jar +# to depend on +# +# Example: Record the dependency on whole xerces-2 and xalan, +# java-pkg_register-dependency xerces-2,xalan +# Example: Record the dependency on ant.jar from ant-core +# java-pkg_register-dependency ant-core ant.jar +# +# Note: Passing both list of packages as the first parameter AND specifying the +# jar as the second is not allowed and will cause the function to die. We assume +# that there's more chance one passes such combination as a mistake, than that +# there are more packages providing identically named jar without class +# collisions. +# ------------------------------------------------------------------------------ +java-pkg_register-dependency() { + debug-print-function ${FUNCNAME} $* + + java-pkg_check-phase install + + [[ ${#} -gt 2 ]] && die "${FUNCNAME} takes at most two arguments" + + local pkgs="${1}" + local jar="${2}" + + [[ -z "${pkgs}" ]] && die "${FUNCNAME} called with no package(s) specified" + + if [[ "${EAPI}" == "1" ]]; then + pkgs="${pkgs//:/-}" + fi + + if [[ -z "${jar}" ]]; then + for pkg in ${pkgs//,/ }; do + java-pkg_ensure-dep runtime "${pkg}" + java-pkg_record-jar_ "${pkg}" + done + else + [[ ${pkgs} == *,* ]] && \ + die "${FUNCNAME} called with both package list and jar name" + java-pkg_ensure-dep runtime "${pkgs}" + java-pkg_record-jar_ "${pkgs}" "${jar}" + fi + + java-pkg_do_write_ +} + +# ------------------------------------------------------------------------------ +# @ebuild-function java-pkg_register-optional-dependency +# +# Registers optional runtime dependency on a package, list of packages, or a +# single jar from a package, into package.env OPTIONAL_DEPEND line. Can only be +# called in src_install phase. +# Intended for packages that can use other packages when those are in classpath. +# Will be put on classpath by launcher if they are installed. Typical case is +# JDBC implementations for various databases. It's better than having USE flag +# for each implementation triggering hard dependency. +# +# @param $1 - comma-separated list of packages, or a single package +# @param $2 - if param $1 is a single package, optionally specify the jar +# to depend on +# +# Example: Record the optional dependency on some jdbc providers +# java-pkg_register-optional-dependency jdbc-jaybird,jtds-1.2,jdbc-mysql +# +# Note: Passing both list of packages as the first parameter AND specifying the +# jar as the second is not allowed and will cause the function to die. We assume +# that there's more chance one passes such combination as a mistake, than that +# there are more packages providing identically named jar without class +# collisions. +# ------------------------------------------------------------------------------ +java-pkg_register-optional-dependency() { + debug-print-function ${FUNCNAME} $* + + java-pkg_check-phase install + + [[ ${#} -gt 2 ]] && die "${FUNCNAME} takes at most two arguments" + + local pkgs="${1}" + local jar="${2}" + + [[ -z "${pkgs}" ]] && die "${FUNCNAME} called with no package(s) specified" + + if [[ "${EAPI}" == "1" ]]; then + pkgs="${pkgs//:/-}" + fi + + if [[ -z "${jar}" ]]; then + for pkg in ${pkgs//,/ }; do + java-pkg_record-jar_ --optional "${pkg}" + done + else + [[ ${pkgs} == *,* ]] && \ + die "${FUNCNAME} called with both package list and jar name" + java-pkg_record-jar_ --optional "${pkgs}" "${jar}" + fi + + java-pkg_do_write_ +} + +# ------------------------------------------------------------------------------ +# @ebuild-function java-pkg_register-environment-variable +# +# Register an arbitrary environment variable into package.env. The gjl launcher +# for this package or any package depending on this will export it into +# environement before executing java command. +# Must only be called in src_install phase. +# +# @param $1 - variable name +# @param $2 - variable value +# ------------------------------------------------------------------------------ +JAVA_PKG_EXTRA_ENV="${T}/java-pkg-extra-env" +JAVA_PKG_EXTRA_ENV_VARS="" +java-pkg_register-environment-variable() { + debug-print-function ${FUNCNAME} $* + + java-pkg_check-phase install + + [[ ${#} != 2 ]] && die "${FUNCNAME} takes two arguments" + + echo "${1}=\"${2}\"" >> ${JAVA_PKG_EXTRA_ENV} + JAVA_PKG_EXTRA_ENV_VARS="${JAVA_PKG_EXTRA_ENV_VARS} ${1}" + + java-pkg_do_write_ +} + +# ------------------------------------------------------------------------------ +# @ebuild-function java-pkg_get-bootclasspath +# +# Returns classpath of a given bootclasspath-providing package version. +# +# @param $1 - the version of bootclasspath (e.g. 1.5), 'auto' for bootclasspath +# of the current JDK +# ------------------------------------------------------------------------------ + +java-pkg_get-bootclasspath() { + local version="${1}" + + local bcp + case "${version}" in + auto) + bcp="$(java-config -g BOOTCLASSPATH)" + ;; + 1.5) + bcp="$(java-pkg_getjars --build-only gnu-classpath-0.98)" + ;; + *) + eerror "unknown parameter of java-pkg_get-bootclasspath" + die "unknown parameter of java-pkg_get-bootclasspath" + ;; + esac + + echo "${bcp}" +} + + +# This function reads stdin, and based on that input, figures out how to +# populate jars from the filesystem. +# Need to figure out a good way of making use of this, ie be able to use a +# string that was built instead of stdin +# NOTE: this isn't quite ready for primetime. +#java-pkg_populate-jars() { +# local line +# +# read line +# while [[ -n "${line}" ]]; do +# # Ignore comments +# [[ ${line%%#*} == "" ]] && continue +# +# # get rid of any spaces +# line="${line// /}" +# +# # format: path=jarinfo +# local path=${line%%=*} +# local jarinfo=${line##*=} +# +# # format: jar@package +# local jar=${jarinfo%%@*}.jar +# local package=${jarinfo##*@} +# if [[ -n ${replace_only} ]]; then +# [[ ! -f $path ]] && die "No jar exists at ${path}" +# fi +# if [[ -n ${create_parent} ]]; then +# local parent=$(dirname ${path}) +# mkdir -p "${parent}" +# fi +# java-pkg_jar-from "${package}" "${jar}" "${path}" +# +# read line +# done +#} + +# ------------------------------------------------------------------------------ +# @section-end query +# ------------------------------------------------------------------------------ + +# ------------------------------------------------------------------------------ +# @section-begin helper +# @section-summary Helper functions +# +# Various other functions to use from an ebuild +# ------------------------------------------------------------------------------ + +# ------------------------------------------------------------------------------ +# @ebuild-function java-pkg_find-normal-jars +# +# Find the files with suffix .jar file in the given directory or $WORKDIR +# +# @param $1 - The directory to search for jar files (default: ${WORKDIR}) +# ------------------------------------------------------------------------------ +java-pkg_find-normal-jars() { + local dir=$1 + [[ "${dir}" ]] || dir="${WORKDIR}" + local found + for jar in $(find "${dir}" -name "*.jar" -type f); do + echo "${jar}" + found="true" + done + [[ "${found}" ]] + return $? +} + +# ------------------------------------------------------------------------------ +# @ebuild-function java-pkg_ensure-no-bundled-jars +# +# Try to locate bundled jar files in ${WORKDIR} and die if found. +# This function should be called after WORKDIR has been populated with symlink +# to system jar files or bundled jars removed. +# ------------------------------------------------------------------------------ +java-pkg_ensure-no-bundled-jars() { + debug-print-function ${FUNCNAME} $* + + local bundled_jars=$(java-pkg_find-normal-jars) + if [[ -n ${bundled_jars} ]]; then + echo "Bundled jars found:" + local jar + for jar in ${bundled_jars}; do + echo $(pwd)${jar/./} + done + die "Bundled jars found!" + fi +} + +# ------------------------------------------------------------------------------ +# @internal-function java-pkg_ensure-vm-version-sufficient +# +# Checks if we have a sufficient VM and dies if we don't. +# +# ------------------------------------------------------------------------------ +java-pkg_ensure-vm-version-sufficient() { + debug-print-function ${FUNCNAME} $* + + if ! java-pkg_is-vm-version-sufficient; then + debug-print "VM is not suffient" + eerror "Current Java VM cannot build this package" + einfo "Please use java-config -S to set the correct one" + die "Active Java VM cannot build this package" + fi +} + +# ------------------------------------------------------------------------------ +# @internal-function java-pkg_is-vm-version-sufficient +# +# @return zero - VM is sufficient +# @return non-zero - VM is not sufficient +# ------------------------------------------------------------------------------ +java-pkg_is-vm-version-sufficient() { + debug-print-function ${FUNCNAME} $* + + depend-java-query --is-sufficient "${DEPEND}" > /dev/null + return $? +} + +# ------------------------------------------------------------------------------ +# @internal-function java-pkg_ensure-vm-version-eq +# +# Die if the current VM is not equal to the argument passed. +# +# @param $@ - Desired VM version to ensure +# ------------------------------------------------------------------------------ +java-pkg_ensure-vm-version-eq() { + debug-print-function ${FUNCNAME} $* + + if ! java-pkg_is-vm-version-eq $@ ; then + debug-print "VM is not suffient" + eerror "This package requires a Java VM version = $@" + einfo "Please use java-config -S to set the correct one" + die "Active Java VM too old" + fi +} + +# ------------------------------------------------------------------------------ +# @internal-function java-pkg_is-vm-version-eq +# +# @param $@ - VM version to compare current VM to +# @return zero - VM versions are equal +# @return non-zero - VM version are not equal +# ------------------------------------------------------------------------------ +java-pkg_is-vm-version-eq() { + debug-print-function ${FUNCNAME} $* + + local needed_version="$@" + + [[ -z "${needed_version}" ]] && die "need an argument" + + local vm_version="$(java-pkg_get-vm-version)" + + vm_version="$(get_version_component_range 1-2 "${vm_version}")" + needed_version="$(get_version_component_range 1-2 "${needed_version}")" + + if [[ -z "${vm_version}" ]]; then + debug-print "Could not get JDK version from DEPEND" + return 1 + else + if [[ "${vm_version}" == "${needed_version}" ]]; then + debug-print "Detected a JDK(${vm_version}) = ${needed_version}" + return 0 + else + debug-print "Detected a JDK(${vm_version}) != ${needed_version}" + return 1 + fi + fi +} + +# ------------------------------------------------------------------------------ +# @internal-function java-pkg_ensure-vm-version-ge +# +# Die if the current VM is not greater than the desired version +# +# @param $@ - VM version to compare current to +# ------------------------------------------------------------------------------ +java-pkg_ensure-vm-version-ge() { + debug-print-function ${FUNCNAME} $* + + if ! java-pkg_is-vm-version-ge "$@" ; then + debug-print "vm is not suffient" + eerror "This package requires a Java VM version >= $@" + einfo "Please use java-config -S to set the correct one" + die "Active Java VM too old" + fi +} + +# ------------------------------------------------------------------------------ +# @internal-function java-pkg_is-vm-version-ge +# +# @param $@ - VM version to compare current VM to +# @return zero - current VM version is greater than checked version +# @return non-zero - current VM version is not greater than checked version +# ------------------------------------------------------------------------------ +java-pkg_is-vm-version-ge() { + debug-print-function ${FUNCNAME} $* + + local needed_version=$@ + local vm_version=$(java-pkg_get-vm-version) + if [[ -z "${vm_version}" ]]; then + debug-print "Could not get JDK version from DEPEND" + return 1 + else + if version_is_at_least "${needed_version}" "${vm_version}"; then + debug-print "Detected a JDK(${vm_version}) >= ${needed_version}" + return 0 + else + debug-print "Detected a JDK(${vm_version}) < ${needed_version}" + return 1 + fi + fi +} + +java-pkg_set-current-vm() { + export GENTOO_VM=${1} +} + +java-pkg_get-current-vm() { + echo ${GENTOO_VM} +} + +java-pkg_current-vm-matches() { + has $(java-pkg_get-current-vm) ${@} + return $? +} + +# ------------------------------------------------------------------------------ +# @ebuild-function java-pkg_get-source +# +# Determines what source version should be used, for passing to -source. +# Unless you want to break things you probably shouldn't set _WANT_SOURCE +# +# @return string - Either the lowest possible source, or JAVA_PKG_WANT_SOURCE +# ------------------------------------------------------------------------------ +java-pkg_get-source() { + echo ${JAVA_PKG_WANT_SOURCE:-$(depend-java-query --get-lowest "${DEPEND} ${RDEPEND}")} +} + +# ------------------------------------------------------------------------------ +# @ebuild-function java-pkg_get-target +# +# Determines what target version should be used, for passing to -target. +# If you don't care about lower versions, you can set _WANT_TARGET to the +# version of your JDK. +# +# @return string - Either the lowest possible target, or JAVA_PKG_WANT_TARGET +# ------------------------------------------------------------------------------ +java-pkg_get-target() { + echo ${JAVA_PKG_WANT_TARGET:-$(depend-java-query --get-lowest "${DEPEND} ${RDEPEND}")} +} + +java-pkg_get-javac() { + debug-print-function ${FUNCNAME} $* + + + local compiler="${GENTOO_COMPILER}" + + local compiler_executable + if [[ "${compiler}" = "javac" ]]; then + # nothing fancy needs to be done for javac + compiler_executable="javac" + else + # for everything else, try to determine from an env file + + local compiler_env="/usr/share/java-config-2/compiler/${compiler}" + if [[ -f ${compiler_env} ]]; then + local old_javac=${JAVAC} + unset JAVAC + # try to get value of JAVAC + compiler_executable="$(source ${compiler_env} 1>/dev/null 2>&1; echo ${JAVAC})" + export JAVAC=${old_javac} + + if [[ -z ${compiler_executable} ]]; then + echo "JAVAC is empty or undefined in ${compiler_env}" + return 1 + fi + + # check that it's executable + if [[ ! -x ${compiler_executable} ]]; then + echo "${compiler_executable} doesn't exist, or isn't executable" + return 1 + fi + else + echo "Could not find environment file for ${compiler}" + return 1 + fi + fi + echo ${compiler_executable} +} + +# ------------------------------------------------------------------------------ +# @ebuild-function java-pkg_javac-args +# +# If an ebuild uses javac directly, instead of using ejavac, it should call this +# to know what -source/-target to use. +# +# @return string - arguments to pass to javac, complete with -target and -source +# ------------------------------------------------------------------------------ +java-pkg_javac-args() { + debug-print-function ${FUNCNAME} $* + + local want_source="$(java-pkg_get-source)" + local want_target="$(java-pkg_get-target)" + + local source_str="-source ${want_source}" + local target_str="-target ${want_target}" + + debug-print "want source: ${want_source}" + debug-print "want target: ${want_target}" + + if [[ -z "${want_source}" || -z "${want_target}" ]]; then + debug-print "could not find valid -source/-target values for javac" + echo "Could not find valid -source/-target values for javac" + return 1 + else + if java-pkg_is-vm-version-ge "1.4"; then + echo "${source_str} ${target_str}" + else + echo "${target_str}" + fi + fi +} + +# TODO document +java-pkg_get-jni-cflags() { + local flags="-I${JAVA_HOME}/include" + + local platform="linux" + use elibc_FreeBSD && platform="freebsd" + + # TODO do a check that the directories are valid + flags="${flags} -I${JAVA_HOME}/include/${platform}" + + echo ${flags} +} + +java-pkg_ensure-gcj() { + if ! built_with_use sys-devel/gcc gcj ; then + ewarn + ewarn "You must build gcc with the gcj support to build with gcj" + ewarn + ebeep 5 + die "No GCJ support found!" + fi +} + +java-pkg_ensure-test() { + if has test ${FEATURES} && ! has -test ${FEATURES} \ + && has test ${IUSE} && ! use test; + then + eerror "You specified FEATURES=test, but USE=test is needed" + eerror "to pull in the additional dependencies for testing" + die "Need USE=test enabled" + fi +} + +# ------------------------------------------------------------------------------ +# @ebuild-function java-pkg_register-ant-task +# +# Register this package as ant task, so that ant will load it when no specific +# ANT_TASKS are specified. Note that even without this registering, all packages +# specified in ANT_TASKS will be loaded. Mostly used by the actual ant tasks +# packages, but can be also used by other ebuilds that used to symlink their +# .jar into /usr/share/ant-core/lib to get autoloaded, for backwards +# compatibility. +# +# @param --version x.y Register only for ant version x.y (otherwise for any ant +# version). Used by the ant-* packages to prevent loading of mismatched +# ant-core ant tasks after core was updated, before the tasks are updated, +# without a need for blockers. +# @param $1 Name to register as. Defaults to JAVA_PKG_NAME ($PN[-$SLOT]) +# ------------------------------------------------------------------------------ +java-pkg_register-ant-task() { + local TASKS_DIR="tasks" + + # check for --version x.y parameters + while [[ -n "${1}" && -n "${2}" ]]; do + local var="${1#--}" + local val="${2}" + if [[ "${var}" == "version" ]]; then + TASKS_DIR="tasks-${val}" + else + die "Unknown parameter passed to java-pkg_register-ant-tasks: ${1} ${2}" + fi + shift 2 + done + + local TASK_NAME="${1:-${JAVA_PKG_NAME}}" + + dodir /usr/share/ant/${TASKS_DIR} + touch "${D}/usr/share/ant/${TASKS_DIR}/${TASK_NAME}" +} + +# ------------------------------------------------------------------------------ +# @internal-function java-pkg_ant-tasks-depend +# +# Translates the WANT_ANT_TASKS variable into valid dependencies. +# ------------------------------------------------------------------------------ +java-pkg_ant-tasks-depend() { + debug-print-function ${FUNCNAME} ${WANT_ANT_TASKS} + + if [[ -n "${WANT_ANT_TASKS}" ]]; then + local DEP="" + for i in ${WANT_ANT_TASKS} + do + if [[ ${i} = ant-* ]]; then + DEP="${DEP}dev-java/${i} " + elif [[ ${i} = */*:* ]]; then + DEP="${DEP}${i} " + else + echo "Invalid atom in WANT_ANT_TASKS: ${i}" + return 1 + fi + done + echo ${DEP} + return 0 + else + return 0 + fi +} + +# ------------------------------------------------------------------------------ +# @ebuild-function ejunit +# +# Junit wrapper function. Makes it easier to run the tests and checks for +# dev-java/junit in DEPEND. Launches the tests using junit.textui.TestRunner. +# +# Examples: +# ejunit -cp build/classes org.blinkenlights.jid3.test.AllTests +# ejunit org.blinkenlights.jid3.test.AllTests +# +# @param $1 - -cp or -classpath +# @param $2 - classpath; junit and recorded dependencies get appended +# @param $@ - the rest of the parameters are passed to java +# ------------------------------------------------------------------------------ +ejunit() { + debug-print-function ${FUNCNAME} $* + + local pkgs + if [[ -f ${JAVA_PKG_DEPEND_FILE} ]]; then + for atom in $(cat ${JAVA_PKG_DEPEND_FILE} | tr : ' '); do + pkgs=${pkgs},$(echo ${atom} | sed -re "s/^.*@//") + done + fi + + local cp=$(java-pkg_getjars --with-dependencies junit${pkgs}) + if [[ ${1} = -cp || ${1} = -classpath ]]; then + cp="${2}:${cp}" + shift 2 + else + cp=".:${cp}" + fi + + local runner=junit.textui.TestRunner + debug-print "Calling: java -cp \"${cp}\" -Djava.awt.headless=true ${runner} ${@}" + java -cp "${cp}" -Djava.awt.headless=true ${runner} "${@}" || die "Running junit failed" +} + +# ------------------------------------------------------------------------------ +# @section-end helper +# ------------------------------------------------------------------------------ + +# ------------------------------------------------------------------------------ +# @eclass-src_prepare +# +# src_prepare Searches for bundled jars +# Don't call directly, but via java-pkg-2_src_prepare! +# ------------------------------------------------------------------------------ + +java-utils-2_src_prepare() { + [[ ${EBUILD_PHASE} == prepare ]] && + java-pkg_func-exists java_prepare && java_prepare + + # Remember that eant will call this unless called via Portage + if [[ ! -e "${T}/java-utils-2_src_prepare-run" ]] && is-java-strict; then + echo "Searching for bundled jars:" + java-pkg_find-normal-jars || echo "None found." + echo "Searching for bundled classes (no output if none found):" + find "${WORKDIR}" -name "*.class" + echo "Search done." + fi + touch "${T}/java-utils-2_src_prepare-run" +} + +# ------------------------------------------------------------------------------ +# @eclass-pkg_preinst +# +# pkg_preinst Searches for missing and unneeded dependencies +# Don't call directly, but via java-pkg-2_pkg_preinst! +# ------------------------------------------------------------------------------ + +java-utils-2_pkg_preinst() { + if is-java-strict; then + if has_version dev-java/java-dep-check; then + [[ -e "${JAVA_PKG_ENV}" ]] || return + local output=$(GENTOO_VM= java-dep-check --image "${D}" "${JAVA_PKG_ENV}") + if [[ ${output} && has_version <=dev-java/java-dep-check-0.2 ]]; then + ewarn "Possibly unneeded dependencies found in package.env:" + for dep in ${output}; do + ewarn "\t${dep}" + done + fi + if [[ ${output} && has_version >dev-java/java-dep-check-0.2 ]]; then + ewarn "${output}" + fi + else + eerror "Install dev-java/java-dep-check for dependency checking" + fi + fi +} + +# ------------------------------------------------------------------------------ +# @section-begin build +# @section-summary Build functions +# +# These are some functions for building a package. In particular, it consists of +# wrappers for javac and ant. +# ------------------------------------------------------------------------------ + +# ------------------------------------------------------------------------------ +# @ebuild-function eant +# +# Ant wrapper function. Will use the appropriate compiler, based on user-defined +# compiler. Will also set proper ANT_TASKS from the variable ANT_TASKS, +# variables: +# EANT_GENTOO_CLASSPATH - calls java-pkg_getjars for the value and adds to the +# gentoo.classpath property. Be sure to call +# java-ant_rewrite-classpath in src_unpack. +# EANT_NEEDS_TOOLS - add tools.jar to the gentoo.classpath. Should only be used +# for build-time purposes, the dependency is not recorded to +# package.env! +# JAVA_PKG_NO_BUNDLED_SEARCH - Don't search for bundled jars or class files +# *ANT_TASKS - used to determine ANT_TASKS before calling Ant. +# ------------------------------------------------------------------------------ +eant() { + debug-print-function ${FUNCNAME} $* + + if [[ ${EBUILD_PHASE} = compile ]]; then + java-ant-2_src_configure + java-utils-2_src_prepare + fi + + if ! has java-ant-2 ${INHERITED}; then + local msg="You should inherit java-ant-2 when using eant" + java-pkg_announce-qa-violation "${msg}" + fi + + local antflags="-Dnoget=true -Dmaven.mode.offline=true -Dbuild.sysclasspath=ignore" + + java-pkg_init-compiler_ + local compiler="${GENTOO_COMPILER}" + + local compiler_env="${JAVA_PKG_COMPILER_DIR}/${compiler}" + local build_compiler="$(source ${compiler_env} 1>/dev/null 2>&1; echo ${ANT_BUILD_COMPILER})" + if [[ "${compiler}" != "javac" && -z "${build_compiler}" ]]; then + die "ANT_BUILD_COMPILER undefined in ${compiler_env}" + fi + + if [[ ${compiler} != "javac" ]]; then + antflags="${antflags} -Dbuild.compiler=${build_compiler}" + # Figure out any extra stuff to put on the classpath for compilers aside + # from javac + # ANT_BUILD_COMPILER_DEPS should be something that could be passed to + # java-config -p + local build_compiler_deps="$(source ${JAVA_PKG_COMPILER_DIR}/${compiler} 1>/dev/null 2>&1; echo ${ANT_BUILD_COMPILER_DEPS})" + if [[ -n ${build_compiler_deps} ]]; then + antflags="${antflags} -lib $(java-config -p ${build_compiler_deps})" + fi + fi + + for arg in "${@}"; do + if [[ ${arg} = -lib ]]; then + if is-java-strict; then + eerror "You should not use the -lib argument to eant because it will fail" + eerror "with JAVA_PKG_STRICT. Please use for example java-pkg_jar-from" + eerror "or ant properties to make dependencies available." + eerror "For ant tasks use WANT_ANT_TASKS or ANT_TASKS from." + eerror "split ant (>=dev-java/ant-core-1.7)." + die "eant -lib is deprecated/forbidden" + else + echo "eant -lib is deprecated. Turn JAVA_PKG_STRICT on for" + echo "more info." + fi + fi + done + + # parse WANT_ANT_TASKS for atoms + local want_ant_tasks + for i in ${WANT_ANT_TASKS}; do + if [[ ${i} = */*:* ]]; then + i=${i#*/} + i=${i%:0} + want_ant_tasks+="${i/:/-} " + else + want_ant_tasks+="${i} " + fi + done + # default ANT_TASKS to WANT_ANT_TASKS, if ANT_TASKS is not set explicitly + ANT_TASKS="${ANT_TASKS:-${want_ant_tasks% }}" + + # override ANT_TASKS with JAVA_PKG_FORCE_ANT_TASKS if it's set + ANT_TASKS="${JAVA_PKG_FORCE_ANT_TASKS:-${ANT_TASKS}}" + + # if ant-tasks is not set by ebuild or forced, use none + ANT_TASKS="${ANT_TASKS:-none}" + + # at this point, ANT_TASKS should be "all", "none" or explicit list + if [[ "${ANT_TASKS}" == "all" ]]; then + einfo "Using all available ANT_TASKS" + elif [[ "${ANT_TASKS}" == "none" ]]; then + einfo "Disabling all optional ANT_TASKS" + else + einfo "Using following ANT_TASKS: ${ANT_TASKS}" + fi + + export ANT_TASKS + + [[ -n ${JAVA_PKG_DEBUG} ]] && antflags="${antflags} --execdebug -debug" + [[ -n ${PORTAGE_QUIET} ]] && antflags="${antflags} -q" + + local gcp="${EANT_GENTOO_CLASSPATH}" + local getjarsarg="" + + if [[ ${EBUILD_PHASE} = "test" ]]; then + antflags="${antflags} -DJunit.present=true" + [[ ${ANT_TASKS} = *ant-junit* ]] && gcp="${gcp} junit" + getjarsarg="--with-dependencies" + fi + + local cp + + for atom in ${gcp}; do + cp="${cp}:$(java-pkg_getjars ${getjarsarg} ${atom})" + done + + [[ -n "${EANT_NEEDS_TOOLS}" ]] && cp="${cp}:$(java-config --tools)" + + if [[ ${cp} ]]; then + # It seems ant does not like single quotes around ${cp} + cp=${cp#:} + [[ ${EANT_GENTOO_CLASSPATH_EXTRA} ]] && \ + cp="${cp}:${EANT_GENTOO_CLASSPATH_EXTRA}" + antflags="${antflags} -Dgentoo.classpath=\"${cp}\"" + fi + + [[ -n ${JAVA_PKG_DEBUG} ]] && echo ant ${antflags} "${@}" + debug-print "Calling ant (GENTOO_VM: ${GENTOO_VM}): ${antflags} ${@}" + ant ${antflags} "${@}" || die "eant failed" +} + +# ------------------------------------------------------------------------------ +# @ebuild-function ejavac +# +# Javac wrapper function. Will use the appropriate compiler, based on +# /etc/java-config/compilers.conf +# +# @param $@ - Arguments to be passed to the compiler +# ------------------------------------------------------------------------------ +ejavac() { + debug-print-function ${FUNCNAME} $* + + java-pkg_init-compiler_ + + local compiler_executable + compiler_executable=$(java-pkg_get-javac) + if [[ ${?} != 0 ]]; then + eerror "There was a problem determining compiler: ${compiler_executable}" + die "get-javac failed" + fi + + local javac_args + javac_args="$(java-pkg_javac-args)" + if [[ ${?} != 0 ]]; then + eerror "There was a problem determining JAVACFLAGS: ${javac_args}" + die "java-pkg_javac-args failed" + fi + + [[ -n ${JAVA_PKG_DEBUG} ]] && echo ${compiler_executable} ${javac_args} "${@}" + ${compiler_executable} ${javac_args} "${@}" || die "ejavac failed" +} + +# ------------------------------------------------------------------------------ +# @ebuild-function java-pkg_filter-compiler +# +# Used to prevent the use of some compilers. Should be used in src_compile. +# Basically, it just appends onto JAVA_PKG_FILTER_COMPILER +# +# @param $@ - compilers to filter +# ------------------------------------------------------------------------------ +java-pkg_filter-compiler() { + JAVA_PKG_FILTER_COMPILER="${JAVA_PKG_FILTER_COMPILER} $@" +} + +# ------------------------------------------------------------------------------ +# @ebuild-function java-pkg_force-compiler +# +# Used to force the use of particular compilers. Should be used in src_compile. +# A common use of this would be to force ecj-3.1 to be used on amd64, to avoid +# OutOfMemoryErrors that may come up. +# +# @param $@ - compilers to force +# ------------------------------------------------------------------------------ +java-pkg_force-compiler() { + JAVA_PKG_FORCE_COMPILER="$@" +} + +# ------------------------------------------------------------------------------ +# @ebuild-function use_doc +# +# Helper function for getting ant to build javadocs. If the user has USE=doc, +# then 'javadoc' or the argument are returned. Otherwise, there is no return. +# +# The output of this should be passed to ant. +# +# Example: build javadocs by calling 'javadoc' target +# eant $(use_doc) +# Example: build javadocs by calling 'apidoc' target +# eant $(use_doc apidoc) +# +# @param $@ - Option value to return. Defaults to 'javadoc' +# @return string - Name of the target to create javadocs +# ------------------------------------------------------------------------------ +use_doc() { + use doc && echo ${@:-javadoc} +} + + +# ------------------------------------------------------------------------------ +# @section-end build +# ------------------------------------------------------------------------------ + +# ------------------------------------------------------------------------------ +# @section-begin internal +# @section-summary Internal functions +# +# Do __NOT__ use any of these from an ebuild! These are only to be used from +# within the java eclasses. +# ------------------------------------------------------------------------------ + +# ----------------------------------------------------------------------------- +# @function-internal java-pkg_init +# +# The purpose of this function, as the name might imply, is to initialize the +# Java environment. It ensures that that there aren't any environment variables +# that'll muss things up. It initializes some variables, which are used +# internally. And most importantly, it'll switch the VM if necessary. +# +# This shouldn't be used directly. Instead, java-pkg and java-pkg-opt will +# call it during each of the phases of the merge process. +# +# ----------------------------------------------------------------------------- +java-pkg_init() { + debug-print-function ${FUNCNAME} $* + unset JAVAC + unset JAVA_HOME + + java-config --help >/dev/null || { + eerror "" + eerror "Can't run java-config --help" + eerror "Have you upgraded python recently but haven't" + eerror "run python-updater yet?" + die "Can't run java-config --help" + } + + # People do all kinds of weird things. + # http://forums.gentoo.org/viewtopic-p-3943166.html + local silence="${SILENCE_JAVA_OPTIONS_WARNING}" + local accept="${I_WANT_GLOBAL_JAVA_OPTIONS}" + if [[ -n ${_JAVA_OPTIONS} && -z ${accept} && -z ${silence} ]]; then + ewarn "_JAVA_OPTIONS changes what java -version outputs at least for" + ewarn "sun-jdk vms and and as such break configure scripts that" + ewarn "use it (for example app-office/openoffice) so we filter it out." + ewarn "Use SILENCE_JAVA_OPTIONS_WARNING=true in the environment (use" + ewarn "make.conf for example) to silence this warning or" + ewarn "I_WANT_GLOBAL_JAVA_OPTIONS to not filter it." + fi + + if [[ -z ${accept} ]]; then + # export _JAVA_OPTIONS= doesn't work because it will show up in java + # -version output + unset _JAVA_OPTIONS + # phase hooks make this run many times without this + I_WANT_GLOBAL_JAVA_OPTIONS="true" + fi + + if java-pkg_func-exists ant_src_unpack; then + java-pkg_announce-qa-violation "Using old ant_src_unpack. Should be src_unpack" + fi + + java-pkg_init_paths_ + java-pkg_switch-vm + PATH=${JAVA_HOME}/bin:${PATH} + + # TODO we will probably want to set JAVAC and JAVACFLAGS + + # Do some QA checks + java-pkg_check-jikes + + # Can't use unset here because Portage does not save the unset + # see https://bugs.gentoo.org/show_bug.cgi?id=189417#c11 + + # When users have crazy classpaths some packages can fail to compile. + # and everything should work with empty CLASSPATH. + # This also helps prevent unexpected dependencies on random things + # from the CLASSPATH. + export CLASSPATH= + + # Unset external ANT_ stuff + export ANT_TASKS= + export ANT_OPTS= + export ANT_RESPECT_JAVA_HOME= +} + +# ------------------------------------------------------------------------------ +# @function-internal java-pkg-init-compiler_ +# +# This function attempts to figure out what compiler should be used. It does +# this by reading the file at JAVA_PKG_COMPILERS_CONF, and checking the +# COMPILERS variable defined there. +# This can be overridden by a list in JAVA_PKG_FORCE_COMPILER +# +# It will go through the list of compilers, and verify that it supports the +# target and source that are needed. If it is not suitable, then the next +# compiler is checked. When JAVA_PKG_FORCE_COMPILER is defined, this checking +# isn't done. +# +# Once the which compiler to use has been figured out, it is set to +# GENTOO_COMPILER. +# +# If you hadn't guessed, JAVA_PKG_FORCE_COMPILER is for testing only. +# +# If the user doesn't defined anything in JAVA_PKG_COMPILERS_CONF, or no +# suitable compiler was found there, then the default is to use javac provided +# by the current VM. +# +# +# @return name of the compiler to use +# ------------------------------------------------------------------------------ +java-pkg_init-compiler_() { + debug-print-function ${FUNCNAME} $* + + if [[ -n ${GENTOO_COMPILER} ]]; then + debug-print "GENTOO_COMPILER already set" + return + fi + + local compilers; + if [[ -z ${JAVA_PKG_FORCE_COMPILER} ]]; then + compilers="$(source ${JAVA_PKG_COMPILERS_CONF} 1>/dev/null 2>&1; echo ${COMPILERS})" + else + compilers=${JAVA_PKG_FORCE_COMPILER} + fi + + debug-print "Read \"${compilers}\" from ${JAVA_PKG_COMPILERS_CONF}" + + # Figure out if we should announce what compiler we're using + local compiler + for compiler in ${compilers}; do + debug-print "Checking ${compiler}..." + # javac should always be alright + if [[ ${compiler} = "javac" ]]; then + debug-print "Found javac... breaking" + export GENTOO_COMPILER="javac" + break + fi + + if has ${compiler} ${JAVA_PKG_FILTER_COMPILER}; then + if [[ -z ${JAVA_PKG_FORCE_COMPILER} ]]; then + einfo "Filtering ${compiler}" + continue + fi + fi + + # for non-javac, we need to make sure it supports the right target and + # source + local compiler_env="${JAVA_PKG_COMPILER_DIR}/${compiler}" + if [[ -f ${compiler_env} ]]; then + local desired_target="$(java-pkg_get-target)" + local desired_source="$(java-pkg_get-source)" + + + # Verify that the compiler supports target + local supported_target=$(source ${compiler_env} 1>/dev/null 2>&1; echo ${SUPPORTED_TARGET}) + if ! has ${desired_target} ${supported_target}; then + ewarn "${compiler} does not support -target ${desired_target}, skipping" + continue + fi + + # -source was introduced in 1.3, so only check 1.3 and on + if version_is_at_least "${desired_soure}" "1.3"; then + # Verify that the compiler supports source + local supported_source=$(source ${compiler_env} 1>/dev/null 2>&1; echo ${SUPPORTED_SOURCE}) + if ! has ${desired_source} ${supported_source}; then + ewarn "${compiler} does not support -source ${desired_source}, skipping" + continue + fi + fi + + # if you get here, then the compiler should be good to go + export GENTOO_COMPILER="${compiler}" + break + else + ewarn "Could not find configuration for ${compiler}, skipping" + ewarn "Perhaps it is not installed?" + continue + fi + done + + # If it hasn't been defined already, default to javac + if [[ -z ${GENTOO_COMPILER} ]]; then + if [[ -n ${compilers} ]]; then + einfo "No suitable compiler found: defaulting to JDK default for compilation" + else + # probably don't need to notify users about the default. + :;#einfo "Defaulting to javac for compilation" + fi + if java-config -g GENTOO_COMPILER 2> /dev/null; then + export GENTOO_COMPILER=$(java-config -g GENTOO_COMPILER) + else + export GENTOO_COMPILER=javac + fi + else + einfo "Using ${GENTOO_COMPILER} for compilation" + fi + +} + +# ------------------------------------------------------------------------------ +# @internal-function init_paths_ +# +# Initializes some variables that will be used. These variables are mostly used +# to determine where things will eventually get installed. +# ------------------------------------------------------------------------------ +java-pkg_init_paths_() { + debug-print-function ${FUNCNAME} $* + + local pkg_name + if [[ "$SLOT" == "0" ]] ; then + JAVA_PKG_NAME="${PN}" + else + JAVA_PKG_NAME="${PN}-${SLOT}" + fi + + JAVA_PKG_SHAREPATH="${DESTTREE}/share/${JAVA_PKG_NAME}" + JAVA_PKG_SOURCESPATH="${JAVA_PKG_SHAREPATH}/sources/" + JAVA_PKG_ENV="${D}${JAVA_PKG_SHAREPATH}/package.env" + JAVA_PKG_VIRTUALS_PATH="${DESTTREE}/share/java-config-2/virtuals" + JAVA_PKG_VIRTUAL_PROVIDER="${D}/${JAVA_PKG_VIRTUALS_PATH}/${JAVA_PKG_NAME}" + + [[ -z "${JAVA_PKG_JARDEST}" ]] && JAVA_PKG_JARDEST="${JAVA_PKG_SHAREPATH}/lib" + [[ -z "${JAVA_PKG_LIBDEST}" ]] && JAVA_PKG_LIBDEST="${DESTTREE}/$(get_libdir)/${JAVA_PKG_NAME}" + [[ -z "${JAVA_PKG_WARDEST}" ]] && JAVA_PKG_WARDEST="${JAVA_PKG_SHAREPATH}/webapps" + + + # TODO maybe only print once? + debug-print "JAVA_PKG_SHAREPATH: ${JAVA_PKG_SHAREPATH}" + debug-print "JAVA_PKG_ENV: ${JAVA_PKG_ENV}" + debug-print "JAVA_PKG_JARDEST: ${JAVA_PKG_JARDEST}" + debug-print "JAVA_PKG_LIBDEST: ${JAVA_PKG_LIBDEST}" + debug-print "JAVA_PKG_WARDEST: ${JAVA_PKG_WARDEST}" +} + +# ------------------------------------------------------------------------------ +# @internal-function java-pkg_do_write_ +# +# Writes the package.env out to disk. +# +# ------------------------------------------------------------------------------ +# TODO change to do-write, to match everything else +java-pkg_do_write_() { + debug-print-function ${FUNCNAME} $* + java-pkg_init_paths_ + # Create directory for package.env + dodir "${JAVA_PKG_SHAREPATH}" + if [[ -n "${JAVA_PKG_CLASSPATH}" || -n "${JAVA_PKG_LIBRARY}" || -f \ + "${JAVA_PKG_DEPEND_FILE}" || -f \ + "${JAVA_PKG_OPTIONAL_DEPEND_FILE}" ]]; then + # Create package.env + ( + echo "DESCRIPTION=\"${DESCRIPTION}\"" + echo "GENERATION=\"2\"" + echo "SLOT=\"${SLOT}\"" + echo "CATEGORY=\"${CATEGORY}\"" + echo "PVR=\"${PVR}\"" + + [[ -n "${JAVA_PKG_CLASSPATH}" ]] && echo "CLASSPATH=\"${JAVA_PKG_CLASSPATH}\"" + [[ -n "${JAVA_PKG_LIBRARY}" ]] && echo "LIBRARY_PATH=\"${JAVA_PKG_LIBRARY}\"" + [[ -n "${JAVA_PROVIDE}" ]] && echo "PROVIDES=\"${JAVA_PROVIDE}\"" + [[ -f "${JAVA_PKG_DEPEND_FILE}" ]] \ + && echo "DEPEND=\"$(cat "${JAVA_PKG_DEPEND_FILE}" | uniq | tr '\n' ':')\"" + [[ -f "${JAVA_PKG_OPTIONAL_DEPEND_FILE}" ]] \ + && echo "OPTIONAL_DEPEND=\"$(cat "${JAVA_PKG_OPTIONAL_DEPEND_FILE}" | uniq | tr '\n' ':')\"" + echo "VM=\"$(echo ${RDEPEND} ${DEPEND} | sed -e 's/ /\n/g' | sed -n -e '/virtual\/\(jre\|jdk\)/ { p;q }')\"" # TODO cleanup ! + [[ -f "${JAVA_PKG_BUILD_DEPEND_FILE}" ]] \ + && echo "BUILD_DEPEND=\"$(cat "${JAVA_PKG_BUILD_DEPEND_FILE}" | uniq | tr '\n' ':')\"" + ) > "${JAVA_PKG_ENV}" + + # register target/source + local target="$(java-pkg_get-target)" + local source="$(java-pkg_get-source)" + [[ -n ${target} ]] && echo "TARGET=\"${target}\"" >> "${JAVA_PKG_ENV}" + [[ -n ${source} ]] && echo "SOURCE=\"${source}\"" >> "${JAVA_PKG_ENV}" + + # register javadoc info + [[ -n ${JAVADOC_PATH} ]] && echo "JAVADOC_PATH=\"${JAVADOC_PATH}\"" \ + >> ${JAVA_PKG_ENV} + # register source archives + [[ -n ${JAVA_SOURCES} ]] && echo "JAVA_SOURCES=\"${JAVA_SOURCES}\"" \ + >> ${JAVA_PKG_ENV} + + + echo "MERGE_VM=\"${GENTOO_VM}\"" >> "${JAVA_PKG_ENV}" + [[ -n ${GENTOO_COMPILER} ]] && echo "MERGE_COMPILER=\"${GENTOO_COMPILER}\"" >> "${JAVA_PKG_ENV}" + + # extra env variables + if [[ -n "${JAVA_PKG_EXTRA_ENV_VARS}" ]]; then + cat "${JAVA_PKG_EXTRA_ENV}" >> "${JAVA_PKG_ENV}" || die + # nested echo to remove leading/trailing spaces + echo "ENV_VARS=\"$(echo ${JAVA_PKG_EXTRA_ENV_VARS})\"" \ + >> "${JAVA_PKG_ENV}" || die + fi + + # Strip unnecessary leading and trailing colons + # TODO try to cleanup if possible + sed -e "s/=\":/=\"/" -e "s/:\"$/\"/" -i "${JAVA_PKG_ENV}" || die "Did you forget to call java_init ?" + else + debug-print "JAVA_PKG_CLASSPATH, JAVA_PKG_LIBRARY, JAVA_PKG_DEPEND_FILE" + debug-print "or JAVA_PKG_OPTIONAL_DEPEND_FILE not defined so can't" + debug-print "write package.env." + fi +} + +# ------------------------------------------------------------------------------ +# @internal-function java-pkg_record-jar_ +# +# Record an (optional) dependency to the package.env +# @param --optional - record dependency as optional +# @param --build - record dependency as build_only +# @param $1 - package to record +# @param $2 - (optional) jar of package to record +# ------------------------------------------------------------------------------ +JAVA_PKG_DEPEND_FILE="${T}/java-pkg-depend" +JAVA_PKG_OPTIONAL_DEPEND_FILE="${T}/java-pkg-optional-depend" +JAVA_PKG_BUILD_DEPEND_FILE="${T}/java-pkg-build-depend" + +java-pkg_record-jar_() { + debug-print-function ${FUNCNAME} $* + + local depend_file="${JAVA_PKG_DEPEND_FILE}" + case "${1}" in + "--optional") depend_file="${JAVA_PKG_OPTIONAL_DEPEND_FILE}"; shift;; + "--build-only") depend_file="${JAVA_PKG_BUILD_DEPEND_FILE}"; shift;; + esac + + local pkg=${1} jar=${2} append + if [[ -z "${jar}" ]]; then + append="${pkg}" + else + append="$(basename ${jar})@${pkg}" + fi + + echo "${append}" >> "${depend_file}" +} + +# ------------------------------------------------------------------------------ +# @internal-function java-pkg_append_ +# +# Appends a value to a variable +# +# Example: java-pkg_append_ CLASSPATH foo.jar +# @param $1 variable name to modify +# @param $2 value to append +# ------------------------------------------------------------------------------ +java-pkg_append_() { + debug-print-function ${FUNCNAME} $* + + local var="${1}" value="${2}" + if [[ -z "${!var}" ]] ; then + export ${var}="${value}" + else + local oldIFS=${IFS} cur haveit + IFS=':' + for cur in ${!var}; do + if [[ ${cur} == ${value} ]]; then + haveit="yes" + break + fi + done + [[ -z ${haveit} ]] && export ${var}="${!var}:${value}" + IFS=${oldIFS} + fi +} + +# ------------------------------------------------------------------------------ +# @internal-function java-pkg_expand_dir_ +# +# Gets the full path of the file/directory's parent. +# @param $1 - file/directory to find parent directory for +# @return - path to $1's parent directory +# ------------------------------------------------------------------------------ +java-pkg_expand_dir_() { + pushd "$(dirname "${1}")" >/dev/null 2>&1 + pwd + popd >/dev/null 2>&1 +} + +# ------------------------------------------------------------------------------ +# @internal-function java-pkg_func-exists +# +# Does the indicated function exist? +# +# @return 0 - function is declared +# @return 1 - function is undeclared +# ------------------------------------------------------------------------------ +java-pkg_func-exists() { + declare -F ${1} > /dev/null +} + +# ------------------------------------------------------------------------------ +# @internal-function java-pkg_setup-vm +# +# Sets up the environment for a specific VM +# +# ------------------------------------------------------------------------------ +java-pkg_setup-vm() { + debug-print-function ${FUNCNAME} $* + + export LANG="C" LC_ALL="C" + + local vendor="$(java-pkg_get-vm-vendor)" + if [[ "${vendor}" == "sun" ]] && java-pkg_is-vm-version-ge "1.5" ; then + addpredict "/dev/random" + elif [[ "${vendor}" == "ibm" ]]; then + addpredict "/proc/self/maps" + addpredict "/proc/cpuinfo" + elif [[ "${vendor}" == "jrockit" ]]; then + addpredict "/proc/cpuinfo" + fi +} + +# ------------------------------------------------------------------------------ +# @internal-function java-pkg_needs-vm +# +# Does the current package depend on virtual/jdk? +# +# @return 0 - Package depends on virtual/jdk +# @return 1 - Package does not depend on virtual/jdk +# ------------------------------------------------------------------------------ +java-pkg_needs-vm() { + debug-print-function ${FUNCNAME} $* + + if [[ -n "$(echo ${DEPEND} | sed -e '\:virtual/jdk:!d')" ]]; then + return 0 + fi + + return 1 +} + +# ------------------------------------------------------------------------------ +# @internal-function java-pkg_get-current-vm +# +# @return - The current VM being used +# ------------------------------------------------------------------------------ +java-pkg_get-current-vm() { + java-config -f +} + +# ------------------------------------------------------------------------------ +# @internal-function java-pkg_get-vm-vendor +# +# @return - The vendor of the current VM +# ------------------------------------------------------------------------------ +java-pkg_get-vm-vendor() { + debug-print-function ${FUNCNAME} $* + + local vm="$(java-pkg_get-current-vm)" + vm="${vm/-*/}" + echo "${vm}" +} + +# ------------------------------------------------------------------------------ +# @internal-function java-pkg_get-vm-version +# +# @return - The version of the current VM +# ------------------------------------------------------------------------------ +java-pkg_get-vm-version() { + debug-print-function ${FUNCNAME} $* + + java-config -g PROVIDES_VERSION +} + +# ------------------------------------------------------------------------------ +# @internal-function java-pkg_switch-vm +# +# Switch VM if we're allowed to (controlled by JAVA_PKG_ALLOW_VM_CHANGE), and +# verify that the current VM is sufficient. +# Setup the environment for the VM being used. +# ------------------------------------------------------------------------------ +java-pkg_switch-vm() { + debug-print-function ${FUNCNAME} $* + + if java-pkg_needs-vm; then + # Use the VM specified by JAVA_PKG_FORCE_VM + if [[ -n "${JAVA_PKG_FORCE_VM}" ]]; then + # If you're forcing the VM, I hope you know what your doing... + debug-print "JAVA_PKG_FORCE_VM used: ${JAVA_PKG_FORCE_VM}" + export GENTOO_VM="${JAVA_PKG_FORCE_VM}" + # if we're allowed to switch the vm... + elif [[ "${JAVA_PKG_ALLOW_VM_CHANGE}" == "yes" ]]; then + debug-print "depend-java-query: NV_DEPEND: ${JAVA_PKG_NV_DEPEND:-${DEPEND}}" + GENTOO_VM="$(depend-java-query --get-vm "${JAVA_PKG_NV_DEPEND:-${DEPEND}}")" + if [[ -z "${GENTOO_VM}" || "${GENTOO_VM}" == "None" ]]; then + eerror "Unable to determine VM for building from dependencies:" + echo "NV_DEPEND: ${JAVA_PKG_NV_DEPEND:-${DEPEND}}" + die "Failed to determine VM for building." + else + export GENTOO_VM + fi + # otherwise just make sure the current VM is sufficient + else + java-pkg_ensure-vm-version-sufficient + fi + debug-print "Using: $(java-config -f)" + + java-pkg_setup-vm + + export JAVA=$(java-config --java) + export JAVAC=$(java-config --javac) + JAVACFLAGS="$(java-pkg_javac-args)" + if [[ ${?} != 0 ]]; then + eerror "There was a problem determining JAVACFLAGS: ${JAVACFLAGS}" + die "java-pkg_javac-args failed" + fi + [[ -n ${JAVACFLAGS_EXTRA} ]] && JAVACFLAGS="${JAVACFLAGS_EXTRA} ${JAVACFLAGS}" + export JAVACFLAGS + + export JAVA_HOME="$(java-config -g JAVA_HOME)" + export JDK_HOME=${JAVA_HOME} + + #TODO If you know a better solution let us know. + java-pkg_append_ LD_LIBRARY_PATH "$(java-config -g LDPATH)" + + local tann="${T}/announced-vm" + # With the hooks we should only get here once from pkg_setup but better safe than sorry + # if people have for example modified eclasses some where + if [[ -n "${JAVA_PKG_DEBUG}" ]] || [[ ! -f "${tann}" ]] ; then + einfo "Using: $(java-config -f)" + [[ ! -f "${tann}" ]] && touch "${tann}" + fi + + else + [[ -n "${JAVA_PKG_DEBUG}" ]] && ewarn "!!! This package inherits java-pkg but doesn't depend on a JDK. -bin or broken dependency!!!" + fi +} + +# ------------------------------------------------------------------------------ +# @internal-function java-pkg_die +# +# Enhanced die for Java packages, which displays some information that may be +# useful for debugging bugs on bugzilla. +# ------------------------------------------------------------------------------ +#register_die_hook java-pkg_die +if ! has java-pkg_die ${EBUILD_DEATH_HOOKS}; then + EBUILD_DEATH_HOOKS="${EBUILD_DEATH_HOOKS} java-pkg_die" +fi + +java-pkg_die() { + echo "!!! When you file a bug report, please include the following information:" >&2 + echo "GENTOO_VM=${GENTOO_VM} CLASSPATH=\"${CLASSPATH}\" JAVA_HOME=\"${JAVA_HOME}\"" >&2 + echo "JAVACFLAGS=\"${JAVACFLAGS}\" COMPILER=\"${GENTOO_COMPILER}\"" >&2 + echo "and of course, the output of emerge --info" >&2 +} + + +# TODO document +# List jars in the source directory, ${S} +java-pkg_jar-list() { + if [[ -n "${JAVA_PKG_DEBUG}" ]]; then + einfo "Linked Jars" + find "${S}" -type l -name '*.jar' -print0 | xargs -0 -r -n 500 ls -ald | sed -e "s,${WORKDIR},\${WORKDIR}," + einfo "Jars" + find "${S}" -type f -name '*.jar' -print0 | xargs -0 -r -n 500 ls -ald | sed -e "s,${WORKDIR},\${WORKDIR}," + einfo "Classes" + find "${S}" -type f -name '*.class' -print0 | xargs -0 -r -n 500 ls -ald | sed -e "s,${WORKDIR},\${WORKDIR}," + fi +} + +# ------------------------------------------------------------------------------ +# @internal-function java-pkg_verify-classes +# +# Verify that the classes were compiled for the right source / target. Dies if +# not. +# @param $1 (optional) - the file to check, otherwise checks whole ${D} +# ------------------------------------------------------------------------------ +java-pkg_verify-classes() { + #$(find ${D} -type f -name '*.jar' -o -name '*.class') + + local version_verify="/usr/bin/class-version-verify.py" + + if [[ ! -x "${version_verify}" ]]; then + version_verify="/usr/$(get_libdir)/javatoolkit/bin/class-version-verify.py" + fi + + if [[ ! -x "${version_verify}" ]]; then + ewarn "Unable to perform class version checks as" + ewarn "class-version-verify.py is unavailable" + ewarn "Please install dev-java/javatoolkit." + return + fi + + local target=$(java-pkg_get-target) + local result + local log="${T}/class-version-verify.log" + if [[ -n "${1}" ]]; then + ${version_verify} -v -t ${target} "${1}" > "${log}" + result=$? + else + ebegin "Verifying java class versions (target: ${target})" + ${version_verify} -v -t ${target} -r "${D}" > "${log}" + result=$? + eend ${result} + fi + [[ -n ${JAVA_PKG_DEBUG} ]] && cat "${log}" + if [[ ${result} != 0 ]]; then + eerror "Incorrect bytecode version found" + [[ -n "${1}" ]] && eerror "in file: ${1}" + eerror "See ${log} for more details." + die "Incorrect bytecode found" + fi +} + +# ---------------------------------------------------------------------------- +# @internal-function java-pkg_ensure-dep +# Check that a package being used in jarfrom, getjars and getjar is contained +# within DEPEND or RDEPEND. +# @param $1 - empty - check both vars; "runtime" or "build" - check only +# RDEPEND, resp. DEPEND +# @param $2 - Package name and slot. + +java-pkg_ensure-dep() { + debug-print-function ${FUNCNAME} $* + + local limit_to="${1}" + local target_pkg="${2}" + local dev_error="" + + local stripped_pkg=$(echo "${target_pkg}" | sed \ + 's/-[0-9]*\(\.[0-9]\)*$//') + + debug-print "Matching against: ${stripped_pkg}" + + if [[ ${limit_to} != runtime && ! ( "${DEPEND}" =~ "$stripped_pkg" ) ]]; then + dev_error="The ebuild is attempting to use ${target_pkg} that is not" + dev_error="${dev_error} declared in DEPEND." + if is-java-strict; then + eerror "${dev_error}" + die "${dev_error}" + elif [[ ${BASH_SUBSHELL} = 0 ]]; then + eerror "${dev_error}" + elog "Because you have this package installed the package will" + elog "build without problems, but please report this to" + elog "http://bugs.gentoo.org" + fi + fi + + if [[ ${limit_to} != build ]]; then + if [[ ! ( ${RDEPEND} =~ "${stripped_pkg}" ) ]]; then + if [[ ! ( ${PDEPEND} =~ "${stripped_pkg}" ) ]]; then + dev_error="The ebuild is attempting to use ${target_pkg}," + dev_error="${dev_error} without specifying --build-only, that is not declared in RDEPEND" + dev_error="${dev_error} or PDEPEND." + if is-java-strict; then + eerror "${dev_error}" + die "${dev_error}" + elif [[ ${BASH_SUBSHELL} = 0 ]]; then + eerror "${dev_error}" + elog "The package will build without problems, but may fail to run" + elog "if you don't have ${target_pkg} installed, so please report" + elog "this to http://bugs.gentoo.org" + fi + fi + fi + fi +} + +# ------------------------------------------------------------------------------ +# @section-end internal +# ------------------------------------------------------------------------------ + +java-pkg_check-phase() { + local phase=${1} + local funcname=${FUNCNAME[1]} + if [[ ${EBUILD_PHASE} != ${phase} ]]; then + local msg="${funcname} used outside of src_${phase}" + java-pkg_announce-qa-violation "${msg}" + fi +} + +java-pkg_check-versioned-jar() { + local jar=${1} + + if [[ ${jar} =~ ${PV} ]]; then + java-pkg_announce-qa-violation "installing versioned jar '${jar}'" + fi +} + +java-pkg_check-jikes() { + if has jikes ${IUSE}; then + java-pkg_announce-qa-violation "deprecated USE flag 'jikes' in IUSE" + fi +} + +java-pkg_announce-qa-violation() { + local nodie + if [[ ${1} == "--nodie" ]]; then + nodie="true" + shift + fi + echo "Java QA Notice: $@" >&2 + increment-qa-violations + [[ -z "${nodie}" ]] && is-java-strict && die "${@}" +} + +increment-qa-violations() { + let "JAVA_PKG_QA_VIOLATIONS+=1" + export JAVA_PKG_QA_VIOLATIONS +} + +is-java-strict() { + [[ -n ${JAVA_PKG_STRICT} ]] + return $? +} + + +# ------------------------------------------------------------------------------ +# @eclass-end +# ------------------------------------------------------------------------------ diff --git a/sdk_container/src/third_party/portage-stable/eclass/java-utils.eclass b/sdk_container/src/third_party/portage-stable/eclass/java-utils.eclass new file mode 100644 index 0000000000..4b731a73eb --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/java-utils.eclass @@ -0,0 +1,7 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils.eclass,v 1.12 2009/11/30 04:19:36 abcd Exp $ + +# @DEAD +# To be removed on 2011/11/30. +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" diff --git a/sdk_container/src/third_party/portage-stable/eclass/java-virtuals-2.eclass b/sdk_container/src/third_party/portage-stable/eclass/java-virtuals-2.eclass new file mode 100644 index 0000000000..ed52a2b0d5 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/java-virtuals-2.eclass @@ -0,0 +1,44 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/java-virtuals-2.eclass,v 1.6 2009/08/27 21:49:04 ali_bush Exp $ + +# Original Author: Alistair John Bush +# Purpose: To provide a default (and only) src_install function +# for ebuilds in the java-virtuals category. + +inherit java-utils-2 + +DEPEND=">=dev-java/java-config-2.1.6" +RDEPEND="${DEPEND}" + +EXPORT_FUNCTIONS src_install + +java-virtuals-2_src_install() { + java-virtuals-2_do_write +} + +# ------------------------------------------------------------------------------ +# @internal-function java-pkg_do_virtuals_write +# +# Writes the virtual env file out to disk. +# +# ------------------------------------------------------------------------------ +java-virtuals-2_do_write() { + java-pkg_init_paths_ + + dodir "${JAVA_PKG_VIRTUALS_PATH}" + { + if [[ -n "${JAVA_VIRTUAL_PROVIDES}" ]]; then + echo "PROVIDERS=\"${JAVA_VIRTUAL_PROVIDES}\"" + fi + + if [[ -n "${JAVA_VIRTUAL_VM}" ]]; then + echo "VM=\"${JAVA_VIRTUAL_VM}\"" + fi + + if [[ -n "${JAVA_VIRTUAL_VM_CLASSPATH}" ]]; then + echo "VM_CLASSPATH=\"${JAVA_VIRTUAL_VM_CLASSPATH}\"" + fi + echo "MULTI_PROVIDER=\"${JAVA_VIRTUAL_MULTI=FALSE}\"" + } > "${JAVA_PKG_VIRTUAL_PROVIDER}" +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/java-vm-2.eclass b/sdk_container/src/third_party/portage-stable/eclass/java-vm-2.eclass new file mode 100644 index 0000000000..c7374b49a3 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/java-vm-2.eclass @@ -0,0 +1,214 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/java-vm-2.eclass,v 1.29 2009/10/11 11:46:59 maekke Exp $ + +# ----------------------------------------------------------------------------- +# @eclass-begin +# @eclass-shortdesc Java Virtual Machine eclass +# @eclass-maintainer java@gentoo.org +# +# This eclass provides functionality which assists with installing +# virtual machines, and ensures that they are recognized by java-config. +# +# ----------------------------------------------------------------------------- + +inherit eutils fdo-mime + +DEPEND="=dev-java/java-config-2*" +hasq "${EAPI}" 0 1 && DEPEND="${DEPEND} >=sys-apps/portage-2.1" + +RDEPEND=" + =dev-java/java-config-2*" + +export WANT_JAVA_CONFIG=2 + +JAVA_VM_CONFIG_DIR="/usr/share/java-config-2/vm" +JAVA_VM_DIR="/usr/lib/jvm" +JAVA_VM_BUILD_ONLY="${JAVA_VM_BUILD_ONLY:-FALSE}" + +EXPORT_FUNCTIONS pkg_setup pkg_postinst pkg_prerm pkg_postrm + +java-vm-2_pkg_setup() { + if [[ "${SLOT}" != "0" ]]; then + VMHANDLE=${PN}-${SLOT} + else + VMHANDLE=${PN} + fi +} + +java-vm-2_pkg_postinst() { + # Set the generation-2 system VM, if it isn't set + if [[ -z "$(java-config-2 -f)" ]]; then + java_set_default_vm_ + fi + + java-vm_check-nsplugin + java_mozilla_clean_ + fdo-mime_desktop_database_update +} + +java-vm_check-nsplugin() { + local libdir + if [[ ${VMHANDLE} =~ emul-linux-x86 ]]; then + libdir=lib32 + else + libdir=lib + fi + # Install a default nsplugin if we don't already have one + if has nsplugin ${IUSE} && use nsplugin; then + if [[ ! -f /usr/${libdir}/nsbrowser/plugins/javaplugin.so ]]; then + einfo "No system nsplugin currently set." + java-vm_set-nsplugin + else + einfo "System nsplugin is already set, not changing it." + fi + einfo "You can change nsplugin with eselect java-nsplugin." + fi +} + +java-vm_set-nsplugin() { + local extra_args + if use amd64; then + if [[ ${VMHANDLE} =~ emul-linux-x86 ]]; then + extra_args="32bit" + else + extra_args="64bit" + fi + einfo "Setting ${extra_args} nsplugin to ${VMHANDLE}" + else + einfo "Setting nsplugin to ${VMHANDLE}..." + fi + eselect java-nsplugin set ${extra_args} ${VMHANDLE} +} + +java-vm-2_pkg_prerm() { + if [[ "$(java-config -f 2>/dev/null)" == "${VMHANDLE}" ]]; then + ewarn "It appears you are removing your system-vm!" + ewarn "Please run java-config -L to list available VMs," + ewarn "then use java-config -S to set a new system-vm!" + fi +} + +java-vm-2_pkg_postrm() { + fdo-mime_desktop_database_update +} + +java_set_default_vm_() { + java-config-2 --set-system-vm="${VMHANDLE}" + + einfo " ${P} set as the default system-vm." +} + +get_system_arch() { + local sarch + sarch=$(echo ${ARCH} | sed -e s/[i]*.86/i386/ -e s/x86_64/amd64/ -e s/sun4u/sparc/ -e s/sparc64/sparc/ -e s/arm.*/arm/ -e s/sa110/arm/) + if [ -z "${sarch}" ]; then + sarch=$(uname -m | sed -e s/[i]*.86/i386/ -e s/x86_64/amd64/ -e s/sun4u/sparc/ -e s/sparc64/sparc/ -e s/arm.*/arm/ -e s/sa110/arm/) + fi + echo ${sarch} +} + +# TODO rename to something more evident, like install_env_file +set_java_env() { + debug-print-function ${FUNCNAME} $* + local platform="$(get_system_arch)" + local env_file="${D}${JAVA_VM_CONFIG_DIR}/${VMHANDLE}" + local old_env_file="${D}/etc/env.d/java/20${P}" + if [[ ${1} ]]; then + local source_env_file="${1}" + else + local source_env_file="${FILESDIR}/${VMHANDLE}.env" + fi + + if [[ ! -f ${source_env_file} ]]; then + die "Unable to find the env file: ${source_env_file}" + fi + + dodir ${JAVA_VM_CONFIG_DIR} + sed \ + -e "s/@P@/${P}/g" \ + -e "s/@PN@/${PN}/g" \ + -e "s/@PV@/${PV}/g" \ + -e "s/@PF@/${PF}/g" \ + -e "s/@PLATFORM@/${platform}/g" \ + -e "/^LDPATH=.*lib\\/\\\"/s|\"\\(.*\\)\"|\"\\1${platform}/:\\1${platform}/server/\"|" \ + < ${source_env_file} \ + > ${env_file} || die "sed failed" + + ( + echo "VMHANDLE=\"${VMHANDLE}\"" + echo "BUILD_ONLY=\"${JAVA_VM_BUILD_ONLY}\"" + ) >> ${env_file} + + [[ -n ${JAVA_PROVIDE} ]] && echo "PROVIDES=\"${JAVA_PROVIDE}\"" >> ${env_file} + + local java_home=$(source ${env_file}; echo ${JAVA_HOME}) + [[ -z ${java_home} ]] && die "No JAVA_HOME defined in ${env_file}" + + # Make the symlink + dosym ${java_home} ${JAVA_VM_DIR}/${VMHANDLE} \ + || die "Failed to make VM symlink at ${JAVA_VM_DIR}/${VMHANDLE}" +} + +# ----------------------------------------------------------------------------- +# @ebuild-function java-vm_revdep-mask +# +# Installs a revdep-rebuild control file which SEARCH_DIR_MASK set to the path +# where the VM is installed. Prevents pointless rebuilds - see bug #177925. +# Also gives a notice to the user. +# +# @example +# java-vm_revdep-mask +# java-vm_revdep-mask /path/to/jdk/ +# +# @param $1 - Path of the VM (defaults to /opt/${P} if not set) +# ------------------------------------------------------------------------------ +java-vm_revdep-mask() { + local VMROOT="${1-/opt/${P}}" + + dodir /etc/revdep-rebuild/ + echo "SEARCH_DIRS_MASK=\"${VMROOT}\""> "${D}/etc/revdep-rebuild/61-${VMHANDLE}" + + elog "A revdep-rebuild control file was installed to prevent reinstalls due to" + elog "missing dependencies (see bug #177925 for more info). Note that some parts" + elog "of the JVM may require dependencies that are pulled only through respective" + elog "USE flags (typically X, alsa, odbc) and some Java code may fail without them." +} + +java_get_plugin_dir_() { + echo /usr/$(get_libdir)/nsbrowser/plugins +} + +install_mozilla_plugin() { + local plugin="${1}" + local variant="${2}" + + if [[ ! -f "${D}/${plugin}" ]]; then + die "Cannot find mozilla plugin at ${D}/${plugin}" + fi + + if [[ -n "${variant}" ]]; then + variant="-${variant}" + fi + + local plugin_dir="/usr/share/java-config-2/nsplugin" + dodir "${plugin_dir}" + dosym "${plugin}" "${plugin_dir}/${VMHANDLE}${variant}-javaplugin.so" +} + +java_mozilla_clean_() { + # Because previously some ebuilds installed symlinks outside of pkg_install + # and are left behind, which forces you to manualy remove them to select the + # jdk/jre you want to use for java + local plugin_dir=$(java_get_plugin_dir_) + for file in ${plugin_dir}/javaplugin_*; do + rm -f ${file} + done + for file in ${plugin_dir}/libjavaplugin*; do + rm -f ${file} + done +} + +# ------------------------------------------------------------------------------ +# @eclass-end +# ------------------------------------------------------------------------------ diff --git a/sdk_container/src/third_party/portage-stable/eclass/java.eclass b/sdk_container/src/third_party/portage-stable/eclass/java.eclass new file mode 100644 index 0000000000..bec6511617 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/java.eclass @@ -0,0 +1,16 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/java.eclass,v 1.33 2009/11/30 04:19:36 abcd Exp $ + +# @DEAD +# To be removed on 2011/11/30. +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" + +EXPORT_FUNCTIONS pkg_prerm + +java_pkg_prerm() { + if java-config -J | grep -q ${P} ; then + ewarn "It appears you are removing your default system VM!" + ewarn "Please run java-config -L then java-config -S to set a new system VM!" + fi +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/kde-dist.eclass b/sdk_container/src/third_party/portage-stable/eclass/kde-dist.eclass new file mode 100644 index 0000000000..fcdc637df4 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/kde-dist.eclass @@ -0,0 +1,7 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/kde-dist.eclass,v 1.77 2009/11/30 04:19:36 abcd Exp $ + +# @DEAD +# To be removed 2011/11/01. +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" diff --git a/sdk_container/src/third_party/portage-stable/eclass/kde-functions.eclass b/sdk_container/src/third_party/portage-stable/eclass/kde-functions.eclass new file mode 100644 index 0000000000..3a8fc73892 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/kde-functions.eclass @@ -0,0 +1,7 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/kde-functions.eclass,v 1.176 2010/01/11 20:51:39 abcd Exp $ + +# @DEAD +# KDE 3 is gone from the tree. Scheduled for removal after 2012/01/12. +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" diff --git a/sdk_container/src/third_party/portage-stable/eclass/kde-meta.eclass b/sdk_container/src/third_party/portage-stable/eclass/kde-meta.eclass new file mode 100644 index 0000000000..38b628cb21 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/kde-meta.eclass @@ -0,0 +1,7 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/kde-meta.eclass,v 1.92 2010/01/11 20:51:39 abcd Exp $ + +# @DEAD +# KDE 3 is gone from the tree. Scheduled for removal after 2012/01/12. +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" diff --git a/sdk_container/src/third_party/portage-stable/eclass/kde-source.eclass b/sdk_container/src/third_party/portage-stable/eclass/kde-source.eclass new file mode 100644 index 0000000000..833258565b --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/kde-source.eclass @@ -0,0 +1,8 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/kde-source.eclass,v 1.26 2009/11/30 04:19:36 abcd Exp $ + +# @DEAD +# This eclass was only for very old cvs versions of KDE, no longer used by +# anything. Scheduled for removal after 2011/06/04. +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" diff --git a/sdk_container/src/third_party/portage-stable/eclass/kde.eclass b/sdk_container/src/third_party/portage-stable/eclass/kde.eclass new file mode 100644 index 0000000000..52c2154eb5 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/kde.eclass @@ -0,0 +1,7 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/kde.eclass,v 1.226 2010/01/11 20:51:39 abcd Exp $ + +# @DEAD +# KDE 3 is gone from the tree. Scheduled for removal after 2012/01/12. +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" diff --git a/sdk_container/src/third_party/portage-stable/eclass/kde4-base.eclass b/sdk_container/src/third_party/portage-stable/eclass/kde4-base.eclass new file mode 100644 index 0000000000..2a29b3f8d9 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/kde4-base.eclass @@ -0,0 +1,726 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/kde4-base.eclass,v 1.58 2010/02/02 14:20:16 reavertm Exp $ + +# @ECLASS: kde4-base.eclass +# @MAINTAINER: +# kde@gentoo.org +# @BLURB: This eclass provides functions for kde 4.X ebuilds +# @DESCRIPTION: +# The kde4-base.eclass provides support for building KDE4 based ebuilds +# and KDE4 applications. +# +# NOTE: KDE 4 ebuilds by default define EAPI="2", this can be redefined but +# eclass will fail with version older than 2. + +# @ECLASS-VARIABLE: CMAKE_REQUIRED +# @DESCRIPTION: +# Specify if cmake buildsystem is being used. Possible values are 'always' and 'never'. +# Please note that if it's set to 'never' you need to explicitly override following phases: +# src_configure, src_compile, src_test and src_install. +# Defaults to 'always'. +: ${CMAKE_REQUIRED:=always} +if [[ ${CMAKE_REQUIRED} = false || ${CMAKE_REQUIRED} = never ]]; then + buildsystem_eclass="" + export_fns="" +else + buildsystem_eclass="cmake-utils" + export_fns="src_configure src_compile src_test src_install" +fi + +inherit kde4-functions + +get_build_type +if [[ ${BUILD_TYPE} = live ]]; then + subversion_eclass="subversion" +fi + +inherit base ${buildsystem_eclass} eutils ${subversion_eclass} + +EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare ${export_fns} pkg_postinst pkg_postrm + +unset buildsystem_eclass +unset export_fns +unset subversion_eclass + +case ${KDEBASE} in + kde-base) + HOMEPAGE="http://www.kde.org/" + LICENSE="GPL-2" + ;; + koffice) + HOMEPAGE="http://www.koffice.org/" + LICENSE="GPL-2" + ;; +esac + +# @ECLASS-VARIABLE: OPENGL_REQUIRED +# @DESCRIPTION: +# Is qt-opengl required? Possible values are 'always', 'optional' and 'never'. +# This variable must be set before inheriting any eclasses. Defaults to 'never'. +OPENGL_REQUIRED="${OPENGL_REQUIRED:-never}" + +# @ECLASS-VARIABLE: MULTIMEDIA_REQUIRED +# @DESCRIPTION: +# Is qt-multimedia required? Possible values are 'always', 'optional' and 'never'. +# This variable must be set before inheriting any eclasses. Defaults to 'never'. +MULTIMEDIA_REQUIRED="${MULTIMEDIA_REQUIRED:-never}" + +# @ECLASS-VARIABLE: WEBKIT_REQUIRED +# @DESCRIPTION: +# Is qt-webkit requred? Possible values are 'always', 'optional' and 'never'. +# This variable must be set before inheriting any eclasses. Defaults to 'never'. +WEBKIT_REQUIRED="${WEBKIT_REQUIRED:-never}" + +# @ECLASS-VARIABLE: CPPUNIT_REQUIRED +# @DESCRIPTION: +# Is cppunit required for tests? Possible values are 'always', 'optional' and 'never'. +# This variable must be set before inheriting any eclasses. Defaults to 'never'. +CPPUNIT_REQUIRED="${CPPUNIT_REQUIRED:-never}" + +# @ECLASS-VARIABLE: KDE_REQUIRED +# @DESCRIPTION: +# Is kde required? Possible values are 'always', 'optional' and 'never'. +# This variable must be set before inheriting any eclasses. Defaults to 'always' +# If set to always or optional, KDE_MINIMAL may be overriden as well. +# Note that for kde-base packages this variable is fixed to 'always'. +KDE_REQUIRED="${KDE_REQUIRED:-always}" + +# Verify KDE_MINIMAL (display QA notice in pkg_setup, still we need to fix it here) +if [[ -n ${KDE_MINIMAL} ]]; then + for slot in ${KDE_SLOTS[@]} ${KDE_LIVE_SLOTS[@]}; do + [[ ${KDE_MINIMAL} = ${slot} ]] && KDE_MINIMAL_VALID=1 && break + done + unset slot + [[ -z ${KDE_MINIMAL_VALID} ]] && unset KDE_MINIMAL +else + KDE_MINIMAL_VALID=1 +fi + +# @ECLASS-VARIABLE: KDE_MINIMAL +# @DESCRIPTION: +# This variable is used when KDE_REQUIRED is set, to specify required KDE minimal +# version for apps to work. Currently defaults to 4.3 +# One may override this variable to raise version requirements. +# For possible values look at KDE_SLOTS and KDE_LIVE_SLOTS variables. +# Note that it is fixed to ${SLOT} for kde-base packages. +KDE_MINIMAL="${KDE_MINIMAL:-4.3}" + +# Setup packages inheriting this eclass +case ${KDEBASE} in + kde-base) + if [[ $BUILD_TYPE = live ]]; then + # Disable tests for live ebuilds + RESTRICT+=" test" + # Live ebuilds in kde-base default to kdeprefix by default + IUSE+=" +kdeprefix" + else + # All other ebuild types default to -kdeprefix as before + IUSE+=" kdeprefix" + fi + # Determine SLOT from PVs + case ${PV} in + *.9999*) SLOT="${PV/.9999*/}" ;; # stable live + 4.5* | 4.4.[6-9]*) SLOT="4.5" ;; + 4.4* | 4.3.[6-9]*) SLOT="4.4" ;; + 4.3*) SLOT="4.3" ;; + 9999*) SLOT="live" ;; # regular live + *) die "Unsupported ${PV}" ;; + esac + # This code is to prevent portage from searching GENTOO_MIRRORS for + # packages that will never be mirrored. (As they only will ever be in + # the overlay). + case ${PV} in + *9999* | 4.?.[6-9]?) + RESTRICT+=" mirror" + ;; + esac + KDE_MINIMAL="${SLOT}" + _kdedir="${SLOT}" + + # Block installation of other SLOTS unless kdeprefix + RDEPEND+=" $(block_other_slots)" + ;; + koffice) + SLOT="2" + ;; +esac + +# @ECLASS-VARIABLE: QT_MINIMAL +# @DESCRIPTION: +# Determine version of qt we enforce as minimal for the package. 4.4.0 4.5.1.. +# Currently defaults to 4.5.1 for KDE 4.3 and earlier +# or 4.6.0_rc1 for KDE 4.4 and later +if slot_is_at_least 4.4 "${KDE_MINIMAL}"; then + QT_MINIMAL="${QT_MINIMAL:-4.6.0}" +fi + +QT_MINIMAL="${QT_MINIMAL:-4.5.1}" + +# OpenGL dependencies +qtopengldepend=" + >=x11-libs/qt-opengl-${QT_MINIMAL}:4 +" +case ${OPENGL_REQUIRED} in + always) + COMMONDEPEND+=" ${qtopengldepend}" + ;; + optional) + IUSE+=" opengl" + COMMONDEPEND+=" opengl? ( ${qtopengldepend} )" + ;; + *) ;; +esac +unset qtopengldepend + +# MultiMedia dependencies +qtmultimediadepend=" + >=x11-libs/qt-multimedia-${QT_MINIMAL}:4 +" +case ${MULTIMEDIA_REQUIRED} in + always) + COMMONDEPEND+=" ${qtmultimediadepend}" + ;; + optional) + IUSE+=" multimedia" + COMMONDEPEND+=" multimedia? ( ${qtmultimediadepend} )" + ;; + *) ;; +esac +unset qtmultimediadepend + +# WebKit dependencies +case ${KDE_REQUIRED} in + always) + qtwebkitusedeps="[kde]" + ;; + optional) + qtwebkitusedeps="[kde?]" + ;; + *) ;; +esac +qtwebkitdepend=" + >=x11-libs/qt-webkit-${QT_MINIMAL}:4${qtwebkitusedeps} +" +unset qtwebkitusedeps +case ${WEBKIT_REQUIRED} in + always) + COMMONDEPEND+=" ${qtwebkitdepend}" + ;; + optional) + IUSE+=" webkit" + COMMONDEPEND+=" webkit? ( ${qtwebkitdepend} )" + ;; + *) ;; +esac +unset qtwebkitdepend + +# CppUnit dependencies +cppuintdepend=" + dev-util/cppunit +" +case ${CPPUNIT_REQUIRED} in + always) + DEPEND+=" ${cppuintdepend}" + ;; + optional) + IUSE+=" test" + DEPEND+=" test? ( ${cppuintdepend} )" + ;; + *) ;; +esac +unset cppuintdepend + +# KDE dependencies +kdecommondepend=" + dev-lang/perl + >=x11-libs/qt-core-${QT_MINIMAL}:4[qt3support,ssl] + >=x11-libs/qt-gui-${QT_MINIMAL}:4[accessibility,dbus] + >=x11-libs/qt-qt3support-${QT_MINIMAL}:4[accessibility,kde] + >=x11-libs/qt-script-${QT_MINIMAL}:4 + >=x11-libs/qt-sql-${QT_MINIMAL}:4[qt3support] + >=x11-libs/qt-svg-${QT_MINIMAL}:4 + >=x11-libs/qt-test-${QT_MINIMAL}:4 + !aqua? ( + x11-libs/libXext + x11-libs/libXt + x11-libs/libXxf86vm + ) +" +if [[ ${PN} != kdelibs ]]; then + if [[ ${KDEBASE} = kde-base ]]; then + kdecommondepend+=" $(add_kdebase_dep kdelibs)" + # libknotificationitem only when SLOT is 4.3 + [[ ${PN} != libknotificationitem ]] && [[ ${SLOT} = 4.3 ]] && \ + kdecommondepend+=" $(add_kdebase_dep libknotificationitem)" + else + kdecommondepend+=" + >=kde-base/kdelibs-${KDE_MINIMAL} + " + fi +fi +kdedepend=" + dev-util/pkgconfig + !aqua? ( + || ( >=x11-libs/libXtst-1.1.0 >> Unpacking ${file} to ${PWD}" + xz -dc "${DISTDIR}"/${file} | tar xof - + assert "failed unpacking ${file}" + ;; + *) + unpack ${file} + ;; + esac + done + else + # For EAPI >= 3, we can just use unpack() directly + unpack ${A} + fi +} + +# @FUNCTION: kde4-base_src_prepare +# @DESCRIPTION: +# General pre-configure and pre-compile function for KDE4 applications. +# It also handles translations if KDE_LINGUAS is defined. See KDE_LINGUAS and +# enable_selected_linguas() and enable_selected_doc_linguas() +# in kde4-functions.eclass(5) for further details. +kde4-base_src_prepare() { + debug-print-function ${FUNCNAME} "$@" + + # Only enable selected languages, used for KDE extragear apps. + if [[ -n ${KDE_LINGUAS} ]]; then + enable_selected_linguas + fi + + # Enable/disable handbooks for kde4-base packages + # kde-l10n inherits kde4-base but is metpackage, so no check for doc + # kdelibs inherits kde4-base but handle installing the handbook itself + if ! has kde4-meta ${INHERITED}; then + has handbook ${IUSE//+} && [[ ${PN} != kde-l10n ]] && [[ ${PN} != kdelibs ]] && enable_selected_doc_linguas + fi + + [[ ${BUILD_TYPE} = live ]] && subversion_src_prepare + + # Apply patches + base_src_prepare + epatch_user + + # Save library dependencies + if [[ -n ${KMSAVELIBS} ]] ; then + save_library_dependencies + fi + + # Inject library dependencies + if [[ -n ${KMLOADLIBS} ]] ; then + load_library_dependencies + fi +} + +# @FUNCTION: kde4-base_src_configure +# @DESCRIPTION: +# Function for configuring the build of KDE4 applications. +kde4-base_src_configure() { + debug-print-function ${FUNCNAME} "$@" + + # Build tests in src_test only, where we override this value + local cmakeargs=(-DKDE4_BUILD_TESTS=OFF) + + if has kdeenablefinal ${IUSE//+} && use kdeenablefinal; then + cmakeargs+=(-DKDE4_ENABLE_FINAL=ON) + fi + + if has debug ${IUSE//+} && use debug; then + # Set "real" debug mode + CMAKE_BUILD_TYPE="Debugfull" + else + # Handle common release builds + append-cppflags -DQT_NO_DEBUG + fi + + # Set distribution name + [[ ${PN} = kdelibs ]] && cmakeargs+=(-DKDE_DISTRIBUTION_TEXT=Gentoo) + + # Here we set the install prefix + cmakeargs+=(-DCMAKE_INSTALL_PREFIX="${EPREFIX}${PREFIX}") + + # Use colors + QTEST_COLORED=1 + + # Shadow existing /usr installations + unset KDEDIRS + + # Handle kdeprefix-ed KDE + if [[ ${KDEDIR} != /usr ]]; then + # Override some environment variables - only when kdeprefix is different, + # to not break ccache/distcc + PATH="${EKDEDIR}/bin:${PATH}" + LDPATH="${EKDEDIR}/$(get_libdir)${LDPATH+:}${LDPATH}" + + # Append full RPATH + cmakeargs+=(-DCMAKE_SKIP_RPATH=OFF) + + # Set cmake prefixes to allow buildsystem to locate valid KDE installation + # when more are present + cmakeargs+=(-DCMAKE_SYSTEM_PREFIX_PATH="${EKDEDIR}") + fi + + # Handle kdeprefix in application itself + if ! has kdeprefix ${IUSE//+} || ! use kdeprefix; then + # If prefix is /usr, sysconf needs to be /etc, not /usr/etc + cmakeargs+=(-DSYSCONF_INSTALL_DIR="${EPREFIX}"/etc) + fi + + if [[ $(declare -p mycmakeargs 2>&-) != "declare -a mycmakeargs="* ]]; then + mycmakeargs=(${mycmakeargs}) + fi + + mycmakeargs=("${cmakeargs[@]}" "${mycmakeargs[@]}") + + cmake-utils_src_configure +} + +# @FUNCTION: kde4-base_src_compile +# @DESCRIPTION: +# General function for compiling KDE4 applications. +kde4-base_src_compile() { + debug-print-function ${FUNCNAME} "$@" + + cmake-utils_src_compile "$@" +} + +# @FUNCTION: kde4-base_src_test +# @DESCRIPTION: +# Function for testing KDE4 applications. +kde4-base_src_test() { + debug-print-function ${FUNCNAME} "$@" + + # Override this value, set in kde4-base_src_configure() + mycmakeargs+=(-DKDE4_BUILD_TESTS=ON) + cmake-utils_src_configure + kde4-base_src_compile + + cmake-utils_src_test +} + +# @FUNCTION: kde4-base_src_install +# @DESCRIPTION: +# Function for installing KDE4 applications. +kde4-base_src_install() { + debug-print-function ${FUNCNAME} "$@" + + # Prefix support, for usage in ebuilds + if [[ ${EAPI} == 2 ]] && ! use prefix; then + ED=${D} + fi + + if [[ -n ${KMSAVELIBS} ]] ; then + install_library_dependencies + fi + + kde4-base_src_make_doc + cmake-utils_src_install +} + +# @FUNCTION: kde4-base_src_make_doc +# @DESCRIPTION: +# Function for installing the documentation of KDE4 applications. +kde4-base_src_make_doc() { + debug-print-function ${FUNCNAME} "$@" + + local doc + for doc in AUTHORS ChangeLog* README* NEWS TODO; do + [[ -s ${doc} ]] && dodoc ${doc} + done + + if [[ -z ${KMNAME} ]]; then + for doc in {apps,runtime,workspace,.}/*/{AUTHORS,README*}; do + if [[ -s ${doc} ]]; then + local doc_complete=${doc} + doc="${doc#*/}" + newdoc "$doc_complete" "${doc%/*}.${doc##*/}" + fi + done + fi +} + +# @FUNCTION: kde4-base_pkg_postinst +# @DESCRIPTION: +# Function to rebuild the KDE System Configuration Cache after an application has been installed. +kde4-base_pkg_postinst() { + debug-print-function ${FUNCNAME} "$@" + + buildsycoca + + if [[ ${BUILD_TYPE} = live ]] && [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]]; then + echo + einfo "WARNING! This is an experimental live ebuild of ${CATEGORY}/${PN}" + einfo "Use it at your own risk." + einfo "Do _NOT_ file bugs at bugs.gentoo.org because of this ebuild!" + echo + elif [[ ${BUILD_TYPE} != live ]] && [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]] && has kdeprefix ${IUSE//+} && use kdeprefix; then + # warning about kdeprefix for non-live users + echo + ewarn "WARNING! You have the kdeprefix useflag enabled." + ewarn "This setting is strongly discouraged and might lead to potential trouble" + ewarn "with KDE update strategies." + ewarn "You are using this setup at your own risk and the kde team does not" + ewarn "take responsibilities for dead kittens." + echo + fi + if [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]] && ! has_version 'kde-base/kdebase-runtime-meta' && ! has_version 'kde-base/kdebase-startkde'; then + # warn about not supported approach + if [[ ${KDE_REQUIRED} == always ]] || ( [[ ${KDE_REQUIRED} == optional ]] && use kde ); then + echo + ewarn "WARNING! Your system configuration contains neither \"kde-base/kdebase-runtime-meta\"" + ewarn "nor \"kde-base/kdebase-startkde\". You need one of above." + ewarn "With this setting you are unsupported by KDE team." + ewarn "All missing features you report for misc packages will be probably ignored or closed as INVALID." + fi + fi +} + +# @FUNCTION: kde4-base_pkg_postrm +# @DESCRIPTION: +# Function to rebuild the KDE System Configuration Cache after an application has been removed. +kde4-base_pkg_postrm() { + debug-print-function ${FUNCNAME} "$@" + + buildsycoca +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/kde4-functions.eclass b/sdk_container/src/third_party/portage-stable/eclass/kde4-functions.eclass new file mode 100644 index 0000000000..7191148967 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/kde4-functions.eclass @@ -0,0 +1,523 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/kde4-functions.eclass,v 1.30 2010/02/02 14:20:16 reavertm Exp $ + +inherit versionator + +# @ECLASS: kde4-functions.eclass +# @MAINTAINER: +# kde@gentoo.org +# @BLURB: Common ebuild functions for KDE 4 packages +# @DESCRIPTION: +# This eclass contains all functions shared by the different eclasses, +# for KDE 4 ebuilds. + +# @ECLASS-VARIABLE: EAPI +# @DESCRIPTION: +# By default kde4 eclasses want EAPI 2 which might be redefinable to newer +# versions. +case ${EAPI:-0} in + 2|3) : ;; + *) DEPEND="EAPI-TOO-OLD" ;; +esac + +# @ECLASS-VARIABLE: KDEBASE +# @DESCRIPTION: +# This gets set to a non-zero value when a package is considered a kde or +# koffice ebuild. + +if [[ ${CATEGORY} = kde-base ]]; then + debug-print "${ECLASS}: KDEBASE ebuild recognized" + KDEBASE=kde-base +fi + +# is this a koffice ebuild? +if [[ ${KMNAME} = koffice || ${PN} = koffice ]]; then + debug-print "${ECLASS}: KOFFICE ebuild recognized" + KDEBASE=koffice +fi + +# @ECLASS-VARIABLE: KDE_SLOTS +# @DESCRIPTION: +# The slots used by all KDE versions later than 4.0. The live KDE releases use +# KDE_LIVE_SLOTS instead. Values should be ordered. +KDE_SLOTS=( "4.1" "4.2" "4.3" "4.4" "4.5" ) + +# @ECLASS-VARIABLE: KDE_LIVE_SLOTS +# @DESCRIPTION: +# The slots used by KDE live versions. Values should be ordered. +KDE_LIVE_SLOTS=( "live" ) + +# @FUNCTION: slot_is_at_least +# @USAGE: +# @DESCRIPTION: +# Version aware slot comparator. +# Current implementation relies on the fact, that slots can be compared like +# string literals (and let's keep it this way). +slot_is_at_least() { + [[ "${2}" > "${1}" || "${2}" = "${1}" ]] +} + +# @FUNCTION: buildsycoca +# @DESCRIPTION: +# Function to rebuild the KDE System Configuration Cache. +# All KDE ebuilds should run this in pkg_postinst and pkg_postrm. +buildsycoca() { + debug-print-function ${FUNCNAME} "$@" + + if [[ ${EAPI} == 2 ]] && ! use prefix; then + EROOT=${ROOT} + fi + + local KDE3DIR="${EROOT}usr/kde/3.5" + if [[ -z ${EROOT%%/} && -x "${KDE3DIR}"/bin/kbuildsycoca ]]; then + # Since KDE3 is aware of shortcuts in /usr, rebuild database + # for KDE3 as well. + touch "${KDE3DIR}"/share/services/ksycoca + chmod 644 "${KDE3DIR}"/share/services/ksycoca + + ebegin "Running kbuildsycoca to build global database" + XDG_DATA_DIRS="${EROOT}usr/local/share:${KDE3DIR}/share:${EROOT}usr/share" \ + DISPLAY="" \ + "${KDE3DIR}"/bin/kbuildsycoca --global --noincremental &> /dev/null + eend $? + fi + + # We no longer need to run kbuildsycoca4, as kded does that automatically, as needed + + # fix permission for some directories + for x in share/{config,kde4}; do + [[ ${KDEDIR} == /usr ]] && DIRS=${EROOT}usr || DIRS="${EROOT}usr ${EROOT}${KDEDIR}" + for y in ${DIRS}; do + [[ -d "${y}/${x}" ]] || break # nothing to do if directory does not exist + if [[ $(stat --format=%a "${y}/${x}") != 755 ]]; then + ewarn "QA Notice:" + ewarn "Package ${PN} is breaking ${y}/${x} permissions." + ewarn "Please report this issue to gentoo bugzilla." + einfo "Permissions will get adjusted automatically now." + find "${y}/${x}" -type d -print0 | xargs -0 chmod 755 + fi + done + done +} + +# @FUNCTION: comment_all_add_subdirectory +# @USAGE: [list of directory names] +# @DESCRIPTION: +# Recursively comment all add_subdirectory instructions in listed directories, +# except those in cmake/. +comment_all_add_subdirectory() { + find "$@" -name CMakeLists.txt -print0 | grep -vFzZ "./cmake" | \ + xargs -0 sed -i \ + -e '/^[[:space:]]*add_subdirectory/s/^/#DONOTCOMPILE /' \ + -e '/^[[:space:]]*ADD_SUBDIRECTORY/s/^/#DONOTCOMPILE /' \ + -e '/^[[:space:]]*macro_optional_add_subdirectory/s/^/#DONOTCOMPILE /' \ + -e '/^[[:space:]]*MACRO_OPTIONAL_ADD_SUBDIRECTORY/s/^/#DONOTCOMPILE /' \ + || die "${LINENO}: Initial sed died" +} + +# @ECLASS-VARIABLE: KDE_LINGUAS +# @DESCRIPTION: +# This is a whitespace-separated list of translations this ebuild supports. +# These translations are automatically added to IUSE. Therefore ebuilds must set +# this variable before inheriting any eclasses. To enable only selected +# translations, ebuilds must call enable_selected_linguas(). kde4-{base,meta}.eclass does +# this for you. +# +# Example: KDE_LINGUAS="en_GB de nl" +for _lingua in ${KDE_LINGUAS}; do + IUSE="${IUSE} linguas_${_lingua}" +done + +# @FUNCTION: enable_selected_linguas +# @DESCRIPTION: +# Enable translations based on LINGUAS settings and translations supported by +# the package (see KDE_LINGUAS). By default, translations are found in "${S}"/po +# but this default can be overridden by defining KDE_LINGUAS_DIR. +enable_selected_linguas() { + debug-print-function ${FUNCNAME} "$@" + + local lingua linguas sr_mess wp + + # if there is no linguas defined we enable everything + if ! $(env | grep -q "^LINGUAS="); then + return 0 + fi + + # @ECLASS-VARIABLE: KDE_LINGUAS_DIR + # @DESCRIPTION: + # Specified folder where application translations are located. + KDE_LINGUAS_DIR=${KDE_LINGUAS_DIR:="po"} + [[ -d "${KDE_LINGUAS_DIR}" ]] || die "wrong linguas dir specified" + comment_all_add_subdirectory "${KDE_LINGUAS_DIR}" + pushd "${KDE_LINGUAS_DIR}" > /dev/null + + # fix all various crazy sr@Latn variations + # this part is only ease for ebuilds, so there wont be any die when this + # fail at any point + sr_mess="sr@latn sr@latin sr@Latin" + for wp in ${sr_mess}; do + [[ -e "${wp}.po" ]] && mv "${wp}.po" "sr@Latn.po" + if [[ -d "${wp}" ]]; then + # move dir and fix cmakelists + mv "${wp}" "sr@Latn" + sed -i \ + -e "s:${wp}:sr@Latin:g" \ + CMakeLists.txt + fi + done + + for lingua in ${KDE_LINGUAS}; do + if [[ -e "${lingua}.po" ]]; then + mv "${lingua}.po" "${lingua}.po.old" + fi + done + + for lingua in ${KDE_LINGUAS}; do + if use linguas_${lingua} ; then + if [[ -d "${lingua}" ]]; then + linguas="${linguas} ${lingua}" + sed -e "/add_subdirectory([[:space:]]*${lingua}[[:space:]]*)[[:space:]]*$/ s/^#DONOTCOMPILE //" \ + -e "/ADD_SUBDIRECTORY([[:space:]]*${lingua}[[:space:]]*)[[:space:]]*$/ s/^#DONOTCOMPILE //" \ + -i CMakeLists.txt || die "Sed to uncomment linguas_${lingua} failed." + fi + if [[ -e "${lingua}.po.old" ]]; then + linguas="${linguas} ${lingua}" + mv "${lingua}.po.old" "${lingua}.po" + fi + fi + done + [[ -n "${linguas}" ]] && einfo "Enabling languages: ${linguas}" + + popd > /dev/null +} + +# @FUNCTION: enable_selected_doc_linguas +# @DESCRIPTION: +# Enable only selected linguas enabled doc folders. +enable_selected_doc_linguas() { + debug-print-function ${FUNCNAME} "$@" + + # if there is no linguas defined we enable everything + if ! $(env | grep -q "^LINGUAS="); then + return 0 + fi + + # @ECLASS-VARIABLE: KDE_DOC_DIRS + # @DESCRIPTION: + # Variable specifying whitespace separated patterns for documentation locations. + # Default is "doc/%lingua" + KDE_DOC_DIRS=${KDE_DOC_DIRS:='doc/%lingua'} + local linguas + for pattern in ${KDE_DOC_DIRS}; do + + local handbookdir=`dirname ${pattern}` + local translationdir=`basename ${pattern}` + # Do filename pattern supplied, treat as directory + [[ "${handbookdir}" = '.' ]] && handbookdir=${translationdir} && translationdir= + [[ -d "${handbookdir}" ]] || die 'wrong doc dir specified' + + if ! use handbook; then + # Disable whole directory + sed -e "/add_subdirectory[[:space:]]*([[:space:]]*${handbookdir}[[:space:]]*)/s/^/#DONOTCOMPILE /" \ + -e "/ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*${handbookdir}[[:space:]]*)/s/^/#DONOTCOMPILE /" \ + -i CMakeLists.txt || die 'failed to comment out all handbooks' + else + # Disable subdirectories recursively + comment_all_add_subdirectory "${handbookdir}" + # Add requested translations + local lingua + for lingua in en ${KDE_LINGUAS}; do + if [[ ${lingua} = 'en' ]] || use linguas_${lingua}; then + if [[ -d "${handbookdir}/${translationdir//%lingua/${lingua}}" ]]; then + sed -e "/add_subdirectory[[:space:]]*([[:space:]]*${translationdir//%lingua/${lingua}}/s/^#DONOTCOMPILE //" \ + -e "/ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*${translationdir//%lingua/${lingua}}/s/^#DONOTCOMPILE //" \ + -i "${handbookdir}"/CMakeLists.txt && ! has ${lingua} ${linguas} && linguas="${linguas} ${lingua}" + fi + fi + done + fi + + done + [[ -n "${linguas}" ]] && einfo "Enabling handbook translations:${linguas}" +} + +# @FUNCTION: get_build_type +# @DESCRIPTION: +# Determine whether we are using live ebuild or tbzs. +get_build_type() { + if [[ ${SLOT} = live || ${PV} = *9999* ]]; then + BUILD_TYPE="live" + else + BUILD_TYPE="release" + fi + export BUILD_TYPE +} + +# @FUNCTION: migrate_store_dir +# @DESCRIPTION: +# Universal store dir migration +# * performs split of kdebase to kdebase-apps when needed +# * moves playground/extragear kde4-base-style to toplevel dir +migrate_store_dir() { + local cleandir="${ESVN_STORE_DIR}/KDE" + if [[ -d "${cleandir}" ]]; then + ewarn "'${cleandir}' has been found. Moving contents to new location." + addwrite "${ESVN_STORE_DIR}" + # Split kdebase + local module + if pushd "${cleandir}"/kdebase/kdebase > /dev/null; then + for module in `find . -maxdepth 1 -type d -name [a-z0-9]\*`; do + module="${module#./}" + mkdir -p "${ESVN_STORE_DIR}/kdebase-${module}" && mv -f "${module}" "${ESVN_STORE_DIR}/kdebase-${module}" || \ + die "Failed to move to '${ESVN_STORE_DIR}/kdebase-${module}'." + done + popd > /dev/null + rm -fr "${cleandir}/kdebase" || \ + die "Failed to remove ${cleandir}/kdebase. You need to remove it manually." + fi + # Move the rest + local pkg + for pkg in "${cleandir}"/*; do + mv -f "${pkg}" "${ESVN_STORE_DIR}"/ || eerror "Failed to move '${pkg}'" + done + rmdir "${cleandir}" || die "Could not move obsolete KDE store dir. Please move '${cleandir}' contents to appropriate location (possibly ${ESVN_STORE_DIR}) and manually remove '${cleandir}' in order to continue." + fi + + if ! hasq kde4-meta ${INHERITED}; then + case ${KMNAME} in + extragear*|playground*) + local svnlocalpath="${ESVN_STORE_DIR}"/"${KMNAME}"/"${PN}" + if [[ -d "${svnlocalpath}" ]]; then + local destdir="${ESVN_STORE_DIR}"/"${ESVN_PROJECT}"/"`basename "${ESVN_REPO_URI}"`" + ewarn "'${svnlocalpath}' has been found." + ewarn "Moving contents to new location: ${destdir}" + addwrite "${ESVN_STORE_DIR}" + mkdir -p "${ESVN_STORE_DIR}"/"${ESVN_PROJECT}" && mv -f "${svnlocalpath}" "${destdir}" \ + || die "Failed to move to '${svnlocalpath}'" + # Try cleaning empty directories + rmdir "`dirname "${svnlocalpath}"`" 2> /dev/null + fi + ;; + esac + fi +} + +# Functions handling KMLOADLIBS and KMSAVELIBS + +# @FUNCTION: save_library_dependencies +# @DESCRIPTION: +# Add exporting CMake dependencies for current package +save_library_dependencies() { + local depsfile="${T}/${PN}:${SLOT}" + + ebegin "Saving library dependencies in ${depsfile##*/}" + echo "EXPORT_LIBRARY_DEPENDENCIES(\"${depsfile}\")" >> "${S}/CMakeLists.txt" || \ + die "Failed to save the library dependencies." + eend $? +} + +# @FUNCTION: install_library_dependencies +# @DESCRIPTION: +# Install generated CMake library dependencies to /var/lib/kde +install_library_dependencies() { + local depsfile="${T}/${PN}:${SLOT}" + + ebegin "Installing library dependencies as ${depsfile##*/}" + insinto /var/lib/kde + doins "${depsfile}" || die "Failed to install library dependencies." + eend $? +} + +# @FUNCTION: load_library_dependencies +# @DESCRIPTION: +# Inject specified library dependencies in current package +load_library_dependencies() { + local pn i depsfile + ebegin "Injecting library dependencies from '${KMLOADLIBS}'" + + i=0 + for pn in ${KMLOADLIBS} ; do + ((i++)) + depsfile="${EPREFIX}/var/lib/kde/${pn}:${SLOT}" + [[ -r "${depsfile}" ]] || die "Depsfile '${depsfile}' not accessible. You probably need to reinstall ${pn}." + sed -i -e "${i}iINCLUDE(\"${depsfile}\")" "${S}/CMakeLists.txt" || \ + die "Failed to include library dependencies for ${pn}" + done + eend $? +} + +# @FUNCTION: block_other_slots +# @DESCRIPTION: +# Create blocks for the current package in other slots when +# installed with USE=-kdeprefix +block_other_slots() { + debug-print-function ${FUNCNAME} "$@" + + _do_blocker ${PN} 0:${SLOT} +} + +# @FUNCTION: add_blocker +# @DESCRIPTION: +# Create correct RDEPEND value for blocking correct package. +# Useful for file-collision blocks. +# Parameters are package and version(s) to block. +# add_blocker kdelibs 4.2.4 +# If no version is specified, then all versions will be blocked +# If any arguments (from 2 on) contain a ":", then different versions +# are blocked in different slots. (Unlisted slots get the version without +# a ":", if none, then all versions are blocked). The parameter is then of +# the form VERSION:SLOT. Any VERSION of 0 means that no blocker will be +# added for that slot (or, if no slot, then for any unlisted slot). +# A parameter of the form :SLOT means to block all versions from that slot. +# If VERSION begins with "<", then "!= the maximum possibile version in slot +_greater_max_in_slot() { + local ver=$1 + local slot=$2 + # If slot is live, then return false + # (nothing is greater than the maximum live version) + [[ $slot == live ]] && return 1 + # Otherwise, for slot X.Y, test against X.Y.50 + local test=${slot}.50 + version_compare $1 ${test} + # 1 = '<', 2 = '=', 3 = '>' + (( $? != 1 )) +} + +# _less_min_in_slot ver slot +# slot must be 4.x or live +# returns true if ver is <= the minimum possibile version in slot +_less_min_in_slot() { + local ver=$1 + local slot=$2 + # If slot == live, then test with "9999_pre", so that 9999 tests false + local test=9999_pre + # If slot == X.Y, then test with X.(Y-1).50 + [[ $slot != live ]] && test=${slot%.*}.$((${slot#*.} - 1)).50 + version_compare $1 ${test} + # 1 = '<', 2 = '=', 3 = '>' + (( $? != 3 )) +} + +# Internal function used for add_blocker and block_other_slots +# This takes the same parameters as add_blocker, but echos to +# stdout instead of updating a variable. +_do_blocker() { + debug-print-function ${FUNCNAME} "$@" + + [[ -z ${1} ]] && die "Missing parameter" + local pkg=kde-base/$1 + shift + local param slot def="unset" var atom + # The following variables will hold parameters that contain ":" + # - block_3_5 + # - block_4_1 + # - block_4_2 + # - block_4_3 + # - block_4_4 + # - block_live + for slot in 3.5 ${KDE_SLOTS[@]} ${KDE_LIVE_SLOTS[@]}; do + local block_${slot//./_}="unset" + done + + # This construct goes through each parameter passed, and sets + # either def or block_* to the version passed + for param; do + # If the parameter does not have a ":" in it... + if [[ ${param/:} == ${param} ]]; then + def=${param} + else # the parameter *does* have a ":" in it + # so everything after the : is the slot... + slot=${param#*:} + # ...and everything before the : is the version + local block_${slot//./_}=${param%:*} + fi + done + + for slot in ${KDE_SLOTS[@]} ${KDE_LIVE_SLOTS[@]}; do + # ${var} contains the name of the variable we care about for this slot + # ${!var} is it's value + var=block_${slot//./_} + # if we didn't pass *:${slot}, then use the unsloted value + [[ ${!var} == "unset" ]] && var=def + + # If no version was passed, or the version is greater than the maximum + # possible version in this slot, block all versions in this slot + if [[ ${!var} == "unset" ]] || [[ -z ${!var} ]] || _greater_max_in_slot ${!var#<} ${slot}; then + atom=${pkg} + # If the version is "0" or less than the minimum possible version in + # this slot, do nothing + elif [[ ${!var} == "0" ]] || _less_min_in_slot ${!var#<} ${slot}; then + continue + # If the version passed begins with a "<", then use "<" instead of "<=" + elif [[ ${!var:0:1} == "<" ]]; then + # this also removes the first character of the version, which is a "<" + atom="<${pkg}-${!var:1}" + else + atom="<=${pkg}-${!var}" + fi + # we always block our own slot, ignoring kdeprefix + if [[ ${SLOT} == ${slot} ]]; then + echo " !${atom}:${slot}" + else + # we only block other slots on -kdeprefix + echo " !kdeprefix? ( !${atom}:${slot}[-kdeprefix] )" + fi + done + + # This is a special case block for :3.5; it does not use the + # default version passed, and no blocker is output *unless* a version + # is passed, or ":3.5" is passed to explicitly request a block on all + # 3.5 versions. + if [[ ${block_3_5} != "unset" && ${block_3_5} != "0" ]]; then + if [[ -z ${block_3_5} ]]; then + atom=${pkg} + elif [[ ${block_3_5:0:1} == "<" ]]; then + atom="<${pkg}-${block_3_5:1}" + else + atom="<=${pkg}-${block_3_5}" + fi + echo " !${atom}:3.5" + fi +} + +# @FUNCTION: add_kdebase_dep +# @DESCRIPTION: +# Create proper dependency for kde-base/ dependencies, +# adding SLOT when needed (and *only* when needed). +# This takes 1 or 2 arguments. The first being the package +# name, the optional second, is additional USE flags to append. +# The output of this should be added directly to DEPEND/RDEPEND, and +# may be wrapped in a USE conditional (but not an || conditional +# without an extra set of parentheses). +add_kdebase_dep() { + debug-print-function ${FUNCNAME} "$@" + + [[ -z ${1} ]] && die "Missing parameter" + + local use=${2:+,${2}} + + echo " !kdeprefix? ( >=kde-base/${1}-${PV}[aqua=,-kdeprefix${use}] )" + echo " kdeprefix? ( >=kde-base/${1}-${PV}:${SLOT}[aqua=,kdeprefix${use}] )" +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/kde4-meta.eclass b/sdk_container/src/third_party/portage-stable/eclass/kde4-meta.eclass new file mode 100644 index 0000000000..8c450387b9 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/kde4-meta.eclass @@ -0,0 +1,712 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/kde4-meta.eclass,v 1.33 2010/02/02 14:20:16 reavertm Exp $ +# +# @ECLASS: kde4-meta.eclass +# @MAINTAINER: +# kde@gentoo.org +# @BLURB: Eclass for writing "split" KDE packages. +# @DESCRIPTION: +# This eclass provides all necessary functions for writing split KDE ebuilds. +# +# You must define KMNAME to use this eclass, and do so before inheriting it. All other variables are optional. +# Do not include the same item in more than one of KMMODULE, KMMEXTRA, KMCOMPILEONLY, KMEXTRACTONLY. + +inherit kde4-base versionator + +EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_test src_install pkg_postinst pkg_postrm + +[[ -z ${KMNAME} ]] && die "kde4-meta.eclass inherited but KMNAME not defined - broken ebuild" + +# Add dependencies that all packages in a certain module share. +case ${KMNAME} in + kdebase|kdebase-apps|kdebase-workspace|kdebase-runtime|kdegraphics) + COMMONDEPEND+=" >=kde-base/qimageblitz-0.0.4" + ;; + kdepim|kdepim-runtime) + ! slot_is_at_least 4.4 ${SLOT} && COMMONDEPEND+=" $(add_kdebase_dep kdepimlibs)" + case ${PN} in + akregator|kaddressbook|kjots|kmail|knode|knotes|korganizer|ktimetracker) + IUSE+=" +kontact" + RDEPEND+=" kontact? ( $(add_kdebase_dep kontact) )" + ;; + esac + ;; + kdegames) + if [[ ${PN} != libkdegames ]]; then + COMMONDEPEND+=" $(add_kdebase_dep libkdegames)" + fi + ;; + koffice) + [[ ${PN} != koffice-data ]] && IUSE+=" debug" + RDEPEND+=" + !app-office/${PN}:0 + !app-office/koffice:0 + !app-office/koffice-meta:0 + " + if has openexr ${IUSE//+}; then + COMMONDEPEND+=" media-gfx/imagemagick[openexr?]" + else + COMMONDEPEND+=" media-gfx/imagemagick" + fi + + COMMONDEPEND+=" + dev-cpp/eigen:2 + media-libs/fontconfig + media-libs/freetype:2 + " + if [[ ${PN} != koffice-libs && ${PN} != koffice-data ]]; then + COMMONDEPEND+=" >=app-office/koffice-libs-${PV}:${SLOT}" + fi + ;; +esac + +DEPEND+=" ${COMMONDEPEND}" +RDEPEND+=" ${COMMONDEPEND}" +unset COMMONDEPEND + +debug-print "line ${LINENO} ${ECLASS}: DEPEND ${DEPEND} - after metapackage-specific dependencies" +debug-print "line ${LINENO} ${ECLASS}: RDEPEND ${RDEPEND} - after metapackage-specific dependencies" + +# Useful to build kde4-meta style stuff from extragear/playground (plasmoids etc) +case ${BUILD_TYPE} in + live) + case ${KMNAME} in + extragear*|playground*) + ESVN_REPO_URI="${ESVN_MIRROR}/trunk/${KMNAME}" + ESVN_PROJECT="${KMNAME}${ESVN_PROJECT_SUFFIX}" + ;; + esac + ;; +esac + +# @ECLASS-VARIABLE: KMNAME +# @DESCRIPTION: +# Name of the parent-module (e.g. kdebase, kdepim, ...). You _must_ set it +# _before_ inheriting this eclass, (unlike the other parameters), since it's +# used to set $SRC_URI. + +# @ECLASS-VARIABLE: KMMODULE +# @DESCRIPTION: +# Specify exactly one subdirectory of $KMNAME here. Defaults to $PN. +# The subdirectory listed here is treated exactly like items in $KMEXTRA. +# +# Example: The ebuild name of "kdebase/l10n" is kde-base/kdebase-l10n, because +# just 'l10n' would be too confusing. Hence it sets KMMODULE="l10n". + +# @ECLASS-VARIABLE: KMNOMODULE +# @DESCRIPTION: +# If set to "true", $KMMODULE doesn't have to be defined. +# +# Example usage: If you're installing subdirectories of a package, like plugins, +# you mark the top subdirectory (containing the package) as $KMEXTRACTONLY, and +# set KMNOMODULE="true". +if [[ -z ${KMMODULE} && ${KMNOMODULE} != true ]]; then + KMMODULE=${PN} +fi + +# @ECLASS-VARIABLE: KMEXTRA +# @DESCRIPTION: +# All subdirectories listed here will be extracted, compiled & installed. +# $KMMODULE is always added to $KMEXTRA. +# If the handbook USE-flag is set, and if this directory exists, +# then "doc/$KMMODULE" is added to $KMEXTRA. In other cases, this should be +# handled in the ebuild. +# If the documentation is in a different subdirectory, you should add it to KMEXTRA. + +# @ECLASS-VARIABLE: KMCOMPILEONLY +# @DESCRIPTION: +# All subdirectories listed here will be extracted & compiled, but not installed. + +# TODO: better formulation may be needed +# @ECLASS-VARIABLE: KMEXTRACTONLY +# @DESCRIPTION: +# All subdirectories listed here will be extracted, but neither compiled nor installed. +# This can be used to avoid compilation in a subdirectory of a directory in $KMMODULE or $KMEXTRA + +# @ECLASS-VARIABLE: KMTARPARAMS +# @DESCRIPTION: +# Specify extra parameters to pass to tar, in kde4-meta_src_extract. +# '-xpf -j' are passed to tar by default. + +# @FUNCTION: kde4-meta_pkg_setup +# @DESCRIPTION: +# Currently just calls its equivalent in kde4-base.eclass(5). Use this one in +# split ebuilds. +kde4-meta_pkg_setup() { + debug-print-function ${FUNCNAME} "$@" + + kde4-base_pkg_setup +} + +# @FUNCTION: kde4-meta_src_unpack +# @DESCRIPTION: +# This function unpacks the source for split ebuilds. See also +# kde4-meta-src_extract. +kde4-meta_src_unpack() { + debug-print-function ${FUNCNAME} "$@" + + if [[ ${BUILD_TYPE} = live ]]; then + migrate_store_dir + S="${WORKDIR}/${P}" + mkdir -p "${S}" + ESVN_RESTRICT="export" subversion_src_unpack + subversion_wc_info + subversion_bootstrap + kde4-meta_src_extract + else + kde4-meta_src_extract + fi +} + +# FIXME: the difference between kde4-meta_src_extract and kde4-meta_src_unpack? + +# @FUNCTION: kde4-meta_src_extract +# @DESCRIPTION: +# A function to unpack the source for a split KDE ebuild. +# Also see KMMODULE, KMNOMODULE, KMEXTRA, KMCOMPILEONLY, KMEXTRACTONLY and +# KMTARPARAMS. +kde4-meta_src_extract() { + debug-print-function ${FUNCNAME} "$@" + + if [[ ${BUILD_TYPE} = live ]]; then + local rsync_options subdir kmnamedir targetdir + # Export working copy to ${S} + einfo "Exporting parts of working copy to ${S}" + kde4-meta_create_extractlists + + rsync_options="--group --links --owner --perms --quiet --exclude=.svn/" + + # Copy ${KMNAME} non-recursively (toplevel files) + rsync ${rsync_options} "${ESVN_WC_PATH}"/${kmnamedir}* "${S}" \ + || die "${ESVN}: can't export toplevel files to '${S}'." + # Copy cmake directory + if [[ -d "${ESVN_WC_PATH}/${kmnamedir}cmake" ]]; then + rsync --recursive ${rsync_options} "${ESVN_WC_PATH}/${kmnamedir}cmake" "${S}" \ + || die "${ESVN}: can't export cmake files to '${S}'." + fi + # Copy all subdirectories + for subdir in $(__list_needed_subdirectories); do + targetdir="" + if [[ $subdir = doc/* && ! -e "$ESVN_WC_PATH/$kmnamedir$subdir" ]]; then + continue + fi + + [[ ${subdir%/} = */* ]] && targetdir=${subdir%/} && targetdir=${targetdir%/*} && mkdir -p "${S}/${targetdir}" + rsync --recursive ${rsync_options} "${ESVN_WC_PATH}/${kmnamedir}${subdir%/}" "${S}/${targetdir}" \ + || die "${ESVN}: can't export subdirectory '${subdir}' to '${S}/${targetdir}'." + done + + if [[ ${KMNAME} = kdebase-runtime && ${PN} != kdebase-data ]]; then + sed -i -e '/^install(PROGRAMS[[:space:]]*[^[:space:]]*\/kde4[[:space:]]/s/^/#DONOTINSTALL /' \ + "${S}"/CMakeLists.txt || die "Sed to exclude bin/kde4 failed" + fi + else + local abort tarball tarfile f extractlist moduleprefix postfix + case ${PV} in + 4.[34].8[05] | 4.[34].9[0568]) + # block for normally packed upstream unstable snapshots + KMTARPARAMS+=" --bzip2" # bz2 + postfix="bz2" + ;; + 4.[34].[6-9]*) + # Not passing --xz, as it doesn't work with stable tar + KMTARPARAMS+=" --use-compress-program=xz" # xz + postfix="xz" + ;; + *) + KMTARPARAMS+=" --bzip2" # bz2 + postfix="bz2" + ;; + esac + case ${KMNAME} in + kdebase-apps) + # kdebase/apps -> kdebase-apps + tarball="kdebase-${PV}.tar.${postfix}" + # Go one level deeper for kdebase-apps in tarballs + moduleprefix=apps/ + KMTARPARAMS+=" --transform=s|apps/||" + ;; + *) + # Create tarball name from module name (this is the default) + tarball="${KMNAME}-${PV}.tar.${postfix}" + ;; + esac + + # Full path to source tarball + tarfile="${DISTDIR}/${tarball}" + + # Detect real toplevel dir from tarball name - it will be used upon extraction + # and in __list_needed_subdirectories + topdir="${tarball%.tar.*}/" + + ebegin "Unpacking parts of ${tarball} to ${WORKDIR}" + + kde4-meta_create_extractlists + + for f in cmake/ CMakeLists.txt ConfigureChecks.cmake config.h.cmake \ + AUTHORS COPYING INSTALL README NEWS ChangeLog + do + extractlist+=" ${topdir}${moduleprefix}${f}" + done + extractlist+=" $(__list_needed_subdirectories)" + + pushd "${WORKDIR}" > /dev/null + [[ -n ${KDE4_STRICTER} ]] && echo tar -xpf "${tarfile}" ${KMTARPARAMS} ${extractlist} >&2 + tar -xpf "${tarfile}" ${KMTARPARAMS} ${extractlist} 2> /dev/null + + # Default $S is based on $P; rename the extracted directory to match $S if necessary + mv ${topdir} ${P} || die "Died while moving \"${topdir}\" to \"${P}\"" + + popd > /dev/null + + eend $? + + # We need to clear it here to make verification below work + unset moduleprefix + + if [[ -n ${KDE4_STRICTER} ]]; then + for f in $(__list_needed_subdirectories fatal); do + if [[ ! -e "${S}/${f#*/}" ]]; then + eerror "'${f#*/}' is missing" + abort=true + fi + done + [[ -n ${abort} ]] && die "There were missing files." + fi + + # We don't need it anymore + unset topdir + fi +} + +# @FUNCTION: kde4-meta_create_extractlists +# @DESCRIPTION: +# Create lists of files and subdirectories to extract. +# Also see descriptions of KMMODULE, KMNOMODULE, KMEXTRA, KMCOMPILEONLY, +# KMEXTRACTONLY and KMTARPARAMS. +kde4-meta_create_extractlists() { + debug-print-function ${FUNCNAME} "$@" + + # TODO change to KMEXTRA for more strict check + if has handbook ${IUSE//+} && use handbook && [[ -n ${KMMODULE} ]]; then + # We use the basename of $KMMODULE because $KMMODULE can contain + # the path to the module subdirectory. + KMEXTRA_NONFATAL+=" + doc/${KMMODULE##*/}" + fi + + # Add some CMake-files to KMEXTRACTONLY. + # Note that this actually doesn't include KMEXTRA handling. + # In those cases you should care to add the relevant files to KMEXTRACTONLY + case ${KMNAME} in + kdebase) + KMEXTRACTONLY+=" + apps/config-apps.h.cmake + apps/ConfigureChecks.cmake" + ;; + kdebase-apps) + KMEXTRACTONLY+=" + config-apps.h.cmake + ConfigureChecks.cmake" + ;; + kdebase-runtime) + KMEXTRACTONLY+=" + config-runtime.h.cmake" + ;; + kdebase-workspace) + KMEXTRACTONLY+=" + config-unix.h.cmake + ConfigureChecks.cmake + config-workspace.h.cmake + config-X11.h.cmake + startkde.cmake + KDE4WorkspaceConfig.cmake.in" + ;; + kdegames) + if [[ ${PN} != libkdegames ]]; then + KMEXTRACTONLY+=" + libkdegames/" + KMLOADLIBS="${KMLOADLIBS} libkdegames" + fi + ;; + kdepim) + if [[ ${PN} != libkdepim ]]; then + KMEXTRACTONLY+=" + libkdepim/" + fi + KMEXTRACTONLY+=" + config-enterprise.h.cmake + kleopatra/ConfigureChecks.cmake" + if slot_is_at_least 4.5 ${SLOT}; then + KMEXTRACTONLY+=" + kdepim-version.h.cmake" + else + KMEXTRACTONLY+=" + kdepim-version.h" + fi + if has kontact ${IUSE//+} && use kontact; then + KMEXTRA+=" + kontact/plugins/${PLUGINNAME:-${PN}}/" + if ! slot_is_at_least 4.4 ${SLOT}; then + KMEXTRACTONLY+=" + kontactinterfaces/" + fi + fi + ;; + kdeutils) + KMEXTRACTONLY+=" + kdeutils-version.h" + ;; + koffice) + KMEXTRACTONLY+=" + config-endian.h.cmake + filters/config-filters.h.cmake + config-openexr.h.cmake + config-opengl.h.cmake + config-prefix.h.cmake + " + case ${PV} in + 2.0.*) + KMEXTRACTONLY+=" + config-openctl.h.cmake" + ;; + esac + ;; + esac + # Don't install cmake modules for split ebuilds, to avoid collisions. + case ${KMNAME} in + kdebase-runtime|kdebase-workspace|kdeedu|kdegames|kdegraphics) + case ${PN} in + libkdegames|libkdeedu|libkworkspace) + KMEXTRA+=" + cmake/modules/" + ;; + *) + KMCOMPILEONLY+=" + cmake/modules/" + ;; + esac + ;; + esac + + debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME}: KMEXTRACTONLY ${KMEXTRACTONLY}" +} + +__list_needed_subdirectories() { + local i j kmextra kmextra_expanded kmmodule_expanded kmcompileonly_expanded extractlist + + # We expand KMEXTRA by adding CMakeLists.txt files + kmextra="${KMEXTRA}" + [[ ${1} != fatal ]] && kmextra+=" ${KMEXTRA_NONFATAL}" + for i in ${kmextra}; do + kmextra_expanded+=" ${i}" + j=$(dirname ${i}) + while [[ ${j} != "." ]]; do + kmextra_expanded+=" ${j}/CMakeLists.txt"; + j=$(dirname ${j}) + done + done + + # Expand KMMODULE + if [[ -n ${KMMODULE} ]]; then + kmmodule_expanded="${KMMODULE}" + j=$(dirname ${KMMODULE}) + while [[ ${j} != "." ]]; do + kmmodule_expanded+=" ${j}/CMakeLists.txt"; + j=$(dirname ${j}) + done + fi + + # Expand KMCOMPILEONLY + for i in ${KMCOMPILEONLY}; do + kmcompileonly_expanded+=" ${i}" + j=$(dirname ${i}) + while [[ ${j} != "." ]]; do + kmcompileonly_expanded+=" ${j}/CMakeLists.txt"; + j=$(dirname ${j}) + done + done + + debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME} - kmextra_expanded: ${kmextra_expanded}" + debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME} - kmmodule_expanded: ${kmmodule_expanded}" + debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME} - kmcompileonly_expanded: ${kmcompileonly_expanded}" + + # Create final list of stuff to extract + # We append topdir only when specified (usually for tarballs) + for i in ${kmmodule_expanded} ${kmextra_expanded} ${kmcompileonly_expanded} \ + ${KMEXTRACTONLY} + do + extractlist+=" ${topdir}${moduleprefix}${i}" + done + + echo ${extractlist} +} + +# @FUNCTION: kde4-meta_src_prepare +# @DESCRIPTION: +# Meta-package build system configuration handling - commenting out targets, etc.. +kde4-meta_src_prepare() { + debug-print-function ${FUNCNAME} "$@" + + kde4-meta_change_cmakelists + kde4-base_src_prepare +} + +# FIXME: no comment here? +_change_cmakelists_parent_dirs() { + debug-print-function ${FUNCNAME} "$@" + + local _olddir _dir + _dir="${S}"/${1} + until [[ ${_dir} == "${S}" ]]; do + _olddir=$(basename "${_dir}") + _dir=$(dirname "${_dir}") + debug-print "${LINENO}: processing ${_dir} CMakeLists.txt searching for ${_olddir}" + if [[ -f ${_dir}/CMakeLists.txt ]]; then + sed -e "/add_subdirectory[[:space:]]*([[:space:]]*${_olddir}[[:space:]]*)/s/#DONOTCOMPILE //g" \ + -e "/ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*${_olddir}[[:space:]]*)/s/#DONOTCOMPILE //g" \ + -i ${_dir}/CMakeLists.txt || die "${LINENO}: died in ${FUNCNAME} while processing ${_dir}" + fi + done +} + +# @FUNCTION: kde4-meta_change_cmakelists +# @DESCRIPTION: +# Adjust CMakeLists.txt to comply to our splitting. +kde4-meta_change_cmakelists() { + debug-print-function ${FUNCNAME} "$@" + + pushd "${S}" > /dev/null + + comment_all_add_subdirectory ./ + + # Restore "add_subdirectory( cmake )" in ${S}/CMakeLists.txt + if [[ -f CMakeLists.txt ]]; then + sed -e '/add_subdirectory[[:space:]]*([[:space:]]*cmake[[:space:]]*)/s/^#DONOTCOMPILE //' \ + -e '/ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*cmake[[:space:]]*)/s/^#DONOTCOMPILE //' \ + -i CMakeLists.txt || die "${LINENO}: cmake sed died" + fi + + if [[ -z ${KMNOMODULE} ]]; then + # Restore "add_subdirectory" in $KMMODULE subdirectories + find "${S}"/${KMMODULE} -name CMakeLists.txt -print0 | \ + xargs -0 sed -i -e 's/^#DONOTCOMPILE //g' || \ + die "${LINENO}: died in KMMODULE section" + _change_cmakelists_parent_dirs ${KMMODULE} + fi + + local i + + # KMEXTRACTONLY section - Some ebuilds need to comment out some subdirs in KMMODULE and they use KMEXTRACTONLY + for i in ${KMEXTRACTONLY}; do + if [[ -d ${i} && -f ${i}/../CMakeLists.txt ]]; then + sed -e "/([[:space:]]*$(basename $i)[[:space:]]*)/s/^/#DONOTCOMPILE /" \ + -i ${i}/../CMakeLists.txt || \ + die "${LINENO}: sed died while working in the KMEXTRACTONLY section while processing ${i}" + fi + done + + # KMCOMPILEONLY + for i in ${KMCOMPILEONLY}; do + debug-print "${LINENO}: KMCOMPILEONLY, processing ${i}" + # Uncomment "add_subdirectory" instructions inside $KMCOMPILEONLY, then comment "install" instructions. + find "${S}"/${i} -name CMakeLists.txt -print0 | \ + xargs -0 sed -i \ + -e 's/^#DONOTCOMPILE //g' \ + -e '/install(.*)/{s/^/#DONOTINSTALL /;}' \ + -e '/^install(/,/)/{s/^/#DONOTINSTALL /;}' \ + -e '/kde4_install_icons(.*)/{s/^/#DONOTINSTALL /;}' || \ + die "${LINENO}: sed died in the KMCOMPILEONLY section while processing ${i}" + _change_cmakelists_parent_dirs ${i} + done + + # KMEXTRA section + for i in ${KMEXTRA}; do + debug-print "${LINENO}: KMEXTRA section, processing ${i}" + find "${S}"/${i} -name CMakeLists.txt -print0 | \ + xargs -0 sed -i -e 's/^#DONOTCOMPILE //g' || \ + die "${LINENO}: sed died uncommenting add_subdirectory instructions in KMEXTRA section while processing ${i}" + _change_cmakelists_parent_dirs ${i} + done + # KMEXTRA_NONFATAL section + for i in ${KMEXTRA_NONFATAL}; do + if [[ -d "${S}"/${i} ]]; then + find "${S}"/${i} -name CMakeLists.txt -print0 | \ + xargs -0 sed -i -e 's/^#DONOTCOMPILE //g' || \ + die "${LINENO}: sed died uncommenting add_subdirectory instructions in KMEXTRA section while processing ${i}" + _change_cmakelists_parent_dirs ${i} + fi + done + + case ${KMNAME} in + kdebase-workspace) + # COLLISION PROTECT section + # Install the startkde script just once, as a part of kde-base/kdebase-startkde, + # not as a part of every package. + if [[ ${PN} != kdebase-startkde && -f CMakeLists.txt ]]; then + # The startkde script moved to kdebase-workspace for KDE4 versions > 3.93.0. + sed -e '/startkde/s/^/#DONOTINSTALL /' \ + -i CMakeLists.txt || die "${LINENO}: sed died in the kdebase-startkde collision prevention section" + fi + # Strip EXPORT feature section from workspace for KDE4 versions > 4.1.82 + if [[ ${PN} != libkworkspace ]]; then + sed -e '/install(FILES ${CMAKE_CURRENT_BINARY_DIR}\/KDE4WorkspaceConfig.cmake/,/^[[:space:]]*FILE KDE4WorkspaceLibraryTargets.cmake )[[:space:]]*^/d' \ + -i CMakeLists.txt || die "${LINENO}: sed died in kdebase-workspace strip config install and fix EXPORT section" + fi + ;; + kdebase-runtime) + # COLLISION PROTECT section + # Only install the kde4 script as part of kde-base/kdebase-data + if [[ ${PN} != kdebase-data && -f CMakeLists.txt ]]; then + sed -e '/^install(PROGRAMS[[:space:]]*[^[:space:]]*\/kde4[[:space:]]/s/^/#DONOTINSTALL /' \ + -i CMakeLists.txt || die "Sed to exclude bin/kde4 failed" + fi + ;; + kdenetwork) + # Disable hardcoded kdepimlibs check + sed -e 's/find_package(KdepimLibs REQUIRED)/macro_optional_find_package(KdepimLibs)/' \ + -i CMakeLists.txt || die "failed to disable hardcoded checks" + ;; + kdepim) + # Disable hardcoded checks + sed -r -e '/find_package\(KdepimLibs/s/REQUIRED//' \ + -e '/find_package\((KdepimLibs|Boost|QGpgme|Akonadi|ZLIB|Strigi|SharedDesktopOntologies|Soprano|Nepomuk)/{/macro_optional_/!s/find/macro_optional_&/}' \ + -e '/macro_log_feature\((Boost|QGPGME|Akonadi|ZLIB|STRIGI|SHAREDDESKTOPONTOLOGIES|Soprano|Nepomuk)_FOUND/s/ TRUE / FALSE /' \ + -i CMakeLists.txt || die "failed to disable hardcoded checks" + if ! slot_is_at_least 4.5 ${SLOT}; then + case ${PN} in + kalarm|kmailcvt|kontact|korganizer|korn) + sed -n -e '/qt4_generate_dbus_interface(.*org\.kde\.kmail\.\(kmail\|mailcomposer\)\.xml/p' \ + -e '/add_custom_target(kmail_xml /,/)/p' \ + -i kmail/CMakeLists.txt || die "uncommenting xml failed" + _change_cmakelists_parent_dirs kmail + ;; + esac + fi + ;; + kdewebdev) + # Disable hardcoded checks + sed -e 's/find_package(KdepimLibs REQUIRED)/macro_optional_find_package(KdepimLibs)/' \ + -e 's/find_package(LibXml2 REQUIRED)/macro_optional_find_package(LibXml2)/' \ + -e 's/find_package(LibXslt REQUIRED)/macro_optional_find_package(LibXslt)/' \ + -e 's/find_package(Boost REQUIRED)/macro_optional_find_package(Boost)/' \ + -i CMakeLists.txt || die "failed to disable hardcoded checks" + ;; + koffice) + # Prevent collisions + if [[ ${PN} != koffice-data ]]; then + sed -e '/install(.*FindKOfficeLibs.cmake/,/)/ d' \ + -i cmake/modules/CMakeLists.txt || die "${LINENO}: sed died in collision prevention section" + sed -e '/install(.\+config-openexr\.h.\+)/d' \ + -i CMakeLists.txt || die "${LINENO}: sed died in collision prevention section" + fi + # koffice 2.0 + case ${PV} in + 2.0.[1-9]) + sed -i -n -e '1h;1!H;${g;s/install(.\+config-openexr.h.\+)//;p}' \ + "${S}"/CMakeLists.txt || \ + die "${LINENO}: sed died in collision prevention section" + ;; + *) ;; + esac + esac + + popd > /dev/null +} + +# @FUNCTION: kde4-meta_src_configure +# @DESCRIPTION: +# Currently just calls its equivalent in kde4-base.eclass(5). Use this one in split +# ebuilds. +kde4-meta_src_configure() { + debug-print-function ${FUNCNAME} "$@" + + # backwards-compatibility: make mycmakeargs an array, if it isn't already + if [[ $(declare -p mycmakeargs 2>&-) != "declare -a mycmakeargs="* ]]; then + mycmakeargs=(${mycmakeargs}) + fi + + # Set some cmake default values here (usually workarounds for automagic deps) + case ${KMNAME} in + kdewebdev) + mycmakeargs=( + -DWITH_KdepimLibs=OFF + -DWITH_LibXml2=OFF + -DWITH_LibXslt=OFF + -DWITH_Boost=OFF + -DWITH_LibTidy=OFF + "${mycmakeargs[@]}" + ) + ;; + esac + + kde4-base_src_configure +} + +# @FUNCTION: kde4-meta_src_compile +# @DESCRIPTION: +# General function for compiling split KDE4 applications. +# Overrides kde4-base_src_compile. +kde4-meta_src_compile() { + debug-print-function ${FUNCNAME} "$@" + + kde4-base_src_compile "$@" +} + +# @FUNCTION: kde4-meta_src_test +# @DESCRIPTION: +# Currently just calls its equivalent in kde4-base.eclass(5) if +# I_KNOW_WHAT_I_AM_DOING is set. Use this in split ebuilds. +kde4-meta_src_test() { + debug-print-function $FUNCNAME "$@" + + if [[ $I_KNOW_WHAT_I_AM_DOING ]]; then + kde4-base_src_test + else + einfo "Tests disabled" + fi +} + +# @FUNCTION: kde4-meta_src_install +# @DESCRIPTION: +# Function for installing KDE4 split applications. +kde4-meta_src_install() { + debug-print-function $FUNCNAME "$@" + + kde4-base_src_install +} + +# @FUNCTION: kde4-meta_src_make_doc +# @DESCRIPTION: +# This function searches in ${S}/${KMMODULE}, +# and tries to install "AUTHORS ChangeLog* README* NEWS TODO" if these files exist. +kde4-meta_src_make_doc() { + debug-print-function ${FUNCNAME} "$@" + + local doc + for doc in AUTHORS ChangeLog* README* NEWS TODO; do + [[ -s ${KMMODULE}/${doc} ]] && newdoc "${KMMODULE}/${doc}" "${doc}.${KMMODULE##*/}" + done + + kde4-base_src_make_doc +} + +# @FUNCTION: kde4-meta_pkg_postinst +# @DESCRIPTION: +# Invoke kbuildsycoca4. +kde4-meta_pkg_postinst() { + debug-print-function ${FUNCNAME} "$@" + + kde4-base_pkg_postinst +} + +# @FUNCTION: kde4-meta_pkg_postrm +# @DESCRIPTION: +# Currently just calls its equivalent in kde4-base.eclass(5). Use this in split +# ebuilds. +kde4-meta_pkg_postrm() { + debug-print-function ${FUNCNAME} "$@" + + kde4-base_pkg_postrm +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/kernel.eclass b/sdk_container/src/third_party/portage-stable/eclass/kernel.eclass new file mode 100644 index 0000000000..b2ac2648d8 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/kernel.eclass @@ -0,0 +1,8 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/kernel.eclass,v 1.61 2009/11/30 04:19:36 abcd Exp $ + +# @DEAD +# Replaced by kernel-2.eclass +# To be removed on 2011/11/30. +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" diff --git a/sdk_container/src/third_party/portage-stable/eclass/latex-package.eclass b/sdk_container/src/third_party/portage-stable/eclass/latex-package.eclass new file mode 100644 index 0000000000..2bfb2136ee --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/latex-package.eclass @@ -0,0 +1,232 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/latex-package.eclass,v 1.38 2009/01/11 21:46:39 ulm Exp $ + +# @ECLASS: latex-package.eclass +# @MAINTAINER: +# TeX team +# +# Author Matthew Turk +# Martin Ehmsen +# @BLURB: An eclass for easy installation of LaTeX packages +# @DESCRIPTION: +# This eClass is designed to be easy to use and implement. The vast majority of +# LaTeX packages will only need to define SRC_URI (and sometimes S) for a +# successful installation. If fonts need to be installed, then the variable +# SUPPLIER must also be defined. +# +# However, those packages that contain subdirectories must process each +# subdirectory individually. For example, a package that contains directories +# DIR1 and DIR2 must call latex-package_src_compile() and +# latex-package_src_install() in each directory, as shown here: +# +# src_compile() { +# cd ${S} +# cd DIR1 +# latex-package_src_compile +# cd .. +# cd DIR2 +# latex-package_src_compile +# } +# +# src_install() { +# cd ${S} +# cd DIR1 +# latex-package_src_install +# cd .. +# cd DIR2 +# latex-package_src_install +# } +# +# The eClass automatically takes care of rehashing TeX's cache (ls-lR) after +# installation and after removal, as well as creating final documentation from +# TeX files that come with the source. Note that we break TeX layout standards +# by placing documentation in /usr/share/doc/${PN} +# +# For examples of basic installations, check out dev-tex/aastex and +# dev-tex/leaflet . +# +# NOTE: The CTAN "directory grab" function creates files with different MD5 +# signatures EVERY TIME. For this reason, if you are grabbing from the CTAN, +# you must either grab each file individually, or find a place to mirror an +# archive of them. (iBiblio) +# +# It inherits base. + +inherit base + +RDEPEND="virtual/latex-base" +DEPEND="${RDEPEND} + >=sys-apps/texinfo-4.2-r5" +HOMEPAGE="http://www.tug.org/" +SRC_URI="ftp://tug.ctan.org/macros/latex/" +S=${WORKDIR}/${P} +TEXMF="/usr/share/texmf" + +# @ECLASS-VARIABLE: SUPPLIER +# @DESCRIPTION: +# This refers to the font supplier; it should be overridden (see eclass +# DESCRIPTION above) +SUPPLIER="misc" + +# @FUNCTION: latex-package_has_tetex3 +# @RETURN: true if at least one of (>=tetex-3 or >=ptex-3.1.8 or >=texlive-core-2007) is installed, else false +# @DESCRIPTION: +# It is often used to know if the current TeX installation supports gentoo's +# texmf-update or if the package has to do it the old way +latex-package_has_tetex_3() { + if has_version '>=app-text/tetex-3' || has_version '>=app-text/ptex-3.1.8' || has_version '>=app-text/texlive-core-2007' ; then + true + else + false + fi +} + +# @FUNCTION: latex-package_src_doinstall +# @USAGE: [ module ] +# @DESCRIPTION: +# [module] can be one or more of: sh, sty, cls, fd, clo, def, cfg, dvi, ps, pdf, +# tex, dtx, tfm, vf, afm, pfb, ttf, bst, styles, doc, fonts, bin, or all. +# If [module] is not given, all is assumed. +# It installs the files found in the current directory to the standard locations +# for a TeX installation +latex-package_src_doinstall() { + debug-print function $FUNCNAME $* + # This actually follows the directions for a "single-user" system + # at http://www.ctan.org/installationadvice/ modified for gentoo. + [ -z "$1" ] && latex-package_src_install all + + while [ "$1" ]; do + case $1 in + "sh") + for i in `find . -maxdepth 1 -type f -name "*.${1}"` + do + dobin $i || die "dobin $i failed" + done + ;; + "sty" | "cls" | "fd" | "clo" | "def" | "cfg") + for i in `find . -maxdepth 1 -type f -name "*.${1}"` + do + insinto ${TEXMF}/tex/latex/${PN} + doins $i || die "doins $i failed" + done + ;; + "dvi" | "ps" | "pdf") + for i in `find . -maxdepth 1 -type f -name "*.${1}"` + do + insinto /usr/share/doc/${PF} + doins $i || die "doins $i failed" + dosym /usr/share/doc/${PF}/$(basename ${i}) ${TEXMF}/doc/latex/${PN}/${i} + #dodoc -u $i + done + ;; + "tex" | "dtx") + for i in `find . -maxdepth 1 -type f -name "*.${1}"` + do + einfo "Making documentation: $i" + texi2dvi -q -c --language=latex $i &> /dev/null + done + ;; + "tfm" | "vf" | "afm") + for i in `find . -maxdepth 1 -type f -name "*.${1}"` + do + insinto ${TEXMF}/fonts/${1}/${SUPPLIER}/${PN} + doins $i || die "doins $i failed" + done + ;; + "pfb") + for i in `find . -maxdepth 1 -type f -name "*.pfb"` + do + insinto ${TEXMF}/fonts/type1/${SUPPLIER}/${PN} + doins $i || die "doins $i failed" + done + ;; + "ttf") + for i in `find . -maxdepth 1 -type f -name "*.ttf"` + do + insinto ${TEXMF}/fonts/truetype/${SUPPLIER}/${PN} + doins $i || die "doins $i failed" + done + ;; + "bst") + for i in `find . -maxdepth 1 -type f -name "*.bst"` + do + insinto ${TEXMF}/bibtex/bst/${PN} + doins $i || die "doins $i failed" + done + ;; + "styles") + latex-package_src_doinstall sty cls fd clo def cfg bst + ;; + "doc") + latex-package_src_doinstall tex dtx dvi ps pdf + ;; + "fonts") + latex-package_src_doinstall tfm vf afm pfb ttf + ;; + "bin") + latex-package_src_doinstall sh + ;; + "all") + latex-package_src_doinstall styles fonts bin doc + ;; + esac + shift + done +} + +# @FUNCTION: latex-package_src_compile +# @DESCRIPTION: +# Calls latex for each *.ins in the current directory in order to generate the +# relevant files that will be installed +latex-package_src_compile() { + debug-print function $FUNCNAME $* + for i in `find \`pwd\` -maxdepth 1 -type f -name "*.ins"` + do + einfo "Extracting from $i" + latex --interaction=batchmode $i &> /dev/null + done +} + +# @FUNCTION: latex-package_src_install +# @DESCRIPTION: +# Installs the package +latex-package_src_install() { + debug-print function $FUNCNAME $* + latex-package_src_doinstall all + if [ -n "${DOCS}" ] ; then + dodoc ${DOCS} + fi +} + +# @FUNCTION: latex-package_pkg_postinst +# @DESCRIPTION: +# Calls latex-package_rehash to ensure the TeX installation is consistent with +# the kpathsea database +latex-package_pkg_postinst() { + debug-print function $FUNCNAME $* + latex-package_rehash +} + +# @FUNCTION: latex-package_pkg_postrm +# @DESCRIPTION: +# Calls latex-package_rehash to ensure the TeX installation is consistent with +# the kpathsea database +latex-package_pkg_postrm() { + debug-print function $FUNCNAME $* + latex-package_rehash +} + +# @FUNCTION: latex-package_rehash +# @DESCRIPTION: +# Rehashes the kpathsea database, according to the current TeX installation +latex-package_rehash() { + debug-print function $FUNCNAME $* + if latex-package_has_tetex_3 ; then + texmf-update + else + texconfig rehash + fi +} + +EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm diff --git a/sdk_container/src/third_party/portage-stable/eclass/linux-mod.eclass b/sdk_container/src/third_party/portage-stable/eclass/linux-mod.eclass new file mode 100644 index 0000000000..7ffd8a218a --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/linux-mod.eclass @@ -0,0 +1,756 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/linux-mod.eclass,v 1.98 2010/01/17 04:00:07 robbat2 Exp $ + +# Author(s): John Mylchreest , +# Stefan Schweizer +# Maintainer: kernel-misc@gentoo.org +# +# Please direct your bugs to the current eclass maintainer :) + +# @ECLASS: linux-mod.eclass +# @MAINTAINER: +# kernel-misc@gentoo.org +# @BLURB: It provides the functionality required to install external modules against a kernel source tree. +# @DESCRIPTION: +# This eclass is used to interface with linux-info.eclass in such a way +# to provide the functionality and initial functions +# required to install external modules against a kernel source +# tree. + +# A Couple of env vars are available to effect usage of this eclass +# These are as follows: + +# @ECLASS-VARIABLE: KERNEL_DIR +# @DESCRIPTION: +# A string containing the directory of the target kernel sources. The default value is +# "/usr/src/linux" + +# @ECLASS-VARIABLE: ECONF_PARAMS +# @DESCRIPTION: +# It's a string containing the parameters to pass to econf. +# If this is not set, then econf isn't run. + +# @ECLASS-VARIABLE: BUILD_PARAMS +# @DESCRIPTION: +# It's a string with the parameters to pass to emake. + +# @ECLASS-VARIABLE: BUILD_TARGETS +# @DESCRIPTION: +# It's a string with the build targets to pass to make. The default value is "clean modules" + +# @ECLASS-VARIABLE: MODULE_NAMES +# @DESCRIPTION: +# It's a string containing the modules to be built automatically using the default +# src_compile/src_install. It will only make ${BUILD_TARGETS} once in any directory. +# +# The structure of each MODULE_NAMES entry is as follows: +# +# modulename(libdir:srcdir:objdir) +# +# where: +# +# modulename = name of the module file excluding the .ko +# libdir = place in system modules directory where module is installed (by default it's misc) +# srcdir = place for ebuild to cd to before running make (by default it's ${S}) +# objdir = place the .ko and objects are located after make runs (by default it's set to srcdir) +# +# To get an idea of how these variables are used, here's a few lines +# of code from around line 540 in this eclass: +# +# einfo "Installing ${modulename} module" +# cd ${objdir} || die "${objdir} does not exist" +# insinto /lib/modules/${KV_FULL}/${libdir} +# doins ${modulename}.${KV_OBJ} || die "doins ${modulename}.${KV_OBJ} failed" +# +# For example: +# MODULE_NAMES="module_pci(pci:${S}/pci:${S}) module_usb(usb:${S}/usb:${S})" +# +# what this would do is +# +# cd "${S}"/pci +# make ${BUILD_PARAMS} ${BUILD_TARGETS} +# cd "${S}" +# insinto /lib/modules/${KV_FULL}/pci +# doins module_pci.${KV_OBJ} +# +# cd "${S}"/usb +# make ${BUILD_PARAMS} ${BUILD_TARGETS} +# cd "${S}" +# insinto /lib/modules/${KV_FULL}/usb +# doins module_usb.${KV_OBJ} + +# There is also support for automated modprobe.d/modules.d(2.4) file generation. +# This can be explicitly enabled by setting any of the following variables. + +# @ECLASS-VARIABLE: MODULESD__ENABLED +# @DESCRIPTION: +# This is used to disable the modprobe.d/modules.d file generation otherwise the file will be +# always generated (unless no MODULESD__* variable is provided). Set to "no" to disable +# the generation of the file and the installation of the documentation. + +# @ECLASS-VARIABLE: MODULESD__EXAMPLES +# @DESCRIPTION: +# This is a bash array containing a list of examples which should +# be used. If you want us to try and take a guess set this to "guess". +# +# For each array_component it's added an options line in the modprobe.d/modules.d file +# +# options array_component +# +# where array_component is " options" (see modprobe.conf(5)) + +# @ECLASS-VARIABLE: MODULESD__ALIASES +# @DESCRIPTION: +# This is a bash array containing a list of associated aliases. +# +# For each array_component it's added an alias line in the modprobe.d/modules.d file +# +# alias array_component +# +# where array_component is "wildcard " (see modprobe.conf(5)) + +# @ECLASS-VARIABLE: MODULESD__ADDITIONS +# @DESCRIPTION: +# This is a bash array containing a list of additional things to +# add to the bottom of the file. This can be absolutely anything. +# Each entry is a new line. + +# @ECLASS-VARIABLE: MODULESD__DOCS +# @DESCRIPTION: +# This is a string list which contains the full path to any associated +# documents for . These files are installed in the live tree. + +# @ECLASS-VARIABLE: KV_OBJ +# @DESCRIPTION: +# It's a read-only variable. It contains the extension of the kernel modules. + +# The order of these is important as both of linux-info and eutils contain +# set_arch_to_kernel and set_arch_to_portage functions and the ones in eutils +# are deprecated in favor of the ones in linux-info. +# See http://bugs.gentoo.org/show_bug.cgi?id=127506 + +inherit eutils linux-info multilib +EXPORT_FUNCTIONS pkg_setup pkg_preinst pkg_postinst src_install src_compile pkg_postrm + +IUSE="kernel_linux" +SLOT="0" +DESCRIPTION="Based on the $ECLASS eclass" +RDEPEND="kernel_linux? ( virtual/modutils )" +DEPEND="${RDEPEND} + sys-apps/sed + kernel_linux? ( virtual/linux-sources )" + +# eclass utilities +# ---------------------------------- + +check_vermagic() { + debug-print-function ${FUNCNAME} $* + + local curr_gcc_ver=$(gcc -dumpversion) + local tmpfile old_chost old_gcc_ver result=0 + + tmpfile=`find "${KV_DIR}/" -iname "*.o.cmd" -exec grep usr/lib/gcc {} \; -quit` + tmpfile=${tmpfile//*usr/lib} + tmpfile=${tmpfile//\/include*} + old_chost=${tmpfile//*gcc\/} + old_chost=${old_chost//\/*} + old_gcc_ver=${tmpfile//*\/} + + if [[ -z ${old_gcc_ver} || -z ${old_chost} ]]; then + ewarn "" + ewarn "Unable to detect what version of GCC was used to compile" + ewarn "the kernel. Build will continue, but you may experience problems." + elif [[ ${curr_gcc_ver} != ${old_gcc_ver} ]]; then + ewarn "" + ewarn "The version of GCC you are using (${curr_gcc_ver}) does" + ewarn "not match the version of GCC used to compile the" + ewarn "kernel (${old_gcc_ver})." + result=1 + elif [[ ${CHOST} != ${old_chost} ]]; then + ewarn "" + ewarn "The current CHOST (${CHOST}) does not match the chost" + ewarn "used when compiling the kernel (${old_chost})." + result=1 + fi + + if [[ ${result} -gt 0 ]]; then + ewarn "" + ewarn "Build will not continue, because you will experience problems." + ewarn "To fix this either change the version of GCC you wish to use" + ewarn "to match the kernel, or recompile the kernel first." + die "GCC Version Mismatch." + fi +} + +# @FUNCTION: use_m +# @RETURN: true or false +# @DESCRIPTION: +# It checks if the kernel version is greater than 2.6.5. +use_m() { + debug-print-function ${FUNCNAME} $* + + # if we haven't determined the version yet, we need too. + get_version; + + # if the kernel version is greater than 2.6.6 then we should use + # M= instead of SUBDIRS= + [ ${KV_MAJOR} -eq 2 -a ${KV_MINOR} -gt 5 -a ${KV_PATCH} -gt 5 ] && \ + return 0 || return 1 +} + +# @FUNCTION: convert_to_m +# @USAGE: /path/to/the/file +# @DESCRIPTION: +# It converts a file (e.g. a makefile) to use M= instead of SUBDIRS= +convert_to_m() { + debug-print-function ${FUNCNAME} $* + + if use_m + then + [ ! -f "${1}" ] && \ + die "convert_to_m() requires a filename as an argument" + ebegin "Converting ${1/${WORKDIR}\//} to use M= instead of SUBDIRS=" + sed -i 's:SUBDIRS=:M=:g' "${1}" + eend $? + fi +} + +# internal function +# +# FUNCTION: update_depmod +# DESCRIPTION: +# It updates the modules.dep file for the current kernel. +update_depmod() { + debug-print-function ${FUNCNAME} $* + + # if we haven't determined the version yet, we need too. + get_version; + + ebegin "Updating module dependencies for ${KV_FULL}" + if [ -r "${KV_OUT_DIR}"/System.map ] + then + depmod -ae -F "${KV_OUT_DIR}"/System.map -b "${ROOT}" -r ${KV_FULL} + eend $? + else + ewarn + ewarn "${KV_OUT_DIR}/System.map not found." + ewarn "You must manually update the kernel module dependencies using depmod." + eend 1 + ewarn + fi +} + +# internal function +# +# FUNCTION: update_modules +# DESCRIPTION: +# It calls the update-modules utility. +update_modules() { + debug-print-function ${FUNCNAME} $* + + if [ -x /sbin/update-modules ] && \ + grep -v -e "^#" -e "^$" "${D}"/etc/modules.d/* >/dev/null 2>&1; then + ebegin "Updating modules.conf" + /sbin/update-modules + eend $? + elif [ -x /sbin/update-modules ] && \ + grep -v -e "^#" -e "^$" "${D}"/etc/modules.d/* >/dev/null 2>&1; then + ebegin "Updating modules.conf" + /sbin/update-modules + eend $? + fi +} + +# internal function +# +# FUNCTION: move_old_moduledb +# DESCRIPTION: +# It updates the location of the database used by the module-rebuild utility. +move_old_moduledb() { + debug-print-function ${FUNCNAME} $* + + local OLDDIR="${ROOT}"/usr/share/module-rebuild/ + local NEWDIR="${ROOT}"/var/lib/module-rebuild/ + + if [[ -f "${OLDDIR}"/moduledb ]]; then + [[ ! -d "${NEWDIR}" ]] && mkdir -p "${NEWDIR}" + [[ ! -f "${NEWDIR}"/moduledb ]] && \ + mv "${OLDDIR}"/moduledb "${NEWDIR}"/moduledb + rm -f "${OLDDIR}"/* + rmdir "${OLDDIR}" + fi +} + +# internal function +# +# FUNCTION: update_moduledb +# DESCRIPTION: +# It adds the package to the /var/lib/module-rebuild/moduledb database used by the module-rebuild utility. +update_moduledb() { + debug-print-function ${FUNCNAME} $* + + local MODULEDB_DIR="${ROOT}"/var/lib/module-rebuild/ + move_old_moduledb + + if [[ ! -f "${MODULEDB_DIR}"/moduledb ]]; then + [[ ! -d "${MODULEDB_DIR}" ]] && mkdir -p "${MODULEDB_DIR}" + touch "${MODULEDB_DIR}"/moduledb + fi + + if ! grep -qs ${CATEGORY}/${PN}-${PVR} "${MODULEDB_DIR}"/moduledb ; then + einfo "Adding module to moduledb." + echo "a:1:${CATEGORY}/${PN}-${PVR}" >> "${MODULEDB_DIR}"/moduledb + fi +} + +# internal function +# +# FUNCTION: remove_moduledb +# DESCRIPTION: +# It removes the package from the /var/lib/module-rebuild/moduledb database used by +# the module-rebuild utility. +remove_moduledb() { + debug-print-function ${FUNCNAME} $* + + local MODULEDB_DIR="${ROOT}"/var/lib/module-rebuild/ + move_old_moduledb + + if grep -qs ${CATEGORY}/${PN}-${PVR} "${MODULEDB_DIR}"/moduledb ; then + einfo "Removing ${CATEGORY}/${PN}-${PVR} from moduledb." + sed -i -e "/.*${CATEGORY}\/${PN}-${PVR}.*/d" "${MODULEDB_DIR}"/moduledb + fi +} + +# @FUNCTION: set_kvobj +# @DESCRIPTION: +# It sets the KV_OBJ variable. +set_kvobj() { + debug-print-function ${FUNCNAME} $* + + if kernel_is 2 6 + then + KV_OBJ="ko" + else + KV_OBJ="o" + fi + # Do we really need to know this? + # Lets silence it. + # einfo "Using KV_OBJ=${KV_OBJ}" +} + +get-KERNEL_CC() { + debug-print-function ${FUNCNAME} $* + + if [[ -n ${KERNEL_CC} ]] ; then + echo "${KERNEL_CC}" + return + fi + + local kernel_cc + if [ -n "${KERNEL_ABI}" ]; then + # In future, an arch might want to define CC_$ABI + #kernel_cc="$(get_abi_CC)" + #[ -z "${kernel_cc}" ] && + kernel_cc="$(tc-getCC $(ABI=${KERNEL_ABI} get_abi_CHOST))" + else + kernel_cc=$(tc-getCC) + fi + echo "${kernel_cc}" +} + +# internal function +# +# FUNCTION: +# USAGE: /path/to/the/modulename_without_extension +# RETURN: A file in /etc/modules.d/ (kernel < 2.6) or /etc/modprobe.d/ (kernel >= 2.6) +# DESCRIPTION: +# This function will generate and install the neccessary modprobe.d/modules.d file from the +# information contained in the modules exported parms. +# (see the variables MODULESD__ENABLED, MODULESD__EXAMPLES, +# MODULESD__ALIASES, MODULESD__ADDITION and MODULESD__DOCS). +# +# At the end the documentation specified with MODULESD__DOCS is installed. +generate_modulesd() { + debug-print-function ${FUNCNAME} $* + + local currm_path currm currm_t t myIFS myVAR + local module_docs module_enabled module_aliases \ + module_additions module_examples module_modinfo module_opts + + for currm_path in ${@} + do + currm=${currm_path//*\/} + currm=$(echo ${currm} | tr '[:lower:]' '[:upper:]') + currm_t=${currm} + while [[ -z ${currm_t//*-*} ]]; do + currm_t=${currm_t/-/_} + done + + module_docs="$(eval echo \${MODULESD_${currm_t}_DOCS})" + module_enabled="$(eval echo \${MODULESD_${currm_t}_ENABLED})" + module_aliases="$(eval echo \${#MODULESD_${currm_t}_ALIASES[*]})" + module_additions="$(eval echo \${#MODULESD_${currm_t}_ADDITIONS[*]})" + module_examples="$(eval echo \${#MODULESD_${currm_t}_EXAMPLES[*]})" + + [[ ${module_aliases} -eq 0 ]] && unset module_aliases + [[ ${module_additions} -eq 0 ]] && unset module_additions + [[ ${module_examples} -eq 0 ]] && unset module_examples + + # If we specify we dont want it, then lets exit, otherwise we assume + # that if its set, we do want it. + [[ ${module_enabled} == no ]] && return 0 + + # unset any unwanted variables. + for t in ${!module_*} + do + [[ -z ${!t} ]] && unset ${t} + done + + [[ -z ${!module_*} ]] && return 0 + + # OK so now if we have got this far, then we know we want to continue + # and generate the modules.d file. + module_modinfo="$(modinfo -p ${currm_path}.${KV_OBJ})" + module_config="${T}/modulesd-${currm}" + + ebegin "Preparing file for modules.d" + #----------------------------------------------------------------------- + echo "# modules.d configuration file for ${currm}" >> "${module_config}" + #----------------------------------------------------------------------- + [[ -n ${module_docs} ]] && \ + echo "# For more information please read:" >> "${module_config}" + for t in ${module_docs} + do + echo "# ${t//*\/}" >> "${module_config}" + done + echo >> "${module_config}" + + #----------------------------------------------------------------------- + if [[ ${module_aliases} -gt 0 ]] + then + echo "# Internal Aliases - Do not edit" >> "${module_config}" + echo "# ------------------------------" >> "${module_config}" + + for((t=0; t<${module_aliases}; t++)) + do + echo "alias $(eval echo \${MODULESD_${currm}_ALIASES[$t]})" \ + >> "${module_config}" + done + echo '' >> "${module_config}" + fi + + #----------------------------------------------------------------------- + if [[ -n ${module_modinfo} ]] + then + echo >> "${module_config}" + echo "# Configurable module parameters" >> "${module_config}" + echo "# ------------------------------" >> "${module_config}" + myIFS="${IFS}" + IFS="$(echo -en "\n\b")" + + for t in ${module_modinfo} + do + myVAR="$(echo ${t#*:} | grep -e " [0-9][ =]" | sed "s:.*\([01][= ]\).*:\1:")" + if [[ -n ${myVAR} ]] + then + module_opts="${module_opts} ${t%%:*}:${myVAR}" + fi + echo -e "# ${t%%:*}:\t${t#*:}" >> "${module_config}" + done + IFS="${myIFS}" + echo '' >> "${module_config}" + fi + + #----------------------------------------------------------------------- + if [[ $(eval echo \${MODULESD_${currm}_ALIASES[0]}) == guess ]] + then + # So lets do some guesswork eh? + if [[ -n ${module_opts} ]] + then + echo "# For Example..." >> "${module_config}" + echo "# --------------" >> "${module_config}" + for t in ${module_opts} + do + echo "# options ${currm} ${t//:*}=${t//*:}" >> "${module_config}" + done + echo '' >> "${module_config}" + fi + elif [[ ${module_examples} -gt 0 ]] + then + echo "# For Example..." >> "${module_config}" + echo "# --------------" >> "${module_config}" + for((t=0; t<${module_examples}; t++)) + do + echo "options $(eval echo \${MODULESD_${currm}_EXAMPLES[$t]})" \ + >> "${module_config}" + done + echo '' >> "${module_config}" + fi + + #----------------------------------------------------------------------- + if [[ ${module_additions} -gt 0 ]] + then + for((t=0; t<${module_additions}; t++)) + do + echo "$(eval echo \${MODULESD_${currm}_ADDITIONS[$t]})" \ + >> "${module_config}" + done + echo '' >> "${module_config}" + fi + + #----------------------------------------------------------------------- + + # then we install it + if kernel_is ge 2 6; then + insinto /etc/modprobe.d + else + insinto /etc/modules.d + fi + newins "${module_config}" "${currm_path//*\/}.conf" + + # and install any documentation we might have. + [[ -n ${module_docs} ]] && dodoc ${module_docs} + done + eend 0 + return 0 +} + +# internal function +# +# FUNCTION: find_module_params +# USAGE: A string "NAME(LIBDIR:SRCDIR:OBJDIR)" +# RETURN: The string "modulename:NAME libdir:LIBDIR srcdir:SRCDIR objdir:OBJDIR" +# DESCRIPTION: +# Analyze the specification NAME(LIBDIR:SRCDIR:OBJDIR) of one module as described in MODULE_NAMES. +find_module_params() { + debug-print-function ${FUNCNAME} $* + + local matched_offset=0 matched_opts=0 test="${@}" temp_var result + local i=0 y=0 z=0 + + for((i=0; i<=${#test}; i++)) + do + case ${test:${i}:1} in + \() matched_offset[0]=${i};; + \:) matched_opts=$((${matched_opts} + 1)); + matched_offset[${matched_opts}]="${i}";; + \)) matched_opts=$((${matched_opts} + 1)); + matched_offset[${matched_opts}]="${i}";; + esac + done + + for((i=0; i<=${matched_opts}; i++)) + do + # i = offset were working on + # y = last offset + # z = current offset - last offset + # temp_var = temporary name + case ${i} in + 0) tempvar=${test:0:${matched_offset[0]}};; + *) y=$((${matched_offset[$((${i} - 1))]} + 1)) + z=$((${matched_offset[${i}]} - ${matched_offset[$((${i} - 1))]})); + z=$((${z} - 1)) + tempvar=${test:${y}:${z}};; + esac + + case ${i} in + 0) result="${result} modulename:${tempvar}";; + 1) result="${result} libdir:${tempvar}";; + 2) result="${result} srcdir:${tempvar}";; + 3) result="${result} objdir:${tempvar}";; + esac + done + + echo ${result} +} + +# default ebuild functions +# -------------------------------- + +# @FUNCTION: linux-mod_pkg_setup +# @DESCRIPTION: +# It checks the CONFIG_CHECK options (see linux-info.eclass(5)), verifies that the kernel is +# configured, verifies that the sources are prepared, verifies that the modules support is builtin +# in the kernel and sets the object extension KV_OBJ. +linux-mod_pkg_setup() { + debug-print-function ${FUNCNAME} $* + + # If we are installing a binpkg, take a different path. + if [[ $EMERGE_FROM == binary ]]; then + linux-mod_pkg_setup_binary + return + fi + + linux-info_pkg_setup; + require_configured_kernel + check_kernel_built; + strip_modulenames; + [[ -n ${MODULE_NAMES} ]] && check_modules_supported + set_kvobj; + # Commented out with permission from johnm until a fixed version for arches + # who intentionally use different kernel and userland compilers can be + # introduced - Jason Wever , 23 Oct 2005 + #check_vermagic; +} + +# @FUNCTION: linux-mod_pkg_setup_binary +# @DESCRIPTION: +# Perform all kernel option checks non-fatally, as the .config and +# /proc/config.gz might not be present. Do not do anything that requires kernel +# sources. +linux-mod_pkg_setup_binary() { + debug-print-function ${FUNCNAME} $* + local new_CONFIG_CHECK + for config in $CONFIG_CHECK ; do + case ${config:0:1} in + ~) optional="" ;; + *) optional="~" ;; + esac + new_CONFIG_CHECK="${new_CONFIG_CHECK} ${optional}${config}" + done + export CONFIG_CHECK="${new_CONFIG_CHECK}" + linux-info_pkg_setup; +} + +strip_modulenames() { + debug-print-function ${FUNCNAME} $* + + local i + for i in ${MODULE_IGNORE}; do + MODULE_NAMES=${MODULE_NAMES//${i}(*} + done +} + +# @FUNCTION: linux-mod_src_compile +# @DESCRIPTION: +# It compiles all the modules specified in MODULE_NAMES. For each module the econf command is +# executed only if ECONF_PARAMS is defined, the name of the target is specified by BUILD_TARGETS +# while the options are in BUILD_PARAMS (all the modules share these variables). The compilation +# happens inside ${srcdir}. +# +# Look at the description of these variables for more details. +linux-mod_src_compile() { + debug-print-function ${FUNCNAME} $* + + local modulename libdir srcdir objdir i n myABI="${ABI}" + set_arch_to_kernel + ABI="${KERNEL_ABI}" + + BUILD_TARGETS=${BUILD_TARGETS:-clean module} + strip_modulenames; + cd "${S}" + touch Module.symvers + for i in ${MODULE_NAMES} + do + unset libdir srcdir objdir + for n in $(find_module_params ${i}) + do + eval ${n/:*}=${n/*:/} + done + libdir=${libdir:-misc} + srcdir=${srcdir:-${S}} + objdir=${objdir:-${srcdir}} + + if [ ! -f "${srcdir}/.built" ]; + then + cd "${srcdir}" + ln -s "${S}"/Module.symvers Module.symvers + einfo "Preparing ${modulename} module" + if [[ -n ${ECONF_PARAMS} ]] + then + econf ${ECONF_PARAMS} || \ + die "Unable to run econf ${ECONF_PARAMS}" + fi + + # This looks messy, but it is needed to handle multiple variables + # being passed in the BUILD_* stuff where the variables also have + # spaces that must be preserved. If don't do this, then the stuff + # inside the variables gets used as targets for Make, which then + # fails. + eval "emake HOSTCC=\"$(tc-getBUILD_CC)\" \ + CROSS_COMPILE=${CHOST}- \ + LDFLAGS=\"$(get_abi_LDFLAGS)\" \ + ${BUILD_FIXES} \ + ${BUILD_PARAMS} \ + ${BUILD_TARGETS} " \ + || die "Unable to emake HOSTCC="$(tc-getBUILD_CC)" CROSS_COMPILE=${CHOST}- LDFLAGS="$(get_abi_LDFLAGS)" ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS}" + cd "${OLDPWD}" + touch "${srcdir}"/.built + fi + done + + set_arch_to_portage + ABI="${myABI}" +} + +# @FUNCTION: linux-mod_src_install +# @DESCRIPTION: +# It install the modules specified in MODULES_NAME. The modules should be inside the ${objdir} +# directory and they are installed inside /lib/modules/${KV_FULL}/${libdir}. +# +# The modprobe.d/modules.d configuration file is automatically generated if the +# MODULESD__* variables are defined. The only way to stop this process is by +# setting MODULESD__ENABLED=no. At the end the documentation specified via +# MODULESD__DOCS is also installed. +# +# Look at the description of these variables for more details. +linux-mod_src_install() { + debug-print-function ${FUNCNAME} $* + + local modulename libdir srcdir objdir i n + + strip_modulenames; + for i in ${MODULE_NAMES} + do + unset libdir srcdir objdir + for n in $(find_module_params ${i}) + do + eval ${n/:*}=${n/*:/} + done + libdir=${libdir:-misc} + srcdir=${srcdir:-${S}} + objdir=${objdir:-${srcdir}} + + einfo "Installing ${modulename} module" + cd "${objdir}" || die "${objdir} does not exist" + insinto /lib/modules/${KV_FULL}/${libdir} + doins ${modulename}.${KV_OBJ} || die "doins ${modulename}.${KV_OBJ} failed" + cd "${OLDPWD}" + + generate_modulesd "${objdir}/${modulename}" + done +} + +# @FUNCTION: linux-mod_pkg_preinst +# @DESCRIPTION: +# It checks what to do after having merged the package. +linux-mod_pkg_preinst() { + debug-print-function ${FUNCNAME} $* + + [ -d "${D}lib/modules" ] && UPDATE_DEPMOD=true || UPDATE_DEPMOD=false + [ -d "${D}etc/modules.d" ] && UPDATE_MODULES=true || UPDATE_MODULES=false + [ -d "${D}lib/modules" ] && UPDATE_MODULEDB=true || UPDATE_MODULEDB=false +} + +# @FUNCTION: linux-mod_pkg_postinst +# @DESCRIPTION: +# It executes /sbin/depmod and adds the package to the /var/lib/module-rebuild/moduledb +# database (if ${D}/lib/modules is created) and it runs /sbin/update-modules +# (if ${D}/etc/modules.d is created). +linux-mod_pkg_postinst() { + debug-print-function ${FUNCNAME} $* + + ${UPDATE_DEPMOD} && update_depmod; + ${UPDATE_MODULES} && update_modules; + ${UPDATE_MODULEDB} && update_moduledb; +} + +# @FUNCTION: linux-mod_pkg_postrm +# @DESCRIPTION: +# It removes the package from the /var/lib/module-rebuild/moduledb database but it doens't +# call /sbin/depmod and /sbin/update-modules because the modules are still installed. +linux-mod_pkg_postrm() { + debug-print-function ${FUNCNAME} $* + remove_moduledb; +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/mailer.eclass b/sdk_container/src/third_party/portage-stable/eclass/mailer.eclass new file mode 100644 index 0000000000..63575aa4fd --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/mailer.eclass @@ -0,0 +1,48 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/mailer.eclass,v 1.16 2009/11/30 04:19:36 abcd Exp $ + +# @DEAD +# To be removed on 2011/11/30. +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" + +EXPORT_FUNCTIONS pkg_postrm + +# Gets current mailer profile +mailer_get_current() { + mailer-config --get-current-profile +} + +# Set current mailer profile +mailer_set_profile() { + local newprofile=${1:-${P}} + + ebegin "Setting the current mailer profile to \"${newprofile}\"" + mailer-config --set-profile ${newprofile} >/dev/null || die + eend $? +} + +# Wipe unused configs +mailer_wipe_confs() { + local x i + + ebegin "Wiping all unused mailer profiles" + for x in /etc/mail/*.mailer ; do + i=${x##*/} + i=${i%.mailer} + + [[ ${i} == ${P} ]] && continue + [[ ${i} == "default" ]] && continue + has_version "~mail-mta/${i}" || rm ${x} + done + eend 0 +} + +mailer_pkg_postrm() { + if use mailwrapper ; then + mailer_wipe_confs + + # We are removing the current profile, switch back to default + [[ $(mailer_get_current) == ${P} ]] && mailer_set_profile default + fi +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/makeedit.eclass b/sdk_container/src/third_party/portage-stable/eclass/makeedit.eclass new file mode 100644 index 0000000000..bd744b8f80 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/makeedit.eclass @@ -0,0 +1,37 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/makeedit.eclass,v 1.12 2008/07/17 09:58:40 pva Exp $ + +# @ECLASS: makeedit.eclass +# @MAINTAINER: +# Author: Spider +# @BLURB: An eclass to replace some flags in makefiles +# @DESCRIPTION: +# +# @CODE +# To use this eclass, do 2 things: +# 1. append-flags "$MAKEEDIT_FLAGS". If you filter-flags, make sure to do +# the append-flags afterward, otherwise you'll lose them. +# 2. after running configure or econf, call edit_makefiles to remove +# extraneous CFLAGS from your Makefiles. +# @CODE +# +# This combination should reduce the RAM requirements of your build, and maybe +# even speed it up a bit. + + +MAKEEDIT_FLAGS="-Wno-return-type -w" + +# @FUNCTION: edit_makefiles +# @DESCRIPTION: +# Removes some flags in makefiles +edit_makefiles() { + # We already add "-Wno-return-type -w" to compiler flags, so + # no need to replace "-Wall" and "-Wreturn-type" with them. + einfo "Parsing Makefiles ..." + find . \( -iname makefile -o -name \*.mk -o -name GNUmakefile \) -print0 | \ + xargs -0 sed -i \ + -e 's:-Wall::g' \ + -e 's:-Wreturn-type::g' \ + -e 's:-pedantic::g' +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/matrox.eclass b/sdk_container/src/third_party/portage-stable/eclass/matrox.eclass new file mode 100644 index 0000000000..d4d117c4cf --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/matrox.eclass @@ -0,0 +1,7 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/matrox.eclass,v 1.20 2009/11/30 04:19:36 abcd Exp $ + +# @DEAD +# To be removed on 2011/11/30. +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" diff --git a/sdk_container/src/third_party/portage-stable/eclass/mercurial.eclass b/sdk_container/src/third_party/portage-stable/eclass/mercurial.eclass new file mode 100644 index 0000000000..b4cc78f7e3 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/mercurial.eclass @@ -0,0 +1,127 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/mercurial.eclass,v 1.11 2010/03/06 12:24:05 djc Exp $ + +# @ECLASS: mercurial.eclass +# @MAINTAINER: +# nelchael@gentoo.org +# @BLURB: This eclass provides generic mercurial fetching functions +# @DESCRIPTION: +# This eclass provides generic mercurial fetching functions. To fetch sources +# from mercurial repository just set EHG_REPO_URI to correct repository URI. If +# you need to share single repository between several ebuilds set EHG_PROJECT to +# project name in all of them. + +inherit eutils + +EXPORT_FUNCTIONS src_unpack + +DEPEND="dev-vcs/mercurial" + +# @ECLASS-VARIABLE: EHG_REPO_URI +# @DESCRIPTION: +# Mercurial repository URI. + +# @ECLASS-VARIABLE: EHG_REVISION +# @DESCRIPTION: +# Create working directory for specified revision, defaults to tip. +# +# EHG_REVISION is passed as a value for --rev parameter, so it can be more than +# just a revision, please consult `hg help revisions' for more details. +[[ -z "${EHG_REVISION}" ]] && EHG_REVISION="tip" + +# @ECLASS-VARIABLE: EHG_PROJECT +# @DESCRIPTION: +# Project name. +# +# This variable default to $PN, but can be changed to allow repository sharing +# between several ebuilds. +[[ -z "${EHG_PROJECT}" ]] && EHG_PROJECT="${PN}" + +# @ECLASS-VARIABLE: EHG_QUIET +# @DESCRIPTION: +# Suppress some extra noise from mercurial, set it to 'OFF' to be louder. +: ${EHG_QUIET:="ON"} +[[ "${EHG_QUIET}" == "ON" ]] && EHG_QUIET_CMD_OPT="--quiet" + +# @ECLASS-VARIABLE: EHG_CLONE_CMD +# @DESCRIPTION: +# Command used to perform initial repository clone. +[[ -z "${EHG_CLONE_CMD}" ]] && EHG_CLONE_CMD="hg clone ${EHG_QUIET_CMD_OPT} --pull --noupdate" + +# @ECLASS-VARIABLE: EHG_PULL_CMD +# @DESCRIPTION: +# Command used to update repository. +[[ -z "${EHG_PULL_CMD}" ]] && EHG_PULL_CMD="hg pull ${EHG_QUIET_CMD_OPT}" + +# @ECLASS-VARIABLE: EHG_OFFLINE +# @DESCRIPTION: +# Set this variable to a non-empty value to disable the automatic updating of +# a mercurial source tree. This is intended to be set outside the ebuild by +# users. +EHG_OFFLINE="${EHG_OFFLINE:-${ESCM_OFFLINE}}" + +# @FUNCTION: mercurial_fetch +# @USAGE: [repository_uri] [module] +# @DESCRIPTION: +# Clone or update repository. +# +# If not repository URI is passed it defaults to EHG_REPO_URI, if module is +# empty it defaults to basename of EHG_REPO_URI. +function mercurial_fetch { + debug-print-function ${FUNCNAME} ${*} + + EHG_REPO_URI=${1-${EHG_REPO_URI}} + [[ -z "${EHG_REPO_URI}" ]] && die "EHG_REPO_URI is empty" + + local hg_src_dir="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/hg-src" + local module="${2-$(basename "${EHG_REPO_URI}")}" + + # Should be set but blank to prevent using $HOME/.hgrc + export HGRCPATH= + + # Check ${hg_src_dir} directory: + addwrite "$(dirname "${hg_src_dir}")" || die "addwrite failed" + if [[ ! -d "${hg_src_dir}" ]]; then + mkdir -p "${hg_src_dir}" || die "failed to create ${hg_src_dir}" + chmod -f g+rw "${hg_src_dir}" || \ + die "failed to chown ${hg_src_dir}" + fi + + # Create project directory: + mkdir -p "${hg_src_dir}/${EHG_PROJECT}" || \ + die "failed to create ${hg_src_dir}/${EHG_PROJECT}" + chmod -f g+rw "${hg_src_dir}/${EHG_PROJECT}" || \ + echo "Warning: failed to chmod g+rw ${EHG_PROJECT}" + cd "${hg_src_dir}/${EHG_PROJECT}" || \ + die "failed to cd to ${hg_src_dir}/${EHG_PROJECT}" + + # Clone/update repository: + if [[ ! -d "${module}" ]]; then + einfo "Cloning ${EHG_REPO_URI} to ${hg_src_dir}/${EHG_PROJECT}/${module}" + ${EHG_CLONE_CMD} "${EHG_REPO_URI}" "${module}" || { + rm -rf "${module}" + die "failed to clone ${EHG_REPO_URI}" + } + cd "${module}" + elif [[ -z "${EHG_OFFLINE}" ]]; then + einfo "Updating ${hg_src_dir}/${EHG_PROJECT}/${module} from ${EHG_REPO_URI}" + cd "${module}" || die "failed to cd to ${module}" + ${EHG_PULL_CMD} || die "update failed" + fi + + # Checkout working copy: + einfo "Creating working directory in ${WORKDIR}/${module} (revision: ${EHG_REVISION})" + hg clone \ + ${EHG_QUIET_CMD_OPT} \ + --rev="${EHG_REVISION}" \ + "${hg_src_dir}/${EHG_PROJECT}/${module}" \ + "${WORKDIR}/${module}" || die "hg clone failed" +} + +# @FUNCTION: mercurial_src_unpack +# @DESCRIPTION: +# The mercurial src_unpack function, which will be exported. +function mercurial_src_unpack { + mercurial_fetch +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/mono.eclass b/sdk_container/src/third_party/portage-stable/eclass/mono.eclass new file mode 100644 index 0000000000..8216138609 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/mono.eclass @@ -0,0 +1,80 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/mono.eclass,v 1.13 2009/03/08 15:46:54 loki_val Exp $ + +# @ECLASS: mono.eclass +# @MAINTAINER: +# dotnet@gentoo.org +# @BLURB: common settings and functions for mono and dotnet related +# packages +# @DESCRIPTION: +# The mono eclass contains common environment settings that are useful for +# dotnet packages. Currently, it provides no functions, just exports +# MONO_SHARED_DIR and sets LC_ALL in order to prevent errors during compilation +# of dotnet packages. + +inherit multilib + +# >=mono-0.92 versions using mcs -pkg:foo-sharp require shared memory, so we set the +# shared dir to ${T} so that ${T}/.wapi can be used during the install process. +export MONO_SHARED_DIR="${T}" + +# Building mono, nant and many other dotnet packages is known to fail if LC_ALL +# variable is not set to C. To prevent this all mono related packages will be +# build with LC_ALL=C (see bugs #146424, #149817) +export LC_ALL=C + +# Monodevelop-using applications need this to be set or they will try to create config +# files in the user's ~ dir. + +export XDG_CONFIG_HOME="${T}" + +# Fix bug 83020: +# "Access Violations Arise When Emerging Mono-Related Packages with MONO_AOT_CACHE" + +unset MONO_AOT_CACHE + +egacinstall() { + gacutil -i "${1}" \ + -root "${D}"/usr/$(get_libdir) \ + -gacdir /usr/$(get_libdir) \ + -package ${2:-${GACPN:-${PN}}} \ + || die "installing ${1} into the Global Assembly Cache failed" +} + +mono_multilib_comply() { + local dir finddirs=() mv_command=${mv_command:-mv} + if [[ -d "${D}/usr/lib" && "$(get_libdir)" != "lib" ]] + then + if ! [[ -d "${D}"/usr/"$(get_libdir)" ]] + then + mkdir "${D}"/usr/"$(get_libdir)" || die "Couldn't mkdir ${D}/usr/$(get_libdir)" + fi + ${mv_command} "${D}"/usr/lib/* "${D}"/usr/"$(get_libdir)"/ || die "Moving files into correct libdir failed" + rm -rf "${D}"/usr/lib + for dir in "${D}"/usr/"$(get_libdir)"/pkgconfig "${D}"/usr/share/pkgconfig + do + + if [[ -d "${dir}" && "$(find "${dir}" -name '*.pc')" != "" ]] + then + pushd "${dir}" &> /dev/null + sed -i -r -e 's:/(lib)([^a-zA-Z0-9]|$):/'"$(get_libdir)"'\2:g' \ + *.pc \ + || die "Sedding some sense into pkgconfig files failed." + popd "${dir}" &> /dev/null + fi + done + if [[ -d "${D}/usr/bin" ]] + then + for exe in "${D}/usr/bin"/* + do + if [[ "$(file "${exe}")" == *"shell script text"* ]] + then + sed -r -i -e ":/lib(/|$): s:/lib(/|$):/$(get_libdir)\1:" \ + "${exe}" || die "Sedding some sense into ${exe} failed" + fi + done + fi + + fi +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/mount-boot.eclass b/sdk_container/src/third_party/portage-stable/eclass/mount-boot.eclass new file mode 100644 index 0000000000..fb69e11e42 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/mount-boot.eclass @@ -0,0 +1,80 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/mount-boot.eclass,v 1.17 2009/10/09 20:57:08 vapier Exp $ +# +# This eclass is really only useful for bootloaders. +# +# If the live system has a separate /boot partition configured, then this +# function tries to ensure that it's mounted in rw mode, exiting with an +# error if it cant. It does nothing if /boot isn't a separate partition. +# +# MAINTAINER: base-system@gentoo.org + +EXPORT_FUNCTIONS pkg_preinst pkg_prerm + +mount-boot_mount_boot_partition() { + if [[ -n ${DONT_MOUNT_BOOT} ]] ; then + return + else + elog + elog "To avoid automounting and auto(un)installing with /boot," + elog "just export the DONT_MOUNT_BOOT variable." + elog + fi + + # note that /dev/BOOT is in the Gentoo default /etc/fstab file + local fstabstate=$(awk '!/^#|^[[:blank:]]+#|^\/dev\/BOOT/ {print $2}' /etc/fstab | egrep "^/boot$" ) + local procstate=$(awk '$2 ~ /^\/boot$/ {print $2}' /proc/mounts) + local proc_ro=$(awk '{ print $2 " ," $4 "," }' /proc/mounts | sed -n '/\/boot .*,ro,/p') + + if [ -n "${fstabstate}" ] && [ -n "${procstate}" ]; then + if [ -n "${proc_ro}" ]; then + einfo + einfo "Your boot partition, detected as being mounted as /boot, is read-only." + einfo "Remounting it in read-write mode ..." + einfo + mount -o remount,rw /boot + if [ "$?" -ne 0 ]; then + eerror + eerror "Unable to remount in rw mode. Please do it manually!" + eerror + die "Can't remount in rw mode. Please do it manually!" + fi + else + einfo + einfo "Your boot partition was detected as being mounted as /boot." + einfo "Files will be installed there for ${PN} to function correctly." + einfo + fi + elif [ -n "${fstabstate}" ] && [ -z "${procstate}" ]; then + mount /boot -o rw + if [ "$?" -eq 0 ]; then + einfo + einfo "Your boot partition was not mounted as /boot, but portage" + einfo "was able to mount it without additional intervention." + einfo "Files will be installed there for ${PN} to function correctly." + einfo + else + eerror + eerror "Cannot automatically mount your /boot partition." + eerror "Your boot partition has to be mounted rw before the installation" + eerror "can continue. ${PN} needs to install important files there." + eerror + die "Please mount your /boot partition manually!" + fi + else + einfo + einfo "Assuming you do not have a separate /boot partition." + einfo + fi +} + +mount-boot_pkg_preinst() { + mount-boot_mount_boot_partition +} + +mount-boot_pkg_prerm() { + touch "${ROOT}"/boot/.keep 2>/dev/null + mount-boot_mount_boot_partition + touch "${ROOT}"/boot/.keep 2>/dev/null +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/mozconfig-2.eclass b/sdk_container/src/third_party/portage-stable/eclass/mozconfig-2.eclass new file mode 100644 index 0000000000..8834d82880 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/mozconfig-2.eclass @@ -0,0 +1,67 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/mozconfig-2.eclass,v 1.21 2010/01/27 12:06:22 ssuominen Exp $ +# +# mozconfig.eclass: the new mozilla.eclass + +inherit multilib flag-o-matic mozcoreconf + +IUSE="debug gnome ipv6 xinerama" + +RDEPEND="x11-libs/libXrender + x11-libs/libXt + x11-libs/libXmu + >=media-libs/jpeg-7 + >=media-libs/libpng-1.2.1 + dev-libs/expat + app-arch/zip + app-arch/unzip + >=x11-libs/gtk+-2.8.6 + >=dev-libs/glib-2.8.2 + >=x11-libs/pango-1.10.1 + >=dev-libs/libIDL-0.8.0 + gnome? ( >=gnome-base/gnome-vfs-2.3.5 + >=gnome-base/libgnomeui-2.2.0 ) + !=x11-libs/cairo-1.0.0" + #According to bugs #18573, #204520, and couple of others in Mozilla's + #bugzilla. libmng and mng support has been removed in 2003. + + +DEPEND="${RDEPEND} + xinerama? ( x11-proto/xineramaproto )" + +mozconfig_config() { + mozconfig_use_enable ipv6 + mozconfig_use_enable xinerama + + # We use --enable-pango to do truetype fonts, and currently pango + # is required for it to build + mozconfig_annotate gentoo --disable-freetype2 + + if use debug; then + mozconfig_annotate +debug \ + --enable-debug \ + --enable-tests \ + --disable-reorder \ + --enable-debugger-info-modules=ALL_MODULES + else + mozconfig_annotate -debug \ + --disable-debug \ + --disable-tests \ + --enable-reorder \ + + # Currently --enable-elf-dynstr-gc only works for x86 and ppc, + # thanks to Jason Wever for the fix. + # -- This breaks now on ppc, no idea why +# if use x86 || use ppc && [[ ${enable_optimize} != -O0 ]]; then + if use x86 && [[ ${enable_optimize} != -O0 ]]; then + mozconfig_annotate "${ARCH} optimized build" --enable-elf-dynstr-gc + fi + fi + + if ! use gnome; then + mozconfig_annotate -gnome --disable-gnomevfs + mozconfig_annotate -gnome --disable-gnomeui + fi +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/mozconfig-3.eclass b/sdk_container/src/third_party/portage-stable/eclass/mozconfig-3.eclass new file mode 100644 index 0000000000..0aff33b654 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/mozconfig-3.eclass @@ -0,0 +1,71 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/mozconfig-3.eclass,v 1.8 2010/01/27 12:06:22 ssuominen Exp $ +# +# mozconfig.eclass: the new mozilla.eclass + +inherit multilib flag-o-matic mozcoreconf-2 + +IUSE="gnome dbus startup-notification" + +RDEPEND="x11-libs/libXrender + x11-libs/libXt + x11-libs/libXmu + >=media-libs/jpeg-7 + dev-libs/expat + app-arch/zip + app-arch/unzip + >=x11-libs/gtk+-2.8.6 + >=dev-libs/glib-2.8.2 + >=x11-libs/pango-1.10.1 + >=dev-libs/libIDL-0.8.0 + gnome? ( >=gnome-base/gnome-vfs-2.16.3 + >=gnome-base/libgnomeui-2.16.1 + >=gnome-base/gconf-2.16.0 + >=gnome-base/libgnome-2.16.0 ) + dbus? ( >=dev-libs/dbus-glib-0.72 ) + startup-notification? ( >=x11-libs/startup-notification-0.8 ) + !=x11-libs/cairo-1.6.0" + #According to bugs #18573, #204520, and couple of others in Mozilla's + #bugzilla. libmng and mng support has been removed in 2003. + + +DEPEND="${RDEPEND}" + +mozconfig_config() { + if ${MN} || ${XUL} || ${TB}; then + mozconfig_annotate thebes --enable-default-toolkit=cairo-gtk2 + else + mozconfig_annotate -thebes --enable-default-toolkit=gtk2 + fi + + if ! use dbus; then + mozconfig_annotate '' --disable-dbus + fi + mozconfig_use_enable startup-notification + +# if use debug; then +# mozconfig_annotate +debug \ +# --enable-debug \ +# --enable-tests \ +# --enable-debugger-info-modules=ALL_MODULES +# else + mozconfig_annotate -debug \ + --disable-debug \ + --disable-tests + + # Currently --enable-elf-dynstr-gc only works for x86 and ppc, + # thanks to Jason Wever for the fix. + # -- This breaks now on ppc, no idea why +# if use x86 || use ppc && [[ ${enable_optimize} != -O0 ]]; then + if use x86 && [[ ${enable_optimize} != -O0 ]]; then + mozconfig_annotate "${ARCH} optimized build" --enable-elf-dynstr-gc + fi +# fi + + if ! use gnome; then + mozconfig_annotate -gnome --disable-gnomevfs + mozconfig_annotate -gnome --disable-gnomeui + fi +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/mozconfig.eclass b/sdk_container/src/third_party/portage-stable/eclass/mozconfig.eclass new file mode 100644 index 0000000000..485d31ad8d --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/mozconfig.eclass @@ -0,0 +1,7 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/mozconfig.eclass,v 1.33 2009/11/30 04:19:36 abcd Exp $ + +# @DEAD +# To be removed on 2011/11/30. +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" diff --git a/sdk_container/src/third_party/portage-stable/eclass/mozcoreconf-2.eclass b/sdk_container/src/third_party/portage-stable/eclass/mozcoreconf-2.eclass new file mode 100644 index 0000000000..425f11041c --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/mozcoreconf-2.eclass @@ -0,0 +1,288 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/mozcoreconf-2.eclass,v 1.15 2010/01/27 18:58:04 armin76 Exp $ +# +# mozcoreconf.eclass : core options for mozilla +# inherit mozconfig-2 if you need USE flags + +inherit multilib flag-o-matic + +IUSE="${IUSE} custom-optimization" + +RDEPEND="x11-libs/libXrender + x11-libs/libXt + x11-libs/libXmu + >=sys-libs/zlib-1.1.4" + +DEPEND="${RDEPEND} + dev-util/pkgconfig" + +# Set by configure (plus USE_AUTOCONF=1), but useful for NSPR +export MOZILLA_CLIENT=1 +export BUILD_OPT=1 +export NO_STATIC_LIB=1 +export USE_PTHREADS=1 + +mozconfig_init() { + declare enable_optimize pango_version myext x + declare MOZ=$([[ ${PN} == mozilla || ${PN} == gecko-sdk ]] && echo true || echo false) + declare FF=$([[ ${PN} == *firefox ]] && echo true || echo false) + declare TB=$([[ ${PN} == *thunderbird ]] && echo true || echo false) + declare SB=$([[ ${PN} == *sunbird ]] && echo true || echo false) + declare EM=$([[ ${PN} == enigmail ]] && echo true || echo false) + declare XUL=$([[ ${PN} == *xulrunner ]] && echo true || echo false) + declare SM=$([[ ${PN} == seamonkey ]] && echo true || echo false) + declare IC=$([[ ${PN} == *icecat ]] && echo true || echo false) + + #################################### + # + # Setup the initial .mozconfig + # See http://www.mozilla.org/build/configure-build.html + # + #################################### + + case ${PN} in + mozilla|gecko-sdk) + # The other builds have an initial --enable-extensions in their + # .mozconfig. The "default" set in configure applies to mozilla + # specifically. + : >.mozconfig || die "initial mozconfig creation failed" + mozconfig_annotate "" --enable-extensions=default ;; + *firefox) + cp browser/config/mozconfig .mozconfig \ + || die "cp browser/config/mozconfig failed" ;; + enigmail) + cp mail/config/mozconfig .mozconfig \ + || die "cp mail/config/mozconfig failed" ;; + *xulrunner) + cp xulrunner/config/mozconfig .mozconfig \ + || die "cp xulrunner/config/mozconfig failed" ;; + *sunbird) + cp calendar/sunbird/config/mozconfig .mozconfig \ + || die "cp calendar/sunbird/config/mozconfig failed" ;; + *thunderbird) + cp mail/config/mozconfig .mozconfig \ + || die "cp mail/config/mozconfig failed" ;; + seamonkey) + # The other builds have an initial --enable-extensions in their + # .mozconfig. The "default" set in configure applies to mozilla + # specifically. + : >.mozconfig || die "initial mozconfig creation failed" + mozconfig_annotate "" --enable-application=suite + mozconfig_annotate "" --enable-extensions=default ;; + *icecat) + cp browser/config/mozconfig .mozconfig \ + || die "cp browser/config/mozconfig failed" ;; + esac + + #################################### + # + # CFLAGS setup and ARCH support + # + #################################### + + # Set optimization level + if [[ ${ARCH} == hppa ]]; then + mozconfig_annotate "more than -O0 causes segfaults on hppa" --enable-optimize=-O0 + elif [[ ${ARCH} == x86 ]]; then + mozconfig_annotate "less then -O2 causes a segfault on x86" --enable-optimize=-O2 + elif use custom-optimization || [[ ${ARCH} == alpha ]]; then + # Set optimization level based on CFLAGS + if is-flag -O0; then + mozconfig_annotate "from CFLAGS" --enable-optimize=-O0 + elif [[ ${ARCH} == ppc ]] && has_version '>=sys-libs/glibc-2.8'; then + mozconfig_annotate "more than -O1 segfaults on ppc with glibc-2.8" --enable-optimize=-O1 + elif is-flag -O1; then + mozconfig_annotate "from CFLAGS" --enable-optimize=-O1 + elif is-flag -Os; then + mozconfig_annotate "from CFLAGS" --enable-optimize=-Os + else + mozconfig_annotate "Gentoo's default optimization" --enable-optimize=-O2 + fi + else + # Enable Mozilla's default + mozconfig_annotate "mozilla default" --enable-optimize + fi + + # Now strip optimization from CFLAGS so it doesn't end up in the + # compile string + filter-flags '-O*' + + # Strip over-aggressive CFLAGS - Mozilla supplies its own + # fine-tuned CFLAGS and shouldn't be interfered with.. Do this + # AFTER setting optimization above since strip-flags only allows + # -O -O1 and -O2 + strip-flags + + # Additional ARCH support + case "${ARCH}" in + alpha) + # Historically we have needed to add -fPIC manually for 64-bit. + # Additionally, alpha should *always* build with -mieee for correct math + # operation + append-flags -fPIC -mieee + ;; + + amd64|ia64) + # Historically we have needed to add this manually for 64-bit + append-flags -fPIC + ;; + + ppc64) + append-flags -fPIC -mminimal-toc + ;; + + ppc) + # Fix to avoid gcc-3.3.x micompilation issues. + if [[ $(gcc-major-version).$(gcc-minor-version) == 3.3 ]]; then + append-flags -fno-strict-aliasing + fi + ;; + + x86) + if [[ $(gcc-major-version) -eq 3 ]]; then + # gcc-3 prior to 3.2.3 doesn't work well for pentium4 + # see bug 25332 + if [[ $(gcc-minor-version) -lt 2 || + ( $(gcc-minor-version) -eq 2 && $(gcc-micro-version) -lt 3 ) ]] + then + replace-flags -march=pentium4 -march=pentium3 + filter-flags -msse2 + fi + fi + ;; + esac + + if [[ $(gcc-major-version) -eq 3 ]]; then + # Enable us to use flash, etc plugins compiled with gcc-2.95.3 + mozconfig_annotate "building with >=gcc-3" --enable-old-abi-compat-wrappers + + # Needed to build without warnings on gcc-3 + CXXFLAGS="${CXXFLAGS} -Wno-deprecated" + fi + + # Go a little faster; use less RAM + append-flags "$MAKEEDIT_FLAGS" + + #################################### + # + # mozconfig setup + # + #################################### + + mozconfig_annotate gentoo \ + --disable-installer \ + --disable-pedantic \ + --enable-crypto \ + --with-system-jpeg \ + --with-system-zlib \ + --disable-updater \ + --enable-pango \ + --enable-svg \ + --enable-system-cairo \ + --disable-strip \ + --disable-strip-libs \ + --disable-install-strip \ + --with-distribution-id=org.gentoo + + # This doesn't work yet + #--with-system-png \ + + if [[ ${PN} != seamonkey ]]; then + mozconfig_annotate gentoo \ + --enable-single-profile \ + --disable-profilesharing \ + --disable-profilelocking + fi + + # Here is a strange one... + if is-flag '-mcpu=ultrasparc*' || is-flag '-mtune=ultrasparc*'; then + mozconfig_annotate "building on ultrasparc" --enable-js-ultrasparc + fi + + # jemalloc won't build with older glibc + ! has_version ">=sys-libs/glibc-2.4" && mozconfig_annotate "we have old glibc" --disable-jemalloc +} + +# Simulate the silly csh makemake script +makemake() { + typeset m topdir + for m in $(find . -name Makefile.in); do + topdir=$(echo "$m" | sed -r 's:[^/]+:..:g') + sed -e "s:@srcdir@:.:g" -e "s:@top_srcdir@:${topdir}:g" \ + < ${m} > ${m%.in} || die "sed ${m} failed" + done +} + +makemake2() { + for m in $(find ../ -name Makefile.in); do + topdir=$(echo "$m" | sed -r 's:[^/]+:..:g') + sed -e "s:@srcdir@:.:g" -e "s:@top_srcdir@:${topdir}:g" \ + < ${m} > ${m%.in} || die "sed ${m} failed" + done +} + +# mozconfig_annotate: add an annotated line to .mozconfig +# +# Example: +# mozconfig_annotate "building on ultrasparc" --enable-js-ultrasparc +# => ac_add_options --enable-js-ultrasparc # building on ultrasparc +mozconfig_annotate() { + declare reason=$1 x ; shift + [[ $# -gt 0 ]] || die "mozconfig_annotate missing flags for ${reason}\!" + for x in ${*}; do + echo "ac_add_options ${x} # ${reason}" >>.mozconfig + done +} + +# mozconfig_use_enable: add a line to .mozconfig based on a USE-flag +# +# Example: +# mozconfig_use_enable truetype freetype2 +# => ac_add_options --enable-freetype2 # +truetype +mozconfig_use_enable() { + declare flag=$(use_enable "$@") + mozconfig_annotate "$(useq $1 && echo +$1 || echo -$1)" "${flag}" +} + +# mozconfig_use_with: add a line to .mozconfig based on a USE-flag +# +# Example: +# mozconfig_use_with kerberos gss-api /usr/$(get_libdir) +# => ac_add_options --with-gss-api=/usr/lib # +kerberos +mozconfig_use_with() { + declare flag=$(use_with "$@") + mozconfig_annotate "$(useq $1 && echo +$1 || echo -$1)" "${flag}" +} + +# mozconfig_use_extension: enable or disable an extension based on a USE-flag +# +# Example: +# mozconfig_use_extension gnome gnomevfs +# => ac_add_options --enable-extensions=gnomevfs +mozconfig_use_extension() { + declare minus=$(useq $1 || echo -) + mozconfig_annotate "${minus:-+}$1" --enable-extensions=${minus}${2} +} + +# mozconfig_final: display a table describing all configuration options paired +# with reasons, then clean up extensions list +mozconfig_final() { + declare ac opt hash reason + echo + echo "==========================================================" + echo "Building ${PF} with the following configuration" + grep ^ac_add_options .mozconfig | while read ac opt hash reason; do + [[ -z ${hash} || ${hash} == \# ]] \ + || die "error reading mozconfig: ${ac} ${opt} ${hash} ${reason}" + printf " %-30s %s\n" "${opt}" "${reason:-mozilla.org default}" + done + echo "==========================================================" + echo + + # Resolve multiple --enable-extensions down to one + declare exts=$(sed -n 's/^ac_add_options --enable-extensions=\([^ ]*\).*/\1/p' \ + .mozconfig | xargs) + sed -i '/^ac_add_options --enable-extensions/d' .mozconfig + echo "ac_add_options --enable-extensions=${exts// /,}" >> .mozconfig +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/mozcoreconf.eclass b/sdk_container/src/third_party/portage-stable/eclass/mozcoreconf.eclass new file mode 100644 index 0000000000..b74539cc0f --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/mozcoreconf.eclass @@ -0,0 +1,272 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/mozcoreconf.eclass,v 1.14 2008/01/05 16:15:09 armin76 Exp $ +# +# mozcoreconf.eclass : core options for mozilla +# inherit mozconfig-2 if you need USE flags + +inherit multilib flag-o-matic + +RDEPEND="x11-libs/libXrender + x11-libs/libXt + x11-libs/libXmu + >=sys-libs/zlib-1.1.4" + +DEPEND="${RDEPEND} + dev-util/pkgconfig" + +# Set by configure (plus USE_AUTOCONF=1), but useful for NSPR +export MOZILLA_CLIENT=1 +export BUILD_OPT=1 +export NO_STATIC_LIB=1 +export USE_PTHREADS=1 + +mozconfig_init() { + declare enable_optimize pango_version myext x + declare MOZ=$([[ ${PN} == mozilla || ${PN} == gecko-sdk ]] && echo true || echo false) + declare FF=$([[ ${PN} == *firefox ]] && echo true || echo false) + declare TB=$([[ ${PN} == *thunderbird ]] && echo true || echo false) + declare SB=$([[ ${PN} == *sunbird ]] && echo true || echo false) + declare EM=$([[ ${PN} == enigmail ]] && echo true || echo false) + declare XUL=$([[ ${PN} == *xulrunner ]] && echo true || echo false) + declare SM=$([[ ${PN} == seamonkey ]] && echo true || echo false) + + #################################### + # + # Setup the initial .mozconfig + # See http://www.mozilla.org/build/configure-build.html + # + #################################### + + case ${PN} in + mozilla|gecko-sdk) + # The other builds have an initial --enable-extensions in their + # .mozconfig. The "default" set in configure applies to mozilla + # specifically. + : >.mozconfig || die "initial mozconfig creation failed" + mozconfig_annotate "" --enable-extensions=default ;; + *firefox) + cp browser/config/mozconfig .mozconfig \ + || die "cp browser/config/mozconfig failed" ;; + enigmail) + cp mail/config/mozconfig .mozconfig \ + || die "cp mail/config/mozconfig failed" ;; + *xulrunner) + cp xulrunner/config/mozconfig .mozconfig \ + || die "cp xulrunner/config/mozconfig failed" ;; + *sunbird) + cp calendar/sunbird/config/mozconfig .mozconfig \ + || die "cp calendar/sunbird/config/mozconfig failed" ;; + *thunderbird) + cp mail/config/mozconfig .mozconfig \ + || die "cp mail/config/mozconfig failed" ;; + seamonkey) + # The other builds have an initial --enable-extensions in their + # .mozconfig. The "default" set in configure applies to mozilla + # specifically. + : >.mozconfig || die "initial mozconfig creation failed" + mozconfig_annotate "" --enable-application=suite + mozconfig_annotate "" --enable-extensions=default ;; + esac + + #################################### + # + # CFLAGS setup and ARCH support + # + #################################### + + # Set optimization level based on CFLAGS + if is-flag -O0; then + mozconfig_annotate "from CFLAGS" --enable-optimize=-O0 + elif [[ ${ARCH} == hppa ]]; then + mozconfig_annotate "more than -O0 causes segfaults on hppa" --enable-optimize=-O0 + elif is-flag -O1; then + mozconfig_annotate "from CFLAGS" --enable-optimize=-O1 + elif is-flag -Os; then + mozconfig_annotate "from CFLAGS" --enable-optimize=-Os + else + mozconfig_annotate "mozilla fallback" --enable-optimize=-O2 + fi + + # Now strip optimization from CFLAGS so it doesn't end up in the + # compile string + filter-flags '-O*' + + # Strip over-aggressive CFLAGS - Mozilla supplies its own + # fine-tuned CFLAGS and shouldn't be interfered with.. Do this + # AFTER setting optimization above since strip-flags only allows + # -O -O1 and -O2 + strip-flags + + # Additional ARCH support + case "${ARCH}" in + alpha) + # Historically we have needed to add -fPIC manually for 64-bit. + # Additionally, alpha should *always* build with -mieee for correct math + # operation + append-flags -fPIC -mieee + ;; + + amd64|ia64) + # Historically we have needed to add this manually for 64-bit + append-flags -fPIC + ;; + + ppc64) + append-flags -fPIC -mminimal-toc + ;; + + ppc) + # Fix to avoid gcc-3.3.x micompilation issues. + if [[ $(gcc-major-version).$(gcc-minor-version) == 3.3 ]]; then + append-flags -fno-strict-aliasing + fi + ;; + + sparc) + # Sparc support ... + replace-sparc64-flags + ;; + + x86) + if [[ $(gcc-major-version) -eq 3 ]]; then + # gcc-3 prior to 3.2.3 doesn't work well for pentium4 + # see bug 25332 + if [[ $(gcc-minor-version) -lt 2 || + ( $(gcc-minor-version) -eq 2 && $(gcc-micro-version) -lt 3 ) ]] + then + replace-flags -march=pentium4 -march=pentium3 + filter-flags -msse2 + fi + fi + ;; + esac + + if [[ $(gcc-major-version) -eq 3 ]]; then + # Enable us to use flash, etc plugins compiled with gcc-2.95.3 + mozconfig_annotate "building with >=gcc-3" --enable-old-abi-compat-wrappers + + # Needed to build without warnings on gcc-3 + CXXFLAGS="${CXXFLAGS} -Wno-deprecated" + fi + + # Go a little faster; use less RAM + append-flags "$MAKEEDIT_FLAGS" + + #################################### + # + # mozconfig setup + # + #################################### + + mozconfig_annotate gentoo \ + --disable-installer \ + --disable-pedantic \ + --enable-crypto \ + --with-system-jpeg \ + --with-system-png \ + --with-system-zlib \ + --disable-updater \ + --enable-default-toolkit=gtk2 \ + --enable-pango \ + --enable-svg \ + --enable-svg-renderer=cairo \ + --enable-system-cairo \ + --disable-strip \ + --disable-strip-libs + + if [[ ${PN} != seamonkey ]]; then + mozconfig_annotate gentoo \ + --enable-single-profile \ + --disable-profilesharing \ + --disable-profilelocking + fi + + # Here is a strange one... + if is-flag '-mcpu=ultrasparc*' || is-flag '-mtune=ultrasparc*'; then + mozconfig_annotate "building on ultrasparc" --enable-js-ultrasparc + fi +} + +# Simulate the silly csh makemake script +makemake() { + typeset m topdir + for m in $(find . -name Makefile.in); do + topdir=$(echo "$m" | sed -r 's:[^/]+:..:g') + sed -e "s:@srcdir@:.:g" -e "s:@top_srcdir@:${topdir}:g" \ + < ${m} > ${m%.in} || die "sed ${m} failed" + done +} + +makemake2() { + for m in $(find ../ -name Makefile.in); do + topdir=$(echo "$m" | sed -r 's:[^/]+:..:g') + sed -e "s:@srcdir@:.:g" -e "s:@top_srcdir@:${topdir}:g" \ + < ${m} > ${m%.in} || die "sed ${m} failed" + done +} + +# mozconfig_annotate: add an annotated line to .mozconfig +# +# Example: +# mozconfig_annotate "building on ultrasparc" --enable-js-ultrasparc +# => ac_add_options --enable-js-ultrasparc # building on ultrasparc +mozconfig_annotate() { + declare reason=$1 x ; shift + [[ $# -gt 0 ]] || die "mozconfig_annotate missing flags for ${reason}\!" + for x in ${*}; do + echo "ac_add_options ${x} # ${reason}" >>.mozconfig + done +} + +# mozconfig_use_enable: add a line to .mozconfig based on a USE-flag +# +# Example: +# mozconfig_use_enable truetype freetype2 +# => ac_add_options --enable-freetype2 # +truetype +mozconfig_use_enable() { + declare flag=$(use_enable "$@") + mozconfig_annotate "$(useq $1 && echo +$1 || echo -$1)" "${flag}" +} + +# mozconfig_use_with: add a line to .mozconfig based on a USE-flag +# +# Example: +# mozconfig_use_with kerberos gss-api /usr/$(get_libdir) +# => ac_add_options --with-gss-api=/usr/lib # +kerberos +mozconfig_use_with() { + declare flag=$(use_with "$@") + mozconfig_annotate "$(useq $1 && echo +$1 || echo -$1)" "${flag}" +} + +# mozconfig_use_extension: enable or disable an extension based on a USE-flag +# +# Example: +# mozconfig_use_extension gnome gnomevfs +# => ac_add_options --enable-extensions=gnomevfs +mozconfig_use_extension() { + declare minus=$(useq $1 || echo -) + mozconfig_annotate "${minus:-+}$1" --enable-extensions=${minus}${2} +} + +# mozconfig_final: display a table describing all configuration options paired +# with reasons, then clean up extensions list +mozconfig_final() { + declare ac opt hash reason + echo + echo "==========================================================" + echo "Building ${PF} with the following configuration" + grep ^ac_add_options .mozconfig | while read ac opt hash reason; do + [[ -z ${hash} || ${hash} == \# ]] \ + || die "error reading mozconfig: ${ac} ${opt} ${hash} ${reason}" + printf " %-30s %s\n" "${opt}" "${reason:-mozilla.org default}" + done + echo "==========================================================" + echo + + # Resolve multiple --enable-extensions down to one + declare exts=$(sed -n 's/^ac_add_options --enable-extensions=\([^ ]*\).*/\1/p' \ + .mozconfig | xargs) + sed -i '/^ac_add_options --enable-extensions/d' .mozconfig + echo "ac_add_options --enable-extensions=${exts// /,}" >> .mozconfig +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/mozextension.eclass b/sdk_container/src/third_party/portage-stable/eclass/mozextension.eclass new file mode 100644 index 0000000000..9fb172bc4b --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/mozextension.eclass @@ -0,0 +1,54 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/mozextension.eclass,v 1.4 2007/12/20 15:43:14 armin76 Exp $ +# +# mozextention.eclass: installing firefox extensions and language packs + +inherit eutils + +DEPEND="app-arch/unzip" + +xpi_unpack() { + local xpi xpiname srcdir + + # Not gonna use ${A} as we are looking for a specific option being passed to function + # You must specify which xpi to use + [[ -z "$*" ]] && die "Nothing passed to the $FUNCNAME command. please pass which xpi to unpack" + + for xpi in "$@"; do + einfo "Unpacking ${xpi} to ${PWD}" + xpiname=$(basename ${xpi%.*}) + + if [[ "${xpi:0:2}" != "./" ]] && [[ "${xpi:0:1}" != "/" ]] ; then + srcdir="${DISTDIR}/" + fi + + [[ -s "${srcdir}${xpi}" ]] || die "${xpi} does not exist" + + case "${xpi##*.}" in + ZIP|zip|jar|xpi) + mkdir "${WORKDIR}/${xpiname}" && \ + cd "${WORKDIR}/${xpiname}" && \ + unzip -qo "${srcdir}${xpi}" || die "failed to unpack ${xpi}" + ;; + *) + einfo "unpack ${xpi}: file format not recognized. Ignoring." + ;; + esac + done +} + + +xpi_install() { + local emid + + # You must tell xpi_install which xpi to use + [[ ${#} -ne 1 ]] && die "$FUNCNAME takes exactly one argument, please specify an xpi to unpack" + + x="${1}" + cd ${x} + # determine id for extension + emid=$(sed -n -e '/<\?em:id>\?/!d; s/.*\([\"{].*[}\"]\).*/\1/; s/\"//g; p; q' ${x}/install.rdf) || die "failed to determine extension id" + insinto "${MOZILLA_FIVE_HOME}"/extensions/${emid} + doins -r "${x}"/* || die "failed to copy extension" +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/mozilla-launcher.eclass b/sdk_container/src/third_party/portage-stable/eclass/mozilla-launcher.eclass new file mode 100644 index 0000000000..bcafc9bd9c --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/mozilla-launcher.eclass @@ -0,0 +1,123 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/mozilla-launcher.eclass,v 1.24 2009/05/01 21:42:38 nirbheek Exp $ + +inherit nsplugins multilib + +if [[ ${PN: -4} != "-bin" ]] ; then + IUSE="moznopango" +fi + +# update_mozilla_launcher_symlinks +# -------------------------------- +# Create or remove the following symlinks in /usr/bin: +# +# firefox -> firefox-bin +# thunderbird -> thunderbird-bin +# mozilla -> mozilla-bin +# sunbird -> sunbird-bin +# seamonkey -> seamonkey-bin +# +# The symlinks are removed if they're found to be dangling. They are +# created according to the following rules: +# +# - If there's a -bin symlink in /usr/bin, and no corresponding +# non-bin symlink, then create one. +# +# - Can't do this in src_install otherwise it overwrites the one +# for the non-bin package. +# +# - Link to the -bin symlink so it's easier to detect when to +# remove the symlink. +# +# NOTE: This eclass does *not* manage the launcher stubs in /usr/bin except +# when a -bin package is installed and the corresponding from-source +# package is not installed. The usual stubs are actually installed in +# src_install so they are included in the package inventory. +# +update_mozilla_launcher_symlinks() { + local f browsers="mozilla firefox thunderbird sunbird seamonkey" + cd "${ROOT}"/usr/bin + + # Remove launcher symlinks that no longer apply + + for f in ${browsers}; do + if [[ -L ${f} && ! -f ${f} ]]; then + einfo "Removing dangling ${f} launcher" + rm -f ${f} + fi + done + + # Create new symlinks + + for f in ${browsers}; do + if [[ -e ${f}-bin && ! -e ${f} ]]; then + einfo "Adding link from ${f}-bin to ${f}" + ln -s ${f}-bin ${f} + fi + done +} + +# install_mozilla_launcher_stub name libdir +# ----------------------------------------- +# Install a stub called /usr/bin/$name that executes mozilla-launcher +# +# Note: $PLUGINS_DIR comes from nsplugins (specifically the deprecated section). +# +install_mozilla_launcher_stub() { + [[ -n $2 ]] || die "install_launcher_stub requires two arguments" + declare name=$1 + declare libdir=$2 + + # If we use xulrunner, the name of the binary should be the same + if [[ ${name: -3} == "xul" ]]; then + name=${name/xul/} + declare appname=xulrunner + declare xulparams="export XUL_PARAMS=${libdir}/application.ini" + declare libdir="/usr/$(get_libdir)/xulrunner-1.9" + else + declare appname=${name} + fi + + dodir /usr/bin + + if [[ ${PN: -4} == "-bin" ]] || ! use moznopango; then + cat <"${D}"/usr/bin/${name} +#!/bin/sh +# +# Stub script to run mozilla-launcher. We used to use a symlink here +# but OOo brokenness makes it necessary to use a stub instead: +# http://bugs.gentoo.org/show_bug.cgi?id=78890 + +export MOZILLA_LAUNCHER=${appname} +export MOZILLA_LIBDIR=${libdir} +export MOZ_PLUGIN_PATH=\${MOZ_PLUGIN_PATH:-/usr/$(get_libdir)/$PLUGINS_DIR} +${xulparams} +exec /usr/libexec/mozilla-launcher "\$@" +EOF + else + cat <"${D}"/usr/bin/${name} +#!/bin/sh +# +# Stub script to run mozilla-launcher. We used to use a symlink here +# but OOo brokenness makes it necessary to use a stub instead: +# http://bugs.gentoo.org/show_bug.cgi?id=78890 + +export MOZILLA_LAUNCHER=${appname} +export MOZILLA_LIBDIR=${libdir} +export MOZ_PLUGIN_PATH=\${MOZ_PLUGIN_PATH:-/usr/$(get_libdir)/$PLUGINS_DIR} +export MOZ_DISABLE_PANGO=1 +${xulparams} +exec /usr/libexec/mozilla-launcher "\$@" +EOF + fi + chmod 0755 "${D}"/usr/bin/${name} +} + +warn_mozilla_launcher_stub() { + elog "Not all locales support the disabling of pango." + elog "If your locale does not support disabling pango," + elog "please open a bug report on http://bugs.gentoo.org" + elog "Then we can filter around the problem with those" + elog "specific locales." +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/myspell.eclass b/sdk_container/src/third_party/portage-stable/eclass/myspell.eclass new file mode 100644 index 0000000000..09463a0f43 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/myspell.eclass @@ -0,0 +1,258 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/myspell.eclass,v 1.6 2009/02/09 08:21:00 pva Exp $ + +# Author: Kevin F. Quinn +# Packages: app-dicts/myspell-* +# Herd: app-dicts + +inherit multilib + +EXPORT_FUNCTIONS src_install pkg_preinst pkg_postinst + +IUSE="" + +SLOT="0" + +# tar, gzip, bzip2 are included in the base profile, but not unzip +DEPEND="app-arch/unzip" + +# Dictionaries don't have any runtime dependencies +# Myspell dictionaries can be used by hunspell, openoffice and others +RDEPEND="" + +# The destination directory for myspell dictionaries +MYSPELL_DICTBASE="/usr/share/myspell" + +# Legacy variable for dictionaries installed before eselect-oodict existed +# so has to remain for binpkg support. This variable is unmaintained - +# if you have a problem with it, emerge app-admin/eselect-oodict. +# The location for openoffice softlinks +MYSPELL_OOOBASE="/usr/lib/openoffice/share/dict/ooo" + + +# set array "fields" to the elements of $1, separated by $2. +# This saves having to muck about with IFS all over the place. +set_fields() { + local old_IFS + old_IFS="${IFS}" + IFS=$2 + fields=($1) + IFS="${old_IFS}" +} + +# language is the second element of the ebuild name +# myspell-- +get_myspell_lang() { + local fields + set_fields "${P}" "-" + echo ${fields[1]} +} + +get_myspell_suffixes() { + case $1 in + DICT) echo ".aff .dic" ;; + HYPH) echo ".dic" ;; + THES) echo ".dat .idx" ;; + esac +} + +# OOo dictionary files are held on the mirrors, rather than +# being fetched direct from the OOo site as upstream doesn't +# change the name when they rebuild the dictionaries. +# -.zip becomes myspell---version.zip +get_myspell_ooo_uri() { + local files fields newfile filestem srcfile dict uris + files=() + uris="" + for dict in \ + "${MYSPELL_SPELLING_DICTIONARIES[@]}" \ + "${MYSPELL_HYPHENATION_DICTIONARIES[@]}" \ + "${MYSPELL_THESAURUS_DICTIONARIES[@]}"; do + set_fields "${dict}" "," + newfile=${fields[4]// } + for file in "${files[@]}"; do + [[ ${file} == ${newfile} ]] && continue 2 + done + filestem=${newfile/.zip} + files=("${files[@]}" "${newfile}") + srcfile="myspell-${filestem}-${PV}.zip" + [[ -z ${uris} ]] && + uris="mirror://gentoo/${srcfile}" || + uris="${uris} mirror://gentoo/${srcfile}" + done + echo "${uris}" +} + + +[[ -z ${SRC_URI} ]] && SRC_URI=$(get_myspell_ooo_uri) + +# Format of dictionary.lst files (from OOo standard +# dictionary.lst file): +# +# List of All Dictionaries to be Loaded by OpenOffice +# --------------------------------------------------- +# Each Entry in the list have the following space delimited fields +# +# Field 0: Entry Type "DICT" - spellchecking dictionary +# "HYPH" - hyphenation dictionary +# "THES" - thesaurus files +# +# Field 1: Language code from Locale "en" or "de" or "pt" ... +# +# Field 2: Country Code from Locale "US" or "GB" or "PT" +# +# Field 3: Root name of file(s) "en_US" or "hyph_de" or "th_en_US" +# (do not add extensions to the name) + +# Format of MYSPELL_[SPELLING|HYPHENATION|THESAURUS]_DICTIONARIES: +# +# Field 0: Language code +# Field 1: Country code +# Field 2: Root name of dictionary files +# Field 3: Description +# Field 4: Archive filename +# +# This format is from the available.lst, hyphavail.lst and +# thesavail.lst files on the openoffice.org repository. + +myspell_src_install() { + local filen fields entry dictlst + cd "${WORKDIR}" + # Install the dictionary, hyphenation and thesaurus files. + # Create dictionary.lst. file containing the parts of + # OOo's dictionary.lst file for this language, indicating + # which dictionaries are relevant for each country variant + # of the language. + insinto ${MYSPELL_DICTBASE} + dictlst="dictionary.lst.$(get_myspell_lang)" + echo "# Autogenerated by ${CATEGORY}/${P}" > ${dictlst} + for entry in "${MYSPELL_SPELLING_DICTIONARIES[@]}"; do + set_fields "${entry}" "," + echo "DICT ${fields[0]} ${fields[1]} ${fields[2]}" >> ${dictlst} + doins ${fields[2]}.aff || die "Missing ${fields[2]}.aff" + doins ${fields[2]}.dic || die "Missing ${fields[2]}.dic" + done + for entry in "${MYSPELL_HYPHENATION_DICTIONARIES[@]}"; do + set_fields "${entry}" "," + echo "HYPH ${fields[0]} ${fields[1]} ${fields[2]}" >> ${dictlst} + doins ${fields[2]}.dic || die "Missing ${fields[2]}.dic" + done + for entry in "${MYSPELL_THESAURUS_DICTIONARIES[@]}"; do + set_fields "${entry}" "," + echo "THES ${fields[0]} ${fields[1]} ${fields[2]}" >> ${dictlst} + doins ${fields[2]}.dat || die "Missing ${fields[2]}.dat" + doins ${fields[2]}.idx || die "Missing ${fields[2]}.idx" + done + doins ${dictlst} || die "Failed to install ${dictlst}" + # Install any txt files (usually README.txt) as documentation + for filen in $(ls *.txt 2> /dev/null); do + dodoc ${filen} + done +} + + +# Add entries in dictionary.lst. to OOo dictionary.lst +# and create softlinks indicated by dictionary.lst. +myspell_pkg_postinst() { + # Update for known applications + if has_version ">=app-admin/eselect-oodict-20060706"; then + if has_version app-office/openoffice; then + eselect oodict set myspell-$(get_myspell_lang) + fi + if has_version app-office/openoffice-bin; then + # On AMD64, openoffice-bin is 32-bit so force ABI + has_multilib_profile && ABI=x86 + eselect oodict set myspell-$(get_myspell_lang) --libdir $(get_libdir) + fi + return + fi + if has_version app-admin/eselect-oodict; then + eselect oodict set myspell-$(get_myspell_lang) + return + fi + + # Legacy code for dictionaries installed before eselect-oodict existed + # so has to remain for binpkg support. This code is unmaintained - + # if you have a problem with it, emerge app-admin/eselect-oodict. + [[ -d ${MYSPELL_OOOBASE} ]] || return + # This stuff is here, not in src_install, as the softlinks are + # deliberately _not_ listed in the package database. + local dictlst entry fields prefix suffix suffixes filen + # Note; can only reach this point if ${MYSPELL_DICTBASE}/${dictlst} + # was successfully installed + dictlst="dictionary.lst.$(get_myspell_lang)" + while read entry; do + fields=(${entry}) + [[ ${fields[0]:0:1} == "#" ]] && continue + [[ -f ${MYSPELL_OOOBASE}/dictionary.lst ]] || \ + touch ${MYSPELL_OOOBASE}/dictionary.lst + grep "^${fields[0]} ${fields[1]} ${fields[2]} " \ + ${MYSPELL_OOOBASE}/dictionary.lst > /dev/null 2>&1 || + echo "${entry}" >> ${MYSPELL_OOOBASE}/dictionary.lst + for suffix in $(get_myspell_suffixes ${fields[0]}); do + filen="${fields[3]}${suffix}" + [[ -h ${MYSPELL_OOOBASE}/${filen} ]] && + rm -f ${MYSPELL_OOOBASE}/${filen} + [[ ! -f ${MYSPELL_OOOBASE}/${filen} ]] && + ln -s ${MYSPELL_DICTBASE}/${filen} \ + ${MYSPELL_OOOBASE}/${filen} + done + done < ${MYSPELL_DICTBASE}/${dictlst} +} + + +# Remove softlinks and entries in dictionary.lst - uses +# dictionary..lst from /usr/share/myspell +# Done in preinst (prerm happens after postinst, which overwrites +# the dictionary..lst file) +myspell_pkg_preinst() { + # Update for known applications + if has_version ">=app-admin/eselect-oodict-20060706"; then + if has_version app-office/openoffice; then + # When building from source, the default library path is correct + eselect oodict unset myspell-$(get_myspell_lang) + fi + if has_version app-office/openoffice-bin; then + # On AMD64, openoffice-bin is 32-bit, so get 32-bit library directory + has_multilib_profile && ABI=x86 + eselect oodict unset myspell-$(get_myspell_lang) --libdir $(get_libdir) + fi + eselect oodict unset myspell-$(get_myspell_lang) --libdir $(get_libdir) + return + fi + # Previous versions of eselect-oodict didn't cater for -bin on amd64 + if has_version app-admin/eselect-oodict; then + eselect oodict unset myspell-$(get_myspell_lang) + return + fi + + # Legacy code for dictionaries installed before eselect-oodict existed + # Don't delete this; needed for uninstalls and binpkg support. + # This code is unmaintained - if you have a problem with it, + # emerge app-admin/eselect-oodict. + local filen dictlst entry fields removeentry suffix + dictlst="dictionary.lst.$(get_myspell_lang)" + [[ -d ${MYSPELL_OOOBASE} ]] || return + [[ -f ${MYSPELL_DICTBASE}/${dictlst} ]] || return + while read entry; do + fields=(${entry}) + [[ ${fields[0]:0:1} == "#" ]] && continue + [[ ${fields[3]} == "" ]] && continue + # Remove entry from dictionary.lst + sed -i -e "/^${fields[0]} ${fields[1]} ${fields[2]} ${fields[3]}$/ { d }" \ + ${MYSPELL_OOOBASE}/dictionary.lst + # See if any other entries in dictionary.lst match the current + # dictionary type and filename + grep "^${fields[0]} .* ${fields[3]}$" ${MYSPELL_OOOBASE}/dictionary.lst \ + 2>&1 > /dev/null && continue + # If no other entries match, remove relevant symlinks + for suffix in $(get_myspell_suffixes ${fields[0]}); do + filen="${fields[3]}${suffix}" + ewarn "Removing entry ${MYSPELL_OOOBASE}/${filen}" + [[ -h ${MYSPELL_OOOBASE}/${filen} ]] && + rm -f ${MYSPELL_OOOBASE}/${filen} + done + done < ${MYSPELL_DICTBASE}/${dictlst} +} + diff --git a/sdk_container/src/third_party/portage-stable/eclass/mysql.eclass b/sdk_container/src/third_party/portage-stable/eclass/mysql.eclass new file mode 100644 index 0000000000..faa8accc45 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/mysql.eclass @@ -0,0 +1,1162 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/mysql.eclass,v 1.136 2010/03/09 20:37:34 robbat2 Exp $ + +# @ECLASS: mysql.eclass +# @MAINTAINER: +# Author: Francesco Riosa (Retired) +# Maintainers: MySQL Team +# - Luca Longinotti +# - Robin H. Johnson +# @BLURB: This eclass provides most of the functions for mysql ebuilds +# @DESCRIPTION: +# The mysql.eclass provides almost all the code to build the mysql ebuilds +# including the src_unpack, src_prepare, src_configure, src_compile, +# scr_install, pkg_preinst, pkg_postinst, pkg_config and pkg_postrm +# phase hooks. + +WANT_AUTOCONF="latest" +WANT_AUTOMAKE="latest" + +inherit eutils flag-o-matic gnuconfig autotools mysql_fx versionator toolchain-funcs + +# Shorten the path because the socket path length must be shorter than 107 chars +# and we will run a mysql server during test phase +S="${WORKDIR}/mysql" + +[[ "${MY_EXTRAS_VER}" == "latest" ]] && MY_EXTRAS_VER="20090228-0714Z" +if [[ "${MY_EXTRAS_VER}" == "live" ]]; then + EGIT_PROJECT=mysql-extras + EGIT_REPO_URI="git://git.overlays.gentoo.org/proj/mysql-extras.git" + inherit git +fi + +case "${EAPI:-0}" in + 2) + EXPORT_FUNCTIONS pkg_setup \ + src_unpack src_prepare \ + src_configure src_compile \ + src_install \ + pkg_preinst pkg_postinst \ + pkg_config pkg_postrm + IUSE_DEFAULT_ON='+' + ;; + 0 | 1) + EXPORT_FUNCTIONS pkg_setup \ + src_unpack \ + src_compile \ + src_install \ + pkg_preinst pkg_postinst \ + pkg_config pkg_postrm + ;; + *) + die "Unsupported EAPI: ${EAPI}" ;; +esac + +# @ECLASS-VARIABLE: MYSQL_VERSION_ID +# @DESCRIPTION: +# MYSQL_VERSION_ID will be: +# major * 10e6 + minor * 10e4 + micro * 10e2 + gentoo revision number, all [0..99] +# This is an important part, because many of the choices the MySQL ebuild will do +# depend on this variable. +# In particular, the code below transforms a $PVR like "5.0.18-r3" in "5001803" +# We also strip off upstream's trailing letter that they use to respin tarballs + +MYSQL_VERSION_ID="" +tpv="${PV%[a-z]}" +tpv=( ${tpv//[-._]/ } ) ; tpv[3]="${PVR:${#PV}}" ; tpv[3]="${tpv[3]##*-r}" +for vatom in 0 1 2 3 ; do + # pad to length 2 + tpv[${vatom}]="00${tpv[${vatom}]}" + MYSQL_VERSION_ID="${MYSQL_VERSION_ID}${tpv[${vatom}]:0-2}" +done +# strip leading "0" (otherwise it's considered an octal number by BASH) +MYSQL_VERSION_ID=${MYSQL_VERSION_ID##"0"} + +# @ECLASS-VARIABLE: MYSQL_COMMUNITY_FEATURES +# @DESCRIPTION: +# Specifiy if community features are available. Possible values are 1 (yes) +# and 0 (no). +# Community features are available in mysql-community +# AND in the re-merged mysql-5.0.82 and newer +if [ "${PN}" == "mysql-community" ]; then + MYSQL_COMMUNITY_FEATURES=1 +elif [ "${PV#5.0}" != "${PV}" ] && mysql_version_is_at_least "5.0.82"; then + MYSQL_COMMUNITY_FEATURES=1 +elif [ "${PV#5.1}" != "${PV}" ] && mysql_version_is_at_least "5.1.28"; then + MYSQL_COMMUNITY_FEATURES=1 +elif [ "${PV#5.4}" != "${PV}" ] ; then + MYSQL_COMMUNITY_FEATURES=1 +elif [ "${PV#5.5}" != "${PV}" ] ; then + MYSQL_COMMUNITY_FEATURES=1 +elif [ "${PV#6.0}" != "${PV}" ] ; then + MYSQL_COMMUNITY_FEATURES=1 +else + MYSQL_COMMUNITY_FEATURES=0 +fi + +# @ECLASS-VARIABLE: XTRADB_VER +# @DESCRIPTION: +# Version of the XTRADB storage engine +XTRADB_VER="${XTRADB_VER}" + +# @ECLASS-VARIABLE: PERCONA_VER +# @DESCRIPTION: +# Designation by PERCONA for a MySQL version to apply an XTRADB release +PERCONA_VER="${PERCONA_VER}" + +# Be warned, *DEPEND are version-dependant +# These are used for both runtime and compiletime +DEPEND="ssl? ( >=dev-libs/openssl-0.9.6d ) + userland_GNU? ( sys-process/procps ) + >=sys-apps/sed-4 + >=sys-apps/texinfo-4.7-r1 + >=sys-libs/readline-4.1 + >=sys-libs/zlib-1.2.3" + +# Having different flavours at the same time is not a good idea +for i in "" "-community" ; do + [[ "${i}" == ${PN#mysql} ]] || + DEPEND="${DEPEND} !dev-db/mysql${i}" +done + +RDEPEND="${DEPEND} + !minimal? ( dev-db/mysql-init-scripts ) + selinux? ( sec-policy/selinux-mysql )" + +# compile-time-only +mysql_version_is_at_least "5.1" \ +|| DEPEND="${DEPEND} berkdb? ( sys-apps/ed )" + +# compile-time-only +mysql_version_is_at_least "5.1.12" \ +&& DEPEND="${DEPEND} >=dev-util/cmake-2.4.3" + +# dev-perl/DBD-mysql is needed by some scripts installed by MySQL +PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )" + +# For other stuff to bring us in +PDEPEND="${PDEPEND} =virtual/mysql-$(get_version_component_range 1-2 ${PV})" + +# Work out the default SERVER_URI correctly +if [ -z "${SERVER_URI}" ]; then + [ -z "${MY_PV}" ] && MY_PV="${PV//_/-}" + # The community build is on the mirrors + if [ "${MYSQL_COMMUNITY_FEATURES}" == "1" ]; then + SERVER_URI="mirror://mysql/Downloads/MySQL-${PV%.*}/mysql-${MY_PV}.tar.gz" + # The (old) enterprise source is on the primary site only + elif [ "${PN}" == "mysql" ]; then + SERVER_URI="ftp://ftp.mysql.com/pub/mysql/src/mysql-${MY_PV}.tar.gz" + fi +fi + +# Define correct SRC_URIs +SRC_URI="${SERVER_URI}" + +# Gentoo patches to MySQL +[[ ${MY_EXTRAS_VER} != live ]] \ +&& SRC_URI="${SRC_URI} + mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 + http://g3nt8.org/patches/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 + http://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" + +DESCRIPTION="A fast, multi-threaded, multi-user SQL database server." +HOMEPAGE="http://www.mysql.com/" +LICENSE="GPL-2" +SLOT="0" +IUSE="big-tables debug embedded minimal ${IUSE_DEFAULT_ON}perl selinux ssl static test" + +mysql_version_is_at_least "4.1" \ +&& IUSE="${IUSE} latin1" + +mysql_version_is_at_least "4.1.3" \ +&& IUSE="${IUSE} cluster extraengine" + +mysql_version_is_at_least "5.0" \ +|| IUSE="${IUSE} raid" + +mysql_version_is_at_least "5.0.18" \ +&& IUSE="${IUSE} max-idx-128" + +mysql_version_is_at_least "5.1" \ +|| IUSE="${IUSE} berkdb" + +[ "${MYSQL_COMMUNITY_FEATURES}" == "1" ] \ +&& IUSE="${IUSE} ${IUSE_DEFAULT_ON}community profiling" + +# PBXT engine +mysql_version_is_at_least "5.1.12" \ +&& [[ -n "${PBXT_VERSION}" ]] \ +&& PBXT_P="pbxt-${PBXT_VERSION}" \ +&& PBXT_SRC_URI="http://www.primebase.org/download/${PBXT_P}.tar.gz mirror://sourceforge/pbxt/${PBXT_P}.tar.gz" \ +&& SRC_URI="${SRC_URI} pbxt? ( ${PBXT_SRC_URI} )" \ +&& IUSE="${IUSE} pbxt" + +# Get the percona tarball if XTRADB_VER and PERCONA_VER are both set +mysql_version_is_at_least "5.1.26" \ +&& [[ -n "${XTRADB_VER}" && -n "${PERCONA_VER}" ]] \ +&& XTRADB_P="percona-xtradb-${XTRADB_VER}" \ +&& XTRADB_SRC_URI_COMMON="${PERCONA_VER}/source/${XTRADB_P}.tar.gz" \ +&& XTRADB_SRC_URI1="http://www.percona.com/percona-builds/xtradb/${XTRADB_SRC_URI_COMMON}" \ +&& XTRADB_SRC_URI2="http://www.percona.com/${PN}/xtradb/${XTRADB_SRC_URI_COMMON}" \ +&& SRC_URI="${SRC_URI} xtradb? ( ${XTRADB_SRC_URI1} ${XTRADB_SRC_URI2} )" \ +&& IUSE="${IUSE} xtradb" + +# +# HELPER FUNCTIONS: +# + +# @FUNCTION: mysql_disable_test +# @DESCRIPTION: +# Helper function to disable specific tests. +mysql_disable_test() { + local rawtestname testname testsuite reason mysql_disable_file + rawtestname="${1}" ; shift + reason="${@}" + ewarn "test '${rawtestname}' disabled: '${reason}'" + + testsuite="${rawtestname/.*}" + testname="${rawtestname/*.}" + mysql_disable_file="${S}/mysql-test/t/disabled.def" + #einfo "rawtestname=${rawtestname} testname=${testname} testsuite=${testsuite}" + echo ${testname} : ${reason} >> "${mysql_disable_file}" + + # ${S}/mysql-tests/t/disabled.def + # + # ${S}/mysql-tests/suite/federated/disabled.def + # + # ${S}/mysql-tests/suite/jp/t/disabled.def + # ${S}/mysql-tests/suite/ndb/t/disabled.def + # ${S}/mysql-tests/suite/rpl/t/disabled.def + # ${S}/mysql-tests/suite/parts/t/disabled.def + # ${S}/mysql-tests/suite/rpl_ndb/t/disabled.def + # ${S}/mysql-tests/suite/ndb_team/t/disabled.def + # ${S}/mysql-tests/suite/binlog/t/disabled.def + # ${S}/mysql-tests/suite/innodb/t/disabled.def + if [ -n "${testsuite}" ]; then + for mysql_disable_file in \ + ${S}/mysql-test/suite/${testsuite}/disabled.def \ + ${S}/mysql-test/suite/${testsuite}/t/disabled.def \ + FAILED ; do + [ -f "${mysql_disable_file}" ] && break + done + if [ "${mysql_disabled_file}" != "FAILED" ]; then + echo "${testname} : ${reason}" >> "${mysql_disable_file}" + else + ewarn "Could not find testsuite disabled.def location for ${rawtestname}" + fi + fi +} + +# @FUNCTION: mysql_init_vars +# @DESCRIPTION: +# void mysql_init_vars() +# Initialize global variables +# 2005-11-19 +mysql_init_vars() { + MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="/usr/share/mysql"} + MY_SYSCONFDIR=${MY_SYSCONFDIR="/etc/mysql"} + MY_LIBDIR=${MY_LIBDIR="/usr/$(get_libdir)/mysql"} + MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="/var/lib/mysql"} + MY_LOGDIR=${MY_LOGDIR="/var/log/mysql"} + MY_INCLUDEDIR=${MY_INCLUDEDIR="/usr/include/mysql"} + + if [[ -z "${MY_DATADIR}" ]] ; then + MY_DATADIR="" + if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then + MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ + | sed -ne '/datadir/s|^--datadir=||p' \ + | tail -n1` + if [[ -z "${MY_DATADIR}" ]] ; then + MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ + | sed -e 's/.*=\s*//' \ + | tail -n1` + fi + fi + if [[ -z "${MY_DATADIR}" ]] ; then + MY_DATADIR="${MY_LOCALSTATEDIR}" + einfo "Using default MY_DATADIR" + fi + elog "MySQL MY_DATADIR is ${MY_DATADIR}" + + if [[ -z "${PREVIOUS_DATADIR}" ]] ; then + if [[ -e "${MY_DATADIR}" ]] ; then + # If you get this and you're wondering about it, see bug #207636 + elog "MySQL datadir found in ${MY_DATADIR}" + elog "A new one will not be created." + PREVIOUS_DATADIR="yes" + else + PREVIOUS_DATADIR="no" + fi + export PREVIOUS_DATADIR + fi + else + if [[ ${EBUILD_PHASE} == "config" ]]; then + local new_MY_DATADIR + new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ + | sed -ne '/datadir/s|^--datadir=||p' \ + | tail -n1` + + if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then + ewarn "MySQL MY_DATADIR has changed" + ewarn "from ${MY_DATADIR}" + ewarn "to ${new_MY_DATADIR}" + MY_DATADIR="${new_MY_DATADIR}" + fi + fi + fi + + MY_SOURCEDIR=${SERVER_URI##*/} + MY_SOURCEDIR=${MY_SOURCEDIR%.tar*} + + export MY_SHAREDSTATEDIR MY_SYSCONFDIR + export MY_LIBDIR MY_LOCALSTATEDIR MY_LOGDIR + export MY_INCLUDEDIR MY_DATADIR MY_SOURCEDIR +} + +configure_minimal() { + # These are things we exclude from a minimal build, please + # note that the server actually does get built and installed, + # but we then delete it before packaging. + local minimal_exclude_list="server embedded-server extra-tools innodb bench berkeley-db row-based-replication readline" + + for i in ${minimal_exclude_list} ; do + myconf="${myconf} --without-${i}" + done + myconf="${myconf} --with-extra-charsets=none" + myconf="${myconf} --enable-local-infile" + + if use static ; then + myconf="${myconf} --with-client-ldflags=-all-static" + myconf="${myconf} --disable-shared --with-pic" + else + myconf="${myconf} --enable-shared --enable-static" + fi + + if mysql_version_is_at_least "4.1" && ! use latin1 ; then + myconf="${myconf} --with-charset=utf8" + myconf="${myconf} --with-collation=utf8_general_ci" + else + myconf="${myconf} --with-charset=latin1" + myconf="${myconf} --with-collation=latin1_swedish_ci" + fi +} + +configure_common() { + myconf="${myconf} $(use_with big-tables)" + myconf="${myconf} --enable-local-infile" + myconf="${myconf} --with-extra-charsets=all" + myconf="${myconf} --with-mysqld-user=mysql" + myconf="${myconf} --with-server" + myconf="${myconf} --with-unix-socket-path=/var/run/mysqld/mysqld.sock" + myconf="${myconf} --without-libwrap" + + if use static ; then + myconf="${myconf} --with-mysqld-ldflags=-all-static" + myconf="${myconf} --with-client-ldflags=-all-static" + myconf="${myconf} --disable-shared --with-pic" + else + myconf="${myconf} --enable-shared --enable-static" + fi + + if use debug ; then + myconf="${myconf} --with-debug=full" + else + myconf="${myconf} --without-debug" + mysql_version_is_at_least "4.1.3" \ + && use cluster \ + && myconf="${myconf} --without-ndb-debug" + fi + + if [ -n "${MYSQL_DEFAULT_CHARSET}" -a -n "${MYSQL_DEFAULT_COLLATION}" ]; then + ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" + ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." + ewarn "You MUST file bugs without these variables set." + myconf="${myconf} --with-charset=${MYSQL_DEFAULT_CHARSET}" + myconf="${myconf} --with-collation=${MYSQL_DEFAULT_COLLATION}" + elif mysql_version_is_at_least "4.1" && ! use latin1 ; then + myconf="${myconf} --with-charset=utf8" + myconf="${myconf} --with-collation=utf8_general_ci" + else + myconf="${myconf} --with-charset=latin1" + myconf="${myconf} --with-collation=latin1_swedish_ci" + fi + + if use embedded ; then + myconf="${myconf} --with-embedded-privilege-control" + myconf="${myconf} --with-embedded-server" + else + myconf="${myconf} --without-embedded-privilege-control" + myconf="${myconf} --without-embedded-server" + fi + +} + +configure_40_41_50() { + myconf="${myconf} $(use_with perl bench)" + myconf="${myconf} --enable-assembler" + myconf="${myconf} --with-extra-tools" + myconf="${myconf} --with-innodb" + myconf="${myconf} --without-readline" + myconf="${myconf} $(use_with ssl openssl)" + mysql_version_is_at_least "5.0" || myconf="${myconf} $(use_with raid)" + + # --with-vio is not needed anymore, it's on by default and + # has been removed from configure + # Apply to 4.x and 5.0.[0-3] + if use ssl ; then + mysql_version_is_at_least "5.0.4" || myconf="${myconf} --with-vio" + fi + + if mysql_version_is_at_least "5.0.60" ; then + if use berkdb ; then + elog "Berkeley DB support was disabled due to build failures" + elog "on multiple arches, go to a version earlier than 5.0.60" + elog "if you want it again. Gentoo bug #224067." + fi + myconf="${myconf} --without-berkeley-db" + elif use berkdb ; then + # The following fix is due to a bug with bdb on SPARC's. See: + # http://www.geocrawler.com/mail/msg.php3?msg_id=4754814&list=8 + # It comes down to non-64-bit safety problems. + if use alpha || use amd64 || use hppa || use mips || use sparc ; then + elog "Berkeley DB support was disabled due to compatibility issues on this arch" + myconf="${myconf} --without-berkeley-db" + else + myconf="${myconf} --with-berkeley-db=./bdb" + fi + else + myconf="${myconf} --without-berkeley-db" + fi + + if mysql_version_is_at_least "4.1.3" ; then + myconf="${myconf} --with-geometry" + myconf="${myconf} $(use_with cluster ndbcluster)" + fi + + if mysql_version_is_at_least "4.1.3" && use extraengine ; then + # http://dev.mysql.com/doc/mysql/en/archive-storage-engine.html + myconf="${myconf} --with-archive-storage-engine" + + # http://dev.mysql.com/doc/mysql/en/csv-storage-engine.html + myconf="${myconf} --with-csv-storage-engine" + + # http://dev.mysql.com/doc/mysql/en/blackhole-storage-engine.html + myconf="${myconf} --with-blackhole-storage-engine" + + # http://dev.mysql.com/doc/mysql/en/federated-storage-engine.html + # http://dev.mysql.com/doc/mysql/en/federated-description.html + # http://dev.mysql.com/doc/mysql/en/federated-limitations.html + if mysql_version_is_at_least "5.0.3" ; then + elog "Before using the Federated storage engine, please be sure to read" + elog "http://dev.mysql.com/doc/mysql/en/federated-limitations.html" + myconf="${myconf} --with-federated-storage-engine" + fi + fi + + if [ "${MYSQL_COMMUNITY_FEATURES}" == "1" ]; then + myconf="${myconf} `use_enable community community-features`" + if use community; then + myconf="${myconf} `use_enable profiling`" + else + myconf="${myconf} --disable-profiling" + fi + fi + + mysql_version_is_at_least "5.0.18" \ + && use max-idx-128 \ + && myconf="${myconf} --with-max-indexes=128" +} + +configure_51() { + # TODO: !!!! readd --without-readline + # the failure depend upon config/ac-macros/readline.m4 checking into + # readline.h instead of history.h + myconf="${myconf} $(use_with ssl ssl /usr)" + myconf="${myconf} --enable-assembler" + myconf="${myconf} --with-geometry" + myconf="${myconf} --with-readline" + myconf="${myconf} --with-zlib-dir=/usr/" + myconf="${myconf} --without-pstack" + use max-idx-128 && myconf="${myconf} --with-max-indexes=128" + if [ "${MYSQL_COMMUNITY_FEATURES}" == "1" ]; then + myconf="${myconf} $(use_enable community community-features)" + if use community; then + myconf="${myconf} $(use_enable profiling)" + else + myconf="${myconf} --disable-profiling" + fi + fi + + # 5.1 introduces a new way to manage storage engines (plugins) + # like configuration=none + local plugins="csv,myisam,myisammrg,heap" + if use extraengine ; then + # like configuration=max-no-ndb, archive and example removed in 5.1.11 + # not added yet: ibmdb2i + # Not supporting as examples: example,daemon_example,ftexample + plugins="${plugins},archive,blackhole,federated,partition" + + elog "Before using the Federated storage engine, please be sure to read" + elog "http://dev.mysql.com/doc/refman/5.1/en/federated-limitations.html" + fi + + # Upstream specifically requests that InnoDB always be built: + # - innobase, innodb_plugin + # Build falcon if available for 6.x series. + for i in innobase innodb_plugin falcon ; do + [ -e "${S}"/storage/${i} ] && plugins="${plugins},${i}" + done + + # like configuration=max-no-ndb + if use cluster ; then + plugins="${plugins},ndbcluster" + myconf="${myconf} --with-ndb-binlog" + fi + + myconf="${myconf} --with-plugins=${plugins}" +} + +xtradb_applicable() { + mysql_version_is_at_least "5.1.26" \ + && [[ -n "${XTRADB_VER}" && -n "${PERCONA_VER}" ]] \ + && use xtradb + return $? +} + +pbxt_applicable() { + mysql_version_is_at_least "5.1.12" \ + && [[ -n "${PBXT_VERSION}" ]] \ + && use pbxt + return $? +} + +pbxt_src_configure() { + mysql_init_vars + + pushd "${WORKDIR}/pbxt-${PBXT_VERSION}" &>/dev/null + + einfo "Reconfiguring dir '${PWD}'" + AT_GNUCONF_UPDATE="yes" eautoreconf + + local myconf="" + myconf="${myconf} --with-mysql=${S} --libdir=${MY_LIBDIR}" + use debug && myconf="${myconf} --with-debug=full" + # TODO: is it safe/needed to use econf here ? + ./configure ${myconf} || die "Problem configuring PBXT storage engine" +} + +pbxt_src_compile() { + # Be backwards compatible for now + if [[ $EAPI != 2 ]]; then + pbxt_src_configure + fi + # TODO: is it safe/needed to use emake here ? + make || die "Problem making PBXT storage engine (${myconf})" + + popd + # TODO: modify test suite for PBXT +} + +pbxt_src_install() { + pushd "${WORKDIR}/pbxt-${PBXT_VERSION}" &>/dev/null + emake install DESTDIR="${D}" || die "Failed to install PBXT" + popd +} + +# +# EBUILD FUNCTIONS +# +# @FUNCTION: mysql_pkg_setup +# @DESCRIPTION: +# Perform some basic tests and tasks during pkg_setup phase: +# die if FEATURES="test", USE="-minimal" and not using FEATURES="userpriv" +# check for conflicting use flags +# create new user and group for mysql +# warn about deprecated features +mysql_pkg_setup() { + if hasq test ${FEATURES} ; then + if ! use minimal ; then + if [[ $UID -eq 0 ]]; then + eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." + fi + fi + fi + + # Check for USE flag problems in pkg_setup + if use static && use ssl ; then + eerror "MySQL does not support being built statically with SSL support enabled!" + die "MySQL does not support being built statically with SSL support enabled!" + fi + + if ! mysql_version_is_at_least "5.0" \ + && use raid \ + && use static ; then + eerror "USE flags 'raid' and 'static' conflict, you cannot build MySQL statically" + eerror "with RAID support enabled." + die "USE flags 'raid' and 'static' conflict!" + fi + + if mysql_version_is_at_least "4.1.3" \ + && ( use cluster || use extraengine ) \ + && use minimal ; then + eerror "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!" + die "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!" + fi + + # Bug #290570 fun. Upstream made us need a fairly new GCC4. + if mysql_version_is_at_least "5.0.83" ; then + GCC_VER=$(gcc-version) + case ${GCC_VER} in + 2*|3*|4.0|4.1|4.2) die "Active GCC too old! Must have at least GCC4.3" ;; + esac + fi + + # This should come after all of the die statements + enewgroup mysql 60 || die "problem adding 'mysql' group" + enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user" + + mysql_check_version_range "4.0 to 5.0.99.99" \ + && use berkdb \ + && elog "Berkeley DB support is deprecated and will be removed in future versions!" + + if [ "${PN}" != "mysql-cluster" ] && use cluster; then + ewarn "Upstream has noted that the NDB cluster support in the 5.0 and" + ewarn "5.1 series should NOT be put into production. In the near" + ewarn "future, it will be disabled from building." + ewarn "" + ewarn "If you need NDB support, you should instead move to the new" + ewarn "mysql-cluster package that represents that upstream NDB" + ewarn "development." + fi +} + +# @FUNCTION: mysql_src_unpack +# @DESCRIPTION: +# Unpack the source code and call mysql_src_prepare for EAPI < 2. +mysql_src_unpack() { + # Initialize the proper variables first + mysql_init_vars + + unpack ${A} + # Grab the patches + [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git_src_unpack + + mv -f "${WORKDIR}/${MY_SOURCEDIR}" "${S}" + + # Be backwards compatible for now + case ${EAPI:-0} in + 2) : ;; + 0 | 1) mysql_src_prepare ;; + esac +} + +# @FUNCTION: mysql_src_prepare +# @DESCRIPTION: +# Apply patches to the source code and remove unneeded bundled libs. +mysql_src_prepare() { + cd "${S}" + + # Apply the patches for this MySQL version + EPATCH_SUFFIX="patch" + mkdir -p "${EPATCH_SOURCE}" || die "Unable to create epatch directory" + # Clean out old items + rm -f "${EPATCH_SOURCE}"/* + # Now link in right patches + mysql_mv_patches + # And apply + epatch + + # last -fPIC fixup, per bug #305873 + i="${S}"/storage/innodb_plugin/plug.in + [ -f "${i}" ] && sed -i -e '/CFLAGS/s,-prefer-non-pic,,g' "${i}" + + # Additional checks, remove bundled zlib + rm -f "${S}/zlib/"*.[ch] + sed -i -e "s/zlib\/Makefile dnl/dnl zlib\/Makefile/" "${S}/configure.in" + rm -f "scripts/mysqlbug" + + # Make charsets install in the right place + find . -name 'Makefile.am' \ + -exec sed --in-place -e 's!$(pkgdatadir)!'${MY_SHAREDSTATEDIR}'!g' {} \; + + if mysql_version_is_at_least "4.1" ; then + # Remove what needs to be recreated, so we're sure it's actually done + einfo "Cleaning up old buildscript files" + find . -name Makefile \ + -o -name Makefile.in \ + -o -name configure \ + -exec rm -f {} \; + rm -f "ltmain.sh" + rm -f "scripts/mysqlbug" + fi + + local rebuilddirlist d + + if xtradb_applicable ; then + einfo "Replacing InnoDB with Percona XtraDB" + pushd "${S}"/storage + i="innobase" + o="${WORKDIR}/storage-${i}.mysql-upstream" + # Have we been here already? + [ -d "${o}" ] && rm -f "${i}" + # Or maybe we haven't + [ -d "${i}" -a ! -d "${o}" ] && mv "${i}" "${o}" + cp -ra "${WORKDIR}/${XTRADB_P}" "${i}" + popd + fi + + if mysql_version_is_at_least "5.1.12" ; then + rebuilddirlist="." + # This does not seem to be needed presently. robbat2 2010/02/23 + #einfo "Updating innobase cmake" + ## TODO: check this with a cmake expert + #cmake \ + # -DCMAKE_C_COMPILER=$(type -P $(tc-getCC)) \ + # -DCMAKE_CXX_COMPILER=$(type -P $(tc-getCXX)) \ + # "storage/innobase" + else + rebuilddirlist=". innobase" + fi + + for d in ${rebuilddirlist} ; do + einfo "Reconfiguring dir '${d}'" + pushd "${d}" &>/dev/null + AT_GNUCONF_UPDATE="yes" eautoreconf + popd &>/dev/null + done + + if mysql_check_version_range "4.1 to 5.0.99.99" \ + && use berkdb ; then + einfo "Fixing up berkdb buildsystem" + [[ -w "bdb/dist/ltmain.sh" ]] && cp -f "ltmain.sh" "bdb/dist/ltmain.sh" + cp -f "/usr/share/aclocal/libtool.m4" "bdb/dist/aclocal/libtool.ac" \ + || die "Could not copy libtool.m4 to bdb/dist/" + #These files exist only with libtool-2*, and need to be included. + if [ -f '/usr/share/aclocal/ltsugar.m4' ]; then + cat "/usr/share/aclocal/ltsugar.m4" >> "bdb/dist/aclocal/libtool.ac" + cat "/usr/share/aclocal/ltversion.m4" >> "bdb/dist/aclocal/libtool.ac" + cat "/usr/share/aclocal/lt~obsolete.m4" >> "bdb/dist/aclocal/libtool.ac" + cat "/usr/share/aclocal/ltoptions.m4" >> "bdb/dist/aclocal/libtool.ac" + fi + pushd "bdb/dist" &>/dev/null + sh s_all \ + || die "Failed bdb reconfigure" + popd &>/dev/null + fi +} + +# @FUNCTION: mysql_src_configure +# @DESCRIPTION: +# Configure mysql to build the code for Gentoo respecting the use flags. +mysql_src_configure() { + # Make sure the vars are correctly initialized + mysql_init_vars + + # $myconf is modified by the configure_* functions + local myconf="" + + if use minimal ; then + configure_minimal + else + configure_common + if mysql_version_is_at_least "5.1.10" ; then + configure_51 + else + configure_40_41_50 + fi + fi + + # Bug #114895, bug #110149 + filter-flags "-O" "-O[01]" + + # glib-2.3.2_pre fix, bug #16496 + append-flags "-DHAVE_ERRNO_AS_DEFINE=1" + + # As discovered by bug #246652, doing a double-level of SSP causes NDB to + # fail badly during cluster startup. + if [[ $(gcc-major-version) -lt 4 ]]; then + filter-flags "-fstack-protector-all" + fi + + CXXFLAGS="${CXXFLAGS} -fno-exceptions -fno-strict-aliasing" + CXXFLAGS="${CXXFLAGS} -felide-constructors -fno-rtti" + mysql_version_is_at_least "5.0" \ + && CXXFLAGS="${CXXFLAGS} -fno-implicit-templates" + export CXXFLAGS + + # bug #283926, with GCC4.4, this is required to get correct behavior. + append-flags -fno-strict-aliasing + + econf \ + --libexecdir="/usr/sbin" \ + --sysconfdir="${MY_SYSCONFDIR}" \ + --localstatedir="${MY_LOCALSTATEDIR}" \ + --sharedstatedir="${MY_SHAREDSTATEDIR}" \ + --libdir="${MY_LIBDIR}" \ + --includedir="${MY_INCLUDEDIR}" \ + --with-low-memory \ + --with-client-ldflags=-lstdc++ \ + --enable-thread-safe-client \ + --with-comment="Gentoo Linux ${PF}" \ + --without-docs \ + ${myconf} || die "econf failed" + + # TODO: Move this before autoreconf !!! + find . -type f -name Makefile -print0 \ + | xargs -0 -n100 sed -i \ + -e 's|^pkglibdir *= *$(libdir)/mysql|pkglibdir = $(libdir)|;s|^pkgincludedir *= *$(includedir)/mysql|pkgincludedir = $(includedir)|' + + if [[ $EAPI == 2 ]]; then + pbxt_applicable && pbxt_src_configure + fi +} + +# @FUNCTION: mysql_src_compile +# @DESCRIPTION: +# Compile the mysql code. +mysql_src_compile() { + # Be backwards compatible for now + case ${EAPI:-0} in + 2) : ;; + 0 | 1) mysql_src_configure ;; + esac + + emake || die "emake failed" + + pbxt_applicable && pbxt_src_compile +} + +# @FUNCTION: mysql_src_install +# @DESCRIPTION: +# Install mysql. +mysql_src_install() { + # Make sure the vars are correctly initialized + mysql_init_vars + + emake install \ + DESTDIR="${D}" \ + benchdir_root="${MY_SHAREDSTATEDIR}" \ + testroot="${MY_SHAREDSTATEDIR}" \ + || die "emake install failed" + + pbxt_applicable && pbxt_src_install + + # Convenience links + einfo "Making Convenience links for mysqlcheck multi-call binary" + dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlanalyze" + dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlrepair" + dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqloptimize" + + # Various junk (my-*.cnf moved elsewhere) + einfo "Removing duplicate /usr/share/mysql files" + rm -Rf "${D}/usr/share/info" + for removeme in "mysql-log-rotate" mysql.server* \ + binary-configure* my-*.cnf mi_test_all* + do + rm -f "${D}"/${MY_SHAREDSTATEDIR}/${removeme} + done + + # Clean up stuff for a minimal build + if use minimal ; then + einfo "Remove all extra content for minimal build" + rm -Rf "${D}${MY_SHAREDSTATEDIR}"/{mysql-test,sql-bench} + rm -f "${D}"/usr/bin/{mysql{_install_db,manager*,_secure_installation,_fix_privilege_tables,hotcopy,_convert_table_format,d_multi,_fix_extensions,_zap,_explain_log,_tableinfo,d_safe,_install,_waitpid,binlog,test},myisam*,isam*,pack_isam} + rm -f "${D}/usr/sbin/mysqld" + rm -f "${D}${MY_LIBDIR}"/lib{heap,merge,nisam,my{sys,strings,sqld,isammrg,isam},vio,dbug}.a + fi + + # Unless they explicitly specific USE=test, then do not install the + # testsuite. It DOES have a use to be installed, esp. when you want to do a + # validation of your database configuration after tuning it. + if use !test ; then + rm -rf "${D}"/${MY_SHAREDSTATEDIR}/mysql-test + fi + + # Configuration stuff + if mysql_version_is_at_least "4.1" ; then + mysql_mycnf_version="4.1" + else + mysql_mycnf_version="4.0" + fi + einfo "Building default my.cnf" + insinto "${MY_SYSCONFDIR}" + doins scripts/mysqlaccess.conf + sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ + "${FILESDIR}/my.cnf-${mysql_mycnf_version}" \ + > "${TMPDIR}/my.cnf.ok" + if mysql_version_is_at_least "4.1" && use latin1 ; then + sed -e "s|utf8|latin1|g" -i "${TMPDIR}/my.cnf.ok" + fi + newins "${TMPDIR}/my.cnf.ok" my.cnf + + # Minimal builds don't have the MySQL server + if ! use minimal ; then + einfo "Creating initial directories" + # Empty directories ... + diropts "-m0750" + if [[ "${PREVIOUS_DATADIR}" != "yes" ]] ; then + dodir "${MY_DATADIR}" + keepdir "${MY_DATADIR}" + chown -R mysql:mysql "${D}/${MY_DATADIR}" + fi + + diropts "-m0755" + for folder in "${MY_LOGDIR}" "/var/run/mysqld" ; do + dodir "${folder}" + keepdir "${folder}" + chown -R mysql:mysql "${D}/${folder}" + done + fi + + # Docs + einfo "Installing docs" + dodoc README ChangeLog EXCEPTIONS-CLIENT INSTALL-SOURCE + doinfo "${S}"/Docs/mysql.info + + # Minimal builds don't have the MySQL server + if ! use minimal ; then + einfo "Including support files and sample configurations" + docinto "support-files" + for script in \ + "${S}"/support-files/my-*.cnf \ + "${S}"/support-files/magic \ + "${S}"/support-files/ndb-config-2-node.ini + do + [[ -f "$script" ]] && dodoc "${script}" + done + + docinto "scripts" + for script in "${S}"/scripts/mysql* ; do + [[ -f "$script" ]] && [[ "${script%.sh}" == "${script}" ]] && dodoc "${script}" + done + + fi + + mysql_lib_symlinks "${D}" +} + +# @FUNCTION: mysql_pkg_preinst +# @DESCRIPTION: +# Create the user and groups for mysql - die if that fails. +mysql_pkg_preinst() { + enewgroup mysql 60 || die "problem adding 'mysql' group" + enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user" +} + +# @FUNCTION: mysql_pkg_postinst +# @DESCRIPTION: +# Run post-installation tasks: +# create the dir for logfiles if non-existant +# touch the logfiles and secure them +# install scripts +# issue required steps for optional features +# issue deprecation warnings +mysql_pkg_postinst() { + # Make sure the vars are correctly initialized + mysql_init_vars + + # Check FEATURES="collision-protect" before removing this + [[ -d "${ROOT}/var/log/mysql" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}" + + # Secure the logfiles + touch "${ROOT}${MY_LOGDIR}"/mysql.{log,err} + chown mysql:mysql "${ROOT}${MY_LOGDIR}"/mysql* + chmod 0660 "${ROOT}${MY_LOGDIR}"/mysql* + + # Minimal builds don't have the MySQL server + if ! use minimal ; then + docinto "support-files" + for script in \ + support-files/my-*.cnf \ + support-files/magic \ + support-files/ndb-config-2-node.ini + do + dodoc "${script}" + done + + docinto "scripts" + for script in scripts/mysql* ; do + [[ "${script%.sh}" == "${script}" ]] && dodoc "${script}" + done + + einfo + elog "You might want to run:" + elog "\"emerge --config =${CATEGORY}/${PF}\"" + elog "if this is a new install." + einfo + fi + + if pbxt_applicable ; then + # TODO: explain it better + elog " mysql> INSTALL PLUGIN pbxt SONAME 'libpbxt.so';" + elog " mysql> CREATE TABLE t1 (c1 int, c2 text) ENGINE=pbxt;" + elog "if, after that, you cannot start the MySQL server," + elog "remove the ${MY_DATADIR}/mysql/plugin.* files, then" + elog "use the MySQL upgrade script to restore the table" + elog "or execute the following SQL command:" + elog " CREATE TABLE IF NOT EXISTS plugin (" + elog " name char(64) binary DEFAULT '' NOT NULL," + elog " dl char(128) DEFAULT '' NOT NULL," + elog " PRIMARY KEY (name)" + elog " ) CHARACTER SET utf8 COLLATE utf8_bin;" + fi + + mysql_check_version_range "4.0 to 5.0.99.99" \ + && use berkdb \ + && elog "Berkeley DB support is deprecated and will be removed in future versions!" +} + +# @FUNCTION: mysql_pkg_config +# @DESCRIPTION: +# Configure mysql environment. +mysql_pkg_config() { + local old_MY_DATADIR="${MY_DATADIR}" + + # Make sure the vars are correctly initialized + mysql_init_vars + + [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR" + + if built_with_use ${CATEGORY}/${PN} minimal ; then + die "Minimal builds do NOT include the MySQL server" + fi + + if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then + local MY_DATADIR_s="$(strip_duplicate_slashes ${ROOT}/${MY_DATADIR})" + local old_MY_DATADIR_s="$(strip_duplicate_slashes ${ROOT}/${old_MY_DATADIR})" + + if [[ -d "${old_MY_DATADIR_s}" ]]; then + if [[ -d "${MY_DATADIR_s}" ]]; then + ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist" + ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}" + else + elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}" + mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \ + || die "Moving MY_DATADIR failed" + fi + else + ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist" + if [[ -d "${MY_DATADIR_s}" ]]; then + ewarn "Attempting to use ${MY_DATADIR_s}" + else + eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist" + die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}" + fi + fi + fi + + local pwd1="a" + local pwd2="b" + local maxtry=5 + + if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then + ewarn "You have already a MySQL database in place." + ewarn "(${ROOT}/${MY_DATADIR}/*)" + ewarn "Please rename or delete it if you wish to replace it." + die "MySQL database already exists!" + fi + + # Bug #213475 - MySQL _will_ object strenously if your machine is named + # localhost. Also causes weird failures. + [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" + + einfo "Creating the mysql database and setting proper" + einfo "permissions on it ..." + + einfo "Insert a password for the mysql 'root' user" + ewarn "Avoid [\"'\\_%] characters in the password" + read -rsp " >" pwd1 ; echo + + einfo "Retype the password" + read -rsp " >" pwd2 ; echo + + if [[ "x$pwd1" != "x$pwd2" ]] ; then + die "Passwords are not the same" + fi + + local options="" + local sqltmp="$(emktemp)" + + local help_tables="${ROOT}${MY_SHAREDSTATEDIR}/fill_help_tables.sql" + [[ -r "${help_tables}" ]] \ + && cp "${help_tables}" "${TMPDIR}/fill_help_tables.sql" \ + || touch "${TMPDIR}/fill_help_tables.sql" + help_tables="${TMPDIR}/fill_help_tables.sql" + + pushd "${TMPDIR}" &>/dev/null + "${ROOT}/usr/bin/mysql_install_db" >"${TMPDIR}"/mysql_install_db.log 2>&1 + if [ $? -ne 0 ]; then + grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2 + die "Failed to run mysql_install_db. Please review /var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log" + fi + popd &>/dev/null + [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \ + || die "MySQL databases not installed" + chown -R mysql:mysql "${ROOT}/${MY_DATADIR}" 2>/dev/null + chmod 0750 "${ROOT}/${MY_DATADIR}" 2>/dev/null + + if mysql_version_is_at_least "4.1.3" ; then + options="--skip-ndbcluster" + + # Filling timezones, see + # http://dev.mysql.com/doc/mysql/en/time-zone-support.html + "${ROOT}/usr/bin/mysql_tzinfo_to_sql" "${ROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null + + if [[ -r "${help_tables}" ]] ; then + cat "${help_tables}" >> "${sqltmp}" + fi + fi + + local socket="${ROOT}/var/run/mysqld/mysqld${RANDOM}.sock" + local pidfile="${ROOT}/var/run/mysqld/mysqld${RANDOM}.pid" + local mysqld="${ROOT}/usr/sbin/mysqld \ + ${options} \ + --user=mysql \ + --skip-grant-tables \ + --basedir=${ROOT}/usr \ + --datadir=${ROOT}/${MY_DATADIR} \ + --skip-innodb \ + --skip-bdb \ + --skip-networking \ + --max_allowed_packet=8M \ + --net_buffer_length=16K \ + --socket=${socket} \ + --pid-file=${pidfile}" + ${mysqld} & + while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do + maxtry=$((${maxtry}-1)) + echo -n "." + sleep 1 + done + + # Do this from memory, as we don't want clear text passwords in temp files + local sql="UPDATE mysql.user SET Password = PASSWORD('${pwd1}') WHERE USER='root'" + "${ROOT}/usr/bin/mysql" \ + --socket=${socket} \ + -hlocalhost \ + -e "${sql}" + + einfo "Loading \"zoneinfo\", this step may require a few seconds ..." + + "${ROOT}/usr/bin/mysql" \ + --socket=${socket} \ + -hlocalhost \ + -uroot \ + -p"${pwd1}" \ + mysql < "${sqltmp}" + + # Stop the server and cleanup + kill $(< "${pidfile}" ) + rm -f "${sqltmp}" + einfo "Stopping the server ..." + wait %1 + einfo "Done" +} + +# @FUNCTION: mysql_pkg_postrm +# @DESCRIPTION: +# Remove mysql symlinks. +mysql_pkg_postrm() { + : # mysql_lib_symlinks "${D}" +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/mysql_fx.eclass b/sdk_container/src/third_party/portage-stable/eclass/mysql_fx.eclass new file mode 100644 index 0000000000..2ee11002a2 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/mysql_fx.eclass @@ -0,0 +1,211 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/mysql_fx.eclass,v 1.22 2009/02/12 05:05:14 robbat2 Exp $ + +# Author: Francesco Riosa (Retired) +# Maintainer: Luca Longinotti + +inherit multilib + +# +# Helper function, version (integer) may have sections separated by dots +# for readability. +# +stripdots() { + local dotver=${1:-"0"} + local v="" + local ret=0 + if [[ "${dotver/./}" != "${dotver}" ]] ; then + # dotted version number + for i in 1000000 10000 100 1 ; do + v=${dotver%%\.*} + # remove leading zeroes + while [[ ${#v} -gt 1 ]] && [[ ${v:0:1} == "0" ]] ; do v=${v#0} ; done + # increment integer version number + ret=$(( ${v} * ${i} + ${ret} )) + if [[ "${dotver}" == "${dotver/\.}" ]] ; then + dotver=0 + else + dotver=${dotver#*\.} + fi + done + echo "${ret}" + else + # already an integer + v=${dotver} + while [[ ${#v} -gt 1 ]] && [[ ${v:0:1} == "0" ]] ; do v=${v#0} ; done + echo "${v}" + fi +} + +# +# Check if a version number falls inside a given range. +# The range includes the extremes and must be specified as +# "low_version to high_version" i.e. "4.1.2 to 5.1.99.99". +# Returns true if inside the range. +# +mysql_check_version_range() { + local lbound="${1%% to *}" ; lbound=$(stripdots "${lbound}") + local rbound="${1#* to }" ; rbound=$(stripdots "${rbound}") + local my_ver="${2:-"${MYSQL_VERSION_ID}"}" + [[ ${lbound} -le ${my_ver} ]] && [[ ${my_ver} -le ${rbound} ]] && return 0 + return 1 +} + +# +# True if at least one applicable range is found for the patch. +# +_mysql_test_patch_ver_pn() { + local allelements=", version, package name" + # So that it fails the directory test if none of them exist + local filesdir="/dev/null" + for d in "${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}" \ + "${WORKDIR}/mysql-extras" ; do + if [ -d "${d}" ]; then + filesdir="${d}" + break + fi + done + + [[ -d "${filesdir}" ]] || die "Source dir must be a directory" + local flags=$1 pname=$2 + if [[ $(( $flags & $(( 1 + 4 + 16 )) )) -eq 21 ]] ; then + einfo "using '${pname}'" + ln -sf "${filesdir}/${pname}" "${EPATCH_SOURCE}" || die "Couldn't move ${pname}" + return 0 + fi + + [[ $(( $flags & $(( 2 + 4 )) )) -gt 0 ]] \ + && allelements="${allelements//", version"}" + + [[ $(( $flags & $(( 8 + 16 )) )) -gt 0 ]] \ + && allelements="${allelements//", package name"}" + + [[ -n "${allelements}" ]] && [[ "${flags}" -gt 0 ]] \ + && ewarn "QA notice: ${allelements} missing in ${pname} patch" + + return 1 +} + +# +# Parse a "index_file" looking for patches to apply to the +# current MySQL version. +# If the patch applies, print its description. +# +mysql_mv_patches() { + # So that it fails the directory test if none of them exist + local filesdir="/dev/null" + if [[ -z "${1}" ]]; then + for d in "${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}" \ + "${WORKDIR}/mysql-extras" ; do + if [ -d "${d}" ]; then + filesdir="${d}" + break + fi + done + [[ -d "${filesdir}" ]] || die "No patches directory found!" + fi + + for i in "$1" "${filesdir}/0000_index.txt" "${filesdir}/000_index.txt" ; do + if [ -n "$i" -a -f "$i" ]; then + local index_file="$i" + break + fi + done + + local my_ver="${2:-"${MYSQL_VERSION_ID}"}" + local my_test_fx=${3:-"_mysql_test_patch_ver_pn"} + _mysql_mv_patches "${index_file}" "${my_ver}" "${my_test_fx}" +} + +_mysql_mv_patches() { + local index_file="${1}" + local my_ver="${2}" + local my_test_fx="${3}" + local dsc ndsc=0 i + dsc=( ) + + # Values for flags are (2^x): + # 1 - one patch found + # 2 - at least one version range is wrong + # 4 - at least one version range is ok + # 8 - at least one ${PN} did not match + # 16 - at least one ${PN} has been matched + local flags=0 pname="" + while read row ; do + case "${row}" in + @patch\ *) + [[ -n "${pname}" ]] \ + && ${my_test_fx} ${flags} "${pname}" \ + && for (( i=0 ; $i < $ndsc ; i++ )) ; do einfo "> ${dsc[$i]}" ; done + flags=1 ; ndsc=0 ; dsc=( ) + pname=${row#"@patch "} + ;; + @ver\ *) + if mysql_check_version_range "${row#"@ver "}" "${my_ver}" ; then + flags=$(( ${flags} | 4 )) + else + flags=$(( ${flags} | 2 )) + fi + ;; + @pn\ *) + if [[ ${row#"@pn "} == "${PN}" ]] ; then + flags=$(( ${flags} | 16 )) + else + flags=$(( ${flags} | 8 )) + fi + ;; + # @use\ *) ;; + @@\ *) + dsc[$ndsc]="${row#"@@ "}" + (( ++ndsc )) + ;; + esac + done < "${index_file}" + + ${my_test_fx} ${flags} "${pname}" \ + && for (( i=0 ; $i < $ndsc ; i++ )) ; do einfo "> ${dsc[$i]}" ; done +} + +# +# Is $2 (defaults to $MYSQL_VERSION_ID) at least version $1? +# (nice) idea from versionator.eclass +# +mysql_version_is_at_least() { + local want_s=$(stripdots "$1") have_s=$(stripdots "${2:-${MYSQL_VERSION_ID}}") + [[ -z "${want_s}" ]] && die "mysql_version_is_at_least missing value to check" + [[ ${want_s} -le ${have_s} ]] && return 0 || return 1 +} + +# +# To be called on the live filesystem, reassigning symlinks of each MySQL +# library to the best version available. +# +mysql_lib_symlinks() { + einfo "Updating MySQL .so symlinks" + local d dirlist maxdots soname sonameln reldir + reldir="${1}" + pushd "${reldir}/usr/$(get_libdir)" &> /dev/null + # dirlist must contain the less significative directory left + dirlist="mysql" + + # waste some time in removing and recreating symlinks + for d in $dirlist ; do + for soname in $( find "${d}" -name "*.so*" -and -not -type "l" 2>/dev/null ) ; do + # maxdot is a limit versus infinite loop + maxdots=0 + sonameln=${soname##*/} + # loop in version of the library to link it, similar to how + # libtool works + while [[ ${sonameln:0-3} != '.so' ]] && [[ ${maxdots} -lt 6 ]] ; do + rm -f "${sonameln}" + ln -s "${soname}" "${sonameln}" + (( ++maxdots )) + sonameln="${sonameln%.*}" + done + rm -f "${sonameln}" + ln -s "${soname}" "${sonameln}" + done + done + popd &> /dev/null +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/mythtv-plugins.eclass b/sdk_container/src/third_party/portage-stable/eclass/mythtv-plugins.eclass new file mode 100644 index 0000000000..140a316338 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/mythtv-plugins.eclass @@ -0,0 +1,123 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/mythtv-plugins.eclass,v 1.36 2009/11/02 01:59:17 cardoe Exp $ +# +# @ECLASS: mythtv-plugins.eclass +# @AUTHOR: Doug Goldstein +# @MAINTAINER: Doug Goldstein +# @BLURB: Installs MythTV plugins along with patches from the release-${PV}-fixes branch +# + +# NOTE: YOU MUST INHERIT EITHER qt3 or qt4 IN YOUR PLUGIN! + +inherit mythtv multilib versionator + +# Extra configure options to pass to econf +MTVCONF=${MTVCONF:=""} + +SLOT="0" +IUSE="${IUSE} debug mmx" + +if [[ -z $MYTHTV_NODEPS ]] ; then +RDEPEND="${RDEPEND} + =media-tv/mythtv-${MY_PV}*" +DEPEND="${DEPEND} + =media-tv/mythtv-${MY_PV}* + >=sys-apps/sed-4" +fi + +# bug 240325 +RESTRICT="strip" + +mythtv-plugins_pkg_setup() { + # List of available plugins (needs to include ALL of them in the tarball) + MYTHPLUGINS="mythbrowser mythcontrols mythdvd mythflix mythgallery" + MYTHPLUGINS="${MYTHPLUGINS} mythgame mythmusic mythnews mythphone" + MYTHPLUGINS="${MYTHPLUGINS} mythvideo mythweather mythweb" + + if version_is_at_least "0.20" ; then + MYTHPLUGINS="${MYTHPLUGINS} mytharchive" + fi + + if version_is_at_least "0.21_beta" ; then + MYTHPLUGINS="${MYTHPLUGINS} mythzoneminder mythmovies" + MYTHPLUGINS="${MYTHPLUGINS/mythdvd/}" + fi + + if version_is_at_least "0.22_beta" ; then + MYTHPLUGINS="${MYTHPLUGINS/mythcontrols/}" + MYTHPLUGINS="${MYTHPLUGINS/mythphone/}" + fi +} + +mythtv-plugins_src_prepare() { + sed -e 's!PREFIX = /usr/local!PREFIX = /usr!' \ + -i 'settings.pro' || die "fixing PREFIX to /usr failed" + + sed -e "s!QMAKE_CXXFLAGS_RELEASE = -O3 -march=pentiumpro -fomit-frame-pointer!QMAKE_CXXFLAGS_RELEASE = ${CXXFLAGS}!" \ + -i 'settings.pro' || die "Fixing QMake's CXXFLAGS failed" + + sed -e "s!QMAKE_CFLAGS_RELEASE = \$\${QMAKE_CXXFLAGS_RELEASE}!QMAKE_CFLAGS_RELEASE = ${CFLAGS}!" \ + -i 'settings.pro' || die "Fixing Qmake's CFLAGS failed" + + find "${S}" -name '*.pro' -exec sed -i \ + -e "s:\$\${PREFIX}/lib/:\$\${PREFIX}/$(get_libdir)/:g" \ + -e "s:\$\${PREFIX}/lib$:\$\${PREFIX}/$(get_libdir):g" \ + {} \; +} + +mythtv-plugins_src_configure() { + cd "${S}" + + if use debug; then + sed -e 's!CONFIG += release!CONFIG += debug!' \ + -i 'settings.pro' || die "switching to debug build failed" + fi + +# if ( use x86 && ! use mmx ) || ! use amd64 ; then + if ( ! use mmx ); then + sed -e 's!DEFINES += HAVE_MMX!DEFINES -= HAVE_MMX!' \ + -i 'settings.pro' || die "disabling MMX failed" + fi + + local myconf="" + + if hasq ${PN} ${MYTHPLUGINS} ; then + for x in ${MYTHPLUGINS} ; do + if [[ ${PN} == ${x} ]] ; then + myconf="${myconf} --enable-${x}" + else + myconf="${myconf} --disable-${x}" + fi + done + else + die "Package ${PN} is unsupported" + fi + + chmod +x configure + econf ${myconf} ${MTVCONF} +} + +mythtv-plugins_src_compile() { + if version_is_at_least "0.22" ; then + eqmake4 mythplugins.pro || die "eqmake4 failed" + else + eqmake3 mythplugins.pro || die "eqmake3 failed" + fi + emake || die "make failed to compile" +} + +mythtv-plugins_src_install() { + if hasq ${PN} ${MYTHPLUGINS} ; then + cd "${S}"/${PN} + else + die "Package ${PN} is unsupported" + fi + + einstall INSTALL_ROOT="${D}" + for doc in AUTHORS COPYING FAQ UPGRADING ChangeLog README; do + test -e "${doc}" && dodoc ${doc} + done +} + +EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_compile src_install diff --git a/sdk_container/src/third_party/portage-stable/eclass/mythtv.eclass b/sdk_container/src/third_party/portage-stable/eclass/mythtv.eclass new file mode 100644 index 0000000000..6ecec1c14f --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/mythtv.eclass @@ -0,0 +1,47 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/mythtv.eclass,v 1.20 2009/11/16 07:59:47 cardoe Exp $ +# +# @ECLASS: mythtv.eclass +# @AUTHOR: Doug Goldstein +# @MAINTAINER: Doug Goldstein +# @BLURB: Downloads the MythTV source packages and any patches from the fixes branch +# + +inherit versionator + +# temporary until all the packagers are fixed for bug #283798 +DEPEND="app-arch/unzip" + +# Release version +MY_PV="${PV%_*}" + +# what product do we want +case "${PN}" in + mythtv) MY_PN="mythtv";; + mythtv-themes) MY_PN="myththemes";; + mythtv-themes-extra) MY_PN="themes";; + *) MY_PN="mythplugins";; +esac + +# _pre is from SVN trunk while _p and _beta are from SVN ${MY_PV}-fixes +# TODO: probably ought to do something smart if the regex doesn't match anything +[[ "${PV}" =~ (_alpha|_beta|_pre|_rc|_p)([0-9]+) ]] || { + eerror "Invalid version requested (_alpha|_beta|_pre|_rc|_p) only" + exit 1 +} + +REV_PREFIX="${BASH_REMATCH[1]}" # _alpha, _beta, _pre, _rc, or _p +MYTHTV_REV="${BASH_REMATCH[2]}" # revision number + +case $REV_PREFIX in + _pre|_alpha) MYTHTV_REPO="trunk";; + _p|_beta|_rc) VER_COMP=( $(get_version_components ${MY_PV}) ) + FIXES_VER="${VER_COMP[0]}-${VER_COMP[1]}" + MYTHTV_REPO="branches/release-${FIXES_VER}-fixes";; +esac + +HOMEPAGE="http://www.mythtv.org" +LICENSE="GPL-2" +SRC_URI="http://svn.mythtv.org/trac/changeset/${MYTHTV_REV}/${MYTHTV_REPO}/${MY_PN}?old_path=%2F&format=zip -> ${MY_PN}-${PV}.zip" +S="${WORKDIR}/${MYTHTV_REPO}/${MY_PN}" diff --git a/sdk_container/src/third_party/portage-stable/eclass/nsplugins.eclass b/sdk_container/src/third_party/portage-stable/eclass/nsplugins.eclass new file mode 100644 index 0000000000..fc95ed3f89 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/nsplugins.eclass @@ -0,0 +1,47 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/nsplugins.eclass,v 1.24 2009/05/01 23:03:00 nirbheek Exp $ +# +# Author: Martin Schlemmer +# +# Just some re-usable functions for the netscape/moz plugins sharing + +inherit eutils + +DESCRIPTION="Based on the ${ECLASS} eclass" + +PLUGINS_DIR="nsbrowser/plugins" + +# This function move the plugin dir in src_install() to +# ${D}/usr/$(get_libdir)/${PLUGIN_DIR}. First argument should be +# the full path (without $D) to old plugin dir. +src_mv_plugins() { + + # Move plugins dir. We use keepdir so that it might not be unmerged + # by mistake ... + keepdir /usr/$(get_libdir)/${PLUGINS_DIR} + cp -a "${D}"/$1/* "${D}"/usr/$(get_libdir)/${PLUGINS_DIR} + rm -rf "${D}"/$1 + dosym /usr/$(get_libdir)/${PLUGINS_DIR} $1 +} + +# This function move plugins in pkg_preinst() in old dir to +# ${ROOT}/usr/$(get_libdir)/${PLUGIN_DIR}. First argument should be +# the full path (without $ROOT) to old plugin dir. +pkg_mv_plugins() { + + # Move old plugins dir + if [ -d "${ROOT}/$1" -a ! -L "${ROOT}/$1" ] + then + mkdir -p "${ROOT}"/usr/$(get_libdir)/${PLUGINS_DIR} + cp -a "${ROOT}"/$1/* "${ROOT}"/usr/$(get_libdir)/${PLUGINS_DIR} + rm -rf "${ROOT}"/$1 + fi +} + +# This function installs a plugin with dosym to PLUGINS_DIR. +# First argument should be the plugin file. +inst_plugin() { + dodir /usr/$(get_libdir)/${PLUGINS_DIR} + dosym ${1} /usr/$(get_libdir)/${PLUGINS_DIR} +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/nvidia-driver.eclass b/sdk_container/src/third_party/portage-stable/eclass/nvidia-driver.eclass new file mode 100644 index 0000000000..b2d6444152 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/nvidia-driver.eclass @@ -0,0 +1,113 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/nvidia-driver.eclass,v 1.14 2008/07/17 12:20:49 chainsaw Exp $ + +# @ECLASS: nvidia-driver.eclass +# @MAINTAINER: +# +# Original Author: Doug Goldstein +# @BLURB: Provide useful messages for nvidia-drivers based on currently installed Nvidia card +# @DESCRIPTION: +# Provide useful messages for nvidia-drivers based on currently installed Nvidia +# card. It inherits versionator + +inherit versionator + +DEPEND="sys-apps/pciutils" + +# the data below is derived from +# http://us.download.nvidia.com/XFree86/Linux-x86_64/177.13/README/appendix-a.html + +drv_96xx="0110 0111 0112 0113 0170 0171 0172 0173 0174 0175 0176 0177 0178 \ +0179 017a 017c 017d 0181 0182 0183 0185 0188 018a 018b 018c 01a0 01f0 0200 \ +0201 0202 0203 0250 0251 0253 0258 0259 025b 0280 0281 0282 0286 0288 0289 \ +028c" + +drv_71xx="0020 0028 0029 002c 002d 00a0 0100 0101 0103 0150 0151 0152 0153" + +drv_173x="00fa 00fb 00fc 00fd 00fe 0301 0302 0308 0309 0311 0312 0314 031a \ +031b 031c 0320 0321 0322 0323 0324 0325 0326 0327 0328 032a 032b 032c 032d \ +0330 0331 0332 0333 0334 0338 033f 0341 0342 0343 0344 0347 0348 034c 034e" + +mask_96xx=">=x11-drivers/nvidia-drivers-97.0.0" +mask_71xx=">=x11-drivers/nvidia-drivers-72.0.0" +mask_173x=">=x11-drivers/nvidia-drivers-177.0.0" + +# @FUNCTION: nvidia-driver-get-card +# @DESCRIPTION: +# Retrieve the PCI device ID for each Nvidia video card you have +nvidia-driver-get-card() { + local NVIDIA_CARD="$(/usr/sbin/lspci -d 10de: -n | \ + awk '/ 0300: /{print $3}' | cut -d: -f2 | tr '\n' ' ')" + + if [ -n "$NVIDIA_CARD" ]; then + echo "$NVIDIA_CARD"; + else + echo "0000"; + fi +} + +nvidia-driver-get-mask() { + local NVIDIA_CARDS="$(nvidia-driver-get-card)" + for card in $NVIDIA_CARDS; do + for drv in $drv_96xx; do + if [ "x$card" = "x$drv" ]; then + echo "$mask_96xx"; + return 0; + fi + done + + for drv in $drv_71xx; do + if [ "x$card" = "x$drv" ]; then + echo "$mask_71xx"; + return 0; + fi + done + + for drv in $drv_173x; do + if [ "x$card" = "x$drv" ]; then + echo "$mask_173x"; + return 0; + fi + done + done + + echo ""; + return 1; +} + +# @FUNCTION: nvidia-driver-check-warning +# @DESCRIPTION: +# Prints out a warning if the driver does not work w/ the installed video card +nvidia-driver-check-warning() { + local NVIDIA_MASK="$(nvidia-driver-get-mask)" + if [ -n "$NVIDIA_MASK" ]; then + version_compare "${NVIDIA_MASK##*-}" "${PV}" + r=$? + + if [ "x$r" = "x1" ]; then + ewarn "***** WARNING *****" + ewarn + ewarn "You are currently installing a version of nvidia-drivers that is" + ewarn "known not to work with a video card you have installed on your" + ewarn "system. If this is intentional, please ignore this. If it is not" + ewarn "please perform the following steps:" + ewarn + ewarn "Add the following mask entry to /etc/portage/package.mask by" + if [ -d "${ROOT}/etc/portage/package.mask" ]; then + ewarn "echo \"$NVIDIA_MASK\" > /etc/portage/package.mask/nvidia-drivers" + else + ewarn "echo \"$NVIDIA_MASK\" >> /etc/portage/package.mask" + fi + ewarn + ewarn "Failure to perform the steps above could result in a non-working" + ewarn "X setup." + ewarn + ewarn "For more information please read:" + ewarn "http://www.nvidia.com/object/IO_32667.html" + ebeep 5 + fi + fi +} + + diff --git a/sdk_container/src/third_party/portage-stable/eclass/pam.eclass b/sdk_container/src/third_party/portage-stable/eclass/pam.eclass new file mode 100644 index 0000000000..df5f830e0a --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/pam.eclass @@ -0,0 +1,242 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License, v2 or later +# Author Diego Pettenò +# $Header: /var/cvsroot/gentoo-x86/eclass/pam.eclass,v 1.22 2011/12/27 17:55:12 fauli Exp $ +# +# This eclass contains functions to install pamd configuration files and +# pam modules. + +if [[ ${___ECLASS_ONCE_PAM} != "recur -_+^+_- spank" ]] ; then +___ECLASS_ONCE_PAM="recur -_+^+_- spank" + +inherit multilib flag-o-matic + +# dopamd [more files] +# +# Install pam auth config file in /etc/pam.d +dopamd() { + [[ -z $1 ]] && die "dopamd requires at least one argument" + + if has pam ${IUSE} && ! use pam; then + return 0; + fi + + ( # dont want to pollute calling env + insinto /etc/pam.d + insopts -m 0644 + doins "$@" + ) || die "failed to install $@" + cleanpamd "$@" +} + +# newpamd +# +# Install pam file as in /etc/pam.d +newpamd() { + [[ $# -ne 2 ]] && die "newpamd requires two arguments" + + if has pam ${IUSE} && ! use pam; then + return 0; + fi + + ( # dont want to pollute calling env + insinto /etc/pam.d + insopts -m 0644 + newins "$1" "$2" + ) || die "failed to install $1 as $2" + cleanpamd $2 +} + +# dopamsecurity
[more files] +# +# Installs the config files in /etc/security/
/ +dopamsecurity() { + [[ $# -lt 2 ]] && die "dopamsecurity requires at least two arguments" + + if has pam ${IUSE} && ! use pam; then + return 0 + fi + + ( # dont want to pollute calling env + insinto /etc/security/$1 + insopts -m 0644 + doins "${@:2}" + ) || die "failed to install ${@:2}" +} + +# newpamsecurity
+# +# Installs the config file as in /etc/security/
/ +newpamsecurity() { + [[ $# -ne 3 ]] && die "newpamsecurity requires three arguments" + + if has pam ${IUSE} && ! use pam; then + return 0; + fi + + ( # dont want to pollute calling env + insinto /etc/security/$1 + insopts -m 0644 + newins "$2" "$3" + ) || die "failed to install $2 as $3" +} + +# getpam_mod_dir +# +# Returns the pam modules' directory for current implementation +getpam_mod_dir() { + if has_version sys-libs/pam || has_version sys-libs/openpam; then + PAM_MOD_DIR=/$(get_libdir)/security + else + # Unable to find PAM implementation... defaulting + PAM_MOD_DIR=/$(get_libdir)/security + fi + + echo ${PAM_MOD_DIR} +} + +# pammod_hide_symbols +# +# Hide all non-PAM-used symbols from the module; this function creates a +# simple ld version script that hides all the symbols that are not +# necessary for PAM to load the module, then uses append-flags to make +# sure that it gets used. +pammod_hide_symbols() { + cat - > "${T}"/pam-eclass-pam_symbols.ver < [more files] +# +# Install pam module file in the pam modules' dir for current implementation +dopammod() { + [[ -z $1 ]] && die "dopammod requires at least one argument" + + if has pam ${IUSE} && ! use pam; then + return 0; + fi + + exeinto $(getpam_mod_dir) + doexe "$@" || die "failed to install $@" +} + +# newpammod +# +# Install pam module file as in the pam +# modules' dir for current implementation +newpammod() { + [[ $# -ne 2 ]] && die "newpammod requires two arguements" + + if has pam ${IUSE} && ! use pam; then + return 0; + fi + + exeinto $(getpam_mod_dir) + newexe "$1" "$2" || die "failed to install $1 as $2" +} + +# pamd_mimic_system [auth levels] +# +# This function creates a pamd file which mimics system-auth file +# for the given levels in the /etc/pam.d directory. +pamd_mimic_system() { + [[ $# -lt 2 ]] && die "pamd_mimic_system requires at least two argments" + pamd_mimic system-auth "$@" +} + +# pamd_mimic [auth levels] +# +# This function creates a pamd file which mimics the given stack +# for the given levels in the /etc/pam.d directory. +pamd_mimic() { + [[ $# -lt 3 ]] && die "pamd_mimic requires at least three argments" + + if has pam ${IUSE} && ! use pam; then + return 0; + fi + + dodir /etc/pam.d + pamdfile=${D}/etc/pam.d/$2 + echo -e "# File autogenerated by pamd_mimic in pam eclass\n\n" >> \ + $pamdfile + + originalstack=$1 + authlevels="auth account password session" + + if has_version '> ${pamdfile} + + shift + done +} + +# cleanpamd +# +# Cleans a pam.d file from modules that might not be present on the system +# where it's going to be installed +cleanpamd() { + while [[ -n $1 ]]; do + if ! has_version sys-libs/pam; then + sed -i -e '/pam_shells\|pam_console/s:^:#:' "${D}/etc/pam.d/$1" + fi + + shift + done +} + +pam_epam_expand() { + sed -n -e 's|#%EPAM-\([[:alpha:]-]\+\):\([-+<>=/.![:alnum:]]\+\)%#.*|\1 \2|p' \ + "$@" | sort -u | while read condition parameter; do + + disable="yes" + + case "$condition" in + If-Has) + message="This can be used only if you have ${parameter} installed" + has_version "$parameter" && disable="no" + ;; + Use-Flag) + message="This can be used only if you enabled the ${parameter} USE flag" + use "$parameter" && disable="no" + ;; + *) + eerror "Unknown EPAM condition '${condition}' ('${parameter}')" + die "Unknown EPAM condition '${condition}' ('${parameter}')" + ;; + esac + + if [ "${disable}" = "yes" ]; then + sed -i -e "/#%EPAM-${condition}:${parameter/\//\\/}%#/d" "$@" + else + sed -i -e "s|#%EPAM-${condition}:${parameter}%#||" "$@" + fi + + done +} + +# Think about it before uncommenting this one, for now run it by hand +# pam_pkg_preinst() { +# eshopts_push -o noglob # so that bash doen't expand "*" +# +# pam_epam_expand "${D}"/etc/pam.d/* +# +# eshopts_pop # reset old shell opts +# } + +fi diff --git a/sdk_container/src/third_party/portage-stable/eclass/pax-utils.eclass b/sdk_container/src/third_party/portage-stable/eclass/pax-utils.eclass new file mode 100644 index 0000000000..0dafc4ab88 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/pax-utils.eclass @@ -0,0 +1,155 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/pax-utils.eclass,v 1.17 2011/12/17 04:23:53 vapier Exp $ + +# @ECLASS: pax-utils.eclass +# @MAINTAINER: +# The Gentoo Linux Hardened Team +# @AUTHOR: +# Original Author: Kevin F. Quinn +# Modifications for bug #365825, @ ECLASS markup: Anthony G. Basile +# @BLURB: functions to provide pax markings +# @DESCRIPTION: +# This eclass provides support for manipulating PaX markings on ELF binaries, +# wrapping the use of the paxctl and scanelf utilities. It decides which to +# use depending on what is installed on the build host, preferring paxctl to +# scanelf. If paxctl is not installed, we fall back to scanelf since it is +# always present. However, currently scanelf doesn't do all that paxctl can. +# +# To control what markings are made, set PAX_MARKINGS in /etc/make.conf to +# contain either "PT" or "none". If PAX_MARKINGS is set to "PT", and the +# necessary utility is installed, the PT_PAX_FLAGS markings will be made. If +# PAX_MARKINGS is set to "none", no markings will be made. + +if [[ ${___ECLASS_ONCE_PAX_UTILS} != "recur -_+^+_- spank" ]] ; then +___ECLASS_ONCE_PAX_UTILS="recur -_+^+_- spank" + +# Default to PT markings. +PAX_MARKINGS=${PAX_MARKINGS:="PT"} + +# @FUNCTION: pax-mark +# @USAGE: {} +# @RETURN: Shell true if we succeed, shell false otherwise +# @DESCRIPTION: +# Marks with provided PaX +# +# Flags are passed directly to the utilities unchanged. Possible flags at the +# time of writing, taken from /sbin/paxctl, are: +# +# p: disable PAGEEXEC P: enable PAGEEXEC +# e: disable EMUTRMAP E: enable EMUTRMAP +# m: disable MPROTECT M: enable MPROTECT +# r: disable RANDMMAP R: enable RANDMMAP +# s: disable SEGMEXEC S: enable SEGMEXEC +# +# Default flags are 'PeMRS', which are the most restrictive settings. Refer +# to http://pax.grsecurity.net/ for details on what these flags are all about. +# Do not use the obsolete flag 'x'/'X' which has been deprecated. +# +# Please confirm any relaxation of restrictions with the Gentoo Hardened team. +# Either ask on the gentoo-hardened mailing list, or CC/assign hardened@g.o on +# the bug report. +pax-mark() { + local f flags fail=0 failures="" zero_load_alignment + # Ignore '-' characters - in particular so that it doesn't matter if + # the caller prefixes with - + flags=${1//-} + shift + # Try paxctl, then scanelf. paxctl is preferred. + if type -p paxctl > /dev/null && has PT ${PAX_MARKINGS}; then + # Try paxctl, the upstream supported tool. + elog "PT PaX marking -${flags}" + _pax_list_files elog "$@" + for f in "$@"; do + # First, try modifying the existing PAX_FLAGS header + paxctl -q${flags} "${f}" && continue + # Second, try stealing the (unused under PaX) PT_GNU_STACK header + paxctl -qc${flags} "${f}" && continue + # Third, try pulling the base down a page, to create space and + # insert a PT_GNU_STACK header (works on ET_EXEC) + paxctl -qC${flags} "${f}" && continue + # + # prelink is masked on hardened so we wont use this method. + # We're working on a new utiity to try to do the same safely. See + # http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=summary + # + # Fourth - check if it loads to 0 (probably an ET_DYN) and if so, + # try rebasing with prelink first to give paxctl some space to + # grow downwards into. + #if type -p objdump > /dev/null && type -p prelink > /dev/null; then + # zero_load_alignment=$(objdump -p "${f}" | \ + # grep -E '^[[:space:]]*LOAD[[:space:]]*off[[:space:]]*0x0+[[:space:]]' | \ + # sed -e 's/.*align\(.*\)/\1/') + # if [[ ${zero_load_alignment} != "" ]]; then + # prelink -r $(( 2*(${zero_load_alignment}) )) && + # paxctl -qC${flags} "${f}" && continue + # fi + #fi + fail=1 + failures="${failures} ${f}" + done + elif type -p scanelf > /dev/null && [[ ${PAX_MARKINGS} != "none" ]]; then + # Try scanelf, the Gentoo swiss-army knife ELF utility + # Currently this sets PT if it can, no option to control what it does. + elog "Fallback PaX marking -${flags}" + _pax_list_files elog "$@" + scanelf -Xxz ${flags} "$@" + elif [[ ${PAX_MARKINGS} != "none" ]]; then + # Out of options! + failures="$*" + fail=1 + fi + if [[ ${fail} == 1 ]]; then + ewarn "Failed to set PaX markings -${flags} for:" + _pax_list_files ewarn ${failures} + ewarn "Executables may be killed by PaX kernels." + fi + return ${fail} +} + +# @FUNCTION: list-paxables +# @USAGE: {} +# @RETURN: Subset of {} which are ELF executables or shared objects +# @DESCRIPTION: +# Print to stdout all of the that are suitable to have PaX flag +# markings, i.e., filter out the ELF executables or shared objects from a list +# of files. This is useful for passing wild-card lists to pax-mark, although +# in general it is preferable for ebuilds to list precisely which ELFS are to +# be marked. Often not all the ELF installed by a package need remarking. +# @EXAMPLE: +# pax-mark -m $(list-paxables ${S}/{,usr/}bin/*) +list-paxables() { + file "$@" 2> /dev/null | grep -E 'ELF.*(executable|shared object)' | sed -e 's/: .*$//' +} + +# @FUNCTION: host-is-pax +# @RETURN: Shell true if the build process is PaX enabled, shell false otherwise +# @DESCRIPTION: +# This is intended for use where the build process must be modified conditionally +# depending on whether the host is PaX enabled or not. It is not intedened to +# determine whether the final binaries need PaX markings. Note: if procfs is +# not mounted on /proc, this returns shell false (e.g. Gentoo/FBSD). +host-is-pax() { + grep -qs ^PaX: /proc/self/status +} + + +# INTERNAL FUNCTIONS +# ------------------ +# +# These functions are for use internally by the eclass - do not use +# them elsewhere as they are not supported (i.e. they may be removed +# or their function may change arbitratily). + +# Display a list of things, one per line, indented a bit, using the +# display command in $1. +_pax_list_files() { + local f cmd + cmd=$1 + shift + for f in "$@"; do + ${cmd} " ${f}" + done +} + +fi diff --git a/sdk_container/src/third_party/portage-stable/eclass/pcmcia.eclass b/sdk_container/src/third_party/portage-stable/eclass/pcmcia.eclass new file mode 100644 index 0000000000..40e8f42d70 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/pcmcia.eclass @@ -0,0 +1,7 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/pcmcia.eclass,v 1.12 2009/11/30 04:19:36 abcd Exp $ + +# @DEAD +# To be removed on 2011/11/30. +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" diff --git a/sdk_container/src/third_party/portage-stable/eclass/perl-app.eclass b/sdk_container/src/third_party/portage-stable/eclass/perl-app.eclass new file mode 100644 index 0000000000..a2cfbdb096 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/perl-app.eclass @@ -0,0 +1,26 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/perl-app.eclass,v 1.11 2009/03/06 11:44:18 tove Exp $ + +# Author: Michael Cummings +# Maintained by the Perl herd + +inherit perl-module + +case "${EAPI:-0}" in + 0|1) EXPORT_FUNCTIONS src_compile ;; + 2) EXPORT_FUNCTIONS src_configure src_compile ;; +esac + +perl-app_src_prep() { + perl-app_src_configure +} + +perl-app_src_configure() { + perl-module_src_configure +} + +perl-app_src_compile() { + has "${EAPI:-0}" 0 1 && perl-app_src_prep + perl-module_src_compile +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/php-common-r1.eclass b/sdk_container/src/third_party/portage-stable/eclass/php-common-r1.eclass new file mode 100644 index 0000000000..1fd6da2c8d --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/php-common-r1.eclass @@ -0,0 +1,296 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/php-common-r1.eclass,v 1.17 2010/01/22 13:23:44 scarabeus Exp $ + +# Based on robbat2's work on the php4 sapi eclass +# Based on stuart's work on the php5 sapi eclass + +# @ECLASS: php-common-r1.eclass +# @MAINTAINER: +# Gentoo PHP team +# @BLURB: Common functions which are shared between the PHP4 and PHP5 packages. +# @DESCRIPTION: +# This eclass provides common functions which are shared between the PHP4 and PHP5 packages. +# It is only used by php*-sapi eclasses currently and the functions are not intended +# for direct use in ebuilds. + + +# ======================================================================== +# CFLAG SANITY +# ======================================================================== + +php_check_cflags() { + # Fixes bug #14067. + # Changed order to run it in reverse for bug #32022 and #12021. + replace-cpu-flags "k6*" "i586" +} + +# ======================================================================== +# IMAP SUPPORT +# ======================================================================== + +php_check_imap() { + if ! use "imap" && ! phpconfutils_usecheck "imap" ; then + return + fi + + if use "ssl" || phpconfutils_usecheck "ssl" ; then + if ! built_with_use virtual/imap-c-client ssl ; then + eerror + eerror "IMAP with SSL requested, but your IMAP C-Client libraries are built without SSL!" + eerror + die "Please recompile the IMAP C-Client libraries with SSL support enabled" + fi + else + if built_with_use virtual/imap-c-client ssl ; then + eerror + eerror "IMAP without SSL requested, but your IMAP C-Client libraries are built with SSL!" + eerror + die "Please recompile the IMAP C-Client libraries with SSL support disabled" + fi + fi + + if use "kolab" || phpconfutils_usecheck "kolab" ; then + if ! built_with_use net-libs/c-client kolab ; then + eerror + eerror "IMAP with annotations support requested, but net-libs/c-client is built without it!" + eerror + die "Please recompile net-libs/c-client with USE=kolab." + fi + fi +} + +# ======================================================================== +# JAVA EXTENSION SUPPORT +# +# The bundled java extension is unique to PHP4, but there is +# now the PHP-Java-Bridge that works under both PHP4 and PHP5. +# ======================================================================== + +php_check_java() { + if ! use "java-internal" && ! phpconfutils_usecheck "java-internal" ; then + return + fi + + JDKHOME="$(java-config --jdk-home)" + NOJDKERROR="You need to use the 'java-config' utility to set your JVM to a JDK!" + if [[ -z "${JDKHOME}" ]] || [[ ! -d "${JDKHOME}" ]] ; then + eerror "${NOJDKERROR}" + die "${NOJDKERROR}" + fi + + # stuart@gentoo.org - 2003/05/18 + # Kaffe JVM is not a drop-in replacement for the Sun JDK at this time + if echo ${JDKHOME} | grep kaffe > /dev/null 2>&1 ; then + eerror + eerror "PHP will not build using the Kaffe Java Virtual Machine." + eerror "Please change your JVM to either Blackdown or Sun's." + eerror + eerror "To build PHP without Java support, please re-run this emerge" + eerror "and place the line:" + eerror " USE='-java-internal'" + eerror "in front of your emerge command, for example:" + eerror " USE='-java-internal' emerge =dev-lang/php-4*" + eerror + eerror "or edit your USE flags in /etc/make.conf." + die "Kaffe JVM not supported" + fi + + JDKVER=$(java-config --java-version 2>&1 | awk '/^java version/ { print $3 }' | xargs ) + einfo "Active JDK version: ${JDKVER}" + case "${JDKVER}" in + 1.4.*) ;; + 1.5.*) ewarn "Java 1.5 is NOT supported at this time, and might not work." ;; + *) eerror "A Java 1.4 JDK is recommended for Java support in PHP." ; die ;; + esac +} + +php_install_java() { + if ! use "java-internal" && ! phpconfutils_usecheck "java-internal" ; then + return + fi + + # We put these into /usr/lib so that they cannot conflict with + # other versions of PHP (e.g. PHP 4 & PHP 5) + insinto "${PHPEXTDIR}" + + einfo "Installing PHP java extension" + doins "modules/java.so" + + einfo "Creating PHP java extension symlink" + dosym "${PHPEXTDIR}/java.so" "${PHPEXTDIR}/libphp_java.so" + + einfo "Installing JAR for PHP" + doins "ext/java/php_java.jar" + + einfo "Installing Java test page" + newins "ext/java/except.php" "java-test.php" +} + +php_install_java_inifile() { + if ! use "java-internal" && ! phpconfutils_usecheck "java-internal" ; then + return + fi + + JAVA_LIBRARY="$(grep -- '-DJAVALIB' Makefile | sed -e 's,.\+-DJAVALIB=\"\([^"]*\)\".*$,\1,g;' | sort -u)" + + echo "extension = java.so" >> "${D}/${PHP_EXT_INI_DIR}/java.ini" + echo "java.library = ${JAVA_LIBRARY}" >> "${D}/${PHP_EXT_INI_DIR}/java.ini" + echo "java.class.path = ${PHPEXTDIR}/php_java.jar" >> "${D}/${PHP_EXT_INI_DIR}/java.ini" + echo "java.library.path = ${PHPEXTDIR}" >> "${D}/${PHP_EXT_INI_DIR}/java.ini" + + dosym "${PHP_EXT_INI_DIR}/java.ini" "${PHP_EXT_INI_DIR_ACTIVE}/java.ini" +} + +# ======================================================================== +# MTA SUPPORT +# ======================================================================== + +php_check_mta() { + if ! [[ -x "${ROOT}/usr/sbin/sendmail" ]] ; then + ewarn + ewarn "You need a virtual/mta that provides a sendmail compatible binary!" + ewarn "All major MTAs provide this, and it's usually some symlink created" + ewarn "as '${ROOT}/usr/sbin/sendmail*'. You should also be able to use other" + ewarn "MTAs directly, but you'll have to edit the sendmail_path directive" + ewarn "in your php.ini for this to work." + ewarn + fi +} + +# ======================================================================== +# ORACLE SUPPORT +# ======================================================================== + +php_check_oracle_all() { + if use "oci8" && [[ -z "${ORACLE_HOME}" ]] ; then + eerror + eerror "You must have the ORACLE_HOME variable set in your environment to" + eerror "compile the Oracle extension." + eerror + die "Oracle configuration incorrect; user error" + fi + + if use "oci8" || use "oracle7" ; then + if has_version 'dev-db/oracle-instantclient-basic' ; then + ewarn + ewarn "Please ensure you have a full install of the Oracle client." + ewarn "'dev-db/oracle-instantclient-basic' is NOT sufficient." + ewarn "Please enable the 'oci8-instant-client' USE flag instead, if you" + ewarn "want to use 'dev-db/oracle-instantclient-basic' as Oracle client." + ewarn + fi + fi +} + +php_check_oracle_8() { + if use "oci8" && [[ -z "${ORACLE_HOME}" ]] ; then + eerror + eerror "You must have the ORACLE_HOME variable set in your environment to" + eerror "compile the Oracle extension." + eerror + die "Oracle configuration incorrect; user error" + fi + + if use "oci8" ; then + if has_version 'dev-db/oracle-instantclient-basic' ; then + ewarn + ewarn "Please ensure you have a full install of the Oracle client." + ewarn "'dev-db/oracle-instantclient-basic' is NOT sufficient." + ewarn "Please enable the 'oci8-instant-client' USE flag instead, if you" + ewarn "want to use 'dev-db/oracle-instantclient-basic' as Oracle client." + ewarn + fi + fi +} + +# ======================================================================== +# POSTGRESQL SUPPORT +# ======================================================================== + +php_check_pgsql() { + if use "postgres" && use "apache2" && use "threads" ; then + if has_version dev-db/libpq ; then + if has_version ">=dev-db/libpq-8" && \ + ! built_with_use ">=dev-db/libpq-8" "threads" ; then + eerror + eerror "You must build dev-db/libpq with USE=threads" + eerror "if you want to build PHP with threads support!" + eerror + die "Rebuild dev-db/libpq with USE=threads" + fi + else + local pgsql_ver=$(eselect postgresql show) + if [[ ${pgsql_ver} == "(none)" ]]; then + eerror "QA: Please select your PostgreSQL version \"eselect postgresql list\"" + die "Can't determine PgSQL." + fi + if ! built_with_use "=dev-db/postgresql-base-${pgsql_ver}*" threads ; then + eerror + eerror "You must build =dev-db/postgresql-base-${pgsql_ver} with USE=threads" + eerror "if you want to build PHP with threads support!" + eerror + die "Rebuild =dev-db/postgresql-base-${pgsql_ver} with USE=threads" + fi + fi + fi +} + +# ======================================================================== +# MYSQL CHARSET DETECTION SUPPORT ## Thanks to hoffie +# ======================================================================== + +php_get_mycnf_charset() { + # nothing todo if no mysql installed + if [[ ! -f "${ROOT}/etc/mysql/my.cnf" ]]; then + echo "empty" + return + fi + local sapi="${1}" + local section="" + local client_charset="" + local sapi_charset="" + + # remove comments and pipe the output to our while loop + while read line ; do + line=$(echo "${line}" | sed 's:[;#][^\n]*::g') + + # skip empty lines + if [[ "${line}" == "" ]] ; then + continue + fi + + # capture sections + tmp=$(echo "${line}" | sed 's:\[\([-a-z0-9\_]*\)\]:\1:') + if [[ "${line}" != "${tmp}" ]] ; then + section=${tmp} + else + # we don't need to check lines which are not in a section we are interested about + if [[ "${section}" != "client" && "${section}" != "php-${sapi}" ]] ; then + continue + fi + + # match default-character-set= lines + tmp=$(echo "${line}" | sed 's|^[[:space:]\ ]*default-character-set[[:space:]\ ]*=[[:space:]\ ]*\"\?\([a-z0-9\-]*\)\"\?|\1|') + if [[ "${line}" == "${tmp}" ]] ; then + # nothing changed, irrelevant line + continue + fi + if [[ "${section}" == "client" ]] ; then + client_charset="${tmp}" + else + if [[ "${section}" == "php-${sapi}" ]] ; then + sapi_charset="${tmp}" + fi + fi + fi + done < "${ROOT}/etc/mysql/my.cnf" + # if a sapi-specific section with a default-character-set= value was found we use it, otherwise we use the client charset (which may be empty) + if [[ -n "${sapi_charset}" ]] ; then + echo "${sapi_charset}" + elif [[ -n "${client_charset}" ]] ; then + echo "${client_charset}" + else + echo "empty" + fi +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/php-ext-base-r1.eclass b/sdk_container/src/third_party/portage-stable/eclass/php-ext-base-r1.eclass new file mode 100644 index 0000000000..db0a00874b --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/php-ext-base-r1.eclass @@ -0,0 +1,175 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/php-ext-base-r1.eclass,v 1.10 2009/12/30 01:05:42 hoffie Exp $ +# +# Author: Tal Peer +# Author: Stuart Herbert +# Author: Luca Longinotti +# Author: Jakub Moc (documentation) + +# @ECLASS: php-ext-base-r1.eclass +# @MAINTAINER: +# Gentoo PHP team +# @BLURB: A unified interface for adding standalone PHP extensions. +# @DESCRIPTION: +# This eclass provides a unified interface for adding standalone +# PHP extensions (modules) to the php.ini files on your system. +# +# Combined with php-ext-source-r1, we have a standardised solution for supporting +# PHP extensions. + +inherit depend.php + +EXPORT_FUNCTIONS src_install + +# @ECLASS-VARIABLE: PHP_EXT_NAME +# @DESCRIPTION: +# The extension name. This must be set, otherwise the eclass dies. +# Only automagically set by php-ext-pecl-r1.eclass, so unless your ebuild +# inherits that eclass, you must set this manually before inherit. +[[ -z "${PHP_EXT_NAME}" ]] && die "No module name specified for the php-ext-base-r1 eclass" + +# @ECLASS-VARIABLE: PHP_EXT_INI +# @DESCRIPTION: +# Controls whether or not to add a line to php.ini for the extension. +# Defaults to "yes" and should not be changed in most cases. +[[ -z "${PHP_EXT_INI}" ]] && PHP_EXT_INI="yes" + +# @ECLASS-VARIABLE: PHP_EXT_ZENDEXT +# @DESCRIPTION: +# Controls whether the extension is a ZendEngine extension or not. +# Defaults to "no" and if you don't know what is it, you don't need it. +[[ -z "${PHP_EXT_ZENDEXT}" ]] && PHP_EXT_ZENDEXT="no" + + +php-ext-base-r1_buildinilist() { + # Work out the list of .ini files to edit/add to + if [[ -z "${PHPSAPILIST}" ]] ; then + PHPSAPILIST="apache2 cli cgi" + fi + + PHPINIFILELIST="" + + for x in ${PHPSAPILIST} ; do + if [[ -f "/etc/php/${x}-php${PHP_VERSION}/php.ini" ]] ; then + PHPINIFILELIST="${PHPINIFILELIST} etc/php/${x}-php${PHP_VERSION}/ext/${PHP_EXT_NAME}.ini" + fi + done +} + +# @FUNCTION: php-ext-base-r1_src_install +# @DESCRIPTION: +# Takes care of standard install for PHP extensions (modules). +php-ext-base-r1_src_install() { + # Pull in the PHP settings + has_php + addpredict /usr/share/snmp/mibs/.index + + # Build the list of .ini files to edit/add to + php-ext-base-r1_buildinilist + + # Add the needed lines to the .ini files + if [[ "${PHP_EXT_INI}" = "yes" ]] ; then + php-ext-base-r1_addextension "${PHP_EXT_NAME}.so" + fi + + # Symlink the .ini files from ext/ to ext-active/ + for inifile in ${PHPINIFILELIST} ; do + inidir="${inifile/${PHP_EXT_NAME}.ini/}" + inidir="${inidir/ext/ext-active}" + dodir "/${inidir}" + dosym "/${inifile}" "/${inifile/ext/ext-active}" + done + + # Add support for installing PHP files into a version dependant directory + PHP_EXT_SHARED_DIR="/usr/share/${PHP_SHARED_CAT}/${PHP_EXT_NAME}" +} + +php-ext-base-r1_addextension() { + if [[ "${PHP_EXT_ZENDEXT}" = "yes" ]] ; then + # We need the full path for ZendEngine extensions + # and we need to check for debugging enabled! + if has_zts ; then + if has_debug ; then + ext_type="zend_extension_debug_ts" + else + ext_type="zend_extension_ts" + fi + ext_file="${EXT_DIR}/$1" + else + if has_debug ; then + ext_type="zend_extension_debug" + else + ext_type="zend_extension" + fi + ext_file="${EXT_DIR}/$1" + fi + + # php-5.3 unifies zend_extension loading and just requires the + # zend_extension keyword with no suffix + # TODO: drop previous code and this check once =dev-lang/php-5.3' ; then + ext_type="zend_extension" + fi + else + # We don't need the full path for normal extensions! + ext_type="extension" + ext_file="$1" + fi + + php-ext-base-r1_addtoinifiles "${ext_type}" "${ext_file}" "Extension added" +} + +# $1 - Setting name +# $2 - Setting value +# $3 - File to add to +# $4 - Sanitized text to output +php-ext-base-r1_addtoinifile() { + if [[ ! -d $(dirname $3) ]] ; then + mkdir -p $(dirname $3) + fi + + # Are we adding the name of a section? + if [[ ${1:0:1} == "[" ]] ; then + echo "$1" >> "$3" + my_added="$1" + else + echo "$1=$2" >> "$3" + my_added="$1=$2" + fi + + if [[ -z "$4" ]] ; then + einfo "Added '$my_added' to /$3" + else + einfo "$4 to /$3" + fi + + insinto /$(dirname $3) + doins "$3" +} + +# @FUNCTION: php-ext-base-r1_addtoinifiles +# @USAGE: [message to output]; or just [section name] +# @DESCRIPTION: +# Add value settings to php.ini file installed by the extension (module). +# You can also add a [section], see examples below. +# +# @CODE +# Add some settings for the extension: +# +# php-ext-base-r1_addtoinifiles "zend_optimizer.optimization_level" "15" +# php-ext-base-r1_addtoinifiles "zend_optimizer.enable_loader" "0" +# php-ext-base-r1_addtoinifiles "zend_optimizer.disable_licensing" "0" +# +# Adding values to a section in php.ini file installed by the extension: +# +# php-ext-base-r1_addtoinifiles "[Debugger]" +# php-ext-base-r1_addtoinifiles "debugger.enabled" "on" +# php-ext-base-r1_addtoinifiles "debugger.profiler_enabled" "on" +# @CODE +php-ext-base-r1_addtoinifiles() { + for x in ${PHPINIFILELIST} ; do + php-ext-base-r1_addtoinifile "$1" "$2" "$x" "$3" + done +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/php-ext-pecl-r1.eclass b/sdk_container/src/third_party/portage-stable/eclass/php-ext-pecl-r1.eclass new file mode 100644 index 0000000000..9ea5a9d94c --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/php-ext-pecl-r1.eclass @@ -0,0 +1,90 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/php-ext-pecl-r1.eclass,v 1.11 2008/01/06 19:30:24 swegener Exp $ +# +# Author: Tal Peer +# Author: Luca Longinotti +# Author: Jakub Moc + +# @ECLASS: php-ext-pecl-r1.eclass +# @MAINTAINER: +# Gentoo PHP team +# @BLURB: A uniform way of installing PECL extensions +# @DESCRIPTION: +# This eclass should be used by all dev-php[45]/pecl-* ebuilds +# as a uniform way of installing PECL extensions. +# For more information about PECL, see http://pecl.php.net/ + +# @ECLASS-VARIABLE: PHP_EXT_PECL_PKG +# @DESCRIPTION: +# Set in ebuild before inheriting this eclass if the tarball name +# differs from ${PN/pecl-/} so that SRC_URI and HOMEPAGE gets set +# correctly by the eclass. +# +# Setting this variable manually also affects PHP_EXT_NAME and ${S} +# unless you override those in ebuild. Also see PHP_EXT_PECL_FILENAME +# if this is not desired for whatever reason. + +# @ECLASS-VARIABLE: PHP_EXT_PECL_FILENAME +# @DESCRIPTION: +# Set in ebuild before inheriting this eclass if the tarball name +# differs from ${PN/pecl-/} so that SRC_URI gets set correctly by +# the eclass. +# +# Unlike PHP_EXT_PECL_PKG, setting this variable does not affect +# HOMEPAGE, PHP_EXT_NAME or ${S}. + + +[[ -z "${PHP_EXT_PECL_PKG}" ]] && PHP_EXT_PECL_PKG="${PN/pecl-/}" + +PECL_PKG="${PHP_EXT_PECL_PKG}" +MY_PV="${PV/_/}" +PECL_PKG_V="${PECL_PKG}-${MY_PV}" + +[[ -z "${PHP_EXT_NAME}" ]] && PHP_EXT_NAME="${PECL_PKG}" + +inherit php-ext-source-r1 depend.php + +EXPORT_FUNCTIONS src_compile src_install + +if [[ -n "${PHP_EXT_PECL_FILENAME}" ]] ; then + FILENAME="${PHP_EXT_PECL_FILENAME}-${MY_PV}.tgz" +else + FILENAME="${PECL_PKG_V}.tgz" +fi + +SRC_URI="http://pecl.php.net/get/${FILENAME}" +HOMEPAGE="http://pecl.php.net/${PECL_PKG}" + +S="${WORKDIR}/${PECL_PKG_V}" + +# @FUNCTION: php-ext-pecl-r1_src_compile +# @DESCRIPTION: +# Takes care of standard compile for PECL packages. +php-ext-pecl-r1_src_compile() { + has_php + php-ext-source-r1_src_compile +} + +# @FUNCTION: php-ext-pecl-r1_src_install +# @DESCRIPTION: +# Takes care of standard install for PECL packages. +# You can also simply add examples to IUSE to automagically install +# examples supplied with the package. + +# @VARIABLE: DOCS +# @DESCRIPTION: +# Set in ebuild if you wish to install additional, package-specific documentation. +php-ext-pecl-r1_src_install() { + has_php + php-ext-source-r1_src_install + + for doc in ${DOCS} "${WORKDIR}"/package.xml CREDITS ; do + [[ -s ${doc} ]] && dodoc-php ${doc} + done + + if has examples ${IUSE} && use examples ; then + insinto /usr/share/doc/${CATEGORY}/${PF}/examples + doins -r examples/* + fi +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/php-ext-source-r1.eclass b/sdk_container/src/third_party/portage-stable/eclass/php-ext-source-r1.eclass new file mode 100644 index 0000000000..c2a2d5a570 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/php-ext-source-r1.eclass @@ -0,0 +1,135 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/php-ext-source-r1.eclass,v 1.19 2008/05/09 13:02:04 hoffie Exp $ +# +# Author: Tal Peer +# Author: Stuart Herbert +# Author: Luca Longinotti +# Author: Jakub Moc (documentation) + +# @ECLASS: php-ext-src-r1.eclass +# @MAINTAINER: +# Gentoo PHP team +# @BLURB: A unified interface for compiling and installing standalone PHP extensions from source code. +# @DESCRIPTION: +# This eclass provides a unified interface for compiling and installing standalone +# PHP extensions (modules) from source code. + + +WANT_AUTOCONF="latest" +WANT_AUTOMAKE="latest" + +inherit php-ext-base-r1 flag-o-matic autotools depend.php + +EXPORT_FUNCTIONS src_unpack src_compile src_install + +# @ECLASS-VARIABLE: PHP_EXT_NAME +# @DESCRIPTION: +# The extension name. This must be set, otherwise the eclass dies. +# Only automagically set by php-ext-pecl-r1.eclass, so unless your ebuild +# inherits that eclass, you must set this manually before inherit. +[[ -z "${PHP_EXT_NAME}" ]] && die "No module name specified for the php-ext-source-r1 eclass" + +DEPEND=">=sys-devel/m4-1.4.3 + >=sys-devel/libtool-1.5.18" +RDEPEND="" + + +# @FUNCTION: php-ext-source-r1_src_unpack +# @DESCRIPTION: +# runs standard src_unpack + _phpize +# +# @VARIABLE: PHP_EXT_SKIP_PHPIZE +# @DESCRIPTION: +# phpize will be run by default for all ebuilds that use +# php-ext-source-r1_src_unpack +# Set PHP_EXT_SKIP_PHPIZE="yes" in your ebuild if you do not want to run phpize. +php-ext-source-r1_src_unpack() { + unpack ${A} + cd "${S}" + if [[ "${PHP_EXT_SKIP_PHPIZE}" != 'yes' ]] ; then + php-ext-source-r1_phpize + fi +} + +# @FUNCTION php-ext-source-r1_phpize +# @DESCRIPTION: +# Runs phpize and autotools in addition to the standard src_unpack +php-ext-source-r1_phpize() { + has_php + # Create configure out of config.m4 + ${PHPIZE} + # force run of libtoolize and regeneration of related autotools + # files (bug 220519) + rm aclocal.m4 + eautoreconf +} + +# @FUNCTION: php-ext-source-r1_src_compile +# @DESCRIPTION: +# Takes care of standard compile for PHP extensions (modules). + +# @VARIABLE: my_conf +# @DESCRIPTION: +# Set this in the ebuild to pass configure options to econf. +php-ext-source-r1_src_compile() { + # Pull in the PHP settings + has_php + addpredict /usr/share/snmp/mibs/.index + addpredict /session_mm_cli0.sem + + # Set the correct config options + my_conf="--prefix=${PHPPREFIX} --with-php-config=${PHPCONFIG} ${my_conf}" + + # Concurrent PHP Apache2 modules support + if has_concurrentmodphp ; then + append-ldflags "-Wl,--version-script=${ROOT}/var/lib/php-pkg/${PHP_PKG}/php${PHP_VERSION}-ldvs" + fi + + # First compile run: the default one + econf ${my_conf} || die "Unable to configure code to compile" + emake || die "Unable to make code" + mv -f "modules/${PHP_EXT_NAME}.so" "${WORKDIR}/${PHP_EXT_NAME}-default.so" || die "Unable to move extension" + + # Concurrent PHP Apache2 modules support + if has_concurrentmodphp ; then + # First let's clean up + make distclean || die "Unable to clean build environment" + + # Second compile run: the versioned one + econf ${my_conf} || die "Unable to configure versioned code to compile" + sed -e "s|-Wl,--version-script=${ROOT}/var/lib/php-pkg/${PHP_PKG}/php${PHP_VERSION}-ldvs|-Wl,--version-script=${ROOT}/var/lib/php-pkg/${PHP_PKG}/php${PHP_VERSION}-ldvs -Wl,--allow-shlib-undefined -L/usr/$(get_libdir)/apache2/modules/ -lphp${PHP_VERSION}|g" -i Makefile + append-ldflags "-Wl,--allow-shlib-undefined -L/usr/$(get_libdir)/apache2/modules/ -lphp${PHP_VERSION}" + emake || die "Unable to make versioned code" + mv -f "modules/${PHP_EXT_NAME}.so" "${WORKDIR}/${PHP_EXT_NAME}-versioned.so" || die "Unable to move versioned extension" + fi +} + +# @FUNCTION: php-ext-source-r1_src_install +# @DESCRIPTION: +# Takes care of standard install for PHP extensions (modules). + +# @VARIABLE: DOCS +# @DESCRIPTION: +# Set in ebuild if you wish to install additional, package-specific documentation. +php-ext-source-r1_src_install() { + # Pull in the PHP settings + has_php + addpredict /usr/share/snmp/mibs/.index + + # Let's put the default module away + insinto "${EXT_DIR}" + newins "${WORKDIR}/${PHP_EXT_NAME}-default.so" "${PHP_EXT_NAME}.so" || die "Unable to install extension" + + # And now the versioned one, if it exists + if has_concurrentmodphp ; then + insinto "${EXT_DIR}-versioned" + newins "${WORKDIR}/${PHP_EXT_NAME}-versioned.so" "${PHP_EXT_NAME}.so" || die "Unable to install extension" + fi + + for doc in ${DOCS} ; do + [[ -s ${doc} ]] && dodoc-php ${doc} + done + + php-ext-base-r1_src_install +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/php-ezc.eclass b/sdk_container/src/third_party/portage-stable/eclass/php-ezc.eclass new file mode 100644 index 0000000000..6d50a90465 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/php-ezc.eclass @@ -0,0 +1,52 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/php-ezc.eclass,v 1.5 2008/01/13 15:28:38 jokey Exp $ + +# @ECLASS: php-ezc.eclass +# @MAINTAINER: +# Gentoo PHP team +# @BLURB: Provides an easy installation of the eZcomponents. +# @DESCRIPTION: +# This eclass provides means for an easy installation of the eZ components. +# For more information on eZcomponents see http://ez.no/products/ez_components + +inherit php-pear-r1 + +EZC_PKG_NAME="${PN/ezc-/}" + +fix_EZC_PV() { + tmp="${PV}" + tmp="${tmp/_/}" + tmp="${tmp/rc/RC}" + tmp="${tmp/beta/b}" + EZC_PV="${tmp}" +} + +# @ECLASS-VARIABLE: EZC_PV +# @DESCRIPTION: +# Set in ebuild before inherit if the eclass ${PV} mangling of beta/rc +# versions breaks SRC_URI. +[[ -z "${EZC_PV}" ]] && fix_EZC_PV + +EZC_PN="${EZC_PKG_NAME}-${EZC_PV}" + +S="${WORKDIR}/${EZC_PN}" + +DEPEND=">=dev-lang/php-5.1.2 + >=dev-php/PEAR-PEAR-1.4.6" + +# @ECLASS-VARIABLE: EZC_BASE_MIN +# @DESCRIPTION: +# Minimal dev-php5/ezc-Base version required for given eZ component version. +# Set in ebuild before inherit. +[[ -z "${EZC_BASE_MIN}" ]] && EZC_BASE_MIN="1.0" + +if [[ "${PN}" != "ezc-Base" ]] ; then + RDEPEND="${DEPEND} >=dev-php5/ezc-Base-${EZC_BASE_MIN}" +else + RDEPEND="${DEPEND}" +fi + +SRC_URI="http://components.ez.no/get/${EZC_PN}.tgz" +HOMEPAGE="http://ez.no/products/ez_components" +LICENSE="BSD" diff --git a/sdk_container/src/third_party/portage-stable/eclass/php-lib-r1.eclass b/sdk_container/src/third_party/portage-stable/eclass/php-lib-r1.eclass new file mode 100644 index 0000000000..b24ef1d99c --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/php-lib-r1.eclass @@ -0,0 +1,65 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/php-lib-r1.eclass,v 1.9 2008/01/06 19:30:24 swegener Exp $ +# +# Author: Stuart Herbert +# Author: Luca Longinotti + +# @ECLASS: php-lib-r1.eclass +# @MAINTAINER: +# Gentoo PHP team +# @BLURB: A unified interface for adding new PHP libraries. +# @DESCRIPTION: +# This eclass provides a unified interface for adding new PHP libraries. +# PHP libraries are PHP scripts designed for reuse inside other PHP scripts. + +inherit depend.php + +EXPORT_FUNCTIONS src_install + +DEPEND="dev-lang/php" +RDEPEND="${DEPEND}" + +# @ECLASS-VARIABLE: PHP_LIB_NAME +# @DESCRIPTION: +# Defaults to ${PN} unless set manually in the ebuild. +[[ -z "${PHP_LIB_NAME}" ]] && PHP_LIB_NAME="${PN}" + +# @FUNCTION: php-lib-r1_src_install +# @USAGE: +# @DESCRIPTION: +# Takes care of install for PHP libraries. +# You have to pass in a list of the PHP files to install. + +# @VARIABLE: DOCS +# @DESCRIPTION: +# Set in ebuild if you wish to install additional, package-specific documentation. + +# $1 - directory in ${S} to insert from +# $2 ... list of files to install +php-lib-r1_src_install() { + has_php + + # install to the correct phpX folder, if not specified + # fall back to /usr/share/php + if [[ -n "${PHP_SHARED_CAT}" ]] ; then + PHP_LIB_DIR="/usr/share/${PHP_SHARED_CAT}/${PHP_LIB_NAME}" + else + PHP_LIB_DIR="/usr/share/php/${PHP_LIB_NAME}" + fi + + local x + + S_DIR="$1" + shift + + for x in $@ ; do + SUBDIR="$(dirname ${x})" + insinto "${PHP_LIB_DIR}/${SUBDIR}" + doins "${S_DIR}/${x}" + done + + for doc in ${DOCS} ; do + [[ -s ${doc} ]] && dodoc-php ${doc} + done +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/php-pear-lib-r1.eclass b/sdk_container/src/third_party/portage-stable/eclass/php-pear-lib-r1.eclass new file mode 100644 index 0000000000..f92ec0303e --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/php-pear-lib-r1.eclass @@ -0,0 +1,94 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/php-pear-lib-r1.eclass,v 1.15 2009/01/12 22:48:06 maekke Exp $ +# +# Author: Luca Longinotti + +# @ECLASS: php-pear-lib-r1.eclass +# @MAINTAINER: +# Gentoo PHP team +# @BLURB: Provides means for an easy installation of PEAR-based libraries. +# @DESCRIPTION: +# This class provides means for an easy installation of PEAR-based libraries, +# such as Creole, Jargon, Phing etc., while retaining the functionality to put +# the libraries into version-dependant directories. + +inherit depend.php multilib + +EXPORT_FUNCTIONS src_install + +DEPEND="dev-lang/php >=dev-php/PEAR-PEAR-1.6.1" +RDEPEND="${DEPEND}" + +# @FUNCTION: php-pear-lib-r1_src_install +# @DESCRIPTION: +# Takes care of standard install for PEAR-based libraries. +php-pear-lib-r1_src_install() { + has_php + + # SNMP support + addpredict /usr/share/snmp/mibs/.index + addpredict /var/lib/net-snmp/ + addpredict /session_mm_cli0.sem + + case "${CATEGORY}" in + dev-php) + if has_version '=dev-lang/php-5*' ; then + PHP_BIN="/usr/$(get_libdir)/php5/bin/php" + else + PHP_BIN="/usr/$(get_libdir)/php4/bin/php" + fi ;; + dev-php4) PHP_BIN="/usr/$(get_libdir)/php4/bin/php" ;; + dev-php5) PHP_BIN="/usr/$(get_libdir)/php5/bin/php" ;; + *) die "Version of PHP required by packages in category ${CATEGORY} unknown" + esac + + cd "${S}" + + if [[ -f "${WORKDIR}"/package2.xml ]] ; then + mv -f "${WORKDIR}/package2.xml" "${S}" + if has_version '>=dev-php/PEAR-PEAR-1.7.0' ; then + local WWW_DIR="/usr/share/webapps/${PN}/${PVR}/htdocs" + pear -d php_bin="${PHP_BIN}" -d www_dir="${WWW_DIR}" \ + install --force --loose --nodeps --offline --packagingroot="${D}" \ + "${S}/package2.xml" || die "Unable to install PEAR package" + else + pear -d php_bin="${PHP_BIN}" install --force --loose --nodeps --offline --packagingroot="${D}" \ + "${S}/package2.xml" || die "Unable to install PEAR package" + fi + else + mv -f "${WORKDIR}/package.xml" "${S}" + if has_version '>=dev-php/PEAR-PEAR-1.7.0' ; then + local WWW_DIR="/usr/share/webapps/${PN}/${PVR}/htdocs" + pear -d php_bin="${PHP_BIN}" -d www_dir="${WWW_DIR}" \ + install --force --loose --nodeps --offline --packagingroot="${D}" \ + "${S}/package.xml" || die "Unable to install PEAR package" + else + pear -d php_bin="${PHP_BIN}" install --force --loose --nodeps --offline --packagingroot="${D}" \ + "${S}/package.xml" || die "Unable to install PEAR package" + fi + fi + + rm -Rf "${D}/usr/share/php/.channels" \ + "${D}/usr/share/php/.depdblock" \ + "${D}/usr/share/php/.depdb" \ + "${D}/usr/share/php/.filemap" \ + "${D}/usr/share/php/.lock" \ + "${D}/usr/share/php/.registry" + + # install to the correct phpX folder, if not specified + # /usr/share/php will be kept, also sedding to substitute + # the path, many files can specify it wrongly + if [[ -n "${PHP_SHARED_CAT}" ]] && [[ "${PHP_SHARED_CAT}" != "php" ]] ; then + mv -f "${D}/usr/share/php" "${D}/usr/share/${PHP_SHARED_CAT}" || die "Unable to move files" + find "${D}/" -type f -exec sed -e "s|/usr/share/php|/usr/share/${PHP_SHARED_CAT}|g" -i {} \; \ + || die "Unable to change PHP path" + einfo + einfo "Installing to /usr/share/${PHP_SHARED_CAT} ..." + einfo + else + einfo + einfo "Installing to /usr/share/php ..." + einfo + fi +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/php-pear-r1.eclass b/sdk_container/src/third_party/portage-stable/eclass/php-pear-r1.eclass new file mode 100644 index 0000000000..42a3df3751 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/php-pear-r1.eclass @@ -0,0 +1,107 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/php-pear-r1.eclass,v 1.23 2010/02/16 04:14:13 beandog Exp $ +# +# Author: Tal Peer +# Author: Luca Longinotti + +# @ECLASS: php-pear-r1.eclass +# @MAINTAINER: +# Gentoo PHP Team +# @BLURB: Provides means for an easy installation of PEAR packages. +# @DESCRIPTION: +# This eclass provides means for an easy installation of PEAR packages. +# For more information on PEAR, see http://pear.php.net/ +# Note that this eclass doesn't handle dependencies of PEAR packages +# on purpose; please use (R)DEPEND to define them correctly! + +inherit multilib + +EXPORT_FUNCTIONS src_install + +DEPEND="dev-lang/php + || ( ( >=dev-php/PEAR-PEAR-1.6.1 =dev-php/pear-1.8.1 )" +RDEPEND="${DEPEND}" + +# @ECLASS-VARIABLE: PHP_PEAR_PKG_NAME +# @DESCRIPTION: +# Set this if the the PEAR package name differs from ${PN/PEAR-/} +# (generally shouldn't be the case). +[[ -z "${PHP_PEAR_PKG_NAME}" ]] && PHP_PEAR_PKG_NAME="${PN/PEAR-/}" + +fix_PEAR_PV() { + tmp="${PV}" + tmp="${tmp/_/}" + tmp="${tmp/rc/RC}" + tmp="${tmp/beta/b}" + tmp="${tmp/alpha/a}" + PEAR_PV="${tmp}" +} + +# @ECLASS-VARIABLE: PEAR_PV +# @DESCRIPTION: +# Set in ebuild if the eclass ${PV} mangling breaks SRC_URI for alpha/beta/rc versions +[[ -z "${PEAR_PV}" ]] && fix_PEAR_PV + +PEAR_PN="${PHP_PEAR_PKG_NAME}-${PEAR_PV}" + +[[ -z "${SRC_URI}" ]] && SRC_URI="http://pear.php.net/get/${PEAR_PN}.tgz" +[[ -z "${HOMEPAGE}" ]] && HOMEPAGE="http://pear.php.net/${PHP_PEAR_PKG_NAME}" + +S="${WORKDIR}/${PEAR_PN}" + +# @FUNCTION: php-pear-r1_src_install +# @DESCRIPTION: +# Takes care of standard install for PEAR packages. +php-pear-r1_src_install() { + # SNMP support + addpredict /usr/share/snmp/mibs/.index + addpredict /var/lib/net-snmp/ + addpredict /session_mm_cli0.sem + + case "${CATEGORY}" in + dev-php) + if has_version '=dev-lang/php-5*' ; then + PHP_BIN="/usr/$(get_libdir)/php5/bin/php" + else + PHP_BIN="/usr/$(get_libdir)/php4/bin/php" + fi ;; + dev-php4) PHP_BIN="/usr/$(get_libdir)/php4/bin/php" ;; + dev-php5) PHP_BIN="/usr/$(get_libdir)/php5/bin/php" ;; + *) die "Version of PHP required by packages in category ${CATEGORY} unknown" + esac + + cd "${S}" + + if [[ -f "${WORKDIR}"/package2.xml ]] ; then + mv -f "${WORKDIR}/package2.xml" "${S}" + if has_version '>=dev-php/PEAR-PEAR-1.7.0' ; then + local WWW_DIR="/usr/share/webapps/${PN}/${PVR}/htdocs" + pear -d php_bin="${PHP_BIN}" -d www_dir="${WWW_DIR}" \ + install --force --loose --nodeps --offline --packagingroot="${D}" \ + "${S}/package2.xml" || die "Unable to install PEAR package" + else + pear -d php_bin="${PHP_BIN}" install --force --loose --nodeps --offline --packagingroot="${D}" \ + "${S}/package2.xml" || die "Unable to install PEAR package" + fi + else + mv -f "${WORKDIR}/package.xml" "${S}" + if has_version '>=dev-php/PEAR-PEAR-1.7.0' ; then + local WWW_DIR="/usr/share/webapps/${PN}/${PVR}/htdocs" + pear -d php_bin="${PHP_BIN}" -d www_dir="${WWW_DIR}" \ + install --force --loose --nodeps --offline --packagingroot="${D}" \ + "${S}/package.xml" || die "Unable to install PEAR package" + else + pear -d php_bin="${PHP_BIN}" install --force --loose --nodeps --offline --packagingroot="${D}" \ + "${S}/package.xml" || die "Unable to install PEAR package" + fi + fi + + rm -Rf "${D}/usr/share/php/.channels" \ + "${D}/usr/share/php/.depdblock" \ + "${D}/usr/share/php/.depdb" \ + "${D}/usr/share/php/.filemap" \ + "${D}/usr/share/php/.lock" \ + "${D}/usr/share/php/.registry" +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/php-pear.eclass b/sdk_container/src/third_party/portage-stable/eclass/php-pear.eclass new file mode 100644 index 0000000000..2f719e888f --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/php-pear.eclass @@ -0,0 +1,25 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/php-pear.eclass,v 1.15 2008/01/06 19:30:24 swegener Exp $ +# +# Author: Tal Peer +# +# The php-pear eclass provides means for easy installation of PEAR +# packages, see http://pear.php.net + +# Note that this eclass doesn't handle PEAR packages' dependencies on +# purpose, please use (R)DEPEND to define them. + +# DEPRECATED!!! +# STOP USING THIS ECLASS, use php-pear-r1.eclass instead! + +inherit php-pear-r1 + +deprecation_warning() { + eerror "Please upgrade ${PF} to use php-pear-r1.eclass!" +} + +php-pear_src_install () { + deprecation_warning + php-pear-r1_src_install +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/php5_1-sapi.eclass b/sdk_container/src/third_party/portage-stable/eclass/php5_1-sapi.eclass new file mode 100644 index 0000000000..fd0cca0427 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/php5_1-sapi.eclass @@ -0,0 +1,7 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/php5_1-sapi.eclass,v 1.45 2009/11/30 04:19:36 abcd Exp $ + +# @DEAD +# To be removed on 2011/11/30. +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" diff --git a/sdk_container/src/third_party/portage-stable/eclass/php5_2-sapi.eclass b/sdk_container/src/third_party/portage-stable/eclass/php5_2-sapi.eclass new file mode 100644 index 0000000000..ebf228057a --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/php5_2-sapi.eclass @@ -0,0 +1,734 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/php5_2-sapi.eclass,v 1.31 2010/02/26 21:56:58 halcy0n Exp $ + +# ======================================================================== +# Based on robbat2's work on the php4 sapi eclass +# +# Author: Stuart Herbert +# Author: Luca Longinotti +# +# ======================================================================== + +# @ECLASS: php5_2-sapi.eclass +# @MAINTAINER: +# Gentoo PHP team +# @BLURB: Eclass for building different php-5.2 SAPI instances. +# @DESCRIPTION: +# Eclass for building different php-5.2 SAPI instances. Use it for the +# new-style =dev-lang/php-5.2* ebuilds. + + +PHPCONFUTILS_MISSING_DEPS="adabas birdstep db2 dbmaker empress empress-bcs esoob frontbase interbase msql oci8 sapdb solid sybase sybase-ct" + +WANT_AUTOCONF="latest" +WANT_AUTOMAKE="latest" + +inherit db-use flag-o-matic autotools toolchain-funcs libtool eutils phpconfutils php-common-r1 + +# @ECLASS-VARIABLE: MY_PHP_P +# @DESCRIPTION: +# Set MY_PHP_P in the ebuild as needed to match tarball version. + +# @ECLASS-VARIABLE: PHP_PACKAGE +# @DESCRIPTION: +# We only set this variable if we are building a copy of php which can be +# installed as a package in its own. +# Copies of php which are compiled into other packages (e.g. php support +# for the thttpd web server) don't need this variable. +if [[ "${PHP_PACKAGE}" == 1 ]] ; then + HOMEPAGE="http://www.php.net/" + LICENSE="PHP-3" + SRC_URI="http://www.php.net/distributions/${MY_PHP_P}.tar.bz2" + S="${WORKDIR}/${MY_PHP_P}" +fi + +IUSE="adabas bcmath berkdb birdstep bzip2 calendar cdb cjk crypt ctype curl curlwrappers db2 dbase dbmaker debug doc empress empress-bcs esoob exif frontbase fdftk filter firebird flatfile ftp gd gd-external gdbm gmp hash iconv imap inifile interbase iodbc ipv6 java-external json kerberos ldap ldap-sasl libedit mcve mhash msql mssql mysql mysqli ncurses nls oci8 oci8-instant-client odbc pcntl pcre pdo pic posix postgres qdbm readline reflection recode sapdb session sharedext sharedmem simplexml snmp soap sockets solid spell spl sqlite ssl suhosin sybase sybase-ct sysvipc tidy tokenizer truetype unicode wddx xml xmlreader xmlwriter xmlrpc xpm xsl yaz zip zlib" + +# these USE flags should have the correct dependencies +DEPEND="adabas? ( >=dev-db/unixODBC-1.8.13 ) + berkdb? ( =sys-libs/db-4* ) + birdstep? ( >=dev-db/unixODBC-1.8.13 ) + bzip2? ( app-arch/bzip2 ) + cdb? ( || ( dev-db/cdb dev-db/tinycdb ) ) + cjk? ( !gd? ( !gd-external? ( >=media-libs/jpeg-7 media-libs/libpng sys-libs/zlib ) ) ) + crypt? ( >=dev-libs/libmcrypt-2.4 ) + curl? ( >=net-misc/curl-7.10.5 ) + db2? ( >=dev-db/unixODBC-1.8.13 ) + dbmaker? ( >=dev-db/unixODBC-1.8.13 ) + empress? ( >=dev-db/unixODBC-1.8.13 ) + empress-bcs? ( >=dev-db/unixODBC-1.8.13 ) + esoob? ( >=dev-db/unixODBC-1.8.13 ) + exif? ( !gd? ( !gd-external? ( >=media-libs/jpeg-6b media-libs/libpng sys-libs/zlib ) ) ) + fdftk? ( app-text/fdftk ) + firebird? ( dev-db/firebird ) + gd? ( >=media-libs/jpeg-6b media-libs/libpng sys-libs/zlib ) + gd-external? ( media-libs/gd ) + gdbm? ( >=sys-libs/gdbm-1.8.0 ) + gmp? ( >=dev-libs/gmp-4.1.2 ) + iconv? ( virtual/libiconv ) + imap? ( virtual/imap-c-client ) + iodbc? ( dev-db/libiodbc >=dev-db/unixODBC-1.8.13 ) + kerberos? ( virtual/krb5 ) + ldap? ( !oci8? ( >=net-nds/openldap-1.2.11 ) ) + ldap-sasl? ( !oci8? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 ) ) + libedit? ( dev-libs/libedit ) + mcve? ( >=dev-libs/openssl-0.9.7 ) + mhash? ( app-crypt/mhash ) + mssql? ( dev-db/freetds ) + mysql? ( virtual/mysql ) + mysqli? ( >=virtual/mysql-4.1 ) + ncurses? ( sys-libs/ncurses ) + nls? ( sys-devel/gettext ) + oci8-instant-client? ( dev-db/oracle-instantclient-basic ) + odbc? ( >=dev-db/unixODBC-1.8.13 ) + postgres? ( || ( >=dev-db/libpq-7.1 ( app-admin/eselect-postgresql + >=dev-db/postgresql-base-7.1 ) ) ) + qdbm? ( dev-db/qdbm ) + readline? ( sys-libs/readline ) + recode? ( app-text/recode ) + sapdb? ( >=dev-db/unixODBC-1.8.13 ) + sharedmem? ( dev-libs/mm ) + simplexml? ( >=dev-libs/libxml2-2.6.8 ) + snmp? ( >=net-analyzer/net-snmp-5.2 ) + soap? ( >=dev-libs/libxml2-2.6.8 ) + solid? ( >=dev-db/unixODBC-1.8.13 ) + spell? ( >=app-text/aspell-0.50 ) + sqlite? ( =dev-db/sqlite-2* pdo? ( =dev-db/sqlite-3* ) ) + ssl? ( >=dev-libs/openssl-0.9.7 ) + sybase? ( dev-db/freetds ) + tidy? ( app-text/htmltidy ) + truetype? ( =media-libs/freetype-2* >=media-libs/t1lib-5.0.0 !gd? ( !gd-external? ( >=media-libs/jpeg-6b media-libs/libpng sys-libs/zlib ) ) ) + wddx? ( >=dev-libs/libxml2-2.6.8 ) + xml? ( >=dev-libs/libxml2-2.6.8 ) + xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv ) + xmlreader? ( >=dev-libs/libxml2-2.6.8 ) + xmlwriter? ( >=dev-libs/libxml2-2.6.8 ) + xpm? ( x11-libs/libXpm >=media-libs/jpeg-6b media-libs/libpng sys-libs/zlib ) + xsl? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 ) + zip? ( sys-libs/zlib ) + zlib? ( sys-libs/zlib ) + virtual/mta" + +# libswf conflicts with ming and should not +# be installed with the new PHP ebuilds +DEPEND="${DEPEND} + !media-libs/libswf" + +# simplistic for now +RDEPEND="${DEPEND}" + +# those are only needed at compile-time +DEPEND="${DEPEND} + >=sys-devel/m4-1.4.3 + >=sys-devel/libtool-1.5.18" + +# Additional features +# +# They are in PDEPEND because we need PHP installed first! +PDEPEND="doc? ( app-doc/php-docs ) + filter? ( !dev-php5/pecl-filter ) + java-external? ( dev-php5/php-java-bridge ) + json? ( !dev-php5/pecl-json ) + mcve? ( dev-php5/pecl-mcve ) + pdo? ( !dev-php5/pecl-pdo ) + suhosin? ( dev-php5/suhosin ) + yaz? ( dev-php5/pecl-yaz )" + +# ======================================================================== +# php.ini Support +# ======================================================================== + +PHP_INI_FILE="php.ini" +PHP_INI_UPSTREAM="php.ini-dist" + +# ======================================================================== + +# @ECLASS-VARIABLE: PHP_PATCHSET_REV +# @DESCRIPTION: +# Provides PHP patchsets support. +# This condition will help non php maintainers in fixing bugs and let them to +# upload patchset tarballs somewhere else. +if [[ ! -n ${PHP_PATCHSET_URI} ]]; then + SRC_URI="${SRC_URI} http://gentoo.longitekk.com/php-patchset-${MY_PHP_PV}-r${PHP_PATCHSET_REV}.tar.bz2" +else + SRC_URI="${SRC_URI} ${PHP_PATCHSET_URI}" +fi + +# @ECLASS-VARIABLE: SUHOSIN_PATCH +# @DESCRIPTION: +# Tarball name for Suhosin patch (see http://www.suhosin.org/). +# This feature will not be available in php if unset. +[[ -n "${SUHOSIN_PATCH}" ]] && SRC_URI="${SRC_URI} suhosin? ( http://gentoo.longitekk.com/${SUHOSIN_PATCH} )" + + +# ======================================================================== + +EXPORT_FUNCTIONS pkg_setup src_compile src_install src_unpack pkg_postinst + +# ======================================================================== +# INTERNAL FUNCTIONS +# ======================================================================== + +php5_2-sapi_check_use_flags() { + # Multiple USE dependencies + phpconfutils_use_depend_any "truetype" "gd" "gd" "gd-external" + phpconfutils_use_depend_any "cjk" "gd" "gd" "gd-external" + phpconfutils_use_depend_any "exif" "gd" "gd" "gd-external" + + # Simple USE dependencies + phpconfutils_use_depend_all "xpm" "gd" + phpconfutils_use_depend_all "gd" "zlib" + phpconfutils_use_depend_all "simplexml" "xml" + phpconfutils_use_depend_all "soap" "xml" + phpconfutils_use_depend_all "wddx" "xml" + phpconfutils_use_depend_all "xmlrpc" "xml" + phpconfutils_use_depend_all "xmlreader" "xml" + phpconfutils_use_depend_all "xmlwriter" "xml" + phpconfutils_use_depend_all "xsl" "xml" + phpconfutils_use_depend_all "filter" "pcre" + phpconfutils_use_depend_all "xmlrpc" "iconv" + phpconfutils_use_depend_all "java-external" "session" + phpconfutils_use_depend_all "ldap-sasl" "ldap" + phpconfutils_use_depend_all "mcve" "ssl" + phpconfutils_use_depend_all "suhosin" "unicode" + phpconfutils_use_depend_all "adabas" "odbc" + phpconfutils_use_depend_all "birdstep" "odbc" + phpconfutils_use_depend_all "dbmaker" "odbc" + phpconfutils_use_depend_all "empress-bcs" "odbc" "empress" + phpconfutils_use_depend_all "empress" "odbc" + phpconfutils_use_depend_all "esoob" "odbc" + phpconfutils_use_depend_all "db2" "odbc" + phpconfutils_use_depend_all "iodbc" "odbc" + phpconfutils_use_depend_all "sapdb" "odbc" + phpconfutils_use_depend_all "solid" "odbc" + phpconfutils_use_depend_all "kolab" "imap" + + # Direct USE conflicts + phpconfutils_use_conflict "gd" "gd-external" + phpconfutils_use_conflict "oci8" "oci8-instant-client" + phpconfutils_use_conflict "oci8" "ldap-sasl" + phpconfutils_use_conflict "qdbm" "gdbm" + phpconfutils_use_conflict "readline" "libedit" + phpconfutils_use_conflict "recode" "mysql" "imap" "yaz" "kolab" + phpconfutils_use_conflict "sharedmem" "threads" + phpconfutils_use_conflict "firebird" "interbase" + + # IMAP support + php_check_imap + + # Mail support + php_check_mta + + # PostgreSQL support + php_check_pgsql + + # Oracle support + php_check_oracle_8 + + phpconfutils_warn_about_external_deps + + export PHPCONFUTILS_AUTO_USE="${PHPCONFUTILS_AUTO_USE}" +} + +php5_2-sapi_set_php_ini_dir() { + PHP_INI_DIR="/etc/php/${PHPSAPI}-php5" + PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext" + PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active" +} + +php5_2-sapi_install_ini() { + destdir=/usr/$(get_libdir)/php5 + + # get the extension dir, if not already defined + [[ -z "${PHPEXTDIR}" ]] && PHPEXTDIR="`"${D}/${destdir}/bin/php-config" --extension-dir`" + + # work out where we are installing the ini file + php5_2-sapi_set_php_ini_dir + + cp "${PHP_INI_UPSTREAM}" "${PHP_INI_UPSTREAM}-${PHPSAPI}" + local phpinisrc="${PHP_INI_UPSTREAM}-${PHPSAPI}" + + # Set the extension dir + einfo "Setting extension_dir in php.ini" + sed -e "s|^extension_dir .*$|extension_dir = ${PHPEXTDIR}|g" -i ${phpinisrc} + + # A patch for PHP for security + einfo "Securing fopen wrappers" + sed -e 's|^allow_url_fopen .*|allow_url_fopen = Off|g' -i ${phpinisrc} + + # Set the include path to point to where we want to find PEAR packages + einfo "Setting correct include_path" + sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:/usr/share/php5:/usr/share/php"|' -i ${phpinisrc} + + # Add needed MySQL extensions charset configuration + local phpmycnfcharset="" + + if [[ "${PHPSAPI}" == "cli" ]] ; then + phpmycnfcharset="`php_get_mycnf_charset cli`" + einfo "MySQL extensions charset for 'cli' SAPI is: ${phpmycnfcharset}" + elif [[ "${PHPSAPI}" == "cgi" ]] ; then + phpmycnfcharset="`php_get_mycnf_charset cgi-fcgi`" + einfo "MySQL extensions charset for 'cgi' SAPI is: ${phpmycnfcharset}" + elif [[ "${PHPSAPI}" == "apache2" ]] ; then + phpmycnfcharset="`php_get_mycnf_charset apache2handler`" + einfo "MySQL extensions charset for 'apache2' SAPI is: ${phpmycnfcharset}" + else + einfo "No supported SAPI found for which to get the MySQL charset." + fi + + if [[ -n "${phpmycnfcharset}" ]] && [[ "${phpmycnfcharset}" != "empty" ]] ; then + einfo "Setting MySQL extensions charset to ${phpmycnfcharset}" + echo "" >> ${phpinisrc} + echo "; MySQL extensions default connection charset settings" >> ${phpinisrc} + echo "mysql.connect_charset = ${phpmycnfcharset}" >> ${phpinisrc} + echo "mysqli.connect_charset = ${phpmycnfcharset}" >> ${phpinisrc} + echo "pdo_mysql.connect_charset = ${phpmycnfcharset}" >> ${phpinisrc} + else + echo "" >> ${phpinisrc} + echo "; MySQL extensions default connection charset settings" >> ${phpinisrc} + echo ";mysql.connect_charset = utf8" >> ${phpinisrc} + echo ";mysqli.connect_charset = utf8" >> ${phpinisrc} + echo ";pdo_mysql.connect_charset = utf8" >> ${phpinisrc} + fi + + dodir ${PHP_INI_DIR} + insinto ${PHP_INI_DIR} + newins ${phpinisrc} ${PHP_INI_FILE} + + dodir ${PHP_EXT_INI_DIR} + dodir ${PHP_EXT_INI_DIR_ACTIVE} + + # Install any extensions built as shared objects + if use sharedext ; then + for x in `ls "${D}/${PHPEXTDIR}/"*.so | sort` ; do + inifilename=${x/.so/.ini} + inifilename=`basename ${inifilename}` + echo "extension=`basename ${x}`" >> "${D}/${PHP_EXT_INI_DIR}/${inifilename}" + dosym "${PHP_EXT_INI_DIR}/${inifilename}" "${PHP_EXT_INI_DIR_ACTIVE}/${inifilename}" + done + fi +} + +# ======================================================================== +# EXPORTED FUNCTIONS +# ======================================================================== + +# @FUNCTION: php5_2-sapi_pkg_setup +# @DESCRIPTION: +# Performs all the USE flag testing and magic before we do anything else. +# This way saves a lot of time. +php5_2-sapi_pkg_setup() { + php5_2-sapi_check_use_flags +} + +# @FUNCTION: php5_2-sapi_src_unpack +# @DESCRIPTION: +# Takes care of unpacking, patching and autotools magic and disables +# interactive tests. + +# @VARIABLE: PHP_EXTRA_BRANDING +# @DESCRIPTION: +# This variable allows an ebuild to add additional information like +# snapshot dates to the version line. +php5_2-sapi_src_unpack() { + cd "${S}" + + [[ -z "${PHP_EXTRA_BRANDING}" ]] && PHP_EXTRA_BRANDING="" + + # Change PHP branding + PHPPR=${PR/r/} + # >=php-5.2.4 has PHP_EXTRA_VERSION, previous had EXTRA_VERSION + sed -re "s|^(PHP_)?EXTRA_VERSION=\".*\"|\1EXTRA_VERSION=\"${PHP_EXTRA_BRANDING}-pl${PHPPR}-gentoo\"|g" -i configure.in \ + || die "Unable to change PHP branding to ${PHP_EXTRA_BRANDING}-pl${PHPPR}-gentoo" + + # multilib-strict support + if [[ -n "${MULTILIB_PATCH}" ]] && [[ -f "${WORKDIR}/${MULTILIB_PATCH}" ]] ; then + epatch "${WORKDIR}/${MULTILIB_PATCH}" + else + ewarn "There is no multilib-strict patch available for this PHP release yet!" + fi + + # Apply general PHP5 patches + if [[ -d "${WORKDIR}/${MY_PHP_PV}/php5" ]] ; then + EPATCH_SOURCE="${WORKDIR}/${MY_PHP_PV}/php5" EPATCH_SUFFIX="patch" EPATCH_FORCE="yes" epatch + fi + + # Apply version-specific PHP patches + if [[ -d "${WORKDIR}/${MY_PHP_PV}/${MY_PHP_PV}" ]] ; then + EPATCH_SOURCE="${WORKDIR}/${MY_PHP_PV}/${MY_PHP_PV}" EPATCH_SUFFIX="patch" EPATCH_FORCE="yes" epatch + fi + + # Patch PHP to show Gentoo as the server platform + sed -e "s/PHP_UNAME=\`uname -a | xargs\`/PHP_UNAME=\`uname -s -n -r -v | xargs\`/g" -i configure.in || die "Failed to fix server platform name" + + # Disable interactive make test + sed -e 's/'`echo "\!getenv('NO_INTERACTION')"`'/false/g' -i run-tests.php + + # Stop PHP from activating the Apache config, as we will do that ourselves + for i in configure sapi/apache2filter/config.m4 sapi/apache2handler/config.m4 ; do + sed -i.orig -e 's,-i -a -n php5,-i -n php5,g' ${i} + sed -i.orig -e 's,-i -A -n php5,-i -n php5,g' ${i} + done + + # Patch PHP to support heimdal instead of mit-krb5 + if has_version "app-crypt/heimdal" ; then + sed -e 's|gssapi_krb5|gssapi|g' -i acinclude.m4 || die "Failed to fix heimdal libname" + sed -e 's|PHP_ADD_LIBRARY(k5crypto, 1, $1)||g' -i acinclude.m4 || die "Failed to fix heimdal crypt library reference" + fi + + # Patch for PostgreSQL support + if use postgres ; then + sed -e 's|include/postgresql|include/postgresql include/postgresql/pgsql|g' -i ext/pgsql/config.m4 || die "Failed to fix PostgreSQL include paths" + fi + + # Suhosin support + if use suhosin ; then + if [[ -n "${SUHOSIN_PATCH}" ]] && [[ -f "${DISTDIR}/${SUHOSIN_PATCH}" ]] ; then + epatch "${DISTDIR}/${SUHOSIN_PATCH}" + else + ewarn "There is no Suhosin patch available for this PHP release yet!" + fi + fi + + # We are heavily patching autotools base files (configure.in) because + # of suhosin etc., so let's regenerate the whole stuff now + + # work around divert() issues with newer autoconf #281697 + if has_version '>=sys-devel/autoconf-2.64' ; then + sed -i -r \ + -e 's:^((m4_)?divert)[(]([0-9]*)[)]:\1(600\3):' \ + $(grep -l divert $(find -name '*.m4') configure.in) || die + fi + + # eaclocal doesn't accept --force, so we try to force re-generation + # this way + rm aclocal.m4 + eautoreconf --force -W no-cross + +} + +# @FUNCTION: php5_2-sapi_src_compile +# @DESCRIPTION: +# Takes care of compiling php according to USE flags set by user (and those automagically +# enabled via phpconfutils eclass if unavoidable). +php5_2-sapi_src_compile() { + destdir=/usr/$(get_libdir)/php5 + + php5_2-sapi_set_php_ini_dir + + cd "${S}" + + phpconfutils_init + + my_conf="${my_conf} --with-config-file-path=${PHP_INI_DIR} --with-config-file-scan-dir=${PHP_EXT_INI_DIR_ACTIVE} --without-pear" + + # extension USE flag shared support? + phpconfutils_extension_enable "bcmath" "bcmath" 1 + phpconfutils_extension_with "bz2" "bzip2" 1 + phpconfutils_extension_enable "calendar" "calendar" 1 + phpconfutils_extension_disable "ctype" "ctype" 0 + phpconfutils_extension_with "curl" "curl" 1 + phpconfutils_extension_with "curlwrappers" "curlwrappers" 0 + phpconfutils_extension_enable "dbase" "dbase" 1 + phpconfutils_extension_disable "dom" "xml" 0 + phpconfutils_extension_enable "exif" "exif" 1 + phpconfutils_extension_with "fbsql" "frontbase" 1 + phpconfutils_extension_with "fdftk" "fdftk" 1 "/opt/fdftk-6.0" + phpconfutils_extension_disable "filter" "filter" 0 + phpconfutils_extension_enable "ftp" "ftp" 1 + phpconfutils_extension_with "gettext" "nls" 1 + phpconfutils_extension_with "gmp" "gmp" 1 + phpconfutils_extension_disable "hash" "hash" 0 + phpconfutils_extension_without "iconv" "iconv" 0 + phpconfutils_extension_disable "ipv6" "ipv6" 0 + phpconfutils_extension_disable "json" "json" 0 + phpconfutils_extension_with "kerberos" "kerberos" 0 "/usr" + phpconfutils_extension_disable "libxml" "xml" 0 + phpconfutils_extension_enable "mbstring" "unicode" 1 + phpconfutils_extension_with "mcrypt" "crypt" 1 + phpconfutils_extension_with "mhash" "mhash" 1 + phpconfutils_extension_with "msql" "msql" 1 + phpconfutils_extension_with "mssql" "mssql" 1 + phpconfutils_extension_with "ncurses" "ncurses" 1 + phpconfutils_extension_with "openssl" "ssl" 0 + phpconfutils_extension_with "openssl-dir" "ssl" 0 "/usr" + phpconfutils_extension_enable "pcntl" "pcntl" 1 + phpconfutils_extension_without "pcre-regex" "pcre" 0 + phpconfutils_extension_disable "pdo" "pdo" 0 + phpconfutils_extension_with "pgsql" "postgres" 1 + phpconfutils_extension_disable "posix" "posix" 0 + phpconfutils_extension_with "pspell" "spell" 1 + phpconfutils_extension_with "recode" "recode" 1 + phpconfutils_extension_disable "reflection" "reflection" 0 + phpconfutils_extension_disable "simplexml" "simplexml" 0 + phpconfutils_extension_enable "shmop" "sharedmem" 0 + phpconfutils_extension_with "snmp" "snmp" 1 + phpconfutils_extension_enable "soap" "soap" 1 + phpconfutils_extension_enable "sockets" "sockets" 1 + phpconfutils_extension_disable "spl" "spl" 0 + phpconfutils_extension_with "sybase" "sybase" 1 + phpconfutils_extension_with "sybase-ct" "sybase-ct" 1 + phpconfutils_extension_enable "sysvmsg" "sysvipc" 1 + phpconfutils_extension_enable "sysvsem" "sysvipc" 1 + phpconfutils_extension_enable "sysvshm" "sysvipc" 1 + phpconfutils_extension_with "tidy" "tidy" 1 + phpconfutils_extension_disable "tokenizer" "tokenizer" 0 + phpconfutils_extension_enable "wddx" "wddx" 1 + phpconfutils_extension_disable "xml" "xml" 0 + phpconfutils_extension_disable "xmlreader" "xmlreader" 0 + phpconfutils_extension_disable "xmlwriter" "xmlwriter" 0 + phpconfutils_extension_with "xmlrpc" "xmlrpc" 1 + phpconfutils_extension_with "xsl" "xsl" 1 + phpconfutils_extension_enable "zip" "zip" 1 + phpconfutils_extension_with "zlib" "zlib" 1 + phpconfutils_extension_enable "debug" "debug" 0 + + # DBA support + if use cdb || use berkdb || use flatfile || use gdbm || use inifile || use qdbm ; then + my_conf="${my_conf} --enable-dba${shared}" + fi + + # Tell PHP where the db.h is on FreeBSD +# if use berkdb ; then +# append-cppflags "-I$(db_includedir)" +# fi + + # DBA drivers support + phpconfutils_extension_with "cdb" "cdb" 0 + phpconfutils_extension_with "db4" "berkdb" 0 + phpconfutils_extension_disable "flatfile" "flatfile" 0 + phpconfutils_extension_with "gdbm" "gdbm" 0 + phpconfutils_extension_disable "inifile" "inifile" 0 + phpconfutils_extension_with "qdbm" "qdbm" 0 + + # Support for the GD graphics library + if use gd-external || phpconfutils_usecheck gd-external ; then + phpconfutils_extension_with "freetype-dir" "truetype" 0 "/usr" + phpconfutils_extension_with "t1lib" "truetype" 0 "/usr" + phpconfutils_extension_enable "gd-jis-conv" "cjk" 0 + phpconfutils_extension_with "gd" "gd-external" 1 "/usr" + else + phpconfutils_extension_with "freetype-dir" "truetype" 0 "/usr" + phpconfutils_extension_with "t1lib" "truetype" 0 "/usr" + phpconfutils_extension_enable "gd-jis-conv" "cjk" 0 + phpconfutils_extension_with "jpeg-dir" "gd" 0 "/usr" + phpconfutils_extension_with "png-dir" "gd" 0 "/usr" + phpconfutils_extension_with "xpm-dir" "xpm" 0 "/usr" + # enable gd last, so configure can pick up the previous settings + phpconfutils_extension_with "gd" "gd" 0 + fi + + # IMAP support + if use imap || phpconfutils_usecheck imap ; then + phpconfutils_extension_with "imap" "imap" 1 + phpconfutils_extension_with "imap-ssl" "ssl" 0 + fi + + # Interbase support + if use interbase ; then + my_conf="${my_conf} --with-interbase=/opt" + fi + + # Firebird support - see Bug 186791 + if use firebird ; then + my_conf="${my_conf} --with-interbase=/usr" + fi + + # LDAP support + if use ldap || phpconfutils_usecheck ldap ; then + if use oci8 ; then + phpconfutils_extension_with "ldap" "ldap" 1 "${ORACLE_HOME}" + else + phpconfutils_extension_with "ldap" "ldap" 1 + phpconfutils_extension_with "ldap-sasl" "ldap-sasl" 0 + fi + fi + + # MySQL support + if use mysql ; then + phpconfutils_extension_with "mysql" "mysql" 1 "/usr" + phpconfutils_extension_with "mysql-sock" "mysql" 0 "/var/run/mysqld/mysqld.sock" + fi + + # MySQLi support + phpconfutils_extension_with "mysqli" "mysqli" 1 "/usr/bin/mysql_config" + + # ODBC support + if use odbc || phpconfutils_usecheck odbc ; then + phpconfutils_extension_with "unixODBC" "odbc" 1 "/usr" + + phpconfutils_extension_with "adabas" "adabas" 1 + phpconfutils_extension_with "birdstep" "birdstep" 1 + phpconfutils_extension_with "dbmaker" "dbmaker" 1 + phpconfutils_extension_with "empress" "empress" 1 + if use empress || phpconfutils_usecheck empress ; then + phpconfutils_extension_with "empress-bcs" "empress-bcs" 0 + fi + phpconfutils_extension_with "esoob" "esoob" 1 + phpconfutils_extension_with "ibm-db2" "db2" 1 + phpconfutils_extension_with "iodbc" "iodbc" 1 "/usr" + phpconfutils_extension_with "sapdb" "sapdb" 1 + phpconfutils_extension_with "solid" "solid" 1 + fi + + # Oracle support + if use oci8 ; then + phpconfutils_extension_with "oci8" "oci8" 1 + fi + if use oci8-instant-client ; then + OCI8IC_PKG="`best_version dev-db/oracle-instantclient-basic`" + OCI8IC_PKG="`printf ${OCI8IC_PKG} | sed -e 's|dev-db/oracle-instantclient-basic-||g' | sed -e 's|-r.*||g'`" + phpconfutils_extension_with "oci8" "oci8-instant-client" 1 "instantclient,/usr/lib/oracle/${OCI8IC_PKG}/client/lib" + fi + + # PDO support + if use pdo || phpconfutils_usecheck pdo ; then + phpconfutils_extension_with "pdo-dblib" "mssql" 1 + # The PDO-Firebird driver is broken and unmaintained upstream + # phpconfutils_extension_with "pdo-firebird" "firebird" 1 + phpconfutils_extension_with "pdo-mysql" "mysql" 1 "/usr" + if use oci8 ; then + phpconfutils_extension_with "pdo-oci" "oci8" 1 + fi + if use oci8-instant-client ; then + OCI8IC_PKG="`best_version dev-db/oracle-instantclient-basic`" + OCI8IC_PKG="`printf ${OCI8IC_PKG} | sed -e 's|dev-db/oracle-instantclient-basic-||g' | sed -e 's|-r.*||g'`" + phpconfutils_extension_with "pdo-oci" "oci8-instant-client" 1 "instantclient,/usr,${OCI8IC_PKG}" + fi + phpconfutils_extension_with "pdo-odbc" "odbc" 1 "unixODBC,/usr" + phpconfutils_extension_with "pdo-pgsql" "postgres" 1 + phpconfutils_extension_with "pdo-sqlite" "sqlite" 1 "/usr" + fi + + # readline/libedit support + # You can use readline or libedit, but you can't use both + phpconfutils_extension_with "readline" "readline" 0 + phpconfutils_extension_with "libedit" "libedit" 0 + + # Session support + if ! use session && ! phpconfutils_usecheck session ; then + phpconfutils_extension_disable "session" "session" 0 + else + phpconfutils_extension_with "mm" "sharedmem" 0 + fi + + # SQLite support + if ! use sqlite && ! phpconfutils_usecheck sqlite ; then + phpconfutils_extension_without "sqlite" "sqlite" 0 + else + phpconfutils_extension_with "sqlite" "sqlite" 0 "/usr" + phpconfutils_extension_enable "sqlite-utf8" "unicode" 0 + fi + + # Fix ELF-related problems + if use pic || phpconfutils_usecheck pic ; then + einfo "Enabling PIC support" + my_conf="${my_conf} --with-pic" + fi + + # Catch CFLAGS problems + php_check_cflags + + # multilib support + if [[ $(get_libdir) != lib ]] ; then + my_conf="--with-libdir=$(get_libdir) ${my_conf}" + fi + + # Support user-passed configuration parameters + [[ -z "${EXTRA_ECONF}" ]] && EXTRA_ECONF="" + + # Set the correct compiler for cross-compilation + tc-export CC + + # We don't use econf, because we need to override all of its settings + ./configure --prefix=${destdir} --host=${CHOST} --mandir=${destdir}/man --infodir=${destdir}/info --sysconfdir=/etc --cache-file=./config.cache ${my_conf} ${EXTRA_ECONF} || die "configure failed" + emake || die "make failed" +} + +# @FUNCTION: php5_2-sapi_src_install +# @DESCRIPTION: +# Takes care of installing php (and its shared extensions if enabled). +php5_2-sapi_src_install() { + destdir=/usr/$(get_libdir)/php5 + + cd "${S}" + + addpredict /usr/share/snmp/mibs/.index + + # Install PHP + emake -j1 INSTALL_ROOT="${D}" install-build install-headers install-programs || die "make install failed" + + # Install missing header files + if use unicode || phpconfutils_usecheck unicode ; then + dodir ${destdir}/include/php/ext/mbstring + insinto ${destdir}/include/php/ext/mbstring + for x in `ls "${S}/ext/mbstring/"*.h` ; do + file=`basename ${x}` + doins ext/mbstring/${file} + done + dodir ${destdir}/include/php/ext/mbstring/oniguruma + insinto ${destdir}/include/php/ext/mbstring/oniguruma + for x in `ls "${S}/ext/mbstring/oniguruma/"*.h` ; do + file=`basename ${x}` + doins ext/mbstring/oniguruma/${file} + done + dodir ${destdir}/include/php/ext/mbstring/libmbfl/mbfl + insinto ${destdir}/include/php/ext/mbstring/libmbfl/mbfl + for x in `ls "${S}/ext/mbstring/libmbfl/mbfl/"*.h` ; do + file=`basename ${x}` + doins ext/mbstring/libmbfl/mbfl/${file} + done + fi + + # Get the extension dir, if not already defined + [[ -z "${PHPEXTDIR}" ]] && PHPEXTDIR="`"${D}/${destdir}/bin/php-config" --extension-dir`" + + # And install the modules to it + if use sharedext ; then + for x in `ls "${S}/modules/"*.so | sort` ; do + module=`basename ${x}` + modulename=${module/.so/} + insinto "${PHPEXTDIR}" + einfo "Installing PHP ${modulename} extension" + doins "modules/${module}" + done + fi + + # Generate the USE file for PHP + phpconfutils_generate_usefile + + # Create the directory where we'll put php5-only php scripts + keepdir /usr/share/php5 +} + +# @FUNCTION: php5_2-sapi_pkg_postinst +# @DESCRIPTION: +# Provides important information to users after install is finished. +php5_2-sapi_pkg_postinst() { + ewarn "If you have additional third party PHP extensions (such as" + ewarn "dev-php5/phpdbg) you may need to recompile them now." + ewarn + + if use sharedext ; then + ewarn "Make sure to use etc-update or dispatch-conf so that extension-specific" + ewarn "ini files get merged properly" + ewarn + fi + + if has kolab ${IUSE} && use kolab ; then + ewarn "Please note that kolab support is still experimental!" + ewarn "Issues specific to USE=kolab must be reported to Gentoo bugzilla only!" + ewarn + ewarn "Kolab groupware server requires annotations support for IMAP, which is enabled" + ewarn "by a third-party patch. Please do NOT report issues with the imap extension" + ewarn "to bugs.php.net until you have recompiled both PHP and net-libs/c-client" + ewarn "with USE=\"-kolab\" and confirmed that those issues still exist!" + ewarn + fi + + ewarn "USE=\"pic\" slows down PHP but has to be enabled on setups where TEXTRELs" + ewarn "are disabled (e.g. when using PaX in the kernel). On hardened profiles this" + ewarn "USE flag is enabled automatically" + ewarn +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/phpconfutils.eclass b/sdk_container/src/third_party/portage-stable/eclass/phpconfutils.eclass new file mode 100644 index 0000000000..e651c4426c --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/phpconfutils.eclass @@ -0,0 +1,463 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/phpconfutils.eclass,v 1.9 2008/01/06 19:30:24 swegener Exp $ +# +# ######################################################################## +# +# Based on Stuart's work on the original confutils eclass +# +# Author(s): Luca Longinotti +# +# ======================================================================== + +# @ECLASS: phpconfutils.eclass +# @MAINTAINER: +# Gentoo PHP team +# @BLURB: Provides utility functions to help with configuring PHP. +# @DESCRIPTION: +# This eclass provides utility functions to help with configuring PHP. +# It is only used by other php eclasses currently and the functions +# are not generally intended for direct use in ebuilds. + + +# ======================================================================== +# List of USE flags that need deps that aren't yet in Portage +# or that can't be (fex. certain commercial apps) +# +# You must define PHPCONFUTILS_MISSING_DEPS if you need this + +# ======================================================================== +# phpconfutils_sort_flags() +# +# Sort and remove duplicates of the auto-enabled USE flags +# + +phpconfutils_sort_flags() { + # Sort the list of auto-magically enabled USE flags + PHPCONFUTILS_AUTO_USE="$(echo ${PHPCONFUTILS_AUTO_USE} | tr '\040\010' '\012\012' | sort -u)" +} + +# ======================================================================== +# phpconfutils_init() +# +# Call this function from your src_compile() function to initialise +# this eclass first +# + +phpconfutils_init() { + # Define wheter we shall support shared extensions or not + if use "sharedext" ; then + shared="=shared" + else + shared="" + fi + + phpconfutils_sort_flags +} + +# ======================================================================== +# phpconfutils_usecheck() +# +# Check if the USE flag we want enabled is part of the auto-magical ones +# + +phpconfutils_usecheck() { + local x + local use="$1" + + for x in ${PHPCONFUTILS_AUTO_USE} ; do + if [[ "${use}+" == "${x}+" ]] ; then + return 0 + fi + done + + # If we get here, the USE is not among the auto-enabled ones + return 1 +} + +# ======================================================================== +# phpconfutils_require_any() +# +# Use this function to ensure one or more of the specified USE flags have +# been enabled and output the results +# +# $1 - message to output everytime a flag is found +# $2 - message to output everytime a flag is not found +# $3 .. - flags to check +# + +phpconfutils_require_any() { + local success_msg="$1" + shift + local fail_msg="$1" + shift + + local required_flags="$@" + local default_flag="$1" + local success="0" + + while [[ -n "$1" ]] ; do + if use "$1" ; then + einfo "${success_msg} $1" + success="1" + else + einfo "${fail_msg} $1" + fi + shift + done + + # Did we find what we are looking for? + if [[ "${success}" == "1" ]] ; then + return + fi + + # If we get here, then none of the required USE flags were enabled + eerror + eerror "You should 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}" + eerror + eerror "The ${default_flag} USE flag was automatically enabled now." + eerror + PHPCONFUTILS_AUTO_USE="${PHPCONFUTILS_AUTO_USE} ${default_flag}" +} + +# ======================================================================== +# phpconfutils_use_conflict() +# +# Use this function to automatically complain to the user if USE flags +# that directly conflict have been enabled +# +# $1 - flag that conflicts with other flags +# $2 .. - flags that conflict +# + +phpconfutils_use_conflict() { + phpconfutils_sort_flags + + if ! use "$1" && ! phpconfutils_usecheck "$1" ; then + return + fi + + local my_flag="$1" + shift + + local my_present="" + local my_remove="" + + while [[ "$1+" != "+" ]] ; do + if use "$1" || phpconfutils_usecheck "$1" ; then + my_present="${my_present} $1" + my_remove="${my_remove} -$1" + fi + shift + done + + if [[ -n "${my_present}" ]] ; then + eerror + 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 + die "Conflicting USE flags found" + fi +} + +# ======================================================================== +# phpconfutils_use_depend_all() +# +# Use this function to specify USE flags that depend on eachother, +# they will be automatically enabled and used for checks later +# +# $1 - flag that depends on other flags +# $2 .. - the flags that must be set for $1 to be valid +# + +phpconfutils_use_depend_all() { + phpconfutils_sort_flags + + if ! use "$1" && ! phpconfutils_usecheck "$1" ; then + return + fi + + local my_flag="$1" + shift + + local my_missing="" + + while [[ "$1+" != "+" ]] ; do + if ! use "$1" && ! phpconfutils_usecheck "$1" ; then + my_missing="${my_missing} $1" + fi + shift + done + + if [[ -n "${my_missing}" ]] ; then + PHPCONFUTILS_AUTO_USE="${PHPCONFUTILS_AUTO_USE} ${my_missing}" + ewarn + ewarn "USE flag '${my_flag}' needs these additional flag(s) set:" + ewarn " ${my_missing}" + ewarn + ewarn "'${my_missing}' was automatically enabled and the required extensions will be" + ewarn "built. In any case it is recommended to enable those flags for" + ewarn "future reference, by adding the following to /etc/portage/package.use:" + ewarn " =${CATEGORY}/${PN}-${PVR} ${my_missing}" + ewarn + fi +} + +# ======================================================================== +# phpconfutils_use_depend_any() +# +# Use this function to automatically complain to the user if a USE flag +# depends on another USE flag that hasn't been enabled +# +# $1 - flag that depends on other flags +# $2 - flag that is used as default if none is enabled +# $3 .. - flags that must be set for $1 to be valid +# + +phpconfutils_use_depend_any() { + phpconfutils_sort_flags + + if ! use "$1" && ! phpconfutils_usecheck "$1" ; then + return + fi + + local my_flag="$1" + shift + + local my_default_flag="$1" + shift + + local my_found="" + local my_missing="" + + while [[ "$1+" != "+" ]] ; do + if use "$1" || phpconfutils_usecheck "$1" ; then + my_found="${my_found} $1" + else + my_missing="${my_missing} $1" + fi + shift + done + + if [[ -z "${my_found}" ]] ; then + PHPCONFUTILS_AUTO_USE="${PHPCONFUTILS_AUTO_USE} ${my_default_flag}" + ewarn + ewarn "USE flag '${my_flag}' needs one of these additional flag(s) set:" + ewarn " ${my_missing}" + ewarn + ewarn "'${my_default_flag}' was automatically selected and enabled." + ewarn "You can change that by enabling/disabling those flags accordingly" + ewarn "in /etc/portage/package.use." + ewarn + fi +} + +# ======================================================================== +# phpconfutils_extension_disable() +# +# 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 +# +# $1 - extension name +# $2 - USE flag +# $3 - optional message to einfo() to the user +# + +phpconfutils_extension_disable() { + if ! use "$2" && ! phpconfutils_usecheck "$2" ; then + my_conf="${my_conf} --disable-$1" + [[ -n "$3" ]] && einfo " Disabling $1" + else + [[ -n "$3" ]] && einfo " Enabling $1" + fi +} + +# ======================================================================== +# phpconfutils_extension_enable() +# +# 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 +# +# $1 - extension name +# $2 - USE flag +# $3 - 1 = support shared, 0 = never support shared +# $4 - additional setting for configure +# $5 - additional message to einfo out to the user +# + +phpconfutils_extension_enable() { + local my_shared + + if [[ "$3" == "1" ]] ; then + if [[ "${shared}+" != "+" ]] ; then + my_shared="${shared}" + if [[ "$4+" != "+" ]] ; then + my_shared="${my_shared},$4" + fi + elif [[ "$4+" != "+" ]] ; then + my_shared="=$4" + fi + else + if [[ "$4+" != "+" ]] ; then + my_shared="=$4" + fi + fi + + if use "$2" || phpconfutils_usecheck "$2" ; then + my_conf="${my_conf} --enable-$1${my_shared}" + einfo " Enabling $1" + else + my_conf="${my_conf} --disable-$1" + einfo " Disabling $1" + fi +} + +# ======================================================================== +# phpconfutils_extension_without() +# +# 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 +# +# $1 - extension name +# $2 - USE flag +# $3 - optional message to einfo() to the user +# + +phpconfutils_extension_without() { + if ! use "$2" && ! phpconfutils_usecheck "$2" ; then + my_conf="${my_conf} --without-$1" + einfo " Disabling $1" + else + einfo " Enabling $1" + fi +} + +# ======================================================================== +# phpconfutils_extension_with() +# +# This function is a replacement for use_with. It supports building +# extensions as shared libraries, +# +# $1 - extension name +# $2 - USE flag +# $3 - 1 = support shared, 0 = never support shared +# $4 - additional setting for configure +# $5 - optional message to einfo() out to the user +# + +phpconfutils_extension_with() { + local my_shared + + if [[ "$3" == "1" ]] ; then + if [[ "${shared}+" != "+" ]] ; then + my_shared="${shared}" + if [[ "$4+" != "+" ]] ; then + my_shared="${my_shared},$4" + fi + elif [[ "$4+" != "+" ]] ; then + my_shared="=$4" + fi + else + if [[ "$4+" != "+" ]] ; then + my_shared="=$4" + fi + fi + + if use "$2" || phpconfutils_usecheck "$2" ; then + my_conf="${my_conf} --with-$1${my_shared}" + einfo " Enabling $1" + else + my_conf="${my_conf} --without-$1" + einfo " Disabling $1" + fi +} + +# ======================================================================== +# phpconfutils_warn_about_external_deps() +# +# This will output a warning to the user if he enables commercial or other +# software not currently present in Portage +# + +phpconfutils_warn_about_external_deps() { + phpconfutils_sort_flags + + local x + local my_found="0" + + for x in ${PHPCONFUTILS_MISSING_DEPS} ; do + if use "${x}" || phpconfutils_usecheck "${x}" ; then + ewarn "USE flag ${x} enables support for software not present in Portage!" + my_found="1" + fi + done + + if [[ "${my_found}" == "1" ]] ; then + ewarn + ewarn "This ebuild will continue, but if you haven't already installed the" + ewarn "software required to satisfy the list above, this package will probably" + ewarn "fail to compile later on." + ewarn "*DO NOT* file bugs about compile failures or issues you're having" + ewarn "when using one of those flags, as we aren't able to support them." + ewarn "|=|=|=|=|=|=| You are on your own if you use them! |=|=|=|=|=|=|" + ewarn + ebeep 5 + fi +} + +# ======================================================================== +# phpconfutils_built_with_use() +# +# Sobstitute for built_with_use() to support the magically enabled USE flags +# + +phpconfutils_built_with_use() { + local opt="$1" + [[ ${opt:0:1} = "-" ]] && shift || opt="-a" + + local PHP_PKG=$(best_version $1) + shift + + local PHP_USEFILE="${ROOT}/var/lib/php-pkg/${PHP_PKG}/PHP_USEFILE" + + [[ ! -e "${PHP_USEFILE}" ]] && return 0 + + local PHP_USE_BUILT=$(<${PHP_USEFILE}) + while [[ $# -gt 0 ]] ; do + if [[ ${opt} = "-o" ]] ; then + has $1 ${PHP_USE_BUILT} && return 0 + else + has $1 ${PHP_USE_BUILT} || return 1 + fi + shift + done + [[ ${opt} = "-a" ]] +} + +# ======================================================================== +# phpconfutils_generate_usefile() +# +# Generate the file used by phpconfutils_built_with_use() to check it's +# USE flags +# + +phpconfutils_generate_usefile() { + phpconfutils_sort_flags + + local PHP_USEFILE="${D}/var/lib/php-pkg/${CATEGORY}/${PN}-${PVR}/PHP_USEFILE" + + # Write the auto-enabled USEs into the correct file + dodir "/var/lib/php-pkg/${CATEGORY}/${PN}-${PVR}/" + echo "${PHPCONFUTILS_AUTO_USE}" > "${PHP_USEFILE}" +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/poppler.eclass b/sdk_container/src/third_party/portage-stable/eclass/poppler.eclass new file mode 100644 index 0000000000..722ef7d3d6 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/poppler.eclass @@ -0,0 +1,197 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/poppler.eclass,v 1.6 2010/01/03 19:10:49 scarabeus Exp $ + +# @ECLASS: poppler.eclass +# @MAINTAINER: +# Peter Alfredsen +# @BLURB: Reduces code duplication in the modularized poppler ebuilds. +# @DESCRIPTION: +# Provides an easy template for making modularized poppler-based ebuilds. + +inherit base multilib libtool + +has 2 ${EAPI} || DEPEND="EAPI-TOO-OLD" + +EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install + +RDEPEND=" + !app-text/poppler + !app-text/poppler-bindings + " +DEPEND=" + dev-util/pkgconfig + userland_GNU? ( >=sys-apps/findutils-4.4.0 ) + " + + +# @ECLASS-VARIABLE: HOMEPAGE +# @DESCRIPTION: +# Default HOMEPAGE +HOMEPAGE="http://poppler.freedesktop.org/" + +# @ECLASS-VARIABLE: SRC_URI +# @DESCRIPTION: +# Default SRC_URI +SRC_URI="http://poppler.freedesktop.org/poppler-${PV}.tar.gz" + +# @ECLASS-VARIABLE: S +# @DESCRIPTION: +# Default working directory +S=${WORKDIR}/poppler-${PV} + +# @ECLASS-VARIABLE: POPPLER_MODULE +# @DESCRIPTION: +# The name of the poppler module. Must be set by the ebuild before inheriting +# the poppler eclass. +POPPLER_MODULE=${POPPLER_MODULE} + +# @ECLASS-VARIABLE: POPPLER_MODULE_S +# @DESCRIPTION: +# The working directory of the poppler module. +POPPLER_MODULE_S=${S}/${POPPLER_MODULE} + +# @FUNCTION: pkg_check_modules_override +# @USAGE: [package1] [package2] +# @DESCRIPTION: +# Will export the appropriate variables to override PKG_CHECK_MODULES autoconf +# macros, with the string " " by default. If packages are specified, they will +# be looked up with pkg-config and the appropriate LIBS and CFLAGS substituted. +# LIBS and CFLAGS can also be specified per-package with the following syntax: +# @CODE +# package=LIBS%CFLAGS +# @CODE +# = and % have no effect unless both are specified. +# Here is an example: +# @CODE +# pkg_check_modules_override GASH "gtk+-2.0=-jule%" gobject-2.0 +# @CODE +# The above example will do: +# @CODE +# export GASH_CFLAGS+=" -jule" +# export GASH_LIBS+=" " +# export GASH_CFLAGS+=" $(pkg-config --cflags gobject-2.0)" +# export GASH_LIBS+=" $(pkg-config --libs gobject-2.0)" +# @CODE +# +# NOTE: If a package is not found, the string " " will be inserted in place of +# _CFLAGS and _LIBS +pkg_check_modules_override() { + local package + local group="${1}" + local packages="${*:2}" + export ${group}_CFLAGS=" " + export ${group}_LIBS=" " + + if [[ ${#@} -lt 1 ]] + then + eerror "${FUNCNAME[0]} requires at least one parameter: GROUP" + eerror "PKG_CHECK_MODULES(GROUP, package1 package2 etc)" + die "${FUNCNAME[0]} requires at least one parameter: GROUP" + fi + + for package in $packages + do + if [[ ${package/=} != ${package} && ${package/\%} != ${package} ]] + then + package_cflag_libs=${package##*=} + export ${group}_CFLAGS+=" ${package_cflag_libs%%\%*}" + export ${group}_LIBS+=" ${package_cflag_libs##*\%}" + else + if pkg-config --exists $package + then + export ${group}_CFLAGS+=" $(pkg-config --cflags $package)" + export ${group}_LIBS+=" $(pkg-config --libs $package)" + else + export ${group}_CFLAGS+=" " + export ${group}_LIBS+=" " + fi + fi + done +} +# @FUNCTION: poppler_src_unpack +# @USAGE: +# @DESCRIPTION: +# Runs unpack ${A} +poppler_src_unpack() { + unpack ${A} +} + +# @FUNCTION: poppler_src_prepare +# @USAGE: +# @DESCRIPTION: +# Runs autopatch from base.eclass. +# Uses sed to replace libpoppler.la references with -lpoppler +poppler_src_prepare() { + base_src_prepare + sed -i \ + -e 's#$(top_builddir)/poppler/libpoppler.la#-lpoppler#' \ + $(find . -type f -name 'Makefile.in') || die "Failed to sed proper lib into Makefile.am" + elibtoolize +} + +# @FUNCTION: poppler_src_configure +# @USAGE: +# @DESCRIPTION: +# Makes sure we get a uniform Makefile environment by using pkg_check_modules_override to +# fill out some blanks that configure wants filled. Probably not really needed, but +# insures against future breakage. +# Calls econf with some defaults. +poppler_src_configure() { + pkg_check_modules_override CAIRO cairo + pkg_check_modules_override POPPLER_GLIB glib-2.0 + pkg_check_modules_override POPPLER_QT4 QtCore QtGui QtXml + pkg_check_modules_override POPPLER_QT4_TEST QtTest + pkg_check_modules_override ABIWORD libxml-2.0 + pkg_check_modules_override GTK_TEST gtk+-2.0 gdk-pixbuf-2.0 libglade-2.0 gthread-2.0 + pkg_check_modules_override POPPLER_GLIB glib-2.0 gobject-2.0 + + econf --disable-static \ + --enable-poppler-qt4 \ + --enable-poppler-glib \ + --enable-xpdf-headers \ + --enable-libjpeg \ + --enable-libopenjpeg \ + --enable-zlib \ + --enable-splash-output \ + ${POPPLER_CONF} +} + +# @FUNCTION: poppler_src_compile +# @USAGE: +# @DESCRIPTION: +# Removes top_srcdir Makefile to ensure that no accidental recursion happens. The build +# will just die if it tries to go through top_srcdir. +# Runs emake "$@" in POPPLER_MODULE_S +poppler_src_compile() { + rm -f "${S}"/Makefile* &> /dev/null + cd "${POPPLER_MODULE_S}" || die "POPPLER_MODULE_S=${POPPLER_MODULE_S} - cd failed" + einfo "Now in $POPPLER_MODULE_S" + emake "$@" || die "emake failed" +} + +# @FUNCTION: poppler_src_install +# @USAGE: +# @DESCRIPTION: +# Runs emake DESTDIR="${D}" ${@:-install} in POPPLER_MODULE_S +# Removes .la files. +poppler_src_install() { + cd "${POPPLER_MODULE_S}" + emake DESTDIR="${D}" ${@:-install} || die "make install failed" + for pfile in "${POPPLER_PKGCONFIG[@]}" + do + insinto /usr/$(get_libdir)/pkgconfig + if [[ ${pfile/=} != ${pfile} ]] + then + if use ${pfile%=*} + then + pfile=${pfile#*=} + else + pfile=false + fi + fi + [[ ${pfile} != "false" ]] && doins "${S}/${pfile}" + done + + find "${D}" -type f -name '*.la' -exec rm -rf '{}' '+' || die "la removal failed" +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/portability.eclass b/sdk_container/src/third_party/portage-stable/eclass/portability.eclass new file mode 100644 index 0000000000..8d7e362967 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/portability.eclass @@ -0,0 +1,168 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/portability.eclass,v 1.15 2010/02/26 18:09:43 grobian Exp $ +# +# Author: Diego Pettenò +# +# This eclass is created to avoid using non-portable GNUisms inside ebuilds +# +# NB: If you add anything, please comment it! + +# treecopy orig1 orig2 orig3 .... dest +# +# mimic cp --parents copy, but working on BSD userland as well +treecopy() { + dest=${!#} + files_count=$# + + while(( $# > 1 )); do + dirstruct=$(dirname "$1") + mkdir -p "${dest}/${dirstruct}" + cp -pPR "$1" "${dest}/${dirstruct}" + + shift + done +} + +# seq min max +# +# compatibility function that mimes seq command if not available +seq() { + local p=$(type -P seq) + + case $# in + 1) min=1 max=$1 step=1 ;; + 2) min=$1 max=$2 step=1 ;; + 3) min=$1 max=$3 step=$2 ;; + *) die "seq called with wrong number of arguments" ;; + esac + + if [[ -z ${p} ]] ; then + local reps + # BSD userland + if [[ ${step} != 0 ]]; then + reps=$(( ($max-$min) / $step +1 )) + else + reps=0 + fi + + jot $reps $min $max $step + else + "${p}" $min $step $max + fi +} + +# Gets the linker flag to link to dlopen() function +dlopen_lib() { + # - Solaris needs nothing + # - Darwin needs nothing + # - *BSD needs nothing + # - Linux needs -ldl (glibc and uclibc) + # - Interix needs -ldl + case "${CHOST}" in + *-linux-gnu*|*-linux-uclibc|*-interix*) + echo "-ldl" + ;; + esac +} + +# Gets the home directory for the specified user +# it's a wrap around egetent as the position of the home directory in the line +# varies depending on the os used. +# +# To use that, inherit eutils, not portability! +egethome() { + ent=$(egetent passwd $1) + + case ${CHOST} in + *-darwin*|*-freebsd*|*-dragonfly*) + # Darwin, OSX, FreeBSD and DragonFly use position 9 to store homedir + echo ${ent} | cut -d: -f9 + ;; + *) + # Linux, NetBSD and OpenBSD use position 6 instead + echo ${ent} | cut -d: -f6 + ;; + esac +} + +# Gets the shell for the specified user +# it's a wrap around egetent as the position of the home directory in the line +# varies depending on the os used. +# +# To use that, inherit eutils, not portability! +egetshell() { + ent=$(egetent passwd "$1") + + case ${CHOST} in + *-darwin*|*-freebsd*|*-dragonfly*) + # Darwin, OSX, FreeBSD and DragonFly use position 9 to store homedir + echo ${ent} | cut -d: -f10 + ;; + *) + # Linux, NetBSD and OpenBSD use position 6 instead + echo ${ent} cut -d: -f7 + ;; + esac +} + +# Returns true if specified user has a shell that precludes logins +# on whichever operating system. +is-login-disabled() { + shell=$(egetshell "$1") + + case ${shell} in + /bin/false|/usr/bin/false|/sbin/nologin|/usr/sbin/nologin) + return 0 ;; + *) + return 1 ;; + esac +} + +# Gets the name of the BSD-ish make command (pmake from NetBSD) +# +# This will return make (provided by system packages) for BSD userlands, +# or bsdmake for Darwin userlands and pmake for the rest of userlands, +# both of which are provided by sys-devel/pmake package. +# +# Note: the bsdmake for Darwin userland is with compatibility with MacOSX +# default name. +get_bmake() { + if [[ ${USERLAND} == *BSD ]]; then + echo make + elif [[ ${USERLAND} == "Darwin" ]]; then + echo bsdmake + else + echo pmake + fi +} + +# Portable method of getting mount names and points. +# Returns as "point node fs options" +# Remember to convert 040 back to a space. +get_mounts() { + local point= node= fs= opts= foo= + + # Linux has /proc/mounts which should always exist + if [[ $(uname -s) == "Linux" ]] ; then + while read node point fs opts foo ; do + echo "${point} ${node} ${fs} ${opts}" + done < /proc/mounts + return + fi + + # OK, pray we have a -p option that outputs mounts in fstab format + # using tabs as the seperator. + # Then pray that there are no tabs in the either. + # Currently only FreeBSD supports this and the other BSDs will + # have to be patched. + # Athough the BSD's may support /proc, they do NOT put \040 in place + # of the spaces and we should not force a /proc either. + local IFS=$'\t' + LC_ALL=C mount -p | while read node point fs foo ; do + opts=${fs#* } + fs=${fs%% *} + echo "${point// /\040} ${node// /\040} ${fs%% *} ${opts// /\040}" + done +} + diff --git a/sdk_container/src/third_party/portage-stable/eclass/prefix.eclass b/sdk_container/src/third_party/portage-stable/eclass/prefix.eclass new file mode 100644 index 0000000000..a347df74c7 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/prefix.eclass @@ -0,0 +1,52 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id: prefix.eclass,v 1.3 2009/11/16 21:39:00 grobian Exp $ + +# @ECLASS: prefix.eclass +# @MAINTAINER: +# Feel free to contact the Prefix team through if +# you have problems, suggestions or questions. +# @BLURB: Eclass to provide Prefix functionality +# @DESCRIPTION: +# Gentoo Prefix allows users to install into a self defined offset +# located somewhere in the filesystem. Prefix ebuilds require +# additional functions and variables which are defined by this eclass. + +# @ECLASS-VARIABLE: EPREFIX +# @DESCRIPTION: +# The offset prefix of a Gentoo Prefix installation. When Gentoo Prefix +# is not used, ${EPREFIX} should be "". Prefix Portage sets EPREFIX, +# hence this eclass has nothing to do here in that case. +# Note that setting EPREFIX in the environment with Prefix Portage sets +# Portage into cross-prefix mode. +if [[ ! ${EPREFIX+set} ]]; then + export EPREFIX='' +fi + + +# @FUNCTION: eprefixify +# @USAGE: +# @DESCRIPTION: +# replaces @GENTOO_PORTAGE_EPREFIX@ with ${EPREFIX} for the given files, +# dies if no arguments are given, a file does not exist, or changing a +# file failed. +eprefixify() { + [[ $# -lt 1 ]] && die "at least one argument required" + + einfo "Adjusting to prefix ${EPREFIX:-/}" + local x + for x in "$@" ; do + if [[ -e ${x} ]] ; then + ebegin " ${x##*/}" + sed -i -e "s|@GENTOO_PORTAGE_EPREFIX@|${EPREFIX}|g" "${x}" + eend $? || die "failed to eprefixify ${x}" + else + die "${x} does not exist" + fi + done + + return 0 +} + + +# vim: tw=72: diff --git a/sdk_container/src/third_party/portage-stable/eclass/qmail.eclass b/sdk_container/src/third_party/portage-stable/eclass/qmail.eclass new file mode 100644 index 0000000000..fbc028ac3f --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/qmail.eclass @@ -0,0 +1,528 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/qmail.eclass,v 1.1 2008/04/06 17:05:27 hollow Exp $ + +# @ECLASS: qmail.eclass +# @MAINTAINER: qmail@gentoo.org +# @BLURB: common qmail functions + +inherit flag-o-matic toolchain-funcs fixheadtails +DESCRIPTION="Based on the ${ECLASS} eclass" + +# hardcoded paths +QMAIL_HOME="/var/qmail" +TCPRULES_DIR="/etc/tcprules.d" +SUPERVISE_DIR="/var/qmail/supervise" + +# source files and directories +GENQMAIL_F=genqmail-${GENQMAIL_PV}.tar.bz2 +GENQMAIL_S="${WORKDIR}"/genqmail-${GENQMAIL_PV} + +QMAIL_SPP_F=qmail-spp-${QMAIL_SPP_PV}.tar.gz +QMAIL_SPP_S="${WORKDIR}"/qmail-spp-${QMAIL_SPP_PV} + +# @FUNCTION: primes +# @USAGE: +# @DESCRIPTION: +# Prints a list of primes between min and max inclusive +# Note: this functions gets very slow when used with large numbers. +primes() { + local min=${1} max=${2} + local result= primelist=2 i p + + [[ ${min} -le 2 ]] && result="${result} 2" + + for ((i = 3; i <= max; i += 2)) + do + for p in ${primelist} + do + [[ $[i % p] == 0 || $[p * p] -gt ${i} ]] && \ + break + done + if [[ $[i % p] != 0 ]] + then + primelist="${primelist} ${i}" + [[ ${i} -ge ${min} ]] && \ + result="${result} ${i}" + fi + done + + echo ${result} +} + +# @FUNCTION: is_prima +# @USAGE: +# @DESCRIPTION: +# Checks wether a number is a prime number +is_prime() { + local number=${1} i + for i in $(primes ${number} ${number}) + do + [[ ${i} == ${number} ]] && return 0 + done + return 1 +} + +dospp() { + insinto "${QMAIL_HOME}"/plugins/ + insopts -o root -g root -m 0755 + newins $1 ${2:-$(basename $1)} +} + +# @FUNCTION: dosupervise +# @USAGE: dosupervise [ ] +# @DESCRIPTION: +# Install runfiles for services and logging to supervise directory +dosupervise() { + local service=$1 + local runfile=${2:-${service}} logfile=${3:-${service}-log} + [[ -z "${service}" ]] && die "no service given" + + insopts -o root -g root -m 0755 + diropts -o root -g root -m 0755 + + dodir ${SUPERVISE_DIR}/${service}{,/log} + fperms +t ${SUPERVISE_DIR}/${service}{,/log} + + insinto ${SUPERVISE_DIR}/${service} + newins ${runfile} run + + insinto ${SUPERVISE_DIR}/${service}/log + newins ${logfile} run +} + +# @FUNCTION: qmail_set_cc +# @DESCRIPTION: +# The following commands patch the conf-{cc,ld} files to use the user's +# specified CFLAGS and LDFLAGS. These rather complex commands are needed +# because a user supplied patch might apply changes to these files, too. +# See bug #165981. +qmail_set_cc() { + cc=$(head -n 1 ./conf-cc | sed -e "s#^g\?cc\s\+\(-O2\)\?#$(tc-getCC) #") + ld=$(head -n 1 ./conf-ld | sed -e "s#^g\?cc\s\+\(-s\)\?#$(tc-getCC) #") + + echo "${cc} ${CFLAGS}" > ./conf-cc || die 'Patching conf-cc failed.' + echo "${ld} ${LDFLAGS}" > ./conf-ld || die 'Patching conf-ld failed.' +} + +# @FUNCTION: qmail_create_users +# @DESCRIPTION: +# Keep qmail groups in sync across ebuilds +qmail_create_groups() { + einfo "Creating qmail groups" + enewgroup nofiles 200 + enewgroup qmail 201 +} + +# @FUNCTION: qmail_create_users +# @DESCRIPTION: +# Keep qmail users in sync across ebuilds +qmail_create_users() { + qmail_create_groups + + einfo "Creating qmail users" + enewuser alias 200 -1 "${QMAIL_HOME}"/alias 200 + enewuser qmaild 201 -1 "${QMAIL_HOME}" 200 + enewuser qmaill 202 -1 "${QMAIL_HOME}" 200 + enewuser qmailp 203 -1 "${QMAIL_HOME}" 200 + enewuser qmailq 204 -1 "${QMAIL_HOME}" 201 + enewuser qmailr 205 -1 "${QMAIL_HOME}" 201 + enewuser qmails 206 -1 "${QMAIL_HOME}" 201 +} + +genqmail_src_unpack() { + cd "${WORKDIR}" + [[ -n ${GENQMAIL_PV} ]] && unpack "${GENQMAIL_F}" +} + +qmail_spp_src_unpack() { + cd "${WORKDIR}" + [[ -n ${QMAIL_SPP_PV} ]] && unpack "${QMAIL_SPP_F}" +} + +# @FUNCTION: qmail_src_postunpack +# @DESCRIPTION: +# Unpack common config files, apply custom patches if supplied and +# set built configuration (CFLAGS, LDFLAGS, etc) +qmail_src_postunpack() { + cd "${S}" + + qmail_set_cc + + mysplit=${QMAIL_CONF_SPLIT:-23} + is_prime ${mysplit} || die "QMAIL_CONF_SPLIT is not a prime number." + einfo "Using conf-split value of ${mysplit}." + echo -n ${mysplit} > "${S}"/conf-split +} + +qmail_src_compile() { + cd "${S}" + emake it man "$@" || die "make failed" +} + +qmail_spp_src_compile() { + cd "${GENQMAIL_S}"/spp/ + emake || die "make spp failed" +} + +qmail_base_install() { + einfo "Setting up basic directory hierarchy" + diropts -o root -g qmail -m 755 + keepdir "${QMAIL_HOME}"/{,bin,control} + + einfo "Installing basic qmail software" + insinto "${QMAIL_HOME}"/bin + + insopts -o root -g qmail -m 755 + doins datemail elq forward maildir2mbox maildirmake \ + maildirwatch mailsubj pinq predate qail \ + qmail-{inject,qmqpc,showctl} sendmail + + einfo "Adding env.d entry for qmail" + doenvd "${GENQMAIL_S}"/conf/99qmail + + declare -F qmail_base_install_hook >/dev/null && \ + qmail_base_install_hook +} + +qmail_full_install() { + einfo "Setting up full directory hierarchy" + keepdir "${QMAIL_HOME}"/users + diropts -o alias -g qmail -m 755 + keepdir "${QMAIL_HOME}"/alias + + einfo "Installing all qmail software" + insopts -o root -g qmail -m 755 + doins bouncesaying condredirect config-fast except preline qbiff \ + qmail-{pop3d,qmqpd,qmtpd,qread,qstat,smtpd,tcpok,tcpto} \ + qreceipt qsmhook tcp-env + + insopts -o root -g qmail -m 711 + doins qmail-{clean,getpw,local,popup,pw2u,remote,rspawn,send} splogger + + insopts -o root -g qmail -m 700 + doins qmail-{lspawn,newmrh,newu,start} + + insopts -o qmailq -g qmail -m 4711 + doins qmail-queue + + declare -F qmail_full_install_hook >/dev/null && \ + qmail_full_install_hook +} + +qmail_config_install() { + einfo "Installing stock configuration files" + insinto "${QMAIL_HOME}"/control + insopts -o root -g root -m 644 + doins "${GENQMAIL_S}"/control/{conf-*,defaultdelivery} + + einfo "Installing configuration sanity checker and launcher" + insinto "${QMAIL_HOME}"/bin + insopts -o root -g root -m 644 + doins "${GENQMAIL_S}"/control/qmail-config-system + + declare -F qmail_config_install_hook >/dev/null && \ + qmail_config_install_hook +} + +qmail_man_install() { + einfo "Installing manpages and documentation" + + # those are tagged for section 8 but named for + # section 9 (which does not exist anyway) + for i in *.9; do + mv ${i} ${i/.9/.8} + done + + into /usr + doman *.[1578] + dodoc BLURB* CHANGES FAQ INSTALL* PIC* README* REMOVE* SECURITY \ + SENDMAIL SYSDEPS TEST* THANKS* THOUGHTS TODO* \ + UPGRADE VERSION* + + declare -F qmail_man_install_hook >/dev/null && \ + qmail_man_install_hook +} + +qmail_sendmail_install() { + einfo "Installing sendmail replacement" + diropts -m 755 + dodir /usr/sbin /usr/lib + + if use mailwrapper; then + insinto /etc/mail + doins "${GENQMAIL_S}"/conf/mailer.conf + else + dosym "${QMAIL_HOME}"/bin/sendmail /usr/sbin/sendmail + dosym "${QMAIL_HOME}"/bin/sendmail /usr/lib/sendmail + fi + + declare -F qmail_sendmail_install_hook >/dev/null && \ + qmail_sendmail_install_hook +} + +qmail_maildir_install() { + # use the correct maildirmake + # the courier-imap one has some extensions that are nicer + MAILDIRMAKE="${D}${QMAIL_HOME}/bin/maildirmake" + [[ -e /usr/bin/maildirmake ]] && \ + MAILDIRMAKE="/usr/bin/maildirmake" + + einfo "Setting up the default aliases" + diropts -o alias -g qmail -m 700 + "${MAILDIRMAKE}" "${D}${QMAIL_HOME}"/alias/.maildir + keepdir "${QMAIL_HOME}"/alias/.maildir/{cur,new,tmp} + + for i in "${QMAIL_HOME}"/alias/.qmail-{mailer-daemon,postmaster,root}; do + if [[ ! -f "${ROOT}${i}" ]]; then + touch "${D}${i}" + fowners alias:qmail "${i}" + fi + done + + einfo "Setting up default maildirs in the account skeleton" + diropts -o root -g root -m 755 + insinto /etc/skel + insopts -o root -g root -m 644 + newins "${GENQMAIL_S}"/control/defaultdelivery .qmail.sample + "${MAILDIRMAKE}" "${D}"/etc/skel/.maildir + keepdir /etc/skel/.maildir/{cur,new,tmp} + + declare -F qmail_maildir_install_hook >/dev/null && \ + qmail_maildir_install_hook +} + +qmail_tcprules_install() { + dodir "${TCPRULES_DIR}" + insinto "${TCPRULES_DIR}" + insopts -o root -g root -m 0644 + doins "${GENQMAIL_S}"/tcprules/Makefile.qmail + doins "${GENQMAIL_S}"/tcprules/tcp.qmail-* + use ssl || rm -f "${D}${TCPRULES_DIR}"/tcp.qmail-pop3sd +} + +qmail_supervise_install() { + einfo "Installing supervise scripts" + + cd "${GENQMAIL_S}"/supervise + + for i in qmail-{send,smtpd,qmtpd,qmqpd,pop3d}; do + dosupervise ${i} + diropts -o qmaill -g root -m 755 + keepdir /var/log/qmail/${i} + done + + if use ssl; then + dosupervise qmail-pop3sd + diropts -o qmaill -g root -m 755 + keepdir /var/log/qmail/qmail-pop3sd + fi + + declare -F qmail_supervise_install_hook >/dev/null && \ + qmail_supervise_install_hook +} + +qmail_spp_install() { + einfo "Installing qmail-spp configuration files" + insinto "${QMAIL_HOME}"/control/ + insopts -o root -g root -m 0644 + doins "${GENQMAIL_S}"/spp/smtpplugins + + einfo "Installing qmail-spp plugins" + keepdir "${QMAIL_HOME}"/plugins/ + for i in authlog mfdnscheck ifauthnext tarpit; do + dospp "${GENQMAIL_S}"/spp/${i} + done + + declare -F qmail_spp_install_hook >/dev/null && \ + qmail_spp_install_hook +} + +qmail_ssl_install() { + use gencertdaily && \ + CRON_FOLDER=cron.daily || \ + CRON_FOLDER=cron.hourly + + einfo "Installing SSL Certificate creation script" + insinto "${QMAIL_HOME}"/control + insopts -o root -g root -m 0644 + doins "${GENQMAIL_S}"/ssl/servercert.cnf + + insinto "${QMAIL_HOME}"/bin + insopts -o root -g root -m 0755 + doins "${GENQMAIL_S}"/ssl/mkservercert + + einfo "Installing RSA key generation cronjob" + insinto /etc/${CRON_FOLDER} + insopts -o root -g root -m 0755 + doins "${GENQMAIL_S}"/ssl/qmail-genrsacert.sh + + keepdir "${QMAIL_HOME}"/control/tlshosts + + declare -F qmail_ssl_install_hook >/dev/null && \ + qmail_ssl_install_hook +} + +qmail_src_install() { + qmail_base_install + qmail_full_install + qmail_config_install + qmail_man_install + qmail_sendmail_install + qmail_maildir_install + qmail_tcprules_install + qmail_supervise_install + + use qmail-spp && qmail_spp_install + use ssl && qmail_ssl_install +} + +qmail_queue_setup() { + if use highvolume; then + myconf="--bigtodo" + else + myconf="--no-bigtodo" + fi + + mysplit=${QMAIL_CONF_SPLIT:-23} + is_prime ${mysplit} || die "QMAIL_CONF_SPLIT is not a prime number." + + einfo "Setting up the message queue hierarchy" + /usr/bin/queue-repair.py --create ${myconf} \ + --split ${mysplit} \ + "${ROOT}${QMAIL_HOME}" >/dev/null || \ + die 'queue-repair failed' +} + +qmail_rootmail_fixup() { + local TMPCMD="ln -sf ${QMAIL_HOME}/alias/.maildir/ ${ROOT}/root/.maildir" + + if [[ -d "${ROOT}"/root/.maildir && ! -L "${ROOT}"/root/.maildir ]] ; then + elog "Previously the qmail ebuilds created /root/.maildir/ but not" + elog "every mail was delivered there. If the directory does not" + elog "contain any mail, please delete it and run:" + elog "${TMPCMD}" + else + ${TMPCMD} + fi + + chown -R alias:qmail "${ROOT}${QMAIL_HOME}"/alias/.maildir 2>/dev/null +} + +qmail_tcprules_fixup() { + mkdir -p "${TCPRULES_DIR}" + for f in {smtp,qmtp,qmqp,pop3}{,.cdb}; do + old="/etc/tcp.${f}" + new="${TCPRULES_DIR}/tcp.qmail-${f}" + fail=0 + if [[ -f "${old}" && ! -f "${new}" ]]; then + einfo "Moving ${old} to ${new}" + cp "${old}" "${new}" || fail=1 + else + fail=1 + fi + if [[ "${fail}" = 1 && -f "${old}" ]]; then + eerror "Error moving ${old} to ${new}, be sure to check the" + eerror "configuration! You may have already moved the files," + eerror "in which case you can delete ${old}" + fi + done +} + +qmail_tcprules_build() { + for f in tcp.qmail-{smtp,qmtp,qmqp,pop3,pop3s}; do + # please note that we don't check if it exists + # as we want it to make the cdb files anyway! + src="${ROOT}${TCPRULES_DIR}/${f}" + cdb="${ROOT}${TCPRULES_DIR}/${f}.cdb" + tmp="${ROOT}${TCPRULES_DIR}/.${f}.tmp" + [[ -e "${src}" ]] && tcprules "${cdb}" "${tmp}" < "${src}" + done +} + +qmail_config_notice() { + elog + elog "To setup ${PN} to run out-of-the-box on your system, run:" + elog "emerge --config =${CATEGORY}/${PF}" +} + +qmail_supervise_config_notice() { + elog + elog "To start qmail at boot you have to add svscan to your startup" + elog "and create the following links:" + elog "ln -s ${SUPERVISE_DIR}/qmail-send /service/qmail-send" + elog "ln -s ${SUPERVISE_DIR}/qmail-smtpd /service/qmail-smtpd" + elog + elog "To start the pop3 server as well, create the following link:" + elog "ln -s ${SUPERVISE_DIR}/qmail-pop3d /service/qmail-pop3d" + elog + if use ssl; then + elog "To start the pop3s server as well, create the following link:" + elog "ln -s ${SUPERVISE_DIR}/qmail-pop3sd /service/qmail-pop3sd" + elog + fi + elog "Additionally, the QMTP and QMQP protocols are supported, " + elog "and can be started as:" + elog "ln -s ${SUPERVISE_DIR}/qmail-qmtpd /service/qmail-qmtpd" + elog "ln -s ${SUPERVISE_DIR}/qmail-qmqpd /service/qmail-qmqpd" + elog + elog "Additionally, if you wish to run qmail right now, you should " + elog "run this before anything else:" + elog "source /etc/profile" +} + +qmail_config_fast() { + if [[ ${ROOT} = / ]]; then + local host=$(hostname --fqdn) + + if [[ -z "${host}" ]]; then + eerror + eerror "Cannot determine your fully-qualified hostname" + eerror "Please setup your /etc/hosts as described in" + eerror "http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=8#doc_chap2_sect4" + eerror + die "cannot determine FQDN" + fi + + if [[ ! -f "${ROOT}${QMAIL_HOME}"/control/me ]]; then + "${ROOT}${QMAIL_HOME}"/bin/config-fast ${host} + fi + else + ewarn "Skipping some configuration as it MUST be run on the final host" + fi +} + +qmail_tcprules_config() { + einfo "Accepting relaying by default from all ips configured on this machine." + LOCALIPS=$(/sbin/ifconfig | grep inet | cut -d' ' -f 12 -s | cut -b 6-20) + TCPSTRING=":allow,RELAYCLIENT=\"\",RBLSMTPD=\"\"" + for ip in $LOCALIPS; do + myline="${ip}${TCPSTRING}" + for proto in smtp qmtp qmqp; do + f="${ROOT}${TCPRULES_DIR}/tcp.qmail-${proto}" + egrep -q "${myline}" "${f}" || echo "${myline}" >> "${f}" + done + done +} + +qmail_ssl_generate() { + CRON_FOLDER=cron.hourly + use gencertdaily && CRON_FOLDER=cron.daily + + ebegin "Generating RSA keys for SSL/TLS, this can take some time" + "${ROOT}"/etc/${CRON_FOLDER}/qmail-genrsacert.sh + eend $? + + einfo "Creating a self-signed ssl-certificate:" + "${ROOT}${QMAIL_HOME}"/bin/mkservercert + + einfo "If you want to have a properly signed certificate " + einfo "instead, do the following:" + # space at the end of the string because of the current implementation + # of einfo + einfo "openssl req -new -nodes -out req.pem \\ " + einfo " -config ${QMAIL_HOME}/control/servercert.cnf \\ " + einfo " -keyout ${QMAIL_HOME}/control/servercert.pem" + einfo "Send req.pem to your CA to obtain signed_req.pem, and do:" + einfo "cat signed_req.pem >> ${QMAIL_HOME}/control/servercert.pem" +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/qt3.eclass b/sdk_container/src/third_party/portage-stable/eclass/qt3.eclass new file mode 100644 index 0000000000..e75a45155f --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/qt3.eclass @@ -0,0 +1,141 @@ +# Copyright 2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/qt3.eclass,v 1.41 2009/05/17 15:17:03 hwoarang Exp $ + +# @ECLASS: qt3.eclass +# @MAINTAINER: +# Qt team +# @BLURB: Eclass for Qt3 packages +# @DESCRIPTION: +# This eclass contains various functions that may be useful +# when dealing with packages using Qt3 libraries. + +inherit toolchain-funcs versionator eutils + +QTPKG="x11-libs/qt-" +QT3MAJORVERSIONS="3.3 3.2 3.1 3.0" +QT3VERSIONS="3.3.8b-r1 3.3.8b 3.3.8-r4 3.3.8-r3 3.3.8-r2 3.3.8-r1 3.3.8 3.3.6-r5 3.3.6-r4 3.3.6-r3 3.3.6-r2 3.3.6-r1 3.3.6 3.3.5-r1 3.3.5 3.3.4-r9 3.3.4-r8 3.3.4-r7 3.3.4-r6 3.3.4-r5 3.3.4-r4 3.3.4-r3 3.3.4-r2 3.3.4-r1 3.3.4 3.3.3-r3 3.3.3-r2 3.3.3-r1 3.3.3 3.3.2 3.3.1-r2 3.3.1-r1 3.3.1 3.3.0-r1 3.3.0 3.2.3-r1 3.2.3 3.2.2-r1 3.2.2 3.2.1-r2 3.2.1-r1 3.2.1 3.2.0 3.1.2-r4 3.1.2-r3 3.1.2-r2 3.1.2-r1 3.1.2 3.1.1-r2 3.1.1-r1 3.1.1 3.1.0-r3 3.1.0-r2 3.1.0-r1 3.1.0" + +if [[ -z "${QTDIR}" ]]; then + export QTDIR="/usr/qt/3" +fi + +addwrite "${QTDIR}/etc/settings" +addpredict "${QTDIR}/etc/settings" + +# @FUNCTION: qt_min_version +# @USAGE: [minimum version] +# @DESCRIPTION: +# This function is deprecated. Use slot dependencies instead. +qt_min_version() { + local list=$(qt_min_version_list "$@") + ewarn "${CATEGORY}/${PF}: qt_min_version() is deprecated. Use slot dependencies instead." + if [[ ${list%% *} == "${list}" ]]; then + echo "${list}" + else + echo "|| ( ${list} )" + fi +} + +qt_min_version_list() { + local MINVER="$1" + local VERSIONS="" + + case "${MINVER}" in + 3|3.0|3.0.0) VERSIONS="=${QTPKG}3*";; + 3.1|3.1.0|3.2|3.2.0|3.3|3.3.0) + for x in ${QT3MAJORVERSIONS}; do + if $(version_is_at_least "${MINVER}" "${x}"); then + VERSIONS="${VERSIONS} =${QTPKG}${x}*" + fi + done + ;; + 3*) + for x in ${QT3VERSIONS}; do + if $(version_is_at_least "${MINVER}" "${x}"); then + VERSIONS="${VERSIONS} =${QTPKG}${x}" + fi + done + ;; + *) VERSIONS="=${QTPKG}3*";; + esac + + echo ${VERSIONS} +} + +# @FUNCTION: eqmake3 +# @USAGE: [.pro file] [additional parameters to qmake] +# @MAINTAINER: +# Przemyslaw Maciag +# Davide Pesavento +# @DESCRIPTION: +# Runs qmake on the specified .pro file (defaults to +# ${PN}.pro if eqmake3 was called with no argument). +# Additional parameters are passed unmodified to qmake. +eqmake3() { + local LOGFILE="${T}/qmake-$$.out" + local projprofile="${1}" + [[ -z ${projprofile} ]] && projprofile="${PN}.pro" + shift 1 + + ebegin "Processing qmake ${projprofile}" + + # file exists? + if [[ ! -f ${projprofile} ]]; then + echo + eerror "Project .pro file \"${projprofile}\" does not exist" + eerror "qmake cannot handle non-existing .pro files" + echo + eerror "This shouldn't happen - please send a bug report to bugs.gentoo.org" + echo + die "Project file not found in ${PN} sources" + fi + + echo >> ${LOGFILE} + echo "****** qmake ${projprofile} ******" >> ${LOGFILE} + echo >> ${LOGFILE} + + # some standard config options + local configoptplus="CONFIG += no_fixpath" + local configoptminus="CONFIG -=" + if has debug ${IUSE} && use debug; then + configoptplus="${configoptplus} debug" + configoptminus="${configoptminus} release" + else + configoptplus="${configoptplus} release" + configoptminus="${configoptminus} debug" + fi + + ${QTDIR}/bin/qmake ${projprofile} \ + QTDIR=${QTDIR} \ + QMAKE=${QTDIR}/bin/qmake \ + QMAKE_CC=$(tc-getCC) \ + QMAKE_CXX=$(tc-getCXX) \ + QMAKE_LINK=$(tc-getCXX) \ + QMAKE_CFLAGS_RELEASE="${CFLAGS}" \ + QMAKE_CFLAGS_DEBUG="${CFLAGS}" \ + QMAKE_CXXFLAGS_RELEASE="${CXXFLAGS}" \ + QMAKE_CXXFLAGS_DEBUG="${CXXFLAGS}" \ + QMAKE_LFLAGS_RELEASE="${LDFLAGS}" \ + QMAKE_LFLAGS_DEBUG="${LDFLAGS}" \ + "${configoptminus}" \ + "${configoptplus}" \ + QMAKE_RPATH= \ + QMAKE_STRIP= \ + ${@} >> ${LOGFILE} 2>&1 + + local result=$? + eend ${result} + + # was qmake successful? + if [[ ${result} -ne 0 ]]; then + echo + eerror "Running qmake on \"${projprofile}\" has failed" + echo + eerror "This shouldn't happen - please send a bug report to bugs.gentoo.org" + echo + die "qmake failed on ${projprofile}" + fi + + return ${result} +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/qt4-build.eclass b/sdk_container/src/third_party/portage-stable/eclass/qt4-build.eclass new file mode 100644 index 0000000000..1656601bf7 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/qt4-build.eclass @@ -0,0 +1,716 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.65 2010/02/17 23:32:24 wired Exp $ + +# @ECLASS: qt4-build.eclass +# @MAINTAINER: +# Ben de Groot , +# Markos Chandras , +# Caleb Tennis +# Alex Alexander +# @BLURB: Eclass for Qt4 split ebuilds. +# @DESCRIPTION: +# This eclass contains various functions that are used when building Qt4 + +inherit base eutils multilib toolchain-funcs flag-o-matic versionator + +MY_PV=${PV/_/-} +if version_is_at_least 4.5.99999999; then + MY_P=qt-everywhere-opensource-src-${MY_PV} + [[ ${CATEGORY}/${PN} != x11-libs/qt-xmlpatterns ]] && IUSE="+exceptions" +else + MY_P=qt-x11-opensource-src-${MY_PV} +fi + +HOMEPAGE="http://qt.nokia.com/" +SRC_URI="http://get.qt.nokia.com/qt/source/${MY_P}.tar.gz" + +LICENSE="|| ( LGPL-2.1 GPL-3 )" +IUSE+=" debug pch aqua" + +RDEPEND=" + !x11-libs/qt-assistant-${PV}-r9999 + !x11-libs/qt-core-${PV}-r9999 + !x11-libs/qt-dbus-${PV}-r9999 + !x11-libs/qt-demo-${PV}-r9999 + !x11-libs/qt-gui-${PV}-r9999 + !x11-libs/qt-multimedia-${PV}-r9999 + !x11-libs/qt-opengl-${PV}-r9999 + !x11-libs/qt-phonon-${PV}-r9999 + !x11-libs/qt-qt3support-${PV}-r9999 + !x11-libs/qt-script-${PV}-r9999 + !x11-libs/qt-sql-${PV}-r9999 + !x11-libs/qt-svg-${PV}-r9999 + !x11-libs/qt-test-${PV}-r9999 + !x11-libs/qt-webkit-${PV}-r9999 + !x11-libs/qt-xmlpatterns-${PV}-r9999 +" + +S=${WORKDIR}/${MY_P} + +# @FUNCTION: qt4-build_pkg_setup +# @DESCRIPTION: +# Sets up S, MY_P, PATH, and LD_LIBRARY_PATH +qt4-build_pkg_setup() { + [[ ${EAPI} == 2 ]] && use !prefix && EPREFIX= + + + PATH="${S}/bin${PATH:+:}${PATH}" + if [[ ${CHOST} != *-darwin* ]]; then + LD_LIBRARY_PATH="${S}/lib${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}" + else + DYLD_LIBRARY_PATH="${S}/lib${DYLD_LIBRARY_PATH:+:}${DYLD_LIBRARY_PATH}" + # On MacOS we *need* at least src/gui/kernel/qapplication_mac.mm for + # platform detection. Note: needs to come before any directories to + # avoid extract failure. + [[ ${CHOST} == *-apple-darwin* ]] && \ + QT4_EXTRACT_DIRECTORIES="src/gui/kernel/qapplication_mac.mm ${QT4_EXTRACT_DIRECTORIES}" + fi + + # Make sure ebuilds use the required EAPI + if [[ ${EAPI} != [23] ]]; then + eerror "The qt4-build eclass requires EAPI=2 or EAPI=3, but this ebuild is using" + eerror "EAPI=${EAPI:-0}. The ebuild author or editor failed. This ebuild needs to be" + eerror "fixed. Using qt4-build eclass without EAPI=2 or EAPI=3 will fail." + die "qt4-build eclass requires EAPI=2 or EAPI=3" + fi + + if ! version_is_at_least 4.1 $(gcc-version); then + ewarn "Using a GCC version lower than 4.1 is not supported!" + echo + ebeep 3 + fi +} + +# @ECLASS-VARIABLE: QT4_TARGET_DIRECTORIES +# @DESCRIPTION: +# Arguments for build_target_directories. Takes the directories, in which the +# code should be compiled. This is a space-separated list + +# @ECLASS-VARIABLE: QT4_EXTRACT_DIRECTORIES +# @DESCRIPTION: +# Space separated list including the directories that will be extracted from Qt +# tarball + +# @FUNCTION: qt4-build_src_unpack +# @DESCRIPTION: +# Unpacks the sources +qt4-build_src_unpack() { + setqtenv + local target targets= + for target in configure LICENSE.GPL3 LICENSE.LGPL projects.pro \ + src/{qbase,qt_targets,qt_install}.pri bin config.tests mkspecs qmake \ + ${QT4_EXTRACT_DIRECTORIES}; do + targets+=" ${MY_P}/${target}" + done + + echo tar xzpf "${DISTDIR}"/${MY_P}.tar.gz ${targets} + tar xzpf "${DISTDIR}"/${MY_P}.tar.gz ${targets} || die +} + +# @ECLASS-VARIABLE: PATCHES +# @DESCRIPTION: +# In case you have patches to apply, specify them in PATCHES variable. Make sure +# to specify the full path. This variable is necessary for src_prepare phase. +# example: +# PATCHES="${FILESDIR}"/mypatch.patch +# ${FILESDIR}"/mypatch2.patch" +# + +# @FUNCTION: qt4-build_src_prepare +# @DESCRIPTION: +# Prepare the sources before the configure phase. Strip CFLAGS if necessary, and fix +# source files in order to respect CFLAGS/CXXFLAGS/LDFLAGS specified on /etc/make.conf. +qt4-build_src_prepare() { + setqtenv + cd "${S}" + + if use aqua; then + # provide a proper macx-g++-64 + use x64-macos && ln -s macx-g++ mkspecs/$(qt_mkspecs_dir) + + sed -e '/^CONFIG/s:app_bundle::' \ + -e '/^CONFIG/s:plugin_no_soname:plugin_with_soname absolute_library_soname:' \ + -i mkspecs/$(qt_mkspecs_dir)/qmake.conf || die "sed failed" + fi + + if [[ ${PN} != qt-core ]]; then + skip_qmake_build_patch + skip_project_generation_patch + symlink_binaries_to_buildtree + fi + + if [[ ${CHOST} == *86*-apple-darwin* ]] ; then + # qmake bus errors with -O2 but -O3 works + replace-flags -O2 -O3 + fi + + # Bug 282984 && Bug 295530 + sed -e "s:\(^SYSTEM_VARIABLES\):CC=$(tc-getCC)\nCXX=$(tc-getCXX)\n\1:" \ + -i configure || die "sed qmake compilers failed" + sed -e "s:\(\$MAKE\):\1 CC=$(tc-getCC) CXX=$(tc-getCXX) LD=$(tc-getCXX):" \ + -i config.tests/unix/compile.test || die "sed test compilers failed" + + # Bug 178652 + if [[ $(gcc-major-version) == 3 ]] && use amd64; then + ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS" + append-flags -fno-gcse + fi + + # Unsupported old gcc versions - hardened needs this :( + if [[ $(gcc-major-version) -lt 4 ]] ; then + ewarn "Appending -fno-stack-protector to CXXFLAGS" + append-cxxflags -fno-stack-protector + # Bug 253127 + sed -e "/^QMAKE_CFLAGS\t/ s:$: -fno-stack-protector-all:" \ + -i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed" + fi + + # Bug 261632 + if use ppc64; then + ewarn "Appending -mminimal-toc to CFLAGS/CXXFLAGS" + append-flags -mminimal-toc + fi + + # Bug 172219 + sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \ + -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \ + -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \ + -e "s:X11R6/::" \ + -i "${S}"/mkspecs/$(qt_mkspecs_dir)/qmake.conf || die "sed ${S}/mkspecs/$(qt_mkspecs_dir)/qmake.conf failed" + + if [[ ${CHOST} != *-darwin* ]]; then + sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \ + -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \ + -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \ + -i mkspecs/common/g++.conf || die "sed mkspecs/common/g++.conf failed" + else + # Set FLAGS *and* remove -arch, since our gcc-apple is multilib + # crippled (by design) :/ + sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \ + -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \ + -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=-headerpad_max_install_names ${LDFLAGS}:" \ + -e "s:-arch\s\w*::g" \ + -i mkspecs/common/mac-g++.conf || die "sed mkspecs/common/mac-g++.conf failed" + + # Fix configure's -arch settings that appear in qmake/Makefile and also + # fix arch handling (automagically duplicates our -arch arg and breaks + # pch). Additionally disable Xarch support. + sed \ + -e "s:-arch i386::" \ + -e "s:-arch ppc::" \ + -e "s:-arch x86_64::" \ + -e "s:-arch ppc64::" \ + -e "s:-arch \$i::" \ + -e "/if \[ ! -z \"\$NATIVE_64_ARCH\" \]; then/,/fi/ d" \ + -e "s:CFG_MAC_XARCH=yes:CFG_MAC_XARCH=no:g" \ + -e "s:-Xarch_x86_64::g" \ + -e "s:-Xarch_ppc64::g" \ + -i configure mkspecs/common/mac-g++.conf || die "sed configure failed" + + # On Snow Leopard don't fall back to 10.5 deployment target. + if [[ ${CHOST} == *-apple-darwin10 ]] ; then + sed -e "s:QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET.*:QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET 10.6:g" \ + -e "s:-mmacosx-version-min=10.[0-9]:-mmacosx-version-min=10.6:g" \ + -i configure mkspecs/common/mac-g++.conf || die "sed configure failed" + fi + fi + + # this one is needed for all systems with a separate -liconv, apart from + # Darwin, for which the sources already cater for -liconv + if use !elibc_glibc && [[ ${CHOST} != *-darwin* ]] ; then + sed \ + -e "s|mac:LIBS += -liconv|LIBS += -liconv|g" \ + -i config.tests/unix/iconv/iconv.pro \ + || die "sed on iconv.pro failed" + fi + + # we need some patches for Solaris + sed -i \ + -e '/^QMAKE_LFLAGS_THREAD/a\QMAKE_LFLAGS_DYNAMIC_LIST = -Wl,--dynamic-list,' \ + mkspecs/$(qt_mkspecs_dir)/qmake.conf || die + # use GCC over SunStudio + sed -i -e '/PLATFORM=solaris-cc/s/cc/g++/' configure || die + # don't flirt with non-Prefix stuff, we're quite possessive + sed -i -e '/^QMAKE_\(LIB\|INC\)DIR\(_X11\|_OPENGL\|\)\t/s/=.*$/=/' \ + mkspecs/$(qt_mkspecs_dir)/qmake.conf || die + + base_src_prepare +} + +# @FUNCTION: qt4-build_src_configure +# @DESCRIPTION: +# Default configure phase +qt4-build_src_configure() { + setqtenv + myconf="$(standard_configure_options) ${myconf}" + + # this one is needed for all systems with a separate -liconv, apart from + # Darwin, for which the sources already cater for -liconv + use !elibc_glibc && [[ ${CHOST} != *-darwin* ]] && \ + myconf+=" -liconv" + + if has glib ${IUSE//+} && use glib; then + # use -I, -L and -l from configure + local glibflags="$(pkg-config --cflags --libs glib-2.0 gthread-2.0)" + # avoid the -pthread argument + myconf+=" ${glibflags//-pthread}" + unset glibflags + fi + + if use aqua ; then + # On (snow) leopard use the new (frameworked) cocoa code. + if [[ ${CHOST##*-darwin} -ge 9 ]] ; then + myconf+=" -cocoa -framework" + + # We are crazy and build cocoa + qt3support :-) + if use qt3support; then + sed -e "/case \"\$PLATFORM,\$CFG_MAC_COCOA\" in/,/;;/ s|CFG_QT3SUPPORT=\"no\"|CFG_QT3SUPPORT=\"yes\"|" \ + -i configure + fi + + # We need the source's headers, not the installed ones. + myconf+=" -I${S}/include" + + # Add hint for the framework location. + myconf+=" -F${QTLIBDIR}" + fi + else + # freetype2 include dir is non-standard, thus include it on configure + # use -I from configure + myconf+=" $(pkg-config --cflags freetype2)" + fi + + echo ./configure ${myconf} + ./configure ${myconf} || die "./configure failed" + myconf="" +} + +# @FUNCTION: qt4-build_src_compile +# @DESCRIPTION: Actual compile phase +qt4-build_src_compile() { + setqtenv + + build_directories ${QT4_TARGET_DIRECTORIES} +} + +# @FUNCTION: fix_includes +# @DESCRIPTION: +# For MacOSX we need to add some symlinks when frameworks are +# being used, to avoid complications with some more or less stupid packages. +fix_includes() { + if use aqua && [[ ${CHOST##*-darwin} -ge 9 ]] ; then + # Some packages tend to include + dodir "${QTHEADERDIR#${EPREFIX}}"/Qt + + # Fake normal headers when frameworks are installed... eases life later on + local dest f + for frw in "${D}${QTLIBDIR}"/*.framework; do + [[ -e "${frw}"/Headers ]] || continue + f=$(basename ${frw}) + dest="${QTHEADERDIR#${EPREFIX}}"/${f%.framework} + dosym "${QTLIBDIR#${EPREFIX}}"/${f}/Headers "${dest}" + + # Link normal headers as well. + for hdr in "${D}/${QTLIBDIR}/${f}"/Headers/*; do + h=$(basename ${hdr}) + dosym "${QTLIBDIR#${EPREFIX}}"/${f}/Headers/${h} "${QTHEADERDIR#${EPREFIX}}"/Qt/${h} + done + done + fi +} + +# @FUNCTION: qt4-build_src_install +# @DESCRIPTION: +# Perform the actual installation including some library fixes. +qt4-build_src_install() { + [[ ${EAPI} == 2 ]] && use !prefix && ED=${D} + setqtenv + install_directories ${QT4_TARGET_DIRECTORIES} + install_qconfigs + fix_library_files + fix_includes +} + +# @FUNCTION: setqtenv +setqtenv() { + # Set up installation directories + QTBASEDIR=${EPREFIX}/usr/$(get_libdir)/qt4 + QTPREFIXDIR=${EPREFIX}/usr + QTBINDIR=${EPREFIX}/usr/bin + QTLIBDIR=${EPREFIX}/usr/$(get_libdir)/qt4 + QMAKE_LIBDIR_QT=${QTLIBDIR} + QTPCDIR=${EPREFIX}/usr/$(get_libdir)/pkgconfig + QTDATADIR=${EPREFIX}/usr/share/qt4 + QTDOCDIR=${EPREFIX}/usr/share/doc/qt-${PV} + QTHEADERDIR=${EPREFIX}/usr/include/qt4 + QTPLUGINDIR=${QTLIBDIR}/plugins + QTSYSCONFDIR=${EPREFIX}/etc/qt4 + QTTRANSDIR=${QTDATADIR}/translations + QTEXAMPLESDIR=${QTDATADIR}/examples + QTDEMOSDIR=${QTDATADIR}/demos + QT_INSTALL_PREFIX=${EPREFIX}/usr/$(get_libdir)/qt4 + PLATFORM=$(qt_mkspecs_dir) + + unset QMAKESPEC +} + +# @FUNCTION: standard_configure_options +# @DESCRIPTION: +# Sets up some standard configure options, like libdir (if necessary), whether +# debug info is wanted or not. +standard_configure_options() { + local myconf= + + [[ $(get_libdir) != lib ]] && myconf+=" -L${EPREFIX}/usr/$(get_libdir)" + + # Disable visibility explicitly if gcc version isn't 4 + if [[ $(gcc-major-version) -lt 4 ]]; then + myconf+=" -no-reduce-exports" + fi + + # precompiled headers doesn't work on hardened, where the flag is masked. + myconf+=" $(qt_use pch)" + + if use debug; then + myconf+=" -debug" + else + myconf+=" -release" + fi + myconf+=" -no-separate-debug-info" + + use aqua && myconf+=" -no-framework" + + # ARCH is set on Gentoo. Qt now falls back to generic on an unsupported + # $(tc-arch). Therefore we convert it to supported values. + case "$(tc-arch)" in + amd64|x64-*) myconf+=" -arch x86_64" ;; + ppc-macos) myconf+=" -arch ppc" ;; + ppc|ppc64|ppc-*) myconf+=" -arch powerpc" ;; + sparc|sparc-*) myconf+=" -arch sparc" ;; + x86-macos) myconf+=" -arch x86" ;; + x86|x86-*) myconf+=" -arch i386" ;; + alpha|arm|ia64|mips|s390|sparc) myconf+=" -arch $(tc-arch)" ;; + hppa|sh) myconf+=" -arch generic" ;; + *) die "$(tc-arch) is unsupported by this eclass. Please file a bug." ;; + esac + + # 4.5: build everything but qt-xmlpatterns w/o exceptions + # 4.6: exceptions USE flag + local exceptions="-exceptions" + case "${PV}" in + 4.5.*) + [[ ${PN} == "qt-xmlpatterns" ]] || exceptions="-no-exceptions" + ;; + *) + has exceptions "${IUSE//+}" && exceptions="$(qt_use exceptions)" + ;; + esac + + # note about -reduce-relocations: + # That flag seems to introduce major breakage to applications, + # mostly to be seen as a core dump with the message "QPixmap: Must + # construct a QApplication before a QPaintDevice" on Solaris + # -- Daniel Vergien + [[ ${CHOST} != *-solaris* ]] && myconf+=" -reduce-relocations" + + myconf+=" -platform $(qt_mkspecs_dir) -stl -verbose -largefile -confirm-license + -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} + -datadir ${QTDATADIR} -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} + -plugindir ${QTPLUGINDIR} -sysconfdir ${QTSYSCONFDIR} + -translationdir ${QTTRANSDIR} -examplesdir ${QTEXAMPLESDIR} + -demosdir ${QTDEMOSDIR} -silent -fast -opensource + ${exceptions} + -nomake examples -nomake demos" + + echo "${myconf}" +} + +# @FUNCTION: build_directories +# @USAGE: < directories > +# @DESCRIPTION: +# Compiles the code in $QT4_TARGET_DIRECTORIES +build_directories() { + for x in "$@"; do + pushd "${S}"/${x} >/dev/null + # avoid running over the maximum argument number, bug #299810 + { + echo "${S}"/mkspecs/common/*.conf + find "${S}" -name '*.pr[io]' + } | xargs sed -i -e "s:\$\$\[QT_INSTALL_LIBS\]:${EPREFIX}/usr/$(get_libdir)/qt4:g" || die + "${S}"/bin/qmake "LIBS+=-L${QTLIBDIR}" "CONFIG+=nostrip" || die "qmake failed" + emake CC="@echo compiling \$< && $(tc-getCC)" \ + CXX="@echo compiling \$< && $(tc-getCXX)" \ + LINK="@echo linking \$@ && $(tc-getCXX)" || die "emake failed" + popd >/dev/null + done +} + +# @FUNCTION: install_directories +# @USAGE: < directories > +# @DESCRIPTION: +# run emake install in the given directories, which are separated by spaces +install_directories() { + for x in "$@"; do + pushd "${S}"/${x} >/dev/null || die "Can't pushd ${S}/${x}" + emake INSTALL_ROOT="${D}" install || die "emake install failed" + popd >/dev/null || die "Can't popd from ${S}/${x}" + done +} + +# @ECLASS-VARIABLE: QCONFIG_ADD +# @DESCRIPTION: +# List options that need to be added to QT_CONFIG in qconfig.pri +: ${QCONFIG_ADD:=} + +# @ECLASS-VARIABLE: QCONFIG_REMOVE +# @DESCRIPTION: +# List options that need to be removed from QT_CONFIG in qconfig.pri +: ${QCONFIG_REMOVE:=} + +# @ECLASS-VARIABLE: QCONFIG_DEFINE +# @DESCRIPTION: +# List variables that should be defined at the top of QtCore/qconfig.h +: ${QCONFIG_DEFINE:=} + +# @FUNCTION: install_qconfigs +# @DESCRIPTION: Install gentoo-specific mkspecs configurations +install_qconfigs() { + local x + if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} ]]; then + for x in QCONFIG_ADD QCONFIG_REMOVE; do + [[ -n ${!x} ]] && echo ${x}=${!x} >> "${T}"/${PN}-qconfig.pri + done + insinto ${QTDATADIR#${EPREFIX}}/mkspecs/gentoo + doins "${T}"/${PN}-qconfig.pri || die "installing ${PN}-qconfig.pri failed" + fi + + if [[ -n ${QCONFIG_DEFINE} ]]; then + for x in ${QCONFIG_DEFINE}; do + echo "#define ${x}" >> "${T}"/gentoo-${PN}-qconfig.h + done + insinto ${QTHEADERDIR#${EPREFIX}}/Gentoo + doins "${T}"/gentoo-${PN}-qconfig.h || die "installing ${PN}-qconfig.h failed" + fi +} + +# @FUNCTION: generate_qconfigs +# @DESCRIPTION: Generates gentoo-specific configurations +generate_qconfigs() { + if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} || -n ${QCONFIG_DEFINE} || ${CATEGORY}/${PN} == x11-libs/qt-core ]]; then + local x qconfig_add qconfig_remove qconfig_new + for x in "${ROOT}${QTDATADIR}"/mkspecs/gentoo/*-qconfig.pri; do + [[ -f ${x} ]] || continue + qconfig_add+=" $(sed -n 's/^QCONFIG_ADD=//p' "${x}")" + qconfig_remove+=" $(sed -n 's/^QCONFIG_REMOVE=//p' "${x}")" + done + + # these error checks do not use die because dying in pkg_post{inst,rm} + # just makes things worse. + if [[ -e "${ROOT}${QTDATADIR}"/mkspecs/gentoo/qconfig.pri ]]; then + # start with the qconfig.pri that qt-core installed + if ! cp "${ROOT}${QTDATADIR}"/mkspecs/gentoo/qconfig.pri \ + "${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri; then + eerror "cp qconfig failed." + return 1 + fi + + # generate list of QT_CONFIG entries from the existing list + # including qconfig_add and excluding qconfig_remove + for x in $(sed -n 's/^QT_CONFIG +=//p' \ + "${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri) ${qconfig_add}; do + hasq ${x} ${qconfig_remove} || qconfig_new+=" ${x}" + done + + # replace the existing QT_CONFIG list with qconfig_new + if ! sed -i -e "s/QT_CONFIG +=.*/QT_CONFIG += ${qconfig_new}/" \ + "${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri; then + eerror "Sed for QT_CONFIG failed" + return 1 + fi + + # create Gentoo/qconfig.h + if [[ ! -e ${ROOT}${QTHEADERDIR}/Gentoo ]]; then + if ! mkdir -p "${ROOT}${QTHEADERDIR}"/Gentoo; then + eerror "mkdir ${QTHEADERDIR}/Gentoo failed" + return 1 + fi + fi + : > "${ROOT}${QTHEADERDIR}"/Gentoo/gentoo-qconfig.h + for x in "${ROOT}${QTHEADERDIR}"/Gentoo/gentoo-*-qconfig.h; do + [[ -f ${x} ]] || continue + cat "${x}" >> "${ROOT}${QTHEADERDIR}"/Gentoo/gentoo-qconfig.h + done + else + rm -f "${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri + rm -f "${ROOT}${QTHEADERDIR}"/Gentoo/gentoo-qconfig.h + rmdir "${ROOT}${QTDATADIR}"/mkspecs \ + "${ROOT}${QTDATADIR}" \ + "${ROOT}${QTHEADERDIR}"/Gentoo \ + "${ROOT}${QTHEADERDIR}" 2>/dev/null + fi + fi +} + +# @FUNCTION: qt4-build_pkg_postrm +# @DESCRIPTION: Generate configurations when the package is completely removed +qt4-build_pkg_postrm() { + generate_qconfigs +} + +# @FUNCTION: qt4-build_pkg_postinst +# @DESCRIPTION: Generate configuration, plus throws a message about possible +# breakages and proposed solutions. +qt4-build_pkg_postinst() { + generate_qconfigs +} + +# @FUNCTION: skip_qmake_build_patch +# @DESCRIPTION: +# Don't need to build qmake, as it's already installed from qt-core +skip_qmake_build_patch() { + # Don't need to build qmake, as it's already installed from qt-core + sed -i -e "s:if true:if false:g" "${S}"/configure || die "Sed failed" +} + +# @FUNCTION: skip_project_generation_patch +# @DESCRIPTION: +# Exit the script early by throwing in an exit before all of the .pro files are scanned +skip_project_generation_patch() { + # Exit the script early by throwing in an exit before all of the .pro files are scanned + sed -e "s:echo \"Finding:exit 0\n\necho \"Finding:g" \ + -i "${S}"/configure || die "Sed failed" +} + +# @FUNCTION: symlink_binaries_to_buildtree +# @DESCRIPTION: +# Symlink generated binaries to buildtree so they can be used during compilation +# time +symlink_binaries_to_buildtree() { + for bin in qmake moc uic rcc; do + ln -s ${QTBINDIR}/${bin} "${S}"/bin/ || die "Symlinking ${bin} to ${S}/bin failed." + done +} + +# @FUNCTION: fix_library_files +# @DESCRIPTION: +# Fixes the pathes in *.la, *.prl, *.pc, as they are wrong due to sandbox and +# moves the *.pc-files into the pkgconfig directory +fix_library_files() { + for libfile in "${D}"/${QTLIBDIR}/{*.la,*.prl,pkgconfig/*.pc}; do + if [[ -e ${libfile} ]]; then + sed -i -e "s:${S}/lib:${QTLIBDIR}:g" ${libfile} || die "Sed on ${libfile} failed." + fi + done + + # pkgconfig files refer to WORKDIR/bin as the moc and uic locations. Fix: + for libfile in "${D}"/${QTLIBDIR}/pkgconfig/*.pc; do + if [[ -e ${libfile} ]]; then + sed -i -e "s:${S}/bin:${QTBINDIR}:g" ${libfile} || die "Sed failed" + + # Move .pc files into the pkgconfig directory + dodir ${QTPCDIR#${EPREFIX}} + mv ${libfile} "${D}"/${QTPCDIR}/ \ + || die "Moving ${libfile} to ${D}/${QTPCDIR}/ failed." + fi + done + + # Don't install an empty directory + rmdir "${D}"/${QTLIBDIR}/pkgconfig +} + +# @FUNCTION: qt_use +# @USAGE: < flag > [ feature ] [ enableval ] +# @DESCRIPTION: +# This will echo "${enableval}-${feature}" if is enabled, or +# "-no-${feature} if the flag is disabled. If [feature] is not specified +# will be used for that. If [enableval] is not specified, it omits the +# assignment-part +qt_use() { + local flag=$1 + local feature=$1 + local enableval= + + [[ -n $2 ]] && feature=$2 + [[ -n $3 ]] && enableval=-$3 + + if use ${flag}; then + echo "${enableval}-${feature}" + else + echo "-no-${feature}" + fi +} + +# @FUNCTION: qt_mkspecs_dir +# @RETURN: the specs-directory w/o path +# @DESCRIPTION: +# Allows us to define which mkspecs dir we want to use. +qt_mkspecs_dir() { + # Allows us to define which mkspecs dir we want to use. + local spec + + case ${CHOST} in + *-freebsd*|*-dragonfly*) + spec=freebsd ;; + *-openbsd*) + spec=openbsd ;; + *-netbsd*) + spec=netbsd ;; + *-darwin*) + if use aqua; then + # mac with carbon/cocoa + spec=macx + else + # darwin/mac with x11 + spec=darwin + fi + ;; + *-solaris*) + spec=solaris ;; + *-linux-*|*-linux) + spec=linux ;; + *) + die "Unknown CHOST, no platform choosen." + esac + + CXX=$(tc-getCXX) + if [[ ${CXX} == *g++* ]]; then + spec+=-g++ + elif [[ ${CXX} == *icpc* ]]; then + spec+=-icc + else + die "Unknown compiler ${CXX}." + fi + if [[ -n ${LIBDIR/lib} ]]; then + spec+=-${LIBDIR/lib} + fi + + # Add -64 for 64bit profiles + if use x64-freebsd || + use amd64-linux || + use x64-macos || + use x64-solaris || + use sparc64-solaris + then + spec+=-64 + fi + + echo "${spec}" +} + +EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_install pkg_postrm pkg_postinst diff --git a/sdk_container/src/third_party/portage-stable/eclass/qt4.eclass b/sdk_container/src/third_party/portage-stable/eclass/qt4.eclass new file mode 100644 index 0000000000..5d55931ea5 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/qt4.eclass @@ -0,0 +1,305 @@ +# Copyright 2005-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/qt4.eclass,v 1.61 2010/01/14 21:15:22 abcd Exp $ + +# @ECLASS: qt4.eclass +# @MAINTAINER: +# Ben de Groot , +# Markos Chandras , +# Caleb Tennis , +# Przemyslaw Maciag , +# Davide Pesavento +# @BLURB: Eclass for Qt4 packages +# @DESCRIPTION: +# This eclass contains various functions that may be useful +# when dealing with packages using Qt4 libraries. + +inherit base eutils multilib toolchain-funcs versionator + +export XDG_CONFIG_HOME="${T}" + +qt4_monolithic_to_split_flag() { + case ${1} in + zlib) + # Qt 4.4+ is always built with zlib enabled, so this flag isn't needed + ;; + gif|jpeg|png) + # qt-gui always installs with these enabled + checkpkgs+=" x11-libs/qt-gui" + ;; + dbus|opengl) + # Make sure the qt-${1} package has been installed already + checkpkgs+=" x11-libs/qt-${1}" + ;; + qt3support) + checkpkgs+=" x11-libs/qt-${1}" + checkflags+=" x11-libs/qt-core:${1} x11-libs/qt-gui:${1} x11-libs/qt-sql:${1}" + ;; + ssl) + # qt-core controls this flag + checkflags+=" x11-libs/qt-core:${1}" + ;; + cups|mng|nas|nis|tiff|xinerama|input_devices_wacom) + # qt-gui controls these flags + checkflags+=" x11-libs/qt-gui:${1}" + ;; + firebird|mysql|odbc|postgres|sqlite3) + # qt-sql controls these flags. sqlite2 is no longer supported so it uses sqlite instead of sqlite3. + checkflags+=" x11-libs/qt-sql:${1%3}" + ;; + accessibility) + eerror "(QA message): Use guiaccessibility and/or qt3accessibility to specify which of qt-gui and qt-qt3support are relevant for this package." + # deal with this gracefully by checking the flag for what is available + for y in gui qt3support; do + has_version x11-libs/qt-${y} && checkflags+=" x11-libs/qt-${y}:${1}" + done + ;; + guiaccessibility) + checkflags+=" x11-libs/qt-gui:accessibility" + ;; + qt3accessibility) + checkflags+=" x11-libs/qt-qt3support:accessibility" + ;; + debug|doc|examples|glib|pch|sqlite|*) + # packages probably shouldn't be checking these flags so we don't handle them currently + eerror "qt4.eclass currently doesn't handle the use flag ${1} in QT4_BUILT_WITH_USE_CHECK for qt-4.4. This is either an" + eerror "eclass bug or an ebuild bug. Please report it at http://bugs.gentoo.org/" + ((fatalerrors+=1)) + ;; + esac +} + +# @FUNCTION: qt4_pkg_setup +# @DESCRIPTION: +# Default pkg_setup function for packages that depends on qt4. If you have to +# create ebuilds own pkg_setup in your ebuild, call qt4_pkg_setup in it. +# This function uses two global vars from ebuild: +# - QT4_BUILT_WITH_USE_CHECK - contains use flags that need to be turned on for +# =x11-libs/qt-4* +# - QT4_OPTIONAL_BUILT_WITH_USE_CHECK - qt4 flags that provides some +# functionality, but can alternatively be disabled in ${CATEGORY}/${PN} +# (so qt4 don't have to be recompiled) +# +# NOTE: Using the above vars is now deprecated in favor of eapi-2 use deps +# +# flags to watch for for Qt4.4: +# zlib png | opengl dbus qt3support | sqlite3 ssl +qt4_pkg_setup() { + local x y checkpkgs checkflags fatalerrors=0 requiredflags="" + + # lots of has_version calls can be very expensive + if [[ -n ${QT4_BUILT_WITH_USE_CHECK}${QT4_OPTIONAL_BUILT_WITH_USE_CHECK} ]]; then + ewarn "QA notice: The QT4_BUILT_WITH_USE functionality is deprecated and" + ewarn "will be removed from future versions of qt4.eclass. Please update" + ewarn "the ebuild to use eapi-2 use dependencies instead." + has_version x11-libs/qt-core && local QT44=true + fi + + for x in ${QT4_BUILT_WITH_USE_CHECK}; do + if [[ -n ${QT44} ]]; then + # The use flags are different in 4.4 and above, and it's split packages, so this is used to catch + # the various use flag combos specified in the ebuilds to make sure we don't error out for no reason. + qt4_monolithic_to_split_flag ${x} + else + [[ ${x} == *accessibility ]] && x=${x#gui} && x=${x#qt3} + if ! built_with_use =x11-libs/qt-4* ${x}; then + requiredflags="${requiredflags} ${x}" + fi + fi + done + + local optionalflags="" + for x in ${QT4_OPTIONAL_BUILT_WITH_USE_CHECK}; do + if use ${x}; then + if [[ -n ${QT44} ]]; then + # The use flags are different in 4.4 and above, and it's split packages, so this is used to catch + # the various use flag combos specified in the ebuilds to make sure we don't error out for no reason. + qt4_monolithic_to_split_flag ${x} + elif ! built_with_use =x11-libs/qt-4* ${x}; then + optionalflags="${optionalflags} ${x}" + fi + fi + done + + # The use flags are different in 4.4 and above, and it's split packages, so this is used to catch + # the various use flag combos specified in the ebuilds to make sure we don't error out for no reason. + for y in ${checkpkgs}; do + if ! has_version ${y}; then + eerror "You must first install the ${y} package. It should be added to the dependencies for this package (${CATEGORY}/${PN}). See bug #217161." + ((fatalerrors+=1)) + fi + done + for y in ${checkflags}; do + if ! has_version ${y%:*}; then + eerror "You must first install the ${y%:*} package with the ${y##*:} flag enabled." + eerror "It should be added to the dependencies for this package (${CATEGORY}/${PN}). See bug #217161." + ((fatalerrors+=1)) + else + if ! built_with_use ${y%:*} ${y##*:}; then + eerror "You must first install the ${y%:*} package with the ${y##*:} flag enabled." + ((fatalerrors+=1)) + fi + fi + done + + local diemessage="" + if [[ ${fatalerrors} -ne 0 ]]; then + diemessage="${fatalerrors} fatal errors were detected. Please read the above error messages and act accordingly." + fi + if [[ -n ${requiredflags} ]]; then + eerror + eerror "(1) In order to compile ${CATEGORY}/${PN} first you need to build" + eerror "=x11-libs/qt-4* with USE=\"${requiredflags}\" flag(s)" + eerror + diemessage="(1) recompile qt4 with \"${requiredflags}\" USE flag(s) ; " + fi + if [[ -n ${optionalflags} ]]; then + eerror + eerror "(2) You are trying to compile ${CATEGORY}/${PN} package with" + eerror "USE=\"${optionalflags}\"" + eerror "while qt4 is built without this particular flag(s): it will" + eerror "not work." + eerror + eerror "Possible solutions to this problem are:" + eerror "a) install package ${CATEGORY}/${PN} without \"${optionalflags}\" USE flag(s)" + eerror "b) re-emerge qt4 with \"${optionalflags}\" USE flag(s)" + eerror + diemessage="${diemessage}(2) recompile qt4 with \"${optionalflags}\" USE flag(s) or disable them for ${PN} package\n" + fi + + [[ -n ${diemessage} ]] && die "can't install ${CATEGORY}/${PN}: ${diemessage}" +} + +# @ECLASS-VARIABLE: PATCHES +# @DESCRIPTION: +# In case you have patches to apply, specify them in the PATCHES variable. +# Make sure to specify the full path. This variable is necessary for the +# src_prepare phase. +# example: +# PATCHES=( +# "${FILESDIR}/mypatch.patch" +# "${FILESDIR}/mypatch2.patch" +# ) +# +# @FUNCTION: qt4_src_prepare +# @DESCRIPTION: +# Default src_prepare function for packages that depend on qt4. If you have to +# override src_prepare in your ebuild, you should call qt4_src_prepare in it, +# otherwise autopatcher will not work! +qt4_src_prepare() { + debug-print-function $FUNCNAME "$@" + base_src_prepare +} + +# @FUNCTION: eqmake4 +# @USAGE: [.pro file] [additional parameters to qmake] +# @DESCRIPTION: +# Runs qmake on the specified .pro file (defaults to ${PN}.pro if called +# without arguments). Additional parameters are appended unmodified to +# qmake command line. For recursive build systems, i.e. those based on +# the subdirs template, you should run eqmake4 on the top-level project +# file only, unless you have strong reasons to do things differently. +# During the building, qmake will be automatically re-invoked with the +# right arguments on every directory specified inside the top-level +# project file by the SUBDIRS variable. +eqmake4() { + has "${EAPI:-0}" 0 1 2 && use !prefix && EPREFIX= + + local projectfile="${1:-${PN}.pro}" + shift + + if [[ ! -f ${projectfile} ]]; then + echo + eerror "Project file '${projectfile#${WORKDIR}/}' does not exists!" + eerror "eqmake4 cannot handle non-existing project files." + eerror + eerror "This shouldn't happen - please send a bug report to http://bugs.gentoo.org/" + echo + die "Project file not found in ${CATEGORY}/${PN} sources." + fi + + ebegin "Running qmake on ${projectfile}" + + # make sure CONFIG variable is correctly set for both release and debug builds + local CONFIG_ADD="release" + local CONFIG_REMOVE="debug" + if has debug ${IUSE} && use debug; then + CONFIG_ADD="debug" + CONFIG_REMOVE="release" + fi + local awkscript='BEGIN { + printf "### eqmake4 was here ###\n" > file; + fixed=0; + } + /^[[:blank:]]*CONFIG[[:blank:]]*[\+\*]?=/ { + for (i=1; i <= NF; i++) { + if ($i ~ rem || $i ~ /debug_and_release/) + { $i=add; fixed=1; } + } + } + /^[[:blank:]]*CONFIG[[:blank:]]*-=/ { + for (i=1; i <= NF; i++) { + if ($i ~ add) { $i=rem; fixed=1; } + } + } + { + print >> file; + } + END { + printf "\nCONFIG -= debug_and_release %s\n", rem >> file; + printf "CONFIG += %s\n", add >> file; + print fixed; + }' + local filepath= + while read filepath; do + local file="${filepath#./}" + grep -q '^### eqmake4 was here ###$' "${file}" && continue + local retval=$({ + rm -f "${file}" || echo "FAILED" + awk -v file="${file}" -- "${awkscript}" add=${CONFIG_ADD} rem=${CONFIG_REMOVE} || echo "FAILED" + } < "${file}") + if [[ ${retval} == 1 ]]; then + einfo " Fixed CONFIG in ${file}" + elif [[ ${retval} != 0 ]]; then + eerror " An error occurred while processing ${file}" + die "eqmake4 failed to process '${file}'." + fi + done < <(find "$(dirname "${projectfile}")" -type f -name "*.pr[io]" 2>/dev/null) + + "${EPREFIX}"/usr/bin/qmake -makefile -nocache \ + QTDIR="${EPREFIX}"/usr/$(get_libdir) \ + QMAKE="${EPREFIX}"/usr/bin/qmake \ + QMAKE_CC=$(tc-getCC) \ + QMAKE_CXX=$(tc-getCXX) \ + QMAKE_LINK=$(tc-getCXX) \ + QMAKE_CFLAGS_RELEASE="${CFLAGS}" \ + QMAKE_CFLAGS_DEBUG="${CFLAGS}" \ + QMAKE_CXXFLAGS_RELEASE="${CXXFLAGS}" \ + QMAKE_CXXFLAGS_DEBUG="${CXXFLAGS}" \ + QMAKE_LFLAGS_RELEASE="${LDFLAGS}" \ + QMAKE_LFLAGS_DEBUG="${LDFLAGS}" \ + QMAKE_STRIP= \ + "${projectfile}" "${@}" + + eend $? + + # was qmake successful? + if [[ $? -ne 0 ]]; then + echo + eerror "Running qmake on '${projectfile#${WORKDIR}/}' has failed!" + eerror "This shouldn't happen - please send a bug report to http://bugs.gentoo.org/" + echo + die "qmake failed on '${projectfile}'." + fi + + return 0 +} + +case ${EAPI:-0} in + 2|3) + EXPORT_FUNCTIONS pkg_setup src_prepare + ;; + 0|1) + EXPORT_FUNCTIONS pkg_setup + ;; +esac diff --git a/sdk_container/src/third_party/portage-stable/eclass/rox-0install.eclass b/sdk_container/src/third_party/portage-stable/eclass/rox-0install.eclass new file mode 100644 index 0000000000..df7a2ab1dc --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/rox-0install.eclass @@ -0,0 +1,91 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/rox-0install.eclass,v 1.2 2007/12/04 21:26:55 lack Exp $ + +# ROX-0install eclass Version 1 + +# Created by Jim Ramsay (lack@gentoo.org) to ease installation of ROX desktop +# applications and integrate this with zeroinstall-injector +# (http://0install.net) + +# These variables are only used inside functions, and so may be set anywhere in +# the ebuild: +# +# ZEROINSTALL_STRIP_REQUIRES - this flag, if set, will force the local +# zeroinstall feed to have all its 'requires' directives stripped out +# LOCAL_FEED_SRC - The ebuild-supplied native feed, for those packages which do +# not already contain one. By default we check for ${APPNAME}.xml and +# ${APPNAME}/${APPNAME}.xml + +# This is an extension of rox.eclass +inherit rox + +DEPEND="${DEPEND} + >=rox-base/zeroinstall-injector-0.31" + +# Some locations for ZEROINSTALL +NATIVE_FEED_DIR="/usr/share/0install.net/native_feeds" +ICON_CACHE_DIR="/var/cache/0install.net/interface_icons" + +# Does all the 0install local feed magic you could want: +# - Parses the input file to get the interface URI +# - Edits the input file and installs it to the final location +# - Installs a local feed pointer +# +# Environment variables: +# ZEROINSTALL_STRIP_REQUIRES - If set, strips all 'requires' sections from the XML +# on editing. Default: Not set +# +# 0install_native_feed +# src - The XML file we will edit, install, and point at +# path - The path where the implementation will be installed +# IE, the final edited xml will be at / +0install_native_feed() { + local src=$1 path=$2 + local feedfile=${src##*/} + local dest="${path}/${feedfile}" + + 0distutils "${src}" > tmp.native_feed || die "0distutils feed edit failed" + + if [[ ${ZEROINSTALL_STRIP_REQUIRES} ]]; then + # Strip out all 'requires' sections + sed -i -e '//d' \ + -e '//,/<\/requires>/d' tmp.native_feed + fi + + ( + insinto ${path} + newins tmp.native_feed ${feedfile} + ) + + local feedname + feedname=$(0distutils -e "${src}") || die "0distutils URI escape failed" + dosym "${dest}" "${NATIVE_FEED_DIR}/${feedname}" + + local cachedname + cachedname=$(0distutils -c "${src}") || die "0distutils URI escape failed" + dosym "${path}/.DirIcon" "${ICON_CACHE_DIR}/${cachedname}" +} + +# Exported functions +rox-0install_src_install() { + # First do the regular Rox install + rox_src_install + + # Now search for the feed, and install it if found. + local search_list="${LOCAL_FEED_SRC} ${APPNAME}/${APPNAME}.xml ${APPNAME}.xml" + local installed="" + for feed in ${search_list}; do + if [[ -f "${feed}" ]]; then + 0install_native_feed "${feed}" "${APPDIR}/${APPNAME}" + installed="true" + break + fi + done + + if [[ -z ${installed} ]]; then + ewarn "No native feed found - This application will not be found by 0launch." + fi +} + +EXPORT_FUNCTIONS src_install diff --git a/sdk_container/src/third_party/portage-stable/eclass/rox.eclass b/sdk_container/src/third_party/portage-stable/eclass/rox.eclass new file mode 100644 index 0000000000..f1528fe091 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/rox.eclass @@ -0,0 +1,315 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/rox.eclass,v 1.31 2010/03/07 20:42:13 lack Exp $ + +# ROX eclass Version 3 + +# This eclass was created by Sergey Kuleshov (svyatogor@gentoo.org) and +# Alexander Simonov (devil@gentoo.org.ua) to ease installation of ROX desktop +# applications. Enhancements and python additions by Peter Hyman. +# Small fixes and current maintenance by Jim Ramsay (lack@gentoo.org) + +# These variables are used in the GLOBAL scope to decide on DEPENDs, so they +# must be set BEFORE you 'inherit rox': +# +# ROX_VER - the minimum version of rox filer required. Default is 2.1.0 +# ROX_LIB_VER - version of rox-lib required if any +# ROX_CLIB_VER - version of rox-clib required if any +# +# These variables are only used inside functions, and so may be set anywhere in +# the ebuild: +# +# APPNAME - the actual name of the application as the app folder is named +# WRAPPERNAME - the name of the wrapper installed into /usr/bin +# Defaults to 'rox-${PN}', or just ${PN} if it already starts with 'rox'. +# This does not normally need to be overridden. +# If overridden with the reserved word 'skip' no wrapper will be created. +# APPNAME_COLLISION - If not set, the old naming convention for wrappers of +# /usr/bin/${APPNAME} will still be around. Needs only be set in packages +# with known collisions (such as Pager, which collides with afterstep) +# APPCATEGORY - the .desktop categories this application should be placed in. +# If unset, no .desktop file will be created. For a list of acceptable +# category names, see +# http://standards.freedesktop.org/menu-spec/latest/apa.html +# APPMIME - the .desktop MimeTypes value to include. This is a +# semicolon-delimited list of mime-types. Any characters in [[:space:]] are +# ignored. If the supported mime-types are dependent upon USE flags, the new +# 'usemime' function may be useful. For example: +# APPMIME="a/foo-1;a/foo-2 +# $(usemime three "a/three") +# text/plain" +# will be expanded to either "a/foo-1;a/foo-2;a/three;text/plain" if +# USE=three or "a/foo-1;a/foo-2;text/plain" if not. +# WARNING: the 'usemime' function cannot be used in global scope. You should +# set APPMIME (or at least the USE-dependant parts) in your own src_install +# before calling rox_src_install. See rox-extra/archive for an example. +# KEEP_SRC - this flag, if set, will not remove the source directory +# but will do a 'make clean' in it. This is useful if users wish to +# preserve the source code for some reason + +# For examples refer to ebuilds in rox-extra/ or rox-base/ + +# need python to byte compile modules, if any +# need autotools to run autoreconf, if required +inherit python autotools eutils multilib + +ROX_VER=${ROX_VER:-"2.1.0"} + +RDEPEND=">=rox-base/rox-${ROX_VER}" + +if [[ ${ROX_LIB_VER} ]]; then + RDEPEND="${RDEPEND} + >=rox-base/rox-lib-${ROX_LIB_VER}" +fi + +if [[ ${ROX_CLIB_VER} ]]; then + RDEPEND="${RDEPEND} + >=rox-base/rox-clib-${ROX_CLIB_VER}" + DEPEND="${DEPEND} + >=rox-base/rox-clib-${ROX_CLIB_VER} + >=dev-util/pkgconfig-0.20" +fi + +# This is the new wrapper name (for /usr/bin/) +# It is also used for the icon name in /usr/share/pixmaps +# +# Use rox-${PN} unless ${PN} already starts with 'rox' +_a="rox-${PN}" +_b=${_a/rox-rox*} +WRAPPERNAME=${_b:-${PN}} +unset _a _b + +# This is the location where all applications are installed +LIBDIR="/usr/$(get_libdir)" +APPDIR="${LIBDIR}/rox" + +# External Functions + +# Used for assembling APPMIME with USE-dependent parts +# WARNING: Cannot be used in global scope. +# Set this in src_install just before you call rox_src_install +usemime() { + local myuse="$1"; shift + use "${myuse}" && echo "$@" +} + +# Utility Functions + +# Expands APPMIME properly, removing whitespace, newlines, and putting in ';' +# where needed. +expandmime() { + local old_IFS=$IFS + IFS=$'; \t\n' + echo "$*" + IFS=$old_IFS +} + +# Creates a .desktop file for this rox application +# (Adapted from eutils::make_desktop_entry) +# +# rox_desktop_entry [ ...] +# exec - The executable to run +# name - The name to display +# icon - The icon file to display +# Any other arguments will be appended verbatim to the desktop file. +# +# The name of the desktop file will be ${exec}.desktop +# +rox_desktop_entry() { + # Coppied from etuils:make_desktop_entry + local exec=${1}; shift + local name=${1}; shift + local icon=${1}; shift + local type=${1}; shift + + local desktop="${exec}.desktop" + + cat <<-EOF > "${desktop}" + [Desktop Entry] + Name=${name} + Type=Application + Comment=${DESCRIPTION} + Exec=${exec} + TryExec=${exec%% *} + Icon=${icon} + Categories=${type}; + EOF + + local extra=${1}; shift + while [[ "${extra}" ]]; do + echo "${extra}" >> "${desktop}" + extra=${1}; shift + done + + # Subshell, so as to not pollute the caller's env. + ( + insinto /usr/share/applications + doins "${desktop}" + ) +} + +# +# Install the wrapper in /usr/bin for commandline execution +# +# Environment needed: +# WRAPPERNAME, APPDIR, LIBDIR, APPNAME, APPNAME_COLLISION +# +rox_install_wrapper() { + if [[ "${WRAPPERNAME}" != "skip" ]]; then + #create a script in bin to run the application from command line + dodir /usr/bin/ + cat >"${D}/usr/bin/${WRAPPERNAME}" </#read/' AppRun + + ./AppRun --compile || die "Failed to compile the package" + if [[ -n "${KEEP_SRC}" ]]; then + emake -C src clean + else + rm -rf src + fi + if [[ -d build ]]; then + rm -rf build + fi + + # Restore the original AppRun + mv AppRun.bak AppRun + fi +} + +rox_src_install() { + if [[ -d "${APPNAME}/Help/" ]]; then + for i in "${APPNAME}"/Help/*; do + dodoc "${i}" + done + fi + + insinto "${APPDIR}" + + # Use 'cp -pPR' and not 'doins -r' here so we don't have to do a flurry of + # 'chmod' calls on the executables in the appdir - Just be sure that all the + # files in the original appdir prior to this step are correct, as they will + # all be preserved. + cp -pPR ${APPNAME} "${D}${APPDIR}/${APPNAME}" + + # Install the wrapper in /usr/bin + rox_install_wrapper + + # Install the .desktop application file + rox_install_desktop +} + +rox_pkg_postinst() { + python_mod_optimize "${APPDIR}/${APPNAME}" >/dev/null 2>&1 + + einfo "${APPNAME} has been installed into ${APPDIR}" + if [[ "${WRAPPERNAME}" != "skip" ]]; then + einfo "You can run it by typing ${WRAPPERNAME} at the command line." + einfo "Or, you can run it by pointing the ROX file manager to the" + else + einfo "You can run it by pointing the ROX file manager to the" + fi + einfo "install location -- ${APPDIR} -- and click" + einfo "on ${APPNAME}'s icon, drag it to a panel, desktop, etc." +} + +rox_pkg_postrm() { + python_mod_cleanup "${APPDIR}" +} + + +EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm diff --git a/sdk_container/src/third_party/portage-stable/eclass/rpm.eclass b/sdk_container/src/third_party/portage-stable/eclass/rpm.eclass new file mode 100644 index 0000000000..b6b8341b5a --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/rpm.eclass @@ -0,0 +1,100 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/rpm.eclass,v 1.19 2009/10/05 06:14:36 vapier Exp $ + +# @ECLASS: rpm.eclass +# @MAINTAINER: +# base-system@gentoo.org +# @BLURB: convenience class for extracting RPMs + +inherit eutils + +DEPEND=">=app-arch/rpm2targz-9.0.0.3g" + +# @FUNCTION: rpm_unpack +# @USAGE: +# @DESCRIPTION: +# Unpack the contents of the specified rpms like the unpack() function. +rpm_unpack() { + [[ $# -eq 0 ]] && set -- ${A} + local a + for a in "$@" ; do + echo ">>> Unpacking ${a} to ${PWD}" + if [[ ${a} == ./* ]] ; then + : nothing to do -- path is local + elif [[ ${a} == ${DISTDIR}/* ]] ; then + ewarn 'QA: do not use ${DISTDIR} with rpm_unpack -- it is added for you' + elif [[ ${a} == /* ]] ; then + ewarn 'QA: do not use full paths with rpm_unpack -- use ./ paths instead' + else + a="${DISTDIR}/${a}" + fi + rpm2tar -O "${a}" | tar xf - || die "failure unpacking ${a}" + done +} + +# @FUNCTION: srcrpm_unpack +# @USAGE: +# @DESCRIPTION: +# Unpack the contents of the specified rpms like the unpack() function as well +# as any archives that it might contain. Note that the secondary archive +# unpack isn't perfect in that it simply unpacks all archives in the working +# directory (with the assumption that there weren't any to start with). +srcrpm_unpack() { + [[ $# -eq 0 ]] && set -- ${A} + rpm_unpack "$@" + + # no .src.rpm files, then nothing to do + [[ "$* " != *".src.rpm " ]] && return 0 + + local old_shopts=$(shopt -p nullglob) + shopt -s nullglob + + # unpack everything + local a + for a in *.tar.{gz,bz2} *.t{gz,bz2} *.zip *.ZIP ; do + unpack "./${a}" + rm -f "${a}" + done + + eval "${old_shopts}" + + return 0 +} + +# @FUNCTION: rpm_src_unpack +# @DESCRIPTION: +# Automatically unpack all archives in ${A} including rpms. If one of the +# archives in a source rpm, then the sub archives will be unpacked as well. +rpm_src_unpack() { + local a + for a in ${A} ; do + case ${a} in + *.rpm) srcrpm_unpack "${a}" ;; + *) unpack "${a}" ;; + esac + done +} + +# @FUNCTION: rpm_spec_epatch +# @USAGE: [spec] +# @DESCRIPTION: +# Read the specified spec (defaults to ${PN}.spec) and attempt to apply +# all the patches listed in it. If the spec does funky things like moving +# files around, well this won't handle that. +rpm_spec_epatch() { + local p spec=${1:-${PN}.spec} + local dir=${spec%/*} + grep '^%patch' "${spec}" | \ + while read line ; do + set -- ${line} + p=$1 + shift + EPATCH_OPTS="$*" + set -- $(grep "^P${p#%p}: " "${spec}") + shift + epatch "${dir:+${dir}/}$*" + done +} + +EXPORT_FUNCTIONS src_unpack diff --git a/sdk_container/src/third_party/portage-stable/eclass/ruby-fakegem.eclass b/sdk_container/src/third_party/portage-stable/eclass/ruby-fakegem.eclass new file mode 100644 index 0000000000..26f029a0e6 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/ruby-fakegem.eclass @@ -0,0 +1,339 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-fakegem.eclass,v 1.17 2010/02/19 11:59:38 flameeyes Exp $ +# +# @ECLASS: ruby-fakegem.eclass +# @MAINTAINER: +# Ruby herd +# +# Author: Diego E. Pettenò +# +# Author: Alex Legler +# +# @BLURB: An eclass for installing Ruby packages to behave like RubyGems. +# @DESCRIPTION: +# This eclass allows to install arbitrary Ruby libraries (including Gems), +# providing integration into the RubyGems system even for "regular" packages. +# + +inherit ruby-ng + +# @ECLASS-VARIABLE: RUBY_FAKEGEM_NAME +# @DESCRIPTION: +# Sets the Gem name for the generated fake gemspec. +# RUBY_FAKEGEM_NAME="${PN}" + +# @ECLASS-VARIABLE: RUBY_FAKEGEM_VERSION +# @DESCRIPTION: +# Sets the Gem version for the generated fake gemspec. +# RUBY_FAKEGEM_VERSION="${PV}" + +# @ECLASS-VARIABLE: RUBY_FAKEGEM_TASK_DOC +# @DESCRIPTION: +# Specify the rake(1) task to run to generate documentation. +# RUBY_FAKEGEM_TASK_DOC="rdoc" + +# @ECLASS-VARIABLE: RUBY_FAKEGEM_TASK_TEST +# @DESCRIPTION: +# Specify the rake(1) task used for executing tests. +# RUBY_FAKEGEM_TASK_TEST="test" + +# @ECLASS-VARIABLE: RUBY_FAKEGEM_DOCDIR +# @DESCRIPTION: +# Specify the directory under which the documentation is built; +# if empty no documentation will be installed automatically. +# RUBY_FAKEGEM_DOCDIR="" + +# @ECLASS-VARIABLE: RUBY_FAKEGEM_EXTRADOC +# @DESCRIPTION: +# Extra documentation to install (readme, changelogs, …). +# RUBY_FAKEGEM_EXTRADOC="" + +# @ECLASS-VARIABLE: RUBY_FAKEGEM_BINWRAP +# @DESCRIPTION: +# Binaries to wrap around (relative to the bin/ directory) +# RUBY_FAKEGEM_BINWRAP="*" + +# @ECLASS-VARIABLE: RUBY_FAKEGEM_REQUIRE_PATHS +# @DESCRIPTION: +# Extra require paths (beside lib) to add to the specification +# RUBY_FAKEGEM_REQUIRE_PATHS="" + +RUBY_FAKEGEM_NAME="${RUBY_FAKEGEM_NAME:-${PN}}" +RUBY_FAKEGEM_VERSION="${RUBY_FAKEGEM_VERSION:-${PV/_pre/.pre}}" +RUBY_FAKEGEM_SUFFIX="${RUBY_FAKEGEM_SUFFIX:-}" + +RUBY_FAKEGEM_TASK_DOC="${RUBY_FAKEGEM_TASK_DOC-rdoc}" +RUBY_FAKEGEM_TASK_TEST="${RUBY_FAKEGEM_TASK_TEST-test}" + +RUBY_FAKEGEM_BINWRAP="${RUBY_FAKEGEM_BINWRAP-*}" + +if [[ ${RUBY_FAKEGEM_TASK_DOC} != "" ]]; then + IUSE="$IUSE doc" + ruby_add_bdepend doc "dev-ruby/rake" +fi + +if [[ ${RUBY_FAKEGEM_TASK_TEST} != "" ]]; then + IUSE="$IUSE test" + ruby_add_bdepend test "dev-ruby/rake" +fi + +SRC_URI="mirror://rubygems/${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}${RUBY_FAKEGEM_SUFFIX:+-${RUBY_FAKEGEM_SUFFIX}}.gem" + +ruby_add_rdepend virtual/rubygems + +# @FUNCTION: ruby_fakegem_gemsdir +# @RETURN: Returns the gem data directory +# @DESCRIPTION: +# This function returns the gems data directory for the ruby +# implementation in question. +ruby_fakegem_gemsdir() { + local _gemsitedir=$(${RUBY} -r rbconfig -e 'print Config::CONFIG["sitelibdir"]' | sed -e 's:site_ruby:gems:') + + [[ -z ${_gemsitedir} ]] && { + eerror "Unable to find the gems dir" + die "Unable to find the gems dir" + } + + echo "${_gemsitedir}" +} + +# @FUNCTION: ruby_fakegem_doins +# @USAGE: file [file...] +# @DESCRIPTION: +# Installs the specified file(s) into the gems directory. +ruby_fakegem_doins() { + ( + insinto $(ruby_fakegem_gemsdir)/gems/${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION} + doins "$@" + ) || die "failed $0 $@" +} + +# @FUNCTION: ruby_fakegem_newsins() +# @USAGE: file filename +# @DESCRIPTION: +# Installs the specified file into the gems directory using the provided filename. +ruby_fakegem_newins() { + ( + # Since newins does not accept full paths but just basenames + # for the target file, we want to extend it here. + local newdirname=/$(dirname "$2") + [[ ${newdirname} == "/." ]] && newdirname= + + local newbasename=$(basename "$2") + + insinto $(ruby_fakegem_gemsdir)/gems/${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}${newdirname} + newins "$1" ${newbasename} + ) || die "failed $0 $@" +} + +# @FUNCTION: ruby_fakegem_genspec +# @DESCRIPTION: +# Generates a gemspec for the package and places it into the "specifications" +# directory of RubyGems. +# In the gemspec, the following values are set: name, version, summary, +# homepage, and require_paths=["lib"]. +# See RUBY_FAKEGEM_NAME and RUBY_FAKEGEM_VERSION for setting name and version. +# See RUBY_FAKEGEM_REQUIRE_PATHS for setting extra require paths. +ruby_fakegem_genspec() { + ( + local required_paths="'lib'" + for path in ${RUBY_FAKEGEM_REQUIRE_PATHS}; do + required_paths="${required_paths}, '${path}'" + done + + # We use the _ruby_implementation variable to avoid having stray + # copies with different implementations; while for now we're using + # the same exact content, we might have differences in the future, + # so better taking this into consideration. + local quoted_description=${DESCRIPTION//\"/\\\"} + cat - > "${T}"/${RUBY_FAKEGEM_NAME}-${_ruby_implementation} < "${T}"/gembin-wrapper-${gembinary} </dev/null + + ebegin "Unpacking data.tar.gz" + tar -mxf "${my_WORKDIR}"/data.tar.gz || die + eend $? + popd &>/dev/null + else + [[ -n ${A} ]] && unpack ${A} + fi +} + +# @FUNCTION: all_ruby_compile +# @DESCRIPTION: +# Compile the package. +all_ruby_compile() { + all_fakegem_compile +} + +# @FUNCTION: each_fakegem_test +# @DESCRIPTION: +# Run tests for the package for each ruby target if the test task is defined. +each_fakegem_test() { + local rubyflags= + ${RUBY} ${rubyflags} -S rake ${RUBY_FAKEGEM_TASK_TEST} || die "tests failed" +} + +if [[ ${RUBY_FAKEGEM_TASK_TEST} != "" ]]; then + # @FUNCTION: each_ruby_test + # @DESCRIPTION: + # Run the tests for this package. + each_ruby_test() { + each_fakegem_test + } +fi + +# @FUNCTION: each_fakegem_install +# @DESCRIPTION: +# Install the package for each ruby target. +each_fakegem_install() { + ruby_fakegem_genspec + + local _gemlibdirs="${RUBY_FAKEGEM_EXTRAINSTALL}" + for directory in bin lib; do + [[ -d ${directory} ]] && _gemlibdirs="${_gemlibdirs} ${directory}" + done + + [[ -n ${_gemlibdirs} ]] && \ + ruby_fakegem_doins -r ${_gemlibdirs} +} + +# @FUNCTION: each_ruby_install +# @DESCRIPTION: +# Install the package for each target. +each_ruby_install() { + each_fakegem_install +} + +# @FUNCTION: all_fakegem_install +# @DESCRIPTION: +# Install files common to all ruby targets. +all_fakegem_install() { + if [[ -n ${RUBY_FAKEGEM_DOCDIR} ]] && [[ ${RUBY_FAKEGEM_TASK_DOC} != "" ]] && use doc; then + for dir in ${RUBY_FAKEGEM_DOCDIR}; do + pushd ${dir} &>/dev/null + dohtml -r * || die "failed to install documentation" + popd &>/dev/null + done + fi + + if [[ -n ${RUBY_FAKEGEM_EXTRADOC} ]]; then + dodoc ${RUBY_FAKEGEM_EXTRADOC} || die "failed to install further documentation" + fi + + # binary wrappers; we assume that all the implementations get the + # same binaries, or something is wrong anyway, so... + if [[ -n ${RUBY_FAKEGEM_BINWRAP} ]]; then + local bindir=$(find "${D}" -type d -path "*/gems/${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/bin" -print -quit) + + if [[ -d "${bindir}" ]]; then + pushd "${bindir}" &>/dev/null + local binaries=$(eval ls ${RUBY_FAKEGEM_BINWRAP}) + for binary in $binaries; do + ruby_fakegem_binwrapper $binary + done + popd &>/dev/null + fi + fi +} + +# @FUNCTION: all_ruby_install +# @DESCRIPTION: +# Install files common to all ruby targets. +all_ruby_install() { + all_fakegem_install +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/ruby-gnome2.eclass b/sdk_container/src/third_party/portage-stable/eclass/ruby-gnome2.eclass new file mode 100644 index 0000000000..fd78546145 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/ruby-gnome2.eclass @@ -0,0 +1,80 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-gnome2.eclass,v 1.16 2009/09/13 12:30:44 flameeyes Exp $ +# +# This eclass simplifies installation of the various pieces of +# ruby-gnome2 since they share a very common installation procedure. +# It's possible that this could provide a foundation for a generalized +# ruby-module.eclass, but at the moment it contains some things +# specific to ruby-gnome2 + +# Variables: +# PATCHES Space delimited list of patch files. + +inherit multilib + +EXPORT_FUNCTIONS src_compile src_install src_unpack + +IUSE="" + +subbinding=${PN#ruby-} ; subbinding=${subbinding%2} +S=${WORKDIR}/ruby-gnome2-all-${PV}/${subbinding} +SRC_URI="mirror://sourceforge/ruby-gnome2/ruby-gnome2-all-${PV}.tar.gz" +HOMEPAGE="http://ruby-gnome2.sourceforge.jp/" +LICENSE="Ruby" +SLOT="0" + +# This eclass can currently only deal with a single ruby version, see +# bug 278012. Since the code is know to work with Ruby 1.8 we +# hard-code it to that version for now. + +DEPEND="=dev-lang/ruby-1.8*" +RDEPEND="${DEPEND}" +USE_RUBY="ruby18" +RUBY=/usr/bin/ruby18 + +ruby-gnome2_src_unpack() { + if [ ! -x /bin/install -a -x /usr/bin/install ]; then + cat <"${T}"/mkmf.rb +require 'mkmf' + +STDERR.puts 'patching mkmf' +CONFIG['INSTALL'] = '/usr/bin/install' +END + # save it because rubygems needs it (for unsetting RUBYOPT) + export GENTOO_RUBYOPT="-r${T}/mkmf.rb" + export RUBYOPT="${RUBYOPT} ${GENTOO_RUBYOPT}" + fi + + unpack ${A} + cd "${S}" + # apply bulk patches + if [[ ${#PATCHES[@]} -gt 1 ]]; then + for x in "${PATCHES[@]}"; do + epatch "${x}" + done + else + for x in ${PATCHES}; do + epatch "${x}" + done + fi +} + +ruby-gnome2_src_compile() { + ${RUBY} extconf.rb || die "extconf.rb failed" + emake CC=${CC:-gcc} CXX=${CXX:-g++} || die "emake failed" +} + +ruby-gnome2_src_install() { + # Create the directories, or the package will create them as files. + dodir $(${RUBY} -r rbconfig -e 'print Config::CONFIG["sitearchdir"]') /usr/$(get_libdir)/pkgconfig + + make DESTDIR="${D}" install || die "make install failed" + for doc in ../AUTHORS ../NEWS ChangeLog README; do + [ -s "$doc" ] && dodoc $doc + done + if [[ -d sample ]]; then + dodir /usr/share/doc/${PF} + cp -a sample "${D}"/usr/share/doc/${PF} || die "cp failed" + fi +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/ruby-ng-gnome2.eclass b/sdk_container/src/third_party/portage-stable/eclass/ruby-ng-gnome2.eclass new file mode 100644 index 0000000000..ca0165e1a1 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/ruby-ng-gnome2.eclass @@ -0,0 +1,61 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng-gnome2.eclass,v 1.1 2010/01/13 18:33:32 graaff Exp $ +# +# @ECLASS: ruby-ng-gnome2.eclass +# @MAINTAINER: +# Ruby herd +# +# Author: Hans de Graaff +# +# @BLURB: +# This eclass simplifies installation of the various pieces of +# ruby-gnome2 since they share a very common installation procedure. + +inherit ruby-ng multilib + +IUSE="" + +subbinding=${PN#ruby-} ; subbinding=${subbinding%2} +S=${WORKDIR}/ruby-gnome2-all-${PV}/${subbinding} +SRC_URI="mirror://sourceforge/ruby-gnome2/ruby-gnome2-all-${PV}.tar.gz" +HOMEPAGE="http://ruby-gnome2.sourceforge.jp/" +LICENSE="Ruby" +SLOT="0" + +# @FUNCTION: each_ruby_configure +# @DESCRIPTION: +# Run the configure script in the subbinding for each specific ruby target. +each_ruby_configure() { + ${RUBY} extconf.rb || die "extconf.rb failed" +} + +# @FUNCTION: each_ruby_compile +# @DESCRIPTION: +# Compile the C bindings in the subbinding for each specific ruby target. +each_ruby_compile() { + emake || die "emake failed" +} + +# @FUNCTION: each_ruby_install +# @DESCRIPTION: +# Install the files in the subbinding for each specific ruby target. +each_ruby_install() { + # Create the directories, or the package will create them as files. + dodir $(${RUBY} -r rbconfig -e 'print Config::CONFIG["sitearchdir"]') /usr/$(get_libdir)/pkgconfig + + emake DESTDIR="${D}" install || die "make install failed" +} + +# @FUNCTION: all_ruby_install +# @DESCRIPTION: +# Install the files common to all ruby targets. +all_ruby_install() { + for doc in ../AUTHORS ../NEWS ChangeLog README; do + [ -s "$doc" ] && dodoc $doc + done + if [[ -d sample ]]; then + dodir /usr/share/doc/${PF} + cp -a sample "${D}"/usr/share/doc/${PF} || die "cp failed" + fi +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/ruby-ng.eclass b/sdk_container/src/third_party/portage-stable/eclass/ruby-ng.eclass new file mode 100644 index 0000000000..2c3d539ed8 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/ruby-ng.eclass @@ -0,0 +1,441 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.8 2010/01/15 12:58:20 flameeyes Exp $ +# +# @ECLASS: ruby-ng.eclass +# @MAINTAINER: +# Ruby herd +# +# Author: Diego E. Pettenò +# +# Author: Alex Legler +# +# Author: Hans de Graaff +# +# @BLURB: An eclass for installing Ruby packages with proper support for multiple Ruby slots. +# @DESCRIPTION: +# The Ruby eclass is designed to allow an easier installation of Ruby packages +# and their incorporation into the Gentoo Linux system. +# +# Currently available targets are: +# * ruby18 - Ruby (MRI) 1.8.x +# * ruby19 - Ruby (MRI) 1.9.x +# * ree18 - Ruby Enterprise Edition 1.8.x +# * jruby - JRuby +# +# This eclass does not define the implementation of the configure, +# compile, test, or install phases. Instead, the default phases are +# used. Specific implementations of these phases can be provided in +# the ebuild either to be run for each Ruby implementation, or for all +# Ruby implementations, as follows: +# +# * each_ruby_configure +# * all_ruby_configure + +# @ECLASS-VARIABLE: USE_RUBY +# @DESCRIPTION: +# This variable contains a space separated list of targets (see above) a package +# is compatible to. It must be set before the `inherit' call. There is no +# default. All ebuilds are expected to set this variable. + +# @ECLASS-VARIABLE: RUBY_PATCHES +# @DESCRIPTION: +# A String or Array of filenames of patches to apply to all implementations. + +# @ECLASS-VARIABLE: RUBY_OPTIONAL +# @DESCRIPTION: +# Set the value to "yes" to make the dependency on a Ruby interpreter optional. + +inherit eutils toolchain-funcs + +EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_test src_install pkg_setup + +case ${EAPI} in + 0|1) + die "Unsupported EAPI=${EAPI} (too old) for ruby-ng.eclass" ;; + 2) ;; + *) + die "Unknown EAPI=${EAPI} for ruby-ng.eclass" +esac + +# @FUNCTION: ruby_implementation_depend +# @USAGE: target [comparator [version]] +# @RETURN: Package atom of a Ruby implementation to be used in dependencies. +# @DESCRIPTION: +# This function returns the formal package atom for a Ruby implementation. +# +# `target' has to be one of the valid values for USE_RUBY (see above) +# +# Set `comparator' and `version' to include a comparator (=, >=, etc.) and a +# version string to the returned string +ruby_implementation_depend() { + local rubypn= + local rubyslot= + + case $1 in + ruby18) + rubypn="dev-lang/ruby" + rubyslot=":1.8" + ;; + ruby19) + rubypn="dev-lang/ruby" + rubyslot=":1.9" + ;; + ree18) + rubypn="dev-lang/ruby-enterprise" + rubyslot=":1.8" + ;; + jruby) + rubypn="dev-java/jruby" + rubyslot="" + ;; + *) die "$1: unknown Ruby implementation" + esac + + echo "$2${rubypn}$3${rubyslot}" +} + +# @FUNCTION: ruby_samelib +# @RETURN: use flag string with current ruby implementations +# @DESCRIPTION: +# Convenience function to output the use dependency part of a +# dependency. Used as a building block for ruby_add_rdepend() and +# ruby_add_bdepend(), but may also be useful in an ebuild to specify +# more complex dependencies. +ruby_samelib() { + local res= + for _ruby_implementation in $USE_RUBY; do + has -${_ruby_implementation} $@ || \ + res="${res}ruby_targets_${_ruby_implementation}?," + done + + echo "[${res%,}]" +} + +_ruby_implementation_depend() { + echo "ruby_targets_${1}? ( ${2}[ruby_targets_${1}] )" +} + +_ruby_add_bdepend() { + local atom=$1 + local conditions=$2 + + for condition in $conditions; do + hasq $condition "$IUSE" || IUSE="${IUSE} $condition" + atom="${condition}? ( ${atom} )" + done + + DEPEND="${DEPEND} ${atom}" + RDEPEND="${RDEPEND}" +} + +_ruby_add_rdepend() { + local atom=$1 + local conditions=$2 + + for condition in $conditions; do + hasq $condition "$IUSE" || IUSE="${IUSE} $condition" + atom="${condition}? ( ${atom} )" + done + + RDEPEND="${RDEPEND} ${atom}" + _ruby_add_bdepend "$atom" test +} + +# @FUNCTION: ruby_add_rdepend +# @USAGE: [conditions] atom +# @DESCRIPTION: +# Adds the specified atom(s) with optional use condition(s) to +# RDEPEND, taking the current set of ruby targets into account. This +# makes sure that all ruby dependencies of the package are installed +# for the same ruby targets. Use this function for all ruby +# dependencies instead of setting RDEPEND yourself. Both atom and +# conditions can be a space-separated list of atoms or conditions. +ruby_add_rdepend() { + local atoms= + local conditions= + case $# in + 1) + atoms=$1 + ;; + 2) + conditions=$1 + atoms=$2 + ;; + *) + die "bad number of arguments to $0" + ;; + esac + + for atom in $atoms; do + _ruby_add_rdepend "${atom}$(ruby_samelib)" "$conditions" + done +} + +# @FUNCTION: ruby_add_bdepend +# @USAGE: [conditions] atom +# @DESCRIPTION: +# Adds the specified atom(s) with optional use condition(s) to both +# DEPEND and RDEPEND, taking the current set of ruby targets into +# account. This makes sure that all ruby dependencies of the package +# are installed for the same ruby targets. Use this function for all +# ruby dependencies instead of setting DEPEND and RDEPEND +# yourself. Both atom and conditions can be a space-separated list of +# atoms or conditions. +ruby_add_bdepend() { + local atoms= + local conditions= + case $# in + 1) + atoms=$1 + ;; + 2) + conditions=$1 + atoms=$2 + ;; + *) + die "bad number of arguments to $0" + ;; + esac + + for atom in $atoms; do + _ruby_add_bdepend "${atom}$(ruby_samelib)" "$conditions" + done +} + +for _ruby_implementation in $USE_RUBY; do + IUSE="${IUSE} ruby_targets_${_ruby_implementation}" + + # If you specify RUBY_OPTIONAL you also need to take care of + # ruby useflag and dependency. + if [[ ${RUBY_OPTIONAL} != "yes" ]]; then + DEPEND="${DEPEND} ruby_targets_${_ruby_implementation}? ( $(ruby_implementation_depend $_ruby_implementation) )" + RDEPEND="${RDEPEND} ruby_targets_${_ruby_implementation}? ( $(ruby_implementation_depend $_ruby_implementation) )" + fi +done + +_ruby_invoke_environment() { + old_S=${S} + sub_S=${S#${WORKDIR}} + + environment=$1; shift + + my_WORKDIR="${WORKDIR}"/${environment} + S="${my_WORKDIR}"/"${sub_S}" + + if [[ -d "${S}" ]]; then + pushd "$S" &>/dev/null + elif [[ -d "${my_WORKDIR}" ]]; then + pushd "${my_WORKDIR}" &>/dev/null + else + pushd "${WORKDIR}" &>/dev/null + fi + + ebegin "Running ${_PHASE:-${EBUILD_PHASE}} phase for $environment" + "$@" + popd &>/dev/null + + S=${old_S} +} + +_ruby_each_implementation() { + local invoked=no + for _ruby_implementation in ${USE_RUBY}; do + # only proceed if it's requested + use ruby_targets_${_ruby_implementation} || continue + + RUBY=$(type -p $_ruby_implementation 2>/dev/null) + invoked=yes + + if [[ -n "$1" ]]; then + _ruby_invoke_environment $_ruby_implementation "$@" + fi + + unset RUBY + done + + [[ ${invoked} == "no" ]] && die "You need to select at least one Ruby implementation by setting RUBY_TARGETS in /etc/make.conf." +} + +# @FUNCTION: ruby-ng_pkg_setup +# @DESCRIPTION: +# Check whether at least one ruby target implementation is present. +ruby-ng_pkg_setup() { + # This only checks that at least one implementation is present + # before doing anything; by leaving the parameters empty we know + # it's a special case. + _ruby_each_implementation +} + +# @FUNCTION: ruby-ng_src_unpack +# @DESCRIPTION: +# Unpack the source archive. +ruby-ng_src_unpack() { + mkdir "${WORKDIR}"/all + pushd "${WORKDIR}"/all &>/dev/null + + # We don't support an each-unpack, it's either all or nothing! + if type all_ruby_unpack &>/dev/null; then + _ruby_invoke_environment all all_ruby_unpack + else + [[ -n ${A} ]] && unpack ${A} + fi + + popd &>/dev/null +} + +_ruby_apply_patches() { + for patch in "${RUBY_PATCHES[@]}"; do + if [ -f "${patch}" ]; then + epatch "${patch}" + elif [ -f "${FILESDIR}/${patch}" ]; then + epatch "${FILESDIR}/${patch}" + else + die "Cannot find patch ${patch}" + fi + done + + # This is a special case: instead of executing just in the special + # "all" environment, this will actually copy the effects on _all_ + # the other environments, and is thus executed before the copy + type all_ruby_prepare &>/dev/null && all_ruby_prepare +} + +_ruby_source_copy() { + # Until we actually find a reason not to, we use hardlinks, this + # should reduce the amount of disk space that is wasted by this. + cp -prl all ${_ruby_implementation} \ + || die "Unable to copy ${_ruby_implementation} environment" +} + +# @FUNCTION: ruby-ng_src_prepare +# @DESCRIPTION: +# Apply patches and prepare versions for each ruby target +# implementation. Also carry out common clean up tasks. +ruby-ng_src_prepare() { + # Way too many Ruby packages are prepared on OSX without removing + # the extra data forks, we do it here to avoid repeating it for + # almost every other ebuild. + find . -name '._*' -delete + + _ruby_invoke_environment all _ruby_apply_patches + + _PHASE="source copy" \ + _ruby_each_implementation _ruby_source_copy + + if type each_ruby_prepare &>/dev/null; then + _ruby_each_implementation each_ruby_prepare + fi +} + +# @FUNCTION: ruby-ng_src_configure +# @DESCRIPTION: +# Configure the package. +ruby-ng_src_configure() { + if type each_ruby_configure &>/dev/null; then + _ruby_each_implementation each_ruby_configure + fi + + type all_ruby_configure &>/dev/null && \ + _ruby_invoke_environment all all_ruby_configure +} + +# @FUNCTION: ruby-ng_src_compile +# @DESCRIPTION: +# Compile the package. +ruby-ng_src_compile() { + if type each_ruby_compile &>/dev/null; then + _ruby_each_implementation each_ruby_compile + fi + + type all_ruby_compile &>/dev/null && \ + _ruby_invoke_environment all all_ruby_compile +} + +# @FUNCTION: ruby-ng_src_test +# @DESCRIPTION: +# Run tests for the package. +ruby-ng_src_test() { + if type each_ruby_test &>/dev/null; then + _ruby_each_implementation each_ruby_test + fi + + type all_ruby_test &>/dev/null && \ + _ruby_invoke_environment all all_ruby_test +} + +_each_ruby_check_install() { + local libruby_basename=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["LIBRUBY_SO"]') + local libruby_soname=$(scanelf -qS "/usr/$(get_libdir)/${libruby_basename}" | awk '{ print $1 }') + local sitedir=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["sitedir"]') + local sitelibdir=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["sitelibdir"]') + + # Look for wrong files in sitedir + if [[ -d "${D}${sitedir}" ]]; then + local f=$(find "${D}${sitedir}" -mindepth 1 -maxdepth 1 -not -wholename "${D}${sitelibdir}") + if [[ -n ${f} ]]; then + eerror "Found files in sitedir, outsite sitelibdir:" + eerror "${f}" + die "Misplaced files in sitedir" + fi + fi + + # The current implementation lacks libruby (i.e.: jruby) + [[ -z ${libruby_soname} ]] && return 0 + + scanelf -qnR "${D}${sitedir}" \ + | fgrep -v "${libruby_soname}" \ + > "${T}"/ruby-ng-${_ruby_implementation}-mislink.log + + if [[ -s "${T}"/ruby-ng-${_ruby_implementation}-mislink.log ]]; then + ewarn "Extensions installed for ${_ruby_implementation} with missing links to ${libruby}" + ewarn $(< "${T}"/ruby-ng-${_ruby_implementation}-mislink.log ) + die "Missing links to ${libruby}" + fi +} + +# @FUNCTION: ruby-ng_src_install +# @DESCRIPTION: +# Install the package for each ruby target implementation. +ruby-ng_src_install() { + if type each_ruby_install &>/dev/null; then + _ruby_each_implementation each_ruby_install + fi + + type all_ruby_install &>/dev/null && \ + _ruby_invoke_environment all all_ruby_install + + _PHASE="check install" \ + _ruby_each_implementation _each_ruby_check_install +} + +# @FUNCTION: doruby +# @USAGE: file [file...] +# @DESCRIPTION: +# Installs the specified file(s) into the sitelibdir of the Ruby interpreter in ${RUBY}. +doruby() { + [[ -z ${RUBY} ]] && die "\$RUBY is not set" + ( # don't want to pollute calling env + insinto $(${RUBY} -rrbconfig -e 'print Config::CONFIG["sitelibdir"]') + insopts -m 0644 + doins "$@" + ) || die "failed to install $@" +} + +# @FUNCTION: ruby_get_libruby +# @RETURN: The location of libruby*.so belonging to the Ruby interpreter in ${RUBY}. +ruby_get_libruby() { + ${RUBY} -rrbconfig -e 'puts File.join(Config::CONFIG["libdir"], Config::CONFIG["LIBRUBY"])' +} + +# @FUNCTION: ruby_get_hdrdir +# @RETURN: The location of the header files belonging to the Ruby interpreter in ${RUBY}. +ruby_get_hdrdir() { + local rubyhdrdir=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["rubyhdrdir"]') + + if [[ "${rubyhdrdir}" = "nil" ]] ; then + rubyhdrdir=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["archdir"]') + fi + + echo "${rubyhdrdir}" +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/ruby.eclass b/sdk_container/src/third_party/portage-stable/eclass/ruby.eclass new file mode 100644 index 0000000000..94ae1d05b9 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/ruby.eclass @@ -0,0 +1,268 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/ruby.eclass,v 1.77 2009/10/03 08:31:29 a3li Exp $ +# +# @ECLASS: ruby.eclass +# @MAINTAINER: +# Ruby herd +# +# Author: Mamoru KOMACHI +# +# The ruby eclass is designed to allow easier installation of ruby +# softwares, and their incorporation into the Gentoo Linux system. + +# src_unpack, src_compile and src_install call a set of functions to emerge +# ruby with SLOT support; econf, emake and einstall is a wrapper for ruby +# to automate configuration, make and install process (they override default +# econf, emake and einstall defined by ebuild.sh respectively). + +# Functions: +# src_unpack Unpacks source archive(s) and apply patches if any. +# src_compile Invokes econf and emake. +# src_install Runs einstall and erubydoc. +# econf Detects setup.rb, install.rb, extconf.rb and configure, +# and then runs the configure script. +# emake Runs make if any Makefile exists. +# einstall Calls install script or Makefile. If both not present, +# installs programs under sitedir. +# erubydoc Finds any documents and puts them in the right place. +# erubydoc needs more sophistication to handle all types of +# appropriate documents. + +# Variables: +# USE_RUBY Space delimited list of supported ruby. +# Set it to "any" if it installs only version independent files. +# If your ebuild supports both ruby 1.6 and 1.8 but has version +# depenedent files such as libraries, set it to something like +# "ruby16 ruby18". Possible values are "any ruby16 ruby18 ruby19" +# RUBY_ECONF You can pass extra arguments to econf by defining this +# variable. Note that you cannot specify them by command line +# if you are using "${T}"/mkmf.rb +require 'mkmf' + +STDERR.puts 'Modified mkmf is used' +CONFIG['INSTALL'] = '/usr/bin/install' +END + # save it because rubygems needs it (for unsetting RUBYOPT) + export GENTOO_RUBYOPT="-r${T}/mkmf.rb" + export RUBYOPT="${RUBYOPT} ${GENTOO_RUBYOPT}" + fi + +} + +ruby_src_unpack() { + #ruby_patch_mkmf + unpack ${A} + cd "${S}" + + # Apply any patches that have been provided. + if [[ ${#PATCHES[@]} -gt 1 ]]; then + for x in "${PATCHES[@]}"; do + epatch "${x}" + done + elif [[ -n "${PATCHES}" ]]; then + for x in ${PATCHES}; do + epatch "${x}" + done + fi +} + +ruby_econf() { + + RUBY_ECONF="${RUBY_ECONF} ${EXTRA_ECONF}" + if [ -f configure ] ; then + ./configure \ + --prefix=/usr \ + --host=${CHOST} \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info \ + --datadir=/usr/share \ + --sysconfdir=/etc \ + --localstatedir=/var/lib \ + --with-ruby=${RUBY} \ + ${RUBY_ECONF} \ + "$@" || die "econf failed" + fi + if [ -f install.rb ] ; then + ${RUBY} install.rb config --prefix=/usr "$@" \ + ${RUBY_ECONF} || die "install.rb config failed" + ${RUBY} install.rb setup "$@" \ + ${RUBY_ECONF} || die "install.rb setup failed" + fi + if [ -f setup.rb ] ; then + ${RUBY} setup.rb config --prefix=/usr "$@" \ + ${RUBY_ECONF} || die "setup.rb config failed" + ${RUBY} setup.rb setup "$@" \ + ${RUBY_ECONF} || die "setup.rb setup failed" + fi + if [ -f extconf.rb ] ; then + ${RUBY} extconf.rb "$@" \ + ${RUBY_ECONF} || die "extconf.rb failed" + fi +} + +ruby_emake() { + if [ -f makefiles -o -f GNUmakefile -o -f makefile -o -f Makefile ] ; then + emake CC="$(tc-getCC)" CXX="$(tc-getCXX)" DLDFLAGS="${LDFLAGS}" "$@" || die "emake for ruby failed" + fi +} + +ruby_src_compile() { + # You can pass configure options via RUBY_ECONF + ruby_econf || die + ruby_emake "$@" || die +} + +doruby() { + ( # dont want to pollute calling env + insinto $(${RUBY} -r rbconfig -e 'print Config::CONFIG["sitedir"]') + insopts -m 0644 + doins "$@" + ) || die "failed to install $@" +} + +ruby_einstall() { + local siteruby + + RUBY_ECONF="${RUBY_ECONF} ${EXTRA_ECONF}" + if [ -f install.rb ] ; then + ${RUBY} install.rb config --prefix="${D}"/usr "$@" \ + ${RUBY_ECONF} || die "install.rb config failed" + ${RUBY} install.rb install "$@" \ + ${RUBY_ECONF} || die "install.rb install failed" + elif [ -f setup.rb ] ; then + ${RUBY} setup.rb config --prefix="${D}"/usr "$@" \ + ${RUBY_ECONF} || die "setup.rb config failed" + ${RUBY} setup.rb install "$@" \ + ${RUBY_ECONF} || die "setup.rb install failed" + elif [ -f extconf.rb -o -f Makefile ] ; then + make DESTDIR="${D}" "$@" install || die "make install failed" + else + siteruby=$(${RUBY} -r rbconfig -e 'print Config::CONFIG["sitedir"]') + insinto ${siteruby} + doins *.rb || die "doins failed" + fi +} + +erubydoc() { + local rdbase=/usr/share/doc/${PF}/rd rdfiles=$(find . -name '*.rd*') + + einfo "running dodoc for ruby ;)" + + insinto ${rdbase} + [ -n "${rdfiles}" ] && doins ${rdfiles} + rmdir "${D}"${rdbase} 2>/dev/null || true + if [ -d doc -o -d docs ] ; then + dohtml -x html -r {doc,docs}/* + dohtml -r {doc,docs}/html/* + else + dohtml -r * + fi + + if hasq examples ${IUSE} && use examples; then + for dir in sample samples example examples; do + if [ -d ${dir} ] ; then + dodir /usr/share/doc/${PF} + cp -pPR ${dir} "${D}"/usr/share/doc/${PF} || die "cp failed" + fi + done + fi + + for i in ChangeLog* [[:upper:]][[:upper:]]* ; do + [ -e $i ] && dodoc $i + done +} + +ruby_src_install() { + + ruby_einstall "$@" || die + + erubydoc +} + +# erubyconf, erubymake and erubyinstall are kept for compatibility +erubyconf() { + ruby_econf "$@" +} + +erubymake() { + ruby_emake "$@" +} + +erubyinstall() { + ruby_einstall "$@" +} + +# prepall adds SLOT support for ruby.eclass. SLOT support currently +# does not work for gems, so if a gem is installed we skip all the +# SLOT code to avoid possible errors, in particular the mv command +# that is part of the USE_RUBY="any" case. +prepall() { + + if [ -z "${GEM_SRC}" ]; then + + [[ ! -x /usr/bin/ruby16 ]] && export USE_RUBY=${USE_RUBY/ruby16/} + [[ ! -x /usr/bin/ruby18 ]] && export USE_RUBY=${USE_RUBY/ruby18/} + [[ ! -x /usr/bin/ruby19 ]] && export USE_RUBY=${USE_RUBY/ruby19/} + [[ ! -x /usr/bin/rubyee ]] && export USE_RUBY=${USE_RUBY/rubyee/} + + local ruby_slots=$(echo "${USE_RUBY}" | wc -w) + + if [ "$ruby_slots" -ge 2 ] ; then + einfo "Now we are building the package for ${USE_RUBY}" + for rb in ${USE_RUBY} ; do + einfo "Using $rb" + export RUBY=/usr/bin/$rb + ruby() { /usr/bin/$rb "$@" ; } + mkdir -p "${S}" + cd "${WORKDIR}" + einfo "Unpacking for $rb" + src_unpack || die "src_unpack failed" + cd "${S}" + find . -name '*.[ao]' -exec rm {} \; + einfo "Building for $rb" + src_compile || die "src_compile failed" + cd "${S}" + einfo "Installing for $rb" + src_install || die "src_install failed" + done + elif [ "${USE_RUBY}" == "any" ] ; then + eerror "USE_RUBY=\"any\" is no longer supported. Please use explicit versions instead." + die "USE_RUBY=\"any\" is no longer supported." + fi + fi + + # Continue with the regular prepall, see bug 140697 + (unset prepall; prepall) +} + diff --git a/sdk_container/src/third_party/portage-stable/eclass/savedconfig.eclass b/sdk_container/src/third_party/portage-stable/eclass/savedconfig.eclass new file mode 100644 index 0000000000..a0a8cd730f --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/savedconfig.eclass @@ -0,0 +1,139 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/savedconfig.eclass,v 1.20 2012/01/04 08:23:51 vapier Exp $ + +# @ECLASS: savedconfig.eclass +# @MAINTAINER: +# base-system@gentoo.org +# @BLURB: common API for saving/restoring complex configuration files +# @DESCRIPTION: +# It is not uncommon to come across a package which has a very fine +# grained level of configuration options that go way beyond what +# USE flags can properly describe. For this purpose, a common API +# of saving and restoring the configuration files was developed +# so users can modify these config files and the ebuild will take it +# into account as needed. + +inherit portability + +IUSE="savedconfig" + +# @FUNCTION: save_config +# @USAGE: +# @DESCRIPTION: +# Use this function to save the package's configuration file into the +# right location. You may specify any number of configuration files, +# but just make sure you call save_config with all of them at the same +# time in order for things to work properly. +save_config() { + if [[ ${EBUILD_PHASE} != "install" ]]; then + die "Bad package! save_config only for use in src_install functions!" + fi + [[ $# -eq 0 ]] && die "Usage: save_config " + + # Be lazy in our EAPI compat + : ${ED:=${D}} + + local dest="/etc/portage/savedconfig/${CATEGORY}" + if [[ $# -eq 1 && -f $1 ]] ; then + # Just one file, so have the ${PF} be that config file + dodir "${dest}" + cp "$@" "${ED}/${dest}/${PF}" || die "failed to save $*" + else + # A dir, or multiple files, so have the ${PF} be a dir + # with all the saved stuff below it + dodir "${dest}/${PF}" + treecopy "$@" "${ED}/${dest}/${PF}" || die "failed to save $*" + fi + + elog "Your configuration for ${CATEGORY}/${PF} has been saved in " + elog "/etc/portage/savedconfig/${CATEGORY}/${PF} for your editing pleasure." + elog "You can edit these files by hand and remerge this package with" + elog "USE=savedconfig to customise the configuration." + elog "You can rename this file/directory to one of the following for" + elog "its configuration to apply to multiple versions:" + elog '${PORTAGE_CONFIGROOT}/etc/portage/savedconfig/' + elog '[${CTARGET}|${CHOST}|""]/${CATEGORY}/[${PF}|${P}|${PN}]' +} + +# @FUNCTION: restore_config +# @USAGE: +# @DESCRIPTION: +# Restores the configuation saved ebuild previously potentially with user edits. +# You can restore a single file or a whole bunch, just make sure you call +# restore_config with all of the files to restore at the same time. +# +# Config files can be laid out as: +# @CODE +# ${PORTAGE_CONFIGROOT}/etc/portage/savedconfig/${CTARGET}/${CATEGORY}/${PF} +# ${PORTAGE_CONFIGROOT}/etc/portage/savedconfig/${CHOST}/${CATEGORY}/${PF} +# ${PORTAGE_CONFIGROOT}/etc/portage/savedconfig/${CATEGORY}/${PF} +# ${PORTAGE_CONFIGROOT}/etc/portage/savedconfig/${CTARGET}/${CATEGORY}/${P} +# ${PORTAGE_CONFIGROOT}/etc/portage/savedconfig/${CHOST}/${CATEGORY}/${P} +# ${PORTAGE_CONFIGROOT}/etc/portage/savedconfig/${CATEGORY}/${P} +# ${PORTAGE_CONFIGROOT}/etc/portage/savedconfig/${CTARGET}/${CATEGORY}/${PN} +# ${PORTAGE_CONFIGROOT}/etc/portage/savedconfig/${CHOST}/${CATEGORY}/${PN} +# ${PORTAGE_CONFIGROOT}/etc/portage/savedconfig/${CATEGORY}/${PN} +# @CODE +restore_config() { + case ${EBUILD_PHASE} in + unpack|compile|configure|prepare) ;; + *) die "Bad package! restore_config only for use in src_{unpack,compile,configure,prepare} functions!" ;; + esac + + use savedconfig || return + + local found check configfile + local base=${PORTAGE_CONFIGROOT}/etc/portage/savedconfig + for check in {${CATEGORY}/${PF},${CATEGORY}/${P},${CATEGORY}/${PN}}; do + configfile=${base}/${CTARGET}/${check} + [[ -r ${configfile} ]] || configfile=${base}/${CHOST}/${check} + [[ -r ${configfile} ]] || configfile=${base}/${check} + einfo "Checking existence of ${configfile} ..." + if [[ -r "${configfile}" ]]; then + einfo "found ${configfile}" + found=${configfile}; + break; + fi + done + if [[ -f ${found} ]]; then + elog "Building using saved configfile ${found}" + if [ $# -gt 0 ]; then + cp -pPR "${found}" "$1" || die "Failed to restore ${found} to $1" + else + die "need to know the restoration filename" + fi + elif [[ -d ${found} ]]; then + elog "Building using saved config directory ${found}" + local dest=${PWD} + pushd "${found}" > /dev/null + treecopy . "${dest}" || die "Failed to restore ${found} to $1" + popd > /dev/null + else + # maybe the user is screwing around with perms they shouldnt #289168 + if [[ ! -r ${base} ]] ; then + eerror "Unable to read ${base} -- please check its permissions." + die "Reading config files failed" + fi + ewarn "No saved config to restore - please remove USE=savedconfig or" + ewarn "provide a configuration file in ${PORTAGE_CONFIGROOT}/etc/portage/savedconfig/${CATEGORY}/${PN}" + ewarn "Your config file(s) will not be used this time" + fi +} + +savedconfig_pkg_postinst() { + # If the user has USE=savedconfig, then chances are they + # are modifying these files, so keep them around. #396169 + # This might lead to cruft build up, but the alternatives + # are worse :/. + + if use savedconfig ; then + # Be lazy in our EAPI compat + : ${EROOT:=${ROOT}} + + find "${EROOT}/etc/portage/savedconfig/${CATEGORY}/${PF}" \ + -exec touch {} + 2>/dev/null + fi +} + +EXPORT_FUNCTIONS pkg_postinst diff --git a/sdk_container/src/third_party/portage-stable/eclass/scsh.eclass b/sdk_container/src/third_party/portage-stable/eclass/scsh.eclass new file mode 100644 index 0000000000..354d0f6cbd --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/scsh.eclass @@ -0,0 +1,74 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/scsh.eclass,v 1.7 2006/09/09 15:17:01 christel Exp $ +# + +inherit eutils + +LICENSE="as-is BSD" +SLOT="0" +IUSE="scsh" + +scsh_scsh_path() { + echo /usr/$(get_libdir)/scsh +} + +set_layout() { + if use scsh; then + SCSH_LAYOUT=scsh + else + ewarn "No layout was specified via USE, defaulting to FHS." + SCSH_LAYOUT=fhs + fi + export SCSH_LAYOUT +} + +set_path_variables() { + SCSH_VERSION="$(best_version 'app-shells/scsh')" + SCSH_MV="${SCSH_VERSION%*.*}" + SCSH_MV="${SCSH_MV//app-shells\/scsh-}" + export SCSH_VERSION SCSH_MV + + case ${SCSH_LAYOUT} in + fhs) + SCSH_PREFIX=/usr + SCSH_MODULES_PATH=/usr/share/scsh-${SCSH_MV}/modules + ;; + scsh) + SCSH_PREFIX=/usr/$(get_libdir)/scsh/modules + SCSH_MODULES_PATH=/usr/$(get_libdir)/scsh/modules/${SCSH_MV} + ;; + esac + export SCSH_PREFIX SCSH_MODULES_PATH + + SCSH_LIB_DIRS='"'${SCSH_MODULES_PATH}'"'" "'"'$(scsh_scsh_path)'"'" "'"'.'"' + export SCSH_LIB_DIRS +} + +scsh_src_unpack() { + set_layout + set_path_variables + einfo "Using ${SCSH_LAYOUT} layout" + unpack ${A} +} + +scsh_get_layout_conf() { + SCSH_LAYOUT_CONF=" --build ${CHOST} + --force + --layout ${SCSH_LAYOUT} + --prefix ${SCSH_PREFIX} + --no-user-defaults + --dest-dir ${D}" + export SCSH_LAYOUT_CONF +} + +scsh_src_compile() { + scsh_get_layout_conf +} + +scsh_src_install() { + dodir ${SCSH_MODULES_PATH} + scsh-install-pkg ${SCSH_LAYOUT_CONF} || die "./scsh-install-pkg failed" +} + +EXPORT_FUNCTIONS src_unpack src_compile src_install diff --git a/sdk_container/src/third_party/portage-stable/eclass/selinux-policy-2.eclass b/sdk_container/src/third_party/portage-stable/eclass/selinux-policy-2.eclass new file mode 100644 index 0000000000..f49ca9e839 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/selinux-policy-2.eclass @@ -0,0 +1,103 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/selinux-policy-2.eclass,v 1.4 2009/08/02 02:58:25 pebenito Exp $ + +# Eclass for installing SELinux policy, and optionally +# reloading the reference-policy based modules + +inherit eutils + +IUSE="" + +HOMEPAGE="http://www.gentoo.org/proj/en/hardened/selinux/" +SRC_URI="http://oss.tresys.com/files/refpolicy/refpolicy-${PV}.tar.bz2" + +LICENSE="GPL-2" +SLOT="0" +S="${WORKDIR}/" + +RDEPEND=">=sys-apps/policycoreutils-1.30.30 + >=sec-policy/selinux-base-policy-${PV}" + +DEPEND="${RDEPEND} + sys-devel/m4 + >=sys-apps/checkpolicy-1.30.12" + +selinux-policy-2_src_unpack() { + local modfiles + [ -z "${POLICY_TYPES}" ] && local POLICY_TYPES="strict targeted" + + unpack ${A} + + for i in ${MODS}; do + modfiles="`find ${S}/refpolicy/policy/modules -iname $i.te` $modfiles" + modfiles="`find ${S}/refpolicy/policy/modules -iname $i.fc` $modfiles" + # use .if from headers + done + + for i in ${POLICY_TYPES}; do + mkdir "${S}"/${i} + cp "${S}"/refpolicy/doc/Makefile.example "${S}"/${i}/Makefile + + cp ${modfiles} "${S}"/${i} + + if [ -n "${POLICY_PATCH}" ]; then + cd "${S}"/${i} + epatch "${POLICY_PATCH}" || die "failed patch ${i}" + fi + + done +} + +selinux-policy-2_src_compile() { + [ -z "${POLICY_TYPES}" ] && local POLICY_TYPES="strict targeted" + + for i in ${POLICY_TYPES}; do + make NAME=$i -C "${S}"/${i} || die "${i} compile failed" + done +} + +selinux-policy-2_src_install() { + [ -z "${POLICY_TYPES}" ] && local POLICY_TYPES="strict targeted" + local BASEDIR="/usr/share/selinux" + + for i in ${POLICY_TYPES}; do + for j in ${MODS}; do + echo "Installing ${i} ${j} policy package" + insinto ${BASEDIR}/${i} + doins "${S}"/${i}/${j}.pp + done + done +} + +selinux-policy-2_pkg_postinst() { + # build up the command in the case of multiple modules + local COMMAND + for i in ${MODS}; do + COMMAND="-i ${i}.pp ${COMMAND}" + done + [ -z "${POLICY_TYPES}" ] && local POLICY_TYPES="strict targeted" + + if has "loadpolicy" $FEATURES ; then + for i in ${POLICY_TYPES}; do + einfo "Inserting the following modules into the $i module store: ${MODS}" + + cd /usr/share/selinux/${i} + semodule -s ${i} ${COMMAND} + done + else + echo + echo + eerror "Policy has not been loaded. It is strongly suggested" + eerror "that the policy be loaded before continuing!!" + echo + einfo "Automatic policy loading can be enabled by adding" + einfo "\"loadpolicy\" to the FEATURES in make.conf." + echo + echo + ebeep 4 + epause 4 + fi +} + +EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_postinst diff --git a/sdk_container/src/third_party/portage-stable/eclass/sgml-catalog.eclass b/sdk_container/src/third_party/portage-stable/eclass/sgml-catalog.eclass new file mode 100644 index 0000000000..02c4caa93d --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/sgml-catalog.eclass @@ -0,0 +1,82 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/sgml-catalog.eclass,v 1.14 2005/09/08 17:37:32 leonardop Exp $ +# +# Author Matthew Turk + +inherit base + +DEPEND=">=app-text/sgml-common-0.6.3-r2" + + +# List of catalogs to install +SGML_TOINSTALL="" + + +sgml-catalog_cat_include() { + debug-print function $FUNCNAME $* + SGML_TOINSTALL="${SGML_TOINSTALL} ${1}:${2}" +} + +sgml-catalog_cat_doinstall() { + debug-print function $FUNCNAME $* + /usr/bin/install-catalog --add $1 $2 &>/dev/null +} + +sgml-catalog_cat_doremove() { + debug-print function $FUNCNAME $* + /usr/bin/install-catalog --remove $1 $2 &>/dev/null +} + +sgml-catalog_pkg_postinst() { + debug-print function $FUNCNAME $* + + for entry in ${SGML_TOINSTALL}; do + arg1=`echo ${entry} | cut -f1 -d\:` + arg2=`echo ${entry} | cut -f2 -d\:` + if [ ! -e ${arg2} ] + then + ewarn "${arg2} doesn't appear to exist, although it ought to!" + continue + fi + einfo "Now adding ${arg2} to ${arg1} and /etc/sgml/catalog" + sgml-catalog_cat_doinstall ${arg1} ${arg2} + done + sgml-catalog_cleanup +} + +sgml-catalog_pkg_prerm() { + sgml-catalog_cleanup +} + +sgml-catalog_pkg_postrm() { + debug-print function $FUNCNAME $* + + for entry in ${SGML_TOINSTALL}; do + arg1=`echo ${entry} | cut -f1 -d\:` + arg2=`echo ${entry} | cut -f2 -d\:` + if [ -e ${arg2} ] + then + ewarn "${arg2} still exists! Not removing from ${arg1}" + ewarn "This is normal behavior for an upgrade ..." + continue + fi + einfo "Now removing $arg1 from $arg2 and /etc/sgml/catalog" + sgml-catalog_cat_doremove ${arg1} ${arg2} + done +} + +sgml-catalog_cleanup() { + if [ -e /usr/bin/gensgmlenv ] + then + einfo Regenerating SGML environment variables ... + gensgmlenv + grep -v export /etc/sgml/sgml.env > /etc/env.d/93sgmltools-lite + fi +} + +sgml-catalog_src_compile() { + return +} + +EXPORT_FUNCTIONS pkg_postrm pkg_postinst src_compile pkg_prerm diff --git a/sdk_container/src/third_party/portage-stable/eclass/ssl-cert.eclass b/sdk_container/src/third_party/portage-stable/eclass/ssl-cert.eclass new file mode 100644 index 0000000000..ebd3df7f61 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/ssl-cert.eclass @@ -0,0 +1,244 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/ssl-cert.eclass,v 1.18 2010/02/16 14:23:39 pva Exp $ +# +# @ECLASS: ssl-cert.eclass +# @MAINTAINER: +# Author: Max Kalika +# @BLURB: Eclass for SSL certificates +# @DESCRIPTION: +# This eclass implements a standard installation procedure for installing +# self-signed SSL certificates. +# @EXAMPLE: +# "install_cert /foo/bar" installs ${ROOT}/foo/bar.{key,csr,crt,pem} + +# Conditionally depend on OpenSSL: allows inheretence +# without pulling extra packages if not needed +DEPEND="ssl? ( dev-libs/openssl )" +IUSE="ssl" + +# @FUNCTION: gen_cnf +# @USAGE: +# @DESCRIPTION: +# Initializes variables and generates the needed +# OpenSSL configuration file and a CA serial file +# +# Access: private +gen_cnf() { + # Location of the config file + SSL_CONF="${T}/${$}ssl.cnf" + # Location of the CA serial file + SSL_SERIAL="${T}/${$}ca.ser" + # Location of some random files OpenSSL can use: don't use + # /dev/u?random here -- doesn't work properly on all platforms + SSL_RANDOM="${T}/environment:${T}/eclass-debug.log:/etc/resolv.conf" + + # These can be overridden in the ebuild + SSL_DAYS="${SSL_DAYS:-730}" + SSL_BITS="${SSL_BITS:-1024}" + SSL_COUNTRY="${SSL_COUNTRY:-US}" + SSL_STATE="${SSL_STATE:-California}" + SSL_LOCALITY="${SSL_LOCALITY:-Santa Barbara}" + SSL_ORGANIZATION="${SSL_ORGANIZATION:-SSL Server}" + SSL_UNIT="${SSL_UNIT:-For Testing Purposes Only}" + SSL_COMMONNAME="${SSL_COMMONNAME:-localhost}" + SSL_EMAIL="${SSL_EMAIL:-root@localhost}" + + # Create the CA serial file + echo "01" > "${SSL_SERIAL}" + + # Create the config file + ebegin "Generating OpenSSL configuration${1:+ for CA}" + cat <<-EOF > "${SSL_CONF}" + [ req ] + prompt = no + default_bits = ${SSL_BITS} + distinguished_name = req_dn + [ req_dn ] + C = ${SSL_COUNTRY} + ST = ${SSL_STATE} + L = ${SSL_LOCALITY} + O = ${SSL_ORGANIZATION} + OU = ${SSL_UNIT} + CN = ${SSL_COMMONNAME}${1:+ CA} + emailAddress = ${SSL_EMAIL} + EOF + eend $? + + return $? +} + +# @FUNCTION: get_base +# @USAGE: [if_ca] +# @RETURN: +# @DESCRIPTION: +# Simple function to determine whether we're creating +# a CA (which should only be done once) or final part +# +# Access: private +get_base() { + if [ "${1}" ] ; then + echo "${T}/${$}ca" + else + echo "${T}/${$}server" + fi +} + +# @FUNCTION: gen_key +# @USAGE: +# @DESCRIPTION: +# Generates an RSA key +# +# Access: private +gen_key() { + local base=`get_base $1` + ebegin "Generating ${SSL_BITS} bit RSA key${1:+ for CA}" + /usr/bin/openssl genrsa -rand "${SSL_RANDOM}" \ + -out "${base}.key" "${SSL_BITS}" &> /dev/null + eend $? + + return $? +} + +# @FUNCTION: gen_csr +# @USAGE: +# @DESCRIPTION: +# Generates a certificate signing request using +# the key made by gen_key() +# +# Access: private +gen_csr() { + local base=`get_base $1` + ebegin "Generating Certificate Signing Request${1:+ for CA}" + /usr/bin/openssl req -config "${SSL_CONF}" -new \ + -key "${base}.key" -out "${base}.csr" &>/dev/null + eend $? + + return $? +} + +# @FUNCTION: gen_crt +# @USAGE: +# @DESCRIPTION: +# Generates either a self-signed CA certificate using +# the csr and key made by gen_csr() and gen_key() or +# a signed server certificate using the CA cert previously +# created by gen_crt() +# +# Access: private +gen_crt() { + local base=`get_base $1` + if [ "${1}" ] ; then + ebegin "Generating self-signed X.509 Certificate for CA" + /usr/bin/openssl x509 -extfile "${SSL_CONF}" \ + -days ${SSL_DAYS} -req -signkey "${base}.key" \ + -in "${base}.csr" -out "${base}.crt" &>/dev/null + else + local ca=`get_base 1` + ebegin "Generating authority-signed X.509 Certificate" + /usr/bin/openssl x509 -extfile "${SSL_CONF}" \ + -days ${SSL_DAYS} -req -CAserial "${SSL_SERIAL}" \ + -CAkey "${ca}.key" -CA "${ca}.crt" \ + -in "${base}.csr" -out "${base}.crt" &>/dev/null + fi + eend $? + + return $? +} + +# @FUNCTION: gen_pem +# @USAGE: +# @DESCRIPTION: +# Generates a PEM file by concatinating the key +# and cert file created by gen_key() and gen_cert() +# +# Access: private +gen_pem() { + local base=`get_base $1` + ebegin "Generating PEM Certificate" + (cat "${base}.key"; echo; cat "${base}.crt") > "${base}.pem" + eend $? + + return $? +} + +# Removed due to bug 174759 +docert() { + eerror "Function \"docert\" has been removed for security reasons." + eerror "\"install_cert\" should be used instead. See bug 174759." + die +} + +# @FUNCTION: install_cert +# @USAGE: +# @DESCRIPTION: +# Uses all the private functions above to generate and install the +# requested certificates. +# are full pathnames relative to ROOT, without extension. +# +# Example: "install_cert /foo/bar" installs ${ROOT}/foo/bar.{key,csr,crt,pem} +# +# Access: public +install_cert() { + if [ $# -lt 1 ] ; then + eerror "At least one argument needed" + return 1; + fi + + case ${EBUILD_PHASE} in + unpack|compile|test|install) + eerror "install_cert cannot be called in ${EBUILD_PHASE}" + return 1 ;; + esac + + # Generate a CA environment #164601 + gen_cnf 1 || return 1 + gen_key 1 || return 1 + gen_csr 1 || return 1 + gen_crt 1 || return 1 + echo + + gen_cnf || return 1 + echo + + local count=0 + for cert in "$@" ; do + # Check the requested certificate + if [ -z "${cert##*/}" ] ; then + ewarn "Invalid certification requested, skipping" + continue + fi + + # Check for previous existence of generated files + for type in key csr crt pem ; do + if [ -e "${ROOT}${cert}.${type}" ] ; then + ewarn "${ROOT}${cert}.${type}: exists, skipping" + continue 2 + fi + done + + # Generate the requested files + gen_key || continue + gen_csr || continue + gen_crt || continue + gen_pem || continue + echo + + # Install the generated files and set sane permissions + local base=$(get_base) + install -d "${ROOT}${cert%/*}" + install -m0400 "${base}.key" "${ROOT}${cert}.key" + install -m0444 "${base}.csr" "${ROOT}${cert}.csr" + install -m0444 "${base}.crt" "${ROOT}${cert}.crt" + install -m0400 "${base}.pem" "${ROOT}${cert}.pem" + count=$((${count}+1)) + done + + # Resulting status + if [ ${count} = 0 ] ; then + eerror "No certificates were generated" + return 1 + elif [ ${count} != ${#} ] ; then + ewarn "Some requested certificates were not generated" + fi +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/stardict.eclass b/sdk_container/src/third_party/portage-stable/eclass/stardict.eclass new file mode 100644 index 0000000000..d87a71c0ee --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/stardict.eclass @@ -0,0 +1,58 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/stardict.eclass,v 1.16 2010/02/03 13:16:39 pva Exp $ + +# Author : Alastair Tse +# +# Convienence class to do stardict dictionary installations. +# +# Usage: +# - Variables to set : +# * FROM_LANG - From this language +# * TO_LANG - To this language +# * DICT_PREFIX - SRC_URI prefix, like "dictd_www.mova.org_" +# * DICT_SUFFIX - SRC_URI after the prefix. + +RESTRICT="strip" + +[ -z "${DICT_SUFFIX}" ] && DICT_SUFFIX=${PN#stardict-[[:lower:]]*-} +[ -z "${DICT_P}" ] && DICT_P=stardict-${DICT_PREFIX}${DICT_SUFFIX}-${PV} + +if [ -n "${FROM_LANG}" -a -n "${TO_LANG}" ]; then + DESCRIPTION="Stardict Dictionary ${FROM_LANG} to ${TO_LANG}" +elif [ -z "${DESCRIPTION}" ]; then + DESCRIPTION="Another Stardict Dictionary" +fi + +HOMEPAGE="http://stardict.sourceforge.net/" +SRC_URI="mirror://sourceforge/stardict/${DICT_P}.tar.bz2" + +IUSE="gzip" +SLOT="0" +LICENSE="GPL-2" + +DEPEND=">=app-text/stardict-2.4.2 + gzip? ( app-arch/gzip + app-text/dictd )" + +S=${WORKDIR}/${DICT_P} + +stardict_src_compile() { + if use gzip; then + for file in *.idx; do + [[ -f $file ]] && gzip ${file} + done + for file in *.dict; do + [[ -f $file ]] && dictzip ${file} + done + fi +} + +stardict_src_install() { + insinto /usr/share/stardict/dic + doins *.dict.dz* + doins *.idx* + doins *.ifo +} + +EXPORT_FUNCTIONS src_compile src_install diff --git a/sdk_container/src/third_party/portage-stable/eclass/subversion.eclass b/sdk_container/src/third_party/portage-stable/eclass/subversion.eclass new file mode 100644 index 0000000000..09e58f24c8 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/subversion.eclass @@ -0,0 +1,551 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/subversion.eclass,v 1.73 2012/02/02 03:17:56 floppym Exp $ + +# @ECLASS: subversion.eclass +# @MAINTAINER: +# Akinori Hattori +# Bo Ørsted Andresen +# Arfrever Frehtes Taifersar Arahesis +# @AUTHOR: +# Original Author: Akinori Hattori +# @BLURB: The subversion eclass is written to fetch software sources from subversion repositories +# @DESCRIPTION: +# The subversion eclass provides functions to fetch, patch and bootstrap +# software sources from subversion repositories. + +inherit eutils + +ESVN="${ECLASS}" + +case "${EAPI:-0}" in + 0|1) + EXPORT_FUNCTIONS src_unpack pkg_preinst + ;; + *) + EXPORT_FUNCTIONS src_unpack src_prepare pkg_preinst + ;; +esac + +DESCRIPTION="Based on the ${ECLASS} eclass" + +SUBVERSION_DEPEND="dev-vcs/subversion + net-misc/rsync" + +if [[ -z "${ESVN_DISABLE_DEPENDENCIES}" ]]; then + DEPEND="${SUBVERSION_DEPEND}" +fi + +# @ECLASS-VARIABLE: ESVN_STORE_DIR +# @DESCRIPTION: +# subversion sources store directory. Users may override this in /etc/make.conf +[[ -z ${ESVN_STORE_DIR} ]] && ESVN_STORE_DIR="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}/svn-src" + +# @ECLASS-VARIABLE: ESVN_FETCH_CMD +# @DESCRIPTION: +# subversion checkout command +ESVN_FETCH_CMD="svn checkout" + +# @ECLASS-VARIABLE: ESVN_UPDATE_CMD +# @DESCRIPTION: +# subversion update command +ESVN_UPDATE_CMD="svn update" + +# @ECLASS-VARIABLE: ESVN_SWITCH_CMD +# @DESCRIPTION: +# subversion switch command +ESVN_SWITCH_CMD="svn switch" + +# @ECLASS-VARIABLE: ESVN_OPTIONS +# @DESCRIPTION: +# the options passed to checkout or update. If you want a specific revision see +# ESVN_REPO_URI instead of using -rREV. +ESVN_OPTIONS="${ESVN_OPTIONS:-}" + +# @ECLASS-VARIABLE: ESVN_REPO_URI +# @DESCRIPTION: +# repository uri +# +# e.g. http://foo/trunk, svn://bar/trunk, svn://bar/branch/foo@1234 +# +# supported protocols: +# http:// +# https:// +# svn:// +# svn+ssh:// +# +# to peg to a specific revision, append @REV to the repo's uri +ESVN_REPO_URI="${ESVN_REPO_URI:-}" + +# @ECLASS-VARIABLE: ESVN_REVISION +# @DESCRIPTION: +# User configurable revision checkout or update to from the repository +# +# Useful for live svn or trunk svn ebuilds allowing the user to peg +# to a specific revision +# +# Note: This should never be set in an ebuild! +ESVN_REVISION="${ESVN_REVISION:-}" + +# @ECLASS-VARIABLE: ESVN_USER +# @DESCRIPTION: +# User name +ESVN_USER="${ESVN_USER:-}" + +# @ECLASS-VARIABLE: ESVN_PASSWORD +# @DESCRIPTION: +# Password +ESVN_PASSWORD="${ESVN_PASSWORD:-}" + +# @ECLASS-VARIABLE: ESVN_PROJECT +# @DESCRIPTION: +# project name of your ebuild (= name space) +# +# subversion eclass will check out the subversion repository like: +# +# ${ESVN_STORE_DIR}/${ESVN_PROJECT}/${ESVN_REPO_URI##*/} +# +# so if you define ESVN_REPO_URI as http://svn.collab.net/repo/svn/trunk or +# http://svn.collab.net/repo/svn/trunk/. and PN is subversion-svn. +# it will check out like: +# +# ${ESVN_STORE_DIR}/subversion/trunk +# +# this is not used in order to declare the name of the upstream project. +# so that you can declare this like: +# +# # jakarta commons-loggin +# ESVN_PROJECT=commons/logging +# +# default: ${PN/-svn}. +ESVN_PROJECT="${ESVN_PROJECT:-${PN/-svn}}" + +# @ECLASS-VARIABLE: ESVN_BOOTSTRAP +# @DESCRIPTION: +# bootstrap script or command like autogen.sh or etc.. +ESVN_BOOTSTRAP="${ESVN_BOOTSTRAP:-}" + +# @ECLASS-VARIABLE: ESVN_PATCHES +# @DESCRIPTION: +# subversion eclass can apply patches in subversion_bootstrap(). +# you can use regexp in this variable like *.diff or *.patch or etc. +# NOTE: patches will be applied before ESVN_BOOTSTRAP is processed. +# +# Patches are searched both in ${PWD} and ${FILESDIR}, if not found in either +# location, the installation dies. +ESVN_PATCHES="${ESVN_PATCHES:-}" + +# @ECLASS-VARIABLE: ESVN_RESTRICT +# @DESCRIPTION: +# this should be a space delimited list of subversion eclass features to +# restrict. +# export) +# don't export the working copy to S. +ESVN_RESTRICT="${ESVN_RESTRICT:-}" + +# @ECLASS-VARIABLE: ESVN_DISABLE_DEPENDENCIES +# @DESCRIPTION: +# Set this variable to a non-empty value to disable the automatic inclusion of +# Subversion in dependencies. +ESVN_DISABLE_DEPENDENCIES="${ESVN_DISABLE_DEPENDENCIES:-}" + +# @ECLASS-VARIABLE: ESVN_OFFLINE +# @DESCRIPTION: +# Set this variable to a non-empty value to disable the automatic updating of +# an svn source tree. This is intended to be set outside the subversion source +# tree by users. +ESVN_OFFLINE="${ESVN_OFFLINE:-${ESCM_OFFLINE}}" + +# @ECLASS-VARIABLE: ESVN_UMASK +# @DESCRIPTION: +# Set this variable to custom umask. +# This is intended to be set by users. +ESVN_UMASK="${ESVN_UMASK:-${EVCS_UMASK}}" + +# @ECLASS-VARIABLE: ESVN_UP_FREQ +# @DESCRIPTION: +# Set the minimum number of hours between svn up'ing in any given svn module. This is particularly +# useful for split KDE ebuilds where we want to ensure that all submodules are compiled for the same +# revision. It should also be kept user overrideable. +ESVN_UP_FREQ="${ESVN_UP_FREQ:=}" + +# @ECLASS-VARIABLE: ESCM_LOGDIR +# @DESCRIPTION: +# User configuration variable. If set to a path such as e.g. /var/log/scm any +# package inheriting from subversion.eclass will record svn revision to +# ${CATEGORY}/${PN}.log in that path in pkg_preinst. This is not supposed to be +# set by ebuilds/eclasses. It defaults to empty so users need to opt in. +ESCM_LOGDIR="${ESCM_LOGDIR:=}" + +# @FUNCTION: subversion_fetch +# @USAGE: [repo_uri] [destination] +# @DESCRIPTION: +# Wrapper function to fetch sources from subversion via svn checkout or svn update, +# depending on whether there is an existing working copy in ${ESVN_STORE_DIR}. +# +# Can take two optional parameters: +# repo_uri - a repository URI. default is ESVN_REPO_URI. +# destination - a check out path in S. +subversion_fetch() { + local repo_uri="$(subversion__get_repository_uri "${1:-${ESVN_REPO_URI}}")" + local revision="$(subversion__get_peg_revision "${1:-${ESVN_REPO_URI}}")" + local S_dest="${2}" + + if [[ -z ${repo_uri} ]]; then + die "${ESVN}: ESVN_REPO_URI (or specified URI) is empty." + fi + + [[ -n "${ESVN_REVISION}" ]] && revision="${ESVN_REVISION}" + + # check for the protocol + local protocol="${repo_uri%%:*}" + + case "${protocol}" in + http|https) + if ! built_with_use -o dev-vcs/subversion webdav-neon webdav-serf; then + echo + eerror "In order to emerge this package, you need to" + eerror "reinstall Subversion with support for WebDAV." + eerror "Subversion requires either Neon or Serf to support WebDAV." + echo + die "${ESVN}: reinstall Subversion with support for WebDAV." + fi + ;; + svn|svn+ssh) + ;; + *) + die "${ESVN}: fetch from '${protocol}' is not yet implemented." + ;; + esac + + addread "/etc/subversion" + addwrite "${ESVN_STORE_DIR}" + + if [[ -n "${ESVN_UMASK}" ]]; then + eumask_push "${ESVN_UMASK}" + fi + + if [[ ! -d ${ESVN_STORE_DIR} ]]; then + debug-print "${FUNCNAME}: initial checkout. creating subversion directory" + mkdir -m 775 -p "${ESVN_STORE_DIR}" || die "${ESVN}: can't mkdir ${ESVN_STORE_DIR}." + fi + + pushd "${ESVN_STORE_DIR}" > /dev/null || die "${ESVN}: can't chdir to ${ESVN_STORE_DIR}" + + local wc_path="$(subversion__get_wc_path "${repo_uri}")" + local options="${ESVN_OPTIONS} --config-dir ${ESVN_STORE_DIR}/.subversion" + + [[ -n "${revision}" ]] && options="${options} -r ${revision}" + + if [[ "${ESVN_OPTIONS}" = *-r* ]]; then + ewarn "\${ESVN_OPTIONS} contains -r, this usage is unsupported. Please" + ewarn "see \${ESVN_REPO_URI}" + fi + + if has_version ">=dev-vcs/subversion-1.6.0"; then + options="${options} --config-option=config:auth:password-stores=" + fi + + debug-print "${FUNCNAME}: wc_path = \"${wc_path}\"" + debug-print "${FUNCNAME}: ESVN_OPTIONS = \"${ESVN_OPTIONS}\"" + debug-print "${FUNCNAME}: options = \"${options}\"" + + if [[ ! -d ${wc_path}/.svn ]]; then + if [[ -n ${ESVN_OFFLINE} ]]; then + ewarn "ESVN_OFFLINE cannot be used when there is no existing checkout." + fi + # first check out + einfo "subversion check out start -->" + einfo " repository: ${repo_uri}${revision:+@}${revision}" + + debug-print "${FUNCNAME}: ${ESVN_FETCH_CMD} ${options} ${repo_uri}" + + mkdir -m 775 -p "${ESVN_PROJECT}" || die "${ESVN}: can't mkdir ${ESVN_PROJECT}." + cd "${ESVN_PROJECT}" || die "${ESVN}: can't chdir to ${ESVN_PROJECT}" + if [[ -n "${ESVN_USER}" ]]; then + ${ESVN_FETCH_CMD} ${options} --username "${ESVN_USER}" --password "${ESVN_PASSWORD}" "${repo_uri}" || die "${ESVN}: can't fetch to ${wc_path} from ${repo_uri}." + else + ${ESVN_FETCH_CMD} ${options} "${repo_uri}" || die "${ESVN}: can't fetch to ${wc_path} from ${repo_uri}." + fi + + elif [[ -n ${ESVN_OFFLINE} ]]; then + svn upgrade "${wc_path}" &>/dev/null + svn cleanup "${wc_path}" &>/dev/null + subversion_wc_info "${repo_uri}" || die "${ESVN}: unknown problem occurred while accessing working copy." + if [[ -n ${ESVN_REVISION} && ${ESVN_REVISION} != ${ESVN_WC_REVISION} ]]; then + die "${ESVN}: You requested off-line updating and revision ${ESVN_REVISION} but only revision ${ESVN_WC_REVISION} is available locally." + fi + einfo "Fetching disabled: Using existing repository copy at revision ${ESVN_WC_REVISION}." + else + svn upgrade "${wc_path}" &>/dev/null + svn cleanup "${wc_path}" &>/dev/null + subversion_wc_info "${repo_uri}" || die "${ESVN}: unknown problem occurred while accessing working copy." + + local esvn_up_freq= + if [[ -n ${ESVN_UP_FREQ} ]]; then + if [[ -n ${ESVN_UP_FREQ//[[:digit:]]} ]]; then + die "${ESVN}: ESVN_UP_FREQ must be an integer value corresponding to the minimum number of hours between svn up." + elif [[ -z $(find "${wc_path}/.svn/entries" -mmin "+$((ESVN_UP_FREQ*60))") ]]; then + einfo "Fetching disabled since ${ESVN_UP_FREQ} hours has not passed since last update." + einfo "Using existing repository copy at revision ${ESVN_WC_REVISION}." + esvn_up_freq=no_update + fi + fi + + if [[ -z ${esvn_up_freq} ]]; then + if [[ ${ESVN_WC_UUID} != $(subversion__svn_info "${repo_uri}" "Repository UUID") ]]; then + # UUID mismatch. Delete working copy and check out it again. + einfo "subversion recheck out start -->" + einfo " old UUID: ${ESVN_WC_UUID}" + einfo " new UUID: $(subversion__svn_info "${repo_uri}" "Repository UUID")" + einfo " repository: ${repo_uri}${revision:+@}${revision}" + + rm -fr "${ESVN_PROJECT}" || die + + debug-print "${FUNCNAME}: ${ESVN_FETCH_CMD} ${options} ${repo_uri}" + + mkdir -m 775 -p "${ESVN_PROJECT}" || die "${ESVN}: can't mkdir ${ESVN_PROJECT}." + cd "${ESVN_PROJECT}" || die "${ESVN}: can't chdir to ${ESVN_PROJECT}" + if [[ -n "${ESVN_USER}" ]]; then + ${ESVN_FETCH_CMD} ${options} --username "${ESVN_USER}" --password "${ESVN_PASSWORD}" "${repo_uri}" || die "${ESVN}: can't fetch to ${wc_path} from ${repo_uri}." + else + ${ESVN_FETCH_CMD} ${options} "${repo_uri}" || die "${ESVN}: can't fetch to ${wc_path} from ${repo_uri}." + fi + elif [[ ${ESVN_WC_URL} != $(subversion__get_repository_uri "${repo_uri}") ]]; then + einfo "subversion switch start -->" + einfo " old repository: ${ESVN_WC_URL}@${ESVN_WC_REVISION}" + einfo " new repository: ${repo_uri}${revision:+@}${revision}" + + debug-print "${FUNCNAME}: ${ESVN_SWITCH_CMD} ${options} ${repo_uri}" + + cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}" + if [[ -n "${ESVN_USER}" ]]; then + ${ESVN_SWITCH_CMD} ${options} --username "${ESVN_USER}" --password "${ESVN_PASSWORD}" ${repo_uri} || die "${ESVN}: can't update ${wc_path} from ${repo_uri}." + else + ${ESVN_SWITCH_CMD} ${options} ${repo_uri} || die "${ESVN}: can't update ${wc_path} from ${repo_uri}." + fi + else + # update working copy + einfo "subversion update start -->" + einfo " repository: ${repo_uri}${revision:+@}${revision}" + + debug-print "${FUNCNAME}: ${ESVN_UPDATE_CMD} ${options}" + + cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}" + if [[ -n "${ESVN_USER}" ]]; then + ${ESVN_UPDATE_CMD} ${options} --username "${ESVN_USER}" --password "${ESVN_PASSWORD}" || die "${ESVN}: can't update ${wc_path} from ${repo_uri}." + else + ${ESVN_UPDATE_CMD} ${options} || die "${ESVN}: can't update ${wc_path} from ${repo_uri}." + fi + fi + fi + fi + + if [[ -n "${ESVN_UMASK}" ]]; then + eumask_pop + fi + + einfo " working copy: ${wc_path}" + + if ! has "export" ${ESVN_RESTRICT}; then + cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}" + + local S="${S}/${S_dest}" + mkdir -p "${S}" + + # export to the ${WORKDIR} + #* "svn export" has a bug. see http://bugs.gentoo.org/119236 + #* svn export . "${S}" || die "${ESVN}: can't export to ${S}." + rsync -rlpgo --exclude=".svn/" . "${S}" || die "${ESVN}: can't export to ${S}." + fi + + popd > /dev/null + + echo +} + +# @FUNCTION: subversion_bootstrap +# @DESCRIPTION: +# Apply patches in ${ESVN_PATCHES} and run ${ESVN_BOOTSTRAP} if specified. +subversion_bootstrap() { + if has "export" ${ESVN_RESTRICT}; then + return + fi + + cd "${S}" + + if [[ -n ${ESVN_PATCHES} ]]; then + einfo "apply patches -->" + + local patch fpatch + + for patch in ${ESVN_PATCHES}; do + if [[ -f ${patch} ]]; then + epatch "${patch}" + + else + for fpatch in ${FILESDIR}/${patch}; do + if [[ -f ${fpatch} ]]; then + epatch "${fpatch}" + + else + die "${ESVN}: ${patch} not found" + + fi + done + + fi + done + + echo + fi + + if [[ -n ${ESVN_BOOTSTRAP} ]]; then + einfo "begin bootstrap -->" + + if [[ -f ${ESVN_BOOTSTRAP} && -x ${ESVN_BOOTSTRAP} ]]; then + einfo " bootstrap with a file: ${ESVN_BOOTSTRAP}" + eval "./${ESVN_BOOTSTRAP}" || die "${ESVN}: can't execute ESVN_BOOTSTRAP." + + else + einfo " bootstrap with command: ${ESVN_BOOTSTRAP}" + eval "${ESVN_BOOTSTRAP}" || die "${ESVN}: can't eval ESVN_BOOTSTRAP." + + fi + fi +} + +# @FUNCTION: subversion_src_unpack +# @DESCRIPTION: +# Default src_unpack. Fetch and, in older EAPIs, bootstrap. +subversion_src_unpack() { + subversion_fetch || die "${ESVN}: unknown problem occurred in subversion_fetch." + if has "${EAPI:-0}" 0 1; then + subversion_bootstrap || die "${ESVN}: unknown problem occurred in subversion_bootstrap." + fi +} + +# @FUNCTION: subversion_src_prepare +# @DESCRIPTION: +# Default src_prepare. Bootstrap. +subversion_src_prepare() { + subversion_bootstrap || die "${ESVN}: unknown problem occurred in subversion_bootstrap." +} + +# @FUNCTION: subversion_wc_info +# @USAGE: [repo_uri] +# @RETURN: ESVN_WC_URL, ESVN_WC_ROOT, ESVN_WC_UUID, ESVN_WC_REVISION and ESVN_WC_PATH +# @DESCRIPTION: +# Get svn info for the specified repo_uri. The default repo_uri is ESVN_REPO_URI. +# +# The working copy information on the specified repository URI are set to +# ESVN_WC_* variables. +subversion_wc_info() { + local repo_uri="$(subversion__get_repository_uri "${1:-${ESVN_REPO_URI}}")" + local wc_path="$(subversion__get_wc_path "${repo_uri}")" + + debug-print "${FUNCNAME}: repo_uri = ${repo_uri}" + debug-print "${FUNCNAME}: wc_path = ${wc_path}" + + if [[ ! -d ${wc_path} ]]; then + return 1 + fi + + export ESVN_WC_URL="$(subversion__svn_info "${wc_path}" "URL")" + export ESVN_WC_ROOT="$(subversion__svn_info "${wc_path}" "Repository Root")" + export ESVN_WC_UUID="$(subversion__svn_info "${wc_path}" "Repository UUID")" + export ESVN_WC_REVISION="$(subversion__svn_info "${wc_path}" "Revision")" + export ESVN_WC_PATH="${wc_path}" +} + +## -- Private Functions + +## -- subversion__svn_info() ------------------------------------------------- # +# +# param $1 - a target. +# param $2 - a key name. +# +subversion__svn_info() { + local target="${1}" + local key="${2}" + + env LC_ALL=C svn info "${target}" | grep -i "^${key}" | cut -d" " -f2- +} + +## -- subversion__get_repository_uri() --------------------------------------- # +# +# param $1 - a repository URI. +subversion__get_repository_uri() { + local repo_uri="${1}" + + debug-print "${FUNCNAME}: repo_uri = ${repo_uri}" + + if [[ -z ${repo_uri} ]]; then + die "${ESVN}: ESVN_REPO_URI (or specified URI) is empty." + fi + + # delete trailing slash + if [[ -z ${repo_uri##*/} ]]; then + repo_uri="${repo_uri%/}" + fi + + repo_uri="${repo_uri%@*}" + + echo "${repo_uri}" +} + +## -- subversion__get_wc_path() ---------------------------------------------- # +# +# param $1 - a repository URI. +subversion__get_wc_path() { + local repo_uri="$(subversion__get_repository_uri "${1}")" + + debug-print "${FUNCNAME}: repo_uri = ${repo_uri}" + + echo "${ESVN_STORE_DIR}/${ESVN_PROJECT}/${repo_uri##*/}" +} + +## -- subversion__get_peg_revision() ----------------------------------------- # +# +# param $1 - a repository URI. +subversion__get_peg_revision() { + local repo_uri="${1}" + + debug-print "${FUNCNAME}: repo_uri = ${repo_uri}" + + # repo_uri has peg revision ? + if [[ ${repo_uri} != *@* ]]; then + debug-print "${FUNCNAME}: repo_uri does not have a peg revision." + fi + + local peg_rev= + [[ ${repo_uri} = *@* ]] && peg_rev="${repo_uri##*@}" + + debug-print "${FUNCNAME}: peg_rev = ${peg_rev}" + + echo "${peg_rev}" +} + +# @FUNCTION: subversion_pkg_preinst +# @USAGE: [repo_uri] +# @DESCRIPTION: +# Log the svn revision of source code. Doing this in pkg_preinst because we +# want the logs to stick around if packages are uninstalled without messing with +# config protection. +subversion_pkg_preinst() { + local pkgdate=$(date "+%Y%m%d %H:%M:%S") + subversion_wc_info "${1:-${ESVN_REPO_URI}}" + if [[ -n ${ESCM_LOGDIR} ]]; then + local dir="${ROOT}/${ESCM_LOGDIR}/${CATEGORY}" + if [[ ! -d ${dir} ]]; then + mkdir -p "${dir}" || \ + eerror "Failed to create '${dir}' for logging svn revision to '${PORTDIR_SCM}'" + fi + local logmessage="svn: ${pkgdate} - ${PF}:${SLOT} was merged at revision ${ESVN_WC_REVISION}" + if [[ -d ${dir} ]]; then + echo "${logmessage}" >> "${dir}/${PN}.log" + else + eerror "Could not log the message '${logmessage}' to '${dir}/${PN}.log'" + fi + fi +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/sword-module.eclass b/sdk_container/src/third_party/portage-stable/eclass/sword-module.eclass new file mode 100644 index 0000000000..6192a32fb9 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/sword-module.eclass @@ -0,0 +1,34 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/sword-module.eclass,v 1.2 2009/05/29 18:46:24 beandog Exp $ + +# +# eclass to simplify installation of Sword modules +# Bugs to theology@gentoo.org +# + +HOMEPAGE="http://www.crosswire.org/sword/modules/" + +# Sword packages are generally released as FooBar.zip in their 'rawzip' form +# The files are also unversioned, so the packager will need to rename the +# original file to something else and host it somewhere to avoid breaking +# the digest when new versions are released. + +SRC_URI="mirror://gentoo/${SWORD_MODULE}-${PV}.zip" + +SLOT="0" +IUSE="" + +S="${WORKDIR}" + +RDEPEND="app-text/sword" +DEPEND="app-arch/unzip" + +sword-module_src_install() { + insinto /usr/share/sword/modules + doins -r "${S}"/modules/* + insinto /usr/share/sword/mods.d + doins "${S}"/mods.d/* +} + +EXPORT_FUNCTIONS src_install diff --git a/sdk_container/src/third_party/portage-stable/eclass/tetex-2.eclass b/sdk_container/src/third_party/portage-stable/eclass/tetex-2.eclass new file mode 100644 index 0000000000..20c3f8a089 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/tetex-2.eclass @@ -0,0 +1,7 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/tetex-2.eclass,v 1.8 2009/11/30 04:19:36 abcd Exp $ + +# @DEAD +# To be removed on 2011/05/30. +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" diff --git a/sdk_container/src/third_party/portage-stable/eclass/tetex-3.eclass b/sdk_container/src/third_party/portage-stable/eclass/tetex-3.eclass new file mode 100644 index 0000000000..ae0683da4d --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/tetex-3.eclass @@ -0,0 +1,215 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/tetex-3.eclass,v 1.20 2008/10/06 19:55:05 aballier Exp $ +# +# Author: Jaromir Malenko +# Author: Mamoru KOMACHI +# Author: Martin Ehmsen +# Author: Alexandre Buisse +# +# A generic eclass to install tetex 3.x distributions. + +TEXMF_PATH=/var/lib/texmf + +inherit tetex + +EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_preinst pkg_postinst + +IUSE="X Xaw3d motif neXt" + +DEPEND="X? ( motif? ( x11-libs/openmotif ) + !motif? ( neXt? ( x11-libs/neXtaw ) + !neXt? ( Xaw3d? ( x11-libs/Xaw3d ) ) ) + !app-text/xdvik + ) + !dev-tex/memoir + !dev-tex/lineno + !dev-tex/SIunits + !dev-tex/floatflt + !dev-tex/g-brief + !dev-tex/koma-script" + +RDEPEND="${DEPEND}" + +tetex-3_pkg_setup() { + ewarn + ewarn "teTeX 3.0 ebuild will remove config files stored in /usr/share/texmf." + ewarn "Please make a backup before upgrading if you changed anything." + ewarn + + ebeep + epause +} + +tetex-3_src_unpack() { + + tetex_src_unpack + + # create update script + cat >${T}/texmf-update<<'EOF' +#!/bin/bash +# +# Utility to update Gentoo teTeX distribution configuration files +# + +PATH=/bin:/usr/bin + +# Fix for all those with altered umask for root +umask 022 + +# Make sure we have a correct environment, bug #30432 +# The list of env. vars is taken from the INSTALL file +for texvar in AFMFONTS BIBINPUTS BSTINPUTS DVILJFONTS DVIPSFONTS \ + DVIPSHEADERS GFFONTS GLYPHFONTS INDEXSTYLE MFBASES MFINPUTS \ + MFPOOL MFTINPUTS MPINPUTS MPMEMS MPPOOL MPSUPPORT OCPINPUTS \ + OFMFONTS OPLFONTS OTPINPUTS OVFFONTS OVPFONTS PKFONTS PSHEADERS \ + T1FONTS T1INPUTS TEXBIB TEXCONFIG TEXDOCS TEXFONTMAPS TEXFONTS \ + TEXFORMATS TEXINDEXSTYLE TEXINPUTS TEXMFCNF TEXMFDBS TEXMFINI \ + TEXPICTS TEXPKS TEXPOOL TEXPSHEADERS TEXSOURCES TFMFONTS TRFONTS \ + VFFONTS XDVIFONTS XDVIVFS ; do + + if [ "${!texvar}" ]; then + if ! $(echo ${!texvar} | grep '^:\|::\|:$' &>/dev/null) ; then + export ${texvar}="${!texvar}:" + fi + fi +done + +if [ "$TEXINPUTS" ]; then + if $(echo ${TEXINPUTS} | grep '/usr/share/texmf' &>/dev/null) ; then + export TEXINPUTS=$(echo ${TEXINPUTS} | sed -e 's|/usr/share/texmf/*:\?||g') + elif $(echo ${TEXINPUTS} | grep '/var/lib/texmf' &>/dev/null) ; then + export TEXINPUTS=$(echo ${TEXINPUTS} | sed -e 's|/var/lib/texmf/*:\?||g') + fi +fi + +for conf in texmf.cnf fmtutil.cnf updmap.cfg +do + if [ -d "/etc/texmf/${conf/.*/.d}" ] + then + echo "Generating /etc/texmf/web2c/${conf} from /etc/texmf/${conf/.*/.d} ..." + cat /etc/texmf/${conf/.*/.d}/* > "/etc/texmf/web2c/${conf}" + fi +done + +# configure +echo "Configuring teTeX ..." +mktexlsr &>/dev/null +texconfig-sys init &>/dev/null +texconfig-sys confall &>/dev/null +texconfig-sys font rw &>/dev/null +texconfig-sys font vardir /var/cache/fonts &>/dev/null +updmap-sys &>/dev/null + +# generate +echo "Generating format files ..." +fmtutil-sys --missing &>/dev/null +echo +echo "Use 'texconfig font ro' to disable font generation for users" +echo +EOF + + # need to fix up the hyperref driver, see bug #31967 + sed -i -e "/providecommand/s/hdvips/hypertex/" \ + ${S}/texmf/tex/latex/hyperref/hyperref.cfg +} + +tetex-3_src_compile() { + sed -i -e "/mktexlsr/,+3d" \ + -e "s/\(updmap-sys\)/\1 --nohash/" \ + Makefile.in || die + + use amd64 && replace-flags "-O3" "-O2" + + if use X ; then + if use motif ; then + toolkit="motif" + elif use neXt ; then + toolkit="neXtaw" + elif use Xaw3d ; then + toolkit="xaw3d" + else + toolkit="xaw" + fi + + TETEX_ECONF="${TETEX_ECONF} --with-xdvi-x-toolkit=${toolkit}" + fi + + tetex_src_compile +} + +tetex-3_src_install() { + + tetex_src_install + + dodir /etc/env.d + echo 'CONFIG_PROTECT_MASK="/etc/texmf/web2c"' > ${D}/etc/env.d/98tetex + # populate /etc/texmf + keepdir /etc/texmf/web2c + cd ${D}/usr/share/texmf # not ${TEXMF_PATH} + for d in $(find . -name config -type d | sed -e "s:\./::g") ; do + dodir /etc/texmf/${d} + for f in $(find ${D}usr/share/texmf/$d -maxdepth 1 -mindepth 1); do + mv $f ${D}/etc/texmf/$d || die "mv $f failed" + dosym /etc/texmf/$d/$(basename $f) /usr/share/texmf/$d/$(basename $f) + done + done + cd - + cd ${D}${TEXMF_PATH} + for f in $(find . -name '*.cnf' -o -name '*.cfg' -type f | sed -e "s:\./::g") ; do + if [ "${f/config/}" != "${f}" ] ; then + continue + fi + dodir /etc/texmf/$(dirname $f) + mv ${D}${TEXMF_PATH}/$f ${D}/etc/texmf/$(dirname $f) || die "mv $f failed." + dosym /etc/texmf/$f ${TEXMF_PATH}/$f + done + + # take care of updmap.cfg, fmtutil.cnf and texmf.cnf + dodir /etc/texmf/{updmap.d,fmtutil.d,texmf.d} + #cp ${D}/usr/share/texmf/web2c/updmap.cfg ${D}/etc/texmf/updmap.d/00updmap.cfg + dosym /etc/texmf/web2c/updmap.cfg ${TEXMF_PATH}/web2c/updmap.cfg + mv ${D}/usr/share/texmf/web2c/updmap.cfg ${D}/etc/texmf/updmap.d/00updmap.cfg + mv ${D}/etc/texmf/web2c/fmtutil.cnf ${D}/etc/texmf/fmtutil.d/00fmtutil.cnf + mv ${D}/etc/texmf/web2c/texmf.cnf ${D}/etc/texmf/texmf.d/00texmf.cnf + + # xdvi + if useq X ; then + dodir /etc/X11/app-defaults /etc/texmf/xdvi + mv ${D}${TEXMF_PATH}/xdvi/XDvi ${D}/etc/X11/app-defaults || die "mv XDvi failed" + dosym /etc/X11/app-defaults/XDvi ${TEXMF_PATH}/xdvi/XDvi + fi + cd - +} + +tetex-3_pkg_preinst() { + + ewarn "Removing ${ROOT}usr/share/texmf/web2c" + rm -rf "${ROOT}usr/share/texmf/web2c" + + # take care of symlinks problems, see bug 120515 + # this can be removed when that is not an issue anymore + # i.e., all users with problem has got them fixed + for conf in updmap.d/00updmap.cfg texmf.d/00texmf.cnf fmtutil.d/00fmtutil.cnf + do + if [ -L "${ROOT}etc/texmf/${conf}" ] + then + ewarn "Removing ${ROOT}etc/texmf/${conf}" + rm -f "${ROOT}etc/texmf/${conf}" + fi + done + + # take care of config protection, upgrade from <=tetex-2.0.2-r4 + for conf in updmap.cfg texmf.cnf fmtutil.cnf + do + if [ ! -d "${ROOT}etc/texmf/${conf/.*/.d}" -a -f "${ROOT}etc/texmf/${conf}" ] + then + mkdir "${ROOT}etc/texmf/${conf/.*/.d}" + cp "${ROOT}etc/texmf/${conf}" "${ROOT}etc/texmf/00${conf/.*/.d}" + fi + done +} + +tetex-3_pkg_postinst() { + tetex_pkg_postinst +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/tetex.eclass b/sdk_container/src/third_party/portage-stable/eclass/tetex.eclass new file mode 100644 index 0000000000..382d415c6c --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/tetex.eclass @@ -0,0 +1,248 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/tetex.eclass,v 1.60 2009/01/06 19:25:20 grobian Exp $ +# +# Author: Jaromir Malenko +# Author: Mamoru KOMACHI +# Author: Martin Ehmsen +# Author: Alexandre Buisse +# +# A generic eclass to install tetex distributions. This shouldn't be +# inherited directly in any ebuilds. It should be inherited from +# tetex-{2,3}.eclass. + +inherit eutils flag-o-matic toolchain-funcs + +EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_postinst + +if [ -z "${TETEX_PV}" ] ; then + TETEX_PV=${PV} +fi + +IUSE="X doc tk" + +S=${WORKDIR}/tetex-src-${TETEX_PV} +TETEX_SRC="tetex-src-${TETEX_PV}.tar.gz" +TETEX_TEXMF="tetex-texmf-${TETEX_PV}.tar.gz" +TETEX_TEXMF_SRC="tetex-texmfsrc-${TETEX_PV}.tar.gz" + +DESCRIPTION="a complete TeX distribution" +HOMEPAGE="http://tug.org/teTeX/" +SRC_PATH_TETEX=ftp://cam.ctan.org/tex-archive/systems/unix/teTeX/2.0/distrib +SRC_URI="${SRC_PATH_TETEX}/${TETEX_SRC} + ${SRC_PATH_TETEX}/${TETEX_TEXMF} + ${SRC_PATH_TETEX}/${TETEX_TEXMF_SRC} + mirror://gentoo/tetex-${TETEX_PV}-gentoo.tar.gz + http://dev.gentoo.org/~usata/distfiles/tetex-${TETEX_PV}-gentoo.tar.gz" + +SLOT="0" +LICENSE="GPL-2" +KEYWORDS="~ia64 ~x86 ~ppc ~sparc ~alpha ~amd64" + +# tetex, ptex, cstetex must not block itself, fix for bug 121727 +if [[ "${PN}" = "tetex" ]] ; then + # >=app-text/ptex-3.1.9 work with app-text/tetex + DEPEND="!=app-text/ptex-3.1.9 does not co-exist with tetex-2 + DEPEND="! +# @BLURB: Provide various functions used by both texlive-core and texlive modules +# @DESCRIPTION: +# Purpose: Provide various functions used by both texlive-core and texlive +# modules. +# +# Note that this eclass *must* not assume the presence of any standard tex tool + + +TEXMF_PATH=/usr/share/texmf +TEXMF_DIST_PATH=/usr/share/texmf-dist +TEXMF_VAR_PATH=/var/lib/texmf + +# @FUNCTION: texlive-common_handle_config_files +# @DESCRIPTION: +# Has to be called in src_install after having installed the files in ${D} +# This function will move the relevant files to /etc/texmf and symling them +# from their original location. This is to allow easy update of texlive's +# configuration + +texlive-common_handle_config_files() { + # Handle config files properly + [ -d "${D}${TEXMF_PATH}" ] || return + cd "${D}${TEXMF_PATH}" + for f in $(find . -name '*.cnf' -type f -o -name '*.cfg' -type f | sed -e "s:\./::g") ; do + if [ "${f#*config}" != "${f}" -o "${f#doc}" != "${f}" ] ; then + continue + fi + dodir /etc/texmf/$(dirname ${f}).d + einfo "Moving (and symlinking) ${TEXMF_PATH}/${f} to /etc/texmf/$(dirname ${f}).d" + mv "${D}/${TEXMF_PATH}/${f}" "${D}/etc/texmf/$(dirname ${f}).d" || die "mv ${f} failed." + dosym /etc/texmf/$(dirname ${f}).d/$(basename ${f}) ${TEXMF_PATH}/${f} + done +} + +# @FUNCTION: texlive-common_is_file_present_in_texmf +# @DESCRIPTION: +# Return if a file is present in the texmf tree +# Call it from the directory containing texmf and texmf-dist + +texlive-common_is_file_present_in_texmf() { + local mark="${T}/$1.found" + find texmf -name $1 -exec touch "${mark}" \; + find texmf-dist -name $1 -exec touch "${mark}" \; + [ -f "${mark}" ] +} + +# @FUNCTION: texlive-common_do_symlinks +# @USAGE: < src > < dest > +# @DESCRIPTION: +# Mimic the install_link function of texlinks +# +# Should have the same behavior as the one in /usr/bin/texlinks +# except that it is under the control of the package manager +# Note that $1 corresponds to $src and $2 to $dest in this function +# ( Arguments are switched because texlinks main function sends them switched ) +# This function should not be called from an ebuild, prefer etexlinks that will +# also do the fmtutil file parsing. + +texlive-common_do_symlinks() { + while [ $# != 0 ]; do + case $1 in + cont-??|metafun|mptopdf) + einfo "Symlink $1 skipped (special case)" + ;; + mf) + einfo "Symlink $1 -> $2 skipped (texlive-core takes care of it)" + ;; + *) + if [ $1 = $2 ]; + then + einfo "Symlink $1 -> $2 skipped" + elif [ -e "${D}/usr/bin/$1" ]; + then + einfo "Symlink $1 skipped (file exists)" + else + einfo "Making symlink from $1 to $2" + dosym $2 /usr/bin/$1 + fi + ;; + esac + shift; shift; + done +} + +# @FUNCTION: etexlinks +# @USAGE: < file > +# @DESCRIPTION: +# Mimic texlinks on a fmtutil format file +# +# $1 has to be a fmtutil format file like fmtutil.cnf +# etexlinks foo will install the symlinks that texlinks --cnffile foo would have +# created. We cannot use texlinks with portage as it is not DESTDIR aware. +# (It would not fail but will not create the symlinks if the target is not in +# the same dir as the source) +# Also, as this eclass must not depend on a tex distribution to be installed we +# cannot use texlinks from here. + +etexlinks() { + # Install symlinks from formats to engines + texlive-common_do_symlinks $(sed '/^[ ]*#/d; /^[ ]*$/d' "$1" | awk '{print $1, $2}') +} + +# @FUNCTION: dobin_texmf_scripts +# @USAGE: < file1 file2 ... > +# @DESCRIPTION: +# Symlinks a script from the texmf tree to /usr/bin. Requires permissions to be +# correctly set for the file that it will point to. + +dobin_texmf_scripts() { + while [ $# -gt 0 ] ; do + local trg=$(basename ${1} | sed 's,\.[^/]*$,,' | tr '[:upper:]' '[:lower:]') + einfo "Installing ${1} as ${trg} bin wrapper" + dosym ../share/${1} /usr/bin/${trg} || die "failed to install ${1} as $trg" + shift + done +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/texlive-module.eclass b/sdk_container/src/third_party/portage-stable/eclass/texlive-module.eclass new file mode 100644 index 0000000000..27c2018709 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/texlive-module.eclass @@ -0,0 +1,332 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/texlive-module.eclass,v 1.34 2010/01/13 15:16:49 fauli Exp $ + +# @ECLASS: texlive-module.eclass +# @MAINTAINER: +# tex@gentoo.org +# +# Original Author: Alexis Ballier +# @BLURB: Provide generic install functions so that modular texlive's texmf ebuild will only have to inherit this eclass +# @DESCRIPTION: +# Purpose: Provide generic install functions so that modular texlive's texmf ebuilds will +# only have to inherit this eclass. +# Ebuilds have to provide TEXLIVE_MODULE_CONTENTS variable that contains the list +# of packages that it will install. (See below) +# +# What is assumed is that it unpacks texmf and texmf-dist directories to +# ${WORKDIR}. +# +# It inherits texlive-common + +# @ECLASS-VARIABLE: TEXLIVE_MODULE_CONTENTS +# @DESCRIPTION: +# The list of packages that will be installed. This variable will be expanded to +# SRC_URI: +# +# For TeX Live 2008: foo -> texlive-module-foo-${PV}.tar.lzma +# For TeX Live 2009: foo -> texlive-module-foo-${PV}.tar.xz + +# @ECLASS-VARIABLE: TEXLIVE_MODULE_DOC_CONTENTS +# @DESCRIPTION: +# The list of packages that will be installed if the doc useflag is enabled. +# Expansion to SRC_URI is the same as for TEXLIVE_MODULE_CONTENTS. This is only +# valid for TeX Live 2008 and later + +# @ECLASS-VARIABLE: TEXLIVE_MODULE_SRC_CONTENTS +# @DESCRIPTION: +# The list of packages that will be installed if the source useflag is enabled. +# Expansion to SRC_URI is the same as for TEXLIVE_MODULE_CONTENTS. This is only +# valid for TeX Live 2008 and later + +# @ECLASS-VARIABLE: TEXLIVE_MODULE_BINSCRIPTS +# @DESCRIPTION: +# A space separated list of files that are in fact scripts installed in the +# texmf tree and that we want to be available directly. They will be installed in +# /usr/bin. + +# @ECLASS-VARIABLE: TL_PV +# @DESCRIPTION: +# Normally the module's PV reflects the TeXLive release it belongs to. +# If this is not the case, TL_PV takes the version number for the +# needed app-text/texlive-core. + +inherit texlive-common + +HOMEPAGE="http://www.tug.org/texlive/" + +COMMON_DEPEND=">=app-text/texlive-core-${TL_PV:-${PV}}" + +IUSE="source" + +# TeX Live 2008 was providing .tar.lzma files of CTAN packages. For 2009 they are now +# .tar.xz +if [ "${PV#2008}" != "${PV}" ]; then + PKGEXT=tar.lzma + DEPEND="${COMMON_DEPEND} + || ( app-arch/xz-utils app-arch/lzma-utils )" +else + PKGEXT=tar.xz + DEPEND="${COMMON_DEPEND} + app-arch/xz-utils" +fi + +for i in ${TEXLIVE_MODULE_CONTENTS}; do + SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.${PKGEXT}" +done + +# Forge doc SRC_URI +[ -n "${PN##*documentation*}" ] && [ -n "${TEXLIVE_MODULE_DOC_CONTENTS}" ] && SRC_URI="${SRC_URI} doc? (" +for i in ${TEXLIVE_MODULE_DOC_CONTENTS}; do + SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.${PKGEXT}" +done +[ -n "${PN##*documentation*}" ] && [ -n "${TEXLIVE_MODULE_DOC_CONTENTS}" ] && SRC_URI="${SRC_URI} )" + +# Forge source SRC_URI +if [ -n "${TEXLIVE_MODULE_SRC_CONTENTS}" ] ; then + SRC_URI="${SRC_URI} source? (" + for i in ${TEXLIVE_MODULE_SRC_CONTENTS}; do + SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.${PKGEXT}" + done + SRC_URI="${SRC_URI} )" +fi + +RDEPEND="${COMMON_DEPEND}" + +[ -z "${PN##*documentation*}" ] || IUSE="${IUSE} doc" + +S="${WORKDIR}" + +if [ "${PV#2008}" == "${PV}" ]; then + +# @FUNCTION: texlive-module_src_unpack +# @DESCRIPTION: +# Only for TeX Live 2009. +# Gives tar.xz unpack support until we can use an EAPI with that support. + +RELOC_TARGET=texmf-dist + +texlive-module_src_unpack() { + local i s + for i in ${A} + do + s="${DISTDIR%/}/${i}" + einfo "Unpacking ${s} to ${PWD}" + test -s "${s}" || die "${s} does not exist" + xz -dc -- "${s}" | tar xof - || die "Unpacking ${s} failed" + done + grep RELOC tlpkg/tlpobj/* | awk '{print $2}' | sed 's#^RELOC/##' > "${T}/reloclist" + { for i in $(<"${T}/reloclist"); do dirname $i; done; } | uniq > "${T}/dirlist" + for i in $(<"${T}/dirlist"); do + [ -d "${RELOC_TARGET}/${i}" ] || mkdir -p "${RELOC_TARGET}/${i}" + done + for i in $(<"${T}/reloclist"); do + mv "${i}" "${RELOC_TARGET}"/$(dirname "${i}") || die "failed to relocate ${i} to ${RELOC_TARGET}/$(dirname ${i})" + done +} + +fi + +# @FUNCTION: texlive-module_add_format +# @DESCRIPTION: +# Creates/appends to a format.${PN}.cnf file for fmtutil. +# This will make fmtutil generate the formats when asked and allow the remaining +# src_compile phase to build the formats + +texlive-module_add_format() { + local name engine mode patterns options + eval $@ + einfo "Appending to format.${PN}.cnf for $@" + [ -d texmf/fmtutil ] || mkdir -p texmf/fmtutil + [ -f texmf/fmtutil/format.${PN}.cnf ] || { echo "# Generated for ${PN} by texlive-module.eclass" > texmf/fmtutil/format.${PN}.cnf; } + if [ "${mode}" == "disabled" ]; then + printf "#! " >> texmf/fmtutil/format.${PN}.cnf + fi + [ -z "${patterns}" ] && patterns="-" + printf "${name}\t${engine}\t${patterns}\t${options}\n" >> texmf/fmtutil/format.${PN}.cnf +} + +# @FUNCTION: texlive-module_make_language_def_lines +# @DESCRIPTION: +# Creates a language.${PN}.def entry to put in /etc/texmf/language.def.d +# It parses the AddHyphen directive of tlpobj files to create it. + +texlive-module_make_language_def_lines() { + local lefthyphenmin righthyphenmin synonyms name file + eval $@ + einfo "Generating language.def entry for $@" + [ -z "$lefthyphenmin" ] && lefthyphenmin="2" + [ -z "$righthyphenmin" ] && righthyphenmin="3" + echo "\\addlanguage{$name}{$file}{}{$lefthyphenmin}{$righthyphenmin}" >> "${S}/language.${PN}.def" + if [ -n "$synonyms" ] ; then + for i in $(echo $synonyms | tr ',' ' ') ; do + einfo "Generating language.def synonym $i for $@" + echo "\\addlanguage{$i}{$file}{}{$lefthyphenmin}{$righthyphenmin}" >> "${S}/language.${PN}.def" + done + fi +} + +# @FUNCTION: texlive-module_make_language_dat_lines +# @DESCRIPTION: +# Only valid for TeXLive 2008. +# Creates a language.${PN}.dat entry to put in /etc/texmf/language.dat.d +# It parses the AddHyphen directive of tlpobj files to create it. + +texlive-module_make_language_dat_lines() { + local lefthyphenmin righthyphenmin synonyms name file + eval $@ + einfo "Generating language.dat entry for $@" + echo "$name $file" >> "${S}/language.${PN}.dat" + if [ -n "$synonyms" ] ; then + for i in $(echo $synonyms | tr ',' ' ') ; do + einfo "Generating language.dat synonym $i for $@" + echo "=$i" >> "${S}/language.${PN}.dat" + done + fi +} + +# @FUNCTION: texlive-module_src_compile +# @DESCRIPTION: +# exported function: +# Will look for format.foo.cnf and build foo format files using fmtutil +# (provided by texlive-core). The compiled format files will be sent to +# texmf-var/web2c, like fmtutil defaults to but with some trick to stay in the +# sandbox +# The next step is to generate config files that are to be installed in +# /etc/texmf; texmf-update script will take care of merging the different config +# files for different packages in a single one used by the whole tex installation. + +texlive-module_src_compile() { + # Generate config files + # TeX Live 2007 was providing lists. For 2008 they are now tlpobj. + for i in "${S}"/tlpkg/tlpobj/*; + do + grep '^execute ' "${i}" | sed -e 's/^execute //' | tr ' ' '@' |sort|uniq >> "${T}/jobs" + done + + for i in $(<"${T}/jobs"); + do + j="$(echo $i | tr '@' ' ')" + command=${j%% *} + parameter=${j#* } + case "${command}" in + addMap) + echo "Map ${parameter}" >> "${S}/${PN}.cfg";; + addMixedMap) + echo "MixedMap ${parameter}" >> "${S}/${PN}.cfg";; + addDvipsMap) + echo "p +${parameter}" >> "${S}/${PN}-config.ps";; + addDvipdfmMap) + echo "f ${parameter}" >> "${S}/${PN}-config";; + AddHyphen) + texlive-module_make_language_def_lines "$parameter" + texlive-module_make_language_dat_lines "$parameter";; + AddFormat) + texlive-module_add_format "$parameter";; + BuildFormat) + einfo "Format $parameter already built.";; + BuildLanguageDat) + einfo "Language file $parameter already generated.";; + *) + die "No rule to proccess ${command}. Please file a bug." + esac + done + + # Build format files + for i in texmf/fmtutil/format*.cnf; do + if [ -f "${i}" ]; then + einfo "Building format ${i}" + VARTEXFONTS="${T}/fonts" TEXMFHOME="${S}/texmf:${S}/texmf-dist:${S}/texmf-var"\ + env -u TEXINPUTS fmtutil --cnffile "${i}" --fmtdir "${S}/texmf-var/web2c" --all\ + || die "failed to build format ${i}" + fi + done + + # Delete ls-R files, these should not be created but better be certain they + # do not end up being installed. + find . -name 'ls-R' -delete +} + +# @FUNCTION: texlive-module_src_install +# @DESCRIPTION: +# exported function: +# Install texmf and config files to the system + +texlive-module_src_install() { + for i in texmf/fmtutil/format*.cnf; do + [ -f "${i}" ] && etexlinks "${i}" + done + + dodir /usr/share + if [ -z "${PN##*documentation*}" ] || use doc; then + [ -d texmf-doc ] && cp -pR texmf-doc "${D}/usr/share/" + else + [ -d texmf/doc ] && rm -rf texmf/doc + [ -d texmf-dist/doc ] && rm -rf texmf-dist/doc + fi + + [ -d texmf ] && cp -pR texmf "${D}/usr/share/" + [ -d texmf-dist ] && cp -pR texmf-dist "${D}/usr/share/" + [ -d tlpkg ] && use source && cp -pR tlpkg "${D}/usr/share/" + + insinto /var/lib/texmf + [ -d texmf-var ] && doins -r texmf-var/* + + insinto /etc/texmf/updmap.d + [ -f "${S}/${PN}.cfg" ] && doins "${S}/${PN}.cfg" + insinto /etc/texmf/dvips.d + [ -f "${S}/${PN}-config.ps" ] && doins "${S}/${PN}-config.ps" + insinto /etc/texmf/dvipdfm/config + [ -f "${S}/${PN}-config" ] && doins "${S}/${PN}-config" + + if [ -f "${S}/language.${PN}.def" ] ; then + insinto /etc/texmf/language.def.d + doins "${S}/language.${PN}.def" + fi + + if [ -f "${S}/language.${PN}.dat" ] ; then + insinto /etc/texmf/language.dat.d + doins "${S}/language.${PN}.dat" + fi + [ -n "${TEXLIVE_MODULE_BINSCRIPTS}" ] && dobin_texmf_scripts ${TEXLIVE_MODULE_BINSCRIPTS} + + texlive-common_handle_config_files +} + +# @FUNCTION: texlive-module_pkg_postinst +# @DESCRIPTION: +# exported function: +# run texmf-update to ensure the tex installation is consistent with the +# installed texmf trees. + +texlive-module_pkg_postinst() { + if [ "$ROOT" = "/" ] && [ -x /usr/sbin/texmf-update ] ; then + /usr/sbin/texmf-update + else + ewarn "Cannot run texmf-update for some reason." + ewarn "Your texmf tree might be inconsistent with your configuration" + ewarn "Please try to figure what has happened" + fi +} + +# @FUNCTION: texlive-module_pkg_postrm +# @DESCRIPTION: +# exported function: +# run texmf-update to ensure the tex installation is consistent with the +# installed texmf trees. + +texlive-module_pkg_postrm() { + if [ "$ROOT" = "/" ] && [ -x /usr/sbin/texmf-update ] ; then + /usr/sbin/texmf-update + else + ewarn "Cannot run texmf-update for some reason." + ewarn "Your texmf tree might be inconsistent with your configuration" + ewarn "Please try to figure what has happened" + fi +} + +if [ "${PV#2008}" != "${PV}" ]; then +EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm +else +EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_postinst pkg_postrm +fi diff --git a/sdk_container/src/third_party/portage-stable/eclass/tla.eclass b/sdk_container/src/third_party/portage-stable/eclass/tla.eclass new file mode 100644 index 0000000000..f503787437 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/tla.eclass @@ -0,0 +1,204 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/tla.eclass,v 1.10 2007/04/23 19:35:05 swegener Exp $ +# +# Original Author: Jeffrey Yasskin +# +# Originally derived from the cvs eclass. +# +# This eclass provides the generic tla fetching functions. +# to use from an ebuild, set the 'ebuild-configurable settings' below in your +# ebuild before inheriting. then either leave the default src_unpack or extend +# over tla_src_unpack. + +# Most of the time, you will define only $ETLA_VERSION and $ETLA_ARCHIVES in +# your ebuild. + +# TODO: +# Make it support particular revisions. + + +# Don't download anything other than the tla archive +SRC_URI="" + +# You shouldn't change these settings yourself! The ebuild/eclass inheriting +# this eclass will take care of that. + +# --- begin ebuild-configurable settings + +# tla command to run. Theoretically, substituting any arch derivative should be +# relatively easy. +[ -z "$ETLA_TLA_CMD" ] && ETLA_TLA_CMD="tla" + +# tla commands with options +[ -z "$ETLA_GET_CMD" ] && ETLA_GET_CMD="get" +[ -z "$ETLA_UPDATE_CMD" ] && ETLA_UPDATE_CMD="replay" + +# Where the tla modules are stored/accessed +[ -z "$ETLA_TOP_DIR" ] && ETLA_TOP_DIR="${DISTDIR}/tla-src" + +# Name of tla version in the format +# user@example.com--archive-name/category--branch--version +# (in other words, an argument to tla get, update, or replay) +[ -z "$ETLA_VERSION" ] && ETLA_VERSION="" + +# A space-separated list of significant archive URLs. You should definitely +# include the URL for the archive your version is stored in, and if it refers +# to any other archives, also list them. +[ -z "$ETLA_ARCHIVES" ] && ETLA_ARCHIVES="" + +# The location in which to cache the version, relative to $ETLA_TOP_DIR. +[ -z "$ETLA_CACHE_DIR" ] && ETLA_CACHE_DIR="${ETLA_VERSION}" + +# ETLA_CLEAN: set this to something to get a clean copy when updating (removes +# the working directory, then uses $ETLA_GET_CMD to re-download it.) + +# --- end ebuild-configurable settings --- + +# add tla to deps +DEPEND="dev-util/tla" + +# registers archives mentioned in $ETLA_ARCHIVES +tla_register_archives() { + debug-print-function $FUNCNAME $* $ETLA_ARCHIVES + + for archive in $ETLA_ARCHIVES; do + $ETLA_TLA_CMD register-archive -f $archive || die "Could not register archive $archive" + done +} + +# checks that configuration variables have rational values. +tla_check_vars() { + [ -z "$ETLA_VERSION" ] && die "ETLA_VERSION must be set by the ebuild. Please fix this ebuild." + $ETLA_TLA_CMD valid-package-name --archive --vsn $ETLA_VERSION || \ + die "ETLA_VERSION has an invalid format. Please fix this ebuild." +} + +# is called from tla_src_unpack +tla_fetch() { + + debug-print-function $FUNCNAME $* + + if [ -n "$ETLA_CLEAN" ]; then + rm -rf $ETLA_TOP_DIR/$ETLA_CACHE_DIR + fi + + # create the top dir if needed + if [ ! -d "$ETLA_TOP_DIR" ]; then + # note that the addwrite statements in this block are only there to allow creating ETLA_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 tla directory" + addwrite /foobar + addwrite / + mkdir -p "$ETLA_TOP_DIR" + export SANDBOX_WRITE="${SANDBOX_WRITE//:\/foobar:\/}" + fi + + # in case ETLA_TOP_DIR is a symlink to a dir, get the real dir's path, + # otherwise addwrite() doesn't work. + cd -P "$ETLA_TOP_DIR" > /dev/null + ETLA_TOP_DIR="`/bin/pwd`" + + # disable the sandbox for this dir + addwrite "$ETLA_TOP_DIR" + + # break $ETLA_VERSION into pieces + local tla_archive=`$ETLA_TLA_CMD parse-package-name --arch $ETLA_VERSION` + local tla_version=`$ETLA_TLA_CMD parse-package-name --package-version $ETLA_VERSION` + #local tla_revision=`$ETLA_TLA_CMD parse-package-name --lvl $ETLA_VERSION` + + # determine checkout or update mode and change to the right directory. + if [ ! -d "$ETLA_TOP_DIR/$ETLA_CACHE_DIR/{arch}" ]; then + mode=get + mkdir -p "$ETLA_TOP_DIR/$ETLA_CACHE_DIR" + cd "$ETLA_TOP_DIR/$ETLA_CACHE_DIR/.." + rmdir "`basename "$ETLA_CACHE_DIR"`" + else + mode=update + cd "$ETLA_TOP_DIR/$ETLA_CACHE_DIR" + fi + + # switch versions automagically if needed + if [ "$mode" == "update" ]; then + local oldversion="`$ETLA_TLA_CMD tree-version`" + if [ "$tla_archive/$tla_version" != "$oldversion" ]; then + + einfo "Changing TLA version from $oldversion to $tla_archive/$tla_version:" + debug-print "$FUNCNAME: Changing TLA version from $oldversion to $tla_archive/$tla_version:" + + $ETLA_TLA_CMD set-tree-version $tla_archive/$tla_version + + fi + fi + + # commands to run + local cmdget="${ETLA_TLA_CMD} ${ETLA_GET_CMD} ${ETLA_VERSION} `basename $ETLA_CACHE_DIR`" + local cmdupdate="${ETLA_TLA_CMD} ${ETLA_UPDATE_CMD} ${ETLA_VERSION}" + + if [ "${mode}" == "get" ]; then + einfo "Running $cmdget" + eval $cmdget || die "tla get command failed" + elif [ "${mode}" == "update" ]; then + einfo "Running $cmdupdate" + eval $cmdupdate || die "tla update command failed" + fi + +} + + +tla_src_unpack() { + + debug-print-function $FUNCNAME $* + + debug-print "$FUNCNAME: init: + ETLA_TLA_CMD=$ETLA_TLA_CMD + ETLA_GET_CMD=$ETLA_GET_CMD + ETLA_UPDATE_CMD=$ETLA_UPDATE_CMD + ETLA_TOP_DIR=$ETLA_TOP_DIR + ETLA_VERSION=$ETLA_VERSION + ETLA_ARCHIVES=$ETLA_ARCHIVES + ETLA_CACHE_DIR=$ETLA_CACHE_DIR + ETLA_CLEAN=$ETLA_CLEAN" + + einfo "Registering Archives ..." + tla_register_archives + + einfo "Checking that passed-in variables are rational ..." + tla_check_vars + + einfo "Fetching tla version $ETLA_VERSION into $ETLA_TOP_DIR ..." + tla_fetch + + einfo "Copying $ETLA_CACHE_DIR from $ETLA_TOP_DIR ..." + debug-print "Copying $ETLA_CACHE_DIR from $ETLA_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}" + + local OLD_SHOPTS=$(shopt -p) + shopt -s dotglob # get any dotfiles too. + cp -Rf "$ETLA_TOP_DIR/$ETLA_CACHE_DIR"/* "${WORKDIR}/${P}" + eval "$OLD_SHOPTS" + + # 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" + # for x in $PATCHES; do + # debug-print "patching from $x" + # patch -p0 < "$x" + # done + # # make sure we don't try to apply patches more than once, since + # # tla_src_unpack may be called several times + # export PATCHES="" + #fi + + einfo "Version ${ETLA_VERSION} is now in ${WORKDIR}/${P}" +} + +EXPORT_FUNCTIONS src_unpack diff --git a/sdk_container/src/third_party/portage-stable/eclass/toolchain-binutils.eclass b/sdk_container/src/third_party/portage-stable/eclass/toolchain-binutils.eclass new file mode 100644 index 0000000000..7f25920ec2 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/toolchain-binutils.eclass @@ -0,0 +1,399 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain-binutils.eclass,v 1.90 2010/03/07 16:32:07 vapier Exp $ +# +# Maintainer: Toolchain Ninjas +# +# We install binutils into CTARGET-VERSION specific directories. This lets +# us easily merge multiple versions for multiple targets (if we wish) and +# then switch the versions on the fly (with `binutils-config`). +# +# binutils-9999 -> live cvs +# binutils-9999_preYYMMDD -> nightly snapshot date YYMMDD +# binutils-# -> normal release + +extra_eclass="" +if [[ -n ${BINUTILS_TYPE} ]] ; then + BTYPE=${BINUTILS_TYPE} +else + case ${PV} in + 9999) BTYPE="cvs";; + 9999_pre*) BTYPE="snap";; + *) BTYPE="rel";; + esac +fi + +if [[ ${BTYPE} == "cvs" ]] ; then + extra_eclass="cvs" + ECVS_SERVER="sourceware.org:/cvs/src" + ECVS_MODULE="binutils" + ECVS_USER="anoncvs" + ECVS_PASS="anoncvs" + BVER="cvs" +elif [[ ${BTYPE} == "snap" ]] ; then + BVER=${PV/9999_pre} +elif [[ ${BTYPE} == "rel" ]] ; then + BVER=${PV} +else + BVER=${BINUTILS_VER} +fi + +inherit eutils libtool flag-o-matic gnuconfig multilib versionator ${extra_eclass} +EXPORT_FUNCTIONS src_unpack src_compile src_test src_install pkg_postinst pkg_postrm + +export CTARGET=${CTARGET:-${CHOST}} +if [[ ${CTARGET} == ${CHOST} ]] ; then + if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then + export CTARGET=${CATEGORY/cross-} + fi +fi +is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; } + +DESCRIPTION="Tools necessary to build programs" +HOMEPAGE="http://sources.redhat.com/binutils/" + +case ${BTYPE} in + cvs) SRC_URI="";; + snap) SRC_URI="ftp://gcc.gnu.org/pub/binutils/snapshots/binutils-${BVER}.tar.bz2";; + rel) + SRC_URI="mirror://kernel/linux/devel/binutils/binutils-${PV}.tar.bz2 + mirror://kernel/linux/devel/binutils/test/binutils-${PV}.tar.bz2 + mirror://gnu/binutils/binutils-${PV}.tar.bz2" +esac +add_src_uri() { + [[ -z $2 ]] && return + local a=$1 + set -- mirror://gentoo http://dev.gentoo.org/~vapier/dist + SRC_URI="${SRC_URI} ${@/%//${a}}" +} +add_src_uri binutils-${PV}-patches-${PATCHVER}.tar.bz2 ${PATCHVER} +add_src_uri binutils-${PV}-uclibc-patches-${UCLIBC_PATCHVER}.tar.bz2 ${UCLIBC_PATCHVER} +add_src_uri elf2flt-${ELF2FLT_VER}.tar.bz2 ${ELF2FLT_VER} + +if version_is_at_least 2.18 ; then + LICENSE="|| ( GPL-3 LGPL-3 )" +else + LICENSE="|| ( GPL-2 LGPL-2 )" +fi +IUSE="nls multitarget multislot test vanilla" +if use multislot ; then + SLOT="${CTARGET}-${BVER}" +elif is_cross ; then + SLOT="${CTARGET}" +else + SLOT="0" +fi + +RDEPEND=">=sys-devel/binutils-config-1.9" +DEPEND="${RDEPEND} + test? ( dev-util/dejagnu ) + nls? ( sys-devel/gettext ) + sys-devel/flex" + +S=${WORKDIR}/binutils +[[ ${BVER} != "cvs" ]] && S=${S}-${BVER} + +LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${BVER} +INCPATH=${LIBPATH}/include +DATAPATH=/usr/share/binutils-data/${CTARGET}/${BVER} +MY_BUILDDIR=${WORKDIR}/build +if is_cross ; then + BINPATH=/usr/${CHOST}/${CTARGET}/binutils-bin/${BVER} +else + BINPATH=/usr/${CTARGET}/binutils-bin/${BVER} +fi + +tc-binutils_unpack() { + unpack ${A} + mkdir -p "${MY_BUILDDIR}" + [[ -d ${WORKDIR}/patch ]] && mkdir "${WORKDIR}"/patch/skip +} + +tc-binutils_apply_patches() { + cd "${S}" + + if ! use vanilla ; then + if [[ -n ${PATCHVER} ]] ; then + EPATCH_SOURCE=${WORKDIR}/patch + if [[ ${CTARGET} == mips* ]] ; then + # remove gnu-hash for mips (bug #233233) + EPATCH_EXCLUDE="77_all_generate-gnu-hash.patch" + fi + [[ -n $(ls "${EPATCH_SOURCE}"/*.bz2 2>/dev/null) ]] \ + && EPATCH_SUFFIX="patch.bz2" \ + || EPATCH_SUFFIX="patch" + epatch + fi + if [[ -n ${UCLIBC_PATCHVER} ]] ; then + EPATCH_SOURCE=${WORKDIR}/uclibc-patches + [[ -n $(ls "${EPATCH_SOURCE}"/*.bz2 2>/dev/null) ]] \ + && EPATCH_SUFFIX="patch.bz2" \ + || EPATCH_SUFFIX="patch" + EPATCH_MULTI_MSG="Applying uClibc fixes ..." \ + epatch + elif [[ ${CTARGET} == *-uclibc* ]] ; then + # starting with binutils-2.17.50.0.17, we no longer need + # uClibc patchsets :D + if grep -qs 'linux-gnu' "${S}"/ltconfig ; then + die "sorry, but this binutils doesn't yet support uClibc :(" + fi + fi + epatch_user + fi + + # fix locale issues if possible #122216 + if [[ -e ${FILESDIR}/binutils-configure-LANG.patch ]] ; then + einfo "Fixing misc issues in configure files" + for f in $(grep -l 'autoconf version 2.13' $(find "${S}" -name configure)) ; do + ebegin " Updating ${f/${S}\/}" + patch "${f}" "${FILESDIR}"/binutils-configure-LANG.patch >& "${T}"/configure-patch.log \ + || eerror "Please file a bug about this" + eend $? + done + fi + # fix conflicts with newer glibc #272594 + if [[ -e libiberty/testsuite/test-demangle.c ]] ; then + sed -i 's:\:get_line:g' libiberty/testsuite/test-demangle.c + fi + + # Fix po Makefile generators + sed -i \ + -e '/^datadir = /s:$(prefix)/@DATADIRNAME@:@datadir@:' \ + -e '/^gnulocaledir = /s:$(prefix)/share:$(datadir):' \ + */po/Make-in || die "sed po's failed" + + # Run misc portage update scripts + gnuconfig_update + elibtoolize --portage --no-uclibc +} + +toolchain-binutils_src_unpack() { + tc-binutils_unpack + tc-binutils_apply_patches +} + +toolchain-binutils_src_compile() { + # prevent makeinfo from running in releases. it may not always be + # installed, and older binutils may fail with newer texinfo. + # besides, we never patch the doc files anyways, so regenerating + # in the first place is useless. #193364 + find . '(' -name '*.info' -o -name '*.texi' ')' -print0 | xargs -0 touch -r . + + # make sure we filter $LINGUAS so that only ones that + # actually work make it through #42033 + strip-linguas -u */po + + # keep things sane + strip-flags + + local x + echo + for x in CATEGORY CBUILD CHOST CTARGET CFLAGS LDFLAGS ; do + einfo "$(printf '%10s' ${x}:) ${!x}" + done + echo + + cd "${MY_BUILDDIR}" + local myconf="" + # new versions allow gold and ld; screw older versions + if grep -q 'enable-gold=both/bfd' "${S}"/configure ; then + myconf="${myconf} --enable-gold=both/bfd" + fi + use nls \ + && myconf="${myconf} --without-included-gettext" \ + || myconf="${myconf} --disable-nls" + use multitarget && myconf="${myconf} --enable-targets=all" + [[ -n ${CBUILD} ]] && myconf="${myconf} --build=${CBUILD}" + is_cross && myconf="${myconf} --with-sysroot=/usr/${CTARGET}" + # glibc-2.3.6 lacks support for this ... so rather than force glibc-2.5+ + # on everyone in alpha (for now), we'll just enable it when possible + has_version ">=${CATEGORY}/glibc-2.5" && myconf="${myconf} --enable-secureplt" + has_version ">=sys-libs/glibc-2.5" && myconf="${myconf} --enable-secureplt" + myconf="--prefix=/usr \ + --host=${CHOST} \ + --target=${CTARGET} \ + --datadir=${DATAPATH} \ + --infodir=${DATAPATH}/info \ + --mandir=${DATAPATH}/man \ + --bindir=${BINPATH} \ + --libdir=${LIBPATH} \ + --libexecdir=${LIBPATH} \ + --includedir=${INCPATH} \ + --enable-64-bit-bfd \ + --enable-shared \ + --disable-werror \ + ${myconf} ${EXTRA_ECONF}" + echo ./configure ${myconf} + "${S}"/configure ${myconf} || die "configure failed" + + emake all || die "emake failed" + + # only build info pages if we user wants them, and if + # we have makeinfo (may not exist when we bootstrap) + if type -p makeinfo > /dev/null ; then + emake info || die "make info failed" + fi + # we nuke the manpages when we're left with junk + # (like when we bootstrap, no perl -> no manpages) + find . -name '*.1' -a -size 0 | xargs rm -f + + # elf2flt only works on some arches / targets + if [[ -n ${ELF2FLT_VER} ]] && [[ ${CTARGET} == *linux* || ${CTARGET} == *-elf* ]] ; then + cd "${WORKDIR}"/elf2flt-${ELF2FLT_VER} + + local x supported_arches=$(sed -n '/defined(TARGET_/{s:^.*TARGET_::;s:)::;p}' elf2flt.c | sort -u) + for x in ${supported_arches} UNSUPPORTED ; do + [[ ${CTARGET} == ${x}* ]] && break + done + + if [[ ${x} != "UNSUPPORTED" ]] ; then + append-flags -I"${S}"/include + myconf="--with-bfd-include-dir=${MY_BUILDDIR}/bfd \ + --with-libbfd=${MY_BUILDDIR}/bfd/libbfd.a \ + --with-libiberty=${MY_BUILDDIR}/libiberty/libiberty.a \ + --with-binutils-ldscript-dir=${LIBPATH}/ldscripts \ + ${myconf}" + echo ./configure ${myconf} + ./configure ${myconf} || die "configure elf2flt failed" + emake || die "make elf2flt failed" + fi + fi +} + +toolchain-binutils_src_test() { + cd "${MY_BUILDDIR}" + make check || die "check failed :(" +} + +toolchain-binutils_src_install() { + local x d + + cd "${MY_BUILDDIR}" + emake DESTDIR="${D}" tooldir="${LIBPATH}" install || die + rm -rf "${D}"/${LIBPATH}/bin + + # Newer versions of binutils get fancy with ${LIBPATH} #171905 + cd "${D}"/${LIBPATH} + for d in ../* ; do + [[ ${d} == ../${BVER} ]] && continue + mv ${d}/* . || die + rmdir ${d} || die + done + + # Now we collect everything intp the proper SLOT-ed dirs + # When something is built to cross-compile, it installs into + # /usr/$CHOST/ by default ... we have to 'fix' that :) + if is_cross ; then + cd "${D}"/${BINPATH} + for x in * ; do + mv ${x} ${x/${CTARGET}-} + done + + if [[ -d ${D}/usr/${CHOST}/${CTARGET} ]] ; then + mv "${D}"/usr/${CHOST}/${CTARGET}/include "${D}"/${INCPATH} + mv "${D}"/usr/${CHOST}/${CTARGET}/lib/* "${D}"/${LIBPATH}/ + rm -r "${D}"/usr/${CHOST}/{include,lib} + fi + fi + insinto ${INCPATH} + doins "${S}/include/libiberty.h" + if [[ -d ${D}/${LIBPATH}/lib ]] ; then + mv "${D}"/${LIBPATH}/lib/* "${D}"/${LIBPATH}/ + rm -r "${D}"/${LIBPATH}/lib + fi + + # Insert elf2flt where appropriate + if [[ -x ${WORKDIR}/elf2flt-${ELF2FLT_VER}/elf2flt ]] ; then + cd "${WORKDIR}"/elf2flt-${ELF2FLT_VER} + insinto ${LIBPATH}/ldscripts + doins elf2flt.ld || die "doins elf2flt.ld failed" + exeinto ${BINPATH} + doexe elf2flt flthdr || die "doexe elf2flt flthdr failed" + mv "${D}"/${BINPATH}/{ld,ld.real} || die + newexe ld-elf2flt ld || die "doexe ld-elf2flt failed" + newdoc README README.elf2flt + fi + + # Now, some binutils are tricky and actually provide + # for multiple TARGETS. Really, we're talking just + # 32bit/64bit support (like mips/ppc/sparc). Here + # we want to tell binutils-config that it's cool if + # it generates multiple sets of binutil symlinks. + # e.g. sparc gets {sparc,sparc64}-unknown-linux-gnu + local targ=${CTARGET/-*} src="" dst="" + local FAKE_TARGETS=${CTARGET} + case ${targ} in + mips*) src="mips" dst="mips64";; + powerpc*) src="powerpc" dst="powerpc64";; + s390*) src="s390" dst="s390x";; + sparc*) src="sparc" dst="sparc64";; + esac + case ${targ} in + mips64*|powerpc64*|s390x*|sparc64*) targ=${src} src=${dst} dst=${targ};; + esac + [[ -n ${src}${dst} ]] && FAKE_TARGETS="${FAKE_TARGETS} ${CTARGET/${src}/${dst}}" + + # Generate an env.d entry for this binutils + cd "${S}" + insinto /etc/env.d/binutils + cat <<-EOF > env.d + TARGET="${CTARGET}" + VER="${BVER}" + LIBPATH="${LIBPATH}" + FAKE_TARGETS="${FAKE_TARGETS}" + EOF + newins env.d ${CTARGET}-${BVER} + + # Handle documentation + if ! is_cross ; then + cd "${S}" + dodoc README + docinto bfd + dodoc bfd/ChangeLog* bfd/README bfd/PORTING bfd/TODO + docinto binutils + dodoc binutils/ChangeLog binutils/NEWS binutils/README + docinto gas + dodoc gas/ChangeLog* gas/CONTRIBUTORS gas/NEWS gas/README* + docinto gprof + dodoc gprof/ChangeLog* gprof/TEST gprof/TODO gprof/bbconv.pl + docinto ld + dodoc ld/ChangeLog* ld/README ld/NEWS ld/TODO + docinto libiberty + dodoc libiberty/ChangeLog* libiberty/README + docinto opcodes + dodoc opcodes/ChangeLog* + fi + # Remove shared info pages + rm -f "${D}"/${DATAPATH}/info/{dir,configure.info,standards.info} + # Trim all empty dirs + find "${D}" -type d | xargs rmdir >& /dev/null +} + +toolchain-binutils_pkg_postinst() { + # Make sure this ${CTARGET} has a binutils version selected + [[ -e ${ROOT}/etc/env.d/binutils/config-${CTARGET} ]] && return 0 + binutils-config ${CTARGET}-${BVER} +} + +toolchain-binutils_pkg_postrm() { + local current_profile=$(binutils-config -c ${CTARGET}) + + # If no other versions exist, then uninstall for this + # target ... otherwise, switch to the newest version + # Note: only do this if this version is unmerged. We + # rerun binutils-config if this is a remerge, as + # we want the mtimes on the symlinks updated (if + # it is the same as the current selected profile) + if [[ ! -e ${BINPATH}/ld ]] && [[ ${current_profile} == ${CTARGET}-${BVER} ]] ; then + local choice=$(binutils-config -l | grep ${CTARGET} | awk '{print $2}') + choice=${choice//$'\n'/ } + choice=${choice/* } + if [[ -z ${choice} ]] ; then + env -i binutils-config -u ${CTARGET} + else + binutils-config ${choice} + fi + elif [[ $(CHOST=${CTARGET} binutils-config -c) == ${CTARGET}-${BVER} ]] ; then + binutils-config ${CTARGET}-${BVER} + fi +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/toolchain-funcs.eclass b/sdk_container/src/third_party/portage-stable/eclass/toolchain-funcs.eclass new file mode 100644 index 0000000000..cd4941435a --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/toolchain-funcs.eclass @@ -0,0 +1,765 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain-funcs.eclass,v 1.109 2011/12/10 19:45:00 vapier Exp $ + +# @ECLASS: toolchain-funcs.eclass +# @MAINTAINER: +# Toolchain Ninjas +# @BLURB: functions to query common info about the toolchain +# @DESCRIPTION: +# The toolchain-funcs aims to provide a complete suite of functions +# for gleaning useful information about the toolchain and to simplify +# ugly things like cross-compiling and multilib. All of this is done +# in such a way that you can rely on the function always returning +# something sane. + +if [[ ${___ECLASS_ONCE_TOOLCHAIN_FUNCS} != "recur -_+^+_- spank" ]] ; then +___ECLASS_ONCE_TOOLCHAIN_FUNCS="recur -_+^+_- spank" + +inherit multilib + +DESCRIPTION="Based on the ${ECLASS} eclass" + +# tc-getPROG
[tuple] +_tc-getPROG() { + local tuple=$1 + local v var vars=$2 + local prog=$3 + + var=${vars%% *} + for v in ${vars} ; do + if [[ -n ${!v} ]] ; then + export ${var}="${!v}" + echo "${!v}" + return 0 + fi + done + + local search= + [[ -n $4 ]] && search=$(type -p "$4-${prog}") + [[ -z ${search} && -n ${!tuple} ]] && search=$(type -p "${!tuple}-${prog}") + [[ -n ${search} ]] && prog=${search##*/} + + export ${var}=${prog} + echo "${!var}" +} +tc-getBUILD_PROG() { _tc-getPROG CBUILD "BUILD_$1 $1_FOR_BUILD HOST$1" "${@:2}"; } +tc-getPROG() { _tc-getPROG CHOST "$@"; } + +# @FUNCTION: tc-getAR +# @USAGE: [toolchain prefix] +# @RETURN: name of the archiver +tc-getAR() { tc-getPROG AR ar "$@"; } +# @FUNCTION: tc-getAS +# @USAGE: [toolchain prefix] +# @RETURN: name of the assembler +tc-getAS() { tc-getPROG AS as "$@"; } +# @FUNCTION: tc-getCC +# @USAGE: [toolchain prefix] +# @RETURN: name of the C compiler +tc-getCC() { tc-getPROG CC gcc "$@"; } +# @FUNCTION: tc-getCPP +# @USAGE: [toolchain prefix] +# @RETURN: name of the C preprocessor +tc-getCPP() { tc-getPROG CPP cpp "$@"; } +# @FUNCTION: tc-getCXX +# @USAGE: [toolchain prefix] +# @RETURN: name of the C++ compiler +tc-getCXX() { tc-getPROG CXX g++ "$@"; } +# @FUNCTION: tc-getLD +# @USAGE: [toolchain prefix] +# @RETURN: name of the linker +tc-getLD() { tc-getPROG LD ld "$@"; } +# @FUNCTION: tc-getSTRIP +# @USAGE: [toolchain prefix] +# @RETURN: name of the strip program +tc-getSTRIP() { tc-getPROG STRIP strip "$@"; } +# @FUNCTION: tc-getNM +# @USAGE: [toolchain prefix] +# @RETURN: name of the symbol/object thingy +tc-getNM() { tc-getPROG NM nm "$@"; } +# @FUNCTION: tc-getRANLIB +# @USAGE: [toolchain prefix] +# @RETURN: name of the archiver indexer +tc-getRANLIB() { tc-getPROG RANLIB ranlib "$@"; } +# @FUNCTION: tc-getOBJCOPY +# @USAGE: [toolchain prefix] +# @RETURN: name of the object copier +tc-getOBJCOPY() { tc-getPROG OBJCOPY objcopy "$@"; } +# @FUNCTION: tc-getF77 +# @USAGE: [toolchain prefix] +# @RETURN: name of the Fortran 77 compiler +tc-getF77() { tc-getPROG F77 gfortran "$@"; } +# @FUNCTION: tc-getFC +# @USAGE: [toolchain prefix] +# @RETURN: name of the Fortran 90 compiler +tc-getFC() { tc-getPROG FC gfortran "$@"; } +# @FUNCTION: tc-getGCJ +# @USAGE: [toolchain prefix] +# @RETURN: name of the java compiler +tc-getGCJ() { tc-getPROG GCJ gcj "$@"; } +# @FUNCTION: tc-getPKG_CONFIG +# @USAGE: [toolchain prefix] +# @RETURN: name of the pkg-config tool +tc-getPKG_CONFIG() { tc-getPROG PKG_CONFIG pkg-config "$@"; } +# @FUNCTION: tc-getRC +# @USAGE: [toolchain prefix] +# @RETURN: name of the Windows resource compiler +tc-getRC() { tc-getPROG RC windres "$@"; } +# @FUNCTION: tc-getDLLWRAP +# @USAGE: [toolchain prefix] +# @RETURN: name of the Windows dllwrap utility +tc-getDLLWRAP() { tc-getPROG DLLWRAP dllwrap "$@"; } + +# @FUNCTION: tc-getBUILD_AR +# @USAGE: [toolchain prefix] +# @RETURN: name of the archiver for building binaries to run on the build machine +tc-getBUILD_AR() { tc-getBUILD_PROG AR ar "$@"; } +# @FUNCTION: tc-getBUILD_AS +# @USAGE: [toolchain prefix] +# @RETURN: name of the assembler for building binaries to run on the build machine +tc-getBUILD_AS() { tc-getBUILD_PROG AS as "$@"; } +# @FUNCTION: tc-getBUILD_CC +# @USAGE: [toolchain prefix] +# @RETURN: name of the C compiler for building binaries to run on the build machine +tc-getBUILD_CC() { tc-getBUILD_PROG CC gcc "$@"; } +# @FUNCTION: tc-getBUILD_CPP +# @USAGE: [toolchain prefix] +# @RETURN: name of the C preprocessor for building binaries to run on the build machine +tc-getBUILD_CPP() { tc-getBUILD_PROG CPP cpp "$@"; } +# @FUNCTION: tc-getBUILD_CXX +# @USAGE: [toolchain prefix] +# @RETURN: name of the C++ compiler for building binaries to run on the build machine +tc-getBUILD_CXX() { tc-getBUILD_PROG CXX g++ "$@"; } +# @FUNCTION: tc-getBUILD_LD +# @USAGE: [toolchain prefix] +# @RETURN: name of the linker for building binaries to run on the build machine +tc-getBUILD_LD() { tc-getBUILD_PROG LD ld "$@"; } +# @FUNCTION: tc-getBUILD_STRIP +# @USAGE: [toolchain prefix] +# @RETURN: name of the strip program for building binaries to run on the build machine +tc-getBUILD_STRIP() { tc-getBUILD_PROG STRIP strip "$@"; } +# @FUNCTION: tc-getBUILD_NM +# @USAGE: [toolchain prefix] +# @RETURN: name of the symbol/object thingy for building binaries to run on the build machine +tc-getBUILD_NM() { tc-getBUILD_PROG NM nm "$@"; } +# @FUNCTION: tc-getBUILD_RANLIB +# @USAGE: [toolchain prefix] +# @RETURN: name of the archiver indexer for building binaries to run on the build machine +tc-getBUILD_RANLIB() { tc-getBUILD_PROG RANLIB ranlib "$@"; } +# @FUNCTION: tc-getBUILD_OBJCOPY +# @USAGE: [toolchain prefix] +# @RETURN: name of the object copier for building binaries to run on the build machine +tc-getBUILD_OBJCOPY() { tc-getBUILD_PROG OBJCOPY objcopy "$@"; } +# @FUNCTION: tc-getBUILD_PKG_CONFIG +# @USAGE: [toolchain prefix] +# @RETURN: name of the pkg-config tool for building binaries to run on the build machine +tc-getBUILD_PKG_CONFIG() { tc-getBUILD_PROG PKG_CONFIG pkg-config "$@"; } + +# @FUNCTION: tc-export +# @USAGE: +# @DESCRIPTION: +# Quick way to export a bunch of compiler vars at once. +tc-export() { + local var + for var in "$@" ; do + [[ $(type -t tc-get${var}) != "function" ]] && die "tc-export: invalid export variable '${var}'" + eval tc-get${var} > /dev/null + done +} + +# @FUNCTION: tc-is-cross-compiler +# @RETURN: Shell true if we are using a cross-compiler, shell false otherwise +tc-is-cross-compiler() { + return $([[ ${CBUILD:-${CHOST}} != ${CHOST} ]]) +} + +# @FUNCTION: tc-is-softfloat +# @DESCRIPTION: +# See if this toolchain is a softfloat based one. +# @CODE +# The possible return values: +# - only: the target is always softfloat (never had fpu) +# - yes: the target should support softfloat +# - no: the target doesn't support softfloat +# @CODE +# This allows us to react differently where packages accept +# softfloat flags in the case where support is optional, but +# rejects softfloat flags where the target always lacks an fpu. +tc-is-softfloat() { + case ${CTARGET} in + bfin*|h8300*) + echo "only" ;; + *) + [[ ${CTARGET//_/-} == *-softfloat-* ]] \ + && echo "yes" \ + || echo "no" + ;; + esac +} + +# @FUNCTION: tc-is-hardfloat +# @DESCRIPTION: +# See if this toolchain is a hardfloat based one. +# @CODE +# The possible return values: +# - yes: the target should support hardfloat +# - no: the target doesn't support hardfloat +tc-is-hardfloat() { + [[ ${CTARGET//_/-} == *-hardfloat-* ]] \ + && echo "yes" \ + || echo "no" +} + +# @FUNCTION: tc-is-static-only +# @DESCRIPTION: +# Return shell true if the target does not support shared libs, shell false +# otherwise. +tc-is-static-only() { + local host=${CTARGET:-${CHOST}} + + # *MiNT doesn't have shared libraries, only platform so far + return $([[ ${host} == *-mint* ]]) +} + +# @FUNCTION: tc-env_build +# @USAGE: [command args] +# @INTERNAL +# @DESCRIPTION: +# Setup the compile environment to the build tools and then execute the +# specified command. We use tc-getBUILD_XX here so that we work with +# all of the semi-[non-]standard env vars like $BUILD_CC which often +# the target build system does not check. +tc-env_build() { + CFLAGS=${BUILD_CFLAGS:--O1 -pipe} \ + CXXFLAGS=${BUILD_CXXFLAGS:--O1 -pipe} \ + CPPFLAGS=${BUILD_CPPFLAGS} \ + LDFLAGS=${BUILD_LDFLAGS} \ + AR=$(tc-getBUILD_AR) \ + AS=$(tc-getBUILD_AS) \ + CC=$(tc-getBUILD_CC) \ + CPP=$(tc-getBUILD_CPP) \ + CXX=$(tc-getBUILD_CXX) \ + LD=$(tc-getBUILD_LD) \ + NM=$(tc-getBUILD_NM) \ + PKG_CONFIG=$(tc-getBUILD_PKG_CONFIG) \ + RANLIB=$(tc-getBUILD_RANLIB) \ + "$@" +} + +# @FUNCTION: econf_build +# @USAGE: [econf flags] +# @DESCRIPTION: +# Sometimes we need to locally build up some tools to run on CBUILD because +# the package has helper utils which are compiled+executed when compiling. +# This won't work when cross-compiling as the CHOST is set to a target which +# we cannot natively execute. +# +# For example, the python package will build up a local python binary using +# a portable build system (configure+make), but then use that binary to run +# local python scripts to build up other components of the overall python. +# We cannot rely on the python binary in $PATH as that often times will be +# a different version, or not even installed in the first place. Instead, +# we compile the code in a different directory to run on CBUILD, and then +# use that binary when compiling the main package to run on CHOST. +# +# For example, with newer EAPIs, you'd do something like: +# @CODE +# src_configure() { +# ECONF_SOURCE=${S} +# if tc-is-cross-compiler ; then +# mkdir "${WORKDIR}"/${CBUILD} +# pushd "${WORKDIR}"/${CBUILD} >/dev/null +# econf_build --disable-some-unused-stuff +# popd >/dev/null +# fi +# ... normal build paths ... +# } +# src_compile() { +# if tc-is-cross-compiler ; then +# pushd "${WORKDIR}"/${CBUILD} >/dev/null +# emake one-or-two-build-tools +# ln/mv build-tools to normal build paths in ${S}/ +# popd >/dev/null +# fi +# ... normal build paths ... +# } +# @CODE +econf_build() { + tc-env_build econf --build=${CBUILD:-${CHOST}} "$@" +} + +# @FUNCTION: tc-has-openmp +# @USAGE: [toolchain prefix] +# @DESCRIPTION: +# See if the toolchain supports OpenMP. +tc-has-openmp() { + local base="${T}/test-tc-openmp" + cat <<-EOF > "${base}.c" + #include + int main() { + int nthreads, tid, ret = 0; + #pragma omp parallel private(nthreads, tid) + { + tid = omp_get_thread_num(); + nthreads = omp_get_num_threads(); ret += tid + nthreads; + } + return ret; + } + EOF + $(tc-getCC "$@") -fopenmp "${base}.c" -o "${base}" >&/dev/null + local ret=$? + rm -f "${base}"* + return ${ret} +} + +# @FUNCTION: tc-has-tls +# @USAGE: [-s|-c|-l] [toolchain prefix] +# @DESCRIPTION: +# See if the toolchain supports thread local storage (TLS). Use -s to test the +# compiler, -c to also test the assembler, and -l to also test the C library +# (the default). +tc-has-tls() { + local base="${T}/test-tc-tls" + cat <<-EOF > "${base}.c" + int foo(int *i) { + static __thread int j = 0; + return *i ? j : *i; + } + EOF + local flags + case $1 in + -s) flags="-S";; + -c) flags="-c";; + -l) ;; + -*) die "Usage: tc-has-tls [-c|-l] [toolchain prefix]";; + esac + : ${flags:=-fPIC -shared -Wl,-z,defs} + [[ $1 == -* ]] && shift + $(tc-getCC "$@") ${flags} "${base}.c" -o "${base}" >&/dev/null + local ret=$? + rm -f "${base}"* + return ${ret} +} + + +# Parse information from CBUILD/CHOST/CTARGET rather than +# use external variables from the profile. +tc-ninja_magic_to_arch() { +ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; } + + local type=$1 + local host=$2 + [[ -z ${host} ]] && host=${CTARGET:-${CHOST}} + + case ${host} in + alpha*) echo alpha;; + arm*) echo arm;; + avr*) ninj avr32 avr;; + bfin*) ninj blackfin bfin;; + cris*) echo cris;; + hppa*) ninj parisc hppa;; + i?86*) + # Starting with linux-2.6.24, the 'x86_64' and 'i386' + # trees have been unified into 'x86'. + # FreeBSD still uses i386 + if [[ ${type} == "kern" ]] && [[ $(KV_to_int ${KV}) -lt $(KV_to_int 2.6.24) || ${host} == *freebsd* ]] ; then + echo i386 + else + echo x86 + fi + ;; + ia64*) echo ia64;; + m68*) echo m68k;; + mips*) echo mips;; + nios2*) echo nios2;; + nios*) echo nios;; + powerpc*) + # Starting with linux-2.6.15, the 'ppc' and 'ppc64' trees + # have been unified into simply 'powerpc', but until 2.6.16, + # ppc32 is still using ARCH="ppc" as default + if [[ ${type} == "kern" ]] && [[ $(KV_to_int ${KV}) -ge $(KV_to_int 2.6.16) ]] ; then + echo powerpc + elif [[ ${type} == "kern" ]] && [[ $(KV_to_int ${KV}) -eq $(KV_to_int 2.6.15) ]] ; then + if [[ ${host} == powerpc64* ]] || [[ ${PROFILE_ARCH} == "ppc64" ]] ; then + echo powerpc + else + echo ppc + fi + elif [[ ${host} == powerpc64* ]] ; then + echo ppc64 + elif [[ ${PROFILE_ARCH} == "ppc64" ]] ; then + ninj ppc64 ppc + else + echo ppc + fi + ;; + s390*) echo s390;; + sh64*) ninj sh64 sh;; + sh*) echo sh;; + sparc64*) ninj sparc64 sparc;; + sparc*) [[ ${PROFILE_ARCH} == "sparc64" ]] \ + && ninj sparc64 sparc \ + || echo sparc + ;; + vax*) echo vax;; + x86_64*freebsd*) echo amd64;; + x86_64*) + # Starting with linux-2.6.24, the 'x86_64' and 'i386' + # trees have been unified into 'x86'. + if [[ ${type} == "kern" ]] && [[ $(KV_to_int ${KV}) -ge $(KV_to_int 2.6.24) ]] ; then + echo x86 + else + ninj x86_64 amd64 + fi + ;; + + # since our usage of tc-arch is largely concerned with + # normalizing inputs for testing ${CTARGET}, let's filter + # other cross targets (mingw and such) into the unknown. + *) echo unknown;; + esac +} +# @FUNCTION: tc-arch-kernel +# @USAGE: [toolchain prefix] +# @RETURN: name of the kernel arch according to the compiler target +tc-arch-kernel() { + tc-ninja_magic_to_arch kern "$@" +} +# @FUNCTION: tc-arch +# @USAGE: [toolchain prefix] +# @RETURN: name of the portage arch according to the compiler target +tc-arch() { + tc-ninja_magic_to_arch portage "$@" +} + +tc-endian() { + local host=$1 + [[ -z ${host} ]] && host=${CTARGET:-${CHOST}} + host=${host%%-*} + + case ${host} in + alpha*) echo big;; + arm*b*) echo big;; + arm*) echo little;; + cris*) echo little;; + hppa*) echo big;; + i?86*) echo little;; + ia64*) echo little;; + m68*) echo big;; + mips*l*) echo little;; + mips*) echo big;; + powerpc*) echo big;; + s390*) echo big;; + sh*b*) echo big;; + sh*) echo little;; + sparc*) echo big;; + x86_64*) echo little;; + *) echo wtf;; + esac +} + +# Internal func. The first argument is the version info to expand. +# Query the preprocessor to improve compatibility across different +# compilers rather than maintaining a --version flag matrix. #335943 +_gcc_fullversion() { + local ver="$1"; shift + set -- `$(tc-getCPP "$@") -E -P - <<<"__GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__"` + eval echo "$ver" +} + +# @FUNCTION: gcc-fullversion +# @RETURN: compiler version (major.minor.micro: [3.4.6]) +gcc-fullversion() { + _gcc_fullversion '$1.$2.$3' "$@" +} +# @FUNCTION: gcc-version +# @RETURN: compiler version (major.minor: [3.4].6) +gcc-version() { + _gcc_fullversion '$1.$2' "$@" +} +# @FUNCTION: gcc-major-version +# @RETURN: major compiler version (major: [3].4.6) +gcc-major-version() { + _gcc_fullversion '$1' "$@" +} +# @FUNCTION: gcc-minor-version +# @RETURN: minor compiler version (minor: 3.[4].6) +gcc-minor-version() { + _gcc_fullversion '$2' "$@" +} +# @FUNCTION: gcc-micro-version +# @RETURN: micro compiler version (micro: 3.4.[6]) +gcc-micro-version() { + _gcc_fullversion '$3' "$@" +} + +# Returns the installation directory - internal toolchain +# function for use by _gcc-specs-exists (for flag-o-matic). +_gcc-install-dir() { + echo "$(LC_ALL=C $(tc-getCC) -print-search-dirs 2> /dev/null |\ + awk '$1=="install:" {print $2}')" +} +# Returns true if the indicated specs file exists - internal toolchain +# function for use by flag-o-matic. +_gcc-specs-exists() { + [[ -f $(_gcc-install-dir)/$1 ]] +} + +# Returns requested gcc specs directive unprocessed - for used by +# gcc-specs-directive() +# Note; later specs normally overwrite earlier ones; however if a later +# spec starts with '+' then it appends. +# gcc -dumpspecs is parsed first, followed by files listed by "gcc -v" +# as "Reading ", in order. Strictly speaking, if there's a +# $(gcc_install_dir)/specs, the built-in specs aren't read, however by +# the same token anything from 'gcc -dumpspecs' is overridden by +# the contents of $(gcc_install_dir)/specs so the result is the +# same either way. +_gcc-specs-directive_raw() { + local cc=$(tc-getCC) + local specfiles=$(LC_ALL=C ${cc} -v 2>&1 | awk '$1=="Reading" {print $NF}') + ${cc} -dumpspecs 2> /dev/null | cat - ${specfiles} | awk -v directive=$1 \ +'BEGIN { pspec=""; spec=""; outside=1 } +$1=="*"directive":" { pspec=spec; spec=""; outside=0; next } + outside || NF==0 || ( substr($1,1,1)=="*" && substr($1,length($1),1)==":" ) { outside=1; next } + spec=="" && substr($0,1,1)=="+" { spec=pspec " " substr($0,2); next } + { spec=spec $0 } +END { print spec }' + return 0 +} + +# Return the requested gcc specs directive, with all included +# specs expanded. +# Note, it does not check for inclusion loops, which cause it +# to never finish - but such loops are invalid for gcc and we're +# assuming gcc is operational. +gcc-specs-directive() { + local directive subdname subdirective + directive="$(_gcc-specs-directive_raw $1)" + while [[ ${directive} == *%\(*\)* ]]; do + subdname=${directive/*%\(} + subdname=${subdname/\)*} + subdirective="$(_gcc-specs-directive_raw ${subdname})" + directive="${directive//\%(${subdname})/${subdirective}}" + done + echo "${directive}" + return 0 +} + +# Returns true if gcc sets relro +gcc-specs-relro() { + local directive + directive=$(gcc-specs-directive link_command) + return $([[ "${directive/\{!norelro:}" != "${directive}" ]]) +} +# Returns true if gcc sets now +gcc-specs-now() { + local directive + directive=$(gcc-specs-directive link_command) + return $([[ "${directive/\{!nonow:}" != "${directive}" ]]) +} +# Returns true if gcc builds PIEs +gcc-specs-pie() { + local directive + directive=$(gcc-specs-directive cc1) + return $([[ "${directive/\{!nopie:}" != "${directive}" ]]) +} +# Returns true if gcc builds with the stack protector +gcc-specs-ssp() { + local directive + directive=$(gcc-specs-directive cc1) + return $([[ "${directive/\{!fno-stack-protector:}" != "${directive}" ]]) +} +# Returns true if gcc upgrades fstack-protector to fstack-protector-all +gcc-specs-ssp-to-all() { + local directive + directive=$(gcc-specs-directive cc1) + return $([[ "${directive/\{!fno-stack-protector-all:}" != "${directive}" ]]) +} +# Returns true if gcc builds with fno-strict-overflow +gcc-specs-nostrict() { + local directive + directive=$(gcc-specs-directive cc1) + return $([[ "${directive/\{!fstrict-overflow:}" != "${directive}" ]]) +} + + +# @FUNCTION: gen_usr_ldscript +# @USAGE: [-a] +# @DESCRIPTION: +# This function generate linker scripts in /usr/lib for dynamic +# libs in /lib. This is to fix linking problems when you have +# the .so in /lib, and the .a in /usr/lib. What happens is that +# in some cases when linking dynamic, the .a in /usr/lib is used +# instead of the .so in /lib due to gcc/libtool tweaking ld's +# library search path. This causes many builds to fail. +# See bug #4411 for more info. +# +# Note that you should in general use the unversioned name of +# the library (libfoo.so), as ldconfig should usually update it +# correctly to point to the latest version of the library present. +gen_usr_ldscript() { + local lib libdir=$(get_libdir) output_format="" auto=false suffix=$(get_libname) + [[ -z ${ED+set} ]] && local ED=${D%/}${EPREFIX}/ + + tc-is-static-only && return + + # Just make sure it exists + dodir /usr/${libdir} + + if [[ $1 == "-a" ]] ; then + auto=true + shift + dodir /${libdir} + fi + + # OUTPUT_FORMAT gives hints to the linker as to what binary format + # is referenced ... makes multilib saner + output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p') + [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )" + + for lib in "$@" ; do + local tlib + if ${auto} ; then + lib="lib${lib}${suffix}" + else + # Ensure /lib/${lib} exists to avoid dangling scripts/symlinks. + # This especially is for AIX where $(get_libname) can return ".a", + # so /lib/${lib} might be moved to /usr/lib/${lib} (by accident). + [[ -r ${ED}/${libdir}/${lib} ]] || continue + #TODO: better die here? + fi + + case ${CTARGET:-${CHOST}} in + *-darwin*) + if ${auto} ; then + tlib=$(scanmacho -qF'%S#F' "${ED}"/usr/${libdir}/${lib}) + else + tlib=$(scanmacho -qF'%S#F' "${ED}"/${libdir}/${lib}) + fi + [[ -z ${tlib} ]] && die "unable to read install_name from ${lib}" + tlib=${tlib##*/} + + if ${auto} ; then + mv "${ED}"/usr/${libdir}/${lib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die + # some install_names are funky: they encode a version + if [[ ${tlib} != ${lib%${suffix}}.*${suffix#.} ]] ; then + mv "${ED}"/usr/${libdir}/${tlib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die + fi + rm -f "${ED}"/${libdir}/${lib} + fi + + # Mach-O files have an id, which is like a soname, it tells how + # another object linking against this lib should reference it. + # Since we moved the lib from usr/lib into lib this reference is + # wrong. Hence, we update it here. We don't configure with + # libdir=/lib because that messes up libtool files. + # Make sure we don't lose the specific version, so just modify the + # existing install_name + if [[ ! -w "${ED}/${libdir}/${tlib}" ]] ; then + chmod u+w "${ED}${libdir}/${tlib}" # needed to write to it + local nowrite=yes + fi + install_name_tool \ + -id "${EPREFIX}"/${libdir}/${tlib} \ + "${ED}"/${libdir}/${tlib} || die "install_name_tool failed" + [[ -n ${nowrite} ]] && chmod u-w "${ED}${libdir}/${tlib}" + # Now as we don't use GNU binutils and our linker doesn't + # understand linker scripts, just create a symlink. + pushd "${ED}/usr/${libdir}" > /dev/null + ln -snf "../../${libdir}/${tlib}" "${lib}" + popd > /dev/null + ;; + *-aix*|*-irix*|*64*-hpux*|*-interix*|*-winnt*) + if ${auto} ; then + mv "${ED}"/usr/${libdir}/${lib}* "${ED}"/${libdir}/ || die + # no way to retrieve soname on these platforms (?) + tlib=$(readlink "${ED}"/${libdir}/${lib}) + tlib=${tlib##*/} + if [[ -z ${tlib} ]] ; then + # ok, apparently was not a symlink, don't remove it and + # just link to it + tlib=${lib} + else + rm -f "${ED}"/${libdir}/${lib} + fi + else + tlib=${lib} + fi + + # we don't have GNU binutils on these platforms, so we symlink + # instead, which seems to work fine. Keep it relative, otherwise + # we break some QA checks in Portage + # on interix, the linker scripts would work fine in _most_ + # situations. if a library links to such a linker script the + # absolute path to the correct library is inserted into the binary, + # which is wrong, since anybody linking _without_ libtool will miss + # some dependencies, since the stupid linker cannot find libraries + # hardcoded with absolute paths (as opposed to the loader, which + # seems to be able to do this). + # this has been seen while building shared-mime-info which needs + # libxml2, but links without libtool (and does not add libz to the + # command line by itself). + pushd "${ED}/usr/${libdir}" > /dev/null + ln -snf "../../${libdir}/${tlib}" "${lib}" + popd > /dev/null + ;; + hppa*-hpux*) # PA-RISC 32bit (SOM) only, others (ELF) match *64*-hpux* above. + if ${auto} ; then + tlib=$(chatr "${ED}"/usr/${libdir}/${lib} | sed -n '/internal name:/{n;s/^ *//;p;q}') + [[ -z ${tlib} ]] && tlib=${lib} + tlib=${tlib##*/} # 'internal name' can have a path component + mv "${ED}"/usr/${libdir}/${lib}* "${ED}"/${libdir}/ || die + # some SONAMEs are funky: they encode a version before the .so + if [[ ${tlib} != ${lib}* ]] ; then + mv "${ED}"/usr/${libdir}/${tlib}* "${ED}"/${libdir}/ || die + fi + [[ ${tlib} != ${lib} ]] && + rm -f "${ED}"/${libdir}/${lib} + else + tlib=$(chatr "${ED}"/${libdir}/${lib} | sed -n '/internal name:/{n;s/^ *//;p;q}') + [[ -z ${tlib} ]] && tlib=${lib} + tlib=${tlib##*/} # 'internal name' can have a path component + fi + pushd "${ED}"/usr/${libdir} >/dev/null + ln -snf "../../${libdir}/${tlib}" "${lib}" + # need the internal name in usr/lib too, to be available at runtime + # when linked with /path/to/lib.sl (hardcode_direct_absolute=yes) + [[ ${tlib} != ${lib} ]] && + ln -snf "../../${libdir}/${tlib}" "${tlib}" + popd >/dev/null + ;; + *) + if ${auto} ; then + tlib=$(scanelf -qF'%S#F' "${ED}"/usr/${libdir}/${lib}) + [[ -z ${tlib} ]] && die "unable to read SONAME from ${lib}" + mv "${ED}"/usr/${libdir}/${lib}* "${ED}"/${libdir}/ || die + # some SONAMEs are funky: they encode a version before the .so + if [[ ${tlib} != ${lib}* ]] ; then + mv "${ED}"/usr/${libdir}/${tlib}* "${ED}"/${libdir}/ || die + fi + rm -f "${ED}"/${libdir}/${lib} + else + tlib=${lib} + fi + cat > "${ED}/usr/${libdir}/${lib}" <<-END_LDSCRIPT + /* GNU ld script + Since Gentoo has critical dynamic libraries in /lib, and the static versions + in /usr/lib, we need to have a "fake" dynamic lib in /usr/lib, otherwise we + run into linking problems. This "fake" dynamic lib is a linker script that + redirects the linker to the real lib. And yes, this works in the cross- + compiling scenario as the sysroot-ed linker will prepend the real path. + + See bug http://bugs.gentoo.org/4411 for more info. + */ + ${output_format} + GROUP ( ${EPREFIX}/${libdir}/${tlib} ) + END_LDSCRIPT + ;; + esac + fperms a+x "/usr/${libdir}/${lib}" || die "could not change perms on ${lib}" + done +} + +fi diff --git a/sdk_container/src/third_party/portage-stable/eclass/toolchain.eclass b/sdk_container/src/third_party/portage-stable/eclass/toolchain.eclass new file mode 100644 index 0000000000..5d24497397 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/toolchain.eclass @@ -0,0 +1,2584 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v 1.420 2010/03/07 04:37:01 vapier Exp $ +# +# Maintainer: Toolchain Ninjas + +HOMEPAGE="http://gcc.gnu.org/" +LICENSE="GPL-2 LGPL-2.1" +RESTRICT="strip" # cross-compilers need controlled stripping + +#---->> eclass stuff <<---- +inherit eutils versionator libtool toolchain-funcs flag-o-matic gnuconfig multilib fixheadtails + +EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_test pkg_preinst src_install pkg_postinst pkg_prerm pkg_postrm +DESCRIPTION="Based on the ${ECLASS} eclass" + +FEATURES=${FEATURES/multilib-strict/} + +toolchain_pkg_setup() { + gcc_pkg_setup +} +toolchain_src_unpack() { + gcc_src_unpack +} +toolchain_src_compile() { + gcc_src_compile +} +toolchain_src_test() { + gcc_src_test +} +toolchain_pkg_preinst() { + ${ETYPE}_pkg_preinst +} +toolchain_src_install() { + ${ETYPE}_src_install +} +toolchain_pkg_postinst() { + ${ETYPE}_pkg_postinst +} +toolchain_pkg_prerm() { + ${ETYPE}_pkg_prerm +} +toolchain_pkg_postrm() { + ${ETYPE}_pkg_postrm +} +#----<< eclass stuff >>---- + + +#---->> globals <<---- +export CTARGET=${CTARGET:-${CHOST}} +if [[ ${CTARGET} = ${CHOST} ]] ; then + if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then + export CTARGET=${CATEGORY/cross-} + fi +fi +is_crosscompile() { + [[ ${CHOST} != ${CTARGET} ]] +} + +tc_version_is_at_least() { version_is_at_least "$1" "${2:-${GCC_PV}}" ; } + + +GCC_PV=${TOOLCHAIN_GCC_PV:-${PV}} +GCC_PVR=${GCC_PV} +[[ ${PR} != "r0" ]] && GCC_PVR=${GCC_PVR}-${PR} +GCC_RELEASE_VER=$(get_version_component_range 1-3 ${GCC_PV}) +GCC_BRANCH_VER=$(get_version_component_range 1-2 ${GCC_PV}) +GCCMAJOR=$(get_version_component_range 1 ${GCC_PV}) +GCCMINOR=$(get_version_component_range 2 ${GCC_PV}) +GCCMICRO=$(get_version_component_range 3 ${GCC_PV}) +[[ ${BRANCH_UPDATE-notset} == "notset" ]] && BRANCH_UPDATE=$(get_version_component_range 4 ${GCC_PV}) + +# According to gcc/c-cppbuiltin.c, GCC_CONFIG_VER MUST match this regex. +# ([^0-9]*-)?[0-9]+[.][0-9]+([.][0-9]+)?([- ].*)? +GCC_CONFIG_VER=${GCC_CONFIG_VER:-$(replace_version_separator 3 '-' ${GCC_PV})} + +# Pre-release support +if [[ ${GCC_PV} != ${GCC_PV/_pre/-} ]] ; then + PRERELEASE=${GCC_PV/_pre/-} +fi +# make _alpha and _beta ebuilds automatically use a snapshot +if [[ ${GCC_PV} == *_alpha* ]] ; then + SNAPSHOT=${GCC_BRANCH_VER}-${GCC_PV##*_alpha} +elif [[ ${GCC_PV} == *_beta* ]] ; then + SNAPSHOT=${GCC_BRANCH_VER}-${GCC_PV##*_beta} +elif [[ ${GCC_PV} == *_rc* ]] ; then + SNAPSHOT=${GCC_PV%_rc*}-RC-${GCC_PV##*_rc} +fi +export GCC_FILESDIR=${GCC_FILESDIR:-${FILESDIR}} + +if [[ ${ETYPE} == "gcc-library" ]] ; then + GCC_VAR_TYPE=${GCC_VAR_TYPE:-non-versioned} + GCC_LIB_COMPAT_ONLY=${GCC_LIB_COMPAT_ONLY:-true} + GCC_TARGET_NO_MULTILIB=${GCC_TARGET_NO_MULTILIB:-true} +else + GCC_VAR_TYPE=${GCC_VAR_TYPE:-versioned} + GCC_LIB_COMPAT_ONLY="false" + GCC_TARGET_NO_MULTILIB=${GCC_TARGET_NO_MULTILIB:-false} +fi + +PREFIX=${TOOLCHAIN_PREFIX:-/usr} + +if [[ ${GCC_VAR_TYPE} == "versioned" ]] ; then + if tc_version_is_at_least 3.4.0 ; then + LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/lib/gcc/${CTARGET}/${GCC_CONFIG_VER}} + else + LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/lib/gcc-lib/${CTARGET}/${GCC_CONFIG_VER}} + fi + INCLUDEPATH=${TOOLCHAIN_INCLUDEPATH:-${LIBPATH}/include} + if is_crosscompile ; then + BINPATH=${TOOLCHAIN_BINPATH:-${PREFIX}/${CHOST}/${CTARGET}/gcc-bin/${GCC_CONFIG_VER}} + else + BINPATH=${TOOLCHAIN_BINPATH:-${PREFIX}/${CTARGET}/gcc-bin/${GCC_CONFIG_VER}} + fi + DATAPATH=${TOOLCHAIN_DATAPATH:-${PREFIX}/share/gcc-data/${CTARGET}/${GCC_CONFIG_VER}} + # Dont install in /usr/include/g++-v3/, but in gcc internal directory. + # We will handle /usr/include/g++-v3/ with gcc-config ... + STDCXX_INCDIR=${TOOLCHAIN_STDCXX_INCDIR:-${LIBPATH}/include/g++-v${GCC_BRANCH_VER/\.*/}} +elif [[ ${GCC_VAR_TYPE} == "non-versioned" ]] ; then + # using non-versioned directories to install gcc, like what is currently + # done for ppc64 and 3.3.3_pre, is a BAD IDEA. DO NOT do it!! However... + # setting up variables for non-versioned directories might be useful for + # specific gcc targets, like libffi. Note that we dont override the value + # returned by get_libdir here. + LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/$(get_libdir)} + INCLUDEPATH=${TOOLCHAIN_INCLUDEPATH:-${PREFIX}/include} + BINPATH=${TOOLCHAIN_BINPATH:-${PREFIX}/bin} + DATAPATH=${TOOLCHAIN_DATAPATH:-${PREFIX}/share} + STDCXX_INCDIR=${TOOLCHAIN_STDCXX_INCDIR:-${PREFIX}/include/g++-v3} +fi + +#----<< globals >>---- + + +#---->> SLOT+IUSE logic <<---- +if [[ ${ETYPE} == "gcc-library" ]] ; then + IUSE="nls build test" + SLOT="${CTARGET}-${SO_VERSION_SLOT:-5}" +else + IUSE="multislot nptl test" + + if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then + IUSE="${IUSE} altivec build fortran nls nocxx" + [[ -n ${PIE_VER} ]] && IUSE="${IUSE} nopie" + [[ -n ${PP_VER} ]] && IUSE="${IUSE} nossp" + [[ -n ${HTB_VER} ]] && IUSE="${IUSE} boundschecking" + [[ -n ${D_VER} ]] && IUSE="${IUSE} d" + + if tc_version_is_at_least 3 ; then + IUSE="${IUSE} bootstrap doc gcj gtk hardened libffi multilib objc vanilla" + + # gcc-{nios2,bfin} don't accept these + if [[ ${PN} == "gcc" ]] ; then + IUSE="${IUSE} n32 n64" + fi + + tc_version_is_at_least "4.0" && IUSE="${IUSE} objc-gc mudflap" + tc_version_is_at_least "4.1" && IUSE="${IUSE} objc++" + tc_version_is_at_least "4.2" && IUSE="${IUSE} openmp" + tc_version_is_at_least "4.3" && IUSE="${IUSE} fixed-point" + tc_version_is_at_least "4.4" && IUSE="${IUSE} graphite" + fi + fi + + # Support upgrade paths here or people get pissed + if use multislot ; then + SLOT="${CTARGET}-${GCC_CONFIG_VER}" + elif is_crosscompile; then + SLOT="${CTARGET}-${GCC_BRANCH_VER}" + else + SLOT="${GCC_BRANCH_VER}" + fi +fi +#----<< SLOT+IUSE logic >>---- + + +#---->> S + SRC_URI essentials <<---- + +# This function sets the source directory depending on whether we're using +# a prerelease, snapshot, or release tarball. To use it, just set S with: +# +# S="$(gcc_get_s_dir)" +# +# Travis Tilley (03 Sep 2004) +# +gcc_get_s_dir() { + local GCC_S + if [[ -n ${PRERELEASE} ]] ; then + GCC_S=${WORKDIR}/gcc-${PRERELEASE} + elif [[ -n ${SNAPSHOT} ]] ; then + GCC_S=${WORKDIR}/gcc-${SNAPSHOT} + else + GCC_S=${WORKDIR}/gcc-${GCC_RELEASE_VER} + fi + echo "${GCC_S}" +} + +# This function handles the basics of setting the SRC_URI for a gcc ebuild. +# To use, set SRC_URI with: +# +# SRC_URI="$(get_gcc_src_uri)" +# +# Other than the variables normally set by portage, this function's behavior +# can be altered by setting the following: +# +# SNAPSHOT +# If set, this variable signals that we should be using a snapshot +# of gcc from ftp://sources.redhat.com/pub/gcc/snapshots/. It is +# expected to be in the format "YYYY-MM-DD". Note that if the ebuild +# has a _pre suffix, this variable is ignored and the prerelease +# tarball is used instead. +# +# BRANCH_UPDATE +# If set, this variable signals that we should be using the main +# release tarball (determined by ebuild version) and applying a +# CVS branch update patch against it. The location of this branch +# update patch is assumed to be in ${GENTOO_TOOLCHAIN_BASE_URI}. +# Just like with SNAPSHOT, this variable is ignored if the ebuild +# has a _pre suffix. +# +# PATCH_VER +# PATCH_GCC_VER +# This should be set to the version of the gentoo patch tarball. +# The resulting filename of this tarball will be: +# gcc-${PATCH_GCC_VER:-${GCC_RELEASE_VER}}-patches-${PATCH_VER}.tar.bz2 +# +# PIE_VER +# PIE_GCC_VER +# obsoleted: PIE_CORE +# These variables control patching in various updates for the logic +# controlling Position Independant Executables. PIE_VER is expected +# to be the version of this patch, PIE_GCC_VER the gcc version of +# the patch, and PIE_CORE (obsoleted) the actual filename of the patch. +# An example: +# PIE_VER="8.7.6.5" +# PIE_GCC_VER="3.4.0" +# The resulting filename of this tarball will be: +# gcc-${PIE_GCC_VER:-${GCC_RELEASE_VER}}-piepatches-v${PIE_VER}.tar.bz2 +# old syntax (do not define PIE_CORE anymore): +# PIE_CORE="gcc-3.4.0-piepatches-v${PIE_VER}.tar.bz2" +# +# SPECS_VER +# SPECS_GCC_VER +# This is for the minispecs files included in the hardened gcc-4.x +# +# PP_VER +# PP_GCC_VER +# obsoleted: PP_FVER +# These variables control patching in stack smashing protection +# support. They both control the version of ProPolice to download. +# +# PP_VER / PP_GCC_VER +# Used to roll our own custom tarballs of ssp. +# PP_FVER / PP_VER +# Used for mirroring ssp straight from IBM. +# PP_VER sets the version of the directory in which to find the +# patch, and PP_FVER sets the version of the patch itself. For +# example: +# PP_VER="3_4" +# PP_FVER="${PP_VER//_/.}-2" +# would download gcc3_4/protector-3.4-2.tar.gz +# +# HTB_VER +# HTB_GCC_VER +# These variables control whether or not an ebuild supports Herman +# ten Brugge's bounds-checking patches. If you want to use a patch +# for an older gcc version with a new gcc, make sure you set +# HTB_GCC_VER to that version of gcc. +# +# MAN_VER +# The version of gcc for which we will download manpages. This will +# default to ${GCC_RELEASE_VER}, but we may not want to pre-generate man pages +# for prerelease test ebuilds for example. This allows you to +# continue using pre-generated manpages from the last stable release. +# If set to "none", this will prevent the downloading of manpages, +# which is useful for individual library targets. +# +gentoo_urls() { + local devspace="HTTP~lv/GCC/URI HTTP~eradicator/gcc/URI HTTP~vapier/dist/URI + HTTP~halcy0n/patches/URI" + devspace=${devspace//HTTP/http:\/\/dev.gentoo.org\/} + echo mirror://gentoo/$1 ${devspace//URI/$1} +} +get_gcc_src_uri() { + export PATCH_GCC_VER=${PATCH_GCC_VER:-${GCC_RELEASE_VER}} + export UCLIBC_GCC_VER=${UCLIBC_GCC_VER:-${PATCH_GCC_VER}} + export PIE_GCC_VER=${PIE_GCC_VER:-${GCC_RELEASE_VER}} + export PP_GCC_VER=${PP_GCC_VER:-${GCC_RELEASE_VER}} + export HTB_GCC_VER=${HTB_GCC_VER:-${GCC_RELEASE_VER}} + export SPECS_GCC_VER=${SPECS_GCC_VER:-${GCC_RELEASE_VER}} + + [[ -n ${PIE_VER} ]] && \ + PIE_CORE=${PIE_CORE:-gcc-${PIE_GCC_VER}-piepatches-v${PIE_VER}.tar.bz2} + + # Set where to download gcc itself depending on whether we're using a + # prerelease, snapshot, or release tarball. + if [[ -n ${PRERELEASE} ]] ; then + GCC_SRC_URI="ftp://gcc.gnu.org/pub/gcc/prerelease-${PRERELEASE}/gcc-${PRERELEASE}.tar.bz2" + elif [[ -n ${SNAPSHOT} ]] ; then + GCC_SRC_URI="ftp://sources.redhat.com/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT}.tar.bz2" + else + GCC_SRC_URI="mirror://gnu/gcc/gcc-${GCC_PV}/gcc-${GCC_RELEASE_VER}.tar.bz2" + # we want all branch updates to be against the main release + [[ -n ${BRANCH_UPDATE} ]] && \ + GCC_SRC_URI="${GCC_SRC_URI} $(gentoo_urls gcc-${GCC_RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2)" + fi + + # propolice aka stack smashing protection + if [[ -n ${PP_VER} ]] ; then + if [[ -n ${PP_FVER} ]] ; then + GCC_SRC_URI="${GCC_SRC_URI} + !nossp? ( + http://www.research.ibm.com/trl/projects/security/ssp/gcc${PP_VER}/protector-${PP_FVER}.tar.gz + $(gentoo_urls protector-${PP_FVER}.tar.gz) + )" + else + GCC_SRC_URI="${GCC_SRC_URI} $(gentoo_urls gcc-${PP_GCC_VER}-ssp-${PP_VER}.tar.bz2)" + fi + fi + + # uclibc lovin + [[ -n ${UCLIBC_VER} ]] && \ + GCC_SRC_URI="${GCC_SRC_URI} $(gentoo_urls gcc-${UCLIBC_GCC_VER}-uclibc-patches-${UCLIBC_VER}.tar.bz2)" + + # PERL cannot be present at bootstrap, and is used to build the man pages. + # So... lets include some pre-generated ones, shall we? + [[ -n ${MAN_VER} ]] && \ + GCC_SRC_URI="${GCC_SRC_URI} $(gentoo_urls gcc-${MAN_VER}-manpages.tar.bz2)" + + # various gentoo patches + [[ -n ${PATCH_VER} ]] && \ + GCC_SRC_URI="${GCC_SRC_URI} $(gentoo_urls gcc-${PATCH_GCC_VER}-patches-${PATCH_VER}.tar.bz2)" + + # strawberry pie, Cappuccino and a Gauloises (it's a good thing) + [[ -n ${PIE_VER} ]] && \ + GCC_SRC_URI="${GCC_SRC_URI} !nopie? ( $(gentoo_urls ${PIE_CORE}) )" + + # gcc minispec for the hardened gcc 4 compiler + [[ -n ${SPECS_VER} ]] && \ + GCC_SRC_URI="${GCC_SRC_URI} !nopie? ( $(gentoo_urls gcc-${SPECS_GCC_VER}-specs-${SPECS_VER}.tar.bz2) )" + + # gcc bounds checking patch + if [[ -n ${HTB_VER} ]] ; then + local HTBFILE="bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch.bz2" + GCC_SRC_URI="${GCC_SRC_URI} + boundschecking? ( + mirror://sourceforge/boundschecking/${HTBFILE} + $(gentoo_urls ${HTBFILE}) + )" + fi + + # support for the D language + [[ -n ${D_VER} ]] && \ + GCC_SRC_URI="${GCC_SRC_URI} d? ( mirror://sourceforge/dgcc/gdc-${D_VER}-src.tar.bz2 )" + + # >= gcc-4.3 uses ecj.jar and we only add gcj as a use flag under certain + # conditions + if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then + tc_version_is_at_least "4.3" && \ + GCC_SRC_URI="${GCC_SRC_URI} + gcj? ( ftp://sourceware.org/pub/java/ecj-4.3.jar )" + fi + + echo "${GCC_SRC_URI}" +} +S=$(gcc_get_s_dir) +SRC_URI=$(get_gcc_src_uri) +#---->> S + SRC_URI essentials >>---- + + +#---->> support checks <<---- + +# Grab a variable from the build system (taken from linux-info.eclass) +get_make_var() { + local var=$1 makefile=${2:-${WORKDIR}/build/Makefile} + echo -e "e:\\n\\t@echo \$(${var})\\ninclude ${makefile}" | \ + r=${makefile%/*} emake --no-print-directory -s -f - 2>/dev/null +} +XGCC() { get_make_var GCC_FOR_TARGET ; } + +# The gentoo piessp patches allow for 3 configurations: +# 1) PIE+SSP by default +# 2) PIE by default +# 3) SSP by default +hardened_gcc_works() { + if [[ $1 == "pie" ]] ; then + # $gcc_cv_ld_pie is unreliable as it simply take the output of + # `ld --help | grep -- -pie`, that reports the option in all cases, also if + # the loader doesn't actually load the resulting executables. + # To avoid breakage, blacklist FreeBSD here at least + [[ ${CTARGET} == *-freebsd* ]] && return 1 + + want_pie || return 1 + hardened_gcc_is_stable pie && return 0 + if has "~$(tc-arch)" ${ACCEPT_KEYWORDS} ; then + hardened_gcc_check_unsupported pie && return 1 + ewarn "Allowing pie-by-default for an unstable arch ($(tc-arch))" + return 0 + fi + return 1 + elif [[ $1 == "ssp" ]] ; then + [[ -z ${PP_VER} ]] && return 1 + hardened_gcc_is_stable ssp && return 0 + if has "~$(tc-arch)" ${ACCEPT_KEYWORDS} ; then + hardened_gcc_check_unsupported ssp && return 1 + ewarn "Allowing ssp-by-default for an unstable arch ($(tc-arch))" + return 0 + fi + return 1 + else + # laziness ;) + hardened_gcc_works pie || return 1 + hardened_gcc_works ssp || return 1 + return 0 + fi +} + +hardened_gcc_is_stable() { + if [[ $1 == "pie" ]] ; then + # HARDENED_* variables are deprecated and here for compatibility + local tocheck="${HARDENED_PIE_WORKS} ${HARDENED_GCC_WORKS}" + if [[ ${CTARGET} == *-uclibc* ]] ; then + tocheck="${tocheck} ${PIE_UCLIBC_STABLE}" + else + tocheck="${tocheck} ${PIE_GLIBC_STABLE}" + fi + elif [[ $1 == "ssp" ]] ; then + # ditto + local tocheck="${HARDENED_SSP_WORKS} ${HARDENED_GCC_WORKS}" + if [[ ${CTARGET} == *-uclibc* ]] ; then + tocheck="${tocheck} ${SSP_UCLIBC_STABLE}" + else + tocheck="${tocheck} ${SSP_STABLE}" + fi + else + die "hardened_gcc_stable needs to be called with pie or ssp" + fi + + hasq $(tc-arch) ${tocheck} && return 0 + return 1 +} + +hardened_gcc_check_unsupported() { + local tocheck="" + # if a variable is unset, we assume that all archs are unsupported. since + # this function is never called if hardened_gcc_is_stable returns true, + # this shouldn't cause problems... however, allowing this logic to work + # even with the variables unset will break older ebuilds that dont use them. + if [[ $1 == "pie" ]] ; then + if [[ ${CTARGET} == *-uclibc* ]] ; then + [[ -z ${PIE_UCLIBC_UNSUPPORTED} ]] && return 0 + tocheck="${tocheck} ${PIE_UCLIBC_UNSUPPORTED}" + else + [[ -z ${PIE_GLIBC_UNSUPPORTED} ]] && return 0 + tocheck="${tocheck} ${PIE_GLIBC_UNSUPPORTED}" + fi + elif [[ $1 == "ssp" ]] ; then + if [[ ${CTARGET} == *-uclibc* ]] ; then + [[ -z ${SSP_UCLIBC_UNSUPPORTED} ]] && return 0 + tocheck="${tocheck} ${SSP_UCLIBC_UNSUPPORTED}" + else + [[ -z ${SSP_UNSUPPORTED} ]] && return 0 + tocheck="${tocheck} ${SSP_UNSUPPORTED}" + fi + else + die "hardened_gcc_check_unsupported needs to be called with pie or ssp" + fi + + hasq $(tc-arch) ${tocheck} && return 0 + return 1 +} + +has_libssp() { + [[ -e /$(get_libdir)/libssp.so ]] && return 0 + return 1 +} + +want_libssp() { + [[ ${GCC_LIBSSP_SUPPORT} == "true" ]] || return 1 + has_libssp || return 1 + [[ -n ${PP_VER} ]] || return 1 + return 0 +} + +_want_stuff() { + local var=$1 flag=$2 + [[ -z ${!var} ]] && return 1 + use ${flag} && return 0 + return 1 +} +want_boundschecking() { _want_stuff HTB_VER boundschecking ; } +want_pie() { _want_stuff PIE_VER !nopie ; } +want_ssp() { _want_stuff PP_VER !nossp ; } + +want_split_specs() { + [[ ${SPLIT_SPECS} == "true" ]] && want_pie +} +want_minispecs() { + if tc_version_is_at_least 4.3.2 && use hardened ; then + if [[ -n ${SPECS_VER} ]] ; then + return 0 + else + die "For Hardened to work you need the minispecs files" + fi + fi + return 1 +} +# This function checks whether or not glibc has the support required to build +# Position Independant Executables with gcc. +glibc_have_pie() { + if [[ ! -f ${ROOT}/usr/$(get_libdir)/Scrt1.o ]] ; then + echo + ewarn "Your glibc does not have support for pie, the file Scrt1.o is missing" + ewarn "Please update your glibc to a proper version or disable hardened" + echo + return 1 + fi +} + +# This function determines whether or not libc has been patched with stack +# smashing protection support. +libc_has_ssp() { + [[ ${ROOT} != "/" ]] && return 0 + + # lib hacks taken from sandbox configure + echo 'int main(){}' > "${T}"/libctest.c + LC_ALL=C gcc "${T}"/libctest.c -lc -o libctest -Wl,-verbose &> "${T}"/libctest.log || return 1 + local libc_file=$(awk '/attempt to open/ { if (($4 ~ /\/libc\.so/) && ($5 == "succeeded")) LIBC = $4; }; END {print LIBC}' "${T}"/libctest.log) + + [[ -z ${libc_file} ]] && die "Unable to find a libc !?" + + # Check for gcc-4.x style ssp support + if [[ -n $(readelf -s "${libc_file}" 2>/dev/null | \ + grep 'FUNC.*GLOBAL.*__stack_chk_fail') ]] + then + return 0 + else + # Check for gcc-3.x style ssp support + if [[ -n $(readelf -s "${libc_file}" 2>/dev/null | \ + grep 'OBJECT.*GLOBAL.*__guard') ]] && \ + [[ -n $(readelf -s "${libc_file}" 2>/dev/null | \ + grep 'FUNC.*GLOBAL.*__stack_smash_handler') ]] + then + return 0 + elif is_crosscompile ; then + die "'${libc_file}' was detected w/out ssp, that sucks (a lot)" + else + return 1 + fi + fi +} + +# This is to make sure we don't accidentally try to enable support for a +# language that doesnt exist. GCC 3.4 supports f77, while 4.0 supports f95, etc. +# +# Also add a hook so special ebuilds (kgcc64) can control which languages +# exactly get enabled +gcc-lang-supported() { + grep ^language=\"${1}\" "${S}"/gcc/*/config-lang.in > /dev/null || return 1 + [[ -z ${TOOLCHAIN_ALLOWED_LANGS} ]] && return 0 + has $1 ${TOOLCHAIN_ALLOWED_LANGS} +} + +#----<< support checks >>---- + +#---->> specs + env.d logic <<---- + +# defaults to enable for all hardened toolchains +gcc_common_hard="-DEFAULT_RELRO -DEFAULT_BIND_NOW" + +# configure to build with the hardened GCC specs as the default +make_gcc_hard() { + if hardened_gcc_works ; then + einfo "Updating gcc to use automatic PIE + SSP building ..." + sed -e "s|^HARD_CFLAGS = |HARD_CFLAGS = -DEFAULT_PIE_SSP ${gcc_common_hard} |" \ + -i "${S}"/gcc/Makefile.in || die "Failed to update gcc!" + elif hardened_gcc_works pie ; then + einfo "Updating gcc to use automatic PIE building ..." + ewarn "SSP has not been enabled by default" + sed -e "s|^HARD_CFLAGS = |HARD_CFLAGS = -DEFAULT_PIE ${gcc_common_hard} |" \ + -i "${S}"/gcc/Makefile.in || die "Failed to update gcc!" + elif hardened_gcc_works ssp ; then + einfo "Updating gcc to use automatic SSP building ..." + ewarn "PIE has not been enabled by default" + sed -e "s|^HARD_CFLAGS = |HARD_CFLAGS = -DEFAULT_SSP ${gcc_common_hard} |" \ + -i "${S}"/gcc/Makefile.in || die "Failed to update gcc!" + else + # do nothing if hardened isnt supported, but dont die either + ewarn "hardened is not supported for this arch in this gcc version" + ebeep + return 0 + fi + + # rebrand to make bug reports easier + BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened} +} + +# now we generate different spec files so that the user can select a compiler +# that enforces certain features in gcc itself and so we don't have to worry +# about a certain package ignoring CFLAGS/LDFLAGS +_create_specs_file() { + # Usage: _create_specs_file + local uflag=$1 name=$2 flags=${*:3} + ebegin "Creating a ${name} gcc specs file" + pushd "${WORKDIR}"/build/gcc > /dev/null + if [[ -z ${uflag} ]] || use ${uflag} ; then + # backup the compiler first + cp Makefile Makefile.orig + sed -i -e '/^HARD_CFLAGS/s:=.*:='"${flags}"':' Makefile + mv xgcc xgcc.foo + mv gcc.o gcc.o.foo + emake -s xgcc + $(XGCC) -dumpspecs > "${WORKDIR}"/build/${name}.specs + # restore everything to normal + mv gcc.o.foo gcc.o + mv xgcc.foo xgcc + mv Makefile.orig Makefile + else + $(XGCC) -dumpspecs > "${WORKDIR}"/build/${name}.specs + fi + popd > /dev/null + eend $([[ -s ${WORKDIR}/build/${name}.specs ]] ; echo $?) +} +create_vanilla_specs_file() { _create_specs_file hardened vanilla ; } +create_hardened_specs_file() { _create_specs_file !hardened hardened ${gcc_common_hard} -DEFAULT_PIE_SSP ; } +create_hardenednossp_specs_file() { _create_specs_file "" hardenednossp ${gcc_common_hard} -DEFAULT_PIE ; } +create_hardenednopie_specs_file() { _create_specs_file "" hardenednopie ${gcc_common_hard} -DEFAULT_SSP ; } +create_hardenednopiessp_specs_file() { _create_specs_file "" hardenednopiessp ${gcc_common_hard} ; } + +split_out_specs_files() { + local s spec_list="hardenednopiessp vanilla" + if hardened_gcc_works ; then + spec_list="${spec_list} hardened hardenednossp hardenednopie" + elif hardened_gcc_works pie ; then + spec_list="${spec_list} hardenednossp" + elif hardened_gcc_works ssp ; then + spec_list="${spec_list} hardenednopie" + fi + for s in ${spec_list} ; do + create_${s}_specs_file || return 1 + done +} + +create_gcc_env_entry() { + dodir /etc/env.d/gcc + local gcc_envd_base="/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}" + + if [[ -z $1 ]] ; then + gcc_envd_file="${D}${gcc_envd_base}" + # I'm leaving the following commented out to remind me that it + # was an insanely -bad- idea. Stuff broke. GCC_SPECS isnt unset + # on chroot or in non-toolchain.eclass gcc ebuilds! + #gcc_specs_file="${LIBPATH}/specs" + gcc_specs_file="" + else + gcc_envd_file="${D}${gcc_envd_base}-$1" + gcc_specs_file="${LIBPATH}/$1.specs" + fi + + # phase PATH/ROOTPATH out ... + echo "PATH=\"${BINPATH}\"" > ${gcc_envd_file} + echo "ROOTPATH=\"${BINPATH}\"" >> ${gcc_envd_file} + echo "GCC_PATH=\"${BINPATH}\"" >> ${gcc_envd_file} + + if use multilib && ! has_multilib_profile; then + LDPATH="${LIBPATH}" + for path in 32 64 ; do + [[ -d ${LIBPATH}/${path} ]] && LDPATH="${LDPATH}:${LIBPATH}/${path}" + done + else + local MULTIDIR + LDPATH="${LIBPATH}" + + # We want to list the default ABI's LIBPATH first so libtool + # searches that directory first. This is a temporary + # workaround for libtool being stupid and using .la's from + # conflicting ABIs by using the first one in the search path + + local abi=${DEFAULT_ABI} + local MULTIDIR=$($(XGCC) $(get_abi_CFLAGS ${abi}) --print-multi-directory) + if [[ ${MULTIDIR} == "." ]] ; then + LDPATH=${LIBPATH} + else + LDPATH=${LIBPATH}/${MULTIDIR} + fi + + for abi in $(get_all_abis) ; do + [[ ${abi} == ${DEFAULT_ABI} ]] && continue + + MULTIDIR=$($(XGCC) $(get_abi_CFLAGS ${abi}) --print-multi-directory) + if [[ ${MULTIDIR} == "." ]] ; then + LDPATH=${LDPATH}:${LIBPATH} + else + LDPATH=${LDPATH}:${LIBPATH}/${MULTIDIR} + fi + done + fi + + echo "LDPATH=\"${LDPATH}\"" >> ${gcc_envd_file} + echo "MANPATH=\"${DATAPATH}/man\"" >> ${gcc_envd_file} + echo "INFOPATH=\"${DATAPATH}/info\"" >> ${gcc_envd_file} + echo "STDCXX_INCDIR=\"${STDCXX_INCDIR##*/}\"" >> ${gcc_envd_file} + + is_crosscompile && echo "CTARGET=${CTARGET}" >> ${gcc_envd_file} + + # Set which specs file to use + [[ -n ${gcc_specs_file} ]] && echo "GCC_SPECS=\"${gcc_specs_file}\"" >> ${gcc_envd_file} +} +setup_minispecs_gcc_build_specs() { + # Setup the "build.specs" file for gcc to use when building. + if want_minispecs ; then + if hardened_gcc_works pie ; then + cat "${WORKDIR}"/specs/pie.specs >> "${WORKDIR}"/build.specs + fi + for s in nostrict znow; do + cat "${WORKDIR}"/specs/${s}.specs >> "${WORKDIR}"/build.specs + done + export GCC_SPECS="${WORKDIR}"/build.specs + fi +} +copy_minispecs_gcc_specs() { + # Build system specs file which, if it exists, must be a complete set of + # specs as it completely and unconditionally overrides the builtin specs. + # For gcc 4 + if use hardened && want_minispecs ; then + $(XGCC) -dumpspecs > "${WORKDIR}"/specs/specs + cat "${WORKDIR}"/build.specs >> "${WORKDIR}"/specs/specs + insinto ${LIBPATH} + doins "${WORKDIR}"/specs/* || die "failed to install specs" + fi +} +add_profile_eselect_conf() { + local compiler_config_file=$1 + local abi=$2 + local specs=$3 + local gcc_specs_file + local var + + if [[ -z ${specs} ]] ; then + # I'm leaving the following commented out to remind me that it + # was an insanely -bad- idea. Stuff broke. GCC_SPECS isnt unset + # on chroot or in non-toolchain.eclass gcc ebuilds! + #gcc_specs_file="${LIBPATH}/specs" + gcc_specs_file="" + + if use hardened ; then + specs="hardened" + else + specs="vanilla" + fi + else + gcc_specs_file="${LIBPATH}/${specs}.specs" + fi + + echo >> ${compiler_config_file} + if ! is_multilib ; then + echo "[${specs}]" >> ${compiler_config_file} + echo " ctarget=${CTARGET}" >> ${compiler_config_file} + else + echo "[${abi}-${specs}]" >> ${compiler_config_file} + var="CTARGET_${abi}" + if [[ -n ${!var} ]] ; then + echo " ctarget=${!var}" >> ${compiler_config_file} + else + var="CHOST_${abi}" + if [[ -n ${!var} ]] ; then + echo " ctarget=${!var}" >> ${compiler_config_file} + else + echo " ctarget=${CTARGET}" >> ${compiler_config_file} + fi + fi + fi + + local MULTIDIR=$($(XGCC) $(get_abi_CFLAGS ${abi}) --print-multi-directory) + local LDPATH=${LIBPATH} + if [[ ${MULTIDIR} != "." ]] ; then + LDPATH="${LIBPATH}/${MULTIDIR}" + fi + + echo " ldpath=${LDPATH}" >> ${compiler_config_file} + + if [[ -n ${gcc_specs_file} ]] ; then + echo " specs=${gcc_specs_file}" >> ${compiler_config_file} + fi + + var="CFLAGS_${abi}" + if [[ -n ${!var} ]] ; then + echo " cflags=${!var}" >> ${compiler_config_file} + fi +} + +create_eselect_conf() { + local config_dir="/etc/eselect/compiler" + local compiler_config_file="${D}/${config_dir}/${CTARGET}-${GCC_CONFIG_VER}.conf" + local abi + + dodir ${config_dir} + + echo "[global]" > ${compiler_config_file} + echo " version=${CTARGET}-${GCC_CONFIG_VER}" >> ${compiler_config_file} + echo " binpath=${BINPATH}" >> ${compiler_config_file} + echo " manpath=${DATAPATH}/man" >> ${compiler_config_file} + echo " infopath=${DATAPATH}/info" >> ${compiler_config_file} + echo " alias_cc=gcc" >> ${compiler_config_file} + echo " stdcxx_incdir=${STDCXX_INCDIR##*/}" >> ${compiler_config_file} + echo " bin_prefix=${CTARGET}" >> ${compiler_config_file} + + # Per spyderous, it is best not to alias the fortran compilers + #if [[ -x "${D}/${BINPATH}/${CTARGET}-g77" ]] ; then + # echo " alias_gfortran=g77" >> ${compiler_config_file} + #elif [[ -x "${D}/${BINPATH}/${CTARGET}-gfortran" ]] ; then + # echo " alias_g77=gfortran" >> ${compiler_config_file} + #fi + + for abi in $(get_all_abis) ; do + add_profile_eselect_conf "${compiler_config_file}" "${abi}" + + if want_split_specs ; then + if use hardened ; then + add_profile_eselect_conf "${compiler_config_file}" "${abi}" vanilla + elif hardened_gcc_works ; then + add_profile_eselect_conf "${compiler_config_file}" "${abi}" hardened + fi + + if hardened_gcc_works || hardened_gcc_works pie ; then + add_profile_eselect_conf "${compiler_config_file}" "${abi}" hardenednossp + fi + + if hardened_gcc_works || hardened_gcc_works ssp ; then + add_profile_eselect_conf "${compiler_config_file}" "${abi}" hardenednopie + fi + + add_profile_eselect_conf "${compiler_config_file}" "${abi}" hardenednopiessp + fi + done +} + +#----<< specs + env.d logic >>---- + +#---->> pkg_* <<---- +gcc_pkg_setup() { + [[ -z ${ETYPE} ]] && die "Your ebuild needs to set the ETYPE variable" + + if [[ ( $(tc-arch) == "amd64" || $(tc-arch) == "ppc64" ) && ( ${LD_PRELOAD} == "/lib/libsandbox.so" || ${LD_PRELOAD} == "/usr/lib/libsandbox.so" ) ]] && is_multilib ; then + eerror "Sandbox in your installed portage does not support compilation." + eerror "of a multilib gcc. Please set FEATURES=-sandbox and try again." + eerror "After you have a multilib gcc, re-emerge portage to have a working sandbox." + die "No 32bit sandbox. Retry with FEATURES=-sandbox." + fi + + if [[ ${ETYPE} == "gcc-compiler" ]] ; then + case $(tc-arch) in + mips) + # Must compile for mips64-linux target if we want n32/n64 support + case "${CTARGET}" in + mips64*) ;; + *) + if use n32 || use n64; then + eerror "n32/n64 can only be used when target host is mips64*-*-linux-*"; + die "Invalid USE flags for CTARGET ($CTARGET)"; + fi + ;; + esac + + #cannot have both n32 & n64 without multilib + if use n32 && use n64 && ! is_multilib; then + eerror "Please enable multilib if you want to use both n32 & n64"; + die "Invalid USE flag combination"; + fi + ;; + esac + + # Setup variables which would normally be in the profile + if is_crosscompile ; then + multilib_env ${CTARGET} + if ! use multilib ; then + MULTILIB_ABIS=${DEFAULT_ABI} + fi + fi + + # we dont want to use the installed compiler's specs to build gcc! + unset GCC_SPECS + fi + + want_libssp && libc_has_ssp && \ + die "libssp cannot be used with a glibc that has been patched to provide ssp symbols" + + unset LANGUAGES #265283 +} + +gcc-compiler_pkg_preinst() { + : +} + +gcc-compiler_pkg_postinst() { + if has_version 'app-admin/eselect-compiler' ; then + do_eselect_compiler + else + do_gcc_config + fi + + if ! is_crosscompile ; then + echo + ewarn "If you have issues with packages unable to locate libstdc++.la," + ewarn "then try running 'fix_libtool_files.sh' on the old gcc versions." + echo + fi + + # If our gcc-config version doesn't like '-' in it's version string, + # tell our users that gcc-config will yell at them, but it's all good. + if ! has_version '>=sys-devel/gcc-config-1.3.10-r1' && [[ ${GCC_CONFIG_VER/-/} != ${GCC_CONFIG_VER} ]] ; then + ewarn "Your version of gcc-config will issue about having an invalid profile" + ewarn "when switching to this profile. It is safe to ignore this warning," + ewarn "and this problem has been corrected in >=sys-devel/gcc-config-1.3.10-r1." + fi + + if ! is_crosscompile && ! use multislot && [[ ${GCCMAJOR}.${GCCMINOR} == 3.4 ]] ; then + echo + ewarn "You should make sure to rebuild all your C++ packages when" + ewarn "upgrading between different versions of gcc. For example," + ewarn "when moving to gcc-3.4 from gcc-3.3, emerge gentoolkit and run:" + ewarn " # revdep-rebuild --library libstdc++.so.5" + echo + ewarn "For more information on the steps to take when upgrading " + ewarn "from gcc-3.3 please refer to: " + ewarn "http://www.gentoo.org/doc/en/gcc-upgrading.xml" + echo + fi + + if ! is_crosscompile ; then + # hack to prevent collisions between SLOT + [[ ! -d ${ROOT}/lib/rcscripts/awk ]] \ + && mkdir -p "${ROOT}"/lib/rcscripts/awk + [[ ! -d ${ROOT}/sbin ]] \ + && mkdir -p "${ROOT}"/sbin + cp "${ROOT}/${DATAPATH}"/fixlafiles.awk "${ROOT}"/lib/rcscripts/awk/ || die "installing fixlafiles.awk" + cp "${ROOT}/${DATAPATH}"/fix_libtool_files.sh "${ROOT}"/sbin/ || die "installing fix_libtool_files.sh" + + [[ ! -d ${ROOT}/usr/bin ]] \ + && mkdir -p "${ROOT}"/usr/bin + # Since these aren't critical files and portage sucks with + # handling of binpkgs, don't require these to be found + for x in "${ROOT}/${DATAPATH}"/c{89,99} ; do + if [[ -e ${x} ]]; then + cp ${x} "${ROOT}"/usr/bin/ || die "installing c89/c99" + fi + done + fi +} + +gcc-compiler_pkg_prerm() { + # Don't let these files be uninstalled #87647 + touch -c "${ROOT}"/sbin/fix_libtool_files.sh \ + "${ROOT}"/lib/rcscripts/awk/fixlafiles.awk +} + +gcc-compiler_pkg_postrm() { + # to make our lives easier (and saner), we do the fix_libtool stuff here. + # rather than checking SLOT's and trying in upgrade paths, we just see if + # the common libstdc++.la exists in the ${LIBPATH} of the gcc that we are + # unmerging. if it does, that means this was a simple re-emerge. + + # clean up the cruft left behind by cross-compilers + if is_crosscompile ; then + if [[ -z $(ls "${ROOT}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then + rm -f "${ROOT}"/etc/env.d/gcc/config-${CTARGET} + rm -f "${ROOT}"/etc/env.d/??gcc-${CTARGET} + rm -f "${ROOT}"/usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64} + fi + return 0 + fi + + # ROOT isnt handled by the script + [[ ${ROOT} != "/" ]] && return 0 + + if [[ ! -e ${LIBPATH}/libstdc++.so ]] ; then + # make sure the profile is sane during same-slot upgrade #289403 + do_gcc_config + + einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}'" + /sbin/fix_libtool_files.sh ${GCC_RELEASE_VER} + if [[ -n ${BRANCH_UPDATE} ]] ; then + einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}'" + /sbin/fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE} + fi + fi + + return 0 +} + +#---->> pkg_* <<---- + +#---->> src_* <<---- + +# generic GCC src_unpack, to be called from the ebuild's src_unpack. +# BIG NOTE regarding hardened support: ebuilds with support for hardened are +# expected to export the following variable: +# +# HARDENED_GCC_WORKS +# This variable should be set to the archs on which hardened should +# be allowed. For example: HARDENED_GCC_WORKS="x86 sparc amd64" +# This allows for additional archs to be supported by hardened when +# ready. +# +# Travis Tilley (03 Sep 2004) +# +gcc-compiler_src_unpack() { + # fail if using pie patches, building hardened, and glibc doesnt have + # the necessary support + want_pie && use hardened && glibc_have_pie + + if use hardened && ! want_minispecs ; then + einfo "updating configuration to build hardened GCC" + make_gcc_hard || die "failed to make gcc hard" + fi + + if is_libffi ; then + # move the libffi target out of gcj and into all + sed -i \ + -e '/^libgcj=/s:target-libffi::' \ + -e '/^target_lib/s:=":="target-libffi :' \ + "${S}"/configure || die + fi +} +gcc-library_src_unpack() { + : +} +guess_patch_type_in_dir() { + [[ -n $(ls "$1"/*.bz2 2>/dev/null) ]] \ + && EPATCH_SUFFIX="patch.bz2" \ + || EPATCH_SUFFIX="patch" +} +do_gcc_rename_java_bins() { + # bug #139918 - conflict between gcc and java-config-2 for ownership of + # /usr/bin/rmi{c,registry}. Done with mv & sed rather than a patch + # because patches would be large (thanks to the rename of man files), + # and it's clear from the sed invocations that all that changes is the + # rmi{c,registry} names to grmi{c,registry} names. + # Kevin F. Quinn 2006-07-12 + einfo "Renaming jdk executables rmic and rmiregistry to grmic and grmiregistry." + # 1) Move the man files if present (missing prior to gcc-3.4) + for manfile in rmic rmiregistry; do + [[ -f ${S}/gcc/doc/${manfile}.1 ]] || continue + mv "${S}"/gcc/doc/${manfile}.1 "${S}"/gcc/doc/g${manfile}.1 + done + # 2) Fixup references in the docs if present (mission prior to gcc-3.4) + for jfile in gcc/doc/gcj.info gcc/doc/grmic.1 gcc/doc/grmiregistry.1 gcc/java/gcj.texi; do + [[ -f ${S}/${jfile} ]] || continue + sed -i -e 's:rmiregistry:grmiregistry:g' "${S}"/${jfile} || + die "Failed to fixup file ${jfile} for rename to grmiregistry" + sed -i -e 's:rmic:grmic:g' "${S}"/${jfile} || + die "Failed to fixup file ${jfile} for rename to grmic" + done + # 3) Fixup Makefiles to build the changed executable names + # These are present in all 3.x versions, and are the important bit + # to get gcc to build with the new names. + for jfile in libjava/Makefile.am libjava/Makefile.in gcc/java/Make-lang.in; do + sed -i -e 's:rmiregistry:grmiregistry:g' "${S}"/${jfile} || + die "Failed to fixup file ${jfile} for rename to grmiregistry" + # Careful with rmic on these files; it's also the name of a directory + # which should be left unchanged. Replace occurrences of 'rmic$', + # 'rmic_' and 'rmic '. + sed -i -e 's:rmic\([$_ ]\):grmic\1:g' "${S}"/${jfile} || + die "Failed to fixup file ${jfile} for rename to grmic" + done +} +gcc_src_unpack() { + export BRANDING_GCC_PKGVERSION="Gentoo ${GCC_PVR}" + + [[ -z ${UCLIBC_VER} ]] && [[ ${CTARGET} == *-uclibc* ]] && die "Sorry, this version does not support uClibc" + + gcc_quick_unpack + exclude_gcc_patches + + cd "${S}" + + if ! use vanilla ; then + if [[ -n ${PATCH_VER} ]] ; then + guess_patch_type_in_dir "${WORKDIR}"/patch + EPATCH_MULTI_MSG="Applying Gentoo patches ..." \ + epatch "${WORKDIR}"/patch + BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION} p${PATCH_VER}" + fi + if [[ -n ${UCLIBC_VER} ]] ; then + guess_patch_type_in_dir "${WORKDIR}"/uclibc + EPATCH_MULTI_MSG="Applying uClibc patches ..." \ + epatch "${WORKDIR}"/uclibc + fi + fi + do_gcc_HTB_patches + do_gcc_SSP_patches + do_gcc_PIE_patches + epatch_user + + ${ETYPE}_src_unpack || die "failed to ${ETYPE}_src_unpack" + + # protoize don't build on FreeBSD, skip it + ## removed in 4.5, bug #270558 --de. + if [[ ${GCCMAJOR}.${GCCMINOR} < 4.5 ]]; then + if ! is_crosscompile && ! use elibc_FreeBSD ; then + # enable protoize / unprotoize + sed -i -e '/^LANGUAGES =/s:$: proto:' "${S}"/gcc/Makefile.in + fi + fi + + fix_files="" + for x in contrib/test_summary libstdc++-v3/scripts/check_survey.in ; do + [[ -e ${x} ]] && fix_files="${fix_files} ${x}" + done + ht_fix_file ${fix_files} */configure *.sh */Makefile.in + + if ! is_crosscompile && is_multilib && \ + [[ ( $(tc-arch) == "amd64" || $(tc-arch) == "ppc64" ) && -z ${SKIP_MULTILIB_HACK} ]] ; then + disgusting_gcc_multilib_HACK || die "multilib hack failed" + fi + + gcc_version_patch + if [[ ${GCCMAJOR}.${GCCMINOR} > 4.0 ]] ; then + if [[ -n ${SNAPSHOT} || -n ${PRERELEASE} ]] ; then + echo ${PV/_/-} > "${S}"/gcc/BASE-VER + fi + fi + + # >= gcc-4.3 doesn't bundle ecj.jar, so copy it + if [[ ${GCCMAJOR}.${GCCMINOR} > 4.2 ]] && + use gcj ; then + cp -pPR "${DISTDIR}/ecj-4.3.jar" "${S}/ecj.jar" || die + fi + + # disable --as-needed from being compiled into gcc specs + # natively when using a gcc version < 3.4.4 + # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14992 + if ! tc_version_is_at_least 3.4.4 ; then + sed -i -e s/HAVE_LD_AS_NEEDED/USE_LD_AS_NEEDED/g "${S}"/gcc/config.in + fi + + # In gcc 3.3.x and 3.4.x, rename the java bins to gcc-specific names + # in line with gcc-4. + if [[ ${GCCMAJOR} == 3 ]] && + [[ ${GCCMINOR} -ge 3 ]] + then + do_gcc_rename_java_bins + fi + + # Fixup libtool to correctly generate .la files with portage + cd "${S}" + elibtoolize --portage --shallow --no-uclibc + + gnuconfig_update + + # update configure files + local f + einfo "Fixing misc issues in configure files" + tc_version_is_at_least 4.1 && epatch "${GCC_FILESDIR}"/gcc-configure-texinfo.patch + for f in $(grep -l 'autoconf version 2.13' $(find "${S}" -name configure)) ; do + ebegin " Updating ${f/${S}\/} [LANG]" + patch "${f}" "${GCC_FILESDIR}"/gcc-configure-LANG.patch >& "${T}"/configure-patch.log \ + || eerror "Please file a bug about this" + eend $? + done + sed -i 's|A-Za-z0-9|[:alnum:]|g' "${S}"/gcc/*.awk #215828 + + if [[ -x contrib/gcc_update ]] ; then + einfo "Touching generated files" + ./contrib/gcc_update --touch | \ + while read f ; do + einfo " ${f%%...}" + done + fi + + disable_multilib_libjava || die "failed to disable multilib java" +} + +gcc-library-configure() { + # multilib support + [[ ${GCC_TARGET_NO_MULTILIB} == "true" ]] \ + && confgcc="${confgcc} --disable-multilib" \ + || confgcc="${confgcc} --enable-multilib" +} + +gcc-compiler-configure() { + # multilib support + if is_multilib ; then + confgcc="${confgcc} --enable-multilib" + elif [[ ${CTARGET} == *-linux* ]] ; then + confgcc="${confgcc} --disable-multilib" + fi + + if tc_version_is_at_least "4.0" ; then + if has mudflap ${IUSE} ; then + confgcc="${confgcc} $(use_enable mudflap libmudflap)" + else + confgcc="${confgcc} --disable-libmudflap" + fi + + if want_libssp ; then + confgcc="${confgcc} --enable-libssp" + else + export gcc_cv_libc_provides_ssp=yes + confgcc="${confgcc} --disable-libssp" + fi + + if tc_version_is_at_least "4.2" ; then + confgcc="${confgcc} $(use_enable openmp libgomp)" + fi + + # enable the cld workaround until we move things to stable. + # by that point, the rest of the software out there should + # have caught up. + if tc_version_is_at_least "4.3" ; then + if ! has ${ARCH} ${KEYWORDS} ; then + confgcc="${confgcc} --enable-cld" + fi + fi + + # Stick the python scripts in their own slotted directory + # bug #279252 + if tc_version_is_at_least "4.4" ; then + confgcc="${confgcc} --with-python-dir=${DATAPATH/$PREFIX/}/python" + fi + fi + + # GTK+ is preferred over xlib in 3.4.x (xlib is unmaintained + # right now). Much thanks to for the heads up. + # Travis Tilley (11 Jul 2004) + if ! is_gcj ; then + confgcc="${confgcc} --disable-libgcj" + elif use gtk ; then + confgcc="${confgcc} --enable-java-awt=gtk" + fi + + case $(tc-arch) in + arm) #264534 + local arm_arch="${CTARGET%%-*}" + # Only do this if arm_arch is armv* + if [[ ${arm_arch} == armv* ]] ; then + # Convert armv7{a,r,m} to armv7-{a,r,m} + [[ ${arm_arch} == armv7? ]] && arm_arch=${arm_arch/7/7-} + # Remove endian ('l' / 'eb') + [[ ${arm_arch} == *l ]] && arm_arch=${arm_arch%l} + [[ ${arm_arch} == *eb ]] && arm_arch=${arm_arch%eb} + confgcc="${confgcc} --with-arch=${arm_arch}" + fi + ;; + # Add --with-abi flags to set default MIPS ABI + mips) + local mips_abi="" + use n64 && mips_abi="--with-abi=64" + use n32 && mips_abi="--with-abi=n32" + [[ -n ${mips_abi} ]] && confgcc="${confgcc} ${mips_abi}" + ;; + # Default arch for x86 is normally i386, lets give it a bump + # since glibc will do so based on CTARGET anyways + x86) + confgcc="${confgcc} --with-arch=${CTARGET%%-*}" + ;; + # Enable sjlj exceptions for backward compatibility on hppa + hppa) + [[ ${GCCMAJOR} == "3" ]] && confgcc="${confgcc} --enable-sjlj-exceptions" + ;; + esac + + GCC_LANG="c" + is_cxx && GCC_LANG="${GCC_LANG},c++" + is_d && GCC_LANG="${GCC_LANG},d" + is_gcj && GCC_LANG="${GCC_LANG},java" + if is_objc || is_objcxx ; then + GCC_LANG="${GCC_LANG},objc" + if tc_version_is_at_least "4.0" ; then + use objc-gc && confgcc="${confgcc} --enable-objc-gc" + fi + is_objcxx && GCC_LANG="${GCC_LANG},obj-c++" + fi + is_treelang && GCC_LANG="${GCC_LANG},treelang" + + # fortran support just got sillier! the lang value can be f77 for + # fortran77, f95 for fortran95, or just plain old fortran for the + # currently supported standard depending on gcc version. + is_fortran && GCC_LANG="${GCC_LANG},fortran" + is_f77 && GCC_LANG="${GCC_LANG},f77" + is_f95 && GCC_LANG="${GCC_LANG},f95" + + # We do NOT want 'ADA support' in here! + # is_ada && GCC_LANG="${GCC_LANG},ada" + + einfo "configuring for GCC_LANG: ${GCC_LANG}" +} + +# Other than the variables described for gcc_setup_variables, the following +# will alter tha behavior of gcc_do_configure: +# +# CTARGET +# CBUILD +# Enable building for a target that differs from CHOST +# +# GCC_TARGET_NO_MULTILIB +# Disable multilib. Useful when building single library targets. +# +# GCC_LANG +# Enable support for ${GCC_LANG} languages. defaults to just "c" +# +# Travis Tilley (04 Sep 2004) +# +gcc_do_configure() { + local confgcc + + # Set configuration based on path variables + confgcc="${confgcc} \ + --prefix=${PREFIX} \ + --bindir=${BINPATH} \ + --includedir=${INCLUDEPATH} \ + --datadir=${DATAPATH} \ + --mandir=${DATAPATH}/man \ + --infodir=${DATAPATH}/info \ + --with-gxx-include-dir=${STDCXX_INCDIR}" + # On Darwin we need libdir to be set in order to get correct install names + # for things like libobjc-gnu, libgcj and libfortran. If we enable it on + # non-Darwin we screw up the behaviour this eclass relies on. We in + # particular need this over --libdir for bug #255315. + [[ ${CHOST} == *-darwin* ]] && \ + confgcc="${confgcc} --enable-version-specific-runtime-libs" + + # All our cross-compile logic goes here ! woo ! + confgcc="${confgcc} --host=${CHOST}" + if is_crosscompile || tc-is-cross-compiler ; then + # Straight from the GCC install doc: + # "GCC has code to correctly determine the correct value for target + # for nearly all native systems. Therefore, we highly recommend you + # not provide a configure target when configuring a native compiler." + confgcc="${confgcc} --target=${CTARGET}" + fi + [[ -n ${CBUILD} ]] && confgcc="${confgcc} --build=${CBUILD}" + + # ppc altivec support + confgcc="${confgcc} $(use_enable altivec)" + + # gcc has fixed-point arithmetic support in 4.3 for mips targets that can + # significantly increase compile time by several hours. This will allow + # users to control this feature in the event they need the support. + tc_version_is_at_least "4.3" && confgcc="${confgcc} $(use_enable fixed-point)" + + # graphite support was added in 4.4, which depends upon external libraries + # for optimizations. This option allows users to determine if they want + # these optimizations and libraries pulled in + tc_version_is_at_least "4.4" && \ + confgcc="${confgcc} $(use_with graphite ppl) $(use_with graphite cloog)" + + + [[ $(tc-is-softfloat) == "yes" ]] && confgcc="${confgcc} --with-float=soft" + + # Native Language Support + if use nls ; then + confgcc="${confgcc} --enable-nls --without-included-gettext" + else + confgcc="${confgcc} --disable-nls" + fi + + # reasonably sane globals (hopefully) + confgcc="${confgcc} \ + --with-system-zlib \ + --disable-checking \ + --disable-werror \ + --enable-secureplt" + + # etype specific configuration + einfo "running ${ETYPE}-configure" + ${ETYPE}-configure || die + + # if not specified, assume we are building for a target that only + # requires C support + GCC_LANG=${GCC_LANG:-c} + confgcc="${confgcc} --enable-languages=${GCC_LANG}" + + if is_crosscompile ; then + # When building a stage1 cross-compiler (just C compiler), we have to + # disable a bunch of features or gcc goes boom + local needed_libc="" + case ${CTARGET} in + *-linux) needed_libc=no-fucking-clue;; + *-dietlibc) needed_libc=dietlibc;; + *-elf) needed_libc=newlib;; + *-freebsd*) needed_libc=freebsd-lib;; + *-gnu*) needed_libc=glibc;; + *-klibc) needed_libc=klibc;; + *-uclibc*) needed_libc=uclibc;; + *-cygwin) needed_libc=cygwin;; + mingw*|*-mingw*) needed_libc=mingw-runtime;; + avr) confgcc="${confgcc} --enable-shared --disable-threads";; + esac + if [[ -n ${needed_libc} ]] ; then + if ! has_version ${CATEGORY}/${needed_libc} ; then + confgcc="${confgcc} --disable-shared --disable-threads --without-headers" + elif built_with_use --hidden --missing false ${CATEGORY}/${needed_libc} crosscompile_opts_headers-only ; then + confgcc="${confgcc} --disable-shared --with-sysroot=${PREFIX}/${CTARGET}" + else + confgcc="${confgcc} --with-sysroot=${PREFIX}/${CTARGET}" + fi + fi + + if [[ ${GCCMAJOR}.${GCCMINOR} > 4.1 ]] ; then + confgcc="${confgcc} --disable-bootstrap --disable-libgomp" + fi + elif [[ ${CHOST} == mingw* ]] || [[ ${CHOST} == *-mingw* ]] || [[ ${CHOST} == *-cygwin ]] ; then + confgcc="${confgcc} --enable-shared --enable-threads=win32" + else + confgcc="${confgcc} --enable-shared --enable-threads=posix" + fi + [[ ${CTARGET} == *-elf ]] && confgcc="${confgcc} --with-newlib" + # __cxa_atexit is "essential for fully standards-compliant handling of + # destructors", but apparently requires glibc. + if [[ ${CTARGET} == *-uclibc* ]] ; then + confgcc="${confgcc} --disable-__cxa_atexit --enable-target-optspace $(use_enable nptl tls)" + [[ ${GCCMAJOR}.${GCCMINOR} == 3.3 ]] && confgcc="${confgcc} --enable-sjlj-exceptions" + if tc_version_is_at_least 3.4 && [[ ${GCCMAJOR}.${GCCMINOR} < 4.3 ]] ; then + confgcc="${confgcc} --enable-clocale=uclibc" + fi + elif [[ ${CTARGET} == *-gnu* ]] ; then + confgcc="${confgcc} --enable-__cxa_atexit" + confgcc="${confgcc} --enable-clocale=gnu" + elif [[ ${CTARGET} == *-freebsd* ]]; then + confgcc="${confgcc} --enable-__cxa_atexit" + elif [[ ${CTARGET} == *-solaris* ]]; then + confgcc="${confgcc} --enable-__cxa_atexit" + fi + [[ ${GCCMAJOR}.${GCCMINOR} < 3.4 ]] && confgcc="${confgcc} --disable-libunwind-exceptions" + + # create a sparc*linux*-{gcc,g++} that can handle -m32 and -m64 (biarch) + if [[ ${CTARGET} == sparc*linux* ]] \ + && is_multilib \ + && ! is_crosscompile \ + && [[ ${GCCMAJOR}.${GCCMINOR} > 4.2 ]] + then + confgcc="${confgcc} --enable-targets=all" + fi + + tc_version_is_at_least 4.3 && set -- "$@" \ + --with-bugurl=http://bugs.gentoo.org/ \ + --with-pkgversion="${BRANDING_GCC_PKGVERSION}" + set -- ${confgcc} "$@" ${EXTRA_ECONF} + + # Nothing wrong with a good dose of verbosity + echo + einfo "PREFIX: ${PREFIX}" + einfo "BINPATH: ${BINPATH}" + einfo "LIBPATH: ${LIBPATH}" + einfo "DATAPATH: ${DATAPATH}" + einfo "STDCXX_INCDIR: ${STDCXX_INCDIR}" + echo + einfo "Configuring GCC with: ${@//--/\n\t--}" + echo + + # Build in a separate build tree + mkdir -p "${WORKDIR}"/build + pushd "${WORKDIR}"/build > /dev/null + + # and now to do the actual configuration + addwrite /dev/zero + echo "${S}"/configure "$@" + "${S}"/configure "$@" || die "failed to run configure" + + # return to whatever directory we were in before + popd > /dev/null +} + +# This function accepts one optional argument, the make target to be used. +# If ommitted, gcc_do_make will try to guess whether it should use all, +# profiledbootstrap, or bootstrap-lean depending on CTARGET and arch. An +# example of how to use this function: +# +# gcc_do_make all-target-libstdc++-v3 +# +# In addition to the target to be used, the following variables alter the +# behavior of this function: +# +# LDFLAGS +# Flags to pass to ld +# +# STAGE1_CFLAGS +# CFLAGS to use during stage1 of a gcc bootstrap +# +# BOOT_CFLAGS +# CFLAGS to use during stages 2+3 of a gcc bootstrap. +# +# Travis Tilley (04 Sep 2004) +# +gcc_do_make() { + # Fix for libtool-portage.patch + local OLDS=${S} + S=${WORKDIR}/build + + # Set make target to $1 if passed + [[ -n $1 ]] && GCC_MAKE_TARGET=$1 + # default target + if is_crosscompile || tc-is-cross-compiler ; then + # 3 stage bootstrapping doesnt quite work when you cant run the + # resulting binaries natively ^^; + GCC_MAKE_TARGET=${GCC_MAKE_TARGET-all} + else + GCC_MAKE_TARGET=${GCC_MAKE_TARGET-bootstrap-lean} + fi + + # the gcc docs state that parallel make isnt supported for the + # profiledbootstrap target, as collisions in profile collecting may occur. + [[ ${GCC_MAKE_TARGET} == "profiledbootstrap" ]] && export MAKEOPTS="${MAKEOPTS} -j1" + + # boundschecking seems to introduce parallel build issues + want_boundschecking && export MAKEOPTS="${MAKEOPTS} -j1" + + if [[ ${GCC_MAKE_TARGET} == "all" ]] ; then + STAGE1_CFLAGS=${STAGE1_CFLAGS-"${CFLAGS}"} + elif [[ $(gcc-version) == "3.4" && ${GCC_BRANCH_VER} == "3.4" ]] && gcc-specs-ssp ; then + # See bug #79852 + STAGE1_CFLAGS=${STAGE1_CFLAGS-"-O2"} + else + STAGE1_CFLAGS=${STAGE1_CFLAGS-"-O"} + fi + + if is_crosscompile; then + # In 3.4, BOOT_CFLAGS is never used on a crosscompile... + # but I'll leave this in anyways as someone might have had + # some reason for putting it in here... --eradicator + BOOT_CFLAGS=${BOOT_CFLAGS-"-O2"} + else + # we only want to use the system's CFLAGS if not building a + # cross-compiler. + BOOT_CFLAGS=${BOOT_CFLAGS-"$(get_abi_CFLAGS) ${CFLAGS}"} + fi + + pushd "${WORKDIR}"/build + + emake \ + LDFLAGS="${LDFLAGS}" \ + STAGE1_CFLAGS="${STAGE1_CFLAGS}" \ + LIBPATH="${LIBPATH}" \ + BOOT_CFLAGS="${BOOT_CFLAGS}" \ + ${GCC_MAKE_TARGET} \ + || die "emake failed with ${GCC_MAKE_TARGET}" + + if ! is_crosscompile && ! use nocxx && use doc ; then + if type -p doxygen > /dev/null ; then + if tc_version_is_at_least 4.3 ; then + cd "${CTARGET}"/libstdc++-v3/doc + emake doc-man-doxygen || ewarn "failed to make docs" + elif tc_version_is_at_least 3.0 ; then + cd "${CTARGET}"/libstdc++-v3 + emake doxygen-man || ewarn "failed to make docs" + fi + else + ewarn "Skipping libstdc++ manpage generation since you don't have doxygen installed" + fi + fi + + popd +} + +# This function will add ${GCC_CONFIG_VER} to the names of all shared libraries in the +# directory specified to avoid filename collisions between multiple slotted +# non-versioned gcc targets. If no directory is specified, it is assumed that +# you want -all- shared objects to have ${GCC_CONFIG_VER} added. Example +# +# add_version_to_shared ${D}/usr/$(get_libdir) +# +# Travis Tilley (05 Sep 2004) +# +add_version_to_shared() { + local sharedlib sharedlibdir + [[ -z $1 ]] \ + && sharedlibdir=${D} \ + || sharedlibdir=$1 + + for sharedlib in $(find ${sharedlibdir} -name *.so.*) ; do + if [[ ! -L ${sharedlib} ]] ; then + einfo "Renaming `basename "${sharedlib}"` to `basename "${sharedlib/.so*/}-${GCC_CONFIG_VER}.so.${sharedlib/*.so./}"`" + mv "${sharedlib}" "${sharedlib/.so*/}-${GCC_CONFIG_VER}.so.${sharedlib/*.so./}" \ + || die + pushd `dirname "${sharedlib}"` > /dev/null || die + ln -sf "`basename "${sharedlib/.so*/}-${GCC_CONFIG_VER}.so.${sharedlib/*.so./}"`" \ + "`basename "${sharedlib}"`" || die + popd > /dev/null || die + fi + done +} + +# This is mostly a stub function to be overwritten in an ebuild +gcc_do_filter_flags() { + strip-flags + + # In general gcc does not like optimization, and add -O2 where + # it is safe. This is especially true for gcc 3.3 + 3.4 + replace-flags -O? -O2 + + # ... sure, why not? + strip-unsupported-flags + + # dont want to funk ourselves + filter-flags '-mabi*' -m31 -m32 -m64 + + case ${GCC_BRANCH_VER} in + 3.2|3.3) + replace-cpu-flags k8 athlon64 opteron i686 x86-64 + replace-cpu-flags pentium-m pentium3m pentium3 + case $(tc-arch) in + amd64|x86) filter-flags '-mtune=*' ;; + # in gcc 3.3 there is a bug on ppc64 where if -mcpu is used, + # the compiler wrongly assumes a 32bit target + ppc64) filter-flags "-mcpu=*";; + esac + case $(tc-arch) in + amd64) replace-cpu-flags core2 nocona;; + x86) replace-cpu-flags core2 prescott;; + esac + + replace-cpu-flags G3 750 + replace-cpu-flags G4 7400 + replace-cpu-flags G5 7400 + + # XXX: should add a sed or something to query all supported flags + # from the gcc source and trim everything else ... + filter-flags -f{no-,}unit-at-a-time -f{no-,}web -mno-tls-direct-seg-refs + filter-flags -f{no-,}stack-protector{,-all} + filter-flags -fvisibility-inlines-hidden -fvisibility=hidden + ;; + 3.4|4.*) + case $(tc-arch) in + x86|amd64) filter-flags '-mcpu=*';; + *-macos) + # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25127 + [[ ${GCC_BRANCH_VER} == 4.0 || ${GCC_BRANCH_VER} == 4.1 ]] && \ + filter-flags '-mcpu=*' '-march=*' '-mtune=*' + ;; + esac + ;; + esac + + # Compile problems with these (bug #6641 among others)... + #filter-flags "-fno-exceptions -fomit-frame-pointer -fforce-addr" + + # CFLAGS logic (verified with 3.4.3): + # CFLAGS: + # This conflicts when creating a crosscompiler, so set to a sane + # default in this case: + # used in ./configure and elsewhere for the native compiler + # used by gcc when creating libiberty.a + # used by xgcc when creating libstdc++ (and probably others)! + # this behavior should be removed... + # + # CXXFLAGS: + # used by xgcc when creating libstdc++ + # + # STAGE1_CFLAGS (not used in creating a crosscompile gcc): + # used by ${CHOST}-gcc for building stage1 compiler + # + # BOOT_CFLAGS (not used in creating a crosscompile gcc): + # used by xgcc for building stage2/3 compiler + + if is_crosscompile ; then + # Set this to something sane for both native and target + CFLAGS="-O2 -pipe" + + local VAR="CFLAGS_"${CTARGET//-/_} + CXXFLAGS=${!VAR} + fi + + export GCJFLAGS=${GCJFLAGS:-${CFLAGS}} +} + +gcc_src_compile() { + gcc_do_filter_flags + einfo "CFLAGS=\"${CFLAGS}\"" + einfo "CXXFLAGS=\"${CXXFLAGS}\"" + + # For hardened gcc 4 for build the hardened specs file to use when building gcc + setup_minispecs_gcc_build_specs + + # Build in a separate build tree + mkdir -p "${WORKDIR}"/build + pushd "${WORKDIR}"/build > /dev/null + + # Install our pre generated manpages if we do not have perl ... + [[ ! -x /usr/bin/perl ]] && [[ -n ${MAN_VER} ]] && \ + unpack gcc-${MAN_VER}-manpages.tar.bz2 + + einfo "Configuring ${PN} ..." + gcc_do_configure + + touch "${S}"/gcc/c-gperf.h + + # Do not make manpages if we do not have perl ... + [[ ! -x /usr/bin/perl ]] \ + && find "${WORKDIR}"/build -name '*.[17]' | xargs touch + + einfo "Compiling ${PN} ..." + gcc_do_make ${GCC_MAKE_TARGET} + + # Do not create multiple specs files for PIE+SSP if boundschecking is in + # USE, as we disable PIE+SSP when it is. + if [[ ${ETYPE} == "gcc-compiler" ]] && want_split_specs && ! want_minispecs; then + split_out_specs_files || die "failed to split out specs" + fi + + popd > /dev/null +} + +gcc_src_test() { + cd "${WORKDIR}"/build + emake -j1 -k check || ewarn "check failed and that sucks :(" +} + +gcc-library_src_install() { + # Do the 'make install' from the build directory + cd "${WORKDIR}"/build + S=${WORKDIR}/build \ + emake -j1 \ + DESTDIR="${D}" \ + prefix=${PREFIX} \ + bindir=${BINPATH} \ + includedir=${LIBPATH}/include \ + datadir=${DATAPATH} \ + mandir=${DATAPATH}/man \ + infodir=${DATAPATH}/info \ + LIBPATH="${LIBPATH}" \ + ${GCC_INSTALL_TARGET} || die + + if [[ ${GCC_LIB_COMPAT_ONLY} == "true" ]] ; then + rm -rf "${D}"${INCLUDEPATH} + rm -rf "${D}"${DATAPATH} + pushd "${D}"${LIBPATH}/ + rm *.a *.la *.so + popd + fi + + if [[ -n ${GCC_LIB_USE_SUBDIR} ]] ; then + mkdir -p "${WORKDIR}"/${GCC_LIB_USE_SUBDIR}/ + mv "${D}"${LIBPATH}/* "${WORKDIR}"/${GCC_LIB_USE_SUBDIR}/ + mv "${WORKDIR}"/${GCC_LIB_USE_SUBDIR}/ "${D}"${LIBPATH} + + dodir /etc/env.d + echo "LDPATH=\"${LIBPATH}/${GCC_LIB_USE_SUBDIR}/\"" >> "${D}"/etc/env.d/99${PN} + fi + + if [[ ${GCC_VAR_TYPE} == "non-versioned" ]] ; then + # if we're not using versioned directories, we need to use versioned + # filenames. + add_version_to_shared + fi +} + +gcc-compiler_src_install() { + local x= + + cd "${WORKDIR}"/build + # Do allow symlinks in private gcc include dir as this can break the build + find gcc/include*/ -type l -print0 | xargs rm -f + # Remove generated headers, as they can cause things to break + # (ncurses, openssl, etc). + for x in $(find gcc/include*/ -name '*.h') ; do + grep -q 'It has been auto-edited by fixincludes from' "${x}" \ + && rm -f "${x}" + done + # Do the 'make install' from the build directory + S=${WORKDIR}/build \ + emake -j1 DESTDIR="${D}" install || die + # Punt some tools which are really only useful while building gcc + find "${D}" -name install-tools -prune -type d -exec rm -rf "{}" \; + # This one comes with binutils + find "${D}" -name libiberty.a -exec rm -f "{}" \; + + # Move the libraries to the proper location + gcc_movelibs + + # Basic sanity check + if ! is_crosscompile ; then + local EXEEXT + eval $(grep ^EXEEXT= "${WORKDIR}"/build/gcc/config.log) + [[ -r ${D}${BINPATH}/gcc${EXEEXT} ]] || die "gcc not found in ${D}" + fi + + dodir /etc/env.d/gcc + create_gcc_env_entry + + if want_split_specs ; then + if use hardened ; then + create_gcc_env_entry vanilla + fi + ! use hardened && hardened_gcc_works && create_gcc_env_entry hardened + if hardened_gcc_works || hardened_gcc_works pie ; then + create_gcc_env_entry hardenednossp + fi + if hardened_gcc_works || hardened_gcc_works ssp ; then + create_gcc_env_entry hardenednopie + fi + create_gcc_env_entry hardenednopiessp + + insinto ${LIBPATH} + doins "${WORKDIR}"/build/*.specs || die "failed to install specs" + fi + # Setup the gcc_env_entry for hardened gcc 4 with minispecs + if want_minispecs ; then + if hardened_gcc_works pie ; then + create_gcc_env_entry hardenednopie + fi + create_gcc_env_entry vanilla + fi + # Make sure we dont have stuff lying around that + # can nuke multiple versions of gcc + + gcc_slot_java + + # Move to compiler-specific directories + [[ -f ${D}${STDCXX_INCDIR}/cxxabi.h ]] && \ + mv -f "${D}"${STDCXX_INCDIR}/cxxabi.h "${D}"${LIBPATH}/include/ + + # These should be symlinks + dodir /usr/bin + cd "${D}"${BINPATH} + for x in cpp gcc g++ c++ g77 gcj gcjh gfortran ; do + # For some reason, g77 gets made instead of ${CTARGET}-g77... + # this should take care of that + [[ -f ${x} ]] && mv ${x} ${CTARGET}-${x} + + if [[ -f ${CTARGET}-${x} ]] && ! is_crosscompile ; then + ln -sf ${CTARGET}-${x} ${x} + + # Create version-ed symlinks + dosym ${BINPATH}/${CTARGET}-${x} \ + /usr/bin/${CTARGET}-${x}-${GCC_CONFIG_VER} + dosym ${BINPATH}/${CTARGET}-${x} \ + /usr/bin/${x}-${GCC_CONFIG_VER} + fi + + if [[ -f ${CTARGET}-${x}-${GCC_CONFIG_VER} ]] ; then + rm -f ${CTARGET}-${x}-${GCC_CONFIG_VER} + ln -sf ${CTARGET}-${x} ${CTARGET}-${x}-${GCC_CONFIG_VER} + fi + done + + # I do not know if this will break gcj stuff, so I'll only do it for + # objc for now; basically "ffi.h" is the correct file to include, + # but it gets installed in .../GCCVER/include and yet it does + # "#include " which (correctly, as it's an "extra" file) + # is installed in .../GCCVER/include/libffi; the following fixes + # ffi.'s include of ffitarget.h - Armando Di Cianno + if [[ -d ${D}${LIBPATH}/include/libffi ]] ; then + mv -i "${D}"${LIBPATH}/include/libffi/* "${D}"${LIBPATH}/include || die + rm -r "${D}"${LIBPATH}/include/libffi || die + fi + + # Now do the fun stripping stuff + env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${BINPATH}" + env RESTRICT="" CHOST=${CTARGET} prepstrip "${D}${LIBPATH}" + # gcc used to install helper binaries in lib/ but then moved to libexec/ + [[ -d ${D}${PREFIX}/libexec/gcc ]] && \ + env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}" + + cd "${S}" + if is_crosscompile; then + rm -rf "${D}"/usr/share/{man,info} + rm -rf "${D}"${DATAPATH}/{man,info} + else + local cxx_mandir=${WORKDIR}/build/${CTARGET}/libstdc++-v3/docs/doxygen/man + if [[ -d ${cxx_mandir} ]] ; then + # clean bogus manpages #113902 + find "${cxx_mandir}" -name '*_build_*' -exec rm {} \; + cp -r "${cxx_mandir}"/man? "${D}/${DATAPATH}"/man/ + fi + has noinfo ${FEATURES} \ + && rm -r "${D}/${DATAPATH}"/info \ + || prepinfo "${DATAPATH}" + has noman ${FEATURES} \ + && rm -r "${D}/${DATAPATH}"/man \ + || prepman "${DATAPATH}" + fi + # prune empty dirs left behind + for x in 1 2 3 4 ; do + find "${D}" -type d -exec rmdir "{}" \; >& /dev/null + done + + # install testsuite results + if use test; then + docinto testsuite + find "${WORKDIR}"/build -type f -name "*.sum" -print0 | xargs -0 dodoc + find "${WORKDIR}"/build -type f -path "*/testsuite/*.log" -print0 \ + | xargs -0 dodoc + fi + + # Rather install the script, else portage with changing $FILESDIR + # between binary and source package borks things .... + if ! is_crosscompile ; then + insinto "${DATAPATH}" + if tc_version_is_at_least 4.0 ; then + newins "${GCC_FILESDIR}"/awk/fixlafiles.awk-no_gcc_la fixlafiles.awk || die + find "${D}/${LIBPATH}" -name libstdc++.la -type f -exec rm "{}" \; + else + doins "${GCC_FILESDIR}"/awk/fixlafiles.awk || die + fi + exeinto "${DATAPATH}" + doexe "${GCC_FILESDIR}"/fix_libtool_files.sh || die + doexe "${GCC_FILESDIR}"/c{89,99} || die + fi + + # use gid of 0 because some stupid ports don't have + # the group 'root' set to gid 0 + chown -R root:0 "${D}"${LIBPATH} + + # Create config files for eselect-compiler + create_eselect_conf + + # Cpoy the needed minispec for hardened gcc 4 + copy_minispecs_gcc_specs +} + +gcc_slot_java() { + local x + + # Move Java headers to compiler-specific dir + for x in "${D}"${PREFIX}/include/gc*.h "${D}"${PREFIX}/include/j*.h ; do + [[ -f ${x} ]] && mv -f "${x}" "${D}"${LIBPATH}/include/ + done + for x in gcj gnu java javax org ; do + if [[ -d ${D}${PREFIX}/include/${x} ]] ; then + dodir /${LIBPATH}/include/${x} + mv -f "${D}"${PREFIX}/include/${x}/* "${D}"${LIBPATH}/include/${x}/ + rm -rf "${D}"${PREFIX}/include/${x} + fi + done + + if [[ -d ${D}${PREFIX}/lib/security ]] || [[ -d ${D}${PREFIX}/$(get_libdir)/security ]] ; then + dodir /${LIBPATH}/security + mv -f "${D}"${PREFIX}/lib*/security/* "${D}"${LIBPATH}/security + rm -rf "${D}"${PREFIX}/lib*/security + fi + + # Move libgcj.spec to compiler-specific directories + [[ -f ${D}${PREFIX}/lib/libgcj.spec ]] && \ + mv -f "${D}"${PREFIX}/lib/libgcj.spec "${D}"${LIBPATH}/libgcj.spec + + # SLOT up libgcj.pc (and let gcc-config worry about links) + local libgcj=$(find "${D}"${PREFIX}/lib/pkgconfig/ -name 'libgcj*.pc') + if [[ -n ${libgcj} ]] ; then + sed -i "/^libdir=/s:=.*:=${LIBPATH}:" "${libgcj}" + mv "${libgcj}" "${D}"/usr/lib/pkgconfig/libgcj-${GCC_PV}.pc || die + fi + + # Rename jar because it could clash with Kaffe's jar if this gcc is + # primary compiler (aka don't have the - extension) + cd "${D}"${BINPATH} + [[ -f jar ]] && mv -f jar gcj-jar +} + +# Move around the libs to the right location. For some reason, +# when installing gcc, it dumps internal libraries into /usr/lib +# instead of the private gcc lib path +gcc_movelibs() { + # older versions of gcc did not support --print-multi-os-directory + tc_version_is_at_least 3.0 || return 0 + + local multiarg removedirs="" + for multiarg in $($(XGCC) -print-multi-lib) ; do + multiarg=${multiarg#*;} + multiarg=${multiarg//@/ -} + + local OS_MULTIDIR=$($(XGCC) ${multiarg} --print-multi-os-directory) + local MULTIDIR=$($(XGCC) ${multiarg} --print-multi-directory) + local TODIR=${D}${LIBPATH}/${MULTIDIR} + local FROMDIR= + + [[ -d ${TODIR} ]] || mkdir -p ${TODIR} + + for FROMDIR in \ + ${LIBPATH}/${OS_MULTIDIR} \ + ${LIBPATH}/../${MULTIDIR} \ + ${PREFIX}/lib/${OS_MULTIDIR} \ + ${PREFIX}/${CTARGET}/lib/${OS_MULTIDIR} \ + ${PREFIX}/lib/${MULTIDIR} + do + removedirs="${removedirs} ${FROMDIR}" + FROMDIR=${D}${FROMDIR} + if [[ ${FROMDIR} != "${TODIR}" && -d ${FROMDIR} ]] ; then + local files=$(find "${FROMDIR}" -maxdepth 1 ! -type d 2>/dev/null) + if [[ -n ${files} ]] ; then + mv ${files} "${TODIR}" + fi + fi + done + fix_libtool_libdir_paths "${LIBPATH}/${MULTIDIR}" + done + + # We remove directories separately to avoid this case: + # mv SRC/lib/../lib/*.o DEST + # rmdir SRC/lib/../lib/ + # mv SRC/lib/../lib32/*.o DEST # Bork + for FROMDIR in ${removedirs} ; do + rmdir "${D}"${FROMDIR} >& /dev/null + done + find "${D}" -type d | xargs rmdir >& /dev/null +} + +#----<< src_* >>---- + +#---->> unorganized crap in need of refactoring follows + +# gcc_quick_unpack will unpack the gcc tarball and patches in a way that is +# consistant with the behavior of get_gcc_src_uri. The only patch it applies +# itself is the branch update if present. +# +# Travis Tilley (03 Sep 2004) +# +gcc_quick_unpack() { + pushd "${WORKDIR}" > /dev/null + export PATCH_GCC_VER=${PATCH_GCC_VER:-${GCC_RELEASE_VER}} + export UCLIBC_GCC_VER=${UCLIBC_GCC_VER:-${PATCH_GCC_VER}} + export PIE_GCC_VER=${PIE_GCC_VER:-${GCC_RELEASE_VER}} + export PP_GCC_VER=${PP_GCC_VER:-${GCC_RELEASE_VER}} + export HTB_GCC_VER=${HTB_GCC_VER:-${GCC_RELEASE_VER}} + export SPECS_GCC_VER=${SPECS_GCC_VER:-${GCC_RELEASE_VER}} + + if [[ -n ${GCC_A_FAKEIT} ]] ; then + unpack ${GCC_A_FAKEIT} + elif [[ -n ${PRERELEASE} ]] ; then + unpack gcc-${PRERELEASE}.tar.bz2 + elif [[ -n ${SNAPSHOT} ]] ; then + unpack gcc-${SNAPSHOT}.tar.bz2 + else + unpack gcc-${GCC_RELEASE_VER}.tar.bz2 + # We want branch updates to be against a release tarball + if [[ -n ${BRANCH_UPDATE} ]] ; then + pushd "${S}" > /dev/null + epatch "${DISTDIR}"/gcc-${GCC_RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2 + popd > /dev/null + fi + fi + + if [[ -n ${D_VER} ]] && use d ; then + pushd "${S}"/gcc > /dev/null + unpack gdc-${D_VER}-src.tar.bz2 + cd .. + ebegin "Adding support for the D language" + ./gcc/d/setup-gcc.sh >& "${T}"/dgcc.log + if ! eend $? ; then + eerror "The D gcc package failed to apply" + eerror "Please include this log file when posting a bug report:" + eerror " ${T}/dgcc.log" + die "failed to include the D language" + fi + popd > /dev/null + fi + + [[ -n ${PATCH_VER} ]] && \ + unpack gcc-${PATCH_GCC_VER}-patches-${PATCH_VER}.tar.bz2 + + [[ -n ${UCLIBC_VER} ]] && \ + unpack gcc-${UCLIBC_GCC_VER}-uclibc-patches-${UCLIBC_VER}.tar.bz2 + + if want_ssp ; then + if [[ -n ${PP_FVER} ]] ; then + # The gcc 3.4 propolice versions are meant to be unpacked to ${S} + pushd "${S}" > /dev/null + unpack protector-${PP_FVER}.tar.gz + popd > /dev/null + else + unpack gcc-${PP_GCC_VER}-ssp-${PP_VER}.tar.bz2 + fi + fi + + if want_pie ; then + if [[ -n ${PIE_CORE} ]] ; then + unpack ${PIE_CORE} + else + unpack gcc-${PIE_GCC_VER}-piepatches-v${PIE_VER}.tar.bz2 + fi + [[ -n ${SPECS_VER} ]] && \ + unpack gcc-${SPECS_GCC_VER}-specs-${SPECS_VER}.tar.bz2 + fi + + want_boundschecking && \ + unpack "bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch.bz2" + + popd > /dev/null +} + +# Exclude any unwanted patches, as specified by the following variables: +# +# GENTOO_PATCH_EXCLUDE +# List of filenames, relative to ${WORKDIR}/patch/ +# +# PIEPATCH_EXCLUDE +# List of filenames, relative to ${WORKDIR}/piepatch/ +# +# Travis Tilley (03 Sep 2004) +# +exclude_gcc_patches() { + local i + for i in ${GENTOO_PATCH_EXCLUDE} ; do + if [[ -f ${WORKDIR}/patch/${i} ]] ; then + einfo "Excluding patch ${i}" + rm -f "${WORKDIR}"/patch/${i} || die "failed to delete ${i}" + fi + done + for i in ${PIEPATCH_EXCLUDE} ; do + if [[ -f ${WORKDIR}/piepatch/${i} ]] ; then + einfo "Excluding piepatch ${i}" + rm -f "${WORKDIR}"/piepatch/${i} || die "failed to delete ${i}" + fi + done +} + +# Try to apply some stub patches so that gcc won't error out when +# passed parameters like -fstack-protector but no ssp is found +do_gcc_stub() { + local v stub_patch="" + for v in ${GCC_RELEASE_VER} ${GCC_BRANCH_VER} ; do + stub_patch=${GCC_FILESDIR}/stubs/gcc-${v}-$1-stub.patch + if [[ -e ${stub_patch} ]] && ! use vanilla ; then + EPATCH_SINGLE_MSG="Applying stub patch for $1 ..." \ + epatch "${stub_patch}" + return 0 + fi + done +} + +do_gcc_HTB_patches() { + if ! want_boundschecking || \ + (want_ssp && [[ ${HTB_EXCLUSIVE} == "true" ]]) + then + do_gcc_stub htb + return 0 + fi + + # modify the bounds checking patch with a regression patch + epatch "${WORKDIR}/bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch" + BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, HTB-${HTB_GCC_VER}-${HTB_VER}" +} + +# patch in ProPolice Stack Smashing protection +do_gcc_SSP_patches() { + # PARISC has no love ... it's our stack :( + if [[ $(tc-arch) == "hppa" ]] || \ + ! want_ssp || \ + (want_boundschecking && [[ ${HTB_EXCLUSIVE} == "true" ]]) + then + do_gcc_stub ssp + return 0 + fi + + local ssppatch + local sspdocs + + if [[ -n ${PP_FVER} ]] ; then + # Etoh keeps changing where files are and what the patch is named + if tc_version_is_at_least 3.4.1 ; then + # >3.4.1 uses version in patch name, and also includes docs + ssppatch="${S}/gcc_${PP_VER}.dif" + sspdocs="yes" + elif tc_version_is_at_least 3.4.0 ; then + # >3.4 put files where they belong and 3_4 uses old patch name + ssppatch="${S}/protector.dif" + sspdocs="no" + elif tc_version_is_at_least 3.2.3 ; then + # earlier versions have no directory structure or docs + mv "${S}"/protector.{c,h} "${S}"/gcc + ssppatch="${S}/protector.dif" + sspdocs="no" + fi + else + # Just start packaging the damn thing ourselves + mv "${WORKDIR}"/ssp/protector.{c,h} "${S}"/gcc/ + ssppatch=${WORKDIR}/ssp/gcc-${PP_GCC_VER}-ssp.patch + # allow boundschecking and ssp to get along + (want_boundschecking && [[ -e ${WORKDIR}/ssp/htb-ssp.patch ]]) \ + && patch -s "${ssppatch}" "${WORKDIR}"/ssp/htb-ssp.patch + fi + + [[ -z ${ssppatch} ]] && die "Sorry, SSP is not supported in this version" + epatch ${ssppatch} + + if [[ ${PN} == "gcc" && ${sspdocs} == "no" ]] ; then + epatch "${GCC_FILESDIR}"/pro-police-docs.patch + fi + + # Don't build crtbegin/end with ssp + sed -e 's|^CRTSTUFF_CFLAGS = |CRTSTUFF_CFLAGS = -fno-stack-protector |'\ + -i gcc/Makefile.in || die "Failed to update crtstuff!" + + # if gcc in a stage3 defaults to ssp, is version 3.4.0 and a stage1 is built + # the build fails building timevar.o w/: + # cc1: stack smashing attack in function ix86_split_to_parts() + if use build && tc_version_is_at_least 3.4.0 ; then + if gcc -dumpspecs | grep -q "fno-stack-protector:" ; then + epatch "${GCC_FILESDIR}"/3.4.0/gcc-3.4.0-cc1-no-stack-protector.patch + fi + fi + + BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, ssp-${PP_FVER:-${PP_GCC_VER}-${PP_VER}}" + if want_libssp ; then + update_gcc_for_libssp + else + update_gcc_for_libc_ssp + fi + + # Don't build libgcc with ssp + sed -e 's|^\(LIBGCC2_CFLAGS.*\)$|\1 -fno-stack-protector|' \ + -i gcc/Makefile.in || die "Failed to update gcc!" +} + +# If glibc or uclibc has been patched to provide the necessary symbols itself, +# then lets use those for SSP instead of libgcc. +update_gcc_for_libc_ssp() { + if libc_has_ssp ; then + einfo "Updating gcc to use SSP from libc ..." + sed -e 's|^\(LIBGCC2_CFLAGS.*\)$|\1 -D_LIBC_PROVIDES_SSP_|' \ + -i "${S}"/gcc/Makefile.in || die "Failed to update gcc!" + fi +} + +# a split out non-libc non-libgcc ssp requires additional spec logic changes +update_gcc_for_libssp() { + einfo "Updating gcc to use SSP from libssp..." + sed -e 's|^\(INTERNAL_CFLAGS.*\)$|\1 -D_LIBSSP_PROVIDES_SSP_|' \ + -i "${S}"/gcc/Makefile.in || die "Failed to update gcc!" +} + +# do various updates to PIE logic +do_gcc_PIE_patches() { + if ! want_pie || \ + (want_boundschecking && [[ ${HTB_EXCLUSIVE} == "true" ]]) + then + return 0 + fi + + want_boundschecking \ + && rm -f "${WORKDIR}"/piepatch/*/*-boundschecking-no.patch* \ + || rm -f "${WORKDIR}"/piepatch/*/*-boundschecking-yes.patch* + + use vanilla && return 0 + + if tc_version_is_at_least 4.3.2; then + guess_patch_type_in_dir "${WORKDIR}"/piepatch/ + EPATCH_MULTI_MSG="Applying pie patches ..." \ + epatch "${WORKDIR}"/piepatch/ + else + guess_patch_type_in_dir "${WORKDIR}"/piepatch/upstream + + # corrects startfile/endfile selection and shared/static/pie flag usage + EPATCH_MULTI_MSG="Applying upstream pie patches ..." \ + epatch "${WORKDIR}"/piepatch/upstream + # adds non-default pie support (rs6000) + EPATCH_MULTI_MSG="Applying non-default pie patches ..." \ + epatch "${WORKDIR}"/piepatch/nondef + # adds default pie support (rs6000 too) if DEFAULT_PIE[_SSP] is defined + EPATCH_MULTI_MSG="Applying default pie patches ..." \ + epatch "${WORKDIR}"/piepatch/def + + # we want to be able to control the pie patch logic via something other + # than ALL_CFLAGS... + sed -e '/^ALL_CFLAGS/iHARD_CFLAGS = ' \ + -e 's|^ALL_CFLAGS = |ALL_CFLAGS = $(HARD_CFLAGS) |' \ + -i "${S}"/gcc/Makefile.in + fi + + BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, pie-${PIE_VER}" +} + +should_we_gcc_config() { + # we always want to run gcc-config if we're bootstrapping, otherwise + # we might get stuck with the c-only stage1 compiler + use bootstrap && return 0 + use build && return 0 + + # if the current config is invalid, we definitely want a new one + # Note: due to bash quirkiness, the following must not be 1 line + local curr_config + curr_config=$(env -i ROOT="${ROOT}" gcc-config -c ${CTARGET} 2>&1) || return 0 + + # if the previously selected config has the same major.minor (branch) as + # the version we are installing, then it will probably be uninstalled + # for being in the same SLOT, make sure we run gcc-config. + local curr_config_ver=$(env -i ROOT="${ROOT}" gcc-config -S ${curr_config} | awk '{print $2}') + + local curr_branch_ver=$(get_version_component_range 1-2 ${curr_config_ver}) + + # If we're using multislot, just run gcc-config if we're installing + # to the same profile as the current one. + use multislot && return $([[ ${curr_config_ver} == ${GCC_CONFIG_VER} ]]) + + if [[ ${curr_branch_ver} == ${GCC_BRANCH_VER} ]] ; then + return 0 + else + # if we're installing a genuinely different compiler version, + # we should probably tell the user -how- to switch to the new + # gcc version, since we're not going to do it for him/her. + # We don't want to switch from say gcc-3.3 to gcc-3.4 right in + # the middle of an emerge operation (like an 'emerge -e world' + # which could install multiple gcc versions). + einfo "The current gcc config appears valid, so it will not be" + einfo "automatically switched for you. If you would like to" + einfo "switch to the newly installed gcc version, do the" + einfo "following:" + echo + einfo "gcc-config ${CTARGET}-${GCC_CONFIG_VER}" + einfo "source /etc/profile" + echo + ebeep + return 1 + fi +} + +do_gcc_config() { + if ! should_we_gcc_config ; then + env -i ROOT="${ROOT}" gcc-config --use-old --force + return 0 + fi + + local current_gcc_config="" current_specs="" use_specs="" + + current_gcc_config=$(env -i ROOT="${ROOT}" gcc-config -c ${CTARGET} 2>/dev/null) + if [[ -n ${current_gcc_config} ]] ; then + # figure out which specs-specific config is active + current_specs=$(gcc-config -S ${current_gcc_config} | awk '{print $3}') + [[ -n ${current_specs} ]] && use_specs=-${current_specs} + fi + if [[ -n ${use_specs} ]] && \ + [[ ! -e ${ROOT}/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}${use_specs} ]] + then + ewarn "The currently selected specs-specific gcc config," + ewarn "${current_specs}, doesn't exist anymore. This is usually" + ewarn "due to enabling/disabling hardened or switching to a version" + ewarn "of gcc that doesnt create multiple specs files. The default" + ewarn "config will be used, and the previous preference forgotten." + ebeep + epause + use_specs="" + fi + + gcc-config ${CTARGET}-${GCC_CONFIG_VER}${use_specs} +} + +should_we_eselect_compiler() { + # we always want to run gcc-config if we're bootstrapping, otherwise + # we might get stuck with the c-only stage1 compiler + use bootstrap && return 0 + use build && return 0 + + # if the current config is invalid, we definitely want a new one + # Note: due to bash quirkiness, the following must not be 1 line + local curr_config + curr_config=$(env -i eselect compiler show ${CTARGET} 2>&1) || return 0 + [[ -z ${curr_config} || ${curr_config} == "(none)" ]] && return 0 + + # if the previously selected config has the same major.minor (branch) as + # the version we are installing, then it will probably be uninstalled + # for being in the same SLOT, make sure we run gcc-config. + local curr_config_ver=$(echo ${curr_config} | cut -f1 -d/ | awk -F - '{ print $5 }') + local curr_branch_ver=$(get_version_component_range 1-2 ${curr_config_ver}) + + # If we're using multislot, just run gcc-config if we're installing + # to the same profile as the current one. + use multislot && return $([[ ${curr_config_ver} == ${GCC_CONFIG_VER} ]]) + + if [[ ${curr_branch_ver} == ${GCC_BRANCH_VER} ]] ; then + return 0 + else + # if we're installing a genuinely different compiler version, + # we should probably tell the user -how- to switch to the new + # gcc version, since we're not going to do it for him/her. + # We don't want to switch from say gcc-3.3 to gcc-3.4 right in + # the middle of an emerge operation (like an 'emerge -e world' + # which could install multiple gcc versions). + einfo "The current gcc config appears valid, so it will not be" + einfo "automatically switched for you. If you would like to" + einfo "switch to the newly installed gcc version, do the" + einfo "following:" + echo + einfo "eselect compiler set " + echo + ebeep + return 1 + fi +} + +do_eselect_compiler() { + if ! should_we_eselect_compiler; then + eselect compiler update + return 0 + fi + + for abi in $(get_all_abis) ; do + local ctarget=$(get_abi_CHOST ${abi}) + local current_specs=$(env -i eselect compiler show ${ctarget} | cut -f2 -d/) + + if [[ -n ${current_specs} && ${current_specs} != "(none)" ]] && eselect compiler set ${CTARGET}-${GCC_CONFIG_VER}/${current_specs} &> /dev/null; then + einfo "The following compiler profile has been activated based on your previous profile:" + einfo "${CTARGET}-${GCC_CONFIG_VER}/${current_specs}" + else + # We couldn't choose based on the old specs, so fall back on vanilla/hardened based on USE + + local spec + if use hardened ; then + spec="hardened" + else + spec="vanilla" + fi + + local profile + local isset=0 + for profile in "${current_specs%-*}-${spec}" "${abi}-${spec}" "${spec}" ; do + if eselect compiler set ${CTARGET}-${GCC_CONFIG_VER}/${profile} &> /dev/null ; then + ewarn "The newly installed version of gcc does not have a profile that matches the name of your" + ewarn "currently selected profile for ${ctarget}, so we have enabled the following instead:" + ewarn "${CTARGET}-${GCC_CONFIG_VER}/${profile}" + ewarn "If this is incorrect, please use 'eselect compiler set' to" + ewarn "select another profile." + + isset=1 + break + fi + done + + if [[ ${isset} == 0 ]] ; then + eerror "We were not able to automatically set the current compiler for ${ctarget}" + eerror "to your newly emerged gcc. Please use 'eselect compiler set'" + eerror "to select your compiler." + fi + fi + done +} + +# This function allows us to gentoo-ize gcc's version number and bugzilla +# URL without needing to use patches. +gcc_version_patch() { + # gcc-4.3+ has configure flags (whoo!) + tc_version_is_at_least 4.3 && return 0 + + local version_string=${GCC_CONFIG_VER} + [[ -n ${BRANCH_UPDATE} ]] && version_string="${version_string} ${BRANCH_UPDATE}" + + einfo "patching gcc version: ${version_string} (${BRANDING_GCC_PKGVERSION})" + + if grep -qs VERSUFFIX "${S}"/gcc/version.c ; then + sed -i -e "s~VERSUFFIX \"\"~VERSUFFIX \" (${BRANDING_GCC_PKGVERSION})\"~" \ + "${S}"/gcc/version.c || die "failed to update VERSUFFIX with Gentoo branding" + else + version_string="${version_string} (${BRANDING_GCC_PKGVERSION})" + sed -i -e "s~\(const char version_string\[\] = \"\).*\(\".*\)~\1$version_string\2~" \ + "${S}"/gcc/version.c || die "failed to update version.c with Gentoo branding." + fi + sed -i -e 's~gcc\.gnu\.org\/bugs\.html~bugs\.gentoo\.org\/~' \ + "${S}"/gcc/version.c || die "Failed to change the bug URL" +} + +# The purpose of this DISGUSTING gcc multilib hack is to allow 64bit libs +# to live in lib instead of lib64 where they belong, with 32bit libraries +# in lib32. This hack has been around since the beginning of the amd64 port, +# and we're only now starting to fix everything that's broken. Eventually +# this should go away. +# +# Travis Tilley (03 Sep 2004) +# +disgusting_gcc_multilib_HACK() { + local config + local libdirs + if has_multilib_profile ; then + case $(tc-arch) in + amd64) + config="i386/t-linux64" + libdirs="../$(get_abi_LIBDIR amd64) ../$(get_abi_LIBDIR x86)" \ + ;; + ppc64) + config="rs6000/t-linux64" + libdirs="../$(get_abi_LIBDIR ppc64) ../$(get_abi_LIBDIR ppc)" \ + ;; + esac + else + die "Your profile is no longer supported by portage." + fi + + einfo "updating multilib directories to be: ${libdirs}" + sed -i -e "s:^MULTILIB_OSDIRNAMES.*:MULTILIB_OSDIRNAMES = ${libdirs}:" "${S}"/gcc/config/${config} +} + +disable_multilib_libjava() { + if is_gcj ; then + # We dont want a multilib libjava, so lets use this hack taken from fedora + pushd "${S}" > /dev/null + sed -i -e 's/^all: all-redirect/ifeq (\$(MULTISUBDIR),)\nall: all-redirect\nelse\nall:\n\techo Multilib libjava build disabled\nendif/' libjava/Makefile.in + sed -i -e 's/^install: install-redirect/ifeq (\$(MULTISUBDIR),)\ninstall: install-redirect\nelse\ninstall:\n\techo Multilib libjava install disabled\nendif/' libjava/Makefile.in + sed -i -e 's/^check: check-redirect/ifeq (\$(MULTISUBDIR),)\ncheck: check-redirect\nelse\ncheck:\n\techo Multilib libjava check disabled\nendif/' libjava/Makefile.in + sed -i -e 's/^all: all-recursive/ifeq (\$(MULTISUBDIR),)\nall: all-recursive\nelse\nall:\n\techo Multilib libjava build disabled\nendif/' libjava/Makefile.in + sed -i -e 's/^install: install-recursive/ifeq (\$(MULTISUBDIR),)\ninstall: install-recursive\nelse\ninstall:\n\techo Multilib libjava install disabled\nendif/' libjava/Makefile.in + sed -i -e 's/^check: check-recursive/ifeq (\$(MULTISUBDIR),)\ncheck: check-recursive\nelse\ncheck:\n\techo Multilib libjava check disabled\nendif/' libjava/Makefile.in + popd > /dev/null + fi +} + +# make sure the libtool archives have libdir set to where they actually +# -are-, and not where they -used- to be. also, any dependencies we have +# on our own .la files need to be updated. +fix_libtool_libdir_paths() { + pushd "${D}" >/dev/null + + pushd "./${1}" >/dev/null + local dir="${PWD#${D%/}}" + local allarchives=$(echo *.la) + allarchives="\(${allarchives// /\\|}\)" + popd >/dev/null + + sed -i \ + -e "/^libdir=/s:=.*:='${dir}':" \ + ./${dir}/*.la + sed -i \ + -e "/^dependency_libs=/s:/[^ ]*/${allarchives}:${LIBPATH}/\1:g" \ + $(find ./${PREFIX}/lib* -maxdepth 3 -name '*.la') \ + ./${dir}/*.la + + popd >/dev/null +} + +is_multilib() { + [[ ${GCCMAJOR} < 3 ]] && return 1 + case ${CTARGET} in + mips64*|powerpc64*|s390x*|sparc*|x86_64*) + has_multilib_profile || use multilib ;; + *-*-solaris*) use multilib ;; + *-apple-darwin*) use multilib ;; + *) false ;; + esac +} + +is_cxx() { + gcc-lang-supported 'c++' || return 1 + ! use nocxx +} + +is_d() { + gcc-lang-supported d || return 1 + use d +} + +is_f77() { + gcc-lang-supported f77 || return 1 + use fortran +} + +is_f95() { + gcc-lang-supported f95 || return 1 + use fortran +} + +is_fortran() { + gcc-lang-supported fortran || return 1 + use fortran +} + +is_gcj() { + gcc-lang-supported java || return 1 + use gcj +} + +is_libffi() { + has libffi ${IUSE} || return 1 + use libffi +} + +is_objc() { + gcc-lang-supported objc || return 1 + use objc +} + +is_objcxx() { + gcc-lang-supported 'obj-c++' || return 1 + use objc++ +} + +is_ada() { + gcc-lang-supported ada || return 1 + use ada +} + +is_treelang() { + has boundschecking ${IUSE} && use boundschecking && return 1 #260532 + is_crosscompile && return 1 #199924 + gcc-lang-supported treelang || return 1 + #use treelang + return 0 +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/twisted.eclass b/sdk_container/src/third_party/portage-stable/eclass/twisted.eclass new file mode 100644 index 0000000000..392ad28558 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/twisted.eclass @@ -0,0 +1,118 @@ +# Copyright 2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License, v2 or later +# $Header: /var/cvsroot/gentoo-x86/eclass/twisted.eclass,v 1.7 2009/10/30 13:14:17 arfrever Exp $ +# +# Author: Marien Zwart +# +# eclass to aid installing and testing twisted packages. +# +# you should set MY_PACKAGE to something like 'Names' before inheriting. +# you may set MY_PV to the right version (defaults to PV). +# +# twisted_src_test relies on the package installing twisted.names to +# have a ${PN} of twisted-names. + +inherit distutils eutils versionator + +MY_PV="${MY_PV:-${PV}}" +MY_VERSION="$(get_version_component_range 1-2 ${MY_PV})" +MY_P="Twisted${MY_PACKAGE}-${MY_PV}" + +HOMEPAGE="http://www.twistedmatrix.com/" +SRC_URI="http://tmrc.mit.edu/mirror/twisted/${MY_PACKAGE}/${MY_VERSION}/${MY_P}.tar.bz2" + +LICENSE="MIT" +SLOT="0" +IUSE="" + +S="${WORKDIR}/${MY_P}" + +twisted_src_test() { + if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then + testing() { + # This is a hack to make tests work without installing to the live + # filesystem. We copy the twisted site-packages to a temporary + # dir, install there, and run from there. + local spath="$(python_get_sitedir)" + mkdir -p "${T}/${spath}" + cp -R "${ROOT}${spath}/twisted" "${T}/${spath}" || die "Copying of files failed with Python ${PYTHON_ABI}" + + # We have to get rid of the existing version of this package + # instead of just installing on top of it, since if the existing + # package has tests in files the version we are installing does + # not have we end up running e.g. twisted-names-0.3.0 tests when + # downgrading to twisted-names-0.1.0-r1. + rm -fr "${T}/${spath}/${PN/-//}" + + "$(PYTHON)" setup.py build -b "build-${PYTHON_ABI}" install --root="${T}" --no-compile --force || die "Installation for tests failed with Python ${PYTHON_ABI}" + cd "${T}/${spath}" || die + PATH="${T}/usr/bin:${PATH}" PYTHONPATH="${T}/${spath}" trial ${PN/-/.} || die "trial failed with Python ${PYTHON_ABI}" + cd "${S}" + rm -fr "${T}/${spath}" + } + python_execute_function testing + else + # This is a hack to make tests work without installing to the live + # filesystem. We copy the twisted site-packages to a temporary + # dir, install there, and run from there. + local spath="$(python_get_sitedir)" + mkdir -p "${T}/${spath}" + cp -R "${ROOT}${spath}/twisted" "${T}/${spath}" || die + + # We have to get rid of the existing version of this package + # instead of just installing on top of it, since if the existing + # package has tests in files the version we are installing does + # not have we end up running fex twisted-names-0.3.0 tests when + # downgrading to twisted-names-0.1.0-r1. + rm -rf "${T}/${spath}/${PN/-//}" + + "${python}" setup.py install --root="${T}" --no-compile --force || die + cd "${T}/${spath}" || die + PATH="${T}/usr/bin:${PATH}" PYTHONPATH="${T}/${spath}" \ + trial ${PN/-/.} || die "trial failed" + cd "${S}" + rm -rf "${T}/${spath}" + fi +} + +twisted_src_install() { + distutils_src_install + + if [[ -d doc/man ]]; then + doman doc/man/* + fi + + if [[ -d doc ]]; then + insinto /usr/share/doc/${PF} + doins -r $(find doc -mindepth 1 -maxdepth 1 -not -name man) + fi +} + +update_plugin_cache() { + einfo "Updating twisted plugin cache..." + # we have to remove the cache or removed plugins won't be removed + # from the cache (http://twistedmatrix.com/bugs/issue926) + rm "${ROOT}$(python_get_sitedir)/twisted/plugins/dropin.cache" + # notice we have to use getPlugIns here for <=twisted-2.0.1 compatibility + python -c "from twisted.plugin import IPlugin, getPlugIns;list(getPlugIns(IPlugin))" +} + +twisted_pkg_postrm() { + distutils_pkg_postrm + if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then + python_execute_function update_plugin_cache + else + update_plugin_cache + fi +} + +twisted_pkg_postinst() { + distutils_pkg_postinst + if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then + python_execute_function update_plugin_cache + else + update_plugin_cache + fi +} + +EXPORT_FUNCTIONS src_test src_install pkg_postrm pkg_postinst diff --git a/sdk_container/src/third_party/portage-stable/eclass/unipatch-001.eclass b/sdk_container/src/third_party/portage-stable/eclass/unipatch-001.eclass new file mode 100644 index 0000000000..905a79ace1 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/unipatch-001.eclass @@ -0,0 +1,7 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/unipatch-001.eclass,v 1.7 2009/11/30 04:19:36 abcd Exp $ + +# @DEAD +# To be removed on 2011/11/30. +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" diff --git a/sdk_container/src/third_party/portage-stable/eclass/vdr-plugin.eclass b/sdk_container/src/third_party/portage-stable/eclass/vdr-plugin.eclass new file mode 100644 index 0000000000..e00c9559ee --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/vdr-plugin.eclass @@ -0,0 +1,613 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/vdr-plugin.eclass,v 1.71 2009/10/11 11:49:05 maekke Exp $ +# +# Author: +# Matthias Schwarzott +# Joerg Bornkessel + +# vdr-plugin.eclass +# +# eclass to create ebuilds for vdr plugins +# + +# Example ebuild (basic version without patching): +# +# EAPI="2" +# inherit vdr-plugin +# IUSE="" +# SLOT="0" +# DESCRIPTION="vdr Plugin: DVB Frontend Status Monitor (signal strengt/noise)" +# HOMEPAGE="http://www.saunalahti.fi/~rahrenbe/vdr/femon/" +# SRC_URI="http://www.saunalahti.fi/~rahrenbe/vdr/femon/files/${P}.tgz" +# LICENSE="GPL-2" +# KEYWORDS="~x86" +# DEPEND=">=media-video/vdr-1.6.0" +# +# + +# For patching you should modify src_prepare phase: +# +# src_prepare() { +# epatch "${FILESDIR}"/${P}-xxx.patch +# vdr-plugin_src_prepare +# } + +# Installation of a config file for the plugin +# +# If ${VDR_CONFD_FILE} is set install this file +# else install ${FILESDIR}/confd if it exists. + +# Gets installed as /etc/conf.d/vdr.${VDRPLUGIN}. +# For the plugin vdr-femon this would be /etc/conf.d/vdr.femon + + +# Installation of an rc-addon file for the plugin +# +# If ${VDR_RCADDON_FILE} is set install this file +# else install ${FILESDIR}/rc-addon.sh if it exists. +# +# Gets installed under ${VDR_RC_DIR}/plugin-${VDRPLUGIN}.sh +# (in example vdr-femon this would be /usr/share/vdr/rcscript/plugin-femon.sh) +# +# This file is sourced by the startscript when plugin is activated in /etc/conf.d/vdr +# It could be used for special startup actions for this plugins, or to create the +# plugin command line options from a nicer version of a conf.d file. + +# HowTo use own local patches; Example +# +# Add to your /etc/make.conf: +# VDR_LOCAL_PATCHES_DIR="/usr/local/patch" +# +# Add two DIR's in your local patch dir, ${PN}/${PV}, +# e.g for vdr-burn-0.1.0 should be: +# /usr/local/patch/vdr-burn/0.1.0/ +# +# all patches which ending on diff or patch in this DIR will automatically applied +# + +inherit base multilib eutils flag-o-matic + +IUSE="" + +# Name of the plugin stripped from all vdrplugin-, vdr- and -cvs pre- and postfixes +VDRPLUGIN="${PN/#vdrplugin-/}" +VDRPLUGIN="${VDRPLUGIN/#vdr-/}" +VDRPLUGIN="${VDRPLUGIN/%-cvs/}" + +DESCRIPTION="vdr Plugin: ${VDRPLUGIN} (based on vdr-plugin.eclass)" + +# works in most cases +S="${WORKDIR}/${VDRPLUGIN}-${PV}" + +# depend on headers for DVB-driver +COMMON_DEPEND=">=media-tv/gentoo-vdr-scripts-0.4.2" + +DEPEND="${COMMON_DEPEND} + media-tv/linuxtv-dvb-headers" +RDEPEND="${COMMON_DEPEND} + >=app-admin/eselect-vdr-0.0.2" + +# this is a hack for ebuilds like vdr-xineliboutput that want to +# conditionally install a vdr-plugin +if [[ "${GENTOO_VDR_CONDITIONAL:-no}" = "yes" ]]; then + # make DEPEND conditional + IUSE="${IUSE} vdr" + DEPEND="vdr? ( ${DEPEND} )" + RDEPEND="vdr? ( ${RDEPEND} )" +fi + +# New method of storing plugindb +# Called from src_install +# file maintained by normal portage-methods +create_plugindb_file() { + local NEW_VDRPLUGINDB_DIR=/usr/share/vdr/vdrplugin-rebuild/ + local DB_FILE="${NEW_VDRPLUGINDB_DIR}/${CATEGORY}-${PF}" + insinto "${NEW_VDRPLUGINDB_DIR}" + +# BUG: portage-2.1.4_rc9 will delete the EBUILD= line, so we cannot use this code. +# cat <<-EOT > "${D}/${DB_FILE}" +# VDRPLUGIN_DB=1 +# CREATOR=ECLASS +# EBUILD=${CATEGORY}/${PN} +# EBUILD_V=${PVR} +# EOT + { + echo "VDRPLUGIN_DB=1" + echo "CREATOR=ECLASS" + echo "EBUILD=${CATEGORY}/${PN}" + echo "EBUILD_V=${PVR}" + echo "PLUGINS=\"$@\"" + } > "${D}/${DB_FILE}" +} + +# Delete files created outside of vdr-plugin.eclass +# vdrplugin-rebuild.ebuild converted plugindb and files are +# not deleted by portage itself - should only be needed as +# long as not every system has switched over to +# vdrplugin-rebuild-0.2 / gentoo-vdr-scripts-0.4.2 +delete_orphan_plugindb_file() { + #elog Testing for orphaned plugindb file + local NEW_VDRPLUGINDB_DIR=/usr/share/vdr/vdrplugin-rebuild/ + local DB_FILE="${ROOT}/${NEW_VDRPLUGINDB_DIR}/${CATEGORY}-${PF}" + + # file exists + [[ -f ${DB_FILE} ]] || return + + # will portage handle the file itself + if grep -q CREATOR=ECLASS "${DB_FILE}"; then + #elog file owned by eclass - don't touch it + return + fi + + elog "Removing orphaned plugindb-file." + elog "\t#rm ${DB_FILE}" + rm "${DB_FILE}" +} + + +create_header_checksum_file() +{ + # Danger: Not using $ROOT here, as compile will also not use it !!! + # If vdr in $ROOT and / differ, plugins will not run anyway + + local CHKSUM="header-md5-vdr" + + if [[ -f ${VDR_CHECKSUM_DIR}/header-md5-vdr ]]; then + cp "${VDR_CHECKSUM_DIR}/header-md5-vdr" "${CHKSUM}" + elif type -p md5sum >/dev/null 2>&1; then + ( + cd "${VDR_INCLUDE_DIR}" + md5sum *.h libsi/*.h|LC_ALL=C sort --key=2 + ) > "${CHKSUM}" + else + die "Could not create md5 checksum of headers" + fi + + insinto "${VDR_CHECKSUM_DIR}" + local p_name + for p_name; do + newins "${CHKSUM}" "header-md5-${p_name}" + done +} + +fix_vdr_libsi_include() +{ + #einfo "Fixing include of libsi-headers" + local f + for f; do + sed -i "${f}" \ + -e '/#include/s:"\(.*libsi.*\)":<\1>:' \ + -e '/#include/s:<.*\(libsi/.*\)>::' + done +} + +vdr_patchmakefile() { + einfo "Patching Makefile" + [[ -e Makefile ]] || die "Makefile of plugin can not be found!" + cp Makefile "${WORKDIR}"/Makefile.before + + # plugin makefiles use VDRDIR in strange ways + # assumptions: + # 1. $(VDRDIR) contains Make.config + # 2. $(VDRDIR) contains config.h + # 3. $(VDRDIR)/include/vdr contains the headers + # 4. $(VDRDIR) contains main vdr Makefile + # 5. $(VDRDIR)/locale exists + # 6. $(VDRDIR) allows to access vdr source files + # + # We only have one directory (for now /usr/include/vdr), + # that contains vdr-headers and Make.config. + # To satisfy 1-3 we do this: + # Set VDRDIR=/usr/include/vdr + # Set VDRINCDIR=/usr/include + # Change $(VDRDIR)/include to $(VDRINCDIR) + + sed -i Makefile \ + -e "s:^VDRDIR.*$:VDRDIR = ${VDR_INCLUDE_DIR}:" \ + -e "/^VDRDIR/a VDRINCDIR = ${VDR_INCLUDE_DIR%/vdr}" \ + -e '/VDRINCDIR.*=/!s:$(VDRDIR)/include:$(VDRINCDIR):' \ + \ + -e 's:-I$(DVBDIR)/include::' \ + -e 's:-I$(DVBDIR)::' + + # maybe needed for multiproto: + #sed -i Makefile \ + # -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \ + # -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):' + + if ! grep -q APIVERSION Makefile; then + ebegin " Converting to APIVERSION" + sed -i Makefile \ + -e 's:^APIVERSION = :APIVERSION ?= :' \ + -e 's:$(LIBDIR)/$@.$(VDRVERSION):$(LIBDIR)/$@.$(APIVERSION):' \ + -e '/VDRVERSION =/a\APIVERSION = $(shell sed -ne '"'"'/define APIVERSION/s/^.*"\\(.*\\)".*$$/\\1/p'"'"' $(VDRDIR)/config.h)' + eend $? + fi + + # Correcting Compile-Flags + # Do not overwrite CXXFLAGS, add LDFLAGS if missing + sed -i Makefile \ + -e '/^CXXFLAGS[[:space:]]*=/s/=/?=/' \ + -e '/LDFLAGS/!s:-shared:$(LDFLAGS) -shared:' + + # Disabling file stripping, useful for debugging + sed -i Makefile \ + -e '/@.*strip/d' \ + -e '/strip \$(LIBDIR)\/\$@/d' \ + -e 's/STRIP.*=.*$/STRIP = true/' + + # Use a file instead of a variable as single-stepping via ebuild + # destroys environment. + touch "${WORKDIR}"/.vdr-plugin_makefile_patched +} + +vdr_add_local_patch() { + if test -d "${VDR_LOCAL_PATCHES_DIR}/${PN}"; then + echo + einfo "Applying local patches" + for LOCALPATCH in "${VDR_LOCAL_PATCHES_DIR}/${PN}/${PV}"/*.{diff,patch}; do + test -f "${LOCALPATCH}" && epatch "${LOCALPATCH}" + done + fi +} + +vdr_has_gettext() { + has_version ">=media-video/vdr-1.5.7" +} + +plugin_has_gettext() { + [[ -d po ]] +} + +vdr_i18n_convert_to_gettext() { + local i18n_tool="${ROOT}/usr/share/vdr/bin/i18n-to-gettext.pl" + + if [[ ${NO_GETTEXT_HACK} == "1" ]]; then + ewarn "Conversion to gettext disabled in ebuild" + return 1 + fi + + if [[ ! -x ${i18n_tool} ]]; then + eerror "Missing ${i18n_tool}" + eerror "Please re-emerge vdr" + die "Missing ${i18n_tool}" + fi + + ebegin "Auto converting translations to gettext" + # call i18n-to-gettext tool + # take all texts missing tr call into special file + "${i18n_tool}" 2>/dev/null \ + |sed -e '/^"/!d' \ + -e '/^""$/d' \ + -e 's/\(.*\)/trNOOP(\1)/' \ + > dummy-translations-trNOOP.c + + # if there were untranslated texts just run it again + # now the missing calls are listed in + # dummy-translations-trNOOP.c + if [[ -s dummy-translations-trNOOP.c ]]; then + "${i18n_tool}" &>/dev/null + fi + + # now use the modified Makefile + if [[ -f Makefile.new ]]; then + mv Makefile.new Makefile + eend 0 "" + else + eend 1 "Conversion to gettext failed. Plugin needs fixing." + return 1 + fi +} + +vdr_i18n_disable_gettext() { + #einfo "Disabling gettext support in plugin" + + # Remove i18n Target if using older vdr + sed -i Makefile \ + -e '/^all:/s/ i18n//' +} + +vdr_i18n() { + if vdr_has_gettext; then + #einfo "VDR has gettext support" + if plugin_has_gettext; then + #einfo "Plugin has gettext support, fine" + if [[ ${NO_GETTEXT_HACK} == "1" ]]; then + ewarn "Please remove unneeded NO_GETTEXT_HACK from ebuild." + fi + else + vdr_i18n_convert_to_gettext + if [[ $? != 0 ]]; then + eerror "" + eerror "Plugin will have only english OSD texts" + eerror "it needs manual fixing." + fi + fi + else + #einfo "VDR has no gettext support" + if plugin_has_gettext; then + vdr_i18n_disable_gettext + fi + fi +} + +vdr-plugin_copy_source_tree() { + pushd . >/dev/null + cp -r "${S}" "${T}"/source-tree + cd "${T}"/source-tree + cp "${WORKDIR}"/Makefile.before Makefile + # TODO: Fix this, maybe no longer needed + sed -i Makefile \ + -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \ + -e 's:^CXXFLAGS:#CXXFLAGS:' \ + -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):' \ + -e 's:-I$(VDRDIR) -I$(DVBDIR):-I$(DVBDIR) -I$(VDRDIR):' + popd >/dev/null +} + +vdr-plugin_install_source_tree() { + einfo "Installing sources" + destdir="${VDRSOURCE_DIR}/vdr-${VDRVERSION}/PLUGINS/src/${VDRPLUGIN}" + insinto "${destdir}-${PV}" + doins -r "${T}"/source-tree/* + + dosym "${VDRPLUGIN}-${PV}" "${destdir}" +} + +vdr-plugin_print_enable_command() { + local p_name c=0 l="" + for p_name in ${vdr_plugin_list}; do + c=$(( c+1 )) + l="$l ${p_name#vdr-}" + done + + elog + case $c in + 1) elog "Installed plugin${l}" ;; + *) elog "Installed $c plugins:${l}" ;; + esac + elog "To activate a plugin execute this command:" + elog "\teselect vdr-plugin enable ..." + elog +} + +has_vdr() { + [[ -f "${VDR_INCLUDE_DIR}"/config.h ]] +} + +## exported functions + +vdr-plugin_pkg_setup() { + # -fPIC is needed for shared objects on some platforms (amd64 and others) + append-flags -fPIC + + # Where should the plugins live in the filesystem + VDR_PLUGIN_DIR="/usr/$(get_libdir)/vdr/plugins" + VDR_CHECKSUM_DIR="${VDR_PLUGIN_DIR%/plugins}/checksums" + + # was /usr/lib/... some time ago + # since gentoo-vdr-scripts-0.3.6 it works with /usr/share/... + VDR_RC_DIR="/usr/share/vdr/rcscript" + + # Pathes to includes + VDR_INCLUDE_DIR="/usr/include/vdr" + DVB_INCLUDE_DIR="/usr/include" + + TMP_LOCALE_DIR="${WORKDIR}/tmp-locale" + LOCDIR="/usr/share/vdr/locale" + + if ! has_vdr; then + # set to invalid values to detect abuses + VDRVERSION="eclass_no_vdr_installed" + APIVERSION="eclass_no_vdr_installed" + + if [[ "${GENTOO_VDR_CONDITIONAL:-no}" = "yes" ]] && ! use vdr; then + einfo "VDR not found!" + else + # if vdr is required + die "VDR not found!" + fi + return + fi + + VDRVERSION=$(awk -F'"' '/define VDRVERSION/ {print $2}' "${VDR_INCLUDE_DIR}"/config.h) + APIVERSION=$(awk -F'"' '/define APIVERSION/ {print $2}' "${VDR_INCLUDE_DIR}"/config.h) + [[ -z ${APIVERSION} ]] && APIVERSION="${VDRVERSION}" + + einfo "Compiling against" + einfo "\tvdr-${VDRVERSION} [API version ${APIVERSION}]" +} + +vdr-plugin_src_util() { + + while [ "$1" ]; do + + case "$1" in + all) + vdr-plugin_src_util unpack add_local_patch patchmakefile i18n + ;; + prepare|all_but_unpack) + vdr-plugin_src_util add_local_patch patchmakefile i18n + ;; + unpack) + base_src_unpack + ;; + add_local_patch) + cd "${S}" || die "Could not change to plugin-source-directory!" + vdr_add_local_patch + ;; + patchmakefile) + cd "${S}" || die "Could not change to plugin-source-directory!" + vdr_patchmakefile + ;; + i18n) + cd "${S}" || die "Could not change to plugin-source-directory!" + vdr_i18n + ;; + esac + + shift + done +} + +vdr-plugin_src_unpack() { + if [[ -z ${VDR_INCLUDE_DIR} ]]; then + eerror "Wrong use of vdr-plugin.eclass." + eerror "An ebuild for a vdr-plugin will not work without calling vdr-plugin_pkg_setup." + echo + eerror "Please report this at bugs.gentoo.org." + die "vdr-plugin_pkg_setup not called!" + fi + if [ -z "$1" ]; then + case "${EAPI:-0}" in + 2) + vdr-plugin_src_util unpack + ;; + *) + vdr-plugin_src_util all + ;; + esac + + else + vdr-plugin_src_util $@ + fi +} + +vdr-plugin_src_prepare() { + base_src_prepare + vdr-plugin_src_util prepare +} + +vdr-plugin_src_compile() { + [ -z "$1" ] && vdr-plugin_src_compile copy_source compile + + while [ "$1" ]; do + + case "$1" in + copy_source) + [[ -n "${VDRSOURCE_DIR}" ]] && vdr-plugin_copy_source_tree + ;; + compile) + if [[ ! -f ${WORKDIR}/.vdr-plugin_makefile_patched ]]; then + eerror "Wrong use of vdr-plugin.eclass." + eerror "An ebuild for a vdr-plugin will not work without" + eerror "calling vdr-plugin_src_unpack to patch the Makefile." + echo + eerror "Please report this at bugs.gentoo.org." + die "vdr-plugin_src_unpack not called!" + fi + cd "${S}" + + BUILD_TARGETS=${BUILD_TARGETS:-${VDRPLUGIN_MAKE_TARGET:-all}} + + emake ${BUILD_PARAMS} \ + ${BUILD_TARGETS} \ + LOCALEDIR="${TMP_LOCALE_DIR}" \ + LIBDIR="${S}" \ + TMPDIR="${T}" \ + || die "emake failed" + ;; + esac + + shift + done +} + +vdr-plugin_src_install() { + [[ -n "${VDRSOURCE_DIR}" ]] && vdr-plugin_install_source_tree + cd "${WORKDIR}" + + if [[ -n ${VDR_MAINTAINER_MODE} ]]; then + local mname="${P}-Makefile" + cp "${S}"/Makefile "${mname}.patched" + cp Makefile.before "${mname}.before" + + diff -u "${mname}.before" "${mname}.patched" > "${mname}.diff" + + insinto "/usr/share/vdr/maintainer-data/makefile-changes" + doins "${mname}.diff" + + insinto "/usr/share/vdr/maintainer-data/makefile-before" + doins "${mname}.before" + + insinto "/usr/share/vdr/maintainer-data/makefile-patched" + doins "${mname}.patched" + + fi + + + + cd "${S}" + insinto "${VDR_PLUGIN_DIR}" + doins libvdr-*.so.* + + # create list of all created plugin libs + vdr_plugin_list="" + local p_name + for p in libvdr-*.so.*; do + p_name="${p%.so*}" + p_name="${p_name#lib}" + vdr_plugin_list="${vdr_plugin_list} ${p_name}" + done + + create_header_checksum_file ${vdr_plugin_list} + create_plugindb_file ${vdr_plugin_list} + + if vdr_has_gettext && [[ -d ${TMP_LOCALE_DIR} ]]; then + einfo "Installing locales" + cd "${TMP_LOCALE_DIR}" + insinto "${LOCDIR}" + doins -r * + fi + + cd "${S}" + local docfile + for docfile in README* HISTORY CHANGELOG; do + [[ -f ${docfile} ]] && dodoc ${docfile} + done + + # if VDR_CONFD_FILE is empty and ${FILESDIR}/confd exists take it + [[ -z ${VDR_CONFD_FILE} ]] && [[ -e ${FILESDIR}/confd ]] && VDR_CONFD_FILE=${FILESDIR}/confd + + if [[ -n ${VDR_CONFD_FILE} ]]; then + newconfd "${VDR_CONFD_FILE}" vdr.${VDRPLUGIN} + fi + + + # if VDR_RCADDON_FILE is empty and ${FILESDIR}/rc-addon.sh exists take it + [[ -z ${VDR_RCADDON_FILE} ]] && [[ -e ${FILESDIR}/rc-addon.sh ]] && VDR_RCADDON_FILE=${FILESDIR}/rc-addon.sh + + if [[ -n ${VDR_RCADDON_FILE} ]]; then + insinto "${VDR_RC_DIR}" + newins "${VDR_RCADDON_FILE}" plugin-${VDRPLUGIN}.sh + fi +} + +vdr-plugin_pkg_postinst() { + vdr-plugin_print_enable_command + + if [[ -n "${VDR_CONFD_FILE}" ]]; then + elog "Please have a look at the config-file" + elog "\t/etc/conf.d/vdr.${VDRPLUGIN}" + elog + fi +} + +vdr-plugin_pkg_postrm() { + delete_orphan_plugindb_file +} + +vdr-plugin_pkg_config() { + ewarn "emerge --config ${PN} is no longer supported" + vdr-plugin_print_enable_command +} + +case "${EAPI:-0}" in + 2) + EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_compile src_install pkg_postinst pkg_postrm pkg_config + ;; + *) + EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst pkg_postrm pkg_config + ;; +esac diff --git a/sdk_container/src/third_party/portage-stable/eclass/vim-doc.eclass b/sdk_container/src/third_party/portage-stable/eclass/vim-doc.eclass new file mode 100644 index 0000000000..62a859be0a --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/vim-doc.eclass @@ -0,0 +1,72 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/vim-doc.eclass,v 1.15 2007/05/14 20:04:07 pioto Exp $ +# +# This eclass is used by vim.eclass and vim-plugin.eclass to update +# the documentation tags. This is necessary since vim doesn't look in +# /usr/share/vim/vimfiles/doc for documentation; it only uses the +# versioned directory, for example /usr/share/vim/vim62/doc +# +# We depend on vim being installed, which is satisfied by either the +# DEPEND in vim-plugin or by whatever version of vim is being +# installed by the eclass. + + +update_vim_helptags() { + local vimfiles vim d s + + # This is where vim plugins are installed + vimfiles="${ROOT}"/usr/share/vim/vimfiles + + if [[ $PN != vim-core ]]; then + # Find a suitable vim binary for updating tags :helptags + vim=$(type -P vim 2>/dev/null) + [[ -z "$vim" ]] && vim=$(type -P gvim 2>/dev/null) + [[ -z "$vim" ]] && vim=$(type -P kvim 2>/dev/null) + if [[ -z "$vim" ]]; then + ewarn "No suitable vim binary to rebuild documentation tags" + fi + fi + + # Make vim not try to connect to X. See :help gui-x11-start + # in vim for how this evil trickery works. + if [[ -n "${vim}" ]] ; then + ln -s "${vim}" "${T}/tagvim" + vim="${T}/tagvim" + fi + + # Install the documentation symlinks into the versioned vim + # directory and run :helptags + for d in "${ROOT}"/usr/share/vim/vim[0-9]*; do + [[ -d "$d/doc" ]] || continue # catch a failed glob + + # Remove links, and possibly remove stale dirs + find $d/doc -name \*.txt -type l | while read s; do + [[ $(readlink "$s") = $vimfiles/* ]] && rm -f "$s" + done + if [[ -f "$d/doc/tags" && $(find "$d" | wc -l | tr -d ' ') = 3 ]]; then + # /usr/share/vim/vim61 + # /usr/share/vim/vim61/doc + # /usr/share/vim/vim61/doc/tags + einfo "Removing $d" + rm -r "$d" + continue + fi + + # Re-create / install new links + if [[ -d $vimfiles/doc ]]; then + ln -s $vimfiles/doc/*.txt $d/doc 2>/dev/null + fi + + # Update tags; need a vim binary for this + if [[ -n "$vim" ]]; then + einfo "Updating documentation tags in $d" + DISPLAY= $vim -u NONE -U NONE -T xterm -X -n -f \ + '+set nobackup nomore' \ + "+helptags $d/doc" \ + '+qa!' /dev/null + fi + done + + [[ -n "${vim}" && -f "${vim}" ]] && rm "${vim}" +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/vim-plugin.eclass b/sdk_container/src/third_party/portage-stable/eclass/vim-plugin.eclass new file mode 100644 index 0000000000..d48dde5043 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/vim-plugin.eclass @@ -0,0 +1,145 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/vim-plugin.eclass,v 1.23 2008/08/30 07:59:18 hawking Exp $ +# +# This eclass simplifies installation of app-vim plugins into +# /usr/share/vim/vimfiles. This is a version-independent directory +# which is read automatically by vim. The only exception is +# documentation, for which we make a special case via vim-doc.eclass + +inherit vim-doc +EXPORT_FUNCTIONS src_install pkg_postinst pkg_postrm + +VIM_PLUGIN_VIM_VERSION="${VIM_PLUGIN_VIM_VERSION:-7.0}" + +IUSE="" +DEPEND="|| ( >=app-editors/vim-${VIM_PLUGIN_VIM_VERSION} + >=app-editors/gvim-${VIM_PLUGIN_VIM_VERSION} )" +RDEPEND="${DEPEND}" +SRC_URI="mirror://gentoo/${P}.tar.bz2" +SLOT="0" + +vim-plugin_src_install() { + local f + + ebegin "Fixing file permissions" + # Make sure perms are good + chmod -R a+rX "${S}" || die "chmod failed" + find "${S}" -user 'portage' -exec chown root '{}' \; || die "chown failed" + if use userland_BSD || use userland_Darwin ; then + find "${S}" -group 'portage' -exec chgrp wheel '{}' \; || die "chgrp failed" + else + find "${S}" -group 'portage' -exec chgrp root '{}' \; || die "chgrp failed" + fi + eend $? + + # Install non-vim-help-docs + cd "${S}" + for f in *; do + [[ -f "${f}" ]] || continue + if [[ "${f}" = *.html ]]; then + dohtml "${f}" + else + dodoc "${f}" + fi + rm -f "${f}" + done + + # Install remainder of plugin + cd "${WORKDIR}" + dodir /usr/share/vim + mv "${S}" "${D}"/usr/share/vim/vimfiles + + # Fix remaining bad permissions + chmod -R -x+X "${D}"/usr/share/vim/vimfiles/ || die "chmod failed" +} + +vim-plugin_pkg_postinst() { + update_vim_helptags # from vim-doc + update_vim_afterscripts # see below + display_vim_plugin_help # see below +} + +vim-plugin_pkg_postrm() { + update_vim_helptags # from vim-doc + update_vim_afterscripts # see below + + # Remove empty dirs; this allows + # /usr/share/vim to be removed if vim-core is unmerged + find /usr/share/vim/vimfiles -depth -type d -exec rmdir {} \; 2>/dev/null +} + +# update_vim_afterscripts: create scripts in +# /usr/share/vim/vimfiles/after/* comprised of the snippets in +# /usr/share/vim/vimfiles/after/*/*.d +update_vim_afterscripts() { + local d f afterdir="${ROOT}"/usr/share/vim/vimfiles/after + + # Nothing to do if the dir isn't there + [ -d "${afterdir}" ] || return 0 + + einfo "Updating scripts in /usr/share/vim/vimfiles/after" + find "${afterdir}" -type d -name \*.vim.d | \ + while read d; do + echo '" Generated by update_vim_afterscripts' > "${d%.d}" + find "${d}" -name \*.vim -type f -maxdepth 1 -print0 | \ + sort -z | xargs -0 cat >> "${d%.d}" + done + + einfo "Removing dead scripts in /usr/share/vim/vimfiles/after" + find "${afterdir}" -type f -name \*.vim | \ + while read f; do + [[ "$(head -n 1 ${f})" == '" Generated by update_vim_afterscripts' ]] \ + || continue + # This is a generated file, but might be abandoned. Check + # if there's no corresponding .d directory, or if the + # file's effectively empty + if [[ ! -d "${f}.d" || -z "$(grep -v '^"' "${f}")" ]]; then + rm -f "${f}" + fi + done +} + +# Display a message with the plugin's help file if one is available. Uses the +# VIM_PLUGIN_HELPFILES env var. If multiple help files are available, they +# should be separated by spaces. If no help files are available, but the env +# var VIM_PLUGIN_HELPTEXT is set, that is displayed instead. Finally, if we +# have nothing else, display a link to VIM_PLUGIN_HELPURI. An extra message +# regarding enabling filetype plugins is displayed if VIM_PLUGIN_MESSAGES +# includes the word "filetype". +display_vim_plugin_help() { + local h + + if [[ -n "${VIM_PLUGIN_HELPFILES}" ]] ; then + elog " " + elog "This plugin provides documentation via vim's help system. To" + elog "view it, use:" + for h in ${VIM_PLUGIN_HELPFILES} ; do + elog " :help ${h}" + done + elog " " + + elif [[ -n "${VIM_PLUGIN_HELPTEXT}" ]] ; then + elog " " + while read h ; do + elog "$h" + done <<<"${VIM_PLUGIN_HELPTEXT}" + elog " " + + elif [[ -n "${VIM_PLUGIN_HELPURI}" ]] ; then + elog " " + elog "Documentation for this plugin is available online at:" + elog " ${VIM_PLUGIN_HELPURI}" + elog " " + fi + + if has "filetype" "${VIM_PLUGIN_MESSAGES}" ; then + elog "This plugin makes use of filetype settings. To enable these," + elog "add lines like:" + elog " filetype plugin on" + elog " filetype indent on" + elog "to your ~/.vimrc file." + elog " " + fi +} + diff --git a/sdk_container/src/third_party/portage-stable/eclass/vim-spell.eclass b/sdk_container/src/third_party/portage-stable/eclass/vim-spell.eclass new file mode 100644 index 0000000000..b6b6a8b66f --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/vim-spell.eclass @@ -0,0 +1,127 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/vim-spell.eclass,v 1.7 2009/07/07 18:54:05 arfrever Exp $ + +# +# Original Author: Ciaran McCreesh +# Maintainers: Vim Herd +# Purpose: Simplify installing spell files for vim7 +# + +# How to make a vim spell file package using prebuilt spell lists +# from upstream (${CODE} is the language's two letter code): +# +# * Get the ${CODE}.*.spl, ${CODE}.*.sug (if your language has them) and +# README_${CODE}.txt files. Currently they're at +# ftp://ftp.vim.org/pub/vim/unstable/runtime/spell/ (except for English, +# which should be taken from CVS instead). +# +# * Stick them in vim-spell-${CODE}-$(date --iso | tr -d - ).tar.bz2 . Make sure +# that they're in the appropriately named subdirectory to avoid having to mess +# with S=. +# +# * Upload the tarball to the Gentoo mirrors. +# +# * (for now) Add your spell file to package.mask next to the other vim7 +# things. The vim herd will handle unmasking your spell packages when vim7 +# comes out of package.mask. +# +# * Create the app-vim/vim-spell-${CODE} package. You should base your ebuild +# upon app-vim/vim-spell-en. You will need to change VIM_SPELL_LANGUAGE, +# KEYWORDS and LICENSE. Check the license carefully! The README will tell +# you what it is. +# +# * Don't forget metadata.xml. You should list vim as the herd, and yourself +# as the maintainer (there is no need to join the vim herd just for spell +# files): +# +# +# +# +# vim +# +# your-name@gentoo.org +# +# +# Vim spell files for French (fr). Supported character sets are +# UTF-8 and latin1. +# +# +# +# * Send an email to vim@gentoo.org to let us know. +# +# Don't forget to update your package as necessary. +# +# If there isn't an upstream-provided pregenerated spell file for your language +# yet, read :help spell.txt from inside vim7 for instructions on how to create +# spell files. It's best to let upstream know if you've generated spell files +# for another language rather than keeping them Gentoo-specific. + +inherit eutils + +EXPORT_FUNCTIONS src_install pkg_postinst + +IUSE="" +DEPEND="|| ( >=app-editors/vim-7_alpha + >=app-editors/gvim-7_alpha )" +RDEPEND="${DEPEND}" +SRC_URI="mirror://gentoo/${P}.tar.bz2" +SLOT="0" + +if [[ -z "${VIM_SPELL_CODE}" ]] ; then + VIM_SPELL_CODE="${PN/vim-spell-/}" +fi + +DESCRIPTION="vim spell files: ${VIM_SPELL_LANGUAGE} (${VIM_SPELL_CODE})" + +if [[ -z "${HOMEPAGE}" ]] ; then + HOMEPAGE="http://www.vim.org/" +fi + +vim-spell_src_install() { + target="/usr/share/vim/vimfiles/spell/" + dodir "${target}" + insinto "${target}" + + had_spell_file= + for f in *.spl ; do + if [[ -f "${f}" ]]; then + doins "${f}" + had_spell_file="yes" + fi + done + + for f in *.sug ; do + if [[ -f "${f}" ]]; then + doins "${f}" + fi + done + + for f in README* ; do + dodoc "${f}" + done + + [[ -z "${had_spell_file}" ]] && die "Didn't install any spell files?" +} + +vim-spell_pkg_postinst() { + target="/usr/share/vim/vimfiles/spell/" + echo + elog "To enable ${VIM_SPELL_LANGUAGE} spell checking, use" + elog " :setlocal spell spelllang=${VIM_SPELL_CODE}" + echo + elog "The following (Vim internal, not file) encodings are supported for" + elog "this language:" + for f in "${ROOT}/${target}/${VIM_SPELL_CODE}".*.spl ; do + enc="${f##*/${VIM_SPELL_CODE}.}" + enc="${enc%.spl}" + [[ -z "${enc}" ]] && continue + elog " ${enc}" + done + echo + elog "For further documentation, use:" + elog " :help spell" + echo + epause +} + diff --git a/sdk_container/src/third_party/portage-stable/eclass/virtualx.eclass b/sdk_container/src/third_party/portage-stable/eclass/virtualx.eclass new file mode 100644 index 0000000000..e915bb875e --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/virtualx.eclass @@ -0,0 +1,150 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/virtualx.eclass,v 1.34 2010/03/04 21:18:27 abcd Exp $ +# +# Author: Martin Schlemmer +# +# This eclass can be used for packages that needs a working X environment to build + +# Is a dependency on xorg-server and xhost needed? +# Valid values are "always", "optional", and "manual" +# "tests" is treated as a synonym for "optional" +: ${VIRTUALX_REQUIRED:=optional} + +# If VIRTUALX_REQUIRED=optional, what use flag should control +# the dependency? Default is "test" +: ${VIRTUALX_USE:=test} + +# Dep string available for use outside of eclass, in case a more +# complicated dep is needed +VIRTUALX_DEPEND="!prefix? ( x11-base/xorg-server ) + x11-apps/xhost" + +case ${VIRTUALX_REQUIRED} in + always) + DEPEND="${VIRTUALX_DEPEND}" + RDEPEND="" + ;; + optional|tests) + DEPEND="${VIRTUALX_USE}? ( ${VIRTUALX_DEPEND} )" + RDEPEND="" + IUSE="${VIRTUALX_USE}" + ;; + manual) + ;; + *) + eerror "Invalid value (${VIRTUALX_REQUIRED}) for VIRTUALX_REQUIRED" + eerror "Valid values are:" + eerror " always" + eerror " optional (default if unset)" + eerror " manual" + die "Invalid value (${VIRTUALX_REQUIRED}) for VIRTUALX_REQUIRED" + ;; +esac + +DESCRIPTION="Based on the $ECLASS eclass" + +virtualmake() { + local retval=0 + local OLD_SANDBOX_ON="${SANDBOX_ON}" + local XVFB=$(type -p Xvfb) + local XHOST=$(type -p xhost) + + # If $DISPLAY is not set, or xhost cannot connect to an X + # display, then do the Xvfb hack. + if [[ -n ${XVFB} && -n ${XHOST} ]] && \ + ( [[ -z ${DISPLAY} ]] || ! (${XHOST} &>/dev/null) ) ; then + export XAUTHORITY= + # The following is derived from Mandrake's hack to allow + # compiling without the X display + + einfo "Scanning for an open DISPLAY to start Xvfb ..." + + # We really do not want SANDBOX enabled here + export SANDBOX_ON="0" + + local i=0 + XDISPLAY=$(i=0; while [[ -f /tmp/.X${i}-lock ]] ; do ((i++));done; echo ${i}) + + # If we are in a chrooted environment, and there is already a + # X server started outside of the chroot, Xvfb will fail to start + # on the same display (most cases this is :0 ), so make sure + # Xvfb is started, else bump the display number + # + # Azarah - 5 May 2002 + # + # Changed the mode from 800x600x32 to 800x600x24 because the mfb + # support has been dropped in Xvfb in the xorg-x11 pre-releases. + # For now only depths up to 24-bit are supported. + # + # Sven Wegener - 22 Aug 2004 + # + # Use "-fp built-ins" because it's only part of the default font path + # for Xorg but not the other DDXs (Xvfb, Kdrive, etc). Temporarily fixes + # bug 278487 until xorg-server is properly patched + # + # Rémi Cardona (10 Aug 2009) + ${XVFB} :${XDISPLAY} -fp built-ins -screen 0 800x600x24 &>/dev/null & + sleep 2 + + local start=${XDISPLAY} + while [[ ! -f /tmp/.X${XDISPLAY}-lock ]] ; do + # Stop trying after 15 tries + if ((XDISPLAY - start > 15)) ; then + + eerror "" + eerror "Unable to start Xvfb." + eerror "" + eerror "'${XVFB} :${XDISPLAY} -fp built-ins -screen 0 800x600x24' returns:" + eerror "" + ${XVFB} :${XDISPLAY} -fp built-ins -screen 0 800x600x24 + eerror "" + eerror "If possible, correct the above error and try your emerge again." + eerror "" + die + fi + + ((XDISPLAY++)) + ${XVFB} :${XDISPLAY} -fp built-ins -screen 0 800x600x24 &>/dev/null & + sleep 2 + done + + # Now enable SANDBOX again if needed. + export SANDBOX_ON="${OLD_SANDBOX_ON}" + + einfo "Starting Xvfb on \$DISPLAY=${XDISPLAY} ..." + + export DISPLAY=:${XDISPLAY} + #Do not break on error, but setup $retval, as we need + #to kill Xvfb + ${maketype} "$@" + retval=$? + + #Now kill Xvfb + kill $(cat /tmp/.X${XDISPLAY}-lock) + else + #Normal make if we can connect to an X display + ${maketype} "$@" + retval=$? + fi + + return ${retval} +} + +#Same as "make", but setup the Xvfb hack if needed +Xmake() { + export maketype="make" + virtualmake "$@" +} + +#Same as "emake", but setup the Xvfb hack if needed +Xemake() { + export maketype="emake" + virtualmake "$@" +} + +#Same as "econf", but setup the Xvfb hack if needed +Xeconf() { + export maketype="econf" + virtualmake "$@" +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/virtuoso.eclass b/sdk_container/src/third_party/portage-stable/eclass/virtuoso.eclass new file mode 100644 index 0000000000..736df2db03 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/virtuoso.eclass @@ -0,0 +1,144 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/virtuoso.eclass,v 1.1 2010/02/08 20:30:19 alexxy Exp $ + +# @ECLASS: virtuoso.eclass +# @MAINTAINER: +# Maciej Mrozowski +# +# @BLURB: Provides splitting functionality for Virtuoso +# @DESCRIPTION: +# This eclass provides common code for splitting Virtuoso OpenSource database + +case ${EAPI:-0} in + 2|3) : ;; + *) DEPEND="EAPI-TOO-OLD" ;; +esac + +inherit base autotools flag-o-matic multilib + +MY_P="virtuoso-opensource-${PV}" + +case ${PV} in + *9999*) + ECVS_SERVER="virtuoso.cvs.sourceforge.net:/cvsroot/virtuoso" + SRC_URI="" + inherit cvs + ;; + *) + # Use this variable to determine distribution method (live or tarball) + TARBALL="${MY_P}.tar.gz" + SRC_URI="mirror://sourceforge/virtuoso/${TARBALL}" + ;; +esac + +EXPORT_FUNCTIONS src_prepare src_configure src_compile src_install + +# Set some defaults +HOMEPAGE="http://virtuoso.openlinksw.com/wiki/main/Main/" +LICENSE="GPL-2" +SLOT="0" + +DEPEND=">=sys-devel/libtool-2.2.6a" +RDEPEND="" + +S="${WORKDIR}/${MY_P}" + +# @FUNCTION: virtuoso_src_prepare +# @DESCRIPTION: +# 1. Applies common release patches (from ${FILESDIR}/${PV}/ dir) +# 2. Applies package-specific patches (from ${FILESDIR}/, PATCHES can be used) +# 3. Modifies makefiles for split build. Uses VOS_EXTRACT +# 4. eautoreconf +virtuoso_src_prepare() { + debug-print-function ${FUNCNAME} "$@" + + for file in "${FILESDIR}/${PV}"/*; do + epatch "${file}" + done + + base_src_prepare + + # @ECLASS-VARIABLE: VOS_EXTRACT + # @DESCRIPTION: + # Lists any subdirectories that are required to be extracted + # and enabled in Makefile.am's for current package. + if [[ -n ${VOS_EXTRACT} ]]; then + # Comment out everything + find . -name Makefile.am -exec \ + sed -e '/SUBDIRS\s*=/s/^/# DISABLED /g' -i {} + \ + || die "failed to disable subdirs" + + # Uncomment specified + local path + for path in ${VOS_EXTRACT}; do + if [[ -d "${path}" ]]; then + # Uncomment leaf + if [[ -f "${path}"/Makefile.am ]]; then + sed -e '/^# DISABLED \s*SUBDIRS\s*=/s/# DISABLED //g' \ + -i "${path}"/Makefile.am || die "failed to uncomment leaf in ${path}/Makefile.am" + fi + # Process remaining path elements + while true; do + local subdir=`basename "${path}"` + path=`dirname "${path}"` + if [[ -f "${path}"/Makefile.am ]]; then + # Uncomment if necessary + sed -e '/^# DISABLED \s*SUBDIRS\s*=/s/.*/SUBDIRS =/g' \ + -i "${path}"/Makefile.am + # Append subdirs if not there already + if [[ -z `grep --color=never -P "SUBDIRS\s*=.*${subdir}\b" "${path}"/Makefile.am` ]]; then + sed -e "/^SUBDIRS\s*=/s|$| ${subdir}|" \ + -i "${path}"/Makefile.am || die "failed to append ${subdir}" + fi + fi + [[ "${path}" = . ]] && break + done + fi + done + fi + + eautoreconf +} + +# @FUNCTION: virtuoso_src_configure +# @DESCRIPTION: +# Runs ./configure with common and user options specified via myconf variable +virtuoso_src_configure() { + debug-print-function ${FUNCNAME} "$@" + + use amd64 && append-flags "-m64" + + # Override some variables to make tests work + if [[ ${PN} != virtuoso-server ]]; then + [[ ${EAPI} == 2 ]] && ! use prefix && EPREFIX= + export ISQL=${EPREFIX}/usr/bin/isql-v + export SERVER=${EPREFIX}/usr/bin/virtuoso-t + fi + + econf \ + --with-layout=gentoo \ + --localstatedir=${EPREFIX}/var \ + --enable-shared \ + --with-pthreads \ + --without-internal-zlib \ + ${myconf} +} + +# @FUNCTION: virtuoso_src_compile +# @DESCRIPTION +# Runs make for specified subdirs +virtuoso_src_compile() { + debug-print-function ${FUNCNAME} "$@" + + base_src_compile +} + +# @FUNCTION: virtuoso_src_install +# @DESCRIPTION: +# Default src_install +virtuoso_src_install() { + debug-print-function ${FUNCNAME} "$@" + + base_src_install +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/vmware-mod.eclass b/sdk_container/src/third_party/portage-stable/eclass/vmware-mod.eclass new file mode 100644 index 0000000000..8a5a315a58 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/vmware-mod.eclass @@ -0,0 +1,121 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/vmware-mod.eclass,v 1.18 2009/01/10 12:26:04 ikelos Exp $ + + +# Ensure vmware comes before linux-mod since we want linux-mod's pkg_preinst and +# pkg_postinst, along with our own pkg_setup, src_unpack and src_compile +inherit flag-o-matic eutils vmware linux-mod + +DESCRIPTION="Modules for Vmware Programs" +HOMEPAGE="http://www.vmware.com/" +SRC_URI="http://platan.vc.cvut.cz/ftp/pub/vmware/${ANY_ANY}.tar.gz + http://platan.vc.cvut.cz/ftp/pub/vmware/obsolete/${ANY_ANY}.tar.gz + http://knihovny.cvut.cz/ftp/pub/vmware/${ANY_ANY}.tar.gz + http://knihovny.cvut.cz/ftp/pub/vmware/obsolete/${ANY_ANY}.tar.gz + http://ftp.cvut.cz/vmware/${ANY_ANY}.tar.gz + http://ftp.cvut.cz/vmware/obsolete/${ANY_ANY}.tar.gz" +LICENSE="vmware" +SLOT="0" +IUSE="" + +# Provide vaguely sensible defaults +[[ -z "${VMWARE_VER}" ]] && VMWARE_VER="VME_V55" +VMWARE_MOD_DIR="${ANY_ANY}" + +S="${WORKDIR}" + +# We needn't restrict this since it was only required to read +# /etc/vmware/locations to determine the version (which is now fixed by +# VMWARE_VER) +# RESTRICT="userpriv" + +EXPORT_FUNCTIONS pkg_setup src_unpack src_install + +vmware-mod_pkg_setup() { + linux-mod_pkg_setup + # Must define VMWARE_VER to make, otherwise it'll try and run getversion.pl + BUILD_TARGETS="auto-build VMWARE_VER=${VMWARE_VER} KERNEL_DIR=${KERNEL_DIR} KBUILD_OUTPUT=${KV_OUT_DIR}" + + vmware_determine_product + # We create a group for VMware users due to bugs #104480 and #106170 + enewgroup "${VMWARE_GROUP}" + + if [[ -z "${VMWARE_MODULE_LIST}" ]]; then + case ${product} in + vmware-tools) + VMWARE_MODULE_LIST="${VMWARE_MODULE_LIST} vmxnet" + [ "$shortname" != "server-tools" ] && VMWARE_MODULE_LIST="${VMWARE_MODULE_LIST} vmhgfs vmmemctl" + use amd64 || VMWARE_MODULE_LIST="${VMWARE_MODULE_LIST} vmdesched" + ;; + *) + VMWARE_MODULE_LIST="${VMWARE_MODULE_LIST} vmmon vmnet" + ;; + esac + fi + + filter-flags -mfpmath=sse + + for mod in ${VMWARE_MODULE_LIST}; do + MODULE_NAMES="${MODULE_NAMES} + ${mod}(misc:${S}/${mod}-only)" + done +} + +vmware-mod_src_unpack() { + case ${product} in + vmware-tools) + # Do nothing, this should be dealt with by vmware.eclass unpack + ;; + *) + unpack ${A} + ;; + esac + + for mod in ${VMWARE_MODULE_LIST}; do + cd "${S}" + unpack ./"${VMWARE_MOD_DIR}"/${mod}.tar + cd "${S}"/${mod}-only + # Ensure it's not used + # rm getversion.pl + if [[ "${VMWARE_MOD_DIR}" = "${ANY_ANY}" ]] ; then + EPATCH_SUFFIX="patch" + epatch "${FILESDIR}"/patches + [[ -d "${FILESDIR}"/patches/${mod} ]] && epatch "${FILESDIR}"/patches/${mod} + fi + convert_to_m "${S}"/${mod}-only/Makefile + done +} + +vmware-mod_src_install() { + # this adds udev rules for vmmon* + if [[ -n "`echo ${VMWARE_MODULE_LIST} | grep vmmon`" ]]; + then + dodir /etc/udev/rules.d + echo 'KERNEL=="vmmon*", GROUP="'$VMWARE_GROUP'" MODE=660' >> "${D}/etc/udev/rules.d/60-vmware.rules" || die + echo 'KERNEL=="vmnet*", GROUP="'$VMWARE_GROUP'" MODE=660' >> "${D}/etc/udev/rules.d/60-vmware.rules" || die + fi + + linux-mod_src_install +} + +# Current VMWARE product mappings +# 'VME_TOT' = .0 +# 'VME_GSX1' = .1 +# 'VME_GSX2' = .2 +# 'VME_GSX251' = .3 +# 'VME_GSX25' = .4 +# 'VME_GSX32' = .5 +# 'VME_V3' = .6 +# 'VME_V32' = .7 +# 'VME_V321' = .8 +# 'VME_V4' = .9 +# 'VME_V45' = .10 +# 'VME_V452' = .11 +# 'VME_V5' = .12 +# 'VME_V55' = .13 +# 'VME_S1B1' = .14 +# 'VME_S1??' = .15 +# 'VME_V6' = .16 +# 'VME_V6' = .17 (6.0.2) +# 'VME_S2B1' = .18 diff --git a/sdk_container/src/third_party/portage-stable/eclass/vmware.eclass b/sdk_container/src/third_party/portage-stable/eclass/vmware.eclass new file mode 100644 index 0000000000..be7b68734c --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/vmware.eclass @@ -0,0 +1,412 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/vmware.eclass,v 1.33 2010/03/09 13:12:08 abcd Exp $ + +# This eclass is for all vmware-* ebuilds in the tree and should contain all +# of the common components across the multiple packages. + +# Only one package per "product" is allowed to be installed at any given time. + +inherit pax-utils eutils + +EXPORT_FUNCTIONS pkg_preinst pkg_postinst pkg_setup src_install src_unpack pkg_postrm + +DEPEND="x11-misc/shared-mime-info" + +export ANY_ANY="vmware-any-any-update115" +#export TOOLS_ANY="vmware-tools-any-update1" +export VMWARE_GROUP=${VMWARE_GROUP:-vmware} +export VMWARE_INSTALL_DIR=/opt/${PN//-//} + +vmware_create_initd() { + dodir "${config_dir}"/init.d/rc{0,1,2,3,4,5,6}.d + # This is to fix a problem where if someone merges vmware and then + # before configuring vmware they upgrade or re-merge the vmware + # package which would rmdir the /etc/vmware/init.d/rc?.d directories. + keepdir "${config_dir}"/init.d/rc{0,1,2,3,4,5,6}.d +} + +vmware_run_questions() { + vmware_determine_product + # Questions: + einfo "Adding answers to ${config_dir}/locations" + locations="${D}${config_dir}/locations" + echo "answer BINDIR ${VMWARE_INSTALL_DIR}/bin" >> ${locations} + echo "answer LIBDIR ${VMWARE_INSTALL_DIR}/lib" >> ${locations} + echo "answer MANDIR ${VMWARE_INSTALL_DIR}/man" >> ${locations} + echo "answer DOCDIR ${VMWARE_INSTALL_DIR}/doc" >> ${locations} + if [ "${product}" == "vmware" -o "${product}" == "vmware-tools" ] + then + echo "answer SBINDIR ${VMWARE_INSTALL_DIR}/sbin" >> ${locations} + echo "answer RUN_CONFIGURATOR no" >> ${locations} + echo "answer INITDIR ${config_dir}/init.d" >> ${locations} + echo "answer INITSCRIPTSDIR ${config_dir}/init.d" >> ${locations} + fi +} + +vmware_determine_product() { + # Set the product category, and the category options + shortname=$(echo ${PN} | cut -d- -f2-) + case "${shortname}" in + workstation|server|player) + product="vmware" + config_program="vmware-config.pl" + ;; + server-console|esx-console|gsx-console) + product="vmware-console" + config_program="vmware-config-console.pl" + ;; + workstation-tools|esx-tools|gsx-tools|server-tools) + product="vmware-tools" + config_program="vmware-config-tools.pl" + ;; + *) + product="unknown" + ;; + esac + config_dir="/etc/${product}" + + # Set per package options + case "${shortname}" in + workstation) + FULL_NAME="Workstation" + ;; + player) + FULL_NAME="Player" + ;; + server) + FULL_NAME="Server" + ;; + server-console) + FULL_NAME="Server Console" + config_program="vmware-config-server-console.pl" + config_dir="/etc/${PN}" + ;; + esx-console) + FULL_NAME="ESX Console" + ;; + esac +} + +vmware_pkg_setup() { + vmware_determine_product +} + +vmware_src_unpack() { + vmware_determine_product + case "${product}" in + vmware-tools) + # We grab our tarball from "CD" + einfo "You will need ${TARBALL} from the VMware installation." + einfo "Select VM->Install VMware Tools from VMware's menu." + cdrom_get_cds ${TARBALL} + ;; + esac + # If there is anything to unpack, at all, then we should be using MY_P. + if [[ -n "${MY_P}" ]] + then + if [[ -e "${CDROM_ROOT}"/${MY_P}.tar.gz ]] + then + tar xzf "${CDROM_ROOT}"/${MY_P}.tar.gz || die + else + unpack "${MY_P}".tar.gz + fi + + if [[ -n "${ANY_ANY}" ]] + then + unpack "${ANY_ANY}".tar.gz + # Move the relevant ANY_ANY files now, so that they can be patched later... + mv -f "${ANY_ANY}"/services.sh "${S}"/installer/services.sh + # We should be able to get rid of this eventually, + # since we'll be using vmware-modules in future... + [[ "${product}" == "vmware" ]] && \ + mv -f "${ANY_ANY}"/*.tar "${S}"/lib/modules/source + [[ -e lib/bin/vmware ]] && \ + chmod 755 lib/bin/vmware + [[ -e bin/vmnet-bridge ]] && \ + chmod 755 bin/vmnet-bridge + [[ -e lib/bin/vmware-vmx ]] && \ + chmod 755 lib/bin/vmware-vmx + [[ -e lib/bin-debug/vmware-vmx ]] && \ + chmod 755 lib/bin-debug/vmware-vmx + if [[ "${RUN_UPDATE}" == "yes" ]] + then + cd "${S}"/"${ANY_ANY}" + ./update vmware ../lib/bin/vmware || die + ./update bridge ../bin/vmnet-bridge || die + ./update vmx ../lib/bin/vmware-vmx || die + ./update vmxdebug ../lib/bin-debug/vmware-vmx || die + fi + fi + + # Remove PAX MPROTECT flag from all applicable files in /bin, /sbin for + # the vmware package only (since modules, tools and console should not + # need to generate code on the fly in memory). + [[ "${product}" == "vmware" ]] && pax-mark -m \ + $(list-paxables ${S}/{bin{,-debug},sbin}/{vmware-serverd,vmware-vmx}) + + # Run through any patches that might need to be applied + cd "${S}" + if [[ -d "${FILESDIR}/${PV}" ]] + then + EPATCH_SUFFIX="patch" + epatch "${FILESDIR}"/${PV} + fi + if [[ -n "${PATCHES}" ]] + then + for patch in ${PATCHES} + do + epatch "${FILESDIR}"/${patch} + done + fi + # Unpack our new libs + for a in ${A} + do + case ${a} in + vmware-libssl.so.0.9.7l.tar.bz2) + unpack vmware-libssl.so.0.9.7l.tar.bz2 + ;; + vmware-libcrypto.so.0.9.7l.tar.bz2) + unpack vmware-libcrypto.so.0.9.7l.tar.bz2 + ;; + esac + done + fi +} + +vmware_src_install() { + # We won't want any perl scripts from VMware once we've finally got all + # of the configuration done, but for now, they're necessary. + #rm -f bin/*.pl + + # As backwards as this seems, we're installing our icons first. + if [[ -e lib/share/icons/48x48/apps/${PN}.png ]] + then + doicon lib/share/icons/48x48/apps/${PN}.png + elif [[ -e doc/icon48x48.png ]] + then + newicon doc/icon48x48.png ${PN}.png + elif [[ -e "${DISTDIR}/${product}.png" ]] + then + newicon "${DISTDIR}"/${product}.png ${PN}.png + fi + + # Since with Gentoo we compile everthing it doesn't make sense to keep + # the precompiled modules arround. Saves about 4 megs of disk space too. + rm -rf "${S}"/lib/modules/binary + # We also don't need to keep the icons around, or do we? + #rm -rf ${S}/lib/share/icons + + # Just like any good monkey, we install the documentation and man pages. + [[ -d doc ]] && dodoc doc/* + if [[ -d man ]] + then + cd man + for x in * + do + doman ${x}/* || die "doman" + done + fi + cd "${S}" + + # We remove the shipped libssl for bug #148682 + if [ -d "${S}"/libssl.so.0.9.7 ] + then + rm -rf "${S}"/lib/lib/libssl.so.0.9.7 + # Now, we move in our own + cp -pPR "${S}"/libssl.so.0.9.7 "${S}"/lib/lib + fi + # We remove the shipped libcrypto for bug #148682 + if [ -d "${S}"/libcrypto.so.0.9.7 ] + then + rm -rf "${S}"/lib/lib/libcrypto.so.0.9.7 + # Now, we move in our own + cp -pPR "${S}"/libcrypto.so.0.9.7 "${S}"/lib/lib + fi + + # We loop through our directories and copy everything to our system. + for x in bin lib sbin + do + if [[ -e "${S}/${x}" ]] + then + dodir "${VMWARE_INSTALL_DIR}"/${x} + cp -pPR "${S}"/${x}/* "${D}""${VMWARE_INSTALL_DIR}"/${x} \ + || die "copying ${x}" + fi + done + + # If we have an /etc directory, we copy it. + if [[ -e "${S}/etc" ]] + then + dodir "${config_dir}" + cp -pPR "${S}"/etc/* "${D}""${config_dir}" + fowners root:${VMWARE_GROUP} "${config_dir}" + fperms 770 "${config_dir}" + fi + + # If we have any helper files, we install them. First, we check for an + # init script. + if [[ -e "${FILESDIR}/${PN}.rc" ]] + then + newinitd "${FILESDIR}"/${PN}.rc ${product} || die "newinitd" + fi + # Then we check for an environment file. + if [[ -e "${FILESDIR}/90${PN}" ]] + then + doenvd "${FILESDIR}"/90${PN} || die "doenvd" + fi + # Last, we check for any mime files. + if [[ -e "${FILESDIR}/${PN}.xml" ]] + then + insinto /usr/share/mime/packages + doins "${FILESDIR}"/${PN}.xml || die "mimetypes" + fi + + # Blame bug #91191 for this one. + if [[ -e doc/EULA ]] + then + insinto "${VMWARE_INSTALL_DIR}"/doc + doins doc/EULA || die "copying EULA" + fi + + # Do we have vmware-ping/vmware-vmx? If so, make them setuid. + for p in /bin/vmware-ping /lib/bin/vmware-vmx /lib/bin-debug/vmware-vmx /lib/bin/vmware-vmx-debug /sbin/vmware-authd; + do + if [ -x "${D}${VMWARE_INSTALL_DIR}${p}" ] + then + fowners root:${VMWARE_GROUP} "${VMWARE_INSTALL_DIR}"${p} + fperms 4750 "${VMWARE_INSTALL_DIR}"${p} + fi + done + + # This removed the user/group warnings + # But also broke vmware-server with FEATURES="userpriv" since it removes + # the set-UID bit + #chown -R root:${VMWARE_GROUP} ${D} || die + + # We like desktop icons. + # TODO: Fix up the icon creation, across the board. + #make_desktop_entry ${PN} "VMware ${FULL_NAME}" + + # We like symlinks for console users. + # TODO: Fix up the symlink creation, across the board. + # dosym ${VMWARE_INSTALL_DIR}/bin/${PN} /usr/bin/${PN} + + # TODO: Replace this junk + # Everything after this point will hopefully go away once we can rid + # ourselves of the evil perl configuration scripts. + + if [ "${product}" == "vmware" -o "${product}" == "vmware-tools" ] + then + + # We have to create a bunch of rc directories for the init script + vmware_create_initd || die "creating rc directories" + + # Now, we copy in our services.sh file + exeinto "${config_dir}"/init.d + newexe installer/services.sh ${product} || die "services.sh" + + # Set the name + dosed "s:%LONGNAME%:Vmware ${FULL_NAME}:" \ + "${config_dir}"/init.d/${product} + [ "${shortname}" == "server" ] && dosed "s:%SHORTNAME%:wgs:" \ + "${config_dir}"/init.d/${product} + fi + + # Finally, we run the "questions" + vmware_run_questions || die "running questions" +} + +vmware_pkg_preinst() { + # This is run here due to bug #143150 + [ -z "${product}" ] && vmware_determine_product + + # This must be done after the install to get the mtimes on each file + # right. + + #Note: it's a bit weird to use ${D} in a preinst script but it should work + #(drobbins, 1 Feb 2002) + + einfo "Generating ${config_dir}/locations file." + d=`echo ${D} | wc -c` + for x in `find ${D}${VMWARE_INSTALL_DIR} ${D}${config_dir}` ; do + x="`echo ${x} | cut -c ${d}-`" + if [ -d "${D}/${x}" ] ; then + echo "directory ${x}" >> "${D}${config_dir}"/locations + else + echo -n "file ${x}" >> "${D}${config_dir}"/locations + if [ "${x}" == "${config_dir}/locations" ] ; then + echo "" >> "${D}${config_dir}"/locations + elif [ "${x}" == "${config_dir}/not_configured" ] ; then + echo "" >> "${D}${config_dir}"/locations + else + echo -n " " >> "${D}${config_dir}"/locations + find ${D}${x} -printf %T@ >> "${D}${config_dir}"/locations + echo "" >> "${D}${config_dir}"/locations + fi + fi + done +} + +vmware_pkg_postinst() { + update-mime-database /usr/share/mime + [[ -d "${config_dir}" ]] && chown -R root:${VMWARE_GROUP} ${config_dir} + + # This is to fix the problem where the not_configured file doesn't get + # removed when the configuration is run. This doesn't remove the file + # It just tells the vmware-config.pl script it can delete it. + einfo "Updating ${config_dir}/locations" + for x in "${config_dir}"/._cfg????_locations ; do + if [ -f $x ] ; then + cat $x >> "${config_dir}"/locations + rm $x + fi + done + + echo + elog "You need to run " + elog " ${VMWARE_INSTALL_DIR}/bin/${config_program}" + elog "to complete the install." + echo + einfo "For VMware Add-Ons just visit" + einfo "http://www.vmware.com/download/downloadaddons.html" + echo + if [ "${PN}" == "vmware-player" ] + then + elog "After configuring, run vmplayer to launch" + else + elog "After configuring, run ${PN} to launch" + fi + echo + if [ "${product}" == "vmware" -o "${product}" == "vmware-tools" ] + then + elog "Also note that when you reboot you should run:" + elog " /etc/init.d/${product} start" + elog "before trying to run ${product}. Or you could just add it to" + elog "the default runlevel:" + elog " rc-update add ${product} default" + echo + ewarn "VMWare allows for the potential of overwriting files as root. Only" + ewarn "give VMWare access to trusted individuals." + echo + fi + ewarn "Remember, in order to run VMware ${FULL_NAME}, you have to" + ewarn "be in the '${VMWARE_GROUP}' group." + echo +} + +vmware_pkg_postrm() { + [ -z "${product}" ] && vmware_determine_product + local product_extras + if [ "${product}" == "vmware" ] + then + product_extras=" and /etc/init.d/${product}" + fi + if ! has_version app-emulation/${PN}; then + echo + elog "To remove all traces of ${product} you will need to remove the files" + elog "in ${config_dir}${product_extras}." + elog "If the vmware-modules package is installed, you may no longer need it." + echo + fi +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/webapp.eclass b/sdk_container/src/third_party/portage-stable/eclass/webapp.eclass new file mode 100644 index 0000000000..193ca86aff --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/webapp.eclass @@ -0,0 +1,566 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.63 2008/03/23 00:11:20 hollow Exp $ + +# @ECLASS: webapp.eclass +# @MAINTAINER: +# web-apps@gentoo.org +# @BLURB: functions for installing applications to run under a web server +# @DESCRIPTION: +# The webapp eclass contains functions to handle web applications with +# webapp-config. Part of the implementation of GLEP #11 + +# @ECLASS-VARIABLE: WEBAPP_DEPEND +# @DESCRIPTION: +# An ebuild should use WEBAPP_DEPEND if a custom DEPEND needs to be built, most +# notably in combination with WEBAPP_OPTIONAL. +WEBAPP_DEPEND=">=app-admin/webapp-config-1.50.15" + +# @ECLASS-VARIABLE: WEBAPP_NO_AUTO_INSTALL +# @DESCRIPTION: +# An ebuild sets this to `yes' if an automatic installation and/or upgrade is +# not possible. The ebuild should overwrite pkg_postinst() and explain the +# reason for this BEFORE calling webapp_pkg_postinst(). + +# @ECLASS-VARIABLE: WEBAPP_OPTIONAL +# @DESCRIPTION: +# An ebuild sets this to `yes' to make webapp support optional, in which case +# you also need to take care of USE-flags and dependencies. + +if [[ "${WEBAPP_OPTIONAL}" != "yes" ]]; then + [[ "${WEBAPP_NO_AUTO_INSTALL}" == "yes" ]] || IUSE="vhosts" + SLOT="${PVR}" + DEPEND="${WEBAPP_DEPEND}" + RDEPEND="${DEPEND}" +fi + +EXPORT_FUNCTIONS pkg_postinst pkg_setup src_install pkg_prerm + +INSTALL_DIR="/${PN}" +IS_UPGRADE=0 +IS_REPLACE=0 + +INSTALL_CHECK_FILE="installed_by_webapp_eclass" +SETUP_CHECK_FILE="setup_by_webapp_eclass" + +ETC_CONFIG="${ROOT}etc/vhosts/webapp-config" +WEBAPP_CONFIG="${ROOT}usr/sbin/webapp-config" +WEBAPP_CLEANER="${ROOT}usr/sbin/webapp-cleaner" + +# ============================================================================== +# INTERNAL FUNCTIONS +# ============================================================================== + +# Load the config file /etc/vhosts/webapp-config +# Supports both the old bash version, and the new python version +webapp_read_config() { + debug-print-function $FUNCNAME $* + + if has_version '>=app-admin/webapp-config-1.50'; then + ENVVAR=$(${WEBAPP_CONFIG} --query ${PN} ${PVR}) || die "Could not read settings from webapp-config!" + eval ${ENVVAR} + else + . ${ETC_CONFIG} || die "Unable to read ${ETC_CONFIG}" + fi +} + +# Check whether a specified file exists in the given directory (`.' by default) +webapp_checkfileexists() { + debug-print-function $FUNCNAME $* + + local my_prefix=${2:+${2}/} + + if [[ ! -e "${my_prefix}${1}" ]]; then + msg="ebuild fault: file '${1}' not found" + eerror "$msg" + eerror "Please report this as a bug at http://bugs.gentoo.org/" + die "$msg" + fi +} + +webapp_check_installedat() { + debug-print-function $FUNCNAME $* + ${WEBAPP_CONFIG} --show-installed -h localhost -d "${INSTALL_DIR}" 2> /dev/null +} + +webapp_strip_appdir() { + debug-print-function $FUNCNAME $* + echo "${1#${MY_APPDIR}/}" +} + +webapp_strip_d() { + debug-print-function $FUNCNAME $* + echo "${1#${D}}" +} + +webapp_strip_cwd() { + debug-print-function $FUNCNAME $* + echo "${1/#.\///}" +} + +webapp_getinstalltype() { + debug-print-function $FUNCNAME $* + + if ! has vhosts ${IUSE} || use vhosts; then + return + fi + + local my_output + my_output="$(webapp_check_installedat)" + + if [[ $? -eq 0 ]]; then + # something is already installed there + # make sure it isn't the same version + + local my_pn="$(echo ${my_output} | awk '{ print $1 }')" + local my_pvr="$(echo ${my_output} | awk '{ print $2 }')" + + REMOVE_PKG="${my_pn}-${my_pvr}" + + if [[ "${my_pn}" == "${PN}" ]]; then + if [[ "${my_pvr}" != "${PVR}" ]]; then + elog "This is an upgrade" + IS_UPGRADE=1 + else + elog "This is a re-installation" + IS_REPLACE=1 + fi + else + elog "${my_output} is installed there" + fi + else + elog "This is an installation" + fi +} + +# ============================================================================== +# PUBLIC FUNCTIONS +# ============================================================================== + +# @FUNCTION: need_httpd +# @DESCRIPTION: +# Call this function AFTER your ebuilds DEPEND line if any of the available +# webservers are able to run this application. +need_httpd() { + DEPEND="${DEPEND} + || ( virtual/httpd-basic virtual/httpd-cgi virtual/httpd-fastcgi )" +} + +# @FUNCTION: need_httpd_cgi +# @DESCRIPTION: +# Call this function AFTER your ebuilds DEPEND line if any of the available +# CGI-capable webservers are able to run this application. +need_httpd_cgi() { + DEPEND="${DEPEND} + || ( virtual/httpd-cgi virtual/httpd-fastcgi )" +} + +# @FUNCTION: need_httpd_fastcgi +# @DESCRIPTION: +# Call this function AFTER your ebuilds DEPEND line if any of the available +# FastCGI-capabale webservers are able to run this application. +need_httpd_fastcgi() { + DEPEND="${DEPEND} + virtual/httpd-fastcgi" +} + +# @FUNCTION: webapp_configfile +# @USAGE: [more files ...] +# @DESCRIPTION: +# Mark a file config-protected for a web-based application. +webapp_configfile() { + debug-print-function $FUNCNAME $* + + local m + for m in "$@"; do + webapp_checkfileexists "${m}" "${D}" + + local my_file="$(webapp_strip_appdir "${m}")" + my_file="$(webapp_strip_cwd "${my_file}")" + + elog "(config) ${my_file}" + echo "${my_file}" >> ${D}/${WA_CONFIGLIST} + done +} + +# @FUNCTION: webapp_hook_script +# @USAGE: +# @DESCRIPTION: +# Install a script that will run after a virtual copy is created, and +# before a virtual copy has been removed. +webapp_hook_script() { + debug-print-function $FUNCNAME $* + + webapp_checkfileexists "${1}" + + elog "(hook) ${1}" + cp "${1}" "${D}/${MY_HOOKSCRIPTSDIR}/$(basename "${1}")" || die "Unable to install ${1} into ${D}/${MY_HOOKSCRIPTSDIR}/" + chmod 555 "${D}/${MY_HOOKSCRIPTSDIR}/$(basename "${1}")" +} + +# @FUNCTION: webapp_postinst_txt +# @USAGE: +# @DESCRIPTION: +# Install a text file containing post-installation instructions. +webapp_postinst_txt() { + debug-print-function $FUNCNAME $* + + webapp_checkfileexists "${2}" + + elog "(info) ${2} (lang: ${1})" + cp "${2}" "${D}/${MY_APPDIR}/postinst-${1}.txt" +} + +# @FUNCTION: webapp_postupgrade_txt +# @USAGE: +# @DESCRIPTION: +# Install a text file containing post-upgrade instructions. +webapp_postupgrade_txt() { + debug-print-function $FUNCNAME $* + + webapp_checkfileexists "${2}" + + elog "(info) ${2} (lang: ${1})" + cp "${2}" "${D}/${MY_APPDIR}/postupgrade-${1}.txt" +} + +# helper for webapp_serverowned() +_webapp_serverowned() { + debug-print-function $FUNCNAME $* + + webapp_checkfileexists "${1}" "${D}" + local my_file="$(webapp_strip_appdir "${1}")" + my_file="$(webapp_strip_cwd "${my_file}")" + + elog "(server owned) ${my_file}" + echo "${my_file}" >> "${D}/${WA_SOLIST}" +} + +# @FUNCTION: webapp_serverowned +# @USAGE: [-R] [more files ...] +# @DESCRIPTION: +# Identify a file which must be owned by the webserver's user:group settings. +# The ownership of the file is NOT set until the application is installed using +# the webapp-config tool. If -R is given directories are handled recursively. +webapp_serverowned() { + debug-print-function $FUNCNAME $* + + local a m + if [[ "${1}" == "-R" ]]; then + shift + for m in "$@"; do + find "${D}${m}" | while read a; do + a=$(webapp_strip_d "${a}") + _webapp_serverowned "${a}" + done + done + else + for m in "$@"; do + _webapp_serverowned "${m}" + done + fi +} + +# @FUNCTION: webapp_server_configfile +# @USAGE: [new name] +# @DESCRIPTION: +# Install a configuration file for the webserver. You need to specify a +# webapp-config supported . if no new name is given `basename $2' is +# used by default. Note: this function will automagically prepend $1 to the +# front of your config file's name. +webapp_server_configfile() { + debug-print-function $FUNCNAME $* + + webapp_checkfileexists "${2}" + + # WARNING: + # + # do NOT change the naming convention used here without changing all + # the other scripts that also rely upon these names + + local my_file="${1}-${3:-$(basename "${2}")}" + + elog "(${1}) config file '${my_file}'" + cp "${2}" "${D}/${MY_SERVERCONFIGDIR}/${my_file}" +} + +# @FUNCTION: webapp_sqlscript +# @USAGE: [version] +# @DESCRIPTION: +# Install a SQL script that creates/upgrades a database schema for the web +# application. Currently supported database engines are mysql and postgres. +# If a version is given the script should upgrade the database schema from +# the given version to $PVR. +webapp_sqlscript() { + debug-print-function $FUNCNAME $* + + webapp_checkfileexists "${2}" + + dodir "${MY_SQLSCRIPTSDIR}/${1}" + + # WARNING: + # + # do NOT change the naming convention used here without changing all + # the other scripts that also rely upon these names + + if [[ -n "${3}" ]]; then + elog "(${1}) upgrade script for ${PN}-${3} to ${PVR}" + cp "${2}" "${D}${MY_SQLSCRIPTSDIR}/${1}/${3}_to_${PVR}.sql" + chmod 600 "${D}${MY_SQLSCRIPTSDIR}/${1}/${3}_to_${PVR}.sql" + else + elog "(${1}) create script for ${PN}-${PVR}" + cp "${2}" "${D}/${MY_SQLSCRIPTSDIR}/${1}/${PVR}_create.sql" + chmod 600 "${D}/${MY_SQLSCRIPTSDIR}/${1}/${PVR}_create.sql" + fi +} + +# @FUNCTION: webapp_src_preinst +# @DESCRIPTION: +# You need to call this function in src_install() BEFORE anything else has run. +# For now we just create required webapp-config directories. +webapp_src_preinst() { + debug-print-function $FUNCNAME $* + + # sanity checks, to catch bugs in the ebuild + if [[ ! -f "${T}/${SETUP_CHECK_FILE}" ]]; then + eerror + eerror "This ebuild did not call webapp_pkg_setup() at the beginning" + eerror "of the pkg_setup() function" + eerror + eerror "Please log a bug on http://bugs.gentoo.org" + eerror + eerror "You should use emerge -C to remove this package, as the" + eerror "installation is incomplete" + eerror + die "Ebuild did not call webapp_pkg_setup() - report to http://bugs.gentoo.org" + fi + + dodir "${MY_HTDOCSDIR}" + dodir "${MY_HOSTROOTDIR}" + dodir "${MY_CGIBINDIR}" + dodir "${MY_ICONSDIR}" + dodir "${MY_ERRORSDIR}" + dodir "${MY_SQLSCRIPTSDIR}" + dodir "${MY_HOOKSCRIPTSDIR}" + dodir "${MY_SERVERCONFIGDIR}" +} + +# ============================================================================== +# EXPORTED FUNCTIONS +# ============================================================================== + +# @FUNCTION: webapp_pkg_setup +# @DESCRIPTION: +# The default pkg_setup() for this eclass. This will gather required variables +# from webapp-config and check if there is an application installed to +# `${ROOT}/var/www/localhost/htdocs/${PN}/' if USE=vhosts is not set. +# +# You need to call this function BEFORE anything else has run in your custom +# pkg_setup(). +webapp_pkg_setup() { + debug-print-function $FUNCNAME $* + + # to test whether or not the ebuild has correctly called this function + # we add an empty file to the filesystem + # + # we used to just set a variable in the shell script, but we can + # no longer rely on Portage calling both webapp_pkg_setup() and + # webapp_src_install() within the same shell process + touch "${T}/${SETUP_CHECK_FILE}" + + # special case - some ebuilds *do* need to overwride the SLOT + if [[ "${SLOT}+" != "${PVR}+" && "${WEBAPP_MANUAL_SLOT}" != "yes" ]]; then + die "Set WEBAPP_MANUAL_SLOT=\"yes\" if you need to SLOT manually" + fi + + # pull in the shared configuration file + G_HOSTNAME="localhost" + webapp_read_config + + local my_dir="${ROOT}${VHOST_ROOT}/${MY_HTDOCSBASE}/${PN}" + + # if USE=vhosts is enabled OR no application is installed we're done here + if ! has vhosts ${IUSE} || use vhosts || [[ ! -d "${my_dir}" ]]; then + return + fi + + local my_output + my_output="$(webapp_check_installedat)" + + if [[ $? -ne 0 ]]; then + # okay, whatever is there, it isn't webapp-config-compatible + echo + ewarn + ewarn "You already have something installed in ${my_dir}" + ewarn + ewarn "Whatever is in ${my_dir}, it's not" + ewarn "compatible with webapp-config." + ewarn + ewarn "This ebuild may be overwriting important files." + ewarn + echo + ebeep 10 + elif [[ "$(echo ${my_output} | awk '{ print $1 }')" != "${PN}" ]]; then + echo + eerror "You already have ${my_output} installed in ${my_dir}" + eerror + eerror "I cannot upgrade a different application" + eerror + echo + die "Cannot upgrade contents of ${my_dir}" + fi + +} + +# @FUNCTION: webapp_src_install +# @DESCRIPTION: +# This is the default src_install(). For now, we just make sure that root owns +# everything, and that there are no setuid files. +# +# You need to call this function AFTER everything else has run in your custom +# src_install(). +webapp_src_install() { + debug-print-function $FUNCNAME $* + + # to test whether or not the ebuild has correctly called this function + # we add an empty file to the filesystem + # + # we used to just set a variable in the shell script, but we can + # no longer rely on Portage calling both webapp_src_install() and + # webapp_pkg_postinst() within the same shell process + touch "${D}/${MY_APPDIR}/${INSTALL_CHECK_FILE}" + + chown -R "${VHOST_DEFAULT_UID}:${VHOST_DEFAULT_GID}" "${D}/" + chmod -R u-s "${D}/" + chmod -R g-s "${D}/" + + keepdir "${MY_PERSISTDIR}" + fowners "root:0" "${MY_PERSISTDIR}" + fperms 755 "${MY_PERSISTDIR}" +} + +# @FUNCTION: webapp_pkg_postinst +# @DESCRIPTION: +# The default pkg_postinst() for this eclass. This installs the web application to +# `${ROOT}/var/www/localhost/htdocs/${PN}/' if USE=vhosts is not set. Otherwise +# display a short notice how to install this application with webapp-config. +# +# You need to call this function AFTER everything else has run in your custom +# pkg_postinst(). +webapp_pkg_postinst() { + debug-print-function $FUNCNAME $* + + webapp_read_config + + # sanity checks, to catch bugs in the ebuild + if [[ ! -f "${ROOT}${MY_APPDIR}/${INSTALL_CHECK_FILE}" ]]; then + eerror + eerror "This ebuild did not call webapp_src_install() at the end" + eerror "of the src_install() function" + eerror + eerror "Please log a bug on http://bugs.gentoo.org" + eerror + eerror "You should use emerge -C to remove this package, as the" + eerror "installation is incomplete" + eerror + die "Ebuild did not call webapp_src_install() - report to http://bugs.gentoo.org" + fi + + if has vhosts ${IUSE}; then + if ! use vhosts; then + echo + elog "vhosts USE flag not set - auto-installing using webapp-config" + + G_HOSTNAME="localhost" + webapp_read_config + + local my_mode=-I + webapp_getinstalltype + + if [[ "${IS_REPLACE}" == "1" ]]; then + elog "${PN}-${PVR} is already installed - replacing" + my_mode=-I + elif [[ "${IS_UPGRADE}" == "1" ]]; then + elog "${REMOVE_PKG} is already installed - upgrading" + my_mode=-U + else + elog "${PN}-${PVR} is not installed - using install mode" + fi + + my_cmd="${WEBAPP_CONFIG} ${my_mode} -h localhost -u root -d ${INSTALL_DIR} ${PN} ${PVR}" + elog "Running ${my_cmd}" + ${my_cmd} + + echo + local cleaner="${WEBAPP_CLEANER} -p -C ${PN}" + einfo "Running ${cleaner}" + ${cleaner} + else + elog + elog "The 'vhosts' USE flag is switched ON" + elog "This means that Portage will not automatically run webapp-config to" + elog "complete the installation." + elog + elog "To install ${PN}-${PVR} into a virtual host, run the following command:" + elog + elog " webapp-config -I -h -d ${PN} ${PN} ${PVR}" + elog + elog "For more details, see the webapp-config(8) man page" + fi + else + elog + elog "This ebuild does not support the 'vhosts' USE flag." + elog "This means that Portage will not automatically run webapp-config to" + elog "complete the installation." + elog + elog "To install ${PN}-${PVR} into a virtual host, run the following command:" + elog + elog " webapp-config -I -h -d ${PN} ${PN} ${PVR}" + elog + elog "For more details, see the webapp-config(8) man page" + fi +} + +# @FUNCTION: webapp_pkg_prerm +# @DESCRIPTION: +# This is the default pkg_prerm() for this eclass. If USE=vhosts is not set +# remove all installed copies of this web application. Otherwise instruct the +# user to manually remove those copies. See bug #136959. +webapp_pkg_prerm() { + debug-print-function $FUNCNAME $* + + local my_output= + my_output="$(${WEBAPP_CONFIG} --list-installs ${PN} ${PVR})" + [[ $? -ne 0 ]] && return + + local x + if has vhosts ${IUSE} && ! use vhosts; then + echo "${my_output}" | while read x; do + if [[ -f "${x}"/.webapp ]]; then + . "${x}"/.webapp + if [[ -n "${WEB_HOSTNAME}" && -n "${WEB_INSTALLDIR}" ]]; then + ${WEBAPP_CONFIG} -C -h ${WEB_HOSTNAME} -d ${WEB_INSTALLDIR} + fi + else + ewarn "Cannot find file ${x}/.webapp" + fi + done + elif [[ "${my_output}" != "" ]]; then + echo + ewarn + ewarn "Don't forget to use webapp-config to remove any copies of" + ewarn "${PN}-${PVR} installed in" + ewarn + + echo "${my_output}" | while read x; do + if [[ -f "${x}"/.webapp ]]; then + ewarn " ${x}" + else + ewarn "Cannot find file ${x}/.webapp" + fi + done + + ewarn + echo + fi +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/wxwidgets.eclass b/sdk_container/src/third_party/portage-stable/eclass/wxwidgets.eclass new file mode 100644 index 0000000000..d0d6757c14 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/wxwidgets.eclass @@ -0,0 +1,285 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/wxwidgets.eclass,v 1.29 2010/02/16 01:06:24 dirtyepic Exp $ + +# @ECLASS: wxwidgets.eclass +# @MAINTAINER: +# wxwidgets@gentoo.org +# @BLURB: Manages build configuration for wxGTK-using packages. +# @DESCRIPTION: +# The wxGTK libraries come in several different possible configurations +# (release, debug, ansi, unicode, etc.) most of which can be installed +# side-by-side. The purpose of this eclass is to provide ebuilds the ability +# to build against a specific type of profile without interfering with the +# user-set system configuration. +# +# Ebuilds that use wxGTK _must_ inherit this eclass. +# +# - Using this eclass - +# +# 1. set WX_GTK_VER to a valid wxGTK SLOT +# 2. inherit wxwidgets +# 3. add an appropriate DEPEND +# 4. done +# +# @CODE +# WX_GTK_VER="2.8" +# +# inherit wxwidgets +# +# DEPEND="x11-libs/wxGTK:2.8[X]" +# RDEPEND="${DEPEND}" +# [...] +# @CODE +# +# This will get you the default configuration, which is what you want 99% +# of the time (in 2.6 the default is "ansi", all other versions default to +# "unicode"). +# +# If your package has optional wxGTK support controlled by a USE flag or you +# need to use the wxBase libraries (USE="-X") then you should not set +# WX_GTK_VER before inherit and instead refer to the need-wxwidgets function +# below. +# +# The variable WX_CONFIG is exported, containing the absolute path to the +# wx-config file to use. Most configure scripts use this path if it's set in +# the environment or accept --with-wx-config="${WX_CONFIG}". + +inherit eutils multilib + +case "${EAPI:-0}" in + 0|1) + EXPORT_FUNCTIONS pkg_setup + ;; + *) + ;; +esac + +# We do this globally so ebuilds can get sane defaults just by inheriting. They +# can be overridden with need-wxwidgets later if need be. + +# ensure this only runs once +if [[ -z ${WX_CONFIG} ]]; then + # and only if WX_GTK_VER is set before inherit + if [[ -n ${WX_GTK_VER} ]]; then + if [[ ${WX_GTK_VER} == 2.6 ]]; then + wxchar="ansi" + else + wxchar="unicode" + fi + for wxtoolkit in gtk2 base; do + # newer versions don't have a seperate debug profile + for wxdebug in xxx release- debug-; do + wxconf="${wxtoolkit}-${wxchar}-${wxdebug/xxx/}${WX_GTK_VER}" + if [[ -f /usr/$(get_libdir)/wx/config/${wxconf} ]]; then + # if this is a wxBase install, die in pkg_setup + [[ ${wxtoolkit} == "base" ]] && WXBASE_DIE=1 + else + continue + fi + WX_CONFIG="/usr/$(get_libdir)/wx/config/${wxconf}" + WX_ECLASS_CONFIG="${WX_CONFIG}" + break + done + [[ -n ${WX_CONFIG} ]] && break + done + [[ -n ${WX_CONFIG} ]] && export WX_CONFIG WX_ECLASS_CONFIG + fi +fi + +# @FUNCTION: wxwidgets_pkg_setup +# @DESCRIPTION: +# +# It's possible for wxGTK to be installed with USE="-X", resulting in something +# called wxBase. There's only ever been a couple packages in the tree that use +# wxBase so this is probably not what you want. Whenever possible, use EAPI 2 +# USE dependencies(tm) to ensure that wxGTK was built with USE="X". This +# function is only exported for EAPI 0 or 1 and catches any remaining cases. +# +# If you do use wxBase, don't set WX_GTK_VER before inherit. Use +# need-wxwidgets() instead. + +wxwidgets_pkg_setup() { + [[ -n $WXBASE_DIE ]] && check_wxuse X +} + +# @FUNCTION: need-wxwidgets +# @USAGE: +# @DESCRIPTION: +# +# Available configurations are: +# +# [2.6] ansi [>=2.8] unicode +# unicode base-unicode +# base +# base-unicode +# +# If your package has optional wxGTK support controlled by a USE flag, set +# WX_GTK_VER inside a conditional rather than before inherit. Some broken +# configure scripts will force wxGTK on if they find ${WX_CONFIG} set. +# +# @CODE +# src_configure() { +# if use wxwidgets; then +# WX_GTK_VER="2.8" +# if use X; then +# need-wxwidgets unicode +# else +# need-wxwidgets base-unicode +# fi +# fi +# @CODE +# + +need-wxwidgets() { + debug-print-function $FUNCNAME $* + + local wxtoolkit wxchar wxdebug wxconf + + if [[ -z ${WX_GTK_VER} ]]; then + echo + eerror "WX_GTK_VER must be set before calling $FUNCNAME." + echo + die "WX_GTK_VER missing" + fi + + if [[ ${WX_GTK_VER} != 2.6 && ${WX_GTK_VER} != 2.8 && ${WX_GTK_VER} != 2.9 ]]; then + echo + eerror "Invalid WX_GTK_VER: ${WX_GTK_VER} - must be set to a valid wxGTK SLOT." + echo + die "Invalid WX_GTK_VER" + fi + + debug-print "WX_GTK_VER is ${WX_GTK_VER}" + + case $1 in + ansi) + debug-print-section ansi + if [[ ${WX_GTK_VER} == 2.6 ]]; then + wxchar="ansi" + else + wxchar="unicode" + fi + check_wxuse X + ;; + unicode) + debug-print-section unicode + check_wxuse X + [[ ${WX_GTK_VER} == 2.6 ]] && check_wxuse unicode + wxchar="unicode" + ;; + base) + debug-print-section base + if [[ ${WX_GTK_VER} == 2.6 ]]; then + wxchar="ansi" + else + wxchar="unicode" + fi + ;; + base-unicode) + debug-print-section base-unicode + [[ ${WX_GTK_VER} == 2.6 ]] && check_wxuse unicode + wxchar="unicode" + ;; + # backwards compatibility + gtk2) + debug-print-section gtk2 + if [[ ${WX_GTK_VER} == 2.6 ]]; then + wxchar="ansi" + else + wxchar="unicode" + fi + check_wxuse X + ;; + *) + echo + eerror "Invalid $FUNCNAME argument: $1" + echo + die "Invalid argument" + ;; + esac + + debug-print "wxchar is ${wxchar}" + + # TODO: remove built_with_use + + # wxBase can be provided by both gtk2 and base installations + if built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* X; then + wxtoolkit="gtk2" + else + wxtoolkit="base" + fi + + debug-print "wxtoolkit is ${wxtoolkit}" + + # debug or release? + if [[ ${WX_GTK_VER} == 2.6 || ${WX_GTK_VER} == 2.8 ]]; then + if built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* debug; then + wxdebug="debug-" + else + wxdebug="release-" + fi + fi + + debug-print "wxdebug is ${wxdebug}" + + # put it all together + wxconf="${wxtoolkit}-${wxchar}-${wxdebug}${WX_GTK_VER}" + + debug-print "wxconf is ${wxconf}" + + # if this doesn't work, something is seriously screwed + if [[ ! -f /usr/$(get_libdir)/wx/config/${wxconf} ]]; then + echo + eerror "Failed to find configuration ${wxconf}" + echo + die "Missing wx-config" + fi + + debug-print "Found config ${wxconf} - setting WX_CONFIG" + + export WX_CONFIG="/usr/$(get_libdir)/wx/config/${wxconf}" + + debug-print "WX_CONFIG is ${WX_CONFIG}" + + export WX_ECLASS_CONFIG="${WX_CONFIG}" + + echo + einfo "Requested wxWidgets: ${1} ${WX_GTK_VER}" + einfo "Using wxWidgets: ${wxconf}" + echo +} + + +# @FUNCTION: check_wxuse +# @USAGE: +# @DESCRIPTION: +# +# Provides a consistant way to check if wxGTK was built with a particular USE +# flag enabled. A better way is EAPI 2 USE dependencies (hint hint). + +check_wxuse() { + debug-print-function $FUNCNAME $* + + if [[ -z ${WX_GTK_VER} ]]; then + echo + eerror "WX_GTK_VER must be set before calling $FUNCNAME." + echo + die "WX_GTK_VER missing" + fi + + # TODO: Remove built_with_use + + ebegin "Checking wxGTK-${WX_GTK_VER} for ${1} support" + if built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* "${1}"; then + eend 0 + else + eend 1 + echo + eerror "${FUNCNAME} - You have requested functionality that requires ${1} support to" + eerror "have been built into x11-libs/wxGTK." + eerror + eerror "Please re-merge =x11-libs/wxGTK-${WX_GTK_VER}* with the ${1} USE flag enabled." + die "Missing USE flags." + fi +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/x-modular.eclass b/sdk_container/src/third_party/portage-stable/eclass/x-modular.eclass new file mode 100644 index 0000000000..b7ba3f0c49 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/x-modular.eclass @@ -0,0 +1,657 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/x-modular.eclass,v 1.118 2009/12/09 10:21:49 vapier Exp $ +# +# @ECLASS: x-modular.eclass +# @MAINTAINER: +# Donnie Berkholz , x11@gentoo.org +# @BLURB: Reduces code duplication in the modularized X11 ebuilds. +# @DESCRIPTION: +# This eclass makes trivial X ebuilds possible for apps, fonts, drivers, +# and more. Many things that would normally be done in various functions +# can be accessed by setting variables instead, such as patching, +# running eautoreconf, passing options to configure and installing docs. +# +# All you need to do in a basic ebuild is inherit this eclass and set +# DESCRIPTION, KEYWORDS and RDEPEND/DEPEND. If your package is hosted +# with the other X packages, you don't need to set SRC_URI. Pretty much +# everything else should be automatic. + +if [[ ${PV} = 9999* ]]; then + GIT_ECLASS="git" + SNAPSHOT="yes" + SRC_URI="" +fi + +# If we're a font package, but not the font.alias one +FONT_ECLASS="" +if [[ "${PN/#font-}" != "${PN}" ]] \ + && [[ "${CATEGORY}" = "media-fonts" ]] \ + && [[ "${PN}" != "font-alias" ]] \ + && [[ "${PN}" != "font-util" ]]; then + # Activate font code in the rest of the eclass + FONT="yes" + + # Whether to inherit the font eclass + FONT_ECLASS="font" +fi + +inherit eutils libtool multilib toolchain-funcs flag-o-matic autotools \ + ${FONT_ECLASS} ${GIT_ECLASS} + +EXPORTED_FUNCTIONS="src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_postrm" + +case "${EAPI:-0}" in + 0|1) + ;; + 2) + EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare src_configure" + ;; + *) + die "Unknown EAPI ${EAPI}" + ;; +esac + +# exports must be ALWAYS after inherit +EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS} + +# @ECLASS-VARIABLE: XDIR +# @DESCRIPTION: +# Directory prefix to use for everything. If you want to install to a +# non-default prefix (e.g., /opt/xorg), change XDIR. This has not been +# recently tested. You may need to uncomment the setting of datadir and +# mandir in x-modular_src_install() or add it back in if it's no longer +# there. You may also want to change the SLOT. +XDIR="/usr" + +IUSE="" +HOMEPAGE="http://xorg.freedesktop.org/" + +# @ECLASS-VARIABLE: SNAPSHOT +# @DESCRIPTION: +# If set to 'yes' and configure.ac exists, eautoreconf will run. Set +# before inheriting this eclass. +: ${SNAPSHOT:=no} + +# Set up SRC_URI for individual modular releases +BASE_INDIVIDUAL_URI="http://xorg.freedesktop.org/releases/individual" +# @ECLASS-VARIABLE: MODULE +# @DESCRIPTION: +# The subdirectory to download source from. Possible settings are app, +# doc, data, util, driver, font, lib, proto, xserver. Set above the +# inherit to override the default autoconfigured module. +if [[ -z ${MODULE} ]]; then + case ${CATEGORY} in + app-doc) MODULE="doc" ;; + media-fonts) MODULE="font" ;; + x11-apps|x11-wm) MODULE="app" ;; + x11-misc|x11-themes) MODULE="util" ;; + x11-drivers) MODULE="driver" ;; + x11-base) MODULE="xserver" ;; + x11-proto) MODULE="proto" ;; + x11-libs) MODULE="lib" ;; + esac +fi + +if [[ -n ${GIT_ECLASS} ]]; then + EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/${MODULE}/${PN}" +else + SRC_URI="${SRC_URI} ${BASE_INDIVIDUAL_URI}/${MODULE}/${P}.tar.bz2" +fi + +SLOT="0" + +# Set the license for the package. This can be overridden by setting +# LICENSE after the inherit. Nearly all FreeDesktop-hosted X packages +# are under the MIT license. (This is what Red Hat does in their rpms) +LICENSE="MIT" + +# Set up shared dependencies +if [[ -n "${SNAPSHOT}" ]]; then +# FIXME: What's the minimal libtool version supporting arbitrary versioning? + DEPEND="${DEPEND} + >=sys-devel/libtool-1.5 + >=sys-devel/m4-1.4" + WANT_AUTOCONF="latest" + WANT_AUTOMAKE="latest" +fi + +if [[ -n "${FONT}" ]]; then + RDEPEND="${RDEPEND} + media-fonts/encodings + x11-apps/mkfontscale + x11-apps/mkfontdir" + PDEPEND="${PDEPEND} + media-fonts/font-alias" + + # Starting with 7.0RC3, we can specify the font directory + # But oddly, we can't do the same for encodings or font-alias + +# @ECLASS-VARIABLE: FONT_DIR +# @DESCRIPTION: +# If you're creating a font package and the suffix of PN is not equal to +# the subdirectory of /usr/share/fonts/ it should install into, set +# FONT_DIR to that directory or directories. Set before inheriting this +# eclass. + : ${FONT_DIR:=${PN##*-}} + + # Fix case of font directories + FONT_DIR=${FONT_DIR/ttf/TTF} + FONT_DIR=${FONT_DIR/otf/OTF} + FONT_DIR=${FONT_DIR/type1/Type1} + FONT_DIR=${FONT_DIR/speedo/Speedo} + + # Set up configure options, wrapped so ebuilds can override if need be + if [[ -z ${FONT_OPTIONS} ]]; then + FONT_OPTIONS="--with-fontdir=\"/usr/share/fonts/${FONT_DIR}\"" + fi + + if [[ -n "${FONT}" ]]; then + if [[ ${PN##*-} = misc ]] || [[ ${PN##*-} = 75dpi ]] || [[ ${PN##*-} = 100dpi ]] || [[ ${PN##*-} = cyrillic ]]; then + IUSE="${IUSE} nls" + fi + fi +fi + +# If we're a driver package +if [[ "${PN/#xf86-video}" != "${PN}" ]] || [[ "${PN/#xf86-input}" != "${PN}" ]]; then + # Enable driver code in the rest of the eclass + DRIVER="yes" +fi + +# Debugging -- ignore packages that can't be built with debugging +if [[ -z "${FONT}" ]] \ + && [[ "${CATEGORY/app-doc}" = "${CATEGORY}" ]] \ + && [[ "${CATEGORY/x11-proto}" = "${CATEGORY}" ]] \ + && [[ "${PN/util-macros}" = "${PN}" ]] \ + && [[ "${PN/xbitmaps}" = "${PN}" ]] \ + && [[ "${PN/xkbdata}" = "${PN}" ]] \ + && [[ "${PN/xorg-cf-files}" = "${PN}" ]] \ + && [[ "${PN/xcursor}" = "${PN}" ]] \ + ; then + DEBUGGABLE="yes" + IUSE="${IUSE} debug" +fi + +DEPEND="${DEPEND} + >=dev-util/pkgconfig-0.18" + +if [[ "${PN/util-macros}" = "${PN}" ]]; then + DEPEND="${DEPEND} + >=x11-misc/util-macros-1.3.0 + sys-devel/binutils" +fi + +RDEPEND="${RDEPEND} + !<=x11-base/xorg-x11-6.9" +# Provides virtual/x11 for temporary use until packages are ported +# x11-base/x11-env" + +# @FUNCTION: x-modular_specs_check +# @USAGE: +# @DESCRIPTION: +# Make any necessary changes related to gcc specs (generally hardened) +x-modular_specs_check() { + if [[ ${PN:0:11} = "xorg-server" ]] || [[ -n "${DRIVER}" ]]; then + append-ldflags -Wl,-z,lazy + # (#116698) breaks loading + filter-ldflags -Wl,-z,now + fi +} + +# @FUNCTION: x-modular_dri_check +# @USAGE: +# @DESCRIPTION: +# Ensures the server supports DRI if building a driver with DRI support +x-modular_dri_check() { + # (#120057) Enabling DRI in drivers requires that the server was built with + # support for it + # Starting with xorg-server 1.5.3, DRI support is always enabled unless + # USE=minimal is set (see bug #252084) + if [[ -n "${DRIVER}" ]]; then + if has dri ${IUSE} && use dri; then + einfo "Checking for direct rendering capabilities ..." + if has_version '>=x11-base/xorg-server-1.5.3'; then + if built_with_use x11-base/xorg-server minimal; then + die "You must build x11-base/xorg-server with USE=-minimal." + fi + else + if ! built_with_use x11-base/xorg-server dri; then + die "You must build x11-base/xorg-server with USE=dri." + fi + fi + fi + fi +} + +# @FUNCTION: x-modular_server_supports_drivers_check +# @USAGE: +# @DESCRIPTION: +# Ensures the server SDK is installed if a driver is being built +x-modular_server_supports_drivers_check() { + # (#135873) Only certain servers will actually use or be capable of + # building external drivers, including binary drivers. + if [[ -n "${DRIVER}" ]]; then + if has_version '>=x11-base/xorg-server-1.1'; then + if ! built_with_use x11-base/xorg-server xorg; then + eerror "x11-base/xorg-server is not built with support for external drivers." + die "You must build x11-base/xorg-server with USE=xorg." + fi + fi + fi +} + +# @FUNCTION: x-modular_unpack_source +# @USAGE: +# @DESCRIPTION: +# Simply unpack source code. Nothing else. +x-modular_unpack_source() { + if [[ -n ${GIT_ECLASS} ]]; then + git_src_unpack + else + unpack ${A} + fi + cd "${S}" + + if [[ -n ${FONT_OPTIONS} ]]; then + einfo "Detected font directory: ${FONT_DIR}" + fi +} + +# @FUNCTION: x-modular_patch_source +# @USAGE: +# @DESCRIPTION: +# Apply all patches +x-modular_patch_source() { + # Use standardized names and locations with bulk patching + # Patch directory is ${WORKDIR}/patch + # See epatch() in eutils.eclass for more documentation + if [[ -z "${EPATCH_SUFFIX}" ]] ; then + EPATCH_SUFFIX="patch" + fi + +# @VARIABLE: PATCHES +# @DESCRIPTION: +# If you have any patches to apply, set PATCHES to their locations and epatch +# will apply them. It also handles epatch-style bulk patches, if you know how to +# use them and set the correct variables. If you don't, read eutils.eclass. + if [[ ${#PATCHES[@]} -gt 1 ]]; then + for x in "${PATCHES[@]}"; do + epatch "${x}" + done + elif [[ -n "${PATCHES}" ]]; then + for x in ${PATCHES}; do + epatch "${x}" + done + # For non-default directory bulk patching + elif [[ -n "${PATCH_LOC}" ]] ; then + epatch ${PATCH_LOC} + # For standard bulk patching + elif [[ -d "${EPATCH_SOURCE}" ]] ; then + epatch + fi +} + +# @FUNCTION: x-modular_reconf_source +# @USAGE: +# @DESCRIPTION: +# Run eautoreconf if necessary, and run elibtoolize. +x-modular_reconf_source() { + if [[ "${SNAPSHOT}" = "yes" ]] + then + # If possible, generate configure if it doesn't exist + if [ -f "./configure.ac" ] + then + eautoreconf + fi + fi + + # Joshua Baergen - October 23, 2005 + # Fix shared lib issues on MIPS, FBSD, etc etc + elibtoolize +} + +# @FUNCTION: x-modular_src_prepare +# @USAGE: +# @DESCRIPTION: +# Prepare a package after unpacking, performing all X-related tasks. +x-modular_src_prepare() { + [[ -n ${GIT_ECLASS} ]] && has src_prepare ${EXPORTED_FUNCTIONS} \ + && git_src_prepare + x-modular_patch_source + x-modular_reconf_source +} + +# @FUNCTION: x-modular_src_unpack +# @USAGE: +# @DESCRIPTION: +# Unpack a package, performing all X-related tasks. +x-modular_src_unpack() { + x-modular_specs_check + x-modular_server_supports_drivers_check + x-modular_dri_check + x-modular_unpack_source + has src_prepare ${EXPORTED_FUNCTIONS} || x-modular_src_prepare +} + +# @FUNCTION: x-modular_font_configure +# @USAGE: +# @DESCRIPTION: +# If a font package, perform any necessary configuration steps +x-modular_font_configure() { + if [[ -n "${FONT}" ]]; then + # Might be worth adding an option to configure your desired font + # and exclude all others. Also, should this USE be nls or minimal? + if has nls ${IUSE//+} && ! use nls; then + FONT_OPTIONS="${FONT_OPTIONS} + --disable-iso8859-2 + --disable-iso8859-3 + --disable-iso8859-4 + --disable-iso8859-5 + --disable-iso8859-6 + --disable-iso8859-7 + --disable-iso8859-8 + --disable-iso8859-9 + --disable-iso8859-10 + --disable-iso8859-11 + --disable-iso8859-12 + --disable-iso8859-13 + --disable-iso8859-14 + --disable-iso8859-15 + --disable-iso8859-16 + --disable-jisx0201 + --disable-koi8-r" + fi + fi +} + +# @FUNCTION: x-modular_debug_setup +# @USAGE: +# @DESCRIPTION: +# Set up CFLAGS for a debug build +x-modular_debug_setup() { + if [[ -n "${DEBUGGABLE}" ]]; then + if use debug; then + strip-flags + append-flags -g + fi + fi +} + +# @FUNCTION: x-modular_src_configure +# @USAGE: +# @DESCRIPTION: +# Perform any necessary pre-configuration steps, then run configure +x-modular_src_configure() { + x-modular_font_configure + x-modular_debug_setup + +# @VARIABLE: CONFIGURE_OPTIONS +# @DESCRIPTION: +# Any extra options to pass to configure + + # If prefix isn't set here, .pc files cause problems + if [[ -x ${ECONF_SOURCE:-.}/configure ]]; then + econf --prefix=${XDIR} \ + --datadir=${XDIR}/share \ + ${FONT_OPTIONS} \ + ${DRIVER_OPTIONS} \ + ${CONFIGURE_OPTIONS} + fi +} + +# @FUNCTION: x-modular_src_make +# @USAGE: +# @DESCRIPTION: +# Run make. +x-modular_src_make() { + emake || die "emake failed" +} + +# @FUNCTION: x-modular_src_compile +# @USAGE: +# @DESCRIPTION: +# Compile a package, performing all X-related tasks. +x-modular_src_compile() { + has src_configure ${EXPORTED_FUNCTIONS} || x-modular_src_configure + x-modular_src_make +} + +# @FUNCTION: x-modular_src_install +# @USAGE: +# @DESCRIPTION: +# Install a built package to ${D}, performing any necessary steps. +# Creates a ChangeLog from git if using live ebuilds. +x-modular_src_install() { + # Install everything to ${XDIR} + if [[ ${CATEGORY} = x11-proto ]]; then + make \ + ${PN/proto/}docdir=/usr/share/doc/${PF} \ + DESTDIR="${D}" \ + install \ + || die + else + make \ + docdir=/usr/share/doc/${PF} \ + DESTDIR="${D}" \ + install \ + || die + fi +# Shouldn't be necessary in XDIR=/usr +# einstall forces datadir, so we need to re-force it +# datadir=${XDIR}/share \ +# mandir=${XDIR}/share/man \ + + if [[ -n ${GIT_ECLASS} ]]; then + pushd "${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}" + git log ${GIT_TREE} > "${S}"/ChangeLog + popd + fi + + if [[ -e ${S}/ChangeLog ]]; then + dodoc "${S}"/ChangeLog + fi +# @VARIABLE: DOCS +# @DESCRIPTION: +# Any documentation to install via dodoc + [[ -n ${DOCS} ]] && dodoc ${DOCS} + + # Don't install libtool archives for server modules + if [[ -e ${D}/usr/$(get_libdir)/xorg/modules ]]; then + find "${D}"/usr/$(get_libdir)/xorg/modules -name '*.la' \ + | xargs rm -f + fi + + if [[ -n "${FONT}" ]]; then + remove_font_metadata + fi + + if [[ -n "${DRIVER}" ]]; then + install_driver_hwdata + fi +} + +# @FUNCTION: x-modular_pkg_preinst +# @USAGE: +# @DESCRIPTION: +# This function doesn't do anything right now, but it may in the future. +x-modular_pkg_preinst() { + # We no longer do anything here, but we can't remove it from the API + : +} + +# @FUNCTION: x-modular_pkg_postinst +# @USAGE: +# @DESCRIPTION: +# Run X-specific post-installation tasks on the live filesystem. The +# only task right now is some setup for font packages. +x-modular_pkg_postinst() { + if [[ -n "${FONT}" ]]; then + setup_fonts + fi +} + +# @FUNCTION: x-modular_pkg_postrm +# @USAGE: +# @DESCRIPTION: +# Run X-specific post-removal tasks on the live filesystem. The only +# task right now is some cleanup for font packages. +x-modular_pkg_postrm() { + if [[ -n "${FONT}" ]]; then + cleanup_fonts + font_pkg_postrm + fi +} + +# @FUNCTION: cleanup_fonts +# @USAGE: +# @DESCRIPTION: +# Get rid of font directories that only contain generated files +cleanup_fonts() { + local ALLOWED_FILES="encodings.dir fonts.alias fonts.cache-1 fonts.dir fonts.scale" + for DIR in ${FONT_DIR}; do + unset KEEP_FONTDIR + REAL_DIR=${ROOT}usr/share/fonts/${DIR} + + ebegin "Checking ${REAL_DIR} for useless files" + pushd ${REAL_DIR} &> /dev/null + for FILE in *; do + unset MATCH + for ALLOWED_FILE in ${ALLOWED_FILES}; do + if [[ ${FILE} = ${ALLOWED_FILE} ]]; then + # If it's allowed, then move on to the next file + MATCH="yes" + break + fi + done + # If we found a match in allowed files, move on to the next file + if [[ -n ${MATCH} ]]; then + continue + fi + # If we get this far, there wasn't a match in the allowed files + KEEP_FONTDIR="yes" + # We don't need to check more files if we're already keeping it + break + done + popd &> /dev/null + # If there are no files worth keeping, then get rid of the dir + if [[ -z "${KEEP_FONTDIR}" ]]; then + rm -rf ${REAL_DIR} + fi + eend 0 + done +} + +# @FUNCTION: setup_fonts +# @USAGE: +# @DESCRIPTION: +# Generates needed files for fonts and fixes font permissions +setup_fonts() { + if [[ ! -n "${FONT_DIR}" ]]; then + msg="FONT_DIR is empty. The ebuild should set it to at least one subdir of /usr/share/fonts." + eerror "${msg}" + die "${msg}" + fi + + create_fonts_scale + create_fonts_dir + create_font_cache +} + +# @FUNCTION: remove_font_metadata +# @USAGE: +# @DESCRIPTION: +# Don't let the package install generated font files that may overlap +# with other packages. Instead, they're generated in pkg_postinst(). +remove_font_metadata() { + local DIR + for DIR in ${FONT_DIR}; do + if [[ "${DIR}" != "Speedo" ]] && \ + [[ "${DIR}" != "CID" ]] ; then + # Delete font metadata files + # fonts.scale, fonts.dir, fonts.cache-1 + rm -f "${D}"/usr/share/fonts/${DIR}/fonts.{scale,dir,cache-1} + fi + done +} + +# @FUNCTION: install_driver_hwdata +# @USAGE: +# @DESCRIPTION: +# Installs device-to-driver mappings for system-config-display and +# anything else that uses hwdata. +install_driver_hwdata() { + insinto /usr/share/hwdata/videoaliases + for i in "${FILESDIR}"/*.xinf; do + # We need this for the case when none exist, + # so *.xinf doesn't expand + if [[ -e $i ]]; then + doins $i + fi + done +} + +# @FUNCTION: discover_font_dirs +# @USAGE: +# @DESCRIPTION: +# Deprecated. Sets up the now-unused FONT_DIRS variable. +discover_font_dirs() { + FONT_DIRS="${FONT_DIR}" +} + +# @FUNCTION: create_fonts_scale +# @USAGE: +# @DESCRIPTION: +# Create fonts.scale file, used by the old server-side fonts subsystem. +create_fonts_scale() { + ebegin "Creating fonts.scale files" + local x + for DIR in ${FONT_DIR}; do + x=${ROOT}/usr/share/fonts/${DIR} + [[ -z "$(ls ${x}/)" ]] && continue + [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue + + # Only generate .scale files if truetype, opentype or type1 + # fonts are present ... + + # NOTE: There is no way to regenerate Speedo/CID fonts.scale + # 2 August 2004 + if [[ "${x/encodings}" = "${x}" ]] \ + && [[ -n "$(find ${x} -iname '*.[pot][ft][abcf]' -print)" ]]; then + mkfontscale \ + -a "${ROOT}"/usr/share/fonts/encodings/encodings.dir \ + -- ${x} + fi + done + eend 0 +} + +# @FUNCTION: create_fonts_dir +# @USAGE: +# @DESCRIPTION: +# Create fonts.dir file, used by the old server-side fonts subsystem. +create_fonts_dir() { + ebegin "Generating fonts.dir files" + for DIR in ${FONT_DIR}; do + x=${ROOT}/usr/share/fonts/${DIR} + [[ -z "$(ls ${x}/)" ]] && continue + [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue + + if [[ "${x/encodings}" = "${x}" ]]; then + mkfontdir \ + -e "${ROOT}"/usr/share/fonts/encodings \ + -e "${ROOT}"/usr/share/fonts/encodings/large \ + -- ${x} + fi + done + eend 0 +} + +# @FUNCTION: create_font_cache +# @USAGE: +# @DESCRIPTION: +# Create fonts.cache-1 files, used by the new client-side fonts +# subsystem. +create_font_cache() { + font_pkg_postinst +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/x11.eclass b/sdk_container/src/third_party/portage-stable/eclass/x11.eclass new file mode 100644 index 0000000000..74b56df9cd --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/x11.eclass @@ -0,0 +1,7 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/x11.eclass,v 1.12 2009/11/30 04:19:36 abcd Exp $ + +# @DEAD +# To be removed on 2011/11/30. +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" diff --git a/sdk_container/src/third_party/portage-stable/eclass/xemacs-elisp-common.eclass b/sdk_container/src/third_party/portage-stable/eclass/xemacs-elisp-common.eclass new file mode 100644 index 0000000000..fc572f7691 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/xemacs-elisp-common.eclass @@ -0,0 +1,146 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/xemacs-elisp-common.eclass,v 1.3 2009/06/21 14:53:12 graaff Exp $ +# +# Copyright 2007 Hans de Graaff +# +# Based on elisp-common.eclass: +# Copyright 2007 Christian Faulhammer +# Copyright 2002-2004 Matthew Kennedy +# Copyright 2004-2005 Mamoru Komachi +# Copyright 2003 Jeremy Maitin-Shepard +# Copyright 2007 Ulrich Mueller +# +# @ECLASS: xemacs-elisp-common.eclass +# @MAINTAINER: +# xemacs@gentoo.org +# @BLURB: XEmacs-related installation utilities +# @DESCRIPTION: +# +# Usually you want to use this eclass for (optional) XEmacs support of +# your package. This is NOT for GNU Emacs! +# +# 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 xemacs USE flag, you need to add +# +# xemacs? ( app-editors/xemacs ) +# +# to your DEPEND/RDEPEND line and use the functions provided here to bring +# the files to the correct locations. +# +# .SS +# src_compile() usage: +# +# An elisp file is compiled by the xemacs-elisp-compile() function +# defined here and simply takes the source files as arguments. +# +# xemacs-elisp-compile *.el +# +# In the case of interdependent elisp files, you can use the +# xemacs-elisp-comp() function which makes sure all files are +# loadable. +# +# xemacs-elisp-comp *.el +# +# Function xemacs-elisp-make-autoload-file() can be used to generate a +# file with autoload definitions for the lisp functions. It takes a +# list of directories (default: working directory) as its argument. +# Use of this function requires that the elisp source files contain +# magic ";;;###autoload" comments. See the XEmacs Lisp Reference Manual +# (node "Autoload") for a detailed explanation. +# +# .SS +# src_install() usage: +# +# The resulting compiled files (.elc) should be put in a subdirectory +# of /usr/lib/xemacs/site-lisp/ which is named after the first +# argument of xemacs-elisp-install(). The following parameters are +# the files to be put in that directory. Usually the subdirectory +# should be ${PN}, but you can choose something else. +# +# xemacs-elisp-install ${PN} *.el *.elc +# + + +SITEPACKAGE=/usr/lib/xemacs/site-packages +XEMACS=/usr/bin/xemacs +XEMACS_BATCH_CLEAN="${XEMACS} --batch --no-site-file --no-init-file" + +# @FUNCTION: xemacs-elisp-compile +# @USAGE: +# @DESCRIPTION: +# Byte-compile elisp files with xemacs. This function will die when +# there is a problem compiling the lisp files. +xemacs-elisp-compile () { + { + ${XEMACS_BATCH_CLEAN} -f batch-byte-compile "$@" + xemacs-elisp-make-autoload-file "$@" + } || die "Compile lisp files failed" +} + +xemacs-elisp-make-autoload-file () { + ${XEMACS_BATCH_CLEAN} \ + -eval "(setq autoload-package-name \"${PN}\")" \ + -eval "(setq generated-autoload-file \"${S}/auto-autoloads.el\")" \ + -l autoload -f batch-update-autoloads "$@" +} + +# @FUNCTION: xemacs-elisp-install +# @USAGE: +# @DESCRIPTION: +# Install elisp source and byte-compiled files. All files are installed +# in site-packages in their own directory, indicated by the first +# argument to the function. This function will die if there is a problem +# installing the list files. + +xemacs-elisp-install () { + local subdir="$1" + shift + ( # use sub-shell to avoid possible environment polution + dodir "${SITEPACKAGE}"/lisp/"${subdir}" + insinto "${SITEPACKAGE}"/lisp/"${subdir}" + doins "$@" + ) || die "Installing lisp files failed" +} + +# @FUNCTION: xemacs-elisp-comp +# @USAGE: +# @DESCRIPTION: +# Byte-compile interdependent XEmacs lisp files. +# Originally taken from GNU autotools, but some configuration options +# removed as they don't make sense with the current status of XEmacs +# in Gentoo. + +xemacs-elisp-comp() { + # Copyright 1995 Free Software Foundation, Inc. + # François Pinard , 1995. + # This script byte-compiles all `.el' files which are part of its + # arguments, using XEmacs, and put the resulting `.elc' files into + # the current directory, so disregarding the original directories used + # in `.el' arguments. + # + # This script manages in such a way that all XEmacs LISP files to + # be compiled are made visible between themselves, in the event + # they require or load-library one another. + + test $# -gt 0 || return 1 + + einfo "Compiling XEmacs Elisp files ..." + + tempdir=elc.$$ + mkdir ${tempdir} + cp "$@" ${tempdir} + pushd ${tempdir} + + echo "(add-to-list 'load-path \"../\")" > script + ${XEMACS_BATCH_CLEAN} -l script -f batch-byte-compile *.el + local ret=$? + mv *.elc .. + + popd + rm -fr ${tempdir} + return ${ret} +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/xemacs-elisp.eclass b/sdk_container/src/third_party/portage-stable/eclass/xemacs-elisp.eclass new file mode 100644 index 0000000000..27a3e515b5 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/xemacs-elisp.eclass @@ -0,0 +1,55 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/xemacs-elisp.eclass,v 1.2 2007/09/25 18:27:12 graaff Exp $ +# +# Copyright 2007 Hans de Graaff +# +# Based on elisp.eclass: +# Copyright 2007 Christian Faulhammer +# Copyright 2002-2003 Matthew Kennedy +# Copyright 2003 Jeremy Maitin-Shepard +# +# @ECLASS: xemacs-elisp.eclass +# @MAINTAINER: +# xemacs@gentoo.org +# @BLURB: Eclass for XEmacs Lisp packages +# @DESCRIPTION: +# +# Emacs support for other than pure elisp packages is handled by +# xemacs-elisp-common.eclass where you won't have a dependency on XEmacs +# itself. All elisp-* functions are documented there. +# +# @VARIABLE: SIMPLE_ELISP +# @DESCRIPTION: +# Setting SIMPLE_ELISP=t in an ebuild means, that the package's source +# is a single (in whatever way) compressed elisp file with the file name +# ${PN}-${PV}. This eclass will then redefine ${S}, and move +# ${PN}-${PV}.el to ${PN}.el in src_unpack(). + +inherit xemacs-elisp-common + +if [ "${SIMPLE_ELISP}" = 't' ]; then + S="${WORKDIR}/" +fi + + +DEPEND="app-editors/xemacs" +IUSE="" + +xemacs-elisp_src_unpack() { + unpack ${A} + if [ "${SIMPLE_ELISP}" = 't' ] + then + cd "${S}" && mv ${P}.el ${PN}.el + fi +} + +xemacs-elisp_src_compile() { + xemacs-elisp-compile *.el +} + +xemacs-elisp_src_install () { + xemacs-elisp-install "${PN}" *.el *.elc +} + +EXPORT_FUNCTIONS src_unpack src_compile src_install diff --git a/sdk_container/src/third_party/portage-stable/eclass/xemacs-packages.eclass b/sdk_container/src/third_party/portage-stable/eclass/xemacs-packages.eclass new file mode 100644 index 0000000000..c612062894 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/xemacs-packages.eclass @@ -0,0 +1,47 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/xemacs-packages.eclass,v 1.15 2009/06/21 14:53:12 graaff Exp $ +# +# xemacs-packages eclass inherited by all xemacs packages +# $PKG_CAT need's to be set before inheriting xemacs-packages + +EXPORT_FUNCTIONS src_unpack src_compile src_install + +DEPEND="app-editors/xemacs" + +[ -z "$HOMEPAGE" ] && HOMEPAGE="http://xemacs.org/" +[ -z "$LICENSE" ] && LICENSE="GPL-2" + +case "${PKG_CAT}" in + "standard" ) + MY_INSTALL_DIR="/usr/lib/xemacs/xemacs-packages" ;; + + "mule" ) + MY_INSTALL_DIR="/usr/lib/xemacs/mule-packages" ;; + + "contrib" ) + MY_INSTALL_DIR="/usr/lib/xemacs/site-packages" ;; +esac +[ -n "$DEBUG" ] && einfo "MY_INSTALL_DIR is ${MY_INSTALL_DIR}" + +if [ -n "$EXPERIMENTAL" ] +then + [ -z "$SRC_URI" ] && SRC_URI="ftp://ftp.xemacs.org/beta/experimental/packages/${P}-pkg.tar.gz" +else + [ -z "$SRC_URI" ] && SRC_URI="http://ftp.xemacs.org/pub/xemacs/packages/${P}-pkg.tar.gz" +fi +[ -n "$DEBUG" ] && einfo "SRC_URI is ${SRC_URI}" + +xemacs-packages_src_unpack() { + return 0 +} + +xemacs-packages_src_compile() { + einfo "Nothing to compile" +} + +xemacs-packages_src_install() { + dodir ${MY_INSTALL_DIR} + cd "${D}${MY_INSTALL_DIR}" + unpack ${A} +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/xfce4.eclass b/sdk_container/src/third_party/portage-stable/eclass/xfce4.eclass new file mode 100644 index 0000000000..8b2da2a0a8 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/xfce4.eclass @@ -0,0 +1,15 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/xfce4.eclass,v 1.33 2009/11/30 04:19:36 abcd Exp $ + +# @DEAD +# To be removed on 2011/09/30. +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" + +xfce4_pkg_postrm() { + fdo-mime_desktop_database_update + fdo-mime_mime_database_update + gnome2_icon_cache_update +} + +EXPORT_FUNCTIONS pkg_postrm diff --git a/sdk_container/src/third_party/portage-stable/eclass/xfce42.eclass b/sdk_container/src/third_party/portage-stable/eclass/xfce42.eclass new file mode 100644 index 0000000000..aaf54166fb --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/xfce42.eclass @@ -0,0 +1,7 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/xfce42.eclass,v 1.10 2009/11/30 04:19:36 abcd Exp $ + +# @DEAD +# To be removed on 2011/09/30. +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" diff --git a/sdk_container/src/third_party/portage-stable/eclass/xfce44.eclass b/sdk_container/src/third_party/portage-stable/eclass/xfce44.eclass new file mode 100644 index 0000000000..21e046f0d5 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/xfce44.eclass @@ -0,0 +1,13 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/xfce44.eclass,v 1.25 2009/11/30 04:19:36 abcd Exp $ + +# @DEAD +# To be removed on 2011/09/30. +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" + +xfce44_pkg_postrm() { + : +} + +EXPORT_FUNCTIONS pkg_postrm diff --git a/sdk_container/src/third_party/portage-stable/eclass/xfconf.eclass b/sdk_container/src/third_party/portage-stable/eclass/xfconf.eclass new file mode 100644 index 0000000000..ef41a38999 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/xfconf.eclass @@ -0,0 +1,140 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/xfconf.eclass,v 1.7 2010/01/23 17:36:34 angelos Exp $ + +# @ECLASS: xfconf.eclass +# @MAINTAINER: +# XFCE maintainers +# @BLURB: Default XFCE ebuild layout +# @DESCRIPTION: +# Default XFCE ebuild layout + +# @ECLASS-VARIABLE: EAUTORECONF +# @DESCRIPTION: +# Run eautoreconf instead of elibtoolize if set "yes" + +# @ECLASS-VARIABLE: EINTLTOOLIZE +# @DESCRIPTION: +# Run intltoolize --force --copy --automake if set "yes" + +# @ECLASS-VARIABLE: DOCS +# @DESCRIPTION: +# Define documentation to install + +# @ECLASS-VARIABLE: PATCHES +# @DESCRIPTION: +# Define patches to apply + +# @ECLASS-VARIABLE: XFCONF +# @DESCRIPTION: +# Define options for econf + +inherit autotools base fdo-mime gnome2-utils libtool + +if ! [[ ${MY_P} ]]; then + MY_P=${P} +else + S=${WORKDIR}/${MY_P} +fi + +SRC_URI="mirror://xfce/xfce/${PV}/src/${MY_P}.tar.bz2" + +if [[ "${EINTLTOOLIZE}" == "yes" ]]; then + _xfce4_intltool="dev-util/intltool" +fi + +if [[ "${EAUTORECONF}" == "yes" ]]; then + _xfce4_m4="dev-util/xfce4-dev-tools" +fi + +RDEPEND="" +DEPEND="${_xfce4_intltool} + ${_xfce4_m4}" + +unset _xfce4_intltool +unset _xfce4_m4 + +XFCONF_EXPF="src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_postrm" +case ${EAPI:-0} in + 3|2) XFCONF_EXPF="${XFCONF_EXPF} src_prepare src_configure" ;; + 1|0) ;; + *) die "Unknown EAPI." ;; +esac +EXPORT_FUNCTIONS ${XFCONF_EXPF} + +# @FUNCTION: xfconf_src_unpack +# @DESCRIPTION: +# Run base_src_util autopatch and eautoreconf or elibtoolize +xfconf_src_unpack() { + unpack ${A} + cd "${S}" + has src_prepare ${XFCONF_EXPF} || xfconf_src_prepare +} + +# @FUNCTION: xfconf_src_prepare +# @DESCRIPTION: +# Run base_src_util autopatch and eautoreconf or elibtoolize +xfconf_src_prepare() { + base_src_prepare + + if [[ "${EINTLTOOLIZE}" == "yes" ]]; then + intltoolize --force --copy --automake || die "intltoolize failed" + fi + + if [[ "${EAUTORECONF}" == "yes" ]]; then + AT_M4DIR="/usr/share/xfce4/dev-tools/m4macros" eautoreconf + else + elibtoolize + fi +} + +# @FUNCTION: xfconf_src_configure +# @DESCRIPTION: +# Run econf with opts in XFCONF variable +xfconf_src_configure() { + econf ${XFCONF} +} + +# @FUNCTION: xfconf_src_compile +# @DESCRIPTION: +# Run econf with opts in XFCONF variable +xfconf_src_compile() { + has src_configure ${XFCONF_EXPF} || xfconf_src_configure + emake || die "emake failed" +} + +# @FUNCTION: xfconf_src_install +# @DESCRIPTION: +# Run emake install and install documentation in DOCS variable +xfconf_src_install() { + emake DESTDIR="${D}" install || die "emake install failed" + + if [[ -n ${DOCS} ]]; then + dodoc ${DOCS} || die "dodoc failed" + fi +} + +# @FUNCTION: xfconf_pkg_preinst +# @DESCRIPTION: +# Run gnome2_icon_savelist +xfconf_pkg_preinst() { + gnome2_icon_savelist +} + +# @FUNCTION: xfconf_pkg_postinst +# @DESCRIPTION: +# Run fdo-mime_{desktop,mime}_database_update and gnome2_icon_cache_update +xfconf_pkg_postinst() { + fdo-mime_desktop_database_update + fdo-mime_mime_database_update + gnome2_icon_cache_update +} + +# @FUNCTION: xfconf_pkg_postrm +# @DESCRIPTION: +# Run fdo-mime_{desktop,mime}_database_update and gnome2_icon_cache_update +xfconf_pkg_postrm() { + fdo-mime_desktop_database_update + fdo-mime_mime_database_update + gnome2_icon_cache_update +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/xmms-plugin.eclass b/sdk_container/src/third_party/portage-stable/eclass/xmms-plugin.eclass new file mode 100644 index 0000000000..9322b0d8e2 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/xmms-plugin.eclass @@ -0,0 +1,8 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/xmms-plugin.eclass,v 1.24 2009/11/30 04:19:36 abcd Exp $ + +# @DEAD +# XMMS is no longer in the tree, so there can't be any plugins for it +# To be removed on 2011/11/30. +ewarn "Please fix your package (${CATEGORY}/${PF}) to not use ${ECLASS}.eclass" diff --git a/sdk_container/src/third_party/portage-stable/eclass/zproduct.eclass b/sdk_container/src/third_party/portage-stable/eclass/zproduct.eclass new file mode 100644 index 0000000000..eaa33ada7d --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/zproduct.eclass @@ -0,0 +1,141 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/zproduct.eclass,v 1.27 2009/02/26 14:25:44 tupone Exp $ +# Author: Jason Shoemaker + +# This eclass is designed to streamline the construction of +# ebuilds for new zope products + +EXPORT_FUNCTIONS src_install pkg_prerm pkg_postinst pkg_config + +DESCRIPTION="This is a zope product" + +RDEPEND="net-zope/zope + app-admin/zprod-manager" + +IUSE="" +SLOT="0" +S=${WORKDIR} + +ZI_DIR="${ROOT}/var/lib/zope/" +ZP_DIR="${ROOT}/usr/share/zproduct" +DOT_ZFOLDER_FPATH="${ZP_DIR}/${PF}/.zfolder.lst" + +zproduct_src_install() { + ## Assume that folders or files that shouldn't be installed + # in the zproduct directory have been already been removed. + ## Assume $S set to the parent directory of the zproduct(s). + + debug-print-function ${FUNCNAME} ${*} + [ -n "${ZPROD_LIST}" ] || die "ZPROD_LIST isn't defined." + [ -z "${1}" ] && zproduct_src_install all + + # set defaults + into ${ZP_DIR} + dodir ${ZP_DIR}/${PF} + + while [ -n "$1" ] ; do + case ${1} in + do_zpfolders) + ## Create .zfolders.lst from $ZPROD_LIST. + debug-print-section do_zpfolders + for N in ${ZPROD_LIST} ; do + echo ${N} >> "${D}"/${DOT_ZFOLDER_FPATH} + done + ;; + do_docs) + #*Moves txt docs + debug-print-section do_docs + docs_move + for ZPROD in ${ZPROD_LIST} ; do + docs_move ${ZPROD}/ + done + ;; + do_install) + debug-print-section do_install + # Copy everything that's left to ${D}${ZP_DIR} + # modified to not copy ownership (QA) + cp --recursive --no-dereference --preserve=timestamps,mode,links "${S}"/* "${D}"/${ZP_DIR}/${PF} + ;; + all) + debug-print-section all + zproduct_src_install do_zpfolders do_docs do_install ;; + esac + shift + done + debug-print "${FUNCNAME}: result is ${RESULT}" +} + +docs_move() { + # if $1 == "/", then this breaks. + if [ -n "$1" ] ; then + docinto $1 + else + docinto / + fi + dodoc $1HISTORY.txt $1README{.txt,} $1INSTALL{.txt,} > /dev/null 2>/dev/null + dodoc $1AUTHORS $1COPYING $1CREDITS.txt $1TODO{.txt,} > /dev/null 2>/dev/null + dodoc $1LICENSE{.GPL,.txt,} $1CHANGES{.txt,} > /dev/null 2>/dev/null + dodoc $1DEPENDENCIES.txt $1FAQ.txt $1UPGRADE.txt > /dev/null 2>/dev/null + for item in ${MYDOC} ; do + dodoc ${1}${item} > /dev/null 2>/dev/null + done +} + +zproduct_pkg_postinst() { + #*check for multiple zinstances, if several display install help msg. + + #*Use zprod-update to install this zproduct to the default zinstance. + debug-print-function ${FUNCNAME} ${*} + + # this is a shared directory, so root should be owner; + # zprod-manager or whatever is used to copy products into the + # instances has to take care of setting the right permissions in + # the target directory + + chown -R root:root ${ZP_DIR}/${PF} + # make shure there is nothing writable in the new dir, and all is readable + chmod -R go-w,a+rX ${ZP_DIR}/${PF} + + einfo "Attention: ${PF} was not installed in any instance! Use 'zprod-manager add'" + #disabled by radek@20061228 - contact me in case of any question! + #${ROOT}/usr/sbin/zprod-manager add ${ZP_DIR}/${PF} +} + +zproduct_pkg_prerm() { + # checks how many times product is installed and informs about it + # it does not remove it (change in behaviour done by radek@20061228) + debug-print-function ${FUNCNAME} ${*} + ZINST_LST=$(ls /var/lib/zope/) + if [ "${ZINST_LST}" ] ; then + # first check and warn on any installed products into instances + ARE_INSTALLED=0 + for N in ${ZINST_LST} ; do + if [ -s $DOT_ZFOLDER_FPATH ] + then + # check only if installed product has non empty folder lists + # + # for every fodler inside product ... + for PFOLD in `cat $DOT_ZFOLDER_FPATH` + do + # ... check if its in instance. + if [ -d "${ZI_DIR}${N}/Products/${PFOLD}" ] + then + ARE_INSTALLED=$[ARE_INSTALLED + 1] + fi + done + fi + done + if [ $ARE_INSTALLED -gt 0 ] + then + ewarn "Detected at least $ARE_INSTALLED copies of product being unmerged." + ewarn "Please manually remove it from instances using 'zprod-manager del'" + ewarn "Product is removed from ${ZP_DIR} but not from instances!" + fi + fi +} + +zproduct_pkg_config() { + einfo "To add zproducts to zope instances use:" + einfo "\tzprod-manager add" +}