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