Move finding XML catalogs into a separate setup hook

This is because libxml/libxslt are not the only implementations that
respect $XML_CATALOG_FILES.

Also, look in share/xml for catalogs (in addition to the
now-deprecated xml/dtd and xml/xsl).
This commit is contained in:
Eelco Dolstra 2014-11-25 16:02:19 +01:00
parent 9adc6fe276
commit e611215f5c
4 changed files with 28 additions and 24 deletions

View File

@ -0,0 +1,22 @@
addXMLCatalogs () {
local d i
# xml/dtd and xml/xsl are deprecated. Catalogs should be
# installed underneath share/xml.
for d in $1/share/xml $1/xml/dtd $1/xml/xsl; do
if [ -d $d ]; then
for i in $(find $d -name catalog.xml); do
XML_CATALOG_FILES+=" $i"
done
fi
done
}
if [ -z "$libxmlHookDone" ]; then
libxmlHookDone=1
# Set up XML_CATALOG_FILES. An empty initial value prevents
# xmllint and xsltproc from looking in /etc/xml/catalog.
export XML_CATALOG_FILES
if [ -z "$XML_CATALOG_FILES" ]; then XML_CATALOG_FILES=" "; fi
envHooks+=(addXMLCatalogs)
fi

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, zlib, xz, python ? null, pythonSupport ? true }:
{ stdenv, fetchurl, zlib, xz, python ? null, pythonSupport ? true, findXMLCatalogs }:
assert pythonSupport -> python != null;
@ -22,9 +22,7 @@ stdenv.mkDerivation (rec {
# RUNPATH for that, leading to undefined references for its users.
++ (stdenv.lib.optional stdenv.isFreeBSD xz);
propagatedBuildInputs = [ zlib ];
setupHook = ./setup-hook.sh;
propagatedBuildInputs = [ zlib findXMLCatalogs ];
passthru = { inherit pythonSupport version; };

View File

@ -1,19 +0,0 @@
addXMLCatalogs () {
for kind in dtd xsl; do
if test -d $1/xml/$kind; then
for i in $(find $1/xml/$kind -name catalog.xml); do
export XML_CATALOG_FILES="$XML_CATALOG_FILES $i"
done
fi
done
}
if test -z "$libxmlHookDone"; then
libxmlHookDone=1
# Set up XML_CATALOG_FILES. An empty initial value prevents
# xmllint and xsltproc from looking in /etc/xml/catalog.
export XML_CATALOG_FILES
if test -z "$XML_CATALOG_FILES"; then XML_CATALOG_FILES=" "; fi
envHooks+=(addXMLCatalogs)
fi

View File

@ -437,7 +437,10 @@ let
../build-support/setup-hooks/make-coverage-analysis-report.sh;
# intended to be used like nix-build -E 'with <nixpkgs> {}; enableDebugging fooPackage'
enableDebugging = pkg : pkg.override { stdenv = stdenvAdapters.keepDebugInfo pkg.stdenv; };
enableDebugging = pkg: pkg.override { stdenv = stdenvAdapters.keepDebugInfo pkg.stdenv; };
findXMLCatalogs = makeSetupHook { } ../build-support/setup-hooks/find-xml-catalogs.sh;
### TOOLS