lol
1{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, texinfo, pcre2
2, enablePython ? false, python ? null, swig, libxml2, ncurses
3}:
4let
5 isPython3 = enablePython && python.pythonAtLeast "3";
6in
7stdenv.mkDerivation rec {
8 pname = "libredwg";
9 version = "0.12.4";
10
11 src = fetchFromGitHub {
12 owner = "LibreDWG";
13 repo = pname;
14 rev = version;
15 sha256 = "sha256-CZZ5/uCls2tY3PKmD+hBBvp7d7KX8nZuCPf03sa4iXc=";
16 fetchSubmodules = true;
17 };
18
19 nativeBuildInputs = [ autoreconfHook pkg-config texinfo ]
20 ++ lib.optional enablePython swig;
21
22 buildInputs = [ pcre2 ]
23 ++ lib.optionals enablePython [ python ]
24 # configurePhase fails with python 3 when ncurses is missing
25 ++ lib.optional isPython3 ncurses
26 ;
27
28 # prevent python tests from running when not building with python
29 configureFlags = lib.optional (!enablePython) "--disable-python";
30
31 doCheck = true;
32
33 # the "xmlsuite" test requires the libxml2 c library as well as the python module
34 checkInputs = lib.optionals enablePython [ libxml2 libxml2.dev ];
35
36 meta = with lib; {
37 broken = stdenv.isDarwin && stdenv.isAarch64;
38 description = "Free implementation of the DWG file format";
39 homepage = "https://savannah.gnu.org/projects/libredwg/";
40 maintainers = with maintainers; [ tweber ];
41 license = licenses.gpl3Plus;
42 platforms = platforms.all;
43 };
44}