tools: Add zlibutil

Third time's the charm...
Editing this commit again to resolve merge conflicts.
- Bodge

Splitting one of Joca’s commits by topic - Bodge

Add zlibutil.cpp and zlib to the project's dependencies. - Joca
master
BodgeMaster 2024-06-08 14:26:48 +02:00
parent 6ef1d401bb
commit 8b13f72acc
4 changed files with 23 additions and 13 deletions

View File

@ -35,10 +35,20 @@ fi
# dynamically linked libraries. # dynamically linked libraries.
echo ">>> Building libs..." echo ">>> Building libs..."
create_directory bin/lib create_directory bin/lib
for lib in $(find ./src/lib -name "*.cpp"); do COMPILE_COMMANDS=(
COMPILE_COMMAND="$CXX_WITH_FLAGS -I ./include -fPIC -shared -o $(sed -e 's/^.\/src/.\/bin/;s/cpp$/so/' <<< $lib) $lib" "$CXX_WITH_FLAGS -I ./include -fPIC -shared -o ./bin/lib/net/client.so ./src/lib/net/client.cpp"
echo $COMPILE_COMMAND "$CXX_WITH_FLAGS -I ./include -fPIC -shared -o ./bin/lib/net/server.so ./src/lib/net/server.cpp"
$COMPILE_COMMAND & "$CXX_WITH_FLAGS -I ./include -fPIC -shared -o ./bin/lib/cli.so ./src/lib/cli.cpp"
"$CXX_WITH_FLAGS -I ./include -fPIC -shared -o ./bin/lib/file.so ./src/lib/file.cpp"
"$CXX_WITH_FLAGS -I ./include -fPIC -shared -o ./bin/lib/game/block.so ./src/lib/game/block.cpp"
"$CXX_WITH_FLAGS -I ./include -fPIC -shared -o ./bin/lib/game/entity.so ./src/lib/game/entity.cpp"
"$CXX_WITH_FLAGS -I ./include -fPIC -shared -o ./bin/lib/nbt.so ./src/lib/nbt.cpp"
"$CXX_WITH_FLAGS -I ./include -fPIC -shared -o ./bin/lib/region.so ./src/lib/region.cpp"
"$CXX_WITH_FLAGS -I ./include -fPIC -shared -l:libz.so -o ./bin/lib/zlibutil.so ./src/lib/zlibutil.cpp"
)
for command in ${!COMPILE_COMMANDS[@]}; do
echo "${COMPILE_COMMANDS[command]}"
${COMPILE_COMMANDS[command]} &
$WAIT_ANYWAY $WAIT_ANYWAY
done done
@ -62,7 +72,7 @@ COMPILE_COMMANDS=(
"$CXX_WITH_FLAGS src/tools/dumpnbt.cpp -I./include -Lbin/lib -l:nbt.so -l:cli.so -o bin/tools/dumpnbt" "$CXX_WITH_FLAGS src/tools/dumpnbt.cpp -I./include -Lbin/lib -l:nbt.so -l:cli.so -o bin/tools/dumpnbt"
"$CXX_WITH_FLAGS src/tools/arraydump.cpp -I./include -Lbin/lib -l:file.so -l:cli.so -o bin/tools/arraydump" "$CXX_WITH_FLAGS src/tools/arraydump.cpp -I./include -Lbin/lib -l:file.so -l:cli.so -o bin/tools/arraydump"
"$CXX_WITH_FLAGS src/tools/baseconvert.cpp -I./include -Lbin/lib -l:cli.so -o bin/tools/baseconvert" "$CXX_WITH_FLAGS src/tools/baseconvert.cpp -I./include -Lbin/lib -l:cli.so -o bin/tools/baseconvert"
"$CXX_WITH_FLAGS src/tools/zlibutil.cpp -I./include -Lbin/lib -l:cli.so -l:libz.so -l:file.so -l:zlibutil.so -o bin/tools/zlibutil" "$CXX_WITH_FLAGS src/tools/zlibutil.cpp -I./include -Lbin/lib -l:cli.so -l:file.so -l:zlibutil.so -l:libz.so -o bin/tools/zlibutil"
"$CXX_WITH_FLAGS -pthread src/tools/hexnet.cpp -I./include -Lbin/lib -l:cli.so -l:libsockpp.so -o bin/tools/hexnet" "$CXX_WITH_FLAGS -pthread src/tools/hexnet.cpp -I./include -Lbin/lib -l:cli.so -l:libsockpp.so -o bin/tools/hexnet"
"$CXX_WITH_FLAGS -DFOSSVG_DEBUG src/fossvg.cpp -I./include -Lbin/lib -l:file.so -l:cli.so -lglfw -lvulkan -o bin/fossvg" "$CXX_WITH_FLAGS -DFOSSVG_DEBUG src/fossvg.cpp -I./include -Lbin/lib -l:file.so -l:cli.so -lglfw -lvulkan -o bin/fossvg"
"$CXX_WITH_FLAGS src/fossvgd.cpp -I./include -Lbin/lib -l:cli.so -o bin/fossvgd" "$CXX_WITH_FLAGS src/fossvgd.cpp -I./include -Lbin/lib -l:cli.so -o bin/fossvgd"

View File

@ -39,6 +39,7 @@ fi
ln -vs ../dependencies/sockpp-0.8.1/include/sockpp/ ./include/ ln -vs ../dependencies/sockpp-0.8.1/include/sockpp/ ./include/
ln -vs ../dependencies/tiny-utf8-4.4.3/include/tinyutf8/ ./include/ ln -vs ../dependencies/tiny-utf8-4.4.3/include/tinyutf8/ ./include/
ln -vs ../dependencies/zlib-1.3.1/ ./include/zlib
create_file ./bin/.placeholder create_file ./bin/.placeholder
create_file ./include/.placeholder create_file ./include/.placeholder

View File

@ -79,7 +79,7 @@ set -e # failures are not acceptable here
create_directory dependencies/tmp create_directory dependencies/tmp
download https://github.com/DuffsDevice/tiny-utf8/archive/refs/tags/v4.4.3.tar.gz dependencies/tmp/tiny-utf8.tar.gz 8e3f61651909c9f3105d3501932a96aa65733127fb6e7cf94cb1b0a2dff42c8f download https://github.com/DuffsDevice/tiny-utf8/archive/refs/tags/v4.4.3.tar.gz dependencies/tmp/tiny-utf8.tar.gz 8e3f61651909c9f3105d3501932a96aa65733127fb6e7cf94cb1b0a2dff42c8f
download https://github.com/fpagliughi/sockpp/archive/refs/tags/v0.8.1.tar.gz dependencies/tmp/sockpp.tar.gz a8aedff8bd8c1da530b91be650352008fddabc9f1df0d19701d76cbc359c8651 download https://github.com/fpagliughi/sockpp/archive/refs/tags/v0.8.1.tar.gz dependencies/tmp/sockpp.tar.gz a8aedff8bd8c1da530b91be650352008fddabc9f1df0d19701d76cbc359c8651
download https://www.zlib.net/zlib-1.3.tar.gz dependencies/tmp/zlib-1.3.tar.gz ff0ba4c292013dbc27530b3a81e1f9a813cd39de01ca5e0f8bf355702efa593e download https://www.zlib.net/zlib-1.3.1.tar.xz dependencies/tmp/zlib.tar.xz 38ef96b8dfe510d42707d9c781877914792541133e1870841463bfa73f883e32
#TODO: figure out how to cache shaderc #TODO: figure out how to cache shaderc
#also TODO: target a specific commit #also TODO: target a specific commit
@ -97,11 +97,8 @@ tar -xf dependencies/tmp/sockpp.tar -C dependencies
echo "done" echo "done"
echo -n ">>> Extracting zlib... " echo -n ">>> Extracting zlib... "
gzip -d dependencies/tmp/zlib-1.3.tar.gz xz -d dependencies/tmp/zlib.tar.xz
tar -xf dependencies/tmp/zlib-1.3.tar -C dependencies tar -xf dependencies/tmp/zlib.tar -C dependencies
cd include/
ln -vs ../dependencies/zlib-1.3/ zlib
cd ..
echo "done" echo "done"
echo ">>> Building sockpp..." echo ">>> Building sockpp..."
@ -148,9 +145,10 @@ cp -v "dependencies/tmp/shaderc/$SHADERC_BUILD/glslc/glslc" dependencies/shaderc
echo ">>> done" echo ">>> done"
echo ">>> Building zlib..." echo ">>> Building zlib..."
cd dependencies/zlib-1.3/ pushd dependencies/zlib-1.3.1/
./configure ./configure
make make
popd
echo "done" echo "done"
echo ">>> Cleaning up..." echo ">>> Cleaning up..."

View File

@ -23,6 +23,7 @@
#include <tinyutf8/tinyutf8.h> #include <tinyutf8/tinyutf8.h>
#include <zlib/zlib.h> #include <zlib/zlib.h>
#include <cstring> #include <cstring>
#include <fstream>
#include "../lib/cli.hpp" #include "../lib/cli.hpp"
#include "../lib/file.hpp" #include "../lib/file.hpp"
@ -32,7 +33,7 @@
#define EXIT_RUNTIME 1 #define EXIT_RUNTIME 1
#define EXIT_USAGE 2 #define EXIT_USAGE 2
#define CHUNK_SIZE 16384 // Chunk size
/* /*
Finnaly, the main file Finnaly, the main file