From a99b61127e8e370b49dc872fc40b6a7aa9120c4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Mancilla?= Date: Sun, 21 Nov 2021 13:01:18 -0300 Subject: [PATCH] arj: fix build on darwin Fix wrong header for statfs function. Use gccStdenv to build with GCC on all systems. GCC is hardcoded in configure.in, but after setting CC_FOR_BUILD to cc to use Clang, the build fails anyway when running a post-compilation command: clang -DLOCALE=LANG_en -DLOCALE_DESC="\"en\"" -DPKGLIBDIR="\"/lib/arj\"" -D_UNIX -g -O2 -o darwin20.6.0/en/rs/arj/arj : darwin20.6.0/en/rs/arj/arj ./darwin20.6.0/en/rs/tools/join ./darwin20.6.0/en/rs/arj/arj ./darwin20.6.0/en/rs/arjsfxjr/arjsfxjr JOIN v 1.30 [26/04/2003] Not a part of any binary package! Copying .. done! ./darwin20.6.0/en/rs/tools/join ./darwin20.6.0/en/rs/arj/arj ./darwin20.6.0/en/rs/arjsfx/arjsfx JOIN v 1.30 [26/04/2003] Not a part of any binary package! Copying ... done! ./darwin20.6.0/en/rs/tools/join ./darwin20.6.0/en/rs/arj/arj ./darwin20.6.0/en/rs/arjsfxv/arjsfxv JOIN v 1.30 [26/04/2003] Not a part of any binary package! Copying ..... done! ./darwin20.6.0/en/rs/tools/join ./darwin20.6.0/en/rs/arj/arj ./darwin20.6.0/en/rs/sfxstub/sfxstub JOIN v 1.30 [26/04/2003] Not a part of any binary package! Copying . done! rm -f ./darwin20.6.0/en/rs/help.arj TZ=UTC0 ./darwin20.6.0/en/rs/arj/arj a ./darwin20.6.0/en/rs/help.arj -+ -t1f -2d -e -jm -jh65535 -jt -hdo200506231314 ./resource/en/arj?.txt ARJ32 v 3.10, Copyright (c) 1998-2004, ARJ Software Russia. Creating archive : ./darwin20.6.0/en/rs/help.arj Adding ./resource/en/arjl.txt 37.2% Adding ./resource/en/arjs.txt 47.3% Testing arjl.txt OK Testing arjs.txt OK 2 file(s) ./darwin20.6.0/en/rs/tools/join ./darwin20.6.0/en/rs/arj/arj ./darwin20.6.0/en/rs/help.arj JOIN v 1.30 [26/04/2003] Not a part of any binary package! Copying . done! ./darwin20.6.0/en/rs/tools/postproc darwin20.6.0/en/rs/arj/arj POSTPROC v 1.30 [17/01/2003] Not a part of any binary package! Patch not found make[1]: *** [GNUmakefile:398: darwin20.6.0/en/rs/arj/arj] Error 3 --- pkgs/tools/archivers/arj/default.nix | 5 +++++ pkgs/top-level/all-packages.nix | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pkgs/tools/archivers/arj/default.nix b/pkgs/tools/archivers/arj/default.nix index e09e390fa473..6f365e226e20 100644 --- a/pkgs/tools/archivers/arj/default.nix +++ b/pkgs/tools/archivers/arj/default.nix @@ -128,6 +128,11 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ autoreconfHook ]; + postPatch = lib.optionalString stdenv.isDarwin '' + substituteInPlace environ.c \ + --replace " #include " " #include " + ''; + preAutoreconf = '' cd gnu ''; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index cd03a1c72068..e459bd49f3fa 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1281,7 +1281,9 @@ with pkgs; argyllcms = callPackage ../tools/graphics/argyllcms {}; - arj = callPackage ../tools/archivers/arj { }; + arj = callPackage ../tools/archivers/arj { + stdenv = gccStdenv; + }; arp-scan = callPackage ../tools/misc/arp-scan { };