2021-12-06 16:07:01 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchurl
|
|
|
|
, ocamlPackages
|
|
|
|
, makeWrapper
|
|
|
|
, libGLU
|
|
|
|
, libGL
|
|
|
|
, freeglut
|
|
|
|
, mpfr
|
|
|
|
, gmp
|
2021-07-14 22:03:04 +00:00
|
|
|
, pkgsHostTarget
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
let
|
|
|
|
inherit (pkgsHostTarget.targetPackages.stdenv) cc;
|
|
|
|
in
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "glsurf";
|
|
|
|
version = "3.3.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2021-12-06 16:07:01 +00:00
|
|
|
url = "https://raffalli.eu/~christophe/glsurf/glsurf-${version}.tar.gz";
|
2020-04-24 23:36:52 +00:00
|
|
|
sha256 = "0w8xxfnw2snflz8wdr2ca9f5g91w5vbyp1hwlx1v7vg83d4bwqs7";
|
|
|
|
};
|
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
|
|
|
] ++ (with ocamlPackages; [
|
2021-12-06 16:07:01 +00:00
|
|
|
ocaml
|
|
|
|
findlib
|
2021-07-14 22:03:04 +00:00
|
|
|
]);
|
|
|
|
|
|
|
|
buildInputs = [
|
2021-12-06 16:07:01 +00:00
|
|
|
freeglut
|
|
|
|
libGL
|
|
|
|
libGLU
|
|
|
|
mpfr
|
|
|
|
gmp
|
2021-07-14 22:03:04 +00:00
|
|
|
] ++ (with ocamlPackages; [
|
2021-12-06 16:07:01 +00:00
|
|
|
camlp4
|
|
|
|
lablgl
|
2023-03-08 16:32:21 +00:00
|
|
|
camlimages
|
|
|
|
num
|
2020-04-24 23:36:52 +00:00
|
|
|
]);
|
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
postPatch = ''
|
|
|
|
for f in callbacks*/Makefile src/Makefile; do
|
|
|
|
substituteInPlace "$f" --replace "+camlp4" \
|
|
|
|
"${ocamlPackages.camlp4}/lib/ocaml/${ocamlPackages.ocaml.version}/site-lib/camlp4"
|
|
|
|
done
|
2023-03-08 16:32:21 +00:00
|
|
|
|
|
|
|
# Fatal error: exception Sys_error("Mutex.unlock: Operation not permitted")
|
|
|
|
sed -i "/gl_started/d" src/draw.ml* src/main.ml
|
2021-07-14 22:03:04 +00:00
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin $out/share/doc/glsurf
|
|
|
|
cp ./src/glsurf.opt $out/bin/glsurf
|
|
|
|
cp ./doc/doc.pdf $out/share/doc/glsurf
|
|
|
|
cp -r ./examples $out/share/doc/glsurf
|
2021-07-14 22:03:04 +00:00
|
|
|
|
|
|
|
wrapProgram "$out/bin/glsurf" --set CC "${cc}/bin/${cc.targetPrefix}cc"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
homepage = "https://raffalli.eu/~christophe/glsurf/";
|
|
|
|
description = "A program to draw implicit surfaces and curves";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "glsurf";
|
2021-05-20 23:08:51 +00:00
|
|
|
license = lib.licenses.gpl2Plus;
|
2023-04-29 16:46:19 +00:00
|
|
|
platforms = lib.platforms.all;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|