nixpkgs/pkgs/development/libraries/py3c/default.nix
Sergei Trofimovich c1ff7da0a9 py3c: unconditionally drop -Werror (fix gcc-11 build)
On gcc-11 build fails as:

    $ nix-build -E 'with import ./. {}; py3c.override { stdenv = gcc11Stdenv; }'

    gcc -fno-strict-aliasing ... -Werror -Wall
    cc1plus: warning:
      command-line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
    In file included from /nix/store/...-python-2.7.18/include/python2.7/Python.h:88,
                     from test_py3c.cpp:4:
    /nix/store/...-python-2.7.18/include/python2.7/unicodeobject.h:534:24:
      error: ISO C++17 does not allow 'register' storage class specifier [-Werror=register]
      534 |     register PyObject *obj,     /* Object */
          |                        ^~~

The fix was already present o clang toolchain. Let's extendt it to all toolchains.
2021-09-28 13:13:35 +01:00

38 lines
850 B
Nix

{ lib, stdenv, fetchFromGitHub, python2, python3 }:
stdenv.mkDerivation rec {
pname = "py3c";
version = "1.3.1";
src = fetchFromGitHub {
owner = "encukou";
repo = pname;
rev = "v${version}";
sha256 = "04i2z7hrig78clc59q3i1z2hh24g7z1bfvxznlzxv00d4s57nhpi";
};
postPatch = ''
# clang and gcc-11 complain about 'register' keywords used by
# python-2.7. Let's avoid blanket -Werror.
substituteInPlace test/setup.py \
--replace "'-Werror', " ""
'';
makeFlags = [
"prefix=${placeholder "out"}"
];
doCheck = true;
checkInputs = [
python2
python3
];
meta = with lib; {
homepage = "https://github.com/encukou/py3c";
description = "Python 2/3 compatibility layer for C extensions";
license = licenses.mit;
maintainers = with maintainers; [ ajs124 dotlambda ];
};
}