aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason E. Hale <jhale@FreeBSD.org>2024-08-13 08:47:30 +0000
committerJason E. Hale <jhale@FreeBSD.org>2024-08-20 05:54:56 +0000
commit76b8901dae25efc80678bb950bdb34a780a39479 (patch)
tree42f0d8d859f89ddbd8adce3a6e3a742dad707f50
parentac9493f7ab65607361f7e3ec106c8cb7b9b613a5 (diff)
devel/cmake-core: Refactor
Move the update reminder to Uses/Mk/cmake.mk where the version has been changed since after 7bdeb4414c22 and will be more likely noticed. Switch to an out-of-source build. This eliminates the need to remove certain unwanted files prior to install. Define a sensible CONFIGURE_LOG for users to report as the default doesn't exist. Sort CONFIGURE_ARGS, not necessarily alphabetically, but to improve readability. Pet portclippy(1): hoist the post-patch target. Settle on one sed(1) delimiter instead of three. Pipes (|) seems to be the most readable here. Remove cruft from ${FILESDIR}/InitialCache.cmake and convert to SUB_FILES to take advantage of framework substitutions. archivers/lzmalib is gone, so there is no need to patch for that. Remove the CPACK_OPTION_COMMENT variable in favor of CMake logic.
-rw-r--r--Mk/Uses/cmake.mk2
-rw-r--r--devel/cmake-core/Makefile78
-rw-r--r--devel/cmake-core/files/InitialCache.cmake29
-rw-r--r--devel/cmake-core/files/InitialCache.cmake.in17
4 files changed, 55 insertions, 71 deletions
diff --git a/Mk/Uses/cmake.mk b/Mk/Uses/cmake.mk
index 26504eda516f..f467bc7f9dd5 100644
--- a/Mk/Uses/cmake.mk
+++ b/Mk/Uses/cmake.mk
@@ -62,6 +62,8 @@ _INCLUDE_USES_CMAKE_MK= yes
_valid_ARGS= indirect insource noninja run testing _internal
+# Reminder: devel/cmake-core, devel/cmake-doc, devel/cmake-gui, and devel/cmake-man
+# are all affected by changing _CMAKE_VERSION. Please check each of these ports.
_CMAKE_VERSION= 3.30.2
CMAKE_BIN= ${LOCALBASE}/bin/cmake
diff --git a/devel/cmake-core/Makefile b/devel/cmake-core/Makefile
index 9c2d40f285a0..2048f1a6092d 100644
--- a/devel/cmake-core/Makefile
+++ b/devel/cmake-core/Makefile
@@ -1,5 +1,4 @@
PORTNAME= cmake
-# Remember to update devel/cmake-doc and devel/cmake-gui as well.
DISTVERSION= ${_CMAKE_VERSION}
CATEGORIES= devel
PKGNAMESUFFIX= -core
@@ -13,31 +12,33 @@ LICENSE_FILE= ${WRKSRC}/Copyright.txt
LIB_DEPENDS= libexpat.so:textproc/expat2 \
libjsoncpp.so:devel/jsoncpp \
- libuv.so:devel/libuv \
- librhash.so:security/rhash
+ librhash.so:security/rhash \
+ libuv.so:devel/libuv
-USES= cmake:_internal compiler:c++11-lang cpe localbase ncurses ssl
+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-zlib \
- --system-zstd \
- --system-bzip2 \
--system-liblzma \
--system-libarchive \
--system-librhash \
--system-libuv \
+ --system-zlib \
+ --system-zstd \
--no-system-cppdap \
--no-system-curl \
--no-system-nghttp2 \
- --parallel=${MAKE_JOBS_NUMBER} \
- --verbose \
- --init="${WRKSRC}/InitialCache.cmake"
+ --verbose
.if defined(WITH_CCACHE_BUILD)
CONFIGURE_ARGS+= --enable-ccache
.endif
@@ -48,59 +49,52 @@ 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}
-
-# 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"
- @${FIND} ${WRKSRC} -name "*.bak" -delete -o -name "*.orig" -delete
-
-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"
+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' \
+ ${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,' \
+ @${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|_compiler=\"ccache|_compiler="${CCACHE_BIN}|g' \
- ${WRKSRC}/bootstrap
+ @${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
+ @${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
- # The .NoDartCoverage is supposed to suppress testing in the
- # source directories, but gets accidentally installed.
- @${FIND} ${STAGEDIR}${PREFIX} -name ".NoDartCoverage" -delete
.include <bsd.port.mk>
diff --git a/devel/cmake-core/files/InitialCache.cmake b/devel/cmake-core/files/InitialCache.cmake
deleted file mode 100644
index 38e354586af1..000000000000
--- a/devel/cmake-core/files/InitialCache.cmake
+++ /dev/null
@@ -1,29 +0,0 @@
-# Disable CMake's tests while building. We are not interested in them when
-# building packages/ports, and it may create problems if part of some
-# dependencies are installed (for example, devel/qmake4 is installed, but
-# devel/qt4-corelib is not).
-# See https://mail.kde.org/pipermail/kde-freebsd/2013-July/015703.html
-set(BUILD_TESTING OFF CACHE BOOL "Build the testing tree.")
-
-# Force CMake to look for base's liblzma, otherwise the configuration process
-# will fail if archivers/lzmalib is installed, as CMake will try to use its
-# liblzma.so.
-# Note that this is necessary only for `make configure' to work, as liblzma is
-# only ever used if CMake's bundled libarchive is being used.
-set(LIBLZMA_INCLUDE_DIR "/usr/include" CACHE PATH
- "Directory where LibLZMA headers are located.")
-set(LIBLZMA_LIBRARY "/usr/lib/liblzma.so" CACHE PATH
- "LibLZMA library to link against.")
-
-# Set (or not) by the CPACK option by replacing @@CPACK_OPTION_VALUE@@
-# with the value of the option itself.
-#
-set(CPACK_ENABLE_FREEBSD_PKG @@CPACK_OPTION_VALUE@@ CACHE BOOL "Enable pkg(8) generator in CPack")
-# Use base libarchive instead of ports, because libpkg uses base
-@@CPACK_OPTION_COMMENT@@set(LibArchive_INCLUDE_DIR "/usr/include" CACHE PATH
-@@CPACK_OPTION_COMMENT@@ "Directory where LibArchive headers are located.")
-# Hack to (a) prevent using either ports libarchive or the bundled version
-# and (b) libpkg links to base libarchive.
-@@CPACK_OPTION_COMMENT@@set(LibArchive_LIBRARY "/usr/lib/libarchive.so" CACHE PATH
-@@CPACK_OPTION_COMMENT@@ "LibArchive library to link against.")
-
diff --git a/devel/cmake-core/files/InitialCache.cmake.in b/devel/cmake-core/files/InitialCache.cmake.in
new file mode 100644
index 000000000000..7532a7832dc9
--- /dev/null
+++ b/devel/cmake-core/files/InitialCache.cmake.in
@@ -0,0 +1,17 @@
+# TODO: Add TEST option to enable regression tests. The tests require
+# additional packages to be installed and a small amount of patching
+# to account for our local changes.
+set(BUILD_TESTING OFF CACHE BOOL "Build the testing tree.")
+
+# Toggled by the CPACK option. Set to ON by default.
+set(CPACK_ENABLE_FREEBSD_PKG %%CPACK_OPTION_VALUE%% CACHE BOOL
+ "Enable pkg(8) generator in CPack")
+
+if(CPACK_ENABLE_FREEBSD_PKG)
+# Use base libarchive instead of the ports or bundled version, because
+# libpkg links against base.
+ set(LibArchive_INCLUDE_DIR "/usr/include" CACHE PATH
+ "Directory where LibArchive headers are located.")
+ set(LibArchive_LIBRARY "/usr/lib/libarchive.so" CACHE PATH
+ "LibArchive library to link against.")
+endif(CPACK_ENABLE_FREEBSD_PKG)