Skip to content

Commit

Permalink
Adobted build scripts for Debian12 and Ubuntu22 (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkSh1 authored Apr 1, 2024
1 parent d5307df commit 3dde175
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 10 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,18 @@ jobs:
for: linux
prepare: "debian-based"
build_on: linux
use_image: ghcr.io/owtech/foundationdb-build:7.4.0-1.ow.build
parallel: 2
parallel: 5
image: foundationdb-build:7.4.0-1.ow.build
owner: owtech

runs-on: ${{ matrix.run_on }}
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set building repo
run: |
echo "use_image=ghcr.io/${{matrix.owner}}/${{matrix.image}}" >> "$GITHUB_ENV"
- name: Build
run: |
Expand All @@ -68,7 +73,7 @@ jobs:
--security-opt label=disable \
--mount=type=bind,src=${{github.workspace}},dst=/home/runner/src,readonly \
--mount=type=bind,src=${{github.workspace}}/bld,dst=/home/runner/bld \
${{ matrix.use_image }} \
$use_image \
/home/runner/src/build-scripts/for-${{ matrix.for }}/build-on-${{ matrix.build_on }}.bash \
${{needs.calc_ver.outputs.project_ver}} \
${{needs.calc_ver.outputs.build_ver}} \
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/make-build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:

build-image:
needs: [calc_ver]
permissions: write-all

strategy:
matrix:
Expand Down Expand Up @@ -59,4 +60,4 @@ jobs:
run: echo "${{ secrets.GITHUB_TOKEN }}" | podman login ghcr.io -u $ --password-stdin

- name: Push image
run: podman push $IMAGE_NAME ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
run: podman push $IMAGE_NAME ghcr.io/${GITHUB_REPOSITORY_OWNER@L}/$IMAGE_NAME
22 changes: 20 additions & 2 deletions build-scripts/for-linux/build-on-linux.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@
# $4 - Paralllel threads
# $5 - Source Dir. If not set then relative to the script dir

#!/bin/bash

get_oldest_java_path()
{
if [ -x "$(command -v update-java-alternatives)" ]
then
update-java-alternatives -l | sort -Vk1 | head -n 1 | awk '{print $3}'
else
echo 'update-java-alternatives is not installed' >&2
ls -d /etc/alternatives/java_sdk_*[0-9] | sort -V | head -n 1
fi
}

set -e

BASE_DIR="$(readlink -f $(dirname $0))"
Expand Down Expand Up @@ -38,8 +51,13 @@ APP_PRMS="\
# find swift
APP_PRMS="$APP_PRMS -DCMAKE_Swift_COMPILER=`$BASE_DIR/find-swift.bash`"

echo "env CC=clang CXX=clang++ cmake -G Ninja $APP_PRMS . $SRC_DIR"
env CC=clang CXX=clang++ cmake -G Ninja $APP_PRMS . $SRC_DIR
# set oldest java
JAVA_OLDEST_PATH=$(get_oldest_java_path)

echo "env JAVA_HOME=$JAVA_OLDEST_PATH CC=clang CXX=clang++ cmake -G Ninja $APP_PRMS $SRC_DIR"
env JAVA_HOME=$JAVA_OLDEST_PATH CC=clang CXX=clang++ cmake -G Ninja $APP_PRMS $SRC_DIR

echo "number of parallel jobs: [$PARALLEL_PRMS]"

ninja $PARALLEL_PRMS -k 0

Expand Down
11 changes: 9 additions & 2 deletions build-scripts/for-linux/prepare-debian-based-clang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@
set -e

sudo apt update

# clang no more than 14 version is needed for boost-5.3 building
max_clang_version=14

RECENT_VERSION=` \
apt search -o APT::Cache::Search::Version=1 '^clang-[0-9]+$' \
| tr - ' ' | awk '{print $2;}' | sort -n | tail -n 1`
apt-cache search -o APT::Cache::Search::Version=1 '^clang-[0-9]+$' | \
tr - ' ' | \
awk -v ver="$max_clang_version" '{if($2<=ver) print $2;}' | \
sort -n | \
tail -n 1`

sudo DEBIAN_FRONTEND=noninteractive apt install -y \
clang-$RECENT_VERSION libc++-$RECENT_VERSION-dev libc++abi-$RECENT_VERSION-dev
Expand Down
2 changes: 1 addition & 1 deletion build-scripts/for-linux/prepare-debian-based-jdk.bash
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set -e
sudo apt update

find_pkg() {
apt search -o APT::Cache::Search::Version=1 "^$1\$" | awk '{print $1;}'
apt-cache search -o APT::Cache::Search::Version=1 "^$1\$" | awk '{print $1;}'
}

PKG_AV=""
Expand Down
6 changes: 5 additions & 1 deletion build-scripts/for-linux/prepare-debian-based.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ BASE_DIR=`dirname $0`

sudo apt update

# wget is required to download cmake 3.24 if you are using Debian 12 to build.
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y wget

$BASE_DIR/prepare-debian-based-cmake.bash 3.24
$BASE_DIR/prepare-debian-based-clang.sh
$BASE_DIR/prepare-debian-based-jdk.bash
Expand Down Expand Up @@ -38,4 +41,5 @@ sudo DEBIAN_FRONTEND=noninteractive apt-get install -y \
libmono-system-runtime-serialization4.0-cil \
libmono-system-xml-linq4.0-cil

sudo pip3 install sphinx-bootstrap-theme
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y \
python3-sphinx-bootstrap-theme

0 comments on commit 3dde175

Please sign in to comment.