summaryrefslogtreecommitdiff
path: root/debian/emacsen-install
blob: 48b69e64c2c4e51b68a7d7c848a678758c0f9c47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#! /bin/sh -e
# /usr/lib/emacsen-common/packages/install/org-mode

# Written by Jim Van Zandt <jrv@debian.org>, borrowing heavily
# from the install scripts for gettext by Santiago Vila
# <sanvila@ctv.es> and octave by Dirk Eddelbuettel <edd@debian.org>.

FLAVOR=$1
PACKAGE=org-mode
STAMPFILE=org-wl.elc
LOG=$(tempfile -pelc_ -s.log -m644)

case ${FLAVOR} in
  emacs) exit 0 ;; # generic emacs package
  emacs21) exit 0 ;; # not supported anymore as of 6.26a-3
  emacs22) exit 0 ;; # not supported anymore as of 8.x
  emacs23) exit 0 ;; # not supported anymore as of 8.x
  xemacs*) exit 0 ;; # not supported anymore as of 7.x
esac

echo "install/${PACKAGE}: Handling install for emacsen flavor ${FLAVOR}, logged in ${LOG}"

FLAVORTEST=$(echo $FLAVOR | cut -c-6)
SITEFLAG="--no-site-file"
FILES="/usr/share/emacs/site-lisp/${PACKAGE}/*.el"
DATAFILES="/usr/share/emacs/site-lisp/${PACKAGE}/etc/styles/*.xml"
DATADIR="/usr/share/${FLAVOR}/site-lisp/${PACKAGE}/etc/styles"

mkdir -p ${DATADIR}
cd ${DATADIR}
for i in ${DATAFILES}; do
  ln -fs $i
done

ELCDIR=/usr/share/${FLAVOR}/site-lisp/${PACKAGE}
install -m 755 -d ${ELCDIR}
cd ${ELCDIR}
for i in ${FILES}; do
    ln -fs $i
done
if [ -n "$EXCLUDE_FILES" ] ; then
  rm -f ${ELCDIR}/${EXCLUDE_FILES}
fi

FLAGS="${SITEFLAG} -q -batch -l path.el -f batch-byte-compile"

cat << EOF > path.el
(setq load-path (cons "." load-path))
(setq byte-compile-warnings nil)
EOF

echo ${FLAVOR} ${FLAGS} *.el > ${LOG}
${FLAVOR} ${FLAGS} *.el >> ${LOG} 2>& 1
egrep -s -e "While compiling|\*\*" ${LOG} || /bin/true
echo install/${PACKAGE}: Deleting ${LOG}
rm -f path.el*

exit 0