#!/bin/sh -ex cd lua-cjson luarocks config variables.CFLAGS " $CFLAGS" luarocks make --pack-binary-rock *.rockspec obj=$(ls *.rock) cp $obj /root cd /root if [ -z $(echo $CFLAGS | grep -o -E -- '( |^)-g( |$)') ]; then # Release build, delete docs/ and tests/ zip -d $obj docs/ docs/* tests/ tests/* # And pack the library with upx unzip $obj lib/* find lib -type f | xargs upx --no-progress zip -r "$obj" lib fi