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