• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Take care of copying current header files over to the correct
2# location in the NDK.
3
4copyndkheaders() {
5    local CURR_PLATFORM=android-9
6    local ALL_PLATFORMS="$CURR_PLATFORM android-8 android-5 android-4 android-3"
7
8    local SRC_HEADERS=$ANDROID_BUILD_TOP/frameworks/base/native/include/android
9    local NDK_PLATFORMS=$ANDROID_BUILD_TOP/development/ndk/platforms
10    local DST_HEADERS=$NDK_PLATFORMS/$CURR_PLATFORM
11
12    local SRC_LIB_ANDROID=$ANDROID_PRODUCT_OUT/system/lib/libandroid.so
13    local DST_LIB_ANDROID=$NDK_PLATFORMS/$CURR_PLATFORM/arch-arm/lib/libandroid.so
14
15    local didsomething=""
16
17    #echo "SRC_HEADERS: $SRC_HEADERS"
18
19    for i in $(cd $SRC_HEADERS; ls *.h); do
20        local src=$SRC_HEADERS/$i
21        local changed=""
22        for j in $ALL_PLATFORMS; do
23            local dst=$NDK_PLATFORMS/$j/include/android/$i
24            if [ "$changed" == "" -a -e $dst ]; then
25                echo "Exists: $dst"
26                if diff $src $dst >/dev/null; then
27                    echo "$i: has not changed from $j" >/dev/null
28                    changed="false"
29                else
30                    changed="true"
31                    echo "$i: has changed from $j" >/dev/null
32                fi
33            fi
34        done
35        if [ "$changed" == "true" -o "$changed" == "" ]; then
36            echo "Updating: $i"
37            cp $src $NDK_PLATFORMS/$CURR_PLATFORM/include/android/$i
38            didsomething="true"
39        fi
40    done
41
42    if diff $SRC_LIB_ANDROID $DST_LIB_ANDROID >/dev/null; then
43        echo "libandroid.so: has not changed"
44    else
45        echo "Updating: $DST_LIB_ANDROID"
46        cp $SRC_LIB_ANDROID $DST_LIB_ANDROID
47        didsomething="true"
48    fi
49    if [ "$didsomething" != "" ]; then
50        echo "Headers changed...  rebuilding platforms."
51        sh $ANDROID_BUILD_TOP/ndk/build/tools/build-platforms.sh
52    fi
53}
54
55copyndkheaders
56