Allow patching glibc to an older version during ecode build, enabled this feature in linux nightly.

This commit is contained in:
Martín Lucas Golini
2025-04-25 00:27:40 -03:00
parent 799d9f9371
commit 53609f3870
3 changed files with 82 additions and 36 deletions

View File

@@ -7,32 +7,36 @@ DEBUG_SYMBOLS=
VERSION=
ARCH=$(arch)
for i in "$@"; do
case $i in
--with-debug-symbols)
DEBUG_SYMBOLS="--with-debug-symbols"
shift
;;
--version)
if [[ -n $2 ]]; then VERSION="$2"; fi
shift
shift
;;
--arch)
if [[ -n $2 ]]; then ARCH="$2"; fi
shift
shift
;;
-*)
echo "Unknown option $i"
exit 1
;;
*)
;;
esac
case $i in
--with-debug-symbols)
DEBUG_SYMBOLS="--with-debug-symbols"
shift
;;
--version)
if [[ -n $2 ]]; then VERSION="$2"; fi
shift
shift
;;
--arch)
if [[ -n $2 ]]; then ARCH="$2"; fi
shift
shift
;;
--patch-glibc)
PATCH_GLIBC=1
shift
;;
-*)
echo "Unknown option $i"
exit 1
;;
*)
;;
esac
done
if [ "$ARCH" = "aarch64" ]; then
ARCH="arm64"
ARCH="arm64"
fi
CONFIG_NAME=
@@ -61,6 +65,48 @@ cp ecode.desktop ecode.app/
cp ../../../bin/assets/icon/ecode.png ecode.app/ecode.png
cp ../../../libs/linux/libeepp.so ecode.app/libs/
cp ../../../bin/ecode ecode.app/ecode.bin
if [ "$PATCH_GLIBC" = "1" ]; then
# Check if ninja is installed
if ! command -v ninja &> /dev/null; then
echo "Ninja not found. Attempting to install ninja-build..."
# Try to detect the distro and install ninja
DISTRO_ID=""
if [ -r /etc/os-release ]; then
. /etc/os-release
DISTRO_ID=${ID,,}
fi
case "$DISTRO_ID" in
ubuntu|debian)
sudo apt-get update
sudo apt-get install -y ninja-build
;;
fedora)
sudo dnf install -y ninja-build
;;
centos|rhel)
sudo yum install -y ninja-build
;;
arch)
sudo pacman -Sy --noconfirm ninja
;;
*)
echo "Could not detect distribution or unsupported distro. Please install ninja manually."
exit 1
;;
esac
fi
git clone https://github.com/corsix/polyfill-glibc.git
cd polyfill-glibc || exit
ninja polyfill-glibc
echo "Patching ecode.bin"
./polyfill-glibc --target-glibc=2.34 ../ecode.app/ecode.bin
cd ..
fi
cp -L "$(bash ../scripts/find_most_recent_sdl2.sh)" ecode.app/libs/ || exit
${STRIP:-strip} ecode.app/libs/libSDL2-2.0.so.0
mkdir -p ecode.app/assets/colorschemes
@@ -105,22 +151,22 @@ export APPIMAGETOOL="appimagetool"
if ! command -v appimagetool &> /dev/null
then
wget -nc "https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-$(arch).AppImage"
APPIMAGETOOL="./appimagetool-$(arch).AppImage"
chmod +x "$APPIMAGETOOL"
wget -nc "https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-$(arch).AppImage"
APPIMAGETOOL="./appimagetool-$(arch).AppImage"
chmod +x "$APPIMAGETOOL"
fi
ECODE_NAME=ecode-linux-"$ECODE_VERSION"-"$ARCH"
if [ -n "$DEBUG_SYMBOLS" ];
then
cp -r ecode.app ecode
rm ecode/.DirIcon
mv ecode/AppRun ecode/ecode
7za a -t7z "$ECODE_NAME"-with-debug-symbols.7z ecode -mx9 -mmt"$(nproc)"
rm -rf ecode
objcopy -S ecode.app/ecode.bin ecode.app/ecode.bin
objcopy -S ecode.app/libs/libeepp.so ecode.app/libs/libeepp.so
cp -r ecode.app ecode
rm ecode/.DirIcon
mv ecode/AppRun ecode/ecode
7za a -t7z "$ECODE_NAME"-with-debug-symbols.7z ecode -mx9 -mmt"$(nproc)"
rm -rf ecode
objcopy -S ecode.app/ecode.bin ecode.app/ecode.bin
objcopy -S ecode.app/libs/libeepp.so ecode.app/libs/libeepp.so
fi
echo "Generating $ECODE_NAME.AppImage"