1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- #!/usr/bin/env bash
- set -ev
- cd "${BASH_SOURCE%/*}/.."
- USAGE="usage: bin/package [-v PACKAGE_VERSION]"
- while getopts ":v:h" opt; do
- case $opt in
- v)
- PKG_VERSION=$OPTARG
- ;;
- h)
- echo $USAGE >&2
- exit
- ;;
- \?)
- echo "Invalid option: -$OPTARG" >&2
- echo $USAGE >&2
- exit 1
- ;;
- :)
- echo "Option -$OPTARG requires an argument" >&2
- echo $USAGE >&2
- exit 1
- ;;
- esac
- done
- ./bin/build || exit 1
- chmod +x *.phar
- echo "Creating tarballs"
- mkdir -p dist || exit 1
- if [ -z "$PKG_VERSION" ]; then
- PKG_VERSION=$(git describe --tag --exact-match)
- if [[ $(php --version) = PHP\ 5.3* ]]; then
- PKG_VERSION=${PKG_VERSION}-php53
- fi
- fi
- # Support BSD tar because OS X :(
- TAR_FLAGS='--transform="flags=r;s/.*/psysh/"'
- if [[ $(tar --version) = bsdtar* ]]; then
- TAR_FLAGS='-s /.*/psysh/'
- fi
- tar $TAR_FLAGS -czf dist/psysh-${PKG_VERSION}.tar.gz psysh.phar
- tar $TAR_FLAGS -czf dist/psysh-${PKG_VERSION}-compat.tar.gz psysh-compat.phar
|