Update editors/libreoffice-sq to version 5.2.5
[dports.git] / Mk / bsd.autotools.mk
1 # $FreeBSD$
2 #
3 # IMPORTANT NOTE:
4 #       Before making any changes to this file, contact portmgr to arrange
5 #       for an experimental ports run.
6 #       Untested commits will almost certainly break the tree, incur the
7 #       wrath of countless folks, and be unceremoniously backed out by
8 #       the maintainer and/or portmgr.
9
10 Autotools_Include_MAINTAINER=   autotools@FreeBSD.org
11
12 #---------------------------------------------------------------------------
13 # USE_AUTOTOOLS= tool[:env] ...
14 #
15 # 'tool' can currently be one of the following:
16 #       autoconf, autoheader
17 #       automake, aclocal
18 #
19 # ':env' is used to specify that the environmental variables are needed
20 #       but the relevant tool should NOT be run as part of the
21 #       'run-autotools' target
22 #
23 # In addition, these variables can be set in the port Makefile to be
24 # passed to the relevant tools:
25 #
26 # AUTOMAKE_ARGS=...
27 #       - Extra arguments passed to automake during configure step
28 #
29 # ACLOCAL_ARGS=...
30 #       - Arguments passed to aclocal during configure step
31 #
32 # AUTOCONF_ARGS=...
33 #       - Extra arguments passed to autoconf during configure step
34 #
35 # AUTOHEADER_ARGS=...
36 #       - Extra arguments passed to autoheader during configure step
37 #
38 #---------------------------------------------------------------------------
39
40 #---------------------------------------------------------------------------
41 # NO USER-SERVICABLE PARTS BEYOND THIS POINT.  REALLY.  WE MEAN IT.
42 #---------------------------------------------------------------------------
43
44 # Known autotools components
45 _AUTOTOOLS_ALL= autoconf autoheader \
46                 automake aclocal
47
48 #---------------------------------------------------------------------------
49 # Primary magic to break out the USE_AUTOTOOLS stanza into something
50 # more useful, along with substantial error checking to prevent
51 # foot-shooting
52 #---------------------------------------------------------------------------
53
54 # Break out the stanza
55 #
56 _AUTOTOOLS_IMPL=
57 .for stanza in ${USE_AUTOTOOLS}
58 _AUTOTOOLS_IMPL+= ${stanza:C/^([^:]+).*/\1/}
59 _AUTOTOOL_${stanza:C/^([^:]+).*/\1/}= ${stanza:C/^[^:]+:([^:]+)/\1/}
60 .endfor
61
62 # Verify each component, normalize
63 #
64 _AUTOTOOLS_NOCOMP=
65 .for component in ${_AUTOTOOLS_IMPL}
66 . if ${_AUTOTOOLS_ALL:M${component}}==""
67 _AUTOTOOLS_NOCOMP+=     ${component}
68 . endif
69 . if ${_AUTOTOOL_${component}}==${component}
70 _AUTOTOOL_${component}=  yes
71 . elsif ${_AUTOTOOL_${component}}!="env" && ${_AUTOTOOL_${component}}!="yes"
72 _AUTOTOOLS_BADCOMP+= ${component}:${_AUTOTOOL_${component}}
73 . endif
74 .endfor
75 .if !empty(_AUTOTOOLS_NOCOMP)
76 IGNORE+=        Unknown autotool: ${_AUTOTOOLS_NOCOMP:O:u}
77 .endif
78
79 # Check for anything other than 'yes' or 'env'
80 #
81 _AUTOTOOLS_BADCOMP=
82 .for component in ${_AUTOTOOLS_IMPL}
83 . if ${_AUTOTOOL_${component}}!="env" && ${_AUTOTOOL_${component}}!="yes"
84 _AUTOTOOLS_BADCOMP+= ${component}:${_AUTOTOOL_${component}}
85 . endif
86 .endfor
87 .if !empty(_AUTOTOOLS_BADCOMP)
88 IGNORE+=        Bad autotool stanza: ${_AUTOTOOLS_BADCOMP:O:u}
89 .endif
90
91 #---------------------------------------------------------------------------
92 # automake and aclocal
93 #---------------------------------------------------------------------------
94
95 .if defined(_AUTOTOOL_aclocal) && ${_AUTOTOOL_aclocal} == "yes"
96 _AUTOTOOL_automake?=    env
97 _AUTOTOOL_rule_aclocal= yes
98 GNU_CONFIGURE=          yes
99 .endif
100
101 .if defined(_AUTOTOOL_automake)
102 AUTOMAKE_VERSION=       1.15
103 AUTOMAKE_APIVER=        1.15
104 AUTOMAKE_PORT=          devel/automake
105
106 . if ${_AUTOTOOL_automake} == "yes"
107 _AUTOTOOL_rule_automake=        yes
108 GNU_CONFIGURE?=                 yes
109 . endif
110 .endif
111
112 .if defined(AUTOMAKE_VERSION)
113 AUTOMAKE=               ${LOCALBASE}/bin/automake-${AUTOMAKE_VERSION}
114 AUTOMAKE_DIR=           ${LOCALBASE}/share/automake-${AUTOMAKE_VERSION}
115 ACLOCAL=                ${LOCALBASE}/bin/aclocal-${AUTOMAKE_VERSION}
116 ACLOCAL_DIR=            ${LOCALBASE}/share/aclocal-${AUTOMAKE_VERSION}
117
118 . if defined(_AUTOTOOL_aclocal)
119 ACLOCAL_ARGS?=          --automake-acdir=${ACLOCAL_DIR}
120 . endif
121
122 AUTOMAKE_VARS=          AUTOMAKE=${AUTOMAKE} \
123                         AUTOMAKE_DIR=${AUTOMAKE_DIR} \
124                         AUTOMAKE_VERSION=${AUTOMAKE_VERSION} \
125                         AUTOMAKE_APIVER=${AUTOMAKE_APIVER} \
126                         ACLOCAL=${ACLOCAL} \
127                         ACLOCAL_DIR=${ACLOCAL_DIR}
128
129 AUTOMAKE_DEPENDS=       ${AUTOMAKE}:${AUTOMAKE_PORT}
130 BUILD_DEPENDS+=         ${AUTOMAKE_DEPENDS}
131 .endif
132
133 #---------------------------------------------------------------------------
134 # autoconf and autoheader
135 #---------------------------------------------------------------------------
136
137 .if defined(_AUTOTOOL_autoheader) && ${_AUTOTOOL_autoheader} == "yes"
138 _AUTOTOOL_autoconf=             yes
139 _AUTOTOOL_rule_autoheader=      yes
140 GNU_CONFIGURE?=                 yes
141 .endif
142
143 .if defined(_AUTOTOOL_autoconf)
144 AUTOCONF_VERSION=       2.69
145 AUTOCONF_PORT=          devel/autoconf
146
147 . if ${_AUTOTOOL_autoconf} == "yes"
148 _AUTOTOOL_rule_autoconf=        yes
149 GNU_CONFIGURE?=                 yes
150 . endif
151 .endif
152
153 .if defined(AUTOCONF_VERSION)
154 AUTOCONF=               ${LOCALBASE}/bin/autoconf-${AUTOCONF_VERSION}
155 AUTOCONF_DIR=           ${LOCALBASE}/share/autoconf-${AUTOCONF_VERSION}
156 AUTOHEADER=             ${LOCALBASE}/bin/autoheader-${AUTOCONF_VERSION}
157 AUTOIFNAMES=            ${LOCALBASE}/bin/ifnames-${AUTOCONF_VERSION}
158 AUTOM4TE?=              ${LOCALBASE}/bin/autom4te-${AUTOCONF_VERSION}
159 AUTORECONF=             ${LOCALBASE}/bin/autoreconf-${AUTOCONF_VERSION}
160 AUTOSCAN=               ${LOCALBASE}/bin/autoscan-${AUTOCONF_VERSION}
161 AUTOUPDATE=             ${LOCALBASE}/bin/autoupdate-${AUTOCONF_VERSION}
162
163 AUTOCONF_VARS=          AUTOCONF=${AUTOCONF} \
164                         AUTOCONF_DIR=${AUTOCONF_DIR} \
165                         AUTOHEADER=${AUTOHEADER} \
166                         AUTOIFNAMES=${AUTOIFNAMES} \
167                         AUTOM4TE=${AUTOM4TE} \
168                         AUTORECONF=${AUTORECONF} \
169                         AUTOSCAN=${AUTOSCAN} \
170                         AUTOUPDATE=${AUTOUPDATE} \
171                         AUTOCONF_VERSION=${AUTOCONF_VERSION}
172
173 AUTOCONF_DEPENDS=       ${AUTOCONF}:${AUTOCONF_PORT}
174 BUILD_DEPENDS+=         ${AUTOCONF_DEPENDS}
175 .endif
176
177 #---------------------------------------------------------------------------
178 # Add to the environment
179 #---------------------------------------------------------------------------
180
181 AUTOTOOLS_VARS=         ${AUTOMAKE_VARS} ${AUTOCONF_VARS}
182
183 .if defined(AUTOTOOLS_VARS) && !empty(AUTOTOOLS_VARS)
184 . for var in AUTOTOOLS CONFIGURE MAKE SCRIPTS
185 ${var:tu}_ENV+=         ${AUTOTOOLS_VARS}
186 . endfor
187 .endif
188
189 #---------------------------------------------------------------------------
190 # Make targets
191 #---------------------------------------------------------------------------
192
193 _USES_configure+=460:run-autotools-aclocal 461:run-autotools-autoconf \
194         462:run-autotools-autoheader 463:run-autotools-automake
195
196 .if defined(_AUTOTOOL_rule_aclocal) && !target(run-autotools-aclocal)
197 run-autotools-aclocal:
198         @(cd ${CONFIGURE_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${ACLOCAL} \
199                 ${ACLOCAL_ARGS})
200 .endif
201
202 .if defined(_AUTOTOOL_rule_autoconf) && !target(run-autotools-autoconf)
203 run-autotools-autoconf:
204         @(cd ${CONFIGURE_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${AUTOCONF} \
205                 ${AUTOCONF_ARGS})
206 .endif
207
208 .if defined(_AUTOTOOL_rule_automake) && !target(run-autotools-automake)
209 run-autotools-automake:
210         @(cd ${CONFIGURE_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${AUTOMAKE} \
211                 ${AUTOMAKE_ARGS})
212 .endif
213
214 .if defined(_AUTOTOOL_rule_autoheader) && !target(run-autotools-autoheader)
215 run-autotools-autoheader:
216         @(cd ${CONFIGURE_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${AUTOHEADER} \
217                 ${AUTOHEADER_ARGS})
218 .endif