| 1 | #!/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="`dirname $0`/s_sql.tmp" |
| 9 | 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_changes() |
| 19 | { |
| 20 | f1="$1" |
| 21 | f2="$2" |
| 22 | cmp $f1 $f2 > /dev/null 2>&1 || |
| 23 | (rm -f $f1 && cp $f2 $f1 && echo "Updated $f1") |
| 24 | } |
| 25 | |
| 26 | mkdir -p $destdir |
| 27 | $sqldir/configure |
| 28 | make sqlite3.c |
| 29 | |
| 30 | copy_if_changes "$destdir/sqlite3.c" "sqlite3.c" |
| 31 | copy_if_changes "$destdir/sqlite3.h" "sqlite3.h" |
| 32 | |
| 33 | # Auto-generated files used in the Windows build. |
| 34 | copy_if_changes "$destdir/keywordhash.h" "keywordhash.h" |
| 35 | copy_if_changes "$destdir/opcodes.c" "opcodes.c" |
| 36 | copy_if_changes "$destdir/opcodes.h" "opcodes.h" |
| 37 | copy_if_changes "$destdir/parse.c" "parse.c" |
| 38 | copy_if_changes "$destdir/parse.h" "parse.h" |
| 39 | |
| 40 | cd .. |
| 41 | rm -rf "$tmp_dir" |