diff options
Diffstat (limited to 'sys-apps/gawk')
-rw-r--r-- | sys-apps/gawk/Manifest | 14 | ||||
-rw-r--r-- | sys-apps/gawk/files/filefuncs/Makefile | 56 | ||||
-rw-r--r-- | sys-apps/gawk/files/filefuncs/filefuncs.c | 484 | ||||
-rw-r--r-- | sys-apps/gawk/files/gawk-4.1.3-bsd_configure_readline.patch | 63 | ||||
-rw-r--r-- | sys-apps/gawk/gawk-3.1.8.ebuild | 77 | ||||
-rw-r--r-- | sys-apps/gawk/gawk-4.0.2.ebuild | 73 | ||||
-rw-r--r-- | sys-apps/gawk/gawk-4.1.3.ebuild | 76 | ||||
-rw-r--r-- | sys-apps/gawk/gawk-4.1.4.ebuild | 79 | ||||
-rw-r--r-- | sys-apps/gawk/metadata.xml | 11 |
9 files changed, 933 insertions, 0 deletions
diff --git a/sys-apps/gawk/Manifest b/sys-apps/gawk/Manifest new file mode 100644 index 000000000000..ae40c24c790a --- /dev/null +++ b/sys-apps/gawk/Manifest @@ -0,0 +1,14 @@ +AUX filefuncs/Makefile 1112 SHA256 0fbd6dc67d07f50af0ed138bb060ac4b145d7f76faf1b77b2de5f83273172b9c SHA512 9bf5acfca439e6589247db3b4b16985765e748bcb66577e7038247830f92137929f139f6ab72ecb9e2b3b03f9406c8ecf7ca349329979ee8d70fbf44b4feb2b8 WHIRLPOOL 4dfe497c641fc5062334365800e3a7bcc6337299f619e1ba2537fedbdd6f2a37a15ffb56e6433d48e9a95326cade5660ce65d61d61e67215071e6c6739c2352c +AUX filefuncs/filefuncs.c 10875 SHA256 850348bd2f2b9772f3e7d946dec4443330bb317f96062888ba7ccd338458bda9 SHA512 48da0dce39759a8d57097b286dcee2ebf1e1799b694a4a7926716df727eb294a7912117c405e1b63a1722fa3a2427cb2139d92fac723ffd8d2e697632719f974 WHIRLPOOL 3a8785506e65aea70bd02d50a2a0dbaf49f0aeec5c199ab1bdbd1e756a4ac24a50f9113a2596cb00a486136bb19caf5dd6ad3b1d4fcd43119b7e5eb5089d3717 +AUX gawk-4.1.3-bsd_configure_readline.patch 1899 SHA256 15e455754aceb62af444b414cf235f58dd1395a4c1ac8f4d551aa5021e3feb84 SHA512 ed3b6c4efe5bcb53bca6eeb50df0e3871eca266dd3d6ea4369f42dce31b771ed0a4f0aac03b09124706539d18c8d1dfe549e43d2ef4cf80a45353e14238ddaec WHIRLPOOL 81ebc0b74b2c3df3023ff870845c766bd1bdace91e7b8359126ad7cb62f50894788ea418cdc6b6dde7383f1d620b0291a974ab1cdbbfb6afb19ad3a3ac1836c8 +DIST gawk-3.1.8.tar.bz2 1984129 SHA256 5dbc7b2c4c328711337c2aacd09a122c7313122262e3ff034590f014067412b4 SHA512 a8046c1a5a6ffc8bd90cc6062d97ba6301b7a707f4a34a06355a83aaaea2ccdf4c4476563fc6f444b529a2d8d3a2de2126b53434ba50aad8bd898fb3299904dd WHIRLPOOL e24079d7c2aee57e48db2ef76df4c217ea0fa435304a563c6df8d0442f8a5e5e4cff2141809f68430939d66a3a6eda981edefa94b2b8c85e5f0a3ee7ba8a7649 +DIST gawk-4.0.2.tar.xz 1626808 SHA256 21e1f28c51b5160f0a4bf1a735c6109b46a3bd6a43de808eabc21c17bb026d13 SHA512 069f68b6792521d94d4003764006ad8fbe9a17c60a88212629204d9a5eb3f662903fff6d91dd3c1834597b76c18f9d3231c93a033f456c59c0571ac13eb77b27 WHIRLPOOL 8b2916d964c5fa67a46c0a5fc39d424b03e6b39a3335ad796a224feb760528631199c1ec6ee2b6719bdc014ab190ddf38092211685020c92851d617e6ca08690 +DIST gawk-4.1.3.tar.xz 2311268 SHA256 e3cf55e91e31ea2845f8338bedd91e40671fc30e4d82ea147d220e687abda625 SHA512 8b9470a1bba397353f10e4e652e8589a637a49e8235fb39ca7681ae662fd27cd140c193d0634179c800f99e19b0e49aef55dfa6612f9695ba80760a36936a1c3 WHIRLPOOL ddcd0f218a08c7d54beaaa28db3a965c57b1d394dd294f142970cbf3b4777a407bbb491b7442f9e4de0b7435167919e76b16f4c5ab28eb62758a3d44d11a49e1 +DIST gawk-4.1.4.tar.xz 2367832 SHA256 53e184e2d0f90def9207860531802456322be091c7b48f23fdc79cda65adc266 SHA512 6a0e9cf086544212f54b54261dcd517b611aaf495ef99c4b7740d07e363bb00c5632f3d7fd5e12a954d5aa9793764162a57453e0e18884b29c6c54b5f444c097 WHIRLPOOL 5103388e7260cd9d4e777a5b53e93ae2eb1270c5baec462d0d4c244fde12bb29d41864ebb22de5c9b797fb9678c548cf3059a39488d35660b508b90c802346ff +EBUILD gawk-3.1.8.ebuild 1794 SHA256 b794beff4f8ce3bb31d416ea4e7cffa083ee432991e4f6b86a1a071b63444845 SHA512 ca82d7bba5d88aadb4616817d0d55f001446a90da3def7fd49fb817c5b2674cd389f5a92efe82736e562ea0f46c9a214286f96137f324ee2be2149d09f298f61 WHIRLPOOL 9b2abe1d8028961d76032e39a359ae76d82ab647008e48d79c887e6ad3b2bd017ab33d7e877582fb34868ee604ed78d8169134c75d1dbfc6b466507847eb2a78 +EBUILD gawk-4.0.2.ebuild 2088 SHA256 aeb7bc3dda2def791ba830ff3052247292249a6fcb270c81412651a5fd013761 SHA512 b15b3c32c04c724e7b0c5c6f8d7cae86e3118c1560ca2fae0f5ded39fc098afa29987e425733e96daedbf1db5757e15fb21059a023c5158498f5b6168809f063 WHIRLPOOL 0197d1effc02f2668e3834108eab717407fb02bb880fdd1a964fdbc0a5bfb44a0f5cd1ab6893af0da3aadd0e22c1e9444af46a98b2fdd74b341877d7d9fd00fd +EBUILD gawk-4.1.3.ebuild 2201 SHA256 e973870920b273d6f516ccb6a47265d0b793916d60a3a72aa8c7153cd90ff8c3 SHA512 fd78556fbd0d2ba92c2816d4a82330a365ca99985b042a3431e075e7a1390954bec0139d7dc63370c564eb90ab3f0a97c6966230a7309d46462d5e934b090d0b WHIRLPOOL 8c4ab7736911b57077dda94446831b6bb1b7fe1c839f6d06b22f42b6d7cc0b763a94e2b5aca899ae0b6641bc5b9a0dc79aafc07f325a885a9ea9f2aa336c7d1a +EBUILD gawk-4.1.4.ebuild 2301 SHA256 26d24d086963e0347732c0c450a18eb3827779a4259f8173683c05f41c780235 SHA512 7264a7180f127dbe7147db5eaee201f37bd4ec25f1478029086720ee59fa96ac3d3516ae1eafeccdfffd8ccb5107152310311953e40c1d0ec9053a6e1a53c27c WHIRLPOOL 93816fee2ee67f75f898f28e2966c90d3f5ef1878213ab0110a63782a4cf3baae7509dfc13ce982058f21b90b9ac253bb552c8674b6e8b8adcedd8089ef19f6a +MISC ChangeLog 5037 SHA256 d91b8f1506cf9102f4f46dbdd03d6c757ed521c54e08b1f03c70ea61d950ee1a SHA512 22fec5534ecd42063f666080c6e9690197120700d23277ca718181306715c41e2253f684efb4c9cdb4456c1a0609d6b45c8a644c4f2e3b86f5e9f5f84a5ec3d6 WHIRLPOOL 69b1294e44f270910dcf450bf3a83167d1665d195b8767f950f45443ab5c5e187afa22c8d49246a3a5c1721650698983407c9e80fa9e964290fc7ca35b0e2f7d +MISC ChangeLog-2015 25235 SHA256 bde68cfbf1ddb7ec621042d675bab7b5aeffed7f3f092dc278b0c0ac2cd602de SHA512 243495808dbef55124b5a8d02e27b87550ad40104b427ed9bb63d3c8785a84d0acd3675a8d15c8579553c22f06809a47d19530eea0300a0b616ed2e3fb527dee WHIRLPOOL 70afaf3d02a4f5a3e4b4b13bb3c9f912d55c4b4c6f06beb10412f52b59fd82e5b6bfb9548fbe1a625e933750e903cb179cf31267b4abba103b3539d95622e8d8 +MISC metadata.xml 347 SHA256 cfaa5b9985d20997a4800b7a60f7804bf8660d217ef2421732c2e296532d6862 SHA512 1150e37d64393f26ef81056ff25e9720a4bc82dd28c9cffd164d144bb6d2f660f802a31d5ebf4fd121a01b36a4a5073893ebec6b735d3eb570da36705d5f446e WHIRLPOOL f4cc92f281dfb2f436c979257347ac8694056a8d9a4a3c794056027a12c64f6cf04023641b0462d57a376335d93c55f3b6722504e7f7e32baf702c4c7578e5f9 diff --git a/sys-apps/gawk/files/filefuncs/Makefile b/sys-apps/gawk/files/filefuncs/Makefile new file mode 100644 index 000000000000..498793805c08 --- /dev/null +++ b/sys-apps/gawk/files/filefuncs/Makefile @@ -0,0 +1,56 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# Author: Martin Schlemmer <azarah@gentoo.org> + +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/sys-apps/gawk/files/filefuncs/filefuncs.c b/sys-apps/gawk/files/filefuncs/filefuncs.c new file mode 100644 index 000000000000..04c9db7fe107 --- /dev/null +++ b/sys-apps/gawk/files/filefuncs/filefuncs.c @@ -0,0 +1,484 @@ +/* + * 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 <azarah@gentoo.org>, Nov 2002 + * + * Extended with: do_symlink() + * do_unlink() + * do_mkdir() + * do_rmdir() + * + * for use in the Gentoo rcscripts + * + */ + +#include "awk.h" + +#include <unistd.h> + +/* 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/sys-apps/gawk/files/gawk-4.1.3-bsd_configure_readline.patch b/sys-apps/gawk/files/gawk-4.1.3-bsd_configure_readline.patch new file mode 100644 index 000000000000..3bd267efd179 --- /dev/null +++ b/sys-apps/gawk/files/gawk-4.1.3-bsd_configure_readline.patch @@ -0,0 +1,63 @@ +http://git.savannah.gnu.org/cgit/gawk.git/commit/?id=ac0ef52fe407b89c7968b927c7b2b513cc13963a + +--- gawk-4.1.3/configure 2015-05-19 15:38:35.000000000 +0200 ++++ gawk-4.1.3/configure 2015-05-19 15:38:35.000000000 +0200 +@@ -10825,7 +10825,46 @@ + + if test $_found_readline = yes ; then + case $host_os in +- *bsd* ) _combo="$_combo -ltermcap" ++ *bsd* ) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -ltermcap" >&5 ++$as_echo_n "checking for tgetent in -ltermcap... " >&6; } ++if ${ac_cv_lib_termcap_tgetent+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ ac_check_lib_save_LIBS=$LIBS ++LIBS="-ltermcap $LIBS" ++cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++/* Override any GCC internal prototype to avoid an error. ++ Use char because int might match the return type of a GCC ++ builtin and then its argument prototype would still apply. */ ++#ifdef __cplusplus ++extern "C" ++#endif ++char tgetent (); ++int ++main () ++{ ++return tgetent (); ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_link "$LINENO"; then : ++ ac_cv_lib_termcap_tgetent=yes ++else ++ ac_cv_lib_termcap_tgetent=no ++fi ++rm -f core conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext ++LIBS=$ac_check_lib_save_LIBS ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_termcap_tgetent" >&5 ++$as_echo "$ac_cv_lib_termcap_tgetent" >&6; } ++if test "x$ac_cv_lib_termcap_tgetent" = xyes; then : ++ _combo="$_combo -ltermcap" ++fi ++ + ;; + esac + +--- gawk-4.1.3/m4/readline.m4 2015-04-05 12:19:19.000000000 +0200 ++++ gawk-4.1.3/m4/readline.m4 2015-04-05 12:19:19.000000000 +0200 +@@ -92,7 +92,7 @@ + + if test $_found_readline = yes ; then + case $host_os in +- *bsd* ) _combo="$_combo -ltermcap" ++ *bsd* ) AC_CHECK_LIB(termcap, tgetent, _combo="$_combo -ltermcap") + ;; + esac + AC_DEFINE(HAVE_LIBREADLINE,1, diff --git a/sys-apps/gawk/gawk-3.1.8.ebuild b/sys-apps/gawk/gawk-3.1.8.ebuild new file mode 100644 index 000000000000..9647eae39c9d --- /dev/null +++ b/sys-apps/gawk/gawk-3.1.8.ebuild @@ -0,0 +1,77 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI="2" + +inherit eutils toolchain-funcs multilib + +DESCRIPTION="GNU awk pattern-matching language" +HOMEPAGE="https://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="!>=virtual/awk-1" +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 +} diff --git a/sys-apps/gawk/gawk-4.0.2.ebuild b/sys-apps/gawk/gawk-4.0.2.ebuild new file mode 100644 index 000000000000..5ca0de1ce0cd --- /dev/null +++ b/sys-apps/gawk/gawk-4.0.2.ebuild @@ -0,0 +1,73 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI="4" + +inherit eutils toolchain-funcs multilib + +DESCRIPTION="GNU awk pattern-matching language" +HOMEPAGE="https://www.gnu.org/software/gawk/gawk.html" +SRC_URI="mirror://gnu/gawk/${P}.tar.xz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +IUSE="nls readline" + +# older gawk's provided shared lib for baselayout-1 +RDEPEND="!<sys-apps/baselayout-2.0.1 + readline? ( sys-libs/readline )" +DEPEND="${RDEPEND} + nls? ( sys-devel/gettext )" + +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 + sed -i '/^pty1:$/s|$|\n_pty1:|' test/Makefile.in #413327 +} + +src_configure() { + export ac_cv_libsigsegv=no + econf \ + --libexec='$(libdir)/misc' \ + $(use_enable nls) \ + $(use_with readline) +} + +src_install() { + emake install DESTDIR="${D}" || die + + # Install headers + insinto /usr/include/awk + doins *.h || die + rm "${ED}"/usr/include/awk/config.h || die + + dodoc AUTHORS ChangeLog FUTURES LIMITATIONS NEWS PROBLEMS POSIX.STD README README_d/*.* + for x in */ChangeLog ; do + newdoc ${x} ${x##*/}.${x%%/*} + done +} + +pkg_postinst() { + # symlink creation here as the links do not belong to gawk, but to any awk + if has_version app-admin/eselect \ + && has_version app-eselect/eselect-awk ; then + eselect awk update ifunset + else + local l + for l in "${EROOT}"usr/share/man/man1/gawk.1* "${EROOT}"usr/bin/gawk; do + [[ -e ${l} && ! -e ${l/gawk/awk} ]] && ln -s "${l##*/}" "${l/gawk/awk}" + done + [[ ! -e ${EROOT}bin/awk ]] && ln -s "../usr/bin/gawk" "${EROOT}bin/awk" + fi +} + +pkg_postrm() { + if has_version app-admin/eselect \ + && has_version app-eselect/eselect-awk ; then + eselect awk update ifunset + fi +} diff --git a/sys-apps/gawk/gawk-4.1.3.ebuild b/sys-apps/gawk/gawk-4.1.3.ebuild new file mode 100644 index 000000000000..b3a2af376238 --- /dev/null +++ b/sys-apps/gawk/gawk-4.1.3.ebuild @@ -0,0 +1,76 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI="5" + +inherit eutils toolchain-funcs multilib + +DESCRIPTION="GNU awk pattern-matching language" +HOMEPAGE="https://www.gnu.org/software/gawk/gawk.html" +SRC_URI="mirror://gnu/gawk/${P}.tar.xz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +IUSE="mpfr nls readline" + +RDEPEND="mpfr? ( dev-libs/mpfr:0= ) + readline? ( sys-libs/readline:0= )" +DEPEND="${RDEPEND} + nls? ( sys-devel/gettext )" + +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 || die + sed -i '/^pty1:$/s|$|\n_pty1:|' test/Makefile.in #413327 + # disable pointless build time hack that breaks cross-compiling #493362 + sed -i \ + -e '/check-recursive all-recursive: check-for-shared-lib-support/d' \ + extension/Makefile.in || die + + EPATCH_OPTS="-Z" \ + epatch "${FILESDIR}/${P}-bsd_configure_readline.patch" #507468 +} + +src_configure() { + export ac_cv_libsigsegv=no + econf \ + --libexec='$(libdir)/misc' \ + $(use_with mpfr) \ + $(use_enable nls) \ + $(use_with readline) +} + +src_install() { + rm -rf README_d # automatic dodocs barfs + default + + # Install headers + insinto /usr/include/awk + doins *.h || die + rm "${ED}"/usr/include/awk/config.h || die +} + +pkg_postinst() { + # symlink creation here as the links do not belong to gawk, but to any awk + if has_version app-admin/eselect \ + && has_version app-eselect/eselect-awk ; then + eselect awk update ifunset + else + local l + for l in "${EROOT}"usr/share/man/man1/gawk.1* "${EROOT}"usr/bin/gawk; do + [[ -e ${l} && ! -e ${l/gawk/awk} ]] && ln -s "${l##*/}" "${l/gawk/awk}" + done + [[ ! -e ${EROOT}bin/awk ]] && ln -s "../usr/bin/gawk" "${EROOT}bin/awk" + fi +} + +pkg_postrm() { + if has_version app-admin/eselect \ + && has_version app-eselect/eselect-awk ; then + eselect awk update ifunset + fi +} diff --git a/sys-apps/gawk/gawk-4.1.4.ebuild b/sys-apps/gawk/gawk-4.1.4.ebuild new file mode 100644 index 000000000000..303da0e8c823 --- /dev/null +++ b/sys-apps/gawk/gawk-4.1.4.ebuild @@ -0,0 +1,79 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI="5" + +inherit eutils toolchain-funcs multilib + +DESCRIPTION="GNU awk pattern-matching language" +HOMEPAGE="https://www.gnu.org/software/gawk/gawk.html" +SRC_URI="mirror://gnu/gawk/${P}.tar.xz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +IUSE="mpfr nls readline" + +RDEPEND="mpfr? ( dev-libs/mpfr:0= ) + readline? ( sys-libs/readline:0= )" +DEPEND="${RDEPEND} + nls? ( sys-devel/gettext )" + +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 || die + sed -i '/^pty1:$/s|$|\n_pty1:|' test/Makefile.in #413327 + # disable pointless build time hack that breaks cross-compiling #493362 + sed -i \ + -e '/check-recursive all-recursive: check-for-shared-lib-support/d' \ + extension/Makefile.in || die + # fix standards conflict on Solaris + if [[ ${CHOST} == *-solaris* ]] ; then + sed -i \ + -e '/\<_XOPEN_SOURCE\>/s/$/600/' \ + extension/inplace.c || die + fi +} + +src_configure() { + export ac_cv_libsigsegv=no + econf \ + --libexec='$(libdir)/misc' \ + $(use_with mpfr) \ + $(use_enable nls) \ + $(use_with readline) +} + +src_install() { + rm -rf README_d # automatic dodocs barfs + default + + # Install headers + insinto /usr/include/awk + doins *.h || die + rm "${ED}"/usr/include/awk/config.h || die +} + +pkg_postinst() { + # symlink creation here as the links do not belong to gawk, but to any awk + if has_version app-admin/eselect \ + && has_version app-eselect/eselect-awk ; then + eselect awk update ifunset + else + local l + for l in "${EROOT}"usr/share/man/man1/gawk.1* "${EROOT}"usr/bin/gawk; do + [[ -e ${l} && ! -e ${l/gawk/awk} ]] && ln -s "${l##*/}" "${l/gawk/awk}" + done + [[ ! -e ${EROOT}bin/awk ]] && ln -s "../usr/bin/gawk" "${EROOT}bin/awk" + fi +} + +pkg_postrm() { + if has_version app-admin/eselect \ + && has_version app-eselect/eselect-awk ; then + eselect awk update ifunset + fi +} diff --git a/sys-apps/gawk/metadata.xml b/sys-apps/gawk/metadata.xml new file mode 100644 index 000000000000..3fa1f9889991 --- /dev/null +++ b/sys-apps/gawk/metadata.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<maintainer type="project"> + <email>base-system@gentoo.org</email> + <name>Gentoo Base System</name> +</maintainer> +<use> + <flag name="mpfr">use mpfr for high precision arithmetic (-M / --bignum)</flag> +</use> +</pkgmetadata> |