[gimp-help-2] [make] Enhance configuring
- From: Ulf-D. Ehlert <ulfehlert src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp-help-2] [make] Enhance configuring
- Date: Sun, 13 Dec 2009 20:12:26 +0000 (UTC)
commit fc3e9548bc1fd99db95414329d48c2b8251ba1ee
Author: Ulf-D. Ehlert <ulfehlert svn gnome org>
Date: Sun Dec 13 21:05:55 2009 +0100
[make] Enhance configuring
* Disable make functions for translating if configure doesn't find
xml2po or some of the gettext tools (msgfmt etc.).
* Disable useless "--enbable -build/--disable-build" configure options.
* Simplify configure output.
* Minor changes to authors commands
(e.g. prevent rebuilding of authors pofile).
Makefile.am | 101 +++++++++++++++++++++++++++++++----------------------
configure.ac | 110 +++++++++++++++++++++++++++++++++-------------------------
2 files changed, 122 insertions(+), 89 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 4c77227..1066bfc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -46,9 +46,9 @@ XMLLINTFLAGS = --nonet
## XML2PO = $(srcdir)/tools/xml2po
##
MSGWIDTH = 79
-## MSGUNIQ = msguniq
-MSGUNIQFLAGS =
-## MSGCAT = msgcat
+## MSGUNIQ = msguniq
+MSGUNIQFLAGS =
+## MSGCAT = msgcat
MSGCATFLAGS = --width=$(MSGWIDTH)
## MSGINIT = msginit
MSGINITFLAGS = --no-translator --width=$(MSGWIDTH)
@@ -88,10 +88,12 @@ po_file_predicates = -type f -not -name "$(COMPENDIUM)"
xml_file_predicates = -name '*.xml'
# list of authors and contributors (no DocBook)
-AUTHORS_SOURCE_XML = stylesheets/authors.xml
+AUTHORS_DATA_XML = stylesheets/authors.xml
# automatically generated authors section (DocBook)
-AUTHORS_DOCBOOK_XML = src/preface/authors.xml
-# Stylesheets generating AUTHORS
+AUTHORS_DOCBOOK_XML = src/preface/authors.xml
+AUTHORS_DOCBOOK_DIRNAME = $(dir $(AUTHORS_DOCBOOK_XML))
+AUTHORS_DOCBOOK_FILENAME = $(notdir $(AUTHORS_DOCBOOK_XML))
+# Stylesheets generating AUTHORS
AUTHORS_TEXT_STYLESHEETS = \
stylesheets/authors_text.xsl \
stylesheets/authors_common.xsl
@@ -103,13 +105,12 @@ AUTHORS_DOCBOOK_STYLESHEETS = \
# lists of source (XML) files and source directories
# HIDE FROM AUTOMAKE #ifeq ($(filter help clean,$(MAKECMDGOALS)),)
# HIDE FROM AUTOMAKE #SRC_DIRS := $(shell cd $(srcdir) && $(find_l) src/ $(src_dir_predicates))
-# HIDE FROM AUTOMAKE #SRC_FILES := $(shell cd $(srcdir) && $(find_l) src/ $(src_file_predicates)) \
-# HIDE FROM AUTOMAKE # $(AUTHORS_DOCBOOK_XML)
+# HIDE FROM AUTOMAKE #SRC_FILES := $(shell cd $(srcdir) && $(find_l) src/ $(src_file_predicates))
# HIDE FROM AUTOMAKE #else
# HIDE FROM AUTOMAKE #SRC_DIRS = $(shell cd $(srcdir) && $(find_l) src/ $(src_dir_predicates))
-# HIDE FROM AUTOMAKE #SRC_FILES = $(shell cd $(srcdir) && $(find_l) src/ $(src_file_predicates)) \
-# HIDE FROM AUTOMAKE # $(AUTHORS_DOCBOOK_XML)
+# HIDE FROM AUTOMAKE #SRC_FILES = $(shell cd $(srcdir) && $(find_l) src/ $(src_file_predicates))
# HIDE FROM AUTOMAKE #endif
+# HIDE FROM AUTOMAKE #SRC_FILES += $(AUTHORS_DOCBOOK_XML)
# TODO?: rename "plainhtml.xsl" to "html.xsl" and use ...
# ... HTML_STYLESHEETS = stylesheets/html*.xsl
@@ -157,7 +158,7 @@ EXTRA_DIST = \
$(COMMON_CSS_FILES) \
$(OTHER_CSS_FILES) \
$(SRC_FILES) \
- $(AUTHORS_SOURCE_XML) \
+ $(AUTHORS_DATA_XML) \
$(PO_FILES) \
$(XSL_FILES) \
$(DIST_TOOLS)
@@ -198,27 +199,9 @@ helpdir = $(gimpdatadir)/help
########################################################################
-#### Make AUTHORS file ####
+#### Functions ####
########################################################################
-AUTHORS: $(AUTHORS_SOURCE_XML) $(AUTHORS_TEXT_STYLESHEETS)
- $(msg) "[DOC] $@"
- $(cmd) $(XSLTPROC) \
- $(XSLTFLAGS) $(XSLTEXTRAFLAGS) \
- $(srcdir)/stylesheets/authors_text.xsl \
- $< \
- > $@
-
-$(AUTHORS_DOCBOOK_XML): $(AUTHORS_SOURCE_XML) $(AUTHORS_DOCBOOK_STYLESHEETS)
- $(msg) "[SRC] $@"
- $(cmd) $(call make_target_dir,$@)
- $(cmd) $(XSLTPROC) \
- $(XSLTFLAGS) $(XSLTEXTRAFLAGS) \
- $(srcdir)/stylesheets/authors_docbook.xsl \
- $< \
- > $@
-
-
#--------------------------------------------------------------#
# The main functions used to transform #
# (a) XML files to POT files #
@@ -226,6 +209,7 @@ $(AUTHORS_DOCBOOK_XML): $(AUTHORS_SOURCE_XML) $(AUTHORS_DOCBOOK_STYLESHEETS)
# (c) XML and PO files to XML files #
#--------------------------------------------------------------#
+if HAVE_I18N_TOOLS
# Create a PO-template (POT)
#
# Usage:
@@ -241,7 +225,7 @@ xml2pot = ($(XML2PO) --output='-' $(1) \
| $(MSGCAT) $(MSGCATFLAGS) - > "$(2)") 2>&1 \
| $(SED) -e '/image file .* not found/d'; \
test -s "$(2)" || rm -f "$(2)"; \
- touch -c -r `ls -t $(1) | head -n 1` "$(2)" || true; \
+ touch -c -r `ls -t $(1) | $(SED) 1q` "$(2)" || true; \
test -s "$(2)"
# Merge template (pot) and message catalog (po) or create a new catalog
@@ -289,6 +273,14 @@ po2xml = $(XML2PO) --po-file=$(2) --language=$(3) --output=$(4) $(1) 2>&1 \
| $(SED) -e '/Warning: image file .* not found./d'; \
rm -f .xml2po.mo
+else
+
+xml2pot = echo "Error: couldn't find xml2po or gettext tools"; exit 69
+pot2po = echo "Error: couldn't find xml2po or gettext tools"; exit 69
+po2xml = echo "Error: couldn't find xml2po or gettext tools"; exit 69
+
+endif
+
#--------------------------------------------------------------#
# Helper functions #
@@ -330,6 +322,29 @@ copy = $(LN_S) $(abs_srcdir)/$(1) $(2)
########################################################################
+#### Make AUTHORS file ####
+########################################################################
+
+AUTHORS: $(AUTHORS_DATA_XML) $(AUTHORS_TEXT_STYLESHEETS)
+ $(msg) "[DOC] $@"
+ $(cmd) $(XSLTPROC) \
+ $(XSLTFLAGS) $(XSLTEXTRAFLAGS) \
+ $(srcdir)/stylesheets/authors_text.xsl \
+ $< \
+ > $@
+
+$(AUTHORS_DOCBOOK_XML): $(AUTHORS_DATA_XML) $(AUTHORS_DOCBOOK_STYLESHEETS)
+ $(msg) "[SRC] $@"
+ $(cmd) $(call make_target_dir,$@)
+ $(cmd) $(XSLTPROC) \
+ $(XSLTFLAGS) $(XSLTEXTRAFLAGS) \
+ $(srcdir)/stylesheets/authors_docbook.xsl \
+ $< \
+ > $@
+ $(cmd) touch -c -r $< $@ || true
+
+
+########################################################################
#### Make pot files: XML(en) --> POT ####
########################################################################
#
@@ -337,29 +352,31 @@ copy = $(LN_S) $(abs_srcdir)/$(1) $(2)
POT_FILES = $(patsubst src/%,pot/%.pot,$(filter-out src src/,$(SRC_DIRS)))
# Special case: src/*.xml --> pot/gimp.pot
POT_FILES += pot/gimp.pot
-#
-# Special case
-pot/gimp.pot: $(srcdir)/src/*.xml
+
+# General case
+pot/%.pot: $(srcdir)/src/%/*.xml
$(cmd) $(call make_target_dir,$@)
$(msg) "[POT] $@"
$(cmd) $(call xml2pot,$^,$@)
-# Special case: pot file for the authors DocBook file
-# (src/preface/authors.xml, but this may change...)
-# TODO: is there a better way?
-AUTHORS_POT = $(AUTHORS_DOCBOOK_XML:src/%/$(notdir $(AUTHORS_DOCBOOK_XML))=pot/%.pot)
-$(AUTHORS_POT): $(AUTHORS_DOCBOOK_XML) $(wildcard $(dir $(AUTHORS_DOCBOOK_XML))*.xml)
+# Special case: rename pot file for toplevel xml files
+pot/gimp.pot: $(srcdir)/src/*.xml
$(cmd) $(call make_target_dir,$@)
$(msg) "[POT] $@"
$(cmd) $(call xml2pot,$^,$@)
-pot/%.pot: $(srcdir)/src/%/*.xml
+# Special case: pot file for the authors DocBook file
+# requires an additional prerequisite
+AUTHORS_POT = $(AUTHORS_DOCBOOK_XML:src/%/$(AUTHORS_DOCBOOK_FILENAME)=pot/%.pot)
+$(AUTHORS_POT): $(AUTHORS_DOCBOOK_XML) $(wildcard $(AUTHORS_DOCBOOK_DIRNAME)/*.xml)
$(cmd) $(call make_target_dir,$@)
$(msg) "[POT] $@"
$(cmd) $(call xml2pot,$^,$@)
+ $(cmd) touch -c -r `ls -t $^ | $(SED) 1q` $@ || true
# Targets suitable for command line
# ("make pot" will work even if pot exists)
pot: potfiles cleanup-pot ;
potfiles: $(POT_FILES) ;
+
cleanup-pot:
$(msg) "Cleaning up pot files ..."
$(cmd) $(find_l) pot/ $(pot_file_predicates) | \
@@ -619,7 +636,7 @@ html-images-%: html/%/images ;
if CYGWIN
# Cygwin
html/%/images: FORCE
- $(cmd) test -h $@ && rm -f $@
+ $(cmd) if test -h $@; then rm -f $@; fi
$(cmd) test -d $@ && rm -rf $@/* || $(MKDIR_P) $@
$(cmd) perl $(srcdir)/tools/make_image_links.pl -v \
--mode=hardlink,copy \
@@ -698,7 +715,7 @@ odf/%/gimp.odt: xml/%/gimp-alldocs.xml xml/%/images
--debug -v \
--output-dir=`pwd` \
--output-file=$@ \
- $<
+ $<
if HAVE_XMLLINT
# make temporary XML source file with all Xincludes resolved
diff --git a/configure.ac b/configure.ac
index 6fcdd7a..4a9bcbe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -55,14 +55,18 @@ AC_SUBST(ALL_LINGUAS)
AC_SUBST(QUICKREFERENCE_ALL_LINGUAS)
-# The build of the HTML files is optional.
+# It doesn't make sense to disable HTML build.
-AC_ARG_ENABLE(build,
- AS_HELP_STRING([--disable-build],
- [don't build the HTML files (needs xsltproc)]),
- , enable_build=yes)
+AC_ARG_ENABLE(build, AS_HELP_STRING([--disable-build], [obsolete]), , )
+#AM_CONDITIONAL(GIMP_HELP_BUILD, true)
-AM_CONDITIONAL(GIMP_HELP_BUILD, test "x$enable_build" = "xyes")
+#AC_ARG_ENABLE(i18n,
+# AS_HELP_STRING([--disable-i18n],
+# [don't build translated HTML files (with xml2po & gettext)]),
+# , enable_i18n=yes)
+#AM_CONDITIONAL(GIMP_HELP_I18N, test "$enable_i18n" = "yes")
+
+test "$ALL_LINGUAS" != "en" && enable_i18n=yes || enable_i18n=no
# Check for GNU make.
@@ -114,21 +118,11 @@ fi
AM_CONDITIONAL(HAVE_DBLATEX, test -n "$DBLATEX")
-# Optional: dot to create build system map
-
-AC_PATH_PROG(DOT, dot)
-if test -z "$DOT"; then
- AC_MSG_WARN([cannot find dot(1), creating build system PNG disabled])
-fi
-
-AM_CONDITIONAL(HAVE_DOT, test -n "$DOT")
-
-
# Search for docbook2odf
AC_PATH_PROG(DOCBOOK2ODF, docbook2odf)
if test -z "$DOCBOOK2ODF"; then
- AC_MSG_WARN([cannot find docbook2odf(1), ODF generation disabled])
+ AC_MSG_NOTICE([cannot find docbook2odf(1), ODF generation disabled])
fi
AM_CONDITIONAL(HAVE_DOCBOOK2ODF, test -n "$DOCBOOK2ODF")
@@ -138,8 +132,8 @@ AM_CONDITIONAL(HAVE_DOCBOOK2ODF, test -n "$DOCBOOK2ODF")
AC_PATH_PROG(XML2PO, xml2po)
if test -z "$XML2PO"; then
- AC_MSG_WARN([cannot find xml2po(1), SVG generation disabled
-(this tool is part of the gnome-doc-utils package)])
+ AC_MSG_WARN([cannot find xml2po])
+ missing_i18n_tools="xml2po"
fi
AM_CONDITIONAL(HAVE_XML2PO, test -n "$XML2PO")
@@ -148,10 +142,10 @@ AM_CONDITIONAL(HAVE_XML2PO, test -n "$XML2PO")
# Search for gettext tools
AC_PATH_PROG(MSGFMT, msgfmt)
-if test -z "$MSGFMT" && test "x$enable_build" = "xyes"; then
- AC_MSG_ERROR([
-** Couldn't find msgfmt(1). You will need it to build the help files.
-** See the file 'INSTALL' for more help.])
+if test -z "$MSGFMT" && test "x$enable_i18n" = "xyes"; then
+ # print warning only for the main i18n toos xml2po & msgfmt
+ AC_MSG_WARN([cannot find msgfmt])
+ missing_i18n_tools=${missing_i18n_tools:+"${missing_i18n_tools} "}msgfmt
fi
MSGFMTFLAGS="--check --use-fuzzy --statistics"
@@ -159,36 +153,47 @@ AC_SUBST(MSGFMTFLAGS)
AC_PATH_PROG(MSGINIT, msginit)
-if test -z "$MSGINIT" && test "x$enable_build" = "xyes"; then
- AC_MSG_ERROR([
-** Couldn't find msginit(1). You will need it to build the help files.
-** See the file 'INSTALL' for more help.])
+if test -z "$MSGINIT" && test "x$enable_i18n" = "xyes"; then
+ missing_i18n_tools=${missing_i18n_tools:+"${missing_i18n_tools} "}msginit
fi
AC_PATH_PROG(MSGMERGE, msgmerge)
-if test -z "$MSGMERGE" && test "x$enable_build" = "xyes"; then
- AC_MSG_ERROR([
-** Couldn't find msgmerge(1). You will need it to build the help files.
-** See the file 'INSTALL' for more help.])
+if test -z "$MSGMERGE" && test "x$enable_i18n" = "xyes"; then
+ missing_i18n_tools=${missing_i18n_tools:+"${missing_i18n_tools} "}msgmerge
fi
AC_PATH_PROG(MSGUNIQ, msguniq)
-if test -z "$MSGUNIQ" && test "x$enable_build" = "xyes"; then
- AC_MSG_ERROR([
-** Couldn't find msguniq(1). You will need it to build the help files.
-** See the file 'INSTALL' for more help.])
+if test -z "$MSGUNIQ" && test "x$enable_i18n" = "xyes"; then
+ missing_i18n_tools=${missing_i18n_tools:+"${missing_i18n_tools} "}msguniq
fi
AC_PATH_PROG(MSGCAT, msgcat)
-if test -z "$MSGCAT" && test "x$enable_build" = "xyes"; then
- AC_MSG_ERROR([
-** Couldn't find msgcat(1). You will need it to build the help files.
-** See the file 'INSTALL' for more help.])
+if test -z "$MSGCAT" && test "x$enable_i18n" = "xyes"; then
+ missing_i18n_tools=${missing_i18n_tools:+"${missing_i18n_tools} "}msgcat
fi
+# Optional: dot to create build system map
+
+AC_PATH_PROG(DOT, dot)
+#if test -z "$DOT"; then
+# AC_MSG_NOTICE([cannot find dot(1), creating build system PNG disabled])
+#fi
+
+AM_CONDITIONAL(HAVE_DOT, test -n "$DOT")
+
+
+#test -z "$missing_i18n_tools" && HAVE_I18N_TOOLS=yes || HAVE_I18N_TOOLS=no
+#AC_SUBST(HAVE_I18N_TOOLS)
+AM_CONDITIONAL(HAVE_I18N_TOOLS, test -z "$missing_i18n_tools")
+
+test -z "$missing_i18n_tools" || test "$missing_i18n_tools" = "xml2po" &&
+HAVE_GETTEXT_TOOLS=yes || HAVE_GETTEXT_TOOLS=no
+AM_CONDITIONAL(HAVE_GETTEXT_TOOLS, test "$HAVE_GETTEXT_TOOLS" = "yes")
+#AC_SUBST(HAVE_GETTEXT_TOOLS)
+
# Optionally allow xsltproc to access DTDs over the network
@@ -207,16 +212,16 @@ AC_SUBST(XSLTFLAGS)
AC_PATH_PROG(PNGNQ, pngnq)
if test -z "$PNGNQ"; then
- AC_MSG_WARN([cannot find pngnq(1),
-Images will not be optimized during distribution creation])
+ AC_MSG_WARN([cannot find pngnq,
+images will not be optimized during distribution creation])
fi
AC_PATH_PROG(PNGCRUSH, pngcrush)
if test -z "$PNGCRUSH"; then
- AC_MSG_WARN([cannot find pngcrush(1),
-Images will not be optimized during distribution creation])
+ AC_MSG_WARN([cannot find pngcrush,
+images will not be optimized during distribution creation])
fi
AM_CONDITIONAL(HAVE_PNGOPTIMIZERS, test -n "$PNGNQ" && test -n "$PNGCRUSH")
@@ -233,7 +238,9 @@ STYLEBASE='http://docbook.sourceforge.net/release/xsl/current'
AC_ARG_WITH(xsl,
AS_HELP_STRING([--with-xsl=<basedir>],
- [path to the base of the DocBook Modular Stylesheets]))
+ [path to the base of the DocBook Modular Stylesheets
+ (deprecated - fix your DocBook Stylesheets package!)
+ ]))
if test "x$with_xsl" != "x"; then
STYLEBASE="$with_xsl"
@@ -267,6 +274,14 @@ fi
AC_SUBST(gimpdatadir)
+if test -n "$missing_i18n_tools" && test "$enable_i18n" = "yes"; then
+ AC_MSG_WARN([
+** Couldn't find some tools needed to build translated help files.
+** You will be able to build the English manual, but no translations.])
+ ALL_LINGUAS=en
+fi
+
+
AC_CONFIG_FILES([
Makefile
quickreference/Makefile
@@ -278,7 +293,8 @@ stylesheets/htmlalternate.xsl
AC_OUTPUT
AC_MSG_RESULT([
- Rebuild the help files: $enable_build
Languages: $ALL_LINGUAS
- Installation prefix: $gimpdatadir
-])
+ Installation prefix: $gimpdatadir ])
+if test -n "$missing_i18n_tools" && test "$enable_i18n" = "yes"; then
+ AC_MSG_RESULT([ Missing translation tools: $missing_i18n_tools ])
+fi
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]