comp.lang.ada
 help / color / mirror / Atom feed
From: Ludovic Brenta <ludovic@ludovic-brenta.org>
Subject: Re: Some questions on packaging Ada code
Date: Wed, 9 Mar 2011 03:22:15 -0800 (PST)
Date: 2011-03-09T03:22:15-08:00	[thread overview]
Message-ID: <eddb7c64-bbfb-4a12-8742-8f452882e82d@f31g2000pri.googlegroups.com> (raw)
In-Reply-To: slrnincsgh.l4u.localhost@example.org

localhost@example.com wrote on comp.lang.ada:
> Hello all! Is it possible to generate an executable using gcc-ada and
> ncurses that doesn't have any dependencies? I'm thinking about providing an
> application to people that don't have ada or maybe even gcc installed and
> certainly not ncurses. I have Linux as my development system. If the answer
> to this question is yes

Yes.

For the GNAT run-time library, pass the -static option to gnatbind,
like so:

gnatmake [other parameters...] -bargs -static

or using a package Binder in your GNAT project file.

Please read the GNAT User's Guide for your version of GCC[1].

[1] http://gcc.gnu.org/onlinedocs/

For libraries other than the GNAT run-time library (such as ncurses),
simply specify the name of all static libraries necessary on the
command line or in the package Linker of your project file, like so:

gnatmake foo.adb [other options...] \
  -bargs -static \
  -largs /usr/lib/libncurses_ada.a /usr/lib/libncurses.a

or:

with "ncurses_ada";
project Foo is
   package Binder is
      for Default_Switches ("Ada") use ("-static");
   end Binder;
   package Linker is
      for Default_Switches ("Ada")
        use ("/usr/lib/libncurses_ada.a", "/usr/lib/libncurses.a");
   end Linker;
end Foo;

> then my next question would be can I generate a
> standalone Windows executable from Linux easily enough or should I take the
> source over to Windows somehow and build it there. Thanks for your help.

It is possible to cross-compile from a GNU/Linux host to a Windows
target but I am not aware of any binary distribution of the necessary
cross-compiler.  This means you would have to build your own cross-
compiler and cross-libraries from source.  I think this would be more
trouble than it is worth (especially since you seem to be a beginner);
you would be better off installing a native compiler and libraries on
Windows and recompiling your sources on Windows.

Finally, some notes about ncurses:
* the library may not work out of the box on Windows as it needs an
ANSI-compliant terminal.  I'm sure it can be made to work, perhaps
with some tweaking.
* you will need an Ada binding to ncurses, both on GNU/Linux and on
Windows.  Do you have one?  (see also http://bugs.debian.org/615920).

Hope this helps

--
Ludovic Brenta.



  parent reply	other threads:[~2011-03-09 11:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-08 18:14 Some questions on packaging Ada code localhost
2011-03-08 20:53 ` Nasser M. Abbasi
2011-03-09 10:32   ` localhost
2011-03-09  0:19 ` R Tyler Croy
2011-03-09 10:33   ` localhost
2011-03-09 10:44     ` Nasser M. Abbasi
2011-03-09 11:29       ` localhost
2011-03-09 11:22 ` Ludovic Brenta [this message]
2011-03-09 11:36   ` localhost
replies disabled

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