blob: 4c9bf549b5f911a89b08505f9518f1dddb9548aa [file] [log] [blame]
Sébastien Blin67da5842019-05-08 18:53:27 -04001#!/usr/bin/env bash
2
3# This script get the short ndk version
4
5source_properties="${ANDROID_NDK}/source.properties"
6
7if [ ! -s "${source_properties}" ]; then
8 echo "No NDK found. Abort!"
9 exit 1
10fi
11
12major_version=$(sed -En -e 's/^Pkg.Revision[ \t]*=[ \t]*([0-9a-f]+).*/\1/p' ${source_properties})
13numerical_minor_version=$(sed -En -e 's/^Pkg.Revision[ \t]*=[ \t]*[0-9a-f]+\.([0-9]+).*/\1/p' ${source_properties})
Sébastien Blin275fa402019-11-28 09:50:53 -050014minor_version=$(echo ${numerical_minor_version} | tr 0123456789 " bcdefghij" | tr -d '[:space:]')
Sébastien Blin67da5842019-05-08 18:53:27 -040015ndk_version=r${major_version}${minor_version}
16
17echo ${ndk_version}