-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeListsDeb.txt
46 lines (39 loc) · 1.79 KB
/
CMakeListsDeb.txt
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
set(BIN_DIR ${PROJECT_SOURCE_DIR}/bin)
set(BIN_DEB_DIR ${BIN_DIR}/deb)
set(DEBIAN_DIR ${PROJECT_SOURCE_DIR}/debian)
set(MODULE_DIR ${PROJECT_SOURCE_DIR}/source/server)
set(MODULE_NAME zero_cache)
set(MODULE_VERSION 2.2)
set(USR_SRC_DIR /usr/src/${MODULE_NAME}-${MODULE_VERSION})
# Targets for the deb packages building
add_custom_target(deb-clean
COMMAND -rm -rf build-stamp install_manifest.txt configure-stamp
COMMAND find . -name "*.1" | xargs rm -f
COMMAND -rm -rf ${DEBIAN_DIR}/buildroot
COMMAND -rm -rf ${DEBIAN_DIR}/zero-cache
COMMAND -rm -rf ${DEBIAN_DIR}/zero-cache-dev
COMMAND find ${DEBIAN_DIR} -name "*.log" | xargs rm -f
COMMAND find ${DEBIAN_DIR} -name "*.substvars" | xargs rm -f
COMMAND find ${DEBIAN_DIR} -name "*.debhelper" | xargs rm -f
COMMAND -rm -rf ${BIN_DEB_DIR}
COMMAND find ${BIN_DIR} -name \"*.dsc\" | xargs rm -f
COMMAND find ${BIN_DIR} -name "*.changes" | xargs rm -f
COMMAND find ${BIN_DIR} -name "*.deb" | xargs rm -f
COMMAND find ${BIN_DIR} -name "*.tar.gz" | xargs rm -f
COMMAND -sudo dkms remove -m ${MODULE_NAME} -v ${MODULE_VERSION} --all
COMMAND -sudo rm -Rf ${USR_SRC_DIR}
)
add_custom_target(deb
COMMAND mkdir -p ${BIN_DEB_DIR}
COMMAND ${MKCHANGELOG}
COMMAND dpkg-buildpackage -rfakeroot -b -us -uc
COMMAND mv -f ../*.changes ../*.deb ${BIN_DEB_DIR}
COMMAND -sudo mkdir ${USR_SRC_DIR}
COMMAND -sudo cp -R ${MODULE_DIR}/* ${USR_SRC_DIR}
COMMAND -sudo cp dkms.conf ${USR_SRC_DIR}/
COMMAND -sudo dkms add -m ${MODULE_NAME} -v ${MODULE_VERSION}
COMMAND -sudo dkms build -m ${MODULE_NAME} -v ${MODULE_VERSION}
COMMAND -sudo dkms mkdeb -m ${MODULE_NAME} -v ${MODULE_VERSION}
COMMAND -cp -f /var/lib/dkms/${MODULE_NAME}/${MODULE_VERSION}/deb/* ${BIN_DEB_DIR}
)
add_dependencies(deb deb-clean)