about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/emulators/dosbox-x/default.nix
blob: c499c69e544214fa6d0210fdf9c6a7485088ad0c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
{ lib
, stdenv
, fetchFromGitHub
, alsa-lib
, AudioUnit
, autoreconfHook
, Carbon
, Cocoa
, ffmpeg
, fluidsynth
, freetype
, glib
, libpcap
, libpng
, libslirp
, libxkbfile
, libXrandr
, makeWrapper
, ncurses
, pkg-config
, SDL2
, SDL2_net
, testers
, yad
, zlib
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "dosbox-x";
  version = "2024.03.01";

  src = fetchFromGitHub {
    owner = "joncampbell123";
    repo = "dosbox-x";
    rev = "dosbox-x-v${finalAttrs.version}";
    hash = "sha256-EcAp7KyqXdBACEbPgkM1INoKeGVo7hMDUx97y2RcX+k=";
  };

  strictDeps = true;

  nativeBuildInputs = [
    autoreconfHook
    makeWrapper
    pkg-config
  ];

  buildInputs = [
    ffmpeg
    fluidsynth
    freetype
    glib
    libpcap
    libpng
    libslirp
    ncurses
    SDL2
    SDL2_net
    zlib
  ] ++ lib.optionals stdenv.hostPlatform.isLinux [
    alsa-lib
    libxkbfile
    libXrandr
  ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
    AudioUnit
    Carbon
    Cocoa
  ];

  # Tests for SDL_net.h for modem & IPX support, not automatically picked up due to being in SDL2 subdirectory
  env.NIX_CFLAGS_COMPILE = "-I${lib.getDev SDL2_net}/include/SDL2";

  configureFlags = [ "--enable-sdl2" ];

  enableParallelBuilding = true;

  hardeningDisable = [ "format" ]; # https://github.com/joncampbell123/dosbox-x/issues/4436

  postInstall = lib.optionalString stdenv.hostPlatform.isLinux ''
    wrapProgram $out/bin/dosbox-x \
      --prefix PATH : ${lib.makeBinPath [ yad ]}
  '';

  passthru.tests.version = testers.testVersion {
    package = finalAttrs.finalPackage;
    # Version output on stderr, program returns status code 1
    command = "${lib.getExe finalAttrs.finalPackage} -version 2>&1 || true";
  };

  meta = {
    homepage = "https://dosbox-x.com";
    description = "A cross-platform DOS emulator based on the DOSBox project";
    longDescription = ''
      DOSBox-X is an expanded fork of DOSBox with specific focus on running
      Windows 3.x/9x/Me, PC-98 and 3D support via 3dfx.

      The full expanded feature list is available here:
      https://dosbox-x.com/wiki/DOSBox%E2%80%90X%E2%80%99s-Feature-Highlights
    '';
    license = lib.licenses.gpl2Plus;
    maintainers = with lib.maintainers; [ hughobrien OPNA2608 ];
    platforms = lib.platforms.unix;
    mainProgram = "dosbox-x";
  };
})