From c06aa2da8457302c0e31a3e2e227c5353b5a3f36 Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 25 Nov 2016 16:04:17 +0100 Subject: [PATCH] Create amalgamized releases --- amalgamize.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 amalgamize.sh diff --git a/amalgamize.sh b/amalgamize.sh new file mode 100644 index 0000000..11f525f --- /dev/null +++ b/amalgamize.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +set -e + +mkdir -p amalgamation +OUTPUT_PREFIX=amalgamation/miniz + +cat miniz.h > $OUTPUT_PREFIX.h +cat miniz.c > $OUTPUT_PREFIX.c +cat miniz_common.h >> $OUTPUT_PREFIX.h +cat miniz_tdef.c >> $OUTPUT_PREFIX.c +cat miniz_tdef.h >> $OUTPUT_PREFIX.h +cat miniz_tinfl.c >> $OUTPUT_PREFIX.c +cat miniz_tinfl.h >> $OUTPUT_PREFIX.h +cat miniz_zip.c >> $OUTPUT_PREFIX.c +cat miniz_zip.h >> $OUTPUT_PREFIX.h + + +sed -i 's/#include "miniz.h"/#include "miniz.h"/' $OUTPUT_PREFIX.c +for i in miniz miniz_common miniz_tdef miniz_tinfl miniz_zip +do + sed -i "s/#include \"$i.h\"//g" $OUTPUT_PREFIX.h + sed -i "s/#include \"$i.h\"//g" $OUTPUT_PREFIX.c +done + + +echo "int main() { return 0; }" > main.c +gcc main.c $OUTPUT_PREFIX.c -o test.out +rm test.out +rm main.c + +cd amalgamation +! test -e miniz.zip || rm miniz.zip +echo -e "miniz.c\nminiz.h" | zip -@ miniz + +echo "Amalgamation created."