summaryrefslogtreecommitdiffstats
path: root/scripts/lib/recipetool
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-01-19 00:18:29 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-01-19 17:24:50 +0000
commitece0a2e1a03b03c3280027f13fe3345cd05f9058 (patch)
tree997bcef011e23ddf61272d10ebdaeb430f4082bb /scripts/lib/recipetool
parent903d47135569d71bda0d554d8cc7fe06a6a44c80 (diff)
downloadpoky-ece0a2e1a03b03c3280027f13fe3345cd05f9058.tar.gz
recipetool: create: support additional autoconf macros from autoconf-archive
Support a number of macros from autoconf-archive when reading configure.ac to extract dependencies. (From OE-Core rev: ee977a62c58ded361c2abd78654bd25637fe9ea1) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/recipetool')
-rw-r--r--scripts/lib/recipetool/create_buildsys.py95
1 files changed, 94 insertions, 1 deletions
diff --git a/scripts/lib/recipetool/create_buildsys.py b/scripts/lib/recipetool/create_buildsys.py
index c6d9bbe254..127e13359b 100644
--- a/scripts/lib/recipetool/create_buildsys.py
+++ b/scripts/lib/recipetool/create_buildsys.py
@@ -144,6 +144,8 @@ class AutotoolsRecipeHandler(RecipeHandler):
144 def extract_autotools_deps(outlines, srctree, extravalues=None, acfile=None): 144 def extract_autotools_deps(outlines, srctree, extravalues=None, acfile=None):
145 import shlex 145 import shlex
146 import oe.package 146 import oe.package
147 import json
148 import glob
147 149
148 values = {} 150 values = {}
149 inherits = [] 151 inherits = []
@@ -163,6 +165,7 @@ class AutotoolsRecipeHandler(RecipeHandler):
163 pkg_re = re.compile('PKG_CHECK_MODULES\(\[?[a-zA-Z0-9_]*\]?, *\[?([^,\]]*)\]?[),].*') 165 pkg_re = re.compile('PKG_CHECK_MODULES\(\[?[a-zA-Z0-9_]*\]?, *\[?([^,\]]*)\]?[),].*')
164 pkgce_re = re.compile('PKG_CHECK_EXISTS\(\[?([^,\]]*)\]?[),].*') 166 pkgce_re = re.compile('PKG_CHECK_EXISTS\(\[?([^,\]]*)\]?[),].*')
165 lib_re = re.compile('AC_CHECK_LIB\(\[?([^,\]]*)\]?,.*') 167 lib_re = re.compile('AC_CHECK_LIB\(\[?([^,\]]*)\]?,.*')
168 libx_re = re.compile('AX_CHECK_LIBRARY\(\[?[^,\]]*\]?, *\[?([^,\]]*)\]?, *\[?([a-zA-Z0-9-]*)\]?,.*')
166 progs_re = re.compile('_PROGS?\(\[?[a-zA-Z0-9_]*\]?, \[?([^,\]]*)\]?[),].*') 169 progs_re = re.compile('_PROGS?\(\[?[a-zA-Z0-9_]*\]?, \[?([^,\]]*)\]?[),].*')
167 dep_re = re.compile('([^ ><=]+)( [<>=]+ [^ ><=]+)?') 170 dep_re = re.compile('([^ ><=]+)( [<>=]+ [^ ><=]+)?')
168 ac_init_re = re.compile('AC_INIT\(([^,]+), *([^,]+)[,)].*') 171 ac_init_re = re.compile('AC_INIT\(([^,]+), *([^,]+)[,)].*')
@@ -189,6 +192,7 @@ class AutotoolsRecipeHandler(RecipeHandler):
189 192
190 # Now turn it into a library->recipe mapping 193 # Now turn it into a library->recipe mapping
191 recipelibmap = {} 194 recipelibmap = {}
195 recipeheadermap = {}
192 pkgdata_dir = tinfoil.config_data.getVar('PKGDATA_DIR', True) 196 pkgdata_dir = tinfoil.config_data.getVar('PKGDATA_DIR', True)
193 for libname, pkg in pkglibmap.iteritems(): 197 for libname, pkg in pkglibmap.iteritems():
194 try: 198 try:
@@ -203,6 +207,27 @@ class AutotoolsRecipeHandler(RecipeHandler):
203 else: 207 else:
204 raise 208 raise
205 209
210 def load_headermap():
211 if recipeheadermap:
212 return
213 includedir = tinfoil.config_data.getVar('includedir', True)
214 for pkg in glob.glob(os.path.join(pkgdata_dir, 'runtime', '*-dev')):
215 with open(os.path.join(pkgdata_dir, 'runtime', pkg)) as f:
216 pn = None
217 headers = []
218 for line in f:
219 if line.startswith('PN:'):
220 pn = line.split(':', 1)[-1].strip()
221 elif line.startswith('FILES_INFO:'):
222 val = line.split(':', 1)[1].strip()
223 dictval = json.loads(val)
224 for fullpth in sorted(dictval):
225 if fullpth.startswith(includedir) and fullpth.endswith('.h'):
226 headers.append(os.path.relpath(fullpth, includedir))
227 if pn and headers:
228 for header in headers:
229 recipeheadermap[header] = pn
230
206 defines = {} 231 defines = {}
207 def subst_defines(value): 232 def subst_defines(value):
208 newvalue = value 233 newvalue = value
@@ -263,7 +288,7 @@ class AutotoolsRecipeHandler(RecipeHandler):
263 deps.append('intltool-native') 288 deps.append('intltool-native')
264 elif keyword == 'AM_PATH_GLIB_2_0': 289 elif keyword == 'AM_PATH_GLIB_2_0':
265 deps.append('glib-2.0') 290 deps.append('glib-2.0')
266 elif keyword == 'AC_CHECK_PROG' or keyword == 'AC_PATH_PROG': 291 elif keyword in ('AC_CHECK_PROG', 'AC_PATH_PROG', 'AX_WITH_PROG'):
267 res = progs_re.search(value) 292 res = progs_re.search(value)
268 if res: 293 if res:
269 for prog in shlex.split(res.group(1)): 294 for prog in shlex.split(res.group(1)):
@@ -292,6 +317,26 @@ class AutotoolsRecipeHandler(RecipeHandler):
292 if libdep is None: 317 if libdep is None:
293 if not lib.startswith('$'): 318 if not lib.startswith('$'):
294 unmappedlibs.append(lib) 319 unmappedlibs.append(lib)
320 elif keyword == 'AX_CHECK_LIBRARY':
321 res = libx_re.search(value)
322 if res:
323 lib = res.group(2)
324 if lib in ignorelibs:
325 logger.debug('Ignoring library dependency %s' % lib)
326 else:
327 libdep = recipelibmap.get(lib, None)
328 if libdep:
329 deps.append(libdep)
330 else:
331 if libdep is None:
332 if not lib.startswith('$'):
333 header = res.group(1)
334 load_headermap()
335 libdep = recipeheadermap.get(header, None)
336 if libdep:
337 deps.append(libdep)
338 else:
339 unmappedlibs.append(lib)
295 elif keyword == 'AC_PATH_X': 340 elif keyword == 'AC_PATH_X':
296 deps.append('libx11') 341 deps.append('libx11')
297 elif keyword in ('AX_BOOST', 'BOOST_REQUIRE'): 342 elif keyword in ('AX_BOOST', 'BOOST_REQUIRE'):
@@ -300,6 +345,36 @@ class AutotoolsRecipeHandler(RecipeHandler):
300 deps.append('flex-native') 345 deps.append('flex-native')
301 elif keyword in ('AC_PROG_YACC', 'AX_PROG_BISON'): 346 elif keyword in ('AC_PROG_YACC', 'AX_PROG_BISON'):
302 deps.append('bison-native') 347 deps.append('bison-native')
348 elif keyword == 'AX_CHECK_ZLIB':
349 deps.append('zlib')
350 elif keyword in ('AX_CHECK_OPENSSL', 'AX_LIB_CRYPTO'):
351 deps.append('openssl')
352 elif keyword == 'AX_LIB_CURL':
353 deps.append('curl')
354 elif keyword == 'AX_LIB_BEECRYPT':
355 deps.append('beecrypt')
356 elif keyword == 'AX_LIB_EXPAT':
357 deps.append('expat')
358 elif keyword == 'AX_LIB_GCRYPT':
359 deps.append('libgcrypt')
360 elif keyword == 'AX_LIB_NETTLE':
361 deps.append('nettle')
362 elif keyword == 'AX_LIB_READLINE':
363 deps.append('readline')
364 elif keyword == 'AX_LIB_SQLITE3':
365 deps.append('sqlite3')
366 elif keyword == 'AX_LIB_TAGLIB':
367 deps.append('taglib')
368 elif keyword == 'AX_PKG_SWIG':
369 deps.append('swig')
370 elif keyword == 'AX_PROG_XSLTPROC':
371 deps.append('libxslt-native')
372 elif keyword == 'AX_WITH_CURSES':
373 deps.append('ncurses')
374 elif keyword == 'AX_PATH_BDB':
375 deps.append('db')
376 elif keyword == 'AX_PATH_LIB_PCRE':
377 deps.append('libpcre')
303 elif keyword == 'AC_INIT': 378 elif keyword == 'AC_INIT':
304 if extravalues is not None: 379 if extravalues is not None:
305 res = ac_init_re.match(value) 380 res = ac_init_re.match(value)
@@ -336,7 +411,9 @@ class AutotoolsRecipeHandler(RecipeHandler):
336 'AM_PATH_GLIB_2_0', 411 'AM_PATH_GLIB_2_0',
337 'AC_CHECK_PROG', 412 'AC_CHECK_PROG',
338 'AC_PATH_PROG', 413 'AC_PATH_PROG',
414 'AX_WITH_PROG',
339 'AC_CHECK_LIB', 415 'AC_CHECK_LIB',
416 'AX_CHECK_LIBRARY',
340 'AC_PATH_X', 417 'AC_PATH_X',
341 'AX_BOOST', 418 'AX_BOOST',
342 'BOOST_REQUIRE', 419 'BOOST_REQUIRE',
@@ -345,6 +422,22 @@ class AutotoolsRecipeHandler(RecipeHandler):
345 'AX_PROG_FLEX', 422 'AX_PROG_FLEX',
346 'AC_PROG_YACC', 423 'AC_PROG_YACC',
347 'AX_PROG_BISON', 424 'AX_PROG_BISON',
425 'AX_CHECK_ZLIB',
426 'AX_CHECK_OPENSSL',
427 'AX_LIB_CRYPTO',
428 'AX_LIB_CURL',
429 'AX_LIB_BEECRYPT',
430 'AX_LIB_EXPAT',
431 'AX_LIB_GCRYPT',
432 'AX_LIB_NETTLE',
433 'AX_LIB_READLINE'
434 'AX_LIB_SQLITE3',
435 'AX_LIB_TAGLIB',
436 'AX_PKG_SWIG',
437 'AX_PROG_XSLTPROC',
438 'AX_WITH_CURSES',
439 'AX_PATH_BDB',
440 'AX_PATH_LIB_PCRE',
348 'AC_INIT', 441 'AC_INIT',
349 'AM_INIT_AUTOMAKE', 442 'AM_INIT_AUTOMAKE',
350 'define(', 443 'define(',