| 1 |
#! /bin/sh |
| 2 |
# /usr/lib/emacsen-common/packages/install/@PACKAGE@ |
| 3 |
set -e |
| 4 |
|
| 5 |
FLAVOR=$1 |
| 6 |
PACKAGE=@PACKAGE@ |
| 7 |
PKGSNAME=mew |
| 8 |
|
| 9 |
case $FLAVOR in |
| 10 |
*xemacs*|emacs2[0-5]|emacs1?|mule2) |
| 11 |
exit 0 |
| 12 |
;; |
| 13 |
esac |
| 14 |
|
| 15 |
ELCDIR=/usr/share/$FLAVOR/site-lisp/$PKGSNAME |
| 16 |
ELDIR=/usr/share/$PKGSNAME |
| 17 |
TOELDIR=../../../$PKGSNAME |
| 18 |
ELCSTAMP=$ELCDIR/compile-stamp |
| 19 |
if [ -f "$ELCSTAMP" ]; then |
| 20 |
if [ -z "`find "$ELDIR/$PKGSNAME.el" -newer "$ELCSTAMP"`" ]; then |
| 21 |
echo "install/$PACKAGE: already byte-compiled for $FLAVOR, skipped" |
| 22 |
exit 0 |
| 23 |
fi |
| 24 |
rm -f "$ELCSTAMP" |
| 25 |
fi |
| 26 |
|
| 27 |
LOG="$ELCDIR/CompilationLog" |
| 28 |
echo "install/$PACKAGE: byte-compiling for $FLAVOR" |
| 29 |
|
| 30 |
cd "$ELDIR" |
| 31 |
LINKS=`echo *.el etc` |
| 32 |
if [ -d contrib ]; then |
| 33 |
LINKS="$LINKS "`echo contrib/*.el` |
| 34 |
fi |
| 35 |
if [ ! -d "$ELCDIR" ]; then |
| 36 |
mkdir "$ELCDIR" |
| 37 |
chmod 755 "$ELCDIR" |
| 38 |
fi |
| 39 |
cd "$ELCDIR" |
| 40 |
rm -f *.elc __myinit.el |
| 41 |
for f in $LINKS; do |
| 42 |
ln -sf "$TOELDIR/$f" . |
| 43 |
done |
| 44 |
FILES=`/bin/ls -1 *.el | grep -v ^mew-nmz` |
| 45 |
|
| 46 |
cat > __myinit.el << EOF |
| 47 |
(setq inhibit-automatic-native-compilation t) |
| 48 |
(setq native-comp-deferred-compilation nil) |
| 49 |
(setq comp-enable-subr-trampolines nil) |
| 50 |
(setq load-path (cons "." load-path)) |
| 51 |
(setq byte-compile-warnings t) |
| 52 |
(setq mew-compiling t) |
| 53 |
(require 'cl) |
| 54 |
EOF |
| 55 |
|
| 56 |
FLAGS="-q -no-site-file -batch -l __myinit.el -f batch-byte-compile" |
| 57 |
echo "$FLAVOR" $FLAGS $FILES > "$LOG" |
| 58 |
set +e |
| 59 |
"$FLAVOR" $FLAGS $FILES >> "$LOG" 2>&1 |
| 60 |
if [ $? -ne 0 ]; then cat "$LOG"; exit 1; fi |
| 61 |
set -e |
| 62 |
gzip -9f "$LOG" |
| 63 |
chmod 644 *.elc |
| 64 |
|
| 65 |
if [ -f /usr/share/emacsen-common/debian-startup.el ] && \ |
| 66 |
[ ! -f "/etc/$FLAVOR/site-start.d/50$PACKAGE.el" ] && \ |
| 67 |
[ -f "/etc/emacs/site-start.d/50$PACKAGE.el" ] && \ |
| 68 |
[ -d "/etc/$FLAVOR/site-start.d" ]; then |
| 69 |
ln -sf "../../emacs/site-start.d/50$PACKAGE.el" "/etc/$FLAVOR/site-start.d/50$PACKAGE.el" |
| 70 |
fi |
| 71 |
|
| 72 |
rm -f __myinit.el* |
| 73 |
|
| 74 |
echo "install/$PACKAGE: byte-compiling for reverse dependency" |
| 75 |
pkgs= |
| 76 |
for p in w3m-el:w3m w3m-el-snapshot:w3m; do |
| 77 |
pkg=`echo $p | cut -d : -f 1` |
| 78 |
sname=`echo $p | cut -d : -f 2` |
| 79 |
dir=/usr/share/$FLAVOR/site-lisp/$sname |
| 80 |
if [ -n "$sname" ] && [ -d "$dir" ] && [ -f "/usr/lib/emacsen-common/packages/install/$pkg" ]; then |
| 81 |
rm -f "$dir"/*.elc "$dir"/*/*.elc "$dir"/*-stamp |
| 82 |
pkgs="$pkg $pkgs" |
| 83 |
fi |
| 84 |
done |
| 85 |
for pkg in $pkgs; do |
| 86 |
"/usr/lib/emacsen-common/packages/install/$pkg" "$FLAVOR" |
| 87 |
done |
| 88 |
|
| 89 |
touch "$ELCSTAMP" |
| 90 |
exit 0 |