Merge pull request #145444 from thiagokokada/build-unar-on-macosx
unar: make it build on Darwin
This commit is contained in:
commit
1cfd83e859
@ -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;
|
||||
};
|
||||
}
|
||||
|
@ -10678,7 +10678,10 @@ with pkgs;
|
||||
inherit (chickenPackages_4) eggDerivation fetchegg;
|
||||
};
|
||||
|
||||
unar = callPackage ../tools/archivers/unar { stdenv = clangStdenv; };
|
||||
unar = callPackage ../tools/archivers/unar {
|
||||
inherit (darwin.apple_sdk.frameworks) Foundation AppKit;
|
||||
stdenv = clangStdenv;
|
||||
};
|
||||
|
||||
unp = callPackage ../tools/archivers/unp { };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user