glew/cross: Fix building with mingw-w64.

This also cleans up the package expression a bit and we no longer
directly override the phases (except patchPhase).

Also for cross-builds we're using the stock mingw target and pass CC, LD
and STRIP to make, because the mingw-w64 targets of the upstream package
are outdated.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
This commit is contained in:
aszlig 2014-02-24 05:46:04 +01:00
parent d0142e9b09
commit b9bc42d0f3
No known key found for this signature in database
GPG Key ID: D0EBD0EC8C2DC961

View File

@ -1,5 +1,7 @@
{ stdenv, fetchurl, mesa_glu, x11, libXmu, libXi }:
with stdenv.lib;
stdenv.mkDerivation rec {
name = "glew-1.10.0";
@ -8,23 +10,33 @@ stdenv.mkDerivation rec {
sha256 = "01zki46dr5khzlyywr3cg615bcal32dazfazkf360s1znqh17i4r";
};
buildInputs = [ x11 libXmu libXi ];
propagatedBuildInputs = [ mesa_glu ]; # GL/glew.h includes GL/glu.h
nativeBuildInputs = [ x11 libXmu libXi ];
propagatedNativeBuildInputs = [ mesa_glu ]; # GL/glew.h includes GL/glu.h
patchPhase = ''
sed -i 's|lib64|lib|' config/Makefile.linux
'';
buildPhase = "make all";
installPhase = ''
GLEW_DEST=$out make install.all
buildFlags = [ "all" ];
installFlags = [ "install.all" ];
preInstall = ''
export GLEW_DEST="$out"
'';
postInstall = ''
mkdir -pv $out/share/doc/glew
mkdir -p $out/lib/pkgconfig
cp glew*.pc $out/lib/pkgconfig
cp -r README.txt LICENSE.txt doc $out/share/doc/glew
'';
crossAttrs.makeFlags = [
"CC=${stdenv.cross.config}-gcc"
"LD=${stdenv.cross.config}-gcc"
"STRIP="
] ++ optional (stdenv.cross.config == "x86_64-w64-mingw32") "SYSTEM=mingw";
meta = {
description = "An OpenGL extension loading library for C(++)";
homepage = http://glew.sourceforge.net/;