codeberg-cli: update to 0.4.6
[void-pkg.git] / common / build-style / gem.sh
blob779e94eec353b731ea1fd31878d4e5726bca327f
2 # This helper is for templates using gem files from RubyGems.
4 do_install() {
5 : ${gem_cmd:=gem}
7 local _GEMDIR _INSTDIR
9 _GEMDIR=$($gem_cmd env gemdir)
10 _INSTDIR=${DESTDIR}/${_GEMDIR}/gems/${pkgname#ruby-}-${version}
12 $gem_cmd install \
13 --local \
14 --install-dir ${DESTDIR}/${_GEMDIR} \
15 --bindir ${DESTDIR}/usr/bin \
16 --ignore-dependencies \
17 --no-document \
18 --verbose \
19 ${XBPS_SRCDISTDIR}/${pkgname}-${version}/${pkgname#ruby-}-${version}.gem
21 # Remove cache
22 rm -rf ${DESTDIR}/${_GEMDIR}/cache
24 # Remove ext directory. they are only source code and configuration
25 # The actual extensions are guarded in an arch path
26 rm -rf ${_INSTDIR}/ext
28 # Remove installed tests and benchmarks
29 rm -rf ${_INSTDIR}/{test,tests,autotest,benchmark,benchmarks,script,examples,demo}
31 # Remove files shipped on the root of the gem, most of the time they are useless
32 find ${_INSTDIR} -maxdepth 1 -type f -delete
34 # Remove unnecessary files
35 find ${DESTDIR}/${_GEMDIR}/extensions \( -name mkmf.log -o -name gem_make.out \) -delete
37 # Place manpages in usr/share/man/man[0-9]
38 if [ -d ${_INSTDIR}/man ]; then
39 find ${_INSTDIR}/man -type f -name '*.[0-8n]' | while read -r m; do
40 vman ${m}
41 done
44 rm -rf "${_INSTDIR}/man"
46 # Place executables in /usr/bin
47 if [ -d "${_INSTDIR}/bin" ]; then
48 for f in "${_INSTDIR}"/bin/*; do
49 vbin "${f}"
50 done
53 rm -rf ${_INSTDIR}/bin
55 # Place conf files in their places
56 if [ -d ${_INSTDIR}/etc ]; then
57 find ${_INSTDIR}/etc -type f | while read -r c; do
58 vmkdir ${c%/*}/
59 mv ${c} "${DESTDIR}/${c##*${_INSTDIR}/etc/}/"
60 done
63 rm -rf ${_INSTDIR}/etc
65 # Ignore the ~> operator, replace it with >=
66 sed 's|~>|>=|g' \
67 -i ${DESTDIR}/${_GEMDIR}/specifications/${pkgname#ruby-}-${version}.gemspec