From b939c608775b00bc2cedd27a5ccb4e5c0cbcbff6 Mon Sep 17 00:00:00 2001 From: toshi0383 Date: Sun, 25 Feb 2018 17:11:48 +0900 Subject: [PATCH] Add archive and install-binary script --- Makefile | 6 ++++++ scripts/archive.sh | 23 +++++++++++++++++++++++ scripts/install-binary.sh | 12 ++++++++++++ 3 files changed, 41 insertions(+) create mode 100755 scripts/archive.sh create mode 100755 scripts/install-binary.sh 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}"