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