shithub: epublish

Download patch

ref: a58f0517af4ed0a30b1a6d2f239d796eaf059cb1
parent: f7c2cdeb04780a7fa581b6fcfa985fb160294a1e
author: sirjofri <sirjofri@sirjofri.de>
date: Fri Sep 10 02:34:39 EDT 2021

adds installation routine, rewires some stuff

--- a/README
+++ b/README
@@ -6,3 +6,16 @@
 
 See the `sample` directory for an example.  For testing, you might
 want to bind . to /bin.
+
+INSTALLATION
+
+the provided mkfile is used for installation. Running it without arguments is safe and gives some details:
+
+   ; mk
+   targets: install
+   configuration:
+      BIN=/rc/bin/epublish
+      LIB=/lib/epublish
+   use mk 'BIN=/path' to override
+
+mk install tries to install the tools to the given paths.
--- a/mkfile
+++ b/mkfile
@@ -1,25 +1,14 @@
-ebook:V: $ebook
-	echo built $ebook
+BIN=/rc/bin/epublish
+LIB=/lib/epublish
+BINFILES=txt2ebook txt2ms
 
-ms:V: $ms
-	echo built $ms
+info:VQ:
+	echo targets: install
+	echo configuration:
+	echo '   BIN='$BIN
+	echo '   LIB='$LIB
+	echo use mk '''BIN=/path''' to override
 
-$ebook:V: $textsource $ebooksource
-	rfork
-	ramfs
-	for (f in $textsource/*){
-		fname=`{basename $f | sed 's/\.[a-zA-Z0-9]*$//g'}
-		txt2ebook $EBOOKARGS <$f >/tmp/$fname.xhtml
-	}
-	bind -a $ebooksource /tmp
-	@{cd /tmp && zip .} >$target
-
-$ms:V: $textsource $mssource
-	rfork
-	ramfs
-	for (f in $textsource/*){
-		fname=`{basename $f}
-		txt2ms $MSARGS <$f >/tmp/$fname.ms
-	}
-	bind -a $mssource /tmp
-	cat /tmp/* >$target
+install:V:
+	mkdir -p $BIN && cp $BINFILES $BIN
+	mkdir $LIB && cp mkfile.tool $LIB/mkfile
--- /dev/null
+++ b/mkfile.tool
@@ -1,0 +1,27 @@
+bindir=`{ if (~ $#bindir 1) echo $bindir; if not echo /rc/bin/epublish }
+
+ebook:V: $ebook
+	echo built $ebook
+
+ms:V: $ms
+	echo built $ms
+
+$ebook:V: $textsource $ebooksource
+	rfork
+	ramfs
+	for (f in $textsource/*){
+		fname=`{basename $f | sed 's/\.[a-zA-Z0-9]*$//g'}
+		$bindir/txt2ebook $EBOOKARGS <$f >/tmp/$fname.xhtml
+	}
+	bind -a $ebooksource /tmp
+	@{cd /tmp && zip .} >$target
+
+$ms:V: $textsource $mssource
+	rfork
+	ramfs
+	for (f in $textsource/*){
+		fname=`{basename $f}
+		$bindir/txt2ms $MSARGS <$f >/tmp/$fname.ms
+	}
+	bind -a $mssource /tmp
+	cat /tmp/* >$target
--- a/sample/mkfile
+++ b/sample/mkfile
@@ -3,6 +3,7 @@
 mssource=mssrc
 ebook=sample.epub
 ms=sample.ms
+bindir=..
 
 MSARGS=-v 'firstheader=1'
 EBOOKARGS=-v 'firstheader=1'
@@ -12,4 +13,4 @@
 sample.pdf: sample.ms
 	troff -ms <sample.ms | lp -dstdout | ps2pdf > $target
 
-<../mkfile
+<../mkfile.tool