update to ccache-4.2

This commit is contained in:
sthen 2021-02-02 14:44:40 +00:00
parent 38d62a6d6e
commit 4f56348aa7
8 changed files with 21 additions and 215 deletions

View File

@ -1,10 +1,9 @@
# $OpenBSD: Makefile,v 1.68 2021/02/01 10:11:27 sthen Exp $
# $OpenBSD: Makefile,v 1.69 2021/02/02 14:44:40 sthen Exp $
COMMENT = compiler cache
V = 4.1
V = 4.2
DISTNAME = ccache-$V
REVISION = 0
CATEGORIES = devel
@ -22,9 +21,6 @@ CONFIGURE_ARGS = -DCMAKE_INSTALL_SYSCONFDIR=${SYSCONFDIR}
DEBUG_PACKAGES = ${BUILD_PACKAGES}
CFLAGS += -D_BSD_SOURCE -D_XOPEN_SOURCE=700
CXXFLAGS += -D_BSD_SOURCE -D_XOPEN_SOURCE=700
COMPILER = base-clang ports-gcc
BUILD_DEPENDS = textproc/asciidoc

View File

@ -1,2 +1,2 @@
SHA256 (ccache-4.1.tar.gz) = ze77gns+7ztCtUVIWBI4gaSpCrvUbMcs+MILO9A53rc=
SIZE (ccache-4.1.tar.gz) = 525898
SHA256 (ccache-4.2.tar.gz) = 2/E5/zIDG1TLR/LXmDJp8yjfFLWkJ4gvifdyHlxBG34=
SIZE (ccache-4.2.tar.gz) = 579666

View File

@ -1,23 +0,0 @@
$OpenBSD: patch-CMakeLists_txt,v 1.3 2021/01/25 21:07:50 sthen Exp $
From 6e95418f15722647f960d8f773edbbecbb46a73c Mon Sep 17 00:00:00 2001
From: Stuart Henderson <sthen@users.noreply.github.com>
Date: Mon, 25 Jan 2021 18:41:54 +0000
Subject: [PATCH] Disable inode cache on OSes without
pthread_mutexattr_setpshared() (#791)
The inode cache requires pthread_mutexattr_setpshared() and build fails on OSes
with sys/mman.h that do not have this function.
Index: CMakeLists.txt
--- CMakeLists.txt.orig
+++ CMakeLists.txt
@@ -71,7 +71,7 @@ include(GNUInstallDirs)
include(GenerateConfigurationFile)
include(GenerateVersionFile)
-if(HAVE_SYS_MMAN_H)
+if(HAVE_SYS_MMAN_H AND HAVE_PTHREAD_MUTEXATTR_SETPSHARED)
set(INODE_CACHE_SUPPORTED 1)
endif()

View File

@ -1,48 +0,0 @@
$OpenBSD: patch-cmake_GenerateConfigurationFile_cmake,v 1.4 2021/02/01 10:11:27 sthen Exp $
From 6e95418f15722647f960d8f773edbbecbb46a73c Mon Sep 17 00:00:00 2001
From: Stuart Henderson <sthen@users.noreply.github.com>
Date: Mon, 25 Jan 2021 18:41:54 +0000
Subject: [PATCH] Disable inode cache on OSes without
pthread_mutexattr_setpshared() (#791)
From b438f50388dd00285083260f60450e6237b7d58f Mon Sep 17 00:00:00 2001
From: Erik Flodin <erik@ejohansson.se>
Date: Mon, 7 Dec 2020 19:20:31 +0100
Subject: [PATCH] Improve SIMD detection (#735)
Index: cmake/GenerateConfigurationFile.cmake
--- cmake/GenerateConfigurationFile.cmake.orig
+++ cmake/GenerateConfigurationFile.cmake
@@ -68,18 +68,19 @@ check_struct_has_member("struct stat" st_mtim sys/stat
check_struct_has_member("struct statfs" f_fstypename sys/mount.h
HAVE_STRUCT_STATFS_F_FSTYPENAME)
-include(CheckCXXCompilerFlag)
-
-# Old GCC versions don't have the required header support.
-# Old Apple Clang versions seem to support -mavx2 but not the target
-# attribute that's used to enable AVX2 for a certain function.
-if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
- OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0))
- message(STATUS "Detected unsupported compiler for HAVE_AVX2 - disabled")
- set(HAVE_AVX2 FALSE)
-else()
- check_cxx_compiler_flag(-mavx2 HAVE_AVX2)
-endif()
+include(CheckCXXSourceCompiles)
+check_cxx_source_compiles(
+ [=[
+ #include <immintrin.h>
+ void func() __attribute__((target("avx2")));
+ void func() { _mm256_abs_epi8(_mm256_set1_epi32(42)); }
+ int main()
+ {
+ func();
+ return 0;
+ }
+ ]=]
+ HAVE_AVX2)
list(APPEND CMAKE_REQUIRED_LIBRARIES ws2_32)
list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES ws2_32)

View File

@ -1,37 +1,25 @@
$OpenBSD: patch-cmake_config_h_in,v 1.3 2021/01/25 21:07:50 sthen Exp $
#1: Fix up ctypes.
#2:
From 6e95418f15722647f960d8f773edbbecbb46a73c Mon Sep 17 00:00:00 2001
From: Stuart Henderson <sthen@users.noreply.github.com>
Date: Mon, 25 Jan 2021 18:41:54 +0000
Subject: [PATCH] Disable inode cache on OSes without
pthread_mutexattr_setpshared() (#791)
The inode cache requires pthread_mutexattr_setpshared() and build fails on OSes
with sys/mman.h that do not have this function.
$OpenBSD: patch-cmake_config_h_in,v 1.4 2021/02/02 14:44:40 sthen Exp $
Index: cmake/config.h.in
--- cmake/config.h.in.orig
+++ cmake/config.h.in
@@ -32,7 +32,7 @@
@@ -12,6 +12,10 @@
#define _GNU_SOURCE 1
// The later definition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables certain
+// features on OpenBSD, so we need _BSD_SOURCE to re-enable them.
+#define _BSD_SOURCE 1
+
+// The later definition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables certain
// features on NetBSD, so we need _NETBSD_SOURCE to re-enable them.
#define _NETBSD_SOURCE 1
@@ -32,7 +36,7 @@
#if defined(__SunOS_5_8) || defined(__SunOS_5_9) || defined(__SunOS_5_10)
# define _XOPEN_SOURCE 500
-#elif !defined(__SunOS_5_11) && !defined(__APPLE__)
+#elif !defined(__SunOS_5_11) && !defined(__APPLE__) && !defined(__OpenBSD__)
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__OpenBSD__)
# define _XOPEN_SOURCE 700
#elif !defined(__SunOS_5_11) && !defined(__APPLE__)
# define _XOPEN_SOURCE
#endif
@@ -88,6 +88,9 @@
// Define if you have the "posix_fallocate.
#cmakedefine HAVE_POSIX_FALLOCATE
+
+// Define if you have the "pthread_mutexattr_setpshared" function.
+#cmakedefine HAVE_PTHREAD_MUTEXATTR_SETPSHARED
// Define if you have the <pwd.h> header file.
#cmakedefine HAVE_PWD_H

View File

@ -1,16 +0,0 @@
$OpenBSD: patch-src_Logging_cpp,v 1.1 2021/01/24 15:25:01 sthen Exp $
OpenBSD has 64-bit time_t on all archs.
Index: src/Logging.cpp
--- src/Logging.cpp.orig
+++ src/Logging.cpp
@@ -88,7 +88,7 @@ do_log(string_view message, bool bulk)
if (tm) {
strftime(timestamp, sizeof(timestamp), "%Y-%m-%dT%H:%M:%S", &*tm);
} else {
- snprintf(timestamp, sizeof(timestamp), "%lu", tv.tv_sec);
+ snprintf(timestamp, sizeof(timestamp), "%lld", (long long)tv.tv_sec);
}
snprintf(prefix,
sizeof(prefix),

View File

@ -1,23 +0,0 @@
$OpenBSD: patch-src_system_hpp,v 1.3 2021/01/25 21:07:50 sthen Exp $
From 6e95418f15722647f960d8f773edbbecbb46a73c Mon Sep 17 00:00:00 2001
From: Stuart Henderson <sthen@users.noreply.github.com>
Date: Mon, 25 Jan 2021 18:41:54 +0000
Subject: [PATCH] Disable inode cache on OSes without
pthread_mutexattr_setpshared() (#791)
The inode cache requires pthread_mutexattr_setpshared() and build fails on OSes
with sys/mman.h that do not have this function.
Index: src/system.hpp
--- src/system.hpp.orig
+++ src/system.hpp
@@ -172,7 +172,7 @@ DLLIMPORT extern char** environ;
# define O_BINARY 0
#endif
-#ifdef HAVE_SYS_MMAN_H
+#if defined(HAVE_SYS_MMAN_H) && defined(HAVE_PTHREAD_MUTEXATTR_SETPSHARED)
# define INODE_CACHE_SUPPORTED
#endif

View File

@ -1,68 +0,0 @@
$OpenBSD: patch-src_third_party_blake3_CMakeLists_txt,v 1.1 2021/02/01 10:11:27 sthen Exp $
From b438f50388dd00285083260f60450e6237b7d58f Mon Sep 17 00:00:00 2001
From: Erik Flodin <erik@ejohansson.se>
Date: Mon, 7 Dec 2020 19:20:31 +0100
Subject: [PATCH] Improve SIMD detection (#735)
Index: src/third_party/blake3/CMakeLists.txt
--- src/third_party/blake3/CMakeLists.txt.orig
+++ src/third_party/blake3/CMakeLists.txt
@@ -13,9 +13,9 @@ else()
endif()
include(CheckAsmCompilerFlag)
-include(CheckCCompilerFlag)
+include(CheckCSourceCompiles)
-function(add_source_if_enabled feature compile_flags)
+function(add_source_if_enabled feature compile_flags intrinsic)
string(TOUPPER "have_${blake_source_type}_${feature}" have_feature)
# AVX512 support fails to compile with old Apple Clang versions even though
@@ -28,7 +28,14 @@ function(add_source_if_enabled feature compile_flags)
elseif(${blake_source_type} STREQUAL "asm")
check_asm_compiler_flag(${compile_flags} ${have_feature})
else()
- check_c_compiler_flag(${compile_flags} ${have_feature})
+ set(CMAKE_REQUIRED_FLAGS ${compile_flags})
+ check_c_source_compiles(
+ [=[
+ #include <immintrin.h>
+ int main() { ${intrinsic}; return 0; }
+ ]=]
+ ${have_feature})
+ unset(CMAKE_REQUIRED_FLAGS)
endif()
if(${have_feature})
@@ -42,10 +49,23 @@ function(add_source_if_enabled feature compile_flags)
endif()
endfunction()
-add_source_if_enabled(sse2 "-msse2")
-add_source_if_enabled(sse41 "-msse4.1")
-add_source_if_enabled(avx2 "-mavx2")
-add_source_if_enabled(avx512 "-mavx512f -mavx512vl")
+# https://software.intel.com/sites/landingpage/IntrinsicsGuide/
+add_source_if_enabled(sse2 "-msse2" "_mm_set1_epi32(42)")
+add_source_if_enabled(sse41 "-msse4.1" "_mm_test_all_ones(_mm_set1_epi32(42))")
+add_source_if_enabled(avx2 "-mavx2" "_mm256_abs_epi8(_mm256_set1_epi32(42))")
+add_source_if_enabled(avx512 "-mavx512f -mavx512vl" "_mm256_abs_epi64(_mm256_set1_epi32(42))")
-# TODO: how to detect ARM NEON support?
-# If NEON, define BLAKE3_USE_NEON and build blake3_neon.c
+# Neon is always available on AArch64
+if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ # https://developer.arm.com/architectures/instruction-sets/simd-isas/neon/intrinsics
+ check_c_source_compiles(
+ [=[
+ #include <arm_neon.h>
+ int main() { vdupq_n_s32(42); return 0; }
+ ]=]
+ HAVE_NEON)
+ if(HAVE_NEON)
+ target_sources(blake3 PRIVATE blake3_neon.c)
+ target_compile_definitions(blake3 PRIVATE BLAKE3_USE_NEON)
+ endif()
+endif()