python-selenium: fix darwin build

/cc ZHF #36454
This commit is contained in:
Daiderd Jordan 2018-03-14 20:58:56 +01:00
parent 7c35fe9c0a
commit b02694dd45
No known key found for this signature in database
GPG Key ID: D02435D05B810C96

View File

@ -7,6 +7,19 @@
, xorg , xorg
}: }:
let
# Recompiling x_ignore_nofocus.so as the original one dlopen's libX11.so.6 by some
# absolute paths. Replaced by relative path so it is found when used in nix.
x_ignore_nofocus =
fetchFromGitHub {
owner = "SeleniumHQ";
repo = "selenium";
rev = "selenium-3.6.0";
sha256 = "13wf4hx4i7nhl4s8xkziwxl0km1j873syrj4amragj6mpip2wn8v";
};
in
buildPythonPackage rec { buildPythonPackage rec {
pname = "selenium"; pname = "selenium";
version = "3.6.0"; version = "3.6.0";
@ -23,21 +36,11 @@ buildPythonPackage rec {
geckodriver geckodriver
]; ];
# Recompiling x_ignore_nofocus.so as the original one dlopen's libX11.so.6 by some patchPhase = stdenv.lib.optionalString stdenv.isLinux ''
# absolute paths. Replaced by relative path so it is found when used in nix.
x_ignore_nofocus =
fetchFromGitHub {
owner = "SeleniumHQ";
repo = "selenium";
rev = "selenium-3.6.0";
sha256 = "13wf4hx4i7nhl4s8xkziwxl0km1j873syrj4amragj6mpip2wn8v";
};
patchPhase = ''
cp "${x_ignore_nofocus}/cpp/linux-specific/"* . cp "${x_ignore_nofocus}/cpp/linux-specific/"* .
substituteInPlace x_ignore_nofocus.c --replace "/usr/lib/libX11.so.6" "${xorg.libX11.out}/lib/libX11.so.6" substituteInPlace x_ignore_nofocus.c --replace "/usr/lib/libX11.so.6" "${xorg.libX11.out}/lib/libX11.so.6"
gcc -c -fPIC x_ignore_nofocus.c -o x_ignore_nofocus.o cc -c -fPIC x_ignore_nofocus.c -o x_ignore_nofocus.o
gcc -shared \ cc -shared \
-Wl,${if stdenv.isDarwin then "-install_name" else "-soname"},x_ignore_nofocus.so \ -Wl,${if stdenv.isDarwin then "-install_name" else "-soname"},x_ignore_nofocus.so \
-o x_ignore_nofocus.so \ -o x_ignore_nofocus.so \
x_ignore_nofocus.o x_ignore_nofocus.o