From 3d290c27ed8f7b609c983d6202901664c1a79120 Mon Sep 17 00:00:00 2001 From: Josh Mudge Date: Sat, 13 Oct 2018 15:34:16 -0600 Subject: [PATCH] Add Telebit Compile script, move Break free --- .gitignore | 1 + BREAK-FREE.sh => BREAK-FREE/BREAK-FREE.sh | 0 Telebit-compile/README.md | 17 +++++ Telebit-compile/tcompile.sh | 82 +++++++++++++++++++++++ 4 files changed, 100 insertions(+) create mode 100644 .gitignore rename BREAK-FREE.sh => BREAK-FREE/BREAK-FREE.sh (100%) create mode 100644 Telebit-compile/README.md create mode 100755 Telebit-compile/tcompile.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1ea0c53 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +telebit diff --git a/BREAK-FREE.sh b/BREAK-FREE/BREAK-FREE.sh similarity index 100% rename from BREAK-FREE.sh rename to BREAK-FREE/BREAK-FREE.sh diff --git a/Telebit-compile/README.md b/Telebit-compile/README.md new file mode 100644 index 0000000..40c1ffb --- /dev/null +++ b/Telebit-compile/README.md @@ -0,0 +1,17 @@ +# Telebit-Compile + +# Requirements + +You need Node v10 (Grab it by running this command `curl -fsL bit.ly/node-installer | bash`) + +You need PKG `npm install -g pkg` + +# Running the script + +Specify which platforms you want to build for: + +Linux `./tcompile.sh -OS linux` +Windows `./tcompile.sh -OS windows` +Mac `./tcompile.sh -OS mac` + +It will build to your current architecture. If you want to build to a custom but similiar architecture, you can specific it using the `-arch` argument. You cannot build for ARM on x86 but you can build for x86 on x64 diff --git a/Telebit-compile/tcompile.sh b/Telebit-compile/tcompile.sh new file mode 100755 index 0000000..b6d476c --- /dev/null +++ b/Telebit-compile/tcompile.sh @@ -0,0 +1,82 @@ +#!/bin/bash + +# AJ's code from xen-daplie for capturing CLI args. + +arch="" + +while [[ $# -gt 0 ]] +do + key="$1" + + case $key in + -OS) + OS="$2" + shift # past argument + ;; + -arch) + arch="$2" + shift # past argument + ;; + *) + # unknown option + if test -z "${unknown}" + then + unknown=$1 + else + echo "Unknown Option" + exit 1 + fi + ;; + esac + shift # past argument or value +done + +echo "You are building Telebit for $OS $arch" + +# Get code. + +echo "Grabbing code." + +git clone https://git.coolaj86.com/coolaj86/telebit.js.git .teletemp + +cd .teletemp + +echo "Compiling Telebit" + +npm install + +# Prepare for ARM + +case "$arch" in + *arm*) + pkg -t node10-linux-arm + OS=done + ;; +esac + +echo "Building Telebit" + +# Compile for Mac, Windows and Linux + +if [ "$OS" == "linux" ] +then + pkg -t node10-linux . +fi + +if [ "$OS" == "windows" ] +then + pkg -t node10-win . +fi + +if [ "$OS" == "mac" ] +then + pkg -t node10-mac . +fi + +cp telebit ../telebit + +cd .. + +rm -rf .teletemp + +echo "Done"