summaryrefslogtreecommitdiff
blob: 01876fc18e103687f6474eb5aa46bad58f394132 (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
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-ruby/system_timer/system_timer-1.2.4.ebuild,v 1.2 2012/05/17 10:56:39 tomka Exp $

EAPI="4"

USE_RUBY="ruby18 ree18"

RUBY_FAKEGEM_TASK_TEST="test"

RUBY_FAKEGEM_TASK_DOC="rdoc"
RUBY_FAKEGEM_DOCDIR="rdoc"
RUBY_FAKEGEM_EXTRADOC="README.markdown ChangeLog"

GITHUB_USER="ph7"
GITHUB_PROJECT="${PN/_/-}"

inherit ruby-fakegem eutils

DESCRIPTION="Signal-based timer for Ruby 1.8 (and RubyEE 1.8)"
HOMEPAGE="http://ph7spot.com/musings/system-timer"
SRC_URI="https://github.com/${GITHUB_USER}/${GITHUB_PROJECT}/tarball/${PV} -> ${P}.tar.gz"
RUBY_S="${GITHUB_USER}-${GITHUB_PROJECT}-*"

LICENSE="|| ( Ruby GPL-2 )"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""

ruby_add_bdepend "
	test? (
		dev-ruby/mocha
		dev-ruby/dust
	)"

each_ruby_configure() {
	${RUBY} -C ext/${PN} extconf.rb || die
}

each_ruby_compile() {
	emake -C ext/${PN} CFLAGS="${CFLAGS} -fPIC" archflag="${LDFLAGS}"
	cp ext/${PN}/*.so lib || die
}

each_ruby_install() {
	each_fakegem_install

	# and now... since the gem was renamed from SystemTimer, create a
	# fake SystemTimer gem...
	cat - <<EOF > "${T}/SystemTimer.gemspec"
# generated by ebuild
# $Header: /var/cvsroot/gentoo-x86/dev-ruby/system_timer/system_timer-1.2.4.ebuild,v 1.2 2012/05/17 10:56:39 tomka Exp $
Gem::Specification.new do |s|
  s.name = "SystemTimer"
  s.version = "${RUBY_FAKEGEM_VERSION}"
  s.summary = "Fake gem to load system_timer"
  s.homepage = "${HOMEPAGE}"
  s.require_paths = ["lib"]
  s.specification_version = 3
  s.add_runtime_dependency("${RUBY_FAKEGEM_NAME}", ["= ${RUBY_FAKEGEM_VERSION}"])
end
EOF
	RUBY_FAKEGEM_NAME=SystemTimer \
		RUBY_FAKEGEM_GEMSPEC="${T}/SystemTimer.gemspec" \
		ruby_fakegem_install_gemspec

	dodir $(ruby_fakegem_gemsdir)/gems/SystemTimer-${PV}/lib
	cat - <<EOF > "${D}/$(ruby_fakegem_gemsdir)/gems/SystemTimer-${PV}/lib/SystemTimer.rb"
require 'system_timer'
EOF
}