mirror of
https://github.com/chocolate-doom/chocpkg.git
synced 2024-11-09 23:01:48 +00:00
Use emscripten's "official" SDL2 port.
Instead of building ourselves.
This commit is contained in:
parent
174ece5b36
commit
5b1fe8e22a
1 changed files with 30 additions and 7 deletions
|
@ -1,5 +1,20 @@
|
|||
description "Emscripten build environment"
|
||||
|
||||
SDL2_PACKAGE_CONFIG="
|
||||
prefix=/
|
||||
exec_prefix=/
|
||||
libdir=/
|
||||
includedir=/
|
||||
|
||||
Name: sdl2
|
||||
Description: sdl2
|
||||
Version: 2.20.0
|
||||
Requires:
|
||||
Conflicts:
|
||||
Libs: -sUSE_SDL=2 -flto -sASYNCIFY -sENVIRONMENT=web
|
||||
Cflags: -sUSE_SDL=2
|
||||
"
|
||||
|
||||
do_fetch() {
|
||||
check_tool emcc
|
||||
mkdir -p "$PACKAGE_BUILD_DIR"
|
||||
|
@ -17,18 +32,26 @@ make_wrapper_script() {
|
|||
path="$PACKAGE_INSTALL_DIR/bin/wasm32-unknown-emscripten-$toolname"
|
||||
mkdir -p "$PACKAGE_INSTALL_DIR/bin"
|
||||
(echo "#!/bin/bash"
|
||||
echo ". $PACKAGE_BUILD_DIR/emsdk_env.sh >/dev/null"
|
||||
echo "export EMCC_CFLAGS='-s ERROR_ON_MISSING_LIBRARIES=1'"
|
||||
echo "export EM_CACHE=$PACKAGE_INSTALL_DIR/emscripten_cache"
|
||||
echo "export EM_FROZEN_CACHE="
|
||||
echo "exec $emtoolname \"\$@\"") > "$path"
|
||||
chmod a+rx "$path"
|
||||
}
|
||||
|
||||
# Emscripten is a weird beast, and wants us to use all its weird tools
|
||||
# (emconfigure, emmake, etc.). Instead of that, we define a "fake" system
|
||||
# named wasm32-unknown-emscripten and create wrapper scripts for all the
|
||||
# necessary compile tools. Then we can build like any other normal
|
||||
# cross-compile system.
|
||||
do_install() {
|
||||
# Emscripten has its own patched version of SDL2 that will get installed
|
||||
# automatically if -sUSE_SDL=2 is provided on the command line. By
|
||||
# installing a "fake" pkg-config file that just supplies this argument,
|
||||
# we short-circuit the build for the normal SDL package.
|
||||
mkdir -p "$PACKAGE_INSTALL_DIR/lib/pkgconfig"
|
||||
echo "$SDL2_PACKAGE_CONFIG" > "$PACKAGE_INSTALL_DIR/lib/pkgconfig/sdl2.pc"
|
||||
# TODO: Add pkg-config files for other libraries emscripten supports.
|
||||
|
||||
# Emscripten is a weird beast, and wants us to use all its weird tools
|
||||
# (emconfigure, emmake, etc.). Instead of that, we define a "fake" system
|
||||
# named wasm32-unknown-emscripten and create wrapper scripts for all the
|
||||
# necessary compile tools. Then we can build like any other normal
|
||||
# cross-compile system -- mostly.
|
||||
make_wrapper_script ar emar
|
||||
make_wrapper_script gcc emcc
|
||||
make_wrapper_script g++ em++
|
||||
|
|
Loading…
Reference in a new issue