Skip to content

Commit

Permalink
build the binaries on our own
Browse files Browse the repository at this point in the history
  • Loading branch information
whyrusleeping committed Dec 9, 2015
1 parent addb65b commit 1be236c
Show file tree
Hide file tree
Showing 15 changed files with 175 additions and 101 deletions.
1 change: 1 addition & 0 deletions dists/go-ipfs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gopath/*
7 changes: 1 addition & 6 deletions dists/go-ipfs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ all: dist
dist: versions deps
mkdir -p $(releases)
cp versions $(releases)/versions
./go-ipfs-dist all
./build-versions.sh

versions: filtered_versions
git ls-remote -t $(repo) | egrep -o "refs/tags/v(.*)" | sed 's/refs\/tags\///' > tag_versions
Expand All @@ -22,11 +22,6 @@ bin:
go-ipfs-dist-x:
chmod +x go-ipfs-dist

bin/gobuilder-cli: bin
#TODO: make this not require a go compiler...
go get github.com/Luzifer/gobuilder/cmd/gobuilder-cli
cp $(gbcli) bin/gobuilder-cli

# bin/go-env:
# ipfs get -o bin/go-env QmfS4PZj7G7KgAztPN3JxXyY6KHJDZ77EaxzocWqsa3XhQ/go-env
# chmox +x bin/go-env
80 changes: 80 additions & 0 deletions dists/go-ipfs/build-versions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#!/bin/bash

# globals
outputDir=../../releases/go-ipfs
goipfspath=github.com/ipfs/go-ipfs/cmd/ipfs

function doBuild() {
local goos=$1
local goarch=$2
local target=$3
local output=$4

echo "==> building $target $goos $goarch"
dir=$output/$1-$2
if [ -e $dir ]
then
echo " skipping build"
return
fi
echo " output to $dir"
mkdir -p $dir
(cd $dir && GOOS=$goos GOARCH=$goarch go build $target 2>&1 > build-log)
echo $target, $goos, $goarch, $? >> $output/results
}

function buildWithMatrix() {
local matfile=$1
local gobin=$2
local output=$3
local commit=$4

# print out build information
mkdir -p $output
go version > $output/build-info
echo "git sha of code: $commit" >> $output/build-info
uname -a >> $output/build-info
echo built on `date` >> $output/build-info

# build each os/arch combo
while read line
do
doBuild $line $gobin $output
done < $matfile
}

function checkoutVersion() {
local repopath=$1
local ref=$2

echo "==> checking out version $v"
(cd $repopath && git checkout $ref)
}

function currentSha() {
(cd $REPO && git show --pretty="%H")
}

# if the output directory already exists, warn user
if [ -e $outputDir ]
then
echo "dirty output directory"
echo "will skip building already existing binaries"
fi


export GOPATH=$(pwd)/gopath
echo "fetching ipfs code..."
go get $goipfspath

repopath=$GOPATH/src/$goipfspath

while read v
do
echo "Building version $v binaries"
checkoutVersion $repopath $v

local output=$outputDir/$v
buildWithMatrix matrices/$v $goipfspath $output $(currentSha $repopath)
echo ""
done < versions
94 changes: 0 additions & 94 deletions dists/go-ipfs/go-ipfs-dist

This file was deleted.

10 changes: 10 additions & 0 deletions dists/go-ipfs/matrices/v0.3.10
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
darwin 386
darwin amd64
freebsd 386
freebsd amd64
freebsd arm
linux 386
linux amd64
linux arm
windows 386
windows amd64
10 changes: 10 additions & 0 deletions dists/go-ipfs/matrices/v0.3.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
darwin 386
darwin amd64
freebsd 386
freebsd amd64
freebsd arm
linux 386
linux amd64
linux arm
windows 386
windows amd64
10 changes: 10 additions & 0 deletions dists/go-ipfs/matrices/v0.3.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
darwin 386
darwin amd64
freebsd 386
freebsd amd64
freebsd arm
linux 386
linux amd64
linux arm
windows 386
windows amd64
10 changes: 10 additions & 0 deletions dists/go-ipfs/matrices/v0.3.4
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
darwin 386
darwin amd64
freebsd 386
freebsd amd64
freebsd arm
linux 386
linux amd64
linux arm
windows 386
windows amd64
10 changes: 10 additions & 0 deletions dists/go-ipfs/matrices/v0.3.5
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
darwin 386
darwin amd64
freebsd 386
freebsd amd64
freebsd arm
linux 386
linux amd64
linux arm
windows 386
windows amd64
10 changes: 10 additions & 0 deletions dists/go-ipfs/matrices/v0.3.6
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
darwin 386
darwin amd64
freebsd 386
freebsd amd64
freebsd arm
linux 386
linux amd64
linux arm
windows 386
windows amd64
10 changes: 10 additions & 0 deletions dists/go-ipfs/matrices/v0.3.7
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
darwin 386
darwin amd64
freebsd 386
freebsd amd64
freebsd arm
linux 386
linux amd64
linux arm
windows 386
windows amd64
10 changes: 10 additions & 0 deletions dists/go-ipfs/matrices/v0.3.8
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
darwin 386
darwin amd64
freebsd 386
freebsd amd64
freebsd arm
linux 386
linux amd64
linux arm
windows 386
windows amd64
10 changes: 10 additions & 0 deletions dists/go-ipfs/matrices/v0.3.9
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
darwin 386
darwin amd64
freebsd 386
freebsd amd64
freebsd arm
linux 386
linux amd64
linux arm
windows 386
windows amd64
2 changes: 2 additions & 0 deletions dists/go-ipfs/versions
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ v0.3.5
v0.3.6
v0.3.7
v0.3.8
v0.3.9
v0.3.10
2 changes: 1 addition & 1 deletion gen-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var spec = {
data: { dists: {} },
}

var goipfsPath = './releases/go-ipfs/v0.3.7/dist.json'
var goipfsPath = './releases/go-ipfs/v0.3.10/dist.json'
spec.data.dists['go-ipfs'] = require(goipfsPath)

njx.render(spec.template, spec.data, function(err, res) {
Expand Down

0 comments on commit 1be236c

Please sign in to comment.