Skip to content
Snippets Groups Projects
Commit 69324cfd authored by Tom Fischer's avatar Tom Fischer
Browse files

Merge pull request #468 from bilke/scripts-cleanup

scripts-folder cleanup
parents 2998bd3c b0cad2e0
No related branches found
No related tags found
No related merge requests found
Showing
with 1 addition and 451 deletions
File moved
File moved
File moved
File moved
if [ "$OPTARG" == "x32" ]; then
ARCHITECTURE="x32"
WIN_ARCHITECTURE="x86"
BITS="32"
elif [ "$OPTARG" == "x64" ]; then
ARCHITECTURE="x64"
WIN_ARCHITECTURE="x64"
BITS="64"
else
echo "$OPTARG is not a valid argument. Specify x32 or x64."
exit 1
fi
\ No newline at end of file
if [ -z $BUILD_LOCATION ]; then
echo "You must specify a build directory (relative to the source directory)."
echo "Aborting..."
echo "Usage: $0 -d /build/directory"
exit 1
fi
# Cleanup
rm -rf $BUILD_LOCATION
mkdir -p $BUILD_LOCATION && cd $BUILD_LOCATION
\ No newline at end of file
if [ "$OSTYPE" == 'msys' ]; then
if [ "$ARCHITECTURE" != "x32" -a "$ARCHITECTURE" != "x64" ]; then
echo "You did not pass the cpu architecture as a script parameter. Aborting..."
echo "Usage: $0 -a [x32|x64]"
exit 1
fi
fi
\ No newline at end of file
NUM_PROCESSORS=""
if [ "$OSTYPE" == 'msys' ]; then
source $SOURCE_LOCATION/scripts/base/configure_win_vs.sh
else
CMAKE_GENERATOR="Unix Makefiles"
if [[ "$OSTYPE" == darwin* ]]; then
NUM_PROCESSORS=`sysctl hw.ncpu | awk '{print $2}'`
else
NUM_PROCESSORS=`cat /proc/cpuinfo | grep processor | wc -l`
fi
fi
\ No newline at end of file
# Check Visual Studio version and setup CMake generator
if [ -z "$VS110COMNTOOLS" ]; then
if [ -z "$VS100COMNTOOLS" ]; then
if [ -z "$VS90COMNTOOLS" ]; then
if [ -z "$VS80COMNTOOLS" ]; then
echo "Error: Visual Studio not found"
exit 1
else
WIN_DEVENV_PATH="$VS80COMNTOOLS..\\IDE"
CMAKE_GENERATOR="Visual Studio 8 2005"
fi
else
WIN_DEVENV_PATH="$VS90COMNTOOLS..\\IDE"
CMAKE_GENERATOR="Visual Studio 9 2008"
fi
else
WIN_DEVENV_PATH="$VS100COMNTOOLS..\\IDE\\"
CMAKE_GENERATOR="Visual Studio 10"
fi
else
WIN_DEVENV_PATH="$VS110COMNTOOLS..\\IDE\\"
CMAKE_GENERATOR="Visual Studio 11"
if [ "$ARCHITECTURE" == "x64" ]; then
WIN_ARCHITECTURE="x86_amd64"
fi
fi
if [ "$ARCHITECTURE" == "x64" ]; then
CMAKE_GENERATOR="$CMAKE_GENERATOR Win64"
fi
DEVENV_EXE="${WIN_DEVENV_PATH}devenv"
# Replace backslashes in WIN_DEVENV_PATH
DEVENV_PATH=$(echo "$WIN_DEVENV_PATH" | awk '{ gsub(/\\/, "/"); print }')
DEVENV_PATH=$(echo "$DEVENV_PATH" | awk '{ gsub(/C:\//, "/c/"); print }')
echo "Visual Studio found: $DEVENV_PATH"
echo "Devenv: $DEVENV_EXE"
echo "CMake Generator: $CMAKE_GENERATOR"
export PATH=$PATH:$DEVENV_PATH
\ No newline at end of file
# Argument 1: Download URL (SSL is not working)
# Argument 2: Destination path
# Argument 3: MD5-Hash (Optional)
download_file() {
if [ "$#" -eq "2" ]; then
echo "file (DOWNLOAD \"$1\" \"$2\" SHOW_PROGRESS)" > download_file.cmake
elif [ "$#" -eq "3" ]; then
echo "file (DOWNLOAD \"$1\" \"$2\" EXPECTED_MD5 \"$3\" SHOW_PROGRESS)" > download_file.cmake
fi
echo "Downloading file $1 ..."
cmake -P download_file.cmake
rm download_file.cmake
}
\ No newline at end of file
......@@ -24,6 +24,6 @@ IF(DOXYGEN_FOUND)
COMMENT "Generating docset ...")
ENDIF() # DOCS_GENERATE_DOCSET
CONFIGURE_FILE(scripts/docs/Doxyfile.in ${PROJECT_BINARY_DIR}/Doxyfile)
CONFIGURE_FILE(Documentation/Doxyfile.in ${PROJECT_BINARY_DIR}/Doxyfile)
ENDIF() # DOXYGEN_FOUND
# Get script directory
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DIR=$SCRIPT_DIR/..
source $SCRIPT_DIR/base/download_file_with_cmake.sh
### Init git hooks ###
# Check for uncrustify
UNCRUSTIFY_LOCATION=`which uncrustify`
if [ -z "$UNCRUSTIFY_LOCATION" ]; then
if [ "$OSTYPE" == 'msys' ]; then
mkdir -vp ~/bin
export PATH=$PATH:~/bin
download_file http://sourceforge.net/projects/uncrustify/files/uncrustify/uncrustify-0.59/uncrustify-0.59-win32.zip/download ./uncrustify-0.59-win32.zip
7za x uncrustify-0.59-win32.zip
mv uncrustify-0.59-win32/uncrustify.exe ~/bin
rm -r uncrustify-0.59-win32*
if [ ! -f ~/bin/uncrustify.exe ]; then
echo "Error downloading uncrustify! Git hooks not set."
else
UNCRUSTIFY_LOCATION=~/bin/uncrustify.exe
fi
else
echo "Please install uncrustify (http://uncrustify.sourceforge.net) to setup git hooks."
exit 1
fi
fi
cd $DIR
# Enable git hooks
# Does not work on Windows at the moment
if [ ! "$OSTYPE" == 'msys' ]; then
cd .git/hooks
git init
cd ../..
git fetch origin
cd .git/hooks
git pull .. remotes/origin/hooks
cd $DIR
# Set git configs for running uncrustify
git config --add --bool hooks.uncrustify true
git config hooks.uncrustify.path $UNCRUSTIFY_LOCATION
git config hooks.uncrustify.conf $SCRIPT_DIR/style/uncrustify.cfg
fi
File deleted
# Setup scripts for Windows #
## setup.sh ##
If you are on Windows you can run `setup.sh` on the *Git Bash* to setup all required third party libraries for OGS (including the Data Explorer). Make also sure you have working Internet connection. For more details have a look on the [devguide][dev].
The following options are available:
- `-a [x32|x64]` to build for either 32- or 64-bits
- `-s` to build Qt with Oracle SQL bindings
A typical call would look like this:
cd /scripts/setup
./setup.sh -a x64 -d
The compilation of the libraries will take some time. Make sure to set the Qt environment variables as described in the [devguide][dev].
[dev]: (http://ufz.github.com/devguide/win-prerequisites/).
\ No newline at end of file
#!/usr/bin/env bash
# Parse options
while getopts ":a:d:s" opt; do
case $opt in
a)
if [ "$OPTARG" == "x32" ]; then
ARCHITECTURE="x32"
WIN_ARCHITECTURE="x86"
elif [ "$OPTARG" == "x64" ]; then
ARCHITECTURE="x64"
WIN_ARCHITECTURE="x64"
else
echo "$OPTARG is not a valid argument. Specify x32 or x64."
exit 1
fi
;;
\?)
echo "Invalid option: -$OPTARG"
exit 1
;;
:)
echo "Option -$OPTARG requires an argument."
exit 1
;;
s)
echo "Qt SQL bindings enabled."
QT_SQL=true
;;
esac
done
SOURCE_LOCATION=`pwd`
SOURCE_LOCATION="$SOURCE_LOCATION/../.."
source setup_prerequisites.sh
source setup_libraries.sh
# source setup_builds.sh
if [ $QT_WAS_BUILT ]; then
echo "Important note: Make sure to add the Qt environment variables!"
if [ $QT_SQL ]; then
echo "Important note: Make sure to add the instantclient directory to the PATH!"
fi
fi
\ No newline at end of file
#!/usr/bin/env bash
LIBS_LOCATION="$SOURCE_LOCATION/../libs"
mkdir -vp $LIBS_LOCATION
cd $LIBS_LOCATION
mkdir -vp include
mkdir -vp lib
QMAKE_LOCATION=`which qmake`
QT_VERSION="qt-everywhere-opensource-src-4.8.3"
VTK_VERSION="vtk-5.10.0"
SHAPELIB_VERSION="shapelib-1.3.0"
LIBGEOTIFF_VERSION="libgeotiff-1.3.0"
INSTANTCLIENT_VERSION="instantclient_11_2"
METIS_VERSION="metis-5.0.2"
BOOST_VERSION="1.53.0"
BOOST_VERSION_UNDERSCORE=${BOOST_VERSION//./_}
## Windows specific
if [ "$OSTYPE" == 'msys' ]; then
if [ -z "$QMAKE_LOCATION" ]; then
# Install Qt
if [ ! -d qt ]; then
# Download and extract
download_file http://releases.qt-project.org/qt4/source/$QT_VERSION.zip ./$QT_VERSION.zip
7za x $QT_VERSION.zip
mv $QT_VERSION/ qt/
rm $QT_VERSION.zip
elif [ -f qt/bin/qmake.exe -a -f qt/bin/QtGui4.dll -a -f qt/bin/QtGuid4.dll ]; then
# Already installed
QT_FOUND=true
fi
if [ $QT_FOUND ]; then
echo "Qt already installed in $LIBS_LOCATION/qt"
else
# Compile
QT_CONFIGURATION="-debug-and-release"
# Get instantclient
QT_SQL_ARGS=""
if [ $QT_SQL ]; then
if [ ! -d instantclient ]; then
if [ "$ARCHITECTURE" == "x64" ]; then
download_file http://dl.dropbox.com/u/5581063/instantclient_11_2_x64.zip ./instantclient_11_2_x64.zip 015bd1b163571988cacf70e7d6185cb5
7za x instantclient_11_2_x64.zip
mv instantclient_11_2/ instantclient/
rm instantclient_11_2_x64.zip
fi
fi
QT_SQL_ARGS="-qt-sql-oci -I %cd%\..\instantclient\sdk\include -L %cd%\..\instantclient\sdk\lib\msvc"
fi
cd qt
echo " \
\"$WIN_DEVENV_PATH\\..\\..\\VC\\vcvarsall.bat\" $WIN_ARCHITECTURE &&\
echo y | configure -opensource -no-accessibility -no-dsp -no-vcproj -no-phonon -no-webkit -no-scripttools -nomake demos -nomake examples $QT_CONFIGURATION $QT_SQL_ARGS &&\
jom && nmake clean &&\
exit\
" > build.bat
$COMSPEC //k build.bat
QT_WAS_BUILT=true
fi
export PATH=$PATH:$LIBS_LOCATION/qt/bin
else
echo "Qt already installed in $QMAKE_LOCATION"
fi
# Install VTK
cd $LIBS_LOCATION
if [ ! -d vtk ]; then
# Download, extract, rename
download_file http://www.vtk.org/files/release/5.10/$VTK_VERSION.tar.gz ./$VTK_VERSION.tar.gz
tar -xf $VTK_VERSION.tar.gz
rm $VTK_VERSION.tar.gz
# Check for existing installation
elif [ -f vtk/build/bin/Release/QVTK.lib -a -f vtk/build/bin/Release/vtkRendering.lib ]; then
if [ $LIB_DEBUG ]; then
if [ -f vtk/build/bin/Debug/QVTK.lib -a -f vtk/build/bin/Debug/vtkRendering.lib ]; then
VTK_FOUND=true
fi
else
VTK_FOUND=true
fi
fi
if [ $VTK_FOUND ]; then
echo "VTK already installed in $LIBS_LOCATION/vtk"
else
# Compile
cd vtk
mkdir -vp build
cd build
cmake .. -DBUILD_TESTING=OFF -DVTK_USE_QT=ON -G "$CMAKE_GENERATOR"
cmake ..
cmake --build . --config Release
cmake --build . --config Release --target QVTK
cmake --build . --config Debug
cmake --build . --config Debug --target QVTK
fi
# Install libgeotiff
cd $LIBS_LOCATION
if [ ! -d libgeotiff ]; then
# Download, extract
download_file http://download.osgeo.org/geotiff/libgeotiff/$LIBGEOTIFF_VERSION.tar.gz ./$LIBGEOTIFF_VERSION.tar.gz
tar -xf $LIBGEOTIFF_VERSION.tar.gz
mv $LIBGEOTIFF_VERSION/ libgeotiff/
rm -rf $LIBGEOTIFF_VERSION.tar.gz
elif [ -f libgeotiff/geotiff.lib ]; then
LIBGEOTIFF_FOUND=true
fi
if [ $LIBGEOTIFF_FOUND ]; then
echo "Libgeotiff already installed in $LIBS_LOCATION/libgeotiff"
else
# Compile
cd libgeotiff
# Download modified makefile
if [ ! -f makefile_mod.vc ]; then
download_file http://dl.dropbox.com/u/5581063/makefile_mod.vc ./makefile_mod.vc 14fb13a5bd04ffc298fee7825dc7679f
fi
echo " \
\"$WIN_DEVENV_PATH\\..\\..\\VC\\vcvarsall.bat\" $WIN_ARCHITECTURE &&\
nmake /f makefile_mod.vc all&&\
exit\
" > build.bat
$COMSPEC //k build.bat
fi
# Install Metis
cd $LIBS_LOCATION
if [ ! -d metis ]; then
# Download, extract, rename
download_file http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/$METIS_VERSION.tar.gz ./$METIS_VERSION.tar.gz
tar -xf $METIS_VERSION.tar.gz
mv $METIS_VERSION/ metis/
rm $METIS_VERSION.tar.gz
# Check for existing installation
elif [ -f metis/build/windows/libmetis/Release/metis.lib ]; then
METIS_FOUND=true
fi
if [ $METIS_FOUND ]; then
echo "Metis already installed in $LIBS_LOCATION/metis"
else
# Compile
cd metis
$COMSPEC //c "vsgen.bat -G \"$CMAKE_GENERATOR\""
cd build/windows
cmake --build . --config Release
cd ../..
cp build/windows/libmetis/Release/metis.lib ../lib/metis.lib
cp include/metis.h ../include/metis.h
fi
# Install Boost
cd $LIBS_LOCATION
if [ ! -d boost ]; then
# Download, extract, rename
download_file http://sourceforge.net/projects/boost/files/boost/$BOOST_VERSION/boost_$BOOST_VERSION_UNDERSCORE.zip/download ./boost_$BOOST_VERSION_UNDERSCORE.zip
7za x boost_$BOOST_VERSION_UNDERSCORE.zip
mv boost_$BOOST_VERSION_UNDERSCORE/ boost/
rm boost_$BOOST_VERSION_UNDERSCORE.zip
elif [ -d boost/stage/lib ]; then
BOOST_FOUND=true
fi
if [ $BOOST_FOUND ]; then
echo "Boost is already installed in ..."
else
# Compile
cd boost
echo " \
\"$WIN_DEVENV_PATH\\..\\..\\VC\\vcvarsall.bat\" $WIN_ARCHITECTURE &&\
bootstrap.bat &&\
bjam.exe address-model=$BITS &&\
exit\
" > build.bat
$COMSPEC //k build.bat
fi
fi
cd $SOURCE_LOCATION/scripts/setup
#!/usr/bin/env bash
# Check for prerequisites
CMAKE_LOCATION=`which cmake`
if [ -z "$CMAKE_LOCATION" ]; then
echo "CMake not found! Aborting..."
exit 1
fi
source $SOURCE_LOCATION/scripts/base/download_file_with_cmake.sh
source $SOURCE_LOCATION/scripts/base/configure_compiler.sh
## Windows specific
if [ "$OSTYPE" == 'msys' ]; then
mkdir -vp ~/bin
export PATH=$PATH:~/bin
# 7-zip
SEVENZIP_LOCATION=`which 7za`
if [ ! -z "$SEVENZIP_LOCATION" ]; then
echo "7-zip found."
else
cd ~/bin
download_file http://dl.dropbox.com/u/5581063/7za.exe ./7za.exe e92604e043f51c604b6d1ac3bcd3a202
fi
SEVENZIP_LOCATION=`which 7za`
if [ -z "$SEVENZIP_LOCATION" ]; then
echo "7-zip not downloaded! Aborting..."
exit 1
fi
# jom
JOM_LOCATION=`which jom`
if [ ! -z "$JOM_LOCATION" ]; then
echo "jom found."
else
cd ~/bin
download_file http://dl.dropbox.com/u/5581063/jom.exe ./jom.exe 335428f223d36f0a39faaa845222346d
fi
JOM_LOCATION=`which jom`
if [ -z "$JOM_LOCATION" ]; then
echo "jom not downloaded! Aborting..."
exit 1
fi
fi
cd "$SOURCE_LOCATION/scripts/setup"
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment