Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

gawkapi.h

38 views
Skip to first unread message

Kenny McCormack

unread,
Aug 8, 2016, 7:39:51 AM8/8/16
to
(This thread is in the general vein of the various "How should the GAWK
ecosystem work?" threads. It is also a spinoff of some points raised in
the most recent incarnation of the "strptime" thread...)

That said, the question is: How exactly should one distribute a GAWK
extension library (assuming you are distributing it as source code)?

Basic assumptions:
1) You want to make it as easy as possible for users to compile and get
running - generally, you need to assume that they're not familiar
with compilers and such things.
2) User did not compile his version of GAWK. Assume some kind of
"binary distribution system" (either a binaries site for the
Windows users or something like "apt-get" on Linux).
3) (But) User does have access to a C compiler and can follow simple
instructions if they are clearly presented. In particular, user
can be assumed to be able to open a Command Prompt (or whatever you
choose to call it) and can navigate around in one.

That all said, consider my "strptime" extension. It consists of 2 files (a
.c and a .h), but it also requires one more file, gawkapi.h, in order to
compile. gawkapi.h comes from the main GAWK tarball; it will not generally
be available (i.e., installed anywhere on the system) under assumption 2)
above.

I have verified that if I put these 3 files (strptime.c, lintwarn.h and
the gawkapi.h file from a recent GAWK tarball)) into a fresh clean
directory and issue the compile command (cut-and-pasted from the comments
in the .c file), it all works. That is all you need.

But the question becomes: How should I ensure that the user, under
assumption 2) above, has a copy of gawkapi.h? Should I include it in
strptime.zip? Will I run afoul of GPL stuff if I do? Do I include
instructions for getting it from the net? It seems a little silly to
download the entire GAWK tarball just to get one file. And, finally, and
most importantly, does it matter which version of gawkapi.h is used? I.e.,
I assume that each new GAWK release (i.e., each new tarball) will or may
have a different version of gawkapi.h. Does this matter which tarball the
user pulls it from?

--
"There are two things that are important in politics.
The first is money and I can't remember what the second one is."
- Mark Hanna -

Janis Papanagnou

unread,
Aug 8, 2016, 11:33:32 AM8/8/16
to
On 08.08.2016 13:39, Kenny McCormack wrote:
> [...]
>
> That all said, consider my "strptime" extension. It consists of 2 files (a
> .c and a .h), but it also requires one more file, gawkapi.h, in order to
> compile. gawkapi.h comes from the main GAWK tarball; it will not generally
> be available (i.e., installed anywhere on the system) under assumption 2)
> above.
>
> I have verified that if I put these 3 files (strptime.c, lintwarn.h and
> the gawkapi.h file from a recent GAWK tarball)) into a fresh clean
> directory and issue the compile command (cut-and-pasted from the comments
> in the .c file), it all works. That is all you need.
>
> But the question becomes: How should I ensure that the user, under
> assumption 2) above, has a copy of gawkapi.h?

Obviously you can't ensure that.

> Should I include it in strptime.zip?

If it's not available in the user's system's include files that's a typical
way to go, yes. (Modulo license issues with that file of course.)

> Will I run afoul of GPL stuff if I do?

Probably. I *think* that's why there's (in other GNU projects) a distinction
of licenses (GPL vs. LGPL); one (the LGPL) would allow to include it, IUUC.
(That might not be relevant, though, if you anyway provide your source open
and for free.)

> Do I include
> instructions for getting it from the net? It seems a little silly to
> download the entire GAWK tarball just to get one file.

Indeed.

> And, finally, and
> most importantly, does it matter which version of gawkapi.h is used?

At least you can't rely on it. That's why with such API stuff there's
typically version information provided to be able to make checks. I see that
in gawkapi.h there's GAWK_API_{MAJOR,MINOR}_VERSION enum constants defined.

> I.e.,
> I assume that each new GAWK release (i.e., each new tarball) will or may
> have a different version of gawkapi.h. Does this matter which tarball the
> user pulls it from?

I haven't ever inspected the details of the gawk API, but part of the API
protocol should reject incompatible versions. If it's not documented the
maintainers may provided that information.

Janis

Aharon Robbins

unread,
Aug 8, 2016, 2:12:37 PM8/8/16
to
In article <no9r26$dm6$1...@news.xmission.com>,
Kenny McCormack <gaz...@shell.xmission.com> wrote:
> Will I run afoul of GPL stuff if I do?

You already have anyway simply by writing a gawk extension, no
matter whether you include the gawkapi.h file in your zip or not.

Any extension is a derivative work and as such is covered by the GPL.
--
Aharon (Arnold) Robbins arnold AT skeeve DOT com

Andrew Schorr

unread,
Aug 8, 2016, 7:39:41 PM8/8/16
to
On Monday, August 8, 2016 at 7:39:51 AM UTC-4, Kenny McCormack wrote:
> That said, the question is: How exactly should one distribute a GAWK
> extension library (assuming you are distributing it as source code)?

By contributing it to the gawkextlib project and helping to get it packaged up properly. Or by copying the packaging mechanisms of a gawkextlib project and hosting it elsewhere.

> 1) You want to make it as easy as possible for users to compile and get
> running - generally, you need to assume that they're not familiar
> with compilers and such things.
> 2) User did not compile his version of GAWK. Assume some kind of
> "binary distribution system" (either a binaries site for the
> Windows users or something like "apt-get" on Linux).

On my Fedora system, /usr/include/gawkapi.h is included in the same package as /usr/bin/gawk. If you have gawk, then you have gawkapi.h. Which distro are you using that does not install gawkapi.h? In principle, gawkapi.h could be part of a separate gawk-devel package, but that's not the way it is packaged on Fedora. I am not sure how other distributions are doing it.

If somebody is attempting to compile an extension, then they will at least have to know how to install a compiler and make and be able to run ./configure && make && make check && make install. If they're able to do that, then they should have the wherewithal to be able to install a gawk-devel package, if such a thing is needed to get /usr/include/gawkapi.h.

> And, finally, and
> most importantly, does it matter which version of gawkapi.h is used? I.e.,
> I assume that each new GAWK release (i.e., each new tarball) will or may
> have a different version of gawkapi.h. Does this matter which tarball the
> user pulls it from?

When each library is loaded, the standard initialization code checks for version compatibility. If it's not compatible, it prints an error message and exits.

Regards,
Andy
0 new messages