Skip to content

Commit

Permalink
sketch out configure support
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Aug 8, 2011
1 parent 13d685b commit f57d70d
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ _UpgradeReport_Files/
ipch/
*.sdf
*.opensdf

/options.gypi
97 changes: 81 additions & 16 deletions configure
Original file line number Diff line number Diff line change
@@ -1,21 +1,86 @@
#! /bin/sh
#!/usr/bin/env python

# v8 doesn't like ccache
if [ ! -z "`echo $CC | grep ccache`" ]; then
echo "Error: V8 doesn't like cache. Please set your CC env var to 'gcc'"
echo " (ba)sh: export CC=gcc"
exit 1
fi
import optparse
import os
import json

CUR_DIR=$PWD
root_dir = os.path.dirname(__file__)

#possible relative path
WORKINGDIR=`dirname $0`
cd "$WORKINGDIR"
#abs path
WORKINGDIR=`pwd`
cd "$CUR_DIR"
# parse our options
parser = optparse.OptionParser()

"${WORKINGDIR}/tools/waf-light" --jobs=1 configure $*
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 ''
}
}

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()

exit $?
6 changes: 6 additions & 0 deletions tools/gyp_node
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ def run_gyp(args):
if __name__ == '__main__':
args = sys.argv[1:]
args.append(os.path.join(script_dir, 'all.gyp'))

options_fn = os.path.abspath(os.path.join(node_root, 'options.gypi'))
if os.path.exists(options_fn):
args.extend(['-I', options_fn])

args.append('--depth=' + node_root)

if sys.platform != 'win32':
Expand All @@ -36,4 +41,5 @@ if __name__ == '__main__':
args.append('-Dcomponent=static_library')
args.append('-Dlibrary=static_library')
gyp_args = list(args)
print gyp_args
run_gyp(gyp_args)

0 comments on commit f57d70d

Please sign in to comment.