method for altering installation location

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

method for altering installation location

Andy Falanga (afalanga)
How does one properly make a build system install to the
system-preferred locations for 64-bit binaries?  I'm wondering how to
properly make my build system choose "/usr/lib64" over simply "/usr/lib"
when configure is run.  I know this can be done simply via
"--prefix=/usr --libdir=lib64", and maybe this is what it should be
(along with some type of bootstrap script).  I was just wondering if
there are already elegant/"smiled upon" methods for doing this in
configure (i.e. configure.ac).

Thanks,
Andy
Reply | Threaded
Open this post in threaded view
|

Re: method for altering installation location

Eric Blake-3
On 11/13/2015 12:11 PM, Andy Falanga (afalanga) wrote:
> How does one properly make a build system install to the
> system-preferred locations for 64-bit binaries?  I'm wondering how to
> properly make my build system choose "/usr/lib64" over simply "/usr/lib"
> when configure is run.  I know this can be done simply via
> "--prefix=/usr --libdir=lib64", and maybe this is what it should be

Yes, that IS the preferred way (although autoconf's config.site can make
it easier).  Your configure script should not hard code any knowledge,
rather the user of your configure script should supply their knowledge.

It's also recommended that you convince your distro to install a
/usr/share/config.site file, which is the easiest way to get
'./configure --prefix=/usr' to just do the right things for all the
other variables.  Fedora has already done so:

$ rpm -qf /usr/share/config.site
autoconf-2.69-20.fc22.noarch
$ cat /usr/share/config.site
# This is the config.site file to satisfy FHS defaults when installing below
# /usr.
#
# You may override this file by your config.site using the CONFIG_SITE env
# variable.
#
# Note: This file includes also RHEL/Fedora fix for installing libraries
into
# "/lib/lib64" on 64bit systems.

if test -n "$host"; then
    # skip when cross-compiling
    return 0
fi

if test "$prefix" = /usr \
   || { test "$prefix" = NONE && test "$ac_default_prefix" = /usr ; }
then
    test "$sysconfdir" = '${prefix}/etc' && sysconfdir=/etc
    test "$sharedstatedir" = '${prefix}/com' && sharedstatedir=/var
    test "$localstatedir" = '${prefix}/var' && localstatedir=/var

    ARCH=`uname -m`
    for i in x86_64 ppc64 s390x aarch64; do
        if test $ARCH = $i; then
            test "$libdir" = '${exec_prefix}/lib' &&
libdir='${exec_prefix}/lib64'
            break
        fi
    done
fi


> (along with some type of bootstrap script).  I was just wondering if
> there are already elegant/"smiled upon" methods for doing this in
> configure (i.e. configure.ac).

There's nothing for you to do in configure.ac (that doesn't scale -
you'd have to modify every packages' configure.ac to get them to all act
the same).  Rather, the work should be done by whoever wants
installation of things into /usr to just work.

See also the autoconf manual:
https://www.gnu.org/software/autoconf/manual/autoconf.html#Site-Defaults

--
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


signature.asc (617 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: method for altering installation location

Michael Felt
I have seen a lot of solutions where .../lib/files.extension is used for
32-bit and .../lib64/files.extension or .../lib/64/files.extension.

I am undecided about what I prefer of these two.

However, as my focus is AIX - I will prefer to use only one directory and
the same file (archive) name and even same member names - and utilize an
AIX feature that permits the same member name for both 32 and 64 bit - as
the linker/loader will only dlopen one, depending on the mode of the
application.

This does complicate the final packaging - but I am hoping to resolve/solve
that outside of the GNU autotools. Instead, I will make the 32-bit library
a pre-requisite and add the glue to include/copy the 64-bit members into
the existing 32-bit archive.

For packaging Linux distros I would look at what seems to be the convention
- and try to follow that.

On Fri, Nov 13, 2015 at 7:57 PM, Eric Blake <[hidden email]> wrote:

> On 11/13/2015 12:11 PM, Andy Falanga (afalanga) wrote:
> > How does one properly make a build system install to the
> > system-preferred locations for 64-bit binaries?  I'm wondering how to
> > properly make my build system choose "/usr/lib64" over simply "/usr/lib"
> > when configure is run.  I know this can be done simply via
> > "--prefix=/usr --libdir=lib64", and maybe this is what it should be
>
> Yes, that IS the preferred way (although autoconf's config.site can make
> it easier).  Your configure script should not hard code any knowledge,
> rather the user of your configure script should supply their knowledge.
>
> It's also recommended that you convince your distro to install a
> /usr/share/config.site file, which is the easiest way to get
> './configure --prefix=/usr' to just do the right things for all the
> other variables.  Fedora has already done so:
>
> $ rpm -qf /usr/share/config.site
> autoconf-2.69-20.fc22.noarch
> $ cat /usr/share/config.site
> # This is the config.site file to satisfy FHS defaults when installing
> below
> # /usr.
> #
> # You may override this file by your config.site using the CONFIG_SITE env
> # variable.
> #
> # Note: This file includes also RHEL/Fedora fix for installing libraries
> into
> # "/lib/lib64" on 64bit systems.
>
> if test -n "$host"; then
>     # skip when cross-compiling
>     return 0
> fi
>
> if test "$prefix" = /usr \
>    || { test "$prefix" = NONE && test "$ac_default_prefix" = /usr ; }
> then
>     test "$sysconfdir" = '${prefix}/etc' && sysconfdir=/etc
>     test "$sharedstatedir" = '${prefix}/com' && sharedstatedir=/var
>     test "$localstatedir" = '${prefix}/var' && localstatedir=/var
>
>     ARCH=`uname -m`
>     for i in x86_64 ppc64 s390x aarch64; do
>         if test $ARCH = $i; then
>             test "$libdir" = '${exec_prefix}/lib' &&
> libdir='${exec_prefix}/lib64'
>             break
>         fi
>     done
> fi
>
>
> > (along with some type of bootstrap script).  I was just wondering if
> > there are already elegant/"smiled upon" methods for doing this in
> > configure (i.e. configure.ac).
>
> There's nothing for you to do in configure.ac (that doesn't scale -
> you'd have to modify every packages' configure.ac to get them to all act
> the same).  Rather, the work should be done by whoever wants
> installation of things into /usr to just work.
>
> See also the autoconf manual:
> https://www.gnu.org/software/autoconf/manual/autoconf.html#Site-Defaults
>
> --
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
>