diff --git a/sdk_container/src/third_party/portage-stable/app-text/texi2html/texi2html-1.78.ebuild b/sdk_container/src/third_party/portage-stable/app-text/texi2html/texi2html-1.78.ebuild new file mode 100644 index 0000000000..0e27e825eb --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/app-text/texi2html/texi2html-1.78.ebuild @@ -0,0 +1,29 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-text/texi2html/texi2html-1.78.ebuild,v 1.12 2011/10/04 17:40:10 jer Exp $ + +EAPI=3 + +DESCRIPTION="Perl script that converts Texinfo to HTML" +HOMEPAGE="http://www.nongnu.org/texi2html/" +SRC_URI="http://download.savannah.gnu.org/releases/texi2html/${P}.tar.bz2" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd ~x64-freebsd ~x86-freebsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris" +IUSE="" + +DEPEND=">=dev-lang/perl-5.6.1" + +src_install() { + #yes, htmldir line is correct, no ${D} + emake DESTDIR="${D}" \ + htmldir="${EPREFIX}"/usr/share/doc/${PF}/html \ + install || die "Installation Failed" + + dodoc AUTHORS ChangeLog NEWS README TODO +} + +pkg_preinst() { + rm -f "${EROOT}"/usr/bin/texi2html +} diff --git a/sdk_container/src/third_party/portage-stable/dev-libs/libxslt/files/libxslt-1.1.23-parallel-install.patch b/sdk_container/src/third_party/portage-stable/dev-libs/libxslt/files/libxslt-1.1.23-parallel-install.patch new file mode 100644 index 0000000000..1c06906318 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-libs/libxslt/files/libxslt-1.1.23-parallel-install.patch @@ -0,0 +1,16 @@ +http://bugs.gentoo.org/212784 + +--- libxslt-1.1.22/work/libxslt-1.1.22/python/Makefile.am ++++ libxslt-1.1.23/work/libxslt-1.1.23/python/Makefile.am +@@ -42,9 +42,9 @@ + cat $(srcdir)/libxsl.py $(srcdir)/libxsltclass.py > libxslt.py + + install-data-local: +- $(mkinstalldirs) $(DESTDIR)$(pythondir) ++ -$(mkinstalldirs) $(DESTDIR)$(pythondir) + @INSTALL@ -m 0644 libxslt.py $(DESTDIR)$(pythondir) +- $(mkinstalldirs) $(DESTDIR)$(DOCS_DIR) ++ -$(mkinstalldirs) $(DESTDIR)$(DOCS_DIR) + @(for doc in $(DOCS) ; \ + do @INSTALL@ -m 0644 $(srcdir)/$$doc $(DESTDIR)$(DOCS_DIR) ; done) + diff --git a/sdk_container/src/third_party/portage-stable/dev-libs/libxslt/files/libxslt-1.1.26-disable_static_modules.patch b/sdk_container/src/third_party/portage-stable/dev-libs/libxslt/files/libxslt-1.1.26-disable_static_modules.patch new file mode 100644 index 0000000000..fad067ff43 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-libs/libxslt/files/libxslt-1.1.26-disable_static_modules.patch @@ -0,0 +1,12 @@ +--- python/Makefile.am ++++ python/Makefile.am +@@ -24,7 +24,8 @@ + libxslt-python-api.xml \ + $(DOCS) + +-libxsltmod_la_LDFLAGS = $(WIN32_EXTRA_LDFLAGS) -module -avoid-version ++libxsltmod_la_CPPFLAGS = -shared ++libxsltmod_la_LDFLAGS = $(WIN32_EXTRA_LDFLAGS) -module -avoid-version -shared + + if WITH_PYTHON + mylibs = \ diff --git a/sdk_container/src/third_party/portage-stable/dev-libs/libxslt/files/libxslt-1.1.26-id-generation.patch b/sdk_container/src/third_party/portage-stable/dev-libs/libxslt/files/libxslt-1.1.26-id-generation.patch new file mode 100644 index 0000000000..f8f4c2a955 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-libs/libxslt/files/libxslt-1.1.26-id-generation.patch @@ -0,0 +1,56 @@ +From ecb6bcb8d1b7e44842edde3929f412d46b40c89f Mon Sep 17 00:00:00 2001 +From: Daniel Veillard +Date: Tue, 22 Feb 2011 02:14:23 +0000 +Subject: Fix generate-id() to not expose object addresses + +As pointed out by Chris Evans it's better +security wise to not expose object addresses directly, use a diff +w.r.t. the document root own address to avoid this +* libxslt/functions.c: fix IDs generation code +--- +diff --git a/libxslt/functions.c b/libxslt/functions.c +index 4720c7a..de962f4 100644 +--- a/libxslt/functions.c ++++ b/libxslt/functions.c +@@ -654,8 +654,9 @@ xsltFormatNumberFunction(xmlXPathParserContextPtr ctxt, int nargs) + void + xsltGenerateIdFunction(xmlXPathParserContextPtr ctxt, int nargs){ + xmlNodePtr cur = NULL; +- unsigned long val; +- xmlChar str[20]; ++ long val; ++ xmlChar str[30]; ++ xmlDocPtr doc; + + if (nargs == 0) { + cur = ctxt->context->node; +@@ -694,9 +695,24 @@ xsltGenerateIdFunction(xmlXPathParserContextPtr ctxt, int nargs){ + * Okay this is ugly but should work, use the NodePtr address + * to forge the ID + */ +- val = (unsigned long)((char *)cur - (char *)0); +- val /= sizeof(xmlNode); +- sprintf((char *)str, "id%ld", val); ++ if (cur->type != XML_NAMESPACE_DECL) ++ doc = cur->doc; ++ else { ++ xmlNsPtr ns = (xmlNsPtr) cur; ++ ++ if (ns->context != NULL) ++ doc = ns->context; ++ else ++ doc = ctxt->context->doc; ++ ++ } ++ ++ val = (long)((char *)cur - (char *)doc); ++ if (val >= 0) { ++ sprintf((char *)str, "idp%ld", val); ++ } else { ++ sprintf((char *)str, "idm%ld", -val); ++ } + valuePush(ctxt, xmlXPathNewString(str)); + } + +-- +cgit v0.8.3.4 diff --git a/sdk_container/src/third_party/portage-stable/dev-libs/libxslt/files/libxslt-1.1.26-undefined.patch b/sdk_container/src/third_party/portage-stable/dev-libs/libxslt/files/libxslt-1.1.26-undefined.patch new file mode 100644 index 0000000000..364276a809 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-libs/libxslt/files/libxslt-1.1.26-undefined.patch @@ -0,0 +1,14 @@ +http://bugs.gentoo.org/show_bug.cgi?id=246748 + +diff -ur libxslt-1.1.26.orig/python/Makefile.am libxslt-1.1.26/python/Makefile.am +--- libxslt-1.1.26.orig/python/Makefile.am 2009-05-12 09:29:34.000000000 +0300 ++++ libxslt-1.1.26/python/Makefile.am 2009-10-07 18:27:35.000000000 +0300 +@@ -36,7 +36,7 @@ + python_LTLIBRARIES = libxsltmod.la + + libxsltmod_la_SOURCES = libxslt.c types.c libxslt-py.c +-libxsltmod_la_LIBADD = $(mylibs) ++libxsltmod_la_LIBADD = $(mylibs) -lpython$(PYTHON_VERSION) + + libxslt.py: $(srcdir)/libxsl.py $(srcdir)/libxsltclass.py + cat $(srcdir)/libxsl.py $(srcdir)/libxsltclass.py > libxslt.py diff --git a/sdk_container/src/third_party/portage-stable/dev-libs/libxslt/files/libxslt.m4-libxslt-1.1.26.patch b/sdk_container/src/third_party/portage-stable/dev-libs/libxslt/files/libxslt.m4-libxslt-1.1.26.patch new file mode 100644 index 0000000000..d6aaae4e9d --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-libs/libxslt/files/libxslt.m4-libxslt-1.1.26.patch @@ -0,0 +1,38 @@ +diff -ur libxslt-1.1.26.orig/libxslt.m4 libxslt-1.1.26/libxslt.m4 +--- libxslt-1.1.26.orig/libxslt.m4 2009-05-12 09:29:34.000000000 +0300 ++++ libxslt-1.1.26/libxslt.m4 2009-10-07 17:03:04.000000000 +0300 +@@ -52,8 +52,10 @@ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_xslttest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" ++ ac_save_CXXFLAGS="$CXXFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $XSLT_CFLAGS" ++ CXXFLAGS="$CXXFLAGS $XSLT_CFLAGS" + LIBS="$XSLT_LIBS $LIBS" + dnl + dnl Now check if the installed libxslt is sufficiently new. +@@ -138,6 +140,7 @@ + } + ],, no_xslt=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" ++ CXXFLAGS="$ac_save_CXXFLAGS" + LIBS="$ac_save_LIBS" + fi + fi +@@ -158,6 +161,7 @@ + else + echo "*** Could not run libxslt test program, checking why..." + CFLAGS="$CFLAGS $XSLT_CFLAGS" ++ CXXFLAGS="$CXXFLAGS $XSLT_CFLAGS" + LIBS="$LIBS $XSLT_LIBS" + AC_TRY_LINK([ + #include +@@ -177,6 +181,7 @@ + echo "*** or that you have moved LIBXSLT since it was installed. In the latter case, you" + echo "*** may want to edit the xslt-config script: $XSLT_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" ++ CXXFLAGS="$ac_save_CXXFLAGS" + LIBS="$ac_save_LIBS" + fi + fi diff --git a/sdk_container/src/third_party/portage-stable/dev-libs/libxslt/libxslt-1.1.26-r1.ebuild b/sdk_container/src/third_party/portage-stable/dev-libs/libxslt/libxslt-1.1.26-r1.ebuild new file mode 100644 index 0000000000..26ccac4e6d --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-libs/libxslt/libxslt-1.1.26-r1.ebuild @@ -0,0 +1,118 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-libs/libxslt/libxslt-1.1.26-r1.ebuild,v 1.7 2011/03/18 17:30:53 armin76 Exp $ + +EAPI="3" +PYTHON_DEPEND="python? 2" +SUPPORT_PYTHON_ABIS="1" +RESTRICT_PYTHON_ABIS="3.* *-jython" + +inherit autotools eutils python toolchain-funcs + +DESCRIPTION="XSLT libraries and tools" +HOMEPAGE="http://www.xmlsoft.org/" +SRC_URI="ftp://xmlsoft.org/${PN}/${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd" +IUSE="crypt debug python" + +DEPEND=">=dev-libs/libxml2-2.6.27:2 + crypt? ( >=dev-libs/libgcrypt-1.1.42 )" +RDEPEND="${DEPEND}" + +pkg_setup() { + if use python; then + python_pkg_setup + fi +} + +src_prepare() { + epatch "${FILESDIR}"/libxslt.m4-${P}.patch \ + "${FILESDIR}"/${PN}-1.1.23-parallel-install.patch \ + "${FILESDIR}"/${P}-undefined.patch \ + "${FILESDIR}"/${P}-disable_static_modules.patch + + # Python bindings are built/tested/installed manually. + sed -e "s/@PYTHON_SUBDIR@//" -i Makefile.am || die "sed failed" + + # Fix generate-id() to not expose object addresses, bug #358615 + epatch "${FILESDIR}/${P}-id-generation.patch" + + eautoreconf + epunt_cxx +} + +src_configure() { + # libgcrypt is missing pkg-config file, so fixing cross-compile + # here. see bug 267503. + if tc-is-cross-compiler; then + export LIBGCRYPT_CONFIG="${SYSROOT}/usr/bin/libgcrypt-config" + fi + + econf \ + --disable-dependency-tracking \ + --with-html-dir=/usr/share/doc/${PF} \ + --with-html-subdir=html \ + $(use_with crypt crypto) \ + $(use_with python) \ + $(use_with debug) \ + $(use_with debug mem-debug) +} + +src_compile() { + default + + if use python; then + python_copy_sources python + building() { + emake PYTHON_INCLUDES="$(python_get_includedir)" \ + PYTHON_SITE_PACKAGES="$(python_get_sitedir)" \ + PYTHON_VERSION="$(python_get_version)" + } + python_execute_function -s --source-dir python building + fi +} + +src_test() { + default + + if use python; then + testing() { + emake test + } + python_execute_function -s --source-dir python testing + fi +} + +src_install() { + emake DESTDIR="${D}" install || die + + if use python; then + installation() { + emake DESTDIR="${D}" \ + PYTHON_SITE_PACKAGES="$(python_get_sitedir)" \ + install + } + python_execute_function -s --source-dir python installation + + python_clean_installation_image + fi + + mv -vf "${ED}"/usr/share/doc/${PN}-python-${PV} \ + "${ED}"/usr/share/doc/${PF}/python + dodoc AUTHORS ChangeLog FEATURES NEWS README TODO || die +} + +pkg_postinst() { + if use python; then + python_mod_optimize libxslt.py + fi +} + +pkg_postrm() { + if use python; then + python_mod_cleanup libxslt.py + fi +} diff --git a/sdk_container/src/third_party/portage-stable/dev-util/scons/files/scons-1.2.0-popen.patch b/sdk_container/src/third_party/portage-stable/dev-util/scons/files/scons-1.2.0-popen.patch new file mode 100644 index 0000000000..23063cffd0 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-util/scons/files/scons-1.2.0-popen.patch @@ -0,0 +1,58 @@ +--- engine/SCons/compat/__init__.py (revision 2695) ++++ engine/SCons/compat/__init__.py (working copy) +@@ -167,11 +167,17 @@ + del shlex + import_as('_scons_shlex', 'shlex') + +-try: +- import subprocess +-except ImportError: +- # Pre-2.4 Python has no subprocess module. +- import_as('_scons_subprocess', 'subprocess') ++#try: ++# import subprocess ++#except ImportError: ++# # Pre-2.4 Python has no subprocess module. ++# import_as('_scons_subprocess', 'subprocess') ++ ++# Import subprocess unconditionally to avoid possible race conditions in ++# the official subprocess API. If there are API versions without known ++# problems, we can version-check and use the original subprocess module ++# in these cases. ++import_as('_scons_subprocess', 'subprocess') + + import sys + try: + + +--- engine/SCons/compat/_scons_subprocess.py (revision 2695) ++++ engine/SCons/compat/_scons_subprocess.py (working copy) +@@ -581,13 +581,19 @@ + class object: + pass + ++import thread ++lock = thread.allocate_lock() ++ + class Popen(object): + def __init__(self, args, bufsize=0, executable=None, + stdin=None, stdout=None, stderr=None, + preexec_fn=None, close_fds=False, shell=False, + cwd=None, env=None, universal_newlines=False, + startupinfo=None, creationflags=0): +- """Create new Popen instance.""" ++ """Create new Popen instance. ++ Popen is not thread-safe and is therefore protected with a lock. ++ """ ++ lock.acquire() + _cleanup() + + self._child_created = False +@@ -655,6 +661,7 @@ + self.stderr = os.fdopen(errread, 'rU', bufsize) + else: + self.stderr = os.fdopen(errread, 'rb', bufsize) ++ lock.release() + + + def _translate_newlines(self, data): diff --git a/sdk_container/src/third_party/portage-stable/dev-util/scons/scons-2.0.1.ebuild b/sdk_container/src/third_party/portage-stable/dev-util/scons/scons-2.0.1.ebuild new file mode 100644 index 0000000000..9b5ca7c11a --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-util/scons/scons-2.0.1.ebuild @@ -0,0 +1,59 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-util/scons/scons-2.0.1.ebuild,v 1.9 2011/01/29 16:28:43 grobian Exp $ + +EAPI="3" +PYTHON_DEPEND="2" +PYTHON_USE_WITH="threads" + +inherit distutils eutils + +DESCRIPTION="Extensible Python-based build utility" +HOMEPAGE="http://www.scons.org/" +SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz + doc? ( + http://www.scons.org/doc/${PV}/PDF/${PN}-user.pdf -> ${P}-user.pdf + http://www.scons.org/doc/${PV}/HTML/${PN}-user.html -> ${P}-user.html + )" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="alpha amd64 ~arm hppa ia64 ~mips ppc ppc64 sparc x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~sparc-solaris ~x86-solaris" +IUSE="doc" + +DEPEND="" +RDEPEND="" + +DOCS="CHANGES.txt RELEASE.txt" + +pkg_setup() { + python_set_active_version 2 + python_pkg_setup +} + +src_prepare() { + distutils_src_prepare + epatch "${FILESDIR}/scons-1.2.0-popen.patch" +} + +src_install () { + distutils_src_install + python_convert_shebangs -r 2 "${ED}" + + # Move man pages from /usr/man to /usr/share/man + dodir /usr/share + mv "${ED}usr/man" "${ED}usr/share" + + if use doc; then + insinto /usr/share/doc/${PF} + doins "${DISTDIR}"/${P}-user.{pdf,html} + fi +} + +pkg_postinst() { + python_mod_optimize /usr/$(get_libdir)/${P} +} + +pkg_postrm() { + python_mod_cleanup /usr/$(get_libdir)/${P} +} diff --git a/sdk_container/src/third_party/portage-stable/sys-apps/gawk/files/filefuncs/Makefile b/sdk_container/src/third_party/portage-stable/sys-apps/gawk/files/filefuncs/Makefile new file mode 100644 index 0000000000..ace7ee6507 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/sys-apps/gawk/files/filefuncs/Makefile @@ -0,0 +1,57 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# Author: Martin Schlemmer +# $Header: /var/cvsroot/gentoo-x86/sys-apps/gawk/files/filefuncs/Makefile,v 1.10 2009/05/16 22:02:25 vapier Exp $ + +CC ?= gcc +LD = $(CC) + +MAJORVER = 0 +MINORVER = 0.1 + +AWKINCDIR = /usr/include/awk +DESTDIR = + +TARGET = filefuncs +TARGET_LIB = $(TARGET).so.$(MAJORVER).$(MINORVER) + +LIBDIR = lib + +# Gentoo specific cruft, you like it dont ya idiot +ifdef D +DESTDIR = $(D) +endif +ifdef S +AWKINCDIR = $(S) +endif + +DOIT = yes +ifeq ($(USERLAND),Darwin) +DOIT = no +endif + +ifeq ($(DOIT),yes) + +all: $(TARGET_LIB) + +$(TARGET).o: $(TARGET).c + $(CC) $(CFLAGS) $(CPPFLAGS) -shared -Wall -DHAVE_CONFIG_H -c -O2 -fPIC -I$(AWKINCDIR) $^ + +$(TARGET_LIB): $(TARGET).o + $(LD) $(LDFLAGS) -o $@ -shared -Wl,-soname -Wl,$(TARGET).so.$(MAJORVER) $^ + +install: $(TARGET_LIB) + install -m 0755 -d $(DESTDIR)/$(LIBDIR)/rcscripts + install -m 0755 $(TARGET_LIB) $(DESTDIR)/$(LIBDIR)/rcscripts + ln -s $(TARGET_LIB) $(DESTDIR)/$(LIBDIR)/rcscripts/$(TARGET).so.$(MAJORVER) + ln -s $(TARGET_LIB) $(DESTDIR)/$(LIBDIR)/rcscripts/$(TARGET).so + +clean: + rm -f $(TARGET) + rm -f *.o *~ core + +else + +all install clean: + +endif diff --git a/sdk_container/src/third_party/portage-stable/sys-apps/gawk/files/filefuncs/filefuncs.c b/sdk_container/src/third_party/portage-stable/sys-apps/gawk/files/filefuncs/filefuncs.c new file mode 100644 index 0000000000..4f3436cf07 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/sys-apps/gawk/files/filefuncs/filefuncs.c @@ -0,0 +1,485 @@ +/* + * filefuncs.c - Builtin functions that provide initial minimal iterface + * to the file system. + * + * Arnold Robbins, update for 3.1, Mon Nov 23 12:53:39 EST 1998 + */ + +/* + * Copyright (C) 2001 the Free Software Foundation, Inc. + * + * This file is part of GAWK, the GNU implementation of the + * AWK Programming Language. + * + * GAWK is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * GAWK is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +/* + * Copyright 1999-2004 Gentoo Foundation + * Distributed under the terms of the GNU General Public License v2 + * Author: Martin Schlemmer , Nov 2002 + * $Header: /var/cvsroot/gentoo-x86/sys-apps/gawk/files/filefuncs/filefuncs.c,v 1.3 2005/05/06 01:35:53 vapier Exp $ + * + * Extended with: do_symlink() + * do_unlink() + * do_mkdir() + * do_rmdir() + * + * for use in the Gentoo rcscripts + * + */ + +#include "awk.h" + +#include + +/* do_chdir --- provide dynamically loaded chdir() builtin for gawk */ + +static NODE * +do_chdir(tree) +NODE *tree; +{ + NODE *newdir; + int ret = -1; + + if (do_lint && tree->param_cnt > 1) + lintwarn("chdir: called with too many arguments"); + + newdir = get_argument(tree, 0); + if (newdir != NULL) { + (void) force_string(newdir); + ret = chdir(newdir->stptr); + if (ret < 0) + update_ERRNO(); + + free_temp(newdir); + } else if (do_lint) + lintwarn("chdir: called with no arguments"); + + + /* Set the return value */ + set_value(tmp_number((AWKNUM) ret)); + + /* Just to make the interpreter happy */ + return tmp_number((AWKNUM) 0); +} + +/* do_symlink --- provide dynamically loaded symlink() builtin for gawk */ + +static NODE * +do_symlink(tree) +NODE *tree; +{ + NODE *oldpath, *newpath; + int ret = -1; + + if (do_lint && tree->param_cnt > 2) + lintwarn("symlink: called with too many arguments"); + + oldpath = get_argument(tree, 0); + newpath = get_argument(tree, 1); + if ((oldpath != NULL) && (newpath)) { + (void) force_string(oldpath); + (void) force_string(newpath); + ret = symlink(oldpath->stptr, newpath->stptr); + if (ret < 0) + update_ERRNO(); + + free_temp(oldpath); + free_temp(newpath); + } else if (do_lint) + lintwarn("symlink: called with not enough arguments"); + + /* Set the return value */ + set_value(tmp_number((AWKNUM) ret)); + + /* Just to make the interpreter happy */ + return tmp_number((AWKNUM) 0); +} + +/* do_unlink --- provide dynamically loaded unlink() builtin for gawk */ + +static NODE * +do_unlink(tree) +NODE *tree; +{ + NODE *pathname; + int ret = -1; + + if (do_lint && tree->param_cnt > 1) + lintwarn("unlink: called with too many arguments"); + + pathname = get_argument(tree, 0); + if (pathname != NULL) { + (void) force_string(pathname); + ret = unlink(pathname->stptr); + if (ret < 0) + update_ERRNO(); + + free_temp(pathname); + } else if (do_lint) + lintwarn("unlink: called with no arguments"); + + /* Set the return value */ + set_value(tmp_number((AWKNUM) ret)); + + /* Just to make the interpreter happy */ + return tmp_number((AWKNUM) 0); +} + +/* do_mkdir --- provide dynamically loaded mkdir() builtin for gawk */ + +static NODE * +do_mkdir(tree) +NODE *tree; +{ + NODE *pathname, *mode; + int ret = -1; + + if (do_lint && tree->param_cnt > 2) + lintwarn("mkdir: called with too many arguments"); + + pathname = get_argument(tree, 0); + mode = get_argument(tree, 1); + if ((pathname != NULL) && (mode != NULL)) { + (void) force_string(pathname); + (void) force_number(mode); + ret = mkdir(pathname->stptr, mode->numbr); + if (ret < 0) + update_ERRNO(); + + free_temp(pathname); + free_temp(mode); + } else if (do_lint) + lintwarn("mkdir: called with not enough arguments"); + + /* Set the return value */ + set_value(tmp_number((AWKNUM) ret)); + + /* Just to make the interpreter happy */ + return tmp_number((AWKNUM) 0); +} + +/* do_rmdir --- provide dynamically loaded rmdir() builtin for gawk */ + +static NODE * +do_rmdir(tree) +NODE *tree; +{ + NODE *pathname; + int ret = -1; + + if (do_lint && tree->param_cnt > 1) + lintwarn("rmdir: called with too many arguments"); + + pathname = get_argument(tree, 0); + if (pathname != NULL) { + (void) force_string(pathname); + ret = rmdir(pathname->stptr); + if (ret < 0) + update_ERRNO(); + + free_temp(pathname); + } else if (do_lint) + lintwarn("rmdir: called with no arguments"); + + /* Set the return value */ + set_value(tmp_number((AWKNUM) ret)); + + /* Just to make the interpreter happy */ + return tmp_number((AWKNUM) 0); +} + +/* format_mode --- turn a stat mode field into something readable */ + +static char * +format_mode(fmode) +unsigned long fmode; +{ + static char outbuf[12]; + int i; + + strcpy(outbuf, "----------"); + /* first, get the file type */ + i = 0; + switch (fmode & S_IFMT) { +#ifdef S_IFSOCK + case S_IFSOCK: + outbuf[i] = 's'; + break; +#endif +#ifdef S_IFLNK + case S_IFLNK: + outbuf[i] = 'l'; + break; +#endif + case S_IFREG: + outbuf[i] = '-'; /* redundant */ + break; + case S_IFBLK: + outbuf[i] = 'b'; + break; + case S_IFDIR: + outbuf[i] = 'd'; + break; +#ifdef S_IFDOOR /* Solaris weirdness */ + case S_IFDOOR: + outbuf[i] = 'D'; + break; +#endif /* S_IFDOOR */ + case S_IFCHR: + outbuf[i] = 'c'; + break; +#ifdef S_IFIFO + case S_IFIFO: + outbuf[i] = 'p'; + break; +#endif + } + + i++; + if ((fmode & S_IRUSR) != 0) + outbuf[i] = 'r'; + i++; + if ((fmode & S_IWUSR) != 0) + outbuf[i] = 'w'; + i++; + if ((fmode & S_IXUSR) != 0) + outbuf[i] = 'x'; + i++; + + if ((fmode & S_IRGRP) != 0) + outbuf[i] = 'r'; + i++; + if ((fmode & S_IWGRP) != 0) + outbuf[i] = 'w'; + i++; + if ((fmode & S_IXGRP) != 0) + outbuf[i] = 'x'; + i++; + + if ((fmode & S_IROTH) != 0) + outbuf[i] = 'r'; + i++; + if ((fmode & S_IWOTH) != 0) + outbuf[i] = 'w'; + i++; + if ((fmode & S_IXOTH) != 0) + outbuf[i] = 'x'; + i++; + + outbuf[i] = '\0'; + + if ((fmode & S_ISUID) != 0) { + if (outbuf[3] == 'x') + outbuf[3] = 's'; + else + outbuf[3] = 'S'; + } + + /* setgid without execute == locking */ + if ((fmode & S_ISGID) != 0) { + if (outbuf[6] == 'x') + outbuf[6] = 's'; + else + outbuf[6] = 'l'; + } + + if ((fmode & S_ISVTX) != 0) { + if (outbuf[9] == 'x') + outbuf[9] = 't'; + else + outbuf[9] = 'T'; + } + + return outbuf; +} + +/* do_stat --- provide a stat() function for gawk */ + +static NODE * +do_stat(tree) +NODE *tree; +{ + NODE *file, *array; + struct stat sbuf; + int ret; + NODE **aptr; + char *pmode; /* printable mode */ + char *type = "unknown"; + + /* check arg count */ + if (tree->param_cnt != 2) + fatal( + "stat: called with incorrect number of arguments (%d), should be 2", + tree->param_cnt); + + /* directory is first arg, array to hold results is second */ + file = get_argument(tree, 0); + array = get_argument(tree, 1); + + /* empty out the array */ + assoc_clear(array); + + /* lstat the file, if error, set ERRNO and return */ + (void) force_string(file); + ret = lstat(file->stptr, & sbuf); + if (ret < 0) { + update_ERRNO(); + + set_value(tmp_number((AWKNUM) ret)); + + free_temp(file); + return tmp_number((AWKNUM) 0); + } + + /* fill in the array */ + aptr = assoc_lookup(array, tmp_string("name", 4), FALSE); + *aptr = dupnode(file); + + aptr = assoc_lookup(array, tmp_string("dev", 3), FALSE); + *aptr = make_number((AWKNUM) sbuf.st_dev); + + aptr = assoc_lookup(array, tmp_string("ino", 3), FALSE); + *aptr = make_number((AWKNUM) sbuf.st_ino); + + aptr = assoc_lookup(array, tmp_string("mode", 4), FALSE); + *aptr = make_number((AWKNUM) sbuf.st_mode); + + aptr = assoc_lookup(array, tmp_string("nlink", 5), FALSE); + *aptr = make_number((AWKNUM) sbuf.st_nlink); + + aptr = assoc_lookup(array, tmp_string("uid", 3), FALSE); + *aptr = make_number((AWKNUM) sbuf.st_uid); + + aptr = assoc_lookup(array, tmp_string("gid", 3), FALSE); + *aptr = make_number((AWKNUM) sbuf.st_gid); + + aptr = assoc_lookup(array, tmp_string("size", 4), FALSE); + *aptr = make_number((AWKNUM) sbuf.st_size); + + aptr = assoc_lookup(array, tmp_string("blocks", 6), FALSE); + *aptr = make_number((AWKNUM) sbuf.st_blocks); + + aptr = assoc_lookup(array, tmp_string("atime", 5), FALSE); + *aptr = make_number((AWKNUM) sbuf.st_atime); + + aptr = assoc_lookup(array, tmp_string("mtime", 5), FALSE); + *aptr = make_number((AWKNUM) sbuf.st_mtime); + + aptr = assoc_lookup(array, tmp_string("ctime", 5), FALSE); + *aptr = make_number((AWKNUM) sbuf.st_ctime); + + /* for block and character devices, add rdev, major and minor numbers */ + if (S_ISBLK(sbuf.st_mode) || S_ISCHR(sbuf.st_mode)) { + aptr = assoc_lookup(array, tmp_string("rdev", 4), FALSE); + *aptr = make_number((AWKNUM) sbuf.st_rdev); + + aptr = assoc_lookup(array, tmp_string("major", 5), FALSE); + *aptr = make_number((AWKNUM) major(sbuf.st_rdev)); + + aptr = assoc_lookup(array, tmp_string("minor", 5), FALSE); + *aptr = make_number((AWKNUM) minor(sbuf.st_rdev)); + } + +#ifdef HAVE_ST_BLKSIZE + aptr = assoc_lookup(array, tmp_string("blksize", 7), FALSE); + *aptr = make_number((AWKNUM) sbuf.st_blksize); +#endif /* HAVE_ST_BLKSIZE */ + + aptr = assoc_lookup(array, tmp_string("pmode", 5), FALSE); + pmode = format_mode(sbuf.st_mode); + *aptr = make_string(pmode, strlen(pmode)); + + /* for symbolic links, add a linkval field */ + if (S_ISLNK(sbuf.st_mode)) { + char buf[BUFSIZ*2]; + int linksize; + + linksize = readlink(file->stptr, buf, sizeof buf); + /* should make this smarter */ + if (linksize == sizeof(buf)) + fatal("size of symbolic link too big"); + buf[linksize] = '\0'; + + aptr = assoc_lookup(array, tmp_string("linkval", 7), FALSE); + *aptr = make_string(buf, linksize); + } + + /* add a type field */ + switch (sbuf.st_mode & S_IFMT) { +#ifdef S_IFSOCK + case S_IFSOCK: + type = "socket"; + break; +#endif +#ifdef S_IFLNK + case S_IFLNK: + type = "symlink"; + break; +#endif + case S_IFREG: + type = "file"; + break; + case S_IFBLK: + type = "blockdev"; + break; + case S_IFDIR: + type = "directory"; + break; +#ifdef S_IFDOOR + case S_IFDOOR: + type = "door"; + break; +#endif + case S_IFCHR: + type = "chardev"; + break; +#ifdef S_IFIFO + case S_IFIFO: + type = "fifo"; + break; +#endif + } + + aptr = assoc_lookup(array, tmp_string("type", 4), FALSE); + *aptr = make_string(type, strlen(type)); + + free_temp(file); + + /* Set the return value */ + set_value(tmp_number((AWKNUM) ret)); + + /* Just to make the interpreter happy */ + return tmp_number((AWKNUM) 0); +} + +/* dlload --- load new builtins in this library */ + +NODE * +dlload(tree, dl) +NODE *tree; +void *dl; +{ + make_builtin("chdir", do_chdir, 1); + make_builtin("symlink", do_symlink, 2); + make_builtin("unlink", do_unlink, 1); + make_builtin("mkdir", do_mkdir, 2); + make_builtin("rmdir", do_rmdir, 1); + make_builtin("stat", do_stat, 2); + + return tmp_number((AWKNUM) 0); +} + diff --git a/sdk_container/src/third_party/portage-stable/sys-apps/gawk/gawk-3.1.8.ebuild b/sdk_container/src/third_party/portage-stable/sys-apps/gawk/gawk-3.1.8.ebuild new file mode 100644 index 0000000000..69a2c0de60 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/sys-apps/gawk/gawk-3.1.8.ebuild @@ -0,0 +1,78 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/gawk/gawk-3.1.8.ebuild,v 1.7 2011/08/05 19:08:07 jer Exp $ + +EAPI="2" + +inherit eutils toolchain-funcs multilib + +DESCRIPTION="GNU awk pattern-matching language" +HOMEPAGE="http://www.gnu.org/software/gawk/gawk.html" +SRC_URI="mirror://gnu/gawk/${P}.tar.bz2" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd" +IUSE="nls" + +RDEPEND="" +DEPEND="${RDEPEND} + nls? ( sys-devel/gettext )" + +SFFS=${WORKDIR}/filefuncs + +src_unpack() { + unpack ${A} + + # Copy filefuncs module's source over ... + cp -r "${FILESDIR}"/filefuncs "${SFFS}" || die "cp failed" +} + +src_prepare() { + # use symlinks rather than hardlinks, and disable version links + sed -i \ + -e '/^LN =/s:=.*:= $(LN_S):' \ + -e '/install-exec-hook:/s|$|\nfoo:|' \ + Makefile.in doc/Makefile.in +} + +src_configure() { + export ac_cv_libsigsegv=no + econf \ + --libexec='$(libdir)/misc' \ + $(use_enable nls) \ + --enable-switch +} + +src_compile() { + emake || die + emake -C "${SFFS}" CC="$(tc-getCC)" || die "filefuncs emake failed" +} + +src_install() { + emake install DESTDIR="${D}" || die + emake -C "${SFFS}" LIBDIR="$(get_libdir)" install || die + + # Keep important gawk in /bin + if use userland_GNU ; then + dodir /bin + mv "${D}"/usr/bin/gawk "${D}"/bin/ || die + dosym /bin/gawk /usr/bin/gawk + + # Provide canonical `awk` + dosym gawk /bin/awk + dosym gawk /usr/bin/awk + dosym gawk.1 /usr/share/man/man1/awk.1 + fi + + # Install headers + insinto /usr/include/awk + doins *.h || die + # We do not want 'acconfig.h' in there ... + rm -f "${D}"/usr/include/awk/acconfig.h + + dodoc AUTHORS ChangeLog FUTURES LIMITATIONS NEWS PROBLEMS POSIX.STD README README_d/*.* + for x in */ChangeLog ; do + newdoc ${x} ${x##*/}.${x%%/*} + done +}