arch-pkgs/ruby-em-websocket/PKGBUILD

66 lines
1.5 KiB
Bash

_gemname=em-websocket
pkgname=ruby-$_gemname
pkgver=0.5.2
pkgrel=3
pkgdesc="EventMachine based WebSocket server"
arch=('any')
url="https://github.com/igrigorik/em-websocket"
license=('MIT')
depends=(
'ruby'
'ruby-eventmachine'
'ruby-http_parser.rb'
)
options=('!emptydirs')
source=("$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz")
b2sums=('91d41044e20f1f8277527205e3ee6671de2a1fb9b433c18d5b48a166c7cfa53c6553e32b726326f126981f0e014625075bc918b71e00bd8a6919670c370b6cab')
prepare() {
cd "$_gemname-$pkgver"
# mangle gemspec
sed -E \
-e 's/~>/>=/g' \
-e 's|git ls-files|find -type f\|sed "s,\\\\./,,g"|' \
-e '/test_files/d' \
-e '/executables/d' \
-i "$_gemname.gemspec"
}
build() {
cd "$_gemname-$pkgver"
gem build "$_gemname.gemspec"
}
package() {
local _gemdir="$(ruby -e'puts Gem.default_dir')"
cd "$_gemname-$pkgver"
gem install \
--ignore-dependencies \
--no-user-install \
--no-document \
--install-dir "$pkgdir/$_gemdir" \
--bindir "$pkgdir/usr/bin" \
"$_gemname-$pkgver.gem"
# delete cache
cd "$pkgdir/$_gemdir"
rm -vrf cache
# delete unnecessary files & folders
cd "gems/$_gemname-$pkgver"
rm -vrf .gitignore spec Gemfile Rakefile "$_gemname.gemspec"
# move documentation
install -vd "$pkgdir/usr/share/doc/$pkgname"
mv -vt "$pkgdir/usr/share/doc/$pkgname" \
CHANGELOG.rdoc README.md examples
# move license
install -vd "$pkgdir/usr/share/licenses/$pkgname"
mv -v -t "$pkgdir/usr/share/licenses/$pkgname" LICENCE
}