Compare commits

...

5 Commits

Author SHA1 Message Date
6e53b6686d
Merge pull request #16 from wdlkmpx/patch2
src/gfx.c: don't g_object_unref(pixsurf)
2021-07-13 19:11:03 +03:00
3b2183777b
Merge pull request #15 from wdlkmpx/patch1
improvements to the build system (autotools)
2021-07-13 19:10:20 +03:00
wdlkmpx
4dbebefc58 po/Makefile.in.gen generates po/Makefile.in 2021-06-20 15:08:29 -05:00
wdlkmpx
f5382a6aa3 src/gfx.c: don't g_object_unref(pixsurf)
it's cairo surface, it's handled properly a couple lines below:

cairo_surface_destroy (pixsurf);
2021-06-16 22:30:19 -05:00
wdlkmpx
694de859a7 update LINGUAS and POTFILES.in 2021-06-16 22:28:31 -05:00
10 changed files with 247 additions and 231 deletions

4
.gitignore vendored
View File

@ -2,7 +2,8 @@
*.o
ar-lib
po/POTFILES
po/*.gmo
*.gmo
*.mo
stamp-it
compile
config.guess
@ -20,6 +21,7 @@ libtool
ltmain.sh
Makefile
Makefile.in
!po/Makefile.in
m4
missing
stamp-h1

View File

@ -1,6 +1,54 @@
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
# special params:
# - po update .pot & po files
# - linguas update LINGUAS and POTFILES.in
# - release create release tarball
#===========================================================================
if test "$1" = "po" ; then
# Before creating a release you might want to update the po files
test -d "po/" || exit
#git clean -dfx
test -f ./configure || ./autogen.sh
test -f ./po/Makefile || ./configure
find po -name '*.pot' -delete # updates don't happen if pot files already exist...
make -C po update-po
# cleanup
rm -f po/*.po~
#sed -i '/#~ /d' po/*.po
#git clean -dfx
exit
fi
if test "$1" = "linguas" ; then
./po/Makefile.in.gen
exit $?
fi
#===========================================================================
if test "$1" == "release" || test "$1" == "--release" ; then
pkg="$(grep -m 1 AC_INIT configure.ac | cut -f 2 -d '[' | cut -f 1 -d ']')"
ver="$(grep -m 1 AC_INIT configure.ac | cut -f 3 -d '[' | cut -f 1 -d ']')"
ver=$(echo $ver)
dir=${pkg}-${ver}
rm -rf ../$dir
mkdir -p ../$dir
cp -rf $PWD/* ../$dir
( cd ../$dir ; ./autogen.sh )
cd ..
tar -Jcf ${dir}.tar.xz $dir
exit
fi
#===========================================================================
# autogen.sh [--verbose]
#===========================================================================
srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.
cd $srcdir
@ -31,7 +79,9 @@ if test -n "$m4dir" ; then
fi
# Get all required m4 macros required for configure
$LIBTOOLIZE ${verbose} --copy --force || exit 1
if grep -q LT_INIT configure.ac ; then
$LIBTOOLIZE ${verbose} --copy --force || exit 1
fi
$ACLOCAL ${verbose} || exit 1
# Generate config.h.in

4
configure.ac vendored
View File

@ -11,7 +11,7 @@ AC_CONFIG_HEADER(config.h)
AM_GNU_GETTEXT([external])
m4_ifdef([AM_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
LT_INIT
#L#T_INIT
# Checks for programs.
AC_PROG_CC
@ -74,7 +74,7 @@ AC_CONFIG_FILES([
src/Makefile
doc/Makefile
doc/gtkballs.6x
po/Makefile.in
po/Makefile
gtkballs.spec
gtkballs-data/Makefile
])

View File

@ -1,2 +0,0 @@
# Set of available languages.
ru fr de pl nl

88
po/Makefile.in Normal file
View File

@ -0,0 +1,88 @@
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
PACKAGE = @PACKAGE@
VERSION = @VERSION@
@SET_MAKE@
prefix = @prefix@
exec_prefix = @exec_prefix@
datarootdir = @datarootdir@
datadir = @datadir@
localedir = @localedir@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
GMSGFMT = @GMSGFMT@
MSGFMT = @MSGFMT@
#MSGFMT_OPTS = -c
XGETTEXT = @XGETTEXT@
MSGMERGE = msgmerge
MOFILES = de.mo fr.mo nl.mo pl.mo ru.mo
LINGUAS = de fr nl pl ru
POTFILES = ../src/about.c ../src/gtkballs.c ../src/gtkballs.h ../src/halloffame.c ../src/inputname.c ../src/mainmenu.c ../src/mainwin.c ../src/preferences.c ../src/prefs.c ../src/rules.c ../src/rulesdialog.c ../src/savedialog.c ../src/scoreboard.c
#.SUFFIXES: .po .gmo .mo
#.po.mo:
# $(GMSGFMT) $(MSGFMT_OPTS) -o `echo $* | sed "s,.*/,,"`.mo $<
all: all-@USE_NLS@
all-yes: $(MOFILES)
all-no:
$(GETTEXT_PACKAGE).pot: $(POTFILES)
$(XGETTEXT) --default-domain=$(GETTEXT_PACKAGE) \
--add-comments --keyword=_ --keyword=N_ --from-code=UTF-8 \
-o $(GETTEXT_PACKAGE).pot $(POTFILES)
install: install-data-@USE_NLS@
install-data-no: all
install-data-yes: all
catalogs="$(LINGUAS)"; \
for cat in $$catalogs; do \
dir=$(DESTDIR)$(localedir)/$$cat/LC_MESSAGES; \
mkdir -p $$dir; \
$(INSTALL_DATA) $$cat.mo $$dir/$(GETTEXT_PACKAGE).mo; \
echo "installing $$cat.mo as $$dir/$(GETTEXT_PACKAGE).mo"; \
done
uninstall:
catalogs="$(LINGUAS)"; \
for cat in $$catalogs; do \
echo "rm -f $(DESTDIR)$(localedir)/$$cat/LC_MESSAGES/$(GETTEXT_PACKAGE).mo"; \
rm -f $(DESTDIR)$(localedir)/$$cat/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \
done
mostlyclean:
rm -f *.pox *.old.po *.new.po *.mo *.gmo *.msg *.cat *.cat.m
clean: mostlyclean
distclean: clean
rm -f Makefile POTFILES
update-po: Makefile
rm -f $(GETTEXT_PACKAGE).pot
$(MAKE) $(GETTEXT_PACKAGE).pot
catalogs="$(LINGUAS)"; \
for lang in $$catalogs; do \
printf " %s " "$$lang"; \
if $(MSGMERGE) $$lang.po $(GETTEXT_PACKAGE).pot -o $$lang.new.po; then \
mv -f $$lang.new.po $$lang.po || exit 1; \
else \
echo "msgmerge for $$lang failed!"; \
rm -f $$lang.new.po; \
fi; \
done
de.mo:
$(GMSGFMT) $(MSGFMT_OPTS) -o de.mo de.po
fr.mo:
$(GMSGFMT) $(MSGFMT_OPTS) -o fr.mo fr.po
nl.mo:
$(GMSGFMT) $(MSGFMT_OPTS) -o nl.mo nl.po
pl.mo:
$(GMSGFMT) $(MSGFMT_OPTS) -o pl.mo pl.po
ru.mo:
$(GMSGFMT) $(MSGFMT_OPTS) -o ru.mo ru.po

97
po/Makefile.in.gen Executable file
View File

@ -0,0 +1,97 @@
#!/bin/sh
# https://unlicense.org
cd $(dirname "$0")
POFILES="$(ls *.po)"
MOFILES="$(echo "$POFILES" | sed 's/\.po$/.mo/')"
LINGUAS="$(echo "$POFILES" | sed 's/\.po$//')"
filez=$(find .. -type f -name '*.h' -or -name '*.c' -or -name '*.cc' -or -name '*.cpp' -or -name '*.hh')
POTFILES="$(grep '_(' $filez | sed -e 's%^\./%%' -e 's%:.*%%' | sort -u)"
echo '
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
PACKAGE = @PACKAGE@
VERSION = @VERSION@
@SET_MAKE@
prefix = @prefix@
exec_prefix = @exec_prefix@
datarootdir = @datarootdir@
datadir = @datadir@
localedir = @localedir@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
GMSGFMT = @GMSGFMT@
MSGFMT = @MSGFMT@
#MSGFMT_OPTS = -c
XGETTEXT = @XGETTEXT@
MSGMERGE = msgmerge
MOFILES = '${MOFILES}'
LINGUAS = '${LINGUAS}'
POTFILES = '${POTFILES}'
#.SUFFIXES: .po .gmo .mo
#.po.mo:
# $(GMSGFMT) $(MSGFMT_OPTS) -o `echo $* | sed "s,.*/,,"`.mo $<
all: all-@USE_NLS@
all-yes: $(MOFILES)
all-no:
$(GETTEXT_PACKAGE).pot: $(POTFILES)
$(XGETTEXT) --default-domain=$(GETTEXT_PACKAGE) \
--add-comments --keyword=_ --keyword=N_ --from-code=UTF-8 \
-o $(GETTEXT_PACKAGE).pot $(POTFILES)
install: install-data-@USE_NLS@
install-data-no: all
install-data-yes: all
catalogs="$(LINGUAS)"; \
for cat in $$catalogs; do \
dir=$(DESTDIR)$(localedir)/$$cat/LC_MESSAGES; \
mkdir -p $$dir; \
$(INSTALL_DATA) $$cat.mo $$dir/$(GETTEXT_PACKAGE).mo; \
echo "installing $$cat.mo as $$dir/$(GETTEXT_PACKAGE).mo"; \
done
uninstall:
catalogs="$(LINGUAS)"; \
for cat in $$catalogs; do \
echo "rm -f $(DESTDIR)$(localedir)/$$cat/LC_MESSAGES/$(GETTEXT_PACKAGE).mo"; \
rm -f $(DESTDIR)$(localedir)/$$cat/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \
done
mostlyclean:
rm -f *.pox *.old.po *.new.po *.mo *.gmo *.msg *.cat *.cat.m
clean: mostlyclean
distclean: clean
rm -f Makefile POTFILES
update-po: Makefile
rm -f $(GETTEXT_PACKAGE).pot
$(MAKE) $(GETTEXT_PACKAGE).pot
catalogs="$(LINGUAS)"; \
for lang in $$catalogs; do \
printf " %s " "$$lang"; \
if $(MSGMERGE) $$lang.po $(GETTEXT_PACKAGE).pot -o $$lang.new.po; then \
mv -f $$lang.new.po $$lang.po || exit 1; \
else \
echo "msgmerge for $$lang failed!"; \
rm -f $$lang.new.po; \
fi; \
done
' > Makefile.in
(
for i in ${LINGUAS}
do
echo "${i}.mo:"
echo " \$(GMSGFMT) \$(MSGFMT_OPTS) -o ${i}.mo ${i}.po"
done
) >> Makefile.in

View File

@ -1,198 +0,0 @@
# Makefile for program source directory in GNU NLS utilities package.
# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
#
# This file file be copied and used freely without restrictions. It can
# be used in projects which are not available under the GNU Public License
# but which still want to provide support for the GNU gettext functionality.
# Please note that the actual code is *not* freely available.
#
# - Modified by Owen Taylor <otaylor@redhat.com> to use GETTEXT_PACKAGE
# instead of PACKAGE and to look for po2tbl in ./ not in intl/
#
# - Modified by jacob berkman <jacob@ximian.com> to install
# Makefile.in.in and po2tbl.sed.in for use with glib-gettextize
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
PACKAGE = @PACKAGE@
VERSION = @VERSION@
SHELL = @SHELL@
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
datarootdir = @datarootdir@
datadir = @datadir@
localedir = @localedir@
subdir = po
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
CC = @CC@
GENCAT = gencat
GMSGFMT = @GMSGFMT@
MSGFMT = @MSGFMT@
#MSGFMT_OPTS = -c
XGETTEXT = @XGETTEXT@
MSGMERGE = msgmerge
POFILES = @POFILES@
GMOFILES = @GMOFILES@
DISTFILES = LINGUAS Makefile.in.in POTFILES.in $(GETTEXT_PACKAGE).pot $(POFILES) $(GMOFILES)
POTFILES = \
CATALOGS = @CATALOGS@
.SUFFIXES:
.SUFFIXES: .po .pox .gmo .mo .msg .cat
.po.pox:
$(MAKE) $(GETTEXT_PACKAGE).pot
$(MSGMERGE) $< $(srcdir)/$(GETTEXT_PACKAGE).pot -o $*.pox
.po.mo:
$(MSGFMT) -o $@ $<
.po.gmo:
$(AM_V_GEN) file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
&& rm -f $$file && $(GMSGFMT) $(MSGFMT_OPTS) -o $$file $<
.po.cat:
sed -f ../intl/po2msg.sed < $< > $*.msg \
&& rm -f $@ && $(GENCAT) $@ $*.msg
all: all-@USE_NLS@
all-yes: $(CATALOGS)
all-no:
$(srcdir)/$(GETTEXT_PACKAGE).pot: $(POTFILES)
$(XGETTEXT) --default-domain=$(GETTEXT_PACKAGE) \
--add-comments --keyword=_ --keyword=N_ \
--keyword=C_:1c,2 \
--keyword=NC_:1c,2 \
--keyword=g_dcgettext:2 \
--keyword=g_dngettext:2,3 \
--keyword=g_dpgettext2:2c,3 \
--flag=N_:1:pass-c-format \
--flag=C_:2:pass-c-format \
--flag=NC_:2:pass-c-format \
--flag=g_dngettext:2:pass-c-format \
--flag=g_strdup_printf:1:c-format \
--flag=g_string_printf:2:c-format \
--flag=g_string_append_printf:2:c-format \
--flag=g_error_new:3:c-format \
--flag=g_set_error:4:c-format \
--flag=g_markup_printf_escaped:1:c-format \
--flag=g_log:3:c-format \
--flag=g_print:1:c-format \
--flag=g_printerr:1:c-format \
--flag=g_printf:1:c-format \
--flag=g_fprintf:2:c-format \
--flag=g_sprintf:2:c-format \
--flag=g_snprintf:3:c-format \
--flag=g_scanner_error:2:c-format \
--flag=g_scanner_warn:2:c-format \
$(POTFILES) \
&& test ! -f $(GETTEXT_PACKAGE).po \
|| ( rm -f $(srcdir)/$(GETTEXT_PACKAGE).pot \
&& mv $(GETTEXT_PACKAGE).po $(srcdir)/$(GETTEXT_PACKAGE).pot )
install: install-exec install-data
install-exec:
install-data: install-data-@USE_NLS@
install-data-no: all
install-data-yes: all
catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
destdir=$(localedir); \
lang=`echo $$cat | sed 's/\.gmo$$//'`; \
dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
mkdir -p $$dir; \
if test -r $$cat; then \
$(INSTALL_DATA) $$cat $$dir/$(GETTEXT_PACKAGE).mo; \
echo "installing $$cat as $$dir/$(GETTEXT_PACKAGE).mo"; \
else \
$(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(GETTEXT_PACKAGE).mo; \
echo "installing $(srcdir)/$$cat as" \
"$$dir/$(GETTEXT_PACKAGE).mo"; \
fi; \
if test -r $$cat.m; then \
$(INSTALL_DATA) $$cat.m $$dir/$(GETTEXT_PACKAGE).mo.m; \
echo "installing $$cat.m as $$dir/$(GETTEXT_PACKAGE).mo.m"; \
else \
if test -r $(srcdir)/$$cat.m ; then \
$(INSTALL_DATA) $(srcdir)/$$cat.m \
$$dir/$(GETTEXT_PACKAGE).mo.m; \
echo "installing $(srcdir)/$$cat as" \
"$$dir/$(GETTEXT_PACKAGE).mo.m"; \
else \
true; \
fi; \
fi; \
done
uninstall:
catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
lang=`echo $$cat | sed 's/\.gmo$$//'`; \
rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \
rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo.m; \
done
check: all
dvi info ctags tags CTAGS TAGS ID:
mostlyclean:
rm -f core core.* *.pox *.old.po cat-id-tbl.tmp
clean: mostlyclean
distclean: clean
rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m $(GMOFILES)
update-po: Makefile
rm -f $(GETTEXT_PACKAGE).pot
$(MAKE) $(GETTEXT_PACKAGE).pot
tmpdir=`pwd`; \
cd $(srcdir); \
catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
lang=`echo $$cat | sed 's/\.gmo$$//'`; \
printf " %s " "$$lang"; \
if $(MSGMERGE) $$lang.po $(GETTEXT_PACKAGE).pot -o $$tmpdir/$$lang.new.po; then \
if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
rm -f $$tmpdir/$$lang.new.po; \
else \
if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
:; \
else \
echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
rm -f $$tmpdir/$$lang.new.po; \
exit 1; \
fi; \
fi; \
else \
echo "msgmerge for $$cat failed!"; \
rm -f $$tmpdir/$$lang.new.po; \
fi; \
done
# POTFILES.in: ./autogen.sh linguas
POTFILES:
cp POTFILES.in POTFILES
Makefile: Makefile.in.in ../config.status POTFILES
cd .. \
&& $(SHELL) ./config.status $(subdir)/$@.in

View File

@ -1,24 +0,0 @@
# List of files which containing translatable strings.
# Package source files
src/about.c
src/child.c
src/gfx.c
src/gtkballs.c
src/gtkutils.c
src/license.c
src/mainmenu.c
src/mainwin.c
src/path.c
src/preferences.c
src/prefs.c
src/rules.c
src/scoreboard.c
src/themerc.c
src/theme.c
src/savegame.c
src/savedialog.c
src/halloffame.c
src/inputname.c
src/rulesdialog.c
src/game.c

6
po/readme.txt Normal file
View File

@ -0,0 +1,6 @@
There's no LINGUAS file..
Just run ./Makefile.in.gen whenever a .po file is added or removed..
and when you want to update the $(POTFILES) (source files that contain translatable strings)

View File

@ -332,9 +332,6 @@ void remake_board(gint numoldchilds, gboolean isnextvalid) {
cxs = gtkbTheme->emptycell.xsize;
cys = gtkbTheme->emptycell.ysize;
gtk_widget_set_size_request(mw_get_da(), rules_get_width() * cxs, rules_get_height() * cys);
if (pixsurf) {
g_object_unref(pixsurf);
}
if (pixsurf) {
cairo_surface_destroy (pixsurf);