bug 462004 - JavaScript shell should provide line editing facilities. r=bsmedberg

--HG--
rename : js/src/js.cpp => js/src/shell/js.cpp
This commit is contained in:
Ted Mielczarek 2008-12-03 08:55:27 -05:00
parent 8370a127e4
commit 68f2eb86cc
8 changed files with 167 additions and 51 deletions

View File

@ -132,7 +132,6 @@ MOZ_USE_NATIVE_UCONV = @MOZ_USE_NATIVE_UCONV@
MOZ_BRANDING_DIRECTORY = @MOZ_BRANDING_DIRECTORY@
XPCOM_USE_LEA = @XPCOM_USE_LEA@
JS_ULTRASPARC_OPTS = @JS_ULTRASPARC_OPTS@
JS_STATIC_BUILD = @JS_STATIC_BUILD@
MOZ_ENABLE_POSTSCRIPT = @MOZ_ENABLE_POSTSCRIPT@
MOZ_INSTALLER = @MOZ_INSTALLER@
MOZ_UPDATER = @MOZ_UPDATER@

View File

@ -4381,7 +4381,6 @@ NECKO_COOKIES=1
NECKO_DISK_CACHE=1
NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource"
NECKO_SMALL_BUFFERS=
JS_STATIC_BUILD=
XPC_IDISPATCH_SUPPORT=
@ -4474,7 +4473,6 @@ basic)
NECKO_SMALL_BUFFERS=1
NS_DISABLE_LOGGING=1
NS_PRINTING=
JS_STATIC_BUILD=1
;;
minimal)
@ -4522,7 +4520,6 @@ minimal)
NECKO_SMALL_BUFFERS=1
NS_DISABLE_LOGGING=1
NS_PRINTING=
JS_STATIC_BUILD=1
;;
*)
@ -7218,25 +7215,6 @@ else
XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
fi
dnl ========================================================
dnl = Force JS to be a static lib
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(js-static-build,
[ --enable-js-static-build Force js to be a static lib],
JS_STATIC_BUILD=1,
JS_STATIC_BUILD= )
AC_SUBST(JS_STATIC_BUILD)
if test -n "$JS_STATIC_BUILD"; then
AC_DEFINE(EXPORT_JS_API)
if test -z "$BUILD_STATIC_LIBS"; then
AC_MSG_ERROR([--enable-js-static-build is only compatible with --enable-static])
fi
fi
dnl ========================================================
dnl =
dnl = Standalone module options

View File

@ -49,15 +49,18 @@ ifdef DEHYDRA_PATH
DIRS += analysis-tests
endif
MODULE = js
LIBRARY_NAME = mozjs
GRE_MODULE = 1
ifdef JS_NATIVE_EDITLINE
DIRS += editline
endif
# editline needs to get built before the shell
DIRS += shell
MODULE = js
LIBRARY_NAME = mozjs
STATIC_LIBRARY_NAME = js_static
GRE_MODULE = 1
PROGRAM = js$(BIN_SUFFIX)
# The shell uses some 'HIDDEN' symbols to produce statistics, so we
# link directly against the .o files, not against the JS shared
# library.
PROGOBJS = js.$(OBJ_SUFFIX) $(OBJS)
LIBS = $(NSPR_LIBS)
ifdef GNU_CXX
@ -97,10 +100,12 @@ endif
# other modules which are always built shared. Failure to do so results in
# the js code getting copied into xpinstall and jsd as well as mozilla-bin,
# and then the static data cells used for locking no longer work.
#
# In fact, we now build both a static and a shared library, as the
# JS shell would like to link to the static library.
ifndef JS_STATIC_BUILD
FORCE_SHARED_LIB = 1
endif
FORCE_STATIC_LIB = 1
VPATH = $(srcdir)
@ -234,9 +239,7 @@ CPPSRCS += \
ifdef DEBUG
CPPSRCS += TraceTreeDrawer.cpp
endif
DEFINES += -DFEATURE_NANOJIT -DJS_TRACER
endif
endif # ENABLE_JIT
ifdef HAVE_DTRACE
INSTALLED_HEADERS += \

View File

@ -106,7 +106,6 @@ MACOSX_DEPLOYMENT_TARGET = @MACOSX_DEPLOYMENT_TARGET@
BUILD_STATIC_LIBS = @BUILD_STATIC_LIBS@
ENABLE_TESTS = @ENABLE_TESTS@
JS_ULTRASPARC_OPTS = @JS_ULTRASPARC_OPTS@
JS_STATIC_BUILD = @JS_STATIC_BUILD@
TAR=@TAR@
@ -269,6 +268,9 @@ NSPR_LIBS = @NSPR_LIBS@
USE_DEPENDENT_LIBS = @USE_DEPENDENT_LIBS@
JS_NATIVE_EDITLINE = @JS_NATIVE_EDITLINE@
EDITLINE_LIBS = @EDITLINE_LIBS@
# MKSHLIB_FORCE_ALL is used to force the linker to include all object
# files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker
# to normal behavior. Makefile's that create shared libraries out of

View File

@ -2479,6 +2479,9 @@ MOZ_ARG_DISABLE_BOOL(jit,
if test "$ENABLE_JIT"; then
AC_DEFINE(FEATURE_NANOJIT)
AC_DEFINE(JS_TRACER)
case "$target" in
i?86-*)
AC_DEFINE(AVMPLUS_IA32)
@ -3891,7 +3894,6 @@ MOZ_ARG_HEADER(Application)
BUILD_STATIC_LIBS=
ENABLE_TESTS=1
MOZ_DBGRINFO_MODULES=
JS_STATIC_BUILD=
dnl ========================================================
dnl =
@ -4840,23 +4842,33 @@ MOZ_ARG_ENABLE_BOOL(static,
BUILD_STATIC_LIBS=)
dnl ========================================================
dnl = Force JS to be a static lib
dnl = Link js shell to system readline
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(js-static-build,
[ --enable-js-static-build Force js to be a static lib],
JS_STATIC_BUILD=1,
JS_STATIC_BUILD= )
MOZ_ARG_ENABLE_BOOL(readline,
[ --enable-readline Link js shell to system readline library],
JS_WANT_READLINE=1,
JS_WANT_READLINE= )
AC_SUBST(JS_STATIC_BUILD)
JS_NATIVE_EDITLINE=
EDITLINE_LIBS=
if test -n "$JS_STATIC_BUILD"; then
AC_DEFINE(EXPORT_JS_API)
if test -z "$BUILD_STATIC_LIBS"; then
AC_MSG_ERROR([--enable-js-static-build is only compatible with --enable-static])
fi
dnl Conveniently, Win32 sets SKIP_LIBRARY_CHECKS...
if test -z "$SKIP_LIBRARY_CHECKS"; then
if test -n "$JS_WANT_READLINE"; then
AC_CHECK_LIB(readline, readline,
EDITLINE_LIBS="-lreadline",
AC_MSG_ERROR([No system readline library found.]))
else
dnl By default, we use editline
JS_NATIVE_EDITLINE=1
EDITLINE_LIBS='$(DEPTH)/editline/$(LIB_PREFIX)editline.$(LIB_SUFFIX)'
fi
dnl Either way, we want to build with line editing support.
AC_DEFINE(EDITLINE)
fi
AC_SUBST(JS_NATIVE_EDITLINE)
AC_SUBST(EDITLINE_LIBS)
dnl ========================================================
dnl =
@ -5241,11 +5253,18 @@ mv confdefs.h.save confdefs.h
MAKEFILES="
Makefile
shell/Makefile
config/Makefile
config/autoconf.mk
config/mkdepend/Makefile
"
if test -n "$JS_NATIVE_EDITLINE"; then
MAKEFILES="$MAKEFILES
editline/Makefile
"
fi
dnl
dnl Run a perl script to quickly create the makefiles.
dnl If it succeeds, it outputs a shell command to set CONFIG_FILES

View File

@ -0,0 +1,55 @@
# -*- Mode: makefile -*-
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Spidermonkey build system.
#
# The Initial Developer of the Original Code is
# The Mozilla Foundation.
# Portions created by the Initial Developer are Copyright (C) 2008
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Ted Mielczarek <ted.mielczarek@gmail.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = editline
FORCE_STATIC_LIB = 1
CSRCS = editline.c sysunix.c
DEFINES += -DANSI_ARROWS -DHAVE_TCGETATTR -DHIDE -DUSE_DIRENT -DSYS_UNIX \
-DHAVE_STDLIB -DUNIQUE_HISTORY
include $(topsrcdir)/config/rules.mk

60
js/src/shell/Makefile.in Normal file
View File

@ -0,0 +1,60 @@
# -*- Mode: makefile -*-
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Spidermonkey build system.
#
# The Initial Developer of the Original Code is
# The Mozilla Foundation.
# Portions created by the Initial Developer are Copyright (C) 2008
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Ted Mielczarek <ted.mielczarek@gmail.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
PROGRAM = js$(BIN_SUFFIX)
CPPSRCS = js.cpp
DEFINES += -DEXPORT_JS_API
LIBS = $(NSPR_LIBS) $(EDITLINE_LIBS) $(DEPTH)/$(LIB_PREFIX)js_static.$(LIB_SUFFIX)
LOCAL_INCLUDES += -I$(topsrcdir) -I..
include $(topsrcdir)/config/rules.mk
# People expect the js shell to wind up in the top-level JS dir.
libs::
$(INSTALL) $(IFLAGS2) $(PROGRAM) $(DEPTH)