blob: 3da00353fe4564066d09c395c2da5b476f76a359 (
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
{
stdenv,
lib,
fetchFromGitHub,
cmake,
qt6,
assimp,
opencascade-occt,
ctestCheckHook,
copyDesktopItems,
makeDesktopItem,
# options
withAssimp ? true,
}:
stdenv.mkDerivation (finalAttrs: {
version = "0.9.0";
pname = "mayo";
src = fetchFromGitHub {
owner = "fougue";
repo = "mayo";
tag = "v${finalAttrs.version}";
hash = "sha256-A2ODbbOyoWIhKOWGzSQS2gUF8kpWlN8hN8CdeumAUps=";
};
cmakeFlags = [
(lib.cmakeOptionType "string" "Mayo_VersionMajor" (lib.versions.major finalAttrs.version))
(lib.cmakeOptionType "string" "Mayo_VersionMinor" (lib.versions.minor finalAttrs.version))
(lib.cmakeOptionType "string" "Mayo_VersionPatch" (lib.versions.patch finalAttrs.version))
(lib.cmakeBool "Mayo_BuildTests" finalAttrs.finalPackage.doCheck)
]
++ lib.optional withAssimp "-DMayo_BuildPluginAssimp=ON";
strictDeps = true;
buildInputs = [
qt6.qtbase
qt6.qtsvg
opencascade-occt
]
++ lib.optional withAssimp assimp;
nativeBuildInputs = [
qt6.wrapQtAppsHook
copyDesktopItems
cmake
];
desktopItems = [
(makeDesktopItem {
name = "mayo";
exec = "mayo";
desktopName = "Mayo";
icon = "mayo";
comment = finalAttrs.meta.description;
categories = [
"Graphics"
"3DGraphics"
"Engineering"
];
})
];
doCheck = true;
nativeCheckInputs = [
ctestCheckHook
];
installPhase = ''
runHook preInstall
install -Dm755 mayo $out/bin/mayo
install -Dm755 mayo-conv $out/bin/mayo-conv
pushd ..
install -Dm444 images/appicon.svg "$out/share/icons/hicolor/scalable/apps/mayo.svg"
install -Dm444 images/appicon_256.png "$out/share/icons/hicolor/256x256/apps/mayo.png"
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
install -Dm444 images/appicons.icns "$out/Applications/Mayo.app/Contents/Resources/mayo.icns"
''
+ ''
popd
runHook postInstall
'';
meta = {
description = "3D CAD viewer and converter based on Qt + OpenCascade";
mainProgram = "mayo";
changelog = "https://github.com/fougue/mayo/releases/tag/v${finalAttrs.version}";
homepage = "https://github.com/fougue/mayo";
maintainers = [ lib.maintainers.gigahawk ];
platforms = with lib.platforms; linux ++ darwin;
license = lib.licenses.bsd2;
};
})
|