Skip to content

Commit f4c4bf5

Browse files
Merge pull request #14 from andyque/testScripts
add build.sh for mac platform
2 parents 812bd87 + 5cb1d16 commit f4c4bf5

File tree

11 files changed

+514
-151
lines changed

11 files changed

+514
-151
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ brew update
3535
brew install git
3636
brew install cmake
3737
brew install m4
38+
brew install autoconf
3839
```
3940

4041
- 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.
@@ -52,7 +53,7 @@ In order to run these scripts, you should install [msys2](http://msys2.github.io
5253

5354
After that, you should also install the following dependencies:
5455

55-
```cpp
56+
```
5657
pacman -S gcc
5758
pacman -S make
5859
pacman -S autoconf
@@ -68,12 +69,12 @@ We have one build script for each platform, they are under `build/platform{ios/m
6869
All of them share the same usage:
6970

7071
```
71-
./build.sh --libs=param1 --arch=param2 --mode=param3
72+
./build.sh --libs=param1 --arch=param2 --mode=param3 --list
7273
```
7374

7475
- param1:
7576
- use `all` to build all the 3rd party libraries, it will take you a very long time.
76-
- use comma separated library names, for example, `png,lua,jpeg/webp`, no space between the comma.
77+
- use comma separated library names, for example, `png,lua,jpeg,webp`, no space between the comma.
7778

7879
- param2:
7980
- use `all` to build all the supported arches. For iOS, they are "armv7, arm64, i386, x86_64", for Android, they are "armeabi, armeabi-v7a, x86, arm64", for Mac, they are "x86_64", for Tizen, they are "armv7"
@@ -83,10 +84,13 @@ All of them share the same usage:
8384
- release: Build library on release mode. This is the default option. We use `-O3 -DNDEBUG` flags to build release library.
8485
- debug: Build library on debug mode. we use `-O0 -g -DDEBUG` flag to build debug library.
8586

87+
- list:
88+
- Use these option to list all the supported libraries.
89+
8690
### For iOS Platform
8791
For building libpng fat library with all arch x86_64, i386, armv7, arm64 on release mode:
8892

89-
```cpp
93+
```
9094
cd build/ios
9195
./build.sh --libs=png
9296
```

build/ios/build.sh

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,36 @@ build_library="all"
1111
function usage()
1212
{
1313
echo "You should follow the instructions here to build static library for iOS"
14-
echo "If you want to build a fat, you should pass 'all' to --arch parameter."
14+
echo ""
15+
echo "./build_png.sh"
16+
echo "\t[-h --help] "
17+
echo "\t--libs=[all | png,lua,tiff,jpeg,webp,zlib etc]"
18+
echo "\t[--arch | -a]=[all | armv7,arm64,i386,x86_64 etc]"
19+
echo "\t[--mode | -m]=[release | debug]"
20+
echo "\t[--list | -l]"
1521
echo ""
1622
echo "Sample:"
17-
echo "./bulid.sh --arch=armv7,arm64 --mode=debug"
18-
echo "You must seperate each arch with comma, otherwise it won't parse correctly. No whitespace is allowed between two arch types."
23+
echo "\t./bulid.sh --libs=png --arch=armv7,arm64 --mode=debug"
1924
echo ""
20-
echo "./build_png.sh"
21-
echo "\t-h --help"
22-
echo "\t--libs=[all | png,lua,tiff,jpeg,webp,zlib,websockets,luajit,freetype2,curl,chipmunk,box2d]"
23-
echo "\t--arch=[all | armv7,arm64,i386,x86_64]"
24-
echo "\t--mode=[release | debug]"
25+
}
26+
27+
function list_all_supported_libraries()
28+
{
29+
30+
# TODO: we need to update the supported libraries and version when we upgrade libraries
31+
echo "Supported libraries and versions:"
32+
echo "\t"
33+
echo "\tcurl 7.26.0"
34+
echo "\tfreetype 2.5.3"
35+
echo "\tjpeg 9.0"
36+
echo "\tlua 1.5.4"
37+
echo "\tluajit 2.0.1"
38+
echo "\topenssl 1.0.1.j"
39+
echo "\tlibpng 1.6.2"
40+
echo "\ttiff 4.0.3"
41+
echo "\twebp 0.4.2"
42+
echo "\twebsockets 1.3"
43+
echo "\tzlib 1.2.8"
2544
echo ""
2645
}
2746

@@ -30,19 +49,23 @@ while [ "$1" != "" ]; do
3049
PARAM=`echo $1 | awk -F= '{print $1}'`
3150
VALUE=`echo $1 | awk -F= '{print $2}'`
3251
case $PARAM in
33-
-h | --help)
52+
--help | -h)
3453
usage
3554
exit
3655
;;
3756
--libs)
3857
build_library=$VALUE
3958
;;
40-
--arch)
59+
--arch | -a)
4160
build_arches=$VALUE
4261
;;
43-
--mode)
62+
--mode | -m)
4463
build_mode=$VALUE
4564
;;
65+
--list | -l)
66+
list_all_supported_libraries
67+
exit
68+
;;
4669
*)
4770
echo "ERROR: unknown parameter \"$PARAM\""
4871
usage

0 commit comments

Comments
 (0)