>
> The gawk source distribution comes with a number of such extensions in the
> (doh) extensions/ directory. filefuncs.c is such one extension, which
> demonstrate how to add stat() and chdir() capabilities to awk.
> The file is compiled into a .so file, which is then referenced from within
> gawk to make the extended commands available.
>
> A vanilla build of gawk does not have any dynamic extension.
>
>
> Now, the Gentoo devs at some point in the past (very early) took that file
> (filefuncs.c) and extended it to implement new commands like "symlink",
> "unlink", "mkdir", "rmdir" and "stat", so those are callable from within
> awk, effectively extending the language. (you can see the Gentoo copyright
> in the file, look
> into /usr/portage/sys-apps/gawk/files/filefuncs/filefuncs.c)
>
> There are a number of Gentoo system scripts that use those awk extensions
> (look into /lib/rcscripts and /lib/rcscripts/awk), which means that
> compiling the expanded filefuncs.c (not the vanilla one) is mandatory on a
> Gentoo system, because there are awk scripts that rely on the extended
> functionaltiy provided by it. Hence Gentoo maintains the filefuncs.c file
> independently, and the gawk ebuild, besides building gawk itself, also takes
> care of building filefuncs.c containing the extensions.
>
>

Thank you very much. That is the best explanation a read to this. It
should be deliverd with the sources.

Still the procedure is unusual. They could apply a patch to
extensions/ filefuncs.c and exclude it for vanilla.

I have a second issue. When compiling gawk on Cygwin, where is no
windows kernel, the Gentoo version of filefuncs breaks. I have to
disable it in the ebuild to get gawk compiled.

  filefuncs.o:filefuncs.c:(.text+0x1e): undefined reference to `_make_builtin'
  [... lots of this ... ]
  filefuncs.o:filefuncs.c:(.text+0x10f1): undefined reference to `_update_ERRNO'
  collect2: ld returned 1 exit status
  make: *** [filefuncs.so.0.0.1] Error 1

You say it is mandatory on a Gentoo system, because there are awk
scripts that rely on. Do this functions break because of the missing
kernel? What would be the workaround?

Thanks

Al

Reply via email to