@cryptotaxi247 / kubo / commits / 253522086

mk: add tarball support

License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

Jakub Sztandera committed Apr 5, 2018 at 18:46 UTC 25352208642a62c23c84245ef64709c38d694b5c
7 files changed +47 -1
.gitignore
+5
@@ -17,3 +17,8 @@ gx-workspace-update.json
17 bin/gx
18 bin/gx*
19 bin/tmp
20 +
21 +
22 +vendor
23 +.tarball
24 +go-ipfs-source.tar.gz
Rules.mk
+2
@@ -8,6 +8,8 @@ TEST_SHORT :=
8 all: help # all has to be first defined target
9 .PHONY: all
10
11 +include mk/git.mk # has to be before tarball.mk
12 +include mk/tarball.mk
13 include mk/util.mk
14 include mk/golang.mk
15 include mk/gx.mk
bin/maketarball.sh new
+22
@@ -0,0 +1,22 @@
1 +#!/usr/bin/env bash
2 +# vim: set expandtab sw=2 ts=2:
3 +
4 +# bash safe mode
5 +set -euo pipefail
6 +IFS=$'\n\t'
7 +
8 +
9 +OUTPUT=$(realpath ${1:-go-ipfs-source.tar.gz})
10 +
11 +TMPDIR="$(mktemp -d)"
12 +NEWIPFS="$TMPDIR/github.com/ipfs/go-ipfs"
13 +mkdir -p "$NEWIPFS"
14 +cp -r . "$NEWIPFS"
15 +( cd "$NEWIPFS" &&
16 + echo $PWD &&
17 + GOPATH="$TMPDIR" gx install --local &&
18 + (git rev-parse --short HEAD || true) > .tarball &&
19 + tar -czf "$OUTPUT" --exclude="./.git" .
20 +)
21 +
22 +rm -rf "$TMPDIR"
cmd/ipfs/Rules.mk
+1 -1
@@ -13,7 +13,7 @@ PATH := $(realpath $(d)):$(PATH)
13 # DEPS_OO_$(d) += merkledag/pb/merkledag.pb.go namesys/pb/namesys.pb.go
14 # DEPS_OO_$(d) += pin/internal/pb/header.pb.go unixfs/pb/unixfs.pb.go
15
16 -$(d)_flags =-ldflags="-X "github.com/ipfs/go-ipfs/repo/config".CurrentCommit=$(shell git rev-parse --short HEAD)"
16 +$(d)_flags =-ldflags="-X "github.com/ipfs/go-ipfs/repo/config".CurrentCommit=$(git-hash)"
17
18 $(d)-try-build $(IPFS_BIN_$(d)): GOFLAGS += $(cmd/ipfs_flags)
19
mk/git.mk new
+1
@@ -0,0 +1 @@
1 +git-commit:=$(shell git rev-parse --short HEAD 2>/dev/null)
mk/gx.mk
+3
@@ -7,5 +7,8 @@ gx-deps:
7 ifneq ($(IPFS_GX_USE_GLOBAL),1)
8 gx-deps: bin/gx bin/gx-go
9 endif
10 +.PHONY: gx-deps
11
12 +ifeq ($(tarball-is),0)
13 DEPS_GO += gx-deps
14 +endif
mk/tarball.mk new
+13
@@ -0,0 +1,13 @@
1 +
2 +
3 +ifeq (,$(wildcard .tarball))
4 +tarball-is:=0
5 +else
6 +tarball-is:=1
7 +# override git hash
8 +git-hash:=$(shell cat .tarball)
9 +endif
10 +
11 +
12 +go-ipfs-source.tar.gz: distclean
13 + bin/maketarball.sh $@