2021-01-21 17:00:13 +00:00
|
|
|
{lib, stdenv, fetchurl, libGLU, libGL, freeglut, glew, libXmu, libXext, libX11
|
2019-05-06 18:30:07 +01:00
|
|
|
, qmake, GLUT, fixDarwinDylibNames }:
|
2012-01-26 19:01:38 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2018-02-27 16:45:20 +00:00
|
|
|
version = "1.4.2";
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "opencsg";
|
2012-01-26 19:01:38 +00:00
|
|
|
src = fetchurl {
|
|
|
|
url = "http://www.opencsg.org/OpenCSG-${version}.tar.gz";
|
2018-02-27 16:45:20 +00:00
|
|
|
sha256 = "1ysazynm759gnw1rdhn9xw9nixnzrlzrc462340a6iif79fyqlnr";
|
2012-01-26 19:01:38 +00:00
|
|
|
};
|
|
|
|
|
2019-05-06 18:30:07 +01:00
|
|
|
nativeBuildInputs = [ qmake ]
|
2021-01-21 17:00:13 +00:00
|
|
|
++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
|
2019-05-06 18:30:07 +01:00
|
|
|
|
|
|
|
buildInputs = [ glew ]
|
2021-01-21 17:00:13 +00:00
|
|
|
++ lib.optionals stdenv.isLinux [ libGLU libGL freeglut libXmu libXext libX11 ]
|
|
|
|
++ lib.optional stdenv.isDarwin GLUT;
|
2012-01-26 19:01:38 +00:00
|
|
|
|
|
|
|
doCheck = false;
|
|
|
|
|
2019-05-06 18:30:07 +01:00
|
|
|
patches = [ ./fix-pro-files.patch ];
|
|
|
|
|
2016-03-16 11:37:35 +00:00
|
|
|
preConfigure = ''
|
2019-05-06 18:30:07 +01:00
|
|
|
rm example/Makefile src/Makefile
|
2019-10-16 09:54:26 +01:00
|
|
|
qmakeFlags=("''${qmakeFlags[@]}" "INSTALLDIR=$out")
|
2016-03-16 11:37:35 +00:00
|
|
|
'';
|
|
|
|
|
2019-05-06 18:30:07 +01:00
|
|
|
postInstall = ''
|
|
|
|
install -D license.txt "$out/share/doc/opencsg/license.txt"
|
2021-01-21 17:00:13 +00:00
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
2019-05-06 18:30:07 +01:00
|
|
|
mkdir -p $out/Applications
|
|
|
|
mv $out/bin/*.app $out/Applications
|
|
|
|
rmdir $out/bin || true
|
|
|
|
'';
|
2012-01-26 19:01:38 +00:00
|
|
|
|
2021-01-12 11:50:23 +00:00
|
|
|
dontWrapQtApps = true;
|
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
postFixup = lib.optionalString stdenv.isDarwin ''
|
2019-05-06 18:30:07 +01:00
|
|
|
app=$out/Applications/opencsgexample.app/Contents/MacOS/opencsgexample
|
|
|
|
install_name_tool -change \
|
|
|
|
$(otool -L $app | awk '/opencsg.+dylib/ { print $1 }') \
|
|
|
|
$(otool -D $out/lib/libopencsg.dylib | tail -n 1) \
|
|
|
|
$app
|
2012-01-26 19:01:38 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2012-01-26 19:01:38 +00:00
|
|
|
description = "Constructive Solid Geometry library";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "http://www.opencsg.org/";
|
2019-05-06 18:30:07 +01:00
|
|
|
platforms = platforms.unix;
|
2018-10-25 20:58:46 +01:00
|
|
|
maintainers = [ maintainers.raskin ];
|
|
|
|
license = licenses.gpl2;
|
2012-01-26 19:01:38 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|