#!/bin/csh -fv # Announce ourselves echo "build_apache_on_solaris9.sh starting at `date`..." # Set environment setenv LD_LIBRARY_PATH /usr/local/lib:/usr/local/ssl/lib:/usr/lib:/usr/openwin/lib:/usr/ccs/lib:/usr/ucblib:/usr/openwin/lib/libp setenv PATH /usr/local/admin:/usr/local/bin:/bin:/usr/bin:/usr/openwin/bin:/sbin:/usr/sbin:/usr/ucb:/usr/local/sbin/:/usr/ccs/bin:/opt/bin:/usr/local/mysql/bin cd /build # Unpack everything set nonomatch foreach gz ( *.gz ) gzip -df $gz end foreach z ( *.Z ) uncompress -f $z end foreach z ( *.z ) uncompress -f $z end foreach t ( *.tar ) tar xvf $t end # Optional install gcc and make #/usr/sbin/pkgadd -n -d /build/gcc-3.3.2-sol9-sparc-local SMCgcc #/usr/sbin/pkgadd -n -d /build/make-3.80-sol8-sparc-local # Blow away bad /usr/ucb/cc rm -f /usr/ucb/cc ln -s `which gcc` /usr/ucb/cc # Check out our compile environment gcc -v make -v which cc which gcc # OpenSSL cd /build/openssl-0.9.7c ./config --prefix=/usr/local --openssldir=/usr/local/openssl shared make make test make install openssl version # Gnu M4 cd /build/m4-1.4 ./configure --prefix=/usr/local make make install # Bison cd /build/bison-1.875 ./configure --prefix=/usr/local make make install # Flex cd /build/flex-2.5.4 ./configure --prefix=/usr/local make make test make install # libxml cd /build/libxml2-2.5.10 ./configure --prefix=/usr/local make make install # libxslt cd /build/libxslt-1.0.32 ./configure --prefix=/usr/local make make install # CrackLib cd /build mv "cracklib,2.7" cracklib2.7 cd /build/cracklib2.7 setenv CC gcc alias cc gcc make all make install cp /build/cracklib2.7/cracklib/libcrack.a /usr/local/lib/libcrack.a chmod +x /usr/local/lib/libcrack.a # Curl cd /build/curl-7.10.5 setenv CFLAGS '-O2 -I/build/openssl-0.9.7c/include -DEAPI' setenv LDFLAGS "-L/build/openssl-0.9.7c" setenv SSL_BASE /build/openssl-0.9.7c ./configure --prefix=/usr/local make make test make install # Berkeley DB cd /build/db-3.1.17/dist setenv CC gcc ./configure --prefix=/usr/local make make install db_verify -V # cyrus-sasl cd /build/cyrus-sasl-2.1.15 setenv LIBS -lcrypto setenv SASL_USE_GSSAPI NO ./configure --prefix=/usr/local --without-krb --enable-login --disable-gssapi \ --disable-krb4 --with-saslauthd=/var/run/saslauthd make make install # cyrus-imap cd /build/cyrus-imapd-2.1.13 ./configure --prefix=/usr/local --with-auth=unix --without-perl make make install # UW IMAP cd /build/imap-2002c1 make gso cp /build/imap-2002c1/src/c-client/rfc822.h /usr/include/rfc822.h chmod +x /usr/include/rfc822.h # libpng cd /build/libpng-1.2.5 cp scripts/makefile.solaris Makefile make make test make install # jpeg cd /build/jpeg-6b ./configure --prefix=/usr/local make make test make install cp /build/jpeg-6b/libjpeg.a /usr/lib/libjpeg.a chmod +x /usr/lib/libjpeg.a # mhash cd /build/mhash-0.8.18 ./configure --prefix=/usr/local make install # libmcrypt cd /build/libmcrypt-2.5.7 cp lib/mcrypt_symb.c src/mcrypt_symb.c ./configure --prefix=/usr/local make # mcrypt cd /build/mcrypt-2.6.4 ./configure --prefix=/usr/local make make install # MySQL cd /build/mysql-4.0.14 ./configure --prefix=/usr/local/mysql make make test make install # Create /etc/my.cnf cat > /etc/my.cnf << EOF [mysqld] datadir=/var/lib/mysql socket=/tmp/mysql.sock [mysql.server] user=mysql basedir=/var/lib [safe_mysqld] err-log=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid EOF # Install the catalog /build/mysql-4.0.14/scripts/mysql_install_db # Verify the catalog was built: ls -lR /var/lib/mysql # Create the MySQL init script cat > /etc/init.d/mysqld << EOF2 #!/bin/sh # # mysqld This shell script takes care of starting and stopping # the MySQL subsystem (mysqld). # # description: MySQL database server. # processname: mysqld # config: /etc/my.cnf # pidfile: /var/run/mysqld.pid prog="MySQL" datadir="/var/lib/mysql" pidfile="/var/run/mysqld/mysqld.pid" start(){ LD_LIBRARY_PATH=/usr/local/lib:/usr/local/ssl/lib:/usr/local/mysql/lib/mysql; export LD_LIBRARY_PATH mkdir -p /var/run/mysqld chown mysql:mysql /var/run/mysqld touch /var/run/mysqld/mysqld.pid chown mysql:mysql /var/run/mysqld/mysqld.pid chmod 0755 /var/run/mysqld/mysqld.pid touch /var/log/mysqld.log chown mysql:mysql /var/log/mysqld.log chmod 0640 /var/log/mysqld.log touch $pidfile chown mysql:mysql $pidfile chmod 0644 $pidfile if [ ! -d $datadir/mysql ] ; then echo "Initializing MySQL database: " /usr/local/mysql/bin/mysql_install_db ret=$? chown -R mysql:mysql $datadir if [ $ret -ne 0 ] ; then return $ret fi fi chown -R mysql:mysql $datadir chmod 0755 $datadir /usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf & ret=$? if [ $ret -eq 0 ]; then echo "Starting $prog: " /bin/true else echo "Starting $prog: " /bin/false fi return $ret } stop(){ /bin/kill `cat $pidfile 2> /dev/null ` > /dev/null 2>&1 ret=$? if [ $ret -eq 0 ]; then echo "Stopping $prog: " /bin/true else echo "Stopping $prog: " /bin/false fi [ $ret -eq 0 ] && rm -f /tmp/mysql.sock [ $ret -eq 0 ] && rm -f $pidfile return $ret } restart(){ stop start } # See how we were called. case "$1" in start) start ;; stop) stop ;; status) status mysqld ;; restart) restart ;; *) echo $"Usage: $0 {start|stop|status|restart}" exit 1 esac exit $? EOF2 chmod +x /etc/init.d/mysqld # Setup MySQL to start automatically on reboot: ln -s /etc/init.d/mysqld /etc/rc2.d/S78mysql ln -s /etc/init.d/mysqld /etc/rc1.d/K01mysql # Now startup MySQL /etc/rc2.d/S78mysql start ps -ef | grep -i sql # Test it /usr/local/mysql/bin/mysql -e status # Apache cd /build/httpd-2.0.48 setenv SSL_BASE /usr/local/openssl ./configure --prefix=/usr/local/httpd \ --with-ssl=/usr/local/openssl \ --enable-so \ --enable-mods-shared=all \ --enable-access=shared --enable-auth=shared --enable-auth_anon=shared \ --enable-auth_dbm=shared --enable-auth_digest=shared --enable-include=shared \ --enable-log_config=shared --enable-env=shared --enable-mime_magic=shared \ --enable-cern_meta=shared --enable-expires=shared --enable-headers=shared \ --enable-usertrack=shared --enable-unique_id=shared --enable-setenvif=shared \ --enable-mime=shared --enable-dav=shared --enable-status=shared \ --enable-autoindex=shared --enable-asis=shared --enable-info=shared \ --enable-cgi=shared --enable-dav_fs=shared --enable-vhost_alias=shared \ --enable-negotiation=shared --enable-dir=shared --enable-imap=shared \ --enable-actions=shared --enable-speling=shared --enable-userdir=shared \ --enable-alias=shared --enable-rewrite=shared --enable-proxy=shared \ --enable-proxy_ftp=shared --enable-proxy_http=shared \ --enable-proxy_connect=shared --enable-rule=SHARED_CORE \ --verbose make make install /usr/local/httpd/bin/httpd -v # Fixup Apache: groupadd apache useradd -d /tmp -g apache apache mkdir -p /var/run/httpd chown apache:apache /var/run/httpd chmod 0755 /var/run/httpd mkdir -p /usr/local/httpd/conf.d cp /usr/local/httpd/conf/httpd.conf /usr/local/httpd/conf/httpd.conf.orig # Now update the init script: /etc/init.d/httpd stop mv /etc/init.d/httpd /etc/init.d/httpd.orig_b4_httpd_upgrade_2_0_48 # Create the init script cat > /etc/init.d/httpd << EOF3 #!/bin/sh # # Startup script for the Apache Web Server # # description: Apache is a World Wide Web server. It is used to serve \ # HTML files and CGI. # processname: httpd # This will prevent initlog from swallowing up a pass-phrase prompt if # mod_ssl needs a pass-phrase from the user. INITLOG_ARGS="" # Path to the apachectl script, server binary, and short-form for messages. apachectl=/usr/local/httpd/bin/apachectl httpd=/usr/local/httpd/bin/httpd pidfile=/usr/local/httpd/logs/httpd.pid prog=httpd RETVAL=0 # The semantics of these two functions differ from the way apachectl does # things -- attempting to start while running is a failure, and shutdown # when not running is also a failure. So we just do it the way init scripts # are expected to behave here. start() { echo "Starting $prog: " $apachectl startssl RETVAL=$? return $RETVAL } stop() { echo "Stopping $prog: " /bin/pkill -U apache kill -5 `/bin/cat $pidfile` RETVAL=$? return $RETVAL } reload() { echo "Reloading $prog: " check13 || exit 1 killproc $httpd -HUP RETVAL=$? return $RETVAL } # See how we were called. case "$1" in start) start ;; stop) stop ;; status) status $httpd RETVAL=$? ;; restart) stop start ;; condrestart) if [ -f $pidfile ] ; then stop start fi ;; reload) reload ;; graceful|help|configtest|fullstatus) $apachectl $@ RETVAL=$? ;; *) echo "Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}" exit 1 esac EOF3 chmod +x /etc/init.d/httpd ln -s /etc/init.d/httpd /etc/rc3.d/S99httpd ln -s /etc/init.d/httpd /etc/rc1.d/K10httpd # PHP cd /build/php-4.3.3 setenv CFLAGS '-O2 -I/build/openssl-0.9.7c/include -DEAPI' setenv LDFLAGS "-L/build/openssl-0.9.7c" ./configure --prefix=/usr/local \ --with-apxs2=/usr/local/httpd/bin/apxs \ --with-config-file-path=/etc --enable-track-vars \ --without-bz2 --with-crack=/build/cracklib2.7 \ --with-curl=/build/curl-7.10.5 --with-cyrus=/build/cyrus-imapd-2.1.13 \ --without-fbsql --without-fdftk --without-fribidi --with-jpeg-dir=/build/jpeg-6b \ --with-png-dir=/build/libpng-1.2.5rc2 --without-hwapi --without-imap \ --without-informix --without-ingres --without-ircg --without-java --without-mcal \ --without-mcrypt --without-mcve --without-ming --without-mnogosearch --without-msession \ --without-ncurses --without-oracle --without-oci8 --without-ovrimos --disable-pcntl \ --without-cpdflib --without-pdflib --without-pfpro --without-pgsql --without-pspell \ --without-qtdom --without-readline --without-libedit --without-recode --without-swf \ --without-sybase --without-sybase-ct --without-xslt-sablot --without-sablot-js \ --without-expat-dir --disable-xslt --without-yaz --disable-yp --without-zip \ --with-mysql=/usr/local/mysql \ --with-xml --with-dom --with-domxml --with-zlib make #make test make install cp php.ini-recommended /usr/local/etc/php.ini (this is new in PHP 4) php -v # Python cd /build/Python-2.3.3 ./configure --prefix=/usr/local make make test make install python -V # Cleanup and exit echo "build_apache_on_solaris9.sh completed at `date`..."