diff --git a/CMakeLists.txt b/CMakeLists.txt index 70df1e483..9b99d8f57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -187,6 +187,19 @@ endif() # Find Library Dependencies # if (WIN32) + set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION .) + include(InstallRequiredSystemLibraries) + + set(CPACK_GENERATOR "ZIP;WIX") + SET(CPACK_WIX_UPGRADE_GUID D9F136C1-3691-47E3-9079-4FE9C9C5EB32) + SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/COPYING.txt) + SET(CPACK_WIX_PRODUCT_ICON ${CMAKE_CURRENT_SOURCE_DIR}/win32/res/clam.ico) + SET(CPACK_WIX_UI_BANNER ${CMAKE_CURRENT_SOURCE_DIR}/win32/wix_ui_banner.bmp) + SET(CPACK_WIX_UI_DIALOG ${CMAKE_CURRENT_SOURCE_DIR}/win32/wix_ui_dialog.bmp) + SET(CPACK_WIX_CMAKE_PACKAGE_REGISTRY ClamAV) + set(CPACK_PACKAGE_INSTALL_DIRECTORY "ClamAV") + include(CPack) + find_package(PThreadW32) set(HAVE_PTHREAD_H 1) set(_REENTRANT 1) @@ -633,7 +646,7 @@ set(includedir "${CMAKE_INSTALL_FULL_INCLUDEDIR}") set(VERSION "${PACKAGE_VERSION}") # DBDIR for systemd service.in files -set(DBDIR "${DATABASE_DIRECTORY}") +set(DBDIR "${CMAKE_INSTALL_PREFIX}/${DATABASE_DIRECTORY}") if(ENABLE_DEBUG) set(CL_DEBUG 1) diff --git a/CMakeOptions.cmake b/CMakeOptions.cmake index c23d0218f..54bca51fe 100644 --- a/CMakeOptions.cmake +++ b/CMakeOptions.cmake @@ -2,17 +2,17 @@ if (WIN32) set(APP_CONFIG_DIRECTORY - "${CMAKE_INSTALL_PREFIX}" CACHE STRING + "." CACHE STRING "App Config directory.") set(DATABASE_DIRECTORY - "${CMAKE_INSTALL_PREFIX}/database" CACHE STRING + "database" CACHE STRING "Database directory.") else() set(APP_CONFIG_DIRECTORY - "${CMAKE_INSTALL_PREFIX}/etc" CACHE STRING + "etc" CACHE STRING "App Config directory.") set(DATABASE_DIRECTORY - "${CMAKE_INSTALL_PREFIX}/share/clamav" CACHE STRING + "share/clamav" CACHE STRING "Database directory.") endif() diff --git a/COPYING b/COPYING.txt similarity index 100% rename from COPYING rename to COPYING.txt diff --git a/COPYING.LGPL b/COPYING/COPYING.LGPL similarity index 100% rename from COPYING.LGPL rename to COPYING/COPYING.LGPL diff --git a/COPYING.YARA b/COPYING/COPYING.YARA similarity index 100% rename from COPYING.YARA rename to COPYING/COPYING.YARA diff --git a/COPYING.bzip2 b/COPYING/COPYING.bzip2 similarity index 100% rename from COPYING.bzip2 rename to COPYING/COPYING.bzip2 diff --git a/COPYING.curl b/COPYING/COPYING.curl similarity index 100% rename from COPYING.curl rename to COPYING/COPYING.curl diff --git a/COPYING.file b/COPYING/COPYING.file similarity index 100% rename from COPYING.file rename to COPYING/COPYING.file diff --git a/COPYING.getopt b/COPYING/COPYING.getopt similarity index 100% rename from COPYING.getopt rename to COPYING/COPYING.getopt diff --git a/COPYING.llvm b/COPYING/COPYING.llvm similarity index 100% rename from COPYING.llvm rename to COPYING/COPYING.llvm diff --git a/COPYING.lzma b/COPYING/COPYING.lzma similarity index 96% rename from COPYING.lzma rename to COPYING/COPYING.lzma index d97053743..fff698c87 100644 --- a/COPYING.lzma +++ b/COPYING/COPYING.lzma @@ -1,7 +1,7 @@ -The original lzma.txt license file, a small portion of which is reproduced below, -is available under libclamav/7z/lzma.txt. - -LICENSE -------- - -LZMA SDK is written and placed in the public domain by Igor Pavlov. +The original lzma.txt license file, a small portion of which is reproduced below, +is available under libclamav/7z/lzma.txt. + +LICENSE +------- + +LZMA SDK is written and placed in the public domain by Igor Pavlov. diff --git a/COPYING.pcre b/COPYING/COPYING.pcre similarity index 100% rename from COPYING.pcre rename to COPYING/COPYING.pcre diff --git a/COPYING.regex b/COPYING/COPYING.regex similarity index 100% rename from COPYING.regex rename to COPYING/COPYING.regex diff --git a/COPYING.unrar b/COPYING/COPYING.unrar similarity index 100% rename from COPYING.unrar rename to COPYING/COPYING.unrar diff --git a/COPYING.zlib b/COPYING/COPYING.zlib similarity index 100% rename from COPYING.zlib rename to COPYING/COPYING.zlib diff --git a/INSTALL.cmake.md b/INSTALL.cmake.md index b0a6b64d1..781cfde65 100644 --- a/INSTALL.cmake.md +++ b/INSTALL.cmake.md @@ -430,6 +430,14 @@ _Tip_: If you're having include-path issues, try building with detailed verbosit cmake --build . --config Release --target install -- /verbosity:detailed ``` +To build the installer, you must have WIX Toolset installed. If you're using +Chocolatey, you can install it simply with `choco install wixtoolset` and then +open a new terminal so that WIX will be in your PATH. + +```ps1 +cpack -C Release +``` + ### External Depedencies The CMake tooling is good about finding installed dependencies on POSIX systems. diff --git a/Makefile.am b/Makefile.am index 12e7fcc28..7ff5d3d3d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -26,7 +26,7 @@ bin_SCRIPTS=clamav-config else SUBDIRS = libltdl libclamav shared libfreshclam clamscan clamd clamdscan freshclam sigtool clamconf database docs etc clamav-milter test clamdtop clambc unit_tests -EXTRA_DIST = examples shared libclamav.pc.in COPYING.bzip2 COPYING.lzma COPYING.unrar COPYING.LGPL COPYING.llvm COPYING.file COPYING.zlib COPYING.getopt COPYING.regex COPYING.YARA COPYING.pcre platform.h.in libclamunrar libclamunrar_iface libclammspack clamdscan/clamdscan.map win32 ChangeLog.md INSTALL.cmake.md INSTALL.autotools.md NEWS.md README.md cmake CMakeLists.txt CMakeOptions.cmake $(top_srcdir)/**/CMakeLists.txt libclammspack/config.h.in.cmake clamav-config.h.cmake.in target.h.cmake.in autogen.sh +EXTRA_DIST = examples shared libclamav.pc.in COPYING.txt COPYING platform.h.in libclamunrar libclamunrar_iface libclammspack clamdscan/clamdscan.map win32 ChangeLog.md INSTALL.cmake.md INSTALL.autotools.md NEWS.md README.md cmake CMakeLists.txt CMakeOptions.cmake $(top_srcdir)/**/CMakeLists.txt libclammspack/config.h.in.cmake clamav-config.h.cmake.in target.h.cmake.in autogen.sh bin_SCRIPTS=clamav-config diff --git a/README.md b/README.md index b18aab61b..82cc6329a 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,46 @@ The ClamAV development team welcomes improvements to [our documentation](https://github.com/Cisco-Talos/clamav-faq), and also [bug reports](https://bugzilla.clamav.net/). Thanks for joining us! +## Licensing + +ClamAV is licensed for public/open source use under the GNU General Public +License, Version 2 (GPLv2). + +See `COPYING.txt` for a copy of the license. + +### 3rd Party Code + +ClamAV contains a number of components that include code copied in part or in +whole from 3rd party projects and whose code is not owned by Cisco and which +are licensed differently than ClamAV. These include: + +- tomsfastmath: public domain +- LLVM: Illinois Open Source License (BSD-like) +- Yara: Apache 2.0 license + - Yara has since switched to the BSD 3-Clause License; + Our source is out-of-date and needs to be updated. +- 7z / lzma: public domain +- libclamav's NSIS/NulSoft parser includes: + - zlib: permissive free software license + - bzip2 / libbzip2: BSD-like license +- OpenBSD's libc/regex: BSD license +- file: BSD license +- str.c: Contains BSD licensed modified-implementations of strtol(), stroul() + functions, Copyright (c) 1990 The Regents of the University of California. +- pngcheck (png.c): MIT/X11-style license +- getopt.c: MIT license +- Curl: license inspired by MIT/X, but not identical +- libmspack: LGPL license +- UnRAR (libclamunrar): a non-free/restricted open source license + - Note: The UnRAR license is incompatible with GPLv2 because it contains a + clause that prohibits reverse engineering a RAR compression algorithm from + the UnRAR decompression code. + For this reason, libclamunrar/libclamunrar_iface is not linked at all with + libclamav. It is instead loaded at run-time. If it fails to load, ClamAV + will continue running without RAR support. + +See the `COPYING` directory for a copy of the 3rd party project licenses. + ## Credits [The ClamAV Team](https://www.clamav.net/about.html#credits) diff --git a/clamav-config.h.cmake.in b/clamav-config.h.cmake.in index 93cef0a61..9d4fe42f9 100644 --- a/clamav-config.h.cmake.in +++ b/clamav-config.h.cmake.in @@ -74,10 +74,10 @@ #ifndef _WIN32 /* Path to virus database directory. */ -#define DATADIR "@DATABASE_DIRECTORY@" +#define DATADIR "@CMAKE_INSTALL_PREFIX@/@DATABASE_DIRECTORY@" /* where to look for the config file */ -#define CONFDIR "@APP_CONFIG_DIRECTORY@" +#define CONFDIR "@CMAKE_INSTALL_PREFIX@/@APP_CONFIG_DIRECTORY@" #endif /* Have sys/fanotify.h */ diff --git a/clambc/CMakeLists.txt b/clambc/CMakeLists.txt index e34fb7653..44d01d85d 100644 --- a/clambc/CMakeLists.txt +++ b/clambc/CMakeLists.txt @@ -28,7 +28,7 @@ target_link_libraries( clambc ClamAV::libclamav ClamAV::shared ) if(WIN32) - install(TARGETS clambc DESTINATION ${CMAKE_INSTALL_PREFIX}) + install(TARGETS clambc DESTINATION .) else() install(TARGETS clambc DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() diff --git a/clamconf/CMakeLists.txt b/clamconf/CMakeLists.txt index 8bd53cac7..7803040af 100644 --- a/clamconf/CMakeLists.txt +++ b/clamconf/CMakeLists.txt @@ -28,7 +28,7 @@ target_link_libraries( clamconf ClamAV::libclamav ClamAV::shared ) if(WIN32) - install(TARGETS clamconf DESTINATION ${CMAKE_INSTALL_PREFIX}) + install(TARGETS clamconf DESTINATION .) else() install(TARGETS clamconf DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() diff --git a/clamd/CMakeLists.txt b/clamd/CMakeLists.txt index 34ce27f0a..a1c2c3491 100644 --- a/clamd/CMakeLists.txt +++ b/clamd/CMakeLists.txt @@ -43,9 +43,9 @@ target_link_libraries( clamd ClamAV::libclamav ClamAV::shared ) if(WIN32) - install(TARGETS clamd DESTINATION ${CMAKE_INSTALL_PREFIX}) + install(TARGETS clamd DESTINATION .) else() - install(TARGETS clamd DESTINATION ${CMAKE_INSTALL_SBINDIR}) + install(TARGETS clamd DESTINATION sbin) endif() if(SYSTEMD_FOUND) diff --git a/clamdscan/CMakeLists.txt b/clamdscan/CMakeLists.txt index 562e080ee..fb382fb2a 100644 --- a/clamdscan/CMakeLists.txt +++ b/clamdscan/CMakeLists.txt @@ -32,7 +32,7 @@ target_link_libraries( clamdscan ClamAV::libclamav ClamAV::shared ) if(WIN32) - install(TARGETS clamdscan DESTINATION ${CMAKE_INSTALL_PREFIX}) + install(TARGETS clamdscan DESTINATION .) else() - install(TARGETS clamdscan DESTINATION ${CMAKE_INSTALL_BINDIR}) + install(TARGETS clamdscan DESTINATION bin) endif() diff --git a/clamdtop/CMakeLists.txt b/clamdtop/CMakeLists.txt index 7f5219041..0eec636d9 100644 --- a/clamdtop/CMakeLists.txt +++ b/clamdtop/CMakeLists.txt @@ -29,7 +29,7 @@ target_link_libraries( clamdtop ClamAV::shared Curses::curses ) if(WIN32) - install(TARGETS clamdtop DESTINATION ${CMAKE_INSTALL_PREFIX}) + install(TARGETS clamdtop DESTINATION .) # Also install shared library (DLL) dependencies install(CODE [[ file(GET_RUNTIME_DEPENDENCIES @@ -54,5 +54,5 @@ if(WIN32) #message("UNRESOLVED_DEPENDENCIES_VAR: ${_u_deps}") ]]) else() - install(TARGETS clamdtop DESTINATION ${CMAKE_INSTALL_BINDIR}) + install(TARGETS clamdtop DESTINATION bin) endif() diff --git a/clamonacc/CMakeLists.txt b/clamonacc/CMakeLists.txt index 13caf8d7a..2086e4992 100644 --- a/clamonacc/CMakeLists.txt +++ b/clamonacc/CMakeLists.txt @@ -49,7 +49,7 @@ target_link_libraries( clamonacc ClamAV::libclamav ClamAV::shared CURL::libcurl ) -install(TARGETS clamonacc DESTINATION ${CMAKE_INSTALL_SBINDIR}) +install(TARGETS clamonacc DESTINATION sbin) if(SYSTEMD_FOUND) configure_file( diff --git a/clamonacc/clamav-clamonacc.service.in b/clamonacc/clamav-clamonacc.service.in index c031db3eb..3712ca58c 100644 --- a/clamonacc/clamav-clamonacc.service.in +++ b/clamonacc/clamav-clamonacc.service.in @@ -11,7 +11,7 @@ After=clamav-daemon.service syslog.target network.target Type=simple User=root ExecStartPre=/bin/bash -c "while [ ! -S /run/clamav/clamd.ctl ]; do sleep 1; done" -ExecStart=@prefix@/sbin/clamonacc -F --config-file=@APP_CONFIG_DIRECTORY@/clamd.conf --log=/var/log/clamav/clamonacc.log --move=/root/quarantine +ExecStart=@prefix@/sbin/clamonacc -F --log=/var/log/clamav/clamonacc.log --move=/root/quarantine [Install] WantedBy=multi-user.target diff --git a/clamscan/CMakeLists.txt b/clamscan/CMakeLists.txt index 0b5bc2ab7..86a5d5977 100644 --- a/clamscan/CMakeLists.txt +++ b/clamscan/CMakeLists.txt @@ -31,7 +31,7 @@ target_link_libraries( clamscan ClamAV::libclamav ClamAV::shared ) if(WIN32) - install(TARGETS clamscan DESTINATION ${CMAKE_INSTALL_PREFIX}) + install(TARGETS clamscan DESTINATION .) else() - install(TARGETS clamscan DESTINATION ${CMAKE_INSTALL_BINDIR}) + install(TARGETS clamscan DESTINATION bin) endif() diff --git a/clamsubmit/CMakeLists.txt b/clamsubmit/CMakeLists.txt index d751c631e..e0a4cf445 100644 --- a/clamsubmit/CMakeLists.txt +++ b/clamsubmit/CMakeLists.txt @@ -36,7 +36,7 @@ if(APPLE) ${APPLE_SECURITY} ) endif() if(WIN32) - install(TARGETS clamsubmit DESTINATION ${CMAKE_INSTALL_PREFIX}) + install(TARGETS clamsubmit DESTINATION .) # Also install shared library (DLL) dependencies install(CODE [[ file(GET_RUNTIME_DEPENDENCIES @@ -62,5 +62,5 @@ if(WIN32) #message("UNRESOLVED_DEPENDENCIES_VAR: ${_u_deps}") ]]) else() - install(TARGETS clamsubmit DESTINATION ${CMAKE_INSTALL_BINDIR}) + install(TARGETS clamsubmit DESTINATION bin) endif() diff --git a/freshclam/CMakeLists.txt b/freshclam/CMakeLists.txt index b2fd5d2ac..d32b08a73 100644 --- a/freshclam/CMakeLists.txt +++ b/freshclam/CMakeLists.txt @@ -30,9 +30,9 @@ target_link_libraries(freshclam-bin ClamAV::libclamav ClamAV::shared ) if(WIN32) - install(TARGETS freshclam-bin DESTINATION ${CMAKE_INSTALL_PREFIX}) + install(TARGETS freshclam-bin DESTINATION .) else() - install(TARGETS freshclam-bin DESTINATION ${CMAKE_INSTALL_BINDIR}) + install(TARGETS freshclam-bin DESTINATION bin) endif() # Install an empty database directory diff --git a/libclamav/CMakeLists.txt b/libclamav/CMakeLists.txt index be2ebd626..fd7778cb6 100644 --- a/libclamav/CMakeLists.txt +++ b/libclamav/CMakeLists.txt @@ -566,7 +566,7 @@ if(ENABLE_SHARED_LIB) target_link_libraries( clamav PUBLIC ICONV::Iconv ) endif() if(WIN32) - install( TARGETS clamav DESTINATION ${CMAKE_INSTALL_PREFIX} ) + install( TARGETS clamav DESTINATION . ) # Also install shared library (DLL) dependencies install( CODE [[ @@ -641,7 +641,7 @@ if(ENABLE_STATIC_LIB) VERSION ${LIBCLAMAV_VERSION} SOVERSION ${LIBCLAMAV_SOVERSION} ) target_compile_definitions( clamav_static PUBLIC clamav_staticLIB ) if(WIN32) - install( TARGETS clamav_static DESTINATION ${CMAKE_INSTALL_PREFIX} ) + install( TARGETS clamav_static DESTINATION . ) else() install( TARGETS clamav_static DESTINATION ${CMAKE_INSTALL_LIBDIR} ) endif() diff --git a/libclammspack/CMakeLists.txt b/libclammspack/CMakeLists.txt index d48a0004c..cca033527 100644 --- a/libclammspack/CMakeLists.txt +++ b/libclammspack/CMakeLists.txt @@ -74,9 +74,9 @@ if(ENABLE_SHARED_LIB) PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/mspack/mspack.h ) if(WIN32) - install(TARGETS mspack DESTINATION ${CMAKE_INSTALL_PREFIX}) + install(TARGETS mspack DESTINATION .) else() - install(TARGETS mspack DESTINATION ${CMAKE_INSTALL_LIBDIR}) + install(TARGETS mspack DESTINATION lib) endif() # Public (forwarded) dependencies. diff --git a/libclamunrar/CMakeLists.txt b/libclamunrar/CMakeLists.txt index c7df99dd9..5d28e3352 100644 --- a/libclamunrar/CMakeLists.txt +++ b/libclamunrar/CMakeLists.txt @@ -90,9 +90,9 @@ if(ENABLE_SHARED_LIB) unrar_obj ) if(WIN32) - install(TARGETS clamunrar DESTINATION ${CMAKE_INSTALL_PREFIX}) + install(TARGETS clamunrar DESTINATION .) else() - install(TARGETS clamunrar DESTINATION ${CMAKE_INSTALL_LIBDIR}) + install(TARGETS clamunrar DESTINATION lib) endif() add_library( ClamAV::libunrar ALIAS clamunrar ) diff --git a/libclamunrar_iface/CMakeLists.txt b/libclamunrar_iface/CMakeLists.txt index 8b01dbd4d..302e7d5e7 100644 --- a/libclamunrar_iface/CMakeLists.txt +++ b/libclamunrar_iface/CMakeLists.txt @@ -64,9 +64,9 @@ if(ENABLE_UNRAR) ClamAV::libunrar_iface_iface) if(WIN32) - install(TARGETS clamunrar_iface DESTINATION ${CMAKE_INSTALL_PREFIX}) + install(TARGETS clamunrar_iface DESTINATION .) else() - install(TARGETS clamunrar_iface DESTINATION ${CMAKE_INSTALL_LIBDIR}) + install(TARGETS clamunrar_iface DESTINATION lib) endif() add_library( ClamAV::libunrar_iface ALIAS clamunrar_iface ) diff --git a/libfreshclam/CMakeLists.txt b/libfreshclam/CMakeLists.txt index 13129dd68..3a7e55f68 100644 --- a/libfreshclam/CMakeLists.txt +++ b/libfreshclam/CMakeLists.txt @@ -67,7 +67,7 @@ if(ENABLE_SHARED_LIB) COMPILE_FLAGS "${WARNCFLAGS}" VERSION ${LIBFRESHCLAM_VERSION} SOVERSION ${LIBFRESHCLAM_SOVERSION}) if(WIN32) - install(TARGETS freshclam DESTINATION ${CMAKE_INSTALL_PREFIX}) + install(TARGETS freshclam DESTINATION .) # Also install shared library (DLL) dependencies install(CODE [[ file(GET_RUNTIME_DEPENDENCIES @@ -94,7 +94,7 @@ if(ENABLE_SHARED_LIB) #message("UNRESOLVED_DEPENDENCIES_VAR: ${_u_deps}") ]]) else() - install(TARGETS freshclam DESTINATION ${CMAKE_INSTALL_LIBDIR}) + install(TARGETS freshclam DESTINATION lib) endif() add_library( ClamAV::libfreshclam ALIAS freshclam ) @@ -115,9 +115,9 @@ if(ENABLE_STATIC_LIB) VERSION ${LIBFRESHCLAM_VERSION} SOVERSION ${LIBFRESHCLAM_SOVERSION}) target_compile_definitions(freshclam_static PUBLIC freshclam_staticLIB) if(WIN32) - install(TARGETS freshclam_static DESTINATION ${CMAKE_INSTALL_PREFIX}) + install(TARGETS freshclam_static DESTINATION .) else() - install(TARGETS freshclam_static DESTINATION ${CMAKE_INSTALL_LIBDIR}) + install(TARGETS freshclam_static DESTINATION lib) endif() add_library( ClamAV::libfreshclam_static ALIAS freshclam_static ) diff --git a/sigtool/CMakeLists.txt b/sigtool/CMakeLists.txt index 42c21c5d3..50d773c67 100644 --- a/sigtool/CMakeLists.txt +++ b/sigtool/CMakeLists.txt @@ -30,7 +30,7 @@ target_link_libraries( sigtool ClamAV::libclamav ClamAV::shared ) if(WIN32) - install(TARGETS sigtool DESTINATION ${CMAKE_INSTALL_PREFIX}) + install(TARGETS sigtool DESTINATION .) else() - install(TARGETS sigtool DESTINATION ${CMAKE_INSTALL_BINDIR}) + install(TARGETS sigtool DESTINATION bin) endif() diff --git a/win32/wix_ui_banner.bmp b/win32/wix_ui_banner.bmp new file mode 100644 index 000000000..8dd113b77 Binary files /dev/null and b/win32/wix_ui_banner.bmp differ diff --git a/win32/wix_ui_dialog.bmp b/win32/wix_ui_dialog.bmp new file mode 100644 index 000000000..383ebfb13 Binary files /dev/null and b/win32/wix_ui_dialog.bmp differ