Fix archive.sh and Makefile

This commit is contained in:
toshi0383 2018-02-26 19:19:48 +09:00
parent c0aabd0bec
commit d07f160bae
2 changed files with 19 additions and 13 deletions

View File

@ -1,11 +1,12 @@
TOOL_NAME = xcodegen
export TOOL_NAME = XcodeGen
export TOOL_NAME_LOWER = xcodegen
VERSION = 1.6.0
PREFIX = /usr/local
INSTALL_PATH = $(PREFIX)/bin/$(TOOL_NAME)
SHARE_PATH = $(PREFIX)/share/$(TOOL_NAME)
INSTALL_PATH = $(PREFIX)/bin/$(TOOL_NAME_LOWER)
SHARE_PATH = $(PREFIX)/share/$(TOOL_NAME_LOWER)
CURRENT_PATH = $(PWD)
REPO = https://github.com/yonaskolb/$(TOOL_NAME)
REPO = https://github.com/yonaskolb/$(TOOL_NAME_LOWER)
RELEASE_TAR = $(REPO)/archive/$(VERSION).tar.gz
SHA = $(shell curl -L -s $(RELEASE_TAR) | shasum -a 256 | sed 's/ .*//')
@ -13,7 +14,7 @@ SHA = $(shell curl -L -s $(RELEASE_TAR) | shasum -a 256 | sed 's/ .*//')
install: build
mkdir -p $(PREFIX)/bin
cp -f .build/release/$(TOOL_NAME) $(INSTALL_PATH)
cp -f .build/release/$(TOOL_NAME_LOWER) $(INSTALL_PATH)
mkdir -p $(SHARE_PATH)
cp -R $(CURRENT_PATH)/SettingPresets $(SHARE_PATH)/SettingPresets

View File

@ -1,11 +1,11 @@
#!/bin/bash
TOOL_NAME=XcodeGen
TOOL_NAME_LOWER=xcodegen
TMP=$(mktemp -d)/$TOOL_NAME
TMP=$(mktemp -d)/${TOOL_NAME:?}
BINDIR=$TMP/bin
SHAREDIR=$TMP/share
ZIPFILE=$TMP/$TOOL_NAME_LOWER.zip
INSTALLSH=scripts/install-binary.sh
ZIPFILE=$TMP/${TOOL_NAME_LOWER:?}.zip
INSTALLSH=scripts/install.sh
# copy
mkdir -p $BINDIR
cp -f .build/release/$TOOL_NAME_LOWER $BINDIR
@ -13,13 +13,18 @@ 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
cp $INSTALLSH $TMP
# zip
(cd $TMP/..; zip -r $ZIPFILE $TOOL_NAME)
# print sha
SHA=$(cat $ZIPFILE | shasum -a 256 | sed 's/ .*//')
echo "SHA: $SHA"
mv $ZIPFILE .
# cleanup
rm -rf $TMP