1 |
On Fri, 3 Sep 2010 22:31:01 +0200 Al <oss.elmar@××××××××××.com> wrote: |
2 |
|
3 |
> Can anybody explain the Gentoo handling of filefuncs in the gawk package? |
4 |
> |
5 |
> Why isn't a simple patch used like in all other cases? |
6 |
|
7 |
gawk provides dynamic extension modules. This is explained here: |
8 |
|
9 |
http://www.gnu.org/manual/gawk/gawk.html#Dynamic-Extensions |
10 |
|
11 |
The gawk source distribution comes with a number of such extensions in the |
12 |
(doh) extensions/ directory. filefuncs.c is such one extension, which |
13 |
demonstrate how to add stat() and chdir() capabilities to awk. |
14 |
The file is compiled into a .so file, which is then referenced from within |
15 |
gawk to make the extended commands available. |
16 |
|
17 |
A vanilla build of gawk does not have any dynamic extension. |
18 |
|
19 |
|
20 |
Now, the Gentoo devs at some point in the past (very early) took that file |
21 |
(filefuncs.c) and extended it to implement new commands like "symlink", |
22 |
"unlink", "mkdir", "rmdir" and "stat", so those are callable from within |
23 |
awk, effectively extending the language. (you can see the Gentoo copyright |
24 |
in the file, look |
25 |
into /usr/portage/sys-apps/gawk/files/filefuncs/filefuncs.c) |
26 |
|
27 |
There are a number of Gentoo system scripts that use those awk extensions |
28 |
(look into /lib/rcscripts and /lib/rcscripts/awk), which means that |
29 |
compiling the expanded filefuncs.c (not the vanilla one) is mandatory on a |
30 |
Gentoo system, because there are awk scripts that rely on the extended |
31 |
functionaltiy provided by it. Hence Gentoo maintains the filefuncs.c file |
32 |
independently, and the gawk ebuild, besides building gawk itself, also takes |
33 |
care of building filefuncs.c containing the extensions. |