Skip to content

Commit

Permalink
win: patch from OSGeo4W applied (OSGeo#4121)
Browse files Browse the repository at this point in the history
* patch from https://github.com/jef-n/OSGeo4W/blob/master/src/grass/osgeo4w/patch applied

* attempt to fix osgeo4w CI

* re-introduce mingw-w64-x86_64-libpng

* sync with osgeo4w patch

* add NumPy into deps in order to fix some tests

* CI(OSGeo4W): Sort OSGeo4W packages in a multiline list

* Add back matplotlib package

* style: Sort packages and configure flags in mswindows build scripts

* packaging: Removed changes from patch that was removed upstream

jef-n/OSGeo4W@c678c71

* packaging: Apply upstream patch update

jef-n/OSGeo4W@4bd721f

* packaging: Keep --with-libpng with libpng-config from repo

* CI: Split msys2 packages on multiple lines, using pacboy for environment-specific packages

* Remove DLL list as unused after applying latest patch

The dll files are copied with the following line, which doesn't need to use that list anymore

# copy dependencies
cp -uv $(/usr/bin/find apps/grass/grass$POSTFIX -iname "*.dll" -o -iname "*.exe" | PATH=$PWD/apps/grass/grass$POSTFIX/lib:$PWD/bin:/mingw64/bin:/usr/bin /usr/bin/xargs /usr/bin/ldd | /usr/bin/sed -ne 's#^.* => \(/mingw64/bin/.*\) (.*)$#\1#p' | /usr/bin/sort -u) apps/grass/grass$POSTFIX/bin

---------

Co-authored-by: Edouard Choinière <27212526+echoix@users.noreply.github.com>
Co-authored-by: Jürgen Fischer <jef@norbit.de>
  • Loading branch information
3 people authored Dec 15, 2024
1 parent 5e27d1a commit 161658b
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 69 deletions.
13 changes: 3 additions & 10 deletions .github/workflows/osgeo4w.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ jobs:
gcc
gettext
libiconv
libpng
libsystre
libtre-git
libwinpthread-git
Expand All @@ -72,20 +71,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 @@ -95,8 +89,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 All @@ -107,8 +102,6 @@ jobs:
- name: Compile GRASS GIS
shell: msys2 {0}
run: |
export CFLAGS="${CFLAGS} -pipe"
export CXXFLAGS="${CXXFLAGS} -pipe"
.github/workflows/build_osgeo4w.sh
- name: Print installed versions
Expand Down
5 changes: 4 additions & 1 deletion mswindows/osgeo4w/build_osgeo4w.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export C_INCLUDE_PATH=".:${OSGEO4W_ROOT_MSYS}/include:${SRC}/dist.${ARCH}/includ
export PYTHONHOME=${OSGEO4W_ROOT_MSYS}/apps/Python312
export ARCH=x86_64-w64-mingw32

CFLAGS="$CFLAGS -pipe" \
CXXFLAGS="$CXXFLAGS -pipe" \
./configure \
--bindir=${OSGEO4W_ROOT_MSYS}/bin \
--enable-largefile \
Expand All @@ -34,7 +36,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 +46,7 @@ export ARCH=x86_64-w64-mingw32
--with-includes=${OSGEO4W_ROOT_MSYS}/include \
--with-lapack \
--with-liblas=${SRC}/mswindows/osgeo4w/liblas-config \
--with-libpng=${SRC}/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
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
91 changes: 34 additions & 57 deletions mswindows/osgeo4w/package.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/bash
#!/bin/bash

set -e

PWD="$(pwd)"
export ARCH=x86_64-w64-mingw32
export SRC=$PWD

if ! [ -d mswindows ]; then
echo Start from GRASS toplevel dir
Expand Down Expand Up @@ -106,34 +107,6 @@ fi

exec 3>&1 > >(tee mswindows/osgeo4w/package.log) 2>&1

DLLS="
/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/libpcre-1.dll
/mingw64/bin/libpixman-1-0.dll
/mingw64/bin/libpng16-16.dll
/mingw64/bin/libquadmath-0.dll
/mingw64/bin/libstdc++-6.dll
/mingw64/bin/libsystre-0.dll
/mingw64/bin/libtre-5.dll
/mingw64/bin/libwinpthread-1.dll
/mingw64/bin/zlib1.dll
/mingw64/bin/libopenblas.dll
"

if ! [ -f mswindows/osgeo4w/configure-stamp ]; then
if [ -e include/Make/Platform.make ] ; then
log make distclean
Expand All @@ -143,52 +116,54 @@ if ! [ -f mswindows/osgeo4w/configure-stamp ]; then
log remove old logs
rm -f mswindows/osgeo4w/package.log.*

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/sqlite3_i.lib mswindows/osgeo4w/lib/sqlite3.lib


log configure
CFLAGS="$CFLAGS -pipe" \
CXXFLAGS="$CXXFLAGS -pipe" \
./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 \
--host=${ARCH} \
--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${SRC}/mswindows/osgeo4w/lib -lcairo" \
--with-cairo-libs=${OSGEO4W_ROOT_MSYS}/lib \
--with-cxx \
--with-fftw \
--with-freetype \
--with-freetype-includes=/mingw64/include/freetype2 \
--with-gdal=$PWD/mswindows/osgeo4w/gdal-config \
--with-geos=$PWD/mswindows/osgeo4w/geos-config \
--with-includes=$OSGEO4W_ROOT_MSYS/include \
--with-freetype-includes=${OSGEO4W_ROOT_MSYS}/include/freetype2 \
--with-gdal=${SRC}/mswindows/osgeo4w/gdal-config \
--with-geos=${SRC}/mswindows/osgeo4w/geos-config \
--with-includes=${OSGEO4W_ROOT_MSYS}/include \
--with-lapack \
--with-liblas=$PWD/mswindows/osgeo4w/liblas-config \
--with-libs="$OSGEO4W_ROOT_MSYS/lib" \
--with-liblas=${SRC}/mswindows/osgeo4w/liblas-config \
--with-libpng=${SRC}/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-readline \
--with-regex \
--with-sqlite \
--with-sqlite-includes=$OSGEO4W_ROOT_MSYS/include \
--with-sqlite-libs=$PWD/mswindows/osgeo4w/lib \
--with-sqlite-includes=${OSGEO4W_ROOT_MSYS}/include \
--with-sqlite-libs=${OSGEO4W_ROOT_MSYS}/lib \
--with-zstd \
--without-pdal \
--without-x
Expand Down Expand Up @@ -244,9 +219,11 @@ if [ -n "$PACKAGE_PATCH" ]; then
unix2dos etc/postinstall/grass${PACKAGE_POSTFIX}.bat
unix2dos etc/preremove/grass${PACKAGE_POSTFIX}.bat

# 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 dependencies
cp -uv $(/usr/bin/find apps/grass/grass$POSTFIX -iname "*.dll" -o -iname "*.exe" | PATH=$PWD/apps/grass/grass$POSTFIX/lib:$PWD/bin:/mingw64/bin:/usr/bin /usr/bin/xargs /usr/bin/ldd | /usr/bin/sed -ne 's#^.* => \(/mingw64/bin/.*\) (.*)$#\1#p' | /usr/bin/sort -u) apps/grass/grass$POSTFIX/bin

# copy R batch files
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

0 comments on commit 161658b

Please sign in to comment.