summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2008-02-18 12:17:34 +0000
committerDaniel Stenberg <daniel@haxx.se>2008-02-18 12:17:34 +0000
commit8ebbe99328248d45f3937c4f15f936d5d36f4a58 (patch)
tree58dfa9555171528528912a8cb6109d351ea767eb
parent43141cbfdb247b7e64bc3d3d5732f43732d59da0 (diff)
downloadrockbox-8ebbe99328248d45f3937c4f15f936d5d36f4a58.tar.gz
rockbox-8ebbe99328248d45f3937c4f15f936d5d36f4a58.zip
FS#8482 take two. Make the language files built first, so that the largest
size can be used as buffer size for languages. Work to this also contributed by Jonas Haggqvist. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16343 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/FILES1
-rw-r--r--apps/lang/Makefile37
-rw-r--r--apps/lang/SOURCES35
-rw-r--r--apps/language.h12
-rwxr-xr-xtools/buildzip.pl35
-rwxr-xr-xtools/configure16
-rw-r--r--tools/make.inc10
-rw-r--r--tools/makesrc.inc4
8 files changed, 108 insertions, 42 deletions
diff --git a/apps/FILES b/apps/FILES
index 36e3924158..956b12a04c 100644
--- a/apps/FILES
+++ b/apps/FILES
@@ -41,6 +41,7 @@ codecs/Tremor/*
41eqs/*.cfg 41eqs/*.cfg
42gui/*.[ch] 42gui/*.[ch]
43keymaps/*.[ch] 43keymaps/*.[ch]
44lang/SOURCES
44lang/*.lang 45lang/*.lang
45menus/*.[ch] 46menus/*.[ch]
46metadata/*.[ch] 47metadata/*.[ch]
diff --git a/apps/lang/Makefile b/apps/lang/Makefile
index e69de29bb2..bcaaa692a0 100644
--- a/apps/lang/Makefile
+++ b/apps/lang/Makefile
@@ -0,0 +1,37 @@
1# __________ __ ___.
2# Open \______ \ ____ ____ | | _\_ |__ _______ ___
3# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6# \/ \/ \/ \/ \/
7# $Id: $
8#
9
10# the header we generate
11HEADER = $(BUILDDIR)/max_language_size.h
12
13# This sets up 'SRC' based on the files mentioned in SOURCES
14include $(TOOLSDIR)/makesrc.inc
15SOURCES=$(SRC)
16
17# OUTP is the list of files to depend upon
18OUTP = $(patsubst %.lang,$(OBJDIR)/%.lng, $(SOURCES))
19
20# the generated file with features specified genlang-style
21FEATS=$(BUILDDIR)/apps/genlang-features
22
23ifndef V
24SILENT=@
25endif
26PRINTS=$(SILENT)$(call info,$(1))
27
28all: $(HEADER)
29
30# generic rule for creating .lng from .lang
31$(OBJDIR)/%.lng : %.lang $(FEATS)
32 $(call PRINTS,GENLANG $<)
33 $(SILENT)$(TOOLSDIR)/genlang -e=$(APPSDIR)/lang/english.lang -t=$(MODELNAME)`cat $(FEATS)` -i=$(TARGET_ID) -b=$@ $<
34
35$(HEADER): $(OUTP)
36 $(call PRINTS,Make $(HEADER))
37 echo "#define MAX_LANGUAGE_SIZE `du -b $(OBJDIR)/* |sort -n |tail -n 1 |cut -f 1`" > $(HEADER)
diff --git a/apps/lang/SOURCES b/apps/lang/SOURCES
index e69de29bb2..af546460a2 100644
--- a/apps/lang/SOURCES
+++ b/apps/lang/SOURCES
@@ -0,0 +1,35 @@
1#ifdef HAVE_LCD_BITMAP /* Not for the Player */
2*.lang
3#else
4afrikaans.lang
5bulgarian.lang
6catala.lang
7czech.lang
8dansk.lang
9deutsch.lang
10eesti.lang
11english.lang
12espanol.lang
13esperanto.lang
14finnish.lang
15francais.lang
16galego.lang
17greek.lang
18hebrew.lang
19islenska.lang
20italiano.lang
21magyar.lang
22nederlands.lang
23norsk.lang
24norsk-nynorsk.lang
25polski.lang
26portugues-brasileiro.lang
27portugues.lang
28romaneste.lang
29russian.lang
30slovenscina.lang
31svenska.lang
32tagalog.lang
33turkce.lang
34wallisertitsch.lang
35#endif /* HAVE_LCD_BITMAP */
diff --git a/apps/language.h b/apps/language.h
index d8f899b573..14c8084a83 100644
--- a/apps/language.h
+++ b/apps/language.h
@@ -1,3 +1,5 @@
1#ifndef __LANGUAGE_H
2#define __LANGUAGE_H
1/*************************************************************************** 3/***************************************************************************
2 * __________ __ ___. 4 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 5 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
@@ -7,7 +9,7 @@
7 * \/ \/ \/ \/ \/ 9 * \/ \/ \/ \/ \/
8 * $Id$ 10 * $Id$
9 * 11 *
10 * Copyright (C) 2002 Daniel Stenberg 12 * Copyright (C) 2002, 2008 Daniel Stenberg
11 * 13 *
12 * All files in this archive are subject to the GNU General Public License. 14 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement. 15 * See the file COPYING in the source tree root for full license agreement.
@@ -17,8 +19,10 @@
17 * 19 *
18 ****************************************************************************/ 20 ****************************************************************************/
19 21
20/* size of the buffer used for loadable, translated strings */ 22/* The following header is generated by the build system and only defines
21#define MAX_LANGUAGE_SIZE 23500 23 MAX_LANGUAGE_SIZE to be the size of the largest currently available
24 language! */
25#include "max_language_size.h"
22 26
23/* both these must match the two initial bytes in the binary lang file */ 27/* both these must match the two initial bytes in the binary lang file */
24#define LANGUAGE_COOKIE 0x1a 28#define LANGUAGE_COOKIE 0x1a
@@ -29,3 +33,5 @@ void lang_init(void);
29 33
30/* load a given language file */ 34/* load a given language file */
31int lang_load(const char *filename); 35int lang_load(const char *filename);
36
37#endif
diff --git a/tools/buildzip.pl b/tools/buildzip.pl
index 4c21ae819f..4faa38ac54 100755
--- a/tools/buildzip.pl
+++ b/tools/buildzip.pl
@@ -154,30 +154,6 @@ sub filesize {
154 return $size; 154 return $size;
155} 155}
156 156
157sub buildlangs {
158 my ($outputlang)=@_;
159 my $dir = "$ROOT/apps/lang";
160 opendir(DIR, $dir);
161 my @files = grep { /\.lang$/ } readdir(DIR);
162 closedir(DIR);
163
164 # Exclude some bad languages (uncomment and adjust in case of release
165 # and/or End Times)
166 # @files = grep(!/(afrikaans|hindi|slovenscina|turkce)\.lang/, @files);
167
168 # Exclude more languages on the player which won't work on charcell display
169 if ($archos =~ /^"?player:/ ) {
170 @files = grep(!/(chinese-simp|chinese-trad|hindi|japanese|korean|thai)\.lang/, @files);
171 }
172
173 for(@files) {
174 my $output = $_;
175 $output =~ s/(.*)\.lang/$1.lng/;
176 print "$ROOT/tools/genlang -e=$dir/english.lang -t=$archos -i=$target_id -b=$outputlang/$output $dir/$_\n" if($verbose);
177 system ("$ROOT/tools/genlang -e=$dir/english.lang -t=$archos -i=$target_id -b=$outputlang/$output $dir/$_ >/dev/null 2>&1");
178 }
179}
180
181sub buildzip { 157sub buildzip {
182 my ($zip, $image, $fonts)=@_; 158 my ($zip, $image, $fonts)=@_;
183 159
@@ -413,15 +389,8 @@ STOP
413 # and the info file 389 # and the info file
414 system("cp rockbox-info.txt .rockbox/"); 390 system("cp rockbox-info.txt .rockbox/");
415 391
416 # now copy the file made for reading on the unit: 392 # copy the already built lng files
417 #if($notplayer) { 393 `cp apps/lang/*lng .rockbox/langs/`
418 # `cp $webroot/docs/Help-JBR.txt .rockbox/docs/`;
419 #}
420 #else {
421 # `cp $webroot/docs/Help-Stu.txt .rockbox/docs/`;
422 #}
423
424 buildlangs(".rockbox/langs");
425 394
426} 395}
427 396
diff --git a/tools/configure b/tools/configure
index 49773e1a6f..e1ca5be190 100755
--- a/tools/configure
+++ b/tools/configure
@@ -1785,6 +1785,11 @@ else
1785 voicetoolset="voicefont wavtrim" 1785 voicetoolset="voicefont wavtrim"
1786fi 1786fi
1787 1787
1788if test "$apps" = "apps"; then
1789 # only when we build "real" apps we build the .lng files
1790 buildlangs="langs"
1791fi
1792
1788sed > Makefile \ 1793sed > Makefile \
1789 -e "s,@ROOTDIR@,${rootdir},g" \ 1794 -e "s,@ROOTDIR@,${rootdir},g" \
1790 -e "s,@DEBUG@,${debug},g" \ 1795 -e "s,@DEBUG@,${debug},g" \
@@ -1842,6 +1847,7 @@ sed > Makefile \
1842 -e "s,@TTS_ENGINE@,${TTS_ENGINE},g" \ 1847 -e "s,@TTS_ENGINE@,${TTS_ENGINE},g" \
1843 -e "s,@TTS_OPTS@,${TTS_OPTS},g" \ 1848 -e "s,@TTS_OPTS@,${TTS_OPTS},g" \
1844 -e "s,@VOICETOOLSET@,${voicetoolset},g" \ 1849 -e "s,@VOICETOOLSET@,${voicetoolset},g" \
1850 -e "s,@LANGS@,${buildlangs},g" \
1845<<EOF 1851<<EOF
1846## Automaticly generated. http://www.rockbox.org/ 1852## Automaticly generated. http://www.rockbox.org/
1847 1853
@@ -1919,14 +1925,14 @@ export ENCODER=@ENCODER@
1919# Do not print "Entering directory ..." 1925# Do not print "Entering directory ..."
1920MAKEFLAGS += --no-print-directory 1926MAKEFLAGS += --no-print-directory
1921 1927
1922.PHONY: all clean tags zip tools manual bin build info 1928.PHONY: all clean tags zip tools manual bin build info langs
1923 1929
1924all: info 1930all: info
1925 1931
1926info: build 1932info: build
1927 \$(SILENT)\$(TOOLSDIR)/mkinfo.pl \$(BUILDDIR)/rockbox-info.txt 1933 \$(SILENT)\$(TOOLSDIR)/mkinfo.pl \$(BUILDDIR)/rockbox-info.txt
1928 1934
1929build: tools 1935build: tools @LANGS@
1930 @SIMUL1@ 1936 @SIMUL1@
1931 @SIMUL2@ 1937 @SIMUL2@
1932 \$(SILENT)\$(MAKE) -C \$(FIRMDIR) OBJDIR=\$(BUILDDIR)/firmware 1938 \$(SILENT)\$(MAKE) -C \$(FIRMDIR) OBJDIR=\$(BUILDDIR)/firmware
@@ -1952,7 +1958,7 @@ clean:
1952 manual *.pdf *.a credits.raw @OUTPUT@ bitmaps pluginbitmaps \ 1958 manual *.pdf *.a credits.raw @OUTPUT@ bitmaps pluginbitmaps \
1953 @ARCHOSROM@ @FLASHFILE@ UI256.bmp rockbox-full.zip \ 1959 @ARCHOSROM@ @FLASHFILE@ UI256.bmp rockbox-full.zip \
1954 html txt rockbox-manual*.zip sysfont.h rockbox-info.txt \ 1960 html txt rockbox-manual*.zip sysfont.h rockbox-info.txt \
1955 voicefontids *.wav *.mp3 *.voice 1961 voicefontids *.wav *.mp3 *.voice max_language_size.h
1956 1962
1957tools: 1963tools:
1958 \$(SILENT)\$(MAKE) -C \$(TOOLSDIR) CC=\$(HOSTCC) AR=\$(HOSTAR) @TOOLSET@ 1964 \$(SILENT)\$(MAKE) -C \$(TOOLSDIR) CC=\$(HOSTCC) AR=\$(HOSTAR) @TOOLSET@
@@ -1996,6 +2002,10 @@ bzip2: tar
1996gzip: tar 2002gzip: tar
1997 \$(SILENT)gzip -f9 rockbox.tar 2003 \$(SILENT)gzip -f9 rockbox.tar
1998 2004
2005langs: features
2006 \$(SILENT)mkdir -p \$(BUILDDIR)/apps/lang
2007 \$(SILENT)\$(MAKE) -C \$(APPSDIR)/lang OBJDIR=\$(BUILDDIR)/apps/lang
2008
1999manual: manual-pdf 2009manual: manual-pdf
2000manual-pdf: 2010manual-pdf:
2001 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-pdf 2011 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-pdf
diff --git a/tools/make.inc b/tools/make.inc
index 8e125c834e..d9f4c14cf4 100644
--- a/tools/make.inc
+++ b/tools/make.inc
@@ -24,6 +24,11 @@ $(OBJDIR)/%.o: %.S
24# play nicely into this as it then adds a dependency to the lang.h file 24# play nicely into this as it then adds a dependency to the lang.h file
25# without the proper path. 25# without the proper path.
26# 26#
27# The trailing sed hack for a range of files is present because how gcc works
28# for generating dependencies when the include file doesn't exist. Then it
29# makes the dependency without any path, and that breaks how things work for
30# us. We thus add the correct path for a few generated files!
31#
27$(DEPFILE): $(SOURCES) 32$(DEPFILE): $(SOURCES)
28 $(SILENT)mkdir -p $(dir $(DEPFILE)) 33 $(SILENT)mkdir -p $(dir $(DEPFILE))
29 $(SILENT)rm -f $(DEPFILE) 34 $(SILENT)rm -f $(DEPFILE)
@@ -40,7 +45,10 @@ $(DEPFILE): $(SOURCES)
40 rm $$del; \ 45 rm $$del; \
41 del=""; \ 46 del=""; \
42 fi \ 47 fi \
43 done | sed -e "s:[^[:space:]]*lang.h:$(OBJDIR)/lang.o:" > $(DEPFILE); \ 48 done | sed -e "s:[^[:space:]]*lang.h:$(OBJDIR)/lang.o:" \
49 -e "s:[^[:space:]]*sysfont.h:$(BUILDDIR)/sysfont.h:" \
50 -e "s:[^[:space:]]*max_language_size.h:$(BUILDDIR)/max_language_size.h:" \
51 > $(DEPFILE); \
44 echo "oo" > /dev/null ) 52 echo "oo" > /dev/null )
45 53
46tags: 54tags:
diff --git a/tools/makesrc.inc b/tools/makesrc.inc
index 78d97f3283..846df8cb9e 100644
--- a/tools/makesrc.inc
+++ b/tools/makesrc.inc
@@ -10,5 +10,5 @@
10# to make this do right when used on Mac OS X. 10# to make this do right when used on Mac OS X.
11 11
12SRC := $(shell cat SOURCES | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) \ 12SRC := $(shell cat SOURCES | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) \
13$(TARGET) $(DEFINES) $(EXTRA_DEFINES) -E -P -include "config.h" - | \ 13$(TARGET) $(DEFINES) $(EXTRA_DEFINES) -E -P -include "config.h" - 2>/dev/null \
14grep -v "^\#") 14| grep -v "^\#")