Przeglądaj źródła

osgeo4w: build fixes (#137)

restructure and stabilize osgeo4w/msys2 based winGRASS build procedure, provided by and thanks to @jef-n 

* osgeo4w: build fixes
* use cmd //c instead of cmd /c
* osgeo4w: use proj_i instead of proj
* avoid ol msys
* drop -j4
* Use osgeo4w's sqlite
Jürgen Fischer 5 lat temu
rodzic
commit
a1d75c73d0

+ 1 - 1
lib/python/ctypes/ctypesgencore/processor/operations.py

@@ -204,7 +204,7 @@ def find_source_libraries(data, opts):
     for library_name in opts.libraries:
         try:
             library = ctypesgencore.libraryloader.load_library(library_name)
-        except ImportError as e:
+        except (ImportError,OSError) as e:
             warning_message("Could not load library \"%s\". Okay, I'll "
                             "try to load it at runtime instead. " % (library_name),
                             cls='missing-library')

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

@@ -2,6 +2,8 @@ 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

+ 14 - 0
mswindows/osgeo4w/envdiff.sed

@@ -0,0 +1,14 @@
+/^+++/d;
+/^[^+]/d;
+s/^+//;
+s/\\/\\\\/g;
+/^PATH=/ {
+	s/\\\\/\//g;
+	s#\([=;]\)\([a-zA-Z]\):#\1/\2#g;
+	s/;/:/g;
+}
+s/;/\\;/g;
+s/^/export /;
+s/=/='/;
+s/
//g;
+s/$/'/;

+ 0 - 38
mswindows/osgeo4w/package.cmd

@@ -1,38 +0,0 @@
-path %PATH%;%OSGEO4W_ROOT%\apps\swig
-set WXWIN=h:\windows\wxPython-src-2.8.9.1
-
-set GRASS_HOME=%OSGEO4W_ROOT%\apps\grass\grass-7.7.0
-set GRASS_INC=%GRASS_HOME%\include
-set GRASS_LPATH=%GRASS_HOME%\lib
-
-set WX_INC=%WXWIN%\lib\vc_dll\mswud;%WXWIN%\lib\vc_dll\mswu;%WXWIN%\include
-set WXPY_INC=%WXWIN%\wxPython\include 
-set WX_LPATH=%OSGEO4W_ROOT%\lib;%WXWIN%\lib\vc_dll
-
-set OLD=%CD%
-cd %OLD%\gui\wxpython\nviz
-python setup.py build_ext -I %OSGEO4W_ROOT%\include;%GRASS_INC%;%WX_INC% -L %GRASS_LPATH%
-copy grass6_wxnviz.py                       %GRASS_HOME%\etc\wxpython\nviz
-copy build\lib.win32-2.5\_grass6_wxnviz.pyd %GRASS_HOME%\etc\wxpython\nviz
-if exist build\lib.win32-2.5\_grass6_wxnviz.pdb copy build\lib.win32-2.5\_grass6_wxnviz.pdb %GRASS_HOME%\etc\wxpython\nviz
-
-cd %OLD%\gui\wxpython\vdigit
-python setup.py build_ext -D WXUSINGDLL -I %OSGEO4W_ROOT%\include;%GRASS_INC%;%WX_INC%;%WXPY_INC% -L %GRASS_LPATH%;%WX_LPATH%
-copy grass6_wxvdigit.py                       %GRASS_HOME%\etc\wxpython\vdigit
-copy build\lib.win32-2.5\_grass6_wxvdigit.pyd %GRASS_HOME%\etc\wxpython\vdigit
-if exist build\lib.win32-2.5\_grass6_wxvdigit.pdb copy build\lib.win32-2.5\_grass6_wxvdigit.pdb %GRASS_HOME%\etc\wxpython\vdigit
-
-goto skip
-
-cd %OLD%\swig\python
-python setup.py build_ext -I %GRASS_INC%;%OSGEO4W_ROOT%\include -L %OSGEO4W_ROOT%\lib;%GRASS_LPATH%
-copy grass6_wxvdigit.py %GRASS_HOME%\etc\wxpython\
-copy build\lib.win32-2.5\_grass6_wxvdigit.pyd %GRASS_HOME%\etc\wxpython\vdigit
-
-cd %OLD%\swig\python\NumPtr
-python setup.py build_ext
-
-
-:skip
-
-cd %OLD%

+ 157 - 160
mswindows/osgeo4w/package.sh

@@ -1,21 +1,21 @@
-#!/usr/bin/sh
+#!/usr/bin/bash
+
+# osgeo4w-setup -g -k -a x86_64 -q -P gdal proj geos fftw libjpeg liblas-devel libpng libpq libtiff libxdr pdcurses regex-devel sqlite3 zstd-devel zstd laszip2
 
 set -e
 
 PWD="$(pwd)"
 
 if ! [ -d mswindows ]; then
-	echo Start from GRASS toplevel dir
-	exit 1
+    echo Start from GRASS toplevel dir
+    exit 1
 fi
 
-if ! [ -d /tmp ]; then 
-    mkdir /tmp 
-    if ! [ -d /tmp ]; then 
- 	echo /tmp does not exists 
- 	exit 1 
-    fi 
-fi 
+mkdir -p /tmp
+if ! [ -d /tmp ]; then
+    echo /tmp does not exists
+    exit 1
+fi
 
 # package patch number
 # e.g. 'r65400-1' for daily builds, '-1' for release
@@ -23,7 +23,7 @@ if [ -z  $PACKAGE_PATCH ]; then
     PACKAGE_PATCH=1
 fi
 
-# package name 
+# package name
 # eg. '-daily' -> 'grass-daily', empty for release
 if [ -z $PACKAGE_POSTFIX ]; then
     PACKAGE_POSTFIX=""
@@ -41,55 +41,74 @@ else
 fi
 
 export OSGEO4W_ROOT_MSYS="/c/OSGeo4W${OSGEO4W_POSTFIX}"
-export OSGEO4W_ROOT="C:\\\OSGeo4W${OSGEO4W_POSTFIX}"
-
-export PATH=/usr/bin:/mingw${MINGW_POSTFIX}/bin/:$OSGEO4W_ROOT_MSYS/bin:$PWD/mswindows/osgeo4w/lib:$PWD/mswindows/osgeo4w
-
-# Force Python3
-# alias python=python3
-export PYTHONPATH=
-export PYTHONHOME=$OSGEO4W_ROOT_MSYS/apps/Python37
-export PATH=$OSGEO4W_ROOT_MSYS/apps/Python37:$PATH
-
-T0=$(date +%s) 
-LT=$T0 
-CS="" 
-
-log() { 
-    local D T 
-    NOW=$(date) 
-    T=$(date +%s) 
-    
-    if [ -n "$CS" ]; then 
-        local D H M S 
- 	S=$(( $T-$LT )) 
- 	M=$(( S/60 )); S=$(( S%60 )) 
- 	H=$(( M/60 )); M=$(( M%60 )) 
- 	D=$(( H/24 )); H=$(( H%24 )) 
- 	
- 	echo -n "$NOW: FINISHED $CS AFTER " 
- 	(( D>0 )) && echo -n "${D}d" 
- 	(( H>0 )) && echo -n "${H}h" 
- 	(( M>0 )) && echo -n "${M}m" 
- 	echo "${S}s" 
-    fi 
-    
-    CS="$@" 
-    LT=$T 
-    if [ -n "$CS" ]; then 
-        echo $NOW: STARTING $CS 
-    elif [ -n "$T0" ]; then 
- 	CS="COMPLETE RUN" 
- 	LT=$T0 
- 	T0="" 
- 	log 
-    fi 
+export OSGEO4W_ROOT=$(cygpath -w "$OSGEO4W_ROOT_MSYS")
+
+fetchenv() {
+    local IFS
+    IFS=
+    batch=$1
+    shift
+    srcenv=$(mktemp /tmp/srcenv.XXXXXXXXXX)
+    dstenv=$(mktemp /tmp/dstenv.XXXXXXXXXX)
+    diffenv=$(mktemp /tmp/diffenv.XXXXXXXXXX)
+    args="$@"
+    cmd.exe //c set >$srcenv
+    cmd.exe //c "call `cygpath -w $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
+    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
+
+T0=$(date +%s)
+LT=$T0
+CS=""
+
+log() {
+    local D T
+    NOW=$(date)
+    T=$(date +%s)
+
+    if [ -n "$CS" ]; then
+        local D H M S
+	S=$(( $T-$LT ))
+	M=$(( S/60 )); S=$(( S%60 ))
+	H=$(( M/60 )); M=$(( M%60 ))
+	D=$(( H/24 )); H=$(( H%24 ))
+
+	echo -n "$NOW: FINISHED $CS AFTER "
+	(( D>0 )) && echo -n "${D}d"
+	(( H>0 )) && echo -n "${H}h"
+	(( M>0 )) && echo -n "${M}m"
+	echo "${S}s"
+    fi
+
+    CS="$@"
+    LT=$T
+    if [ -n "$CS" ]; then
+        echo $NOW: STARTING $CS
+    elif [ -n "$T0" ]; then
+	CS="COMPLETE RUN"
+	LT=$T0
+	T0=""
+	log
+    fi
 }
 
-exec 3<include/VERSION 
-read MAJOR <&3 
-read MINOR <&3 
-read PATCH <&3 
+exec 3<include/VERSION
+read MAJOR <&3
+read MINOR <&3
+read PATCH <&3
 
 export VERSION=${MAJOR}.${MINOR}.${PATCH}
 export POSTFIX=${MAJOR}${MINOR}
@@ -100,82 +119,74 @@ else
     GRASS_EXECUTABLE=grass${MAJOR}${MINOR}
 fi
 
-if [ -f mswindows/osgeo4w/package.log ]; then 
-    i=0 
-    while [ -f mswindows/osgeo4w/package.log.$i ]; do 
- 	(( i+=1 )) 
-    done 
-    mv mswindows/osgeo4w/package.log mswindows/osgeo4w/package.log.$i 
-fi 
-
-exec 3>&1 >> mswindows/osgeo4w/package.log 2>&1 
-
-dll_to_a() {
-        # http://sourceforge.net/apps/trac/mingw-w64/wiki/Answer%2064%20bit%20MSVC-generated%20x64%20.lib
-        echo "$1 => $2"
-        gendef - $1 >$2.def
-	if [ "$MINGW_POSTFIX" = "64" ]; then
-            dlltool --as-flags=--64 -m i386:x86-64 -k --output-lib $2.dll.a --input-def $2.def
-	else
-	    dlltool -k --output-lib $2.dll.a --input-def $2.def
-	fi
-}
+if [ -f mswindows/osgeo4w/package.log ]; then
+    i=0
+    while [ -f mswindows/osgeo4w/package.log.$i ]; do
+	(( i+=1 ))
+    done
+    mv mswindows/osgeo4w/package.log mswindows/osgeo4w/package.log.$i
+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"
 
-log dll.to.a
-[ -d mswindows/osgeo4w/lib ] || mkdir mswindows/osgeo4w/lib 
-dll_to_a $OSGEO4W_ROOT_MSYS/bin/proj_5_2.dll    mswindows/osgeo4w/lib/libproj
-dll_to_a $OSGEO4W_ROOT_MSYS/bin/iconv.dll       mswindows/osgeo4w/lib/libiconv
-dll_to_a $OSGEO4W_ROOT_MSYS/bin/gdal204.dll     mswindows/osgeo4w/lib/libgdal
-dll_to_a $OSGEO4W_ROOT_MSYS/bin/liblas_c.dll    mswindows/osgeo4w/lib/liblas_c
-dll_to_a $OSGEO4W_ROOT_MSYS/bin/geos_c.dll      mswindows/osgeo4w/lib/libgeos_c
-dll_to_a $OSGEO4W_ROOT_MSYS/bin/libtiff.dll     mswindows/osgeo4w/lib/libtiff
-dll_to_a $OSGEO4W_ROOT_MSYS/bin/libpq.dll       mswindows/osgeo4w/lib/libpq
-dll_to_a $OSGEO4W_ROOT_MSYS/bin/libmysql.dll       mswindows/osgeo4w/lib/libmysqlclient
-dll_to_a $OSGEO4W_ROOT_MSYS/bin/sqlite3.dll     mswindows/osgeo4w/lib/libsqlite3
-dll_to_a $OSGEO4W_ROOT_MSYS/bin/cairo.dll       mswindows/osgeo4w/lib/libcairo
-dll_to_a $OSGEO4W_ROOT_MSYS/bin/libfftw3-3.dll  mswindows/osgeo4w/lib/libfftw3
-dll_to_a $OSGEO4W_ROOT_MSYS/bin/pdcurses.dll  mswindows/osgeo4w/lib/libpdcurses
-dll_to_a $OSGEO4W_ROOT_MSYS/bin/zstd.dll  mswindows/osgeo4w/lib/libzstd
 if [ "$MINGW_POSTFIX" = "64" ]; then
-    dll_to_a $OSGEO4W_ROOT_MSYS/bin/zlib1.dll       mswindows/osgeo4w/lib/libz
-    dll_to_a $OSGEO4W_ROOT_MSYS/bin/libpng16.dll    mswindows/osgeo4w/lib/libpng
-    dll_to_a $OSGEO4W_ROOT_MSYS/bin/jpeg.dll        mswindows/osgeo4w/lib/libjpeg
+	conf_host=x86_64-w64-mingw32
+	# https://trac.osgeo.org/osgeo4w/ticket/550
+	conf_opts="--with-liblas=$PWD/mswindows/osgeo4w/liblas-config"
 else
-# TODO (related to dependencies)
-    dll_to_a $OSGEO4W_ROOT_MSYS/bin/zlib_osgeo.dll       mswindows/osgeo4w/lib/libz
-#   dll_to_a $OSGEO4W_ROOT_MSYS/bin/libpng12-0.dll  mswindows/osgeo4w/lib/libpng
-    dll_to_a $OSGEO4W_ROOT_MSYS/bin/jpeg_osgeo.dll  mswindows/osgeo4w/lib/libjpeg
+	conf_host=i386-w64-mingw32
+	# https://trac.osgeo.org/osgeo4w/ticket/539
+	#  LAS support hopefully only temporarily disabled on 32bit
+	conf_opts=
 fi
 
-cp -uv $OSGEO4W_ROOT_MSYS/lib/libxdr.a          mswindows/osgeo4w/lib
-#cp -uv $OSGEO4W_ROOT_MSYS/lib/libregex.a        mswindows/osgeo4w/lib
-cp -uv $OSGEO4W_ROOT_MSYS/lib/libfreetype.dll.a mswindows/osgeo4w/lib
+mkdir -p dist.$conf_host/bin
+cp -uv $DLLS dist.$conf_host/bin
 
-if ! [ -f mswindows/osgeo4w/configure-stamp ]; then
+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
 
+if ! [ -f mswindows/osgeo4w/configure-stamp ]; then
 	if [ -e include/Make/Platform.make ] ; then
 	    log make distclean
 	    make distclean
 	fi
 
 	log remove old logs
-	rm -f mswindows/osgeo4w/package.log.[0-9][0-9][0-9]
-
-	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
-	
+	rm -f mswindows/osgeo4w/package.log.*
+
 	log configure
-	LDFLAGS="-L$PWD/mswindows/osgeo4w/lib -lz" ./configure \
+	./configure \
 	        --host=$conf_host \
-		--with-libs="$PWD/mswindows/osgeo4w/lib "\
+		--with-libs="$OSGEO4W_ROOT/lib" \
 		--with-includes=$OSGEO4W_ROOT_MSYS/include \
                 --libexecdir=$OSGEO4W_ROOT_MSYS/bin \
                 --prefix=$OSGEO4W_ROOT_MSYS/apps/grass \
@@ -187,32 +198,40 @@ if ! [ -f mswindows/osgeo4w/configure-stamp ]; then
 		--enable-largefile \
 		--with-fftw \
 		--with-freetype \
+		--with-freetype-includes=/mingw${MINGW_POSTFIX}/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-postgres \
+		--with-postgres-includes=$OSGEO4W_ROOT_MSYS/include \
+		--with-postgres-libs=$PWD/mswindows/osgeo4w/lib \
 		--with-gdal=$PWD/mswindows/osgeo4w/gdal-config \
 		--with-geos=$PWD/mswindows/osgeo4w/geos-config \
 		--with-sqlite \
+		--with-sqlite-includes=$OSGEO4W_ROOT_MSYS/include \
+		--with-sqlite-libs=$PWD/mswindows/osgeo4w/lib \
 		--with-regex \
 		--with-nls \
-		--with-freetype-includes=$OSGEO4W_ROOT_MSYS/include/freetype2 \
 		--with-zstd \
 		--with-odbc \
 	        --with-cairo \
-                --with-postgres \
 	        --with-opengl=windows \
                 --with-bzlib $conf_opts
 # see #3047
-#	        --with-mysql 
+#	        --with-mysql
+
 	touch mswindows/osgeo4w/configure-stamp
 fi
 
-log make 
-make -k || ( cat error.log >&3 && false ) 
+
+log make
+make -k || ( cat error.log >&3 && false )
 
 log make install
 make install
 
 log cleanup
-rm -f diib*
+rm -f d*.o
 
 log prepare packaging
 mv $OSGEO4W_ROOT_MSYS/apps/grass/grass$POSTFIX/include/grass/config.h \
@@ -227,68 +246,46 @@ sed -e "s#@POSTFIX@#$POSTFIX#g" \
 sed -e "s#@POSTFIX@#$POSTFIX#g" -e "s#@VERSION@#$VERSION#g" -e "s#@GRASS_EXECUTABLE@#$GRASS_EXECUTABLE#g" \
     mswindows/osgeo4w/postinstall.bat >$OSGEO4W_ROOT_MSYS/etc/postinstall/grass${PACKAGE_POSTFIX}.bat
 sed -e "s#@POSTFIX@#$POSTFIX#g" -e "s#@VERSION@#$VERSION#g" -e "s#@GRASS_EXECUTABLE@#$GRASS_EXECUTABLE#g" \
-    mswindows/osgeo4w/preremove.bat >$OSGEO4W_ROOT_MSYS/etc/preremove/grass${PACKAGE_POSTFIX}.bat 
+    mswindows/osgeo4w/preremove.bat >$OSGEO4W_ROOT_MSYS/etc/preremove/grass${PACKAGE_POSTFIX}.bat
 
 if [ -n "$PACKAGE_PATCH" ]; then
-    log building vc libraries 
+    log building vc libraries
     OSGEO4W_POSTFIX=$OSGEO4W_POSTFIX sh \
-        mswindows/osgeo4w/mklibs.sh $OSGEO4W_ROOT_MSYS/apps/grass/grass$POSTFIX/lib/*.${MAJOR}.${MINOR}.dll 
+        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
     mkdir -p mswindows/osgeo4w/package
-    
+
     PDIR=$PWD/mswindows/osgeo4w/package
     SRC=$PWD
-    cd $OSGEO4W_ROOT_MSYS 
+    cd $OSGEO4W_ROOT_MSYS
 
     # update startup script
     sed -e "s#@POSTFIX@#$POSTFIX#g" \
 	$SRC/mswindows/osgeo4w/grass.bat.tmpl > bin/${GRASS_EXECUTABLE}.bat.tmpl
-    
+
     # bat files - unix2dos
     unix2dos bin/${GRASS_EXECUTABLE}.bat.tmpl
     unix2dos etc/postinstall/grass${PACKAGE_POSTFIX}.bat
     unix2dos etc/preremove/grass${PACKAGE_POSTFIX}.bat
-    
+
     # copy dependencies (TODO: to be reduced)
-    if [ "$MINGW_POSTFIX" = "64" ]; then
-	mingw_libgcc=libgcc_s_seh-1.dll
-    else
-	mingw_libgcc=libgcc_s_dw2-1.dll
-    fi
-    cp -uv /mingw${MINGW_POSTFIX}/bin/libintl-8.dll \
-        /mingw${MINGW_POSTFIX}/bin/libiconv-2.dll \
-	/mingw${MINGW_POSTFIX}/bin/libfontconfig-1.dll \
-	/mingw${MINGW_POSTFIX}/bin/$mingw_libgcc \
-	/mingw${MINGW_POSTFIX}/bin/libwinpthread-1.dll \
-	/mingw${MINGW_POSTFIX}/bin/libexpat-1.dll \
-	/mingw${MINGW_POSTFIX}/bin/libfreetype-6.dll \
-	/mingw${MINGW_POSTFIX}/bin/libbz2-1.dll \
-        /mingw${MINGW_POSTFIX}/bin/libharfbuzz-0.dll \
-	/mingw${MINGW_POSTFIX}/bin/libglib-2.0-0.dll \
-	/mingw${MINGW_POSTFIX}/bin/libpng16-16.dll \
-	/mingw${MINGW_POSTFIX}/bin/libsystre-0.dll \
-	/mingw${MINGW_POSTFIX}/bin/libtre-5.dll \
-	/mingw${MINGW_POSTFIX}/bin/libgraphite2.dll \
-	/mingw${MINGW_POSTFIX}/bin/libpcre-1.dll \
-        /mingw${MINGW_POSTFIX}/bin/zlib1.dll \
-        /mingw${MINGW_POSTFIX}/bin/libstdc++-6.dll \
-	apps/grass/grass$POSTFIX/bin
+    cp -uv $DLLS apps/grass/grass$POSTFIX/bin
     cp -uv /mingw${MINGW_POSTFIX}/etc/fonts/fonts.conf \
 	apps/grass/grass$POSTFIX/etc
-    
+
     # creating grass package
-    tar -cjf $PDIR/grass$PACKAGE_POSTFIX-$VERSION-$PACKAGE_PATCH.tar.bz2 \
+    /bin/tar -cjf $PDIR/grass$PACKAGE_POSTFIX-$VERSION-$PACKAGE_PATCH.tar.bz2 \
 	apps/grass/grass$POSTFIX \
 	bin/${GRASS_EXECUTABLE}.bat.tmpl \
 	etc/postinstall/grass${PACKAGE_POSTFIX}.bat \
 	etc/preremove/grass${PACKAGE_POSTFIX}.bat
-    
+
     # clean up
     rm bin/${GRASS_EXECUTABLE}.bat.tmpl
 fi
 
-log 
+log
 
 exit 0

+ 2 - 2
mswindows/osgeo4w/postinstall.bat

@@ -3,8 +3,8 @@ set BATCH=%OSGEO4W_ROOT%\bin\@GRASS_EXECUTABLE@.bat
 textreplace -std -t "%BATCH%"
 textreplace -std -t "%OSGEO4W_ROOT%"\apps\grass\grass-@POSTFIX@\etc\fontcap
 
-xxmklink "%OSGEO4W_STARTMENU%\GRASS GIS @VERSION@.lnk"       "%BATCH%"  "--gui" \ "Launch GRASS GIS @VERSION@" 1 "%ICON%" 
-xxmklink "%ALLUSERSPROFILE%\Desktop\GRASS GIS @VERSION@.lnk" "%BATCH%"  "--gui" \ "Launch GRASS GIS @VERSION@" 1 "%ICON%" 
+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

+ 1 - 1
mswindows/osgeo4w/preremove.bat

@@ -1,5 +1,5 @@
 del "%OSGEO4W_STARTMENU%\GRASS GIS @VERSION@.lnk"
-del "%ALLUSERSPROFILE%\Desktop\GRASS GIS @VERSION@.lnk"
+del "%OSGEO4W_DESKTOP%\GRASS GIS @VERSION@.lnk"
 
 del "%OSGEO4W_ROOT%\bin\@GRASS_EXECUTABLE@.bat"
 del "%OSGEO4W_ROOT%"\apps\grass\grass@POSTFIX@\etc\fontcap