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/frameworks/native platform-frameworks-native 12 git clone --depth 1 https://android.googlesource.com/platform/hardware/libhardware platform-hardware-libhardware 13 git clone --depth 1 https://android.googlesource.com/platform/system/core platform-system-core 14 git clone --depth 1 https://android.googlesource.com/platform/system/logging platform-system-logging 15 git clone --depth 1 https://android.googlesource.com/platform/system/unwinding platform-system-unwinding 16fi 17 18dest=include/android_stub 19 20# Persist the frozen Android N system/window.h for backward compatibility 21 22cp -av ${dest}/system/window.h platform-system-core/libsystem/include/system 23 24rm -rf ${dest} 25mkdir ${dest} 26 27 28# These directories contains mostly only the files we need, so copy wholesale 29 30cp -av \ 31 platform-frameworks-native/libs/nativewindow/include/vndk \ 32 platform-frameworks-native/libs/nativebase/include/nativebase \ 33 platform-system-core/libsync/include/ndk \ 34 platform-system-core/libsync/include/sync \ 35 platform-system-core/libsystem/include/system \ 36 platform-system-logging/liblog/include/log \ 37 platform-system-unwinding/libbacktrace/include/backtrace \ 38 ${dest} 39 40 41# We only need a few files from these big directories so just copy those 42 43mkdir ${dest}/hardware 44cp -av platform-hardware-libhardware/include/hardware/{hardware,gralloc,gralloc1,fb}.h ${dest}/hardware 45cp -av platform-frameworks-native/vulkan/include/hardware/hwvulkan.h ${dest}/hardware 46 47mkdir ${dest}/cutils 48cp -av platform-system-core/libcutils/include/cutils/{compiler,log,native_handle,properties,trace}.h ${dest}/cutils 49 50 51# include/android has files from a few different projects 52 53mkdir ${dest}/android 54cp -av \ 55 platform-frameworks-native/libs/nativewindow/include/android/* \ 56 platform-frameworks-native/libs/arect/include/android/* \ 57 platform-system-core/libsync/include/android/* \ 58 platform-system-logging/liblog/include/android/* \ 59 ${dest}/android 60 61