Commit 69db8684 authored by Albert  Babí Oller's avatar Albert Babí Oller Committed by Albert Babí Oller

packaging: add global installation support for linux

- avoid using fixed paths and find LRC either when globally installed or located in custom directory
- add installation rules for binaries, .desktop files, .appdata.xml, logo and doc
- add support for generating and copying runtime files (webresources and translations)
- add launcher script (client qt/gnome/kde selector)
- add uninstall support
- add missing sources (moderatorlistmodel)
- update README

Gitlab: #160, #230, #263, #264

Change-Id: I3fee77a917be038072a20c7f99b510f9a8bf65b4
parent b55be608
......@@ -12,24 +12,11 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(SRC_DIR ${CMAKE_SOURCE_DIR}/src)
set(SRC_DIR ${PROJECT_SOURCE_DIR}/src)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
set(QML_RESOURCES ${CMAKE_SOURCE_DIR}/resources.qrc)
set(QML_RESOURCES_QML ${CMAKE_SOURCE_DIR}/qml.qrc)
if(NOT DEFINED LRC)
set(LRC ${CMAKE_CURRENT_SOURCE_DIR}/../install/lrc)
set(LRCPATH ${LRC}/include/libringclient)
set(LRCLIBDIR ${LRC}/lib)
else()
set(LRCPATH ${LRC}/src)
if (NOT DEFINED LRCBUILD)
set(LRCLIBDIR ${LRC}/build)
else()
set(LRCLIBDIR ${LRCBUILD})
endif()
endif()
set(QML_RESOURCES ${PROJECT_SOURCE_DIR}/resources.qrc)
set(QML_RESOURCES_QML ${PROJECT_SOURCE_DIR}/qml.qrc)
set(QML_LIBS
Qt5::Quick
......@@ -80,7 +67,8 @@ set(COMMON_SOURCES
${SRC_DIR}/qmlregister.cpp
${SRC_DIR}/utilsadapter.cpp
${SRC_DIR}/dbuserrorhandler.cpp
${SRC_DIR}/xrectsel.c)
${SRC_DIR}/xrectsel.c
${SRC_DIR}/moderatorlistmodel.cpp)
set(COMMON_HEADERS
${SRC_DIR}/avatarimageprovider.h
......@@ -130,7 +118,8 @@ set(COMMON_HEADERS
${SRC_DIR}/qtutils.h
${SRC_DIR}/utilsadapter.h
${SRC_DIR}/dbuserrorhandler.h
${SRC_DIR}/xrectsel.h)
${SRC_DIR}/xrectsel.h
${SRC_DIR}/moderatorlistmodel.h)
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBNM libnm)
......@@ -140,66 +129,169 @@ if(LIBNM_FOUND)
endif()
if(QT5_VER AND QT5_PATH)
string(REPLACE "." ";" VERSION_LIST ${QT5_VER})
list(GET VERSION_LIST 0 QT5_VER_MAJOR)
list(GET VERSION_LIST 1 QT5_VER_MINOR)
list(GET VERSION_LIST 2 QT5_VER_PATCH)
if ((${QT5_VER_MAJOR} GREATER_EQUAL 5) AND (${QT5_VER_MINOR} GREATER_EQUAL 14))
message(STATUS "Using custom Qt version")
find_package(Qt5 ${QT5_VER} REQUIRED
COMPONENTS
Core
Quick
QuickWidgets
Network
Svg
QuickControls2
WebEngine
DBus
PATHS ${QT5_PATH} NO_DEFAULT_PATH)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH true)
endif()
string(REPLACE "." ";" VERSION_LIST ${QT5_VER})
list(GET VERSION_LIST 0 QT5_VER_MAJOR)
list(GET VERSION_LIST 1 QT5_VER_MINOR)
list(GET VERSION_LIST 2 QT5_VER_PATCH)
if((${QT5_VER_MAJOR} GREATER_EQUAL 5) AND (${QT5_VER_MINOR} GREATER_EQUAL 14))
message(STATUS "Using custom Qt version")
find_package(Qt5 ${QT5_VER} REQUIRED COMPONENTS
Core
Quick
QuickWidgets
Network
Svg
QuickControls2
WebEngine
DBus
PATHS ${QT5_PATH} NO_DEFAULT_PATH)
find_package(Qt5LinguistTools ${QT5_VER}
PATHS ${QT5_PATH} NO_DEFAULT_PATH)
endif()
else()
find_package(Qt5 REQUIRED COMPONENTS
Core
Quick
QuickWidgets
Network
Svg
QuickControls2
WebEngine
DBus)
find_package(Qt5LinguistTools)
endif()
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH true)
# If LRC is not globally installed, it's path should be specified
# by setting variable LRC. If library is not inside LRC + suffixes
# lib, build or build-local, it's path should be set with LRCLIB.
if(DEFINED LRC)
if(EXISTS ${LRC}/include/libringclient)
set(LRC_SRC_PATH ${LRC}/include/libringclient)
else()
set(LRC_SRC_PATH ${LRC}/src)
endif()
if(NOT DEFINED LRCLIB)
set(LRCLIB ${LRC})
endif()
find_library(ringclient ringclient
PATHS ${LRCLIB}
PATH_SUFFIXES lib build build-local NO_DEFAULT_PATH)
message("Will expect lrc library in ${LRCLIB} (including \
subdirs /lib, /build and /build-local)")
set(LRC_LIB_NAME ${ringclient})
else()
find_package(Qt5 REQUIRED
COMPONENTS
Core
Quick
QuickWidgets
Network
Svg
QuickControls2
WebEngine
DBus)
find_package(LibRingClient REQUIRED)
if (LibRingClient_FOUND)
set(LRC_SRC_PATH ${LIB_RING_CLIENT_INCLUDE_DIR})
set(LRC_LIB_NAME ${LIB_RING_CLIENT_LIBRARY})
else()
message("lrc not found!")
endif()
endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR}
message("Will expect lrc headers in ${LRC_SRC_PATH}")
include_directories(${PROJECT_SOURCE_DIR}
${SRC_DIR}
${LRCPATH}
${LRC_SRC_PATH}
${LIBNM_INCLUDE_DIRS})
link_libraries(${LIBNM_LIBRARIES})
add_executable(${PROJECT_NAME}
${SRC_DIR}/main.cpp
${COMMON_HEADERS}
${COMMON_SOURCES}
${QML_RESOURCES}
${QML_RESOURCES_QML})
${QML_RESOURCES_QML}
${LRC_SRC_PATH}/webresource.qrc)
message(${LRCLIBDIR})
find_library(ringclient ringclient ${LRCLIBDIR} NO_DEFAULT_PATH)
find_library(qrencode qrencode)
find_library(X11 X11)
target_link_libraries(jami-qt
${QML_LIBS}
${ringclient}
${LRC_LIB_NAME}
${qrencode}
${X11}
)
${LIBNM_LIBRARIES})
if(ENABLE_TESTS)
message("Add Jami tests")
add_subdirectory(tests)
endif()
# Installation rules
install(TARGETS jami-qt
RUNTIME DESTINATION bin)
# install .desktop in XDG desktop dir so that it is recognized by the system
install(FILES ${PROJECT_SOURCE_DIR}/jami-qt.desktop
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
# logos
install(FILES images/jami.svg
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps)
install(FILES images/jami-48px.png
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/48x48/apps
RENAME jami.png)
install(FILES images/jami-32px.xpm
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/pixmaps
RENAME jami.xpm)
install(FILES jami-qt.appdata.xml
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/metainfo)
# install jami launcher that selects between clients
install(
FILES
"${PROJECT_SOURCE_DIR}/src/jami"
DESTINATION
${CMAKE_INSTALL_PREFIX}/bin
PERMISSIONS
WORLD_READ
OWNER_WRITE
OWNER_READ
GROUP_READ
OWNER_EXECUTE
GROUP_EXECUTE
WORLD_EXECUTE)
# add a target to generate API documentation with Doxygen
find_package(Doxygen)
if(DOXYGEN_FOUND)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in ${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile @ONLY)
add_custom_target(doc
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc
COMMENT "Generating API documentation with Doxygen" VERBATIM)
# create doc/README.md symlink to README since Doxygen doesn't understand file with no extension
add_custom_command(
TARGET doc
PRE_BUILD
COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/README ${CMAKE_CURRENT_SOURCE_DIR}/doc/README.md)
endif(DOXYGEN_FOUND)
# translations
if(Qt5LinguistTools_FOUND)
message("Releasing and copying translation files")
file(GLOB TS_FILES ${PROJECT_SOURCE_DIR}/translations/*.ts)
qt5_add_translation(QM_FILES ${TS_FILES})
add_custom_target(translations ALL DEPENDS ${QM_FILES})
install(FILES ${QM_FILES}
DESTINATION "${CMAKE_INSTALL_PREFIX}/share/libringclient/translations")
endif()
# uninstall
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
......@@ -71,6 +71,9 @@ Then, you can build daemon, lrc and client-qt with:
And you will have the daemon in `daemon/bin/dring` and the client in `client-qt/build-local/jami-qt`. You also can run it with
If you use a Qt version that is not wide-system installed you need to specify its path after the `--qt` flag, i. e., `./make-ring.py --install --qt /home/<username>/Qt/5.15.0/gcc_64
```bash
./make-ring.py --run --qt
```
......@@ -81,10 +84,23 @@ And you will have the daemon in `daemon/bin/dring` and the client in `client-qt/
cd client-qt
mkdir build
cd build
${YOUR_QT5_gcc64_PATH}/bin/qmake ../jami-qt.pro
make -j9
cmake .. -DQT5_VER=5.15.0 -DQT5_PATH=/home/<username>/Qt/5.15.0/gcc_64 -DLRC=<path_to_lrc> -DCMAKE_INSTALL_PREFIX=<installation_path>
make -j
```
Variables `QT5_VER` and `QT5_PATH` are used to specify version and path for a custom installation of Qt.
If lrc library is installed in a custom directory you can set its path with the variable LRC. Additionally you can specify built library location with `LRCLIB` (otherwise it will seach inside LRC with the suffixes `/lib`, `/build` and `/build-local`).
After the build has finished, you are finally ready to launch jami-qt in your build directory.
If you want to install it to the path provided by `CMAKE_INSTALL_PREFIX` you can run:
```bash
make install
```
If you want more details, or separately build other projects you can check [this page](https://git.jami.net/savoirfairelinux/ring-project/wikis/technical/Build-instructions).
## Building On Native Windows
......@@ -184,7 +200,6 @@ Only 64-bit MSVC build can be compiled.
```bash
cd client-windows
pandoc -f markdown -t html5 -o changelog.html changelog.md
python make-client.py -d
python make-client.py -b
powershell -ExecutionPolicy Unrestricted -File copy-runtime-files.ps1
......
# Taken from:
# https://cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F
#
# Copyright (C) 2021 Savoir-faire Linux Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
foreach(file ${files})
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
exec_program(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
endif(NOT "${rm_retval}" STREQUAL 0)
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
endforeach(file)
......@@ -195,7 +195,7 @@ def compile_and_copy_web_resources():
print(bcolors.FAIL + "No rcc found!" + bcolors.ENDC)
sys.exit()
lrc_web_resources_path = globalVar.lrc_path + os.sep + 'webresource.qrc'
lrc_web_resources_path = globalVar.lrc_path + os.sep + "src" + os.sep + 'webresource.qrc'
execute_cmd(rcc + ' -binary ' + lrc_web_resources_path +
' -o ' + globalVar.output_path + os.sep + 'webresource.rcc')
......
PROJECT_NAME = "jami-qt"
PROJECT_NUMBER =
INPUT = /home/ababi/ring-project/client-qt
RECURSIVE = YES
EXCLUDE = /home/ababi/ring-project/client-qt/build-local
FILE_PATTERNS = *.cpp *.h *.c *.md
INPUT_ENCODING = UTF-8
USE_MDFILE_AS_MAINPAGE = /home/ababi/ring-project/client-qt/doc/README.md
EXTRACT_ALL = YES
EXTRACT_LOCAL_CLASSES = YES
PROJECT_NAME = "@CMAKE_PROJECT_NAME@"
PROJECT_NUMBER = @PROJECT_VERSION@
INPUT = @PROJECT_SOURCE_DIR@
RECURSIVE = YES
EXCLUDE = @PROJECT_BINARY_DIR@
FILE_PATTERNS = *.cpp *.h *.c *.md
INPUT_ENCODING = UTF-8
USE_MDFILE_AS_MAINPAGE = @PROJECT_SOURCE_DIR@/doc/README.md
EXTRACT_ALL = YES
EXTRACT_LOCAL_CLASSES = YES
.\" Manpage for jami-qt.
.TH man 8 "08 April 2021" "1.0" "jami-qt man page"
.SH NAME
jami-qt \- Qt client for jami.net
.SH SYNOPSIS
jami-qt [options]
.SH DESCRIPTION
jami-qt is a qt client for jami.net
.SH OPTIONS
.B \-v, \-\-version
Display the version and exit.
.TP
.B \-d, \-\-debug
Enable debug.
.TP
.B \-h, \-\-help
Display help text and exit.
.SH SEE ALSO
dring(1)
.SH AUTHOR
Alexandre Viau (alexandre.viau@savoirfairelinux.net)
/* XPM */
static char * jami_xpm[] = {
"32 32 357 2",
" c None",
". c #2B5B92",
"+ c #202654",
"@ c #262F5E",
"# c #252C5A",
"$ c #252F5D",
"% c #2865A0",
"& c #2767A2",
"* c #2569A5",
"= c #26305F",
"- c #293868",
"; c #2B4070",
"> c #2B3D6D",
", c #2B3E6E",
"' c #256BA6",
") c #2868A3",
"! c #2171AF",
"~ c #2073B2",
"{ c #1C77B7",
"] c #197ABA",
"^ c #284172",
"/ c #2C4172",
"( c #2D4879",
"_ c #2E4C7E",
": c #2E4B7D",
"< c #2E4E7F",
"[ c #2E4C7D",
"} c #2C5183",
"| c #1A7AB8",
"1 c #2074B0",
"2 c #256CA8",
"3 c #1A79B9",
"4 c #177CBC",
"5 c #147EBF",
"6 c #127FC1",
"7 c #1080C2",
"8 c #265A90",
"9 c #2D497A",
"0 c #2E4779",
"a c #2D4172",
"b c #2D5487",
"c c #2D5386",
"d c #27649A",
"e c #0D85C3",
"f c #1380BD",
"g c #1A7AB7",
"h c #2173AF",
"i c #266CA7",
"j c #117FC2",
"k c #1080C3",
"l c #0F80C3",
"m c #0F81C4",
"n c #0E81C4",
"o c #1F6EAB",
"p c #2E4B7C",
"q c #2E4678",
"r c #2C4070",
"s c #2C4A7C",
"t c #2D568A",
"u c #1F79B3",
"v c #0A8ECC",
"w c #0B8AC8",
"x c #0E85C3",
"y c #147FBD",
"z c #1B79B6",
"A c #2074B1",
"B c #0E81C5",
"C c #147DBE",
"D c #2D4577",
"E c #2C3E6F",
"F c #2B4576",
"G c #2D568B",
"H c #138FCC",
"I c #0A94D3",
"J c #0A91CF",
"K c #0A8DCB",
"L c #0B89C7",
"M c #0E84C2",
"N c #1180C2",
"O c #137EC0",
"P c #157DBE",
"Q c #275D93",
"R c #293B6A",
"S c #2B4E81",
"T c #2C4F82",
"U c #26679C",
"V c #0B9AD9",
"W c #0B98D7",
"X c #0B96D5",
"Y c #0A94D2",
"Z c #0B8DCB",
"` c #1E76B5",
" . c #2172B0",
".. c #2368A2",
"+. c #273261",
"@. c #294374",
"#. c #2A4577",
"$. c #1B86C1",
"%. c #0D9BDB",
"&. c #0C9BDB",
"*. c #0C99D9",
"=. c #0B96D4",
"-. c #1C77B6",
";. c #1F73B1",
">. c #2075B2",
",. c #2079B6",
"'. c #207EBA",
"). c #2080BC",
"!. c #1D85C1",
"~. c #1980B9",
"{. c #1980BA",
"]. c #187FB8",
"^. c #187BB4",
"/. c #1973AD",
"(. c #2069A2",
"_. c #275D94",
":. c #26669C",
"<. c #0F9CDC",
"[. c #0E9CDC",
"}. c #0D9CDC",
"|. c #0C9BDA",
"1. c #0B99D9",
"2. c #0A93D1",
"3. c #1092D0",
"4. c #0E98D8",
"5. c #0E9DDD",
"6. c #109EDE",
"7. c #0F9DDD",
"8. c #0B99D8",
"9. c #0A95D3",
"0. c #0E85C2",
"a. c #1C78B5",
"b. c #2769A4",
"c. c #1D8ECC",
"d. c #0F9EDE",
"e. c #158AC9",
"f. c #1C78B9",
"g. c #1181BF",
"h. c #0B8BC9",
"i. c #0A93D2",
"j. c #0B98D8",
"k. c #1083C1",
"l. c #1E76B3",
"m. c #2676B0",
"n. c #119EDD",
"o. c #0E9BDB",
"p. c #1C78B7",
"q. c #1D77B7",
"r. c #2074B2",
"s. c #1F75B2",
"t. c #1083C0",
"u. c #0B8CCA",
"v. c #1C94D1",
"w. c #168ECD",
"x. c #2073B1",
"y. c #2669A4",
"z. c #2769A5",
"A. c #1D77B4",
"B. c #0B97D6",
"C. c #137FBD",
"D. c #1F85C1",
"E. c #109DDD",
"F. c #1C7BB9",
"G. c #1C78B8",
"H. c #2072B1",
"I. c #2768A3",
"J. c #2C598E",
"K. c #266BA7",
"L. c #1B79B7",
"M. c #0D86C4",
"N. c #0A8FCD",
"O. c #0A96D4",
"P. c #0C9ADA",
"Q. c #0A92D0",
"R. c #157FBD",
"S. c #1196D4",
"T. c #178DCB",
"U. c #1D77B6",
"V. c #2C588C",
"W. c #246EAA",
"X. c #197BB9",
"Y. c #0C87C5",
"Z. c #0A90CE",
"`. c #0C9AD9",
" + c #149EDD",
".+ c #1697D4",
"++ c #1790CD",
"@+ c #1486C3",
"#+ c #1285C3",
"$+ c #0E9ADA",
"%+ c #2866A1",
"&+ c #2D578B",
"*+ c #2370AC",
"=+ c #177DBA",
"-+ c #1095D4",
";+ c #198AC6",
">+ c #207EB7",
",+ c #2674AA",
"'+ c #2A6FA5",
")+ c #2D679A",
"!+ c #2D598D",
"~+ c #2D5488",
"{+ c #2C5A8F",
"]+ c #2A6097",
"^+ c #1A7CB5",
"/+ c #24679E",
"(+ c #2070AB",
"_+ c #1B78B7",
":+ c #28669F",
"<+ c #2172AF",
"[+ c #147FBC",
"}+ c #157FBB",
"|+ c #216EA5",
"1+ c #285689",
"2+ c #2C4272",
"3+ c #2C4171",
"4+ c #2B5C91",
"5+ c #29639A",
"6+ c #27679F",
"7+ c #256BA4",
"8+ c #236EA9",
"9+ c #2172AD",
"0+ c #1F75B1",
"a+ c #187DBA",
"b+ c #1380BE",
"c+ c #0F8ECA",
"d+ c #273B6A",
"e+ c #2A3969",
"f+ c #2C4071",
"g+ c #294E81",
"h+ c #265E95",
"i+ c #2469A5",
"j+ c #28659E",
"k+ c #2D5689",
"l+ c #236FAA",
"m+ c #285D93",
"n+ c #2D4D7F",
"o+ c #2A5B90",
"p+ c #1C79B5",
"q+ c #197BB8",
"r+ c #167EBB",
"s+ c #1082C0",
"t+ c #0F85C2",
"u+ c #0D87C4",
"v+ c #1683C1",