nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 libGLU,
6 libGL,
7 SDL,
8 scons,
9 SDL_ttf,
10 SDL_image,
11 zlib,
12 SDL_net,
13 speex,
14 libvorbis,
15 libogg,
16 boost,
17 fribidi,
18 bsdiff,
19 fetchpatch,
20}:
21let
22 version = "0.9.4";
23 patchlevel = "4";
24 tutorial4patch = fetchurl {
25 url = "http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=34;filename=tutorial-part4.map.bspatch;att=1;bug=595448";
26 name = "globulation2-tutorial4-map-patch-debian.bspatch";
27 sha256 = "d3511ac0f822d512c42abd34b3122f2990862d3d0af6ce464ff372f5bd7f35e9";
28 };
29in
30stdenv.mkDerivation rec {
31 name = "glob2-${version}.${patchlevel}";
32
33 src = fetchurl {
34 url = "mirror://savannah/glob2/${version}/${name}.tar.gz";
35 sha256 = "1f0l2cqp2g3llhr9jl6jj15k0wb5q8n29vqj99xy4p5hqs78jk8g";
36 };
37
38 patches = [
39 ./header-order.patch
40 ./public-buildproject.patch
41 (fetchpatch {
42 url = "https://bitbucket.org/giszmo/glob2/commits/c9dc715624318e4fea4abb24e04f0ebdd9cd8d2a/raw";
43 sha256 = "0017xg5agj3dy0hx71ijdcrxb72bjqv7x6aq7c9zxzyyw0mkxj0k";
44 })
45 (fetchpatch {
46 url = "https://sources.debian.org/data/main/g/glob2/0.9.4.4-6/debian/patches/10_pthread_underlinkage.patch";
47 sha256 = "sha256-L9POADlkgQbUQEUmx4s3dxXG9tS0w2IefpRGuQNRMI0=";
48 })
49 (fetchpatch {
50 url = "https://sources.debian.org/data/main/g/glob2/0.9.4.4-6/debian/patches/link-boost-system.patch";
51 sha256 = "sha256-ne6F2ZowB+TUmg3ePuUoPNxXI0ZJC6HEol3oQQHJTy4=";
52 })
53 (fetchpatch {
54 url = "https://sources.debian.org/data/main/g/glob2/0.9.4.4-6/debian/patches/scons.patch";
55 sha256 = "sha256-Gah7SoVcd/Aljs0Nqo3YF0lZImUWtrGM4HbbQ4yrhHU=";
56 })
57 (fetchpatch {
58 url = "https://sources.debian.org/data/main/g/glob2/0.9.4.4-6/debian/patches/boost-1.69.patch";
59 sha256 = "sha256-D7agFR4uyIHxQz690Q8EHPF+rTEoiGUpgkm7r5cL5SI=";
60 })
61 ];
62
63 postPatch = ''
64 cp campaigns/tutorial-part4.map{,.orig}
65 bspatch campaigns/tutorial-part4.map{.orig,} ${tutorial4patch}
66 sed -i -e "s@env = Environment()@env = Environment( ENV = os.environ )@" SConstruct
67 '';
68
69 # fix sdl-config for cross
70 # TODO: remaining *-config, and make it work for !(build.canExecute host)
71 preBuild = ''
72 substituteInPlace SConstruct \
73 --replace-fail sdl-config "${lib.getExe' (lib.getDev SDL) "sdl-config"}"
74 '';
75
76 nativeBuildInputs = [
77 scons
78 bsdiff # bspatch
79 ];
80 buildInputs = [
81 libGLU
82 libGL
83 SDL
84 SDL_ttf
85 SDL_image
86 zlib
87 SDL_net
88 speex
89 libvorbis
90 libogg
91 boost
92 fribidi
93 ];
94
95 sconsFlags = [
96 "BINDIR=${placeholder "out"}/bin"
97 "INSTALLDIR=${placeholder "out"}/share/globulation2"
98 "DATADIR=${placeholder "out"}/share/globulation2/glob2"
99 ];
100
101 NIX_LDFLAGS = "-lboost_system";
102
103 meta = {
104 description = "RTS without micromanagement";
105 mainProgram = "glob2";
106 maintainers = with lib.maintainers; [ raskin ];
107 platforms = lib.platforms.linux;
108 license = lib.licenses.gpl3;
109 broken = !stdenv.buildPlatform.canExecute stdenv.hostPlatform;
110 };
111 passthru.updateInfo.downloadPage = "http://globulation2.org/wiki/Download_and_Install";
112}