File: [cvs.NetBSD.org] / pkgsrc / lang / rust / Makefile (download)
Revision 1.238, Wed May 26 09:21:39 2021 UTC (2 years, 10 months ago) by he
Branch: MAIN
Changes since 1.237: +60 -38
lines
Update lang/rust to version 1.51.0.
Pkgsrc changes:
* Add support for the big-endian arm64 NetBSD target (aarch64_be).
* On NetBSD/i386, use the i586 (pentium) bootstrap kit variant in
preference to i686.
* Adjust patches, re-compute line offsets, re-compute crate checksums.
* Remove a patch which was either integrated upstream and/or no longer
applies.
* Bump bootstraps to 1.50.0.
* Move conditionals until after bsd.prefs.mk so that they work...
* Default to "dist" build target if cross-compiling, but allow
also to override via rust.BUILD_TARGET.
* Allow overriding MAKE_JOBS_SAFE via rust.MAKE_JOBS_SAFE if you
want a different trade-off between occasional breakage and performance.
* Adjust platform.mk according to work already done in wip/rust/
* Add a patch to optimize the install.sh script used to install binary
bootstraps to not do so many forks; use case/esac and parameter expansion
instead of grep, sed and cut.
* Drop building documentation for the binary bootstrap kits. This will
also impact the lang/rust-bin package. For full documentation, build
or install lang/rust as a package.
Upstream changes:
Version 1.51.0 (2021-03-25)
============================
Language
--------
- [You can now parameterize items such as functions, traits, and
`struct`s by constant values in addition to by types and
lifetimes.][79135] Also known as "const generics" E.g. you can
now write the following. Note: Only values of primitive integers,
`bool`, or `char` types are currently permitted.
```rust
struct GenericArray<T, const LENGTH: usize> {
inner: [T; LENGTH]
}
impl<T, const LENGTH: usize> GenericArray<T, LENGTH> {
const fn last(&self) -> Option<&T> {
if LENGTH == 0 {
None
} else {
Some(&self.inner[LENGTH - 1])
}
}
}
```
Compiler
--------
- [Added the `-Csplit-debuginfo` codegen option for macOS platforms.][79570]
This option controls whether debug information is split across
multiple files or packed into a single file. **Note** This option
is unstable on other platforms.
- [Added tier 3\* support for `aarch64_be-unknown-linux-gnu`,
`aarch64-unknown-linux-gnu_ilp32`, and
`aarch64_be-unknown-linux-gnu_ilp32` targets.][81455]
- [Added tier 3 support for `i386-unknown-linux-gnu` and
`i486-unknown-linux-gnu` targets.][80662]
- [The `target-cpu=native` option will now detect individual features
of CPUs.][80749]
\* Refer to Rust's [platform support page][platform-support-doc] for more
information on Rust's tiered platform support.
Libraries
---------
- [`Box::downcast` is now also implemented for any `dyn Any + Send
+ Sync` object.][80945]
- [`str` now implements `AsMut<str>`.][80279]
- [`u64` and `u128` now implement `From<char>`.][79502]
- [`Error` is now implemented for `&T` where `T` implements `Error`.][75180]
- [`Poll::{map_ok, map_err}` are now implemented for
`Poll<Option<Result<T,E>>>`.][80968]
- [`unsigned_abs` is now implemented for all signed integer types.][80959]
- [`io::Empty` now implements `io::Seek`.][78044]
- [`rc::Weak<T>` and `sync::Weak<T>`'s methods such as `as_ptr`
are now implemented for `T: ?Sized` types.][80764]
- [`Div` and `Rem` by their `NonZero` variant is now implemented
for all unsigned integers.][79134]
Stabilized APIs
---------------
- [`Arc::decrement_strong_count`]
- [`Arc::increment_strong_count`]
- [`Once::call_once_force`]
- [`Peekable::next_if_eq`]
- [`Peekable::next_if`]
- [`Seek::stream_position`]
- [`array::IntoIter`]
- [`panic::panic_any`]
- [`ptr::addr_of!`]
- [`ptr::addr_of_mut!`]
- [`slice::fill_with`]
- [`slice::split_inclusive_mut`]
- [`slice::split_inclusive`]
- [`slice::strip_prefix`]
- [`slice::strip_suffix`]
- [`str::split_inclusive`]
- [`sync::OnceState`]
- [`task::Wake`]
- [`VecDeque::range`]
- [`VecDeque::range_mut`]
Cargo
-----
- [Added the `split-debuginfo` profile option to control the -Csplit-debuginfo
codegen option.][cargo/9112]
- [Added the `resolver` field to `Cargo.toml` to enable the new
feature resolver and CLI option behavior.][cargo/8997] Version
2 of the feature resolver will try to avoid unifying features of
dependencies where that unification could be unwanted. Such as
using the same dependency with a `std` feature in a build scripts
and proc-macros, while using the `no-std` feature in the final
binary. See the [Cargo book documentation][feature-resolver@2.0]
for more information on the feature.
Rustdoc
-------
- [Rustdoc will now include documentation for methods available
from _nested_ `Deref` traits.][80653]
- [You can now provide a `--default-theme` flag which sets the
default theme to use for documentation.][79642]
Various improvements to intra-doc links:
- [You can link to non-path primitives such as `slice`.][80181]
- [You can link to associated items.][74489]
- [You can now include generic parameters when linking to items,
like `Vec<T>`.][76934]
Misc
----
- [You can now pass `--include-ignored` to tests (e.g. with
`cargo test -- --include-ignored`) to include testing tests marked
`#[ignore]`.][80053]
Compatibility Notes
-------------------
- [WASI platforms no longer use the `wasm-bindgen` ABI, and instead
use the wasm32 ABI.][79998]
- [`rustc` no longer promotes division, modulo and indexing operations
to `const` that could fail.][80579]
- [The minimum version of glibc for the following platforms has
been bumped to version 2.31 for the distributed artifacts.][81521]
- `armv5te-unknown-linux-gnueabi`
- `sparc64-unknown-linux-gnu`
- `thumbv7neon-unknown-linux-gnueabihf`
- `armv7-unknown-linux-gnueabi`
- `x86_64-unknown-linux-gnux32`
- [`atomic::spin_loop_hint` has been deprecated.][80966] It's
recommended to use `hint::spin_loop` instead.
Internal Only
-------------
- [Consistently avoid constructing optimized MIR when not doing codegen][80718]
[79135]: https://github.com/rust-lang/rust/pull/79135
[74489]: https://github.com/rust-lang/rust/pull/74489
[76934]: https://github.com/rust-lang/rust/pull/76934
[79570]: https://github.com/rust-lang/rust/pull/79570
[80181]: https://github.com/rust-lang/rust/pull/80181
[79642]: https://github.com/rust-lang/rust/pull/79642
[80945]: https://github.com/rust-lang/rust/pull/80945
[80279]: https://github.com/rust-lang/rust/pull/80279
[80053]: https://github.com/rust-lang/rust/pull/80053
[79502]: https://github.com/rust-lang/rust/pull/79502
[75180]: https://github.com/rust-lang/rust/pull/75180
[79135]: https://github.com/rust-lang/rust/pull/79135
[81521]: https://github.com/rust-lang/rust/pull/81521
[80968]: https://github.com/rust-lang/rust/pull/80968
[80959]: https://github.com/rust-lang/rust/pull/80959
[80718]: https://github.com/rust-lang/rust/pull/80718
[80653]: https://github.com/rust-lang/rust/pull/80653
[80579]: https://github.com/rust-lang/rust/pull/80579
[79998]: https://github.com/rust-lang/rust/pull/79998
[78044]: https://github.com/rust-lang/rust/pull/78044
[81455]: https://github.com/rust-lang/rust/pull/81455
[80764]: https://github.com/rust-lang/rust/pull/80764
[80749]: https://github.com/rust-lang/rust/pull/80749
[80662]: https://github.com/rust-lang/rust/pull/80662
[79134]: https://github.com/rust-lang/rust/pull/79134
[80966]: https://github.com/rust-lang/rust/pull/80966
[cargo/8997]: https://github.com/rust-lang/cargo/pull/8997
[cargo/9112]: https://github.com/rust-lang/cargo/pull/9112
[feature-resolver@2.0]: https://doc.rust-lang.org/nightly/cargo/reference/features.html#feature-resolver-version-2
[`Once::call_once_force`]: https://doc.rust-lang.org/stable/std/sync/struct.Once.html#method.call_once_force
[`sync::OnceState`]: https://doc.rust-lang.org/stable/std/sync/struct.OnceState.html
[`panic::panic_any`]: https://doc.rust-lang.org/stable/std/panic/fn.panic_any.html
[`slice::strip_prefix`]: https://doc.rust-lang.org/stable/std/primitive.slice.html#method.strip_prefix
[`slice::strip_suffix`]: https://doc.rust-lang.org/stable/std/primitive.slice.html#method.strip_prefix
[`Arc::increment_strong_count`]: https://doc.rust-lang.org/nightly/std/sync/struct.Arc.html#method.increment_strong_count
[`Arc::decrement_strong_count`]: https://doc.rust-lang.org/nightly/std/sync/struct.Arc.html#method.decrement_strong_count
[`slice::fill_with`]: https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.fill_with
[`ptr::addr_of!`]: https://doc.rust-lang.org/nightly/std/ptr/macro.addr_of.html
[`ptr::addr_of_mut!`]: https://doc.rust-lang.org/nightly/std/ptr/macro.addr_of_mut.html
[`array::IntoIter`]: https://doc.rust-lang.org/nightly/std/array/struct.IntoIter.html
[`slice::split_inclusive`]: https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.split_inclusive
[`slice::split_inclusive_mut`]: https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.split_inclusive_mut
[`str::split_inclusive`]: https://doc.rust-lang.org/nightly/std/primitive.str.html#method.split_inclusive
[`task::Wake`]: https://doc.rust-lang.org/nightly/std/task/trait.Wake.html
[`Seek::stream_position`]: https://doc.rust-lang.org/nightly/std/io/trait.Seek.html#method.stream_position
[`Peekable::next_if`]: https://doc.rust-lang.org/nightly/std/iter/struct.Peekable.html#method.next_if
[`Peekable::next_if_eq`]: https://doc.rust-lang.org/nightly/std/iter/struct.Peekable.html#method.next_if_eq
[`VecDeque::range`]: https://doc.rust-lang.org/nightly/std/collections/struct.VecDeque.html#method.range
[`VecDeque::range_mut`]: https://doc.rust-lang.org/nightly/std/collections/struct.VecDeque.html#method.range_mut
|
# $NetBSD: Makefile,v 1.238 2021/05/26 09:21:39 he Exp $
DISTNAME= rustc-1.51.0-src
PKGNAME= ${DISTNAME:S/rustc/rust/:S/-src//}
CATEGORIES= lang
MASTER_SITES= https://static.rust-lang.org/dist/
MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= https://www.rust-lang.org/
COMMENT= Safe, concurrent, practical language
LICENSE= mit OR apache-2.0
CONFLICTS+= rust-bin-[0-9]*
# uses -std=c++14
GCC_REQD+= 5
USE_GCC_RUNTIME= yes
USE_LANGUAGES= c c++11
USE_LIBTOOL= yes
USE_TOOLS+= bash grep gmake perl:build pkg-config
# The NetBSD bootstraps are built for NetBSD 8 (because rust doesn't
# build on 7). Mark earlier versions as broken.
BROKEN_ON_PLATFORM+= NetBSD-[1-7].*-*
# Bootstrap is built for NetBSD 9.x on these platforms:
BROKEN_ON_PLATFORM+= NetBSD-8.*-*arm*
BROKEN_ON_PLATFORM+= NetBSD-8.*-aarch64
BROKEN_ON_PLATFORM+= NetBSD-8.*-sparc64
HAS_CONFIGURE= yes
PYTHON_FOR_BUILD_ONLY= yes
CONFIG_SHELL= ${PYTHONBIN}
CONFIGURE_SCRIPT= src/bootstrap/configure.py
CONFIGURE_ARGS+= --prefix=${PREFIX}
CONFIGURE_ARGS+= --mandir=${PREFIX}/${PKGMANDIR}
CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
CONFIGURE_ARGS+= --python=${PYTHONBIN}
CONFIGURE_ARGS+= --release-channel=stable
CONFIGURE_ARGS+= --local-rust-root=${RUST_BOOTSTRAP_PATH}
CONFIGURE_ARGS+= --enable-extended # Build and install cargo too.
CONFIGURE_ARGS+= --enable-rpath
CONFIGURE_ARGS+= --disable-codegen-tests
CONFIGURE_ARGS+= --disable-dist-src
CONFIGURE_ARGS+= --disable-llvm-static-stdcpp
CONFIGURE_ARGS+= --disable-ninja
# Getting RPATH with $ORIGIN into bootstrap may be troublesome, so
# uncommenting the LD_LIBRARY_PATH setting may be required to run
# the bootstrap
PKGSRC_MAKE_ENV+= LD_LIBRARY_PATH=${RUST_BOOTSTRAP_PATH:Q}/lib
# This should allow us to perform "offline" builds (so cargo doesn't fetch
# dependencies during the build stage) but this isn't hooked up yet.
CONFIGURE_ARGS+= --enable-vendor
# cargo defaults to using the number of available CPUs
MAKE_ENV+= CARGO_BUILD_JOBS=${_MAKE_JOBS_N}
CFLAGS.SunOS+= -D_POSIX_PTHREAD_SEMANTICS
UNLIMIT_RESOURCES+= cputime datasize virtualsize
TEST_TARGET= check
# bin/* lib/*, but names vary
CHECK_RELRO_SUPPORTED= no
CHECK_SSP_SUPPORTED= no
.include "../../mk/bsd.prefs.mk"
# Allow overriding MAKE_JOBS_SAFE
# some may chose to mostly build faster,
# and deal with any failures due to deadlocks
.if !empty(rust.MAKE_JOBS_SAFE)
. if ${rust.MAKE_JOBS_SAFE:tl} == "yes"
MAKE_JOBS_SAFE= yes
. endif
.endif
.if !empty(rust.BUILD_TARGET)
BUILD_TARGET= ${rust.BUILD_TARGET}
.endif
# 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
.else
BUILD_TARGET?= build
.endif
.if ${BUILD_TARGET} == "dist"
# Reduce size of bootstrap:
CONFIGURE_ARGS+= --disable-docs
CONFIGURE_ARGS+= --disable-compiler-docs
.endif
.if !empty(MACHINE_PLATFORM:MNetBSD-*-powerpc) || \
!empty(MACHINE_PLATFORM:MNetBSD-*-earmv7hf) || \
!empty(TARGET:Marmv7-unknown-netbsd-eabihf)
# Bootstrapping on NetBSD/powerpc requires no debug-info from rustc
# (both for amd64->powerpc built and powerpc->powerpc built bootstrap bits)
# Also try to downsize the armv7 build.
CONFIGURE_ARGS+= --disable-debug
CONFIGURE_ARGS+= --disable-debug-assertions
CONFIGURE_ARGS+= --disable-llvm-release-debuginfo
CONFIGURE_ARGS+= --debuginfo-level=0
CONFIGURE_ARGS+= --debuginfo-level-rustc=0
CONFIGURE_ARGS+= --debuginfo-level-std=0
CONFIGURE_ARGS+= --debuginfo-level-tools=0
CONFIGURE_ARGS+= --debuginfo-level-tests=0
.endif
# Only build the ARM target on/for this host, due to resource constraints
.if !empty(MACHINE_PLATFORM:MNetBSD-*-earmv7hf)
CONFIGURE_ARGS+= --set llvm.targets="ARM"
.endif
# When cross-building for ARM on X86, X86 needs to go along due
# to 2-stage build process
.if !empty(TARGET:Marmv7-unknown-netbsd-eabihf)
CONFIGURE_ARGS+= --set llvm.targets="ARM;X86"
.endif
.if ${OPSYS} == "NetBSD"
# This block contains information about known trouble on NetBSD and workarounds.
# Parallel builds failed on NetBSD due to dynamic linker locking bugs.
# \todo Explain if the build is believed to be sound if not parallel,
# or if a non-parallel build is merely more likely to work.
#
# See toolchain/54192 at
# http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=54192
# which was fixed in -current on 2020-04-19:
# http://mail-index.netbsd.org/source-changes/2020/04/16/msg116256.html
# http://mail-index.netbsd.org/source-changes/2020/04/19/msg116337.html
# These were pulled up to netbsd-9 on 2020-05-13:
# http://releng.netbsd.org/cgi-bin/req-9.cgi?show=907
# This has not been pulled up to netbsd-8
# \todo Explain if it's not applicable, shouldn't be pulled up, should be
# but hasn't, is too hard, etc.
#
# On pkgbuild for 2020Q1 9.0_RELEASE amd64, rust did not build despite
# MAKE_JOBS_SAFE=no, but setting MAKE_JOBS=1 resulted in success. (No
# PR is open for this.) \todo Understand and fix.
#
# If we aren't on 9-current, and are on 8.x or 9.x, avoid parallel.
# \todo Consider avoiding setting this on netbsd-9 past the fix.
. if ${MACHINE_PLATFORM:MNetBSD-[1-9].*} && !${MACHINE_PLATFORM:MNetBSD-9.99.*}
MAKE_JOBS_SAFE?= no
. endif
# Open PRs
#
# Broken package with PREFIX not /usr/pkg:
# http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=54453
#
.endif
#
# Under NetBSD, do not use DT_RUNPATH
#
BUILDLINK_TRANSFORM.NetBSD+= rm:-Wl,--enable-new-dtags
.PHONY: pre-build-fix
#
# Rust unfortunately requires itself to build. On platforms which aren't
# supported by upstream (where they offer binary bootstraps), or where we do
# not trust random binaries from the Internet, we need to build and provide our
# own bootstrap. See the stage0-bootstrap below for more details.
#
DISTFILES:= ${DEFAULT_DISTFILES}
.if !empty(MACHINE_PLATFORM:MDarwin-*-aarch64) || make(distinfo) || make (makesum) || make(mdi)
RUST_STAGE0_VER= 1.50.0
RUST_ARCH:= aarch64-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:MDarwin-*-x86_64) || make(distinfo) || make (makesum) || make(mdi)
RUST_STAGE0_VER= 1.50.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-*-aarch64) || make(distinfo) || make (makesum) || make(mdi)
RUST_STAGE0_VER= 1.50.0
RUST_ARCH:= aarch64-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-*-earmv6hf) || make(distinfo) || make (makesum) || make(mdi)
RUST_STAGE0_VER= 1.50.0
RUST_ARCH:= arm-unknown-linux-gnueabihf
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-*-earmv7hf) || make(distinfo) || make (makesum) || make(mdi)
RUST_STAGE0_VER= 1.50.0
RUST_ARCH:= armv7-unknown-linux-gnueabihf
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.50.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.50.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
DISTFILES:= ${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
pre-build-fix:
.endif
#
# The SunOS target defaults to illumos as that's what the current bootstraps
# are built on. If you wish to target Oracle Solaris you'll need to create an
# x86_64-sun-solaris bootstrap and comment out the overrides.
#
.if !empty(MACHINE_PLATFORM:MSunOS-*-x86_64) || make(distinfo) || make (makesum) || make(mdi)
RUST_STAGE0_VER= 1.50.0
RUST_ARCH:= x86_64-unknown-illumos
RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
SITES.${RUST_STAGE0}= https://us-east.manta.joyent.com/pkgsrc/public/pkg-bootstraps/
DISTFILES:= ${DISTFILES} ${RUST_STAGE0}
RUST_BOOTSTRAP_PATH?= ${WRKDIR}/rust-${RUST_STAGE0_VER}-${RUST_ARCH}
# Override default "x86_64-sun-solaris" selection
CONFIGURE_ARGS+= --set=target.${RUST_ARCH}.llvm-config=${LLVM_CONFIG_PATH}
CONFIGURE_ARGS+= --build=${RUST_ARCH}
CONFIGURE_ARGS+= --host=${RUST_ARCH}
CONFIGURE_ARGS+= --target=${RUST_ARCH}
pre-build-fix:
.endif
.if !empty(MACHINE_PLATFORM:MFreeBSD-*-x86_64) || make(distinfo) || make (makesum) || make(mdi)
RUST_STAGE0_VER= 1.50.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.50.0
RUST_ARCH= i586-unknown-netbsd
RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
RUST_STD_STAGE0:= rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
SITES.${RUST_STAGE0}= ${MASTER_SITE_LOCAL:=rust/}
SITES.${RUST_STD_STAGE0}= ${MASTER_SITE_LOCAL:=rust/}
DISTFILES:= ${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
# Setting this changes it for every distfile, which doesn't match what is
# currently in distinfo.
#DIST_SUBDIR= ${PKGNAME}
# For atomic ops
CFLAGS+= -march=i586
pre-build-fix:
${TOOLS_PLATFORM.paxctl} +am ${WRKDIR}/rust-bootstrap/bin/cargo
${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.50.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.50.0
RUST_ARCH= powerpc-unknown-netbsd
# Cross-built against NetBSD 9.0
. if empty(OS_VERSION:M8.*) || make(distinfo) || make(makesum) || make(mdi)
RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}90.tar.gz
RUST_STD_STAGE0:= rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}90.tar.gz
DISTFILES:= ${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
SITES.${RUST_STAGE0}= ${MASTER_SITE_LOCAL:=rust/}
SITES.${RUST_STD_STAGE0}= ${MASTER_SITE_LOCAL:=rust/}
. endif
# Cross-built against NetBSD 8.0
. if !empty(OS_VERSION:M8.*) || make(distinfo) || make(makesum) || make(mdi)
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}
SITES.${RUST_STAGE0}= ${MASTER_SITE_LOCAL:=rust/}
SITES.${RUST_STD_STAGE0}= ${MASTER_SITE_LOCAL:=rust/}
. endif
pre-build-fix:
.endif
.if !empty(MACHINE_PLATFORM:MNetBSD-*-aarch64) || make(distinfo) || make (makesum) || make(mdi)
RUST_STAGE0_VER= 1.50.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
DISTFILES:= ${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
SITES.${RUST_STAGE0}= ${MASTER_SITE_LOCAL:=rust/}
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.50.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
DISTFILES:= ${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
SITES.${RUST_STAGE0}= ${MASTER_SITE_LOCAL:=rust/}
SITES.${RUST_STD_STAGE0}= ${MASTER_SITE_LOCAL:=rust/}
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.50.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}
SITES.${RUST_STAGE0}= ${MASTER_SITE_LOCAL:=rust/}
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.
.if !defined(RUST_ARCH) && !defined(RUST_BOOTSTRAP_PATH)
NOT_FOR_PLATFORM+= ${MACHINE_PLATFORM}
.else
RUST_BOOTSTRAP_PATH?= ${WRKDIR}/rust-bootstrap
.endif
.if ${OPSYS} == "SunOS"
BUILD_DEPENDS+= coreutils>=0:../../sysutils/coreutils
BUILD_DEPENDS+= gzip>=0:../../archivers/gzip
TOOLS_CREATE+= md5sum
TOOLS_PATH.md5sum= ${PREFIX}/bin/gmd5sum
TOOLS_PLATFORM.gzcat= ${PREFIX}/bin/gzip -cd
.endif
SUBST_CLASSES+= rpath
SUBST_STAGE.rpath= pre-configure
SUBST_FILES.rpath+= compiler/rustc_codegen_ssa/src/back/linker.rs
SUBST_FILES.rpath+= compiler/rustc_target/src/spec/netbsd_base.rs
SUBST_FILES.rpath+= src/bootstrap/builder.rs
SUBST_FILES.rpath+= src/bootstrap/compile.rs
SUBST_VARS.rpath= PREFIX
#
# Generate list of subst entries for various .cargo-checksum.json files. These
# are all handled together in one big substitution to simplify things rather
# than one substitution entry per file, but are kept separate below to ease
# updating and verification.
#
CKSUM_CRATES+= vendor/libc
CKSUMS+= 8d7ddc8dd25a9404f9181a49438d9506c676cfd4b6fa21dbe5c1f9969abc4b91
CKSUMS+= f147be95b04ea1303171dff46c5a66b08cd47ccd0a4c346d5bcec7a8aaac3fc4
CKSUM_CRATES+= vendor/cc-1.0.60
CKSUMS+= 903c5f2f5dd0cc7d04f99f605a95e6abde8b38156fd4e73eefc58493f55a4e5a
CKSUMS+= e45520f4dda532240e4ec28af550fcb76f44090361f273bebcf0d07dc0807885
CKSUM_CRATES+= vendor/rustc-ap-rustc_target
CKSUMS+= ab83c62fab6927a47fc3d15c02eec41174ea9f3e8dce5c53adab613d48918bc5
CKSUMS+= 01f50edc3845bd03459d525444150d03f57cdb479de2668a71c1538adf3d340a
CKSUM_CRATES+= vendor/lzma-sys
CKSUMS+= 6fd5e9245db34c6f557b8bfcaf03db82fc88c3b06dbfbb5f03b2bcd138983ef9
CKSUMS+= 5e252578b5d266f6a4c8dc9f71ca7a91536ccb8c5c7d7753b82f12ec886459ef
CKSUM_CRATES+= vendor/stacker
CKSUMS+= cee329550bad2ed1182abb71db9c24558a91b12e1eab8d9a48e23b997bb8f04e
CKSUMS+= 79915b243d02df1dc698f5c2de3a9356c6c296d2dedb06d9035dbcc2f8972cf4
CKSUM_CRATES+= vendor/net2
CKSUMS+= fd072307ebbaa01cfe1fd7553d7f42d27093b2bd32dd81d419d2e1c9423495a0
CKSUMS+= 9e146a847e1f726fa7d7eae224aaa925030287f99770f950a012cb398e088d12
CKSUM_CRATES+= vendor/openssl-src
CKSUMS+= 03dcdaac7de880b860ecfe859ba2ac3e46c8f46a7bf948aa674147eebee421b0
CKSUMS+= 580a24c5a739e688e488498b8a34e27a3284c3160e6d3aaff711a80774c35c48
SUBST_CLASSES+= cksum
SUBST_STAGE.cksum= pre-configure
.for crate in ${CKSUM_CRATES}
SUBST_FILES.cksum+= ${crate}/.cargo-checksum.json
.endfor
.for from to in ${CKSUMS}
SUBST_SED.cksum+= -e 's,${from},${to},g'
.endfor
post-extract:
set -e; \
if ${TEST} -e ${WRKDIR}/rust-${RUST_STAGE0_VER}-${RUST_ARCH}/install.sh \
-a ! -e ${RUST_BOOTSTRAP_PATH}/bin/rustc; then \
cd ${WRKDIR}/rust-${RUST_STAGE0_VER}-${RUST_ARCH}; \
${TOOLS_BASH} ./install.sh --prefix=${RUST_BOOTSTRAP_PATH}; \
cd ${WRKDIR}/rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}; \
${TOOLS_BASH} ./install.sh --prefix=${RUST_BOOTSTRAP_PATH}; \
fi
.if ${OPSYS} == "NetBSD"
SDIR=${WRKDIR}/scripts; \
${MKDIR} $${SDIR}; \
cd $${SDIR}; \
${RM} -f c++-wrap; \
${RM} -f clang++-wrap; \
${RM} -f clang-wrap; \
${RM} -f ar-wrap; \
${CP} ${.CURDIR}/files/gcc-wrap .; \
${CHMOD} +x gcc-wrap; \
${LN} -s gcc-wrap c++-wrap; \
${LN} -s gcc-wrap clang++-wrap; \
${LN} -s gcc-wrap clang-wrap; \
${LN} -s gcc-wrap ar-wrap
.endif
.if ${OPSYS} == "FreeBSD"
MAKE_ENV+= OPENSSL_DIR=${SSLBASE}
.endif
.if ${OPSYS} == "NetBSD" && !empty(PKGSRC_COMPILER:Mclang) && !exists(/lib/libgcc_s.so)
BUILDLINK_TRANSFORM+= rm:-lgcc_s
MAKE_ENV+= PKGSRC_HAVE_LIBCPP=yes
.endif
pre-build: pre-build-fix
.if ${OPSYS} == "NetBSD" && !empty(PKGSRC_COMPILER:Mclang) && !exists(/lib/libgcc_s.so)
cp ${FILESDIR}/libgcc_s.so.1 ${RUST_BOOTSTRAP_PATH}/lib/.
.endif
#
# These are essentially copies of the "all", "test", and "install" Makefile
# targets, but are duplicated here so that we can specify -j.
#
do-build:
${RUN}${_ULIMIT_CMD} \
cd ${WRKSRC} && \
${SETENV} ${MAKE_ENV} \
sh -c "if [ \"${BUILD_TARGET}\" = \"dist\" ]; then \
unset DESTDIR; \
${PYTHONBIN} ./x.py -v \
${BUILD_TARGET} -j ${_MAKE_JOBS_N}; \
else \
${PYTHONBIN} ./x.py -v \
${BUILD_TARGET} --stage 2 -j ${_MAKE_JOBS_N} && \
${PYTHONBIN} ./x.py -v \
doc --stage 2 -j ${_MAKE_JOBS_N}; \
fi"
do-test:
${RUN}${_ULIMIT_CMD} \
cd ${WRKSRC} && \
${SETENV} ${MAKE_ENV} \
${PYTHONBIN} ./x.py -v test -j ${_MAKE_JOBS_N}
do-install:
${RUN}${_ULIMIT_CMD} \
cd ${WRKSRC} && \
${SETENV} ${MAKE_ENV} ${INSTALL_ENV} \
${PYTHONBIN} ./x.py -v install -j ${_MAKE_JOBS_N}
.if ${OPSYS} == "Darwin"
.PHONY: fix-darwin-install-name
post-install: fix-darwin-install-name
fix-darwin-install-name:
for f in ${DESTDIR}${PREFIX}/lib/librustc_macros-*.dylib \
${DESTDIR}${PREFIX}/lib/libtracing_attributes-*.dylib \
${DESTDIR}${PREFIX}/lib/libserde_derive-*.dylib \
${DESTDIR}${PREFIX}/lib/libchalk_derive-*.dylib; do \
install_name_tool -id `${ECHO} $$f | ${SED} -e 's,${DESTDIR},,g'` $$f; \
done
.endif
# MacOS X 10.7 is the oldest supported version. See
# ${WRKSRC}/src/bootstrap/lib.rs
MAKE_ENV.Darwin+= MACOSX_DEPLOYMENT_TARGET="10.7"
GENERATE_PLIST+= ${FIND} ${DESTDIR}${PREFIX} \( -type f -o -type l \) -print | \
${SED} -e 's,${DESTDIR}${PREFIX}/,,' | ${SORT} ;
# Create a relocatable stage2 bootstrap from the bits we just built that can be
# used to build the next version of rust. Currently only tested on SmartOS.
#
# Use the alternate BOOTSTRAP_NAME when creating a nightly release.
#
#BOOTSTRAP_NAME= ${PKGNAME_NOREV:C/rust/rust-nightly/}-${RUST_ARCH}
BOOTSTRAP_NAME= ${PKGNAME_NOREV}-${RUST_ARCH}
BOOTSTRAP_TMPDIR= ${WRKDIR}/${BOOTSTRAP_NAME}
USE_TOOLS+= gtar
# The NetBSD part is so far untested, because I could not convince
# the rust build to use the gcc wrapper when building natively,
# so that I could get a placeholder in the RPATH, because chrpath
# cannot extend the length of the RPATH...
ELFEDIT?= /usr/bin/elfedit
.PHONY: stage0-bootstrap
stage0-bootstrap: install
${RM} -rf ${BOOTSTRAP_TMPDIR}
${MKDIR} ${BOOTSTRAP_TMPDIR}
.if ${OPSYS} == "NetBSD"
(cd ${BOOTSTRAP_TMPDIR}; \
DISTDIR=${WRKSRC}/bild/dist; \
VER_ARCH=${PKGVERSION}-${RUST_ARCH}; \
RUSTC=rustc-$${VER_ARCH}; \
RUSTC_FILE=$${RUSTC}.tar.gz; \
RUST_STD=rust-std-$${VER_ARCH}; \
RUST_STD_FILE=$${RUST_STD}.tar.gz; \
${GTAR} -xzf $${DISTDIR}/$${RUSTC_FILE}; \
(cd ${RUSTC}; \
RPATH='/usr/pkg/lib:/lib:/usr/lib:$$ORIGIN/../lib'; \
for f in rls-preview/bin/rls rustc/bin/rustc rustc/bin/rustdoc; do \
chrpath -r $$RPATH $$f; \
done; \
RPATH='/usr/pkg/lib:/lib:/usr/lib:$$ORIGIN'; \
for f in rustc/lib/*.so*; do \
chrpath -r $$RPATH $$f; \
done; \
RPATH='/usr/pkg/lib:/lib:/usr/lib:$$ORIGIN:$$ORIGIN/../../..'; \
for f in rustc/lib/rustlib/*/*/*.so*; do \
chrpath -r $$RPATH $$f; \
done;); \
${GTAR} -czf $${RUSTC_FILE} $${RUSTC}; \
${CP} $${DISTDIR}/$${RUST_STD_FILE} .; \
${ECHO} "Fixed stage0 bootstrap in ${BOOTSTRAP_TMPDIR}:"; \
${ECHO} "$${RUSTC_FILE}"; \
${ECHO} "$${RUST_STD_FILE}"; \
)
.endif
.if ${OS_VARIANT} == "SmartOS"
${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
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
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 \
${CP} ${PREFIX}/lib/$${lib} ${BOOTSTRAP_TMPDIR}/lib/pkgsrc/; \
done
for f in ${BOOTSTRAP_TMPDIR}/bin/*; do \
/bin/file -b "$$f" | grep ^ELF >/dev/null || continue; \
${ELFEDIT} -e 'dyn:runpath $$ORIGIN/../lib:$$ORIGIN/../lib/pkgsrc' $$f; \
done
for f in ${BOOTSTRAP_TMPDIR}/lib/pkgsrc/*.so*; do \
${ELFEDIT} -e 'dyn:runpath $$ORIGIN' $$f; \
done
for f in ${BOOTSTRAP_TMPDIR}/lib/*.so*; do \
${ELFEDIT} -e 'dyn:runpath $$ORIGIN:$$ORIGIN/pkgsrc' $$f; \
done
for f in ${BOOTSTRAP_TMPDIR}/lib/rustlib/*/*/*.so*; do \
${ELFEDIT} -e 'dyn:runpath $$ORIGIN:$$ORIGIN/../../..:$$ORIGIN/../../../pkgsrc' $$f; \
done
(cd ${WRKDIR}; \
${GTAR} -zcf ${BOOTSTRAP_NAME}.tar.gz ${BOOTSTRAP_NAME})
.endif
.include "options.mk"
# These dependencies currently use the bundled sources as they require
# development features not yet available in released versions.
#
#.include "../../devel/libgit2/buildlink3.mk"
#.include "../../security/libssh2/buildlink3.mk"
#.include "../../www/http-parser/buildlink3.mk"
#.include "../../devel/jemalloc/buildlink3.mk"
## Issues specific to: bootstrap AND NetBSD follow
# rust i386 bootstraps are built for 8.0 and still depend on libstdc++.so.8.
# Pull in compat80 on 9.x and newer.
.if !empty(MACHINE_PLATFORM:MNetBSD-*-i386) && empty(OS_VERSION:M8.*)
BUILD_DEPENDS+= compat80>=0:../../emulators/compat80
.endif
# This is for when we build natively:
.if !empty(MACHINE_PLATFORM:MNetBSD-*-powerpc) || \
!empty(MACHINE_PLATFORM:MNetBSD-*-i386)
# LLVM needs libatomic for 64-bit atomics on powerpc and i386
.include "../../devel/libatomic/buildlink3.mk"
# Make those libraries available via a unique directory:
DEPENDS+= libatomic-links>=0:../../devel/libatomic-links
.endif
.include "../../devel/zlib/buildlink3.mk"
.include "../../lang/python/tool.mk"
.include "../../mk/bsd.pkg.mk"