1{
2 lib,
3 rustPlatform,
4 pkg-config,
5 at-spi2-atk,
6 gdk-pixbuf,
7 cairo,
8 gtk3,
9 writeText,
10 stdenv,
11}:
12
13{ version, src, ... }:
14
15let
16 rustDep = rustPlatform.buildRustPackage {
17 pname = "super_native_extensions-rs";
18 inherit version src;
19
20 unpackPhase = ''
21 runHook preUnpack
22
23 if [ -d $src/super_native_extensions ]; then
24 cp -r $src/super_native_extensions ${src.name}
25 else
26 cp -r $src ${src.name}
27 fi
28 chmod -R u+w -- "$sourceRoot"
29
30 runHook postUnpack
31 '';
32
33 sourceRoot = "${src.name}/rust";
34
35 cargoHash =
36 rec {
37 _0_9_1 = _0_9_0-dev_6;
38 _0_9_0-dev_6 = "sha256-1yJIbBxScmkCwy/e+/z2cYA8qQBfT0yoIBmOSPVd4h4=";
39 _0_9_0-dev_5 = _0_8_22;
40 _0_9_0-dev_3 = _0_8_22;
41 _0_8_22 = "sha256-gYYoC3bGJrYY1uUHfqMv6pp4SK+P9fRoBsLtf34rsCg=";
42 _0_8_24 = _0_8_22;
43 _0_8_21 = _0_8_22;
44 _0_8_20 = _0_8_22;
45 _0_8_19 = _0_8_22;
46 _0_8_18 = _0_8_22;
47 _0_8_17 = _0_8_22;
48 }
49 .${"_" + (lib.replaceStrings [ "." ] [ "_" ] version)} or (throw ''
50 Unsupported version of pub 'super_native_extensions': '${version}'
51 Please add cargoHash to here. If the cargoHash
52 is the same with existing versions, add an alias here.
53 '');
54
55 nativeBuildInputs = [ pkg-config ];
56
57 buildInputs = [
58 at-spi2-atk
59 gdk-pixbuf
60 cairo
61 gtk3
62 ];
63
64 passthru.libraryPath = "lib/libsuper_native_extensions.so";
65 };
66
67 fakeCargokitCmake = writeText "FakeCargokit.cmake" ''
68 function(apply_cargokit target manifest_dir lib_name any_symbol_name)
69 target_link_libraries("''${target}" PRIVATE ${rustDep}/${rustDep.passthru.libraryPath})
70 set("''${target}_cargokit_lib" ${rustDep}/${rustDep.passthru.libraryPath} PARENT_SCOPE)
71 endfunction()
72 '';
73
74in
75stdenv.mkDerivation {
76 pname = "super_native_extensions";
77 inherit version src;
78 inherit (src) passthru;
79
80 installPhase = ''
81 runHook preInstall
82
83 cp -r "$src" "$out"
84 if [ -d $out/super_native_extensions ]; then
85 pushd $out/super_native_extensions
86 else
87 pushd $out
88 fi
89 chmod +rwx cargokit/cmake/cargokit.cmake
90 cp ${fakeCargokitCmake} cargokit/cmake/cargokit.cmake
91 popd
92
93 runHook postInstall
94 '';
95}