Browse Source

quote path names (may contain spaces);
remove bashisms when using /bin/sh;
remove PWD from PATH(ok?).
(merge from devbr6 https://trac.osgeo.org/grass/changeset/39046)


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@39049 15284696-431f-4ddb-bdfa-cd5b030d7da7

Hamish Bowman 15 years ago
parent
commit
c9ca43c39f
1 changed files with 55 additions and 38 deletions
  1. 55 38
      mswindows/osgeo4w/package.sh

+ 55 - 38
mswindows/osgeo4w/package.sh

@@ -7,8 +7,10 @@ if ! [ -d mswindows ]; then
 	exit 1
 fi
 
-export OSGEO4W_ROOT_MSYS=/c/Programme/OSGeo4W
-export PATH=.:/c/mingw/bin:/usr/local/bin:/bin:$OSGEO4W_ROOT_MSYS/bin:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem
+#portable? can we use %PROGRAMFILES% -> $PROGRAMFILES here?
+OSGEO4W_ROOT_MSYS="/c/Programme/OSGeo4W"
+PATH="/c/mingw/bin:/usr/local/bin:/bin:$OSGEO4W_ROOT_MSYS/bin:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem"
+export OSGEO4W_ROOT_MSYS PATH
 
 version() {
 	(
@@ -16,12 +18,12 @@ version() {
 		read MINOR
 		read PATCH
 		echo $MAJOR.$MINOR.$PATCH
-	) <include/VERSION
+	) < include/VERSION
 }
 
-export VERSION=$(version)
-export PACKAGE=3
-
+VERSION=$(version)
+PACKAGE=3
+export VERSION PACKAGE
 
 (
 echo
@@ -70,50 +72,65 @@ echo $(date): STARTING make install
 make install
 
 echo $(date): STARTING cleanup
-mv $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/lib/*.$VERSION.dll $OSGEO4W_ROOT_MSYS/bin
-rm $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/lib/*.dll
-
-mv $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/include/grass/config.h $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/include/grass/config.h.mingw
-cp mswindows/osgeo4w/config.h.switch $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/include/grass/config.h
-cp mswindows/osgeo4w/config.h.vc $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/include/grass
-cp mswindows/osgeo4w/grass70.bat.tmpl $OSGEO4W_ROOT_MSYS/bin/grass70.bat.tmpl
-cp mswindows/osgeo4w/ini.bat.tmpl $OSGEO4W_ROOT_MSYS/etc/ini/grass.bat.tmpl
-cp mswindows/osgeo4w/postinstall.bat $OSGEO4W_ROOT_MSYS/etc/postinstall/grass.bat
-cp mswindows/osgeo4w/preremove.bat $OSGEO4W_ROOT_MSYS/etc/preremove/grass.bat
-cp /c/mingw/bin/libgnurx-0.dll $OSGEO_ROOT_MSYS/bin
-cp /c/mingw/bin/libiconv-2.dll $OSGEO_ROOT_MSYS/bin
-cp /c/mingw/bin/libintl-8.dll $OSGEO_ROOT_MSYS/bin
-
-P=$(pwd -W)
-P=${P//\//\\\\}\\\\dist.i686-pc-mingw32
-
-sed -e "s#$P#@osgeo4w@#" $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/etc/fontcap >$OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/etc/fontcap.tmpl
-sed -e "s#$P#@osgeo4w_msys@#" $OSGEO4W_ROOT_MSYS/apps/grass/bin/grass70 >$OSGEO4W_ROOT_MSYS/apps/grass/bin/grass70.tmpl
-rm $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/etc/fontcap 
+mv "$OSGEO4W_ROOT_MSYS"/apps/grass/grass-$VERSION/lib/*.$VERSION.dll \
+   "$OSGEO4W_ROOT_MSYS/bin"
+rm "$OSGEO4W_ROOT_MSYS"/apps/grass/grass-$VERSION/lib/*.dll
+
+mv "$OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/include/grass/config.h" \
+   "$OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/include/grass/config.h.mingw"
+cp mswindows/osgeo4w/config.h.switch \
+   "$OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/include/grass/config.h"
+cp mswindows/osgeo4w/config.h.vc \
+   "$OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/include/grass"
+cp mswindows/osgeo4w/grass70.bat.tmpl \
+   "$OSGEO4W_ROOT_MSYS/bin/grass70.bat.tmpl"
+cp mswindows/osgeo4w/ini.bat.tmpl \
+   "$OSGEO4W_ROOT_MSYS/etc/ini/grass.bat.tmpl"
+cp mswindows/osgeo4w/postinstall.bat \
+   "$OSGEO4W_ROOT_MSYS/etc/postinstall/grass.bat"
+cp mswindows/osgeo4w/preremove.bat \
+   "$OSGEO4W_ROOT_MSYS/etc/preremove/grass.bat"
+cp /c/mingw/bin/libgnurx-0.dll "$OSGEO_ROOT_MSYS/bin"
+cp /c/mingw/bin/libiconv-2.dll "$OSGEO_ROOT_MSYS/bin"
+cp /c/mingw/bin/libintl-8.dll "$OSGEO_ROOT_MSYS/bin"
+
+P="$(pwd -W)"
+#portable? how about dist.amd64-pc-mingw32?
+P="${P//\//\\\\}\\\\dist.i686-pc-mingw32"
+
+sed -e "s#$P#@osgeo4w@#" "$OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/etc/fontcap" \
+    > $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/etc/fontcap.tmpl
+sed -e "s#$P#@osgeo4w_msys@#" "$OSGEO4W_ROOT_MSYS/apps/grass/bin/grass70" \
+    > $OSGEO4W_ROOT_MSYS/apps/grass/bin/grass70.tmpl
+rm "$OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/etc/fontcap"
 
 echo $(date): STARTING building vc libraries
-sh mswindows/osgeo4w/mklibs.sh $OSGEO4W_ROOT_MSYS/bin/*.$VERSION.dll
-mv mswindows/osgeo4w/vc/grass*.lib $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/lib
+sh mswindows/osgeo4w/mklibs.sh "$OSGEO4W_ROOT_MSYS"/bin/*.$VERSION.dll
+mv mswindows/osgeo4w/vc/grass*.lib \
+   "$OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/lib"
 
 set -x
 echo $(date): BUILDING GDAL GRASS plugins
 cmd /c 'mswindows\\osgeo4w\\gdalplugins.cmd $VERSION'
 
 echo $(date): CREATING packages
-mkdir -p package/grass-devel package/grass-devel-mingw package/grass-devel-vc package/grass
+mkdir -p package/grass-devel \
+         package/grass-devel-mingw \
+         package/grass-devel-vc \
+         package/grass
 
-PDIR=$PWD/package
-cd $OSGEO4W_ROOT_MSYS
-tar -cjf $PDIR/grass-devel/grass-devel-$VERSION-$PACKAGE.tar.bz2 \
-	apps/grass/grass-$VERSION/include
+PDIR="$PWD/package"
+cd "$OSGEO4W_ROOT_MSYS"
+tar -cjf "$PDIR/grass-devel/grass-devel-$VERSION-$PACKAGE.tar.bz2" \
+	"apps/grass/grass-$VERSION/include"
 
-tar -cjf $PDIR/grass-devel-mingw/grass-devel-mingw-$VERSION-$PACKAGE.tar.bz2 \
-	apps/grass/grass-$VERSION/lib/libgrass*.a
+tar -cjf "$PDIR/grass-devel-mingw/grass-devel-mingw-$VERSION-$PACKAGE.tar.bz2" \
+	"apps/grass/grass-$VERSION/lib/"libgrass*.a
 
-tar -cjf $PDIR/grass-devel-vc/grass-devel-vc-$VERSION-$PACKAGE.tar.bz2 \
-	apps/grass/grass-$VERSION/lib/*.lib
+tar -cjf "$PDIR/grass-devel-vc/grass-devel-vc-$VERSION-$PACKAGE.tar.bz2" \
+	"apps/grass/grass-$VERSION/"lib/*.lib
 
-tar -cjf $PDIR/grass/grass-$VERSION-$PACKAGE.tar.bz2 \
+tar -cjf "$PDIR/grass/grass-$VERSION-$PACKAGE.tar.bz2" \
 	apps/grass/bin/grass70.tmpl \
 	apps/grass/grass-$VERSION/authors \
 	apps/grass/grass-$VERSION/bin/ \