mirror of
https://github.com/RetroDECK/AppImages.git
synced 2025-04-11 02:55:09 +00:00
Repo init
This commit is contained in:
parent
e08b43ec10
commit
6c24e9495a
57
.github/workflows/appimage_maker.yml
vendored
Normal file
57
.github/workflows/appimage_maker.yml
vendored
Normal file
|
@ -0,0 +1,57 @@
|
|||
name: AppImage Maker
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
project:
|
||||
- name: dolphin
|
||||
repo: https://github.com/dolphin-emu/dolphin.git
|
||||
cmake_args: "-DENABLE_SDL=ON"
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up build dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y cmake make git wget patch
|
||||
|
||||
- name: Remove previous appimage directory
|
||||
run: |
|
||||
rm -rf appimages/${{ matrix.project.name }}
|
||||
mkdir -p appimages/${{ matrix.project.name }}
|
||||
|
||||
- name: Run build script
|
||||
run: |
|
||||
chmod +x automation_tools/build_appimage.sh
|
||||
# Collect any patch files from patches/<appname>/
|
||||
PATCH_ARGS=""
|
||||
for f in patches/${{ matrix.project.name }}/*.patch; do
|
||||
if [ -f "$f" ]; then
|
||||
PATCH_ARGS="$PATCH_ARGS $f"
|
||||
fi
|
||||
done
|
||||
# Determine output file name with current date (YYYYMMDD)
|
||||
DATE=$(date +%Y%m%d)
|
||||
OUTPUT="appimages/${{ matrix.project.name }}/${{ matrix.project.name }}-${DATE}.AppImage"
|
||||
echo "Building AppImage for ${{ matrix.project.name }}..."
|
||||
echo "Repository: ${{ matrix.project.repo }}"
|
||||
echo "Output: $OUTPUT"
|
||||
echo "CMake Args: ${{ matrix.project.cmake_args }}"
|
||||
echo "Patch files: $PATCH_ARGS"
|
||||
automation_tools/build_appimage.sh "${{ matrix.project.repo }}" "${{ matrix.project.name }}" "$OUTPUT" "${{ matrix.project.cmake_args }}" $PATCH_ARGS
|
||||
|
||||
- name: Publish AppImage
|
||||
if: success()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.project.name }}-AppImage
|
||||
path: appimages/${{ matrix.project.name }}/*.AppImage
|
94
automation_tools/appimage_maker.sh
Executable file
94
automation_tools/appimage_maker.sh
Executable file
|
@ -0,0 +1,94 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Function: build_appimage
|
||||
# Parameters:
|
||||
# $1: Repository URL
|
||||
# $2: App name (used for clone directory, executable name, AppDir, desktop file, and icon)
|
||||
# $3: Output AppImage file name
|
||||
# $4: (Optional) Additional CMake arguments
|
||||
# $5...: (Optional) One or more patch file paths to be applied before building
|
||||
|
||||
build_appimage() {
|
||||
local REPO_URL="$1"
|
||||
local APP_NAME="$2"
|
||||
local APPIMAGE_OUTPUT="$3"
|
||||
local CMAKE_ARGS="${4:-}"
|
||||
shift 4
|
||||
local PATCH_FILES=("$@") # Remaining arguments are patch files
|
||||
|
||||
# Static/temporary names based on the app name:
|
||||
local CLONE_DIR="$APP_NAME"
|
||||
local BUILD_DIR="build"
|
||||
local APPDIR="${APP_NAME}.AppDir"
|
||||
|
||||
# Save current directory
|
||||
local CURRENT_DIR
|
||||
CURRENT_DIR="$(pwd)"
|
||||
|
||||
# Clone the repository if not already cloned
|
||||
if [ ! -d "$CLONE_DIR" ]; then
|
||||
git clone "$REPO_URL" "$CLONE_DIR"
|
||||
fi
|
||||
|
||||
pushd "$CLONE_DIR" > /dev/null
|
||||
|
||||
# Optionally checkout a specific branch or commit if desired
|
||||
# git checkout <branch-or-commit>
|
||||
|
||||
# Apply patch files, if provided
|
||||
if [ ${#PATCH_FILES[@]} -gt 0 ]; then
|
||||
for patch in "${PATCH_FILES[@]}"; do
|
||||
if [ -f "$patch" ]; then
|
||||
echo "Applying patch: $patch"
|
||||
patch -p1 < "$patch"
|
||||
else
|
||||
echo "Warning: Patch file $patch does not exist. Skipping."
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Create build directory and build the project
|
||||
mkdir -p "$BUILD_DIR"
|
||||
pushd "$BUILD_DIR" > /dev/null
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release $CMAKE_ARGS
|
||||
make -j"$(nproc)"
|
||||
popd > /dev/null
|
||||
|
||||
# Prepare the AppDir structure
|
||||
rm -rf "$APPDIR"
|
||||
mkdir -p "$APPDIR/usr/bin"
|
||||
# Assumes the built executable is named as the app name and is located in the build directory
|
||||
cp "$BUILD_DIR/$APP_NAME" "$APPDIR/usr/bin/"
|
||||
|
||||
# Copy the desktop file and icon (assumed to be in the repository root with matching names)
|
||||
cp "${APP_NAME}.desktop" "$APPDIR/"
|
||||
cp "${APP_NAME}.png" "$APPDIR/"
|
||||
|
||||
# Download appimagetool if not already present (placed one level above the clone directory)
|
||||
if [ ! -f "../appimagetool" ]; then
|
||||
wget -O ../appimagetool https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
|
||||
chmod +x ../appimagetool
|
||||
fi
|
||||
|
||||
# Create the AppImage using appimagetool
|
||||
../appimagetool "$APPDIR" "$APPIMAGE_OUTPUT"
|
||||
|
||||
echo "AppImage created: $APPIMAGE_OUTPUT"
|
||||
|
||||
popd > /dev/null
|
||||
cd "$CURRENT_DIR"
|
||||
}
|
||||
|
||||
# Example usage:
|
||||
# This will clone the repository into a folder named "dolphin-emu",
|
||||
# build it using a build directory named "build",
|
||||
# assume the executable is "dolphin-emu" and the desktop/icon files are named
|
||||
# "dolphin-emu.desktop" and "dolphin-emu.png", apply any provided patch files,
|
||||
# and output "Dolphin-emu.AppImage".
|
||||
# build_appimage \
|
||||
# "https://github.com/dolphin-emu/dolphin.git" \
|
||||
# "dolphin-emu" \
|
||||
# "Dolphin-emu.AppImage" \
|
||||
# "-DENABLE_SDL=ON" \
|
||||
# "patches/fix_bug.patch" "patches/add_feature.patch"
|
Loading…
Reference in a new issue