diff options
author | Thiago Kenji Okada <thiagokokada@gmail.com> | 2021-11-12 11:12:36 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-12 11:12:36 -0300 |
commit | 1cfd83e859002d1f053bb3abdee5cfa8aae95493 (patch) | |
tree | 23bb8b2879a0f7cb7bbac4ea990667dc9d1d6ae0 /pkgs/tools/archivers | |
parent | c6f83b3433c04c948d6990b02e0e2b32d89a48ef (diff) | |
parent | 6add5e065646a8e21460d2b5e546175063dfdc58 (diff) | |
download | nixpkgs-1cfd83e859002d1f053bb3abdee5cfa8aae95493.tar nixpkgs-1cfd83e859002d1f053bb3abdee5cfa8aae95493.tar.gz nixpkgs-1cfd83e859002d1f053bb3abdee5cfa8aae95493.tar.bz2 nixpkgs-1cfd83e859002d1f053bb3abdee5cfa8aae95493.tar.lz nixpkgs-1cfd83e859002d1f053bb3abdee5cfa8aae95493.tar.xz nixpkgs-1cfd83e859002d1f053bb3abdee5cfa8aae95493.tar.zst nixpkgs-1cfd83e859002d1f053bb3abdee5cfa8aae95493.zip |
Merge pull request #145444 from thiagokokada/build-unar-on-macosx
unar: make it build on Darwin
Diffstat (limited to 'pkgs/tools/archivers')
-rw-r--r-- | pkgs/tools/archivers/unar/default.nix | 70 |
1 files changed, 51 insertions, 19 deletions
diff --git a/pkgs/tools/archivers/unar/default.nix b/pkgs/tools/archivers/unar/default.nix index f3f7b32e119..5ce51fb0134 100644 --- a/pkgs/tools/archivers/unar/default.nix +++ b/pkgs/tools/archivers/unar/default.nix @@ -1,4 +1,17 @@ -{ lib, stdenv, fetchFromGitHub, installShellFiles, gnustep, bzip2, zlib, icu, openssl, wavpack }: +{ lib +, stdenv +, fetchFromGitHub +, installShellFiles +, gnustep +, bzip2 +, zlib +, icu +, openssl +, wavpack +, xcbuildHook +, Foundation +, AppKit +}: stdenv.mkDerivation rec { pname = "unar"; @@ -12,35 +25,54 @@ stdenv.mkDerivation rec { sha256 = "0p846q1l66k3rnd512sncp26zpv411b8ahi145sghfcsz9w8abc4"; }; - postPatch = '' - for f in Makefile.linux ../UniversalDetector/Makefile.linux ; do - substituteInPlace $f \ - --replace "= gcc" "=${stdenv.cc.targetPrefix}cc" \ - --replace "= g++" "=${stdenv.cc.targetPrefix}c++" \ - --replace "-DGNU_RUNTIME=1" "" \ - --replace "-fgnu-runtime" "-fobjc-nonfragile-abi" - done + postPatch = + if stdenv.isDarwin then '' + substituteInPlace "./XADMaster.xcodeproj/project.pbxproj" \ + --replace "libstdc++.6.dylib" "libc++.1.dylib" + '' else '' + for f in Makefile.linux ../UniversalDetector/Makefile.linux ; do + substituteInPlace $f \ + --replace "= gcc" "=${stdenv.cc.targetPrefix}cc" \ + --replace "= g++" "=${stdenv.cc.targetPrefix}c++" \ + --replace "-DGNU_RUNTIME=1" "" \ + --replace "-fgnu-runtime" "-fobjc-nonfragile-abi" + done - # we need to build inside this directory as well, so we have to make it writeable - chmod +w ../UniversalDetector -R - ''; + # we need to build inside this directory as well, so we have to make it writeable + chmod +w ../UniversalDetector -R + ''; - buildInputs = [ gnustep.base bzip2 icu openssl wavpack zlib ]; + buildInputs = [ bzip2 icu openssl wavpack zlib ] ++ + lib.optionals stdenv.isLinux [ gnustep.base ] ++ + lib.optionals stdenv.isDarwin [ Foundation AppKit ]; - nativeBuildInputs = [ gnustep.make installShellFiles ]; + nativeBuildInputs = [ installShellFiles ] ++ + lib.optionals stdenv.isLinux [ gnustep.make ] ++ + lib.optionals stdenv.isDarwin [ xcbuildHook ]; + + xcbuildFlags = lib.optionals stdenv.isDarwin [ + "-target unar" + "-target lsar" + "-configuration Release" + "MACOSX_DEPLOYMENT_TARGET=10.12" + # Fix "ld: file not found: /nix/store/*-clang-7.1.0/lib/arc/libarclite_macosx." error + # Disabling ARC may leak memory, however since this program is generally not used for + # long periods of time, it shouldn't be an issue + "CLANG_LINK_OBJC_RUNTIME=NO" + ]; + + makefile = lib.optionalString (!stdenv.isDarwin) "Makefile.linux"; enableParallelBuilding = true; dontConfigure = true; - makefile = "Makefile.linux"; - sourceRoot = "./source/XADMaster"; installPhase = '' runHook preInstall - install -Dm555 -t $out/bin lsar unar + install -Dm555 -t $out/bin ${lib.optionalString stdenv.isDarwin "Products/Release/"}{lsar,unar} for f in lsar unar; do installManPage ./Extra/$f.? installShellCompletion --bash --name $f ./Extra/$f.bash_completion @@ -60,7 +92,7 @@ stdenv.mkDerivation rec { ADF, DMS, LZX, PowerPacker, LBR, Squeeze, Crunch, and other old formats. ''; license = licenses.lgpl21Plus; - maintainers = with maintainers; [ peterhoeg ]; - platforms = platforms.linux; + maintainers = with maintainers; [ peterhoeg thiagokokada ]; + platforms = platforms.unix; }; } |