2020-11-25 17:43:49 +01:00
|
|
|
{ stdenv, fetchFromGitHub, fetchpatch, lib, enableUnfree ? false }:
|
2007-09-04 13:55:19 +02:00
|
|
|
|
2010-08-07 00:26:25 +02:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "p7zip";
|
2021-04-05 03:33:25 +02:00
|
|
|
version = "17.04";
|
2010-08-07 00:26:25 +02:00
|
|
|
|
2020-06-11 14:29:15 +02:00
|
|
|
src = fetchFromGitHub {
|
2021-07-11 18:20:38 +02:00
|
|
|
owner = "jinfeihan57";
|
2020-06-11 14:29:15 +02:00
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2022-03-16 14:38:47 +01:00
|
|
|
sha256 = {
|
|
|
|
free = "sha256-DrBuf2VPdcprHI6pMSmL7psm2ofOrUf0Oj0qwMjXzkk=";
|
|
|
|
unfree = "sha256-19F4hPV0nKVuFZNbOcXrcA1uW6Y3HQolaHVIYXGmh18=";
|
|
|
|
}.${if enableUnfree then "unfree" else "free"};
|
|
|
|
# remove the unRAR related code from the src drv
|
|
|
|
# > the license requires that you agree to these use restrictions,
|
|
|
|
# > or you must remove the software (source and binary) from your hard disks
|
|
|
|
# https://fedoraproject.org/wiki/Licensing:Unrar
|
2022-05-17 21:10:33 +02:00
|
|
|
postFetch = lib.optionalString (!enableUnfree) ''
|
2022-03-16 14:38:47 +01:00
|
|
|
rm -r $out/CPP/7zip/Compress/Rar*
|
|
|
|
find $out -name makefile'*' -exec sed -i '/Rar/d' {} +
|
|
|
|
'';
|
2020-11-25 17:43:49 +01:00
|
|
|
};
|
2020-12-21 19:01:38 +01:00
|
|
|
|
2017-04-07 22:51:23 +02:00
|
|
|
# Default makefile is full of impurities on Darwin. The patch doesn't hurt Linux so I'm leaving it unconditional
|
|
|
|
postPatch = ''
|
|
|
|
sed -i '/CC=\/usr/d' makefile.macosx_llvm_64bits
|
2021-10-09 10:14:41 +02:00
|
|
|
# Avoid writing timestamps into compressed manpages
|
|
|
|
# to maintain determinism.
|
|
|
|
substituteInPlace install.sh --replace 'gzip' 'gzip -n'
|
2020-07-18 22:40:14 +02:00
|
|
|
chmod +x install.sh
|
2017-04-07 22:51:23 +02:00
|
|
|
|
|
|
|
# I think this is a typo and should be CXX? Either way let's kill it
|
|
|
|
sed -i '/XX=\/usr/d' makefile.macosx_llvm_64bits
|
2021-01-15 10:19:50 +01:00
|
|
|
'' + lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
|
2018-10-12 14:36:48 +02:00
|
|
|
substituteInPlace makefile.machine \
|
|
|
|
--replace 'CC=gcc' 'CC=${stdenv.cc.targetPrefix}gcc' \
|
|
|
|
--replace 'CXX=g++' 'CXX=${stdenv.cc.targetPrefix}g++'
|
2017-04-07 22:51:23 +02:00
|
|
|
'';
|
|
|
|
|
2020-11-25 17:43:49 +01:00
|
|
|
makeFlags = [ "DEST_HOME=${placeholder "out"}" ];
|
|
|
|
|
2013-08-15 05:53:43 +02:00
|
|
|
preConfigure = ''
|
2020-11-25 17:43:49 +01:00
|
|
|
buildFlags=all3
|
2021-01-15 10:19:50 +01:00
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
2020-11-25 17:43:49 +01:00
|
|
|
cp makefile.macosx_llvm_64bits makefile.machine
|
|
|
|
'';
|
2007-09-06 22:45:36 +02:00
|
|
|
|
2012-10-05 22:06:35 +02:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2016-12-17 13:04:59 +01:00
|
|
|
setupHook = ./setup-hook.sh;
|
|
|
|
|
2021-01-15 10:19:50 +01:00
|
|
|
NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=c++11-narrowing";
|
2019-04-23 04:36:35 +02:00
|
|
|
|
2022-03-16 14:38:47 +01:00
|
|
|
passthru.updateScript = ./update.sh;
|
|
|
|
|
|
|
|
meta = with lib; {
|
2021-07-11 18:20:38 +02:00
|
|
|
homepage = "https://github.com/jinfeihan57/p7zip";
|
2020-06-11 14:29:15 +02:00
|
|
|
description = "A new p7zip fork with additional codecs and improvements (forked from https://sourceforge.net/projects/p7zip/)";
|
2022-03-16 14:38:47 +01:00
|
|
|
license = with licenses;
|
|
|
|
# p7zip code is largely lgpl2Plus
|
|
|
|
# CPP/7zip/Compress/LzfseDecoder.cpp is bsd3
|
|
|
|
[ lgpl2Plus /* and */ bsd3 ] ++
|
|
|
|
# and CPP/7zip/Compress/Rar* are unfree with the unRAR license restriction
|
|
|
|
# the unRAR compression code is disabled by default
|
|
|
|
lib.optionals enableUnfree [ unfree ];
|
|
|
|
maintainers = with maintainers; [ raskin jk ];
|
|
|
|
platforms = platforms.unix;
|
2021-04-27 19:28:44 +02:00
|
|
|
mainProgram = "7z";
|
2007-09-06 22:45:36 +02:00
|
|
|
};
|
2007-09-04 13:55:19 +02:00
|
|
|
}
|