xref: /aosp_15_r20/external/sqlite/REBUILD-ANDROID-PATCH.bash (revision a3141fd39888aecc864dfb08485df64ff6c387f9)
1#!/bin/bash
2#
3# Copyright (C) 2023 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: REBUILD-ANDROID_PATCH.bash <release>
20#
21# This script must be executed in $ANDROID_BUILD_TOP/external/sqlite/
22#
23
24set -e
25
26script_name="$(basename "$0")"
27script_dir=$(dirname $(realpath ${BASH_SOURCE[0]}))
28
29source $script_dir/common-functions.sh
30
31if [[ $# -lt 1 ]]; then
32  die "missing required arguments"
33elif [[ $# -gt 1 ]]; then
34  die "extra arguments on command line"
35fi
36sqlite_release=$(normalize_release "$1") || die "invalid release"
37sqlite_base="sqlite-autoconf-${sqlite_release}"
38
39export patch_dir=${script_dir}/dist
40echo
41echo "# Regenerating Android.patch ..."
42(
43    cd dist/$sqlite_base || die "release directory not found"
44    echo_and_exec bash -c '(for x in orig/*; do diff -u -d $x ${x#orig/}; done) > Android.patch'
45    echo_and_exec cp Android.patch ${patch_dir}/
46)
47