2021-01-23 13:26:19 +01:00
|
|
|
{ lib, stdenv, fetchFromGitHub, glfw, pkg-config, libXrandr, libXdamage
|
2017-09-10 17:23:50 +02:00
|
|
|
, libXext, libXrender, libXinerama, libXcursor, libXxf86vm, libXi
|
2020-11-01 17:57:57 +01:00
|
|
|
, libX11, libGLU, python3Packages, ensureNewerSourcesForZipFilesHook
|
2018-03-23 20:03:59 +01:00
|
|
|
, Cocoa
|
2017-09-10 17:23:50 +02:00
|
|
|
}:
|
2017-08-04 01:29:26 +02:00
|
|
|
|
2020-11-01 17:57:57 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "glslviewer";
|
2020-11-01 17:57:57 +01:00
|
|
|
version = "1.6.8";
|
2017-08-04 01:29:26 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "patriciogonzalezvivo";
|
|
|
|
repo = "glslViewer";
|
2020-11-01 17:57:57 +01:00
|
|
|
rev = version;
|
|
|
|
sha256 = "0v7x93b61ama0gmzlx1zc56jgi7bvzsfvbkfl82xzwf2h5g1zni7";
|
2017-08-04 01:29:26 +02:00
|
|
|
};
|
|
|
|
|
2023-02-08 09:20:25 +01:00
|
|
|
postPatch = ''
|
|
|
|
sed '1i#include <cstring>' -i src/tools/text.cpp # gcc12
|
2024-01-28 17:30:22 +01:00
|
|
|
sed '8i#include <cstdint>' -i src/io/fs.cpp # gcc13
|
2023-02-08 09:20:25 +01:00
|
|
|
'';
|
|
|
|
|
2021-01-19 07:50:56 +01:00
|
|
|
nativeBuildInputs = [ pkg-config ensureNewerSourcesForZipFilesHook python3Packages.six ];
|
2018-03-23 20:03:59 +01:00
|
|
|
buildInputs = [
|
|
|
|
glfw libGLU glfw libXrandr libXdamage
|
|
|
|
libXext libXrender libXinerama libXcursor libXxf86vm
|
|
|
|
libXi libX11
|
2020-11-01 17:57:57 +01:00
|
|
|
] ++ (with python3Packages; [ python setuptools wrapPython ])
|
2021-01-23 13:26:19 +01:00
|
|
|
++ lib.optional stdenv.isDarwin Cocoa;
|
2020-11-01 17:57:57 +01:00
|
|
|
pythonPath = with python3Packages; [ pyyaml requests ];
|
2018-03-23 20:03:59 +01:00
|
|
|
|
2017-08-04 01:29:26 +02:00
|
|
|
# Makefile has /usr/local/bin hard-coded for 'make install'
|
|
|
|
preConfigure = ''
|
2017-09-10 17:23:50 +02:00
|
|
|
substituteInPlace Makefile \
|
|
|
|
--replace '/usr/local' "$out" \
|
|
|
|
--replace '/usr/bin/clang++' 'clang++'
|
2018-03-23 20:03:59 +01:00
|
|
|
substituteInPlace Makefile \
|
|
|
|
--replace 'python setup.py install' "python setup.py install --prefix=$out"
|
2020-11-01 17:57:57 +01:00
|
|
|
2to3 -w bin/*
|
2017-08-04 01:29:26 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
preInstall = ''
|
2018-03-23 20:03:59 +01:00
|
|
|
mkdir -p $out/bin $(toPythonPath "$out")
|
|
|
|
export PYTHONPATH=$PYTHONPATH:$(toPythonPath "$out")
|
2017-08-04 01:29:26 +02:00
|
|
|
'';
|
2017-09-10 17:23:50 +02:00
|
|
|
|
2018-03-23 20:03:59 +01:00
|
|
|
postInstall = ''
|
|
|
|
wrapPythonPrograms
|
|
|
|
'';
|
2017-09-10 17:23:50 +02:00
|
|
|
|
2021-01-23 13:26:19 +01:00
|
|
|
meta = with lib; {
|
2017-08-04 01:29:26 +02:00
|
|
|
description = "Live GLSL coding renderer";
|
2023-01-21 22:41:12 +01:00
|
|
|
homepage = "https://patriciogonzalezvivo.com/2015/glslViewer/";
|
2017-08-04 01:29:26 +02:00
|
|
|
license = licenses.bsd3;
|
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
|
|
|
maintainers = [ maintainers.hodapp ];
|
2022-12-06 21:47:40 +01:00
|
|
|
# never built on aarch64-darwin since first introduction in nixpkgs
|
|
|
|
broken = stdenv.isDarwin && stdenv.isAarch64;
|
2017-08-04 01:29:26 +02:00
|
|
|
};
|
|
|
|
}
|