File: emacsen-install

package info (click to toggle)
emacspeak 24-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 9,092 kB
  • ctags: 4,597
  • sloc: xml: 54,699; lisp: 42,103; tcl: 1,799; makefile: 810; cpp: 603; sh: 566; ansic: 153; perl: 124
file content (116 lines) | stat: -rw-r--r-- 3,314 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
#! /bin/sh -e
#
THISSCRIPT=/usr/lib/emacsen-common/packages/install/emacspeak

# Written by Jim Van Zandt <jrv@debian.org>, borrowing heavily
# from the install scripts for gettext by Santiago Vila
# <sanvila@ctv.es> and octave by Dirk Eddelbuettel <edd@debian.org>.

# set -v

FLAVOR=$1
PACKAGE=emacspeak

if [ ${FLAVOR} = emacs ]; then exit 0; fi

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

if [ -f ${ELCDIR}/lisp/emacspeak.elc ]; then
    # emacspeak is already compiled - apparently we've just been
    # called because some other speech server is being installed.
    cp -ar ${ELDIR}/servers/* ${ELCDIR}/servers;
    cp -ar ${ELDIR}/blurbs/* ${ELCDIR}/blurbs;
    exit 0;
fi

echo install/${PACKAGE}: Handling install for emacsen flavor ${FLAVOR}

if [ ${FLAVOR} = emacs20 ]; then
    echo "  emacspeak does not support emacs20"
    exit 0;
fi

ENAME=`echo $FLAVOR | perl -pe 's/emacs.*/emacs/'`
if [ ${ENAME} = xemacs ] ; then
    echo " emacspeak does not support xemacs"
    exit 0;
    SITEFLAG="-no-site-file"	# if and when xemacs is supported
else 
    if [ ${ENAME} = emacs ]; then # sanity check
	SITEFLAG="--no-site-file"
    else
	echo "unknown flavor $FLAVOR, does not start with emacs or xemacs"
	exit 1
    fi
fi

install -m 755 -d ${ELCDIR}

log=`tempfile`
echo "  Temporary log file is ${log}"

if [ -f /proc/cpuinfo ]; then
    EST=`awk '
    /MHz/{
	min=1146/$NF;
	if (min > 1./6){	# do not print estimate if it is short
		printf(" (~%3.1f min)",min);
	    }
	exit;
    }
    ' /proc/cpuinfo`
else
    EST=""
fi

echo -n "  Byte-compiling ${EST} ..."
echo "$THISSCRIPT byte-compiling for ${FLAVOR}" >>${log} 2>&1
echo "
Copy files from ${ELDIR} to ${ELCDIR}" >>${log} 2>&1
cd ${ELDIR}
cp -r * ${ELCDIR}
cd ${ELCDIR}

echo "
Configure in ${ELCDIR}..." >>${log} 2>&1
make config SRC=${ELCDIR} FLAVOR=${FLAVOR} >>${log} 2>&1

echo "
Byte-compile..." >>${log} 2>&1
make SRC=${ELCDIR} FLAVOR=${FLAVOR} >>${log} 2>&1
echo "done."

echo "
Delete sources for compiled files..." >>${log} 2>&1
cd lisp; rm -vf `echo  *.elc|sed 's/\.elc/.el/g'` >>${log} 2>&1; cd ..

echo "
Replace unchanged files and directories with symlinks to ${ELDIR}/..." >>${log} 2>&1

# don't replace server or blurb directories with symlinks, since other
# packages (emacspeak-ss and eflite) may be copying files there
for x in Makefile README lisp/* etc/* realaudio sawfish shoutcast \
    sounds user-guide xsl ; do
    if diff -rq $x ${ELDIR}/$x >/dev/null 2>&1; then   # unchanged
	echo $x >>${log} 2>&1
	rm -rf $x; 
	ln -s ${ELDIR}/$x $x
    fi
done

PRIORITY=`/usr/sbin/update-alternatives --display $ENAME|awk "/\/usr\/bin\/${FLAVOR} .*priority/{print \\$NF}"`
echo "  New alternative for /usr/bin/emacspeak is /usr/bin/emacspeak.${FLAVOR}"
#echo "...with priority= ${PRIORITY:-0}"
# this will work for xemacs (creating /usr/bin/xemacspeak), if & when 
# xemacs is supported
update-alternatives --install /usr/bin/${ENAME}peak ${ENAME}peak 	\
	/usr/bin/${ENAME}peak.${FLAVOR} ${PRIORITY:-0}
ln -sf ${ELCDIR}/etc/emacspeak.sh /usr/bin/${ENAME}peak.${FLAVOR}
mv ${log} ${ELCDIR}/install.log
chmod 644 ${ELCDIR}/install.log
gzip ${ELCDIR}/install.log
echo "  Compilation log saved to ${ELCDIR}/install.log.gz"
ln -sf /usr/share/doc/emacspeak/DOC ${ELCDIR}/etc/DOC

exit 0