-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanylinux1.nix
executable file
·76 lines (67 loc) · 1.92 KB
/
manylinux1.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Contributed by @thomasjm as a gist:
# https://gist.github.com/thomasjm/b0e757213096527faa888cd18b07c182
{stdenv, pkgs}:
with stdenv.lib;
with pkgs;
rec {
# To be manylinux1 compatible, we have to be able to link against any of the libraries below (PEP 513)
# https://www.python.org/dev/peps/pep-0513
desiredLibraries = [
"libpanelw.so.5"
"libncursesw.so.5"
"libgcc_s.so.1"
"libstdc++.so.6"
"libsndfile.so.1"
"libm.so.6"
"libfluidsynth.so.1"
"libdl.so.2"
"librt.so.1"
"libcrypt.so.1"
"libc.so.6"
"libnsl.so.1"
"libutil.so.1"
"libpthread.so.0"
"libresolv.so.2"
"libX11.so.6"
"libXext.so.6"
"libXrender.so.1"
"libICE.so.6"
"libSM.so.6"
"libGL.so.1"
"libgobject-2.0.so.0"
"libgthread-2.0.so.0"
"libglib-2.0.so.0"
];
# The desired libraries can be collectively found in these packages
libs = [glib libGL ncurses5 xorg.libX11 xorg.libXrender xorg.libXext xorg.libICE xorg.libSM glibc gcc7.cc libsndfile fluidsynth_1];
package = stdenv.mkDerivation {
name = "manylinux1_libs";
unpackPhase = "true";
buildInputs = libs;
propagatedBuildInputs = libs;
buildPhase = ''
mkdir -p $out/lib
num_found=0
IFS=:
export DESIRED_LIBRARIES=${concatStringsSep ":" desiredLibraries}
export LIBRARY_PATH=${makeLibraryPath libs}
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 (length desiredLibraries)}
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
'';
installPhase = "true";
};
}