Skip to content

Commit

Permalink
oracle-instantclient: support aarch64-darwin (#366184)
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperSandro2000 authored Dec 22, 2024
2 parents 088f445 + 8f33c0d commit 49fffe9
Showing 1 changed file with 35 additions and 7 deletions.
42 changes: 35 additions & 7 deletions pkgs/by-name/or/oracle-instantclient/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
autoPatchelfHook,
fixDarwinDylibNames,
unzip,
_7zz,
libaio,
makeWrapper,
odbcSupport ? true,
Expand Down Expand Up @@ -32,6 +33,7 @@ let
x86_64-linux = "21.10.0.0.0";
aarch64-linux = "19.10.0.0.0";
x86_64-darwin = "19.8.0.0.0";
aarch64-darwin = "23.3.0.23.09";
}
.${stdenv.hostPlatform.system} or throwSystem;

Expand All @@ -40,6 +42,7 @@ let
x86_64-linux = "2110000";
aarch64-linux = "191000";
x86_64-darwin = "198000";
aarch64-darwin = "233023";
}
.${stdenv.hostPlatform.system} or throwSystem;

Expand Down Expand Up @@ -67,18 +70,33 @@ let
tools = "sha256-1xFFGZapFq9ogGQ6ePSv4PrXl5qOAgRZWAp4mJ5uxdU=";
odbc = "sha256-S6+5P4daK/+nXwoHmOkj4DIkHtwdzO5GOkCCI612bRY=";
};
aarch64-darwin = {
basic = "sha256-G83bWDhw9wwjLVee24oy/VhJcCik7/GtKOzgOXuo1/4=";
sdk = "sha256-PerfzgietrnAkbH9IT7XpmaFuyJkPHx0vl4FCtjPzLs=";
sqlplus = "sha256-khOjmaExAb3rzWEwJ/o4XvRMQruiMw+UgLFtsOGn1nY=";
tools = "sha256-gA+SbgXXpY12TidpnjBzt0oWQ5zLJg6wUpzpSd/N5W4=";
odbc = "sha256-JzoSdH7mJB709cdXELxWzpgaNTjOZhYH/wLkdzKA2N0=";
};
}
.${stdenv.hostPlatform.system} or throwSystem;

# rels per component and architecture, optional
rels = { }.${stdenv.hostPlatform.system} or { };
rels =
{
aarch64-darwin = {
basic = "1";
tools = "1";
};
}
.${stdenv.hostPlatform.system} or { };

# convert platform to oracle architecture names
arch =
{
x86_64-linux = "linux.x64";
aarch64-linux = "linux.arm64";
x86_64-darwin = "macos.x64";
aarch64-darwin = "macos.arm64";
}
.${stdenv.hostPlatform.system} or throwSystem;

Expand All @@ -87,15 +105,20 @@ let
x86_64-linux = "linux";
aarch64-linux = "linux";
x86_64-darwin = "mac";
aarch64-darwin = "mac";
}
.${stdenv.hostPlatform.system} or throwSystem;

suffix =
{
aarch64-darwin = ".dmg";
}
.${stdenv.hostPlatform.system} or "dbru.zip";

# calculate the filename of a single zip file
srcFilename =
component: arch: version: rel:
"instantclient-${component}-${arch}-${version}"
+ (optionalString (rel != "") "-${rel}")
+ "dbru.zip"; # ¯\_(ツ)_/¯
"instantclient-${component}-${arch}-${version}" + (optionalString (rel != "") "-${rel}") + suffix;

# fetcher for the non clickthrough artifacts
fetcher =
Expand All @@ -111,21 +134,25 @@ let
(fetcher (srcFilename component arch version rels.${component} or "") hashes.${component} or "")
) components;

isDarwinAarch64 = stdenv.hostPlatform.system == "aarch64-darwin";

pname = "oracle-instantclient";
extLib = stdenv.hostPlatform.extensions.sharedLibrary;
in
stdenv.mkDerivation {
inherit pname version srcs;

buildInputs =
[ (lib.getLib stdenv.cc.cc) ]
[
(lib.getLib stdenv.cc.cc)
]
++ optional stdenv.hostPlatform.isLinux libaio
++ optional odbcSupport unixODBC;

nativeBuildInputs =
[
makeWrapper
unzip
(if isDarwinAarch64 then _7zz else unzip)
]
++ optional stdenv.hostPlatform.isLinux autoPatchelfHook
++ optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
Expand All @@ -136,7 +163,7 @@ stdenv.mkDerivation {
"lib"
];

unpackCmd = "unzip $curSrc";
unpackCmd = if isDarwinAarch64 then "7zz x $curSrc -aoa -oinstantclient" else "unzip $curSrc";

installPhase = ''
mkdir -p "$out/"{bin,include,lib,"share/java","share/${pname}-${version}/demo/"} $lib/lib
Expand Down Expand Up @@ -174,6 +201,7 @@ stdenv.mkDerivation {
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
maintainers = with maintainers; [ dylanmtaylor ];
hydraPlatforms = [ ];
Expand Down

0 comments on commit 49fffe9

Please sign in to comment.