/[ports]/head/Mk/Uses/cmake.mk
ViewVC logotype

Contents of /head/Mk/Uses/cmake.mk

Parent Directory Parent Directory | Revision Log Revision Log


Revision 421635 - (show annotations) (download)
Fri Sep 9 19:42:46 2016 UTC (7 years, 9 months ago) by amdmi3
File MIME type: text/plain
File size: 3299 byte(s)
Most commonly used build systems support silent builds, when they
hide actual commands executed and only show short summary line (like
"CC foo.c"). CMake and ninja enable this by default, some autotools
using ports do as well. This is unacceptable because we need complete
build logs at any time, so we now switch to verbose build logs
unconditionally. Note that this change deliberately affects ALL
builds and not only package builds on cluster, because we need to
be sure that user experiencing failure can always provide informative
build log regardless of settings and without rerunning the build.

Change summary:

- Always do verbose builds for cmake, ninja and GNU configure (the
  latter includes check if --disable-silent-rules is actually supported
  by the configure script; there are isolated cases when it's not true)
- Remove CMAKE_VERBOSE, NINJA_VERBOSE and
  CONFIGURE_ARGS=--disable-silent-rules from all ports which set them
  for this is no longer needed
- Revert hacks for --disable-silent-rules support priorly committed
  to biology/ncbi-blast+ and net-p2p/mldonkey - no longer needed as well

Submitted by:	amdmi3
Reviewed by:	mat
Exp-run by:	antoine
Approved by:	portmgr (mat, antoine)
Differential Revision:	D7534

1 # $FreeBSD$
2 #
3 # Provide support for CMake based projects
4 #
5 # Feature: cmake
6 # Usage: USES=cmake or USES=cmake:ARGS
7 # Valid ARGS: outsource
8 # ARGS description:
9 # outsource perform an out-of-source build
10 #
11 #
12 # Additional variables that affect cmake behaviour:
13 #
14 # User defined variables:
15 # CMAKE_NOCOLOR - Disable colour build output
16 # Default: not set, unless BATCH or PACKAGE_BUILDING is defined
17 # CMAKE_NINJA - Use ninja instead of make(1)
18 #
19 # Variables for ports:
20 # CMAKE_ARGS - Arguments passed to cmake
21 # Default: see below
22 # CMAKE_BUILD_TYPE - Type of build (cmake predefined build types).
23 # Projects may have their own build profiles.
24 # CMake supports the following types: Debug,
25 # Release, RelWithDebInfo and MinSizeRel.
26 # Debug and Release profiles respect system
27 # CFLAGS, RelWithDebInfo and MinSizeRel will set
28 # CFLAGS to "-O2 -g" and "-Os -DNDEBUG".
29 # Default: Release, if WITH_DEBUG is not set,
30 # Debug otherwise
31 # CMAKE_SOURCE_PATH - Path to the source directory
32 # Default: ${WRKSRC}
33 #
34 # MAINTAINER: kde@FreeBSD.org
35
36 .if !defined(_INCLUDE_USES_CMAKE_MK)
37 _INCLUDE_USES_CMAKE_MK= yes
38
39 _valid_ARGS= outsource run
40
41 # Sanity check
42 .for arg in ${cmake_ARGS}
43 . if empty(_valid_ARGS:M${arg})
44 IGNORE= Incorrect 'USES+= cmake:${cmake_ARGS}' usage: argument [${arg}] is not recognized
45 . endif
46 .endfor
47
48 CMAKE_BIN= ${LOCALBASE}/bin/cmake
49 BUILD_DEPENDS+= ${CMAKE_BIN}:devel/cmake
50
51 .if ${cmake_ARGS:Mrun}
52 RUN_DEPENDS+= ${CMAKE_BIN}:devel/cmake
53 .endif
54
55 .if defined(WITH_DEBUG)
56 CMAKE_BUILD_TYPE?= Debug
57 .else
58 CMAKE_BUILD_TYPE?= Release
59 .endif #defined(WITH_DEBUG)
60
61 PLIST_SUB+= CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:tl}"
62
63 .if defined(STRIP) && ${STRIP} != "" && !defined(WITH_DEBUG)
64 INSTALL_TARGET?= install/strip
65 .endif
66
67 CMAKE_ARGS+= -DCMAKE_C_COMPILER:STRING="${CC}" \
68 -DCMAKE_CXX_COMPILER:STRING="${CXX}" \
69 -DCMAKE_C_FLAGS:STRING="${CFLAGS}" \
70 -DCMAKE_C_FLAGS_DEBUG:STRING="${CFLAGS}" \
71 -DCMAKE_C_FLAGS_RELEASE:STRING="${CFLAGS}" \
72 -DCMAKE_CXX_FLAGS:STRING="${CXXFLAGS}" \
73 -DCMAKE_CXX_FLAGS_DEBUG:STRING="${CXXFLAGS}" \
74 -DCMAKE_CXX_FLAGS_RELEASE:STRING="${CXXFLAGS}" \
75 -DCMAKE_EXE_LINKER_FLAGS:STRING="${LDFLAGS}" \
76 -DCMAKE_MODULE_LINKER_FLAGS:STRING="${LDFLAGS}" \
77 -DCMAKE_SHARED_LINKER_FLAGS:STRING="${LDFLAGS}" \
78 -DCMAKE_INSTALL_PREFIX:PATH="${CMAKE_INSTALL_PREFIX}" \
79 -DCMAKE_BUILD_TYPE:STRING="${CMAKE_BUILD_TYPE}" \
80 -DTHREADS_HAVE_PTHREAD_ARG:BOOL=YES \
81 -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=YES \
82 -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
83
84 CMAKE_INSTALL_PREFIX?= ${PREFIX}
85
86 .if defined(BATCH) || defined(PACKAGE_BUILDING)
87 CMAKE_NOCOLOR= yes
88 .endif
89
90 .if defined(CMAKE_NOCOLOR)
91 CMAKE_ARGS+= -DCMAKE_COLOR_MAKEFILE:BOOL=OFF
92 .endif
93
94 .if defined(CMAKE_NINJA)
95 .include "${USESDIR}/ninja.mk"
96 .endif
97
98 _CMAKE_MSG= "===> Performing in-source build"
99 CMAKE_SOURCE_PATH?= ${WRKSRC}
100
101 .if ${cmake_ARGS:Moutsource}
102 _CMAKE_MSG= "===> Performing out-of-source build"
103 CONFIGURE_WRKSRC= ${WRKDIR}/.build
104 BUILD_WRKSRC?= ${CONFIGURE_WRKSRC}
105 INSTALL_WRKSRC?= ${CONFIGURE_WRKSRC}
106 .endif
107
108 .if !target(do-configure)
109 do-configure:
110 @${ECHO_MSG} ${_CMAKE_MSG}
111 ${MKDIR} ${CONFIGURE_WRKSRC}
112 @cd ${CONFIGURE_WRKSRC}; ${SETENV} ${CONFIGURE_ENV} ${CMAKE_BIN} ${CMAKE_ARGS} ${CMAKE_SOURCE_PATH}
113 .endif
114
115 .endif #!defined(_INCLUDE_USES_CMAKE_MK)

Properties

Name Value
svn:eol-style native
svn:keywords FreeBSD=%H
svn:mime-type text/plain

  ViewVC Help
Powered by ViewVC 1.1.27