2021-03-23 07:42:43 +01:00
|
|
|
# Once the bootstraps are available on pkg.FreeBSD.org run sync.sh
|
|
|
|
# to upload them to ~/public_distfiles on freefall in preparation
|
|
|
|
# for the next lang/rust update.
|
2020-02-25 19:18:26 +01:00
|
|
|
PORTNAME= rust
|
2024-03-18 14:14:34 +01:00
|
|
|
PORTVERSION= 1.77.0
|
2020-02-25 19:18:26 +01:00
|
|
|
CATEGORIES= lang
|
2021-09-12 01:46:02 +02:00
|
|
|
MASTER_SITES= https://static.rust-lang.org/dist/
|
|
|
|
PKGNAMEPREFIX= ${FLAVOR:S/_/-/g}-
|
2020-02-25 19:18:26 +01:00
|
|
|
PKGNAMESUFFIX= -bootstrap
|
|
|
|
DISTNAME= ${PORTNAME}c-${PORTVERSION}-src
|
2021-05-17 18:34:53 +02:00
|
|
|
DIST_SUBDIR= rust
|
2020-02-25 19:18:26 +01:00
|
|
|
|
|
|
|
MAINTAINER= rust@FreeBSD.org
|
|
|
|
COMMENT= Create bootstrap compilers for building lang/rust
|
2022-09-07 23:06:12 +02:00
|
|
|
WWW= https://www.rust-lang.org/
|
2020-02-25 19:18:26 +01:00
|
|
|
|
|
|
|
LICENSE= APACHE20 MIT
|
|
|
|
LICENSE_COMB= dual
|
|
|
|
LICENSE_FILE_APACHE20= ${WRKSRC}/LICENSE-APACHE
|
|
|
|
LICENSE_FILE_MIT= ${WRKSRC}/LICENSE-MIT
|
|
|
|
|
2023-01-28 16:32:40 +01:00
|
|
|
ONLY_FOR_ARCHS= amd64 powerpc64 powerpc64le
|
2021-10-25 14:58:26 +02:00
|
|
|
ONLY_FOR_ARCHS_REASON= untested on other architectures
|
2020-02-25 19:18:26 +01:00
|
|
|
|
2021-09-12 01:46:02 +02:00
|
|
|
BUILD_DEPENDS= ${FLAVOR:S/_/-/g}-freebsd-sysroot>=a2021.09.14:devel/freebsd-sysroot@${FLAVOR} \
|
2022-09-09 23:00:54 +02:00
|
|
|
cmake:devel/cmake-core \
|
2020-02-25 19:18:26 +01:00
|
|
|
gmake:devel/gmake \
|
|
|
|
rust>=${PORTVERSION}:lang/rust
|
|
|
|
|
2022-12-29 22:16:45 +01:00
|
|
|
FLAVORS= aarch64 amd64 armv7 i386 powerpc powerpc64 powerpc64le riscv64
|
2020-02-25 19:18:26 +01:00
|
|
|
FLAVOR?= ${FLAVORS:[1]}
|
|
|
|
|
2023-06-15 00:00:28 +02:00
|
|
|
USES= cpe ninja:build perl5 python:build tar:xz
|
2021-10-19 13:14:32 +02:00
|
|
|
CPE_VENDOR= ${PORTNAME}-lang
|
2020-02-25 19:18:26 +01:00
|
|
|
# for openssl-src crate
|
|
|
|
USE_PERL5= build
|
|
|
|
PATCHDIR= ${.CURDIR}/../rust/files
|
2021-09-06 19:16:38 +02:00
|
|
|
# rustc stashes intermediary files in TMPDIR (default /tmp) which
|
|
|
|
# might cause issues for users that for some reason space limit
|
|
|
|
# their /tmp. WRKDIR should have plenty of space.
|
|
|
|
# ?= to allow users to still overwrite it in make.conf.
|
|
|
|
TMPDIR?= ${WRKDIR}
|
2020-02-25 19:18:26 +01:00
|
|
|
# Resulting packages are not specific to amd64
|
|
|
|
NO_ARCH= yes
|
|
|
|
|
|
|
|
_CARGO_VENDOR_DIR= ${WRKSRC}/vendor
|
|
|
|
_RUST_ARCH_amd64= x86_64
|
|
|
|
_RUST_ARCH_i386= i686
|
2022-12-29 22:16:45 +01:00
|
|
|
_RUST_ARCH_powerpc64= powerpc64
|
2021-11-05 11:25:23 +01:00
|
|
|
_RUST_ARCH_riscv64= riscv64gc
|
2020-02-25 19:18:26 +01:00
|
|
|
_RUST_HOST= ${_RUST_ARCH_${ARCH}:U${ARCH}}-unknown-${OPSYS:tl}
|
|
|
|
_RUST_TARGET= ${_RUST_ARCH_${FLAVOR}:U${FLAVOR}}-unknown-${OPSYS:tl}
|
|
|
|
_RUST_LLVM_TARGET= ${_RUST_LLVM_TARGET_${FLAVOR}}
|
|
|
|
_RUST_LLVM_TARGET_aarch64= AArch64
|
|
|
|
_RUST_LLVM_TARGET_amd64= X86
|
|
|
|
_RUST_LLVM_TARGET_armv7= ARM
|
|
|
|
_RUST_LLVM_TARGET_i386= X86
|
2022-12-29 22:16:45 +01:00
|
|
|
_RUST_LLVM_TARGET_powerpc64= PowerPC
|
2020-10-13 10:36:35 +02:00
|
|
|
_RUST_LLVM_TARGET_powerpc64le= PowerPC
|
2021-05-04 08:05:04 +02:00
|
|
|
_RUST_LLVM_TARGET_powerpc= PowerPC
|
2021-11-05 11:25:23 +01:00
|
|
|
_RUST_LLVM_TARGET_riscv64= RISCV
|
2020-02-25 19:18:26 +01:00
|
|
|
|
|
|
|
.include <bsd.port.pre.mk>
|
|
|
|
|
|
|
|
.if ${OPSYS} != FreeBSD
|
|
|
|
IGNORE= is only for FreeBSD
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if exists(${PATCHDIR}/${FLAVOR:S/_/-/})
|
|
|
|
EXTRA_PATCHES+= ${PATCHDIR}/${FLAVOR:S/_/-/}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
post-patch:
|
|
|
|
# Disable vendor checksums
|
|
|
|
@${REINPLACE_CMD} 's,"files":{[^}]*},"files":{},' \
|
|
|
|
${_CARGO_VENDOR_DIR}/*/.cargo-checksum.json
|
|
|
|
|
|
|
|
do-configure:
|
|
|
|
# Check that the running kernel has COMPAT_FREEBSD11 required by lang/rust post-ino64
|
|
|
|
@${SETENV} CC="${CC}" OPSYS="${OPSYS}" OSVERSION="${OSVERSION}" WRKDIR="${WRKDIR}" \
|
|
|
|
${SH} ${SCRIPTSDIR}/rust-compat11-canary.sh
|
2021-05-17 14:06:15 +02:00
|
|
|
@${ECHO_CMD} 'changelog-seen=2' > ${WRKSRC}/config.toml
|
|
|
|
@${ECHO_CMD} '[build]' >> ${WRKSRC}/config.toml
|
2021-11-25 09:55:43 +01:00
|
|
|
@${ECHO_CMD} 'build-dir="${WRKDIR}/_build"' >> ${WRKSRC}/config.toml
|
2020-02-25 19:18:26 +01:00
|
|
|
@${ECHO_CMD} 'vendor=true' >> ${WRKSRC}/config.toml
|
|
|
|
@${ECHO_CMD} 'extended=false' >> ${WRKSRC}/config.toml
|
|
|
|
@${ECHO_CMD} 'python="${PYTHON_CMD}"' >> ${WRKSRC}/config.toml
|
|
|
|
@${ECHO_CMD} 'docs=false' >> ${WRKSRC}/config.toml
|
|
|
|
@${ECHO_CMD} 'verbose=2' >> ${WRKSRC}/config.toml
|
|
|
|
@${ECHO_CMD} 'cargo-native-static=true' >> ${WRKSRC}/config.toml
|
|
|
|
@${ECHO_CMD} 'cargo="${LOCALBASE}/bin/cargo"' >> ${WRKSRC}/config.toml
|
|
|
|
@${ECHO_CMD} 'rustc="${LOCALBASE}/bin/rustc"' >> ${WRKSRC}/config.toml
|
|
|
|
.if ${_RUST_HOST} != ${_RUST_TARGET}
|
|
|
|
@${ECHO_CMD} 'host=["${_RUST_HOST}","${_RUST_TARGET}"]' >> ${WRKSRC}/config.toml
|
|
|
|
@${ECHO_CMD} 'target=["${_RUST_TARGET}"]' >> ${WRKSRC}/config.toml
|
|
|
|
.endif
|
|
|
|
@${ECHO_CMD} '[rust]' >> ${WRKSRC}/config.toml
|
|
|
|
@${ECHO_CMD} 'channel="stable"' >> ${WRKSRC}/config.toml
|
|
|
|
@${ECHO_CMD} 'default-linker="${CC}"' >> ${WRKSRC}/config.toml
|
2020-03-12 20:39:24 +01:00
|
|
|
@${ECHO_CMD} 'deny-warnings=false' >> ${WRKSRC}/config.toml
|
2020-02-25 19:18:26 +01:00
|
|
|
@${ECHO_CMD} '[llvm]' >> ${WRKSRC}/config.toml
|
|
|
|
@${ECHO_CMD} 'link-shared=false' >> ${WRKSRC}/config.toml
|
|
|
|
.if defined(WITH_CCACHE_BUILD) && !defined(NO_CCACHE)
|
|
|
|
@${ECHO_CMD} 'ccache="${CCACHE_BIN}"' >> ${WRKSRC}/config.toml
|
|
|
|
.else
|
|
|
|
@${ECHO_CMD} 'ccache=false' >> ${WRKSRC}/config.toml
|
|
|
|
.endif
|
lang/rust-bootstrap: Unbreak build
error: linking with `/wrkdirs/usr/ports/lang/rust-bootstrap/work-aarch64/aarch64-unknown-freebsd-cc` failed: exit code: 1
|
= note: "/wrkdirs/usr/ports/lang/rust-bootstrap/work-aarch64/aarch64-unknown-freebsd-cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-Wl,--eh-frame-hdr" "-L" "/wrkdirs/usr/ports/lang/rust-bootstrap/work-aarch64/rustc-1.46.0-src/build/x86_64-unknown-freebsd/stage1/lib/rustlib/aarch64-unknown-freebsd/lib" "/wrkdirs/usr/ports/lang/rust-bootstrap/work-aarch64/rustc-1.46.0-src/build/x86_64-unknown-freebsd/stage1-rustc/aarch64-unknown-freebsd/release/deps/rustc_binary-aee2141e03185e53.rustc_binary.b5znfnzc-cgu.0.rcgu.o" "/wrkdirs/usr/ports/lang/rust-bootstrap/work-aarch64/rustc-1.46.0-src/build/x86_64-unknown-freebsd/stage1-rustc/aarch64-unknown-freebsd/release/deps/rustc_binary-aee2141e03185e53.rustc_binary.b5znfnzc-cgu.1.rcgu.o" "-o" "/wrkdirs/usr/ports/lang/rust-bootstrap/work-aarch64/rustc-1.46.0-src/build/x86_64-unknown-freebsd/stage1-rustc/aarch64-unknown-freebsd/release/deps/rustc_binary-aee2141e03185e53" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-Wl,-O1" "-nodefaultlibs" "-L" "/wrkdirs/usr/ports/lang/rust-bootstrap/work-aarch64/rustc-1.46.0-src/build/x86_64-unknown-freebsd/stage1-rustc/aarch64-unknown-freebsd/release/deps" "-L" "/wrkdirs/usr/ports/lang/rust-bootstrap/work-aarch64/rustc-1.46.0-src/build/x86_64-unknown-freebsd/stage1-rustc/release/deps" "-L" "/wrkdirs/usr/ports/lang/rust-bootstrap/work-aarch64/rustc-1.46.0-src/build/x86_64-unknown-freebsd/stage1-rustc/aarch64-unknown-freebsd/release/build/psm-b70dc38335c8633c/out" "-L" "/wrkdirs/usr/ports/lang/rust-bootstrap/work-aarch64/rustc-1.46.0-src/build/x86_64-unknown-freebsd/stage1-rustc/aarch64-unknown-freebsd/release/build/rustc_llvm-2e64396678b51f1b/out" "-L" "/wrkdirs/usr/ports/lang/rust-bootstrap/work-aarch64/rustc-1.46.0-src/build/aarch64-unknown-freebsd/llvm/build/lib" "-L" "/wrkdirs/usr/ports/lang/rust-bootstrap/work-aarch64/rustc-1.46.0-src/build/x86_64-unknown-freebsd/stage1/lib/rustlib/aarch64-unknown-freebsd/lib" "-L" "/wrkdirs/usr/ports/lang/rust-bootstrap/work-aarch64/rustc-1.46.0-src/build/x86_64-unknown-freebsd/stage1-rustc/aarch64-unknown-freebsd/release/deps" "-lrustc_driver-92f05a38b6344bea" "-Wl,--start-group" "-L" "/wrkdirs/usr/ports/lang/rust-bootstrap/work-aarch64/rustc-1.46.0-src/build/x86_64-unknown-freebsd/stage1/lib/rustlib/aarch64-unknown-freebsd/lib" "-lstd-1f5c5da87793947f" "-Wl,--end-group" "-Wl,-Bstatic" "/wrkdirs/usr/ports/lang/rust-bootstrap/work-aarch64/rustc-1.46.0-src/build/x86_64-unknown-freebsd/stage1/lib/rustlib/aarch64-unknown-freebsd/lib/libcompiler_builtins-8365ea7481741727.rlib" "-Wl,-Bdynamic" "-lc++" "-lutil" "-lutil" "-lexecinfo" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil" "-Wl,-rpath,$ORIGIN/../lib"
= note: ld: error: /wrkdirs/usr/ports/lang/rust-bootstrap/work-aarch64/rustc-1.46.0-src/build/x86_64-unknown-freebsd/stage1-rustc/aarch64-unknown-freebsd/release/deps/librustc_driver-92f05a38b6344bea.so: undefined reference to compress2 [--no-allow-shlib-undefined]
ld: error: /wrkdirs/usr/ports/lang/rust-bootstrap/work-aarch64/rustc-1.46.0-src/build/x86_64-unknown-freebsd/stage1-rustc/aarch64-unknown-freebsd/release/deps/librustc_driver-92f05a38b6344bea.so: undefined reference to compressBound [--no-allow-shlib-undefined]
ld: error: /wrkdirs/usr/ports/lang/rust-bootstrap/work-aarch64/rustc-1.46.0-src/build/x86_64-unknown-freebsd/stage1-rustc/aarch64-unknown-freebsd/release/deps/librustc_driver-92f05a38b6344bea.so: undefined reference to crc32 [--no-allow-shlib-undefined]
ld: error: /wrkdirs/usr/ports/lang/rust-bootstrap/work-aarch64/rustc-1.46.0-src/build/x86_64-unknown-freebsd/stage1-rustc/aarch64-unknown-freebsd/release/deps/librustc_driver-92f05a38b6344bea.so: undefined reference to uncompress [--no-allow-shlib-undefined]
cc: error: linker command failed with exit code 1 (use -v to see invocation)
2020-09-02 20:15:58 +02:00
|
|
|
# https://github.com/rust-lang/rust/pull/72696#issuecomment-641517185
|
|
|
|
@${ECHO_CMD} 'ldflags="-lz"' >> ${WRKSRC}/config.toml
|
2021-11-09 09:14:18 +01:00
|
|
|
# we need to make sure to always build llvm with host arch support to get a
|
2020-02-25 19:18:26 +01:00
|
|
|
# host compiler that can build the host->target compiler
|
2021-11-09 09:14:18 +01:00
|
|
|
@${ECHO_CMD} 'targets="${_RUST_LLVM_TARGET};${_RUST_LLVM_TARGET_${ARCH}}"' >> ${WRKSRC}/config.toml
|
2020-02-25 19:18:26 +01:00
|
|
|
@${ECHO_CMD} '[target.${_RUST_TARGET}]' >> ${WRKSRC}/config.toml
|
2021-09-12 01:46:02 +02:00
|
|
|
@${ECHO_CMD} 'cc="${LOCALBASE}/freebsd-sysroot/${FLAVOR:S/_/-/g}/bin/cc"' >> ${WRKSRC}/config.toml
|
|
|
|
@${ECHO_CMD} 'cxx="${LOCALBASE}/freebsd-sysroot/${FLAVOR:S/_/-/g}/bin/c++"' >> ${WRKSRC}/config.toml
|
|
|
|
@${ECHO_CMD} 'linker="${LOCALBASE}/freebsd-sysroot/${FLAVOR:S/_/-/g}/bin/cc"' >> ${WRKSRC}/config.toml
|
2020-02-25 19:18:26 +01:00
|
|
|
.for _key _util in ar ${AR} ranlib ${RANLIB}
|
|
|
|
@bin="$$(which ${_util})"; \
|
|
|
|
${ECHO_CMD} "${_key}=\"$$bin\"" >> ${WRKSRC}/config.toml
|
|
|
|
.endfor
|
|
|
|
.if ${_RUST_HOST} != ${_RUST_TARGET}
|
|
|
|
@${ECHO_CMD} '[target.${_RUST_HOST}]' >> ${WRKSRC}/config.toml
|
|
|
|
@${ECHO_CMD} 'cc="${CC}"' >> ${WRKSRC}/config.toml
|
|
|
|
@${ECHO_CMD} 'cxx="${CXX}"' >> ${WRKSRC}/config.toml
|
|
|
|
@${ECHO_CMD} 'linker="${CC}"' >> ${WRKSRC}/config.toml
|
|
|
|
.endif
|
|
|
|
@${ECHO_CMD} '[dist]' >> ${WRKSRC}/config.toml
|
|
|
|
@${ECHO_CMD} 'src-tarball=false' >> ${WRKSRC}/config.toml
|
|
|
|
|
|
|
|
do-build:
|
|
|
|
@cd ${WRKSRC} && \
|
|
|
|
${SETENV} ${MAKE_ENV} ${PYTHON_CMD} x.py dist --jobs=${MAKE_JOBS_NUMBER} \
|
2022-01-12 10:38:51 +01:00
|
|
|
cargo rustc rust-std
|
2020-02-25 19:18:26 +01:00
|
|
|
|
|
|
|
do-install:
|
2020-06-19 20:53:57 +02:00
|
|
|
@${MKDIR} ${STAGEDIR}${PREFIX}/rust-bootstrap/${FLAVOR}
|
2021-11-26 10:30:31 +01:00
|
|
|
${INSTALL_DATA} ${WRKDIR}/_build/dist/*-${_RUST_ARCH_${FLAVOR}:U${FLAVOR}}-unknown-${OPSYS:tl}${EXTRACT_SUFX} \
|
2020-06-19 20:53:57 +02:00
|
|
|
${STAGEDIR}${PREFIX}/rust-bootstrap/${FLAVOR}
|
2020-02-25 19:18:26 +01:00
|
|
|
@cd ${STAGEDIR}${PREFIX} && \
|
|
|
|
${FIND} rust-bootstrap -type f >> ${TMPPLIST}
|
|
|
|
|
|
|
|
.include <bsd.port.post.mk>
|