summaryrefslogtreecommitdiff
path: root/lang/rust
diff options
context:
space:
mode:
authoradam <adam@pkgsrc.org>2018-11-27 15:45:23 +0000
committeradam <adam@pkgsrc.org>2018-11-27 15:45:23 +0000
commit826abea8d87001add2eec9d2227159d25b5f97e3 (patch)
tree31bfb7001bd4c27ee5f36b16dc9437a8cfb7fee1 /lang/rust
parent39908f2b95dc6bb27252bf64ad9615e281074585 (diff)
downloadpkgsrc-826abea8d87001add2eec9d2227159d25b5f97e3.tar.gz
rust: speed-up building; clean-ups
- use 'build' target for building, not 'dist' - set jobs also for install target - do not generate tarballs; we don't need them, but they take a lot of disk-space - do not install 'src' - do not generate 'install.log' nor 'uninstall.sh' - on Darwin, use headerpad_max_install_names to be able to fix all dylibs - make optimized bootstrap - pkglint fixes - get ready to depend on lang/llvm and devel/jemalloc
Diffstat (limited to 'lang/rust')
-rw-r--r--lang/rust/Makefile51
-rw-r--r--lang/rust/cargo.mk4
-rw-r--r--lang/rust/distinfo11
-rw-r--r--lang/rust/patches/patch-src_bootstrap_bootstrap.py20
-rw-r--r--lang/rust/patches/patch-src_bootstrap_builder.rs14
-rw-r--r--lang/rust/patches/patch-src_tools_cargo_src_cargo_core_profiles.rs6
-rw-r--r--lang/rust/patches/patch-src_tools_cargo_tests_testsuite_build.rs6
-rw-r--r--lang/rust/patches/patch-src_tools_rust-installer_install-template.sh36
-rw-r--r--lang/rust/patches/patch-src_tools_rust-installer_src_generator.rs26
9 files changed, 132 insertions, 42 deletions
diff --git a/lang/rust/Makefile b/lang/rust/Makefile
index 7ce0111bdb6..c3b6aca46d2 100644
--- a/lang/rust/Makefile
+++ b/lang/rust/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.65 2018/11/18 07:03:01 ryoon Exp $
+# $NetBSD: Makefile,v 1.66 2018/11/27 15:45:23 adam Exp $
DISTNAME= rustc-1.30.1-src
PKGNAME= ${DISTNAME:S/rustc/rust/:S/-src//}
@@ -18,6 +18,8 @@ USE_TOOLS+= bash ggrep gmake perl:build pkg-config
BUILD_DEPENDS+= cmake-[0-9]*:../../devel/cmake
HAS_CONFIGURE= yes
+CONFIG_SHELL= ${PYTHONBIN}
+CONFIGURE_SCRIPT= src/bootstrap/configure.py
CONFIGURE_ARGS+= --prefix=${PREFIX}
CONFIGURE_ARGS+= --mandir=${PREFIX}/${PKGMANDIR}
CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
@@ -31,6 +33,10 @@ CONFIGURE_ARGS+= --disable-codegen-tests
CONFIGURE_ARGS+= --disable-dist-src
CONFIGURE_ARGS+= --disable-llvm-static-stdcpp
CONFIGURE_ARGS+= --disable-ninja
+# XXX: to be enabled in the future
+#CONFIGURE_ARGS+= --jemalloc-root=${BUILDLINK_PREFIX.jemalloc}/lib
+#CONFIGURE_ARGS+= --enable-llvm-link-shared
+#CONFIGURE_ARGS+= --llvm-root=${BUILDLINK_PREFIX.llvm}
CONFIGURE_ARGS.SunOS+= --disable-jemalloc
# The gcc-wrap / c++-wrap script takes CROSS_ROOT environment variable
@@ -51,9 +57,9 @@ MAKE_ENV+= GNU_CROSS_TARGET=${GNU_CROSS_TARGET}
# the ultimate target to built for, as well as the
# host the compiler is supposed to run on.
# Rust's target designation
-#TARGET= armv7-unknown-netbsd-eabihf
-#TARGET= sparc64-unknown-netbsd
-#TARGET= powerpc-unknown-netbsd
+#TARGET= armv7-unknown-netbsd-eabihf
+#TARGET= sparc64-unknown-netbsd
+#TARGET= powerpc-unknown-netbsd
#SCRIPTS= ${WRKDIR}/scripts
#CONFIGURE_ARGS+= --host=${TARGET}
#CONFIGURE_ARGS+= --target=${TARGET}
@@ -65,7 +71,7 @@ MAKE_ENV+= GNU_CROSS_TARGET=${GNU_CROSS_TARGET}
# May be required when cross-building on NetBSD
#MAKE_ENV+= OPENSSL_DIR=/usr
-# Getting RPATH with $ORIGIN into bootstrap may be troublesome, so
+# Getting RPATH with $ORIGIN into bootstrap may be troublesome, so
# uncommenting the LD_LIBRARY_PATH setting may be required to run
# the bootstrap
MAKE_ENV+= LD_LIBRARY_PATH=${WRKDIR}/rust-bootstrap/lib
@@ -250,6 +256,9 @@ RUST_BOOTSTRAP_PATH?= ${WRKDIR}/rust-bootstrap
BUILD_DEPENDS+= coreutils>=0:../../sysutils/coreutils
TOOLS_CREATE+= md5sum
TOOLS_PATH.md5sum= ${PREFIX}/bin/gmd5sum
+.else
+LD_LIBRARY_PATH= ${RUST_BOOTSTRAP_PATH}/lib
+PKGSRC_MAKE_ENV+= LD_LIBRARY_PATH=${LD_LIBRARY_PATH:Q}
.endif
SUBST_CLASSES+= rpath
@@ -291,11 +300,6 @@ post-extract:
${LN} -s gcc-wrap clang-wrap
.endif
-.if ${OPSYS} != "SunOS"
-LD_LIBRARY_PATH= ${RUST_BOOTSTRAP_PATH}/lib
-PKGSRC_MAKE_ENV+= LD_LIBRARY_PATH=${LD_LIBRARY_PATH:Q}
-.endif
-
.if ${OPSYS} == "FreeBSD"
MAKE_ENV+= OPENSSL_DIR=${SSLBASE}
.endif
@@ -307,23 +311,20 @@ pre-build: pre-build-fix
do-build:
cd ${WRKSRC} \
- && env ${MAKE_ENV} \
- ${PYTHONBIN} ./x.py -v dist -j ${MAKE_JOBS:U1}
+ && ${SETENV} ${MAKE_ENV} \
+ ${PYTHONBIN} ./x.py -v build -j ${MAKE_JOBS:U1}
do-install:
cd ${WRKSRC} \
- && env ${MAKE_ENV} ${INSTALL_ENV} \
- ${PYTHONBIN} ./x.py -v install
+ && ${SETENV} ${MAKE_ENV} ${INSTALL_ENV} \
+ ${PYTHONBIN} ./x.py -v install -j ${MAKE_JOBS:U1}
-post-install:
- ${RM} -f ${DESTDIR}${PREFIX}/lib/rustlib/install.log
- ${RM} -f ${DESTDIR}${PREFIX}/lib/rustlib/uninstall.sh
- ${RM} -rf ${DESTDIR}${PREFIX}/lib/rustlib/src
-
-GENERATE_PLIST+= find ${DESTDIR}${PREFIX} \( -type f -o -type l \) -print | \
- sed 's,${DESTDIR}${PREFIX}/,,' | ${SORT} ;
+GENERATE_PLIST+=find ${DESTDIR}${PREFIX} \( -type f -o -type l \) -print | \
+ sed 's,${DESTDIR}${PREFIX}/,,' | ${SORT} ;
.if ${OPSYS} == "Darwin"
+LDFLAGS+= -headerpad_max_install_names
+
.PHONY: fix-darwin-install-name
post-install: fix-darwin-install-name
fix-darwin-install-name:
@@ -387,9 +388,9 @@ stage0-bootstrap: install
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}"; \
+ ${ECHO} "Fixed stage0 bootstrap in ${BOOTSTRAP_TMPDIR}:"; \
+ ${ECHO} "$${RUSTC_FILE}"; \
+ ${ECHO} "$${RUST_STD_FILE}"; \
)
.endif
.if ${OS_VARIANT} == "SmartOS"
@@ -423,8 +424,10 @@ stage0-bootstrap: install
.endif
.include "../../devel/cmake/buildlink3.mk"
+#.include "../../devel/jemalloc/buildlink3.mk"
#.include "../../devel/libgit2/buildlink3.mk"
.include "../../devel/zlib/buildlink3.mk"
+#.include "../../lang/llvm/buildlink3.mk"
.include "../../lang/python/tool.mk"
#.include "../../security/libssh2/buildlink3.mk"
.include "../../security/openssl/buildlink3.mk"
diff --git a/lang/rust/cargo.mk b/lang/rust/cargo.mk
index 2e76b020180..8dcf101a04d 100644
--- a/lang/rust/cargo.mk
+++ b/lang/rust/cargo.mk
@@ -1,4 +1,4 @@
-# $NetBSD: cargo.mk,v 1.5 2018/11/27 14:02:11 maya Exp $
+# $NetBSD: cargo.mk,v 1.6 2018/11/27 15:45:23 adam Exp $
#
# Common logic that can be used by packages that depend on cargo crates
# from crates.io. This lets existing pkgsrc infrastructure fetch and verify
@@ -28,7 +28,7 @@ CARGO_VENDOR_DIR= ${WRKDIR}/vendor
DISTFILES?= ${DEFAULT_DISTFILES}
.for _crate in ${CARGO_CRATE_DEPENDS}
DISTFILES+= ${_crate}.crate
-SITES.${_crate}.crate+= -${MASTER_SITE_CRATESIO}${_crate:C/-[0-9.]+$//}/${_crate:C/^.*-([0-9.]+)$/\1/}/download
+SITES.${_crate}.crate+= -${MASTER_SITE_CRATESIO}${_crate:C/-[0-9.]+$//}/${_crate:C/^.*-([0-9.]+)$/\1/}/download
EXTRACT_DIR.${_crate}.crate?= ${CARGO_VENDOR_DIR}
.endfor
diff --git a/lang/rust/distinfo b/lang/rust/distinfo
index dd8ea4e8a16..d5f856b1d9e 100644
--- a/lang/rust/distinfo
+++ b/lang/rust/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.46 2018/11/18 07:03:01 ryoon Exp $
+$NetBSD: distinfo,v 1.47 2018/11/27 15:45:23 adam Exp $
SHA1 (rust-1.29.1-i686-unknown-netbsd.tar.gz) = f4f8cbd0a2581546680328765bf5d7d351cf0643
RMD160 (rust-1.29.1-i686-unknown-netbsd.tar.gz) = a590d8dfed10220e8013796cd66c5c9eed51bf37
@@ -97,7 +97,8 @@ RMD160 (rustc-1.30.1-src.tar.gz) = 9b8bda1fb32573e9b4160393d2031ff5e06df2f7
SHA512 (rustc-1.30.1-src.tar.gz) = 8eb09bec937f705acd31d05aaa4ef03cabc43b8d9104462436c3155581d7efc753928fd1076f8831eab2cd718284f2ee928bdde06ab47c2ac37de254cea0f099
Size (rustc-1.30.1-src.tar.gz) = 149474922 bytes
SHA1 (patch-src_bootstrap_bin_rustc.rs) = 0abf893090a6053e01fd658096d9a2b5b8c144da
-SHA1 (patch-src_bootstrap_bootstrap.py) = 96ef9368eaa5e10e607ff031d50ed05f3a915775
+SHA1 (patch-src_bootstrap_bootstrap.py) = 5b886b95857bf019c2e37cb380e6905cb444b756
+SHA1 (patch-src_bootstrap_builder.rs) = e02356401417f8e8296a5fe27c68072f698f0190
SHA1 (patch-src_bootstrap_lib.rs) = d86e173b931099730a4f18d044d7977c89f87b91
SHA1 (patch-src_libbacktrace_configure) = b2c1e9b93a99408aad42ab9f1af27704cc81bdd8
SHA1 (patch-src_liblibc_src_unix_bsd_netbsdlike_netbsd_mod.rs) = e5b564bb247094cc8e4e6935a02262b3385cb7e6
@@ -109,6 +110,8 @@ SHA1 (patch-src_llvm_CMakeLists.txt) = ffdf4337fdc84d8314c97c4e492e6b84244a99d1
SHA1 (patch-src_llvm_cmake_modules_AddLLVM.cmake) = f0620ac62ecfb1d62d2dfa61b4c063d21c29b8f5
SHA1 (patch-src_llvm_include_llvm-c_DataTypes.h) = 432693204912e79059ee31e815ad1e24f3236374
SHA1 (patch-src_llvm_include_llvm_Analysis_ConstantFolding.h) = 861089ea7ec8985b9b9fce53ffadfa3e9eed4a72
-SHA1 (patch-src_tools_cargo_src_cargo_core_profiles.rs) = 17e19ccaf29e5d2e6a42c5e59837169ebbc7c58e
-SHA1 (patch-src_tools_cargo_tests_testsuite_build.rs) = 10c0f9cc2f2c4fdc651fc123ef5d84cadf93feb5
+SHA1 (patch-src_tools_cargo_src_cargo_core_profiles.rs) = 379f60b809d5af3569541828c7e485da805ad9cc
+SHA1 (patch-src_tools_cargo_tests_testsuite_build.rs) = 76e77c2c49baf8c951ed8d2293e98e3ede0f8538
+SHA1 (patch-src_tools_rust-installer_install-template.sh) = f2ec6dced2be1fa23773d5827503ad07d0913dc2
+SHA1 (patch-src_tools_rust-installer_src_generator.rs) = 45fb4762ef7ddaa7b7071897921d26522277cfc1
SHA1 (patch-src_vendor_rand_src_rngs_os.rs) = 318c9e0ed77f83bb34f5512638545ff16844e8fd
diff --git a/lang/rust/patches/patch-src_bootstrap_bootstrap.py b/lang/rust/patches/patch-src_bootstrap_bootstrap.py
index d811817171a..c8184c5b436 100644
--- a/lang/rust/patches/patch-src_bootstrap_bootstrap.py
+++ b/lang/rust/patches/patch-src_bootstrap_bootstrap.py
@@ -1,11 +1,10 @@
-$NetBSD: patch-src_bootstrap_bootstrap.py,v 1.2 2018/10/29 22:24:11 he Exp $
+$NetBSD: patch-src_bootstrap_bootstrap.py,v 1.3 2018/11/27 15:45:23 adam Exp $
-Use `uname -p` on NetBSD, as that's reliable & sensible there.
-Also force debuginfo to 0, otherwise the build doesn't work on
-NetBSD/macppc (powerpc).
-Also, handle earmv7hf for NetBSD.
+Use `uname -p` on NetBSD, as that is reliable and sensible there.
+Do not use debuginfo; optimize 'bootstrap' instead.
+Handle earmv7hf for NetBSD.
---- src/bootstrap/bootstrap.py.orig 2018-09-20 17:28:03.000000000 +0000
+--- src/bootstrap/bootstrap.py.orig 2018-11-07 03:22:38.000000000 +0000
+++ src/bootstrap/bootstrap.py
@@ -196,6 +196,11 @@ def default_build_triple():
'OpenBSD': 'unknown-openbsd'
@@ -33,3 +32,12 @@ Also, handle earmv7hf for NetBSD.
else:
ostype += 'eabihf'
elif cputype == 'mips':
+@@ -622,7 +629,7 @@ class RustBuild(object):
+ env["LIBRARY_PATH"] = os.path.join(self.bin_root(), "lib") + \
+ (os.pathsep + env["LIBRARY_PATH"]) \
+ if "LIBRARY_PATH" in env else ""
+- env["RUSTFLAGS"] = "-Cdebuginfo=2 "
++ env["RUSTFLAGS"] = "-Copt-level=2 "
+
+ build_section = "target.{}".format(self.build_triple())
+ target_features = []
diff --git a/lang/rust/patches/patch-src_bootstrap_builder.rs b/lang/rust/patches/patch-src_bootstrap_builder.rs
new file mode 100644
index 00000000000..9749c233d79
--- /dev/null
+++ b/lang/rust/patches/patch-src_bootstrap_builder.rs
@@ -0,0 +1,14 @@
+$NetBSD: patch-src_bootstrap_builder.rs,v 1.1 2018/11/27 15:45:23 adam Exp $
+
+Do not install 'src'.
+
+--- src/bootstrap/builder.rs.orig 2018-11-25 15:56:35.000000000 +0000
++++ src/bootstrap/builder.rs
+@@ -473,7 +473,6 @@ impl<'a> Builder<'a> {
+ install::Rustfmt,
+ install::Clippy,
+ install::Analysis,
+- install::Src,
+ install::Rustc
+ ),
+ }
diff --git a/lang/rust/patches/patch-src_tools_cargo_src_cargo_core_profiles.rs b/lang/rust/patches/patch-src_tools_cargo_src_cargo_core_profiles.rs
index 897eb556b1f..729e962cd9c 100644
--- a/lang/rust/patches/patch-src_tools_cargo_src_cargo_core_profiles.rs
+++ b/lang/rust/patches/patch-src_tools_cargo_src_cargo_core_profiles.rs
@@ -1,10 +1,10 @@
-$NetBSD: patch-src_tools_cargo_src_cargo_core_profiles.rs,v 1.1 2018/10/29 22:24:11 he Exp $
+$NetBSD: patch-src_tools_cargo_src_cargo_core_profiles.rs,v 1.2 2018/11/27 15:45:23 adam Exp $
Turn off incremental builds for sparc64, ref.
https://sources.debian.org/patches/cargo/0.29.0-1/2007_sparc64_disable_incremental_build.patch/
---- ./src/tools/cargo/src/cargo/core/profiles.rs.orig 2018-10-24 20:01:28.000000000 +0000
-+++ ./src/tools/cargo/src/cargo/core/profiles.rs
+--- src/tools/cargo/src/cargo/core/profiles.rs.orig 2018-10-24 20:01:28.000000000 +0000
++++ src/tools/cargo/src/cargo/core/profiles.rs
@@ -458,6 +458,9 @@ impl Profile {
debuginfo: Some(2),
debug_assertions: true,
diff --git a/lang/rust/patches/patch-src_tools_cargo_tests_testsuite_build.rs b/lang/rust/patches/patch-src_tools_cargo_tests_testsuite_build.rs
index 3c2bc795ce3..7db887b192c 100644
--- a/lang/rust/patches/patch-src_tools_cargo_tests_testsuite_build.rs
+++ b/lang/rust/patches/patch-src_tools_cargo_tests_testsuite_build.rs
@@ -1,10 +1,10 @@
-$NetBSD: patch-src_tools_cargo_tests_testsuite_build.rs,v 1.1 2018/10/29 22:24:11 he Exp $
+$NetBSD: patch-src_tools_cargo_tests_testsuite_build.rs,v 1.2 2018/11/27 15:45:23 adam Exp $
Don't attempt incremental operations on sparc64, ref.
https://sources.debian.org/patches/cargo/0.29.0-1/2007_sparc64_disable_incremental_build.patch/
---- ./src/tools/cargo/tests/testsuite/build.rs.orig 2018-10-24 20:01:28.000000000 +0000
-+++ ./src/tools/cargo/tests/testsuite/build.rs
+--- src/tools/cargo/tests/testsuite/build.rs.orig 2018-10-24 20:01:28.000000000 +0000
++++ src/tools/cargo/tests/testsuite/build.rs
@@ -38,6 +38,7 @@ fn cargo_fail_with_no_stderr() {
/// Check that the `CARGO_INCREMENTAL` environment variable results in
diff --git a/lang/rust/patches/patch-src_tools_rust-installer_install-template.sh b/lang/rust/patches/patch-src_tools_rust-installer_install-template.sh
new file mode 100644
index 00000000000..adae00e9128
--- /dev/null
+++ b/lang/rust/patches/patch-src_tools_rust-installer_install-template.sh
@@ -0,0 +1,36 @@
+$NetBSD: patch-src_tools_rust-installer_install-template.sh,v 1.3 2018/11/27 15:45:23 adam Exp $
+
+No logging to 'install.log'.
+Do not create 'uninstall.sh'.
+
+--- src/tools/rust-installer/install-template.sh.orig 2018-11-07 03:23:50.000000000 +0000
++++ src/tools/rust-installer/install-template.sh
+@@ -15,20 +15,12 @@ set -u
+ init_logging() {
+ local _abs_libdir="$1"
+ local _logfile="$_abs_libdir/$TEMPLATE_REL_MANIFEST_DIR/install.log"
+- rm -f "$_logfile"
+- need_ok "failed to remove old installation log"
+- touch "$_logfile"
+- need_ok "failed to create installation log"
+ LOGFILE="$_logfile"
+ }
+
+ log_line() {
+ local _line="$1"
+
+- if [ -n "${LOGFILE-}" -a -e "${LOGFILE-}" ]; then
+- echo "$_line" >> "$LOGFILE"
+- # Ignore errors, which may happen e.g. after the manifest dir is deleted
+- fi
+ }
+
+ msg() {
+@@ -972,7 +964,6 @@ write_to_file "$TEMPLATE_RUST_INSTALLER_
+ critical_need_ok "failed to write installer version"
+
+ # Install the uninstaller
+-install_uninstaller "$src_dir" "$src_basename" "$abs_libdir"
+
+ # Install each component
+ install_components "$src_dir" "$abs_libdir" "$dest_prefix" "$components"
diff --git a/lang/rust/patches/patch-src_tools_rust-installer_src_generator.rs b/lang/rust/patches/patch-src_tools_rust-installer_src_generator.rs
new file mode 100644
index 00000000000..8a704b5c89a
--- /dev/null
+++ b/lang/rust/patches/patch-src_tools_rust-installer_src_generator.rs
@@ -0,0 +1,26 @@
+$NetBSD: patch-src_tools_rust-installer_src_generator.rs,v 1.1 2018/11/27 15:45:23 adam Exp $
+
+Do not create tarballs; not needed for PkgSrc installation.
+
+--- src/tools/rust-installer/src/generator.rs.orig 2018-11-26 21:41:04.000000000 +0000
++++ src/tools/rust-installer/src/generator.rs
+@@ -13,7 +13,6 @@ use std::path::Path;
+
+ use errors::*;
+ use super::Scripter;
+-use super::Tarballer;
+ use util::*;
+
+ actor!{
+@@ -97,11 +96,6 @@ impl Generator {
+ // Make the tarballs
+ create_dir_all(&self.output_dir)?;
+ let output = Path::new(&self.output_dir).join(&self.package_name);
+- let mut tarballer = Tarballer::default();
+- tarballer.work_dir(self.work_dir)
+- .input(self.package_name)
+- .output(path_to_str(&output)?);
+- tarballer.run()?;
+
+ Ok(())
+ }