Manually adding thirdparty libs

This commit is contained in:
2025-04-14 14:49:36 -04:00
parent 1bd2dc2333
commit 77f1466ae3
70 changed files with 60610 additions and 4 deletions

View File

@@ -0,0 +1,28 @@
if ($env:VCINSTALLDIR) {
return
}
$ErrorActionPreference = "Stop"
# Use vswhere to find the latest Visual Studio installation
$vswhere_out = & "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath
if ($null -eq $vswhere_out) {
Write-Host "ERROR: Visual Studio installation not found"
exit 1
}
# Find Launch-VsDevShell.ps1 in the Visual Studio installation
$vs_path = $vswhere_out
$vs_devshell = Join-Path $vs_path "\Common7\Tools\Launch-VsDevShell.ps1"
if ( -not (Test-Path $vs_devshell) ) {
Write-Host "ERROR: Launch-VsDevShell.ps1 not found in Visual Studio installation"
Write-Host Tested path: $vs_devshell
exit 1
}
# Launch the Visual Studio Developer Shell
Push-Location
write-host @args
& $vs_devshell @args
Pop-Location

View File

@@ -0,0 +1,72 @@
function Clone-Gitrepo { param( [string] $path, [string] $url )
if (test-path $path) {
# git -C $path pull
}
else {
Write-Host "Cloning $url ..."
git clone $url $path
}
}
function Grab-Zip { param( $url, $path_file, $path_dst )
Invoke-WebRequest -Uri $url -OutFile $path_file
Expand-Archive -Path $path_file -DestinationPath $path_dst -Force
}
function Update-GitRepo
{
param( [string] $path, [string] $url, [string] $build_command )
if ( $build_command -eq $null ) {
write-host "Attempted to call Update-GitRepo without build_command specified"
return
}
$repo_name = $url.Split('/')[-1].Replace('.git', '')
$last_built_commit = join-path $path_build "last_built_commit_$repo_name.txt"
if ( -not(test-path -Path $path))
{
write-host "Cloining repo from $url to $path"
git clone $url $path
write-host "Building $url"
push-location $path
& "$build_command"
pop-location
git -C $path rev-parse HEAD | out-file $last_built_commit
$script:binaries_dirty = $true
write-host
return
}
git -C $path fetch
$latest_commit_hash = git -C $path rev-parse '@{u}'
$last_built_hash = if (Test-Path $last_built_commit) { Get-Content $last_built_commit } else { "" }
if ( $latest_commit_hash -eq $last_built_hash ) {
write-host
return
}
write-host "Build out of date for: $path, updating"
write-host 'Pulling...'
git -C $path pull
write-host "Building $url"
push-location $path
& $build_command
pop-location
$latest_commit_hash | out-file $last_built_commit
$script:binaries_dirty = $true
write-host
}
function Verify-Path { param( $path )
if (test-path $path) {return $true}
new-item -ItemType Directory -Path $path
return $false
}

View File

@@ -0,0 +1,111 @@
#!/bin/bash
clone_gitrepo() {
local path="$1"
local url="$2"
if [ -d "$path" ]; then
# git -C "$path" pull
:
else
echo "Cloning $url ..."
git clone "$url" "$path"
fi
}
get_ini_content() {
local path_file="$1"
declare -A ini
local current_section=""
while IFS= read -r line; do
if [[ $line =~ ^\[(.+)\]$ ]]; then
current_section="${BASH_REMATCH[1]}"
ini["$current_section"]=""
elif [[ $line =~ ^([^=]+)=(.*)$ ]]; then
local key="${BASH_REMATCH[1]}"
local value="${BASH_REMATCH[2]}"
if [ -n "$current_section" ]; then
ini["$current_section,$key"]="$value"
fi
fi
done < "$path_file"
# To use this function, you would need to pass the result by reference
# and then access it in the calling function
}
invoke_with_color_coded_output() {
local command="$1"
eval "$command" 2>&1 | while IFS= read -r line; do
if [[ "$line" =~ [Ee]rror ]]; then
echo -e "\033[0;31m\t$line\033[0m" # Red for errors
elif [[ "$line" =~ [Ww]arning ]]; then
echo -e "\033[0;33m\t$line\033[0m" # Yellow for warnings
else
echo -e "\033[0;37m\t$line\033[0m" # White for other output
fi
done
}
update_git_repo() {
local path="$1"
local url="$2"
local build_command="$3"
if [ -z "$build_command" ]; then
echo "Attempted to call update_git_repo without build_command specified"
return
fi
local repo_name=$(basename "$url" .git)
local last_built_commit="$path_build/last_built_commit_$repo_name.txt"
if [ ! -d "$path" ]; then
echo "Cloning repo from $url to $path"
git clone "$url" "$path"
echo "Building $url"
pushd "$path" > /dev/null
eval "$build_command"
popd > /dev/null
git -C "$path" rev-parse HEAD > "$last_built_commit"
binaries_dirty=true
echo
return
fi
git -C "$path" fetch
local latest_commit_hash=$(git -C "$path" rev-parse '@{u}')
local last_built_hash=""
[ -f "$last_built_commit" ] && last_built_hash=$(cat "$last_built_commit")
if [ "$latest_commit_hash" = "$last_built_hash" ]; then
echo
return
fi
echo "Build out of date for: $path, updating"
echo 'Pulling...'
git -C "$path" pull
echo "Building $url"
pushd "$path" > /dev/null
eval "$build_command"
popd > /dev/null
echo "$latest_commit_hash" > "$last_built_commit"
binaries_dirty=true
echo
}
verify_path() {
local path="$1"
if [ -d "$path" ]; then
return 0
fi
mkdir -p "$path"
return 1
}