blob: 152ee99fcb1c46bd4f0aeae7b4602eb7be186efe (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
{ lib
, fetchFromGitHub
, llvmPackages_13
, makeBinaryWrapper
, libiconv
, MacOSX-SDK
, which
}:
let
llvmPackages = llvmPackages_13;
inherit (llvmPackages) stdenv;
in stdenv.mkDerivation rec {
pname = "odin";
version = "dev-2023-11";
src = fetchFromGitHub {
owner = "odin-lang";
repo = "Odin";
rev = version;
hash = "sha256-5plcr+j9aFSaLfLQXbG4WD1GH6rE7D3uhlUbPaDEYf8=";
};
nativeBuildInputs = [
makeBinaryWrapper which
];
buildInputs = lib.optional stdenv.isDarwin libiconv;
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
'';
dontConfigure = true;
buildFlags = [
"release"
];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp odin $out/bin/odin
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
'';
meta = with lib; {
description = "A fast, concise, readable, pragmatic and open sourced programming language";
homepage = "https://odin-lang.org/";
license = licenses.bsd3;
maintainers = with maintainers; [ luc65r astavie znaniye ];
platforms = platforms.x86_64 ++ [ "aarch64-darwin" ];
};
}
|