python27: use ffi/expat as system libraries

Without `--with-system-{ffi,expat}` flags, Python will use its own
embedded libraries that are out-of-date. Thanks to it, they can be a
security issue. So let's use our own libraries instead.

This is already what Python 3.x does, so should be safe.
This commit is contained in:
Thiago Kenji Okada
2022-12-18 00:01:57 +00:00
parent 06db865023
commit 47f904bad1
@@ -199,11 +199,10 @@ let
"--enable-shared"
] ++ [
"--with-threads"
"--enable-unicode=ucs${toString ucsEncoding}"
] ++ optionals (stdenv.hostPlatform.isCygwin || stdenv.hostPlatform.isAarch64) [
"--with-system-ffi"
] ++ optionals stdenv.hostPlatform.isCygwin [
"--with-system-expat"
"--enable-unicode=ucs${toString ucsEncoding}"
] ++ optionals stdenv.hostPlatform.isCygwin [
"ac_cv_func_bind_textdomain_codeset=yes"
] ++ optionals stdenv.isDarwin [
"--disable-toolbox-glue"
@@ -238,10 +237,7 @@ let
strictDeps = true;
buildInputs =
optional (stdenv ? cc && stdenv.cc.libc != null) stdenv.cc.libc ++
[ bzip2 openssl zlib ]
++ optional (stdenv.hostPlatform.isCygwin || stdenv.hostPlatform.isAarch64) libffi
++ optional stdenv.hostPlatform.isCygwin expat
++ [ db gdbm ncurses sqlite readline ]
[ bzip2 openssl zlib libffi expat db gdbm ncurses sqlite readline ]
++ optionals x11Support [ tcl tk libX11 ]
++ optional (stdenv.isDarwin && configd != null) configd;
nativeBuildInputs =