]> gitweb.factorcode.org Git - factor.git/commitdiff
Refactored debian package structure.
authorTrent Buck <trentbuck@gmail.com>
Thu, 19 Jan 2006 20:14:36 +0000 (20:14 +0000)
committerTrent Buck <trentbuck@gmail.com>
Thu, 19 Jan 2006 20:14:36 +0000 (20:14 +0000)
debian/dirs
debian/docs
debian/rules
debian/scripts/factor-export [new file with mode: 0644]
debian/scripts/factor-import [new file with mode: 0644]
debian/scripts/factor-init [new file with mode: 0644]
debian/scripts/factor-run [new file with mode: 0644]

index 5da8268f4a78f5dc3f2e7fc5cd4c8a132b9bf29a..9a22bace1cd1a740d5bd2e23d810712f24dea2bc 100644 (file)
@@ -1,2 +1,3 @@
 usr/bin
+usr/lib/factor
 usr/share/factor
index 531a735f5c33a331a13b4ec8c2bf250ae4cb7b05..b873b8cdfe4bf0b189def1de94d16a675cfc89c9 100644 (file)
@@ -6,6 +6,3 @@ doc/handbook.pdf
 doc/internals.txt
 doc/theory.pdf
 doc/handbook
-examples
-library
-version.factor
index 80295290e5bf51a07e119a3323f61584370bbb03..41de1acb98e2b2d594af6f354e161e5d4201cc0b 100644 (file)
@@ -4,6 +4,9 @@
 # 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:
@@ -14,18 +17,19 @@ build: build-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
@@ -36,7 +40,7 @@ clean:
        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
@@ -44,8 +48,12 @@ 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
 
diff --git a/debian/scripts/factor-export b/debian/scripts/factor-export
new file mode 100644 (file)
index 0000000..a1af34b
--- /dev/null
@@ -0,0 +1,38 @@
+#!/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
diff --git a/debian/scripts/factor-import b/debian/scripts/factor-import
new file mode 100644 (file)
index 0000000..cfedf69
--- /dev/null
@@ -0,0 +1,38 @@
+#!/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
diff --git a/debian/scripts/factor-init b/debian/scripts/factor-init
new file mode 100644 (file)
index 0000000..7be0548
--- /dev/null
@@ -0,0 +1,47 @@
+#!/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
diff --git a/debian/scripts/factor-run b/debian/scripts/factor-run
new file mode 100644 (file)
index 0000000..6490c82
--- /dev/null
@@ -0,0 +1,72 @@
+#!/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