summaryrefslogtreecommitdiff
path: root/multimedia/kodi/Makefile
blob: 16e92d74d70f5ed8d78aefb38a7049eb0259faec (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
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293

PORTNAME=	kodi
DISTVERSION=	19.0
DISTVERSIONSUFFIX=	-${KODI_CODENAME}
CATEGORIES=	multimedia java

MAINTAINER=	yzrh@noema.org
COMMENT=	Award winning media center application

LICENSE=	GPLv2+

ONLY_FOR_ARCHS=	aarch64 amd64 armv6 armv7 i386 powerpc64 powerpc64le

BUILD_DEPENDS=	flatbuffers>0:devel/flatbuffers \
		rapidjson>0:devel/rapidjson \
		swig>0:devel/swig
LIB_DEPENDS=	libass.so:multimedia/libass \
		libavcodec.so:multimedia/ffmpeg \
		libavfilter.so:multimedia/ffmpeg \
		libavformat.so:multimedia/ffmpeg \
		libavutil.so:multimedia/ffmpeg \
		libcdio.so:sysutils/libcdio \
		libcrossguid.so:devel/libcrossguid \
		libcurl.so:ftp/curl \
		libdav1d.so:multimedia/dav1d \
		libdvdnav.so:multimedia/libdvdnav \
		libdvdread.so:multimedia/libdvdread \
		libexpat.so:textproc/expat2 \
		libfmt.so:devel/libfmt \
		libfreetype.so:print/freetype2 \
		libfribidi.so:converters/fribidi \
		libfstrcmp.so:devel/fstrcmp \
		libgif.so:graphics/giflib \
		liblzo2.so:archivers/lzo2 \
		libpcre.so:devel/pcre \
		libpng.so:graphics/png \
		libpostproc.so:multimedia/ffmpeg \
		libspdlog.so:devel/spdlog \
		libswresample.so:multimedia/ffmpeg \
		libswscale.so:multimedia/ffmpeg \
		libtag.so:audio/taglib \
		libtinyxml.so:textproc/tinyxml \
		libuuid.so:misc/e2fsprogs-libuuid

USES=		cmake compiler:c++14-lang gettext \
		gnome iconv jpeg pkgconfig python:3.5+ sqlite ssl

KODI_CODENAME=	Matrix

USE_GITHUB=	yes
GH_ACCOUNT=	xbmc
GH_PROJECT=	xbmc

KODI_ARCH_aarch64=	aarch64
KODI_ARCH_amd64=	x86_64
KODI_ARCH_i386=		x86
KODI_ARCH_armv7=	armv7
KODI_ARCH_armv6=	armv6
KODI_ARCH_powerpc64=	powerpc64
KODI_ARCH_powerpc64le=	powerpc64le

PLIST_SUB=	ARCH=${KODI_ARCH_${ARCH}}

INSTALLS_ICONS=	yes
USE_LDCONFIG=	yes
USE_JAVA=	yes
JAVA_BUILD=	jre
USE_GNOME=	libxml2
CMAKE_ARGS=	-DGIT_VERSION="${GH_TAGNAME}" \
		-DDVDNAV_LIBRARY="${LOCALBASE}/lib/libdvdnav.so" \
		-DDVDREAD_LIBRARY="${LOCALBASE}/lib/libdvdread.so" \
		-DLIBDVD_INCLUDE_DIRS="${LOCALBASE}/include"
CMAKE_OFF=	ENABLE_INTERNAL_CROSSGUID
CONFIGURE_ENV=	_CPU_FEATURE="${CPU_FEATURE}"

OPTIONS_SUB=		yes
# Broken: BLUETOOTH
OPTIONS_DEFINE=		AIRPLAY AVAHI LIBBLURAY CEC DBUS DVDCSS LCMS2 \
			LIRC WEBSERVER NFS DVD SMB TEST UDEV UPNP \
			VAAPI VDPAU XSLT DOCS
OPTIONS_DEFAULT=	LIBBLURAY CEC DVDCSS LCMS2 WEBSERVER \
			DVD UPNP VAAPI VDPAU XSLT WAYLAND X11 GL
OPTIONS_DEFAULT_amd64=	SSE SSE2 SSE3 SSSE3 SSE4_1 SSE4_2
OPTIONS_DEFAULT_i386=	SSE SSE2 SSE3
OPTIONS_SINGLE=		RENDER
OPTIONS_SINGLE_RENDER=	GL GLES
OPTIONS_RADIO=		DATABASE
OPTIONS_RADIO_DATABASE=	MARIADB MYSQL
OPTIONS_GROUP=		SOUND FEATURE PLATFORM
# Broken: ALSA
OPTIONS_GROUP_SOUND=	PULSEAUDIO SNDIO
OPTIONS_GROUP_FEATURE=	SSE SSE2 SSE3 SSSE3 SSE4_1 SSE4_2 AVX AVX2
OPTIONS_GROUP_PLATFORM=GBM WAYLAND X11
OPTIONS_EXCLUDE_aarch64=FEATURE
OPTIONS_EXCLUDE_armv7=	FEATURE
OPTIONS_EXCLUDE_armv6=	FEATURE

PLATFORM_DESC=	Kodi platform
DATABASE_DESC=	Database
FEATURE_DESC=	X86 CPU feature

AIRPLAY_DESC=	AirPlay support
BLUETOOTH_DESC=	Bluetooth support
CEC_DESC=	CEC adapter support
DVD_DESC=	DVD support
UDEV_DESC=	Use libudev-devd
XSLT_DESC=	Use libxslt

RENDER_DESC=	Render system
GL_DESC=	OpenGL
GLES_DESC=	OpenGL ES

GBM_DESC=	GBM support
MARIADB_DESC=	MariaDB database support

SSE2_DESC=	Use SSE2 optimized routines
SSE3_DESC=	Use SSE3 optimized routines
SSSE3_DESC=	Use SSSE3 optimized routines
SSE4_1_DESC=	Use SSE4.1 optimized routines
SSE4_2_DESC=	Use SSE4.2 optimized routines
AVX_DESC=	Use AVX optimized routines
AVX2_DESC=	Use AVX2 optimized routines

AIRPLAY_LIB_DEPENDS=	libplist-2.0.so:devel/libplist \
			libshairplay.so:audio/shairplay
AIRPLAY_CMAKE_BOOL=	ENABLE_PLIST \
			ENABLE_AIRTUNES

AVAHI_LIB_DEPENDS=	libavahi-client.so:net/avahi-app
AVAHI_CMAKE_BOOL=	ENABLE_AVAHI

BLUETOOTH_CMAKE_BOOL=	ENABLE_BLUETOOTH
BLUETOOTH_CMAKE_ON=	-DBLUETOOTH_INCLUDE_DIR="${LOCALBASE}/include"

LIBBLURAY_LIB_DEPENDS=	libbluray.so:multimedia/libbluray
LIBBLURAY_CMAKE_BOOL=	ENABLE_BLURAY

CEC_LIB_DEPENDS=	libcec.so:multimedia/libcec
CEC_CMAKE_BOOL=		ENABLE_CEC

DBUS_LIB_DEPENDS=	libdbus-1.so:devel/dbus
DBUS_CMAKE_BOOL=	ENABLE_DBUS

DVDCSS_LIB_DEPENDS=	libdvdcss.so:multimedia/libdvdcss
DVDCSS_CMAKE_BOOL=	ENABLE_DVDCSS
DVDCSS_CMAKE_ON=	-DDVDCSS_LIBRARY="${LOCALBASE}/lib/libdvdcss.so"

LCMS2_LIB_DEPENDS=	liblcms2.so.2:graphics/lcms2
LCMS2_CMAKE_BOOL=	ENABLE_LCMS2

LIRC_LIB_DEPENDS=	liblirc_client.so:comms/lirc
LIRC_CMAKE_BOOL=	ENABLE_LIRCCLIENT

WEBSERVER_LIB_DEPENDS=	libmicrohttpd.so:www/libmicrohttpd
WEBSERVER_CMAKE_BOOL=	ENABLE_MICROHTTPD

NFS_LIB_DEPENDS=	libnfs.so:net/libnfs
NFS_CMAKE_BOOL=		ENABLE_NFS

DVD_CMAKE_BOOL=		ENABLE_OPTICAL

SMB_USES=		samba:lib
SMB_CMAKE_BOOL=		ENABLE_SMBCLIENT

TEST_LIB_DEPENDS=	libgtest.so:devel/googletest
TEST_CMAKE_BOOL=	ENABLE_TESTING

UDEV_LIB_DEPENDS=	libudev.so:devel/libudev-devd
UDEV_CMAKE_BOOL=	ENABLE_UDEV

UPNP_CMAKE_BOOL=	ENABLE_UPNP

VAAPI_LIB_DEPENDS=	libva.so:multimedia/libva
VAAPI_CMAKE_BOOL=	ENABLE_VAAPI

VDPAU_LIB_DEPENDS=	libvdpau.so:multimedia/libvdpau
VDPAU_CMAKE_BOOL=	ENABLE_VDPAU

XSLT_LIB_DEPENDS=	libxslt.so:textproc/libxslt
XSLT_CMAKE_BOOL=	ENABLE_XSLT

GL_CMAKE_ON=		-DAPP_RENDER_SYSTEM:STRING="gl"

GLES_CMAKE_ON=		-DAPP_RENDER_SYSTEM:STRING="gles"

MARIADB_USES=		mysql:105m
MARIADB_CMAKE_BOOL=	ENABLE_MARIADBCLIENT
MARIADB_CMAKE_ON=	-DMARIADBCLIENT_INCLUDE_DIR="${LOCALBASE}/include"

MYSQL_USES=		mysql
MYSQL_CMAKE_BOOL=	ENABLE_MYSQLCLIENT

ALSA_LIB_DEPENDS=	libasound.so:audio/alsa-lib
ALSA_CMAKE_BOOL=	ENABLE_ALSA

PULSEAUDIO_LIB_DEPENDS=	libpulse.so:audio/pulseaudio
PULSEAUDIO_CMAKE_BOOL=	ENABLE_PULSEAUDIO

SNDIO_LIB_DEPENDS=	libsndio.so:audio/sndio
SNDIO_CMAKE_BOOL=	ENABLE_SNDIO

SSE_VARS=		CPU_FEATURE+=SSE
SSE2_VARS=		CPU_FEATURE+=SSE2
SSE3_VARS=		CPU_FEATURE+=SSE3
SSSE3_VARS=		CPU_FEATURE+=SSSE3
SSE4_1_VARS=		CPU_FEATURE+=SSE4.1
SSE4_2_VARS=		CPU_FEATURE+=SSE4.2
AVX_VARS=		CPU_FEATURE+=AVX
AVX2_VARS=		CPU_FEATURE+=AVX2

GBM_IMPLIES=		UDEV
GBM_USES=		gl
GBM_USE=		GL=egl,gbm,glu
GBM_CFLAGS=		-I${LOCALBASE}/include/libepoll-shim
GBM_LDFLAGS=		-L${LOCALBASE}/lib -lepoll-shim
GBM_BUILD_DEPENDS=	evdev-proto>0:devel/evdev-proto
GBM_LIB_DEPENDS=	libepoll-shim.so:devel/libepoll-shim \
			libdrm.so:graphics/libdrm \
			libxkbcommon.so:x11/libxkbcommon \
			libinput.so:x11/libinput

WAYLAND_USES=		gl
WAYLAND_USE=		GL=egl,glu
WAYLAND_BUILD_DEPENDS=	evdev-proto>0:devel/evdev-proto \
			wayland-protocols>0:graphics/wayland-protocols
WAYLAND_LIB_DEPENDS=	libdrm.so:graphics/libdrm \
			libxkbcommon.so:x11/libxkbcommon \
			libinput.so:x11/libinput \
			libwayland-client++.so:graphics/waylandpp

X11_USES=		xorg gl
X11_USE=		XORG=x11,xext,xrandr GL=egl,gbm,gl,glu
X11_LIB_DEPENDS=	libdrm.so:graphics/libdrm

.include <bsd.port.options.mk>

.if !empty(PORT_OPTIONS:MGBM) && !empty(PORT_OPTIONS:MWAYLAND) && !empty(PORT_OPTIONS:MX11)
CMAKE_ARGS+=	-DCORE_PLATFORM_NAME:STRING="gbm wayland x11"
.elif empty(PORT_OPTIONS:MGBM) && !empty(PORT_OPTIONS:MWAYLAND) && !empty(PORT_OPTIONS:MX11)
CMAKE_ARGS+=	-DCORE_PLATFORM_NAME:STRING="wayland x11"
.elif !empty(PORT_OPTIONS:MGBM) && empty(PORT_OPTIONS:MWAYLAND) && !empty(PORT_OPTIONS:MX11)
CMAKE_ARGS+=	-DCORE_PLATFORM_NAME:STRING="gbm x11"
.elif !empty(PORT_OPTIONS:MGBM) && !empty(PORT_OPTIONS:MWAYLAND) && empty(PORT_OPTIONS:MX11)
CMAKE_ARGS+=	-DCORE_PLATFORM_NAME:STRING="gbm wayland"
.elif empty(PORT_OPTIONS:MGBM) && empty(PORT_OPTIONS:MWAYLAND) && !empty(PORT_OPTIONS:MX11)
CMAKE_ARGS+=	-DCORE_PLATFORM_NAME:STRING="x11"
.elif empty(PORT_OPTIONS:MGBM) && !empty(PORT_OPTIONS:MWAYLAND) && empty(PORT_OPTIONS:MX11)
CMAKE_ARGS+=	-DCORE_PLATFORM_NAME:STRING="wayland"
.elif !empty(PORT_OPTIONS:MGBM) && empty(PORT_OPTIONS:MWAYLAND) && empty(PORT_OPTIONS:MX11)
CMAKE_ARGS+=	-DCORE_PLATFORM_NAME:STRING="gbm"
.endif

.if !empty(PORT_OPTIONS:MGBM) && !empty(PORT_OPTIONS:MWAYLAND) || !empty(PORT_OPTIONS:MGBM) && !empty(PORT_OPTIONS:MX11) || !empty(PORT_OPTIONS:MWAYLAND) && !empty(PORT_OPTIONS:MX11)
PLIST_SUB+=	KODICOMBINED="" \
		KODIGBM="@comment " \
		KODIWAYLAND="@comment " \
		KODIX11="@comment "
.else
PLIST_SUB+=	KODICOMBINED="@comment "

.if !empty(PORT_OPTIONS:MGBM)
PLIST_SUB+=	KODIGBM=""
.else
PLIST_SUB+=	KODIGBM="@comment "
.endif

.if !empty(PORT_OPTIONS:MWAYLAND)
PLIST_SUB+=	KODIWAYLAND=""
.else
PLIST_SUB+=	KODIWAYLAND="@comment "
.endif

.if !empty(PORT_OPTIONS:MX11)
PLIST_SUB+=	KODIX11=""
.else
PLIST_SUB+=	KODIX11="@comment "
.endif
.endif

post-patch:
	${REINPLACE_CMD} 's|KODI_DEPENDSBUILD|true|' \
		${WRKSRC}/cmake/modules/FindLibDvd.cmake
	${REINPLACE_CMD} 's|/usr/share|${LOCALBASE}/share|' \
		${WRKSRC}/xbmc/platform/linux/input/LibInputSettings.cpp

post-install:
	${INSTALL_MAN} ${WRKSRC}/docs/manpages/kodi.bin.1 ${STAGEDIR}${MAN1PREFIX}/man/man1
	cd ${STAGEDIR}${MAN1PREFIX}/man/man1 && ${LN} -s kodi.bin.1.gz kodi.1.gz
	cd ${STAGEDIR}${PREFIX}/bin && ${STRIP_CMD} TexturePacker JsonSchemaBuilder
	${FIND} ${STAGEDIR}${PREFIX}/lib/kodi -type f -name '*.so' -print0 | ${XARGS} -0 ${STRIP_CMD}
	${RM} -rf ${STAGEDIR}${PREFIX}/lib/firewalld

.include <bsd.port.mk>