Skip to content

Commit 4846da6

Browse files
Merge pull request #5912 from craigcomstock/ENT-13016/master
Added helper scripts for platform package dependencies, build and install
2 parents c8c9c39 + a9842a2 commit 4846da6

File tree

3 files changed

+80
-0
lines changed

3 files changed

+80
-0
lines changed

ci/build.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
# build.sh runs autogen/configure and then builds CFEngine core
3+
# the script should take into account the operating system environment and adjust, such as --without-pam on termux, BSDs and such
4+
set -ex
5+
thisdir="$(dirname "$0")"
6+
cd "$thisdir"/..
7+
OPTS="--enable-debug"
8+
9+
if [ -n "$TERMUX_VERSION" ]; then
10+
OPTS="$OPTS --without-pam"
11+
fi
12+
13+
./autogen.sh $OPTS
14+
make

ci/dependencies.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/usr/bin/env bash
2+
# dependencies.sh is called by install.sh to install libraries and packages needed to build and install CFEngine from source.
3+
set -ex
4+
# limited support here, focused on rhel-like on aarch64 which has no previous CFEngine version to leverage: ENT-13016
5+
if [ -f /etc/os-release ]; then
6+
source /etc/os-release
7+
VERSION_MAJOR=${VERSION_ID%.*}
8+
if [ "$ID" = "rhel" ] || [[ "$ID_LIKE" =~ "rhel" ]]; then
9+
if [ "$VERSION_MAJOR" -ge "10" ]; then
10+
# note that having a redhat subscription makes things easier: lmdb-devel and librsync-devel are available from codeready-builder repo
11+
if subscription-manager status; then
12+
sudo subscription-manager config --rhsm.manage_repos=1
13+
sudo subscription-manager repos --enable codeready-builder-for-rhel-"$VERSION_MAJOR"-"$(uname -m)"-rpms
14+
sudo dnf install --assumeyes https://dl.fedoraproject.org/pub/epel/epel-release-latest-"$VERSION_MAJOR".noarch.rpm
15+
sudo dnf install --assumeyes flex-devel lmdb-devel librsync-devel fakeroot # only available via subscription with codeready-builder installed
16+
# flex-devel, libyaml-devel and fakeroot are also only available easily from codeready-builder but are not critical to building CFEngine usable enough to configure a build host.
17+
# fakeroot is only needed for running tests but can be worked around by using GAINROOT=env with tests/acceptance/testall script
18+
else
19+
# here we assume no subscription and so must build those two dependencies from source :)
20+
sudo yum groups install -y 'Development Tools'
21+
sudo yum update --assumeyes
22+
sudo yum install -y gcc gdb make git libtool autoconf automake byacc flex openssl-devel pcre2-devel pam-devel libxml2-devel
23+
tmpdir="$(mktemp -d)"
24+
echo "Building lmdb and librsync in $tmpdir"
25+
(
26+
cd "$tmpdir"
27+
git clone --recursive --depth 1 https://github.com/LMDB/lmdb
28+
cd lmdb/libraries/liblmdb
29+
make
30+
sudo make install prefix=/usr
31+
cd -
32+
sudo dnf install -y cmake
33+
git clone --recursive --depth 1 https://github.com/librsync/librsync
34+
cd librsync
35+
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release .
36+
make
37+
sudo make install
38+
)
39+
fi
40+
else
41+
echo "Unsupported version of redhat for $0"
42+
exit 1
43+
fi
44+
else
45+
echo "Unsupported distribution based on /etc/os-release."
46+
fi
47+
elif [ -n "$TERMUX_VERSION" ]; then
48+
pkg install build-essential git autoconf automake bison flex liblmdb openssl pcre2 libacl libyaml
49+
else
50+
echo "Unsupported operating system for $0"
51+
exit 1
52+
fi
53+

ci/install.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
# install.sh ensures dependencies are installed, builds core, then installs it
3+
set -ex
4+
thisdir=$(dirname $0)
5+
"$thisdir"/dependencies.sh
6+
"$thisdir"/build.sh
7+
cd "$thisdir"/..
8+
GAINROOT=""
9+
if [ ! -n "$TERMUX_VERSION" ]; then
10+
GAINROOT="sudo"
11+
fi
12+
13+
$GAINROOT make install

0 commit comments

Comments
 (0)