Skip to content

Commit 16a997f

Browse files
Merge pull request #20 from andyque/testScripts
improve the help string and reduce the unneeded configs
2 parents 6608398 + 3e54120 commit 16a997f

File tree

7 files changed

+20
-30
lines changed

7 files changed

+20
-30
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ pacman -S mingw-w64-i686-toolchain
6666
```
6767

6868
## How to use
69-
We have one build script for each platform, they are under `build` directory.
69+
We have one build script for each platform, it is under `build` directory.
7070

71-
All of them share the same usage:
71+
The usage would be:
7272

7373
```
7474
./build.sh -p=platform --libs=libs --arch=arch --mode=mode --list

build/android.ini

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ cfg_armv7_alias_folder_name="armeabi-v7a"
1111
cfg_arm64_alias_folder_name="armeabi-v8a"
1212

1313

14-
#help message strings goes here
15-
cfg_help_arch_string="arm,armv7,x86,arm64"
16-
cfg_help_sample_string="./build.sh -p=android --libs=png --arch=arm,armv7,arm64 --mode=debug"
17-
1814
#build machine & build host
1915
cfg_build_machine="x86_64-apple-darwin14"
2016
cfg_x86_host_machine="i686-linux-android"

build/build.sh

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,25 @@ function contains() {
2929

3030
function usage()
3131
{
32-
echo "You should follow the instructions here to build static library for $cfg_platform_name"
32+
echo "Helper to build all the 3rd party libraries for Cocos2D-X on various platform."
3333
echo ""
34-
echo "./build_png.sh"
35-
echo "\t[-h --help] "
36-
echo "\t--libs=[all | png,lua,tiff,jpeg,webp,zlib etc]"
37-
echo "\t[--arch | -a]=[all | $cfg_help_arch_string etc]"
38-
echo "\t[--mode | -m]=[release | debug]"
39-
echo "\t[--list | -l]"
34+
echo "Usage:"
35+
echo " ./build.sh -p=PLATFORM [--libs=LIBRARY...] [-a=ARCH...] [-mode=MODE]"
36+
echo " ./build.sh --platform=PLATFORM [--libs=LIBRARY...] [--arch=ARCH...] [--mode=MODE]"
37+
echo " ./build.sh -p=PLATFORM (-h | --help)"
38+
echo " ./build.sh -p=PLATFORM (-l | --list)"
4039
echo ""
41-
echo "Sample:"
42-
echo "$cfg_help_sample_string"
40+
echo "Arguments:"
41+
echo " PLATFORM: Platform names, valid values are: mac,ios,android,win32,tizen,linux"
42+
echo " LIBRARY: Library names, valid values are platform dependent(png,jpeg,lua,chipmunk,etc)"
43+
echo " ARCH: Build arches, valid values are platform dependent(arm,arm64,armv7,i386,etc)"
44+
echo " MODE: Build mode, valid values are: release and debug"
4345
echo ""
46+
echo "Options:"
47+
echo " --platform Specify a target platform, one platform a time."
48+
echo " --libs: Specify a few target libraries,all the libraries should be comma separated.[default: all]"
49+
echo " --arch: Specify a few arches to build,all the arches should be comma separated. [default: all]"
50+
echo " --mode: Specify the build mode.[default: release]"
4451
}
4552

4653

@@ -81,7 +88,7 @@ function check_invalid_platform()
8188
{
8289
# echo "checking ${build_platform} is in ${cfg_all_valid_platforms[@]}"
8390
if [ $(contains "${cfg_all_valid_platforms[@]}" $build_platform) == "n" ]; then
84-
echo "Invalid platform! Only ${cfg_all_valid_platforms[@]} is acceptable."
91+
usage
8592
exit 1
8693
fi
8794
}
@@ -109,11 +116,10 @@ function list_all_supported_libraries()
109116
{
110117

111118
echo "Supported libraries and versions:"
112-
echo "\t"
113119

114120
for lib in ${cfg_all_supported_libraries[@]}
115121
do
116-
all_supported_libraries=$(find ../contrib/src -type f | grep SHA512SUMS | xargs cat | awk 'match ($0, /.tgz|.tar.gz|.zip|.tar.xz/) { print substr($2,0,length($2)-RLENGTH)}' | grep $lib | awk '{print $1}')
122+
all_supported_libraries=$(find ../contrib/src -type f | grep SHA512SUMS | xargs cat | awk 'match ($0, /.tgz|.tar.gz|.zip|.tar.xz/) { print substr($2,0,length($2)-RLENGTH)}' | grep -i $lib | awk '{print $1}')
117123
echo $all_supported_libraries | awk '{ print $1}'
118124
done
119125
}

build/ios.ini

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ cfg_default_build_arches="all"
55
cfg_default_build_mode="release"
66
cfg_default_build_libraries="all"
77

8-
#help message strings goes here
9-
cfg_help_arch_string="armv7,armv7s,arm64,i386,x86_64"
10-
cfg_help_sample_string="./build.sh -p=ios --libs=png --arch=armv7,arm64,i368 --mode=debug"
118

129
cfg_build_machine="x86_64-apple-darwin14"
1310
cfg_x86_64_host_machine="x86_64-apple-darwin"

build/linux.ini

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ cfg_default_build_libraries="all"
99
# cfg_default_gcc_version=4.8
1010
# cfg_android_ndk_path=/Users/guanghui/AndroidDev/android-ndk-r9d
1111

12-
#help message strings goes here
13-
cfg_help_arch_string="i386,x86_64"
14-
cfg_help_sample_string="./build.sh -p=linux --libs=png --arch=i368,x86_64 --mode=debug"
1512

1613
cfg_is_cross_compile=no
1714
cfg_build_machine="x86_64-linux-gnu"

build/mac.ini

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ cfg_default_build_mode="release"
66
cfg_default_build_libraries="all"
77
#specific default values
88

9-
#help message strings goes here
10-
cfg_help_arch_string="i386,x86_64"
11-
cfg_help_sample_string="./build.sh -p=mac --libs=png --arch=i368,x86_64 --mode=debug"
129

1310
#build machine & build host
1411
cfg_build_machine="x86_64-apple-darwin14"

build/tizen.ini

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ cfg_default_build_arches="all"
55
cfg_default_build_mode="release"
66
cfg_default_build_libraries="all"
77

8-
#help message strings goes here
9-
cfg_help_arch_string="armv7"
10-
cfg_help_sample_string="./build.sh -p=tizen --libs=png --arch=armv7 --mode=debug"
118

129
#build machine & build host
1310
cfg_build_machine="x86_64-apple-darwin14"

0 commit comments

Comments
 (0)