From 35a1ca8a0a8fb680affc784c20415f47b067d296 Mon Sep 17 00:00:00 2001 From: Emily Date: Tue, 14 Sep 2021 02:06:56 +0100 Subject: [PATCH 1/6] darwin.trash: fix on aarch64-darwin None of these clang options should be necessary with the nixpkgs stdenv infrastructure, and the -arch was breaking Apple Silicon builds. --- pkgs/os-specific/darwin/trash/trash.diff | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/os-specific/darwin/trash/trash.diff b/pkgs/os-specific/darwin/trash/trash.diff index fa6edf98b3de..d96f6c9c4fef 100644 --- a/pkgs/os-specific/darwin/trash/trash.diff +++ b/pkgs/os-specific/darwin/trash/trash.diff @@ -7,7 +7,7 @@ index 5e4306f..9c975fc 100644 @echo ---- Compiling: @echo ====================================== - $(CC) -O2 -Wall -Wextra -Wpartial-availability -Wno-unguarded-availability -force_cpusubtype_ALL -mmacosx-version-min=10.7 -arch i386 -arch x86_64 -framework AppKit -framework ScriptingBridge -o $@ $(SOURCE_FILES) -+ $(CC) -O2 -Wall -Wextra -Wpartial-availability -Wno-unguarded-availability -force_cpusubtype_ALL -mmacosx-version-min=10.7 -arch x86_64 -framework AppKit -framework ScriptingBridge -o $@ $(SOURCE_FILES) ++ $(CC) -O2 -Wall -Wextra -Wpartial-availability -Wno-unguarded-availability -framework AppKit -framework ScriptingBridge -o $@ $(SOURCE_FILES) analyze: @echo From 83c4c7ea5b400ec19052d6aff08d1424bcd33504 Mon Sep 17 00:00:00 2001 From: Emily Date: Tue, 14 Sep 2021 03:09:55 +0100 Subject: [PATCH 2/6] rpm: fix on aarch64-darwin --- pkgs/tools/package-management/rpm/default.nix | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/package-management/rpm/default.nix b/pkgs/tools/package-management/rpm/default.nix index f942efe6dd7b..5e46a0336875 100644 --- a/pkgs/tools/package-management/rpm/default.nix +++ b/pkgs/tools/package-management/rpm/default.nix @@ -36,14 +36,20 @@ stdenv.mkDerivation rec { "--sharedstatedir=/com" ]; - # Small fixes for ndb on darwin - # https://github.com/rpm-software-management/rpm/pull/1465 patches = [ + # Small fixes for ndb on darwin + # https://github.com/rpm-software-management/rpm/pull/1465 (fetchpatch { name = "darwin-support.patch"; url = "https://github.com/rpm-software-management/rpm/commit/2d20e371d5e38f4171235e5c64068cad30bda557.patch"; sha256 = "0p3j5q5a4hl357maf7018k3826jhcpqg6wfrnccrkv30g0ayk171"; }) + # Fix build on aarch64-darwin + # https://github.com/rpm-software-management/rpm/pull/1775 + (fetchpatch { + url = "https://github.com/emilazy/rpm/commit/45120e756930b4787ea2e06fb8a9e623ea13f2f3.patch"; + sha256 = "0zzblwx9apxyjsri4cxd09y9b2hs57r2fck98939j1qgcwy732ar"; + }) ]; postPatch = '' From d9d051ecd9c8fa5d32644f41a695f4d95645a61d Mon Sep 17 00:00:00 2001 From: Emily Date: Tue, 14 Sep 2021 04:18:32 +0100 Subject: [PATCH 3/6] dash: use fetchpatch --- pkgs/shells/dash/default.nix | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pkgs/shells/dash/default.nix b/pkgs/shells/dash/default.nix index f044c41b73d6..fa954a4921cd 100644 --- a/pkgs/shells/dash/default.nix +++ b/pkgs/shells/dash/default.nix @@ -1,4 +1,11 @@ -{ lib, stdenv, buildPackages, autoreconfHook, fetchurl, libedit }: +{ lib +, stdenv +, buildPackages +, autoreconfHook +, fetchurl +, fetchpatch +, libedit +}: stdenv.mkDerivation rec { pname = "dash"; @@ -12,11 +19,11 @@ stdenv.mkDerivation rec { hardeningDisable = [ "format" ]; patches = [ - (fetchurl { + (fetchpatch { # Dash executes code when noexec ("-n") is specified # https://www.openwall.com/lists/oss-security/2020/11/11/3 url = "https://git.kernel.org/pub/scm/utils/dash/dash.git/patch/?id=29d6f2148f10213de4e904d515e792d2cf8c968e"; - sha256 = "08q90bx36ixwlcj331dh7420qyj8i0qh1cc1gljrhd83fhl9w0y5"; + sha256 = "0aadb7aaaan6jxmi6icv4p5gqx7k510yszaqsa29b5giyxz5l9i1"; }) ] ++ lib.optionals stdenv.isDarwin [ # Temporary fix until a proper one is accepted upstream From 1875c0312e2e4e58035b9e55a6783a4812c26514 Mon Sep 17 00:00:00 2001 From: Emily Date: Tue, 14 Sep 2021 04:19:17 +0100 Subject: [PATCH 4/6] dash: 0.5.11.2 -> 0.5.11.4 The readdir64/dirent64 patch was obsoleted by an upstream commit. --- .../0001-fix-dirent64-et-al-on-darwin.patch | 41 ------------------- pkgs/shells/dash/default.nix | 8 +--- 2 files changed, 2 insertions(+), 47 deletions(-) delete mode 100644 pkgs/shells/dash/0001-fix-dirent64-et-al-on-darwin.patch diff --git a/pkgs/shells/dash/0001-fix-dirent64-et-al-on-darwin.patch b/pkgs/shells/dash/0001-fix-dirent64-et-al-on-darwin.patch deleted file mode 100644 index f2e0802f7981..000000000000 --- a/pkgs/shells/dash/0001-fix-dirent64-et-al-on-darwin.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 7e75779eaeacdbb46a387a59d9aaf1481a1da3e5 Mon Sep 17 00:00:00 2001 -From: Adrian Gierakowski -Date: Sun, 19 Jul 2020 08:38:05 +0100 -Subject: [PATCH] fix dirent64 et al on darwin - ---- - configure.ac | 11 +++++++++++ - 1 file changed, 11 insertions(+) - -diff --git a/configure.ac b/configure.ac -index b8faca9..cee1e4d 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -139,6 +139,7 @@ if test "$ac_cv_func_signal" != yes; then - [klibc has bsd_signal instead of signal])]) - fi - -+dnl TODO: stat64 is deprecated since macOS 10.6 - dnl Check for stat64 (dietlibc/klibc). - AC_CHECK_FUNC(stat64,, [ - AC_DEFINE(fstat64, fstat, [64-bit operations are the same as 32-bit]) -@@ -155,6 +156,16 @@ AC_CHECK_FUNC(open64,, [ - AC_DEFINE(open64, open, [64-bit operations are the same as 32-bit]) - ]) - -+dnl OS X apparently has stat64 but not readdir64. -+AC_CHECK_FUNC(readdir64,, [ -+ AC_DEFINE(readdir64, readdir, [64-bit operations are the same as 32-bit]) -+]) -+ -+dnl OS X apparently has stat64 but not dirent64. -+AC_CHECK_TYPE(struct dirent64,, [ -+ AC_DEFINE(dirent64, dirent, [64-bit operations are the same as 32-bit]) -+],[#include ]) -+ - dnl Check if struct stat has st_mtim. - AC_MSG_CHECKING(for stat::st_mtim) - AC_COMPILE_IFELSE( --- -2.15.1 - diff --git a/pkgs/shells/dash/default.nix b/pkgs/shells/dash/default.nix index fa954a4921cd..0a6eb556a97a 100644 --- a/pkgs/shells/dash/default.nix +++ b/pkgs/shells/dash/default.nix @@ -9,11 +9,11 @@ stdenv.mkDerivation rec { pname = "dash"; - version = "0.5.11.2"; + version = "0.5.11.4"; src = fetchurl { url = "http://gondor.apana.org.au/~herbert/dash/files/${pname}-${version}.tar.gz"; - sha256 = "0pvdpm1cgfbc25ramn4305a0158yq031q1ain4dc972rnxl7vyq0"; + sha256 = "13g06zqfy4n7jkrbb5l1vw0xcnjvq76i16al8fjc5g33afxbf5af"; }; hardeningDisable = [ "format" ]; @@ -25,13 +25,9 @@ stdenv.mkDerivation rec { url = "https://git.kernel.org/pub/scm/utils/dash/dash.git/patch/?id=29d6f2148f10213de4e904d515e792d2cf8c968e"; sha256 = "0aadb7aaaan6jxmi6icv4p5gqx7k510yszaqsa29b5giyxz5l9i1"; }) - ] ++ lib.optionals stdenv.isDarwin [ - # Temporary fix until a proper one is accepted upstream - ./0001-fix-dirent64-et-al-on-darwin.patch ]; depsBuildBuild = [ buildPackages.stdenv.cc ]; - nativeBuildInputs = lib.optional stdenv.isDarwin autoreconfHook; buildInputs = [ libedit ]; configureFlags = [ "--with-libedit" ]; From a04e858da4b111636f758f01e1ddc726780b1e52 Mon Sep 17 00:00:00 2001 From: Emily Date: Tue, 14 Sep 2021 04:19:46 +0100 Subject: [PATCH 5/6] dash: fix on aarch64-darwin --- pkgs/shells/dash/default.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/shells/dash/default.nix b/pkgs/shells/dash/default.nix index 0a6eb556a97a..2a0d73145607 100644 --- a/pkgs/shells/dash/default.nix +++ b/pkgs/shells/dash/default.nix @@ -25,8 +25,17 @@ stdenv.mkDerivation rec { url = "https://git.kernel.org/pub/scm/utils/dash/dash.git/patch/?id=29d6f2148f10213de4e904d515e792d2cf8c968e"; sha256 = "0aadb7aaaan6jxmi6icv4p5gqx7k510yszaqsa29b5giyxz5l9i1"; }) + + # aarch64-darwin fix from upstream; remove on next release + (fetchpatch { + url = "https://git.kernel.org/pub/scm/utils/dash/dash.git/patch/?id=6f6d1f2da03468c0e131fdcbdcfa9771ffca2614"; + sha256 = "16iz2ylkyhpxqq411ns8pjk8rizh6afhavvsf052wvzsnmmlvfbw"; + }) ]; + # configure.ac patched; remove on next release + nativeBuildInputs = [ autoreconfHook ]; + depsBuildBuild = [ buildPackages.stdenv.cc ]; buildInputs = [ libedit ]; From 9d3086d862fe10508c1e5685125d3fe0ab308b51 Mon Sep 17 00:00:00 2001 From: Emily Date: Tue, 14 Sep 2021 04:30:39 +0100 Subject: [PATCH 6/6] jwhois: fix on aarch64-darwin This is somewhat of a hack, and other packages are certainly affected by this issue (e.g. assh runs into it in some cgo code), but at least this documents a workaround in-tree and gets one more package building now. --- pkgs/tools/networking/jwhois/default.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/tools/networking/jwhois/default.nix b/pkgs/tools/networking/jwhois/default.nix index 5a79a09281c3..025169a9fd35 100644 --- a/pkgs/tools/networking/jwhois/default.nix +++ b/pkgs/tools/networking/jwhois/default.nix @@ -18,6 +18,11 @@ stdenv.mkDerivation rec { makeFlags = [ "AR=${stdenv.cc.bintools.targetPrefix}ar" ]; + # Work around error from on aarch64-darwin: + # error: 'TARGET_OS_IPHONE' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_] + # TODO: this should probably be fixed at a lower level than this? + NIX_CFLAGS_COMPILE = lib.optional stdenv.isDarwin "-Wno-undef-prefix"; + meta = { description = "A client for the WHOIS protocol allowing you to query the owner of a domain name"; homepage = "https://www.gnu.org/software/jwhois/";