2021-08-31 19:15:32 +00:00
|
|
|
#!/bin/bash -x
|
|
|
|
|
|
|
|
EMAIL="himattmcwilliams@gmail.com"
|
|
|
|
NAME="Matt McWilliams"
|
2021-09-15 05:56:54 +00:00
|
|
|
BOOST_ROOT="/lib/x86_64-linux-gnu/"
|
|
|
|
#Build dir?
|
|
|
|
#BOOST_ROOT=/opt/libboost/lib
|
2021-08-31 19:15:32 +00:00
|
|
|
|
|
|
|
# https://jeromewu.github.io/build-ffmpeg-webassembly-version-part-3-v0.1/
|
|
|
|
# altered for povray
|
|
|
|
|
|
|
|
# verify Emscripten version
|
|
|
|
emcc -v > build.log
|
|
|
|
|
|
|
|
cd unix/
|
|
|
|
|
|
|
|
sh prebuild.sh
|
|
|
|
|
|
|
|
# configure povray
|
|
|
|
CFLAGS="-pthread -DBOOST_THREAD_USE_LIB -s USE_BOOST_HEADERS=1"
|
|
|
|
LDFLAGS="$CFLAGS -s INITIAL_MEMORY=33554432" # 33554432 bytes = 32 MB
|
|
|
|
CONFIG_ARGS=(
|
|
|
|
--arch=x86_32 # use x86_32 to achieve minimal architectural optimization
|
|
|
|
--enable-cross-compile # enable cross compile
|
|
|
|
--disable-x86asm # disable x86 asm
|
|
|
|
--disable-inline-asm # disable inline asm
|
|
|
|
--disable-stripping # disable stripping
|
|
|
|
--disable-programs # disable programs build (incl. ffplay, ffprobe & ffmpeg)
|
|
|
|
--disable-doc # disable doc
|
|
|
|
--extra-cflags="$CFLAGS"
|
|
|
|
--extra-cxxflags="$CFLAGS"
|
|
|
|
--extra-ldflags="$LDFLAGS"
|
|
|
|
--nm="llvm-nm -g"
|
|
|
|
--ar=emar
|
|
|
|
--as=llvm-as
|
|
|
|
--ranlib=llvm-ranlib
|
|
|
|
--cc=emcc
|
|
|
|
--cxx=em++
|
|
|
|
--objcc=emcc
|
|
|
|
--dep-cc=emcc
|
|
|
|
)
|
|
|
|
|
|
|
|
ARGS=(
|
|
|
|
LIBS="-lboost_system -lboost_thread -lboost_date_time"
|
|
|
|
COMPILED_BY="$NAME <$EMAIL>"
|
|
|
|
CC=emcc
|
|
|
|
CXX=em++
|
|
|
|
CFLAGS="$CFLAGS"
|
|
|
|
CXXFLAGS="$CFLAGS"
|
|
|
|
LDFLAGS="$LDFLAGS"
|
|
|
|
--host=wasm32
|
|
|
|
)
|
|
|
|
|
|
|
|
BOOST_ROOT=$BOOST_ROOT emconfigure ./configure "${ARGS[@]}"
|
|
|
|
|
|
|
|
# build dependencies
|
2021-09-15 20:10:38 +00:00
|
|
|
emmake make -j2
|
2021-08-31 19:15:32 +00:00
|
|
|
|
|
|
|
exit
|
|
|
|
|
|
|
|
# build ffmpeg.wasm
|
|
|
|
mkdir -p wasm/dist
|
|
|
|
ARGS=(
|
|
|
|
-I. -I./fftools
|
|
|
|
-Llibavcodec -Llibavdevice -Llibavfilter -Llibavformat -Llibavresample -Llibavutil -Llibpostproc -Llibswscale -Llibswresample
|
|
|
|
-Qunused-arguments
|
|
|
|
-o wasm/dist/ffmpeg.js fftools/ffmpeg_opt.c fftools/ffmpeg_filter.c fftools/ffmpeg_hw.c fftools/cmdutils.c fftools/ffmpeg.c
|
|
|
|
-lavdevice -lavfilter -lavformat -lavcodec -lswresample -lswscale -lavutil -lm
|
|
|
|
-s USE_SDL=2 # use SDL2
|
|
|
|
-s USE_PTHREADS=1 # enable pthreads support
|
|
|
|
-s INITIAL_MEMORY=33554432 # 33554432 bytes = 32 MB
|
|
|
|
)
|
|
|
|
emcc "${ARGS[@]}"
|