My setup:
Before starting please read setup and brief of how libpng is compiled. It is a waste if I write same thing repeatedly.
Link: http://www.ourinnovativemind.in/2016/03/how-to-compile-libpng-using-android-ndk.html
Starting steps same as libpng project:
# AndroidBuild.sh START
#!/bin/sh
# http://www.ourinnovativemind.in
# http://www.gamesgreh.in
# Add configure options here
export CONFIGURATION_OPTIONS="--enable-static --disable-shared --with-bzip2=no"
# use custom build environment
# installation directory
export PREFIX=`pwd`/prefix
# Path of NDK. For simplicity make symlinks in home directories
export NDK=/mnt/work/SDK_IDE/android-ndk-r10e-linux/
# processor specific libraries and includes.
# Suffix for arch-???. arch-arm arch-arm64 arch-mips arch-mips64 arch-x86 arch-x86_64
export ARCH=arm
# compiler for processor
export CROSS_COMPILE=arm-linux-androideabi
# Android platform version
export PLATFORM=android-8
# GCC compiler version
export GCC_VERSION=4.8
# Getting toolchain directory inside NDK from variables set above
# Hardcoded for linux running on x86 cpu 64-Bit
export ANDROID_PREFIX=${NDK}/toolchains/$CROSS_COMPILE-$GCC_VERSION/prebuilt/linux-x86_64
# SYSROOT. usr dir i.e. usr/include, usr/lib
export SYSROOT=${NDK}/platforms/$PLATFORM/arch-$ARCH
export CROSS_PATH=${ANDROID_PREFIX}/bin/${CROSS_COMPILE}
# Some compiler and binutils. More might be needed depending on source.
export CPP=${CROSS_PATH}-cpp
export AR=${CROSS_PATH}-ar
export AS=${CROSS_PATH}-as
export NM=${CROSS_PATH}-nm
export CC=${CROSS_PATH}-gcc
export CXX=${CROSS_PATH}-g++
export LD=${CROSS_PATH}-ld
export RANLIB=${CROSS_PATH}-ranlib
# package configuration file save location
export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig
# Flags for compiler
export CFLAGS="${CFLAGS} --sysroot=${SYSROOT} -I${SYSROOT}/usr/include -I${ANDROID_PREFIX}/include"
export CPPFLAGS="${CFLAGS}"
export LDFLAGS="${LDFLAGS} -L${SYSROOT}/usr/lib -L${ANDROID_PREFIX}/lib"
#$@
./configure --host=${CROSS_COMPILE} --with-sysroot=${SYSROOT} --prefix=${PREFIX} "$@" $CONFIGURATION_OPTIONS
make
make install
# AndroidBuild.sh END
Copy all lines above and paste in a new file AndroidBuild.sh and save. Then change the variables valid for your system. Create folder prefix or whatever name you like. Change NDK=/mnt/work/SDK_IDE/android-ndk-r10e-linux/ and compiler related values as per your system. This script copied from web can cause error due to removal of newlines for strange reasons. Ensure # is ahead of comments. Now run sh AndroidBuild.sh. It should end without errors. This will install all built files in prefix directory.
Links:
Script file http://txt.do/5vi0z or http://textuploader.com/5vi0z!
Below is output of console if you want to compare it with yours:
bindesh@linux-k2zc:/mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3> sh AndroidBuild.sh
FreeType build system -- automatic system detection
The following settings are used:
platform unix
compiler /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc
configuration directory ./builds/unix
configuration rules ./builds/unix/unix.mk
If this does not correspond to your system or settings please remove the file
`config.mk' from this directory then read the INSTALL file for help.
Otherwise, simply type `make' again to build the library,
or `make refdoc' to build the API reference (this needs python >= 2.6).
cd builds/unix; \
./configure '--host=arm-linux-androideabi' '--with-sysroot=/mnt/work/SDK_IDE/android-ndk-r10e-linux//platforms/android-8/arch-arm' '--prefix=/mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix' '--enable-static' '--disable-shared' '--with-bzip2=no'
configure: loading site script /usr/share/site/x86_64-unknown-linux-gnu
checking build system type... x86_64-pc-linux-gnu
checking host system type... arm-unknown-linux-androideabi
checking for arm-linux-androideabi-gcc... /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc accepts -g... yes
checking for /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-cpp
checking for arm-linux-androideabi-pkg-config... no
checking for pkg-config... /usr/bin/pkg-config
configure: WARNING: using cross tools not prefixed with host triplet
checking pkg-config is at least version 0.24... yes
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc... /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ld
checking if the linker (/mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-nm
checking the name lister (/mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to arm-unknown-linux-androideabi format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ld option to reload object files... -r
checking for arm-linux-androideabi-objdump... no
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for arm-linux-androideabi-dlltool... no
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for arm-linux-androideabi-ar... /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ar
checking for archiver @FILE support... @
checking for arm-linux-androideabi-strip... no
checking for strip... strip
checking for arm-linux-androideabi-ranlib... /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ranlib
checking for gawk... gawk
checking command to parse /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-nm output from /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc object... ok
checking for sysroot... /mnt/work/SDK_IDE/android-ndk-r10e-linux//platforms/android-8/arch-arm
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for arm-linux-androideabi-mt... no
checking for mt... mt
checking if mt is a manifest tool... no
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc supports -fno-rtti -fno-exceptions... no
checking for /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc option to produce PIC... -fPIC -DPIC
checking if /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc PIC flag -fPIC -DPIC works... yes
checking if /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc static flag -static works... yes
checking if /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc supports -c -o file.o... yes
checking if /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc supports -c -o file.o... (cached) yes
checking whether the /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc linker (/mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ld) supports shared libraries... yes
checking dynamic linker characteristics... Android linker
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking for x86_64-pc-linux-gnu-gcc... no
checking for gcc... gcc
checking for gcc... (cached) gcc
checking for suffix of native executables...
checking for a BSD-compatible install... /usr/bin/install -c
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for ANSI C header files... (cached) yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking size of int... 4
checking size of long... 4
checking whether cpp computation of bit length in ftconfig.in works... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for sys/param.h... yes
checking for getpagesize... no
checking for working mmap... no
checking for memcpy... yes
checking for memmove... yes
checking gcc compiler flag -pedantic to assure ANSI C works correctly... ok, add it to XX_ANSIFLAGS
checking gcc compiler flag -ansi to assure ANSI C works correctly... ok, add it to XX_ANSIFLAGS
checking for ZLIB... yes
checking for LIBPNG... yes
checking for HARFBUZZ... yes
configure: creating ./config.status
config.status: creating unix-cc.mk
config.status: creating unix-def.mk
config.status: creating ftconfig.h
config.status: executing libtool commands
configure:
Library configuration:
external zlib: yes (pkg-config)
bzip2: no
libpng: yes (pkg-config)
harfbuzz: yes (pkg-config)
make: Nothing to be done for 'unix'.
make: Nothing to be done for 'all'.
rm -rf /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/include/freetype2
rm -f /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/include/ft2build.h
/usr/bin/mkdir -p /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/lib \
/mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/lib/pkgconfig \
/mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/include/freetype2/freetype/config \
/mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/bin \
/mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/share/aclocal \
/mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/share/man/man1
./builds/unix/libtool --mode=install /usr/bin/install -c \
/mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/objs/libfreetype.la /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/lib
libtool: install: /usr/bin/install -c /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/objs/.libs/libfreetype.lai /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/lib/libfreetype.la
libtool: install: /usr/bin/install -c /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/objs/.libs/libfreetype.a /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/lib/libfreetype.a
libtool: install: chmod 644 /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/lib/libfreetype.a
libtool: install: /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ranlib /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/lib/libfreetype.a
for P in /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/tttables.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftoutln.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftstroke.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/t1tables.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/fterrors.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftcid.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftbitmap.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftmodapi.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftsystem.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftcffdrv.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftautoh.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftsynth.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftlcdfil.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftpfr.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftsizes.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftrender.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftlzw.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftfntfmt.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftglyph.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftlist.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftincrem.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftchapters.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftbdf.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftcache.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ttnameid.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftgzip.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftbzip2.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftmac.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/freetype.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftwinfnt.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/fttypes.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftotval.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftbbox.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftmm.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftadvanc.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftttdrv.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftmoderr.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftgasp.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftgxval.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftsnames.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/tttags.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ttunpat.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/fterrdef.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/fttrigon.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftimage.h ; do \
/usr/bin/install -c -m 644 \
$P /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/include/freetype2/freetype ; \
done
for P in /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/config/ftstdlib.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/config/ftconfig.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/config/ftmodule.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/config/ftoption.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/config/ftheader.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/objs/ftmodule.h ; do \
/usr/bin/install -c -m 644 \
$P /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/include/freetype2/freetype/config ; \
done
/usr/bin/install -c -m 644 /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/ft2build.h \
/mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/include/freetype2/ft2build.h
/usr/bin/install -c -m 644 ./builds/unix/ftconfig.h \
/mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/include/freetype2/freetype/config/ftconfig.h
/usr/bin/install -c -m 644 /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/objs/ftmodule.h \
/mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/include/freetype2/freetype/config/ftmodule.h
/usr/bin/install -c -m 755 ./builds/unix/freetype-config \
/mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/bin/freetype-config
/usr/bin/install -c -m 644 ./builds/unix/freetype2.m4 \
/mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/share/aclocal/freetype2.m4
/usr/bin/install -c -m 644 ./builds/unix/freetype2.pc \
/mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/lib/pkgconfig/freetype2.pc
/usr/bin/install -c -m 644 /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/docs/freetype-config.1 \
/mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/share/man/man1/freetype-config.1
bindesh@linux-k2zc:/mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3>
- OpenSuse Linux Leap 42.1.20151028 x86_64 (64Bit), AMD Athlon X2
- Android NDK r10e-rc4 (64-bit). Directory name android-ndk-r10e-linux
- Terminal / Bash shell. On Windows one needs to install binutils, development environment. Just install CodeBlocks windows or other such compiler. They contain most of needed tools.
Before starting please read setup and brief of how libpng is compiled. It is a waste if I write same thing repeatedly.
Link: http://www.ourinnovativemind.in/2016/03/how-to-compile-libpng-using-android-ndk.html
Starting steps same as libpng project:
- Download Android NDK and extract/install to a path without containing space or special characters. If using Linux then make symbolic link to home.
- Download FreeType package version 2.6.3
- Create a working directory where package will be compiled. Extract package.
# AndroidBuild.sh START
#!/bin/sh
# http://www.ourinnovativemind.in
# http://www.gamesgreh.in
# Add configure options here
export CONFIGURATION_OPTIONS="--enable-static --disable-shared --with-bzip2=no"
# use custom build environment
# installation directory
export PREFIX=`pwd`/prefix
# Path of NDK. For simplicity make symlinks in home directories
export NDK=/mnt/work/SDK_IDE/android-ndk-r10e-linux/
# processor specific libraries and includes.
# Suffix for arch-???. arch-arm arch-arm64 arch-mips arch-mips64 arch-x86 arch-x86_64
export ARCH=arm
# compiler for processor
export CROSS_COMPILE=arm-linux-androideabi
# Android platform version
export PLATFORM=android-8
# GCC compiler version
export GCC_VERSION=4.8
# Getting toolchain directory inside NDK from variables set above
# Hardcoded for linux running on x86 cpu 64-Bit
export ANDROID_PREFIX=${NDK}/toolchains/$CROSS_COMPILE-$GCC_VERSION/prebuilt/linux-x86_64
# SYSROOT. usr dir i.e. usr/include, usr/lib
export SYSROOT=${NDK}/platforms/$PLATFORM/arch-$ARCH
export CROSS_PATH=${ANDROID_PREFIX}/bin/${CROSS_COMPILE}
# Some compiler and binutils. More might be needed depending on source.
export CPP=${CROSS_PATH}-cpp
export AR=${CROSS_PATH}-ar
export AS=${CROSS_PATH}-as
export NM=${CROSS_PATH}-nm
export CC=${CROSS_PATH}-gcc
export CXX=${CROSS_PATH}-g++
export LD=${CROSS_PATH}-ld
export RANLIB=${CROSS_PATH}-ranlib
# package configuration file save location
export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig
# Flags for compiler
export CFLAGS="${CFLAGS} --sysroot=${SYSROOT} -I${SYSROOT}/usr/include -I${ANDROID_PREFIX}/include"
export CPPFLAGS="${CFLAGS}"
export LDFLAGS="${LDFLAGS} -L${SYSROOT}/usr/lib -L${ANDROID_PREFIX}/lib"
#$@
./configure --host=${CROSS_COMPILE} --with-sysroot=${SYSROOT} --prefix=${PREFIX} "$@" $CONFIGURATION_OPTIONS
make
make install
# AndroidBuild.sh END
Copy all lines above and paste in a new file AndroidBuild.sh and save. Then change the variables valid for your system. Create folder prefix or whatever name you like. Change NDK=/mnt/work/SDK_IDE/android-ndk-r10e-linux/ and compiler related values as per your system. This script copied from web can cause error due to removal of newlines for strange reasons. Ensure # is ahead of comments. Now run sh AndroidBuild.sh. It should end without errors. This will install all built files in prefix directory.
Links:
Script file http://txt.do/5vi0z or http://textuploader.com/5vi0z!
Below is output of console if you want to compare it with yours:
bindesh@linux-k2zc:/mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3> sh AndroidBuild.sh
FreeType build system -- automatic system detection
The following settings are used:
platform unix
compiler /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc
configuration directory ./builds/unix
configuration rules ./builds/unix/unix.mk
If this does not correspond to your system or settings please remove the file
`config.mk' from this directory then read the INSTALL file for help.
Otherwise, simply type `make' again to build the library,
or `make refdoc' to build the API reference (this needs python >= 2.6).
cd builds/unix; \
./configure '--host=arm-linux-androideabi' '--with-sysroot=/mnt/work/SDK_IDE/android-ndk-r10e-linux//platforms/android-8/arch-arm' '--prefix=/mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix' '--enable-static' '--disable-shared' '--with-bzip2=no'
configure: loading site script /usr/share/site/x86_64-unknown-linux-gnu
checking build system type... x86_64-pc-linux-gnu
checking host system type... arm-unknown-linux-androideabi
checking for arm-linux-androideabi-gcc... /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc accepts -g... yes
checking for /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-cpp
checking for arm-linux-androideabi-pkg-config... no
checking for pkg-config... /usr/bin/pkg-config
configure: WARNING: using cross tools not prefixed with host triplet
checking pkg-config is at least version 0.24... yes
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc... /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ld
checking if the linker (/mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-nm
checking the name lister (/mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to arm-unknown-linux-androideabi format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ld option to reload object files... -r
checking for arm-linux-androideabi-objdump... no
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for arm-linux-androideabi-dlltool... no
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for arm-linux-androideabi-ar... /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ar
checking for archiver @FILE support... @
checking for arm-linux-androideabi-strip... no
checking for strip... strip
checking for arm-linux-androideabi-ranlib... /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ranlib
checking for gawk... gawk
checking command to parse /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-nm output from /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc object... ok
checking for sysroot... /mnt/work/SDK_IDE/android-ndk-r10e-linux//platforms/android-8/arch-arm
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for arm-linux-androideabi-mt... no
checking for mt... mt
checking if mt is a manifest tool... no
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc supports -fno-rtti -fno-exceptions... no
checking for /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc option to produce PIC... -fPIC -DPIC
checking if /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc PIC flag -fPIC -DPIC works... yes
checking if /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc static flag -static works... yes
checking if /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc supports -c -o file.o... yes
checking if /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc supports -c -o file.o... (cached) yes
checking whether the /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc linker (/mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ld) supports shared libraries... yes
checking dynamic linker characteristics... Android linker
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking for x86_64-pc-linux-gnu-gcc... no
checking for gcc... gcc
checking for gcc... (cached) gcc
checking for suffix of native executables...
checking for a BSD-compatible install... /usr/bin/install -c
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for ANSI C header files... (cached) yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking size of int... 4
checking size of long... 4
checking whether cpp computation of bit length in ftconfig.in works... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for sys/param.h... yes
checking for getpagesize... no
checking for working mmap... no
checking for memcpy... yes
checking for memmove... yes
checking gcc compiler flag -pedantic to assure ANSI C works correctly... ok, add it to XX_ANSIFLAGS
checking gcc compiler flag -ansi to assure ANSI C works correctly... ok, add it to XX_ANSIFLAGS
checking for ZLIB... yes
checking for LIBPNG... yes
checking for HARFBUZZ... yes
configure: creating ./config.status
config.status: creating unix-cc.mk
config.status: creating unix-def.mk
config.status: creating ftconfig.h
config.status: executing libtool commands
configure:
Library configuration:
external zlib: yes (pkg-config)
bzip2: no
libpng: yes (pkg-config)
harfbuzz: yes (pkg-config)
make: Nothing to be done for 'unix'.
make: Nothing to be done for 'all'.
rm -rf /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/include/freetype2
rm -f /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/include/ft2build.h
/usr/bin/mkdir -p /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/lib \
/mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/lib/pkgconfig \
/mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/include/freetype2/freetype/config \
/mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/bin \
/mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/share/aclocal \
/mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/share/man/man1
./builds/unix/libtool --mode=install /usr/bin/install -c \
/mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/objs/libfreetype.la /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/lib
libtool: install: /usr/bin/install -c /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/objs/.libs/libfreetype.lai /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/lib/libfreetype.la
libtool: install: /usr/bin/install -c /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/objs/.libs/libfreetype.a /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/lib/libfreetype.a
libtool: install: chmod 644 /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/lib/libfreetype.a
libtool: install: /mnt/work/SDK_IDE/android-ndk-r10e-linux//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ranlib /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/lib/libfreetype.a
for P in /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/tttables.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftoutln.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftstroke.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/t1tables.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/fterrors.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftcid.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftbitmap.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftmodapi.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftsystem.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftcffdrv.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftautoh.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftsynth.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftlcdfil.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftpfr.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftsizes.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftrender.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftlzw.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftfntfmt.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftglyph.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftlist.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftincrem.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftchapters.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftbdf.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftcache.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ttnameid.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftgzip.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftbzip2.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftmac.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/freetype.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftwinfnt.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/fttypes.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftotval.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftbbox.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftmm.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftadvanc.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftttdrv.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftmoderr.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftgasp.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftgxval.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftsnames.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/tttags.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ttunpat.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/fterrdef.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/fttrigon.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/ftimage.h ; do \
/usr/bin/install -c -m 644 \
$P /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/include/freetype2/freetype ; \
done
for P in /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/config/ftstdlib.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/config/ftconfig.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/config/ftmodule.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/config/ftoption.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/freetype/config/ftheader.h /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/objs/ftmodule.h ; do \
/usr/bin/install -c -m 644 \
$P /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/include/freetype2/freetype/config ; \
done
/usr/bin/install -c -m 644 /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/include/ft2build.h \
/mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/include/freetype2/ft2build.h
/usr/bin/install -c -m 644 ./builds/unix/ftconfig.h \
/mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/include/freetype2/freetype/config/ftconfig.h
/usr/bin/install -c -m 644 /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/objs/ftmodule.h \
/mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/include/freetype2/freetype/config/ftmodule.h
/usr/bin/install -c -m 755 ./builds/unix/freetype-config \
/mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/bin/freetype-config
/usr/bin/install -c -m 644 ./builds/unix/freetype2.m4 \
/mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/share/aclocal/freetype2.m4
/usr/bin/install -c -m 644 ./builds/unix/freetype2.pc \
/mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/lib/pkgconfig/freetype2.pc
/usr/bin/install -c -m 644 /mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/docs/freetype-config.1 \
/mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3/prefix/share/man/man1/freetype-config.1
bindesh@linux-k2zc:/mnt/work/work/programming/Android/00_libraries/freetype/freetype-2.6.3>
No comments:
Post a Comment