Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DEB/RPM/mac] master branch - debug all unix packages, switch to DEB/RPM #1112

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions packaging/Packaging.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,13 @@
#
################################################################################

# Set common CPACK variables

set(CPACK_PACKAGE_NAME medInria CACHE STRING "Name of the package for the superproject")
mark_as_advanced(CPACK_PACKAGE_NAME)

set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${CPACK_PACKAGE_NAME} - medical image visualisation and processing tool")

set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Medical image visualisation and processing tool")
set(CPACK_PACKAGE_DESCRIPTION
"${CPACK_PACKAGE_NAME} is a medical image visualization and processing tool developed at Inria by the teams Asclepios, Athena, Parietal and Visages.")

"A tool developed at Inria by the teams Epione, Athena, Parietal and Visages.")
set(CPACK_PACKAGE_VENDOR http://med.inria.fr/)
set(CPACK_PACKAGE_CONTACT "medInria Team <[email protected]>")
set(CPACK_PACKAGE_CONTACT "medInria team <[email protected]>")

set(CPACK_PACKAGE_VERSION_MAJOR ${${PROJECT_NAME}_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${${PROJECT_NAME}_VERSION_MINOR})
Expand Down Expand Up @@ -67,6 +62,5 @@ if (UNIX)
endif()

# Include cpack modules

include (InstallRequiredSystemLibraries)
include (CPack)
2 changes: 1 addition & 1 deletion packaging/apple/ApplePackScript.cmake.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
execute_process(COMMAND rm -f @PROJECT_BINARY_DIR@/medInria-@@PROJECT_NAME@[email protected])
execute_process(COMMAND @PROJECT_BINARY_DIR@/packaging/apple/mac_packager.sh @medInria_BINARY_DIR@/bin/plugins @medInria_BINARY_DIR@/bin/plugins_legacy @PRIVATE_PLUGINS_DIRS@ @PRIVATE_PLUGINS_LEGACY_DIRS@)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep private

execute_process(COMMAND @PROJECT_BINARY_DIR@/packaging/apple/mac_packager.sh @medInria_BINARY_DIR@/bin/plugins @medInria_BINARY_DIR@/bin/plugins_legacy)
14 changes: 1 addition & 13 deletions packaging/linux/DEB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,5 @@
#
################################################################################


set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt5-sql-sqlite, libqt5-webkit")

# TODO: Remove this when we will not support old ubuntu distribs.

set(CPACK_DEBIAN_PACKAGE_REPLACES
"dcmtk-inria, itk-inria-build, medinria-plugins, medinria-plugins-asclepios, medinria-visages-plugins, vtk-inria-build")

set(CPACK_DEBIAN_PACKAGE_HOMEPAGE ${CPACK_PACKAGE_VENDOR})
set(CPACK_DEBIAN_PACKAGE_NAME ${CPACK_PACKAGE_NAME})
set(CPACK_DEBIAN_PACKAGE_PROVIDES ${CPACK_PACKAGE_NAME})
set(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})

set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA ${CMAKE_BINARY_DIR}/packaging/linux/prerm;${CMAKE_BINARY_DIR}/packaging/linux/postinst)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6, libstdc++6, libgcc-s1, qtbase5-dev, libqt5quick5")
27 changes: 0 additions & 27 deletions packaging/linux/GeneratorConfig.cmake.in

This file was deleted.

59 changes: 17 additions & 42 deletions packaging/linux/LinuxPackaging.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,49 +33,34 @@ set(CPACK_PACKAGE_FILE_NAME
"${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${DISTRIBUTOR_ID}_${RELEASE}-${ARCH}")

# Set the right package generator

set(CPACK_GENERATOR DEB)
if(${DISTRIBUTOR_ID} MATCHES fc|fedora|Fedora|Centos|centos|SUSE|Suse|suse)
set(CPACK_GENERATOR RPM)
endif()

# For the 3.0 release, disable RPM/DEB as we're too far behind Ubuntu/Fedora
# releases on the build farm, will re-enable if we ever manage to get up to date

set(CPACK_GENERATOR "ZIP")
set (CPACK_PACKAGING_INSTALL_PREFIX /opt/medInria CACHE STRING "Prefix where the package will be installed")
mark_as_advanced(CPACK_PACKAGING_INSTALL_PREFIX)

# Remember the linux packaging source dir

set(CURRENT_SRC_DIR ${CMAKE_SOURCE_DIR}/packaging/linux)
set(CURRENT_BIN_DIR ${CMAKE_BINARY_DIR}/packaging/linux)

# Generate CPACK_PROJECT_CONFIG_FILE

configure_file(${CURRENT_SRC_DIR}/GeneratorConfig.cmake.in
${CURRENT_BIN_DIR}/GeneratorConfig.cmake
@ONLY)
set(CPACK_PROJECT_CONFIG_FILE ${CURRENT_BIN_DIR}/GeneratorConfig.cmake)

# Set directory where the package will be installed

set (CPACK_PACKAGING_INSTALL_PREFIX /usr/local/medInria CACHE STRING "Prefix where the package will be installed")
mark_as_advanced(CPACK_PACKAGING_INSTALL_PREFIX)

# Add postinst and prerm script

configure_file(${CURRENT_SRC_DIR}/postinst.in ${CURRENT_BIN_DIR}/postinst)
# The postinst and prerm scripts are run at package installation for both, or uninstallation for prerm
configure_file(${CURRENT_SRC_DIR}/prerm.in ${CURRENT_BIN_DIR}/prerm)
configure_file(${CURRENT_SRC_DIR}/postinst.in ${CURRENT_BIN_DIR}/postinst)

# include settings specific to DEB and RPM

# Include settings specific to DEB and RPM
include(${CURRENT_SRC_DIR}/RPM.cmake)
include(${CURRENT_SRC_DIR}/DEB.cmake)

# Generate desktop file.

# Generate desktop file
configure_file(${CURRENT_SRC_DIR}/medInria.desktop.in ${CURRENT_BIN_DIR}/medInria.desktop @ONLY)
install(FILES ${CURRENT_BIN_DIR}/medInria.desktop
DESTINATION share/applications)
install(FILES ${CURRENT_BIN_DIR}/medInria.desktop DESTINATION .)
install(FILES ${CMAKE_SOURCE_DIR}/src/app/medInria/resources/medInria.png DESTINATION .)

# Configure a cleaning script run after the creation of the archive to be packaged
configure_file(${CURRENT_SRC_DIR}/PostArchiveCleanupScript.cmake.in ${CURRENT_BIN_DIR}/PostArchiveCleanupScript.cmake @ONLY)
install(CODE "include(${CURRENT_BIN_DIR}/PostArchiveCleanupScript.cmake)")

# Add project to package

Expand All @@ -84,23 +69,13 @@ set(backup_CPACK_INSTALL_CMAKE_PROJECTS ${CPACK_INSTALL_CMAKE_PROJECTS} ${CMAKE_

#clear it
set(CPACK_INSTALL_CMAKE_PROJECTS "")
foreach(external_project ${external_projects})
if(NOT USE_SYSTEM_${external_project} AND BUILD_SHARED_LIBS_${external_project})
ExternalProject_Get_Property(${external_project} binary_dir)
set(CPACK_INSTALL_CMAKE_PROJECTS ${CPACK_INSTALL_CMAKE_PROJECTS} ${binary_dir} ${external_project} ALL "/")
endif()
endforeach()

foreach(dir ${PRIVATE_PLUGINS_DIRS})
set(CPACK_INSTALL_CMAKE_PROJECTS ${CPACK_INSTALL_CMAKE_PROJECTS} ${dir} ${dir} ALL "/bin")
endforeach()

foreach(dir ${PRIVATE_PLUGINS_LEGACY_DIRS})
set(CPACK_INSTALL_CMAKE_PROJECTS ${CPACK_INSTALL_CMAKE_PROJECTS} ${dir} ${dir} ALL "/bin")
foreach(external_project ${external_projects})
if(NOT USE_SYSTEM_${external_project} AND BUILD_SHARED_LIBS_${external_project})
ExternalProject_Get_Property(${external_project} binary_dir)
set(CPACK_INSTALL_CMAKE_PROJECTS ${CPACK_INSTALL_CMAKE_PROJECTS} ${binary_dir} ${external_project} ALL "/")
endif()
endforeach()

install(CODE "include(${CURRENT_BIN_DIR}/PostArchiveCleanupScript.cmake)")

# force the medinria-superproject install target to run last so we can use it
# to cleanup
set(CPACK_INSTALL_CMAKE_PROJECTS ${CPACK_INSTALL_CMAKE_PROJECTS} ${backup_CPACK_INSTALL_CMAKE_PROJECTS})
31 changes: 9 additions & 22 deletions packaging/linux/PostArchiveCleanupScript.cmake.in
Original file line number Diff line number Diff line change
@@ -1,34 +1,21 @@
set(DIR @CPACK_PACKAGE_DIRECTORY@/_CPack_Packages/Linux/@CPACK_GENERATOR@/@CPACK_PACKAGE_FILE_NAME@)
set(DIR @CMAKE_BINARY_DIR@/_CPack_Packages/Linux/@CPACK_GENERATOR@/@CPACK_PACKAGE_FILE_NAME@/@CPACK_PACKAGING_INSTALL_PREFIX@)

# Removing useless directories
# Removing useless files and directories
file(REMOVE_RECURSE ${DIR}/cmake)
file(REMOVE_RECURSE ${DIR}/etc)
file(REMOVE_RECURSE ${DIR}/include)
file(REMOVE_RECURSE ${DIR}/share)

# Cleaning up useless stuff in /lib
file(REMOVE_RECURSE ${DIR}/plugins)
file(REMOVE_RECURSE ${DIR}/wrp)
file(REMOVE_RECURSE ${DIR}/lib/cmake)
file(REMOVE_RECURSE ${DIR}/lib64/cmake)
file(REMOVE_RECURSE ${DIR}/lib/vtk-8.0/CMake)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verify vtk cleaning phase with new version of vtk.

file(REMOVE_RECURSE ${DIR}/lib/vtk-8.0/doc)
file(REMOVE_RECURSE ${DIR}/lib/vtk-8.0/doxygen)
file(REMOVE_RECURSE ${DIR}/lib/vtk-8.0/testing)
file(GLOB LIB_JUNK ${DIR}/lib/*.cmake ${DIR}/lib/vtk-8.0/*.cmake)

if (LIB_JUNK)
list(LENGTH LIB_JUNK LIB_JUNK_LENGTH)

if (LIB_JUNK_LENGTH GREATER 0)
file(REMOVE ${LIB_JUNK})
endif()
endif()
file(GLOB_RECURSE LIB_JUNK ${DIR}/lib/*.cmake ${DIR}/lib64/*.cmake)
file(REMOVE ${LIB_JUNK})

# Cleaning up binaries in /bin
file(GLOB BINARIES RELATIVE ${DIR}/bin/ ${DIR}/bin/*)

foreach(bin ${BINARIES})
if(NOT bin MATCHES "^med")
file(GLOB BIN_JUNK RELATIVE ${DIR}/bin/ ${DIR}/bin/*)
foreach(bin ${BIN_JUNK})
if((NOT bin MATCHES "^med") AND (NOT bin MATCHES "^plugins"))
file(REMOVE ${DIR}/bin/${bin})
endif()
endforeach()

14 changes: 2 additions & 12 deletions packaging/linux/RPM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,9 @@
#
################################################################################

set(CPACK_RPM_PACKAGE_REQUIRES "qt, qtwebkit")
if(${DISTRIBUTOR_ID} MATCHES 14|15)
set(CPACK_RPM_PACKAGE_REQUIRES "qt, qt-webkit")
endif()

# TODO: Remove this when we will not support old fedora distribs.

set(CPACK_RPM_PACKAGE_OBSOLETES
"dcmtk-inria, itk-inria-build, medinria-plugins, medinria-plugins-asclepios, medinria-visages-plugins, vtk-inria-build")

set(CPACK_RPM_PACKAGE_REQUIRES "qt5-qtsvg-devel, mesa-libGLU-devel")
set(CPACK_RPM_PACKAGE_PROVIDES "${CPACK_PACKAGE_NAME} = ${CPACK_PACKAGE_VERSION}")
set(CPACK_RPM_PACKAGE_LICENSE BSD)
set (CPACK_RPM_PACKAGE_ARCHITECTURE ${ARCH})

set(CPACK_RPM_PACKAGE_ARCHITECTURE ${ARCH})
set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE ${CMAKE_BINARY_DIR}/packaging/linux/postinst)
set(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE ${CMAKE_BINARY_DIR}/packaging/linux/prerm)
13 changes: 5 additions & 8 deletions packaging/linux/medInria.desktop.in
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
[Desktop Entry]
Version=@CPACK_PACKAGE_VERSION@
Type=Application
Name=medInria
GenericName=Medical Imaging Platform
Comment=Process and Visualize Medical Images
Icon=@CPACK_PACKAGING_INSTALL_PREFIX@/share/icons/medInria.png
Exec=medInria %U
Terminal=false
Categories=Graphics;Science;MedicalSoftware;Qt;Viewer;
MimeType=dcm;img;mha;nii;nii.gz;vtk;fib;roi;
Version=@CPACK_PACKAGE_VERSION@
Exec=@CPACK_PACKAGING_INSTALL_PREFIX@/bin/medInria_launcher.sh
Name=@CPACK_PACKAGE_NAME@
Comment=@CPACK_PACKAGE_DESCRIPTION_SUMMARY@
Icon=@CPACK_PACKAGING_INSTALL_PREFIX@/medInria.png
22 changes: 3 additions & 19 deletions packaging/linux/postinst.in
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,23 +1,7 @@
#!/bin/sh
set -e

# Remove unwanted files.
rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/cmake
rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/include
rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/share/qtdcm
rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/plugins/designer
rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/lib/*.cmake
rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/lib/vtk-8.0/testing
rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/lib/vtk-8.0/doxygen
rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/lib/vtk-8.0/doc
rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/lib/vtk-8.0/CMake
rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/lib/vtk-8.0/*.cmake
rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/lib/InsightToolkit/*.cmake
rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/bin/vtk*
rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/bin/ttk*
rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/bin/itk*
rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/bin/dtk*

# Create Symbolic link
ln -s @CPACK_PACKAGING_INSTALL_PREFIX@/share/applications/medInria.desktop /usr/share/applications/medInria.desktop
ln -s @CPACK_PACKAGING_INSTALL_PREFIX@/medInria.desktop /usr/share/applications/medInria.desktop
chmod +x /usr/share/applications/medInria.desktop
ln -s @CPACK_PACKAGING_INSTALL_PREFIX@/bin/medInria_launcher.sh /usr/bin/medInria
echo "The application is installed and set up."
5 changes: 3 additions & 2 deletions packaging/linux/prerm.in
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/sh
set -e

[ -h /usr/share/applications/medInria.desktop ] && rm -f /usr/share/applications/medInria.desktop
[ -h /usr/bin/medInria ] && rm -f /usr/bin/medInria
echo "Cleaning of the installation..."
rm -f /usr/share/applications/medInria.desktop
rm -f /usr/bin/medInria
41 changes: 11 additions & 30 deletions packaging/unix/Launchers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,46 +16,27 @@ set(CURRENT_BIN_DIR ${CMAKE_BINARY_DIR}/packaging/unix)

# Install a launcher scripts for the application with right environment variable

# For developpers.

foreach (dir ${PRIVATE_PLUGINS_DIRS})
set(DEV_PLUGINS_DIRS "${DEV_PLUGINS_DIRS}:${dir}/bin/plugins")
endforeach()

foreach (dir ${PRIVATE_PLUGINS_LEGACY_DIRS})
set(DEV_PLUGINS_LEGACY_DIRS "${DEV_PLUGINS_LEGACY_DIRS}:${dir}/bin/plugins_legacy")
endforeach()

## For developpers
# Needed on macOS to find plugins. On linux you can also directly use ./medInria-build/bin/medInria
ExternalProject_Get_Property(medInria binary_dir)

set(LOCATE "")
set(LOCATE "")
set(MEDINRIA_DIR ${CMAKE_BINARY_DIR})

if (APPLE)
set(MEDINRIA_BIN ${binary_dir}/bin/medInria.app/Contents/MacOS/medInria)
else()
set(MEDINRIA_BIN ${binary_dir}/bin/medInria)
if (APPLE)
set(MEDINRIA_BIN ${binary_dir}/bin/medInria.app/Contents/MacOS/medInria)
else()
set(MEDINRIA_BIN ${binary_dir}/bin/medInria)
endif()

set(MEDINRIA_PLUGINS_DIRS "${binary_dir}/bin/plugins:${DEV_PLUGINS_DIRS}")
set(MEDINRIA_PLUGINS_LEGACY_DIRS "${binary_dir}/bin/plugins_legacy:${DEV_PLUGINS_LEGACY_DIRS}")

set(MEDINRIA_PLUGINS_DIRS "${binary_dir}/bin/plugins")
set(MEDINRIA_PLUGINS_LEGACY_DIRS "${binary_dir}/bin/plugins_legacy")
configure_file(${CURRENT_SRC_DIR}/medInria.sh.in medInria.sh @ONLY)

# For end users.

## For end users / packaging
file(READ "${CURRENT_SRC_DIR}/locate_bin.sh" LOCATE)
set(MEDINRIA_DIR "$(locate)")

if (APPLE)
set(MEDINRIA_BIN "\${MEDINRIA_DIR}/bin/medInria.app/Contents/MacOS/medInria")
else()
set(MEDINRIA_BIN "\${MEDINRIA_DIR}/bin/medInria")
endif()

set(MEDINRIA_PLUGINS_DIRS "\${MEDINRIA_DIR}/plugins:\${MEDINRIA_DIR}/bin/plugins:\${MEDINRIA_USER_PLUGINS_DIRS}")
set(MEDINRIA_PLUGINS_LEGACY_DIRS "\${MEDINRIA_DIR}/bin/plugins_legacy:\${MEDINRIA_USER_PLUGINS_DIRS_LEGACY}")

configure_file(${CURRENT_SRC_DIR}/medInria.sh.in ${CURRENT_BIN_DIR}/medInria_launcher.sh @ONLY)
install(PROGRAMS ${CURRENT_BIN_DIR}/medInria_launcher.sh
DESTINATION bin)
install(PROGRAMS ${CURRENT_BIN_DIR}/medInria_launcher.sh DESTINATION bin)
35 changes: 5 additions & 30 deletions packaging/unix/medInria.sh.in
Original file line number Diff line number Diff line change
@@ -1,38 +1,13 @@
#!/bin/bash

usage() {
local ret="$1"
echo "Usage: $0 [--prefix prefix_command] [--debug] [--help] parameters"
exit ${ret}
}

# Set the library path
@LOCATE@

if [ "$1" == "--help" ]; then
usage 0
fi

med_prefix=""
if [ "$1" == "--prefix" ]; then
shift
med_prefix="$1"
shift
fi

if [ "$1" == "--debug" ]; then
med_prefix="gdb --args"
fi

# Locate the directory containing this script.

MEDINRIA_DIR="@MEDINRIA_DIR@"
MEDINRIA_BIN="@MEDINRIA_BIN@"
export LD_LIBRARY_PATH=${MEDINRIA_DIR}/lib:${MEDINRIA_DIR}/lib64:$LD_LIBRARY_PATH

# Set the plugins and library paths.
# Needed for macOS to find plugins
export MEDINRIA_PLUGINS_DIR="@MEDINRIA_PLUGINS_DIRS@"
export MEDINRIA_PLUGINS_DIR_LEGACY="@MEDINRIA_PLUGINS_LEGACY_DIRS@"
export LD_LIBRARY_PATH=${MEDINRIA_DIR}/lib:${MEDINRIA_DIR}/lib64:${MEDINRIA_DIR}/plugins_legacy:$LD_LIBRARY_PATH

# Call medInria

exec ${med_prefix} "${MEDINRIA_BIN}" $*
# Call medInria
exec "@MEDINRIA_BIN@" $*
Loading