Skip to content

Commit

Permalink
macOS Ventura and Sonoma Updates and Housekeeping. (#66)
Browse files Browse the repository at this point in the history
Updates for macOS Ventura/Sonoma, disable Apple Silicon GH runners
(requires paid accounts), and some housekeeping.
  • Loading branch information
hjdhjd authored Oct 7, 2023
1 parent bc86b59 commit 7303558
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 39 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
alpine-aarch64,
alpine-arm32v7,
alpine-x86_64,
darwin-arm64,
# darwin-arm64,
darwin-x86_64,
windows-x86_64
]
Expand Down Expand Up @@ -55,8 +55,8 @@ jobs:
TARGET_OS: alpine

# Build for Apple Silicon macOS environments.
- name: darwin-arm64
os: macos-13-large
# - name: darwin-arm64
# os: macos-13-large

# Build for Intel macOS environments.
- name: darwin-x86_64
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Specifically, we provide:
|-------------------------------------|--------------------------------|
| FreeBSD | x86_64 |
| Linux | x86_64, armv7l, aarch64 |
| macOS (10.14 (Mojave) or newer) | x86_64, arm64 (Apple Silicon) |
| macOS 13.0 (Ventura) or newer | x86_64, arm64 (Apple Silicon) |
| Raspberry Pi 3 or better (Raspbian) | armv7l, aarch64 |
| Windows 10 or newer | x86_64 |

Expand Down
27 changes: 16 additions & 11 deletions build-ffmpeg
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ fi

if build "giflib" "5.2.1"; then

download "https://netcologne.dl.sourceforge.net/project/giflib/giflib-5.2.1.tar.gz"
download "https://downloads.sourceforge.net/project/giflib/giflib-5.2.1.tar.gz"

if [[ "${TARGET_OS}" == "darwin" ]]; then

Expand Down Expand Up @@ -870,7 +870,7 @@ EOF

if [ -n "${LDEXEFLAGS}" ]; then

sed -i.backup 's/-lgcc_s/-lgcc_eh/g' "${WORKSPACE}/lib/pkgconfig/x265.pc" # The -i.backup is intended and required on MacOS: https://stackoverflow.com/questions/5694228/sed-in-place-flag-that-works-both-on-mac-bsd-and-linux
sed -i.backup 's/-lgcc_s/-lgcc_eh/g' "${WORKSPACE}/lib/pkgconfig/x265.pc" # The -i.backup is intended and required on macOS: https://stackoverflow.com/questions/5694228/sed-in-place-flag-that-works-both-on-mac-bsd-and-linux
fi

build_done "x265" "latest"
Expand All @@ -887,8 +887,8 @@ if build "libvpx" "1.13.0"; then
if [[ "${TARGET_OS}" == "darwin" ]]; then

echo "Applying Darwin patch"
sed "s/,--version-script//g" build/make/Makefile >build/make/Makefile.patched
sed "s/-Wl,--no-undefined -Wl,-soname/-Wl,-undefined,error -Wl,-install_name/g" build/make/Makefile.patched >build/make/Makefile
sed "s/,--version-script//g" build/make/Makefile > build/make/Makefile.patched
sed "s/-Wl,--no-undefined -Wl,-soname/-Wl,-undefined,error -Wl,-install_name/g" build/make/Makefile.patched > build/make/Makefile
fi

execute ./configure --prefix="${WORKSPACE}" --disable-unit-tests --disable-shared --disable-examples --as=yasm --enable-vp9-highbitdepth
Expand Down Expand Up @@ -1036,7 +1036,7 @@ if command_exists "python3"; then

if build "pcre" "8.45"; then

download "https://altushost-swe.dl.sourceforge.net/project/pcre/pcre/8.45/pcre-8.45.tar.gz" "pcre-8.45.tar.gz"
download "https://downloads.sourceforge.net/project/pcre/pcre/8.45/pcre-8.45.tar.gz" "pcre-8.45.tar.gz"

execute ./configure --prefix="${WORKSPACE}" --disable-shared --enable-static
execute make -j ${MJOBS}
Expand Down Expand Up @@ -1089,7 +1089,7 @@ if ! isLinux; then

if build "opencore" "0.1.6"; then

download "https://netactuate.dl.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.6.tar.gz" "opencore-amr-0.1.6.tar.gz"
download "https://downloads.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.6.tar.gz" "opencore-amr-0.1.6.tar.gz"

execute ./configure --prefix="${WORKSPACE}" --disable-shared --enable-static
execute make -j ${MJOBS}
Expand All @@ -1105,7 +1105,7 @@ if ! isLinux; then

if build "lame" "3.100"; then

download "https://sourceforge.net/projects/lame/files/lame/3.100/lame-3.100.tar.gz/download?use_mirror=gigenet" "lame-3.100.tar.gz"
download "https://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz" "lame-3.100.tar.gz"

execute ./configure --prefix="${WORKSPACE}" --disable-shared --enable-static
execute make -j ${MJOBS}
Expand Down Expand Up @@ -1147,6 +1147,11 @@ if ! isLinux; then

download "https://ftp.osuosl.org/pub/xiph/releases/vorbis/libvorbis-1.3.7.tar.gz"

if [[ "${TARGET_OS}" == "darwin" ]]; then

sed -i.backup 's/-force_cpusubtype_ALL //g' configure # The -i.backup is intended and required on macOS: https://stackoverflow.com/questions/5694228/sed-in-place-flag-that-works-both-on-mac-bsd-and-linux
fi

execute ./configure --prefix="${WORKSPACE}" --with-ogg-libraries="${WORKSPACE}"/lib --with-ogg-includes="${WORKSPACE}"/include/ --enable-static --disable-shared --disable-oggtest
execute make -j ${MJOBS}
execute make install
Expand All @@ -1163,7 +1168,7 @@ if ! isLinux; then

download "https://ftp.osuosl.org/pub/xiph/releases/theora/libtheora-1.1.1.tar.gz"

sed "s/-fforce-addr//g" configure >configure.patched
sed "s/-fforce-addr//g" configure > configure.patched
chmod +x configure.patched
mv configure.patched configure

Expand Down Expand Up @@ -1201,7 +1206,7 @@ if ${NONFREE_AND_GPL}; then

if build "fdk_aac" "2.0.2"; then

download "https://sourceforge.net/projects/opencore-amr/files/fdk-aac/fdk-aac-2.0.2.tar.gz/download?use_mirror=gigenet" "fdk-aac-2.0.2.tar.gz"
download "https://downloads.sourceforge.net/project/opencore-amr/fdk-aac/fdk-aac-2.0.2.tar.gz" "fdk-aac-2.0.2.tar.gz"

execute ./configure --prefix="${WORKSPACE}" --disable-shared --enable-static --enable-pic
execute make -j ${MJOBS}
Expand Down Expand Up @@ -1235,7 +1240,7 @@ if ! isLinux; then

if build "libpng" "1.6.39"; then

download "https://gigenet.dl.sourceforge.net/project/libpng/libpng16/1.6.39/libpng-1.6.39.tar.gz" "libpng-1.6.39.tar.gz"
download "https://downloads.sourceforge.net/project/libpng/libpng16/1.6.39/libpng-1.6.39.tar.gz" "libpng-1.6.39.tar.gz"

export LDFLAGS="${LDFLAGS}"
export CPPFLAGS="${CFLAGS}"
Expand Down Expand Up @@ -1307,7 +1312,7 @@ if ${NONFREE_AND_GPL}; then

if [ -n "${LDEXEFLAGS}" ]; then

sed -i.backup 's/-lgcc_s/-lgcc_eh/g' "${WORKSPACE}"/lib/pkgconfig/srt.pc # The -i.backup is intended and required on MacOS: https://stackoverflow.com/questions/5694228/sed-in-place-flag-that-works-both-on-mac-bsd-and-linux
sed -i.backup 's/-lgcc_s/-lgcc_eh/g' "${WORKSPACE}"/lib/pkgconfig/srt.pc # The -i.backup is intended and required on macOS: https://stackoverflow.com/questions/5694228/sed-in-place-flag-that-works-both-on-mac-bsd-and-linux
fi

build_done "srt" "1.5.1"
Expand Down
34 changes: 16 additions & 18 deletions build-macOS.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
#!/bin/sh

#!/bin/zsh
set -e

WORKDIR=$(pwd)
BUILD_TARGET=/Users/Shared/ffmpeg-for-homebridge
# Get the operating system and architecture to create the target in system-arch form.
TARGET="$(uname -s | awk '{print tolower($0)}')-$(uname -m)"

if [ ! -f "$WORKDIR/build-ffmpeg" ]; then
echo "Execute this script from inside the ffmpeg-for-homebridge project directory."
exit 1
fi
# Create our workspace.
rm -rf "${TARGET}"
mkdir -p "${TARGET}"
cd ${TARGET}

mkdir -p $BUILD_TARGET
cd $BUILD_TARGET
# Build FFmpeg.
SKIPINSTALL=yes VERBOSE=yes ../build-ffmpeg --build --enable-gpl-and-non-free

export SKIPINSTALL=yes
# Package FFmpeg.
echo "Packaging FFmpeg."
mkdir -p package/usr/local/bin/

$WORKDIR/build-ffmpeg --build --enable-gpl-and-non-free
# Emulate the filesystem hierarchy so it's easily discoverable in a user's path environment variable.
cp workspace/bin/ffmpeg package/usr/local/bin/ffmpeg

rm -rf $BUILD_TARGET/upload
mkdir -p $BUILD_TARGET/upload/usr/bin/local
cp $BUILD_TARGET/workspace/bin/ffmpeg upload/usr/bin/local/
tar -C $BUILD_TARGET/upload -zcvf ffmpeg-darwin-$(uname -m).tar.gz .
cp ffmpeg-darwin-$(uname -m).tar.gz $WORKDIR/
# Now we package it all up.
tar -C package -zcvf ffmpeg-${TARGET}.tar.gz .

echo "File to upload at $WORKDIR/ffmpeg-darwin-$(uname -m).tar.gz"
6 changes: 3 additions & 3 deletions install.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async function getDownloadFileName() {

case "darwin":

if (parseInt(os.release()) >= 18) {
if (parseInt(os.release()) >= 22) {

switch (process.arch) {

Expand Down Expand Up @@ -191,9 +191,9 @@ async function install() {

if (!ffmpegDownloadFileName) {

if (os.platform() === "darwin" && parseInt(os.release()) < 18) {
if (os.platform() === "darwin" && parseInt(os.release()) < 22) {

console.log("ffmpeg-for-homebridge: macOS versions older than 10.14 (Mojave) are not supported, you will need to install a working version of FFmpeg manually.");
console.log("ffmpeg-for-homebridge: macOS versions older than 13 (Ventura) are not supported, you will need to install a working version of FFmpeg manually.");
} else {

console.log("ffmpeg-for-homebridge: %s %s is not supported, you will need to install a working version of FFmpeg manually.", os.platform, process.arch);
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ffmpeg-for-homebridge",
"version": "2.1.0",
"version": "2.1.1",
"description": "Static FFmpeg binaries for Homebridge with support for audio (libfdk-aac) and hardware encoding (h264_v4l2m2m and h264_qsv).",
"author": {
"name": "The Homebridge Team",
Expand Down

0 comments on commit 7303558

Please sign in to comment.