Line 0
Link Here
|
|
|
1 |
# Copyright 1999-2015 Gentoo Foundation |
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# $Header: /var/cvsroot/gentoo-x86/app-editors/emacs/emacs-24.4-r2.ebuild,v 1.1 2015/01/23 20:38:44 ulm Exp $ |
4 |
|
5 |
EAPI=5 |
6 |
|
7 |
inherit elisp-common eutils flag-o-matic multilib readme.gentoo |
8 |
|
9 |
DESCRIPTION="The extensible, customizable, self-documenting real-time display editor" |
10 |
HOMEPAGE="http://www.gnu.org/software/emacs/" |
11 |
SRC_URI="mirror://gnu/emacs/${P}.tar.xz |
12 |
http://dev.gentoo.org/~ulm/emacs/${P}-patches-3.tar.xz" |
13 |
|
14 |
LICENSE="GPL-3+ FDL-1.3+ BSD HPND MIT W3C unicode PSF-2" |
15 |
SLOT="24" |
16 |
KEYWORDS="amd64 ~arm ~mips ~ppc ~x86" |
17 |
IUSE="acl alsa aqua athena dbus games gconf gfile gif gnutls gpm gsettings gtk +gtk3 gzip-el hesiod imagemagick +inotify jpeg kerberos libxml2 livecd m17n-lib motif pax_kernel png selinux sound source svg tiff toolkit-scroll-bars wide-int X Xaw3d xft +xpm zlib" |
18 |
REQUIRED_USE="?? ( aqua X )" |
19 |
|
20 |
RDEPEND="sys-libs/ncurses |
21 |
>=app-admin/eselect-emacs-1.16 |
22 |
>=app-emacs/emacs-common-gentoo-1.4-r1[games?,X?] |
23 |
net-libs/liblockfile |
24 |
acl? ( virtual/acl ) |
25 |
alsa? ( media-libs/alsa-lib ) |
26 |
dbus? ( sys-apps/dbus ) |
27 |
gfile? ( >=dev-libs/glib-2.28.6 ) |
28 |
gnutls? ( net-libs/gnutls ) |
29 |
gpm? ( sys-libs/gpm ) |
30 |
hesiod? ( net-dns/hesiod ) |
31 |
kerberos? ( virtual/krb5 ) |
32 |
libxml2? ( >=dev-libs/libxml2-2.2.0 ) |
33 |
selinux? ( sys-libs/libselinux ) |
34 |
zlib? ( sys-libs/zlib ) |
35 |
X? ( |
36 |
x11-libs/libXmu |
37 |
x11-libs/libXt |
38 |
x11-misc/xbitmaps |
39 |
gconf? ( >=gnome-base/gconf-2.26.2 ) |
40 |
gsettings? ( >=dev-libs/glib-2.28.6 ) |
41 |
gif? ( media-libs/giflib ) |
42 |
jpeg? ( virtual/jpeg:0= ) |
43 |
png? ( >=media-libs/libpng-1.4:0= ) |
44 |
svg? ( >=gnome-base/librsvg-2.0 ) |
45 |
tiff? ( media-libs/tiff ) |
46 |
xpm? ( x11-libs/libXpm ) |
47 |
imagemagick? ( >=media-gfx/imagemagick-6.6.2 ) |
48 |
xft? ( |
49 |
media-libs/fontconfig |
50 |
media-libs/freetype |
51 |
x11-libs/libXft |
52 |
m17n-lib? ( |
53 |
>=dev-libs/libotf-0.9.4 |
54 |
>=dev-libs/m17n-lib-1.5.1 |
55 |
) |
56 |
) |
57 |
gtk? ( |
58 |
gtk3? ( x11-libs/gtk+:3 ) |
59 |
!gtk3? ( x11-libs/gtk+:2 ) |
60 |
) |
61 |
!gtk? ( |
62 |
motif? ( >=x11-libs/motif-2.3:0 ) |
63 |
!motif? ( |
64 |
Xaw3d? ( x11-libs/libXaw3d ) |
65 |
!Xaw3d? ( athena? ( x11-libs/libXaw ) ) |
66 |
) |
67 |
) |
68 |
)" |
69 |
|
70 |
DEPEND="${RDEPEND} |
71 |
virtual/pkgconfig |
72 |
gzip-el? ( app-arch/gzip ) |
73 |
pax_kernel? ( |
74 |
sys-apps/attr |
75 |
sys-apps/paxctl |
76 |
)" |
77 |
|
78 |
RDEPEND="${RDEPEND} |
79 |
!<app-editors/emacs-vcs-${PV}" |
80 |
|
81 |
EMACS_SUFFIX="${PN/emacs/emacs-${SLOT}}" |
82 |
SITEFILE="20${PN}-${SLOT}-gentoo.el" |
83 |
# FULL_VERSION keeps the full version number, which is needed in |
84 |
# order to determine some path information correctly for copy/move |
85 |
# operations later on |
86 |
FULL_VERSION="${PV%%_*}" |
87 |
S="${WORKDIR}/emacs-${FULL_VERSION}" |
88 |
|
89 |
src_prepare() { |
90 |
EPATCH_SUFFIX=patch epatch |
91 |
|
92 |
epatch "${FILESDIR}/${PN}-24.3-stderr.patch" |
93 |
epatch "${FILESDIR}/${PN}-24.3-alloc-invalid-frees.patch" |
94 |
epatch "${FILESDIR}/${PN}-24.4-configure.patch" |
95 |
epatch "${FILESDIR}/${PN}-24.4-preload-hack.patch" |
96 |
epatch "${FILESDIR}/${PN}-24.4-lisp.patch" |
97 |
|
98 |
epatch_user |
99 |
|
100 |
# Fix filename reference in redirected man page |
101 |
sed -i -e "/^\\.so/s/etags/&-${EMACS_SUFFIX}/" doc/man/ctags.1 \ |
102 |
|| die "unable to sed ctags.1" |
103 |
|
104 |
#AT_M4DIR=m4 eautoreconf |
105 |
} |
106 |
|
107 |
src_configure() { |
108 |
strip-flags |
109 |
filter-flags -pie #526948 |
110 |
|
111 |
if use sh; then |
112 |
replace-flags "-O[1-9]" -O0 #262359 |
113 |
elif use ia64; then |
114 |
replace-flags "-O[2-9]" -O1 #325373 |
115 |
else |
116 |
replace-flags "-O[3-9]" -O2 |
117 |
fi |
118 |
|
119 |
local myconf |
120 |
|
121 |
if use alsa; then |
122 |
use sound || ewarn \ |
123 |
"USE flag \"alsa\" overrides \"-sound\"; enabling sound support." |
124 |
myconf+=" --with-sound=alsa" |
125 |
else |
126 |
myconf+=" --with-sound=$(usex sound oss)" |
127 |
fi |
128 |
|
129 |
if use X; then |
130 |
myconf+=" --with-x --without-ns" |
131 |
myconf+=" $(use_with gconf)" |
132 |
myconf+=" $(use_with gsettings)" |
133 |
myconf+=" $(use_with toolkit-scroll-bars)" |
134 |
myconf+=" $(use_with gif)" |
135 |
myconf+=" $(use_with jpeg)" |
136 |
myconf+=" $(use_with png)" |
137 |
myconf+=" $(use_with svg rsvg)" |
138 |
myconf+=" $(use_with tiff)" |
139 |
myconf+=" $(use_with xpm)" |
140 |
myconf+=" $(use_with imagemagick)" |
141 |
|
142 |
if use xft; then |
143 |
myconf+=" --with-xft" |
144 |
myconf+=" $(use_with m17n-lib libotf)" |
145 |
myconf+=" $(use_with m17n-lib m17n-flt)" |
146 |
else |
147 |
myconf+=" --without-xft" |
148 |
myconf+=" --without-libotf --without-m17n-flt" |
149 |
use m17n-lib && ewarn \ |
150 |
"USE flag \"m17n-lib\" has no effect if \"xft\" is not set." |
151 |
fi |
152 |
|
153 |
local f |
154 |
if use gtk; then |
155 |
einfo "Configuring to build with GIMP Toolkit (GTK+)" |
156 |
myconf+=" --with-x-toolkit=$(usex gtk3 gtk3 gtk2)" |
157 |
for f in motif Xaw3d athena; do |
158 |
use ${f} && ewarn \ |
159 |
"USE flag \"${f}\" has no effect if \"gtk\" is set." |
160 |
done |
161 |
elif use motif; then |
162 |
einfo "Configuring to build with Motif toolkit" |
163 |
myconf+=" --with-x-toolkit=motif" |
164 |
for f in Xaw3d athena; do |
165 |
use ${f} && ewarn \ |
166 |
"USE flag \"${f}\" has no effect if \"motif\" is set." |
167 |
done |
168 |
elif use athena || use Xaw3d; then |
169 |
einfo "Configuring to build with Athena/Lucid toolkit" |
170 |
myconf+=" --with-x-toolkit=lucid $(use_with Xaw3d xaw3d)" |
171 |
else |
172 |
einfo "Configuring to build with no toolkit" |
173 |
myconf+=" --with-x-toolkit=no" |
174 |
fi |
175 |
elif use aqua; then |
176 |
einfo "Configuring to build with Nextstep (Cocoa) support" |
177 |
myconf+=" --with-ns --disable-ns-self-contained" |
178 |
myconf+=" --without-x" |
179 |
else |
180 |
myconf+=" --without-x --without-ns" |
181 |
fi |
182 |
|
183 |
# Save version information in the Emacs binary. It will be available |
184 |
# in variable "system-configuration-options". |
185 |
myconf+=" GENTOO_PACKAGE=${CATEGORY}/${PF}" |
186 |
|
187 |
econf \ |
188 |
--program-suffix="-${EMACS_SUFFIX}" \ |
189 |
--infodir="${EPREFIX}"/usr/share/info/${EMACS_SUFFIX} \ |
190 |
--localstatedir="${EPREFIX}"/var \ |
191 |
--enable-locallisppath="${EPREFIX}/etc/emacs:${EPREFIX}${SITELISP}" \ |
192 |
--with-gameuser="${GAMES_USER_DED:-games}" \ |
193 |
--without-compress-install \ |
194 |
--with-file-notification=$(usev gfile || usev inotify || echo no) \ |
195 |
$(use_enable acl) \ |
196 |
$(use_with dbus) \ |
197 |
$(use_with gnutls) \ |
198 |
$(use_with gpm) \ |
199 |
$(use_with hesiod) \ |
200 |
$(use_with kerberos) $(use_with kerberos kerberos5) \ |
201 |
$(use_with libxml2 xml2) \ |
202 |
$(use_with selinux) \ |
203 |
$(use_with wide-int) \ |
204 |
$(use_with zlib) \ |
205 |
${myconf} |
206 |
} |
207 |
|
208 |
src_compile() { |
209 |
echo $S |
210 |
$(tc-getCC) -shared -fPIC -o preload.so "${FILESDIR}/preload.c" || die |
211 |
|
212 |
export SANDBOX_ON=0 # for the unbelievers, see Bug #131505 |
213 |
emake |
214 |
} |
215 |
|
216 |
src_install () { |
217 |
emake DESTDIR="${D}" NO_BIN_LINK=t install |
218 |
|
219 |
mv "${ED}"/usr/bin/{emacs-${FULL_VERSION}-,}${EMACS_SUFFIX} \ |
220 |
|| die "moving emacs executable failed" |
221 |
mv "${ED}"/usr/share/man/man1/{emacs-,}${EMACS_SUFFIX}.1 \ |
222 |
|| die "moving emacs man page failed" |
223 |
|
224 |
# move info dir to avoid collisions with the dir file generated by portage |
225 |
mv "${ED}"/usr/share/info/${EMACS_SUFFIX}/dir{,.orig} \ |
226 |
|| die "moving info dir failed" |
227 |
touch "${ED}"/usr/share/info/${EMACS_SUFFIX}/.keepinfodir |
228 |
docompress -x /usr/share/info/${EMACS_SUFFIX}/dir.orig |
229 |
|
230 |
# avoid collision between slots, see bug #169033 e.g. |
231 |
rm "${ED}"/usr/share/emacs/site-lisp/subdirs.el |
232 |
rm -rf "${ED}"/usr/share/{applications,icons} |
233 |
rm -rf "${ED}"/var |
234 |
|
235 |
# remove unused <version>/site-lisp dir |
236 |
rm -rf "${ED}"/usr/share/emacs/${FULL_VERSION}/site-lisp |
237 |
|
238 |
# remove COPYING file (except for etc/COPYING used by describe-copying) |
239 |
rm "${ED}"/usr/share/emacs/${FULL_VERSION}/lisp/COPYING |
240 |
|
241 |
if use gzip-el; then |
242 |
# compress .el files when a corresponding .elc exists |
243 |
find "${ED}"/usr/share/emacs/${FULL_VERSION}/lisp -type f \ |
244 |
-name "*.elc" -print | sed 's/\.elc$/.el/' | xargs gzip -9n |
245 |
assert "gzip .el failed" |
246 |
fi |
247 |
|
248 |
local cdir |
249 |
if use source; then |
250 |
cdir="/usr/share/emacs/${FULL_VERSION}/src" |
251 |
insinto "${cdir}" |
252 |
# This is not meant to install all the source -- just the |
253 |
# C source you might find via find-function |
254 |
doins src/*.{c,h,m} |
255 |
elif has installsources ${FEATURES}; then |
256 |
cdir="/usr/src/debug/${CATEGORY}/${PF}/${S#"${WORKDIR}/"}/src" |
257 |
fi |
258 |
|
259 |
sed -e "${cdir:+#}/^Y/d" -e "s/^[XY]//" >"${T}/${SITEFILE}" <<-EOF |
260 |
X |
261 |
;;; ${PN}-${SLOT} site-lisp configuration |
262 |
X |
263 |
(when (string-match "\\\\\`${FULL_VERSION//./\\\\.}\\\\>" emacs-version) |
264 |
Y (setq find-function-C-source-directory |
265 |
Y "${EPREFIX}${cdir}") |
266 |
X (let ((path (getenv "INFOPATH")) |
267 |
X (dir "${EPREFIX}/usr/share/info/${EMACS_SUFFIX}") |
268 |
X (re "\\\\\`${EPREFIX}/usr/share/info\\\\>")) |
269 |
X (and path |
270 |
X ;; move Emacs Info dir before anything else in /usr/share/info |
271 |
X (let* ((p (cons nil (split-string path ":" t))) (q p)) |
272 |
X (while (and (cdr q) (not (string-match re (cadr q)))) |
273 |
X (setq q (cdr q))) |
274 |
X (setcdr q (cons dir (delete dir (cdr q)))) |
275 |
X (setq Info-directory-list (prune-directory-list (cdr p))))))) |
276 |
EOF |
277 |
elisp-site-file-install "${T}/${SITEFILE}" || die |
278 |
|
279 |
dodoc README BUGS |
280 |
|
281 |
if use aqua; then |
282 |
dodir /Applications/Gentoo |
283 |
rm -rf "${ED}"/Applications/Gentoo/Emacs${EMACS_SUFFIX#emacs}.app |
284 |
mv nextstep/Emacs.app \ |
285 |
"${ED}"/Applications/Gentoo/Emacs${EMACS_SUFFIX#emacs}.app || die |
286 |
fi |
287 |
|
288 |
DOC_CONTENTS="You can set the version to be started by /usr/bin/emacs |
289 |
through the Emacs eselect module, which also redirects man and info |
290 |
pages. Therefore, several Emacs versions can be installed at the |
291 |
same time. \"man emacs.eselect\" for details. |
292 |
\\n\\nIf you upgrade from Emacs version 24.2 or earlier, then it is |
293 |
strongly recommended that you use app-admin/emacs-updater to rebuild |
294 |
all byte-compiled elisp files of the installed Emacs packages." |
295 |
use X && DOC_CONTENTS+="\\n\\nYou need to install some fonts for Emacs. |
296 |
Installing media-fonts/font-adobe-{75,100}dpi on the X server's |
297 |
machine would satisfy basic Emacs requirements under X11. |
298 |
See also https://wiki.gentoo.org/wiki/Xft_support_for_GNU_Emacs |
299 |
for how to enable anti-aliased fonts." |
300 |
use aqua && DOC_CONTENTS+="\\n\\nEmacs${EMACS_SUFFIX#emacs}.app is in |
301 |
\"${EPREFIX}/Applications/Gentoo\". You may want to copy or symlink |
302 |
it into /Applications by yourself." |
303 |
readme.gentoo_create_doc |
304 |
} |
305 |
|
306 |
pkg_preinst() { |
307 |
# move Info dir file to correct name |
308 |
local infodir=/usr/share/info/${EMACS_SUFFIX} f |
309 |
if [[ -f ${ED}${infodir}/dir.orig ]]; then |
310 |
mv "${ED}"${infodir}/dir{.orig,} || die "moving info dir failed" |
311 |
elif [[ -d "${ED}"${infodir} ]]; then |
312 |
# this should not happen in EAPI 4 |
313 |
ewarn "Regenerating Info directory index in ${infodir} ..." |
314 |
rm -f "${ED}"${infodir}/dir{,.*} |
315 |
for f in "${ED}"${infodir}/*; do |
316 |
if [[ ${f##*/} != *-[0-9]* && -e ${f} ]]; then |
317 |
install-info --info-dir="${ED}"${infodir} "${f}" \ |
318 |
|| die "install-info failed" |
319 |
fi |
320 |
done |
321 |
fi |
322 |
} |
323 |
|
324 |
pkg_postinst() { |
325 |
elisp-site-regen |
326 |
|
327 |
local pvr |
328 |
for pvr in ${REPLACING_VERSIONS}; do |
329 |
[[ ${pvr%%[-_]*} = 24.[12] ]] && FORCE_PRINT_ELOG=1 |
330 |
done |
331 |
readme.gentoo_print_elog |
332 |
|
333 |
if use livecd; then |
334 |
# force an update of the emacs symlink for the livecd/dvd, |
335 |
# because some microemacs packages set it with USE=livecd |
336 |
eselect emacs update |
337 |
elif [[ $(readlink "${EROOT}"/usr/bin/emacs) = ${EMACS_SUFFIX} ]]; then |
338 |
# refresh symlinks in case any installed files have changed |
339 |
eselect emacs set ${EMACS_SUFFIX} |
340 |
else |
341 |
eselect emacs update ifunset |
342 |
fi |
343 |
} |
344 |
|
345 |
pkg_postrm() { |
346 |
elisp-site-regen |
347 |
eselect emacs update ifunset |
348 |
} |