Gentoo Archives: gentoo-commits

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