Skip to content

Commit

Permalink
Linux deployment: fixed an issue with version 55 of ICU being wrongly…
Browse files Browse the repository at this point in the history
… needed on some Linux systems (closes #1627).
  • Loading branch information
agarny committed May 9, 2018
2 parents f361f59 + 9e9eef6 commit 83ea018
Show file tree
Hide file tree
Showing 18 changed files with 196 additions and 59 deletions.
48 changes: 29 additions & 19 deletions CMakeLists.txt
Expand Up @@ -11,6 +11,7 @@ option(ENABLE_TEST_PLUGINS "Enable the test plugins to be built" OFF)
option(ENABLE_TESTS "Enable the tests to be built" OFF)

if(NOT WIN32 AND NOT APPLE)
option(USE_PREBUILT_ICU_PACKAGE "Use the pre-built version of the ICU package" ON)
option(USE_PREBUILT_MESA_PACKAGE "Use the pre-built version of the Mesa package" ON)
endif()

Expand Down Expand Up @@ -300,10 +301,19 @@ elseif(NOT WIN32)
set(CMAKE_SHARED_LIBRARY_SUFFIX_POST)
endif()

# Version of ICU that we are using on Windows
# On Windows, specify the version of ICU that we are using while on Linux, add
# our copy of the ICU and Mesa libraries
# Note #1: On Linux, ICU is needed so that our external projects that need ICU
# (e.g. QtWebKit) can rely on the ICU version that we want to use...
# Note #2: On Linux, Mesa is needed so that we can run OpenCOR on machines that
# don't have 'proper' OpenGL support (e.g. on a Linux virtual machine
# in VirtualBox)...

if(WIN32)
set(ICU_VERSION 57)
elseif(NOT APPLE)
add_subdirectory(${CMAKE_SOURCE_DIR}/distrib/linux/icu)
add_subdirectory(${CMAKE_SOURCE_DIR}/distrib/linux/mesa)
endif()

# Retrieve or build our copy of QtWebKit
Expand Down Expand Up @@ -976,7 +986,7 @@ endforeach()
# Build the CLI version of OpenCOR (Windows specific)
# Note: when it comes to WINDOWS_CLI_PROJECT_NAME, we used to have it set to
# ${CMAKE_PROJECT_NAME}.com, but Ninja found a duplicate rule (from a copy
# command), so now we use '_' instead of '.'...
# command), so now we use '_' instead...

if(WIN32)
qt5_wrap_cpp(WINDOWS_CLI_SOURCES_MOC ${WINDOWS_CLI_HEADERS_MOC})
Expand Down Expand Up @@ -1140,12 +1150,6 @@ else()

copy_file_to_build_dir(DIRECT ${QT_BINARY_DIR} . ${ORIG_MESA_FILENAME} ${DEST_MESA_FILENAME})
copy_file_to_build_dir(DIRECT ${QT_BINARY_DIR} bin ${ORIG_MESA_FILENAME} ${DEST_MESA_FILENAME})
else()
# Add our copy of the Mesa library so that we can run OpenCOR on
# machines that don't have 'proper' OpenGL support (e.g. on a Linux
# virtual machine in VirtualBox)

add_subdirectory(${CMAKE_SOURCE_DIR}/distrib/linux/mesa)
endif()
endif()

Expand Down Expand Up @@ -1327,19 +1331,9 @@ else()
set(REAL_QT_LIBRARY_DIR ${QT_LIBRARY_DIR})
endif()

linux_deploy_qt_library(${REAL_QT_LIBRARY_DIR} ${CMAKE_SHARED_LIBRARY_PREFIX}Qt${QT_VERSION_MAJOR}${QT_LIBRARY}${CMAKE_SHARED_LIBRARY_SUFFIX}.${QT_VERSION_MAJOR})
linux_deploy_qt_library(DIRECT ${REAL_QT_LIBRARY_DIR} ${CMAKE_SHARED_LIBRARY_PREFIX}Qt${QT_VERSION_MAJOR}${QT_LIBRARY}${CMAKE_SHARED_LIBRARY_SUFFIX}.${QT_VERSION_MAJOR})
endforeach()

if(NOT ENABLE_TRAVIS_CI)
# We are building OpenCOR locally, so we can deploy the ICU libraries
# Note: indeed, on Travis CI, the PPA we use doesn't have those
# libraries...

foreach(QT_FILE icudata icui18n icuuc)
linux_deploy_qt_library(${QT_LIBRARY_DIR} ${CMAKE_SHARED_LIBRARY_PREFIX}${QT_FILE}${CMAKE_SHARED_LIBRARY_SUFFIX}.56)
endforeach()
endif()

# Qt plugins required by OpenCOR

linux_deploy_qt_plugin(imageformats qjpeg)
Expand All @@ -1356,6 +1350,22 @@ else()
linux_deploy_qt_plugin(xcbglintegrations qxcb-egl-integration qxcb-glx-integration)
endif()

# JPEG and PNG are needed by QtWebKit and may not be present on a user's
# system

find_package(JPEG REQUIRED QUIET)
find_package(PNG REQUIRED QUIET)

get_filename_component(REAL_JPEG_LIBRARY ${JPEG_LIBRARY} REALPATH)
get_filename_component(REAL_PNG_LIBRARY ${PNG_LIBRARY} REALPATH)

install(FILES ${REAL_JPEG_LIBRARY}
DESTINATION lib
RENAME libjpeg.so.8)
install(FILES ${REAL_PNG_LIBRARY}
DESTINATION lib
RENAME libpng12.so.0)

# Shell script to run OpenCOR

set(SH_FILENAME ${PROJECT_BUILD_DIR}/${CMAKE_PROJECT_NAME}.sh)
Expand Down
32 changes: 21 additions & 11 deletions cmake/common.cmake
Expand Up @@ -586,35 +586,45 @@ endmacro()

#===============================================================================

macro(runpath2rpath FILENAME)
macro(runpath2rpath PROJECT_TARGET FILENAME)
# Convert the RUNPATH value, if any, of the given ELF file to an RPATH value

execute_process(COMMAND ${RUNPATH2RPATH} ${FILENAME}
RESULT_VARIABLE RESULT)
if("${PROJECT_TARGET}" STREQUAL "DIRECT")
execute_process(COMMAND ${RUNPATH2RPATH} ${FILENAME}
RESULT_VARIABLE RESULT)

if(NOT RESULT EQUAL 0)
message(FATAL_ERROR "The RUNPATH value of '${FILENAME}' could not be converted to an RPATH value...")
if(NOT RESULT EQUAL 0)
message(FATAL_ERROR "The RUNPATH value of '${FILENAME}' could not be converted to an RPATH value...")
endif()
else()
add_custom_command(TARGET ${PROJECT_TARGET} POST_BUILD
COMMAND ${RUNPATH2RPATH} ${FILENAME})
endif()
endmacro()

#===============================================================================

macro(linux_deploy_qt_library DIRNAME FILENAME)
macro(linux_deploy_qt_library PROJECT_TARGET DIRNAME FILENAME)
# Copy the Qt library to the build/lib folder, so we can test things without
# first having to deploy OpenCOR
# Note: this is particularly useful when the Linux machine has different
# versions of Qt...

copy_file_to_build_dir(DIRECT ${DIRNAME} lib ${FILENAME})
copy_file_to_build_dir(${PROJECT_TARGET} ${DIRNAME} lib ${FILENAME})

# Make sure that the RUNPATH value is converted to an RPATH value

runpath2rpath(lib/${FILENAME})
runpath2rpath(${PROJECT_TARGET} ${PROJECT_BUILD_DIR}/lib/${FILENAME})

# Strip the Qt library of all its local symbols

if(RELEASE_MODE)
execute_process(COMMAND strip -x lib/${FILENAME})
if("${PROJECT_TARGET}" STREQUAL "DIRECT")
execute_process(COMMAND strip -x ${PROJECT_BUILD_DIR}/lib/${FILENAME})
else()
add_custom_command(TARGET ${PROJECT_TARGET} POST_BUILD
COMMAND strip -x ${PROJECT_BUILD_DIR}/lib/${FILENAME})
endif()
endif()

# Deploy the Qt library
Expand All @@ -637,12 +647,12 @@ macro(linux_deploy_qt_plugin PLUGIN_CATEGORY)

# Make sure that the RUNPATH value is converted to an RPATH value

runpath2rpath(${PLUGIN_DEST_DIRNAME}/${PLUGIN_FILENAME})
runpath2rpath(DIRECT ${PROJECT_BUILD_DIR}/${PLUGIN_DEST_DIRNAME}/${PLUGIN_FILENAME})

# Strip the Qt plugin of all its local symbols

if(RELEASE_MODE)
execute_process(COMMAND strip -x ${PLUGIN_DEST_DIRNAME}/${PLUGIN_FILENAME})
execute_process(COMMAND strip -x ${PROJECT_BUILD_DIR}/${PLUGIN_DEST_DIRNAME}/${PLUGIN_FILENAME})
endif()

# Deploy the Qt plugin
Expand Down
108 changes: 108 additions & 0 deletions distrib/linux/icu/CMakeLists.txt
@@ -0,0 +1,108 @@
project(ICU)

# Name and version of our package

set(PACKAGE_NAME ICU)
set(PACKAGE_VERSION 56.1)

# Version of our library

set(MAJOR_LIBRARY_VERSION 56)
set(LIBRARY_VERSION ${MAJOR_LIBRARY_VERSION}.1)

# Git tag for our library

set(GIT_TAG v56.1)

# Specify where our local package will be installed

set(FULL_LOCAL_EXTERNAL_PACKAGE_DIR ${PROJECT_SOURCE_DIR}/${LOCAL_EXTERNAL_PACKAGE_DIR})

# Name of our package's shared library

set(ICUDATA_SHARED_LIBRARY ${CMAKE_SHARED_LIBRARY_PREFIX}icudata${CMAKE_SHARED_LIBRARY_SUFFIX}.${MAJOR_LIBRARY_VERSION})
set(ICUI18N_SHARED_LIBRARY ${CMAKE_SHARED_LIBRARY_PREFIX}icui18n${CMAKE_SHARED_LIBRARY_SUFFIX}.${MAJOR_LIBRARY_VERSION})
set(ICUUC_SHARED_LIBRARY ${CMAKE_SHARED_LIBRARY_PREFIX}icuuc${CMAKE_SHARED_LIBRARY_SUFFIX}.${MAJOR_LIBRARY_VERSION})

# Specify the files that need to have their SHA-1 value checked

set(SHA1_FILES
lib/${ICUDATA_SHARED_LIBRARY}
lib/${ICUI18N_SHARED_LIBRARY}
lib/${ICUUC_SHARED_LIBRARY}
)

# Use the pre-built version of our package unless instructed otherwise

if(USE_PREBUILT_ICU_PACKAGE)
# Retrieve the library's package

string(REPLACE "${${CMAKE_PROJECT_NAME}_SOURCE_DIR}/" ""
RELATIVE_PROJECT_SOURCE_DIR "${PROJECT_SOURCE_DIR}/${REMOTE_EXTERNAL_PACKAGE_DIR}")

retrieve_package_file(${PACKAGE_NAME} ${PACKAGE_VERSION}
${RELATIVE_PROJECT_SOURCE_DIR} 37cf2e70a0e2aa3f3814360e182a45269c7001f6
SHA1_FILES ${SHA1_FILES}
SHA1_VALUES 09c48c1e7ecaee2ce66d2214eb791bf14a58ed9c
8ce5cb893e638bc02060271c0fc2f7cbf0156590
34be5958abf7a7af5f624893925b60cf069f7c43)
else()
# Build ICU as an external project

set(PACKAGE_BUILD ${PACKAGE_NAME}Build)

ExternalProject_Add(${PACKAGE_BUILD}
SOURCE_DIR
${CMAKE_SOURCE_DIR}/ext/${PACKAGE_NAME}
BINARY_DIR
${EXTERNAL_PROJECT_BUILD_DIR}/Build/${PACKAGE_BUILD}
INSTALL_DIR
${FULL_LOCAL_EXTERNAL_PACKAGE_DIR}
GIT_REPOSITORY
https://github.com/opencor/icu
GIT_TAG
${GIT_TAG}
CONFIGURE_COMMAND
<SOURCE_DIR>/source/runConfigureICU Linux --prefix=<INSTALL_DIR>
BUILD_BYPRODUCTS
<INSTALL_DIR>/lib/${ICUDATA_SHARED_LIBRARY}
<INSTALL_DIR>/lib/${ICUI18N_SHARED_LIBRARY}
<INSTALL_DIR>/lib/${ICUUC_SHARED_LIBRARY}
)

# Package our external project

create_package_file(${PACKAGE_NAME} ${PACKAGE_VERSION}
${LOCAL_EXTERNAL_PACKAGE_DIR}
PACKAGED_FILES include lib
SHA1_FILES ${SHA1_FILES}
TARGET ${PACKAGE_BUILD})
endif()

# Allow our main CMake project to find our ICU package

set(LOCAL_ICU_LIB_DIR ${FULL_LOCAL_EXTERNAL_PACKAGE_DIR}/lib)

set(ICU_ROOT_DIR ${FULL_LOCAL_EXTERNAL_PACKAGE_DIR} PARENT_SCOPE)
set(ICU_ICUDATA_LIBRARY ${LOCAL_ICU_LIB_DIR}/${ICUDATA_SHARED_LIBRARY} PARENT_SCOPE)
set(ICU_ICUI18N_LIBRARY ${LOCAL_ICU_LIB_DIR}/${ICUI18N_SHARED_LIBRARY} PARENT_SCOPE)
set(ICU_ICUUC_LIBRARY ${LOCAL_ICU_LIB_DIR}/${ICUUC_SHARED_LIBRARY} PARENT_SCOPE)
set(ICU_LIBRARIES
${LOCAL_ICU_LIB_DIR}/${ICUDATA_SHARED_LIBRARY}
${LOCAL_ICU_LIB_DIR}/${ICUI18N_SHARED_LIBRARY}
${LOCAL_ICU_LIB_DIR}/${ICUUC_SHARED_LIBRARY}
PARENT_SCOPE
)
set(ICU_PKGCONFIG_DIR ${LOCAL_ICU_LIB_DIR}/pkgconfig PARENT_SCOPE)

# (Copy and) deploy our copy of the ICU libraries

if(USE_PREBUILT_ICU_PACKAGE)
set(DEPLOY_TARGET DIRECT)
else()
set(DEPLOY_TARGET ${PACKAGE_BUILD})
endif()

foreach(ICU_LIBRARY ${ICUDATA_SHARED_LIBRARY} ${ICUI18N_SHARED_LIBRARY} ${ICUUC_SHARED_LIBRARY})
linux_deploy_qt_library(${DEPLOY_TARGET} ${LOCAL_ICU_LIB_DIR} ${ICU_LIBRARY})
endforeach()
2 changes: 1 addition & 1 deletion doc/downloads/index.js
Expand Up @@ -37,7 +37,7 @@ var jsonData = { "versions": [
}
],
"changes": [
{ "change": "<strong>General:</strong> added support for exiting full-screen mode when pressing the Esc key on macOS (see issue <a href=\"https://github.com/opencor/opencor/issues/1637\">#1637</a>)." },
{ "change": "<strong>General:</strong> fixed an issue with version 55 of ICU being wrongly needed on some Linux systems (see issue <a href=\"https://github.com/opencor/opencor/issues/1627\">#1627</a>). Added support for exiting full-screen mode when pressing the Esc key on macOS (see issue <a href=\"https://github.com/opencor/opencor/issues/1637\">#1637</a>)." },
{ "change": "<strong>SBML API:</strong> don't build libSBML with bzip2 or zip compression anymore (see issue <a href=\"https://github.com/opencor/opencor/issues/1628\">#1628</a>)." },
{ "change": "<strong>Core plugin:</strong> fixed a problem with the menu items for recently opened files potentially appearing as disabled on macOS (see issue <a href=\"https://github.com/opencor/opencor/issues/1633\">#1633</a>)." },
{ "change": "<strong>Simualtion Experiment view:</strong> fixed a problem with a SED-ML file being considered as modified under certain conditions (see issue <a href=\"https://github.com/opencor/opencor/issues/1626\">#1626</a>)." }
Expand Down
Binary file added res/oxygen/actions/edit-select-none.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/oxygen/actions/media-playlist-repeat.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/oxygen/actions/media-playlist-shuffle.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/oxygen/actions/rating-unrated.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/oxygen/actions/shuffle.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/oxygen/actions/x-clementine-shuffle.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/oxygen/apps/artikulate.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/oxygen/emblems/media-mount.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Binary file modified res/oxygen/mimetypes/application-vnd.sun.xml.calc.template.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/oxygen/places/folder-games.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion scripts/traviscilinuxinstall
Expand Up @@ -7,7 +7,7 @@ RUN apt -y install software-properties-common
RUN apt-add-repository -y ppa:beineri/opt-qt592-xenial

RUN apt -y -qq update
RUN apt -y -qq install cmake g++-5 git libgl1-mesa-dev libglu1-mesa-dev ninja-build
RUN apt -y -qq install cmake g++-5 git libgl1-mesa-dev libglu1-mesa-dev libjpeg-dev libpng-dev ninja-build
RUN apt -y -qq install qt59location qt59multimedia qt59sensors qt59svg qt59tools qt59webchannel

RUN ln -s /usr/bin/g++-5 /usr/bin/g++
Expand Down

0 comments on commit 83ea018

Please sign in to comment.