Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / applications / emulators / pcsxr / default.nix
blobb80c32bd9edaa3965a78732ea5f61fba3c5bab1a
1 { lib, stdenv, fetchurl, autoreconfHook, intltool, pkg-config, gtk3, SDL2, xorg
2 , wrapGAppsHook, libcdio, nasm, ffmpeg_4, file
3 , fetchpatch }:
5 stdenv.mkDerivation rec {
6   pname = "pcsxr";
7   version = "1.9.94";
9   # codeplex does not support direct downloading
10   src = fetchurl {
11     url = "mirror://debian/pool/main/p/pcsxr/pcsxr_${version}.orig.tar.xz";
12     sha256 = "0q7nj0z687lmss7sgr93ij6my4dmhkm2nhjvlwx48dn2lxl6ndla";
13   };
15   patches = [
16     ( fetchpatch {
17       url = "https://salsa.debian.org/games-team/pcsxr/raw/315e56d16e36ef3011f72d0fe86190728d2ba596/debian/patches/01_fix-i386-exec-stack.patch";
18       sha256 = "17497wjxd6b92bj458s2769d9bpp68ydbvmfs9gp51yhnq4zl81x";
19     })
20     ( fetchpatch {
21       url = "https://salsa.debian.org/games-team/pcsxr/raw/315e56d16e36ef3011f72d0fe86190728d2ba596/debian/patches/02_disable-ppc-auto-dynarec.patch";
22       sha256 = "0v8n79z034w6cqdrzhgd9fkdpri42mzvkdjm19x4asz94gg2i2kf";
23     })
24     ( fetchpatch {
25       url = "https://salsa.debian.org/games-team/pcsxr/raw/315e56d16e36ef3011f72d0fe86190728d2ba596/debian/patches/03_fix-plugin-dir.patch";
26       sha256 = "0vkl0mv6whqaz79kvvvlmlmjpynyq4lh352j3bbxcr0vjqffxvsy";
27     })
28     ( fetchpatch {
29       url = "https://salsa.debian.org/games-team/pcsxr/raw/315e56d16e36ef3011f72d0fe86190728d2ba596/debian/patches/04_update-homedir-symlinks.patch";
30       sha256 = "18r6n025ybr8fljfsaqm4ap31wp8838j73lrsffi49fkis60dp4j";
31     })
32     ( fetchpatch {
33       url = "https://salsa.debian.org/games-team/pcsxr/raw/315e56d16e36ef3011f72d0fe86190728d2ba596/debian/patches/05_format-security.patch";
34       sha256 = "03m4kfc9bk5669hf7ji1anild08diliapx634f9cigyxh72jcvni";
35     })
36     ( fetchpatch {
37       url = "https://salsa.debian.org/games-team/pcsxr/raw/315e56d16e36ef3011f72d0fe86190728d2ba596/debian/patches/06_warnings.patch";
38       sha256 = "0iz3g9ihnhisfgrzma9l74y4lhh57na9h41bmiam1millb796g71";
39     })
40     ( fetchpatch {
41       url = "https://salsa.debian.org/games-team/pcsxr/raw/315e56d16e36ef3011f72d0fe86190728d2ba596/debian/patches/07_non-linux-ip-addr.patch";
42       sha256 = "14vb9l0l4nzxcymhjjs4q57nmsncmby9qpdr7c19rly5wavm4k77";
43     })
44     ( fetchpatch {
45       url = "https://salsa.debian.org/games-team/pcsxr/raw/315e56d16e36ef3011f72d0fe86190728d2ba596/debian/patches/08_reproducible.patch";
46       sha256 = "1cx9q59drsk9h6l31097lg4aanaj93ysdz5p88pg9c7wvxk1qz06";
47     })
49     ./uncompress2.patch
50     ./0001-libpcsxcore-fix-build-with-ffmpeg-4.patch
51   ];
53   nativeBuildInputs = [ autoreconfHook intltool pkg-config wrapGAppsHook ];
54   buildInputs = [
55     gtk3 SDL2 xorg.libXv xorg.libXtst libcdio nasm ffmpeg_4 file
56     xorg.libXxf86vm
57   ];
59   # Workaround build failure on -fno-common toolchains like upstream
60   # gcc-10. Otherwise build fails as:
61   #   ld: AboutDlg.o:/build/pcsxr/gui/Linux.h:42: multiple definition of `cfgfile';
62   #     LnxMain.o:/build/pcsxr/gui/Linux.h:42: first defined here
63   env.NIX_CFLAGS_COMPILE = "-fcommon";
65   dynarecTarget =
66    if stdenv.isx86_64 then "x86_64"
67    else if stdenv.isi686 then "x86"
68    else "no"; #debian patch 2 says ppc doesn't work
70   configureFlags = [
71     "--enable-opengl"
72     "--enable-ccdda"
73     "--enable-libcdio"
74     "--enable-dynarec=${dynarecTarget}"
75   ];
77   postInstall = ''
78     mkdir -p "$out/share/doc/${pname}-${version}"
79     cp README \
80        AUTHORS \
81        doc/keys.txt \
82        doc/tweaks.txt \
83        ChangeLog.df \
84        ChangeLog \
85        "$out/share/doc/${pname}-${version}"
86   '';
88   meta = with lib; {
89     broken = stdenv.isDarwin;
90     description = "Playstation 1 emulator";
91     homepage = "https://github.com/iCatButler/pcsxr";
92     maintainers = with maintainers; [ rardiol ];
93     license = licenses.gpl2Plus;
94     platforms = platforms.all;
95     mainProgram = "pcsxr";
96   };