diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index b02b497..5df4518 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -18,6 +18,15 @@ jobs: - name: Ubuntu Base Dockerfile file: ./cicd/ubuntu/base.Dockerfile tag: base + context: cicd/ubuntu/ + - name: Ubuntu Linux Dockerfile (Windows/Linux/Android) + file: ./cicd/ubuntu/linux.Dockerfile + tag: linux + context: cicd/ubuntu/ + - name: Ubuntu Apple Dockerfile (MacOS/iOS) + file: ./cicd/ubuntu/apple.Dockerfile + tag: apple + context: cicd/ubuntu/ # - name: Web Dockerfile # file: ./images/web.Dockerfile # tag: web @@ -49,6 +58,6 @@ jobs: uses: docker/build-push-action@v6 with: file: ${{ matrix.file }} - context: cicd/ubuntu/ + context: ${{ matrix.context }} push: true tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.APP_NAME_BASE }}-${{ matrix.tag }}:latest diff --git a/cicd/ubuntu/apple.Dockerfile b/cicd/ubuntu/apple.Dockerfile new file mode 100644 index 0000000..ee81f7b --- /dev/null +++ b/cicd/ubuntu/apple.Dockerfile @@ -0,0 +1,19 @@ +FROM bioblaze/blazium-base:latest + +WORKDIR /root + +RUN download-apple-files + +RUN download-project-deps + +RUN install-llvm-mingw + +RUN install-xar test + +RUN setup-xcode-sdks + +RUN setup-osxcross + +RUN setup-ios-cross-toolchain + +CMD ["/bin/bash"] \ No newline at end of file diff --git a/cicd/ubuntu/base.Dockerfile b/cicd/ubuntu/base.Dockerfile index c50ff96..4de0088 100644 --- a/cicd/ubuntu/base.Dockerfile +++ b/cicd/ubuntu/base.Dockerfile @@ -42,6 +42,8 @@ RUN echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal main" >> /etc/apt/ RUN echo "deb http://security.ubuntu.com/ubuntu xenial-security main" >> /etc/apt/sources.list +RUN echo "deb [trusted=yes] http://security.ubuntu.com/ubuntu bionic-security main" >> /etc/apt/sources.list + RUN wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb && \ dpkg -i packages-microsoft-prod.deb && \ rm packages-microsoft-prod.deb @@ -57,13 +59,13 @@ RUN apt-get install -y \ speech-dispatcher \ fontconfig \ dotnet-host dotnet-sdk-8.0 \ - libfontconfig-dev + libfontconfig-dev --no-remove --no-upgrade RUN apt-get install -y --no-install-recommends clang-format clang-tidy \ clang-tools clang clangd libc++-dev libc++1 libc++abi-dev \ libc++abi1 libclang-dev libclang1 libllvm-ocaml-dev \ libomp-dev libomp5 lld llvm-dev llvm-runtime llvm python3-clang liblldb-20-dev lldb-20 \ - python3-lldb-20 + python3-lldb-20 --no-remove --no-upgrade RUN apt-get install -y \ gcc-multilib g++-multilib \ @@ -75,7 +77,7 @@ RUN apt-get install -y \ libxi-dev libxi-dev:i386 \ libxrandr-dev libxrandr-dev:i386 \ libgl1-mesa-dev libgl1-mesa-dev:i386 \ - libatomic-ops-dev + libatomic-ops-dev --no-remove --no-upgrade RUN apt-get install -y \ libglu1-mesa-dev \ @@ -87,13 +89,13 @@ RUN apt-get install -y \ libstdc++6 \ libatomic1 \ libfreetype6-dev \ - libssl-dev libssl1.0.0 \ libgl-dev \ liblzma-dev liblzma5 lzma-dev \ libglu-dev \ libdbus-1-dev \ libxml2-dev \ - bzip2 \ + libbz2-dev --no-remove --no-upgrade +RUN apt-get install -y \ libmpc-dev libmpfr-dev libgmp-dev \ libembree-dev \ libenet-dev \ @@ -112,19 +114,37 @@ RUN apt-get install -y \ libzstd-dev \ libsquish-dev \ libicu-dev \ - libdispatch-dev \ + libdispatch-dev --no-remove --no-upgrade +RUN apt-get install -y \ libltdl-dev libtool libltdl7 uuid-dev \ - gobjc gobjc++ \ - #lib32ncurses-dev lib32ncurses6 lib32ncursesw6 lib32tinfo6 lib32c-dev lib32tinfo6 libc6-i386 \ - lib64ncurses-dev lib64ncurses6 lib64ncursesw6:i386 lib64tinfo6:i386 lib64c-dev:i386 libc6-amd64:i386 lib64tinfo6:i386 \ - libncurses-dev openjdk-17-jdk + gobjc gobjc++ --no-remove --no-upgrade +RUN apt-get install -y \ + openjdk-17-jdk --no-remove --no-upgrade +RUN apt-get install -y \ + libncurses-dev --no-remove --no-upgrade RUN apt-get install -y \ mingw-w64 \ mingw-w64-common \ mingw-w64-tools \ - gcc-mingw-w64 g++-mingw-w64 directx-headers-dev + gcc-mingw-w64 g++-mingw-w64 directx-headers-dev --no-remove --no-upgrade + +RUN apt-cache policy libssl1.0-dev + + + +RUN apt-get install -y libcrypto++ libcrypto++-dev libssl1.0-dev libbz2-dev \ + lib32z1 lib32c-dev libcrypt1:i386 libminizip-dev lib32z1-dev \ + libc6-i386 --no-upgrade + +RUN apt-mark hold libssl1.0-dev + + +RUN apt-get install -y -f \ + lib32ncurses-dev lib32ncurses6 lib32ncursesw6 lib32tinfo6 lib32c-dev lib32tinfo6 libc6-i386 --no-remove --no-upgrade + + RUN update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix && \ update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix && \ @@ -181,5 +201,8 @@ COPY cmds/download-apple-files.sh $INSTALL_DIR/ RUN chmod +x $INSTALL_DIR/download-apple-files.sh RUN update-alternatives --install $INSTALL_DIR/download-apple-files download-apple-files $INSTALL_DIR/download-apple-files.sh 10 +COPY cmds/download-project-deps.sh $INSTALL_DIR/ +RUN chmod +x $INSTALL_DIR/download-project-deps.sh +RUN update-alternatives --install $INSTALL_DIR/download-project-deps download-project-deps $INSTALL_DIR/download-project-deps.sh 10 CMD ["/bin/bash"] diff --git a/cicd/ubuntu/cmds/download-project-deps.sh b/cicd/ubuntu/cmds/download-project-deps.sh new file mode 100644 index 0000000..29e92a6 --- /dev/null +++ b/cicd/ubuntu/cmds/download-project-deps.sh @@ -0,0 +1,96 @@ +#!/bin/bash + +# Exit immediately if a command exits with a non-zero status +set -e + +# Log function for structured output +log() { + local message="$1" + if [[ -n "$GITHUB_ACTIONS" ]]; then + echo "$message" >> "$GITHUB_STEP_SUMMARY" + fi + echo "$message" +} + +# Detect if running on a GitHub Actions runner +if [[ -n "$GITHUB_ACTIONS" ]]; then + log "### Running on a GitHub Actions runner" + log "Debug information will be written to GITHUB_STEP_SUMMARY." +else + log "### Not running on a GitHub Actions runner" + log "Debug information will only appear in the terminal." +fi + +# Ensure the base directory exists +DEPS_DIR="/root/deps" +log "### Ensuring dependencies directory exists: $DEPS_DIR" +mkdir -p "$DEPS_DIR" + +# macOS needs MoltenVK +if [ ! -d "$DEPS_DIR/moltenvk" ]; then + log "### Missing MoltenVK for macOS, downloading it." + mkdir -p "$DEPS_DIR/moltenvk" + pushd "$DEPS_DIR/moltenvk" > /dev/null + curl -L -o moltenvk.tar https://github.com/godotengine/moltenvk-osxcross/releases/download/vulkan-sdk-1.3.283.0-2/MoltenVK-all.tar + tar xf moltenvk.tar && rm -f moltenvk.tar + mv MoltenVK/MoltenVK/include/ MoltenVK/ + mv MoltenVK/MoltenVK/static/MoltenVK.xcframework/ MoltenVK/ + popd > /dev/null + log "MoltenVK downloaded and extracted successfully." +else + log "MoltenVK already exists. Skipping download." +fi + +# Windows and macOS need ANGLE +if [ ! -d "$DEPS_DIR/angle" ]; then + log "### Missing ANGLE libraries, downloading them." + mkdir -p "$DEPS_DIR/angle" + pushd "$DEPS_DIR/angle" > /dev/null + base_url="https://github.com/godotengine/godot-angle-static/releases/download/chromium%2F6601.2/godot-angle-static" + curl -L -o windows_arm64.zip "$base_url-arm64-llvm-release.zip" + curl -L -o windows_x86_64.zip "$base_url-x86_64-gcc-release.zip" + curl -L -o windows_x86_32.zip "$base_url-x86_32-gcc-release.zip" + curl -L -o macos_arm64.zip "$base_url-arm64-macos-release.zip" + curl -L -o macos_x86_64.zip "$base_url-x86_64-macos-release.zip" + unzip -o windows_arm64.zip && rm -f windows_arm64.zip + unzip -o windows_x86_64.zip && rm -f windows_x86_64.zip + unzip -o windows_x86_32.zip && rm -f windows_x86_32.zip + unzip -o macos_arm64.zip && rm -f macos_arm64.zip + unzip -o macos_x86_64.zip && rm -f macos_x86_64.zip + popd > /dev/null + log "ANGLE libraries downloaded and extracted successfully." +else + log "ANGLE libraries already exist. Skipping download." +fi + +# Mesa/NIR libraries +if [ ! -d "$DEPS_DIR/mesa" ]; then + log "### Missing Mesa/NIR libraries, downloading them." + mkdir -p "$DEPS_DIR/mesa" + pushd "$DEPS_DIR/mesa" > /dev/null + curl -L -o mesa_arm64.zip https://github.com/godotengine/godot-nir-static/releases/download/23.1.9-1/godot-nir-static-arm64-llvm-release.zip + curl -L -o mesa_x86_64.zip https://github.com/godotengine/godot-nir-static/releases/download/23.1.9-1/godot-nir-static-x86_64-gcc-release.zip + curl -L -o mesa_x86_32.zip https://github.com/godotengine/godot-nir-static/releases/download/23.1.9-1/godot-nir-static-x86_32-gcc-release.zip + unzip -o mesa_arm64.zip && rm -f mesa_arm64.zip + unzip -o mesa_x86_64.zip && rm -f mesa_x86_64.zip + unzip -o mesa_x86_32.zip && rm -f mesa_x86_32.zip + popd > /dev/null + log "Mesa/NIR libraries downloaded and extracted successfully." +else + log "Mesa/NIR libraries already exist. Skipping download." +fi + +# Swappy libraries +if [ ! -d "$DEPS_DIR/swappy" ]; then + log "### Missing Swappy libraries, downloading them." + mkdir -p "$DEPS_DIR/swappy" + pushd "$DEPS_DIR/swappy" > /dev/null + curl -L -O https://github.com/darksylinc/godot-swappy/releases/download/v2023.3.0.0/godot-swappy.7z + 7z x godot-swappy.7z && rm godot-swappy.7z + popd > /dev/null + log "Swappy libraries downloaded and extracted successfully." +else + log "Swappy libraries already exist. Skipping download." +fi + +log "### Dependency download and setup completed successfully!" diff --git a/cicd/ubuntu/cmds/install-xar.sh b/cicd/ubuntu/cmds/install-xar.sh index ab083ee..353960e 100644 --- a/cicd/ubuntu/cmds/install-xar.sh +++ b/cicd/ubuntu/cmds/install-xar.sh @@ -38,6 +38,8 @@ fi log "### Navigating to source directory" cd "$INSTALL_DIR/xar" || { log "Failed to navigate to $INSTALL_DIR/xar"; exit 1; } +#sed -i '332s/^.*$/AC_CHECK_LIB([crypto], [OPENSSL_init_crypto], , [have_libcrypto="0"])/' configure.ac; + # Check if configure script exists or run autogen.sh if [[ ! -f ./configure ]]; then log "Running autogen.sh to generate configure script..." @@ -50,17 +52,21 @@ fi log "### Configuring build" ./configure -log "### Building all components" +make + +make install + +# log "### Building all components" make src_all make lib_all -log "### Installing components" +# log "### Installing components" make src_install make lib_install -# Optional cleanup -log "### Cleaning up build artifacts" -make clean +# # Optional cleanup +# log "### Cleaning up build artifacts" +# make clean # Verify installation log "### Verifying Xar installation" diff --git a/cicd/ubuntu/cmds/setup-xcode-sdks.sh b/cicd/ubuntu/cmds/setup-xcode-sdks.sh index d3a17aa..0494681 100644 --- a/cicd/ubuntu/cmds/setup-xcode-sdks.sh +++ b/cicd/ubuntu/cmds/setup-xcode-sdks.sh @@ -45,7 +45,7 @@ log "Checking out commit $PBZX_COMMIT" git checkout "$PBZX_COMMIT" log "### Building pbzx" -clang -O3 -llzma -lxar -I /usr/local/include pbzx.c -o pbzx +clang -O3 -llzma -lxar -I /usr/local/include -I /usr/local/src/xar/xar/include pbzx.c -o pbzx # Step 2: Extract Xcode XIP and build SDK tarballs log "### Extracting Xcode XIP" diff --git a/cicd/ubuntu/linux.Dockerfile b/cicd/ubuntu/linux.Dockerfile new file mode 100644 index 0000000..3d169e3 --- /dev/null +++ b/cicd/ubuntu/linux.Dockerfile @@ -0,0 +1,13 @@ +FROM bioblaze/blazium-base:latest + +WORKDIR /root + +RUN download-project-deps + +RUN install-llvm-mingw + +RUN setup-android-sdk + +RUN setup-godot-sdks + +CMD ["/bin/bash"] \ No newline at end of file