#!/bin/bash
# Copyright 2013-2016 Myriad Group AG. All Rights Reserved.

####### 3D needs #########
EXTRA_FILES_3D="
  lib/egl/egl.cfg
  lib/egl/eglsubAndroid.so
  lib/egl/libEGL_adreno.so
  lib/egl/libGLESv1_CM_adreno.so
  lib/egl/libGLESv2_adreno.so
  lib/egl/libplayback_adreno.so
  lib/egl/libq3dtools_adreno.so
  lib/hw/gralloc.msm8960.so
  lib/libadreno_utils.so
  lib/libgsl.so
  lib/libmemalloc.so
  lib/libqdutils.so
  "

####### CAMERA needs #########
EXTRA_FILES_CAMERA="
  lib/hw/camera.mako.so
  "

####### HW CODECS needs #########
EXTRA_FILES_HWCODEC="
  etc/media_codecs.xml
  etc/media_profiles.xml
  etc/media_codecs_google_audio.xml
  etc/media_codecs_google_telephony.xml
  etc/media_codecs_google_video.xml
  "

####### LINKING LOOP #########
NEEDED_EXTRA_FILES="
  $EXTRA_FILES_3D
  $EXTRA_FILES_CAMERA
  $EXTRA_FILES_HWCODEC
  "

for x in $NEEDED_EXTRA_FILES; do
  target=/system_jolla/$x
  link=$ANDROID_ROOT/${x/.msm8960./.default.}
  ln -sf $target $link
done

ln -sf /system_jolla/lib/hw/camera.mako.so /system/lib/hw/camera.default.so

# For camera socket
mkdir -p /data/misc
ln -s /data_jolla/misc/camera /data/misc/camera
