1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 testers,
6 doxygen,
7 qmake,
8}:
9
10stdenv.mkDerivation (finalAttrs: {
11 pname = "qdjango";
12 version = "unstable-2018-03-07";
13
14 src = fetchFromGitHub {
15 owner = "jlaine";
16 repo = "qdjango";
17 rev = "bda4755ece9d173a67b880e498027fcdc51598a8";
18 hash = "sha256-5MfRfsIlv73VMvKMBCLviXFovyGH0On5ukLIEy7zwkk=";
19 };
20
21 outputs = [
22 "out"
23 "dev"
24 "doc"
25 ];
26
27 postPatch =
28 ''
29 # HTML docs depend on regular docs
30 substituteInPlace qdjango.pro \
31 --replace 'dist.depends = docs' 'htmldocs.depends = docs'
32 ''
33 + lib.optionalString stdenv.hostPlatform.isDarwin ''
34 # tst_Auth:constIterator (tests/db/auth/tst_auth.cpp:624) fails on Darwin?
35 # QVERIFY(&*(it += 2) == 0) evals to false
36 substituteInPlace tests/db/db.pro \
37 --replace 'auth' ""
38 '';
39
40 qmakeFlags = [
41 # Uses Qt testing infrastructure via QMake CONFIG testcase,
42 # defaults to installing all testcase targets under Qt prefix
43 # https://github.com/qt/qtbase/blob/29400a683f96867133b28299c0d0bd6bcf40df35/mkspecs/features/testcase.prf#L110-L120
44 "CONFIG+=no_testcase_installs"
45
46 # Qmake-generated pkg-config files default to Qt prefix
47 "QMAKE_PKGCONFIG_PREFIX=${placeholder "out"}"
48 ];
49
50 nativeBuildInputs = [
51 doxygen
52 qmake
53 ];
54
55 dontWrapQtApps = true;
56
57 doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
58
59 preCheck = lib.optionalString stdenv.hostPlatform.isDarwin ''
60 # at this point in the build, install_name for dylibs hasn't been patched yet so we need to set the library path.
61 # for some reason, this doesn't work when just exporting the needed paths even though the autogenerated wrappers
62 # should at most prepend paths? just patch them into the wrappers instead
63 substituteInPlace $(find tests -name target_wrapper.sh) \
64 --replace 'DYLD_LIBRARY_PATH=' "DYLD_LIBRARY_PATH=$PWD/src/db:$PWD/src/http:"
65 '';
66
67 passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
68
69 meta = with lib; {
70 description = "Qt-based C++ web framework";
71 homepage = "https://github.com/jlaine/qdjango";
72 license = licenses.lgpl21Plus;
73 maintainers = with maintainers; [ OPNA2608 ];
74 platforms = platforms.all;
75 pkgConfigModules = [
76 "qdjango-db"
77 "qdjango-http"
78 ];
79 };
80})