symlinking library headers for better portability
This commit is contained in:
parent
d04b700809
commit
55b9b9d4fa
28 changed files with 645 additions and 0 deletions
56
updatesymlinks.sh
Executable file
56
updatesymlinks.sh
Executable 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue