You are not logged in.
I'm working on updating what had been an orphaned AUR package. A new make dependency was needed (docbook-xsl) and to produce a successful build, I needed to specify build flags pointing to two specific files from that dependency (illustrated below with html/chunk.xsl and fo/docbook.xsl)
makedepends=('cmake' 'git' 'docbook-xsl=1.79.2-7')
build() {
mkdir -p "$srcdir/$_gitname/build_dir"
cd "$srcdir/$_gitname/build_dir"
CXXFLAGS+=" -fpermissive"
cmake -DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=RELEASE \
-DBT_DOCBOOK_XSL_HTML_CHUNK_XSL=/usr/share/xml/docbook/xsl-stylesheets-1.79.2/html/chunk.xsl \
-DBT_DOCBOOK_XSL_PDF_DOCBOOK_XSL=/usr/share/xml/docbook/xsl-stylesheets-1.79.2/fo/docbook.xsl \
..
make
}
It's working, but I'm not convinced it's the most elegant solution. I'd prefer not to have to require a specific version of docbook-xsl, or specify a static path to the necessary files, for updatability sake and avoiding the possibility the files are not where I've specified.
Any thoughts on how to elegantly handle this?
Offline
I do not know docbook-xsl.
Arch Wiki suggests using pacman to get docbook-xsl version. Perhaps that helps.
Sometimes I seem a bit harsh — don’t get offended too easily!
Offline
Thanks @mpan. That reference provides a nice simple means to dynamically point to the files, with a bit of tweaking:
/usr/share/xml/docbook/xsl-stylesheets-$(pacman -Q docbook-xsl | cut -d ' ' -f 2 | cut -d '-' -f 1)/html/chunk.xsl
/usr/share/xml/docbook/xsl-stylesheets-$(pacman -Q docbook-xsl | cut -d ' ' -f 2 | cut -d '-' -f 1)/fo/docbook.xsl
If using pacman within PKGBUILD is fine, then this looks like it'll do the trick.
Last edited by Bink (2022-05-15 10:17:55)
Offline
This has worked in testing. Thanks again @mpan.
makedepends=('cmake' 'git' 'docbook-xsl')
build() {
_xslstylespath="/usr/share/xml/docbook/xsl-stylesheets-"$(pacman -Q docbook-xsl | cut -d ' ' -f 2 | cut -d '-' -f 1)
mkdir -p "$srcdir/$_gitname/build_dir"
cd "$srcdir/$_gitname/build_dir"
CXXFLAGS+=" -fpermissive"
cmake -DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=RELEASE \
-DBT_DOCBOOK_XSL_HTML_CHUNK_XSL=$_xslstylespath/html/chunk.xsl \
-DBT_DOCBOOK_XSL_PDF_DOCBOOK_XSL=$_xslstylespath/fo/docbook.xsl \
..
make
}
Offline