File: vm.emacsen-install

package info (click to toggle)
vm 8.2.0b-7
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 4,212 kB
  • sloc: lisp: 50,545; sh: 546; makefile: 451; ansic: 298; python: 112
file content (130 lines) | stat: -rw-r--r-- 4,218 bytes parent folder | download | duplicates (4)
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
#!/bin/bash
#				-*- Mode: Sh -*-
# emacsen.install ---
# Author	   : Manoj Srivastava ( srivasta@tiamat.datasync.com )
# Created On	   : Fri Apr  3 14:39:59 1998
# Created On Node  : tiamat.datasync.com
# Last Modified By : Manoj Srivastava
# Last Modified On : Fri Feb  8 21:55:35 2008
# Last Machine Used: anzu.internal.golden-gryphon.com
# Update Count	   : 48
# Status	   : Unknown, Use with caution!
# HISTORY	   :
# Description	   :
#
# arch-tag: 8d8ec43a-8bb5-4ecd-bde8-67736b2d04d5
#

set -e

FLAVOUR=$1
PACKAGE="vm"

if [ "X$FLAVOUR" = "X" ]; then
    echo Need argument to determin FLAVOUR of emacs;
    exit 1
fi

if [ "X$PACKAGE" = "X" ]; then
    echo Internal error: need package name;
    exit 1;
fi


ELDIR=/usr/share/emacs/site-lisp/$PACKAGE.in
ELCDIR=/usr/share/$FLAVOUR/site-lisp/$PACKAGE
EFLAGS="-batch -q -l load-path-hack.el -f batch-byte-compile"
STARTDIR=/etc/$FLAVOUR/site-start.d
INFO_FILES="/usr/info/vm.info.gz";
STARTFILE="$PACKAGE-init.el";
BYTEOPTS="./vm-byteopts.el";
PRELOADS=" -l $BYTEOPTS -l ./vm-message.el -l ./vm-misc.el -l ./vm-vars.el -l ./vm-version.el";
BATCHFLAGS=" -batch -q -no-site-file"
CORE="vm-message.el vm-misc.el vm-byteopts.el"
STAMPFILE=vm-autoload.elc
PRECIOUS='vm-autoload.el version.txt'

case "$FLAVOUR" in
    # Note: this list of emacs flavours appears in vm.emacsen-remove too
    emacs|emacs25|emacs24|emacs23|emacs-snapshot)
	echo -n "install/$PACKAGE: Byte-compiling for $FLAVOUR..."
        case $FLAVOUR in
            emacs*)
                EMACS_FLAVOR=emacs
                ;;
            xemacs*)
                EMACS_FLAVOR=xemacs
                ;;
        esac

	if [ -d $ELCDIR ]; then
            if [ -e "${ELCDIR}/${STAMPFILE}" ]; then
                echo "${PACKAGE} files already compiled in ${ELCDIR}."
                exit 0
            else
                test ! -d $ELCDIR/pixmaps     || rm -rf $ELCDIR/pixmaps
                test ! -f $ELCDIR/Makefile.in || rm -rf $ELCDIR/Makefile.in
                test ! -f $ELCDIR/Makefile    || rm -rf $ELCDIR/Makefile
	              test ! -d $ELCDIR || rm -f $ELCDIR/*.elc $ELCDIR/*.el $ELCDIR/install.log $ELCDIR/vm-init.el;
	              test ! -d $ELCDIR || rm -rf $ELCDIR
            fi
	fi
	if [ ! -d $ELCDIR ]; then
	    install -m 755 -d $ELCDIR
	fi
	cd $ELDIR
	# if we do not have make, well, we are hosed.
	LOG=`tempfile`;
	trap "test -f $LOG && mv -f $LOG $ELCDIR/install.log > /dev/null 2>&1" exit
	if [ -x /usr/bin/make ]; then
            # Save some files which "make clean" removes
	    # but which are shipped in the .deb
	    for f in $PRECIOUS; do
		test ! -f $f || cp -a $f $f.precious
	    done
	    make clean                                        > $LOG;
	    (make prefix=/usr  EMACS=$FLAVOUR EMACS_FLAVOR=$EMACS_FLAVOR) >> $LOG 2>&1 ;
	    echo "tar cf - . | (cd $ELCDIR; tar xpf -)"      >> $LOG;
	    tar cf - . | (cd $ELCDIR; tar xpf -)
            make clean                                       >> $LOG;
            # Restore the saved files
	    for f in $PRECIOUS; do
		test ! -f $f.precious || mv $f.precious $f
	    done
	    echo "cd $ELCDIR;"                               >> $LOG;
	    cd $ELCDIR;
	else
	    echo >&2 "You do not seem to have make."
	    echo >&2 "This is not good, since I can't byte compile without make"
	    echo >&2 "I am letting vm remain non-byte compiled, which slows it down."
	    echo >&2 "Please hit return to continue."
	    read ans;
	    echo "You do not seem to have make."         > $LOG;
	    echo "Not byte compiling."                  >> $LOG;
	    echo "tar cf - . | (cd $ELCDIR; tar xpf -)" >> $LOG;
	    tar cf - . | (cd $ELCDIR; tar xpf -)
            echo "rm -f *.elc *~"                       >> $LOG;
            rm -f *.elc *~
	    echo "cd $ELCDIR;"                          >> $LOG;
	    cd $ELCDIR;
	fi

	mv $LOG       $ELCDIR/install.log;
        chmod 644     $ELCDIR/install.log;
	sed -e "s|=F|/usr/share/$FLAVOUR/site-lisp/$PACKAGE|" \
            $ELDIR/$STARTFILE > $ELCDIR/$STARTFILE;
	ucf $ELCDIR/$STARTFILE $STARTDIR/50$STARTFILE;

	echo " done."
	;;
    *)
	echo "install/$PACKAGE: Ignoring emacsen flavor $FLAVOUR."
	;;
esac

exit 0


### Local Variables:
### mode: shell-script
### End: