pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/lang/rust rust: speed-up building; clean-ups



details:   https://anonhg.NetBSD.org/pkgsrc/rev/606a8d1e1d86
branches:  trunk
changeset: 315596:606a8d1e1d86
user:      adam <adam%pkgsrc.org@localhost>
date:      Tue Nov 27 15:45:23 2018 +0000

description:
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:

 lang/rust/Makefile                                                   |  51 +++++----
 lang/rust/cargo.mk                                                   |   4 +-
 lang/rust/distinfo                                                   |  11 +-
 lang/rust/patches/patch-src_bootstrap_bootstrap.py                   |  20 ++-
 lang/rust/patches/patch-src_bootstrap_builder.rs                     |  14 ++
 lang/rust/patches/patch-src_tools_cargo_src_cargo_core_profiles.rs   |   6 +-
 lang/rust/patches/patch-src_tools_cargo_tests_testsuite_build.rs     |   6 +-
 lang/rust/patches/patch-src_tools_rust-installer_install-template.sh |  36 +++++++
 lang/rust/patches/patch-src_tools_rust-installer_src_generator.rs    |  26 +++++
 9 files changed, 132 insertions(+), 42 deletions(-)

diffs (truncated from 332 to 300 lines):

diff -r bb6e856c4b20 -r 606a8d1e1d86 lang/rust/Makefile
--- a/lang/rust/Makefile        Tue Nov 27 15:37:45 2018 +0000
+++ b/lang/rust/Makefile        Tue Nov 27 15:45:23 2018 +0000
@@ -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 @@
 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-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 @@
 # 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 @@
 # 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 @@
 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 @@
        ${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 @@
 
 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 @@
        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 @@
 .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 -r bb6e856c4b20 -r 606a8d1e1d86 lang/rust/cargo.mk
--- a/lang/rust/cargo.mk        Tue Nov 27 15:37:45 2018 +0000
+++ b/lang/rust/cargo.mk        Tue Nov 27 15:45:23 2018 +0000
@@ -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 @@
 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 -r bb6e856c4b20 -r 606a8d1e1d86 lang/rust/distinfo
--- a/lang/rust/distinfo        Tue Nov 27 15:37:45 2018 +0000
+++ b/lang/rust/distinfo        Tue Nov 27 15:45:23 2018 +0000
@@ -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 @@
 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_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 -r bb6e856c4b20 -r 606a8d1e1d86 lang/rust/patches/patch-src_bootstrap_bootstrap.py
--- a/lang/rust/patches/patch-src_bootstrap_bootstrap.py        Tue Nov 27 15:37:45 2018 +0000
+++ b/lang/rust/patches/patch-src_bootstrap_bootstrap.py        Tue Nov 27 15:45:23 2018 +0000
@@ -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 @@
          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 -r bb6e856c4b20 -r 606a8d1e1d86 lang/rust/patches/patch-src_bootstrap_builder.rs
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/rust/patches/patch-src_bootstrap_builder.rs  Tue Nov 27 15:45:23 2018 +0000
@@ -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 -r bb6e856c4b20 -r 606a8d1e1d86 lang/rust/patches/patch-src_tools_cargo_src_cargo_core_profiles.rs
--- a/lang/rust/patches/patch-src_tools_cargo_src_cargo_core_profiles.rs        Tue Nov 27 15:37:45 2018 +0000
+++ b/lang/rust/patches/patch-src_tools_cargo_src_cargo_core_profiles.rs        Tue Nov 27 15:45:23 2018 +0000
@@ -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 -r bb6e856c4b20 -r 606a8d1e1d86 lang/rust/patches/patch-src_tools_cargo_tests_testsuite_build.rs
--- a/lang/rust/patches/patch-src_tools_cargo_tests_testsuite_build.rs  Tue Nov 27 15:37:45 2018 +0000
+++ b/lang/rust/patches/patch-src_tools_cargo_tests_testsuite_build.rs  Tue Nov 27 15:45:23 2018 +0000
@@ -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 -r bb6e856c4b20 -r 606a8d1e1d86 lang/rust/patches/patch-src_tools_rust-installer_install-template.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/rust/patches/patch-src_tools_rust-installer_install-template.sh      Tue Nov 27 15:45:23 2018 +0000
@@ -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"
+ 



Home | Main Index | Thread Index | Old Index