Bug 1885580 - Add a MenuGroup component for the menu redesign r=android-reviewers,007
[gecko.git] / third_party / sqlite3 / vendor.sh
blob7e9964368a88a93d048f9e977a81a9e6d9b4f29e
1 #!/bin/bash
3 # IMPORTANT: use `./mach vendor third_party/sqlite3/moz.yaml`, don't invoke
4 # this script directly.
6 # Script to download updated versions of SQLite sources and extensions.
8 set -e
10 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
11 cd $DIR
13 # Retrieve SQLite information from the website script-friendly section.
15 echo ""
16 echo "Retrieving SQLite latest version..."
17 download_url="https://www.sqlite.org/download.html"
18 # The download page contains a script-friendly comment to extract file versions.
19 # PRODUCT,VERSION,RELATIVE-URL,SIZE-IN-BYTES,SHA3-HASH
20 # Match on the amalgamation to extract path and version, they are the same for
21 # all the files anyway.
22 re="PRODUCT,([^,]+),([^,]+)/sqlite-amalgamation-([0-9]+)\.zip"
23 DOWNLOAD_PAGE_HTML="`wget -t 3 --retry-connrefused -w 5 --random-wait $download_url -qO-`"
24 if [[ $DOWNLOAD_PAGE_HTML =~ $re ]]; then
25 webversion="${BASH_REMATCH[1]}";
26 path="${BASH_REMATCH[2]}";
27 version="${BASH_REMATCH[3]}";
28 else
29 echo "Error retrieving SQLite files";
30 exit;
33 # Check version matches with the one from Github, otherwise you'll have to point
34 # ./mach vendor to a specific revision.
36 echo ""
37 echo "Comparing Github and Website version numbers..."
38 gitversion=`cat src/VERSION.txt`
39 echo "Website version: $webversion";
40 echo "Github version: $gitversion";
41 if [ "$webversion" != "$gitversion" ]; then
42 echo 'Versions do not match, try to invoke `./mach vendor` with a specific `--revision <github tag>`)'
43 exit;
46 # Retrieve files and update sources.
48 echo ""
49 echo "Retrieving SQLite amalgamation..."
50 amalgamation_url="https://www.sqlite.org/$path/sqlite-amalgamation-$version.zip"
51 wget -t 3 --retry-connrefused -w 5 --random-wait $amalgamation_url -qO amalgamation.zip
52 echo "Unpacking SQLite source files..."
53 unzip -p "amalgamation.zip" "sqlite-amalgamation-$version/sqlite3.c" > "src/sqlite3.c"
54 unzip -p "amalgamation.zip" "sqlite-amalgamation-$version/sqlite3.h" > "src/sqlite3.h"
55 mkdir -p ext
56 unzip -p "amalgamation.zip" "sqlite-amalgamation-$version/sqlite3ext.h" > "ext/sqlite3ext.h"
57 rm -f "amalgamation.zip"
59 echo ""
60 echo "Retrieving SQLite preprocessed..."
61 preprocessed_url="https://www.sqlite.org/$path/sqlite-preprocessed-$version.zip"
62 wget -t 3 --retry-connrefused -w 5 --random-wait $preprocessed_url -qO preprocessed.zip
63 echo "Unpacking FTS5 extension..."
64 unzip -p "preprocessed.zip" "sqlite-preprocessed-$version/fts5.c" > "ext/fts5.c"
65 rm -f "preprocessed.zip"
67 # Retrieve and update other SQLite extensions code.
69 # If the extension is hosted on Github or other supported platforms, you want
70 # to use `mach vendor` for it, rather than manually downloading it here.
71 # The same is valid for SQLite owned extensions that don't need preprocessing
72 # (e.g. carray.c/h). In general anything that is in sqlite-src archive is also
73 # in their official Github repo.
75 echo ""
76 echo "Update complete, please commit and check in your changes."
77 echo ""