blob: a0ee4c1286aa17205af0c9dbc3322e287904e511 [file] [log] [blame]
diff --git a/Makefile.in b/Makefile.in
--- a/Makefile.in
+++ b/Makefile.in
@@ -280,7 +280,8 @@ COPYDESTS = $(DESTDIR)${etcdir} $(DESTDIR)${lispdir} $(DESTDIR)${leimdir}/ja-dic
all: ${SUBDIR}
-.PHONY: all ${SUBDIR} blessmail epaths-force FRC
+#.PHONY: all ${SUBDIR} blessmail epaths-force FRC
+.PHONY: all ${SUBDIR} epaths-force FRC
removenullpaths=sed -e 's/^://g' -e 's/:$$//g' -e 's/::/:/g'
@@ -415,7 +416,8 @@ $(srcdir)/src/stamp-h.in: $(AUTOCONF_INPUTS)
## don't have to duplicate the list of utilities to install in
## this Makefile as well.
-install: all install-arch-indep install-doc install-arch-dep blessmail
+#install: all install-arch-indep install-doc install-arch-dep blessmail
+install: all install-arch-indep install-doc install-arch-dep
@true
## Ensure that $subdir contains a subdirs.el file.
diff --git a/configure b/configure
--- a/configure
+++ b/configure
@@ -4631,6 +4631,10 @@ case "${canonical}" in
esac
;;
+ *-nacl )
+ opsys=nacl
+ ;;
+
## Intel 386 machines where we don't care about the manufacturer.
i[3456]86-*-* )
case "${canonical}" in
@@ -8206,6 +8210,7 @@ rm -f core conftest.err conftest.$ac_objext \
test "x$CANNOT_DUMP" = "x" && CANNOT_DUMP=no
case "$opsys" in
+ nacl) CANNOT_DUMP=yes ;;
your-opsys-here) CANNOT_DUMP=yes ;;
esac
@@ -9828,6 +9833,7 @@ system_malloc=no
case "$opsys" in
## darwin ld insists on the use of malloc routines in the System framework.
darwin|sol2-10) system_malloc=yes ;;
+ nacl) system_malloc=yes ;;
esac
if test "${system_malloc}" = "yes"; then
@@ -15169,7 +15175,7 @@ esac
emacs_broken_SIGIO=no
case $opsys in
- hpux* | irix6-5 | openbsd | sol2* | unixware )
+ hpux* | irix6-5 | openbsd | sol2* | unixware)
emacs_broken_SIGIO=yes
;;
@@ -15179,6 +15185,13 @@ $as_echo "#define BROKEN_GET_CURRENT_DIR_NAME 1" >>confdefs.h
;;
+ nacl)
+
+ emacs_broken_SIGIO=yes
+$as_echo "#define BROKEN_GET_CURRENT_DIR_NAME 1" >>confdefs.h
+
+ ;;
+
freebsd)
$as_echo "#define BROKEN_PTY_READ_AFTER_EAGAIN 1" >>confdefs.h
@@ -15277,7 +15290,7 @@ case $opsys in
;;
- gnu-linux | gnu-kfreebsd | freebsd | netbsd )
+ nacl | gnu-linux | gnu-kfreebsd | freebsd | netbsd )
if test "x$ac_cv_func_grantpt" = xyes; then
$as_echo "#define UNIX98_PTYS 1" >>confdefs.h
@@ -15430,7 +15443,7 @@ if test $emacs_glibc = yes; then
emacs_pending_output=unknown
case $opsys in
- gnu | gnu-linux | gnu-kfreebsd )
+ nacl | gnu | gnu-linux | gnu-kfreebsd )
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of pending output formalism" >&5
$as_echo_n "checking for style of pending output formalism... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -15929,7 +15942,7 @@ if ${emacs_cv_usable_FIONREAD+:} false; then :
$as_echo_n "(cached) " >&6
else
case $opsys in
- aix4-2)
+ aix4-2 | nacl)
emacs_cv_usable_FIONREAD=no
;;
@@ -24659,7 +24672,7 @@ LD_FIRSTFLAG=
ORDINARY_LINK=
case "$opsys" in
## gnu: GNU needs its own crt0.
- aix4-2|cygwin|darwin|gnu|hpux*|irix6-5|sol2*|unixware) ORDINARY_LINK=yes ;;
+ nacl|aix4-2|cygwin|darwin|gnu|hpux*|irix6-5|sol2*|unixware) ORDINARY_LINK=yes ;;
## On post 1.3 releases of NetBSD, gcc -nostdlib also clears the
## library search parth, i.e. it won't search /usr/lib for libc and
diff --git a/leim/Makefile.in b/leim/Makefile.in
--- a/leim/Makefile.in
+++ b/leim/Makefile.in
@@ -28,10 +28,13 @@ SHELL = /bin/sh
# Here are the things that we expect ../configure to edit.
srcdir=@srcdir@
+top_srcdir = @top_srcdir@
+abs_top_builddir = @abs_top_builddir@
+EXEEXT = @EXEEXT@
# Which Emacs to use to convert TIT files to Emacs Lisp files,
# byte-compile Emacs Lisp files, and generate the file leim-list.el.
-EMACS = ../src/emacs
+EMACS = ${abs_top_builddir}/src/emacs${EXEEXT}
buildlisppath=${srcdir}/../lisp
diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in
--- a/lib-src/Makefile.in
+++ b/lib-src/Makefile.in
@@ -23,7 +23,7 @@
SHELL = /bin/sh
# Following ../lisp/Makefile.in.
-EMACS = ../src/emacs
+EMACS = ../src/emacs${EXEEXT}
EMACSOPT = -batch --no-site-file --no-site-lisp
# ==================== Things `configure' will edit ====================
@@ -183,7 +183,8 @@ config_h = ../src/config.h $(srcdir)/../src/conf_post.h
all: ${EXE_FILES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
-.PHONY: all need-blessmail maybe-blessmail
+#.PHONY: all need-blessmail maybe-blessmail
+.PHONY: all
LOADLIBES = ../lib/libgnu.a $(LIBS_SYSTEM)
$(EXE_FILES): ../lib/libgnu.a
@@ -290,8 +291,8 @@ TAGS: etags${EXEEXT}
## distribute Emacs. If they were clobbered, all the .elc files were
## clobbered too.
test-distrib${EXEEXT}: ${srcdir}/test-distrib.c
- $(CC) ${ALL_CFLAGS} -o test-distrib ${srcdir}/test-distrib.c
- ./test-distrib ${srcdir}/testfile
+ $(CC) ${ALL_CFLAGS} -o test-distrib${EXEEXT} ${srcdir}/test-distrib.c
+ $(RUNPROGRAM) -- ./test-distrib${EXEEXT} ${srcdir}/testfile
../lib/libgnu.a: $(config_h)
cd ../lib && $(MAKE) libgnu.a
@@ -303,30 +304,30 @@ regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h $(config_h)
etags${EXEEXT}: ${srcdir}/etags.c regex.o $(config_h)
$(CC) ${ALL_CFLAGS} -DEMACS_NAME="\"GNU Emacs\"" \
-DVERSION="\"${version}\"" ${srcdir}/etags.c \
- regex.o $(LOADLIBES) -o etags
+ regex.o $(LOADLIBES) -o etags${EXEEXT}
ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ${srcdir}/../lib/min-max.h $(config_h)
$(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" \
- ${srcdir}/ebrowse.c $(LOADLIBES) -o ebrowse
+ ${srcdir}/ebrowse.c $(LOADLIBES) -o ebrowse${EXEEXT}
## We depend on etags to assure that parallel makes do not write two
## etags.o files on top of each other.
ctags${EXEEXT}: etags${EXEEXT}
$(CC) ${ALL_CFLAGS} -DCTAGS -DEMACS_NAME="\"GNU Emacs\"" \
-DVERSION="\"${version}\"" ${srcdir}/etags.c \
- regex.o $(LOADLIBES) -o ctags
+ regex.o $(LOADLIBES) -o ctags${EXEEXT}
profile${EXEEXT}: ${srcdir}/profile.c $(config_h)
$(CC) ${ALL_CFLAGS} ${srcdir}/profile.c \
- $(LOADLIBES) $(LIB_CLOCK_GETTIME) -o profile
+ $(LOADLIBES) $(LIB_CLOCK_GETTIME) -o profile${EXEEXT}
make-docfile${EXEEXT}: ${srcdir}/make-docfile.c $(config_h)
$(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) \
- -o make-docfile
+ -o make-docfile${EXEEXT}
movemail${EXEEXT}: ${srcdir}/movemail.c pop.o $(config_h)
$(CC) ${ALL_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c pop.o \
- $(LOADLIBES) $(LIBS_MOVE) -o movemail
+ $(LOADLIBES) $(LIBS_MOVE) -o movemail${EXEEXT} ${COMPAT_LIBS}
pop.o: ${srcdir}/pop.c ${srcdir}/../lib/min-max.h $(config_h)
$(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c
@@ -334,13 +335,13 @@ pop.o: ${srcdir}/pop.c ${srcdir}/../lib/min-max.h $(config_h)
emacsclient${EXEEXT}: ${srcdir}/emacsclient.c $(config_h)
$(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c \
-DVERSION="\"${version}\"" \
- $(LOADLIBES) -o emacsclient
+ $(LOADLIBES) -o emacsclient${EXEEXT} ${COMPAT_LIBS}
hexl${EXEEXT}: ${srcdir}/hexl.c $(config_h)
- $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl
+ $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl${EXEEXT}
update-game-score${EXEEXT}: ${srcdir}/update-game-score.c $(config_h)
$(CC) ${ALL_CFLAGS} -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \
- ${srcdir}/update-game-score.c $(LOADLIBES) -o update-game-score
+ ${srcdir}/update-game-score.c $(LOADLIBES) -o update-game-score${EXEEXT}
## Makefile ends here.
diff --git a/lib-src/profile.c b/lib-src/profile.c
--- a/lib-src/profile.c
+++ b/lib-src/profile.c
@@ -37,7 +37,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <stdio.h>
#include <intprops.h>
-#include <systime.h>
+#include "systime.h"
static EMACS_TIME TV1;
static int watch_not_started = 1; /* flag */
diff --git a/lib/getopt.in.h b/lib/getopt.in.h
--- a/lib/getopt.in.h
+++ b/lib/getopt.in.h
@@ -16,6 +16,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#if !defined(NACL_SKIP_GETOPT)
#ifndef _@GUARD_PREFIX@_GETOPT_H
#if __GNUC__ >= 3
@@ -251,3 +252,4 @@ extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv,
#endif /* _@GUARD_PREFIX@_GETOPT_H */
#endif /* _@GUARD_PREFIX@_GETOPT_H */
+#endif
diff --git a/lib/symlink.c b/lib/symlink.c
--- a/lib/symlink.c
+++ b/lib/symlink.c
@@ -24,6 +24,7 @@
#include <sys/stat.h>
+#undef HAVE_SYMLINK
#if HAVE_SYMLINK
# undef symlink
diff --git a/lisp/Makefile.in b/lisp/Makefile.in
--- a/lisp/Makefile.in
+++ b/lisp/Makefile.in
@@ -21,6 +21,7 @@ SHELL = /bin/sh
srcdir = @srcdir@
top_srcdir = @top_srcdir@
abs_top_builddir = @abs_top_builddir@
+EXEEXT = @EXEEXT@
lisp = $(srcdir)
VPATH = $(srcdir)
@@ -30,7 +31,7 @@ VPATH = $(srcdir)
# We sometimes change directory before running Emacs (typically when
# building out-of-tree, we chdir to the source directory), so we need
# to use an absolute file name.
-EMACS = ${abs_top_builddir}/src/emacs
+EMACS = ${abs_top_builddir}/src/emacs${EXEEXT}
# Command line flags for Emacs.
diff --git a/lisp/files.el b/lisp/files.el
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1098,7 +1098,8 @@ containing it, until no links are left at any level.
(while (not done)
(setcar counter (1- (car counter)))
(if (< (car counter) 0)
- (error "Apparent cycle of symbolic links for %s" filename))
+ ;;(error "Apparent cycle of symbolic links for %s" filename))
+ (setq done t))
(let ((handler (find-file-name-handler filename 'file-truename)))
;; For file name that has a special handler, call handler.
;; This is so that ange-ftp can save time by doing a no-op.
@@ -1117,10 +1118,14 @@ containing it, until no links are left at any level.
;; save time--don't recalculate.
(if (assoc dir (car prev-dirs))
(setq dir (cdr (assoc dir (car prev-dirs))))
- (let ((old dir)
- (new (file-name-as-directory (file-truename dirfile counter prev-dirs))))
- (setcar prev-dirs (cons (cons old new) (car prev-dirs)))
- (setq dir new))))
+ ;; Otherwise, we don't have a cached dir, check for . and ..
+ ;; then recurse we don't have . or ..
+ (if (not (or (equal ".." (file-name-nondirectory filename))
+ (equal "." (file-name-nondirectory filename))))
+ (let ((old dir)
+ (new (file-name-as-directory (file-truename dirfile counter prev-dirs))))
+ (setcar prev-dirs (cons (cons old new) (car prev-dirs)))
+ (setq dir new)))))
(if (equal ".." (file-name-nondirectory filename))
(setq filename
(directory-file-name (file-name-directory (directory-file-name dir)))
diff --git a/lisp/loadup.el b/lisp/loadup.el
--- a/lisp/loadup.el
+++ b/lisp/loadup.el
@@ -68,7 +68,7 @@
;; Hash consing saved around 11% of pure space in my tests.
(setq purify-flag (make-hash-table :test 'equal :size 70000)))
-(message "Using load-path %s" load-path)
+;; (message "Using load-path %s" load-path)
(if (or (member (nth 3 command-line-args) '("dump" "bootstrap"))
(member (nth 4 command-line-args) '("dump" "bootstrap")))
diff --git a/lisp/shell.el b/lisp/shell.el
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -292,10 +292,11 @@ Value is a list of strings, which may be nil."
(if (and (not purify-flag)
(equal name "bash")
(file-executable-p prog)
- (string-match "bad option"
+ (and (not (equal system-type 'nacl))
+ (string-match "bad option"
(shell-command-to-string
(concat (shell-quote-argument prog)
- " --noediting"))))
+ " --noediting")))))
'("-i")
'("--noediting" "-i")))
"Args passed to inferior shell by \\[shell], if the shell is bash.
diff --git a/lisp/startup.el b/lisp/startup.el
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1004,7 +1004,7 @@ Amongst another things, it parses the command-line arguments."
;; even if invoked with "-u USER", or
;; if $USER or $LOGNAME are set to
;; something different.
- (if (memq system-type '(windows-nt ms-dos))
+ (if (memq system-type '(windows-nt ms-dos nacl))
"~"
(concat "~" init-file-user))))
nil
@@ -1031,6 +1031,7 @@ Amongst another things, it parses the command-line arguments."
(cond
((eq system-type 'ms-dos)
(concat "~" init-file-user "/_emacs"))
+ ((eq system-type 'nacl) "~/.emacs")
((not (eq system-type 'windows-nt))
(concat "~" init-file-user "/.emacs"))
;; Else deal with the Windows situation
@@ -1052,13 +1053,20 @@ Amongst another things, it parses the command-line arguments."
(when (eq user-init-file t)
;; If we did not find ~/.emacs, try
- ;; ~/.emacs.d/init.el.
+ ;; ~<user>/.emacs.d/init.el.
(let ((otherfile
(expand-file-name
"init"
(file-name-as-directory
- (concat "~" init-file-user "/.emacs.d")))))
- (load otherfile t t)
+ (concat "~" init-file-user "/.emacs.d"))))
+ ;; NaCl cannot expand ~<user>, just use '~'
+ (otherfile-nacl
+ (expand-file-name
+ "init"
+ (file-name-as-directory "~/.emacs.d"))))
+ (if (eq system-type 'nacl)
+ (load otherfile-nacl t t)
+ (load otherfile t t))
;; If we did not find the user's init file,
;; set user-init-file conclusively.
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -164,12 +164,12 @@ matching the resulting Git log output, and KEYWORDS is a list of
;;; STATE-QUERYING FUNCTIONS
-;;;###autoload (defun vc-git-registered (file)
-;;;###autoload "Return non-nil if FILE is registered with git."
-;;;###autoload (if (vc-find-root file ".git") ; Short cut.
-;;;###autoload (progn
-;;;###autoload (load "vc-git")
-;;;###autoload (vc-git-registered file))))
+;;;###autonotload (defun vc-git-registered (file)
+;;;###autonotload "Return non-nil if FILE is registered with git."
+;;;###autonotload (if (vc-find-root file ".git") ; Short cut.
+;;;###autonotload (progn
+;;;###autonotload (load "vc-git")
+;;;###autonotload (vc-git-registered file))))
(defun vc-git-registered (file)
"Check whether FILE is registered with git."
diff --git a/lisp/window.el b/lisp/window.el
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -4001,7 +4001,10 @@ right, if any."
(let ((quit-restore (window-parameter old-window 'quit-restore)))
(when quit-restore
(set-window-parameter new-window 'quit-restore quit-restore)))
- new-window))
+ new-window)
+ ;; To workaround drawing issues with NaCl terminals, redraw now.
+ (if (equal system-type 'nacl)
+ (redraw-display)))
(defalias 'split-window-horizontally 'split-window-right)
diff --git a/src/Makefile.in b/src/Makefile.in
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -284,11 +284,13 @@ LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
LIB_PTHREAD_SIGMASK = @LIB_PTHREAD_SIGMASK@
+NACL_LIBS = ${EXTRA_LIBS}
+
INTERVALS_H = dispextern.h intervals.h composite.h
GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
-RUN_TEMACS = `/bin/pwd`/temacs
+RUN_TEMACS = $(RUNPROGRAM) -- `/bin/pwd`/temacs
UNEXEC_OBJ = @UNEXEC_OBJ@
@@ -328,6 +330,22 @@ ALL_OBJC_CFLAGS=$(ALL_CFLAGS) $(GNU_OBJC_CFLAGS)
@$(MKDEPDIR)
$(CC) -c $(CPPFLAGS) $(ALL_OBJC_CFLAGS) $<
+nacl_emacs.o: emacs.c
+ @$(MKDEPDIR)
+ $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< -DNACL_EMACS -o $@
+
+nacl_process.o: process.c
+ @$(MKDEPDIR)
+ $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< -DNACL_EMACS -o $@
+
+nacl_callproc.o: callproc.c
+ @$(MKDEPDIR)
+ $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< -DNACL_EMACS -o $@
+
+nacl_sysdep.o: sysdep.c
+ @$(MKDEPDIR)
+ $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< -DNACL_EMACS -o $@
+
## lastfile must follow all files whose initialized data areas should
## be dumped as pure by dump-emacs.
@@ -346,9 +364,29 @@ base_obj = dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \
doprnt.o intervals.o textprop.o composite.o xml.o \
profiler.o \
$(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) \
- $(W32_OBJ) $(WINDOW_SYSTEM_OBJ)
+ $(W32_OBJ) $(WINDOW_SYSTEM_OBJ) -lnacl_io
obj = $(base_obj) $(NS_OBJC_OBJ)
+## Just like $(obj), but includes nacl_emacs.o (built with NACL_EMACS) instead
+## of emacs.o, and also includes emacs_pepper.o
+nacl_obj = dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \
+ charset.o coding.o category.o ccl.o character.o chartab.o bidi.o \
+ cm.o term.o terminal.o xfaces.o $(XOBJ) $(GTK_OBJ) $(DBUS_OBJ) \
+ nacl_emacs.o keyboard.o macros.o keymap.o nacl_sysdep.o \
+ buffer.o filelock.o insdel.o marker.o \
+ minibuf.o fileio.o dired.o \
+ cmds.o casetab.o casefiddle.o indent.o search.o regex.o undo.o \
+ alloc.o data.o doc.o editfns.o callint.o \
+ eval.o floatfns.o fns.o font.o print.o lread.o \
+ syntax.o $(UNEXEC_OBJ) bytecode.o \
+ nacl_process.o gnutls.o nacl_callproc.o \
+ region-cache.o sound.o atimer.o \
+ doprnt.o intervals.o textprop.o composite.o xml.o \
+ profiler.o \
+ emacs_pepper.o \
+ $(WINDOW_SYSTEM_OBJ) $(FONT_OBJ) \
+ $(NS_OBJC_OBJ)
+
## Object files used on some machine or other.
## These go in the DOC file on all machines in case they are needed.
## Some of them have no DOC entries, but it does no harm to have them
@@ -400,9 +438,10 @@ LIBES = $(LIBS) $(W32_LIBS) $(LIBS_GNUSTEP) $(LIBX_BASE) $(LIBIMAGE) \
$(LIBGNUTLS_LIBS) $(LIB_PTHREAD) $(LIB_PTHREAD_SIGMASK) \
$(LIB_GCC) $(LIB_MATH) $(LIB_STANDARD) $(LIB_GCC)
-all: emacs$(EXEEXT) $(OTHER_FILES)
+all: emacs$(EXEEXT) $(OTHER_FILES) nacl_temacs$(EXEEXT)
.PHONY: all
+#$(leimdir)/leim-list.el: bootstrap-emacs$(EXEEXT) temacs$(EXEEXT)
$(leimdir)/leim-list.el: bootstrap-emacs$(EXEEXT)
cd $(leimdir) && $(MAKE) $(MFLAGS) leim-list.el EMACS=$(bootstrap_exe)
@@ -414,7 +453,12 @@ $(leimdir)/leim-list.el: bootstrap-emacs$(EXEEXT)
emacs$(EXEEXT): temacs$(EXEEXT) $(etc)/DOC $(lisp) $(leimdir)/leim-list.el
if test "$(CANNOT_DUMP)" = "yes"; then \
rm -f emacs$(EXEEXT); \
- ln temacs$(EXEEXT) emacs$(EXEEXT); \
+ echo "#!/bin/bash" > emacs$(EXEEXT); \
+ echo 'EMACSLOADPATH=$${EMACSLOADPATH} \\' >> emacs$(EXEEXT); \
+ echo "$(RUNPROGRAM) -p \\" >> emacs$(EXEEXT); \
+ echo "$(RUNPROGRAM_ARGS) -- $(PWD)/temacs$(EXEEXT) \\" >> emacs$(EXEEXT); \
+ echo ' "$$@"' >> emacs$(EXEEXT); \
+ chmod a+x emacs$(EXEEXT); \
else \
LC_ALL=C $(RUN_TEMACS) -batch -l loadup dump || exit 1; \
test "X$(PAXCTL)" = X || $(PAXCTL) -zex emacs$(EXEEXT); \
@@ -438,8 +482,8 @@ emacs$(EXEEXT): temacs$(EXEEXT) $(etc)/DOC $(lisp) $(leimdir)/leim-list.el
##
$(etc)/DOC: $(libsrc)/make-docfile$(EXEEXT) $(obj) $(lisp)
-rm -f $(etc)/DOC
- $(libsrc)/make-docfile -d $(srcdir) $(SOME_MACHINE_OBJECTS) $(obj) > $(etc)/DOC
- $(libsrc)/make-docfile -a $(etc)/DOC -d $(lispsource) `sed -n -e 's| \\\\||' -e 's|^[ ]*$$(lispsource)/||p' $(srcdir)/lisp.mk`
+ cd $(srcdir) $(RUNPROGRAM) -- ${PWD}/$(libsrc)/make-docfile$(EXEEXT) $(SOME_MACHINE_OBJECTS) ${PWD}/$(obj) > ${PWD}/$(etc)/DOC
+ cd $(libspsource) && $(RUNPROGRAM) -- ${PWD}/$(libsrc)/make-docfile$(EXEEXT) -a ${PWD}/$(etc)/DOC `sed -n -e 's| \\\\||' -e 's|^[ ]*$$(lispsource)/||p' ${PWD}/$(srcdir)/lisp.mk`
$(libsrc)/make-docfile$(EXEEXT):
cd $(libsrc); $(MAKE) $(MFLAGS) make-docfile$(EXEEXT)
@@ -453,7 +497,7 @@ GLOBAL_SOURCES = $(base_obj:.o=.c) $(NS_OBJC_OBJ:.o=.m)
gl-stamp: $(libsrc)/make-docfile$(EXEEXT) $(GLOBAL_SOURCES)
@rm -f gl-tmp
- $(libsrc)/make-docfile -d $(srcdir) -g $(obj) > gl-tmp
+ cd $(srcdir) && $(RUNPROGRAM) -- ${PWD}/$(libsrc)/make-docfile$(EXEEXT) -g $(obj) > ${PWD}/gl-tmp
$(srcdir)/../build-aux/move-if-change gl-tmp globals.h
echo timestamp > $@
@@ -464,7 +508,15 @@ $(lib)/libgnu.a: $(config_h)
temacs$(EXEEXT): $(START_FILES) stamp-oldxmenu $(obj) $(otherobj) $(lib)/libgnu.a
$(CC) $(LD_FIRSTFLAG) $(ALL_CFLAGS) $(TEMACS_LDFLAGS) $(LDFLAGS) \
- -o temacs $(START_FILES) $(obj) $(otherobj) $(lib)/libgnu.a $(LIBES)
+ -o temacs$(EXEEXT) $(START_FILES) $(obj) $(otherobj) $(lib)/libgnu.a $(LIBES) ${COMPAT_LIBS}
+ test "$(CANNOT_DUMP)" = "yes" || \
+ test "X$(PAXCTL)" = X || $(PAXCTL) -r temacs$(EXEEXT)
+
+## A special build of temacs with a different entry point, and including
+## emacs_pepper
+nacl_temacs$(EXEEXT): $(START_FILES) stamp-oldxmenu $(nacl_obj) $(otherobj) $(lib)/libgnu.a
+ $(CC) $(LD_FIRSTFLAG) $(ALL_CFLAGS) $(TEMACS_LDFLAGS) $(LDFLAGS) \
+ -o nacl_temacs$(EXEEXT) $(START_FILES) $(nacl_obj) $(otherobj) $(lib)/libgnu.a $(NACL_LIBS) $(LIBES) ${COMPAT_LIBS}
test "$(CANNOT_DUMP)" = "yes" || \
test "X$(PAXCTL)" = X || $(PAXCTL) -r temacs$(EXEEXT)
@@ -613,8 +665,12 @@ $(lispsource)/loaddefs.el: $(BOOTSTRAPEMACS) $(VCSWITNESS)
bootstrap-emacs$(EXEEXT): temacs$(EXEEXT)
cd ../lisp; $(MAKE) $(MFLAGS) update-subdirs
if test "$(CANNOT_DUMP)" = "yes"; then \
- rm -f bootstrap-emacs$(EXEEXT); \
- ln temacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \
+ echo "#!/bin/bash" > bootstrap-emacs$(EXEEXT); \
+ echo 'EMACSLOADPATH=$${EMACSLOADPATH} \' >> bootstrap-emacs$(EXEEXT); \
+ echo "$(RUNPROGRAM) -p \\" >> bootstrap-emacs$(EXEEXT); \
+ echo "$(RUNPROGRAM_ARGS) -- $(PWD)/temacs$(EXEEXT) \\" >> bootstrap-emacs$(EXEEXT); \
+ echo ' "$$@"' >> bootstrap-emacs$(EXEEXT); \
+ chmod a+x bootstrap-emacs$(EXEEXT); \
else \
$(RUN_TEMACS) --batch --load loadup bootstrap || exit 1; \
test "X$(PAXCTL)" = X || $(PAXCTL) -zex emacs$(EXEEXT); \
diff --git a/src/alloc.c b/src/alloc.c
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -47,6 +47,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <verify.h>
+#ifdef NACL_EMACS
+#include <spawn.h>
+#define pipe nacl_spawn_pipe
+#endif
+
/* GC_CHECK_MARKED_OBJECTS means do sanity checks on allocated objects.
Doable only if GC_MARK_STACK. */
#if ! GC_MARK_STACK
diff --git a/src/callproc.c b/src/callproc.c
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -29,6 +29,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "lisp.h"
+#ifdef NACL_EMACS
+#include <spawn.h>
+#define pipe nacl_spawn_pipe
+#endif
+
#ifdef WINDOWSNT
#define NOMINMAX
#include <windows.h>
@@ -655,6 +660,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
{
if (fd[0] >= 0)
emacs_close (fd[0]);
+ message("Errno was %d", errno);
report_file_error ("Doing vfork", Qnil);
}
@@ -1610,7 +1616,11 @@ init_callproc (void)
Vdata_directory);
sh = (char *) getenv ("SHELL");
+#ifndef NACL_EMACS
Vshell_file_name = build_string (sh ? sh : "/bin/sh");
+#else
+ Vshell_file_name = build_string (sh ? sh : "/bin/bash");
+#endif
#ifdef DOS_NT
Vshared_game_score_directory = Qnil;
diff --git a/src/emacs.c b/src/emacs.c
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -31,6 +31,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "lisp.h"
+#ifdef NACL_EMACS
+#include <spawn.h>
+#define pipe nacl_spawn_pipe
+#endif
+
#ifdef WINDOWSNT
#include <fcntl.h>
#include "w32.h"
@@ -656,11 +661,27 @@ void (*__malloc_initialize_hook) (void) EXTERNALLY_VISIBLE = malloc_initialize_h
#endif /* DOUG_LEA_MALLOC */
+int real_main (int argc, char **argv);
-/* ARGSUSED */
+#ifndef NACL_EMACS
int
main (int argc, char **argv)
{
+ return real_main(argc, argv);
+}
+
+#else // NACL_EMACS
+int
+nacl_emacs_main (int argc, char **argv)
+{
+ return real_main(argc, argv);
+}
+#endif // NACL_EMACS
+
+/* ARGSUSED */
+int
+real_main (int argc, char **argv)
+{
#if GC_MARK_STACK
Lisp_Object dummy;
#endif
@@ -1877,7 +1898,7 @@ shut_down_emacs (int sig, Lisp_Object stuff)
Vinhibit_redisplay = Qt;
/* If we are controlling the terminal, reset terminal modes. */
-#ifndef DOS_NT
+#if !defined(DOS_NT) && !defined(NACL_EMACS)
{
pid_t pgrp = EMACS_GETPGRP (0);
pid_t tpgrp = tcgetpgrp (0);
@@ -2113,7 +2134,7 @@ decode_env_path (const char *evarname, const char *defalt)
path = getenv (evarname);
else
path = 0;
- if (!path)
+ if (!path || strlen(path) == 0)
{
path = defalt;
#ifdef WINDOWSNT
diff --git a/src/fileio.c b/src/fileio.c
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2131,8 +2131,10 @@ on the system, we copy the SELinux context of FILE to NEWNAME. */)
mode_mask |= 02000;
}
}
+#if !defined(__native_client__)
if (fchmod (ofd, st.st_mode & mode_mask) != 0)
report_file_error ("Doing chmod", Fcons (newname, Qnil));
+#endif
}
#endif /* not MSDOS */
@@ -2149,6 +2151,7 @@ on the system, we copy the SELinux context of FILE to NEWNAME. */)
}
#endif
+#if !defined(__native_client__)
if (input_file_statable_p)
{
if (!NILP (keep_time))
@@ -2160,6 +2163,7 @@ on the system, we copy the SELinux context of FILE to NEWNAME. */)
build_string ("Cannot set file date"), newname);
}
}
+#endif
if (emacs_close (ofd) < 0)
report_file_error ("I/O error", Fcons (newname, Qnil));
@@ -2272,8 +2276,10 @@ With a prefix argument, TRASH is nil. */)
encoded_file = ENCODE_FILE (filename);
+#if !defined(__native_client__)
if (unlink (SSDATA (encoded_file)) < 0)
report_file_error ("Removing old name", list1 (filename));
+#endif
return Qnil;
}
@@ -2352,7 +2358,8 @@ This is what happens in interactive use with M-x. */)
INTEGERP (ok_if_already_exists), 0, 0);
if (rename (SSDATA (encoded_file), SSDATA (encoded_newname)) < 0)
{
- if (errno == EXDEV)
+ //if (errno == EXDEV)
+ if (1)
{
ptrdiff_t count;
symlink_target = Ffile_symlink_p (file);
@@ -2630,6 +2637,8 @@ For a directory, this means you can access files in that directory. */)
Lisp_Object absname;
Lisp_Object handler;
+ return Qt;
+
CHECK_STRING (filename);
absname = Fexpand_file_name (filename, Qnil);
@@ -2698,6 +2707,9 @@ DEFUN ("file-writable-p", Ffile_writable_p, Sfile_writable_p, 1, 1, 0,
doc: /* Return t if file FILENAME can be written or created by you. */)
(Lisp_Object filename)
{
+ return Qt;
+
+#if 0 // PETEWIL - bypass this until sel_ldr is working
Lisp_Object absname, dir, encoded;
Lisp_Object handler;
@@ -2731,6 +2743,8 @@ DEFUN ("file-writable-p", Ffile_writable_p, Sfile_writable_p, 1, 1, 0,
return (check_writable (!NILP (dir) ? SSDATA (dir) : "")
? Qt : Qnil);
#endif
+
+#endif // 0
}
DEFUN ("access-file", Faccess_file, Saccess_file, 2, 2, 0,
@@ -4848,6 +4862,7 @@ This calls `write-region-annotate-functions' at the start, and
immediate_quit = 0;
+#if !defined(__native_client__)
#ifdef HAVE_FSYNC
/* Note fsync appears to change the modtime on BSD4.2 (both vax and sun).
Disk full in NFS may be reported here. */
@@ -4862,6 +4877,7 @@ This calls `write-region-annotate-functions' at the start, and
ok = 0, save_errno = errno;
}
#endif
+#endif
modtime = invalid_emacs_time ();
if (visiting)
diff --git a/src/keyboard.c b/src/keyboard.c
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -6858,6 +6858,26 @@ decode_keyboard_code (struct tty_display_info *tty,
and so this function is called once for each individual termcap
terminal. The first parameter indicates which terminal to read from. */
+#if defined(__native_client__)
+#include "nacl_io/kernel_intercept.h"
+#include "nacl_io/kernel_wrap.h"
+#include <stdarg.h>
+
+/*
+ * TODO(bradnelson): Drop this when fcntl is sorted out in nacl_io.
+ * Explicitly use nacl_fcntl.
+ * When built as a shared library, without this emacs seems to hit stubs.
+ */
+int nacl_fcntl(int fd, int cmd, ...) {
+ va_list ap;
+ va_start(ap, cmd);
+ int rtn = ki_fcntl(fd, cmd, ap);
+ va_end(ap);
+ return rtn;
+}
+#define fcntl nacl_fcntl
+#endif
+
int
tty_read_avail_input (struct terminal *terminal,
struct input_event *hold_quit)
@@ -6946,10 +6966,10 @@ tty_read_avail_input (struct terminal *terminal,
return 0;
if (n_to_read > sizeof cbuf)
n_to_read = sizeof cbuf;
-#elif defined USG || defined CYGWIN
+#elif defined USG || defined CYGWIN || defined __native_client__
/* Read some input if available, but don't wait. */
n_to_read = sizeof cbuf;
- fcntl (fileno (tty->input), F_SETFL, O_NDELAY);
+ fcntl (fileno (tty->input), F_SETFL, O_NONBLOCK);
#else
# error "Cannot read without possibly delaying"
#endif
diff --git a/src/lisp.h b/src/lisp.h
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -190,7 +190,8 @@ enum Lisp_Bits
#ifndef USE_LSB_TAG
/* 1. We know malloc returns a multiple of 8. */
# if (defined GNU_MALLOC || defined DOUG_LEA_MALLOC || defined __GLIBC__ \
- || defined DARWIN_OS || defined __sun)
+ || defined DARWIN_OS || defined __sun \
+ || (defined __native_client__ && defined _NEWLIB_VERSION))
/* 2. We can specify multiple-of-8 alignment on static variables. */
# ifdef alignas
/* 3. Pointers-as-ints exceed VAL_MAX.
diff --git a/src/process.c b/src/process.c
--- a/src/process.c
+++ b/src/process.c
@@ -33,6 +33,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "lisp.h"
+#ifdef NACL_EMACS
+#include <spawn.h>
+#define pipe nacl_spawn_pipe
+#endif
+
/* Only MS-DOS does not define `subprocesses'. */
#ifdef subprocesses
@@ -1588,6 +1593,22 @@ create_process_1 (struct atimer *timer)
/* Nothing to do. */
}
+#ifdef NACL_EMACS
+/*
+ * TODO(bradnelson): Drop this when fcntl is sorted out in nacl_io.
+ * Explicitly use nacl_fcntl.
+ * When built as a shared library, without this emacs seems to hit stubs.
+ */
+static int nacl_fcntl(int fd, int cmd, ...) {
+ va_list ap;
+ va_start(ap, cmd);
+ int rtn = ki_fcntl(fd, cmd, ap);
+ va_end(ap);
+ return rtn;
+}
+#define fcntl nacl_fcntl
+#endif
+
static void
create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
@@ -1640,7 +1661,11 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
#endif /* HAVE_PTYS */
{
int tem;
+#if defined(NACL_EMACS)
+ tem = nacl_spawn_pipe2 (sv, O_NONBLOCK);
+#else
tem = pipe (sv);
+#endif
if (tem < 0)
report_file_error ("Creating pipe", Qnil);
inchannel = sv[0];
@@ -4473,14 +4498,26 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
Ctemp = write_mask;
timeout = make_emacs_time (0, 0);
+#if defined (NACL_EMACS)
+ // NACL doesn't support pselect yet, so use select instead.
+ // (glibc stubs out pselect in terms of select).
+ // Select takes a different kind of time, and one fewer argument.
+ struct timeval timevalue = {0,0};
+ if ((select (max (max_process_desc, max_input_desc) + 1,
+#else
if ((pselect (max (max_process_desc, max_input_desc) + 1,
+#endif
&Atemp,
#ifdef NON_BLOCKING_CONNECT
(num_pending_connects > 0 ? &Ctemp : NULL),
#else
NULL,
#endif
+#if defined (NACL_EMACS)
+ NULL, &timevalue)
+#else
NULL, &timeout, NULL)
+#endif
<= 0))
{
/* It's okay for us to do this and then continue with
@@ -4633,13 +4670,23 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
nfds = xg_select
#elif defined (HAVE_NS)
nfds = ns_select
+#elif defined (NACL_EMACS)
+ // NACL doesn't support pselect yet, so use select instead.
+ // (glibc stubs out pselect in terms of select).
+ // Select takes a different kind of time, and one fewer argument.
+ struct timeval timevalue = {0,0};
+ nfds = select
#else
nfds = pselect
#endif
(max (max_process_desc, max_input_desc) + 1,
&Available,
(check_write ? &Writeok : (SELECT_TYPE *)0),
+#if defined (NACL_EMACS)
+ NULL, &timevalue);
+#else
NULL, &timeout, NULL);
+#endif
#ifdef HAVE_GNUTLS
/* GnuTLS buffers data internally. In lowat mode it leaves
@@ -6935,7 +6982,15 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
{
if (read_kbd || !NILP (wait_for_cell))
FD_SET (0, &waitchannels);
- nfds = pselect (1, &waitchannels, NULL, NULL, &timeout, NULL);
+#if defined (NACL_EMACS)
+ // NACL doesn't support pselect yet, so use select instead.
+ // (glibc stubs out pselect in terms of select).
+ // Select takes a different kind of time, and one fewer argument.
+ struct timeval timevalue = {0,0};
+ nfds = select(1, &waitchannels, NULL, NULL, &timevalue);
+#else
+ nfds = pselect(1, &waitchannels, NULL, NULL, &timeout, NULL);
+#endif
}
xerrno = errno;
diff --git a/src/sysdep.c b/src/sysdep.c
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -40,6 +40,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "sysselect.h"
#include "blockinput.h"
+#ifdef NACL_EMACS
+# include <spawn.h>
+# define pipe nacl_spawn_pipe
+#endif
+
#ifdef BSD_SYSTEM
#include <sys/param.h>
#include <sys/sysctl.h>
@@ -353,6 +358,7 @@ child_setup_tty (int out)
emacs_get_tty (out, &s);
s.main.c_oflag |= OPOST; /* Enable output postprocessing */
s.main.c_oflag &= ~ONLCR; /* Disable map of NL to CR-NL on output */
+
#ifdef NLDLY
/* http://lists.gnu.org/archive/html/emacs-devel/2008-05/msg00406.html
Some versions of GNU Hurd do not have FFDLY? */
@@ -906,6 +912,15 @@ init_sys_modes (struct tty_display_info *tty_out)
tty.main.c_iflag &= ~IXON; /* Disable start/stop output control */
tty.main.c_oflag &= ~ONLCR; /* Disable map of NL to CR-NL
on output */
+
+#ifdef NACL_EMACS
+ // The NaCl platform is not honoring the ONLCR bit being disbled.
+ // They are planning to fix it, but until then, we can send the term
+ // code to fix disable AutoCRLF.
+ puts("\x1b[20l");
+#endif // NACL_EMACS
+
+
tty.main.c_oflag &= ~TAB3; /* Disable tab expansion */
#ifdef CS8
if (tty_out->meta_key)
@@ -1228,6 +1243,14 @@ reset_all_sys_modes (void)
struct tty_display_info *tty;
for (tty = tty_list; tty; tty = tty->next)
reset_sys_modes (tty);
+
+#ifdef NACL_EMACS
+ // The NaCl platform is not honoring the ONLCR bit being disbled.
+ // They are planning to fix it, but until then, we can send the term
+ // code to reset AutoCRLF to it's previous state.
+ puts("\x1b[20h");
+#endif // NACL_EMACS
+
}
/* Prepare the terminal for closing it; move the cursor to the
@@ -2438,7 +2461,7 @@ cfmakeraw (struct termios *termios_p)
}
#endif /* !defined (HAVE_CFMAKERAW */
-#if !defined (HAVE_CFSETSPEED)
+#if !defined (HAVE_CFSETSPEED) && !defined(__native_client__)
/* Workaround for targets which are missing cfsetspeed. */
static int
cfsetspeed (struct termios *termios_p, speed_t vitesse)
diff --git a/src/term.c b/src/term.c
--- a/src/term.c
+++ b/src/term.c
@@ -2918,6 +2918,7 @@ set_tty_hooks (struct terminal *terminal)
static void
dissociate_if_controlling_tty (int fd)
{
+#ifndef __native_client__
#ifndef DOS_NT
pid_t pgid = tcgetpgrp (fd); /* If tcgetpgrp succeeds, fd is the ctty. */
if (pgid != -1)
@@ -2948,6 +2949,7 @@ dissociate_if_controlling_tty (int fd)
#endif /* ! USG */
}
#endif /* !DOS_NT */
+#endif
}
/* Create a termcap display on the tty device with the given name and
diff --git a/src/unexelf.c b/src/unexelf.c
--- a/src/unexelf.c
+++ b/src/unexelf.c
@@ -616,6 +616,7 @@ find_section (const char *name, const char *section_names, const char *file_name
void
unexec (const char *new_name, const char *old_name)
{
+#if !defined(__native_client__)
int new_file, old_file, new_file_size;
#if defined (emacs) || !defined (DEBUG)
@@ -1318,4 +1319,5 @@ temacs:
stat_buf.st_mode |= 0111 & ~n;
if (chmod (new_name, stat_buf.st_mode) == -1)
fatal ("Can't chmod (%s): errno %d\n", new_name, errno);
+#endif
}
diff --git a/src/vm-limit.c b/src/vm-limit.c
--- a/src/vm-limit.c
+++ b/src/vm-limit.c
@@ -139,7 +139,9 @@ ret_lim_data (void)
static void
get_lim_data (void)
{
+#ifndef __native_client__
lim_data = vlimit (LIM_DATA, -1);
+#endif
}
#endif /* not MSDOS */