44
55export BUILDDIR=` pwd`
66
7- NCPU=4
7+ NCPU=8
88uname -s | grep -i " linux" && NCPU=` cat /proc/cpuinfo | grep -c -i processor`
99
1010NDK=` which ndk-build`
@@ -17,7 +17,7 @@ for ARCH in armeabi armeabi-v7a arm64-v8a x86 x86_64; do
1717
1818cd $BUILDDIR
1919
20- GCCPREFIX=" ` env CLANG= ./setCrossEnvironment-$ARCH .sh sh -c ' basename $CC | sed s/-gcc //' ` "
20+ GCCPREFIX=" ` ./setCrossEnvironment-$ARCH .sh sh -c ' basename $STRIP | sed s/-strip //' ` "
2121echo " ARCH $ARCH GCCPREFIX $GCCPREFIX "
2222
2323mkdir -p $ARCH
@@ -53,7 +53,9 @@ cd $BUILDDIR/$ARCH
5353 cp -f $BUILDDIR /config.sub libcharset/build-aux/
5454 cp -f $BUILDDIR /config.guess libcharset/build-aux/
5555
56- env CFLAGS=" -I$NDK /sources/android/support/include" \
56+ sed -i ' s/MB_CUR_MAX/1/g' lib/loop_wchar.h
57+
58+ env CFLAGS=" -I$NDK /sources/android/support/include -D_IO_getc=getc" \
5759 LDFLAGS=" -L$BUILDDIR /$ARCH -landroid_support" \
5860 $BUILDDIR /setCrossEnvironment-$ARCH .sh \
5961 ./configure \
@@ -114,19 +116,29 @@ cd $BUILDDIR/$ARCH
114116 cp -f $BUILDDIR /config.sub .
115117 cp -f $BUILDDIR /config.guess .
116118
119+ sed -i ' s/ld_shlibs=no/ld_shlibs=yes/g' ./configure
120+
117121 env CFLAGS=" -I$NDK /sources/android/support/include -frtti -fexceptions -I$BUILDDIR /$ARCH /include" \
118122 LDFLAGS=" -frtti -fexceptions -L$BUILDDIR /$ARCH /lib" \
119- LIBS=" -L$BUILDDIR /$ARCH -landroid_support -lgnustl_static -lstdc++ -latomic " \
123+ LIBS=" -L$BUILDDIR /$ARCH -landroid_support" \
120124 $BUILDDIR /setCrossEnvironment-$ARCH .sh \
121125 ./configure \
122126 --host=$GCCPREFIX \
123127 --prefix=` pwd` /../ \
124- --enable-static --disable -shared \
128+ --enable-static --enable -shared \
125129 --with-glib=no --with-gobject=no \
126130 --with-cairo=no --with-fontconfig=no \
127131 --with-icu=no --with-freetype=no \
128132 || exit 1
129133
134+ env PATH=` pwd` :$PATH \
135+ $BUILDDIR /setCrossEnvironment-$ARCH .sh \
136+ make -j$NCPU V=1 || echo " Crappy libtool cannot link anything"
137+
138+ env PATH=` pwd` :$PATH \
139+ $BUILDDIR /setCrossEnvironment-$ARCH .sh \
140+ sh -c ' $LD $CFLAGS $LDFLAGS -shared src/.libs/*.o src/hb-ucdn/.libs/*.o -o src/.libs/libharfbuzz.so' || exit 1
141+
130142 env PATH=` pwd` :$PATH \
131143 $BUILDDIR /setCrossEnvironment-$ARCH .sh \
132144 make -j$NCPU V=1 || exit 1
@@ -135,6 +147,10 @@ cd $BUILDDIR/$ARCH
135147 $BUILDDIR /setCrossEnvironment-$ARCH .sh \
136148 make V=1 install || exit 1
137149
150+ env PATH=` pwd` :$PATH \
151+ $BUILDDIR /setCrossEnvironment-$ARCH .sh \
152+ sh -c ' $AR rcs ../lib/libharfbuzz.a src/.libs/*.o src/hb-ucdn/.libs/*.o' || exit 1
153+
138154 cd ..
139155 cp -f lib/libharfbuzz.a ./
140156}
@@ -165,9 +181,9 @@ cd $BUILDDIR/$ARCH
165181 sed -i " s@LD_SONAME *=.*@LD_SONAME =@g" config/mh-linux
166182 sed -i " s%ln -s *%cp -f \$ (dir \$ @)/%g" config/mh-linux
167183
168- env CFLAGS=" -I$NDK /sources/android/support/include -frtti -fexceptions -include $BUILDDIR /ndk-r15-64-bit-fix.h " \
184+ env CFLAGS=" -I$NDK /sources/android/support/include -frtti -fexceptions" \
169185 LDFLAGS=" -frtti -fexceptions -L$BUILDDIR /$ARCH /lib" \
170- LIBS=" -L$BUILDDIR /$ARCH -landroid_support -lgnustl_static -lstdc++ -latomic " \
186+ LIBS=" -L$BUILDDIR /$ARCH -landroid_support ` $BUILDDIR /setCrossEnvironment- $ARCH .sh sh -c ' echo $LDFLAGS ' ` " \
171187 $BUILDDIR /setCrossEnvironment-$ARCH .sh \
172188 ./configure \
173189 --host=$GCCPREFIX \
@@ -214,10 +230,12 @@ cd $BUILDDIR/$ARCH
214230 cp -f $BUILDDIR /config.sub .
215231 cp -f $BUILDDIR /config.guess .
216232
233+ sed -i ' s/ld_shlibs=no/ld_shlibs=yes/g' ./configure
234+
217235 env CFLAGS=" -I$NDK /sources/android/support/include -frtti -fexceptions" \
218236 CXXFLAGS=" -std=c++11" \
219237 LDFLAGS=" -frtti -fexceptions" \
220- LIBS=" -L$BUILDDIR /$ARCH -landroid_support -lgnustl_static -lstdc++ -latomic " \
238+ LIBS=" -L$BUILDDIR /$ARCH -landroid_support" \
221239 HARFBUZZ_CFLAGS=" -I$BUILDDIR /$ARCH /include/harfbuzz" \
222240 HARFBUZZ_LIBS=" -L$BUILDDIR /$ARCH /lib -lharfbuzz" \
223241 ICU_CFLAGS=" -I$BUILDDIR /$ARCH /include" \
@@ -226,9 +244,66 @@ cd $BUILDDIR/$ARCH
226244 ./configure \
227245 --host=$GCCPREFIX \
228246 --prefix=` pwd` /../ \
229- --enable-static --disable -shared \
247+ --enable-static --enable -shared \
230248 || exit 1
231249
250+ env PATH=` pwd` :$PATH \
251+ $BUILDDIR /setCrossEnvironment-$ARCH .sh \
252+ make V=1 || \
253+ env PATH=` pwd` :$PATH \
254+ $BUILDDIR /setCrossEnvironment-$ARCH .sh \
255+ sh -c ' $LD $CFLAGS -shared src/.libs/*.o -o src/.libs/libicu-le-hb.so.0.0.0 -L../lib -lharfbuzz -licuuc $LDFLAGS' || exit 1
256+
257+ env PATH=` pwd` :$PATH \
258+ $BUILDDIR /setCrossEnvironment-$ARCH .sh \
259+ sh -c ' $AR rcs ../lib/libicu-le-hb.a src/.libs/*.o' || exit 1
260+
261+ cat > src/libicu-le-hb.la << EOF
262+ # libicu-le-hb.so - a libtool library file
263+ # Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.7ubuntu1
264+ #
265+ # Please DO NOT delete this file!
266+ # It is necessary for linking the library.
267+
268+ # The name that we can dlopen(3).
269+ dlname='libicu-le-hb.so.0'
270+
271+ # Names of this library.
272+ library_names='libicu-le-hb.so.0.0.0 libicu-le-hb.so.0 libicu-le-hb.so'
273+
274+ # The name of the static archive.
275+ old_library=''
276+
277+ # Linker flags that can not go in dependency_libs.
278+ inherited_linker_flags=''
279+
280+ # Libraries that this one depends upon.
281+ dependency_libs=''
282+
283+ # Names of additional weak libraries provided by this library
284+ weak_library_names=''
285+
286+ # Version information for libharfbuzz.
287+ current=0
288+ age=0
289+ revision=0
290+
291+ # Is this an already installed library?
292+ installed=no
293+
294+ # Should we warn about portability when linking against -modules?
295+ shouldnotlink=no
296+
297+ # Files to dlopen/dlpreopen
298+ dlopen=''
299+ dlpreopen=''
300+
301+ # Directory that this library needs to be installed in:
302+ libdir='/usr/lib'
303+ EOF
304+
305+ cp -f src/libicu-le-hb.la src/.libs/libicu-le-hb.lai
306+
232307 env PATH=` pwd` :$PATH \
233308 $BUILDDIR /setCrossEnvironment-$ARCH .sh \
234309 make V=1 || exit 1
@@ -249,9 +324,9 @@ cd $BUILDDIR/$ARCH
249324
250325 cd icu/source
251326
252- env CFLAGS=" -I$NDK /sources/android/support/include -frtti -fexceptions -include $BUILDDIR /ndk-r15-64-bit-fix.h " \
327+ env CFLAGS=" -I$NDK /sources/android/support/include -frtti -fexceptions" \
253328 LDFLAGS=" -frtti -fexceptions -L$BUILDDIR /$ARCH /lib" \
254- LIBS=" -L$BUILDDIR /$ARCH -landroid_support -lgnustl_static -lstdc++ -latomic " \
329+ LIBS=" -L$BUILDDIR /$ARCH -landroid_support ` $BUILDDIR /setCrossEnvironment- $ARCH .sh sh -c ' echo $LDFLAGS ' ` " \
255330 ICULEHB_CFLAGS=" -I$BUILDDIR /$ARCH /include/icu-le-hb" \
256331 ICULEHB_LIBS=" -licu-le-hb" \
257332 $BUILDDIR /setCrossEnvironment-$ARCH .sh \
0 commit comments