@@ -0,0 +1,32 @@
1+{ stdenv
2+, fetchurl
3+, libffi
4+}:
5+stdenv.mkDerivation rec {
6+ pname = "copper";
7+ version = "4.4";
8+ src = fetchurl {
9+ url = "https://tibleiz.net/download/copper-${version}-src.tar.gz";
10+ sha256 = "1nf0bw143rjhd019yms3k6k531rahl8anidwh6bif0gm7cngfwfw";
11+ };
12+ buildInputs = [
13+ libffi
14+ ];
15+ postPatch = ''
16+ substituteInPlace Makefile --replace "-s scripts/" "scripts/"
17+ patchShebangs .
18+ '';
19+ buildPhase = ''
20+ make BACKEND=elf64 boot-elf64
21+ make BACKEND=elf64 COPPER=stage3/copper-elf64 copper-elf64
22+ '';
23+ installPhase = ''
24+ make BACKEND=elf64 install prefix=$out
25+ '';
26+ meta = with stdenv.lib; {
27+ description = "Simple imperative language, statically typed with type inference and genericity.";
28+ homepage = "https://tibleiz.net/copper/";
29+ license = licenses.bsd2;
30+ platforms = platforms.x86_64;
31+ };
32+}