[27131] | 1 | #!/bin/bash
|
---|
| 2 |
|
---|
| 3 | # run as: ./makegs2.sh
|
---|
[28513] | 4 | # or ./makegs2.sh gnome-lib to compile GS2 using gnome-lib
|
---|
| 5 | # which checks out gnome-lib src from svn if needed and if possible
|
---|
[27131] | 6 |
|
---|
[28513] | 7 | docheckout=$1
|
---|
[32003] | 8 | getimagick=$2
|
---|
[27131] | 9 | gsdlhome=`pwd`
|
---|
| 10 | echo "**** GSDLHOME: $gsdlhome"
|
---|
| 11 |
|
---|
[31732] | 12 | bitness=`uname -m`
|
---|
| 13 | # if we're 64 bit, add -fPIC to CFLAGS. Check if bitness contains substring "64"
|
---|
| 14 | if [[ $bitness == *"64"* ]]; then
|
---|
| 15 | export CFLAGS="-fPIC $CFLAGS"
|
---|
| 16 | echo "64 bit unix system, incl -fPIC in CFLAGS so it is now: $CFLAGS"
|
---|
| 17 | fi
|
---|
| 18 |
|
---|
[28513] | 19 | # Compile by chaining the commands with && so it stops at that stage after an error
|
---|
| 20 | cd $gsdlhome
|
---|
[27134] | 21 | if [ "x$docheckout" = "xgnome-lib" ]; then
|
---|
[28513] | 22 | ./configure --enable-gnome-lib-ext --enable-apache-httpd \
|
---|
| 23 | && make \
|
---|
| 24 | && make install
|
---|
| 25 | else
|
---|
| 26 | ./configure --enable-apache-httpd \
|
---|
| 27 | && make \
|
---|
| 28 | && make install
|
---|
[27131] | 29 | fi
|
---|
| 30 |
|
---|
[27635] | 31 | status=$?
|
---|
| 32 | echo "****************************************"
|
---|
| 33 | if [ $status = 0 ] ; then
|
---|
| 34 | # 5. Message to warn user that the env of this x-term uses gnome-lib
|
---|
| 35 | # and GUIs may not work from this console
|
---|
[28513] | 36 | if [ "x$docheckout" = "xgnome-lib" ]; then
|
---|
| 37 | echo "*** The environment for this console has been set to compile Greenstone with gnome-lib."
|
---|
| 38 | echo "*** As a result, graphical applications may not work well."
|
---|
| 39 | echo "*** In such a case, open a new console."
|
---|
| 40 | else
|
---|
| 41 | echo "Finished compiling Greenstone2. (Compiled without gnome-lib)"
|
---|
| 42 | fi
|
---|
[27635] | 43 | else
|
---|
| 44 | echo "@@@ Error compiling up Greenstone. Return status: $status"
|
---|
| 45 | fi
|
---|
[31732] | 46 | if [[ $bitness == *"64"* ]]; then
|
---|
| 47 | echo ""
|
---|
| 48 | echo "This unix is 64 bit. So added -fPIC to CFLAGS, which is now: $CFLAGS"
|
---|
| 49 | fi
|
---|
[27635] | 50 | echo "****************************************"
|
---|
| 51 |
|
---|
| 52 |
|
---|
[32003] | 53 | imgpkg=
|
---|
| 54 | if [ "x$getimagick" = "ximagemagick" ]; then
|
---|
| 55 | os=`uname`
|
---|
[27635] | 56 |
|
---|
[32003] | 57 | if [ "x$os" = "xDarwin" ]; then
|
---|
| 58 | # by default, resort to the Mac Leopard (10.5, kernel 12.6.0)'s imagemagick binary
|
---|
| 59 | imgpkg=http://trac.greenstone.org/export/head/gs2-extensions/imagemagick/trunk/imagemagick-darwin-10.5.tar.gz
|
---|
| 60 |
|
---|
| 61 | kernelVersion=`uname -r`
|
---|
| 62 | # El Capitan is MacOS version 10.11 but its kernelVersion is 15.6.0
|
---|
| 63 | if [ "x$kernelVersion" = "x15.6.0" ]; then
|
---|
| 64 | echo "Getting imagemagick built for El Capitan"
|
---|
| 65 | imgpkg=http://trac.greenstone.org/export/head/gs2-extensions/imagemagick/trunk/imagemagick-darwin-10.11.tar.gz
|
---|
| 66 | else
|
---|
| 67 | echo "Getting imagemagick built on Mac Leopard"
|
---|
| 68 | fi
|
---|
| 69 |
|
---|
| 70 | pushd ext
|
---|
| 71 | curl $imgpkg > imagemagick.tar.gz
|
---|
| 72 | tar -xvzf imagemagick.tar.gz
|
---|
| 73 | mv imagemagick/darwin ../bin/darwin/imagemagick
|
---|
| 74 | popd
|
---|
| 75 |
|
---|
| 76 | else
|
---|
| 77 | # linux
|
---|
| 78 | pushd ext
|
---|
| 79 | if [[ $bitness == *"64"* ]]; then
|
---|
| 80 | echo "Getting 64 bit imagemagick precompiled binary"
|
---|
| 81 | wget http://trac.greenstone.org/export/head/gs2-extensions/imagemagick/trunk/imagemagick-linux-x64.tar.gz
|
---|
| 82 | tar -xvzf imagemagick-linux-x64.tar.gz
|
---|
| 83 | else
|
---|
| 84 | echo "Getting 32 bit imagemagick precompiled binary"
|
---|
| 85 | wget http://trac.greenstone.org/export/head/gs2-extensions/imagemagick/trunk/imagemagick-linux.tar.gz
|
---|
| 86 | tar -xvzf imagemagick-linux.tar.gz
|
---|
| 87 | fi
|
---|
| 88 |
|
---|
| 89 | mv imagemagick/linux ../bin/linux/imagemagick
|
---|
| 90 | popd
|
---|
| 91 | fi
|
---|
| 92 |
|
---|
| 93 | fi
|
---|