ffmpeg: build and include zlib to enable PNG support (#21)
* add zlib to ffmpeg * checkout specific commit
This commit is contained in:
17
ffmpeg/build.sh
Normal file → Executable file
17
ffmpeg/build.sh
Normal file → Executable file
@@ -17,6 +17,18 @@ NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
|||||||
PREFIX="$DIR/build/prefix"
|
PREFIX="$DIR/build/prefix"
|
||||||
mkdir -p "$DIR/build"
|
mkdir -p "$DIR/build"
|
||||||
|
|
||||||
|
# --- Build zlib (static) ---
|
||||||
|
if [ ! -d "zlib-src" ]; then
|
||||||
|
git clone https://github.com/madler/zlib.git zlib-src
|
||||||
|
git -C zlib-src checkout da607da739fa6047df13e66a2af6b8bec7c2a498 # pin to v1.3.2
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd zlib-src
|
||||||
|
./configure --prefix="$PREFIX" --static
|
||||||
|
make -j"$NJOBS"
|
||||||
|
make install
|
||||||
|
cd "$DIR"
|
||||||
|
|
||||||
# --- Build x264 (static) ---
|
# --- Build x264 (static) ---
|
||||||
if [ ! -d "x264-src" ]; then
|
if [ ! -d "x264-src" ]; then
|
||||||
git clone --depth 1 --branch stable https://code.videolan.org/videolan/x264.git x264-src
|
git clone --depth 1 --branch stable https://code.videolan.org/videolan/x264.git x264-src
|
||||||
@@ -46,6 +58,7 @@ PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" \
|
|||||||
--enable-gpl \
|
--enable-gpl \
|
||||||
--enable-static \
|
--enable-static \
|
||||||
--disable-shared \
|
--disable-shared \
|
||||||
|
--enable-zlib \
|
||||||
--enable-libx264 \
|
--enable-libx264 \
|
||||||
--enable-pic \
|
--enable-pic \
|
||||||
--disable-doc \
|
--disable-doc \
|
||||||
@@ -75,7 +88,7 @@ cp "$PREFIX/bin/ffmpeg" "$INSTALL_DIR/bin/"
|
|||||||
cp "$PREFIX/bin/ffprobe" "$INSTALL_DIR/bin/"
|
cp "$PREFIX/bin/ffprobe" "$INSTALL_DIR/bin/"
|
||||||
|
|
||||||
# Libraries
|
# Libraries
|
||||||
for lib in libavformat.a libavcodec.a libavutil.a libswresample.a libx264.a; do
|
for lib in libavformat.a libavcodec.a libavutil.a libswresample.a libx264.a libz.a; do
|
||||||
cp "$PREFIX/lib/$lib" "$INSTALL_DIR/lib/"
|
cp "$PREFIX/lib/$lib" "$INSTALL_DIR/lib/"
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -88,7 +101,7 @@ done
|
|||||||
strip "$INSTALL_DIR/bin/ffmpeg" "$INSTALL_DIR/bin/ffprobe" 2>/dev/null || true
|
strip "$INSTALL_DIR/bin/ffmpeg" "$INSTALL_DIR/bin/ffprobe" 2>/dev/null || true
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
rm -rf x264-src ffmpeg-src "$DIR/build"
|
rm -rf zlib-src x264-src ffmpeg-src "$DIR/build"
|
||||||
|
|
||||||
echo "Installed ffmpeg to $INSTALL_DIR"
|
echo "Installed ffmpeg to $INSTALL_DIR"
|
||||||
du -sh "$INSTALL_DIR"
|
du -sh "$INSTALL_DIR"
|
||||||
|
|||||||
Reference in New Issue
Block a user