From 8911770ab527cd83be9e0690847e629b8cd7e1aa Mon Sep 17 00:00:00 2001 From: Martin Landa Date: Thu, 30 Sep 2021 21:10:31 +0200 Subject: [PATCH] Apply patches from OSGeo4W upstreams backported to relbr78 (#1893) * backport #1880 to releasebranch_7_8 * GRASS-Packager.bat: only 64bit builds produced * GRASS-Installer: SVN_REVISION -> GIT_REVISION * mswindows: py37 -> py39, remove epsg_csv * GRASS Packager/Installer: only msvcrt2019 required by osgeo4w v2 --- lib/python/ctypes/loader.py | 6 ++ mswindows/GRASS-Installer.nsi.tmpl | 118 ++++++-------------------- mswindows/GRASS-Packager.bat.tmpl | 30 +++---- mswindows/Makefile | 2 +- mswindows/env.bat | 3 +- mswindows/osgeo4w/env.bat.tmpl | 2 - mswindows/osgeo4w/mklibs.sh | 27 ++---- mswindows/osgeo4w/package.sh | 128 +++++++++++------------------ mswindows/osgeo4w/postinstall.bat | 56 +++++++------ 9 files changed, 123 insertions(+), 249 deletions(-) diff --git a/lib/python/ctypes/loader.py b/lib/python/ctypes/loader.py index ab2fd5e4f98..2d05f452292 100644 --- a/lib/python/ctypes/loader.py +++ b/lib/python/ctypes/loader.py @@ -236,6 +236,12 @@ def __getattr__(self, name): class WindowsLibraryLoader(LibraryLoader): name_formats = ["%s.dll", "lib%s.dll"] + def __init__(self): + super().__init__() + for p in os.getenv("PATH").split(";"): + if os.path.exists(p) and hasattr(os, 'add_dll_directory'): + os.add_dll_directory(p) + def load(self, path): return _WindowsLibrary(path) diff --git a/mswindows/GRASS-Installer.nsi.tmpl b/mswindows/GRASS-Installer.nsi.tmpl index b79da7a7577..de0a07bc7e8 100644 --- a/mswindows/GRASS-Installer.nsi.tmpl +++ b/mswindows/GRASS-Installer.nsi.tmpl @@ -22,19 +22,15 @@ SetCompressorDictSize 128 ;Version variables -!if "@GRASS_VERSION_SVN@" == "" - !define SVN_REVISION "0" +!if "@GRASS_VERSION_GIT@" == "" + !define GIT_REVISION "0" !else - !define SVN_REVISION "@GRASS_VERSION_SVN@" + !define GIT_REVISION "@GRASS_VERSION_GIT@" !endif !define BINARY_REVISION "1" !define VERSION_NUMBER "@GRASS_VERSION_MAJOR@.@GRASS_VERSION_MINOR@.@GRASS_VERSION_RELEASE@" !define GRASS_BASE "GRASS GIS @GRASS_VERSION_MAJOR@.@GRASS_VERSION_MINOR@" -!if ${INSTALLER_TYPE} == "Release" - !define GRASS_COMMAND "grass@GRASS_VERSION_MAJOR@@GRASS_VERSION_MINOR@" -!else - !define GRASS_COMMAND "grass@GRASS_VERSION_MAJOR@@GRASS_VERSION_MINOR@svn" -!endif +!define GRASS_COMMAND "grass@GRASS_VERSION_MAJOR@@GRASS_VERSION_MINOR@" ;---------------------------------------------------------------------------------------------------------------------------- @@ -72,9 +68,9 @@ SetCompressorDictSize 128 !define DISPLAYED_NAME "GRASS GIS ${VERSION_NUMBER}-${BINARY_REVISION} (${PLATFORM})" !define CHECK_INSTALL_NAME "GRASS GIS @GRASS_VERSION_MAJOR@@GRASS_VERSION_MINOR@" !else - !define INSTALLER_NAME "WinGRASS-${VERSION_NUMBER}-${SVN_REVISION}-${BINARY_REVISION}-Setup-${PLATFORM}.exe" - !define DISPLAYED_NAME "GRASS GIS ${VERSION_NUMBER}-${SVN_REVISION}-${BINARY_REVISION} (${PLATFORM})" - !define CHECK_INSTALL_NAME "GRASS GIS @GRASS_VERSION_MAJOR@@GRASS_VERSION_MINOR@ SVN" + !define INSTALLER_NAME "WinGRASS-${VERSION_NUMBER}-${GIT_REVISION}-${BINARY_REVISION}-Setup-${PLATFORM}.exe" + !define DISPLAYED_NAME "GRASS GIS ${VERSION_NUMBER}-${GIT_REVISION}-${BINARY_REVISION} (${PLATFORM})" + !define CHECK_INSTALL_NAME "GRASS GIS @GRASS_VERSION_MAJOR@@GRASS_VERSION_MINOR@ GIT" !endif ;Define the source path of the demolocation files @@ -184,7 +180,7 @@ FunctionEnd ;call the uninstaller of the currently installed GRASS release ;if the uninstall procedure succeeded, call the current installer asking for the install PATH -;the currently installed release of GRASS is defined by the variable $INSTALLED_VERSION = $INSTALLED_SVN_REVISION + $INSTALLED_BINARY_REVISION +;the currently installed release of GRASS is defined by the variable $INSTALLED_VERSION = $INSTALLED_GIT_REVISION + $INSTALLED_BINARY_REVISION Function .onInit @@ -195,7 +191,7 @@ Function .onInit Var /GLOBAL INSTALL_PATH Var /GLOBAL INSTALLED_VERSION_NUMBER - Var /GLOBAL INSTALLED_SVN_REVISION + Var /GLOBAL INSTALLED_GIT_REVISION Var /GLOBAL INSTALLED_BINARY_REVISION Var /GLOBAL INSTALLED_VERSION @@ -210,10 +206,10 @@ Function .onInit ReadRegStr $UNINSTALL_STRING HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}" "UninstallString" ReadRegStr $INSTALL_PATH HKLM "Software\${GRASS_BASE}" "InstallPath" ReadRegStr $INSTALLED_VERSION_NUMBER HKLM "Software\${GRASS_BASE}" "VersionNumber" - ReadRegStr $INSTALLED_SVN_REVISION HKLM "Software\${GRASS_BASE}" "SvnRevision" + ReadRegStr $INSTALLED_GIT_REVISION HKLM "Software\${GRASS_BASE}" "GitRevision" - ${If} $INSTALLED_SVN_REVISION == "" - ReadRegStr $INSTALLED_SVN_REVISION HKLM "Software\${GRASS_BASE}" "Revision" + ${If} $INSTALLED_GIT_REVISION == "" + ReadRegStr $INSTALLED_GIT_REVISION HKLM "Software\${GRASS_BASE}" "Revision" ${EndIf} ReadRegStr $INSTALLED_BINARY_REVISION HKLM "Software\${GRASS_BASE}" "BinaryRevision" @@ -228,7 +224,7 @@ Function .onInit StrCpy $DISPLAYED_INSTALLED_VERSION "$INSTALLED_VERSION_NUMBER-$INSTALLED_BINARY_REVISION" ${EndIf} !else - StrCpy $DISPLAYED_INSTALLED_VERSION "$INSTALLED_VERSION_NUMBER-$INSTALLED_SVN_REVISION-$INSTALLED_BINARY_REVISION" + StrCpy $DISPLAYED_INSTALLED_VERSION "$INSTALLED_VERSION_NUMBER-$INSTALLED_GIT_REVISION-$INSTALLED_BINARY_REVISION" !endif StrCpy $MESSAGE_0_ "$MESSAGE_0_The installed release is $DISPLAYED_INSTALLED_VERSION$\r$\n" @@ -250,11 +246,11 @@ Function .onInit StrCpy $MESSAGE_3_ "$MESSAGE_3_$\r$\n" StrCpy $MESSAGE_3_ "$MESSAGE_3_Press OK to reinstall ${DISPLAYED_NAME} or Cancel to quit." - IntOp $INSTALLED_SVN_REVISION $INSTALLED_SVN_REVISION * 1 + IntOp $INSTALLED_GIT_REVISION $INSTALLED_GIT_REVISION * 1 IntOp $INSTALLED_BINARY_REVISION $INSTALLED_BINARY_REVISION * 1 - IntOp $INSTALLED_VERSION $INSTALLED_SVN_REVISION + $INSTALLED_BINARY_REVISION + IntOp $INSTALLED_VERSION $INSTALLED_GIT_REVISION + $INSTALLED_BINARY_REVISION - !define /math VERSION ${SVN_REVISION} + ${BINARY_REVISION} + !define /math VERSION ${GIT_REVISION} + ${BINARY_REVISION} ${If} $INSTALLED_VERSION_NUMBER == "" ${Else} @@ -490,14 +486,6 @@ FunctionEnd ;Declares the variables for optional Sample Data Sections Var /GLOBAL HTTP_PATH Var /GLOBAL ARCHIVE_NAME -;Var /GLOBAL ARCHIVE_NAME2005 -Var /GLOBAL ARCHIVE_NAME2008 -Var /GLOBAL ARCHIVE_NAME2010 -!if ${PLATFORM} == "x86_64" - Var /GLOBAL ARCHIVE_NAME2012 -!endif -Var /GLOBAL ARCHIVE_NAME2013 -Var /GLOBAL ARCHIVE_NAME2015 Var /GLOBAL EXTENDED_ARCHIVE_NAME Var /GLOBAL ORIGINAL_UNTAR_FOLDER Var /GLOBAL CUSTOM_UNTAR_FOLDER @@ -629,7 +617,7 @@ Section "GRASS" SecGRASS ;Set the Name, Version and Revision of GRASS + PublisherInfo + InstallPath WriteRegStr HKLM "Software\${GRASS_BASE}" "Name" "${GRASS_BASE} (${PLATFORM})" WriteRegStr HKLM "Software\${GRASS_BASE}" "VersionNumber" "${VERSION_NUMBER}" - WriteRegStr HKLM "Software\${GRASS_BASE}" "SvnRevision" "${SVN_REVISION}" + WriteRegStr HKLM "Software\${GRASS_BASE}" "GitRevision" "${GIT_REVISION}" WriteRegStr HKLM "Software\${GRASS_BASE}" "BinaryRevision" "${BINARY_REVISION}" WriteRegStr HKLM "Software\${GRASS_BASE}" "Publisher" "${PUBLISHER}" WriteRegStr HKLM "Software\${GRASS_BASE}" "WebSite" "${WEB_SITE}" @@ -644,7 +632,7 @@ Section "GRASS" SecGRASS "DisplayVersion" "${VERSION_NUMBER}-${BINARY_REVISION}" !else WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}"\ - "DisplayVersion" "${VERSION_NUMBER}-${SVN_REVISION}-${BINARY_REVISION}" + "DisplayVersion" "${VERSION_NUMBER}-${GIT_REVISION}-${BINARY_REVISION}" !endif WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}" "DisplayIcon" "$INSTALL_DIR\gui\icons\grass.ico" @@ -810,16 +798,6 @@ Function DownloadInstallMSRuntime SetShellVarContext current InitPluginsDir NSISdl::download "$HTTP_PATH/$ARCHIVE_NAME" "$TEMP\$ARCHIVE_NAME" - ;!if ${PLATFORM} == "x86" - ; NSISdl::download "$HTTP_PATH/msvcrt2005/$ARCHIVE_NAME2005" "$TEMP\$ARCHIVE_NAME2005" - ;!endif - NSISdl::download "$HTTP_PATH/msvcrt2008/$ARCHIVE_NAME2008" "$TEMP\$ARCHIVE_NAME2008" - NSISdl::download "$HTTP_PATH/msvcrt2010/$ARCHIVE_NAME2010" "$TEMP\$ARCHIVE_NAME2010" - !if ${PLATFORM} == "x86_64" - NSISdl::download "$HTTP_PATH/msvcrt2012/$ARCHIVE_NAME2012" "$TEMP\$ARCHIVE_NAME2012" - !endif - NSISdl::download "$HTTP_PATH/msvcrt2013/$ARCHIVE_NAME2013" "$TEMP\$ARCHIVE_NAME2013" - NSISdl::download "$HTTP_PATH/msvcrt2015/$ARCHIVE_NAME2015" "$TEMP\$ARCHIVE_NAME2015" Pop $0 StrCmp $0 "success" download_ok download_failed @@ -827,16 +805,6 @@ Function DownloadInstallMSRuntime download_ok: InitPluginsDir untgz::extract "-d" "$TEMP\$ORIGINAL_UNTAR_FOLDER" "-zbz2" "$TEMP\$ARCHIVE_NAME" - ;!if ${PLATFORM} == "x86" - ; untgz::extract "-d" "$TEMP\$ORIGINAL_UNTAR_FOLDER" "-zbz2" "$TEMP\$ARCHIVE_NAME2005" - ;!endif - untgz::extract "-d" "$TEMP\$ORIGINAL_UNTAR_FOLDER" "-zbz2" "$TEMP\$ARCHIVE_NAME2008" - untgz::extract "-d" "$TEMP\$ORIGINAL_UNTAR_FOLDER" "-zbz2" "$TEMP\$ARCHIVE_NAME2010" - !if ${PLATFORM} == "x86_64" - untgz::extract "-d" "$TEMP\$ORIGINAL_UNTAR_FOLDER" "-zbz2" "$TEMP\$ARCHIVE_NAME2012" - !endif - untgz::extract "-d" "$TEMP\$ORIGINAL_UNTAR_FOLDER" "-zbz2" "$TEMP\$ARCHIVE_NAME2013" - untgz::extract "-d" "$TEMP\$ORIGINAL_UNTAR_FOLDER" "-zbz2" "$TEMP\$ARCHIVE_NAME2015" Pop $0 StrCmp $0 "success" untar_ok untar_failed @@ -854,31 +822,6 @@ Function DownloadInstallMSRuntime untar_ok: DetailPrint "Archive successfully unzipped." - !if ${PLATFORM} == "x86" - ; seems to be not needed, see #2996 - ;DetailPrint "Installing vcredist_2005_x86.exe ..." - ;ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist_2005_x86.exe" /q' - DetailPrint "Installing vcredist_2008_x86.exe ..." - ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist_2008_x86.exe" /q' - DetailPrint "Installing vcredist_2010_x86.exe ..." - ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist_2010_x86.exe" /q' - DetailPrint "Installing vcredist_2013_x86.exe ..." - ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist_2013_x86.exe" /q' - DetailPrint "Installing vcredist_2015_x86.exe ..." - ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist_2015_x86.exe" /q' - !else - DetailPrint "Installing vcredist_2008_x64.exe ..." - ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist-2008-sp1-x64.exe" /q' - DetailPrint "Installing vcredist_2010_x64.exe ..." - ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist-2010-x64.exe" /q' - ; msvcrt2012 package contains dll files - ;DetailPrint "Installing vcredist_2012_x64.exe ..." - ;ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist-2012-x64.exe" /q' - DetailPrint "Installing vcredist_2013_x64.exe ..." - ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist-2013-x64.exe" /q' - DetailPrint "Installing vcredist_2015_x64.exe ..." - ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist_2015_x64.exe" /q' - !endif DetailPrint "Copying runtime files ..." CopyFiles "$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\*.dll" "$INSTALL_DIR\extrabin" DetailPrint "MS runtime files installed." @@ -891,27 +834,13 @@ FunctionEnd Section "Important Microsoft Runtime DLLs" SecMSRuntime ;Set the size (in KB) of the archive file - StrCpy $ARCHIVE_SIZE_KB 18512 + StrCpy $ARCHIVE_SIZE_KB 833 ;Set the size (in KB) of the unpacked archive file AddSize 13500 - StrCpy $HTTP_PATH "http://download.osgeo.org/osgeo4w/${PLATFORM}/release/msvcrt/" - !if ${PLATFORM} == "x86_64" - StrCpy $ARCHIVE_NAME "msvcrt-1.0.1-9.tar.bz2" - StrCpy $ARCHIVE_NAME2008 "msvcrt2008-1.0.0-1.tar.bz2" - StrCpy $ARCHIVE_NAME2010 "msvcrt2010-1.0.0-1.tar.bz2" - StrCpy $ARCHIVE_NAME2012 "msvcrt2012-1.0.0-1.tar.bz2" - StrCpy $ARCHIVE_NAME2013 "msvcrt2013-1.0.0-1.tar.bz2" - StrCpy $ARCHIVE_NAME2015 "msvcrt2015-1.0-1.tar.bz2" - !else - StrCpy $ARCHIVE_NAME "msvcrt-1.0.1-14.tar.bz2" - ;StrCpy $ARCHIVE_NAME2005 "msvcrt2005-1.0-1.tar.bz2" - StrCpy $ARCHIVE_NAME2008 "msvcrt2008-1.0-1.tar.bz2" - StrCpy $ARCHIVE_NAME2010 "msvcrt2010-1.0-1.tar.bz2" - StrCpy $ARCHIVE_NAME2013 "msvcrt2013-1.0-1.tar.bz2" - StrCpy $ARCHIVE_NAME2015 "msvcrt2015-1.0-1.tar.bz2" - !endif + StrCpy $HTTP_PATH "http://download.osgeo.org/osgeo4w/v2/${PLATFORM}/release/msvcrt2019/" + StrCpy $ARCHIVE_NAME "msvcrt2019-14.2-1.tar.bz2" StrCpy $EXTENDED_ARCHIVE_NAME "Microsoft Visual C++ Redistributable Packages" StrCpy $ORIGINAL_UNTAR_FOLDER "install_msruntime" @@ -921,11 +850,12 @@ SectionEnd Function DownloadDataSet - IntOp $ARCHIVE_SIZE_MB $ARCHIVE_SIZE_KB / 1024 + ; IntOp $ARCHIVE_SIZE_MB $ARCHIVE_SIZE_KB / 1024 StrCpy $DOWNLOAD_MESSAGE_ "The installer will download the $EXTENDED_ARCHIVE_NAME sample data set.$\r$\n" StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_$\r$\n" - StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_The archive is about $ARCHIVE_SIZE_MB MB and may take" + ; StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_The archive is about $ARCHIVE_SIZE_MB MB and may take" + StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_The archive is about $ARCHIVE_SIZE_KB KB and may take" StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_ several minutes to download.$\r$\n" StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_$\r$\n" StrCpy $DOWNLOAD_MESSAGE_ "$DOWNLOAD_MESSAGE_The $EXTENDED_ARCHIVE_NAME dataset will be copied to:$\r$\n" diff --git a/mswindows/GRASS-Packager.bat.tmpl b/mswindows/GRASS-Packager.bat.tmpl index d8d071b41f9..69d52afc28c 100644 --- a/mswindows/GRASS-Packager.bat.tmpl +++ b/mswindows/GRASS-Packager.bat.tmpl @@ -14,14 +14,14 @@ rem ---------------------------------------------------------------------------- set PACKAGE_DIR=.\GRASS-@GRASS_VERSION_MAJOR@@GRASS_VERSION_MINOR@-Package -set OSGEO4W_BLD_DIR=C:\OSGeo4W%1 -if exist C:\OSGeo4W%1_grass@GRASS_VERSION_MAJOR@_py3 ( -set OSGEO4W_PKG_DIR=C:\OSGeo4W%1_grass@GRASS_VERSION_MAJOR@_py3 +set OSGEO4W_BLD_DIR=C:\OSGeo4W +if exist C:\OSGeo4W_grass@GRASS_VERSION_MAJOR@ ( +set OSGEO4W_PKG_DIR=C:\OSGeo4W_grass@GRASS_VERSION_MAJOR@ ) else ( -set OSGEO4W_PKG_DIR=C:\OSGeo4W%1 +set OSGEO4W_PKG_DIR=C:\OSGeo4W ) -set MSYS_BLD_DIR=C:\msys%1\mingw%1 +set MSYS_BLD_DIR=C:\msys64\mingw64 set GRASS_PREFIX=%OSGEO4W_BLD_DIR%\apps\grass\grass@GRASS_VERSION_MAJOR@@GRASS_VERSION_MINOR@ @@ -53,9 +53,8 @@ mkdir %PACKAGE_DIR%\extrabin\gdalplugins copy %OSGEO4W_PKG_DIR%\bin\* %PACKAGE_DIR%\extrabin xcopy %OSGEO4W_PKG_DIR%\bin\gdalplugins\* %PACKAGE_DIR%\extrabin\gdalplugins /S/V/F/I -del %PACKAGE_DIR%\extrabin\msvcp* -del %PACKAGE_DIR%\extrabin\msvcr* -del %PACKAGE_DIR%\extrabin\vcredist_* +rem msvcrt2019 +del %PACKAGE_DIR%\extrabin\*140*.dll @echo. @echo ----------------------------------------------------------------------------------------------------------------------- @@ -86,22 +85,13 @@ xcopy %OSGEO4W_PKG_DIR%\share\gdal %PACKAGE_DIR%\share\gdal /S/V/F/I @echo. @echo ----------------------------------------------------------------------------------------------------------------------- -@echo Copy shared GEOTIFF files to PACKAGE_DIR\share\epsg_csv +@echo Copy Python content to PACKAGE_DIR\Python3 @echo ----------------------------------------------------------------------------------------------------------------------- @echo. -mkdir %PACKAGE_DIR%\share\epsg_csv -xcopy %OSGEO4W_PKG_DIR%\share\epsg_csv %PACKAGE_DIR%\share\epsg_csv /S/V/F/I +mkdir %PACKAGE_DIR%\Python39 -@echo. -@echo ----------------------------------------------------------------------------------------------------------------------- -@echo Copy Python content to PACKAGE_DIR\Python37 -@echo ----------------------------------------------------------------------------------------------------------------------- -@echo. - -mkdir %PACKAGE_DIR%\Python37 - -xcopy %OSGEO4W_PKG_DIR%\apps\Python37\* %PACKAGE_DIR%\Python37 /S/V/F/I +xcopy %OSGEO4W_PKG_DIR%\apps\Python39\* %PACKAGE_DIR%\Python39 /S/V/F/I @echo. @echo ----------------------------------------------------------------------------------------------------------------------- diff --git a/mswindows/Makefile b/mswindows/Makefile index 3eed5bef901..3a33ac70b74 100644 --- a/mswindows/Makefile +++ b/mswindows/Makefile @@ -21,7 +21,7 @@ GRASS-Packager.bat: GRASS-Packager.bat.tmpl GRASS-Installer.nsi: GRASS-Installer.nsi.tmpl sed \ - -e 's#@GRASS_VERSION_SVN@#$(GRASS_VERSION_SVN)#' \ + -e 's#@GRASS_VERSION_GIT@#$(GRASS_VERSION_GIT)#' \ -e 's#@GRASS_VERSION_MAJOR@#$(GRASS_VERSION_MAJOR)#' \ -e 's#@GRASS_VERSION_MINOR@#$(GRASS_VERSION_MINOR)#' \ -e 's#@GRASS_VERSION_RELEASE@#$(GRASS_VERSION_RELEASE)#' \ diff --git a/mswindows/env.bat b/mswindows/env.bat index e5b21c03d72..338b946450f 100644 --- a/mswindows/env.bat +++ b/mswindows/env.bat @@ -3,13 +3,12 @@ REM Environmental variables for GRASS stand-alone installer REM set GRASS_PYTHON=%GISBASE%\extrabin\python3.exe -set PYTHONHOME=%GISBASE%\Python37 +set PYTHONHOME=%GISBASE%\Python39 set GRASS_PROJSHARE=%GISBASE%\share\proj set PROJ_LIB=%GISBASE%\share\proj set GDAL_DATA=%GISBASE%\share\gdal -set GEOTIFF_CSV=%GISBASE%\share\epsg_csv set FONTCONFIG_FILE=%GISBASE%\etc\fonts.conf diff --git a/mswindows/osgeo4w/env.bat.tmpl b/mswindows/osgeo4w/env.bat.tmpl index 157d622b350..200c86f2687 100644 --- a/mswindows/osgeo4w/env.bat.tmpl +++ b/mswindows/osgeo4w/env.bat.tmpl @@ -2,8 +2,6 @@ REM REM Environmental variables for GRASS OSGeo4W installer REM -call "%OSGEO4W_ROOT%\bin\py3_env.bat" - set GISBASE=%OSGEO4W_ROOT%\apps\grass\grass@POSTFIX@ REM Uncomment if you want to use Bash instead of Cmd diff --git a/mswindows/osgeo4w/mklibs.sh b/mswindows/osgeo4w/mklibs.sh index 00a597afa9f..0985a96535a 100755 --- a/mswindows/osgeo4w/mklibs.sh +++ b/mswindows/osgeo4w/mklibs.sh @@ -2,30 +2,12 @@ set -e -if [ -z "$OSGEO4W_POSTFIX" ]; then - OSGEO4W_POSTFIX="" -fi +[ -d mswindows/osgeo4w/vc ] || mkdir mswindows/osgeo4w/vc -if [ "$OSGEO4W_POSTFIX" != "64" ]; then - MACHINE=x86 -else - MACHINE=x64 +if [ -n "$VCPATH" ]; then + PATH=$PATH:$VCPATH fi -PROGRAMFILES="/c/Program Files (x86)" -VSDIR="$PROGRAMFILES/Microsoft Visual Studio 14.0" -# add example for MS Visual Studio 2017 Community 64 bit -# VSDIR="$PROGRAMFILES/Microsoft Visual Studio/2017/Community" -PATH="$VSDIR/Common7/IDE:$PATH" -PATH="$VSDIR/VC/bin:$PATH" -# add example for MS Visual Studio 2017 Community 64 bit -# PATH="$VSDIR/VC/Tools/MSVC/14.12.25827/bin/Hostx64/x64:$PATH" -PATH="$VSDIR/Common7/Tools:$PATH" -PATH="$PATH:/c/OSGeo4W${OSGEO4W_POSTFIX}/bin" -export PATH - -[ -d mswindows/osgeo4w/vc ] || mkdir mswindows/osgeo4w/vc - for dllfile in "$@"; do dlldir=${dllfile%/*} dllfile=${dllfile##*/} @@ -43,6 +25,7 @@ for dllfile in "$@"; do egrep -v "^[ ]*(_+IMPORT_DESCRIPTOR_.*|_+NULL_IMPORT_DESCRIPTOR)$" >mswindows/osgeo4w/vc/${defname%$VERSION} (cd mswindows/osgeo4w/vc ; - lib -nologo -def:${defname} -subsystem:windows -machine:${MACHINE} + lib -nologo -def:${defname} -subsystem:windows -machine:x64 lib -nologo $libname || exit) done + diff --git a/mswindows/osgeo4w/package.sh b/mswindows/osgeo4w/package.sh index c49d57974a2..d8eaaf45c10 100755 --- a/mswindows/osgeo4w/package.sh +++ b/mswindows/osgeo4w/package.sh @@ -1,7 +1,5 @@ #!/usr/bin/bash -# osgeo4w-setup -g -k -a x86_64 -q -P gdal -P proj -P geos -P fftw -P libjpeg -P liblas-devel -P libpng -P libpq -P libtiff -P libxdr -P pdcurses -P regex-devel -P sqlite3 -P zstd-devel -P zstd -P laszip2 -P python3-core -P python3-six - set -e PWD="$(pwd)" @@ -29,19 +27,8 @@ if [ -z $PACKAGE_POSTFIX ]; then PACKAGE_POSTFIX="" fi -# OSGeo4W directory postfix -# eg. '64' for 64bit, empty for 32bit -if [ -z $OSGEO4W_POSTFIX ]; then - OSGEO4W_POSTFIX="" -fi -if [ "$OSGEO4W_POSTFIX" = "64" ]; then - MINGW_POSTFIX=64 -else - MINGW_POSTFIX=32 -fi - -export OSGEO4W_ROOT_MSYS="/c/OSGeo4W${OSGEO4W_POSTFIX}" -export OSGEO4W_ROOT=$(cygpath -w "$OSGEO4W_ROOT_MSYS") +[ -n "$OSGEO4W_ROOT_MSYS" ] +echo "OSGEO4W_ROOT_MSYS:$OSGEO4W_ROOT_MSYS OSGEO4W_ROOT:$OSGEO4W_ROOT" fetchenv() { local IFS @@ -53,22 +40,16 @@ fetchenv() { diffenv=$(mktemp /tmp/diffenv.XXXXXXXXXX) args="$@" cmd.exe //c set >$srcenv - cmd.exe //c "call `cygpath -w $batch` $args \>nul 2\>nul \& set" >$dstenv + cmd.exe //c "call `cygpath -sw $batch` $args \>nul 2\>nul \& set" >$dstenv diff -u $srcenv $dstenv | sed -f mswindows/osgeo4w/envdiff.sed >$diffenv . $diffenv - PATH=$PATH:/usr/bin:/mingw${MINGW_POSTFIX}/bin/:$PWD/mswindows/osgeo4w/lib:$PWD/mswindows/osgeo4w:/c/windows32/system32:/c/windows:/c/windows32/system32:/c/windows + PATH=$PATH:/usr/bin:/mingw64/bin/:$PWD/mswindows/osgeo4w/lib:$PWD/mswindows/osgeo4w:/c/windows32/system32:/c/windows:/c/windows32/system32:/c/windows rm -f $srcenv $dstenv $diffenv } -# Avoid GRASS' old msys -! [ -f $OSGEO4W_ROOT_MSYS/etc/ini/msys.bat ] || mv $OSGEO4W_ROOT_MSYS/etc/ini/msys.bat $OSGEO4W_ROOT_MSYS/etc/ini/msys.bat.off - fetchenv $OSGEO4W_ROOT_MSYS/bin/o4w_env.bat -fetchenv $OSGEO4W_ROOT_MSYS/bin/py3_env.bat -! [ -f $OSGEO4W_ROOT_MSYS/etc/ini/msys.bat.off ] || mv $OSGEO4W_ROOT_MSYS/etc/ini/msys.bat.off $OSGEO4W_ROOT_MSYS/etc/ini/msys.bat - -PATH=/mingw${MINGW_POSTFIX}/lib/ccache/bin:$PATH +PATH=/mingw64/lib/ccache/bin:$PATH T0=$(date +%s) LT=$T0 @@ -125,42 +106,30 @@ fi exec 3>&1 > >(tee mswindows/osgeo4w/package.log) 2>&1 -if [ "$MINGW_POSTFIX" = "64" ]; then - mingw_libgcc=libgcc_s_seh-1.dll -else - mingw_libgcc=libgcc_s_dw2-1.dll -fi - -DLLS="/mingw${MINGW_POSTFIX}/bin/zlib1.dll - /mingw${MINGW_POSTFIX}/bin/libbz2-1.dll - /mingw${MINGW_POSTFIX}/bin/libiconv-2.dll - /mingw${MINGW_POSTFIX}/bin/libexpat-1.dll - /mingw${MINGW_POSTFIX}/bin/libfontconfig-1.dll - /mingw${MINGW_POSTFIX}/bin/libintl-8.dll - /mingw${MINGW_POSTFIX}/bin/libsystre-0.dll - /mingw${MINGW_POSTFIX}/bin/libtre-5.dll - /mingw${MINGW_POSTFIX}/bin/libwinpthread-1.dll - /mingw${MINGW_POSTFIX}/bin/libcairo-2.dll - /mingw${MINGW_POSTFIX}/bin/libpixman-1-0.dll - /mingw${MINGW_POSTFIX}/bin/libpng16-16.dll - /mingw${MINGW_POSTFIX}/bin/libfreetype-6.dll - /mingw${MINGW_POSTFIX}/bin/libharfbuzz-0.dll - /mingw${MINGW_POSTFIX}/bin/libglib-2.0-0.dll - /mingw${MINGW_POSTFIX}/bin/libgraphite2.dll - /mingw${MINGW_POSTFIX}/bin/libpcre-1.dll - /mingw${MINGW_POSTFIX}/bin/libstdc++-6.dll - /mingw${MINGW_POSTFIX}/bin/$mingw_libgcc" - -if [ "$MINGW_POSTFIX" = "64" ]; then - conf_host=x86_64-w64-mingw32 - # https://trac.osgeo.org/osgeo4w/ticket/550 - conf_opts="--with-liblas=$PWD/mswindows/osgeo4w/liblas-config" -else - conf_host=i386-w64-mingw32 - # https://trac.osgeo.org/osgeo4w/ticket/539 - # LAS support hopefully only temporarily disabled on 32bit - conf_opts= -fi +DLLS=" + /mingw64/bin/zlib1.dll + /mingw64/bin/libbz2-1.dll + /mingw64/bin/libiconv-2.dll + /mingw64/bin/libexpat-1.dll + /mingw64/bin/libfontconfig-1.dll + /mingw64/bin/libbrotlidec.dll + /mingw64/bin/libbrotlicommon.dll + /mingw64/bin/libintl-8.dll + /mingw64/bin/libsystre-0.dll + /mingw64/bin/libtre-5.dll + /mingw64/bin/libwinpthread-1.dll + /mingw64/bin/libcairo-2.dll + /mingw64/bin/libpixman-1-0.dll + /mingw64/bin/libpng16-16.dll + /mingw64/bin/libfreetype-6.dll + /mingw64/bin/libharfbuzz-0.dll + /mingw64/bin/libglib-2.0-0.dll + /mingw64/bin/libgraphite2.dll + /mingw64/bin/libpcre-1.dll + /mingw64/bin/libstdc++-6.dll + /mingw64/bin/libgcc_s_seh-1.dll + /mingw64/bin/libfftw3-3.dll +" if ! [ -f mswindows/osgeo4w/configure-stamp ]; then if [ -e include/Make/Platform.make ] ; then @@ -171,33 +140,32 @@ if ! [ -f mswindows/osgeo4w/configure-stamp ]; then log remove old logs rm -f mswindows/osgeo4w/package.log.* - mkdir -p dist.$conf_host/bin - cp -uv $DLLS dist.$conf_host/bin + mkdir -p dist.x86_64-w64-mingw32/bin + cp -uv $DLLS dist.x86_64-w64-mingw32/bin mkdir -p mswindows/osgeo4w/lib cp -uv $OSGEO4W_ROOT_MSYS/lib/libpq.lib mswindows/osgeo4w/lib/pq.lib - cp -uv $OSGEO4W_ROOT_MSYS/lib/proj_i.lib mswindows/osgeo4w/lib/proj.lib cp -uv $OSGEO4W_ROOT_MSYS/lib/sqlite3_i.lib mswindows/osgeo4w/lib/sqlite3.lib log configure ./configure \ - --host=$conf_host \ - --with-libs="$OSGEO4W_ROOT/lib" \ + --host=x86_64-w64-mingw32 \ + --with-libs="$OSGEO4W_ROOT_MSYS/lib" \ --with-includes=$OSGEO4W_ROOT_MSYS/include \ - --libexecdir=$OSGEO4W_ROOT_MSYS/bin \ - --prefix=$OSGEO4W_ROOT_MSYS/apps/grass \ - --bindir=$OSGEO4W_ROOT_MSYS/bin \ - --includedir=$OSGEO4W_ROOT_MSYS/include \ + --libexecdir=$OSGEO4W_ROOT_MSYS/bin \ + --prefix=$OSGEO4W_ROOT_MSYS/apps/grass \ + --bindir=$OSGEO4W_ROOT_MSYS/bin \ + --includedir=$OSGEO4W_ROOT_MSYS/include \ --without-x \ --with-cxx \ --enable-shared \ --enable-largefile \ --with-fftw \ --with-freetype \ - --with-freetype-includes=/mingw${MINGW_POSTFIX}/include/freetype2 \ + --with-freetype-includes=/mingw64/include/freetype2 \ --with-proj-share=$OSGEO4W_ROOT_MSYS/share/proj \ --with-proj-includes=$OSGEO4W_ROOT_MSYS/include \ - --with-proj-libs=$PWD/mswindows/osgeo4w/lib \ + --with-proj-libs=$OSGEO4W_ROOT_MSYS/lib \ --with-postgres \ --with-postgres-includes=$OSGEO4W_ROOT_MSYS/include \ --with-postgres-libs=$PWD/mswindows/osgeo4w/lib \ @@ -210,11 +178,12 @@ if ! [ -f mswindows/osgeo4w/configure-stamp ]; then --with-nls \ --with-zstd \ --with-odbc \ - --with-cairo \ - --with-opengl=windows \ - --with-bzlib $conf_opts -# see #3047 -# --with-mysql + --with-cairo \ + --with-cairo-includes=$OSGEO4W_ROOT_MSYS/include \ + --with-cairo-ldflags="-L$PWD/mswindows/osgeo4w/lib -lcairo -lfontconfig" \ + --with-opengl=windows \ + --with-bzlib \ + --with-liblas=$PWD/mswindows/osgeo4w/liblas-config touch mswindows/osgeo4w/configure-stamp fi @@ -248,8 +217,7 @@ sed -e "s#@POSTFIX@#$POSTFIX#g" -e "s#@VERSION@#$VERSION#g" -e "s#@GRASS_EXECUTA if [ -n "$PACKAGE_PATCH" ]; then log building vc libraries - OSGEO4W_POSTFIX=$OSGEO4W_POSTFIX sh \ - mswindows/osgeo4w/mklibs.sh $OSGEO4W_ROOT_MSYS/apps/grass/grass$POSTFIX/lib/*.${MAJOR}.${MINOR}.dll + sh mswindows/osgeo4w/mklibs.sh $OSGEO4W_ROOT_MSYS/apps/grass/grass$POSTFIX/lib/*.${MAJOR}.${MINOR}.dll mv mswindows/osgeo4w/vc/grass*.lib $OSGEO4W_ROOT_MSYS/apps/grass/grass$POSTFIX/lib log creating package @@ -267,8 +235,7 @@ if [ -n "$PACKAGE_PATCH" ]; then # copy dependencies (TODO: to be reduced) cp -uv $DLLS apps/grass/grass$POSTFIX/bin - cp -uv /mingw${MINGW_POSTFIX}/etc/fonts/fonts.conf \ - apps/grass/grass$POSTFIX/etc + cp -uv /mingw64/etc/fonts/fonts.conf apps/grass/grass$POSTFIX/etc # creating grass package /bin/tar -cjf $PDIR/grass$PACKAGE_POSTFIX-$VERSION-$PACKAGE_PATCH.tar.bz2 \ @@ -277,7 +244,6 @@ if [ -n "$PACKAGE_PATCH" ]; then bin/python-${GRASS_EXECUTABLE}.bat \ etc/postinstall/grass${PACKAGE_POSTFIX}.bat \ etc/preremove/grass${PACKAGE_POSTFIX}.bat - fi log diff --git a/mswindows/osgeo4w/postinstall.bat b/mswindows/osgeo4w/postinstall.bat index 0efcf3477e9..e9f75cecfdf 100644 --- a/mswindows/osgeo4w/postinstall.bat +++ b/mswindows/osgeo4w/postinstall.bat @@ -1,27 +1,29 @@ -set ICON=%OSGEO4W_ROOT%\apps\grass\grass@POSTFIX@\gui\icons\grass_osgeo.ico -set BATCH=%OSGEO4W_ROOT%\bin\@GRASS_EXECUTABLE@.bat -textreplace -std -t "%BATCH%" -textreplace -std -t "%OSGEO4W_ROOT%"\apps\grass\grass@POSTFIX@\etc\fontcap - -if not %OSGEO4W_MENU_LINKS%==0 xxmklink "%OSGEO4W_STARTMENU%\GRASS GIS @VERSION@.lnk" "%BATCH%" "--gui" \ "Launch GRASS GIS @VERSION@" 1 "%ICON%" -if not %OSGEO4W_DESKTOP_LINKS%==0 xxmklink "%OSGEO4W_DESKTOP%\GRASS GIS @VERSION@.lnk" "%BATCH%" "--gui" \ "Launch GRASS GIS @VERSION@" 1 "%ICON%" - -rem run g.mkfontcap outside a GRASS session during -rem an OSGeo4W installation for updating paths to fonts - -rem set gisbase -set GISBASE=%OSGEO4W_ROOT%\apps\grass\grass@POSTFIX@ - -rem set path to freetype dll and its dependencies -set FREETYPEBASE=%OSGEO4W_ROOT%\bin;%OSGEO4W_ROOT%\apps\msys\bin;%GISBASE%\lib - -rem set dependencies to path -set PATH=%FREETYPEBASE%;%PATH% - -rem GISRC must be set -set GISRC=dummy - -rem run g.mkfontcap outside a GRASS session -"%GISBASE%\bin\g.mkfontcap.exe" -o - -del "%BATCH%.tmpl +set ICON=%OSGEO4W_ROOT%\apps\grass\grass@POSTFIX@\gui\icons\grass_osgeo.ico +set BATCH=%OSGEO4W_ROOT%\bin\@GRASS_EXECUTABLE@.bat +textreplace -std -t "%BATCH%" +textreplace -std -t "%OSGEO4W_ROOT%\apps\grass\grass@POSTFIX@\etc\fontcap" + +for /F "tokens=* USEBACKQ" %%F IN (`getspecialfolder Documents`) do set DOCUMENTS=%%F + +if not %OSGEO4W_MENU_LINKS%==0 xxmklink "%OSGEO4W_STARTMENU%\GRASS GIS @VERSION@.lnk" "%BATCH%" "--gui" "%DOCUMENTS%" "Launch GRASS GIS @VERSION@" 1 "%ICON%" +if not %OSGEO4W_DESKTOP_LINKS%==0 xxmklink "%OSGEO4W_DESKTOP%\GRASS GIS @VERSION@.lnk" "%BATCH%" "--gui" "%DOCUMENTS%" "Launch GRASS GIS @VERSION@" 1 "%ICON%" + +rem run g.mkfontcap outside a GRASS session during +rem an OSGeo4W installation for updating paths to fonts + +rem set gisbase +set GISBASE=%OSGEO4W_ROOT%\apps\grass\grass@POSTFIX@ + +rem set path to freetype dll and its dependencies +set FREETYPEBASE=%OSGEO4W_ROOT%\bin;%OSGEO4W_ROOT%\apps\msys\bin;%GISBASE%\lib + +rem set dependencies to path +set PATH=%FREETYPEBASE%;%PATH% + +rem GISRC must be set +set GISRC=dummy + +rem run g.mkfontcap outside a GRASS session +"%GISBASE%\bin\g.mkfontcap.exe" -o + +del "%BATCH%.tmpl