2021-10-07 02:43:19 +02:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, installShellFiles
|
|
|
|
, gnustep
|
|
|
|
, bzip2
|
|
|
|
, zlib
|
|
|
|
, icu
|
|
|
|
, openssl
|
|
|
|
, wavpack
|
|
|
|
, xcbuildHook
|
|
|
|
, Foundation
|
|
|
|
, AppKit
|
|
|
|
}:
|
2016-08-19 13:44:19 +02:00
|
|
|
|
2020-05-03 03:05:42 +02:00
|
|
|
stdenv.mkDerivation rec {
|
2016-08-19 13:44:19 +02:00
|
|
|
pname = "unar";
|
2020-05-03 03:05:42 +02:00
|
|
|
version = "1.10.7";
|
2018-01-18 08:26:15 +01:00
|
|
|
|
2020-05-03 03:05:42 +02:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "MacPaw";
|
|
|
|
# the unar repo contains a shallow clone of both XADMaster and universal-detector
|
|
|
|
repo = "unar";
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "0p846q1l66k3rnd512sncp26zpv411b8ahi145sghfcsz9w8abc4";
|
2016-08-19 13:44:19 +02:00
|
|
|
};
|
|
|
|
|
2021-10-07 02:43:19 +02:00
|
|
|
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" "" \
|
2022-10-20 13:19:43 +02:00
|
|
|
--replace "-fgnu-runtime" "-fobjc-runtime=gnustep-2.0"
|
2021-10-07 02:43:19 +02:00
|
|
|
done
|
2020-05-03 03:05:42 +02:00
|
|
|
|
2021-10-07 02:43:19 +02:00
|
|
|
# we need to build inside this directory as well, so we have to make it writeable
|
|
|
|
chmod +w ../UniversalDetector -R
|
|
|
|
'';
|
2016-08-19 13:44:19 +02:00
|
|
|
|
2021-10-07 02:43:19 +02:00
|
|
|
buildInputs = [ bzip2 icu openssl wavpack zlib ] ++
|
|
|
|
lib.optionals stdenv.isLinux [ gnustep.base ] ++
|
|
|
|
lib.optionals stdenv.isDarwin [ Foundation AppKit ];
|
2020-05-03 03:05:42 +02:00
|
|
|
|
2021-10-07 02:43:19 +02:00
|
|
|
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";
|
2020-05-03 03:05:42 +02:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
dontConfigure = true;
|
|
|
|
|
|
|
|
sourceRoot = "./source/XADMaster";
|
2016-08-19 13:44:19 +02:00
|
|
|
|
|
|
|
installPhase = ''
|
2018-01-18 08:26:15 +01:00
|
|
|
runHook preInstall
|
2016-08-19 13:44:19 +02:00
|
|
|
|
2021-10-07 02:43:19 +02:00
|
|
|
install -Dm555 -t $out/bin ${lib.optionalString stdenv.isDarwin "Products/Release/"}{lsar,unar}
|
2020-05-03 03:05:42 +02:00
|
|
|
for f in lsar unar; do
|
|
|
|
installManPage ./Extra/$f.?
|
|
|
|
installShellCompletion --bash --name $f ./Extra/$f.bash_completion
|
|
|
|
done
|
2018-01-18 08:26:15 +01:00
|
|
|
|
|
|
|
runHook postInstall
|
2016-08-19 13:44:19 +02:00
|
|
|
'';
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2020-05-03 03:05:42 +02:00
|
|
|
homepage = "https://theunarchiver.com";
|
2016-08-19 13:44:19 +02:00
|
|
|
description = "An archive unpacker program";
|
|
|
|
longDescription = ''
|
2021-07-17 20:55:28 +02:00
|
|
|
The Unarchiver is an archive unpacker program with support for the popular
|
|
|
|
zip, RAR, 7z, tar, gzip, bzip2, LZMA, XZ, CAB, MSI, NSIS, EXE, ISO, BIN,
|
|
|
|
and split file formats, as well as the old Stuffit, Stuffit X, DiskDouble,
|
|
|
|
Compact Pro, Packit, cpio, compress (.Z), ARJ, ARC, PAK, ACE, ZOO, LZH,
|
2018-01-18 08:26:15 +01:00
|
|
|
ADF, DMS, LZX, PowerPacker, LBR, Squeeze, Crunch, and other old formats.
|
2016-08-19 13:44:19 +02:00
|
|
|
'';
|
2020-05-03 03:05:42 +02:00
|
|
|
license = licenses.lgpl21Plus;
|
2021-10-07 02:43:19 +02:00
|
|
|
maintainers = with maintainers; [ peterhoeg thiagokokada ];
|
|
|
|
platforms = platforms.unix;
|
2016-08-19 13:44:19 +02:00
|
|
|
};
|
|
|
|
}
|