summaryrefslogtreecommitdiff
path: root/Makefile
blob: 13c4777ca415510bd1b0909b2e0bdefc8c4a2eb4 (plain)
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
# Copyright (C) 2013, Linaro Limited.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
#
# Author: Andrew McDermott <andrew.mcdermott@linaro.org>
#
# This Makefile will produce a tarball of the latest sources of
# OpenJDK 8 development.  Running `make' will create the tar archive
# with whatever has been downloaded already.  If you want a
# absolutely-latest-and-greatest archive you should invoke this as
# `make clean all'. The reason that this is not the default rule is to
# not hit on the OpenJDK mercurial server each and every time make is
# (inadvertently) invoked.
#
# Invoke as `make ARCH=jdk8' for x86 snapshot.
# Invoke as `make ARCH=aarch64-port' for ARMv8 snapshot (default)

TOP_DIR ?= .
OUT_DIR ?= $(TOP_DIR)/out
NET_DIR ?= $(TOP_DIR)/net

PORT ?= aarch64-port
URL ?= http://hg.openjdk.java.net/$(PORT)/jdk8

JDK8_CORE := jdk8
JDK8_COMPONENTS := corba jaxp jaxws langtools jdk hotspot nashorn

JDK8_CORE_TARBALL := $(patsubst %,$(NET_DIR)/$(PORT)/%.tar.gz,$(JDK8_CORE))
JDK8_COMPONENT_TARBALLS := $(patsubst %,$(NET_DIR)/$(PORT)/%.tar.gz,$(JDK8_COMPONENTS))

COMPRESSION ?= bz2
VERSION ?= snapshot
SNAPSHOT_NAME := openjdk8-$(PORT)-$(VERSION)
TARBALL := $(SNAPSHOT_NAME).tar.$(COMPRESSION)

ALL_DOWNLOADS := $(JDK8_CORE_TARBALL) $(JDK8_COMPONENT_TARBALLS)

.PHONY: all print-commit-ids

all: $(OUT_DIR)/$(TARBALL)

print-commit-ids: $(JDK8_CORE_TARBALL) $(JDK8_COMPONENT_TARBALLS)
	./print-commit-ids $(JDK8_CORE_TARBALL) $(JDK8_COMPONENT_TARBALLS)

$(OUT_DIR)/$(TARBALL): $(ALL_DOWNLOADS) | $(OUT_DIR)
	$(RM) -r $@ $(JDK8_CORE)
	tar -zxf $(JDK8_CORE_TARBALL) --transform='s/^\([^-]\+\)-[0-9a-f]\{12\}/\1/'
	@(set -e; for i in $(JDK8_COMPONENT_TARBALLS); \
	do \
		echo "unpacking $$i"; \
		tar -C jdk8 -zxf $$i --transform='s/^\([^-]\+\)-[0-9a-f]\{12\}/\1/'; \
	done)
	./print-commit-ids $(JDK8_CORE_TARBALL) $(JDK8_COMPONENT_TARBALLS) > $(JDK8_CORE)/BOM
	tar -acf $@ --transform='s/^$(JDK8_CORE)/$(SNAPSHOT_NAME)/' $(JDK8_CORE) $(JDK8_CORE)/BOM

$(OUT_DIR):
	mkdir $@

$(NET_DIR)/$(PORT):
	@mkdir -p $@

$(NET_DIR)/$(PORT)/jdk8.tar.gz: | $(NET_DIR)/$(PORT)
	wget -O $@ -q $(URL)/archive/tip.tar.gz

$(NET_DIR)/$(PORT)/%.tar.gz: | $(NET_DIR)/$(PORT)
	wget -O $@ -q $(URL)/$(patsubst %.tar.gz,%,$(notdir $@))/archive/tip.tar.gz

net-clean:
	$(RM) -r $(NET_DIR)/$(PORT)

clean:
	$(RM) -r $(OUT_DIR)/$(TARBALL) $(JDK8_CORE)

spotless: clean net-clean
	$(RM) -r $(OUT_DIR)

unpack:
	$(RM) -r $(SNAPSHOT_NAME)
	tar axf $(OUT_DIR)/$(TARBALL)