Michal Vasko | b725ee8 | 2019-12-20 15:20:51 +0100 | [diff] [blame] | 1 | set(PACKAGE "libyang") |
| 2 | set(CPP_PACKAGE "libyang-cpp") |
Michal Vasko | 8daccd6 | 2019-12-20 15:52:17 +0100 | [diff] [blame] | 3 | set(PYTHON_PACKAGE "python3-yang") |
Martin Winter | 7fbed08 | 2020-07-15 16:41:48 +0200 | [diff] [blame] | 4 | set(TOOLS_PACKAGE "libyang-tools") |
Michal Vasko | b725ee8 | 2019-12-20 15:20:51 +0100 | [diff] [blame] | 5 | |
| 6 | find_program(DEB_BUILDER NAMES debuild) |
| 7 | find_program(RPM_BUILDER NAMES rpmbuild) |
| 8 | |
| 9 | # setup package build |
| 10 | configure_file(${PROJECT_SOURCE_DIR}/packages/${PACKAGE}.spec.in ${PROJECT_BINARY_DIR}/build-packages/${PACKAGE}.spec) |
| 11 | configure_file(${PROJECT_SOURCE_DIR}/packages/${PACKAGE}.dsc.in ${PROJECT_BINARY_DIR}/build-packages/${PACKAGE}.dsc) |
| 12 | configure_file(${PROJECT_SOURCE_DIR}/packages/debian.control.in ${PROJECT_BINARY_DIR}/build-packages/debian.control @ONLY) |
| 13 | configure_file(${PROJECT_SOURCE_DIR}/packages/debian.rules.in ${PROJECT_BINARY_DIR}/build-packages/debian.rules) |
Michal Vasko | 143f418 | 2020-01-27 10:38:27 +0100 | [diff] [blame] | 14 | configure_file(${PROJECT_SOURCE_DIR}/packages/debian.compat |
| 15 | ${PROJECT_BINARY_DIR}/build-packages/debian.compat COPYONLY) |
Michal Vasko | 1054200 | 2020-07-29 09:59:11 +0200 | [diff] [blame] | 16 | configure_file(${PROJECT_SOURCE_DIR}/packages/debian.copyright |
| 17 | ${PROJECT_BINARY_DIR}/build-packages/debian.copyright COPYONLY) |
Michal Vasko | b725ee8 | 2019-12-20 15:20:51 +0100 | [diff] [blame] | 18 | configure_file(${PROJECT_SOURCE_DIR}/packages/${PACKAGE}.rpmlintrc |
| 19 | ${PROJECT_BINARY_DIR}/build-packages/${PACKAGE}.rpmlintrc COPYONLY) |
Michal Vasko | b725ee8 | 2019-12-20 15:20:51 +0100 | [diff] [blame] | 20 | configure_file(${PROJECT_SOURCE_DIR}/packages/debian.${PACKAGE}.install |
Michal Vasko | 1054200 | 2020-07-29 09:59:11 +0200 | [diff] [blame] | 21 | ${PROJECT_BINARY_DIR}/build-packages/debian.${PACKAGE}${LIBYANG_MAJOR_SOVERSION}.install COPYONLY) |
Michal Vasko | b725ee8 | 2019-12-20 15:20:51 +0100 | [diff] [blame] | 22 | configure_file(${PROJECT_SOURCE_DIR}/packages/debian.${PACKAGE}-dev.install |
| 23 | ${PROJECT_BINARY_DIR}/build-packages/debian.${PACKAGE}-dev.install COPYONLY) |
| 24 | configure_file(${PROJECT_SOURCE_DIR}/packages/debian.${CPP_PACKAGE}.install |
Michal Vasko | 1054200 | 2020-07-29 09:59:11 +0200 | [diff] [blame] | 25 | ${PROJECT_BINARY_DIR}/build-packages/debian.${CPP_PACKAGE}${LIBYANG_MAJOR_SOVERSION}.install COPYONLY) |
Michal Vasko | b725ee8 | 2019-12-20 15:20:51 +0100 | [diff] [blame] | 26 | configure_file(${PROJECT_SOURCE_DIR}/packages/debian.${CPP_PACKAGE}-dev.install |
| 27 | ${PROJECT_BINARY_DIR}/build-packages/debian.${CPP_PACKAGE}-dev.install COPYONLY) |
Michal Vasko | 143f418 | 2020-01-27 10:38:27 +0100 | [diff] [blame] | 28 | # no python package for Debian because there is only SWIG 3.10 on Debian 9 :-/ |
| 29 | #configure_file(${PROJECT_SOURCE_DIR}/packages/debian.${PYTHON_PACKAGE}.install |
Michal Vasko | 1054200 | 2020-07-29 09:59:11 +0200 | [diff] [blame] | 30 | # ${PROJECT_BINARY_DIR}/build-packages/debian.${PYTHON_PACKAGE}${LIBYANG_MAJOR_SOVERSION}.install COPYONLY) |
Michal Vasko | b725ee8 | 2019-12-20 15:20:51 +0100 | [diff] [blame] | 31 | |
Michal Vasko | 2b677b8 | 2020-02-03 09:17:11 +0100 | [diff] [blame] | 32 | if(NOT DEB_BUILDER) |
Michal Vasko | b725ee8 | 2019-12-20 15:20:51 +0100 | [diff] [blame] | 33 | message(STATUS "Missing tools (devscripts, debhelper package) for building DEB package.") |
Michal Vasko | 2b677b8 | 2020-02-03 09:17:11 +0100 | [diff] [blame] | 34 | else() |
Michal Vasko | b725ee8 | 2019-12-20 15:20:51 +0100 | [diff] [blame] | 35 | # target for local build deb package |
| 36 | message(STATUS "To build local DEB package, use \"build-deb\" target.") |
| 37 | add_custom_target(build-deb |
| 38 | WORKING_DIRECTORY ${PROJECT_BINARY_DIR} |
| 39 | COMMAND build-packages/local-deb.sh |
| 40 | ) |
| 41 | configure_file(${PROJECT_SOURCE_DIR}/packages/local-deb.sh.in ${PROJECT_BINARY_DIR}/build-packages/local-deb.sh @ONLY) |
| 42 | endif() |
| 43 | |
Michal Vasko | 2b677b8 | 2020-02-03 09:17:11 +0100 | [diff] [blame] | 44 | if(NOT RPM_BUILDER) |
Michal Vasko | b725ee8 | 2019-12-20 15:20:51 +0100 | [diff] [blame] | 45 | message(STATUS "Missing tools (rpm package) for building RPM package.") |
Michal Vasko | 2b677b8 | 2020-02-03 09:17:11 +0100 | [diff] [blame] | 46 | else() |
Michal Vasko | b725ee8 | 2019-12-20 15:20:51 +0100 | [diff] [blame] | 47 | # target for local build rpm package |
| 48 | message(STATUS "To build local RPM package, use \"build-rpm\" target.") |
| 49 | string(REPLACE ${PROJECT_SOURCE_DIR} "." EXCLUDE_BUILD_DIR ${PROJECT_BINARY_DIR}) |
| 50 | add_custom_target(build-rpm |
| 51 | WORKING_DIRECTORY ${PROJECT_BINARY_DIR} |
| 52 | COMMAND build-packages/local-rpm.sh |
| 53 | ) |
| 54 | configure_file(${PROJECT_SOURCE_DIR}/packages/local-rpm.sh.in ${PROJECT_BINARY_DIR}/build-packages/local-rpm.sh @ONLY) |
| 55 | endif() |