1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-04 01:48:54 +00:00

lang/rust: Simplify do-configure and garbage collect files/config.toml

This commit is contained in:
Tobias Kortkamp 2020-01-07 07:01:46 +00:00
parent ced1e88d5e
commit f998d9199b
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=522316
2 changed files with 26 additions and 64 deletions

View File

@ -141,32 +141,36 @@ post-patch-SOURCES-off:
@${REINPLACE_CMD} -e 's/config.tools.*"src".*/false;/' \
${WRKSRC}/src/bootstrap/install.rs
.if defined(WITH_CCACHE_BUILD) && !defined(NO_CCACHE)
CCACHE_VALUE= "${CCACHE_BIN}"
.else
CCACHE_VALUE= false
.endif
do-configure:
${SED} -E \
-e 's,%PREFIX%,${PREFIX},' \
-e 's,%SYSCONFDIR%,${PREFIX}/etc,' \
-e 's,%MANDIR%,${MANPREFIX}/man,' \
-e 's,%PYTHON_CMD%,${PYTHON_CMD},' \
-e 's,%CHANNEL%,${PKGNAMESUFFIX:Ustable:S/^-//},' \
-e 's,%TARGET%,${_RUST_TARGET},' \
-e 's,%CCACHE%,${CCACHE_VALUE},' \
-e 's,%CC%,${CC},' \
-e 's,%CXX%,${CXX},' \
-e 's,%DOCS%,${_RUST_BUILD_DOCS},' \
< ${FILESDIR}/config.toml \
> ${WRKSRC}/config.toml
@${ECHO_CMD} '[build]' > ${WRKSRC}/config.toml
@${ECHO_CMD} 'vendor=true' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'extended=true' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'python="${PYTHON_CMD}"' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'docs=${_RUST_BUILD_DOCS}' >> ${WRKSRC}/config.toml
@${ECHO_CMD} '[install]' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'prefix="${PREFIX}"' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'sysconfdir="${PREFIX}/etc"' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'mandir="${MANPREFIX}/man"' >> ${WRKSRC}/config.toml
@${ECHO_CMD} '[rust]' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'channel="${PKGNAMESUFFIX:Ustable:S/^-//}"' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'default-linker="${CC}"' >> ${WRKSRC}/config.toml
@${ECHO_CMD} '[llvm]' >> ${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
# no need to build a crosscompiler for these targets
.if ${ARCH} == aarch64 || ${ARCH} == armv6 || ${ARCH} == armv7 || ${ARCH} == powerpc64
@${REINPLACE_CMD} -e 's,^#targets =.*,targets = "${_LLVM_TARGET}",' \
-e 's,^#experimental-targets =.*,experimental-targets = "",' \
${WRKSRC}/config.toml
@${ECHO_CMD} 'targets="${_LLVM_TARGET}"' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'experimental-targets=""' >> ${WRKSRC}/config.toml
.endif
@${ECHO_CMD} '[target.${_RUST_TARGET}]' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'cc="${CC}"' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'cxx="${CXX}"' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'linker="${CC}"' >> ${WRKSRC}/config.toml
@${ECHO_CMD} '[dist]' >> ${WRKSRC}/config.toml
@${ECHO_CMD} 'src-tarball=false' >> ${WRKSRC}/config.toml
@${REINPLACE_CMD} -e 's,%CC%,${CC},g' \
${WRKSRC}/src/librustc_llvm/build.rs \
${WRKSRC}/src/bootstrap/native.rs

View File

@ -1,42 +0,0 @@
[build]
# Use bundled crates; this should permit offline build.
vendor = true
# In addition to rustc, rust-std and rust-docs, build Cargo.
extended = true
# python(1) location.
python = "%PYTHON_CMD%"
# Do we want to build docs?
docs = %DOCS%
[install]
# Install location.
prefix = "%PREFIX%"
sysconfdir = "%SYSCONFDIR%"
mandir = "%MANDIR%"
[rust]
# Rust release channel.
channel = "%CHANNEL%"
default-linker = "%CC%"
[llvm]
ccache = %CCACHE%
#targets = "X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX;Hexagon"
#experimental-targets = "WebAssembly;RISCV"
[target.%TARGET%]
cc = "%CC%"
cxx = "%CXX%"
linker = "%CC%"
[dist]
# Do not build the source archive.
src-tarball = false