forked from heterodb/pg-strom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
103 lines (92 loc) · 4.01 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
# ----------------------------------------
#
# Makefile for packaging
#
# ----------------------------------------
include Makefile.common
__PGSTROM_TGZ := pg_strom-$(PGSTROM_VERSION)
PGSTROM_TGZ := $(__PGSTROM_TGZ).tar.gz
SWDC ?= $(shell test -d ../swdc/.git && realpath ../swdc || echo /dev/null)
__SWDC_URL = [email protected]:heterodb/swdc.git
__ARCH = $(shell rpmbuild -E %{_arch})
__DIST = $(shell rpmbuild -E %{dist} | grep -o -E '\.el[0-9]+' | sed 's/\.el/rhel/g')
__SOURCEDIR = $(shell rpmbuild -E %{_sourcedir})
__SPECDIR = $(shell rpmbuild -E %{_specdir})
__RPMDIR = $(shell rpmbuild -E %{_rpmdir})/$(__ARCH)
__SRPMDIR = $(shell rpmbuild -E %{_srcrpmdir})
__SPECFILE = $(__SPECDIR)/pg_strom-PG$(PG_MAJORVERSION).spec
rpm: rpm-pg_strom
all: rpm-pg_strom rpm-mysql2arrow rpm-pcap2arrow
__precheck_swdc:
rpm -qf `which $(PG_CONFIG)` || exit 1
(cd $(SWDC); \
test "`git remote get-url origin`" = "$(__SWDC_URL)" || exit 1; \
git pull || exit 1)
swdc: __precheck_swdc rpm-pg_strom
(PGSTROM_TGZ_FULLPATH="`realpath $(PGSTROM_TGZ)`"; \
cd $(SWDC); \
RPM="`rpmspec -q --rpms $(__SPECFILE) | grep -v debug`.rpm"; \
DEST=docs/yum/$(__DIST)-$(__ARCH); \
rpmsign --addsign $(__RPMDIR)/$${RPM} && \
mkdir -p $${DEST} && \
install -m 644 $(__RPMDIR)/$${RPM} $${DEST} && \
git add $${DEST}/$${RPM}; \
RPM="`rpmspec -q --rpms $(__SPECFILE) | grep debuginfo`.rpm"; \
DEST=docs/yum/$(__DIST)-debuginfo; \
rpmsign --addsign $(__RPMDIR)/$${RPM} && \
mkdir -p $${DEST} && \
install -m 644 $(__RPMDIR)/$${RPM} $${DEST} && \
git add $${DEST}/$${RPM}; \
RPM=`rpmspec -q --srpm $(__SPECFILE) | sed 's/$(__ARCH)/src.rpm/g'`; \
DEST=docs/yum/$(__DIST)-source; \
rpmsign --addsign $(__SRPMDIR)/$${RPM} && \
mkdir -p $${DEST} && \
install -m 644 $(__SRPMDIR)/$${RPM} $${DEST} && \
git add $${DEST}/$${RPM}; \
install -m 644 $${PGSTROM_TGZ_FULLPATH} ./docs/tgz && \
git add ./docs/tgz/$(PGSTROM_TGZ); \
./update-index.sh)
tarball:
git archive --format=tar.gz \
--prefix=$(__PGSTROM_TGZ)/ \
-o $(PGSTROM_TGZ) $(GITHASH) \
LICENSE Makefile Makefile.common \
src arrow-tools test/ssbm
rpm-pg_strom: tarball
cp -f $(PGSTROM_TGZ) $(__SOURCEDIR) || exit 1
git show --format=raw $(GITHASH):files/systemd-pg_strom.conf > \
$(__SOURCEDIR)/systemd-pg_strom.conf || exit 1
(git show --format=raw $(GITHASH):files/pg_strom.spec.in | \
sed -e "s/@@STROM_VERSION@@/$(VERSION)/g" \
-e "s/@@STROM_RELEASE@@/$(RELEASE)/g" \
-e "s/@@STROM_TARBALL@@/$(__PGSTROM_TGZ)/g" \
-e "s/@@PGSTROM_GITHASH@@/$(GITHASH)/g" \
-e "s/@@PGSQL_VERSION@@/$(PG_MAJORVERSION)/g";\
git show --format=raw $(GITHASH):CHANGELOG) > $(__SPECFILE)
rpmbuild -ba $(__SPECFILE) --undefine=_debugsource_packages
rpm-mysql2arrow: tarball
cp -f $(PGSTROM_TGZ) $(__SOURCEDIR) || exit 1
git show --format=raw $(GITHASH):files/mysql2arrow.spec.in | \
sed -e "s/@@STROM_VERSION@@/$(VERSION)/g" \
-e "s/@@STROM_RELEASE@@/$(RELEASE)/g" \
-e "s/@@STROM_TARBALL@@/$(__PGSTROM_TGZ)/g" \
-e "s/@@PGSTROM_GITHASH@@/$(GITHASH)/g" > \
$(__SPECDIR)/mysql2arrow.spec
git show --format=raw $(GITHASH):files/pg_strom.spec.in | \
awk 'BEGIN {flag=0;} /^%changelog$$/{flag=1; next;} { if (flag>0) print; }' >> \
$(__SPECDIR)/mysql2arrow.spec
rpmbuild -ba $(__SPECDIR)/mysql2arrow.spec \
--undefine=_debugsource_packages
rpm-pcap2arrow: tarball
cp -f $(PGSTROM_TGZ) $(__SOURCEDIR) || exit 1
git show --format=raw $(GITHASH):files/pcap2arrow.spec.in | \
sed -e "s/@@STROM_VERSION@@/$(VERSION)/g" \
-e "s/@@STROM_RELEASE@@/$(RELEASE)/g" \
-e "s/@@STROM_TARBALL@@/$(__PGSTROM_TGZ)/g" \
-e "s/@@PGSTROM_GITHASH@@/$(GITHASH)/g" > \
$(__SPECDIR)/pcap2arrow.spec
git show --format=raw $(GITHASH):files/pg_strom.spec.in | \
awk 'BEGIN {flag=0;} /^%changelog$$/{flag=1; next;} { if (flag>0) print; }' >> \
$(__SPECDIR)/mysql2arrow.spec
rpmbuild -ba $(__SPECDIR)/pcap2arrow.spec \
--undefine=_debugsource_packages