Add Darwin as a supported platform

This commit is contained in:
Benjamin Hipple 2018-10-02 22:53:48 -04:00
parent d7c1d04af4
commit ba02a2c371

View File

@ -1,4 +1,4 @@
{ stdenvNoCC, writeText, fetchurl, rpm, cpio, openmp }: { stdenvNoCC, writeText, fetchurl, rpmextract, openmp, undmg }:
stdenvNoCC.mkDerivation rec { stdenvNoCC.mkDerivation rec {
name = "mkl-${version}"; name = "mkl-${version}";
@ -6,24 +6,40 @@ stdenvNoCC.mkDerivation rec {
date = "2019.0"; date = "2019.0";
rel = "117"; rel = "117";
src = fetchurl { src = if stdenvNoCC.isDarwin
url = "http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/13575/l_mkl_${version}.tgz"; then
sha256 = "1bf7i54iqlf7x7fn8kqwmi06g30sxr6nq3ac0r871i6g0p3y47sf"; (fetchurl {
}; url = "http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/13565/m_mkl_${version}.dmg";
sha256 = "1f1jppac7vqwn00hkws0p4njx38ajh0n25bsjyb5d7jcacwfvm02";
})
else
(fetchurl {
url = "http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/13575/l_mkl_${version}.tgz";
sha256 = "1bf7i54iqlf7x7fn8kqwmi06g30sxr6nq3ac0r871i6g0p3y47sf";
});
buildInputs = [ rpm cpio ]; buildInputs = if stdenvNoCC.isDarwin then [ undmg ] else [ rpmextract ];
propagatedBuildInputs = [ openmp ]; propagatedBuildInputs = [ openmp ];
buildPhase = '' buildPhase = if stdenvNoCC.isDarwin then ''
rpm2cpio rpm/intel-mkl-common-c-${date}-${rel}-${date}-${rel}.noarch.rpm | cpio -idmv for f in Contents/Resources/pkg/*.tgz; do
rpm2cpio rpm/intel-mkl-core-rt-${date}-${rel}-${date}-${rel}.x86_64.rpm | cpio -idmv tar xzvf $f
''; done
'' else ''
rpmextract rpm/intel-mkl-common-c-${date}-${rel}-${date}-${rel}.noarch.rpm
rpmextract rpm/intel-mkl-core-rt-${date}-${rel}-${date}-${rel}.x86_64.rpm
'' ;
installPhase = '' installPhase = if stdenvNoCC.isDarwin then ''
mkdir -p $out/lib mkdir -p $out/lib
cp -r opt/intel/compilers_and_libraries_${version}/linux/mkl/include $out/ cp -r compilers_and_libraries_${version}/mac/mkl/include $out/
cp -r opt/intel/compilers_and_libraries_${version}/linux/mkl/lib/intel64_lin/* $out/lib/ cp -r compilers_and_libraries_${version}/mac/mkl/lib/* $out/lib/
cp license.txt $out/lib/ cp -r compilers_and_libraries_${version}/licensing/mkl/en/license.txt $out/lib/
'' else ''
mkdir -p $out/lib
cp -r opt/intel/compilers_and_libraries_${version}/linux/mkl/include $out/
cp -r opt/intel/compilers_and_libraries_${version}/linux/mkl/lib/intel64_lin/* $out/lib/
cp license.txt $out/lib/
''; '';
# Per license agreement, do not modify the binary # Per license agreement, do not modify the binary
@ -48,8 +64,8 @@ stdenvNoCC.mkDerivation rec {
threading models. threading models.
''; '';
homepage = https://software.intel.com/en-us/mkl; homepage = https://software.intel.com/en-us/mkl;
license = licenses.issl; license = [ licenses.issl licenses.unfreeRedistributable ];
platforms = [ "x86_64-linux" ]; platforms = [ "x86_64-linux" "x86_64-darwin" ];
maintainers = [ maintainers.bhipple ]; maintainers = [ maintainers.bhipple ];
}; };
} }