Merge pull request #4664 from lazka/ccache-4.10

ccache: Update to 4.10; add new deps: fmt + doctest
This commit is contained in:
Christoph Reiter 2024-06-06 08:56:23 +02:00 committed by GitHub
commit 45c0396527
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 78 additions and 145 deletions

View File

@ -1,11 +0,0 @@
--- ccache-4.9/src/third_party/blake3/CMakeLists.txt.orig 2024-01-07 19:44:27.592646500 +0100
+++ ccache-4.9/src/third_party/blake3/CMakeLists.txt 2024-01-07 19:44:37.726993400 +0100
@@ -19,7 +19,7 @@
if(MSVC)
set(suffix "_x86-64_windows_msvc.asm")
- elseif(WIN32)
+ elseif(WIN32 OR CYGWIN)
set(suffix "_x86-64_windows_gnu.S")
else()
set(suffix "_x86-64_unix.S")

View File

@ -1,120 +0,0 @@
From 3b61a866621036b669a0a9e891702e1b0fd17bb0 Mon Sep 17 00:00:00 2001
From: Kreijstal <rainb@tfwno.gf>
Date: Sun, 17 Mar 2024 23:17:09 +0100
Subject: [PATCH] Stop msys2 from hanging forever, Problem: MSYS2 symlinks
error if location does not exist, otherwise they work as symlinks just
'fine'.
---
src/ccache/util/LockFile.cpp | 34 +++++++++++++++++++++++++++++++---
unittest/test_Util.cpp | 5 ++---
2 files changed, 33 insertions(+), 6 deletions(-)
diff --git a/src/ccache/util/LockFile.cpp b/src/ccache/util/LockFile.cpp
index 43b62cd1..d2f2a48b 100644
--- a/src/util/LockFile.cpp
+++ b/src/util/LockFile.cpp
@@ -43,7 +43,9 @@ const uint32_t k_max_sleep_time_ms = 50;
#ifndef _WIN32
const util::Duration k_staleness_limit(2);
#endif
-
+#ifdef __CYGWIN__
+# include <fcntl.h>
+#endif
namespace fs = util::filesystem;
using pstr = util::PathString;
@@ -236,16 +238,31 @@ LockFile::do_acquire(const bool blocking)
const auto now = TimePoint::now();
const auto my_content =
FMT("{}-{}.{}", content_prefix, now.sec(), now.nsec_decimal_part());
-
+# ifdef __CYGWIN__
+ // Cygwin-specific file-based lock
+ int fd = open(m_lock_file.c_str(), O_WRONLY | O_CREAT | O_EXCL, 0666);
+ if (fd != -1) {
+ // Lock file successfully created, write the content and close the file
+ write(fd, my_content.c_str(), my_content.size());
+ close(fd); // Lock acquired
+ return true;
+ }
+# else
if (fs::create_symlink(my_content, m_lock_file)) {
// We got the lock.
return true;
}
+# endif
int saved_errno = errno;
if (saved_errno == ENOENT) {
// Directory doesn't exist?
+# ifdef __CYGWIN__
+ if (!fs::exists(m_lock_file.parent_path())
+ && fs::create_directories(m_lock_file.parent_path())) {
+# else
if (fs::create_directories(m_lock_file.parent_path())) {
+# endif
// OK. Retry.
continue;
}
@@ -262,7 +279,17 @@ LockFile::do_acquire(const bool blocking)
// Directory doesn't exist or isn't writable?
return false;
}
-
+# ifdef __CYGWIN__
+ // Cygwin-specific code to read the content of the lock file
+ std::ifstream lock_file(m_lock_file);
+ if (!lock_file.is_open()) {
+ // Handle error: the lock file couldn't be opened
+ return false;
+ }
+ std::string content;
+ lock_file >> content;
+ lock_file.close();
+# else
auto content_path = fs::read_symlink(m_lock_file);
if (!content_path) {
if (content_path.error() == std::errc::no_such_file_or_directory) {
@@ -278,6 +305,7 @@ LockFile::do_acquire(const bool blocking)
}
auto content = content_path->string();
+# endif
if (content == my_content) {
// Lost NFS reply?
LOG("Symlinking {} failed but we got the lock anyway", m_lock_file);
diff --git a/unittest/test_Util.cpp b/unittest/test_Util.cpp
index e670464b..6120a82a 100644
--- a/unittest/test_Util.cpp
+++ b/unittest/test_Util.cpp
@@ -102,7 +102,7 @@ TEST_CASE("Util::make_relative_path")
const std::string cwd = util::actual_cwd();
const std::string actual_cwd = FMT("{}/d", cwd);
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__CYGWIN__)
const std::string apparent_cwd = actual_cwd;
#else
const std::string apparent_cwd = FMT("{}/s", cwd);
@@ -114,7 +114,6 @@ TEST_CASE("Util::make_relative_path")
#endif
REQUIRE(fs::current_path("d"));
util::setenv("PWD", apparent_cwd);
-
SUBCASE("No base directory")
{
CHECK(make_relative_path("", "/a", "/a", "/a/x") == "/a/x");
@@ -198,7 +197,7 @@ TEST_CASE("Util::normalize_abstract_absolute_path")
TEST_CASE("Util::normalize_concrete_absolute_path")
{
-#ifndef _WIN32
+#if !defined(_WIN32) && !defined(__CYGWIN__)
TestContext test_context;
util::write_file("file", "");
--
2.44.0

View File

@ -2,8 +2,8 @@
# Contributor: Renato Silva <br.renatosilva@gmail.com>
pkgname=ccache
pkgver=4.9.1
pkgrel=2
pkgver=4.10
pkgrel=1
pkgdesc="A compiler cache (mingw-w64)"
arch=('i686' 'x86_64')
url="https://ccache.samba.org/"
@ -15,25 +15,18 @@ makedepends=("cmake"
"pkgconf"
"zlib-devel"
"libzstd-devel"
"libxxhash-devel"
'gcc')
depends=("gcc-libs" "zlib" "libzstd")
depends=("gcc-libs" "zlib" "libzstd" "fmt" "doctest" "libxxhash")
options=('staticlibs' 'strip')
install="${pkgname}.install"
source=(https://github.com/ccache/ccache/releases/download/v${pkgver}/ccache-${pkgver}.tar.xz{,.asc}
"0001-fix-blake3-segfault.patch"
"0002-Stop-msys2-from-hanging-forever-Problem-MSYS2-symlin.patch")
source=(https://github.com/ccache/ccache/releases/download/v${pkgver}/ccache-${pkgver}.tar.xz{,.asc})
validpgpkeys=("5A939A71A46792CF57866A51996DDA075594ADB8") #Joel Rosdahl <joel@rosdahl.net>
sha256sums=('4c03bc840699127d16c3f0e6112e3f40ce6a230d5873daa78c60a59c7ef59d25'
'SKIP'
'0d9e9f9dd4ff87a010e017091ab503945c40b46766aaee520bca09633ab00927'
'05723222a62159fdeae0a720bbccab1a873ee931dc6a1c7327ec1317f041bba3')
sha256sums=('83630b5e922b998ab2538823e0cad962c0f956fad1fcf443dd5288269a069660'
'SKIP')
prepare() {
cd "${pkgname}-${pkgver}"
patch -Np1 -i "${srcdir}/0001-fix-blake3-segfault.patch"
# https://github.com/ccache/ccache/pull/1416
patch -Np1 -i "${srcdir}/0002-Stop-msys2-from-hanging-forever-Problem-MSYS2-symlin.patch"
}
build() {
@ -45,6 +38,7 @@ build() {
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release \
-DREDIS_STORAGE_BACKEND=OFF \
-DDEPS=LOCAL \
../${pkgname}-${pkgver}
cmake --build .

33
doctest/PKGBUILD Normal file
View File

@ -0,0 +1,33 @@
# Maintainer: Christoph Reiter <reiter.christoph@gmail.com>
pkgname=doctest
pkgver=2.4.9
pkgrel=1
pkgdesc='The lightest feature rich C++ single header testing framework'
arch=('any')
url='https://github.com/onqtam/doctest'
license=('spdx:MIT')
makedepends=('cmake' 'gcc' 'make')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/${pkgname}/${pkgname}/archive/refs/tags/v${pkgver}.tar.gz")
sha256sums=('19b2df757f2f3703a5e63cee553d85596875f06d91a3333acd80a969ef210856')
prepare() {
cd "${srcdir}/${pkgname}-${pkgver}"
mkdir build
}
build() {
cd "${srcdir}/${pkgname}-${pkgver}/build"
cmake -DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release \
-DDOCTEST_WITH_TESTS=off \
-G"Unix Makefiles" \
../
make
}
package() {
cd "${srcdir}/${pkgname}-${pkgver}/build"
make DESTDIR="${pkgdir}" install
install -Dm 0644 ../LICENSE.txt "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

37
fmt/PKGBUILD Normal file
View File

@ -0,0 +1,37 @@
# Maintainer: Christoph Reiter <reiter.christoph@gmail.com>
pkgname=fmt
pkgver=10.2.0
pkgrel=1
pkgdesc='Open-source formatting library for C++'
arch=(x86_64 i686)
url=https://fmt.dev
msys2_repository_url="https://github.com/fmtlib/fmt"
license=(spdx:MIT)
depends=(gcc-libs)
makedepends=(
cmake
ninja
gcc
)
source=("https://github.com/fmtlib/fmt/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz")
sha256sums=('3ca91733a7313a8ad41c0885929415f8ec0a2a31d4dc7e27e9331412f4ca26ac')
build() {
cmake -S "${pkgname}-${pkgver}" -B build \
-GNinja \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON
cmake --build build
}
check() {
cmake --build build --target test
}
package() {
DESTDIR="${pkgdir}" cmake --build build --target install
install -Dm 644 "${pkgname}-${pkgver}"/LICENSE -t "${pkgdir}"/usr/share/licenses/fmt/
}