In an attempt to reduce build dependencies, remove the requirement for

objcopy. Instead, we are now using "od" to generate C source code.


git-svn-id: https://shellinabox.googlecode.com/svn/trunk@230 0da03de8-d603-11dd-86c2-0f8696b7b6f9
This commit is contained in:
zodiac@gmail.com 2010-09-29 02:19:23 +00:00
parent 412a209218
commit 81af285a8d
10 changed files with 239 additions and 285 deletions

View file

@ -2,9 +2,6 @@ AM_CPPFLAGS =
AM_CFLAGS = -g -std=gnu99 -Wall AM_CFLAGS = -g -std=gnu99 -Wall
AM_LDFLAGS = -g -lm AM_LDFLAGS = -g -lm
OBJCOPY ?= objcopy
OBJDUMP ?= objdump
noinst_LTLIBRARIES = libhttp.la \ noinst_LTLIBRARIES = libhttp.la \
liblogging.la liblogging.la
noinst_DATA = $(top_srcdir)/demo/demo.js noinst_DATA = $(top_srcdir)/demo/demo.js
@ -112,39 +109,36 @@ shellinaboxd_SOURCES = shellinabox/shellinaboxd.c \
shellinabox/keyboard-layout.html \ shellinabox/keyboard-layout.html \
shellinabox/beep.wav \ shellinabox/beep.wav \
config.h config.h
BUILT_SOURCES = shellinabox/beep.h \
shellinabox/cgi_root.h \
shellinabox/enabled.h \
shellinabox/favicon.h \
shellinabox/keyboard.h \
shellinabox/keyboard-layout.h \
shellinabox/print-styles.h \
shellinabox/root_page.h \
shellinabox/shell_in_a_box.h \
shellinabox/shell_in_a_box.js \
shellinabox/styles.h \
shellinabox/vt100.h \
shellinabox/vt100.js
shellinaboxd_LDADD = liblogging.la \ shellinaboxd_LDADD = liblogging.la \
libhttp.la libhttp.la
shellinaboxd_LDFLAGS = -static shellinaboxd_LDFLAGS = -static
objcopyflags = case "$(host_cpu)" in \ symbolname = \
i[0-9]86)echo '-O elf32-i386 -B i386';; \ sed -e 's/.*\/\([^.]*\)[.].*/\1/' \
x86_64) echo '-O elf64-x86-64 -B i386:x86-64';; \
*) trap 'rm -f /tmp/probe$$$$.o' EXIT; \
$(CC) $(AM_CFLAGS) $(CFLAGS) -c -xc \
-o /tmp/probe$$$$.o /dev/null && \
$(OBJDUMP) -f /tmp/probe$$$$.o | \
sed -e 's/.*file format */-O /;t; \
s/architecture: *\([^,]*\).*/-B \1/;t; \
d';; \
esac
renamesymbols = \
sed -e 's/\(.*\/\)\([^.]*\)\([.].*\)/\1\2\3=\2 /' \
-e 't0' \ -e 't0' \
-e 's/\([^.]*\)\([.].*\)/\1\2=\1 /' \ -e 's/\([^.]*\)[.].*/\1/' \
-e 't0' \
-e 's/.*/&=& /' \
-e ':0' \ -e ':0' \
-e 's/$$/aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ/' \ -e 's/$$/ aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ/' \
-e ':1' \ -e ':1' \
-e 's/\(=[^-_]*\)[-_]\([a-z]\)\([^ ]* .*\2\)\(.\)/\1\4\3\4/' \ -e 's/\([^-_]*\)[-_]\([a-z]\)\([^ ]* .*\2\)\(.\)/\1\4\3\4/' \
-e 't1' \ -e 't1' \
-e 's/.\{53\}$$//' \ -e 's/.\{53\}$$//' \
-e 's/[-/.]/_/g' \ -e 's/[-/.]/_/g'
-e 's/^/--redefine-sym _binary_/' \
-e 's/\([^=]*\)\(=[^ ]*\)/& \1_end\2End/' \
-e 's/\([^=]*\)\(=[^ ]*\)/& \1_start\2Start/' \
-e 's/[^ ]*\([^=]*\)=[^ ]*/-N\1_size/'
libtool: $(LIBTOOL_DEPS) libtool: $(LIBTOOL_DEPS)
$(SHELL) ./config.status --recheck $(SHELL) ./config.status --recheck
@ -251,57 +245,72 @@ clean-local:
debian/shellinabox*.debhelper* \ debian/shellinabox*.debhelper* \
debian/shellinabox.substvars \ debian/shellinabox.substvars \
debian/tmp debian/tmp
-rm -rf GNU-stack -rm -rf shellinabox/beep.h \
shellinabox/cgi_root.h \
shellinabox/enabled.h \
shellinabox/favicon.h \
shellinabox/keyboard.h \
shellinabox/keyboard-layout.h \
shellinabox/print-styles.h \
shellinabox/root_page.h \
shellinabox/shell_in_a_box.h \
shellinabox/styles.h \
shellinabox/vt100.h
.css.o: .css.h:
@echo $(OBJCOPY) "$<" "$@" @echo od "$<" '>'"$@"
@$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`\ @mkdir -p "`dirname "$@"`"
"$<" "$@" @{ sym="`echo "$<" | $(symbolname)`"; \
@-printf '\000' >GNU-stack && \ echo "static const char $${sym}Start[]="; \
$(OBJCOPY) --add-section .note.GNU-stack=GNU-stack "$@"; \ od -vb "$<" | sed 's/[0-7]*/"/;s/ /\\/g;s/$$/"/'; \
rm -f GNU-stack echo ';'; \
echo "static const int $${sym}Size=(int)sizeof($${sym}Start);"; \
} >"$@"
.gif.o: .gif.h:
@echo $(OBJCOPY) "$<" "$@" @echo od "$<" '>'"$@"
@$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`\ @mkdir -p "`dirname "$@"`"
"$<" "$@" @{ sym="`echo "$<" | $(symbolname)`"; \
@-printf '\000' >GNU-stack && \ echo "static const char $${sym}Start[]="; \
$(OBJCOPY) --add-section .note.GNU-stack=GNU-stack "$@"; \ od -vb "$<" | sed 's/[0-7]*/"/;s/ /\\/g;s/$$/"/'; \
rm -f GNU-stack echo ';'; \
echo "static const int $${sym}Size=(int)sizeof($${sym}Start);"; \
} >"$@"
.png.o: .png.h:
@echo $(OBJCOPY) "$<" "$@" @echo od "$<" '>'"$@"
@$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`\ @mkdir -p "`dirname "$@"`"
"$<" "$@" @{ sym="`echo "$<" | $(symbolname)`"; \
@-printf '\000' >GNU-stack && \ echo "static const char $${sym}Start[]="; \
$(OBJCOPY) --add-section .note.GNU-stack=GNU-stack "$@"; \ od -vb "$<" | sed 's/[0-7]*/"/;s/ /\\/g;s/$$/"/'; \
rm -f GNU-stack echo ';'; \
echo "static const int $${sym}Size=(int)sizeof($${sym}Start);"; \
} >"$@"
.html.o: .html.h:
@echo $(OBJCOPY) "$<" "$@" @echo od "$<" '>'"$@"
@$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`\ @mkdir -p "`dirname "$@"`"
"$<" "$@" @{ sym="`echo "$<" | $(symbolname)`"; \
@-printf '\000' >GNU-stack && \ echo "static const char $${sym}Start[]="; \
$(OBJCOPY) --add-section .note.GNU-stack=GNU-stack "$@"; \ od -vb "$<" | sed 's/[0-7]*/"/;s/ /\\/g;s/$$/"/'; \
rm -f GNU-stack echo ';'; \
echo "static const int $${sym}Size=(int)sizeof($${sym}Start);"; \
} >"$@"
.ico.o: .ico.h:
@echo $(OBJCOPY) "$<" "$@" @echo od "$<" '>'"$@"
@$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`\ @mkdir -p "`dirname "$@"`"
"$<" "$@" @{ sym="`echo "$<" | $(symbolname)`"; \
@-printf '\000' >GNU-stack && \ echo "static const char $${sym}Start[]="; \
$(OBJCOPY) --add-section .note.GNU-stack=GNU-stack "$@"; \ od -vb "$<" | sed 's/[0-7]*/"/;s/ /\\/g;s/$$/"/'; \
rm -f GNU-stack echo ';'; \
echo "static const int $${sym}Size=(int)sizeof($${sym}Start);"; \
} >"$@"
shellinabox/shell_in_a_box.o: ${top_srcdir}/shellinabox/shell_in_a_box.js \
${top_srcdir}/config.h
${top_srcdir}/shellinabox/vt100.js: ${top_srcdir}/shellinabox/vt100.jspp
.jspp.js: .jspp.js:
@echo preprocess "$<" "$@" @echo preprocess "$<" "$@"
@mkdir -p "`dirname "$@"`"
sed -e "`sed -e 's/^#define *\([^ ]*\) *\(.*\)/\/^[^#]\/s\/\1\/\2 \\\\\/* \1 *\\\\\/\/g/' \ sed -e "`sed -e 's/^#define *\([^ ]*\) *\(.*\)/\/^[^#]\/s\/\1\/\2 \\\\\/* \1 *\\\\\/\/g/' \
-e t \ -e t \
-e d "$<"`" \ -e d "$<"`" \
@ -309,21 +318,24 @@ ${top_srcdir}/shellinabox/vt100.js: ${top_srcdir}/shellinabox/vt100.jspp
-e "s/VERSION/\"@VERSION@ (revision @VCS_REVISION@)\"/g" \ -e "s/VERSION/\"@VERSION@ (revision @VCS_REVISION@)\"/g" \
"$<" >"$@" "$<" >"$@"
.js.o: .js.h:
@echo $(OBJCOPY) "$<" "$@" @echo od "$<" '>'"$@"
@$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`\ @mkdir -p "`dirname "$@"`"
"$<" "$@" @{ sym="`echo "$<" | $(symbolname)`"; \
@-printf '\000' >GNU-stack && \ echo "static const char $${sym}Start[]="; \
$(OBJCOPY) --add-section .note.GNU-stack=GNU-stack "$@"; \ od -vb "$<" | sed 's/[0-7]*/"/;s/ /\\/g;s/$$/"/'; \
rm -f GNU-stack echo ';'; \
echo "static const int $${sym}Size=(int)sizeof($${sym}Start);"; \
} >"$@"
.wav.o: .wav.h:
@echo $(OBJCOPY) "$<" "$@" @echo od "$<" '>'"$@"
@$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`\ @mkdir -p "`dirname "$@"`"
"$<" "$@" @{ sym="`echo "$<" | $(symbolname)`"; \
@-printf '\000' >GNU-stack && \ echo "static const char $${sym}Start[]="; \
$(OBJCOPY) --add-section .note.GNU-stack=GNU-stack "$@"; \ od -vb "$<" | sed 's/[0-7]*/"/;s/ /\\/g;s/$$/"/'; \
rm -f GNU-stack echo ';'; \
echo "static const int $${sym}Size=(int)sizeof($${sym}Start);"; \
} >"$@"

View file

@ -72,19 +72,9 @@ liblogging_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" \ am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" \
"$(DESTDIR)$(docdir)" "$(DESTDIR)$(docdir)"
PROGRAMS = $(bin_PROGRAMS) PROGRAMS = $(bin_PROGRAMS)
am__dirstamp = $(am__leading_dot)dirstamp
am_shellinaboxd_OBJECTS = shellinaboxd.$(OBJEXT) \ am_shellinaboxd_OBJECTS = shellinaboxd.$(OBJEXT) \
externalfile.$(OBJEXT) launcher.$(OBJEXT) privileges.$(OBJEXT) \ externalfile.$(OBJEXT) launcher.$(OBJEXT) privileges.$(OBJEXT) \
service.$(OBJEXT) session.$(OBJEXT) usercss.$(OBJEXT) \ service.$(OBJEXT) session.$(OBJEXT) usercss.$(OBJEXT)
shellinabox/cgi_root.$(OBJEXT) shellinabox/root_page.$(OBJEXT) \
shellinabox/vt100.$(OBJEXT) \
shellinabox/shell_in_a_box.$(OBJEXT) \
shellinabox/styles.$(OBJEXT) \
shellinabox/print-styles.$(OBJEXT) \
shellinabox/enabled.$(OBJEXT) shellinabox/favicon.$(OBJEXT) \
shellinabox/keyboard.$(OBJEXT) \
shellinabox/keyboard-layout.$(OBJEXT) \
shellinabox/beep.$(OBJEXT)
shellinaboxd_OBJECTS = $(am_shellinaboxd_OBJECTS) shellinaboxd_OBJECTS = $(am_shellinaboxd_OBJECTS)
shellinaboxd_DEPENDENCIES = liblogging.la libhttp.la shellinaboxd_DEPENDENCIES = liblogging.la libhttp.la
shellinaboxd_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ shellinaboxd_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
@ -375,45 +365,41 @@ shellinaboxd_SOURCES = shellinabox/shellinaboxd.c \
shellinabox/beep.wav \ shellinabox/beep.wav \
config.h config.h
BUILT_SOURCES = shellinabox/beep.h \
shellinabox/cgi_root.h \
shellinabox/enabled.h \
shellinabox/favicon.h \
shellinabox/keyboard.h \
shellinabox/keyboard-layout.h \
shellinabox/print-styles.h \
shellinabox/root_page.h \
shellinabox/shell_in_a_box.h \
shellinabox/shell_in_a_box.js \
shellinabox/styles.h \
shellinabox/vt100.h \
shellinabox/vt100.js
shellinaboxd_LDADD = liblogging.la \ shellinaboxd_LDADD = liblogging.la \
libhttp.la libhttp.la
shellinaboxd_LDFLAGS = -static shellinaboxd_LDFLAGS = -static
objcopyflags = case "$(host_cpu)" in \ symbolname = \
i[0-9]86)echo '-O elf32-i386 -B i386';; \ sed -e 's/.*\/\([^.]*\)[.].*/\1/' \
x86_64) echo '-O elf64-x86-64 -B i386:x86-64';; \
*) trap 'rm -f /tmp/probe$$$$.o' EXIT; \
$(CC) $(AM_CFLAGS) $(CFLAGS) -c -xc \
-o /tmp/probe$$$$.o /dev/null && \
$(OBJDUMP) -f /tmp/probe$$$$.o | \
sed -e 's/.*file format */-O /;t; \
s/architecture: *\([^,]*\).*/-B \1/;t; \
d';; \
esac
renamesymbols = \
sed -e 's/\(.*\/\)\([^.]*\)\([.].*\)/\1\2\3=\2 /' \
-e 't0' \ -e 't0' \
-e 's/\([^.]*\)\([.].*\)/\1\2=\1 /' \ -e 's/\([^.]*\)[.].*/\1/' \
-e 't0' \
-e 's/.*/&=& /' \
-e ':0' \ -e ':0' \
-e 's/$$/aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ/' \ -e 's/$$/ aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ/' \
-e ':1' \ -e ':1' \
-e 's/\(=[^-_]*\)[-_]\([a-z]\)\([^ ]* .*\2\)\(.\)/\1\4\3\4/' \ -e 's/\([^-_]*\)[-_]\([a-z]\)\([^ ]* .*\2\)\(.\)/\1\4\3\4/' \
-e 't1' \ -e 't1' \
-e 's/.\{53\}$$//' \ -e 's/.\{53\}$$//' \
-e 's/[-/.]/_/g' \ -e 's/[-/.]/_/g'
-e 's/^/--redefine-sym _binary_/' \
-e 's/\([^=]*\)\(=[^ ]*\)/& \1_end\2End/' \
-e 's/\([^=]*\)\(=[^ ]*\)/& \1_start\2Start/' \
-e 's/[^ ]*\([^=]*\)=[^ ]*/-N\1_size/'
all: config.h all: $(BUILT_SOURCES) config.h
$(MAKE) $(AM_MAKEFLAGS) all-am $(MAKE) $(AM_MAKEFLAGS) all-am
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .c .css .gif .html .ico .js .jspp .lo .o .obj .png .wav .SUFFIXES: .c .css .gif .h .html .ico .js .jspp .lo .o .obj .png .wav
am--refresh: am--refresh:
@: @:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@ -521,51 +507,12 @@ clean-binPROGRAMS:
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \ echo " rm -f" $$list; \
rm -f $$list rm -f $$list
shellinabox/$(am__dirstamp):
@$(MKDIR_P) shellinabox
@: > shellinabox/$(am__dirstamp)
shellinabox/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) shellinabox/$(DEPDIR)
@: > shellinabox/$(DEPDIR)/$(am__dirstamp)
shellinabox/cgi_root.$(OBJEXT): shellinabox/$(am__dirstamp) \
shellinabox/$(DEPDIR)/$(am__dirstamp)
shellinabox/root_page.$(OBJEXT): shellinabox/$(am__dirstamp) \
shellinabox/$(DEPDIR)/$(am__dirstamp)
shellinabox/vt100.$(OBJEXT): shellinabox/$(am__dirstamp) \
shellinabox/$(DEPDIR)/$(am__dirstamp)
shellinabox/shell_in_a_box.$(OBJEXT): shellinabox/$(am__dirstamp) \
shellinabox/$(DEPDIR)/$(am__dirstamp)
shellinabox/styles.$(OBJEXT): shellinabox/$(am__dirstamp) \
shellinabox/$(DEPDIR)/$(am__dirstamp)
shellinabox/print-styles.$(OBJEXT): shellinabox/$(am__dirstamp) \
shellinabox/$(DEPDIR)/$(am__dirstamp)
shellinabox/enabled.$(OBJEXT): shellinabox/$(am__dirstamp) \
shellinabox/$(DEPDIR)/$(am__dirstamp)
shellinabox/favicon.$(OBJEXT): shellinabox/$(am__dirstamp) \
shellinabox/$(DEPDIR)/$(am__dirstamp)
shellinabox/keyboard.$(OBJEXT): shellinabox/$(am__dirstamp) \
shellinabox/$(DEPDIR)/$(am__dirstamp)
shellinabox/keyboard-layout.$(OBJEXT): shellinabox/$(am__dirstamp) \
shellinabox/$(DEPDIR)/$(am__dirstamp)
shellinabox/beep.$(OBJEXT): shellinabox/$(am__dirstamp) \
shellinabox/$(DEPDIR)/$(am__dirstamp)
shellinaboxd$(EXEEXT): $(shellinaboxd_OBJECTS) $(shellinaboxd_DEPENDENCIES) shellinaboxd$(EXEEXT): $(shellinaboxd_OBJECTS) $(shellinaboxd_DEPENDENCIES)
@rm -f shellinaboxd$(EXEEXT) @rm -f shellinaboxd$(EXEEXT)
$(shellinaboxd_LINK) $(shellinaboxd_OBJECTS) $(shellinaboxd_LDADD) $(LIBS) $(shellinaboxd_LINK) $(shellinaboxd_OBJECTS) $(shellinaboxd_LDADD) $(LIBS)
mostlyclean-compile: mostlyclean-compile:
-rm -f *.$(OBJEXT) -rm -f *.$(OBJEXT)
-rm -f shellinabox/beep.$(OBJEXT)
-rm -f shellinabox/cgi_root.$(OBJEXT)
-rm -f shellinabox/enabled.$(OBJEXT)
-rm -f shellinabox/favicon.$(OBJEXT)
-rm -f shellinabox/keyboard-layout.$(OBJEXT)
-rm -f shellinabox/keyboard.$(OBJEXT)
-rm -f shellinabox/print-styles.$(OBJEXT)
-rm -f shellinabox/root_page.$(OBJEXT)
-rm -f shellinabox/shell_in_a_box.$(OBJEXT)
-rm -f shellinabox/styles.$(OBJEXT)
-rm -f shellinabox/vt100.$(OBJEXT)
distclean-compile: distclean-compile:
-rm -f *.tab.c -rm -f *.tab.c
@ -1033,14 +980,16 @@ distcleancheck: distclean
$(distcleancheck_listfiles) ; \ $(distcleancheck_listfiles) ; \
exit 1; } >&2 exit 1; } >&2
check-am: all-am check-am: all-am
check: check-am check: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) check-am
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(MANS) $(DATA) $(HEADERS) \ all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(MANS) $(DATA) $(HEADERS) \
config.h config.h
installdirs: installdirs:
for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(docdir)"; do \ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(docdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done done
install: install-am install: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) install-am
install-exec: install-exec-am install-exec: install-exec-am
install-data: install-data-am install-data: install-data-am
uninstall: uninstall-am uninstall: uninstall-am
@ -1061,12 +1010,11 @@ clean-generic:
distclean-generic: distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-rm -f shellinabox/$(DEPDIR)/$(am__dirstamp)
-rm -f shellinabox/$(am__dirstamp)
maintainer-clean-generic: maintainer-clean-generic:
@echo "This command is intended for maintainers to use" @echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild." @echo "it deletes files that may require special tools to rebuild."
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
clean: clean-am clean: clean-am
clean-am: clean-binPROGRAMS clean-generic clean-libtool clean-local \ clean-am: clean-binPROGRAMS clean-generic clean-libtool clean-local \
@ -1144,7 +1092,7 @@ uninstall-am: uninstall-binPROGRAMS uninstall-dist_docDATA \
uninstall-man: uninstall-man1 uninstall-man: uninstall-man1
.MAKE: all install-am install-strip .MAKE: all check install install-am install-strip
.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \ .PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \
clean-binPROGRAMS clean-generic clean-libtool clean-local \ clean-binPROGRAMS clean-generic clean-libtool clean-local \
@ -1166,9 +1114,6 @@ uninstall-man: uninstall-man1
uninstall-man uninstall-man1 uninstall-man uninstall-man1
OBJCOPY ?= objcopy
OBJDUMP ?= objdump
libtool: $(LIBTOOL_DEPS) libtool: $(LIBTOOL_DEPS)
$(SHELL) ./config.status --recheck $(SHELL) ./config.status --recheck
@ -1273,55 +1218,71 @@ clean-local:
debian/shellinabox*.debhelper* \ debian/shellinabox*.debhelper* \
debian/shellinabox.substvars \ debian/shellinabox.substvars \
debian/tmp debian/tmp
-rm -rf GNU-stack -rm -rf shellinabox/beep.h \
shellinabox/cgi_root.h \
shellinabox/enabled.h \
shellinabox/favicon.h \
shellinabox/keyboard.h \
shellinabox/keyboard-layout.h \
shellinabox/print-styles.h \
shellinabox/root_page.h \
shellinabox/shell_in_a_box.h \
shellinabox/styles.h \
shellinabox/vt100.h
.css.o: .css.h:
@echo $(OBJCOPY) "$<" "$@" @echo od "$<" '>'"$@"
@$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`\ @mkdir -p "`dirname "$@"`"
"$<" "$@" @{ sym="`echo "$<" | $(symbolname)`"; \
@-printf '\000' >GNU-stack && \ echo "static const char $${sym}Start[]="; \
$(OBJCOPY) --add-section .note.GNU-stack=GNU-stack "$@"; \ od -vb "$<" | sed 's/[0-7]*/"/;s/ /\\/g;s/$$/"/'; \
rm -f GNU-stack echo ';'; \
echo "static const int $${sym}Size=(int)sizeof($${sym}Start);"; \
} >"$@"
.gif.o: .gif.h:
@echo $(OBJCOPY) "$<" "$@" @echo od "$<" '>'"$@"
@$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`\ @mkdir -p "`dirname "$@"`"
"$<" "$@" @{ sym="`echo "$<" | $(symbolname)`"; \
@-printf '\000' >GNU-stack && \ echo "static const char $${sym}Start[]="; \
$(OBJCOPY) --add-section .note.GNU-stack=GNU-stack "$@"; \ od -vb "$<" | sed 's/[0-7]*/"/;s/ /\\/g;s/$$/"/'; \
rm -f GNU-stack echo ';'; \
echo "static const int $${sym}Size=(int)sizeof($${sym}Start);"; \
} >"$@"
.png.o: .png.h:
@echo $(OBJCOPY) "$<" "$@" @echo od "$<" '>'"$@"
@$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`\ @mkdir -p "`dirname "$@"`"
"$<" "$@" @{ sym="`echo "$<" | $(symbolname)`"; \
@-printf '\000' >GNU-stack && \ echo "static const char $${sym}Start[]="; \
$(OBJCOPY) --add-section .note.GNU-stack=GNU-stack "$@"; \ od -vb "$<" | sed 's/[0-7]*/"/;s/ /\\/g;s/$$/"/'; \
rm -f GNU-stack echo ';'; \
echo "static const int $${sym}Size=(int)sizeof($${sym}Start);"; \
} >"$@"
.html.o: .html.h:
@echo $(OBJCOPY) "$<" "$@" @echo od "$<" '>'"$@"
@$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`\ @mkdir -p "`dirname "$@"`"
"$<" "$@" @{ sym="`echo "$<" | $(symbolname)`"; \
@-printf '\000' >GNU-stack && \ echo "static const char $${sym}Start[]="; \
$(OBJCOPY) --add-section .note.GNU-stack=GNU-stack "$@"; \ od -vb "$<" | sed 's/[0-7]*/"/;s/ /\\/g;s/$$/"/'; \
rm -f GNU-stack echo ';'; \
echo "static const int $${sym}Size=(int)sizeof($${sym}Start);"; \
} >"$@"
.ico.o: .ico.h:
@echo $(OBJCOPY) "$<" "$@" @echo od "$<" '>'"$@"
@$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`\ @mkdir -p "`dirname "$@"`"
"$<" "$@" @{ sym="`echo "$<" | $(symbolname)`"; \
@-printf '\000' >GNU-stack && \ echo "static const char $${sym}Start[]="; \
$(OBJCOPY) --add-section .note.GNU-stack=GNU-stack "$@"; \ od -vb "$<" | sed 's/[0-7]*/"/;s/ /\\/g;s/$$/"/'; \
rm -f GNU-stack echo ';'; \
echo "static const int $${sym}Size=(int)sizeof($${sym}Start);"; \
shellinabox/shell_in_a_box.o: ${top_srcdir}/shellinabox/shell_in_a_box.js \ } >"$@"
${top_srcdir}/config.h
${top_srcdir}/shellinabox/vt100.js: ${top_srcdir}/shellinabox/vt100.jspp
.jspp.js: .jspp.js:
@echo preprocess "$<" "$@" @echo preprocess "$<" "$@"
@mkdir -p "`dirname "$@"`"
sed -e "`sed -e 's/^#define *\([^ ]*\) *\(.*\)/\/^[^#]\/s\/\1\/\2 \\\\\/* \1 *\\\\\/\/g/' \ sed -e "`sed -e 's/^#define *\([^ ]*\) *\(.*\)/\/^[^#]\/s\/\1\/\2 \\\\\/* \1 *\\\\\/\/g/' \
-e t \ -e t \
-e d "$<"`" \ -e d "$<"`" \
@ -1329,21 +1290,25 @@ ${top_srcdir}/shellinabox/vt100.js: ${top_srcdir}/shellinabox/vt100.jspp
-e "s/VERSION/\"@VERSION@ (revision @VCS_REVISION@)\"/g" \ -e "s/VERSION/\"@VERSION@ (revision @VCS_REVISION@)\"/g" \
"$<" >"$@" "$<" >"$@"
.js.o: .js.h:
@echo $(OBJCOPY) "$<" "$@" @echo od "$<" '>'"$@"
@$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`\ @mkdir -p "`dirname "$@"`"
"$<" "$@" @{ sym="`echo "$<" | $(symbolname)`"; \
@-printf '\000' >GNU-stack && \ echo "static const char $${sym}Start[]="; \
$(OBJCOPY) --add-section .note.GNU-stack=GNU-stack "$@"; \ od -vb "$<" | sed 's/[0-7]*/"/;s/ /\\/g;s/$$/"/'; \
rm -f GNU-stack echo ';'; \
echo "static const int $${sym}Size=(int)sizeof($${sym}Start);"; \
} >"$@"
.wav.o: .wav.h:
@echo $(OBJCOPY) "$<" "$@" @echo od "$<" '>'"$@"
@$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`\ @mkdir -p "`dirname "$@"`"
"$<" "$@" @{ sym="`echo "$<" | $(symbolname)`"; \
@-printf '\000' >GNU-stack && \ echo "static const char $${sym}Start[]="; \
$(OBJCOPY) --add-section .note.GNU-stack=GNU-stack "$@"; \ od -vb "$<" | sed 's/[0-7]*/"/;s/ /\\/g;s/$$/"/'; \
rm -f GNU-stack echo ';'; \
echo "static const int $${sym}Size=(int)sizeof($${sym}Start);"; \
} >"$@"
# Tell versions [3.59,3.63) of GNU make to not export all variables. # Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded. # Otherwise a system limit (for SysV at least) may be exceeded.

View file

@ -156,7 +156,7 @@
#define STDC_HEADERS 1 #define STDC_HEADERS 1
/* Most recent revision number in the version control system */ /* Most recent revision number in the version control system */
#define VCS_REVISION "229" #define VCS_REVISION "230"
/* Version number of package */ /* Version number of package */
#define VERSION "2.10" #define VERSION "2.10"

2
configure vendored
View file

@ -2328,7 +2328,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_compiler_gnu=$ac_cv_c_compiler_gnu
VCS_REVISION=229 VCS_REVISION=230
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF

View file

@ -2,7 +2,7 @@ AC_PREREQ(2.57)
dnl This is the one location where the authoritative version number is stored dnl This is the one location where the authoritative version number is stored
AC_INIT(shellinabox, 2.10, markus@shellinabox.com) AC_INIT(shellinabox, 2.10, markus@shellinabox.com)
VCS_REVISION=229 VCS_REVISION=230
AC_SUBST(VCS_REVISION) AC_SUBST(VCS_REVISION)
AC_DEFINE_UNQUOTED(VCS_REVISION, "${VCS_REVISION}", AC_DEFINE_UNQUOTED(VCS_REVISION, "${VCS_REVISION}",
[Most recent revision number in the version control system]) [Most recent revision number in the version control system])

View file

@ -2402,7 +2402,7 @@ VT100.prototype.toggleCursorBlinking = function() {
}; };
VT100.prototype.about = function() { VT100.prototype.about = function() {
alert("VT100 Terminal Emulator " + "2.10 (revision 229)" + alert("VT100 Terminal Emulator " + "2.10 (revision 230)" +
"\nCopyright 2008-2010 by Markus Gutschke\n" + "\nCopyright 2008-2010 by Markus Gutschke\n" +
"For more information check http://shellinabox.com"); "For more information check http://shellinabox.com");
}; };

View file

@ -1400,8 +1400,8 @@ static void childProcess(struct Service *service, int width, int height,
// Finish all pending PAM operations. // Finish all pending PAM operations.
int status, rc; int status, rc;
check(NOINTR(waitpid(pid, &status, 0)) == pid); check(NOINTR(waitpid(pid, &status, 0)) == pid);
pam_close_session(pam, PAM_SILENT); rc = pam_close_session(pam, PAM_SILENT);
pam_end(pam, rc); pam_end(pam, rc | PAM_DATA_SILENT);
_exit(WIFEXITED(status) ? WEXITSTATUS(status) : -WTERMSIG(status)); _exit(WIFEXITED(status) ? WEXITSTATUS(status) : -WTERMSIG(status));
} }
} }

View file

@ -358,7 +358,7 @@ ShellInABox.prototype.extendContextMenu = function(entries, actions) {
}; };
ShellInABox.prototype.about = function() { ShellInABox.prototype.about = function() {
alert("Shell In A Box version " + "2.10 (revision 229)" + alert("Shell In A Box version " + "2.10 (revision 230)" +
"\nCopyright 2008-2010 by Markus Gutschke\n" + "\nCopyright 2008-2010 by Markus Gutschke\n" +
"For more information check http://shellinabox.com" + "For more information check http://shellinabox.com" +
(typeof serverSupportsSSL != 'undefined' && serverSupportsSSL ? (typeof serverSupportsSSL != 'undefined' && serverSupportsSSL ?

View file

@ -76,6 +76,20 @@
#include "shellinabox/session.h" #include "shellinabox/session.h"
#include "shellinabox/usercss.h" #include "shellinabox/usercss.h"
// Embedded resources
#include "shellinabox/beep.h"
#include "shellinabox/cgi_root.h"
#include "shellinabox/enabled.h"
#include "shellinabox/favicon.h"
#include "shellinabox/keyboard.h"
#include "shellinabox/keyboard-layout.h"
#include "shellinabox/print-styles.h"
#include "shellinabox/root_page.h"
#include "shellinabox/shell_in_a_box.h"
#include "shellinabox/styles.h"
#include "shellinabox/vt100.h"
#define PORTNUM 4200 #define PORTNUM 4200
#define MAX_RESPONSE 2048 #define MAX_RESPONSE 2048
@ -584,13 +598,6 @@ static void serveStaticFile(HttpConnection *http, const char *contentType,
httpTransfer(http, response, len); httpTransfer(http, response, len);
} }
static const char *addr(const char *a) {
// Work-around for a gcc bug that could occasionally generate invalid
// assembly instructions when optimizing code too agressively.
asm volatile("");
return a;
}
static int shellInABoxHttpHandler(HttpConnection *http, void *arg, static int shellInABoxHttpHandler(HttpConnection *http, void *arg,
const char *buf, int len) { const char *buf, int len) {
checkGraveyard(); checkGraveyard();
@ -620,49 +627,32 @@ static int shellInABoxHttpHandler(HttpConnection *http, void *arg,
// client session. // client session.
return dataHandler(http, arg, buf, len, url); return dataHandler(http, arg, buf, len, url);
} }
extern char rootPageStart[]; char *html = stringPrintf(NULL, rootPageStart,
extern char rootPageEnd[];
char *rootPage;
check(rootPage = malloc(rootPageEnd - rootPageStart + 1));
memcpy(rootPage, rootPageStart, rootPageEnd - rootPageStart);
rootPage[rootPageEnd - rootPageStart] = '\000';
char *html = stringPrintf(NULL, rootPage,
enableSSL ? "true" : "false"); enableSSL ? "true" : "false");
serveStaticFile(http, "text/html", html, strrchr(html, '\000')); serveStaticFile(http, "text/html", html, strrchr(html, '\000'));
free(html); free(html);
free(rootPage);
} else if (pathInfoLength == 8 && !memcmp(pathInfo, "beep.wav", 8)) { } else if (pathInfoLength == 8 && !memcmp(pathInfo, "beep.wav", 8)) {
// Serve the audio sample for the console bell. // Serve the audio sample for the console bell.
extern char beepStart[]; serveStaticFile(http, "audio/x-wav", beepStart, beepStart + beepSize - 1);
extern char beepEnd[];
serveStaticFile(http, "audio/x-wav", beepStart, beepEnd);
} else if (pathInfoLength == 11 && !memcmp(pathInfo, "enabled.gif", 11)) { } else if (pathInfoLength == 11 && !memcmp(pathInfo, "enabled.gif", 11)) {
// Serve the checkmark icon used in the context menu // Serve the checkmark icon used in the context menu
extern char enabledStart[]; serveStaticFile(http, "image/gif", enabledStart,
extern char enabledEnd[]; enabledStart + enabledSize - 1);
serveStaticFile(http, "image/gif", enabledStart, enabledEnd);
} else if (pathInfoLength == 11 && !memcmp(pathInfo, "favicon.ico", 11)) { } else if (pathInfoLength == 11 && !memcmp(pathInfo, "favicon.ico", 11)) {
// Serve the favicon // Serve the favicon
extern char faviconStart[]; serveStaticFile(http, "image/x-icon", faviconStart,
extern char faviconEnd[]; faviconStart + faviconSize - 1);
serveStaticFile(http, "image/x-icon", faviconStart, faviconEnd);
} else if (pathInfoLength == 13 && !memcmp(pathInfo, "keyboard.html", 13)) { } else if (pathInfoLength == 13 && !memcmp(pathInfo, "keyboard.html", 13)) {
// Serve the keyboard layout // Serve the keyboard layout
extern char keyboardLayoutStart[]; serveStaticFile(http, "text/html", keyboardLayoutStart,
extern char keyboardLayoutEnd[]; keyboardLayoutStart + keyboardLayoutSize - 1);
serveStaticFile(http, "text/html", keyboardLayoutStart, keyboardLayoutEnd);
} else if (pathInfoLength == 12 && !memcmp(pathInfo, "keyboard.png", 12)) { } else if (pathInfoLength == 12 && !memcmp(pathInfo, "keyboard.png", 12)) {
// Serve the keyboard icon // Serve the keyboard icon
extern char keyboardStart[]; serveStaticFile(http, "image/png", keyboardStart,
extern char keyboardEnd[]; keyboardStart + keyboardSize - 1);
serveStaticFile(http, "image/png", keyboardStart, keyboardEnd);
} else if (pathInfoLength == 14 && !memcmp(pathInfo, "ShellInABox.js", 14)) { } else if (pathInfoLength == 14 && !memcmp(pathInfo, "ShellInABox.js", 14)) {
// Serve both vt100.js and shell_in_a_box.js in the same transaction. // Serve both vt100.js and shell_in_a_box.js in the same transaction.
// Also, indicate to the client whether the server is SSL enabled. // Also, indicate to the client whether the server is SSL enabled.
extern char vt100Start[];
extern char vt100End[];
extern char shellInABoxStart[];
extern char shellInABoxEnd[];
char *userCSSString = getUserCSSString(userCSSList); char *userCSSString = getUserCSSString(userCSSList);
char *stateVars = stringPrintf(NULL, char *stateVars = stringPrintf(NULL,
"serverSupportsSSL = %s;\n" "serverSupportsSSL = %s;\n"
@ -677,8 +667,8 @@ static int shellInABoxHttpHandler(HttpConnection *http, void *arg,
free(userCSSString); free(userCSSString);
int stateVarsLength = strlen(stateVars); int stateVarsLength = strlen(stateVars);
int contentLength = stateVarsLength + int contentLength = stateVarsLength +
(addr(vt100End) - addr(vt100Start)) + vt100Size - 1 +
(addr(shellInABoxEnd) - addr(shellInABoxStart)); shellInABoxSize - 1;
char *response = stringPrintf(NULL, char *response = stringPrintf(NULL,
"HTTP/1.1 200 OK\r\n" "HTTP/1.1 200 OK\r\n"
"Content-Type: text/javascript; charset=utf-8\r\n" "Content-Type: text/javascript; charset=utf-8\r\n"
@ -690,8 +680,8 @@ static int shellInABoxHttpHandler(HttpConnection *http, void *arg,
check(response = realloc(response, headerLength + contentLength)); check(response = realloc(response, headerLength + contentLength));
memcpy(memcpy(memcpy( memcpy(memcpy(memcpy(
response + headerLength, stateVars, stateVarsLength)+stateVarsLength, response + headerLength, stateVars, stateVarsLength)+stateVarsLength,
vt100Start, vt100End - vt100Start) + (vt100End - vt100Start), vt100Start, vt100Size - 1) + vt100Size - 1,
shellInABoxStart, shellInABoxEnd - shellInABoxStart); shellInABoxStart, shellInABoxSize - 1);
} else { } else {
contentLength = 0; contentLength = 0;
} }
@ -703,10 +693,8 @@ static int shellInABoxHttpHandler(HttpConnection *http, void *arg,
cssStyleSheet, strrchr(cssStyleSheet, '\000')); cssStyleSheet, strrchr(cssStyleSheet, '\000'));
} else if (pathInfoLength == 16 && !memcmp(pathInfo, "print-styles.css",16)){ } else if (pathInfoLength == 16 && !memcmp(pathInfo, "print-styles.css",16)){
// Serve the style sheet. // Serve the style sheet.
extern char printStylesStart[];
extern char printStylesEnd[];
serveStaticFile(http, "text/css; charset=utf-8", serveStaticFile(http, "text/css; charset=utf-8",
printStylesStart, printStylesEnd); printStylesStart, printStylesStart + printStylesSize - 1);
} else if (pathInfoLength > 8 && !memcmp(pathInfo, "usercss-", 8)) { } else if (pathInfoLength > 8 && !memcmp(pathInfo, "usercss-", 8)) {
// Server user style sheets (if any) // Server user style sheets (if any)
struct UserCSS *css = userCSSList; struct UserCSS *css = userCSSList;
@ -850,11 +838,7 @@ static void parseArgs(int argc, char * const argv[]) {
int verbosity = MSG_DEFAULT; int verbosity = MSG_DEFAULT;
externalFiles = newHashMap(destroyExternalFileHashEntry, NULL); externalFiles = newHashMap(destroyExternalFileHashEntry, NULL);
HashMap *serviceTable = newHashMap(destroyServiceHashEntry, NULL); HashMap *serviceTable = newHashMap(destroyServiceHashEntry, NULL);
extern char stylesStart[]; check(cssStyleSheet = strdup(stylesStart));
extern char stylesEnd[];
check(cssStyleSheet = malloc(stylesEnd - stylesStart + 1));
memcpy(cssStyleSheet, stylesStart, stylesEnd - stylesStart);
cssStyleSheet[stylesEnd - stylesStart] = '\000';
for (;;) { for (;;) {
static const char optstring[] = "+hb::c:df:g:np:s:tqu:v"; static const char optstring[] = "+hb::c:df:g:np:s:tqu:v";
@ -1278,19 +1262,12 @@ int main(int argc, char * const argv[]) {
// Output a <frameset> that includes our root page // Output a <frameset> that includes our root page
check(port = serverGetListeningPort(server)); check(port = serverGetListeningPort(server));
extern char cgiRootStart[];
extern char cgiRootEnd[];
char *cgiRoot;
check(cgiRoot = malloc(cgiRootEnd - cgiRootStart + 1));
memcpy(cgiRoot, cgiRootStart, cgiRootEnd - cgiRootStart);
cgiRoot[cgiRootEnd - cgiRootStart] = '\000';
printf("X-ShellInABox-Port: %d\r\n" printf("X-ShellInABox-Port: %d\r\n"
"X-ShellInABox-Pid: %d\r\n" "X-ShellInABox-Pid: %d\r\n"
"Content-type: text/html; charset=utf-8\r\n\r\n", "Content-type: text/html; charset=utf-8\r\n\r\n",
port, getpid()); port, getpid());
printfUnchecked(cgiRoot, port, cgiSessionKey); printfUnchecked(cgiRootStart, port, cgiSessionKey);
fflush(stdout); fflush(stdout);
free(cgiRoot);
check(!NOINTR(close(fds[1]))); check(!NOINTR(close(fds[1])));
closeAllFds((int []){ launcherFd, serverGetFd(server) }, 2); closeAllFds((int []){ launcherFd, serverGetFd(server) }, 2);
logSetLogLevel(MSG_QUIET); logSetLogLevel(MSG_QUIET);

View file

@ -2402,7 +2402,7 @@ VT100.prototype.toggleCursorBlinking = function() {
}; };
VT100.prototype.about = function() { VT100.prototype.about = function() {
alert("VT100 Terminal Emulator " + "2.10 (revision 229)" + alert("VT100 Terminal Emulator " + "2.10 (revision 230)" +
"\nCopyright 2008-2010 by Markus Gutschke\n" + "\nCopyright 2008-2010 by Markus Gutschke\n" +
"For more information check http://shellinabox.com"); "For more information check http://shellinabox.com");
}; };