summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-11-25 16:02:19 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-11-25 16:23:48 +0100
commite611215f5c1b7ca19785ec462e696dff103847b0 (patch)
tree7eabe17b47ddd6f782ef4356807870645b6c024e /pkgs/build-support
parent9adc6fe2766669330c5287a276e93c4777fed902 (diff)
downloadnixlib-e611215f5c1b7ca19785ec462e696dff103847b0.tar
nixlib-e611215f5c1b7ca19785ec462e696dff103847b0.tar.gz
nixlib-e611215f5c1b7ca19785ec462e696dff103847b0.tar.bz2
nixlib-e611215f5c1b7ca19785ec462e696dff103847b0.tar.lz
nixlib-e611215f5c1b7ca19785ec462e696dff103847b0.tar.xz
nixlib-e611215f5c1b7ca19785ec462e696dff103847b0.tar.zst
nixlib-e611215f5c1b7ca19785ec462e696dff103847b0.zip
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).
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/setup-hooks/find-xml-catalogs.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/pkgs/build-support/setup-hooks/find-xml-catalogs.sh b/pkgs/build-support/setup-hooks/find-xml-catalogs.sh
new file mode 100644
index 000000000000..b742d5a8ffd9
--- /dev/null
+++ b/pkgs/build-support/setup-hooks/find-xml-catalogs.sh
@@ -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