Commit ddbe9e7d authored by Rashad Kanavath's avatar Rashad Kanavath
Browse files

PKG: use all gtk dependencies from system

parent 92721844
......@@ -119,12 +119,21 @@ set(PKG_GTK_SEARCHDIRS
# OTB package manager 'this script' will pick them up and put
# into the binary package. Below cmake variable controls the list of
#libraries coming from /usr/lib a.k.a system.
set(ALLOWED_SYSTEM_DLLS
libfreetype.so.6.*
set(GTK_LIB_LIST_1
libgthread-2.0.so.0
libglib-2.0.so.0
libgobject-2.0.so.0
libXrender.so.1
libfontconfig.so.1
libpcre.so.3
libffi.so.6
)
set(GTK_LIB_LIST_2
libfreetype.so.6
libz.so.1
libpng12.so.0
libexpat.so.1
libfontconfig.so.1
)
set(ALLOWED_SYSTEM_DLLS ${GTK_LIB_LIST_1} ${GTK_LIB_LIST_2})
......@@ -224,8 +224,6 @@ endmacro(macro_super_package)
function(func_prepare_package)
file(WRITE ${CMAKE_BINARY_DIR}/make_symlinks_temp "")
#This must exist in any OTB Installation. minimal or full
......@@ -351,8 +349,9 @@ function(func_process_deps input_file)
message("Processing ${input_file_full_path}")
set(is_executable FALSE)
is_file_executable2("${input_file_full_path}" is_executable)
is_file_executable2(input_file_full_path is_executable)
if(NOT is_executable)
#copy back to input_file_full_path
pkg_install_rule(${input_file_full_path})
message("not is_executable ${input_file_full_path}")
return()
......@@ -500,11 +499,15 @@ function(pkg_install_rule src_file)
endif()
set(SKIP_INSTALL FALSE)
setif_value_in_list(is_gtk_lib "${src_file_NAME}" ALLOWED_SYSTEM_DLLS)
setif_value_in_list(is_gtk_lib "${src_file_NAME}" GTK_LIB_LIST_1)
if(is_gtk_lib)
set(output_dir "lib/gtk")
set(SKIP_INSTALL TRUE)
endif()
if(PKG_GENERATE_XDK)
set(SKIP_INSTALL TRUE)
else()
set(output_dir "lib/gtk")
endif() #if(PKG_GENERATE_XDK)
endif() #if(is_gtk_lib)
#special case
if("${src_file_NAME}" MATCHES "^otbapp_")
......
......@@ -71,42 +71,51 @@ function(search_library input_file pkg_searchdirs result)
endfunction()
macro(add_to_symlink_list src_file target_file)
macro(add_to_symlink_list src_file_name link_file_name)
#TODO: avoid code duplication here and later in install_rule
set(SKIP_INSTALL FALSE)
get_filename_component(src_file_name_NAME ${src_file_name} NAME)
if(PKG_GENERATE_XDK)
get_filename_component(src_file_NAME ${src_file} NAME)
setif_value_in_list(is_gtk_lib "${src_file_NAME}" ALLOWED_SYSTEM_DLLS)
if ("${src_file_NAME}"
if ("${src_file_name_NAME}"
MATCHES
"libOTB|libotb|otbApp|otbapp_|otbTest|libMonteverdi|monteverdi|mapla|iceViewer"
)
set(SKIP_INSTALL TRUE)
endif()
if(is_gtk_lib)
set(SKIP_INSTALL TRUE)
endif()
endif(PKG_GENERATE_XDK)
setif_value_in_list(is_gtk_lib "${src_file_name_NAME}" GTK_LIB_LIST_1)
if(is_gtk_lib AND PKG_GENERATE_XDK)
set(SKIP_INSTALL TRUE)
endif()
# NOTE: $OUT_DIR is set actually in pkgsetup.in. So don't try
# any pre-mature optimization on that variable names
if(NOT SKIP_INSTALL)
set(lib_dir "lib")
if(is_gtk_lib)
set(lib_dir "lib/gtk")
endif()
file(APPEND
${CMAKE_BINARY_DIR}/make_symlinks_temp
"ln -sf \"$OUT_DIR/lib/${src_file}\" \"$OUT_DIR/lib/${target_file}\" \n"
"ln -sf \"$OUT_DIR/${lib_dir}/${src_file_name}\" \"$OUT_DIR/${lib_dir}/${link_file_name}\" \n"
)
endif()
endmacro()
function(is_file_executable2 file result_var)
function(is_file_executable2 file_var result_var)
#
# A file is not executable until proven otherwise:
#
set(${result_var} 0 PARENT_SCOPE)
get_filename_component(file_full "${file}" ABSOLUTE)
get_filename_component(file_full "${${file_var}}" ABSOLUTE)
set(${file_var} "${file_full}" PARENT_SCOPE)
string(TOLOWER "${file_full}" file_full_lower)
# If file name ends in .exe on Windows, *assume* executable:
......@@ -125,9 +134,10 @@ function(is_file_executable2 file result_var)
func_is_file_a_symbolic_link("${file_full}" is_a_symlink file_full_target)
if(is_a_symlink)
message("resolving '${file_full}' to '${file_full_target}")
message("Resolving '${file_full}' to '${file_full_target}")
get_filename_component(file_full_path "${file_full}" PATH)
set(file_full "${file_full_path}/${file_full_target}")
set(${file_var} "${file_full}" PARENT_SCOPE)
string(TOLOWER "${file_full}" file_full_lower)
endif()
......@@ -149,6 +159,7 @@ function(is_file_executable2 file result_var)
if(NOT EXISTS "${file_full}")
message(FATAL_ERROR "err. '${file_full}' does not exists or is not absolute path")
set(${file_var} "" PARENT_SCOPE)
endif()
execute_process(COMMAND "${FILE_COMMAND}" "${file_full}"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment