Commit 5aecc929 authored by Rashad Kanavath's avatar Rashad Kanavath

PKG: use cmake variable for absolute path for patchelf program

parent c8587b5e
if(NOT __EXTERNAL_PACKAGE_TOOLS__)
set(__EXTERNAL_PACKAGE_TOOLS__ 1)
set(PKGTOOLS_SB_PREFIX_DIR "${CMAKE_BINARY_DIR}/PACKAGE-TOOLS")
include(ExternalProject)
if( __EXTERNAL_PACKAGE_TOOLS__)
return()
else()
set(__EXTERNAL_PACKAGE_TOOLS__ 1)
endif()
if(WIN32)
add_custom_target(PACKAGE-TOOLS)
......@@ -11,9 +10,16 @@ if(WIN32)
endif()
if(UNIX AND NOT WIN32)
include(ExternalProject)
set(PKGTOOLS_SB_PREFIX_DIR "${CMAKE_BINARY_DIR}/PACKAGE-TOOLS")
if(APPLE)
add_custom_target(PATCHELF)
else()
set(PATCHELF_INSTALL_DIR ${PKGTOOLS_SB_PREFIX_DIR}/install-patchelf)
set(PATCHELF_PROGRAM ${PATCHELF_INSTALL_DIR}/patchelf)
ExternalProject_Add(PATCHELF
PREFIX "${PKGTOOLS_SB_PREFIX_DIR}"
URL "http://nixos.org/releases/patchelf/patchelf-0.9/patchelf-0.9.tar.bz2"
......@@ -23,14 +29,18 @@ if(UNIX AND NOT WIN32)
BINARY_DIR "${PKGTOOLS_SB_PREFIX_DIR}/build-patchelf"
TMP_DIR "${PKGTOOLS_SB_PREFIX_DIR}/tmp-patchelf"
STAMP_DIR "${PKGTOOLS_SB_PREFIX_DIR}/stamp-patchelf"
PATCH_COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_INSTALL_PREFIX}/tools
PATCH_COMMAND ${CMAKE_COMMAND} -E make_directory ${PKGTOOLS_SB_PREFIX_DIR}/install
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E chdir ${PKGTOOLS_SB_PREFIX_DIR}/src-patchelf
./configure --prefix ${CMAKE_INSTALL_PREFIX}/tools
./configure --prefix ${PATCHELF_INSTALL_DIR}
BUILD_COMMAND ${CMAKE_COMMAND} -E chdir ${PKGTOOLS_SB_PREFIX_DIR}/src-patchelf ${CMAKE_MAKE_PROGRAM}
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy ${PKGTOOLS_SB_PREFIX_DIR}/src-patchelf/src/patchelf ${CMAKE_INSTALL_PREFIX}/tools
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy ${PKGTOOLS_SB_PREFIX_DIR}/src-patchelf/src/patchelf ${PATCHELF_PROGRAM}
)
endif(APPLE)
set(MAKESELF_INSTALL_DIR ${PKGTOOLS_SB_PREFIX_DIR}/install-makeself)
set(MAKESELF_SCRIPT ${MAKESELF_INSTALL_DIR}/makeself.sh)
set(MAKESELF_HEADER_SCRIPT ${MAKESELF_INSTALL_DIR}/makeself-header.sh)
ExternalProject_Add(MAKESELF
PREFIX "${PKGTOOLS_SB_PREFIX_DIR}"
URL "https://www.orfeo-toolbox.org/packages/makeself-2.2.0.tar.gz"
......@@ -41,21 +51,15 @@ if(UNIX AND NOT WIN32)
TMP_DIR "${PKGTOOLS_SB_PREFIX_DIR}/tmp-makeself"
STAMP_DIR "${PKGTOOLS_SB_PREFIX_DIR}/stamp-makeself"
CONFIGURE_COMMAND ""
BUILD_COMMAND ${CMAKE_COMMAND}
-E copy
BUILD_COMMAND ${CMAKE_COMMAND} -E copy
${PKGTOOLS_SB_PREFIX_DIR}/src-makeself/makeself-header.sh
${PKGTOOLS_SB_PREFIX_DIR}/makeself-header.sh
INSTALL_COMMAND ${CMAKE_COMMAND}
-E copy
${MAKESELF_HEADER_SCRIPT}
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy
${PKGTOOLS_SB_PREFIX_DIR}/src-makeself/makeself.sh
${PKGTOOLS_SB_PREFIX_DIR}/makeself.sh
${MAKESELF_SCRIPT}
DEPENDS PATCHELF
)
set(MAKESELF_SCRIPT ${PKGTOOLS_SB_PREFIX_DIR}/makeself.sh)
add_custom_target(PACKAGE-TOOLS DEPENDS MAKESELF)
endif(UNIX AND NOT WIN32)
endif() #idef guard
......@@ -101,6 +101,7 @@ else() #Unix like
endforeach(req)
endif()
set(EXTRA_CACHE_CONFIG)
if(WIN32)
set(CMAKE_INSTALL_PREFIX "${MONTEVERDI_INSTALL_DIR}")
......@@ -110,7 +111,17 @@ endif()
set(PACKAGE_NAME OTB)
set(PACKAGE_LONG_NAME OrfeoToolBox)
if(WIN32)
set(EXTRA_CACHE_CONFIG
"set(CMAKE_CROSSCOMPILING TRUE)
set(WIN32 TRUE)
set(MXE_ARCH \"${MXE_ARCH}\")
set(MXE_MXEROOT \"${MXE_MXEROOT}\")"
)
set(ITK_VERSION_STRING)
set(PACKAGE_PLATFORM_NAME "win")
if(MXE_TARGET_DIR MATCHES "i686")
set(MXE_ARCH "i686")
......@@ -122,6 +133,7 @@ if(WIN32)
get_filename_component(MXE_MXEROOT ${MXE_TARGET_DIR} PATH)
get_filename_component(MXE_MXEROOT ${MXE_MXEROOT} PATH)
set(PACKAGE_VERSION_STRING ${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}.${OTB_VERSION_PATCH})
else() #(WIN32)
if(UNIX)
set(PACKAGE_ARCH 32)
......@@ -134,20 +146,13 @@ else() #(WIN32)
set(PACKAGE_PLATFORM_NAME "Linux")
endif()
get_version("${SUPERBUILD_SOURCE_DIR}/CMake/External_itk.cmake" "ITK_SB_VERSION" ITK_SB_VERSION)
set(ITK_VERSION_STRING "${get_version_ITK_SB_VERSION}")
endif(UNIX)
endif() #(WIN32)
get_version("${OTB_SOURCE_DIR}/CMakeLists.txt" "OTB_VERSION_" OTB_VERSION_STRING)
set(PACKAGE_VERSION_STRING ${get_version_OTB_VERSION_STRING})
set(EXTRA_CACHE_CONFIG
"set(CMAKE_CROSSCOMPILING TRUE)
set(WIN32 TRUE)
set(MXE_ARCH \"${MXE_ARCH}\")
set(MXE_MXEROOT \"${MXE_MXEROOT}\")")
#guess install directory from OTB_MODULES_DIR
#copy of cmake variables not needed.
if(WIN32)
set(Monteverdi_SOURCE_DIR "${Monteverdi_SOURCE_DIR}")
set(Monteverdi_BINARY_DIR "${Monteverdi_BINARY_DIR}")
......@@ -156,17 +161,14 @@ if(WIN32)
set(DEPENDENCIES_INSTALL_DIR "${MXE_MXEROOT}/usr/${MXE_ARCH}-w64-mingw32.shared")
set(QT_PLUGINS_DIR "${DEPENDENCIES_INSTALL_DIR}/qt/plugins")
set(QT_TRANSLATIONS_DIR "${DEPENDENCIES_INSTALL_DIR}/qt/translations")
set(ITK_VERSION_STRING)
else() #unixes
set(Monteverdi_SOURCE_DIR "${SUPERBUILD_BINARY_DIR}/MVD/src/MVD")
set(Monteverdi_BINARY_DIR "${SUPERBUILD_BINARY_DIR}/MVD/build")
set(MONTEVERDI_INSTALL_DIR "${SUPERBUILD_INSTALL_DIR}")
set(QT_PLUGINS_DIR "${SUPERBUILD_INSTALL_DIR}/plugins")
set(QT_TRANSLATIONS_DIR "${SUPERBUILD_INSTALL_DIR}/translations")
set(OTB_INSTALL_DIR "${SUPERBUILD_BINARY_DIR}/OTB/build")
set(DEPENDENCIES_INSTALL_DIR "${SUPERBUILD_INSTALL_DIR}")
set(ITK_VERSION_STRING "${get_version_ITK_SB_VERSION}")
set(EXTRA_CACHE_CONFIG)
set(QT_PLUGINS_DIR "${SUPERBUILD_INSTALL_DIR}/plugins")
set(QT_TRANSLATIONS_DIR "${SUPERBUILD_INSTALL_DIR}/translations")
endif()
macro_setup_cmake_project(OTB)
......
macro(macro_setup_cmake_project pkg)
message( "-- Configuring ${pkg} package")
include(${SUPERBUILD_SOURCE_DIR}/CMake/External_pkgtools.cmake)
#reset it again in macro(macro_create_targets_for_package pkg)
#because thats the cmake macros way.
set(PACKAGE_PROJECT_DIR ${CMAKE_BINARY_DIR}/PACKAGE-${pkg})
......@@ -18,6 +21,7 @@ macro(macro_setup_cmake_project pkg)
set(PKG_GENERATE_XDK OFF)
endif()
#set archive name inside loop
file(WRITE "${PACKAGE_PROJECT_DIR}/src/CMakeLists.txt"
"cmake_minimum_required(VERSION 3.2)
......@@ -36,6 +40,7 @@ macro(macro_setup_cmake_project pkg)
set(CMAKE_INSTALL_PREFIX \"${CMAKE_INSTALL_PREFIX}\")
set(ITK_VERSION_STRING \"${ITK_VERSION_STRING}\")
set(PKG_GENERATE_XDK ${PKG_GENERATE_XDK})
set(PATCHELF_PROGRAM ${PATCHELF_PROGRAM})
${EXTRA_CACHE_CONFIG}
include(\"${SUPERBUILD_SOURCE_DIR}/Packaging/PackageHelper.cmake\")
macro_super_package(STAGE_DIR \"${archive_name}\")"
......@@ -47,8 +52,6 @@ endmacro()
macro(macro_create_targets_for_package pkg)
include(${SUPERBUILD_SOURCE_DIR}/CMake/External_pkgtools.cmake)
if(WIN32)
add_custom_target(PACKAGE-${pkg}-check
COMMAND ${CMAKE_COMMAND} --build "." --target install
......
......@@ -5,6 +5,12 @@ macro(macro_super_package)
message(FATAL_ERROR "PKG_STAGE_DIR is emtpy. Just can't continue.")
endif()
if(UNIX AND NOT APPLE)
if(NOT PATCHELF_PROGRAM)
message(FATAL_ERROR "PATCHELF_PROGRAM not set")
endif()
endif()
set(loader_program_PATHS)
if(WIN32)
set(loader_program_names "${MXE_ARCH}-w64-mingw32.shared-objdump")
......@@ -130,7 +136,7 @@ macro(macro_super_package)
########### install patchelf( linux only) ##################
if(NOT APPLE)
install(PROGRAMS ${CMAKE_INSTALL_PREFIX}/tools/patchelf
install(PROGRAMS ${PATCHELF_PROGRAM}
DESTINATION ${PKG_STAGE_DIR}/tools)
endif()
endif() # if(UNIX)
......
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