diff --git a/INSTALL b/INSTALL index c8e08b3000..7692d27966 100644 --- a/INSTALL +++ b/INSTALL @@ -70,12 +70,18 @@ build/, using default build options. It then installs the Bro binary into /usr/local/bro/bin. Depending on the Bro package you downloaded, there may be auxiliary tools and libraries available in the aux/ directory. If so, they will be installed by default as well -if not explicitly disabled via configure options. +if not explicitly disabled via configure options and may also have +additional installation/configuration instructions that you can +find in their source directories. You can specify a different installation directory with > ./configure --prefix= +Note that "/usr" and "/opt/bro" are standard prefixes for binary +packages to be installed, so those are typically not good choices +unless you are creating such a package. + Run "./configure --help" for more options. Running Bro diff --git a/Makefile b/Makefile index 10f64df310..8bf528dd26 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,14 @@ # BUILD=build +BROCCOLI=aux/broccoli +BROCTL=aux/broctl + +# CMake/CPack versions before 2.8.2 have bugs that can create bad packages +CMAKE_PACK_REQ=2.8.2 +CMAKE_VER=`cmake -version` + +OSX_VER_CMD=sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2 all: configured ( cd $(BUILD) && make ) @@ -16,13 +24,48 @@ install: configured clean: configured ( cd $(BUILD) && make clean ) -dist: configured - ( cd $(BUILD) && make package_source ) +dist: cmake_version + # Minimum Bro source package + ( \ + ./configure --ignore-dirs='aux/broctl;aux/broccoli' --pkg-name-prefix=Bro && \ + cd $(BUILD) && \ + make package_source \ + ) + # Full Bro source package + ( \ + ./configure --pkg-name-prefix=Bro-all && \ + cd $(BUILD) && \ + make package_source \ + ) + # Broccoli source package + ( \ + cd $(BROCCOLI) && \ + ./configure && \ + cd $(BUILD) && \ + make package_source && \ + mv Broccoli*.tar.gz ../../../$(BUILD)/ && \ + cd .. && \ + rm -r $(BUILD) \ + ) + # Broctl source package + ( \ + cd $(BROCTL) && \ + ./configure && \ + cd $(BUILD) && \ + make package_source && \ + mv Broctl*.tar.gz ../../../$(BUILD)/ && \ + cd .. && \ + rm -r $(BUILD) \ + ) distclean: rm -rf $(BUILD) -.PHONY : configured configured: @test -d $(BUILD) || ( echo "Error: No build/ directory found. Did you run configure?" && exit 1 ) @test -e $(BUILD)/Makefile || ( echo "Error: No build/Makefile found. Did you run configure?" && exit 1 ) + +cmake_version: + @test "$(CMAKE_VER)" \> "cmake version $(CMAKE_PACK_REQ)" || ( echo "Error: please use a CMake version greater than $(CMAKE_PACK_REQ)" && exit 1 ) + +.PHONY : all install clean distclean configured cmake_version diff --git a/aux/broccoli b/aux/broccoli index b133618869..c2769d9cd8 160000 --- a/aux/broccoli +++ b/aux/broccoli @@ -1 +1 @@ -Subproject commit b1336188695fb900ac30c48164fea831c2aae2f4 +Subproject commit c2769d9cd826ecaa08431d6af329db75a7d43583 diff --git a/aux/broctl b/aux/broctl index a6ebc3ee2f..13986eb507 160000 --- a/aux/broctl +++ b/aux/broctl @@ -1 +1 @@ -Subproject commit a6ebc3ee2fc986a62244e03a3d7c7162aa33838b +Subproject commit 13986eb50729f45834eb050be4a6233c83f9295d diff --git a/cmake/ConfigurePackaging.cmake b/cmake/ConfigurePackaging.cmake index 3cbc7cba0c..51f1c04d96 100644 --- a/cmake/ConfigurePackaging.cmake +++ b/cmake/ConfigurePackaging.cmake @@ -4,7 +4,9 @@ # Sets CPack version variables by splitting the first macro argument # using "." as a delimiter. If the length of the split list is # greater than 2, all remaining elements are tacked on to the patch -# level version. +# level version. Not that the version set by the macro is internal +# to binary packaging, the file name of our package will reflect the +# exact version number. macro(SetPackageVersion _version) string(REPLACE "." " " version_numbers ${_version}) separate_arguments(version_numbers) @@ -33,8 +35,10 @@ macro(SetPackageVersion _version) ${CPACK_PACKAGE_VERSION_MAJOR}) string(REGEX REPLACE "[_a-zA-Z-]" "" CPACK_PACKAGE_VERSION_MINOR ${CPACK_PACKAGE_VERSION_MINOR}) - string(REGEX REPLACE "[_a-zA-Z-]" "" CPACK_PACKAGE_VERSION_PATCH - ${CPACK_PACKAGE_VERSION_PATCH}) + if (CPACK_PACKAGE_VERSION_PATCH) + string(REGEX REPLACE "[_a-zA-Z-]" "" CPACK_PACKAGE_VERSION_PATCH + ${CPACK_PACKAGE_VERSION_PATCH}) + endif () endif () if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") @@ -43,8 +47,10 @@ macro(SetPackageVersion _version) ${CPACK_PACKAGE_VERSION_MAJOR}) string(REGEX REPLACE "[-]" "" CPACK_PACKAGE_VERSION_MINOR ${CPACK_PACKAGE_VERSION_MINOR}) - string(REGEX REPLACE "[-]" "" CPACK_PACKAGE_VERSION_PATCH - ${CPACK_PACKAGE_VERSION_PATCH}) + if (CPACK_PACKAGE_VERSION_PATCH) + string(REGEX REPLACE "[-]" "" CPACK_PACKAGE_VERSION_PATCH + ${CPACK_PACKAGE_VERSION_PATCH}) + endif () endif () # Minimum supported OS X version @@ -143,14 +149,16 @@ endmacro(SetPackageMetadata) # See also: http://public.kitware.com/Bug/view.php?id=10294 macro(SetPackageInstallScripts) - # Remove duplicates from the list of installed config files - separate_arguments(INSTALLED_CONFIG_FILES) - list(REMOVE_DUPLICATES INSTALLED_CONFIG_FILES) - # Space delimit the list again - foreach (_file ${INSTALLED_CONFIG_FILES}) - set(_tmp "${_tmp} ${_file}") - endforeach () - set(INSTALLED_CONFIG_FILES "${_tmp}" CACHE STRING "" FORCE) + if (INSTALLED_CONFIG_FILES) + # Remove duplicates from the list of installed config files + separate_arguments(INSTALLED_CONFIG_FILES) + list(REMOVE_DUPLICATES INSTALLED_CONFIG_FILES) + # Space delimit the list again + foreach (_file ${INSTALLED_CONFIG_FILES}) + set(_tmp "${_tmp} ${_file}") + endforeach () + set(INSTALLED_CONFIG_FILES "${_tmp}" CACHE STRING "" FORCE) + endif () if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/cmake/package_preinstall.sh.in) configure_file( diff --git a/configure b/configure index 18094abfa1..dce70e6534 100755 --- a/configure +++ b/configure @@ -45,7 +45,6 @@ Usage: $0 [OPTION]... [VAR=VALUE]... --with-perftools=PATH path to Google Perftools install root Packaging Options (for developers): - --package toggles special build logic for binary packaging --ignore-dirs=PATHS paths to ignore when creating source package (semicolon delimited and quoted when multiple) --pkg-name-prefix=NAME use the given name as the package prefix instead @@ -165,9 +164,6 @@ while [ $# -ne 0 ]; do --with-perftools=*) append_cache_entry GooglePerftools_ROOT_DIR PATH $optarg ;; - --package) - append_cache_entry PACKAGING_MODE BOOL true - ;; --ignore-dirs=*) append_cache_entry CPACK_SOURCE_IGNORE_FILES STRING $optarg ;; diff --git a/make-mac-packages b/make-mac-packages new file mode 100755 index 0000000000..713d8d3311 --- /dev/null +++ b/make-mac-packages @@ -0,0 +1,67 @@ +#!/bin/sh + +# This script creates binary packages for Mac OS X. +# They can be found in build/ after running. + +# CMake/CPack versions before 2.8.2 have bugs that can create bad packages +CMAKE_PACK_REQ=2.8.3 +CMAKE_VER=`cmake -version` + +if [ "${CMAKE_VER}" \< "${CMAKE_PACK_REQ}" ]; then + echo "Package creation requires CMake > 2.8.2" >&2 + exit 1 +fi + +type sw_vers > /dev/null 2>&1 || { + echo "Unable to get Mac OS X version" >&2; + exit 1; +} + +# Get the OS X minor version +# 5 = Leopard, 6 = Snow Leopard, 7 = Lion ... +osx_ver=`sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2` + +if [ ${osx_ver} -lt 5 ]; then + echo "Packages for OS X < 10.5 are not supported" >&2 + exit 1 +elif [ ${osx_ver} -eq 5 ]; then + # On OS X 10.5, the x86_64 version of libresolv is broken, + # so we build for i386 as the easiest solution + arch=i386 +else + # Currently it's just easiest to build the 10.5 package on + # on 10.5, but if it weren't for the libresolv issue, we could + # potentially build packages for older OS X version by using the + # --osx-sysroot and --osx-min-version options + arch=x86_64 +fi + +# Minimum Bro +CMAKE_OSX_ARCHITECTURES=${arch} ./configure --prefix=/opt/bro \ + --disable-broccoli --disable-broctl --pkg-name-prefix=Bro +cd build +make package +cd .. + +# Full Bro package +CMAKE_OSX_ARCHITECTURES=${arch} ./configure --prefix=/opt/bro \ + --pkg-name-prefix=Bro-all +cd build +make package +cd .. + +# Broccoli +cd aux/broccoli +CMAKE_OSX_ARCHITECTURES=${arch} ./configure --prefix=/opt/bro +cd build +make package +mv Broccoli*.dmg ../../../build/ +cd ../../.. + +# Broctl +cd aux/broctl +CMAKE_OSX_ARCHITECTURES=${arch} ./configure --prefix=/opt/bro +cd build +make package +mv Broctl*.dmg ../../../build/ +cd ../../.. diff --git a/make-rpm-packages b/make-rpm-packages new file mode 100755 index 0000000000..bbd797b8e2 --- /dev/null +++ b/make-rpm-packages @@ -0,0 +1,42 @@ +#!/bin/sh + +# This script generates binary RPM packages. +# They can be found in build/ after running. + +# CMake/CPack versions before 2.8.2 have bugs that can create bad packages +CMAKE_PACK_REQ=2.8.2 +CMAKE_VER=`cmake -version` + +if [ "${CMAKE_VER}" \< "${CMAKE_PACK_REQ}" ]; then + echo "Package creation requires CMake > 2.8.2" >&2 + exit 1 +fi + +# Minimum Bro +./configure --prefix=/opt/bro --disable-broccoli --disable-broctl \ + --pkg-name-prefix=Bro +cd build +make package +cd .. + +# Full Bro package +./configure --prefix=/opt/bro --pkg-name-prefix=Bro-all +cd build +make package +cd .. + +# Broccoli +cd aux/broccoli +./configure --prefix=/opt/bro +cd build +make package +mv Broccoli*.rpm ../../../build/ +cd ../../.. + +# Broctl +cd aux/broctl +./configure --prefix=/opt/bro +cd build +make package +mv Broctl*.rpm ../../../build/ +cd ../../..