Rust nightly の x86_64, i686 両対応版の PKGBUILD

タイトルの通りのブツです。これを参考にして rust-bin-nightly を改造した感じです。 パッケージのビルド時間が短くなって大変ハッピー。

# Maintainer: NAKASHIMA, Makoto <[email protected]>
pkgname=rust-nightly-bin
pkgver=2015.01.25
pkgrel=1
arch=('i686' 'x86_64')
pkgdesc='A safe, concurrent, practical language from Mozilla.'
url='http://www.rust-lang.org/'
provides=('rust' 'cargo')
conflicts=('rust' 'rust-git' 'rust-nightly' 'cargo-nightly-bin')
depends=('shared-mime-info')
license=('MIT' 'Apache')
source=('https://raw.githubusercontent.com/rust-lang/rust/master/src/etc/gedit/share/mime/packages/rust.xml'
        'rust-nightly.conf')
sha256sums=('a2a6609d6a89dd57f1bf874da222316c2b3c8ffcfe5b5ae87f8489096744446d'
            'fc2ed32e9841d2080803b117a773aa6606fc74391fec76fbadd2e952ca1fc256')
install=rust.install
options=(staticlibs !strip)

_target_os=unknown-linux-gnu
_nightly_x86_64="https://static.rust-lang.org/dist/rust-nightly-x86_64-$_target_os.tar.gz"
_nightly_i686="https://static.rust-lang.org/dist/rust-nightly-i686-$_target_os.tar.gz"

pkgver() {
  date --utc -d"$(curl -I $_nightly_x86_64 | sed -n 's/^Last-Modified: *//p')" +"%Y.%m.%d"
}

package() {
  local INSTALL_DIR=/usr/local
  local MAN_DIR=/usr/local/man

  curl -O $_nightly_x86_64
  curl -O $_nightly_i686
  tar xf rust-nightly-x86_64-$_target_os.tar.gz
  tar xf rust-nightly-i686-$_target_os.tar.gz

  cp -r rust-nightly-i686-$_target_os/lib/rustlib/i686-$_target_os \
     rust-nightly-x86_64-$_target_os/lib/rustlib

  cd rust-nightly-x86_64-$_target_os
  find lib/rustlib/i686-$_target_os/lib -type f | sed 's/^/file:/' >> manifest-rustc.in

  # Rust, Cargo and Documentation.
  ./install.sh --prefix=${pkgdir}${INSTALL_DIR} --mandir=${pkgdir}${MAN_DIR}

  # Establish .rs MIME type association.
  mkdir -p "${pkgdir}/usr/share/mime/packages"
  install -m 644 "${srcdir}/rust.xml" "${pkgdir}/usr/share/mime/packages/rust.xml"

  # Dynamic linker configuration (no LD_LIBRARY_PATH required).
  mkdir -p "${pkgdir}/etc/ld.so.conf.d"
  install -m 644 "${srcdir}/rust-nightly.conf" "${pkgdir}/etc/ld.so.conf.d/rust-nightly.conf"

  # Remove manifest file referencing $pkgdir.
  rm -f ${pkgdir}/usr/local/lib/rustlib/{manifest-rustc,manifest-cargo,components,rust-installer-version}
}