Commit cafc00f5 authored by Bernhard Link's avatar Bernhard Link

avoid make distcheck failing because of gv-i18n.h

Make distcheck fails because a gv-i18n.h file is left over
after building and dist-cleaning.

To avoid this make gv-i18n.h not depend on the nls/ directory
(causing rebuilds of this file), but list the languages
to include in a nls/LANGUAGES files.

Additionally move it from EXTRA_DIST to gv_SOURCES proper.

Version 2 of this patch should fix some problems when building
directly from git and documents the replacement of .lnk files
parent 44ebd7d9
......@@ -64,7 +64,7 @@ used instead of GNU gv's own strings.
See my job discription on http://sv.gnu.org/projects/gv for details.
I'll check if they are syntactically correct and copy them to "src/nls" in the
distribution tarball of GNU gv.
distribution tarball of GNU gv and update the src/nls/LANGUAGES file.
......@@ -76,9 +76,10 @@ distribution tarball of GNU gv.
(A) What to do of more locales share the same translation strings?
src/nls/LANGUAGES can contain aliases for languages.
Assume "de_CH.utf8" uses the same translation strings as "de_AT.utf8".
"echo de_AT.utf8 > de_CH.utf8.lnk" will create a translation file for
"de_CH.utf8" that tells GNU gv to use the strings from the locale "de_AT.utf8".
"echo 'de_AT.utf8 -> de_CH.utf8' >> LANGUAGES" tells GNU gv to use the
strings from the locale "de_AT.utf8" for the locale "de_CH.utf8".
......
......@@ -14,7 +14,7 @@ appdefaultsdir = $(pkgdatadir)
appdefaults_DATA = ../GV
EXTRA_DIST=ad2c gv_font_res.dat gv_font_res-I18N_mb.dat gv_layout_res.dat gv-i18n.h gv-i18n.pl gv_misc_res.dat Aaa_bison.yacc \
EXTRA_DIST=ad2c gv_font_res.dat gv_font_res-I18N_mb.dat gv_layout_res.dat gv-i18n.pl gv_misc_res.dat Aaa_bison.yacc \
gv_current.xbm gv_doc.xbm gv_empty.xbm gv_even.xbm gv_icon.xbm gv_odd.xbm \
gv_selected.xbm gv_unmark.xbm $(srcdir)/nls/*
......@@ -144,6 +144,7 @@ gv_SOURCES = Aaa.c \
AaaP.h \
gv_message.h \
types.h \
gv-i18n.h \
gv-update-userconfig.in
BUILT_SOURCES = gv_spartan.h gv_widgetless.h gv_intern_res_unix.h gv_class.h gv-i18n.h
......@@ -211,8 +212,8 @@ gv_class.h : gv_class.ad
@echo "creating gv_class.h"
@sh $(srcdir)/ad2c gv_class.ad > gv_class.h
gv-i18n.h: $(srcdir)/nls $(srcdir)/nls/*
perl $(srcdir)/gv-i18n.pl $(srcdir) > gv-i18n.h
gv-i18n.h: $(srcdir)/nls/LANGUAGES $(srcdir)/nls/*.dat
perl $(srcdir)/gv-i18n.pl $(srcdir) > gv-i18n.h || { rm gv-i18n.h ; exit 1 ; }
gv_class.ad : $(srcdir)/gv_font_res.dat $(srcdir)/gv_font_res-I18N_mb.dat $(srcdir)/gv_layout_res.dat gv_make_res.dat $(srcdir)/gv_misc_res.dat $(srcdir)/gv_user_res.dat gv_intern_res_unix.dat
@echo "creating gv_class.ad"
......
......@@ -3,42 +3,35 @@
$src = ".";
$src = $ARGV[0] if @ARGV == 1;
@languages = <$src/nls/*>;
open(LANGUAGES, '<', "$src/nls/LANGUAGES");
s!#.*!! for (@languages);
s!^$src/nls/!!g for (@languages);
@languages = reverse sort @languages;
@languages = <LANGUAGES>;
%lang2 = ();
for $lang (@languages)
{
next if $lang !~ m/((\.dat))$/;
chomp($lang);
next if $lang =~ m/ -> /;
next if $lang =~ m/^$/;
$lang2 = $lang;
$lang2 =~ s/[^a-zA-Z_0-9]/_/g;
print "static String gv_nls_${lang2} [] = {\n";
system "$src/ad2c $src/nls/$lang";
print "static String gv_nls_${lang2}_dat [] = {\n";
(system "$src/ad2c '$src/nls/$lang'.dat") == 0 or die "failed to process $src/nls/${lang}.dat" ;
print "0};\n\n";
}
print "static String* getI18N(char* locale)\n{\n";
for $lang (@languages)
{
next if $lang !~ m/((\.dat)|(\.lnk))$/;
next if $lang =~ m/^$/;
$lang2 = $lang;
if ($lang =~ /\.lnk$/ )
{
open($file, "<", "$src/nls/$lang") or die "Cannot read file $lang";
$lang2 = <$file>;
chomp $lang2;
close($lang);
}
$lang2 =~ s/^.* -> //g;
$lang2 =~ s/[^a-zA-Z_0-9]/_/g;
$lang3 = $lang;
$lang3 =~ s/\.lnk$//g;
$lang3 =~ s/\.dat$//g;
print " if (!strcmp(locale, \"$lang3\")) return gv_nls_$lang2;\n";
$lang3 =~ s/ -> .*$//g;
print " if (!strcmp(locale, \"$lang3\")) return gv_nls_${lang2}_dat;\n";
}
print " return 0;\n}\n";
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment