summaryrefslogtreecommitdiffstats
path: root/graphics/waifu2x-converter-cpp/Makefile
blob: c7b30a8b031096ff170d7d3015fb10f16327263c (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
# $FreeBSD$

PORTNAME=	waifu2x-converter-cpp
DISTVERSION=	1.0.0-410
DISTVERSIONSUFFIX=	-g5e5ac35
PORTREVISION=	2
CATEGORIES=	graphics
MASTER_SITES=	https://aur.archlinux.org/cgit/aur.git/plain/${PORTNAME:C/-.*//}.1.gz?h=${PORTNAME:C/-.*//}-git&id=5c150a5&/:manpage
DISTFILES=	${PORTNAME:C/-.*//}.1.gz:manpage
EXTRACT_ONLY=	${DISTFILES:N*\:manpage:C/:.*//}

MAINTAINER=	jbeich@FreeBSD.org
COMMENT=	Scale and denoise images using convolutional neural networks

LICENSE=	BSD2CLAUSE MIT
LICENSE_COMB=	multi
LICENSE_FILE_BSD2CLAUSE=${WRKSRC}/LICENSE
LICENSE_FILE_MIT=	${WRKSRC}/LICENSE

BUILD_DEPENDS=	${LOCALBASE}/include/CL/opencl.h:devel/opencl
LIB_DEPENDS=	libopencv_highgui.so:graphics/opencv2 \
		libopencv_imgproc.so:graphics/opencv2-core

USE_GITHUB=	yes
GH_ACCOUNT=	tanakamura

USES=		cmake compiler:c++11-lib dos2unix
DOS2UNIX_GLOB=	*.cpp *.hpp
CMAKE_ARGS=	-DOPENCV_PREFIX="${LOCALBASE}" \
		-DOpenCL_LIBRARY="${LOCALBASE}/lib/libOpenCL.so" \
		-DINSTALL_MODELS=on
CFLAGS+=	-D_GLIBCXX_USE_C99 -D_GLIBCXX_USE_C99_MATH_TR1 \
		-D_DECLARE_C99_LDBL_MATH # XXX ports/193528
LDFLAGS+=	-Wl,--as-needed # avoid overlinking (opencv deps)
TEST_TARGET=	test ARGS="-V"
USE_LDCONFIG=	yes
PLIST_FILES=	bin/${PORTNAME} \
		man/man1/${PORTNAME}.1.gz \
		include/w2xconv.h \
		lib/libw2xc.so
PORTDATA=	*
PORTDOCS=	*

OPTIONS_DEFINE=	DOCS SIMD
OPTIONS_DEFAULT=SIMD

DOCS_CMAKE_ON=	-DINSTALL_DOCS=on
SIMD_CMAKE_OFF=	-DARMOPT=off -DX86OPT=off

post-extract:
	@${GZCAT} ${_DISTDIR}/${DISTFILES:M*\:manpage:C/:.*//} \
		>${WRKDIR}/${PORTNAME}.1

post-patch:
	@${REINPLACE_CMD} -e '/Darwin/,/FLAGS_RELEASE/d' \
		-e 's,".*\(-m[^[:space:]]*\).*","\1",' \
		-e 's/$${TS}/${DISTVERSIONFULL}/' \
		${WRKSRC}/CMakeLists.txt
# Undo AUR rename and use version from |git describe --tags|
	@${REINPLACE_CMD} -e '/AUTHORS/,$$! { /\.B mai/! \
			s,${PORTNAME:C/-.*//},${PORTNAME},; }' \
		-e '1s,\(version\) [^"]*,\1 ${DISTVERSIONFULL},' \
		${WRKDIR}/${PORTNAME}.1

post-install:
	${INSTALL_MAN} ${WRKDIR}/${PORTNAME}.1 \
		${STAGEDIR}${MAN1PREFIX}/man/man1

.include <bsd.port.mk>
OpenPOWER on IntegriCloud