Adding setup-hook for opensp, to set the sgml catalog files

This sets the SGML_CATALOG_FILES, similar to how libxml2 does the same with
XML_CATALOG_FILES.

I based the hook on the libxml2 one, and I followed the instructions about this
variable here:
http://docbook.sourceforge.net/release/dsssl/1.79/doc/install.html
This commit is contained in:
Lluís Batlle i Rossell 2013-03-18 15:05:53 +01:00
parent 4ae71ad19d
commit d711dcc070
3 changed files with 29 additions and 1 deletions

View File

@ -3,13 +3,17 @@
stdenv.mkDerivation {
name = "sp-compat-${builtins.substring 7 100 opensp.name}";
buildCommand = ''
phases = [ "fixupPhase" "installPhase" ];
installPhase = ''
mkdir -pv $out/bin
for i in ${opensp}/bin/o*; do
ln -sv $i $out/bin/''${i#${opensp}/bin/o}
done
'';
setupHook = opensp.setupHook;
meta.description =
"Compatibility wrapper for old programs looking for original sp programs";
}

View File

@ -13,6 +13,8 @@ stdenv.mkDerivation {
docsrc/*.xml
'';
setupHook = ./setup-hook.sh;
buildInputs = [ xmlto docbook_xml_dtd_412 libxslt docbook_xsl ];
meta = {

View File

@ -0,0 +1,22 @@
addSGMLCatalogs () {
if test -d $1/sgml/dtd; then
for i in $(find $1/sgml/dtd -name docbook.cat); do
export SGML_CATALOG_FILES="${SGML_CATALOG_FILES:+:}$i"
done
fi
}
if test -z "$sgmlHookDone"; then
sgmlHookDone=1
# Set http_proxy and ftp_proxy to a invalid host to prevent
# xmllint and xsltproc from trying to download DTDs from the
# network even when --nonet is not given. That would be impure.
# (Note that .invalid is a reserved domain guaranteed not to
# work.)
export http_proxy=http://nodtd.invalid/
export ftp_proxy=http://nodtd.invalid/
export SGML_CATALOG_FILES
envHooks=(${envHooks[@]} addSGMLCatalogs)
fi