pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/mk/tools Add support for cmake as a tool (USE_TOOLS+=c...
details: https://anonhg.NetBSD.org/pkgsrc/rev/fd1d7ce808d0
branches: trunk
changeset: 536373:fd1d7ce808d0
user: markd <markd%pkgsrc.org@localhost>
date: Wed Dec 12 01:00:38 2007 +0000
description:
Add support for cmake as a tool (USE_TOOLS+=cmake) and for using it in
the configure stage of a build (by setting USE_CMAKE=yes).
diffstat:
mk/cmake-Modules/Platform/UnixPaths.cmake | 14 +++++++
mk/configure/cmake-rewrite.awk | 29 +++++++++++++++
mk/configure/cmake.mk | 58 +++++++++++++++++++++++++++++++
mk/configure/configure.mk | 32 +++++++++++++++-
mk/tools/defaults.mk | 3 +-
mk/tools/replace.mk | 13 ++++++-
6 files changed, 144 insertions(+), 5 deletions(-)
diffs (230 lines):
diff -r 02df441ca5d4 -r fd1d7ce808d0 mk/cmake-Modules/Platform/UnixPaths.cmake
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mk/cmake-Modules/Platform/UnixPaths.cmake Wed Dec 12 01:00:38 2007 +0000
@@ -0,0 +1,14 @@
+SET(CMAKE_SYSTEM_INCLUDE_PATH ${CMAKE_SYSTEM_INCLUDE_PATH}
+ # Standard
+ $ENV{BUILDLINK_DIR}/include /include /usr/include
+
+ )
+
+SET(CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_SYSTEM_LIBRARY_PATH}
+ # Standard
+ $ENV{BUILDLINK_DIR}/lib /lib /usr/lib
+ )
+
+SET(CMAKE_SYSTEM_PROGRAM_PATH ${CMAKE_SYSTEM_PROGRAM_PATH}
+ /bin /usr/bin /usr/local/bin /usr/pkg/bin /sbin
+ )
diff -r 02df441ca5d4 -r fd1d7ce808d0 mk/configure/cmake-rewrite.awk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mk/configure/cmake-rewrite.awk Wed Dec 12 01:00:38 2007 +0000
@@ -0,0 +1,29 @@
+# $NetBSD: cmake-rewrite.awk,v 1.1 2007/12/12 01:00:38 markd Exp $
+#
+# cleanup references to libraries in the buildlink tree in files
+# written by cmake's export_library_dependencies() function
+#
+BEGIN { buildlink_dir = ARGV[1]; delete ARGV[1] }
+{
+ match($0, "_LIB_DEPENDS \"")
+ if (RSTART == 0) {
+ print
+ } else {
+ printf "%s \"", $1
+ d=substr($0,RSTART+RLENGTH,length($0))
+ while ( d != "\")") {
+ match(d,"[^;]*")
+ dep=substr(d,RSTART,RLENGTH)
+ d=substr(d,RLENGTH+2,length(d))
+ if (dep ~ "^" buildlink_dir) {
+ "ls -l " dep | getline ls_out
+ match(ls_out,"-> ")
+ if (RSTART > 0) {
+ dep=substr(ls_out,RSTART+RLENGTH,length(ls_out))
+ }
+ }
+ printf "%s;",dep
+ }
+ print d
+ }
+}
diff -r 02df441ca5d4 -r fd1d7ce808d0 mk/configure/cmake.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mk/configure/cmake.mk Wed Dec 12 01:00:38 2007 +0000
@@ -0,0 +1,58 @@
+# $NetBSD: cmake.mk,v 1.1 2007/12/12 01:00:39 markd Exp $
+
+_CMAKE_DIR= ${BUILDLINK_DIR}/cmake-Modules
+
+USE_TOOLS+= cmake
+CMAKE_ARGS+= -DCMAKE_INSTALL_PREFIX:PATH=${PREFIX}
+CMAKE_ARGS+= -DCMAKE_MODULE_PATH:PATH=${_CMAKE_DIR}
+
+CMAKE_MODULE_PATH_OVERRIDE+= CMakeLists.txt
+
+######################################################################
+### configure-cmake-override (PRIVATE)
+######################################################################
+### configure-cmake-override modifies the cmake CMakeLists.txt file in
+### ${WRKSRC} so that if CMAKE_MODULE_PATH is set we add our Module
+### directory before any others.
+###
+
+SUBST_CLASSES+= cmake
+SUBST_STAGE.cmake= do-configure-pre-hook
+SUBST_MESSAGE.cmake= Fixing CMAKE_MODULE_PATH in CMakeLists.txt
+SUBST_FILES.cmake= ${CMAKE_MODULE_PATH_OVERRIDE}
+SUBST_SED.cmake= \
+ 's|set *( *CMAKE_MODULE_PATH |set (CMAKE_MODULE_PATH "${_CMAKE_DIR}" |'
+
+do-configure-pre-hook: cmake-copy-module-tree
+
+.PHONY: cmake-copy-module-tree
+cmake-copy-module-tree:
+ ${_PKG_SILENT}${_PKG_DEBUG}set -e; \
+ cd ${PKGSRCDIR}/mk; ${CP} -R cmake-Modules ${_CMAKE_DIR}
+
+
+######################################################################
+### cmake-dependencies-rewrite (PRIVATE)
+######################################################################
+### The cmake function export_library_dependencies() writes out
+### library dependency info to a file and this may contain buildlink
+### paths.
+### cmake-dependencies-rewrite modifies any such files, listed in
+### ${CMAKE_DEPENDENCIES_REWRITE} (relative to ${WRKSRC}) to have the
+### real dependencies
+###
+
+do-configure-post-hook: cmake-dependencies-rewrite
+
+.PHONY: cmake-dependencies-rewrite
+cmake-dependencies-rewrite:
+ @${STEP_MSG} "Rewrite cmake Dependencies files"
+.if defined(CMAKE_DEPENDENCIES_REWRITE) && !empty(CMAKE_DEPENDENCIES_REWRITE)
+ ${_PKG_SILENT}${_PKG_DEBUG}set -e; \
+ cd ${WRKSRC}; \
+ for file in ${CMAKE_DEPENDENCIES_REWRITE}; do \
+ ${TEST} -f "$$file" || continue; \
+ ${AWK} -f ${PKGSRCDIR}/mk/configure/cmake-rewrite.awk ${BUILDLINK_DIR} $$file > $$file.override; \
+ ${MV} -f $$file.override $$file; \
+ done
+.endif
diff -r 02df441ca5d4 -r fd1d7ce808d0 mk/configure/configure.mk
--- a/mk/configure/configure.mk Tue Dec 11 22:54:04 2007 +0000
+++ b/mk/configure/configure.mk Wed Dec 12 01:00:38 2007 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: configure.mk,v 1.20 2007/12/01 11:11:55 rillig Exp $
+# $NetBSD: configure.mk,v 1.21 2007/12/12 01:00:40 markd Exp $
#
# = Package-settable variables =
#
@@ -48,14 +48,17 @@
_USER_VARS.configure= CONFIG_SHELL_FLAGS
_PKG_VARS.configure= CONFIGURE_ENV CONFIG_SHELL CONFIGURE_SCRIPT \
CONFIGURE_ARGS OVERRIDE_GNU_CONFIG_SCRIPTS HAS_CONFIGURE \
- GNU_CONFIGURE PKGCONFIG_OVERRIDE USE_PKGLOCALEDIR
+ GNU_CONFIGURE PKGCONFIG_OVERRIDE USE_PKGLOCALEDIR \
+ CMAKE_ARGS CMAKE_ARG_PATH
CONFIGURE_SCRIPT?= ./configure
CONFIGURE_ENV+= ${ALL_ENV}
CONFIGURE_ARGS?= # empty
CONFIG_SHELL?= ${SH}
CONFIG_SHELL_FLAGS?= # none
-_BUILD_DEFS+= CONFIGURE_ENV CONFIGURE_ARGS
+CMAKE_ARGS?= # empty
+CMAKE_ARG_PATH?= .
+_BUILD_DEFS+= CONFIGURE_ENV CONFIGURE_ARGS CMAKE_ARGS
.if defined(GNU_CONFIGURE)
. include "${PKGSRCDIR}/mk/configure/gnu-configure.mk"
@@ -76,6 +79,9 @@
.if defined(USE_PKGLOCALEDIR)
. include "${PKGSRCDIR}/mk/configure/replace-localedir.mk"
.endif
+.if defined(USE_CMAKE)
+. include "${PKGSRCDIR}/mk/configure/cmake.mk"
+.endif
######################################################################
### configure (PUBLIC)
@@ -222,6 +228,25 @@
.endfor
######################################################################
+### do-configure-cmake (PRIVATE)
+######################################################################
+### do-configure-cmake runs cmake to configure the software for
+### building.
+###
+_CONFIGURE_CMAKE_ENV+= BUILDLINK_DIR=${BUILDLINK_DIR}
+_CONFIGURE_CMAKE_ENV+= ${CONFIGURE_ENV}
+
+
+.PHONY: do-configure-cmake
+do-configure-cmake:
+.for _dir_ in ${CONFIGURE_DIRS}
+ ${_PKG_SILENT}${_PKG_DEBUG}${_ULIMIT_CMD} \
+ cd ${WRKSRC} && cd ${_dir_} && \
+ ${SETENV} ${_CONFIGURE_CMAKE_ENV} \
+ cmake ${CMAKE_ARGS} ${CMAKE_ARG_PATH}
+.endfor
+
+######################################################################
### pre-configure, do-configure, post-configure (PUBLIC, override)
######################################################################
### {pre,do,post}-configure are the heart of the package-customizable
@@ -231,6 +256,7 @@
_DO_CONFIGURE_TARGETS+= ${HAS_CONFIGURE:D do-configure-script}
_DO_CONFIGURE_TARGETS+= ${USE_IMAKE:D do-configure-imake}
+_DO_CONFIGURE_TARGETS+= ${USE_CMAKE:D do-configure-cmake}
.if !target(do-configure)
do-configure: ${_DO_CONFIGURE_TARGETS}
diff -r 02df441ca5d4 -r fd1d7ce808d0 mk/tools/defaults.mk
--- a/mk/tools/defaults.mk Tue Dec 11 22:54:04 2007 +0000
+++ b/mk/tools/defaults.mk Wed Dec 12 01:00:38 2007 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: defaults.mk,v 1.52 2007/08/10 03:46:10 jlam Exp $
+# $NetBSD: defaults.mk,v 1.53 2007/12/12 01:00:40 markd Exp $
#
# Copyright (c) 2005 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -63,6 +63,7 @@
_TOOLS_VARNAME.chgrp= CHGRP
_TOOLS_VARNAME.chmod= CHMOD
_TOOLS_VARNAME.chown= CHOWN
+_TOOLS_VARNAME.cmake= CMAKE
_TOOLS_VARNAME.cmp= CMP
_TOOLS_VARNAME.cp= CP
_TOOLS_VARNAME.csh= CSH
diff -r 02df441ca5d4 -r fd1d7ce808d0 mk/tools/replace.mk
--- a/mk/tools/replace.mk Tue Dec 11 22:54:04 2007 +0000
+++ b/mk/tools/replace.mk Wed Dec 12 01:00:38 2007 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: replace.mk,v 1.201 2007/11/08 19:31:40 joerg Exp $
+# $NetBSD: replace.mk,v 1.202 2007/12/12 01:00:40 markd Exp $
#
# Copyright (c) 2005 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -283,6 +283,17 @@
. endif
.endfor
+.if !defined(TOOLS_IGNORE.cmake) && !empty(_USE_TOOLS:Mcmake)
+. if !empty(PKGPATH:Mdevel/cmake)
+MAKEFLAGS+= TOOLS_IGNORE.cmake=
+. elif !empty(_TOOLS_USE_PKGSRC.cmake:M[yY][eE][sS])
+TOOLS_DEPENDS.cmake?= cmake>=2.4.6nb3:../../devel/cmake
+TOOLS_CREATE+= cmake
+TOOLS_FIND_PREFIX+= TOOLS_PREFIX.cmake=cmake
+TOOLS_PATH.cmake= ${TOOLS_PREFIX.cmake}/bin/cmake
+. endif
+.endif
+
.if !defined(TOOLS_IGNORE.csh) && !empty(_USE_TOOLS:Mcsh)
. if !empty(PKGPATH:Mshells/tcsh)
MAKEFLAGS+= TOOLS_IGNORE.csh=
Home |
Main Index |
Thread Index |
Old Index