aboutsummaryrefslogtreecommitdiff
path: root/graphics/cimg/Makefile
blob: ad6f3906461c9f6ce5d85ae5b660ce8eb886612a (plain) (blame)
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
PORTNAME=	cimg
DISTVERSIONPREFIX=	v.
DISTVERSION=	3.6.6
PORTEPOCH=	3
CATEGORIES=	graphics devel

MAINTAINER=	thierry@FreeBSD.org
COMMENT=	C++ Template Image Processing Library
WWW=		https://cimg.eu/

LICENSE=	CeCILL_C CeCILL
LICENSE_COMB=	dual
LICENSE_NAME_CeCILL_C=	CeCILL-C
LICENSE_NAME_CeCILL=	CeCILL
LICENSE_FILE_CeCILL_C=	${WRKSRC}/Licence_CeCILL-C_V1-en.txt
LICENSE_FILE_CeCILL=	${WRKSRC}/Licence_CeCILL_V2-en.txt
LICENSE_PERMS_CeCILL_C=	dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
LICENSE_PERMS_CeCILL=	dist-mirror dist-sell pkg-mirror pkg-sell auto-accept

USE_GITHUB=	yes
GH_ACCOUNT=	GreycLab
GH_PROJECT=	CImg

BUILD_WRKSRC=	${WRKSRC}/examples

OPTIONS_DEFINE=	DOCS EXAMPLES

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MDOCS} || ${PORT_OPTIONS:MEXAMPLES}
USES+=		compiler:c11 gmake pkgconfig:build xorg
.endif

.if ${PORT_OPTIONS:MDOCS}

REINPLACE_ARGS=	-i ""

. if !defined(WITH_DEBUG)
LIB_DEPENDS+=	libcurl.so:ftp/curl			\
		libpng.so:graphics/png			\
		libtiff.so:graphics/tiff		\
		libImath.so:math/Imath			\
		libheif.so:graphics/libheif		\
		libOpenEXR.so:graphics/openexr		\
		libfftw3.so:math/fftw3			\
		libwebp.so:graphics/webp		\
		libopencv_core.so:graphics/opencv	\
		libGraphicsMagick.so:graphics/GraphicsMagick
RUN_DEPENDS+=	dcraw:graphics/dcraw
USES+=		jpeg magick:7
ALL_TARGET=	Mlinux
. else
ALL_TARGET=	dlinux
WITHOUT_MEDCON=	yes
WITHOUT_FFMPEG=	yes
. endif

. if !defined(WITHOUT_MEDCON)
RUN_DEPENDS+=	medcon:graphics/xmedcon
. endif
. if !defined(WITHOUT_FFMPEG)
LIB_DEPENDS+=	libavformat.so:multimedia/ffmpeg
. endif

USE_XORG+=	x11 xrandr
. if defined(WITH_XSHM)
USE_XORG+=	xext
. endif

DOCBASE=	README.txt
CFLAGS+=	-I${LOCALBASE}/include/Imath -I${LOCALBASE}/include/OpenEXR
MAKE_ARGS+=	CPPFLAGS="${CFLAGS}" FREEBSD_LDFLAGS="${LDFLAGS}"
. if !exists(/usr/include/omp.h)
MAKE_ARGS+=	OPENMP_CFLAGS=
. endif
PROGS=		CImg_demo captcha curve_editor2d dtmri_view3d			\
	edge_explorer2d fade_images gaussian_fit1d generate_loop_macros		\
	hough_transform2d image2ascii image_registration2d image_surface3d	\
	jawbreaker mcf_levelsets2d mcf_levelsets3d odykill			\
	pde_TschumperleDeriche2d pde_heatflow2d plotter1d radon_transform2d	\
	scene3d spherical_function3d tetris tron tutorial use_RGBclass		\
	use_chlpca use_draw_gradient use_jpeg_buffer use_nlmeans use_skeleton	\
	wavelet_atrous
.else
NO_BUILD=	yes
.endif

.include <bsd.port.pre.mk>

pre-configure-DOCS-on:
	${REINPLACE_CMD} -e 's|make|${MAKE_CMD}|' ${BUILD_WRKSRC}/Makefile

pre-configure-DOCS-off:
	${REINPLACE_CMD} -e 's|^OPTFLAGS|#OPTFLAGS|' ${BUILD_WRKSRC}/Makefile

pre-configure:
. if !defined(WITHOUT_FFMPEG)
	${REINPLACE_CMD} -e 's|#FFMPEG_CFLAGS|FFMPEG_CFLAGS|'	\
		-e 's|#FFMPEG_DEFINE|FFMPEG_DEFINE|'		\
		-e 's|#FFMPEG_LIBS|FFMPEG_LIBS|'		\
		${BUILD_WRKSRC}/Makefile
. endif
. if defined(WITH_XSHM)
	${REINPLACE_CMD} -e 's|XSHM_CFLAGS = #|XSHM_CFLAGS =|'	\
		-e 's|XSHM_LDFLAGS = #|XSHM_LDFLAGS =|'		\
		${BUILD_WRKSRC}/Makefile
. endif

do-install:
	${INSTALL_DATA} ${WRKSRC}/CImg.h ${STAGEDIR}${PREFIX}/include

do-install-DOCS-on:
	${INSTALL_PROGRAM} ${PROGS:C|^|${BUILD_WRKSRC}/|} ${STAGEDIR}${PREFIX}/bin
	${MKDIR} ${STAGEDIR}${DOCSDIR}
	${INSTALL_DATA} ${DOCBASE:S|^|${WRKSRC}/|} ${STAGEDIR}${DOCSDIR}

do-install-EXAMPLES-on:
	${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
	${CP} -R ${WRKSRC}/examples/* ${STAGEDIR}${EXAMPLESDIR}
	@(cd ${STAGEDIR}${EXAMPLESDIR} && ${MAKE_CMD} clean)
	@${RM} ${STAGEDIR}${EXAMPLESDIR}/*.orig

.include <bsd.port.post.mk>