Repository navigation
ENT-14716: Fixed building core from source on RHEL 8 and 9 in ci scripts #6472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
aleksandrychev
wants to merge
1
commit into
cfengine:master
from
aleksandrychev:ENT-14716_rhel8_9_source_build
+55
−1
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,12 @@ build_lmdb() { | |
| git clone --recursive --depth 1 https://github.com/LMDB/lmdb | ||
| cd lmdb/libraries/liblmdb | ||
| make | ||
| $GAINROOT make install prefix=/usr | ||
| # lmdb's Makefile defaults to /usr/lib which is not in the runtime linker path on lib64 distributions (rhel, suse) | ||
| libdir=/usr/lib | ||
| if [ -d /usr/lib64 ]; then | ||
| libdir=/usr/lib64 | ||
| fi | ||
| $GAINROOT make install prefix=/usr libdir="$libdir" | ||
| ) | ||
| } | ||
|
|
||
|
|
@@ -40,6 +45,49 @@ build_librsync() { | |
| ) | ||
| } | ||
|
|
||
| # Build pcre2 into /opt/pcre2, away from the system pcre2, and ci/configure.sh will use it from there. | ||
| # Use the same pcre2 release and checksum as the CFEngine packages, from buildscripts deps-packaging. | ||
| build_pcre2() { | ||
| if [ -f /opt/pcre2/include/pcre2.h ]; then | ||
| echo pcre2 already installed in /opt/pcre2, no-op. | ||
| return | ||
| fi | ||
| deps_url=https://raw.githubusercontent.com/cfengine/buildscripts/master/deps-packaging/pcre2 | ||
| tmpdir="$(mktemp -d)" | ||
| echo building pcre2 in "$tmpdir" | ||
| ( | ||
| cd "$tmpdir" | ||
| curl --fail --location --silent --show-error --output source "$deps_url"/source | ||
| curl --fail --location --silent --show-error --output distfiles "$deps_url"/distfiles | ||
| tarball="$(awk '{print $2}' distfiles)" | ||
| curl --fail --location --silent --show-error --output "$tarball" "$(cat source)$tarball" | ||
| sha256sum --check distfiles | ||
| tar --extract --gzip --file "$tarball" | ||
| cd "${tarball%.tar.gz}" | ||
| ./configure --prefix=/opt/pcre2 --libdir=/opt/pcre2/lib | ||
| make | ||
| $GAINROOT make install | ||
| ) | ||
| } | ||
|
|
||
| # libntech's configure.ac lists the pcre2 declarations it needs (AC_CHECK_DECLS([PCRE2_...])). | ||
| # Build a newer pcre2 when the system one lacks any of them (rhel-8 has 10.32). | ||
| ensure_pcre2() { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think any "guard" code should live in buildscripts/ci/setup-cfengine-build-host.sh and not here. Here in core/ci/dependencies.sh we should just let things roll and fail if they will. |
||
| decls="$(sed -n 's/^ *AC_CHECK_DECLS(\[\(PCRE2_[^]]*\)\].*/\1/p' "$(dirname "$0")"/../libntech/configure.ac | tr ',' ' ')" | ||
| if [ -z "$decls" ]; then | ||
| echo "AC_CHECK_DECLS([PCRE2_...]) not found in libntech/configure.ac" | ||
| exit 1 | ||
| fi | ||
| system_macros="$(printf '#define PCRE2_CODE_UNIT_WIDTH 8\n#include <pcre2.h>\n' | gcc -E -dM -)" | ||
| for decl in $decls; do | ||
| if ! echo "$system_macros" | grep --quiet --word-regexp "#define $decl"; then | ||
| echo "system pcre2 $(pcre2-config --version) lacks $decl required by libntech" | ||
| build_pcre2 | ||
| return | ||
| fi | ||
| done | ||
| } | ||
|
|
||
| # limited support here, focused on rhel-like on aarch64 which has no previous CFEngine version to leverage: ENT-13016 | ||
| if [ -f /etc/os-release ]; then | ||
| source /etc/os-release | ||
|
|
@@ -68,6 +116,7 @@ if [ -f /etc/os-release ]; then | |
| build_lmdb | ||
| build_librsync | ||
| fi | ||
| ensure_pcre2 | ||
| else | ||
| echo "Unsupported version of redhat for $0" | ||
| exit 1 | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If libntech needs a particular version of pcre2 then libntech should specify that and we should use that specification here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should just move this to buildscripts/ci/setup-cfengine-build-host.sh so we have the version there if we need to use it.