mirror of
https://github.com/Cisco-Talos/clamav.git
synced 2025-10-19 10:23:17 +00:00

CMake/CPack is already used to build: - TGZ source tarball - WiX-based installer (Windows) - ZIP install packages (Windows) This commit adds support for building: - macOS PKG installer - DEB package - RPM package This should also enable building FreeBSD packages, but while I was able to build all of the static dependencies using Mussels, CMake/CPack 3.20 doesn't appear to have the the FreeBSD generator despite being in the documentation. The package names are will be in this format: clamav-<version><suffix>.<os>.<arch>.<extension> This includes changing the Windows .zip and .msi installer names. E.g.: - clamav-0.104.0-rc.macos.x86_64.pkg - clamav-0.104.0-rc.win.win32.msi - clamav-0.104.0-rc.win.win32.zip - clamav-0.104.0-rc.win.x64.msi - clamav-0.104.0-rc.linux.x86_64.deb - clamav-0.104.0-rc.linux.x86_64.rpm Notes about building the packages: I've only tested this with building ClamAV using static dependencies that I build using the clamav_deps "host-static" recipes from the "clamav" Mussels cookbook. Eg: msl build clamav_deps -t host-static Here's an example configuration to build clam in this way, installing to /usr/local/clamav: ```sh cmake .. \ -D CMAKE_FIND_PACKAGE_PREFER_CONFIG=TRUE \ -D CMAKE_PREFIX_PATH=$HOME/.mussels/install/host-static \ -D CMAKE_INSTALL_PREFIX="/usr/local/clamav" \ -D CMAKE_MODULE_PATH=$HOME/.mussels/install/host-static/lib/cmake \ -D CMAKE_BUILD_TYPE=RelWithDebInfo \ -D ENABLE_EXAMPLES=OFF \ -D JSONC_INCLUDE_DIR="$HOME/.mussels/install/host-static/include/json-c" \ -D JSONC_LIBRARY="$HOME/.mussels/install/host-static/lib/libjson-c.a" \ -D ENABLE_JSON_SHARED=OFF \ -D BZIP2_INCLUDE_DIR="$HOME/.mussels/install/host-static/include" \ -D BZIP2_LIBRARY_RELEASE="$HOME/.mussels/install/host-static/lib/libbz2_static.a" \ -D OPENSSL_ROOT_DIR="$HOME/.mussels/install/host-static" \ -D OPENSSL_INCLUDE_DIR="$HOME/.mussels/install/host-static/include" \ -D OPENSSL_CRYPTO_LIBRARY="$HOME/.mussels/install/host-static/lib/libcrypto.a" \ -D OPENSSL_SSL_LIBRARY="$HOME/.mussels/install/host-static/lib/libssl.a" \ -D LIBXML2_INCLUDE_DIR="$HOME/.mussels/install/host-static/include/libxml2" \ -D LIBXML2_LIBRARY="$HOME/.mussels/install/host-static/lib/libxml2.a" \ -D PCRE2_INCLUDE_DIR="$HOME/.mussels/install/host-static/include" \ -D PCRE2_LIBRARY="$HOME/.mussels/install/host-static/lib/libpcre2-8.a" \ -D CURSES_INCLUDE_DIR="$HOME/.mussels/install/host-static/include" \ -D CURSES_LIBRARY="$HOME/.mussels/install/host-static/lib/libncurses.a" \ -D ZLIB_INCLUDE_DIR="$HOME/.mussels/install/host-static/include" \ -D ZLIB_LIBRARY="$HOME/.mussels/install/host-static/lib/libz.a" \ -D LIBCHECK_INCLUDE_DIR="$HOME/.mussels/install/host-static/include" \ -D LIBCHECK_LIBRARY="$HOME/.mussels/install/host-static/lib/libcheck.a" ``` Set CPACK_PACKAGING_INSTALL_PREFIX to customize the resulting package's install location. This can be different than the install prefix. E.g.: ```sh -D CMAKE_INSTALL_PREFIX="/usr/local/clamav" \ -D CPACK_PACKAGING_INSTALL_PREFIX="/usr/local/clamav" \ ``` Then `make` and then one of these, depending on the platform: ```sh cpack # macOS: productbuild is default cpack -G DEB # Debian-based cpack -G RPM # RPM-based ``` On macOS you'll need to `pip3 install markdown` so that the NEWS.md file can be converted to html so it will render in the installer. On RPM-based systems, you'll need rpmbuild (install rpm-build) This commit also fixes an issue where the html manual (if present) was not correctly added to the Windows (or now other) install packages. Fix num to hex function for Windows installer guid Fix win32 cpack build Fix macOS cpack build
26 lines
526 B
CMake
26 lines
526 B
CMake
#
|
|
# clamav config files
|
|
#
|
|
|
|
install(
|
|
FILES
|
|
${CMAKE_CURRENT_SOURCE_DIR}/clamd.conf.sample
|
|
DESTINATION
|
|
${APP_CONFIG_DIRECTORY}
|
|
COMPONENT programs)
|
|
|
|
install(
|
|
FILES
|
|
${CMAKE_CURRENT_SOURCE_DIR}/freshclam.conf.sample
|
|
DESTINATION
|
|
${APP_CONFIG_DIRECTORY}
|
|
COMPONENT programs)
|
|
|
|
if(ENABLE_MILTER)
|
|
install(
|
|
FILES
|
|
${CMAKE_CURRENT_SOURCE_DIR}/clamav-milter.conf.sample
|
|
DESTINATION
|
|
${APP_CONFIG_DIRECTORY}
|
|
COMPONENT programs)
|
|
endif()
|