Dianne Hackborn | 08d5b8f | 2010-08-04 11:12:40 -0700 | [diff] [blame] | 1 | # Take care of copying current header files over to the correct |
| 2 | # location in the NDK. |
| 3 | |
| 4 | copyndkheaders() { |
| 5 | local CURR_PLATFORM=android-9 |
| 6 | local ALL_PLATFORMS="$CURR_PLATFORM android-8 android-5 android-4 android-3" |
| 7 | |
Mathias Agopian | 60b8226 | 2012-03-23 14:19:18 -0700 | [diff] [blame] | 8 | local SRC_HEADERS=$ANDROID_BUILD_TOP/frameworks/native/include/android |
Dianne Hackborn | 08d5b8f | 2010-08-04 11:12:40 -0700 | [diff] [blame] | 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 |
Dianne Hackborn | de5ba5e | 2010-10-21 21:10:26 -0700 | [diff] [blame] | 13 | local DST_LIB_ANDROID=$NDK_PLATFORMS/$CURR_PLATFORM/arch-arm/lib/libandroid.so |
Dianne Hackborn | 08d5b8f | 2010-08-04 11:12:40 -0700 | [diff] [blame] | 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 |
Dianne Hackborn | de5ba5e | 2010-10-21 21:10:26 -0700 | [diff] [blame] | 23 | local dst=$NDK_PLATFORMS/$j/include/android/$i |
Dianne Hackborn | 08d5b8f | 2010-08-04 11:12:40 -0700 | [diff] [blame] | 24 | if [ "$changed" == "" -a -e $dst ]; then |
Dianne Hackborn | de5ba5e | 2010-10-21 21:10:26 -0700 | [diff] [blame] | 25 | echo "Exists: $dst" |
Dianne Hackborn | 08d5b8f | 2010-08-04 11:12:40 -0700 | [diff] [blame] | 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" |
Dianne Hackborn | de5ba5e | 2010-10-21 21:10:26 -0700 | [diff] [blame] | 37 | cp $src $NDK_PLATFORMS/$CURR_PLATFORM/include/android/$i |
Dianne Hackborn | 08d5b8f | 2010-08-04 11:12:40 -0700 | [diff] [blame] | 38 | didsomething="true" |
| 39 | fi |
| 40 | done |
| 41 | |
| 42 | if diff $SRC_LIB_ANDROID $DST_LIB_ANDROID >/dev/null; then |
Dianne Hackborn | de5ba5e | 2010-10-21 21:10:26 -0700 | [diff] [blame] | 43 | echo "libandroid.so: has not changed" |
Dianne Hackborn | 08d5b8f | 2010-08-04 11:12:40 -0700 | [diff] [blame] | 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 | |
| 55 | copyndkheaders |