Debian Codegraph @

bin/update-android-headers.sh

raw
1 #!/bin/sh
2
3 set -eu
4
5 if [ ! -e .git ]; then
6 echo must run from top-level directory;
7 exit 1
8 fi
9
10 if [ ! -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
16 fi
17
18 dest=include/android_stub
19
20 # Persist the frozen Android N system/window.h for backward compatibility
21
22 cp -av ${dest}/system/window.h platform-system-core/libsystem/include/system
23
24 rm -rf ${dest}
25 mkdir ${dest}
26
27
28 # These directories contains mostly only the files we need, so copy wholesale
29
30 cp -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
43 mkdir ${dest}/hardware
44 cp -av platform-hardware-libhardware/include/hardware/{hardware,gralloc,gralloc1,fb}.h ${dest}/hardware
45 cp -av platform-frameworks-native/vulkan/include/hardware/hwvulkan.h ${dest}/hardware
46
47 mkdir ${dest}/cutils
48 cp -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
53 mkdir ${dest}/android
54 cp -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