mirror of
https://github.com/PartialVolume/shredos.x86_64.git
synced 2026-02-19 21:22:10 +00:00
fix: amend buildscript
Signed-off-by: desertwitch <24509509+desertwitch@users.noreply.github.com>
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,6 +1,7 @@
|
|||||||
/output
|
/output
|
||||||
/dist
|
/dist
|
||||||
/dl
|
/dl
|
||||||
|
/build_all_shredos.log
|
||||||
/.auto.deps
|
/.auto.deps
|
||||||
/.config.cmd
|
/.config.cmd
|
||||||
/.config.old
|
/.config.old
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ prompt_version() {
|
|||||||
[ -z "$NEW_VERSION" ] && NEW_VERSION="$current_version"
|
[ -z "$NEW_VERSION" ] && NEW_VERSION="$current_version"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$NEW_VERSION" > "$VERSION_FILE"
|
run_cmd_change_version "$NEW_VERSION"
|
||||||
|
|
||||||
printf "%b" "$GREEN"
|
printf "%b" "$GREEN"
|
||||||
echo
|
echo
|
||||||
@@ -211,18 +211,55 @@ replace_version() {
|
|||||||
local to=$2
|
local to=$2
|
||||||
|
|
||||||
if [ -f "$VERSION_FILE" ]; then
|
if [ -f "$VERSION_FILE" ]; then
|
||||||
sed -i "s@$from@$to@g" "$VERSION_FILE"
|
run_cmd sed -i "s@$from@$to@g" "$VERSION_FILE"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
run_cmd() {
|
run_cmd() {
|
||||||
|
local timestamp
|
||||||
|
timestamp=$(date '+%d.%m.%Y %H:%M:%S')
|
||||||
|
|
||||||
if [ "$DRY_RUN" -eq 1 ]; then
|
if [ "$DRY_RUN" -eq 1 ]; then
|
||||||
|
if [[ $* == make* ]]; then
|
||||||
|
printf "%b" "$YELLOW"
|
||||||
echo "[DRY_RUN] $*"
|
echo "[DRY_RUN] $*"
|
||||||
|
printf "%b" "$RESET"
|
||||||
else
|
else
|
||||||
|
echo "[DRY_RUN] $*"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "[$timestamp] $*" >> "build_all_shredos.log"
|
||||||
"$@"
|
"$@"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
run_cmd_tee() {
|
||||||
|
local timestamp
|
||||||
|
timestamp=$(date '+%d.%m.%Y %H:%M:%S')
|
||||||
|
local log_file="$1"
|
||||||
|
|
||||||
|
if [ "$DRY_RUN" -eq 1 ]; then
|
||||||
|
echo "[DRY_RUN] tee $log_file"
|
||||||
|
cat
|
||||||
|
else
|
||||||
|
echo "[$timestamp] tee $log_file" >> "build_all_shredos.log"
|
||||||
|
tee "$log_file"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
run_cmd_change_version() {
|
||||||
|
local timestamp
|
||||||
|
timestamp=$(date '+%d.%m.%Y %H:%M:%S')
|
||||||
|
local new_version="$1"
|
||||||
|
|
||||||
|
if [ "$DRY_RUN" -eq 1 ]; then
|
||||||
|
echo "[DRY_RUN] echo \"$new_version\" > \"$VERSION_FILE\""
|
||||||
|
else
|
||||||
|
echo "[$timestamp] echo \"$new_version\" > \"$VERSION_FILE\"" >> "build_all_shredos.log"
|
||||||
|
echo "$new_version" > "$VERSION_FILE"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
build_config() {
|
build_config() {
|
||||||
local index="$1"
|
local index="$1"
|
||||||
local config="$2"
|
local config="$2"
|
||||||
@@ -315,7 +352,7 @@ build_config() {
|
|||||||
echo "Building '$config' ($arch)..."
|
echo "Building '$config' ($arch)..."
|
||||||
echo "============================================"
|
echo "============================================"
|
||||||
echo
|
echo
|
||||||
if run_cmd make 2>&1 | tee "$log_file"; then
|
if run_cmd make 2>&1 | run_cmd_tee "$log_file"; then
|
||||||
echo
|
echo
|
||||||
echo "============================================"
|
echo "============================================"
|
||||||
echo "Finishing '$config' ($arch)..."
|
echo "Finishing '$config' ($arch)..."
|
||||||
@@ -334,7 +371,8 @@ build_config() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
print_summary() {
|
print_summary_and_exit() {
|
||||||
|
local return_code="$1"
|
||||||
local total_success=$((X64_SUCCESS + X32_SUCCESS))
|
local total_success=$((X64_SUCCESS + X32_SUCCESS))
|
||||||
local total_failed=$((X64_FAILED + X32_FAILED))
|
local total_failed=$((X64_FAILED + X32_FAILED))
|
||||||
local total_builds=$((total_success + total_failed))
|
local total_builds=$((total_success + total_failed))
|
||||||
@@ -349,8 +387,17 @@ print_summary() {
|
|||||||
echo "Total: $total_success succeeded, $total_failed failed (out of $total_builds)"
|
echo "Total: $total_success succeeded, $total_failed failed (out of $total_builds)"
|
||||||
echo "--------------------------------------------"
|
echo "--------------------------------------------"
|
||||||
echo "You will find all output files of the builds in the 'dist/' folder."
|
echo "You will find all output files of the builds in the 'dist/' folder."
|
||||||
|
echo "Check 'build_all_shredos.log' for all the commands that were executed."
|
||||||
echo "============================================"
|
echo "============================================"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
if [ "$return_code" -ne 0 ]; then
|
||||||
|
exit "$return_code"
|
||||||
|
elif [ "$total_failed" -gt 0 ]; then
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
build_config_success() {
|
build_config_success() {
|
||||||
@@ -418,6 +465,10 @@ build_config_failed() {
|
|||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
if [ -f "build_all_shredos.log" ]; then
|
||||||
|
rm build_all_shredos.log
|
||||||
|
fi
|
||||||
|
|
||||||
parse_arguments "$@"
|
parse_arguments "$@"
|
||||||
prompt_version
|
prompt_version
|
||||||
display_build_plan
|
display_build_plan
|
||||||
@@ -477,7 +528,7 @@ run_cmd rm -r dist || true
|
|||||||
run_cmd mkdir -p dist
|
run_cmd mkdir -p dist
|
||||||
|
|
||||||
echo "Starting to build..."
|
echo "Starting to build..."
|
||||||
trap 'print_summary' EXIT
|
trap 'print_summary_and_exit $?' EXIT
|
||||||
|
|
||||||
if [ ${#X64_CONFIGS[@]} -gt 0 ]; then
|
if [ ${#X64_CONFIGS[@]} -gt 0 ]; then
|
||||||
echo
|
echo
|
||||||
@@ -513,10 +564,3 @@ if [ ${#X32_CONFIGS[@]} -gt 0 ]; then
|
|||||||
((++CFG_INDEX))
|
((++CFG_INDEX))
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TOTAL_FAILED=$((X64_FAILED + X32_FAILED))
|
|
||||||
if [ "$TOTAL_FAILED" -gt 0 ]; then
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|||||||
Reference in New Issue
Block a user