1{ stdenv, lib
2, Carbon
3, fetchzip
4, libGL
5, libX11
6}:
7
8stdenv.mkDerivation {
9 pname = "soil";
10 version = "unstable-2020-01-04";
11
12 src = fetchzip {
13 url = "https://web.archive.org/web/20200104042737id_/http://www.lonesock.net/files/soil.zip";
14 sha256 = "1c05nwbnfdgwaz8ywn7kg2xrcvrcbpdyhcfkkiiwk69zvil0pbgd";
15 };
16
17 buildInputs = if stdenv.hostPlatform.isDarwin then [
18 Carbon
19 ] else [
20 libGL
21 libX11
22 ];
23
24 buildPhase = ''
25 cd src
26 $CC $NIX_CFLAGS_COMPILE -c *.c
27 $AR rcs libSOIL.a *.o
28 '';
29 installPhase = ''
30 mkdir -p $out/lib $out/include/SOIL
31 cp libSOIL.a $out/lib/
32 cp SOIL.h $out/include/SOIL/
33 '';
34
35 meta = with lib; {
36 description = "Simple OpenGL Image Library";
37 longDescription = ''
38 SOIL is a tiny C library used primarily for uploading textures
39 into OpenGL.
40 '';
41 homepage = "https://www.lonesock.net/soil.html";
42 license = licenses.publicDomain;
43 platforms = platforms.unix;
44 maintainers = with maintainers; [ r-burns ];
45 };
46}