#!/bin/bash # Makefile to compile up the OWASP-for-C++ package after first compiling up its dependencies # The OWASP-for-C package: # http://owasp-esapi-cplusplus.googlecode.com/svn/trunk/doc/html/index.html # It depends on cryptopp, boost (depends on zlib, bzip2, cmake, curl), and requires the safeint header file # unpack everything # (svn checkout owasp-for-c++? or commit as a directory to gs?) # rename cryptopp-version folder to cryptopp # create 'installed' folder # compile everything (or at least all the dependencies) into the installed folder, compile owasp, # with safeint in -I CFLAGS path export securitydir=`pwd` stored_installdir=$installdir export installdir=$securitydir/installed # Cryptopp, Boost, and the SafeInt header file is needed for OWASP-ESAPI-for-C++ CRYPTOPP=cryptopp-5.6.2 # Boost is needed for OWASP-ESAPI-for-C++ ZLIB=zlib-1.2.7 BZIP2=bzip2-1.0.6 CMAKE=cmake-2.8.10.2 CURL=curl-7.30.0 BOOST=boost_1_52_0 SAFEINT=safeint OWASPCPP=gs_owasp-esapi-cpp_03.03.2014 # http://owasp-esapi-cplusplus.googlecode.com/svn/trunk/doc/html/index.html # svn checkout https://owasp-esapi-cplusplus.googlecode.com/svn/trunk/ owasp-esapi-cpp pkglist="$CRYPTOPP $ZLIB $BZIP2 $CURL $CMAKE $BOOST $SAFEINT $OWASPCPP" # If doing tarclean: then get rid of all the extracted folders and the installed folder if [ "x$1" = "xtarclean" ]; then folders="$pkglist $installdir" for folder in $folders; do if [ -d $folder ]; then rm -rf $folder fi done exit fi # make the installed folder if [ ! -e $installdir ]; then mkdir $installdir mkdir $installdir/include fi # UNPACK #ziplist="$CRYPTOPP $boostlist $SAFEINT $OWASPCPP" for zip in $pkglist; do if test ! -d "$zip" ; then tar xvzf $zip.tar.gz fi done # Copy across the Safe Integer header file cp safeint/SafeInt3.hpp $installdir/include/. # Make a symbolic link to cryptopp-version-no. that's called cryptopp if [ -d "$CRYPTOPP" ] && [ ! -e cryptopp ]; then #mv $CRYPTOPP cryptopp ln -s $CRYPTOPP cryptopp fi # COMPILE # Basically, we run the .sh file in the CASCADE-MAKE folder for each package # each package's .sh file will cd into the package's folder (stored in the exported compiledir var) # and then run configure, make and install steps as applicable. # http://stackoverflow.com/questions/546817/iterating-over-two-lists-in-parallel-in-bin-s makearray=("CRYPTOPP" "ZLIB" "BZIP2" "CURL" "CMAKE" "BOOST" "SAFEINT" "OWASPCPP") pkgarray=($pkglist) count=${#makearray[@]} for i in `seq 1 $count` do echo "Compiling ${pkgarray[$i-1]} by running ${makearray[$i-1]}.sh" makefile=${makearray[$i-1]} export compiledir=${pkgarray[$i-1]} if [ -e CASCADE-MAKE/$makefile.sh ]; then ./CASCADE-MAKE/$makefile.sh $* fi done compiledir= export securitydir= export installdir=$stored_installdir