nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 fetchurl,
3 fetchpatch,
4 lib,
5 stdenv,
6 libGLU,
7 libGL,
8 libglut,
9 SDL,
10 libXi,
11 libSM,
12 libXmu,
13 libXext,
14 libX11,
15}:
16
17stdenv.mkDerivation rec {
18 pname = "plib";
19 version = "1.8.5";
20
21 src = fetchurl {
22 # XXX: The author doesn't use the orthodox SF way to store tarballs.
23 url = "https://plib.sourceforge.net/dist/${pname}-${version}.tar.gz";
24 sha256 = "0cha71mflpa10vh2l7ipyqk67dq2y0k5xbafwdks03fwdyzj4ns8";
25 };
26
27 patches = [
28 (fetchpatch {
29 url = "https://sources.debian.net/data/main/p/plib/1.8.5-7/debian/patches/04_CVE-2011-4620.diff";
30 sha256 = "1b7y0vqqdzd48q68ldlzw0zzqy9mg4c10a754r4hi3ldjmcplf0j";
31 })
32 (fetchpatch {
33 url = "https://sources.debian.net/data/main/p/plib/1.8.5-7/debian/patches/05_CVE-2012-4552.diff";
34 sha256 = "0b6cwdwii5b5vy78sbw5cw1s96l4jyzr4dk69v63pa0wwi2b5dki";
35 })
36 (fetchpatch {
37 url = "https://sources.debian.org/data/main/p/plib/1.8.5-13/debian/patches/08_CVE-2021-38714.patch";
38 sha256 = "sha256-3f1wZn0QqK/hPWCg1KEzbB95IGoxBjLZoCOFlW98t5w=";
39 })
40 ./darwin-ssgloadflt-uint.patch
41 ];
42
43 configureFlags = lib.optionals stdenv.hostPlatform.isDarwin [
44 "--disable-sl"
45 "--disable-pw"
46 ];
47
48 propagatedBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [
49 libGLU
50 libGL
51 libglut
52 SDL
53
54 # The following libs ought to be propagated build inputs of Mesa.
55 libXi
56 libSM
57 libXmu
58 libXext
59 libX11
60 ];
61
62 meta = {
63 description = "Suite of portable game libraries";
64
65 longDescription = ''
66 PLIB includes sound effects, music, a complete 3D engine, font
67 rendering, a simple Windowing library, a game scripting
68 language, a GUI, networking, 3D math library and a collection of
69 handy utility functions. All are 100% portable across nearly
70 all modern computing platforms. What's more, it's all available
71 on line - and completely free. Each library component is fairly
72 independent of the others - so if you want to use SDL, GTK,
73 GLUT, or FLTK instead of PLIB's 'PW' windowing library, you can.
74 '';
75
76 license = lib.licenses.lgpl2Plus;
77
78 homepage = "https://plib.sourceforge.net/";
79 platforms = lib.platforms.unix;
80 };
81}