Advertisement
Guest User

Untitled

a guest
Jan 4th, 2012
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.74 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # Script updated 2008-09-23 by Skwerl (antiquiet.com) to work with dreamhost's debian etch
  4. # Script updated 2007-11-24 by Andrew (ajmconsulting.net) to allow 3rd wget line to pass
  5. # Script updated 2006-12-25 by Carl McDade (hiveminds.co.uk) to allow memory limit and freetype
  6. #
  7. # LIBMCRYPT version information (was set as static download file name previously.)
  8. #
  9. # Save the code to a file as *.sh
  10. # Abort on any errors
  11. #
  12. set -e
  13.  
  14. # The domain in which to install the PHP CGI script.
  15. export DOMAIN="DOMAIN.TLD"
  16.  
  17. # Where do you want all this stuff built? I'd recommend picking a local
  18. # filesystem.
  19. # ***Don't pick a directory that already exists!*** We clean up after
  20. # ourselves at the end!
  21. SRCDIR=${HOME}/source
  22.  
  23. # And where should it be installed?
  24. INSTALLDIR=${HOME}/php5
  25.  
  26. # Set DISTDIR to somewhere persistent, if you plan to muck around with this
  27. # script and run it several times!
  28. DISTDIR=${HOME}/dist
  29.  
  30. # Pre-download clean up!!!!
  31. rm -rf $SRCDIR $DISTDIR
  32.  
  33. # Update version information here.
  34. PHP5="php-5.2.17"
  35. LIBICONV="libiconv-1.11"
  36. LIBMCRYPT="libmcrypt-2.5.7"
  37. LIBXML2="libxml2-2.6.32"
  38. LIBXSLT="libxslt-1.1.24"
  39. MHASH="mhash-0.9.7.1"
  40. ZLIB="zlib-1.2.5"
  41. CURL="curl-7.14.0"
  42. LIBIDN="libidn-0.6.8"
  43. CCLIENT="imap-2004g"
  44. CCLIENT_DIR="imap-2004g" # Another pest!
  45. FREETYPE="freetype-2.2.1"
  46. OPENSSL="openssl-0.9.8i"
  47.  
  48. # What PHP features do you want enabled?
  49. PHPFEATURES="--prefix=${INSTALLDIR} \
  50. --with-config-file-path=${INSTALLDIR}/etc/php5/${DOMAIN} \
  51. --enable-fastcgi \
  52. --enable-force-cgi-redirect \
  53. --with-xml \
  54. --with-libxml-dir=${INSTALLDIR} \
  55. --with-freetype-dir=${INSTALLDIR} \
  56. --enable-soap \
  57. --with-openssl=${INSTALLDIR} \
  58. --with-mhash=${INSTALLDIR} \
  59. --with-mcrypt=${INSTALLDIR} \
  60. --with-zlib-dir=${INSTALLDIR} \
  61. --with-jpeg-dir=/usr \
  62. --with-png-dir=/usr \
  63. --with-gd \
  64. --enable-gd-native-ttf \
  65. --enable-memory-limit \
  66. --enable-ftp \
  67. --enable-exif \
  68. --enable-sockets \
  69. --enable-wddx \
  70. --with-iconv=${INSTALLDIR} \
  71. --enable-sqlite-utf8 \
  72. --enable-calendar \
  73. --with-curl=${INSTALLDIR} \
  74. --enable-mbstring \
  75. --enable-mbregex \
  76. --enable-bcmath \
  77. --with-mysql=/usr \
  78. --with-mysqli \
  79. --without-pear \
  80. --with-gettext \
  81. --with-imap=${INSTALLDIR} \
  82. --without-imap-ssl"
  83.  
  84. # ---- end of user-editable bits. Hopefully! ----
  85.  
  86. # Push the install dir's bin directory into the path
  87. export PATH=${INSTALLDIR}/bin:$PATH
  88.  
  89. # set up directories
  90. mkdir -p ${SRCDIR}
  91. mkdir -p ${INSTALLDIR}
  92. mkdir -p ${DISTDIR}
  93. cd ${DISTDIR}
  94.  
  95. # Get all the required packages
  96. wget -c http://us.php.net/get/${PHP5}.tar.gz/from/this/mirror
  97. mv mirror ${PHP5}.tar.gz
  98. wget -c http://mirrors.usc.edu/pub/gnu/libiconv/${LIBICONV}.tar.gz
  99. wget -c ftp://ftp.uni-weimar.de/pub/unix/${LIBMCRYPT}.tar.gz
  100. wget -c http://xmlsoft.org/sources/old/${LIBXML2}.tar.gz
  101. wget -c http://xmlsoft.org/sources/${LIBXSLT}.tar.gz
  102. wget -c http://iweb.dl.sourceforge.net/project/mhash/mhash/0.9.7.1/${MHASH}.tar.gz
  103. wget -c http://www.zlib.net/${ZLIB}.tar.gz
  104. wget -c http://curl.haxx.se/download/${CURL}.tar.gz
  105. wget -c http://kent.dl.sourceforge.net/sourceforge/freetype/${FREETYPE}.tar.gz
  106. wget -c ftp://alpha.gnu.org/pub/gnu/libidn/${LIBIDN}.tar.gz
  107. wget -c ftp://ftp.cac.washington.edu/imap/old/${CCLIENT}.tar.Z
  108. wget -c http://www.openssl.org/source/${OPENSSL}.tar.gz
  109.  
  110. echo ---------- Unpacking downloaded archives. This process may take several minutes! ----------
  111.  
  112. cd ${SRCDIR}
  113. # Unpack them all
  114. echo Extracting ${PHP5}...
  115. tar xzf ${DISTDIR}/${PHP5}.tar.gz
  116. echo Done.
  117. echo Extracting ${LIBICONV}...
  118. tar xzf ${DISTDIR}/${LIBICONV}.tar.gz
  119. echo Done.
  120. echo Extracting ${LIBMCRYPT}...
  121. tar xzf ${DISTDIR}/${LIBMCRYPT}.tar.gz
  122. echo Done.
  123. echo Extracting ${LIBXML2}...
  124. tar xzf ${DISTDIR}/${LIBXML2}.tar.gz
  125. echo Done.
  126. echo Extracting ${LIBXSLT}...
  127. tar xzf ${DISTDIR}/${LIBXSLT}.tar.gz
  128. echo Done.
  129. echo Extracting ${MHASH}...
  130. tar xzf ${DISTDIR}/${MHASH}.tar.gz
  131. echo Done.
  132. echo Extracting ${ZLIB}...
  133. tar xzf ${DISTDIR}/${ZLIB}.tar.gz
  134. echo Done.
  135. echo Extracting ${CURL}...
  136. tar xzf ${DISTDIR}/${CURL}.tar.gz
  137. echo Done.
  138. echo Extracting ${LIBIDN}...
  139. tar xzf ${DISTDIR}/${LIBIDN}.tar.gz
  140. echo Done.
  141. echo Extracting ${CCLIENT}...
  142. uncompress -cd ${DISTDIR}/${CCLIENT}.tar.Z |tar x
  143. echo Done.
  144. echo Extracting ${FREETYPE}...
  145. tar xzf ${DISTDIR}/${FREETYPE}.tar.gz
  146. echo Done.
  147. echo Extracting ${OPENSSL}...
  148. tar xzf ${DISTDIR}/${OPENSSL}.tar.gz
  149. echo Done.
  150.  
  151. # Build them in the required order to satisfy dependencies.
  152.  
  153. #libiconv
  154. cd ${SRCDIR}/${LIBICONV}
  155. ./configure --enable-extra-encodings --prefix=${INSTALLDIR}
  156. # make clean
  157. make
  158. make install
  159.  
  160. #libxml2
  161. cd ${SRCDIR}/${LIBXML2}
  162. ./configure --with-iconv=${INSTALLDIR} --prefix=${INSTALLDIR}
  163. # make clean
  164. make
  165. make install
  166.  
  167. #libxslt
  168. cd ${SRCDIR}/${LIBXSLT}
  169. ./configure --prefix=${INSTALLDIR} \
  170. --with-libxml-prefix=${INSTALLDIR} \
  171. --with-libxml-include-prefix=${INSTALLDIR}/include/ \
  172. --with-libxml-libs-prefix=${INSTALLDIR}/lib/
  173. # make clean
  174. make
  175. make install
  176.  
  177. #zlib
  178. cd ${SRCDIR}/${ZLIB}
  179. ./configure --shared --prefix=${INSTALLDIR}
  180. # make clean
  181. make
  182. make install
  183.  
  184. #libmcrypt
  185. cd ${SRCDIR}/${LIBMCRYPT}
  186. ./configure --disable-posix-threads --prefix=${INSTALLDIR}
  187. # make clean
  188. make
  189. make install
  190.  
  191. #libmcrypt lltdl issue!!
  192. cd ${SRCDIR}/${LIBMCRYPT}/libltdl
  193. ./configure --prefix=${INSTALLDIR} --enable-ltdl-install
  194. # make clean
  195. make
  196. make install
  197.  
  198. #mhash
  199. cd ${SRCDIR}/${MHASH}
  200. ./configure --prefix=${INSTALLDIR}
  201. # make clean
  202. make
  203. make install
  204.  
  205. #freetype
  206. cd ${SRCDIR}/${FREETYPE}
  207. ./configure --prefix=${INSTALLDIR}
  208. # make clean
  209. make
  210. make install
  211.  
  212. #libidn
  213. cd ${SRCDIR}/${LIBIDN}
  214. ./configure --with-iconv-prefix=${INSTALLDIR} --prefix=${INSTALLDIR}
  215. # make clean
  216. make
  217. make install
  218.  
  219. #cURL
  220. cd ${SRCDIR}/${CURL}
  221. ./configure --with-ssl=${INSTALLDIR} --with-zlib=${INSTALLDIR} \
  222. --with-libidn=${INSTALLDIR} --enable-ipv6 --enable-cookies \
  223. --enable-crypto-auth --prefix=${INSTALLDIR}
  224. # make clean
  225. make
  226. make install
  227.  
  228. # c-client
  229. cd ${SRCDIR}/${CCLIENT_DIR}
  230. make -i ldb SSLTYPE=none
  231. # Install targets are for wusses!
  232. cp c-client/c-client.a ${INSTALLDIR}/lib/libc-client.a
  233. cp c-client/*.h ${INSTALLDIR}/include
  234.  
  235. #OpenSSL
  236. cd ${SRCDIR}/${OPENSSL}
  237. ./config --prefix=${INSTALLDIR} --openssldir=${INSTALLDIR}
  238. make
  239. make install
  240.  
  241. echo - about to build php5...
  242. echo
  243. read -p "(Press any key to continue)" temp;
  244. echo
  245.  
  246. #PHP 5
  247. cd ${SRCDIR}/${PHP5}
  248. ./configure ${PHPFEATURES}
  249. # make clean
  250. make
  251. make install
  252.  
  253. #copy config file
  254. mkdir -p ${INSTALLDIR}/etc/php5/${DOMAIN}
  255. cp ${SRCDIR}/${PHP5}/php.ini-dist ${INSTALLDIR}/etc/php5/${DOMAIN}/php.ini
  256.  
  257. #copy PHP CGI
  258. mkdir -p ${HOME}/${DOMAIN}/cgi-bin
  259. chmod 0755 ${HOME}/${DOMAIN}/cgi-bin
  260. cp ${INSTALLDIR}/bin/php ${HOME}/${DOMAIN}/cgi-bin/php.cgi
  261. rm -rf $SRCDIR $DISTDIR
  262. echo ---------- INSTALL COMPLETE! ----------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement