1
mirror of https://github.com/mpv-player/mpv synced 2024-10-30 04:46:41 +01:00

build: remove doc/locale language auto-detection, simplify

This removes the rather complicated configure and Makefile parts
related to auto-detecting available languages for manpages and locales.
We don't have non-English manpages or any locales, so this is
pointless. It didn't even work: configure --language=all created an
invalid config.mak that would cause "make install" to fail.

Remove installation of locales. There are no translations at all which
could be installed. Should there ever be someone who is interested in
adding translations, this can be added back in a simpler way.

Rename the --enable-translation configure option to --enable-gettext.
This is what this option really does: enable gettext() use. This may
be interesting for people who want to experiment with localizing mpv,
but is entirely useless for normal use.

Remove detection of the binary codecs directory in configure.
This commit is contained in:
wm4 2012-11-13 23:41:38 +01:00
parent a2098326da
commit 97efafee8a
4 changed files with 22 additions and 167 deletions

2
.gitignore vendored
View File

@ -14,8 +14,6 @@
/core/input/input_conf.h /core/input/input_conf.h
/tags /tags
/TAGS /TAGS
/locale
/po
/video/out/vo_opengl_shaders.h /video/out/vo_opengl_shaders.h
/video/out/vdpau_template.c /video/out/vdpau_template.c
/demux/ebml_defs.c /demux/ebml_defs.c

View File

@ -286,11 +286,9 @@ ALL_PRG += mpv$(EXESUF)
INSTALL_TARGETS += check_rst2man \ INSTALL_TARGETS += check_rst2man \
install-mpv \ install-mpv \
install-mpv-man \ install-mpv-man
install-mpv-msg
INSTALL_NO_MAN_TARGETS += install-mpv \ INSTALL_NO_MAN_TARGETS += install-mpv
install-mpv-msg
DIRS = . \ DIRS = . \
audio \ audio \
@ -309,8 +307,6 @@ DIRS = . \
video/filter \ video/filter \
video/out video/out
MOFILES := $(MSG_LANGS:%=locale/%/LC_MESSAGES/mpv.mo)
ADDSUFFIXES = $(foreach suf,$(1),$(addsuffix $(suf),$(2))) ADDSUFFIXES = $(foreach suf,$(1),$(addsuffix $(suf),$(2)))
ADD_ALL_DIRS = $(call ADDSUFFIXES,$(1),$(DIRS)) ADD_ALL_DIRS = $(call ADDSUFFIXES,$(1),$(DIRS))
@ -325,7 +321,7 @@ endif
###### generic rules ####### ###### generic rules #######
all: $(ALL_PRG) locales all: $(ALL_PRG)
%.1: %.rst %.1: %.rst
$(RST2MAN) $< $@ $(RST2MAN) $< $@
@ -392,16 +388,9 @@ version.h .version: version.sh
%$(EXESUF): %.c %$(EXESUF): %.c
$(CC) $(CFLAGS) -o $@ $^ $(CC) $(CFLAGS) -o $@ $^
locales: $(MOFILES)
locale/%/LC_MESSAGES/mpv.mo: po/%.po
mkdir -p $(dir $@)
msgfmt -c -o $@ $<
%.ho: %.h %.ho: %.h
$(CC) $(CFLAGS) -Wno-unused -c -o $@ -x c $< $(CC) $(CFLAGS) -Wno-unused -c -o $@ -x c $<
###### dependency declarations / specific CFLAGS ###### ###### dependency declarations / specific CFLAGS ######
core/version.c osdep/mpv-rc.o: version.h core/version.c osdep/mpv-rc.o: version.h
@ -421,46 +410,26 @@ install-no-man: $(INSTALL_NO_MAN_TARGETS)
install-dirs: install-dirs:
if test ! -d $(BINDIR) ; then $(INSTALL) -d $(BINDIR) ; fi if test ! -d $(BINDIR) ; then $(INSTALL) -d $(BINDIR) ; fi
if test ! -d $(CONFDIR) ; then $(INSTALL) -d $(CONFDIR) ; fi if test ! -d $(CONFDIR) ; then $(INSTALL) -d $(CONFDIR) ; fi
if test ! -d $(LIBDIR) ; then $(INSTALL) -d $(LIBDIR) ; fi
install-%: %$(EXESUF) install-dirs install-%: %$(EXESUF) install-dirs
$(INSTALL) -m 755 $(INSTALLSTRIP) $< $(BINDIR) $(INSTALL) -m 755 $(INSTALLSTRIP) $< $(BINDIR)
install-mpv-man: $(foreach lang,$(MAN_LANGS),install-mpv-man-$(lang)) install-mpv-man: install-mpv-man-en
install-mpv-msg: $(foreach lang,$(MSG_LANGS),install-mpv-msg-$(lang))
install-mpv-man-en: DOCS/man/en/mpv.1 install-mpv-man-en: DOCS/man/en/mpv.1
if test ! -d $(MANDIR)/man1 ; then $(INSTALL) -d $(MANDIR)/man1 ; fi if test ! -d $(MANDIR)/man1 ; then $(INSTALL) -d $(MANDIR)/man1 ; fi
$(INSTALL) -m 644 DOCS/man/en/mpv.1 $(MANDIR)/man1/ $(INSTALL) -m 644 DOCS/man/en/mpv.1 $(MANDIR)/man1/
define MPLAYER_MAN_RULE
install-mpv-man-$(lang): DOCS/man/$(lang)/mpv.1
if test ! -d $(MANDIR)/$(lang)/man1 ; then $(INSTALL) -d $(MANDIR)/$(lang)/man1 ; fi
$(INSTALL) -m 644 DOCS/man/$(lang)/mpv.1 $(MANDIR)/$(lang)/man1/
endef
$(foreach lang,$(filter-out en,$(MAN_LANG_ALL)),$(eval $(MPLAYER_MAN_RULE)))
define MPLAYER_MSG_RULE
install-mpv-msg-$(lang):
if test ! -d $(LOCALEDIR)/$(lang)/LC_MESSAGES ; then $(INSTALL) -d $(LOCALEDIR)/$(lang)/LC_MESSAGES ; fi
$(INSTALL) -m 644 locale/$(lang)/LC_MESSAGES/mpv.mo $(LOCALEDIR)/$(lang)/LC_MESSAGES/
endef
$(foreach lang,$(MSG_LANG_ALL),$(eval $(MPLAYER_MSG_RULE)))
uninstall: uninstall:
$(RM) $(BINDIR)/mpv$(EXESUF) $(RM) $(BINDIR)/mpv$(EXESUF)
$(RM) $(MANDIR)/man1/mpv.1 $(RM) $(MANDIR)/man1/mpv.1
$(RM) $(foreach lang,$(MAN_LANGS),$(foreach man,mpv.1,$(MANDIR)/$(lang)/man1/$(man))) $(RM) $(MANDIR)/en/man1/mpv.1
$(RM) $(foreach lang,$(MSG_LANGS),$(LOCALEDIR)/$(lang)/LC_MESSAGES/mpv.1)
clean: clean:
-$(RM) $(call ADD_ALL_DIRS,/*.o /*.d /*.a /*.ho /*~) -$(RM) $(call ADD_ALL_DIRS,/*.o /*.d /*.a /*.ho /*~)
-$(RM) $(foreach lang,$(MAN_LANGS),$(foreach man,mpv.1,DOCS/man/$(lang)/$(man)))
-$(RM) $(call ADD_ALL_DIRS,/*.o /*.a /*.ho /*~) -$(RM) $(call ADD_ALL_DIRS,/*.o /*.a /*.ho /*~)
-$(RM) $(call ADD_ALL_EXESUFS,mpv) -$(RM) $(call ADD_ALL_EXESUFS,mpv)
-$(RM) $(MOFILES) -$(RM) DOCS/man/en/mpv.1
-$(RM) version.h -$(RM) version.h
-$(RM) core/codecs.conf.h -$(RM) core/codecs.conf.h
-$(RM) core/input/input_conf.h -$(RM) core/input/input_conf.h
@ -470,7 +439,6 @@ clean:
-$(RM) sub/osd_font.h -$(RM) sub/osd_font.h
distclean: clean distclean: clean
-$(RM) -r locale
-$(RM) config.log config.mak config.h TAGS tags -$(RM) config.log config.mak config.h TAGS tags
TAGS: TAGS:
@ -484,7 +452,7 @@ osxbundle:
-include $(DEP_FILES) -include $(DEP_FILES)
.PHONY: all locales *install* .PHONY: all *install*
.PHONY: checkheaders *clean .version .PHONY: checkheaders *clean .version
# Disable suffix rules. Most of the builtin rules are suffix rules, # Disable suffix rules. Most of the builtin rules are suffix rules,

135
configure vendored
View File

@ -272,10 +272,6 @@ case $(echo -n) in
*) _echo_n='-n ' _echo_c= ;; # BSD echo *) _echo_n='-n ' _echo_c= ;; # BSD echo
esac esac
msg_lang_all=''
ls po/*.po >/dev/null 2>&1 && msg_lang_all=$(echo po/*.po | sed -e 's:po/\([^[:space:]]*\)\.po:\1:g')
man_lang_all=$(echo DOCS/man/??/mpv.1 DOCS/man/??_??/mpv.1 | sed -e "s:DOCS/man/\(..\)/mpv.1:\1:g" -e "s:DOCS/man/\(.._..\)/mpv.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(){ show_help(){
cat << EOF cat << EOF
@ -292,12 +288,9 @@ Installation directories:
--mandir=DIR directory for installing man pages [PREFIX/share/man] --mandir=DIR directory for installing man pages [PREFIX/share/man]
--confdir=DIR directory for installing configuration files --confdir=DIR directory for installing configuration files
[PREFIX/etc/mpv] [PREFIX/etc/mpv]
--localedir=DIR directory for locale tree [PREFIX/share/locale] --localedir=DIR directory for gettext locales [PREFIX/share/locale]
--libdir=DIR directory for object code libraries [PREFIX/lib]
--codecsdir=DIR directory for binary codecs [LIBDIR/codecs]
Optional features: Optional features:
--disable-mpv disable mpv compilation [enable]
--disable-encoding disable encoding functionality [enable] --disable-encoding disable encoding functionality [enable]
--enable-termcap use termcap database for key codes [autodetect] --enable-termcap use termcap database for key codes [autodetect]
--enable-termios use termios database for key codes [autodetect] --enable-termios use termios database for key codes [autodetect]
@ -378,22 +371,8 @@ Audio output:
--disable-dsound disable DirectSound audio output [autodetect] --disable-dsound disable DirectSound audio output [autodetect]
--disable-select disable using select() on the audio device [enable] --disable-select disable using select() on the audio device [enable]
Language options: Localization options:
--enable-translation enable support for translated output [disable] --enable-gettext enable gettext() usage [disable]
--language-doc=lang language to use for the documentation [en]
--language-man=lang language to use for the man pages [en]
--language-msg=lang extra languages for program messages [all]
--language=lang default language to use [en]
Specific options override --language. You can pass a list of languages separated
by whitespace or commas instead of a single language. Nonexisting translations
will be dropped from each list. All translations available in the list will be
installed. The value "all" will activate all translations. The LINGUAS
environment variable is honored. In all cases the fallback is English.
The program always supports English-language output; additional message
languages are only installed if --enable-translation is also specified.
Available values for --language-doc are: all $doc_lang_all
Available values for --language-man are: all $man_lang_all
Available values for --language-msg are: all $msg_lang_all
Miscellaneous options: Miscellaneous options:
--enable-cross-compile enable cross-compilation [disable] --enable-cross-compile enable cross-compilation [disable]
@ -492,9 +471,8 @@ _apple_remote=auto
_apple_ir=auto _apple_ir=auto
_termcap=auto _termcap=auto
_termios=auto _termios=auto
#language=en
_shm=auto _shm=auto
_translation=no _gettext=no
_cdda=auto _cdda=auto
_cddb=auto _cddb=auto
_coreaudio=auto _coreaudio=auto
@ -541,12 +519,6 @@ for ac_option do
--confdir=*) --confdir=*)
_confdir=$(echo $ac_option | cut -d '=' -f 2) _confdir=$(echo $ac_option | cut -d '=' -f 2)
;; ;;
--libdir=*)
_libdir=$(echo $ac_option | cut -d '=' -f 2)
;;
--codecsdir=*)
_codecsdir=$(echo $ac_option | cut -d '=' -f 2)
;;
--localedir=*) --localedir=*)
_localedir=$(echo $ac_option | cut -d '=' -f 2) _localedir=$(echo $ac_option | cut -d '=' -f 2)
;; ;;
@ -580,18 +552,6 @@ for ac_option do
--windres=*) --windres=*)
_windres=$(echo $ac_option | cut -d '=' -f 2) _windres=$(echo $ac_option | cut -d '=' -f 2)
;; ;;
--language-doc=*)
language_doc=$(echo $ac_option | cut -d '=' -f 2)
;;
--language-man=*)
language_man=$(echo $ac_option | cut -d '=' -f 2)
;;
--language-msg=*)
language_msg=$(echo $ac_option | cut -d '=' -f 2)
;;
--language=*)
language=$(echo $ac_option | cut -d '=' -f 2)
;;
--enable-static) --enable-static)
_ld_static='-static' _ld_static='-static'
@ -616,8 +576,8 @@ for ac_option do
--disable-debug) --disable-debug)
_debug= _debug=
;; ;;
--enable-translation) _translation=yes ;; --enable-gettext) _gettext=yes ;;
--disable-translation) _translation=no ;; --disable-gettext) _gettext=no ;;
--enable-cross-compile) _cross_compile=yes ;; --enable-cross-compile) _cross_compile=yes ;;
--disable-cross-compile) _cross_compile=no ;; --disable-cross-compile) _cross_compile=no ;;
--enable-encoding) _encoding=yes ;; --enable-encoding) _encoding=yes ;;
@ -785,7 +745,6 @@ test -z "$_bindir" && _bindir="$_prefix/bin"
test -z "$_datadir" && _datadir="$_prefix/share/mpv" test -z "$_datadir" && _datadir="$_prefix/share/mpv"
test -z "$_mandir" && _mandir="$_prefix/share/man" test -z "$_mandir" && _mandir="$_prefix/share/man"
test -z "$_confdir" && _confdir="$_prefix/etc/mpv" test -z "$_confdir" && _confdir="$_prefix/etc/mpv"
test -z "$_libdir" && _libdir="$_prefix/lib"
test -z "$_localedir" && _localedir="$_prefix/share/locale" test -z "$_localedir" && _localedir="$_prefix/share/locale"
for tmpdir in "$TMPDIR" "$TEMPDIR" "/tmp" ; do for tmpdir in "$TMPDIR" "$TEMPDIR" "/tmp" ; do
@ -1271,54 +1230,13 @@ else
fi fi
echocheck "translation support" echocheck "gettext support"
if test "$_translation" = yes; then if test "$_gettext" = yes; then
def_translation="#define CONFIG_TRANSLATION 1" def_gettext="#define CONFIG_GETTEXT 1"
else else
def_translation="#undef CONFIG_TRANSLATION" def_gettext="#undef CONFIG_GETTEXT"
fi fi
echores "$_translation" echores "$_gettext"
echocheck "language"
# Set preferred languages, "all" uses English as main language.
test -z "$language" && language=$LINGUAS
test -z "$language_doc" && language_doc=$language
test -z "$language_man" && language_man=$language
test -z "$language_msg" && language_msg=$language
test -z "$language_msg" && language_msg="all"
language_doc=$(echo $language_doc | tr , " ")
language_man=$(echo $language_man | tr , " ")
language_msg=$(echo $language_msg | tr , " ")
test "$language_doc" = "all" && language_doc=$doc_lang_all
test "$language_man" = "all" && language_man=$man_lang_all
test "$language_msg" = "all" && language_msg=$msg_lang_all
if test "$_translation" != yes ; then
language_msg=""
fi
# Prune non-existing translations from language lists.
# Set message translation to the first available language.
# Fall back on English.
for lang in $language_doc ; do
test -d DOCS/xml/$lang && tmp_language_doc="$tmp_language_doc $lang"
done
language_doc=$tmp_language_doc
test -z "$language_doc" && language_doc=en
for lang in $language_man ; do
test -d DOCS/man/$lang && tmp_language_man="$tmp_language_man $lang"
done
language_man=$tmp_language_man
test -z "$language_man" && language_man=en
for lang in $language_msg ; do
test -f po/$lang.po && tmp_language_msg="$tmp_language_msg $lang"
done
language_msg=$tmp_language_msg
echores "messages (en+): $language_msg - man pages: $language_man - documentation: $language_doc"
echocheck "__builtin_expect" echocheck "__builtin_expect"
@ -2910,22 +2828,6 @@ test "$_libbs2b" = yes && def_libbs2b="#define CONFIG_LIBBS2B 1"
echores "$_libbs2b" echores "$_libbs2b"
if test -z "$_codecsdir" ; then
for dir in "$_libdir/codecs" "$_libdir/win32" /usr/local/lib/codecs \
/usr/lib/codecs /usr/local/lib/win32 /usr/lib/win32 ; do
if test -d "$dir" ; then
_codecsdir="$dir"
break;
fi;
done
fi
# Fall back on default directory.
if test -z "$_codecsdir" ; then
_codecsdir="$_libdir/codecs"
mingw32 && _codecsdir="codecs"
fi
echocheck "LCMS2 support" echocheck "LCMS2 support"
if test "$_lcms2" = auto ; then if test "$_lcms2" = auto ; then
_lcms2=no _lcms2=no
@ -3304,17 +3206,9 @@ export LC_ALL = C
CONFIGURATION = $configuration CONFIGURATION = $configuration
DOC_LANGS = $language_doc
DOC_LANG_ALL = $doc_lang_all
MAN_LANGS = $language_man
MAN_LANG_ALL = $man_lang_all
MSG_LANGS = $language_msg
MSG_LANG_ALL = $msg_lang_all
prefix = \$(DESTDIR)$_prefix prefix = \$(DESTDIR)$_prefix
BINDIR = \$(DESTDIR)$_bindir BINDIR = \$(DESTDIR)$_bindir
DATADIR = \$(DESTDIR)$_datadir DATADIR = \$(DESTDIR)$_datadir
LIBDIR = \$(DESTDIR)$_libdir
MANDIR = \$(DESTDIR)$_mandir MANDIR = \$(DESTDIR)$_mandir
CONFDIR = \$(DESTDIR)$_confdir CONFDIR = \$(DESTDIR)$_confdir
LOCALEDIR = \$(DESTDIR)$_localedir LOCALEDIR = \$(DESTDIR)$_localedir
@ -3457,7 +3351,7 @@ cat > $TMPH << EOF
#define MPLAYER_CONFDIR "$_confdir" #define MPLAYER_CONFDIR "$_confdir"
#define MPLAYER_LOCALEDIR "$_localedir" #define MPLAYER_LOCALEDIR "$_localedir"
$def_translation $def_gettext
/* system headers */ /* system headers */
@ -3659,11 +3553,6 @@ Config files successfully generated by ./configure $configuration !
Data directory: $_datadir Data directory: $_datadir
Config direct.: $_confdir Config direct.: $_confdir
Languages:
Messages (in addition to English): $language_msg
Manual pages: $language_man
Documentation: $language_doc
Enabled optional drivers: Enabled optional drivers:
Input: $inputmodules Input: $inputmodules
Codecs: libavcodecs $codecmodules Codecs: libavcodecs $codecmodules

View File

@ -26,7 +26,7 @@
#include "osdep/getch2.h" #include "osdep/getch2.h"
#include "osdep/io.h" #include "osdep/io.h"
#ifdef CONFIG_TRANSLATION #ifdef CONFIG_GETTEXT
#include <locale.h> #include <locale.h>
#include <libintl.h> #include <libintl.h>
#endif #endif
@ -86,7 +86,7 @@ void mp_msg_init(void){
for(i=0;i<MSGT_MAX;i++) mp_msg_levels[i] = -2; for(i=0;i<MSGT_MAX;i++) mp_msg_levels[i] = -2;
mp_msg_cancolor = isatty(fileno(stdout)); mp_msg_cancolor = isatty(fileno(stdout));
mp_msg_levels[MSGT_IDENTIFY] = -1; // no -identify output by default mp_msg_levels[MSGT_IDENTIFY] = -1; // no -identify output by default
#ifdef CONFIG_TRANSLATION #ifdef CONFIG_GETTEXT
textdomain("mpv"); textdomain("mpv");
char *localedir = getenv("MPV_LOCALEDIR"); char *localedir = getenv("MPV_LOCALEDIR");
if (localedir == NULL && strlen(MPLAYER_LOCALEDIR)) if (localedir == NULL && strlen(MPLAYER_LOCALEDIR))
@ -249,7 +249,7 @@ void mp_msg(int mod, int lev, const char *format, ...)
char *mp_gtext(const char *string) char *mp_gtext(const char *string)
{ {
#ifdef CONFIG_TRANSLATION #ifdef CONFIG_GETTEXT
/* gettext expects the global locale to be set with /* gettext expects the global locale to be set with
* setlocale(LC_ALL, ""). However doing that would suck for a * setlocale(LC_ALL, ""). However doing that would suck for a
* couple of reasons (locale stuff is badly designed and sucks in * couple of reasons (locale stuff is badly designed and sucks in