forked from git-for-windows/MINGW-packages
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPKGBUILD
59 lines (49 loc) · 2.33 KB
/
PKGBUILD
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
# Maintainer: Alexey Pavlov <[email protected]>
_realname=asciidoctor
pkgbase="mingw-w64-${_realname}"
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.5.5
pkgrel=3
pkgdesc="An implementation of AsciiDoc in Ruby (mingw-w64)"
arch=('any')
url='http://asciidoctor.org'
license=('MIT')
depends=("${MINGW_PACKAGE_PREFIX}-ruby")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc")
source=(https://rubygems.org/downloads/${_realname}-${pkgver}.gem)
sha256sums=('87effa3de95919df880aab04c6c29c89255ce671abce361da476208734a5424e')
check() {
local _gemdir="$(ruby -e 'puts Gem.default_dir')"
_gemdir="$(cygpath -u ${_gemdir})"
${MINGW_PREFIX}/bin/gem check --verbose \
"${_realname}-${pkgver}.gem"
}
package() {
local _gemdir="$(${MINGW_PREFIX}/bin/ruby -e 'puts Gem.default_dir')"
_gemdir="$(cygpath -u ${_gemdir})"
${MINGW_PREFIX}/bin/gem install --ignore-dependencies --no-user-install --verbose \
-i "${pkgdir}/${_gemdir}" -n "${pkgdir}${MINGW_PREFIX}/bin" \
"${_realname}-${pkgver}.gem"
local _ruby_exe=$(cygpath -m ${MINGW_PREFIX}/bin/ruby.exe)
#for this conversion, we want the fully qualified ruby .exe path
#so that we can be sure that we are calling the correct one.
sed -e "s|${_ruby_exe}|${MINGW_PREFIX}/bin/ruby|g" \
-i ${pkgdir}${MINGW_PREFIX}/bin/asciidoctor \
-i ${pkgdir}${MINGW_PREFIX}/bin/asciidoctor-safe
#for Win32 .bat files, we want to drop the path references as the path
#refs are not needed since it's involved from the same dir. If we did
#need fully-qualified pathes, they would have to be fully-qualified and
# in DOS format.
local _inst_dir=$(cygpath -m ${pkgdir}/${MINGW_PREFIX}/bin/)
local _w_ruby_exe=$(cygpath -w ${MINGW_PREFIX}/bin/ruby.exe | sed 's/\\/\\\\/g')
sed -e "s|${_w_ruby_exe}|ruby.exe|g" \
-e "s|${_inst_dir}||g" \
-i ${pkgdir}${MINGW_PREFIX}/bin/asciidoctor.bat \
-i ${pkgdir}${MINGW_PREFIX}/bin/asciidoctor-safe.bat
install -Dm644 "${pkgdir}/$_gemdir/gems/${_realname}-${pkgver}/LICENSE.adoc" \
"${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE.adoc"
install -Dm644 "${pkgdir}/${_gemdir}/gems/${_realname}-${pkgver}/man/asciidoctor.1" \
"${pkgdir}${MINGW_PREFIX}/share/man/man1/asciidoctor.1"
rm "${pkgdir}/${_gemdir}/cache/${_realname}-${pkgver}.gem"
rm -rf "${pkgdir}${MINGW_PREFIX}/${_gemdir}/gems/${_realname}-${pkgver}/man"
}