aboutsummaryrefslogtreecommitdiffstats
path: root/lang
diff options
context:
space:
mode:
authordumbbell <dumbbell@FreeBSD.org>2017-06-17 22:44:30 +0800
committerdumbbell <dumbbell@FreeBSD.org>2017-06-17 22:44:30 +0800
commit4777881f618c2bddf83f0d57bb8c688783c42942 (patch)
tree12e15eca6491b32d8db6ecb14e3515fea7695332 /lang
parent032c556450749ab8fb7aef89680d6fc3672e6b11 (diff)
downloadfreebsd-ports-gnome-4777881f618c2bddf83f0d57bb8c688783c42942.tar.gz
freebsd-ports-gnome-4777881f618c2bddf83f0d57bb8c688783c42942.tar.zst
freebsd-ports-gnome-4777881f618c2bddf83f0d57bb8c688783c42942.zip
lang/rust: Enable on FreeBSD/aarch64 + various fixes
This port now uses an unofficial bootstrap of Rust 1.17.0 and Cargo 0.18.0 for FreeBSD/aarch64. Here are my notes to create this boostrap: https://gist.github.com/dumbbell/b587da50ef014078da9e732a4331ebad The port's Makefile was changed to: - allow to override the versions and directories of the bootstrap archives; - patch the bootstrap script and manifest with those versions/directories. Beside changes to support FreeBSD/aarch64, the port received the following fixes: - Pass python path to the configure script. - Fix and simplify the extraction of rust-std bootstrap by re-using existing variables. - Make sure tar(1) doesn't produce sparse file entries when it recreates the rust-std bootstrap because Python 2's tarfile module doesn't support them (PR 219842). PR: 216143, 219842 Differential Revision: https://reviews.freebsd.org/D10857
Diffstat (limited to 'lang')
-rw-r--r--lang/rust/Makefile59
-rw-r--r--lang/rust/distinfo6
-rw-r--r--lang/rust/files/extra-patch-ino6468
3 files changed, 116 insertions, 17 deletions
diff --git a/lang/rust/Makefile b/lang/rust/Makefile
index c3d404e9759b..95aaf177b0b9 100644
--- a/lang/rust/Makefile
+++ b/lang/rust/Makefile
@@ -6,8 +6,10 @@ PORTVERSION?= 1.18.0
CATEGORIES= lang
MASTER_SITES= http://static.rust-lang.org/dist/:src \
https://static.rust-lang.org/dist/:rust_bootstrap \
+ LOCAL/dumbbell/rust:rust_bootstrap \
https://static.rust-lang.org/dist/:cargo_bootstrap \
https://s3.amazonaws.com/rust-lang-ci/cargo-builds/:cargo_bootstrap \
+ LOCAL/dumbbell/rust:cargo_bootstrap \
LOCAL/marino:bootstrap
DISTNAME?= ${PORTNAME}c-${PORTVERSION}-src
BOOTSTRAP_FILES=${RUSTC_BOOTSTRAP}:rust_bootstrap \
@@ -34,7 +36,7 @@ LICENSE_FILE_MIT= ${WRKSRC}/LICENSE-MIT
BUILD_DEPENDS= cmake:devel/cmake
-ONLY_FOR_ARCHS?= amd64 i386
+ONLY_FOR_ARCHS?= aarch64 amd64 i386
ONLY_FOR_ARCHS_REASON= requires prebuilt bootstrap compiler
# FIXME: The bootstrapped rustc adds -L/usr/local/lib in front of
@@ -45,26 +47,30 @@ CONFLICTS_BUILD+= ${PKGBASE}
CONFLICTS_INSTALL?= rust-nightly
RUST_BOOTSTRAP_DIR?= 2017-04-27
+RUST_BOOTSTRAP_DIR_aarch64?= 2017-04-24
RUST_BOOTSTRAP_VERSION?= 1.17.0
-RUST_BOOTSTRAP_HASH?= f4594d3e53dcb114
-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
+RUST_BOOTSTRAP_VERSION_aarch64?=1.17.0
+RUSTC_BOOTSTRAP= ${RUST_BOOTSTRAP_DIR_${ARCH}:U${RUST_BOOTSTRAP_DIR}}/rustc-${RUST_BOOTSTRAP_VERSION_${ARCH}:U${RUST_BOOTSTRAP_VERSION}}-${RUST_TARGET}.tar.gz
+RUST_STD_BOOTSTRAP= ${RUST_BOOTSTRAP_DIR_${ARCH}:U${RUST_BOOTSTRAP_DIR}}/rust-std-${RUST_BOOTSTRAP_VERSION_${ARCH}:U${RUST_BOOTSTRAP_VERSION}}-${RUST_TARGET}.tar.gz
CARGO_BOOTSTRAP_DIR?= ${RUST_BOOTSTRAP_DIR}
+CARGO_BOOTSTRAP_DIR_aarch64?= ${RUST_BOOTSTRAP_DIR}
CARGO_BOOTSTRAP_VERSION?= 0.18.0
-CARGO_BOOTSTRAP= ${CARGO_BOOTSTRAP_DIR}/cargo-${CARGO_BOOTSTRAP_VERSION}-${RUST_TARGET}.tar.gz
+CARGO_BOOTSTRAP_VERSION_aarch64?=0.18.0
+CARGO_BOOTSTRAP= ${CARGO_BOOTSTRAP_DIR_${ARCH}:U${CARGO_BOOTSTRAP_DIR}}/cargo-${CARGO_BOOTSTRAP_VERSION_${ARCH}:U${CARGO_BOOTSTRAP_VERSION}}-${RUST_TARGET}${EXTRACT_SUFX}
CARGO_REGISTRY= ${PORTNAME}-registry-${DISTVERSIONFULL}.tar.xz
RUST_CHANNEL= ${PKGNAMESUFFIX:Ustable:S/^-//}
# Rust's target arch string is different from *BSD arch strings
-RUST_ARCH_x86_64= x86_64 # dragonfly
+RUST_ARCH_aarch64= aarch64
RUST_ARCH_amd64= x86_64
RUST_ARCH_i386= i686
+RUST_ARCH_x86_64= x86_64 # dragonfly
RUST_TARGET= ${RUST_ARCH_${ARCH}}-unknown-${OPSYS:tl}
PLIST_SUB+= RUST_TARGET=${RUST_TARGET}
-USES= compiler gmake libedit python:2,build
+USES= compiler gmake libedit python:2.7,build
HAS_CONFIGURE= yes
CONFIGURE_ARGS= --disable-valgrind \
${CHOSEN_COMPILER_TYPE:Mclang:C/.+/--enable-&/} \
@@ -72,7 +78,8 @@ CONFIGURE_ARGS= --disable-valgrind \
--musl-root=${PREFIX} \
--local-rust-root=${PREFIX} \
--mandir=${MANPREFIX}/man \
- --release-channel=${RUST_CHANNEL}
+ --release-channel=${RUST_CHANNEL} \
+ --python="${PYTHON_CMD}"
MAKE_ARGS+= VERBOSE=1
@@ -136,29 +143,32 @@ pre-fetch:
exit 1;\
fi
-LIBSTD= rust-std-${RUST_BOOTSTRAP_VERSION}-${RUST_ARCH_${ARCH}}-unknown-freebsd/rust-std-${RUST_ARCH_${ARCH}}-unknown-freebsd/lib/rustlib/${RUST_ARCH_${ARCH}}-unknown-freebsd/lib/libstd-f4594d3e53dcb114.rlib
-STDF= std-${RUST_BOOTSTRAP_HASH}.0.o
+RUST_STD_DIR= ${RUST_STD_BOOTSTRAP:T:R:R}
+LIBSTD_SUFFIX= f4594d3e53dcb114
+LIBSTD_SUFFIX_aarch64= b41e0ffe8c1bd541
+LIBSTD= ${RUST_STD_DIR}/rust-std-${RUST_TARGET}/lib/rustlib/${RUST_TARGET}/lib/libstd-${LIBSTD_SUFFIX_${ARCH}:U${LIBSTD_SUFFIX}}.rlib
+STDF= ${LIBSTD:T:R:S/lib//}.0.o
post-extract:
@${MKDIR} \
- ${WRKSRC}/build/cache/${RUST_BOOTSTRAP_DIR} \
- ${WRKSRC}/build/cache/${CARGO_BOOTSTRAP_DIR}
+ ${WRKSRC}/build/cache/${RUST_BOOTSTRAP_DIR_${ARCH}:U${RUST_BOOTSTRAP_DIR}} \
+ ${WRKSRC}/build/cache/${CARGO_BOOTSTRAP_DIR_${ARCH}:U${CARGO_BOOTSTRAP_DIR}}
${LN} -sf ${DISTDIR}/${DIST_SUBDIR}/${RUSTC_BOOTSTRAP} \
- ${WRKSRC}/build/cache/${RUST_BOOTSTRAP_DIR}
+ ${WRKSRC}/build/cache/${RUST_BOOTSTRAP_DIR_${ARCH}:U${RUST_BOOTSTRAP_DIR}}
.if ${OPSYS} != FreeBSD || ${OSVERSION} < 1200031
${LN} -sf ${DISTDIR}/${DIST_SUBDIR}/${RUST_STD_BOOTSTRAP} \
- ${WRKSRC}/build/cache/${RUST_BOOTSTRAP_DIR}
+ ${WRKSRC}/build/cache/${RUST_BOOTSTRAP_DIR_${ARCH}:U${RUST_BOOTSTRAP_DIR}}
.endif
${LN} -sf ${DISTDIR}/${DIST_SUBDIR}/${CARGO_BOOTSTRAP} \
- ${WRKSRC}/build/cache/${CARGO_BOOTSTRAP_DIR}
- ${TAR} -x -C ${WRKSRC} -f ${DISTDIR}/${DIST_SUBDIR}/${RUST_STD_BOOTSTRAP}
+ ${WRKSRC}/build/cache/${CARGO_BOOTSTRAP_DIR_${ARCH}:U${CARGO_BOOTSTRAP_DIR}}
.if ${OPSYS} == FreeBSD && ${OSVERSION} >= 1200031
+ ${TAR} -x -C ${WRKSRC} -f ${DISTDIR}/${DIST_SUBDIR}/${RUST_STD_BOOTSTRAP}
${CC} ${CFLAGS} -fPIC -c -o ${WRKSRC}/old_fstat.o ${FILESDIR}/old_fstat.c
(cd ${WRKSRC} && ${AR} x ${WRKSRC}/${LIBSTD} ${STDF})
${LD} -r -o ${WRKSRC}/std.xx.o ${WRKSRC}/${STDF} ${WRKSRC}/old_fstat.o
${MV} ${WRKSRC}/std.xx.o ${WRKSRC}/${STDF}
(cd ${WRKSRC} && ${AR} r ${WRKSRC}/${LIBSTD} ${STDF})
- ${TAR} -cy -C ${WRKSRC} -f ${WRKSRC}/rustc.tbz rust-std-${RUST_BOOTSTRAP_VERSION}-${RUST_ARCH_${ARCH}}-unknown-freebsd
+ ${TAR} -cy --format=ustar -C ${WRKSRC} -f ${WRKSRC}/rustc.tbz ${RUST_STD_DIR}
${MV} ${WRKSRC}/rustc.tbz ${WRKSRC}/build/cache/${RUST_STD_BOOTSTRAP}
.endif
@@ -168,6 +178,21 @@ post-patch:
${WRKSRC}/mk/main.mk
@${REINPLACE_CMD} -e 's|gdb|${LOCALBASE}/bin/gdb|' \
${WRKSRC}/src/etc/rust-gdb
+ @if test "${RUST_BOOTSTRAP_DIR_${ARCH}}" -o "${RUST_BOOTSTRAP_VERSION_${ARCH}}"; then \
+ ${REINPLACE_CMD} -e \
+ 's|^rustc:.*|rustc: ${RUST_BOOTSTRAP_VERSION_${ARCH}:U${RUST_BOOTSTRAP_VERSION}}-${RUST_BOOTSTRAP_DIR_${ARCH}:U${RUST_BOOTSTRAP_DIR}}|' \
+ ${WRKSRC}/src/stage0.txt; \
+ fi
+ @if test "${CARGO_BOOTSTRAP_DIR_${ARCH}}"; then \
+ ${REINPLACE_CMD} -e \
+ 's|^cargo:.*|cargo: ${RUST_BOOTSTRAP_DIR_${ARCH}:U${RUST_BOOTSTRAP_DIR}}|' \
+ ${WRKSRC}/src/stage0.txt; \
+ fi
+ @if test "${CARGO_BOOTSTRAP_VERSION_${ARCH}}"; then \
+ ${REINPLACE_CMD} -e \
+ 's|cargo-nightly-|cargo-${CARGO_BOOTSTRAP_VERSION_${ARCH}:U${CARGO_BOOTSTRAP_VERSION}}-|' \
+ ${WRKSRC}/src/bootstrap/bootstrap.py; \
+ fi
# In case the previous "make stage" failed, this ensures rust's
# install.sh won't backup previously staged files before reinstalling
diff --git a/lang/rust/distinfo b/lang/rust/distinfo
index 119cdf7a6d62..f4b1c17cb5f1 100644
--- a/lang/rust/distinfo
+++ b/lang/rust/distinfo
@@ -13,5 +13,11 @@ SHA256 (rust/2017-04-27/rust-std-1.17.0-i686-unknown-freebsd.tar.gz) = 51304792a
SIZE (rust/2017-04-27/rust-std-1.17.0-i686-unknown-freebsd.tar.gz) = 57341618
SHA256 (rust/2017-04-27/cargo-0.18.0-i686-unknown-freebsd.tar.gz) = 30ec4cfc667e3a8fca3cb0377b6a6f5dbcd19ad7143046db24e37432646e60a2
SIZE (rust/2017-04-27/cargo-0.18.0-i686-unknown-freebsd.tar.gz) = 4914461
+SHA256 (rust/2017-04-24/rustc-1.17.0-aarch64-unknown-freebsd.tar.gz) = 85c234018cfc7548051d6f726a379ba2c37b80c393a74a96e7212a0c4e15e92e
+SIZE (rust/2017-04-24/rustc-1.17.0-aarch64-unknown-freebsd.tar.gz) = 33612511
+SHA256 (rust/2017-04-24/rust-std-1.17.0-aarch64-unknown-freebsd.tar.gz) = a86d963998cce1f357cbb748c0cd45307255eac964181f3879348e44faf6772c
+SIZE (rust/2017-04-24/rust-std-1.17.0-aarch64-unknown-freebsd.tar.gz) = 43207694
+SHA256 (rust/2017-04-24/cargo-0.18.0-aarch64-unknown-freebsd.tar.gz) = 8cdbf046bfc98e1cb92b89c306e4389b92a8df9db44b8f7c784aaac25ad52877
+SIZE (rust/2017-04-24/cargo-0.18.0-aarch64-unknown-freebsd.tar.gz) = 2935624
SHA256 (rust/rust-registry-1.18.0.tar.xz) = 86c74c61aec5b94c9db9f569e6aa5cfeab2dde2a4ba73ea1da4c7320b31f5b36
SIZE (rust/rust-registry-1.18.0.tar.xz) = 7714840
diff --git a/lang/rust/files/extra-patch-ino64 b/lang/rust/files/extra-patch-ino64
index 5ea8fa414e55..db545435c7ba 100644
--- a/lang/rust/files/extra-patch-ino64
+++ b/lang/rust/files/extra-patch-ino64
@@ -1,3 +1,37 @@
+--- ./src/liblibc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs.orig 2017-04-24 18:56:45.000000000 +0000
++++ ./src/liblibc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs 2017-05-30 07:55:40.703709000 +0000
+@@ -7,10 +7,12 @@
+ pub struct stat {
+ pub st_dev: ::dev_t,
+ pub st_ino: ::ino_t,
+- pub st_mode: ::mode_t,
+ pub st_nlink: ::nlink_t,
++ pub st_mode: ::mode_t,
++ pub st_pad0: ::uint16_t,
+ pub st_uid: ::uid_t,
+ pub st_gid: ::gid_t,
++ pub st_pad1: ::uint32_t,
+ pub st_rdev: ::dev_t,
+ pub st_atime: ::time_t,
+ pub st_atime_nsec: ::c_long,
+@@ -18,13 +20,13 @@
+ pub st_mtime_nsec: ::c_long,
+ pub st_ctime: ::time_t,
+ pub st_ctime_nsec: ::c_long,
++ pub st_birthtime: ::time_t,
++ pub st_birthtime_nsec: ::c_long,
+ pub st_size: ::off_t,
+ pub st_blocks: ::blkcnt_t,
+ pub st_blksize: ::blksize_t,
+ pub st_flags: ::fflags_t,
+- pub st_gen: ::uint32_t,
+- pub st_lspare: ::int32_t,
+- pub st_birthtime: ::time_t,
+- pub st_birthtime_nsec: ::c_long,
++ pub st_gen: ::uint64_t,
++ pub st_spare: [::int64_t; 10],
+ }
+ }
--- ./src/liblibc/src/unix/bsd/freebsdlike/freebsd/mod.rs.orig 2017-04-24 18:56:45.000000000 +0000
+++ ./src/liblibc/src/unix/bsd/freebsdlike/freebsd/mod.rs 2017-05-25 16:28:37.280076000 +0000
@@ -1,8 +1,8 @@
@@ -205,6 +239,40 @@
}
}
+--- ./src/vendor/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs.orig 2017-04-24 20:20:26.000000000 +0000
++++ ./src/vendor/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs 2017-05-30 07:57:19.874957000 +0000
+@@ -7,10 +7,12 @@
+ pub struct stat {
+ pub st_dev: ::dev_t,
+ pub st_ino: ::ino_t,
+- pub st_mode: ::mode_t,
+ pub st_nlink: ::nlink_t,
++ pub st_mode: ::mode_t,
++ pub st_pad0: ::uint16_t,
+ pub st_uid: ::uid_t,
+ pub st_gid: ::gid_t,
++ pub st_pad1: ::uint32_t,
+ pub st_rdev: ::dev_t,
+ pub st_atime: ::time_t,
+ pub st_atime_nsec: ::c_long,
+@@ -18,13 +20,13 @@
+ pub st_mtime_nsec: ::c_long,
+ pub st_ctime: ::time_t,
+ pub st_ctime_nsec: ::c_long,
++ pub st_birthtime: ::time_t,
++ pub st_birthtime_nsec: ::c_long,
+ pub st_size: ::off_t,
+ pub st_blocks: ::blkcnt_t,
+ pub st_blksize: ::blksize_t,
+ pub st_flags: ::fflags_t,
+- pub st_gen: ::uint32_t,
+- pub st_lspare: ::int32_t,
+- pub st_birthtime: ::time_t,
+- pub st_birthtime_nsec: ::c_long,
++ pub st_gen: ::uint64_t,
++ pub st_spare: [::int64_t; 10],
+ }
+ }
--- ./src/vendor/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs.orig 2017-04-24 20:20:26.000000000 +0000
+++ ./src/vendor/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs 2017-05-25 16:25:42.305261000 +0000
@@ -7,10 +7,12 @@