2013-01-07 07:35:04 +01:00
|
|
|
# Created by: Jyun-Yan You <jyyou@cs.nctu.edu.tw>
|
2012-01-23 17:07:04 +01:00
|
|
|
# $FreeBSD$
|
|
|
|
|
|
|
|
PORTNAME= rust
|
2017-05-14 17:26:44 +02:00
|
|
|
PORTVERSION?= 1.17.0
|
2012-01-23 17:07:04 +01:00
|
|
|
CATEGORIES= lang
|
2013-01-07 07:35:04 +01:00
|
|
|
MASTER_SITES= http://static.rust-lang.org/dist/:src \
|
2017-02-22 20:04:03 +01:00
|
|
|
https://static.rust-lang.org/dist/:rust_bootstrap \
|
|
|
|
https://s3.amazonaws.com/rust-lang-ci/cargo-builds/:cargo_bootstrap \
|
2016-07-12 13:49:49 +02:00
|
|
|
LOCAL/marino:bootstrap
|
2017-02-22 20:04:03 +01:00
|
|
|
DISTNAME?= ${PORTNAME}c-${PORTVERSION}-src
|
|
|
|
BOOTSTRAP_FILES=${RUSTC_BOOTSTRAP}:rust_bootstrap \
|
|
|
|
${RUST_STD_BOOTSTRAP}:rust_bootstrap \
|
|
|
|
${CARGO_BOOTSTRAP}:cargo_bootstrap
|
|
|
|
DISTFILES?= ${DISTNAME}${EXTRACT_SUFX}:src \
|
|
|
|
${BOOTSTRAP_FILES}
|
|
|
|
.if !defined(SKIP_CARGO_REGISTRY)
|
|
|
|
MASTER_SITES+= LOCAL/riggs/rust:registry \
|
|
|
|
LOCAL/dumbbell/rust:registry
|
|
|
|
DISTFILES+= ${CARGO_REGISTRY}:registry
|
|
|
|
.endif
|
|
|
|
DIST_SUBDIR?= rust
|
|
|
|
EXTRACT_ONLY?= ${DISTFILES:N*\:*bootstrap:C/:.*//}
|
2012-01-23 17:07:04 +01:00
|
|
|
|
2016-04-02 16:49:00 +02:00
|
|
|
MAINTAINER?= riggs@FreeBSD.org
|
2014-04-27 10:02:10 +02:00
|
|
|
COMMENT= Language with a focus on memory safety and concurrency
|
2012-01-23 17:07:04 +01:00
|
|
|
|
2014-03-15 08:03:58 +01:00
|
|
|
LICENSE= APACHE20 \
|
|
|
|
MIT
|
|
|
|
LICENSE_COMB= dual
|
2016-04-01 03:16:08 +02:00
|
|
|
# APACHE20 license is standard, see Templates/Licenses/APACHE20
|
|
|
|
LICENSE_FILE_MIT= ${WRKSRC}/LICENSE-MIT
|
2014-03-15 08:03:58 +01:00
|
|
|
|
2016-08-20 07:57:34 +02:00
|
|
|
BUILD_DEPENDS= cmake:devel/cmake
|
|
|
|
|
2016-04-02 16:49:00 +02:00
|
|
|
ONLY_FOR_ARCHS?= amd64 i386
|
2014-07-23 09:41:07 +02:00
|
|
|
ONLY_FOR_ARCHS_REASON= requires prebuilt bootstrap compiler
|
|
|
|
|
2015-06-24 19:09:27 +02:00
|
|
|
# FIXME: The bootstrapped rustc adds -L/usr/local/lib in front of
|
|
|
|
# the LDFLAGS. When stage0's rustc is linked, it picks the installed
|
|
|
|
# librust*so and fails.
|
2016-04-02 16:49:00 +02:00
|
|
|
CONFLICTS_BUILD?= rust-nightly
|
|
|
|
CONFLICTS_BUILD+= ${PKGBASE}
|
|
|
|
CONFLICTS_INSTALL?= rust-nightly
|
2015-06-24 19:09:27 +02:00
|
|
|
|
2017-05-14 17:26:44 +02:00
|
|
|
RUST_BOOTSTRAP_DIR?= 2017-03-11
|
|
|
|
RUST_BOOTSTRAP_VERSION?= 1.16.0
|
2017-02-22 20:04:03 +01:00
|
|
|
RUSTC_BOOTSTRAP= ${RUST_BOOTSTRAP_DIR}/rustc-${RUST_BOOTSTRAP_VERSION}-${RUST_TARGET}.tar.gz
|
|
|
|
RUST_STD_BOOTSTRAP= ${RUST_BOOTSTRAP_DIR}/rust-std-${RUST_BOOTSTRAP_VERSION}-${RUST_TARGET}.tar.gz
|
|
|
|
|
2017-05-14 17:26:44 +02:00
|
|
|
CARGO_BOOTSTRAP_DIR?= 6b05583d71f982bcad049b9fa094c637c062e751
|
2017-02-22 20:04:03 +01:00
|
|
|
CARGO_BOOTSTRAP_VERSION?= nightly
|
|
|
|
CARGO_BOOTSTRAP= ${CARGO_BOOTSTRAP_DIR}/cargo-${CARGO_BOOTSTRAP_VERSION}-${RUST_TARGET}.tar.gz
|
|
|
|
CARGO_REGISTRY= ${PORTNAME}-registry-${DISTVERSIONFULL}.tar.xz
|
2012-05-22 19:49:35 +02:00
|
|
|
|
2016-04-02 16:49:00 +02:00
|
|
|
RUST_CHANNEL= ${PKGNAMESUFFIX:Ustable:S/^-//}
|
2015-09-12 16:49:44 +02:00
|
|
|
|
2015-09-19 20:22:06 +02:00
|
|
|
# Rust's target arch string is different from *BSD arch strings
|
2016-03-31 22:04:49 +02:00
|
|
|
RUST_ARCH_x86_64= x86_64 # dragonfly
|
2015-09-19 20:22:06 +02:00
|
|
|
RUST_ARCH_amd64= x86_64
|
|
|
|
RUST_ARCH_i386= i686
|
2015-12-13 15:21:05 +01:00
|
|
|
RUST_TARGET= ${RUST_ARCH_${ARCH}}-unknown-${OPSYS:tl}
|
2017-02-22 20:04:03 +01:00
|
|
|
PLIST_SUB+= RUST_TARGET=${RUST_TARGET}
|
2015-09-12 16:49:44 +02:00
|
|
|
|
2016-04-17 12:21:20 +02:00
|
|
|
USES= compiler gmake libedit python:2,build
|
2012-01-23 17:07:04 +01:00
|
|
|
HAS_CONFIGURE= yes
|
2016-07-02 21:06:34 +02:00
|
|
|
CONFIGURE_ARGS= --disable-valgrind \
|
2016-04-17 12:21:20 +02:00
|
|
|
${CHOSEN_COMPILER_TYPE:Mclang:C/.+/--enable-&/} \
|
2016-08-09 23:41:25 +02:00
|
|
|
--prefix=${PREFIX} \
|
|
|
|
--musl-root=${PREFIX} \
|
|
|
|
--local-rust-root=${PREFIX} \
|
2016-04-17 12:21:20 +02:00
|
|
|
--mandir=${MANPREFIX}/man \
|
2015-09-12 16:49:44 +02:00
|
|
|
--release-channel=${RUST_CHANNEL}
|
2015-06-24 19:09:27 +02:00
|
|
|
|
2014-07-23 09:41:07 +02:00
|
|
|
MAKE_ARGS+= VERBOSE=1
|
2012-01-23 17:07:04 +01:00
|
|
|
|
2016-07-02 21:06:34 +02:00
|
|
|
OPTIONS_DEFINE= DOCS GDB LLNEXTGEN PORT_LLVM
|
2015-12-13 15:21:05 +01:00
|
|
|
GDB_DESC= Install ports gdb (necessary for debugging rust programs)
|
2014-03-15 08:03:58 +01:00
|
|
|
LLNEXTGEN_DESC= Build with grammar verification
|
2012-01-23 17:07:04 +01:00
|
|
|
|
2016-07-02 21:06:34 +02:00
|
|
|
DOCS_CONFIGURE_ENABLE= docs
|
2016-04-01 16:08:37 +02:00
|
|
|
GDB_RUN_DEPENDS= ${LOCALBASE}/bin/gdb:devel/gdb
|
|
|
|
LLNEXTGEN_BUILD_DEPENDS= LLnextgen:devel/llnextgen
|
2012-01-23 17:07:04 +01:00
|
|
|
|
2016-03-25 07:38:23 +01:00
|
|
|
# Rust may pass more regression tests with bundled LLVM
|
|
|
|
PORT_LLVM_DESC= Build against devel/llvm${LLVM_VER} instead of bundled version
|
2016-04-01 16:08:37 +02:00
|
|
|
PORT_LLVM_BUILD_DEPENDS= ${LLVM_PREFIX}/bin/FileCheck:devel/llvm${LLVM_VER}
|
2016-03-25 07:38:23 +01:00
|
|
|
PORT_LLVM_CONFIGURE_ON= --llvm-root=${LLVM_PREFIX}
|
2017-05-14 17:26:44 +02:00
|
|
|
LLVM_VER?= 40
|
2016-03-25 07:38:23 +01:00
|
|
|
LLVM_PREFIX= ${LOCALBASE}/llvm${LLVM_VER}
|
|
|
|
|
2015-11-07 23:17:36 +01:00
|
|
|
# Note that make test does not work when rust is already installed
|
|
|
|
TEST_TARGET= check
|
|
|
|
TEST_ENV+= ALLOW_NONZERO_RLIMIT_CORE=1
|
|
|
|
|
2017-03-06 14:27:57 +01:00
|
|
|
# Rust manifests list all files and directories installed by rust-installer.
|
|
|
|
# We use them in:
|
|
|
|
# - pre-install to cleanup the ${STAGEDIR}
|
|
|
|
# - post-install to populate the ${TMPPLIST}
|
|
|
|
RUST_MANIFESTS= lib/rustlib/manifest-rustc \
|
|
|
|
lib/rustlib/manifest-rust-std-${RUST_TARGET}
|
|
|
|
RUST_DOCS_MANIFESTS= lib/rustlib/manifest-rust-docs
|
|
|
|
DOCS_VARS= rust_manifests+=${RUST_DOCS_MANIFESTS}
|
|
|
|
|
|
|
|
PLIST_FILES= lib/rustlib/components \
|
|
|
|
lib/rustlib/rust-installer-version
|
|
|
|
|
2015-09-12 16:49:44 +02:00
|
|
|
pre-fetch:
|
|
|
|
# FIXME: This is the same check for CONFLICTS as the standard
|
|
|
|
# one, except port origins are not compared. This allows
|
|
|
|
# the port to conflict with itself, because Rust would pick
|
|
|
|
# installed Rust libraries instead of freshly built ones.
|
|
|
|
@conflicts_with=$$( \
|
|
|
|
{ ${PKG_QUERY} -g "%n-%v %p %o" ${CONFLICTS:C/.+/'&'/} ${CONFLICTS_BUILD:C/.+/'&'/} 2>/dev/null || : ; } \
|
|
|
|
| while read pkgname prfx orgn; do \
|
|
|
|
if [ "/${PREFIX}" = "/$${prfx}" ]; then \
|
|
|
|
${ECHO_CMD} -n " $${pkgname}"; \
|
|
|
|
fi; \
|
|
|
|
done); \
|
|
|
|
if [ -n "$${conflicts_with}" ]; then \
|
|
|
|
${ECHO_MSG}; \
|
|
|
|
${ECHO_MSG} "===> ${PKGNAME} conflicts with installed package(s): "; \
|
|
|
|
for entry in $${conflicts_with}; do \
|
|
|
|
${ECHO_MSG} " $${entry}"; \
|
|
|
|
done; \
|
|
|
|
${ECHO_MSG}; \
|
|
|
|
${ECHO_MSG} " They will not build together."; \
|
|
|
|
${ECHO_MSG} " Please remove them first with pkg delete."; \
|
|
|
|
exit 1;\
|
|
|
|
fi
|
2015-03-26 15:29:57 +01:00
|
|
|
|
2012-05-22 19:49:35 +02:00
|
|
|
post-extract:
|
2017-02-22 20:04:03 +01:00
|
|
|
@${MKDIR} \
|
|
|
|
${WRKSRC}/build/cache/${RUST_BOOTSTRAP_DIR} \
|
|
|
|
${WRKSRC}/build/cache/${CARGO_BOOTSTRAP_DIR}
|
|
|
|
${LN} -sf ${DISTDIR}/${DIST_SUBDIR}/${RUSTC_BOOTSTRAP} \
|
|
|
|
${WRKSRC}/build/cache/${RUST_BOOTSTRAP_DIR}
|
|
|
|
${LN} -sf ${DISTDIR}/${DIST_SUBDIR}/${RUST_STD_BOOTSTRAP} \
|
|
|
|
${WRKSRC}/build/cache/${RUST_BOOTSTRAP_DIR}
|
|
|
|
${LN} -sf ${DISTDIR}/${DIST_SUBDIR}/${CARGO_BOOTSTRAP} \
|
|
|
|
${WRKSRC}/build/cache/${CARGO_BOOTSTRAP_DIR}
|
2015-06-24 19:09:27 +02:00
|
|
|
|
2015-09-03 17:22:07 +02:00
|
|
|
post-patch:
|
2017-02-22 20:04:03 +01:00
|
|
|
@test ! -f ${WRKSRC}/mk/main.mk || \
|
|
|
|
${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|' \
|
2015-09-03 17:22:07 +02:00
|
|
|
${WRKSRC}/mk/main.mk
|
2015-12-13 15:21:05 +01:00
|
|
|
@${REINPLACE_CMD} -e 's|gdb|${LOCALBASE}/bin/gdb|' \
|
|
|
|
${WRKSRC}/src/etc/rust-gdb
|
2015-09-03 17:22:07 +02:00
|
|
|
|
2015-06-24 19:09:27 +02:00
|
|
|
# In case the previous "make stage" failed, this ensures rust's
|
|
|
|
# install.sh won't backup previously staged files before reinstalling
|
|
|
|
# new ones. Otherwise, the staging directory is polluted with unneeded
|
|
|
|
# files.
|
|
|
|
pre-install:
|
2017-03-06 14:27:57 +01:00
|
|
|
@for f in ${RUST_MANIFESTS} ${RUST_DOCS_MANIFESTS}; do \
|
|
|
|
if test -f "${STAGEDIR}${PREFIX}/$$f"; then \
|
|
|
|
${SED} -E -e 's,^(file|dir):,${STAGEDIR},' \
|
|
|
|
< "${STAGEDIR}${PREFIX}/$$f" \
|
|
|
|
| ${XARGS} ${RM} -r; \
|
|
|
|
${RM} "${STAGEDIR}${PREFIX}/$$f"; \
|
2016-04-07 09:17:45 +02:00
|
|
|
fi; \
|
|
|
|
done
|
2017-03-06 14:27:57 +01:00
|
|
|
@for f in ${PLIST_FILES}; do \
|
|
|
|
${RM} "${STAGEDIR}${PREFIX}/$$f"; \
|
2016-07-02 21:06:34 +02:00
|
|
|
done
|
|
|
|
|
2017-03-06 14:27:57 +01:00
|
|
|
# In post-install, we use the manifests generated during Rust install
|
|
|
|
# to in turn generate the PLIST. We do that, instead of the regular
|
|
|
|
# `pkg-plist`, because several libraries have a computed filename based
|
|
|
|
# on the absolute path of the source files. As it is user-specific, we
|
|
|
|
# can't know their filename in advance.
|
|
|
|
#
|
|
|
|
# We fix manpage entries in the generated manifests because Rust
|
|
|
|
# installs them uncompressed but the Ports framework compresses them.
|
2014-04-27 10:02:10 +02:00
|
|
|
post-install:
|
2017-03-06 14:27:57 +01:00
|
|
|
for f in ${RUST_MANIFESTS}; do \
|
|
|
|
${REINPLACE_CMD} -E \
|
|
|
|
-e 's|:${STAGEDIR}|:|' \
|
|
|
|
-e 's|(man/man[1-9]/.*\.[0-9])|\1.gz|' \
|
|
|
|
${STAGEDIR}${PREFIX}/$$f; \
|
|
|
|
${RM} ${STAGEDIR}${PREFIX}/$$f.bak; \
|
|
|
|
${ECHO} "${PREFIX}/$$f" >> ${TMPPLIST}; \
|
|
|
|
${AWK} '\
|
|
|
|
/^file:/ { \
|
|
|
|
file=$$0; \
|
|
|
|
sub(/^file:/, "", file); \
|
|
|
|
print file; \
|
|
|
|
} \
|
|
|
|
/^dir:/ { \
|
|
|
|
dir=$$0; \
|
|
|
|
sub(/^dir:/, "", dir); \
|
|
|
|
system("find ${STAGEDIR}" dir " -type f | ${SED} -E -e \"s|${STAGEDIR}||\""); \
|
|
|
|
}' \
|
|
|
|
${STAGEDIR}${PREFIX}/$$f >> ${TMPPLIST}; \
|
2016-04-07 09:17:45 +02:00
|
|
|
done
|
2017-03-06 14:27:57 +01:00
|
|
|
@${RM} \
|
|
|
|
${STAGEDIR}${PREFIX}/lib/rustlib/install.log \
|
|
|
|
${STAGEDIR}${PREFIX}/lib/rustlib/uninstall.sh
|
2016-04-02 16:49:00 +02:00
|
|
|
# FIXME: Static libraries in lib/rustlib/*/lib/*.rlib are not stripped,
|
|
|
|
# but they contain non-object files which make strip(1) unhappy.
|
2015-06-24 19:09:27 +02:00
|
|
|
@${STRIP_CMD} \
|
|
|
|
${STAGEDIR}${PREFIX}/bin/rustc \
|
|
|
|
${STAGEDIR}${PREFIX}/bin/rustdoc \
|
|
|
|
${STAGEDIR}${PREFIX}/lib/*.so \
|
|
|
|
${STAGEDIR}${PREFIX}/lib/rustlib/*/lib/*.so
|
2012-01-23 17:07:04 +01:00
|
|
|
|
2015-09-12 16:49:44 +02:00
|
|
|
.include <bsd.port.mk>
|
2017-02-22 20:04:03 +01:00
|
|
|
|
|
|
|
# "make gen-registry" is a special target to ease this port update.
|
|
|
|
#
|
|
|
|
# After changing the version number and the Git revision, you can run
|
|
|
|
# "make gen-registry" to update the distinfo and create a new snapshot of
|
|
|
|
# the registry. The new registry is written to ${DISTDIR} and can be
|
|
|
|
# uploaded.
|
|
|
|
|
|
|
|
gen-registry:
|
|
|
|
${MAKE} -C${.CURDIR} -DSKIP_CARGO_REGISTRY makesum
|
|
|
|
${MAKE} -C${.CURDIR} -DSKIP_CARGO_REGISTRY
|
2017-05-14 17:26:44 +02:00
|
|
|
${TAR} cJvf ${DISTDIR}/${DIST_SUBDIR}/${CARGO_REGISTRY} -C${WRKDIR} \
|
2017-02-22 20:04:03 +01:00
|
|
|
--uid 0 --gid 0 \
|
|
|
|
--exclude 'src/*/benches/' \
|
|
|
|
--exclude 'src/*/ci/' \
|
|
|
|
--exclude 'src/*/examples/' \
|
|
|
|
--exclude 'src/*/tests/' \
|
|
|
|
--exclude 'index/github.com-*/.git/' \
|
|
|
|
.cargo
|
|
|
|
${MAKE} -C${.CURDIR} makesum
|