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