2021-01-15 22:18:51 +00:00
|
|
|
{ stdenv, fetchFromGitHub, fetchpatch, lib, enableUnfree ? false }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "p7zip";
|
2021-01-15 22:18:51 +00:00
|
|
|
version = "17.03";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-06-18 07:06:33 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "szcnick";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2021-01-15 22:18:51 +00:00
|
|
|
sha256 = "0zgpa90z5p30jbpqydiig1h8hn41c76n2x26rh8cc92xw72ni33d";
|
|
|
|
};
|
2021-01-05 17:05:55 +00:00
|
|
|
|
2020-04-24 23:36:52 +00: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
|
2020-08-20 17:08:02 +00:00
|
|
|
chmod +x install.sh
|
2020-04-24 23:36:52 +00: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 22:18:51 +00:00
|
|
|
'' + lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
|
2020-04-24 23:36:52 +00:00
|
|
|
substituteInPlace makefile.machine \
|
|
|
|
--replace 'CC=gcc' 'CC=${stdenv.cc.targetPrefix}gcc' \
|
|
|
|
--replace 'CXX=g++' 'CXX=${stdenv.cc.targetPrefix}g++'
|
|
|
|
'' + lib.optionalString (!enableUnfree) ''
|
|
|
|
# Remove non-free RAR source code
|
|
|
|
# (see DOC/License.txt, https://fedoraproject.org/wiki/Licensing:Unrar)
|
|
|
|
rm -r CPP/7zip/Compress/Rar*
|
|
|
|
find . -name makefile'*' -exec sed -i '/Rar/d' {} +
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
makeFlags = [ "DEST_HOME=${placeholder "out"}" ];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
preConfigure = ''
|
2021-01-15 22:18:51 +00:00
|
|
|
buildFlags=all3
|
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
|
|
|
cp makefile.macosx_llvm_64bits makefile.machine
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
setupHook = ./setup-hook.sh;
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=c++11-narrowing";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
meta = {
|
2020-06-18 07:06:33 +00:00
|
|
|
homepage = "https://github.com/szcnick/p7zip";
|
|
|
|
description = "A new p7zip fork with additional codecs and improvements (forked from https://sourceforge.net/projects/p7zip/)";
|
2021-01-15 22:18:51 +00:00
|
|
|
platforms = lib.platforms.unix;
|
|
|
|
maintainers = [ lib.maintainers.raskin ];
|
2020-04-24 23:36:52 +00:00
|
|
|
# RAR code is under non-free UnRAR license, but we remove it
|
|
|
|
license = if enableUnfree then lib.licenses.unfree else lib.licenses.lgpl2Plus;
|
|
|
|
};
|
|
|
|
}
|