1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
|
#!/bin/sh
# installation wrapper-script to compile and install ODIN
# on Windows using an MSYS UNIX shell
command="`basename $0`"
usage="usage: $command [-d (debug mode)] [-n (no multi-threading)] [-j <make jobs>] [-a <ACML dir>] <MR-Software-dir> <installation-dir>"
# parse options
EXTRA_CONFIG_OPTS="--disable-unit-test"
EXTRA_CXXFLAGS="-mthreads"
EXTRA_LDFLAGS="-mthreads"
MFLAGS=""
ACMLDIR=""
dist="yes"
continue="yes"
while [ $continue = "yes" ] ; do
case "$1" in
-d) EXTRA_CONFIG_OPTS="--enable-debug" ; dist="no" ; shift 1 ;;
-n) EXTRA_CXXFLAGS="" ; EXTRA_LDFLAGS="" ; EXTRA_CONFIG_OPTS="--disable-threads $EXTRA_CONFIG_OPTS" ; shift 1 ;;
-j) shift 1 ; MFLAGS="-j $1" ; shift 1 ;;
-a) shift 1 ; ACMLDIR="$1" ; EXTRA_BUILD_LDFLAGS="-L${ACMLDIR} $EXTRA_BUILD_LDFLAGS" ; EXTRA_CONFIG_OPTS="--enable-acmlsupport $EXTRA_CONFIG_OPTS" ; shift 1 ;;
*) continue="no" ;;
esac
done
case $# in
2) MR_SOFTWARE_DIR="$1"
INSTALLDIR="$2";;
*) echo $usage; exit;;
esac
for checkpath in "$MR_SOFTWARE_DIR" "$INSTALLDIR" "$ACMLDIR" ; do
if test ! -z $checkpath ; then
if ! (echo $checkpath | grep -q "^.:/") ; then
echo "ERROR: Please use the drive letter notation X:/somedir instead of $checkpath" ; exit -1;
fi
fi
done
# -O2 does not work withc GCC 3.4.5
EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -O1"
EXTRA_BUILD_CXXFLAGS="-I${MR_SOFTWARE_DIR}/include $EXTRA_BUILD_CXXFLAGS"
EXTRA_BUILD_LDFLAGS="-L${MR_SOFTWARE_DIR}/lib $EXTRA_BUILD_LDFLAGS"
QTDIR_SLASH="`echo $QTDIR | sed 's/\\\\/\\//g'`"
echo "EXTRA_CXXFLAGS=$EXTRA_CXXFLAGS"
echo "EXTRA_LDFLAGS =$EXTRA_LDFLAGS"
echo "EXTRA_BUILD_CXXFLAGS=$EXTRA_BUILD_CXXFLAGS"
echo "EXTRA_BUILD_LDFLAGS =$EXTRA_BUILD_LDFLAGS"
echo "EXTRA_CONFIG_OPTS =$EXTRA_CONFIG_OPTS"
if [ ! -f Makefile ] ; then
if ! CXXFLAGS="$EXTRA_CXXFLAGS" LDFLAGS="$EXTRA_LDFLAGS" ./configure \
--with-extra-build-cxxflags="$EXTRA_BUILD_CXXFLAGS" \
--with-extra-build-ldflags="$EXTRA_BUILD_LDFLAGS" \
--with-extra-include-base="${MR_SOFTWARE_DIR}/include" \
--prefix=$INSTALLDIR \
--with-qt-dir="$QTDIR_SLASH" \
--enable-static --disable-shared \
$EXTRA_CONFIG_OPTS
then
echo "ERROR: MinGW configure failed"
exit -1
fi
fi
if ! make $MFLAGS install ; then
echo "ERROR: MinGW build failed"
exit -1
fi
if [ $dist = "yes" ] ; then
# Modify doxygen file: Add dot path
cat odin.doxygen | grep -v DOT_PATH > odin.doxygen.tmp
mv odin.doxygen.tmp odin.doxygen
echo "DOT_PATH = c:/Programme/Graphviz/bin" >> odin.doxygen
# Add path for extra DLLs required during printing usage for manual
export PATH="$PATH":"$MR_SOFTWARE_DIR/bin"
if [ ! -d manual ] ; then
echo -n "Creating Manual ..."
if ! (cp /c/Programme/Doxygen/bin/doxygen.exe . && make manual && mkdir -p $INSTALLDIR/share/doc/odin && cp -r manual $INSTALLDIR/share/doc/odin/)
then
echo "ERROR: Manual failed"
exit -1
fi
fi
fi
echo -n "Copying ODIN source code to $INSTALLDIR ..."
if ! (make dist && mkdir -p $INSTALLDIR/src && cp odin-*.tar.gz $INSTALLDIR/src/)
then
echo "ERROR: Copy source failed"
exit -1
fi
echo "done"
echo -n "Copying MR-Software stuff to $INSTALLDIR ..."
cp $MR_SOFTWARE_DIR/bin/notepad++.exe $MR_SOFTWARE_DIR/bin/*.xml $MR_SOFTWARE_DIR/bin/SciLexer.dll $INSTALLDIR/bin
for mrsoftinclude in blitz ; do
cp -r $MR_SOFTWARE_DIR/include/$mrsoftinclude $INSTALLDIR/include
done
for mrsoftlib in libgsl.a libgslcblas.a libblitz.a ; do
cp $MR_SOFTWARE_DIR/lib/$mrsoftlib $INSTALLDIR/lib
done
for optmrsoftlib in libniftiio.a libznz.a libz.a libpng.a libofstd.a libdcmdata.a libdcmimgle.a ; do
if test -f $MR_SOFTWARE_DIR/lib/$optmrsoftlib ; then
cp $MR_SOFTWARE_DIR/lib/$optmrsoftlib $INSTALLDIR/lib
fi
done
echo "done"
echo -n "Copying MinGW stuff to $INSTALLDIR ..."
MINGWDIR=$(dirname $(dirname $(which g++)))
MINGW32NAME=$(basename $(find $MINGWDIR -maxdepth 1 -name '*mingw32') )
for subdir in bin include lib libexec $MINGW32NAME ; do
cp -r $MINGWDIR/${subdir} $INSTALLDIR/
done
echo "done"
echo -n "Copying MSYS stuff to $INSTALLDIR ..."
mkdir -p $INSTALLDIR/msys
for subdir in /bin /etc ; do
cp -r $subdir $INSTALLDIR/msys
done
echo "done"
echo -n "Removing unused Java stuff in $INSTALLDIR ..."
rm -rf $(find $INSTALLDIR -depth -name java*)
echo "done"
echo -n "Setting up $INSTALLDIR/bin/shell.bat ..."
echo 'set PATH=%1\bin;%PATH%' > $INSTALLDIR/bin/shell.bat
echo 'set LD_LIBRARY_PATH=%1\lib;%LD_LIBRARY_PATH%' >> $INSTALLDIR/bin/shell.bat
echo 'set LIBRARY_PATH=%1\lib;%LIBRARY_PATH%' >> $INSTALLDIR/bin/shell.bat
echo 'set CPLUS_INCLUDE_PATH=%1\include;%CPLUS_INCLUDE_PATH%' >> $INSTALLDIR/bin/shell.bat
echo 'set MANPATH=%1\man;%MANPATH%' >> $INSTALLDIR/bin/shell.bat
echo 'start %1%\msys\bin\rxvt.exe -backspacekey -sl 2500 -fg White -bg Black -sr -fn Courier-16 -tn msys -e /bin/sh --login -i' >> $INSTALLDIR/bin/shell.bat
echo "done"
echo -n "Creating dummy cygpath ..."
echo "#!/bin/sh" > $INSTALLDIR/msys/bin/cygpath
echo "eval echo \\\"\\\$\\{\$#\\}\\\"" >> $INSTALLDIR/msys/bin/cygpath
echo "done"
echo -n "Copying Qt stuff to $INSTALLDIR ..."
for qtdll in QtCore4 QtGui4 Qt5Core Qt5Gui Qt5Widgets Qt5PrintSupport icuin51 icuuc51 icudt51 ; do
if test -f $QTDIR_SLASH/bin/$qtdll.dll ; then
cp $QTDIR_SLASH/bin/$qtdll.dll $INSTALLDIR/bin
fi
done
if test -f $QTDIR_SLASH/plugins/platforms/qwindows.dll ; then
mkdir -p $INSTALLDIR/bin/platforms
cp $QTDIR_SLASH/plugins/platforms/qwindows.dll $INSTALLDIR/bin/platforms
fi
echo "done"
if test ! -z $ACMLDIR ; then
echo -n "Copying AMD Core Math Lib to $INSTALLDIR ..."
cp $ACMLDIR/libacml.a $INSTALLDIR/lib
echo "done"
fi
if [ $dist = "yes" ] ; then
echo -n "Creating NSIS distribution ..."
rm -f $INSTALLDIR/bin/odintestsuite.exe # Remove obsolete stuff before distributing
VERSION=$(grep PACKAGE_VERSION= configure | awk -F \' '{print $2}')
cat odin.nsi | sed s/VERSION/$VERSION/ | sed s/MINGW32NAME/$MINGW32NAME/ > $INSTALLDIR/odin.nsi
OLDPWD=$PWD
pushd $INSTALLDIR
if ! /c/Programme/NSIS/makensis.exe odin.nsi
then
echo "ERROR: NSIS failed"
fi
mv odin-${VERSION}.exe $OLDPWD
pushd $OLDPWD
fi
|