On 01/24/2019 07:29 PM, Ken Moffat wrote:
On Fri, Jan 25, 2019 at 12:21:25AM -0000, BLFS Trac wrote:
#11521: Upgrade rustc for firefox-65.0
-------------------------+-----------------------
  Reporter:  ken@…        |       Owner:  ken@…
      Type:  enhancement  |      Status:  assigned
  Priority:  normal       |   Milestone:  8.4
Component:  BOOK         |     Version:  SVN
  Severity:  normal       |  Resolution:
  Keywords:               |
-------------------------+-----------------------

Comment (by bdubbs):

  Just a progress report.   I tried to change the value of prefix in
  config.toml to /opt/rust or /opt/rustc-1.32.0, but it won't work.  I've
  developed a workaround.


Interesting.  I expect I'll find out the gory details soon enough -
still in the process of adapting my scripts, then I'll boot my
haswell in 8.3 and try updating to 1.32.0, brief test, then 1.31.1
and switch the symlink.

  After DESTDIR=${PWD}/install ./x.py install:

  {{{
  mkdir -p install/opt/rustc-1.32.0
  mv install/usr/* install/opt/rustc-1.32.0
  rmdir install/usr
  }}}

  and then continue with

  {{{
  chown -R root:root install
  cp -a install/* /
  }}}

  And finish with

  ln -sfnv rustc-1.32.0 /opt/rustc
  --------

  For ld.so.conf, add '/opt/rustc/lib' and run ldconfig.

  Add a boot script that does 'pathprepend /opt/rustc/bin'


Why a boot script ?  My theory is that only cbindgen, gdb (for the
testsuite), firefox, librsvg, thunderbird need to know about it.

So I'm thinking of the SAVEPATH approach like in LVM2, but put
/opt/rustc/bin at the front.

And I'm particularly interested in the possibility of reverting to
an older version.

The boot script makes the change more general and means that builds for firefox, thunderbird, librsvg, etc will not require changes.

Attaching my script for now.

  -- Bruce
#!/bin/bash

source /usr/src/stats

#######################

DIR=`pwd`
VER=1.32.0
PROGRAM=rustc-$VER-src
LOG=$DIR/$PROGRAM-test.log
TITLE=$PROGRAM
TIMEFORMAT="$TIMEFMT $TITLE"

BUILDDIR=/mnt/tmp/rustc

rm -f  $LOG
sudo rm -rf $BUILDDIR
mkdir  $BUILDDIR
cd     $BUILDDIR

before=`df -k /mnt/tmp | grep / | sed -e "s/ \{2,\}/ /g" | cut -d' ' -f3`

tar -xf $DIR/$PROGRAM.tar.?z* || exit 1

cd $PROGRAM
{ time \
  {
    echo Making $TITLE
    date

    # Remove current version and symlink if they exist
    sudo rm -rf /opt/rustc /opt/rustc-$VER

    cat << EOF > config.toml
# see src/bootstrap/config.toml.example for more possible options
[llvm]

# use ninja
ninja = true

targets = "X86"
# When compiling LLVM, the experimental targets (WebAssembly
# and RISCV) are built by default - omit them
experimental-targets = ""

[build]
# omit HTML docs to save time and space (comment this to build them)
docs = false

# install cargo as well as rust
extended = true

[install]
prefix = "/usr"
docdir = "share/doc/rustc-$VER"

[rust]
channel = "stable"
rpath = false

# BLFS does not install the FileCheck executable from llvm,
# so disable codegen tests
codegen-tests = false

# get a trace if there is an Internal Compiler Exception
backtrace-on-ice = true

EOF

    export RUSTFLAGS="$RUSTFLAGS -C link-args=-lffi" &&

    #python3 ./x.py build  --jobs=4 &&
    ./x.py build --jobs 4 --exclude src/tools/miri &&

    #echo "BLFS Start CHECK"  &&
    #date > $DIR/rustc-$VER-testlog &&
    #(./x.py test --verbose --no-fail-fast 2>&1 >> $DIR/rustc-$VER-testlog || 
true ) &&
    #date >> $DIR/rustc-$VER-testlog &&

    echo "BLFS Start INSTALL"  &&
    export LIBSSH2_SYS_USE_PKG_CONFIG=1 &&

    DESTDIR=${PWD}/install ./x.py install &&

    # Not needed in script
    #unset LIBSSH2_SYS_USE_PKG_CONFIG

    mkdir -p install/opt/rustc-$VER         &&
    mv install/usr/* install/opt/rustc-$VER &&
    rmdir install/usr                       &&

    $SUDO chown -R root:root install &&
    $SUDO cp -a install/* /          &&

    # Create a symlink.
    $SUDO ln -sfnv rustc-$VER /opt/rustc   &&
    :
  }
} 2>&1 | tee -a $LOG

if [ $PIPESTATUS -ne 0 ]; then exit 1; fi;

stats $LOG $DIR/$PROGRAM.tar.?z* $before /mnt/tmp


du -sm $BUILDDIR

exit 0


thread 'main' panicked at 'could not canonicalize /opt/rustc', 
src/bootstrap/install.rs:78:48
note: Run with `RUST_BACKTRACE=1` for a backtrace.
failed to run: /mnt/tmp/rustc/rustc-1.32.0-src/build/bootstrap/debug/bootstrap 
install


#!/bin/bash

function stats()
{
  log=$1
  tarball=$2
  b4=$3
  builddir=$4

  # New fast time 20170519 -- change cpu scaling to 'performance'
  # Time as of 20180127 -- 95  -- binutils 2.30.0
  # Time as of 20180813 -- 94  -- binutils 2.31.1
  base_sbu=94

  # For laptop 20180112
  [ $(hostname) == 'laptop-181216' ] && base_sbu=119
  [ $(hostname) == 'toshiba-lfs'   ] && base_sbu=119
  [ $(hostname) == 'frodo82'       ] && base_sbu=95

  # For systemd in qemu
  #base_sbu=95

  dir=${builddir:-/tmp}

  free_now=`df -k $dir | grep / | sed -e "s/ \{2,\}/ /g" | cut -d" " -f3`

  buildtime=`tail -n1 $log|cut -f1 -d" "`
  sbu=`echo "scale=3; $buildtime / $base_sbu" | bc`

  psizeK=`du -k $tarball | cut -f1`
  psizeM=`echo "scale=3; $psizeK / 1024"   | bc`

  bsizeK=`echo "$free_now - $b4"           | bc`
  bsizeM=`echo "scale=3; $bsizeK / 1024"   | bc`

  echo "SBU=$sbu"                                  | tee -a $log
  echo "$psizeK $tarball SIZE ($psizeM MB)"        | tee -a $log
  echo "$bsizeK kilobytes BUILD SIZE ($bsizeM MB)" | tee -a $log
  (echo -n "md5sum : "; md5sum $tarball)           | tee -a $log
  #(echo -n "sha1sum: "; sha1sum $tarball)          | tee -a $log

  hostname=$(cat /etc/hostname) # For chroot

  echo "`date` $tarball" >> /usr/src/packages-$(lsb_release -r|cut 
-f2)-$hostname.log
}

TIMEFMT='%1R Elapsed Time - '
if [ $UID -ne 0 ]; then SUDO='sudo -E'; fi
-- 
http://lists.linuxfromscratch.org/listinfo/blfs-book
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to