nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 cmake,
3 dos2unix,
4 fetchFromGitHub,
5 fetchpatch,
6 lib,
7 libxml2,
8 pcre,
9 pkg-config,
10 stdenv,
11}:
12
13stdenv.mkDerivation (finalAttrs: {
14 pname = "opencollada";
15 version = "1.6.68";
16
17 src = fetchFromGitHub {
18 owner = "KhronosGroup";
19 repo = "OpenCOLLADA";
20 rev = "v${finalAttrs.version}";
21 sha256 = "1ym16fxx9qhf952vva71sdzgbm7ifis0h1n5fj1bfdj8zvvkbw5w";
22 };
23
24 # Fix freaky dos-style CLRF things
25 prePatch = ''
26 dos2unix CMakeLists.txt
27 '';
28
29 patches = [
30 # fix build with gcc 13
31 (fetchpatch {
32 url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/media-libs/opencollada/files/opencollada-1.6.68-gcc13.patch?id=b76590f9fb8615da3da9d783ad841c0e3881a27b";
33 hash = "sha256-oi/QhNPRnuSHfJJ071/3wnjLeg4zZUL6NwSGYvgkb/k=";
34 })
35
36 # fix pcre
37 (fetchpatch {
38 url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/media-libs/opencollada/files/opencollada-1.6.63-pcre-fix.patch";
39 hash = "sha256-igrwgmNwDKYwj6xWvWrryT5ARWJpztVmlQ0HCLQn5+Q=";
40 })
41
42 # fix build with cmake 4
43 (fetchpatch {
44 url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/media-libs/opencollada/files/opencollada-1.6.68-cmake4.patch?id=42f1e0614c4d056841fdc162c29a04ff0e910139";
45 hash = "sha256-gbF6PPalJGgXGu4W7EptYeDq8418JdGH50LIqKqGKX0=";
46 })
47 ];
48
49 postPatch = ''
50 # Drop blanket -Werror as it tends to fail on newer toolchain for
51 # minor warnings. In this case it was gcc-13 build failure.
52 substituteInPlace DAEValidator/CMakeLists.txt --replace-fail ' -Werror"' '"'
53 ''
54 + lib.optionalString stdenv.hostPlatform.isDarwin ''
55 substituteInPlace GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp \
56 --replace math.h cmath
57 '';
58
59 nativeBuildInputs = [
60 cmake
61 pkg-config
62 dos2unix
63 ];
64
65 propagatedBuildInputs = [
66 libxml2
67 pcre
68 ];
69
70 meta = {
71 description = "Library for handling the COLLADA file format";
72 homepage = "https://github.com/KhronosGroup/OpenCOLLADA/";
73 maintainers = [ ];
74 platforms = lib.platforms.unix;
75 license = lib.licenses.mit;
76 };
77})