Skip to content

Commit

Permalink
created download script
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaWise committed Sep 25, 2018
1 parent c97e061 commit d5b9de5
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 16 deletions.
3 changes: 0 additions & 3 deletions deps/common.gypi
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
'variables': {
'sqlite_version%': '3250100',
},
'target_defaults': {
'default_configuration': 'Release',
'msbuild_toolset': '',
Expand Down
32 changes: 32 additions & 0 deletions deps/download.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env sh

VERSION="3250100"
YEAR="2018"

echo "downloading source..."
DEPS="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
TEMP="$DEPS/temp"
rm -rf "$TEMP"
mkdir -p "$TEMP"
curl -#f "https://www.sqlite.org/$YEAR/sqlite-src-$VERSION.zip" > "$TEMP/temp.zip" || exit 1
echo "extracting source..."
unzip "$TEMP/temp.zip" -d "$TEMP" > /dev/null || exit 1
cd "$TEMP/sqlite-src-$VERSION"

echo "configuring amalgamation..."
sh configure > /dev/null || exit 1

echo "building amalgamation..."
make sqlite3.c > /dev/null || exit 1

echo "generating tarball..."
tar czf "$DEPS/sqlite3.tar.gz" sqlite3.c sqlite3.h sqlite3ext.h || exit 1

echo "cleaning up..."
cd - > /dev/null
rm -rf "$TEMP"
MAJOR=`expr "${VERSION:0:1}" + 0`
MINOR=`expr "${VERSION:1:2}" + 0`
PATCH=`expr "${VERSION:3:2}" + 0`
sed -Eie "s/version [0-9]+\.[0-9]+\.[0-9]+/version $MAJOR.$MINOR.$PATCH/g" "$DEPS/../docs/compilation.md"
echo "done!"
Binary file removed deps/sqlite-autoconf-3250100.tar.gz
Binary file not shown.
20 changes: 12 additions & 8 deletions deps/sqlite3.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,23 @@
'hard_dependency': 1,
'actions': [{
'action_name': 'unpack_sqlite_dep',
'inputs': ['./sqlite-autoconf-<@(sqlite_version).tar.gz'],
'outputs': ['<(SHARED_INTERMEDIATE_DIR)/sqlite-autoconf-<@(sqlite_version)/sqlite3.c'],
'action': ['node', './extract.js', './sqlite-autoconf-<@(sqlite_version).tar.gz', '<(SHARED_INTERMEDIATE_DIR)'],
'inputs': ['./sqlite3.tar.gz'],
'outputs': [
'<(SHARED_INTERMEDIATE_DIR)/sqlite3/sqlite3.c',
'<(SHARED_INTERMEDIATE_DIR)/sqlite3/sqlite3.h',
'<(SHARED_INTERMEDIATE_DIR)/sqlite3/sqlite3ext.h',
],
'action': ['node', './extract.js', '<@(_inputs)', '<(SHARED_INTERMEDIATE_DIR)/sqlite3'],
}],
},
{
'target_name': 'sqlite3',
'type': 'static_library',
'dependencies': ['action_before_build'],
'sources': ['<(SHARED_INTERMEDIATE_DIR)/sqlite-autoconf-<@(sqlite_version)/sqlite3.c'],
'include_dirs': ['<(SHARED_INTERMEDIATE_DIR)/sqlite-autoconf-<@(sqlite_version)/'],
'sources': ['<(SHARED_INTERMEDIATE_DIR)/sqlite3/sqlite3.c'],
'include_dirs': ['<(SHARED_INTERMEDIATE_DIR)/sqlite3/'],
'direct_dependent_settings': {
'include_dirs': ['<(SHARED_INTERMEDIATE_DIR)/sqlite-autoconf-<@(sqlite_version)/'],
'include_dirs': ['<(SHARED_INTERMEDIATE_DIR)/sqlite3/'],
},
'cflags': [
'-std=c99',
Expand All @@ -60,6 +64,7 @@
],
},
'defines': [
# NOTE: when these change, so must /docs/compilation.md
'SQLITE_THREADSAFE=0',
'SQLITE_DEFAULT_MEMSTATUS=0',
'SQLITE_LIKE_DOESNT_MATCH_BLOBS',
Expand All @@ -81,8 +86,7 @@
'SQLITE_ENABLE_COLUMN_METADATA',
# TODO: test ANALYZE with stat4 enabled
# 'SQLITE_ENABLE_STAT4',
# TODO: evaluate the extra compilation steps necessary for this feature
# 'SQLITE_ENABLE_UPDATE_DELETE_LIMIT',
'SQLITE_ENABLE_UPDATE_DELETE_LIMIT',
'SQLITE_ENABLE_FTS4',
'SQLITE_ENABLE_FTS5',
'SQLITE_ENABLE_JSON1',
Expand Down
Binary file added deps/sqlite3.tar.gz
Binary file not shown.
25 changes: 20 additions & 5 deletions docs/compilation.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,30 @@
# SQLite3 compilation options

The following [compilation options](https://www.sqlite.org/compile.html) are used in this distribution of SQLite3.
This distribution currently uses SQLite3 **version 3.25.1** with the following [compilation options](https://www.sqlite.org/compile.html).

- SQLITE_THREADSAFE=0
- SQLITE_DEFAULT_MEMSTATUS=0
- SQLITE_LIKE_DOESNT_MATCH_BLOBS
- SQLITE_OMIT_DEPRECATED
- SQLITE_OMIT_TRACE
- SQLITE_OMIT_COMPLETE
- SQLITE_OMIT_GET_TABLE
- SQLITE_OMIT_DESERIALIZE
- SQLITE_OMIT_TCL_VARIABLE
- SQLITE_OMIT_AUTHORIZATION
- SQLITE_OMIT_PROGRESS_CALLBACK
- SQLITE_DEFAULT_CACHE_SIZE=-16000
- SQLITE_DEFAULT_FOREIGN_KEYS=1
- SQLITE_DEFAULT_WAL_SYNCHRONOUS=1
- SQLITE_MAX_ATTACHED=125
- SQLITE_MAX_LENGTH=2147483647
- SQLITE_MAX_SQL_LENGTH=1073741824
- SQLITE_USE_URI=1
- SQLITE_ENABLE_COLUMN_METADATA
- SQLITE_ENABLE_UPDATE_DELETE_LIMIT
- SQLITE_ENABLE_FTS4
- SQLITE_ENABLE_FTS5
- SQLITE_ENABLE_JSON1
- SQLITE_ENABLE_RTREE
- SQLITE_INTROSPECTION_PRAGMAS
- SQLITE_SOUNDEX
- SQLITE_DEFAULT_FOREIGN_KEYS=1
- SQLITE_DEFAULT_WAL_SYNCHRONOUS=1
- SQLITE_DEFAULT_CACHE_SIZE=-16000
- SQLITE_LIKE_DOESNT_MATCH_BLOBS
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"sqlite": "^2.9.0"
},
"scripts": {
"download": "sh ./deps/download.sh",
"lzz": "lzz -hx hpp -sx cpp -k BETTER_SQLITE3 -d -hl -sl -e ./src/better_sqlite3.lzz",
"prepublishOnly": "npm run lzz",
"install-debug": "node-gyp rebuild --debug",
Expand Down

0 comments on commit d5b9de5

Please sign in to comment.