lol
1{ stdenv, fetchurl, mesa_glu, xlibsWrapper, libXmu, libXi
2, buildPlatform, hostPlatform
3}:
4
5with stdenv.lib;
6
7stdenv.mkDerivation rec {
8 name = "glew-2.0.0";
9
10 src = fetchurl {
11 url = "mirror://sourceforge/glew/${name}.tgz";
12 sha256 = "0r37fg2s1f0jrvwh6c8cz5x6v4wqmhq42qm15cs9qs349q5c6wn5";
13 };
14
15 outputs = [ "bin" "out" "dev" "doc" ];
16
17 nativeBuildInputs = [ xlibsWrapper libXmu libXi ];
18 propagatedNativeBuildInputs = [ mesa_glu ]; # GL/glew.h includes GL/glu.h
19
20 patchPhase = ''
21 sed -i 's|lib64|lib|' config/Makefile.linux
22 ${optionalString (hostPlatform != buildPlatform) ''
23 sed -i -e 's/\(INSTALL.*\)-s/\1/' Makefile
24 ''}
25 '';
26
27 buildFlags = [ "all" ];
28 installFlags = [ "install.all" ];
29
30 preInstall = ''
31 makeFlagsArray+=(GLEW_DEST=$out BINDIR=$bin/bin INCDIR=$dev/include/GL)
32 '';
33
34 postInstall = ''
35 mkdir -pv $out/share/doc/glew
36 mkdir -p $out/lib/pkgconfig
37 cp glew*.pc $out/lib/pkgconfig
38 cp -r README.md LICENSE.txt doc $out/share/doc/glew
39 rm $out/lib/*.a
40 '';
41
42 makeFlags = [
43 "SYSTEM=${if hostPlatform.isMinGW then "mingw" else hostPlatform.parsed.kernel.name}"
44 ];
45
46 meta = with stdenv.lib; {
47 description = "An OpenGL extension loading library for C(++)";
48 homepage = http://glew.sourceforge.net/;
49 license = licenses.free; # different files under different licenses
50 #["BSD" "GLX" "SGI-B" "GPL2"]
51 platforms = platforms.mesaPlatforms;
52 };
53}