nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 129 lines 3.6 kB view raw
1{ 2 lib, 3 clangStdenv, 4 callPackage, 5 fetchFromGitHub, 6}: 7 8let 9 irFile = 10 if clangStdenv.hostPlatform.system == "x86_64-linux" then 11 "linux-amd64.cpp" 12 else if clangStdenv.hostPlatform.system == "aarch64-linux" then 13 "linux-arm64.cpp" 14 else if clangStdenv.hostPlatform.system == "i686-linux" then 15 "linux-i386.cpp" 16 else if clangStdenv.hostPlatform.system == "x86_64-darwin" then 17 "darwin-amd64.cpp" 18 else if clangStdenv.hostPlatform.system == "aarch64-darwin" then 19 "darwin-arm64.cpp" 20 else 21 throw "Unsupported platform: ${clangStdenv.hostPlatform.system}"; 22in 23clangStdenv.mkDerivation (finalAttrs: { 24 pname = "julec"; 25 version = "0.1.7"; 26 27 src = fetchFromGitHub { 28 owner = "julelang"; 29 repo = "jule"; 30 tag = "jule${finalAttrs.version}"; 31 name = "jule-${finalAttrs.version}"; 32 hash = "sha256-7py8QrNMX8LwpI7LCp5XgRFUzgltFP1rTbuzqw/1D8o="; 33 }; 34 35 irSrc = fetchFromGitHub { 36 owner = "julelang"; 37 repo = "julec-ir"; 38 # revision determined by the upstream commit hash in julec-ir/README.md 39 rev = "81ddbed06a715428a90d3645f7242fa4e522ea16"; 40 name = "jule-ir-${finalAttrs.version}"; 41 hash = "sha256-Az9RDrwRY2kuMgL/Lf/x6YctfySr96/imWZeOa+J/rM="; 42 }; 43 44 dontConfigure = true; 45 46 unpackPhase = '' 47 runHook preUnpack 48 49 cp -R ${finalAttrs.src}/* . 50 cp "${finalAttrs.irSrc}/src/${irFile}" ./ir.cpp 51 52 chmod +w -R . 53 54 find ./*/* -type f -name '*.md' -exec rm -f {} + 55 56 runHook postUnpack 57 ''; 58 59 buildPhase = '' 60 runHook preBuild 61 62 echo "Building ${finalAttrs.meta.mainProgram}-bootstrap v${finalAttrs.version} for ${clangStdenv.hostPlatform.system}..." 63 mkdir -p bin 64 ${clangStdenv.cc.targetPrefix}c++ ir.cpp \ 65 --std=c++17 \ 66 -Wno-everything \ 67 -fwrapv \ 68 -ffloat-store \ 69 -fno-fast-math \ 70 -fno-rounding-math \ 71 -ffp-contract=fast \ 72 -fexcess-precision=standard \ 73 -DNDEBUG \ 74 -fomit-frame-pointer \ 75 -fno-strict-aliasing \ 76 -o "bin/${finalAttrs.meta.mainProgram}-bootstrap" 77 78 echo "Building ${finalAttrs.meta.mainProgram} v${finalAttrs.version} for ${clangStdenv.hostPlatform.system}..." 79 bin/${finalAttrs.meta.mainProgram}-bootstrap build \ 80 -p \ 81 --opt L2 \ 82 -o "bin/${finalAttrs.meta.mainProgram}" \ 83 "src/${finalAttrs.meta.mainProgram}" 84 85 runHook postBuild 86 ''; 87 88 installPhase = '' 89 runHook preInstall 90 91 mkdir -p $out/lib/jule 92 mkdir -p $out/bin 93 cp -R api $out/lib/jule/api 94 cp -R std $out/lib/jule/std 95 cp -R bin $out/lib/jule/bin 96 ln -s $out/lib/jule/bin/${finalAttrs.meta.mainProgram} $out/bin/${finalAttrs.meta.mainProgram} 97 98 runHook postInstall 99 ''; 100 101 passthru = { 102 # see doc/hooks/julec.section.md 103 hook = callPackage ./hook.nix { julec = finalAttrs.finalPackage; }; 104 tests.hello-jule = callPackage ./test { julec = finalAttrs.finalPackage; }; 105 }; 106 107 meta = { 108 description = "Jule Programming Language Compiler"; 109 longDescription = '' 110 Jule is an effective programming language designed to build efficient, fast, reliable and safe software while maintaining simplicity. 111 It is a statically typed, compiled language with a syntax influenced by Go, Rust, and C++. 112 ''; 113 homepage = "https://jule.dev"; 114 changelog = "https://github.com/julelang/manual/releases/tag/jule${finalAttrs.version}"; 115 license = lib.licenses.bsd3; 116 platforms = [ 117 "x86_64-linux" 118 "aarch64-linux" 119 "i686-linux" 120 "x86_64-darwin" 121 "aarch64-darwin" 122 ]; 123 mainProgram = "julec"; 124 maintainers = with lib.maintainers; [ 125 koi 126 sebaguardian 127 ]; 128 }; 129})