Fixup fromcvs/togit conversion
[minix-pkgsrc.git] / mk / configure / configure.mk
blob481aceeefa7d283af64325da30bd0f7139e7835e
1 # $NetBSD: configure.mk,v 1.24 2011/09/08 20:17:15 abs Exp $
3 # = Package-settable variables =
5 # CONFIGURE_ENV is the shell environment that is exported to the
6 # configure script.
8 # CONFIG_SHELL is the shell that is used for interpreting the
9 # configure script.
11 # CONFIGURE_SCRIPT is the path to the script to run in order to
12 # configure the software for building. If the path is relative,
13 # then it is assumed to be relative to each directory listed in
14 # CONFIGURE_DIRS.
16 # CONFIGURE_ARGS is the list of arguments that is passed to the
17 # configure script.
19 # INSTALL_SH_OVERRIDE is a list of files relative to WRKSRC which
20 # should be overridden by the install-sh script from
21 # sysutils/install-sh. If not defined or set to "no", then
22 # no files are overridden.
24 # Possible values: no, defined, undefined.
26 # Default value: defined when GNU_CONFIGURE is defined, undefined
27 # otherwise.
29 # OVERRIDE_GNU_CONFIG_SCRIPTS
30 # Whether to override the GNU config.guess and config.sub scripts
31 # with the pkgsrc versions.
33 # Possible values: defined, undefined.
35 # Default value: defined when GNU_CONFIGURE is defined, undefined
36 # otherwise.
38 # Command-line variables:
40 # CONFIG_SHELL_FLAGS
41 # Set this to -x when you really need to see all commands that the
42 # configure script executes.
44 # Keywords: config.guess config.sub
47 _VARGROUPS+= configure
48 _USER_VARS.configure= CONFIG_SHELL_FLAGS
49 _PKG_VARS.configure= CONFIGURE_ENV CONFIG_SHELL CONFIGURE_SCRIPT \
50 CONFIGURE_ARGS OVERRIDE_GNU_CONFIG_SCRIPTS HAS_CONFIGURE \
51 GNU_CONFIGURE PKGCONFIG_OVERRIDE USE_PKGLOCALEDIR \
52 CMAKE_ARGS CMAKE_ARG_PATH
54 CONFIGURE_SCRIPT?= ./configure
55 CONFIGURE_ENV+= ${ALL_ENV}
56 CONFIGURE_ARGS?= # empty
57 CONFIG_SHELL?= ${SH}
58 CONFIG_SHELL_FLAGS?= # none
59 CMAKE_ARGS?= # empty
60 CMAKE_ARG_PATH?= .
61 _BUILD_DEFS+= CONFIGURE_ENV CONFIGURE_ARGS CMAKE_ARGS
63 .if defined(GNU_CONFIGURE)
64 . include "gnu-configure.mk"
65 .endif
66 .if defined(OVERRIDE_GNU_CONFIG_SCRIPTS)
67 . include "config-override.mk"
68 .endif
69 .if defined(INSTALL_SH_OVERRIDE) && empty(INSTALL_SH_OVERRIDE:M[Nn][Oo])
70 . include "install-sh-override.mk"
71 .endif
72 .if defined(USE_LIBTOOL)
73 . include "libtool-override.mk"
74 .endif
75 .if defined(PKGCONFIG_OVERRIDE)
76 . include "pkg-config-override.mk"
77 .endif
78 .include "replace-interpreter.mk"
79 .if defined(USE_PKGLOCALEDIR)
80 . include "replace-localedir.mk"
81 .endif
82 .if defined(USE_CMAKE)
83 . include "cmake.mk"
84 .endif
86 ######################################################################
87 ### configure (PUBLIC)
88 ######################################################################
89 ### configure is a public target to configure the sources for building.
90 ###
91 _CONFIGURE_TARGETS+= check-vulnerable
92 _CONFIGURE_TARGETS+= wrapper
93 _CONFIGURE_TARGETS+= acquire-configure-lock
94 _CONFIGURE_TARGETS+= ${_COOKIE.configure}
95 _CONFIGURE_TARGETS+= release-configure-lock
97 .PHONY: configure
98 .if !target(configure)
99 . if exists(${_COOKIE.configure})
100 configure:
101 @${DO_NADA}
102 . elif defined(_PKGSRC_BARRIER)
103 configure: ${_CONFIGURE_TARGETS}
104 . else
105 configure: barrier
106 . endif
107 .endif
109 .PHONY: acquire-configure-lock release-configure-lock
110 acquire-configure-lock: acquire-lock
111 release-configure-lock: release-lock
113 .if exists(${_COOKIE.configure})
114 ${_COOKIE.configure}:
115 @${DO_NADA}
116 .else
117 ${_COOKIE.configure}: real-configure
118 .endif
120 ######################################################################
121 ### real-configure (PRIVATE)
122 ######################################################################
123 ### real-configure is a helper target onto which one can hook all of the
124 ### targets that do the actual configuration of the sources.
127 # Note: pre-configure-checks-hook comes after pre-configure to allow
128 # packages for fixing bad files with SUBST_STAGE.* = pre-configure.
130 _REAL_CONFIGURE_TARGETS+= configure-check-interactive
131 _REAL_CONFIGURE_TARGETS+= configure-message
132 _REAL_CONFIGURE_TARGETS+= configure-vars
133 _REAL_CONFIGURE_TARGETS+= pre-configure
134 _REAL_CONFIGURE_TARGETS+= do-configure-pre-hook
135 _REAL_CONFIGURE_TARGETS+= pre-configure-checks-hook
136 _REAL_CONFIGURE_TARGETS+= do-configure
137 _REAL_CONFIGURE_TARGETS+= do-configure-post-hook
138 _REAL_CONFIGURE_TARGETS+= post-configure
139 _REAL_CONFIGURE_TARGETS+= _configure-cookie
140 _REAL_CONFIGURE_TARGETS+= error-check
142 .PHONY: real-configure
143 real-configure: ${_REAL_CONFIGURE_TARGETS}
145 .PHONY: configure-message
146 configure-message:
147 @${PHASE_MSG} "Configuring for ${PKGNAME}"
149 ######################################################################
150 ### configure-check-interactive (PRIVATE)
151 ######################################################################
152 ### configure-check-interactive checks whether we must do an interactive
153 ### configuration or not.
155 configure-check-interactive:
156 .if !empty(INTERACTIVE_STAGE:Mconfigure) && defined(BATCH)
157 @${ERROR_MSG} "The configure stage of this package requires user interaction"
158 @${ERROR_MSG} "Please configure manually with:"
159 @${ERROR_MSG} " \"cd ${.CURDIR} && ${MAKE} configure\""
160 ${RUN} ${FALSE}
161 .else
162 @${DO_NADA}
163 .endif
165 ######################################################################
166 ### do-configure-pre-hook (PRIVATE)
167 ######################################################################
168 ### do-configure-pre-hook is a helper target onto which one can hook
169 ### all of the targets that should be run after pre-configure but before
170 ### do-configure. These targets typically edit the files used by the
171 ### do-configure target.
173 .PHONY: do-configure-pre-hook
174 do-configure-pre-hook:
175 @${DO_NADA}
177 ######################################################################
178 ### do-configure-post-hook (PRIVATE)
179 ######################################################################
180 ### do-configure-post-hook is a helper target onto which one can hook
181 ### all of the targets that should be run after do-configure but before
182 ### post-configure. These targets typically edit the files generated
183 ### by the do-configure target that are used during the build phase.
185 .PHONY: do-configure-post-hook
186 do-configure-post-hook:
187 @${DO_NADA}
189 ######################################################################
190 ### do-configure-script (PRIVATE)
191 ######################################################################
192 ### do-configure-script runs the configure script to configure the
193 ### software for building.
195 _CONFIGURE_SCRIPT_ENV+= INSTALL=${INSTALL:Q}\ -c\ -o\ ${BINOWN}\ -g\ ${BINGRP}
196 _CONFIGURE_SCRIPT_ENV+= INSTALL_PROGRAM=${INSTALL_PROGRAM:Q}
197 _CONFIGURE_SCRIPT_ENV+= INSTALL_SCRIPT=${INSTALL_SCRIPT:Q}
198 _CONFIGURE_SCRIPT_ENV+= INSTALL_DATA=${INSTALL_DATA:Q}
199 _CONFIGURE_SCRIPT_ENV+= INSTALL_GAME=${INSTALL_GAME:Q}
200 _CONFIGURE_SCRIPT_ENV+= INSTALL_GAME_DATA=${INSTALL_GAME_DATA:Q}
201 _CONFIGURE_SCRIPT_ENV+= ${CONFIGURE_ENV}
203 .PHONY: do-configure-script
204 do-configure-script:
205 .for _dir_ in ${CONFIGURE_DIRS}
206 ${RUN}${_ULIMIT_CMD} \
207 cd ${WRKSRC} && cd ${_dir_} && \
208 ${PKGSRC_SETENV} ${_CONFIGURE_SCRIPT_ENV} \
209 ${CONFIG_SHELL} ${CONFIG_SHELL_FLAGS} \
210 ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
211 .endfor
213 ######################################################################
214 ### do-configure-imake (PRIVATE)
215 ######################################################################
216 ### do-configure-imake runs xmkmf and imake to configure the software
217 ### for building.
219 _CONFIGURE_IMAKE_ENV+= XPROJECTROOT=${X11BASE:Q}
220 _CONFIGURE_IMAKE_ENV+= ${SCRIPTS_ENV}
222 .PHONY: do-configure-imake
223 do-configure-imake:
224 .for _dir_ in ${CONFIGURE_DIRS}
225 ${RUN} \
226 cd ${WRKSRC} && cd ${_dir_} && \
227 ${PKGSRC_SETENV} ${_CONFIGURE_IMAKE_ENV} ${XMKMF}
228 .endfor
230 ######################################################################
231 ### do-configure-cmake (PRIVATE)
232 ######################################################################
233 ### do-configure-cmake runs cmake to configure the software for
234 ### building.
236 _CONFIGURE_CMAKE_ENV+= BUILDLINK_DIR=${BUILDLINK_DIR}
237 _CONFIGURE_CMAKE_ENV+= ${CONFIGURE_ENV}
240 .PHONY: do-configure-cmake
241 do-configure-cmake:
242 .for _dir_ in ${CONFIGURE_DIRS}
243 ${RUN}${_ULIMIT_CMD} \
244 cd ${WRKSRC} && cd ${_dir_} && \
245 ${PKGSRC_SETENV} ${_CONFIGURE_CMAKE_ENV} \
246 cmake ${CMAKE_ARGS} ${CMAKE_ARG_PATH}
247 .endfor
249 ######################################################################
250 ### pre-configure, do-configure, post-configure (PUBLIC, override)
251 ######################################################################
252 ### {pre,do,post}-configure are the heart of the package-customizable
253 ### configure targets, and may be overridden within a package Makefile.
255 .PHONY: pre-configure do-configure post-configure
257 _DO_CONFIGURE_TARGETS+= ${HAS_CONFIGURE:D do-configure-script}
258 _DO_CONFIGURE_TARGETS+= ${USE_IMAKE:D do-configure-imake}
259 _DO_CONFIGURE_TARGETS+= ${USE_CMAKE:D do-configure-cmake}
261 .if !target(do-configure)
262 do-configure: ${_DO_CONFIGURE_TARGETS}
263 @${DO_NADA}
264 .endif
266 .if !target(pre-configure)
267 pre-configure:
268 @${DO_NADA}
269 .endif
271 .if !target(post-configure)
272 post-configure:
273 @${DO_NADA}
274 .endif
276 # configure-help:
277 # Runs ${CONFIGURE_SCRIPT} --help. It is mainly intended for
278 # package developers so they can quickly see the options of the
279 # configure script.
281 configure-help:
282 .for d in ${CONFIGURE_DIRS}
283 ${RUN} cd ${WRKSRC} && cd ${d} && ${PKGSRC_SETENV} ${_CONFIGURE_SCRIPT_ENV} ${CONFIG_SHELL} ${CONFIGURE_SCRIPT} --help
284 .endfor