[yelp-tools] Added HELP_MEDIA_NODUP and YELP_INIT_HELP



commit 2e63c1ae0f1bad71c6d7b9bf328f919e6372e719
Author: Shaun McCance <shaunm gnome org>
Date:   Mon Nov 18 09:57:49 2013 -0500

    Added HELP_MEDIA_NODUP and YELP_INIT_HELP
    
    HELP_MEDIA normally craetes symlinks for localized copies that don't
    exist, but for images this isn't actually necessary. Yelp can load
    according to the document path. Don't want to break API on HELP_MEDIA
    because people use it for a few other things. Hence, HELP_MEDIA_NODUP
    which works just like HELP_MEDIA, except no symlinks on install.
    
    Also, if you use HELP_MEDIA_NODUP and somebody builds with an older
    yelp.m4, the files are just silently ignored. Added YELP_INIT_HELP
    to replace YELP_HELP_INIT (though YELP_HELP_INIT is not currently
    deprecated), and YELP_INIT_HELP is stingy about checking minimum
    version.

 .gitignore                    |    1 +
 configure.ac                  |    6 ++++-
 tools/Makefile.am             |    2 +-
 tools/{yelp.m4 => yelp.m4.in} |   46 +++++++++++++++++++++++++++++++++++++++-
 4 files changed, 51 insertions(+), 4 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index ea4bd01..8a13d09 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,6 +17,7 @@ Makefile.in
 /intltool-update.in
 /missing
 
+/tools/yelp.m4
 /tools/yelp-build
 /tools/yelp-check
 /tools/yelp-new
diff --git a/configure.ac b/configure.ac
index 5ba8caf..924471c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([yelp-tools], [3.10.0],
+AC_INIT([yelp-tools], [3.11.1],
         [http://bugzilla.gnome.org/enter_bug.cgi?product=yelp-tools])
 AM_INIT_AUTOMAKE([1.9 no-dist-gzip dist-bzip2])
 
@@ -16,6 +16,9 @@ AC_SUBST(GDU_AWK)
 
 AC_PROG_LN_S
 
+YELP_STABLE_VERSION=$(echo $VERSION | $GDU_AWK '// { split($1, v, "."); print 100 * v[[1]] + (int((v[[2]] + 
1) / 2) * 2); }')
+AC_SUBST([YELP_STABLE_VERSION])
+
 AC_CHECK_PROG(XMLLINT, xmllint, xmllint)
 if test x"$XMLLINT" = x; then
   AC_MSG_ERROR([xmllint not found])
@@ -93,6 +96,7 @@ AC_CONFIG_FILES([
 Makefile
 templates/Makefile
 tools/Makefile
+tools/yelp.m4
 tools/yelp-build
 tools/yelp-check
 tools/yelp-new
diff --git a/tools/Makefile.am b/tools/Makefile.am
index fcbd6fc..1f98071 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -3,4 +3,4 @@ aclocal_DATA = yelp.m4
 
 bin_SCRIPTS = yelp-build yelp-check yelp-new
 
-EXTRA_DIST = yelp-build.in yelp-check.in yelp-new.in $(aclocal_DATA)
+EXTRA_DIST = yelp.m4.in yelp-build.in yelp-check.in yelp-new.in $(aclocal_DATA)
diff --git a/tools/yelp.m4 b/tools/yelp.m4.in
similarity index 80%
rename from tools/yelp.m4
rename to tools/yelp.m4.in
index 766c93b..b1d34cb 100644
--- a/tools/yelp.m4
+++ b/tools/yelp.m4.in
@@ -1,9 +1,24 @@
+AC_DEFUN([YELP_INIT_HELP],
+[
+if test "x[$1]" = "x"; then
+  AC_MSG_ERROR([Must pass a minimum version to [YELP_INIT_HELP]])
+fi
+if test $(echo [$1] | awk '// { split($1, v, "."); print 100 * v[[1]] + v[[2]] }') -gt 
@YELP_STABLE_VERSION@; then
+  AC_MSG_ERROR([requested yelp.m4 $1 but installed version is @VERSION ])
+fi
+YELP_MIN_VERSION=[$1]
+AC_SUBST([YELP_MIN_VERSION])
+YELP_HELP_INIT
+])
+
+dnl YELP_HELP_INIT is deprecated. Use YELP_INIT_HELP with a minimum version
 AC_DEFUN([YELP_HELP_INIT],
 [
 AC_REQUIRE([AC_PROG_LN_S])
 m4_pattern_allow([AM_V_at])
 m4_pattern_allow([AM_V_GEN])
 m4_pattern_allow([AM_DEFAULT_VERBOSITY])
+
 AC_ARG_WITH([help-dir],
             AC_HELP_STRING([--with-help-dir=DIR],
                            [path where help files are installed]),,
@@ -29,6 +44,7 @@ HELP_POT ?=
 HELP_FILES ?=
 HELP_EXTRA ?=
 HELP_MEDIA ?=
+HELP_MEDIA_NODUP ?=
 HELP_LINGUAS ?=
 
 _HELP_LINGUAS = $(if $(filter environment,$(origin LINGUAS)),$(filter 
$(LINGUAS),$(HELP_LINGUAS)),$(HELP_LINGUAS))
@@ -37,7 +53,7 @@ _HELP_POFILES = $(if $(HELP_ID),$(foreach lc,$(_HELP_LINGUAS),$(lc)/$(lc).po))
 _HELP_MOFILES = $(patsubst %.po,%.mo,$(_HELP_POFILES))
 _HELP_C_FILES = $(foreach f,$(HELP_FILES),C/$(f))
 _HELP_C_EXTRA = $(foreach f,$(HELP_EXTRA),C/$(f))
-_HELP_C_MEDIA = $(foreach f,$(HELP_MEDIA),C/$(f))
+_HELP_C_MEDIA = $(foreach f,$(HELP_MEDIA),C/$(f)) $(foreach f,$(HELP_MEDIA_NODUP),C/$(f))
 _HELP_LC_FILES = $(foreach lc,$(_HELP_LINGUAS),$(foreach f,$(HELP_FILES),$(lc)/$(f)))
 _HELP_LC_STAMPS = $(foreach lc,$(_HELP_LINGUAS),$(lc)/$(lc).stamp)
 
@@ -49,6 +65,18 @@ _HELP_LC_VERBOSE_0 = @echo "  GEN    "$(dir [$]@);
 
 all: $(_HELP_C_FILES) $(_HELP_C_EXTRA) $(_HELP_C_MEDIA) $(_HELP_LC_FILES) $(_HELP_POFILES)
 
+.PHONY: _yelp_check_version
+all: _yelp_check_version
+_yelp_check_version:
+       @if test "x$(HELP_MEDIA_NODUP)" != "x"; then \
+         if test "x$(YELP_MIN_VERSION)" = "x" -o \
+             $$(echo "$(YELP_MIN_VERSION)" | awk '"'"'// { split($$''1, v, "."); print 100 * v[[1]] + v[[2]] 
}'"'"') \
+               -lt 312; then \
+           echo "Must use [YELP_INIT_HELP] with version >= 3.12 to use HELP_MEDIA_NODUP" 1>&2; \
+           exit 1; \
+         fi; \
+       fi;
+
 .PHONY: pot
 pot: $(_HELP_POTFILE)
 $(_HELP_POTFILE): $(_HELP_C_FILES) $(_HELP_C_EXTRA) $(_HELP_C_MEDIA)
@@ -101,6 +129,7 @@ EXTRA_DIST += $(_HELP_C_EXTRA) $(_HELP_C_MEDIA)
 EXTRA_DIST += $(foreach lc,$(HELP_LINGUAS),$(lc)/$(lc).stamp)
 EXTRA_DIST += $(foreach lc,$(HELP_LINGUAS),$(lc)/$(lc).po)
 EXTRA_DIST += $(foreach f,$(HELP_MEDIA),$(foreach lc,$(HELP_LINGUAS),$(wildcard $(lc)/$(f))))
+EXTRA_DIST += $(foreach f,$(HELP_MEDIA_NODUP),$(foreach lc,$(HELP_LINGUAS),$(wildcard $(lc)/$(f))))
 
 distdir: distdir-help-files
 distdir-help-files:
@@ -167,6 +196,19 @@ install-help:
            fi; \
          done; \
        done
+       @for f in $(HELP_MEDIA_NODUP); do \
+         for lc in C $(_HELP_LINGUAS); do \
+           if test -f "$$lc$$f"; then d=; else d="$(srcdir)/"; fi; \
+           helpdir="$(DESTDIR)$(HELP_DIR)/$$lc/$(HELP_ID)/"; \
+           mdir=`dirname "$$f"`; \
+           if test "x$mdir" = "x."; then mdir=""; fi; \
+           if ! test -d "$$helpdir$$mdir"; then $(mkinstalldirs) "$$helpdir$$mdir"; fi; \
+           if test -f "$$d$$lc/$$f"; then \
+             echo "$(INSTALL_DATA) $$d$$lc/$$f $$helpdir$$f"; \
+             $(INSTALL_DATA) "$$d$$lc/$$f" "$$helpdir$$f" || exit 1; \
+           fi; \
+         done; \
+       done
 
 .PHONY: uninstall-help
 uninstall-am: $(if $(HELP_ID),uninstall-help)
@@ -182,7 +224,7 @@ uninstall-help:
          echo "rm -f $$helpdir`basename $$f`"; \
          rm -f "$$helpdir`basename $$f`"; \
        done
-       @for f in $(HELP_MEDIA); do \
+       @for f in $(HELP_MEDIA) $(HELP_MEDIA_NODUP); do \
          for lc in C $(_HELP_LINGUAS); do \
            helpdir="$(DESTDIR)$(HELP_DIR)/$$lc/$(HELP_ID)/"; \
            echo "rm -f $$helpdir$$f"; \


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]