diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-04-09 15:57:21 -0400 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-04-09 15:57:21 -0400 |
commit | 662562d9fe7197bb85c89e9d000d215a5f5117d1 (patch) | |
tree | e7f6731dbfc545ebe920e5484938d32482effa11 /configure | |
parent | 1915c39eeee26d0f39a6fd0a3df1ce3d4be070b9 (diff) | |
download | qtlocation-mapboxgl-662562d9fe7197bb85c89e9d000d215a5f5117d1.tar.gz |
use mapnik-packaging to build all dependencies
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 117 |
1 files changed, 34 insertions, 83 deletions
@@ -8,8 +8,6 @@ import subprocess import sys root_dir = os.path.dirname(__file__) -sys.path.insert(0, os.path.join(root_dir, 'deps', 'gyp', 'pylib')) -import gyp # parse our options parser = optparse.OptionParser() @@ -19,42 +17,27 @@ parser.add_option("--debug", dest="debug", help="Also build debug build") +parser.add_option("--pkg-config-root", + action="store", + dest="pkgconfig_root", + help="Path to pkg-config directory") + parser.add_option("--boost", action="store", dest="boost_root", help="Path to boost (defaults to /usr/local)") -parser.add_option("--glfw3", - action="store", - dest="glfw3", - help="Path to gflw3 (defaults to using pkg-config)") - -parser.add_option("--png", - action="store", - dest="png", - help="Path to png (defaults to using pkg-config)") - -parser.add_option("--png-includes", - action="store", - dest="png_includes", - help="Path to png includes") - -parser.add_option("--png-libpath", - action="store", - dest="png_libpath", - help="Path to png libs") - (options, args) = parser.parse_args() -def pkg_config(pkg): - cmd = os.popen('pkg-config --static --libs %s' % pkg, 'r') - libs = cmd.readline().strip() - ret = cmd.close() +def pkg_config(pkg, pkgconfig_root): + env = os.environ.copy() + env["PKG_CONFIG_PATH"] = pkgconfig_root + cmd = subprocess.Popen(['pkg-config', '--static', '--libs', pkg], stdout=subprocess.PIPE, env=env) + libs, ret = cmd.communicate() if (ret): return None - cmd = os.popen('pkg-config --cflags %s' % pkg, 'r') - cflags = cmd.readline().strip() - ret = cmd.close() + cmd = subprocess.Popen(['pkg-config', '--cflags', pkg], stdout=subprocess.PIPE, env=env) + cflags, red = cmd.communicate() if (ret): return None return (libs, cflags) @@ -67,46 +50,28 @@ def configure_llmr(o): o['target_defaults']['default_configuration'] = 'Debug' if options.debug else 'Release' def configure_glfw3(o): - if options.glfw3: - libpath = os.path.join(options.glfw3,'lib') - if os.path.exists(libpath): - o['variables']['glfw3_libraries'] = ['-L'+libpath] - o['variables']['glfw3_libraries'] += ['-lglfw3'] - incpath = os.path.join(options.glfw3,'include') - if os.path.exists(incpath): - o['variables']['glfw3_cflags'] = ['-I'+incpath] - else: - ret = pkg_config('glfw3') - if not ret: - sys.stderr.write('could not find glfw3 with pkg-config') - sys.exit(-1) - o['variables']['glfw3_libraries'] = ret[0].split() - o['variables']['glfw3_cflags'] = ret[1].split() + ret = pkg_config('glfw3', options.pkgconfig_root) + if not ret: + sys.stderr.write('could not find glfw3 with pkg-config') + sys.exit(-1) + o['variables']['glfw3_libraries'] = ret[0].split() + o['variables']['glfw3_cflags'] = ret[1].split() def configure_png(o): - if options.png or options.png_libpath or options.png_includes: - libpath = None - if options.png_libpath: - libpath = options.png_libpath - elif options.png: - libpath = os.path.join(options.png,'lib') - if libpath and os.path.exists(libpath): - o['variables']['png_libraries'] = ['-L'+libpath] - o['variables']['png_libraries'] += ['-lpng','-lz'] - incpath = None - if options.png_includes: - incpath = options.png_includes - elif options.png: - incpath = os.path.join(options.png,'include') - if incpath and os.path.exists(incpath): - o['variables']['png_cflags'] = ['-I'+incpath] - else: - ret = pkg_config('libpng') - if not ret: - sys.stderr.write('could not find libpng with pkg-config') - sys.exit(-1) - o['variables']['png_libraries'] = ret[0].split() - o['variables']['png_cflags'] = ret[1].split() + ret = pkg_config('libpng', options.pkgconfig_root) + if not ret: + sys.stderr.write('could not find png with pkg-config') + sys.exit(-1) + o['variables']['png_libraries'] = ret[0].split() + o['variables']['png_cflags'] = ret[1].split() + +def configure_curl(o): + ret = pkg_config('libcurl', options.pkgconfig_root) + if not ret: + sys.stderr.write('could not find curl with pkg-config') + sys.exit(-1) + o['variables']['curl_libraries'] = ret[0].split() + o['variables']['curl_cflags'] = ret[1].split() def write(filename, data): filename = os.path.join(root_dir, filename) @@ -124,16 +89,11 @@ output = { } } -def run_gyp(args): - rc = gyp.main(args) - if rc != 0: - print 'Error running GYP' - sys.exit(rc) - if __name__ == '__main__': configure_llmr(output) configure_glfw3(output) configure_png(output) + configure_curl(output) pprint.pprint(output, indent=2) write('config.gypi', "# Do not edit. Generated by the configure script.\n" + @@ -146,13 +106,4 @@ if __name__ == '__main__': config = '\n'.join(map('='.join, config.iteritems())) + '\n' write('config.mk', - '# Do not edit. Generated by the configure script.\n' + config) - - gyp_args = [] - gyp_args.extend(['-f', 'make']) - gyp_args.append(os.path.join(os.path.abspath(root_dir), 'llmr.gyp')) - gyp_args.append('--depth=' + root_dir) - output_dir = os.path.join(os.path.abspath(root_dir), 'out') - gyp_args.extend(['--generator-output', output_dir]) - gyp_args.extend(['-Goutput_dir=' + output_dir]) - run_gyp(gyp_args) + '# Do not edit. Generated by the configure script.\n' + config)
\ No newline at end of file |