forked from postgrespro/mamonsu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.pkg
93 lines (74 loc) · 2.91 KB
/
Makefile.pkg
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
TOKEN ?= $(PACKAGECLOUD_TOKEN)
prepare_builddir: clean
mkdir -p build
tar --transform='s,^\.,mamonsu-$(VERSION),'\
-czf build/mamonsu-$(VERSION).tar.gz .\
--exclude=build || echo ok
tar xvf build/mamonsu-$(VERSION).tar.gz -C build
cp build/mamonsu-$(VERSION).tar.gz \
$(BUILDDIR)/packaging/rpm/SOURCES
chown -R root.root $(BUILDDIR)
deb: prepare_builddir
cd $(BUILDDIR) && cp -a $(WORKDIR)/packaging/debian . && dpkg-buildpackage -b
cp -av build/mamonsu*.deb .
rpm: prepare_builddir
rpmbuild -ba --define '_topdir $(BUILDDIR)/packaging/rpm'\
$(BUILDDIR)/packaging/rpm/SPECS/mamonsu.spec
cp -av $(BUILDDIR)/packaging/rpm/RPMS/noarch/mamonsu*.rpm .
pkg: build/prepare build/all
docker run -v "$(WORKDIR)":/src --rm debian:wheezy bash -exc " \
cp /src/packaging/push.rb /src/build/out && cd /src/build/out && \
(apt-get update -m || apt-get update -m || apt-get update -m) && \
apt-get install -y ruby-dev && gem install --no-ri --no-rdoc package_cloud -v 0.2.37 && \
TOKEN=$(TOKEN) ruby push.rb"
build/prepare:
mkdir -p build
touch build/prepare
build/all: build/pkg_debian build/pkg_ubuntu build/pkg_centos
@echo Build for all platform: done
touch build/all
build/pkg_debian: build/pkg_debian_7 build/pkg_debian_8
@echo Debian: done
build/pkg_ubuntu: build/pkg_ubuntu_14_04 build/pkg_ubuntu_15_10 build/pkg_ubuntu_16_04 build/pkg_ubuntu_16_10
@echo Ubuntu: done
build/pkg_centos: build/pkg_centos_6 build/pkg_centos_7
@echo Centos: done
define build_deb
docker run -v "$(WORKDIR)":/src --rm $1:$2 bash -exc " \
cp -a /src /var/build && \
find /var/build -type d -exec chmod 0755 {} \; && find /var/build -type f -exec chmod 0644 {} \; && \
cd /var/build && (apt-get update -m || apt-get update -m || apt-get update -m) && \
apt-get install -y make dpkg-dev debhelper python-dev python-setuptools && make deb && \
mkdir -p /src/build/out/$1/$2 && cp *.deb /src/build/out/$1/$2"
endef
define build_rpm
docker run -v "$(WORKDIR)":/src --rm $1:$2 bash -exc " \
cp -a /src /var/build && \
find /var/build -type d -exec chmod 0755 {} \; && find /var/build -type f -exec chmod 0644 {} \; && \
cd /var/build && yum install -y tar make rpm-build python2-devel python-setuptools && make rpm && \
mkdir -p /src/build/out/el/$2 && cp *.rpm /src/build/out/el/$2"
endef
build/pkg_debian_7:
$(call build_deb,debian,wheezy)
touch build/pkg_debian_7
build/pkg_debian_8:
$(call build_deb,debian,jessie)
touch build/pkg_debian_8
build/pkg_ubuntu_14_04:
$(call build_deb,ubuntu,trusty)
touch build/pkg_ubuntu_14_04
build/pkg_ubuntu_15_10:
$(call build_deb,ubuntu,wily)
touch build/pkg_ubuntu_15_10
build/pkg_ubuntu_16_04:
$(call build_deb,ubuntu,xenial)
touch build/pkg_ubuntu_16_04
build/pkg_ubuntu_16_10:
$(call build_deb,ubuntu,yakkety)
touch build/pkg_ubuntu_16_10
build/pkg_centos_6:
$(call build_rpm,centos,6)
touch build/pkg_centos_6
build/pkg_centos_7:
$(call build_rpm,centos,7)
touch build/pkg_centos_7