feat: macOS arm64 build support (#8515)

This commit is contained in:
gnattu 2022-12-08 00:18:04 +08:00 committed by GitHub
parent 584c80e323
commit 3cb7fe5012
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 61 additions and 3 deletions

View File

@ -13,5 +13,6 @@ packages:
- centos.amd64
- linux.amd64
- windows.amd64
- macos
- macos.amd64
- macos.arm64
- portable

View File

@ -17,7 +17,7 @@ RUN apt-get update -yqq \
libfreetype6-dev libssl-dev libssl1.1 liblttng-ust0
# Link to docker-build script
RUN ln -sf ${SOURCE_DIR}/deployment/build.macos /build.sh
RUN ln -sf ${SOURCE_DIR}/deployment/build.macos.amd64 /build.sh
VOLUME ${SOURCE_DIR}/

View File

@ -0,0 +1,26 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim
# Docker build arguments
ARG SOURCE_DIR=/jellyfin
ARG ARTIFACT_DIR=/dist
# Docker run environment
ENV SOURCE_DIR=/jellyfin
ENV ARTIFACT_DIR=/dist
ENV DEB_BUILD_OPTIONS=noddebs
ENV ARCH=amd64
ENV IS_DOCKER=YES
# Prepare Debian build environment
RUN apt-get update -yqq \
&& apt-get install -yqq --no-install-recommends \
debhelper gnupg devscripts \
mmv libcurl4-openssl-dev libfontconfig1-dev \
libfreetype6-dev libssl-dev libssl1.1 liblttng-ust0
# Link to docker-build script
RUN ln -sf ${SOURCE_DIR}/deployment/build.macos.arm64 /build.sh
VOLUME ${SOURCE_DIR}/
VOLUME ${ARTIFACT_DIR}/
ENTRYPOINT ["/build.sh"]

View File

@ -1,6 +1,6 @@
#!/bin/bash
#= MacOS 10.13+ .tar.gz
#= macOS 10.13+ amd64 .tar.gz
set -o errexit
set -o xtrace

31
deployment/build.macos.arm64 Executable file
View File

@ -0,0 +1,31 @@
#!/bin/bash
#= macOS 11.0+ arm64 .tar.gz
set -o errexit
set -o xtrace
# Move to source directory
pushd ${SOURCE_DIR}
# Get version
if [[ ${IS_UNSTABLE} == 'yes' ]]; then
version="${BUILD_ID}"
else
version="$( grep "version:" ./build.yaml | sed -E 's/version: "([0-9\.]+.*)"/\1/' )"
fi
# Build archives
dotnet publish Jellyfin.Server --configuration Release --self-contained --runtime osx-arm64 --output dist/jellyfin-server_${version}/ -p:DebugSymbols=false -p:DebugType=none -p:UseAppHost=true
tar -czf jellyfin-server_${version}_macos-arm64.tar.gz -C dist jellyfin-server_${version}
rm -rf dist/jellyfin-server_${version}
# Move the artifacts out
mkdir -p ${ARTIFACT_DIR}/
mv jellyfin[-_]*.tar.gz ${ARTIFACT_DIR}/
if [[ ${IS_DOCKER} == YES ]]; then
chown -Rc $(stat -c %u:%g ${ARTIFACT_DIR}) ${ARTIFACT_DIR}
fi
popd