2021-04-16 18:39:20 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
2024-01-19 00:25:41 +00:00
|
|
|
, fetchpatch
|
2021-04-16 18:39:20 +00:00
|
|
|
, nix-update-script
|
|
|
|
, cmake
|
|
|
|
, pkg-config
|
|
|
|
, makeWrapper
|
|
|
|
, zlib
|
|
|
|
, libX11
|
|
|
|
, libXrandr
|
|
|
|
, libXinerama
|
|
|
|
, libXcursor
|
|
|
|
, libXi
|
|
|
|
, libXext
|
|
|
|
, libGLU
|
2021-06-10 02:57:09 +00:00
|
|
|
, 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
|
|
|
};
|
|
|
|
|
2024-01-19 00:25:41 +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)" ""
|
2024-01-19 00:25:41 +00:00
|
|
|
|
|
|
|
# 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 ]
|
2021-06-10 02:57:09 +00:00
|
|
|
++ 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 ];
|
|
|
|
|
2023-02-19 19:23:32 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = toString [
|
2022-12-23 16:57:29 +00:00
|
|
|
# Needed with GCC 12
|
|
|
|
"-Wno-error=array-bounds"
|
|
|
|
];
|
|
|
|
|
2023-07-13 03:26:51 +00:00
|
|
|
# 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 \
|
2022-03-14 18:06:00 +00:00
|
|
|
--chdir "$out/lib/foxotron"
|
2021-04-16 18:39:20 +00:00
|
|
|
ln -s $out/{lib/foxotron,bin}/Foxotron
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru = {
|
2022-12-25 22:11:14 +00:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
}
|