1{ lib
2, stdenv
3, fetchFromGitHub
4, fetchpatch
5, cmake
6, libX11
7, freetype
8, libjpeg
9, openal
10, flac
11, libvorbis
12, glew
13, libXrandr
14, libXrender
15, udev
16, xcbutilimage
17, IOKit
18, Foundation
19, AppKit
20, OpenAL
21}:
22
23stdenv.mkDerivation rec {
24 pname = "sfml";
25 version = "2.5.1";
26
27 src = fetchFromGitHub {
28 owner = "SFML";
29 repo = "SFML";
30 rev = version;
31 sha256 = "sha256-Xt2Ct4vV459AsSvJxQfwMsNs6iA5y3epT95pLWJGeSk=";
32 };
33
34 patches = [
35 (fetchpatch {
36 url = "https://github.com/macports/macports-ports/raw/4df1fc235a708ff28200ffc0a39120974ed4b6e1/multimedia/sfml/files/patch-apple-silicon.diff";
37 extraPrefix = "";
38 sha256 = "sha256-9dNawJaYtkugR+2NvhQOhgsf6w9ZXHkBgsDRh8yAJc0=";
39 })
40 (fetchpatch {
41 url = "https://github.com/SFML/SFML/commit/bf92efe9a4035fee0258386173d53556aa196e49.patch";
42 hash = "sha256-1htwPfpn7Z6s/3b+/i1tQ+btjr/tWv5m6IyDVMBNqQA=";
43 })
44 ];
45
46 nativeBuildInputs = [ cmake ];
47 buildInputs = [ freetype libjpeg openal flac libvorbis glew ]
48 ++ lib.optional stdenv.isLinux udev
49 ++ lib.optionals (!stdenv.isDarwin) [ libX11 libXrandr libXrender xcbutilimage ]
50 ++ lib.optionals stdenv.isDarwin [ IOKit Foundation AppKit OpenAL ];
51
52 cmakeFlags = [
53 "-DSFML_INSTALL_PKGCONFIG_FILES=yes"
54 "-DSFML_MISC_INSTALL_PREFIX=share/SFML"
55 "-DSFML_BUILD_FRAMEWORKS=no"
56 "-DSFML_USE_SYSTEM_DEPS=yes"
57 ];
58
59 meta = with lib; {
60 homepage = "https://www.sfml-dev.org/";
61 description = "Simple and fast multimedia library";
62 longDescription = ''
63 SFML is a simple, fast, cross-platform and object-oriented multimedia API.
64 It provides access to windowing, graphics, audio and network.
65 It is written in C++, and has bindings for various languages such as C, .Net, Ruby, Python.
66 '';
67 license = licenses.zlib;
68 maintainers = [ maintainers.astsmtl ];
69 platforms = platforms.unix;
70 };
71}