diff --git a/Makefile b/Makefile index b8984290..acf50cfa 100644 --- a/Makefile +++ b/Makefile @@ -100,6 +100,7 @@ contrib: lib $(MAKE) -C contrib/pzstd all $(MAKE) -C contrib/seekable_format/examples all $(MAKE) -C contrib/largeNbDicts all + cd contrib/single_file_decoder/ ; ./build_test.sh .PHONY: cleanTabs cleanTabs: diff --git a/contrib/declib/.gitignore b/contrib/single_file_decoder/.gitignore similarity index 100% rename from contrib/declib/.gitignore rename to contrib/single_file_decoder/.gitignore diff --git a/contrib/declib/README.md b/contrib/single_file_decoder/README.md similarity index 82% rename from contrib/declib/README.md rename to contrib/single_file_decoder/README.md index bf568be9..159214e1 100644 --- a/contrib/declib/README.md +++ b/contrib/single_file_decoder/README.md @@ -7,7 +7,10 @@ Create `zstddeclib.c` from the Zstd source using: cd zstd/contrib/declib ./combine.sh -r ../../lib -r ../../lib/common -r ../../lib/decompress -o zstddeclib.c zstddeclib-in.c ``` -Then add the resulting file to your project (see the [example files](examples)). `build.sh` will run the above script then compile and test the library. +Then add the resulting file to your project (see the [example files](examples)). + +`create_single_file_decoder.sh` will run the above script, creating file `zstddeclib.c`. +`build_test.sh` will create the decoder, then compile and test the library. Why --- diff --git a/contrib/declib/build.sh b/contrib/single_file_decoder/build_test.sh similarity index 82% rename from contrib/declib/build.sh rename to contrib/single_file_decoder/build_test.sh index e0a62745..eb688bf3 100755 --- a/contrib/declib/build.sh +++ b/contrib/single_file_decoder/build_test.sh @@ -10,14 +10,13 @@ OUT_FILE="tempbin" OUT_WASM="temp.wasm" # Amalgamate the sources -echo "Amalgamating files... this may take a few minutes" -./combine.sh -r "$ZSTD_SRC_ROOT" -r "$ZSTD_SRC_ROOT/common" -r "$ZSTD_SRC_ROOT/decompress" -o zstddeclib.c zstddeclib-in.c +./create_single_file_decoder.sh # Did combining work? if [ $? -ne 0 ]; then - echo "Combine script: FAILED" + echo "Single file decoder creation script: FAILED" exit 1 fi -echo "Combine script: PASSED" +echo "Single file decoder creation script: PASSED" # Compile the generated output cc -Os -g0 -o $OUT_FILE examples/simple.c diff --git a/contrib/declib/combine.sh b/contrib/single_file_decoder/combine.sh similarity index 100% rename from contrib/declib/combine.sh rename to contrib/single_file_decoder/combine.sh diff --git a/contrib/single_file_decoder/create_single_file_decoder.sh b/contrib/single_file_decoder/create_single_file_decoder.sh new file mode 100755 index 00000000..ad976bb8 --- /dev/null +++ b/contrib/single_file_decoder/create_single_file_decoder.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +# Where to find the sources +ZSTD_SRC_ROOT="../../lib" + + +# Amalgamate the sources +echo "Amalgamating files... this can take a while" +./combine.sh -r "$ZSTD_SRC_ROOT" -r "$ZSTD_SRC_ROOT/common" -r "$ZSTD_SRC_ROOT/decompress" -o zstddeclib.c zstddeclib-in.c +# Did combining work? +if [ $? -ne 0 ]; then + echo "Combine script: FAILED" + exit 1 +fi +echo "Combine script: PASSED" diff --git a/contrib/declib/examples/README.md b/contrib/single_file_decoder/examples/README.md similarity index 100% rename from contrib/declib/examples/README.md rename to contrib/single_file_decoder/examples/README.md diff --git a/contrib/declib/examples/emscripten.c b/contrib/single_file_decoder/examples/emscripten.c similarity index 100% rename from contrib/declib/examples/emscripten.c rename to contrib/single_file_decoder/examples/emscripten.c diff --git a/contrib/declib/examples/shell.html b/contrib/single_file_decoder/examples/shell.html similarity index 100% rename from contrib/declib/examples/shell.html rename to contrib/single_file_decoder/examples/shell.html diff --git a/contrib/declib/examples/simple.c b/contrib/single_file_decoder/examples/simple.c similarity index 100% rename from contrib/declib/examples/simple.c rename to contrib/single_file_decoder/examples/simple.c diff --git a/contrib/declib/zstddeclib-in.c b/contrib/single_file_decoder/zstddeclib-in.c similarity index 100% rename from contrib/declib/zstddeclib-in.c rename to contrib/single_file_decoder/zstddeclib-in.c