PKGBUILDs/extra/ruby/PKGBUILD

378 lines
8.6 KiB
Bash
Raw Normal View History

2022-10-06 01:31:19 +00:00
# Maintainer: Anatol Pomozov <anatol.pomozov@gmail.com>
# Maintainer: Andreas 'Segaja' Schleifer <segaja at archlinux dot org>
# Maintainer: Tim Meusel <tim@bastelfreak.de>
# Contributor: Thomas Dziedzic <gostrc@gmail.com>
# Contributor: Allan McRae <allan@archlinux.org>
# Contributor: John Proctor <jproctor@prium.net>
# Contributor: Jeramy Rutley <jrutley@gmail.com>
2024-08-09 18:25:43 +00:00
# Do not re-package default gems (see https://stdgems.org/). Trying to do that will lead to multiple problems
2022-10-06 01:31:19 +00:00
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
# - generalize arch-dependent removal of gem remains
2024-08-09 18:25:43 +00:00
pkgname=(
ruby
ruby-docs
ruby-default-gems
ruby-bundled-gems
ruby-stdlib
)
pkgver=3.2.4
2023-01-09 19:02:11 +00:00
pkgrel=1
2024-08-09 18:25:43 +00:00
pkgdesc='An object-oriented language for quick and easy programming'
2022-10-06 01:31:19 +00:00
url='https://www.ruby-lang.org/en/'
2024-08-09 18:25:43 +00:00
arch=(x86_64)
license=(BSD-2-Clause)
makedepends=(
doxygen
gcc-libs
gdbm
glibc
gmp
graphviz
libffi
libxcrypt
libyaml
openssl
readline
rust
tk
zlib
)
checkdepends=(
inetutils
procps-ng
)
options=('!emptydirs')
source=(
"https://cache.ruby-lang.org/pub/ruby/${pkgver:0:3}/ruby-${pkgver}.tar.xz"
ruby-3.2-openssl-3.3-fix.patch::https://github.com/ruby/ruby/commit/dd5e625d7bcb7dc849fdbc2ad8053f9c2724efb4.patch
)
sha512sums=('fb0af37be4b6ad7b98ab9f8a508952238ee68b5828e3926331e4db52e2ebc1e6046f31114069322db0cd3bea7c9b82ace91c8564573ddcfa1f960877b237dbff'
'52351374fc9aa9c3576bfb4b62df1d1d8dbe7327270a4d1c5777d247a33d6e6528b08a537fc4c87d9d0cc54b4b9183848f6c54d54fc727871b3e511b7a73ddb7')
b2sums=('9c2300a958b03528d51f0d74a069c8c538ca4009835d55377509a000bcfb43893a8a80d8fda57011e77c72e6283cb259281d5ba7b37444546e49f2a9ad515cf3'
'1ee662e57f9f29b4ab29b391b38b988a8b5c199e62c815353c3a47e6eceea910344c7d9a00512916e05b6404efddf941313dfdcb0bec027f7f668443309228b9')
_bootstrap=0
_rubyver="${pkgver:0:3}.0"
_bundled_gems=(
debug
matrix
minitest
net-ftp
net-imap
net-pop
net-smtp
power_assert
prime
rake
rbs
rexml
rss
test-unit
typeprof
)
_bundled_gems_bins=(
rake
rbs
rdbg
typeprof
)
_default_gems=(
abbrev
base64
benchmark
bigdecimal
cgi
csv
date
delegate
did_you_mean
digest
drb
english
error_highlight
etc
fcntl
fiddle
fileutils
find
forwardable
getoptlong
io-console
io-nonblock
io-wait
ipaddr
json
logger
mutex_m
net-http
net-protocol
nkf
observer
open-uri
open3
openssl
optparse
ostruct
pathname
pp
prettyprint
pstore
psych
readline
readline-ext
reline
resolv
resolv-replace
rinda
ruby2_keywords
securerandom
set
shellwords
singleton
stringio
strscan
syntax_suggest
syslog
tempfile
time
timeout
tmpdir
tsort
un
uri
weakref
yaml
zlib
)
_default_tool_gems=(
bundler
erb
irb
racc
rdoc
rubygems
)
_default_tool_gems_bins=(
bundle
bundler
erb
gem
irb
racc
rdoc
ri
)
2022-11-05 02:39:03 +00:00
prepare() {
2024-08-09 18:25:43 +00:00
cd "ruby-${pkgver}"
# ignore test_session_reuse_but_expire test for openssl version 3.3
sed -i "s/3.2./3.3./g" test/net/http/test_https.rb
patch -Np1 < ../ruby-3.2-openssl-3.3-fix.patch
2022-11-05 02:39:03 +00:00
}
2022-10-06 01:31:19 +00:00
build() {
2024-08-09 18:25:43 +00:00
cd "ruby-${pkgver}"
# this uses malloc_usable_size, which is incompatible with fortification level 3
export CFLAGS="${CFLAGS/_FORTIFY_SOURCE=3/_FORTIFY_SOURCE=2}"
export CXXFLAGS="${CXXFLAGS/_FORTIFY_SOURCE=3/_FORTIFY_SOURCE=2}"
2022-10-06 01:31:19 +00:00
./configure \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--sharedstatedir=/var/lib \
--libexecdir=/usr/lib/ruby \
--enable-shared \
--disable-rpath \
--with-dbm-type=gdbm_compat
make
}
check() {
2024-08-09 18:25:43 +00:00
cd "ruby-${pkgver}"
2022-10-06 01:31:19 +00:00
2024-08-09 18:25:43 +00:00
# this uses malloc_usable_size, which is incompatible with fortification level 3
export CFLAGS="${CFLAGS/_FORTIFY_SOURCE=3/_FORTIFY_SOURCE=2}"
export CXXFLAGS="${CXXFLAGS/_FORTIFY_SOURCE=3/_FORTIFY_SOURCE=2}"
make check
2022-10-06 01:31:19 +00:00
}
package_ruby() {
2024-08-09 18:25:43 +00:00
depends=(
gcc-libs
gdbm
glibc
gmp
libffi
libxcrypt
libyaml
openssl
readline
zlib
)
2022-10-06 01:31:19 +00:00
optdepends=(
2024-08-09 18:25:43 +00:00
'tk: for Ruby/TK'
'ruby-docs: Documentation for Ruby'
'ruby-default-gems: Default gems which are part of Ruby StdLib'
'ruby-bundled-gems: Bundled gems which are part of Ruby StdLib'
'ruby-stdlib: Full Ruby StdLib including default gems, bundled gems and tools'
2022-10-06 01:31:19 +00:00
)
2024-08-09 18:25:43 +00:00
provides=(
libruby.so
2022-10-06 01:31:19 +00:00
)
2024-08-09 18:25:43 +00:00
replaces=(
2022-10-06 01:31:19 +00:00
ruby-abbrev
ruby-base64
ruby-benchmark
ruby-bigdecimal
ruby-cgi
ruby-csv
ruby-date
ruby-delegate
ruby-did_you_mean
ruby-digest
ruby-drb
ruby-english
ruby-etc
ruby-fcntl
ruby-fiddle
ruby-fileutils
ruby-find
ruby-forwardable
ruby-getoptlong
ruby-io-console
ruby-io-nonblock
ruby-io-wait
ruby-ipaddr
ruby-json
ruby-logger
ruby-mutex_m
ruby-net-http
ruby-open-uri
ruby-psych
ruby-reline
2024-08-09 18:25:43 +00:00
ruby-ruby2_keywords
ruby-set
2022-10-06 01:31:19 +00:00
ruby-stringio
ruby-time
ruby-tmpdir
ruby-uri
)
2024-08-09 18:25:43 +00:00
conflicts=("${replaces[@]}")
provides+=("${_default_gems[@]/#/ruby-}")
cd "ruby-${pkgver}"
make DESTDIR="${pkgdir}" install-nodoc
install --verbose -D --mode=0644 BSDL COPYING --target-directory "${pkgdir}/usr/share/licenses/${pkgname}"
install --verbose -D --mode=0644 *.md --target-directory "${pkgdir}/usr/share/doc/${pkgname}"
# remove unrepreducible files
rm --recursive --verbose \
"${pkgdir}/usr/lib/ruby/gems/${_rubyver}/cache"
# bootstrap switch
if (( _bootstrap )); then
# provide everything for a bootstrap build
# use a reference to provides to srcinfo generation isn't confused
declare -n bootstrap_provides=provides
bootstrap_provides+=("${_default_tool_gems[@]/#/ruby-}" rubygems)
bootstrap_provides+=("${_bundled_gems[@]/#/ruby-}")
declare -n bootstrap_conflicts=conflicts
bootstrap_conflicts+=("${_default_tool_gems[@]/#/ruby-}" rubygems)
bootstrap_conflicts+=("${_bundled_gems[@]/#/ruby-}")
else
# remove de-vendored parts
_remove_default_tool_gems
_remove_bundled_gems
# add standard dependencies
depends+=(
rubygems
)
fi
2022-10-06 01:31:19 +00:00
}
2024-08-09 18:25:43 +00:00
# remove bundled gems - they are provided as dedicated packages
_remove_bundled_gems() {
local gem bin
for gem in "${_bundled_gems[@]}"; do
msg2 "removing bundled gem ${gem}"
rm --recursive --verbose \
"${pkgdir}/usr/lib/ruby/gems/${_rubyver}/gems/${gem}"-* \
"${pkgdir}/usr/lib/ruby/gems/${_rubyver}/specifications/${gem}"-*.gemspec
rm --recursive --verbose --force \
"${pkgdir}/usr/lib/ruby/gems/${_rubyver}/extensions"/*-linux*/"${_rubyver}/${gem}"-*
done
for bin in "${_bundled_gems_bins[@]}"; do
rm --recursive --verbose "${pkgdir}/usr/bin/${bin}"
rm --recursive --verbose --force "${pkgdir}/usr/share/man/man1/${bin}.1"
done
2022-10-06 01:31:19 +00:00
2024-08-09 18:25:43 +00:00
}
# remove default tool gems - they are provided as dedicated packages
_remove_default_tool_gems() {
local gem bin
for gem in "${_default_tool_gems[@]}"; do
msg2 "removing default gem ${gem}"
rm --recursive --verbose \
"${pkgdir}/usr/lib/ruby/${_rubyver}/${gem}"*
if [[ ${gem} != rubygems ]]; then
rm --recursive --verbose \
"${pkgdir}/usr/lib/ruby/gems/${_rubyver}/gems/${gem}"-* \
"${pkgdir}/usr/lib/ruby/gems/${_rubyver}/specifications/default/${gem}"-*.gemspec
fi
rm --recursive --verbose --force \
"${pkgdir}/usr/lib/ruby/${_rubyver}"/*-linux*/"${gem}"
done
for bin in "${_default_tool_gems_bins[@]}"; do
rm --recursive --verbose "${pkgdir}/usr/bin/${bin}"
rm --recursive --verbose --force "${pkgdir}/usr/share/man/man1/${bin}.1"
done
}
package_ruby-docs() {
pkgdesc='Documentation files for Ruby'
cd "ruby-${pkgver}"
make DESTDIR="${pkgdir}" install-doc install-capi
install --verbose -D --mode=0644 BSDL COPYING --target-directory "${pkgdir}/usr/share/licenses/${pkgname}"
}
package_ruby-bundled-gems() {
pkgdesc='Bundled gems which are part of Ruby StdLib'
replaces=(ruby-bundledgems)
conflicts=(ruby-bundledgems)
depends=("${_bundled_gems[@]/#/ruby-}")
cd "ruby-${pkgver}"
install --verbose -D --mode=0644 BSDL COPYING --target-directory "${pkgdir}/usr/share/licenses/${pkgname}"
}
package_ruby-default-gems() {
pkgdesc='Default gems which are part of Ruby StdLib'
depends=("${_default_tool_gems[@]/#/ruby-}")
cd "ruby-${pkgver}"
install --verbose -D --mode=0644 BSDL COPYING --target-directory "${pkgdir}/usr/share/licenses/${pkgname}"
}
package_ruby-stdlib() {
pkgdesc='Full Ruby StdLib including default gems, bundled gems and tools'
depends=(ruby-default-gems ruby-bundled-gems)
cd "ruby-${pkgver}"
install --verbose -D --mode=0644 BSDL COPYING --target-directory "${pkgdir}/usr/share/licenses/${pkgname}"
2022-10-06 01:31:19 +00:00
}
2023-01-09 19:02:11 +00:00
# vim: tabstop=2 shiftwidth=2 expandtab: