diff options
author | Daniel Stenberg <daniel@haxx.se> | 2008-02-18 12:17:34 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2008-02-18 12:17:34 +0000 |
commit | 8ebbe99328248d45f3937c4f15f936d5d36f4a58 (patch) | |
tree | 58dfa9555171528528912a8cb6109d351ea767eb | |
parent | 43141cbfdb247b7e64bc3d3d5732f43732d59da0 (diff) | |
download | rockbox-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/FILES | 1 | ||||
-rw-r--r-- | apps/lang/Makefile | 37 | ||||
-rw-r--r-- | apps/lang/SOURCES | 35 | ||||
-rw-r--r-- | apps/language.h | 12 | ||||
-rwxr-xr-x | tools/buildzip.pl | 35 | ||||
-rwxr-xr-x | tools/configure | 16 | ||||
-rw-r--r-- | tools/make.inc | 10 | ||||
-rw-r--r-- | tools/makesrc.inc | 4 |
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/* | |||
41 | eqs/*.cfg | 41 | eqs/*.cfg |
42 | gui/*.[ch] | 42 | gui/*.[ch] |
43 | keymaps/*.[ch] | 43 | keymaps/*.[ch] |
44 | lang/SOURCES | ||
44 | lang/*.lang | 45 | lang/*.lang |
45 | menus/*.[ch] | 46 | menus/*.[ch] |
46 | metadata/*.[ch] | 47 | metadata/*.[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 | ||
11 | HEADER = $(BUILDDIR)/max_language_size.h | ||
12 | |||
13 | # This sets up 'SRC' based on the files mentioned in SOURCES | ||
14 | include $(TOOLSDIR)/makesrc.inc | ||
15 | SOURCES=$(SRC) | ||
16 | |||
17 | # OUTP is the list of files to depend upon | ||
18 | OUTP = $(patsubst %.lang,$(OBJDIR)/%.lng, $(SOURCES)) | ||
19 | |||
20 | # the generated file with features specified genlang-style | ||
21 | FEATS=$(BUILDDIR)/apps/genlang-features | ||
22 | |||
23 | ifndef V | ||
24 | SILENT=@ | ||
25 | endif | ||
26 | PRINTS=$(SILENT)$(call info,$(1)) | ||
27 | |||
28 | all: $(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 | ||
4 | afrikaans.lang | ||
5 | bulgarian.lang | ||
6 | catala.lang | ||
7 | czech.lang | ||
8 | dansk.lang | ||
9 | deutsch.lang | ||
10 | eesti.lang | ||
11 | english.lang | ||
12 | espanol.lang | ||
13 | esperanto.lang | ||
14 | finnish.lang | ||
15 | francais.lang | ||
16 | galego.lang | ||
17 | greek.lang | ||
18 | hebrew.lang | ||
19 | islenska.lang | ||
20 | italiano.lang | ||
21 | magyar.lang | ||
22 | nederlands.lang | ||
23 | norsk.lang | ||
24 | norsk-nynorsk.lang | ||
25 | polski.lang | ||
26 | portugues-brasileiro.lang | ||
27 | portugues.lang | ||
28 | romaneste.lang | ||
29 | russian.lang | ||
30 | slovenscina.lang | ||
31 | svenska.lang | ||
32 | tagalog.lang | ||
33 | turkce.lang | ||
34 | wallisertitsch.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 */ |
31 | int lang_load(const char *filename); | 35 | int 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 | ||
157 | sub 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 | |||
181 | sub buildzip { | 157 | sub 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" |
1786 | fi | 1786 | fi |
1787 | 1787 | ||
1788 | if test "$apps" = "apps"; then | ||
1789 | # only when we build "real" apps we build the .lng files | ||
1790 | buildlangs="langs" | ||
1791 | fi | ||
1792 | |||
1788 | sed > Makefile \ | 1793 | sed > 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 ..." |
1920 | MAKEFLAGS += --no-print-directory | 1926 | MAKEFLAGS += --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 | ||
1924 | all: info | 1930 | all: info |
1925 | 1931 | ||
1926 | info: build | 1932 | info: build |
1927 | \$(SILENT)\$(TOOLSDIR)/mkinfo.pl \$(BUILDDIR)/rockbox-info.txt | 1933 | \$(SILENT)\$(TOOLSDIR)/mkinfo.pl \$(BUILDDIR)/rockbox-info.txt |
1928 | 1934 | ||
1929 | build: tools | 1935 | build: 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 | ||
1957 | tools: | 1963 | tools: |
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 | |||
1996 | gzip: tar | 2002 | gzip: tar |
1997 | \$(SILENT)gzip -f9 rockbox.tar | 2003 | \$(SILENT)gzip -f9 rockbox.tar |
1998 | 2004 | ||
2005 | langs: features | ||
2006 | \$(SILENT)mkdir -p \$(BUILDDIR)/apps/lang | ||
2007 | \$(SILENT)\$(MAKE) -C \$(APPSDIR)/lang OBJDIR=\$(BUILDDIR)/apps/lang | ||
2008 | |||
1999 | manual: manual-pdf | 2009 | manual: manual-pdf |
2000 | manual-pdf: | 2010 | manual-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 | ||
46 | tags: | 54 | tags: |
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 | ||
12 | SRC := $(shell cat SOURCES | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) \ | 12 | SRC := $(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 \ |
14 | grep -v "^\#") | 14 | | grep -v "^\#") |