1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:27:45 +00:00

Everywhere: Replace SERENITY_ROOT with SERENITY_SOURCE_DIR

This commit is contained in:
Panagiotis Vasilopoulos 2021-04-20 03:51:04 +03:00 committed by Linus Groh
parent 3f5c934ea6
commit e45e0eeb47
33 changed files with 69 additions and 69 deletions

View file

@ -27,7 +27,7 @@ disk_usage() {
du -sm "$1" | cut -f1
}
DISK_SIZE=$(($(disk_usage "$SERENITY_ROOT/Base") + $(disk_usage Root) + 300))
DISK_SIZE=$(($(disk_usage "$SERENITY_SOURCE_DIR/Base") + $(disk_usage Root) + 300))
echo "setting up disk image..."
if [ "$1" = "ebr" ]; then
@ -98,7 +98,7 @@ script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
"$script_path/build-root-filesystem.sh"
if [ -z "$2" ]; then
grub_cfg="$SERENITY_ROOT"/Meta/grub-"${partition_scheme}".cfg
grub_cfg="$SERENITY_SOURCE_DIR"/Meta/grub-"${partition_scheme}".cfg
else
grub_cfg=$2
fi

View file

@ -23,7 +23,7 @@ disk_usage() {
expr "$(du -sk "$1" | cut -f1)" / 1024
}
DISK_SIZE=$(($(disk_usage "$SERENITY_ROOT/Base") + $(disk_usage Root) + 100))
DISK_SIZE=$(($(disk_usage "$SERENITY_SOURCE_DIR/Base") + $(disk_usage Root) + 100))
echo "setting up disk image..."
qemu-img create _disk_image "${DISK_SIZE:-600}"m || die "could not create disk image"

View file

@ -26,19 +26,19 @@ if [ "$(id -u)" != 0 ]; then
die "this script needs to run as root"
fi
[ -z "$SERENITY_ROOT" ] && die "SERENITY_ROOT is not set"
[ -d "$SERENITY_ROOT/Base" ] || die "$SERENITY_ROOT/Base doesn't exist"
[ -z "$SERENITY_SOURCE_DIR" ] && die "SERENITY_SOURCE_DIR is not set"
[ -d "$SERENITY_SOURCE_DIR/Base" ] || die "$SERENITY_SOURCE_DIR/Base doesn't exist"
umask 0022
printf "installing base system... "
$CP -PdR "$SERENITY_ROOT"/Base/* mnt/
$CP "$SERENITY_ROOT"/Toolchain/Local/i686/i686-pc-serenity/lib/libgcc_s.so mnt/usr/lib/
$CP -PdR "$SERENITY_SOURCE_DIR"/Base/* mnt/
$CP "$SERENITY_SOURCE_DIR"/Toolchain/Local/i686/i686-pc-serenity/lib/libgcc_s.so mnt/usr/lib/
$CP -PdR Root/* mnt/
# If umask was 027 or similar when the repo was cloned,
# file permissions in Base/ are too restrictive. Restore
# the permissions needed in the image.
chmod -R g+rX,o+rX "$SERENITY_ROOT"/Base/* mnt/
chmod -R g+rX,o+rX "$SERENITY_SOURCE_DIR"/Base/* mnt/
chmod 660 mnt/etc/WindowServer/WindowServer.ini
chown $window_uid:$window_gid mnt/etc/WindowServer/WindowServer.ini
@ -96,9 +96,9 @@ mkdir -p mnt/home/anon
mkdir -p mnt/home/anon/Desktop
mkdir -p mnt/home/anon/Downloads
mkdir -p mnt/home/nona
cp "$SERENITY_ROOT"/README.md mnt/home/anon/
cp -r "$SERENITY_ROOT"/Userland/Libraries/LibJS/Tests mnt/home/anon/js-tests
cp -r "$SERENITY_ROOT"/Userland/Libraries/LibWeb/Tests mnt/home/anon/web-tests
cp "$SERENITY_SOURCE_DIR"/README.md mnt/home/anon/
cp -r "$SERENITY_SOURCE_DIR"/Userland/Libraries/LibJS/Tests mnt/home/anon/js-tests
cp -r "$SERENITY_SOURCE_DIR"/Userland/Libraries/LibWeb/Tests mnt/home/anon/web-tests
chmod 700 mnt/root
chmod 700 mnt/home/anon
chmod 700 mnt/home/nona
@ -126,14 +126,14 @@ ln -s checksum mnt/bin/sha256sum
ln -s checksum mnt/bin/sha512sum
echo "done"
if [ -f "${SERENITY_ROOT}/Kernel/sync-local.sh" ] || [ -f "${SERENITY_ROOT}/Build/sync-local.sh" ]; then
if [ -f "${SERENITY_SOURCE_DIR}/Kernel/sync-local.sh" ] || [ -f "${SERENITY_SOURCE_DIR}/Build/sync-local.sh" ]; then
# TODO: Deprecated on 2021-01-30. In a few months, remove this 'if'.
tput setaf 1
echo
echo " +-----------------------------------------------------------------------------+"
echo " | |"
echo " | WARNING: sync-local.sh, previously located in Kernel/ and later Build/ |"
echo " | must be moved to \$SERENITY_ROOT! |"
echo " | must be moved to \$SERENITY_SOURCE_DIR! |"
echo " | See https://github.com/SerenityOS/serenity/pull/5172 for details. |"
echo " | |"
echo " +-----------------------------------------------------------------------------+"
@ -142,6 +142,6 @@ if [ -f "${SERENITY_ROOT}/Kernel/sync-local.sh" ] || [ -f "${SERENITY_ROOT}/Buil
fi
# Run local sync script, if it exists
if [ -f "${SERENITY_ROOT}/sync-local.sh" ]; then
sh "${SERENITY_ROOT}/sync-local.sh"
if [ -f "${SERENITY_SOURCE_DIR}/sync-local.sh" ]; then
sh "${SERENITY_SOURCE_DIR}/sync-local.sh"
fi

View file

@ -1,10 +1,10 @@
#!/usr/bin/env bash
SERENITY_PORTS_DIR="${SERENITY_ROOT}/Build/${SERENITY_ARCH}/Root/usr/Ports"
SERENITY_PORTS_DIR="${SERENITY_SOURCE_DIR}/Build/${SERENITY_ARCH}/Root/usr/Ports"
for file in $(git ls-files "${SERENITY_ROOT}/Ports"); do
for file in $(git ls-files "${SERENITY_SOURCE_DIR}/Ports"); do
if [ "$(basename "$file")" != ".hosted_defs.sh" ]; then
target=${SERENITY_PORTS_DIR}/$(realpath --relative-to="${SERENITY_ROOT}/Ports" "$file")
target=${SERENITY_PORTS_DIR}/$(realpath --relative-to="${SERENITY_SOURCE_DIR}/Ports" "$file")
mkdir -p "$(dirname "$target")" && cp "$file" "$target"
fi
done

View file

@ -2,13 +2,13 @@
set -e
if [ -z "$SERENITY_ROOT" ]
if [ -z "$SERENITY_SOURCE_DIR" ]
then
SERENITY_ROOT="$(git rev-parse --show-toplevel)"
SERENITY_SOURCE_DIR="$(git rev-parse --show-toplevel)"
echo "Serenity root not set. This is fine! Other scripts may require you to set the environment variable first, e.g.:"
echo " export SERENITY_ROOT=${SERENITY_ROOT}"
echo " export SERENITY_SOURCE_DIR=${SERENITY_SOURCE_DIR}"
fi
cd "$SERENITY_ROOT"
cd "$SERENITY_SOURCE_DIR"
find . \( -name Base -o -name Patches -o -name Ports -o -name Root -o -name Toolchain -o -name Build \) -prune -o \( -name '*.ipc' -or -name '*.cpp' -or -name '*.idl' -or -name '*.c' -or -name '*.h' -or -name '*.S' -or -name '*.css' -or -name '*.json' -or -name '*.gml' -or -name 'CMakeLists.txt' \) -print > serenity.files

View file

@ -91,9 +91,9 @@ cd -P -- "$SERENITY_BUILD" || die "Could not cd to \"$SERENITY_BUILD\""
if [ "$SERENITY_RUN" = "b" ]; then
# Meta/run.sh b: bochs
[ -z "$SERENITY_BOCHSRC" ] && {
# Make sure that SERENITY_ROOT is set and not empty
[ -z "$SERENITY_ROOT" ] && die 'SERENITY_ROOT not set or empty'
SERENITY_BOCHSRC="$SERENITY_ROOT/Meta/bochsrc"
# Make sure that SERENITY_SOURCE_DIR is set and not empty
[ -z "$SERENITY_SOURCE_DIR" ] && die 'SERENITY_SOURCE_DIR not set or empty'
SERENITY_BOCHSRC="$SERENITY_SOURCE_DIR/Meta/bochsrc"
}
"$SERENITY_BOCHS_BIN" -q -f "$SERENITY_BOCHSRC"
elif [ "$SERENITY_RUN" = "qn" ]; then

View file

@ -106,14 +106,14 @@ create_build_dir() {
cmd_with_target() {
is_valid_target || ( >&2 echo "Unknown target: $TARGET"; usage )
if [ ! -d "$SERENITY_ROOT" ]; then
SERENITY_ROOT="$(get_top_dir)"
export SERENITY_ROOT
if [ ! -d "$SERENITY_SOURCE_DIR" ]; then
SERENITY_SOURCE_DIR="$(get_top_dir)"
export SERENITY_SOURCE_DIR
fi
BUILD_DIR="$SERENITY_ROOT/Build/$TARGET"
BUILD_DIR="$SERENITY_SOURCE_DIR/Build/$TARGET"
if [ "$TARGET" != "lagom" ]; then
export SERENITY_ARCH="$TARGET"
TOOLCHAIN_DIR="$SERENITY_ROOT/Toolchain/Build/$TARGET"
TOOLCHAIN_DIR="$SERENITY_SOURCE_DIR/Toolchain/Build/$TARGET"
fi
}
@ -140,7 +140,7 @@ delete_target() {
}
build_toolchain() {
( cd "$SERENITY_ROOT/Toolchain" && ARCH="$TARGET" ./BuildIt.sh )
( cd "$SERENITY_SOURCE_DIR/Toolchain" && ARCH="$TARGET" ./BuildIt.sh )
}
ensure_toolchain() {