Skip to content
This repository was archived by the owner on Dec 21, 2024. It is now read-only.

Commit 655aede

Browse files
Makoto OnukiAndroid (Google) Code Review
authored andcommitted
Merge "Add bash script to update SQLite"
2 parents 5c02db4 + 86e5272 commit 655aede

File tree

1 file changed

+102
-0
lines changed

1 file changed

+102
-0
lines changed

UPDATE-SOURCE.bash

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
#!/bin/bash
2+
#
3+
# Copyright (C) 2018 The Android Open Source Project
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
# This script updates SQLite source files with a SQLite tarball.
18+
#
19+
# Usage: UPDATE-SOURCE.bash SQLITE-SOURCE.tgz
20+
#
21+
# This script must be executed in $ANDROID_BUILD_TOP/external/sqlite/
22+
#
23+
24+
set -e
25+
26+
script_name="$(basename "$0")"
27+
28+
source_tgz="$1"
29+
source_ext_dir="$1.extracted"
30+
31+
die() {
32+
echo "$script_name: $*"
33+
exit 1
34+
}
35+
36+
echo_and_exec() {
37+
echo " Running: $@"
38+
"$@"
39+
}
40+
41+
# Make sure the source tgz file exists.
42+
pwd="$(pwd)"
43+
if [[ ! "$pwd" =~ .*/external/sqlite/? ]] ; then
44+
die 'Execute this script in $ANDROID_BUILD_TOP/external/sqlite/'
45+
fi
46+
47+
# Make sure the source tgz file exists.
48+
49+
if [[ ! -f "$source_tgz" ]] ; then
50+
die " Missing or invalid argument.
51+
52+
Usage: $script_name SQLITE-SOURCE_TGZ
53+
"
54+
fi
55+
56+
57+
echo
58+
echo "# Extracting the source tgz..."
59+
echo_and_exec rm -fr "$source_ext_dir"
60+
echo_and_exec mkdir -p "$source_ext_dir"
61+
echo_and_exec tar xvf "$source_tgz" -C "$source_ext_dir" --strip-components=1
62+
63+
echo
64+
echo "# Making file sqlite3.c in $source_ext_dir ..."
65+
(
66+
cd "$source_ext_dir"
67+
echo_and_exec ./configure
68+
echo_and_exec make -j 4 sqlite3.c
69+
)
70+
71+
echo
72+
echo "# Copying the source files ..."
73+
for to in dist/orig/ dist/ ; do
74+
echo_and_exec cp "$source_ext_dir/"{shell.c,sqlite3.c,sqlite3.h,sqlite3ext.h} "$to"
75+
done
76+
77+
echo
78+
echo "# Applying Android.patch ..."
79+
(
80+
cd dist
81+
echo_and_exec patch -i Android.patch
82+
)
83+
84+
echo
85+
echo "# Regenerating Android.patch ..."
86+
(
87+
cd dist
88+
echo_and_exec bash -c '(for x in orig/*; do diff -u -d $x ${x#orig/}; done) > Android.patch'
89+
)
90+
91+
cat <<EOF
92+
93+
=======================================================
94+
95+
Finished successfully!
96+
97+
Make sure to update README.version
98+
99+
=======================================================
100+
101+
EOF
102+

0 commit comments

Comments
 (0)