Merge pull request #169232 from thiagokokada/fix-uasm-macos

uasm: fix compilation on darwin; _7zz: cross-compilation fixes
This commit is contained in:
Thiago Kenji Okada 2022-04-19 09:11:30 +01:00 committed by GitHub
commit 58e6c134cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 52 additions and 22 deletions

View file

@ -1,4 +1,10 @@
{ lib, stdenv, fetchFromGitHub, fetchpatch }:
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, testVersion
, uasm
}:
stdenv.mkDerivation rec {
pname = "uasm";
@ -14,9 +20,23 @@ stdenv.mkDerivation rec {
sha256 = "sha256-CIbHPKJa60SyJeFgF1Tux7RfJZBChhUVXR7HGa+gCtQ=";
};
patches = lib.optionals stdenv.isDarwin [
(fetchpatch {
name = "fix-v2_55-compilation-on-macos.patch";
url = "https://github.com/Terraspace/UASM/commit/b50c430cc3083c7f32e288a9f64fe1cafb03091d.patch";
sha256 = "sha256-FGFB282LSEKtGD1cIRH+Qi5bye5Gx4xb0Ty4J03xjCU";
})
];
enableParallelBuilding = true;
makefile = "gccLinux64.mak";
makefile =
if stdenv.isDarwin then
"ClangOSX64.mak"
else
"gccLinux64.mak";
makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" ];
installPhase = ''
runHook preInstall
@ -27,10 +47,16 @@ stdenv.mkDerivation rec {
runHook postInstall
'';
passthru.tests.version = testVersion {
package = uasm;
command = "uasm -h";
version = "v${version}";
};
meta = with lib; {
homepage = "http://www.terraspace.co.uk/uasm.html";
description = "A free MASM-compatible assembler based on JWasm";
platforms = platforms.linux;
platforms = platforms.unix;
maintainers = with maintainers; [ thiagokokada ];
license = licenses.watcom;
};

View file

@ -2,23 +2,27 @@
, lib
, fetchurl
# Only used for x86/x86_64
, uasm
, useUasm ? stdenv.isLinux
, useUasm ? stdenv.hostPlatform.isx86
# RAR code is under non-free unRAR license
# see the meta.license section below for more details
, enableUnfree ? false
# For tests
, _7zz
, testVersion
}:
let
inherit (stdenv.hostPlatform) system;
platformSuffix =
lib.optionalString useUasm {
aarch64-linux = "_arm64";
i686-linux = "_x86";
x86_64-linux = "_x64";
}.${system} or
(builtins.trace "7zz's ASM optimizations not available for `${system}`. Building without optimizations." "");
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." "");
in
stdenv.mkDerivation rec {
pname = "7zz";
@ -50,6 +54,10 @@ stdenv.mkDerivation rec {
sourceRoot = "CPP/7zip/Bundles/Alone2";
makeFlags =
[
"CC=${stdenv.cc.targetPrefix}cc"
"CXX=${stdenv.cc.targetPrefix}c++"
] ++
lib.optionals useUasm [ "MY_ASM=uasm" ] ++
# it's the compression code with the restriction, see DOC/License.txt
lib.optionals (!enableUnfree) [ "DISABLE_RAR_COMPRESS=true" ];
@ -69,17 +77,13 @@ stdenv.mkDerivation rec {
runHook postInstall
'';
doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
$out/bin/7zz --help | grep ${version}
runHook postInstallCheck
'';
passthru.updateScript = ./update.sh;
passthru = {
updateScript = ./update.sh;
tests.version = testVersion {
package = _7zz;
command = "7zz --help";
};
};
meta = with lib; {
description = "Command line archiver utility";