From 2aba9cf07aaed31f4411a5cbee096a569fd07edc Mon Sep 17 00:00:00 2001 From: AndersonTorres Date: Mon, 23 May 2022 22:54:28 -0300 Subject: [PATCH] Cmake build system: implement GNU directory conventions With this patch, many hardcoded paths are now substituted by GNU conventions, as documented in the references below: https://cmake.org/cmake/help/v3.23/module/GNUInstallDirs.html https://www.gnu.org/prep/standards/html_node/Directory-Variables.html --- src/CMakeLists.txt | 6 +++--- src/a12/CMakeLists.txt | 6 +++--- src/a12/net/CMakeLists.txt | 2 +- src/frameserver/CMakeLists.txt | 2 +- src/frameserver/avfeed/CMakeLists.txt | 2 +- src/frameserver/decode/CMakeLists.txt | 2 +- src/frameserver/encode/CMakeLists.txt | 2 +- src/frameserver/game/CMakeLists.txt | 2 +- src/frameserver/net/CMakeLists.txt | 2 +- src/frameserver/remoting/CMakeLists.txt | 2 +- src/frameserver/terminal/CMakeLists.txt | 2 +- src/platform/cmake/CMakeLists.LWA | 2 +- src/platform/cmake/CMakeLists.Linux | 4 ++-- src/shmif/CMakeLists.txt | 10 ++++------ src/tools/acfgfs/CMakeLists.txt | 4 ++-- src/tools/aclip/CMakeLists.txt | 4 ++-- src/tools/aloadimage/CMakeLists.txt | 4 ++-- src/tools/shmmon/CMakeLists.txt | 2 +- src/tools/vrbridge/CMakeLists.txt | 2 +- src/wayland/CMakeLists.txt | 6 +++--- 20 files changed, 33 insertions(+), 35 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8f1ff2a9..caf2faee 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -747,7 +747,7 @@ else() # if (VIDEO_PLATFORM STREQUAL "egl-dri") amsg("${CL_YEL}egl-dri+privsep${CL_RST}\t${CL_GRN}installing SUID${CL_RST}") - install(TARGETS arcan DESTINATION bin + install(TARGETS arcan DESTINATION ${CMAKE_INSTALL_BINDIR} PERMISSIONS SETUID OWNER_WRITE OWNER_READ OWNER_EXECUTE @@ -755,10 +755,10 @@ else() WORLD_READ WORLD_EXECUTE ) else() - install(TARGETS arcan DESTINATION bin) + install(TARGETS arcan DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() - install(TARGETS ${BIN_INSTALL} DESTINATION bin) + install(TARGETS ${BIN_INSTALL} DESTINATION ${CMAKE_INSTALL_BINDIR}) install(DIRECTORY ${CMAKE_SOURCE_DIR}/../data/appl DESTINATION ${APPL_DEST} diff --git a/src/a12/CMakeLists.txt b/src/a12/CMakeLists.txt index 892565c6..2ede2266 100644 --- a/src/a12/CMakeLists.txt +++ b/src/a12/CMakeLists.txt @@ -97,8 +97,8 @@ target_link_libraries(arcan_a12 ${LIBRARIES}) set(A12_LIBRARIES arcan_a12 PARENT_SCOPE) install(TARGETS arcan_a12 - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) -install(FILES a12.h DESTINATION include/arcan) +install(FILES a12.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/arcan) add_subdirectory("net") diff --git a/src/a12/net/CMakeLists.txt b/src/a12/net/CMakeLists.txt index 2ba4ae9c..6f629d94 100644 --- a/src/a12/net/CMakeLists.txt +++ b/src/a12/net/CMakeLists.txt @@ -23,4 +23,4 @@ add_executable(arcan-net ${SOURCES}) add_sanitizers(arcan-net) target_link_libraries(arcan-net PRIVATE arcan_a12 ) target_include_directories(arcan-net PRIVATE ${INCLUDE_DIRS}) -install(TARGETS arcan-net DESTINATION bin) +install(TARGETS arcan-net DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/src/frameserver/CMakeLists.txt b/src/frameserver/CMakeLists.txt index f8d2adee..a46ba3d0 100644 --- a/src/frameserver/CMakeLists.txt +++ b/src/frameserver/CMakeLists.txt @@ -69,6 +69,6 @@ endforeach() add_executable(arcan_frameserver frameserver.c) add_sanitizers(arcan_frameserver) target_compile_definitions(arcan_frameserver PRIVATE AFSRV_CHAINLOADER) -install(TARGETS arcan_frameserver DESTINATION bin) +install(TARGETS arcan_frameserver DESTINATION ${CMAKE_INSTALL_BINDIR}) amsg("${CL_YEL}frameservers\t${CL_GRN}${FRAMESERVER_MODESTRING}${CL_RST}") set(FRAMESERVER_MODESTRING ${FRAMESERVER_MODESTRING} PARENT_SCOPE) diff --git a/src/frameserver/avfeed/CMakeLists.txt b/src/frameserver/avfeed/CMakeLists.txt index 7290336d..3daf0de3 100644 --- a/src/frameserver/avfeed/CMakeLists.txt +++ b/src/frameserver/avfeed/CMakeLists.txt @@ -18,5 +18,5 @@ if (AVFEED_SOURCES) ) target_include_directories(afsrv_avfeed PRIVATE ${FSRV_ROOT} ${AVFEED_INCLUDE_DIRS}) target_link_libraries(afsrv_avfeed ${STDLIB} arcan_shmif_int ${AVFEED_LIBS}) - install(TARGETS afsrv_avfeed DESTINATION bin) + install(TARGETS afsrv_avfeed DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() diff --git a/src/frameserver/decode/CMakeLists.txt b/src/frameserver/decode/CMakeLists.txt index 85f0d27a..6b515ab6 100644 --- a/src/frameserver/decode/CMakeLists.txt +++ b/src/frameserver/decode/CMakeLists.txt @@ -22,5 +22,5 @@ if (DECODE_SOURCES) add_dependencies(afsrv_decode ${DECODE_DEPS}) endif() - install(TARGETS afsrv_decode DESTINATION bin) + install(TARGETS afsrv_decode DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() diff --git a/src/frameserver/encode/CMakeLists.txt b/src/frameserver/encode/CMakeLists.txt index 87ca659e..c2cb9c46 100644 --- a/src/frameserver/encode/CMakeLists.txt +++ b/src/frameserver/encode/CMakeLists.txt @@ -18,5 +18,5 @@ if (ENCODE_SOURCES) ) target_include_directories(afsrv_encode PRIVATE ${FSRV_ROOT} ${ENCODE_INCLUDE_DIRS}) target_link_libraries(afsrv_encode ${STDLIB} arcan_shmif_int ${ENCODE_LIBS}) - install(TARGETS afsrv_encode DESTINATION bin) + install(TARGETS afsrv_encode DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() diff --git a/src/frameserver/game/CMakeLists.txt b/src/frameserver/game/CMakeLists.txt index 88d4e5d4..a10890fc 100644 --- a/src/frameserver/game/CMakeLists.txt +++ b/src/frameserver/game/CMakeLists.txt @@ -28,5 +28,5 @@ if (GAME_SOURCES) arcan_shmif_int ${GAME_LIBS} ) - install(TARGETS afsrv_game DESTINATION bin) + install(TARGETS afsrv_game DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() diff --git a/src/frameserver/net/CMakeLists.txt b/src/frameserver/net/CMakeLists.txt index 93762287..ebeb0eb2 100644 --- a/src/frameserver/net/CMakeLists.txt +++ b/src/frameserver/net/CMakeLists.txt @@ -18,5 +18,5 @@ if (NET_SOURCES) ) target_include_directories(afsrv_net PRIVATE ${FSRV_ROOT} ${NET_INCLUDE_DIRS}) target_link_libraries(afsrv_net ${STDLIB} arcan_shmif_int ${NET_LIBS}) - install(TARGETS afsrv_net DESTINATION bin) + install(TARGETS afsrv_net DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() diff --git a/src/frameserver/remoting/CMakeLists.txt b/src/frameserver/remoting/CMakeLists.txt index ad5c0c8c..3e599d66 100644 --- a/src/frameserver/remoting/CMakeLists.txt +++ b/src/frameserver/remoting/CMakeLists.txt @@ -22,5 +22,5 @@ if (REMOTING_SOURCES) ${REMOTING_INCLUDE_DIRS} ) target_link_libraries(afsrv_remoting ${STDLIB} arcan_shmif_int ${REMOTING_LIBS}) - install(TARGETS afsrv_remoting DESTINATION bin) + install(TARGETS afsrv_remoting DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() diff --git a/src/frameserver/terminal/CMakeLists.txt b/src/frameserver/terminal/CMakeLists.txt index 3b5ef4a1..e979bb9c 100644 --- a/src/frameserver/terminal/CMakeLists.txt +++ b/src/frameserver/terminal/CMakeLists.txt @@ -24,5 +24,5 @@ if (TERMINAL_SOURCES) add_dependencies(afsrv_terminal ${TERMINAL_DEPENDENCIES}) endif() - install(TARGETS afsrv_terminal DESTINATION bin) + install(TARGETS afsrv_terminal DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() diff --git a/src/platform/cmake/CMakeLists.LWA b/src/platform/cmake/CMakeLists.LWA index 76711fc5..e3057ddc 100644 --- a/src/platform/cmake/CMakeLists.LWA +++ b/src/platform/cmake/CMakeLists.LWA @@ -111,4 +111,4 @@ target_compile_definitions(arcan_lwa PRIVATE ARCAN_BUILDVERSION=\"${SOURCE_TAG}-${PLATFORM_BUILDTAG}-${CMAKE_SYSTEM_NAME}\" ) -install(TARGETS arcan_lwa DESTINATION bin) +install(TARGETS arcan_lwa DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/src/platform/cmake/CMakeLists.Linux b/src/platform/cmake/CMakeLists.Linux index 9c8e6529..9be1e239 100644 --- a/src/platform/cmake/CMakeLists.Linux +++ b/src/platform/cmake/CMakeLists.Linux @@ -41,11 +41,11 @@ if (NOT RES_DEST) endif() if (NOT APIMAN_DEST) - set(APIMAN_DEST ${CMAKE_INSTALL_PREFIX}/share/man/man3) + set(APIMAN_DEST ${CMAKE_INSTALL_MANDIR}/man3) endif() if (NOT MAN_DEST) - set(MAN_DEST ${CMAKE_INSTALL_PREFIX}/share/man/man1) + set(MAN_DEST ${CMAKE_INSTALL_MANDIR}/man1) endif() set(ARCAN_PLATFORM diff --git a/src/shmif/CMakeLists.txt b/src/shmif/CMakeLists.txt index 06d34a21..e2cd95bb 100644 --- a/src/shmif/CMakeLists.txt +++ b/src/shmif/CMakeLists.txt @@ -31,8 +31,6 @@ else() set(ASD ${CMAKE_CURRENT_SOURCE_DIR}/../) endif() -set(ASHMIF_INSTPATH lib) - set (TUI_HEADERS ${ASD}/shmif/arcan_tui.h ${ASD}/shmif/arcan_tuidefs.h @@ -273,9 +271,9 @@ target_include_directories(arcan_shmif_server PRIVATE ${ASD}/shmif) if (NOT ARCAN_SOURCE_DIR) install(TARGETS ${TARGET_LIST} - LIBRARY DESTINATION ${ASHMIF_INSTPATH} - ARCHIVE DESTINATION ${ASHMIF_INSTPATH} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) - install(FILES ${SHMIF_HEADERS} DESTINATION include/arcan/shmif) - install(FILES ${TUI_HEADERS} DESTINATION include/arcan) + install(FILES ${SHMIF_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/arcan/shmif) + install(FILES ${TUI_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/arcan) endif() diff --git a/src/tools/acfgfs/CMakeLists.txt b/src/tools/acfgfs/CMakeLists.txt index 8a42f53c..8ca13dfd 100644 --- a/src/tools/acfgfs/CMakeLists.txt +++ b/src/tools/acfgfs/CMakeLists.txt @@ -38,11 +38,11 @@ set(SOURCES add_executable(${PROJECT_NAME} ${SOURCES}) target_link_libraries(${PROJECT_NAME} ${LIBRARIES}) -install(TARGETS ${PROJECT_NAME} DESTINATION bin) +install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) target_include_directories(${PROJECT_NAME} PUBLIC ${ARCAN_SHMIF_INCLUDE_DIR} ${FUSE3_INCLUDE_DIRS}) if (CMAKE_SYSTEM_NAME MATCHES "(DragonFly|FreeBSD|NetBSD|OpenBSD)") install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/arcan_cfgfs.1 DESTINATION man/man1) else() -install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/arcan_cfgfs.1 DESTINATION share/man/man1) +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/arcan_cfgfs.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) endif() diff --git a/src/tools/aclip/CMakeLists.txt b/src/tools/aclip/CMakeLists.txt index 7ef47c58..436548bb 100644 --- a/src/tools/aclip/CMakeLists.txt +++ b/src/tools/aclip/CMakeLists.txt @@ -42,10 +42,10 @@ set(SOURCES add_executable(${PROJECT_NAME} ${SOURCES}) target_link_libraries(${PROJECT_NAME} ${LIBRARIES}) -install(TARGETS ${PROJECT_NAME} DESTINATION bin) +install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) if (CMAKE_SYSTEM_NAME MATCHES "(DragonFly|FreeBSD|NetBSD|OpenBSD)") install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/aclip.1 DESTINATION man/man1) else() -install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/aclip.1 DESTINATION share/man/man1) +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/aclip.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) endif() diff --git a/src/tools/aloadimage/CMakeLists.txt b/src/tools/aloadimage/CMakeLists.txt index 0d948b6c..326c3fc8 100644 --- a/src/tools/aloadimage/CMakeLists.txt +++ b/src/tools/aloadimage/CMakeLists.txt @@ -64,11 +64,11 @@ SET(SOURCES add_executable(${PROJECT_NAME} ${SOURCES}) target_link_libraries(${PROJECT_NAME} ${LIBRARIES}) -install(TARGETS ${PROJECT_NAME} DESTINATION bin) +install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) add_sanitizers(${PROJECT_NAME}) if (CMAKE_SYSTEM_NAME MATCHES "(DragonFly|FreeBSD|NetBSD|OpenBSD)") install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/aloadimage.1 DESTINATION man/man1) else() -install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/aloadimage.1 DESTINATION share/man/man1) +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/aloadimage.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) endif() diff --git a/src/tools/shmmon/CMakeLists.txt b/src/tools/shmmon/CMakeLists.txt index 736a0fa4..46758db9 100644 --- a/src/tools/shmmon/CMakeLists.txt +++ b/src/tools/shmmon/CMakeLists.txt @@ -44,4 +44,4 @@ set(SOURCES add_executable(${PROJECT_NAME} ${SOURCES}) target_link_libraries(${PROJECT_NAME} ${LIBRARIES}) -install(TARGETS ${PROJECT_NAME} DESTINATION bin) +install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/src/tools/vrbridge/CMakeLists.txt b/src/tools/vrbridge/CMakeLists.txt index 28488290..fc8eb0f8 100644 --- a/src/tools/vrbridge/CMakeLists.txt +++ b/src/tools/vrbridge/CMakeLists.txt @@ -111,4 +111,4 @@ endif() target_link_libraries(${PROJECT_NAME} ${LIBRARIES}) -install(TARGETS ${PROJECT_NAME} DESTINATION bin) +install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/src/wayland/CMakeLists.txt b/src/wayland/CMakeLists.txt index 1d6b8cc3..4cd44922 100644 --- a/src/wayland/CMakeLists.txt +++ b/src/wayland/CMakeLists.txt @@ -96,11 +96,11 @@ target_include_directories(arcan-wayland PRIVATE ${WAYBRIDGE_INCLUDES}) target_include_directories(arcan_xwm PRIVATE ${WAYBRIDGE_INCLUDES}) add_sanitizers(arcan-wayland) -install(TARGETS arcan-wayland DESTINATION bin) -install(TARGETS arcan_xwm DESTINATION bin) +install(TARGETS arcan-wayland DESTINATION ${CMAKE_INSTALL_BINDIR}) +install(TARGETS arcan_xwm DESTINATION ${CMAKE_INSTALL_BINDIR}) if (CMAKE_SYSTEM_NAME MATCHES "(DragonFly|FreeBSD|NetBSD|OpenBSD)") install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/arcan-wayland.1 DESTINATION man/man1) else() -install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/arcan-wayland.1 DESTINATION share/man/man1) +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/arcan-wayland.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) endif()#install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/arcan-wayland.1 DESTINATION man) -- 2.35.3