summaryrefslogtreecommitdiff
path: root/apps/plugins/puzzles/resync.sh
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/puzzles/resync.sh')
-rwxr-xr-xapps/plugins/puzzles/resync.sh45
1 files changed, 44 insertions, 1 deletions
diff --git a/apps/plugins/puzzles/resync.sh b/apps/plugins/puzzles/resync.sh
index 384fc79d1f..7c2df45c7e 100755
--- a/apps/plugins/puzzles/resync.sh
+++ b/apps/plugins/puzzles/resync.sh
@@ -25,12 +25,55 @@ read ans
25if [ "YES" == $ans ] 25if [ "YES" == $ans ]
26then 26then
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 src
33 cp -r "$1"/{*.c,*.h,*.but,LICENCE,README,CMakeLists.txt} src 34 cp -r "$1"/{*.h,puzzles.but,LICENCE,README,CMakeLists.txt} 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 $SRC "$ROOT"/src
50 popd > /dev/null
51
52 cat <<EOF >> SOURCES.games
53
54/* Disabled for now. Fix puzzles.make and CATEGORIES to accomodate these. */
55/* The help system would also need to be patched to compile these. */
56/*src/unfinished/group.c*/
57/*src/unfinished/separate.c*/
58/*src/unfinished/slide.c*/
59/*src/unfinished/sokoban.c*/
60
61/* no c200v2 */
62#if PLUGIN_BUFFER_SIZE > 0x14000
63src/loopy.c
64src/pearl.c
65src/solo.c
66#endif
67EOF
68
69 cat <<EOF > SOURCES
70/* Auto-generated by resync.sh */
71EOF
72 cat SOURCES.rockbox | cpp | grep -vE "^#" >> SOURCES
73 echo -e "\n/* puzzles core sources */" >> SOURCES
74 cat SOURCES.core >> SOURCES
75 rm SOURCES.core
76
34 echo "[3/5] Regenerating help" 77 echo "[3/5] Regenerating help"
35 rm -rf help 78 rm -rf help
36 ./genhelp.sh 79 ./genhelp.sh