Compare commits

...

No commits in common. "master" and "sandboxes" have entirely different histories.

88 changed files with 4619 additions and 465 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

28
.gitignore vendored
View File

@ -1,23 +1,5 @@
# Ignore everything
*
# But not these files...
!README.md
!.gitignore
!bash/**
!tmux/tmux.conf
!tmux/setup.sh
!tmux/plugins/tpm
!scripts/*
!nano/*
!x11/**
!git/*
!vscode/*
!Terminal/*
!starship.toml
!Brewfile
#directory catchall
!*/
.gitmodules
tmux/plugins/tmux-sensible/
tmux/plugins/tmux/
.DS_Store
mono/httplistener/*
jesseduffield/lazygit/state.yml
gcloud
configstore/update-notifier-npm.json

6
.gitmodules vendored
View File

@ -1,6 +0,0 @@
[submodule "/Users/jchenry/.config/tmux/plugins/tpm"]
path = /Users/jchenry/.config/tmux/plugins/tpm
url = https://github.com/tmux-plugins/tpm
[submodule "/Users/colin.henry/.config/tmux/plugins/tpm"]
path = /Users/colin.henry/.config/tmux/plugins/tpm
url = https://github.com/tmux-plugins/tpm

View File

@ -1,18 +1,49 @@
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-fonts"
tap "homebrew/core"
#tap "homebrew/bundle"
#tap "homebrew/cask"
#tap "homebrew/core"
brew "docker"
brew "drone-cli"
brew "git"
brew "btop"
brew "git-flow"
brew "graphviz"
brew "jq"
brew "make"
brew "starship"
brew "mas"
brew "mosh"
brew "ncurses"
brew "plantuml"
brew "pv"
brew "rclone"
brew "reattach-to-user-namespace"
brew "terraform"
brew "tmux"
cask "1password"
brew "watch"
brew "wget"
brew "youtube-dl"
cask "aerial"
cask "font-meslo-for-powerline"
cask "font-meslo-lg-dz"
cask "obsidian"
cask "omnifocus"
cask "discord"
cask "disk-inventory-x"
cask "geekbench"
cask "hazel"
cask "minecraft"
cask "paragon-ntfs"
cask "spotify"
cask "visual-studio-code"
cask "zoomus"
mas "1Password 7", id: 1333542190
mas "AdBlock", id: 1402042596
mas "Base", id: 402383384
mas "Cyberduck", id: 409222199
mas "Day One", id: 1055511498
mas "Evernote", id: 406056744
mas "Evernote Web Clipper", id: 1481669779
mas "GarageBand", id: 682658836
mas "iMovie", id: 408981434
mas "Keynote", id: 409183694
mas "My Net", id: 931314293
mas "Numbers", id: 409203825
mas "Pages", id: 409201541
mas "Parcel", id: 639968404
mas "PDFpen", id: 403624960
mas "ScreenFlow", id: 917790450
mas "Skitch", id: 425955336
mas "Slack", id: 803453959

View File

@ -1,29 +0,0 @@
## Steps to bootstrap a new Mac
1. Install Apple's Command Line Tools, which are prerequisites for Git and Homebrew.
```bash
xcode-select --install
```
2. Clone repo into new hidden directory.
```bash
# Use SSH (if set up)...
git clone git@github.com:jchenry/dotfiles.git ~/.config
# ...or use HTTPS and switch remotes later.
git clone https://github.com/jchenry/dotfiles.git ~/.config
```
3. run setup scripts
```bash
~/.config/scripts/acct.sh
~/.config/scripts/brew-setup.sh
~/.config/macos-defaults.sh
~/.config/bash/setup.sh
~/.config/tmux/setup.sh
~/.config/vscode/setup.sh
```

View File

@ -1,6 +0,0 @@
#!/usr/bin/env bash -eo pipefail
# Taken from: https://apple.stackexchange.com/questions/344401/how-to-programatically-set-terminal-theme-profile
theme=$(<theme.xml)
plutil -replace Window\ Settings.Dracula -xml "$theme" ~/Library/Preferences/com.apple.Terminal.plist
defaults write com.apple.Terminal "Default Window Settings" -string "DraculaTest"
defaults write com.apple.Terminal "Startup Window Settings" -string "DraculaTest"

View File

@ -1,195 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBlackColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMS
AAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVRyb290gAGjCwwTVSRudWxs0w0ODxARElVO
U1JHQlxOU0NvbG9yU3BhY2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pOLVJlZ3VsYXLSFxgZGlokY2xhc3NuYW1lWCRjbGFzc2VzVk5TRm9udKIZ
G1hOU09iamVjdAgRGiQpMjdJTFFTWF5nbnd+hY6QkpSqr7rDys0AAAAAAAABAQAAAAAA
AAAcAAAAAAAAAAAAAAAAAAAA1g==
</data>
<key>FontAntialias</key>
<true/>
<key>ProfileCurrentVersion</key>
<real>2.0699999999999998</real>
<key>SelectionColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMS
AAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVRyb290gAGjCwwTVSRudWxs0w0ODxARElVO
U1JHQlxOU0NvbG9yU3BhY2VWJGNsYXNzTxAnMC4yNjY2NjY2ODA2IDAuMjc4NDMxMzg1
OCAwLjM1Mjk0MTE4NTIAEAGAAtIUFRYXWiRjbGFzc25hbWVYJGNsYXNzZXNXTlNDb2xv
cqIWGFhOU09iamVjdAgRGiQpMjdJTFFTV11kand+qKqssbzFzdAAAAAAAAABAQAAAAAA
AAAZAAAAAAAAAAAAAAAAAAAA2Q==
</data>
<key>TextBoldColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMS
AAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVRyb290gAGjCwwTVSRudWxs0w0ODxARElVO
U1JHQlxOU0NvbG9yU3BhY2VWJGNsYXNzTxAcMC40MTk2MDc4NDMxIDAuNDU4ODIzNTI5
NCAxABABgALSFBUWF1okY2xhc3NuYW1lWCRjbGFzc2VzV05TQ29sb3KiFhhYTlNPYmpl
Y3QIERokKTI3SUxRU1ddZGp3fp2foaaxusLFAAAAAAAAAQEAAAAAAAAAGQAAAAAAAAAA
AAAAAAAAAM4=
</data>
<key>TextColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMS
AAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVRyb290gAGjCwwTVSRudWxs0w0ODxARElVO
U1JHQlxOU0NvbG9yU3BhY2VWJGNsYXNzRjEgMSAxABABgALSFBUWF1okY2xhc3NuYW1l
WCRjbGFzc2VzV05TQ29sb3KiFhhYTlNPYmplY3QIERokKTI3SUxRU1ddZGp3foWHiY6Z
oqqtAAAAAAAAAQEAAAAAAAAAGQAAAAAAAAAAAAAAAAAAALY=
</data>
<key>name</key>
<string>Dracula</string>
<key>type</key>
<string>Window Settings</string>
</dict>
</plist>

View File

@ -1,9 +1,9 @@
#!/usr/bin/env bash -eo pipefail
ACCT=`whoami`
read -p "email: " EMAIL
# change default shell back to bash
chsh -s /bin/bash $ACCT
# Generate keypair for use with github
ssh-keygen -o -a 100 -t ed25519 -f $HOME/.ssh/id_ed25519 -C "$EMAIL"
ssh-keygen -o -a 100 -t ed25519 -f $HOME/.ssh/id_ed25519 -C "colin@jchenry.me"

View File

@ -1,5 +1,6 @@
export BASH_SILENCE_DEPRECATION_WARNING=1
BASHRC_D=~/.config/bash/rc.d
BASHRC_D=~/.config/bashrc.d
[[ -r ${BASHRC_D}/bootstrap ]] && . ${BASHRC_D}/bootstrap
. $XDG_CONFIG_HOME/bash/sandboxes/sandbox.sh

View File

@ -1,2 +0,0 @@
export PATH=$PATH:/opt/homebrew/bin
export PATH=/usr/local/sbin:$PATH

View File

@ -1,3 +0,0 @@
export SPACESHIP_HOST_SHOW=always
export SPACESHIP_USER_SHOW=always
eval "$(starship init bash)"

View File

@ -1,2 +0,0 @@
export JAVA_HOME=$HOME/Library/Java/JavaVirtualMachines/openjdk-18.0.2.1/Contents/Home
export PATH=$PATH:$JAVA_HOME/bin

View File

@ -1,2 +0,0 @@
export PATH=$PATH:/usr/local/terraform

BIN
bash/sandboxes/.DS_Store vendored Executable file

Binary file not shown.

16
bash/sandboxes/Makefile.core Executable file
View File

@ -0,0 +1,16 @@
#
# All the common tasks
#
build:
docker build --tag=$(TAG) .
echo "Build $(TAG) Complete"
clean:
docker rmi $(TAG)
bash:
docker run --rm -it $(TAG) bash
push:
docker push $(TAG)

BIN
bash/sandboxes/goshell/.DS_Store vendored Executable file

Binary file not shown.

View File

@ -0,0 +1,72 @@
FROM docker:18.09.7-dind
# # set up nsswitch.conf for Go's "netgo" implementation
# # - https://github.com/golang/go/blob/go1.9.1/src/net/conf.go#L194-L275
# # - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf
# RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
ENV GOLANG_VERSION 1.13.5
RUN set -eux; \
apk add --no-cache --virtual .build-deps \
bash \
gcc \
musl-dev \
openssl \
go \
; \
export \
# set GOROOT_BOOTSTRAP such that we can actually build Go
GOROOT_BOOTSTRAP="$(go env GOROOT)" \
# ... and set "cross-building" related vars to the installed system's values so that we create a build targeting the proper arch
# (for example, if our build host is GOARCH=amd64, but our build env/image is GOARCH=386, our build needs GOARCH=386)
GOOS="$(go env GOOS)" \
GOARCH="$(go env GOARCH)" \
GOHOSTOS="$(go env GOHOSTOS)" \
GOHOSTARCH="$(go env GOHOSTARCH)" \
; \
# also explicitly set GO386 and GOARM if appropriate
# https://github.com/docker-library/golang/issues/184
apkArch="$(apk --print-arch)"; \
case "$apkArch" in \
armhf) export GOARM='6' ;; \
x86) export GO386='387' ;; \
esac; \
\
wget -O go.tgz "https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz"; \
echo '27d356e2a0b30d9983b60a788cf225da5f914066b37a6b4f69d457ba55a626ff *go.tgz' | sha256sum -c -; \
tar -C /usr/local -xzf go.tgz; \
rm go.tgz; \
\
cd /usr/local/go/src; \
./make.bash; \
\
rm -rf \
# https://github.com/golang/go/blob/0b30cf534a03618162d3015c8705dd2231e34703/src/cmd/dist/buildtool.go#L121-L125
/usr/local/go/pkg/bootstrap \
# https://golang.org/cl/82095
# https://github.com/golang/build/blob/e3fe1605c30f6a3fd136b561569933312ede8782/cmd/release/releaselet.go#L56
/usr/local/go/pkg/obj \
; \
apk del .build-deps; \
\
export PATH="/usr/local/go/bin:$PATH"; \
go version
ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
WORKDIR $GOPATH
RUN apk add --no-cache shadow bash docker-cli
RUN sed -i 's/^CREATE_MAIL_SPOOL=yes/CREATE_MAIL_SPOOL=no/' /etc/default/useradd
ADD scripts/startup.sh /startup.sh
RUN chmod +x /startup.sh
RUN mkdir /project
WORKDIR /project
ENTRYPOINT ["/startup.sh"]

View File

@ -0,0 +1,153 @@
# Go cross compiler (xgo): Base cross-compilation layer
# Copyright (c) 2014 Péter Szilágyi. All rights reserved.
#
# Released under the MIT license.
FROM ubuntu:16.04
MAINTAINER Péter Szilágyi <peterke@gmail.com>
# Mark the image as xgo enabled to support xgo-in-xgo
ENV XGO_IN_XGO 1
# Configure the Go environment, since it's not going to change
ENV PATH /usr/local/go/bin:$PATH
ENV GOPATH /go
# Inject the remote file fetcher and checksum verifier
ADD scripts/fetch.sh /fetch.sh
ENV FETCH /fetch.sh
RUN chmod +x $FETCH
# Make sure apt-get is up to date and dependent packages are installed
RUN \
apt-get update && \
apt-get install -y automake autogen build-essential ca-certificates \
gcc-5-arm-linux-gnueabi g++-5-arm-linux-gnueabi libc6-dev-armel-cross \
gcc-5-arm-linux-gnueabihf g++-5-arm-linux-gnueabihf libc6-dev-armhf-cross \
gcc-5-aarch64-linux-gnu g++-5-aarch64-linux-gnu libc6-dev-arm64-cross \
gcc-5-mips-linux-gnu g++-5-mips-linux-gnu libc6-dev-mips-cross \
gcc-5-mipsel-linux-gnu g++-5-mipsel-linux-gnu libc6-dev-mipsel-cross \
gcc-5-mips64-linux-gnuabi64 g++-5-mips64-linux-gnuabi64 libc6-dev-mips64-cross \
gcc-5-mips64el-linux-gnuabi64 g++-5-mips64el-linux-gnuabi64 libc6-dev-mips64el-cross \
gcc-5-multilib g++-5-multilib gcc-mingw-w64 g++-mingw-w64 clang llvm-dev \
libtool libxml2-dev uuid-dev libssl-dev swig openjdk-8-jdk pkg-config patch \
make xz-utils cpio wget zip unzip p7zip git mercurial bzr texinfo help2man \
--no-install-recommends
# Fix any stock package issues
RUN ln -s /usr/include/asm-generic /usr/include/asm
# Configure the container for OSX cross compilation
ENV OSX_SDK MacOSX10.11.sdk
ENV OSX_NDK_X86 /usr/local/osx-ndk-x86
RUN \
OSX_SDK_PATH=https://s3.dockerproject.org/darwin/v2/$OSX_SDK.tar.xz && \
$FETCH $OSX_SDK_PATH dd228a335194e3392f1904ce49aff1b1da26ca62 && \
\
git clone https://github.com/tpoechtrager/osxcross.git && \
mv `basename $OSX_SDK_PATH` /osxcross/tarballs/ && \
\
sed -i -e 's|-march=native||g' /osxcross/build_clang.sh /osxcross/wrapper/build.sh && \
UNATTENDED=yes OSX_VERSION_MIN=10.6 /osxcross/build.sh && \
mv /osxcross/target $OSX_NDK_X86 && \
\
rm -rf /osxcross
ADD scripts/patch.tar.xz $OSX_NDK_X86/SDK/$OSX_SDK/usr/include/c++
ENV PATH $OSX_NDK_X86/bin:$PATH
# # Configure the container for iOS cross compilation
# ENV IOS_NDK_ARM_7 /usr/local/ios-ndk-arm-7
# ENV IOS_NDK_ARM64 /usr/local/ios-ndk-arm64
# ENV IOS_SIM_NDK_AMD64 /usr/local/ios-sim-ndk-amd64
# ADD scripts/update_ios.sh /update_ios.sh
# ENV UPDATE_IOS /update_ios.sh
# RUN chmod +x $UPDATE_IOS
# RUN \
# IOS_SDK_PATH=https://sdks.website/dl/iPhoneOS9.3.sdk.tbz2 && \
# $FETCH $IOS_SDK_PATH db5ecf91617abf26d3db99e769bd655b943905e5 && \
# mv `basename $IOS_SDK_PATH` iPhoneOS9.3.sdk.tar.bz2 && \
# $UPDATE_IOS /iPhoneOS9.3.sdk.tar.bz2 && \
# rm -rf /iPhoneOS9.3.sdk.tar.bz2
# # Configure the container for Android cross compilation
# ENV ANDROID_NDK android-ndk-r11c
# ENV ANDROID_NDK_PATH http://dl.google.com/android/repository/$ANDROID_NDK-linux-x86_64.zip
# ENV ANDROID_NDK_ROOT /usr/local/$ANDROID_NDK
# ENV ANDROID_NDK_LIBC $ANDROID_NDK_ROOT/sources/cxx-stl/gnu-libstdc++/4.9
# ENV ANDROID_PLATFORM 21
# ENV ANDROID_CHAIN_ARM arm-linux-androideabi-4.9
# ENV ANDROID_CHAIN_ARM64 aarch64-linux-android-4.9
# ENV ANDROID_CHAIN_386 x86-4.9
# RUN \
# $FETCH $ANDROID_NDK_PATH de5ce9bddeee16fb6af2b9117e9566352aa7e279 && \
# unzip `basename $ANDROID_NDK_PATH` \
# "$ANDROID_NDK/build/*" \
# "$ANDROID_NDK/sources/cxx-stl/gnu-libstdc++/4.9/include/*" \
# "$ANDROID_NDK/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi*/*" \
# "$ANDROID_NDK/sources/cxx-stl/gnu-libstdc++/4.9/libs/arm64*/*" \
# "$ANDROID_NDK/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/*" \
# "$ANDROID_NDK/prebuilt/linux-x86_64/*" \
# "$ANDROID_NDK/platforms/*/arch-arm/*" \
# "$ANDROID_NDK/platforms/*/arch-arm64/*" \
# "$ANDROID_NDK/platforms/*/arch-x86/*" \
# "$ANDROID_NDK/toolchains/$ANDROID_CHAIN_ARM/*" \
# "$ANDROID_NDK/toolchains/$ANDROID_CHAIN_ARM64/*" \
# "$ANDROID_NDK/toolchains/$ANDROID_CHAIN_386/*" -d /usr/local > /dev/null && \
# rm -f `basename $ANDROID_NDK_PATH`
# ENV PATH /usr/$ANDROID_CHAIN_ARM/bin:$PATH
# ENV PATH /usr/$ANDROID_CHAIN_ARM64/bin:$PATH
# ENV PATH /usr/$ANDROID_CHAIN_386/bin:$PATH
# Inject the old Go package downloader and tool-chain bootstrapper
ADD scripts/bootstrap.sh /bootstrap.sh
ENV BOOTSTRAP /bootstrap.sh
RUN chmod +x $BOOTSTRAP
# Inject the new Go root distribution downloader and bootstrapper
ADD scripts/bootstrap_pure.sh /bootstrap_pure.sh
ENV BOOTSTRAP_PURE /bootstrap_pure.sh
RUN chmod +x $BOOTSTRAP_PURE
# Inject the Go source distribution downloader and bootstrapper
ADD scripts/bootstrap_repo.sh /bootstrap_repo.sh
ENV BOOTSTRAP_REPO /bootstrap_repo.sh
RUN chmod +x $BOOTSTRAP_REPO
# Inject the C dependency cross compiler
ADD scripts/build_deps.sh /build_deps.sh
ENV BUILD_DEPS /build_deps.sh
RUN chmod +x $BUILD_DEPS
# Inject the container entry point, the build script
ADD scripts/build.sh /build.sh
ENV BUILD /build.sh
# RUN chmod +x $BUILD
# ENTRYPOINT ["/build.sh"]
ENV GO_VERSION 1111
RUN \
export ROOT_DIST=https://storage.googleapis.com/golang/go1.11.5.linux-amd64.tar.gz && \
export ROOT_DIST_SHA=ff54aafedff961eb94792487e827515da683d61a5f9482f668008832631e5d25 && \
\
$BOOTSTRAP_PURE
ADD scripts/startup.sh /startup.sh
RUN chmod +x /startup.sh
RUN mkdir /project
WORKDIR /project
ENTRYPOINT ["/startup.sh"]

16
bash/sandboxes/goshell/Makefile Executable file
View File

@ -0,0 +1,16 @@
#
# Build tasks for this Dockerfile
#
TAG=jchenry/goshell
include ../Makefile.core
bash:
docker run --rm -it --privileged -v /var/run/docker.sock:/var/run/docker.sock $(TAG) bash
# clean:
# $(MAKE) -f Makefile.common $@
# rm whatever additional things

View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
#includes for go zsh config
function goshell() {
__docker_bash "goshell" "/project"
}

View File

@ -0,0 +1,71 @@
#!/bin/bash
#
# Contains the Go tool-chain bootstrapper, that retrieves all the configured
# distribution packages, extracts the binaries and deletes anything not needed.
#
# Usage: bootstrap.sh
#
# Needed environment variables:
# FETCH - Remote file fetcher and checksum verifier (injected by image)
# DIST_LINUX_64, DIST_LINUX_64_SHA - 64 bit Linux Go binaries and checksum
# DIST_LINUX_32, DIST_LINUX_32_SHA - 32 bit Linux Go binaries and checksum
# DIST_LINUX_ARM, DIST_LINUX_ARM_SHA - ARM v5 Linux Go binaries and checksum
# DIST_OSX_64, DIST_OSX_64_SHA - 64 bit Mac OSX Go binaries and checksum
# DIST_OSX_32, DIST_OSX_32_SHA - 32 bit Mac OSX Go binaries and checksum
# DIST_WIN_64, DIST_WIN_64_SHA - 64 bit Windows Go binaries and checksum
# DIST_WIN_32, DIST_WIN_32_SHA - 32 bit Windows Go binaries and checksum
set -e
# Download and verify all the binary packages
$FETCH $DIST_LINUX_64 $DIST_LINUX_64_SHA
$FETCH $DIST_LINUX_32 $DIST_LINUX_32_SHA
$FETCH $DIST_LINUX_ARM $DIST_LINUX_ARM_SHA
$FETCH $DIST_OSX_64 $DIST_OSX_64_SHA
$FETCH $DIST_OSX_32 $DIST_OSX_32_SHA
$FETCH $DIST_WIN_64 $DIST_WIN_64_SHA
$FETCH $DIST_WIN_32 $DIST_WIN_32_SHA
# Extract the 64 bit Linux package as the primary Go SDK
tar -C /usr/local -xzf `basename $DIST_LINUX_64`
rm -f `basename $DIST_LINUX_64`
export GOROOT=/usr/local/go
export GOROOT_BOOTSTRAP=$GOROOT
# Extract all other packages as secondary ones, keeping only the binaries
if [ "$DIST_LINUX_32" != "" ]; then
tar -C /usr/local --wildcards -xzf `basename $DIST_LINUX_32` go/pkg/linux_386*
GOOS=linux GOARCH=386 /usr/local/go/pkg/tool/linux_amd64/dist bootstrap
rm -f `basename $DIST_LINUX_32`
fi
if [ "$DIST_LINUX_ARM" != "" ]; then
tar -C /usr/local --wildcards -xzf `basename $DIST_LINUX_ARM` go/pkg/linux_arm*
GOOS=linux GOARCH=arm /usr/local/go/pkg/tool/linux_amd64/dist bootstrap
rm -f `basename $DIST_LINUX_ARM`
fi
if [ "$DIST_OSX_64" != "" ]; then
tar -C /usr/local --wildcards -xzf `basename $DIST_OSX_64` go/pkg/darwin_amd64*
GOOS=darwin GOARCH=amd64 /usr/local/go/pkg/tool/linux_amd64/dist bootstrap
rm -f `basename $DIST_OSX_64`
fi
if [ "$DIST_OSX_32" != "" ]; then
tar -C /usr/local --wildcards -xzf `basename $DIST_OSX_32` go/pkg/darwin_386*
GOOS=darwin GOARCH=386 /usr/local/go/pkg/tool/linux_amd64/dist bootstrap
rm -f `basename $DIST_OSX_32`
fi
if [ "$DIST_WIN_64" != "" ]; then
unzip -d /usr/local -q `basename $DIST_WIN_64` go/pkg/windows_amd64*
GOOS=windows GOARCH=amd64 /usr/local/go/pkg/tool/linux_amd64/dist bootstrap
rm -f `basename $DIST_WIN_64`
fi
if [ "$DIST_WIN_32" != "" ]; then
unzip -d /usr/local -q `basename $DIST_WIN_32` go/pkg/windows_386*
GOOS=windows GOARCH=386 /usr/local/go/pkg/tool/linux_amd64/dist bootstrap
rm -f `basename $DIST_WIN_32`
fi
# Install xgo within the container to enable internal cross compilation
echo "Installing xgo-in-xgo..."
go get -u github.com/karalabe/xgo

View File

@ -0,0 +1,67 @@
#!/bin/bash
#
# Contains the Go tool-chain pure-Go bootstrapper, that as of Go 1.5, initiates
# not only a few pre-built Go cross compilers, but rather bootstraps all of the
# supported platforms from the origin Linux amd64 distribution.
#
# Usage: bootstrap_pure.sh
#
# Environment variables for remote bootstrapping:
# FETCH - Remote file fetcher and checksum verifier (injected by image)
# ROOT_DIST - 64 bit Linux Go binary distribution package
# ROOT_DIST_SHA - 64 bit Linux Go distribution package checksum
#
# Environment variables for local bootstrapping:
# GOROOT - Path to the lready installed Go runtime
set -e
# Download, verify and install the root distribution if pulled remotely
if [ "$GOROOT" == "" ]; then
$FETCH $ROOT_DIST $ROOT_DIST_SHA
tar -C /usr/local -xzf `basename $ROOT_DIST`
rm -f `basename $ROOT_DIST`
export GOROOT=/usr/local/go
fi
export GOROOT_BOOTSTRAP=$GOROOT
# Pre-build all guest distributions based on the root distribution
echo "Bootstrapping linux/386..."
GOOS=linux GOARCH=386 CGO_ENABLED=1 go install std
echo "Bootstrapping linux/arm64..."
GOOS=linux GOARCH=arm64 CGO_ENABLED=1 CC=aarch64-linux-gnu-gcc-5 go install std
if [ $GO_VERSION -ge 170 ]; then
echo "Bootstrapping linux/mips64..."
GOOS=linux GOARCH=mips64 CGO_ENABLED=1 CC=mips64-linux-gnuabi64-gcc-5 go install std
echo "Bootstrapping linux/mips64le..."
GOOS=linux GOARCH=mips64le CGO_ENABLED=1 CC=mips64el-linux-gnuabi64-gcc-5 go install std
fi
if [ $GO_VERSION -ge 180 ]; then
echo "Bootstrapping linux/mips..."
GOOS=linux GOARCH=mips CGO_ENABLED=1 CC=mips-linux-gnu-gcc-5 go install std
echo "Bootstrapping linux/mipsle..."
GOOS=linux GOARCH=mipsle CGO_ENABLED=1 CC=mipsel-linux-gnu-gcc-5 go install std
fi
echo "Bootstrapping windows/amd64..."
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc go install std
echo "Bootstrapping windows/386..."
GOOS=windows GOARCH=386 CGO_ENABLED=1 CC=i686-w64-mingw32-gcc go install std
echo "Bootstrapping darwin/amd64..."
GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 CC=o64-clang go install std
echo "Bootstrapping darwin/386..."
GOOS=darwin GOARCH=386 CGO_ENABLED=1 CC=o32-clang go install std
# Install xgo within the container to enable internal cross compilation
echo "Installing xgo-in-xgo..."
go get -u github.com/karalabe/xgo
ln -s /go/bin/xgo /usr/bin/xgo

View File

@ -0,0 +1,35 @@
#!/bin/bash
#
# Contains the Go tool-chain source repository bootstrapper, that builds and
# bootstraps a Go environment from the official GitHub repository, opposed to
# using pre-build packages.
#
# Usage: bootstrap_repo.sh <branch>
#
# Needed environment variables:
# FETCH - Remote file fetcher and checksum verifier (injected by image)
set -e
# Define the paths to deploy the bootstrapper and the final distribution
export GOROOT=/usr/local/go
export GOROOT_BOOTSTRAP=${GOROOT}-boot
# Download and install the Go bootstrap distribution
BOOT_DIST=https://storage.googleapis.com/golang/go1.4.3.linux-amd64.tar.gz
BOOT_DIST_SHA=332b64236d30a8805fc8dd8b3a269915b4c507fe
$FETCH $BOOT_DIST $BOOT_DIST_SHA
tar -C /usr/local -xzf `basename $BOOT_DIST`
rm -f `basename $BOOT_DIST`
mv $GOROOT $GOROOT_BOOTSTRAP
# Download, build and install the requesed Go sources
(cd /usr/local && git clone https://go.googlesource.com/go)
(cd $GOROOT && git checkout $1)
(cd $GOROOT/src && ./make.bash)
rm -rf $GOROOT_BOOTSTRAP
export GOROOT_BOOTSTRAP=$GOROOT
$BOOTSTRAP_PURE

View File

@ -0,0 +1,629 @@
#!/bin/bash
#
# Contains the main cross compiler, that individually sets up each target build
# platform, compiles all the C dependencies, then build the requested executable
# itself.
#
# Usage: build.sh <import path>
#
# Needed environment variables:
# REPO_REMOTE - Optional VCS remote if not the primary repository is needed
# REPO_BRANCH - Optional VCS branch to use, if not the master branch
# DEPS - Optional list of C dependency packages to build
# ARGS - Optional arguments to pass to C dependency configure scripts
# PACK - Optional sub-package, if not the import path is being built
# OUT - Optional output prefix to override the package name
# FLAG_V - Optional verbosity flag to set on the Go builder
# FLAG_X - Optional flag to print the build progress commands
# FLAG_RACE - Optional race flag to set on the Go builder
# FLAG_TAGS - Optional tag flag to set on the Go builder
# FLAG_LDFLAGS - Optional ldflags flag to set on the Go builder
# FLAG_BUILDMODE - Optional buildmode flag to set on the Go builder
# TARGETS - Comma separated list of build targets to compile for
# GO_VERSION - Bootstrapped version of Go to disable uncupported targets
# EXT_GOPATH - GOPATH elements mounted from the host filesystem
# Define a function that figures out the binary extension
function extension {
if [ "$FLAG_BUILDMODE" == "archive" ] || [ "$FLAG_BUILDMODE" == "c-archive" ]; then
if [ "$1" == "windows" ]; then
echo ".lib"
else
echo ".a"
fi
elif [ "$FLAG_BUILDMODE" == "shared" ] || [ "$FLAG_BUILDMODE" == "c-shared" ]; then
if [ "$1" == "windows" ]; then
echo ".dll"
elif [ "$1" == "darwin" ] || [ "$1" == "ios" ]; then
echo ".dylib"
else
echo ".so"
fi
else
if [ "$1" == "windows" ]; then
echo ".exe"
fi
fi
}
# Either set a local build environemnt, or pull any remote imports
if [ "$EXT_GOPATH" != "" ]; then
# If local builds are requested, inject the sources
echo "Building locally $1..."
export GOPATH=$GOPATH:$EXT_GOPATH
set -e
# Find and change into the package folder
cd `go list -e -f {{.Dir}} $1`
export GOPATH=$GOPATH:`pwd`/Godeps/_workspace
else
# Inject all possible Godep paths to short circuit go gets
GOPATH_ROOT=$GOPATH/src
IMPORT_PATH=$1
while [ "$IMPORT_PATH" != "." ]; do
export GOPATH=$GOPATH:$GOPATH_ROOT/$IMPORT_PATH/Godeps/_workspace
IMPORT_PATH=`dirname $IMPORT_PATH`
done
# Otherwise download the canonical import path (may fail, don't allow failures beyond)
echo "Fetching main repository $1..."
go get -v -d $1
set -e
cd $GOPATH_ROOT/$1
# Switch over the code-base to another checkout if requested
if [ "$REPO_REMOTE" != "" ] || [ "$REPO_BRANCH" != "" ]; then
# Detect the version control system type
IMPORT_PATH=$1
while [ "$IMPORT_PATH" != "." ] && [ "$REPO_TYPE" == "" ]; do
if [ -d "$GOPATH_ROOT/$IMPORT_PATH/.git" ]; then
REPO_TYPE="git"
elif [ -d "$GOPATH_ROOT/$IMPORT_PATH/.hg" ]; then
REPO_TYPE="hg"
fi
IMPORT_PATH=`dirname $IMPORT_PATH`
done
if [ "$REPO_TYPE" == "" ]; then
echo "Unknown version control system type, cannot switch remotes and branches."
exit -1
fi
# If we have a valid VCS, execute the switch operations
if [ "$REPO_REMOTE" != "" ]; then
echo "Switching over to remote $REPO_REMOTE..."
if [ "$REPO_TYPE" == "git" ]; then
git remote set-url origin $REPO_REMOTE
git fetch --all
git reset --hard origin/HEAD
git clean -dxf
elif [ "$REPO_TYPE" == "hg" ]; then
echo -e "[paths]\ndefault = $REPO_REMOTE\n" >> .hg/hgrc
hg pull
fi
fi
if [ "$REPO_BRANCH" != "" ]; then
echo "Switching over to branch $REPO_BRANCH..."
if [ "$REPO_TYPE" == "git" ]; then
git reset --hard origin/$REPO_BRANCH
git clean -dxf
elif [ "$REPO_TYPE" == "hg" ]; then
hg checkout $REPO_BRANCH
fi
fi
fi
fi
# Download all the C dependencies
mkdir /deps
DEPS=($DEPS) && for dep in "${DEPS[@]}"; do
if [ "${dep##*.}" == "tar" ]; then cat "/deps-cache/`basename $dep`" | tar -C /deps -x; fi
if [ "${dep##*.}" == "gz" ]; then cat "/deps-cache/`basename $dep`" | tar -C /deps -xz; fi
if [ "${dep##*.}" == "bz2" ]; then cat "/deps-cache/`basename $dep`" | tar -C /deps -xj; fi
done
DEPS_ARGS=($ARGS)
# Save the contents of the pre-build /usr/local folder for post cleanup
USR_LOCAL_CONTENTS=`ls /usr/local`
# Configure some global build parameters
NAME=`basename $1/$PACK`
if [ "$OUT" != "" ]; then
NAME=$OUT
fi
if [ "$FLAG_V" == "true" ]; then V=-v; fi
if [ "$FLAG_X" == "true" ]; then X=-x; fi
if [ "$FLAG_RACE" == "true" ]; then R=-race; fi
if [ "$FLAG_TAGS" != "" ]; then T=(--tags "$FLAG_TAGS"); fi
if [ "$FLAG_LDFLAGS" != "" ]; then LD="$FLAG_LDFLAGS"; fi
if [ "$FLAG_BUILDMODE" != "" ] && [ "$FLAG_BUILDMODE" != "default" ]; then BM="--buildmode=$FLAG_BUILDMODE"; fi
# If no build targets were specified, inject a catch all wildcard
if [ "$TARGETS" == "" ]; then
TARGETS="./."
fi
# Build for each requested platform individually
for TARGET in $TARGETS; do
# Split the target into platform and architecture
XGOOS=`echo $TARGET | cut -d '/' -f 1`
XGOARCH=`echo $TARGET | cut -d '/' -f 2`
# Check and build for Android targets
if ([ $XGOOS == "." ] || [[ $XGOOS == android* ]]); then
# Split the platform version and configure the linker options
PLATFORM=`echo $XGOOS | cut -d '-' -f 2`
if [ "$PLATFORM" == "" ] || [ "$PLATFORM" == "." ] || [ "$PLATFORM" == "android" ]; then
PLATFORM=16 # Jelly Bean 4.0.0
fi
if [ "$PLATFORM" -ge 16 ]; then
CGO_CCPIE="-fPIE"
CGO_LDPIE="-fPIE"
EXT_LDPIE="-extldflags=-pie"
else
unset CGO_CCPIE CGO_LDPIE EXT_LDPIE
fi
mkdir -p /build-android-aar
# Iterate over the requested architectures, bootstrap and build
if [ $XGOARCH == "." ] || [ $XGOARCH == "arm" ] || [ $XGOARCH == "aar" ]; then
if [ "$GO_VERSION" -lt 150 ]; then
echo "Go version too low, skipping android-$PLATFORM/arm..."
else
# Include a linker workaround for pre Go 1.6 releases
if [ "$GO_VERSION" -lt 160 ]; then
EXT_LDAMD="-extldflags=-Wl,--allow-multiple-definition"
fi
echo "Assembling toolchain for android-$PLATFORM/arm..."
$ANDROID_NDK_ROOT/build/tools/make-standalone-toolchain.sh --ndk-dir=$ANDROID_NDK_ROOT --install-dir=/usr/$ANDROID_CHAIN_ARM --toolchain=$ANDROID_CHAIN_ARM --arch=arm > /dev/null 2>&1
echo "Bootstrapping android-$PLATFORM/arm..."
CC=arm-linux-androideabi-gcc GOOS=android GOARCH=arm GOARM=7 CGO_ENABLED=1 CGO_CFLAGS="$CGO_CCPIE" CGO_LDFLAGS="$CGO_LDPIE" go install std
echo "Compiling for android-$PLATFORM/arm..."
CC=arm-linux-androideabi-gcc CXX=arm-linux-androideabi-g++ HOST=arm-linux-androideabi PREFIX=/usr/$ANDROID_CHAIN_ARM/arm-linux-androideabi $BUILD_DEPS /deps ${DEPS_ARGS[@]}
export PKG_CONFIG_PATH=/usr/$ANDROID_CHAIN_ARM/arm-linux-androideabi/lib/pkgconfig
if [ $XGOARCH == "." ] || [ $XGOARCH == "arm" ]; then
CC=arm-linux-androideabi-gcc CXX=arm-linux-androideabi-g++ GOOS=android GOARCH=arm GOARM=7 CGO_ENABLED=1 CGO_CFLAGS="$CGO_CCPIE" CGO_CXXFLAGS="$CGO_CCPIE" CGO_LDFLAGS="$CGO_LDPIE" go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK
CC=arm-linux-androideabi-gcc CXX=arm-linux-androideabi-g++ GOOS=android GOARCH=arm GOARM=7 CGO_ENABLED=1 CGO_CFLAGS="$CGO_CCPIE" CGO_CXXFLAGS="$CGO_CCPIE" CGO_LDFLAGS="$CGO_LDPIE" go build $V $X "${T[@]}" --ldflags="$V $EXT_LDPIE $EXT_LDAMD $LD" $BM -o "/build/$NAME-android-$PLATFORM-arm`extension android`" ./$PACK
fi
if [ $XGOARCH == "." ] || [ $XGOARCH == "aar" ]; then
CC=arm-linux-androideabi-gcc CXX=arm-linux-androideabi-g++ GOOS=android GOARCH=arm GOARM=7 CGO_ENABLED=1 go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK
CC=arm-linux-androideabi-gcc CXX=arm-linux-androideabi-g++ GOOS=android GOARCH=arm GOARM=7 CGO_ENABLED=1 go build $V $X "${T[@]}" --ldflags="$V $EXT_LDAMD $LD" --buildmode=c-shared -o "/build-android-aar/$NAME-android-$PLATFORM-arm.so" ./$PACK
fi
fi
fi
if [ "$GO_VERSION" -lt 160 ]; then
echo "Go version too low, skipping android-$PLATFORM/386,arm64..."
else
if [ "$PLATFORM" -ge 9 ] && ([ $XGOARCH == "." ] || [ $XGOARCH == "386" ] || [ $XGOARCH == "aar" ]); then
echo "Assembling toolchain for android-$PLATFORM/386..."
$ANDROID_NDK_ROOT/build/tools/make-standalone-toolchain.sh --ndk-dir=$ANDROID_NDK_ROOT --install-dir=/usr/$ANDROID_CHAIN_386 --toolchain=$ANDROID_CHAIN_386 --arch=x86 > /dev/null 2>&1
echo "Bootstrapping android-$PLATFORM/386..."
CC=i686-linux-android-gcc GOOS=android GOARCH=386 CGO_ENABLED=1 CGO_CFLAGS="$CGO_CCPIE" CGO_LDFLAGS="$CGO_LDPIE" go install std
echo "Compiling for android-$PLATFORM/386..."
CC=i686-linux-android-gcc CXX=i686-linux-android-g++ HOST=i686-linux-android PREFIX=/usr/$ANDROID_CHAIN_386/i686-linux-android $BUILD_DEPS /deps ${DEPS_ARGS[@]}
export PKG_CONFIG_PATH=/usr/$ANDROID_CHAIN_386/i686-linux-android/lib/pkgconfig
if [ $XGOARCH == "." ] || [ $XGOARCH == "386" ]; then
CC=i686-linux-android-gcc CXX=i686-linux-android-g++ GOOS=android GOARCH=386 CGO_ENABLED=1 CGO_CFLAGS="$CGO_CCPIE" CGO_CXXFLAGS="$CGO_CCPIE" CGO_LDFLAGS="$CGO_LDPIE" go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK
CC=i686-linux-android-gcc CXX=i686-linux-android-g++ GOOS=android GOARCH=386 CGO_ENABLED=1 CGO_CFLAGS="$CGO_CCPIE" CGO_CXXFLAGS="$CGO_CCPIE" CGO_LDFLAGS="$CGO_LDPIE" go build $V $X "${T[@]}" --ldflags="$V $EXT_LDPIE $LD" $BM -o "/build/$NAME-android-$PLATFORM-386`extension android`" ./$PACK
fi
if [ $XGOARCH == "." ] || [ $XGOARCH == "aar" ]; then
CC=i686-linux-android-gcc CXX=i686-linux-android-g++ GOOS=android GOARCH=386 CGO_ENABLED=1 go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK
CC=i686-linux-android-gcc CXX=i686-linux-android-g++ GOOS=android GOARCH=386 CGO_ENABLED=1 go build $V $X "${T[@]}" --ldflags="$V $LD" --buildmode=c-shared -o "/build-android-aar/$NAME-android-$PLATFORM-386.so" ./$PACK
fi
fi
if [ "$PLATFORM" -ge 21 ] && ([ $XGOARCH == "." ] || [ $XGOARCH == "arm64" ] || [ $XGOARCH == "aar" ]); then
echo "Assembling toolchain for android-$PLATFORM/arm64..."
$ANDROID_NDK_ROOT/build/tools/make-standalone-toolchain.sh --ndk-dir=$ANDROID_NDK_ROOT --install-dir=/usr/$ANDROID_CHAIN_ARM64 --toolchain=$ANDROID_CHAIN_ARM64 --arch=arm64 > /dev/null 2>&1
echo "Bootstrapping android-$PLATFORM/arm64..."
CC=aarch64-linux-android-gcc GOOS=android GOARCH=arm64 CGO_ENABLED=1 CGO_CFLAGS="$CGO_CCPIE" CGO_LDFLAGS="$CGO_LDPIE" go install std
echo "Compiling for android-$PLATFORM/arm64..."
CC=aarch64-linux-android-gcc CXX=aarch64-linux-android-g++ HOST=aarch64-linux-android PREFIX=/usr/$ANDROID_CHAIN_ARM64/aarch64-linux-android $BUILD_DEPS /deps ${DEPS_ARGS[@]}
export PKG_CONFIG_PATH=/usr/$ANDROID_CHAIN_ARM64/aarch64-linux-android/lib/pkgconfig
if [ $XGOARCH == "." ] || [ $XGOARCH == "arm64" ]; then
CC=aarch64-linux-android-gcc CXX=aarch64-linux-android-g++ GOOS=android GOARCH=arm64 CGO_ENABLED=1 CGO_CFLAGS="$CGO_CCPIE" CGO_CXXFLAGS="$CGO_CCPIE" CGO_LDFLAGS="$CGO_LDPIE" go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK
CC=aarch64-linux-android-gcc CXX=aarch64-linux-android-g++ GOOS=android GOARCH=arm64 CGO_ENABLED=1 CGO_CFLAGS="$CGO_CCPIE" CGO_CXXFLAGS="$CGO_CCPIE" CGO_LDFLAGS="$CGO_LDPIE" go build $V $X "${T[@]}" --ldflags="$V $EXT_LDPIE $LD" $BM -o "/build/$NAME-android-$PLATFORM-arm64`extension android`" ./$PACK
fi
if [ $XGOARCH == "." ] || [ $XGOARCH == "aar" ]; then
CC=aarch64-linux-android-gcc CXX=aarch64-linux-android-g++ GOOS=android GOARCH=arm64 CGO_ENABLED=1 go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK
CC=aarch64-linux-android-gcc CXX=aarch64-linux-android-g++ GOOS=android GOARCH=arm64 CGO_ENABLED=1 go build $V $X "${T[@]}" --ldflags="$V $LD" --buildmode=c-shared -o "/build-android-aar/$NAME-android-$PLATFORM-arm64.so" ./$PACK
fi
fi
fi
# Assemble the Android Archive from the built shared libraries
if [ $XGOARCH == "." ] || [ $XGOARCH == "aar" ]; then
title=${NAME^}
archive=/build/$NAME-android-$PLATFORM-aar
bundle=/build/$NAME-android-$PLATFORM.aar
# Generate the Java import path based on the Go one
package=`go list ./$PACK | tr '-' '_'`
package=$(for p in `echo ${package//\// }`; do echo $p | awk 'BEGIN{FS="."}{for (i=NF; i>0; i--){printf "%s.", $i;}}'; done | sed 's/.$//')
package=${package%.*}
# Create a fresh empty Android archive
rm -rf $archive $bundle
mkdir -p $archive
echo -e "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" package=\"$package\">\n <uses-sdk android:minSdkVersion=\"$PLATFORM\"/>\n</manifest>" > $archive/AndroidManifest.xml
mkdir -p $archive/res
touch $archive/R.txt
# Generate the JNI wrappers automatically with SWIG
jni=`mktemp -d`
header=`find /build-android-aar | grep '\.h$' | head -n 1`
if [ "$header" == "" ]; then
echo "No API C header specified, skipping android-$PLATFORM/aar..."
else
cp $header $jni/$NAME.h
sed -i -e 's|__complex|complex|g' $jni/$NAME.h
sed -i -e 's|_Complex|complex|g' $jni/$NAME.h
echo -e "%module $title\n%{\n#include \"$NAME.h\"\n%}\n%pragma(java) jniclasscode=%{\nstatic {\nSystem.loadLibrary(\"$NAME\");\n}\n%}\n%include \"$NAME.h\"" > $jni/$NAME.i
mkdir -p $jni/${package//.//}
swig -java -package $package -outdir $jni/${package//.//} $jni/$NAME.i
# Assemble the Go static libraries and the JNI interface into shared libraries
for lib in `find /build-android-aar | grep '\.so$'`; do
if [[ "$lib" = *-arm.so ]]; then cc=arm-linux-androideabi-gcc; abi="armeabi-v7a"; fi
if [[ "$lib" = *-arm64.so ]]; then cc=aarch64-linux-android-gcc; abi="arm64-v8a"; fi
if [[ "$lib" = *-386.so ]]; then cc=i686-linux-android-gcc; abi="x86"; fi
mkdir -p $archive/jni/$abi
cp ${lib%.*}.h $jni/${NAME}.h
cp $lib $archive/jni/$abi/lib${NAME}raw.so
(cd $archive/jni/$abi && $cc -shared -fPIC -o lib${NAME}.so -I"$ANDROID_NDK_LIBC/include" -I"$ANDROID_NDK_LIBC/libs/$abi/include" -I"$jni" lib${NAME}raw.so $jni/${NAME}_wrap.c)
done
# Compile the Java wrapper and assemble into a .jar file
mkdir -p $jni/build
javac -target 1.7 -source 1.7 -cp . -d $jni/build $jni/${package//.//}/*.java
(cd $jni/build && jar cvf $archive/classes.jar *)
# Finally assemble the archive contents into an .aar and clean up
(cd $archive && zip -r $bundle *)
rm -rf $jni $archive
fi
fi
# Clean up the android builds, toolchains and runtimes
rm -rf /build-android-aar
rm -rf /usr/local/go/pkg/android_*
rm -rf /usr/$ANDROID_CHAIN_ARM /usr/$ANDROID_CHAIN_ARM64 /usr/$ANDROID_CHAIN_386
fi
# Check and build for Linux targets
if ([ $XGOOS == "." ] || [ $XGOOS == "linux" ]) && ([ $XGOARCH == "." ] || [ $XGOARCH == "amd64" ]); then
echo "Compiling for linux/amd64..."
HOST=x86_64-linux PREFIX=/usr/local $BUILD_DEPS /deps ${DEPS_ARGS[@]}
GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK
GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build $V $X "${T[@]}" --ldflags="$V $LD" $R $BM -o "/build/$NAME-linux-amd64$R`extension linux`" ./$PACK
fi
if ([ $XGOOS == "." ] || [ $XGOOS == "linux" ]) && ([ $XGOARCH == "." ] || [ $XGOARCH == "386" ]); then
echo "Compiling for linux/386..."
HOST=i686-linux PREFIX=/usr/local $BUILD_DEPS /deps ${DEPS_ARGS[@]}
GOOS=linux GOARCH=386 CGO_ENABLED=1 go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK
GOOS=linux GOARCH=386 CGO_ENABLED=1 go build $V $X "${T[@]}" --ldflags="$V $LD" $BM -o "/build/$NAME-linux-386`extension linux`" ./$PACK
fi
if ([ $XGOOS == "." ] || [ $XGOOS == "linux" ]) && ([ $XGOARCH == "." ] || [ $XGOARCH == "arm" ] || [ $XGOARCH == "arm-5" ]); then
if [ "$GO_VERSION" -ge 150 ]; then
echo "Bootstrapping linux/arm-5..."
CC=arm-linux-gnueabi-gcc-5 GOOS=linux GOARCH=arm GOARM=5 CGO_ENABLED=1 CGO_CFLAGS="-march=armv5" CGO_CXXFLAGS="-march=armv5" go install std
fi
echo "Compiling for linux/arm-5..."
CC=arm-linux-gnueabi-gcc-5 CXX=arm-linux-gnueabi-g++-5 HOST=arm-linux-gnueabi PREFIX=/usr/arm-linux-gnueabi CFLAGS="-march=armv5" CXXFLAGS="-march=armv5" $BUILD_DEPS /deps ${DEPS_ARGS[@]}
export PKG_CONFIG_PATH=/usr/arm-linux-gnueabi/lib/pkgconfig
CC=arm-linux-gnueabi-gcc-5 CXX=arm-linux-gnueabi-g++-5 GOOS=linux GOARCH=arm GOARM=5 CGO_ENABLED=1 CGO_CFLAGS="-march=armv5" CGO_CXXFLAGS="-march=armv5" go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK
CC=arm-linux-gnueabi-gcc-5 CXX=arm-linux-gnueabi-g++-5 GOOS=linux GOARCH=arm GOARM=5 CGO_ENABLED=1 CGO_CFLAGS="-march=armv5" CGO_CXXFLAGS="-march=armv5" go build $V $X "${T[@]}" --ldflags="$V $LD" $BM -o "/build/$NAME-linux-arm-5`extension linux`" ./$PACK
if [ "$GO_VERSION" -ge 150 ]; then
echo "Cleaning up Go runtime for linux/arm-5..."
rm -rf /usr/local/go/pkg/linux_arm
fi
fi
if ([ $XGOOS == "." ] || [ $XGOOS == "linux" ]) && ([ $XGOARCH == "." ] || [ $XGOARCH == "arm-6" ]); then
if [ "$GO_VERSION" -lt 150 ]; then
echo "Go version too low, skipping linux/arm-6..."
else
echo "Bootstrapping linux/arm-6..."
CC=arm-linux-gnueabi-gcc-5 GOOS=linux GOARCH=arm GOARM=6 CGO_ENABLED=1 CGO_CFLAGS="-march=armv6" CGO_CXXFLAGS="-march=armv6" go install std
echo "Compiling for linux/arm-6..."
CC=arm-linux-gnueabi-gcc-5 CXX=arm-linux-gnueabi-g++-5 HOST=arm-linux-gnueabi PREFIX=/usr/arm-linux-gnueabi CFLAGS="-march=armv6" CXXFLAGS="-march=armv6" $BUILD_DEPS /deps ${DEPS_ARGS[@]}
export PKG_CONFIG_PATH=/usr/arm-linux-gnueabi/lib/pkgconfig
CC=arm-linux-gnueabi-gcc-5 CXX=arm-linux-gnueabi-g++-5 GOOS=linux GOARCH=arm GOARM=6 CGO_ENABLED=1 CGO_CFLAGS="-march=armv6" CGO_CXXFLAGS="-march=armv6" go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK
CC=arm-linux-gnueabi-gcc-5 CXX=arm-linux-gnueabi-g++-5 GOOS=linux GOARCH=arm GOARM=6 CGO_ENABLED=1 CGO_CFLAGS="-march=armv6" CGO_CXXFLAGS="-march=armv6" go build $V $X "${T[@]}" --ldflags="$V $LD" $BM -o "/build/$NAME-linux-arm-6`extension linux`" ./$PACK
echo "Cleaning up Go runtime for linux/arm-6..."
rm -rf /usr/local/go/pkg/linux_arm
fi
fi
if ([ $XGOOS == "." ] || [ $XGOOS == "linux" ]) && ([ $XGOARCH == "." ] || [ $XGOARCH == "arm-7" ]); then
if [ "$GO_VERSION" -lt 150 ]; then
echo "Go version too low, skipping linux/arm-7..."
else
echo "Bootstrapping linux/arm-7..."
CC=arm-linux-gnueabihf-gcc-5 GOOS=linux GOARCH=arm GOARM=7 CGO_ENABLED=1 CGO_CFLAGS="-march=armv7-a" CGO_CXXFLAGS="-march=armv7-a" go install std
echo "Compiling for linux/arm-7..."
CC=arm-linux-gnueabihf-gcc-5 CXX=arm-linux-gnueabihf-g++-5 HOST=arm-linux-gnueabihf PREFIX=/usr/arm-linux-gnueabihf CFLAGS="-march=armv7-a -fPIC" CXXFLAGS="-march=armv7-a -fPIC" $BUILD_DEPS /deps ${DEPS_ARGS[@]}
export PKG_CONFIG_PATH=/usr/arm-linux-gnueabihf/lib/pkgconfig
CC=arm-linux-gnueabihf-gcc-5 CXX=arm-linux-gnueabihf-g++-5 GOOS=linux GOARCH=arm GOARM=7 CGO_ENABLED=1 CGO_CFLAGS="-march=armv7-a -fPIC" CGO_CXXFLAGS="-march=armv7-a -fPIC" go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK
CC=arm-linux-gnueabihf-gcc-5 CXX=arm-linux-gnueabihf-g++-5 GOOS=linux GOARCH=arm GOARM=7 CGO_ENABLED=1 CGO_CFLAGS="-march=armv7-a -fPIC" CGO_CXXFLAGS="-march=armv7-a -fPIC" go build $V $X "${T[@]}" --ldflags="$V $LD" $BM -o "/build/$NAME-linux-arm-7`extension linux`" ./$PACK
echo "Cleaning up Go runtime for linux/arm-7..."
rm -rf /usr/local/go/pkg/linux_arm
fi
fi
if ([ $XGOOS == "." ] || [ $XGOOS == "linux" ]) && ([ $XGOARCH == "." ] || [ $XGOARCH == "arm64" ]); then
if [ "$GO_VERSION" -lt 150 ]; then
echo "Go version too low, skipping linux/arm64..."
else
echo "Compiling for linux/arm64..."
CC=aarch64-linux-gnu-gcc-5 CXX=aarch64-linux-gnu-g++-5 HOST=aarch64-linux-gnu PREFIX=/usr/aarch64-linux-gnu $BUILD_DEPS /deps ${DEPS_ARGS[@]}
export PKG_CONFIG_PATH=/usr/aarch64-linux-gnu/lib/pkgconfig
CC=aarch64-linux-gnu-gcc-5 CXX=aarch64-linux-gnu-g++-5 GOOS=linux GOARCH=arm64 CGO_ENABLED=1 go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK
CC=aarch64-linux-gnu-gcc-5 CXX=aarch64-linux-gnu-g++-5 GOOS=linux GOARCH=arm64 CGO_ENABLED=1 go build $V $X "${T[@]}" --ldflags="$V $LD" $BM -o "/build/$NAME-linux-arm64`extension linux`" ./$PACK
fi
fi
if ([ $XGOOS == "." ] || [ $XGOOS == "linux" ]) && ([ $XGOARCH == "." ] || [ $XGOARCH == "mips64" ]); then
if [ "$GO_VERSION" -lt 170 ]; then
echo "Go version too low, skipping linux/mips64..."
else
echo "Compiling for linux/mips64..."
CC=mips64-linux-gnuabi64-gcc-5 CXX=mips64-linux-gnuabi64-g++-5 HOST=mips64-linux-gnuabi64 PREFIX=/usr/mips64-linux-gnuabi64 $BUILD_DEPS /deps ${DEPS_ARGS[@]}
export PKG_CONFIG_PATH=/usr/mips64-linux-gnuabi64/lib/pkgconfig
CC=mips64-linux-gnuabi64-gcc-5 CXX=mips64-linux-gnuabi64-g++-5 GOOS=linux GOARCH=mips64 CGO_ENABLED=1 go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK
CC=mips64-linux-gnuabi64-gcc-5 CXX=mips64-linux-gnuabi64-g++-5 GOOS=linux GOARCH=mips64 CGO_ENABLED=1 go build $V $X "${T[@]}" --ldflags="$V $LD" $BM -o "/build/$NAME-linux-mips64`extension linux`" ./$PACK
fi
fi
if ([ $XGOOS == "." ] || [ $XGOOS == "linux" ]) && ([ $XGOARCH == "." ] || [ $XGOARCH == "mips64le" ]); then
if [ "$GO_VERSION" -lt 170 ]; then
echo "Go version too low, skipping linux/mips64le..."
else
echo "Compiling for linux/mips64le..."
CC=mips64el-linux-gnuabi64-gcc-5 CXX=mips64el-linux-gnuabi64-g++-5 HOST=mips64el-linux-gnuabi64 PREFIX=/usr/mips64el-linux-gnuabi64 $BUILD_DEPS /deps ${DEPS_ARGS[@]}
export PKG_CONFIG_PATH=/usr/mips64le-linux-gnuabi64/lib/pkgconfig
CC=mips64el-linux-gnuabi64-gcc-5 CXX=mips64el-linux-gnuabi64-g++-5 GOOS=linux GOARCH=mips64le CGO_ENABLED=1 go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK
CC=mips64el-linux-gnuabi64-gcc-5 CXX=mips64el-linux-gnuabi64-g++-5 GOOS=linux GOARCH=mips64le CGO_ENABLED=1 go build $V $X "${T[@]}" --ldflags="$V $LD" $BM -o "/build/$NAME-linux-mips64le`extension linux`" ./$PACK
fi
fi
if ([ $XGOOS == "." ] || [ $XGOOS == "linux" ]) && ([ $XGOARCH == "." ] || [ $XGOARCH == "mips" ]); then
if [ "$GO_VERSION" -lt 180 ]; then
echo "Go version too low, skipping linux/mips..."
else
echo "Compiling for linux/mips..."
CC=mips-linux-gnu-gcc-5 CXX=mips-linux-gnu-g++-5 HOST=mips-linux-gnu PREFIX=/usr/mips-linux-gnu $BUILD_DEPS /deps ${DEPS_ARGS[@]}
export PKG_CONFIG_PATH=/usr/mips-linux-gnu/lib/pkgconfig
CC=mips-linux-gnu-gcc-5 CXX=mips-linux-gnu-g++-5 GOOS=linux GOARCH=mips CGO_ENABLED=1 go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK
CC=mips-linux-gnu-gcc-5 CXX=mips-linux-gnu-g++-5 GOOS=linux GOARCH=mips CGO_ENABLED=1 go build $V $X "${T[@]}" --ldflags="$V $LD" $BM -o "/build/$NAME-linux-mips`extension linux`" ./$PACK
fi
fi
if ([ $XGOOS == "." ] || [ $XGOOS == "linux" ]) && ([ $XGOARCH == "." ] || [ $XGOARCH == "mipsle" ]); then
if [ "$GO_VERSION" -lt 180 ]; then
echo "Go version too low, skipping linux/mipsle..."
else
echo "Compiling for linux/mipsle..."
CC=mipsel-linux-gnu-gcc-5 CXX=mipsel-linux-gnu-g++-5 HOST=mipsel-linux-gnu PREFIX=/usr/mipsel-linux-gnu $BUILD_DEPS /deps ${DEPS_ARGS[@]}
export PKG_CONFIG_PATH=/usr/mipsle-linux-gnu/lib/pkgconfig
CC=mipsel-linux-gnu-gcc-5 CXX=mipsel-linux-gnu-g++-5 GOOS=linux GOARCH=mipsle CGO_ENABLED=1 go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK
CC=mipsel-linux-gnu-gcc-5 CXX=mipsel-linux-gnu-g++-5 GOOS=linux GOARCH=mipsle CGO_ENABLED=1 go build $V $X "${T[@]}" --ldflags="$V $LD" $BM -o "/build/$NAME-linux-mipsle`extension linux`" ./$PACK
fi
fi
# Check and build for Windows targets
if [ $XGOOS == "." ] || [[ $XGOOS == windows* ]]; then
# Split the platform version and configure the Windows NT version
PLATFORM=`echo $XGOOS | cut -d '-' -f 2`
if [ "$PLATFORM" == "" ] || [ "$PLATFORM" == "." ] || [ "$PLATFORM" == "windows" ]; then
PLATFORM=4.0 # Windows NT
fi
MAJOR=`echo $PLATFORM | cut -d '.' -f 1`
if [ "${PLATFORM/.}" != "$PLATFORM" ] ; then
MINOR=`echo $PLATFORM | cut -d '.' -f 2`
fi
CGO_NTDEF="-D_WIN32_WINNT=0x`printf "%02d" $MAJOR``printf "%02d" $MINOR`"
# Build the requested windows binaries
if [ $XGOARCH == "." ] || [ $XGOARCH == "amd64" ]; then
echo "Compiling for windows-$PLATFORM/amd64..."
CC=x86_64-w64-mingw32-gcc-posix CXX=x86_64-w64-mingw32-g++-posix HOST=x86_64-w64-mingw32 PREFIX=/usr/x86_64-w64-mingw32 $BUILD_DEPS /deps ${DEPS_ARGS[@]}
export PKG_CONFIG_PATH=/usr/x86_64-w64-mingw32/lib/pkgconfig
CC=x86_64-w64-mingw32-gcc-posix CXX=x86_64-w64-mingw32-g++-posix GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CGO_CFLAGS="$CGO_NTDEF" CGO_CXXFLAGS="$CGO_NTDEF" go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK
CC=x86_64-w64-mingw32-gcc-posix CXX=x86_64-w64-mingw32-g++-posix GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CGO_CFLAGS="$CGO_NTDEF" CGO_CXXFLAGS="$CGO_NTDEF" go build $V $X "${T[@]}" --ldflags="$V $LD" $R $BM -o "/build/$NAME-windows-$PLATFORM-amd64$R`extension windows`" ./$PACK
fi
if [ $XGOARCH == "." ] || [ $XGOARCH == "386" ]; then
echo "Compiling for windows-$PLATFORM/386..."
CC=i686-w64-mingw32-gcc-posix CXX=i686-w64-mingw32-g++-posix HOST=i686-w64-mingw32 PREFIX=/usr/i686-w64-mingw32 $BUILD_DEPS /deps ${DEPS_ARGS[@]}
export PKG_CONFIG_PATH=/usr/i686-w64-mingw32/lib/pkgconfig
CC=i686-w64-mingw32-gcc-posix CXX=i686-w64-mingw32-g++-posix GOOS=windows GOARCH=386 CGO_ENABLED=1 CGO_CFLAGS="$CGO_NTDEF" CGO_CXXFLAGS="$CGO_NTDEF" go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK
CC=i686-w64-mingw32-gcc-posix CXX=i686-w64-mingw32-g++-posix GOOS=windows GOARCH=386 CGO_ENABLED=1 CGO_CFLAGS="$CGO_NTDEF" CGO_CXXFLAGS="$CGO_NTDEF" go build $V $X "${T[@]}" --ldflags="$V $LD" $BM -o "/build/$NAME-windows-$PLATFORM-386`extension windows`" ./$PACK
fi
fi
# Check and build for OSX targets
if [ $XGOOS == "." ] || [[ $XGOOS == darwin* ]]; then
# Split the platform version and configure the deployment target
PLATFORM=`echo $XGOOS | cut -d '-' -f 2`
if [ "$PLATFORM" == "" ] || [ "$PLATFORM" == "." ] || [ "$PLATFORM" == "darwin" ]; then
PLATFORM=10.6 # OS X Snow Leopard
fi
export MACOSX_DEPLOYMENT_TARGET=$PLATFORM
# Strip symbol table below Go 1.6 to prevent DWARF issues
LDSTRIP=""
if [ "$GO_VERSION" -lt 160 ]; then
LDSTRIP="-s"
fi
# Build the requested darwin binaries
if [ $XGOARCH == "." ] || [ $XGOARCH == "amd64" ]; then
echo "Compiling for darwin-$PLATFORM/amd64..."
CC=o64-clang CXX=o64-clang++ HOST=x86_64-apple-darwin15 PREFIX=/usr/local $BUILD_DEPS /deps ${DEPS_ARGS[@]}
CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go get $V $X "${T[@]}" --ldflags="$LDSTRIP $V $LD" -d ./$PACK
CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build $V $X "${T[@]}" --ldflags="$LDSTRIP $V $LD" $R $BM -o "/build/$NAME-darwin-$PLATFORM-amd64$R`extension darwin`" ./$PACK
fi
if [ $XGOARCH == "." ] || [ $XGOARCH == "386" ]; then
echo "Compiling for darwin-$PLATFORM/386..."
CC=o32-clang CXX=o32-clang++ HOST=i386-apple-darwin15 PREFIX=/usr/local $BUILD_DEPS /deps ${DEPS_ARGS[@]}
CC=o32-clang CXX=o32-clang++ GOOS=darwin GOARCH=386 CGO_ENABLED=1 go get $V $X "${T[@]}" --ldflags="$LDSTRIP $V $LD" -d ./$PACK
CC=o32-clang CXX=o32-clang++ GOOS=darwin GOARCH=386 CGO_ENABLED=1 go build $V $X "${T[@]}" --ldflags="$LDSTRIP $V $LD" $BM -o "/build/$NAME-darwin-$PLATFORM-386`extension darwin`" ./$PACK
fi
# Remove any automatically injected deployment target vars
unset MACOSX_DEPLOYMENT_TARGET
fi
# Check and build for iOS targets
if [ $XGOOS == "." ] || [[ $XGOOS == ios* ]]; then
# Split the platform version and configure the deployment target
PLATFORM=`echo $XGOOS | cut -d '-' -f 2`
if [ "$PLATFORM" == "" ] || [ "$PLATFORM" == "." ] || [ "$PLATFORM" == "ios" ]; then
PLATFORM=5.0 # first iPad and upwards
fi
export IPHONEOS_DEPLOYMENT_TARGET=$PLATFORM
# Build the requested iOS binaries
if [ "$GO_VERSION" -lt 150 ]; then
echo "Go version too low, skipping ios..."
else
# Add the 'ios' tag to all builds, otherwise the std libs will fail
if [ "$FLAG_TAGS" != "" ]; then
IOSTAGS=(--tags "ios $FLAG_TAGS")
else
IOSTAGS=(--tags ios)
fi
mkdir -p /build-ios-fw
# Strip symbol table below Go 1.6 to prevent DWARF issues
LDSTRIP=""
if [ "$GO_VERSION" -lt 160 ]; then
LDSTRIP="-s"
fi
# Cross compile to all available iOS and simulator platforms
if [ -d "$IOS_NDK_ARM_7" ] && ([ $XGOARCH == "." ] || [ $XGOARCH == "arm-7" ] || [ $XGOARCH == "framework" ]); then
echo "Bootstrapping ios-$PLATFORM/arm-7..."
export PATH=$IOS_NDK_ARM_7/bin:$PATH
GOOS=darwin GOARCH=arm GOARM=7 CGO_ENABLED=1 CC=arm-apple-darwin11-clang go install --tags ios std
echo "Compiling for ios-$PLATFORM/arm-7..."
CC=arm-apple-darwin11-clang CXX=arm-apple-darwin11-clang++ HOST=arm-apple-darwin11 PREFIX=/usr/local $BUILD_DEPS /deps ${DEPS_ARGS[@]}
CC=arm-apple-darwin11-clang CXX=arm-apple-darwin11-clang++ GOOS=darwin GOARCH=arm GOARM=7 CGO_ENABLED=1 go get $V $X "${IOSTAGS[@]}" --ldflags="$V $LD" -d ./$PACK
if [ $XGOARCH == "." ] || [ $XGOARCH == "arm-7" ]; then
CC=arm-apple-darwin11-clang CXX=arm-apple-darwin11-clang++ GOOS=darwin GOARCH=arm GOARM=7 CGO_ENABLED=1 go build $V $X "${IOSTAGS[@]}" --ldflags="$LDSTRIP $V $LD" $BM -o "/build/$NAME-ios-$PLATFORM-armv7`extension darwin`" ./$PACK
fi
if [ $XGOARCH == "." ] || [ $XGOARCH == "framework" ]; then
CC=arm-apple-darwin11-clang CXX=arm-apple-darwin11-clang++ GOOS=darwin GOARCH=arm GOARM=7 CGO_ENABLED=1 go build $V $X "${IOSTAGS[@]}" --ldflags="$V $LD" --buildmode=c-archive -o "/build-ios-fw/$NAME-ios-$PLATFORM-armv7.a" ./$PACK
fi
echo "Cleaning up Go runtime for ios-$PLATFORM/arm-7..."
rm -rf /usr/local/go/pkg/darwin_arm
fi
if [ -d "$IOS_NDK_ARM64" ] && ([ $XGOARCH == "." ] || [ $XGOARCH == "arm64" ] || [ $XGOARCH == "framework" ]); then
echo "Bootstrapping ios-$PLATFORM/arm64..."
export PATH=$IOS_NDK_ARM64/bin:$PATH
GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 CC=arm-apple-darwin11-clang go install --tags ios std
echo "Compiling for ios-$PLATFORM/arm64..."
CC=arm-apple-darwin11-clang CXX=arm-apple-darwin11-clang++ HOST=arm-apple-darwin11 PREFIX=/usr/local $BUILD_DEPS /deps ${DEPS_ARGS[@]}
CC=arm-apple-darwin11-clang CXX=arm-apple-darwin11-clang++ GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 go get $V $X "${IOSTAGS[@]}" --ldflags="$V $LD" -d ./$PACK
if [ $XGOARCH == "." ] || [ $XGOARCH == "arm64" ]; then
CC=arm-apple-darwin11-clang CXX=arm-apple-darwin11-clang++ GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 go build $V $X "${IOSTAGS[@]}" --ldflags="$LDSTRIP $V $LD" $BM -o "/build/$NAME-ios-$PLATFORM-arm64`extension darwin`" ./$PACK
fi
if [ $XGOARCH == "." ] || [ $XGOARCH == "framework" ]; then
CC=arm-apple-darwin11-clang CXX=arm-apple-darwin11-clang++ GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 go build $V $X "${IOSTAGS[@]}" --ldflags="$V $LD" --buildmode=c-archive -o "/build-ios-fw/$NAME-ios-$PLATFORM-arm64.a" ./$PACK
fi
echo "Cleaning up Go runtime for ios-$PLATFORM/arm64..."
rm -rf /usr/local/go/pkg/darwin_arm64
fi
if [ -d "$IOS_SIM_NDK_AMD64" ] && ([ $XGOARCH == "." ] || [ $XGOARCH == "amd64" ] || [ $XGOARCH == "framework" ]); then
echo "Bootstrapping ios-$PLATFORM/amd64..."
export PATH=$IOS_SIM_NDK_AMD64/bin:$PATH
mv /usr/local/go/pkg/darwin_amd64 /usr/local/go/pkg/darwin_amd64_bak
GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 CC=arm-apple-darwin11-clang go install --tags ios std
echo "Compiling for ios-$PLATFORM/amd64..."
CC=arm-apple-darwin11-clang CXX=arm-apple-darwin11-clang++ HOST=arm-apple-darwin11 PREFIX=/usr/local $BUILD_DEPS /deps ${DEPS_ARGS[@]}
CC=arm-apple-darwin11-clang CXX=arm-apple-darwin11-clang++ GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go get $V $X "${IOSTAGS[@]}" --ldflags="$V $LD" -d ./$PACK
if [ $XGOARCH == "." ] || [ $XGOARCH == "amd64" ]; then
CC=arm-apple-darwin11-clang CXX=arm-apple-darwin11-clang++ GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build $V $X "${IOSTAGS[@]}" --ldflags="$LDSTRIP $V $LD" $BM -o "/build/$NAME-ios-$PLATFORM-x86_64`extension darwin`" ./$PACK
fi
if [ $XGOARCH == "." ] || [ $XGOARCH == "framework" ]; then
CC=arm-apple-darwin11-clang CXX=arm-apple-darwin11-clang++ GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build $V $X "${IOSTAGS[@]}" --ldflags="$V $LD" --buildmode=c-archive -o "/build-ios-fw/$NAME-ios-$PLATFORM-x86_64.a" ./$PACK
fi
echo "Cleaning up Go runtime for ios-$PLATFORM/amd64..."
rm -rf /usr/local/go/pkg/darwin_amd64
mv /usr/local/go/pkg/darwin_amd64_bak /usr/local/go/pkg/darwin_amd64
fi
# Assemble the iOS framework from the built binaries
if [ $XGOARCH == "." ] || [ $XGOARCH == "framework" ]; then
title=${NAME^}
framework=/build/$NAME-ios-$PLATFORM-framework/$title.framework
rm -rf $framework
mkdir -p $framework/Versions/A
(cd $framework/Versions && ln -nsf A Current)
arches=()
for lib in `ls /build-ios-fw | grep -e '\.a$'`; do
arches+=("-arch" "`echo ${lib##*-} | cut -d '.' -f 1`" "/build-ios-fw/$lib")
done
arm-apple-darwin11-lipo -create "${arches[@]}" -o $framework/Versions/A/$title
arm-apple-darwin11-ranlib $framework/Versions/A/$title
(cd $framework && ln -nsf Versions/A/$title $title)
mkdir -p $framework/Versions/A/Headers
for header in `ls /build-ios-fw | grep -e '\.h$'`; do
cp -f /build-ios-fw/$header $framework/Versions/A/Headers/$title.h
done
(cd $framework && ln -nsf Versions/A/Headers Headers)
mkdir -p $framework/Versions/A/Resources
echo -e "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n</dict>\n</plist>" > $framework/Versions/A/Resources/Info.plist
(cd $framework && ln -nsf Versions/A/Resources Resources)
mkdir -p $framework/Versions/A/Modules
echo -e "framework module \"$title\" {\n header \"$title.h\"\n export *\n}" > $framework/Versions/A/Modules/module.modulemap
(cd $framework && ln -nsf Versions/A/Modules Modules)
chmod 777 -R /build/$NAME-ios-$PLATFORM-framework
fi
rm -rf /build-ios-fw
fi
# Remove any automatically injected deployment target vars
unset IPHONEOS_DEPLOYMENT_TARGET
fi
done
# Clean up any leftovers for subsequent build invocations
echo "Cleaning up build environment..."
rm -rf /deps
for dir in `ls /usr/local`; do
keep=0
# Check against original folder contents
for old in $USR_LOCAL_CONTENTS; do
if [ "$old" == "$dir" ]; then
keep=1
fi
done
# Delete anything freshly generated
if [ "$keep" == "0" ]; then
rm -rf "/usr/local/$dir"
fi
done

View File

@ -0,0 +1,27 @@
#!/bin/bash
#
# Contains the a dependency builder to iterate over all installed dependencies
# and cross compile them to the requested target platform.
#
# Usage: build_deps.sh <dependency folder> <configure arguments>
#
# Needed environment variables:
# CC - C cross compiler to use for the build
# HOST - Target platform to build (used to find the needed tool-chains)
# PREFIX - File-system path where to install the built binaries
set -e
# Remove any previous build leftovers, and copy a fresh working set (clean doesn't work for cross compiling)
rm -rf /deps-build && cp -r $1 /deps-build
# Build all the dependencies (no order for now)
for dep in `ls /deps-build`; do
echo "Configuring dependency $dep for $HOST..."
(cd /deps-build/$dep && ./configure --disable-shared --host=$HOST --prefix=$PREFIX --silent ${@:2})
echo "Building dependency $dep for $HOST..."
(cd /deps-build/$dep && make --silent -j install)
done
# Remove any build artifacts
rm -rf /deps-build

View File

@ -0,0 +1,27 @@
#!/bin/bash
#
# Contains a simple fetcher to download a file from a remote URL and verify its
# SHA1 or SHA256 checksum (selected based on provided length).
#
# Usage: fetch.sh <remote URL> <SHA1/SHA256 checksum>
set -e
# Skip the download if no operands specified
if [ "$1" == "" -o "$2" == "" ]; then
echo "Fetch operands missing, skipping..."
exit
fi
# Pull the file from the remote URL
file=`basename $1`
echo "Downloading $1..."
wget -q $1
# Generate a desired checksum report and check against it
echo "$2 $file" > $file.sum
if [ "${#2}" == "40" ]; then
sha1sum -c $file.sum
else
sha256sum -c $file.sum
fi
rm $file.sum

Binary file not shown.

View File

@ -0,0 +1,7 @@
#!/usr/bin/env sh
useradd $HOST_USER --home /home/$HOST_USER --gid $HOST_GID --uid $HOST_UID --shell /bin/bash
echo "$HOST_USER:pw" | chpasswd
chown $HOST_USER:$HOST_GID /home/$HOST_USER
su $HOST_USER
cd /project

View File

@ -0,0 +1,61 @@
#!/bin/bash
#
# Contains a simple tool that updates some of the iOS toolchains with the SDKs
# explicitly provided. The goal is to allow using your own up to date SDKs or
# the simulator one not supported out of the box.
#
# Usage: update_ios.sh <path to>/<iSomething><Version>.sdk.tar.<type>
set -e
# Figure out the base name of the SDK
sdk=`basename $1`
sdk=${sdk%.*}
sdk=${sdk%.*}
# Define a small extraction utility to
function extract {
case $1 in
*.tar.xz)
xz -dc $1 | tar xf -
;;
*.tar.gz)
gunzip -dc $1 | tar xf -
;;
*.tar.bz2)
bzip2 -dc $1 | tar xf -
;;
esac
}
# Extract the SDK, patch it, clean it up and prep for bootstrapping
extract $1
if [[ "`basename $1`" =~ ^iPhoneSimulator ]]; then
echo "Patching iOS simulator SDK with missing libraries..."
ln -s $OSX_NDK_X86/SDK/$OSX_SDK/usr/lib/system/libsystem_kernel.dylib $sdk/usr/lib/system/libsystem_kernel.dylib
ln -s $OSX_NDK_X86/SDK/$OSX_SDK/usr/lib/system/libsystem_platform.dylib $sdk/usr/lib/system/libsystem_platform.dylib
ln -s $OSX_NDK_X86/SDK/$OSX_SDK/usr/lib/system/libsystem_pthread.dylib $sdk/usr/lib/system/libsystem_pthread.dylib
ln -s $OSX_NDK_X86/SDK/$OSX_SDK/usr/lib/system/libsystem_kernel.tbd $sdk/usr/lib/system/libsystem_kernel.tbd
ln -s $OSX_NDK_X86/SDK/$OSX_SDK/usr/lib/system/libsystem_platform.tbd $sdk/usr/lib/system/libsystem_platform.tbd
ln -s $OSX_NDK_X86/SDK/$OSX_SDK/usr/lib/system/libsystem_pthread.tbd $sdk/usr/lib/system/libsystem_pthread.tbd
fi
tar -czf /tmp/$sdk.tar.gz $sdk
rm -rf $sdk
# Pull the iOS cross compiler tool and build the toolchain
git clone https://github.com/tpoechtrager/cctools-port.git
if [[ "`basename $1`" =~ ^iPhoneSimulator ]]; then
rm -rf $IOS_SIM_NDK_AMD64
/cctools-port/usage_examples/ios_toolchain/build.sh /tmp/$sdk.tar.gz x86_64
mv /cctools-port/usage_examples/ios_toolchain/target $IOS_SIM_NDK_AMD64
else
rm -rf $IOS_NDK_ARM_7 $IOS_NDK_ARM64
/cctools-port/usage_examples/ios_toolchain/build.sh /tmp/$sdk.tar.gz armv7
mv /cctools-port/usage_examples/ios_toolchain/target $IOS_NDK_ARM_7
/cctools-port/usage_examples/ios_toolchain/build.sh /tmp/$sdk.tar.gz arm64
mv /cctools-port/usage_examples/ios_toolchain/target $IOS_NDK_ARM64
fi
rm -rf /cctools-port

View File

@ -0,0 +1,21 @@
FROM ubuntu:18.04
MAINTAINER Colin Henry <colin@jchenry.me>
RUN apt-get update && \
apt-get install -y openssh-server curl wget gnupg
RUN curl https://cli-assets.heroku.com/install-ubuntu.sh | sh
#sshd setup - https://docs.docker.com/examples/running_ssh_service/
RUN mkdir /var/run/sshd
RUN echo 'root:pw' | chpasswd
RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile
EXPOSE 22
ADD startup.sh /root/startup.sh
RUN chmod +x /root/startup.sh

View File

@ -0,0 +1,7 @@
#
# Build tasks for this Dockerfile
#
TAG=jchenry/herokushell
include ../Makefile.core

View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
function herokushell() {
__docker_bash "herokushell" "/project"
}

View File

@ -0,0 +1,7 @@
#!/usr/bin/env sh
useradd $HOST_USER --home /home/$HOST_USER --gid $HOST_GID --uid $HOST_UID --shell /bin/bash
echo "$HOST_USER:pw" | chpasswd
chown $HOST_USER:$HOST_GID /home/$HOST_USER
su $HOST_USER
cd /project

View File

@ -0,0 +1,23 @@
#jchenry/jdk8shell
#
# Shell for Go development
FROM maven:3.5.2-jdk-8-slim
MAINTAINER Colin Henry <colin@jchenry.me>
RUN apt-get update && \
apt-get install -y openssh-server
#sshd setup - https://docs.docker.com/examples/running_ssh_service/
RUN mkdir /var/run/sshd
RUN echo 'root:pw' | chpasswd
RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile
EXPOSE 22
ADD startup.sh /root/startup.sh
RUN chmod +x /root/startup.sh

View File

@ -0,0 +1,7 @@
#
# Build tasks for this Dockerfile
#
TAG=jchenry/jdk8shell
include ../Makefile.core

View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
#includes for go zsh config
function jdk8shell() {
__docker_bash "jdk8shell" "/project"
}

View File

@ -0,0 +1,10 @@
#!/usr/bin/env sh
# groupadd --gid $HOST_GID $HOST_USER
useradd $HOST_USER --home /home/$HOST_USER --gid $HOST_GID --uid $HOST_UID --shell /bin/bash
echo "$HOST_USER:pw" | chpasswd
# chown $HOST_USER:$HOST_USER /home/$HOST_USER
# /usr/sbin/sshd
su $HOST_USER
cd /project

View File

@ -0,0 +1,34 @@
#markmandel/leinshell
#
# Shell for Clojure development, with Leiningen
FROM java:jdk
MAINTAINER Mark Mandel <mark.mandel@gmail.com>
RUN apt-get update && \
apt-get install -y zsh openssh-server
#sshd setup - https://docs.docker.com/examples/running_ssh_service/
RUN mkdir /var/run/sshd
RUN echo 'root:pw' | chpasswd
RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile
EXPOSE 22
#lein installation
ENV LEIN_ROOT=1
RUN cd /usr/local/bin/ && wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein && chmod +x ./lein
RUN lein
ADD startup.sh /root/startup.sh
RUN chmod +x /root/startup.sh
RUN mkdir /project
WORKDIR /project
#port for web apps
EXPOSE 8080

View File

@ -0,0 +1,7 @@
#
# Build tasks for this Dockerfile
#
TAG=jchenry/leinshell
include ../Makefile.core

View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
#includes for go zsh config
function leinshell() {
mkdir -p ~/.m2
__docker_bash "leinshell" "/project" \
"-v $SANDBOXES/leinshell/profiles.clj:/home/$USER/.lein/profiles.clj" \
"-v ~/.m2:/home/$USER/.m2" \
"-P=true"
}

View File

@ -0,0 +1 @@
{:user {:plugins [[lein-ancient "0.6.7"]]}}

View File

@ -0,0 +1,13 @@
#!/usr/bin/env sh
# groupadd --gid $HOST_GID $HOST_USER
useradd $HOST_USER --home /home/$HOST_USER --gid $HOST_GID --uid $HOST_UID --shell /bin/bash
echo "$HOST_USER:pw" | chpasswd
# chown $HOST_USER:$HOST_USER /home/$HOST_USER
#setup lein for this user
cp -r /root/.lein/* /home/$HOST_USER/.lein/
chown -R $HOST_USER:$HOST_USER /home/$HOST_USER/.lein
# /usr/sbin/sshd
su $HOST_USER
cd /project

View File

@ -0,0 +1,24 @@
#jchenry/nodeshell
#
# Shell for Node development
FROM node:17.0.1
MAINTAINER Colin Henry <colin@jchenry.me>
RUN apt-get update && \
apt-get install -y openssh-server
#sshd setup - https://docs.docker.com/examples/running_ssh_service/
RUN mkdir /var/run/sshd
RUN echo 'root:pw' | chpasswd
RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile
EXPOSE 22
ADD startup.sh /root/startup.sh
RUN chmod +x /root/startup.sh

View File

@ -0,0 +1,7 @@
#
# Build tasks for this Dockerfile
#
TAG=jchenry/nodeshell
include ../Makefile.core

View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
#includes for go zsh config
function nodeshell() {
__docker_bash "nodeshell" "/project"
}

136
bash/sandboxes/sandbox.sh Executable file
View File

@ -0,0 +1,136 @@
#!/usr/bin/env bash
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# a bash take on docker based dev sandboxes with apologies to Mark Mandel
__docker_bash () {
local shell=$1
local src=$2
local name=$shell${PWD//\//.}
printf "Starting Container: $shell \n"
_docker_run "--rm" \
"--name $name" \
"--hostname docker" \
"-P=true" \
"-e TERM" \
"-e HOST_GID=`id -g`" \
"-e HOST_UID=`id -u`" \
"-e HOST_USER=${USER}" \
"--privileged" \
"-v ~/.bash_history:/home/${USER}/.bash_history" \
"-v ~/.bash_profile:/home/${USER}/.bash_profile" \
"-v ~/.config:/home/${USER}/.config" \
"-v /var/run/docker.sock:/var/run/docker.sock" \
"-v `pwd`:${src}" \
${argv:3} \
"-it jchenry/$shell /root/startup.sh"
}
SANDBOXES=$SCRIPT_DIR
# Source all the shells
for p in $SANDBOXES/*; do
if [[ -d $p ]]; then
source $p/include.sh
fi
done
#Takes each argument and applies it to a docker run command
function _docker_run() {
# echo "docker run $@"
eval "docker run $@"
}
# #standard default docker zsh function
# function _docker_zsh() {
# local shell=$1
# local src=$2
# local name=$shell${${PWD//\//.}:-200} #make sure we stay under 255 chars
# echo "Starting Container: $name (${#name})"
# _docker_run "--rm" \
# "--name $name" \
# "-P=true" \
# "-e TERM" \
# "-e HOST_GID=`id -g`" \
# "-e HOST_UID=`id -u`" \
# "-e HOST_USER=$USER" \
# "-v ~/.oh-my-zsh:/home/$USER/.oh-my-zsh" \
# "-v ~/.dircolors:/home/$USER/.dircolors " \
# "-v ~/.zsh_history:/home/$USER/.zsh_history" \
# "-v $SANDBOXES/$shell/zshrc:/home/$USER/.zshrc" \
# "-v $SANDBOXES/core.zsh:/home/$USER/.core.zsh" \
# "-v `pwd`:$src" \
# ${argv:3} \
# "-it markmandel/$shell /root/startup.sh"
# }
function _get_docker_ssh_port() {
local name=$1
typeset -a port
port=(${(@s/:/)$(docker port $name 22)})
echo $port[2]
}
#ssh mount a docker container
function docker-ssh-mount() {
local name=$1
local mountpoint=/tmp/$name
local port=$(_get_docker_ssh_port $name)
mkdir -p $mountpoint
echo "Mounting on $port"
sshfs $USER@0.0.0.0:/ $mountpoint -p $port -o follow_symlinks
}
# # compdef __list_docker_containers docker-ssh-mount
# #attach a new zsh termainl to an already running shell
# function shell-attach() {
# docker exec -it -u=$USER $1 /usr/bin/zsh
# }
# # compdef __list_docker_containers shell-attach
# #Credit: _docker .oh-my-zsh plugin
# function __list_docker_containers() {
# declare -a cont_cmd
# cont_cmd=($(docker ps | awk 'NR>1{print $NF":[CON("$1")"$2"("$3")]"}'))
# if [[ 'X$cont_cmd' != 'X' ]]
# _describe 'containers' cont_cmd
# }
# alias dsm=docker-ssh-mount
# #Credit: https://github.com/jbbarth/dotfiles/blob/master/.zsh/docker.zsh
# function docker-cleanup() {
# echo "* Removing old containers"
# docker ps -qa | xargs --no-run-if-empty -n 1 docker rm
# echo "* Removing <none> images"
# docker images --filter dangling=true -q | xargs --no-run-if-empty -n 1 docker rmi
# }
# alias dc=docker-cleanup
# function docker-known-host-clear() {
# if [[ $1 == "" ]]; then
# echo "Container name not passed in" >&2
# return 1
# fi
# local name=$1
# local port=$(_get_docker_ssh_port $name)
# ssh-keygen -R 0.0.0.0:$port
# }
# # compdef __list_docker_containers docker-known-host-clear

7
bash/sandboxes/startup.sh Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env sh
useradd $HOST_USER --home /home/$HOST_USER --gid $HOST_GID --uid $HOST_UID --shell /bin/bash
echo "$HOST_USER:pw" | chpasswd
chown $HOST_USER:$HOST_GID /home/$HOST_USER
su $HOST_USER
cd /project

View File

@ -0,0 +1,65 @@
#jchenry/swiftshell
#
# Shell for Swift development
# learning the hard way
FROM swift:4.2
MAINTAINER Colin Henry <colin@jchenry.me>
RUN apt-get update && \
apt-get install -y openssh-server wget
#sshd setup - https://docs.docker.com/examples/running_ssh_service/
RUN mkdir /var/run/sshd
RUN echo 'root:pw' | chpasswd
RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile
EXPOSE 22
ADD startup.sh /root/startup.sh
RUN chmod +x /root/startup.sh
# FROM golang:1.9.2
# MAINTAINER Colin Henry <colin@jchenry.me>
# RUN apt-get update && \
# apt-get install -y openssh-server
# #sshd setup - https://docs.docker.com/examples/running_ssh_service/
# RUN mkdir /var/run/sshd
# RUN echo 'root:pw' | chpasswd
# RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# # SSH login fix. Otherwise user is kicked off after login
# RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
# ENV NOTVISIBLE "in users profile"
# RUN echo "export VISIBLE=now" >> /etc/profile
# EXPOSE 22
# # RUN go get github.com/constabulary/gb/...
# # RUN go get github.com/golang/lint/golint
# # RUN go get golang.org/x/tools/cmd/goimports
# # RUN mv ./bin/* /usr/local/bin
# # RUN rm -rf /go
# ADD startup.sh /root/startup.sh
# RUN chmod +x /root/startup.sh

View File

@ -0,0 +1,7 @@
#
# Build tasks for this Dockerfile
#
TAG=jchenry/swiftshell
include ../Makefile.core

View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
#includes for go zsh config
function swift-shell() {
__docker_bash "swiftshell" "/workspace"
}

View File

@ -0,0 +1,9 @@
#!/usr/bin/env sh
# groupadd --gid $HOST_GID $HOST_USER
useradd $HOST_USER --home /home/$HOST_USER --gid $HOST_GID --uid $HOST_UID --shell /bin/bash
echo "$HOST_USER:pw" | chpasswd
# chown $HOST_USER:$HOST_USER /home/$HOST_USER
# /usr/sbin/sshd
su $HOST_USER
cd /project

View File

@ -1,2 +0,0 @@
echo "source .config/bash/bash_profile" >> ~/.bashrc
echo "source .config/bash/bash_profile" >> ~/.bash_profile

5
bashrc.d/000-ps1.sh Normal file
View File

@ -0,0 +1,5 @@
if [ -z "$PS1" ]; then
return
fi
export PS1='${c_user}\u${c_reset}@${c_user}\h${c_reset}:${c_path}\w${c_reset}$(git_prompt)\n\$ '

33
bashrc.d/002-git-prompt.sh Executable file
View File

@ -0,0 +1,33 @@
# Configure colors, if available.
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
c_reset=`tput sgr0`
c_user=`tput setaf 8`
c_path=`tput setaf 8`
c_git_clean=`tput setaf 2`
c_git_dirty=`tput setaf 1`
else
c_reset=
c_user=
c_git_cleancleann_path=
c_git_clean=
c_git_dirty=
fi
# Function to assemble the Git parsingart of our prompt.
git_prompt ()
{
if ! git rev-parse --git-dir > /dev/null 2>&1; then
return 0
fi
git_branch=$(git branch 2>/dev/null | sed -n '/^\*/s/^\* //p')
if git diff --quiet 2>/dev/null >&2; then
git_color="$c_git_clean"
else
git_color="$c_git_dirty"
fi
echo "[$git_color$git_branch${c_reset}]"
}
function tabc() {
NAME=$1; if [ -z "$NAME" ]; then NAME="Default"; fi
osascript -e "tell application \"Terminal\" to set current settings of front window to settings set \"$NAME\""
}

19
bashrc.d/004-open_github.sh Executable file
View File

@ -0,0 +1,19 @@
# Opens the github page for the current git repository in your browser
# git@github.com:jasonneylon/dotfiles.git
# https://github.com/jasonneylon/dotfiles/
function gh() {
giturl=$(git config --get remote.origin.url)
if [ "$giturl" == "" ]
then
echo "Not a git repository or no remote.origin.url set"
exit 1;
fi
giturl=${giturl/git\@github\.com\:/https://github.com/}
giturl=${giturl/\.git/\/tree/}
branch="$(git symbolic-ref HEAD 2>/dev/null)" ||
branch="(unnamed branch)" # detached HEAD
branch=${branch##refs/heads/}
giturl=$giturl/$branch
open $giturl
}

View File

@ -3,5 +3,5 @@ export GOPATH=$XDG_DATA
export GOROOT=/usr/local/go
export GOBIN=$XDG_DATA/bin
export GO111MODULE=on
export GOPRIVATE=github.com/jchenry/*
export GOPRIVATE=github.com/jchenry
export PATH=$PATH:$GOROOT/bin:$GOBIN

View File

@ -1,5 +1,3 @@
alias build-targets="make -rpn | sed -n -e '/^$/ { n ; /^[^ .#][^ ]*:/p ; }' | egrep --color '^[^ ]*:'"
alias ebg="tr 'A-Za-z' 'N-ZA-Mn-za-m'"
alias tmux="tmux -f "$XDG_CONFIG_HOME"/tmux/tmux.conf"
alias drone-local="drone exec --branch $(git branch 2>/dev/null | sed -n '/^\*/s/^\* //p') --trusted"

View File

@ -0,0 +1,11 @@
# boosted from https://threkk.medium.com/how-to-use-bookmarks-in-bash-zsh-6b8074e40774 and adapted using mattn_jp's bash changes: https://twitter.com/mattn_jp/status/1434192554036137995?s=20
if [ -d "$HOME/.local/cdbookmarks" ]; then
export CDPATH=".:$HOME/.local/cdbookmarks:/"
alias goto="cd -P"
_goto()
{
local IFS=$'\n'
COMPREPLY=( $( compgen -W "$(/bin/ls $HOME/.local/cdbookmarks)" -- ${COMP_WORDS[COMP_CWORD]}))
} && complete -F _goto goto
fi

3
code-server/config.yaml Normal file
View File

@ -0,0 +1,3 @@
bind-addr: 192.168.1.6:8080
auth: password
cert: false

36
dlv/config.yml Normal file
View File

@ -0,0 +1,36 @@
# Configuration file for the delve debugger.
# This is the default configuration file. Available options are provided, but disabled.
# Delete the leading hash mark to enable an item.
# Uncomment the following line and set your preferred ANSI foreground color
# for source line numbers in the (list) command (if unset, default is 34,
# dark blue) See https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit
# source-list-line-color: 34
# Provided aliases will be added to the default aliases for a given command.
aliases:
# command: ["alias1", "alias2"]
# Define sources path substitution rules. Can be used to rewrite a source path stored
# in program's debug information, if the sources were moved to a different place
# between compilation and debugging.
# Note that substitution rules will not be used for paths passed to "break" and "trace"
# commands.
substitute-path:
# - {from: path, to: path}
# Maximum number of elements loaded from an array.
# max-array-values: 64
# Maximum loaded string length.
# max-string-len: 64
# Output evaluation.
# max-variable-recurse: 1
# Uncomment the following line to make the whatis command also print the DWARF location expression of its argument.
# show-location-expr: true
# List of directories to use when searching for separate debug info files.
debug-info-directories: ["/usr/lib/debug/.build-id"]

9
gatsby/config.json Normal file
View File

@ -0,0 +1,9 @@
{
"telemetry": {
"machineId": "0ea97bef-c42f-466e-89a1-cec6ec7c773c",
"enabled": true
},
"cli": {
"packageManager": "npm"
}
}

2663
git/git-completion.sh Executable file

File diff suppressed because it is too large Load Diff

30
git/git-precommit Executable file
View File

@ -0,0 +1,30 @@
#!/bin/sh
echo "Would you like to play a game?"
# Read user input, assign stdin to keyboard
exec < /dev/tty
while read -p "Have you double checked that only relevant files were added? (Y/n) " yn; do
case $yn in
[Yy] ) break;;
[Nn] ) echo "Please ensure the right files were added!"; exit 1;;
* ) echo "Please answer y (yes) or n (no):" && continue;
esac
done
while read -p "Has the documentation been updated? (Y/n) " yn; do
case $yn in
[Yy] ) break;;
[Nn] ) echo "Please add or update the docs!"; exit 1;;
* ) echo "Please answer y (yes) or n (no):" && continue;
esac
done
while read -p "Do you know which issue or PR numbers to reference? (Y/n) " yn; do
case $yn in
[Yy] ) break;;
[Nn] ) echo "Better go check those tracking numbers!"; exit 1;;
* ) echo "Please answer y (yes) or n (no):" && continue;
esac
done
exec <&-

33
git/git-prompt.sh Executable file
View File

@ -0,0 +1,33 @@
# Configure colors, if available.
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
c_reset=`tput sgr0`
c_user=`tput setaf 8`
c_path=`tput setaf 8`
c_git_clean=`tput setaf 2`
c_git_dirty=`tput setaf 1`
else
c_reset=
c_user=
c_git_cleancleann_path=
c_git_clean=
c_git_dirty=
fi
# Function to assemble the Git parsingart of our prompt.
git_prompt ()
{
if ! git rev-parse --git-dir > /dev/null 2>&1; then
return 0
fi
git_branch=$(git branch 2>/dev/null | sed -n '/^\*/s/^\* //p')
if git diff --quiet 2>/dev/null >&2; then
git_color="$c_git_clean"
else
git_color="$c_git_dirty"
fi
echo "[$git_color$git_branch${c_reset}]"
}
function tabc() {
NAME=$1; if [ -z "$NAME" ]; then NAME="Default"; fi
osascript -e "tell application \"Terminal\" to set current settings of front window to settings set \"$NAME\""
}

View File

@ -1,22 +1,18 @@
[hub]
protocol = https
protocol = https
[core]
editor = code --wait
excludesfile = /opt/boxen/config/git/gitignore
[user]
name = Colin Henry
email = jchenry@users.noreply.github.com
[push]
default = simple
[diff]
tool = vscode
[difftool "vscode"]
cmd = code --wait --diff $LOCAL $REMOTE
[merge]
tool = vscode
[mergetool "vscode"]
cmd = code --wait $MERGED
tool = kdiff3
[alias]
lgb = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset%n' --abbrev-commit --date=relative --branches
[mergetool "kdiff3"]
path = /Applications/kdiff3.app/Contents/MacOS/kdiff3
[http]
sslverify = true

27
git/githubzen.fortunes Executable file
View File

@ -0,0 +1,27 @@
It's not fully shipped until it's fast.
%
Practicality beats purity.
%
Avoid administrative distraction.
%
Mind your words, they are important.
%
Non-blocking is better than blocking.
%
Design for failure.
%
Half measures are as bad as nothing at all.
%
Favor focus over features.
%
Approachable is better than simple.
%
Encourage flow.
%
Anything added dilutes everything else.
%
Speak like a human.
%
Responsive is better than fast.
%
Keep it logically awesome.

10
git/gitmessage Executable file
View File

@ -0,0 +1,10 @@
# If applied, this commit will...
# [Add/Fix/Remove/Update/Refactor/Document] [issue #id] [summary]
# Why is it necessary? (Bug fix, feature, improvements?)
-
# How does the change address the issue?
-
# What side effects does this change have?
-

25
git/update_git_repos.sh Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash
# store the current dir
CUR_DIR=$(pwd)
# Let the person running the script know what's going on.
echo "Pulling in latest changes for all repositories..."
# Find all git repositories and update it to the master latest revision
for i in $(find . -name ".git" | cut -c 3-); do
echo "";
echo "** "$i+" **";
# We have to go to the .git parent directory to call the pull command
cd "$i";
cd ..;
# finally pull
git pull origin;
# lets get back to the CUR_DIR
cd $CUR_DIR
done
echo "Complete!"

View File

@ -0,0 +1 @@
reporting: "off"

View File

@ -0,0 +1,2 @@
reporting: "off"
startuppopupversion: 1

View File

@ -1,5 +1,3 @@
#!/usr/bin/env bash
# Enable full keyboard access for all controls (e.g. enable Tab in modal dialogs)
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
@ -110,8 +108,6 @@ defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
# Terminal.app: Only use UTF-8 in Terminal
defaults write com.apple.terminal StringEncodings -array 4
# Terminal.app: set default prodile to Pro
defaults write com.apple.terminal "Default Window Settings" -string "Pro";
# Activity Monitor: Visualize CPU usage in the Activity Monitor Dock icon
defaults write com.apple.ActivityMonitor IconType -int 5

View File

@ -1,3 +0,0 @@
#!/usr/bin/env bash -eo pipefail
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew bundle --file ~/.config/Brewfile

View File

@ -1,2 +0,0 @@
xcode-select --install

View File

@ -1,15 +0,0 @@
add_newline = false
[username]
style_user="white bold"
format="$user($style)"
show_always=true
[hostname]
ssh_only=false
format="@$hostname:"
disabled=false
[character]
success_symbol = "[\\$](green)"
error_symbol = "[\\$](red)"

2
tmux/battery.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
ioreg -l | grep -i capacity | tr '\n' ' | ' | awk '{printf("%.2f%%", $10/$5 * 100)}'

@ -1 +0,0 @@
Subproject commit 420656d265a92365d1a3828dd632f3be114092ad

View File

@ -1 +0,0 @@
git submodule add https://github.com/tmux-plugins/tpm $XDG_CONFIG_HOME/tmux/plugins/tpm

35
tmux/tmux.conf Normal file → Executable file
View File

@ -1,24 +1,25 @@
# based on config described here: https://www.youtube.com/watch?v=B-1wGwvUwm8
unbind C-b
set -g prefix C-a
set-option -g prefix C-a
unbind r
bind r source-file ~/.config/tmux/tmux.conf
# Set status bar
set -g status-bg black
set -g status-fg white
set -g status-left ''
set -g status-right '#[fg=green] #( uname -n ) | #( date "+%d %b %H:%M.%S")'
unbind h
bind h split-window -v
# Highlight active window
set-window-option -g window-status-current-style bg=red
unbind v
bind v split-window -h
# set -g mouse on
# Set window notifications
setw -g monitor-activity on
set -g visual-activity on
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'dracula/tmux'
set -g @dracula-show-powerline true
set -g @dracula-show-left-icon session
set -g @dracula-plugins "cpu-usage ram-usage"
set-option -g status on
set-option -g status-interval 2
set-option -g status-justify "centre"
run '~/.config/tmux/plugins/tpm/tpm'
# Fix LSOpenURLsWithRole() error on OS X. Requires reattach-to-user-namespace
# to be installed.
#set-option -g default-command "which reattach-to-user-namespace > /dev/null && reattach-to-user-namespace -l $SHELL || $SHELL"

View File

@ -1,3 +0,0 @@
dracula-theme.theme-dracula
golang.go
hashicorp.terraform

View File

@ -1,115 +0,0 @@
{
"go.formatTool": "goimports",
"go.useLanguageServer": true,
"go.lintTool": "golangci-lint",
"window.zoomLevel": 0,
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "text.html.markdown.journal.task.open.bullet",
"settings": {
"foreground": "#FFFF00"
}
},
{
"scope": "text.html.markdown.journal.task.open.marker",
"settings": {
"foreground": "#FFFF00"
}
},
{
"scope": "text.html.markdown.journal.task.open.keyword",
"settings": {
"fontStyle": "italic"
}
},
{
"scope": "text.html.markdown.journal.task.open.text",
"settings": {}
},
{
"scope": "text.html.markdown.journal.task.completed.keyword",
"settings": {
"fontStyle": "italic"
}
},
{
"scope": "text.html.markdown.journal.task.completed.marker",
"settings": {
"foreground": "#AAAAAA"
}
},
{
"scope": "text.html.markdown.journal.task.completed.text",
"settings": {
"foreground": "#AAAAAA"
}
},
{
"scope": "text.html.markdown.journal.task.completed.bullet",
"settings": {
"foreground": "#FFFF00"
}
},
{
"scope": "text.html.markdown.journal.memo.keyword",
"settings": {
"fontStyle": "italic"
}
},
{
"scope": "text.html.markdown.journal.memo.bullet",
"settings": {
"foreground": "#FFFF00"
}
},
{
"scope": "text.html.markdown.journal.scope",
"settings": {
"foreground": "#FFFF00"
}
},
{
"scope": "text.html.markdown.journal.link.keyword",
"settings": {
"fontStyle": "italic"
}
},
{
"scope": "text.html.markdown.journal.link.bullet",
"settings": {
"foreground": "#FFFF00"
}
}
]
},
"go.toolsManagement.autoUpdate": true,
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"files.exclude": {
"**/.classpath": true,
"**/.project": true,
"**/.settings": true,
"**/.factorypath": true
},
"go.coverOnSave": true,
"go.coverageDecorator": {
"coveredHighlightColor": "rgba(64,128,128,0.5)",
"uncoveredHighlightColor": "rgba(128,64,64,0.25)",
"coveredGutterStyle": "blockgreen",
"uncoveredGutterStyle": "blockred"
},
"go.coverOnSingleTest": true,
"go.alternateTools": {
},
"javascript.format.enable": false,
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
},
"[css]": {
"editor.defaultFormatter": "vscode.css-language-features"
},
"editor.fontFamily": "MesloLGSDZNerdFontCompleteM-Regular, Menlo, Monaco, 'Courier New', monospace",
"workbench.colorTheme": "Dracula"
}

View File

@ -1,7 +0,0 @@
#!/usr/bin/env bash -eo pipefail
ln -s ~/.vscode/settings.json ~/Library/Application Support/Code/User/settings.json
while read p; do
code --install-extension $p
done <extensions.txt

9
zim/notebooks.list Normal file
View File

@ -0,0 +1,9 @@
[NotebookList]
Default=
1=~/Notebooks/Notes
[Notebook 1]
uri=~/Notebooks/Notes
name=Notes
interwiki=None
icon=None

20
zim/preferences.conf Normal file
View File

@ -0,0 +1,20 @@
[General]
plugins=["pageindex","pathbar","insertsymbol","printtobrowser","versioncontrol"]
plugins_list_version=0.70
[PageIndexPlugin]
pane=left_pane
autoexpand=True
autocollapse=True
[PathBarPlugin]
[InsertSymbolPlugin]
[PrintToBrowserPlugin]
[VersionControlPlugin]
autosave=False
autosave_at_interval=False
autosave_interval=10