1{
2 lib,
3 stdenv,
4 fetchurl,
5 fetchpatch,
6 autoreconfHook,
7 SDL,
8 SDL_net,
9 SDL_sound,
10 copyDesktopItems,
11 graphicsmagick,
12 libGL,
13 libGLU,
14 libpng,
15 binutils,
16 makeDesktopItem,
17}:
18
19stdenv.mkDerivation rec {
20 pname = "dosbox";
21 version = "0.74-3";
22
23 src = fetchurl {
24 url = "mirror://sourceforge/dosbox/dosbox-${version}.tar.gz";
25 hash = "sha256-wNE91+0u02O2jeYVR1eB6JHNWC6BYrXDZpE3UCIiJgo=";
26 };
27
28 patches = [
29 (fetchpatch {
30 url = "https://github.com/joncampbell123/dosbox-x/commit/006d5727d36d1ec598e387f2f1a3c521e3673dcb.patch";
31 includes = [ "src/gui/render_templates_sai.h" ];
32 hash = "sha256-HSO29/LgZRKQ3HQBA0QF5henG8pCSoe1R2joYNPcUcE=";
33 })
34 ];
35
36 strictDeps = true;
37
38 nativeBuildInputs = [
39 autoreconfHook
40 copyDesktopItems
41 graphicsmagick
42 SDL # for sdl-config during build time
43 ];
44
45 depsBuildBuild = [
46 binutils # build calls `ar`
47 ];
48
49 buildInputs = [
50 SDL
51 SDL_net
52 SDL_sound
53 libpng
54 ]
55 ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
56 libGL
57 libGLU
58 ];
59
60 # Tests for SDL_net.h for modem & IPX support, not automatically picked up due to being in SDL subdirectory
61 env.NIX_CFLAGS_COMPILE = "-I${lib.getDev SDL_net}/include/SDL";
62
63 hardeningDisable = [ "format" ];
64
65 configureFlags = lib.optional stdenv.hostPlatform.isDarwin "--disable-sdltest";
66
67 desktopItems = [
68 (makeDesktopItem {
69 name = "dosbox";
70 exec = "dosbox";
71 icon = "dosbox";
72 comment = "x86 dos emulator";
73 desktopName = "DOSBox";
74 genericName = "DOS emulator";
75 categories = [
76 "Emulator"
77 "Game"
78 ];
79 })
80 ];
81
82 postInstall = ''
83 mkdir -p $out/share/icons/hicolor/256x256/apps
84 gm convert src/dosbox.ico $out/share/icons/hicolor/256x256/apps/dosbox.png
85 '';
86
87 enableParallelBuilding = true;
88
89 meta = with lib; {
90 homepage = "http://www.dosbox.com/";
91 changelog = "https://www.dosbox.com/wiki/Releases";
92 description = "DOS emulator";
93 longDescription = ''
94 DOSBox is an emulator that recreates a MS-DOS compatible environment
95 (complete with Sound, Input, Graphics and even basic networking). This
96 environment is complete enough to run many classic MS-DOS games completely
97 unmodified. In order to utilize all of DOSBox's features you need to first
98 understand some basic concepts about the MS-DOS environment.
99 '';
100 license = licenses.gpl2Plus;
101 maintainers = with maintainers; [ matthewbauer ];
102 platforms = platforms.unix;
103 mainProgram = "dosbox";
104 };
105}