GLE icon indicating copy to clipboard operation
GLE copied to clipboard

FHS Compliance on Linux

Open vlabella opened this issue 7 months ago • 3 comments

The files that GLE installs during the cmake install stage on Linux are not Filesystem Hierarchy Standard (FHS) compliant.

The variable CMAKE_INSTALL_PREFIX controls the root of the installation. This can be set to a folder to serve as a staging area to allow for easy packaging using zip etc. The cmake install process is currently designed for this - to install to a staging area for packaging - not to install system wide as an application. It would be good to enable it to be able to install for system wide installation, which I believe is needed for package maintainers.

However, there seem to be variations in the locations of files from distro to distro making this nontrivial. In addition, gle is programmed to expect certain files in certain locations, adding to the complexity.

Here is the current list of files and where they get installed relative to the CMAKE_INSTALL_PREFIX

Files that get installed into ./doc

LICENSE.txt README.txt ChaneLog.txt gle-manual.pdf

Files that get installed into ./gleinc

include/*

Files get installed into the root

glerc init.text initex.ini

Files that get installed into ./bin

gle qgle glebtool fbuild makefmt

A couple of solutions would be

  1. Add options to the cmake file to control these locations. This may require modifications to the source code where gle searches for things.

  2. Create a custom install script (per distro) that does the installation from the staging area. This may also require modifications to the gle source code.

Question: Where should these files be installed (per distro) to make them FHS compliant?

vlabella avatar May 15 '25 20:05 vlabella

Gentoo linux:

/usr/bin: gle qgle glebtool fbuild makefmt

/usr/share/gle: glerc init.text initex.ini gleinc/: barcode.gle ... ziptext.gle font/: arial8.fmt ... timesi8.fmt

/usr/share/doc/gle-4.3.6: README.txt ChangeLog.txt gle-manual.pdf

License texts for in Gentoo are not installed per package; instead, each package has a list of licenses it uses (for gle: BSD GPL2+), and there is a central licenses directory (containing, in particular, the files BSD, GPL2+).

I think this layout is similar to most linux distros. The package name may be different: in Debian it is gle-graphics, as far as I know. Also, Debian uses /usr/share/doc/ directories without version numbers: /usr/share/doc/gle-graphics/.

So, for this layout it is reasonable to set CMAKE_INSTALL_PREFIX to /usr/share/gle (for Debian, /usr/share/gle-graphics). Executables go to /usr/bin everywhere. The directory in /usr/share/doc/ should be configurable: gle-<version_number> in Gentoo, gle-graphics in Debian.

andreygrozin avatar May 16 '25 05:05 andreygrozin

For the debian package, I do not use make install (anymore). The binaries and fonts are put into place with an install file:

https://salsa.debian.org/science-team/gle-graphics/-/blob/master/debian/gle-graphics.install

This way it is easier to control what is included in the package and where, and what not. For example, glebtool is in its own package, because it is only needed during the build. fbuild and makefmt are not in the Debian package, would they be useful to a user? If they were included, probably not with these pretty generic names. All in all, I am pretty happy with picking files from the staging area. I don't think upstream should worry too much about packaging issues, as long as it does not impede packaging.

steigies avatar May 18 '25 14:05 steigies

These comments are very helpful

vlabella avatar May 20 '25 23:05 vlabella

I just committed a change so GLE will look in FHS compliant directories for its files.

  • linux: auto searching for GLE_TOP if not set. It will search relative to executable location in FHS compliant directories. for example: gle is in /usr/bin it will search for glerc in /usr/share/gle or /usr/share/gle-graphics
  • linux gui: will search in FHS compliant directory first for gle-manaul.pdf if GLE_TOP is /usr/share/gle it will search in /usr/share/doc/gle if GLE_TOP is /usr/share/gle-graphics it will search in /usr/share/doc/gle-graphics if not found then it will also search in non FHS compliant locations: /usr/share/gle/doc /usr/share/gle-graphics/doc

cmake installation command does not yet install to these locations. So its up to the user or package maintainer to write an install scrip to install files as follows:

/usr/bin: gle qgle manip

/usr/share/gle: glerc init.text initex.ini gleinc/: barcode.gle ... ziptext.gle font/: arial8.fmt ... timesi8.fmt

/usr/share/doc/gle README.txt ChangeLog.txt gle-manual.pdf

vlabella avatar Oct 28 '25 16:10 vlabella

Changes have been made to the gle program and the cmake files to adhere to the FHS compliance on Linux. By default the cmake install command installs the files in FHS complaint directories. The readme has been updated with the new build commands. 4.3.9 will be the first version to use these changes when released soon. I am going to close this issue.

vlabella avatar Oct 30 '25 17:10 vlabella