debian/: Add packaging support.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 15 May 2021 13:52:46 +0000 (14:52 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 15 May 2021 13:59:01 +0000 (14:59 +0100)
This is quite fancy, and arranges to dump images for new Lisp systems as
they get installed.

15 files changed:
Makefile.am
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/copyright [new file with mode: 0644]
debian/rules [new file with mode: 0755]
debian/runlisp.config [new file with mode: 0755]
debian/runlisp.dirs [new file with mode: 0644]
debian/runlisp.install [new file with mode: 0644]
debian/runlisp.installdirs [new file with mode: 0644]
debian/runlisp.postinst [new file with mode: 0755]
debian/runlisp.postrm [new file with mode: 0755]
debian/runlisp.prerm [new file with mode: 0755]
debian/runlisp.templates [new file with mode: 0644]
debian/runlisp.triggers [new file with mode: 0644]

index b13d107..f79b77d 100644 (file)
@@ -201,4 +201,14 @@ dist-hook::
 EXTRA_DIST             += config/auto-version
 EXTRA_DIST             += config/confsubst
 
+## Debian.
+EXTRA_DIST             += debian/changelog debian/copyright debian/compat
+EXTRA_DIST             += debian/control debian/rules
+
+EXTRA_DIST             += debian/runlisp.install debian/runlisp.dirs
+EXTRA_DIST             += debian/runlisp.config debian/runlisp.templates
+EXTRA_DIST             += debian/runlisp.postinst
+EXTRA_DIST             += debian/runlisp.prerm debian/runlisp.postrm
+EXTRA_DIST             += debian/runlisp.triggers
+
 ###----- That's all, folks --------------------------------------------------
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..9843dad
--- /dev/null
@@ -0,0 +1,6 @@
+runlisp (0.99.99~) experimental; urgency=medium
+
+  * Preparation for initial release.
+
+ -- Mark Wooding <mdw@distorted.org.uk>  Mon, 01 Mar 2021 01:24:02 +0000
+
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..f599e28
--- /dev/null
@@ -0,0 +1 @@
+10
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..edf435e
--- /dev/null
@@ -0,0 +1,16 @@
+Source: runlisp
+Section: lisp
+Priority: extra
+Maintainer: Mark Wooding <mdw@distorted.org.uk>
+Build-Depends: autoconf, autoconf-archive, automake, clisp, cl-asdf,
+ debhelper (>= 10), ecl, groff, gsfonts, sbcl
+Standards-Version: 3.1.1
+
+Package: runlisp
+Architecture: any
+Depends: ${shlibs:Depends}
+Description: Utility for running scripts written in Common Lisp.
+ `runlisp' is a small C program intended to be run from a script `#!'
+ line.  It selects and invokes a Common Lisp implementation, so as to run
+ the script.  In this sense, `runlisp' is a partial replacement for
+ `cl-launch'.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..90ecc72
--- /dev/null
@@ -0,0 +1,27 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Copyright: 2020--2021 Mark Wooding, Straylight/Edgeware
+Upstream-Name: tripe
+Upstream-Contact: Mark Wooding <mdw@distorted.org.uk>
+Source: https://ftp.distorted.org.uk/pub/mdw/
+License: GPL-3.0+
+
+Files: *
+Copyright: 2020--2021 Mark Wooding, Straylight/Edgeware
+License: GPL-3.0+
+
+License: GPL-3.0+
+ runlisp is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 3 of the License, or (at
+ your option) any later version.
+ .
+ runlisp is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ for more details.
+ .
+ You should have received a copy of the GNU General Public License
+ along with runlisp.  If not, see <https://www.gnu.org/licenses/>.
+ .
+ On Debian systems, the full text of the GNU General Public License
+ version 3 can be found in the file `/usr/share/common-licenses/GPL-3'.
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..9b128d0
--- /dev/null
@@ -0,0 +1,16 @@
+#! /usr/bin/make -f
+
+DH_OPTIONS              = --parallel -Bdebian/build
+
+OVERRIDES              += auto_configure
+dh_auto_configure_OPTS  = --
+dh_auto_configure_OPTS += --with-imagedir=/var/lib/runlisp
+
+OVERRIDES              += auto_install
+dh_auto_install_OPTS    = --destdir=debian/tmp
+
+%:; dh $@ $(DH_OPTIONS)
+
+$(foreach o, $(sort $(OVERRIDES)), dh-$o-hook)::; @:
+$(foreach o, $(sort $(OVERRIDES)), override_dh_$o): override_dh_%: dh-%-hook
+       dh_$* $(addprefix -O, $(DH_OPTIONS)) $(dh_$*_OPTS)
diff --git a/debian/runlisp.config b/debian/runlisp.config
new file mode 100755 (executable)
index 0000000..e370b1b
--- /dev/null
@@ -0,0 +1,76 @@
+#! /bin/sh -e
+
+. /usr/share/debconf/confmodule
+db_capb backup
+
+## Main state machine.
+state=0
+while :; do
+  case $state in
+
+    0)
+      db_input medium runlisp/dump-custom-images || :
+      ;;
+
+    1)
+      db_get runlisp/dump-custom-images
+      case $RET in select) ;; *) state=2; continue ;; esac
+
+      ## Determine the configured Lisp systems.
+      sects=$(query-runlisp-config -LM)
+      unset lisps
+      for s in $sects; do
+       case $s in @*) continue ;; esac
+       if ! query-runlisp-config -M -p$s:dump-image >/dev/null 2>&1
+         then continue; fi
+       lisps=${lisps+$lisps, }$s
+      done
+      db_subst runlisp/selected-implementations lisps "$lisps"
+
+      ## See if the list has changed recently.
+      db_get runlisp/available-implementations
+      case $RET in
+       "$lisps")
+         ch=nil prio=medium
+         ;;
+       *)
+         ch=t prio=high
+         db_set runlisp/available-implementations "$lisps"
+         ;;
+      esac
+
+      ## Filter nonexistent implementations from the active list.
+      db_get runlisp/selected-implementations
+      case $RET in
+       -)
+         v=$lisps
+         ;;
+       *)
+         unset v
+         for i in $(echo "$RET" | tr , " "); do
+           case " $lisps," in *" $i,"*) v=${v+$v, }$i ;; esac
+         done
+         ;;
+      esac
+      db_set runlisp/selected-implementations "$v"
+      case $ch in
+       t) db_fset runlisp/selected-implementations seen false ;;
+      esac
+      db_input $prio runlisp/selected-implementations || :
+      ;;
+
+    -1)
+      exit 10
+      ;;
+    *)
+      break
+      ;;
+  esac
+
+  set +e; db_go; rc=$?; set -e
+  case $rc in
+    0) state=$(( $state + 1 )) ;;
+    30) state=$(( $state - 1 )) ;;
+    *) exit $rc ;;
+  esac
+done
diff --git a/debian/runlisp.dirs b/debian/runlisp.dirs
new file mode 100644 (file)
index 0000000..b418dc2
--- /dev/null
@@ -0,0 +1,3 @@
+### -*-conf-*-
+
+/var/lib/runlisp
diff --git a/debian/runlisp.install b/debian/runlisp.install
new file mode 100644 (file)
index 0000000..b566ff6
--- /dev/null
@@ -0,0 +1,23 @@
+### -*-conf-*-
+
+etc/runlisp/runlisp.conf
+etc/runlisp/runlisp.d/
+
+usr/bin/dump-runlisp-image
+usr/bin/query-runlisp-config
+usr/bin/runlisp
+
+README.org             /usr/share/doc/runlisp
+doc/README.pdf         /usr/share/doc/runlisp
+usr/share/doc/runlisp/dump-runlisp-image.pdf
+usr/share/doc/runlisp/query-runlisp-config.pdf
+usr/share/doc/runlisp/runlisp.conf.pdf
+usr/share/doc/runlisp/runlisp.pdf
+
+usr/share/man/man1/dump-runlisp-image.1
+usr/share/man/man1/query-runlisp-config.1
+usr/share/man/man1/runlisp.1
+usr/share/man/man5/runlisp.conf.5
+
+usr/share/runlisp/dump-ecl
+usr/share/runlisp/eval.lisp
diff --git a/debian/runlisp.installdirs b/debian/runlisp.installdirs
new file mode 100644 (file)
index 0000000..ac10ed4
--- /dev/null
@@ -0,0 +1,3 @@
+### -*-conf-*-
+
+/var/lib/runlisp
\ No newline at end of file
diff --git a/debian/runlisp.postinst b/debian/runlisp.postinst
new file mode 100755 (executable)
index 0000000..9288e1b
--- /dev/null
@@ -0,0 +1,23 @@
+#! /bin/sh -e
+
+. /usr/share/debconf/confmodule
+
+db_get runlisp/dump-custom-images
+mode=$RET
+
+{ echo ";;; -*-conf-*-"; echo
+  case $mode in
+    select)
+      db_get runlisp/selected-implementations
+      echo "dump = $RET"
+      ;;
+  esac
+} >/etc/runlisp/runlisp.d/8debconf.new
+mv /etc/runlisp/runlisp.d/8debconf.new /etc/runlisp/runlisp.d/8debconf
+
+case $mode in
+  none) ;;
+  *) dump-runlisp-image -aiRU ;;
+esac
+
+#DEBHELPER#
diff --git a/debian/runlisp.postrm b/debian/runlisp.postrm
new file mode 100755 (executable)
index 0000000..a0c5e30
--- /dev/null
@@ -0,0 +1,9 @@
+#! /bin/sh -e
+
+case $1 in
+  purge)
+    rm -f /etc/runlisp/runlisp.d/8debconf
+    ;;
+esac
+
+#DEBHELPER#
diff --git a/debian/runlisp.prerm b/debian/runlisp.prerm
new file mode 100755 (executable)
index 0000000..ec5c62a
--- /dev/null
@@ -0,0 +1,17 @@
+#! /bin/sh -e
+
+. /usr/share/debconf/confmodule
+
+db_get runlisp/dump-custom-images
+mode=$RET
+
+case $1 in
+  deconfigure | remove)
+    case $mode in
+      none) ;;
+      *) dump-runlisp-image -arRU ;;
+    esac
+    ;;
+esac
+
+#DEBHELPER#
diff --git a/debian/runlisp.templates b/debian/runlisp.templates
new file mode 100644 (file)
index 0000000..6fd1340
--- /dev/null
@@ -0,0 +1,24 @@
+Template: runlisp/dump-custom-images
+Type: select
+Choices: none, all, select
+Default: all
+Description: Dump custom Lisp images for faster startup?
+ `runlisp' often works significantly faster if it can build and use custom
+ Lisp images, rather than having to use the vanilla images from the
+ installation package.
+ .
+ You can opt to dump custom images for selected Lisp implementations, for all
+ supported Lisps installed, or not to dump images at all.
+
+Template: runlisp/selected-implementations
+Type: multiselect
+Choices: ${lisps}
+Default: -
+Description: Which Lisp implementations should have custom images dumped?
+ You have opted to dump images only for explicitly selected Lisp
+ implementations.
+
+Template: runlisp/available-implementations
+Type: string
+Default:
+Description: (internal use only)
diff --git a/debian/runlisp.triggers b/debian/runlisp.triggers
new file mode 100644 (file)
index 0000000..5317ee9
--- /dev/null
@@ -0,0 +1,6 @@
+### -*-conf-*-
+
+interest-noawait /usr/bin/clisp
+interest-noawait /usr/bin/cmucl
+interest-noawait /usr/bin/ecl
+interest-noawait /usr/bin/sbcl