add a project setup script so we can better deal with dependencies, also add the first dependency to the project
parent
3483b4182e
commit
23a928bd06
|
@ -47,6 +47,8 @@ point to `bin/lib`.
|
||||||
- `cd` to the project's base directory
|
- `cd` to the project's base directory
|
||||||
- `scripts/setup_project.sh`
|
- `scripts/setup_project.sh`
|
||||||
|
|
||||||
|
This will download the following dependenceis:
|
||||||
|
- [tiny-utf8](https://github.com/DuffsDevice/tiny-utf8)
|
||||||
|
|
||||||
### Building
|
### Building
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# figure out if using wget or curl
|
||||||
|
echo -n "Wget or curl? "
|
||||||
|
if command -v wget >/dev/null 2>&1; then
|
||||||
|
USE_WGET=yes
|
||||||
|
echo "wget"
|
||||||
|
else
|
||||||
|
if command -v curl >/dev/null 2>&1; then
|
||||||
|
USE_WGET=no
|
||||||
|
echo "curl"
|
||||||
|
else
|
||||||
|
echo "Neither wget nor curl found. Aborting."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
function download {
|
||||||
|
URL="$1"
|
||||||
|
DESTINATION="$2"
|
||||||
|
echo -n "Downloading $URL to $DESTINATION... "
|
||||||
|
if [ $USE_WGET = yes ]; then
|
||||||
|
wget -O "$DESTINATION" "$URL" >/dev/null 2>&1
|
||||||
|
else
|
||||||
|
curl -L "$URL" --output "$DESTINATION" >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
echo "done."
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Cleaning build files..."
|
||||||
|
scripts/clean.sh
|
||||||
|
echo "Cleaning dependencies..."
|
||||||
|
scripts/clean_dependencies.sh
|
||||||
|
|
||||||
|
mkdir -v dependencies/tmp
|
||||||
|
download https://github.com/DuffsDevice/tiny-utf8/archive/refs/tags/v4.4.3.tar.gz dependencies/tmp/tiny-utf8.tar.gz
|
||||||
|
#TODO: verify the files we have downloaded
|
||||||
|
#TODO: keep the files somewhere else as a cache and only download the ones
|
||||||
|
# we don't have or that got corrupted
|
||||||
|
#TODO: once we cache files properly, have clean_dependencies.sh prune
|
||||||
|
# unknown files from the cache (for example old versions
|
||||||
|
# of dependencies)
|
||||||
|
|
||||||
|
echo -n "Extracting tiny-utf8... "
|
||||||
|
gzip -d dependencies/tmp/tiny-utf8.tar.gz
|
||||||
|
tar -xf dependencies/tmp/tiny-utf8.tar -C dependencies
|
||||||
|
echo "done."
|
||||||
|
|
||||||
|
rm -rv dependencies/tmp
|
Loading…
Reference in New Issue