Skip to content

Commit 6ceca48

Browse files
author
Matt Keller
committed
progress in getting the libraries we want in the build
1 parent 8b606fa commit 6ceca48

File tree

4 files changed

+249
-21
lines changed

4 files changed

+249
-21
lines changed

.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
12.18.3

build-ffmpeg

Lines changed: 128 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,14 @@ else
4444
MJOBS=4
4545
fi
4646

47-
make_dir() {
48-
remove_dir "$1"
49-
if ! mkdir "$1"; then
50-
printf "\n Failed to create dir %s" "$1"
51-
exit 1
52-
fi
47+
CONFIGURE_OPTIONS+=("--extra-version=beamcube")
48+
49+
make_dir () {
50+
remove_dir "$1"
51+
if ! mkdir "$1"; then
52+
printf "\n Failed to create dir %s" "$1"
53+
exit 1
54+
fi
5355
}
5456

5557
remove_dir() {
@@ -358,6 +360,11 @@ if build "autoconf" "2.71"; then
358360
build_done "autoconf" "2.71"
359361
fi
360362

363+
if build "meson"; then
364+
execute python3 -m pip install meson ninja
365+
build_done "meson"
366+
fi
367+
361368
if build "automake" "1.16.4"; then
362369
download "https://ftp.gnu.org/gnu/automake/automake-1.16.4.tar.gz"
363370
execute ./configure --prefix="${WORKSPACE}"
@@ -492,6 +499,7 @@ fi
492499
mv libx265.a libx265_main.a
493500

494501
if [[ "$OSTYPE" == "darwin"* ]]; then
502+
execute install_name_tool -id "${WORKSPACE}/lib/libx265.198.dylib" libx265.198.dylib
495503
execute "${MACOS_LIBTOOL}" -static -o libx265.a libx265_main.a libx265_main10.a libx265_main12.a 2>/dev/null
496504
else
497505
execute ar -M <<EOF
@@ -528,7 +536,7 @@ if build "libvpx" "1.10.0"; then
528536
execute make -j $MJOBS
529537

530538
if [[ "$OSTYPE" == "darwin"* ]]; then
531-
install_name_tool -id "${WORKSPACE}/lib/libvpx.6.dylib" libvpx.6.dylib
539+
execute install_name_tool -id "${WORKSPACE}/lib/libvpx.6.dylib" libvpx.6.dylib
532540
fi
533541

534542
execute make install
@@ -569,13 +577,28 @@ CONFIGURE_OPTIONS+=("--enable-libvpx")
569577

570578
execute cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX="${WORKSPACE}" -DUSE_OMP=OFF -DENABLE_SHARED=on .
571579
execute make
580+
581+
if [[ "$OSTYPE" == "darwin"* ]]; then
582+
execute install_name_tool -id "${WORKSPACE}/lib/libvidstab.1.1.dylib" libvidstab.1.1.dylib
583+
fi
584+
572585
execute make install
573586

574587
build_done "vid_stab" "1.1.0"
575588
fi
576589
CONFIGURE_OPTIONS+=("--enable-libvidstab")
577590
# fi
578591

592+
if build "twolame"; then
593+
download "https://downloads.sourceforge.net/twolame/twolame-0.4.0.tar.gz"
594+
execute ./configure --prefix="${WORKSPACE}" --enable-shared --disable-static
595+
execute make -j $MJOBS
596+
execute make install
597+
598+
build_done "twolame"
599+
fi
600+
CONFIGURE_OPTIONS+=("--enable-libtwolame")
601+
579602
if build "av1" "ae2be80"; then
580603
# libaom ae2be80 == v3.1.2
581604
download "https://aomedia.googlesource.com/aom/+archive/ae2be8030200925895fa6e98bd274ffdb595cbf6.tar.gz" "av1.tar.gz" "av1"
@@ -587,6 +610,9 @@ if build "av1" "ae2be80"; then
587610
execute cmake -DEBUILD_SHARED_LIBS=1 -DENABLE_TESTS=0 -DCMAKE_INSTALL_PREFIX="${WORKSPACE}" -DCMAKE_INSTALL_LIBDIR=lib "$PACKAGES"/av1
588611
fi
589612
execute make -j $MJOBS
613+
if [[ "$OSTYPE" == "darwin"* ]]; then
614+
execute install_name_tool -id "${WORKSPACE}/lib/libaom.2.dylib" libaom.2.dylib
615+
fi
590616
execute make install
591617

592618
build_done "av1" "ae2be80"
@@ -605,6 +631,17 @@ if build "zimg" "3.0.3"; then
605631
fi
606632
CONFIGURE_OPTIONS+=("--enable-libzimg")
607633

634+
# get prebuilt binaries
635+
if build "openh264"; then
636+
download "https://github.com/cisco/openh264/archive/v2.1.1.tar.gz" "openh264-2.1.1.tar.gz"
637+
execute export PREFIX="${WORKSPACE}"
638+
execute make
639+
execute make install-shared
640+
641+
build_done "openh264"
642+
fi
643+
CONFIGURE_OPTIONS+=("--enable-libopenh264")
644+
608645
##
609646
## audio library
610647
##
@@ -713,7 +750,7 @@ fi
713750

714751
if build "libvorbis" "1.3.6"; then
715752
download "https://ftp.osuosl.org/pub/xiph/releases/vorbis/libvorbis-1.3.6.tar.gz"
716-
execute ./configure --prefix="${WORKSPACE}" --with-ogg-libraries="${WORKSPACE}"/lib --with-ogg-includes="${WORKSPACE}"/include/ --disable-static --enable-shared --disable-oggtest
753+
OGG_CFLAGS="-I${WORKSPACE}/include/ogg" OGG_LIBS="-L${WORKSPACE}/lib -logg" execute ./configure --prefix="${WORKSPACE}" --with-ogg-libraries="${WORKSPACE}"/lib --with-ogg-includes="${WORKSPACE}"/include/ --disable-static --enable-shared --disable-oggtest
717754
execute make -j $MJOBS
718755
execute make install
719756

@@ -726,14 +763,47 @@ if build "libtheora" "1.1.1"; then
726763
sed "s/-fforce-addr//g" configure >configure.patched
727764
chmod +x configure.patched
728765
mv configure.patched configure
729-
execute ./configure --prefix="${WORKSPACE}" --with-ogg-libraries="${WORKSPACE}"/lib --with-ogg-includes="${WORKSPACE}"/include/ --with-vorbis-libraries="${WORKSPACE}"/lib --with-vorbis-includes="${WORKSPACE}"/include/ --disable-static --enable-shared --disable-oggtest --disable-vorbistest --disable-examples --disable-asm --disable-spec
766+
OGG_CFLAGS="-I${WORKSPACE}/include/ogg" OGG_LIBS="-L${WORKSPACE}/lib -logg" execute ./configure --prefix="${WORKSPACE}" --with-ogg-libraries="${WORKSPACE}"/lib --with-ogg-includes="${WORKSPACE}"/include/ --with-vorbis-libraries="${WORKSPACE}"/lib --with-vorbis-includes="${WORKSPACE}"/include/ --disable-static --enable-shared --disable-oggtest --disable-vorbistest --disable-examples --disable-asm --disable-spec
730767
execute make -j $MJOBS
731768
execute make install
732769

733770
build_done "libtheora" "1.1.1"
734771
fi
735772
CONFIGURE_OPTIONS+=("--enable-libtheora")
736773

774+
if build "shine"; then
775+
download "https://github.com/toots/shine/archive/3.1.1.tar.gz" "shine-3.1.1.tar.gz"
776+
execute autoreconf -i
777+
execute ./configure --prefix="${WORKSPACE}" --enable-shared --disable-static
778+
execute make -j $MJOBS
779+
execute make install
780+
781+
build_done "shine"
782+
fi
783+
CONFIGURE_OPTIONS+=("--enable-libshine")
784+
785+
if build "soxr"; then
786+
download "http://ftp.debian.org/debian/pool/main/libs/libsoxr/libsoxr_0.1.3.orig.tar.xz" "soxr-0.1.3.tar.xz"
787+
make_dir build
788+
cd build || exit
789+
execute cmake .. -DWITH_OPENMP:BOOL=OFF -Wno-dev -DCMAKE_INSTALL_PREFIX="${WORKSPACE}" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS:BOOL=ON
790+
execute make -j $MJOBS
791+
execute make install
792+
793+
build_done "soxr"
794+
fi
795+
CONFIGURE_OPTIONS+=("--enable-libsoxr")
796+
797+
if build "speex"; then
798+
download "http://downloads.us.xiph.org/releases/speex/speex-1.2.0.tar.gz"
799+
execute ./configure --prefix="${WORKSPACE}" --enable-shared --disable-static
800+
execute make -j $MJOBS
801+
execute make install
802+
803+
build_done "speex"
804+
fi
805+
CONFIGURE_OPTIONS+=("--enable-libspeex")
806+
737807
##
738808
## image library
739809
##
@@ -770,6 +840,19 @@ if build "libwebp" "1.2.0"; then
770840
fi
771841
CONFIGURE_OPTIONS+=("--enable-libwebp")
772842

843+
if build "openjpeg"; then
844+
download "https://github.com/uclouvain/openjpeg/archive/v2.3.1.tar.gz" "openjpeg-v2.3.1.tar.gz"
845+
make_dir build
846+
cd build || exit
847+
execute cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${WORKSPACE}" -DBUILD_SHARED_LIBS:bool=on
848+
execute make -j $MJOBS
849+
execute make install
850+
851+
build_done "openjpeg"
852+
fi
853+
CONFIGURE_OPTIONS+=("--enable-libopenjpeg")
854+
855+
773856
##
774857
## other library
775858
##
@@ -783,21 +866,40 @@ if build "libsdl" "2.0.14"; then
783866
build_done "libsdl" "2.0.14"
784867
fi
785868

786-
#if build "srt"; then
787-
# download "https://github.com/Haivision/srt/archive/v1.4.1.tar.gz" "srt-1.4.1.tar.gz"
788-
# export OPENSSL_ROOT_DIR="${WORKSPACE}"
789-
# export OPENSSL_LIB_DIR="${WORKSPACE}"/lib
790-
# export OPENSSL_INCLUDE_DIR="${WORKSPACE}"/include/
791-
# execute cmake . -DCMAKE_INSTALL_PREFIX="${WORKSPACE}" -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_BINDIR=bin -DCMAKE_INSTALL_INCLUDEDIR=include -DENABLE_SHARED=ON -DENABLE_STATIC=OFF -DENABLE_APPS=OFF -DUSE_STATIC_LIBSTDCXX=ON
869+
if build "snappy"; then
870+
download "https://github.com/google/snappy/archive/1.1.8.tar.gz"
871+
make_dir build
872+
cd build || exit
873+
execute cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${WORKSPACE}" -DBUILD_SHARED_LIBS:bool=on
874+
execute make -j $MJOBS
875+
876+
if [[ "$OSTYPE" == "darwin"* ]]; then
877+
execute install_name_tool -id "${WORKSPACE}/lib/libsnappy.1.dylib" libsnappy.1.dylib
878+
fi
879+
880+
execute make install
881+
882+
build_done "snappy"
883+
fi
884+
CONFIGURE_OPTIONS+=("--enable-libsnappy")
885+
886+
if build "xz"; then
887+
download "https://tukaani.org/xz/xz-5.2.5.tar.gz"
888+
execute ./configure --prefix="${WORKSPACE}" --enable-shared --disable-static
889+
execute make -j $MJOBS
890+
execute make install
891+
892+
build_done "xz"
893+
fi
894+
895+
#if build "libass"; then
896+
# download "https://github.com/libass/libass/releases/download/0.15.0/libass-0.15.0.tar.gz"
897+
# execute ./configure --prefix="${WORKSPACE}" --enable-shared --disable-static
898+
# execute make -j $MJOBS
792899
# execute make install
793900
#
794-
# if [ -n "$LDEXEFLAGS" ]; then
795-
# 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
796-
# fi
797-
#
798-
# build_done "srt"
901+
# build_done "libass"
799902
#fi
800-
#CONFIGURE_OPTIONS+=("--enable-libsrt")
801903

802904

803905
##
@@ -921,4 +1023,9 @@ elif [[ ! "$SKIPINSTALL" == "yes" ]]; then
9211023
esac
9221024
fi
9231025

1026+
cd $CWD
1027+
if [[ "$OSTYPE" == "darwin"* ]]; then
1028+
node copy_mac_libs.js
1029+
fi
1030+
9241031
exit 0

config-target.txt

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
❌ don't need
2+
✅ already in ffmpeg-build-script build
3+
🕒 need to add to ffmpeg-build-script
4+
5+
Target (evermeet.cx static build)
6+
--cc=/usr/bin/clang
7+
--prefix=/opt/ffmpeg
8+
--extra-version=tessus
9+
❌ --enable-avisynth - non-linear editing
10+
❌ --enable-fontconfig
11+
✅ --enable-gpl
12+
✅ --enable-libaom
13+
❌ --enable-libass
14+
❌ --enable-libbluray - bluray playback
15+
🕒✅ --enable-libdav1d
16+
❌ --enable-libfreetype - text rendering
17+
❌ --enable-libgsm - GSM audio
18+
❌ --enable-libmodplug - midi/instrument support https://github.com/Konstanty/libmodplug
19+
✅ --enable-libmp3lame
20+
❌ --enable-libmysofa - spatial audio
21+
✅ --enable-libopencore-amrnb
22+
✅ --enable-libopencore-amrwb
23+
🕒✅ --enable-libopenh264
24+
🕒✅ --enable-libopenjpeg
25+
✅ --enable-libopus
26+
❌ --enable-librubberband - time stretching
27+
🕒✅ --enable-libshine - mp3 encoder
28+
🕒✅ --enable-libsnappy - compression/decompression
29+
🕒✅ --enable-libsoxr - resampling
30+
🕒✅ --enable-libspeex - speex audio file format
31+
✅ --enable-libtheora
32+
🕒✅ --enable-libtwolame - mpeg2
33+
✅ --enable-libvidstab
34+
❌ --enable-libvmaf - perceptual video quality metric
35+
❌ --enable-libvo-amrwbenc - VisualOn AMR-WB encoder library
36+
✅ --enable-libvorbis
37+
✅ --enable-libvpx
38+
✅ --enable-libwebp
39+
✅ --enable-libx264
40+
✅ --enable-libx265
41+
❌ --enable-libxavs - AV standard of China
42+
✅ --enable-libxvid
43+
🕒✅ --enable-libzimg - Scaling, colorspace conversion, and dithering library
44+
❌ --enable-libzmq - ZeroMQ Support To Let Multiple Clients Connect To A Single Instance (streaming)
45+
❌ --enable-libzvbi - capture and decode VBI (vertical blanking interval) data
46+
✅ --enable-version3
47+
--pkg-config-flags=--static
48+
--disable-ffplay

copy_mac_libs.js

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
const { resolve, basename } = require('path');
2+
const { mkdirSync } = require('fs');
3+
const { execSync } = require('child_process');
4+
5+
function logAndExec(cmd) {
6+
console.log(`EXEC ${cmd}`);
7+
execSync(cmd);
8+
}
9+
10+
const baseBinDir = resolve(__dirname, 'workspace/bin');
11+
const baseLibDir = resolve(__dirname, 'workspace/lib');
12+
const destDir = resolve(__dirname, 'workspace/mac');
13+
14+
logAndExec(`rm -r ${destDir}`);
15+
logAndExec(`mkdir -p ${destDir}`);
16+
17+
const skippedLibs = new Set();
18+
const copiedLibs = new Set();
19+
const missingLibs = new Set();
20+
21+
function copyDylibs(binaryName, base = baseBinDir) {
22+
const origPath = resolve(base, binaryName);
23+
const binaryPath = resolve(destDir, binaryName);
24+
logAndExec(`cp ${origPath} ${binaryPath}`);
25+
26+
console.log(`Inspecting ${binaryPath}`);
27+
const lines = execSync(`otool -L ${binaryPath}`).toString('utf8').split('\n');
28+
const libsToRewrite = [];
29+
for (const line of lines) {
30+
const match = /[^\s:]+/.exec(line);
31+
if (!match) {
32+
continue;
33+
}
34+
const [path] = match;
35+
if (path.startsWith('/usr/local')) {
36+
missingLibs.add(path);
37+
} else if (path.startsWith('/Users')) {
38+
const filename = basename(path);
39+
const newFilename = resolve(destDir, filename);
40+
if (!copiedLibs.has(path)) {
41+
copiedLibs.add(path);
42+
copiedLibs.add(newFilename);
43+
if (path !== newFilename) {
44+
logAndExec(`cp ${path} ${newFilename}`);
45+
logAndExec(`chmod u+w ${newFilename}`);
46+
copyDylibs(filename, baseLibDir);
47+
}
48+
}
49+
libsToRewrite.push({path, filename});
50+
} else {
51+
skippedLibs.add(path);
52+
}
53+
}
54+
if (libsToRewrite.length > 0) {
55+
logAndExec(`install_name_tool -id @loader_path/${binaryName} ${libsToRewrite.map(({path, filename}) => `-change ${path} @loader_path/${filename}`).join(' ')} ${binaryPath}`);
56+
}
57+
}
58+
59+
copyDylibs('ffmpeg');
60+
copyDylibs('ffprobe');
61+
62+
for (const lib of Array.from(skippedLibs).sort()) {
63+
console.log(`[NOTE] skipped ${lib}`);
64+
}
65+
for (const lib of Array.from(copiedLibs).sort()) {
66+
if (!lib.startsWith(destDir)) {
67+
console.log(`Copied ${lib}`);
68+
}
69+
}
70+
for (const lib of Array.from(missingLibs).sort()) {
71+
console.log(`[WARNING] missing ${lib}`);
72+
}

0 commit comments

Comments
 (0)