upgpkg: wordpress 6.2.1-1
[ArchLinux/community.git] / ruby-kpeg / trunk / PKGBUILD
blob1c27b0896ed753660b22c843494cfdf5d9c8b6aa
1 # Maintainer: Andreas 'Segaja' Schleifer <segaja at archlinux dot org>
3 _gemname='kpeg'
4 pkgname="ruby-${_gemname}"
5 pkgver=1.3.2
6 pkgrel=4
7 pkgdesc='A simple PEG library for ruby'
8 arch=('any')
9 url="https://github.com/evanphx/${_gemname}"
10 license=('MIT')
11 depends=('ruby')
12 makedepends=('ruby-hoe' 'ruby-rake')
13 options=('!emptydirs')
14 source=("${url}/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz"
15     # https://github.com/evanphx/kpeg/issues/56
16     "${pkgname}_fix_tests.patch::${url}/commit/560e4abae250c1d53552ea38d112accb95268cfe.patch")
17 sha512sums=('8c05529af8c5ee1defb4401109ad8fd62cd39b6c278202e01781b294ee94395e8acdfe10d7e984b9ed5f1c11006dcbfa694c3315a0d9e5a085adb81bfbaa0848'
18             '0ea92ded31efe8e06c33374f2a42ac8ca1876f201117220031d4d39a5d59925ea2f1b7154c7a41d81189cb522b2109400fd68585a91eddb03ad3bc0921d4036d')
19 b2sums=('91494f7e92bed6e285b4ed9be20738afba82ca75316e7e4537c4d15032dff906416c94f02ca1f5dec56d412c3910cbac072b63918b3ca1bbb71d1ca896d015da'
20         '21069bc557a609b67eb72ca10c01f1b14c60e5b36f47ac2ab8a503d45ff4a94903e765b47cfd6eef04dccbfb4652246f12462ced348821281d0388fc80bf0c17')
22 prepare() {
23   cd "${_gemname}-${pkgver}"
25   patch --verbose --strip=1 --input="../${pkgname}_fix_tests.patch"
27   # update gemspec/Gemfile to allow newer version of the dependencies
28   sed --in-place --regexp-extended 's|~>|>=|g' "${_gemname}.gemspec"
31 build() {
32   cd "${_gemname}-${pkgver}"
34   local _gemdir="$(gem env gemdir)"
36   gem build "${_gemname}.gemspec"
38   gem install \
39     --local \
40     --verbose \
41     --ignore-dependencies \
42     --no-user-install \
43     --install-dir "tmp_install/${_gemdir}" \
44     --bindir "tmp_install/usr/bin" \
45     "${_gemname}-${pkgver}.gem"
47   # remove unrepreducible files
48   rm --force --recursive --verbose \
49     "tmp_install/${_gemdir}/cache/" \
50     "tmp_install/${_gemdir}/gems/${_gemname}-${pkgver}/vendor/" \
51     "tmp_install/${_gemdir}/doc/${_gemname}-${pkgver}/ri/ext/"
53   find "tmp_install/${_gemdir}/gems/" \
54     -type f \
55     \( \
56       -iname "*.o" -o \
57       -iname "*.c" -o \
58       -iname "*.so" -o \
59       -iname "*.time" -o \
60       -iname "gem.build_complete" -o \
61       -iname "Makefile" \
62     \) \
63     -delete
65   find "tmp_install/${_gemdir}/extensions/" \
66     -type f \
67     \( \
68       -iname "mkmf.log" -o \
69       -iname "gem_make.out" \
70     \) \
71     -delete
74 check() {
75   cd "${_gemname}-${pkgver}"
77   local _gemdir="$(gem env gemdir)"
79   GEM_HOME="tmp_install/${_gemdir}" rake test
82 package() {
83   cd "${_gemname}-${pkgver}"
85   cp --archive --verbose tmp_install/* "${pkgdir}"
87   install --verbose --directory --mode=0755 "${pkgdir}/usr/share/vim/vimfiles/"
88   mv --verbose vim/syntax_kpeg/* "${pkgdir}/usr/share/vim/vimfiles/"
90   install --verbose -D --mode=0644 LICENSE --target-directory "${pkgdir}/usr/share/licenses/${pkgname}"
91   install --verbose -D --mode=0644 *.rdoc --target-directory "${pkgdir}/usr/share/doc/${pkgname}"