mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 09:37:45 +00:00
Meta: Don't depend on toolchain for lagom target in serenity.sh
- Only call ensure_toolchain for non-lagom targets - Use host addr2line, we can't expect the i686 toolchain's addr2line to support the host's binary executable format - Don't export SERENITY_ARCH and TOOLCHAIN_DIR, don't need them anymore
This commit is contained in:
parent
cab2982feb
commit
1c85ce0324
1 changed files with 14 additions and 11 deletions
|
@ -95,13 +95,10 @@ cmd_with_target() {
|
||||||
SERENITY_ROOT="$(get_top_dir)"
|
SERENITY_ROOT="$(get_top_dir)"
|
||||||
export SERENITY_ROOT
|
export SERENITY_ROOT
|
||||||
BUILD_DIR="$SERENITY_ROOT/Build/$TARGET"
|
BUILD_DIR="$SERENITY_ROOT/Build/$TARGET"
|
||||||
if [ "$TARGET" = "lagom" ]; then
|
if [ "$TARGET" != "lagom" ]; then
|
||||||
TOOLCHAIN=i686
|
export SERENITY_ARCH="$TARGET"
|
||||||
else
|
TOOLCHAIN_DIR="$SERENITY_ROOT/Toolchain/Build/$TARGET"
|
||||||
TOOLCHAIN="$TARGET"
|
|
||||||
fi
|
fi
|
||||||
export SERENITY_ARCH="TOOLCHAIN"
|
|
||||||
TOOLCHAIN_DIR="$SERENITY_ROOT/Toolchain/Build/$TOOLCHAIN"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ensure_target() {
|
ensure_target() {
|
||||||
|
@ -127,7 +124,7 @@ delete_target() {
|
||||||
}
|
}
|
||||||
|
|
||||||
build_toolchain() {
|
build_toolchain() {
|
||||||
( cd Toolchain && ARCH="$TOOLCHAIN" ./BuildIt.sh )
|
( cd Toolchain && ARCH="$TARGET" ./BuildIt.sh )
|
||||||
}
|
}
|
||||||
|
|
||||||
ensure_toolchain() {
|
ensure_toolchain() {
|
||||||
|
@ -187,7 +184,7 @@ if [[ "$CMD" =~ ^(build|install|image|run|gdb|rebuild|recreate|kaddr2line|addr2l
|
||||||
# this error after the toolchain finished building:
|
# this error after the toolchain finished building:
|
||||||
# ninja: error: loading 'build.ninja': No such file or directory
|
# ninja: error: loading 'build.ninja': No such file or directory
|
||||||
ensure_target
|
ensure_target
|
||||||
ensure_toolchain
|
[ "$TARGET" = "lagom" ] || ensure_toolchain
|
||||||
case "$CMD" in
|
case "$CMD" in
|
||||||
build)
|
build)
|
||||||
build_target "$@"
|
build_target "$@"
|
||||||
|
@ -243,10 +240,16 @@ if [[ "$CMD" =~ ^(build|install|image|run|gdb|rebuild|recreate|kaddr2line|addr2l
|
||||||
[ $# -ge 2 ] || usage
|
[ $# -ge 2 ] || usage
|
||||||
BINARY_FILE="$1"; shift
|
BINARY_FILE="$1"; shift
|
||||||
BINARY_FILE_PATH="$BUILD_DIR/$BINARY_FILE"
|
BINARY_FILE_PATH="$BUILD_DIR/$BINARY_FILE"
|
||||||
if [ -x "$BINARY_FILE_PATH" ]; then
|
if [ "$TARGET" = "lagom" ]; then
|
||||||
"$TOOLCHAIN_DIR/binutils/binutils/addr2line" -e "$BINARY_FILE_PATH" "$@"
|
command -v addr2line >/dev/null 2>&1 || die "Please install addr2line!"
|
||||||
|
ADDR2LINE=addr2line
|
||||||
else
|
else
|
||||||
find "$BUILD_DIR" -name "$BINARY_FILE" -executable -type f -exec "$TOOLCHAIN_DIR/binutils/binutils/addr2line" -e {} "$@" \;
|
ADDR2LINE="$TOOLCHAIN_DIR/binutils/binutils/addr2line"
|
||||||
|
fi
|
||||||
|
if [ -x "$BINARY_FILE_PATH" ]; then
|
||||||
|
"$ADDR2LINE" -e "$BINARY_FILE_PATH" "$@"
|
||||||
|
else
|
||||||
|
find "$BUILD_DIR" -name "$BINARY_FILE" -executable -type f -exec "$ADDR2LINE" -e {} "$@" \;
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue