symlinking library headers for better portability

This commit is contained in:
kin fuyuki 2026-02-20 00:30:40 -03:00
commit 55b9b9d4fa
No known key found for this signature in database
GPG key ID: 0E4E8E519FB71401
28 changed files with 645 additions and 0 deletions

56
updatesymlinks.sh Executable file
View file

@ -0,0 +1,56 @@
#!/bin/bash
folders=("engine/src" "lib/raylib/include")
names=("enginend" "raylib")
outdir="include"
types=("h" "hpp")
mkdir -p "$outdir"
create_symlinks() {
local src="$1"
local outnam="$2"
local currout="$outdir/$outnam"
mkdir -p "$currout"
find "$src" -mindepth 1 -print0 | while IFS= read -r -d '' item; do
rl="${item#$src/}"
outpath="$currout/$rl"
mkdir -p "$(dirname "$outpath")"
if [ -f "$item" ]; then
nam=$(basename "$item")
ftype="${nam##*.}"
skip=true
for type in "${types[@]}"; do
if [ "$ftype" = "$type" ]; then
skip=false
break
fi
done
if [ "$skip" = false ]; then
ln -sf "$(realpath --relative-to="$(dirname "$outpath")" "$item")" "$outpath"
fi
elif [ -d "$item" ]; then
mkdir -p "$outpath"
fi
done
}
for i in "${!folders[@]}"; do
if [ $i -lt ${#names[@]} ]; then
src="${folders[$i]}"
outnam="${names[$i]}"
if [ -d "$src" ]; then
create_symlinks "$src" "$outnam"
echo
else
echo "'$src' not exist"
fi
fi
done