nixpkgs/pkgs/development/compilers/odin/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

79 lines
1.7 KiB
Nix
Raw Normal View History

2021-06-25 13:16:59 +00:00
{ lib
, fetchFromGitHub
2023-06-15 14:49:35 +00:00
, llvmPackages_13
, makeBinaryWrapper
2021-06-25 13:16:59 +00:00
, libiconv
2023-06-15 14:49:35 +00:00
, MacOSX-SDK
, which
2021-06-25 13:16:59 +00:00
}:
let
2023-06-15 14:49:35 +00:00
llvmPackages = llvmPackages_13;
2021-06-25 13:16:59 +00:00
inherit (llvmPackages) stdenv;
in stdenv.mkDerivation rec {
pname = "odin";
2024-01-05 15:34:39 +00:00
version = "dev-2024-01";
2021-06-25 13:16:59 +00:00
src = fetchFromGitHub {
owner = "odin-lang";
repo = "Odin";
2023-06-15 14:49:35 +00:00
rev = version;
2024-01-05 15:34:39 +00:00
hash = "sha256-ufIpnibY7rd76l0Mh+qXYXkc8W3cuTJ1cbmj4SgSUis=";
2021-06-25 13:16:59 +00:00
};
nativeBuildInputs = [
makeBinaryWrapper which
2021-06-25 13:16:59 +00:00
];
buildInputs = lib.optional stdenv.isDarwin libiconv;
2023-06-15 14:49:35 +00:00
LLVM_CONFIG = "${llvmPackages.llvm.dev}/bin/llvm-config";
postPatch = lib.optionalString stdenv.isDarwin ''
sed -i src/main.cpp \
-e 's|-syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk|-syslibroot ${MacOSX-SDK}|'
'' + ''
sed -i build_odin.sh \
-e 's/^GIT_SHA=.*$/GIT_SHA=/' \
-e 's/LLVM-C/LLVM/' \
-e 's/framework System/lSystem/'
patchShebangs build_odin.sh
2021-06-25 13:16:59 +00:00
'';
dontConfigure = true;
buildFlags = [
"release"
];
installPhase = ''
runHook preInstall
2021-06-25 13:16:59 +00:00
mkdir -p $out/bin
cp odin $out/bin/odin
2023-06-15 14:49:35 +00:00
mkdir -p $out/share
cp -r core $out/share/core
cp -r vendor $out/share/vendor
wrapProgram $out/bin/odin \
--prefix PATH : ${lib.makeBinPath (with llvmPackages; [
bintools
llvm
clang
lld
])} \
--set-default ODIN_ROOT $out/share
runHook postInstall
2021-06-25 13:16:59 +00:00
'';
meta = with lib; {
description = "A fast, concise, readable, pragmatic and open sourced programming language";
homepage = "https://odin-lang.org/";
2023-06-15 14:49:35 +00:00
license = licenses.bsd3;
2023-11-08 21:09:07 +00:00
maintainers = with maintainers; [ luc65r astavie znaniye ];
2023-06-15 14:49:35 +00:00
platforms = platforms.x86_64 ++ [ "aarch64-darwin" ];
2021-06-25 13:16:59 +00:00
};
}