Skip to content

Commit

Permalink
adapt RH9 build to VCPKG
Browse files Browse the repository at this point in the history
  • Loading branch information
qrkourier committed Jun 8, 2023
1 parent d0c5eff commit 7ca2671
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 11 deletions.
15 changes: 13 additions & 2 deletions .github/actions/openziti-tunnel-build-action/redhat-9/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG CMAKE_VERSION="3.22.3"
ARG CMAKE_VERSION="3.26.3"

FROM rockylinux:9

Expand All @@ -15,7 +15,6 @@ ENV TZ=UTC

RUN dnf install -y \
"@Development Tools" \
cmake \
dnf-plugins-core \
iproute \
python3 \
Expand All @@ -30,12 +29,24 @@ RUN dnf install -y \
doxygen \
graphviz \
git \
ninja-build \
&& dnf clean all

RUN curl -sSfL https://cmake.org/files/v${CMAKE_VERSION%.*}/cmake-${CMAKE_VERSION}-linux-$(uname -m).sh -o cmake.sh \
&& (bash cmake.sh --skip-license --prefix=/usr/local) \
&& rm cmake.sh

ENV GIT_CONFIG_GLOBAL="/tmp/ziti-builder-gitconfig"

ENV VCPKG_ROOT=/usr/local/vcpkg
# this must be set on arm. see https://learn.microsoft.com/en-us/vcpkg/users/config-environment#vcpkg_force_system_binaries
ENV VCPKG_FORCE_SYSTEM_BINARIES=yes

RUN cd /usr/local \
&& git clone --branch 2023.04.15 https://github.com/microsoft/vcpkg \
&& ./vcpkg/bootstrap-vcpkg.sh -disableMetrics \
&& chmod -R ugo+rwX /usr/local/vcpkg

WORKDIR /github/workspace
COPY ./entrypoint.sh /root/
ENTRYPOINT [ "/root/entrypoint.sh" ]
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@ echo "INFO: GIT_DISCOVERY_ACROSS_FILESYSTEM=${GIT_DISCOVERY_ACROSS_FILESYSTEM}"
echo "INFO: WORKDIR=${PWD}"
echo "INFO: $(git --version)"

# if first positional is an expected arch string then set cmake preset,
# else use ci-linux-x64 (which actually just uses native/host tools - e.g. not cross compile)
if [ ${#} -ge 1 ]; then
cmake_preset="${1}"
else
cmake_preset="ci-linux-x64"
fi

if [ ${#} -ge 2 ]; then
cmake_config="${2}"
else
cmake_config="Release"
fi

# workspace dir for each build env is added to "safe" dirs in global config e.g.
# ~/.gitconfig so both runner and builder containers trust these dirs
# owned by different UIDs from that of Git's EUID. This is made necessary
Expand All @@ -22,23 +36,21 @@ for SAFE in \
git config --global --add safe.directory ${SAFE}
done

cmake -E make_directory ./build
(
[[ -d ./build ]] && rm -r ./build
cmake -E make_directory ./build
# allow unset for scl_source scripts
set +u
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=./toolchains/default.cmake \
--preset "${cmake_preset}" \
-DCMAKE_BUILD_TYPE="${cmake_config}" \
-DBUILD_DIST_PACKAGES=ON \
-DUSE_OPENSSL=ON \
-S . \
-B ./build
cmake \
--build ./build \
--config "${cmake_config}" \
--target package \
--verbose
)

if (( ${#} )); then
echo "INFO: running ziti-edge-tunnel"
set -x
./build/programs/ziti-edge-tunnel/ziti-edge-tunnel ${@}
fi

0 comments on commit 7ca2671

Please sign in to comment.