mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-09 22:45:08 +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" ```
94 lines
3.4 KiB
Nix
94 lines
3.4 KiB
Nix
{ stdenv, lib, fetchFromGitHub, fetchpatch, fetchurl, cmake, pkg-config, doxygen,
|
|
libX11, libXinerama, libXrandr, libGLU, libGL,
|
|
glib, libxml2, pcre, zlib,
|
|
AGL, Accelerate, Carbon, Cocoa, Foundation,
|
|
boost,
|
|
jpegSupport ? true, libjpeg,
|
|
exrSupport ? false, openexr_3,
|
|
gifSupport ? true, giflib,
|
|
pngSupport ? true, libpng,
|
|
tiffSupport ? true, libtiff,
|
|
gdalSupport ? false, gdal,
|
|
curlSupport ? true, curl,
|
|
colladaSupport ? false, opencollada,
|
|
opencascadeSupport ? false, opencascade-occt,
|
|
ffmpegSupport ? false, ffmpeg,
|
|
nvttSupport ? false, nvidia-texture-tools,
|
|
freetypeSupport ? true, freetype,
|
|
svgSupport ? false, librsvg,
|
|
pdfSupport ? false, poppler,
|
|
vncSupport ? false, libvncserver,
|
|
lasSupport ? false, libLAS,
|
|
luaSupport ? false, lua,
|
|
sdlSupport ? false, SDL2,
|
|
restSupport ? false, asio,
|
|
withApps ? false,
|
|
withExamples ? false, fltk,
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "openscenegraph";
|
|
version = "3.6.5";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "openscenegraph";
|
|
repo = "OpenSceneGraph";
|
|
rev = "OpenSceneGraph-${version}";
|
|
sha256 = "00i14h82qg3xzcyd8p02wrarnmby3aiwmz0z43l50byc9f8i05n1";
|
|
};
|
|
|
|
nativeBuildInputs = [ pkg-config cmake doxygen ];
|
|
|
|
buildInputs = lib.optionals (!stdenv.hostPlatform.isDarwin) [
|
|
libX11 libXinerama libXrandr libGLU libGL
|
|
] ++ [
|
|
glib libxml2 pcre zlib
|
|
] ++ lib.optional jpegSupport libjpeg
|
|
++ lib.optional exrSupport openexr_3
|
|
++ lib.optional gifSupport giflib
|
|
++ lib.optional pngSupport libpng
|
|
++ lib.optional tiffSupport libtiff
|
|
++ lib.optional gdalSupport gdal
|
|
++ lib.optional curlSupport curl
|
|
++ lib.optional colladaSupport opencollada
|
|
++ lib.optional opencascadeSupport opencascade-occt
|
|
++ lib.optional ffmpegSupport ffmpeg
|
|
++ lib.optional nvttSupport nvidia-texture-tools
|
|
++ lib.optional freetypeSupport freetype
|
|
++ lib.optional svgSupport librsvg
|
|
++ lib.optional pdfSupport poppler
|
|
++ lib.optional vncSupport libvncserver
|
|
++ lib.optional lasSupport libLAS
|
|
++ lib.optional luaSupport lua
|
|
++ lib.optional sdlSupport SDL2
|
|
++ lib.optional restSupport asio
|
|
++ lib.optionals withExamples [ fltk ]
|
|
++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ ]
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [ AGL Accelerate Carbon Cocoa Foundation ]
|
|
++ lib.optional (restSupport || colladaSupport) boost
|
|
;
|
|
|
|
patches = [
|
|
(fetchpatch {
|
|
name = "opencascade-api-patch";
|
|
url = "https://github.com/openscenegraph/OpenSceneGraph/commit/bc2daf9b3239c42d7e51ecd7947d31a92a7dc82b.patch";
|
|
hash = "sha256-VR8YKOV/YihB5eEGZOGaIfJNrig1EPS/PJmpKsK284c=";
|
|
})
|
|
# OpenEXR 3 support: https://github.com/openscenegraph/OpenSceneGraph/issues/1075
|
|
(fetchurl {
|
|
url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-games/openscenegraph/files/openscenegraph-3.6.5-openexr3.patch?id=0f642d8f09b589166f0e0c0fc84df7673990bf3f";
|
|
hash = "sha256-fdNbkg6Vp7DeDBTe5Zso8qJ5v9uPSXHpQ5XlGkvputk=";
|
|
})
|
|
];
|
|
|
|
cmakeFlags = lib.optional (!withApps) "-DBUILD_OSG_APPLICATIONS=OFF" ++ lib.optional withExamples "-DBUILD_OSG_EXAMPLES=ON";
|
|
|
|
meta = with lib; {
|
|
description = "3D graphics toolkit";
|
|
homepage = "http://www.openscenegraph.org/";
|
|
maintainers = with maintainers; [ aanderse raskin ];
|
|
platforms = with platforms; linux ++ darwin;
|
|
license = "OpenSceneGraph Public License - free LGPL-based license";
|
|
};
|
|
}
|