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
Родитель 4b9a084bf4
Коммит f00a2cb279
8 изменённых файлов: 171 добавлений и 54 удалений

Просмотреть файл

@ -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@

Просмотреть файл

@ -4379,7 +4379,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=
@ -4472,7 +4471,6 @@ basic)
NECKO_SMALL_BUFFERS=1
NS_DISABLE_LOGGING=1
NS_PRINTING=
JS_STATIC_BUILD=1
;;
minimal)
@ -4520,7 +4518,6 @@ minimal)
NECKO_SMALL_BUFFERS=1
NS_DISABLE_LOGGING=1
NS_PRINTING=
JS_STATIC_BUILD=1
;;
*)
@ -7187,25 +7184,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

Просмотреть файл

@ -52,15 +52,18 @@ ifndef JS_MOZ_INSTALL
NSDISTMODE = copy
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
@ -100,10 +103,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
ifeq (86,$(findstring 86,$(OS_TEST)))
ifeq (64,$(findstring 64,$(OS_TEST)))
@ -615,20 +620,22 @@ install:: $(INSTALLED_HEADERS)
install:: $(SCRIPTS) $(PROGRAM)
$(INSTALL) $(IFLAGS2) $^ $(bindir)
install:: $(LIBRARY)
ifneq (,$(LIBRARY))
$(INSTALL) $(IFLAGS1) $(LIBRARY) $(libdir)
endif
ifneq (,$(IMPORT_LIBRARY))
$(INSTALL) $(IFLAGS2) $(IMPORT_LIBRARY) $(libdir)
endif
# The Mozilla top-level makefiles use install-runtime-libs directly to
# place an additional copy of the libraries in the 'dist/bin'
# directory.
install:: install-runtime-libs
install-runtime-libs:: $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY)
ifneq (,$(LIBRARY))
$(INSTALL) $(IFLAGS1) $(LIBRARY) $(libdir)
endif
ifneq (,$(SHARED_LIBRARY))
$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(libdir)
endif
ifneq (,$(IMPORT_LIBRARY))
$(INSTALL) $(IFLAGS2) $(IMPORT_LIBRARY) $(libdir)
endif
# Extra dependancies and rules for auto-generated headers
host_jskwgen.$(OBJ_SUFFIX): jsversion.h jskeyword.tbl

Просмотреть файл

@ -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

Просмотреть файл

@ -3808,7 +3808,6 @@ MOZ_ARG_HEADER(Application)
BUILD_STATIC_LIBS=
ENABLE_TESTS=1
MOZ_DBGRINFO_MODULES=
JS_STATIC_BUILD=
dnl ========================================================
dnl =
@ -4746,23 +4745,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)
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
JS_NATIVE_EDITLINE=
EDITLINE_LIBS=
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 =
@ -5147,11 +5156,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

Просмотреть файл

@ -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
Просмотреть файл

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

Просмотреть файл