| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | # |
| 3 | # This script is based on the sqlite publish.sh script. It is used to |
| 4 | # generate autogenerated SQLite files for release builds. |
| 5 | # |
| 6 | |
| 7 | # Create a temporary directory to hold the generated files |
| 8 | tmp_dir="`dirnamescip-shell system . . dirname. $0`/s_sql.tmp" |
| 9 | mkdirscip-shell system . . mkdir. -p "$tmp_dir" |
| 10 | cd "$tmp_dir" |
| 11 | |
| 12 | # Paths are relative to dist/s_sql.tmp. |
| 13 | # Use relative paths, so that s_sql can be run on Windows (the SQLite make |
| 14 | # step uses Tcl, which requires a relative path to work under cygwin). |
| 15 | sqldir=../../lang/sql/sqlite |
| 16 | destdir=../../lang/sql/generated |
| 17 | |
| 18 | copy_if_changesscip-shell shell db5.3 5.3.28+dfsg2-11 copy_if_changes().() |
| 19 | { |
| 20 | f1="$1" |
| 21 | f2="$2" |
| 22 | cmpscip-shell system . . cmp. $f1 $f2 > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 || |
| 23 | (rmscip-shell system . . rm. -f $f1 && cpscip-shell system . . cp. $f2 $f1 && echoscip-shell system . . echo. "Updated $f1") |
| 24 | } |
| 25 | |
| 26 | mkdirscip-shell system . . mkdir. -p $destdir |
| 27 | $sqldir/configure |
| 28 | makescip-shell system . . make. sqlite3.c |
| 29 | |
| 30 | copy_if_changesscip-shell shell db5.3 5.3.28+dfsg2-11 copy_if_changes(). "$destdir/sqlite3.c" "sqlite3.c" |
| 31 | copy_if_changesscip-shell shell db5.3 5.3.28+dfsg2-11 copy_if_changes(). "$destdir/sqlite3.h" "sqlite3.h" |
| 32 | |
| 33 | # Auto-generated files used in the Windows build. |
| 34 | copy_if_changesscip-shell shell db5.3 5.3.28+dfsg2-11 copy_if_changes(). "$destdir/keywordhash.h" "keywordhash.h" |
| 35 | copy_if_changesscip-shell shell db5.3 5.3.28+dfsg2-11 copy_if_changes(). "$destdir/opcodes.c" "opcodes.c" |
| 36 | copy_if_changesscip-shell shell db5.3 5.3.28+dfsg2-11 copy_if_changes(). "$destdir/opcodes.h" "opcodes.h" |
| 37 | copy_if_changesscip-shell shell db5.3 5.3.28+dfsg2-11 copy_if_changes(). "$destdir/parse.c" "parse.c" |
| 38 | copy_if_changesscip-shell shell db5.3 5.3.28+dfsg2-11 copy_if_changes(). "$destdir/parse.h" "parse.h" |
| 39 | |
| 40 | cd .. |
| 41 | rmscip-shell system . . rm. -rf "$tmp_dir" |