rastersoft / autovala

A program that automatically generates CMake and Meson configuration files for your Vala project
GNU General Public License v3.0
104 stars 15 forks source link

[Feature request] custom tag directories #86

Open cromerc opened 7 years ago

cromerc commented 7 years ago

It would be nice if the custom tag had a component to choose the correct directory for the files for both meson and cmake. For example right now I have these custom tags:

custom: data/dbus/org.pamac.system.conf ${CMAKE_INSTALL_SYSCONFDIR}/dbus-1/system.d
custom: data/dbus/org.pamac.user.service ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/dbus-1/services
custom: data/dbus/org.pamac.system.service ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/dbus-1/system-services
custom: data/systemd/pamac-system.service ${CMAKE_INSTALL_LIBDIR}/systemd/system
custom: data/systemd/pamac-cleancache.service ${CMAKE_INSTALL_LIBDIR}/systemd/system
custom: data/systemd/pamac-cleancache.timer ${CMAKE_INSTALL_LIBDIR}/systemd/system
custom: data/systemd/pamac-mirrorlist.service ${CMAKE_INSTALL_LIBDIR}/systemd/system
custom: data/systemd/pamac-mirrorlist.timer ${CMAKE_INSTALL_LIBDIR}/systemd/system
custom: data/polkit/org.pamac.policy ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/polkit-1/actions
custom: data/mime/x-alpm-package.xml ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/mime/packages

Naturally in meson this is broken since $CMAKE_INSTALL_DATAROOTDIR is not set.

My suggestion would be to change the custom tag to this:

custom: data/dbus/org.pamac.system.conf dbus-1/system.d sysconfdir
custom: data/dbus/org.pamac.user.service dbus-1/services datarootdir
custom: data/dbus/org.pamac.system.service dbus-1/system-services datarootdir
custom: data/systemd/pamac-system.service systemd/system libdir
custom: data/systemd/pamac-cleancache.service systemd/system libdir
custom: data/systemd/pamac-cleancache.timer systemd/system libdir
custom: data/systemd/pamac-mirrorlist.service systemd/system libdir
custom: data/systemd/pamac-mirrorlist.timer systemd/system libdir
custom: data/polkit/org.pamac.policy polkit-1/actions datarootdir
custom: data/mime/x-alpm-package.xml mime/packages datarootdir

By having 3 arguments to the custom tag we can choose where on the system the files get installed to. This will also allow prefix installs to work correctly. For example I am using DESTDIR="$pkgdir" in a pacman PKGBUILD, which means I need the custom tag to respect the DESTDIR for the installation.

For example sysconfdir would put the correct directory "$DESTDIR/$PREFIX/etc" into the cmake/meson directories.

rastersoft commented 7 years ago

All these cases seem to be described in #87, aren't they?

cromerc commented 7 years ago

Yes they are the same examples, but both feature requests serve a different purpose. This one is about being able to control where files get installed when using the "custom" tag. The other feature request is for more auto detection abilities. These are real examples from the pamac-classic project.

rastersoft commented 7 years ago

Remember that if the destination path doesn't start with '/', it will be $DESTDIR/$PREFIX, so "custom: file share/" will install the file "filename" inside /usr/local/share or /usr/share, depending on the building settings.

cromerc commented 7 years ago

Good to know, but doesn't solve this problem. What if the user ran cmake -DCMAKE-INSTALL-LIBDIR=/usr/lib64 but then in the project file has: custom: file lib/ it would install it into lib directory by mistake instead of lib64 like what was passed to cmake.

rastersoft commented 7 years ago

Mmm... you are right...

rastersoft commented 6 years ago

Mmm... But the user should never need to install to the lib or lib64 folder because there belong only libraries, and the decision for libraries is made by cmake/meson themselves...

Is there another case where the user really need to choose between several folders?

cromerc commented 6 years ago

That isn't correct, there are also binaries, shell scripts, config files, etc in the lib directories. They are usually in subdirectories though. For example with the software OpenRC they install some binaries, config files, log files, etc into /usr/lib/openrc

My libdir looks like this: /usr/lib/openrc/bin (non root privilege binaries) /usr/lib/openrc/sh (shell scripts) /usr/lib/openrc/cache /usr/lib/openrc/console (config files for the console) /usr/lib/openrc/sbin (root privilege binaries)

Binaries that are in /usr/bin can be called by the user of the system or by other binaries/scripts. Binaries that are in /usr/lib are only supposed to be called by other binaries not by the user.

Here is the FHS(File Hierarchy Standard): http://www.pathname.com/fhs/pub/fhs-2.3.html#USRLIBLIBRARIESFORPROGRAMMINGANDPA

Programs that have files that are not libraries installed in a subdir in lib: accountsservice netifrc atkmm aspell cinnamon at-spi2-core cgit cups evince firefox geany gimp glib apache gnome-terminal gnome-system-monitor

These are only a few examples, if you go through all the folders you have under /usr/lib you will notice there are things other than binaries stored there.

So installing into the correct lib folder is important for software that installs those extra files into the lib folder.

rastersoft commented 6 years ago

Ok, you convinced me. I'll try to do it.

cromerc commented 6 years ago

Jajaja gracias. :)