Fix conditionals for building with wxGTK support

This separates conditional for building with wxGTK support from Qt
support.  Qt support is not really optional, as the main package
contains gnuplot-qt.  Making build without Qt support would require more
invasive .spec changes.  This also means that attempts to build without
both wxGTK and Qt always failed.

This also ensures that wxGTK support is only enabled in Fedora.
This commit is contained in:
Tomas Hoger 2018-01-24 14:25:28 +01:00
parent 4a5539c98a
commit 28d14f83b8

View File

@ -4,10 +4,16 @@
%global x11_app_defaults_dir %{_datadir}/X11/app-defaults %global x11_app_defaults_dir %{_datadir}/X11/app-defaults
%if 0%{?fedora}
%bcond_without wx
%else
%bcond_with wx
%endif
Summary: A program for plotting mathematical expressions and data Summary: A program for plotting mathematical expressions and data
Name: gnuplot Name: gnuplot
Version: %{major}.%{minor}.%{patchlevel} Version: %{major}.%{minor}.%{patchlevel}
Release: 6%{?dist} Release: 7%{?dist}
# MIT .. term/PostScript/aglfn.txt # MIT .. term/PostScript/aglfn.txt
License: gnuplot and MIT License: gnuplot and MIT
Group: Applications/Engineering Group: Applications/Engineering
@ -39,11 +45,11 @@ BuildRequires: pango-devel, tex(latex), tex(subfigure.sty)
BuildRequires: tex(cm-super-t1.enc), tex(pdftex.map), tex-tex4ht, texinfo BuildRequires: tex(cm-super-t1.enc), tex(pdftex.map), tex-tex4ht, texinfo
BuildRequires: /usr/bin/texi2dvi BuildRequires: /usr/bin/texi2dvi
BuildRequires: zlib-devel, libjpeg-turbo-devel, tex(ecrm1000.tfm), latex2html BuildRequires: zlib-devel, libjpeg-turbo-devel, tex(ecrm1000.tfm), latex2html
%if 0%{?fedora} || 0%{?rhel} > 7
#qt-terminal requires libqt >= 4.5 #qt-terminal requires libqt >= 4.5
BuildRequires: qt5-qtbase-devel BuildRequires: qt5-qtbase-devel
BuildRequires: qt5-qtsvg-devel BuildRequires: qt5-qtsvg-devel
BuildRequires: qt5-linguist BuildRequires: qt5-linguist
%if %{with wx}
BuildRequires: wxGTK-devel BuildRequires: wxGTK-devel
%endif %endif
@ -58,6 +64,8 @@ dimensions and in many different formats.
Install gnuplot if you need a graphics package for scientific data Install gnuplot if you need a graphics package for scientific data
representation. representation.
This package provides a Qt based terminal version of gnuplot.
%package common %package common
Group: Applications/Engineering Group: Applications/Engineering
Summary: The common gnuplot parts Summary: The common gnuplot parts
@ -73,7 +81,7 @@ program especially suited for scientific data representation. Gnuplot
can be used to plot functions and data points in both two and three can be used to plot functions and data points in both two and three
dimensions and in many different formats. dimensions and in many different formats.
This subpackage contains common parts needed for arbitrary version of gnuplot This subpackage contains common parts needed for all versions of gnuplot.
%package minimal %package minimal
Group: Applications/Engineering Group: Applications/Engineering
@ -91,9 +99,10 @@ dimensions and in many different formats.
Install gnuplot-minimal if you need a minimal version of graphics package Install gnuplot-minimal if you need a minimal version of graphics package
for scientific data representation. for scientific data representation.
%if %{with wx}
%package wx %package wx
Group: Applications/Engineering Group: Applications/Engineering
Summary: Qt interface for gnuplot Summary: wxGTK interface for gnuplot
Requires: %{name}-common = %{version}-%{release} Requires: %{name}-common = %{version}-%{release}
Requires(post): %{_sbindir}/alternatives Requires(post): %{_sbindir}/alternatives
Requires(preun): %{_sbindir}/alternatives Requires(preun): %{_sbindir}/alternatives
@ -106,7 +115,8 @@ program especially suited for scientific data representation. Gnuplot
can be used to plot functions and data points in both two and three can be used to plot functions and data points in both two and three
dimensions and in many different formats. dimensions and in many different formats.
This package provides a wxGTK based terminal version of gnuplot This package provides a wxGTK based terminal version of gnuplot.
%endif
#%package -n emacs-%{name} #%package -n emacs-%{name}
#Group: Applications/Engineering #Group: Applications/Engineering
@ -173,6 +183,7 @@ rm -rf demo/plugin/*.so demo/plugin/*.o
%global configure_opts --with-readline=builtin --without-linux-vga \\\ %global configure_opts --with-readline=builtin --without-linux-vga \\\
--enable-history-file --enable-history-file
# at first create minimal version of gnuplot for server SIG purposes # at first create minimal version of gnuplot for server SIG purposes
mkdir minimal mkdir minimal
cd minimal cd minimal
@ -182,21 +193,23 @@ make %{?_smp_mflags}
cd - cd -
# create full version of gnuplot # create full version of gnuplot
%if 0%{?fedora} || 0%{?rhel} > 7 %if %{with wx}
# Fedora only - wx # With wxGTK support (Fedora only)
mkdir wx mkdir wx
cd wx cd wx
ln -s ../configure . ln -s ../configure .
%configure %{configure_opts} --without-qt %configure %{configure_opts} --without-qt
make %{?_smp_mflags} make %{?_smp_mflags}
cd - cd -
%endif
# With Qt support
mkdir qt mkdir qt
cd qt cd qt
ln -s ../configure . ln -s ../configure .
%configure %{configure_opts} --disable-wxwidgets --enable-qt %configure %{configure_opts} --disable-wxwidgets --enable-qt
make %{?_smp_mflags} make %{?_smp_mflags}
cd - cd -
%endif
# Docs don't build properly out of tree # Docs don't build properly out of tree
@ -209,18 +222,20 @@ rm -rf docs/htmldocs/images.idx
make -C tutorial make -C tutorial
%install %install
%if 0%{?fedora} || 0%{?rhel} > 7 %if %{with wx}
# install wx # install wx
make -C wx install DESTDIR=$RPM_BUILD_ROOT INSTALL='install -p' make -C wx install DESTDIR=$RPM_BUILD_ROOT INSTALL='install -p'
# rename binary # rename binary
mv $RPM_BUILD_ROOT%{_bindir}/gnuplot $RPM_BUILD_ROOT%{_bindir}/gnuplot-wx mv $RPM_BUILD_ROOT%{_bindir}/gnuplot $RPM_BUILD_ROOT%{_bindir}/gnuplot-wx
%endif
# install qt # install qt
make -C qt install DESTDIR=$RPM_BUILD_ROOT INSTALL='install -p' make -C qt install DESTDIR=$RPM_BUILD_ROOT INSTALL='install -p'
# rename binary # rename binary
mv $RPM_BUILD_ROOT%{_bindir}/gnuplot $RPM_BUILD_ROOT%{_bindir}/gnuplot-qt mv $RPM_BUILD_ROOT%{_bindir}/gnuplot $RPM_BUILD_ROOT%{_bindir}/gnuplot-qt
# install minimal binary # install minimal binary
install -p -m 755 minimal/src/gnuplot $RPM_BUILD_ROOT%{_bindir}/gnuplot-minimal install -p -m 755 minimal/src/gnuplot $RPM_BUILD_ROOT%{_bindir}/gnuplot-minimal
%endif
# install info # install info
make -C docs install-info DESTDIR=$RPM_BUILD_ROOT INSTALL='install -p' make -C docs install-info DESTDIR=$RPM_BUILD_ROOT INSTALL='install -p'
@ -257,8 +272,10 @@ fi
%posttrans minimal %posttrans minimal
%{_sbindir}/alternatives --install %{_bindir}/gnuplot gnuplot %{_bindir}/gnuplot-minimal 40 %{_sbindir}/alternatives --install %{_bindir}/gnuplot gnuplot %{_bindir}/gnuplot-minimal 40
%if %{with wx}
%posttrans wx %posttrans wx
%{_sbindir}/alternatives --install %{_bindir}/gnuplot gnuplot %{_bindir}/gnuplot-wx 50 %{_sbindir}/alternatives --install %{_bindir}/gnuplot gnuplot %{_bindir}/gnuplot-wx 50
%endif
%preun %preun
if [ $1 = 0 ]; then if [ $1 = 0 ]; then
@ -277,10 +294,12 @@ if [ $1 = 0 ]; then
%{_sbindir}/alternatives --remove gnuplot %{_bindir}/gnuplot-minimal || : %{_sbindir}/alternatives --remove gnuplot %{_bindir}/gnuplot-minimal || :
fi fi
%if %{with wx}
%preun wx %preun wx
if [ $1 = 0 ]; then if [ $1 = 0 ]; then
%{_sbindir}/alternatives --remove gnuplot %{_bindir}/gnuplot-wx || : %{_sbindir}/alternatives --remove gnuplot %{_bindir}/gnuplot-wx || :
fi fi
%endif
%post latex %post latex
[ -e %{_bindir}/texhash ] && %{_bindir}/texhash 2> /dev/null; [ -e %{_bindir}/texhash ] && %{_bindir}/texhash 2> /dev/null;
@ -324,10 +343,12 @@ fi
%doc ChangeLog Copyright %doc ChangeLog Copyright
%{_bindir}/gnuplot-minimal %{_bindir}/gnuplot-minimal
%if %{with wx}
%files wx %files wx
%ghost %attr(0755,-,-) %{_bindir}/gnuplot %ghost %attr(0755,-,-) %{_bindir}/gnuplot
%doc ChangeLog Copyright %doc ChangeLog Copyright
%{_bindir}/gnuplot-wx %{_bindir}/gnuplot-wx
%endif
#%files -n emacs-%{name} #%files -n emacs-%{name}
#%doc ChangeLog Copyright #%doc ChangeLog Copyright
@ -346,6 +367,9 @@ fi
%{_datadir}/texmf/tex/latex/gnuplot/ %{_datadir}/texmf/tex/latex/gnuplot/
%changelog %changelog
* Wed Jan 24 2018 Tomas Hoger <thoger@redhat.com> - 5.0.6-7
- Fix conditionals for building with(out) wxGTK support
* Tue Sep 19 2017 Troy Dawson <tdawson@redhat.com> - 5.0.6-6 * Tue Sep 19 2017 Troy Dawson <tdawson@redhat.com> - 5.0.6-6
- Cleanup spec file conditionals - Cleanup spec file conditionals