geoip2_c 0.4.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ubuntu.yml +1 -1
- data/.github/workflows/windows.yml +1 -1
- data/README.md +15 -2
- data/ext/geoip2/extconf.rb +43 -13
- data/lib/geoip2/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a7471c1c8b9c5960c8b10f11701a6b23cedce5cbf49356c1a06a4fed3896ffc4
|
|
4
|
+
data.tar.gz: 5bc5a25d99d5b6dd98c06be377d85d9097cd2ceeaad5d8fcbf9e116c3ea628f6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 16607879122d4480d57abe51b8b5cf312ce4122de4d531bb11089e48b6993541d52f52d495c99196bc657be8c45bafff325558168ed062ac163bffb19916a017
|
|
7
|
+
data.tar.gz: 81b34e63a9e5aef8585ad6a2a0318a70893963b37b26c0286fb07aba1f12d872873ae1fd3e4345dbd31de6e869414a09f4fb35c74822e8339968e80064431b3a
|
|
@@ -27,7 +27,7 @@ jobs:
|
|
|
27
27
|
with:
|
|
28
28
|
submodules: true
|
|
29
29
|
- name: Setup ruby
|
|
30
|
-
uses: ruby/setup-ruby@
|
|
30
|
+
uses: ruby/setup-ruby@7f797815d8adceb1c412e7abefdd1ab4abc47a5f # v1.335.0
|
|
31
31
|
with:
|
|
32
32
|
ruby-version: ${{ matrix.ruby }}
|
|
33
33
|
bundler: latest
|
|
@@ -37,7 +37,7 @@ jobs:
|
|
|
37
37
|
with:
|
|
38
38
|
submodules: true
|
|
39
39
|
- name: Setup ruby
|
|
40
|
-
uses: ruby/setup-ruby@
|
|
40
|
+
uses: ruby/setup-ruby@7f797815d8adceb1c412e7abefdd1ab4abc47a5f # v1.335.0
|
|
41
41
|
with:
|
|
42
42
|
ruby-version: ${{ matrix.ruby }}
|
|
43
43
|
bundler: latest
|
data/README.md
CHANGED
|
@@ -16,7 +16,7 @@ Need ruby.h to build this extension, so you must install it before build this ex
|
|
|
16
16
|
Debian GNU Linux / Ubuntu:
|
|
17
17
|
|
|
18
18
|
```
|
|
19
|
-
$ sudo apt install -y build-essential automake autoconf libtool
|
|
19
|
+
$ sudo apt install -y build-essential automake autoconf libtool pkgconf
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
CentOS:
|
|
@@ -25,7 +25,7 @@ CentOS:
|
|
|
25
25
|
$ sudo yum groupinstall -y "Development Tools"
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
By default, the build downloads the libmaxminddb source from GitHub, so it needs network access. To build without network access, use [libmaxminddb installed on the system](#using-libmaxminddb-installed-on-the-system).
|
|
29
29
|
|
|
30
30
|
## Installation
|
|
31
31
|
|
|
@@ -43,6 +43,19 @@ Or install it yourself as:
|
|
|
43
43
|
|
|
44
44
|
$ gem install geoip2_c
|
|
45
45
|
|
|
46
|
+
### Using libmaxminddb installed on the system
|
|
47
|
+
|
|
48
|
+
By default, the installation downloads the source of libmaxminddb from GitHub and builds it. To link libmaxminddb installed on the system instead, for example where the build cannot access github.com, install its development package and pass `--use-system-libraries`:
|
|
49
|
+
|
|
50
|
+
$ sudo apt install -y libmaxminddb-dev # or: sudo yum install -y libmaxminddb-devel
|
|
51
|
+
$ gem install geoip2_c -- --use-system-libraries
|
|
52
|
+
|
|
53
|
+
Setting the environment variable `GEOIP2_C_USE_SYSTEM_LIBRARIES` has the same effect, which helps when geoip2_c is installed as a dependency of another gem. Any value enables it, even `0` or an empty value:
|
|
54
|
+
|
|
55
|
+
$ GEOIP2_C_USE_SYSTEM_LIBRARIES=1 gem install fluent-plugin-geoip
|
|
56
|
+
|
|
57
|
+
In both ways, the extension is linked to the shared library of libmaxminddb. Keep the runtime package (`libmaxminddb0` on Debian and Ubuntu, `libmaxminddb` on RHEL) installed wherever geoip2_c is used.
|
|
58
|
+
|
|
46
59
|
## Usage
|
|
47
60
|
|
|
48
61
|
```ruby
|
data/ext/geoip2/extconf.rb
CHANGED
|
@@ -1,19 +1,49 @@
|
|
|
1
1
|
require "mkmf"
|
|
2
|
-
require "mini_portile2"
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
# By default, this downloads libmaxminddb and builds it. To link the
|
|
4
|
+
# libmaxminddb installed on the system instead, for example where the build
|
|
5
|
+
# cannot access github.com, pass --use-system-libraries
|
|
6
|
+
# (gem install geoip2_c -- --use-system-libraries) or set
|
|
7
|
+
# GEOIP2_C_USE_SYSTEM_LIBRARIES.
|
|
8
|
+
if arg_config("--use-system-libraries", ENV.key?("GEOIP2_C_USE_SYSTEM_LIBRARIES"))
|
|
9
|
+
pkg_config("libmaxminddb")
|
|
10
|
+
unless have_header("maxminddb.h") && have_library("maxminddb", "MMDB_open")
|
|
11
|
+
abort "libmaxminddb is not found. Install libmaxminddb-dev (Debian, Ubuntu) " \
|
|
12
|
+
"or libmaxminddb-devel (RHEL), or build without --use-system-libraries " \
|
|
13
|
+
"and without GEOIP2_C_USE_SYSTEM_LIBRARIES."
|
|
14
|
+
end
|
|
15
|
+
$CFLAGS << " -std=c99 -fPIC -fms-extensions"
|
|
16
|
+
else
|
|
17
|
+
require "mini_portile2"
|
|
6
18
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
sha256: maxminddb_sha256
|
|
11
|
-
}]
|
|
12
|
-
recipe.cook
|
|
13
|
-
recipe.activate
|
|
19
|
+
maxminddb_version = "1.14.1"
|
|
20
|
+
maxminddb_sha256 = "ca5c87d41339f8bc4daabb53e8a9356b3c995f2d2419b85d7bff823b2ecc252d"
|
|
21
|
+
maxminddb_url = "https://github.com/maxmind/libmaxminddb/releases/download/#{maxminddb_version}/libmaxminddb-#{maxminddb_version}.tar.gz"
|
|
14
22
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
23
|
+
recipe = MiniPortile.new("libmaxminddb", maxminddb_version)
|
|
24
|
+
recipe.files = [{
|
|
25
|
+
url: maxminddb_url,
|
|
26
|
+
sha256: maxminddb_sha256
|
|
27
|
+
}]
|
|
28
|
+
recipe.configure_options += ["--with-pic"]
|
|
29
|
+
begin
|
|
30
|
+
recipe.download
|
|
31
|
+
rescue
|
|
32
|
+
raise if recipe.downloaded?
|
|
33
|
+
abort <<~MESSAGE
|
|
34
|
+
Failed to download #{maxminddb_url}.
|
|
35
|
+
If the build accesses github.com through a proxy, set https_proxy.
|
|
36
|
+
To link libmaxminddb installed on the system instead, install libmaxminddb-dev (Debian, Ubuntu)
|
|
37
|
+
or libmaxminddb-devel (RHEL), and pass --use-system-libraries
|
|
38
|
+
(gem install geoip2_c -- --use-system-libraries) or set GEOIP2_C_USE_SYSTEM_LIBRARIES.
|
|
39
|
+
MESSAGE
|
|
40
|
+
end
|
|
41
|
+
recipe.cook
|
|
42
|
+
recipe.activate
|
|
43
|
+
|
|
44
|
+
$INCFLAGS = "-I#{File.join(recipe.path, 'include')} " + $INCFLAGS
|
|
45
|
+
$LOCAL_LIBS << " #{File.join(recipe.path, 'lib', 'libmaxminddb.a')}"
|
|
46
|
+
$CFLAGS << " -std=c99 -fPIC -fms-extensions -I#{File.join(recipe.path, 'include')}"
|
|
47
|
+
end
|
|
18
48
|
|
|
19
49
|
create_makefile("geoip2/geoip2")
|
data/lib/geoip2/version.rb
CHANGED