diff options
author | Lluís Batlle i Rossell <viric@viric.name> | 2013-03-18 15:05:53 +0100 |
---|---|---|
committer | Lluís Batlle i Rossell <viric@viric.name> | 2013-03-18 15:07:20 +0100 |
commit | d711dcc070ac80074db96ab8cf744955489ec68a (patch) | |
tree | f8c2917c54e7dd68b08af7e3d7844b059d838637 /pkgs/tools/text/sgml | |
parent | 4ae71ad19d3931488464985d1073817770fbdfd0 (diff) |
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
Diffstat (limited to 'pkgs/tools/text/sgml')
-rw-r--r-- | pkgs/tools/text/sgml/opensp/compat.nix | 6 | ||||
-rw-r--r-- | pkgs/tools/text/sgml/opensp/default.nix | 2 | ||||
-rw-r--r-- | pkgs/tools/text/sgml/opensp/setup-hook.sh | 22 |
3 files changed, 29 insertions, 1 deletions
diff --git a/pkgs/tools/text/sgml/opensp/compat.nix b/pkgs/tools/text/sgml/opensp/compat.nix index 8e521da20848..3e9d9152d36a 100644 --- a/pkgs/tools/text/sgml/opensp/compat.nix +++ b/pkgs/tools/text/sgml/opensp/compat.nix @@ -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"; } diff --git a/pkgs/tools/text/sgml/opensp/default.nix b/pkgs/tools/text/sgml/opensp/default.nix index 76efbd0b1af6..e30567000dd1 100644 --- a/pkgs/tools/text/sgml/opensp/default.nix +++ b/pkgs/tools/text/sgml/opensp/default.nix @@ -13,6 +13,8 @@ stdenv.mkDerivation { docsrc/*.xml ''; + setupHook = ./setup-hook.sh; + buildInputs = [ xmlto docbook_xml_dtd_412 libxslt docbook_xsl ]; meta = { diff --git a/pkgs/tools/text/sgml/opensp/setup-hook.sh b/pkgs/tools/text/sgml/opensp/setup-hook.sh new file mode 100644 index 000000000000..2c9142da1016 --- /dev/null +++ b/pkgs/tools/text/sgml/opensp/setup-hook.sh @@ -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 |