Skip to content

Commit

Permalink
Create amalgamized releases
Browse files Browse the repository at this point in the history
  • Loading branch information
uroni committed Nov 25, 2016
1 parent 224d207 commit c06aa2d
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions amalgamize.sh
Original file line number Diff line number Diff line change
@@ -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."

0 comments on commit c06aa2d

Please sign in to comment.