# Windows on ARM64, clang/lld based. Must precede %%mingw_package_header. %global mingw_build_ucrtarm64 1 # win32/win64 build with the clang supplement drivers: the qemu-ga MSI ships # DLLs from clang/compiler-rt toolchain sysroots, where the GNU runtime DLLs # do not exist, so nothing shipped there may import them. %global mingw_toolchain_win32 clang %global mingw_toolchain_win64 clang %{?mingw_package_header} %global pkgname pcre2 Name: mingw-%{pkgname} Version: 10.47 Release: 1.2%{?dist} Summary: MinGW Windows %{pkgname} library License: BSD-3-Clause URL: http://www.pcre.org/ Source: https://github.com/PhilipHazel/pcre2/releases/download/pcre2-%{version}/pcre2-%{version}.tar.bz2 ## Patches taken from native package ## # Do no set RPATH if libdir is not /usr/lib Patch0: pcre2-10.10-Fix-multilib.patch BuildArch: noarch BuildRequires: make BuildRequires: automake autoconf libtool # The win32/win64 clang columns dispatch to the supplement drivers only from # 152-1.9 on. Headers and CRT must be named; the GCC targets get them # through gcc. compiler-rt and libunwind: the drivers always link # -rtlib=compiler-rt -unwindlib=libunwind, and mock installs no weak # dependencies. BuildRequires: mingw32-filesystem >= 152-1.9 BuildRequires: mingw32-clang BuildRequires: mingw32-binutils BuildRequires: mingw32-headers BuildRequires: mingw32-crt BuildRequires: mingw32-compiler-rt >= 22.1.8 BuildRequires: mingw32-libunwind >= 22.1.8 BuildRequires: mingw64-filesystem >= 152-1.9 BuildRequires: mingw64-clang BuildRequires: mingw64-binutils BuildRequires: mingw64-headers BuildRequires: mingw64-crt BuildRequires: mingw64-compiler-rt >= 22.1.8 BuildRequires: mingw64-libunwind >= 22.1.8 # No gcc for this target: the toolchain is clang, lld and the llvm-* tools. # Headers and CRT must be named; the other targets get them through gcc. BuildRequires: ucrtarm64-filesystem >= 152 BuildRequires: ucrtarm64-clang BuildRequires: ucrtarm64-llvm-tools BuildRequires: ucrtarm64-headers BuildRequires: ucrtarm64-crt # The drivers always link -rtlib=compiler-rt (__chkstk lives there) and # -unwindlib=libunwind; libunwind only arrives through ucrtarm64-clang's # Recommends chain, and mock installs no weak dependencies. BuildRequires: ucrtarm64-compiler-rt >= 22.1.8 BuildRequires: ucrtarm64-libunwind >= 22.1.8 %description Cross compiled Perl-compatible regular expression library for use with mingw32. PCRE has its own native API, but a set of "wrapper" functions that are based on the POSIX API are also supplied in the library libpcreposix. Note that this just provides a POSIX calling interface to PCRE: the regular expressions themselves still follow Perl syntax and semantics. The header file for the POSIX-style functions is called pcreposix.h. # Win32 %package -n mingw32-%{pkgname} Summary: MinGW Windows %{pkgname} library %description -n mingw32-%{pkgname} MinGW Windows %{pkgname} library. %package -n mingw32-%{pkgname}-static Summary: Static version of the MinGW Windows %{pkgname} library %description -n mingw32-%{pkgname}-static Static version of the MinGW Windows %{pkgname} library. # Win64 %package -n mingw64-%{pkgname} Summary: MinGW Windows %{pkgname} library %description -n mingw64-%{pkgname} MinGW Windows %{pkgname} library. %package -n mingw64-%{pkgname}-static Summary: Static version of the MinGW Windows %{pkgname} library %description -n mingw64-%{pkgname}-static Static version of the MinGW Windows %{pkgname} library. # Windows on ARM64 %package -n ucrtarm64-%{pkgname} Summary: MinGW Windows %{pkgname} library %description -n ucrtarm64-%{pkgname} MinGW Windows %{pkgname} library for the Windows on ARM64 target. %package -n ucrtarm64-%{pkgname}-static Summary: Static version of the MinGW Windows %{pkgname} library %description -n ucrtarm64-%{pkgname}-static Static version of the MinGW Windows %{pkgname} library for the Windows on ARM64 target. %{?mingw_debug_package} %prep %autosetup -p1 -n %{pkgname}-%{version} # Because of multilib patch libtoolize --copy --force autoreconf -vif %build # No --disable-symvers needed: AX_CHECK_VSCRIPT probes with a real link, so # symbol versioning turns itself off wherever lld links (which, with the # win32/win64 columns on the clang drivers, is now every target here). # %%check asserts that outcome rather than trusting it. %mingw_configure \ --enable-jit \ --enable-pcre2grep-jit \ --disable-bsr-anycrlf \ --disable-coverage \ --disable-ebcdic \ --disable-fuzz-support \ --disable-never-backslash-C \ --enable-newline-is-lf \ --enable-pcre2-8 \ --enable-pcre2-16 \ --enable-pcre2-32 \ --enable-pcre2grep-callout \ --enable-pcre2grep-jit \ --disable-pcre2grep-libbz2 \ --disable-pcre2grep-libz \ --disable-pcre2test-libedit \ --disable-rebuild-chartables \ --enable-shared \ --enable-stack-for-recursion \ --enable-static \ --enable-unicode \ --disable-valgrind %mingw_make_build %install %mingw_make_install rm -rf %{buildroot}%{mingw32_datadir}/doc/* rm -rf %{buildroot}%{mingw64_datadir}/doc/* rm -rf %{buildroot}%{ucrtarm64_datadir}/doc/* rm -rf %{buildroot}%{mingw32_datadir}/man/* rm -rf %{buildroot}%{mingw64_datadir}/man/* rm -rf %{buildroot}%{ucrtarm64_datadir}/man/* # Drop all .la files find %{buildroot} -name "*.la" -delete # Fix spurious-executable-perm chmod 0644 %{buildroot}%{mingw32_libdir}/*.dll.a chmod 0644 %{buildroot}%{mingw64_libdir}/*.dll.a chmod 0644 %{buildroot}%{ucrtarm64_libdir}/*.dll.a %check # Verify the ucrtarm64 output with the llvm-* tools only: GNU nm/ar/objdump # silently mis-read AArch64 PE/COFF. %%check runs after the BRP passes. # 1. Symbol versioning stayed off for this target (see %%build). The # positive grep proves the variable exists in the file the negatives read: # a missing Makefile or renamed variable must not pass vacuously. # Every target links with lld now, so the negatives run for all three build # dirs; the positive grep per directory proves the variable exists in the # file the negatives read (the old cross-target GNU-ld control went with the # last GNU-linked target). for d in build_ucrtarm64 build_win32 build_win64 ; do grep -qE '^EXTRA_LIBPCRE2_8_LDFLAGS =' $d/Makefile for v in 8 16 32 POSIX ; do ! grep -E "^EXTRA_LIBPCRE2_${v}_LDFLAGS =.*(version-script|[.]sym)" \ $d/Makefile done done # 2. Every DLL and every program shipped for this target is a Windows ARM64 # PE, stripped, with its debuginfo split out; if %%mingw_debug_package went # missing they would ship unstripped, silently. for f in libpcre2-8-0.dll libpcre2-16-0.dll libpcre2-32-0.dll \ libpcre2-posix-3.dll pcre2grep.exe pcre2test.exe ; do %{ucrtarm64_objdump} -f %{buildroot}%{ucrtarm64_bindir}/$f %{ucrtarm64_objdump} -f %{buildroot}%{ucrtarm64_bindir}/$f \ | grep -q 'file format coff-arm64' %{ucrtarm64_objdump} -h %{buildroot}%{ucrtarm64_bindir}/$f \ | grep -q '\.gnu_debuglink' test -f %{buildroot}%{_prefix}/lib/debug%{ucrtarm64_bindir}/$f.debug done # 3. Every shipped archive -- static and import alike -- still carries its ar # symbol index, and its members are ARM64 COFF. for pair in 8:pcre2_compile_8 16:pcre2_compile_16 32:pcre2_compile_32 \ posix:pcre2_regcomp ; do w=$(echo "$pair" | cut -d: -f1) sym=$(echo "$pair" | cut -d: -f2) for a in %{buildroot}%{ucrtarm64_libdir}/libpcre2-$w.a \ %{buildroot}%{ucrtarm64_libdir}/libpcre2-$w.dll.a ; do magic=$(od -A n -t x1 -N 10 "$a" | tr -d ' \n') echo "archive $a: header $magic, expecting $sym" test "$magic" = "213c617263683e0a2f20" %{ucrtarm64_nm} --print-armap "$a" \ | awk -v s="$sym" '$1 == s && $2 == "in" { found = 1 } END { exit !found }' %{ucrtarm64_objdump} -f "$a" | grep -q 'file format coff-arm64' ! %{ucrtarm64_objdump} -f "$a" \ | grep -E 'file format (coff-i386|coff-x86-64|elf)' done done # 4. Link test: a real pcre2 consumer has to compile and link against exactly # what is about to be packaged, both against the import library and # statically. The executables cannot be run here, so only the link, the # resulting file format and the imports are checked. armcheck=%{_builddir}/ucrtarm64-pcre2-check rm -rf $armcheck mkdir -p $armcheck cat > $armcheck/t.c <<'EOF' #define PCRE2_CODE_UNIT_WIDTH 8 #include #include #include int main (void) { static const char subject[] = "the quick brown fox"; pcre2_code *re; pcre2_match_data *md; PCRE2_SIZE erroroffset; int errornumber; int rc; re = pcre2_compile ((PCRE2_SPTR) "q(ui)ck", PCRE2_ZERO_TERMINATED, 0, &errornumber, &erroroffset, NULL); if (re == NULL) return 1; md = pcre2_match_data_create_from_pattern (re, NULL); if (md == NULL) return 1; rc = pcre2_match (re, (PCRE2_SPTR) subject, strlen (subject), 0, 0, md, NULL); printf ("pcre2_match: %%d\n", rc); pcre2_match_data_free (md); pcre2_code_free (re); return rc == 2 ? 0 : 1; } EOF # Shared: -lpcre2-8 resolves to libpcre2-8.dll.a -> libpcre2-8-0.dll. %{ucrtarm64_cc} -I%{buildroot}%{ucrtarm64_includedir} $armcheck/t.c \ -L%{buildroot}%{ucrtarm64_libdir} -lpcre2-8 -o $armcheck/t.exe %{ucrtarm64_objdump} -f $armcheck/t.exe %{ucrtarm64_objdump} -f $armcheck/t.exe | grep -q 'file format coff-arm64' %{ucrtarm64_objdump} -p $armcheck/t.exe | grep -i 'libpcre2-8-0.dll' # Static: the same program against ucrtarm64-pcre2-static, which must not end up # importing the DLL. -DPCRE2_STATIC is what stops pcre2.h from declaring the # API __declspec(dllimport) on Windows. %{ucrtarm64_cc} -DPCRE2_STATIC -I%{buildroot}%{ucrtarm64_includedir} \ $armcheck/t.c -L%{buildroot}%{ucrtarm64_libdir} \ -Wl,-Bstatic -lpcre2-8 -Wl,-Bdynamic -o $armcheck/t-static.exe %{ucrtarm64_objdump} -f $armcheck/t-static.exe %{ucrtarm64_objdump} -f $armcheck/t-static.exe | grep -q 'file format coff-arm64' # Capture the imports first: under "!" a crashed objdump would count as # "pattern absent" and pass. imports=$(%{ucrtarm64_objdump} -p $armcheck/t-static.exe) if echo "$imports" | grep -qi 'libpcre2-8-0.dll'; then echo "ERROR: the static link imports libpcre2-8-0.dll" >&2 exit 1 fi # 4b. The win32/win64 DLLs are now linked with the clang supplement drivers, # and the qemu-ga MSI ships libpcre2-8-0.dll from sysroots where the GNU # runtime DLLs do not exist: no libgcc, libssp or libunwind import may # appear. The same consumer links through the same drivers. for t in i686-w64-mingw32 x86_64-w64-mingw32 ; do case $t in i686-*) wbin_rel=%{mingw32_bindir} wlibdir=%{buildroot}%{mingw32_libdir} wincdir=%{buildroot}%{mingw32_includedir} peformat=pei-i386 ;; x86_64-*) wbin_rel=%{mingw64_bindir} wlibdir=%{buildroot}%{mingw64_libdir} wincdir=%{buildroot}%{mingw64_includedir} peformat=pei-x86-64 ;; esac wbindir=%{buildroot}$wbin_rel for f in libpcre2-8-0.dll libpcre2-16-0.dll libpcre2-32-0.dll \ libpcre2-posix-3.dll ; do $t-objdump -f $wbindir/$f | grep -q "file format $peformat" $t-objdump -h $wbindir/$f | grep -q '\.gnu_debuglink' test -f %{buildroot}%{_prefix}/lib/debug$wbin_rel/$f.debug imports=$($t-objdump -p $wbindir/$f | grep 'DLL Name' || :) echo "$t $f imports: $imports" if echo "$imports" | grep -qiE 'libgcc|libssp|libunwind'; then echo "ERROR: $t $f imports a GNU runtime or unwinder DLL" >&2 exit 1 fi done $t-clang -I$wincdir $armcheck/t.c -L$wlibdir -lpcre2-8 -o $armcheck/t-$t.exe $t-objdump -f $armcheck/t-$t.exe | grep -q "file format $peformat" $t-objdump -p $armcheck/t-$t.exe | grep -i 'libpcre2-8-0.dll' $t-clang -DPCRE2_STATIC -I$wincdir $armcheck/t.c -L$wlibdir \ -Wl,-Bstatic -lpcre2-8 -Wl,-Bdynamic -o $armcheck/t-static-$t.exe imports=$($t-objdump -p $armcheck/t-static-$t.exe) if echo "$imports" | grep -qi 'libpcre2-8-0.dll'; then echo "ERROR: the $t static link imports libpcre2-8-0.dll" >&2 exit 1 fi done rm -rf "$armcheck" # 5. The pkg-config files are how everything downstream (glib2 first of all) # finds this library, and nothing else in this build would notice if one were # missing or landed in the wrong directory. ucrtarm64-pkg-config is the # wrapper downstream specs call; it dispatches to pkgconf with the # aarch64-w64-mingw32 personality. --modversion short-circuits pkgconf, so # --cflags/--libs get their own invocations. --cflags is expected to come # out empty: the personality lists the sysroot include directory as a system # path and pkgconf drops -I for those, as it does for the other targets. ( PKG_CONFIG_LIBDIR=%{buildroot}%{ucrtarm64_libdir}/pkgconfig export PKG_CONFIG_LIBDIR cat $PKG_CONFIG_LIBDIR/libpcre2-8.pc grep -q '^prefix=%{ucrtarm64_prefix}$' $PKG_CONFIG_LIBDIR/libpcre2-8.pc for m in libpcre2-8 libpcre2-16 libpcre2-32 libpcre2-posix ; do ucrtarm64-pkg-config --exists --print-errors $m ucrtarm64-pkg-config --modversion $m ucrtarm64-pkg-config --cflags $m ucrtarm64-pkg-config --libs $m done ucrtarm64-pkg-config --libs libpcre2-8 | grep -q -- '-lpcre2-8' ucrtarm64-pkg-config --modversion libpcre2-8 | grep -q '^%{version}$' ) # Win32 %files -n mingw32-%{pkgname} %license COPYING %{mingw32_bindir}/pcre2grep.exe %{mingw32_bindir}/pcre2test.exe %{mingw32_bindir}/pcre2-config %{mingw32_bindir}/libpcre2-8-0.dll %{mingw32_bindir}/libpcre2-16-0.dll %{mingw32_bindir}/libpcre2-32-0.dll %{mingw32_bindir}/libpcre2-posix-3.dll %{mingw32_libdir}/libpcre2-8.dll.a %{mingw32_libdir}/libpcre2-16.dll.a %{mingw32_libdir}/libpcre2-32.dll.a %{mingw32_libdir}/libpcre2-posix.dll.a %{mingw32_libdir}/pkgconfig/libpcre2-*.pc %{mingw32_includedir}/pcre2.h %{mingw32_includedir}/pcre2posix.h %files -n mingw32-%{pkgname}-static %license COPYING %{mingw32_libdir}/libpcre2-8.a %{mingw32_libdir}/libpcre2-16.a %{mingw32_libdir}/libpcre2-32.a %{mingw32_libdir}/libpcre2-posix.a # Win64 %files -n mingw64-%{pkgname} %license COPYING %{mingw64_bindir}/pcre2grep.exe %{mingw64_bindir}/pcre2test.exe %{mingw64_bindir}/pcre2-config %{mingw64_bindir}/libpcre2-8-0.dll %{mingw64_bindir}/libpcre2-16-0.dll %{mingw64_bindir}/libpcre2-32-0.dll %{mingw64_bindir}/libpcre2-posix-3.dll %{mingw64_libdir}/libpcre2-8.dll.a %{mingw64_libdir}/libpcre2-16.dll.a %{mingw64_libdir}/libpcre2-32.dll.a %{mingw64_libdir}/libpcre2-posix.dll.a %{mingw64_libdir}/pkgconfig/libpcre2-*.pc %{mingw64_includedir}/pcre2.h %{mingw64_includedir}/pcre2posix.h %files -n mingw64-%{pkgname}-static %license COPYING %{mingw64_libdir}/libpcre2-8.a %{mingw64_libdir}/libpcre2-16.a %{mingw64_libdir}/libpcre2-32.a %{mingw64_libdir}/libpcre2-posix.a # Windows on ARM64 %files -n ucrtarm64-%{pkgname} %license COPYING %{ucrtarm64_bindir}/pcre2grep.exe %{ucrtarm64_bindir}/pcre2test.exe %{ucrtarm64_bindir}/pcre2-config %{ucrtarm64_bindir}/libpcre2-8-0.dll %{ucrtarm64_bindir}/libpcre2-16-0.dll %{ucrtarm64_bindir}/libpcre2-32-0.dll %{ucrtarm64_bindir}/libpcre2-posix-3.dll %{ucrtarm64_libdir}/libpcre2-8.dll.a %{ucrtarm64_libdir}/libpcre2-16.dll.a %{ucrtarm64_libdir}/libpcre2-32.dll.a %{ucrtarm64_libdir}/libpcre2-posix.dll.a %{ucrtarm64_libdir}/pkgconfig/libpcre2-*.pc %{ucrtarm64_includedir}/pcre2.h %{ucrtarm64_includedir}/pcre2posix.h %files -n ucrtarm64-%{pkgname}-static %license COPYING %{ucrtarm64_libdir}/libpcre2-8.a %{ucrtarm64_libdir}/libpcre2-16.a %{ucrtarm64_libdir}/libpcre2-32.a %{ucrtarm64_libdir}/libpcre2-posix.a %changelog * Mon Aug 24 2026 Erik Berg - 10.47-1.2 - Build the win32 and win64 targets with the clang supplement drivers: the qemu-ga MSI ships libpcre2-8-0.dll from clang/compiler-rt toolchain sysroots, where the GNU runtime DLLs do not exist - Symbol versioning now self-disables on every target (lld links them all); the checks assert that, and that the x86 DLLs import no libgcc, libssp or libunwind * Thu Aug 06 2026 Erik Berg - 10.47-1.1 - Add pcre2 for the Windows on ARM64 target * Sat Nov 15 2025 Sandro Mani - 10.47-1 - Update to 10.47 * Fri Jan 16 2026 Fedora Release Engineering - 10.46-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild * Tue Sep 02 2025 Sandro Mani - 10.46-1 - Update to 10.46 * Thu Jul 24 2025 Fedora Release Engineering - 10.45-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild * Thu Feb 20 2025 Sandro Mani - 10.45-1 - Update to 10.45 * Fri Jan 17 2025 Fedora Release Engineering - 10.44-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild * Thu Jul 18 2024 Fedora Release Engineering - 10.44-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild * Tue Jul 02 2024 Sandro Mani - 10.44-1 - Update to 10.44 * Fri Mar 22 2024 Sandro Mani - 10.43-1 - Update to 10.43 * Thu Jan 25 2024 Fedora Release Engineering - 10.42-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild * Sun Jan 21 2024 Fedora Release Engineering - 10.42-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild * Thu Jul 20 2023 Fedora Release Engineering - 10.42-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild * Thu Jan 19 2023 Fedora Release Engineering - 10.42-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild * Fri Jan 13 2023 Sandro Mani - 10.42-1 - Update to 10.42 * Thu Jul 21 2022 Fedora Release Engineering - 10.40-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild * Sun May 01 2022 Sandro Mani - 10.40-1 - Update to 10.40 * Fri Mar 25 2022 Sandro Mani - 10.39-3 - Rebuild with mingw-gcc-12 * Thu Jan 20 2022 Fedora Release Engineering - 10.39-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild * Fri Nov 05 2021 Sandro Mani - 10.39-1 - Update to 10.39 * Thu Jul 22 2021 Fedora Release Engineering - 10.37-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild * Fri Jul 16 2021 Sandro Mani - 10.37-1 - Update to 10.37 * Tue Jan 26 2021 Fedora Release Engineering - 10.36-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild * Thu Dec 10 2020 Sandro Mani - 10.36-1 - Update to 10.36 * Tue Jul 28 2020 Fedora Release Engineering - 10.35-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild * Sat May 09 2020 Sandro Mani - 10.35-1 - Update to 10.35 * Wed Jan 29 2020 Fedora Release Engineering - 10.34-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild * Thu Nov 21 2019 Sandro Mani - 10.34-1 - Update to 10.34 * Wed Aug 28 2019 Sandro Mani - 10.33-3 - Rebuild (readline) * Thu Jul 25 2019 Fedora Release Engineering - 10.33-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild * Wed Apr 17 2019 Sandro Mani - 10.33-1 - Update to 10.33 * Fri Feb 01 2019 Fedora Release Engineering - 10.32-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild * Thu Sep 13 2018 Sandro Mani - 10.32-1 - Update to 10.32 * Fri Jul 13 2018 Fedora Release Engineering - 10.31-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild * Mon Feb 12 2018 Sandro Mani - 10.31-1 - Update to 10.31 * Thu Feb 08 2018 Fedora Release Engineering - 10.30-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild * Tue Aug 15 2017 Sandro Mani - 10.30-1 - Update to 10.30 * Wed Jul 26 2017 Fedora Release Engineering - 10.23-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild * Fri Jul 07 2017 Sandro Mani - 10.23-2 - Remove duplicate listed files in %%files - Add %%license to static packages * Wed Jun 14 2017 Sandro Mani - 10.23-1 - Initial package