forked from pmodels/mpich
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile-rpm.mk
More file actions
150 lines (133 loc) · 6.01 KB
/
Makefile-rpm.mk
File metadata and controls
150 lines (133 loc) · 6.01 KB
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
NAME := mpich
SRC_EXT := gz
GIT_TAG := v3.3
TOPDIR := $(shell echo $$PWD)
# sadly, git is too old on EL7 to do this
daos_adio-all.patch:
# actually need to configure and then generate a diff
# against the upstream tarball
#git submodule update
#git diff --submodule=diff $(GIT_TAG)..HEAD > $@
echo ./autogen.sh
echo ./configure
echo rm -rf pristine
echo mkdir pristine
echo tar -C pristine -xzvf $(notdir $(SOURCE))
diff -ur --exclude Dockerfile.centos.7 --exclude Jenkinsfile \
--exclude Makefile-rpm.mk --exclude mpich-modules.patch \
--exclude mpich.macros --exclude mpich.pth.py2 \
--exclude mpich.pth.py3 --exclude mpich.spec \
--exclude pristine --exclude .git --exclude .github \
--exclude _topdir \
--exclude daos_adio\*.patch \
--exclude make\ rpms.out\* \
--exclude \*.swp \
--exclude \*.gz \
pristine/* . > $@ || true
echo rm -rf pristine
# so instead we get a patch for each submodule
define gen_submod_patch
set -e; \
DIR=$(1); \
A=$$(git ls-tree $(GIT_TAG) $$DIR | \
sed -e 's/[^ ]* [^ ]* \([^ ]*\) .*/\1/'); \
B=$$(git ls-tree HEAD $$DIR | \
sed -e 's/[^ ]* [^ ]* \([^ ]*\) .*/\1/'); \
echo "Create patch for $$DIR from $$A..$$B"; \
cd $$DIR; \
git diff --src-prefix=a/$$DIR/ --dst-prefix=b/$$DIR/ \
$$A..$$B > $(TOPDIR)/$@
endef
daos_adio-hwloc.patch:
$(call gen_submod_patch,src/hwloc)
daos_adio-izem.patch:
$(call gen_submod_patch,src/izem)
daos_adio-libfabric.patch:
$(call gen_submod_patch,src/mpid/ch4/netmod/ofi/libfabric)
daos_adio-ucx.patch:
$(call gen_submod_patch,src/mpid/ch4/netmod/ucx/ucx)
daos_adio.patch:
# get all to-be-generated files generated
#./configure
# some day (post git 1.8 in EL7) can do this:
#git diff $(GIT_TAG)..HEAD -- \
# ':(exclude)README.vin' \
# ':(exclude)src/hwloc' \
# ':(exclude)src/izem' \
# ':(exclude)src/mpid/ch4/netmod/ofi/libfabric' \
# ':(exclude)src/mpid/ch4/netmod/ucx/ucx' \
#
git diff $(GIT_TAG)..HEAD | \
sed -e '/^diff --git/d' -e '/^index /d' | \
filterdiff -p 1 \
-x README.vin \
-x src/hwloc \
-x src/izem \
-x src/mpid/ch4/netmod/ofi/libfabric \
-x src/mpid/ch4/netmod/ucx/ucx \
> $@
include packaging/Makefile_packaging.mk
GIT_COMMIT := $(shell git rev-parse --short HEAD)
$(NAME)-$(DL_VERSION)-$(GIT_COMMIT).tar:
mkdir -p rpmbuild
git archive --prefix=$(subst -$(GIT_COMMIT).tar,,$@)/ -o $@ HEAD
git submodule update --init
set -x; p=$$PWD && (echo .; git submodule foreach) | \
while read junk path; do \
temp="$${path%\'}"; \
temp="$${temp#\'}"; \
path=$$temp; \
[ "$$path" = "" ] && continue; \
(cd $$path && git archive --prefix=$(subst -$(GIT_COMMIT).tar,,$@)/$$path/ HEAD \
> $$p/rpmbuild/tmp.tar && \
tar --concatenate --file=$$p/$@ \
$$p/rpmbuild/tmp.tar && rm $$p/rpmbuild/tmp.tar); \
done
#tar tvf $@
$(NAME)-$(DL_VERSION).tar.$(SRC_EXT): $(NAME)-$(DL_VERSION)-$(GIT_COMMIT).tar
older_tarballs=$$(ls $(NAME)-$(DL_VERSION)-*.tar | \
grep -v $(NAME)-$(DL_VERSION)-$(GIT_COMMIT).tar) ; \
if [ -n "$$older_tarballs" ]; then \
rm -f "$$older_tarballs"; \
fi
rm -f $@
gzip < $< > $@
mpich.spec: FORCE
rm -f mpich.spec
ln mpich-$(DISTRO_BASE).spec $@
CHROOT ?= false
CHROOT_NAME ?= epel-7-x86_64
ifeq ($(ID_LIKE),debian)
ROMIO_DIR := BUILD/mpich-$(VERSION)/src/mpi/romio
ROMIO_PREFIX := _topdir
else
ifeq ($(CHROOT),true)
ROMIO_PREFIX := /var/lib/mock/$(CHROOT_NAME)/root/builddir/build
CHROOT_ROMIO_PREFIX := /builddir/build
else
ROMIO_PREFIX := _topdir
endif
ROMIO_DIR := BUILD/mpich-$(DL_VERSION)/src/mpi/romio
endif
romio-$(DL_VERSION).tar.gz: FORCE
set -e; \
if [ -f $(ROMIO_PREFIX)/$(ROMIO_DIR)/test/Makefile ] && \
grep "MPI_LIB = /" $(ROMIO_PREFIX)/$(ROMIO_DIR)/test/Makefile; then \
trap 'mv $(ROMIO_PREFIX)/$(ROMIO_DIR)/test/Makefile{.old,}' EXIT; \
mv $(ROMIO_PREFIX)/$(ROMIO_DIR)/test/Makefile{,.old}; \
sed -e 's/\(MPI_LIB = \)\/\(.*\)/\1-L\/\2/' \
< $(ROMIO_PREFIX)/$(ROMIO_DIR)/test/Makefile.old \
> $(ROMIO_PREFIX)/$(ROMIO_DIR)/test/Makefile; \
fi; \
if [ "$(ID_LIKE)" != "debian" ]; then \
if $(CHROOT); then \
mock -r $(CHROOT_NAME) --chroot \
"make -C $(CHROOT_ROMIO_PREFIX)/$(ROMIO_DIR) clean"; \
else \
make -C $(ROMIO_PREFIX)/$(ROMIO_DIR) clean; \
fi; \
fi; \
tar -C $(ROMIO_PREFIX)/$(ROMIO_DIR)/.. --exclude Makefile.old \
-czf romio-$(DL_VERSION).tar.gz romio
romio-tarball: romio-$(DL_VERSION).tar.gz
.PHONY: romio-tarball