-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
88 lines (77 loc) · 3.17 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
PKGVER := 2.2.6
SOURCE_ARCHIVE := v$(PKGVER).tar.gz
TARGZ_FILE := h2o.tar.gz
IMAGE_NAME := h2o-package
debian8: IMAGE_NAME := $(IMAGE_NAME)-deb8
debian9: IMAGE_NAME := $(IMAGE_NAME)-deb9
debian10: IMAGE_NAME := $(IMAGE_NAME)-deb10
ubuntu1404: IMAGE_NAME := $(IMAGE_NAME)-ub1404
ubuntu1604: IMAGE_NAME := $(IMAGE_NAME)-ub1604
ubuntu1804: IMAGE_NAME := $(IMAGE_NAME)-ub1804
LIBUV_NAME := libuv1_1.9.1
LIBUV_RELEASE := 3
LIBUV_DSC := $(LIBUV_NAME)-$(LIBUV_RELEASE).dsc
LIBUV_ORIG := $(LIBUV_NAME).orig.tar.gz
LIBUV_DEBIAN := $(LIBUV_NAME)-$(LIBUV_RELEASE).debian.tar.xz
.PHONY: all clean debian8 debian9 debian10 ubuntu1404 ubuntu1604 ubuntu1804
all: debian8 debian9 debian10 ubuntu1404 ubuntu1604 ubuntu1804
debian8: debian8.build
debian9: debian9.build
debian10: debian10.build
ubuntu1404: ubuntu1404.build
ubuntu1604: ubuntu1604.build
ubuntu1804: ubuntu1804.build
src/$(SOURCE_ARCHIVE):
curl -SL https://github.com/h2o/h2o/archive/$(SOURCE_ARCHIVE) -o src/$(SOURCE_ARCHIVE)
deps/$(LIBUV_DSC):
[ -d deps ] || mkdir deps
cd deps && curl -SLO http://http.debian.net/debian/pool/main/libu/libuv1/$(LIBUV_DSC)
deps/$(LIBUV_ORIG):
[ -d deps ] || mkdir deps
cd deps && curl -SLO http://http.debian.net/debian/pool/main/libu/libuv1/$(LIBUV_ORIG)
deps/$(LIBUV_DEBIAN):
[ -d deps ] || mkdir deps
cd deps && curl -SLO http://http.debian.net/debian/pool/main/libu/libuv1/$(LIBUV_DEBIAN)
%.build: src/debian/* src/debian/patches/* src/$(SOURCE_ARCHIVE) deps/$(LIBUV_DSC) deps/$(LIBUV_ORIG) deps/$(LIBUV_DEBIAN)
[ -d [email protected] ] && rm -rf [email protected] || :
[ -d $@ ] && mv $@ [email protected] || :
cp Dockerfile.$* Dockerfile
ifdef IS_TRAVIS_CI
trap 'kill $$!' EXIT; \
while :; do echo "image building..."; sleep 60; done & \
tar -czf - Dockerfile src deps | docker build -t $(IMAGE_NAME) --build-arg PKGVER=$(PKGVER) - >out.log 2>&1 || (cat out.log && false)
else
tar -czf - Dockerfile src deps | docker build -t $(IMAGE_NAME) --build-arg PKGVER=$(PKGVER) -
endif
docker run --name $(IMAGE_NAME)-tmp $(IMAGE_NAME)
mkdir -p tmp
docker wait $(IMAGE_NAME)-tmp
docker cp $(IMAGE_NAME)-tmp:/tmp/$(TARGZ_FILE) tmp
docker rm $(IMAGE_NAME)-tmp
mkdir $@
tar -xzf tmp/$(TARGZ_FILE) -C $@
rm -rf tmp Dockerfile
docker images | grep -q $(IMAGE_NAME) && docker rmi $(IMAGE_NAME) || true
bintray:
./scripts/build_bintray_json.bash \
h2o \
h2o-doc \
h2o-dbg \
libh2o0 \
libh2o-evloop0 \
libh2o-dev-common \
libh2o-dev \
libh2o-evloop-dev
work: src/$(SOURCE_ARCHIVE)
mkdir -p work
tar -xzf src/$(SOURCE_ARCHIVE) -C work --strip-components=1
cp -pr src/debian work/debian
cd work && QUILT_PATCHES="debian/patches" quilt setup debian/patches/series
clean:
rm -rf *.build.bak *.build deps tmp bintray work Dockerfile
docker images | grep -q $(IMAGE_NAME)-deb8 && docker rmi $(IMAGE_NAME)-deb8 || true
docker images | grep -q $(IMAGE_NAME)-deb9 && docker rmi $(IMAGE_NAME)-deb9 || true
docker images | grep -q $(IMAGE_NAME)-deb10 && docker rmi $(IMAGE_NAME)-deb10 || true
docker images | grep -q $(IMAGE_NAME)-ub1404 && docker rmi $(IMAGE_NAME)-ub1404 || true
docker images | grep -q $(IMAGE_NAME)-ub1604 && docker rmi $(IMAGE_NAME)-ub1604 || true
docker images | grep -q $(IMAGE_NAME)-ub1804 && docker rmi $(IMAGE_NAME)-ub1804 || true