From 596cb8d01068417a37e01c6de13783aacb5299fa Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Sat, 12 Jun 2021 22:00:09 -0400 Subject: [PATCH] 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. --- mingw-filesystem.spec | 37 +++++++++++++++++++++++++++++++++++-- pkgconf-personality-mingw32 | 6 ++++++ pkgconf-personality-mingw64 | 6 ++++++ 3 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 pkgconf-personality-mingw32 create mode 100644 pkgconf-personality-mingw64 diff --git a/mingw-filesystem.spec b/mingw-filesystem.spec index 005f59f..0aca677 100644 --- a/mingw-filesystem.spec +++ b/mingw-filesystem.spec @@ -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 - 119-1 +- Use pkgconf for pkgconfig + * Mon Jun 07 2021 Sandro Mani - 118-1 - Allow overriding CFLAGS/CXXFLAGS/LDFLAGS for %%mingw_meson diff --git a/pkgconf-personality-mingw32 b/pkgconf-personality-mingw32 new file mode 100644 index 0000000..dcf7848 --- /dev/null +++ b/pkgconf-personality-mingw32 @@ -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 diff --git a/pkgconf-personality-mingw64 b/pkgconf-personality-mingw64 new file mode 100644 index 0000000..4cca871 --- /dev/null +++ b/pkgconf-personality-mingw64 @@ -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