-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDistributions.mk
212 lines (195 loc) · 6.26 KB
/
Distributions.mk
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
OS_RELEASE_FILE = /etc/os-release
ifneq (,$(wildcard, $(OS_RELEASE_FILE)))
$(error cannot find /etc/os-release. This Makefile look up the file to get distribution name and version.)
endif
OS = $(shell . /etc/os-release; echo -n $$ID)
VERSION = $(shell . /etc/os-release; echo -n $$VERSION_ID)
MAJOR_VERSION = $(shell echo $(VERSION) | sed -e 's/\..*//')
MINOR_VERSION = $(shell echo $(VERSION) | awk -F'.' '{print $$2}')
# If the distribution is CentOS 7, We need minor version to determine python version
ifeq ($(strip $(OS)), centos)
ifeq ($(strip $(VERSION)), 7)
MINOR_VERSION = $(shell awk -F'[ |.]' '{print $$5}' /etc/redhat-release)
endif
endif
# default vars
USE_MOD_PYTHON = 0
USE_MOD_WSGI = 0
USE_PYTHON2 = 0
USE_PYTHON3 = 0
########## Scientific Linux 5.0 - 5.7 ##########
# Scientific Linux older than or equal to 5.7 returns ScientificSL
# Scientific Linux newer than or equal to 5.8 returns Scientific
ifeq ($(strip $(OS)),ScientificSL)
WWW_DOCUMENT_ROOT = /var/www/html
HTTPD_CONF_DIR = /etc/httpd/conf.d
USE_MOD_PYTHON = 1
endif
########## Scientific Linux 5.8 - , 7.x ##########
ifeq ($(strip $(OS)),scientific)
WWW_DOCUMENT_ROOT = /var/www/html
HTTPD_CONF_DIR = /etc/httpd/conf.d
ifeq ($(strip $(MAJOR_VERSION)),5)
USE_MOD_PYTHON = 1
USE_PYTHON2 = 1
PYTHON_EXEC_FILE = python2
PYTHON_CONFIG = python2-config
endif
ifeq ($(strip $(MAJOR_VERSION)),6)
USE_MOD_WSGI = 1
USE_PYTHON2 = 1
PYTHON_EXEC_FILE = python2
PYTHON_CONFIG = python-config
endif
ifeq ($(strip $(MAJOR_VERSION)),7)
USE_MOD_WSGI = 1
USE_PYTHON2 = 1
PYTHON_EXEC_FILE = python2
PYTHON_CONFIG = python2-config
ifeq ($(shell test $(MINOR_VERSION) -gt 6; echo $$?),0)
USE_PYTHON2 = 0
USE_PYTHON3 = 1
PYTHON_EXEC_FILE = python3
PYTHON_CONFIG = python3-config
endif
endif
endif
########## Scientific Linux CERN ##########
ifeq ($(strip $(OS)),ScientificCERNSLC)
WWW_DOCUMENT_ROOT = /var/www/html
HTTPD_CONF_DIR = /etc/httpd/conf.d
ifeq ($(strip $(MAJOR_VERSION)),5)
USE_MOD_PYTHON = 1
USE_PYTHON2 = 1
PYTHON_EXEC_FILE = python2
PYTHON_CONFIG = python2-config
endif
ifeq ($(strip $(MAJOR_VERSION)),6)
USE_MOD_WSGI = 1
USE_PYTHON2 = 1
PYTHON_EXEC_FILE = python2
PYTHON_CONFIG = python2-config
endif
endif
# CERN CentOS 7 is like a CentOS 7
########## CentOS ##########
ifeq ($(strip $(OS)),centos)
WWW_DOCUMENT_ROOT = /var/www/html
HTTPD_CONF_DIR = /etc/httpd/conf.d
ifeq ($(strip $(MAJOR_VERSION)),5)
USE_MOD_PYTHON = 1
USE_PYTHON2 = 1
PYTHON_EXEC_FILE = python2
PYTHON_CONFIG = python2-config
endif
ifeq ($(strip $(MAJOR_VERSION)),6)
USE_MOD_WSGI = 1
USE_PYTHON2 = 1
PYTHON_EXEC_FILE = python2
PYTHON_CONFIG = python-config
endif
ifeq ($(strip $(MAJOR_VERSION)),7)
USE_MOD_WSGI = 1
USE_PYTHON2 = 1
PYTHON_EXEC_FILE = python2
PYTHON_CONFIG = python2-config
# Use python3 on CentOS 7.7 and later
ifeq ($(shell test $(MINOR_VERSION) -gt 6; echo $$?),0)
USE_PYTHON2 = 0
USE_PYTHON3 = 1
PYTHON_EXEC_FILE = python3
PYTHON_CONFIG = python3-config
endif
endif
ifeq ($(strip $(MAJOR_VERSION)),8)
USE_MOD_WSGI = 1
USE_PYTHON3 = 1
PYTHON_EXEC_FILE = python3
PYTHON_CONFIG = python3-config
endif
ifeq ($(strip $(MAJOR_VERSION)),9)
USE_MOD_WSGI = 1
USE_PYTHON3 = 1
PYTHON_EXEC_FILE = python3
PYTHON_CONFIG = python3-config
endif
endif
########## AlmaLinux ##########
ifeq ($(strip $(OS)),almalinux)
WWW_DOCUMENT_ROOT = /var/www/html
HTTPD_CONF_DIR = /etc/httpd/conf.d
ifeq ($(strip $(MAJOR_VERSION)),8)
USE_MOD_WSGI = 1
USE_PYTHON3 = 1
PYTHON_EXEC_FILE = python3
PYTHON_CONFIG = python3-config
endif
ifeq ($(strip $(MAJOR_VERSION)),9)
USE_MOD_WSGI = 1
USE_PYTHON3 = 1
PYTHON_EXEC_FILE = python3
PYTHON_CONFIG = python3-config
endif
endif
########## Fedora ##########
ifeq ($(strip $(OS)),Fedora)
WWW_DOCUMENT_ROOT = /var/www/html
HTTPD_CONF_DIR = /etc/httpd/conf.d
USE_MOD_WSGI = 1
USE_PYTHON3 = 1
PYTHON_EXEC_FILE = python3
PYTHON_CONFIG = python3-config
endif
########## Debian ##########
ifeq ($(strip $(OS)),debian)
WWW_DOCUMENT_ROOT = /var/www
HTTPD_CONF_DIR = /etc/apache2/conf.d
USE_MOD_WSGI = 1
USE_PYTHON3 = 1
PYTHON_EXEC_FILE = python3
PYTHON_CONFIG = python3-config
endif
########## Ubuntu ##########
ifeq ($(strip $(OS)),ubuntu)
WWW_DOCUMENT_ROOT = /var/www
HTTPD_CONF_DIR = /etc/apache2/conf.d
USE_MOD_WSGI = 1
USE_PYTHON3 = 1
PYTHON_EXEC_FILE = python3
PYTHON_CONFIG = python3-config
endif
########## ArchLinux ##########
ifeq ($(strip $(OS)),arch)
WWW_DOCUMENT_ROOT = /srv/http
HTTPD_CONF_DIR = /etc/httpd/conf/extra
USE_MOD_WSGI = 1
USE_PYTHON3 = 1
PYTHON_EXEC_FILE = python
PYTHON_CONFIG = python-config
endif
########## Raspbian ##########
ifeq ($(strip $(OS)),raspbian)
WWW_DOCUMENT_ROOT = /var/www/html
HTTPD_CONF_DIR = /etc/apache2/conf-available
USE_MOD_WSGI = 1
USE_PYTHON3 = 1
PYTHON_EXEC_FILE = python3
PYTHON_CONFIG = python3-config
endif
########## Unknown ##########
ifeq ($(strip $(WWW_DOCUMENT_ROOT)),)
WWW_DOCUMENT_ROOT = /
HTTPD_CONF_DIR = /
USE_MOD_WSGI = 1
endif
PYTHON_EXEC_PATH = /usr/bin/$(PYTHON_EXEC_FILE)
PYTHON_CONFIG_PATH = /usr/bin/$(PYTHON_CONFIG)
# all target for testing #
#all:
# @echo "os:" $(OS)
# @echo "version:" $(VERSION)
# @echo "arch:" $(ARCH)
# @echo "major_version:" $(MAJOR_VERSION)
# @echo "httpd_document_root:" $(HTTPD_DOCUMENT_ROOT)
# @echo "mod_python:" $(USE_MOD_PYTHON)
# @echo "mod_wsgi:" $(USE_MOD_WSGI)