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
-
11
1
# #####################################################################
12
2
# Distribution
13
3
# #####################################################################
14
4
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
24
-
25
- PKG_NAME = $(CFG_PACKAGE_NAME )
5
+ PKG_NAME := rust
6
+ PKG_DIR = $(PKG_NAME ) -$(CFG_RELEASE )
7
+ PKG_TAR = dist/$(PKG_DIR ) .tar.gz
26
8
27
- # License suitable for displaying in a popup
28
- LICENSE.txt : $(S ) COPYRIGHT $(S ) LICENSE-APACHE $(S ) LICENSE-MIT
29
- cat $^ > $@
30
-
31
-
32
- # #####################################################################
33
- # Source tarball
34
- # #####################################################################
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
35
14
36
- PKG_TAR = dist/$(PKG_NAME ) .tar.gz
15
+ ifeq ($(CFG_OSTYPE ) , apple-darwin)
16
+ PKG_OSX = dist/$(PKG_DIR ) .pkg
17
+ endif
37
18
38
19
PKG_GITMODULES := $(S ) src/libuv $(S ) src/llvm $(S ) src/gyp $(S ) src/compiler-rt
20
+
39
21
PKG_FILES := \
40
22
$(S ) COPYRIGHT \
41
23
$(S ) LICENSE-APACHE \
@@ -58,73 +40,28 @@ PKG_FILES := \
58
40
snapshots.txt \
59
41
test) \
60
42
$(PKG_GITMODULES ) \
61
- $(filter-out config.stamp, \
62
- $(MKFILES_FOR_TARBALL ) )
43
+ $(filter-out Makefile config.stamp config.mk , \
44
+ $(MKFILE_DEPS ) )
63
45
64
46
UNROOTED_PKG_FILES := $(patsubst $(S ) % ,./% ,$(PKG_FILES ) )
65
47
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
48
+ LICENSE.txt : $(S ) COPYRIGHT $(S ) LICENSE-APACHE $(S ) LICENSE-MIT
49
+ cat $^ > $@
108
50
109
51
ifdef CFG_ISCC
110
-
111
- PKG_EXE = dist/$(PKG_NAME ) -install.exe
112
-
113
52
% .iss : $(S ) src/etc/pkg/% .iss
114
53
cp $< $@
115
54
116
55
% .ico : $(S ) src/etc/pkg/% .ico
117
56
cp $< $@
118
57
119
58
$(PKG_EXE ) : rust.iss modpath.iss LICENSE.txt rust-logo.ico \
120
- $(CSREQ3_T_$(CFG_BUILD)_H_$(CFG_BUILD)) \
59
+ $(PKG_FILES) $( CSREQ3_T_$(CFG_BUILD)_H_$(CFG_BUILD)) \
121
60
dist-prepare-win
122
61
$(CFG_PYTHON) $(S)src/etc/copy-runtime-deps.py tmp/dist/win/bin
123
62
@$(call E, ISCC: $@)
124
63
$(Q)"$(CFG_ISCC)" $<
125
64
126
- $(eval $(call DEF_PREPARE,win))
127
-
128
65
dist-prepare-win : PREPARE_HOST=$(CFG_BUILD )
129
66
dist-prepare-win : PREPARE_TARGETS=$(CFG_BUILD )
130
67
dist-prepare-win : PREPARE_DEST_DIR=tmp/dist/win
@@ -133,72 +70,105 @@ dist-prepare-win: PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD)
133
70
dist-prepare-win : PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD )
134
71
dist-prepare-win : PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD )
135
72
dist-prepare-win : PREPARE_CLEAN=true
136
- dist-prepare-win : prepare-base-win
73
+ dist-prepare-win : prepare-base
137
74
138
75
endif
139
76
140
- dist-win : $(PKG_EXE )
141
-
142
- distcheck-win : dist-win
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)
143
94
144
- # #####################################################################
145
- # OS X .pkg installer
146
- # #####################################################################
95
+ .PHONY : dist distcheck
147
96
148
- ifeq ( $( CFG_OSTYPE ) , apple-darwin )
97
+ ifdef CFG_WINDOWSY_$(CFG_BUILD )
149
98
150
- define DEF_OSX_PKG
99
+ dist : $( PKG_EXE )
151
100
152
- $$(eval $$(call DEF_PREPARE,osx-$(1 ) ) )
101
+ distcheck : dist
102
+ @echo
103
+ @echo -----------------------------------------------
104
+ @echo $(PKG_EXE ) ready for distribution
105
+ @echo -----------------------------------------------
153
106
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 )
107
+ else
162
108
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
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 -----------------------------------------------
168
128
169
- endef
129
+ endif
170
130
171
- $(foreach host,$(CFG_HOST),$(eval $(call DEF_OSX_PKG,$(host))) )
131
+ ifeq ( $( CFG_OSTYPE ) , apple-darwin )
172
132
173
- dist-osx : $(foreach host,$(CFG_HOST ) ,dist/$(PKG_NAME ) -$(host ) .pkg)
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
174
147
175
- else
148
+ dist-osx : $( PKG_OSX )
176
149
177
- dist-osx :
150
+ distcheck-osx : $(PKG_OSX )
151
+ @echo
152
+ @echo -----------------------------------------------
153
+ @echo $(PKG_OSX ) ready for distribution
154
+ @echo -----------------------------------------------
178
155
179
156
endif
180
157
181
- # FIXME should do something
182
- distcheck-osx : dist-osx
158
+ dist-install-dir : $(foreach host,$(CFG_HOST ) ,dist-install-dir-$(host ) )
183
159
184
-
185
- # #####################################################################
186
- # Unix binary installer tarballs
187
- # #####################################################################
160
+ dist-tar-bins : $(foreach host,$(CFG_HOST ) ,dist/$(PKG_DIR ) -$(host ) .tar.gz)
188
161
189
162
define DEF_INSTALLER
190
-
191
- $$(eval $$(call DEF_PREPARE,dir-$(1 ) ) )
192
-
193
163
dist-install-dir-$(1 ) : PREPARE_HOST=$(1 )
194
164
dist-install-dir-$(1 ) : PREPARE_TARGETS=$(1 )
195
- dist-install-dir-$(1 ) : PREPARE_DEST_DIR=tmp/dist/$$(PKG_NAME ) -$(1 )
165
+ dist-install-dir-$(1 ) : PREPARE_DEST_DIR=tmp/dist/$$(PKG_DIR ) -$(1 )
196
166
dist-install-dir-$(1 ) : PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD )
197
167
dist-install-dir-$(1 ) : PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD )
198
168
dist-install-dir-$(1 ) : PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD )
199
169
dist-install-dir-$(1 ) : PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD )
200
170
dist-install-dir-$(1 ) : PREPARE_CLEAN=true
201
- dist-install-dir-$(1 ) : prepare-base-dir- $( 1 )
171
+ dist-install-dir-$(1 ) : prepare-base
202
172
$$(Q ) (cd $$(PREPARE_DEST_DIR ) / && find -type f) \
203
173
> $$(PREPARE_DEST_DIR ) /$$(CFG_LIBDIR_RELATIVE ) /$$(CFG_RUSTLIBDIR ) /manifest
204
174
$$(Q )$$(PREPARE_MAN_CMD ) $$(S ) COPYRIGHT $$(PREPARE_DEST_DIR )
@@ -207,71 +177,11 @@ dist-install-dir-$(1): prepare-base-dir-$(1)
207
177
$$(Q )$$(PREPARE_MAN_CMD ) $$(S ) README.md $$(PREPARE_DEST_DIR )
208
178
$$(Q )$$(PREPARE_BIN_CMD ) $$(S ) src/etc/install.sh $$(PREPARE_DEST_DIR )
209
179
210
- dist/$$(PKG_NAME ) -$(1 ) .tar.gz: dist-install-dir-$(1 )
180
+ dist/$$(PKG_DIR ) -$(1 ) .tar.gz: dist-install-dir-$(1 )
211
181
@$(call E, build: $$@ )
212
- $$(Q ) tar -czf dist/$$(PKG_NAME ) -$(1 ) .tar.gz -C tmp/dist $$(PKG_NAME ) -$(1 )
182
+ $$(Q ) tar -czf dist/$$(PKG_DIR ) -$(1 ) .tar.gz -C tmp/dist $$(PKG_DIR ) -$(1 )
213
183
214
184
endef
215
185
216
186
$(foreach host,$(CFG_HOST),\
217
187
$(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