Description: debianization -- documentation
 Address Debian Policy requirements for documentation;
 and silence the composition machinery.
 This is a Debian centric patch.
Origin: vendor, Debian
Author: Jerome Benoit <calculus@rezozer.net>
Last-Update: 2014-11-06

--- a/docs/Makefile
+++ b/docs/Makefile
@@ -4,32 +4,39 @@
 
 TOPSRCDIR?=..
 PKGDOCDIR?=/usr/share/doc/tachyon
+PKGEXAMPLESDIR?=$(PKGDOCDIR)/examples
 
-LATEX=latex
-DVIPS=dvips
 LATEX2HTML=latex2html
-PDFLATEX=pdflatex
-MAKEINDEX=makeindex
+PDFLATEX=pdflatex -no-shell-escape -interaction=batchmode
+MAKEINDEX=makeindex -q
 
 default:
 	@echo "Select documentation to build:"
 	@echo "------------------------------"
 	@echo " all - All supported file formats"
 	@echo "html - HTML"
-	@echo "  ps - Adobe PostScript"
 	@echo " pdf - Adobe PDF "
 
-all: html ps pdf
-
-ps: tachyon.ps
+all: html pdf
 
 pdf: tachyon.pdf
 
 html: tachyon/tachyon.html
 
-tachyon/tachyon.html :
+listof_demo_SOURCES = \
+		glwin.h glwin.c \
+	mainanim.c \
+	animspheres.c \
+	animspheres2.c \
+	hypertex.c \
+	fire.c \
+	animskull.c \
+	tgatoyuv.c
+
+tachyon/tachyon.html : tachyon.pdf
 	rm -rf tachyon
 	$(LATEX2HTML) \
+		-verbosity 2 \
 		-local_icons \
 		-split 5 \
 		-toc_depth 4 \
@@ -38,19 +45,8 @@
 		-address "john.stone@gmail.com" \
 		-up_url "http://www.photonlimited.com/" \
 		-up_title "photonlimited.com, home of Tachyon" \
-		tachyon
-
-tachyon.ps : tachyon.dvi
-	$(DVIPS) tachyon.dvi -o tachyon.ps
-
-tachyon.dvi :
-	$(LATEX) tachyon
-	$(MAKEINDEX) tachyon
-	$(LATEX) tachyon
-	$(MAKEINDEX) tachyon
-	$(LATEX) tachyon
-	$(MAKEINDEX) tachyon
-	$(LATEX) tachyon
+		-info 0 \
+		tachyon 1> tachyon.html.log 2>&1
 
 tachyon.pdf :
 	$(PDFLATEX) tachyon
@@ -62,11 +58,10 @@
 	$(PDFLATEX) tachyon
 
 clean :
-	-rm -f *.aux *.dvi *.idx *.lof *.log *.lot *.pdf *.ps *.toc *.ilg *.ind
+	-rm -f *.aux *.idx *.lof *.log *.lot *.pdf *.toc *.ilg *.ind
+	-rm tachyon.html.log
 
 distclean: clean
-	-rm tachyon.dvi
-	-rm tachyon.ps
 	-rm tachyon.pdf
 	-rm -rf tachyon
 
@@ -75,5 +70,17 @@
 install: all
 	mkdir -p $(DESTDIR)$(PKGDOCDIR)
 	mkdir -p $(DESTDIR)$(PKGDOCDIR)/html
-	cp -t $(DESTDIR)$(PKGDOCDIR) tachyon.dvi tachyon.ps tachyon.pdf
-	cp -t $(DESTDIR)$(PKGDOCDIR)/html tachyon/tachyon.css tachyon/*.html tachyon/*.png
+	mkdir -p $(DESTDIR)$(PKGEXAMPLESDIR)
+	mkdir -p $(DESTDIR)$(PKGEXAMPLESDIR)/scenes
+	mkdir -p $(DESTDIR)$(PKGEXAMPLESDIR)/demosrc
+	cp -p $(TOPSRCDIR)/unix/README $(DESTDIR)$(PKGDOCDIR)/README.unix
+	cp -p -t $(DESTDIR)$(PKGDOCDIR) tachyon.pdf
+	cp -p -t $(DESTDIR)$(PKGDOCDIR)/html tachyon/tachyon.css tachyon/*.html tachyon/*.png
+	cp -pr -t $(DESTDIR)$(PKGEXAMPLESDIR)/scenes $(TOPSRCDIR)/scenes/*
+	cp -p -t $(DESTDIR)$(PKGEXAMPLESDIR)/demosrc $(addprefix $(TOPSRCDIR)/demosrc/, $(listof_demo_SOURCES))
+	cp -p -t $(DESTDIR)$(PKGEXAMPLESDIR)/scenes $(TOPSRCDIR)/debian/adhoc/scenes/action.sh
+	cp -p -t $(DESTDIR)$(PKGEXAMPLESDIR)/demosrc $(TOPSRCDIR)/debian/adhoc/demosrc/Makefile
+	rdfind -outputname /dev/null -removeidentinode false -makesymlinks true $(DESTDIR)$(PKGDOCDIR)/html
+	symlinks -r -c -s -v $(DESTDIR)$(PKGDOCDIR)/html
+	rdfind -outputname /dev/null -removeidentinode false -makesymlinks true $(DESTDIR)$(PKGEXAMPLESDIR)/scenes
+	symlinks -r -c -s -v $(DESTDIR)$(PKGEXAMPLESDIR)/scenes
--- /dev/null
+++ b/pkgextra/volpack/data/Makefile
@@ -0,0 +1,35 @@
+TOPSRCDIR?=../../..
+PKGDOCDIR?=/usr/share/doc/tachyon
+PKGEXAMPLESDIR?=$(PKGDOCDIR)/examples
+
+CFLAGS += -Wall -Wno-unused-result
+
+listof_DATA = \
+	engine/engine.den \
+	brain/brain.den
+
+default:
+
+den2raw: den2raw.c denfile.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^
+
+clean:
+
+distclean: clean
+	rm -f den2raw
+	rm -f $(listof_DATA)
+
+check:
+
+install: den2raw $(listof_DATA)
+	mkdir -p $(DESTDIR)$(PKGDOCDIR)
+	mkdir -p $(DESTDIR)$(PKGEXAMPLESDIR)
+	mkdir -p $(DESTDIR)$(PKGEXAMPLESDIR)/scenes
+	mkdir -p $(DESTDIR)$(PKGEXAMPLESDIR)/scenes/vol
+	for d in $(listof_DATA); do \
+		r=$${d##*/} ; r=$${r%.den}.XXX ; \
+		./den2raw $$d $(DESTDIR)$(PKGEXAMPLESDIR)/scenes/vol/$$r ; \
+	done
+
+% : %.Z
+	gzip --decompress --to-stdout $< > $@
--- a/pkgextra/volpack/data/denfile.c
+++ b/pkgextra/volpack/data/denfile.c
@@ -5,6 +5,9 @@
  * See the file dencopy.c for sample usage.
  */
 
+#include <stdlib.h>
+#include <fcntl.h>
+#include <unistd.h>
 #include <stdio.h>
 
 #ifndef MIN
@@ -17,6 +20,11 @@
 
 #define MAX_READ_SIZE	8192	/* maximum # of bytes per read(2) call */
 
+int read_bytes();
+int read_shorts();
+int read_words();
+int write_bytes();
+
 /*
  * read_den
  *
@@ -200,6 +208,40 @@
 }
 
 /*
+ * write_raw
+ *
+ * Write an array of volume data to a .raw file.  Return 1 on success,
+ * 0 on failure.
+ */
+
+int
+write_raw(filename, data, xlen, ylen, zlen)
+char *filename;		/* name of file to create */
+unsigned char *data;	/* volume data */
+int xlen, ylen, zlen;	/* volume dimensions */
+{
+    int fd;			/* file descriptor */
+    int map_length;		/* Total number of densities in map          */
+				/*   (= product of lens)                     */
+
+    /* open file */
+    if ((fd = creat(filename, 0644)) < 0) {
+	fprintf(stderr, "cannot open file %s\n", filename);
+	return(0);
+    }
+
+    /* write the header */
+    map_length = xlen * ylen * zlen;
+    if (!write_bytes(fd, (char *)data, map_length)) {
+	close(fd);
+	fprintf(stderr, "cannot write to file %s\n", filename);
+	return(0);
+    }
+    close(fd);
+    return(1);
+}
+
+/*
  * read_bytes
  *
  * Read data from a file.  The data is assumed to be a sequence of bytes,
@@ -210,6 +252,7 @@
  * error or the full number of bytes could not be read.
  */
 
+int
 read_bytes(fd, buf, bytecount)
 int fd;		/* file descriptor to read from */
 char *buf;	/* memory in which to store data */
@@ -238,6 +281,7 @@
  * error or the full number of shorts could not be read.
  */
 
+int
 read_shorts(fd, sbuf, shortcount, swap)
 int fd;		/* file descriptor to read from */
 short *sbuf;	/* memory in which to store data */
@@ -286,6 +330,7 @@
  * error or the full number of words could not be read.
  */
 
+int
 read_words(fd, wbuf, wordcount, swap)
 int fd;		/* file descriptor to read from */
 int *wbuf;	/* memory in which to store data */
@@ -334,6 +379,7 @@
  * Return value is 1 if the write was succesful or 0 if there was an error.
  */
 
+int
 write_bytes(fd, buf, bytecount)
 int fd;		/* file descriptor to write to */
 char *buf;	/* memory containing data */
--- /dev/null
+++ b/pkgextra/volpack/data/den2raw.c
@@ -0,0 +1,43 @@
+/*
+ * den2raw.c
+ *
+ * Convert a density file to a raw file. The destination file is in the native byte ordering,
+ * even if the source file is not.
+ *
+ * Usage: den2raw src.den dst.raw
+ * Compilation: cc -o den2raw den2raw.c denfile.c
+ */
+
+#define _GNU_SOURCE
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+int main(int argc, char *argv[]) {
+	unsigned char *data, *read_den(), write_raw();
+	int xlen, ylen, zlen;
+	char *rawfilename;
+	size_t rawfilenamelen;
+
+	if (argc != 3) {
+		fprintf(stderr, "Usage: dencopy src.den dst.raw\n");
+		exit(1);
+    }
+	if ((data = read_den(argv[1], &xlen, &ylen, &zlen)) == NULL) {
+		fprintf(stderr, "den2raw: read failed\n");
+		exit(1);
+		}
+	rawfilenamelen=strlen(argv[2]);
+	if ((3 < rawfilenamelen) && !(strcasecmp(argv[2]+rawfilenamelen-4, ".XXX"))) {
+		asprintf(&rawfilename,"%sXXXXXXXXXXXXXXXXXXXXxXXXXXXXXXXXXXXXXXXXXxXXXXXXXXXXXXXXXXXXXX", argv[2]);
+		sprintf(rawfilename+rawfilenamelen-3, "%dx%dx%d", xlen, ylen, zlen);
+		}
+	else {
+		asprintf(&rawfilename,"%s", argv[2]);
+		}
+	if (!write_raw(rawfilename, data, xlen, ylen, zlen)) {
+		fprintf(stderr, "den2raw: write failed\n");
+		exit(1);
+		}
+	free(rawfilename);
+	return(0); }
--- /dev/null
+++ b/pkgextra/virtual-reality/graphics/Makefile
@@ -0,0 +1,28 @@
+TOPSRCDIR?=../../..
+PKGDOCDIR?=/usr/share/doc/tachyon
+PKGEXAMPLESDIR?=$(PKGDOCDIR)/examples
+
+listof_DATA_Z = \
+	$(wildcard objects/tpoly/*.tpoly.Z)
+
+listof_DATA = \
+	$(patsubst %.Z,%, $(listof_DATA_Z))
+
+default:
+
+clean:
+
+distclean: clean
+	rm -f $(listof_DATA)
+
+check:
+
+install: $(listof_DATA)
+	mkdir -p $(DESTDIR)$(PKGDOCDIR)
+	mkdir -p $(DESTDIR)$(PKGEXAMPLESDIR)
+	mkdir -p $(DESTDIR)$(PKGEXAMPLESDIR)/scenes
+	mkdir -p $(DESTDIR)$(PKGEXAMPLESDIR)/scenes/tpoly
+	cp -p -t $(DESTDIR)$(PKGEXAMPLESDIR)/scenes/tpoly $(listof_DATA)
+
+% : %.Z
+	gzip --decompress --to-stdout $< > $@
