lol
1{stdenv, fetchurl, python, pil, pygame, SDL} @ args: with args;
2stdenv.mkDerivation {
3 name = "thePenguinMachine";
4
5 src = fetchurl {
6 url = http://www.migniot.com/matrix/projects/thepenguinmachine/ThePenguinMachine.tar.gz;
7 sha256 = "09ljks8vj75g00h3azc83yllbfsrxwmv1c9g32gylcmsshik0dqv";
8 };
9
10 broken = true; # Not found
11
12 buildInputs = [python pil pygame SDL];
13
14 configurePhase = ''
15 sed -e "/includes = /aincludes.append('${SDL}/include/SDL')" -i setup.py;
16 sed -e "/includes = /aincludes.append('$(echo ${pygame}/include/python*)')" -i setup.py;
17 cat setup.py;
18 export NIX_LDFLAGS="$NIX_LDFLAGS -lgcc_s"
19 '';
20 buildPhase = ''
21 sed -e "s/pygame.display.toggle_fullscreen.*/pass;/" -i tpm/Application.py
22 sed -e 's@"Surface"@"pygame.Surface"@' -i src/surfutils.c
23 python setup.py build;
24 python setup.py build_clib;
25 python setup.py build_ext;
26 python setup.py build_py;
27 python setup.py build_scripts;
28 '';
29 installPhase = ''
30 python setup.py install --prefix=$out
31 mkdir -p "$out"/share/tpm/
32 cp -r . "$out"/share/tpm/build-dir
33 mkdir -p "$out/bin"
34 echo "#! /bin/sh" >> "$out/bin/tpm"
35 echo "export PYTHONPATH=\"\$PYTHONPATH:$PYTHONPATH:$(echo ${pil}/lib/python*/site-packages/PIL)\"" >> "$out/bin/tpm"
36 echo "cd \"$out/share/tpm/build-dir\"" >> "$out/bin/tpm"
37 echo "export PYTHONPATH=\"\$PYTHONPATH:$PYTHONPATH:$(echo ${pil}/lib/python*/site-packages/PIL)\"" >> "$out/bin/tpm"
38 echo "${python}/bin/python \"$out\"/share/tpm/build-dir/ThePenguinMachine.py \"\$@\"" >> "$out/bin/tpm"
39 chmod a+x "$out/bin/tpm"
40 '';
41
42 meta = {
43 description = "An Incredible Machine clone";
44 };
45}