gnucash-docs master: Build chm docs in Mingw.

John Ralls jralls at code.gnucash.org
Fri Sep 15 17:54:09 EDT 2017


Updated	 via  https://github.com/Gnucash/gnucash-docs/commit/d649fb74 (commit)
	from  https://github.com/Gnucash/gnucash-docs/commit/430feccc (commit)



commit d649fb745afe969bc8dd8db0555ad5e80146ae01
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Sep 15 14:53:52 2017 -0700

    Build chm docs in Mingw.

diff --git a/Makefile.am b/Makefile.am
index 3d3445d..c11aea7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,6 +6,7 @@ EXTRA_DIST = gnucash-docs.spec \
 	     xmldocs.make \
 	     omf.make \
 	     pdf.make \
+             chm.make \
 	     stylesheet \
 	     xsl \
 	     HACKING \
@@ -55,4 +56,3 @@ epub-recursive $(MOBI_RECURSIVE):
 	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
 	  || eval $$failcom; \
 	done; test -z "$$fail"
-
diff --git a/chm.make b/chm.make
new file mode 100644
index 0000000..75d2beb
--- /dev/null
+++ b/chm.make
@@ -0,0 +1,47 @@
+# Create CHM help files for Win32
+# Copyright 2017 John Ralls <jralls at ceridwen.us>
+# Procedure lifted from make_chm() in gnucash-on-windows.git:install-impl.sh,
+# originally written by Andreas Köhler.
+
+chmfile=$(docname).chm
+mapfile=$(docname).hhmap
+
+htmlhelp_xsl="http://docbook.sourceforge.net/release/xsl/current/htmlhelp/htmlhelp.xsl"
+
+$(chmfile): $(entities) $(figfiles)
+$(mapfile): $(chmfile)
+	mv htmlhelp.hhmap $(mapfile)
+
+chm-local: $(chmfile) $(mapfile)
+
+install-chm-local: $(chmfile) $(mapfile)
+	$(mkinstalldirs) $(DESTDIR)$(docdir)/$(lang)
+	$(INSTALL_DATA) $(chmfile) $(DESTDIR)$(docdir)/$(lang)
+	$(INSTALL_DATA) $(mapfile) $(DESTDIR)$(docdir)/$(lang)
+
+.xml.chm:
+	${XSLTPROC} ${htmlhelp_xsl} ${srcdir}/$(docname).xml
+	count=0
+	echo >> htmlhelp.hhp
+	echo "[ALIAS]" >> htmlhelp.hhp
+	echo "IDH_0=index.html" >> htmlhelp.hhp
+	echo "#define IDH_0 0" > mymaps
+	echo "[Map]" > htmlhelp.hhmap
+	echo "Searching for anchors ..."
+	for id in `cat ${srcdir}/*.xml | sed '/sect.*id=/!d;s,.*id=["'\'']\([^"'\'']*\)["'\''].*,\1,'` ; do \
+		files=`grep -l "[\"']${id}[\"']" *.html` || continue; \
+		echo "IDH_$((++count))=${files}#${id}" >> htmlhelp.hhp; \
+		echo "#define IDH_${count} ${count}" >> mymaps; \
+		echo "${id}=${count}" >> htmlhelp.hhmap; \
+	done
+	echo >> htmlhelp.hhp
+	echo "[MAP]" >> htmlhelp.hhp
+	cat mymaps >> htmlhelp.hhp
+	rm mymaps
+	"${HHC}" htmlhelp.hhp  >/dev/null  || true
+	mv htmlhelp.chm $(chmfile)
+
+CLEANFILES += $(chmfile) $(mapfile) htmlhelp.hhp
+# Don't try to make dist from windows, this is here only to silence an
+# error from the Italian translations.
+EXTRA_DIST = $(entities) $(docname).xml
diff --git a/configure.ac b/configure.ac
index 196d13e..feb1f28 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,6 +3,7 @@
 
 dnl Process this file with autoconf to produce a configure script.
 AC_INIT([gnucash-docs], [2.6.99], [https://bugzilla.gnome.org/page.cgi?id=browse.html&product=GnuCash], , [http://www.gnucash.org/])
+AC_CANONICAL_HOST
 
 dnl ==========================================================================
 dnl
@@ -189,6 +190,20 @@ case $LANG in
         lang_us=false ;;
 esac
 
+ac_cv_gnc_windows="no"
+case $host_os in
+  mingw*)
+  ac_cv_gnc_windows="yes"
+  AC_PATH_PROG([HHC], hhc.exe, [hhc_not_found], [/c/Program Files (x86)/Html Help Workshop:/c/Program Files/Html Help Workshop])
+  if test ! -x "${HHC}"; then
+     AC_MSG_ERROR([Html Help Workshop Not Found])
+  fi
+  AM_EXTRA_RECURSIVE_TARGETS([chm install-chm])
+  ;;
+  *)
+  ;;
+esac
+AM_CONDITIONAL([GNC_WINDOWS], [test x${ac_cv_gnc_windows} = "xyes"])
 AM_CONDITIONAL([LANG_US], [test x${lang_us} = "xtrue"])
 AC_CONFIG_FILES([
 gnucash-docs.spec
diff --git a/guide/C/Makefile.am b/guide/C/Makefile.am
index ccc5196..2770cfd 100644
--- a/guide/C/Makefile.am
+++ b/guide/C/Makefile.am
@@ -36,9 +36,13 @@ entities = \
 	appendixd.xml
 DISTCLEANFILES =  $(docname)-C.omf.out
 CLEANFILES =  $(DISTCLEANFILES)
+if GNC_WINDOWS
+include $(top_srcdir)/chm.make
+else
 include $(top_srcdir)/xmldocs.make
 include $(top_srcdir)/pdf.make
 include $(top_srcdir)/epub.make
 if WITH_MOBI
 include $(top_srcdir)/mobi.make
 endif
+endif
diff --git a/guide/de/Makefile.am b/guide/de/Makefile.am
index 20a8376..799231b 100644
--- a/guide/de/Makefile.am
+++ b/guide/de/Makefile.am
@@ -34,9 +34,13 @@ entities = \
 DISTCLEANFILES =  $(docname)-de.omf.out
 CLEANFILES =  $(DISTCLEANFILES)
 XSLTFLAGS_FO= --stringparam paper.type A4
+if GNC_WINDOWS
+include $(top_srcdir)/chm.make
+else
 include $(top_srcdir)/xmldocs.make
 include $(top_srcdir)/pdf.make
 include $(top_srcdir)/epub.make
 if WITH_MOBI
 include $(top_srcdir)/mobi.make
 endif
+endif
diff --git a/guide/it/Makefile.am b/guide/it/Makefile.am
index 5c5f816..e2508e2 100644
--- a/guide/it/Makefile.am
+++ b/guide/it/Makefile.am
@@ -5,12 +5,16 @@ omffile = $(docname)-it.omf
 DISTCLEANFILES =  $(docname)-it.omf.out
 CLEANFILES =  $(DISTCLEANFILES)
 XSLTFLAGS_FO= --stringparam paper.type A4
+if GNC_WINDOWS
+include $(top_srcdir)/chm.make
+else
 include $(top_srcdir)/xmldocs.make
 include $(top_srcdir)/pdf.make
 include $(top_srcdir)/epub.make
 if WITH_MOBI
 include $(top_srcdir)/mobi.make
 endif
+endif
 
 COMPONENTS = \
 	${top_srcdir}/guide/C/gnucash-guide.xml \
diff --git a/guide/ja/Makefile.am b/guide/ja/Makefile.am
index 69c3cd3..ef7101b 100644
--- a/guide/ja/Makefile.am
+++ b/guide/ja/Makefile.am
@@ -31,12 +31,16 @@ DISTCLEANFILES =  $(docname)-ja.omf.out mincho.xml gothic.xml $(fopconfig)
 CLEANFILES =  $(DISTCLEANFILES)
 FOPFLAGS = -l $(lang) -c $(fopconfig)
 XSLTFLAGS_FO= --stringparam paper.type A4
+if GNC_WINDOWS
+include $(top_srcdir)/chm.make
+else
 include $(top_srcdir)/xmldocs.make
 include $(top_srcdir)/pdf.make
 include $(top_srcdir)/epub.make
 if WITH_MOBI
 include $(top_srcdir)/mobi.make
 endif
+endif
 
 mincho.xml: $(JAPANESE_MINCHO_TTF_ABS)
 	$(FOP_TTFREADER) $< $@
diff --git a/guide/pt/Makefile.am b/guide/pt/Makefile.am
index ebb5692..2ac960d 100644
--- a/guide/pt/Makefile.am
+++ b/guide/pt/Makefile.am
@@ -37,9 +37,13 @@ entities = \
 	appendixd.xml
 DISTCLEANFILES =  $(docname)-C.omf.out
 CLEANFILES =  $(DISTCLEANFILES)
+if GNC_WINDOWS
+include $(top_srcdir)/chm.make
+else
 include $(top_srcdir)/xmldocs.make
 include $(top_srcdir)/pdf.make
 include $(top_srcdir)/epub.make
 if WITH_MOBI
 include $(top_srcdir)/mobi.make
 endif
+endif
diff --git a/guide/ru/Makefile.am b/guide/ru/Makefile.am
index 05e3535..130a21f 100644
--- a/guide/ru/Makefile.am
+++ b/guide/ru/Makefile.am
@@ -31,9 +31,13 @@ entities = \
 DISTCLEANFILES = $(docname)-ru.omf.out
 CLEANFILES = $(DISTCLEANFILES)
 XSLTFLAGS_FO = --stringparam paper.type A4
+if GNC_WINDOWS
+include $(top_srcdir)/chm.make
+else
 include $(top_srcdir)/xmldocs.make
 include $(top_srcdir)/pdf.make
 include $(top_srcdir)/epub.make
 if WITH_MOBI
 include $(top_srcdir)/mobi.make
 endif
+endif
diff --git a/help/C/Makefile.am b/help/C/Makefile.am
index 2ac8626..d6718f7 100644
--- a/help/C/Makefile.am
+++ b/help/C/Makefile.am
@@ -27,9 +27,13 @@ entities = \
         Help_tips-appendix.xml
 DISTCLEANFILES =  $(docname)-C.omf.out
 CLEANFILES =  $(DISTCLEANFILES)
+if GNC_WINDOWS
+include $(top_srcdir)/chm.make
+else
 include $(top_srcdir)/xmldocs.make
 include $(top_srcdir)/pdf.make
 include $(top_srcdir)/epub.make
 if WITH_MOBI
 include $(top_srcdir)/mobi.make
 endif
+endif
diff --git a/help/de/Makefile.am b/help/de/Makefile.am
index 405905b..f18550b 100644
--- a/help/de/Makefile.am
+++ b/help/de/Makefile.am
@@ -14,9 +14,13 @@ entities = \
 DISTCLEANFILES =  $(docname)-de.omf.out
 CLEANFILES =  $(DISTCLEANFILES)
 XSLTFLAGS_FO= --stringparam paper.type A4
+if GNC_WINDOWS
+include $(top_srcdir)/chm.make
+else
 include $(top_srcdir)/xmldocs.make
 include $(top_srcdir)/pdf.make
 include $(top_srcdir)/epub.make
 if WITH_MOBI
 include $(top_srcdir)/mobi.make
 endif
+endif
diff --git a/help/it/Makefile.am b/help/it/Makefile.am
index 59c543f..ff6ba4a 100644
--- a/help/it/Makefile.am
+++ b/help/it/Makefile.am
@@ -5,12 +5,16 @@ omffile = $(docname)-it.omf
 DISTCLEANFILES =  $(docname)-it.omf.out
 CLEANFILES =  $(DISTCLEANFILES)
 XSLTFLAGS_FO= --stringparam paper.type A4
+if GNC_WINDOWS
+include $(top_srcdir)/chm.make
+else
 include $(top_srcdir)/xmldocs.make
 include $(top_srcdir)/pdf.make
 include $(top_srcdir)/epub.make
 if WITH_MOBI
 include $(top_srcdir)/mobi.make
 endif
+endif
 
 COMPONENTS = \
 	${top_srcdir}/help/C/gnucash-help.xml \
diff --git a/help/pt/Makefile.am b/help/pt/Makefile.am
index c4a4e7c..d46a1d9 100644
--- a/help/pt/Makefile.am
+++ b/help/pt/Makefile.am
@@ -22,9 +22,13 @@ entities = \
 DISTCLEANFILES =  $(docname)-pt.omf.out
 CLEANFILES =  $(DISTCLEANFILES)
 XSLTFLAGS_FO= --stringparam paper.type A4
+if GNC_WINDOWS
+include $(top_srcdir)/chm.make
+else
 include $(top_srcdir)/xmldocs.make
 include $(top_srcdir)/pdf.make
 include $(top_srcdir)/epub.make
 if WITH_MOBI
 include $(top_srcdir)/mobi.make
 endif
+endif



Summary of changes:
 Makefile.am          |  2 +-
 chm.make             | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 configure.ac         | 15 +++++++++++++++
 guide/C/Makefile.am  |  4 ++++
 guide/de/Makefile.am |  4 ++++
 guide/it/Makefile.am |  4 ++++
 guide/ja/Makefile.am |  4 ++++
 guide/pt/Makefile.am |  4 ++++
 guide/ru/Makefile.am |  4 ++++
 help/C/Makefile.am   |  4 ++++
 help/de/Makefile.am  |  4 ++++
 help/it/Makefile.am  |  4 ++++
 help/pt/Makefile.am  |  4 ++++
 13 files changed, 103 insertions(+), 1 deletion(-)
 create mode 100644 chm.make



More information about the gnucash-changes mailing list