2021-10-01 09:20:50 +00:00
|
|
|
{ lib, stdenv, fetchurl, autoPatchelfHook, installShellFiles }:
|
|
|
|
|
|
|
|
let
|
2022-03-30 09:31:56 +00:00
|
|
|
version = "6.11";
|
|
|
|
downloadVersion = lib.replaceStrings [ "." ] [ "" ] version;
|
2021-10-04 12:37:57 +00:00
|
|
|
srcUrl = {
|
|
|
|
i686-linux = {
|
2022-03-30 09:31:56 +00:00
|
|
|
url = "https://www.rarlab.com/rar/rarlinux-x32-${downloadVersion}.tar.gz";
|
|
|
|
sha256 = "sha256-7mpKkOEspGskt9yfSDrdK7CieJ0AectJKTi8TxLnbtk=";
|
2021-10-04 12:37:57 +00:00
|
|
|
};
|
|
|
|
x86_64-linux = {
|
2022-03-30 09:31:56 +00:00
|
|
|
url = "https://www.rarlab.com/rar/rarlinux-x64-${downloadVersion}.tar.gz";
|
|
|
|
sha256 = "sha256-pb3QdLqdxIf3ybLfPao3MdilTHYjCB1BujYsTQuEMtE=";
|
|
|
|
};
|
|
|
|
aarch64-darwin = {
|
|
|
|
url = "https://www.rarlab.com/rar/rarmacos-arm-${downloadVersion}.tar.gz";
|
|
|
|
sha256 = "sha256-q2fC4w2/tJ+GaD3ETPP+V3SAApdlLDgr3eE2YcERQXA=";
|
2021-10-04 12:37:57 +00:00
|
|
|
};
|
|
|
|
x86_64-darwin = {
|
2022-03-30 09:31:56 +00:00
|
|
|
url = "https://www.rarlab.com/rar/rarmacos-x64-${downloadVersion}.tar.gz";
|
|
|
|
sha256 = "sha256-yHWxAscqnLKrG9Clsaiy6wSbyVz4gpvN6AjyirCmIKQ=";
|
2021-10-04 12:37:57 +00:00
|
|
|
};
|
|
|
|
}.${stdenv.system} or (throw "Unsupported system: ${stdenv.system}");
|
2021-10-01 09:20:50 +00:00
|
|
|
manSrc = fetchurl {
|
|
|
|
url = "https://aur.archlinux.org/cgit/aur.git/plain/rar.1?h=rar&id=8e39a12e88d8a3b168c496c44c18d443c876dd10";
|
|
|
|
name = "rar.1";
|
|
|
|
sha256 = "sha256-93cSr9oAsi+xHUtMsUvICyHJe66vAImS2tLie7nt8Uw=";
|
|
|
|
};
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "rar";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
src = fetchurl srcUrl;
|
|
|
|
|
|
|
|
dontBuild = true;
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
buildInputs = lib.optionals stdenv.isLinux [ stdenv.cc.cc.lib ];
|
2021-10-01 09:20:50 +00:00
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles ]
|
|
|
|
++ lib.optionals stdenv.isLinux [ autoPatchelfHook ];
|
2021-10-01 09:20:50 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
install -Dm755 {rar,unrar} -t "$out/bin"
|
|
|
|
install -Dm755 default.sfx -t "$out/lib"
|
|
|
|
install -Dm644 {acknow.txt,license.txt} -t "$out/share/doc/rar"
|
|
|
|
install -Dm644 rarfiles.lst -t "$out/etc"
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
installManPage ${manSrc}
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Utility for RAR archives";
|
|
|
|
homepage = "https://www.rarlab.com/";
|
|
|
|
license = licenses.unfree;
|
|
|
|
maintainers = with maintainers; [ thiagokokada ];
|
2021-10-04 12:37:57 +00:00
|
|
|
platforms = with platforms; linux ++ darwin;
|
2021-10-01 09:20:50 +00:00
|
|
|
};
|
|
|
|
}
|