File: sample-package-install-foo

package info (click to toggle)
emacsen-common 1.4.22
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 116 kB
  • ctags: 30
  • sloc: perl: 194; sh: 110; lisp: 108; makefile: 80
file content (31 lines) | stat: -rw-r--r-- 829 bytes parent folder | download
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
#!/bin/sh
# /usr/lib/emacsen-common/packages/install/foo
# [ Sample only -- this script hasn't been tested, so be careful. ]
set -e

FLAVOR=$1
echo install/foo: Handling install of emacsen flavor ${FLAVOR}

byte_compile_options="-batch -f batch-byte-compile"
el_files="some-file.el some-other-file.el etc.el" 
el_dir=/usr/share/emacs/site-lisp/foo/
elc_dir=/usr/share/${FLAVOR}/site-lisp/foo/

if [ ${FLAVOR} != emacs ]
then
  echo install/foo: byte-compiling for ${FLAVOR}

  [ -d ${elc_dir} ] || mkdir ${elc_dir}

  # Copy the temp .el files
  (cd ${el_dir} && cp ${el_files} ${elc_dir})

  # Byte compile them
  (cd ${elc_dir} \
   && ${FLAVOR} ${byte_compile_options} ${el_files} 2> /dev/null)

  # remove the redundant .el files
  # presumes that any .el files in the <flavor> dir are trash.
  rm ${elc_dir}/*.el
fi
exit 0;