aboutsummaryrefslogtreecommitdiff
path: root/devel/cmake/Makefile
blob: b3c4c52435f0c82b9fa86f4d5b0d9ad306873a86 (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
# Created by: Kyle Martin <mkm@ieee.org>

PORTNAME=	cmake
# Remember to update devel/cmake-doc and devel/cmake-gui as well.
DISTVERSION=	3.21.2
CATEGORIES=	devel
MASTER_SITES=	https://github.com/Kitware/CMake/releases/download/v${DISTVERSION}/ \
		https://www.cmake.org/files/v${PORTVERSION}/

MAINTAINER=	kde@FreeBSD.org
COMMENT=	Cross-platform Makefile generator

LICENSE=	BSD3CLAUSE
LICENSE_FILE=	${WRKSRC}/Copyright.txt

LIB_DEPENDS=	libcurl.so:ftp/curl \
		libexpat.so:textproc/expat2 \
		libjsoncpp.so:devel/jsoncpp \
		libuv.so:devel/libuv \
		librhash.so:security/rhash

USES=		compiler:c++11-lang cpe ncurses

CPE_VENDOR=	cmake_project
HAS_CONFIGURE=	yes
CONFIGURE_ENV=	MAKE=make
CONFIGURE_ARGS=	--prefix=${PREFIX} \
		--datadir="/${DATADIR_REL}" \
		--docdir="/${DOCSDIR_REL}" \
		--system-libs \
		--parallel=${MAKE_JOBS_NUMBER} \
		--init="${WRKSRC}/InitialCache.cmake"

OPTIONS_DEFINE=	DOCS MANPAGES CPACK
OPTIONS_DEFAULT=MANPAGES
OPTIONS_SUB=	yes

MANPAGES_USES=		python:3.6-3.9,env
MANPAGES_BUILD_DEPENDS=	sphinx-build-${PYTHON_VER}:textproc/py-sphinx@${PY_FLAVOR}
MANPAGES_VARS=		BINARY_ALIAS=sphinx-build=sphinx-build-${PYTHON_VER}
MANPAGES_CONFIGURE_ON=	--sphinx-man

CPACK_DESC=		Enable FreeBSD generator in CPack (experimental)
CPACK_LIB_DEPENDS=	libpkg.so:${PKG_ORIGIN}
CPACK_USES_OFF=		libarchive
# When CPACK is on, uses base libarchive and won't pass stage-qa

CONFLICTS_INSTALL=	cmake-modules-*

CXXFLAGS+=	-D__BSD_VISIBLE

.include <bsd.port.pre.mk>

.if defined(STRIP) && ${STRIP} != "" && !defined(WITH_DEBUG)
INSTALL_TARGET=	install/strip
.endif

# Before running configure, substitute in the values of options
# for the build. CMake's configure doesn't accept --with-foo
# or similar options: it expects them to be set in CMake-style
# syntax in the initial cache.
pre-configure:
	@${CP} "${FILESDIR}/InitialCache.cmake" "${WRKSRC}/InitialCache.cmake"

pre-configure-CPACK-on:
	@${REINPLACE_CMD} \
		-e 's/@@CPACK_OPTION_VALUE@@/ON/' \
		-e 's/@@CPACK_OPTION_COMMENT@@//' \
		"${WRKSRC}/InitialCache.cmake"

pre-configure-CPACK-off:
	@${REINPLACE_CMD} \
		-e 's/@@CPACK_OPTION_VALUE@@/OFF/' \
		-e 's/@@CPACK_OPTION_COMMENT@@/# /' \
		"${WRKSRC}/InitialCache.cmake"

post-patch:
	@(${FIND} ${WRKSRC}/Modules -name "*.cmake" -print0; \
		${FIND} ${WRKSRC}/Tests -name "CMakeLists.txt" -print0 ) | \
		${XARGS} -0 -n 100 ${REINPLACE_CMD} -e 's,/usr/local,${LOCALBASE},g; \
			s,/usr/X11R6,${LOCALBASE},g'
	@${REINPLACE_CMD} -e 's,/usr/local,${LOCALBASE},g' \
		${WRKSRC}/Source/cmLocalGenerator.cxx \
		${WRKSRC}/Source/CPack/cmCPackGenerator.cxx \
		${WRKSRC}/bootstrap
	@${REINPLACE_CMD} -e 's,/opt/kde4,${PREFIX},g' \
		${WRKSRC}/Modules/FindKDE4.cmake
	@${REINPLACE_CMD} -e 's,/usr/include,${LOCALBASE}/include,' \
		${WRKSRC}/Modules/FindDCMTK.cmake
	@${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
		${WRKSRC}/Modules/FindFLEX.cmake
	@${FIND} ${WRKSRC} -name "*.bak" -delete -o -name "*.orig" -delete

# cmake-gui(1) is installed by devel/cmake-gui. Remove the man page's source to
# prevent it from being built/installed by devel/cmake.
	${RM} ${WRKSRC}/Help/manual/cmake-gui.1.rst

post-install:
	${INSTALL_DATA} ${WRKSRC}/Auxiliary/cmake-mode.el ${STAGEDIR}${PREFIX}/share/emacs/site-lisp
	# The .NoDartCoverage is supposed to suppress testing in the
	# source directories, but gets accidentally installed.
	@${FIND} ${STAGEDIR}${PREFIX} -name ".NoDartCoverage" -delete

.include <bsd.port.post.mk>