meson: convert po/

Meson warns if xgettext is not found.  In the future we may want to add
a required argument to i18n.gettext(); in the meanwhile, I am adding a
--enable-gettext/--disable-gettext option and feature detection in
configure.  This preserves QEMU's default behavior of detecting system
features, without any warning, if neither --enable-* nor --disable-*
is requested.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Marc-André Lureau 2019-09-19 21:02:09 +04:00 committed by Paolo Bonzini
parent a0b93237d8
commit e8f3bd71d8
12 changed files with 44 additions and 131 deletions

View File

@ -219,7 +219,7 @@ distclean: clean ninja-distclean
rm -f config-host.mak config-host.h* rm -f config-host.mak config-host.h*
rm -f tests/tcg/config-*.mak rm -f tests/tcg/config-*.mak
rm -f config-all-disas.mak config.status rm -f config-all-disas.mak config.status
rm -f po/*.mo tests/qemu-iotests/common.env rm -f tests/qemu-iotests/common.env
rm -f roms/seabios/config.mak roms/vgabios/config.mak rm -f roms/seabios/config.mak roms/vgabios/config.mak
rm -f qemu-plugins-ld.symbols qemu-plugins-ld64.symbols rm -f qemu-plugins-ld.symbols qemu-plugins-ld64.symbols
rm -f *-config-target.h *-config-devices.mak *-config-devices.h rm -f *-config-target.h *-config-devices.mak *-config-devices.h
@ -297,9 +297,6 @@ endif
mkdir -p "$(DESTDIR)$(qemu_desktopdir)" mkdir -p "$(DESTDIR)$(qemu_desktopdir)"
$(INSTALL_DATA) $(SRC_PATH)/ui/qemu.desktop \ $(INSTALL_DATA) $(SRC_PATH)/ui/qemu.desktop \
"$(DESTDIR)$(qemu_desktopdir)/qemu.desktop" "$(DESTDIR)$(qemu_desktopdir)/qemu.desktop"
ifdef CONFIG_GTK
$(MAKE) -C po $@
endif
$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/keymaps" $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/keymaps"
set -e; for x in $(KEYMAPS); do \ set -e; for x in $(KEYMAPS); do \
$(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \ $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \

21
configure vendored
View File

@ -569,6 +569,7 @@ secret_keyring=""
libdaxctl="" libdaxctl=""
meson="" meson=""
skip_meson=no skip_meson=no
gettext=""
bogus_os="no" bogus_os="no"
malloc_trim="" malloc_trim=""
@ -1161,6 +1162,10 @@ for opt do
;; ;;
--enable-vnc) vnc="enabled" --enable-vnc) vnc="enabled"
;; ;;
--disable-gettext) gettext="false"
;;
--enable-gettext) gettext="true"
;;
--oss-lib=*) oss_lib="$optarg" --oss-lib=*) oss_lib="$optarg"
;; ;;
--audio-drv-list=*) audio_drv_list="$optarg" --audio-drv-list=*) audio_drv_list="$optarg"
@ -3032,6 +3037,19 @@ if test "$whpx" != "no" ; then
fi fi
fi fi
##########################################
# gettext probe
if test "$gettext" != "false" ; then
if has xgettext; then
gettext=true
else
if test "$gettext" = "true" ; then
feature_not_found "gettext" "Install xgettext binary"
fi
gettext=false
fi
fi
########################################## ##########################################
# Sparse probe # Sparse probe
if test "$sparse" != "no" ; then if test "$sparse" != "no" ; then
@ -8099,7 +8117,7 @@ DIRS="$DIRS docs docs/interop fsdev scsi"
DIRS="$DIRS pc-bios/optionrom pc-bios/s390-ccw" DIRS="$DIRS pc-bios/optionrom pc-bios/s390-ccw"
DIRS="$DIRS roms/seabios" DIRS="$DIRS roms/seabios"
LINKS="Makefile" LINKS="Makefile"
LINKS="$LINKS tests/tcg/lm32/Makefile po/Makefile" LINKS="$LINKS tests/tcg/lm32/Makefile"
LINKS="$LINKS tests/tcg/Makefile.target" LINKS="$LINKS tests/tcg/Makefile.target"
LINKS="$LINKS pc-bios/optionrom/Makefile pc-bios/keymaps" LINKS="$LINKS pc-bios/optionrom/Makefile pc-bios/keymaps"
LINKS="$LINKS pc-bios/s390-ccw/Makefile" LINKS="$LINKS pc-bios/s390-ccw/Makefile"
@ -8231,6 +8249,7 @@ NINJA=$PWD/ninjatool $meson setup \
-Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \ -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \
-Dsdl=$sdl -Dsdl_image=$sdl_image \ -Dsdl=$sdl -Dsdl_image=$sdl_image \
-Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \ -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \
-Dgettext=$gettext \
$cross_arg \ $cross_arg \
"$PWD" "$source_path" "$PWD" "$source_path"

View File

@ -1115,6 +1115,9 @@ subdir('tools')
subdir('pc-bios') subdir('pc-bios')
subdir('tests') subdir('tests')
subdir('docs') subdir('docs')
if 'CONFIG_GTK' in config_host
subdir('po')
endif
if build_docs if build_docs
makeinfo = find_program('makeinfo', required: build_docs) makeinfo = find_program('makeinfo', required: build_docs)

View File

@ -1,3 +1,4 @@
option('gettext', type : 'boolean', value : true)
option('sdl', type : 'feature', value : 'auto') option('sdl', type : 'feature', value : 'auto')
option('sdl_image', type : 'feature', value : 'auto') option('sdl_image', type : 'feature', value : 'auto')
option('vnc', type : 'feature', value : 'enabled') option('vnc', type : 'feature', value : 'enabled')

8
po/LINGUAS Normal file
View File

@ -0,0 +1,8 @@
bg
de_DE
fr_FR
hu
it
sv
tr
zh_CN

View File

@ -1,52 +0,0 @@
# This makefile is very special as it's meant to build as part of the build
# process and also within the source tree to update the translation files.
# Set SRC_PATH for in-tree builds without configuration.
SRC_PATH=..
# The default target must come before any include statements.
all:
.PHONY: all build clean install update
%.mo: %.po
$(call quiet-command, msgfmt -o $@ $<,"GEN","$@")
-include ../config-host.mak
include $(SRC_PATH)/rules.mak
PO_PATH=$(SRC_PATH)/po
VERSION=$(shell cat $(SRC_PATH)/VERSION)
SRCS=$(filter-out $(PO_PATH)/messages.po,$(wildcard $(PO_PATH)/*.po))
OBJS=$(patsubst $(PO_PATH)/%.po,%.mo,$(SRCS))
vpath %.po $(PO_PATH)
all:
@echo "Use 'make update' to update translation files or use 'make build'"
@echo "or 'make install' to build and install the translation files."
update: $(SRCS)
build: $(OBJS)
clean:
rm -f $(OBJS)
install: $(OBJS)
for obj in $(OBJS); do \
base=$$(basename $$obj .mo); \
$(INSTALL) -d $(DESTDIR)$(prefix)/share/locale/$$base/LC_MESSAGES; \
$(INSTALL) -m644 $$obj $(DESTDIR)$(prefix)/share/locale/$$base/LC_MESSAGES/qemu.mo; \
done
$(PO_PATH)/messages.po: $(SRC_PATH)/ui/gtk.c
$(call quiet-command, ( cd $(SRC_PATH) && \
xgettext -o - --from-code=UTF-8 --foreign-user --no-location \
--package-name=QEMU --package-version=$(VERSION) \
--msgid-bugs-address=qemu-devel@nongnu.org -k_ -C ui/gtk.c | \
sed -e s/CHARSET/UTF-8/) >$@,"GEN","$@")
$(PO_PATH)/%.po: $(PO_PATH)/messages.po
$(call quiet-command, msgmerge -q $@ $< > $@.bak && mv $@.bak $@,"GEN","$@")

1
po/POTFILES Normal file
View File

@ -0,0 +1 @@
ui/gtk.c

7
po/meson.build Normal file
View File

@ -0,0 +1,7 @@
i18n = import('i18n')
if get_option('gettext')
i18n.gettext(meson.project_name(),
args: '--msgid-bugs-address=qemu-devel@nongnu.org',
preset: 'glib')
endif

View File

@ -1,74 +0,0 @@
# SOME DESCRIPTIVE TITLE.
# This file is put in the public domain.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: QEMU 2.12.91\n"
"Report-Msgid-Bugs-To: qemu-devel@nongnu.org\n"
"POT-Creation-Date: 2018-07-18 07:56+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
msgid " - Press Ctrl+Alt+G to release grab"
msgstr ""
msgid " [Paused]"
msgstr ""
msgid "_Pause"
msgstr ""
msgid "_Reset"
msgstr ""
msgid "Power _Down"
msgstr ""
msgid "_Quit"
msgstr ""
msgid "_Fullscreen"
msgstr ""
msgid "_Copy"
msgstr ""
msgid "Zoom _In"
msgstr ""
msgid "Zoom _Out"
msgstr ""
msgid "Best _Fit"
msgstr ""
msgid "Zoom To _Fit"
msgstr ""
msgid "Grab On _Hover"
msgstr ""
msgid "_Grab Input"
msgstr ""
msgid "Show _Tabs"
msgstr ""
msgid "Detach Tab"
msgstr ""
msgid "Show Menubar"
msgstr ""
msgid "_Machine"
msgstr ""
msgid "_View"
msgstr ""

View File

@ -39,6 +39,7 @@ class FreeBSDVM(basevm.BaseVM):
"bash", "bash",
"gmake", "gmake",
"gsed", "gsed",
"gettext",
# libs: crypto # libs: crypto
"gnutls", "gnutls",

View File

@ -37,6 +37,7 @@ class NetBSDVM(basevm.BaseVM):
"bash", "bash",
"gmake", "gmake",
"gsed", "gsed",
"gettext",
# libs: crypto # libs: crypto
"gnutls", "gnutls",

View File

@ -36,6 +36,7 @@ class OpenBSDVM(basevm.BaseVM):
"bash", "bash",
"gmake", "gmake",
"gsed", "gsed",
"gettext",
# libs: usb # libs: usb
"libusb1", "libusb1",