diff --git a/.github/workflows/ecode-nightly.yml b/.github/workflows/ecode-nightly.yml index 93325499e..bd60589e0 100644 --- a/.github/workflows/ecode-nightly.yml +++ b/.github/workflows/ecode-nightly.yml @@ -51,6 +51,9 @@ jobs: - arch: x86_64 container: ubuntu-22.04 runs-on: ${{ matrix.config.container }} + container: + image: ubuntu:20.04 + options: --device /dev/fuse --cap-add SYS_ADMIN env: CC: gcc CXX: g++ @@ -68,6 +71,11 @@ jobs: echo $(gcc --version) - name: Update Packages run: | + export DEBIAN_FRONTEND=noninteractive + apt-get update + apt-get install -y --no-install-recommends software-properties-common build-essential git ca-certificates sudo curl libfuse2 fuse + curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - + sudo apt-get install -y nodejs sudo add-apt-repository -y universe sudo add-apt-repository -y multiverse sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test @@ -83,12 +91,12 @@ jobs: sudo update-alternatives --set c++ /usr/bin/g++ sudo update-alternatives --config gcc sudo update-alternatives --config g++ - sudo apt-get install -y libfuse2 fuse premake4 mesa-common-dev libgl1-mesa-dev ninja-build + sudo apt-get install -y libfuse2 fuse premake4 mesa-common-dev libgl1-mesa-dev bash projects/linux/scripts/install_sdl2.sh - name: Build ecode run: | bash projects/scripts/patch_commit_number.sh - bash projects/linux/ecode/build.app.sh --version ${{ env.INSTALL_REF }} --arch ${{ matrix.config.arch }} --patch-glibc + bash projects/linux/ecode/build.app.sh --with-static-cpp --version ${{ env.INSTALL_REF }} --arch ${{ matrix.config.arch }} - name: Upload Files uses: softprops/action-gh-release@v2 with: diff --git a/premake4.lua b/premake4.lua index 2176b0262..e6d41f816 100644 --- a/premake4.lua +++ b/premake4.lua @@ -175,6 +175,7 @@ newoption { { "SDL2", "SDL2" } } } +newoption { trigger = "with-static-cpp", description = "Builds statically libstdc++" } function explode(div,str) if (div=='') then return false end @@ -591,6 +592,10 @@ function build_link_configuration( package_name, use_ee_icon ) defines { "EE_TEXT_SHAPER_ENABLED" } end + if _OPTIONS["with-static-cpp"] then + linkoptions { "-static-libgcc -static-libstdc++" } + end + set_ios_config() set_apple_config() build_arch_configuration() diff --git a/premake5.lua b/premake5.lua index ded8674b2..de6ce04cf 100644 --- a/premake5.lua +++ b/premake5.lua @@ -28,6 +28,7 @@ newoption { } } newoption { trigger = "arch", description = "Used exclusively to indicate premake the architecture of the dependencies that need to be downloaded" } +newoption { trigger = "with-static-cpp", description = "Builds statically libstdc++" } function get_dll_extension() if os.target() == "macosx" then @@ -380,6 +381,10 @@ function build_link_configuration( package_name, use_ee_icon ) defines { "EE_TEXT_SHAPER_ENABLED" } end + if _OPTIONS["with-static-cpp"] then + linkoptions { "-static-libgcc -static-libstdc++" } + end + cppdialect "C++20" set_ios_config() set_apple_config() diff --git a/projects/linux/ecode/build.app.sh b/projects/linux/ecode/build.app.sh index 38e72ccdd..ce33606fb 100755 --- a/projects/linux/ecode/build.app.sh +++ b/projects/linux/ecode/build.app.sh @@ -4,6 +4,7 @@ DIRPATH="$(dirname "$CANONPATH")" cd "$DIRPATH" || exit cd ../../../ || exit DEBUG_SYMBOLS= +STATIC_CPP= VERSION= ARCH=$(arch) for i in "$@"; do @@ -12,6 +13,10 @@ for i in "$@"; do DEBUG_SYMBOLS="--with-debug-symbols" shift ;; + --with-static-cpp) + STATIC_CPP="--with-static-cpp" + shift + ;; --version) if [[ -n $2 ]]; then VERSION="$2"; fi shift @@ -22,10 +27,6 @@ for i in "$@"; do shift shift ;; - --patch-glibc) - PATCH_GLIBC=1 - shift - ;; -*) echo "Unknown option $i" exit 1 @@ -42,11 +43,11 @@ fi CONFIG_NAME= if command -v premake4 &> /dev/null then - premake4 $DEBUG_SYMBOLS --with-text-shaper gmake || exit + premake4 $DEBUG_SYMBOLS --with-text-shaper $STATIC_CPP gmake || exit CONFIG_NAME=release elif command -v premake5 &> /dev/null then - premake5 $DEBUG_SYMBOLS --with-text-shaper gmake2 || exit + premake5 $DEBUG_SYMBOLS --with-text-shaper $STATIC_CPP gmake2 || exit CONFIG_NAME=release_"$ARCH" else echo "Neither premake5 nor premake4 is available. Please install one." @@ -65,48 +66,6 @@ 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