Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 111 lines 2.7 kB view raw
1{ 2 lib, 3 stdenv, 4 cairo, 5 cmake, 6 fetchzip, 7 freetype, 8 libffi, 9 libgit2, 10 libpng, 11 libuuid, 12 makeBinaryWrapper, 13 openssl, 14 pixman, 15 SDL2, 16}: 17 18stdenv.mkDerivation (finalAttrs: { 19 pname = "pharo"; 20 version = "10.3.4+3.884643b"; 21 22 src = fetchzip { 23 # It is necessary to download from there instead of from the repository because that archive 24 # also contains artifacts necessary for the bootstrapping. 25 url = "https://files.pharo.org/vm/pharo-spur64-headless/Linux-x86_64/source/PharoVM-v${finalAttrs.version}-Linux-x86_64-c-src.zip"; 26 hash = "sha256-JBN0gPVMIUFzrdLqrCnCvf4cbZMfpluO2/jCxk3U+M8="; 27 }; 28 29 strictDeps = true; 30 31 buildInputs = [ 32 cairo 33 freetype 34 libffi 35 libgit2 36 libpng 37 libuuid 38 openssl 39 pixman 40 SDL2 41 ]; 42 43 nativeBuildInputs = [ 44 cmake 45 makeBinaryWrapper 46 ]; 47 48 cmakeFlags = [ 49 # Necessary to perform the bootstrapping without already having Pharo available. 50 "-DGENERATED_SOURCE_DIR=." 51 "-DALWAYS_INTERACTIVE=ON" 52 "-DBUILD_IS_RELEASE=ON" 53 "-DGENERATE_SOURCES=OFF" 54 # Prevents CMake from trying to download stuff. 55 "-DBUILD_BUNDLE=OFF" 56 ]; 57 58 env.NIX_CFLAGS_COMPILE = toString [ 59 "-Wno-incompatible-pointer-types" 60 ]; 61 62 # Fix missing version.info 63 preBuild = '' 64 mkdir -p /build/source/build/ 65 echo "${finalAttrs.version}" > /build/source/build/version.info 66 ''; 67 68 installPhase = '' 69 runHook preInstall 70 71 cmake --build . --target=install 72 mkdir -p "$out/lib" 73 mkdir "$out/bin" 74 cp build/vm/*.so* "$out/lib/" 75 cp build/vm/pharo "$out/bin/pharo" 76 77 runHook postInstall 78 ''; 79 80 preFixup = 81 let 82 libPath = lib.makeLibraryPath ( 83 finalAttrs.buildInputs 84 ++ [ 85 stdenv.cc.cc 86 "$out" 87 ] 88 ); 89 in 90 '' 91 patchelf --allowed-rpath-prefixes "$NIX_STORE" --shrink-rpath "$out/bin/pharo" 92 ln -s "${libgit2}/lib/libgit2.so" $out/lib/libgit2.so.1.1 93 wrapProgram "$out/bin/pharo" --argv0 $out/bin/pharo --prefix LD_LIBRARY_PATH ":" "${libPath}" 94 ''; 95 96 meta = { 97 description = "Clean and innovative Smalltalk-inspired environment"; 98 homepage = "https://pharo.org"; 99 changelog = "https://github.com/pharo-project/pharo/releases/"; 100 license = lib.licenses.mit; 101 longDescription = '' 102 Pharo's goal is to deliver a clean, innovative, free open-source 103 Smalltalk-inspired environment. By providing a stable and small core 104 system, excellent dev tools, and maintained releases, Pharo is an 105 attractive platform to build and deploy mission critical applications. 106 ''; 107 maintainers = with lib.maintainers; [ ehmry ]; 108 mainProgram = "pharo"; 109 platforms = lib.platforms.linux; 110 }; 111})