Unverified Commit cd74270a authored by Philip Taron's avatar Philip Taron Committed by GitHub
Browse files

julec: init at 0.1.3 (#379891)

parents 99c96428 8579b431
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -579,6 +579,17 @@
    githubId = 50264672;
    name = "Adam Freeth";
  };
  adamperkowski = {
    name = "Adam Perkowski";
    email = "adas1per@protonmail.com";
    matrix = "@xx0a_q:matrix.org";
    github = "adamperkowski";
    githubId = 75480869;
    keys = [
      { fingerprint = "00F6 1623 FB56 BC5B B709  4E63 4CE6 C117 2DF6 BE79"; }
      { fingerprint = "5A53 0832 DA91 20B0 CA57  DDB6 7CBD B58E CF1D 3478"; }
    ];
  };
  adamt = {
    email = "mail@adamtulinius.dk";
    github = "adamtulinius";
@@ -21424,6 +21435,11 @@
    githubId = 19472270;
    name = "Sebastian";
  };
  sebaguardian = {
    name = "Sebaguardian";
    github = "Sebaguardian";
    githubId = 68247013;
  };
  sebastianblunt = {
    name = "Sebastian Blunt";
    email = "nix@sebastianblunt.com";
+110 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchFromGitHub,
}:

let
  irFile =
    if stdenv.hostPlatform.system == "x86_64-linux" then
      "linux-amd64.cpp"
    else if stdenv.hostPlatform.system == "aarch64-linux" then
      "linux-arm64.cpp"
    else if stdenv.hostPlatform.system == "i686-linux" then
      "linux-i386.cpp"
    else if stdenv.hostPlatform.system == "x86_64-darwin" then
      "darwin-amd64.cpp"
    else if stdenv.hostPlatform.system == "aarch64-darwin" then
      "darwin-arm64.cpp"
    else
      throw "Unsupported platform: ${stdenv.hostPlatform.system}";
in
stdenv.mkDerivation (finalAttrs: {
  pname = "julec";
  version = "0.1.3";

  src = fetchFromGitHub {
    owner = "julelang";
    repo = "jule";
    tag = "jule${finalAttrs.version}";
    name = "jule-${finalAttrs.version}";
    hash = "sha256-hFWoGeTmfXIPcICWXa5W36QDOk3yB7faORxFaM9shcQ=";
  };

  irSrc = fetchFromGitHub {
    owner = "julelang";
    repo = "julec-ir";
    # revision determined by the upstream commit hash in julec-ir/README.md
    rev = "a274782922e4275c4a036d63acffd3369dbc382f";
    name = "jule-ir-${finalAttrs.version}";
    hash = "sha256-TXMSXTGTzZntPUhT6QTmn3nD2k855ZoAW9aQWyhrE8s=";
  };

  dontConfigure = true;

  unpackPhase = ''
    runHook preUnpack

    cp -R ${finalAttrs.src}/* .
    cp "${finalAttrs.irSrc}/src/${irFile}" ./ir.cpp

    chmod +w -R .

    find ./*/* -type f -name '*.md' -exec rm -f {} +

    runHook postUnpack
  '';

  buildPhase = ''
    runHook preBuild

    echo "Building ${finalAttrs.meta.mainProgram} v${finalAttrs.version} for ${stdenv.hostPlatform.system}..."
    mkdir -p bin
    ${stdenv.cc.targetPrefix}c++ ir.cpp \
      --std=c++17 \
      -Wno-everything \
      -O3 \
      -flto \
      -DNDEBUG \
      -fomit-frame-pointer \
      -o "bin/${finalAttrs.meta.mainProgram}"

    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall

    mkdir -p $out/lib/jule
    mkdir -p $out/bin
    cp -R api $out/lib/jule/api
    cp -R std $out/lib/jule/std
    cp -R bin $out/lib/jule/bin
    ln -s $out/lib/jule/bin/${finalAttrs.meta.mainProgram} $out/bin/${finalAttrs.meta.mainProgram}

    runHook postInstall
  '';

  meta = {
    description = "Jule Programming Language Compiler";
    longDescription = ''
      Jule is an effective programming language designed to build efficient, fast, reliable and safe software while maintaining simplicity.
      It is a statically typed, compiled language with a syntax influenced by Go, Rust, and C++.
    '';
    homepage = "https://jule.dev";
    changelog = "https://github.com/julelang/manual/releases/tag/jule${finalAttrs.version}";
    license = lib.licenses.bsd3;
    platforms = [
      "x86_64-linux"
      "aarch64-linux"
      "i686-linux"
      "x86_64-darwin"
      "aarch64-darwin"
    ];
    mainProgram = "julec";
    maintainers = with lib.maintainers; [
      adamperkowski
      sebaguardian
    ];
  };
})