Gentoo Archives: gentoo-user

From: Al <oss.elmar@××××××××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] gawk and filefuncs
Date: Fri, 03 Sep 2010 23:05:09
Message-Id: AANLkTim6mBMSnjYTvVDQMcuG_NFBRuSVVOJ_6=+6irr8@mail.gmail.com
In Reply to: Re: [gentoo-user] gawk and filefuncs by Etaoin Shrdlu
1 >
2 > The gawk source distribution comes with a number of such extensions in the
3 > (doh) extensions/ directory. filefuncs.c is such one extension, which
4 > demonstrate how to add stat() and chdir() capabilities to awk.
5 > The file is compiled into a .so file, which is then referenced from within
6 > gawk to make the extended commands available.
7 >
8 > A vanilla build of gawk does not have any dynamic extension.
9 >
10 >
11 > Now, the Gentoo devs at some point in the past (very early) took that file
12 > (filefuncs.c) and extended it to implement new commands like "symlink",
13 > "unlink", "mkdir", "rmdir" and "stat", so those are callable from within
14 > awk, effectively extending the language. (you can see the Gentoo copyright
15 > in the file, look
16 > into /usr/portage/sys-apps/gawk/files/filefuncs/filefuncs.c)
17 >
18 > There are a number of Gentoo system scripts that use those awk extensions
19 > (look into /lib/rcscripts and /lib/rcscripts/awk), which means that
20 > compiling the expanded filefuncs.c (not the vanilla one) is mandatory on a
21 > Gentoo system, because there are awk scripts that rely on the extended
22 > functionaltiy provided by it. Hence Gentoo maintains the filefuncs.c file
23 > independently, and the gawk ebuild, besides building gawk itself, also takes
24 > care of building filefuncs.c containing the extensions.
25 >
26 >
27
28 Thank you very much. That is the best explanation a read to this. It
29 should be deliverd with the sources.
30
31 Still the procedure is unusual. They could apply a patch to
32 extensions/ filefuncs.c and exclude it for vanilla.
33
34 I have a second issue. When compiling gawk on Cygwin, where is no
35 windows kernel, the Gentoo version of filefuncs breaks. I have to
36 disable it in the ebuild to get gawk compiled.
37
38 filefuncs.o:filefuncs.c:(.text+0x1e): undefined reference to `_make_builtin'
39 [... lots of this ... ]
40 filefuncs.o:filefuncs.c:(.text+0x10f1): undefined reference to `_update_ERRNO'
41 collect2: ld returned 1 exit status
42 make: *** [filefuncs.so.0.0.1] Error 1
43
44 You say it is mandatory on a Gentoo system, because there are awk
45 scripts that rely on. Do this functions break because of the missing
46 kernel? What would be the workaround?
47
48 Thanks
49
50 Al

Replies

Subject Author
Re: [gentoo-user] gawk and filefuncs Al <oss.elmar@××××××××××.com>
Re: [gentoo-user] gawk and filefuncs Etaoin Shrdlu <shrdlu@×××××××××××××.org>