From 02aadd8a4356dcab36a464885a5b97207a9a2319 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Sat, 4 May 2024 23:02:43 +0300 Subject: [PATCH] ninja: Fix slow cursor update regression Reported in https://github.com/ninja-build/ninja/issues/2435 PR waiting for approval: https://github.com/ninja-build/ninja/pull/2437. --- ...e-Do-not-set-locale-to-an-empty-stri.patch | 27 +++++++++++++++++++ mingw-w64-ninja/PKGBUILD | 11 +++++--- 2 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 mingw-w64-ninja/0001-RealDiskInterface-Do-not-set-locale-to-an-empty-stri.patch diff --git a/mingw-w64-ninja/0001-RealDiskInterface-Do-not-set-locale-to-an-empty-stri.patch b/mingw-w64-ninja/0001-RealDiskInterface-Do-not-set-locale-to-an-empty-stri.patch new file mode 100644 index 0000000000000..ef02127bc0ed1 --- /dev/null +++ b/mingw-w64-ninja/0001-RealDiskInterface-Do-not-set-locale-to-an-empty-stri.patch @@ -0,0 +1,27 @@ +From 3d1a5fa9ab4a38fd5c2004820907158e1e774858 Mon Sep 17 00:00:00 2001 +From: Orgad Shaneh +Date: Sat, 4 May 2024 22:49:06 +0300 +Subject: [PATCH] RealDiskInterface: Do *not* set locale to an empty string + +It causes the cursor handling to be extremely slow on MinGW. + +Added in #2321. + +Fixes #2435. +--- + src/disk_interface.cc | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/src/disk_interface.cc b/src/disk_interface.cc +index 5aba2179ef..1259c612f4 100644 +--- a/src/disk_interface.cc ++++ b/src/disk_interface.cc +@@ -161,8 +161,6 @@ bool DiskInterface::MakeDirs(const string& path) { + RealDiskInterface::RealDiskInterface() + #ifdef _WIN32 + : use_cache_(false), long_paths_enabled_(false) { +- setlocale(LC_ALL, ""); +- + // Probe ntdll.dll for RtlAreLongPathsEnabled, and call it if it exists. + HINSTANCE ntdll_lib = ::GetModuleHandleW(L"ntdll"); + if (ntdll_lib) { diff --git a/mingw-w64-ninja/PKGBUILD b/mingw-w64-ninja/PKGBUILD index fef882c6f90e1..92e8b1a6067d8 100644 --- a/mingw-w64-ninja/PKGBUILD +++ b/mingw-w64-ninja/PKGBUILD @@ -4,7 +4,7 @@ _realname=ninja pkgbase=mingw-w64-${_realname} pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}") pkgver=1.12.0 -pkgrel=1 +pkgrel=2 pkgdesc="Ninja is a small build system with a focus on speed (mingw-w64)" arch=('any') mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64') @@ -13,12 +13,15 @@ license=('spdx:Apache-2.0') depends=() options=('strip' 'staticlibs') makedepends=("re2c" "${MINGW_PACKAGE_PREFIX}-python" "${MINGW_PACKAGE_PREFIX}-cc") -source=("${_realname}-${pkgver}.tar.gz"::"https://github.com/ninja-build/ninja/archive/v${pkgver}.tar.gz") -sha256sums=('8b2c86cd483dc7fcb7975c5ec7329135d210099a89bc7db0590a07b0bbfe49a5') +source=("${_realname}-${pkgver}.tar.gz"::"https://github.com/ninja-build/ninja/archive/v${pkgver}.tar.gz" + "0001-RealDiskInterface-Do-not-set-locale-to-an-empty-stri.patch") +sha256sums=('8b2c86cd483dc7fcb7975c5ec7329135d210099a89bc7db0590a07b0bbfe49a5' + 'e0b99734711ea439d34ef40a3db06939609b2cfa55e345a83b932048f61c5329') prepare() { cd "${srcdir}"/ninja-${pkgver} - + # https://github.com/ninja-build/ninja/pull/2437 + patch -p1 -i "${srcdir}"/0001-RealDiskInterface-Do-not-set-locale-to-an-empty-stri.patch } build() {