winlin

update build script for ubuntu

@@ -15,70 +15,63 @@ function Ubuntu_prepare() @@ -15,70 +15,63 @@ function Ubuntu_prepare()
15 15
16 echo "Ubuntu detected, install tools if needed" 16 echo "Ubuntu detected, install tools if needed"
17 17
18 - apt-cache show libpcre3; ret=$?; if [[ 0 -ne $ret ]]; then  
19 - echo "install libpcre3"  
20 - require_sudoer "sudo apt-get install -y libpcre3"  
21 - sudo apt-get install -y libpcre3  
22 - echo "install libpcre3 success"  
23 - fi  
24 -  
25 - apt-cache show libpcre3-dev; ret=$?; if [[ 0 -ne $ret ]]; then  
26 - echo "install libpcre3-dev"  
27 - require_sudoer "sudo apt-get install -y libpcre3-dev"  
28 - sudo apt-get install -y libpcre3-dev  
29 - echo "install libpcre3-dev success"  
30 - fi  
31 -  
32 - apt-cache show zlib1g-dev; ret=$?; if [[ 0 -ne $ret ]]; then  
33 - echo "install zlib1g-dev"  
34 - require_sudoer "sudo apt-get install -y zlib1g-dev"  
35 - sudo apt-get install -y zlib1g-dev  
36 - echo "install zlib1g-dev success"  
37 - fi  
38 -  
39 - apt-cache show libfreetype6-dev; ret=$?; if [[ 0 -ne $ret ]]; then  
40 - echo "install libfreetype6-dev"  
41 - require_sudoer "sudo apt-get install -y libfreetype6-dev"  
42 - sudo apt-get install -y libfreetype6-dev  
43 - echo "install libfreetype6-dev success"  
44 - fi  
45 -  
46 - apt-cache show gcc; ret=$?; if [[ 0 -ne $ret ]]; then 18 + gcc --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
47 echo "install gcc" 19 echo "install gcc"
48 require_sudoer "sudo apt-get install -y gcc" 20 require_sudoer "sudo apt-get install -y gcc"
49 sudo apt-get install -y gcc 21 sudo apt-get install -y gcc
50 echo "install gcc success" 22 echo "install gcc success"
51 fi 23 fi
52 24
53 - apt-cache show g++; ret=$?; if [[ 0 -ne $ret ]]; then 25 + g++ --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
54 echo "install g++" 26 echo "install g++"
55 require_sudoer "sudo apt-get install -y g++" 27 require_sudoer "sudo apt-get install -y g++"
56 sudo apt-get install -y g++ 28 sudo apt-get install -y g++
57 echo "install g++ success" 29 echo "install g++ success"
58 fi 30 fi
59 31
60 - apt-cache show make; ret=$?; if [[ 0 -ne $ret ]]; then 32 + make --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
61 echo "install make" 33 echo "install make"
62 require_sudoer "sudo apt-get install -y make" 34 require_sudoer "sudo apt-get install -y make"
63 sudo apt-get install -y make 35 sudo apt-get install -y make
64 echo "install make success" 36 echo "install make success"
65 fi 37 fi
66 38
67 - apt-cache show autoconf; ret=$?; if [[ 0 -ne $ret ]]; then 39 + autoconf --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
68 echo "install autoconf" 40 echo "install autoconf"
69 require_sudoer "sudo apt-get install -y autoconf" 41 require_sudoer "sudo apt-get install -y autoconf"
70 sudo apt-get install -y autoconf 42 sudo apt-get install -y autoconf
71 echo "install autoconf success" 43 echo "install autoconf success"
72 fi 44 fi
73 45
74 - apt-cache show libtool; ret=$?; if [[ 0 -ne $ret ]]; then 46 + libtool --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
75 echo "install libtool" 47 echo "install libtool"
76 require_sudoer "sudo apt-get install -y libtool" 48 require_sudoer "sudo apt-get install -y libtool"
77 sudo apt-get install -y libtool 49 sudo apt-get install -y libtool
78 echo "install libtool success" 50 echo "install libtool success"
79 fi 51 fi
80 52
81 - apt-cache show libssl-dev; ret=$?; if [[ 0 -ne $ret ]]; then 53 + if [[ ! -f /usr/include/pcre.h ]]; then
  54 + echo "install libpcre3-dev"
  55 + require_sudoer "sudo apt-get install -y libpcre3-dev"
  56 + sudo apt-get install -y libpcre3-dev
  57 + echo "install libpcre3-dev success"
  58 + fi
  59 +
  60 + if [[ ! -f /usr/include/zlib.h ]]; then
  61 + echo "install zlib1g-dev"
  62 + require_sudoer "sudo apt-get install -y zlib1g-dev"
  63 + sudo apt-get install -y zlib1g-dev
  64 + echo "install zlib1g-dev success"
  65 + fi
  66 +
  67 + if [[ ! -d /usr/include/freetype2 ]]; then
  68 + echo "install libfreetype6-dev"
  69 + require_sudoer "sudo apt-get install -y libfreetype6-dev"
  70 + sudo apt-get install -y libfreetype6-dev
  71 + echo "install libfreetype6-dev success"
  72 + fi
  73 +
  74 + if [[ ! -d /usr/include/openssl ]]; then
82 echo "install libssl-dev" 75 echo "install libssl-dev"
83 require_sudoer "sudo apt-get install -y libssl-dev" 76 require_sudoer "sudo apt-get install -y libssl-dev"
84 sudo apt-get install -y libssl-dev 77 sudo apt-get install -y libssl-dev