usr/bin
+usr/lib/factor
usr/share/factor
doc/internals.txt
doc/theory.pdf
doc/handbook
-examples
-library
-version.factor
# SITE_CFLAGS=-fPIC -ffast-math -funsigned-char -mpowerpc -mpowerpc-gpopt -mpowerpc-gfxopt -maltivec -mabi=altivec -mtune=G4 -mcpu=G4 -pipe
# SITE_CFLAGS=-march=pentium4
+VERSION=0.80
+FARCH=$(shell sh debian/architecture.sh)
+
configure: configure-stamp
configure-stamp:
build-stamp: configure-stamp
dh_testdir
- $(MAKE) linux-`sh debian/architecture.sh`
-####### Build the bootstrap image
- echo "USE: image \"`sh debian/architecture.sh`\" make-image 0 exit" | factor-vm debian/make-bootstrap-images.factor
-# wget http://factorcode.org/boot.image.`sh debian/architecture.sh`
-####### Build the factor image
- ./f boot.image.`sh debian/architecture.sh` -libraries:sdl:name=libSDL.so -libraries:freetype:name=libfreetype.so
-# cp /usr/share/factor/f /usr/share/factor/factor.image .
-####### Build the extended image
+ $(MAKE) linux-$(FARCH)
+ mv f runtime
+ # Build the bootstrap image
+ echo "USE: image \"$(FARCH)\" make-image" | factor-run --basic debian/make-bootstrap-images.factor # || wget http://factorcode.org/boot.image.$(FARCH)
+ mv boot.image.$(FARCH) boot.image
+ # Build the factor image
+ ./runtime boot.image -libraries:sdl:name=libSDL.so -libraries:freetype:name=libfreetype.so
+ mv factor.image basic.image
+ # Build the extended image
sqlite3 contrib/sqlite/test.db < contrib/sqlite/test.txt
-# $(CC) $(CFLAGS) -L /usr/X11R6/lib -shared -o contrib/factory/simple-error-handler.so contrib/factory/simple-error-handler.c -lX11
- echo 'USING: image kernel ; "extended.image" save-image 0 exit' | ./f factor.image contrib/load.factor
-####### Build the documentation
+ $(CC) $(CFLAGS) -L /usr/X11R6/lib -shared -o contrib/factory/simple-error-handler.so contrib/factory/simple-error-handler.c -lX11
+ echo 'USING: image kernel ; "extended.image" save-image 0 exit' | ./runtime basic.image contrib/load.factor
+ # Build the documentation
cd doc && for i in *.eps; do epstopdf $$i; done
cd doc && rubber --pdf theory
cd doc && sh makedoc
dh_testroot
rm -f build-stamp configure-stamp
-$(MAKE) clean
- -rm -f f factor.image extended.image
+ -rm -f f runtime factor.image boot.image boot.image.$(FARCH) basic.image extended.image
dh_clean
install: build
dh_testroot
dh_clean -k
dh_installdirs
- install f factor.image extended.image $(CURDIR)/debian/factor/usr/share/factor
- install -m 755 debian/factor-vm $(CURDIR)/debian/factor/usr/bin
+ # Install binary files
+ install runtime boot.image basic.image extended.image $(CURDIR)/debian/factor/usr/lib/factor
+ # Install source files
+ install contrib examples fonts library version.factor $(CURDIR)/debian/factor/usr/share/factor
+ # Install wrapper scripts
+ install -m 755 debian/scripts/factor-* $(CURDIR)/debian/factor/usr/bin
binary-indep: build install
--- /dev/null
+#!/bin/sh
+# Help function
+###############
+help () {
+ cat <<EOF
+Usage: factor-export IMAGE FILE [ WORDS ]
+
+Export words from a Factor image as ASCII source code.
+
+Options:
+
+ none so far
+
+ If FILE is a single hypen (-), code will be written to
+ standard output.
+
+This is useful for moving Factor code in bulk between
+incompatible systems, such as different architectures or
+when the image format changes. An example of this is:
+
+ factor-export image.x86 | ssh host factor-import image.ppc
+
+It is also useful for managing changes in a Factor codebase.
+EOF
+ exit 0
+}
+
+# Default values
+################
+
+# Argument parsing
+##################
+
+# Logic
+#######
+echo 'Sorry, this is just a stub at the moment.'
+help
+exit 1
--- /dev/null
+#!/bin/sh
+# Help function
+###############
+help () {
+ cat <<EOF
+Usage: factor-import IMAGE FILE
+
+Export words from a Factor image as ASCII source code.
+
+Options:
+
+ none so far
+
+ If FILE is a single hypen (-), code will be read from
+ standard input.
+
+This is useful for moving Factor code in bulk between
+incompatible systems, such as different architectures or
+when the image format changes. An example of this is:
+
+ factor-export image.x86 | ssh host factor-import image.ppc
+
+It is also useful for managing changes in a Factor codebase.
+EOF
+ exit 0
+}
+
+# Default values
+################
+
+# Argument parsing
+##################
+
+# Logic
+#######
+echo 'Sorry, this is just a stub at the moment.'
+help
+exit 1
--- /dev/null
+#!/bin/sh
+# Help function
+###############
+help () {
+ cat <<EOF
+Usage: factor-init -o DEST [ OPTION ]
+
+Create an editable image from one of the default images that
+is distributed with the Factor runtime.
+
+Options:
+
+ -b copy the basic image (default)
+ -e copy the extended image (includes contrib libs)
+ -i FILE copy the image FILE
+ -o FILE write the editable image to FILE
+ -h print this help information
+EOF
+ exit 0
+}
+
+# Default values
+################
+BINARY_PATH='/usr/lib/factor'
+SRC="$BINARY_PATH/basic.image"
+DST=''
+
+# Argument parsing
+##################
+while getopts "hbei:o:" x
+do
+ case "$x" in
+ b) SRC="$BINARY_PATH/basic.image";;
+ e) SRC="$BINARY_PATH/extended.image";;
+ i) SRC="$OPTARG";;
+ o) DST="$OPTARG";;
+ h) help;;
+ esac
+done
+
+# Logic
+#######
+if test -n "$DST"; then
+ exec /bin/cp -v "$SRC" "$DST"
+else
+ help
+fi
--- /dev/null
+#!/bin/sh
+# Help function
+###############
+help () {
+ cat <<EOF
+Usage: factor-run IMAGE [ OPTIONS, FILES ]
+
+Launch the factor runtime using an initial image IMAGE, taking
+input from each FILE in turn and then starting a listener.
+
+If IMAGE is -b or --basic, the basic image that is distributed
+with factor will be used. If IMAGE is -e or --extended, the
+extended image that is distributed with factor will be used.
+
+Library options:
+
+ -resource-path=PATH
+ Specify the path where factor libraries
+
+ -shell={tty, ui, telnet}
+ Specify what sort of listener to use.
+
+ -port=N
+ When using the "telnet" listener, specify the port
+ to listen on.
+
+Runtime options (n is a number):
+
+ +Dn Data stack size, kilobytes
+ +Cn Call stack size, kilobytes
+ +Gn Number of generations, must be >= 2
+ +Yn Size of n-1 youngest generations, megabytes
+ +An Size of tenured and semi-spaces, megabytes
+ +Xn Code heap size, megabytes
+EOF
+ exit 0
+}
+
+# Default values
+################
+BINARY_PATH='/usr/lib/factor'
+RESOURCE_PATH='/usr/share/factor'
+IMAGE="$BINARY_PATH/basic.image"
+RUNTIME="$BINARY_PATH/runtime"
+
+# Logic
+#######
+if test 0 -eq $#
+then
+ # As a 'quick start' behaviour, so that new users can
+ # get something to play with immediately.
+ echo "Launching the Factor runtime with a read-only basic image."
+ echo "Use \`\"filename\" save-image' to write an editable image."
+ exec "$RUNTIME" "$IMAGE" -resource-path="$RESOURCE_PATH"
+else
+ case "$1" in
+ -h|--help)
+ help
+ ;;
+ -b|--basic)
+ IMAGE="$BINARY_PATH/basic.image"
+ ;;
+ -e|--extended)
+ IMAGE="$BINARY_PATH/extended.image"
+ ;;
+ *)
+ IMAGE="$1"
+ ;;
+ esac
+ shift
+ exec "$RUNTIME" "$IMAGE" -resource-path="$RESOURCE_PATH" "$@"
+fi