nixpkgs/pkgs/applications/graphics/foxotron/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

102 lines
2.7 KiB
Nix
Raw Normal View History

2021-04-16 18:39:20 +00:00
{ stdenv
, lib
, fetchFromGitHub
, fetchpatch
2021-04-16 18:39:20 +00:00
, nix-update-script
, cmake
, pkg-config
, makeWrapper
, zlib
, libX11
, libXrandr
, libXinerama
, libXcursor
, libXi
, libXext
, libGLU
, alsa-lib
2021-04-16 18:39:20 +00:00
, fontconfig
, AVFoundation
, Carbon
, Cocoa
, CoreAudio
, Kernel
, OpenGL
}:
stdenv.mkDerivation rec {
pname = "foxotron";
2023-07-16 16:33:16 +00:00
version = "2023-07-16";
2021-04-16 18:39:20 +00:00
src = fetchFromGitHub {
owner = "Gargaj";
repo = "Foxotron";
rev = version;
fetchSubmodules = true;
2023-07-16 16:33:16 +00:00
sha256 = "sha256-s1eWZMVitVSP7nJJ5wXvnV8uI6yto7LmvlvocOwVAxw=";
2021-04-16 18:39:20 +00:00
};
patches = [
(fetchpatch {
name = "0001-assimp-Include-cstdint-for-std-uint32_t.patch";
url = "https://github.com/assimp/assimp/commit/108e3192a201635e49e99a91ff2044e1851a2953.patch";
stripLen = 1;
extraPrefix = "externals/assimp/";
hash = "sha256-rk0EFmgeZVwvx3NJOOob5Jwj9/J+eOtuAzfwp88o+J4=";
})
];
2022-12-22 18:25:58 +00:00
postPatch = ''
substituteInPlace CMakeLists.txt \
--replace "set(CMAKE_OSX_ARCHITECTURES x86_64)" ""
# Outdated vendored assimp, many warnings with newer compilers, too old for CMake option to control this
# Note that this -Werror caused issues on darwin, so make sure to re-check builds there before removing this
substituteInPlace externals/assimp/code/CMakeLists.txt \
--replace 'TARGET_COMPILE_OPTIONS(assimp PRIVATE -Werror)' ""
2022-12-22 18:25:58 +00:00
'';
2021-04-16 18:39:20 +00:00
nativeBuildInputs = [ cmake pkg-config makeWrapper ];
buildInputs = [ zlib ]
++ lib.optionals stdenv.hostPlatform.isLinux [ libX11 libXrandr libXinerama libXcursor libXi libXext alsa-lib fontconfig libGLU ]
2021-04-16 18:39:20 +00:00
++ lib.optionals stdenv.hostPlatform.isDarwin [ AVFoundation Carbon Cocoa CoreAudio Kernel OpenGL ];
env.NIX_CFLAGS_COMPILE = toString [
2022-12-23 16:57:29 +00:00
# Needed with GCC 12
"-Wno-error=array-bounds"
];
# error: writing 1 byte into a region of size 0
hardeningDisable = [ "fortify3" ];
2021-04-16 18:39:20 +00:00
installPhase = ''
runHook preInstall
mkdir -p $out/{bin,lib/foxotron}
cp -R ${lib.optionalString stdenv.hostPlatform.isDarwin "Foxotron.app/Contents/MacOS/"}Foxotron \
../{config.json,Shaders,Skyboxes} $out/lib/foxotron/
wrapProgram $out/lib/foxotron/Foxotron \
--chdir "$out/lib/foxotron"
2021-04-16 18:39:20 +00:00
ln -s $out/{lib/foxotron,bin}/Foxotron
runHook postInstall
'';
passthru = {
updateScript = nix-update-script { };
2021-04-16 18:39:20 +00:00
};
meta = with lib; {
description = "General purpose model viewer";
longDescription = ''
ASSIMP based general purpose model viewer ("turntable") created for the
Revision 2021 3D Graphics Competition.
'';
homepage = "https://github.com/Gargaj/Foxotron";
2021-05-03 09:35:44 +00:00
license = licenses.unlicense;
2021-04-16 18:39:20 +00:00
maintainers = with maintainers; [ OPNA2608 ];
platforms = platforms.all;
};
}