1{ cairo
2, cmake
3, fetchurl
4, freetype
5, gcc
6, git
7, gnumake
8, lib
9, libffi
10, libgit2
11, libpng
12, libuuid
13, makeBinaryWrapper
14, openssl
15, pixman
16, runtimeShell
17, SDL2
18, stdenv
19, unzip
20}:
21let
22 inherit (lib.strings) makeLibraryPath;
23 pharo-sources = fetchurl {
24 # It is necessary to download from there instead of from the repository because that archive
25 # also contains artifacts necessary for the bootstrapping.
26 url = "https://files.pharo.org/vm/pharo-spur64-headless/Linux-x86_64/source/PharoVM-10.0.8-b323c5f-Linux-x86_64-c-src.zip";
27 hash = "sha256-5IHymk6yl3pMLG3FeM4nqos0yLYMa3B2+hYW08Yo1V0=";
28 };
29 library_path = makeLibraryPath [
30 libgit2
31 SDL2
32 cairo
33 "$out"
34 ];
35in
36stdenv.mkDerivation {
37 pname = "pharo";
38 version = "10.0.8";
39 src = pharo-sources;
40
41 buildInputs = [
42 cairo
43 libgit2
44 libpng
45 pixman
46 SDL2
47 ];
48
49 nativeBuildInputs = [
50 cmake
51 freetype
52 gcc
53 git
54 gnumake
55 libffi
56 libuuid
57 makeBinaryWrapper
58 openssl
59 pixman
60 SDL2
61 unzip
62 ];
63
64 cmakeFlags = [
65 # Necessary to perform the bootstrapping without already having Pharo available.
66 "-DGENERATED_SOURCE_DIR=."
67 "-DALWAYS_INTERACTIVE=ON"
68 "-DBUILD_IS_RELEASE=ON"
69 "-DGENERATE_SOURCES=OFF"
70 # Prevents CMake from trying to download stuff.
71 "-DBUILD_BUNDLE=OFF"
72 ];
73
74 installPhase = ''
75 runHook preInstall
76
77 cmake --build . --target=install
78 mkdir -p "$out/lib"
79 mkdir "$out/bin"
80 cp build/vm/*.so* "$out/lib/"
81 cp build/vm/pharo "$out/bin/pharo"
82 patchelf --allowed-rpath-prefixes "$NIX_STORE" --shrink-rpath "$out/bin/pharo"
83 wrapProgram "$out/bin/pharo" --set LD_LIBRARY_PATH "${library_path}"
84
85 runHook postInstall
86 '';
87
88 meta = with lib; {
89 description = "Clean and innovative Smalltalk-inspired environment";
90 homepage = "https://pharo.org";
91 license = licenses.mit;
92 longDescription = ''
93 Pharo's goal is to deliver a clean, innovative, free open-source
94 Smalltalk-inspired environment. By providing a stable and small core
95 system, excellent dev tools, and maintained releases, Pharo is an
96 attractive platform to build and deploy mission critical applications.
97 '';
98 maintainers = [ ];
99 platforms = lib.platforms.linux;
100 };
101}