summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElan Ruusamäe2015-02-22 19:40:30 (GMT)
committerElan Ruusamäe2015-02-22 19:40:30 (GMT)
commit0b76b37717d93873f6f9d11cee2b97c1537ea1ab (patch)
treeaafd4781a2bc64df80d4981efa83091c50d3a98b
parent93c2628deecca91e6e345ca491b8847a7e304af6 (diff)
downloadQtLockedFile-0b76b37717d93873f6f9d11cee2b97c1537ea1ab.zip
QtLockedFile-0b76b37717d93873f6f9d11cee2b97c1537ea1ab.tar.gz
prepare qt5 build
-rw-r--r--QtLockedFile.spec75
1 files changed, 63 insertions, 12 deletions
diff --git a/QtLockedFile.spec b/QtLockedFile.spec
index c0d8a39..a532d83 100644
--- a/QtLockedFile.spec
+++ b/QtLockedFile.spec
@@ -1,3 +1,7 @@
+#
+# Conditional build:
+%bcond_without qt4 # build Qt4
+%bcond_with qt5 # build Qt5
# last commit to qtlockedfile subdir in
# https://qt.gitorious.org/qt-solutions/qt-solutions/
@@ -17,12 +21,17 @@ Source1: qtlockedfile.prf
Patch0: qtlockedfile-dont-build-example.patch
Patch1: qtlockedfile-use-current-version.patch
URL: http://doc.qt.digia.com/solutions/4/qtlockedfile/qtlockedfile.html
+%if %{with qt4}
BuildRequires: QtCore-devel
BuildRequires: libstdc++-devel
BuildRequires: qt4-qmake
+%endif
+%if %{with qt5}
+%endif
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%define _qt4_datadir %{_datadir}/qt4
+%define _qt5_datadir %{_datadir}/qt5
%description
This class extends the QFile class with inter-process file locking
@@ -47,31 +56,53 @@ applications that use QtLockedFile.
%patch0 -p1
%patch1 -p0
+set -- *
+install -d build-qt{4,5}
+cp -al "$@" build-qt4
+cp -al "$@" build-qt5
+
%build
-touch .licenseAccepted
+%if %{with qt4}
+cd build-qt4
# Does not use GNU configure
./configure -library
qmake-qt4
%{__make}
+cd ..
+%endif
+
+%if %{with qt5}
+cd build-qt5
+./configure -library
+qmake-qt5
+%{__make}
+cd ..
+%endif
%install
rm -rf $RPM_BUILD_ROOT
-# libraries
-install -d $RPM_BUILD_ROOT%{_libdir}
+%if %{with qt4}
+cd build-qt4
+install -d $RPM_BUILD_ROOT{%{_libdir},%{_qt4_datadir}/mkspecs/features}
cp -a lib/* $RPM_BUILD_ROOT%{_libdir}
-
rm $RPM_BUILD_ROOT%{_libdir}/lib*-%{version}.so.1.0
-
-# headers
install -d $RPM_BUILD_ROOT%{_includedir}/QtSolutions
-cp -p \
- src/qtlockedfile.h \
- src/QtLockedFile \
- $RPM_BUILD_ROOT%{_includedir}/QtSolutions
-
-install -d $RPM_BUILD_ROOT%{_qt4_datadir}/mkspecs/features
+cp -p src/qtlockedfile.h src/QtLockedFile $RPM_BUILD_ROOT%{_includedir}/QtSolutions
cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_qt4_datadir}/mkspecs/features
+cd ..
+%endif
+
+%if %{with qt5}
+cd build-qt5
+install -d $RPM_BUILD_ROOT{%{_libdir},%{_qt5_datadir}/mkspecs/features}
+cp -a lib/* $RPM_BUILD_ROOT%{_libdir}
+rm $RPM_BUILD_ROOT%{_libdir}/lib*-%{version}.so.1.0
+install -d $RPM_BUILD_ROOT%{_includedir}/QtSolutions
+cp -p src/qtlockedfile.h src/QtLockedFile $RPM_BUILD_ROOT%{_includedir}/QtSolutions
+cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_qt5_datadir}/mkspecs/features
+cd ..
+%endif
%clean
rm -rf $RPM_BUILD_ROOT
@@ -79,6 +110,7 @@ rm -rf $RPM_BUILD_ROOT
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
+%if %{with qt4}
%files
%defattr(644,root,root,755)
%doc README.TXT
@@ -95,3 +127,22 @@ rm -rf $RPM_BUILD_ROOT
%{_includedir}/QtSolutions/QtLockedFile
%{_includedir}/QtSolutions/qtlockedfile.h
%{_qt4_datadir}/mkspecs/features/qtlockedfile.prf
+%endif
+
+%if %{with qt5}
+%files
+%defattr(644,root,root,755)
+%doc README.TXT
+%attr(755,root,root) %{_libdir}/libQtSolutions_LockedFile-%{version}.so.*.*.*
+%attr(755,root,root) %ghost %{_libdir}/libQtSolutions_LockedFile-%{version}.so.1
+
+%files devel
+%defattr(644,root,root,755)
+%doc doc example
+%{_libdir}/libQtSolutions_LockedFile-%{version}.so
+# XXX shared dir with QtSingleApplication
+%dir %{_includedir}/QtSolutions
+%{_includedir}/QtSolutions/QtLockedFile
+%{_includedir}/QtSolutions/qtlockedfile.h
+%{_qt5_datadir}/mkspecs/features/qtlockedfile.prf
+%endif