Skip to content

Commit

Permalink
Upgrade rust to version 1.48.0.
Browse files Browse the repository at this point in the history
Pkgsrc changes:
 * Compensate for files being moved around upstream.
 * Introduce optional, on-by-default semi-static building of cargo,
   using the internal curl and openssl sources.  This reduces the dynamic
   dependencies of cargo and therefore the rust package itself.
   Ref. options.mk.
 * The 1.47.0 bootstrap kits have been re-built with the above option
   turned on, so no longer depends on curl or openssl from pkgsrc and/or
   from earlier OS or pkgsrc versions.  This should hopefully fix
   installation of rust with non-default PREFIX, ref. PR#54453.


Upstream changes:

Version 1.48.0 (2020-11-19)
==========================

Language
--------
- [The `unsafe` keyword is now syntactically permitted on modules.][75857] This
  is still rejected *semantically*, but can now be parsed by procedural macros.

Compiler
--------
- [Stabilised the `-C link-self-contained=<yes|no>` compiler flag.][76158]
  This tells `rustc` whether to link its own C runtime and libraries
  or to rely on a external linker to find them. (Supported only on
  `windows-gnu`, `linux-musl`, and `wasi` platforms.)
- [You can now use `-C target-feature=+crt-static` on `linux-gnu` targets.]
  [77386]
  Note: If you're using cargo you must explicitly pass the `--target` flag.
- [Added tier 2\* support for `aarch64-unknown-linux-musl`.][76420]

\* Refer to Rust's [platform support page][forge-platform-support] for more
information on Rust's tiered platform support.

Libraries
---------
- [`io::Write` is now implemented for `&ChildStdin` `&Sink`, `&Stdout`,
  and `&Stderr`.][76275]
- [All arrays of any length now implement `TryFrom<Vec<T>>`.][76310]
- [The `matches!` macro now supports having a trailing comma.][74880]
- [`Vec<A>` now implements `PartialEq<[B]>` where `A: PartialEq<B>`.][74194]
- [The `RefCell::{replace, replace_with, clone}` methods now all use
  `#[track_caller]`.][77055]

Stabilized APIs
---------------
- [`slice::as_ptr_range`]
- [`slice::as_mut_ptr_range`]
- [`VecDeque::make_contiguous`]
- [`future::pending`]
- [`future::ready`]

The following previously stable methods are now `const fn`'s:

- [`Option::is_some`]
- [`Option::is_none`]
- [`Option::as_ref`]
- [`Result::is_ok`]
- [`Result::is_err`]
- [`Result::as_ref`]
- [`Ordering::reverse`]
- [`Ordering::then`]

Cargo
-----

Rustdoc
-------
- [You can now link to items in `rustdoc` using the intra-doc link
  syntax.][74430] E.g. ``/// Uses [`std::future`]`` will automatically generate
  a link to `std::future`'s documentation. See ["Linking to items by
  name"][intradoc-links] for more information.
- [You can now specify `#[doc(alias = "<alias>")]` on items to add
  search aliases when searching through `rustdoc`'s UI.][75740]

Compatibility Notes
-------------------
- [Promotion of references to `'static` lifetime inside `const fn`
  now follows the same rules as inside a `fn` body.][75502] In
  particular, `&foo()` will not be promoted to `'static` lifetime
  any more inside `const fn`s.
- [Associated type bindings on trait objects are now verified to meet the bounds
  declared on the trait when checking that they implement the trait.][27675]
- [When trait bounds on associated types or opaque types are ambiguous, the
  compiler no longer makes an arbitrary choice on which bound to use.][54121]
- [Fixed recursive nonterminals not being expanded in macros during
  pretty-print/reparse check.][77153] This may cause errors if your macro wasn't
  correctly handling recursive nonterminal tokens.
- [`&mut` references to non zero-sized types are no longer promoted.][75585]
- [`rustc` will now warn if you use attributes like `#[link_name]` or `#[cold]`
  in places where they have no effect.][73461]
- [Updated `_mm256_extract_epi8` and `_mm256_extract_epi16` signatures in
  `arch::{x86, x86_64}` to return `i32` to match the vendor signatures.][73166]
- [`mem::uninitialized` will now panic if any inner types inside
  a struct or enum disallow zero-initialization.][71274]
- [`#[target_feature]` will now error if used in a place where it
  has no effect.][78143]
- [Foreign exceptions are now caught by `catch_unwind` and will
  cause an abort.][70212] Note: This behaviour is not guaranteed
  and is still considered undefined behaviour, see the [`catch_unwind`]
  documentation for further information.

Internal Only
-------------
These changes provide no direct user facing benefits, but represent significant
improvements to the internals and overall performance of rustc and
related tools.

- [Building `rustc` from source now uses `ninja` by default over `make`.][74922]
  You can continue building with `make` by setting `ninja=false` in
  your `config.toml`.
- [cg_llvm: `fewer_names` in `uncached_llvm_type`][76030]
- [Made `ensure_sufficient_stack()` non-generic][76680]

[78143]: rust-lang/rust#78143
[76680]: rust-lang/rust#76680
[76030]: rust-lang/rust#76030
[70212]: rust-lang/rust#70212
[27675]: rust-lang/rust#27675
[54121]: rust-lang/rust#54121
[71274]: rust-lang/rust#71274
[77386]: rust-lang/rust#77386
[77153]: rust-lang/rust#77153
[77055]: rust-lang/rust#77055
[76275]: rust-lang/rust#76275
[76310]: rust-lang/rust#76310
[76420]: rust-lang/rust#76420
[76158]: rust-lang/rust#76158
[75857]: rust-lang/rust#75857
[75585]: rust-lang/rust#75585
[75740]: rust-lang/rust#75740
[75502]: rust-lang/rust#75502
[74880]: rust-lang/rust#74880
[74922]: rust-lang/rust#74922
[74430]: rust-lang/rust#74430
[74194]: rust-lang/rust#74194
[73461]: rust-lang/rust#73461
[73166]: rust-lang/rust#73166
[intradoc-links]: https://doc.rust-lang.org/rustdoc/linking-to-items-by-name.html
[`catch_unwind`]: https://doc.rust-lang.org/std/panic/fn.catch_unwind.html
[`Option::is_some`]: https://doc.rust-lang.org/std/option/enum.Option.html#method.is_some
[`Option::is_none`]: https://doc.rust-lang.org/std/option/enum.Option.html#method.is_none
[`Option::as_ref`]: https://doc.rust-lang.org/std/option/enum.Option.html#method.as_ref
[`Result::is_ok`]: https://doc.rust-lang.org/std/result/enum.Result.html#method.is_ok
[`Result::is_err`]: https://doc.rust-lang.org/std/result/enum.Result.html#method.is_err
[`Result::as_ref`]: https://doc.rust-lang.org/std/result/enum.Result.html#method.as_ref
[`Ordering::reverse`]: https://doc.rust-lang.org/std/cmp/enum.Ordering.html#method.reverse
[`Ordering::then`]: https://doc.rust-lang.org/std/cmp/enum.Ordering.html#method.then
[`slice::as_ptr_range`]: https://doc.rust-lang.org/std/primitive.slice.html#method.as_ptr_range
[`slice::as_mut_ptr_range`]: https://doc.rust-lang.org/std/primitive.slice.html#method.as_mut_ptr_range
[`VecDeque::make_contiguous`]: https://doc.rust-lang.org/std/collections/struct.VecDeque.html#method.make_contiguous
[`future::pending`]: https://doc.rust-lang.org/std/future/fn.pending.html
[`future::ready`]: https://doc.rust-lang.org/std/future/fn.ready.html
  • Loading branch information
he32 committed Jan 1, 2021
1 parent 663c234 commit 5e317d3
Show file tree
Hide file tree
Showing 13 changed files with 310 additions and 156 deletions.
96 changes: 69 additions & 27 deletions lang/rust/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# $NetBSD: Makefile,v 1.208 2020/11/29 20:15:15 he Exp $
# $NetBSD: Makefile,v 1.209 2021/01/01 20:44:48 he Exp $

DISTNAME= rustc-1.47.0-src
DISTNAME= rustc-1.48.0-src
PKGNAME= ${DISTNAME:S/rustc/rust/:S/-src//}
CATEGORIES= lang
MASTER_SITES= https://static.rust-lang.org/dist/
Expand Down Expand Up @@ -44,12 +44,18 @@ CONFIGURE_ARGS+= --disable-ninja
# XXX: to be enabled in the future
#CONFIGURE_ARGS+= --jemalloc-root=${BUILDLINK_PREFIX.jemalloc}/lib

# Include (optional) settings to cross-build rust
.include "cross.mk"

.if !empty(TARGET)
# Use "dist" build target for cross compile of bootstrap
#BUILD_TARGET= dist
BUILD_TARGET= dist
.else
BUILD_TARGET= build
.endif

# Include (optional) settings to cross-build rust
.include "cross.mk"
# More diag when failing
#MAKE_ENV+= RUST_BACKTRACE=1

# Getting RPATH with $ORIGIN into bootstrap may be troublesome, so
# uncommenting the LD_LIBRARY_PATH setting may be required to run
Expand Down Expand Up @@ -154,23 +160,23 @@ BUILDLINK_TRANSFORM.NetBSD+= rm:-Wl,--enable-new-dtags
DISTFILES:= ${DEFAULT_DISTFILES}

.if !empty(MACHINE_PLATFORM:MDarwin-*-x86_64) || make(distinfo) || make (makesum) || make(mdi)
RUST_STAGE0_VER= 1.46.0
RUST_STAGE0_VER= 1.47.0
RUST_ARCH:= x86_64-apple-darwin
RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
RUST_STD_STAGE0:= rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
DISTFILES:= ${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
pre-build-fix:
.endif
.if !empty(MACHINE_PLATFORM:MLinux-*-i386) || make(distinfo) || make (makesum) || make(mdi)
RUST_STAGE0_VER= 1.46.0
RUST_STAGE0_VER= 1.47.0
RUST_ARCH:= i686-unknown-linux-gnu
RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
RUST_STD_STAGE0:= rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
DISTFILES:= ${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
pre-build-fix:
.endif
.if !empty(MACHINE_PLATFORM:MLinux-*-x86_64) || make(distinfo) || make (makesum) || make(mdi)
RUST_STAGE0_VER= 1.46.0
RUST_STAGE0_VER= 1.47.0
RUST_ARCH:= x86_64-unknown-linux-gnu
RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
RUST_STD_STAGE0:= rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
Expand All @@ -187,23 +193,23 @@ RUST_BOOTSTRAP_PATH?= ${WRKDIR}/rust-${RUST_STAGE0_VER}-${RUST_ARCH}
pre-build-fix:
.endif
.if !empty(MACHINE_PLATFORM:MFreeBSD-*-i386) || make(distinfo) || make (makesum) || make(mdi)
RUST_STAGE0_VER= 1.46.0
RUST_STAGE0_VER= 1.47.0
RUST_ARCH:= i686-unknown-freebsd
RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
RUST_STD_STAGE0:= rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
DISTFILES:= ${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
pre-build-fix:
.endif
.if !empty(MACHINE_PLATFORM:MFreeBSD-*-x86_64) || make(distinfo) || make (makesum) || make(mdi)
RUST_STAGE0_VER= 1.46.0
RUST_STAGE0_VER= 1.47.0
RUST_ARCH:= x86_64-unknown-freebsd
RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
RUST_STD_STAGE0:= rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
DISTFILES:= ${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
pre-build-fix:
.endif
.if !empty(MACHINE_PLATFORM:MNetBSD-*-i386) || make(distinfo) || make (makesum) || make(mdi)
RUST_STAGE0_VER= 1.46.0
RUST_STAGE0_VER= 1.47.0
RUST_ARCH= i686-unknown-netbsd
RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
RUST_STD_STAGE0:= rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
Expand All @@ -220,15 +226,15 @@ pre-build-fix:
${TOOLS_PLATFORM.paxctl} +am ${WRKDIR}/rust-bootstrap/bin/rustc
.endif
.if !empty(MACHINE_PLATFORM:MNetBSD-*-x86_64) || make(distinfo) || make (makesum) || make(mdi)
RUST_STAGE0_VER= 1.46.0
RUST_STAGE0_VER= 1.47.0
RUST_ARCH= x86_64-unknown-netbsd
RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
RUST_STD_STAGE0:= rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
DISTFILES:= ${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
pre-build-fix:
.endif
.if !empty(MACHINE_PLATFORM:MNetBSD-*-powerpc) || make(distinfo) || make (makesum) || make(mdi)
RUST_STAGE0_VER= 1.46.0
RUST_STAGE0_VER= 1.47.0
RUST_ARCH= powerpc-unknown-netbsd

# Cross-built against NetBSD 9.0
Expand All @@ -252,7 +258,7 @@ SITES.${RUST_STD_STAGE0}= ${MASTER_SITE_LOCAL:=rust/}
pre-build-fix:
.endif
.if !empty(MACHINE_PLATFORM:MNetBSD-*-aarch64) || make(distinfo) || make (makesum) || make(mdi)
RUST_STAGE0_VER= 1.46.0
RUST_STAGE0_VER= 1.47.0
RUST_ARCH= aarch64-unknown-netbsd
RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
RUST_STD_STAGE0:= rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
Expand All @@ -262,7 +268,7 @@ SITES.${RUST_STD_STAGE0}= ${MASTER_SITE_LOCAL:=rust/}
pre-build-fix:
.endif
.if !empty(MACHINE_PLATFORM:MNetBSD-*-sparc64) || make(distinfo) || make (makesum) || make(mdi)
RUST_STAGE0_VER= 1.46.0
RUST_STAGE0_VER= 1.47.0
RUST_ARCH= sparc64-unknown-netbsd
RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
RUST_STD_STAGE0:= rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
Expand All @@ -273,7 +279,7 @@ pre-build-fix:
.endif
.if !empty(MACHINE_PLATFORM:MNetBSD-*-earmv7hf) || make(distinfo) || make (makesum) || make(mdi)
RUST_ARCH= armv7-unknown-netbsd-eabihf
RUST_STAGE0_VER= 1.46.0
RUST_STAGE0_VER= 1.47.0
RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
RUST_STD_STAGE0:= rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
DISTFILES:= ${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
Expand All @@ -282,7 +288,8 @@ SITES.${RUST_STD_STAGE0}= ${MASTER_SITE_LOCAL:=rust/}
pre-build-fix:
.endif

# You may override RUST_BOOTSTRAP_PATH and RUST_ARCH in mk.conf if you have a local bootstrap compiler.
# You may override RUST_BOOTSTRAP_PATH and RUST_ARCH in mk.conf
# if you have a local bootstrap compiler.
.if !defined(RUST_ARCH) && !defined(RUST_BOOTSTRAP_PATH)
NOT_FOR_PLATFORM+= ${MACHINE_PLATFORM}
.else
Expand All @@ -299,8 +306,9 @@ TOOLS_PLATFORM.gzcat= ${PREFIX}/bin/gzip -cd

SUBST_CLASSES+= rpath
SUBST_STAGE.rpath= pre-configure
SUBST_FILES.rpath+= src/librustc_codegen_ssa/back/linker.rs
SUBST_FILES.rpath+= compiler/rustc_codegen_ssa/src/back/linker.rs
SUBST_FILES.rpath+= src/bootstrap/builder.rs
SUBST_FILES.rpath+= src/bootstrap/compile.rs
SUBST_VARS.rpath= PREFIX

#
Expand All @@ -310,16 +318,25 @@ SUBST_VARS.rpath= PREFIX
# updating and verification.
#
CKSUM_CRATES+= vendor/libc
CKSUMS+= 9f96e346d87296e2b0b87b9fe375d67fb66cd88ce61ea2905466c8c5891d3108
CKSUMS+= ebcb0709586e6ed1e8b4538368201638006e26042d464bbc1151bef9eb158f8c
CKSUMS+= a9e46c0eee970cb5b4bd910924141d223fad4aa45380d3df1ce4b25992a13037
CKSUMS+= 41394431697e352653c37188233bd44776881eb704132203b1a232271d1afd92

CKSUM_CRATES+= vendor/lzma-sys
CKSUMS+= 6fd5e9245db34c6f557b8bfcaf03db82fc88c3b06dbfbb5f03b2bcd138983ef9
CKSUMS+= 5e252578b5d266f6a4c8dc9f71ca7a91536ccb8c5c7d7753b82f12ec886459ef

CKSUM_CRATES+= vendor/stacker
CKSUMS+= 37ef9666d048191eeca23d8f7d99cf912b953cc489bf860107aec306b95b2d99
CKSUMS+= 410f22f5e95860530be1abaaf2e279d2f4226e5c17c2cee302661d8079246b3a
CKSUMS+= cee329550bad2ed1182abb71db9c24558a91b12e1eab8d9a48e23b997bb8f04e
CKSUMS+= 79915b243d02df1dc698f5c2de3a9356c6c296d2dedb06d9035dbcc2f8972cf4

CKSUM_CRATES+= vendor/net2
CKSUMS+= 03836f768aaf8c7bc9a351f3c10ce47d1f27f162133e99941850f84bb0e9dbc5
CKSUMS+= bc857fca2bb7a6c999b19911339dff54a882ef096ad424f21dcec9e13600b871

CKSUM_CRATES+= vendor/openssl-src
CKSUMS+= 29499e62a2cde2fda48d21df58812ee5c198ef744522992bde8faae76747ac08
CKSUMS+= e34f9921c6531d043f3516821442aaeda86c7912d40cbddaf79bba6b08c37952


SUBST_CLASSES+= cksum
SUBST_STAGE.cksum= pre-configure
Expand All @@ -330,6 +347,17 @@ SUBST_FILES.cksum+= ${crate}/.cargo-checksum.json
SUBST_SED.cksum+= -e 's,${from},${to},g'
.endfor

# Patchelf appears to create unrecognized binaries...
#.if ${OPSYS} == "NetBSD"
#TOOL_DEPENDS+= patchelf-[0-9]*:../../devel/patchelf
#PATCHELF= ${PREFIX}/bin/patchelf
#FORCE_RPATH= --force-rpath
#.endif

#TOOL_DEPENDS+= patchelf-[0-9]*:../../devel/patchelf
#PATCHELF= ${PREFIX}/bin/patchelf
#FORCE_RPATH= --force-rpath

post-extract:
set -e; \
if ${TEST} -e ${WRKDIR}/rust-${RUST_STAGE0_VER}-${RUST_ARCH}/install.sh \
Expand All @@ -351,6 +379,12 @@ post-extract:
${LN} -s gcc-wrap c++-wrap; \
${LN} -s gcc-wrap clang++-wrap; \
${LN} -s gcc-wrap clang-wrap
# Fixup cargo rpath to pick up libcurl.so
# RPATH='${PREFIX}/lib:/lib:/usr/lib:$$ORIGIN/../lib'; \
# for f in bin/cargo; do \
# f=${RUST_BOOTSTRAP_PATH:Q}/$$f; \
# ${PATCHELF} ${FORCE_RPATH} --set-rpath $${RPATH} $$f; \
# done
.endif

.if ${OPSYS} == "FreeBSD"
Expand Down Expand Up @@ -439,20 +473,24 @@ stage0-bootstrap: install
${ECHO} "$${RUST_STD_FILE}"; \
)
.endif

.if ${OS_VARIANT} == "SmartOS"
stage0-bootstrap: install
${RM} -rf ${BOOTSTRAP_TMPDIR}
${MKDIR} ${BOOTSTRAP_TMPDIR}
${CP} -R ${DESTDIR}/${PREFIX}/bin ${BOOTSTRAP_TMPDIR}/
${CP} -R ${DESTDIR}/${PREFIX}/lib ${BOOTSTRAP_TMPDIR}/
${MKDIR} ${BOOTSTRAP_TMPDIR}/lib/pkgsrc
for lib in libgcc_s.so.1 libssp.so.0 libstdc++.so.6; do \
${CP} `${PKG_CC} -print-file-name=$${lib}` \
${BOOTSTRAP_TMPDIR}/lib/pkgsrc/; \
done
# direct dependencies
: direct dependencies
for lib in libLLVM-10.so libcrypto.so.1.1 libcurl.so.4 \
libssl.so.1.1 libz.so.1; do \
${CP} ${PREFIX}/lib/$${lib} ${BOOTSTRAP_TMPDIR}/lib/pkgsrc/; \
done
# libcurl dependencies
: libcurl dependencies
for lib in libiconv.so.2 libidn2.so.0 libintl.so.8 liblber-2.4.so.2 \
libldap-2.4.so.2 libnghttp2.so.14 libsasl2.so.3 \
libssh2.so.1 libunistring.so.2; do \
Expand Down Expand Up @@ -527,9 +565,13 @@ DEPENDS+= libatomic-links>=0:../../devel/libatomic-links
DEPENDS+= openssl>=1.1:../../security/openssl
.endif

# This is for when we build natively:
.if ((${OPSYS} == "NetBSD") && \
((${MACHINE_ARCH} == "powerpc") || (${MACHINE_ARCH} == "i386")))
# For 8-byte atomics, required by LLVM
.include "../../devel/libatomic/buildlink3.mk"
.endif

.include "../../devel/zlib/buildlink3.mk"
.include "../../lang/python/tool.mk"
.include "../../security/openssl/buildlink3.mk"
BUILDLINK_API_DEPENDS.curl+= curl>=7.67.0
.include "../../www/curl/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"
Loading

0 comments on commit 5e317d3

Please sign in to comment.