From 0a9e204dadc20054aafe2d7151136f08ad5637fa Mon Sep 17 00:00:00 2001 From: autoantwort <41973254+autoantwort@users.noreply.github.com> Date: Tue, 1 Feb 2022 20:57:44 +0100 Subject: [PATCH] [pixman] fix build on M1 macs (#22854) --- ports/pixman/no-host-cpu-checks.patch | 108 ++++++++++++++++++++++++++ ports/pixman/portfile.cmake | 4 +- ports/pixman/vcpkg.json | 3 +- versions/baseline.json | 2 +- versions/p-/pixman.json | 5 ++ 5 files changed, 119 insertions(+), 3 deletions(-) create mode 100644 ports/pixman/no-host-cpu-checks.patch diff --git a/ports/pixman/no-host-cpu-checks.patch b/ports/pixman/no-host-cpu-checks.patch new file mode 100644 index 0000000000..f70c54a01c --- /dev/null +++ b/ports/pixman/no-host-cpu-checks.patch @@ -0,0 +1,108 @@ +diff --git a/meson.build b/meson.build +index 1cec227..1b07ca8 100644 +--- a/meson.build ++++ b/meson.build +@@ -95,44 +95,7 @@ else + mmx_flags = ['-mmmx', '-Winline'] + endif + if not use_mmx.disabled() +- if host_machine.cpu_family() == 'x86_64' or cc.get_id() == 'msvc' +- have_mmx = true +- elif host_machine.cpu_family() == 'x86' and cc.compiles(''' +- #include +- #include +- +- /* Check support for block expressions */ +- #define _mm_shuffle_pi16(A, N) \ +- ({ \ +- __m64 ret; \ +- \ +- /* Some versions of clang will choke on K */ \ +- asm ("pshufw %2, %1, %0\n\t" \ +- : "=y" (ret) \ +- : "y" (A), "K" ((const int8_t)N) \ +- ); \ +- \ +- ret; \ +- }) +- +- int main () { +- __m64 v = _mm_cvtsi32_si64 (1); +- __m64 w; +- +- w = _mm_shuffle_pi16(v, 5); +- +- /* Some versions of clang will choke on this */ +- asm ("pmulhuw %1, %0\n\t" +- : "+y" (w) +- : "y" (v) +- ); +- +- return _mm_cvtsi64_si32 (v); +- }''', +- args : mmx_flags, +- name : 'MMX Intrinsic Support') +- have_mmx = true +- endif ++ have_mmx = true + endif + + if have_mmx +@@ -154,29 +117,7 @@ elif cc.get_id() != 'msvc' + sse2_flags = ['-msse2', '-Winline'] + endif + if not use_sse2.disabled() +- if host_machine.cpu_family() == 'x86' +- if cc.compiles(''' +- #if defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2)) +- # if !defined(__amd64__) && !defined(__x86_64__) +- # error "Need GCC >= 4.2 for SSE2 intrinsics on x86" +- # endif +- #endif +- #include +- #include +- #include +- int param; +- int main () { +- __m128i a = _mm_set1_epi32 (param), b = _mm_set1_epi32 (param + 1), c; +- c = _mm_xor_si128 (a, b); +- return _mm_cvtsi128_si32(c); +- }''', +- args : sse2_flags, +- name : 'SSE2 Intrinsic Support') +- have_sse2 = true +- endif +- elif host_machine.cpu_family() == 'x86_64' +- have_sse2 = true +- endif ++ have_sse2 = true + endif + + if have_sse2 +@@ -192,24 +133,8 @@ if cc.get_id() != 'msvc' + ssse3_flags = ['-mssse3', '-Winline'] + endif + +-# x64 pre-2010 MSVC compilers crashes when building the ssse3 code +-if not use_ssse3.disabled() and not (cc.get_id() == 'msvc' and cc.version().version_compare('<16') and host_machine.cpu_family() == 'x86_64') +- if host_machine.cpu_family().startswith('x86') +- if cc.compiles(''' +- #include +- #include +- #include +- int param; +- int main () { +- __m128i a = _mm_set1_epi32 (param), b = _mm_set1_epi32 (param + 1), c; +- c = _mm_xor_si128 (a, b); +- return _mm_cvtsi128_si32(c); +- }''', +- args : ssse3_flags, +- name : 'SSSE3 Intrinsic Support') +- have_ssse3 = true +- endif +- endif ++if use_ssse3.enabled() ++ have_ssse3 = true + endif + + if have_ssse3 diff --git a/ports/pixman/portfile.cmake b/ports/pixman/portfile.cmake index 43f4f3ddba..fa6c8687a4 100644 --- a/ports/pixman/portfile.cmake +++ b/ports/pixman/portfile.cmake @@ -39,7 +39,9 @@ vcpkg_extract_source_archive_ex( OUT_SOURCE_PATH SOURCE_PATH ARCHIVE ${ARCHIVE} REF ${PIXMAN_VERSION} - PATCHES remove_test_demos.patch + PATCHES + remove_test_demos.patch + no-host-cpu-checks.patch ) # Meson install wrongly pkgconfig file! vcpkg_configure_meson( diff --git a/ports/pixman/vcpkg.json b/ports/pixman/vcpkg.json index 916f1a4f08..b475c2fb78 100644 --- a/ports/pixman/vcpkg.json +++ b/ports/pixman/vcpkg.json @@ -1,9 +1,10 @@ { "name": "pixman", "version": "0.40.0", - "port-version": 1, + "port-version": 2, "description": "Pixman is a low-level software library for pixel manipulation, providing features such as image compositing and trapezoid rasterization.", "homepage": "https://www.cairographics.org/releases", + "license": "MIT", "dependencies": [ "libpng", { diff --git a/versions/baseline.json b/versions/baseline.json index b8f7569148..d7442110be 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -5314,7 +5314,7 @@ }, "pixman": { "baseline": "0.40.0", - "port-version": 1 + "port-version": 2 }, "pkgconf": { "baseline": "1.8.0", diff --git a/versions/p-/pixman.json b/versions/p-/pixman.json index 5379531d8c..0faacd4b5a 100644 --- a/versions/p-/pixman.json +++ b/versions/p-/pixman.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "85d5aa0bbd91cff8853d0767bc9dc73e97156291", + "version": "0.40.0", + "port-version": 2 + }, { "git-tree": "c2dd7fec404954b43ad0da4ee86c29a4cfdd8fc1", "version": "0.40.0",