Skip to content

Commit f458d66

Browse files
Merge pull request #16 from andyque/testScripts
finish linux,ios,mac,android,tizen
2 parents f4c4bf5 + 0351604 commit f458d66

37 files changed

+833
-1795
lines changed

README.md

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ or Windows machine were not tested, so we don't know if it works or not.
2727

2828
## Prerequisite
2929
### For Mac users
30-
- If you want to use these scripts, you should install Git 1.8+, CMake 2.8+ and M4 1.4+.
30+
- If you want to use these scripts, you should install Git 1.8+, CMake 2.8+, autoconf and libtool.
3131
If you are a Homebrew user, you could simply run the following commands to install these tools:
3232

3333
```
3434
brew update
3535
brew install git
3636
brew install cmake
37-
brew install m4
3837
brew install autoconf
38+
brew install libtool
3939
```
4040

4141
- If you want to build static libraries for iOS and Mac, you should install the latest version of XCode. You should also install the `Command Line Tools` bundled with XCode.
@@ -45,22 +45,24 @@ brew install autoconf
4545

4646
- If you want to build static libraries for Tizen, you should download and install [Tizen SDK](https://developer.tizen.org/downloads/tizen-sdk). And you should also add a environment variable named `TIZEN_SDK` in your shell.
4747

48-
### For Linux users
49-
xxx need to improve the document here later.
48+
### For Linux(Ubuntu) users
49+
- If you want to use these scripts, you should instll *autoconf*:
50+
51+
```
52+
sudo apt-get install autoconf
53+
sudo apt-get install cmake
54+
sudo apt-get install libtool
55+
sudo apt-get install git
56+
```
5057

5158
### For Windows users
5259
In order to run these scripts, you should install [msys2](http://msys2.github.io/) and update the system packages.
5360

5461
After that, you should also install the following dependencies:
5562

5663
```
57-
pacman -S gcc
58-
pacman -S make
59-
pacman -S autoconf
60-
pacman -S automake
61-
pacman -S git
62-
pacman -S cmake
63-
pacman -S libtool
64+
pacman -S mingw-w64-i686-toolchain
65+
6466
```
6567

6668
## How to use
@@ -69,9 +71,11 @@ We have one build script for each platform, they are under `build/platform{ios/m
6971
All of them share the same usage:
7072

7173
```
72-
./build.sh --libs=param1 --arch=param2 --mode=param3 --list
74+
./build.sh -p=param0 --libs=param1 --arch=param2 --mode=param3 --list
7375
```
7476

77+
- param0: specify a platform, only (ios, mac, android, linux and tizen ) are valid values.
78+
7579
- param1:
7680
- use `all` to build all the 3rd party libraries, it will take you a very long time.
7781
- use comma separated library names, for example, `png,lua,jpeg,webp`, no space between the comma.
@@ -87,12 +91,12 @@ All of them share the same usage:
8791
- list:
8892
- Use these option to list all the supported libraries.
8993

90-
### For iOS Platform
94+
### Build png on iOS platform
9195
For building libpng fat library with all arch x86_64, i386, armv7, arm64 on release mode:
9296

9397
```
94-
cd build/ios
95-
./build.sh --libs=png
98+
cd build
99+
./build.sh -p=ios --libs=png
96100
```
97101

98102
After running this command, it will generate a folder named `png`:
@@ -110,24 +114,24 @@ All the other libraries share the same folder structure.
110114
For building libpng fat library with arch armv7 and arm64 on debug mode:
111115

112116
```
113-
cd build/ios
114-
./build.sh --libs=png --arch=armv7,arm64 --mode=debug
117+
cd build
118+
./build.sh -p=ios --libs=png --arch=armv7,arm64 --mode=debug
115119
```
116120

117-
### For Android Platform
118-
xxx document will be update later.
121+
### Build for Android arm64
122+
123+
1. Download Android NDK r10c and set the ANDROID_NDK to point to the Android ndk r10c path. Don't forget to `source ~/.bash_profile`.
124+
125+
2. Modify the android.ini config file. Change `cfg_default_build_api=21` and `cfg_default_gcc_version=4.9`.
126+
127+
3. Pass `--arch=64` to build the libraries with arm64 support.
119128

120-
### For Mac
121-
xxx document will be update later.
122129

123-
### For Tizen
124-
xxx document will be update later.
130+
For other platforms and other libraries, it is more or less the same way except for some minor changes in `--arch` parameter and `-p` parameter.
125131

126-
### For Linux
127-
xxx After testing these scripts on Linux, document will be update.
128132

129133
## How to build a DEBUG and RELEASE version
130-
xxx we need to improve the script to add debug and release options.
134+
You can add flag "--mode=[debug | release]" for building DEBUG and RELEASE version.
131135

132136
## How to do build clean?
133137
If you use `./build.sh` to build static libraries, there is no need to do clean. After generating the static library, script will delete the intermediate files.

build/android.ini

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
cfg_platform_name=android
2+
#default values put it here
3+
cfg_default_build_arches="all"
4+
cfg_default_build_mode="release"
5+
cfg_default_build_libraries="all"
6+
#specific default values
7+
cfg_default_build_api=19
8+
cfg_default_gcc_version=4.8
9+
10+
#help message strings goes here
11+
cfg_help_arch_string="arm,armv7,x86,arm64"
12+
cfg_help_sample_string="./build.sh -p=android --libs=png --arch=arm,armv7,arm64 --mode=debug"
13+
14+
#build machine & build host
15+
cfg_build_machine="x86_64-apple-darwin14"
16+
cfg_x86_host_machine="i686-linux-android"
17+
cfg_arm64_host_machine="aarch64-linux-android"
18+
cfg_arm_host_machine="arm-linux-androideabi"
19+
cfg_armv7_host_machine="arm-linux-androideabi"
20+
21+
#only cross compile should define thse variables
22+
cfg_is_cross_compile=yes
23+
24+
cfg_x86_toolchain_bin="${ANDROID_NDK}/toolchains/x86-${cfg_default_gcc_version}/prebuilt/darwin-x86_64/bin"
25+
cfg_arm64_toolchain_bin="${ANDROID_NDK}/toolchains/aarch64-linux-android-${cfg_default_gcc_version}/prebuilt/darwin-x86_64/bin"
26+
cfg_arm_toolchain_bin="${ANDROID_NDK}/toolchains/arm-linux-androideabi-${cfg_default_gcc_version}/prebuilt/darwin-x86_64/bin"
27+
cfg_armv7_toolchain_bin="${ANDROID_NDK}/toolchains/arm-linux-androideabi-${cfg_default_gcc_version}/prebuilt/darwin-x86_64/bin"
28+
29+
30+
#build arches and build libraries
31+
cfg_all_supported_arches=("arm" "armv7" "x86" "arm64")
32+
cfg_all_supported_libraries=("png" "zlib" "lua" "luajit" "websockets" "curl" "freetype" "jpeg" "tiff" "webp" "chipmunk" "openssl")
33+
cfg_default_arches_all=("arm" "armv7" "x86" "arm64")
34+
cfg_default_libraries_all=("png" "zlib" "lua" "luajit" "websockets" "curl" "freetype" "jpeg" "tiff" "webp" "chipmunk" "openssl")
35+
36+
37+
#whether build fat library, use lipo -S create
38+
cfg_build_fat_library=no
39+
40+
#debug and release mode flag
41+
cfg_build_release_mode="-O3 -DNDEBUG"
42+
cfg_build_debug_mode="-O0 -g -DDEBUG"
43+

build/android/build.sh

Lines changed: 0 additions & 152 deletions
This file was deleted.

0 commit comments

Comments
 (0)