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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
|
#!/bin/sh
set -e
FLAVOR=$1
PACKAGE=@PACKAGE@
VERSION=@VERSION@
if [ "X${FLAVOR}" = "X" ]; then
echo Need argument to determin FLAVOR of emacsen
exit 1
fi
if [ "X${PACKAGE}" = "X" ]; then
echo Internal error: need package name
exit 1
fi
if [ "X${FLAVOR}" = Xemacs ]; then exit 0; fi
if [ -e /etc/${FLAVOR}/site-start.d/51semi-init.el ]; then
# remove 51semi-init.el which was left by the wemi package
rm -f /etc/${FLAVOR}/site-start.d/51semi-init.el
fi
ELDIR=/usr/share/emacs/site-lisp/${PACKAGE}
SITELISP=/usr/share/${FLAVOR}/site-lisp
EFLAGS="-no-site-file -batch -q -l ./SEMI-MK.comp"
ELCDIR_BASE=/usr/share/${FLAVOR}/site-lisp/${PACKAGE}
APEL_DIR_BASE=${SITELISP}/apel
FLIM_DIR_BASE=${SITELISP}/flim
BITMAP_MULE_DIR_BASE=${SITELISP}/bitmap-mule
EMACSEN_MULE=${FLAVOR}
EMACSEN_NOMULE=""
FLAVOR_SUFFIX=`echo ${FLAVOR} | cut -s -d - -f 2`
FLAVORTEST=`echo ${FLAVOR} | sed -e s/^s// | cut -c-6`
if [ "X${FLAVORTEST}" = "Xxemacs" ]; then
FLAVOR_BODY=`echo ${FLAVOR} | cut -d - -f 1`
if [ "X${FLAVOR_SUFFIX}" = "Xmule" ]; then
EMACSEN_MULE=`ls /usr/bin/${FLAVOR_BODY}*-mule* 2>/dev/null | head -1`
if [ -n "${EMACSEN_MULE}" ]; then
EMACSEN_MULE=`basename ${EMACSEN_MULE}`
fi
EMACSEN_NOMULE=""
elif [ "X${FLAVOR_SUFFIX}" = "Xnomule" ]; then
EMACSEN_MULE=""
EMACSEN_NOMULE=`ls /usr/bin/${FLAVOR_BODY}*-nomule* 2>/dev/null | head -1`
if [ -n "${EMACSEN_NOMULE}" ]; then
EMACSEN_NOMULE=`basename ${EMACSEN_NOMULE}`
fi
else
FLAVOR_SUFFIX=""
EMACSEN_MULE=`ls /usr/bin/${FLAVOR}*-mule* 2>/dev/null | head -1`
if [ -n "${EMACSEN_MULE}" ]; then
EMACSEN_MULE=`basename ${EMACSEN_MULE}`
fi
EMACSEN_NOMULE=`ls /usr/bin/${FLAVOR}*-nomule* 2>/dev/null | head -1`
if [ -n "${EMACSEN_NOMULE}" ]; then
EMACSEN_NOMULE=`basename ${EMACSEN_NOMULE}`
fi
fi
fi
COMPILED=no
for EMACSEN in "${EMACSEN_MULE}" "${EMACSEN_NOMULE}"; do
if [ -n "${EMACSEN}" ]; then
ELCDIR=${ELCDIR_BASE}
APEL_DIR=${APEL_DIR_BASE}
FLIM_DIR=${FLIM_DIR_BASE}
BITMAP_MULE_DIR=${BITMAP_MULE_DIR_BASE}
if [ "X${FLAVORTEST}" = "Xxemacs" -a -z "${FLAVOR_SUFFIX}" ]; then
if [ "X${EMACSEN}" = "X${EMACSEN_MULE}" ]; then
echo -n "install/${PACKAGE}: Byte-compiling for ${FLAVOR} (mule) ..."
ELCDIR=${ELCDIR}/mule
if [ -d ${APEL_DIR_BASE}/mule ]; then
APEL_DIR=${APEL_DIR_BASE}/mule
fi
if [ -d ${FLIM_DIR_BASE}/mule ]; then
FLIM_DIR=${FLIM_DIR_BASE}/mule
fi
if [ -d ${BITMAP_MULE_DIR_BASE}/mule ]; then
BITMAP_MULE_DIR=${BITMAP_MULE_DIR_BASE}/mule
fi
else
echo -n "install/${PACKAGE}: Byte-compiling for ${FLAVOR} (nomule) ..."
ELCDIR=${ELCDIR}/nomule
if [ -d ${APEL_DIR_BASE}/nomule ]; then
APEL_DIR=${APEL_DIR_BASE}/nomule
fi
if [ -d ${FLIM_DIR_BASE}/nomule ]; then
FLIM_DIR=${FLIM_DIR_BASE}/nomule
fi
if [ -d ${BITMAP_MULE_DIR_BASE}/nomule ]; then
BITMAP_MULE_DIR=${BITMAP_MULE_DIR_BASE}/nomule
fi
fi
else
echo -n "install/${PACKAGE}: Byte-compiling for ${FLAVOR} ..."
fi
STAMP="${ELCDIR}/compile-stamp"
if [ -e "${STAMP}" ]; then
if [ "X${VERSION}" = X"`cat ${STAMP}`" ]; then
echo " skipped. (already compiled)"
else
rm -f ${STAMP}
fi
fi
if [ ! -e "${STAMP}" ]; then
if [ "X${FLAVORTEST}" = "Xxemacs" -a -z "${FLAVOR_SUFFIX}" ]; then
rm -f ${ELCDIR_BASE}/*.el ${ELCDIR_BASE}/*.elc
fi
rm -rf ${ELCDIR}
install -m 755 -d ${ELCDIR}/tmp
cp -r ${ELDIR}/* ${ELCDIR}/tmp/
(cd ${ELCDIR}/tmp
cat << EOF > SEMI-MK.comp
(setq load-path (cons "${APEL_DIR}" load-path))
(setq load-path (cons "${FLIM_DIR}" load-path))
(setq load-path (cons "${BITMAP_MULE_DIR}" load-path))
EOF
cat SEMI-MK >> SEMI-MK.comp
make FLAGS="${EFLAGS}" EMACS=${EMACSEN} LISPDIR=${ELCDIR} install \
> ${ELCDIR}/CompilationLog 2>&1
cd ${ELCDIR}
echo "rm -rf ${ELCDIR}/semi/*.el ${ELCDIR}/tmp" >> ${ELCDIR}/CompilationLog 2>&1
rm -rf ${ELCDIR}/semi/*.el ${ELCDIR}/tmp
echo "mv ${ELCDIR}/semi/* ${ELCDIR}/" >> ${ELCDIR}/CompilationLog 2>&1
mv ${ELCDIR}/semi/* ${ELCDIR}/
echo "rm -rf ${ELCDIR}/semi" >> ${ELCDIR}/CompilationLog 2>&1
rm -rf ${ELCDIR}/semi
cd ${ELDIR}
for f in *.el; do
if [ -f ${ELCDIR}/${f}c ]; then
ln -sf ${ELDIR}/${f} ${ELCDIR}/${f}
fi
done
)
gzip -9 ${ELCDIR}/CompilationLog
chmod 644 ${ELCDIR}/CompilationLog.gz
if [ -f ${ELCDIR}/mime-play.elc ]; then
touch ${ELCDIR}/*.elc
chmod 644 ${ELCDIR}/*.elc
echo "${VERSION}" > ${STAMP}
chmod 644 ${STAMP}
COMPILED=yes
fi
if [ "X${FLAVORTEST}" = "Xxemacs" -a -z "${FLAVOR_SUFFIX}" ]; then
if [ -e ${ELCDIR_BASE}/mule/compile-stamp ]; then
ln -sf ${ELCDIR_BASE}/mule/*.elc ${ELCDIR_BASE}/mule/*.el ${ELCDIR_BASE}/
elif [ -e ${ELCDIR_BASE}/nomule/compile-stamp ]; then
ln -sf ${ELCDIR_BASE}/nomule/*.elc ${ELCDIR_BASE}/nomule/*.el ${ELCDIR_BASE}/
fi
fi
echo " done."
fi
fi
done
if [ "X${COMPILED}" = Xyes ]; then
RECOMPILE_WL=no
RECOMPILE_TGNUS=no
RECOMPILE_W3MEL=no
if [ -d /usr/share/${FLAVOR}/site-lisp/wl ]; then
RECOMPILE_WL=yes
fi
if [ -d /usr/share/${FLAVOR}/site-lisp/t-gnus ]; then
RECOMPILE_TGNUS=yes
fi
if [ -d /usr/share/${FLAVOR}/site-lisp/w3m ]; then
RECOMPILE_W3MEL=yes
fi
if [ "X${RECOMPILE_WL}" = Xyes ]; then
# remove wl/wl-beta before removing w3m-el to prevent redundant byte-compiling
for pkg in wl wl-beta; do
f=/usr/lib/emacsen-common/packages/remove/${pkg}
if [ -f ${f} ]; then
${f} ${FLAVOR}
fi
done
fi
if [ "X${RECOMPILE_TGNUS}" = Xyes ]; then
pkg=t-gnus
f=/usr/lib/emacsen-common/packages/remove/${pkg}
if [ -f ${f} ]; then
${f} ${FLAVOR}
fi
fi
if [ "X${RECOMPILE_W3MEL}" = Xyes ]; then
pkg=w3m-el
f=/usr/lib/emacsen-common/packages/remove/${pkg}
if [ -f ${f} ]; then
${f} ${FLAVOR}
fi
# install w3m-el before installing wl/wl-beta to prevent redundant byte-compiling
pkg=w3m-el
f=/usr/lib/emacsen-common/packages/install/${pkg}
if [ -f ${f} ]; then
${f} ${FLAVOR}
fi
fi
if [ "X${RECOMPILE_TGNUS}" = Xyes ]; then
pkg=t-gnus
if [ ! -d /usr/share/${FLAVOR}/site-lisp/${pkg} ]; then
f=/usr/lib/emacsen-common/packages/install/${pkg}
if [ -f ${f} ]; then
${f} ${FLAVOR}
fi
fi
fi
if [ "X${RECOMPILE_WL}" = Xyes ]; then
if [ ! -d /usr/share/${FLAVOR}/site-lisp/wl ]; then
for pkg in wl wl-beta; do
f=/usr/lib/emacsen-common/packages/install/${pkg}
if [ -f ${f} ]; then
${f} ${FLAVOR}
fi
done
fi
fi
fi
exit 0
|