summaryrefslogtreecommitdiff
path: root/graphics/opencolorio/Makefile
blob: 7015c88a8b012c1c3cc0a6010c8e8f5340d6b1a3 (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
96
97
98
99
100
101
102
103
104
105
106
# Created by: Shane Ambler <FreeBSD@Shaneware.biz>
# $FreeBSD$

PORTNAME=	opencolorio
PORTVERSION=	1.1.0
PORTREVISION=	1
DISTVERSIONPREFIX=	v
CATEGORIES=	graphics multimedia

MAINTAINER?=	FreeBSD@Shaneware.biz
COMMENT?=	Complete color management solution

LICENSE=	BSD3CLAUSE

USES=		alias cmake compiler:c++11-lang pkgconfig shebangfix

USE_GITHUB=	yes
GH_ACCOUNT=	imageworks
GH_PROJECT=	OpenColorIO

CMAKE_ON=	USE_EXTERNAL_TINYXML USE_EXTERNAL_YAML
CMAKE_OFF=	OCIO_BUILD_JNIGLUE OCIO_BUILD_NUKE OCIO_BUILD_STATIC
LDFLAGS+=	-L${LOCALBASE}/lib
# pyglue gives an error on use of register
# this should only be an error using c++17
CXXFLAGS+=	-Wno-deprecated-register

SHEBANG_FILES=	share/sphinx/ExtractRstFromSourceCPP.py \
		share/sphinx/ExtractRstFromSourceSimple.py \
		src/pyglue/createPyDocH.py

OPTIONS_DEFINE=		DOCS

DOCS_CMAKE_BOOL=	OCIO_BUILD_DOCS

.if ${MACHINE_CPU:Msse2}
CMAKE_ON+=	OCIO_USE_SSE
.else
CMAKE_OFF+=	OCIO_USE_SSE
.endif

.include <bsd.port.options.mk>

.if defined(OCIO_SLAVE) && ${OCIO_SLAVE} == tools
LIB_DEPENDS=	liblcms2.so:graphics/lcms2 \
		libOpenImageIO.so:graphics/openimageio \
		libOpenColorIO.so:graphics/opencolorio
CMAKE_ON+=	OCIO_BUILD_APPS USE_EXTERNAL_LCMS
CMAKE_OFF+=	OCIO_BUILD_SHARED OCIO_BUILD_PYGLUE
LDFLAGS+=	-lOpenColorIO
USE_GL=		gl glu glut glew
USE_XORG=	xi xmu
PLIST=		${PKGDIR}/pkg-plist-tools
EXTRA_PATCHES=	${PATCHDIR}/tools
.elif defined(OCIO_SLAVE) && ${OCIO_SLAVE} == pymodule
LIB_DEPENDS=	libOpenImageIO.so:graphics/openimageio \
		libOpenColorIO.so:graphics/opencolorio
USES+=		python
USE_PYTHON=	flavors
LDFLAGS+=	-lOpenColorIO
CMAKE_ON+=	OCIO_BUILD_PYGLUE OCIO_PYGLUE_LINK
CMAKE_OFF+=	OCIO_BUILD_APPS OCIO_BUILD_SHARED
CMAKE_ARGS+=	-DPYTHON:FILEPATH=${PYTHON_CMD}
PLIST=		${PKGDIR}/pkg-plist-pyglue
.else # master port
BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}Jinja2>0:devel/py-Jinja2@${PY_FLAVOR}
LIB_DEPENDS=	libtinyxml.so:textproc/tinyxml \
		libyaml-cpp03.so:devel/yaml-cpp03
USES+=		python:2.7,build
USE_LDCONFIG=	yes
CMAKE_ON+=	OCIO_BUILD_SHARED OCIO_BUILD_PYGLUE
CMAKE_OFF+=	OCIO_BUILD_APPS
CMAKE_ARGS+=	-DPYTHON:FILEPATH=${PYTHON_CMD}
# we enable pyglue in master port. This makes the python module
# available when generating docs, we leave the python header in place
# but only install the python module with the py-opencolorio port
# this makes it easier to allow multiple python versions installed
# doc building fails using python3 - but the py-opencolorio port can still
# be used to build a python 3 module
PLIST=		${PKGDIR}/pkg-plist
EXTRA_PATCHES=	${PATCHDIR}/libs
.endif

post-patch:
	@${REINPLACE_CMD} -e '/pkg_check_modules/ s|yaml-cpp|&03|' \
		${WRKSRC}/CMakeLists.txt
	@${REINPLACE_CMD} -e '/YAML_CPP_INCLUDE_DIR/ s|yaml-cpp|&03|' \
		${WRKSRC}/CMakeLists.txt
	@${REINPLACE_CMD} -e '/YAML_CPP_LIBRARY/ s|yaml-cpp|&03|' \
		${WRKSRC}/CMakeLists.txt
	@${REINPLACE_CMD} -e 's|yaml-cpp|&03|' ${WRKSRC}/src/core/OCIOYaml.cpp
.if ${SLAVE_PORT} == yes
	@${FIND} ${WRKSRC}/src/apps -name main.cpp | ${XARGS} \
		${REINPLACE_CMD} '/namespace OIIO/d'
.endif

.if defined(OCIO_SLAVE) && ${OCIO_SLAVE} == pymodule
do-install:
	@${MKDIR} ${STAGEDIR}${PYTHON_SITELIBDIR}
	${INSTALL_LIB} ${BUILD_WRKSRC}/src/pyglue/PyOpenColorIO.so ${STAGEDIR}${PYTHON_SITELIBDIR}
.elif !defined(OCIO_SLAVE)
post-install:
	@${RM} -R ${STAGEDIR}${PYTHON_LIBDIR}
.endif

.include <bsd.port.mk>