From b9bc42d0f33e5490e8e1fbbf6048f2fc641bc546 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 24 Feb 2014 05:46:04 +0100 Subject: [PATCH] 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 --- pkgs/development/libraries/glew/default.nix | 24 +++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/pkgs/development/libraries/glew/default.nix b/pkgs/development/libraries/glew/default.nix index ef81f210d39f..b79fa97047b9 100644 --- a/pkgs/development/libraries/glew/default.nix +++ b/pkgs/development/libraries/glew/default.nix @@ -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/;