@@ -1,33 +1,49 @@
1−{stdenv, fetchurl, libGLU_combined, tcl, tk, file, libXmu, cmake, libtool, qt4,
2−ftgl, freetype}:
1+{ stdenv, fetchFromGitHub, fetchpatch, libGL, libGLU, libXmu, cmake, ninja,
2+ pkgconfig, fontconfig, freetype, expat, freeimage, vtk }:
33
44stdenv.mkDerivation rec {
5− name = "opencascade-oce-0.18.3";
6− src = fetchurl {
7− url = https://github.com/tpaviot/oce/archive/OCE-0.18.3.tar.gz;
8− sha256 = "0v4ny0qhr5hiialb2ss25bllfnd6j4g7mfxnqfmr1xsjpykxcly5";
5+ pname = "opencascade-oce";
6+ version = "0.18.3";
7+
8+ src = fetchFromGitHub {
9+ owner = "tpaviot";
10+ repo = "oce";
11+ rev = "OCE-${version}";
12+ sha256 = "17wy8dcf44vqisishv1jjf3cmcxyygqq29y9c3wjdj983qi2hsig";
913 };
1014
11− buildInputs = [ libGLU_combined tcl tk file libXmu libtool qt4 ftgl freetype cmake ];
15+ nativeBuildInputs = [ cmake ninja pkgconfig ];
16+ buildInputs = [ libGL libGLU libXmu freetype fontconfig expat freeimage vtk ];
1217
13− # Fix for glibc 2.26
14− postPatch = ''
15− sed -i -e 's/^\( *#include <\)x\(locale.h>\)//' \
16− src/Standard/Standard_CLocaleSentry.hxx
17− '';
18+ cmakeFlags = [
19+ "-DOCE_INSTALL_PREFIX=${placeholder "out"}"
20+ "-DOCE_WITH_FREEIMAGE=ON"
21+ "-DOCE_WITH_VTK=ON"
22+ ];
1823
19− preConfigure = ''
20− cmakeFlags="$cmakeFlags -DOCE_INSTALL_PREFIX=$out"
21− '';
24+ patches = [
25+ # Use fontconfig instead of hardcoded directory list
26+ # https://github.com/tpaviot/oce/pull/714
27+ (fetchpatch {
28+ url = "https://github.com/tpaviot/oce/commit/9643432b27fec8974ca0ee15c3c372f5fe8fc069.patch";
29+ sha256 = "1wd940rszmh5apcpk5fv6126h8mcjcy4rjifrql5d4ac90v06v4c";
30+ })
31+ # Fix for glibc 2.26
32+ (fetchpatch {
33+ url = "https://github.com/tpaviot/oce/commit/3b44656e93270d782009b06ec4be84d2a13f8126.patch";
34+ sha256 = "1ccakkcwy5g0184m23x0mnh22i0lk45xm8kgiv5z3pl7nh35dh8k";
35+ })
36+ ];
2237
23− # https://bugs.freedesktop.org/show_bug.cgi?id=83631
24− NIX_CFLAGS_COMPILE = "-DGLX_GLXEXT_LEGACY";
25−
26− enableParallelBuilding = true;
38+ postPatch = ''
39+ # make sure the installed cmake file uses absolute paths for fontconfig
40+ substituteInPlace adm/cmake/TKService/CMakeLists.txt \
41+ --replace FONTCONFIG_LIBRARIES FONTCONFIG_LINK_LIBRARIES
42+ '';
2743
2844 meta = with stdenv.lib; {
2945 description = "Open CASCADE Technology, libraries for 3D modeling and numerical simulation";
30− homepage = http://www.opencascade.org/;
46+ homepage = "https://github.com/tpaviot/oce";
3147 maintainers = [ maintainers.viric ];
3248 platforms = platforms.linux;
3349 license = licenses.lgpl21;