152 lines
2.4 KiB
Bash
Executable File
152 lines
2.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Parse args
|
|
TARGET=""
|
|
PACKAGE_FILE=""
|
|
while [ $# -gt 0 ]; do
|
|
case "$1" in
|
|
-f)
|
|
PACKAGE_FILE=$2
|
|
shift 2
|
|
;;
|
|
--)
|
|
shift
|
|
break
|
|
;;
|
|
-*)
|
|
echo "Usage: $0 [-f package-file] <target-directory-name>"
|
|
exit 1
|
|
;;
|
|
*)
|
|
if [ -z "$TARGET" ]; then
|
|
TARGET=$1
|
|
shift
|
|
else
|
|
echo "Unexpected argument: $1"
|
|
echo "Usage: $0 [-f package-file] <target-directory-name>"
|
|
exit 1
|
|
fi
|
|
;;
|
|
esac
|
|
done
|
|
|
|
if [ -z "$TARGET" ]; then
|
|
echo "Usage: $0 [-f package-file] <target-directory-name>"
|
|
exit 1
|
|
fi
|
|
|
|
if [ -n "$PACKAGE_FILE" ]; then
|
|
if [ ! -f "$PACKAGE_FILE" ]; then
|
|
echo "Package file not found: $PACKAGE_FILE"
|
|
exit 1
|
|
fi
|
|
if command -v realpath >/dev/null 2>&1; then
|
|
PACKAGE_FILE="$(realpath "$PACKAGE_FILE")"
|
|
else
|
|
PACKAGE_FILE="$(cd "$(dirname "$PACKAGE_FILE")" && pwd -P)/$(basename "$PACKAGE_FILE")"
|
|
fi
|
|
fi
|
|
# Create and enter target directory
|
|
mkdir -p "./code/$TARGET" || exit 1
|
|
mkdir -p "./sdk" || exit 1
|
|
|
|
rm -f "./sdk/$TARGET"
|
|
(cd sdk && ln -s "../code/$TARGET/sdk" $TARGET)
|
|
|
|
cd "./code/$TARGET" || exit 1
|
|
|
|
# List of packages (comment/uncomment as needed)
|
|
all_packages=(
|
|
openssl
|
|
nghttp2
|
|
basisu
|
|
ezaudio
|
|
httplib
|
|
mongo
|
|
opus
|
|
tinygltf
|
|
webrtc
|
|
astronomy
|
|
boost
|
|
fftw
|
|
msquic
|
|
soxr
|
|
tommath
|
|
zip
|
|
audiofile
|
|
catch2
|
|
glfw
|
|
json-nlohmann
|
|
oggvorbis
|
|
speex
|
|
utf8cpp
|
|
zstd
|
|
aws
|
|
curl
|
|
glm
|
|
libunwind
|
|
onnx
|
|
speexdsp
|
|
vookoo
|
|
base32
|
|
date
|
|
gte
|
|
mapbox
|
|
stb
|
|
vulkan
|
|
imgui
|
|
)
|
|
|
|
: "${ignore_packages:=}"
|
|
: "${say:=echo}"
|
|
|
|
read -a ignore_list <<< "$ignore_packages"
|
|
|
|
trim_whitespace() {
|
|
local s=$1
|
|
s="${s#"${s%%[![:space:]]*}"}"
|
|
s="${s%"${s##*[![:space:]]}"}"
|
|
printf '%s' "$s"
|
|
}
|
|
|
|
if [ -n "$PACKAGE_FILE" ]; then
|
|
package_list=()
|
|
while IFS= read -r line || [ -n "$line" ]; do
|
|
line=$(trim_whitespace "$line")
|
|
if [ -z "$line" ]; then
|
|
continue
|
|
fi
|
|
case "$line" in
|
|
\#*) continue ;;
|
|
esac
|
|
package_list+=("$line")
|
|
done < "$PACKAGE_FILE"
|
|
else
|
|
: "${packages:=${all_packages[*]}}"
|
|
read -a package_list <<< "$packages"
|
|
fi
|
|
|
|
should_ignore() {
|
|
local pkg=$1
|
|
for ignore in "${ignore_list[@]}"; do
|
|
if [ "$pkg" = "$ignore" ]; then
|
|
return 0
|
|
fi
|
|
done
|
|
return 1
|
|
}
|
|
|
|
../../resources/packages/_empty/prepare
|
|
|
|
# Loop through packages and call prepare script
|
|
for package in "${package_list[@]}"; do
|
|
if should_ignore "$package"; then
|
|
continue
|
|
fi
|
|
|
|
$say "$package"
|
|
../../resources/packages/"$package"/prepare
|
|
done
|
|
|
|
$say "Done installing packages"
|