Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@iloveitaly
Created May 25, 2010 20:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save iloveitaly/413654 to your computer and use it in GitHub Desktop.
Save iloveitaly/413654 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Some Notes About Free TDS
# #
# # TDS
# #
# SYBASE=$HOME/usr/lib
# LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$SYBASE/lib
#
# export SYBASE LD_LIBRARY_PATH
#
# tsql -C
#
# SYBASE=$HOME/usr/local/freetds
# [chivas]$ LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$SYBASE/lib
# [chivas]$ export SYBASE LD_LIBRARY_PATH
#
# ./configure --prefix=$HOME/usr --with-tdsver=8.0 --enable--msdblib -enable-
# Script updated 2009-08-01 by Ben Turley to add LDAP support
# Script updated 2009-05-24 by ksmoe to correct copying of correct PHP cgi file (php-cgi instead of php)
# Script updated 2006-12-25 by Carl McDade (hiveminds.co.uk) to allow memory limit and freetype
#
# Script updated 2007-11-24 by Andrew (ajmconsulting.net) to allow 3rd wget line to pass
# LIBMCRYPT version information (was set as static download file name previously.)
#
# Script updated 2009-4-25 by Daniel (whathuhstudios.com) for latest source versions
# Save the code to a file as *.sh
# Abort on any errors
#
set -e
# The domain in which to install the PHP CGI script.
export DOMAIN="domain.com"
# Where do you want all this stuff built? I'd recommend picking a local
# filesystem.
# ***Don't pick a directory that already exists!*** We clean up after
# ourselves at the end!
SRCDIR=${HOME}/source
# And where should it be installed?
INSTALLDIR=${HOME}/php5
# Set DISTDIR to somewhere persistent, if you plan to muck around with this
# script and run it several times!
DISTDIR=${HOME}/dist
# Pre-download clean up!!!!
rm -rf $SRCDIR $DISTDIR
# Update version information here.
PHP5="php-5.2.13"
LIBICONV="libiconv-1.13"
LIBMCRYPT="libmcrypt-2.5.8"
LIBXML2="libxml2-2.7.3"
LIBXSLT="libxslt-1.1.24"
MHASH="mhash-0.9.9.9"
ZLIB="zlib-1.2.5"
CURL="curl-7.18.2"
LIBIDN="libidn-0.6.14"
CCLIENT="imap-2004g"
CCLIENT_DIR="imap-2004g" # Another pest!
OPENSSL="openssl-0.9.8k"
#OPENSSL="openssl-0.9.8i" this used to be an I it should be a K in order for it to work. when it was set to i
#it was unable to locate the package as the file it tried to fetch never existed.
OPENSSL_DIR="openssl-0.9.8k"
FREETYPE="freetype-2.3.9"
LDAP="openldap-2.4.17"
FREETDS="freetds-0.82"
# What PHP features do you want enabled?
PHPFEATURES="--prefix=${INSTALLDIR} \
--with-config-file-path=${INSTALLDIR}/etc/php5/${DOMAIN} \
--enable-fastcgi \
--enable-force-cgi-redirect \
--with-xml \
--with-libxml-dir=${INSTALLDIR} \
--with-freetype-dir=${INSTALLDIR} \
--enable-soap \
--with-openssl=/usr \
--with-mhash=${INSTALLDIR} \
--with-mcrypt=${INSTALLDIR} \
--with-zlib-dir=${INSTALLDIR} \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--with-gd \
--enable-gd-native-ttf \
--enable-memory-limit \
--enable-ftp \
--enable-exif \
--enable-sockets \
--enable-wddx \
--with-iconv=${INSTALLDIR} \
--enable-sqlite-utf8 \
--enable-calendar \
--with-curl=${INSTALLDIR} \
--enable-mbstring \
--enable-mbregex \
--enable-bcmath \
--with-mysql=/usr \
--with-mssql=${INSTALLDIR} \
--with-pdo-mssql \
--with-pdo-mysql \
--enable-pdo \
--with-mysqli \
--without-pear \
--with-gettext \
--with-openssl=${INSTALLDIR} \
--with-imap-ssl=/usr \
--with-sybase=${HOME}/usr"
# imap doesn't seems to be working
# fix here, I don't need imap though http://forum.dreamhosters.com/programming/119191-Errors-custom-compiling-PHP5.htm
# --with-imap=${INSTALLDIR} \
# --with-ldap=${INSTALLDIR} \
# ---- end of user-editable bits. Hopefully! ----
# Push the install dir's bin directory into the path
export PATH=${INSTALLDIR}/bin:$PATH
# set up directories
mkdir -p ${SRCDIR}
mkdir -p ${INSTALLDIR}
mkdir -p ${DISTDIR}
cd ${DISTDIR}
# Get all the required packages
wget -c http://us2.php.net/distributions/${PHP5}.tar.gz
wget -c http://mirrors.usc.edu/pub/gnu/libiconv/${LIBICONV}.tar.gz
wget -c http://easynews.dl.sourceforge.net/sourceforge/mcrypt/${LIBMCRYPT}.tar.gz
wget -c ftp://xmlsoft.org/libxml2/${LIBXML2}.tar.gz
wget -c ftp://xmlsoft.org/libxml2/${LIBXSLT}.tar.gz
wget -c http://voxel.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/${MHASH}.tar.gz
wget -c http://www.zlib.net/${ZLIB}.tar.gz
wget -c http://curl.haxx.se/download/${CURL}.tar.gz
wget -c http://kent.dl.sourceforge.net/sourceforge/freetype/${FREETYPE}.tar.gz
wget -c ftp://alpha.gnu.org/pub/gnu/libidn/${LIBIDN}.tar.gz
wget -c ftp://ftp.cac.washington.edu/imap/old/${CCLIENT}.tar.Z
wget -c http://www.openssl.org/source/${OPENSSL}.tar.gz
wget -c ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/${LDAP}.tgz
wget -c http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/${FREETDS}.tar.gz
echo ---------- Unpacking downloaded archives. This process may take several minutes! ----------
cd ${SRCDIR}
# Unpack them all
echo Extracting ${PHP5}...
tar xzf ${DISTDIR}/${PHP5}.tar.gz
echo Done.
echo Extracting ${LIBICONV}...
tar xzf ${DISTDIR}/${LIBICONV}.tar.gz
echo Done.
echo Extracting ${LIBMCRYPT}...
tar xzf ${DISTDIR}/${LIBMCRYPT}.tar.gz
echo Done.
echo Extracting ${LIBXML2}...
tar xzf ${DISTDIR}/${LIBXML2}.tar.gz
echo Done.
echo Extracting ${LIBXSLT}...
tar xzf ${DISTDIR}/${LIBXSLT}.tar.gz
echo Done.
echo Extracting ${MHASH}...
tar xzf ${DISTDIR}/${MHASH}.tar.gz
echo Done.
echo Extracting ${ZLIB}...
tar xzf ${DISTDIR}/${ZLIB}.tar.gz
echo Done.
echo Extracting ${CURL}...
tar xzf ${DISTDIR}/${CURL}.tar.gz
echo Done.
echo Extracting ${LIBIDN}...
tar xzf ${DISTDIR}/${LIBIDN}.tar.gz
echo Done.
echo Extracting ${CCLIENT}...
uncompress -cd ${DISTDIR}/${CCLIENT}.tar.Z |tar x
echo Done.
echo Extracting ${OPENSSL}...
uncompress -cd ${DISTDIR}/${OPENSSL}.tar.gz |tar x
echo Done.
echo Extracting ${FREETYPE}...
tar xzf ${DISTDIR}/${FREETYPE}.tar.gz
echo Done.
echo Extracting ${LDAP}...
tar xzf ${DISTDIR}/${LDAP}.tgz > /dev/null
echo Done.
echo Extracting
tar xzf ${DISTDIR}/${FREETDS}.tar.gz
echo Done.
# Build them in the required order to satisfy dependencies.
#freetds
SYBASE={$INSTALLDIR}
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$SYBASE/lib
export SYBASE LD_LIBRARY_PATH
cd ${SRCDIR}/${FREETDS}
./configure --prefix=${INSTALLDIR} --with-tdsver=8.0 --enable--msdblib --enable-sybase-compat
make
make install
#libiconv
cd ${SRCDIR}/${LIBICONV}
./configure --enable-extra-encodings --prefix=${INSTALLDIR}
# make clean
make
make install
#libxml2
cd ${SRCDIR}/${LIBXML2}
./configure --with-iconv=${INSTALLDIR} --prefix=${INSTALLDIR}
# make clean
make
make install
#libxslt
cd ${SRCDIR}/${LIBXSLT}
./configure --prefix=${INSTALLDIR} \
--with-libxml-prefix=${INSTALLDIR} \
--with-libxml-include-prefix=${INSTALLDIR}/include/ \
--with-libxml-libs-prefix=${INSTALLDIR}/lib/
# make clean
make
make install
#zlib
cd ${SRCDIR}/${ZLIB}
./configure --shared --prefix=${INSTALLDIR}
# make clean
make
make install
#libmcrypt
cd ${SRCDIR}/${LIBMCRYPT}
./configure --disable-posix-threads --prefix=${INSTALLDIR}
# make clean
make
make install
#libmcrypt lltdl issue!!
cd ${SRCDIR}/${LIBMCRYPT}/libltdl
./configure --prefix=${INSTALLDIR} --enable-ltdl-install
# make clean
make
make install
#mhash
cd ${SRCDIR}/${MHASH}
./configure --prefix=${INSTALLDIR}
# make clean
make
make install
#freetype
cd ${SRCDIR}/${FREETYPE}
./configure --prefix=${INSTALLDIR}
# make clean
make
make install
#libidn
cd ${SRCDIR}/${LIBIDN}
./configure --with-libiconv-prefix=${INSTALLDIR} --prefix=${INSTALLDIR}
# make clean
make
make install
# c-client
# cd ${SRCDIR}/${CCLIENT_DIR}
# make ldb
# # Install targets are for wusses!
# cp c-client/c-client.a ${INSTALLDIR}/lib/libc-client.a
# cp c-client/*.h ${INSTALLDIR}/include
# openssl
cd ${SRCDIR}/${OPENSSL_DIR}
# use shared objects for cURL and ldap
./config --prefix=${INSTALLDIR} shared
make
make install
#cURL
cd ${SRCDIR}/${CURL}
./configure --with-ssl=${INSTALLDIR} --with-zlib=${INSTALLDIR} \
--with-libidn=${INSTALLDIR} --enable-ipv6 --enable-cookies \
--enable-crypto-auth --prefix=${INSTALLDIR}
# make clean
make
make install
# ldap
cd ${SRCDIR}/${LDAP}
./configure --prefix=${INSTALLDIR} --disable-slapd --disable-slurpd --with-tls
make
make install
#PHP 5
cd ${SRCDIR}/${PHP5}
./configure ${PHPFEATURES}
# make clean
make
make install
#copy config file
mkdir -p ${INSTALLDIR}/etc/php5/${DOMAIN}
cp ${SRCDIR}/${PHP5}/php.ini-dist ${INSTALLDIR}/etc/php5/${DOMAIN}/php.ini
#copy PHP CGI
mkdir -p ${HOME}/${DOMAIN}/cgi-bin
chmod 0755 ${HOME}/${DOMAIN}/cgi-bin
cp ${INSTALLDIR}/bin/php-cgi ${HOME}/${DOMAIN}/cgi-bin/php.cgi
rm -rf $SRCDIR $DISTDIR
echo ---------- INSTALL COMPLETE! ----------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment