33SCRIPT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) "
44source ${SCRIPT_DIR} /base.sh
55
6- rm -rf ${ARTIFACT_DIR}
7- mkdir -p ${RUNTIME_LIB_DIR}
8- mkdir -p ${ARTIFACT_DIR}
9-
106
117# ==============================================================================
128# Build Libraries
139# ==============================================================================
1410
15- echo " macOS library build script"
16- echo " Currently no additional libraries are built."
17- echo " This structure allows for future library additions."
11+ #
12+ # Video
13+ #
14+
15+ # Build libvpx
16+ LIBVPX_REPO=" https://chromium.googlesource.com/webm/libvpx.git"
17+ LIBVPX_TAG_PREFIX=" v"
18+ LIBVPX_VERSION=" 1.15.2" # get_latest_tag ${LIBVPX_REPO} ${LIBVPX_TAG_PREFIX}
19+ git_clone ${LIBVPX_REPO} ${LIBVPX_TAG_PREFIX}${LIBVPX_VERSION}
20+ ./configure --prefix=" ${PREFIX} " --disable-shared --enable-static --enable-pic --disable-examples \
21+ --disable-tools --disable-docs --disable-unit-tests --enable-vp9-highbitdepth --as=yasm
22+ do_make_and_make_install
23+ FFMPEG_CONFIGURE_OPTIONS+=(" --enable-libvpx" )
24+
25+ # Build x264
26+ download_and_unpack_file " https://code.videolan.org/videolan/x264/-/archive/master/x264-master.tar.bz2"
27+ do_configure " --cross-prefix=${CROSS_PREFIX} --enable-static --enable-pic --disable-cli --disable-lavf --disable-swscale"
28+ do_make_and_make_install
29+ FFMPEG_CONFIGURE_OPTIONS+=(" --enable-libx264" )
30+
31+ # Build x265
32+ X265_VERSION=" master"
33+ git_clone " https://bitbucket.org/multicoreware/x265_git" " ${X265_VERSION} "
34+ mkcd build
35+ mkdir -p 8bit 10bit 12bit
36+
37+ cd 12bit
38+ do_cmake " -DHIGH_BIT_DEPTH=1 -DEXPORT_C_API=0 -DENABLE_SHARED=0 -DBUILD_SHARED_LIBS=0 -DENABLE_CLI=0 -DENABLE_TESTS=0 -DMAIN12=1" ../../source
39+ make -j ${CPU_NUM}
40+ cp libx265.a ../8bit/libx265_main12.a
41+
42+ cd ../10bit
43+ do_cmake " -DHIGH_BIT_DEPTH=1 -DEXPORT_C_API=0 -DENABLE_SHARED=0 -DBUILD_SHARED_LIBS=0 -DENABLE_CLI=0 -DENABLE_TESTS=0" ../../source
44+ make -j ${CPU_NUM}
45+ cp libx265.a ../8bit/libx265_main10.a
46+
47+ cd ../8bit
48+ do_cmake ' -DEXTRA_LIB="x265_main10.a;x265_main12.a" -DEXTRA_LINK_FLAGS=-L. -DLINKED_10BIT=1 -DLINKED_12BIT=1
49+ -DENABLE_SHARED=0 -DBUILD_SHARED_LIBS=0 -DENABLE_CLI=0 -DENABLE_TESTS=0' ../../source
50+ make -j ${CPU_NUM}
51+
52+ mv libx265.a libx265_main.a
53+
54+ libtool -static -o libx265.a libx265_main.a libx265_main10.a libx265_main12.a
55+
56+ make install
57+ cat << EOS > ${PKG_CONFIG_PATH} /x265.pc
58+ prefix=${PREFIX}
59+ exec_prefix=\$ {prefix}
60+ libdir=\$ {exec_prefix}/lib
61+ includedir=\$ {prefix}/include
62+
63+ Name: x265
64+ Description: H.265 (HEVC) encoder library
65+ Version: 5.0
66+
67+ Libs: -L\$ {libdir} -lx265 -lpthread -lstdc++
68+ Cflags: -I\$ {includedir}
69+ EOS
70+ FFMPEG_CONFIGURE_OPTIONS+=(" --enable-libx265" )
71+
72+ # Build libaom
73+ LIBAOM_REPO=" https://aomedia.googlesource.com/aom.git"
74+ LIBAOM_TAG_PREFIX=" v"
75+ LIBAOM_VERSION=" 3.13.1" # get_latest_tag ${LIBAOM_REPO} ${LIBAOM_TAG_PREFIX}
76+ git_clone ${LIBAOM_REPO} ${LIBAOM_TAG_PREFIX}${LIBAOM_VERSION}
77+ mkcd _build
78+ do_cmake " -DBUILD_SHARED_LIBS=0 -DENABLE_DOCS=0 -DENABLE_TESTS=0 -DENABLE_EXAMPLES=0" ..
79+ do_make_and_make_install
80+ FFMPEG_CONFIGURE_OPTIONS+=(" --enable-libaom" )
81+
1882
19- # 将来的にここにライブラリビルドを追加可能
20- # 例:
21- # - x264
22- # - x265
23- # - libvpx
24- # など
83+ #
84+ # Audio
85+ #
86+
87+ # Build opus
88+ OPUS_REPO=" https://github.com/xiph/opus.git"
89+ OPUS_TAG_PREFIX=" v"
90+ OPUS_VERSION=" 1.6" # get_latest_tag ${OPUS_REPO} ${OPUS_TAG_PREFIX}
91+ git_clone ${OPUS_REPO} ${OPUS_TAG_PREFIX}${OPUS_VERSION}
92+ mkcd build
93+ do_cmake " -DBUILD_SHARED_LIBS=0 -DBUILD_TESTING=0" ..
94+ do_make_and_make_install
95+ FFMPEG_CONFIGURE_OPTIONS+=(" --enable-libopus" )
96+
97+ # Build mp3lame
98+ svn_checkout " https://svn.code.sf.net/p/lame/svn/trunk/lame"
99+ do_configure " --disable-shared --enable-static --enable-nasm --disable-decoder --disable-gtktest --disable-cpml --disable-frontend"
100+ do_make_and_make_install
101+ FFMPEG_CONFIGURE_OPTIONS+=(" --enable-libmp3lame" )
25102
26103
27104# ------------------------------------------------------------------------------
28105# Prepare FFmpeg Build Options
29106# ------------------------------------------------------------------------------
30107
31108# Write library options to files for FFmpeg configure
32- # echo -n "${FFMPEG_EXTRA_LIBS[@]}" > ${PREFIX}/ffmpeg_extra_libs
33- # echo -n "${FFMPEG_CONFIGURE_OPTIONS[@]}" > ${PREFIX}/ffmpeg_configure_options
34- touch ${PREFIX} /ffmpeg_extra_libs
35- touch ${PREFIX} /ffmpeg_configure_options
36-
109+ echo -n " ${FFMPEG_CONFIGURE_OPTIONS[@]} " > ${PREFIX} /ffmpeg_configure_options
37110
38111# ==============================================================================
39112# Build FFmpeg
@@ -53,7 +126,6 @@ git_clone "https://github.com/FFmpeg/FFmpeg.git" n${FFMPEG_VERSION}
53126 --enable-version3 \
54127 --enable-videotoolbox \
55128 --enable-neon \
56- --extra-libs=" ` cat ${PREFIX} /ffmpeg_extra_libs` " \
57129 --pkg-config-flags=" --static" \
58130 --prefix=${PREFIX} | tee ${PREFIX} /configure_options 1>&2
59131
@@ -66,13 +138,7 @@ do_strip ${PREFIX}/bin "ff*"
66138# Finalize - Copy build artifacts to output directory
67139# ==============================================================================
68140
69- # Copy library files
70- # cp_archive ${PREFIX}/lib/*{.a,.la} ${ARTIFACT_DIR}
71- # cp_archive ${PREFIX}/lib/pkgconfig ${ARTIFACT_DIR}
72- # cp_archive ${PREFIX}/include ${ARTIFACT_DIR}
73-
74141# Copy FFmpeg build options (for reference)
75- cp_archive ${PREFIX} /ffmpeg_extra_libs ${ARTIFACT_DIR}
76142cp_archive ${PREFIX} /ffmpeg_configure_options ${ARTIFACT_DIR}
77143
78144# Copy FFmpeg binaries and configuration
0 commit comments