diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 50ac45adc25..8a5845cafe3 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -2536,6 +2536,11 @@ github = "MikePlayle"; name = "Mike Playle"; }; + mkazulak = { + email = "kazulakm@gmail.com"; + github = "mulderr"; + name = "Maciej Kazulak"; + }; mkg = { email = "mkg@vt.edu"; github = "mkgvt"; diff --git a/pkgs/development/libraries/odpic/default.nix b/pkgs/development/libraries/odpic/default.nix new file mode 100644 index 00000000000..07edc24ecab --- /dev/null +++ b/pkgs/development/libraries/odpic/default.nix @@ -0,0 +1,45 @@ +{ stdenv, fetchurl, fetchpatch, fixDarwinDylibNames, oracle-instantclient, libaio }: + +stdenv.mkDerivation rec { + name = "odpic-${version}"; + version = "2.4.0"; + + src = fetchurl { + url = "https://github.com/oracle/odpi/archive/v${version}.tar.gz"; + sha256 = "1z793mg8hmy067xhllip7ca84xy07ca1cqilnr35mbvhmydp03zz"; + }; + + patches = [ (fetchpatch { + url = https://github.com/oracle/odpi/commit/31fdd70c06be711840a2668f572c7ee7c4434d18.patch; + sha256 = "1f00zp4w7l4vnkg0fmvnkga20ih8kjd5bxvr1nryziibjh1xp41j"; + }) ]; + + nativeBuildInputs = stdenv.lib.optional stdenv.isDarwin [ fixDarwinDylibNames ]; + + buildInputs = [ oracle-instantclient ] + ++ stdenv.lib.optionals stdenv.isLinux [ libaio ]; + + libPath = stdenv.lib.makeLibraryPath + [ oracle-instantclient ]; + + dontPatchELF = true; + makeFlags = [ "PREFIX=$(out)" "CC=cc" "LD=cc"]; + + postFixup = '' + ${stdenv.lib.optionalString (stdenv.isLinux) '' + patchelf --set-rpath "${libPath}" $out/lib/libodpic${stdenv.hostPlatform.extensions.sharedLibrary} + ''} + ${stdenv.lib.optionalString (stdenv.isDarwin) '' + install_name_tool -add_rpath "${libPath}" $out/lib/libodpic${stdenv.hostPlatform.extensions.sharedLibrary} + ''} + ''; + + meta = with stdenv.lib; { + description = "Oracle ODPI-C library"; + homepage = "https://oracle.github.io/odpi/"; + maintainers = with maintainers; [ mkazulak flokli ]; + license = licenses.asl20; + platforms = [ "x86_64-linux" "x86_64-darwin" ]; + hydraPlatforms = []; + }; +} diff --git a/pkgs/development/libraries/oracle-instantclient/default.nix b/pkgs/development/libraries/oracle-instantclient/default.nix index 7e0f2e1cf90..56f0cc084d1 100644 --- a/pkgs/development/libraries/oracle-instantclient/default.nix +++ b/pkgs/development/libraries/oracle-instantclient/default.nix @@ -1,49 +1,57 @@ -{ stdenv, requireFile, autoPatchelfHook, rpmextract, libaio, makeWrapper, odbcSupport ? false, unixODBC }: +{ stdenv, requireFile, autoPatchelfHook, unzip, libaio, makeWrapper, odbcSupport ? false, unixODBC }: assert odbcSupport -> unixODBC != null; let - baseVersion = "12.2"; - requireSource = version: rel: part: hash: (requireFile rec { - name = "oracle-instantclient${baseVersion}-${part}-${version}-${rel}.x86_64.rpm"; - message = '' - This Nix expression requires that ${name} already - be part of the store. Download the file - manually at - - http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html - - and add it to the Nix store using either: - nix-store --add-fixed sha256 ${name} - or - nix-prefetch-url --type sha256 file:///path/to/${name} - ''; - url = "http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html"; - sha256 = hash; - }); -in stdenv.mkDerivation rec { + baseVersion = "12.2"; version = "${baseVersion}.0.1.0"; + + requireSource = component: arch: version: rel: hash: (requireFile rec { + name = "instantclient-${component}-${arch}-${version}" + (stdenv.lib.optionalString (rel != "") "-${rel}") + ".zip"; + url = "http://www.oracle.com/technetwork/database/database-technologies/instant-client/downloads/index.html"; + sha256 = hash; + }); + + throwSystem = throw "Unsupported system: ${stdenv.system}"; + + arch = { + "x86_64-linux" = "linux.x64"; + "x86_64-darwin" = "macos.x64"; + }."${stdenv.system}" or throwSystem; + + srcs = { + "x86_64-linux" = [ + (requireSource "basic" arch version "" "5015e3c9fba84e009f7519893f798a1622c37d1ae2c55104ff502c52a0fe5194") + (requireSource "sdk" arch version "" "7f404c3573c062ce487a51ac4cfe650c878d7edf8e73b364ec852645ed1098cb") + (requireSource "sqlplus" arch version "" "d49b2bd97376591ca07e7a836278933c3f251875c215044feac73ba9f451dfc2") ] + ++ stdenv.lib.optional odbcSupport (requireSource "odbc" arch version "2" "365a4ae32c7062d9fbc3fb41add748e7881f774484a175a4b41a2c294ce9095d"); + "x86_64-darwin" = [ + (requireSource "basic" arch version "2" "3ed3102e5a24f0da638694191edb34933309fb472eb1df21ad5c86eedac3ebb9") + (requireSource "sdk" arch version "2" "e0befca9c4e71ebc9f444957ffa70f01aeeec5976ea27c40406471b04c34848b") + (requireSource "sqlplus" arch version "2" "d147cbb5b2a954fdcb4b642df4f0bd1153fd56e0f56e7fa301601b4f7e2abe0e") ] + ++ stdenv.lib.optional odbcSupport (requireSource "odbc" arch version "2" "1805c1ab6c8c5e8df7bdcc35d7f2b94c329ecf4dff9bde55d5f9b159ecd8b64e"); + }."${stdenv.system}" or throwSystem; + +in stdenv.mkDerivation rec { + inherit version srcs; name = "oracle-instantclient-${version}"; - buildInputs = [ libaio stdenv.cc.cc.lib ] ++ stdenv.lib.optional odbcSupport unixODBC; - nativeBuildInputs = [ autoPatchelfHook makeWrapper rpmextract ]; + buildInputs = [ stdenv.cc.cc.lib ] + ++ stdenv.lib.optionals (stdenv.isLinux) [ libaio ] + ++ stdenv.lib.optional odbcSupport unixODBC; + nativeBuildInputs = [ autoPatchelfHook makeWrapper unzip ]; - srcs = [ - (requireSource version "1" "basic" "43c4bfa938af741ae0f9964a656f36a0700849f5780a2887c8e9f1be14fe8b66") - (requireSource version "1" "devel" "4c7ad8d977f9f908e47c5e71ce56c2a40c7dc83cec8a5c106b9ff06d45bb3442") - (requireSource version "1" "sqlplus" "303e82820a10f78e401e2b07d4eebf98b25029454d79f06c46e5f9a302ce5552") - ] ++ stdenv.lib.optional odbcSupport (requireSource version "2" "odbc" "e870c84d2d4be6f77c0760083b82b7ffbb15a4bf5c93c4e6c84f36d6ed4dfdf1"); - - unpackCmd = "rpmextract $curSrc"; + unpackCmd = "unzip $curSrc"; installPhase = '' - mkdir -p "$out/"{bin,include,lib,"share/${name}/demo/"} + mkdir -p "$out/"{bin,include,lib,"share/java","share/${name}/demo/"} - install -Dm755 lib/oracle/${baseVersion}/client64/bin/* $out/bin + install -Dm755 {sqlplus,adrci,genezi} $out/bin ln -s $out/bin/sqlplus $out/bin/sqlplus64 - install -Dm644 lib/oracle/${baseVersion}/client64/lib/* $out/lib - install -Dm644 include/oracle/${baseVersion}/client64/* $out/include - install -Dm644 share/oracle/${baseVersion}/client64/demo/* $out/share/${name}/demo + install -Dm644 *${stdenv.hostPlatform.extensions.sharedLibrary}* $out/lib + install -Dm644 *.jar $out/share/java + install -Dm644 sdk/include/* $out/include + install -Dm644 sdk/demo/* $out/share/${name}/demo ''; meta = with stdenv.lib; { @@ -54,7 +62,7 @@ in stdenv.mkDerivation rec { command line SQL client. ''; license = licenses.unfree; - platforms = [ "x86_64-linux" ]; + platforms = [ "x86_64-linux" "x86_64-darwin" ]; maintainers = with maintainers; [ pesterhazy flokli ]; hydraPlatforms = []; }; diff --git a/pkgs/development/python-modules/cx_oracle/0001-odpi-src-dpiOci.c-nixify-libclntsh.so-dlopen.patch b/pkgs/development/python-modules/cx_oracle/0001-odpi-src-dpiOci.c-nixify-libclntsh.so-dlopen.patch deleted file mode 100644 index a2de7b24853..00000000000 --- a/pkgs/development/python-modules/cx_oracle/0001-odpi-src-dpiOci.c-nixify-libclntsh.so-dlopen.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 355b9d812efdfbd041e14b365258b69c81689981 Mon Sep 17 00:00:00 2001 -From: Florian Klink -Date: Thu, 17 May 2018 18:37:40 +0200 -Subject: [PATCH] odpi/src/dpiOci.c: nixify libclntsh.so dlopen - ---- - odpi/src/dpiOci.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/odpi/src/dpiOci.c b/odpi/src/dpiOci.c -index 76b9867..22c2987 100644 ---- a/odpi/src/dpiOci.c -+++ b/odpi/src/dpiOci.c -@@ -1575,6 +1575,10 @@ static int dpiOci__loadLib(dpiError *error) - } - } - } -+ if(!dpiOciLibHandle) { -+ dpiOciLibHandle = dlopen("@libclntsh@", RTLD_LAZY); -+ } -+ - #endif - - if (!dpiOciLibHandle) { --- -2.16.3 - diff --git a/pkgs/development/python-modules/cx_oracle/default.nix b/pkgs/development/python-modules/cx_oracle/default.nix index 717faf1128f..7c0fa32eb99 100644 --- a/pkgs/development/python-modules/cx_oracle/default.nix +++ b/pkgs/development/python-modules/cx_oracle/default.nix @@ -1,22 +1,19 @@ -{ stdenv, buildPythonPackage, fetchPypi, oracle-instantclient }: +{ stdenv, buildPythonPackage, fetchPypi, odpic }: buildPythonPackage rec { pname = "cx_Oracle"; version = "6.3.1"; - buildInputs = [ - oracle-instantclient - ]; + buildInputs = [ odpic ]; src = fetchPypi { inherit pname version; sha256 = "0200j6jh80rpgzxmvgcxmkshaj4zadq32g2i97nlwiq3f7q374l7"; }; - patches = [ ./0001-odpi-src-dpiOci.c-nixify-libclntsh.so-dlopen.patch ]; - - postPatch = '' - substituteInPlace odpi/src/dpiOci.c --replace @libclntsh@ "${oracle-instantclient}/lib/libclntsh.so"; + preConfigure = '' + export ODPIC_INC_DIR="${odpic}/include" + export ODPIC_LIB_DIR="${odpic}/lib" ''; # Check need an Oracle database to run diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 659f2840722..e645b0a2a02 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4148,6 +4148,8 @@ with pkgs; odpdown = callPackage ../tools/typesetting/odpdown { }; + odpic = callPackage ../development/libraries/odpic { }; + odt2txt = callPackage ../tools/text/odt2txt { }; offlineimap = callPackage ../tools/networking/offlineimap { };