]> prime8.dev >> repos - ttyd.git/commitdiff
cmake: add support for generating deb package for ubuntu
authorShuanglei Tao <tsl0922@gmail.com>
Sat, 25 Mar 2017 16:02:27 +0000 (00:02 +0800)
committerShuanglei Tao <tsl0922@gmail.com>
Sun, 26 Mar 2017 01:15:47 +0000 (09:15 +0800)
CMakeLists.txt
src/server.c
src/server.h

index 2395093c9dda5e1178a9799e7862eaa5a2e78b1b..e35c63489d1d6d7a6783273538730e9ce2217496 100644 (file)
@@ -1,6 +1,7 @@
 cmake_minimum_required(VERSION 2.8)
+cmake_policy(SET CMP0048 NEW)
 
-project(ttyd)
+project(ttyd VERSION "1.3.1")
 
 if(CMAKE_VERSION VERSION_LESS "3.1")
     if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
@@ -62,8 +63,23 @@ endif()
 add_executable(${PROJECT_NAME} ${SOURCE_FILES})
 target_include_directories(${PROJECT_NAME} PUBLIC ${INCLUDE_DIRS})
 target_link_libraries(${PROJECT_NAME} ${LINK_LIBS})
+target_compile_definitions(${PROJECT_NAME} PRIVATE TTYD_VERSION="${PROJECT_VERSION}")
 
 include(GNUInstallDirs)
 
 install(TARGETS ${PROJECT_NAME} DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT prog)
 install(FILES man/ttyd.1 DESTINATION "${CMAKE_INSTALL_MANDIR}/man1" COMPONENT doc)
+
+set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
+set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
+set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_NAME} - Share your terminal over the web")
+set(CPACK_PACKAGE_CONTACT "Shuanglei Tao <tsl0922@gmail.com>")
+set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}_${CMAKE_SYSTEM_PROCESSOR}")
+
+set(CPACK_GENERATOR "DEB")
+SET(CPACK_DEBIAN_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
+set(CPACK_DEBIAN_PACKAGE_SECTION "shells")
+set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://tsl0922.github.io/ttyd")
+set(CPACK_DEBIAN_PACKAGE_DEPENDS "libjson-c2, libwebsockets7, libssl1.0.0, libc6 (>= 2.14)")
+
+include(CPack)
index 2856db0b4f7724bb051cc94455f90c1087a519da..d863df68d910aa71b91f8589191b61c90a70d818 100644 (file)
@@ -1,7 +1,5 @@
 #include "server.h"
 
-#define TTYD_VERSION "1.3.1"
-
 volatile bool force_exit = false;
 struct lws_context *context;
 struct tty_server *server;
index d547647be37275c5f5f8407967b908fd4ed84a5e..0ba7ab2f4486f72fb0bd4aa1eb9e7d37bdb9da53 100644 (file)
@@ -2,6 +2,10 @@
 #include "lws_config.h"
 #endif
 
+#ifndef TTYD_VERSION
+#define TTYD_VERSION "unknown"
+#endif
+
 #define _GNU_SOURCE
 
 #include <stdio.h>