diff options
Diffstat (limited to 'apps/plugins/puzzles/resync.sh')
-rwxr-xr-x | apps/plugins/puzzles/resync.sh | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/apps/plugins/puzzles/resync.sh b/apps/plugins/puzzles/resync.sh index 76679971a4..3431a6f695 100755 --- a/apps/plugins/puzzles/resync.sh +++ b/apps/plugins/puzzles/resync.sh | |||
@@ -19,19 +19,58 @@ then | |||
19 | fi | 19 | fi |
20 | 20 | ||
21 | echo "=== POTENTIALLY DANGEROUS OPERATION ===" | 21 | echo "=== POTENTIALLY DANGEROUS OPERATION ===" |
22 | echo "Are you sure you want to remove all files in src/?" | 22 | echo "Are you sure you want to remove all files in src/ and help/?" |
23 | echo -n "If so, type \"yes\" in all caps: " | 23 | echo -n "If so, type \"yes\" in all caps: " |
24 | read ans | 24 | read ans |
25 | if [ "YES" == $ans ] | 25 | if [ "YES" == $ans ] |
26 | then | 26 | then |
27 | pushd "$(dirname "$0")" > /dev/null | 27 | pushd "$(dirname "$0")" > /dev/null |
28 | ROOT="$PWD" | ||
28 | 29 | ||
29 | echo "[1/5] Removing current src/ directory" | 30 | echo "[1/5] Removing current src/ directory" |
30 | rm -rf src | 31 | rm -rf src |
31 | echo "[2/5] Copying new sources" | 32 | echo "[2/5] Copying new sources" |
32 | mkdir src | 33 | mkdir -p src/unfinished |
33 | cp -r "$1"/{*.c,*.h,*.R,*.but,LICENCE,README} src | 34 | cp -r "$1"/{*.h,puzzles.but,LICENCE,README,CMakeLists.txt,unfinished} src |
35 | |||
36 | # Parse out definitions of core, core_obj, and common from | ||
37 | # CMakeLists. Extract the .c filenames, except malloc.c, and store | ||
38 | # in SOURCES.core. | ||
39 | 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 | ||
40 | echo "src/printing.c" >> SOURCES.core | ||
41 | |||
42 | # Parse out puzzle definitions to build SOURCES.games, but | ||
43 | # preserve the ability to disable puzzles based on memory size. | ||
44 | 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 | ||
45 | |||
46 | SRC="$(cat SOURCES.games SOURCES.core | sed 's/src\///' | tr '\n' ' ' | head -c-1) loopy.c pearl.c solo.c" | ||
47 | echo "Detected sources:" $SRC | ||
48 | pushd "$1" > /dev/null | ||
49 | cp -r $SRC "$ROOT"/src | ||
50 | popd > /dev/null | ||
51 | |||
52 | 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 | ||
53 | |||
54 | cat <<EOF >> SOURCES.games | ||
55 | |||
56 | /* no c200v2 */ | ||
57 | #if PLUGIN_BUFFER_SIZE > 0x14000 | ||
58 | src/loopy.c | ||
59 | src/pearl.c | ||
60 | src/solo.c | ||
61 | #endif | ||
62 | EOF | ||
63 | |||
64 | cat <<EOF > SOURCES | ||
65 | /* Auto-generated by resync.sh */ | ||
66 | EOF | ||
67 | cat SOURCES.rockbox | cpp | grep -vE "^#" >> SOURCES | ||
68 | echo -e "\n/* puzzles core sources */" >> SOURCES | ||
69 | cat SOURCES.core >> SOURCES | ||
70 | rm SOURCES.core | ||
71 | |||
34 | echo "[3/5] Regenerating help" | 72 | echo "[3/5] Regenerating help" |
73 | rm -rf help | ||
35 | ./genhelp.sh | 74 | ./genhelp.sh |
36 | 75 | ||
37 | echo "[4/5] Staging for commit" | 76 | echo "[4/5] Staging for commit" |