|
1 | 1 | CFG_RELEASE_NUM=0.10.0
|
2 | 2 | CFG_RELEASE_LABEL=
|
3 | 3 |
|
| 4 | +OPENSSL_VERS=1.0.2g |
| 5 | +OPENSSL_SHA256=b784b1b3907ce39abf4098702dade6365522a253ad1552e267a9a0e89594aa33 |
| 6 | + |
4 | 7 | include config.mk
|
5 | 8 |
|
6 | 9 | ifneq ($(CFG_LOCAL_RUST_ROOT),)
|
|
46 | 49 | VERBOSE_FLAG=
|
47 | 50 | endif
|
48 | 51 |
|
| 52 | +ifdef CFG_CUSTOM_BUILD_DIR |
| 53 | +export CARGO_TARGET_DIR := $(CFG_CUSTOM_BUILD_DIR) |
| 54 | +endif |
| 55 | + |
| 56 | +S := $(CFG_SRC_DIR)/ |
| 57 | + |
49 | 58 | export CFG_VERSION
|
50 | 59 | export CFG_DISABLE_CROSS_TESTS
|
51 | 60 |
|
@@ -81,19 +90,21 @@ endif
|
81 | 90 | all: $(foreach target,$(CFG_TARGET),cargo-$(target))
|
82 | 91 |
|
83 | 92 | define CARGO_TARGET
|
84 |
| -cargo-$(1): $$(CARGO) |
| 93 | +cargo-$(1): $$(CARGO) target/openssl/$(1).stamp |
85 | 94 | $$(CFG_RUSTC) -V
|
86 | 95 | $$(CARGO) --version
|
87 |
| - $$(CARGO) build --target $(1) $$(OPT_FLAG) $$(VERBOSE_FLAG) $$(ARGS) |
| 96 | + $$(CARGO) build --target $(1) \ |
| 97 | + --manifest-path $(S)Cargo.toml \ |
| 98 | + $$(OPT_FLAG) $$(VERBOSE_FLAG) $$(ARGS) |
88 | 99 |
|
89 | 100 | test-unit-$(1): $$(CARGO)
|
90 | 101 | @mkdir -p target/$(1)/cit
|
91 | 102 | $$(CARGO) test --target $(1) $$(VERBOSE_FLAG) $$(only)
|
92 | 103 | endef
|
93 | 104 | $(foreach target,$(CFG_TARGET),$(eval $(call CARGO_TARGET,$(target))))
|
94 | 105 |
|
95 |
| -$(TARGET_ROOT)/snapshot/bin/cargo$(X): src/snapshots.txt |
96 |
| - $(CFG_PYTHON) src/etc/dl-snapshot.py $(CFG_BUILD) |
| 106 | +$(TARGET_ROOT)/snapshot/bin/cargo$(X): $(S)src/snapshots.txt |
| 107 | + $(CFG_PYTHON) $(S)src/etc/dl-snapshot.py $(CFG_BUILD) |
97 | 108 | touch $@
|
98 | 109 |
|
99 | 110 |
|
@@ -155,6 +166,76 @@ $(DOC_DIR)/%: src/doc/%
|
155 | 166 | @mkdir -p $(@D)
|
156 | 167 | cp $< $@
|
157 | 168 |
|
| 169 | +ifdef CFG_ENABLE_NIGHTLY |
| 170 | + |
| 171 | +OPENSSL_OS_x86_64-unknown-linux-gnu := linux-x86_64 |
| 172 | +OPENSSL_OS_x86_64-unknown-linux-musl := linux-x86_64 |
| 173 | +OPENSSL_OS_i686-unknown-linux-gnu := linux-x32 |
| 174 | +OPENSSL_OS_arm-unknown-linux-gnueabi := linux-armv4 |
| 175 | +OPENSSL_OS_arm-unknown-linux-gnueabihf := linux-armv4 |
| 176 | +OPENSSL_OS_armv7-unknown-linux-gnueabihf := linux-armv4 |
| 177 | +OPENSSL_OS_x86_64-unknown-freebsd := BSD-x86_64 |
| 178 | +OPENSSL_OS_x86_64-unknown-netbsd := BSD-x86_64 |
| 179 | + |
| 180 | +OPENSSL_CC_x86_64-unknown-linux-gnu := gcc |
| 181 | +OPENSSL_CC_x86_64-unknown-linux-musl := musl-gcc |
| 182 | +OPENSSL_CC_i686-unknown-linux-gnu := gcc |
| 183 | +OPENSSL_CC_arm-unknown-linux-gnueabi := arm-linux-gnueabi-gcc |
| 184 | +OPENSSL_CC_arm-unknown-linux-gnueabihf := arm-linux-gnueabihf-gcc |
| 185 | +OPENSSL_CC_armv7-unknown-linux-gnueabihf := armv7-linux-gnueabihf-gcc |
| 186 | +OPENSSL_CC_x86_64-unknown-freebsd := x86_64-unknown-freebsd10-gcc |
| 187 | +OPENSSL_CC_x86_64-unknown-netbsd := x86_64-unknown-netbsd-gcc |
| 188 | +OPENSSL_AR_x86_64-unknown-linux-gnu := ar |
| 189 | +OPENSSL_AR_x86_64-unknown-linux-musl := ar |
| 190 | +OPENSSL_AR_i686-unknown-linux-gnu := ar |
| 191 | +OPENSSL_AR_arm-unknown-linux-gnueabi := arm-linux-gnueabi-ar |
| 192 | +OPENSSL_AR_arm-unknown-linux-gnueabihf := arm-linux-gnueabihf-ar |
| 193 | +OPENSSL_AR_armv7-unknown-linux-gnueabihf := armv7-linux-gnueabihf-ar |
| 194 | +OPENSSL_AR_x86_64-unknown-freebsd := x86_64-unknown-freebsd10-ar |
| 195 | +OPENSSL_AR_x86_64-unknown-netbsd := x86_64-unknown-netbsd-ar |
| 196 | + |
| 197 | +define BUILD_OPENSSL |
| 198 | +OPENSSL_INSTALL_$(1) := $$(CFG_BUILD_DIR)/target/openssl/$(1)-install |
| 199 | + |
| 200 | +target/openssl/$(1).stamp: target/openssl/openssl-$$(OPENSSL_VERS).tar.gz \ |
| 201 | + | target/openssl/ |
| 202 | + mkdir -p target/openssl/$(1) |
| 203 | + tar xf $$< -C target/openssl/$(1) --strip-components 1 |
| 204 | + (cd target/openssl/$(1) && \ |
| 205 | + CC=$$(OPENSSL_CC_$(1)) \ |
| 206 | + AR=$$(OPENSSL_AR_$(1)) \ |
| 207 | + ./Configure --prefix=$$(OPENSSL_INSTALL_$(1)) \ |
| 208 | + no-dso $$(OPENSSL_OS_$(1)) -fPIC && \ |
| 209 | + $(MAKE) -j10 && \ |
| 210 | + $(MAKE) install) |
| 211 | + touch $$@ |
| 212 | + |
| 213 | +# variables read by various build scripts to find openssl |
| 214 | +cargo-$(1): export OPENSSL_STATIC := 1 |
| 215 | +cargo-$(1): export OPENSSL_ROOT_DIR := $$(OPENSSL_INSTALL_$(1)) |
| 216 | +cargo-$(1): export OPENSSL_LIB_DIR := $$(OPENSSL_INSTALL_$(1))/lib |
| 217 | +cargo-$(1): export OPENSSL_INCLUDE_DIR := $$(OPENSSL_INSTALL_$(1))/include |
| 218 | + |
| 219 | +# build libz statically into the cargo we're producing |
| 220 | +cargo-$(1): export LIBZ_SYS_STATIC := 1 |
| 221 | +endef |
| 222 | + |
| 223 | +$(foreach target,$(CFG_TARGET),$(eval $(call BUILD_OPENSSL,$(target)))) |
| 224 | + |
| 225 | +target/openssl/openssl-$(OPENSSL_VERS).tar.gz: | target/openssl/ |
| 226 | + curl -o $(@) https://openssl.org/source/openssl-$(OPENSSL_VERS).tar.gz |
| 227 | + sha256sum $(@) > $(@).sha256 |
| 228 | + test $(OPENSSL_SHA256) = `cut -d ' ' -f 1 $(@).sha256` |
| 229 | + |
| 230 | +target/openssl/: |
| 231 | + mkdir -p $(@) |
| 232 | +else |
| 233 | +define BUILD_OPENSSL |
| 234 | +target/openssl/$(1).stamp: |
| 235 | +endef |
| 236 | +$(foreach target,$(CFG_TARGET),$(eval $(call BUILD_OPENSSL,$(target)))) |
| 237 | +endif |
| 238 | + |
158 | 239 | # === Distribution
|
159 | 240 |
|
160 | 241 | define DO_DIST_TARGET
|
@@ -186,21 +267,23 @@ prepare-image-$(1):
|
186 | 267 | $$(IMGDIR_$(1))/share/zsh/site-functions \
|
187 | 268 | $$(IMGDIR_$(1))/etc/bash_completion.d
|
188 | 269 | cp $$(TARGET_$(1))/cargo$$(X) $$(IMGDIR_$(1))/bin
|
189 |
| - cp src/etc/cargo.1 $$(IMGDIR_$(1))/share/man/man1 |
190 |
| - cp src/etc/_cargo $$(IMGDIR_$(1))/share/zsh/site-functions/_cargo |
191 |
| - cp src/etc/cargo.bashcomp.sh $$(IMGDIR_$(1))/etc/bash_completion.d/cargo |
192 |
| - cp README.md LICENSE-MIT LICENSE-APACHE LICENSE-THIRD-PARTY \ |
| 270 | + cp $(S)src/etc/cargo.1 $$(IMGDIR_$(1))/share/man/man1 |
| 271 | + cp $(S)src/etc/_cargo $$(IMGDIR_$(1))/share/zsh/site-functions/_cargo |
| 272 | + cp $(S)src/etc/cargo.bashcomp.sh $$(IMGDIR_$(1))/etc/bash_completion.d/cargo |
| 273 | + cp $(S)README.md $(S)LICENSE-MIT $(S)LICENSE-APACHE \ |
| 274 | + $(S)LICENSE-THIRD-PARTY \ |
193 | 275 | $$(IMGDIR_$(1))/share/doc/cargo
|
194 | 276 |
|
195 | 277 | prepare-overlay-$(1):
|
196 | 278 | rm -Rf $$(OVERLAYDIR_$(1))
|
197 | 279 | mkdir -p $$(OVERLAYDIR_$(1))
|
198 |
| - cp README.md LICENSE-MIT LICENSE-APACHE LICENSE-THIRD-PARTY \ |
| 280 | + cp $(S)README.md $(S)LICENSE-MIT $(S)LICENSE-APACHE \ |
| 281 | + $(S)LICENSE-THIRD-PARTY \ |
199 | 282 | $$(OVERLAYDIR_$(1))
|
200 | 283 | echo "$(CFG_VERSION)" > $$(OVERLAYDIR_$(1))/version
|
201 | 284 |
|
202 | 285 | $$(DISTDIR_$(1))/$$(PKG_NAME)-$(1).tar.gz: prepare-image-$(1) prepare-overlay-$(1)
|
203 |
| - sh src/rust-installer/gen-installer.sh \ |
| 286 | + sh $(S)src/rust-installer/gen-installer.sh \ |
204 | 287 | --product-name=Rust \
|
205 | 288 | --rel-manifest-dir=rustlib \
|
206 | 289 | --success-message=Rust-is-ready-to-roll. \
|
|
0 commit comments