File: emacsen-install

package info (click to toggle)
flim 1:1.14.9+0.20120428-23
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 1,984 kB
  • sloc: lisp: 10,293; sh: 142; makefile: 111
file content (142 lines) | stat: -rw-r--r-- 3,651 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#! /bin/sh
# /usr/lib/emacsen-common/packages/install/flim
set -e

FLAVOR=$1
PACKAGE=flim

ELCDIR=/usr/share/$FLAVOR/site-lisp/$PACKAGE
ELDIR=/usr/share/$PACKAGE
ELCSTAMP=$ELCDIR/compile-stamp

case $FLAVOR in
    emacs19|mule2|xemacs20|xemacs19)
    exit 0
    ;;
    *xemacs*)
    mule=`/bin/ls -1 /usr/bin/$FLAVOR*-mule* 2>/dev/null | head -1`
    nomule=`/bin/ls -1 /usr/bin/$FLAVOR*-nomule* 2>/dev/null | head -1`
    if [ -n "$mule" ]; then
	if [ ! -f "/usr/share/$FLAVOR/site-lisp/apel/poem.elc" ]; then
	    inst=/usr/lib/emacsen-common/packages/install/apel
	    if [ ! -x "$inst" ]; then exit 0; fi
	    "$inst" "$FLAVOR"
	fi
	if [ ! -f "$ELCDIR/mime.elc" ]; then rm -f "$ELCSTAMP"; fi
    fi
    if [ -n "$nomule" ]; then
	if [ ! -f "/usr/share/$FLAVOR/site-lisp/apel/nomule/poem.elc" ]; then
	    inst=/usr/lib/emacsen-common/packages/install/apel
	    if [ ! -x "$inst" ]; then exit 0; fi
	    "$inst" "$FLAVOR"
	fi
	if [ ! -f "$ELCDIR/nomule/mime.elc" ]; then rm -f "$ELCSTAMP"; fi
	if [ -n "$mule" ]; then
	    EMACSEN="$mule $nomule"
	else
	    EMACSEN="$nomule"
	fi
    else
	EMACSEN=$FLAVOR
    fi
    ;;
    *)
    if [ ! -f "/usr/share/$FLAVOR/site-lisp/apel/poem.elc" ]; then exit 0; fi
    EMACSEN=$FLAVOR
    ;;
esac

if [ -f "$ELCSTAMP" ]; then
    if [ -z "`find "$ELDIR/mime.el" -newer "$ELCSTAMP"`" ]; then
	echo "install/$PACKAGE: already byte-compiled for $FLAVOR, skipped"
	exit 0
    fi
    rm -f "$ELCSTAMP"
fi

LOG=`mktemp -t elc.XXXXXXXXXXXX`
chmod 644 "$LOG"
echo "install/$PACKAGE: byte-compiling for $FLAVOR, logged in $LOG"

cd "$ELDIR"
LINKS=`echo *.el`
if [ ! -d "$ELCDIR" ]; then
    mkdir "$ELCDIR"
    chmod 755 "$ELCDIR"
fi

for EMACS in $EMACSEN; do
    cd "$ELCDIR"
    TOELDIR=../../../$PACKAGE
    case $EMACS in
	*-nomule*)
	if [ x"$EMACS" != x"$EMACSEN" ]; then
	    if [ ! -d nomule ]; then
		mkdir nomule
		chmod 755 nomule
	    fi
	    cd nomule
	    TOELDIR=../$TOELDIR
	fi
	;;
    esac
    rm -f *.elc __myinit.el
    for f in $LINKS; do
	ln -sf "$TOELDIR/$f" .
    done
    case $EMACS in
	*-nomule*)
	rm -f mel-q-ccl.el mel-b-ccl.el
	;;
    esac
    FILES=`echo *.el | sed s/sasl-xoauth2.el//`

    cat > __myinit.el << EOF
(setq load-path (cons "/usr/share/$FLAVOR/site-lisp/apel" load-path))
(setq load-path (cons "." load-path))
(setq byte-compile-warnings nil)
EOF
    case $EMACS in
	*-nomule*)
	cat >> __myinit.el << EOF
(setq load-path (cons "/usr/share/$FLAVOR/site-lisp/apel/nomule" load-path))
EOF
	;;
	*)
    esac

    FLAGS="-q -no-site-file -batch -l __myinit.el -f batch-byte-compile"
    echo "$EMACS" $FLAGS $FILES >> "$LOG"
    "$EMACS" $FLAGS $FILES >> "$LOG" 2>&1
    chmod 644 *.elc

    rm -f __myinit.el*
done # EMACS in $EMACSEN

if [ -f /usr/share/emacsen-common/debian-startup.el ] && \
   [ ! -f "/etc/$FLAVOR/site-start.d/50$PACKAGE.el" ] && \
   [ -f "/etc/emacs/site-start.d/50$PACKAGE.el" ] && \
   [ -d "/etc/$FLAVOR/site-start.d" ]; then
    ln -sf "../../emacs/site-start.d/50$PACKAGE.el" "/etc/$FLAVOR/site-start.d/50$PACKAGE.el"
fi

echo "install/$PACKAGE: deleting $LOG"
rm -f "$LOG"

echo "install/$PACKAGE: byte-compiling for reverse dependency"
pkgs=
for p in w3m-el:w3m w3m-el-snapshot:w3m semi mu-cite rail lsdb elserv; do
    pkg=`echo $p | cut -d : -f 1`
    sname=`echo $p | cut -d : -f 2`
    dir=/usr/share/$FLAVOR/site-lisp/$sname
    if [ -n "$sname" ] && [ -d "$dir" ] && [ -f "/usr/lib/emacsen-common/packages/install/$pkg" ]; then
	rm -f "$dir"/*.elc "$dir"/*/*.elc "$dir"/*-stamp "$dir"/*/*-stamp
	pkgs="$pkg $pkgs"
    fi
done
for pkg in $pkgs; do
    "/usr/lib/emacsen-common/packages/install/$pkg" "$FLAVOR"
done

touch "$ELCSTAMP"
exit 0