2017-04-28 20:45:41 +00:00
|
|
|
# Copyright (c) 2014-present, Facebook, Inc.
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# This source code is licensed under the BSD-style license found in the
|
|
|
|
# LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
# of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
|
2015-02-03 05:21:36 +00:00
|
|
|
# make package
|
|
|
|
if(APPLE)
|
2015-07-13 19:24:58 +00:00
|
|
|
add_custom_target(
|
|
|
|
packages
|
2016-06-27 23:19:08 +00:00
|
|
|
COMMAND bash "${CMAKE_SOURCE_DIR}/tools/deployment/make_osx_package.sh"
|
2016-08-10 21:06:47 +00:00
|
|
|
COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/tools/codegen/genapi.py" "${CMAKE_SOURCE_DIR}"
|
2015-07-16 19:23:44 +00:00
|
|
|
"--output" "--directory" "${CMAKE_BINARY_DIR}"
|
2015-07-13 19:24:58 +00:00
|
|
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
|
|
|
COMMENT "Building default OS X package (no custom config)" VERBATIM
|
|
|
|
DEPENDS daemon shell
|
|
|
|
)
|
2015-02-03 05:21:36 +00:00
|
|
|
elseif(LINUX)
|
|
|
|
add_custom_target(
|
|
|
|
packages
|
|
|
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
|
|
|
COMMENT "Building linux packages (no custom config)" VERBATIM
|
2015-05-04 21:15:19 +00:00
|
|
|
DEPENDS daemon shell
|
2015-02-03 05:21:36 +00:00
|
|
|
)
|
2016-11-16 03:43:53 +00:00
|
|
|
|
2016-12-01 00:28:49 +00:00
|
|
|
set(DEB_PACKAGE_DEPENDENCIES "libc6 (>=2.12), zlib1g")
|
|
|
|
set(RPM_PACKAGE_DEPENDENCIES "glibc >= 2.12, zlib")
|
2017-03-16 01:39:06 +00:00
|
|
|
set(PACMAN_PACKAGE_DEPENDENCIES "zlib")
|
2016-12-01 00:28:49 +00:00
|
|
|
|
2016-11-16 03:43:53 +00:00
|
|
|
find_program(FPM_EXECUTABLE "fpm" ENV PATH)
|
|
|
|
find_program(RPMBUILD_EXECUTABLE "rpmbuild" ENV PATH)
|
2017-03-16 01:39:06 +00:00
|
|
|
find_program(BSDTAR_EXECUTABLE "bsdtar" ENV PATH)
|
2016-11-16 03:43:53 +00:00
|
|
|
|
|
|
|
if(FPM_EXECUTABLE)
|
|
|
|
add_custom_command(TARGET packages PRE_BUILD
|
|
|
|
COMMAND bash "${CMAKE_SOURCE_DIR}/tools/deployment/make_linux_package.sh"
|
2017-03-27 04:23:40 +00:00
|
|
|
-t "deb" -i "1.linux" -d '${DEB_PACKAGE_DEPENDENCIES}'
|
2016-11-16 03:43:53 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
if(RPMBUILD_EXECUTABLE)
|
|
|
|
add_custom_command(TARGET packages PRE_BUILD
|
|
|
|
COMMAND bash "${CMAKE_SOURCE_DIR}/tools/deployment/make_linux_package.sh"
|
2017-03-27 04:23:40 +00:00
|
|
|
-t "rpm" -i "1.linux" -d '${RPM_PACKAGE_DEPENDENCIES}'
|
2016-11-16 03:43:53 +00:00
|
|
|
)
|
|
|
|
else()
|
|
|
|
WARNING_LOG("Skipping RPM/CentOS packages: Cannot find rpmbuild")
|
|
|
|
endif()
|
2017-03-16 01:39:06 +00:00
|
|
|
|
|
|
|
if(BSDTAR_EXECUTABLE)
|
|
|
|
add_custom_command(TARGET packages PRE_BUILD
|
|
|
|
COMMAND bash "${CMAKE_SOURCE_DIR}/tools/deployment/make_linux_package.sh"
|
|
|
|
-t "pacman" -i "1.arch" -d '${PACMAN_PACKAGE_DEPENDENCIES}'
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
WARNING_LOG("Skipping ArchLinux packages: Cannot find bsdtar")
|
|
|
|
endif()
|
|
|
|
|
2017-03-27 04:23:40 +00:00
|
|
|
add_custom_command(TARGET packages PRE_BUILD
|
|
|
|
COMMAND bash "${CMAKE_SOURCE_DIR}/tools/deployment/make_linux_package.sh"
|
|
|
|
-t "tar" -i "1.linux" -d "none"
|
|
|
|
)
|
|
|
|
|
2016-11-16 03:43:53 +00:00
|
|
|
else()
|
|
|
|
WARNING_LOG("Cannot find fpm executable in path")
|
|
|
|
endif()
|
|
|
|
|
2015-02-03 05:21:36 +00:00
|
|
|
endif()
|
2015-07-16 22:23:29 +00:00
|
|
|
|
2017-09-09 23:48:39 +00:00
|
|
|
if(NOT SKIP_KERNEL)
|
|
|
|
if(NOT DEFINED KERNEL_BINARY)
|
|
|
|
message(FATAL_ERROR "Package related targets must be included after kernel")
|
|
|
|
endif()
|
2015-07-16 22:23:29 +00:00
|
|
|
|
2017-09-09 23:48:39 +00:00
|
|
|
# Add dependencies and additional package data based on optional components.
|
|
|
|
if(EXISTS "${CMAKE_BINARY_DIR}/kernel/${KERNEL_BINARY}")
|
|
|
|
# The osquery kernel was built
|
|
|
|
add_dependencies(packages kernel-build)
|
|
|
|
endif()
|
2015-07-16 22:23:29 +00:00
|
|
|
endif()
|