Skip to content

Commit 0b1d99b

Browse files
committed
Add the necessary bits to build gecko on ICS
1 parent 58ae4dd commit 0b1d99b

File tree

5 files changed

+186
-5
lines changed

5 files changed

+186
-5
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,3 +349,6 @@
349349
[submodule "glue/gonk/external/busybox"]
350350
path = glue/gonk/external/busybox
351351
url = git://android.git.linaro.org/platform/external/busybox.git
352+
[submodule "toolchains"]
353+
path = toolchains
354+
url = git://github.com/mozilla-b2g/b2g-toolchains.git

Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ GONK_BASE ?= glue/gonk
1616
FASTBOOT ?= $(abspath $(GONK_BASE)/out/host/linux-x86/bin/fastboot)
1717
HEIMDALL ?= heimdall
1818
TOOLCHAIN_HOST = linux-x86
19-
TOOLCHAIN_PATH = $(GONK_BASE)/prebuilt/$(TOOLCHAIN_HOST)/toolchain/arm-eabi-4.4.3/bin
19+
TOOLCHAIN_PATH ?= $(GONK_BASE)/prebuilt/$(TOOLCHAIN_HOST)/toolchain/arm-eabi-4.4.3/bin
2020

2121
GAIA_PATH ?= $(abspath gaia)
2222
GECKO_PATH ?= $(abspath gecko)
@@ -183,7 +183,7 @@ define GECKO_BUILD_CMD
183183
export GONK_PRODUCT="$(GONK)" && \
184184
export GONK_PATH="$(GONK_PATH)" && \
185185
export TARGET_TOOLS_PREFIX="$(abspath $(TOOLCHAIN_PATH))" && \
186-
export EXTRA_INCLUDE="-include $(abspath Unicode.h)" && \
186+
export EXTRA_INCLUDE="$(EXTRA_INCLUDE)" && \
187187
ulimit -n 4096 && \
188188
$(MAKE) -C $(GECKO_PATH) -f client.mk -s $(MAKE_FLAGS) && \
189189
$(MAKE) -C $(GECKO_OBJDIR) package
@@ -374,6 +374,8 @@ config-nexuss-ics: blobs-nexuss-ics gonk-ics-sync config-gecko
374374
echo "KERNEL_PATH = ./boot/kernel-android-samsung" >> .config.mk && \
375375
echo "GONK = crespo" >> .config.mk && \
376376
echo "GONK_BASE = glue/gonk-ics" >> .config.mk && \
377+
echo "TOOLCHAIN_PATH = ./toolchains/arm-linux-androideabi-4.6.3/linux-x86/bin/arm-linux-androideabi-" >> .config.mk && \
378+
echo "EXTRA_INCLUDE = -include \"$(abspath Unicode.h)\"" >> .config.mk && \
377379
echo OK
378380

379381
.PHONY: config-qemu
@@ -627,7 +629,7 @@ test:
627629

628630
GDB_PORT=22576
629631
GDBINIT=/tmp/b2g.gdbinit.$(shell whoami)
630-
GDB=$(abspath $(GONK_BASE)/prebuilt/linux-x86/tegra-gdb/arm-eabi-gdb)
632+
GDB=$(abspath toolchains/arm-linux-androideabi-4.6.3/linux-x86/bin/arm-linux-androideabi-gdb)
631633
B2G_BIN=/system/b2g/b2g
632634

633635
.PHONY: forward-gdb-port
@@ -666,7 +668,7 @@ restore-auto-restart: adb-check-version
666668

667669
.PHONY: run-gdb-server
668670
run-gdb-server: adb-check-version forward-gdb-port kill-gdb-server disable-auto-restart
669-
$(ADB) shell gdbserver :$(GDB_PORT) $(B2G_BIN).d &
671+
$(ADB) shell LD_LIBRARY_PATH=/system/b2g gdbserver :$(GDB_PORT) $(B2G_BIN).d &
670672
sleep 1
671673

672674
.PHONY: run-gdb

Unicode.h

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
/*
2+
* Copyright (C) 2005 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#ifndef ANDROID_UNICODE_H
18+
#define ANDROID_UNICODE_H
19+
20+
#define __STDC_LIMIT_MACROS 1
21+
22+
#include <sys/types.h>
23+
#include <stdint.h>
24+
25+
extern "C" {
26+
27+
// char32_t and char16_t are built-in types as of c++0x.
28+
#if !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L
29+
typedef uint32_t char32_t;
30+
typedef uint16_t char16_t;
31+
#endif
32+
33+
// Standard string functions on char16_t strings.
34+
int strcmp16(const char16_t *, const char16_t *);
35+
int strncmp16(const char16_t *s1, const char16_t *s2, size_t n);
36+
size_t strlen16(const char16_t *);
37+
size_t strnlen16(const char16_t *, size_t);
38+
char16_t *strcpy16(char16_t *, const char16_t *);
39+
char16_t *strncpy16(char16_t *, const char16_t *, size_t);
40+
41+
// Version of comparison that supports embedded nulls.
42+
// This is different than strncmp() because we don't stop
43+
// at a nul character and consider the strings to be different
44+
// if the lengths are different (thus we need to supply the
45+
// lengths of both strings). This can also be used when
46+
// your string is not nul-terminated as it will have the
47+
// equivalent result as strcmp16 (unlike strncmp16).
48+
int strzcmp16(const char16_t *s1, size_t n1, const char16_t *s2, size_t n2);
49+
50+
// Version of strzcmp16 for comparing strings in different endianness.
51+
int strzcmp16_h_n(const char16_t *s1H, size_t n1, const char16_t *s2N, size_t n2);
52+
53+
// Standard string functions on char32_t strings.
54+
size_t strlen32(const char32_t *);
55+
size_t strnlen32(const char32_t *, size_t);
56+
57+
/**
58+
* Measure the length of a UTF-32 string in UTF-8. If the string is invalid
59+
* such as containing a surrogate character, -1 will be returned.
60+
*/
61+
ssize_t utf32_to_utf8_length(const char32_t *src, size_t src_len);
62+
63+
/**
64+
* Stores a UTF-8 string converted from "src" in "dst", if "dst_length" is not
65+
* large enough to store the string, the part of the "src" string is stored
66+
* into "dst" as much as possible. See the examples for more detail.
67+
* Returns the size actually used for storing the string.
68+
* dst" is not null-terminated when dst_len is fully used (like strncpy).
69+
*
70+
* Example 1
71+
* "src" == \u3042\u3044 (\xE3\x81\x82\xE3\x81\x84)
72+
* "src_len" == 2
73+
* "dst_len" >= 7
74+
* ->
75+
* Returned value == 6
76+
* "dst" becomes \xE3\x81\x82\xE3\x81\x84\0
77+
* (note that "dst" is null-terminated)
78+
*
79+
* Example 2
80+
* "src" == \u3042\u3044 (\xE3\x81\x82\xE3\x81\x84)
81+
* "src_len" == 2
82+
* "dst_len" == 5
83+
* ->
84+
* Returned value == 3
85+
* "dst" becomes \xE3\x81\x82\0
86+
* (note that "dst" is null-terminated, but \u3044 is not stored in "dst"
87+
* since "dst" does not have enough size to store the character)
88+
*
89+
* Example 3
90+
* "src" == \u3042\u3044 (\xE3\x81\x82\xE3\x81\x84)
91+
* "src_len" == 2
92+
* "dst_len" == 6
93+
* ->
94+
* Returned value == 6
95+
* "dst" becomes \xE3\x81\x82\xE3\x81\x84
96+
* (note that "dst" is NOT null-terminated, like strncpy)
97+
*/
98+
void utf32_to_utf8(const char32_t* src, size_t src_len, char* dst);
99+
100+
/**
101+
* Returns the unicode value at "index".
102+
* Returns -1 when the index is invalid (equals to or more than "src_len").
103+
* If returned value is positive, it is able to be converted to char32_t, which
104+
* is unsigned. Then, if "next_index" is not NULL, the next index to be used is
105+
* stored in "next_index". "next_index" can be NULL.
106+
*/
107+
int32_t utf32_from_utf8_at(const char *src, size_t src_len, size_t index, size_t *next_index);
108+
109+
110+
/**
111+
* Returns the UTF-8 length of UTF-16 string "src".
112+
*/
113+
ssize_t utf16_to_utf8_length(const char16_t *src, size_t src_len);
114+
115+
/**
116+
* Converts a UTF-16 string to UTF-8. The destination buffer must be large
117+
* enough to fit the UTF-16 as measured by utf16_to_utf8_length with an added
118+
* NULL terminator.
119+
*/
120+
void utf16_to_utf8(const char16_t* src, size_t src_len, char* dst);
121+
122+
/**
123+
* Returns the length of "src" when "src" is valid UTF-8 string.
124+
* Returns 0 if src is NULL or 0-length string. Returns -1 when the source
125+
* is an invalid string.
126+
*
127+
* This function should be used to determine whether "src" is valid UTF-8
128+
* characters with valid unicode codepoints. "src" must be null-terminated.
129+
*
130+
* If you are going to use other utf8_to_... functions defined in this header
131+
* with string which may not be valid UTF-8 with valid codepoint (form 0 to
132+
* 0x10FFFF), you should use this function before calling others, since the
133+
* other functions do not check whether the string is valid UTF-8 or not.
134+
*
135+
* If you do not care whether "src" is valid UTF-8 or not, you should use
136+
* strlen() as usual, which should be much faster.
137+
*/
138+
ssize_t utf8_length(const char *src);
139+
140+
/**
141+
* Measure the length of a UTF-32 string.
142+
*/
143+
size_t utf8_to_utf32_length(const char *src, size_t src_len);
144+
145+
/**
146+
* Stores a UTF-32 string converted from "src" in "dst". "dst" must be large
147+
* enough to store the entire converted string as measured by
148+
* utf8_to_utf32_length plus space for a NULL terminator.
149+
*/
150+
void utf8_to_utf32(const char* src, size_t src_len, char32_t* dst);
151+
152+
/**
153+
* Returns the UTF-16 length of UTF-8 string "src".
154+
*/
155+
ssize_t utf8_to_utf16_length(const uint8_t* src, size_t srcLen);
156+
157+
/**
158+
* Convert UTF-8 to UTF-16 including surrogate pairs.
159+
* Returns a pointer to the end of the string (where a null terminator might go
160+
* if you wanted to add one).
161+
*/
162+
char16_t* utf8_to_utf16_no_null_terminator(const uint8_t* src, size_t srcLen, char16_t* dst);
163+
164+
/**
165+
* Convert UTF-8 to UTF-16 including surrogate pairs. The destination buffer
166+
* must be large enough to hold the result as measured by utf8_to_utf16_length
167+
* plus an added NULL terminator.
168+
*/
169+
void utf8_to_utf16(const uint8_t* src, size_t srcLen, char16_t* dst);
170+
171+
}
172+
173+
#undef __STDC_LIMIT_MACROS
174+
#endif

config/gecko-prof-gonk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ sys=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
1010

1111
ac_add_options --target=arm-android-eabi
1212
ac_add_options --with-gonk="$gonk"
13+
ac_add_options --with-gonk-toolchain-prefix="$TARGET_TOOLS_PREFIX"
1314
ac_add_options --with-endian=little
1415

1516
ac_add_options --enable-application=b2g
@@ -23,4 +24,4 @@ ac_add_options --enable-marionette
2324
ac_add_options --enable-omx-plugin
2425

2526
# Enable dump() from JS.
26-
export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
27+
export CXXFLAGS="-DMOZ_ENABLE_JS_DUMP $EXTRA_INCLUDE"

toolchains

Submodule toolchains added at 70cd8f0

0 commit comments

Comments
 (0)