I was wondering how would I proceed if I need to install some software in a directory of my choice instead of where PKGBUILD will install it?
Reading the makepkg info it seems like there are 3 variables which can be configured:
PKGDEST — directory for storing resulting packages
SRCDEST — directory for storing source data (symbolic links will be placed to src/ if it points elsewhere)
SRCPKGDEST — directory for storing resulting source packages (built with makepkg -S)
Do I need to create a makepkg.conf file inside the cloned pakage repo with the above variables?
Upon examining the PKGBUILD file I see that there some symbolic links and also in some *.pc files paths are hard coded, e.g. /opt/somepackage which makes me wonder whether any of the above changes in makepkg.conf will even be respectd in the first place or I’ll end up with a mess?
Is there an standardised way to compile and install packages into a custom directory without affecting anything else on the system?
I understand but in some cases I would like to install everything for instance in /tmp just to further examine the package but without affecting my system by installing in /opt or wherever the PKGBUILD has designated to install packages.
Yes of course. You need the PKGBUILD file for the package you want to rebuild. Edit the build function. Depending on how the PKGBUILD is written, you might need to edit the install function too.
Yeah I was aware of this but as I said I’ll need to edit all other *.pc files where hardcoded links appear.
Of course I could simply do a grep and sed on that but there might be something more elegant like makepkg --prefix for instance?
The problem with installing packages in non-standard directories is other packages won’t be able to find them. This may not matter for standalone packages, but eventually you’ll get into trouble creating a bad habit like that.
-r, --root <path>
Specify an alternative installation root (default is /). This should not be used as a way to install software into /usr/local instead
of /usr. NOTE: If database path or log file are not specified on either the command line or in pacman.conf(5), their default location
will be inside this root path. NOTE: This option is not suitable for performing operations on a mounted guest system. See --sysroot
instead.
Also I’m reving the xfce tag since the DE is not relevant to the question