universal7580: sepolicy: address GPSD denials
[GitHub/LineageOS/android_device_samsung_universal7580-common.git] / setup-makefiles.sh
1 #!/bin/bash
2 #
3 # Copyright (C) 2017-2019 The LineageOS Project
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #
17
18 set -e
19
20 VENDOR=samsung
21 DEVICE_COMMON=universal7580-common
22
23 export INITIAL_COPYRIGHT_YEAR=2017
24
25 # Load extract_utils and do some sanity checks
26 MY_DIR="${BASH_SOURCE%/*}"
27 if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi
28
29 LINEAGE_ROOT="${MY_DIR}/../../.."
30
31 HELPER="${LINEAGE_ROOT}/vendor/lineage/build/tools/extract_utils.sh"
32 if [ ! -f "${HELPER}" ]; then
33 echo "Unable to find helper script at ${HELPER}"
34 exit 1
35 fi
36 source "${HELPER}"
37
38 # Initialize the helper
39 setup_vendor "${DEVICE_COMMON}" "${VENDOR}" "${LINEAGE_ROOT}" true
40
41 # Copyright headers and guards
42 write_headers "a3xelte a5xelte a7xelte gvwifi gvlte j7elte s5neolte"
43
44 # The standard blobs
45 write_makefiles "${MY_DIR}/proprietary-files.txt" true
46
47 # The BSP blobs - we put a conditional in case the BSP
48 # is actually being built
49 printf '\n%s\n' 'ifeq ($(WITH_EXYNOS_BSP),)' >> "$PRODUCTMK"
50 printf '\n%s\n' 'ifeq ($(WITH_EXYNOS_BSP),)' >> "$ANDROIDMK"
51
52 write_makefiles "$MY_DIR"/proprietary-files-bsp.txt
53
54 printf '%s\n' 'endif' >> "$PRODUCTMK"
55 printf '%s\n' 'endif' >> "$ANDROIDMK"
56
57 ###################################################################################################
58 # CUSTOM PART START #
59 ###################################################################################################
60 OUTDIR=vendor/$VENDOR/$DEVICE_COMMON
61 (cat << EOF) >> $LINEAGE_ROOT/$OUTDIR/Android.mk
62 include \$(CLEAR_VARS)
63 LOCAL_MODULE := libGLES_mali
64 LOCAL_MODULE_OWNER := samsung
65 LOCAL_SRC_FILES := proprietary/vendor/lib/egl/libGLES_mali.so
66 LOCAL_MODULE_TAGS := optional
67 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
68 LOCAL_MODULE_SUFFIX := .so
69 LOCAL_MODULE_PATH := \$(TARGET_OUT_VENDOR_SHARED_LIBRARIES)/egl
70
71 SYMLINKS := \$(TARGET_OUT)/vendor
72 \$(SYMLINKS):
73 @echo "Symlink: vulkan.exynos5.so"
74 @mkdir -p \$@/lib/hw
75 \$(hide) ln -sf ../egl/libGLES_mali.so \$@/lib/hw/vulkan.exynos5.so
76 @echo "Symlink: libOpenCL.so"
77 \$(hide) ln -sf egl/libGLES_mali.so \$@/lib/libOpenCL.so
78 @echo "Symlink: libOpenCL.so.1"
79 \$(hide) ln -sf egl/libGLES_mali.so \$@/lib/libOpenCL.so.1
80 @echo "Symlink: libOpenCL.so.1.1"
81 \$(hide) ln -sf egl/libGLES_mali.so \$@/lib/libOpenCL.so.1.1
82
83 ALL_MODULES.\$(LOCAL_MODULE).INSTALLED := \\
84 \$(ALL_MODULES.\$(LOCAL_MODULE).INSTALLED) \$(SYMLINKS)
85
86 include \$(BUILD_PREBUILT)
87
88 EOF
89
90 (cat << EOF) >> $LINEAGE_ROOT/$OUTDIR/$DEVICE_COMMON-vendor.mk
91
92 # Create Mali links for Vulkan and OpenCL
93 PRODUCT_PACKAGES += libGLES_mali
94 EOF
95 ###################################################################################################
96 # CUSTOM PART END #
97 ###################################################################################################
98
99 # Finish
100 write_footers