From ce602086b5994df8496516e4e74b6eb0fc282ee8 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Mon, 18 Apr 2022 22:33:05 +0100 Subject: [PATCH 1/4] uasm: fix compilation on darwin --- pkgs/development/compilers/uasm/default.nix | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/uasm/default.nix b/pkgs/development/compilers/uasm/default.nix index bd4d61d698cb..a08e232c962e 100644 --- a/pkgs/development/compilers/uasm/default.nix +++ b/pkgs/development/compilers/uasm/default.nix @@ -14,9 +14,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 @@ -30,7 +44,7 @@ stdenv.mkDerivation rec { 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; }; From b2d35019c024fed6d0e3f8fa604492bbf58b3d5e Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Mon, 18 Apr 2022 22:55:43 +0100 Subject: [PATCH 2/4] _7zz: cross-compilation fixes --- pkgs/tools/archivers/7zz/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/tools/archivers/7zz/default.nix b/pkgs/tools/archivers/7zz/default.nix index 144a1b275926..79fe9a07c63a 100644 --- a/pkgs/tools/archivers/7zz/default.nix +++ b/pkgs/tools/archivers/7zz/default.nix @@ -50,6 +50,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" ]; From e277cf18e20f40b69a8a54af183b8218a7daa74a Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Mon, 18 Apr 2022 23:33:19 +0100 Subject: [PATCH 3/4] uasm: add testVersion --- pkgs/development/compilers/uasm/default.nix | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pkgs/development/compilers/uasm/default.nix b/pkgs/development/compilers/uasm/default.nix index a08e232c962e..7356175c87c4 100644 --- a/pkgs/development/compilers/uasm/default.nix +++ b/pkgs/development/compilers/uasm/default.nix @@ -1,4 +1,10 @@ -{ lib, stdenv, fetchFromGitHub, fetchpatch }: +{ lib +, stdenv +, fetchFromGitHub +, fetchpatch +, testVersion +, uasm +}: stdenv.mkDerivation rec { pname = "uasm"; @@ -41,6 +47,12 @@ 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"; From 21a40059dd8dd97d90941150854432b39f0445c0 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Tue, 19 Apr 2022 00:39:09 +0100 Subject: [PATCH 4/4] _7zz: useUasm only in x86 platforms `uasm` is x86 only. It seems that in `aarch64-linux` at least, the optimizing build is done without using any third-party tool (maybe using GCC's own assembly?). --- pkgs/tools/archivers/7zz/default.nix | 38 ++++++++++++++-------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/pkgs/tools/archivers/7zz/default.nix b/pkgs/tools/archivers/7zz/default.nix index 79fe9a07c63a..03c95378a0ae 100644 --- a/pkgs/tools/archivers/7zz/default.nix +++ b/pkgs/tools/archivers/7zz/default.nix @@ -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"; @@ -73,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";