2018-08-16 19:09:50 +01:00
|
|
|
{ stdenv, requireFile, autoPatchelfHook, fixDarwinDylibNames, unzip, libaio, makeWrapper, odbcSupport ? false, unixODBC }:
|
2015-04-21 11:25:09 +01:00
|
|
|
|
2017-04-01 10:50:13 +01:00
|
|
|
assert odbcSupport -> unixODBC != null;
|
2015-04-21 11:25:09 +01:00
|
|
|
|
2018-01-09 21:20:47 +00:00
|
|
|
let
|
2018-08-16 19:09:50 +01:00
|
|
|
inherit (stdenv.lib) optional optionals optionalString;
|
|
|
|
|
2018-06-08 01:35:26 +01:00
|
|
|
baseVersion = "12.2";
|
2018-01-09 21:20:47 +00:00
|
|
|
version = "${baseVersion}.0.1.0";
|
2015-04-21 11:25:09 +01:00
|
|
|
|
2018-06-08 01:35:26 +01:00
|
|
|
requireSource = component: arch: version: rel: hash: (requireFile rec {
|
2018-08-16 19:09:50 +01:00
|
|
|
name = "instantclient-${component}-${arch}-${version}" + (optionalString (rel != "") "-${rel}") + ".zip";
|
2018-06-08 01:35:26 +01:00
|
|
|
url = "http://www.oracle.com/technetwork/database/database-technologies/instant-client/downloads/index.html";
|
|
|
|
sha256 = hash;
|
|
|
|
});
|
|
|
|
|
2018-08-20 20:11:29 +01:00
|
|
|
throwSystem = throw "Unsupported system: ${stdenv.hostPlatform.system}";
|
2018-06-08 01:35:26 +01:00
|
|
|
|
|
|
|
arch = {
|
|
|
|
"x86_64-linux" = "linux.x64";
|
|
|
|
"x86_64-darwin" = "macos.x64";
|
2018-08-20 20:11:29 +01:00
|
|
|
}."${stdenv.hostPlatform.system}" or throwSystem;
|
2018-06-08 01:35:26 +01:00
|
|
|
|
|
|
|
srcs = {
|
|
|
|
"x86_64-linux" = [
|
|
|
|
(requireSource "basic" arch version "" "5015e3c9fba84e009f7519893f798a1622c37d1ae2c55104ff502c52a0fe5194")
|
|
|
|
(requireSource "sdk" arch version "" "7f404c3573c062ce487a51ac4cfe650c878d7edf8e73b364ec852645ed1098cb")
|
|
|
|
(requireSource "sqlplus" arch version "" "d49b2bd97376591ca07e7a836278933c3f251875c215044feac73ba9f451dfc2") ]
|
2018-08-16 19:09:50 +01:00
|
|
|
++ optional odbcSupport (requireSource "odbc" arch version "2" "365a4ae32c7062d9fbc3fb41add748e7881f774484a175a4b41a2c294ce9095d");
|
2018-06-08 01:35:26 +01:00
|
|
|
"x86_64-darwin" = [
|
|
|
|
(requireSource "basic" arch version "2" "3ed3102e5a24f0da638694191edb34933309fb472eb1df21ad5c86eedac3ebb9")
|
|
|
|
(requireSource "sdk" arch version "2" "e0befca9c4e71ebc9f444957ffa70f01aeeec5976ea27c40406471b04c34848b")
|
|
|
|
(requireSource "sqlplus" arch version "2" "d147cbb5b2a954fdcb4b642df4f0bd1153fd56e0f56e7fa301601b4f7e2abe0e") ]
|
2018-08-16 19:09:50 +01:00
|
|
|
++ optional odbcSupport (requireSource "odbc" arch version "2" "1805c1ab6c8c5e8df7bdcc35d7f2b94c329ecf4dff9bde55d5f9b159ecd8b64e");
|
2018-08-20 20:11:29 +01:00
|
|
|
}."${stdenv.hostPlatform.system}" or throwSystem;
|
2018-06-08 01:35:26 +01:00
|
|
|
|
2018-08-16 19:09:50 +01:00
|
|
|
extLib = stdenv.hostPlatform.extensions.sharedLibrary;
|
2018-06-08 01:35:26 +01:00
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
inherit version srcs;
|
|
|
|
name = "oracle-instantclient-${version}";
|
2015-04-21 11:25:09 +01:00
|
|
|
|
2018-06-08 01:35:26 +01:00
|
|
|
buildInputs = [ stdenv.cc.cc.lib ]
|
2018-08-16 19:09:50 +01:00
|
|
|
++ optionals (stdenv.isLinux) [ libaio ]
|
|
|
|
++ optional odbcSupport unixODBC;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper unzip ]
|
|
|
|
++ optional stdenv.isLinux autoPatchelfHook
|
|
|
|
++ optional stdenv.isDarwin fixDarwinDylibNames;
|
2015-04-21 11:25:09 +01:00
|
|
|
|
2019-08-21 01:55:59 +01:00
|
|
|
outputs = [ "out" "dev" "lib"];
|
|
|
|
|
2018-06-08 01:35:26 +01:00
|
|
|
unpackCmd = "unzip $curSrc";
|
2018-05-17 16:35:01 +01:00
|
|
|
|
2018-05-22 00:29:28 +01:00
|
|
|
installPhase = ''
|
2019-08-21 01:55:59 +01:00
|
|
|
mkdir -p "$out/"{bin,include,"share/java","share/${name}/demo/"} $lib/lib
|
|
|
|
install -Dm755 {adrci,genezi,uidrvci,sqlplus} $out/bin
|
|
|
|
install -Dm644 *${extLib}* $lib/lib
|
|
|
|
|
2018-06-08 01:35:26 +01:00
|
|
|
install -Dm644 *.jar $out/share/java
|
|
|
|
install -Dm644 sdk/include/* $out/include
|
|
|
|
install -Dm644 sdk/demo/* $out/share/${name}/demo
|
2018-08-04 02:58:57 +01:00
|
|
|
|
|
|
|
# PECL::oci8 will not build without this
|
2018-08-16 19:09:50 +01:00
|
|
|
# this symlink only exists in dist zipfiles for some platforms
|
|
|
|
ln -sfn $out/lib/libclntsh${extLib}.12.1 $out/lib/libclntsh${extLib}
|
2015-04-21 11:25:09 +01:00
|
|
|
'';
|
|
|
|
|
2019-08-21 01:55:59 +01:00
|
|
|
postFixup = optionalString stdenv.isDarwin ''
|
|
|
|
for exe in "$out/bin/"* ; do
|
|
|
|
if [ ! -L "$exe" ]; then
|
|
|
|
install_name_tool -add_rpath "$lib/lib" "$exe"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
2015-04-21 11:25:09 +01:00
|
|
|
meta = with stdenv.lib; {
|
2015-06-29 15:20:58 +01:00
|
|
|
description = "Oracle instant client libraries and sqlplus CLI";
|
2015-04-21 11:25:09 +01:00
|
|
|
longDescription = ''
|
|
|
|
Oracle instant client provides access to Oracle databases (OCI,
|
|
|
|
OCCI, Pro*C, ODBC or JDBC). This package includes the sqlplus
|
|
|
|
command line SQL client.
|
|
|
|
'';
|
|
|
|
license = licenses.unfree;
|
2018-06-08 01:35:26 +01:00
|
|
|
platforms = [ "x86_64-linux" "x86_64-darwin" ];
|
2018-05-22 00:29:00 +01:00
|
|
|
maintainers = with maintainers; [ pesterhazy flokli ];
|
2018-05-22 01:00:46 +01:00
|
|
|
hydraPlatforms = [];
|
2015-04-21 11:25:09 +01:00
|
|
|
};
|
|
|
|
}
|