2023-10-09 19:29:22 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchzip
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "unrar";
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "7.0.7";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
src = fetchzip {
|
|
|
|
url = "https://www.rarlab.com/rar/unrarsrc-${finalAttrs.version}.tar.gz";
|
|
|
|
stripRoot = false;
|
2024-04-21 15:54:59 +00:00
|
|
|
hash = "sha256-S7BMywydetDh1GINcK3k3fN9ciDoKTCAe/1tkgykoAQ=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
sourceRoot = finalAttrs.src.name;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postPatch = ''
|
2023-10-09 19:29:22 +00:00
|
|
|
substituteInPlace unrar/makefile \
|
2020-04-24 23:36:52 +00:00
|
|
|
--replace "CXX=" "#CXX=" \
|
|
|
|
--replace "STRIP=" "#STRIP=" \
|
|
|
|
--replace "AR=" "#AR="
|
|
|
|
'';
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
|
|
|
|
# `make {unrar,lib}` call `make clean` implicitly
|
|
|
|
# separate build into different dirs to avoid deleting them
|
2020-04-24 23:36:52 +00:00
|
|
|
buildPhase = ''
|
2023-10-09 19:29:22 +00:00
|
|
|
runHook preBuild
|
2021-10-01 09:20:50 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
cp -a unrar libunrar
|
|
|
|
make -C libunrar lib
|
|
|
|
make -C unrar -j1
|
2021-10-01 09:20:50 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
runHook postBuild
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2023-10-09 19:29:22 +00:00
|
|
|
runHook preInstall
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
install -Dm755 unrar/unrar -t $out/bin/
|
|
|
|
install -Dm644 unrar/{acknow.txt,license.txt} -t $out/share/doc/unrar/
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
install -Dm755 libunrar/libunrar.so -t $out/lib/
|
|
|
|
install -Dm644 libunrar/dll.hpp -t $dev/include/unrar/
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
runHook postInstall
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
setupHook = ./setup-hook.sh;
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Utility for RAR archives";
|
|
|
|
homepage = "https://www.rarlab.com/";
|
|
|
|
license = licenses.unfreeRedistributable;
|
2023-11-16 04:20:00 +00:00
|
|
|
mainProgram = "unrar";
|
2024-02-29 20:09:43 +00:00
|
|
|
maintainers = with maintainers; [ wegank ];
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
2023-10-09 19:29:22 +00:00
|
|
|
})
|