forked from pool/python-pyqt-rpm-macros
Benjamin Greiner
e40fff8e07
- update to version 0.1 - Add PyQt6 support - Add link to wiki in macros file - Remove python-rpm-macros interpreter workaround. The inconsistency never made it into a released package. OBS-URL: https://build.opensuse.org/request/show/874295 OBS-URL: https://build.opensuse.org/package/show/KDE:Qt5/python-pyqt-rpm-macros?expand=0&rev=10
78 lines
2.6 KiB
Plaintext
78 lines
2.6 KiB
Plaintext
# Documentation: https://en.opensuse.org/openSUSE:Packaging_PyQt_and_SIP
|
|
|
|
%sip4_only() %{?use_sip4:%{**}}
|
|
|
|
%sip5_only() %{?!use_sip4:%{**}}
|
|
|
|
%pyqt5_sipdir %{?use_sip4:%_datadir/sip/PyQt5-%python_bin_suffix}%{?!use_sip4:%python_sitearch/PyQt5/bindings}
|
|
|
|
%pyqt6_sipdir %{python_sitearch}/PyQt6/bindings
|
|
|
|
%_pyqt_datadir %{?pyqt_build_for_qt6:%{_qt6_datadir}}%{!?pyqt_build_for_qt6:%{_libqt5_datadir}}
|
|
|
|
%_pyqt_qmake %{?pyqt_build_for_qt6:%{__qt6_qmake}}%{!?pyqt_build_for_qt6:%{_libqt5_qmake}}
|
|
|
|
%pyqt_build(c:m:s:v) \
|
|
export CXXFLAGS="%{optflags}" \
|
|
export CFLAGS="%{optflags}" \
|
|
%{python_expand # \
|
|
%if 0%{?use_sip4} \
|
|
mkdir build \
|
|
pushd build \
|
|
[ -d ../config-tests ] && ln -s ../config-tests . \
|
|
[ -d ../sip ] && ln -s ../sip . \
|
|
$python ../configure.py \\\
|
|
%{-v:--verbose}%{!-v:-w} \\\
|
|
--sip=%{_bindir}/sip-%{$python_bin_suffix} \\\
|
|
--qmake=%{_bindir}/qmake-qt5 \\\
|
|
%{-c*} \\\
|
|
QMAKE_CFLAGS+="${CFLAGS} ${CPPFLAGS}" \\\
|
|
QMAKE_CXXFLAGS+="${CXXFLAGS} ${CPPFLAGS}" \
|
|
popd \
|
|
%else \
|
|
sip-build-%{$python_bin_suffix} \\\
|
|
--verbose \\\
|
|
--api-dir %{_pyqt_datadir}/qsci/api/python_%{$python_bin_suffix}/ \\\
|
|
--no-make \\\
|
|
--qmake=%{_pyqt_qmake} \\\
|
|
--qmake-setting "QMAKE_CFLAGS += ${CFLAGS} ${CPPFLAGS}" \\\
|
|
--qmake-setting "QMAKE_CXXFLAGS += ${CXXFLAGS} ${CPPFLAGS}" \\\
|
|
%{-s*} \
|
|
%endif \
|
|
pushd build \
|
|
make %{?_smp_mflags} %{-m*} \
|
|
popd \
|
|
} \
|
|
%{nil}
|
|
|
|
%pyqt_install \
|
|
%{python_expand pushd build \
|
|
%make_install INSTALL_ROOT=%{buildroot} \
|
|
popd \
|
|
# move some files when installing PyQt5 packages built with SIP v4\
|
|
%if 0%{?use_sip4} \
|
|
[ -d %{buildroot}%{_libqt5_datadir}/qsci/api/python ] \\\
|
|
&& mv -T %{buildroot}%{_libqt5_datadir}/qsci/api/python \\\
|
|
%{buildroot}%{_libqt5_datadir}/qsci/api/python_%{$python_bin_suffix} \
|
|
[ -d %{buildroot}/%{_datadir}/sip/PyQt5 ] \\\
|
|
&& mv -T %{buildroot}/%{_datadir}/sip/PyQt5 %{buildroot}/%{_datadir}/sip/PyQt5-%{$python_bin_suffix} \
|
|
%endif \
|
|
# rename PyQt5 plugins, if any \
|
|
find %{buildroot}%{_libqt5_plugindir} -name '*pyqt5*.so' \\\
|
|
| while read f; do mv ${f} ${f/pyqt5/py%{$python_bin_suffix}qt5}; done \
|
|
# rename PyQt6 plugins, if any \
|
|
find %{buildroot}%{_qt6_pluginsdir} -name '*pyqt6*.so' \\\
|
|
| while read f; do mv ${f} ${f/pyqt6/py%{$python_bin_suffix}qt6}; done \
|
|
} \
|
|
%{nil}
|
|
|
|
%pyqt_install_examples() \
|
|
%{python_expand # install example files \
|
|
exdir=%{buildroot}%{_docdir}/%{$python_prefix}-%{1} \
|
|
mkdir -p $exdir \
|
|
cp -r examples $exdir/ \
|
|
find $exdir -name "*.py" -exec sed -i "1 s|^#!%{_bindir}/env python.*$|#!%{_bindir}/$python|" {} \\; \
|
|
%fdupes $exdir \
|
|
} \
|
|
%{nil}
|