2019-08-20 00:24:36 +01:00
|
|
|
{ stdenv
|
|
|
|
, fetchurl
|
|
|
|
, autoPatchelfHook
|
|
|
|
, fixDarwinDylibNames
|
|
|
|
, unzip
|
|
|
|
, libaio
|
|
|
|
, makeWrapper
|
|
|
|
, odbcSupport ? true
|
|
|
|
, 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;
|
|
|
|
|
2019-08-20 00:24:36 +01:00
|
|
|
throwSystem = throw "Unsupported system: ${stdenv.hostPlatform.system}";
|
2015-04-21 11:25:09 +01:00
|
|
|
|
2019-08-20 00:24:36 +01:00
|
|
|
# assemble list of components
|
|
|
|
components = [ "basic" "sdk" "sqlplus" ] ++ optional odbcSupport "odbc";
|
2018-06-08 01:35:26 +01:00
|
|
|
|
2019-08-20 00:24:36 +01:00
|
|
|
# determine the version number, there might be different ones per architecture
|
|
|
|
version = {
|
2019-09-09 00:38:31 +01:00
|
|
|
x86_64-linux = "19.3.0.0.0";
|
2019-09-09 21:42:03 +01:00
|
|
|
x86_64-darwin = "19.3.0.0.0";
|
2019-09-09 00:38:31 +01:00
|
|
|
}.${stdenv.hostPlatform.system} or throwSystem;
|
2018-06-08 01:35:26 +01:00
|
|
|
|
2019-08-20 00:24:36 +01:00
|
|
|
# hashes per component and architecture
|
|
|
|
hashes = {
|
2019-09-09 00:38:31 +01:00
|
|
|
x86_64-linux = {
|
|
|
|
basic = "1yk4ng3a9ka1mzgfph9br6rwclagbgfvmg6kja11nl5dapxdzaxy";
|
|
|
|
sdk = "115v1gqr0czy7dcf2idwxhc6ja5b0nind0mf1rn8iawgrw560l99";
|
|
|
|
sqlplus = "0zj5h84ypv4n4678kfix6jih9yakb277l9hc0819iddc0a5slbi5";
|
|
|
|
odbc = "1g1z6pdn76dp440fh49pm8ijfgjazx4cvxdi665fsr62h62xkvch";
|
2019-08-20 00:24:36 +01:00
|
|
|
};
|
2019-09-09 00:38:31 +01:00
|
|
|
x86_64-darwin = {
|
2019-09-09 21:42:03 +01:00
|
|
|
basic = "f4335c1d53e8188a3a8cdfb97494ff87c4d0f481309284cf086dc64080a60abd";
|
|
|
|
sdk = "b46b4b87af593f7cfe447cfb903d1ae5073cec34049143ad8cdc9f3e78b23b27";
|
|
|
|
sqlplus = "f7565c3cbf898b0a7953fbb0017c5edd9d11d1863781588b7caf3a69937a2e9e";
|
|
|
|
odbc = "f91da40684abaa866aa059eb26b1322f2d527670a1937d678404c991eadeb725";
|
2019-08-20 00:24:36 +01:00
|
|
|
};
|
2019-09-09 00:38:31 +01:00
|
|
|
}.${stdenv.hostPlatform.system} or throwSystem;
|
2019-08-20 00:24:36 +01:00
|
|
|
|
|
|
|
# rels per component and architecture, optional
|
|
|
|
rels = {
|
2019-09-09 00:38:31 +01:00
|
|
|
}.${stdenv.hostPlatform.system} or {};
|
2018-06-08 01:35:26 +01:00
|
|
|
|
2019-08-20 00:24:36 +01:00
|
|
|
# convert platform to oracle architecture names
|
2018-06-08 01:35:26 +01:00
|
|
|
arch = {
|
2019-08-13 22:52:01 +01:00
|
|
|
x86_64-linux = "linux.x64";
|
|
|
|
x86_64-darwin = "macos.x64";
|
|
|
|
}.${stdenv.hostPlatform.system} or throwSystem;
|
2018-06-08 01:35:26 +01:00
|
|
|
|
2019-09-09 21:42:03 +01:00
|
|
|
shortArch = {
|
|
|
|
x86_64-linux = "linux";
|
2019-10-16 22:56:08 +01:00
|
|
|
x86_64-darwin = "mac";
|
2019-09-09 21:42:03 +01:00
|
|
|
}.${stdenv.hostPlatform.system} or throwSystem;
|
|
|
|
|
2019-08-20 00:24:36 +01:00
|
|
|
# calculate the filename of a single zip file
|
|
|
|
srcFilename = component: arch: version: rel:
|
|
|
|
"instantclient-${component}-${arch}-${version}" +
|
|
|
|
(optionalString (rel != "") "-${rel}") +
|
2019-09-09 21:42:03 +01:00
|
|
|
(optionalString (arch == "linux.x64" || arch == "macos.x64") "dbru") + # ¯\_(ツ)_/¯
|
2019-08-20 00:24:36 +01:00
|
|
|
".zip";
|
|
|
|
|
|
|
|
# fetcher for the non clickthrough artifacts
|
2019-09-09 21:42:03 +01:00
|
|
|
fetcher = srcFilename: hash: fetchurl {
|
|
|
|
url = "https://download.oracle.com/otn_software/${shortArch}/instantclient/193000/${srcFilename}";
|
2019-08-20 00:24:36 +01:00
|
|
|
sha256 = hash;
|
|
|
|
};
|
|
|
|
|
|
|
|
# assemble srcs
|
|
|
|
srcs = map (component:
|
2019-09-09 00:38:31 +01:00
|
|
|
(fetcher (srcFilename component arch version rels.${component} or "") hashes.${component} or ""))
|
2019-08-20 00:24:36 +01:00
|
|
|
components;
|
2018-06-08 01:35:26 +01:00
|
|
|
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "oracle-instantclient";
|
2018-08-16 19:09:50 +01:00
|
|
|
extLib = stdenv.hostPlatform.extensions.sharedLibrary;
|
2019-08-20 00:24:36 +01:00
|
|
|
in stdenv.mkDerivation {
|
|
|
|
inherit pname version srcs;
|
2015-04-21 11:25:09 +01:00
|
|
|
|
2018-06-08 01:35:26 +01:00
|
|
|
buildInputs = [ stdenv.cc.cc.lib ]
|
2019-08-20 00:24:36 +01:00
|
|
|
++ optional stdenv.isLinux libaio
|
2018-08-16 19:09:50 +01:00
|
|
|
++ 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-20 00:24:36 +01:00
|
|
|
mkdir -p "$out/"{bin,include,lib,"share/java","share/${pname}-${version}/demo/"} $lib/lib
|
2019-08-21 01:55:59 +01:00
|
|
|
install -Dm755 {adrci,genezi,uidrvci,sqlplus} $out/bin
|
2019-08-21 23:41:49 +01:00
|
|
|
|
|
|
|
# cp to preserve symlinks
|
|
|
|
cp -P *${extLib}* $lib/lib
|
|
|
|
|
2018-06-08 01:35:26 +01:00
|
|
|
install -Dm644 *.jar $out/share/java
|
|
|
|
install -Dm644 sdk/include/* $out/include
|
2019-08-15 13:41:18 +01:00
|
|
|
install -Dm644 sdk/demo/* $out/share/${pname}-${version}/demo
|
2018-08-04 02:58:57 +01:00
|
|
|
|
2019-08-20 00:24:36 +01:00
|
|
|
# provide alias
|
|
|
|
ln -sfn $out/bin/sqlplus $out/bin/sqlplus64
|
|
|
|
'';
|
2018-08-04 02:58:57 +01:00
|
|
|
|
2019-08-21 23:00:33 +01:00
|
|
|
postFixup = optionalString stdenv.isDarwin ''
|
2019-08-21 01:55:59 +01:00
|
|
|
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
|
|
|
};
|
|
|
|
}
|