-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
104 lines (89 loc) · 2.45 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
NAME=golang
VERSION=1.10
ITERATION=1.lru
PREFIX=/usr/local
LICENSE=BSD
VENDOR="Google"
MAINTAINER="Ryan Parman"
DESCRIPTION="Go is an open source programming language that makes it easy to build simple, reliable, and efficient software."
URL=https://golang.org
RHEL=$(shell rpm -q --queryformat '%{VERSION}' centos-release)
#-------------------------------------------------------------------------------
all: info clean install-deps extract package move
#-------------------------------------------------------------------------------
.PHONY: info
info:
@ echo "NAME: $(NAME)"
@ echo "VERSION: $(VERSION)"
@ echo "ITERATION: $(ITERATION)"
@ echo "PREFIX: $(PREFIX)"
@ echo "LICENSE: $(LICENSE)"
@ echo "VENDOR: $(VENDOR)"
@ echo "MAINTAINER: $(MAINTAINER)"
@ echo "DESCRIPTION: $(DESCRIPTION)"
@ echo "URL: $(URL)"
@ echo "RHEL: $(RHEL)"
@ echo " "
#-------------------------------------------------------------------------------
.PHONY: clean
clean:
rm -Rf /tmp/installdir* go*
#-------------------------------------------------------------------------------
.PHONY: install-deps
install-deps:
yum -y install \
gcc \
gcc-c++ \
git \
glibc-devel \
make \
mercurial \
tar \
;
#-------------------------------------------------------------------------------
.PHONY: extract
extract:
mkdir -p /tmp/installdir-$(NAME)-$(VERSION);
wget https://storage.googleapis.com/golang/go$(VERSION).linux-amd64.tar.gz
tar -C /tmp/installdir-$(NAME)-$(VERSION) -xzf go$(VERSION).linux-amd64.tar.gz
cd /tmp/installdir-$(NAME)-$(VERSION) && \
mkdir -p bin && \
ln -s /usr/local/go/bin/go bin/go && \
ln -s /usr/local/go/bin/godoc bin/godoc && \
ln -s /usr/local/go/bin/gofmt bin/gofmt \
;
#-------------------------------------------------------------------------------
.PHONY: package
package:
fpm \
-s dir \
-d gcc \
-d gcc-c++ \
-d git \
-d glibc-devel \
-d make \
-d mercurial \
-d tar \
-t rpm \
-n $(NAME) \
-v $(VERSION) \
-C /tmp/installdir-$(NAME)-$(VERSION) \
-m $(MAINTAINER) \
--iteration $(ITERATION) \
--license $(LICENSE) \
--vendor $(VENDOR) \
--prefix $(PREFIX) \
--url $(URL) \
--description $(DESCRIPTION) \
--rpm-defattrdir 0755 \
--rpm-digest md5 \
--rpm-compression gzip \
--rpm-os linux \
--rpm-auto-add-directories \
go \
bin \
;
#-------------------------------------------------------------------------------
.PHONY: move
move:
mv *.rpm /vagrant/repo/