blob: b53e23ef1c535ab38a3aff7e3affc0fa92c67069 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
{
lib,
stdenv,
fetchurl,
pkg-config,
libglut,
libGLU,
libx11,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "openctm";
version = "1.0.3";
src = fetchurl {
url = "mirror://sourceforge/project/openctm/OpenCTM-${finalAttrs.version}/OpenCTM-${finalAttrs.version}-src.tar.bz2";
hash = "sha256-So0mCNlzZPfuxWt8Y3xWuTCK6YKGs+kNu3QTyQ6UPx0=";
};
outputs = [
"bin"
"dev"
"man"
"out"
];
nativeBuildInputs = [ pkg-config ];
buildInputs = [
libglut
libGLU
]
++ lib.optionals stdenv.hostPlatform.isLinux [ libx11 ];
postPatch =
lib.optionalString stdenv.hostPlatform.isLinux ''
substituteInPlace "tools/tinyxml/Makefile.linux" \
--replace-warn "-Wno-format" "-Wno-format -Wno-format-security"
substituteInPlace "tools/Makefile.linux" \
--replace-warn "-lglut" "-lglut -lGL -lGLU" \
--replace-fail "all: ctmconv ctmviewer ctmbench" "all: ctmconv ctmbench"
substituteInPlace "Makefile.linux" \
--replace-fail "$""(CP) tools/ctmviewer $""(BINDIR)" "" \
--replace-fail "$""(CP) doc/ctmviewer.1 $""(MAN1DIR)" ""
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace "lib/Makefile.macosx" \
"tools/Makefile.macosx" \
"tools/jpeg/makefile.macosx" \
"tools/zlib/Makefile.macosx" \
--replace-warn "gcc" "${stdenv.cc.targetPrefix}cc"
substituteInPlace "lib/Makefile.macosx" "tools/Makefile.macosx" "tools/tinyxml/Makefile.macosx" \
--replace-warn "g++" "${stdenv.cc.targetPrefix}c++"
'';
makeFlags = [
"BINDIR=$(bin)/bin/"
"INCDIR=$(dev)/include/"
"LIBDIR=$(out)/lib/"
"MAN1DIR=$(man)/share/man//man1"
];
makefile = if stdenv.hostPlatform.isDarwin then "Makefile.macosx" else "Makefile.linux";
preInstall = "mkdir -p $bin/bin $dev/include $out/lib $man/share/man/man1";
meta = {
description = "File format, software library and a tool set for compression of 3D triangle meshes";
homepage = "https://sourceforge.net/projects/openctm/";
license = lib.licenses.zlib;
maintainers = with lib.maintainers; [ nim65s ];
};
})
|