ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/mports/trunk/Mk/extensions/autotools.mk
Revision: 15462
Committed: Tue Sep 17 03:15:41 2013 UTC (10 years, 7 months ago) by laffer1
File size: 13475 byte(s)
Log Message:
fixup some properties.

File Contents

# Content
1 #-*- mode: makefile; tab-width: 4; -*-
2 # ex:ts=4
3 #
4 # $MidnightBSD$
5 # $FreeBSD: ports/Mk/bsd.autotools.mk,v 1.28 2007/03/27 01:23:56 linimon Exp $
6 #
7 # Please view me with 4 column tabs!
8 #
9 # Please make sure all changes to this file are passed either through
10 # the maintainer, or portmgr@MidnightBSD.org
11
12 .if defined(_POSTMKINCLUDED) && !defined(Autotools_Post_Include)
13
14 Autotools_Post_Include= autotools.mk
15 Autotools_Include_MAINTAINER= luke@MidnightBSD.org
16
17 #---------------------------------------------------------------------------
18 # IMPORTANT! READ ME! YES, THAT MEANS YOU!
19 #
20 # The "versioned" autotools referenced here are for BUILDING other ports
21 # only. THIS CANNOT BE STRESSED HIGHLY ENOUGH. Things WILL BREAK if you
22 # try to use them for anything other than ports/ work. This particularly
23 # includes use as a run-time dependency.
24 #
25 # If you need unmodified versions of autotools, such as for use in an
26 # IDE, then you MUST use the devel/gnu-* equivalents, and NOT these.
27 # See devel/anjuta and devel/kdevelop for examples.
28 #
29 # You have been WARNED!
30 #---------------------------------------------------------------------------
31
32 #---------------------------------------------------------------------------
33 # Entry point into the autotools system
34 #---------------------------------------------------------------------------
35 #
36 # USE_AUTOTOOLS= tool:version[:env] ...
37 #
38 # 'tool' can currently be one of:
39 # libtool, libltdl, autoconf, autoheader, automake, aclocal
40 #
41 # 'version' is tool dependent
42 #
43 # ':env' is used to pecify that the environment variables are needed,
44 # but the relevant tool should NOT be run as part of the
45 # run-autotools target
46 #
47 # XXX: there is currently no sanity checking of the supplied variables
48 # other than to detect actually available versions. This should
49 # probably be fixed at some point.
50 #
51 # In addition, the following variables can be set in the port Makefile
52 # to be passed to the relevant tools:
53 #
54 # AUTOMAKE_ARGS=...
55 # - Extra arguments passed to automake during configure step
56 #
57 # ACLOCAL_ARGS=...
58 # - Arguments passed to aclocal during configure step
59 #
60 # AUTOCONF_ARGS=...
61 # - Extra arguments passed to autoconf during configure step
62 #
63 # AUTOHEADER_ARGS=...
64 # - Extra arguments passed to autoheader during configure step
65 #
66 # LIBTOOLFLAGS=<value>
67 # - Arguments passed to libtool during configure step
68 #
69 # LIBTOOLFILES=<list-of-files>
70 # - A list of files to patch during libtool pre-configuration
71 #
72 # AUTOTOOLSFILES=<list-of-files>
73 # - A list of files to further patch with derived information
74 # post-patching to reduce churn during component updates
75 #
76 #---------------------------------------------------------------------------
77
78 #---------------------------------------------------------------------------
79 # NO USER-SERVICABLE PARTS BEYOND THIS POINT. REALLY. WE MEAN IT.
80 #---------------------------------------------------------------------------
81
82 # Known autotools components
83 _AUTOTOOLS_ALL= autoconf autoheader autoconf213 autoheader213 \
84 automake aclocal automake14 aclocal14 \
85 libtool libtoolize libltdl
86
87 # Incompatible autotools mixing
88 _AUTOTOOLS_IGN_autoconf= autoconf213 autoheader213
89 _AUTOTOOLS_IGN_autoheader= autoconf213 autoheader213
90 _AUTOTOOLS_IGN_autoconf213= autoconf autoheader
91 _AUTOTOOLS_IGN_autoheader213= autoconf autoheader
92 _AUTOTOOLS_IGN_automake= automake14 aclocal14
93 _AUTOTOOLS_IGN_aclocal= automake14 aclocal14
94 _AUTOTOOLS_IGN_automake14= automake aclocal
95 _AUTOTOOLS_IGN_aclocal14= automake aclocal
96
97 #---------------------------------------------------------------------------
98 # Primary magic to break out the USE_AUTOTOOLS stanza into something
99 # more useful, along with substantial error checking to prevent
100 # foot-shooting
101 #---------------------------------------------------------------------------
102
103 # Break out the stanza
104 #
105 _AUTOTOOLS_IMPL=
106 .for stanza in ${USE_AUTOTOOLS}
107 _AUTOTOOLS_IMPL+= ${stanza:C/^([^:]+).*/\1/}
108 _AUTOTOOL_${stanza:C/^([^:]+).*/\1/}= ${stanza:C/^[^:]+:([^:]+)/\1/}
109 .endfor
110
111 # Verify each component, normalize
112 #
113 _AUTOTOOLS_NOCOMP=
114 .for component in ${_AUTOTOOLS_IMPL}
115 . if ${_AUTOTOOLS_ALL:M${component}}==""
116 _AUTOTOOLS_NOCOMP+= ${component}
117 . endif
118 . if ${_AUTOTOOL_${component}}==${component}
119 _AUTOTOOL_${component}= yes
120 . elsif ${_AUTOTOOL_${component}}!="env" && ${_AUTOTOOL_${component}}!="yes"
121 _AUTOTOOLS_BADCOMP+= ${component}:${_AUTOTOOL_${component}}
122 . endif
123 .endfor
124 .if !empty(_AUTOTOOLS_NOCOMP)
125 IGNORE+= Unknown autotool: ${_AUTOTOOLS_NOCOMP:O:u}
126 .endif
127
128 # Check for anything other than 'yes' or 'env'
129 #
130 _AUTOTOOLS_BADCOMP=
131 .for component in ${_AUTOTOOLS_IMPL}
132 . if ${_AUTOTOOL_${component}}!="env" && ${_AUTOTOOL_${component}}!="yes"
133 _AUTOTOOLS_BADCOMP+= ${component}:${_AUTOTOOL_${component}}
134 . endif
135 .endfor
136 .if !empty(_AUTOTOOLS_BADCOMP)
137 IGNORE+= Bad autotool stanza: ${_AUTOTOOLS_BADCOMP:O:u}
138 .endif
139
140 # Check for incompatible mixes of components
141 #
142 _AUTOTOOLS_IGN=
143 .for component in ${_AUTOTOOLS_IMPL}
144 . for ignore in ${_AUTOTOOLS_IGN_${component}}
145 . if defined(_AUTOTOOL_${ignore})
146 _AUTOTOOLS_IGN+= ${component}
147 . endif
148 . endfor
149 .endfor
150 .if !empty(_AUTOTOOLS_IGN)
151 IGNORE+= Incompatible autotools: ${_AUTOTOOLS_IGN:O:u}
152 .endif
153
154 #---------------------------------------------------------------------------
155 # automake and aclocal
156 #---------------------------------------------------------------------------
157
158 .if defined(_AUTOTOOL_aclocal) && ${_AUTOTOOL_aclocal} == "yes"
159 _AUTOTOOL_automake?= env
160 _AUTOTOOL_rule_aclocal= yes
161 GNU_CONFIGURE= yes
162 .endif
163
164 .if defined(_AUTOTOOL_automake)
165 AUTOMAKE_VERSION= 1.12
166 AUTOMAKE_APIVER= 1.12.6
167 AUTOMAKE_PORT= devel/automake
168
169 . if ${_AUTOTOOL_automake} == "yes"
170 _AUTOTOOL_rule_automake= yes
171 GNU_CONFIGURE?= yes
172 . endif
173 .endif
174
175 .if defined(_AUTOTOOL_aclocal14) && ${_AUTOTOOL_aclocal14} == "yes"
176 _AUTOTOOL_automake14?= env
177 _AUTOTOOL_rule_aclocal14= yes
178 GNU_CONFIGURE?= yes
179 .endif
180
181 .if defined(_AUTOTOOL_automake14)
182 AUTOMAKE_VERSION= 1.4
183 AUTOMAKE_APIVER= 1.4.6
184 AUTOMAKE_PORT= devel/automake14
185 AUTOMAKE_ARGS+= -i # backwards compatibility shim
186
187 . if ${_AUTOTOOL_automake14} == "yes"
188 _AUTOTOOL_rule_automake= yes
189 GNU_CONFIGURE?= yes
190 . endif
191 .endif
192
193 .if defined(AUTOMAKE_VERSION)
194 AUTOMAKE= ${LOCALBASE}/bin/automake-${AUTOMAKE_VERSION}
195 AUTOMAKE_DIR= ${LOCALBASE}/share/automake-${AUTOMAKE_VERSION}
196 ACLOCAL= ${LOCALBASE}/bin/aclocal-${AUTOMAKE_VERSION}
197 ACLOCAL_DIR= ${LOCALBASE}/share/aclocal-${AUTOMAKE_VERSION}
198
199 . if defined(_AUTOTOOL_aclocal) || defined(_AUTOTOOL_aclocal14)
200 ACLOCAL_ARGS?= --acdir=${ACLOCAL_DIR}
201 . endif
202
203 AUTOMAKE_VARS= AUTOMAKE=${AUTOMAKE} \
204 AUTOMAKE_DIR=${AUTOMAKE_DIR} \
205 AUTOMAKE_VERSION=${AUTOMAKE_VERSION} \
206 AUTOMAKE_APIVER=${AUTOMAKE_APIVER} \
207 ACLOCAL=${ACLOCAL} \
208 ACLOCAL_DIR=${ACLOCAL_DIR}
209
210 AUTOMAKE_DEPENDS= ${AUTOMAKE}:${PORTSDIR}/${AUTOMAKE_PORT}
211 BUILD_DEPENDS+= ${AUTOMAKE_DEPENDS}
212 .endif
213
214 #---------------------------------------------------------------------------
215 # autoconf and autoheader
216 #---------------------------------------------------------------------------
217
218 .if defined(_AUTOTOOL_autoheader) && ${_AUTOTOOL_autoheader} == "yes"
219 _AUTOTOOL_autoconf= yes
220 _AUTOTOOL_rule_autoheader= yes
221 GNU_CONFIGURE?= yes
222 .endif
223
224 .if defined(_AUTOTOOL_autoconf)
225 AUTOCONF_VERSION= 2.69
226 AUTOCONF_PORT= devel/autoconf
227
228 . if ${_AUTOTOOL_autoconf} == "yes"
229 _AUTOTOOL_rule_autoconf= yes
230 GNU_CONFIGURE?= yes
231 . endif
232 .endif
233
234 .if defined(_AUTOTOOL_autoheader213) && ${_AUTOTOOL_autoheader213} == "yes"
235 _AUTOTOOL_autoconf213= yes
236 _AUTOTOOL_rule_autoheader= yes
237 GNU_CONFIGURE?= yes
238 .endif
239
240 .if defined(_AUTOTOOL_autoconf213)
241 AUTOCONF_VERSION= 2.13
242 AUTOCONF_PORT= devel/autoconf213
243 AUTOM4TE= ${FALSE} # doesn't exist here
244
245 . if ${_AUTOTOOL_autoconf213} == "yes"
246 _AUTOTOOL_rule_autoconf= yes
247 GNU_CONFIGURE?= yes
248 . endif
249 .endif
250
251 .if defined(AUTOCONF_VERSION)
252 AUTOCONF= ${LOCALBASE}/bin/autoconf-${AUTOCONF_VERSION}
253 AUTOCONF_DIR= ${LOCALBASE}/share/autoconf-${AUTOCONF_VERSION}
254 AUTOHEADER= ${LOCALBASE}/bin/autoheader-${AUTOCONF_VERSION}
255 AUTOIFNAMES= ${LOCALBASE}/bin/ifnames-${AUTOCONF_VERSION}
256 AUTOM4TE?= ${LOCALBASE}/bin/autom4te-${AUTOCONF_VERSION}
257 AUTORECONF= ${LOCALBASE}/bin/autoreconf-${AUTOCONF_VERSION}
258 AUTOSCAN= ${LOCALBASE}/bin/autoscan-${AUTOCONF_VERSION}
259 AUTOUPDATE= ${LOCALBASE}/bin/autoupdate-${AUTOCONF_VERSION}
260
261 AUTOCONF_VARS= AUTOCONF=${AUTOCONF} \
262 AUTOCONF_DIR=${AUTOCONF_DIR} \
263 AUTOHEADER=${AUTOHEADER} \
264 AUTOIFNAMES=${AUTOIFNAMES} \
265 AUTOM4TE=${AUTOM4TE} \
266 AUTORECONF=${AUTORECONF} \
267 AUTOSCAN=${AUTOSCAN} \
268 AUTOUPDATE=${AUTOUPDATE} \
269 AUTOCONF_VERSION=${AUTOCONF_VERSION}
270
271 AUTOCONF_DEPENDS= ${AUTOCONF}:${PORTSDIR}/${AUTOCONF_PORT}
272 BUILD_DEPENDS+= ${AUTOCONF_DEPENDS}
273 .endif
274
275 #---------------------------------------------------------------------------
276 # libltdl
277 #---------------------------------------------------------------------------
278
279 .if defined(_AUTOTOOL_libltdl)
280 LIB_DEPENDS+= ltdl.7:${PORTSDIR}/devel/libltdl
281 .endif
282
283 #---------------------------------------------------------------------------
284 # libtool/libtoolize
285 #---------------------------------------------------------------------------
286
287 .if defined(_AUTOTOOL_libtool) || defined(_AUTOTOOL_libtoolize)
288 LIBTOOL_VERSION= 2.4
289 LIBTOOL_PORT= devel/libtool
290
291 . if defined(_AUTOTOOL_libtool) && ${_AUTOTOOL_libtool} == "yes"
292 _AUTOTOOL_rule_libtool= yes
293 GNU_CONFIGURE?= yes
294 . endif
295 . if defined(_AUTOTOOL_libtoolize) && ${_AUTOTOOL_libtoolize} == "yes"
296 _AUTOTOOL_rule_libtoolize= yes
297 GNU_CONFIGURE?= yes
298 . endif
299
300 .endif
301
302 .if defined(LIBTOOL_VERSION)
303 LIBTOOL= ${LOCALBASE}/bin/libtool
304 LIBTOOLIZE= ${LOCALBASE}/bin/libtoolize
305 LIBTOOL_LIBEXECDIR= ${LOCALBASE}/libexec/libtool
306 LIBTOOL_SHAREDIR= ${LOCALBASE}/share/libtool
307 LIBTOOL_M4= ${LOCALBASE}/share/aclocal/libtool.m4
308 LTMAIN= ${LOCALBASE}/share/libtool/config/ltmain.sh
309
310 LIBTOOL_VARS= LIBTOOL=${LIBTOOL} \
311 LIBTOOLIZE=${LIBTOOLIZE} \
312 LIBTOOL_LIBEXECDIR=${LIBTOOL_LIBEXECDIR} \
313 LIBTOOL_SHAREDIR=${LIBTOOL_SHAREDIR} \
314 LIBTOOL_M4=${LIBTOOL_M4} \
315 LTMAIN=${LTMAIN}
316
317 LIBTOOLFLAGS?= # default to empty
318
319 . if defined(_AUTOTOOL_rule_autoconf) || defined(_AUTOTOOL_rule_autoconf213)
320 LIBTOOLFILES?= aclocal.m4
321 . elif defined(_AUTOTOOL_rule_libtool)
322 LIBTOOLFILES?= ${CONFIGURE_SCRIPT}
323 . endif
324
325 LIBTOOL_DEPENDS= libtool>=2.4:${PORTSDIR}/${LIBTOOL_PORT}
326 BUILD_DEPENDS+= ${LIBTOOL_DEPENDS}
327 .endif
328
329 #---------------------------------------------------------------------------
330 # Add to the environment
331 #---------------------------------------------------------------------------
332
333 AUTOTOOLS_VARS= ${AUTOMAKE_VARS} ${AUTOCONF_VARS} ${LIBTOOL_VARS}
334
335 .if defined(AUTOTOOLS_VARS) && !empty(AUTOTOOLS_VARS)
336 . for var in AUTOTOOLS CONFIGURE MAKE SCRIPTS
337 ${var:U}_ENV+= ${AUTOTOOLS_VARS}
338 . endfor
339 .endif
340
341 #---------------------------------------------------------------------------
342 # Make targets
343 #---------------------------------------------------------------------------
344
345 .if !target(run-autotools)
346 .ORDER: run-autotools run-autotools-aclocal \
347 patch-autotools-libtool run-autotools-autoheader \
348 run-autotools-libtoolize run-autotools-autoconf \
349 run-autotools-automake
350
351 run-autotools:: run-autotools-aclocal \
352 patch-autotools-libtool run-autotools-autoheader \
353 run-autotools-libtoolize run-autotools-autoconf \
354 run-autotools-automake
355 .endif
356
357 .if !target(run-autotools-aclocal)
358 run-autotools-aclocal:
359 . if defined(_AUTOTOOL_rule_aclocal)
360 @(cd ${CONFIGURE_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${ACLOCAL} \
361 ${ACLOCAL_ARGS})
362 . else
363 @${DO_NADA}
364 . endif
365 .endif
366
367 .if !target(run-autotools-automake)
368 run-autotools-automake:
369 . if defined(_AUTOTOOL_rule_automake)
370 @(cd ${CONFIGURE_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${AUTOMAKE} \
371 ${AUTOMAKE_ARGS})
372 . else
373 @${DO_NADA}
374 . endif
375 .endif
376
377 .if !target(run-autotools-autoconf)
378 run-autotools-autoconf:
379 . if defined(_AUTOTOOL_rule_autoconf)
380 @(cd ${CONFIGURE_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${AUTOCONF} \
381 ${AUTOCONF_ARGS})
382 . else
383 @${DO_NADA}
384 . endif
385 .endif
386
387 .if !target(run-autotools-autoheader)
388 run-autotools-autoheader:
389 . if defined(_AUTOTOOL_rule_autoheader)
390 @(cd ${CONFIGURE_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${AUTOHEADER} \
391 ${AUTOHEADER_ARGS})
392 . else
393 @${DO_NADA}
394 . endif
395 .endif
396
397 .if !target(run-autotools-libtoolize)
398 run-autotools-libtoolize:
399 . if defined(_AUTOTOOL_rule_libtoolize)
400 @(cd ${CONFIGURE_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${LIBTOOLIZE} \
401 ${LIBTOOLIZE_ARGS})
402 . else
403 @${DO_NADA}
404 . endif
405 .endif
406
407 .if !target(patch-autotools-libtool)
408 patch-autotools-libtool::
409 . if defined(_AUTOTOOL_rule_libtool)
410 @for file in ${LIBTOOLFILES}; do \
411 ${REINPLACE_CMD} -e \
412 "/^ltmain=/!s|\$$ac_aux_dir/ltmain.sh|${LIBTOOLFLAGS} ${LTMAIN}|g; \
413 /^LIBTOOL=/s|\$$(top_builddir)/libtool|${LIBTOOL}|g" \
414 ${PATCH_WRKSRC}/$$file; \
415 done;
416 . else
417 @${DO_NADA}
418 . endif
419 .endif
420
421 #---------------------------------------------------------------------------
422 # Reduce patch churn by auto-substituting data from AUTOTOOLS_VARS
423 # into the correct places. Code shamelessly stolen from PLIST_SUB.
424
425 AUTOTOOLSFILES?= # default to empty
426 AUTOTOOLS_VARS?= # empty if not already set
427
428 .if !target(configure-autotools)
429 configure-autotools::
430 . if ${AUTOTOOLS_VARS}!="" && ${AUTOTOOLSFILES} != ""
431 @for file in ${AUTOTOOLSFILES}; do \
432 ${REINPLACE_CMD} ${AUTOTOOLS_VARS:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
433 ${WRKSRC}/$${file} ; \
434 done
435 . else
436 @${DO_NADA}
437 . endif
438 .endif
439
440 .endif #!defined(_POSTMKINCLUDED) && !defined(Autotools_Pre_Include)

Properties

Name Value
svn:keywords MidnightBSD=%H