forked from libpdk/libpdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·67 lines (59 loc) · 1.67 KB
/
install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
function _cleanup()
{
unset -f _usage _cleanup ; return 0
}
## Clear out nested functions on exit
trap _cleanup INT EXIT RETURN
###### some declarations ######
forceBuild=no
function _usage() {
###### U S A G E : Help and ERROR ######
echo $@
echo "Usage:"
echo "./install [-f]"
}
[ $# = 0 ] && _usage " >>>>>>>> no options given "
##################################################################
####### "getopts" with: short options AND long options #######
####### AND short/long arguments #######
while getopts ':f-' OPTION ; do
case "$OPTION" in
f ) forceBuild=yes ;;
- ) [ $OPTIND -ge 1 ] && optind=$(expr $OPTIND - 1 ) || optind=$OPTIND
eval OPTION="\$$optind"
OPTARG=$(echo $OPTION | cut -d'=' -f2)
OPTION=$(echo $OPTION | cut -d'=' -f1)
case $OPTION in
--force ) forceBuild=yes ;;
* ) _usage " Long: >>>>>>>> invalid options (long) ";exit 1;;
esac
OPTIND=1
shift
;;
? ) _usage "Short: >>>>>>>> invalid options (short) ";exit 1;;
esac
done
echo -e "Welcome to use libpdk project"
if [ ! -d "build" ]
then
echo -e "create the build directory"
mkdir build
cd build
else
cd build
if [ "$forceBuild" == "yes" ]
then
echo -e "clean the build directory"
rm -Rf *
fi
fi
echo -e "init the submodules of libpdk project"
git submodule init
echo -e "build configure libpdk"
cmake ../
if [ $? ]
then
echo "something is wrong, maybe the build system can't find php-config"
echo "you can try ./install --php-config-path=path"
fi