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: Wed, 30 Nov 2022 11:59:13
Message-Id: 1669807855.2b5fa51a40a887b4b6dbc1fc770327d53a56967e.ulm@gentoo
1 commit: 2b5fa51a40a887b4b6dbc1fc770327d53a56967e
2 Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
3 AuthorDate: Wed Nov 30 11:30:55 2022 +0000
4 Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org>
5 CommitDate: Wed Nov 30 11:30:55 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2b5fa51a
7
8 app-editors/emacs: Fix ctags command execution vulnerability
9
10 Bug: https://bugs.gentoo.org/883687
11 Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>
12
13 app-editors/emacs/Manifest | 4 +
14 app-editors/emacs/emacs-25.3-r13.ebuild | 355 ++++++++++++++++++++++
15 app-editors/emacs/emacs-26.3-r9.ebuild | 375 +++++++++++++++++++++++
16 app-editors/emacs/emacs-27.2-r7.ebuild | 438 +++++++++++++++++++++++++++
17 app-editors/emacs/emacs-28.2-r2.ebuild | 517 ++++++++++++++++++++++++++++++++
18 5 files changed, 1689 insertions(+)
19
20 diff --git a/app-editors/emacs/Manifest b/app-editors/emacs/Manifest
21 index 5785eee804f0..bba1f3c9607e 100644
22 --- a/app-editors/emacs/Manifest
23 +++ b/app-editors/emacs/Manifest
24 @@ -5,11 +5,15 @@ DIST emacs-23.4.tar.bz2 38646508 BLAKE2B 33dac5d27a63b7aab6b4053964a0ecf7f7939c7
25 DIST emacs-24.5-patches-5.tar.xz 14796 BLAKE2B 3e097f9cdf96a8b0255ce69770f79259ac9bdddbf5aa77c381973e4348d0900ee6dc6ed4af26021811afbb14eff84bc2a370bc8e803d112476554d03b074ce66 SHA512 fe9f9c19ff760e61dcbf1828d4e9e2806c141b47372bdd736be8237183660a28e2ef86a97034d060e244ff81540a2503a1b47655ef84222fddacb3a87f0f34ae
26 DIST emacs-24.5.tar.xz 39759804 BLAKE2B aec253528038686822d1f8ed9a52dff276789ef7744053fc9b6176fceba4d4d8684fe979cf97e756b3feaf734d2377baef81f5efaa5450930a4e94d9f3bca355 SHA512 89dee4c3aadb6e505c523f84c65b5e40e5bf28a586cc8a4518a59581c22972f942bb6f3c772df0d5b2685c3e78247c545c6bb2576e981d1ef0f9298c18ad1677
27 DIST emacs-25.3-patches-3.tar.xz 2828 BLAKE2B 9a367a545d889d2edf0ee95edb856a7367ec6c10ae6c6fe6b2b452f548184a2a721eb72c448f303a639d5210366c11cf64af33fa322496ff1fd6f7a7e995a154 SHA512 fd65b768be3e3b7b6e280324ff5dd9f790a1279775defea370be5a2555fd64c134c004723e0722331e32117901281dfa2ca2ba42ee4fb33037a3eb83617e222b
28 +DIST emacs-25.3-patches-4.tar.xz 5164 BLAKE2B 30ef1e7ac6ee9a702678899cb27ea9c321eb0711d55917118ec99ea9e060e79bae179172d0a2dda5821c19902f6e0813e17ac71c198cd814c265838f96883b87 SHA512 ea487de3bb792386510c23c295441438c2fc4eae085fe9d41e5e16181fd4265c1d205b360ce977070a43343feeafac5b9392ea39414f2b170d7051f89ed58502
29 DIST emacs-25.3.tar.xz 42854740 BLAKE2B 4f4e2572bbef48b75c561497fc22046081e56099b6174725d79b15a5b16d5c886eaf8ff3f75cf561e989ebb092ab9e98ba7503e720a9db7560758b30d5116f23 SHA512 1cce656451b6ca8502ebb229e88bd3ef48b7f9444a10eeac4ea43bd5491b2efacd641dfa35227a33362c3866493d3449cf1df81606563eef44bba0ed668e457f
30 DIST emacs-26.3-patches-2.tar.xz 1780 BLAKE2B f5dc9d041ea8a07549a817a2b18f84c8a75dce1d53e8de7c6751d48e71e27ee5a3626688252e079917b50473d6b3963f191383050799d199223cdd594be24dbe SHA512 33c91a138e2c9ba3146e66dc03cf05a4baef48019b1ca5c487a56b15f561bf208d58b0f2dc7d250682b86437dce1ce5b050887c4a5ef44194c46fbb7a7346d16
31 +DIST emacs-26.3-patches-3.tar.xz 4160 BLAKE2B ae6fac12a2d2d35c31c895f1be9104b54c283cf4385d21e0ccd3825a3349d60495e441a5fa9f535d4b3d4c60da530ee036a475643cb11862f2a6e1bb44dc7deb SHA512 1edfdbbe6a97ffcdb17facc90336dd6f8d3d397bc95cf06fa170a4ca68e653226de8a5c2001d8dc3d3a0144d50421f2208c6fa3a816123ef952cb25df4aace49
32 DIST emacs-26.3.tar.xz 44415140 BLAKE2B aa8434e6431992ee40402f03a890dd2c49784ee76f437888efe61d66b9aa2bdb816eb0bfe1055e9e154a8bb3ed065fee71623741b474d465a96964618ec775e3 SHA512 4d5a4319253afb081e105a3697eb6eeb8d8a0da18cd41346e376ca5af1e180a26e641f76c64fad1b0253168f14a511f0a4d9d4141524fb1cf4d04f25b05a76e9
33 DIST emacs-27.2-patches-3.tar.xz 7776 BLAKE2B c03947780518ebf86994b1af20cc24377094c55c783e3cbb0230da5ecb4c92613c4e6d599cefe51b297cc117e3a832c6b34365cc983da0630a9ca6f39b58d10e SHA512 a72af0dd47989b5e4ceecc48d8dfd1a362cdda17070a6a5a9c53c0448a7bceed3b27efd0dd78a0cbe3eb503015b1475cd52fc01c5aca10a52ad30635f385b190
34 +DIST emacs-27.2-patches-4.tar.xz 10104 BLAKE2B c4a6651744583ed6d85a8f2f27f86999b6cea76229feb6423679f9b9da88e5ac2606fdb6933b4a5c2ada31ac760f3921721a0fd84912a81b8727c0eef84984ae SHA512 fd16fa75e2453c6d3562ff3e98cebc24960774fdc8f0e72ae838376cec090308934e11be8df98fc7a100e14125cb096f23bcb29955e7c809090105ddc51495d6
35 DIST emacs-27.2.tar.xz 44624480 BLAKE2B 245ea96004b90f81ac74de74521cbbe086caf1176937e08157eae12cdde5a0f35fc77f7119272ed812974358e5e95abb05e1c2e4f3b501cf5401ea9274f62156 SHA512 0f63a5a8709b113ef790c1a64845dad05ead096f93f62164ff221c517a35b91ea7bced75a992d794981a85382cda03cca7338da2f5ef8f6ef1459b88018a4ce9
36 DIST emacs-28.1-patches-1.tar.xz 960 BLAKE2B a717923a1b022ff4dafaa27a7198a287b7d5ea5765cef9b719e17c622796707dce855d12d634f836aa1196557e7f780b884027ccc4467fb56d48d710fdd2b82e SHA512 67a393891c3834855b05d4722026bce9da6e68cc15143a7887884e8aba4f78d8daca7d3796b25c68e23f19c300a036db9b91961c50aff901e5d9da448c9c72e9
37 DIST emacs-28.1.tar.xz 47699512 BLAKE2B 42a12bec2dc74f4838ae79b5589fb7439ff415d8ddd34f2ff7a8c503f909ddd4144ad35ae19c758d8627cfa9ed29276b326c5bec3853a77cd179e9fb17d22ad7 SHA512 c146ff7086aba49fa6c18adf4e485a59eb4c6525fddb9d385034446830b8bb0ac9e6fb76e7b6d94a9fddc41643415f36acad57a1ae16a841c97f61bc211459d9
38 +DIST emacs-28.2-patches-1.tar.xz 3404 BLAKE2B af0ea87f8406b3fe646bc32fea5866c1c7bdeeb5bb5ef733a361cf31f96b72b0dc6a7afb9a166f6182b7835cadd7b0b25f61a79abed241788f35a74d5937513f SHA512 02f9f574d2d06750ddf5218aaf3c725f954020bde94492264a9ad1d3294b24866f89d296b126ed26390f0597afb55daad944c31dde2bfedc6ea1ab769ea11c7d
39 DIST emacs-28.2.tar.xz 47722600 BLAKE2B a7e4990658b5e7306510f8dded93aaf0b82cdd9306df8b786526d038c3249ef9579287075f2235eb01a71ae1699db555254f137b86ab2d2305b45895053df552 SHA512 a7cec7e3e82367815a1442f69af54102dbfc434069810a9dec5938a6660cb8b076e6f1fb0bfff9695b15603dbbe05eb9c7dfd92e90cf40fc4d1e5746bce83bd8
40
41 diff --git a/app-editors/emacs/emacs-25.3-r13.ebuild b/app-editors/emacs/emacs-25.3-r13.ebuild
42 new file mode 100644
43 index 000000000000..46c86cb65b9f
44 --- /dev/null
45 +++ b/app-editors/emacs/emacs-25.3-r13.ebuild
46 @@ -0,0 +1,355 @@
47 +# Copyright 1999-2022 Gentoo Authors
48 +# Distributed under the terms of the GNU General Public License v2
49 +
50 +EAPI=8
51 +
52 +inherit autotools elisp-common flag-o-matic readme.gentoo-r1
53 +
54 +DESCRIPTION="The extensible, customizable, self-documenting real-time display editor"
55 +HOMEPAGE="https://www.gnu.org/software/emacs/"
56 +SRC_URI="mirror://gnu/emacs/${P}.tar.xz
57 + https://dev.gentoo.org/~ulm/emacs/${P}-patches-4.tar.xz"
58 +
59 +LICENSE="GPL-3+ FDL-1.3+ BSD HPND MIT W3C unicode PSF-2"
60 +SLOT="25"
61 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
62 +IUSE="acl alsa aqua athena cairo dbus dynamic-loading games gfile gif gpm gsettings gtk gui gzip-el imagemagick +inotify jpeg kerberos libxml2 livecd m17n-lib motif png selinux sound source ssl svg tiff toolkit-scroll-bars wide-int Xaw3d xft +xpm zlib"
63 +
64 +RDEPEND="acct-group/mail
65 + app-emacs/emacs-common[games?,gui(-)?]
66 + net-libs/liblockfile
67 + sys-libs/ncurses:0=
68 + acl? ( virtual/acl )
69 + alsa? ( media-libs/alsa-lib )
70 + dbus? ( sys-apps/dbus )
71 + games? ( acct-group/gamestat )
72 + gpm? ( sys-libs/gpm )
73 + !inotify? ( gfile? ( >=dev-libs/glib-2.28.6 ) )
74 + kerberos? ( virtual/krb5 )
75 + libxml2? ( >=dev-libs/libxml2-2.2.0 )
76 + selinux? ( sys-libs/libselinux )
77 + ssl? ( net-libs/gnutls:0= )
78 + zlib? ( sys-libs/zlib )
79 + gui? ( !aqua? (
80 + x11-libs/libICE
81 + x11-libs/libSM
82 + x11-libs/libX11
83 + x11-libs/libXext
84 + x11-libs/libXfixes
85 + x11-libs/libXinerama
86 + x11-libs/libXrandr
87 + x11-libs/libxcb
88 + x11-misc/xbitmaps
89 + gsettings? ( >=dev-libs/glib-2.28.6 )
90 + gif? ( media-libs/giflib:0= )
91 + jpeg? ( media-libs/libjpeg-turbo:0= )
92 + png? ( >=media-libs/libpng-1.4:0= )
93 + svg? ( >=gnome-base/librsvg-2.0 )
94 + tiff? ( media-libs/tiff:0 )
95 + xpm? ( x11-libs/libXpm )
96 + imagemagick? ( >=media-gfx/imagemagick-6.6.2:0= )
97 + xft? (
98 + media-libs/fontconfig
99 + media-libs/freetype
100 + x11-libs/libXft
101 + x11-libs/libXrender
102 + cairo? ( >=x11-libs/cairo-1.12.18[X] )
103 + m17n-lib? (
104 + >=dev-libs/libotf-0.9.4
105 + >=dev-libs/m17n-lib-1.5.1
106 + )
107 + )
108 + gtk? ( x11-libs/gtk+:3 )
109 + !gtk? (
110 + motif? (
111 + >=x11-libs/motif-2.3:0
112 + x11-libs/libXpm
113 + x11-libs/libXmu
114 + x11-libs/libXt
115 + )
116 + !motif? (
117 + Xaw3d? (
118 + x11-libs/libXaw3d
119 + x11-libs/libXmu
120 + x11-libs/libXt
121 + )
122 + !Xaw3d? ( athena? (
123 + x11-libs/libXaw
124 + x11-libs/libXmu
125 + x11-libs/libXt
126 + ) )
127 + )
128 + )
129 + ) )"
130 +
131 +DEPEND="${RDEPEND}
132 + gui? ( !aqua? ( x11-base/xorg-proto ) )"
133 +
134 +BDEPEND="virtual/pkgconfig
135 + gzip-el? ( app-arch/gzip )"
136 +
137 +IDEPEND="app-eselect/eselect-emacs"
138 +
139 +RDEPEND+=" ${IDEPEND}"
140 +
141 +EMACS_SUFFIX="emacs-${SLOT}"
142 +SITEFILE="20${EMACS_SUFFIX}-gentoo.el"
143 +# FULL_VERSION keeps the full version number, which is needed in
144 +# order to determine some path information correctly for copy/move
145 +# operations later on
146 +FULL_VERSION="${PV%%_*}"
147 +S="${WORKDIR}/emacs-${FULL_VERSION}"
148 +PATCHES=("${WORKDIR}/patch")
149 +
150 +src_prepare() {
151 + default
152 +
153 + # Fix filename reference in redirected man page
154 + sed -i -e "/^\\.so/s/etags/&-${EMACS_SUFFIX}/" doc/man/ctags.1 \
155 + || die "unable to sed ctags.1"
156 +
157 + AT_M4DIR=m4 eautoreconf
158 + touch src/stamp-h.in || die
159 +}
160 +
161 +src_configure() {
162 + strip-flags
163 + filter-flags -pie #526948
164 +
165 + if use ia64; then
166 + replace-flags "-O[2-9]" -O1 #325373
167 + else
168 + replace-flags "-O[3-9]" -O2
169 + fi
170 +
171 + # Don't trigger a floating point exception for NaNs on alpha
172 + use alpha && append-flags -mieee
173 +
174 + local myconf
175 +
176 + if use alsa; then
177 + use sound || ewarn \
178 + "USE flag \"alsa\" overrides \"-sound\"; enabling sound support."
179 + myconf+=" --with-sound=alsa"
180 + else
181 + myconf+=" --with-sound=$(usex sound oss)"
182 + fi
183 +
184 + if ! use gui; then
185 + einfo "Configuring to build without window system support"
186 + myconf+=" --without-x --without-ns"
187 + elif use aqua; then
188 + einfo "Configuring to build with Nextstep (Macintosh Cocoa) support"
189 + myconf+=" --with-ns --disable-ns-self-contained"
190 + myconf+=" --without-x"
191 + else
192 + myconf+=" --with-x --without-ns"
193 + myconf+=" --without-gconf"
194 + myconf+=" $(use_with gsettings)"
195 + myconf+=" $(use_with toolkit-scroll-bars)"
196 + myconf+=" $(use_with gif)"
197 + myconf+=" $(use_with jpeg)"
198 + myconf+=" $(use_with png)"
199 + myconf+=" $(use_with svg rsvg)"
200 + myconf+=" $(use_with tiff)"
201 + myconf+=" $(use_with xpm)"
202 + myconf+=" $(use_with imagemagick)"
203 +
204 + if use xft; then
205 + myconf+=" --with-xft"
206 + myconf+=" $(use_with cairo)"
207 + myconf+=" $(use_with m17n-lib libotf)"
208 + myconf+=" $(use_with m17n-lib m17n-flt)"
209 + else
210 + myconf+=" --without-xft"
211 + myconf+=" --without-cairo"
212 + myconf+=" --without-libotf --without-m17n-flt"
213 + use cairo && ewarn \
214 + "USE flag \"cairo\" has no effect if \"xft\" is not set."
215 + use m17n-lib && ewarn \
216 + "USE flag \"m17n-lib\" has no effect if \"xft\" is not set."
217 + fi
218 +
219 + local f line
220 + if use gtk; then
221 + einfo "Configuring to build with GIMP Toolkit (GTK+)"
222 + while read line; do ewarn "${line}"; done <<-EOF
223 + Your version of GTK+ will have problems with closing open
224 + displays. This is no problem if you just use one display, but
225 + if you use more than one and close one of them Emacs may crash.
226 + See <https://gitlab.gnome.org/GNOME/gtk/-/issues/221> and
227 + <https://gitlab.gnome.org/GNOME/gtk/-/issues/2315>.
228 + If you intend to use more than one display, then it is strongly
229 + recommended that you compile Emacs with the Athena/Lucid or the
230 + Motif toolkit instead.
231 + EOF
232 + myconf+=" --with-x-toolkit=gtk3"
233 + myconf+=" --without-xwidgets"
234 + for f in motif Xaw3d athena; do
235 + use ${f} && ewarn \
236 + "USE flag \"${f}\" has no effect if \"gtk\" is set."
237 + done
238 + elif use motif; then
239 + einfo "Configuring to build with Motif toolkit"
240 + myconf+=" --with-x-toolkit=motif"
241 + for f in Xaw3d athena; do
242 + use ${f} && ewarn \
243 + "USE flag \"${f}\" has no effect if \"motif\" is set."
244 + done
245 + elif use athena || use Xaw3d; then
246 + einfo "Configuring to build with Athena/Lucid toolkit"
247 + myconf+=" --with-x-toolkit=lucid $(use_with Xaw3d xaw3d)"
248 + else
249 + einfo "Configuring to build with no toolkit"
250 + myconf+=" --with-x-toolkit=no"
251 + fi
252 + fi
253 +
254 + econf \
255 + --program-suffix="-${EMACS_SUFFIX}" \
256 + --infodir="${EPREFIX}"/usr/share/info/${EMACS_SUFFIX} \
257 + --localstatedir="${EPREFIX}"/var \
258 + --enable-locallisppath="${EPREFIX}/etc/emacs:${EPREFIX}${SITELISP}" \
259 + --with-gameuser=":gamestat" \
260 + --without-compress-install \
261 + --without-hesiod \
262 + --with-file-notification=$(usev inotify || usev gfile || echo no) \
263 + $(use_enable acl) \
264 + $(use_with dbus) \
265 + $(use_with dynamic-loading modules) \
266 + $(use_with gpm) \
267 + $(use_with kerberos) $(use_with kerberos kerberos5) \
268 + $(use_with libxml2 xml2) \
269 + $(use_with selinux) \
270 + $(use_with ssl gnutls) \
271 + $(use_with wide-int) \
272 + $(use_with zlib) \
273 + ${myconf}
274 +}
275 +
276 +src_compile() {
277 + # Disable sandbox when dumping. For the unbelievers, see bug #131505
278 + emake RUN_TEMACS="SANDBOX_ON=0 LD_PRELOAD= env ./temacs"
279 +}
280 +
281 +src_install() {
282 + emake DESTDIR="${D}" NO_BIN_LINK=t BLESSMAIL_TARGET= install
283 +
284 + mv "${ED}"/usr/bin/{emacs-${FULL_VERSION}-,}${EMACS_SUFFIX} \
285 + || die "moving emacs executable failed"
286 + mv "${ED}"/usr/share/man/man1/{emacs-,}${EMACS_SUFFIX}.1 \
287 + || die "moving emacs man page failed"
288 +
289 + # move info dir to avoid collisions with the dir file generated by portage
290 + mv "${ED}"/usr/share/info/${EMACS_SUFFIX}/dir{,.orig} \
291 + || die "moving info dir failed"
292 + touch "${ED}"/usr/share/info/${EMACS_SUFFIX}/.keepinfodir
293 + docompress -x /usr/share/info/${EMACS_SUFFIX}/dir.orig
294 +
295 + # movemail must be setgid mail
296 + fowners root:mail /usr/libexec/emacs/${FULL_VERSION}/${CHOST}/movemail
297 + fperms 2751 /usr/libexec/emacs/${FULL_VERSION}/${CHOST}/movemail
298 +
299 + # avoid collision between slots, see bug #169033 e.g.
300 + rm "${ED}"/usr/share/emacs/site-lisp/subdirs.el || die
301 + rm -rf "${ED}"/usr/share/{appdata,applications,icons} || die
302 + rm -rf "${ED}"/var || die
303 +
304 + # remove unused <version>/site-lisp dir
305 + rm -rf "${ED}"/usr/share/emacs/${FULL_VERSION}/site-lisp || die
306 +
307 + # remove COPYING file (except for etc/COPYING used by describe-copying)
308 + rm "${ED}"/usr/share/emacs/${FULL_VERSION}/lisp/COPYING || die
309 +
310 + if use gzip-el; then
311 + # compress .el files when a corresponding .elc exists
312 + find "${ED}"/usr/share/emacs/${FULL_VERSION}/lisp -type f \
313 + -name "*.elc" -print | sed 's/\.elc$/.el/' | xargs gzip -9n
314 + assert "gzip .el failed"
315 + fi
316 +
317 + local cdir
318 + if use source; then
319 + cdir="/usr/share/emacs/${FULL_VERSION}/src"
320 + insinto "${cdir}"
321 + # This is not meant to install all the source -- just the
322 + # C source you might find via find-function
323 + doins src/*.{c,h,m}
324 + elif has installsources ${FEATURES}; then
325 + cdir="/usr/src/debug/${CATEGORY}/${PF}/${S#"${WORKDIR}/"}/src"
326 + fi
327 +
328 + sed -e "${cdir:+#}/^Y/d" -e "s/^[XY]//" >"${T}/${SITEFILE}" <<-EOF || die
329 + X
330 + ;;; ${EMACS_SUFFIX} site-lisp configuration
331 + X
332 + (when (string-match "\\\\\`${FULL_VERSION//./\\\\.}\\\\>" emacs-version)
333 + Y (setq find-function-C-source-directory
334 + Y "${EPREFIX}${cdir}")
335 + X (let ((path (getenv "INFOPATH"))
336 + X (dir "${EPREFIX}/usr/share/info/${EMACS_SUFFIX}")
337 + X (re "\\\\\`${EPREFIX}/usr/share\\\\>"))
338 + X (and path
339 + X ;; move Emacs Info dir before anything else in /usr/share
340 + X (let* ((p (cons nil (split-string path ":" t))) (q p))
341 + X (while (and (cdr q) (not (string-match re (cadr q))))
342 + X (setq q (cdr q)))
343 + X (setcdr q (cons dir (delete dir (cdr q))))
344 + X (setq Info-directory-list (prune-directory-list (cdr p)))))))
345 + EOF
346 + elisp-site-file-install "${T}/${SITEFILE}" || die
347 +
348 + dodoc README BUGS CONTRIBUTE
349 +
350 + if use gui && use aqua; then
351 + dodir /Applications/Gentoo
352 + rm -rf "${ED}"/Applications/Gentoo/${EMACS_SUFFIX^}.app || die
353 + mv nextstep/Emacs.app \
354 + "${ED}"/Applications/Gentoo/${EMACS_SUFFIX^}.app || die
355 + fi
356 +
357 + local DOC_CONTENTS="You can set the version to be started by
358 + /usr/bin/emacs through the Emacs eselect module, which also
359 + redirects man and info pages. Therefore, several Emacs versions can
360 + be installed at the same time. \"man emacs.eselect\" for details.
361 + \\n\\nIf you upgrade from a previous major version of Emacs, then
362 + it is strongly recommended that you use app-admin/emacs-updater
363 + to rebuild all byte-compiled elisp files of the installed Emacs
364 + packages."
365 + if use gui; then
366 + DOC_CONTENTS+="\\n\\nYou need to install some fonts for Emacs.
367 + Installing media-fonts/font-adobe-{75,100}dpi on the X server's
368 + machine would satisfy basic Emacs requirements under X11.
369 + See also https://wiki.gentoo.org/wiki/Xft_support_for_GNU_Emacs
370 + for how to enable anti-aliased fonts."
371 + use aqua && DOC_CONTENTS+="\\n\\n${EMACS_SUFFIX^}.app is in
372 + \"${EPREFIX}/Applications/Gentoo\". You may want to copy or
373 + symlink it into /Applications by yourself."
374 + fi
375 + readme.gentoo_create_doc
376 +}
377 +
378 +pkg_preinst() {
379 + # move Info dir file to correct name
380 + if [[ -d ${ED}/usr/share/info ]]; then
381 + mv "${ED}"/usr/share/info/${EMACS_SUFFIX}/dir{.orig,} || die
382 + fi
383 +}
384 +
385 +pkg_postinst() {
386 + elisp-site-regen
387 + readme.gentoo_print_elog
388 +
389 + if use livecd; then
390 + # force an update of the emacs symlink for the livecd/dvd,
391 + # because some microemacs packages set it with USE=livecd
392 + eselect emacs update
393 + else
394 + eselect emacs update ifunset
395 + fi
396 +}
397 +
398 +pkg_postrm() {
399 + elisp-site-regen
400 + eselect emacs update ifunset
401 +}
402
403 diff --git a/app-editors/emacs/emacs-26.3-r9.ebuild b/app-editors/emacs/emacs-26.3-r9.ebuild
404 new file mode 100644
405 index 000000000000..c093e7366f68
406 --- /dev/null
407 +++ b/app-editors/emacs/emacs-26.3-r9.ebuild
408 @@ -0,0 +1,375 @@
409 +# Copyright 1999-2022 Gentoo Authors
410 +# Distributed under the terms of the GNU General Public License v2
411 +
412 +EAPI=8
413 +
414 +inherit elisp-common flag-o-matic readme.gentoo-r1
415 +
416 +DESCRIPTION="The extensible, customizable, self-documenting real-time display editor"
417 +HOMEPAGE="https://www.gnu.org/software/emacs/"
418 +SRC_URI="mirror://gnu/emacs/${P}.tar.xz
419 + https://dev.gentoo.org/~ulm/emacs/${P}-patches-3.tar.xz"
420 +
421 +LICENSE="GPL-3+ FDL-1.3+ BSD HPND MIT W3C unicode PSF-2"
422 +SLOT="26"
423 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
424 +IUSE="acl alsa aqua athena cairo dbus dynamic-loading games gfile gif gpm gsettings gtk gui gzip-el imagemagick +inotify jpeg kerberos lcms libxml2 livecd m17n-lib mailutils motif png selinux sound source ssl svg systemd +threads tiff toolkit-scroll-bars wide-int Xaw3d xft +xpm xwidgets zlib"
425 +
426 +RDEPEND="app-emacs/emacs-common[games?,gui(-)?]
427 + sys-libs/ncurses:0=
428 + acl? ( virtual/acl )
429 + alsa? ( media-libs/alsa-lib )
430 + dbus? ( sys-apps/dbus )
431 + games? ( acct-group/gamestat )
432 + gpm? ( sys-libs/gpm )
433 + !inotify? ( gfile? ( >=dev-libs/glib-2.28.6 ) )
434 + kerberos? ( virtual/krb5 )
435 + lcms? ( media-libs/lcms:2 )
436 + libxml2? ( >=dev-libs/libxml2-2.2.0 )
437 + mailutils? ( net-mail/mailutils[clients] )
438 + !mailutils? ( acct-group/mail net-libs/liblockfile )
439 + selinux? ( sys-libs/libselinux )
440 + ssl? ( net-libs/gnutls:0= )
441 + systemd? ( sys-apps/systemd )
442 + zlib? ( sys-libs/zlib )
443 + gui? ( !aqua? (
444 + x11-libs/libICE
445 + x11-libs/libSM
446 + x11-libs/libX11
447 + x11-libs/libXext
448 + x11-libs/libXfixes
449 + x11-libs/libXinerama
450 + x11-libs/libXrandr
451 + x11-libs/libxcb
452 + x11-misc/xbitmaps
453 + gsettings? ( >=dev-libs/glib-2.28.6 )
454 + gif? ( media-libs/giflib:0= )
455 + jpeg? ( media-libs/libjpeg-turbo:0= )
456 + png? ( >=media-libs/libpng-1.4:0= )
457 + svg? ( >=gnome-base/librsvg-2.0 )
458 + tiff? ( media-libs/tiff:0 )
459 + xpm? ( x11-libs/libXpm )
460 + imagemagick? ( >=media-gfx/imagemagick-6.6.2:0= )
461 + xft? (
462 + media-libs/fontconfig
463 + media-libs/freetype
464 + x11-libs/libXft
465 + x11-libs/libXrender
466 + cairo? ( >=x11-libs/cairo-1.12.18[X] )
467 + m17n-lib? (
468 + >=dev-libs/libotf-0.9.4
469 + >=dev-libs/m17n-lib-1.5.1
470 + )
471 + )
472 + gtk? (
473 + x11-libs/gtk+:3
474 + xwidgets? (
475 + net-libs/webkit-gtk:4=
476 + x11-libs/libXcomposite
477 + )
478 + )
479 + !gtk? (
480 + motif? (
481 + >=x11-libs/motif-2.3:0
482 + x11-libs/libXpm
483 + x11-libs/libXmu
484 + x11-libs/libXt
485 + )
486 + !motif? (
487 + Xaw3d? (
488 + x11-libs/libXaw3d
489 + x11-libs/libXmu
490 + x11-libs/libXt
491 + )
492 + !Xaw3d? ( athena? (
493 + x11-libs/libXaw
494 + x11-libs/libXmu
495 + x11-libs/libXt
496 + ) )
497 + )
498 + )
499 + ) )"
500 +
501 +DEPEND="${RDEPEND}
502 + gui? ( !aqua? ( x11-base/xorg-proto ) )"
503 +
504 +BDEPEND="virtual/pkgconfig
505 + gzip-el? ( app-arch/gzip )"
506 +
507 +IDEPEND="app-eselect/eselect-emacs"
508 +
509 +RDEPEND+=" ${IDEPEND}"
510 +
511 +EMACS_SUFFIX="emacs-${SLOT}"
512 +SITEFILE="20${EMACS_SUFFIX}-gentoo.el"
513 +# FULL_VERSION keeps the full version number, which is needed in
514 +# order to determine some path information correctly for copy/move
515 +# operations later on
516 +FULL_VERSION="${PV%%_*}"
517 +S="${WORKDIR}/emacs-${FULL_VERSION}"
518 +PATCHES=("${WORKDIR}/patch")
519 +
520 +src_prepare() {
521 + default
522 +
523 + # Fix filename reference in redirected man page
524 + sed -i -e "/^\\.so/s/etags/&-${EMACS_SUFFIX}/" doc/man/ctags.1 || die
525 +
526 + #AT_M4DIR=m4 eautoreconf
527 +}
528 +
529 +src_configure() {
530 + strip-flags
531 + filter-flags -pie #526948
532 +
533 + if use ia64; then
534 + replace-flags "-O[2-9]" -O1 #325373
535 + else
536 + replace-flags "-O[3-9]" -O2
537 + fi
538 +
539 + local myconf
540 +
541 + if use alsa; then
542 + use sound || ewarn \
543 + "USE flag \"alsa\" overrides \"-sound\"; enabling sound support."
544 + myconf+=" --with-sound=alsa"
545 + else
546 + myconf+=" --with-sound=$(usex sound oss)"
547 + fi
548 +
549 + if ! use gui; then
550 + einfo "Configuring to build without window system support"
551 + myconf+=" --without-x --without-ns"
552 + elif use aqua; then
553 + einfo "Configuring to build with Nextstep (Macintosh Cocoa) support"
554 + myconf+=" --with-ns --disable-ns-self-contained"
555 + myconf+=" --without-x"
556 + else
557 + myconf+=" --with-x --without-ns"
558 + myconf+=" --without-gconf"
559 + myconf+=" $(use_with gsettings)"
560 + myconf+=" $(use_with toolkit-scroll-bars)"
561 + myconf+=" $(use_with gif)"
562 + myconf+=" $(use_with jpeg)"
563 + myconf+=" $(use_with png)"
564 + myconf+=" $(use_with svg rsvg)"
565 + myconf+=" $(use_with tiff)"
566 + myconf+=" $(use_with xpm)"
567 + myconf+=" $(use_with imagemagick)"
568 +
569 + if use xft; then
570 + myconf+=" --with-xft"
571 + myconf+=" $(use_with cairo)"
572 + myconf+=" $(use_with m17n-lib libotf)"
573 + myconf+=" $(use_with m17n-lib m17n-flt)"
574 + else
575 + myconf+=" --without-xft"
576 + myconf+=" --without-cairo"
577 + myconf+=" --without-libotf --without-m17n-flt"
578 + use cairo && ewarn \
579 + "USE flag \"cairo\" has no effect if \"xft\" is not set."
580 + use m17n-lib && ewarn \
581 + "USE flag \"m17n-lib\" has no effect if \"xft\" is not set."
582 + fi
583 +
584 + local f line
585 + if use gtk; then
586 + einfo "Configuring to build with GIMP Toolkit (GTK+)"
587 + while read line; do ewarn "${line}"; done <<-EOF
588 + Your version of GTK+ will have problems with closing open
589 + displays. This is no problem if you just use one display, but
590 + if you use more than one and close one of them Emacs may crash.
591 + See <https://gitlab.gnome.org/GNOME/gtk/-/issues/221> and
592 + <https://gitlab.gnome.org/GNOME/gtk/-/issues/2315>.
593 + If you intend to use more than one display, then it is strongly
594 + recommended that you compile Emacs with the Athena/Lucid or the
595 + Motif toolkit instead.
596 + EOF
597 + myconf+=" --with-x-toolkit=gtk3 $(use_with xwidgets)"
598 + for f in motif Xaw3d athena; do
599 + use ${f} && ewarn \
600 + "USE flag \"${f}\" has no effect if \"gtk\" is set."
601 + done
602 + elif use motif; then
603 + einfo "Configuring to build with Motif toolkit"
604 + myconf+=" --with-x-toolkit=motif"
605 + for f in Xaw3d athena; do
606 + use ${f} && ewarn \
607 + "USE flag \"${f}\" has no effect if \"motif\" is set."
608 + done
609 + elif use athena || use Xaw3d; then
610 + einfo "Configuring to build with Athena/Lucid toolkit"
611 + myconf+=" --with-x-toolkit=lucid $(use_with Xaw3d xaw3d)"
612 + else
613 + einfo "Configuring to build with no toolkit"
614 + myconf+=" --with-x-toolkit=no"
615 + fi
616 + ! use gtk && use xwidgets && ewarn \
617 + "USE flag \"xwidgets\" has no effect if \"gtk\" is not set."
618 + fi
619 +
620 + econf \
621 + --program-suffix="-${EMACS_SUFFIX}" \
622 + --includedir="${EPREFIX}"/usr/include/${EMACS_SUFFIX} \
623 + --infodir="${EPREFIX}"/usr/share/info/${EMACS_SUFFIX} \
624 + --localstatedir="${EPREFIX}"/var \
625 + --enable-locallisppath="${EPREFIX}/etc/emacs:${EPREFIX}${SITELISP}" \
626 + --without-compress-install \
627 + --without-hesiod \
628 + --without-pop \
629 + --with-file-notification=$(usev inotify || usev gfile || echo no) \
630 + $(use_enable acl) \
631 + $(use_with dbus) \
632 + $(use_with dynamic-loading modules) \
633 + $(use_with games gameuser ":gamestat") \
634 + $(use_with gpm) \
635 + $(use_with kerberos) $(use_with kerberos kerberos5) \
636 + $(use_with lcms lcms2) \
637 + $(use_with libxml2 xml2) \
638 + $(use_with mailutils) \
639 + $(use_with selinux) \
640 + $(use_with ssl gnutls) \
641 + $(use_with systemd libsystemd) \
642 + $(use_with threads) \
643 + $(use_with wide-int) \
644 + $(use_with zlib) \
645 + ${myconf}
646 +}
647 +
648 +src_compile() {
649 + # Disable sandbox when dumping. For the unbelievers, see bug #131505
650 + emake RUN_TEMACS="SANDBOX_ON=0 LD_PRELOAD= env ./temacs"
651 +}
652 +
653 +src_install() {
654 + emake DESTDIR="${D}" NO_BIN_LINK=t BLESSMAIL_TARGET= install
655 +
656 + mv "${ED}"/usr/bin/{emacs-${FULL_VERSION}-,}${EMACS_SUFFIX} || die
657 + mv "${ED}"/usr/share/man/man1/{emacs-,}${EMACS_SUFFIX}.1 || die
658 + mv "${ED}"/usr/share/metainfo/{emacs-,}${EMACS_SUFFIX}.appdata.xml || die
659 +
660 + # move info dir to avoid collisions with the dir file generated by portage
661 + mv "${ED}"/usr/share/info/${EMACS_SUFFIX}/dir{,.orig} || die
662 + touch "${ED}"/usr/share/info/${EMACS_SUFFIX}/.keepinfodir
663 + docompress -x /usr/share/info/${EMACS_SUFFIX}/dir.orig
664 +
665 + # movemail must be setgid mail
666 + if ! use mailutils; then
667 + fowners root:mail /usr/libexec/emacs/${FULL_VERSION}/${CHOST}/movemail
668 + fperms 2751 /usr/libexec/emacs/${FULL_VERSION}/${CHOST}/movemail
669 + fi
670 +
671 + # avoid collision between slots, see bug #169033 e.g.
672 + rm "${ED}"/usr/share/emacs/site-lisp/subdirs.el || die
673 + rm -rf "${ED}"/usr/share/{applications,icons} || die
674 + rm -rf "${ED}/usr/$(get_libdir)" || die
675 + rm -rf "${ED}"/var || die
676 +
677 + # remove unused <version>/site-lisp dir
678 + rm -rf "${ED}"/usr/share/emacs/${FULL_VERSION}/site-lisp || die
679 +
680 + # remove COPYING file (except for etc/COPYING used by describe-copying)
681 + rm "${ED}"/usr/share/emacs/${FULL_VERSION}/lisp/COPYING || die
682 +
683 + if use systemd; then
684 + insinto /usr/lib/systemd/user
685 + sed -e "/^##/d" \
686 + -e "/^ExecStart/s,emacs,${EPREFIX}/usr/bin/${EMACS_SUFFIX}," \
687 + -e "/^ExecStop/s,emacsclient,${EPREFIX}/usr/bin/&-${EMACS_SUFFIX}," \
688 + etc/emacs.service | newins - ${EMACS_SUFFIX}.service
689 + assert
690 + fi
691 +
692 + if use gzip-el; then
693 + # compress .el files when a corresponding .elc exists
694 + find "${ED}"/usr/share/emacs/${FULL_VERSION}/lisp -type f \
695 + -name "*.elc" -print | sed 's/\.elc$/.el/' | xargs gzip -9n
696 + assert "gzip .el failed"
697 + fi
698 +
699 + local cdir
700 + if use source; then
701 + cdir="/usr/share/emacs/${FULL_VERSION}/src"
702 + insinto "${cdir}"
703 + # This is not meant to install all the source -- just the
704 + # C source you might find via find-function
705 + doins src/*.{c,h,m}
706 + elif has installsources ${FEATURES}; then
707 + cdir="/usr/src/debug/${CATEGORY}/${PF}/${S#"${WORKDIR}/"}/src"
708 + fi
709 +
710 + sed -e "${cdir:+#}/^Y/d" -e "s/^[XY]//" >"${T}/${SITEFILE}" <<-EOF || die
711 + X
712 + ;;; ${EMACS_SUFFIX} site-lisp configuration
713 + X
714 + (when (string-match "\\\\\`${FULL_VERSION//./\\\\.}\\\\>" emacs-version)
715 + Y (setq find-function-C-source-directory
716 + Y "${EPREFIX}${cdir}")
717 + X (let ((path (getenv "INFOPATH"))
718 + X (dir "${EPREFIX}/usr/share/info/${EMACS_SUFFIX}")
719 + X (re "\\\\\`${EPREFIX}/usr/share\\\\>"))
720 + X (and path
721 + X ;; move Emacs Info dir before anything else in /usr/share
722 + X (let* ((p (cons nil (split-string path ":" t))) (q p))
723 + X (while (and (cdr q) (not (string-match re (cadr q))))
724 + X (setq q (cdr q)))
725 + X (setcdr q (cons dir (delete dir (cdr q))))
726 + X (setq Info-directory-list (prune-directory-list (cdr p)))))))
727 + EOF
728 + elisp-site-file-install "${T}/${SITEFILE}" || die
729 +
730 + dodoc README BUGS CONTRIBUTE
731 +
732 + if use gui && use aqua; then
733 + dodir /Applications/Gentoo
734 + rm -rf "${ED}"/Applications/Gentoo/${EMACS_SUFFIX^}.app || die
735 + mv nextstep/Emacs.app \
736 + "${ED}"/Applications/Gentoo/${EMACS_SUFFIX^}.app || die
737 + fi
738 +
739 + local DOC_CONTENTS="You can set the version to be started by
740 + /usr/bin/emacs through the Emacs eselect module, which also
741 + redirects man and info pages. Therefore, several Emacs versions can
742 + be installed at the same time. \"man emacs.eselect\" for details.
743 + \\n\\nIf you upgrade from a previous major version of Emacs, then
744 + it is strongly recommended that you use app-admin/emacs-updater
745 + to rebuild all byte-compiled elisp files of the installed Emacs
746 + packages."
747 + if use gui; then
748 + DOC_CONTENTS+="\\n\\nYou need to install some fonts for Emacs.
749 + Installing media-fonts/font-adobe-{75,100}dpi on the X server's
750 + machine would satisfy basic Emacs requirements under X11.
751 + See also https://wiki.gentoo.org/wiki/Xft_support_for_GNU_Emacs
752 + for how to enable anti-aliased fonts."
753 + use aqua && DOC_CONTENTS+="\\n\\n${EMACS_SUFFIX^}.app is in
754 + \"${EPREFIX}/Applications/Gentoo\". You may want to copy or
755 + symlink it into /Applications by yourself."
756 + fi
757 + readme.gentoo_create_doc
758 +}
759 +
760 +pkg_preinst() {
761 + # move Info dir file to correct name
762 + if [[ -d ${ED}/usr/share/info ]]; then
763 + mv "${ED}"/usr/share/info/${EMACS_SUFFIX}/dir{.orig,} || die
764 + fi
765 +}
766 +
767 +pkg_postinst() {
768 + elisp-site-regen
769 + readme.gentoo_print_elog
770 +
771 + if use livecd; then
772 + # force an update of the emacs symlink for the livecd/dvd,
773 + # because some microemacs packages set it with USE=livecd
774 + eselect emacs update
775 + else
776 + eselect emacs update ifunset
777 + fi
778 +}
779 +
780 +pkg_postrm() {
781 + elisp-site-regen
782 + eselect emacs update ifunset
783 +}
784
785 diff --git a/app-editors/emacs/emacs-27.2-r7.ebuild b/app-editors/emacs/emacs-27.2-r7.ebuild
786 new file mode 100644
787 index 000000000000..cc325a69c728
788 --- /dev/null
789 +++ b/app-editors/emacs/emacs-27.2-r7.ebuild
790 @@ -0,0 +1,438 @@
791 +# Copyright 1999-2022 Gentoo Authors
792 +# Distributed under the terms of the GNU General Public License v2
793 +
794 +EAPI=8
795 +
796 +inherit elisp-common readme.gentoo-r1 toolchain-funcs #autotools
797 +
798 +if [[ ${PV##*.} = 9999 ]]; then
799 + inherit git-r3
800 + EGIT_REPO_URI="https://git.savannah.gnu.org/git/emacs.git"
801 + EGIT_BRANCH="emacs-27"
802 + EGIT_CHECKOUT_DIR="${WORKDIR}/emacs"
803 + S="${EGIT_CHECKOUT_DIR}"
804 + SLOT="${PV%%.*}-vcs"
805 +else
806 + # FULL_VERSION keeps the full version number, which is needed in
807 + # order to determine some path information correctly for copy/move
808 + # operations later on
809 + FULL_VERSION="${PV%%_*}"
810 + SRC_URI="mirror://gnu/emacs/${P}.tar.xz"
811 + S="${WORKDIR}/emacs-${FULL_VERSION}"
812 + # PV can be in any of the following formats:
813 + # 27.1 released version (slot 27)
814 + # 27.1_rc1 upstream release candidate (27)
815 + # 27.0.9999 live ebuild (slot 27-vcs)
816 + # 27.0.90 upstream prerelease snapshot (27-vcs)
817 + # 27.0.50_pre20191223 snapshot by Gentoo developer (27-vcs)
818 + if [[ ${PV} == *_pre* ]]; then
819 + SRC_URI="https://dev.gentoo.org/~ulm/distfiles/${P}.tar.xz"
820 + S="${WORKDIR}/emacs"
821 + elif [[ ${PV//[0-9]} != "." ]]; then
822 + SRC_URI="https://alpha.gnu.org/gnu/emacs/pretest/${PN}-${PV/_/-}.tar.xz"
823 + fi
824 + # Patchset from proj/emacs-patches.git
825 + SRC_URI+=" https://dev.gentoo.org/~ulm/emacs/${P}-patches-4.tar.xz"
826 + PATCHES=("${WORKDIR}/patch")
827 + SLOT="${PV%%.*}"
828 + [[ ${PV} == *.*.* ]] && SLOT+="-vcs"
829 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
830 +fi
831 +
832 +DESCRIPTION="The extensible, customizable, self-documenting real-time display editor"
833 +HOMEPAGE="https://www.gnu.org/software/emacs/"
834 +
835 +LICENSE="GPL-3+ FDL-1.3+ BSD HPND MIT W3C unicode PSF-2"
836 +IUSE="acl alsa aqua athena cairo dbus dynamic-loading games gfile gif +gmp gpm gsettings gtk gui gzip-el harfbuzz imagemagick +inotify jpeg json kerberos lcms libxml2 livecd m17n-lib mailutils motif png selinux sound source ssl svg systemd +threads tiff toolkit-scroll-bars wide-int Xaw3d xft +xpm xwidgets zlib"
837 +RESTRICT="test"
838 +
839 +RDEPEND="app-emacs/emacs-common[games?,gui(-)?]
840 + sys-libs/ncurses:0=
841 + acl? ( virtual/acl )
842 + alsa? ( media-libs/alsa-lib )
843 + dbus? ( sys-apps/dbus )
844 + games? ( acct-group/gamestat )
845 + gmp? ( dev-libs/gmp:0= )
846 + gpm? ( sys-libs/gpm )
847 + !inotify? ( gfile? ( >=dev-libs/glib-2.28.6 ) )
848 + json? ( dev-libs/jansson:= )
849 + kerberos? ( virtual/krb5 )
850 + lcms? ( media-libs/lcms:2 )
851 + libxml2? ( >=dev-libs/libxml2-2.2.0 )
852 + mailutils? ( net-mail/mailutils[clients] )
853 + !mailutils? ( acct-group/mail net-libs/liblockfile )
854 + selinux? ( sys-libs/libselinux )
855 + ssl? ( net-libs/gnutls:0= )
856 + systemd? ( sys-apps/systemd )
857 + zlib? ( sys-libs/zlib )
858 + gui? ( !aqua? (
859 + x11-libs/libICE
860 + x11-libs/libSM
861 + x11-libs/libX11
862 + x11-libs/libXext
863 + x11-libs/libXfixes
864 + x11-libs/libXinerama
865 + x11-libs/libXrandr
866 + x11-libs/libxcb
867 + x11-misc/xbitmaps
868 + gsettings? ( >=dev-libs/glib-2.28.6 )
869 + gif? ( media-libs/giflib:0= )
870 + jpeg? ( media-libs/libjpeg-turbo:0= )
871 + png? ( >=media-libs/libpng-1.4:0= )
872 + svg? ( >=gnome-base/librsvg-2.0 )
873 + tiff? ( media-libs/tiff:0 )
874 + xpm? ( x11-libs/libXpm )
875 + imagemagick? ( >=media-gfx/imagemagick-6.6.2:0= )
876 + xft? (
877 + media-libs/fontconfig
878 + media-libs/freetype
879 + x11-libs/libXft
880 + x11-libs/libXrender
881 + cairo? ( >=x11-libs/cairo-1.12.18[X] )
882 + harfbuzz? ( media-libs/harfbuzz:0= )
883 + m17n-lib? (
884 + >=dev-libs/libotf-0.9.4
885 + >=dev-libs/m17n-lib-1.5.1
886 + )
887 + )
888 + gtk? (
889 + x11-libs/gtk+:3
890 + xwidgets? (
891 + net-libs/webkit-gtk:4=
892 + x11-libs/libXcomposite
893 + )
894 + )
895 + !gtk? (
896 + motif? (
897 + >=x11-libs/motif-2.3:0
898 + x11-libs/libXpm
899 + x11-libs/libXmu
900 + x11-libs/libXt
901 + )
902 + !motif? (
903 + Xaw3d? (
904 + x11-libs/libXaw3d
905 + x11-libs/libXmu
906 + x11-libs/libXt
907 + )
908 + !Xaw3d? ( athena? (
909 + x11-libs/libXaw
910 + x11-libs/libXmu
911 + x11-libs/libXt
912 + ) )
913 + )
914 + )
915 + ) )"
916 +
917 +DEPEND="${RDEPEND}
918 + gui? ( !aqua? ( x11-base/xorg-proto ) )"
919 +
920 +BDEPEND="sys-apps/texinfo
921 + virtual/pkgconfig
922 + gzip-el? ( app-arch/gzip )"
923 +
924 +IDEPEND="app-eselect/eselect-emacs"
925 +
926 +RDEPEND+=" ${IDEPEND}"
927 +
928 +EMACS_SUFFIX="emacs-${SLOT}"
929 +SITEFILE="20${EMACS_SUFFIX}-gentoo.el"
930 +
931 +src_prepare() {
932 + if [[ ${PV##*.} = 9999 ]]; then
933 + FULL_VERSION=$(sed -n 's/^AC_INIT([^,]*,[ \t]*\([^ \t,)]*\).*/\1/p' \
934 + configure.ac)
935 + [[ ${FULL_VERSION} ]] || die "Cannot determine current Emacs version"
936 + einfo "Emacs branch: ${EGIT_BRANCH}"
937 + einfo "Commit: ${EGIT_VERSION}"
938 + einfo "Emacs version number: ${FULL_VERSION}"
939 + [[ ${FULL_VERSION} =~ ^${PV%.*}(\..*)?$ ]] \
940 + || die "Upstream version number changed to ${FULL_VERSION}"
941 + fi
942 +
943 + default
944 +
945 + # Fix filename reference in redirected man page
946 + sed -i -e "/^\\.so/s/etags/&-${EMACS_SUFFIX}/" doc/man/ctags.1 || die
947 +
948 + #AT_M4DIR=m4 eautoreconf
949 +}
950 +
951 +src_configure() {
952 + local myconf
953 +
954 + if use alsa; then
955 + use sound || ewarn \
956 + "USE flag \"alsa\" overrides \"-sound\"; enabling sound support."
957 + myconf+=" --with-sound=alsa"
958 + else
959 + myconf+=" --with-sound=$(usex sound oss)"
960 + fi
961 +
962 + if ! use gui; then
963 + einfo "Configuring to build without window system support"
964 + myconf+=" --without-x --without-ns"
965 + elif use aqua; then
966 + einfo "Configuring to build with Nextstep (Macintosh Cocoa) support"
967 + myconf+=" --with-ns --disable-ns-self-contained"
968 + myconf+=" --without-x"
969 + else
970 + myconf+=" --with-x --without-ns"
971 + myconf+=" --without-gconf"
972 + myconf+=" $(use_with gsettings)"
973 + myconf+=" $(use_with toolkit-scroll-bars)"
974 + myconf+=" $(use_with gif)"
975 + myconf+=" $(use_with jpeg)"
976 + myconf+=" $(use_with png)"
977 + myconf+=" $(use_with svg rsvg)"
978 + myconf+=" $(use_with tiff)"
979 + myconf+=" $(use_with xpm)"
980 + myconf+=" $(use_with imagemagick)"
981 +
982 + if use xft; then
983 + myconf+=" --with-xft"
984 + myconf+=" $(use_with cairo)"
985 + myconf+=" $(use_with harfbuzz)"
986 + myconf+=" $(use_with m17n-lib libotf)"
987 + myconf+=" $(use_with m17n-lib m17n-flt)"
988 + else
989 + myconf+=" --without-xft"
990 + myconf+=" --without-cairo"
991 + myconf+=" --without-libotf --without-m17n-flt"
992 + use cairo && ewarn \
993 + "USE flag \"cairo\" has no effect if \"xft\" is not set."
994 + use m17n-lib && ewarn \
995 + "USE flag \"m17n-lib\" has no effect if \"xft\" is not set."
996 + fi
997 +
998 + local f line
999 + if use gtk; then
1000 + einfo "Configuring to build with GIMP Toolkit (GTK+)"
1001 + while read line; do ewarn "${line}"; done <<-EOF
1002 + Your version of GTK+ will have problems with closing open
1003 + displays. This is no problem if you just use one display, but
1004 + if you use more than one and close one of them Emacs may crash.
1005 + See <https://gitlab.gnome.org/GNOME/gtk/-/issues/221> and
1006 + <https://gitlab.gnome.org/GNOME/gtk/-/issues/2315>.
1007 + If you intend to use more than one display, then it is strongly
1008 + recommended that you compile Emacs with the Athena/Lucid or the
1009 + Motif toolkit instead.
1010 + EOF
1011 + myconf+=" --with-x-toolkit=gtk3 $(use_with xwidgets)"
1012 + for f in motif Xaw3d athena; do
1013 + use ${f} && ewarn \
1014 + "USE flag \"${f}\" has no effect if \"gtk\" is set."
1015 + done
1016 + elif use motif; then
1017 + einfo "Configuring to build with Motif toolkit"
1018 + myconf+=" --with-x-toolkit=motif"
1019 + for f in Xaw3d athena; do
1020 + use ${f} && ewarn \
1021 + "USE flag \"${f}\" has no effect if \"motif\" is set."
1022 + done
1023 + elif use athena || use Xaw3d; then
1024 + einfo "Configuring to build with Athena/Lucid toolkit"
1025 + myconf+=" --with-x-toolkit=lucid $(use_with Xaw3d xaw3d)"
1026 + else
1027 + einfo "Configuring to build with no toolkit"
1028 + myconf+=" --with-x-toolkit=no"
1029 + fi
1030 + ! use gtk && use xwidgets && ewarn \
1031 + "USE flag \"xwidgets\" has no effect if \"gtk\" is not set."
1032 + fi
1033 +
1034 + if tc-is-cross-compiler; then
1035 + # Configure a CBUILD directory when cross-compiling to make tools
1036 + mkdir "${S}-build" && pushd "${S}-build" >/dev/null || die
1037 + ECONF_SOURCE="${S}" econf_build --without-all --without-x-toolkit
1038 + popd >/dev/null || die
1039 + # Don't try to execute the binary for dumping during the build
1040 + myconf+=" --with-dumping=none"
1041 + elif use m68k; then
1042 + # Workaround for https://debbugs.gnu.org/44531
1043 + myconf+=" --with-dumping=unexec"
1044 + else
1045 + myconf+=" --with-dumping=pdumper"
1046 + fi
1047 +
1048 + econf \
1049 + --program-suffix="-${EMACS_SUFFIX}" \
1050 + --includedir="${EPREFIX}"/usr/include/${EMACS_SUFFIX} \
1051 + --infodir="${EPREFIX}"/usr/share/info/${EMACS_SUFFIX} \
1052 + --localstatedir="${EPREFIX}"/var \
1053 + --enable-locallisppath="${EPREFIX}/etc/emacs:${EPREFIX}${SITELISP}" \
1054 + --without-compress-install \
1055 + --without-hesiod \
1056 + --without-pop \
1057 + --with-file-notification=$(usev inotify || usev gfile || echo no) \
1058 + --with-pdumper \
1059 + $(use_enable acl) \
1060 + $(use_with dbus) \
1061 + $(use_with dynamic-loading modules) \
1062 + $(use_with games gameuser ":gamestat") \
1063 + $(use_with gmp libgmp) \
1064 + $(use_with gpm) \
1065 + $(use_with json) \
1066 + $(use_with kerberos) $(use_with kerberos kerberos5) \
1067 + $(use_with lcms lcms2) \
1068 + $(use_with libxml2 xml2) \
1069 + $(use_with mailutils) \
1070 + $(use_with selinux) \
1071 + $(use_with ssl gnutls) \
1072 + $(use_with systemd libsystemd) \
1073 + $(use_with threads) \
1074 + $(use_with wide-int) \
1075 + $(use_with zlib) \
1076 + ${myconf}
1077 +}
1078 +
1079 +src_compile() {
1080 + if tc-is-cross-compiler; then
1081 + # Build native tools for compiling lisp etc.
1082 + emake -C "${S}-build" src
1083 + emake lib # Cross-compile dependencies first for timestamps
1084 + # Save native build tools in the cross-directory
1085 + cp "${S}-build"/lib-src/make-{docfile,fingerprint} lib-src || die
1086 + # Specify the native Emacs to compile lisp
1087 + emake -C lisp all EMACS="${S}-build/src/emacs"
1088 + fi
1089 +
1090 + emake
1091 +}
1092 +
1093 +src_install() {
1094 + emake DESTDIR="${D}" NO_BIN_LINK=t BLESSMAIL_TARGET= install
1095 +
1096 + mv "${ED}"/usr/bin/{emacs-${FULL_VERSION}-,}${EMACS_SUFFIX} || die
1097 + mv "${ED}"/usr/share/man/man1/{emacs-,}${EMACS_SUFFIX}.1 || die
1098 + mv "${ED}"/usr/share/metainfo/{emacs-,}${EMACS_SUFFIX}.appdata.xml || die
1099 +
1100 + # move info dir to avoid collisions with the dir file generated by portage
1101 + mv "${ED}"/usr/share/info/${EMACS_SUFFIX}/dir{,.orig} || die
1102 + touch "${ED}"/usr/share/info/${EMACS_SUFFIX}/.keepinfodir
1103 + docompress -x /usr/share/info/${EMACS_SUFFIX}/dir.orig
1104 +
1105 + # movemail must be setgid mail
1106 + if ! use mailutils; then
1107 + fowners root:mail /usr/libexec/emacs/${FULL_VERSION}/${CHOST}/movemail
1108 + fperms 2751 /usr/libexec/emacs/${FULL_VERSION}/${CHOST}/movemail
1109 + fi
1110 +
1111 + # avoid collision between slots, see bug #169033 e.g.
1112 + rm "${ED}"/usr/share/emacs/site-lisp/subdirs.el || die
1113 + rm -rf "${ED}"/usr/share/{applications,icons} || die
1114 + rm -rf "${ED}/usr/$(get_libdir)" || die
1115 + rm -rf "${ED}"/var || die
1116 +
1117 + # remove unused <version>/site-lisp dir
1118 + rm -rf "${ED}"/usr/share/emacs/${FULL_VERSION}/site-lisp || die
1119 +
1120 + # remove COPYING file (except for etc/COPYING used by describe-copying)
1121 + rm "${ED}"/usr/share/emacs/${FULL_VERSION}/lisp/COPYING || die
1122 +
1123 + if use systemd; then
1124 + insinto /usr/lib/systemd/user
1125 + sed -e "/^##/d" \
1126 + -e "/^ExecStart/s,emacs,${EPREFIX}/usr/bin/${EMACS_SUFFIX}," \
1127 + -e "/^ExecStop/s,emacsclient,${EPREFIX}/usr/bin/&-${EMACS_SUFFIX}," \
1128 + etc/emacs.service | newins - ${EMACS_SUFFIX}.service
1129 + assert
1130 + fi
1131 +
1132 + if use gzip-el; then
1133 + # compress .el files when a corresponding .elc exists
1134 + find "${ED}"/usr/share/emacs/${FULL_VERSION}/lisp -type f \
1135 + -name "*.elc" -print | sed 's/\.elc$/.el/' | xargs gzip -9n
1136 + assert "gzip .el failed"
1137 + fi
1138 +
1139 + local cdir
1140 + if use source; then
1141 + cdir="/usr/share/emacs/${FULL_VERSION}/src"
1142 + insinto "${cdir}"
1143 + # This is not meant to install all the source -- just the
1144 + # C source you might find via find-function
1145 + doins src/*.{c,h,m}
1146 + elif has installsources ${FEATURES}; then
1147 + cdir="/usr/src/debug/${CATEGORY}/${PF}/${S#"${WORKDIR}/"}/src"
1148 + fi
1149 +
1150 + sed -e "${cdir:+#}/^Y/d" -e "s/^[XY]//" >"${T}/${SITEFILE}" <<-EOF || die
1151 + X
1152 + ;;; ${EMACS_SUFFIX} site-lisp configuration
1153 + X
1154 + (when (string-match "\\\\\`${FULL_VERSION//./\\\\.}\\\\>" emacs-version)
1155 + Y (setq find-function-C-source-directory
1156 + Y "${EPREFIX}${cdir}")
1157 + X (let ((path (getenv "INFOPATH"))
1158 + X (dir "${EPREFIX}/usr/share/info/${EMACS_SUFFIX}")
1159 + X (re "\\\\\`${EPREFIX}/usr/share\\\\>"))
1160 + X (and path
1161 + X ;; move Emacs Info dir before anything else in /usr/share
1162 + X (let* ((p (cons nil (split-string path ":" t))) (q p))
1163 + X (while (and (cdr q) (not (string-match re (cadr q))))
1164 + X (setq q (cdr q)))
1165 + X (setcdr q (cons dir (delete dir (cdr q))))
1166 + X (setq Info-directory-list (prune-directory-list (cdr p)))))))
1167 + EOF
1168 + elisp-site-file-install "${T}/${SITEFILE}" || die
1169 +
1170 + dodoc README BUGS CONTRIBUTE
1171 +
1172 + if use gui && use aqua; then
1173 + dodir /Applications/Gentoo
1174 + rm -rf "${ED}"/Applications/Gentoo/${EMACS_SUFFIX^}.app || die
1175 + mv nextstep/Emacs.app \
1176 + "${ED}"/Applications/Gentoo/${EMACS_SUFFIX^}.app || die
1177 + fi
1178 +
1179 + local DOC_CONTENTS="You can set the version to be started by
1180 + /usr/bin/emacs through the Emacs eselect module, which also
1181 + redirects man and info pages. Therefore, several Emacs versions can
1182 + be installed at the same time. \"man emacs.eselect\" for details.
1183 + \\n\\nIf you upgrade from a previous major version of Emacs, then
1184 + it is strongly recommended that you use app-admin/emacs-updater
1185 + to rebuild all byte-compiled elisp files of the installed Emacs
1186 + packages."
1187 + if use gui; then
1188 + DOC_CONTENTS+="\\n\\nYou need to install some fonts for Emacs.
1189 + Installing media-fonts/font-adobe-{75,100}dpi on the X server's
1190 + machine would satisfy basic Emacs requirements under X11.
1191 + See also https://wiki.gentoo.org/wiki/Xft_support_for_GNU_Emacs
1192 + for how to enable anti-aliased fonts."
1193 + use aqua && DOC_CONTENTS+="\\n\\n${EMACS_SUFFIX^}.app is in
1194 + \"${EPREFIX}/Applications/Gentoo\". You may want to copy or
1195 + symlink it into /Applications by yourself."
1196 + fi
1197 + tc-is-cross-compiler && DOC_CONTENTS+="\\n\\nEmacs did not write
1198 + a portable dump file due to being cross-compiled.
1199 + To create this file at run time, execute the following command:
1200 + \\n${EMACS_SUFFIX} --batch -Q --eval='(dump-emacs-portable
1201 + \"/usr/libexec/emacs/${FULL_VERSION}/${CHOST}/emacs.pdmp\")'"
1202 + readme.gentoo_create_doc
1203 +}
1204 +
1205 +pkg_preinst() {
1206 + # move Info dir file to correct name
1207 + if [[ -d ${ED}/usr/share/info ]]; then
1208 + mv "${ED}"/usr/share/info/${EMACS_SUFFIX}/dir{.orig,} || die
1209 + fi
1210 +}
1211 +
1212 +pkg_postinst() {
1213 + elisp-site-regen
1214 + readme.gentoo_print_elog
1215 +
1216 + if use livecd; then
1217 + # force an update of the emacs symlink for the livecd/dvd,
1218 + # because some microemacs packages set it with USE=livecd
1219 + eselect emacs update
1220 + else
1221 + eselect emacs update ifunset
1222 + fi
1223 +}
1224 +
1225 +pkg_postrm() {
1226 + elisp-site-regen
1227 + eselect emacs update ifunset
1228 +}
1229
1230 diff --git a/app-editors/emacs/emacs-28.2-r2.ebuild b/app-editors/emacs/emacs-28.2-r2.ebuild
1231 new file mode 100644
1232 index 000000000000..9fa3ec4b3414
1233 --- /dev/null
1234 +++ b/app-editors/emacs/emacs-28.2-r2.ebuild
1235 @@ -0,0 +1,517 @@
1236 +# Copyright 1999-2022 Gentoo Authors
1237 +# Distributed under the terms of the GNU General Public License v2
1238 +
1239 +EAPI=8
1240 +
1241 +inherit autotools elisp-common readme.gentoo-r1 toolchain-funcs
1242 +
1243 +if [[ ${PV##*.} = 9999 ]]; then
1244 + inherit git-r3
1245 + EGIT_REPO_URI="https://git.savannah.gnu.org/git/emacs.git"
1246 + EGIT_BRANCH="emacs-28"
1247 + EGIT_CHECKOUT_DIR="${WORKDIR}/emacs"
1248 + S="${EGIT_CHECKOUT_DIR}"
1249 + SLOT="${PV%%.*}-vcs"
1250 +else
1251 + # FULL_VERSION keeps the full version number, which is needed in
1252 + # order to determine some path information correctly for copy/move
1253 + # operations later on
1254 + FULL_VERSION="${PV%%_*}"
1255 + SRC_URI="mirror://gnu/emacs/${P}.tar.xz"
1256 + S="${WORKDIR}/emacs-${FULL_VERSION}"
1257 + # PV can be in any of the following formats:
1258 + # 27.1 released version (slot 27)
1259 + # 27.1_rc1 upstream release candidate (27)
1260 + # 27.0.9999 live ebuild (slot 27-vcs)
1261 + # 27.0.90 upstream prerelease snapshot (27-vcs)
1262 + # 27.0.50_pre20191223 snapshot by Gentoo developer (27-vcs)
1263 + if [[ ${PV} == *_pre* ]]; then
1264 + SRC_URI="https://dev.gentoo.org/~ulm/distfiles/${P}.tar.xz"
1265 + S="${WORKDIR}/emacs"
1266 + elif [[ ${PV//[0-9]} != "." ]]; then
1267 + SRC_URI="https://alpha.gnu.org/gnu/emacs/pretest/${PN}-${PV/_/-}.tar.xz"
1268 + fi
1269 + # Patchset from proj/emacs-patches.git
1270 + SRC_URI+=" https://dev.gentoo.org/~ulm/emacs/${P}-patches-1.tar.xz"
1271 + PATCHES=("${WORKDIR}/patch")
1272 + SLOT="${PV%%.*}"
1273 + [[ ${PV} == *.*.* ]] && SLOT+="-vcs"
1274 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
1275 +fi
1276 +
1277 +DESCRIPTION="The extensible, customizable, self-documenting real-time display editor"
1278 +HOMEPAGE="https://www.gnu.org/software/emacs/"
1279 +
1280 +LICENSE="GPL-3+ FDL-1.3+ BSD HPND MIT W3C unicode PSF-2"
1281 +IUSE="acl alsa aqua athena cairo dbus dynamic-loading games gfile gif +gmp gpm gsettings gtk gui gzip-el harfbuzz imagemagick +inotify jit jpeg json kerberos lcms libxml2 livecd m17n-lib mailutils motif png selinux sound source ssl svg systemd +threads tiff toolkit-scroll-bars wide-int Xaw3d xft +xpm xwidgets zlib"
1282 +
1283 +RDEPEND="app-emacs/emacs-common[games?,gui(-)?]
1284 + sys-libs/ncurses:0=
1285 + acl? ( virtual/acl )
1286 + alsa? ( media-libs/alsa-lib )
1287 + dbus? ( sys-apps/dbus )
1288 + games? ( acct-group/gamestat )
1289 + gmp? ( dev-libs/gmp:0= )
1290 + gpm? ( sys-libs/gpm )
1291 + !inotify? ( gfile? ( >=dev-libs/glib-2.28.6 ) )
1292 + jit? (
1293 + sys-devel/gcc:=[jit(-)]
1294 + sys-libs/zlib
1295 + )
1296 + json? ( dev-libs/jansson:= )
1297 + kerberos? ( virtual/krb5 )
1298 + lcms? ( media-libs/lcms:2 )
1299 + libxml2? ( >=dev-libs/libxml2-2.2.0 )
1300 + mailutils? ( net-mail/mailutils[clients] )
1301 + !mailutils? ( acct-group/mail net-libs/liblockfile )
1302 + selinux? ( sys-libs/libselinux )
1303 + ssl? ( net-libs/gnutls:0= )
1304 + systemd? ( sys-apps/systemd )
1305 + zlib? ( sys-libs/zlib )
1306 + gui? ( !aqua? (
1307 + x11-libs/libICE
1308 + x11-libs/libSM
1309 + x11-libs/libX11
1310 + x11-libs/libXext
1311 + x11-libs/libXfixes
1312 + x11-libs/libXinerama
1313 + x11-libs/libXrandr
1314 + x11-libs/libxcb
1315 + x11-misc/xbitmaps
1316 + gsettings? ( >=dev-libs/glib-2.28.6 )
1317 + gif? ( media-libs/giflib:0= )
1318 + jpeg? ( media-libs/libjpeg-turbo:0= )
1319 + png? ( >=media-libs/libpng-1.4:0= )
1320 + svg? ( >=gnome-base/librsvg-2.0 )
1321 + tiff? ( media-libs/tiff:0 )
1322 + xpm? ( x11-libs/libXpm )
1323 + imagemagick? ( >=media-gfx/imagemagick-6.6.2:0= )
1324 + xft? (
1325 + media-libs/fontconfig
1326 + media-libs/freetype
1327 + x11-libs/libXft
1328 + x11-libs/libXrender
1329 + cairo? ( >=x11-libs/cairo-1.12.18[X] )
1330 + harfbuzz? ( media-libs/harfbuzz:0= )
1331 + m17n-lib? (
1332 + >=dev-libs/libotf-0.9.4
1333 + >=dev-libs/m17n-lib-1.5.1
1334 + )
1335 + )
1336 + gtk? (
1337 + x11-libs/gtk+:3
1338 + xwidgets? (
1339 + net-libs/webkit-gtk:4=
1340 + x11-libs/libXcomposite
1341 + )
1342 + )
1343 + !gtk? (
1344 + motif? (
1345 + >=x11-libs/motif-2.3:0
1346 + x11-libs/libXpm
1347 + x11-libs/libXmu
1348 + x11-libs/libXt
1349 + )
1350 + !motif? (
1351 + Xaw3d? (
1352 + x11-libs/libXaw3d
1353 + x11-libs/libXmu
1354 + x11-libs/libXt
1355 + )
1356 + !Xaw3d? ( athena? (
1357 + x11-libs/libXaw
1358 + x11-libs/libXmu
1359 + x11-libs/libXt
1360 + ) )
1361 + )
1362 + )
1363 + ) )"
1364 +
1365 +DEPEND="${RDEPEND}
1366 + gui? ( !aqua? ( x11-base/xorg-proto ) )"
1367 +
1368 +BDEPEND="sys-apps/texinfo
1369 + virtual/pkgconfig
1370 + gzip-el? ( app-arch/gzip )"
1371 +
1372 +IDEPEND="app-eselect/eselect-emacs"
1373 +
1374 +RDEPEND+=" ${IDEPEND}"
1375 +
1376 +EMACS_SUFFIX="emacs-${SLOT}"
1377 +SITEFILE="20${EMACS_SUFFIX}-gentoo.el"
1378 +
1379 +src_prepare() {
1380 + if [[ ${PV##*.} = 9999 ]]; then
1381 + FULL_VERSION=$(sed -n 's/^AC_INIT([^,]*,[^0-9.]*\([0-9.]*\).*/\1/p' \
1382 + configure.ac)
1383 + [[ ${FULL_VERSION} ]] || die "Cannot determine current Emacs version"
1384 + einfo "Emacs branch: ${EGIT_BRANCH}"
1385 + einfo "Commit: ${EGIT_VERSION}"
1386 + einfo "Emacs version number: ${FULL_VERSION}"
1387 + [[ ${FULL_VERSION} =~ ^${PV%.*}(\..*)?$ ]] \
1388 + || die "Upstream version number changed to ${FULL_VERSION}"
1389 + fi
1390 +
1391 + if use jit; then
1392 + export NATIVE_FULL_AOT=1
1393 + find lisp -type f -name "*.elc" -delete || die
1394 +
1395 + # These files ignore LDFLAGS. We assign the variable here, because
1396 + # for live ebuilds FULL_VERSION doesn't exist in global scope
1397 + QA_FLAGS_IGNORED="usr/$(get_libdir)/emacs/${FULL_VERSION}/native-lisp/.*"
1398 +
1399 + # gccjit doesn't play well with ccache or distcc #801580
1400 + # For now, work around the problem with an explicit LIBRARY_PATH
1401 + has ccache ${FEATURES} || has distcc ${FEATURES} && tc-is-gcc \
1402 + && export LIBRARY_PATH=$("$(tc-getCC)" -print-search-dirs \
1403 + | sed -n '/^libraries:/{s:^[^/]*::;p}')
1404 + fi
1405 +
1406 + default
1407 +
1408 + # Fix filename reference in redirected man page
1409 + sed -i -e "/^\\.so/s/etags/&-${EMACS_SUFFIX}/" doc/man/ctags.1 || die
1410 +
1411 + AT_M4DIR=m4 eautoreconf
1412 +}
1413 +
1414 +src_configure() {
1415 + local myconf
1416 +
1417 + # Prevents e.g. tests interfering with running Emacs.
1418 + unset EMACS_SOCKET_NAME
1419 +
1420 + if use alsa; then
1421 + use sound || ewarn \
1422 + "USE flag \"alsa\" overrides \"-sound\"; enabling sound support."
1423 + myconf+=" --with-sound=alsa"
1424 + else
1425 + myconf+=" --with-sound=$(usex sound oss)"
1426 + fi
1427 +
1428 + if use jit; then
1429 + use zlib || ewarn \
1430 + "USE flag \"jit\" overrides \"-zlib\"; enabling zlib support."
1431 + myconf+=" --with-zlib"
1432 + else
1433 + myconf+=" $(use_with zlib)"
1434 + fi
1435 +
1436 + if ! use gui; then
1437 + einfo "Configuring to build without window system support"
1438 + myconf+=" --without-x --without-ns"
1439 + elif use aqua; then
1440 + einfo "Configuring to build with Nextstep (Macintosh Cocoa) support"
1441 + myconf+=" --with-ns --disable-ns-self-contained"
1442 + myconf+=" --without-x"
1443 + else
1444 + myconf+=" --with-x --without-ns"
1445 + myconf+=" --without-gconf"
1446 + myconf+=" $(use_with gsettings)"
1447 + myconf+=" $(use_with toolkit-scroll-bars)"
1448 + myconf+=" $(use_with gif)"
1449 + myconf+=" $(use_with jpeg)"
1450 + myconf+=" $(use_with png)"
1451 + myconf+=" $(use_with svg rsvg)"
1452 + myconf+=" $(use_with tiff)"
1453 + myconf+=" $(use_with xpm)"
1454 + myconf+=" $(use_with imagemagick)"
1455 +
1456 + if use xft; then
1457 + myconf+=" --with-xft"
1458 + myconf+=" $(use_with cairo)"
1459 + myconf+=" $(use_with harfbuzz)"
1460 + myconf+=" $(use_with m17n-lib libotf)"
1461 + myconf+=" $(use_with m17n-lib m17n-flt)"
1462 + else
1463 + myconf+=" --without-xft"
1464 + myconf+=" --without-cairo"
1465 + myconf+=" --without-libotf --without-m17n-flt"
1466 + use cairo && ewarn \
1467 + "USE flag \"cairo\" has no effect if \"xft\" is not set."
1468 + use m17n-lib && ewarn \
1469 + "USE flag \"m17n-lib\" has no effect if \"xft\" is not set."
1470 + fi
1471 +
1472 + local f line
1473 + if use gtk; then
1474 + einfo "Configuring to build with GIMP Toolkit (GTK+)"
1475 + while read line; do ewarn "${line}"; done <<-EOF
1476 + Your version of GTK+ will have problems with closing open
1477 + displays. This is no problem if you just use one display, but
1478 + if you use more than one and close one of them Emacs may crash.
1479 + See <https://gitlab.gnome.org/GNOME/gtk/-/issues/221> and
1480 + <https://gitlab.gnome.org/GNOME/gtk/-/issues/2315>.
1481 + If you intend to use more than one display, then it is strongly
1482 + recommended that you compile Emacs with the Athena/Lucid or the
1483 + Motif toolkit instead.
1484 + EOF
1485 + myconf+=" --with-x-toolkit=gtk3 $(use_with xwidgets)"
1486 + for f in motif Xaw3d athena; do
1487 + use ${f} && ewarn \
1488 + "USE flag \"${f}\" has no effect if \"gtk\" is set."
1489 + done
1490 + elif use motif; then
1491 + einfo "Configuring to build with Motif toolkit"
1492 + myconf+=" --with-x-toolkit=motif"
1493 + for f in Xaw3d athena; do
1494 + use ${f} && ewarn \
1495 + "USE flag \"${f}\" has no effect if \"motif\" is set."
1496 + done
1497 + elif use athena || use Xaw3d; then
1498 + einfo "Configuring to build with Athena/Lucid toolkit"
1499 + myconf+=" --with-x-toolkit=lucid $(use_with Xaw3d xaw3d)"
1500 + else
1501 + einfo "Configuring to build with no toolkit"
1502 + myconf+=" --with-x-toolkit=no"
1503 + fi
1504 + ! use gtk && use xwidgets && ewarn \
1505 + "USE flag \"xwidgets\" has no effect if \"gtk\" is not set."
1506 + fi
1507 +
1508 + if tc-is-cross-compiler; then
1509 + # Configure a CBUILD directory when cross-compiling to make tools
1510 + mkdir "${S}-build" && pushd "${S}-build" >/dev/null || die
1511 + ECONF_SOURCE="${S}" econf_build --without-all --without-x-toolkit
1512 + popd >/dev/null || die
1513 + # Don't try to execute the binary for dumping during the build
1514 + myconf+=" --with-dumping=none"
1515 + elif use m68k; then
1516 + # Workaround for https://debbugs.gnu.org/44531
1517 + myconf+=" --with-dumping=unexec"
1518 + else
1519 + myconf+=" --with-dumping=pdumper"
1520 + fi
1521 +
1522 + econf \
1523 + --program-suffix="-${EMACS_SUFFIX}" \
1524 + --includedir="${EPREFIX}"/usr/include/${EMACS_SUFFIX} \
1525 + --infodir="${EPREFIX}"/usr/share/info/${EMACS_SUFFIX} \
1526 + --localstatedir="${EPREFIX}"/var \
1527 + --enable-locallisppath="${EPREFIX}/etc/emacs:${EPREFIX}${SITELISP}" \
1528 + --without-compress-install \
1529 + --without-hesiod \
1530 + --without-pop \
1531 + --with-file-notification=$(usev inotify || usev gfile || echo no) \
1532 + --with-pdumper \
1533 + $(use_enable acl) \
1534 + $(use_with dbus) \
1535 + $(use_with dynamic-loading modules) \
1536 + $(use_with games gameuser ":gamestat") \
1537 + $(use_with gmp libgmp) \
1538 + $(use_with gpm) \
1539 + $(use_with jit native-compilation) \
1540 + $(use_with json) \
1541 + $(use_with kerberos) $(use_with kerberos kerberos5) \
1542 + $(use_with lcms lcms2) \
1543 + $(use_with libxml2 xml2) \
1544 + $(use_with mailutils) \
1545 + $(use_with selinux) \
1546 + $(use_with ssl gnutls) \
1547 + $(use_with systemd libsystemd) \
1548 + $(use_with threads) \
1549 + $(use_with wide-int) \
1550 + ${myconf}
1551 +}
1552 +
1553 +src_compile() {
1554 + if tc-is-cross-compiler; then
1555 + # Build native tools for compiling lisp etc.
1556 + emake -C "${S}-build" src
1557 + emake lib # Cross-compile dependencies first for timestamps
1558 + # Save native build tools in the cross-directory
1559 + cp "${S}-build"/lib-src/make-{docfile,fingerprint} lib-src || die
1560 + # Specify the native Emacs to compile lisp
1561 + emake -C lisp all EMACS="${S}-build/src/emacs"
1562 + fi
1563 +
1564 + emake
1565 +}
1566 +
1567 +src_test() {
1568 + # List .el test files with a comment above listing the exact
1569 + # subtests which caused failure. Elements should begin with a %.
1570 + # e.g. %lisp/gnus/mml-sec-tests.el.
1571 + local exclude_tests=(
1572 + # Reason: not yet known
1573 + # mml-secure-en-decrypt-{1,2,3,4}
1574 + # mml-secure-find-usable-keys-{1,2}
1575 + # mml-secure-key-checks
1576 + # mml-secure-select-preferred-keys-4
1577 + # mml-secure-sign-verify-1
1578 + %lisp/gnus/mml-sec-tests.el
1579 +
1580 + # Reason: race condition
1581 + # Looks like it should be fixed in 29.x at least:
1582 + # https://debbugs.gnu.org/cgi/bugreport.cgi?bug=55706
1583 + # files-tests-file-name-non-special-file-in-directory-p
1584 + %lisp/files-tests.el
1585 +
1586 + # Reason: permission denied on /nonexistent
1587 + # (vc-*-bzr only fails if breezy is installed, as they
1588 + # try to access cache dirs under /nonexistent)
1589 + #
1590 + # rmail-undigest-test-multipart-mixed-digest
1591 + # rmail-undigest-test-rfc1153-less-strict-digest
1592 + # rmail-undigest-test-rfc1153-sloppy-digest
1593 + # rmail-undigest-test-rfc934-digest
1594 + # vc-test-bzr02-state
1595 + # vc-test-bzr05-rename-file
1596 + # vc-test-bzr06-version-diff
1597 + # vc-bzr-test-bug9781
1598 + %lisp/mail/undigest-tests.el
1599 + %lisp/vc/vc-tests.el
1600 + %lisp/vc/vc-bzr-tests.el
1601 +
1602 + # Reason: fails if bubblewrap (bwrap) is installed
1603 + # "bwrap: setting up uid map: Permission denied"
1604 + #
1605 + # bytecomp-tests--dest-mountpoint
1606 + %lisp/emacs-lisp/bytecomp-tests.el
1607 + )
1608 +
1609 + # See test/README for possible options
1610 + emake \
1611 + EMACS_TEST_VERBOSE=1 \
1612 + EXCLUDE_TESTS="${exclude_tests[*]}" \
1613 + TEST_BACKTRACE_LINE_LENGTH=nil \
1614 + check
1615 +}
1616 +
1617 +src_install() {
1618 + emake DESTDIR="${D}" NO_BIN_LINK=t BLESSMAIL_TARGET= install
1619 +
1620 + mv "${ED}"/usr/bin/{emacs-${FULL_VERSION}-,}${EMACS_SUFFIX} || die
1621 + mv "${ED}"/usr/share/man/man1/{emacs-,}${EMACS_SUFFIX}.1 || die
1622 + mv "${ED}"/usr/share/metainfo/{emacs-,}${EMACS_SUFFIX}.metainfo.xml || die
1623 +
1624 + # move info dir to avoid collisions with the dir file generated by portage
1625 + mv "${ED}"/usr/share/info/${EMACS_SUFFIX}/dir{,.orig} || die
1626 + touch "${ED}"/usr/share/info/${EMACS_SUFFIX}/.keepinfodir
1627 + docompress -x /usr/share/info/${EMACS_SUFFIX}/dir.orig
1628 +
1629 + # movemail must be setgid mail
1630 + if ! use mailutils; then
1631 + fowners root:mail /usr/libexec/emacs/${FULL_VERSION}/${CHOST}/movemail
1632 + fperms 2751 /usr/libexec/emacs/${FULL_VERSION}/${CHOST}/movemail
1633 + fi
1634 +
1635 + # avoid collision between slots, see bug #169033 e.g.
1636 + rm "${ED}"/usr/share/emacs/site-lisp/subdirs.el || die
1637 + rm -rf "${ED}"/usr/share/{applications,icons} || die
1638 + rm -rf "${ED}/usr/$(get_libdir)/systemd" || die
1639 + rm -rf "${ED}"/var || die
1640 +
1641 + # remove unused <version>/site-lisp dir
1642 + rm -rf "${ED}"/usr/share/emacs/${FULL_VERSION}/site-lisp || die
1643 +
1644 + # remove COPYING file (except for etc/COPYING used by describe-copying)
1645 + rm "${ED}"/usr/share/emacs/${FULL_VERSION}/lisp/COPYING || die
1646 +
1647 + if use systemd; then
1648 + insinto /usr/lib/systemd/user
1649 + sed -e "/^##/d" \
1650 + -e "/^ExecStart/s,emacs,${EPREFIX}/usr/bin/${EMACS_SUFFIX}," \
1651 + -e "/^ExecStop/s,emacsclient,${EPREFIX}/usr/bin/&-${EMACS_SUFFIX}," \
1652 + etc/emacs.service | newins - ${EMACS_SUFFIX}.service
1653 + assert
1654 + fi
1655 +
1656 + if use gzip-el; then
1657 + # compress .el files when a corresponding .elc exists
1658 + find "${ED}"/usr/share/emacs/${FULL_VERSION}/lisp -type f \
1659 + -name "*.elc" -print | sed 's/\.elc$/.el/' | xargs gzip -9n
1660 + assert "gzip .el failed"
1661 + fi
1662 +
1663 + local cdir
1664 + if use source; then
1665 + cdir="/usr/share/emacs/${FULL_VERSION}/src"
1666 + insinto "${cdir}"
1667 + # This is not meant to install all the source -- just the
1668 + # C source you might find via find-function
1669 + doins src/*.{c,h,m}
1670 + elif has installsources ${FEATURES}; then
1671 + cdir="/usr/src/debug/${CATEGORY}/${PF}/${S#"${WORKDIR}/"}/src"
1672 + fi
1673 +
1674 + sed -e "${cdir:+#}/^Y/d" -e "s/^[XY]//" >"${T}/${SITEFILE}" <<-EOF || die
1675 + X
1676 + ;;; ${EMACS_SUFFIX} site-lisp configuration
1677 + X
1678 + (when (string-match "\\\\\`${FULL_VERSION//./\\\\.}\\\\>" emacs-version)
1679 + Y (setq find-function-C-source-directory
1680 + Y "${EPREFIX}${cdir}")
1681 + X (let ((path (getenv "INFOPATH"))
1682 + X (dir "${EPREFIX}/usr/share/info/${EMACS_SUFFIX}")
1683 + X (re "\\\\\`${EPREFIX}/usr/share\\\\>"))
1684 + X (and path
1685 + X ;; move Emacs Info dir before anything else in /usr/share
1686 + X (let* ((p (cons nil (split-string path ":" t))) (q p))
1687 + X (while (and (cdr q) (not (string-match re (cadr q))))
1688 + X (setq q (cdr q)))
1689 + X (setcdr q (cons dir (delete dir (cdr q))))
1690 + X (setq Info-directory-list (prune-directory-list (cdr p)))))))
1691 + EOF
1692 + elisp-site-file-install "${T}/${SITEFILE}" || die
1693 +
1694 + dodoc README BUGS CONTRIBUTE
1695 +
1696 + if use gui && use aqua; then
1697 + dodir /Applications/Gentoo
1698 + rm -rf "${ED}"/Applications/Gentoo/${EMACS_SUFFIX^}.app || die
1699 + mv nextstep/Emacs.app \
1700 + "${ED}"/Applications/Gentoo/${EMACS_SUFFIX^}.app || die
1701 + fi
1702 +
1703 + local DOC_CONTENTS="You can set the version to be started by
1704 + /usr/bin/emacs through the Emacs eselect module, which also
1705 + redirects man and info pages. Therefore, several Emacs versions can
1706 + be installed at the same time. \"man emacs.eselect\" for details.
1707 + \\n\\nIf you upgrade from a previous major version of Emacs, then
1708 + it is strongly recommended that you use app-admin/emacs-updater
1709 + to rebuild all byte-compiled elisp files of the installed Emacs
1710 + packages."
1711 + if use gui; then
1712 + DOC_CONTENTS+="\\n\\nYou need to install some fonts for Emacs.
1713 + Installing media-fonts/font-adobe-{75,100}dpi on the X server's
1714 + machine would satisfy basic Emacs requirements under X11.
1715 + See also https://wiki.gentoo.org/wiki/Xft_support_for_GNU_Emacs
1716 + for how to enable anti-aliased fonts."
1717 + use aqua && DOC_CONTENTS+="\\n\\n${EMACS_SUFFIX^}.app is in
1718 + \"${EPREFIX}/Applications/Gentoo\". You may want to copy or
1719 + symlink it into /Applications by yourself."
1720 + fi
1721 + tc-is-cross-compiler && DOC_CONTENTS+="\\n\\nEmacs did not write
1722 + a portable dump file due to being cross-compiled.
1723 + To create this file at run time, execute the following command:
1724 + \\n${EMACS_SUFFIX} --batch -Q --eval='(dump-emacs-portable
1725 + \"/usr/libexec/emacs/${FULL_VERSION}/${CHOST}/emacs.pdmp\")'"
1726 + readme.gentoo_create_doc
1727 +}
1728 +
1729 +pkg_preinst() {
1730 + # move Info dir file to correct name
1731 + if [[ -d ${ED}/usr/share/info ]]; then
1732 + mv "${ED}"/usr/share/info/${EMACS_SUFFIX}/dir{.orig,} || die
1733 + fi
1734 +}
1735 +
1736 +pkg_postinst() {
1737 + elisp-site-regen
1738 + readme.gentoo_print_elog
1739 +
1740 + if use livecd; then
1741 + # force an update of the emacs symlink for the livecd/dvd,
1742 + # because some microemacs packages set it with USE=livecd
1743 + eselect emacs update
1744 + else
1745 + eselect emacs update ifunset
1746 + fi
1747 +}
1748 +
1749 +pkg_postrm() {
1750 + elisp-site-regen
1751 + eselect emacs update ifunset
1752 +}