Sha256: 246cdb26c4c152a40df1a8c0ce7ef371f15f6c464b1cc67fe9f8ada01c8a9a13

Contents?: true

Size: 1.72 KB

Versions: 7

Compression:

Stored size: 1.72 KB

Contents

#!/bin/bash
#/ Usage: script/build-rubyc-exe <RUBYC> [VERSION]
#/
#/ WARNING: You should not need to call this directly. Please create packages using
#/ `script/package [platform]` or `bundle exec rake package[platform]`
#/
#/ Builds a distributable package for licensed for a given RUBYC compiler and licensed VERSION.
#/ Packages are of the form licensed-$VERSION-$PLATFORM-x64.tar.gz and contain a `./licensed` executable
#/ Built Packages are placed in the <root>/pkg directory.
#/
#/ OPTIONS:
#/   <RUBYC>           The path to a rubyc compiler that should be used to compile the target executable
#/   [VERSION]         (optional, default to current git branch or SHA1) version of licensed to build exe at
#/
#/ EXAMPLES:
#/
#/   Builds a package for version 1.1.0 using a local rubyc compiler
#/     $ build-rubyc-exe RUBYC="./rubyc-darwin" VERSION="1.1.0"
#/

set -euo pipefail

usage(){
  grep "^#/" <"$0" | cut -c3-
}

BASE_DIR="$(cd "$(dirname $0)/.." && pwd)"
VERSION=${VERSION:=""}
RUBYC=${RUBYC:=""}
if [ ! -f "$RUBYC" ]; then
  echo "Please specify a rubyc compiler" >&2
  usage
  exit 127
fi

BUILD_DEST="$(mktemp -d)"
trap "rm -rf $BUILD_DEST" EXIT

if [ -n "$VERSION" ]; then
  git checkout "$VERSION"
  CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
  trap "rm -rf $BUILD_DEST; git checkout $CURRENT_BRANCH" EXIT
else
  VERSION="$(git rev-parse --abbrev-ref HEAD)"
fi

PACKAGE_DEST="$BASE_DIR/pkg"
mkdir -p "$PACKAGE_DEST"

PLATFORM="$(uname -s | tr '[:upper:]' '[:lower:]')"
TARGET="licensed-$VERSION-$PLATFORM-x64.tar.gz"

"$RUBYC" --clean-tmpdir -o "$BUILD_DEST/licensed" "$BASE_DIR/exe/licensed"

chmod +x $BUILD_DEST/licensed
tar -C "$BUILD_DEST" -czf "$PACKAGE_DEST/$TARGET" "./licensed"

echo "licensed built to $PACKAGE_DEST/$TARGET"

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
licensed-1.4.0 script/build-rubyc-exe
licensed-1.3.4 script/build-rubyc-exe
licensed-1.3.3 script/build-rubyc-exe
licensed-1.3.2 script/build-rubyc-exe
licensed-1.3.1 script/build-rubyc-exe
licensed-1.3.0 script/build-rubyc-exe
licensed-1.2.0 script/build-rubyc-exe