From 1d2d4ec8fa23ea40b7b70818c8bfad2dd4172268 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Thu, 9 Nov 2023 21:36:52 -0500 Subject: [PATCH 1/5] encfs: fix build with newer versions of clang Apply patch to resolve the following error: error: no matching constructor for initialization of 'std::shared_ptr' --- pkgs/tools/filesystems/encfs/default.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkgs/tools/filesystems/encfs/default.nix b/pkgs/tools/filesystems/encfs/default.nix index 14701a615c01..966c39682392 100644 --- a/pkgs/tools/filesystems/encfs/default.nix +++ b/pkgs/tools/filesystems/encfs/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchFromGitHub +{ lib, stdenv, fetchFromGitHub, fetchpatch , cmake, pkg-config, perl , gettext, fuse, openssl, tinyxml2 }: @@ -14,6 +14,15 @@ stdenv.mkDerivation rec { owner = "vgough"; }; + patches = lib.optionals stdenv.cc.isClang [ + # Fixes a build failure when building with newer versions of clang. + # https://github.com/vgough/encfs/pull/650 + (fetchpatch { + url = "https://github.com/vgough/encfs/commit/406b63bfe234864710d1d23329bf41d48001fbfa.patch"; + hash = "sha256-VunC5ICRJBgCXqkr7ad7DPzweRJr1bdOpo1LKNCs4zY="; + }) + ]; + buildInputs = [ gettext fuse openssl tinyxml2 ]; nativeBuildInputs = [ cmake pkg-config perl ]; From 58f06c41b5831cdd80e4bfc527387311de46b6ed Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Thu, 9 Nov 2023 23:24:02 -0500 Subject: [PATCH 2/5] grass: fix build on Darwin * Drop patch related to documentation installation. It fails to apply because the change was made upstream as of 8.0; and * Convert the port to an `unsigned int` as expected by the MySQL API. --- .../gis/grass/clang-integer-conversion.patch | 21 +++++++++++ pkgs/applications/gis/grass/default.nix | 9 +++-- .../gis/grass/no_symbolic_links.patch | 37 ------------------- pkgs/top-level/all-packages.nix | 4 +- 4 files changed, 29 insertions(+), 42 deletions(-) create mode 100644 pkgs/applications/gis/grass/clang-integer-conversion.patch delete mode 100644 pkgs/applications/gis/grass/no_symbolic_links.patch diff --git a/pkgs/applications/gis/grass/clang-integer-conversion.patch b/pkgs/applications/gis/grass/clang-integer-conversion.patch new file mode 100644 index 000000000000..85145f45c37d --- /dev/null +++ b/pkgs/applications/gis/grass/clang-integer-conversion.patch @@ -0,0 +1,21 @@ +diff -ur a/db/drivers/mysql/db.c b/db/drivers/mysql/db.c +--- a/db/drivers/mysql/db.c 1969-12-31 19:00:01.000000000 -0500 ++++ b/db/drivers/mysql/db.c 2023-11-09 23:26:25.329700495 -0500 +@@ -52,9 +52,16 @@ + + db_get_login2("mysql", name, &user, &password, &host, &port); + ++ const char* errstr; ++ unsigned int port_number = (unsigned int)strtonum(port, 0, 65536, &errstr); ++ if (errstr != NULL) { ++ db_d_append_error("%s", errstr); ++ return DB_FAILED; ++ } ++ + connection = mysql_init(NULL); + res = mysql_real_connect(connection, host, user, password, +- connpar.dbname, port, NULL, 0); ++ connpar.dbname, port_number, NULL, 0); + + if (res == NULL) { + db_d_append_error("%s\n%s", _("Connection failed."), diff --git a/pkgs/applications/gis/grass/default.nix b/pkgs/applications/gis/grass/default.nix index 0f250a80b970..cd0d6dbc9386 100644 --- a/pkgs/applications/gis/grass/default.nix +++ b/pkgs/applications/gis/grass/default.nix @@ -81,12 +81,13 @@ stdenv.mkDerivation (finalAttrs: { strictDeps = true; - # On Darwin the installer tries to symlink the help files into a system - # directory - patches = [ ./no_symbolic_links.patch ]; + patches = lib.optionals stdenv.isDarwin [ + # Fix conversion of const char* to unsigned int. + ./clang-integer-conversion.patch + ]; # Correct mysql_config query - patchPhase = '' + postPatch = '' substituteInPlace configure --replace "--libmysqld-libs" "--libs" ''; diff --git a/pkgs/applications/gis/grass/no_symbolic_links.patch b/pkgs/applications/gis/grass/no_symbolic_links.patch deleted file mode 100644 index ef09b97b7037..000000000000 --- a/pkgs/applications/gis/grass/no_symbolic_links.patch +++ /dev/null @@ -1,37 +0,0 @@ -diff --git a/include/Make/Install.make b/include/Make/Install.make -index 0aba138..8ba74bc 100644 ---- a/include/Make/Install.make -+++ b/include/Make/Install.make -@@ -116,11 +116,6 @@ real-install: | $(INST_DIR) $(UNIX_BIN) - -$(INSTALL) config.status $(INST_DIR)/config.status - -$(CHMOD) -R a+rX $(INST_DIR) 2>/dev/null - --ifneq ($(findstring darwin,$(ARCH)),) -- @# enable OSX Help Viewer -- @/bin/ln -sfh "$(INST_DIR)/docs/html" /Library/Documentation/Help/GRASS-$(GRASS_VERSION_MAJOR).$(GRASS_VERSION_MINOR) --endif -- - $(INST_DIR) $(UNIX_BIN): - $(MAKE_DIR_CMD) $@ - -diff --git a/macosx/app/build_html_user_index.sh b/macosx/app/build_html_user_index.sh -index 04e63eb..c9d9c2c 100755 ---- a/macosx/app/build_html_user_index.sh -+++ b/macosx/app/build_html_user_index.sh -@@ -140,7 +140,6 @@ else - # echo "$BASENAME $SHORTDESC" >> $FULLINDEX - # make them local to user to simplify page links - echo "$BASENAME $SHORTDESC" >> $FULLINDEX -- ln -sf "$HTMLDIRG/$i" global_$i - done - done - fi -@@ -183,8 +182,3 @@ echo " - " > $i.html - done - --# add Help Viewer links in user docs folder -- --mkdir -p $HOME/Library/Documentation/Help/ --ln -sfh ../../GRASS/$GRASS_MMVER/Modules/docs/html $HOME/Library/Documentation/Help/GRASS-$GRASS_MMVER-addon --ln -sfh $GISBASE/docs/html $HOME/Library/Documentation/Help/GRASS-$GRASS_MMVER diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6e9cc272b445..585aad18f234 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -30254,7 +30254,9 @@ with pkgs; dcw-gmt = callPackage ../applications/gis/gmt/dcw.nix { }; - grass = callPackage ../applications/gis/grass { }; + grass = callPackage ../applications/gis/grass { + stdenv = if stdenv.isDarwin then overrideSDK stdenv "11.0" else stdenv; + }; openorienteering-mapper = libsForQt5.callPackage ../applications/gis/openorienteering-mapper { }; From 3e7992ba67ff4d6424879f2636857866229c952c Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Thu, 9 Nov 2023 20:44:18 -0500 Subject: [PATCH 3/5] python3Packages.aggdraw: fix build with clang 16 Clang 16 defaults to C++17, which disallows the `register` storage class specifier. Upstream has fixed this on a maintenance branch, but it is not yet available in a release. --- pkgs/development/python-modules/aggdraw/default.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/development/python-modules/aggdraw/default.nix b/pkgs/development/python-modules/aggdraw/default.nix index 9d1e0ee96bab..ef44979c4394 100644 --- a/pkgs/development/python-modules/aggdraw/default.nix +++ b/pkgs/development/python-modules/aggdraw/default.nix @@ -1,5 +1,6 @@ { lib , fetchFromGitHub +, fetchpatch , buildPythonPackage , packaging , setuptools @@ -23,6 +24,14 @@ buildPythonPackage rec { hash = "sha256-2yajhuRyQ7BqghbSgPClW3inpw4TW2DhgQbomcRFx94="; }; + patches = [ + # Removes `register` storage class specifier, which is not allowed in C++17. + (fetchpatch { + url = "https://github.com/pytroll/aggdraw/commit/157ed49803567e8c3eeb7dfeff4c116db35747f7.patch"; + hash = "sha256-QSzpO90u5oSBWUzehRFbXgZ1ApEfLlfp11MUx6w11aI="; + }) + ]; + nativeBuildInputs = [ packaging setuptools From f409f152d226d488c402a9668fdbe41d8a47f4af Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Fri, 10 Nov 2023 00:07:56 -0500 Subject: [PATCH 4/5] python3Packages.mayavi: fix build with Python 3.11 and clang 16 * Apply a patch from upstream that adds Python 3.11 compatibility; and * Apply a patch that fixes an incompatible function pointer conversion. --- .../python-modules/mayavi/default.nix | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pkgs/development/python-modules/mayavi/default.nix b/pkgs/development/python-modules/mayavi/default.nix index bdc0a74007d8..1eebee06cfa5 100644 --- a/pkgs/development/python-modules/mayavi/default.nix +++ b/pkgs/development/python-modules/mayavi/default.nix @@ -3,6 +3,7 @@ , buildPythonPackage , envisage , fetchPypi +, fetchpatch , numpy , packaging , pyface @@ -26,6 +27,24 @@ buildPythonPackage rec { hash = "sha256-n0J+8spska542S02ibpr7KJMhGDicG2KHJuEKJrT/Z4="; }; + patches = [ + # Adds compatibility with Python 3.11. + # https://github.com/enthought/mayavi/pull/1199 + (fetchpatch { + name = "python311-compat.patch"; + url = "https://github.com/enthought/mayavi/commit/50c0cbfcf97560be69c84b7c924635a558ebf92f.patch"; + hash = "sha256-zZOT6on/f5cEjnDBrNGog/wPQh7rBkaFqrxkBYDUQu0="; + includes = [ "tvtk/src/*" ]; + }) + # Fixes an incompatible function pointer conversion error + # https://github.com/enthought/mayavi/pull/1266 + (fetchpatch { + name = "incompatible-pointer-conversion.patch"; + url = "https://github.com/enthought/mayavi/commit/887adc8fe2b076a368070f5b1d564745b03b1964.patch"; + hash = "sha256-88H1NNotd4pO0Zw1oLrYk5WNuuVrmTU01HJgsTRfKlo="; + }) + ]; + postPatch = '' # building the docs fails with the usual Qt xcb error, so skip: substituteInPlace setup.py \ From 7ba619345c243d219013d5835e875183e6fde25e Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Thu, 9 Nov 2023 22:01:57 -0500 Subject: [PATCH 5/5] vorbis-tools: fix build with clang 16 and on Darwin * Use iconv on Darwin to eliminate a call to undeclared function `charset_convert`; and * Applies a patch to fix a call to undeclared function `utf8_decode`. --- .../audio/vorbis-tools/default.nix | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/pkgs/applications/audio/vorbis-tools/default.nix b/pkgs/applications/audio/vorbis-tools/default.nix index 46e67c7dc33e..877f670d6861 100644 --- a/pkgs/applications/audio/vorbis-tools/default.nix +++ b/pkgs/applications/audio/vorbis-tools/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchurl, libogg, libvorbis, libao, pkg-config, curl +{ lib, stdenv, fetchurl, fetchpatch, libogg, libvorbis, libao, pkg-config, curl, libiconv , speex, flac , autoreconfHook }: @@ -11,12 +11,18 @@ stdenv.mkDerivation rec { sha256 = "1c7h4ivgfdyygz2hyh6nfibxlkz8kdk868a576qkkjgj5gn78xyv"; }; - nativeBuildInputs = [ autoreconfHook pkg-config ]; - buildInputs = [ libogg libvorbis libao curl speex flac ]; + patches = lib.optionals stdenv.cc.isClang [ + # Fixes a call to undeclared function `utf8_decode`. + # https://github.com/xiph/vorbis-tools/pull/33 + (fetchpatch { + url = "https://github.com/xiph/vorbis-tools/commit/8a645f78b45ae7e370c0dc2a52d0f2612aa6110b.patch"; + hash = "sha256-RkT9Xa0pRu/oO9E9qhDa17L0luWgYHI2yINIkPZanmI="; + }) + ]; - env = lib.optionalAttrs stdenv.cc.isClang { - NIX_CFLAGS_COMPILE = "-Wno-error=implicit-function-declaration"; - }; + nativeBuildInputs = [ autoreconfHook pkg-config ]; + buildInputs = [ libogg libvorbis libao curl speex flac ] + ++ lib.optionals stdenv.isDarwin [ libiconv ]; meta = with lib; { description = "Extra tools for Ogg-Vorbis audio codec";