15104ee6eSmrg# $XTermId: xterm.spec,v 1.178 2024/12/04 21:54:33 tom Exp $
20bd37d32SmrgSummary: X terminal emulator (development version)
30bd37d32Smrg%global my_middle xterm
40bd37d32Smrg%global my_suffix -dev
50bd37d32Smrg%global fullname %{my_middle}%{my_suffix}
60bd37d32Smrg%global my_class XTermDev
70bd37d32SmrgName: %{fullname}
85104ee6eSmrgVersion: 397
9e39b573cSmrgRelease: 1
10492d43a5SmrgLicense: X11
110bd37d32SmrgGroup: User Interface/X
125307cd1aSmrgSource: https://invisible-island.net/archives/xterm/xterm-%{version}.tgz
134419d26bSmrgURL: https://invisible-island.net/xterm/
14f2e35a3aSmrgProvides: x-terminal-emulator >= %{version}
15492d43a5Smrg
165104ee6eSmrg# Using "find-xterm-fonts" gives these package names:
175104ee6eSmrg#
185104ee6eSmrg# fedora:
195104ee6eSmrg#     xorg-x11-fonts-misc
205104ee6eSmrg# mageia:
215104ee6eSmrg#     x11-font-adobe-75dpi
225104ee6eSmrg#     x11-font-misc-misc
235104ee6eSmrg# opensuse:
245104ee6eSmrg#     efont-unicode-bitmap-fonts
255104ee6eSmrg#     xorg-x11-fonts-core
265104ee6eSmrg#     xorg-x11-fonts-legacy
275104ee6eSmrg
285104ee6eSmrg# Library dependencies (chiefly Xft and Xpm) are similar across my test
295104ee6eSmrg# machines for mageia/fedora/opensuse, but package names vary:
305104ee6eSmrg#
315104ee6eSmrg# fedora:
325104ee6eSmrg#     libXft            libXft-devel
335104ee6eSmrg#     libXpm            libXpm-devel
345104ee6eSmrg#     libutempter       libutempter-devel
355104ee6eSmrg#     ncurses-libs      ncurses-devel
365104ee6eSmrg# mageia
375104ee6eSmrg#     lib64xft2         lib64xft-devel
385104ee6eSmrg#     lib64xpm4         lib64xpm-devel
395104ee6eSmrg#     lib64utempter0    lib64utempter-devel
405104ee6eSmrg#     lib64ncurses6     lib64ncurses-devel
415104ee6eSmrg# opensuse
425104ee6eSmrg#     libXft2           libXft-devel
435104ee6eSmrg#     libXpm4           libXpm-devel
445104ee6eSmrg#     libutempter0      utempter-devel
455104ee6eSmrg#     libncurses6       ncurses-devel
465104ee6eSmrg
47e0a2b6dfSmrg# This part (the build-requires) would be useful if the various distributions
48e0a2b6dfSmrg# had provided stable package-naming, or virtual packages to cover transitions. 
49e0a2b6dfSmrg# However, they have not done this in the past.
50e0a2b6dfSmrg%define use_x_manpage %(test "x$_use_x_manpage" = xyes && echo 1 || echo 0)
51e0a2b6dfSmrg%if "%{use_x_manpage}"
52e0a2b6dfSmrg
53e0a2b6dfSmrg%global is_mandriva %(test -f /etc/mandriva-release && echo %{use_x_manpage} || echo 0)
54e0a2b6dfSmrg%global is_redhat   %(test -f /etc/redhat-release && echo %{use_x_manpage} || echo 0)
55e0a2b6dfSmrg%global is_suse     %(test -f /etc/SuSE-release && echo %{use_x_manpage} || echo 0)
56e0a2b6dfSmrg
57e0a2b6dfSmrg%if %{is_mandriva}
58e0a2b6dfSmrgBuildRequires: x11-docs
59e0a2b6dfSmrg%else
60e0a2b6dfSmrg%if %{is_redhat}
615307cd1aSmrg# missing in Fedora 37:
625307cd1aSmrg## BuildRequires: xorg-x11-docs
635307cd1aSmrgBuildRequires: ncurses-devel
64e0a2b6dfSmrg%else
65e0a2b6dfSmrg%if %{is_suse}
66e0a2b6dfSmrgBuildRequires: xorg-docs
67e0a2b6dfSmrg%endif
68e0a2b6dfSmrg%endif
69e0a2b6dfSmrg%endif
70e0a2b6dfSmrg
71e0a2b6dfSmrg%endif
72e0a2b6dfSmrg
73492d43a5Smrg%description
74492d43a5Smrgxterm is the standard terminal emulator for the X Window System.
75492d43a5SmrgIt provides DEC VT102 and Tektronix 4014 compatible terminals for
76492d43a5Smrgprograms that cannot use the window system directly.  This version
77492d43a5Smrgimplements ISO/ANSI colors, Unicode, and most of the control sequences
78492d43a5Smrgused by DEC VT220 terminals.
79492d43a5Smrg
80492d43a5SmrgThis package provides four commands:
810bd37d32Smrg a) %{fullname}, which is the actual terminal emulator
820bd37d32Smrg b) u%{fullname}, which is a wrapper around %{fullname}
830bd37d32Smrg    which sets %{fullname} to use UTF-8 encoding when
840bd37d32Smrg    the user's locale supports this,
850bd37d32Smrg c) koi8r%{fullname}, a wrapper similar to u%{fullname}
860bd37d32Smrg    for locales that use the KOI8-R character set, and
870bd37d32Smrg d) resize%{my_suffix}.
88492d43a5Smrg
89492d43a5SmrgA complete list of control sequences supported by the X terminal emulator
900bd37d32Smrgis provided in /usr/share/doc/%{fullname}.
91492d43a5Smrg
920bd37d32SmrgThe %{fullname} program uses bitmap images provided by the xbitmaps package.
93492d43a5Smrg
940bd37d32SmrgThose interested in using koi8r%{fullname} will likely want to install the
95492d43a5Smrgxfonts-cyrillic package as well.
96492d43a5Smrg
970bd37d32SmrgThis package is configured to use "%{fullname}" and "%{my_class}"
980bd37d32Smrgfor the program and its resource class, to avoid conflict with other packages.
99e39b573cSmrg
100492d43a5Smrg%prep
101492d43a5Smrg
102f2e35a3aSmrg%global target_appdata %{fullname}.appdata.xml
103492d43a5Smrg
1040bd37d32Smrg%define desktop_utils   %(if which desktop-file-install 2>&1 >/dev/null ; then echo 1 || echo 0 ; fi)
1050bd37d32Smrg%define icon_theme  %(test -d /usr/share/icons/hicolor && echo 1 || echo 0)
106e0a2b6dfSmrg%define apps_x11r6  %(test -d /usr/X11R6/lib/X11/app-defaults && echo 1 || echo 0)
107492d43a5Smrg%define apps_shared %(test -d /usr/share/X11/app-defaults && echo 1 || echo 0)
108492d43a5Smrg%define apps_syscnf %(test -d /etc/X11/app-defaults && echo 1 || echo 0)
109492d43a5Smrg
110e0a2b6dfSmrg%if %{apps_x11r6}
111e0a2b6dfSmrg%define _xresdir    %{_prefix}/X11R6/lib/X11/app-defaults
112e0a2b6dfSmrg%else
113492d43a5Smrg%if %{apps_shared}
114492d43a5Smrg%define _xresdir    %{_datadir}/X11/app-defaults
115492d43a5Smrg%else
116492d43a5Smrg%define _xresdir    %{_sysconfdir}/X11/app-defaults
117492d43a5Smrg%endif
118e0a2b6dfSmrg%endif
119492d43a5Smrg
120492d43a5Smrg%define _iconsdir   %{_datadir}/icons
121492d43a5Smrg%define _pixmapsdir %{_datadir}/pixmaps
1220bd37d32Smrg%define my_docdir   %{_datadir}/doc/%{fullname}
1230bd37d32Smrg
1240bd37d32Smrg# no need for debugging symbols...
1250bd37d32Smrg%define debug_package %{nil}
126492d43a5Smrg
127e39b573cSmrg%setup -q -n xterm-%{version}
128492d43a5Smrg
129492d43a5Smrg%build
130492d43a5SmrgCPPFLAGS="-DMISC_EXP -DEXP_HTTP_HEADERS" \
131492d43a5Smrg%configure \
132f2e35a3aSmrg        --target %{_target_platform} \
133f2e35a3aSmrg        --prefix=%{_prefix} \
134f2e35a3aSmrg        --bindir=%{_bindir} \
135f2e35a3aSmrg        --datadir=%{_datadir} \
136f2e35a3aSmrg        --mandir=%{_mandir} \
137492d43a5Smrg%if "%{my_suffix}" != ""
138f2e35a3aSmrg        --program-suffix=%{my_suffix} \
139f2e35a3aSmrg        --without-xterm-symlink \
1400bd37d32Smrg%endif
1410bd37d32Smrg%if "%{icon_theme}"
142f2e35a3aSmrg        --with-icon-symlink=%{fullname} \
143f2e35a3aSmrg        --with-icon-theme \
144f2e35a3aSmrg        --with-icondir=%{_iconsdir} \
145492d43a5Smrg%endif
146f2e35a3aSmrg        --with-app-class=%{my_class} \
147f2e35a3aSmrg        --disable-imake \
148f2e35a3aSmrg        --enable-dabbrev \
149f2e35a3aSmrg        --enable-dec-locator \
150f2e35a3aSmrg        --enable-exec-xterm \
151f2e35a3aSmrg        --enable-hp-fkeys \
152f2e35a3aSmrg        --enable-load-vt-fonts \
153f2e35a3aSmrg        --enable-logfile-exec \
154f2e35a3aSmrg        --enable-logging \
155f2e35a3aSmrg        --enable-mini-luit \
156f2e35a3aSmrg        --enable-regis-graphics \
157f2e35a3aSmrg        --enable-sco-fkeys \
158f2e35a3aSmrg        --enable-toolbar \
159f2e35a3aSmrg        --enable-xmc-glitch \
160f2e35a3aSmrg        --with-app-defaults=%{_xresdir} \
161f2e35a3aSmrg        --with-pixmapdir=%{_pixmapsdir} \
162f2e35a3aSmrg        --with-own-terminfo=%{_datadir}/terminfo \
163f2e35a3aSmrg        --with-terminal-type=xterm-new \
164f2e35a3aSmrg        --with-utempter \
165f2e35a3aSmrg        --with-icon-name=mini.xterm \
166f2e35a3aSmrg        --with-xpm
167492d43a5Smrgmake
168492d43a5Smrg
169492d43a5Smrgchmod u+w XTerm.ad
170492d43a5Smrgcat >>XTerm.ad <<EOF
171492d43a5Smrg*backarrowKeyIsErase: true
172492d43a5Smrg*ptyInitialErase: true
173492d43a5SmrgEOF
174492d43a5Smrgls -l *.ad
175492d43a5Smrg
176492d43a5Smrg%install
177492d43a5Smrgrm -rf $RPM_BUILD_ROOT
178492d43a5Smrg
179492d43a5Smrg# Usually do not use install-ti, since that will conflict with ncurses.
180492d43a5Smrgmake install-bin install-man install-app install-icon \
181492d43a5Smrg%if "%{install_ti}" == "yes"
182f2e35a3aSmrg        install-ti \
183492d43a5Smrg%endif
184f2e35a3aSmrg        DESTDIR=$RPM_BUILD_ROOT \
185f2e35a3aSmrg        TERMINFO=%{_datadir}/terminfo
186492d43a5Smrg
187f2e35a3aSmrg        mkdir -p $RPM_BUILD_ROOT%{my_docdir}
188f2e35a3aSmrg        cp \
189f2e35a3aSmrg                ctlseqs.txt \
190f2e35a3aSmrg                README.i18n \
191f2e35a3aSmrg                THANKS \
192f2e35a3aSmrg                xterm.log.html \
193f2e35a3aSmrg        $RPM_BUILD_ROOT%{my_docdir}/
194492d43a5Smrg
195f2e35a3aSmrg        cp -r vttests \
196f2e35a3aSmrg        $RPM_BUILD_ROOT%{my_docdir}/
197492d43a5Smrg
198f2e35a3aSmrg        # The scripts are readable, but not executable, to let find-requires
199f2e35a3aSmrg        # know that they do not depend on Perl packages.
200f2e35a3aSmrg        chmod 644 $RPM_BUILD_ROOT%{my_docdir}/vttests/*.pl
201492d43a5Smrg
2020bd37d32Smrg%if "%{desktop_utils}"
203492d43a5Smrgmake install-desktop \
204f2e35a3aSmrg        DESKTOP_FLAGS="--dir $RPM_BUILD_ROOT%{_datadir}/applications"
205492d43a5Smrg
206492d43a5Smrgtest -n "%{my_suffix}" && \
207492d43a5Smrg( cd $RPM_BUILD_ROOT%{_datadir}/applications
208f2e35a3aSmrg        for p in *.desktop
209f2e35a3aSmrg        do
210f2e35a3aSmrg                mv $p `basename $p .desktop`%{my_suffix}.desktop
211f2e35a3aSmrg        done
212492d43a5Smrg)
213f2e35a3aSmrg
214f2e35a3aSmrgmkdir -p $RPM_BUILD_ROOT%{_datadir}/appdata && \
215f2e35a3aSmrginstall -m 644 xterm.appdata.xml $RPM_BUILD_ROOT%{_datadir}/appdata/%{target_appdata} && \
216f2e35a3aSmrg( cd $RPM_BUILD_ROOT%{_datadir}/appdata
217f2e35a3aSmrg  sed -i \
218f2e35a3aSmrg      -e 's/>xterm\.desktop</>%{fullname}.desktop</' \
219f2e35a3aSmrg      -e 's/>XTerm</>%{my_class}</' \
220f2e35a3aSmrg      %{target_appdata}
221f2e35a3aSmrg)
222f2e35a3aSmrgdiff -u xterm.appdata.xml $RPM_BUILD_ROOT%{_datadir}/appdata/%{target_appdata} && \
223492d43a5Smrg%endif
224492d43a5Smrg
2250bd37d32Smrg%post
2260bd37d32Smrg%if "%{icon_theme}"
2270bd37d32Smrgtouch --no-create %{_iconsdir}/hicolor
2280bd37d32Smrgif [ -x %{_bindir}/gtk-update-icon-cache ]; then
2290bd37d32Smrg  %{_bindir}/gtk-update-icon-cache %{_iconsdir}/hicolor || :
2300bd37d32Smrgfi
2310bd37d32Smrg%endif
232e0a2b6dfSmrg# find-requires does not care about at this point
233e0a2b6dfSmrgchmod +x %{my_docdir}/vttests/*.*
2340bd37d32Smrg
2350bd37d32Smrg%postun
2360bd37d32Smrg%if "%{icon_theme}"
2370bd37d32Smrgtouch --no-create %{_iconsdir}/hicolor
2380bd37d32Smrgif [ -x %{_bindir}/gtk-update-icon-cache ]; then
2390bd37d32Smrg  %{_bindir}/gtk-update-icon-cache %{_iconsdir}/hicolor || :
2400bd37d32Smrgfi
2410bd37d32Smrg%endif
2420bd37d32Smrg
243492d43a5Smrg%files
244492d43a5Smrg%defattr(-,root,root,-)
2450bd37d32Smrg%{_bindir}/koi8r%{fullname}
2460bd37d32Smrg%{_bindir}/%{fullname}
2470bd37d32Smrg%{_bindir}/u%{fullname}
248492d43a5Smrg%{_bindir}/resize%{my_suffix}
249492d43a5Smrg%{_mandir}/*/*
250492d43a5Smrg%{my_docdir}/*
251492d43a5Smrg%{_xresdir}/*XTerm*
252492d43a5Smrg
253492d43a5Smrg%if "%{install_ti}" == "yes"
254492d43a5Smrg%{_datadir}/terminfo/*
255492d43a5Smrg%endif
256492d43a5Smrg
2570bd37d32Smrg%if "%{desktop_utils}"
258f2e35a3aSmrg%config(missingok) %{_datadir}/appdata/%{target_appdata}
259f2e35a3aSmrg%config(missingok) %{_datadir}/applications/%{fullname}.desktop
260f2e35a3aSmrg%config(missingok) %{_datadir}/applications/u%{fullname}.desktop
261492d43a5Smrg%endif
262492d43a5Smrg
2630bd37d32Smrg%if "%{icon_theme}"
264f2e35a3aSmrg%{_iconsdir}/hicolor/*.png
265f2e35a3aSmrg%{_iconsdir}/hicolor/*.svg
266f2e35a3aSmrg%{_iconsdir}/hicolor/48x48/apps/*.png
267f2e35a3aSmrg%{_iconsdir}/hicolor/scalable/apps/*.svg
2680bd37d32Smrg%endif
269f2e35a3aSmrg%{_pixmapsdir}/*.xpm
2700bd37d32Smrg
271492d43a5Smrg%changelog
272492d43a5Smrg
2735307cd1aSmrg* Fri Nov 25 2022 Thomas E. Dickey
2745307cd1aSmrg- Fedora 37 has no xorg-x11-docs
2755307cd1aSmrg
2764419d26bSmrg* Thu Feb 24 2022 Thomas E. Dickey
2774419d26bSmrg- double-buffer is not enabled by default
2784419d26bSmrg
279f2e35a3aSmrg* Sat Jul 25 2020 Thomas E. Dickey
280f2e35a3aSmrg- sixels are enabled by default
281f2e35a3aSmrg
282f2e35a3aSmrg* Sun Mar 08 2020 Thomas E. Dickey
283f2e35a3aSmrg- remove "--vendor" option from desktop-file-install
284f2e35a3aSmrg
285f2e35a3aSmrg* Sun Nov 17 2019 Thomas E. Dickey
286f2e35a3aSmrg- install appdata.xml file
287f2e35a3aSmrg
288f2e35a3aSmrg* Wed May 02 2018 Thomas E. Dickey
289f2e35a3aSmrg- install all icons
290f2e35a3aSmrg
2912e4f8982Smrg* Fri Jan 29 2016 Thomas E. Dickey
2922e4f8982Smrg- use --enable-screen-dumps
2932e4f8982Smrg
2940bd37d32Smrg* Mon May 27 2013 Thomas E. Dickey
2950bd37d32Smrg- use --with-icon-symlink
2960bd37d32Smrg
2970bd37d32Smrg* Mon Oct 08 2012 Thomas E. Dickey
2980bd37d32Smrg- added to pixmapsdir
2990bd37d32Smrg
3000bd37d32Smrg* Fri Jun 15 2012 Thomas E. Dickey
3010bd37d32Smrg- modify to support icon theme
3020bd37d32Smrg
303492d43a5Smrg* Fri Oct 22 2010 Thomas E. Dickey
304492d43a5Smrg- initial version.
305