mirror of
https://github.com/iDescriptor/iDescriptor.git
synced 2026-06-22 03:45:51 +08:00
229 lines
7.5 KiB
YAML
229 lines
7.5 KiB
YAML
name: Build macOS
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
env:
|
|
QT_VERSION: "6.8.0"
|
|
GO_VERSION: "1.23.0"
|
|
LIBPLIST_VER: "2.7.0"
|
|
LIBTATSU_VER: "1.0.5"
|
|
LIBIMOBILEDEVICE_GLUE_VER: "1.3.2"
|
|
LIBIMOBILEDEVICE_VER: "1.4.0"
|
|
LIBIRECOVERY_VER: "1.3.1"
|
|
LIBUSBMUXD_VER: "2.1.1"
|
|
|
|
jobs:
|
|
build-macos:
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- runner: macos-15-intel
|
|
arch: x86_64
|
|
# - runner: macos-14
|
|
# arch: arm64
|
|
runs-on: ${{ matrix.runner }}
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: "recursive"
|
|
|
|
- name: Install Qt
|
|
uses: jurplel/install-qt-action@v4
|
|
with:
|
|
version: ${{ env.QT_VERSION }}
|
|
modules: "qtmultimedia qtlocation qtpositioning qtserialport"
|
|
|
|
- name: Update pkgconfig path
|
|
run: |
|
|
echo "PKG_CONFIG_PATH=$(brew --prefix)/lib/pkgconfig:${PKG_CONFIG_PATH:-}" >> "$GITHUB_ENV"
|
|
echo "CMAKE_PREFIX_PATH=${QT_ROOT_DIR}/lib/cmake:${CMAKE_PREFIX_PATH:-}" >> "$GITHUB_ENV"
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version: "^1.23.0"
|
|
|
|
- name: Install macOS dependencies
|
|
run: |
|
|
brew install \
|
|
autoconf \
|
|
automake \
|
|
libtool \
|
|
pkg-config \
|
|
pugixml \
|
|
libusb \
|
|
qrencode \
|
|
curl \
|
|
openssl \
|
|
libzip \
|
|
libheif \
|
|
libssh \
|
|
gstreamer \
|
|
gst-plugins-base \
|
|
gst-plugins-good \
|
|
gst-plugins-bad \
|
|
gst-plugins-ugly \
|
|
gst-libav \
|
|
create-dmg
|
|
|
|
- name: Compile additional dependencies
|
|
run: |
|
|
git clone https://github.com/lxqt/lxqt-build-tools.git
|
|
pushd lxqt-build-tools
|
|
mkdir build && cd build
|
|
cmake ..
|
|
sudo make install
|
|
popd
|
|
|
|
git clone https://github.com/lxqt/qtermwidget.git
|
|
pushd qtermwidget
|
|
mkdir build && cd build
|
|
cmake .. \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DCMAKE_INSTALL_PREFIX=/usr/local \
|
|
-DLXQT_BUILD_QT6=ON \
|
|
-DBUILD_TESTS=OFF
|
|
sudo make -j"$(sysctl -n hw.ncpu)" install
|
|
popd
|
|
|
|
- name: Build libimobiledevice suite (versioned tarballs)
|
|
run: |
|
|
set -euo pipefail
|
|
workspace="$PWD"
|
|
tmp="$PWD/_tmp_libs"
|
|
mkdir -p "$tmp"
|
|
cd "$tmp"
|
|
|
|
base_url="https://github.com/libimobiledevice"
|
|
|
|
libs=( "libplist" "libtatsu" "libimobiledevice-glue" "libusbmuxd" "libimobiledevice" "libirecovery")
|
|
|
|
for name in "${libs[@]}"; do
|
|
# Use tr for POSIX-compliant uppercase conversion instead of bash 4+ ^^ syntax
|
|
ver_var=$(echo "$name" | tr '[:lower:]' '[:upper:]' | sed 's/-/_/g')_VER
|
|
ver="${!ver_var:-}"
|
|
if [ -z "$ver" ]; then
|
|
echo "Version for $name not set (env var $ver_var)"
|
|
exit 1
|
|
fi
|
|
|
|
archive="${name}-${ver}.tar.bz2"
|
|
url="${base_url}/${name}/releases/download/${ver}/${archive}"
|
|
echo "=== Processing $name $ver ==="
|
|
echo "URL: $url"
|
|
curl -L -o "$archive" "$url"
|
|
|
|
echo "Extracting $archive"
|
|
tar xjf "$archive"
|
|
|
|
srcdir="${name}-${ver}"
|
|
pushd "$srcdir"
|
|
|
|
./configure
|
|
|
|
make -j"$(sysctl -n hw.ncpu)" && sudo make install
|
|
popd
|
|
echo "Installed $name $ver"
|
|
done
|
|
|
|
# cleanup
|
|
cd "$workspace"
|
|
rm -rf "$tmp"
|
|
|
|
- name: Configure CMake
|
|
run: |
|
|
cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DRUN_CLANG_TIDY=OFF
|
|
|
|
- name: Build with CMake
|
|
run: cmake --build build --config Release
|
|
|
|
- name: Deploy Qt dependencies
|
|
run: |
|
|
macdeployqt build/iDescriptor.app -qmldir=qml -verbose=2
|
|
|
|
# Bundle GStreamer
|
|
GST_PLUGIN_DIR="build/iDescriptor.app/Contents/Frameworks/gstreamer"
|
|
mkdir -p "${GST_PLUGIN_DIR}"
|
|
|
|
PLUGINS=(
|
|
"libgstapp"
|
|
"libgstaudioconvert"
|
|
"libgstautodetect"
|
|
"libgstavi"
|
|
"libgstcoreelements"
|
|
"libgstlevel"
|
|
"libgstlibav"
|
|
"libgstosxaudio"
|
|
"libgstplayback"
|
|
"libgstvolume"
|
|
)
|
|
|
|
for plugin in "${PLUGINS[@]}"; do
|
|
cp "$(brew --prefix gstreamer)/lib/gstreamer-1.0/${plugin}.dylib" "${GST_PLUGIN_DIR}/"
|
|
done
|
|
|
|
cp "$(brew --prefix gstreamer)/libexec/gstreamer-1.0/gst-plugin-scanner" "build/iDescriptor.app/Contents/Frameworks/"
|
|
|
|
# Bundle libjxl_cms
|
|
cp "$(brew --prefix)/lib/libjxl_cms.0.11.dylib" build/iDescriptor.app/Contents/Frameworks/
|
|
install_name_tool -id "@rpath/libjxl_cms.0.11.dylib" build/iDescriptor.app/Contents/Frameworks/libjxl_cms.0.11.dylib
|
|
install_name_tool -change "$(brew --prefix)/lib/libjxl_cms.0.11.dylib" "@rpath/libjxl_cms.0.11.dylib" build/iDescriptor.app/Contents/Frameworks/libjxl.0.11.dylib
|
|
|
|
# Add rpath to main executable
|
|
install_name_tool -add_rpath "@executable_path/../Frameworks" build/iDescriptor.app/Contents/MacOS/iDescriptor
|
|
|
|
# Fix GStreamer library paths
|
|
FRAMEWORKS_DIR="build/iDescriptor.app/Contents/Frameworks"
|
|
BREW_PREFIX="$(brew --prefix)"
|
|
|
|
# For some reason libavfilter sometimes doesnt get copied by macdeployqt
|
|
FFMPEG_LIB_DIR="$(brew --prefix ffmpeg)/lib"
|
|
cp ${FFMPEG_LIB_DIR}/libavfilter.11.dylib "${FRAMEWORKS_DIR}/"
|
|
|
|
# Fix dependencies in all GStreamer plugins
|
|
for plugin in "${GST_PLUGIN_DIR}"/*.dylib; do
|
|
echo "Fixing plugin: $(basename ${plugin})"
|
|
|
|
# Get all dependencies and fix them
|
|
otool -L "${plugin}" | grep -E "${BREW_PREFIX}" | awk '{print $1}' | while read dep; do
|
|
depname=$(basename "${dep}")
|
|
echo " Changing ${depname}"
|
|
install_name_tool -change "${dep}" "@rpath/${depname}" "${plugin}" 2>/dev/null || true
|
|
done
|
|
done
|
|
|
|
# Fix dependencies in GStreamer core libraries themselves
|
|
for lib in "${FRAMEWORKS_DIR}"/libgst*.dylib "${FRAMEWORKS_DIR}"/libglib*.dylib "${FRAMEWORKS_DIR}"/libgobject*.dylib "${FRAMEWORKS_DIR}"/libgmodule*.dylib "${FRAMEWORKS_DIR}"/libgio*.dylib "${FRAMEWORKS_DIR}"/libgthread*.dylib; do
|
|
if [ -f "${lib}" ]; then
|
|
echo "Fixing library: $(basename ${lib})"
|
|
|
|
otool -L "${lib}" | grep -E "${BREW_PREFIX}" | awk '{print $1}' | while read dep; do
|
|
depname=$(basename "${dep}")
|
|
echo " Changing ${depname}"
|
|
install_name_tool -change "${dep}" "@rpath/${depname}" "${lib}" 2>/dev/null || true
|
|
done
|
|
fi
|
|
done
|
|
|
|
- name: Create DMG
|
|
run: |
|
|
create-dmg \
|
|
--volname "iDescriptor" \
|
|
--volicon "resources/icons/app-icon/icon.icns" \
|
|
--window-pos 200 120 \
|
|
--window-size 600 400 \
|
|
--icon-size 100 \
|
|
--icon "iDescriptor.app" 175 190 \
|
|
--hide-extension "iDescriptor.app" \
|
|
--app-drop-link 425 190 \
|
|
"build/iDescriptor-macOS-${{ matrix.arch }}.dmg" \
|
|
"build/iDescriptor.app"
|
|
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: iDescriptor-macOS-${{ matrix.arch }}
|
|
path: build/*.dmg
|