about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/pharo/default.nix
blob: 6e83a31d5dd519e59a5d2b565371b23ffb07a0fa (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
{ cairo
, cmake
, fetchurl
, freetype
, gcc
, git
, gnumake
, lib
, libffi
, libgit2
, libpng
, libuuid
, makeBinaryWrapper
, openssl
, pixman
, runtimeShell
, SDL2
, stdenv
, unzip
}:
let
  inherit (lib.strings) makeLibraryPath;
  pharo-sources = fetchurl {
    # It is necessary to download from there instead of from the repository because that archive
    # also contains artifacts necessary for the bootstrapping.
    url = "https://files.pharo.org/vm/pharo-spur64-headless/Linux-x86_64/source/PharoVM-10.0.5-2757766-Linux-x86_64-c-src.zip";
    hash = "sha256-i6WwhdVdyzmqGlx1Fn12mCq5+HnRORT65HEiJo0joCE=";
  };
  library_path = makeLibraryPath [
    libgit2
    SDL2
    cairo
    "$out"
  ];
in
stdenv.mkDerivation {
  pname = "pharo";
  version = "10.0.5";
  src = pharo-sources;

  buildInputs = [
    cairo
    libgit2
    libpng
    pixman
    SDL2
  ];

  nativeBuildInputs = [
    cmake
    freetype
    gcc
    git
    gnumake
    libffi
    libuuid
    makeBinaryWrapper
    openssl
    pixman
    SDL2
    unzip
  ];

  cmakeFlags = [
    # Necessary to perform the bootstrapping without already having Pharo available.
    "-DGENERATED_SOURCE_DIR=."
    "-DGENERATE_SOURCES=OFF"
    # Prevents CMake from trying to download stuff.
    "-DBUILD_BUNDLE=OFF"
  ];

  installPhase = ''
    runHook preInstall

    cmake --build . --target=install
    mkdir -p "$out/lib"
    mkdir "$out/bin"
    cp build/vm/*.so* "$out/lib/"
    cp build/vm/pharo "$out/bin/pharo"
    patchelf --allowed-rpath-prefixes /nix/store --shrink-rpath "$out/bin/pharo"
    wrapProgram "$out/bin/pharo" --set LD_LIBRARY_PATH "${library_path}"

    runHook postInstall
  '';

  meta = with lib; {
    description = "Clean and innovative Smalltalk-inspired environment";
    homepage = "https://pharo.org";
    license = licenses.mit;
    longDescription = ''
      Pharo's goal is to deliver a clean, innovative, free open-source
      Smalltalk-inspired environment. By providing a stable and small core
      system, excellent dev tools, and maintained releases, Pharo is an
      attractive platform to build and deploy mission critical applications.
    '';
    maintainers = [ ];
    platforms = lib.platforms.linux;
  };
}