summaryrefslogtreecommitdiffstats
path: root/meta/classes/autotools.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/autotools.bbclass')
-rw-r--r--meta/classes/autotools.bbclass128
1 files changed, 8 insertions, 120 deletions
diff --git a/meta/classes/autotools.bbclass b/meta/classes/autotools.bbclass
index c43531b050..3741d09706 100644
--- a/meta/classes/autotools.bbclass
+++ b/meta/classes/autotools.bbclass
@@ -131,129 +131,15 @@ EXTRACONFFUNCS ??= ""
131 131
132EXTRA_OECONF_append = " ${PACKAGECONFIG_CONFARGS}" 132EXTRA_OECONF_append = " ${PACKAGECONFIG_CONFARGS}"
133 133
134do_configure[prefuncs] += "autotools_preconfigure autotools_copy_aclocals ${EXTRACONFFUNCS}" 134do_configure[prefuncs] += "autotools_preconfigure autotools_aclocals ${EXTRACONFFUNCS}"
135do_configure[postfuncs] += "autotools_postconfigure" 135do_configure[postfuncs] += "autotools_postconfigure"
136 136
137ACLOCALDIR = "${WORKDIR}/aclocal-copy" 137ACLOCALDIR = "${STAGING_DATADIR}/aclocal"
138 138ACLOCALEXTRAPATH = ""
139python autotools_copy_aclocals () { 139ACLOCALEXTRAPATH_class-target = " -I ${STAGING_DATADIR_NATIVE}/aclocal/"
140 import copy 140ACLOCALEXTRAPATH_class-nativesdk = " -I ${STAGING_DATADIR_NATIVE}/aclocal/"
141
142 s = d.getVar("AUTOTOOLS_SCRIPT_PATH")
143 if not os.path.exists(s + "/configure.in") and not os.path.exists(s + "/configure.ac"):
144 if not d.getVar("AUTOTOOLS_COPYACLOCAL", False):
145 return
146
147 taskdepdata = d.getVar("BB_TASKDEPDATA", False)
148 #bb.warn(str(taskdepdata))
149 pn = d.getVar("PN")
150 aclocaldir = d.getVar("ACLOCALDIR")
151 oe.path.remove(aclocaldir)
152 bb.utils.mkdirhier(aclocaldir)
153 start = None
154 configuredeps = []
155 # Detect bitbake -b usage
156 # Everything but quilt-native would have dependencies
157 nodeps = (pn != "quilt-native")
158
159 for dep in taskdepdata:
160 data = taskdepdata[dep]
161 if data[1] == "do_configure" and data[0] == pn:
162 start = dep
163 if not nodeps and start:
164 break
165 if nodeps and data[0] != pn:
166 nodeps = False
167 if start is None:
168 bb.fatal("Couldn't find ourself in BB_TASKDEPDATA?")
169
170 # We need to figure out which m4 files we need to expose to this do_configure task.
171 # This needs to match what would get restored from sstate, which is controlled
172 # ultimately by calls from bitbake to setscene_depvalid().
173 # That function expects a setscene dependency tree. We build a dependency tree
174 # condensed to do_populate_sysroot -> do_populate_sysroot dependencies, similar to
175 # that used by setscene tasks. We can then call into setscene_depvalid() and decide
176 # which dependencies we can "see" and should expose the m4 files for.
177 setscenedeps = copy.deepcopy(taskdepdata)
178
179 start = set([start])
180
181 # Create collapsed do_populate_sysroot -> do_populate_sysroot tree
182 for dep in taskdepdata:
183 data = setscenedeps[dep]
184 if data[1] != "do_populate_sysroot":
185 for dep2 in setscenedeps:
186 data2 = setscenedeps[dep2]
187 if dep in data2[3]:
188 data2[3].update(setscenedeps[dep][3])
189 data2[3].remove(dep)
190 if dep in start:
191 start.update(setscenedeps[dep][3])
192 start.remove(dep)
193 del setscenedeps[dep]
194
195 # Remove circular references
196 for dep in setscenedeps:
197 if dep in setscenedeps[dep][3]:
198 setscenedeps[dep][3].remove(dep)
199
200 # Direct dependencies should be present and can be depended upon
201 for dep in start:
202 configuredeps.append(setscenedeps[dep][0])
203
204 # Call into setscene_depvalid for each sub-dependency and only copy m4 files
205 # for ones that would be restored from sstate.
206 done = list(start)
207 next = list(start)
208 while next:
209 new = []
210 for dep in next:
211 data = setscenedeps[dep]
212 for datadep in data[3]:
213 if datadep in done:
214 continue
215 taskdeps = {}
216 taskdeps[dep] = setscenedeps[dep][:2]
217 taskdeps[datadep] = setscenedeps[datadep][:2]
218 retval = setscene_depvalid(datadep, taskdeps, [], d)
219 if retval:
220 bb.note("Skipping setscene dependency %s for m4 macro copying" % datadep)
221 continue
222 done.append(datadep)
223 new.append(datadep)
224 configuredeps.append(setscenedeps[datadep][0])
225 next = new
226
227 cp = []
228 if nodeps:
229 bb.warn("autotools: Unable to find task dependencies, -b being used? Pulling in all m4 files")
230 for l in [d.expand("${STAGING_DATADIR_NATIVE}/aclocal/"), d.expand("${STAGING_DATADIR}/aclocal/")]:
231 cp.extend(os.path.join(l, f) for f in os.listdir(l))
232
233 for c in configuredeps:
234 if c.endswith("-native"):
235 manifest = d.expand("${SSTATE_MANIFESTS}/manifest-${BUILD_ARCH}-%s.populate_sysroot" % c)
236 elif c.startswith("nativesdk-"):
237 manifest = d.expand("${SSTATE_MANIFESTS}/manifest-${SDK_ARCH}_${SDK_OS}-%s.populate_sysroot" % c)
238 elif "-cross-" in c or "-crosssdk" in c:
239 continue
240 else:
241 manifest = d.expand("${SSTATE_MANIFESTS}/manifest-${MACHINE}-%s.populate_sysroot" % c)
242 try:
243 f = open(manifest, "r")
244 for l in f:
245 if "/aclocal/" in l and l.strip().endswith(".m4"):
246 cp.append(l.strip())
247 elif "config_site.d/" in l:
248 cp.append(l.strip())
249 except:
250 bb.warn("%s not found" % manifest)
251
252 for c in cp:
253 t = os.path.join(aclocaldir, os.path.basename(c))
254 if not os.path.exists(t):
255 os.symlink(c, t)
256 141
142python autotools_aclocals () {
257 # Refresh variable with cache files 143 # Refresh variable with cache files
258 d.setVar("CONFIG_SITE", siteinfo_get_files(d, aclocalcache=True)) 144 d.setVar("CONFIG_SITE", siteinfo_get_files(d, aclocalcache=True))
259} 145}
@@ -279,6 +165,7 @@ autotools_do_configure() {
279 if [ -e ${AUTOTOOLS_SCRIPT_PATH}/configure.in -o -e ${AUTOTOOLS_SCRIPT_PATH}/configure.ac ]; then 165 if [ -e ${AUTOTOOLS_SCRIPT_PATH}/configure.in -o -e ${AUTOTOOLS_SCRIPT_PATH}/configure.ac ]; then
280 olddir=`pwd` 166 olddir=`pwd`
281 cd ${AUTOTOOLS_SCRIPT_PATH} 167 cd ${AUTOTOOLS_SCRIPT_PATH}
168 mkdir -p ${ACLOCALDIR}
282 ACLOCAL="aclocal --system-acdir=${ACLOCALDIR}/" 169 ACLOCAL="aclocal --system-acdir=${ACLOCALDIR}/"
283 if [ x"${acpaths}" = xdefault ]; then 170 if [ x"${acpaths}" = xdefault ]; then
284 acpaths= 171 acpaths=
@@ -289,6 +176,7 @@ autotools_do_configure() {
289 else 176 else
290 acpaths="${acpaths}" 177 acpaths="${acpaths}"
291 fi 178 fi
179 acpaths="$acpaths ${ACLOCALEXTRAPATH}"
292 AUTOV=`automake --version | sed -e '1{s/.* //;s/\.[0-9]\+$//};q'` 180 AUTOV=`automake --version | sed -e '1{s/.* //;s/\.[0-9]\+$//};q'`
293 automake --version 181 automake --version
294 echo "AUTOV is $AUTOV" 182 echo "AUTOV is $AUTOV"