NigelCunningham / pam-MySQL

PAM MySQL
GNU General Public License v2.0
111 stars 61 forks source link

install_dir is hard coded to '/lib/security' #80

Closed spike77453 closed 2 years ago

spike77453 commented 2 years ago

It seems that install_dir is hard coded to /lib/security: https://github.com/NigelCunningham/pam-MySQL/blob/master/meson.build#L270

This is a problem on Fedora (and by extension also on RHEL/CentOS etc.) since the correct directory is platform dependent (e.g. /lib/security on 32bit platforms and /lib64/security on 64bit platforms, see: https://docs.fedoraproject.org/en-US/packaging-guidelines/RPMMacros/, technically /usr/lib/security and /usr/lib64/security since https://fedoraproject.org/wiki/Features/UsrMove)

I couldn't find any (reasonably easy) way to set install_dir during build time, but this might be me knowing little to nothing about meson. It'd be nice if this could be configurable so it can be set to %{_libdir}

There's also https://github.com/NigelCunningham/pam-MySQL/blob/master/install.sh which tries to address this. But that of course doesn't work in an rpm build environment:

+ /usr/bin/meson install -C x86_64-redhat-linux-gnu --no-rebuild
Installing libpam_mysql.so to /builddir/build/BUILDROOT/pam_mysql-1.0.0~beta1-1.fc34.x86_64/lib/security
Running custom install script '/builddir/build/BUILD/pam-MySQL-1.0.0-beta1/install.sh'
--- stdout ---

--- stderr ---
mv: cannot stat '/lib/security/libpam_mysql.so': No such file or directory
strip: '/lib/security/pam_mysql.so': No such file

FAILED: install script '/builddir/build/BUILD/pam-MySQL-1.0.0-beta1/install.sh' exit code 1, stopped

The current expansion of the %meson macro on Fedora 34 looks something like this:

/usr/bin/meson --buildtype=plain --prefix=/usr --libdir=/usr/lib64 --libexecdir=/usr/libexec --bindir=/usr/bin --sbindir=/usr/sbin --includedir=/usr/include --datadir=/usr/share --mandir=/usr/share/man --infodir=/usr/share/info --localedir=/usr/share/locale --sysconfdir=/etc --localstatedir=/var --sharedstatedir=/var/lib --wrap-mode=nodownload --auto-features=enabled . x86_64-redhat-linux-gnu

So the right directory to use is probably libdir: https://mesonbuild.com/Builtin-options.html

spike77453 commented 2 years ago

Here's a working scratch build: https://copr.fedorainfracloud.org/coprs/spike/pam-MySQL/build/2915175/

I did:

sed -i "s#install_dir: '/lib/security'#install_dir: join_paths(get_option('libdir'), 'security')#" meson.build

Please take it with a grain of salt though since I have no idea if that's how things are done with meson