Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
a2e1c64a
Commit
a2e1c64a
authored
Jul 17, 2021
by
Jerome Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update build scripts to build single thread version
parent
b59fb556
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
118 additions
and
83 deletions
+118
-83
build-with-docker.sh
build-with-docker.sh
+1
-0
build.sh
build.sh
+2
-2
build-aom.sh
wasm/build-scripts/build-aom.sh
+0
-1
build-fdk-aac.sh
wasm/build-scripts/build-fdk-aac.sh
+3
-4
build-ffmpeg.sh
wasm/build-scripts/build-ffmpeg.sh
+21
-7
build-freetype2.sh
wasm/build-scripts/build-freetype2.sh
+6
-4
build-fribidi.sh
wasm/build-scripts/build-fribidi.sh
+3
-5
build-harfbuzz.sh
wasm/build-scripts/build-harfbuzz.sh
+2
-4
build-lame.sh
wasm/build-scripts/build-lame.sh
+1
-2
build-libass.sh
wasm/build-scripts/build-libass.sh
+2
-2
build-libvpx.sh
wasm/build-scripts/build-libvpx.sh
+12
-5
build-libwebp.sh
wasm/build-scripts/build-libwebp.sh
+1
-2
build-ogg.sh
wasm/build-scripts/build-ogg.sh
+2
-3
build-opus.sh
wasm/build-scripts/build-opus.sh
+2
-3
build-theora.sh
wasm/build-scripts/build-theora.sh
+2
-4
build-vorbis.sh
wasm/build-scripts/build-vorbis.sh
+2
-4
build-wavpack.sh
wasm/build-scripts/build-wavpack.sh
+2
-3
build-x264.sh
wasm/build-scripts/build-x264.sh
+16
-8
build-x265.sh
wasm/build-scripts/build-x265.sh
+3
-5
build-zlib.sh
wasm/build-scripts/build-zlib.sh
+1
-2
configure-ffmpeg.sh
wasm/build-scripts/configure-ffmpeg.sh
+1
-1
var.sh
wasm/build-scripts/var.sh
+33
-12
No files found.
build-with-docker.sh
View file @
a2e1c64a
...
@@ -9,5 +9,6 @@ docker run \
...
@@ -9,5 +9,6 @@ docker run \
--rm
\
--rm
\
-v
$PWD
:/src
\
-v
$PWD
:/src
\
-v
$PWD
/wasm/cache:/emsdk_portable/.data/cache/wasm
\
-v
$PWD
/wasm/cache:/emsdk_portable/.data/cache/wasm
\
-e
FFMPEG_ST
=
${
FFMPEG_ST
:-
no
}
\
emscripten/emsdk:
$EM_VERSION
\
emscripten/emsdk:
$EM_VERSION
\
sh
-c
'bash ./build.sh'
sh
-c
'bash ./build.sh'
build.sh
View file @
a2e1c64a
...
@@ -30,10 +30,10 @@ $SCRIPT_ROOT/build-vorbis.sh
...
@@ -30,10 +30,10 @@ $SCRIPT_ROOT/build-vorbis.sh
$SCRIPT_ROOT
/build-theora.sh
$SCRIPT_ROOT
/build-theora.sh
# build opus
# build opus
$SCRIPT_ROOT
/build-opus.sh
$SCRIPT_ROOT
/build-opus.sh
# build freetype2
$SCRIPT_ROOT
/build-freetype2.sh
# build libwebp
# build libwebp
$SCRIPT_ROOT
/build-libwebp.sh
$SCRIPT_ROOT
/build-libwebp.sh
# build freetype2
$SCRIPT_ROOT
/build-freetype2.sh
# build fribidi
# build fribidi
$SCRIPT_ROOT
/build-fribidi.sh
$SCRIPT_ROOT
/build-fribidi.sh
# build harfbuzz
# build harfbuzz
...
...
wasm/build-scripts/build-aom.sh
View file @
a2e1c64a
...
@@ -5,7 +5,6 @@ source $(dirname $0)/var.sh
...
@@ -5,7 +5,6 @@ source $(dirname $0)/var.sh
LIB_PATH
=
third_party/aom
LIB_PATH
=
third_party/aom
CMBUILD_DIR
=
cmbuild
CMBUILD_DIR
=
cmbuild
CFLAGS
=
"-s USE_PTHREADS=1
$OPTIM_FLAGS
"
CM_FLAGS
=(
CM_FLAGS
=(
-DCMAKE_INSTALL_PREFIX
=
$BUILD_DIR
# assign lib and include install path
-DCMAKE_INSTALL_PREFIX
=
$BUILD_DIR
# assign lib and include install path
-DCMAKE_TOOLCHAIN_FILE
=
$TOOLCHAIN_FILE
# use emscripten toolchain file
-DCMAKE_TOOLCHAIN_FILE
=
$TOOLCHAIN_FILE
# use emscripten toolchain file
...
...
wasm/build-scripts/build-fdk-aac.sh
View file @
a2e1c64a
...
@@ -4,16 +4,15 @@ set -euo pipefail
...
@@ -4,16 +4,15 @@ set -euo pipefail
source
$(
dirname
$0
)
/var.sh
source
$(
dirname
$0
)
/var.sh
LIB_PATH
=
third_party/fdk-aac
LIB_PATH
=
third_party/fdk-aac
CFLAGS
=
"-s USE_PTHREADS=1
$OPTIM_FLAGS
"
CONF_FLAGS
=(
CONF_FLAGS
=(
--prefix
=
$BUILD_DIR
# install library in a build directory for FFmpeg to include
--prefix
=
$BUILD_DIR
# install library in a build directory for FFmpeg to include
--host
=
i686-linux
# use i686
linux
--host
=
x86_64-
linux
--disable-shared
# disable shared library
--disable-shared
# disable shared library
--disable-dependency-tracking
# speedup one-time build
--disable-dependency-tracking
# speedup one-time build
)
)
echo
"CONF_FLAGS=
${
CONF_FLAGS
[@]
}
"
echo
"CONF_FLAGS=
${
CONF_FLAGS
[@]
}
"
(
cd
$LIB_PATH
&&
\
(
cd
$LIB_PATH
&&
\
emconfigure ./autogen.sh
&&
\
emconfigure ./autogen.sh
&&
\
CFLAGS
=
$CFLAGS
emconfigure ./configure
-C
"
${
CONF_FLAGS
[@]
}
"
)
CFLAGS
=
$CFLAGS
emconfigure ./configure
"
${
CONF_FLAGS
[@]
}
"
)
emmake make
-C
$LIB_PATH
install
-j
emmake make
-C
$LIB_PATH
clean
emmake make
-C
$LIB_PATH
clean
emmake make
-C
$LIB_PATH
install
-j
wasm/build-scripts/build-ffmpeg.sh
View file @
a2e1c64a
...
@@ -3,27 +3,41 @@
...
@@ -3,27 +3,41 @@
set
-eo
pipefail
set
-eo
pipefail
source
$(
dirname
$0
)
/var.sh
source
$(
dirname
$0
)
/var.sh
mkdir
-p
wasm/dist
if
[[
"
$FFMPEG_ST
"
!=
"yes"
]]
;
then
emmake make
-j
mkdir
-p
wasm/packages/core/dist
EXPORTED_FUNCTIONS
=
"[_main, _proxy_main]"
EXTRA_FLAGS
=(
-pthread
-s
USE_PTHREADS
=
1
# enable pthreads support
-s
PROXY_TO_PTHREAD
=
1
# detach main() from browser/UI main thread
-o
wasm/packages/core/dist/ffmpeg-core.js
)
else
mkdir
-p
wasm/packages/core-st/dist
EXPORTED_FUNCTIONS
=
"[_main]"
EXTRA_FLAGS
=(
-o
wasm/packages/core-st/dist/ffmpeg-core.js
)
fi
FLAGS
=(
FLAGS
=(
-I
.
-I
./fftools
-I
$BUILD_DIR
/include
-I
.
-I
./fftools
-I
$BUILD_DIR
/include
-Llibavcodec
-Llibavdevice
-Llibavfilter
-Llibavformat
-Llibavresample
-Llibavutil
-Lharfbuzz
-Llibass
-Lfribidi
-Llibpostproc
-Llibswscale
-Llibswresample
-L
$BUILD_DIR
/lib
-Llibavcodec
-Llibavdevice
-Llibavfilter
-Llibavformat
-Llibavresample
-Llibavutil
-Lharfbuzz
-Llibass
-Lfribidi
-Llibpostproc
-Llibswscale
-Llibswresample
-L
$BUILD_DIR
/lib
-Wno-deprecated-declarations
-Wno-pointer-sign
-Wno-implicit-int-float-conversion
-Wno-switch
-Wno-parentheses
-Qunused-arguments
-Wno-deprecated-declarations
-Wno-pointer-sign
-Wno-implicit-int-float-conversion
-Wno-switch
-Wno-parentheses
-Qunused-arguments
-lavdevice
-lavfilter
-lavformat
-lavcodec
-lswresample
-lswscale
-lavutil
-lpostproc
-lm
-lharfbuzz
-lfribidi
-llibass
-lx264
-lx265
-lvpx
-lwavpack
-lmp3lame
-lfdk-aac
-lvorbis
-lvorbisenc
-lvorbisfile
-logg
-ltheora
-ltheoraenc
-ltheoradec
-lz
-lfreetype
-lopus
-lwebp
-pthread
-lavdevice
-lavfilter
-lavformat
-lavcodec
-lswresample
-lswscale
-lavutil
-lpostproc
-lm
-lharfbuzz
-lfribidi
-llibass
-lx264
-lx265
-lvpx
-lwavpack
-lmp3lame
-lfdk-aac
-lvorbis
-lvorbisenc
-lvorbisfile
-logg
-ltheora
-ltheoraenc
-ltheoradec
-lz
-lfreetype
-lopus
-lwebp
fftools/ffmpeg_opt.c fftools/ffmpeg_filter.c fftools/ffmpeg_hw.c fftools/cmdutils.c fftools/ffmpeg.c
fftools/ffmpeg_opt.c fftools/ffmpeg_filter.c fftools/ffmpeg_hw.c fftools/cmdutils.c fftools/ffmpeg.c
-o
wasm/dist/ffmpeg-core.js
-o
wasm/dist/ffmpeg-core.js
-s
USE_SDL
=
2
# use SDL2
-s
USE_SDL
=
2
# use SDL2
-s
USE_PTHREADS
=
1
# enable pthreads support
-s
PROXY_TO_PTHREAD
=
1
# detach main() from browser/UI main thread
-s
INVOKE_RUN
=
0
# not to run the main() in the beginning
-s
INVOKE_RUN
=
0
# not to run the main() in the beginning
-s
EXIT_RUNTIME
=
1
# exit runtime after execution
-s
EXIT_RUNTIME
=
1
# exit runtime after execution
-s
MODULARIZE
=
1
# use modularized version to be more flexible
-s
MODULARIZE
=
1
# use modularized version to be more flexible
-s
EXPORT_NAME
=
"createFFmpegCore"
# assign export name for browser
-s
EXPORT_NAME
=
"createFFmpegCore"
# assign export name for browser
-s
EXPORTED_FUNCTIONS
=
"
[_main, _proxy_main]
"
# export main and proxy_main funcs
-s
EXPORTED_FUNCTIONS
=
"
$EXPORTED_FUNCTIONS
"
# export main and proxy_main funcs
-s
EXTRA_EXPORTED_RUNTIME_METHODS
=
"[FS, cwrap, ccall, setValue, writeAsciiToMemory]"
# export preamble funcs
-s
EXTRA_EXPORTED_RUNTIME_METHODS
=
"[FS, cwrap, ccall, setValue, writeAsciiToMemory]"
# export preamble funcs
-s
INITIAL_MEMORY
=
2146435072
# 64 KB * 1024 * 16 * 2047 = 2146435072 bytes ~= 2 GB
-s
INITIAL_MEMORY
=
2146435072
# 64 KB * 1024 * 16 * 2047 = 2146435072 bytes ~= 2 GB
--post-js
wasm/post-js.js
--post-js
wasm/
src/
post-js.js
$OPTIM_FLAGS
$OPTIM_FLAGS
${
EXTRA_FLAGS
[@]
}
)
)
echo
"FFMPEG_EM_FLAGS=
${
FLAGS
[@]
}
"
echo
"FFMPEG_EM_FLAGS=
${
FLAGS
[@]
}
"
emmake make
-j
emcc
"
${
FLAGS
[@]
}
"
emcc
"
${
FLAGS
[@]
}
"
wasm/build-scripts/build-freetype2.sh
View file @
a2e1c64a
...
@@ -4,15 +4,17 @@ set -euo pipefail
...
@@ -4,15 +4,17 @@ set -euo pipefail
source
$(
dirname
$0
)
/var.sh
source
$(
dirname
$0
)
/var.sh
LIB_PATH
=
third_party/freetype2
LIB_PATH
=
third_party/freetype2
CFLAGS
=
"-s USE_PTHREADS=1
$OPTIM_FLAGS
"
CONF_FLAGS
=(
CONF_FLAGS
=(
--prefix
=
$BUILD_DIR
# install library in a build directory for FFmpeg to include
--prefix
=
$BUILD_DIR
# install library in a build directory for FFmpeg to include
--host
=
i686-gnu
# use i686 linux
--host
=
x86_64-gnu
# use i686 linux
--enable-shared
=
no
# not to build shared library
--enable-shared
=
no
# not to build shared library
--without-harfbuzz
)
)
echo
"CONF_FLAGS=
${
CONF_FLAGS
[@]
}
"
echo
"CONF_FLAGS=
${
CONF_FLAGS
[@]
}
"
(
cd
$LIB_PATH
&&
\
(
cd
$LIB_PATH
&&
\
emconfigure ./autogen.sh
&&
\
emconfigure ./autogen.sh
&&
\
CFLAGS
=
$CFLAGS
emconfigure ./configure
-C
"
${
CONF_FLAGS
[@]
}
"
)
emconfigure ./configure
"
${
CONF_FLAGS
[@]
}
"
)
emmake make
-C
$LIB_PATH
install
-j
emmake make
-C
$LIB_PATH
clean
emmake make
-C
$LIB_PATH
clean
# build apinames manually to prevent it built by emcc
gcc
-o
third_party/freetype2/objs/apinames third_party/freetype2/src/tools/apinames.c
emmake make
-C
$LIB_PATH
install
-j
wasm/build-scripts/build-fribidi.sh
View file @
a2e1c64a
...
@@ -4,10 +4,9 @@ set -euo pipefail
...
@@ -4,10 +4,9 @@ set -euo pipefail
source
$(
dirname
$0
)
/var.sh
source
$(
dirname
$0
)
/var.sh
LIB_PATH
=
third_party/fribidi
LIB_PATH
=
third_party/fribidi
CFLAGS
=
"-s USE_PTHREADS=1
$OPTIM_FLAGS
"
CONF_FLAGS
=(
CONF_FLAGS
=(
--prefix
=
$BUILD_DIR
# install library in a build directory for FFmpeg to include
--prefix
=
$BUILD_DIR
# install library in a build directory for FFmpeg to include
--host
=
i686-gnu
# use i686
linux
--host
=
x86_64-
linux
--enable-shared
=
no
# not to build shared library
--enable-shared
=
no
# not to build shared library
--enable-static
=
yes
--enable-static
=
yes
--disable-dependency-tracking
--disable-dependency-tracking
...
@@ -15,8 +14,7 @@ CONF_FLAGS=(
...
@@ -15,8 +14,7 @@ CONF_FLAGS=(
)
)
echo
"CONF_FLAGS=
${
CONF_FLAGS
[@]
}
"
echo
"CONF_FLAGS=
${
CONF_FLAGS
[@]
}
"
(
cd
$LIB_PATH
&&
\
(
cd
$LIB_PATH
&&
\
emconfigure ./autogen.sh
&&
\
emconfigure ./autogen.sh
"
${
CONF_FLAGS
[@]
}
"
)
CFLAGS
=
$CFLAGS
emconfigure ./configure
-C
"
${
CONF_FLAGS
[@]
}
"
)
emmake make
-C
$LIB_PATH
clean
emmake make
-C
$LIB_PATH
install
-j
||
true
emmake make
-C
$LIB_PATH
install
-j
||
true
cp
$LIB_PATH
/fribidi.pc
$BUILD_DIR
/lib/pkgconfig
cp
$LIB_PATH
/fribidi.pc
$BUILD_DIR
/lib/pkgconfig
emmake make
-C
$LIB_PATH
clean
wasm/build-scripts/build-harfbuzz.sh
View file @
a2e1c64a
...
@@ -4,7 +4,6 @@ set -euo pipefail
...
@@ -4,7 +4,6 @@ set -euo pipefail
source
$(
dirname
$0
)
/var.sh
source
$(
dirname
$0
)
/var.sh
LIB_PATH
=
third_party/harfbuzz
LIB_PATH
=
third_party/harfbuzz
CFLAGS
=
"-s USE_PTHREADS=1
$OPTIM_FLAGS
"
CONF_FLAGS
=(
CONF_FLAGS
=(
--prefix
=
$BUILD_DIR
# install library in a build directory for FFmpeg to include
--prefix
=
$BUILD_DIR
# install library in a build directory for FFmpeg to include
--host
=
i686-gnu
# use i686 linux
--host
=
i686-gnu
# use i686 linux
...
@@ -13,7 +12,6 @@ CONF_FLAGS=(
...
@@ -13,7 +12,6 @@ CONF_FLAGS=(
)
)
echo
"CONF_FLAGS=
${
CONF_FLAGS
[@]
}
"
echo
"CONF_FLAGS=
${
CONF_FLAGS
[@]
}
"
(
cd
$LIB_PATH
&&
\
(
cd
$LIB_PATH
&&
\
emconfigure ./autogen.sh
&&
\
emconfigure ./autogen.sh
"
${
CONF_FLAGS
[@]
}
"
)
CFLAGS
=
$CFLAGS
emconfigure ./configure
-C
"
${
CONF_FLAGS
[@]
}
"
)
emmake make
-C
$LIB_PATH
install
-j
emmake make
-C
$LIB_PATH
clean
emmake make
-C
$LIB_PATH
clean
emmake make
-C
$LIB_PATH
install
-j
wasm/build-scripts/build-lame.sh
View file @
a2e1c64a
...
@@ -4,7 +4,6 @@ set -euo pipefail
...
@@ -4,7 +4,6 @@ set -euo pipefail
source
$(
dirname
$0
)
/var.sh
source
$(
dirname
$0
)
/var.sh
LIB_PATH
=
third_party/lame
LIB_PATH
=
third_party/lame
CFLAGS
=
"-s USE_PTHREADS=1
$OPTIM_FLAGS
"
CONF_FLAGS
=(
CONF_FLAGS
=(
--prefix
=
$BUILD_DIR
# install library in a build directory for FFmpeg to include
--prefix
=
$BUILD_DIR
# install library in a build directory for FFmpeg to include
--host
=
i686-linux
# use i686 linux
--host
=
i686-linux
# use i686 linux
...
@@ -16,5 +15,5 @@ CONF_FLAGS=(
...
@@ -16,5 +15,5 @@ CONF_FLAGS=(
)
)
echo
"CONF_FLAGS=
${
CONF_FLAGS
[@]
}
"
echo
"CONF_FLAGS=
${
CONF_FLAGS
[@]
}
"
(
cd
$LIB_PATH
&&
CFLAGS
=
$CFLAGS
emconfigure ./configure
"
${
CONF_FLAGS
[@]
}
"
)
(
cd
$LIB_PATH
&&
CFLAGS
=
$CFLAGS
emconfigure ./configure
"
${
CONF_FLAGS
[@]
}
"
)
emmake make
-C
$LIB_PATH
install
-j
emmake make
-C
$LIB_PATH
clean
emmake make
-C
$LIB_PATH
clean
emmake make
-C
$LIB_PATH
install
-j
wasm/build-scripts/build-libass.sh
View file @
a2e1c64a
...
@@ -14,6 +14,6 @@ CONF_FLAGS=(
...
@@ -14,6 +14,6 @@ CONF_FLAGS=(
--disable-require-system-font-provider
--disable-require-system-font-provider
)
)
echo
"CONF_FLAGS=
${
CONF_FLAGS
[@]
}
"
echo
"CONF_FLAGS=
${
CONF_FLAGS
[@]
}
"
(
cd
$LIB_PATH
&&
./autogen.sh
&&
EM_PKG_CONFIG_PATH
=
$EM_PKG_CONFIG_PATH
emconfigure ./configure
-C
"
${
CONF_FLAGS
[@]
}
"
)
(
cd
$LIB_PATH
&&
./autogen.sh
&&
emconfigure ./configure
"
${
CONF_FLAGS
[@]
}
"
)
emmake make
-C
$LIB_PATH
install
-j
emmake make
-C
$LIB_PATH
clean
emmake make
-C
$LIB_PATH
clean
emmake make
-C
$LIB_PATH
install
-j
wasm/build-scripts/build-libvpx.sh
View file @
a2e1c64a
...
@@ -4,7 +4,13 @@ set -euo pipefail
...
@@ -4,7 +4,13 @@ set -euo pipefail
source
$(
dirname
$0
)
/var.sh
source
$(
dirname
$0
)
/var.sh
LIB_PATH
=
third_party/libvpx
LIB_PATH
=
third_party/libvpx
FLAGS
=
"-c -s USE_PTHREADS=1
$OPTIM_FLAGS
"
if
[[
"
$FFMPEG_ST
"
==
"yes"
]]
;
then
EXTRA_CONF_FLAGS
=(
--disable-multithread
)
fi
CONF_FLAGS
=(
CONF_FLAGS
=(
--prefix
=
$BUILD_DIR
# install library in a build directory for FFmpeg to include
--prefix
=
$BUILD_DIR
# install library in a build directory for FFmpeg to include
--target
=
generic-gnu
# target with miminal features
--target
=
generic-gnu
# target with miminal features
...
@@ -14,10 +20,11 @@ CONF_FLAGS=(
...
@@ -14,10 +20,11 @@ CONF_FLAGS=(
--disable-docs
# not to build docs
--disable-docs
# not to build docs
--disable-unit-tests
# not to do unit tests
--disable-unit-tests
# not to do unit tests
--disable-dependency-tracking
# speed up one-time build
--disable-dependency-tracking
# speed up one-time build
--extra-cflags
=
"
$FLAGS
"
# flags to use pthread and code optimization
--extra-cflags
=
"
$CFLAGS
"
# flags to use pthread and code optimization
--extra-cxxflags
=
"
$FLAGS
"
# flags to use pthread and code optimization
--extra-cxxflags
=
"
$CXXFLAGS
"
# flags to use pthread and code optimization
${
EXTRA_CONF_FLAGS
-
}
)
)
echo
"CONF_FLAGS=
${
CONF_FLAGS
[@]
}
"
echo
"CONF_FLAGS=
${
CONF_FLAGS
[@]
}
"
(
cd
$LIB_PATH
&&
LDFLAGS
=
"
$FLAGS
"
STRIP
=
"llvm-strip"
emconfigure ./configure
"
${
CONF_FLAGS
[@]
}
"
)
(
cd
$LIB_PATH
&&
emconfigure ./configure
"
${
CONF_FLAGS
[@]
}
"
)
emmake make
-C
$LIB_PATH
install
-j
emmake make
-C
$LIB_PATH
clean
emmake make
-C
$LIB_PATH
clean
emmake make
-C
$LIB_PATH
install
-j
wasm/build-scripts/build-libwebp.sh
View file @
a2e1c64a
...
@@ -4,7 +4,6 @@ set -euo pipefail
...
@@ -4,7 +4,6 @@ set -euo pipefail
source
$(
dirname
$0
)
/var.sh
source
$(
dirname
$0
)
/var.sh
LIB_PATH
=
third_party/libwebp
LIB_PATH
=
third_party/libwebp
CXXFLAGS
=
"-s USE_PTHREADS=1
$OPTIM_FLAGS
"
CM_FLAGS
=(
CM_FLAGS
=(
-DCMAKE_INSTALL_PREFIX
=
$BUILD_DIR
-DCMAKE_INSTALL_PREFIX
=
$BUILD_DIR
-DCMAKE_TOOLCHAIN_FILE
=
$TOOLCHAIN_FILE
-DCMAKE_TOOLCHAIN_FILE
=
$TOOLCHAIN_FILE
...
@@ -28,6 +27,6 @@ cd $LIB_PATH
...
@@ -28,6 +27,6 @@ cd $LIB_PATH
mkdir
-p
build
mkdir
-p
build
cd
build
cd
build
emmake cmake ..
-DCMAKE_C_FLAGS
=
"
$CXXFLAGS
"
${
CM_FLAGS
[@]
}
emmake cmake ..
-DCMAKE_C_FLAGS
=
"
$CXXFLAGS
"
${
CM_FLAGS
[@]
}
emmake make
install
emmake make clean
emmake make clean
emmake make
install
cd
$ROOT_DIR
cd
$ROOT_DIR
wasm/build-scripts/build-ogg.sh
View file @
a2e1c64a
...
@@ -4,7 +4,6 @@ set -euo pipefail
...
@@ -4,7 +4,6 @@ set -euo pipefail
source
$(
dirname
$0
)
/var.sh
source
$(
dirname
$0
)
/var.sh
LIB_PATH
=
third_party/Ogg
LIB_PATH
=
third_party/Ogg
CFLAGS
=
"-s USE_PTHREADS=1
$OPTIM_FLAGS
"
CONF_FLAGS
=(
CONF_FLAGS
=(
--prefix
=
$BUILD_DIR
# install library in a build directory for FFmpeg to include
--prefix
=
$BUILD_DIR
# install library in a build directory for FFmpeg to include
--host
=
i686-linux
# use i686 linux
--host
=
i686-linux
# use i686 linux
...
@@ -15,6 +14,6 @@ CONF_FLAGS=(
...
@@ -15,6 +14,6 @@ CONF_FLAGS=(
echo
"CONF_FLAGS=
${
CONF_FLAGS
[@]
}
"
echo
"CONF_FLAGS=
${
CONF_FLAGS
[@]
}
"
(
cd
$LIB_PATH
&&
\
(
cd
$LIB_PATH
&&
\
emconfigure ./autogen.sh
&&
\
emconfigure ./autogen.sh
&&
\
CFLAGS
=
$CFLAGS
emconfigure ./configure
-C
"
${
CONF_FLAGS
[@]
}
"
)
emconfigure ./configure
"
${
CONF_FLAGS
[@]
}
"
)
emmake make
-C
$LIB_PATH
install
-j
emmake make
-C
$LIB_PATH
clean
emmake make
-C
$LIB_PATH
clean
emmake make
-C
$LIB_PATH
install
-j
wasm/build-scripts/build-opus.sh
View file @
a2e1c64a
...
@@ -4,7 +4,6 @@ set -euo pipefail
...
@@ -4,7 +4,6 @@ set -euo pipefail
source
$(
dirname
$0
)
/var.sh
source
$(
dirname
$0
)
/var.sh
LIB_PATH
=
third_party/opus
LIB_PATH
=
third_party/opus
CFLAGS
=
"-s USE_PTHREADS=1
$OPTIM_FLAGS
"
CONF_FLAGS
=(
CONF_FLAGS
=(
--prefix
=
$BUILD_DIR
# install library in a build directory for FFmpeg to include
--prefix
=
$BUILD_DIR
# install library in a build directory for FFmpeg to include
--host
=
i686-gnu
# use i686 linux
--host
=
i686-gnu
# use i686 linux
...
@@ -18,6 +17,6 @@ CONF_FLAGS=(
...
@@ -18,6 +17,6 @@ CONF_FLAGS=(
echo
"CONF_FLAGS=
${
CONF_FLAGS
[@]
}
"
echo
"CONF_FLAGS=
${
CONF_FLAGS
[@]
}
"
(
cd
$LIB_PATH
&&
\
(
cd
$LIB_PATH
&&
\
emconfigure ./autogen.sh
&&
\
emconfigure ./autogen.sh
&&
\
CFLAGS
=
$CFLAGS
emconfigure ./configure
-C
"
${
CONF_FLAGS
[@]
}
"
)
CFLAGS
=
$CFLAGS
emconfigure ./configure
"
${
CONF_FLAGS
[@]
}
"
)
emmake make
-C
$LIB_PATH
install
-j
emmake make
-C
$LIB_PATH
clean
emmake make
-C
$LIB_PATH
clean
emmake make
-C
$LIB_PATH
install
-j
wasm/build-scripts/build-theora.sh
View file @
a2e1c64a
...
@@ -4,8 +4,6 @@ set -euo pipefail
...
@@ -4,8 +4,6 @@ set -euo pipefail
source
$(
dirname
$0
)
/var.sh
source
$(
dirname
$0
)
/var.sh
LIB_PATH
=
third_party/theora
LIB_PATH
=
third_party/theora
CFLAGS
=
"-s USE_PTHREADS=1
$OPTIM_FLAGS
-I
$BUILD_DIR
/include"
LDFLAGS
=
"-L
$BUILD_DIR
/lib"
CONF_FLAGS
=(
CONF_FLAGS
=(
--prefix
=
$BUILD_DIR
# install library in a build directory for FFmpeg to include
--prefix
=
$BUILD_DIR
# install library in a build directory for FFmpeg to include
--host
=
i686-linux
# use i686 linux
--host
=
i686-linux
# use i686 linux
...
@@ -21,6 +19,6 @@ CONF_FLAGS=(
...
@@ -21,6 +19,6 @@ CONF_FLAGS=(
)
)
echo
"CONF_FLAGS=
${
CONF_FLAGS
[@]
}
"
echo
"CONF_FLAGS=
${
CONF_FLAGS
[@]
}
"
(
cd
$LIB_PATH
&&
\
(
cd
$LIB_PATH
&&
\
CFLAGS
=
$CFLAGS
LDFLAGS
=
$LDFLAGS
emconfigure ./autogen.sh
-C
"
${
CONF_FLAGS
[@]
}
"
)
emconfigure ./autogen.sh
"
${
CONF_FLAGS
[@]
}
"
)
emmake make
-C
$LIB_PATH
install
-j
emmake make
-C
$LIB_PATH
clean
emmake make
-C
$LIB_PATH
clean
emmake make
-C
$LIB_PATH
install
-j
wasm/build-scripts/build-vorbis.sh
View file @
a2e1c64a
...
@@ -4,8 +4,6 @@ set -euo pipefail
...
@@ -4,8 +4,6 @@ set -euo pipefail
source
$(
dirname
$0
)
/var.sh
source
$(
dirname
$0
)
/var.sh
LIB_PATH
=
third_party/vorbis
LIB_PATH
=
third_party/vorbis
CFLAGS
=
"-s USE_PTHREADS=1
$OPTIM_FLAGS
-I
$BUILD_DIR
/include"
LDFLAGS
=
"-L
$BUILD_DIR
/lib"
CONF_FLAGS
=(
CONF_FLAGS
=(
--prefix
=
$BUILD_DIR
# install library in a build directory for FFmpeg to include
--prefix
=
$BUILD_DIR
# install library in a build directory for FFmpeg to include
--host
=
i686-linux
# use i686 linux
--host
=
i686-linux
# use i686 linux
...
@@ -19,6 +17,6 @@ CONF_FLAGS=(
...
@@ -19,6 +17,6 @@ CONF_FLAGS=(
echo
"CONF_FLAGS=
${
CONF_FLAGS
[@]
}
"
echo
"CONF_FLAGS=
${
CONF_FLAGS
[@]
}
"
(
cd
$LIB_PATH
&&
\
(
cd
$LIB_PATH
&&
\
emconfigure ./autogen.sh
&&
\
emconfigure ./autogen.sh
&&
\
CFLAGS
=
$CFLAGS
LDFLAGS
=
$LDFLAGS
emconfigure ./configure
-C
"
${
CONF_FLAGS
[@]
}
"
)
emconfigure ./configure
"
${
CONF_FLAGS
[@]
}
"
)
emmake make
-C
$LIB_PATH
install
-j
emmake make
-C
$LIB_PATH
clean
emmake make
-C
$LIB_PATH
clean
emmake make
-C
$LIB_PATH
install
-j
wasm/build-scripts/build-wavpack.sh
View file @
a2e1c64a
...
@@ -4,7 +4,6 @@ set -euo pipefail
...
@@ -4,7 +4,6 @@ set -euo pipefail
source
$(
dirname
$0
)
/var.sh
source
$(
dirname
$0
)
/var.sh
LIB_PATH
=
third_party/WavPack
LIB_PATH
=
third_party/WavPack
CFLAGS
=
"-s USE_PTHREADS=1
$OPTIM_FLAGS
"
CONF_FLAGS
=(
CONF_FLAGS
=(
--prefix
=
$BUILD_DIR
# install library in a build directory for FFmpeg to include
--prefix
=
$BUILD_DIR
# install library in a build directory for FFmpeg to include
--host
=
x86-linux-gnu
# use x86 linux as host
--host
=
x86-linux-gnu
# use x86 linux as host
...
@@ -19,6 +18,6 @@ CONF_FLAGS=(
...
@@ -19,6 +18,6 @@ CONF_FLAGS=(
--disable-maintainer-mode
--disable-maintainer-mode
)
)
echo
"CONF_FLAGS=
${
CONF_FLAGS
[@]
}
"
echo
"CONF_FLAGS=
${
CONF_FLAGS
[@]
}
"
(
cd
$LIB_PATH
&&
CFLAGS
=
$CFLAGS
emconfigure ./autogen.sh
-C
"
${
CONF_FLAGS
[@]
}
"
)
(
cd
$LIB_PATH
&&
CFLAGS
=
$CFLAGS
emconfigure ./autogen.sh
"
${
CONF_FLAGS
[@]
}
"
)
emmake make
-C
$LIB_PATH
install
-j
emmake make
-C
$LIB_PATH
clean
emmake make
-C
$LIB_PATH
clean
emmake make
-C
$LIB_PATH
install
-j
wasm/build-scripts/build-x264.sh
View file @
a2e1c64a
...
@@ -4,15 +4,23 @@ set -euo pipefail
...
@@ -4,15 +4,23 @@ set -euo pipefail
source
$(
dirname
$0
)
/var.sh
source
$(
dirname
$0
)
/var.sh
LIB_PATH
=
third_party/x264
LIB_PATH
=
third_party/x264
if
[[
"
$FFMPEG_ST
"
==
"yes"
]]
;
then
EXTRA_CONF_FLAGS
=(
--disable-thread
)
fi
CONF_FLAGS
=(
CONF_FLAGS
=(
--prefix
=
$BUILD_DIR
# install library in a build directory for FFmpeg to include
--prefix
=
$BUILD_DIR
# install library in a build directory for FFmpeg to include
--host
=
i686-gnu
# use i686 linux
--host
=
i686-gnu
# use i686 linux
--enable-static
# enable building static library
--enable-static
# enable building static library
--disable-cli
# disable cli tools
--disable-cli
# disable cli tools
--disable-asm
# disable asm optimization
--disable-asm
# disable asm optimization
--extra-cflags
=
"-c -s USE_PTHREADS=1
$OPTIM_FLAGS
"
# flags to use pthread and code optimization
--extra-cflags
=
"
$CFLAGS
"
# flags to use pthread and code optimization
${
EXTRA_CONF_FLAGS
-
}
)
)
echo
"CONF_FLAGS=
${
CONF_FLAGS
[@]
}
"
echo
"CONF_FLAGS=
${
CONF_FLAGS
[@]
}
"
(
cd
$LIB_PATH
&&
emconfigure ./configure
-C
"
${
CONF_FLAGS
[@]
}
"
)
(
cd
$LIB_PATH
&&
emconfigure ./configure
"
${
CONF_FLAGS
[@]
}
"
)
emmake make
-C
$LIB_PATH
install-lib-static
-j
emmake make
-C
$LIB_PATH
clean
emmake make
-C
$LIB_PATH
clean
emmake make
-C
$LIB_PATH
install-lib-static
-j
wasm/build-scripts/build-x265.sh
View file @
a2e1c64a
...
@@ -4,7 +4,6 @@ set -euo pipefail
...
@@ -4,7 +4,6 @@ set -euo pipefail
source
$(
dirname
$0
)
/var.sh
source
$(
dirname
$0
)
/var.sh
LIB_PATH
=
third_party/x265/source
LIB_PATH
=
third_party/x265/source
CXXFLAGS
=
"-s USE_PTHREADS=1
$OPTIM_FLAGS
"
BASE_FLAGS
=(
BASE_FLAGS
=(
-DCMAKE_TOOLCHAIN_FILE
=
$TOOLCHAIN_FILE
-DCMAKE_TOOLCHAIN_FILE
=
$TOOLCHAIN_FILE
-DENABLE_LIBNUMA
=
OFF
-DENABLE_LIBNUMA
=
OFF
...
@@ -42,16 +41,19 @@ mkdir -p main 10bit 12bit
...
@@ -42,16 +41,19 @@ mkdir -p main 10bit 12bit
cd
12bit
cd
12bit
emmake cmake ../..
-DCMAKE_CXX_FLAGS
=
"
$CXXFLAGS
"
${
FLAGS_12BIT
[@]
}
emmake cmake ../..
-DCMAKE_CXX_FLAGS
=
"
$CXXFLAGS
"
${
FLAGS_12BIT
[@]
}
emmake make clean
emmake make
-j
emmake make
-j
cd
../10bit
cd
../10bit
emmake cmake ../..
-DCMAKE_CXX_FLAGS
=
"
$CXXFLAGS
"
${
FLAGS_10BIT
[@]
}
emmake cmake ../..
-DCMAKE_CXX_FLAGS
=
"
$CXXFLAGS
"
${
FLAGS_10BIT
[@]
}
emmake make clean
emmake make
-j
emmake make
-j
cd
../main
cd
../main
ln
-sf
../10bit/libx265.a libx265_main10.a
ln
-sf
../10bit/libx265.a libx265_main10.a
ln
-sf
../12bit/libx265.a libx265_main12.a
ln
-sf
../12bit/libx265.a libx265_main12.a
emmake cmake ../..
-DCMAKE_CXX_FLAGS
=
"
$CXXFLAGS
"
${
FLAGS_MAIN
[@]
}
emmake cmake ../..
-DCMAKE_CXX_FLAGS
=
"
$CXXFLAGS
"
${
FLAGS_MAIN
[@]
}
emmake make clean
emmake make
install
-j
emmake make
install
-j
mv
libx265.a libx265_main.a
mv
libx265.a libx265_main.a
...
@@ -68,8 +70,4 @@ EOF
...
@@ -68,8 +70,4 @@ EOF
cp
libx265.a
$BUILD_DIR
/lib
cp
libx265.a
$BUILD_DIR
/lib
emmake make
-C
.
clean
emmake make
-C
../10bit clean
emmake make
-C
../12bit clean
cd
$ROOT_DIR
cd
$ROOT_DIR
wasm/build-scripts/build-zlib.sh
View file @
a2e1c64a
...
@@ -4,7 +4,6 @@ set -euo pipefail
...
@@ -4,7 +4,6 @@ set -euo pipefail
source
$(
dirname
$0
)
/var.sh
source
$(
dirname
$0
)
/var.sh
LIB_PATH
=
third_party/zlib
LIB_PATH
=
third_party/zlib
CXXFLAGS
=
"-s USE_PTHREADS=1
$OPTIM_FLAGS
"
CM_FLAGS
=(
CM_FLAGS
=(
-DCMAKE_INSTALL_PREFIX
=
$BUILD_DIR
-DCMAKE_INSTALL_PREFIX
=
$BUILD_DIR
-DCMAKE_TOOLCHAIN_FILE
=
$TOOLCHAIN_FILE
-DCMAKE_TOOLCHAIN_FILE
=
$TOOLCHAIN_FILE
...
@@ -18,6 +17,6 @@ rm -rf build zconf.h
...
@@ -18,6 +17,6 @@ rm -rf build zconf.h
mkdir
-p
build
mkdir
-p
build
cd
build
cd
build
emmake cmake ..
-DCMAKE_C_FLAGS
=
"
$CXXFLAGS
"
${
CM_FLAGS
[@]
}
emmake cmake ..
-DCMAKE_C_FLAGS
=
"
$CXXFLAGS
"
${
CM_FLAGS
[@]
}
emmake make
install
emmake make clean
emmake make clean
emmake make
install
cd
$ROOT_DIR
cd
$ROOT_DIR
wasm/build-scripts/configure-ffmpeg.sh
View file @
a2e1c64a
...
@@ -24,4 +24,4 @@ FLAGS=(
...
@@ -24,4 +24,4 @@ FLAGS=(
# --enable-libaom # enable libaom
# --enable-libaom # enable libaom
)
)
echo
"FFMPEG_CONFIG_FLAGS=
${
FLAGS
[@]
}
"
echo
"FFMPEG_CONFIG_FLAGS=
${
FLAGS
[@]
}
"
EM_PKG_CONFIG_PATH
=
${
EM_PKG_CONFIG_PATH
}
emconfigure ./configure
"
${
FLAGS
[@]
}
"
emconfigure ./configure
"
${
FLAGS
[@]
}
"
wasm/build-scripts/var.sh
View file @
a2e1c64a
...
@@ -7,6 +7,23 @@ set -euo pipefail
...
@@ -7,6 +7,23 @@ set -euo pipefail
# Include llvm binaries
# Include llvm binaries
export
PATH
=
$PATH
:
$EMSDK
/upstream/bin
export
PATH
=
$PATH
:
$EMSDK
/upstream/bin
# if yes, we are building a single thread version of
# ffmpeg.wasm-core, which is slow but compatible with
# most browsers as there is no SharedArrayBuffer.
FFMPEG_ST
=
${
FFMPEG_ST
:-
no
}
# Root directory
ROOT_DIR
=
$PWD
# Directory to install headers and libraries
BUILD_DIR
=
$ROOT_DIR
/build
# Directory to look for pkgconfig files
EM_PKG_CONFIG_PATH
=
$BUILD_DIR
/lib/pkgconfig
# Toolchain file path for cmake
TOOLCHAIN_FILE
=
$EMSDK
/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake
# Flags for code optimization, focus on speed instead
# Flags for code optimization, focus on speed instead
# of size
# of size
OPTIM_FLAGS
=(
OPTIM_FLAGS
=(
...
@@ -24,20 +41,22 @@ fi
...
@@ -24,20 +41,22 @@ fi
# Convert array to string
# Convert array to string
OPTIM_FLAGS
=
"
${
OPTIM_FLAGS
[@]
}
"
OPTIM_FLAGS
=
"
${
OPTIM_FLAGS
[@]
}
"
# Root directory
CFLAGS_BASE
=
"-I
$BUILD_DIR
/include
$OPTIM_FLAGS
"
ROOT_DIR
=
$PWD
CFLAGS
=
"
$CFLAGS_BASE
-s USE_PTHREADS=1"
# Directory to install headers and libraries
BUILD_DIR
=
$ROOT_DIR
/build
# Directory to look for pkgconfig files
if
[[
"
$FFMPEG_ST
"
==
"yes"
]]
;
then
EM_PKG_CONFIG_PATH
=
$BUILD_DIR
/lib/pkgconfig
CFLAGS
=
"
$CFLAGS_BASE
-s USE_PTHREADS=0"
EXTRA_FFMPEG_CONF_FLAGS
=(
--disable-pthreads
)
fi
# Toolchain file path for cmake
export
CFLAGS
=
$CFLAGS
TOOLCHAIN_FILE
=
$EMSDK
/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake
export
CXXFLAGS
=
$CFLAGS
export
LDFLAGS
=
"
$CFLAGS
-L
$BUILD_DIR
/lib"
export
STRIP
=
"llvm-strip"
export
EM_PKG_CONFIG_PATH
=
$EM_PKG_CONFIG_PATH
CFLAGS
=
"-s USE_PTHREADS=1 -I
$BUILD_DIR
/include
$OPTIM_FLAGS
"
LDFLAGS
=
"
$CFLAGS
-L
$BUILD_DIR
/lib"
FFMPEG_CONFIG_FLAGS_BASE
=(
FFMPEG_CONFIG_FLAGS_BASE
=(
--target-os
=
none
# use none to prevent any os specific configurations
--target-os
=
none
# use none to prevent any os specific configurations
--arch
=
x86_32
# use x86_32 to achieve minimal architectural optimization
--arch
=
x86_32
# use x86_32 to achieve minimal architectural optimization
...
@@ -61,8 +80,10 @@ FFMPEG_CONFIG_FLAGS_BASE=(
...
@@ -61,8 +80,10 @@ FFMPEG_CONFIG_FLAGS_BASE=(
--cxx
=
em++
--cxx
=
em++
--objcc
=
emcc
--objcc
=
emcc
--dep-cc
=
emcc
--dep-cc
=
emcc
${
EXTRA_FFMPEG_CONF_FLAGS
-
}
)
)
echo
"EMSDK=
$EMSDK
"
echo
"EMSDK=
$EMSDK
"
echo
"OPTIM_FLAGS=
$OPTIM_FLAGS
"
echo
"FFMPEG_ST=
$FFMPEG_ST
"
echo
"CFLAGS(CXXFLAGS)=
$CFLAGS
"
echo
"BUILD_DIR=
$BUILD_DIR
"
echo
"BUILD_DIR=
$BUILD_DIR
"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment