git » rubygems.git » main » tree

[main] / PKGBUILD

# Maintainer: Anatol Pomozov <anatol.pomozov@gmail.com>
# Maintainer: Andreas 'Segaja' Schleifer <segaja at archlinux dot org>

pkgname=rubygems
pkgver=3.4.19
pkgrel=1
pkgdesc='Package management framework for Ruby'
arch=('any')
url='https://rubygems.org/'
license=('MIT')
depends=(
  ruby
)
#checkdepends=(
#  cmake
#  git
#  ruby-rake
#  ruby-test-unit
#  ruby-webrick
#)

provides=(
  ruby-rubygems
)
options=('!emptydirs')
source=(
  "https://github.com/rubygems/rubygems/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz"
  operating_system.rb)
sha512sums=('8d0bc225ef01d3cc5e3ad12a1bf0bbb3923349bb9b79b76a9ac58bb8dcf79666a478a871d19919adc15f1aa2599efde5d3938c61801579277117b569e7007656'
            '9d74b5528fc87c78316abdd5423a15a8859aec0cd230b20906c53e7e05d8ba8a156af42dc0f6cff270f0c75196079e622c45cc9f0b2f512fc5311fd54e37ab11')
b2sums=('adf618f326fa83a8eb7febb9872a71f2bf78048dfa7c4db07343c9813ba5d858c86bcd6e54df1a559e60e458ba8d73d2a7ac82ee5e0cbde6e9d8b45c12793d4c'
        '714ce47535ede25cad914002c45c908de7d4ff6eae5b25daf9ab1d3a75e09fffe6e17bc73422f9ba2fe16ae5e120352c536d2ab6152a36431a7f35e9c5466b47')

prepare() {
  cd "rubygems-${pkgver}"

  sed --in-place --regexp-extended 's|git ls-files|find -type f -not -path "*/\.git/*"|' Rakefile
  su -c "pacman -S --noconfirm ruby-rdoc --overwrite='*'"
}

#check() {
#  cd "rubygems-${pkgver}"
#  GEM_HOME="$(pwd)/.gem"
#  mkdir --parents --verbose "${GEM_HOME}"
#  rake update_manifest test
#}

package() {
  cd "rubygems-${pkgver}"

  local _gemdir="$(ruby -e 'puts Gem.dir')"
  local _extension_api_version="$(ruby -e 'puts Gem.extension_api_version')"

  export GEM_HOME="${pkgdir}${_gemdir}"

  install --verbose -d --mode=0755 \
      "${GEM_HOME}" \
      "${pkgdir}/usr/lib/ruby/${_extension_api_version}"

  # define the current version as previous version to avoid printing the changelog
  ruby setup.rb \
    --destdir="${pkgdir}" \
    --prefix="/usr" \
    --previous-version="${pkgver}" \
    --verbose # || true

  # fix package structure
  mv --verbose "${pkgdir}/usr/lib/${pkgname}.rb" "${pkgdir}/usr/lib/ruby/${_extension_api_version}"
  mv --verbose "${pkgdir}/usr/lib/${pkgname}" "${pkgdir}/usr/lib/ruby/${_extension_api_version}"

  # cleanup - remove any bundler references as they are provided by https://archlinux.org/packages/community/any/ruby-bundler/
  rm --force --verbose --recursive \
    "${pkgdir}/usr/bin/"{bundle*,rake,rake-compiler,rspec,rdbg,rbs,typeprof} \
    "${pkgdir}/usr/gems" \
    "${pkgdir}/usr/lib/bundler.rb" \
    "${pkgdir}/usr/lib/bundler" \
    "${pkgdir}/usr/specifications"

  install --verbose -D --mode=0644 ../operating_system.rb --target-directory "${pkgdir}/usr/lib/ruby/vendor_ruby/rubygems/defaults"
  install --verbose -D --mode=0644 LICENSE.txt MIT.txt --target-directory "${pkgdir}/usr/share/licenses/${pkgname}"
  install --verbose -D --mode=0644 *.md --target-directory "${pkgdir}/usr/share/doc/${pkgname}"
}

# vim: tabstop=2 shiftwidth=2 expandtab: