| 1 | This is a backport of the commits in PR 235 (“Fixes for packaging on
|
| 2 | linux-like systems”), which was merged upstream:
|
| 3 |
|
| 4 | https://github.com/opengribs/XyGrib/pull/235
|
| 5 |
|
| 6 | It fixes finding resources such as icons, maps and translations installed in
|
| 7 | the data directory. This patch has been merged upstream and can be removed
|
| 8 | with the next release.
|
| 9 |
|
| 10 | Sightly adapted to find openjpg-2.4.
|
| 11 |
|
| 12 | diff --git a/CMakeLists.txt b/CMakeLists.txt
|
| 13 | index 64059ab65dae..00cc5d6aea6f 100644
|
| 14 | |
| 15 | |
| 16 | @@ -7,6 +7,9 @@ set(VERSION_PATCH 6)
|
| 17 | set(XYGRIB_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
|
| 18 | set(XYGRIB_VERSION_DATE "2019-07-05")
|
| 19 |
|
| 20 | +option(GNU_PACKAGE "Install into GNU standard directories" OFF)
|
| 21 | +option(GEN_TRANSLATIONS "Generate translations" ON)
|
| 22 | +
|
| 23 | set(CMAKE_VERBOSE_MAKEFILE ON)
|
| 24 |
|
| 25 | # Find includes in corresponding build directories
|
| 26 | @@ -25,7 +28,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
| 27 | set(CMAKE_CXX_STANDARD 11)
|
| 28 | #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
|
| 29 | if(UNIX AND NOT APPLE)
|
| 30 | -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC")
|
| 31 | +add_compile_options(-Wall -fPIC)
|
| 32 | endif()
|
| 33 |
|
| 34 | # Add support for address etc sanitizers, part 1/2 (other half after ADD_EXECUTABLE)
|
| 35 | @@ -108,17 +111,12 @@ find_path(OPENJPEG_INCLUDE_DIR
|
| 36 | ~/Library/Frameworks/include
|
| 37 | /Library/Frameworks/include
|
| 38 | /usr/local/include
|
| 39 | - /usr/local/include/openjpeg-2.3
|
| 40 | - /usr/include/openjpeg-2.3
|
| 41 | - /usr/local/include/openjpeg-2.1
|
| 42 | - /usr/include/openjpeg-2.1
|
| 43 | - /usr/local/include/openjpeg-2.2
|
| 44 | - /usr/include/openjpeg-2.2
|
| 45 | /usr/include
|
| 46 | /sw/include # Fink
|
| 47 | /opt/local/include # DarwinPorts
|
| 48 | /opt/csw/include # Blastwave
|
| 49 | /opt/include
|
| 50 | + PATH_SUFFIXES openjpeg-2.4 openjpeg-2.3 openjpeg-2.2 openjpeg-2.1
|
| 51 | REQUIRED
|
| 52 | )
|
| 53 | include_directories(${OPENJPEG_INCLUDE_DIR})
|
| 54 | @@ -212,22 +210,24 @@ include_directories(${PNG_INCLUDE_DIR})
|
| 55 | configure_file(cmake/Version.h.in ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/include/Version.h)
|
| 56 | include_directories(${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/include)
|
| 57 |
|
| 58 | -if(APPLE)
|
| 59 | -set(PREFIX_BIN ${PROJECT_NAME})
|
| 60 | -set(PREFIX_PKGDATA ${PROJECT_NAME})
|
| 61 | -endif()
|
| 62 | -if(WIN32)
|
| 63 | -set(PREFIX_BIN ".")
|
| 64 | -set(PREFIX_PKGDATA ".")
|
| 65 | -endif()
|
| 66 | -if(UNIX AND NOT APPLE)
|
| 67 | -# This is not exactly a good idea on linux - the code should be changed so that the executable would go to /usr/local/bin and the data to /usr/local/share/XyGrib
|
| 68 | -set(PREFIX_BIN ${PROJECT_NAME})
|
| 69 | -set(PREFIX_PKGDATA ${PROJECT_NAME})
|
| 70 | +if(GNU_PACKAGE)
|
| 71 | + include(GNUInstallDirs)
|
| 72 | + set(PREFIX_BIN ${CMAKE_INSTALL_FULL_BINDIR})
|
| 73 | + set(PREFIX_PKGDATA ${CMAKE_INSTALL_FULL_DATADIR}/openGribs/${PROJECT_NAME})
|
| 74 | +else()
|
| 75 | + if(WIN32)
|
| 76 | + set(PREFIX_BIN ".")
|
| 77 | + set(PREFIX_PKGDATA ".")
|
| 78 | + else()
|
| 79 | + set(PREFIX_BIN ${PROJECT_NAME})
|
| 80 | + set(PREFIX_PKGDATA ${PROJECT_NAME})
|
| 81 | + endif()
|
| 82 | endif()
|
| 83 |
|
| 84 | add_subdirectory(src)
|
| 85 | -add_subdirectory(data/tr)
|
| 86 | +if(GEN_TRANSLATIONS)
|
| 87 | + add_subdirectory(data/tr)
|
| 88 | +endif()
|
| 89 |
|
| 90 | # Installation
|
| 91 | # macOS bundle parameters
|
| 92 | @@ -241,4 +241,14 @@ set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE_SHORT_VERSION_STR
|
| 93 | set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE_BUNDLE_VERSION "${XYGRIB_VERSION}")
|
| 94 | set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE_COPYRIGHT "${PROJECT_NAME} Authors")
|
| 95 | # Install data
|
| 96 | -install(DIRECTORY data DESTINATION ${PREFIX_PKGDATA})
|
| 97 | +install(DIRECTORY data DESTINATION ${PREFIX_PKGDATA}
|
| 98 | + PATTERN "CMakeFiles" EXCLUDE
|
| 99 | + PATTERN "CMakeLists.txt" EXCLUDE
|
| 100 | + PATTERN "Makefile" EXCLUDE
|
| 101 | + PATTERN "cmake_install.cmake" EXCLUDE)
|
| 102 | +if(GNU_PACKAGE)
|
| 103 | + install(FILES debian/xygrib.desktop
|
| 104 | + DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/applications)
|
| 105 | + install(FILES debian/xygrib.png
|
| 106 | + DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/pixmaps)
|
| 107 | +endif()
|
| 108 | diff --git a/INSTALL.md b/INSTALL.md
|
| 109 | index 2c9d3ab4da03..1190cc780182 100644
|
| 110 | |
| 111 | |
| 112 | @@ -22,7 +22,19 @@ https://gihub.com/opengribs/XyGrib/releases or on https://opengribs.org in the d
|
| 113 | - openSUSE Tumbleweed: `sudo zypper install gcc git cmake libqt5-qtbase-devel libpng-devel openjpeg2-devel libnova-devel libproj-devel zlib-devel libbz2-devel
|
| 114 |
|
| 115 | ## Build and package
|
| 116 | +### Options
|
| 117 |
|
| 118 | +XyGrib has two CMake options
|
| 119 | +- GNU_PACKAGE (DEFAULT: OFF)
|
| 120 | +```
|
| 121 | +Files will be installed in GNU standard installation directories such as prefix/bin and prefix/share.
|
| 122 | +Packagers are recommended to test this option.
|
| 123 | +```
|
| 124 | +- GEN_TRANSLATION (DEFAULT: ON)
|
| 125 | +```
|
| 126 | +Create targets to generate translation files.
|
| 127 | +Turning this off removes the need for qt-linguist, part of qttools-5 qt5 submodule, during build.
|
| 128 | +```
|
| 129 | ### macOS
|
| 130 |
|
| 131 | - Get the source
|