-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
234 lines (207 loc) · 5.49 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
ITERATION=1.lru
PREFIX=/usr/local
LICENSE=Python-2.0
VENDOR="The Python Software Foundation"
MAINTAINER="Ryan Parman"
DESCRIPTION="An interpreted, interactive, object-oriented programming language."
URL=https://python.org
RHEL=$(shell rpm -q --queryformat '%{VERSION}' centos-release)
#-------------------------------------------------------------------------------
all:
@echo "Run either 'make python27' or 'make python3'."
#-------------------------------------------------------------------------------
.PHONY: python27
python27: python27-vars info compile27 install-tmp package move
.PHONY: python3
python3: python3-vars info compile3 install-tmp package move
#-------------------------------------------------------------------------------
.PHONY: python27-vars
python27-vars:
$(eval NAME=python27)
$(eval VERSION=2.7.13)
$(eval BINARY=python2.7)
.PHONY: python3-vars
python3-vars:
$(eval NAME=python3)
$(eval VERSION=3.6.1)
$(eval BINARY=python3.6)
#-------------------------------------------------------------------------------
.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 "BINARY: $(BINARY)"
@ echo " "
#-------------------------------------------------------------------------------
.PHONY: clean
clean:
rm -Rf /tmp/installdir* python*.rpm Py* gmon.out
#-------------------------------------------------------------------------------
.PHONY: install-deps
install-deps:
yum -y install \
wget \
bzip2-devel \
ncurses-devel \
openssl-devel \
sqlite-devel \
zlib-devel \
valgrind-devel \
tcl-devel \
lzma-devel \
gdbm-devel \
;
#-------------------------------------------------------------------------------
.PHONY: compile27
compile27:
wget https://www.python.org/ftp/python/$(VERSION)/Python-$(VERSION).tar.xz;
tar xf Python-$(VERSION).tar.xz;
cd ./Python-$(VERSION) && \
./configure --prefix=$(PREFIX) \
--enable-profiling \
--enable-ipv6 \
--enable-unicode=ucs4 \
--with-valgrind \
--with-ensurepip=yes && \
make;
.PHONY: compile3
compile3:
wget https://www.python.org/ftp/python/$(VERSION)/Python-$(VERSION).tar.xz;
tar xf Python-$(VERSION).tar.xz;
cd ./Python-$(VERSION) && \
./configure --prefix=$(PREFIX) \
--enable-shared \
--enable-profiling \
--enable-loadable-sqlite-extensions \
--enable-ipv6 \
--enable-big-digits=30 \
--with-hash-algorithm=siphash24 \
--with-signal-module \
--with-valgrind \
--with-threads \
--with-doc-strings \
--with-tsc \
--with-pymalloc \
--with-ensurepip=yes && \
make;
#-------------------------------------------------------------------------------
.PHONY: install-tmp
install-tmp:
mkdir -p /tmp/installdir-$(NAME)-$(VERSION);
cd ./Python-$(VERSION) && \
make altinstall DESTDIR=/tmp/installdir-$(NAME)-$(VERSION);
#-------------------------------------------------------------------------------
.PHONY: package
package:
# Main package
fpm \
-f \
-d "$(NAME)-libs = $(EPOCH):$(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-changelog CHANGELOG-$(NAME).txt \
--rpm-dist el$(RHEL) \
--rpm-auto-add-directories \
usr/local/bin \
;
# Libs package
fpm \
-f \
-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-changelog CHANGELOG-$(NAME).txt \
--rpm-dist el$(RHEL) \
--rpm-auto-add-directories \
--after-install after-install-libs.sh \
usr/local/lib \
;
# Development package
fpm \
-f \
-d "$(NAME) = $(EPOCH):$(VERSION)-$(ITERATION).el$(RHEL)" \
-s dir \
-t rpm \
-n $(NAME)-devel \
-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-changelog CHANGELOG-$(NAME).txt \
--rpm-dist el$(RHEL) \
--rpm-auto-add-directories \
usr/local/include \
;
# Documentation package
fpm \
-f \
-d "$(NAME) = $(EPOCH):$(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-changelog CHANGELOG-$(NAME).txt \
--rpm-dist el$(RHEL) \
--rpm-auto-add-directories \
usr/local/share \
;
#-------------------------------------------------------------------------------
.PHONY: move
move:
mv *.rpm /vagrant/repo