2021-04-25 19:10:34 -04:00
|
|
|
#!/bin/bash
|
|
|
|
cd "$(dirname "${BASH_SOURCE[0]}")"
|
|
|
|
|
2021-12-04 03:14:35 -03:00
|
|
|
archive_filename="nxdumptool-rewrite_poc_$(git rev-parse --short HEAD)"
|
2021-04-25 19:10:34 -04:00
|
|
|
|
2022-03-22 16:55:06 -03:00
|
|
|
# Clean-up from last build
|
2021-08-03 03:15:06 -04:00
|
|
|
rm -f ./*.7z
|
2021-04-25 19:10:34 -04:00
|
|
|
|
|
|
|
rm -rf ./code_templates/tmp
|
|
|
|
mkdir ./code_templates/tmp
|
|
|
|
|
|
|
|
mv ./source/main.cpp ./main.cpp
|
|
|
|
|
|
|
|
make clean_all
|
|
|
|
|
2022-03-22 16:55:06 -03:00
|
|
|
# Build loop
|
2021-04-25 19:10:34 -04:00
|
|
|
for f in ./code_templates/*.c; do
|
|
|
|
basename="$(basename "$f")"
|
|
|
|
filename="${basename%.*}"
|
2022-07-04 21:04:28 -04:00
|
|
|
|
2021-04-25 19:10:34 -04:00
|
|
|
if [[ $filename == "dump_title_infos" ]]; then
|
|
|
|
continue
|
|
|
|
fi
|
2022-07-04 21:04:28 -04:00
|
|
|
|
2021-04-25 19:10:34 -04:00
|
|
|
echo $filename
|
2022-07-04 21:04:28 -04:00
|
|
|
|
2021-04-25 19:10:34 -04:00
|
|
|
rm -f ./source/main.c
|
|
|
|
cp $f ./source/main.c
|
2022-07-04 21:04:28 -04:00
|
|
|
|
2021-05-18 08:32:43 -04:00
|
|
|
cp ./romfs/icon/nxdumptool.jpg ./romfs/icon/$filename.jpg
|
2022-07-04 21:04:28 -04:00
|
|
|
|
2021-05-18 08:32:43 -04:00
|
|
|
make BUILD_TYPE="$filename" -j$(nproc)
|
2022-07-04 21:04:28 -04:00
|
|
|
|
2021-05-18 08:32:43 -04:00
|
|
|
rm -f ./romfs/icon/$filename.jpg
|
2022-07-04 21:04:28 -04:00
|
|
|
|
2021-04-25 19:10:34 -04:00
|
|
|
mkdir ./code_templates/tmp/$filename
|
2021-05-18 08:32:43 -04:00
|
|
|
cp ./$filename.nro ./code_templates/tmp/$filename/$filename.nro
|
2021-12-04 03:14:35 -03:00
|
|
|
cp ./$filename.elf ./code_templates/tmp/$filename/$filename.elf
|
2022-07-04 21:04:28 -04:00
|
|
|
|
2021-05-18 08:32:43 -04:00
|
|
|
make BUILD_TYPE="$filename" clean
|
2021-04-25 19:10:34 -04:00
|
|
|
done
|
|
|
|
|
2022-03-22 16:55:06 -03:00
|
|
|
# Post build clean-up
|
2021-04-25 19:10:34 -04:00
|
|
|
make clean_all
|
|
|
|
|
2022-03-22 16:55:06 -03:00
|
|
|
# Package resulting binaries
|
2021-04-25 19:10:34 -04:00
|
|
|
cd ./code_templates/tmp
|
2021-12-04 03:14:35 -03:00
|
|
|
7z a ../../"$archive_filename.7z" */*.nro
|
|
|
|
7z a ../../"$archive_filename-Debug_ELFs.7z" */*.elf
|
2021-04-25 19:10:34 -04:00
|
|
|
|
2022-03-22 16:55:06 -03:00
|
|
|
# Final clean-up
|
2021-04-25 19:10:34 -04:00
|
|
|
cd ../..
|
|
|
|
rm -f ./source/main.c
|
|
|
|
rm -rf ./code_templates/tmp
|
|
|
|
mv ./main.cpp ./source/main.cpp
|