Damjan Marion | 4d2f86a | 2019-01-18 13:28:22 +0100 | [diff] [blame] | 1 | # Copyright (c) 2019 Cisco and/or its affiliates. |
| 2 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | # you may not use this file except in compliance with the License. |
| 4 | # You may obtain a copy of the License at: |
| 5 | # |
| 6 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | # |
| 8 | # Unless required by applicable law or agreed to in writing, software |
| 9 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | # See the License for the specific language governing permissions and |
| 12 | # limitations under the License. |
| 13 | |
Damjan Marion | 5857daf | 2020-06-16 16:05:12 +0200 | [diff] [blame] | 14 | if(CMAKE_CROSSCOMPILING) |
| 15 | return() |
| 16 | endif() |
| 17 | |
Damjan Marion | 4d2f86a | 2019-01-18 13:28:22 +0100 | [diff] [blame] | 18 | get_cmake_property(VPP_COMPONENTS COMPONENTS) |
| 19 | string(REPLACE ";" " " VPP_COMPONENTS "${VPP_COMPONENTS}") |
| 20 | |
Andrew Yourtchenko | 5ca8bfc | 2023-10-18 21:18:32 +0000 | [diff] [blame^] | 21 | ############################################################################## |
| 22 | # pinned timestamp for reproducible builds |
| 23 | ############################################################################## |
| 24 | set(VPP_SOURCE_DATE_EPOCH |
| 25 | "" |
| 26 | CACHE |
| 27 | STRING "Artifact build timestamp for reproducible builds" |
| 28 | ) |
| 29 | |
| 30 | if(VPP_SOURCE_DATE_EPOCH STREQUAL "") |
| 31 | set(VPP_TIMESTAMP_ARG "") |
| 32 | else() |
| 33 | set(VPP_TIMESTAMP_ARG "--date=@${VPP_SOURCE_DATE_EPOCH}") |
| 34 | endif() |
| 35 | |
Damjan Marion | 4d2f86a | 2019-01-18 13:28:22 +0100 | [diff] [blame] | 36 | execute_process( |
Andrew Yourtchenko | 5ca8bfc | 2023-10-18 21:18:32 +0000 | [diff] [blame^] | 37 | COMMAND date -R ${VPP_TIMESTAMP_ARG} |
Damjan Marion | 4d2f86a | 2019-01-18 13:28:22 +0100 | [diff] [blame] | 38 | OUTPUT_VARIABLE TIMESTAMP |
| 39 | OUTPUT_STRIP_TRAILING_WHITESPACE |
| 40 | ) |
| 41 | |
Damjan Marion | a416493 | 2020-05-12 12:22:18 +0200 | [diff] [blame] | 42 | # parse /etc/os-release |
| 43 | file(READ "/etc/os-release" os_release) |
| 44 | string(REPLACE "\n" ";" os_release ${os_release}) |
| 45 | foreach(l ${os_release}) |
| 46 | string(REPLACE "=" ";" l ${l}) |
| 47 | list(GET l 0 _name) |
| 48 | list(GET l 1 _value) |
| 49 | string(REPLACE "\"" "" _value ${_value}) |
| 50 | set(OS_${_name} ${_value}) |
| 51 | endforeach() |
| 52 | |
Paul Vinciguerra | 3ca4b14 | 2020-12-30 00:41:15 +0000 | [diff] [blame] | 53 | set(VPP_DEB_BUILD_DEPENDS "python3-all, python3-setuptools") |
| 54 | set(VPP_DEB_WITH_PYTHON2 "no") |
Damjan Marion | a416493 | 2020-05-12 12:22:18 +0200 | [diff] [blame] | 55 | |
| 56 | foreach(f rules changelog control) |
Damjan Marion | 4d2f86a | 2019-01-18 13:28:22 +0100 | [diff] [blame] | 57 | configure_file( |
| 58 | ${CMAKE_CURRENT_SOURCE_DIR}/debian/${f}.in |
Damjan Marion | 88b2e36 | 2021-04-29 18:47:25 +0200 | [diff] [blame] | 59 | ${VPP_BINARY_DIR}/debian/${f} |
Damjan Marion | a416493 | 2020-05-12 12:22:18 +0200 | [diff] [blame] | 60 | @ONLY |
Damjan Marion | 4d2f86a | 2019-01-18 13:28:22 +0100 | [diff] [blame] | 61 | ) |
| 62 | endforeach() |
| 63 | |
Damjan Marion | a416493 | 2020-05-12 12:22:18 +0200 | [diff] [blame] | 64 | foreach(f copyright vpp.preinst vpp.postrm vpp.postinst vpp.service) |
Damjan Marion | 4d2f86a | 2019-01-18 13:28:22 +0100 | [diff] [blame] | 65 | file(COPY |
| 66 | ${CMAKE_CURRENT_SOURCE_DIR}/debian/${f} |
Damjan Marion | 88b2e36 | 2021-04-29 18:47:25 +0200 | [diff] [blame] | 67 | DESTINATION ${VPP_BINARY_DIR}/debian |
Damjan Marion | 4d2f86a | 2019-01-18 13:28:22 +0100 | [diff] [blame] | 68 | ) |
| 69 | endforeach() |
| 70 | |
Damjan Marion | 88b2e36 | 2021-04-29 18:47:25 +0200 | [diff] [blame] | 71 | add_custom_target(pkg-deb |
Damjan Marion | 4d2f86a | 2019-01-18 13:28:22 +0100 | [diff] [blame] | 72 | COMMENT "Building .deb packages..." |
Damjan Marion | 88b2e36 | 2021-04-29 18:47:25 +0200 | [diff] [blame] | 73 | WORKING_DIRECTORY ${VPP_BINARY_DIR} |
Damjan Marion | 4d2f86a | 2019-01-18 13:28:22 +0100 | [diff] [blame] | 74 | COMMAND "dpkg-buildpackage" "-us" "-uc" "-b" |
Damjan Marion | 7ec2fe2 | 2019-01-22 09:10:16 +0100 | [diff] [blame] | 75 | USES_TERMINAL |
Damjan Marion | 4d2f86a | 2019-01-18 13:28:22 +0100 | [diff] [blame] | 76 | ) |