summaryrefslogtreecommitdiffstats
path: root/emacs-lisp/FUNCTIONS
blob: 437521227ff884e5f55b009d35663ddcef3ce112 (plain) (blame)
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
59
60
61
#-------------------------------------------------------------------------
## Helper to install extra directories and files.
#-------------------------------------------------------------------------
function emacs_lisp_install() {
  cp -vr "${@/#/$SOURCE_DIRECTORY/}" \
    "$INSTALL_ROOT/usr/share/emacs/site-lisp/$SPELL/"
}

#-------------------------------------------------------------------------
## Section-default build script.
#-------------------------------------------------------------------------
function default_build_emacs_lisp() {
  [ $# = 0 ] && set -- "$SOURCE_DIRECTORY"
  shopt -s nullglob

  local texi_files

  while [ $# -gt 0 ]; do
    emacs -Q -L "$1" -batch -f batch-byte-compile "$1"/*.el &&
    texi_files=("$1"/*.texi)
    if [ ${#texi_files[@]} -gt 0 ]
    then
      makeinfo "${texi_files[@]}" &&
      gzip -9 "$1"/*.info
    fi
    shift
  done
}

#-------------------------------------------------------------------------
## Section-default install script.
#-------------------------------------------------------------------------
function default_install_emacs_lisp() {
  [ $# = 0 ] && set -- "$SOURCE_DIRECTORY"
  shopt -s nullglob

  local dir="$INSTALL_ROOT/usr/share/emacs/site-lisp/$SPELL"
  local info_dir="$INSTALL_ROOT/usr/share/info"

  local info_files

  while [ $# -gt 0 ]; do
    install -d -m755 "$dir" &&
    install -m644 "$1"/*.el "$1"/*.elc "$dir" &&
    info_files=("$1"/*.info.gz)
    if [ ${#info_files[@]} -gt 0 ]
    then
      install -m644 "${info_files[@]}" "$info_dir" &&
      install-info --info-dir="$info_dir" "${info_files[@]/#*\//$info_dir/}"
    fi
    shift
  done
}

function default_build() {
   default_build_emacs_lisp
}

function default_install() {
   default_install_emacs_lisp
}