Unverified Commit cad590f3 authored by Ben Siraphob's avatar Ben Siraphob Committed by GitHub
Browse files

pong3d: fix build (#406844)

parents 0840fee5 f4517745
Loading
Loading
Loading
Loading
+24 −8
Original line number Diff line number Diff line
@@ -2,28 +2,44 @@
  lib,
  stdenv,
  fetchurl,

  libX11,
}:

stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
  pname = "3dpong";
  version = "0.5";

  src = fetchurl {
    url = "ftp://ftp.tuxpaint.org/unix/x/3dpong/src/3dpong-${version}.tar.gz";
    sha256 = "1ibb79sbzlbn4ra3n0qk22gqr6fg7q0jy6cm0wg2qj4z64c7hmdi";
    url = "https://tuxpaint.org/ftp/unix/x/3dpong/src/3dpong-${finalAttrs.version}.tar.gz";
    hash = "sha256-sVV4GDGfSCweB5UZLwE+z5mMnxATAztUJnbRv3Q6a8U=";
  };

  buildInputs = [ libX11 ];
  postPatch = ''
    substituteInPlace src/3dpong.c --replace-fail \
      "#include <stdio.h>" \
      "#include <stdio.h>
       #include <unistd.h>"

    substituteInPlace src/randnum.c --replace-fail \
      "#include <stdio.h>" \
      "#include <stdio.h>
       #include <stdlib.h>"

  preConfigure = ''
    sed -i s,/usr/local,$out, Makefile
    mkdir -p $out/bin
    substituteInPlace src/text.c --replace-fail \
      "#include <X11/Xlib.h>" \
      "#include <X11/Xlib.h>
       #include <string.h>"
  '';

  buildInputs = [ libX11 ];

  makeFlags = [ "PREFIX=$(out)" ];

  meta = {
    homepage = "http://www.newbreedsoftware.com/3dpong/";
    description = "One or two player 3d sports game based on Pong from Atari";
    license = lib.licenses.gpl2Plus;
    platforms = lib.platforms.linux;
  };
}
})