forked from nkadel/samba4repo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
274 lines (230 loc) · 7.23 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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
#
# Makefile - build wrapper for Samba 4 on RHEL 6
#
# git clone RHEL 6 SRPM building tools from
# https://github.com/nkadel/[package] into designated
# SAMBAPKGS below
#
# Set up local
#REOBASEE=http://localhost
REPOBASE=file://$(PWD)
# RHEL 7 needs compat-nettle34-3.x, which uses epel-7-x86_64
SAMBAPKGS+=compat-nettle34-3.x-srpm
# RHEL 7 needs gmp-6.1.x-srpm, which uses epel-7-x86_64
SAMBAPKGS+=gmp-6.1.x-srpm
# CentOS 8 needs quota-devel, whcih RHEL 8 and CentOS 8 put in a different
# channel from quota and quota debuginfo for no sane reason
#SAMBAPKGS+=quota-4.x-srpm
# Current libtalloc-2.x required
SAMBAPKGS+=libtalloc-2.3.x-srpm
# Current libtdb-1.4.x required
SAMBAPKGS+=libtdb-1.4.x-srpm
# Current libtevent-0.11.x required for Samba 4.10
SAMBAPKGS+=libtevent-0.11.x-srpm
# RHEL 7 needs compat-gnutls36.3.x-sprm, which uses compat-nettle34
SAMBAPKGS+=compat-gnutls36-3.x-srpm
# Also requires libtevent
SAMBAPKGS+=libldb-2.4.x-srpm
# Current samba release, requires all curent libraries
SAMBAPKGS+=samba-4.15.x-srpm
REPOS+=samba4repo/el/7
REPOS+=samba4repo/el/8
REPOS+=samba4repo/fedora/34
REPOS+=samba4repo/amz/2
REPODIRS := $(patsubst %,%/x86_64/repodata,$(REPOS)) $(patsubst %,%/SRPMS/repodata,$(REPOS))
CFGS+=samba4repo-7-x86_64.cfg
CFGS+=samba4repo-8-x86_64.cfg
CFGS+=samba4repo-f34-x86_64.cfg
# Amazon 2 config
CFGS+=samba4repo-amz2-x86_64.cfg
# /et/cmock version lacks EPEL
CFGS+=epel-8-x86_64.cfg
# Link from /etc/mock
MOCKCFGS+=epel-7-x86_64.cfg
MOCKCFGS+=epel-8-x86_64.cfg
MOCKCFGS+=fedora-34-x86_64.cfg
#MOCKCFGS+=amazonlinux-2-x86_64.cfg
all:: install
install:: $(CFGS)
install:: $(MOCKCFGS)
install:: $(REPODIRS)
install:: $(SAMBAPKGS)
# Actually put all the modules in the local repo
.PHONY: install clean getsrc build srpm src.rpm
install clean getsrc build srpm src.rpm::
@for name in $(SAMBAPKGS); do \
(cd $$name && $(MAKE) $(MFLAGS) $@); \
done
# Git submodule checkout operation
# For more recent versions of git, use "git checkout --recurse-submodules"
#*-srpm::
# @[ -d $@/.git ] || \
# git submodule update --init $@
# Dependencies of libraries on other libraries for compilation
libtevent-0.11.x-srpm:: libtalloc-2.3.x-srpm
libldb-2.4.x-srpm:: libtalloc-2.3.x-srpm
libldb-2.4.x-srpm:: libtdb-1.4.x-srpm
libldb-2.4.x-srpm:: libtevent-0.11.x-srpm
compat-gnutls36-3.x-srpm:: compat-nettle34-3.x-srpm
compat-gnutls36-3.x-srpm:: gmp-6.1.x-srpm
compat-gnutls36-3.x-srpm:: libldb-2.4.x-srpm
# Samba rellies on all the othe components
samba-4.15.x-srpm:: compat-gnutls36-3.x-srpm
samba-4.15.x-srpm:: libtalloc-2.3.x-srpm
samba-4.15.x-srpm:: libtdb-1.4.x-srpm
samba-4.15.x-srpm:: libtevent-0.11.x-srpm
samba-4.15.x-srpm:: libldb-2.4.x-srpm
# Actually build in directories
.PHONY: $(SAMBAPKGS)
$(SAMBAPKGS)::
(cd $@ && $(MAKE) $(MLAGS) install)
repodirs: $(REPOS) $(REPODIRS)
repos: $(REPOS) $(REPODIRS)
$(REPOS):
install -d -m 755 $@
.PHONY: $(REPODIRS)
$(REPODIRS): $(REPOS)
@install -d -m 755 `dirname $@`
/usr/bin/createrepo -q `dirname $@`
.PHONY: cfg
cfg:: cfgs
.PHONY: cfgs
cfgs: $(CFGS) $(MOCKCFGS)
epel-8-x86_64.cfg:: /etc/mock/epel-8-x86_64.cfg
@echo Generating $@ from $?
@cat $? > $@
@echo >> $@
@echo '# epel-8 configs lack EPEL, added here' >> $@
@echo "include('templates/epel-8.tpl')" >> $@
samba4repo-7-x86_64.cfg: /etc/mock/epel-7-x86_64.cfg
@echo Generating $@ from $?
@cat $? > $@
@sed -i 's/epel-7-x86_64/samba4repo-7-x86_64/g' $@
@echo >> $@
@echo "Disabling 'best=' for $@"
@sed -i '/^best=/d' $@
@echo "best=0" >> $@
@echo "config_opts['yum.conf'] += \"\"\"" >> $@
@echo '[samba4repo]' >> $@
@echo 'name=samba4repo' >> $@
@echo 'enabled=1' >> $@
@echo 'baseurl=$(REPOBASE)/samba4repo/el/7/x86_64/' >> $@
@echo 'failovermethod=priority' >> $@
@echo 'skip_if_unavailable=False' >> $@
@echo 'metadata_expire=0' >> $@
@echo 'gpgcheck=0' >> $@
@echo 'priority=20' >> $@
@echo '"""' >> $@
samba4repo-8-x86_64.cfg: epel-8-x86_64.cfg
@echo Generating $@ from $?
@cat $? > $@
@sed -i 's/epel-8-x86_64/samba4repo-8-x86_64/g' $@
@echo >> $@
@echo "Disabling 'best=' for $@"
@sed -i '/^best=/d' $@
@echo "best=0" >> $@
@echo "config_opts['dnf.conf'] += \"\"\"" >> $@
@echo '[samba4repo]' >> $@
@echo 'name=samba4repo' >> $@
@echo 'enabled=1' >> $@
@echo 'baseurl=$(REPOBASE)/samba4repo/el/8/x86_64/' >> $@
@echo 'failovermethod=priority' >> $@
@echo 'skip_if_unavailable=False' >> $@
@echo 'metadata_expire=0' >> $@
@echo 'gpgcheck=0' >> $@
@echo 'priority=20' >> $@
@echo '"""' >> $@
samba4repo-f34-x86_64.cfg: /etc/mock/fedora-34-x86_64.cfg
@echo Generating $@ from $?
@cat $? > $@
@sed -i 's/fedora-34-x86_64/samba4repo-f34-x86_64/g' $@
@echo >> $@
@echo "Disabling 'best=' for $@"
@sed -i '/^best=/d' $@
@echo "best=0" >> $@
@echo "config_opts['dnf.conf'] += \"\"\"" >> $@
@echo '[samba4repo]' >> $@
@echo 'name=samba4repo' >> $@
@echo 'enabled=1' >> $@
@echo 'baseurl=$(REPOBASE)/samba4repo/fedora/34/x86_64/' >> $@
@echo 'failovermethod=priority' >> $@
@echo 'skip_if_unavailable=False' >> $@
@echo 'metadata_expire=0' >> $@
@echo 'gpgcheck=0' >> $@
@echo 'priority=20' >> $@
@echo '"""' >> $@
samba4repo-rawhide-x86_64.cfg: /etc/mock/fedora-rawhide-x86_64.cfg
@echo Generating $@ from $?
@cat $? > $@
@sed -i 's/fedora-rawhide-x86_64/samba4repo-rawhide-x86_64/g' $@
@echo >> $@
@echo "Disabling 'best=' for $@"
@sed -i '/^best=/d' $@
@echo "best=0" >> $@
@echo "config_opts['yum.conf'] += \"\"\"" >> $@
@echo '[samba4repo]' >> $@
@echo 'name=samba4repo' >> $@
@echo 'enabled=1' >> $@
@echo 'baseurl=$(REPOBASE)/samba4repo/fedora/rawhide/x86_64/' >> $@
@echo 'failovermethod=priority' >> $@
@echo 'skip_if_unavailable=False' >> $@
@echo 'metadata_expire=0' >> $@
@echo 'gpgcheck=0' >> $@
@echo 'priority=20' >> $@
@echo '"""' >> $@
samba4repo-amz2-x86_64.cfg: /etc/mock/amazonlinux-2-x86_64.cfg
@echo Generating $@ from $?
@cat $? > $@
@sed -i 's/amz-2-x86_64/samba4repo-amz2-x86_64/g' $@
@echo >> $@
@echo "Disabling 'best=' for $@"
@sed -i '/^best=/d' $@
@echo "best=0" >> $@
@echo "config_opts['dnf.conf'] += \"\"\"" >> $@
@echo '[samba4repo]' >> $@
@echo 'name=samba4repo' >> $@
@echo 'enabled=1' >> $@
@echo 'baseurl=$(REPOBASE)/samba4repo/amz/2/x86_64/' >> $@
@echo 'failovermethod=priority' >> $@
@echo 'skip_if_unavailable=False' >> $@
@echo 'metadata_expire=0' >> $@
@echo 'gpgcheck=0' >> $@
@echo 'priority=20' >> $@
@echo '"""' >> $@
$(MOCKCFGS)::
ln -sf /etc/mock/$@ $@
repo: samba4repo.repo
samba4repo.repo:: Makefile samba4repo.repo.in
if [ -s /etc/fedora-release ]; then \
cat $@.in | \
sed "s|@REPOBASEDIR@/|$(PWD)/|g" | \
sed "s|/@RELEASEDIR@/|/fedora/|g" > $@; \
elif [ -s /etc/redhat-release ]; then \
cat $@.in | \
sed "s|@REPOBASEDIR@/|$(PWD)/|g" | \
sed "s|/@RELEASEDIR@/|/el/|g" > $@; \
else \
echo Error: unknown release, check /etc/*-release; \
exit 1; \
fi
samba4repo.repo::
@cmp -s $@ /etc/yum.repos.d/$@ || \
diff -u $@ /etc/yum.repos.d/$@
clean::
find . -name \*~ -exec rm -f {} \;
rm -f *.cfg
rm -f *.out
@for name in $(SAMBAPKGS); do \
$(MAKE) -C $$name clean; \
done
distclean: clean
rm -rf $(REPOS)
rm -rf samba4repo
@for name in $(SAMBAPKGS); do \
(cd $$name; git clean -x -d -f); \
done
maintainer-clean: distclean
rm -rf $(SAMBAPKGS)
@for name in $(SAMBAPKGS); do \
(cd $$name; git clean -x -d -f); \
done