File: emacsen-install

package info (click to toggle)
edb 1.31-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 3,180 kB
  • ctags: 1,236
  • sloc: lisp: 10,484; sh: 424; makefile: 172
file content (98 lines) | stat: -rwxr-xr-x 1,657 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
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/bin/sh
# Synopsis: [DEBIAN_EL_DEBUG=1] emacsen-install [--test] emacs24 ...

set -e

if [ "$DEBIAN_EL_DEBUG" ]; then
    set -x
fi

PACKAGE=edb
MESSAGE="install/$PACKAGE:"
unset test

Run ()
{
    ${test+echo} "$@"
}

Install ()
{
    # set ARGS and FLAVOR before calling

    ELDIR=/usr/share/emacs/site-lisp/$PACKAGE
    ELCDIR=/usr/share/$FLAVOR/site-lisp/$PACKAGE

    BYTECOMP=BYTE-COMPILE.el
    EL_LIBS="-l ./$BYTECOMP -l bfuncs -l database.el"
    EL_FLAGS="-batch -q -no-site-file"
    EMACS="$FLAVOR $EL_LIBS $EL_FLAGS"

    echo "install/$PACKAGE: Handling install of emacsen flavor $FLAVOR"

    case "$FLAVOR" in
	xemacs*|emacs23|emacs22|emacs21|emacs20|emacs19|mule2)
	    echo "$MESSAGE [$FLAVOR] ignored."
	    ;;

	*)
	    echo "$MESSAGE Byte-Compiling in dir $ELDIR/ ..."

	    Run install -m 755 -d $ELCDIR
	    Run rm -f $ELCDIR/*.el $ELCDIR/*.elc

	    Run cd $ELDIR

	    cat << EOF > $BYTECOMP
(setq load-path (cons "." load-path))
(setq edb-directory ".")
EOF

	    Run $EMACS \
		-f edb-bfunc-make-all \
		-f batch-byte-compile \
		   database.el

	    rm -f $BYTECOMP
	    Run mv -f *.elc $ELCDIR/

	    for file in $ELDIR/*.el
	    do
		if [ ! -f $file ]; then
		    echo "$MESSAGE [ERROR] No $file in $(pwd)"
		    exit 1
		fi

		Run ln -sf $file $ELCDIR
	    done

	    echo "$MESSAGE Byte-Compiling... done."
	    ;;
    esac
}

Main ()
{
    ARGS="$*"

    if [ "$1" = "--test" ]; then
	test="test-mode"
	echo "$MESSAGE [TEST MODE $1] No real commands run"
	shift
    fi

    FLAVOR=$1
    [ ! "$1" ] || shift

    if [ "$FLAVOR" = emacs ]; then
	return 0
    fi

    Install $FLAVOR

    exit 0
}

Main  "$@"

# Endo file