From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,39bde956b245c191 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.15.41 with SMTP id u9mr24883160pbc.3.1323130943991; Mon, 05 Dec 2011 16:22:23 -0800 (PST) MIME-Version: 1.0 Path: lh20ni73800pbb.0!nntp.google.com!news2.google.com!goblin3!goblin1!goblin.stu.neva.ru!news.tornevall.net!news.jacob-sparre.dk!pnx.dk!jacob-sparre.dk!ada-dk.org!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: How to nicely distribute a simple Ada library? Date: Mon, 5 Dec 2011 18:22:20 -0600 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <361x89sndsg9$.16ruxrwxud090$.dlg@40tude.net> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1323130942 23077 69.95.181.76 (6 Dec 2011 00:22:22 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 6 Dec 2011 00:22:22 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: news2.google.com comp.lang.ada:14845 Date: 2011-12-05T18:22:20-06:00 List-Id: "Dmitry A. Kazakov" 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.