Use pkgconf for pkgconfig

PkgConf supports pretending to be pkgconfig(1) for cross-target
toolchains through the use of personality files.

By using this method, we can drop mingw-pkg-config and consistently
use native tools for discovery and toolchain configuration for
cross-compilation.
This commit is contained in:
Neal Gompa 2021-06-12 22:00:09 -04:00
parent f88d07b914
commit 596cb8d010
3 changed files with 47 additions and 2 deletions

View File

@ -6,7 +6,7 @@
%global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d)
Name: mingw-filesystem
Version: 118
Version: 119
Release: 1%{?dist}
Summary: MinGW cross compiler base filesystem and environment
@ -37,14 +37,17 @@ Source16: standard-dlls-mingw32
Source17: standard-dlls-mingw64
Source18: toolchain-mingw32.meson
Source19: toolchain-mingw64.meson
Source20: pkgconf-personality-mingw32
Source21: pkgconf-personality-mingw64
# Taken from the Fedora filesystem package
Source101: https://fedorahosted.org/filesystem/browser/lang-exceptions
Source102: iso_639.sed
Source103: iso_3166.sed
BuildRequires: make
BuildRequires: make
BuildRequires: iso-codes
BuildRequires: pkgconf
%description
@ -65,6 +68,8 @@ Obsoletes: cross-filesystem < 67-2
Obsoletes: cross-filesystem-scripts < 67-2
Obsoletes: mingw-filesystem < 75-2
Obsoletes: mingw-filesystem-scripts < 75-2
# For using pkgconf with MinGW
Requires: pkgconf
%description base
This package contains the base filesystem layout, RPM macros and
@ -78,6 +83,10 @@ This environment is maintained by the Fedora MinGW SIG at:
%package -n mingw32-filesystem
Summary: MinGW cross compiler base filesystem and environment for the win32 target
Requires: %{name}-base = %{version}-%{release}
# Replace mingw32-pkg-config
Conflicts: mingw32-pkg-config < 0.28-17
Obsoletes: mingw32-pkg-config < 0.28-17
Provides: mingw32-pkg-config = 0.28-17
# Note about 'Provides: mingw32(foo.dll)'
# ------------------------------------------------------------
@ -108,6 +117,10 @@ This environment is maintained by the Fedora MinGW SIG at:
%package -n mingw64-filesystem
Summary: MinGW cross compiler base filesystem and environment for the win64 target
Requires: %{name}-base = %{version}-%{release}
# Replace mingw64-pkg-config
Conflicts: mingw64-pkg-config < 0.28-17
Obsoletes: mingw64-pkg-config < 0.28-17
Provides: mingw64-pkg-config = 0.28-17
Provides: %(sed "s/\(.*\)/mingw64(\1) /g" %{SOURCE17} | tr "\n" " ")
Provides: mingw64(mscoree.dll)
@ -142,6 +155,10 @@ for i in mingw32-configure mingw32-cmake mingw32-make mingw32-meson mingw32-pkg-
mingw64-configure mingw64-cmake mingw64-make mingw64-meson mingw64-pkg-config ; do
ln -s %{_libexecdir}/mingw-scripts $i
done
for i in i686-w64-mingw32-pkg-config \
x86_64-w64-mingw32-pkg-config ; do
ln -s %{_bindir}/pkgconf $i
done
popd
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/profile.d
@ -280,6 +297,13 @@ install -m 0644 %{SOURCE12} $RPM_BUILD_ROOT%{_datadir}/mingw/
install -m 0644 %{SOURCE18} $RPM_BUILD_ROOT%{_datadir}/mingw/
install -m 0644 %{SOURCE19} $RPM_BUILD_ROOT%{_datadir}/mingw/
mkdir -p $RPM_BUILD_ROOT%{pkgconfig_personalitydir}
install -m 0644 %{SOURCE20} $RPM_BUILD_ROOT%{pkgconfig_personalitydir}/i686-w64-mingw32.personality
install -m 0644 %{SOURCE21} $RPM_BUILD_ROOT%{pkgconfig_personalitydir}/x86_64-w64-mingw32.personality
# Link mingw-pkg-config man pages to pkgconf(1)
echo ".so man1/pkgconf.1" > %{buildroot}%{_mandir}/man1/i686-w64-mingw32-pkg-config.1
echo ".so man1/pkgconf.1" > %{buildroot}%{_mandir}/man1/x86_64-w64-mingw32-pkg-config.1
%files base
%doc COPYING
@ -298,10 +322,13 @@ install -m 0644 %{SOURCE19} $RPM_BUILD_ROOT%{_datadir}/mingw/
%{_bindir}/mingw32-make
%{_bindir}/mingw32-meson
%{_bindir}/mingw32-pkg-config
%{_bindir}/i686-w64-mingw32-pkg-config
%{_mandir}/man1/i686-w64-mingw32-pkg-config.1*
%{_prefix}/i686-w64-mingw32
%{_rpmconfigdir}/fileattrs/mingw32.attr
%{_datadir}/mingw/toolchain-mingw32.cmake
%{_datadir}/mingw/toolchain-mingw32.meson
%{pkgconfig_personalitydir}/i686-w64-mingw32.personality
%files -n mingw64-filesystem
%{macrosdir}/macros.mingw64
@ -311,13 +338,19 @@ install -m 0644 %{SOURCE19} $RPM_BUILD_ROOT%{_datadir}/mingw/
%{_bindir}/mingw64-make
%{_bindir}/mingw64-meson
%{_bindir}/mingw64-pkg-config
%{_bindir}/x86_64-w64-mingw32-pkg-config
%{_mandir}/man1/x86_64-w64-mingw32-pkg-config.1*
%{_prefix}/x86_64-w64-mingw32
%{_rpmconfigdir}/fileattrs/mingw64.attr
%{_datadir}/mingw/toolchain-mingw64.cmake
%{_datadir}/mingw/toolchain-mingw64.meson
%{pkgconfig_personalitydir}/x86_64-w64-mingw32.personality
%changelog
* Sat Jun 12 2021 Neal Gompa <ngompa13@gmail.com> - 119-1
- Use pkgconf for pkgconfig
* Mon Jun 07 2021 Sandro Mani <manisandro@gmail.com> - 118-1
- Allow overriding CFLAGS/CXXFLAGS/LDFLAGS for %%mingw_meson

View File

@ -0,0 +1,6 @@
# MinGW 32-bit x86 Windows target
Triplet: i686-w64-mingw32
SysrootDir: /usr/i686-w64-mingw32/sys-root/mingw
DefaultSearchPaths: /usr/i686-w64-mingw32/sys-root/mingw/lib/pkgconfig:/usr/i686-w64-mingw32/sys-root/mingw/share/pkgconfig
SystemIncludePaths: /usr/i686-w64-mingw32/sys-root/mingw/include
SystemLibraryPaths: /usr/i686-w64-mingw32/sys-root/mingw/lib

View File

@ -0,0 +1,6 @@
# MinGW 64-bit x86 Windows target
Triplet: x86_64-w64-mingw32
SysrootDir: /usr/x86_64-w64-mingw32/sys-root/mingw
DefaultSearchPaths: /usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig:/usr/x86_64-w64-mingw32/sys-root/mingw/share/pkgconfig
SystemIncludePaths: /usr/x86_64-w64-mingw32/sys-root/mingw/include
SystemLibraryPaths: /usr/x86_64-w64-mingw32/sys-root/mingw/lib