aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--Makefile.config.in7
-rw-r--r--configure.ac6
-rw-r--r--doc/manual/local.mk79
-rw-r--r--misc/emacs/local.mk1
5 files changed, 90 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index b7ffc1b03..f22a70a81 100644
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,9 @@ SUBS = \
perl/local.mk \
scripts/local.mk \
corepkgs/local.mk \
- tests/local.mk \
+ misc/emacs/local.mk \
+ doc/manual/local.mk \
+ tests/local.mk
GLOBAL_CXXFLAGS = -I . -I src -I src/libutil -I src/libstore -I src/libmain -I src/libexpr
diff --git a/Makefile.config.in b/Makefile.config.in
index 130da2625..f5f813b2c 100644
--- a/Makefile.config.in
+++ b/Makefile.config.in
@@ -12,10 +12,15 @@ bindir = @bindir@
bsddiff_compat_include = @bsddiff_compat_include@
datadir = @datadir@
datarootdir = @datarootdir@
+dblatex = @dblatex@
+docbookrng = @docbookrng@
+docbookxsl = @docbookxsl@
+docdir = @docdir@
exec_prefix = @exec_prefix@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
+mandir = @mandir@
perl = @perl@
perlbindings = @perlbindings@
perllibdir = @perllibdir@
@@ -23,3 +28,5 @@ pkglibdir = $(libdir)/$(PACKAGE_NAME)
prefix = @prefix@
storedir = @storedir@
sysconfdir = @sysconfdir@
+xmllint = @xmllint@
+xsltproc = @xsltproc@
diff --git a/configure.ac b/configure.ac
index aa57543e5..043aed5b3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -203,12 +203,6 @@ AC_ARG_WITH(docbook-xsl, AC_HELP_STRING([--with-docbook-xsl=PATH],
AC_SUBST(docbookxsl)
-AC_ARG_WITH(xml-flags, AC_HELP_STRING([--with-xml-flags=FLAGS],
- [extra flags to be passed to xmllint and xsltproc]),
- xmlflags=$withval, xmlflags=)
-AC_SUBST(xmlflags)
-
-
AC_ARG_WITH(store-dir, AC_HELP_STRING([--with-store-dir=PATH],
[path of the Nix store (defaults to /nix/store)]),
storedir=$withval, storedir='/nix/store')
diff --git a/doc/manual/local.mk b/doc/manual/local.mk
new file mode 100644
index 000000000..ae3a9df5c
--- /dev/null
+++ b/doc/manual/local.mk
@@ -0,0 +1,79 @@
+XSLTPROC = $(xsltproc) --nonet $(xmlflags) \
+ --param section.autolabel 1 \
+ --param section.label.includes.component.label 1 \
+ --param html.stylesheet \'style.css\' \
+ --param xref.with.number.and.title 1 \
+ --param toc.section.depth 3 \
+ --param admon.style \'\' \
+ --param callout.graphics.extension \'.gif\' \
+ --param contrib.inline.enabled 0
+
+MANUAL_SRCS := $(wildcard $(d)/*.xml)
+
+
+# Do XInclude processing / RelaxNG validation
+$(d)/manual.xmli: $(d)/manual.xml $(MANUAL_SRCS) $(d)/version.txt
+ $(trace-gen) $(xmllint) --nonet --xinclude $< -o $@.tmp
+ @mv $@.tmp $@
+
+$(d)/version.txt:
+ $(trace-gen) echo -n $(PACKAGE_VERSION) > $@
+
+# Note: RelaxNG validation requires xmllint >= 2.7.4.
+$(d)/manual.is-valid: $(d)/manual.xmli
+ $(trace-gen) $(XSLTPROC) --novalid --stringparam profile.condition manual \
+ $(docbookxsl)/profiling/profile.xsl $< 2> /dev/null | \
+ $(xmllint) --nonet --noout --relaxng $(docbookrng)/docbook.rng -
+ @touch $@
+
+clean_files += $(d)/manual.xmli $(d)/version.txt $(d)/manual.is-valid
+
+
+# Generate man pages.
+man-pages := $(foreach n, \
+ nix-env.1 nix-build.1 nix-shell.1 nix-store.1 nix-instantiate.1 \
+ nix-collect-garbage.1 nix-push.1 nix-pull.1 \
+ nix-prefetch-url.1 nix-channel.1 \
+ nix-install-package.1 nix-hash.1 nix-copy-closure.1 \
+ nix.conf.5 nix-daemon.8, \
+ $(d)/$(n))
+
+$(man-pages): $(d)/manual.xmli $(d)/manual.is-valid
+ $(trace-gen) $(XSLTPROC) --stringparam profile.condition manpage \
+ $(docbookxsl)/profiling/profile.xsl $< 2> /dev/null | \
+ (cd doc/manual && $(XSLTPROC) $(docbookxsl)/manpages/docbook.xsl -)
+
+clean_files += $(d)/*.1 $(d)/*.5 $(d)/*.8
+
+
+# Generate the HTML manual.
+$(d)/manual.html: $(d)/manual.xml $(MANUAL_SRCS) $(d)/manual.is-valid
+ $(trace-gen) $(XSLTPROC) --xinclude --stringparam profile.condition manual \
+ $(docbookxsl)/profiling/profile.xsl $< | \
+ $(XSLTPROC) --output $@ $(docbookxsl)/html/docbook.xsl -
+
+$(foreach file, $(d)/manual.html $(d)/style.css, $(eval $(call install-data-in, $(file), $(docdir)/manual)))
+
+$(foreach file, $(wildcard $(d)/figures/*.png), $(eval $(call install-data-in, $(file), $(docdir)/manual/figures)))
+
+$(foreach file, $(wildcard $(docbookxsl)/images/callouts/*.gif), $(eval $(call install-data-in, $(file), $(docdir)/manual/images/callouts)))
+
+$(eval $(call install-symlink, manual.html, $(docdir)/manual/index.html))
+
+all: $(d)/manual.html
+
+clean_files += $(d)/manual.html
+
+
+# Generate the PDF manual.
+$(d)/manual.pdf: $(d)/manual.xml $(MANUAL_SRCS) $(d)/manual.is-valid
+ $(trace-gen) if test "$(dblatex)" != ""; then \
+ cd doc/manual && $(XSLTPROC) --xinclude --stringparam profile.condition manual \
+ $(docbookxsl)/profiling/profile.xsl manual.xml | \
+ $(dblatex) -o manual.pdf $(dblatex_opts) -; \
+ else \
+ echo "Please install dblatex and rerun configure."; \
+ exit 1; \
+ fi
+
+clean_files += $(d)/manual.pdf
diff --git a/misc/emacs/local.mk b/misc/emacs/local.mk
new file mode 100644
index 000000000..8e06b881b
--- /dev/null
+++ b/misc/emacs/local.mk
@@ -0,0 +1 @@
+$(eval $(call install-data-in,$(d)/nix-mode.el,$(datadir)/emacs/site-lisp))