Code

Merge branch 'ab/i18n-scripts-basic'
authorJunio C Hamano <gitster@pobox.com>
Mon, 23 May 2011 16:58:45 +0000 (09:58 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 23 May 2011 16:58:45 +0000 (09:58 -0700)
* ab/i18n-scripts-basic:
  Makefile: add xgettext target for *.sh files
  git-sh-i18n.sh: add GIT_GETTEXT_POISON support
  git-sh-i18n.sh: add no-op gettext() and eval_gettext() wrappers
  git-sh-i18n--envsubst: our own envsubst(1) for eval_gettext()

1  2 
Makefile

diff --combined Makefile
index d09ee701885b4f977ae4399caa4be6133570e1be,10252d50afc2ba086e93aeb745a1831764519dbf..db72c45f31c7166a46702e973404bd8a73b0652b
+++ b/Makefile
@@@ -274,7 -274,8 +274,7 @@@ STRIP ?= stri
  #   mandir
  #   infodir
  #   htmldir
 -#   ETC_GITCONFIG (but not sysconfdir)
 -#   ETC_GITATTRIBUTES
 +#   sysconfdir
  # can be specified as a relative path some/where/else;
  # this is interpreted as relative to $(prefix) and "git" at
  # runtime figures out where they are based on the path to the executable.
@@@ -290,8 -291,15 +290,8 @@@ sharedir = $(prefix)/shar
  gitwebdir = $(sharedir)/gitweb
  template_dir = share/git-core/templates
  htmldir = share/doc/git-doc
 -ifeq ($(prefix),/usr)
 -sysconfdir = /etc
  ETC_GITCONFIG = $(sysconfdir)/gitconfig
  ETC_GITATTRIBUTES = $(sysconfdir)/gitattributes
 -else
 -sysconfdir = $(prefix)/etc
 -ETC_GITCONFIG = etc/gitconfig
 -ETC_GITATTRIBUTES = etc/gitattributes
 -endif
  lib = lib
  # DESTDIR=
  pathsep = :
@@@ -373,6 -381,7 +373,7 @@@ SCRIPT_LIB += git-rebase--a
  SCRIPT_LIB += git-rebase--interactive
  SCRIPT_LIB += git-rebase--merge
  SCRIPT_LIB += git-sh-setup
+ SCRIPT_LIB += git-sh-i18n
  
  SCRIPT_PERL += git-add--interactive.perl
  SCRIPT_PERL += git-difftool.perl
@@@ -406,6 -415,7 +407,7 @@@ PROGRAM_OBJS += shell.
  PROGRAM_OBJS += show-index.o
  PROGRAM_OBJS += upload-pack.o
  PROGRAM_OBJS += http-backend.o
+ PROGRAM_OBJS += sh-i18n--envsubst.o
  
  PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
  
@@@ -415,10 -425,8 +417,10 @@@ TEST_PROGRAMS_NEED_X += test-dat
  TEST_PROGRAMS_NEED_X += test-delta
  TEST_PROGRAMS_NEED_X += test-dump-cache-tree
  TEST_PROGRAMS_NEED_X += test-genrandom
 +TEST_PROGRAMS_NEED_X += test-index-version
  TEST_PROGRAMS_NEED_X += test-line-buffer
  TEST_PROGRAMS_NEED_X += test-match-trees
 +TEST_PROGRAMS_NEED_X += test-mktemp
  TEST_PROGRAMS_NEED_X += test-obj-pool
  TEST_PROGRAMS_NEED_X += test-parse-options
  TEST_PROGRAMS_NEED_X += test-path-utils
@@@ -429,6 -437,8 +431,6 @@@ TEST_PROGRAMS_NEED_X += test-string-poo
  TEST_PROGRAMS_NEED_X += test-subprocess
  TEST_PROGRAMS_NEED_X += test-svn-fe
  TEST_PROGRAMS_NEED_X += test-treap
 -TEST_PROGRAMS_NEED_X += test-index-version
 -TEST_PROGRAMS_NEED_X += test-mktemp
  
  TEST_PROGRAMS = $(patsubst %,%$X,$(TEST_PROGRAMS_NEED_X))
  
@@@ -1187,14 -1197,6 +1189,14 @@@ endi
  -include config.mak.autogen
  -include config.mak
  
 +ifndef sysconfdir
 +ifeq ($(prefix),/usr)
 +sysconfdir = /etc
 +else
 +sysconfdir = etc
 +endif
 +endif
 +
  ifdef CHECK_HEADER_DEPENDENCIES
  COMPUTE_HEADER_DEPENDENCIES =
  USE_COMPUTED_HEADER_DEPENDENCIES =
@@@ -1753,7 -1755,33 +1755,7 @@@ $(patsubst %.perl,%,$(SCRIPT_PERL)): % 
  gitweb:
        $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all
  
 -ifdef JSMIN
 -GITWEB_PROGRAMS += gitweb/static/gitweb.min.js
 -GITWEB_JS = gitweb/static/gitweb.min.js
 -else
 -GITWEB_JS = gitweb/static/gitweb.js
 -endif
 -ifdef CSSMIN
 -GITWEB_PROGRAMS += gitweb/static/gitweb.min.css
 -GITWEB_CSS = gitweb/static/gitweb.min.css
 -else
 -GITWEB_CSS = gitweb/static/gitweb.css
 -endif
 -OTHER_PROGRAMS +=  gitweb/gitweb.cgi  $(GITWEB_PROGRAMS)
 -gitweb/gitweb.cgi: gitweb/gitweb.perl $(GITWEB_PROGRAMS)
 -      $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)
 -
 -ifdef JSMIN
 -gitweb/static/gitweb.min.js: gitweb/static/gitweb.js
 -      $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)
 -endif # JSMIN
 -ifdef CSSMIN
 -gitweb/static/gitweb.min.css: gitweb/static/gitweb.css
 -      $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)
 -endif # CSSMIN
 -
 -
 -git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/static/gitweb.css gitweb/static/gitweb.js
 +git-instaweb: git-instaweb.sh gitweb
        $(QUIET_GEN)$(RM) $@ $@+ && \
        sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
            -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
@@@ -2037,10 -2065,14 +2039,14 @@@ XGETTEXT_FLAGS = 
        --from-code=UTF-8
  XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \
        --keyword=_ --keyword=N_ --keyword="Q_:1,2"
+ XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell
  LOCALIZED_C := $(C_OBJ:o=c)
+ LOCALIZED_SH := $(SCRIPT_SH)
  
  po/git.pot: $(LOCALIZED_C)
-       $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ $(XGETTEXT_FLAGS_C) $(LOCALIZED_C) && \
+       $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ $(XGETTEXT_FLAGS_C) $(LOCALIZED_C)
+       $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_SH) \
+               $(LOCALIZED_SH)
        mv $@+ $@
  
  pot: po/git.pot