From 74a5ce327ebcfbab7516389a743931349cb0fd5d Mon Sep 17 00:00:00 2001 From: a-bad-dev <244852891+a-bad-dev@users.noreply.github.com> Date: Sun, 24 May 2026 00:39:25 -0300 Subject: [PATCH] seperate patches from scripts and fix a few things --- build-aarch64.sh | 25 +++++-------------------- build-win64.sh | 24 +++++------------------- build-x86_64.sh | 25 +++++-------------------- patches/patch-1.patch | 4 ++++ patches/patch-2.patch | 4 ++++ 5 files changed, 23 insertions(+), 59 deletions(-) create mode 100644 patches/patch-1.patch create mode 100644 patches/patch-2.patch diff --git a/build-aarch64.sh b/build-aarch64.sh index 9a1f0d3..e5aa865 100755 --- a/build-aarch64.sh +++ b/build-aarch64.sh @@ -11,6 +11,8 @@ RED="\x1b[31m" GREEN="\x1b[32m" RESET="\x1b[0m" +SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" + # make sure we are root if [ "$(id -u)" != "0" ]; then echo -e "${BOLD}${RED}This script must be run as root!${RESET}" @@ -62,26 +64,9 @@ unzip sdl2.zip mv SDL2-${SDL_VERSION} sdl2 rm sdl2.zip -# create patch files -cat > patch-1.patch <<'EOF' -3753c3753 -< m_repeat_place_time = g_settings->getFloat("repeat_place_time", 0.16f, 2.0f); ---- -> m_repeat_place_time = g_settings->getFloat("repeat_place_time", 0.001f, 2.0f); -EOF - -cat > patch-2.patch <<'EOF' -151c151 -< repeat_place_time (Place repetition interval) float 0.25 0.16 2.0 ---- -> repeat_place_time (Place repetition interval) float 0.25 0.001 2.0 -EOF - -# apply patches -patch luanti/src/client/game.cpp patch-1.patch -patch luanti/builtin/settingtypes.txt patch-2.patch - -rm patch-[1-2].patch +# apply external patch files +patch luanti/src/client/game.cpp "$SCRIPT_DIR"/patches/patch-1.patch +patch luanti/builtin/settingtypes.txt "$SCRIPT_DIR"/patches/patch-2.patch # compile luajit echo -e "${BOLD}Compiling LuaJIT...${RESET}" diff --git a/build-win64.sh b/build-win64.sh index 47bff56..7e80d4f 100755 --- a/build-win64.sh +++ b/build-win64.sh @@ -7,6 +7,8 @@ BOLD="\x1b[1m" GREEN="\x1b[32m" RESET="\x1b[0m" +SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" + # system update (skip this most of the time) echo -e "${BOLD}Updating system...${RESET}" pacman -Syu @@ -24,25 +26,9 @@ tar -xf luanti.tar cd luanti-${VERSION}/ -# create and apply patches -cat > patch-1.patch <<'EOF' -3753c3753 -< m_repeat_place_time = g_settings->getFloat("repeat_place_time", 0.16f, 2.0f); ---- -> m_repeat_place_time = g_settings->getFloat("repeat_place_time", 0.001f, 2.0f); -EOF - -cat > patch-2.patch <<'EOF' -151c151 -< repeat_place_time (Place repetition interval) float 0.25 0.16 2.0 ---- -> repeat_place_time (Place repetition interval) float 0.25 0.001 2.0 -EOF - -patch src/client/game.cpp patch-1.patch -patch builtin/settingtypes.txt patch-2.patch - -rm patch-[1-2].patch +# apply external patch files +patch src/client/game.cpp "${SCRIPT_DIR}/patches/patch-1.patch" +patch builtin/settingtypes.txt "${SCRIPT_DIR}/patches/patch-2.patch" # configure echo -e "${BOLD}Preparing to compile...${RESET}" diff --git a/build-x86_64.sh b/build-x86_64.sh index 0b704b6..5111e3f 100755 --- a/build-x86_64.sh +++ b/build-x86_64.sh @@ -11,6 +11,8 @@ RED="\x1b[31m" GREEN="\x1b[32m" RESET="\x1b[0m" +SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" + # make sure we are root if [ "$(id -u)" != "0" ]; then echo -e "${BOLD}${RED}This script must be run as root!${RESET}" @@ -62,26 +64,9 @@ unzip sdl2.zip mv SDL2-${SDL_VERSION} sdl2 rm sdl2.zip -# create patch files -cat > patch-1.patch <<'EOF' -3753c3753 -< m_repeat_place_time = g_settings->getFloat("repeat_place_time", 0.16f, 2.0f); ---- -> m_repeat_place_time = g_settings->getFloat("repeat_place_time", 0.001f, 2.0f); -EOF - -cat > patch-2.patch <<'EOF' -151c151 -< repeat_place_time (Place repetition interval) float 0.25 0.16 2.0 ---- -> repeat_place_time (Place repetition interval) float 0.25 0.001 2.0 -EOF - -# apply patches -patch luanti/src/client/game.cpp patch-1.patch -patch luanti/builtin/settingtypes.txt patch-2.patch - -rm patch-[1-2].patch +# apply external patch files +patch luanti/src/client/game.cpp "${SCRIPT_DIR}/patches/patch-1.patch" +patch luanti/builtin/settingtypes.txt "${SCRIPT_DIR}/patches/patch-2.patch" # compile luajit echo -e "${BOLD}Compiling LuaJIT...${RESET}" diff --git a/patches/patch-1.patch b/patches/patch-1.patch new file mode 100644 index 0000000..59ca4db --- /dev/null +++ b/patches/patch-1.patch @@ -0,0 +1,4 @@ +3753c3753 +< m_repeat_place_time = g_settings->getFloat("repeat_place_time", 0.16f, 2.0f); +--- +> m_repeat_place_time = g_settings->getFloat("repeat_place_time", 0.001f, 2.0f); diff --git a/patches/patch-2.patch b/patches/patch-2.patch new file mode 100644 index 0000000..673bc5a --- /dev/null +++ b/patches/patch-2.patch @@ -0,0 +1,4 @@ +151c151 +< repeat_place_time (Place repetition interval) float 0.25 0.16 2.0 +--- +> repeat_place_time (Place repetition interval) float 0.25 0.001 2.0