ghost-node/scripts/patches/patch-3.sh
Uncle Stretch 6263c620ab
fix starter and patch scripts
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
2026-02-07 15:35:23 +03:00

20 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
LATEST_GCC_WORKING_VERSION=14
PATH_TO_BUILD_CONFIG=~/.local/share/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/librocksdb-sys-0.11.0+8.1.1/build.rs
GCC_MAJOR=$(gcc -dumpversion | cut -d. -f1)
SKIPPED_PATCH_OK="[+] patch-3 not needed: gcc version is good to compile without patch"
[[ "$GCC_MAJOR" -le "$LATEST_GCC_WORKING_VERSION" ]] && { echo $SKIPPED_PATCH_OK; exit 0; }
SKIPPED_PATCH_OK="[+] patch-3 already applied: no need to change build config of librocksdb"
grep -q "config.flag(\"-include\").flag(\"cstdint\");" "$PATH_TO_BUILD_CONFIG" && { echo $SKIPPED_PATCH_OK; exit 0; }
PATCH_MESSAGE="include cstdint for build config of librocksdb"
[[ -z "$1" ]] && { echo "[!] patch-3 could be applied: $PATCH_MESSAGE"; exit 2; }
sed -i "/$(printf '%s' "config.compile(\"librocksdb.a\");" | sed 's/[].[*^$\/]/\\&/g')/i \
if !target.contains(\"windows\") {\n config.flag(\"-include\").flag(\"cstdint\");\n }" "$PATH_TO_BUILD_CONFIG"
echo "[+] patch-3 will be applied: $PATCH_MESSAGE"
exit 0