gnome-calculator: new package (i16n WIP).

This commit is contained in:
Andrea Zagli
2015-03-26 14:49:33 +01:00
parent 55c9830ba6
commit d85b178bf3
4 changed files with 369 additions and 0 deletions

View File

@@ -0,0 +1,290 @@
--- ./m4/intltool.m4.orig 2015-03-22 19:20:14.000000000 +0100
+++ ./m4/intltool.m4 2015-03-26 13:46:45.996450400 +0100
@@ -155,31 +155,6 @@
# Substitute ALL_LINGUAS so we can use it in po/Makefile
AC_SUBST(ALL_LINGUAS)
-# Set DATADIRNAME correctly if it is not set yet
-# (copied from glib-gettext.m4)
-if test -z "$DATADIRNAME"; then
- AC_LINK_IFELSE(
- [AC_LANG_PROGRAM([[]],
- [[extern int _nl_msg_cat_cntr;
- return _nl_msg_cat_cntr]])],
- [DATADIRNAME=share],
- [case $host in
- *-*-solaris*)
- dnl On Solaris, if bind_textdomain_codeset is in libc,
- dnl GNU format message catalog is always supported,
- dnl since both are added to the libc all together.
- dnl Hence, we'd like to go with DATADIRNAME=share
- dnl in this case.
- AC_CHECK_FUNC(bind_textdomain_codeset,
- [DATADIRNAME=share], [DATADIRNAME=lib])
- ;;
- *)
- [DATADIRNAME=lib]
- ;;
- esac])
-fi
-AC_SUBST(DATADIRNAME)
-
IT_PO_SUBDIR([po])
])
--- ./Makefile.am.orig 2015-01-29 16:28:18.000000000 +0100
+++ ./Makefile.am 2015-03-26 13:46:46.046485300 +0100
@@ -1,4 +1,4 @@
-SUBDIRS = po src search-provider data help
+SUBDIRS = po src search-provider data
# Temporary fix for JHBuild, see https://bugzilla.gnome.org/show_bug.cgi?id=641652
ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} -I m4
--- ./po/Makefile.in.in.orig 2015-03-22 19:20:14.000000000 +0100
+++ ./po/Makefile.in.in 2015-03-26 13:46:46.049487500 +0100
@@ -33,8 +33,7 @@
datadir = @datadir@
datarootdir = @datarootdir@
libdir = @libdir@
-DATADIRNAME = @DATADIRNAME@
-itlocaledir = $(prefix)/$(DATADIRNAME)/locale
+localedir = @localedir@
subdir = po
install_sh = @install_sh@
# Automake >= 1.8 provides @mkdir_p@.
@@ -108,7 +107,7 @@
install-data-yes: all
linguas="$(USE_LINGUAS)"; \
for lang in $$linguas; do \
- dir=$(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES; \
+ dir=$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES; \
$(mkdir_p) $$dir; \
if test -r $$lang.gmo; then \
$(INSTALL_DATA) $$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \
@@ -142,8 +141,8 @@
uninstall:
linguas="$(USE_LINGUAS)"; \
for lang in $$linguas; do \
- rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \
- rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo.m; \
+ rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \
+ rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo.m; \
done
check: all $(GETTEXT_PACKAGE).pot
--- ./search-provider/Makefile.am.orig 2015-01-29 16:28:18.000000000 +0100
+++ ./search-provider/Makefile.am 2015-03-26 13:46:46.051488900 +0100
@@ -1,6 +1,12 @@
+# The valac command is always executed in the sources directory, not the build
+# directory. If $(top_srcdir) is used, it will be relative to the build directory.
+vapidir = ../vapi
+
+
libexec_PROGRAMS = gnome-calculator-search-provider
gnome_calculator_search_provider_SOURCES = \
+ $(vapidir)/windows.vapi \
search-provider.vala
gnome_calculator_search_provider_VALAFLAGS = \
--- ./search-provider/search-provider.vala.orig 2015-01-29 16:28:18.000000000 +0100
+++ ./search-provider/search-provider.vala 2015-03-26 13:46:46.053490400 +0100
@@ -23,11 +23,13 @@
{
int exit_status;
- var tsep_string = Posix.nl_langinfo (Posix.NLItem.THOUSEP);
+ string tsep_string;
+ Windows.GetLocaleInfo(0x0400, 0x0000000f, out tsep_string, 4);
if (tsep_string == null || tsep_string == "")
tsep_string = " ";
- var decimal = Posix.nl_langinfo (Posix.NLItem.RADIXCHAR);
+ string decimal;
+ Windows.GetLocaleInfo(0x0400, 0x0000000e, out decimal, 4);
if (decimal == null)
decimal = "";
--- ./src/gcalccmd.vala.orig 2015-01-29 16:28:18.000000000 +0100
+++ ./src/gcalccmd.vala 2015-03-26 13:46:46.055491800 +0100
@@ -15,11 +15,13 @@
static void solve (string equation)
{
- var tsep_string = Posix.nl_langinfo (Posix.NLItem.THOUSEP);
+ string tsep_string;
+ Windows.GetLocaleInfo(0x0400, 0x0000000f, out tsep_string, 4);
if (tsep_string == null || tsep_string == "")
tsep_string = " ";
- var decimal = Posix.nl_langinfo (Posix.NLItem.RADIXCHAR);
+ string decimal;
+ Windows.GetLocaleInfo(0x0400, 0x0000000e, out decimal, 4);
if (decimal == null)
decimal = "";
@@ -82,5 +84,5 @@
if (requires_new_line)
stdout.printf ("\n");
- return Posix.EXIT_SUCCESS;
+ return 0;
}
--- ./src/gnome-calculator.vala.orig 2015-01-29 16:28:18.000000000 +0100
+++ ./src/gnome-calculator.vala 2015-03-26 13:46:46.058494000 +0100
@@ -142,17 +142,20 @@
{
/* NOTE: Is not translated so can be easily parsed */
stderr.printf ("%1$s %2$s\n", program_name, VERSION);
- return Posix.EXIT_SUCCESS;
+ return 0;
}
if (options.contains ("solve"))
{
var solve_equation = (string) options.lookup_value ("solve", VariantType.STRING);
- var tsep_string = Posix.nl_langinfo (Posix.NLItem.THOUSEP);
+
+ string tsep_string;
+ Windows.GetLocaleInfo(0x0400, 0x0000000f, out tsep_string, 4);
if (tsep_string == null || tsep_string == "")
tsep_string = " ";
- var decimal = Posix.nl_langinfo (Posix.NLItem.RADIXCHAR);
+ string decimal;
+ Windows.GetLocaleInfo(0x0400, 0x0000000e, out decimal, 4);
if (decimal == null)
decimal = "";
@@ -169,17 +172,17 @@
var serializer = new Serializer (DisplayFormat.AUTOMATIC, 10, 9);
serializer.set_representation_base (representation_base);
stdout.printf ("%s\n", serializer.to_string (result));
- return Posix.EXIT_SUCCESS;
+ return 0;
}
else if (error == ErrorCode.MP)
{
stderr.printf ("Error: %s\n", Number.error);
- return Posix.EXIT_FAILURE;
+ return 1;
}
else
{
stderr.printf ("Error: %s\n", mp_error_code_to_string (error));
- return Posix.EXIT_FAILURE;
+ return 1;
}
}
@@ -264,7 +267,10 @@
public static int main (string[] args)
{
Intl.setlocale (LocaleCategory.ALL, "");
- Intl.bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR);
+
+ string p = Win32.get_package_installation_directory_of_module (null);
+ Intl.bindtextdomain (GETTEXT_PACKAGE, Path.build_filename (p, "share", "locale"));
+
Intl.bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
Intl.textdomain (GETTEXT_PACKAGE);
--- ./src/Makefile.am.orig 2015-01-29 16:28:18.000000000 +0100
+++ ./src/Makefile.am 2015-03-26 13:46:46.060512900 +0100
@@ -1,6 +1,10 @@
bin_PROGRAMS = gnome-calculator gcalccmd
noinst_PROGRAMS = test-number test-equation test-serializer
+# The valac command is always executed in the sources directory, not the build
+# directory. If $(top_srcdir) is used, it will be relative to the build directory.
+vapidir = ../vapi
+
TESTS = test-number test-equation test-serializer
AM_CPPFLAGS = \
@@ -17,6 +21,7 @@
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(top_srcdir)/data/ --generate-source $<
gnome_calculator_SOURCES = \
+ $(vapidir)/windows.vapi \
config.vapi \
mpfr.vapi \
gnome-calculator.vala \
@@ -55,6 +60,7 @@
-lgmp
gcalccmd_SOURCES = \
+ $(vapidir)/windows.vapi \
config.vapi \
mpfr.vapi \
gcalccmd.vala \
@@ -80,6 +86,7 @@
-lgmp
test_number_SOURCES = \
+ $(vapidir)/windows.vapi \
config.vapi \
mpfr.vapi \
test-number.vala \
@@ -99,6 +106,7 @@
-lgmp
test_equation_SOURCES = \
+ $(vapidir)/windows.vapi \
config.vapi \
mpfr.vapi \
test-equation.vala \
@@ -124,6 +132,7 @@
-lgmp
test_serializer_SOURCES = \
+ $(vapidir)/windows.vapi \
config.vapi \
mpfr.vapi \
test-serializer.vala \
--- ./src/math-equation.vala.orig 2015-01-29 16:28:18.000000000 +0100
+++ ./src/math-equation.vala 2015-03-26 13:46:46.063497600 +0100
@@ -477,7 +477,8 @@
get_bounds (out start, out end);
var text = get_text (start, end, false);
- var tsep_string = Posix.nl_langinfo (Posix.NLItem.THOUSEP);
+ string tsep_string;
+ Windows.GetLocaleInfo(0x0400, 0x0000000f, out tsep_string, 4);
if (tsep_string == null || tsep_string == "")
tsep_string = " ";
text = text.replace (tsep_string, "");
--- ./src/serializer.vala.orig 2015-01-29 16:28:18.000000000 +0100
+++ ./src/serializer.vala 2015-03-26 14:37:21.466912900 +0100
@@ -37,15 +37,18 @@
public Serializer (DisplayFormat format, int number_base, int trailing_digits)
{
- var radix_string = Posix.nl_langinfo (Posix.NLItem.RADIXCHAR);
+ /*string radix_string;
+ Windows.GetLocaleInfo(0x0400, 0x0000000e, out radix_string, 4);
if (radix_string != null && radix_string != "")
radix = radix_string.locale_to_utf8 (-1, null, null).get_char (0);
- else
+ else*/
radix = '.';
- var tsep_string = Posix.nl_langinfo (Posix.NLItem.THOUSEP);
+
+ /*string tsep_string;
+ Windows.GetLocaleInfo(0x0400, 0x0000000f, out tsep_string, 4);
if (tsep_string != null && tsep_string != "")
tsep = tsep_string.locale_to_utf8 (-1, null, null).get_char (0);
- else
+ else*/
tsep = ' ';
tsep_count = 3;
--- ./vapi/windows.vapi.orig 2015-03-26 13:46:45.987442900 +0100
+++ ./vapi/windows.vapi 2015-03-26 13:46:46.068501200 +0100
@@ -1 +1,6 @@
+[CCode (lower_case_cprefix="", cheader_filename="winnls.h")]
+namespace Windows
+{
+ public int GetLocaleInfo (int locale, int LCType, out string lpLCData, int cchData);
+}

View File

@@ -0,0 +1,57 @@
# Maintainer: Andrea Zagli <andrea.zagli.free@gmail.com>
_realname=gnome-calculator
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=3.16.0
pkgrel=1
arch=('any')
pkgdesc="GNOME desktop calculator (mingw-w64)"
options=(!strip staticlibs)
depends=("${MINGW_PACKAGE_PREFIX}-glib2"
"${MINGW_PACKAGE_PREFIX}-gtk3"
"${MINGW_PACKAGE_PREFIX}-gtksourceview3"
"${MINGW_PACKAGE_PREFIX}-gsettings-desktop-schemas"
"${MINGW_PACKAGE_PREFIX}-libxml2"
"${MINGW_PACKAGE_PREFIX}-mpfr")
makedepends=("${MINGW_PACKAGE_PREFIX}-pkg-config"
"${MINGW_PACKAGE_PREFIX}-vala"
"${MINGW_PACKAGE_PREFIX}-gobject-introspection")
license=("GPL 2")
url="http://www.gnome.org"
install=${_realname}-${CARCH}.install
source=(http://ftp.gnome.org/pub/gnome/sources/${_realname}/${pkgver%.*}/${_realname}-$pkgver.tar.xz
001-win.patch)
sha256sums=('bbc2fbc4692e30a2b12755bf79a4dce6288b5d419f81331d738a47da27b71519'
'93ffcebe9de2ed50c3b57453cad082690eed39616876bf77b0445cc75ac45a7f')
prepare() {
cd "${srcdir}"/${_realname}-${pkgver}
mkdir vapi
echo "" > vapi/windows.vapi
patch -b -V simple -p1 -i ${srcdir}/001-win.patch
autoreconf -f -i
}
build() {
mkdir -p build-${MINGW_CHOST}
cd build-${MINGW_CHOST}
../${_realname}-${pkgver}/configure \
--host=${MINGW_CHOST} \
--target=${MINGW_CHOST} \
--build=${MINGW_CHOST} \
--prefix=${MINGW_PREFIX} \
--libexecdir=${MINGW_PREFIX}/lib
make
}
package() {
cd "$srcdir/build-${MINGW_CHOST}"
make DESTDIR=$pkgdir install
install -Dm644 "${srcdir}/${_realname}-${pkgver}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
}

View File

@@ -0,0 +1,11 @@
post_install() {
mingw32/bin/glib-compile-schemas mingw32/share/glib-2.0/schemas
}
post_upgrade() {
post_install $1
}
post_remove() {
post_install $1
}

View File

@@ -0,0 +1,11 @@
post_install() {
mingw64/bin/glib-compile-schemas mingw64/share/glib-2.0/schemas
}
post_upgrade() {
post_install $1
}
post_remove() {
post_install $1
}