Alex Deymo | efb03ae | 2015-09-23 12:40:45 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright (C) 2015 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 | |
| 18 | # Generates the android_includes/ directory with the headers that normally will |
| 19 | # be generated by cmake. Run this command whenever you update the include files. |
| 20 | |
| 21 | LOCAL_PATH=$(realpath $(dirname "$0")) |
| 22 | |
| 23 | cleanup() { |
| 24 | rm -rf "${WORKDIR}" |
| 25 | } |
| 26 | trap cleanup INT TERM ERR EXIT |
| 27 | |
| 28 | WORKDIR=$(mktemp -d libdivsufsort.XXXXXX) |
| 29 | INCLUDESDIR="${LOCAL_PATH}/android_include" |
| 30 | |
| 31 | pushd "${WORKDIR}" |
| 32 | cmake "${LOCAL_PATH}" \ |
| 33 | -DBUILD_DIVSUFSORT64=1 \ |
| 34 | -DBUILD_EXAMPLES=0 \ |
| 35 | -DUSE_OPENMP=0 \ |
| 36 | -DWITH_LFS=1 |
| 37 | |
| 38 | mkdir -p "${INCLUDESDIR}" |
| 39 | echo "Copying headers:" |
| 40 | cp -v include/*.h "${INCLUDESDIR}/" |
| 41 | popd >/dev/null |
| 42 | |
| 43 | cat <<EOF |
| 44 | ============================================================= |
| 45 | Remember to run the following command to add the new headers: |
| 46 | |
| 47 | git add android_include/* |
| 48 | |
| 49 | EOF |