1#!/bin/sh 2 3set -eu 4 5if [ ! -e .git ]; then 6 echo must run from top-level directory; 7 exit 1 8fi 9 10if [ ! -d platform-hardware-libhardware ]; then 11 git clone --depth 1 https://android.googlesource.com/platform/hardware/libhardware platform-hardware-libhardware 12 git clone --depth 1 https://android.googlesource.com/platform/system/core platform-system-core 13 git clone --depth 1 https://android.googlesource.com/platform/frameworks/native platform-frameworks-native 14fi 15 16dest=include/android_stub 17 18rm -rf ${dest} 19mkdir ${dest} 20 21 22# These directories contains mostly only the files we need, so copy wholesale 23 24cp -av platform-frameworks-native/libs/nativewindow/include/vndk \ 25 platform-system-core/libsync/include/sync \ 26 platform-system-core/libsync/include/ndk \ 27 platform-system-core/libbacktrace/include/backtrace \ 28 platform-system-core/libsystem/include/system \ 29 platform-system-core/liblog/include/log \ 30 platform-frameworks-native/libs/nativewindow/include/apex \ 31 platform-frameworks-native/libs/nativewindow/include/system \ 32 platform-frameworks-native/libs/nativebase/include/nativebase \ 33 ${dest} 34 35 36# We only need a few files from these big directories so just copy those 37 38mkdir ${dest}/hardware 39cp -av platform-hardware-libhardware/include/hardware/{hardware,gralloc,gralloc1,fb}.h ${dest}/hardware 40cp -av platform-frameworks-native/vulkan/include/hardware/hwvulkan.h ${dest}/hardware 41 42mkdir ${dest}/cutils 43cp -av platform-system-core/libcutils/include/cutils/{log,native_handle,properties}.h ${dest}/cutils 44 45 46# include/android has files from a few different projects 47 48mkdir ${dest}/android 49cp -av platform-frameworks-native/libs/nativewindow/include/android/* \ 50 platform-frameworks-native/libs/arect/include/android/* \ 51 platform-system-core/liblog/include/android/* \ 52 platform-system-core/libsync/include/android/* \ 53 ${dest}/android 54 55