crossbuild: target-aware POSIX gate in generated headers (Sylpheed fork)
Some checks failed
ci / CI ubuntu-latest avx clang debug (push) Failing after 17s
ci / CI ubuntu-latest baseline clang debug (push) Failing after 8s
ci / CI ubuntu-latest baseline clang release (push) Failing after 9s
ci / CI ubuntu-latest avx gcc debug (push) Failing after 8s
ci / CI ubuntu-latest avx gcc release (push) Failing after 8s
ci / CI ubuntu-latest avx2 gcc debug (push) Failing after 10s
ci / CI ubuntu-latest avx2 gcc release (push) Failing after 8s
ci / CI ubuntu-latest baseline gcc debug (push) Failing after 8s
ci / CI ubuntu-latest baseline gcc release (push) Failing after 8s
ci / CI ubuntu-latest avx clang release (push) Failing after 9s
ci / CI ubuntu-latest avx2 clang debug (push) Failing after 8s
ci / CI ubuntu-latest avx2 clang release (push) Failing after 8s
ci / CI windows-latest avx msvc debug (push) Has been cancelled
ci / CI windows-latest avx msvc release (push) Has been cancelled
ci / CI windows-latest avx2 msvc debug (push) Has been cancelled
ci / CI windows-latest avx2 msvc release (push) Has been cancelled
ci / CI windows-latest baseline msvc debug (push) Has been cancelled
ci / CI windows-latest baseline msvc release (push) Has been cancelled
ci / CI macos-latest avx clang debug (push) Has been cancelled
ci / CI macos-latest avx clang release (push) Has been cancelled
ci / CI macos-latest baseline clang debug (push) Has been cancelled
ci / CI macos-latest baseline clang release (push) Has been cancelled

Pre-generated snappy-stubs-public.h / config.h baked HAVE_SYS_UIO_H=1 from
a Linux cmake host, breaking clang-cl cross-compiles to Windows. Gate the
sys/uio.h include on !_WIN32 so the same checked-in headers build on both
hosts. See xenia-rs docs/CROSS_BUILD_SETUP.md §7.3.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
MechaCat02
2026-06-05 07:22:08 +02:00
parent 6af9287fbd
commit 77c78fad94
2 changed files with 135 additions and 0 deletions

69
config.h Normal file
View File

@@ -0,0 +1,69 @@
#ifndef THIRD_PARTY_SNAPPY_OPENSOURCE_CMAKE_CONFIG_H_
#define THIRD_PARTY_SNAPPY_OPENSOURCE_CMAKE_CONFIG_H_
/* Define to 1 if the compiler supports __attribute__((always_inline)). */
#define HAVE_ATTRIBUTE_ALWAYS_INLINE 1
/* Define to 1 if the compiler supports __builtin_ctz and friends. */
#define HAVE_BUILTIN_CTZ 1
/* Define to 1 if the compiler supports __builtin_expect. */
#define HAVE_BUILTIN_EXPECT 1
/* Define to 1 if the compiler supports __builtin_prefetch. */
#define HAVE_BUILTIN_PREFETCH 1
/* Define to 1 if you have a definition for mmap() in <sys/mman.h>. */
#define HAVE_FUNC_MMAP 1
/* Define to 1 if you have a definition for sysconf() in <unistd.h>. */
#define HAVE_FUNC_SYSCONF 1
/* Define to 1 if you have the `lzo2' library (-llzo2). */
#define HAVE_LIBLZO2 0
/* Define to 1 if you have the `z' library (-lz). */
#define HAVE_LIBZ 1
/* Define to 1 if you have the `lz4' library (-llz4). */
#define HAVE_LIBLZ4 0
/* Define to 1 if you have the <sys/mman.h> header file. */
#define HAVE_SYS_MMAN_H 1
/* Define to 1 if you have the <sys/resource.h> header file. */
#define HAVE_SYS_RESOURCE_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/uio.h> header file. */
#define HAVE_SYS_UIO_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if you have the <windows.h> header file. */
#define HAVE_WINDOWS_H 0
/* Define to 1 if you target processors with SSSE3+ and have <tmmintrin.h>. */
#define SNAPPY_HAVE_SSSE3 1
/* Define to 1 if you target processors with SSE4.2 and have <crc32intrin.h>. */
#define SNAPPY_HAVE_X86_CRC32 1
/* Define to 1 if you target processors with BMI2+ and have <bmi2intrin.h>. */
#define SNAPPY_HAVE_BMI2 0
/* Define to 1 if you target processors with NEON and have <arm_neon.h>. */
#define SNAPPY_HAVE_NEON 0
/* Define to 1 if you have <arm_neon.h> and <arm_acle.h> and want to optimize
compression speed by using __crc32cw from <arm_acle.h>. */
#define SNAPPY_HAVE_NEON_CRC32 0
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
#define SNAPPY_IS_BIG_ENDIAN 0
#endif // THIRD_PARTY_SNAPPY_OPENSOURCE_CMAKE_CONFIG_H_

66
snappy-stubs-public.h Normal file
View File

@@ -0,0 +1,66 @@
// Copyright 2011 Google Inc. All Rights Reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Various type stubs for the open-source version of Snappy.
//
// This file cannot include config.h, as it is included from snappy.h,
// which is a public header. Instead, snappy-stubs-public.h is generated by
// from snappy-stubs-public.h.in at configure time.
#ifndef THIRD_PARTY_SNAPPY_OPENSOURCE_SNAPPY_STUBS_PUBLIC_H_
#define THIRD_PARTY_SNAPPY_OPENSOURCE_SNAPPY_STUBS_PUBLIC_H_
#include <cstddef>
// Original cmake configure baked HAVE_SYS_UIO_H=1 on the Linux host that
// pre-generated this header; gate it on _WIN32 so cross-compiles to Windows
// fall back to the iovec definition below.
#if !defined(_WIN32) // HAVE_SYS_UIO_H
#include <sys/uio.h>
#endif // HAVE_SYS_UIO_H
#define SNAPPY_MAJOR 1
#define SNAPPY_MINOR 2
#define SNAPPY_PATCHLEVEL 2
#define SNAPPY_VERSION \
((SNAPPY_MAJOR << 16) | (SNAPPY_MINOR << 8) | SNAPPY_PATCHLEVEL)
namespace snappy {
#if defined(_WIN32) // !HAVE_SYS_UIO_H
// Windows does not have an iovec type, yet the concept is universally useful.
// It is simple to define it ourselves, so we put it inside our own namespace.
struct iovec {
void* iov_base;
size_t iov_len;
};
#endif // !HAVE_SYS_UIO_H
} // namespace snappy
#endif // THIRD_PARTY_SNAPPY_OPENSOURCE_SNAPPY_STUBS_PUBLIC_H_