:: Re: [DNG] merged /usr breakage
Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Didier Kryn
Fecha:  
A: dng@lists.dyne.org
Asunto: Re: [DNG] merged /usr breakage
Le 07/01/2022 à 12:13, Olaf Meeuwissen a écrit :
>> Concerning installation in /usr/local:
>> --------------------------------------
>>
>>     My first investigations indicate that there is provision in
>> Freedesktop.org to put icons and launchers under $HOME/.local, but
>> nothing for /usr/local. Therefore the installation of an application
>> in /usr/local could include executable, config files and manpages, but
>> the icon and the launcher would be per user.
>>     Seems /usr/local is honoured by the base system (default PATH and
>> default man search path) but is "deprecated" by Freedesktop.
>>
>>
>> Concerning installation in user's space:
>> ----------------------------------------
>>
>>     As written above, Freedesktop enables icons, launchers and
>> applications menu in ~/.local . Man will look also by default search
>> ~/man if it exists, but, to my knowledge, there is no default user
>> directory for executables; it is therefore up to the user to create
>> this directory and specify it when installing, which makes
>> uninstallation problematic.
>>
>>     In this case, the installer might force the use of ~/bin and ~/man
>> and create them if they don't exist.
> If I were you I would make the installation locations configurable, at
> least at build time with an option to override at install time.
>
> Don't know if you have any experience with building GNU software from
> source but the ./configure command has options to set a whole pile of
> locations:
>
> - bindir
> - libdir
> - mandir
> - ...
>
> by default these locations are below a configurable prefixdir that
> defaults to /usr/local so you get to install below
>
> - /usr/local/bin
> - /usr/local/lib
> - /usr/local/man
> -/usr/local/...
>
> If the user runs ./configure --prefix=$HOME then everything will end up
> below $HOME. If that user also added --mandir=/usr/local/man then only
> the manual pages would end up there, everything else still goes below
> $HOME.
>
> Often the resulting Makefile allows specifying a staging location, a
> destdir, so you can easily bundle the installed result, in a Debian
> package for example;-). Setting destdir to /tmp/test, would install
> that $HOME configured build in
>
> -/tmp/test/$HOME/bin
> -/tmp/test/$HOME/lib
> - /tmp/test/usr/local/man
> -/tmp/test/$HOME/...
>
> but at run-time still use the location without the /tmp/test prefix.
>
> Long story short, don't try to decide the final locations but make them
> configurable and let the builder decide. Just organize the locations
> using things like bindir, libdir, etc and make your code use whatever
> was configured at build time.
>
> I realize that autoconf may be less popular than it once was (cmake is
> gaining popularity, it seems) but its documentation has a section on the
> various installation locations it supports. Perhaps that can serve as a
> guide for picking the places you need.
>
> https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.70/autoconf.html#Installation-Directory-Variables


    First I won't use GNU autotools they're very complicated and they
make Makefiles unreadable and, in this case, it's a hammer to kill a fly.

    Install can be user-configurable, this is easy, but the package
provides the way to uninstall and, for the uninstall to work, the
install must be hardcoded because the source of the package cannot
remember what the user has done at install time.

    Therefore there must be some standard locations where to put files.
I could provide three options: /usr, /usr/local and $HOME. Then, the
uninstall could find its way automatically, but, in the case /usr/local,
it would be up to every user to create symlinks to icon and launcher,
and in the case of $HOME, the directories bin and man would be created
automatically.

--     Didier