Commit 8babc42d authored by Rashad Kanavath's avatar Rashad Kanavath

PKG: bash shell and use which to find path

parent 1c624c2d
......@@ -8,7 +8,8 @@ cd `dirname $0`
OUT_DIR=`pwd`
CAT=`which cat`
RM=`which rm`
chmod=`which chmod`
CHMOD=`which chmod`
SED=`which sed`
WHICH_ENV=`which env`
PATCH_ELF_EXE=$OUT_DIR/tools/patchelf
......@@ -26,12 +27,12 @@ for bin_file in $BINARY_FILES; do
fi
done
i_am_xdk=@IS_XDK@
I_AM_XDK=@IS_XDK@
if [ "$i_am_xdk" = true ] ; then
sed -i "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@ITK_VERSION_STRING@/Modules/ITKZLIB.cmake
sed -i "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@ITK_VERSION_STRING@/ITKConfig.cmake
sed -i "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@ITK_VERSION_STRING@/ITKTargets-release.cmake
if [ "$I_AM_XDK" = true ] ; then
$SED -i "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@ITK_VERSION_STRING@/Modules/ITKZLIB.cmake
$SED -i "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@ITK_VERSION_STRING@/ITKConfig.cmake
$SED -i "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@ITK_VERSION_STRING@/ITKTargets-release.cmake
else
$CAT > $OUT_DIR/monteverdi.sh << EOF
#!$WHICH_ENV bash
......@@ -67,11 +68,11 @@ export GDAL_DATA
export GEOTIFF_CSV
EOF
fi
echo "Creating symbolic links..."
. ./make_symlinks
fi
$RM -fr $OUT_DIR/tools
$RM -f $OUT_DIR/pkgsetup
......
#!/bin/sh
#!/usr/bin/env bash
cd `dirname $0`
......@@ -6,6 +6,14 @@ cd `dirname $0`
# Avoid any pre-mature optimization on variable names here.
OUT_DIR=`pwd`
CAT=`which cat`
RM=`which rm`
CHMOD=`which chmod`
SED=`which sed`
CP=`which cp`
MKDIR=`which mkdir`
WHICH_ENV=`which env`
# find install_name_tool
INSTALL_NAME_TOOL=`which install_name_tool`
if [ -z "$INSTALL_NAME_TOOL" ]; then
......@@ -31,13 +39,22 @@ done
LONG_VERSION_STRING=@Monteverdi_VERSION_MAJOR@.@Monteverdi_VERSION_MINOR@.@Monteverdi_VERSION_PATCH@
SHORT_VERSION_STRING=@Monteverdi_VERSION_MAJOR@.@Monteverdi_VERSION_MINOR@
rm -fr Mapla.app
rm -fr Monteveridi.app
I_AM_XDK=@IS_XDK@
if [ "$I_AM_XDK" = true ] ; then
$SED -i "" "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@ITK_VERSION_STRING@/Modules/ITKZLIB.cmake
$SED -i "" "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@ITK_VERSION_STRING@/ITKConfig.cmake
$SED -i "" "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@ITK_VERSION_STRING@/ITKTargets-release.cmake
else
mkdir -p Mapla.app/Contents/{MacOS,Resources}
mkdir -p Monteverdi.app/Contents/{MacOS,Resources}
$RM -fr Mapla.app
$RM -fr Monteveridi.app
cat > Mapla.app/Contents/Info.plist << EOF
$MKDIR -p Mapla.app/Contents/{MacOS,Resources}
$MKDIR -p Monteverdi.app/Contents/{MacOS,Resources}
$CAT > Mapla.app/Contents/Info.plist << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
......@@ -58,8 +75,8 @@ cat > Mapla.app/Contents/Info.plist << EOF
</plist>
EOF
cat > $OUT_DIR/Mapla.app/Contents/MacOS/Mapla << EOF
#!/bin/sh
$CAT > $OUT_DIR/Mapla.app/Contents/MacOS/Mapla << EOF
#!$WHICH_ENV bash
export LC_NUMERIC=C
export OTB_APPLICATION_PATH=$OUT_DIR/lib/otb/applications
export GDAL_DATA=$OUT_DIR/share/gdal
......@@ -67,10 +84,10 @@ export GEOTIFF_CSV=$OUT_DIR/share/epsg_csv
$OUT_DIR/bin/mapla "\$@"
EOF
chmod +x $OUT_DIR/Mapla.app/Contents/MacOS/Mapla
$CHMOD +x $OUT_DIR/Mapla.app/Contents/MacOS/Mapla
cat > $OUT_DIR/Monteverdi.app/Contents/MacOS/Monteverdi << EOF
#!/bin/sh
$CAT > $OUT_DIR/Monteverdi.app/Contents/MacOS/Monteverdi << EOF
#!$WHICH_ENV bash
export LC_NUMERIC=C
export OTB_APPLICATION_PATH=$OUT_DIR/lib/otb/applications
export GDAL_DATA=$OUT_DIR/share/gdal
......@@ -78,37 +95,30 @@ export GEOTIFF_CSV=$OUT_DIR/share/epsg_csv
$OUT_DIR/bin/monteverdi "\$@"
EOF
chmod +x $OUT_DIR/Monteverdi.app/Contents/MacOS/Monteverdi
cp Mapla.app/Contents/Info.plist Monteverdi.app/Contents/Info.plist
cp $OUT_DIR/Monteverdi.icns Monteverdi.app/Contents/Resources/
cp $OUT_DIR/Monteverdi.icns Mapla.app/Contents/Resources/
$CHMOD +x $OUT_DIR/Monteverdi.app/Contents/MacOS/Monteverdi
sed -i "" "s,STARTUP_FILE,Mapla,g" Mapla.app/Contents/Info.plist
sed -i "" "s,LONG_VERSION,$LONG_VERSION_STRING,g" Mapla.app/Contents/Info.plist
sed -i "" "s,SHORT_VERSION,$SHORT_VERSION_STRING,g" Mapla.app/Contents/Info.plist
$CP Mapla.app/Contents/Info.plist Monteverdi.app/Contents/Info.plist
$CP $OUT_DIR/Monteverdi.icns Monteverdi.app/Contents/Resources/
$CP $OUT_DIR/Monteverdi.icns Mapla.app/Contents/Resources/
sed -i "" "s,STARTUP_FILE,Monteverdi,g" Monteverdi.app/Contents/Info.plist
sed -i "" "s,LONG_VERSION,$LONG_VERSION_STRING,g" Monteverdi.app/Contents/Info.plist
sed -i "" "s,SHORT_VERSION,$SHORT_VERSION_STRING,g" Monteverdi.app/Contents/Info.plist
$SED -i "" "s,STARTUP_FILE,Mapla,g" Mapla.app/Contents/Info.plist
$SED -i "" "s,LONG_VERSION,$LONG_VERSION_STRING,g" Mapla.app/Contents/Info.plist
$SED -i "" "s,SHORT_VERSION,$SHORT_VERSION_STRING,g" Mapla.app/Contents/Info.plist
# echo "Creating symbolic links..."
. ./make_symlinks
$SED -i "" "s,STARTUP_FILE,Monteverdi,g" Monteverdi.app/Contents/Info.plist
$SED -i "" "s,LONG_VERSION,$LONG_VERSION_STRING,g" Monteverdi.app/Contents/Info.plist
$SED -i "" "s,SHORT_VERSION,$SHORT_VERSION_STRING,g" Monteverdi.app/Contents/Info.plist
if [ -f lib/cmake/ITK-@ITK_VERSION_STRING@/ITKConfig.cmake ]; then
rm -fr $OUT_DIR/bin/*
sed -i "" "s,@CMAKE_INSTALL_PREFIX@,$OUT_DIR,g" lib/cmake/ITK-@ITK_VERSION_STRING@/Modules/ITKZLIB.cmake
sed -i "" "s,@CMAKE_INSTALL_PREFIX@,$OUT_DIR,g" lib/cmake/ITK-@ITK_VERSION_STRING@/ITKConfig.cmake
sed -i "" "s,@CMAKE_INSTALL_PREFIX@,$OUT_DIR,g" lib/cmake/ITK-@ITK_VERSION_STRING@/ITKTargets-release.cmake
fi
rm -f $OUT_DIR/mapla.sh
rm -f $OUT_DIR/monteverdi.sh
rm -f $OUT_DIR/Monteverdi.icns
# echo "Creating symbolic links..."
. ./make_symlinks
$RM -f $OUT_DIR/Monteverdi.icns
rm -fr $OUT_DIR/tools
$RM -fr $OUT_DIR/tools
rm -f $OUT_DIR/pkgsetup
$RM -f $OUT_DIR/pkgsetup
rm -f $OUT_DIR/make_symlinks
$RM -f $OUT_DIR/make_symlinks
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment