Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fixDarwinDylibNames,
6 oracle-instantclient,
7 libaio,
8}:
9
10let
11 version = "5.6.0";
12 libPath = lib.makeLibraryPath [ oracle-instantclient.lib ];
13
14in
15stdenv.mkDerivation {
16 inherit version;
17
18 pname = "odpic";
19
20 src = fetchFromGitHub {
21 owner = "oracle";
22 repo = "odpi";
23 rev = "v${version}";
24 sha256 = "sha256-kdhL+yvolf7paNBbUN0V/Zp0mwHS2BEhP8bRUwa3dhQ=";
25 };
26
27 nativeBuildInputs = lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
28
29 buildInputs = [ oracle-instantclient ] ++ lib.optionals stdenv.hostPlatform.isLinux [ libaio ];
30
31 dontPatchELF = true;
32 makeFlags = [
33 "PREFIX=$(out)"
34 "CC=${stdenv.cc.targetPrefix}cc"
35 "LD=${stdenv.cc.targetPrefix}cc"
36 ];
37
38 postFixup = ''
39 ${lib.optionalString (stdenv.hostPlatform.isLinux) ''
40 patchelf --set-rpath "${libPath}:$(patchelf --print-rpath $out/lib/libodpic${stdenv.hostPlatform.extensions.sharedLibrary})" $out/lib/libodpic${stdenv.hostPlatform.extensions.sharedLibrary}
41 ''}
42 ${lib.optionalString (stdenv.hostPlatform.isDarwin) ''
43 install_name_tool -add_rpath "${libPath}" $out/lib/libodpic${stdenv.hostPlatform.extensions.sharedLibrary}
44 ''}
45 '';
46
47 meta = with lib; {
48 description = "Oracle ODPI-C library";
49 homepage = "https://oracle.github.io/odpi/";
50 license = licenses.asl20;
51 platforms = [
52 "x86_64-linux"
53 "aarch64-linux"
54 "x86_64-darwin"
55 ];
56 hydraPlatforms = [ ];
57 };
58}