1# $XTermId: xterm.spec,v 1.178 2024/12/04 21:54:33 tom Exp $
2Summary: X terminal emulator (development version)
3%global my_middle xterm
4%global my_suffix -dev
5%global fullname %{my_middle}%{my_suffix}
6%global my_class XTermDev
7Name: %{fullname}
8Version: 397
9Release: 1
10License: X11
11Group: User Interface/X
12Source: https://invisible-island.net/archives/xterm/xterm-%{version}.tgz
13URL: https://invisible-island.net/xterm/
14Provides: x-terminal-emulator >= %{version}
15
16# Using "find-xterm-fonts" gives these package names:
17#
18# fedora:
19#     xorg-x11-fonts-misc
20# mageia:
21#     x11-font-adobe-75dpi
22#     x11-font-misc-misc
23# opensuse:
24#     efont-unicode-bitmap-fonts
25#     xorg-x11-fonts-core
26#     xorg-x11-fonts-legacy
27
28# Library dependencies (chiefly Xft and Xpm) are similar across my test
29# machines for mageia/fedora/opensuse, but package names vary:
30#
31# fedora:
32#     libXft            libXft-devel
33#     libXpm            libXpm-devel
34#     libutempter       libutempter-devel
35#     ncurses-libs      ncurses-devel
36# mageia
37#     lib64xft2         lib64xft-devel
38#     lib64xpm4         lib64xpm-devel
39#     lib64utempter0    lib64utempter-devel
40#     lib64ncurses6     lib64ncurses-devel
41# opensuse
42#     libXft2           libXft-devel
43#     libXpm4           libXpm-devel
44#     libutempter0      utempter-devel
45#     libncurses6       ncurses-devel
46
47# This part (the build-requires) would be useful if the various distributions
48# had provided stable package-naming, or virtual packages to cover transitions. 
49# However, they have not done this in the past.
50%define use_x_manpage %(test "x$_use_x_manpage" = xyes && echo 1 || echo 0)
51%if "%{use_x_manpage}"
52
53%global is_mandriva %(test -f /etc/mandriva-release && echo %{use_x_manpage} || echo 0)
54%global is_redhat   %(test -f /etc/redhat-release && echo %{use_x_manpage} || echo 0)
55%global is_suse     %(test -f /etc/SuSE-release && echo %{use_x_manpage} || echo 0)
56
57%if %{is_mandriva}
58BuildRequires: x11-docs
59%else
60%if %{is_redhat}
61# missing in Fedora 37:
62## BuildRequires: xorg-x11-docs
63BuildRequires: ncurses-devel
64%else
65%if %{is_suse}
66BuildRequires: xorg-docs
67%endif
68%endif
69%endif
70
71%endif
72
73%description
74xterm is the standard terminal emulator for the X Window System.
75It provides DEC VT102 and Tektronix 4014 compatible terminals for
76programs that cannot use the window system directly.  This version
77implements ISO/ANSI colors, Unicode, and most of the control sequences
78used by DEC VT220 terminals.
79
80This package provides four commands:
81 a) %{fullname}, which is the actual terminal emulator
82 b) u%{fullname}, which is a wrapper around %{fullname}
83    which sets %{fullname} to use UTF-8 encoding when
84    the user's locale supports this,
85 c) koi8r%{fullname}, a wrapper similar to u%{fullname}
86    for locales that use the KOI8-R character set, and
87 d) resize%{my_suffix}.
88
89A complete list of control sequences supported by the X terminal emulator
90is provided in /usr/share/doc/%{fullname}.
91
92The %{fullname} program uses bitmap images provided by the xbitmaps package.
93
94Those interested in using koi8r%{fullname} will likely want to install the
95xfonts-cyrillic package as well.
96
97This package is configured to use "%{fullname}" and "%{my_class}"
98for the program and its resource class, to avoid conflict with other packages.
99
100%prep
101
102%global target_appdata %{fullname}.appdata.xml
103
104%define desktop_utils   %(if which desktop-file-install 2>&1 >/dev/null ; then echo 1 || echo 0 ; fi)
105%define icon_theme  %(test -d /usr/share/icons/hicolor && echo 1 || echo 0)
106%define apps_x11r6  %(test -d /usr/X11R6/lib/X11/app-defaults && echo 1 || echo 0)
107%define apps_shared %(test -d /usr/share/X11/app-defaults && echo 1 || echo 0)
108%define apps_syscnf %(test -d /etc/X11/app-defaults && echo 1 || echo 0)
109
110%if %{apps_x11r6}
111%define _xresdir    %{_prefix}/X11R6/lib/X11/app-defaults
112%else
113%if %{apps_shared}
114%define _xresdir    %{_datadir}/X11/app-defaults
115%else
116%define _xresdir    %{_sysconfdir}/X11/app-defaults
117%endif
118%endif
119
120%define _iconsdir   %{_datadir}/icons
121%define _pixmapsdir %{_datadir}/pixmaps
122%define my_docdir   %{_datadir}/doc/%{fullname}
123
124# no need for debugging symbols...
125%define debug_package %{nil}
126
127%setup -q -n xterm-%{version}
128
129%build
130CPPFLAGS="-DMISC_EXP -DEXP_HTTP_HEADERS" \
131%configure \
132        --target %{_target_platform} \
133        --prefix=%{_prefix} \
134        --bindir=%{_bindir} \
135        --datadir=%{_datadir} \
136        --mandir=%{_mandir} \
137%if "%{my_suffix}" != ""
138        --program-suffix=%{my_suffix} \
139        --without-xterm-symlink \
140%endif
141%if "%{icon_theme}"
142        --with-icon-symlink=%{fullname} \
143        --with-icon-theme \
144        --with-icondir=%{_iconsdir} \
145%endif
146        --with-app-class=%{my_class} \
147        --disable-imake \
148        --enable-dabbrev \
149        --enable-dec-locator \
150        --enable-exec-xterm \
151        --enable-hp-fkeys \
152        --enable-load-vt-fonts \
153        --enable-logfile-exec \
154        --enable-logging \
155        --enable-mini-luit \
156        --enable-regis-graphics \
157        --enable-sco-fkeys \
158        --enable-toolbar \
159        --enable-xmc-glitch \
160        --with-app-defaults=%{_xresdir} \
161        --with-pixmapdir=%{_pixmapsdir} \
162        --with-own-terminfo=%{_datadir}/terminfo \
163        --with-terminal-type=xterm-new \
164        --with-utempter \
165        --with-icon-name=mini.xterm \
166        --with-xpm
167make
168
169chmod u+w XTerm.ad
170cat >>XTerm.ad <<EOF
171*backarrowKeyIsErase: true
172*ptyInitialErase: true
173EOF
174ls -l *.ad
175
176%install
177rm -rf $RPM_BUILD_ROOT
178
179# Usually do not use install-ti, since that will conflict with ncurses.
180make install-bin install-man install-app install-icon \
181%if "%{install_ti}" == "yes"
182        install-ti \
183%endif
184        DESTDIR=$RPM_BUILD_ROOT \
185        TERMINFO=%{_datadir}/terminfo
186
187        mkdir -p $RPM_BUILD_ROOT%{my_docdir}
188        cp \
189                ctlseqs.txt \
190                README.i18n \
191                THANKS \
192                xterm.log.html \
193        $RPM_BUILD_ROOT%{my_docdir}/
194
195        cp -r vttests \
196        $RPM_BUILD_ROOT%{my_docdir}/
197
198        # The scripts are readable, but not executable, to let find-requires
199        # know that they do not depend on Perl packages.
200        chmod 644 $RPM_BUILD_ROOT%{my_docdir}/vttests/*.pl
201
202%if "%{desktop_utils}"
203make install-desktop \
204        DESKTOP_FLAGS="--dir $RPM_BUILD_ROOT%{_datadir}/applications"
205
206test -n "%{my_suffix}" && \
207( cd $RPM_BUILD_ROOT%{_datadir}/applications
208        for p in *.desktop
209        do
210                mv $p `basename $p .desktop`%{my_suffix}.desktop
211        done
212)
213
214mkdir -p $RPM_BUILD_ROOT%{_datadir}/appdata && \
215install -m 644 xterm.appdata.xml $RPM_BUILD_ROOT%{_datadir}/appdata/%{target_appdata} && \
216( cd $RPM_BUILD_ROOT%{_datadir}/appdata
217  sed -i \
218      -e 's/>xterm\.desktop</>%{fullname}.desktop</' \
219      -e 's/>XTerm</>%{my_class}</' \
220      %{target_appdata}
221)
222diff -u xterm.appdata.xml $RPM_BUILD_ROOT%{_datadir}/appdata/%{target_appdata} && \
223%endif
224
225%post
226%if "%{icon_theme}"
227touch --no-create %{_iconsdir}/hicolor
228if [ -x %{_bindir}/gtk-update-icon-cache ]; then
229  %{_bindir}/gtk-update-icon-cache %{_iconsdir}/hicolor || :
230fi
231%endif
232# find-requires does not care about at this point
233chmod +x %{my_docdir}/vttests/*.*
234
235%postun
236%if "%{icon_theme}"
237touch --no-create %{_iconsdir}/hicolor
238if [ -x %{_bindir}/gtk-update-icon-cache ]; then
239  %{_bindir}/gtk-update-icon-cache %{_iconsdir}/hicolor || :
240fi
241%endif
242
243%files
244%defattr(-,root,root,-)
245%{_bindir}/koi8r%{fullname}
246%{_bindir}/%{fullname}
247%{_bindir}/u%{fullname}
248%{_bindir}/resize%{my_suffix}
249%{_mandir}/*/*
250%{my_docdir}/*
251%{_xresdir}/*XTerm*
252
253%if "%{install_ti}" == "yes"
254%{_datadir}/terminfo/*
255%endif
256
257%if "%{desktop_utils}"
258%config(missingok) %{_datadir}/appdata/%{target_appdata}
259%config(missingok) %{_datadir}/applications/%{fullname}.desktop
260%config(missingok) %{_datadir}/applications/u%{fullname}.desktop
261%endif
262
263%if "%{icon_theme}"
264%{_iconsdir}/hicolor/*.png
265%{_iconsdir}/hicolor/*.svg
266%{_iconsdir}/hicolor/48x48/apps/*.png
267%{_iconsdir}/hicolor/scalable/apps/*.svg
268%endif
269%{_pixmapsdir}/*.xpm
270
271%changelog
272
273* Fri Nov 25 2022 Thomas E. Dickey
274- Fedora 37 has no xorg-x11-docs
275
276* Thu Feb 24 2022 Thomas E. Dickey
277- double-buffer is not enabled by default
278
279* Sat Jul 25 2020 Thomas E. Dickey
280- sixels are enabled by default
281
282* Sun Mar 08 2020 Thomas E. Dickey
283- remove "--vendor" option from desktop-file-install
284
285* Sun Nov 17 2019 Thomas E. Dickey
286- install appdata.xml file
287
288* Wed May 02 2018 Thomas E. Dickey
289- install all icons
290
291* Fri Jan 29 2016 Thomas E. Dickey
292- use --enable-screen-dumps
293
294* Mon May 27 2013 Thomas E. Dickey
295- use --with-icon-symlink
296
297* Mon Oct 08 2012 Thomas E. Dickey
298- added to pixmapsdir
299
300* Fri Jun 15 2012 Thomas E. Dickey
301- modify to support icon theme
302
303* Fri Oct 22 2010 Thomas E. Dickey
304- initial version.
305