mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
111 lines
2.7 KiB
Python
Executable File
111 lines
2.7 KiB
Python
Executable File
#!/usr/bin/env python
|
|
|
|
import optparse
|
|
import os
|
|
import json
|
|
import sys
|
|
|
|
root_dir = os.path.dirname(__file__)
|
|
sys.path.insert(0, os.path.join(root_dir, 'deps', 'v8', 'tools'))
|
|
import utils # GuessArchitecture
|
|
|
|
def pkg_config(pkg):
|
|
cmd = os.popen('pkg-config --libs %s' % pkg, 'r')
|
|
libs = cmd.readline().strip()
|
|
ret = cmd.close()
|
|
if (ret): return 0
|
|
|
|
cmd = os.popen('pkg-config --cflags %s' % pkg, 'r')
|
|
cflags = cmd.readline().strip()
|
|
ret = cmd.close()
|
|
if (ret): return 0
|
|
|
|
return (libs, cflags)
|
|
|
|
# parse our options
|
|
parser = optparse.OptionParser()
|
|
|
|
parser.add_option("--debug", action="store_true", dest="debug",
|
|
default=False, help="Also build debug build")
|
|
|
|
parser.add_option("--prefix", action="store", dest="prefix",
|
|
help="Select the install prefix (defaults to /usr/local)")
|
|
|
|
|
|
# TODO options to support for backwards compatibility
|
|
#
|
|
# --without-snapshot
|
|
# Build without snapshotting V8 libraries. You might want to set this for
|
|
# cross-compiling. [Default: False]
|
|
#
|
|
# --without-ssl
|
|
# Build without SSL
|
|
#
|
|
# --shared-v8
|
|
# Link to a shared V8 DLL instead of static linking
|
|
#
|
|
# --shared-v8-includes=SHARED_V8_INCLUDES
|
|
# Directory containing V8 header files
|
|
#
|
|
# --shared-v8-libpath=SHARED_V8_LIBPATH
|
|
# A directory to search for the shared V8 DLL
|
|
#
|
|
# --shared-v8-libname=SHARED_V8_LIBNAME
|
|
# Alternative lib name to link to (default: 'v8')
|
|
#
|
|
# --openssl-includes=OPENSSL_INCLUDES
|
|
# A directory to search for the OpenSSL includes
|
|
#
|
|
# --openssl-libpath=OPENSSL_LIBPATH
|
|
# A directory to search for the OpenSSL libraries
|
|
#
|
|
# --no-ssl2
|
|
# Disable OpenSSL v2
|
|
#
|
|
# --gdb
|
|
# add gdb support
|
|
#
|
|
# --shared-cares
|
|
# Link to a shared C-Ares DLL instead of static linking
|
|
#
|
|
# --shared-cares-includes=SHARED_CARES_INCLUDES
|
|
# Directory containing C-Ares header files
|
|
#
|
|
# --shared-cares-libpath=SHARED_CARES_LIBPATH
|
|
# A directory to search for the shared C-Ares DLL
|
|
#
|
|
# --with-dtrace
|
|
# Build with DTrace (experimental)
|
|
#
|
|
# --dest-cpu=DEST_CPU
|
|
# CPU architecture to build for. Valid values are: arm, ia32, x64
|
|
|
|
|
|
(options, args) = parser.parse_args()
|
|
|
|
print "configure options:", options
|
|
|
|
output = {
|
|
'variables': {
|
|
'node_debug': 'true' if options.debug else 'false',
|
|
'node_prefix': options.prefix if options.prefix else ''
|
|
}
|
|
}
|
|
|
|
out = pkg_config('openssl')
|
|
if out:
|
|
output['variables']['node_use_openssl'] = 'true'
|
|
output['variables']['openssl_libs'] = '-lssl -lcrypto -lz' #out[0]
|
|
output['variables']['openssl_cflags'] = out[1]
|
|
|
|
|
|
fn = os.path.join(root_dir, 'options.gypi')
|
|
print "creating ", fn
|
|
|
|
f = open(fn, 'w+')
|
|
f.write("# Do not edit. Generated by the configure script.\n")
|
|
json.dump(output, f, indent=2, skipkeys=True)
|
|
f.write("\n")
|
|
f.close()
|
|
|