1# How to make your build VNDK compliant
2
3## Enable VNDK flag
4In your device's BoardConfig.mk, set BOARD_VNDK_VERSION := current.
5
6Set that device's lunch combo and compile
7
8    make -j32 >log 2>&1
9
10
11## Fixing Build errors
12The resulting errors will be mainly of 2 types:
13
14### Copy headers not allowed
15Vendor modules are not allowed to use LOCAL_COPY_HEADERS. They need to export
16their headers via BUILD_HEADER_LIBRARY. Modules will import this library via
17LOCAL_HEADER_LIBRARIES.
18
19Here is an example on how to do that:
20* Lets call the offending module libabc. Open libabc's Android.mk
21* Note all the headers that are being copied by libabc
22* Create a local dir called include (or inc). Add symlinks to every file that is
23   being copied. If all the files are in the same folder, the include dir itself
24   will be a symlink to that folder
25* In Android.mk, remove all lines with copy headers
26
27
28    - LOCAL_COPY_HEADERS_TO := dir
29    - LOCAL_COPY_HEADERS := file1
30    - LOCAL_COPY_HEADERS := file2
31    - ....
32
33* Replace above lines with
34
35
36    + LOCAL_EXPORT_HEADER_LIBRARY_HEADERS := libabc_headers
37
38
39* Create the module_headers lib outside the definition of current module
40
41
42    + include $(CLEAR_VARS)
43    + LOCAL_MODULE := libabc_headers
44    + LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
45    + include $(BUILD_HEADER_LIBRARY)
46
47Note: - and + are code lines in patch format
48
49### Headers not found
50* Once all copy header violations are cleaned up, make will start throwing lots of
51   "file not found" errors. These are due to 2 reasons:
52
53   * Modules relying on copy headers are not finding those headers anymore due
54   to above changes
55
56   * VNDK build rules remove global includes from the path. So dirs like
57   system/core/include, frameworks/av/include or hardware/libhardware/include
58   will no longer be offered in include path
59* Fix them using the **parse_and_fix_errors.sh** script. Customize it according to
60   your needs.
61
62
63