1{
2 lib,
3 stdenv,
4 fetchurl,
5 fetchpatch,
6 libX11,
7 libXext,
8 xorgproto,
9 libICE,
10 libSM,
11 libpng12,
12 zlib,
13}:
14
15stdenv.mkDerivation rec {
16 pname = "lincity";
17 version = "1.13.1";
18
19 src = fetchurl {
20 url = "mirror://sourceforge/lincity/${pname}-${version}.tar.gz";
21 sha256 = "0p81wl7labyfb6rgp0hi42l2akn3n7r2bnxal1wyvjylzw8vsk3v";
22 };
23
24 buildInputs = [
25 libICE
26 libpng12
27 libSM
28 libX11
29 libXext
30 xorgproto
31 zlib
32 ];
33
34 patches = [
35 (fetchpatch {
36 url = "https://sources.debian.net/data/main/l/lincity/1.13.1-13/debian/patches/extern-inline-functions-777982";
37 sha256 = "06dp3zwk0z5wr5a3xaaj2my75vcjcy98vc22hsag7ggd9jwrkcp0";
38 })
39 (fetchpatch {
40 url = "https://sources.debian.net/data/main/l/lincity/1.13.1-13/debian/patches/clang-ftbfs-757859";
41 sha256 = "098rnywcsyc0m11x4a5m3dza8i0jmfh6pacfgma1vvxpsfkb6ngp";
42 })
43 (fetchpatch {
44 url = "https://sources.debian.org/data/main/l/lincity/1.13.1-16/debian/patches/fix-implicit-declarations-823432";
45 hash = "sha256-S9TQ7KcmGGsQeTKLXqF/9FDXv/+WjrEPL4ly7DSki1s=";
46 })
47 (fetchpatch {
48 url = "https://sources.debian.org/data/main/l/lincity/1.13.1-16/debian/patches/fix-implicit-function-declarations-1066295";
49 hash = "sha256-KlmXBWPI8lFWO8kPA78uG52DCs8NeGmNNFpZYfCwo5M=";
50 })
51 (fetchpatch {
52 url = "https://sources.debian.org/data/main/l/lincity/1.13.1-16/debian/patches/delay_timers";
53 hash = "sha256-IxstC74R7kige0ormFLGEj4uzbJt/b8bLmygheN08II=";
54 })
55 (fetchpatch {
56 url = "https://sources.debian.org/data/main/l/lincity/1.13.1-16/debian/patches/map-max-draw";
57 hash = "sha256-9qLPrmEKMMrSVwqtEvoiyjPPo1eLO3u6bCJslubmBJU=";
58 })
59 ];
60
61 # Workaround build failure on -fno-common toolchains like upstream
62 # gcc-10. Otherwise build fails as:
63 # ld: modules/.libs/libmodules.a(rocket_pad.o):/build/lincity-1.13.1/modules/../screen.h:23:
64 # multiple definition of `monthgraph_style'; ldsvguts.o:/build/lincity-1.13.1/screen.h:23: first defined here
65 env.NIX_CFLAGS_COMPILE = "-fcommon";
66
67 postPatch = ''
68 sed -e 's@\[MPS_INFO_CHARS\]@[MPS_INFO_CHARS+8]@' -i mps.c -i mps.h
69 '';
70
71 meta = with lib; {
72 description = "City simulation game";
73 mainProgram = "xlincity";
74 license = licenses.gpl2Plus;
75 homepage = "https://sourceforge.net/projects/lincity";
76 maintainers = [ ];
77 # ../lcintl.h:14:10: fatal error: 'libintl.h' file not found
78 broken = stdenv.hostPlatform.isDarwin;
79 };
80}