Compilar y Empaquetar para macOS #34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Compilar y Empaquetar para macOS (Intel x86_64 via Rosetta) | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| build-and-package: | |
| runs-on: macos-latest | |
| steps: | |
| - name: Clonar repositorio Trinity | |
| uses: actions/checkout@v4 | |
| with: | |
| path: "trinity" | |
| - name: Clonar Manifiesto de mcpelauncher | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: "minecraft-linux/mcpelauncher-manifest" | |
| ref: "qt6" # <-- ACTUALIZADO A qt6 | |
| submodules: "recursive" | |
| path: "mcpelauncher" | |
| - name: Clonar mcpe-extract (Codeberg) | |
| run: git clone https://codeberg.org/javiercplus/mcpe-extract.git | |
| - name: Clonar mcpelauncher-mac-bin (Librerías puente) | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: "minecraft-linux/mcpelauncher-mac-bin" | |
| path: "mac-bin" | |
| - name: Preparar ANGLE (x86_64) | |
| run: | | |
| mkdir -p external_libs/angle_extracted | |
| curl -L "https://huggingface.co/datasets/ccoffee20/macos/resolve/main/angle-macos-latest-11.0-x86_64-tar.zip" -o angle.zip | |
| unzip angle.zip -d external_libs/angle_extracted | |
| cd external_libs/angle_extracted | |
| find . -name "*.tar.xz" -exec tar -xf {} \; | |
| - name: Instalar Homebrew (Intel) y dependencias | |
| run: | | |
| arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
| eval "$(/usr/local/bin/brew shellenv)" | |
| brew update | |
| brew install cmake ninja qt@6 libzip libpng pkg-config openssl@3 rustup-init | |
| brew link --force qt@6 | |
| arch -x86_64 rustup-init -y | |
| - name: Compilar Trinity (x86_64) | |
| run: | | |
| eval "$(/usr/local/bin/brew shellenv)" | |
| cd trinity | |
| mkdir -p build && cd build | |
| arch -x86_64 cmake .. \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -G Ninja \ | |
| -DCMAKE_PREFIX_PATH="$(brew --prefix qt@6)" \ | |
| -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 \ | |
| -DCMAKE_OSX_ARCHITECTURES=x86_64 \ | |
| -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ | |
| -DCMAKE_POLICY_DEFAULT_CMP0169=OLD \ | |
| -Wno-dev | |
| arch -x86_64 cmake --build . --parallel $(sysctl -n hw.ncpu) | |
| - name: Compilar mcpelauncher (x86_64) | |
| run: | | |
| eval "$(/usr/local/bin/brew shellenv)" | |
| source $HOME/.cargo/env | |
| cd mcpelauncher | |
| wget https://huggingface.co/datasets/ccoffee20/trinity-installer/resolve/main/patch.sh | |
| bash patch.sh | |
| mkdir -p build && cd build | |
| OPENSSL_DIR="$(brew --prefix openssl@3)" | |
| arch -x86_64 cmake .. \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -G Ninja \ | |
| -DCMAKE_PREFIX_PATH="$(brew --prefix qt@6)" \ | |
| -DJNI_USE_JNIVM=ON \ | |
| -DGAMEWINDOW_SYSTEM=SDL3 \ | |
| -DBUILD_WEBVIEW=OFF \ | |
| -DBUILD_UI=OFF \ | |
| -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 \ | |
| -DCMAKE_OSX_ARCHITECTURES=x86_64 \ | |
| -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ | |
| -DCMAKE_POLICY_DEFAULT_CMP0169=OLD \ | |
| -DCMAKE_POLICY_DEFAULT_CMP0074=NEW \ | |
| -DOPENSSL_ROOT_DIR="$OPENSSL_DIR" \ | |
| -Wno-dev | |
| arch -x86_64 cmake --build . --parallel $(sysctl -n hw.ncpu) | |
| - name: Compilar mcpe-extract (x86_64) | |
| run: | | |
| eval "$(/usr/local/bin/brew shellenv)" | |
| cd mcpe-extract | |
| mkdir -p build && cd build | |
| arch -x86_64 cmake .. \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -G Ninja \ | |
| -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 \ | |
| -DCMAKE_OSX_ARCHITECTURES=x86_64 \ | |
| -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ | |
| -DCMAKE_POLICY_DEFAULT_CMP0169=OLD \ | |
| -Wno-dev | |
| arch -x86_64 cmake --build . --parallel $(sysctl -n hw.ncpu) | |
| - name: Crear Application Bundle y Empaquetar | |
| run: | | |
| eval "$(/usr/local/bin/brew shellenv)" | |
| mkdir -p dist/Trinity.app/Contents/MacOS | |
| mkdir -p dist/Trinity.app/Contents/Frameworks | |
| mkdir -p dist/Trinity.app/Contents/Resources/mcpelauncher/lib/native/x86_64 | |
| mkdir -p dist/Trinity.app/Contents/Resources/mcpelauncher/lib/x86_64 | |
| mkdir -p dist/lib | |
| # Copiar los binarios recién compilados | |
| cp mcpelauncher/build/mcpelauncher-client/mcpelauncher-client dist/Trinity.app/Contents/MacOS/ | |
| cp mcpe-extract/build/mcpelauncher-extract dist/Trinity.app/Contents/MacOS/ | |
| cp trinity/build/app/trinity dist/Trinity.app/Contents/MacOS/trinity-bin | |
| # Buscar y copiar el msa-daemon compilado | |
| find mcpelauncher/build -type f -name "msa-daemon" -exec cp {} dist/Trinity.app/Contents/MacOS/ \; || true | |
| # Script wrapper actualizado para x86_64 | |
| cat << 'EOF' > dist/Trinity.app/Contents/MacOS/trinity | |
| #!/bin/bash | |
| # la ruta completa de la app | |
| TRINITY_APP="/Applications/Trinity.app" | |
| NATIVE_LIBS="$TRINITY_APP/Contents/Resources/mcpelauncher/lib/x86_64" | |
| QT_FRAMEWORKS="$TRINITY_APP/Contents/Frameworks" | |
| export ANGLE_DEFAULT_PLATFORM=metal | |
| export QT_MAC_WANTS_LAYER=1 | |
| export DYLD_LIBRARY_PATH="$NATIVE_LIBS:$QT_FRAMEWORKS:$DYLD_LIBRARY_PATH" | |
| export DYLD_FRAMEWORK_PATH="$QT_FRAMEWORKS:$DYLD_FRAMEWORK_PATH" | |
| "$TRINITY_APP/Contents/MacOS/trinity-bin" "$@" | |
| EOF | |
| chmod +x dist/Trinity.app/Contents/MacOS/trinity | |
| ln -s /usr/local/opt/qtsvg/lib/QtSvg.framework dist/lib/ | |
| ln -s /usr/local/opt/qtvirtualkeyboard/lib/QtVirtualKeyboard.framework dist/lib/ | |
| ln -s /usr/local/opt/qtvirtualkeyboard/lib/QtVirtualKeyboardQml.framework dist/lib/ | |
| cd dist | |
| arch -x86_64 $(brew --prefix qt@6)/bin/macdeployqt Trinity.app \ | |
| -executable=Trinity.app/Contents/MacOS/trinity-bin \ | |
| -executable=Trinity.app/Contents/MacOS/mcpelauncher-client \ | |
| -executable=Trinity.app/Contents/MacOS/mcpelauncher-extract | |
| cd .. | |
| # Inyectar dependencias nativas de Android (FMOD y SOs) para x86_64 | |
| cp mac-bin/lib/native/x86_64/libfmod*.dylib dist/Trinity.app/Contents/Resources/mcpelauncher/lib/native/x86_64/ | |
| cp mac-bin/lib/x86_64/*.so dist/Trinity.app/Contents/Resources/mcpelauncher/lib/x86_64/ | |
| # Inyectar ANGLE precompilado a Frameworks | |
| find external_libs/angle_extracted -name "libEGL.dylib" -exec cp {} dist/Trinity.app/Contents/Frameworks/ \; | |
| find external_libs/angle_extracted -name "libGLESv2.dylib" -exec cp {} dist/Trinity.app/Contents/Frameworks/ \; | |
| # Enseñar a los ejecutables dónde buscar las librerías de ANGLE | |
| install_name_tool -add_rpath @loader_path/../Frameworks dist/Trinity.app/Contents/MacOS/trinity-bin || true | |
| install_name_tool -add_rpath @loader_path/../Frameworks dist/Trinity.app/Contents/MacOS/mcpelauncher-client || true | |
| install_name_tool -add_rpath @loader_path/../Frameworks dist/Trinity.app/Contents/MacOS/msa-daemon || true | |
| install_name_tool -add_rpath @loader_path/../Frameworks dist/Trinity.app/Contents/MacOS/mcpelauncher-extract || true | |
| cat <<EOF > dist/Trinity.app/Contents/Info.plist | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>CFBundleExecutable</key> | |
| <string>trinity</string> | |
| <key>CFBundleIdentifier</key> | |
| <string>com.trench.trinity.launcher</string> | |
| <key>CFBundleName</key> | |
| <string>Trinity</string> | |
| <key>CFBundleIconFile</key> | |
| <string>AppIcon</string> | |
| <key>CFBundleShortVersionString</key> | |
| <string>1.0</string> | |
| <key>LSMinimumSystemVersion</key> | |
| <string>10.15</string> | |
| <key>NSHighResolutionCapable</key> | |
| <true/> | |
| </dict> | |
| </plist> | |
| EOF | |
| cp trinity/resources/branding/com.trench.trinity.launcher.icns dist/Trinity.app/Contents/Resources/AppIcon.icns | |
| cd dist | |
| arch -x86_64 codesign --force --deep --sign - Trinity.app | |
| arch -x86_64 hdiutil create -volname "Trinity Launcher" -srcfolder Trinity.app -ov -format UDZO Trinity.dmg | |
| - name: Subir instalador DMG | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: trinity-mcpelauncher-macos-x86_64-dmg | |
| path: dist/Trinity.dmg | |
| if-no-files-found: error |