blob: 90ff556db986dccb3e870facd9271f47e82d7b5b [file] [log] [blame]
Dianne Hackborn08d5b8f2010-08-04 11:12:40 -07001# 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
Mathias Agopian60b82262012-03-23 14:19:18 -07008 local SRC_HEADERS=$ANDROID_BUILD_TOP/frameworks/native/include/android
Dianne Hackborn08d5b8f2010-08-04 11:12:40 -07009 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
Dianne Hackbornde5ba5e2010-10-21 21:10:26 -070013 local DST_LIB_ANDROID=$NDK_PLATFORMS/$CURR_PLATFORM/arch-arm/lib/libandroid.so
Dianne Hackborn08d5b8f2010-08-04 11:12:40 -070014
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
Dianne Hackbornde5ba5e2010-10-21 21:10:26 -070023 local dst=$NDK_PLATFORMS/$j/include/android/$i
Dianne Hackborn08d5b8f2010-08-04 11:12:40 -070024 if [ "$changed" == "" -a -e $dst ]; then
Dianne Hackbornde5ba5e2010-10-21 21:10:26 -070025 echo "Exists: $dst"
Dianne Hackborn08d5b8f2010-08-04 11:12:40 -070026 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"
Dianne Hackbornde5ba5e2010-10-21 21:10:26 -070037 cp $src $NDK_PLATFORMS/$CURR_PLATFORM/include/android/$i
Dianne Hackborn08d5b8f2010-08-04 11:12:40 -070038 didsomething="true"
39 fi
40 done
41
42 if diff $SRC_LIB_ANDROID $DST_LIB_ANDROID >/dev/null; then
Dianne Hackbornde5ba5e2010-10-21 21:10:26 -070043 echo "libandroid.so: has not changed"
Dianne Hackborn08d5b8f2010-08-04 11:12:40 -070044 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