Separate emscripten debug info

This commit is contained in:
Tamás Bálint Misius
2025-01-24 10:56:12 +01:00
parent cb65cf8ffd
commit e8921ca6db
3 changed files with 17 additions and 11 deletions

20
.github/build.sh vendored
View File

@@ -9,6 +9,7 @@ if [[ -z ${BSH_HOST_PLATFORM-} ]]; then >&2 echo "BSH_HOST_PLATFORM not set";
if [[ -z ${BSH_HOST_LIBC-} ]]; then >&2 echo "BSH_HOST_LIBC not set"; exit 1; fi if [[ -z ${BSH_HOST_LIBC-} ]]; then >&2 echo "BSH_HOST_LIBC not set"; exit 1; fi
if [[ -z ${BSH_STATIC_DYNAMIC-} ]]; then >&2 echo "BSH_STATIC_DYNAMIC not set"; exit 1; fi if [[ -z ${BSH_STATIC_DYNAMIC-} ]]; then >&2 echo "BSH_STATIC_DYNAMIC not set"; exit 1; fi
if [[ -z ${BSH_DEBUG_RELEASE-} ]]; then >&2 echo "BSH_DEBUG_RELEASE not set"; exit 1; fi if [[ -z ${BSH_DEBUG_RELEASE-} ]]; then >&2 echo "BSH_DEBUG_RELEASE not set"; exit 1; fi
if [[ -z ${BSH_LINT-} ]]; then >&2 echo "BSH_LINT not set"; exit 1; fi
if [[ -z ${RELEASE_NAME-} ]]; then >&2 echo "RELEASE_NAME not set"; exit 1; fi if [[ -z ${RELEASE_NAME-} ]]; then >&2 echo "RELEASE_NAME not set"; exit 1; fi
if [[ -z ${RELEASE_TYPE-} ]]; then >&2 echo "RELEASE_TYPE not set"; exit 1; fi if [[ -z ${RELEASE_TYPE-} ]]; then >&2 echo "RELEASE_TYPE not set"; exit 1; fi
if [[ -z ${MOD_ID-} ]]; then >&2 echo "MOD_ID not set"; exit 1; fi if [[ -z ${MOD_ID-} ]]; then >&2 echo "MOD_ID not set"; exit 1; fi
@@ -119,7 +120,7 @@ if [[ -z ${BSH_NO_PACKAGES-} ]]; then
fi fi
;; ;;
emscripten) emscripten)
git clone https://github.com/emscripten-core/emsdk.git --branch 3.1.30 git clone https://github.com/emscripten-core/emsdk.git --branch 3.1.72
cd emsdk cd emsdk
./emsdk install latest ./emsdk install latest
./emsdk activate latest ./emsdk activate latest
@@ -284,6 +285,9 @@ if [[ $BSH_HOST_PLATFORM == linux ]] && [[ $BSH_HOST_ARCH != aarch64 ]]; then
meson_configure+=$'\t'-Db_pie=false meson_configure+=$'\t'-Db_pie=false
c_link_args+=\'-no-pie\', c_link_args+=\'-no-pie\',
fi fi
if [[ $SEPARATE_DEBUG == yes ]] && [[ $BSH_HOST_PLATFORM == emscripten ]]; then
c_link_args+=\'-gseparate-dwarf\',
fi
stable_or_beta=no stable_or_beta=no
if [[ $RELEASE_TYPE == beta ]]; then if [[ $RELEASE_TYPE == beta ]]; then
meson_configure+=$'\t'-Dbeta=true meson_configure+=$'\t'-Dbeta=true
@@ -488,10 +492,14 @@ else
fi fi
if [[ $SEPARATE_DEBUG == yes ]] && [[ $BSH_HOST_PLATFORM-$BSH_HOST_LIBC != windows-msvc ]]; then if [[ $SEPARATE_DEBUG == yes ]] && [[ $BSH_HOST_PLATFORM-$BSH_HOST_LIBC != windows-msvc ]]; then
$objcopy --only-keep-debug $strip_target $DEBUG_ASSET_PATH if [[ $BSH_HOST_PLATFORM == emscripten ]]; then
$strip --strip-debug --strip-unneeded $strip_target mv $APP_EXE.wasm.debug.wasm $DEBUG_ASSET_PATH # yeah >_>
$objcopy --add-gnu-debuglink $DEBUG_ASSET_PATH $strip_target else
chmod -x $DEBUG_ASSET_PATH $objcopy --only-keep-debug $strip_target $DEBUG_ASSET_PATH
$strip --strip-debug --strip-unneeded $strip_target
$objcopy --add-gnu-debuglink $DEBUG_ASSET_PATH $strip_target
chmod -x $DEBUG_ASSET_PATH
fi
fi fi
if [[ $BSH_HOST_PLATFORM == android ]]; then if [[ $BSH_HOST_PLATFORM == android ]]; then
$JAVA_HOME_8_X64/bin/keytool -genkeypair -keystore keystore.jks -alias androidkey -validity 10000 -keyalg RSA -keysize 2048 -keypass bagelsbagels -storepass bagelsbagels -dname "CN=nobody" $JAVA_HOME_8_X64/bin/keytool -genkeypair -keystore keystore.jks -alias androidkey -validity 10000 -keyalg RSA -keysize 2048 -keypass bagelsbagels -storepass bagelsbagels -dname "CN=nobody"
@@ -539,7 +547,7 @@ if [[ $BSH_HOST_PLATFORM == darwin ]]; then
exit 1 exit 1
fi fi
elif [[ $PACKAGE_MODE == emscripten ]]; then elif [[ $PACKAGE_MODE == emscripten ]]; then
tar cvf $ASSET_PATH $APP_EXE.js $APP_EXE.worker.js $APP_EXE.wasm tar cvf $ASSET_PATH $APP_EXE.js $APP_EXE.wasm
elif [[ $PACKAGE_MODE == appimage ]]; then elif [[ $PACKAGE_MODE == appimage ]]; then
# so far this can only happen with $BSH_HOST_PLATFORM-$BSH_HOST_LIBC == linux-gnu, but this may change later # so far this can only happen with $BSH_HOST_PLATFORM-$BSH_HOST_LIBC == linux-gnu, but this may change later
case $BSH_HOST_ARCH in case $BSH_HOST_ARCH in

2
.github/prepare.py vendored
View File

@@ -152,7 +152,7 @@ for arch, platform, libc, statdyn, bplatform, runso
( 'aarch64', 'android', 'bionic', 'static', 'linux', 'ubuntu-22.04', '.apk', 'check', None, None, None, 'debug', 0, False ), # priority = 0: rarely used debug build ( 'aarch64', 'android', 'bionic', 'static', 'linux', 'ubuntu-22.04', '.apk', 'check', None, None, None, 'debug', 0, False ), # priority = 0: rarely used debug build
( 'aarch64', 'android', 'bionic', 'static', 'linux', 'ubuntu-22.04', '.apk', 'publish', '.dbg', None, 'arm64-and-gcc-static', 'release', 10, True ), ( 'aarch64', 'android', 'bionic', 'static', 'linux', 'ubuntu-22.04', '.apk', 'publish', '.dbg', None, 'arm64-and-gcc-static', 'release', 10, True ),
( 'wasm32', 'emscripten', 'emscripten', 'static', 'linux', 'ubuntu-22.04', '.tar', 'check', None, None, None, 'debug', 0, False ), # priority = 0: rarely used debug build ( 'wasm32', 'emscripten', 'emscripten', 'static', 'linux', 'ubuntu-22.04', '.tar', 'check', None, None, None, 'debug', 0, False ), # priority = 0: rarely used debug build
( 'wasm32', 'emscripten', 'emscripten', 'static', 'linux', 'ubuntu-22.04', '.tar', 'publish', None, 'emscripten', 'wasm32-ems-static', 'release', 10, False ), # I have no idea how to separate debug info on emscripten, TODO: enable lint once emscripten ships clang-tidy ( 'wasm32', 'emscripten', 'emscripten', 'static', 'linux', 'ubuntu-22.04', '.tar', 'publish','.dbg.wasm','emscripten', 'wasm32-ems-static', 'release', 10, False ), # TODO: enable lint once emscripten ships clang-tidy
]: ]:
if priority < do_priority: if priority < do_priority:
continue continue

View File

@@ -220,10 +220,8 @@ if host_platform == 'emscripten'
'-s', 'USE_ZLIB=1', '-s', 'USE_ZLIB=1',
'-s', 'DISABLE_EXCEPTION_CATCHING=0', '-s', 'DISABLE_EXCEPTION_CATCHING=0',
] ]
if is_debug project_link_args += [ '--source-map-base=./' ]
project_link_args += [ '--source-map-base=./' ] emcc_args += [ '-gsource-map' ]
emcc_args += [ '-gsource-map' ]
endif
project_link_args += emcc_args project_link_args += emcc_args
project_cpp_args += emcc_args project_cpp_args += emcc_args
else else