From 4cb42cbc92abee5b2fc8f73309f50c2712a12e19 Mon Sep 17 00:00:00 2001 From: Benjamin Barenblat Date: Sun, 5 Apr 2015 15:36:22 -0400 Subject: Rewrite emacsen files from dh-make templates --- debian/copyright | 5 +++++ debian/urweb-mode.emacsen-install | 43 ++++++++++++++++++++++++--------------- debian/urweb-mode.emacsen-remove | 8 +++++++- debian/urweb-mode.emacsen-startup | 37 ++++++++++++++++----------------- 4 files changed, 56 insertions(+), 37 deletions(-) diff --git a/debian/copyright b/debian/copyright index 4c0b59ff..6c7ca72a 100644 --- a/debian/copyright +++ b/debian/copyright @@ -13,6 +13,11 @@ Files: debian/* Copyright: 2013, 2014, 2015 Benjamin Barenblat License: Apache-2.0 +Files: debian/*.emacsen* +Copyright: 1998-2011 Craig Small + 2015 Benjamin Barenblat +License: Apache-2.0 + Files: m4/ax_check_openssl.m4 Copyright: 2009, 2010 Zmanda Inc. 2009, 2010 Dustin J. Mitchell diff --git a/debian/urweb-mode.emacsen-install b/debian/urweb-mode.emacsen-install index 9f47ce49..edaa9aa1 100644 --- a/debian/urweb-mode.emacsen-install +++ b/debian/urweb-mode.emacsen-install @@ -1,30 +1,41 @@ #!/bin/sh -e -#/usr/lib/emacsen-common/packages/install/urweb-mode +# /usr/lib/emacsen-common/packages/install/urweb-mode + +# Written by Jim Van Zandt , borrowing heavily +# from the install scripts for gettext by Santiago Vila +# and octave by Dirk Eddelbuettel . FLAVOR=$1 +PACKAGE=urweb-mode + if [ ${FLAVOR} = emacs ]; then exit 0; fi -PACKAGE=urweb-mode echo install/${PACKAGE}: Handling install for emacsen flavor ${FLAVOR} -# The byte-compiled files goes into the site-lisp directory. -BCDIR=/usr/share/${FLAVOR}/site-lisp/${PACKAGE} -install -m 755 -d ${BCDIR} +FLAGS="${SITEFLAG} -q -batch -l path.el -f batch-byte-compile" -# The elisp source files are in the generic site-lisp directory. -SRCDIR=/usr/share/emacs/site-lisp/${PACKAGE} -SRC=`find ${SRCDIR} -name '*.el' -exec basename '{}' ';'` +ELDIR=/usr/share/emacs/site-lisp/${PACKAGE} +ELCDIR=/usr/share/${FLAVOR}/site-lisp/${PACKAGE} +ELRELDIR=../../../emacs/site-lisp/${PACKAGE} + +# Install-info-altdir does not actually exist. +# Maybe somebody will write it. +if test -x /usr/sbin/install-info-altdir; then + echo install/${PACKAGE}: install Info links for ${FLAVOR} + install-info-altdir --quiet --section "" "" --dirname=${FLAVOR} /usr/share/info/${PACKAGE}.info.gz +fi + +install -m 755 -d ${ELCDIR} +cd ${ELDIR} +FILES=`echo *.el` +cd ${ELCDIR} +ln -sf ${ELRELDIR}/*.el . -# Prepare for byte-compiling the source files. -cd ${BCDIR} -ln -sf ${SRCDIR}/*.el . cat << EOF > path.el -(setq load-path (cons "." load-path) byte-compile-warnings nil) +(debian-pkg-add-load-path-item ".") +(setq byte-compile-warnings nil) EOF - -# Byte-compile elisp files. -FLAGS="--no-site-file --no-init-file --batch -l path.el -f batch-byte-compile" -${FLAVOR} ${FLAGS} ${SRC} +${FLAVOR} ${FLAGS} ${FILES} rm -f path.el exit 0 diff --git a/debian/urweb-mode.emacsen-remove b/debian/urweb-mode.emacsen-remove index b45668c7..9135536d 100644 --- a/debian/urweb-mode.emacsen-remove +++ b/debian/urweb-mode.emacsen-remove @@ -1,9 +1,15 @@ #!/bin/sh -e # /usr/lib/emacsen-common/packages/remove/urweb-mode + FLAVOR=$1 PACKAGE=urweb-mode + if [ ${FLAVOR} != emacs ]; then + if test -x /usr/sbin/install-info-altdir; then + echo remove/${PACKAGE}: removing Info links for ${FLAVOR} + install-info-altdir --quiet --remove --dirname=${FLAVOR} /usr/share/info/urweb-mode.info.gz + fi + echo remove/${PACKAGE}: purging byte-compiled files for ${FLAVOR} rm -rf /usr/share/${FLAVOR}/site-lisp/${PACKAGE} fi -exit 0 diff --git a/debian/urweb-mode.emacsen-startup b/debian/urweb-mode.emacsen-startup index 4341955a..f2e2a24a 100644 --- a/debian/urweb-mode.emacsen-startup +++ b/debian/urweb-mode.emacsen-startup @@ -1,21 +1,18 @@ ;; -*-emacs-lisp-*- - -(if (not (file-exists-p "/usr/share/emacs/site-lisp/urweb-mode")) - (message "Package urweb-mode removed but not purged. Skipping setup.") - - (let ((pkgdir (concat "/usr/share/" - (symbol-name debian-emacs-flavor) - "/site-lisp/urweb-mode"))) - - ;; Only load urweb-mode if it has been installed. - (if (zerop (length (file-expand-wildcards pkgdir))) - (message "urweb-mode not for this flavor. Skipping.") - - ;; The urweb-mode package follows the Debian/GNU Linux 'emacsen' policy - ;; and byte-compiles its elisp files for each 'emacs flavor'. The - ;; compiled code is then installed in a subdirectory of the respective - ;; site-lisp directory. - (debian-pkg-add-load-path-item pkgdir) - - ;; Autoload urweb-mode top-level functions site-wide. - (load "urweb-mode-startup")))) +;; The urweb-mode package follows the Debian/GNU Linux 'emacsen' policy and +;; byte-compiles its elisp files for each 'emacs flavor' (emacs19, +;; xemacs19, emacs20, xemacs20...). The compiled code is then +;; installed in a subdirectory of the respective site-lisp directory. +;; We have to add this to the load-path: +(let ((package-dir (concat "/usr/share/" + (symbol-name debian-emacs-flavor) + "/site-lisp/urweb-mode"))) +;; If package-dir does not exist, the urweb-mode package must have +;; removed but not purged, and we should skip the setup. + (when (file-directory-p package-dir) + (if (fboundp 'debian-pkg-add-load-path-item) + (debian-pkg-add-load-path-item package-dir) + (setq load-path (cons package-dir load-path))) + ;; urweb-mode maintains its own autoloads file, so just rely on it instead + ;; of creating another set of autoloads. + (load "urweb-mode-startup"))) -- cgit v1.2.3