* [gentoo-user] gawk and filefuncs @ 2010-09-03 20:31 Al 2010-09-03 21:04 ` Etaoin Shrdlu 0 siblings, 1 reply; 6+ messages in thread From: Al @ 2010-09-03 20:31 UTC (permalink / raw To: gentoo-user Can anybody explain the Gentoo handling of filefuncs in the gawk package? Why isn't a simple patch used like in all other cases? Al ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-user] gawk and filefuncs 2010-09-03 20:31 [gentoo-user] gawk and filefuncs Al @ 2010-09-03 21:04 ` Etaoin Shrdlu 2010-09-03 22:25 ` Al 0 siblings, 1 reply; 6+ messages in thread From: Etaoin Shrdlu @ 2010-09-03 21:04 UTC (permalink / raw To: gentoo-user On Fri, 3 Sep 2010 22:31:01 +0200 Al <oss.elmar@googlemail.com> wrote: > Can anybody explain the Gentoo handling of filefuncs in the gawk package? > > Why isn't a simple patch used like in all other cases? gawk provides dynamic extension modules. This is explained here: http://www.gnu.org/manual/gawk/gawk.html#Dynamic-Extensions 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. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-user] gawk and filefuncs 2010-09-03 21:04 ` Etaoin Shrdlu @ 2010-09-03 22:25 ` Al 2010-09-03 22:26 ` Al 2010-09-04 9:58 ` Etaoin Shrdlu 0 siblings, 2 replies; 6+ messages in thread From: Al @ 2010-09-03 22:25 UTC (permalink / raw To: gentoo-user > > 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-user] gawk and filefuncs 2010-09-03 22:25 ` Al @ 2010-09-03 22:26 ` Al 2010-09-04 9:58 ` Etaoin Shrdlu 1 sibling, 0 replies; 6+ messages in thread From: Al @ 2010-09-03 22:26 UTC (permalink / raw To: gentoo-user > I have a second issue. When compiling gawk on Cygwin, where is no > windows kernel, the Gentoo version of filefuncs breaks. I have to Sure there is a windows kernel. The linux kernel is missing. Al ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-user] gawk and filefuncs 2010-09-03 22:25 ` Al 2010-09-03 22:26 ` Al @ 2010-09-04 9:58 ` Etaoin Shrdlu 2010-09-04 10:51 ` Al 1 sibling, 1 reply; 6+ messages in thread From: Etaoin Shrdlu @ 2010-09-04 9:58 UTC (permalink / raw To: gentoo-user On Sat, 4 Sep 2010 00:25:32 +0200 Al <oss.elmar@googlemail.com> wrote: > 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. Since it's critical for Gentoo gawk, perhaps they didn't want to depend on gawk's source distribution suddenly removing that file or otherwise changing (and patches need to be maintained up-to-date against the original, while a standalone file does not need maintenance). But this is all just my guessing. > 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? How are you building it? It needs special commands because it needs to become a shared object, not an executable. Note that building that file is by no means necessary for a working gawk. And, even if you built it, it wouldn't do anything unless you specifically used the extension() gawk command to reference the object file and import the extra definitions (see the link I posted in the first email for all the gory details. Also the Makefile that comes with Gentoo's own filefuncs.c may help). ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-user] gawk and filefuncs 2010-09-04 9:58 ` Etaoin Shrdlu @ 2010-09-04 10:51 ` Al 0 siblings, 0 replies; 6+ messages in thread From: Al @ 2010-09-04 10:51 UTC (permalink / raw To: gentoo-user >> 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? > > How are you building it? It needs special commands because it needs to > become a shared object, not an executable. > Here is how I am building it and the whole context: http://en.gentoo-wiki.com/wiki/Prefix/Cygwin#gawk-3.1.7:_.5Bfilefuncs.so.0.0.1.5D_Error_1 emerge --oneshot gawk > Note that building that file is by no means necessary for a working gawk. > > And, even if you built it, it wouldn't do anything unless you specifically > used the extension() gawk command to reference the object file and import > the extra definitions (see the link I posted in the first email for all > the gory details. Also the Makefile that comes with Gentoo's own > filefuncs.c may help). I did understand, that it is an extension, which provides additional commands for awk scripts and that the gentoo system makes use of them especially of it's own additions. Options: 1.) It would compile on Cygwin. I just made a mistake. 2.) It depends on the missing kernel. I have to rewrite Gentoos filefuncs.c to work without a linux kernel. 3.) I can go with the original extension. Portage does not really depend on Gentoos additions. 4.) I have to adapt all awk scripts that make use of it. Al ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-09-04 10:51 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-09-03 20:31 [gentoo-user] gawk and filefuncs Al 2010-09-03 21:04 ` Etaoin Shrdlu 2010-09-03 22:25 ` Al 2010-09-03 22:26 ` Al 2010-09-04 9:58 ` Etaoin Shrdlu 2010-09-04 10:51 ` Al
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox