void-packages

Void Source Packages
git clone git://ezup.dev/void-packages.git
Log | Files | Refs | README | LICENSE

gem.sh (1763B)


      1#
      2# This helper is for templates using gem files from RubyGems.
      3#
      4do_install() {
      5	: ${gem_cmd:=gem}
      6
      7	local _GEMDIR _INSTDIR
      8	
      9	_GEMDIR=$($gem_cmd env gemdir)
     10	_INSTDIR=${DESTDIR}/${_GEMDIR}/gems/${pkgname#ruby-}-${version}
     11
     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
     20
     21	# Remove cache
     22	rm -rf ${DESTDIR}/${_GEMDIR}/cache
     23
     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
     27
     28	# Remove installed tests and benchmarks
     29	rm -rf ${_INSTDIR}/{test,tests,autotest,benchmark,benchmarks,script,examples,demo}
     30
     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
     33
     34	# Remove unnecessary files
     35	find ${DESTDIR}/${_GEMDIR}/extensions \( -name mkmf.log -o -name gem_make.out \) -delete
     36
     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
     42	fi
     43
     44	rm -rf "${_INSTDIR}/man"
     45
     46	# Place executables in /usr/bin
     47	if [ -d "${_INSTDIR}/bin" ]; then
     48		for f in "${_INSTDIR}"/bin/*; do
     49			vbin "${f}"
     50		done
     51	fi
     52
     53	rm -rf ${_INSTDIR}/bin
     54
     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
     61	fi
     62
     63	rm -rf ${_INSTDIR}/etc
     64
     65	# Ignore the ~> operator, replace it with >=
     66	sed 's|~>|>=|g' \
     67		-i ${DESTDIR}/${_GEMDIR}/specifications/${pkgname#ruby-}-${version}.gemspec
     68}