Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

win: patch from OSGeo4W applied #4121

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions .github/workflows/osgeo4w.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
mingw-w64-x86_64-fftw mingw-w64-x86_64-openblas mingw-w64-x86_64-pkgconf
mingw-w64-x86_64-gcc mingw-w64-x86_64-ccache mingw-w64-x86_64-zlib mingw-w64-x86_64-libiconv
mingw-w64-x86_64-bzip2 mingw-w64-x86_64-gettext mingw-w64-x86_64-libsystre
mingw-w64-x86_64-libtre-git mingw-w64-x86_64-libwinpthread-git mingw-w64-x86_64-libpng
mingw-w64-x86_64-libtre-git mingw-w64-x86_64-libwinpthread-git
mingw-w64-x86_64-pcre

- name: Setup OSGeo4W environment
Expand All @@ -51,20 +51,15 @@ jobs:
package-dir: "D:/OSGeo4W_pkg"
packages: |
cairo-devel
fftw
freetype-devel
gdal-devel
gdal-ecw
gdal-mrsid
geos-devel
libjpeg-turbo-devel
liblas-devel
libpng-devel
libpq-devel
libtiff-devel
libxdr
netcdf-devel
pdal-devel
pdcurses
proj-devel
python3-core
python3-jupyter
Expand All @@ -74,8 +69,9 @@ jobs:
python3-ply
python3-pytest
python3-pywin32
python3-six
python3-wxpython
regex-devel
sqlite3-devel
zstd-devel

- name: Set number of cores for compilation
Expand Down
2 changes: 1 addition & 1 deletion include/Make/Grass.make
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ DSPFDEPS = $(GISLIB)
FORMDEPS = $(DBMILIB) $(GISLIB)
RASTER3DDEPS = $(RASTERLIB) $(GISLIB)
GISDEPS = $(DATETIMELIB) $(ZLIBLIBPATH) $(ZLIB) $(BZIP2LIBPATH) $(BZIP2LIB) $(ZSTDLIBPATH) $(ZSTDLIB) $(INTLLIB) $(REGEXLIBPATH) $(REGEXLIB) $(ICONVLIB) $(PTHREADLIBPATH) $(PTHREADLIB) $(MATHLIB)
GMATHDEPS = $(GISLIB) $(FFTWLIB) $(LAPACKLIB) $(BLASLIB) $(CCMATHLIB) $(OPENMP_CFLAGS) $(OPENMP_LIBPATH) $(OPENMP_LIB)
GMATHDEPS = $(GISLIB) $(FFTWLIB) $(LAPACKLIB) $(BLASLIB) $(CCMATHLIB) $(OPENMP_LIBPATH) $(OPENMP_LIB)
GPDEDEPS = $(RASTER3DLIB) $(RASTERLIB) $(GISLIB) $(GMATHLIB) $(OPENMP_LIBPATH) $(OPENMP_LIB) $(MATHLIB)
GPROJDEPS = $(GISLIB) $(GDALLIBS) $(PROJLIB) $(MATHLIB)
HTMLDRIVERDEPS = $(DRIVERLIB) $(GISLIB) $(MATHLIB)
Expand Down
2 changes: 1 addition & 1 deletion include/Make/Platform.make.in
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ USE_PTHREAD = @USE_PTHREAD@
#OpenMP
OPENMP_INCPATH = @OPENMP_INCPATH@
OPENMP_LIBPATH = @OPENMP_LIBPATH@
OPENMP_LIB = @OPENMP_LIB@
OPENMP_LIB = @OPENMP_CFLAGS@ @OPENMP_LIB@
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@OPENMP_CFLAGS@ shouldn't be needed to be added to OPENMP_LIB (?!), OPENMP_CFLAGS should be added to Makefiles that need it (via EXTRA_CFLAGS).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tested successfully locally without this change. There should be no need to add OPENMP_CFLAGS to OPENMP_LIB.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the contrary, I tried using the package.sh build on CI, more closer to OSGeo4W build, and I had some gomp errors: https://github.com/echoix/grass/actions/runs/10641753457/job/29503311365?pr=207#step:9:1864

OPENMP_CFLAGS = @OPENMP_CFLAGS@
USE_OPENMP = @USE_OPENMP@

Expand Down
3 changes: 2 additions & 1 deletion mswindows/osgeo4w/build_osgeo4w.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export ARCH=x86_64-w64-mingw32
--with-cairo \
--with-cairo-includes=${OSGEO4W_ROOT_MSYS}/include \
--with-cairo-ldflags="-L${SRC}/mswindows/osgeo4w/lib -lcairo" \
--with-cairo-libs=$OSGEO4W_ROOT_MSYS/lib \
--with-cairo-libs=${OSGEO4W_ROOT_MSYS}/lib \
--with-cxx \
--with-fftw \
--with-freetype \
Expand All @@ -44,6 +44,7 @@ export ARCH=x86_64-w64-mingw32
--with-includes=${OSGEO4W_ROOT_MSYS}/include \
--with-lapack \
--with-liblas=${SRC}/mswindows/osgeo4w/liblas-config \
--with-libpng=$PWD/mswindows/osgeo4w/libpng-config \
--with-libs="${OSGEO4W_ROOT_MSYS}/lib ${OSGEO4W_ROOT_MSYS}/bin" \
--with-netcdf=${OSGEO4W_ROOT_MSYS}/bin/nc-config \
--with-nls \
Expand Down
2 changes: 2 additions & 0 deletions mswindows/osgeo4w/env.bat.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ REM Uncomment if you want to use Bash instead of Cmd
REM Note that msys package must be also installed
REM set GRASS_SH=%OSGEO4W_ROOT%\apps\msys\bin\sh.exe

set PYTHONPATH=%OSGEO4W_ROOT%\apps\grass\grass@POSTFIX@\etc\python;%PYTHONPATH%
set GRASS_COMPATIBILITY_TEST=0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does this mean?

set GRASS_PYTHON=%OSGEO4W_ROOT%\bin\python3.exe
set GRASS_PROJSHARE=%OSGEO4W_ROOT%\share\proj

Expand Down
2 changes: 1 addition & 1 deletion mswindows/osgeo4w/libpng-config
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

prefix="${OSGEO4W_ROOT_MSYS}"
version="$(sed '/^#define PNG_LIBPNG_VER_STRING/!d; s/^[^"]*"\|"//g' ${prefix}/include/libpng*/png.h)"
dll_version="$(sed '/^#define PNG_LIBPNG_VER_DLLNUM/!d; s/^[^0-9]*\|[^0-9]*$//g' ${prefix}/include/libpng*/png.h)"
dll_version="$(sed '/^#define PNG_LIBPNG_VER_SHAREDLIB/!d; s/^[^0-9]*\|[^0-9]*$//g' ${prefix}/include/libpng*/png.h)"
exec_prefix="${prefix}"
libdir="${prefix}/lib"
includedir="${prefix}/include/libpng${dll_version}"
Expand Down
48 changes: 21 additions & 27 deletions mswindows/osgeo4w/package.sh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we document somewhere why and which DLL is needed to include in the winGRASS package? IIRC I was involved in a trial/error-way to check which of the DLLs we added finally back then.

Original file line number Diff line number Diff line change
Expand Up @@ -108,26 +108,17 @@ exec 3>&1 > >(tee mswindows/osgeo4w/package.log) 2>&1

DLLS="
/mingw64/bin/libblas.dll
/mingw64/bin/libbrotlicommon.dll
/mingw64/bin/libbrotlidec.dll
/mingw64/bin/libbz2-1.dll
/mingw64/bin/libcairo-2.dll
/mingw64/bin/libfftw3-3.dll
/mingw64/bin/libfontconfig-1.dll
/mingw64/bin/libfreetype-6.dll
/mingw64/bin/libgcc_s_seh-1.dll
/mingw64/bin/libgfortran-5.dll
/mingw64/bin/libglib-2.0-0.dll
/mingw64/bin/libgomp-1.dll
/mingw64/bin/libgraphite2.dll
/mingw64/bin/libharfbuzz-0.dll
/mingw64/bin/libiconv-2.dll
/mingw64/bin/libintl-8.dll
/mingw64/bin/liblapack.dll
/mingw64/bin/libpcre-1.dll
/mingw64/bin/libpixman-1-0.dll
/mingw64/bin/libpng16-16.dll
/mingw64/bin/libomp.dll
/mingw64/bin/libquadmath-0.dll
/mingw64/bin/libreadline8.dll
/mingw64/bin/libstdc++-6.dll
/mingw64/bin/libsystre-0.dll
/mingw64/bin/libtre-5.dll
Expand All @@ -148,45 +139,46 @@ if ! [ -f mswindows/osgeo4w/configure-stamp ]; then
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/sqlite3_i.lib mswindows/osgeo4w/lib/sqlite3.lib


log configure
./configure \
--bindir=$OSGEO4W_ROOT_MSYS/bin \
--bindir=${OSGEO4W_ROOT_MSYS}/bin \
--enable-largefile \
--enable-shared \
--host=x86_64-w64-mingw32 \
--includedir=$OSGEO4W_ROOT_MSYS/include \
--libexecdir=$OSGEO4W_ROOT_MSYS/bin \
--prefix=$OSGEO4W_ROOT_MSYS/apps/grass \
--includedir=${OSGEO4W_ROOT_MSYS}/include \
--libexecdir=${OSGEO4W_ROOT_MSYS}/bin \
--prefix=${OSGEO4W_ROOT_MSYS}/apps/grass \
--with-blas \
--with-bzlib \
--with-cairo \
--with-cairo-includes=$OSGEO4W_ROOT_MSYS/include \
--with-cairo-ldflags="-L$PWD/mswindows/osgeo4w/lib -lcairo -lfontconfig" \
--with-cairo-includes=${OSGEO4W_ROOT_MSYS}/include \
--with-cairo-ldflags="-L$PWD/mswindows/osgeo4w/lib -lcairo" \
--with-cxx \
--with-fftw \
--with-freetype \
--with-freetype-includes=/mingw64/include/freetype2 \
--with-freetype-includes=${OSGEO4W_ROOT_MSYS}/include/freetype2 \
--with-gdal=$PWD/mswindows/osgeo4w/gdal-config \
--with-geos=$PWD/mswindows/osgeo4w/geos-config \
--with-includes=$OSGEO4W_ROOT_MSYS/include \
--with-includes=${OSGEO4W_ROOT_MSYS}/include \
--with-lapack \
--with-lapack-includes=/mingw64/include \
--with-liblas=$PWD/mswindows/osgeo4w/liblas-config \
--with-libs="$OSGEO4W_ROOT_MSYS/lib" \
--with-libpng=$PWD/mswindows/osgeo4w/libpng-config \
--with-libs="${OSGEO4W_ROOT_MSYS}/lib ${OSGEO4W_ROOT_MSYS}/bin" \
--with-netcdf=${OSGEO4W_ROOT_MSYS}/bin/nc-config \
--with-nls \
--with-odbc \
--with-opengl=windows \
--with-openmp \
--with-postgres \
--with-postgres-includes=$OSGEO4W_ROOT_MSYS/include \
--with-postgres-libs=$PWD/mswindows/osgeo4w/lib \
--with-proj-includes=$OSGEO4W_ROOT_MSYS/include \
--with-proj-libs=$OSGEO4W_ROOT_MSYS/lib \
--with-proj-share=$OSGEO4W_ROOT_MSYS/share/proj \
--with-postgres-includes=${OSGEO4W_ROOT_MSYS}/include \
--with-postgres-libs=${OSGEO4W_ROOT_MSYS}/lib \
--with-proj-includes=${OSGEO4W_ROOT_MSYS}/include \
--with-proj-libs=${OSGEO4W_ROOT_MSYS}/lib \
--with-proj-share=${OSGEO4W_ROOT_MSYS}/share/proj \
--with-regex \
--with-sqlite \
--with-sqlite-includes=$OSGEO4W_ROOT_MSYS/include \
Expand Down Expand Up @@ -248,7 +240,9 @@ if [ -n "$PACKAGE_PATCH" ]; then

# copy dependencies (TODO: to be reduced)
cp -uv $DLLS apps/grass/grass$POSTFIX/bin
cp -uv /mingw64/etc/fonts/fonts.conf apps/grass/grass$POSTFIX/etc

# copy R batch files
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be checked whether we include these files already in another way, e.g. in the NSIS installer-

cp -uv $SRC/mswindows/external/rbatch/* apps/grass/grass$POSTFIX/bin

# creating grass package
/bin/tar -cjf $PDIR/grass$PACKAGE_POSTFIX-$VERSION-$PACKAGE_PATCH.tar.bz2 \
Expand Down
Loading