diff --git a/Makefile b/Makefile index 6b583f6d..161155b4 100644 --- a/Makefile +++ b/Makefile @@ -41,3 +41,9 @@ release: format_code git add . git commit -m "Update to $(VERSION)" git tag $(VERSION) + +install-binary: + ./scripts/install.sh + +archive: build + ./scripts/archive.sh diff --git a/scripts/archive.sh b/scripts/archive.sh new file mode 100755 index 00000000..33ff109d --- /dev/null +++ b/scripts/archive.sh @@ -0,0 +1,23 @@ +#!/bin/bash +TOOL_NAME=XcodeGen +TOOL_NAME_LOWER=xcodegen +TMP=$(mktemp -d)/$TOOL_NAME +BINDIR=$TMP/bin +SHAREDIR=$TMP/share +ZIPFILE=$TMP/$TOOL_NAME_LOWER.zip +INSTALLSH=scripts/install-binary.sh + +mkdir -p $BINDIR +cp -f .build/release/$TOOL_NAME_LOWER $BINDIR + +mkdir -p $SHAREDIR +cp -R SettingPresets $SHAREDIR/SettingPresets + +sed -e 's/^BASE_DIR=.*/BASE_DIR=$(cd `dirname $0`; pwd)/' -e '/.*[zZ][iI][pP].*/d' $INSTALLSH \ + > $TMP/install.sh +chmod +x $TMP/install.sh + +(cd $TMP/..; zip -r $ZIPFILE $TOOL_NAME) +mv $ZIPFILE . + +rm -rf $TMP diff --git a/scripts/install-binary.sh b/scripts/install-binary.sh new file mode 100755 index 00000000..aabd53af --- /dev/null +++ b/scripts/install-binary.sh @@ -0,0 +1,12 @@ +#!/bin/bash +PREFIX=${1:-/usr/local} + +### NOTE: Stripped or replaced by archive.sh from this line +ZIPFILE=xcodegen.zip +if [ ! -f $ZIPFILE ];then echo $ZIPFILE not found; exit 1; fi +unzip -o xcodegen.zip +BASE_DIR=XcodeGen +### to this line. + +cp -r $BASE_DIR/share "${PREFIX}" +cp -r $BASE_DIR/bin "${PREFIX}"