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