comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: How to nicely distribute a simple Ada library?
Date: Mon, 5 Dec 2011 18:22:20 -0600
Date: 2011-12-05T18:22:20-06:00	[thread overview]
Message-ID: <jbjn7u$mh5$1@munin.nbi.dk> (raw)
In-Reply-To: 361x89sndsg9$.16ruxrwxud090$.dlg@40tude.net

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message 
news:361x89sndsg9$.16ruxrwxud090$.dlg@40tude.net...
...
> 4. Never set linker options using pragmas! Linker options belong to the
> .gpr file.

We made the opposite decision in Claw. We put all of the needed linker 
options into (one) body, tailored for each compiler. (Note that since Claw 
is for Windows only, we really only had one target per compiler.)

One of the main reasons is that pragma Linker_Options works in most Ada 
compilers, while the project facilities are all over the map. (.GPR files 
didn't even exist for GNAT when we created Claw in the late 1990's). 
Moreover, we wanted to supply libraries in pure source form, without any 
"building" artifacts that go out of date the moment a new compiler or OS 
version is released.

Indeed, every Ada compiler has a decent make facility. Needing more than 
that suggests an overcomplicated setup for most libraries. Just create a 
directory, dump the source in it, and point your compiler (using a project, 
maybe) to it. Everything else should be automated by the compiler, and I can 
hardly imagine a decent programmer that couldn't do the first three steps in 
their sleep.

So I would give a different setup:

(1) Depend on as few other libraries (other than the Ada-defined stuff) as 
possible. Most of the trouble comes from depending on other libraries, and 
few things really need to do that. If you have a package of GTK widgets, of 
course you'll need a dependency, but unless those are the primary reason for 
your package, keep them separate. (Someone might want to use your library 
with QT or with Claw, and they shouldn't need GTK in that case.)

(2) Put as much as possible into the source code. Perferably, *everything* 
will be in the source code, so a simple make will do the trick.

(3) I do agree with others in one sense -- never put build information into 
the source code unless it has a direct impact on the library (as in Claw 
needing to force linking of various Win32 object libraries). Indeed, if you 
need build information anywhere, refer back to point 1. :-)

(4) Don't worry about fancy installers unless you are planning a large 
project that many people will (not might) use. The amount of time sucked up 
by creating and testing such things is immense (it probably accounts for 30% 
of my time working on Janus/Ada -- example: the current release is 
unfinished in large part because the uninstaller doesn't work right on 
Windows 7. Grrrr.) You're much better off spending your time on the project, 
not on installers and other cruft. You could spend that 30% of time 
individually helping users and still be better off (because you'll learn 
about the pain points and think about ways to mitigate them).

YMMV. The situation probably is different if you are creating a GNAT-only 
project -- but I'd recommend against that (even if you don't directly 
support non-GNAT-use) -- depending only on Ada allows more people to use 
your work. (And Ada compilers are pretty similar compared to other languages 
with multiple implementations.)

                                             Randy.





  parent reply	other threads:[~2011-12-06  0:22 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-04 11:19 How to nicely distribute a simple Ada library? Natasha Kerensikova
2011-12-04 12:06 ` Dmitry A. Kazakov
2011-12-05 11:55   ` Yannick Duchêne (Hibou57)
2011-12-05 11:58   ` Yannick Duchêne (Hibou57)
2011-12-05 13:31     ` Dmitry A. Kazakov
2011-12-05 14:11       ` Yannick Duchêne (Hibou57)
2011-12-05 15:22         ` Georg Bauhaus
2011-12-05 15:51           ` Yannick Duchêne (Hibou57)
2011-12-05 17:50             ` Dmitry A. Kazakov
2011-12-05 15:24         ` Dmitry A. Kazakov
2011-12-06  0:22   ` Randy Brukardt [this message]
2011-12-06  6:27     ` J-P. Rosen
2011-12-08  7:47       ` Randy Brukardt
2011-12-08 10:17         ` Ludovic Brenta
2011-12-09  0:00           ` Randy Brukardt
2011-12-09  8:42             ` Ludovic Brenta
2011-12-06  8:57   ` Ludovic Brenta
2011-12-06  9:47     ` Dmitry A. Kazakov
2011-12-06 10:13       ` Ludovic Brenta
2011-12-08 15:53   ` Yannick Duchêne (Hibou57)
2011-12-08 18:34     ` Dmitry A. Kazakov
2011-12-04 12:28 ` Ludovic Brenta
2011-12-04 14:39 ` Georg Bauhaus
2011-12-08 10:18   ` Natasha Kerensikova
2011-12-08 11:28     ` Ludovic Brenta
2011-12-08 14:00     ` Robert A Duff
2011-12-08 15:37       ` Georg Bauhaus
2011-12-04 17:42 ` Jeffrey Carter
2011-12-04 20:25 ` Tero Koskinen
2011-12-04 22:04 ` Simon Wright
2011-12-05 11:53 ` Yannick Duchêne (Hibou57)
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox