forked from livecode/livecode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildbot.mk
228 lines (185 loc) · 7.35 KB
/
buildbot.mk
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# Copyright (C) 2015 LiveCode Ltd.
#
# This file is part of LiveCode.
#
# LiveCode is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License v3 as published by the Free
# Software Foundation.
#
# LiveCode 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 LiveCode. If not see <http://www.gnu.org/licenses/>.
# This file contains rules used by the LiveCode Buildbot installation at
# <https://vulcan.livecode.com/>
# Load version information
include version
# Get git commit information
ifeq ($(BUILD_EDITION),commercial)
GIT_VERSION=g$(shell git --git-dir=../.git rev-parse --short HEAD)
else
GIT_VERSION=g$(shell git rev-parse --short HEAD)
endif
################################################################
# Configure with gyp
################################################################
# Buildbot must set the variables PLATFORM and SUBPLATFORM
ifeq ($(BUILD_SUBPLATFORM),)
CONFIG_TARGET = config-$(BUILD_PLATFORM)
else
CONFIG_TARGET = config-$(BUILD_PLATFORM)-$(BUILD_SUBPLATFORM)
endif
config:
$(MAKE) $(CONFIG_TARGET)
.PHONY: config
################################################################
# Compile
################################################################
# Buildbot must set the variables PLATFORM and SUBPLATFORM
ifeq ($(BUILD_SUBPLATFORM),)
COMPILE_TARGET = compile-$(BUILD_PLATFORM)
else
COMPILE_TARGET = compile-$(BUILD_PLATFORM)-$(BUILD_SUBPLATFORM)
endif
compile:
$(MAKE) $(COMPILE_TARGET)
.PHONY: compile
################################################################
# Archive / extract built binaries
################################################################
bin-archive:
tar -Jcvf $(BUILD_PLATFORM)-bin.tar.xz $(BUILD_PLATFORM)-bin
bin-extract:
find . -maxdepth 1 -name '*-bin.tar.xz' -print0 | xargs -0 -n1 tar -xvf
################################################################
# Installer generation
################################################################
# BUILD_PLATFORM will be set to the platform on which the installer's being
# built. Its build artefacts will have been extracted into the
# ./$(BUILD_PLATFORM)-bin/ directory
BUILD_STABILITY ?= beta
BUILDTOOL_STACK = builder/builder_tool.livecodescript
WKHTMLTOPDF ?= $(shell which wkhtmltopdf 2>/dev/null)
BUILD_EDITION ?= community
# Those directories are given to the tool builder, and they might get passed
# (like private-dir) to engine functions, to which a path relative to this file
# becomes invalid).
top_src_dir=${PWD}
engine_dir=${top_src_dir}
output_dir=${top_src_dir}
work_dir=${top_src_dir}/_cache/builder_tool
private_dir=${top_src_dir}/..
bin_dir = ${top_src_dir}/$(BUILD_PLATFORM)-bin
docs_source_dir = ${top_src_dir}/docs
docs_private_source_dir = ${private_dir}/docs
docs_build_dir = ${top_src_dir}/_build/docs-build
ifeq ($(BUILD_PLATFORM),mac)
LIVECODE = $(bin_dir)/LiveCode-Community.app/Contents/MacOS/LiveCode-Community
buildtool_platform = mac
else ifeq ($(BUILD_PLATFORM),linux-x86)
LIVECODE = $(bin_dir)/LiveCode-Community
buildtool_platform = linux
else ifeq ($(BUILD_PLATFORM),linux-x86_64)
LIVECODE = $(bin_dir)/LiveCode-Community
buildtool_platform = linux
endif
# FIXME add --warn-as-error
buildtool_command = $(LIVECODE) -ui $(BUILDTOOL_STACK) \
--build $(BUILD_STABILITY) \
--engine-dir ${engine_dir} --output-dir ${output_dir} --work-dir ${work_dir} \
--private-dir ${private_dir}
# Settings for upload
RSYNC ?= rsync
UPLOAD_SERVER ?= meg.on-rev.com
UPLOAD_PATH = staging/$(BUILD_LONG_VERSION)/$(GIT_VERSION)
UPLOAD_MAX_RETRIES = 50
dist-docs: dist-docs-community
ifeq ($(BUILD_EDITION),commercial)
dist-docs: dist-docs-commercial
endif
dist-docs-community:
mkdir -p $(docs_build_dir)
cp -R $(docs_source_dir) $(docs_build_dir)/raw-community
$(buildtool_command) --platform $(buildtool_platform) --stage docs \
--docs-dir $(docs_build_dir)/raw-community \
--built-docs-dir $(docs_build_dir)/cooked-community
dist-docs-commercial:
mkdir -p $(docs_build_dir)
cp -R $(docs_source_dir) $(docs_build_dir)/raw-commercial
rsync -a $(docs_private_source_dir)/ $(docs_build_dir)/raw-commercial/
$(buildtool_command) --platform $(buildtool_platform) --stage docs \
--docs-dir $(docs_build_dir)/raw-commercial \
--built-docs-dir $(docs_build_dir)/cooked-commercial
dist-notes:
WKHTMLTOPDF=$(WKHTMLTOPDF) \
$(buildtool_command) --platform $(buildtool_platform) --stage notes
ifeq ($(BUILD_EDITION),commercial)
dist-server: dist-server-commercial
endif
dist-server: dist-server-community
dist-server-community:
$(buildtool_command) --platform mac --platform win --platform linux \
--stage server --edition community
dist-server-commercial:
$(buildtool_command) --platform mac --platform win --platform linux \
--stage server --edition commercial
ifeq ($(BUILD_EDITION),commercial)
dist-tools: dist-tools-commercial
distmac-disk: distmac-disk-indy distmac-disk-business
endif
dist-tools: dist-tools-community
distmac-disk: distmac-disk-community
dist-tools-community:
$(buildtool_command) --platform mac --platform win --platform linux --stage tools --edition community \
--built-docs-dir $(docs_build_dir)/cooked-community
dist-tools-commercial:
$(buildtool_command) --platform mac --platform win --platform linux --stage tools --edition indy \
--built-docs-dir $(docs_build_dir)/cooked-commercial
$(buildtool_command) --platform mac --platform win --platform linux --stage tools --edition business \
--built-docs-dir $(docs_build_dir)/cooked-commercial
# Make a list of installers to be uploaded to the distribution server
dist-upload-files.txt:
find . -maxdepth 1 -name 'LiveCode*Installer-*-Mac.dmg' \
-o -name 'LiveCode*Installer-*-Windows.exe' \
-o -name 'LiveCode*Installer-*-Linux.*' \
-o -name 'LiveCode*Server-*-Linux*.zip' \
-o -name 'LiveCode*Server-*-Mac.zip' \
-o -name 'LiveCode*Server-*-Windows.zip' \
-o -name '*-bin.tar.xz' \
> $@
# Perform the upload. This is in two steps:
# (1) Create the target directory
# (2) Transfer the files using rsync
#
# We need to do the actual transfer in a loop to deal with possible
# connection drops
dist-upload-mkdir:
ssh $(UPLOAD_SERVER) "mkdir -p \"$(UPLOAD_PATH)\""
dist-upload: dist-upload-files.txt dist-upload-mkdir
trap "echo Interrupted; exit;" SIGINT SIGTERM; \
i=0; \
false; \
while [ $$? -ne 0 -a $$i -lt $(UPLOAD_MAX_RETRIES) ] ; do \
i=$$(($$i+1)); \
rsync -v --progress --partial --chmod=ugo=rwX --executability \
--files-from=dist-upload-files.txt . $(UPLOAD_SERVER):"\"$(UPLOAD_PATH)\""; \
done; \
rc=$$?; \
if [ $$i -eq $(UPLOAD_MAX_RETRIES) ]; then \
echo "Maximum retries reached, giving up"; \
fi; \
exit $$rc
# This rule is used for packing the Mac installer contents; the
# resulting archive gets transferred to a Mac for signing and
# conversion to a DMG.
distmac-archive:
find . -maxdepth 1 -name 'LiveCode*Installer-*-Mac.app' -print0 \
| xargs -0 tar -Jcvf mac-installer.tar.xz
distmac-extract:
tar -xvf mac-installer.tar.xz
# Final installer creation for Mac
distmac-disk-%:
$(buildtool_command) --platform mac --stage disk --edition $*