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
8 # CONFIG_SHELL is the shell that is used for interpreting the
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
16 # CONFIGURE_ARGS is the list of arguments that is passed to the
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
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
38 # Command-line variables:
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
58 CONFIG_SHELL_FLAGS?
= # none
61 _BUILD_DEFS
+= CONFIGURE_ENV CONFIGURE_ARGS CMAKE_ARGS
63 .if defined
(GNU_CONFIGURE
)
64 .
include "gnu-configure.mk"
66 .if defined
(OVERRIDE_GNU_CONFIG_SCRIPTS
)
67 .
include "config-override.mk"
69 .if defined
(INSTALL_SH_OVERRIDE
) && empty
(INSTALL_SH_OVERRIDE
:M
[Nn
][Oo
])
70 .
include "install-sh-override.mk"
72 .if defined
(USE_LIBTOOL
)
73 .
include "libtool-override.mk"
75 .if defined
(PKGCONFIG_OVERRIDE
)
76 .
include "pkg-config-override.mk"
78 .
include "replace-interpreter.mk"
79 .if defined
(USE_PKGLOCALEDIR
)
80 .
include "replace-localedir.mk"
82 .if defined
(USE_CMAKE
)
86 ######################################################################
87 ### configure (PUBLIC)
88 ######################################################################
89 ### configure is a public target to configure the sources for building.
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
98 .if
!target
(configure
)
99 . if exists
(${_COOKIE.configure
})
102 . elif defined
(_PKGSRC_BARRIER
)
103 configure
: ${_CONFIGURE_TARGETS}
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
}:
117 ${_COOKIE.configure
}: real-configure
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
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\""
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
:
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
:
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
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}
213 ######################################################################
214 ### do-configure-imake (PRIVATE)
215 ######################################################################
216 ### do-configure-imake runs xmkmf and imake to configure the software
219 _CONFIGURE_IMAKE_ENV
+= XPROJECTROOT
=${X11BASE
:Q
}
220 _CONFIGURE_IMAKE_ENV
+= ${SCRIPTS_ENV}
222 .PHONY
: do-configure-imake
224 .for _dir_ in
${CONFIGURE_DIRS}
226 cd
${WRKSRC} && cd
${_dir_} && \
227 ${PKGSRC_SETENV} ${_CONFIGURE_IMAKE_ENV} ${XMKMF}
230 ######################################################################
231 ### do-configure-cmake (PRIVATE)
232 ######################################################################
233 ### do-configure-cmake runs cmake to configure the software for
236 _CONFIGURE_CMAKE_ENV
+= BUILDLINK_DIR
=${BUILDLINK_DIR}
237 _CONFIGURE_CMAKE_ENV
+= ${CONFIGURE_ENV}
240 .PHONY
: 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}
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}
266 .if
!target
(pre-configure
)
271 .if
!target
(post-configure
)
277 # Runs ${CONFIGURE_SCRIPT} --help. It is mainly intended for
278 # package developers so they can quickly see the options of the
282 .for d in
${CONFIGURE_DIRS}
283 ${RUN} cd
${WRKSRC} && cd
${d} && ${PKGSRC_SETENV} ${_CONFIGURE_SCRIPT_ENV} ${CONFIG_SHELL} ${CONFIGURE_SCRIPT} --help