forked from len0rd/rockbox
This enables two of the "unfinished" puzzles. Slide requires a new "sticky mouse mode" to enable dragging. The help system is disabled for these puzzles, since they lack manual chapters. Group is currently unplayable due to lack of request_keys() support, which will need to be added upstream. Separate fails to draw anything. Change-Id: I7bcff3679ac5b10b0f39c5eaa19a36b4b1fe8d53
83 lines
2.8 KiB
Bash
Executable file
83 lines
2.8 KiB
Bash
Executable file
#!/bin/sh
|
|
# Usage: resync.sh PUZZLES_PATH
|
|
#
|
|
# Automatic resync tool. Removes the current source snapshot in src/
|
|
# and copies just the source files we need from the puzzles source
|
|
# tree. Handles help generation as well. Stages changes in git.
|
|
#
|
|
# Expects a modified Halibut (https://www.fwei.tk/git/halibut) to be
|
|
# installed in $PATH. Also requires host CC and lz4 library to be
|
|
# available
|
|
|
|
|
|
if [ $# -ne 1 ]
|
|
then
|
|
echo -e "Usage: $0 PUZZLES_PATH\n"
|
|
echo "Automatically resync with upstream."
|
|
echo "PUZZLES_PATH is the path to a puzzles source tree."
|
|
exit
|
|
fi
|
|
|
|
echo "=== POTENTIALLY DANGEROUS OPERATION ==="
|
|
echo "Are you sure you want to remove all files in src/ and help/?"
|
|
echo -n "If so, type \"yes\" in all caps: "
|
|
read ans
|
|
if [ "YES" == $ans ]
|
|
then
|
|
pushd "$(dirname "$0")" > /dev/null
|
|
ROOT="$PWD"
|
|
|
|
echo "[1/5] Removing current src/ directory"
|
|
rm -rf src
|
|
echo "[2/5] Copying new sources"
|
|
mkdir -p src/unfinished
|
|
cp -r "$1"/{*.h,puzzles.but,LICENCE,README,CMakeLists.txt,unfinished} src
|
|
|
|
# Parse out definitions of core, core_obj, and common from
|
|
# CMakeLists. Extract the .c filenames, except malloc.c, and store
|
|
# in SOURCES.core.
|
|
cat src/CMakeLists.txt | awk '/add_library\(/{p=1} p{printf $0" "} /\)/{if(p) print; p=0}' | grep -E "core|common" | grep -Po "[a-z0-9\-]*?\.c" | sort -n | grep -vE 'malloc\.c|ps\.c' | awk '{print "src/"$0}' | uniq > SOURCES.core
|
|
echo "src/printing.c" >> SOURCES.core
|
|
|
|
# Parse out puzzle definitions to build SOURCES.games, but
|
|
# preserve the ability to disable puzzles based on memory size.
|
|
cat src/CMakeLists.txt | awk '/puzzle\(/{p=1} p{print} /\)/{p=0}' | grep -Eo "\(.*$" | tr -dc "a-z\n" | grep -v nullgame | awk '$0!~/loopy|pearl|solo/' | awk '{print "src/"$0".c"}' > SOURCES.games
|
|
|
|
SRC="$(cat SOURCES.games SOURCES.core | sed 's/src\///' | tr '\n' ' ' | head -c-1) loopy.c pearl.c solo.c"
|
|
echo "Detected sources:" $SRC
|
|
pushd "$1" > /dev/null
|
|
cp -r $SRC "$ROOT"/src
|
|
popd > /dev/null
|
|
|
|
cat src/unfinished/CMakeLists.txt | awk '/puzzle\(/{p=1} p{print} /\)/{p=0}' | grep -Eo "\(.*$" | tr -dc "a-z\n" | awk '{print "src/unfinished/"$0".c"}' | grep -v "group" | grep -v "separate" >> SOURCES.games
|
|
|
|
cat <<EOF >> SOURCES.games
|
|
|
|
/* no c200v2 */
|
|
#if PLUGIN_BUFFER_SIZE > 0x14000
|
|
src/loopy.c
|
|
src/pearl.c
|
|
src/solo.c
|
|
#endif
|
|
EOF
|
|
|
|
cat <<EOF > SOURCES
|
|
/* Auto-generated by resync.sh */
|
|
EOF
|
|
cat SOURCES.rockbox | cpp | grep -vE "^#" >> SOURCES
|
|
echo -e "\n/* puzzles core sources */" >> SOURCES
|
|
cat SOURCES.core >> SOURCES
|
|
rm SOURCES.core
|
|
|
|
echo "[3/5] Regenerating help"
|
|
rm -rf help
|
|
./genhelp.sh
|
|
|
|
echo "[4/5] Staging for commit"
|
|
git add src help
|
|
echo "[5/5] Successfully resynced with upstream"
|
|
|
|
popd > /dev/null
|
|
else
|
|
echo "Did nothing."
|
|
fi
|