xref: /aosp_15_r20/external/libdivsufsort/generate_includes.sh (revision 30b9430b2d8672faf9045aa522d63599a84e8e49)
1*30b9430bSXin Li#!/bin/bash
2*30b9430bSXin Li#
3*30b9430bSXin Li# Copyright (C) 2015 The Android Open Source Project
4*30b9430bSXin Li#
5*30b9430bSXin Li# Licensed under the Apache License, Version 2.0 (the "License");
6*30b9430bSXin Li# you may not use this file except in compliance with the License.
7*30b9430bSXin Li# You may obtain a copy of the License at
8*30b9430bSXin Li#
9*30b9430bSXin Li#      http://www.apache.org/licenses/LICENSE-2.0
10*30b9430bSXin Li#
11*30b9430bSXin Li# Unless required by applicable law or agreed to in writing, software
12*30b9430bSXin Li# distributed under the License is distributed on an "AS IS" BASIS,
13*30b9430bSXin Li# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14*30b9430bSXin Li# See the License for the specific language governing permissions and
15*30b9430bSXin Li# limitations under the License.
16*30b9430bSXin Li#
17*30b9430bSXin Li
18*30b9430bSXin Li# Generates the android_includes/ directory with the headers that normally will
19*30b9430bSXin Li# be generated by cmake. Run this command whenever you update the include files.
20*30b9430bSXin Li
21*30b9430bSXin LiLOCAL_PATH=$(realpath $(dirname "$0"))
22*30b9430bSXin Li
23*30b9430bSXin Licleanup() {
24*30b9430bSXin Li  rm -rf "${WORKDIR}"
25*30b9430bSXin Li}
26*30b9430bSXin Litrap cleanup INT TERM ERR EXIT
27*30b9430bSXin Li
28*30b9430bSXin LiWORKDIR=$(mktemp -d libdivsufsort.XXXXXX)
29*30b9430bSXin LiINCLUDESDIR="${LOCAL_PATH}/android_include"
30*30b9430bSXin Li
31*30b9430bSXin Lipushd "${WORKDIR}"
32*30b9430bSXin Licmake "${LOCAL_PATH}" \
33*30b9430bSXin Li  -DBUILD_DIVSUFSORT64=1 \
34*30b9430bSXin Li  -DBUILD_EXAMPLES=0 \
35*30b9430bSXin Li  -DUSE_OPENMP=0 \
36*30b9430bSXin Li  -DWITH_LFS=1
37*30b9430bSXin Li
38*30b9430bSXin Limkdir -p "${INCLUDESDIR}"
39*30b9430bSXin Liecho "Copying headers:"
40*30b9430bSXin Licp -v include/*.h "${INCLUDESDIR}/"
41*30b9430bSXin Lipopd >/dev/null
42*30b9430bSXin Li
43*30b9430bSXin Licat <<EOF
44*30b9430bSXin Li=============================================================
45*30b9430bSXin LiRemember to run the following command to add the new headers:
46*30b9430bSXin Li
47*30b9430bSXin Li  git add android_include/*
48*30b9430bSXin Li
49*30b9430bSXin LiEOF
50