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