Compare commits
No commits in common. "23a928bd0617ef4d59d797b37bd7d5c8edd17903" and "f80a33ddb0ace554e19b6b24aef2294b643899ce" have entirely different histories.
23a928bd06
...
f80a33ddb0
|
@ -1,8 +1,5 @@
|
||||||
/bin/*
|
/bin/*
|
||||||
!/bin/.placeholder
|
!/bin/.placeholder
|
||||||
|
|
||||||
/dependencies/*
|
|
||||||
!/dependencies/.placeholder
|
|
||||||
|
|
||||||
# ignore nano's temp files
|
# ignore nano's temp files
|
||||||
*.swp
|
*.swp
|
||||||
|
|
40
README.md
40
README.md
|
@ -16,43 +16,3 @@ Immediate goals:
|
||||||
- NBT library
|
- NBT library
|
||||||
- [ ] parse NBT
|
- [ ] parse NBT
|
||||||
- [ ] decode and encode data
|
- [ ] decode and encode data
|
||||||
|
|
||||||
|
|
||||||
## Project Setup Instructions
|
|
||||||
|
|
||||||
### Prerequisites:
|
|
||||||
|
|
||||||
This project requires bash and a C++20 compiler.
|
|
||||||
|
|
||||||
The project setup requires wget or curl, gzip, and tar.
|
|
||||||
|
|
||||||
**For people using other shells than bash:** You need to at least have bash
|
|
||||||
installed to use the scripts, but using it as your shell while working on
|
|
||||||
this project also allows you to use the provided aliases.
|
|
||||||
|
|
||||||
If you don’t want to use bash as your shell, not even temporarily for this
|
|
||||||
project, you can use the scripts by running them from the project's base
|
|
||||||
directory and run any generated executables with `LD_LIBRARY_PATH` set to
|
|
||||||
point to `bin/lib`.
|
|
||||||
|
|
||||||
|
|
||||||
### Setup
|
|
||||||
|
|
||||||
- `git clone` this repository
|
|
||||||
- if using bash:
|
|
||||||
- `source` the file `setupenv.bashrc` from the project's base directory
|
|
||||||
to load the provided shell environment
|
|
||||||
- `setup_project`
|
|
||||||
- if not using bash or not using the provided environment:
|
|
||||||
- `cd` to the project's base directory
|
|
||||||
- `scripts/setup_project.sh`
|
|
||||||
|
|
||||||
This will download the following dependenceis:
|
|
||||||
- [tiny-utf8](https://github.com/DuffsDevice/tiny-utf8)
|
|
||||||
|
|
||||||
### Building
|
|
||||||
|
|
||||||
To build the project, just use the `build` alias or invoke the `build.sh`
|
|
||||||
script from the project's base directory.
|
|
||||||
|
|
||||||
`build` and `build.sh` accept the environment variables `CXX` and `CXXFLAGS`. `CXXFLAGS` must at least specify the C++ version.
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env bash
|
#!/bin/bash
|
||||||
|
|
||||||
if [ -z "$CXX" ]; then
|
if [ -z "$CXX" ]; then
|
||||||
CXX="c++"
|
CXX="c++"
|
|
@ -1,5 +1,3 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
rm -rv ./bin
|
rm -rv ./bin
|
||||||
mkdir -v ./bin
|
mkdir -v ./bin
|
||||||
set -v
|
set -v
|
|
@ -1,6 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
rm -rv ./dependencies
|
|
||||||
mkdir -v ./dependencies
|
|
||||||
set -v
|
|
||||||
echo -n "" > ./dependencies/.placeholder
|
|
|
@ -1,49 +0,0 @@
|
||||||
#!/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
|
|
|
@ -1,20 +0,0 @@
|
||||||
PROJECT_BASE_DIR="$( cd -- "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 ; pwd -P )"
|
|
||||||
|
|
||||||
alias clean="pushd \"$PROJECT_BASE_DIR\" >/dev/null 2>&1; scripts/clean.sh; popd >/dev/null 2>&1"
|
|
||||||
alias clean_dependencies="pushd \"$PROJECT_BASE_DIR\" >/dev/null 2>&1; scripts/clean_dependencies.sh; popd >/dev/null 2>&1"
|
|
||||||
alias setup_project="pushd \"$PROJECT_BASE_DIR\" >/dev/null 2>&1; scripts/setup_project.sh; popd >/dev/null 2>&1"
|
|
||||||
|
|
||||||
function build {
|
|
||||||
pushd "$PROJECT_BASE_DIR" >/dev/null 2>&1
|
|
||||||
CXX="$CXX" CXXFLAGS="$CXXFLAGS" scripts/build.sh
|
|
||||||
popd >/dev/null 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if [ -z "$LD_LIBRARY_PATH" ]; then
|
|
||||||
export LD_LIBRARY_PATH="$PROJECT_BASE_DIR"/bin/lib
|
|
||||||
else
|
|
||||||
export LD_LIBRARY_PATH="$PROJECT_BASE_DIR"/bin/lib:"LD_LIBRARY_PATH"
|
|
||||||
fi
|
|
||||||
|
|
||||||
unset PROJECT_BASE_DIR
|
|
Loading…
Reference in New Issue