summaryrefslogtreecommitdiff
path: root/emacs.spec
blob: 22ecd83613244ffa3b6d6d355de58f4fd5203bb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
%global _hardened_build 1
%bcond_with bootstrap

%if "0%{?product_family}" != "0"
%bcond_without bootstrap
%endif

Name:          emacs
Epoch:         1
Version:       29.4
Release:       1
Summary:       An extensible GNU text editor
License:       GPL-3.0-or-later AND CC0-1.0
URL:           https://www.gnu.org/software/emacs
Source0:       https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz
Source1:       site-start.el
Source2:       default.el
Source3:       dotemacs.el
Source4:       emacs-terminal.sh
Source5:       emacs.service
Source6:       emacs.desktop
Source7:       emacs-terminal.desktop

#patch from fedora
#https://src.fedoraproject.org/rpms/emacs/blob/rawhide/f/emacs-spellchecker.patch
Patch1001:        emacs-spellchecker.patch
#https://src.fedoraproject.org/rpms/emacs/blob/rawhide/f/emacs-system-crypto-policies.patch
Patch1002:        emacs-system-crypto-policies.patch

Patch9000:        emacs-deal-taboo-words.patch

BuildRequires: make gcc
BuildRequires: autoconf automake libtool
BuildRequires: pkgconfig(MagickWand) >= 7
BuildRequires: pkgconfig(alsa) >= 1.0.0
BuildRequires: pkgconfig(cairo) >= 1.8.0
BuildRequires: pkgconfig(cairo-xcb) >= 1.8.0
BuildRequires: pkgconfig(dbus-1) >= 1.0
BuildRequires: pkgconfig(fontconfig) >= 2.2.0
BuildRequires: pkgconfig(freetype2)
BuildRequires: pkgconfig(freetype2) >= 2.5.0
BuildRequires: pkgconfig(gio-2.0) >= 2.24
BuildRequires: pkgconfig(gio-2.0) >= 2.26
BuildRequires: pkgconfig(glib-2.0) >= 2.37.5
BuildRequires: pkgconfig(gnutls) >= 2.12.2
BuildRequires: pkgconfig(gobject-2.0) >= 2.0
BuildRequires: pkgconfig(gtk+-3.0) >= 3.10
BuildRequires: pkgconfig(harfbuzz) >= 0.9.42
BuildRequires: pkgconfig(jansson) >= 2.7
BuildRequires: pkgconfig(lcms2)
BuildRequires: pkgconfig(libotf)
BuildRequires: pkgconfig(libpng) >= 1.0.0
BuildRequires: pkgconfig(librsvg-2.0) >= 2.14.0
BuildRequires: pkgconfig(libseccomp) >= 2.5.2
BuildRequires: pkgconfig(libsystemd) >= 222
BuildRequires: pkgconfig(libwebpdemux) >= 0.6.0
BuildRequires: pkgconfig(libxml-2.0) > 2.6.17
BuildRequires: pkgconfig(m17n-flt)
BuildRequires: pkgconfig(webkit2gtk-4.1) >= 2.12
BuildRequires: pkgconfig(xfixes) >= 4.0.0
BuildRequires: pkgconfig(xft) >= 0.13.0
BuildRequires: pkgconfig(xi)
BuildRequires: pkgconfig(xinerama) >= 1.0.2
BuildRequires: pkgconfig(xrandr) >= 1.2.2
BuildRequires: giflib-devel
BuildRequires: gpm-devel
BuildRequires: libacl-devel
BuildRequires: libjpeg-devel
BuildRequires: liblockfile-devel
BuildRequires: libtiff-devel
BuildRequires: ncurses-devel
BuildRequires: sqlite-devel
BuildRequires: zlib-devel
BuildRequires: Xaw3d-devel
BuildRequires: /usr/bin/makeinfo

%ifarch %{ix86}
BuildRequires: util-linux
%endif

Requires:      desktop-file-utils dejavu-sans-mono-fonts
Requires:      emacs-common = %{epoch}:%{version}-%{release}
Requires(preun):     %{_sbindir}/alternatives
Requires(posttrans): %{_sbindir}/alternatives

Provides:      emacs(bin) = %{epoch}:%{version}-%{release}

%define site_lisp %{_datadir}/emacs/site-lisp
%define site_start_d %{site_lisp}/site-start.d
%define bytecompargs -batch --no-init-file --no-site-file -f batch-byte-compile
%define pkgconfig %{_datadir}/pkgconfig
%define emacs_libexecdir %{_libexecdir}/emacs/%{version}/%{_host}

%description
Emacs is the extensible, customizable, self-documenting real-time display editor.
At its core is an interpreter for Emacs Lisp, a dialect of the Lisp programming language
with extensions to support text editing. And it is an entire ecosystem of functionality beyond text editing,
including a project planner, mail and news reader, debugger interface, calendar, and more.

%package       devel
Summary:       Development header files for emacs

%description   devel
Development header files for emacs.

%if !%{with bootstrap}
%package       lucid
Summary:       GNU Emacs text editor with LUCID toolkit X support
Requires:      emacs-common = %{epoch}:%{version}-%{release}
Requires(preun):     %{_sbindir}/alternatives
Requires(posttrans): %{_sbindir}/alternatives
Provides:      emacs(bin) = %{epoch}:%{version}-%{release}

%description   lucid
This package provides an emacs binary with support for X windows
using LUCID toolkit.
%endif

%package       nox
Summary:       GNU Emacs text editor without X support
Requires:      emacs-common = %{epoch}:%{version}-%{release}
Requires(preun):     %{_sbindir}/alternatives
Requires(posttrans): %{_sbindir}/alternatives
Provides:      emacs(bin) = %{epoch}:%{version}-%{release}

%description   nox
This package provides an emacs binary with no X windows support for running
on a terminal

%package       common
Summary:       Emacs common files
License:       GPLv3+ and GFDL and BSD
Requires:      %{name}-filesystem = %{epoch}:%{version}-%{release}
Requires(preun):     /sbin/install-info
Requires(preun):     %{_sbindir}/alternatives
Requires(posttrans): %{_sbindir}/alternatives
Requires(post):      /sbin/install-info
Provides:      %{name}-el = %{epoch}:%{version}-%{release}
Obsoletes:     emacs-el < 1:24.3-29

%description   common
This package contains all the common files needed by emacs, emacs-lucid
or emacs-nox.

%package       terminal
Summary:       A desktop menu for GNU Emacs terminal.
Requires:      emacs = %{epoch}:%{version}-%{release}
BuildArch:     noarch

%description   terminal
Install emacs-terminal if you need a terminal with Malayalam support.

%package       filesystem
Summary:       Emacs filesystem layout
BuildArch:     noarch

%description   filesystem
Emacs filesystem layout

%package_help

%prep
%autosetup -n %{name}-%{version} -p1

autoconf

egrep -v "tetris.elc|pong.elc" lisp/Makefile.in > lisp/Makefile.in.new && mv lisp/Makefile.in.new lisp/Makefile.in

rm -f lisp/play/tetris.el* lisp/play/pong.el*

%define info_files ada-mode auth autotype bovine calc ccmode cl dbus dired-x ebrowse ede ediff edt efaq-w32 efaq eieio eintr elisp emacs-gnutls emacs-mime emacs epa erc ert eshell eudc eww flymake forms gnus htmlfontify idlwave ido info mairix-el message mh-e newsticker nxml-mode octave-mode org pcl-cvs pgg rcirc reftex remember sasl sc semantic ses sieve smtpmail speedbar srecode todo-mode tramp url vhdl-mode vip viper widget wisent woman

cd info
fs=( $(ls *.info) )
is=( %info_files  )
files=$(echo ${fs[*]} | sed 's/\.info//'g | sort | tr -d '\n')
for i in $(seq 0 $(( ${#fs[*]} - 1 ))); do
  if test "${fs[$i]}" != "${is[$i]}.info"; then
    echo Please update %%info_files: ${fs[$i]} != ${is[$i]}.info >&2
    break
  fi
done
cd ..

%ifarch %{ix86}
%define setarch setarch %{_arch} -R
%else
%define setarch %{nil}
%endif

ln -s ../../%{name}/%{version}/etc/COPYING doc
ln -s ../../%{name}/%{version}/etc/NEWS doc

%build
%ifarch loongarch64
%_update_config_guess
%_update_config_sub
%endif
export CFLAGS="-DMAIL_USE_LOCKF $RPM_OPT_FLAGS -fPIE"

# Build GTK+ binary
mkdir build-gtk && pushd build-gtk
%global _configure ../configure
%configure --with-dbus --with-gif --with-jpeg --with-png --with-rsvg --without-gconf \
           --with-tiff --with-xft --with-xpm --with-x-toolkit=gtk3 --with-gpm=no \
           --with-harfbuzz --with-cairo --with-json \
           --with-xwidgets --with-modules --without-libotf --without-m17n-flt
%make_build bootstrap
%{setarch} %make_build
popd

# Build Lucid binary
%if !%{with bootstrap}
mkdir build-lucid && pushd build-lucid
%configure --with-dbus --with-gif --with-jpeg --with-png --with-rsvg --without-gconf \
           --with-tiff --with-xft --with-xpm --with-x-toolkit=lucid --with-gpm=no \
           --with-harfbuzz --with-cairo --with-json \
           --with-modules --without-libotf --without-m17n-flt
%make_build bootstrap
%{setarch} %make_build
popd
%endif

# Build binary without X support
mkdir build-nox && pushd build-nox
%configure --with-x=no --with-modules --with-json --without-gconf
%{setarch} %make_build
popd

# Generate pkgconfig file
cat > emacs.pc << EOF
sitepkglispdir=%{_datadir}/emacs/site-lisp
sitestartdir=%{site_lisp}/site-start.d

Name: emacs
Description: GNU Emacs text editor
Version: %{epoch}:%{version}
EOF

# Generate macros.emacs RPM macro file
cat > macros.emacs << EOF
%%_emacs_version %{version}
%%_emacs_ev %{?epoch:%{epoch}:}%{version}
%%_emacs_evr %{?epoch:%{epoch}:}%{version}-%{release}
%%_emacs_sitelispdir %{_datadir}/emacs/site-lisp
%%_emacs_sitestartdir %{site_lisp}/site-start.d
%%_emacs_bytecompile /usr/bin/emacs -batch --no-init-file --no-site-file --eval '(progn (setq load-path (cons "." load-path)))' -f batch-byte-compile
EOF

%install
%make_install -C build-gtk

rm %{buildroot}%{_bindir}/emacs
touch %{buildroot}%{_bindir}/emacs

rm %{buildroot}%{emacs_libexecdir}/emacs-*.pdmp

gunzip %{buildroot}%{_datadir}/emacs/%{version}/lisp/jka*.el.gz


%if !%{with bootstrap}
install -p -m 0755 build-lucid/src/emacs %{buildroot}%{_bindir}/emacs-%{version}-lucid
%endif

install -p -m 0755 build-nox/src/emacs %{buildroot}%{_bindir}/emacs-%{version}-nox

chmod 755 %{buildroot}%{emacs_libexecdir}/movemail

# Confirm movemail don't setgid
mkdir -p %{buildroot}%{site_lisp}
install -p -m 0644 %SOURCE1 %{buildroot}%{_datadir}/emacs/site-lisp/site-start.el
install -p -m 0644 %SOURCE2 %{buildroot}%{_datadir}/emacs/site-lisp

echo "(setq source-directory \"%{_datadir}/emacs/%{version}/\")" >> %{buildroot}%{_datadir}/emacs/site-lisp/site-start.el

pushd %{buildroot}%{_bindir}
mv etags etags.emacs
mv ctags gctags
popd

pushd %{buildroot}%{_mandir}/man1
mv ctags.1.gz gctags.1.gz
mv etags.1.gz etags.emacs.1.gz
popd

mv %{buildroot}%{_infodir}/info.info.gz %{buildroot}%{_infodir}/info.gz

install -d %{buildroot}%{_datadir}/emacs/site-lisp/site-start.d

install -d %{buildroot}/%{_datadir}/pkgconfig
install -p -m 0644 emacs.pc %{buildroot}/%{_datadir}/pkgconfig

install -d %{buildroot}%{_rpmconfigdir}/macros.d
install -p -m 0644 macros.emacs %{buildroot}%{_rpmconfigdir}/macros.d/

install -p -m 755 %SOURCE4 %{buildroot}/%{_bindir}/emacs-terminal

rm -f %{buildroot}%{_infodir}/dir

install -d %{buildroot}%{_userunitdir}
install -p -m 0644 %SOURCE5 %{buildroot}%{_userunitdir}/emacs.service

# Emacs 26.1 don't installs the upstream unit file to /usr/lib64 on 64bit archs.
rm -f %{buildroot}/usr/lib64/systemd/user/emacs.service

mkdir -p %{buildroot}%{_datadir}/applications
desktop-file-install --dir=%{buildroot}%{_datadir}/applications \
                     %SOURCE6
desktop-file-install --dir=%{buildroot}%{_datadir}/applications \
                     %SOURCE7

# We don't ship the client variants yet
rm %{buildroot}%{_datadir}/applications/emacsclient.desktop
rm %{buildroot}%{_datadir}/applications/emacsclient-mail.desktop

rm -f *-filelist {common,el}-*-files

( TOPDIR=${PWD}
  cd %{buildroot}

  find .%{_datadir}/emacs/%{version}/lisp .%{_datadir}/emacs/%{version}/lisp/leim \
  .%{_datadir}/emacs/site-lisp \( -type f -name '*.elc' -fprint $TOPDIR/common-lisp-none-elc-files \) -o \( -type d -fprintf $TOPDIR/common-lisp-dir-files "%%%%dir %%p\n" \) -o \( -name '*.el.gz' -fprint $TOPDIR/el-bytecomped-files -o -fprint $TOPDIR/common-not-comped-files \)
)
sed -i -e "s|\.%{_prefix}|%{_prefix}|" *-files
cat common-*-files > common-filelist
cat el-*-files common-lisp-dir-files > el-filelist

%preun
%{_sbindir}/alternatives --remove emacs %{_bindir}/emacs-%{version}

%posttrans
%{_sbindir}/alternatives --install %{_bindir}/emacs emacs %{_bindir}/emacs-%{version} 80

%if !%{with bootstrap}
%preun lucid
%{_sbindir}/alternatives --remove emacs %{_bindir}/emacs-%{version}-lucid
%{_sbindir}/alternatives --remove emacs-lucid %{_bindir}/emacs-%{version}-lucid

%posttrans lucid
%{_sbindir}/alternatives --install %{_bindir}/emacs emacs %{_bindir}/emacs-%{version}-lucid 70
%{_sbindir}/alternatives --install %{_bindir}/emacs-lucid emacs-lucid %{_bindir}/emacs-%{version}-lucid 60
%endif

%preun nox
%{_sbindir}/alternatives --remove emacs %{_bindir}/emacs-%{version}-nox
%{_sbindir}/alternatives --remove emacs-nox %{_bindir}/emacs-%{version}-nox

%posttrans nox
%{_sbindir}/alternatives --install %{_bindir}/emacs emacs %{_bindir}/emacs-%{version}-nox 70
%{_sbindir}/alternatives --install %{_bindir}/emacs-nox emacs-nox %{_bindir}/emacs-%{version}-nox 60

%preun common
%{_sbindir}/alternatives --remove emacs.etags %{_bindir}/etags.emacs

%posttrans common
%{_sbindir}/alternatives --install %{_bindir}/etags emacs.etags %{_bindir}/etags.emacs 80 \
       --slave %{_mandir}/man1/etags.1.gz emacs.etags.man %{_mandir}/man1/etags.emacs.1.gz


%files
%doc doc/NEWS BUGS README
%license etc/COPYING
%attr(0755,-,-) %ghost %{_bindir}/emacs
%{_bindir}/emacs-%{version}
%{_datadir}/icons/hicolor/*
%{_datadir}/applications/emacs.desktop
%{_datadir}/applications/emacs-mail.desktop
%{_metainfodir}/%{name}.metainfo.xml

%files devel
%{_includedir}/emacs-module.h

%if !%{with bootstrap}
%files lucid
%attr(0755,-,-) %ghost %{_bindir}/emacs
%attr(0755,-,-) %ghost %{_bindir}/emacs-lucid
%{_bindir}/emacs-%{version}-lucid
%endif

%files nox
%attr(0755,-,-) %ghost %{_bindir}/emacs
%attr(0755,-,-) %ghost %{_bindir}/emacs-nox
%{_bindir}/emacs-%{version}-nox

%files common -f common-filelist -f el-filelist
%doc doc/NEWS BUGS README
%license etc/COPYING
%{_rpmconfigdir}/macros.d/macros.emacs
%attr(0644,root,root) %config(noreplace) %{_datadir}/emacs/site-lisp/default.el
%attr(0644,root,root) %config %{_datadir}/emacs/site-lisp/site-start.el
%{_bindir}/gctags
%{_bindir}/ebrowse
%{_bindir}/emacsclient
%{_bindir}/etags.emacs
%{_libexecdir}/emacs
%{pkgconfig}/emacs.pc
%{_userunitdir}/emacs.service
%dir %{_datadir}/emacs/%{version}
%{_datadir}/emacs/%{version}/etc
%{_datadir}/emacs/%{version}/site-lisp
%{_infodir}/*

%files terminal
%{_bindir}/emacs-terminal
%{_datadir}/applications/emacs-terminal.desktop

%files filesystem
%dir %{_datadir}/emacs
%dir %{_datadir}/emacs/site-lisp
%dir %{_datadir}/emacs/site-lisp/site-start.d

%files help
%doc doc/NEWS BUGS README
%{_mandir}/*/*

%changelog
* Mon Dec 02 2024 Funda Wang <fundawang@yeah.net> - 1:29.4-1
- update to 29.4

* Tue Jul 02 2024 zhangpan <zhangpan103@h-partners.com> - 1:29.1-3
- fix CVE-2024-39331

* Mon Apr 01 2024 lingsheng <lingsheng1@h-partners.com> - 1:29.1-2
- fix CVE-2024-30202 CVE-2024-30203 CVE-2024-30204 CVE-2024-30205

* Tue Jan 23 2024 zhangpan <zhangpan103@h-partners.com> - 1:29.1-1
- update to 29.1

* Mon Sep 25 2023 leeffo <liweiganga@uniontech.com> - 1:28.2-5
- fix CVE-2022-48337

* Fri Mar 24 2023 zhangpan <zhangpan103@h-partners.com> - 1:28.2-4
- fix CVE-2023-28617

* Wed Mar 15 2023 yanglongkang <yanglongkang@h-partners.com> - 1:28.2-3
- fix CVE-2023-27985 CVE-2023-27986

* Wed Feb 22 2023 zhangpan <zhangpan103@h-partners.com> - 1:28.2-2
- fix CVE-2022-48337 CVE-2022-48338 CVE-2022-48339

* Thu Feb 02 2023 zhouwenpei <zhouwenpei1@h-partners.com> - 1:28.2-1
- update to 28.2

* Thu Dec 01 2022 wangkerong <wangkerong@h-partners.com> - 1:27.2-8
- fix CVE-2022-45939

* Fri Nov 18 2022 Wenlong Zhang<zhangwenlong@loongson.cn> - 1:27.2-7
- add loongarch support for emacs

* Fri Aug 26 2022 zhujunhao <zhujunhao11@huawei.com> - 1:27.2-6
- close bootstrap with product_family

* Sat Jun 11 2022 wangkeorng <wangkeorng@huawei.com> - 1:27.2-5
- delete macro in changelog

* Mon Jan 17 2022 liuyumeng <liuyumeng5@huawei.com> - 1:27.2-4
- round self-developed patch

* Tue Aug 10 2021 yangcheng <yangcheng87@huawei.com> - 1:27.2-3
- DESC: Fix the upgrade error caused by the info file in the emacs-help software package being repackaged

* Tue Aug 10 2021 yanan <yanan@huawei.com> - 1:27.2-2
- DESC: Fix FTBFS with glibc 2.34

* Mon Jul 19 2021 wangkerong <wangkerong@huawei.com> - 1:27.2-1
- DESC: upgrade to 1:27.2

* Wed Dec 09 2020 chenyanpan <chenyanpan@huawei.com> - 1:27.1-5
- Type: improvement
- DESC: use make_build instead of make for building bootstrap

* Wed Dec 16 2020 jinzhimin <jinzhimin2@huawei.com> - 1:27.1-4
- remove unnecessary patch

* Wed Dec 16 2020 jinzhimin <jinzhimin2@huawei.com> - 1:27.1-3
- fix emacs run failed

* Wed Sep 23 2020 hanhui <hanhui15@huawei.com> - 1:27.1-2
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:slove the problem of mercurial compile failed

* Wed Aug 19 2020 xiaoweiwei <xiaoweiwei5@huawei.com> - 1:27.1-1
- upgrade to 27.1

* Mon May 18 2020 zhangrui <zhangrui182@huawei.com> - 1:26.1-13
- rebuild for giflib

* Fri Mar 13 2020 songnannan <songnannan2@huawei.com> - 1:26.1-12
- add secure compile option

* Sat Jan 11 2020 openEuler Buildteam <buildteam@openeuler.org> - 1:26.1-11
- remove unnecessary source

* Sat Dec 28 2019 openEuler Buildteam <buildteam@openeuler.org> - 1:26.1-10
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:optimization the spec

* Tue Oct 29 2019 openEuler Buildteam <buildteam@openeuler.org> - 1:26.1-9
- Type:bugfix
- Id:NA
- SUG:NA
- DESC:change the pakcage list and requires

* Tue Oct 29 2019 yanglijin <yanglijin@huawei.com> - 1:26.1-8
- emacs can not use

* Fri Sep 20 2019 chenzhenyu <chenzhenyu13@huawei.com> - 1:26.1-7
- Package init