1{ lib, stdenv, fetchFromGitHub, fixDarwinDylibNames, oracle-instantclient, libaio }:
2
3let
4 version = "4.6.1";
5 libPath = lib.makeLibraryPath [ oracle-instantclient.lib ];
6
7in stdenv.mkDerivation {
8 inherit version;
9
10 pname = "odpic";
11
12 src = fetchFromGitHub {
13 owner = "oracle";
14 repo = "odpi";
15 rev = "v${version}";
16 sha256 = "sha256-3kJI3qRgqrithhGq7lO1r94T/P3SamDgLN13hKzmj5I=";
17 };
18
19 nativeBuildInputs = lib.optional stdenv.isDarwin fixDarwinDylibNames;
20
21 buildInputs = [ oracle-instantclient ]
22 ++ lib.optionals stdenv.isLinux [ libaio ];
23
24 dontPatchELF = true;
25 makeFlags = [ "PREFIX=$(out)" "CC=${stdenv.cc.targetPrefix}cc" "LD=${stdenv.cc.targetPrefix}cc"];
26
27 postFixup = ''
28 ${lib.optionalString (stdenv.isLinux) ''
29 patchelf --set-rpath "${libPath}:$(patchelf --print-rpath $out/lib/libodpic${stdenv.hostPlatform.extensions.sharedLibrary})" $out/lib/libodpic${stdenv.hostPlatform.extensions.sharedLibrary}
30 ''}
31 ${lib.optionalString (stdenv.isDarwin) ''
32 install_name_tool -add_rpath "${libPath}" $out/lib/libodpic${stdenv.hostPlatform.extensions.sharedLibrary}
33 ''}
34 '';
35
36 meta = with lib; {
37 description = "Oracle ODPI-C library";
38 homepage = "https://oracle.github.io/odpi/";
39 maintainers = with maintainers; [ mkazulak flokli ];
40 license = licenses.asl20;
41 platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ];
42 hydraPlatforms = [];
43 };
44}