mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-17 07:13:23 +01:00
_7zz: build on macOS
This commit is contained in:
parent
2458b102be
commit
d383e90ace
3 changed files with 55 additions and 18 deletions
|
@ -2,9 +2,9 @@
|
|||
, lib
|
||||
, fetchurl
|
||||
|
||||
# Only used for x86/x86_64
|
||||
# Only used for Linux's x86/x86_64
|
||||
, uasm
|
||||
, useUasm ? stdenv.hostPlatform.isx86
|
||||
, useUasm ? (stdenv.isLinux && stdenv.hostPlatform.isx86)
|
||||
|
||||
# RAR code is under non-free unRAR license
|
||||
# see the meta.license section below for more details
|
||||
|
@ -16,13 +16,13 @@
|
|||
}:
|
||||
|
||||
let
|
||||
inherit (stdenv.hostPlatform) system;
|
||||
platformSuffix = {
|
||||
aarch64-linux = "_arm64";
|
||||
i686-linux = "_x86";
|
||||
x86_64-linux = "_x64";
|
||||
}.${system} or
|
||||
(builtins.trace "`platformSuffix` not available for `${system}.` Making a generic `7zz` build." "");
|
||||
makefile = {
|
||||
aarch64-darwin = "../../cmpl_mac_arm64.mak";
|
||||
x86_64-darwin = "../../cmpl_mac_x64.mak";
|
||||
aarch64-linux = "../../cmpl_gcc_arm64.mak";
|
||||
i686-linux = "../../cmpl_gcc_x86.mak";
|
||||
x86_64-linux = "../../cmpl_gcc_x64.mak";
|
||||
}.${stdenv.hostPlatform.system} or "../../cmpl_gcc.mak"; # generic build
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "7zz";
|
||||
|
@ -51,27 +51,40 @@ stdenv.mkDerivation rec {
|
|||
'';
|
||||
};
|
||||
|
||||
sourceRoot = "CPP/7zip/Bundles/Alone2";
|
||||
sourceRoot = ".";
|
||||
|
||||
patches = [ ./fix-build-on-darwin.patch ];
|
||||
patchFlags = [ "-p0" ];
|
||||
|
||||
NIX_CFLAGS_COMPILE = lib.optionals stdenv.isDarwin [
|
||||
"-Wno-deprecated-copy-dtor"
|
||||
];
|
||||
|
||||
inherit makefile;
|
||||
|
||||
makeFlags =
|
||||
[
|
||||
"CC=${stdenv.cc.targetPrefix}cc"
|
||||
"CXX=${stdenv.cc.targetPrefix}c++"
|
||||
] ++
|
||||
lib.optionals useUasm [ "MY_ASM=uasm" ] ++
|
||||
]
|
||||
++ lib.optionals useUasm [ "MY_ASM=uasm" ]
|
||||
# We need at minimum 10.13 here because of utimensat, however since
|
||||
# we need a bump anyway, let's set the same minimum version as the one in
|
||||
# aarch64-darwin so we don't need additional changes for it
|
||||
++ lib.optionals stdenv.isDarwin [ "MACOSX_DEPLOYMENT_TARGET=10.16" ]
|
||||
# it's the compression code with the restriction, see DOC/License.txt
|
||||
lib.optionals (!enableUnfree) [ "DISABLE_RAR_COMPRESS=true" ];
|
||||
|
||||
makefile = "../../cmpl_gcc${platformSuffix}.mak";
|
||||
++ lib.optionals (!enableUnfree) [ "DISABLE_RAR_COMPRESS=true" ];
|
||||
|
||||
nativeBuildInputs = lib.optionals useUasm [ uasm ];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
preBuild = "cd CPP/7zip/Bundles/Alone2";
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
install -Dm555 -t $out/bin b/g${platformSuffix}/7zz
|
||||
install -Dm555 -t $out/bin b/*/7zz
|
||||
install -Dm444 -t $out/share/doc/${pname} ../../../../DOC/*.txt
|
||||
|
||||
runHook postInstall
|
||||
|
@ -96,7 +109,7 @@ stdenv.mkDerivation rec {
|
|||
# the unRAR compression code is disabled by default
|
||||
lib.optionals enableUnfree [ unfree ];
|
||||
maintainers = with maintainers; [ anna328p peterhoeg jk ];
|
||||
platforms = platforms.linux;
|
||||
platforms = platforms.unix;
|
||||
mainProgram = "7zz";
|
||||
};
|
||||
}
|
||||
|
|
24
pkgs/tools/archivers/7zz/fix-build-on-darwin.patch
Normal file
24
pkgs/tools/archivers/7zz/fix-build-on-darwin.patch
Normal file
|
@ -0,0 +1,24 @@
|
|||
diff -Naur CPP/7zip/Common/FileStreams.cpp CPP/7zip/Common/FileStreams.cpp
|
||||
--- CPP/7zip/Common/FileStreams.cpp
|
||||
+++ CPP/7zip/Common/FileStreams.cpp
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <pwd.h>
|
||||
|
||||
// for major()/minor():
|
||||
-#if defined(__FreeBSD__) || defined(BSD)
|
||||
+#if defined(__FreeBSD__) || defined(BSD) || defined(__APPLE__)
|
||||
#include <sys/types.h>
|
||||
#else
|
||||
#include <sys/sysmacros.h>
|
||||
diff -Naur CPP/7zip/UI/Common/UpdateCallback.cpp CPP/7zip/UI/Common/UpdateCallback.cpp
|
||||
--- CPP/7zip/UI/Common/UpdateCallback.cpp
|
||||
+++ CPP/7zip/UI/Common/UpdateCallback.cpp
|
||||
@@ -9,7 +9,7 @@
|
||||
// #include <pwd.h>
|
||||
|
||||
// for major()/minor():
|
||||
-#if defined(__FreeBSD__) || defined(BSD)
|
||||
+#if defined(__FreeBSD__) || defined(BSD) || defined(__APPLE__)
|
||||
#include <sys/types.h>
|
||||
#else
|
||||
#include <sys/sysmacros.h>
|
|
@ -995,7 +995,7 @@ with pkgs;
|
|||
|
||||
_6tunnel = callPackage ../tools/networking/6tunnel { };
|
||||
|
||||
_7zz = callPackage ../tools/archivers/7zz { };
|
||||
_7zz = darwin.apple_sdk_11_0.callPackage ../tools/archivers/7zz { };
|
||||
|
||||
_9pfs = callPackage ../tools/filesystems/9pfs { };
|
||||
|
||||
|
|
Loading…
Reference in a new issue