2021-04-18 02:13:31 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, nix-update-script
|
|
|
|
, cmake
|
|
|
|
, pkg-config
|
|
|
|
, makeWrapper
|
|
|
|
, zlib
|
|
|
|
, libX11
|
|
|
|
, libXrandr
|
|
|
|
, libXinerama
|
|
|
|
, libXcursor
|
|
|
|
, libXi
|
|
|
|
, libXext
|
|
|
|
, libGLU
|
2021-06-28 23:13:55 +00:00
|
|
|
, alsa-lib
|
2021-04-18 02:13:31 +00:00
|
|
|
, fontconfig
|
|
|
|
, AVFoundation
|
|
|
|
, Carbon
|
|
|
|
, Cocoa
|
|
|
|
, CoreAudio
|
|
|
|
, Kernel
|
|
|
|
, OpenGL
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "foxotron";
|
2023-08-04 22:07:22 +00:00
|
|
|
version = "2023-07-16";
|
2021-04-18 02:13:31 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Gargaj";
|
|
|
|
repo = "Foxotron";
|
|
|
|
rev = version;
|
|
|
|
fetchSubmodules = true;
|
2023-08-04 22:07:22 +00:00
|
|
|
sha256 = "sha256-s1eWZMVitVSP7nJJ5wXvnV8uI6yto7LmvlvocOwVAxw=";
|
2021-04-18 02:13:31 +00:00
|
|
|
};
|
|
|
|
|
2022-12-28 21:21:41 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace CMakeLists.txt \
|
|
|
|
--replace "set(CMAKE_OSX_ARCHITECTURES x86_64)" ""
|
|
|
|
'';
|
|
|
|
|
2021-04-18 02:13:31 +00:00
|
|
|
nativeBuildInputs = [ cmake pkg-config makeWrapper ];
|
|
|
|
|
|
|
|
buildInputs = [ zlib ]
|
2021-06-28 23:13:55 +00:00
|
|
|
++ lib.optionals stdenv.hostPlatform.isLinux [ libX11 libXrandr libXinerama libXcursor libXi libXext alsa-lib fontconfig libGLU ]
|
2021-04-18 02:13:31 +00:00
|
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [ AVFoundation Carbon Cocoa CoreAudio Kernel OpenGL ];
|
|
|
|
|
2023-03-04 12:14:45 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = toString [
|
2023-02-16 17:41:37 +00:00
|
|
|
# Needed with GCC 12
|
|
|
|
"-Wno-error=array-bounds"
|
|
|
|
];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
# error: writing 1 byte into a region of size 0
|
|
|
|
hardeningDisable = [ "fortify3" ];
|
|
|
|
|
2021-04-18 02:13:31 +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-04-27 09:35:20 +00:00
|
|
|
--chdir "$out/lib/foxotron"
|
2021-04-18 02:13:31 +00:00
|
|
|
ln -s $out/{lib/foxotron,bin}/Foxotron
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru = {
|
2022-12-28 21:21:41 +00:00
|
|
|
updateScript = nix-update-script { };
|
2021-04-18 02:13:31 +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 20:48:10 +00:00
|
|
|
license = licenses.unlicense;
|
2021-04-18 02:13:31 +00:00
|
|
|
maintainers = with maintainers; [ OPNA2608 ];
|
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|