Unverified Commit 03e43b4a authored by Emily Trau's avatar Emily Trau Committed by GitHub
Browse files

Merge pull request #262744 from emilytrau/stage0-posix

Init non-bootstrap stage0-posix tools
parents 19770d11 cde691dd
Loading
Loading
Loading
Loading
+48 −0
Original line number Diff line number Diff line
{ lib
, stdenv
, fetchFromGitHub
, m2libc
, mescc-tools
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "m2-mesoplanet";
  version = "1.11.0";

  src = fetchFromGitHub {
    owner = "oriansj";
    repo = "M2-Mesoplanet";
    rev = "Release_${finalAttrs.version}";
    hash = "sha256-hE7xvX84q3tk0XakveYDJhrhfBnpoItQs456NCzFfws=";
  };

  # Don't use vendored M2libc
  postPatch = ''
    rmdir M2libc
    ln -s ${m2libc}/include/M2libc M2libc
  '';

  # Upstream overrides the optimisation to be -O0, which is incompatible with fortify. Let's disable it.
  hardeningDisable = [ "fortify" ];

  doCheck = true;
  checkTarget = "test";
  nativeCheckInputs = [ mescc-tools ];

  installPhase = ''
    runHook preInstall

    install -D bin/M2-Mesoplanet $out/bin/M2-Mesoplanet

    runHook postInstall
  '';

  meta = with lib; {
    description = "Macro Expander Saving Our m2-PLANET";
    homepage = "https://github.com/oriansj/M2-Mesoplanet";
    license = licenses.gpl3Only;
    maintainers = teams.minimal-bootstrap.members;
    inherit (m2libc.meta) platforms;
    mainProgram = "M2-Mesoplanet";
  };
})
+43 −0
Original line number Diff line number Diff line
{ lib
, stdenv
, fetchFromGitHub
, m2libc
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "m2-planet";
  version = "1.11.0";

  src = fetchFromGitHub {
    owner = "oriansj";
    repo = "M2-Planet";
    rev = "Release_${finalAttrs.version}";
    hash = "sha256-xVwUO67PlRiBj/YBnnTXFGh3jH470fcbaNjABoyYes4=";
  };

  # Don't use vendored M2libc
  postPatch = ''
    rmdir M2libc
    ln -s ${m2libc}/include/M2libc M2libc
  '';

  # Upstream overrides the optimisation to be -O0, which is incompatible with fortify. Let's disable it.
  hardeningDisable = [ "fortify" ];

  installPhase = ''
    runHook preInstall

    install -D bin/M2-Planet $out/bin/M2-Planet

    runHook postInstall
  '';

  meta = with lib; {
    description = "PLAtform NEutral Transpiler";
    homepage = "https://github.com/oriansj/M2-Planet";
    license = licenses.gpl3Only;
    maintainers = teams.minimal-bootstrap.members;
    inherit (m2libc.meta) platforms;
    mainProgram = "M2-Planet";
  };
})
+43 −0
Original line number Diff line number Diff line
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "m2libc";
  version = "unstable-2023-05-22";

  src = fetchFromGitHub {
    owner = "oriansj";
    repo = "M2libc";
    rev = "de7c75f144176c3b9be77695d9bf94440445aeae";
    hash = "sha256-248plvODhBRfmx7zOmf05ICbk8vzSbaceZJ0j+wPaAY=";
  };

  patches = [
    # # aarch64: syscall: mkdir -> mkdirat
    # https://github.com/oriansj/M2libc/pull/17
    (fetchpatch {
      url = "https://github.com/oriansj/M2libc/commit/ff7c3023b3ab6cfcffc5364620b25f8d0279e96b.patch";
      hash = "sha256-QAKddv4TixIQHpFa9SVu9fAkeKbzhQaxjaWzW2yJy7A=";
    })
  ];

  installPhase = ''
    runHook preInstall

    mkdir -p $out/include
    cp -r . $out/include/M2libc

    runHook postInstall
  '';

  meta = with lib; {
    description = "More standards compliant C library written in M2-Planet's C subset";
    homepage = "https://github.com/oriansj/m2libc";
    license = licenses.gpl3Only;
    maintainers = teams.minimal-bootstrap.members;
    platforms = [ "i686-linux" "x86_64-linux" "aarch64-linux" "riscv32-linux" "riscv64-linux" ];
  };
})
+40 −0
Original line number Diff line number Diff line
{ lib
, stdenv
, fetchFromGitHub
, m2libc
, perl
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "mescc-tools-extra";
  version = "1.3.0";

  src = fetchFromGitHub {
    owner = "oriansj";
    repo = "mescc-tools-extra";
    rev = "Release_${finalAttrs.version}";
    hash = "sha256-LS9Eq1z+OsDF7Jq0TfF4u8jEJ5bjcLZNfKtnpIbtG20=";
  };

  # Don't use vendored M2libc
  postPatch = ''
    rmdir M2libc
    ln -s ${m2libc}/include/M2libc M2libc
  '';

  enableParallelBuilding = true;

  doCheck = true;
  checkTarget = "test";
  nativeCheckInputs = [ perl ];

  installFlags = [ "PREFIX=$(out)" ];

  meta = with lib; {
    description = "Collection of tools written for use in bootstrapping";
    homepage = "https://github.com/oriansj/mescc-tools-extra";
    license = licenses.gpl3Only;
    maintainers = teams.minimal-bootstrap.members;
    inherit (m2libc.meta) platforms;
  };
})
+39 −0
Original line number Diff line number Diff line
{ lib
, stdenv
, fetchFromSavannah
, m2libc
, which
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "mescc-tools";
  version = "1.5.1";

  src = fetchFromSavannah {
    repo = "mescc-tools";
    rev = "Release_${finalAttrs.version}";
    hash = "sha256-jFDrmzsjKEQKOKlsch1ceWtzUhoJAJVyHjXGVhjE9/U=";
  };

  # Don't use vendored M2libc
  postPatch = ''
    rmdir M2libc
    ln -s ${m2libc}/include/M2libc M2libc
  '';

  enableParallelBuilding = true;

  doCheck = true;
  checkTarget = "test";
  nativeCheckInputs = [ which ];

  installFlags = [ "PREFIX=$(out)" ];

  meta = with lib; {
    description = "Collection of tools written for use in bootstrapping";
    homepage = "https://savannah.nongnu.org/projects/mescc-tools";
    license = licenses.gpl3Only;
    maintainers = teams.minimal-bootstrap.members;
    inherit (m2libc.meta) platforms;
  };
})