forked from LadybirdBrowser/ladybird
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Meta: Add a vcpkg cache to the devcontainer
This also means that the prebuilt devcontainer will have a populated vcpkg binary cache, speeding up the first build by a lot.
- Loading branch information
Showing
4 changed files
with
76 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
27 changes: 27 additions & 0 deletions
27
.devcontainer/features/vcpkg-cache/devcontainer-feature.json
This file contains 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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"name": "Caches Ladybird's vcpkg dependencies", | ||
"id": "vcpkg-cache", | ||
"version": "1.0.0", | ||
"description": "Create a prebuilt vcpkg binary cache for Ladybird developer use", | ||
"installsAfter": [ "./features/ladybird" ], | ||
"containerEnv": { | ||
"VCPKG_BINARY_SOURCES": ";files,/usr/local/share/vcpkg-binary-cache,read" | ||
}, | ||
"options": { | ||
"release_triplet": { | ||
"type": "boolean", | ||
"default": true, | ||
"description": "Build vcpkg dependencies with release configuration" | ||
}, | ||
"debug_triplet": { | ||
"type": "boolean", | ||
"default": false, | ||
"description": "Build vcpkg dependencies with debug configuration" | ||
}, | ||
"sanitizer_triplet": { | ||
"type": "boolean", | ||
"default": false, | ||
"description": "Build vcpkg dependencies with sanitizer configuration" | ||
} | ||
} | ||
} |
This file contains 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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/sh | ||
# Prebuild ladybird's vcpkg dependencies | ||
set -e | ||
|
||
# FIXME: Add some options to make this more flexible and usable by other projects | ||
# FIXME: Find a way to do this without cloning ladybird | ||
|
||
cd /tmp | ||
|
||
CACHE_DIR=/usr/local/share/vcpkg-binary-cache | ||
mkdir -p ${CACHE_DIR} | ||
|
||
# Clone ladybird to get access to vcpkg.json and vcpkg commit id | ||
git clone https://github.com/LadybirdBrowser/ladybird.git --depth 1 | ||
cd ladybird | ||
# Grab and bootstrap the exact commit of vcpkg that trunk is using | ||
python3 ./Toolchain/BuildVcpkg.py | ||
|
||
# Install the vcpkg.json in manifest mode from the root of the repo | ||
# Set the binary cache directory to the one we intend to use at container runtime | ||
export VCPKG_ROOT="${PWD}/Toolchain/Tarballs/vcpkg" | ||
export VCPKG_BINARY_SOURCES="clear;files,${CACHE_DIR},readwrite" | ||
|
||
# Check options to see which versions we should build | ||
if [ "${RELEASE_TRIPLET}" = "true" ]; then | ||
./Toolchain/Local/vcpkg/bin/vcpkg install --overlay-triplets="${PWD}/Meta/CMake/vcpkg/release-triplets" | ||
fi | ||
|
||
if [ "${DEBUG_TRIPLET}" = "true" ]; then | ||
./Toolchain/Local/vcpkg/bin/vcpkg install --overlay-triplets="${PWD}/Meta/CMake/vcpkg/debug-triplets" | ||
fi | ||
|
||
if [ "${SANITIZER_TRIPLET}" = "true" ]; then | ||
./Toolchain/Local/vcpkg/bin/vcpkg install --overlay-triplets="${PWD}/Meta/CMake/vcpkg/sanitizer-triplets" | ||
fi | ||
|
||
# Clean up to reduce layer size | ||
cd /tmp | ||
rm -rf ladybird |
This file contains 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