Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Mar 2013 17:59:30 +0000 (UTC)
From:      Max Brazhnikov <makc@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r314668 - in head: . Mk Mk/Uses
Message-ID:  <201303191759.r2JHxUQp082492@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: makc
Date: Tue Mar 19 17:59:30 2013
New Revision: 314668
URL: http://svnweb.freebsd.org/changeset/ports/314668

Log:
  Convert USE_CMAKE to USES macro:
   Usage:		USES= cmake or USES= cmake:ARGS
   Valid ARGS:	outsource (perform an out-of-source build)
  
  Tested by:	exp-run (bapt)
  Approved by:	portmgr (bapt)

Added:
  head/Mk/Uses/cmake.mk   (contents, props changed)
     - copied, changed from r314095, head/Mk/bsd.cmake.mk
Deleted:
  head/Mk/bsd.cmake.mk
Modified:
  head/CHANGES
  head/Mk/bsd.port.mk

Modified: head/CHANGES
==============================================================================
--- head/CHANGES	Tue Mar 19 16:53:38 2013	(r314667)
+++ head/CHANGES	Tue Mar 19 17:59:30 2013	(r314668)
@@ -11,6 +11,21 @@ in the release notes and/or placed into 
 All ports committers are allowed to commit to this file.
 
 20130319:
+AUTHOR: makc@FreeBSD.org
+
+ * New USES macro should be used instead of deprecated USE_CMAKE and
+   CMAKE_OUTSOURCE:
+
+   USES= cmake:outsource
+   to perform out-of-source build (equivalent to former pair usage of
+   USE_CMAKE/CMAKE_OUTSOURCE)
+
+   USES= cmake
+   In-source build (equivalent to plain USE_CMAKE=yes) can be used if
+   project doesn't support out-of-source build.
+
+
+20130319:
 AUTHOR: bapt@FreeBSD.org
 
  * The options framework now uses ports-mgmt/dialog4ports contributed by

Copied and modified: head/Mk/Uses/cmake.mk (from r314095, head/Mk/bsd.cmake.mk)
==============================================================================
--- head/Mk/bsd.cmake.mk	Wed Mar 13 16:34:04 2013	(r314095, copy source)
+++ head/Mk/Uses/cmake.mk	Tue Mar 19 17:59:30 2013	(r314668)
@@ -1,103 +1,122 @@
-#-*- tab-width: 4; -*-
-# ex:ts=4
-#
-# USE_CMAKE		- If set, this port uses cmake.
-#
-# CMAKE_ENV		- Environment passed to cmake.
-#				Default: ${CONFIGURE_ENV}
-# CMAKE_ARGS		- Arguments passed to cmake
-#				Default: see below
-# CMAKE_BUILD_TYPE	- Type of build (cmake predefined build types).
-#				Projects may have their own build profiles.
-#				CMake supports the following types: Debug,
-#				Release, RelWithDebInfo and MinSizeRel.
-#				Debug and Release profiles respect system
-#				CFLAGS, RelWithDebInfo and MinSizeRel will set
-#				CFLAGS to "-O2 -g" and "-Os -DNDEBUG".
-#				Default: Release, if WITH_DEBUG is not set,
-#				Debug otherwise
-# CMAKE_VERBOSE		- Verbose build
-#				Default: not set
-# CMAKE_OUTSOURCE	- Instruct to perform an out-of-source build
-# 				Default: not set
-# CMAKE_SOURCE_PATH	- Path to sourcedir for cmake
-#				Default: ${WRKSRC}
-# CMAKE_INSTALL_PREFIX	- prefix for cmake to use for installation.
-#				Default: ${PREFIX}
-#
-#
 # $FreeBSD$
-
-CMAKE_MAINTAINER=	kde@FreeBSD.org
-
 #
-# CMAKE_BIN is the location where the cmake port installs the cmake
-# executable
+# Provide support for CMake based projects
 #
-# CMAKE_PORT is where the cmake port is located in the ports tree
+# MAINTAINER: kde@FreeBSD.org
 #
-CMAKE_BIN=		${LOCALBASE}/bin/cmake
-CMAKE_PORT=		${PORTSDIR}/devel/cmake
-
+# Feature:		cmake
+# Usage:		USES=cmake or USES=cmake:ARGS
+# Valid ARGS:		outsource
+# ARGS description:
+# outsource		perform an out-of-source build
 #
-# Make sure we depend on cmake
 #
-BUILD_DEPENDS+=	${CMAKE_BIN}:${CMAKE_PORT}
-
+# Additional variables that affect cmake behaviour:
 #
-# Default environment and arguments to cmake
+# User defined variables:
+# CMAKE_VERBOSE		- Enable verbose build output
+#			Default: not set, until BATCH or PACKAGE_BUILDING is defined
+# CMAKE_NOCOLOR		- Disable colour build output
+#			Default: not set, until BATCH or PACKAGE_BUILDING is defined
 #
-CMAKE_ENV?=		${CONFIGURE_ENV}
-CMAKE_ARGS+=	-DCMAKE_C_COMPILER:STRING="${CC}" \
-				-DCMAKE_CXX_COMPILER:STRING="${CXX}" \
-				-DCMAKE_C_FLAGS:STRING="${CFLAGS}" \
-				-DCMAKE_C_FLAGS_DEBUG:STRING="${CFLAGS}" \
-				-DCMAKE_C_FLAGS_RELEASE:STRING="${CFLAGS}" \
-				-DCMAKE_CXX_FLAGS:STRING="${CXXFLAGS}" \
-				-DCMAKE_CXX_FLAGS_DEBUG:STRING="${CXXFLAGS}" \
-				-DCMAKE_CXX_FLAGS_RELEASE:STRING="${CXXFLAGS}" \
-				-DCMAKE_EXE_LINKER_FLAGS:STRING="${LDFLAGS}" \
-				-DCMAKE_MODULE_LINKER_FLAGS:STRING="${LDFLAGS}" \
-				-DCMAKE_SHARED_LINKER_FLAGS:STRING="${LDFLAGS}" \
-				-DCMAKE_INSTALL_PREFIX:PATH="${CMAKE_INSTALL_PREFIX}" \
-				-DCMAKE_BUILD_TYPE:STRING="${CMAKE_BUILD_TYPE}" \
-				-DTHREADS_HAVE_PTHREAD_ARG:BOOL=YES
+# Variables for ports:
+# CMAKE_ENV		- Environment passed to cmake.
+#			Default: ${CONFIGURE_ENV}
+# CMAKE_ARGS		- Arguments passed to cmake
+#			Default: see below
+# CMAKE_BUILD_TYPE	- Type of build (cmake predefined build types).
+#			Projects may have their own build profiles.
+#			CMake supports the following types: Debug,
+#			Release, RelWithDebInfo and MinSizeRel.
+#			Debug and Release profiles respect system
+#			CFLAGS, RelWithDebInfo and MinSizeRel will set
+#			CFLAGS to "-O2 -g" and "-Os -DNDEBUG".
+#			Default: Release, if WITH_DEBUG is not set,
+#			Debug otherwise
+# CMAKE_SOURCE_PATH	- Path to the source directory
+#			Default: ${WRKSRC}
+#
+# Deprecated variables:
+# CMAKE_OUTSOURCE	- Instruct to perform an out-of-source build.
+#			Deprecated, use 'USES+=	cmake:outsource' instead.
+
+.if !defined(_INCLUDE_USES_CMAKE_MK)
+_INCLUDE_USES_CMAKE_MK=	yes
+
+_valid_ARGS=		outsource run
+_cmake_ARGS=		${cmake_ARGS:C/\:/ /g}
+
+# Sanity check
+.if defined(cmake_ARGS)
+.  for arg in ${_cmake_ARGS}
+.    if empty(_valid_ARGS:M${arg})
+IGNORE=	Incorrect 'USES+= cmake:${cmake_ARGS}' usage: argument [${arg}] is not recognized
+.    endif
+.  endfor
+.endif
 
-#
-# Default build type and sourcedir
-#
-CMAKE_SOURCE_PATH?=	${WRKSRC}
-.if defined(CMAKE_OUTSOURCE)
-CONFIGURE_WRKSRC=	${WRKDIR}/.build
-BUILD_WRKSRC=		${CONFIGURE_WRKSRC}
-INSTALL_WRKSRC=		${CONFIGURE_WRKSRC}
+CMAKE_BIN=		${LOCALBASE}/bin/cmake
+BUILD_DEPENDS+=		${CMAKE_BIN}:${PORTSDIR}/devel/cmake
+
+.if ${_cmake_ARGS:Mrun}
+RUN_DEPENDS+=		${CMAKE_BIN}:${PORTSDIR}/devel/cmake
 .endif
-CMAKE_INSTALL_PREFIX?=	${PREFIX}
 
 .if defined(WITH_DEBUG)
 CMAKE_BUILD_TYPE?=	Debug
 .else
 CMAKE_BUILD_TYPE?=	Release
-.endif
+.endif #defined(WITH_DEBUG)
+
+PLIST_SUB+=		CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:L}"
 
 .if defined(STRIP) && ${STRIP} != ""
 INSTALL_TARGET?=	install/strip
 .endif
 
-PLIST_SUB+=	CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:L}"
+CMAKE_ENV?=		${CONFIGURE_ENV}
+CMAKE_ARGS+=		-DCMAKE_C_COMPILER:STRING="${CC}" \
+			-DCMAKE_CXX_COMPILER:STRING="${CXX}" \
+			-DCMAKE_C_FLAGS:STRING="${CFLAGS}" \
+			-DCMAKE_C_FLAGS_DEBUG:STRING="${CFLAGS}" \
+			-DCMAKE_C_FLAGS_RELEASE:STRING="${CFLAGS}" \
+			-DCMAKE_CXX_FLAGS:STRING="${CXXFLAGS}" \
+			-DCMAKE_CXX_FLAGS_DEBUG:STRING="${CXXFLAGS}" \
+			-DCMAKE_CXX_FLAGS_RELEASE:STRING="${CXXFLAGS}" \
+			-DCMAKE_EXE_LINKER_FLAGS:STRING="${LDFLAGS}" \
+			-DCMAKE_MODULE_LINKER_FLAGS:STRING="${LDFLAGS}" \
+			-DCMAKE_SHARED_LINKER_FLAGS:STRING="${LDFLAGS}" \
+			-DCMAKE_INSTALL_PREFIX:PATH="${PREFIX}" \
+			-DCMAKE_BUILD_TYPE:STRING="${CMAKE_BUILD_TYPE}" \
+			-DTHREADS_HAVE_PTHREAD_ARG:BOOL=YES
+
+.if defined(BATCH) || defined(PACKAGE_BUILDING)
+CMAKE_VERBOSE=		yes
+CMAKE_NOCOLOR=		yes
+.endif
 
-#
-# Force makefile verbosity if needed
-#
-.if defined(CMAKE_VERBOSE) || defined(BATCH)
-CMAKE_ARGS+=	-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
+.if defined(CMAKE_VERBOSE)
+CMAKE_ARGS+=		-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
+.endif
+.if defined(CMAKE_NOCOLOR)
+CMAKE_ARGS+=		-DCMAKE_COLOR_MAKEFILE:BOOL=OFF
+.endif
+
+_CMAKE_MSG=		"===>  Performing in-source build"
+CMAKE_SOURCE_PATH?=	${WRKSRC}
+
+.if ${_cmake_ARGS:Moutsource}
+_CMAKE_MSG=		"===>  Performing out-of-source build"
+CONFIGURE_WRKSRC=	${WRKDIR}/.build
+BUILD_WRKSRC=		${CONFIGURE_WRKSRC}
+INSTALL_WRKSRC=		${CONFIGURE_WRKSRC}
 .endif
 
-#
-# Redefine do-configure target
-#
 .if !target(do-configure)
 do-configure:
+	@${ECHO_MSG} ${_CMAKE_MSG}
 	${MKDIR} ${CONFIGURE_WRKSRC}
 	@cd ${CONFIGURE_WRKSRC}; ${SETENV} ${CMAKE_ENV} ${CMAKE_BIN} ${CMAKE_ARGS} ${CMAKE_SOURCE_PATH}
 .endif
+
+.endif #!defined(_INCLUDE_USES_CMAKE_MK)

Modified: head/Mk/bsd.port.mk
==============================================================================
--- head/Mk/bsd.port.mk	Tue Mar 19 16:53:38 2013	(r314667)
+++ head/Mk/bsd.port.mk	Tue Mar 19 17:59:30 2013	(r314668)
@@ -1506,6 +1506,14 @@ PKGCOMPATDIR?=		${LOCALBASE}/lib/compat/
 
 .include "${PORTSDIR}/Mk/bsd.pbi.mk"
 
+.if defined(USE_CMAKE)
+. if defined(CMAKE_OUTSOURCE)
+USES+=	cmake:outsource
+. else
+USES+=	cmake
+. endif
+.endif
+
 # Loading features
 .for f in ${USES}
 _f=${f:C/\:.*//g}
@@ -2095,10 +2103,6 @@ RUN_DEPENDS+=	${_GL_${_component}_RUN_DE
 .include "${PORTSDIR}/Mk/bsd.kde4.mk"
 .endif
 
-.if defined(USE_CMAKE)
-.include "${PORTSDIR}/Mk/bsd.cmake.mk"
-.endif
-
 .if exists(${PORTSDIR}/Makefile.inc)
 .include "${PORTSDIR}/Makefile.inc"
 USE_SUBMAKE=	yes



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201303191759.r2JHxUQp082492>