mkl: extract static libraries optionally

This commit is contained in:
Roberto Di Remigio 2019-12-15 22:43:23 +01:00
parent e0605b3174
commit 6cc9bbe2fd
No known key found for this signature in database
GPG Key ID: E4FADFE6DFB29C6E
2 changed files with 25 additions and 20 deletions

View File

@ -1,4 +1,4 @@
{ stdenvNoCC, fetchurl, rpmextract, undmg, darwin }: { stdenvNoCC, fetchurl, rpm, cpio, undmg, darwin, enableStatic ? false }:
/* /*
For details on using mkl as a blas provider for python packages such as numpy, For details on using mkl as a blas provider for python packages such as numpy,
numexpr, scipy, etc., see the Python section of the NixPkgs manual. numexpr, scipy, etc., see the Python section of the NixPkgs manual.
@ -39,7 +39,7 @@ in stdenvNoCC.mkDerivation {
then then
[ undmg darwin.cctools ] [ undmg darwin.cctools ]
else else
[ rpmextract ]; [ rpm cpio ];
buildPhase = if stdenvNoCC.isDarwin then '' buildPhase = if stdenvNoCC.isDarwin then ''
for f in Contents/Resources/pkg/*.tgz; do for f in Contents/Resources/pkg/*.tgz; do
@ -47,24 +47,28 @@ in stdenvNoCC.mkDerivation {
done done
'' else '' '' else ''
# Common stuff # Common stuff
rpmextract rpm/intel-mkl-common-c-${rpm-ver}.noarch.rpm rpm2cpio rpm/intel-mkl-common-c-${rpm-ver}.noarch.rpm | cpio -idv
rpmextract rpm/intel-mkl-common-f-${rpm-ver}.noarch.rpm rpm2cpio rpm/intel-mkl-common-f-${rpm-ver}.noarch.rpm | cpio -idv
# Dynamic libraries # Dynamic libraries
rpmextract rpm/intel-mkl-cluster-rt-${rpm-ver}.x86_64.rpm rpm2cpio rpm/intel-mkl-cluster-rt-${rpm-ver}.x86_64.rpm | cpio -idv
rpmextract rpm/intel-mkl-core-rt-${rpm-ver}.x86_64.rpm rpm2cpio rpm/intel-mkl-core-rt-${rpm-ver}.x86_64.rpm | cpio -idv
rpmextract rpm/intel-mkl-gnu-f-rt-${rpm-ver}.x86_64.rpm rpm2cpio rpm/intel-mkl-gnu-f-rt-${rpm-ver}.x86_64.rpm | cpio -idv
rpmextract rpm/intel-mkl-gnu-rt-${rpm-ver}.x86_64.rpm rpm2cpio rpm/intel-mkl-gnu-rt-${rpm-ver}.x86_64.rpm | cpio -idv
# Static libraries
rpmextract rpm/intel-mkl-cluster-${rpm-ver}.x86_64.rpm
rpmextract rpm/intel-mkl-core-${rpm-ver}.x86_64.rpm
rpmextract rpm/intel-mkl-gnu-${rpm-ver}.x86_64.rpm
rpmextract rpm/intel-mkl-gnu-f-${rpm-ver}.x86_64.rpm
# Intel OpenMP runtime # Intel OpenMP runtime
rpmextract rpm/intel-openmp-${openmp-ver}.x86_64.rpm rpm2cpio rpm/intel-openmp-${openmp-ver}.x86_64.rpm | cpio -idv
''; '' + (if enableStatic then ''
# Static libraries
rpm2cpio rpm/intel-mkl-core-${rpm-ver}.x86_64.rpm | cpio -idv
rpm2cpio rpm/intel-mkl-cluster-${rpm-ver}.x86_64.rpm | cpio -idv
rpm2cpio rpm/intel-mkl-gnu-${rpm-ver}.x86_64.rpm | cpio -idv
rpm2cpio rpm/intel-mkl-gnu-f-${rpm-ver}.x86_64.rpm | cpio -idv
'' else ''
# Extract the PkgConfig files for dynamic libraries only
rpm2cpio rpm/intel-mkl-core-${rpm-ver}.x86_64.rpm | cpio -idv '*dynamic*.pc'
''
);
installPhase = '' installPhase = ''
for f in $(find . -name 'mkl*.pc') ; do for f in $(find . -name 'mkl*.pc') ; do

View File

@ -55,7 +55,7 @@ self: super: let
removeUnknownConfigureFlags = f: with self.lib; removeUnknownConfigureFlags = f: with self.lib;
remove "--disable-shared" remove "--disable-shared"
(remove "--enable-static" f); (remove "--enable-static" f);
ocamlFixPackage = b: ocamlFixPackage = b:
b.overrideAttrs (o: { b.overrideAttrs (o: {
configurePlatforms = [ ]; configurePlatforms = [ ];
@ -63,7 +63,7 @@ self: super: let
buildInputs = o.buildInputs ++ o.nativeBuildInputs or [ ]; buildInputs = o.buildInputs ++ o.nativeBuildInputs or [ ];
propagatedNativeBuildInputs = o.propagatedBuildInputs or [ ]; propagatedNativeBuildInputs = o.propagatedBuildInputs or [ ];
}); });
ocamlStaticAdapter = _: super: ocamlStaticAdapter = _: super:
self.lib.mapAttrs self.lib.mapAttrs
(_: p: if p ? overrideAttrs then ocamlFixPackage p else p) (_: p: if p ? overrideAttrs then ocamlFixPackage p else p)
@ -153,6 +153,7 @@ in {
static = true; static = true;
}; };
openblas = super.openblas.override { enableStatic = true; }; openblas = super.openblas.override { enableStatic = true; };
mkl = super.mkl.override { enableStatic = true; };
nix = super.nix.override { withAWS = false; }; nix = super.nix.override { withAWS = false; };
# openssl 1.1 doesn't compile # openssl 1.1 doesn't compile
openssl = super.openssl_1_0_2.override { openssl = super.openssl_1_0_2.override {
@ -209,7 +210,7 @@ in {
kmod = super.kmod.override { kmod = super.kmod.override {
withStatic = true; withStatic = true;
}; };
curl = super.curl.override { curl = super.curl.override {
# a very sad story: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=439039 # a very sad story: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=439039
gssSupport = false; gssSupport = false;
@ -241,6 +242,6 @@ in {
ocaml-ng = self.lib.mapAttrs (_: set: ocaml-ng = self.lib.mapAttrs (_: set:
if set ? overrideScope' then set.overrideScope' ocamlStaticAdapter else set if set ? overrideScope' then set.overrideScope' ocamlStaticAdapter else set
) super.ocaml-ng; ) super.ocaml-ng;
python27 = super.python27.override { static = true; }; python27 = super.python27.override { static = true; };
} }