1{
2 lib,
3 stdenv,
4 env,
5 fetchFromGitHub,
6 pkg-config,
7 qbs,
8 wrapQtAppsHook,
9 qtbase,
10 qtdeclarative,
11 qttools,
12 qtwayland,
13 qtsvg,
14 zlib,
15 zstd,
16 libGL,
17}:
18
19let
20 qtEnv = env "tiled-qt-env" [
21 qtbase
22 qtdeclarative
23 qtsvg
24 qttools
25 qtwayland
26 ];
27in
28
29stdenv.mkDerivation rec {
30 pname = "tiled";
31 version = "1.11.90";
32
33 src = fetchFromGitHub {
34 owner = "mapeditor";
35 repo = pname;
36 rev = "v${version}";
37 sha256 = "sha256-gGsozdFEE5c315DF+EsIY9wGv50wwrOBycejTkVwEHA=";
38 };
39
40 nativeBuildInputs = [
41 pkg-config
42 qbs
43 wrapQtAppsHook
44 ];
45 buildInputs = [
46 qtEnv
47 zlib
48 zstd
49 libGL
50 ];
51
52 outputs = [
53 "out"
54 "dev"
55 ];
56
57 strictDeps = true;
58
59 configurePhase = ''
60 runHook preConfigure
61
62 qbs setup-qt --settings-dir . ${qtEnv}/bin/qmake qtenv
63 qbs config --settings-dir . defaultProfile qtenv
64 qbs resolve --settings-dir . config:release qbs.installPrefix:/ projects.Tiled.installHeaders:true
65
66 runHook postConfigure
67 '';
68
69 buildPhase = ''
70 runHook preBuild
71
72 qbs build --settings-dir . config:release
73
74 runHook postBuild
75 '';
76
77 installPhase = ''
78 runHook preInstall
79
80 qbs install --settings-dir . --install-root $out config:release
81
82 runHook postInstall
83 '';
84
85 meta = with lib; {
86 description = "Free, easy to use and flexible tile map editor";
87 homepage = "https://www.mapeditor.org/";
88 license = with licenses; [
89 bsd2 # libtiled and tmxviewer
90 gpl2Plus # all the rest
91 ];
92 maintainers = with maintainers; [
93 dywedir
94 ryan4yin
95 ];
96 platforms = platforms.linux;
97 };
98}