wok-next diff ninja/stuff/patches/ninja-1.8.2-add_NINJAJOBS_var-1.patch @ rev 21727
created recipe for vbindiff
author | Hans-G?nter Theisgen |
---|---|
date | Sat Nov 21 14:32:44 2020 +0100 (2020-11-21) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/ninja/stuff/patches/ninja-1.8.2-add_NINJAJOBS_var-1.patch Sat Nov 21 14:32:44 2020 +0100 1.3 @@ -0,0 +1,65 @@ 1.4 +Submitted By: Bruce Dubbs <bdubbs at linuxfromscratch dot org> 1.5 +Date: 2017-10-14 1.6 +Initial Package Version: 1.9.2 1.7 +Upstream Status: Not submitted 1.8 +Origin: Self 1.9 +Description: Ninja normally uses all cores+2 when building 1.10 + a package. This patch allows useers to limit the 1.11 + cores used by setting an environment variable: 1.12 + NINJAJOBS to an integer. 1.13 + 1.14 + The patch also fixes a few warnings. 1.15 + 1.16 + 1.17 +diff -Naur ninja-1.8.2.orig/src/build_log.cc ninja-1.8.2/src/build_log.cc 1.18 +--- ninja-1.8.2.orig/src/build_log.cc 2017-09-10 20:20:10.000000000 -0500 1.19 ++++ ninja-1.8.2/src/build_log.cc 2017-10-12 14:38:00.988957823 -0500 1.20 +@@ -75,12 +75,12 @@ 1.21 + } 1.22 + switch (len & 7) 1.23 + { 1.24 +- case 7: h ^= uint64_t(data[6]) << 48; 1.25 +- case 6: h ^= uint64_t(data[5]) << 40; 1.26 +- case 5: h ^= uint64_t(data[4]) << 32; 1.27 +- case 4: h ^= uint64_t(data[3]) << 24; 1.28 +- case 3: h ^= uint64_t(data[2]) << 16; 1.29 +- case 2: h ^= uint64_t(data[1]) << 8; 1.30 ++ case 7: h ^= uint64_t(data[6]) << 48; __attribute__ ((fallthrough)); 1.31 ++ case 6: h ^= uint64_t(data[5]) << 40; __attribute__ ((fallthrough)); 1.32 ++ case 5: h ^= uint64_t(data[4]) << 32; __attribute__ ((fallthrough)); 1.33 ++ case 4: h ^= uint64_t(data[3]) << 24; __attribute__ ((fallthrough)); 1.34 ++ case 3: h ^= uint64_t(data[2]) << 16; __attribute__ ((fallthrough)); 1.35 ++ case 2: h ^= uint64_t(data[1]) << 8; __attribute__ ((fallthrough)); 1.36 + case 1: h ^= uint64_t(data[0]); 1.37 + h *= m; 1.38 + }; 1.39 +diff -Naur ninja-1.8.2.orig/src/hash_map.h ninja-1.8.2/src/hash_map.h 1.40 +--- ninja-1.8.2.orig/src/hash_map.h 2017-09-10 20:20:10.000000000 -0500 1.41 ++++ ninja-1.8.2/src/hash_map.h 2017-10-12 14:30:29.563974429 -0500 1.42 +@@ -39,8 +39,8 @@ 1.43 + len -= 4; 1.44 + } 1.45 + switch (len) { 1.46 +- case 3: h ^= data[2] << 16; 1.47 +- case 2: h ^= data[1] << 8; 1.48 ++ case 3: h ^= data[2] << 16; __attribute__ ((fallthrough)); 1.49 ++ case 2: h ^= data[1] << 8; __attribute__ ((fallthrough)); 1.50 + case 1: h ^= data[0]; 1.51 + h *= m; 1.52 + }; 1.53 +diff -Naur ninja-1.8.2.orig/src/ninja.cc ninja-1.8.2/src/ninja.cc 1.54 +--- ninja-1.8.2.orig/src/ninja.cc 2017-09-10 20:20:10.000000000 -0500 1.55 ++++ ninja-1.8.2/src/ninja.cc 2017-10-12 14:47:34.143936739 -0500 1.56 +@@ -221,6 +221,12 @@ 1.57 + 1.58 + /// Choose a default value for the -j (parallelism) flag. 1.59 + int GuessParallelism() { 1.60 ++ 1.61 ++ int j = 0; 1.62 ++ char* jobs = getenv( "NINJAJOBS" ); 1.63 ++ if ( jobs != NULL ) j = atoi( jobs ); 1.64 ++ if ( j > 0 ) return j; 1.65 ++ 1.66 + switch (int processors = GetProcessorCount()) { 1.67 + case 0: 1.68 + case 1: