| 1 | #! /bin/sh |
| 2 | # /usr/lib/emacsen-common/packages/install/flim |
| 3 | set -e |
| 4 | |
| 5 | FLAVOR=$1 |
| 6 | PACKAGE=flim |
| 7 | |
| 8 | ELCDIR=/usr/share/$FLAVOR/site-lisp/$PACKAGE |
| 9 | ELDIR=/usr/share/$PACKAGE |
| 10 | ELCSTAMP=$ELCDIR/compile-stamp |
| 11 | |
| 12 | case $FLAVOR in |
| 13 | *xemacs*|emacs2[0-3]|emacs1?|mule2) |
| 14 | exit 0 |
| 15 | ;; |
| 16 | esac |
| 17 | |
| 18 | if [ ! -f "/usr/share/$FLAVOR/site-lisp/apel/poem.elc" ]; then exit 0; fi |
| 19 | EMACSEN=$FLAVOR |
| 20 | |
| 21 | if [ -f "$ELCSTAMP" ]; then |
| 22 | if [ -z "`find "$ELDIR/mime.el" -newer "$ELCSTAMP"`" ]; then |
| 23 | echo "install/$PACKAGE: already byte-compiled for $FLAVOR, skipped" |
| 24 | exit 0 |
| 25 | fi |
| 26 | rm -f "$ELCSTAMP" |
| 27 | fi |
| 28 | |
| 29 | LOG="$ELCDIR/CompilationLog" |
| 30 | echo "install/$PACKAGE: byte-compiling for $FLAVOR" |
| 31 | |
| 32 | cd "$ELDIR" |
| 33 | LINKS=`echo *.el` |
| 34 | if [ ! -d "$ELCDIR" ]; then |
| 35 | mkdir "$ELCDIR" |
| 36 | chmod 755 "$ELCDIR" |
| 37 | fi |
| 38 | |
| 39 | cd "$ELCDIR" |
| 40 | TOELDIR=../../../$PACKAGE |
| 41 | rm -f *.elc __myinit.el |
| 42 | for f in $LINKS; do |
| 43 | ln -sf "$TOELDIR/$f" . |
| 44 | done |
| 45 | FILES=`echo *.el | sed s/sasl-xoauth2.el//` |
| 46 | |
| 47 | cat > __myinit.el << EOF |
| 48 | (setq inhibit-automatic-native-compilation t) |
| 49 | (setq native-comp-deferred-compilation nil) |
| 50 | (setq comp-enable-subr-trampolines nil) |
| 51 | (setq load-path (cons "/usr/share/$FLAVOR/site-lisp/apel" load-path)) |
| 52 | (setq load-path (cons "." load-path)) |
| 53 | (setq byte-compile-warnings t) |
| 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 | rm -f __myinit.el* |
| 66 | |
| 67 | if [ -f /usr/share/emacsen-common/debian-startup.el ] && \ |
| 68 | [ ! -f "/etc/$FLAVOR/site-start.d/50$PACKAGE.el" ] && \ |
| 69 | [ -f "/etc/emacs/site-start.d/50$PACKAGE.el" ] && \ |
| 70 | [ -d "/etc/$FLAVOR/site-start.d" ]; then |
| 71 | ln -sf "../../emacs/site-start.d/50$PACKAGE.el" "/etc/$FLAVOR/site-start.d/50$PACKAGE.el" |
| 72 | fi |
| 73 | |
| 74 | echo "install/$PACKAGE: byte-compiling for reverse dependency" |
| 75 | pkgs= |
| 76 | for p in w3m-el:w3m w3m-el-snapshot:w3m semi mu-cite rail lsdb elserv; 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 "$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 |