[video] Fix bookmark thumbnails of rotated videos
[xbmc.git] / cmake / scripts / webos / Install.cmake
blob03dd7ce183399fd3d00dd969ffba1b06b06626b4
1 # webOS packaging
2 find_program(ARES_PACKAGE ares-package PATHS ${TOOLCHAIN}/../CLI ENV WEBOS_CLI_PATH
3                                        PATH_SUFFIXES bin
4                                        REQUIRED)
6 set(APP_PACKAGE_DIR ${CMAKE_BINARY_DIR}/tools/webOS/packaging)
8 # Configure files into packaging environment.
9 configure_file(${CMAKE_SOURCE_DIR}/tools/webOS/packaging/appinfo.json.in ${APP_PACKAGE_DIR}/appinfo.json @ONLY)
10 configure_file(${CMAKE_SOURCE_DIR}/tools/webOS/packaging/icon.png ${APP_PACKAGE_DIR}/icon.png COPYONLY)
11 configure_file(${CMAKE_SOURCE_DIR}/tools/webOS/packaging/largeIcon.png ${APP_PACKAGE_DIR}/largeIcon.png COPYONLY)
14 # Webos-userland are stubs for libs on the target device not contained in the toolchain,
15 # we don't package them, but still add them to the search path for verify
16 # Using DEPENDS_PATH/lib could result finding libs that are not on the target device, so
17 # we specifically use the build dir
18 get_filename_component(arch_dir ${DEPENDS_PATH} NAME)
19 set(WEBOS_USERLAND_LIBS ${CMAKE_SOURCE_DIR}/tools/depends/target/webos-userland/${arch_dir}/build)
21 # toolchain sysroot
22 set(WEBOS_ROOTFS ${TOOLCHAIN}/${HOST}/sysroot)
23 set(WEBOS_LD_LIBRARY_PATH ${WEBOS_USERLAND_LIBS}:${APP_PACKAGE_DIR}/lib)
24 set(VERIFY_EXE ${CMAKE_SOURCE_DIR}/tools/webOS/verify-symbols.sh)
27 set(APP_INSTALL_DIRS ${CMAKE_BINARY_DIR}/addons
28                      ${CMAKE_BINARY_DIR}/media
29                      ${CMAKE_BINARY_DIR}/system
30                      ${CMAKE_BINARY_DIR}/userdata)
31 set(APP_TOOLCHAIN_FILES ${TOOLCHAIN}/${HOST}/sysroot/lib/libatomic.so.1
32                         ${TOOLCHAIN}/${HOST}/sysroot/lib/libcrypt.so.1
33                         ${CMAKE_BINARY_DIR}/libAcbAPI.so.1)
34 set(BIN_ADDONS_DIR ${DEPENDS_PATH}/addons)
36 file(WRITE ${CMAKE_BINARY_DIR}/install.cmake "
37   file(INSTALL ${APP_BINARY} DESTINATION ${APP_PACKAGE_DIR}
38        FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
39   file(INSTALL ${APP_INSTALL_DIRS} DESTINATION ${APP_PACKAGE_DIR})
40   file(CREATE_LINK python${PYTHON_VERSION} python3 SYMBOLIC)
41   file(INSTALL python3 DESTINATION ${APP_PACKAGE_DIR}/lib)
42   file(INSTALL ${DEPENDS_PATH}/lib/python${PYTHON_VERSION} DESTINATION ${APP_PACKAGE_DIR}/lib FOLLOW_SYMLINK_CHAIN)
43   file(INSTALL ${APP_TOOLCHAIN_FILES} DESTINATION ${APP_PACKAGE_DIR}/lib FOLLOW_SYMLINK_CHAIN)
45   file(STRINGS ${CMAKE_BINARY_DIR}/missing_libs.txt missing_libs)
46   foreach(lib IN LISTS missing_libs)
47     file(INSTALL ${DEPENDS_PATH}/lib/\$\{lib\} DESTINATION ${APP_PACKAGE_DIR}/lib FOLLOW_SYMLINK_CHAIN)
48   endforeach()
50   if(EXISTS ${BIN_ADDONS_DIR})
51     file(INSTALL ${BIN_ADDONS_DIR} DESTINATION ${APP_PACKAGE_DIR})
52   endif()
55 # Copy files to the location expected by the webOS packaging scripts.
56 add_custom_target(bundle
57   DEPENDS ${APP_NAME_LC} ${CMAKE_BINARY_DIR}/missing_libs.txt AcbAPI
58   COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/install.cmake
61 add_custom_command(
62   OUTPUT ${CMAKE_BINARY_DIR}/missing_libs.txt
63   DEPENDS ${CMAKE_BINARY_DIR}/${APP_BINARY}
64   COMMAND bash -c "WEBOS_ROOTFS=${WEBOS_ROOTFS} WEBOS_LD_LIBRARY_PATH=${WEBOS_LD_LIBRARY_PATH} \
65             ${VERIFY_EXE} ${CMAKE_BINARY_DIR}/${APP_BINARY} \
66             | awk '/Missing library:/ { print $3 }'" > missing_libs.txt
67   VERBATIM
70 add_custom_target(verify-libs
71   DEPENDS bundle ${CMAKE_BINARY_DIR}/missing_libs.txt
72   COMMAND echo verifying dynamic library dependencies
73   COMMAND env WEBOS_ROOTFS=${WEBOS_ROOTFS} WEBOS_LD_LIBRARY_PATH=${WEBOS_LD_LIBRARY_PATH}
74           ${VERIFY_EXE} ${APP_PACKAGE_DIR}/${APP_BINARY}
75   WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
76   VERBATIM
79 if(CMAKE_BUILD_TYPE STREQUAL Release)
80   add_custom_target(strip
81     DEPENDS bundle verify-libs
82     COMMAND find ${APP_PACKAGE_DIR} -iname *.so* -exec ${CMAKE_STRIP} ${APP_PACKAGE_DIR}/${APP_BINARY} {} \;
83     WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
84     VERBATIM
85   )
86   set(IPK_DEPENDS strip)
87 endif()
89 add_custom_target(ipk
90   DEPENDS bundle ${IPK_DEPENDS}
91   COMMAND ${ARES_PACKAGE} ${APP_PACKAGE_DIR}
92   WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
93   VERBATIM
96 add_custom_target(ipk-clean
97   COMMAND ${CMAKE_COMMAND} -E rm -r ${APP_PACKAGE_DIR}
98   WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
99   VERBATIM