File mingw64-qmlpluginexports.spec of Package mingw64-qmlpluginexports
#
# spec file for package mingw64-qmlpluginexports
#
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global qt_version @BUILD_FLAVOR@%nil
%if "%{qt_version}" == ""
%define _name qmlpluginexports
Name: mingw64-%{_name}
%else
%define _name qmlpluginexports-%{qt_version}
Name: mingw64-%{_name}
%endif
Version: 1.0
Release: 0
Summary: Tool to list exports provided by QML plugins
License: GPL-3.0-or-later
Group: Development/Tools/Building
URL: https://www.opensuse.org
Source0: LICENSE
Source1: qmlpluginexports.cpp
Source2: CMakeLists.txt
#!BuildIgnore: qml-autoreqprov
#!BuildIgnore: mingw64-cross-%{_name}
%if "%{qt_version}" == "qt6"
BuildRequires: mingw64-qt6-declarative-private-devel
%else
BuildRequires: mingw64-libqt5-qtdeclarative-private-headers-devel
%endif
BuildRequires: mingw64-dlfcn-win32-devel
BuildRequires: mingw64-cross-cmake
BuildRequires: mingw64-cross-wine
%if "%{qt_version}" == ""
ExclusiveArch: do_not_build
%endif
%_mingw64_package_header_debug
BuildArch: noarch
%description
This tools loads a QML plugin and prints a list of identifiers and versions
to stdout. See qml-autoreqprov's README for details.
%package -n mingw64-cross-%{_name}
Summary: Tool to list exports provided by QML plugins
License: GPL-3.0-or-later
Group: Development/Tools/Building
Requires: mingw64-cross-wine
Requires: %{name}
%description -n mingw64-cross-%{_name}
Native wrapper for cross compiled windows executable qmlpluginexports-qt5
%_mingw64_debug_package
%prep
cp %{SOURCE0} .
cp %{SOURCE1} .
cp %{SOURCE2} .
%build
%if "%{qt_version}" == "qt6"
%qmake6 .
%qmake6_build
%else
%_mingw64_cmake
%_mingw64_cmake_build
%endif
%install
%_mingw64_cmake_install
mkdir -p %{buildroot}%{_prefix}/%{_mingw64_target}/bin/qt5
mkdir -p %{buildroot}%{_bindir}
cat << EOF > %{buildroot}%{_prefix}/%{_mingw64_target}/bin/qt5/qmlpluginexports
#!/bin/sh -x
binpath=\$(echo \$1 | sed 's,%{_mingw64_prefix}/.*,%{_mingw64_bindir},g')
rootdir=\$HOME/.wine/.qmlpluginexports
if ! test -d \$rootdir\$binpath; then
# init binary search path
ci_host=%{_mingw64_target} . /usr/lib/rpm/mingw64-cross-wine-wine.sh \$binpath
# delete previous setting
rm -rf \$rootdir
# add hint that path has been set
mkdir -p \$rootdir\$binpath
fi
# list provides
/usr/bin/wine %{_mingw64_bindir}/qmlpluginexports-%{qt_version}.exe \$* | sed 's,\r,,g'
exit $?
EOF
chmod a+x %{buildroot}%{_prefix}/%{_mingw64_target}/bin/qt5/qmlpluginexports
ln -s ../%{_mingw64_target}/bin/qt5/qmlpluginexports %{buildroot}%{_bindir}/%{_mingw64_target}-qmlpluginexports-%{qt_version}
%files
%license LICENSE
%{_mingw64_bindir}/qmlpluginexports-%{qt_version}.exe
%files -n mingw64-cross-%{_name}
%{_prefix}/%{_mingw64_target}/bin/qt5/
%{_prefix}/bin/%{_mingw64_target}-qmlpluginexports-qt5
%changelog