Skip to content
Snippets Groups Projects
Commit df8296d8 authored by Rashad Kanavath's avatar Rashad Kanavath
Browse files

Revert "PKG: fixes from shellcheck"

This reverts commit f50a7c63.

Conflicts:
	SuperBuild/Packaging/Files/macx_pkgsetup.in
parent b1d3fd5a
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env bash
DIRNAME_0=$(dirname "$0")
cd "$DIRNAME_0"
cd `dirname $0`
# NOTE: $OUT_DIR is also used in make_sylinks script (see below)
# Avoid any pre-mature optimization on variable names here.
OUT_DIR=$(pwd)
OUT_DIR=`pwd`
CAT=`which cat`
RM=`which rm`
CHMOD=`which chmod`
SED=`which sed`
CP=`which cp`
MKDIR=`which mkdir`
# find install_name_tool
INSTALL_NAME_TOOL=$(which install_name_tool)
INSTALL_NAME_TOOL=`which install_name_tool`
if [ -z "$INSTALL_NAME_TOOL" ]; then
echo "install_name_tool does not exists.."
echo "please install install_name_tool and make sure it can be found from PATH"
......@@ -25,8 +30,8 @@ BINARY_FILES="@VAR_IN_PKGSETUP_CONFIGURE@"
# #add rpath to LC_RPATH using install_name_tool
for bin_file in $BINARY_FILES; do
#echo "adding rpath to $OUT_DIR/$bin_file"
if [ -f "$OUT_DIR/$bin_file" ]; then
"$INSTALL_NAME_TOOL" -add_rpath "$OUT_DIR/lib" "$OUT_DIR/$bin_file"
if [ -f $OUT_DIR/$bin_file ]; then
$INSTALL_NAME_TOOL -add_rpath "$OUT_DIR/lib" "$OUT_DIR/$bin_file"
fi
done
......@@ -36,18 +41,19 @@ SHORT_VERSION_STRING=@Monteverdi_VERSION_MAJOR@.@Monteverdi_VERSION_MINOR@
I_AM_XDK=@IS_XDK@
if [ "$I_AM_XDK" = true ] ; then
sed -i "" "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@PKG_ITK_SB_VERSION@/Modules/ITKZLIB.cmake
sed -i "" "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@PKG_ITK_SB_VERSION@/ITKConfig.cmake
sed -i "" "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@PKG_ITK_SB_VERSION@/ITKTargets-release.cmake
$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
rm -fr Mapla.app
rm -fr Monteveridi.app
$RM -fr Mapla.app
$RM -fr Monteveridi.app
mkdir -p Mapla.app/Contents/{MacOS,Resources}
mkdir -p Monteverdi.app/Contents/{MacOS,Resources}
$MKDIR -p Mapla.app/Contents/{MacOS,Resources}
$MKDIR -p Monteverdi.app/Contents/{MacOS,Resources}
cat > "Mapla.app/Contents/Info.plist" << EOF
$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">
......@@ -68,7 +74,7 @@ else
</plist>
EOF
cat > "$OUT_DIR/Mapla.app/Contents/MacOS/Mapla" << EOF
$CAT > $OUT_DIR/Mapla.app/Contents/MacOS/Mapla << EOF
#!/bin/sh
export LC_NUMERIC=C
export OTB_APPLICATION_PATH=$OUT_DIR/lib/otb/applications
......@@ -77,9 +83,9 @@ 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
$CAT > $OUT_DIR/Monteverdi.app/Contents/MacOS/Monteverdi << EOF
#!/bin/sh
export LC_NUMERIC=C
export OTB_APPLICATION_PATH=$OUT_DIR/lib/otb/applications
......@@ -88,21 +94,21 @@ export GEOTIFF_CSV=$OUT_DIR/share/epsg_csv
$OUT_DIR/bin/monteverdi "\$@"
EOF
chmod +x "$OUT_DIR/Monteverdi.app/Contents/MacOS/Monteverdi"
$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/"
$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,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
$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
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,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
cat > "$OUT_DIR/otbenv.profile" << EOF
$CAT > $OUT_DIR/otbenv.profile << EOF
#!/bin/sh
PATH=\$PATH:$OUT_DIR/bin
PYTHONPATH=$OUT_DIR/lib/python:\$PYTHONPATH
......@@ -116,7 +122,7 @@ export GEOTIFF_CSV
export PYTHONPATH
EOF
chmod +x "$OUT_DIR/otbenv.profile"
$CHMOD +x $OUT_DIR/otbenv.profile
fi
......@@ -124,13 +130,13 @@ fi
# echo "Creating symbolic links..."
. ./make_symlinks
rm -f "$OUT_DIR/Monteverdi.icns"
$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
open "$OUT_DIR"
open $OUT_DIR
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