geoip2_c 0.3.4 → 0.4.1

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.
Files changed (186) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +23 -0
  3. data/.github/workflows/ubuntu.yml +17 -8
  4. data/.github/workflows/windows.yml +18 -8
  5. data/.gitmodules +0 -3
  6. data/ext/geoip2/extconf.rb +9 -25
  7. data/ext/geoip2/geoip2.c +82 -32
  8. data/geoip2_c.gemspec +1 -0
  9. data/lib/geoip2/version.rb +1 -1
  10. metadata +18 -182
  11. data/ext/geoip2/libmaxminddb/.gitignore +0 -38
  12. data/ext/geoip2/libmaxminddb/.gitmodules +0 -9
  13. data/ext/geoip2/libmaxminddb/.perltidyrc +0 -11
  14. data/ext/geoip2/libmaxminddb/.travis.yml +0 -70
  15. data/ext/geoip2/libmaxminddb/.uncrustify.cfg +0 -78
  16. data/ext/geoip2/libmaxminddb/AUTHORS +0 -0
  17. data/ext/geoip2/libmaxminddb/Changes.md +0 -277
  18. data/ext/geoip2/libmaxminddb/LICENSE +0 -202
  19. data/ext/geoip2/libmaxminddb/Makefile.am +0 -41
  20. data/ext/geoip2/libmaxminddb/NOTICE +0 -13
  21. data/ext/geoip2/libmaxminddb/README.dev.md +0 -69
  22. data/ext/geoip2/libmaxminddb/README.md +0 -122
  23. data/ext/geoip2/libmaxminddb/appveyor.yml +0 -33
  24. data/ext/geoip2/libmaxminddb/bin/Makefile.am +0 -10
  25. data/ext/geoip2/libmaxminddb/bin/mmdblookup.c +0 -715
  26. data/ext/geoip2/libmaxminddb/bootstrap +0 -21
  27. data/ext/geoip2/libmaxminddb/common.mk +0 -7
  28. data/ext/geoip2/libmaxminddb/configure.ac +0 -132
  29. data/ext/geoip2/libmaxminddb/dev-bin/make-man-pages.pl +0 -76
  30. data/ext/geoip2/libmaxminddb/dev-bin/ppa-release.sh +0 -53
  31. data/ext/geoip2/libmaxminddb/dev-bin/regen-prototypes.pl +0 -136
  32. data/ext/geoip2/libmaxminddb/dev-bin/regen-win32-test-projs.pl +0 -54
  33. data/ext/geoip2/libmaxminddb/dev-bin/release.sh +0 -113
  34. data/ext/geoip2/libmaxminddb/dev-bin/uncrustify-all.sh +0 -21
  35. data/ext/geoip2/libmaxminddb/dev-bin/valgrind-all.pl +0 -53
  36. data/ext/geoip2/libmaxminddb/doc/libmaxminddb.md +0 -889
  37. data/ext/geoip2/libmaxminddb/doc/mmdblookup.md +0 -103
  38. data/ext/geoip2/libmaxminddb/include/maxminddb.h +0 -241
  39. data/ext/geoip2/libmaxminddb/include/maxminddb_config.h.in +0 -14
  40. data/ext/geoip2/libmaxminddb/projects/VS12/README.md +0 -59
  41. data/ext/geoip2/libmaxminddb/projects/VS12/libmaxminddb-release.props +0 -32
  42. data/ext/geoip2/libmaxminddb/projects/VS12/libmaxminddb-x64.props +0 -14
  43. data/ext/geoip2/libmaxminddb/projects/VS12/libmaxminddb.props +0 -32
  44. data/ext/geoip2/libmaxminddb/projects/VS12/libmaxminddb.sln +0 -150
  45. data/ext/geoip2/libmaxminddb/projects/VS12/libmaxminddb.vcxproj +0 -143
  46. data/ext/geoip2/libmaxminddb/projects/VS12/libmaxminddb.vcxproj.filters +0 -32
  47. data/ext/geoip2/libmaxminddb/projects/VS12/maxminddb_config.h +0 -14
  48. data/ext/geoip2/libmaxminddb/projects/VS12-tests/bad_pointers.vcxproj +0 -105
  49. data/ext/geoip2/libmaxminddb/projects/VS12-tests/basic_lookup.vcxproj +0 -105
  50. data/ext/geoip2/libmaxminddb/projects/VS12-tests/data_entry_list.vcxproj +0 -105
  51. data/ext/geoip2/libmaxminddb/projects/VS12-tests/data_types.vcxproj +0 -105
  52. data/ext/geoip2/libmaxminddb/projects/VS12-tests/dump.vcxproj +0 -105
  53. data/ext/geoip2/libmaxminddb/projects/VS12-tests/get_value.vcxproj +0 -105
  54. data/ext/geoip2/libmaxminddb/projects/VS12-tests/get_value_pointer_bug.vcxproj +0 -105
  55. data/ext/geoip2/libmaxminddb/projects/VS12-tests/ipv4_start_cache.vcxproj +0 -105
  56. data/ext/geoip2/libmaxminddb/projects/VS12-tests/ipv6_lookup_in_ipv4.vcxproj +0 -105
  57. data/ext/geoip2/libmaxminddb/projects/VS12-tests/libtap.vcxproj +0 -85
  58. data/ext/geoip2/libmaxminddb/projects/VS12-tests/maxminddb_test_helper.vcxproj +0 -107
  59. data/ext/geoip2/libmaxminddb/projects/VS12-tests/metadata.vcxproj +0 -105
  60. data/ext/geoip2/libmaxminddb/projects/VS12-tests/metadata_pointers.vcxproj +0 -105
  61. data/ext/geoip2/libmaxminddb/projects/VS12-tests/no_map_get_value.vcxproj +0 -105
  62. data/ext/geoip2/libmaxminddb/projects/VS12-tests/read_node.vcxproj +0 -105
  63. data/ext/geoip2/libmaxminddb/projects/VS12-tests/shared.vcxproj +0 -104
  64. data/ext/geoip2/libmaxminddb/projects/VS12-tests/threads.vcxproj +0 -103
  65. data/ext/geoip2/libmaxminddb/projects/VS12-tests/version.vcxproj +0 -105
  66. data/ext/geoip2/libmaxminddb/projects/test.vcxproj.template +0 -105
  67. data/ext/geoip2/libmaxminddb/src/Makefile.am +0 -25
  68. data/ext/geoip2/libmaxminddb/src/data-pool.c +0 -180
  69. data/ext/geoip2/libmaxminddb/src/data-pool.h +0 -52
  70. data/ext/geoip2/libmaxminddb/src/libmaxminddb.pc.in +0 -11
  71. data/ext/geoip2/libmaxminddb/src/maxminddb-compat-util.h +0 -167
  72. data/ext/geoip2/libmaxminddb/src/maxminddb.c +0 -2181
  73. data/ext/geoip2/libmaxminddb/t/Makefile.am +0 -27
  74. data/ext/geoip2/libmaxminddb/t/bad_databases_t.c +0 -67
  75. data/ext/geoip2/libmaxminddb/t/bad_pointers_t.c +0 -53
  76. data/ext/geoip2/libmaxminddb/t/basic_lookup_t.c +0 -207
  77. data/ext/geoip2/libmaxminddb/t/compile_c++_t.pl +0 -107
  78. data/ext/geoip2/libmaxminddb/t/data-pool-t.c +0 -374
  79. data/ext/geoip2/libmaxminddb/t/data_entry_list_t.c +0 -353
  80. data/ext/geoip2/libmaxminddb/t/data_types_t.c +0 -439
  81. data/ext/geoip2/libmaxminddb/t/dump_t.c +0 -103
  82. data/ext/geoip2/libmaxminddb/t/external_symbols_t.pl +0 -106
  83. data/ext/geoip2/libmaxminddb/t/get_value_pointer_bug_t.c +0 -66
  84. data/ext/geoip2/libmaxminddb/t/get_value_t.c +0 -249
  85. data/ext/geoip2/libmaxminddb/t/ipv4_start_cache_t.c +0 -36
  86. data/ext/geoip2/libmaxminddb/t/ipv6_lookup_in_ipv4_t.c +0 -48
  87. data/ext/geoip2/libmaxminddb/t/libtap/.gitignore +0 -13
  88. data/ext/geoip2/libmaxminddb/t/libtap/.travis.yml +0 -13
  89. data/ext/geoip2/libmaxminddb/t/libtap/COPYING +0 -165
  90. data/ext/geoip2/libmaxminddb/t/libtap/INSTALL +0 -41
  91. data/ext/geoip2/libmaxminddb/t/libtap/Makefile +0 -72
  92. data/ext/geoip2/libmaxminddb/t/libtap/Makefile.win +0 -37
  93. data/ext/geoip2/libmaxminddb/t/libtap/README.md +0 -268
  94. data/ext/geoip2/libmaxminddb/t/libtap/t/cmp_mem.c +0 -20
  95. data/ext/geoip2/libmaxminddb/t/libtap/t/cmp_mem.expected +0 -28
  96. data/ext/geoip2/libmaxminddb/t/libtap/t/cmpok.c +0 -16
  97. data/ext/geoip2/libmaxminddb/t/libtap/t/cmpok.expected +0 -37
  98. data/ext/geoip2/libmaxminddb/t/libtap/t/diag.c +0 -10
  99. data/ext/geoip2/libmaxminddb/t/libtap/t/diag.expected +0 -2
  100. data/ext/geoip2/libmaxminddb/t/libtap/t/diesok.c +0 -14
  101. data/ext/geoip2/libmaxminddb/t/libtap/t/diesok.expected +0 -6
  102. data/ext/geoip2/libmaxminddb/t/libtap/t/is.c +0 -24
  103. data/ext/geoip2/libmaxminddb/t/libtap/t/is.expected +0 -58
  104. data/ext/geoip2/libmaxminddb/t/libtap/t/like.c +0 -10
  105. data/ext/geoip2/libmaxminddb/t/libtap/t/like.expected +0 -4
  106. data/ext/geoip2/libmaxminddb/t/libtap/t/simple.c +0 -31
  107. data/ext/geoip2/libmaxminddb/t/libtap/t/simple.expected +0 -32
  108. data/ext/geoip2/libmaxminddb/t/libtap/t/skip.c +0 -23
  109. data/ext/geoip2/libmaxminddb/t/libtap/t/skip.expected +0 -9
  110. data/ext/geoip2/libmaxminddb/t/libtap/t/synopsis.c +0 -13
  111. data/ext/geoip2/libmaxminddb/t/libtap/t/synopsis.expected +0 -9
  112. data/ext/geoip2/libmaxminddb/t/libtap/t/test.c +0 -28
  113. data/ext/geoip2/libmaxminddb/t/libtap/t/todo.c +0 -17
  114. data/ext/geoip2/libmaxminddb/t/libtap/t/todo.expected +0 -11
  115. data/ext/geoip2/libmaxminddb/t/libtap/tap.c +0 -354
  116. data/ext/geoip2/libmaxminddb/t/libtap/tap.h +0 -115
  117. data/ext/geoip2/libmaxminddb/t/maxmind-db/.gitattributes +0 -1
  118. data/ext/geoip2/libmaxminddb/t/maxmind-db/.gitconfig +0 -2
  119. data/ext/geoip2/libmaxminddb/t/maxmind-db/.gitignore +0 -2
  120. data/ext/geoip2/libmaxminddb/t/maxmind-db/.perltidyallrc +0 -11
  121. data/ext/geoip2/libmaxminddb/t/maxmind-db/.tidyallrc +0 -7
  122. data/ext/geoip2/libmaxminddb/t/maxmind-db/LICENSE +0 -4
  123. data/ext/geoip2/libmaxminddb/t/maxmind-db/MaxMind-DB-spec.md +0 -558
  124. data/ext/geoip2/libmaxminddb/t/maxmind-db/README.md +0 -4
  125. data/ext/geoip2/libmaxminddb/t/maxmind-db/bad-data/README.md +0 -7
  126. data/ext/geoip2/libmaxminddb/t/maxmind-db/bad-data/libmaxminddb/libmaxminddb-offset-integer-overflow.mmdb +0 -0
  127. data/ext/geoip2/libmaxminddb/t/maxmind-db/bad-data/maxminddb-golang/cyclic-data-structure.mmdb +0 -0
  128. data/ext/geoip2/libmaxminddb/t/maxmind-db/bad-data/maxminddb-golang/invalid-bytes-length.mmdb +0 -1
  129. data/ext/geoip2/libmaxminddb/t/maxmind-db/bad-data/maxminddb-golang/invalid-data-record-offset.mmdb +0 -0
  130. data/ext/geoip2/libmaxminddb/t/maxmind-db/bad-data/maxminddb-golang/invalid-map-key-length.mmdb +0 -0
  131. data/ext/geoip2/libmaxminddb/t/maxmind-db/bad-data/maxminddb-golang/invalid-string-length.mmdb +0 -1
  132. data/ext/geoip2/libmaxminddb/t/maxmind-db/bad-data/maxminddb-golang/metadata-is-an-uint128.mmdb +0 -1
  133. data/ext/geoip2/libmaxminddb/t/maxmind-db/bad-data/maxminddb-golang/unexpected-bytes.mmdb +0 -0
  134. data/ext/geoip2/libmaxminddb/t/maxmind-db/perltidyrc +0 -12
  135. data/ext/geoip2/libmaxminddb/t/maxmind-db/source-data/GeoIP2-Anonymous-IP-Test.json +0 -32
  136. data/ext/geoip2/libmaxminddb/t/maxmind-db/source-data/GeoIP2-City-Test.json +0 -12616
  137. data/ext/geoip2/libmaxminddb/t/maxmind-db/source-data/GeoIP2-Connection-Type-Test.json +0 -102
  138. data/ext/geoip2/libmaxminddb/t/maxmind-db/source-data/GeoIP2-Country-Test.json +0 -10975
  139. data/ext/geoip2/libmaxminddb/t/maxmind-db/source-data/GeoIP2-DensityIncome-Test.json +0 -14
  140. data/ext/geoip2/libmaxminddb/t/maxmind-db/source-data/GeoIP2-Domain-Test.json +0 -452
  141. data/ext/geoip2/libmaxminddb/t/maxmind-db/source-data/GeoIP2-Enterprise-Test.json +0 -666
  142. data/ext/geoip2/libmaxminddb/t/maxmind-db/source-data/GeoIP2-ISP-Test.json +0 -12585
  143. data/ext/geoip2/libmaxminddb/t/maxmind-db/source-data/GeoIP2-Precision-Enterprise-Test.json +0 -1035
  144. data/ext/geoip2/libmaxminddb/t/maxmind-db/source-data/GeoLite2-ASN-Test.json +0 -37
  145. data/ext/geoip2/libmaxminddb/t/maxmind-db/source-data/README +0 -13
  146. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoIP2-Anonymous-IP-Test.mmdb +0 -0
  147. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoIP2-City-Test-Broken-Double-Format.mmdb +0 -0
  148. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoIP2-City-Test-Invalid-Node-Count.mmdb +0 -0
  149. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoIP2-City-Test.mmdb +0 -0
  150. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoIP2-Connection-Type-Test.mmdb +0 -0
  151. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoIP2-Country-Test.mmdb +0 -0
  152. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoIP2-DensityIncome-Test.mmdb +0 -0
  153. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoIP2-Domain-Test.mmdb +0 -0
  154. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoIP2-Enterprise-Test.mmdb +0 -0
  155. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoIP2-ISP-Test.mmdb +0 -0
  156. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoIP2-Precision-Enterprise-Test.mmdb +0 -0
  157. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoLite2-ASN-Test.mmdb +0 -0
  158. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-no-ipv4-search-tree.mmdb +0 -0
  159. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-string-value-entries.mmdb +0 -0
  160. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-broken-pointers-24.mmdb +0 -0
  161. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-broken-search-tree-24.mmdb +0 -0
  162. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-decoder.mmdb +0 -0
  163. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-ipv4-24.mmdb +0 -0
  164. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-ipv4-28.mmdb +0 -0
  165. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-ipv4-32.mmdb +0 -0
  166. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-ipv6-24.mmdb +0 -0
  167. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-ipv6-28.mmdb +0 -0
  168. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-ipv6-32.mmdb +0 -0
  169. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-metadata-pointers.mmdb +0 -0
  170. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-mixed-24.mmdb +0 -0
  171. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-mixed-28.mmdb +0 -0
  172. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-mixed-32.mmdb +0 -0
  173. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-nested.mmdb +0 -0
  174. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/README.md +0 -26
  175. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/maps-with-pointers.raw +0 -0
  176. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/write-test-data.pl +0 -614
  177. data/ext/geoip2/libmaxminddb/t/maxmind-db/tidyall.ini +0 -5
  178. data/ext/geoip2/libmaxminddb/t/maxminddb_test_helper.c +0 -255
  179. data/ext/geoip2/libmaxminddb/t/maxminddb_test_helper.h +0 -69
  180. data/ext/geoip2/libmaxminddb/t/metadata_pointers_t.c +0 -32
  181. data/ext/geoip2/libmaxminddb/t/metadata_t.c +0 -226
  182. data/ext/geoip2/libmaxminddb/t/mmdblookup_t.pl +0 -158
  183. data/ext/geoip2/libmaxminddb/t/no_map_get_value_t.c +0 -32
  184. data/ext/geoip2/libmaxminddb/t/read_node_t.c +0 -157
  185. data/ext/geoip2/libmaxminddb/t/threads_t.c +0 -196
  186. data/ext/geoip2/libmaxminddb/t/version_t.c +0 -10
@@ -1,21 +0,0 @@
1
- #! /bin/sh
2
-
3
- # make sure to use the installed libtool
4
- if [ -f ltmain.sh ]; then
5
- rm ltmain.sh
6
- fi
7
- autoreconf -fiv
8
-
9
- ###################################################
10
- # the steps below may help with outdated toolsets
11
-
12
- # disable dependency trackeing for OS X with multiply arch option's
13
- # automake -i --gnu --add-missing
14
-
15
-
16
- #aclocal \
17
- #&& automake -i --gnu --add-missing \
18
- #&& autoconf
19
-
20
- #LIBTOOLIZE=$( which libtoolize glibtoolize | head -1 )
21
- #$LIBTOOLIZE -f
@@ -1,7 +0,0 @@
1
- if DEBUG
2
- AM_CFLAGS=-O0 -g -Wall -Wextra
3
- else
4
- AM_CFLAGS=-O2 -g
5
- endif
6
-
7
- AM_CPPFLAGS = -I$(top_srcdir)/include
@@ -1,132 +0,0 @@
1
- # -*- Autoconf -*-
2
- # Process this file with autoconf to produce a configure script.
3
-
4
- AC_PREREQ([2.63])
5
- AC_INIT([libmaxminddb], [1.3.2], [support@maxmind.com])
6
- AC_CONFIG_SRCDIR([include/maxminddb.h])
7
- AC_CONFIG_HEADERS([config.h include/maxminddb_config.h])
8
-
9
- PKG_PROG_PKG_CONFIG
10
- m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR], [AC_SUBST([pkgconfigdir], [${libdir}/pkgconfig])])
11
- AC_CONFIG_FILES([src/libmaxminddb.pc])
12
-
13
- LT_INIT
14
- AM_INIT_AUTOMAKE(foreign m4_esyscmd([case `automake --version | head -n 1` in
15
- *1.14*) echo subdir-objects;;
16
- *1.11*);;
17
- *) echo serial-tests;;
18
- esac]))
19
- AC_PROG_LIBTOOL
20
- # Checks for programs.
21
- AC_PROG_CC_C99
22
-
23
- # Copied from http://stackoverflow.com/a/10682813/9832 and tweaked for C (as
24
- # opposed to C++)
25
- #
26
- # AX_CHECK_CFLAGS(ADDITIONAL-CFLAGS, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
27
- #
28
- # checks whether the $(CC) compiler accepts the ADDITIONAL-CFLAGS
29
- # if so, they are added to the CXXFLAGS
30
- AC_DEFUN([AX_CHECK_CFLAGS],
31
- [
32
- AC_MSG_CHECKING([whether compiler accepts "$1"])
33
- cat > conftest.c << EOF
34
- int main(){
35
- return 0;
36
- }
37
- EOF
38
- if $CC $CFLAGS -o conftest.o conftest.c [$1] > /dev/null 2>&1
39
- then
40
- AC_MSG_RESULT([yes])
41
- CFLAGS="${CFLAGS} [$1]"
42
- [$2]
43
- else
44
- AC_MSG_RESULT([no])
45
- [$3]
46
- fi
47
- ])dnl AX_CHECK_CFLAGS
48
-
49
- AX_CHECK_CFLAGS([-fms-extensions])
50
-
51
- # We will add this back for non-debug builds in the common.mk file
52
- CFLAGS=`echo ${CFLAGS} | sed 's/-O2//'`
53
- CXXFLAGS=`echo ${CXXFLAGS} | sed 's/-O2//'`
54
-
55
- # autoconf insists on giving us gnu99 if it's available
56
- CC=`echo ${CC} | sed 's/-std=gnu99/-std=c99/'`
57
-
58
- AC_C_RESTRICT
59
-
60
- AC_CHECK_HEADERS([arpa/inet.h assert.h fcntl.h inttypes.h libgen.h math.h netdb.h netinet/in.h stdarg.h stdbool.h stdint.h stdio.h stdlib.h string.h sys/mman.h sys/socket.h sys/stat.h sys/time.h sys/types.h unistd.h])
61
-
62
- # configure generates an invalid config for MinGW because of the type checks
63
- # so we only run them on non MinGW-Systems. For MinGW we also need to link
64
- # against ws2_32.
65
- AC_CANONICAL_HOST
66
- is_windows=false
67
- case $host_os in
68
- mingw*)
69
- LDFLAGS="-lws2_32"
70
- is_windows=true
71
- ;;
72
- *)
73
- AC_TYPE_OFF_T
74
- AC_TYPE_SIZE_T
75
- AC_TYPE_SSIZE_T
76
- AC_TYPE_UINT8_T
77
- AC_TYPE_UINT32_T
78
- AC_TYPE_UINT64_T
79
- ;;
80
- esac
81
-
82
- AM_CONDITIONAL([WINDOWS], [test x$is_windows = xtrue])
83
-
84
- # This check is backwards in order to make life easier for people writing
85
- # extensions in other languages that link to this library. If they want to
86
- # simply assume that they are using a newish compiler, they don't need to
87
- # check for this type nor do they need to define anything on the CLI. They'll
88
- # just get code that assumes this type exists.
89
- AC_CHECK_TYPE(
90
- [unsigned __int128],
91
- [AC_DEFINE([MMDB_UINT128_IS_BYTE_ARRAY], [0], [Missing the unsigned __int128 type])],
92
- [AC_CHECK_TYPE(
93
- [unsigned int __attribute__((mode(TI)))],
94
- [AC_DEFINE([MMDB_UINT128_IS_BYTE_ARRAY], [0], [Missing the unsigned __int128 type])
95
- AC_DEFINE([MMDB_UINT128_USING_MODE], [1], [int128 types are available with __attribute__((mode(TI)))])],
96
- [AC_DEFINE([MMDB_UINT128_IS_BYTE_ARRAY], [1], [Missing the unsigned __int128 type])])])
97
-
98
- AC_CHECK_TYPES([boolean])
99
-
100
- AC_CHECK_FUNCS([clock_gettime open_memstream])
101
-
102
- AC_C_BIGENDIAN(
103
- [AC_DEFINE([MMDB_LITTLE_ENDIAN], [0], [System is big-endian])],
104
- [AC_DEFINE([MMDB_LITTLE_ENDIAN], [1], [System is little-endian])])
105
-
106
- AC_FUNC_MMAP
107
-
108
- AC_SEARCH_LIBS([fabs], [m])
109
- AC_SEARCH_LIBS([fabsf], [m])
110
- AC_SEARCH_LIBS([getaddrinfo], [socket])
111
-
112
- AC_ARG_ENABLE(
113
- [debug],
114
- [ --enable-debug Turn on debugging],
115
- [case "${enableval}" in
116
- yes) debug=true ;;
117
- no) debug=false ;;
118
- *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
119
- esac],[debug=false])
120
- AM_CONDITIONAL([DEBUG], [test x$debug = xtrue])
121
-
122
- AC_ARG_ENABLE([tests],
123
- AS_HELP_STRING([--enable-tests], [Compilation of tests code]),
124
- [enable_tests=${enableval}],
125
- [enable_tests=yes])
126
- AM_CONDITIONAL([TESTS], [test "${enable_tests}" = "yes"])
127
-
128
- AC_CONFIG_FILES([Makefile
129
- src/Makefile
130
- bin/Makefile
131
- t/Makefile])
132
- AC_OUTPUT
@@ -1,76 +0,0 @@
1
- #!/usr/bin/env perl
2
-
3
- use strict;
4
- use warnings;
5
- use autodie qw( :all );
6
-
7
- use FindBin qw( $Bin );
8
-
9
- use File::Path qw( mkpath );
10
- use File::Slurp qw( edit_file read_file write_file );
11
- use File::Temp qw( tempdir );
12
- use File::Which qw( which );
13
-
14
- sub main {
15
- my $target = shift || "$Bin/..";
16
-
17
- my $pandoc = which('pandoc')
18
- or die
19
- "\n You must install pandoc in order to generate the man pages.\n\n";
20
-
21
- _make_man( $target, 'libmaxminddb', 3 );
22
- _make_lib_man_links($target);
23
-
24
- _make_man( $target, 'mmdblookup', 1 );
25
- }
26
-
27
- sub _make_man {
28
- my $target = shift;
29
- my $name = shift;
30
- my $section = shift;
31
-
32
- my $man_dir = "$target/man/man$section";
33
- mkpath($man_dir);
34
-
35
- my $tempdir = tempdir( CLEANUP => 1 );
36
-
37
- my $markdown = <<"EOF";
38
- % $name($section)
39
-
40
- EOF
41
- $markdown .= read_file("$Bin/../doc/$name.md");
42
-
43
- my $tempfile = "$tempdir/$name.$section.md";
44
- write_file( $tempfile, $markdown );
45
-
46
- my $man_file = "$man_dir/$name.$section";
47
- system( qw( pandoc -s -t man ), $tempfile, '-o', $man_file );
48
-
49
- _fix_indentation($man_file);
50
- }
51
-
52
- sub _make_lib_man_links {
53
- my $target = shift;
54
-
55
- my $header = read_file("$Bin/../include/maxminddb.h");
56
- for my $proto ( $header =~ /^ +extern.+?(\w+)\(/gsm ) {
57
- open my $fh, '>', "$target/man/man3/$proto.3";
58
- print {$fh} ".so man3/libmaxminddb.3\n";
59
- close $fh;
60
- }
61
- }
62
-
63
- # AFAICT there's no way to control the indentation depth for code blocks with
64
- # Pandoc.
65
- sub _fix_indentation {
66
- my $file = shift;
67
-
68
- edit_file(
69
- sub {
70
- s/^\.IP\n\.nf/.IP "" 4\n.nf/gm;
71
- },
72
- $file
73
- );
74
- }
75
-
76
- main(shift);
@@ -1,53 +0,0 @@
1
- #!/bin/bash
2
-
3
- set -e
4
- set -x
5
- set -u
6
-
7
- DISTS=( artful zesty xenial trusty precise )
8
-
9
- VERSION=$(perl -MFile::Slurp::Tiny=read_file -MDateTime <<EOF
10
- use v5.16;
11
- my \$log = read_file(q{Changes.md});
12
- \$log =~ /^## (\d+\.\d+\.\d+) - (\d{4}-\d{2}-\d{2})/;
13
- die 'Release time is not today!' unless DateTime->now->ymd eq \$2;
14
- say \$1;
15
- EOF
16
- )
17
-
18
- RESULTS=/tmp/build-libmaxminddb-results/
19
- SRCDIR="$RESULTS/libmaxminddb"
20
-
21
- mkdir -p "$SRCDIR"
22
-
23
- # gbp does weird things without a pristine checkout
24
- git clone git@github.com:maxmind/libmaxminddb.git -b ubuntu-ppa $SRCDIR
25
-
26
- pushd "$SRCDIR"
27
- git merge "$VERSION"
28
-
29
- for dist in "${DISTS[@]}"; do
30
- dch -v "$VERSION-0+maxmind1~$dist" -D "$dist" -u low "New upstream release."
31
- gbp buildpackage -S --git-ignore-new
32
-
33
- git clean -xfd
34
- git reset HEAD --hard
35
- done
36
-
37
- read -e -p "Release to PPA? (y/n)" SHOULD_RELEASE
38
-
39
- if [ "$SHOULD_RELEASE" != "y" ]; then
40
- echo "Aborting"
41
- exit 1
42
- fi
43
-
44
- # Upload to launchpad
45
- dput ppa:maxmind/ppa ../*source.changes
46
-
47
- # Make the changelog up to date in git
48
-
49
- dch -v "$VERSION-0+maxmind1" -D "${DISTS[0]}" -u low "New upstream release."
50
-
51
- git add debian/changelog
52
- git commit -m "Update debian/changelog for $VERSION"
53
- git push
@@ -1,136 +0,0 @@
1
- #!/usr/bin/env perl
2
-
3
- use strict;
4
- use warnings;
5
-
6
- use FindBin qw( $Bin );
7
-
8
- use File::Basename qw( basename dirname );
9
- use File::Slurp qw( read_file write_file );
10
- use List::MoreUtils qw( uniq );
11
-
12
- sub main {
13
- _regen_prototypes(
14
- "$Bin/../src/maxminddb.c",
15
- "$Bin/../include/maxminddb.h"
16
- );
17
-
18
- _regen_prototypes(
19
- "$Bin/../bin/mmdblookup.c",
20
- );
21
-
22
- _regen_prototypes(
23
- "$Bin/../t/maxminddb_test_helper.c",
24
- "$Bin/../t/maxminddb_test_helper.h",
25
- );
26
- }
27
-
28
- sub _regen_prototypes {
29
- my $c_file = shift;
30
- my $h_file = shift;
31
-
32
- my $c_code = read_file($c_file);
33
- my $h_code = $h_file ? read_file($h_file) : q{};
34
- my $orig_c_code = $c_code;
35
- my $orig_h_code = $h_code;
36
-
37
- my $script_name = basename($0);
38
- my $dir = basename($Bin);
39
-
40
- my $indent_off = '/* *INDENT-OFF* */';
41
- my $indent_on = '/* *INDENT-ON* */';
42
- my $prototypes_start
43
- = "/* --prototypes automatically generated by $dir/$script_name - don't remove this comment */";
44
- my $prototypes_end
45
- = q{/* --prototypes end - don't remove this comment-- */};
46
-
47
- ( my $prototypes_start_re = $prototypes_start ) =~ s/ \n /\n */g;
48
- ( my $prototypes_end_re = $prototypes_end ) =~ s/\n/\n */g;
49
-
50
- for my $content ( $c_code, $h_code ) {
51
- $content =~ s{
52
- [ ]*
53
- \Q$indent_off\E
54
- \n
55
- [ ]*
56
- \Q$prototypes_start\E
57
- .+?
58
- [ ]*
59
- \Q$prototypes_end\E
60
- \n
61
- [ ]*
62
- \Q$indent_on\E
63
- \n
64
- }{__PROTOTYPES__}sx;
65
- }
66
-
67
- my @prototypes = parse_prototypes($c_code);
68
-
69
- if ($h_file) {
70
- my $external_prototypes = join q{}, map {
71
- my $p = 'extern ' . $_->{prototype};
72
- $p =~ s/^/ /; # first line
73
- $p =~ s/\n/\n /gm; # the rest
74
- $p . ";\n"
75
- }
76
- grep { $_->{external} } @prototypes;
77
- $h_code
78
- =~ s/__PROTOTYPES__/ $indent_off\n $prototypes_start\n$external_prototypes $prototypes_end\n $indent_on\n/;
79
- $h_code =~ s{\n *(/\* \*INDENT)}{\n $1}g;
80
- }
81
-
82
- my $internal_prototypes = join q{}, uniq
83
- map { $_->{prototype} . ";\n" } grep { !$_->{external} } @prototypes;
84
- $c_code
85
- =~ s/__PROTOTYPES__/$indent_off\n$prototypes_start\n$internal_prototypes$prototypes_end\n$indent_on\n/;
86
-
87
- write_file( $c_file, $c_code ) if $c_code ne $orig_c_code;
88
- write_file( $h_file, $h_code ) if $h_file && $h_code ne $orig_h_code;
89
- }
90
-
91
- my $return_type_re = qr/(?:\w+\s+)+?\**?/;
92
- my $signature_re = qr/\([^\(\)]+?\)/;
93
-
94
- # Shamelessly stolen from Inline::C::ParseRegExp
95
- my $sp = qr{[ \t]|\n(?![ \t]*\n)};
96
-
97
- my $re_type = qr {
98
- (?: (?: const $sp*)? \w+ $sp* )+? # words
99
- (?: (?: const $sp*)? \* $sp* )* # stars
100
- (?: const $sp*)? # optional const
101
- }x;
102
-
103
- my $re_identifier = qr{ \w+ $sp* }x;
104
-
105
- my $re_args = qr/\(.*?\)/s;
106
-
107
- # and again from Inline::C::ParseRegExp
108
- my $re_signature = qr/^($re_type ($re_identifier) $re_args) (?>[\ \t\n]*?{)/x;
109
-
110
- {
111
- my %skip = map { $_ => 1 } qw( memmem );
112
-
113
- sub parse_prototypes {
114
- my $c_code = shift;
115
-
116
- my @protos;
117
-
118
- for my $chunk ( $c_code =~ /^(\w+.+?[;{])/gsm ) {
119
- my ( $prototype, $name ) = $chunk =~ /^$re_signature/ms
120
- or next;
121
-
122
- next if $prototype =~ /^(?:DEBUG_FUNC|NO_PROTO)/;
123
-
124
- push @protos,
125
- {
126
- name => $name,
127
- prototype => $prototype,
128
- external => $prototype =~ /^LOCAL/ ? 0 : 1,
129
- };
130
- }
131
-
132
- return grep { !$skip{ $_->{name} } } @protos;
133
- }
134
- }
135
-
136
- main();
@@ -1,54 +0,0 @@
1
- #!/usr/bin/env perl
2
-
3
- use strict;
4
- use warnings;
5
-
6
- use FindBin qw( $Bin );
7
-
8
- use Data::UUID;
9
- use File::Slurp qw( read_file write_file );
10
- use Path::Iterator::Rule;
11
-
12
- sub main {
13
- my $rule = Path::Iterator::Rule->new;
14
- $rule->file->name(qr/_t.c$/);
15
-
16
- my $ug = Data::UUID->new;
17
-
18
- my $template = read_file("$Bin/../projects/test.vcxproj.template");
19
-
20
- my @names;
21
- for my $file ( $rule->all("$Bin/../t/") ) {
22
- my ($name) = $file =~ /(\w*)_t.c$/;
23
-
24
- next unless $name;
25
- next if $name eq 'threads';
26
-
27
- push @names, $name;
28
-
29
- my $project = $template;
30
-
31
- $project =~ s/%TESTNAME%/$name/g;
32
-
33
- my $uuid = $ug->to_string( $ug->create );
34
- $project =~ s/%UUID%/$uuid/g;
35
-
36
- write_file( "$Bin/../projects/VS12-tests/$name.vcxproj", $project );
37
- }
38
-
39
- _modify_yml(@names);
40
- }
41
-
42
- sub _modify_yml {
43
- my @names = @_;
44
-
45
- my $exe_block = join "\n",
46
- map { " - .\\projects\\VS12\\Debug\\test_${_}.exe" } @names;
47
-
48
- my $file = "$Bin/../appveyor.yml";
49
- my $config = read_file($file);
50
- $config =~ s/(#EXES).*?(#ENDEXES)/$1\n$exe_block\n $2/s;
51
- write_file( $file, $config );
52
- }
53
-
54
- main();
@@ -1,113 +0,0 @@
1
- #!/bin/bash
2
-
3
- set -eu -o pipefail
4
-
5
- changelog=$(cat Changes.md)
6
-
7
- regex='## ([0-9]+\.[0-9]+\.[0-9]+) - ([0-9]{4}-[0-9]{2}-[0-9]{2})
8
-
9
- ((.|
10
- )*)
11
- '
12
-
13
- if [[ ! $changelog =~ $regex ]]; then
14
- echo "Could not find date line in change log!"
15
- exit 1
16
- fi
17
-
18
- version="${BASH_REMATCH[1]}"
19
- date="${BASH_REMATCH[2]}"
20
- notes="$(echo "${BASH_REMATCH[3]}" | sed -n -e '/^## [0-9]\+\.[0-9]\+\.[0-9]\+/,$!p')"
21
-
22
- dist="libmaxminddb-$version.tar.gz"
23
-
24
- if [[ "$date" != $(date +"%Y-%m-%d") ]]; then
25
- echo "$date is not today!"
26
- exit 1
27
- fi
28
-
29
- if [ -n "$(git status --porcelain)" ]; then
30
- echo ". is not clean." >&2
31
- exit 1
32
- fi
33
-
34
- old_version=$(perl -MFile::Slurp=read_file <<EOF
35
- use v5.16;
36
- my \$conf = read_file(q{configure.ac});
37
- \$conf =~ /AC_INIT.+\[(\d+\.\d+\.\d+)\]/;
38
- say \$1;
39
- EOF
40
- )
41
-
42
- perl -MFile::Slurp=edit_file -e \
43
- "edit_file { s/\Q$old_version/$version/g } \$_ for qw( configure.ac include/maxminddb.h )"
44
-
45
- if [ -n "$(git status --porcelain)" ]; then
46
- git add configure.ac include/maxminddb.h
47
- git commit -m "Bumped version to $version"
48
- fi
49
-
50
- ./bootstrap
51
- ./configure
52
- make
53
- make check
54
- make clean
55
- make safedist
56
-
57
- if [ ! -d .gh-pages ]; then
58
- echo "Checking out gh-pages in .gh-pages"
59
- git clone -b gh-pages git@github.com:maxmind/libmaxminddb.git .gh-pages
60
- pushd .gh-pages
61
- else
62
- echo "Updating .gh-pages"
63
- pushd .gh-pages
64
- git pull
65
- fi
66
-
67
- if [ -n "$(git status --porcelain)" ]; then
68
- echo ".gh-pages is not clean" >&2
69
- exit 1
70
- fi
71
-
72
- index=index.md
73
- cat <<EOF > $index
74
- ---
75
- layout: default
76
- title: libmaxminddb - a library for working with MaxMind DB files
77
- version: $version
78
- ---
79
- EOF
80
-
81
- cat ../doc/libmaxminddb.md >> $index
82
-
83
- mmdblookup=mmdblookup.md
84
- cat <<EOF > $mmdblookup
85
- ---
86
- layout: default
87
- title: mmdblookup - a utility to look up an IP address in a MaxMind DB file
88
- version: $version
89
- ---
90
- EOF
91
-
92
- cat ../doc/mmdblookup.md >> $mmdblookup
93
-
94
- git commit -m "Updated for $version" -a
95
-
96
- read -p "Push to origin? (y/n) " should_push
97
-
98
- if [ "$should_push" != "y" ]; then
99
- echo "Aborting"
100
- exit 1
101
- fi
102
-
103
- git push
104
-
105
- popd
106
-
107
- git push
108
-
109
- message="$version
110
-
111
- $notes"
112
-
113
- hub release create -a "$dist" -m "$message" "$version"
@@ -1,21 +0,0 @@
1
- #!/bin/sh
2
-
3
- uncrustify="uncrustify -c .uncrustify.cfg --replace --no-backup"
4
-
5
- # We indent each thing twice because uncrustify is not idempotent - in some
6
- # cases it will flip-flop between two indentation styles.
7
- for dir in bin include src t; do
8
- c_files=`find $dir -maxdepth 1 -name '*.c'`
9
- if [ "$c_files" != "" ]; then
10
- $uncrustify $dir/*.c;
11
- $uncrustify $dir/*.c;
12
- fi
13
-
14
- h_files=`find $dir -maxdepth 1 -name '*.h'`
15
- if [ "$h_files" != "" ]; then
16
- $uncrustify $dir/*.h;
17
- $uncrustify $dir/*.h;
18
- fi
19
- done
20
-
21
- ./dev-bin/regen-prototypes.pl
@@ -1,53 +0,0 @@
1
- #!/usr/bin/env perl
2
-
3
- # Note to run this you will probably want to build with ./configure
4
- # --disable-shared. You don't want to valgrind the libtool script.
5
- #
6
- # Also make sure you compile the tests first (`make check').
7
-
8
- use strict;
9
- use warnings;
10
-
11
- use File::Basename qw( basename );
12
- use FindBin qw( $Bin );
13
- use IPC::Run3;
14
-
15
- my $top_dir = "$Bin/..";
16
-
17
- my $output;
18
-
19
- my @tests;
20
- push @tests, glob "$top_dir/t/*_t";
21
- push @tests, glob "$top_dir/t/*-t";
22
-
23
- my @mmdblookup = (
24
- "$top_dir/bin/mmdblookup",
25
- '--file', "$top_dir/t/maxmind-db/test-data/MaxMind-DB-test-decoder.mmdb",
26
- '--ip',
27
- );
28
-
29
- # We want IPv4 and IPv6 addresses - one of each that exists in the db and one
30
- # that doesn't
31
- my @ips = ( '1.1.1.1', '10.0.0.0', 'abcd::', '0900::' );
32
-
33
- my @cmds = (
34
- ( map { [ @mmdblookup, $_ ] } @ips ),
35
- ( map { [$_] } @tests ),
36
- );
37
-
38
- for my $cmd (@cmds) {
39
- my $output;
40
- run3(
41
- [ qw( valgrind -v --leak-check=full --show-leak-kinds=all -- ), @{$cmd} ],
42
- \undef,
43
- \$output,
44
- \$output,
45
- );
46
-
47
- $output =~ s/^(?!=).*\n//mg;
48
-
49
- my $marker = '-' x 60;
50
- print $marker, "\n", ( join q{ }, basename( shift @{$cmd} ), @{$cmd} ),
51
- "\n", $marker, "\n", $output,
52
- "\n\n";
53
- }