Blob Blame History Raw
%global win32_dir %{_builddir}/mingw32-%{name}-%{version}-%{release}
%global win64_dir %{_builddir}/mingw64-%{name}-%{version}-%{release}
%global win32_host_dir %{_builddir}/mingw32-host-%{name}-%{version}-%{release}
%global win64_host_dir %{_builddir}/mingw64-host-%{name}-%{version}-%{release}

# Disable debuginfo subpackages and debugsource packages for now to use old logic
%undefine _debugsource_packages
%undefine _debuginfo_subpackages

# Override the __debug_install_post argument as this package
# contains both native as well as cross compiled binaries
%global __debug_install_post %%{mingw_debug_install_post}; %{_rpmconfigdir}/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_find_debuginfo_opts} "%{_builddir}/%%{?buildsubdir}" %{nil}

%global pkgname sip
%global pre dev1805261119

Name:           mingw-%{pkgname}
Summary:        MinGW Windows SIP
Version:        4.19.9
Release:        0.1%{?pre:.%pre}%{?dist}

# sipgen/parser.{c.h} is GPLv3+ with exceptions (bison)
License:        GPLv2 or GPLv3 and (GPLv3+ with exceptions)
Url:            http://www.riverbankcomputing.com/software/sip/intro
%if 0%{?pre:1}
Source0:        https://www.riverbankcomputing.com/static/Downloads/sip/sip-%{version}.%{pre}.tar.gz
%else
Source0:        http://downloads.sourceforge.net/pyqt/sip-%{version}.tar.gz
%endif
Source1:        mingw-win32-host-pyconfig
Source2:        mingw-win64-host-pyconfig
Source3:        mingw-win32-pyconfig
Source4:        mingw-win64-pyconfig
Source5:        mingw-win32-g++
Source6:        mingw-win64-g++

# make install should not strip (by default), kills -debuginfo
Patch0:         sip-4.16.3-no_strip.patch
# try not to rpath the world
Patch1:         sip-4.16.3-no_rpath.patch
# Fix some config paths, add -lpythonX.Y to linker flags
Patch2:         sip-4.19-config.patch
# Backport fix for build error with Python < 3.3
Patch3:         sip-4.19.9_siplib.patch
# Fix unpack error in configure.py, FIXME temporarily forcefully disable broken mk_distinf
Patch4:         sip-4.19.9_configure.patch

BuildRequires:  gcc-c++
BuildRequires:  python2-devel

BuildRequires:  mingw32-filesystem >= 102
BuildRequires:  mingw32-python2
BuildRequires:  mingw32-qt5-qtbase

BuildRequires:  mingw64-filesystem >= 102
BuildRequires:  mingw64-python2
BuildRequires:  mingw64-qt5-qtbase


%description
MinGW Windows SIP.

%package -n mingw32-%{pkgname}
Summary:       MinGW Windows SIP
Requires:      mingw32-python2

%description -n mingw32-%{pkgname}
MinGW Windows SIP.


%package -n mingw64-%{pkgname}
Summary:       MinGW Windows SIP
Requires:      mingw64-python2

%description -n mingw64-%{pkgname}
MinGW Windows SIP.


%{?mingw_debug_package}


%prep
%autosetup -p1 -n %{pkgname}-%{version}%{?pre:.%pre}
cp -a %{SOURCE5} specs/mingw-win32-g++
cp -a %{SOURCE6} specs/mingw-win64-g++

rm -rf %{win32_dir}
rm -rf %{win64_dir}
rm -rf %{win32_host_dir}
rm -rf %{win64_host_dir}
cp -a . %{win32_dir}
cp -a . %{win64_dir}
cp -a . %{win32_host_dir}
cp -a . %{win64_host_dir}


%build
pushd %{win32_host_dir}
%{__python2} configure.py --configuration=%{SOURCE1} \
    CXXFLAGS="%{optflags} -I/usr/include/python2.7" CFLAGS="%{optflags} -I/usr/include/python2.7" LFLAGS="%{?__global_ldflags} -lpython2.7"
%make_build
popd

pushd %{win64_host_dir}
%{__python2} configure.py --configuration=%{SOURCE2} \
    CXXFLAGS="%{optflags} -I/usr/include/python2.7" CFLAGS="%{optflags} -I/usr/include/python2.7" LFLAGS="%{?__global_ldflags} -lpython2.7"
%make_build
popd

pushd %{win32_dir}
mingw32-python configure.py --configuration=%{SOURCE3} --use-qmake -p mingw-win32-g++ \
    CXXFLAGS="%{optflags}" CFLAGS="%{optflags}" LFLAGS="%{?__global_ldflags}"
%mingw32_qmake_qt5 sip.pro
%mingw32_make %{?_smp_mflags}
popd

pushd %{win64_dir}
mingw64-python configure.py --configuration=%{SOURCE4} --use-qmake -p mingw-win64-g++ \
    CXXFLAGS="%{optflags}" CFLAGS="%{optflags}" LFLAGS="%{?__global_ldflags}"
%mingw64_qmake_qt5 sip.pro
%mingw64_make %{?_smp_mflags}
popd


%install
%make_install -C %{win32_host_dir}
%make_install -C %{win64_host_dir}
%mingw32_make INSTALL_ROOT=%{buildroot} -C %{win32_dir} install
%mingw64_make INSTALL_ROOT=%{buildroot} -C %{win64_dir} install

mkdir -p %{buildroot}%{mingw32_datadir}/sip
mkdir -p %{buildroot}%{mingw64_datadir}/sip

mkdir -p %{buildroot}%{_bindir}
ln -s %{_prefix}/%{mingw32_target}/bin/sip %{buildroot}%{_bindir}/mingw32-sip
ln -s %{_prefix}/%{mingw64_target}/bin/sip %{buildroot}%{_bindir}/mingw64-sip

# Exclude debug files from the main files (note: the debug files are only created after %%install, so we can't search for them directly)
find %{buildroot}%{mingw32_prefix} | grep -E '.(exe|dll|pyd)$' | sed 's|^%{buildroot}\(.*\)$|%%exclude \1.debug|' > mingw32-%{pkgname}.debugfiles
find %{buildroot}%{mingw64_prefix} | grep -E '.(exe|dll|pyd)$' | sed 's|^%{buildroot}\(.*\)$|%%exclude \1.debug|' > mingw64-%{pkgname}.debugfiles


%files -n mingw32-%{pkgname} -f mingw32-%{pkgname}.debugfiles
%license LICENSE LICENSE-GPL2 LICENSE-GPL3
%{_prefix}/%{mingw32_target}/bin/sip
%{_prefix}/%{mingw32_target}/lib/python2.7/site-packages/*
%{_bindir}/mingw32-sip
%{mingw32_bindir}/sip.exe
%{mingw32_python2_sitearch}/*
%exclude %{mingw32_python2_sitearch}/*.debug
%{mingw32_includedir}/python2.7/sip.h
%dir %{mingw32_datadir}/sip

%files -n mingw64-%{pkgname} -f mingw64-%{pkgname}.debugfiles
%license LICENSE LICENSE-GPL2 LICENSE-GPL3
%{_prefix}/%{mingw64_target}/bin/sip
%{_prefix}/%{mingw64_target}/lib/python2.7/site-packages/*
%{_bindir}/mingw64-sip
%{mingw64_bindir}/sip.exe
%{mingw64_python2_sitearch}/*
%exclude %{mingw64_python2_sitearch}/*.debug
%{mingw64_includedir}/python2.7/sip.h
%dir %{mingw64_datadir}/sip


%changelog
* Fri Jun 01 2018 Sandro Mani <manisandro@gmail.com> - 4.19.9-0.1.dev1805261119
- Update to 4.19.9.dev1805261119

* Wed Mar 07 2018 Sandro Mani <manisandro@gmail.com> - 4.19.8-1
- Update to 4.19.8

* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 4.19.7-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Wed Jan 24 2018 Sandro Mani <manisandro@gmail.com> - 4.19.7-1
- Update to 4.19.7

* Sat Nov 25 2017 Sandro Mani <manisandro@gmail.com> - 4.19.6-1
- Update to 4.19.6

* Tue Nov 07 2017 Sandro Mani <manisandro@gmail.com> - 4.19.5-1
- Update to 4.19.5

* Sat Nov 04 2017 Sandro Mani <manisandro@gmail.com> - 4.19.4-1
- Update to 4.19.4

* Sat Sep 09 2017 Sandro Mani <manisandro@gmail.com> - 4.19.3-4
- More robust debug file filtering

* Sat Sep 09 2017 Sandro Mani <manisandro@gmail.com> - 4.19.3-3
- Rebuild for mingw-filesystem

* Mon Sep 04 2017 Sandro Mani <manisandro@gmail.com> - 4.19.3-2
- Build against Qt5

* Tue Jul 11 2017 Sandro Mani <manisandro@gmail.com> - 4.19.3-1
- Update to 4.19.3

* Tue Apr 25 2017 Sandro Mani <manisandro@gmail.com> - 4.19.2-1
- Update to 4.19.2

* Mon Jan 16 2017 Sandro Mani <manisandro@gmail.com> - 4.19-1
- Update to 4.19.0

* Fri Jan 22 2016 Sandro Mani <manisandro@gmail.com> - 4.17-1
- Update to 4.17.0

* Mon Aug 10 2015 Sandro Mani <manisandro@gmail.com> - 4.16.9-1
- Initial package