From e468cd49c1ba380d22e8bdc572806291b5d00a42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D9=85=D9=87=D8=AF=D9=8A=20=D8=B4=D9=8A=D9=86=D9=88=D9=86?= =?UTF-8?q?=20=28Mehdi=20Chinoune=29?= Date: Mon, 6 May 2024 07:17:09 +0100 Subject: [PATCH] qgis: enable PDAL support --- .../005-fix-building-qgis-with-pdal.patch | 45 +++++++++++++++++++ mingw-w64-qgis/PKGBUILD | 27 ++++++----- 2 files changed, 60 insertions(+), 12 deletions(-) create mode 100644 mingw-w64-qgis/005-fix-building-qgis-with-pdal.patch diff --git a/mingw-w64-qgis/005-fix-building-qgis-with-pdal.patch b/mingw-w64-qgis/005-fix-building-qgis-with-pdal.patch new file mode 100644 index 0000000000..e2c9be224b --- /dev/null +++ b/mingw-w64-qgis/005-fix-building-qgis-with-pdal.patch @@ -0,0 +1,45 @@ +--- a/external/pdal_wrench/tile/tile.cpp ++++ b/external/pdal_wrench/tile/tile.cpp +@@ -51,7 +51,7 @@ std::vector directoryList(const std::string& dir) + fs::directory_iterator end; + while (it != end) + { +- files.push_back(untwine::fromNative(it->path())); ++ files.push_back(untwine::fromNative(it->path().string())); + it++; + } + } +--- a/external/untwine/untwine/Common.cpp ++++ b/external/untwine/untwine/Common.cpp +@@ -55,7 +55,11 @@ MapContext mapFile(const std::string& filename, bool readOnly, size_t pos, size_ + #ifndef _WIN32 + ctx.m_fd = ::open(filename.data(), readOnly ? O_RDONLY : O_RDWR); + #else ++#ifdef _MSC_VER + ctx.m_fd = ::_wopen(toNative(filename).data(), readOnly ? _O_RDONLY : _O_RDWR); ++#else ++ ctx.m_fd = ::_open(toNative(filename).data(), readOnly ? _O_RDONLY : _O_RDWR); ++#endif + #endif + + if (ctx.m_fd == -1) +@@ -129,7 +133,7 @@ std::vector directoryList(const std::string& dir) + fs::directory_iterator end; + while (it != end) + { +- files.push_back(untwine::fromNative(it->path())); ++ files.push_back(untwine::fromNative(it->path().string())); + it++; + } + } +--- a/external/untwine/untwine/Untwine.cpp ++++ b/external/untwine/untwine/Untwine.cpp +@@ -122,7 +122,7 @@ void cleanup(const std::string& dir, bool rmdir) + + } // namespace untwine + +-#ifdef _WIN32 ++#ifdef _MSC_VER + int wmain( int argc, wchar_t *argv[ ], wchar_t *envp[ ] ) + #else + int main(int argc, char *argv[]) diff --git a/mingw-w64-qgis/PKGBUILD b/mingw-w64-qgis/PKGBUILD index b92ef5e4b0..0c99ff1512 100644 --- a/mingw-w64-qgis/PKGBUILD +++ b/mingw-w64-qgis/PKGBUILD @@ -4,7 +4,7 @@ _realname=qgis pkgbase=mingw-w64-${_realname} pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}" pkgver=3.36.2 -pkgrel=1 +pkgrel=2 pkgdesc='Geographic Information System (GIS) that supports vector, raster & database formats (mingw-w64)' arch=('any') mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64') @@ -24,7 +24,7 @@ depends=("${MINGW_PACKAGE_PREFIX}-draco" "${MINGW_PACKAGE_PREFIX}-libzip" "${MINGW_PACKAGE_PREFIX}-netcdf" "${MINGW_PACKAGE_PREFIX}-opencl-icd" - #"${MINGW_PACKAGE_PREFIX}-pdal" + "${MINGW_PACKAGE_PREFIX}-pdal" "${MINGW_PACKAGE_PREFIX}-proj" "${MINGW_PACKAGE_PREFIX}-protobuf" "${MINGW_PACKAGE_PREFIX}-python-gdal" @@ -57,12 +57,14 @@ source=("https://qgis.org/downloads/${_realname}-$pkgver.tar.bz2" "001-fix-building-with-mingw-w64-clang.patch" "002-fix-settingstree-init-order-clang.patch" "003-fix-pyrcc-command.patch" - "004-fix-customwidgets-install.patch") + "004-fix-customwidgets-install.patch" + "005-fix-building-qgis-with-pdal.patch") sha256sums=('8c886ab59094d7ea7fff5c299173b969509b88d896880d2c5d818c400cee69a4' 'f805b861d4081299cb319e85ee8c4841942b6ad798e549be32280f65c04fcf6e' 'e880eef26fa06d8fae291346f87735e140145c2d65558fce69e480e303c629e2' 'c0f599996d90da55d1370f7144d545352d0075ca7876d4ade52c520b237ce318' - '216dc67ef707f2e918afb7d190c9ea75c11065dea0d23d11b94cab5d8463bac3') + '216dc67ef707f2e918afb7d190c9ea75c11065dea0d23d11b94cab5d8463bac3' + 'b582354d836a228e965cc18de9656493330dd1d44b1e9210a6466811eba59d51') apply_patch_with_msg() { for _patch in "$@" @@ -83,6 +85,10 @@ prepare() { apply_patch_with_msg \ 003-fix-pyrcc-command.patch \ 004-fix-customwidgets-install.patch + # https://github.com/PDAL/wrench/pull/35 + # https://github.com/hobuinc/untwine/pull/162 + apply_patch_with_msg \ + 005-fix-building-qgis-with-pdal.patch } build() { @@ -99,7 +105,7 @@ build() { _extra_config+=("-DWITH_QTWEBKIT=OFF") fi - CXXFLAGS+=" -DQWT_POLAR_VERSION=0x060200 -Wno-ignored-attributes" + CXXFLAGS+=" -Wno-ignored-attributes" MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \ ${MINGW_PREFIX}/bin/cmake \ -G"Ninja" \ @@ -113,15 +119,12 @@ build() { -DQGIS_PLUGIN_SUBDIR=lib/qgis/plugins \ -DQT_PLUGINS_DIR=share/qt5/plugins \ -DWITH_3D=ON \ - -DWITH_CUSTOM_WIDGETS=ON \ - -DWITH_QWTPOLAR=ON \ - -DQWTPOLAR_LIBRARY=${MINGW_PREFIX}/lib/libqwt-qt5.dll.a \ - -DQWTPOLAR_INCLUDE_DIR=${MINGW_PREFIX}/include/qwt-qt5 \ - -DWITH_INTERNAL_QWTPOLAR=OFF \ - -DENABLE_TESTS=OFF \ -DWITH_BINDINGS=ON \ + -DWITH_CUSTOM_WIDGETS=ON \ + -DWITH_PDAL=ON \ + -DWITH_QWTPOLAR=ON \ + -DENABLE_TESTS=OFF \ -DWITH_GRASS=OFF \ - -DWITH_PDAL=OFF \ -DHAS_KDE_QT5_PDF_TRANSFORM_FIX=TRUE \ -DHAS_KDE_QT5_SMALL_CAPS_FIX=TRUE \ -DHAS_KDE_QT5_FONT_STRETCH_FIX=TRUE \