Unverified Commit d2943a89 authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

Merge pull request #316030 from atorres1985-contrib/bmake

bmake: 20240301 -> 20240520
parents 994e6bd2 894ea3e4
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
--- bmake/make-bootstrap.sh.in.orig     2019-02-19 10:55:21.733606117 -0800
+++ bmake/make-bootstrap.sh.in  2019-02-19 10:56:02.150771541 -0800
@@ -4,6 +4,7 @@
 
 srcdir=@srcdir@
 
+prefix="@prefix@"
 DEFAULT_SYS_PATH="@default_sys_path@"
 
 case "@use_meta@" in
+5 −5
Original line number Diff line number Diff line
diff -Naur bmake-old/boot-strap bmake-new/boot-strap
--- bmake-old/boot-strap	2023-06-27 18:02:19.000000000 -0300
+++ bmake-new/boot-strap	2023-07-23 22:31:02.334720661 -0300
@@ -413,9 +413,6 @@
--- bmake-old/boot-strap	2024-03-10 14:51:10.000000000 -0300
+++ bmake-new/boot-strap	2024-05-30 21:49:13.689803511 -0300
@@ -435,9 +435,6 @@
 	[ -s make-bootstrap.sh ] || op_configure
 	chmod 755 make-bootstrap.sh || exit 1
 	./make-bootstrap.sh || exit 1
-	case "$op" in
-	build) op_test;;
-	build) rm -f tested; op_test;;
-	esac
 }
 
 op_test() {
@@ -434,7 +431,6 @@
@@ -461,7 +458,6 @@
 }
 
 op_install() {
+56 −53
Original line number Diff line number Diff line
{ lib
, stdenv
, fetchurl
, getopt
, ksh
, bc
, tzdata
, pkgsMusl # for passthru.tests
{
  lib,
  bc,
  fetchurl,
  getopt,
  ksh,
  pkgsMusl,
  stdenv,
  tzdata,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "bmake";
  version = "20240301";
  version = "20240520";

  src = fetchurl {
    url = "http://www.crufty.net/ftp/pub/sjg/bmake-${finalAttrs.version}.tar.gz";
    hash = "sha256-JM4L46z8i5PHWgeWxi7swWN246fAVXCzAtIEgOOOn1k=";
    url = "https://www.crufty.net/ftp/pub/sjg/bmake-${finalAttrs.version}.tar.gz";
    hash = "sha256-IhDM1FWwCN95Ufbb00e/zBg3xGRzAU5LjdX/MJGuKJQ=";
  };

  patches = [
    # make bootstrap script aware of the prefix in /nix/store
    ./001-bootstrap-fix.diff
    # decouple tests from build phase
    ./002-dont-test-while-installing.diff
    # preserve PATH from build env in unit tests
@@ -28,6 +27,41 @@ stdenv.mkDerivation (finalAttrs: {
    ./004-unconditional-ksh-test.diff
  ];

  outputs = [ "out" "man" ];

  nativeBuildInputs = [ getopt ];

  nativeCheckInputs = [
    bc
    tzdata
  ] ++ lib.optionals (stdenv.hostPlatform.libc != "musl") [
    ksh
  ];

  # The generated makefile is a small wrapper for calling ./boot-strap with a
  # given op. On a case-insensitive filesystem this generated makefile clobbers
  # a distinct, shipped Makefile and causes infinite recursion during tests
  # which eventually fail with "fork: Resource temporarily unavailable"
  configureFlags = [
    "--without-makefile"
  ];

  # Disabled tests:
  # * directive-export{,-gmake}: another failure related to TZ variables
  # * opt-keep-going-indirect: not yet known
  # * varmod-localtime: musl doesn't support TZDIR and this test relies on
  #   impure, implicit paths
  env.BROKEN_TESTS = builtins.concatStringsSep " " [
    "directive-export"
    "directive-export-gmake"
    "opt-keep-going-indirect"
    "varmod-localtime"
  ];

  strictDeps = true;

  doCheck = true;

  # Make tests work with musl
  # * Disable deptgt-delete_on_error test (alpine does this too)
  # * Disable shell-ksh test (ksh doesn't compile with musl)
@@ -39,16 +73,6 @@ stdenv.mkDerivation (finalAttrs: {
    substituteInPlace unit-tests/opt-chdir.exp --replace "File name" "Filename"
  '';

  nativeBuildInputs = [ getopt ];

  # The generated makefile is a small wrapper for calling ./boot-strap with a
  # given op. On a case-insensitive filesystem this generated makefile clobbers
  # a distinct, shipped, Makefile and causes infinite recursion during tests
  # which eventually fail with "fork: Resource temporarily unavailable"
  configureFlags = [
    "--without-makefile"
  ];

  buildPhase = ''
    runHook preBuild

@@ -65,29 +89,6 @@ stdenv.mkDerivation (finalAttrs: {
    runHook postInstall
  '';

  doCheck = true;

  nativeCheckInputs = [
    bc
    tzdata
  ] ++ lib.optionals (stdenv.hostPlatform.libc != "musl") [
    ksh
  ];

  # Disabled tests:
  # directive-export{,-gmake}: another failure related to TZ variables
  # opt-chdir: ofborg complains about it somehow
  # opt-keep-going-indirect: not yet known
  # varmod-localtime: musl doesn't support TZDIR and this test relies on impure,
  # implicit paths
  env.BROKEN_TESTS = builtins.concatStringsSep " " [
    "directive-export"
    "directive-export-gmake"
    "opt-chdir" # works on my machine -- AndersonTorres
    "opt-keep-going-indirect"
    "varmod-localtime"
  ];

  checkPhase = ''
    runHook preCheck

@@ -96,22 +97,24 @@ stdenv.mkDerivation (finalAttrs: {
    runHook postCheck
  '';

  strictDeps = true;

  setupHook = ./setup-hook.sh;

  passthru.tests.bmakeMusl = pkgsMusl.bmake;
  passthru = {
    tests = {
      bmakeMusl = pkgsMusl.bmake;
    };
  };

  meta = {
    homepage = "http://www.crufty.net/help/sjg/bmake.html";
    homepage = "https://www.crufty.net/help/sjg/bmake.html";
    description = "Portable version of NetBSD 'make'";
    license = lib.licenses.bsd3;
    mainProgram = "bmake";
    maintainers = with lib.maintainers; [ thoughtpolice AndersonTorres ];
    platforms = lib.platforms.unix;
    # ofborg: x86_64-linux builds the musl package, aarch64-linux doesn't
    broken = stdenv.hostPlatform.isMusl && stdenv.buildPlatform.isAarch64;
    # requires strip
    badPlatforms = [ lib.systems.inspect.platformPatterns.isStatic ];
  };
})
# TODO: report the quirks and patches to bmake devteam (especially the Musl one)
# TODO: investigate Musl support
# TODO: investigate static support