From d50bbfde2f13f9b7ae2849e66c7f8e5a61756ac7 Mon Sep 17 00:00:00 2001 From: Curculigo Date: Sat, 6 Dec 2025 08:47:15 +0700 Subject: [PATCH] Update patch_commit_number.sh (#148) * Update patch_commit_number.sh FreeBSD does not include Perl in the base system. Since the workflow installs gsed, why not use it instead? To use Perl, you would need to install perl5 anyway. * Update patch_commit_number.sh * Update patch_commit_number.sh * OpenBSD * OpenBSD * OpenBSD * Update build.app.sh * Update build.app.sh * Update build.app.sh * Delete projects/openbsd directory * Update build.app.sh * Update build.app.sh --- projects/freebsd/ecode/build.app.sh | 26 +++++++++++++++++++++++-- projects/scripts/patch_commit_number.sh | 12 +++++++++--- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/projects/freebsd/ecode/build.app.sh b/projects/freebsd/ecode/build.app.sh index dafaa91ac..ef7034492 100755 --- a/projects/freebsd/ecode/build.app.sh +++ b/projects/freebsd/ecode/build.app.sh @@ -31,9 +31,31 @@ while [ $# -gt 0 ]; do shift done -premake5 --with-text-shaper gmake || exit +CONFIG_NAME= +if command -v premake5 &> /dev/null +then + premake5 --with-text-shaper gmake || exit + CONFIG_NAME=release_x86_64 +elif command -v premake4 &> /dev/null +then + premake4 --with-text-shaper gmake || exit + CONFIG_NAME=release +else + echo "Neither premake5 nor premake4 is available. Please install one." + exit 1 +fi + cd make/bsd || exit -gmake -j"$(nproc)" config=release_x86_64 ecode || exit + +if command -v nproc &> /dev/null # nproc is only available on FreeBSD 13.2 and later +then + parallel_tasks=$(nproc) +else + parallel_tasks=$(getconf NPROCESSORS_ONLN 2>/dev/null || sysctl -n hw.ncpu) + # the former is the number of online cpus, the later is the total number of cpus +fi +gmake -j"${parallel_tasks}" config="${CONFIG_NAME}" ecode || exit + cd "$DIRPATH" || exit rm -rf ./ecode.app mkdir -p ecode.app/assets diff --git a/projects/scripts/patch_commit_number.sh b/projects/scripts/patch_commit_number.sh index 395e18cbb..2079c0987 100644 --- a/projects/scripts/patch_commit_number.sh +++ b/projects/scripts/patch_commit_number.sh @@ -6,8 +6,14 @@ COMMIT_NUMBER=$(git rev-list "$(git tag --sort=-creatordate | grep ecode | sed - FILE_PATH="../../src/tools/ecode/version.hpp" -if [[ "$OSTYPE" == "darwin"* || "$OSTYPE" == "freebsd"* ]]; then +case "$OSTYPE" in + darwin*) perl -i -pe "s/#define ECODE_COMMIT_NUMBER [0-9]+/#define ECODE_COMMIT_NUMBER $COMMIT_NUMBER/" "$FILE_PATH" -else + ;; + freebsd*|openbsd*|netbsd*|dragonfly*|solaris*) + gsed -i "s/#define ECODE_COMMIT_NUMBER [0-9]\+/#define ECODE_COMMIT_NUMBER $COMMIT_NUMBER/" "$FILE_PATH" + ;; + *) sed -i "s/#define ECODE_COMMIT_NUMBER [0-9]\+/#define ECODE_COMMIT_NUMBER $COMMIT_NUMBER/" "$FILE_PATH" -fi + ;; +esac