diff options
author | adisbladis <adisbladis@gmail.com> | 2019-12-05 10:01:58 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-05 10:01:58 +0000 |
commit | 65cc85199c497bb58f1fbdcd24273e5222ce015f (patch) | |
tree | 8b9b7e5d9fd6114319e2043d6f5273be7d49f680 | |
parent | 8465cae85c316aa07890a73496357f93d5ef9e37 (diff) | |
parent | 6530535b20408fb4445ddb92eba1fc3c04a06ec0 (diff) | |
download | nixlib-65cc85199c497bb58f1fbdcd24273e5222ce015f.tar nixlib-65cc85199c497bb58f1fbdcd24273e5222ce015f.tar.gz nixlib-65cc85199c497bb58f1fbdcd24273e5222ce015f.tar.bz2 nixlib-65cc85199c497bb58f1fbdcd24273e5222ce015f.tar.lz nixlib-65cc85199c497bb58f1fbdcd24273e5222ce015f.tar.xz nixlib-65cc85199c497bb58f1fbdcd24273e5222ce015f.tar.zst nixlib-65cc85199c497bb58f1fbdcd24273e5222ce015f.zip |
Merge pull request #73866 from FRidh/manylinux
manylinux packages for Python
-rw-r--r-- | pkgs/development/interpreters/python/manylinux/default.nix | 83 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 2 |
2 files changed, 85 insertions, 0 deletions
diff --git a/pkgs/development/interpreters/python/manylinux/default.nix b/pkgs/development/interpreters/python/manylinux/default.nix new file mode 100644 index 000000000000..428e04f4f922 --- /dev/null +++ b/pkgs/development/interpreters/python/manylinux/default.nix @@ -0,0 +1,83 @@ +{ lib, pkgs }: + +let + # Create a derivation that links all desired manylinux libraries + createManyLinuxPackage = name: libs: let + drvs = lib.unique (lib.attrValues libs); + names = lib.attrNames libs; + in pkgs.runCommand name { + buildInputs = drvs; + } '' + mkdir -p $out/lib + num_found=0 + + IFS=: + export DESIRED_LIBRARIES=${lib.concatStringsSep ":" names} + export LIBRARY_PATH=${lib.makeLibraryPath drvs} + for desired in $DESIRED_LIBRARIES; do + for path in $LIBRARY_PATH; do + if [ -e $path/$desired ]; then + echo "FOUND $path/$desired" + ln -s $path/$desired $out/lib/$desired + num_found=$((num_found+1)) + break + fi + done + done + + num_desired=${toString (lib.length names)} + echo "Found $num_found of $num_desired libraries" + if [ "$num_found" -ne "$num_desired" ]; then + echo "Error: not all desired libraries were found" + exit 1 + fi + ''; + + # https://www.python.org/dev/peps/pep-0599/ + manylinux2014Libs = with pkgs; { + "libgcc_s.so.1" = glibc; + "libstdc++.so.6" = stdenv.cc.cc; + "libm.so.6" = glibc; + "libdl.so.2" = glibc; + "librt.so.1" = glibc; + "libc.so.6" = glibc; + "libnsl.so.1" = glibc; + "libutil.so.1" = glibc; + "libpthread.so.0" = glibc; + "libresolv.so.2" = glibc; + "libX11.so.6" = xorg.libX11; + "libXext.so.6" = xorg.libXext; + "libXrender.so.1" = xorg.libXrender; + "libICE.so.6" = xorg.libICE; + "libSM.so.6" = xorg.libSM; + "libGL.so.1" = libGL; + "libgobject-2.0.so.0" = glib; + "libgthread-2.0.so.0" = glib; + "libglib-2.0.so.0" = glib; + }; + + # https://www.python.org/dev/peps/pep-0571/ + manylinux2010Libs = manylinux2014Libs; + + # https://www.python.org/dev/peps/pep-0513/ + manylinux1Libs = manylinux2010Libs // (with pkgs; { + "libpanelw.so.5" = ncurses5; + "libncursesw.so.5" = ncurses5; + "libcrypt.so.1" = glibc; + }); +in { + # List of libraries that are needed for manylinux compatibility. + # When using a wheel that is manylinux1 compatible, just extend + # the `buildInputs` with one of these `manylinux` lists. + # Additionally, add `autoPatchelfHook` to `nativeBuildInputs`. + manylinux1 = lib.unique (lib.attrValues manylinux1Libs); + manylinux2010 = lib.unique (lib.attrValues manylinux2010Libs); + manylinux2014 = lib.unique (lib.attrValues manylinux2014Libs); + + # These are symlink trees to the relevant libs and are typically not needed + # These exist so as to quickly test whether all required libraries are provided + # by the mapped packages. + manylinux1Package = createManyLinuxPackage "manylinux1" manylinux1Libs; + manylinux2010Package = createManyLinuxPackage "manylinux2010" manylinux2010Libs; + manylinux2014Package = createManyLinuxPackage "manylinux2014" manylinux2014Libs; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 488fdb046cd7..31a413bf523b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9224,6 +9224,8 @@ in pypy27Packages = pypy27.pkgs; pypy3Packages = pypy3.pkgs; + pythonManylinuxPackages = callPackage ./../development/interpreters/python/manylinux { }; + update-python-libraries = callPackage ../development/interpreters/python/update-python-libraries { }; # Should eventually be moved inside Python interpreters. |