mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-16 09:54:52 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
59 lines
1.6 KiB
Nix
59 lines
1.6 KiB
Nix
{ lib, stdenv, fetchurl, libGLU, libXmu, libXi, libXext
|
|
, AGL, OpenGL
|
|
, testers
|
|
, mesa
|
|
}:
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "glew";
|
|
version = "1.10.0";
|
|
|
|
src = fetchurl {
|
|
url = "mirror://sourceforge/glew/glew-${finalAttrs.version}.tgz";
|
|
sha256 = "01zki46dr5khzlyywr3cg615bcal32dazfazkf360s1znqh17i4r";
|
|
};
|
|
|
|
buildInputs = if stdenv.hostPlatform.isDarwin then [ AGL ] else [ libXmu libXi libXext ];
|
|
propagatedBuildInputs = if stdenv.hostPlatform.isDarwin then [ OpenGL ] else [ libGLU ]; # GL/glew.h includes GL/glu.h
|
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
patchPhase = ''
|
|
sed -i 's|lib64|lib|' config/Makefile.linux
|
|
${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
|
|
sed -i -e 's/\(INSTALL.*\)-s/\1/' Makefile
|
|
''}
|
|
'';
|
|
|
|
buildFlags = [ "all" ];
|
|
installFlags = [ "install.all" ];
|
|
|
|
preInstall = ''
|
|
export GLEW_DEST="$out"
|
|
'';
|
|
|
|
postInstall = ''
|
|
mkdir -pv $out/share/doc/glew
|
|
mkdir -p $dev/lib/pkgconfig
|
|
cp glew*.pc $dev/lib/pkgconfig
|
|
cp -r README.txt LICENSE.txt doc $out/share/doc/glew
|
|
'';
|
|
|
|
makeFlags = [
|
|
"SYSTEM=${if stdenv.hostPlatform.isMinGW then "mingw" else stdenv.hostPlatform.parsed.kernel.name}"
|
|
"CC:=$(CC)"
|
|
"LD:=$(CC)"
|
|
];
|
|
|
|
passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
|
|
|
|
meta = with lib; {
|
|
description = "OpenGL extension loading library for C(++)";
|
|
homepage = "https://glew.sourceforge.net/";
|
|
license = licenses.free; # different files under different licenses
|
|
#["BSD" "GLX" "SGI-B" "GPL2"]
|
|
pkgConfigModules = [ "glew" ];
|
|
inherit (mesa.meta) platforms;
|
|
};
|
|
})
|