comp.lang.ada
 help / color / mirror / Atom feed
* Installing .ads, best practices ?
@ 2018-04-30 13:17 patrick
  2018-04-30 14:38 ` Niklas Holsti
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: patrick @ 2018-04-30 13:17 UTC (permalink / raw)


Hi Everyone

If we create our own C libraries on Linux(or similar posix) the best practice is to put the header in /usr/local/lib and not in /usr/lib where the original libraries installed by the package manager or at install time are located.

On my system, most of the .ads spec files are located in:
/usr/lib/gcc/x86_64-linux-gnu/4.6/rts-native/adainclude/

It doesn't seem to like a good idea to install my own spec files there for system wide use.

Would /usr/local/include be better? Do you use something like this? If so, do you have an environmental variable in your.bashrc so that gnatmake finds it without passing an argument ?

Thanks for reading-Patrick

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Installing .ads, best practices ?
  2018-04-30 13:17 Installing .ads, best practices ? patrick
@ 2018-04-30 14:38 ` Niklas Holsti
  2018-04-30 15:03 ` Dmitry A. Kazakov
  2018-04-30 16:48 ` Simon Wright
  2 siblings, 0 replies; 8+ messages in thread
From: Niklas Holsti @ 2018-04-30 14:38 UTC (permalink / raw)


On 18-04-30 16:17 , patrick@spellingbeewinnars.org wrote:
> Hi Everyone
>
> If we create our own C libraries on Linux(or similar posix) the best
> practice is to put the header in /usr/local/lib and not in /usr/lib
> where the original libraries installed by the package manager or at
> install time are located.
>
> On my system, most of the .ads spec files are located in:
> /usr/lib/gcc/x86_64-linux-gnu/4.6/rts-native/adainclude/
>
> It doesn't seem to like a good idea to install my own spec files
> there for system wide use.
>
> Would /usr/local/include be better? Do you use something like this?
> If so, do you have an environmental variable in your.bashrc so that
> gnatmake finds it without passing an argument ?

Perhaps some good suggestions can be found in the Debian Ada Policy, at 
https://people.debian.org/~lbrenta/debian-ada-policy.html.

As for gnatmake, my practice is to have a program-specific shell-script 
that is "sourced" to define the ADA_INCLUDE_PATH (and sometimes 
ADA_OBJECTS_PATH) that lists the locations of the source and object 
files. But I recomment to use gprbuild and a library project if possible.

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Installing .ads, best practices ?
  2018-04-30 13:17 Installing .ads, best practices ? patrick
  2018-04-30 14:38 ` Niklas Holsti
@ 2018-04-30 15:03 ` Dmitry A. Kazakov
  2018-04-30 16:25   ` patrick
  2018-04-30 16:48 ` Simon Wright
  2 siblings, 1 reply; 8+ messages in thread
From: Dmitry A. Kazakov @ 2018-04-30 15:03 UTC (permalink / raw)


On 2018-04-30 15:17, patrick@spellingbeewinnars.org wrote:

> If we create our own C libraries on Linux(or similar posix) the best practice is to put the header in /usr/local/lib and not in /usr/lib where the original libraries installed by the package manager or at install time are located.
> 
> On my system, most of the .ads spec files are located in:
> /usr/lib/gcc/x86_64-linux-gnu/4.6/rts-native/adainclude/
> 
> It doesn't seem to like a good idea to install my own spec files there for system wide use.
> 
> Would /usr/local/include be better? Do you use something like this? If so, do you have an environmental variable in your.bashrc so that gnatmake finds it without passing an argument ?

No. As Niklas suggested use the corresponding Ada policy of the target 
and pack your Ada library using the corresponding packaging tool, e.g. 
dpkg under Debian or rpm under Fedora.

If you respect the policy, no additional user settings are required to 
use your library with either gnatmake or gprbuild.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Installing .ads, best practices ?
  2018-04-30 15:03 ` Dmitry A. Kazakov
@ 2018-04-30 16:25   ` patrick
  2018-04-30 16:53     ` Dmitry A. Kazakov
  0 siblings, 1 reply; 8+ messages in thread
From: patrick @ 2018-04-30 16:25 UTC (permalink / raw)


Hi Dmitry ! Hi Niklas :)

It's actually my "library", I write "library" in quotes because it is currently 6 lines long, LOL.

The environment variables worked perfectly.

I am going to use /usr/local/lib + include for now as I guess there isn't a convention regarding tiny user written libraries.

based on the Ludovic's document, I could install here later:
ADA_INCLUDE_PATH += :/usr/share/ada/adainclude/LIBRARY
ADA_OBJECTS_PATH += :/usr/lib/TARGET/ada/adalib/LIBRARY

but I think for now it's important to keep my stuff separate from Ludovic's professional packages

Thanks again-Patrick

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Installing .ads, best practices ?
  2018-04-30 13:17 Installing .ads, best practices ? patrick
  2018-04-30 14:38 ` Niklas Holsti
  2018-04-30 15:03 ` Dmitry A. Kazakov
@ 2018-04-30 16:48 ` Simon Wright
  2018-04-30 17:21   ` patrick
  2 siblings, 1 reply; 8+ messages in thread
From: Simon Wright @ 2018-04-30 16:48 UTC (permalink / raw)


patrick@spellingbeewinnars.org writes:

> If we create our own C libraries on Linux(or similar posix) the best
> practice is to put the header in /usr/local/lib and not in /usr/lib
> where the original libraries installed by the package manager or at
> install time are located.
>
> On my system, most of the .ads spec files are located in:
> /usr/lib/gcc/x86_64-linux-gnu/4.6/rts-native/adainclude/

4.6? that's a bit ancient, isn't it?

> It doesn't seem to like a good idea to install my own spec files there
> for system wide use.

It would be a Very Bad Idea; that's the compiler's runtime.

When you say "for system wide use", do you mean that you want to make
your work available for other users of the system? or that you want to
avoid confusing other users of the system? (if there are any, of
course!)

> Would /usr/local/include be better? Do you use something like this? If
> so, do you have an environmental variable in your.bashrc so that
> gnatmake finds it without passing an argument ?

If this is just for yourself, I would:

a) learn how to use GNAT projects (.gpr)
b) use gprbuild instead of gnatmake
c) use gprinstall to install in a standard place; if you say
     gprinstall -p -P mylibrary.gpr --prefix=/usr/local
   then a reworked version of mylibrary.gpr will be installed in
   /usr/local/share/gpr/, with other files in appropriate places
   (e.g. /usr/local/include/mylibrary/, /usr/local/lib/mylibrary/)
d) add 'export ADA_PROJECT_PATH=/usr/local/share/gpr' to ~/.bashrc


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Installing .ads, best practices ?
  2018-04-30 16:25   ` patrick
@ 2018-04-30 16:53     ` Dmitry A. Kazakov
  0 siblings, 0 replies; 8+ messages in thread
From: Dmitry A. Kazakov @ 2018-04-30 16:53 UTC (permalink / raw)


On 2018-04-30 18:25, patrick@spellingbeewinnars.org wrote:

> It's actually my "library", I write "library" in quotes because it is currently 6 lines long, LOL.
> 
> The environment variables worked perfectly.

> I am going to use /usr/local/lib + include for now as I guess there isn't a convention regarding tiny user written libraries.
> 
> based on the Ludovic's document, I could install here later:
> ADA_INCLUDE_PATH += :/usr/share/ada/adainclude/LIBRARY
> ADA_OBJECTS_PATH += :/usr/lib/TARGET/ada/adalib/LIBRARY

No you should not, because it is different under different Linux 
distributions plus even more different when multi-arch comes into 
consideration!

If you are not going to make it right, do nothing. Just supply the 
sources and the gpr-file. The user can unpack it in whatever directory 
he chooses and then use the project file.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Installing .ads, best practices ?
  2018-04-30 16:48 ` Simon Wright
@ 2018-04-30 17:21   ` patrick
  2018-04-30 17:27     ` patrick
  0 siblings, 1 reply; 8+ messages in thread
From: patrick @ 2018-04-30 17:21 UTC (permalink / raw)


Hi Dmitry, Hi Simon

It's just for my use! and I only need a line of code to build it. If I distribute it, I will make a GPR file.

Thanks

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Installing .ads, best practices ?
  2018-04-30 17:21   ` patrick
@ 2018-04-30 17:27     ` patrick
  0 siblings, 0 replies; 8+ messages in thread
From: patrick @ 2018-04-30 17:27 UTC (permalink / raw)


Actually sense the title was best practices... I will get started on this. GPR might be a little overkill but if this is the way it's done, why not go with the flow.

Thanks

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-04-30 17:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-30 13:17 Installing .ads, best practices ? patrick
2018-04-30 14:38 ` Niklas Holsti
2018-04-30 15:03 ` Dmitry A. Kazakov
2018-04-30 16:25   ` patrick
2018-04-30 16:53     ` Dmitry A. Kazakov
2018-04-30 16:48 ` Simon Wright
2018-04-30 17:21   ` patrick
2018-04-30 17:27     ` patrick

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