12 , enablePython ? false
16 isPython3 = enablePython && python.pythonAtLeast "3";
18 stdenv.mkDerivation rec {
22 src = fetchFromGitHub {
26 hash = "sha256-FlBHwNsqVSBE8dTDewoKkCbs8Jd/4d69MPpEFzg6Ruc=";
27 fetchSubmodules = true;
31 printVersion = writeShellScript "print-version" ''
32 echo -n ${lib.escapeShellArg version}
35 # avoid git dependency
36 cp ${printVersion} build-aux/git-version-gen
39 preConfigure = lib.optionalString (stdenv.hostPlatform.isDarwin && enablePython) ''
40 # prevent configure picking up stack_size from distutils.sysconfig
41 export PYTHON_EXTRA_LDFLAGS=" "
44 nativeBuildInputs = [ autoreconfHook pkg-config texinfo ]
45 ++ lib.optional enablePython swig;
47 buildInputs = [ pcre2 ]
48 ++ lib.optionals enablePython [ python ]
49 # configurePhase fails with python 3 when ncurses is missing
50 ++ lib.optional isPython3 ncurses
53 # prevent python tests from running when not building with python
54 configureFlags = lib.optional (!enablePython) "--disable-python";
57 doCheck = !stdenv.hostPlatform.isLinux;
59 # the "xmlsuite" test requires the libxml2 c library as well as the python module
60 nativeCheckInputs = lib.optionals enablePython [ libxml2 libxml2.dev ];
63 description = "Free implementation of the DWG file format";
64 homepage = "https://savannah.gnu.org/projects/libredwg/";
65 maintainers = with maintainers; [ tweber ];
66 license = licenses.gpl3Plus;
67 platforms = platforms.all;