-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathrroonga.gemspec
More file actions
132 lines (117 loc) · 3.82 KB
/
rroonga.gemspec
File metadata and controls
132 lines (117 loc) · 3.82 KB
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
119
120
121
122
123
124
125
126
127
128
129
130
131
# -*- ruby -*-
#
# Copyright (C) 2012-2025 Sutou Kouhei <kou@clear-code.com>
# Copyright (C) 2017 Masafumi Yokoyama <yokoyama@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1 as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
require "English"
require_relative "rroonga-build"
base_dir = File.dirname(__FILE__)
ext_dir = File.join(base_dir, "ext", "groonga")
guess_version = lambda do |ext_dir|
version = {}
File.open(File.join(ext_dir, "rb-grn.h")) do |rb_grn_h|
rb_grn_h.each_line do |line|
case line
when /\A#define RB_GRN_([A-Z]+)_VERSION (\d+)/
version[$1.downcase] = $2
end
end
end
[version["major"], version["minor"], version["micro"]].join(".")
end
clean_white_space = lambda do |entry|
entry.gsub(/(\A\n+|\n+\z)/, '') + "\n"
end
Gem::Specification.new do |s|
s.name = "rroonga"
s.version = guess_version.call(ext_dir)
authors_path = File.join(base_dir, "AUTHORS")
authors = []
emails = []
File.readlines(authors_path).each do |line|
if /\s*<([^<>]*)>$/ =~ line
authors << $PREMATCH
emails << $1
end
end
s.authors = authors
s.email = emails
readme_path = File.join(base_dir, "README.md")
entries = File.read(readme_path).split(/^##\s(.*)$/)
description = clean_white_space.call(entries[entries.index("Description") + 1])
s.summary, s.description, = description.split(/\n\n+/, 3)
s.files = ["README.md", "AUTHORS", "Rakefile", "Gemfile", ".yardopts"]
s.files += Dir.glob("doc/text/*.md")
s.files += Dir.glob("doc/images/*")
s.files += ["#{s.name}.gemspec"]
s.files += ["rroonga-build.rb", "extconf.rb"]
Dir.chdir(base_dir) do
s.files += Dir.glob("{lib,benchmark,misc,example}/**/*.rb")
s.files += Dir.glob("ext/**/*.{c,h,rb,def}")
s.extensions = ["ext/groonga/extconf.rb"]
s.extra_rdoc_files = ["README.md"]
s.test_files = Dir.glob("test/**/*.rb")
Dir.chdir("bin") do
s.executables = Dir.glob("*")
end
end
s.homepage = "http://ranguba.org/#about-rroonga"
s.licenses = ["LGPL-2.1"]
s.require_paths = ["lib", "ext/groonga"]
s.required_ruby_version = ">= 1.9.3"
s.add_runtime_dependency("groonga-client", ">= 0.0.3")
s.add_runtime_dependency("json")
s.add_runtime_dependency("pkg-config")
required_groonga_version = RroongaBuild::RequiredGroongaVersion::STRING
s.metadata["msys2_mingw_dependencies"] = "groonga>=#{required_groonga_version}"
package = "groonga>=#{required_groonga_version}"
groonga_base_url = "https://packages.groonga.org"
[
# Try without additional APT repositories
[
"debian",
"libgroonga-dev",
],
[
"debian",
"#{groonga_base_url}/%{distribution}/groonga-apt-source-latest-%{code_name}.deb",
],
# Retry with additional APT repositories
[
"debian",
"libgroonga-dev",
],
# Try without additional Yum repositories
[
"rhel",
"pkgconfig(groonga)",
],
[
"rhel",
"#{groonga_base_url}/almalinux/%{major_version}/groonga-release-latest.noarch.rpm",
],
# Retry without additional Yum repositories
[
"rhel",
"pkgconfig(groonga)",
],
[
"homebrew",
"groonga",
],
].each do |platform, system_package|
s.requirements << "system: #{package}: #{platform}: #{system_package}"
end
end