mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
Meta+Toolchain+CI: Add a script to bootstrap vcpkg
And hook it into ladybird.sh for convenience. The script will set up PATH and other environment variables automatically. On CI, vcpkg is theoretically already installed on Linux machines, but not with the right environment variables, and not on macOS. So this also makes CI use this script to bootstrap vcpkg.
This commit is contained in:
parent
be9fe23835
commit
b36ab480bf
Notes:
sideshowbarker
2024-07-16 22:26:05 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/b36ab480bf Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/45 Reviewed-by: https://github.com/ADKaster ✅
6 changed files with 50 additions and 1 deletions
4
.github/actions/setup/action.yml
vendored
4
.github/actions/setup/action.yml
vendored
|
@ -60,3 +60,7 @@ runs:
|
|||
set -e
|
||||
brew update
|
||||
brew install coreutils bash ninja wabt ccache unzip qt llvm@18
|
||||
|
||||
- name: 'Install vcpkg'
|
||||
shell: bash
|
||||
run: ./Toolchain/BuildVcpkg.sh
|
||||
|
|
1
.github/workflows/lagom-template.yml
vendored
1
.github/workflows/lagom-template.yml
vendored
|
@ -22,6 +22,7 @@ env:
|
|||
# github.workspace = /home/runner/work/serenity/serenity
|
||||
LADYBIRD_SOURCE_DIR: ${{ github.workspace }}
|
||||
CCACHE_DIR: ${{ github.workspace }}/.ccache
|
||||
VCPKG_ROOT: ${{ github.workspace }}/Toolchain/Tarballs/vcpkg
|
||||
|
||||
jobs:
|
||||
CI:
|
||||
|
|
1
.github/workflows/nightly-android.yml
vendored
1
.github/workflows/nightly-android.yml
vendored
|
@ -10,6 +10,7 @@ env:
|
|||
# github.workspace = /home/runner/work/serenity/serenity
|
||||
LADYBIRD_SOURCE_DIR: ${{ github.workspace }}
|
||||
CCACHE_DIR: ${{ github.workspace }}/.ccache
|
||||
VCPKG_ROOT: ${{ github.workspace }}/Toolchain/Tarballs/vcpkg
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || format('{0}-{1}', github.ref, github.run_number) }}
|
||||
|
|
1
.github/workflows/serenity-js-artifacts.yml
vendored
1
.github/workflows/serenity-js-artifacts.yml
vendored
|
@ -5,6 +5,7 @@ on: [push]
|
|||
env:
|
||||
LADYBIRD_SOURCE_DIR: ${{ github.workspace }}
|
||||
SERENITY_CCACHE_DIR: ${{ github.workspace }}/.ccache
|
||||
VCPKG_ROOT: ${{ github.workspace }}/Toolchain/Tarballs/vcpkg
|
||||
|
||||
jobs:
|
||||
build-and-package:
|
||||
|
|
|
@ -83,7 +83,9 @@ cmd_with_target() {
|
|||
BUILD_DIR="$LADYBIRD_SOURCE_DIR/Build/ladybird"
|
||||
CMAKE_ARGS+=("-DCMAKE_INSTALL_PREFIX=$LADYBIRD_SOURCE_DIR/Build/lagom-install")
|
||||
CMAKE_ARGS+=("-DSERENITY_CACHE_DIR=${LADYBIRD_SOURCE_DIR}/Build/caches")
|
||||
export PATH="$LADYBIRD_SOURCE_DIR/Toolchain/Local/cmake/bin":$PATH
|
||||
|
||||
export PATH="$LADYBIRD_SOURCE_DIR/Toolchain/Local/cmake/bin:$LADYBIRD_SOURCE_DIR/Toolchain/Local/vcpkg/bin:$PATH"
|
||||
export VCPKG_ROOT="$LADYBIRD_SOURCE_DIR/Toolchain/Tarballs/vcpkg"
|
||||
}
|
||||
|
||||
ensure_target() {
|
||||
|
@ -124,10 +126,20 @@ build_cmake() {
|
|||
( cd "$LADYBIRD_SOURCE_DIR/Toolchain" && ./BuildCMake.sh )
|
||||
}
|
||||
|
||||
build_vcpkg() {
|
||||
echo "Building vcpkg"
|
||||
( cd "$LADYBIRD_SOURCE_DIR/Toolchain" && ./BuildVcpkg.sh )
|
||||
}
|
||||
|
||||
ensure_toolchain() {
|
||||
if [ "$(cmake -P "$LADYBIRD_SOURCE_DIR"/Meta/CMake/cmake-version.cmake)" -ne 1 ]; then
|
||||
build_cmake
|
||||
fi
|
||||
|
||||
# FIXME: Add a version check if needed.
|
||||
if [ ! -x "${LADYBIRD_SOURCE_DIR}/Toolchain/Local/vcpkg/bin/vcpkg" ]; then
|
||||
build_vcpkg
|
||||
fi
|
||||
}
|
||||
|
||||
run_gdb() {
|
||||
|
@ -179,6 +191,7 @@ build_and_run_lagom_target() {
|
|||
if [[ "$CMD" =~ ^(build|install|run|gdb|test|rebuild|recreate|addr2line)$ ]]; then
|
||||
cmd_with_target
|
||||
[[ "$CMD" != "recreate" && "$CMD" != "rebuild" ]] || delete_target
|
||||
ensure_toolchain
|
||||
ensure_target
|
||||
case "$CMD" in
|
||||
build)
|
||||
|
|
29
Toolchain/BuildVcpkg.sh
Executable file
29
Toolchain/BuildVcpkg.sh
Executable file
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# This script builds the vcpkg dependency management system
|
||||
set -e
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
. "${DIR}/../Meta/shell_include.sh"
|
||||
|
||||
exit_if_running_as_root "Do not run BuildVcpkg.sh as root, parts of your Toolchain directory will become root-owned"
|
||||
|
||||
GIT_REPO="https://github.com/microsoft/vcpkg.git"
|
||||
GIT_REV="01f602195983451bc83e72f4214af2cbc495aa94" # 2024.05.24
|
||||
PREFIX_DIR="$DIR/Local/vcpkg"
|
||||
|
||||
mkdir -p "$DIR/Tarballs"
|
||||
pushd "$DIR/Tarballs"
|
||||
[ ! -d vcpkg ] && git clone $GIT_REPO
|
||||
|
||||
cd vcpkg
|
||||
git fetch origin
|
||||
git checkout $GIT_REV
|
||||
|
||||
./bootstrap-vcpkg.sh -disableMetrics
|
||||
|
||||
mkdir -p "$PREFIX_DIR/bin"
|
||||
cp vcpkg "$PREFIX_DIR/bin"
|
||||
popd
|
Loading…
Reference in a new issue