1
+ # Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2
+ # file at the top-level directory of this distribution and at
3
+ # http://rust-lang.org/COPYRIGHT.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ # http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ # <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ # option. This file may not be copied, modified, or distributed
9
+ # except according to those terms.
10
+
1
11
# #####################################################################
2
12
# Distribution
3
13
# #####################################################################
4
14
5
- PKG_NAME := rust
6
- PKG_DIR = $(PKG_NAME ) -$(CFG_RELEASE )
7
- PKG_TAR = dist/$(PKG_DIR ) .tar.gz
15
+ # Primary targets:
16
+ #
17
+ # * dist - make all distribution artifacts
18
+ # * distcheck - sanity check dist artifacts
19
+ # * dist-tar-src - source tarballs
20
+ # * dist-win - Windows exe installers
21
+ # * dist-osx - OS X .pkg installers
22
+ # * dist-tar-bins - Ad-hoc Unix binary installers
23
+ # * dist-docs - Stage docs for upload
8
24
9
- ifdef CFG_ISCC
10
- PKG_ISS = $(wildcard $(S ) src/etc/pkg/* .iss)
11
- PKG_ICO = $(S ) src/etc/pkg/rust-logo.ico
12
- PKG_EXE = dist/$(PKG_DIR ) -install.exe
13
- endif
25
+ PKG_NAME = $(CFG_PACKAGE_NAME )
14
26
15
- ifeq ( $( CFG_OSTYPE ) , apple-darwin)
16
- PKG_OSX = dist/ $( PKG_DIR ) .pkg
17
- endif
27
+ # License suitable for displaying in a popup
28
+ LICENSE.txt : $( S ) COPYRIGHT $( S ) LICENSE-APACHE $( S ) LICENSE-MIT
29
+ cat $^ > $@
18
30
19
- PKG_GITMODULES := $(S ) src/libuv $(S ) src/llvm $(S ) src/gyp $(S ) src/compiler-rt
20
31
32
+ # #####################################################################
33
+ # Source tarball
34
+ # #####################################################################
35
+
36
+ PKG_TAR = dist/$(PKG_NAME ) .tar.gz
37
+
38
+ PKG_GITMODULES := $(S ) src/libuv $(S ) src/llvm $(S ) src/gyp $(S ) src/compiler-rt
21
39
PKG_FILES := \
22
40
$(S ) COPYRIGHT \
23
41
$(S ) LICENSE-APACHE \
@@ -40,28 +58,73 @@ PKG_FILES := \
40
58
snapshots.txt \
41
59
test) \
42
60
$(PKG_GITMODULES ) \
43
- $(filter-out Makefile config.stamp config.mk , \
44
- $(MKFILE_DEPS ) )
61
+ $(filter-out config.stamp, \
62
+ $(MKFILES_FOR_TARBALL ) )
45
63
46
64
UNROOTED_PKG_FILES := $(patsubst $(S ) % ,./% ,$(PKG_FILES ) )
47
65
48
- LICENSE.txt : $(S ) COPYRIGHT $(S ) LICENSE-APACHE $(S ) LICENSE-MIT
49
- cat $^ > $@
66
+ $(PKG_TAR ) : $(PKG_FILES )
67
+ @$(call E, making dist dir)
68
+ $(Q ) rm -Rf tmp/dist/$(PKG_NAME )
69
+ $(Q ) mkdir -p tmp/dist/$(PKG_NAME )
70
+ $(Q ) tar \
71
+ -C $(S) \
72
+ --exclude-vcs \
73
+ --exclude =*~ \
74
+ --exclude=*/llvm/test/*/*.ll \
75
+ --exclude=*/llvm/test/*/*.td \
76
+ --exclude=*/llvm/test/*/*.s \
77
+ --exclude=*/llvm/test/*/*/*.ll \
78
+ --exclude=*/llvm/test/*/*/*.td \
79
+ --exclude=*/llvm/test/*/*/*.s \
80
+ -c $(UNROOTED_PKG_FILES ) | tar -x -C tmp/dist/$(PKG_NAME )
81
+ $(Q)tar -czf $(PKG_TAR) -C tmp/dist $(PKG_NAME)
82
+ $(Q)rm -Rf tmp/dist/$(PKG_NAME)
83
+
84
+ dist-tar-src : $(PKG_TAR )
85
+
86
+ distcheck-tar-src : dist-tar-src
87
+ $(Q ) rm -Rf tmp/distcheck/$(PKG_NAME )
88
+ $(Q ) rm -Rf tmp/distcheck/srccheck
89
+ $(Q ) mkdir -p tmp/distcheck
90
+ @$(call E, unpacking $(PKG_TAR ) in tmp/distcheck/$(PKG_NAME ) )
91
+ $(Q ) cd tmp/distcheck && tar -xzf ../../$(PKG_TAR )
92
+ @$(call E, configuring in tmp/distcheck/srccheck)
93
+ $(Q ) mkdir -p tmp/distcheck/srccheck
94
+ $(Q ) cd tmp/distcheck/srccheck && ../$(PKG_NAME ) /configure
95
+ @$(call E, making 'check' in tmp/distcheck/srccheck)
96
+ $(Q ) +make -C tmp/distcheck/srccheck check
97
+ @$(call E, making 'clean' in tmp/distcheck/srccheck)
98
+ $(Q ) +make -C tmp/distcheck/srccheck clean
99
+ $(Q ) rm -Rf tmp/distcheck/$(PKG_NAME )
100
+ $(Q ) rm -Rf tmp/distcheck/srccheck
101
+
102
+
103
+ # #####################################################################
104
+ # Windows .exe installer
105
+ # #####################################################################
106
+
107
+ # FIXME Needs to support all hosts, but making rust.iss compatible looks like a chore
50
108
51
109
ifdef CFG_ISCC
110
+
111
+ PKG_EXE = dist/$(PKG_NAME ) -install.exe
112
+
52
113
% .iss : $(S ) src/etc/pkg/% .iss
53
114
cp $< $@
54
115
55
116
% .ico : $(S ) src/etc/pkg/% .ico
56
117
cp $< $@
57
118
58
119
$(PKG_EXE ) : rust.iss modpath.iss LICENSE.txt rust-logo.ico \
59
- $(PKG_FILES) $( CSREQ3_T_$(CFG_BUILD)_H_$(CFG_BUILD)) \
120
+ $(CSREQ3_T_$(CFG_BUILD)_H_$(CFG_BUILD)) \
60
121
dist-prepare-win
61
122
$(CFG_PYTHON) $(S)src/etc/copy-runtime-deps.py tmp/dist/win/bin
62
123
@$(call E, ISCC: $@)
63
124
$(Q)"$(CFG_ISCC)" $<
64
125
126
+ $(eval $(call DEF_PREPARE,win))
127
+
65
128
dist-prepare-win : PREPARE_HOST=$(CFG_BUILD )
66
129
dist-prepare-win : PREPARE_TARGETS=$(CFG_BUILD )
67
130
dist-prepare-win : PREPARE_DEST_DIR=tmp/dist/win
@@ -70,105 +133,72 @@ dist-prepare-win: PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD)
70
133
dist-prepare-win : PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD )
71
134
dist-prepare-win : PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD )
72
135
dist-prepare-win : PREPARE_CLEAN=true
73
- dist-prepare-win : prepare-base
136
+ dist-prepare-win : prepare-base-win
74
137
75
138
endif
76
139
77
- $(PKG_TAR ) : $(PKG_FILES )
78
- @$(call E, making dist dir)
79
- $(Q ) rm -Rf tmp/dist/$(PKG_DIR )
80
- $(Q ) mkdir -p tmp/dist/$(PKG_DIR )
81
- $(Q ) tar \
82
- -C $(S) \
83
- --exclude-vcs \
84
- --exclude =*~ \
85
- --exclude=*/llvm/test/*/*.ll \
86
- --exclude=*/llvm/test/*/*.td \
87
- --exclude=*/llvm/test/*/*.s \
88
- --exclude=*/llvm/test/*/*/*.ll \
89
- --exclude=*/llvm/test/*/*/*.td \
90
- --exclude=*/llvm/test/*/*/*.s \
91
- -c $(UNROOTED_PKG_FILES ) | tar -x -C tmp/dist/$(PKG_DIR )
92
- $(Q)tar -czf $(PKG_TAR) -C tmp/dist $(PKG_DIR)
93
- $(Q)rm -Rf tmp/dist/$(PKG_DIR)
140
+ dist-win : $(PKG_EXE )
94
141
95
- .PHONY : dist distcheck
142
+ distcheck-win : dist-win
96
143
97
- ifdef CFG_WINDOWSY_$(CFG_BUILD)
144
+ # #####################################################################
145
+ # OS X .pkg installer
146
+ # #####################################################################
98
147
99
- dist : $( PKG_EXE )
148
+ ifeq ( $( CFG_OSTYPE ) , apple-darwin )
100
149
101
- distcheck : dist
102
- @echo
103
- @echo -----------------------------------------------
104
- @echo $(PKG_EXE ) ready for distribution
105
- @echo -----------------------------------------------
150
+ define DEF_OSX_PKG
106
151
107
- else
152
+ $$( eval $$( call DEF_PREPARE,osx- $( 1 ) ) )
108
153
109
- dist : $(PKG_TAR ) $(PKG_OSX )
110
-
111
- distcheck : $(PKG_TAR )
112
- $(Q ) rm -Rf dist
113
- $(Q ) mkdir -p dist
114
- @$(call E, unpacking $(PKG_TAR ) in dist/$(PKG_DIR ) )
115
- $(Q ) cd dist && tar -xzf ../$(PKG_TAR )
116
- @$(call E, configuring in dist/$(PKG_DIR ) -build)
117
- $(Q ) mkdir -p dist/$(PKG_DIR ) -build
118
- $(Q ) cd dist/$(PKG_DIR ) -build && ../$(PKG_DIR ) /configure
119
- @$(call E, making 'check' in dist/$(PKG_DIR ) -build)
120
- $(Q ) +make -C dist/$(PKG_DIR ) -build check
121
- @$(call E, making 'clean' in dist/$(PKG_DIR ) -build)
122
- $(Q ) +make -C dist/$(PKG_DIR ) -build clean
123
- $(Q ) rm -Rf dist
124
- @echo
125
- @echo -----------------------------------------------
126
- @echo $(PKG_TAR ) ready for distribution
127
- @echo -----------------------------------------------
154
+ dist-prepare-osx-$(1 ) : PREPARE_HOST=$(1 )
155
+ dist-prepare-osx-$(1 ) : PREPARE_TARGETS=$(1 )
156
+ dist-prepare-osx-$(1 ) : PREPARE_DEST_DIR=tmp/dist/pkgroot-$(1 )
157
+ dist-prepare-osx-$(1 ) : PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD )
158
+ dist-prepare-osx-$(1 ) : PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD )
159
+ dist-prepare-osx-$(1 ) : PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD )
160
+ dist-prepare-osx-$(1 ) : PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD )
161
+ dist-prepare-osx-$(1 ) : prepare-base-osx-$(1 )
128
162
129
- endif
163
+ dist/$(PKG_NAME ) -$(1 ) .pkg: $(S ) src/etc/pkg/Distribution.xml LICENSE.txt dist-prepare-osx-$(1 )
164
+ @$$(call E, making OS X pkg)
165
+ $(Q ) pkgbuild --identifier org.rust-lang.rust --root tmp/dist/pkgroot-$(1 ) rust.pkg
166
+ $(Q ) productbuild --distribution $(S ) src/etc/pkg/Distribution.xml --resources . dist/$(PKG_NAME ) -$(1 ) .pkg
167
+ $(Q ) rm -rf tmp rust.pkg
130
168
131
- ifeq ( $( CFG_OSTYPE ) , apple-darwin)
169
+ endef
132
170
133
- dist-prepare-osx : PREPARE_HOST=$(CFG_BUILD )
134
- dist-prepare-osx : PREPARE_TARGETS=$(CFG_BUILD )
135
- dist-prepare-osx : PREPARE_DEST_DIR=tmp/dist/pkgroot
136
- dist-prepare-osx : PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD )
137
- dist-prepare-osx : PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD )
138
- dist-prepare-osx : PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD )
139
- dist-prepare-osx : PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD )
140
- dist-prepare-osx : prepare-base
141
-
142
- $(PKG_OSX ) : Distribution.xml LICENSE.txt dist-prepare-osx
143
- @$(call E, making OS X pkg)
144
- $(Q ) pkgbuild --identifier org.rust-lang.rust --root tmp/dist/pkgroot rust.pkg
145
- $(Q ) productbuild --distribution Distribution.xml --resources . $(PKG_OSX )
146
- $(Q ) rm -rf tmp rust.pkg
171
+ $(foreach host,$(CFG_HOST),$(eval $(call DEF_OSX_PKG,$(host))))
147
172
148
- dist-osx : $(PKG_OSX )
173
+ dist-osx : $(foreach host, $( CFG_HOST ) ,dist/ $( PKG_NAME ) - $( host ) .pkg )
149
174
150
- distcheck-osx : $(PKG_OSX )
151
- @echo
152
- @echo -----------------------------------------------
153
- @echo $(PKG_OSX ) ready for distribution
154
- @echo -----------------------------------------------
175
+ else
176
+
177
+ dist-osx :
155
178
156
179
endif
157
180
158
- dist-install-dir : $(foreach host,$(CFG_HOST ) ,dist-install-dir-$(host ) )
181
+ # FIXME should do something
182
+ distcheck-osx : dist-osx
159
183
160
- dist-tar-bins : $(foreach host,$(CFG_HOST ) ,dist/$(PKG_DIR ) -$(host ) .tar.gz)
184
+
185
+ # #####################################################################
186
+ # Unix binary installer tarballs
187
+ # #####################################################################
161
188
162
189
define DEF_INSTALLER
190
+
191
+ $$(eval $$(call DEF_PREPARE,dir-$(1 ) ) )
192
+
163
193
dist-install-dir-$(1 ) : PREPARE_HOST=$(1 )
164
194
dist-install-dir-$(1 ) : PREPARE_TARGETS=$(1 )
165
- dist-install-dir-$(1 ) : PREPARE_DEST_DIR=tmp/dist/$$(PKG_DIR ) -$(1 )
195
+ dist-install-dir-$(1 ) : PREPARE_DEST_DIR=tmp/dist/$$(PKG_NAME ) -$(1 )
166
196
dist-install-dir-$(1 ) : PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD )
167
197
dist-install-dir-$(1 ) : PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD )
168
198
dist-install-dir-$(1 ) : PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD )
169
199
dist-install-dir-$(1 ) : PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD )
170
200
dist-install-dir-$(1 ) : PREPARE_CLEAN=true
171
- dist-install-dir-$(1 ) : prepare-base
201
+ dist-install-dir-$(1 ) : prepare-base-dir- $( 1 )
172
202
$$(Q ) (cd $$(PREPARE_DEST_DIR ) / && find -type f) \
173
203
> $$(PREPARE_DEST_DIR ) /$$(CFG_LIBDIR_RELATIVE ) /$$(CFG_RUSTLIBDIR ) /manifest
174
204
$$(Q )$$(PREPARE_MAN_CMD ) $$(S ) COPYRIGHT $$(PREPARE_DEST_DIR )
@@ -177,11 +207,71 @@ dist-install-dir-$(1): prepare-base
177
207
$$(Q )$$(PREPARE_MAN_CMD ) $$(S ) README.md $$(PREPARE_DEST_DIR )
178
208
$$(Q )$$(PREPARE_BIN_CMD ) $$(S ) src/etc/install.sh $$(PREPARE_DEST_DIR )
179
209
180
- dist/$$(PKG_DIR ) -$(1 ) .tar.gz: dist-install-dir-$(1 )
210
+ dist/$$(PKG_NAME ) -$(1 ) .tar.gz: dist-install-dir-$(1 )
181
211
@$(call E, build: $$@ )
182
- $$(Q ) tar -czf dist/$$(PKG_DIR ) -$(1 ) .tar.gz -C tmp/dist $$(PKG_DIR ) -$(1 )
212
+ $$(Q ) tar -czf dist/$$(PKG_NAME ) -$(1 ) .tar.gz -C tmp/dist $$(PKG_NAME ) -$(1 )
183
213
184
214
endef
185
215
186
216
$(foreach host,$(CFG_HOST),\
187
217
$(eval $(call DEF_INSTALLER,$(host))))
218
+
219
+ dist-install-dirs : $(foreach host,$(CFG_HOST ) ,dist-install-dir-$(host ) )
220
+
221
+ dist-tar-bins : $(foreach host,$(CFG_HOST ) ,dist/$(PKG_NAME ) -$(host ) .tar.gz)
222
+
223
+ # Just try to run the compiler for the build host
224
+ distcheck-tar-bins : dist-tar-bins
225
+ @$(call E, checking binary tarball)
226
+ $(Q ) rm -Rf tmp/distcheck/$(PKG_NAME ) -$(CFG_BUILD )
227
+ $(Q ) rm -Rf tmp/distcheck/tarbininstall
228
+ $(Q ) mkdir -p tmp/distcheck
229
+ $(Q ) cd tmp/distcheck && tar -xzf ../../dist/$(PKG_NAME ) -$(CFG_BUILD ) .tar.gz
230
+ $(Q ) mkdir -p tmp/distcheck/tarbininstall
231
+ $(Q ) sh tmp/distcheck/$(PKG_NAME ) -$(CFG_BUILD ) /install.sh --prefix=tmp/distcheck/tarbininstall
232
+ $(Q ) tmp/distcheck/tarbininstall/bin/rustc --version
233
+ $(Q ) rm -Rf tmp/distcheck/$(PKG_NAME ) -$(CFG_BUILD )
234
+ $(Q ) rm -Rf tmp/distcheck/tarbininstall
235
+
236
+ # #####################################################################
237
+ # Docs
238
+ # #####################################################################
239
+
240
+ # Just copy the docs to a folder under dist with the appropriate name
241
+ # for uploading to S3
242
+ dist-docs : docs compiler-docs
243
+ $(Q ) rm -Rf dist/doc
244
+ $(Q ) mkdir -p dist/doc/
245
+ $(Q ) cp -r doc dist/doc/$(CFG_PACKAGE_VERS )
246
+
247
+ distcheck-docs : dist-docs
248
+
249
+ # #####################################################################
250
+ # Primary targets (dist, distcheck)
251
+ # #####################################################################
252
+
253
+ ifdef CFG_WINDOWSY_$(CFG_BUILD)
254
+
255
+ dist : dist-win
256
+
257
+ distcheck : distcheck-win
258
+ $(Q ) rm -Rf tmp/distcheck
259
+ @echo
260
+ @echo -----------------------------------------------
261
+ @echo " Rust ready for distribution (see ./dist)"
262
+ @echo -----------------------------------------------
263
+
264
+ else
265
+
266
+ dist : dist-tar-src dist-osx dist-tar-bins dist-docs
267
+
268
+ distcheck : distcheck-tar-src distcheck-osx distcheck-tar-bins distcheck-docs
269
+ $(Q ) rm -Rf tmp/distcheck
270
+ @echo
271
+ @echo -----------------------------------------------
272
+ @echo " Rust ready for distribution (see ./dist)"
273
+ @echo -----------------------------------------------
274
+
275
+ endif
276
+
277
+ .PHONY : dist distcheck
0 commit comments