[OSGeo-Discuss] How to set SHARE_DIR?
Jim Klassen
klassen.js at gmail.com
Mon Oct 5 20:04:36 PDT 2020
I wouldn't expect someone to set CMAKE_INSTALL_PREFIX=$HOME. That just seems like a good way to cause issues to me.
There is a ~/.local/share directory and a ~/.local/share/applications directory in my home directory that has desktop files in it. (That might imply using CMAKE_INSTALL_PREFIX=$HOME/.local is possible but that still seems like it is asking for trouble.)
Standard practice is to put the files under ${CMAKE_INSTALL_PREFIX}/share/<app> unless the user specifically overrides that. I consider it hostile behavior when an installer or build system starts putting files outside of the path(s) that I have specified for it. I can make symlinks for files in ${CMAKE_INSTALL_PREFIX}/share to ~/.local/share/applications manually if I want to.
As an aside, I personally tend to install locally built applications under ~/apps/<category>/<app>/<version> where <category> is something like GIS, and <app> would be like QGIS or PDAL, and version is the release or the output of 'git describe --tags'. This lets me keep multiple versions of installed applications which is particularly useful for regression testing and/or ensuring a long job is completed using one version of a program while I can start new jobs with newer versions. I have a (git) versioned build.sh script for each application that does things like make directories, call cmake/make/make test/make install, and sometimes updates desktop files and module files (see the environment-modules Debian package). Occasionally I have special builds with custom patches for a particular task. These fit the structure too (they have a different git tag/hash).
If build systems started messing around with files in ~/.local/share/applications behind my back, it would make a real mess of not being certain what build a desktop file was pointing to.
On 10/5/20 8:56 PM, Pierre Abbat wrote:
> When installing an app from a package on Linux, the binaries go in /usr/bin/,
> the data files go in /usr/share/<app>/, and the desktop files go in /usr/share/
> applications/. When installing from source, or installing from a package on
> DragonFly, the binaries go in /usr/local/bin/, the data files go in /usr/local/
> share/<app>/, and the desktop files go in /usr/share/applications/. When I
> install it in my home directory, the binaries go in ~/bin/. The desktop files,
> however, go in ~/.local/applications/. Where should the data files go?
>
> I've been setting SHARE_DIR to ${CMAKE_INSTALL_PREFIX}/share/<app>. If I put
> the desktop file in ${CMAKE_INSTALL_PREFIX}/share/applications/, that would be
> correct for a system-wide install, but wrong for a personal install. I checked
> SHARE_DIR in CMakeLists files seven levels deep (PDAL has some that are that
> deep), but found none that set SHARE_DIR to anything else. Is there another
> CMake variable that tells where desktop files go?
>
> One of the lines in the desktop file tells where the icon is. PerfectTIN has a
> 256×256 pixel icon. Do I have to shrink it for the desktop file?
>
> Pierre
More information about the Discuss
mailing list