changeset 27279:6d8527aeeebb

Rewrite translation handling in the build system.
author diego
date Thu, 17 Jul 2008 12:36:54 +0000
parents 4411ed11575e
children 440d543fb991
files Makefile configure
diffstat 2 files changed, 36 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Thu Jul 17 12:24:47 2008 +0000
+++ b/Makefile	Thu Jul 17 12:36:54 2008 +0000
@@ -819,8 +819,8 @@
 install-%: %$(EXESUF) install-dirs
 	$(INSTALL) -m 755 $(INSTALLSTRIP) $< $(BINDIR)
 
-install-mplayer-man: $(foreach lang,$(MAN_LANG),install-mplayer-man-$(lang))
-install-mencoder-man: $(foreach lang,$(MAN_LANG),install-mencoder-man-$(lang))
+install-mplayer-man:  $(foreach lang,$(MAN_LANGS),install-mplayer-man-$(lang))
+install-mencoder-man: $(foreach lang,$(MAN_LANGS),install-mencoder-man-$(lang))
 
 install-mplayer-man-en:
 	$(INSTALL) -d $(MANDIR)/man1
@@ -856,7 +856,7 @@
 	rm -f $(prefix)/share/pixmaps/mplayer.xpm
 	rm -f $(prefix)/share/applications/mplayer.desktop
 	rm -f $(MANDIR)/man1/mplayer.1 $(MANDIR)/man1/mencoder.1
-	rm -f $(foreach lang,$(MAN_LANG),$(foreach man,mplayer.1 mencoder.1,$(MANDIR)/$(lang)/man1/$(man)))
+	rm -f $(foreach lang,$(MAN_LANGS),$(foreach man,mplayer.1 mencoder.1,$(MANDIR)/$(lang)/man1/$(man)))
 
 clean:
 	rm -f $(foreach dir,$(DIRS),$(foreach suffix,/*.o /*.a /*.ho /*~, $(addsuffix $(suffix),$(dir))))
--- a/configure	Thu Jul 17 12:24:47 2008 +0000
+++ b/configure	Thu Jul 17 12:36:54 2008 +0000
@@ -191,9 +191,9 @@
   *)	_echo_n='-n '	_echo_c=	;;	# BSD echo
 esac
 
-msg_langs=`echo help/help_mp-??.h help/help_mp-??_??.h | sed -e "s:help/help_mp-\(..\).h:\1:g" -e "s:help/help_mp-\(.....\).h:\1:g"`
-man_langs=`echo DOCS/man/??/mplayer.1 | sed -e "s:DOCS/man/\(..\)/mplayer.1:\1:g"`
-doc_langs=`echo DOCS/xml/??/ DOCS/xml/??_??/ | sed -e "s:DOCS/xml/\(..\)/:\1:g" -e "s:DOCS/xml/\(.._..\)/:\1:g"`
+msg_lang_all=`echo help/help_mp-??.h help/help_mp-??_??.h | sed -e "s:help/help_mp-\(..\).h:\1:g" -e "s:help/help_mp-\(.....\).h:\1:g"`
+man_lang_all=`echo DOCS/man/??/mplayer.1 | sed -e "s:DOCS/man/\(..\)/mplayer.1:\1:g"`
+doc_lang_all=`echo DOCS/xml/??/ DOCS/xml/??_??/ | sed -e "s:DOCS/xml/\(..\)/:\1:g" -e "s:DOCS/xml/\(.._..\)/:\1:g"`
 
 show_help(){
 cat << EOF
@@ -419,7 +419,7 @@
                          translated man pages, the first language is used for
                          messages and the GUI (the environment variable
                          \$LINGUAS is also honored) [en]
-                         (Available: all $msg_langs)
+                         (Available: all $msg_lang_all)
   --with-install=PATH    path to a custom install program
 
 Advanced options:
@@ -2604,28 +2604,38 @@
 echocheck "language"
 test -z "$_language" && _language=$LINGUAS
 _language=`echo $_language | tr , " "`
-echo $_language | grep -q all || msg_langs="$_language en"
+if $(echo $_language | grep -q all) ; then
+  doc_lang=en ; doc_langs=$doc_lang_all
+  man_lang=en ; man_langs=$man_lang_all
+  msg_lang=en
+else
+  for lang in $_language ; do
+    if test -d DOCS/man/$lang ; then
+      tmp_man_langs="$tmp_man_langs $lang"
+    fi
+    if test -d DOCS/xml/$lang ; then
+      tmp_doc_langs="$tmp_doc_langs $lang"
+    fi
+  done
+  man_langs=$tmp_man_langs
+  doc_langs=$tmp_man_langs
 for lang in $_language ; do
-  test "$lang" = all && lang=en
   if test -f "help/help_mp-${lang}.h" ; then
-    _language=$lang
+    msg_lang=$lang
     break
   else
     echo ${_echo_n} "$lang not found, ${_echo_c}"
     _language=`echo $_language | sed "s/$lang *//"`
   fi
 done
-test -z "$_language" && _language=en
-_mp_help="help/help_mp-${_language}.h"
-for lang in $msg_langs ; do
-  if test -f "DOCS/man/$lang/mplayer.1" ; then
-    MAN_LANG_ALL="$lang $MAN_LANG_ALL"
-  fi
-done
-MAN_LANG="$(echo $MAN_LANG_ALL | sed 's/en//')"
-doc_lang=$_language
-test -d DOCS/xml/$doc_lang || doc_lang=en
-echores "using $_language (man pages: $MAN_LANG_ALL)"
+fi
+test -z "$doc_langs" && doc_langs=en
+test -z "$man_langs" && man_langs=en
+test -z "$doc_lang" && doc_lang=$(echo $doc_langs | cut -f1 -d" ")
+test -z "$man_lang" && man_lang=$(echo $man_langs | cut -f1 -d" ")
+test -z "$msg_lang" && msg_lang=en
+_mp_help="help/help_mp-${_msg_lang}.h"
+echores "messages: $msg_lang - man pages: $man_langs - documentation: $doc_langs"
 
 
 echocheck "enable sighandler"
@@ -7609,8 +7619,9 @@
 # Ensure that locale settings do not interfere with shell commands.
 export LC_ALL = C
 
-MAN_LANG = $MAN_LANG
-MAN_LANG_ALL = $MAN_LANG_ALL
+MAN_LANG = $man_lang
+MAN_LANGS = $man_langs
+MAN_LANG_ALL = $man_lang_all
 
 DESTDIR =
 prefix = \$(DESTDIR)$_prefix
@@ -8604,8 +8615,8 @@
   Optimizing for: $_optimizing
 
   Languages:
-    Messages/GUI: $_language
-    Manual pages: $MAN_LANG_ALL
+    Messages/GUI: $msg_lang
+    Manual pages: $man_langs
 
   Enabled optional drivers:
     Input: $_inputmodules