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