From daec7d9faeb81e8353cb8cd9c84e5eb64d348554 Mon Sep 17 00:00:00 2001 From: "R. Voggenauer" Date: Wed, 4 Aug 2021 22:56:01 +0200 Subject: [PATCH] ccache: update to 4.3 --- mingw-w64-ccache/01-directory-separator.patch | 101 ------------------ mingw-w64-ccache/010-ucrt.patch | 12 --- mingw-w64-ccache/PKGBUILD | 62 +++++++---- 3 files changed, 40 insertions(+), 135 deletions(-) delete mode 100644 mingw-w64-ccache/01-directory-separator.patch delete mode 100644 mingw-w64-ccache/010-ucrt.patch diff --git a/mingw-w64-ccache/01-directory-separator.patch b/mingw-w64-ccache/01-directory-separator.patch deleted file mode 100644 index ea4a6198cf..0000000000 --- a/mingw-w64-ccache/01-directory-separator.patch +++ /dev/null @@ -1,101 +0,0 @@ -diff -Naur ccache-3.4.2.orig/src/ccache.c ccache-3.4.2/src/ccache.c ---- ccache-3.4.2.orig/src/ccache.c 2018-08-16 17:13:29.359895100 -0400 -+++ ccache-3.4.2/src/ccache.c 2018-08-16 17:15:51.861247500 -0400 -@@ -855,6 +855,13 @@ - } - // p and q span the include file path. - char *inc_path = x_strndup(p, q - p); -+#ifdef _WIN32 -+ // gcc-E [file.c] -g adds CWD with double forward slashes -+ // like: -+ // # 1 "C:\\msys64\\home\\user\\test//" -+ // double forward slashes should be replaced with simple slashes -+ str_replace(inc_path, "\\\\", "\\"); -+#endif - if (!has_absolute_include_headers) { - has_absolute_include_headers = is_absolute_path(inc_path); - } -diff -Naur ccache-3.7.orig/src/ccache.h ccache-3.7/src/ccache.h ---- ccache-3.7.orig/src/ccache.h 2019-04-23 21:37:37.438109100 -0400 -+++ ccache-3.7/src/ccache.h 2019-04-23 21:38:16.908721300 -0400 -@@ -213,6 +213,7 @@ - char *read_text_file(const char *path, size_t size_hint); - char *subst_env_in_string(const char *str, char **errmsg); - void set_cloexec_flag(int fd); -+void str_replace(char *target, const char *needle, const char *replacement); - double time_seconds(void); - - // ---------------------------------------------------------------------------- -diff -Naur ccache-3.4.2.orig/src/util.c ccache-3.4.2/src/util.c ---- ccache-3.4.2.orig/src/util.c 2018-08-16 17:13:29.344270000 -0400 -+++ ccache-3.4.2/src/util.c 2018-08-16 17:19:32.688548500 -0400 -@@ -1097,6 +1097,13 @@ - } else { - snprintf(ret, maxlen, "%s", path); - p = ret; -+ -+ //replace forward slashes with backward slashes inplace -+ char *tmp; -+ for(tmp = p; *tmp; tmp++) { -+ if(*tmp == '/') -+ *tmp = '\\'; -+ } - } - #else - // Yes, there are such systems. This replacement relies on the fact that when -@@ -1286,11 +1293,17 @@ - const char *p1 = s1; - const char *p2 = s2; - -+#ifndef _WIN32 -+ char dirseparator = '/'; -+#else -+ char dirseparator = '\\'; -+#endif -+ - while (*p1 && *p2 && *p1 == *p2) { - ++p1; - ++p2; - } -- while ((*p1 && *p1 != '/') || (*p2 && *p2 != '/')) { -+ while ((*p1 && *p1 != dirseparator) || (*p2 && *p2 != dirseparator)) { - p1--; - p2--; - } -@@ -1688,3 +1701,36 @@ - (void)fd; - #endif - } -+ -+void str_replace(char *target, const char *needle, const char *replacement) -+{ -+ char buffer[1024] = { 0 }; -+ char *insert_point = &buffer[0]; -+ const char *tmp = target; -+ size_t needle_len = strlen(needle); -+ size_t repl_len = strlen(replacement); -+ -+ while (1) { -+ const char *p = strstr(tmp, needle); -+ -+ // walked past last occurrence of needle; copy remaining part -+ if (p == NULL) { -+ strcpy(insert_point, tmp); -+ break; -+ } -+ -+ // copy part before needle -+ memcpy(insert_point, tmp, p - tmp); -+ insert_point += p - tmp; -+ -+ // copy replacement string -+ memcpy(insert_point, replacement, repl_len); -+ insert_point += repl_len; -+ -+ // adjust pointers, move on -+ tmp = p + needle_len; -+ } -+ -+ // write altered string back to target -+ strcpy(target, buffer); -+} diff --git a/mingw-w64-ccache/010-ucrt.patch b/mingw-w64-ccache/010-ucrt.patch deleted file mode 100644 index 9d1d202a81..0000000000 --- a/mingw-w64-ccache/010-ucrt.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ccache-3.7.9/src/system.h.orig 2020-03-29 16:11:45.000000000 +0200 -+++ ccache-3.7.9/src/system.h 2021-05-09 20:11:02.291660400 +0200 -@@ -55,7 +55,9 @@ - extern int usleep(useconds_t); - #endif - -+#ifndef environ - extern char **environ; -+#endif - - #ifndef ESTALE - #define ESTALE -1 diff --git a/mingw-w64-ccache/PKGBUILD b/mingw-w64-ccache/PKGBUILD index bf22c4fdec..efb890f03d 100644 --- a/mingw-w64-ccache/PKGBUILD +++ b/mingw-w64-ccache/PKGBUILD @@ -4,47 +4,65 @@ _realname=ccache pkgbase=mingw-w64-${_realname} pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}" -pkgver=3.7.9 -pkgrel=2 +pkgver=4.3 +pkgrel=1 pkgdesc="Compiler cache that speeds up recompilation by caching previous compilations (mingw-w64)" arch=('any') mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32') url="https://ccache.dev/" license=("GPL3") replaces=("${MINGW_PACKAGE_PREFIX}-${_realname}-git") -makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config") +makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" + "${MINGW_PACKAGE_PREFIX}-cmake" + "${MINGW_PACKAGE_PREFIX}-asciidoc" + "${MINGW_PACKAGE_PREFIX}-pkg-config") depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs" - "${MINGW_PACKAGE_PREFIX}-zlib") + "${MINGW_PACKAGE_PREFIX}-zstd") options=('staticlibs' 'strip') -source=("https://github.com/ccache/ccache/releases/download/v${pkgver}/${_realname}-${pkgver}.tar.xz"{,.asc} - "01-directory-separator.patch" - "010-ucrt.patch") -sha256sums=('f893da7543bfb9172bd55e603fcbdfcd83e6def176a28689c13235695b4cf44b' - 'SKIP' - '888748bd62a23b909dda4df714ffb2bb09db3fa698d199754f372a01b5a55179' - '9a569472260674d61e983ae9c617eb5ec90e78b525741a40267b92de0f9f35ae') +source=("https://github.com/ccache/ccache/releases/download/v${pkgver}/${_realname}-${pkgver}.tar.xz"{,.asc}) +sha256sums=('504a0f2184465c306826f035b4bc00bae7500308d6af4abbfb50e33a694989b4' + 'SKIP') validpgpkeys=('5A939A71A46792CF57866A51996DDA075594ADB8') # Joel Rosdahl prepare() { cd "${srcdir}/${_realname}-${pkgver}" - patch -p1 -i "${srcdir}/01-directory-separator.patch" - patch -p1 -i "${srcdir}/010-ucrt.patch" + } build() { - [[ -d ${srcdir}/build-${MINGW_CHOST} ]] && rm -rf ${srcdir}/build-${MINGW_CHOST} - mkdir -p ${srcdir}/build-${MINGW_CHOST} && cd ${srcdir}/build-${MINGW_CHOST} - ../${_realname}-${pkgver}/configure \ - --prefix=${MINGW_PREFIX} \ - --build=${MINGW_CHOST} \ - --host=${MINGW_CHOST} \ - --target=${MINGW_CHOST} - make + mkdir -p "${srcdir}"/build-${MINGW_CHOST} && cd "${srcdir}"/build-${MINGW_CHOST} + + declare -a extra_config + if check_option "debug" "n"; then + extra_config+=("-DCMAKE_BUILD_TYPE=Release") + else + extra_config+=("-DCMAKE_BUILD_TYPE=Debug") + fi + + # Note: enabling static linking as default has brought a bug to light in mingw32 + # "-DSTATIC_LINK=OFF" can be removed as soon as the bug is fixed + MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \ + ${MINGW_PREFIX}/bin/cmake \ + -G"MSYS Makefiles" \ + -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \ + "${extra_config[@]}" \ + -DBUILD_{SHARED,STATIC}_LIBS=ON \ + -DSTATIC_LINK=OFF \ + ../${_realname}-${pkgver} + + ${MINGW_PREFIX}/bin/cmake --build . +} + +check() { + # run unittest to verify that the program is not broken + cd "${srcdir}"/build-${MINGW_CHOST} + ${MINGW_PREFIX}/bin/ctest -R unittest } package() { cd "${srcdir}/build-${MINGW_CHOST}" - make DESTDIR="${pkgdir}" install + + DESTDIR="${pkgdir}" ${MINGW_PREFIX}/bin/cmake --build . --target install # hack: use bash scripts as shortcuts since we cannot use symlinks install -d ${pkgdir}${MINGW_PREFIX}/lib/ccache/bin