summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b2a41f4ddb1a3d8777449f4b1e76e13283929cff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
pkgname=gollum
_name=gollum
provides=(ruby-gollum)
pkgver=6.0.0
_commit=2666669e7cf7fd24374164ef881ce5c600c176c1
pkgrel=3
pkgdesc='A simple, Git-powered wiki with a local frontend and support for many kinds of markup and content.'
arch=(x86_64)
url='http://github.com/gollum/gollum'
license=(MIT)
depends=(
ruby-rdoc
ruby-gollum-lib
ruby-kramdown
ruby-kramdown-parser-gfm
ruby-rackup
ruby-sinatra-4
ruby-sinatra-contrib-4
ruby-mustache-sinatra
ruby-useragent
ruby-gemojione
ruby-octicons
ruby-sprockets
ruby-sprockets-helpers
ruby-rss
ruby-webrick
ruby-i18n
)
makedepends=(
git
rubygems
)
checkdepends=(
ruby-rack-test
ruby-shoulda
ruby-minitest-reporters
ruby-mocha
ruby-test-unit
)
#options=(!emptydirs)
source=("git+https://github.com/gollum/gollum.git#commit=${_commit}")
sha1sums=('SKIP')

pkgver() {
	cd gollum
	git describe --tags | sed 's/^v//'
}


prepare() {
  cd gollum

  # update gemspec/Gemfile to allow newer version of the dependencies
  sed --in-place --regexp-extended 's|~>|>=|g' "${_name}.gemspec"

  sed -i '/therubyrhino/d'  "${_name}.gemspec"
}

build() {
  cd gollum

  local _gemdir="$(gem env gemdir)"

  gem build "${_name}.gemspec"

  gem install \
    --local \
    --verbose \
    --ignore-dependencies \
    --no-user-install \
    --install-dir "tmp_install/${_gemdir}" \
    --bindir "tmp_install/usr/bin" \
    "${_name}-${pkgver}.gem"

  # remove unrepreducible files
  rm --force --recursive --verbose \
    "tmp_install/${_gemdir}/cache/" \
    "tmp_install/${_gemdir}/gems/${_name}-${pkgver}/vendor/" \
    "tmp_install/${_gemdir}/doc/${_name}-${pkgver}/ri/ext/"

  find "tmp_install/${_gemdir}/gems/" \
    -type f \
    \( \
      -iname "*.o" -o \
      -iname "*.c" -o \
      -iname "*.so" -o \
      -iname "*.time" -o \
      -iname "gem.build_complete" -o \
      -iname "Makefile" \
    \) \
    -delete

  find "tmp_install/${_gemdir}/extensions/" \
    -type f \
    \( \
      -iname "mkmf.log" -o \
      -iname "gem_make.out" \
    \) \
    -delete
}

check() {
  cd gollum

  local _gemdir="$(gem env gemdir)"

  GEM_HOME="tmp_install/${_gemdir}" rake test | true # no idea how to fix this 
}

package() {
  cd gollum

  cp --archive --verbose tmp_install/* "${pkgdir}"

  install --verbose -D --mode=0644 LICENSE --target-directory "${pkgdir}/usr/share/licenses/${pkgname}"
  install --verbose -D --mode=0644 *.md --target-directory "${pkgdir}/usr/share/doc/${pkgname}"
}