aboutsummaryrefslogtreecommitdiffstats
path: root/graphics/opencv/Makefile
blob: 97f5e6989b58a2f8db78ced1357791cd065b6c5d (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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# New ports collection makefile for:   opencv
# Date created:                05 March 2005
# Whom:                        Marc Abramowitz (http://marc.abramowitz.info)
#
# $FreeBSD$
#

PORTNAME=   opencv
PORTVERSION=    2.0.0
PORTREVISION=   2
CATEGORIES= graphics
MASTER_SITES=   SF/${PORTNAME}library/${PORTNAME}-unix/2.0
DISTNAME=   OpenCV-${PORTVERSION}

MAINTAINER= avilla@FreeBSD.org
COMMENT=    Open Source Computer Vision library from Intel

USE_GNOME=  pkgconfig
WANT_GSTREAMER= yes
MAKE_JOBS_SAFE= yes
USE_BZIP2=  yes
USE_CMAKE=  yes
CMAKE_ARGS= -DWITH_1394:BOOL=Off -DWITH_UNICAP:BOOL=Off
CMAKE_SOURCE_PATH=  ${WRKSRC}
USE_LDCONFIG=   yes

NOT_FOR_ARCHS=  sparc64
NOT_FOR_ARCHS_REASON_sparc64=   does not compile on sparc64

PORTDOCS=   CMakeLists.txt ChangeLog.htm haartraining.htm index.htm \
        latex_readme.txt license.txt opencv-logo.png \
        opencv-logo2.png opencv.jpg opencv.pdf packaging.txt \
        papers pattern.pdf python.txt vidsurv

PORTEXAMPLES=   c

OPTIONS=    FFMPEG  "Include FFmpeg support" off \
        GSTREAMER   "Include Gstreamer support" off \
        GTK "Include GTK+ support" off \
        JASPER  "Include JPEG 2000 support" on \
        JPEG    "Include JPEG support" on \
        PNG "Include PNG support" on \
        PYTHON  "Build with Python support" off \
        TIFF    "Include TIFF support" on \
        V4L "Include Video4Linux support" on \
        XINE    "Include XINE support" off

# cannot be built with cmake yet
#OCTAVE "Build with Octave support" off \

.include <bsd.port.pre.mk>

.if ${OSVERSION} < 700042
BROKEN=     does not build on 6.X
.endif

.ifndef(NOPORTEXAMPLES)
CMAKE_ARGS+=    -DBUILD_EXAMPLES:BOOL=On -DINSTALL_C_EXAMPLES:BOOL=On
.endif

.if defined(WITH_FFMPEG)
LIB_DEPENDS+=   avcodec.1:${PORTSDIR}/multimedia/ffmpeg
CMAKE_ARGS+=    -DWITH_FFMPEG:BOOL=On
.else
CMAKE_ARGS+=    -DWITH_FFMPEG:BOOL=Off
.endif

.if defined(WITH_GSTREAMER)
LIB_DEPENDS+=   gstreamer-${GST_VERSION}.0:${PORTSDIR}/multimedia/gstreamer
CMAKE_ARGS+=    -DWITH_GSTREAMER:BOOL=On
.else
CMAKE_ARGS+=    -DWITH_GSTREAMER:BOOL=Off
.endif

.if defined(WITH_GTK)
USE_GNOME=  gtk20
CMAKE_ARGS+=    -DWITH_GTK:BOOL=On
.else
CMAKE_ARGS+=    -DWITH_GTK:BOOL=Off
.endif

.if !defined(WITHOUT_JASPER)
LIB_DEPENDS+=   jasper.4:${PORTSDIR}/graphics/jasper
CMAKE_ARGS+=    -DWITH_JASPER:BOOL=On
.else
CMAKE_ARGS+=    -DWITH_JASPER:BOOL=Off
.endif

.if !defined(WITHOUT_JPEG)
LIB_DEPENDS+=   jpeg.11:${PORTSDIR}/graphics/jpeg
CMAKE_ARGS+=    -DWITH_JPEG:BOOL=On
.else
CMAKE_ARGS+=    -DWITH_JPEG:BOOL=Off
.endif

#.if defined(WITH_OCTAVE)
#.include "${PORTSDIR}/Mk/bsd.octave.mk"
#CMAKE_ARGS+=   -DBUILD_OCTAVE_SUPPORT:BOOL=On
#.ifndef(NOPORTEXAMPLES)
#CMAKE_ARGS+=   -DINSTALL_OCTAVE_EXAMPLES:BOOL=On
#PORTEXAMPLES+= octave
#.endif
#PLIST_SUB+=    OCTAVE=""
#.else
#CMAKE_ARGS+=   -DBUILD_OCTAVE_SUPPORT:BOOL=Off
#PLIST_SUB+=    OCTAVE="@comment "
#.endif

.if !defined(WITHOUT_PNG)
LIB_DEPENDS+=   png.6:${PORTSDIR}/graphics/png
CMAKE_ARGS+=    -DWITH_PNG:BOOL=On
.else
CMAKE_ARGS+=    -DWITH_PNG:BOOL=Off
.endif

.if defined(WITH_PYTHON)
.include "${PORTSDIR}/Mk/bsd.python.mk"
USE_PYTHON= yes
CMAKE_ARGS+=    -DBUILD_NEW_PYTHON_SUPPORT:BOOL=On
.ifndef(NOPORTEXAMPLES)
CMAKE_ARGS+=    -DINSTALL_PYTHON_EXAMPLES:BOOL=On
PORTEXAMPLES+=  python
.endif
PLIST_SUB+= PYTHON=""
.else
CMAKE_ARGS+=    -DBUILD_NEW_PYTHON_SUPPORT:BOOL=Off
PLIST_SUB+= PYTHON="@comment "
.endif

.if !defined(WITHOUT_TIFF)
LIB_DEPENDS+=   tiff.4:${PORTSDIR}/graphics/tiff
CMAKE_ARGS+=    -DWITH_TIFF:BOOL=On
.else
CMAKE_ARGS+=    -DWITH_TIFF:BOOL=Off
.endif

.if !defined(WITHOUT_V4L)
BUILD_DEPENDS+= ${LOCALBASE}/include/linux/videodev.h:${PORTSDIR}/multimedia/v4l_compat
CMAKE_ARGS+=    -DWITH_V4L:BOOL=On \
        -DCMAKE_REQUIRED_INCLUDES:STRING="${LOCALBASE}/include"
.else
CMAKE_ARGS+=    -DWITH_V4L:BOOL=Off
.endif

.if defined(WITH_XINE)
LIB_DEPENDS+=   xine.1:${PORTSDIR}/multimedia/libxine
CMAKE_ARGS+=    -DWITH_XINE:BOOL=On
.else
CMAKE_ARGS+=    -DWITH_XINE:BOOL=Off
.endif

CONFIGURE_WRKSRC=${WRKSRC}/build
BUILD_WRKSRC=${CONFIGURE_WRKSRC}
INSTALL_WRKSRC=${BUILD_WRKSRC}

pre-configure:
    @${MKDIR} ${CONFIGURE_WRKSRC}
    @${REINPLACE_CMD} -e 's:set(OPENCV_SOVERSION.*:set(OPENCV_SOVERSION "$${OPENCV_VERSION_MAJOR}"):' \
        -e 's:-pthread:${PTHREAD_LIBS}:g' \
        -e 's:lib/pkgconfig:libdata/pkgconfig:g' \
        -e 's:${PORTNAME}/doc:doc/${PORTNAME}:g' \
        ${WRKSRC}/CMakeLists.txt
    @${REINPLACE_CMD} -e 's:${PORTNAME}/samples:examples/${PORTNAME}:g' \
        ${WRKSRC}/samples/*/CMakeLists.txt
.ifdef(NOPORTDOCS)
    @${REINPLACE_CMD} -e '/add_subdirectory(doc)/ d' \
        ${WRKSRC}/CMakeLists.txt
.endif

.include <bsd.port.post.mk>