nixpkgs/pkgs/development/libraries/glew/default.nix

61 lines
1.7 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchurl, libGLU, xlibsWrapper, libXmu, libXi
, OpenGL
}:
with lib;
stdenv.mkDerivation rec {
2021-06-22 13:21:29 +00:00
pname = "glew";
version = "2.2.0";
src = fetchurl {
2021-06-22 13:21:29 +00:00
url = "mirror://sourceforge/glew/${pname}-${version}.tgz";
2020-04-05 16:16:00 +00:00
sha256 = "1qak8f7g1iswgswrgkzc7idk7jmqgwrs58fhg2ai007v7j4q5z6l";
};
outputs = [ "bin" "out" "dev" "doc" ];
buildInputs = optionals (!stdenv.isDarwin) [ xlibsWrapper libXmu libXi ];
propagatedBuildInputs = if stdenv.isDarwin then [ OpenGL ] else [ libGLU ]; # GL/glew.h includes GL/glu.h
patchPhase = ''
sed -i 's|lib64|lib|' config/Makefile.linux
2017-11-27 15:57:50 +00:00
substituteInPlace config/Makefile.darwin --replace /usr/local "$out"
${optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
2017-11-27 15:57:50 +00:00
sed -i -e 's/\(INSTALL.*\)-s/\1/' Makefile
''}
'';
buildFlags = [ "all" ];
installFlags = [ "install.all" ];
preInstall = ''
makeFlagsArray+=(GLEW_DEST=$out BINDIR=$bin/bin INCDIR=$dev/include/GL)
'';
postInstall = ''
mkdir -pv $out/share/doc/glew
mkdir -p $out/lib/pkgconfig
cp glew*.pc $out/lib/pkgconfig
2016-11-25 22:37:15 +00:00
cp -r README.md LICENSE.txt doc $out/share/doc/glew
rm $out/lib/*.a
'';
makeFlags = [
"SYSTEM=${if stdenv.hostPlatform.isMinGW then "mingw" else stdenv.hostPlatform.parsed.kernel.name}"
2021-08-18 20:00:19 +00:00
"CC=${stdenv.cc.targetPrefix}cc"
"LD=${stdenv.cc.targetPrefix}cc"
"AR=${stdenv.cc.targetPrefix}ar"
];
2017-11-27 15:57:50 +00:00
enableParallelBuilding = true;
meta = with lib; {
description = "An OpenGL extension loading library for C(++)";
homepage = "http://glew.sourceforge.net/";
2014-08-21 19:15:32 +00:00
license = licenses.free; # different files under different licenses
#["BSD" "GLX" "SGI-B" "GPL2"]
platforms = platforms.mesaPlatforms;
};
}