Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 axiom (20120301-3) unstable; urgency=low
 .
   * Apply upstream patch for 64bit scanToken issue
   * use quilt patches to replace older debian/patches_applied
Author: Camm Maguire <camm@debian.org>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- axiom-20120301.orig/lsp/Makefile.pamphlet
+++ axiom-20120301/lsp/Makefile.pamphlet
@@ -1321,13 +1321,7 @@ all:
 
 gcldir: 
 	@echo 2 building ${GCLVERSION}
-	@tar -zxf ${ZIPS}/${GCLVERSION}.tgz
-<<gcl-2.6.8pre4.socket.patch>>
-<<gcl-2.6.8pre4.libspad.patch>>
-<<gcl-2.6.8pre4.toploop.patch>>
-<<gcl-2.6.8pre4.collectfn.fix>>
-<<gcl-2.6.8pre4.read.patch>>
-<<gclConfigureMake>>
+	echo '(compiler::link (list (compile-file "${BOOKS}/tangle.lisp")) "${OUT}/lisp" (format nil "(progn (let ((*load-path* (cons ~S *load-path*))(si::*load-types* ~S)) (compiler::emit-fn t))(when (fboundp (quote si::sgc-on)) (si::sgc-on t))#-native-reloc(setq compiler::*default-system-p* t))" si::*system-directory* (quote (list #+native-reloc".o" ".lsp"))) "${OBJ}/${SYS}/lib/cfuns-c.o ${OBJ}/${SYS}/lib/sockio-c.o ${OBJ}/${SYS}/lib/libspad.a")' | gcl
 	@echo 13 finished system build on `date` | tee >gcldir
 
 ccldir: ${LSP}/ccl/Makefile
@@ -1397,13 +1397,7 @@
 
 gcldir: 
 	@echo 2 building ${GCLVERSION}
-	@tar -zxf ${ZIPS}/${GCLVERSION}.tgz
-<<gcl-2.6.8pre7.h.linux.defs.patch>>
-<<gcl-2.6.8pre7.o.read.d.patch>>
-<<gcl-2.6.8pre7.unixport.initgcl.lsp.in.patch>>
-<<gcl-2.6.8pre7.unixport.makefile.patch>>
-<<gcl-2.6.8pre7.collectfn.fix>>
-<<gclConfigureMake>>
+	echo '(compiler::link (list (compile-file "${BOOKS}/tangle.lisp")) "${OUT}/lisp" (format nil "(progn (let ((*load-path* (cons ~S *load-path*))(si::*load-types* ~S)) (compiler::emit-fn t))(when (fboundp (quote si::sgc-on)) (si::sgc-on t))#-native-reloc(setq compiler::*default-system-p* t))" si::*system-directory* (quote (list #+native-reloc".o" ".lsp"))) "${OBJ}/${SYS}/lib/cfuns-c.o ${OBJ}/${SYS}/lib/sockio-c.o ${OBJ}/${SYS}/lib/libspad.a")' | gcl
 	@echo 13 finished system build on `date` | tee >gcldir
 
 ccldir: ${LSP}/ccl/Makefile
--- axiom-20120301.orig/src/interp/Makefile.pamphlet
+++ axiom-20120301/src/interp/Makefile.pamphlet
@@ -395,15 +395,40 @@ the ``.fn'' files which are used to opti
 
 \subsection{save depsys image}
 Once the appropriate commands are in the [[${OUT}/makedep.lisp]] file
-we can load the file into a fresh image and save it. At least that's
+we can load the file into a fresh image and save it. At least that is
 how it used to work. In freebsd we cannot do this so we have to use
 a much more complicated procedure.
 This code used to read:
 \begin{verbatim}
 <<save depsys image>>=
 	@ (cd ${MNT}/${SYS}/bin ; \
-	   echo '(progn (load "${OUT}/makedep.lisp")' \
-                '(spad-save "${DEPSYS}"))' | ${LISPSYS})
+	   echo '#+native-reloc(progn\
+		    (load "${OUT}/makedep.lisp")\
+		    (spad-save "${DEPSYS}"))\
+		 #-native-reloc(progn\
+		    (setq si::*collect-binary-modules* t)\
+		    (load "${OUT}/makedep.lisp")\
+		    (compiler::link\
+			(remove-duplicates si::*binary-modules* :test (quote equal))\
+			"$(DEPSYS)"\
+			(format nil "\
+				(setq si::*collect-binary-modules* t)\
+				(let ((si::*load-path* (cons ~S si::*load-path*))\
+	                              (si::*load-types* ~S))\
+				  (compiler::emit-fn t))\
+				  (load \"$(OUT)/makedep.lisp\")\
+				  (gbc t)\
+				  (when si::*binary-modules*\
+					(error (apply (quote concatenate) (quote string)\
+					 \"Binary module load error: \" si::*binary-modules*)))\
+				  (setq si::collect-binary-modules* nil si::*binary-modules* nil)\
+				  (gbc t)\
+				  ;(fmakunbound (quote si::sgc-on))\
+				  (when (fboundp (quote si::sgc-on)) (si::sgc-on t))\
+				  (setq compiler::*default-system-p* t)"\
+				si::*system-directory* (quote (list ".lsp")))\
+				""\
+				nil))' | sed 's,\\$$,,g' | ${LISPSYS})
 @
 \end{verbatim}
 
@@ -667,7 +692,7 @@ ${SAVESYS}:	${DEPSYS} ${OBJS} ${OUT}/boo
 #	@ cp -p ${SRC}/doc/msgs/co-eng.msgs ${SPAD}/doc/msgs
 	@ echo '${PROCLAIMS}' > ${OUT}/makeint.lisp
 	@ echo '(load "${OUT}/nocompil")' >> ${OUT}/makeint.lisp
-	@ echo '(load "${OUT}/bookvol5")' >> ${OUT}/makeint.lisp
+	@ echo '(load "${OUT}/bookvol5.lsp")' >> ${OUT}/makeint.lisp
 	@ echo '(load "${OUT}/util")' >> ${OUT}/makeint.lisp
 	@ echo '(in-package "BOOT")' >> ${OUT}/makeint.lisp
 	@ touch ${TIMESTAMP}
@@ -695,11 +720,34 @@ ${SAVESYS}:	${DEPSYS} ${OBJS} ${OUT}/boo
 	@ echo '#+:akcl (setq compiler::*suppress-compiler-notes* t)' \
                 >> ${OUT}/makeint.lisp
 	@ echo '#+:akcl (si::gbc-time 0)' >> ${OUT}/makeint.lisp
-	@ echo '#+:akcl (setq si::*system-directory* "${SPAD}/bin/")' \
-               >> ${OUT}/makeint.lisp
-	@ (cd ${OBJ}/${SYS}/bin ; \
-	  echo '(progn (gbc t) (load "${OUT}/makeint.lisp")' \
-                 '(gbc t) (user::spad-save "${SAVESYS}"))' | ${LISPSYS} )
+	@ (cd ${OBJ}/${SYS}/bin ;\
+	   echo '#+native-reloc(progn \
+		      (load "${OUT}/makeint.lisp")\
+		      (gbc t)\
+		      (user::spad-save "${SAVESYS}"))\
+	        #-native-reloc(progn\
+		      (setq si::*collect-binary-modules* t)\
+		      (load "${OUT}/makeint.lisp")\
+		      (compiler::link\
+			(remove-duplicates si::*binary-modules* :test (quote equal))\
+			"$(SAVESYS)"\
+			(format nil "\
+				(let ((si::*load-path* (cons ~S si::*load-path*))\
+                                      (si::*load-types* ~S))\
+				 (compiler::emit-fn t))\
+				 (setq si::*collect-binary-modules* t)\
+				 (load \"$(OUT)/makeint.lisp\")\
+				 (when si::*binary-modules*\
+					(error (apply (quote concatenate) (quote string)\
+					 \"Binary module load error: \" si::*binary-modules*)))\
+				 (setq si::collect-binary-modules* nil si::*binary-modules* nil)\
+				 (gbc t)\
+				 ;(fmakunbound (quote si::sgc-on))\
+				 (when (fboundp (quote si::sgc-on)) (si::sgc-on t))\
+				 (setq compiler::*default-system-p* t boot::|$$SpadServer| nil boot::$$openServerIfTrue t)"\
+			        si::*system-directory* (quote (list ".lsp")))\
+		        "$(OBJ)/$(SYS)/lib/sockio-c.o $(OBJ)/$(SYS)/lib/cfuns-c.o $(OBJ)/$(SYS)/lib/libspad.a"\
+		        nil))' | sed 's,\\$$,,g' | $(LISPSYS))
 	@ echo 6 ${SAVESYS} created
 	@ cp ${SAVESYS} ${AXIOMSYS}
 	@ echo 6a ${AXIOMSYS} created
--- axiom-20120301.orig/src/lib/pixmap.c.pamphlet
+++ axiom-20120301/src/lib/pixmap.c.pamphlet
@@ -81,7 +81,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
 /* returns true if the file exists */
 
 int
-file_exists(char *file)
+ax_file_exists(char *file)
 {
     FILE *f;
 
@@ -96,10 +96,10 @@ file_exists(char *file)
 {
     char com[512], zfile[512];
 
-    if (file_exists(file))
+    if (ax_file_exists(file))
         return fopen(file, mode);
     sprintf(zfile, "%s.Z", file);
-    if (file_exists(zfile)) {
+    if (ax_file_exists(zfile)) {
         sprintf(com, "gunzip -c %s.Z 2>/dev/null", file);
         return popen(com, mode);
     }
--- axiom-20120301.orig/src/input/monitortest.input.pamphlet
+++ axiom-20120301/src/input/monitortest.input.pamphlet
@@ -354,10 +354,11 @@ Check that monitoring is not occurring
 --RValue = (NIL NIL NIL NIL)
 --E 26
 
+\begin{chunk}{*}
 )spool 
 )lisp (bye)
  
-\end{chunk}
+\end{chunk}{*}
 \eject
 \begin{thebibliography}{99}
 \bibitem{1} nothing
--- axiom-20120301.orig/src/etc/Makefile.pamphlet
+++ axiom-20120301/src/etc/Makefile.pamphlet
@@ -24,7 +24,7 @@ ${MNT}/${SYS}/algebra/*.daase: ${INT}/al
 	@ cp ${SRC}/doc/topics.data ${INT}/algebra
 	@ cp ${SRC}/doc/topics.data ${INT}/algebra
 	@ (cd ${INT}/algebra ; \
-           echo ')lisp (make-databases "" nil)' | ${INTERPSYS} )
+           echo ')lisp #+native-reloc(make-databases "" nil) #-native-reloc(system "cp -pr ${SRC}/../debian/*.daase ${INT}/algebra/")' | ${INTERPSYS} )
 	@ cp -pr ${INT}/algebra/*.daase ${MNT}/${SYS}/algebra
 
 @
--- axiom-20120301.orig/src/algebra/Makefile.pamphlet
+++ axiom-20120301/src/algebra/Makefile.pamphlet
@@ -17251,7 +17251,7 @@ ${MID}/%.o: ${MID}/%.lsp
 	  else \
 	   echo '(progn (in-package (quote boot)) (compile-file "$*.lsp" :output-file "$*.o"))' | ${DEPSYS} >${TMP}/trace ; \
 	  fi )
-	@ cp ${MID}/$*.o ${OUT}/$*.o
+	@ mkdir -p $$(dirname $(OUT)/$*.o) && cp ${MID}/$*.o ${OUT}/$*.o
 
 @
 <<genericSPADfiles>>=
