[kde-freebsd] bsd.port.mk alternative

David Naylor blackdragon at highveldmail.co.za
Sun Jan 20 17:28:28 CET 2008


Hi,

I have completed a bsd.cmake.mk that appears to work.  I've tested it
on devel/qdevelop and games/ksuduku without any problem.

The above ports work, using out-of-source builds, with just
USE_CMAKE=yes added (and all previous cmake lines removed).  If you
need to use in-source build define CMAKE_INSOURCE=yes.

See below for patch

David

diff -uNrd Mk~/bsd.cmake.mk Mk/bsd.cmake.mk
--- Mk~/bsd.cmake.mk	1970-01-01 00:00:00.000000000 +0000
+++ Mk/bsd.cmake.mk	2008-01-20 18:27:59.000000000 +0000
@@ -0,0 +1,117 @@
+#-*- mode: Fundamental; tab-width: 4; -*-
+# ex:ts=4
+#
+# bsd.cmake.mk - Support for cmake-based ports.
+#
+# Created by: David Naylor <dragonsa at highveldmail.co.za> (Extended)
+#
+# For FreeBSD committers:
+# Please send all suggested changes to the maintainer instead of committing
+# them to CVS yourself.
+#
+# $FreeBSD:$
+#
+
+##############################################################################
+# Notes
+##############################################################################
+# 1) bsd.cmake.mk does an out-of-source build by default, see CMAKE_INSOURCE
+#
+
+##############################################################################
+# Variables that each port can define (Globals)
+##############################################################################
+#
+# USE_CMAKE		- Should be defined to use cmake (and for following
+#			  ports to have any effect
+#
+# CMAKE_ENV		- Addition environment variables to set for cmake
+#
+# CMAKE_ARGS		- Arguments to pass to cmake
+#
+# CMAKE_BUILDTYPE	- Type of build (release, debug, [expand])
+#			  default: Release
+#
+# CMAKE_INSOURCE	- Force cmake to build in-source
+#			  default: to build out of source (see CMAKE_BUILDDIR)
+#
+# CMAKE_VERBOSE		- Verbose build
+#
+# CMAKE_DEBUG		- Force build type to be debug
+#
+
+CMAKE_BUILDTYPE?=	Release
+
+.if !defined(CMAKE_INSOURCE)
+.if defined(NO_WRKSUBDIR)
+BUILD_WRKSRC?=	${WRKDIR)/build
+.else
+BUILD_WRKSRC?=	${WRKSRC}-build
+.endif
+.endif
+
+##############################################################################
+# Variables that each port shouldn't define, but can (Local)
+##############################################################################
+#
+# Note: See below for defaults
+#
+# CMAKE_BIN		- Path to cmake binary
+#
+# CMAKE_PORT		- Path to cmake port
+#
+
+CMAKE_BIN?=		${LOCALBASE}/bin/cmake
+CMAKE_PORT?=		${PORTSDIR}/devel/cmake
+
+##############################################################################
+# Internal variables
+##############################################################################
+
+# Predefined cmake arguments
+CMAKE_ARGS+=	-DCMAKE_INSTALL_PREFIX:PATH=${PREFIX}
+
+##############################################################################
+# Set other variables in accordance with cmake
+##############################################################################
+
+# Depend on CMake
+BUILD_DEPENDS+=	${CMAKE_BIN}:${CMAKE_PORT}
+
+# Verbose Makefiles
+.if defined(CMAKE_VERBOSE)
+CMAKE_ARGS+=	-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
+.endif
+
+# With Debugging
+.if defined(CMAKE_DEBUG)
+CMAKE_ARGS+=	-DCMAKE_BUILD_TYPE:STRING=DEBUG
+.else
+CMAKE_ARGS+=	-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILDTYPE}
+.endif
+
+# Cleanup for out-of-source builds and using cmake
+CONFIGURE_WRKSRC=	${BUILD_WRKSRC}
+
+##############################################################################
+# Define targets for cmake
+##############################################################################
+
+do-configure:
+	@${MKDIR} ${BUILD_WRKSRC}
+	@if [ -f ${SCRIPTDIR}/configure ]; then \
+		cd ${.CURDIR} && ${SETENV} ${SCRIPTS_ENV} ${SH} \
+		  ${SCRIPTDIR}/configure; \
+	fi
+	@(cd ${CONFIGURE_WRKSRC} && \
+		if ! ${SETENV} CC="${CC}" CXX="${CXX}" \
+	    CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" \
+	    INSTALL="/usr/bin/install -c ${_BINOWNGRP}" \
+	    INSTALL_DATA="${INSTALL_DATA}" \
+	    INSTALL_PROGRAM="${INSTALL_PROGRAM}" \
+	    INSTALL_SCRIPT="${INSTALL_SCRIPT}" \
+	    ${CONFIGURE_ENV} ${CMAKE_BIN} ${CMAKE_ARGS} ${WRKSRC}; then \
+			 ${ECHO_MSG} "===>  Script \"$cmake\" failed unexpectedly."; \
+			 ${FALSE}; \
+		fi)
+
diff -uNrd Mk~/bsd.port.mk Mk/bsd.port.mk
--- Mk~/bsd.port.mk	2008-01-20 15:50:25.000000000 +0000
+++ Mk/bsd.port.mk	2008-01-20 15:51:54.000000000 +0000
@@ -1485,6 +1485,10 @@
 .include "${PORTSDIR}/Mk/bsd.qt.mk"
 .endif

+.if defined (USE_CMAKE)
+.include "${PORTSDIR}/Mk/bsd.cmake.mk"
+.endif
+
 .if defined(WANT_GNOME) || defined(USE_GNOME) || defined(USE_GTK)
 .include "${PORTSDIR}/Mk/bsd.gnome.mk"
 .endif


More information about the kde-freebsd mailing list