# rustc/cfg - "Build" settings for package #--------------------------------------------------------------------- [technotes] 1. To build "rustc", foreign executables that were downloaded pre- viously may be needed. Whether or not the "rustc" package is already present, the build needs to done with Internet access enabled, regardless. Better still, the build isn't guaranteed to produce consistent results or to work at all. This is one of relatively few packages supported by Laclin that has these issues. In general, Laclin seeks to avoid packages that require foreign execu- tables and/or online builds, though there are exceptions. "rustc" was added because it might be needed in the future to build Linux ker- nels. #--------------------------------------------------------------------- 2. "rustc" is presently hidden, to some extent, from the rest of the distro. If a package needs "rustc" to build, the associated "cfg" file should include "rustc" in a "setpaths" line. For example: setpaths = rustc zlib Alternatively, "bash" scripts that need "rustc" for arbitrary opera- tions, not limited to Laclin package builds, can do the following to set things up: . srcpkgpaths rustc zlib #--------------------------------------------------------------------- 3. The steps used to obtain the foreign executables were as follows. The two "/somewhere.../" directory paths were modified appropriate- ly. # Assumption: Internet access is enabled. RUSTREL=1.80.0 SRCNAME=rustc-$RUSTREL-src rm -fr $SRCNAME tar Jxf /somewhere1/$SRCNAME.tar.xz cd $SRCNAME sed -e "s@__META_PREFIX__@/tmp/rustc@" \ < /somewhere2/config-bootstrap.toml \ > config.toml . srcpkgpaths zlib export RUSTFLAGS="$RUSTFLAGS -C link-args=-lffi" python3 ./x.py build --exclude src/tools/miri # Press Control-C to abort the build as soon as three ".tar.xz" tar- # balls are downloaded. # The "build/cache/" subdirectory should now contain a subdirectory # with a date name similar to "2023-01-10". "cp -a" the date-name dir- # ectory into the directory "special/cache/" that comes with this # "cfg" file. # The file "config-bootstrap.toml" used here is provided with this # "cfg" file [in an associated subdirectory named "special"]. #--------------------------------------------------------------------- 3. "rustc" updates can be problematic. One issue is that a "rustc" build will only work if a compatible release of "libgit2" is installed and compatibility is unpredictable. If either "libgit2" or "rustc" is updated, a "rustc" build should be attempted. If it fails due to a "libgit2" compatibility issue, the up- date should be canceled. #--------------------------------------------------------------------- 4. It's likely that you'll need to delete the existing copy of the "rustc" package before you can rebuild the package. This is especial- ly true if the existing copy is more than a release or two older than the release that you'll be building. If you leave the existing copy of the package in place, the package will try to use itself to rebuild itself. This approach may be faster than the alternative, which will be a rebuild from scratch based sole- ly on the foreign executables. Either way, it's recommended that the existing copy of the "rustc" package be backed up before you proceed. #--------------------------------------------------------------------- [buildtimes] 01.21 hours (or 072.68 minutes) - 2023 dedi Xeon E3-1200 v3 4x2 32GB RAM 02.03 hours (or 121.62 minutes) - ThinkPad W530 i7 4x2 32GB RAM Obsolete times: 00.89 hours (or 053.42 minutes) - 2021 L.A. dedi box: 6x2 CPU 32GB RAM 00.90 hours (or 054.05 minutes) - 2023 dedi Xeon E3-1200 v3 4x2 32GB RAM 01.62 hours (or 097.50 minutes) - OpenVZ 1x4 CPU 4GB RAM 01.83 hours (or 109.85 minutes) - ThinkPad W530 i7 4x2 32GB RAM #---------------------------------------------------------------------- [settings] altpkg = yes defer = glibc64 configure = none nosyslinks = yes purge = no tmpsize = 9217M setpaths = zlib #--------------------------------------------------------------------- [depends] brotli curl libgit2 libidn2 libpsl librtmp libsasl libssh2 libunistring nghttp2 openldap openssl pcre python zlib zstd #--------------------------------------------------------------------- [build] if [ -d $PRODTREE/rustc ]; then . srcpkgpaths rustc fi RUSTHOME=/var/tmp/rusthome rm -fr $RUSTHOME export HOME=$RUSTHOME export CARGO_HOME=$RUSTHOME/.cargo mkdir -p $RUSTHOME $CARGO_HOME unset RUSTHOME SPCLIB=$PKGDIR_PROD/spclib mkdir -p $SPCLIB export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SPCLIB RUSTREL=1.80.0 # Should match source tarball release mkdir -p build/cache cp -a $PKGDIR_SPECIAL/cache/* build/cache/ sed -e "s@__META_PREFIX__@$PKGDIR_PROD@" \ < $PKGDIR_SPECIAL/config-bootstrap.toml \ > config.toml if [ -f $PKGDIR_PROD/bin/rustc ]; then sed -e 's@^ *# *stage *2 *@@' -i config.toml fi export RUSTFLAGS="$RUSTFLAGS -C link-args=-lffi" python3 ./x.py build library --exclude src/tools/miri export LIBSSH2_SYS_USE_PKG_CONFIG=1 DESTDIR=${PWD}/install python3 ./x.py install unset LIBSSH2_SYS_USE_PKG_CONFIG cd install chown -R 0.0 . settreedate . rm -fr $PKGDIR_PROD mkdir -p $PKGDIR_PROD cp -a */pkg/rustc/* $PKGDIR_PROD/ mkdir -p /opt cd /opt rm -fr rustc ln -s $PKGDIR_PROD rustc rm -fr $SPCLIB mkdir -p $SPCLIB cp -a $PRODTREE/libgit2/lib/* $SPCLIB/ #--------------------------------------------------------------------- # Original URLs. These URLs were valid at one point, but may have died # since then. If you download newer versions of tarballs [etc.], don't # delete the original versions, as you may not be able to replace # them. [urls] url_debian = tbd url_home = tbd url_lfs = tbd url_tarball = https://static.rust-lang.org/dist/\ rustc-1.80.0-src.tar.xz #--------------------------------------------------------------------- [history] 220902 Added package. Started with 1.60.0. 220906 Updated to 1.62.1 230218 Updated to 1.66.1 240331 Updated to 1.76.0 240727 Updated to 1.80.0