Date: Wed, 20 Jun 2018 09:00:54 +0000 (UTC) From: Adriaan de Groot <adridg@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r472857 - in head/devel/cmake: . files Message-ID: <201806200900.w5K90s0m094768@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: adridg Date: Wed Jun 20 09:00:53 2018 New Revision: 472857 URL: https://svnweb.freebsd.org/changeset/ports/472857 Log: ntroduce OPTION for devel/cmake to generate packages The generator causes segfaults because it doesn't call pkg_init() (see https://gitlab.kitware.com/cmake/cmake/issues/18031). This feature was briefly enabled by default for 3.11.0, between r467437 (added) and r467620 (removed), but causes problems with stage-qa (PR 227372). Hide it behind an OPTION for people who want it and don't worry about stage-qa. The patch to CPack source will be submitted upstream once some corner cases are ironed out. Reported by: upstream Approved by: tcberner Differential Revision: https://reviews.freebsd.org/D15900 Added: head/devel/cmake/files/patch-Source_CPack_cmCPackFreeBSDGenerator.cxx (contents, props changed) Modified: head/devel/cmake/Makefile head/devel/cmake/files/InitialCache.cmake Modified: head/devel/cmake/Makefile ============================================================================== --- head/devel/cmake/Makefile Wed Jun 20 08:56:04 2018 (r472856) +++ head/devel/cmake/Makefile Wed Jun 20 09:00:53 2018 (r472857) @@ -4,6 +4,7 @@ PORTNAME= cmake # Remember to update devel/cmake-doc and devel/cmake-gui as well. DISTVERSION= 3.11.4 +PORTREVISION= 1 CATEGORIES= devel MASTER_SITES= https://www.cmake.org/files/v${PORTVERSION:R}/ @@ -19,7 +20,7 @@ LIB_DEPENDS= libcurl.so:ftp/curl \ libuv.so:devel/libuv \ librhash.so:security/rhash -USES= compiler:c++11-lang libarchive ncurses +USES= compiler:c++11-lang ncurses HAS_CONFIGURE= yes CONFIGURE_ENV= MAKE=make @@ -28,9 +29,9 @@ CONFIGURE_ARGS= --prefix=${PREFIX} \ --docdir="/${DOCSDIR_REL}" \ --system-libs \ --parallel=${MAKE_JOBS_NUMBER} \ - --init="${PATCHDIR}/InitialCache.cmake" + --init="${WRKSRC}/InitialCache.cmake" -OPTIONS_DEFINE= DOCS MANPAGES +OPTIONS_DEFINE= DOCS MANPAGES CPACK OPTIONS_DEFAULT=MANPAGES OPTIONS_SUB= yes @@ -38,6 +39,11 @@ MANPAGES_USES= python:env MANPAGES_BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}sphinx>0:textproc/py-sphinx@${PY_FLAVOR} MANPAGES_CONFIGURE_ON= --sphinx-man +CPACK_DESC= Enable FreeBSD generator in CPack (experimental) +CPACK_LIB_DEPENDS= libpkg.so:ports-mgmt/pkg +CPACK_USES_OFF= libarchive +# When CPACK is on, uses base libarchive and won't pass stage-qa + CONFLICTS_INSTALL= cmake-modules-* .include <bsd.port.pre.mk> @@ -45,6 +51,25 @@ CONFLICTS_INSTALL= cmake-modules-* .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; \ Modified: head/devel/cmake/files/InitialCache.cmake ============================================================================== --- head/devel/cmake/files/InitialCache.cmake Wed Jun 20 08:56:04 2018 (r472856) +++ head/devel/cmake/files/InitialCache.cmake Wed Jun 20 09:00:53 2018 (r472857) @@ -15,5 +15,15 @@ set(LIBLZMA_INCLUDE_DIR "/usr/include" CACHE PATH set(LIBLZMA_LIBRARY "/usr/lib/liblzma.so" CACHE PATH "LibLZMA library to link against.") -# Don't even try -set(CPACK_ENABLE_FREEBSD_PKG OFF CACHE BOOL "Enable pkg(8) generator in CPack") +# 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/libthr.so;/usr/lib/libarchive.so" CACHE PATH +@@CPACK_OPTION_COMMENT@@ "LibArchive library to link against.") + Added: head/devel/cmake/files/patch-Source_CPack_cmCPackFreeBSDGenerator.cxx ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/cmake/files/patch-Source_CPack_cmCPackFreeBSDGenerator.cxx Wed Jun 20 09:00:53 2018 (r472857) @@ -0,0 +1,18 @@ +diff --git Source/CPack/cmCPackFreeBSDGenerator.cxx Source/CPack/cmCPackFreeBSDGenerator.cxx +index 91ae1a23f..a676302e7 100644 +--- Source/CPack/cmCPackFreeBSDGenerator.cxx ++++ Source/CPack/cmCPackFreeBSDGenerator.cxx +@@ -339,6 +339,13 @@ int cmCPackFreeBSDGenerator::PackageFiles() + + std::string output_dir = + cmSystemTools::CollapseCombinedPath(toplevel, "../"); ++ if (!pkg_initialized() && pkg_init(NULL, NULL) != EPKG_OK) ++ { ++ cmCPackLogger(cmCPackLog::LOG_ERROR, ++ "Can not initialize libpkg." << std::endl); ++ return 0; ++ } ++ + pkg_create_from_manifest(output_dir.c_str(), ::TXZ, toplevel.c_str(), + manifestname.c_str(), NULL); +
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806200900.w5K90s0m094768>