mirror of
https://github.com/Ed94/VEFontCache-Odin.git
synced 2025-08-06 06:52:44 -07:00
working on linux build scripts
This commit is contained in:
@@ -7,20 +7,19 @@ function clone-gitrepo { param( [string] $path, [string] $url )
|
||||
git clone $url $path
|
||||
}
|
||||
}
|
||||
|
||||
function Get-IniContent { param([ string]$filePath )
|
||||
function Get-IniContent { param( [string] $path_file )
|
||||
$ini = @{}
|
||||
$currentSection = $null
|
||||
switch -regex -file $filePath
|
||||
switch -regex -file $path_file
|
||||
{
|
||||
"^\[(.+)\]$" {
|
||||
$currentSection = $matches[1].Trim()
|
||||
$ini[$currentSection] = @{}
|
||||
$ini[ $currentSection ] = @{}
|
||||
}
|
||||
"^(.+?)\s*=\s*(.*)" {
|
||||
$key, $value = $matches[1].Trim(), $matches[2].Trim()
|
||||
if ($null -ne $currentSection) {
|
||||
$ini[$currentSection][$key] = $value
|
||||
$ini[ $currentSection ][ $key ] = $value
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,7 +38,6 @@ function Invoke-WithColorCodedOutput { param( [scriptblock] $command )
|
||||
Write-Host "`t$_" -ForegroundColor $color
|
||||
}
|
||||
}
|
||||
|
||||
function Update-GitRepo
|
||||
{
|
||||
param( [string] $path, [string] $url, [string] $build_command )
|
||||
|
111
scripts/helpers/misc.sh
Normal file
111
scripts/helpers/misc.sh
Normal 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
|
||||
}
|
65
scripts/helpers/odin_compiler_defs.sh
Normal file
65
scripts/helpers/odin_compiler_defs.sh
Normal file
@@ -0,0 +1,65 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Not meant to be used standalone
|
||||
|
||||
# Odin Compiler Flags
|
||||
|
||||
# For a breakdown of any flag, type <odin_compiler> <command> -help
|
||||
command_build='build'
|
||||
command_check='check'
|
||||
command_query='query'
|
||||
command_report='report'
|
||||
command_run='run'
|
||||
|
||||
flag_build_mode='-build-mode:'
|
||||
flag_build_mode_dll='-build-mode:dll'
|
||||
flag_collection='-collection:'
|
||||
flag_debug='-debug'
|
||||
flag_define='-define:'
|
||||
flag_default_allocator_nil='-default-to-nil-allocator'
|
||||
flag_disable_assert='-disable-assert'
|
||||
flag_dynamic_map_calls='-dynamic-map-calls'
|
||||
flag_extra_assembler_flags='-extra_assembler-flags:'
|
||||
flag_extra_linker_flags='-extra-linker-flags:'
|
||||
flag_ignore_unknown_attributes='-ignore-unknown-attributes'
|
||||
flag_keep_temp_files='-keep-temp-files'
|
||||
flag_max_error_count='-max-error-count:'
|
||||
flag_micro_architecture_native='-microarch:native'
|
||||
flag_no_bounds_check='-no-bounds-check'
|
||||
flag_no_crt='-no-crt'
|
||||
flag_no_entrypoint='-no-entry-point'
|
||||
flag_no_thread_local='-no-thread-local'
|
||||
flag_no_thread_checker='-no-threaded-checker'
|
||||
flag_output_path='-out='
|
||||
flag_optimization_level='-opt:'
|
||||
flag_optimize_none='-o:none'
|
||||
flag_optimize_minimal='-o:minimal'
|
||||
flag_optimize_size='-o:size'
|
||||
flag_optimize_speed='-o:speed'
|
||||
flag_optimize_aggressive='-o:aggressive'
|
||||
flag_pdb_name='-pdb-name:'
|
||||
flag_sanitize_address='-sanitize:address'
|
||||
flag_sanitize_memory='-sanitize:memory'
|
||||
flag_sanitize_thread='-sanitize:thread'
|
||||
flag_subsystem='-subsystem:'
|
||||
flag_show_timings='-show-timings'
|
||||
flag_show_more_timings='-show-more-timings'
|
||||
flag_show_system_calls='-show-system-calls'
|
||||
flag_target='-target:'
|
||||
flag_thread_count='-thread-count:'
|
||||
flag_use_lld='-lld'
|
||||
flag_use_separate_modules='-use-separate-modules'
|
||||
flag_vet_all='-vet'
|
||||
flag_vet_unused_entities='-vet-unused'
|
||||
flag_vet_semicolon='-vet-semicolon'
|
||||
flag_vet_shadow_vars='-vet-shadowing'
|
||||
flag_vet_using_stmt='-vet-using-stmt'
|
||||
|
||||
# flag_msvc_link_disable_dynamic_base='/DYNAMICBASE:NO'
|
||||
# flag_msvc_link_base_address='/BASE:'
|
||||
# flag_msvc_link_fixed_base_address='/FIXED'
|
||||
# flag_msvc_link_stack_size='/STACK'
|
||||
# flag_msvc_link_debug='/DEBUG'
|
||||
|
||||
# Assuming to be in default path, change if otherwise
|
||||
odin_compiler='odin'
|
Reference in New Issue
Block a user