Bläddra i källkod

winGRASS: scripts for packaging simplified

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@49286 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 13 år sedan
förälder
incheckning
e10d1f9941

+ 20 - 31
mswindows/GRASS-Installer.nsi

@@ -30,17 +30,17 @@ SetCompressorDictSize 64
 
 ;Version variables
 
-!define RELEASE_VERSION_NUMBER "7.0.0"
-!define RELEASE_SVN_REVISION "36599"
-!define RELEASE_BINARY_REVISION "1"
-!define RELEASE_GRASS_COMMAND "grass70"
-!define RELEASE_GRASS_BASE "GRASS 7.0"
-
-!define DEVEL_VERSION_NUMBER "7.0.SVN"
-!define DEVEL_SVN_REVISION "36599"
-!define DEVEL_BINARY_REVISION "1"
-!define DEVEL_GRASS_COMMAND "grass70svn"
-!define DEVEL_GRASS_BASE "GRASS 7.0.SVN"
+!define SVN_REVISION "36599"
+!define BINARY_REVISION "1"
+!if ${INSTALLER_TYPE} == "Release"
+	!define VERSION_NUMBER "7.0.0"
+	!define GRASS_COMMAND "grass70"
+	!define GRASS_BASE "GRASS 7.0"
+!else
+	!define VERSION_NUMBER "7.0.SVN"
+	!define GRASS_COMMAND "grass70svn"
+	!define GRASS_BASE "GRASS 7.0.SVN"
+!endif
 
 ;----------------------------------------------------------------------------------------------------------------------------
 
@@ -57,26 +57,15 @@ SetCompressorDictSize 64
 
 ;Set the installer variables, depending on the selected version to build
 
+!define PACKAGE_FOLDER ".\GRASS-70-Package"
 !if ${INSTALLER_TYPE} == "Release"
-	!define VERSION_NUMBER "${RELEASE_VERSION_NUMBER}"
-	!define SVN_REVISION "${RELEASE_SVN_REVISION}"
-	!define BINARY_REVISION "${RELEASE_BINARY_REVISION}"
-	!define GRASS_COMMAND "${RELEASE_GRASS_COMMAND}"
-	!define GRASS_BASE "${RELEASE_GRASS_BASE}"
 	!define INSTALLER_NAME "WinGRASS-${VERSION_NUMBER}-${BINARY_REVISION}-Setup.exe"
 	!define DISPLAYED_NAME "GRASS ${VERSION_NUMBER}-${BINARY_REVISION}"
-	!define CHECK_INSTALL_NAME "GRASS"
-	!define PACKAGE_FOLDER ".\GRASS-70-Release-Package"
-!else if ${INSTALLER_TYPE} == "Devel"
-	!define VERSION_NUMBER "${DEVEL_VERSION_NUMBER}"
-	!define SVN_REVISION "${DEVEL_SVN_REVISION}"
-	!define BINARY_REVISION "${DEVEL_BINARY_REVISION}"
-	!define GRASS_COMMAND "${DEVEL_GRASS_COMMAND}"
-	!define GRASS_BASE "${DEVEL_GRASS_BASE}"
+	!define CHECK_INSTALL_NAME "GRASS 70"
+!else
 	!define INSTALLER_NAME "WinGRASS-${VERSION_NUMBER}-r${SVN_REVISION}-${BINARY_REVISION}-Setup.exe"
 	!define DISPLAYED_NAME "GRASS ${VERSION_NUMBER}-r${SVN_REVISION}-${BINARY_REVISION}"
 	!define CHECK_INSTALL_NAME "GRASS 70 SVN"
-	!define PACKAGE_FOLDER ".\GRASS-70-Devel-Package"
 !endif
 
 ;----------------------------------------------------------------------------------------------------------------------------
@@ -617,7 +606,7 @@ Section "GRASS" SecGRASS
 	
 	;HKEY_LOCAL_MACHINE Install entries
 	;Set the Name, Version and Revision of GRASS + PublisherInfo + InstallPath	
-	WriteRegStr HKLM "Software\${GRASS_BASE}" "Name" "GRASS"
+	WriteRegStr HKLM "Software\${GRASS_BASE}" "Name" "GRASS 7.0"
 	WriteRegStr HKLM "Software\${GRASS_BASE}" "VersionNumber" "${VERSION_NUMBER}"
 	WriteRegStr HKLM "Software\${GRASS_BASE}" "SvnRevision" "${SVN_REVISION}"
 	WriteRegStr HKLM "Software\${GRASS_BASE}" "BinaryRevision" "${BINARY_REVISION}"
@@ -626,7 +615,7 @@ Section "GRASS" SecGRASS
 	WriteRegStr HKLM "Software\${GRASS_BASE}" "InstallPath" "$INSTALL_DIR"
 	
 	;HKEY_LOCAL_MACHINE Uninstall entries
-	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}" "DisplayName" "GRASS"
+	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}" "DisplayName" "GRASS 7.0"
 	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}" "UninstallString" "$INSTALL_DIR\Uninstall-GRASS.exe"
 	
 	!if ${INSTALLER_TYPE} == "Release"
@@ -721,7 +710,7 @@ Section "GRASS" SecGRASS
 	FileWrite $0 '$\r$\n'
 	FileWrite $0 'cd "%USERPROFILE%"'
 	FileWrite $0 '$\r$\n'
-	FileWrite $0 '%GRASS_PYTHON% "%WINGISBASE%\grass70.py" %*'
+	FileWrite $0 '%GRASS_PYTHON% "%GISBASE%\etc\grass70.py" %*'
 	FileClose $0
 	done_create_grass_command.bat:
 	
@@ -858,7 +847,7 @@ Section "GRASS" SecGRASS
 	FileWrite $0 'GEOTIFF_CSV="$INSTALL_DIR\share\epsg_csv"$\r$\n'
 	FileWrite $0 'export GEOTIFF_CSV$\r$\n'
 	FileWrite $0 '$\r$\n'
-	FileWrite $0 '"$$GRASS_PYTHON $$GISBASE/grass70.py" "$$@"'
+	FileWrite $0 '"$$GRASS_PYTHON $$GISBASE/etc/grass70.py" "$$@"'
 	FileClose $0
 	done_create_grass_command:
 		
@@ -893,13 +882,13 @@ Section "GRASS" SecGRASS
 	done_create_grass7\rc:
 	
 	;replace gisbase = "/c/OSGeo4W/apps/grass/grass-7.0.svn" in grass70.py with $INSTDIR
-	Push "$INSTDIR\grass70.py" ; file to modify
+	Push "$INSTDIR\etc\grass70.py" ; file to modify
 	Push 'gisbase = "/c/OSGeo4W/apps/grass/grass-7.0.svn"' ; string that a line must begin with *WS Sensitive*
 	Push 'gisbase = "$INSTDIR"' ; string to replace whole line with
 	Call ReplaceLineStr
 	
 	;replace config_projshare = "/c/OSGeo4W/share/proj" i n grass70.py with $INSTDIR\proj
-	Push "$INSTDIR\grass70.py" ; file to modify
+	Push "$INSTDIR\etc\grass70.py" ; file to modify
 	Push 'config_projshare = "/c/OSGeo4W/share/proj"' ; string that a line must begin with *WS Sensitive*
 	Push 'config_projshare = "$INSTDIR\proj"' ; string to replace whole line with
 	Call ReplaceLineStr

+ 2 - 2
mswindows/GRASS-Packager.bat

@@ -12,7 +12,7 @@ rem ----------------------------------------------------------------------------
 rem Set the script variables
 rem --------------------------------------------------------------------------------------------------------------------------
 
-set PACKAGE_DIR=.\GRASS-70-Devel-Package
+set PACKAGE_DIR=.\GRASS-70-Package
 
 set OSGEO4W_DIR=c:\osgeo4w
 
@@ -36,7 +36,7 @@ mkdir %PACKAGE_DIR%
 @echo -----------------------------------------------------------------------------------------------------------------------
 @echo.
 
-xcopy %GRASS_BIN_PREFIX%\grass70* %PACKAGE_DIR% /S/V/F
+rem xcopy %GRASS_BIN_PREFIX%\grass70.py %PACKAGE_DIR% /S/V/F
 xcopy %GRASS_PREFIX% %PACKAGE_DIR% /S/V/F
 
 @echo.

+ 0 - 1
mswindows/osgeo4w/env.bat.tmpl

@@ -1,5 +1,4 @@
 set GISBASE=%OSGEO4W_ROOT%\apps\grass\grass-@VERSION@
-set WINGISBASE=%OSGEO4W_ROOT%\apps\grass\grass-@VERSION@
 set GRASS_SH=%OSGEO4W_ROOT%\apps\msys\bin\sh.exe
 set GRASS_WISH=%OSGEO4W_ROOT%\bin\wish.exe
 set GRASS_PYTHON=%OSGEO4W_ROOT%\bin\python.exe

+ 1 - 1
mswindows/osgeo4w/grass.bat.tmpl

@@ -2,4 +2,4 @@
 SET OSGEO4W_ROOT=@osgeo4w@
 call %OSGEO4W_ROOT%\bin\o4w_env.bat
 call %OSGEO4W_ROOT%\apps\grass\grass-@VERSION@\etc\env.bat
-%GRASS_PYTHON% %OSGEO4W_ROOT%\bin\grass@POSTFIX@.py %*
+%GRASS_PYTHON% %GISBASE%\etc\grass@POSTFIX@.py %*

+ 2 - 3
mswindows/osgeo4w/grass.tmpl

@@ -2,7 +2,6 @@
 
 OSGEO4W_ROOT_MSYS=@OSGEO4W_ROOT_MSYS@
 GISBASE=$OSGEO4W_ROOT_MSYS/apps/grass/grass-@VERSION@
-WINGISBASE=$OSGEO4W_ROOT_MSYS/apps/grass/grass-@VERSION@
 GRASS_SH=$OSGEO4W_ROOT_MSYS/apps/msys/bin/sh.exe
 GRASS_WISH=$OSGEO4W_ROOT_MSYS/bin/wish.exe
 GRASS_PYTHON=$OSGEO4W_ROOT_MSYS/bin/python.exe
@@ -10,9 +9,9 @@ PYTHONHOME=$OSGEO4W_ROOT_MSYS/apps/Python25
 GRASS_PROJSHARE=$OSGEO4W_ROOT_MSYS/share/proj
 PATH=$OSGEO4W_ROOT_MSYS/apps/grass/grass-@VERSION@/bin:$PATH
 
-export $OSGEO4W_ROOT_MSYS $GISBASE $WINGISBASE $GRASS_SH $GRASS_WISH $GRASS_PYTHON $PYTHONHOME $GRASS_PROJSHARE
+export $OSGEO4W_ROOT_MSYS $GISBASE $GRASS_SH $GRASS_WISH $GRASS_PYTHON $PYTHONHOME $GRASS_PROJSHARE
 export $PATH
 
-$GRASS_PYTHON "$OSGEO4W_ROOT_MSYS/bin/grass@POSTFIX@.py" "$@"
+$GRASS_PYTHON "$GISBASE/etc/grass@POSTFIX@.py" "$@"
 
 exit 0

+ 21 - 16
mswindows/osgeo4w/package.sh

@@ -67,6 +67,12 @@ read PATCH <&3
 
 export VERSION=$MAJOR.$MINOR.$PATCH
 
+if [ "$PATCH" == "svn" ]; then
+    GRASS_EXECUTABLE=grass${MAJOR}${MINOR}svn
+else
+    GRASS_EXECUTABLE=grass${MAJOR}${MINOR}
+fi
+
 export GRASS_PYTHON="/c/OSGeo4W/bin/python.exe"
 export PYTHONHOME="/c/OSGeo4W/apps/Python25"
 
@@ -130,7 +136,7 @@ if ! [ -f mswindows/osgeo4w/configure-stamp ]; then
 fi
 
 log make 
-make -k || ( cat error.log >&3 && false ) 
+# make -k || ( cat error.log >&3 && false ) 
 
 log make install
 make install
@@ -141,15 +147,15 @@ mv $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/include/grass/config.h \
 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
 sed -e "s#@VERSION@#$VERSION#g" -e "s#@OSGEO4W_ROOT@#$OSGEO4W_ROOT#g" -e "s#@POSTFIX@#$MAJOR$MINOR#g" \
-    mswindows/osgeo4w/grass.bat.tmpl >$OSGEO4W_ROOT_MSYS/bin/grass$MAJOR$MINOR.bat
+    mswindows/osgeo4w/grass.bat.tmpl >$OSGEO4W_ROOT_MSYS/bin/${GRASS_EXECUTABLE}.bat
 sed -e "s#@VERSION@#$VERSION#g" -e "s#@OSGEO4W_ROOT_MSYS@#$OSGEO4W_ROOT_MSYS#g" -e "s#@POSTFIX@#$MAJOR$MINOR#g" \
-    mswindows/osgeo4w/grass.tmpl >$OSGEO4W_ROOT_MSYS/bin/grass$MAJOR$MINOR
+    mswindows/osgeo4w/grass.tmpl >$OSGEO4W_ROOT_MSYS/bin/${GRASS_EXECUTABLE}
 sed -e "s#@VERSION@#$VERSION#g" -e "s#@OSGEO4W_ROOT_MSYS@#$OSGEO4W_ROOT#g" \
     mswindows/osgeo4w/env.bat.tmpl >$OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/etc/env.bat
-sed -e "s#@VERSION@#$VERSION#g" -e "s#@POSTFIX@#$MAJOR$MINOR#g" \
-    mswindows/osgeo4w/postinstall.bat >$OSGEO4W_ROOT_MSYS/etc/postinstall/grass$MAJOR$MINOR.bat 
-sed -e "s#@VERSION@#$VERSION#g" -e "s#@POSTFIX@#$MAJOR$MINOR#g" \
-    mswindows/osgeo4w/preremove.bat >$OSGEO4W_ROOT_MSYS/etc/preremove/grass$MAJOR$MINOR.bat 
+sed -e "s#@VERSION@#$VERSION#g" -e "s#@GRASS_EXECUTABLE@#$GRASS_EXECUTABLE#g" \
+    mswindows/osgeo4w/postinstall.bat >$OSGEO4W_ROOT_MSYS/etc/postinstall/${GRASS_EXECUTABLE}.bat 
+sed -e "s#@VERSION@#$VERSION#g" -e "s#@GRASS_EXECUTABLE@#$GRASS_EXECUTABLE#g" \
+    mswindows/osgeo4w/preremove.bat >$OSGEO4W_ROOT_MSYS/etc/preremove/${GRASS_EXECUTABLE}.bat 
 
 if [ -f /c/mingw/bin/libgnurx-0.dll ]; then
     cp /c/mingw/bin/libgnurx-0.dll $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/bin 
@@ -174,24 +180,23 @@ if [ -n "$PACKAGE" ]; then
     cd $OSGEO4W_ROOT_MSYS 
 
     sed -e "s#@VERSION@#$VERSION#g" -e "s#@POSTFIX@#$MAJOR$MINOR#g" \
-	$SRC/mswindows/osgeo4w/grass.bat.tmpl >$OSGEO4W_ROOT_MSYS/bin/grass$MAJOR$MINOR.bat.tmpl
+	$SRC/mswindows/osgeo4w/grass.bat.tmpl >$OSGEO4W_ROOT_MSYS/bin/${GRASS_EXECUTABLE}.bat.tmpl
     sed -e "s#@VERSION@#$VERSION#g" -e "s#@OSGEO4W_ROOT_MSYS@#@OSGEO4W_ROOT@#g" -e "s#@POSTFIX@#$MAJOR$MINOR#g" \
-	$SRC/mswindows/osgeo4w/grass.tmpl >$OSGEO4W_ROOT_MSYS/bin/grass$MAJOR$MINOR.tmpl
+	$SRC/mswindows/osgeo4w/grass.tmpl >$OSGEO4W_ROOT_MSYS/bin/${GRASS_EXECUTABLE}.tmpl
 
     # grass package
     tar -cjf $PDIR/grass$PACKAGE_NAME-$VERSION-$PACKAGE.tar.bz2 \
 	apps/grass/grass-$VERSION \
-	bin/grass$MAJOR$MINOR.py \
-	bin/grass$MAJOR$MINOR.bat.tmpl \
-	bin/grass$MAJOR$MINOR.tmpl \
+	bin/${GRASS_EXECUTABLE}.bat.tmpl \
+	bin/${GRASS_EXECUTABLE}.tmpl \
 	bin/libintl3.dll \
 	bin/libiconv2.dll \
 	bin/regex2.dll \
-	etc/postinstall/grass$MAJOR$MINOR.bat \
-	etc/preremove/grass$MAJOR$MINOR.bat
+	etc/postinstall/${GRASS_EXECUTABLE}.bat \
+	etc/preremove/${GRASS_EXECUTABLE}.bat
     
-    rm bin/grass$MAJOR$MINOR.tmpl
-    rm bin/grass$MAJOR$MINOR.bat.tmpl
+    rm bin/${GRASS_EXECUTABLE}.tmpl
+    rm bin/${GRASS_EXECUTABLE}.bat.tmpl
     
     # grass-devel package (obsolete)
     ###tar -cjf $PDIR/grass-devel-$VERSION-$PACKAGE.tar.bz2 \

+ 5 - 5
mswindows/osgeo4w/postinstall.bat

@@ -1,7 +1,7 @@
 set ICON=%OSGEO4W_ROOT%\apps\grass\grass-@VERSION@\etc\gui\icons\grass.ico
-set BATCH=%OSGEO4W_ROOT%\bin\grass@POSTFIX@.bat
-textreplace -std -t "%OSGEO4W_ROOT%"\bin\grass@POSTFIX@.bat
-textreplace -std -t "%OSGEO4W_ROOT%"\bin\grass@POSTFIX@ 
+set BATCH=%OSGEO4W_ROOT%\bin\@GRASS_EXECUTABLE@.bat
+textreplace -std -t "%OSGEO4W_ROOT%"\bin\@GRASS_EXECUTABLE@.bat
+textreplace -std -t "%OSGEO4W_ROOT%"\bin\@GRASS_EXECUTABLE@
 textreplace -std -t "%OSGEO4W_ROOT%"\apps\grass\grass-@VERSION@\etc\fontcap
 
 mkdir "%OSGEO4W_STARTMENU%\GRASS GIS @VERSION@" 
@@ -10,5 +10,5 @@ xxmklink "%OSGEO4W_STARTMENU%\GRASS GIS @VERSION@\GRASS Command Line.lnk"  "%BAT
 
 xxmklink "%ALLUSERSPROFILE%\Desktop\GRASS GIS @VERSION@.lnk" "%BATCH%"  "-gui" \ "Launch GRASS GIS @VERSION@ with wxGUI" 1 "%ICON%" 
 
-del "%OSGEO4W_ROOT%"\bin\grass@POSTFIX@.bat.tmpl
-del "%OSGEO4W_ROOT%"\bin\grass@POSTFIX@.tmpl
+del "%OSGEO4W_ROOT%"\bin\@GRASS_EXECUTABLE@.bat.tmpl
+del "%OSGEO4W_ROOT%"\bin\@GRASS_EXECUTABLE@.tmpl

+ 2 - 3
mswindows/osgeo4w/preremove.bat

@@ -4,7 +4,6 @@ rmdir "%OSGEO4W_STARTMENU%\GRASS GIS @VERSION@"
 
 del "%ALLUSERSPROFILE%\Desktop\GRASS GIS @VERSION@.lnk"
 
-del "%OSGEO4W_ROOT%"\bin\grass@POSTFIX@.py
-del "%OSGEO4W_ROOT%"\bin\grass@POSTFIX@.bat
-del "%OSGEO4W_ROOT%"\bin\grass@POSTFIX@
+del "%OSGEO4W_ROOT%"\bin\@GRASS_EXECUTABLE@.bat
+del "%OSGEO4W_ROOT%"\bin\@GRASS_EXECUTABLE@
 del "%OSGEO4W_ROOT%"\apps\grass\grass-@VERSION@\etc\fontcap