mirror of
https://github.com/audacity/mod-openvino-macos.git
synced 2025-12-11 05:47:14 -06:00
Build universal package
This commit is contained in:
parent
44af0d1b66
commit
bf7936acfa
32
.github/workflows/build.yml
vendored
32
.github/workflows/build.yml
vendored
@ -76,6 +76,36 @@ jobs:
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: mod-openvino-intel
|
||||
name: mod-openvino-x86
|
||||
path: ${{ env.STAGING_PATH }}/Audacity-OpenVINO.pkg
|
||||
|
||||
build-openvino-plugins-universal:
|
||||
runs-on: macos-latest
|
||||
needs: [build-openvino-plugins-arm64, build-openvino-plugins-intel]
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: ${{ github.workspace }}
|
||||
|
||||
- name: Download arm64 artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: mod-openvino-arm64
|
||||
path: universal/mod-openvino-arm64
|
||||
|
||||
- name: Download intel artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: mod-openvino-x86
|
||||
path: universal/mod-openvino-x86
|
||||
|
||||
- name: Make univeral PKG
|
||||
run: |
|
||||
scripts/make-universal-pkg.sh
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: mod-openvino-universal
|
||||
path: ${{ env.STAGING_PATH }}/Audacity-OpenVINO*.pkg
|
||||
|
||||
@ -12,12 +12,17 @@ if [[ "$ARCH" == "arm64" ]]; then
|
||||
OPENVINO_URL="https://storage.openvinotoolkit.org/repositories/openvino/packages/2024.0/macos/m_openvino_toolkit_macos_11_0_2024.0.0.14509.34caeefd078_arm64.tgz"
|
||||
OPENVINO_FOLDER="m_openvino_toolkit_macos_11_0_2024.0.0.14509.34caeefd078_arm64"
|
||||
LIBTORCH_URL="https://download.pytorch.org/libtorch/cpu/libtorch-macos-arm64-2.2.2.zip"
|
||||
LIBOMP_LIB_DIR="/opt/homebrew/opt/libomp/lib/"
|
||||
elif [[ "$ARCH" == "x86_64" ]]; then
|
||||
MACOS_DEPLOYMENT_TARGET="10.15"
|
||||
OV_ARCH_NAME="intel64"
|
||||
OPENVINO_URL="https://storage.openvinotoolkit.org/repositories/openvino/packages/2024.0/macos/m_openvino_toolkit_macos_10_15_2024.0.0.14509.34caeefd078_x86_64.tgz"
|
||||
OPENVINO_FOLDER="m_openvino_toolkit_macos_10_15_2024.0.0.14509.34caeefd078_x86_64"
|
||||
LIBTORCH_URL="https://download.pytorch.org/libtorch/cpu/libtorch-macos-x86_64-2.2.2.zip"
|
||||
LIBOMP_LIB_DIR="/usr/local/opt/libomp/lib/"
|
||||
echo "Install x86 brew"
|
||||
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||
arch -x86_64 /usr/local/bin/brew install libomp
|
||||
else
|
||||
echo "Unsupported architecture: $ARCH"
|
||||
exit 1
|
||||
@ -33,7 +38,6 @@ PACKAGE_PATH="$ROOT_DIR/packages"
|
||||
BUILD_PATH="$ROOT_DIR/build"
|
||||
STAGING_PATH="$ROOT_DIR/staging"
|
||||
|
||||
LIBOMP_LIB_DIR="/opt/homebrew/opt/libomp/lib/"
|
||||
OPENCL_INCLUDE_DIR="/opt/homebrew/opt/opencl-clhpp-headers/include"
|
||||
|
||||
echo "Applying patches..."
|
||||
@ -142,6 +146,7 @@ xcodebuild \
|
||||
-scheme "$SCHEME" \
|
||||
-configuration "$CONFIG" \
|
||||
-derivedDataPath "$BUILD_DIR" \
|
||||
-arch "$ARCH" \
|
||||
clean build
|
||||
|
||||
APP_PATH="$BUILD_DIR/Build/Products/$CONFIG/$SCHEME.app"
|
||||
|
||||
89
scripts/make-universal-pkg.sh
Executable file
89
scripts/make-universal-pkg.sh
Executable file
@ -0,0 +1,89 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
ROOT_DIR=$(pwd)
|
||||
STAGING_PATH="$ROOT_DIR/staging"
|
||||
|
||||
process_file() {
|
||||
local rel_path="$1"
|
||||
local arm_file="$ARM_DIR/$rel_path"
|
||||
local x86_file="$X86_DIR/$rel_path"
|
||||
local out_file="$UNIVERSAL_DIR/$rel_path"
|
||||
|
||||
echo processing $1
|
||||
|
||||
mkdir -p "$(dirname "$out_file")"
|
||||
|
||||
if [ -f "$arm_file" ] && [ -f "$x86_file" ]; then
|
||||
# Merge matching binaries
|
||||
if file "$arm_file" | grep -q 'Mach-O'; then
|
||||
lipo -create -output "$out_file" "$arm_file" "$x86_file"
|
||||
echo "Created universal binary: $rel_path"
|
||||
else
|
||||
cp "$arm_file" "$out_file"
|
||||
echo "Copied from ARM (non-binary): $rel_path"
|
||||
fi
|
||||
elif [ -f "$arm_file" ]; then
|
||||
cp "$arm_file" "$out_file"
|
||||
echo "Copied from ARM only: $rel_path"
|
||||
elif [ -f "$x86_file" ]; then
|
||||
cp "$x86_file" "$out_file"
|
||||
echo "Copied from x86 only: $rel_path"
|
||||
fi
|
||||
|
||||
# Copy symlinks
|
||||
if [ -L "$arm_file" ]; then
|
||||
link_target=$(readlink "$arm_file")
|
||||
ln -sf "$link_target" "$out_file"
|
||||
echo "Copied symlink from ARM: $rel_path -> $link_target"
|
||||
elif [ -L "$x86_file" ]; then
|
||||
link_target=$(readlink "$x86_file")
|
||||
ln -sf "$link_target" "$out_file"
|
||||
echo "Copied symlink from x86: $rel_path -> $link_target"
|
||||
fi
|
||||
}
|
||||
|
||||
echo "Extracting PKGs"
|
||||
cd universal || exit 1
|
||||
|
||||
pkgutil --expand-full "mod-openvino-arm64/Audacity-OpenVINO.pkg" openvino-module-arm64
|
||||
pkgutil --expand-full "mod-openvino-x86/Audacity-OpenVINO.pkg" openvino-module-x86
|
||||
|
||||
ARM_DIR="openvino-module-arm64/"
|
||||
X86_DIR="openvino-module-x86/"
|
||||
UNIVERSAL_DIR="openvino-module-universal/"
|
||||
|
||||
mkdir -p "$UNIVERSAL_DIR"
|
||||
mkdir -p "$STAGING_PATH"
|
||||
|
||||
all_files=$(
|
||||
(
|
||||
(cd "$ARM_DIR" && find . \( -type f -o -type l \))
|
||||
(cd "$X86_DIR" && find . \( -type f -o -type l \))
|
||||
) | sort -u
|
||||
)
|
||||
|
||||
while read -r rel_path; do
|
||||
rel_path="${rel_path#./}"
|
||||
process_file "$rel_path"
|
||||
done <<< "$all_files"
|
||||
|
||||
version=$(sed -nE 's/.*version="([0-9]+\.[0-9]+\.[0-9]+[^"]*)".*/\1/p' $ARM_DIR/openvino-module.pkg/PackageInfo)
|
||||
|
||||
echo "Creating universal PKG"
|
||||
mv openvino-module-universal/openvino-module.pkg openvino-module-universal/openvino-module.dir
|
||||
mkdir -p openvino-module-universal/packages
|
||||
pkgbuild \
|
||||
--root openvino-module-universal/openvino-module.dir/Payload \
|
||||
--scripts openvino-module-universal/openvino-module.dir/Scripts \
|
||||
--install-location / \
|
||||
--identifier org.audacityteam.audacity \
|
||||
--version "$version" \
|
||||
openvino-module-universal/packages/openvino-module.pkg
|
||||
|
||||
|
||||
productbuild --distribution openvino-module-universal/Distribution \
|
||||
--resources openvino-module-universal/Resources \
|
||||
--package-path ./openvino-module-universal/packages \
|
||||
$STAGING_PATH/Audacity-OpenVINO-${version}.pkg
|
||||
Loading…
x
Reference in New Issue
Block a user