[28866] | 1 | #!/bin/bash
|
---|
| 2 |
|
---|
| 3 | # Makefile to compile up the OWASP-for-C++ package after first compiling up its dependencies
|
---|
| 4 | # The OWASP-for-C package:
|
---|
| 5 | # http://owasp-esapi-cplusplus.googlecode.com/svn/trunk/doc/html/index.html
|
---|
| 6 | # It depends on cryptopp, boost (depends on zlib, bzip2, cmake, curl), and requires the safeint header file
|
---|
| 7 |
|
---|
| 8 | # unpack everything
|
---|
| 9 | # (svn checkout owasp-for-c++? or commit as a directory to gs?)
|
---|
| 10 | # rename cryptopp-version folder to cryptopp
|
---|
| 11 | # create 'installed' folder
|
---|
| 12 | # compile everything (or at least all the dependencies) into the installed folder, compile owasp,
|
---|
| 13 | # with safeint in -I CFLAGS path
|
---|
| 14 |
|
---|
| 15 | export securitydir=`pwd`
|
---|
| 16 | stored_installdir=$installdir
|
---|
| 17 | export installdir=$securitydir/installed
|
---|
| 18 |
|
---|
| 19 | # Cryptopp, Boost, and the SafeInt header file is needed for OWASP-ESAPI-for-C++
|
---|
| 20 | CRYPTOPP=cryptopp-5.6.2
|
---|
| 21 |
|
---|
| 22 | # Boost is needed for OWASP-ESAPI-for-C++
|
---|
| 23 | ZLIB=zlib-1.2.7
|
---|
| 24 | BZIP2=bzip2-1.0.6
|
---|
| 25 | CMAKE=cmake-2.8.10.2
|
---|
| 26 | CURL=curl-7.30.0
|
---|
| 27 | BOOST=boost_1_52_0
|
---|
| 28 |
|
---|
| 29 | SAFEINT=safeint
|
---|
| 30 | OWASPCPP=gs_owasp-esapi-cpp_03.03.2014
|
---|
| 31 | # http://owasp-esapi-cplusplus.googlecode.com/svn/trunk/doc/html/index.html
|
---|
| 32 | # svn checkout https://owasp-esapi-cplusplus.googlecode.com/svn/trunk/ owasp-esapi-cpp
|
---|
| 33 |
|
---|
[28867] | 34 | pkglist="$SAFEINT $CRYPTOPP $ZLIB $BZIP2 $CURL $CMAKE $BOOST $OWASPCPP"
|
---|
[28866] | 35 |
|
---|
| 36 |
|
---|
| 37 | # If doing tarclean: then get rid of all the extracted folders and the installed folder
|
---|
| 38 | if [ "x$1" = "xtarclean" ]; then
|
---|
| 39 | folders="$pkglist $installdir"
|
---|
| 40 | for folder in $folders; do
|
---|
| 41 | if [ -d $folder ]; then
|
---|
| 42 | rm -rf $folder
|
---|
| 43 | fi
|
---|
| 44 | done
|
---|
| 45 | exit
|
---|
| 46 | fi
|
---|
| 47 |
|
---|
| 48 |
|
---|
| 49 | # make the installed folder
|
---|
| 50 | if [ ! -e $installdir ]; then
|
---|
| 51 | mkdir $installdir
|
---|
| 52 | mkdir $installdir/include
|
---|
| 53 | fi
|
---|
| 54 |
|
---|
| 55 | # UNPACK
|
---|
| 56 | #ziplist="$CRYPTOPP $boostlist $SAFEINT $OWASPCPP"
|
---|
| 57 | for zip in $pkglist; do
|
---|
| 58 | if test ! -d "$zip" ; then
|
---|
| 59 | tar xvzf $zip.tar.gz
|
---|
| 60 | fi
|
---|
| 61 | done
|
---|
| 62 |
|
---|
| 63 | # Copy across the Safe Integer header file
|
---|
| 64 | cp safeint/SafeInt3.hpp $installdir/include/.
|
---|
| 65 |
|
---|
| 66 | # Make a symbolic link to cryptopp-version-no. that's called cryptopp
|
---|
| 67 | if [ -d "$CRYPTOPP" ] && [ ! -e cryptopp ]; then
|
---|
| 68 | #mv $CRYPTOPP cryptopp
|
---|
| 69 | ln -s $CRYPTOPP cryptopp
|
---|
| 70 | fi
|
---|
| 71 |
|
---|
| 72 |
|
---|
| 73 | # COMPILE
|
---|
| 74 | # Basically, we run the <package>.sh file in the CASCADE-MAKE folder for each package
|
---|
| 75 | # each package's .sh file will cd into the package's folder (stored in the exported compiledir var)
|
---|
| 76 | # and then run configure, make and install steps as applicable.
|
---|
| 77 |
|
---|
| 78 | # http://stackoverflow.com/questions/546817/iterating-over-two-lists-in-parallel-in-bin-s
|
---|
[28867] | 79 | makearray=("SAFEINT" "CRYPTOPP" "ZLIB" "BZIP2" "CURL" "CMAKE" "BOOST" "OWASPCPP")
|
---|
[28866] | 80 | pkgarray=($pkglist)
|
---|
| 81 |
|
---|
| 82 | count=${#makearray[@]}
|
---|
| 83 | for i in `seq 1 $count`
|
---|
| 84 | do
|
---|
| 85 | makefile=${makearray[$i-1]}
|
---|
| 86 | export compiledir=${pkgarray[$i-1]}
|
---|
| 87 |
|
---|
| 88 | if [ -e CASCADE-MAKE/$makefile.sh ]; then
|
---|
[28867] | 89 | echo "Compiling $compiledir by running makefile.sh"
|
---|
[28866] | 90 | ./CASCADE-MAKE/$makefile.sh $*
|
---|
| 91 | fi
|
---|
| 92 | done
|
---|
| 93 | compiledir=
|
---|
| 94 |
|
---|
| 95 | export securitydir=
|
---|
| 96 | export installdir=$stored_installdir
|
---|