aboutsummaryrefslogtreecommitdiff
path: root/devel/cmake-core/Makefile
blob: 2048f1a6092d0dfa7018e6f4cfda947911218cd8 (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
PORTNAME=	cmake
DISTVERSION=	${_CMAKE_VERSION}
CATEGORIES=	devel
PKGNAMESUFFIX=	-core

MAINTAINER=	kde@FreeBSD.org
COMMENT=	Cross-platform Makefile generator
WWW=		https://www.cmake.org/

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

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

USES=		cmake:_internal compiler:c++17-lang cpe localbase ncurses ssl
CPE_VENDOR=	cmake_project

HAS_CONFIGURE=	yes
CONFIGURE_CMD=	${WRKSRC}/bootstrap
CONFIGURE_LOG=	Bootstrap.cmk/cmake_bootstrap.log
CONFIGURE_ARGS=	--prefix=${PREFIX} \
		--datadir="/${DATADIR_REL}" \
		--docdir="/${DOCSDIR_REL}" \
		--init="${BUILD_WRKSRC}/InitialCache.cmake" \
		--parallel=${MAKE_JOBS_NUMBER} \
		--system-bzip2 \
		--system-expat \
		--system-jsoncpp \
		--system-liblzma \
		--system-libarchive \
		--system-librhash \
		--system-libuv \
		--system-zlib \
		--system-zstd \
		--no-system-cppdap \
		--no-system-curl \
		--no-system-nghttp2 \
		--verbose
.if defined(WITH_CCACHE_BUILD)
CONFIGURE_ARGS+=	--enable-ccache
.endif
CONFIGURE_ENV=	MAKE=${MAKE}

# Quick fix to enable build with non-base SSL (CFLAGS/LDFLAGS only) (PR: 274512)
CFLAGS+=	-I${OPENSSLINC}
CXXFLAGS+=	-D__BSD_VISIBLE
LDFLAGS+=	-L${OPENSSLLIB}

SUB_FILES=	InitialCache.cmake

BUILD_WRKSRC=		${WRKDIR}/.build
CONFIGURE_WRKSRC=	${BUILD_WRKSRC}
INSTALL_WRKSRC=		${BUILD_WRKSRC}

OPTIONS_DEFINE=		DOCS CPACK
OPTIONS_DEFAULT=	CPACK
OPTIONS_SUB=		yes

CPACK_DESC=		Enable FreeBSD generator in CPack
CPACK_LIB_DEPENDS=	libpkg.so:${PKG_ORIGIN}
CPACK_SUB_LIST=		CPACK_OPTION_VALUE="ON"
CPACK_SUB_LIST_OFF=	CPACK_OPTION_VALUE="OFF"

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|_compiler=\"ccache|_compiler="${CCACHE_BIN}|g' \
		${WRKSRC}/bootstrap
	@${REINPLACE_CMD} -e 's|/usr/include|${LOCALBASE}/include|' \
		${WRKSRC}/Modules/FindDCMTK.cmake
	@${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
		${WRKSRC}/Modules/FindFLEX.cmake
	@${REINPLACE_CMD} -e 's|/opt/kde4|${PREFIX}|g' \
		${WRKSRC}/Modules/FindKDE4.cmake

# 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

pre-configure:
	@${MKDIR} ${BUILD_WRKSRC}
# 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.
	@${CP} ${WRKDIR}/InitialCache.cmake ${BUILD_WRKSRC}

post-install:
	${INSTALL_DATA} ${WRKSRC}/Auxiliary/cmake-mode.el ${STAGEDIR}${PREFIX}/share/emacs/site-lisp

.include <bsd.port.mk>