-
Notifications
You must be signed in to change notification settings - Fork 0
/
deb.cmake
72 lines (51 loc) · 2.75 KB
/
deb.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
set(_VERSION_MAJOR 0)
set(_VERSION_MINOR 6)
set(_VERSION_PATCH 4)
set(CPACK_GENERATOR "DEB")
############下面是设置debian/control文件中的内容
# 设置版本信息
set(CPACK_PACKAGE_VERSION_MAJOR "${_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${_VERSION_PATCH}")
# 设置安装包的包名,打好的包将会是packagename-version-linux.debian,如果不设置,默认是工程名
set(CPACK_PACKAGE_NAME "dde-top-panel")
# 设置程序名,就是程序安装后的名字
set(CPACK_DEBIAN_PACKAGE_NAME "dde-top-panel")
# 设置架构
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
# 设置依赖
set(CPACK_DEBIAN_PACKAGE_DEPENDS
"libqt5dbus5, libqt5core5a, libqt5gui5, libxcb-ewmh2, libxcb1, libdframeworkdbus2,
libdtkcore5-bin, libkf5windowsystem5, libqt5svg5, libqt5concurrent5, libgsettings-qt1, libxcb-util0")
# 设置section
set(CPACK_DEBIAN_PACKAGE_SECTION "utils")
# 设置priority
set(CPACK_DEBIAN_PACKAGE_PRIORITY "Optional")
# 设置description
set(CPACK_PACKAGE_DESCRIPTION "DDE Top Panel is a top bar supporting the global menu for Deepin V20")
# 设置联系方式
set(CPACK_PACKAGE_CONTACT "[email protected]")
# 设置维护人
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "SeptemberHX")
##############debian/control设置完成了,下面设置控制脚本,动态库,changelog等
# lib目录下保存这一些动态库和安装控制脚本(postinst、postinst、preinst、prerm) doc目录下是changelog和copyright等文件 这些东西是打包时要依赖的一些额外的东西
set(LIBS_DIR ${CMAKE_SOURCE_DIR}/debian/scripts)
set(DOCS_DIR ${CMAKE_SOURCE_DIR}/debian/doc)
# 设置控制脚本,这些都是大包者本人自己准备的,没有就算了
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${LIBS_DIR}/postinst;${LIBS_DIR}/prerm")
# 压缩 changelog
include(GNUInstallDirs)
add_custom_command(
OUTPUT "${CMAKE_BINARY_DIR}/changelog.gz"
COMMAND gzip -cn9 "${DOCS_DIR}/changelog" > "${CMAKE_BINARY_DIR}/changelog.gz"
WORKING_DIRECTORY "${DOCS_DIR}"
DEPENDS "${DOCS_DIR}/changelog"
COMMENT "Compressing changelog"
)
add_custom_target(changelog ALL DEPENDS "${CMAKE_BINARY_DIR}/changelog.gz")
install(FILES ${CMAKE_BINARY_DIR}/frame/dde-top-panel DESTINATION /usr/bin/)
install(FILES ${CMAKE_SOURCE_DIR}/xml/com.deepin.dde.toppanel.gschema.xml DESTINATION /usr/share/glib-2.0/schemas)
install(FILES ${CMAKE_SOURCE_DIR}/dde-top-panel.desktop DESTINATION /usr/share/applications)
install(DIRECTORY ${CMAKE_BINARY_DIR}/translations DESTINATION /usr/share/dde-top-panel)
# 最后把我们的changelog等东西也加进来,project是你的工程名
install(FILES ${CMAKE_BINARY_DIR}/changelog.gz ${DOCS_DIR}/copyright DESTINATION ${CMAKE_INSTALL_DOCDIR})