about summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.gitignore9
-rw-r--r--FreeBSD/Makefile8
-rw-r--r--Linux/Makefile8
-rw-r--r--Makefile84
-rw-r--r--NetBSD/Makefile8
-rw-r--r--OpenBSD/Makefile9
-rw-r--r--POSIX/Makefile8
-rw-r--r--README.745
-rw-r--r--exman.128
-rw-r--r--exman.in (renamed from exman.sh)8
-rw-r--r--freebsd.url1
-rw-r--r--linux.url1
-rw-r--r--netbsd-comp.url1
-rw-r--r--netbsd-man.url1
-rw-r--r--openbsd-comp.url1
-rw-r--r--openbsd-man.url1
-rw-r--r--posix.url1
-rw-r--r--system.mk27
18 files changed, 139 insertions, 110 deletions
diff --git a/.gitignore b/.gitignore
index 8f9e5a6..d5017e9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,4 @@
-*.tar
+*.tar.xz
+*.tgz
+*.txz
 exman
-freebsd/
-linux/
-netbsd/
-openbsd/
-posix/
diff --git a/FreeBSD/Makefile b/FreeBSD/Makefile
new file mode 100644
index 0000000..57e6e7b
--- /dev/null
+++ b/FreeBSD/Makefile
@@ -0,0 +1,8 @@
+SYSTEM = FreeBSD
+VERSION = 12.2-RELEASE
+MIRROR = https://download.FreeBSD.org/ftp/releases/amd64/${VERSION}
+DISTFILES = base.txz
+FILES = ./usr/share/man/man[1-9]/
+STRIP = 4
+
+.include "../system.mk"
diff --git a/Linux/Makefile b/Linux/Makefile
new file mode 100644
index 0000000..c81394d
--- /dev/null
+++ b/Linux/Makefile
@@ -0,0 +1,8 @@
+SYSTEM = Linux
+VERSION = 5.09
+MIRROR = https://mirrors.edge.kernel.org/pub/linux/docs/man-pages
+DISTFILES = man-pages-${VERSION}.tar.xz
+FILES = man-pages-${VERSION}/man[1-9]/
+STRIP = 1
+
+.include "../system.mk"
diff --git a/Makefile b/Makefile
index 80c41b6..275d6ac 100644
--- a/Makefile
+++ b/Makefile
@@ -1,63 +1,41 @@
-PREFIX = /usr/local
-SHAREDIR = ${PREFIX}/share
-MANDIR = ${SHAREDIR}/man
+PREFIX ?= /usr/local
+SHAREDIR ?= ${PREFIX}/share
+MANDIR ?= ${SHAREDIR}/man
+EXMANDIR ?= ${SHAREDIR}/exman
 
-CURL ?= curl
-TAR ?= tar
+SYSTEMS += FreeBSD
+SYSTEMS += Linux
+SYSTEMS += NetBSD
+SYSTEMS += OpenBSD
+SYSTEMS += POSIX
 
-SYSTEMS += freebsd
-SYSTEMS += linux
-SYSTEMS += netbsd
-SYSTEMS += openbsd
-SYSTEMS += posix
+all: exman
+.for system in ${SYSTEMS}
+	${MAKE} -C ${system} ${.TARGET}
+.endfor
 
-all: exman ${SYSTEMS}
+.SUFFIXES: .in
 
-.SUFFIXES: .tar .url
-
-.PRECIOUS: ${SYSTEMS:=.tar}
-
-.url.tar:
-	${CURL} -f -o $@ "$$(cat $<)"
-
-.tar:
-	mkdir -p $@
-	${TAR} -x -f $< -C $@ --strip-components ${STRIP.$@} ${FILES.$@}
-
-netbsd: netbsd-man.tar netbsd-comp.tar
-	mkdir -p $@
-	${TAR} -x -f netbsd-man.tar -C $@ --strip-components ${STRIP.$@} ${FILES.$@}
-	${TAR} -x -f netbsd-comp.tar -C $@ --strip-components ${STRIP.$@} ${FILES.$@}
-
-.PRECIOUS: netbsd-man.tar netbsd-comp.tar
-
-openbsd: openbsd-man.tar openbsd-comp.tar
-	mkdir -p $@
-	${TAR} -x -f openbsd-man.tar -C $@ --strip-components ${STRIP.$@} ${FILES.$@}
-	${TAR} -x -f openbsd-comp.tar -C $@ --strip-components ${STRIP.$@} ${FILES.$@}
-
-.PRECIOUS: openbsd-man.tar openbsd-comp.tar
-
-FILES.freebsd = './usr/share/man/man[1-9]/'
-FILES.netbsd = './usr/share/man/man[1-9]*/'
-FILES.openbsd = './usr/share/man/man[1-9]*/'
-FILES.linux = '*/man[1-9]/'
-FILES.posix = '*/man[0-3]p/'
-
-STRIP.freebsd = 4
-STRIP.netbsd = 4
-STRIP.openbsd = 4
-STRIP.linux = 1
-STRIP.posix = 1
+.in:
+	sed 's|%%EXMANDIR%%|${EXMANDIR}|g' ${.IMPSRC} > ${.TARGET}
+	chmod a+x ${.TARGET}
 
 clean:
-	rm -fr ${SYSTEMS} *.tar
+	rm -f exman
+.for system in ${SYSTEMS}
+	${MAKE} -C ${system} ${.TARGET}
+.endfor
 
-install: exman exman.1 ${SYSTEMS}
-	install -d ${PREFIX}/bin ${MANDIR}/man1 ${SHAREDIR}/exman
+install: exman exman.1
+	install -d ${PREFIX}/bin ${MANDIR}/man1
 	install exman ${PREFIX}/bin
-	gzip -c exman.1 > ${MANDIR}/man1/exman.1.gz
-	${TAR} -c -f - ${SYSTEMS} | ${TAR} -xo -f - -C ${SHAREDIR}/exman
+	install -m 644 exman.1 ${MANDIR}/man1
+.for system in ${SYSTEMS}
+	${MAKE} -C ${system} ${.TARGET}
+.endfor
 
 uninstall:
-	rm -fr ${PREFIX}/bin/exman ${MANDIR}/man1/exman.1.gz ${SHAREDIR}/exman
+	rm -f ${PREFIX}/bin/exman ${MANDIR}/man1/exman.1
+.for system in ${SYSTEMS}
+	${MAKE} -C ${system} ${.TARGET}
+.endfor
diff --git a/NetBSD/Makefile b/NetBSD/Makefile
new file mode 100644
index 0000000..d39769f
--- /dev/null
+++ b/NetBSD/Makefile
@@ -0,0 +1,8 @@
+SYSTEM = NetBSD
+VERSION = 9.1
+MIRROR = https://cdn.netbsd.org/pub/NetBSD/NetBSD-${VERSION}/amd64/binary/sets
+DISTFILES = comp.tar.xz games.tar.xz man.tar.xz
+FILES = ./usr/share/man/man[1-9]*/
+STRIP = 4
+
+.include "../system.mk"
diff --git a/OpenBSD/Makefile b/OpenBSD/Makefile
new file mode 100644
index 0000000..0fd4e2e
--- /dev/null
+++ b/OpenBSD/Makefile
@@ -0,0 +1,9 @@
+SYSTEM = OpenBSD
+VERSION = 6.8
+MIRROR = https://cdn.openbsd.org/pub/OpenBSD/${VERSION}/amd64
+V = ${VERSION:S/.//}
+DISTFILES = comp${V}.tgz game${V}.tgz man${V}.tgz
+FILES = ./usr/share/man/man[1-9]*/
+STRIP = 4
+
+.include "../system.mk"
diff --git a/POSIX/Makefile b/POSIX/Makefile
new file mode 100644
index 0000000..6a36ca4
--- /dev/null
+++ b/POSIX/Makefile
@@ -0,0 +1,8 @@
+SYSTEM = POSIX
+VERSION = 2017
+MIRROR = https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/man-pages-posix
+DISTFILES = man-pages-posix-${VERSION}-a.tar.xz
+FILES = man-pages-posix-${VERSION}/man[0-3]p/
+STRIP = 1
+
+.include "../system.mk"
diff --git a/README.7 b/README.7
index 0548095..23b5d67 100644
--- a/README.7
+++ b/README.7
@@ -1,4 +1,4 @@
-.Dd May  3, 2020
+.Dd January 27, 2021
 .Dt README 7
 .Os "Causal Agency"
 .
@@ -7,31 +7,30 @@
 .Nd manuals for other systems
 .
 .Sh INSTALLING
-Use
+.Nm
+requires BSD
 .Xr make 1
-to download and extract
-manuals for various systems:
-.Bd -literal -offset indent
-make
-.Ed
-.
-.Pp
-If
+and
+.Xr tar 1 ,
+sometimes called
+.Xr bmake 1
+and
+.Xr bsdtar 1 ,
+respectively,
+as well as
+.Xr curl 1 .
+The paths of
 .Xr tar 1
-is GNU,
-it requires the
-.Fl Fl wildcards
-option:
-.Bd -literal -offset indent
-TAR='tar --wildcards' make
-.Ed
-.
-.Pp
-Install manuals and the
-.Xr exman 1
-utility:
+and
+.Xr curl 1
+can be set by the environment variables
+.Ev TAR
+and
+.Ev CURL ,
+respectively.
 .Bd -literal -offset indent
-sudo make install PREFIX=/usr/local
+make all
+sudo make install
 .Ed
 .
 .Sh CONTRIBUTING
diff --git a/exman.1 b/exman.1
index b2cc204..af0f349 100644
--- a/exman.1
+++ b/exman.1
@@ -1,4 +1,4 @@
-.Dd December 14, 2020
+.Dd January 27, 2021
 .Dt EXMAN 1
 .Os
 .
@@ -25,23 +25,23 @@ are passed to
 .
 .Pp
 The available systems are as follows:
-.Bl -tag -width "freebsd"
-.It Sy freebsd
-.Fx 12.2-RELEASE
-.It Sy linux
-The Linux man-pages project 5.09
-.It Sy netbsd
-.Nx 9.1
-.It Sy openbsd
-.Ox 6.8
-.It Sy posix
-The Linux man-pages-posix project 2017-a
+.Bl -tag -width "FreeBSD"
+.It Fx
+12.2-RELEASE
+.It Linux
+man-pages 5.09
+.It Nx
+9.1
+.It Ox
+6.8
+.It POSIX
+man-pages-posix 2017
 .El
 .
 .Sh EXAMPLES
 .Bd -literal
-exman freebsd 4 unix
-exman linux 7 unix
+exman FreeBSD 4 unix
+exman Linux 7 unix
 .Ed
 .
 .Sh SEE ALSO
diff --git a/exman.sh b/exman.in
index 9b6777d..7d4a9c8 100644
--- a/exman.sh
+++ b/exman.in
@@ -6,17 +6,11 @@ die() {
 	exit 1
 }
 
-script=$0
-path=${script%/*}
-prefix=${path%/bin}
-exman="${prefix}/share/exman"
-[ -d "${exman}" ] || exman=$prefix
-
 system=${1:-}
 [ -n "${system}" ] || die 'What system do you want?'
 shift
 
-export MANPATH="${exman}/${system}"
+export MANPATH="%%EXMANDIR%%/${system}"
 [ -d "${MANPATH}" ] || die "No manuals for ${system}"
 
 export MANSECT
diff --git a/freebsd.url b/freebsd.url
deleted file mode 100644
index 269af5e..0000000
--- a/freebsd.url
+++ /dev/null
@@ -1 +0,0 @@
-https://download.FreeBSD.org/ftp/releases/amd64/12.2-RELEASE/base.txz
diff --git a/linux.url b/linux.url
deleted file mode 100644
index f0584b8..0000000
--- a/linux.url
+++ /dev/null
@@ -1 +0,0 @@
-https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/man-pages-5.09.tar.xz
diff --git a/netbsd-comp.url b/netbsd-comp.url
deleted file mode 100644
index c4704a5..0000000
--- a/netbsd-comp.url
+++ /dev/null
@@ -1 +0,0 @@
-https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.1/amd64/binary/sets/comp.tar.xz
diff --git a/netbsd-man.url b/netbsd-man.url
deleted file mode 100644
index bf0d532..0000000
--- a/netbsd-man.url
+++ /dev/null
@@ -1 +0,0 @@
-https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.1/amd64/binary/sets/man.tar.xz
diff --git a/openbsd-comp.url b/openbsd-comp.url
deleted file mode 100644
index fce012f..0000000
--- a/openbsd-comp.url
+++ /dev/null
@@ -1 +0,0 @@
-https://cdn.openbsd.org/pub/OpenBSD/6.8/amd64/comp68.tgz
diff --git a/openbsd-man.url b/openbsd-man.url
deleted file mode 100644
index f21fa7c..0000000
--- a/openbsd-man.url
+++ /dev/null
@@ -1 +0,0 @@
-https://cdn.openbsd.org/pub/OpenBSD/6.8/amd64/man68.tgz
diff --git a/posix.url b/posix.url
deleted file mode 100644
index 6dc7ad7..0000000
--- a/posix.url
+++ /dev/null
@@ -1 +0,0 @@
-https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/man-pages-posix/man-pages-posix-2017-a.tar.xz
diff --git a/system.mk b/system.mk
new file mode 100644
index 0000000..7ab5aba
--- /dev/null
+++ b/system.mk
@@ -0,0 +1,27 @@
+PREFIX ?= /usr/local
+SHAREDIR ?= ${PREFIX}/share
+EXMANDIR ?= ${SHAREDIR}/exman
+
+CURL ?= curl
+TAR ?= tar
+ALLOW_FAILURE ?= false
+
+all: ${DISTFILES}
+
+.PRECIOUS: ${DISTFILES}
+
+${DISTFILES}:
+	${CURL} -O ${MIRROR}/${.TARGET}
+
+clean:
+	rm -f ${DISTFILES}
+
+install: ${DISTFILES}
+	install -d ${EXMANDIR}/${SYSTEM}
+.for distfile in ${DISTFILES}
+	${TAR} -x -f ${distfile} -C ${EXMANDIR}/${SYSTEM} \
+		--strip-components=${STRIP} '${FILES}' || ${ALLOW_FAILURE}
+.endfor
+
+uninstall:
+	rm -fr ${EXMANDIR}/${SYSTEM}