fix oneapi

This commit is contained in:
2023-07-18 20:17:38 +08:00
parent 130cb67787
commit f368ed87b5
2 changed files with 36 additions and 61 deletions

1
.gitignore vendored
View File

@@ -1,2 +1,3 @@
result result
result-man result-man
outputs

View File

@@ -1,19 +1,15 @@
{ {
lib, stdenv, fetchurl, autoPatchelfHook lib, stdenv, fetchurl, autoPatchelfHook,
# glibc, zlib, file ncurses, xorg
# glibc, libX11, glib, libnotify, xdg-utils, ncurses, nss,
# at-spi2-core, libxcb, libdrm, gtk3, mesa, qt515, zlib, xorg, atk, nspr, dbus,
# pango, cairo, gdk-pixbuf, cups, expat, libxkbcommon, alsaLib, file, at-spi2-atk,
# freetype, fontconfig
}: }:
stdenv.mkDerivation rec stdenv.mkDerivation rec
{ {
version = "2023.1"; version = "2023.1";
pname = "intel-oneapi"; pname = "oneapi";
sourceRoot = "."; sourceRoot = ".";
srcs = [ src = [
(fetchurl { (fetchurl {
url = "https://registrationcenter-download.intel.com/akdlm/IRC_NAS/7deeaac4-f605-4bcf-a81b-ea7531577c61/l_BaseKit_p_2023.1.0.46401_offline.sh"; url = "https://registrationcenter-download.intel.com/akdlm/IRC_NAS/7deeaac4-f605-4bcf-a81b-ea7531577c61/l_BaseKit_p_2023.1.0.46401_offline.sh";
sha256 = "0cn32zqfbjv0vq43g6ap10crnsyk7nldyqpyyzn6g52j5h45g93l"; sha256 = "0cn32zqfbjv0vq43g6ap10crnsyk7nldyqpyyzn6g52j5h45g93l";
@@ -23,8 +19,11 @@ stdenv.mkDerivation rec
sha256 = "0wfya02lljq4iid0nc5sn4055dkvgxwrc40x7qbgpdprzqx4a8l8"; sha256 = "0wfya02lljq4iid0nc5sn4055dkvgxwrc40x7qbgpdprzqx4a8l8";
}) })
]; ];
basekit = "${builtins.elemAt src 0}";
hpckit = "${builtins.elemAt src 1}";
# nativeBuildInputs = [ file ]; nativeBuildInputs = [ autoPatchelfHook ];
propagatedBuildInputs = [ ncurses stdenv.cc.cc.lib xorg.libXau ];
# propagatedBuildInputs = # propagatedBuildInputs =
# [ # [
@@ -45,57 +44,32 @@ stdenv.mkDerivation rec
# xorg.libXrandr # xorg.libXrandr
# ]; # ];
# phases = [ "installPhase" "fixupPhase" "installCheckPhase" "distPhase" ]; unpackPhase =
let
unpack = toolkit: "bash ${toolkit} --extract-only --extract-folder $TMP";
in
"
${unpack basekit}
${unpack hpckit}
";
patchPhase =
"
patchShebangs $TMP
autoPatchelf $TMP
";
installPhase = installPhase =
'' let
cd $sourceRoot install = toolkit:
mkdir -p $out/tmp "
base_kit=$(echo $srcs|cut -d" " -f1) export HOME=$TMP
hpc_kit=$(echo $srcs|cut -d" " -f2) toolkit_name=$(basename ${toolkit} | sed -e 's/\.sh//g' | sed -e 's/.*-//g')
# Extract files $TMP/\${toolkit_name}/install.sh --install-dir $out --eula accept -s
bash $base_kit --log $out/basekit_install_log --extract-only --extract-folder $out/tmp -a --install-dir $out \ ";
--download-cache $out/tmp --download-dir $out/tmp --log-dir $out/tmp -s --eula accept in
bash $hpc_kit --log $out/hpckit_install_log --extract-only --extract-folder $out/tmp -a --install-dir $out \ "
--download-cache $out/tmp --download-dir $out/tmp --log-dir $out/tmp -s --eula accept runHook preInstall
for file in `grep -l -r "/bin/sh" $out/tmp` ${install basekit}
do ${install hpckit}
sed -e "s,/bin/sh,${stdenv.shell},g" -i $file runHook postInstall
done ";
export HOME=$out
# Patch the bootstraper binaries and libs
for files in `find $out/tmp/l_BaseKit_p_${version}_offline/lib`
do
patchelf --set-rpath "${glibc}/lib:$libPath:$out/tmp/l_BaseKit_p_${version}_offline/lib" $file 2>/dev/null || true
done
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" --set-rpath "${glibc}/lib:$libPath:$out/tmp/l_BaseKit_p_${version}_offline/lib" $out/tmp/l_BaseKit_p_${version}_offline/bootstrapper
# launch install
export LD_LIBRARY_PATH=${zlib}/lib
$out/tmp/l_BaseKit_p_${version}_offline/install.sh --install-dir $out --download-cache $out/tmp \
--download-dir $out/tmp --log-dir $out/tmp --eula accept -s --ignore-errors
$out/tmp/l_HPCKit_p_${version}_offline/install.sh --install-dir $out --download-cache $out/tmp --download-dir $out/tmp --log-dir $out/tmp --eula accept -s --ignore-errors
rm -rf $out/tmp
'';
# postFixup = ''
# echo "Fixing rights..."
# chmod u+w -R $out
# echo "Patching rpath and interpreter..."
# for dir in `find $out -mindepth 1 -maxdepth 1 -type d`
# do
# echo " $dir"
# for file in `find $dir -type f -exec file {} + | grep ELF| awk -F: '{print $1}'`
# do
# echo " $file"
# patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" --set-rpath '$ORIGIN'":${glibc}/lib:$libPath:$dir/latest/lib64" $file 2>/dev/null || true
# done
# done
# '';
meta = {
description = "Intel OneAPI Basekit + HPCKit";
maintainers = [ lib.maintainers.bzizou ];
platforms = lib.platforms.linux;
license = lib.licenses.unfree;
};
} }