-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
139 lines (131 loc) · 3.34 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
NAME=git
VERSION=2.16.2
ITERATION=1.lru
PREFIX=/usr/local
LICENSE=GPLv2
VENDOR="Git contributors"
MAINTAINER="Ryan Parman"
DESCRIPTION="Fast Version Control System"
URL=https://git-scm.com
ACTUALOS=$(shell osqueryi "select * from os_version;" --json | jq -r ".[].name")
EL=$(shell if [[ "$(ACTUALOS)" == "Amazon Linux AMI" ]]; then echo alami; else echo el; fi)
RHEL=$(shell [[ -f /etc/centos-release ]] && rpm -q --queryformat '%{VERSION}' centos-release)
.PHONY: package
package:
@ 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 "OS: $(ACTUALOS)"
@ echo "EL: $(EL)"
@ echo "RHEL: $(RHEL)"
@ echo " "
rm -Rf git*
rm -Rf /tmp/installdir*
mkdir -p /tmp/installdir-$(NAME)-$(VERSION)
yum -y install \
asciidoc \
expat-devel \
gettext-devel \
libcurl-devel \
openssl-devel \
pcre-devel \
perl-ExtUtils-MakeMaker \
tcl \
zlib-devel \
;
wget https://www.kernel.org/pub/software/scm/git/$(NAME)-$(VERSION).tar.xz
tar xf $(NAME)-$(VERSION).tar.xz
cd ./$(NAME)-$(VERSION) && \
./configure --prefix=$(PREFIX) \
--with-openssl \
--with-libpcre \
--with-curl \
--with-expat \
--with-shell=$(shell which bash) \
--with-perl=$(shell which perl) \
--with-python=$(shell which python) \
--with-zlib=/usr/include
cd ./$(NAME)-$(VERSION) && \
make prefix=$(PREFIX) all
cd ./$(NAME)-$(VERSION) && \
make prefix=$(PREFIX) install DESTDIR=/tmp/installdir-$(NAME)-$(VERSION)
cd /tmp/installdir-$(NAME)-$(VERSION) && \
mkdir -p bin && \
ln -s /usr/local/bin/git bin/git
# Main package
fpm \
-d "$(NAME)-libs = $(VERSION)-$(ITERATION).$(EL)$(RHEL)" \
-s dir \
-t rpm \
-n $(NAME) \
-v $(VERSION) \
-C /tmp/installdir-$(NAME)-$(VERSION) \
-m $(MAINTAINER) \
--iteration $(ITERATION) \
--license $(LICENSE) \
--vendor $(VENDOR) \
--prefix / \
--url $(URL) \
--description $(DESCRIPTION) \
--rpm-defattrdir 0755 \
--rpm-digest md5 \
--rpm-compression gzip \
--rpm-os linux \
--rpm-dist $(EL)$(RHEL) \
--rpm-auto-add-directories \
usr/local/bin \
bin \
;
# Libs package
fpm \
-s dir \
-t rpm \
-n $(NAME)-libs \
-v $(VERSION) \
-C /tmp/installdir-$(NAME)-$(VERSION) \
-m $(MAINTAINER) \
--iteration $(ITERATION) \
--license $(LICENSE) \
--vendor $(VENDOR) \
--prefix / \
--url $(URL) \
--description $(DESCRIPTION) \
--rpm-defattrdir 0755 \
--rpm-digest md5 \
--rpm-compression gzip \
--rpm-os linux \
--rpm-dist $(EL)$(RHEL) \
--rpm-auto-add-directories \
usr/local/lib64 \
usr/local/libexec \
;
# Documentation package
fpm \
-d "$(NAME) = $(VERSION)-$(ITERATION).$(EL)$(RHEL)" \
-s dir \
-t rpm \
-n $(NAME)-doc \
-v $(VERSION) \
-C /tmp/installdir-$(NAME)-$(VERSION) \
-m $(MAINTAINER) \
--iteration $(ITERATION) \
--license $(LICENSE) \
--vendor $(VENDOR) \
--prefix / \
--url $(URL) \
--description $(DESCRIPTION) \
--rpm-defattrdir 0755 \
--rpm-digest md5 \
--rpm-compression gzip \
--rpm-os linux \
--rpm-dist $(EL)$(RHEL) \
--rpm-auto-add-directories \
usr/local/share \
;
[[ -d /vagrant/repo ]] && mv *.rpm /vagrant/repo/