mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Changes for packaging
- Added 'dist' target to top-level Makefile for doing source packages - Added 'make-*-packages' scripts for generating binary packages - Fixes for the ConfigurePackaging CMake script - No longer fails when package version doesn't include a patch-level - Now considers the case when a package doesn't install any config files and the INSTALLED_CONFIG_FILES var is empty
This commit is contained in:
parent
8d4f487add
commit
1d8ad8e946
8 changed files with 185 additions and 23 deletions
8
INSTALL
8
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=<dir>
|
||||
|
||||
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
|
||||
|
|
49
Makefile
49
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
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit b1336188695fb900ac30c48164fea831c2aae2f4
|
||||
Subproject commit c2769d9cd826ecaa08431d6af329db75a7d43583
|
|
@ -1 +1 @@
|
|||
Subproject commit a6ebc3ee2fc986a62244e03a3d7c7162aa33838b
|
||||
Subproject commit 13986eb50729f45834eb050be4a6233c83f9295d
|
|
@ -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,9 +35,11 @@ macro(SetPackageVersion _version)
|
|||
${CPACK_PACKAGE_VERSION_MAJOR})
|
||||
string(REGEX REPLACE "[_a-zA-Z-]" "" CPACK_PACKAGE_VERSION_MINOR
|
||||
${CPACK_PACKAGE_VERSION_MINOR})
|
||||
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")
|
||||
# RPM version accepts letters, but not dashes.
|
||||
|
@ -43,9 +47,11 @@ macro(SetPackageVersion _version)
|
|||
${CPACK_PACKAGE_VERSION_MAJOR})
|
||||
string(REGEX REPLACE "[-]" "" CPACK_PACKAGE_VERSION_MINOR
|
||||
${CPACK_PACKAGE_VERSION_MINOR})
|
||||
if (CPACK_PACKAGE_VERSION_PATCH)
|
||||
string(REGEX REPLACE "[-]" "" CPACK_PACKAGE_VERSION_PATCH
|
||||
${CPACK_PACKAGE_VERSION_PATCH})
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Minimum supported OS X version
|
||||
set(CPACK_OSX_PACKAGE_VERSION 10.5)
|
||||
|
@ -143,6 +149,7 @@ endmacro(SetPackageMetadata)
|
|||
# See also: http://public.kitware.com/Bug/view.php?id=10294
|
||||
macro(SetPackageInstallScripts)
|
||||
|
||||
if (INSTALLED_CONFIG_FILES)
|
||||
# Remove duplicates from the list of installed config files
|
||||
separate_arguments(INSTALLED_CONFIG_FILES)
|
||||
list(REMOVE_DUPLICATES INSTALLED_CONFIG_FILES)
|
||||
|
@ -151,6 +158,7 @@ macro(SetPackageInstallScripts)
|
|||
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(
|
||||
|
|
4
configure
vendored
4
configure
vendored
|
@ -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
|
||||
;;
|
||||
|
|
67
make-mac-packages
Executable file
67
make-mac-packages
Executable file
|
@ -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 ../../..
|
42
make-rpm-packages
Executable file
42
make-rpm-packages
Executable file
|
@ -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 ../../..
|
Loading…
Add table
Add a link
Reference in a new issue