Merge pull request #145444 from thiagokokada/build-unar-on-macosx

unar: make it build on Darwin

authored by Thiago Kenji Okada and committed by GitHub 1cfd83e8 c6f83b34

+55 -20
+51 -19
pkgs/tools/archivers/unar/default.nix
··· 1 - { lib, stdenv, fetchFromGitHub, installShellFiles, gnustep, bzip2, zlib, icu, openssl, wavpack }: 2 3 stdenv.mkDerivation rec { 4 pname = "unar"; ··· 12 sha256 = "0p846q1l66k3rnd512sncp26zpv411b8ahi145sghfcsz9w8abc4"; 13 }; 14 15 - postPatch = '' 16 - for f in Makefile.linux ../UniversalDetector/Makefile.linux ; do 17 - substituteInPlace $f \ 18 - --replace "= gcc" "=${stdenv.cc.targetPrefix}cc" \ 19 - --replace "= g++" "=${stdenv.cc.targetPrefix}c++" \ 20 - --replace "-DGNU_RUNTIME=1" "" \ 21 - --replace "-fgnu-runtime" "-fobjc-nonfragile-abi" 22 - done 23 24 - # we need to build inside this directory as well, so we have to make it writeable 25 - chmod +w ../UniversalDetector -R 26 - ''; 27 28 - buildInputs = [ gnustep.base bzip2 icu openssl wavpack zlib ]; 29 30 - nativeBuildInputs = [ gnustep.make installShellFiles ]; 31 32 enableParallelBuilding = true; 33 34 dontConfigure = true; 35 36 - makefile = "Makefile.linux"; 37 - 38 sourceRoot = "./source/XADMaster"; 39 40 installPhase = '' 41 runHook preInstall 42 43 - install -Dm555 -t $out/bin lsar unar 44 for f in lsar unar; do 45 installManPage ./Extra/$f.? 46 installShellCompletion --bash --name $f ./Extra/$f.bash_completion ··· 60 ADF, DMS, LZX, PowerPacker, LBR, Squeeze, Crunch, and other old formats. 61 ''; 62 license = licenses.lgpl21Plus; 63 - maintainers = with maintainers; [ peterhoeg ]; 64 - platforms = platforms.linux; 65 }; 66 }
··· 1 + { lib 2 + , stdenv 3 + , fetchFromGitHub 4 + , installShellFiles 5 + , gnustep 6 + , bzip2 7 + , zlib 8 + , icu 9 + , openssl 10 + , wavpack 11 + , xcbuildHook 12 + , Foundation 13 + , AppKit 14 + }: 15 16 stdenv.mkDerivation rec { 17 pname = "unar"; ··· 25 sha256 = "0p846q1l66k3rnd512sncp26zpv411b8ahi145sghfcsz9w8abc4"; 26 }; 27 28 + postPatch = 29 + if stdenv.isDarwin then '' 30 + substituteInPlace "./XADMaster.xcodeproj/project.pbxproj" \ 31 + --replace "libstdc++.6.dylib" "libc++.1.dylib" 32 + '' else '' 33 + for f in Makefile.linux ../UniversalDetector/Makefile.linux ; do 34 + substituteInPlace $f \ 35 + --replace "= gcc" "=${stdenv.cc.targetPrefix}cc" \ 36 + --replace "= g++" "=${stdenv.cc.targetPrefix}c++" \ 37 + --replace "-DGNU_RUNTIME=1" "" \ 38 + --replace "-fgnu-runtime" "-fobjc-nonfragile-abi" 39 + done 40 41 + # we need to build inside this directory as well, so we have to make it writeable 42 + chmod +w ../UniversalDetector -R 43 + ''; 44 45 + buildInputs = [ bzip2 icu openssl wavpack zlib ] ++ 46 + lib.optionals stdenv.isLinux [ gnustep.base ] ++ 47 + lib.optionals stdenv.isDarwin [ Foundation AppKit ]; 48 + 49 + nativeBuildInputs = [ installShellFiles ] ++ 50 + lib.optionals stdenv.isLinux [ gnustep.make ] ++ 51 + lib.optionals stdenv.isDarwin [ xcbuildHook ]; 52 + 53 + xcbuildFlags = lib.optionals stdenv.isDarwin [ 54 + "-target unar" 55 + "-target lsar" 56 + "-configuration Release" 57 + "MACOSX_DEPLOYMENT_TARGET=10.12" 58 + # Fix "ld: file not found: /nix/store/*-clang-7.1.0/lib/arc/libarclite_macosx." error 59 + # Disabling ARC may leak memory, however since this program is generally not used for 60 + # long periods of time, it shouldn't be an issue 61 + "CLANG_LINK_OBJC_RUNTIME=NO" 62 + ]; 63 64 + makefile = lib.optionalString (!stdenv.isDarwin) "Makefile.linux"; 65 66 enableParallelBuilding = true; 67 68 dontConfigure = true; 69 70 sourceRoot = "./source/XADMaster"; 71 72 installPhase = '' 73 runHook preInstall 74 75 + install -Dm555 -t $out/bin ${lib.optionalString stdenv.isDarwin "Products/Release/"}{lsar,unar} 76 for f in lsar unar; do 77 installManPage ./Extra/$f.? 78 installShellCompletion --bash --name $f ./Extra/$f.bash_completion ··· 92 ADF, DMS, LZX, PowerPacker, LBR, Squeeze, Crunch, and other old formats. 93 ''; 94 license = licenses.lgpl21Plus; 95 + maintainers = with maintainers; [ peterhoeg thiagokokada ]; 96 + platforms = platforms.unix; 97 }; 98 }
+4 -1
pkgs/top-level/all-packages.nix
··· 10678 inherit (chickenPackages_4) eggDerivation fetchegg; 10679 }; 10680 10681 - unar = callPackage ../tools/archivers/unar { stdenv = clangStdenv; }; 10682 10683 unp = callPackage ../tools/archivers/unp { }; 10684
··· 10678 inherit (chickenPackages_4) eggDerivation fetchegg; 10679 }; 10680 10681 + unar = callPackage ../tools/archivers/unar { 10682 + inherit (darwin.apple_sdk.frameworks) Foundation AppKit; 10683 + stdenv = clangStdenv; 10684 + }; 10685 10686 unp = callPackage ../tools/archivers/unp { }; 10687