rgeo-proj4 3.1.1 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b578b226ebc3b376a92f58cf080d34f237b5929751e6b856e493d9b6a6daa1ae
4
- data.tar.gz: 84f4953ac2aea3783e7a807542c7aaf102b265dc454a9de97c340d70f04685c1
3
+ metadata.gz: 62f388f5389751fb4be6fd44e37b436c2a3465dc407346cb8c311c839af0e35f
4
+ data.tar.gz: 259d631dcf07572b4a99de70cef87156ea880bc2db54aeaea9cf6db4530772ed
5
5
  SHA512:
6
- metadata.gz: bb2bddfdc101da5c0a4b2af5d5445ce7e57f8d49505b5bb2f53376e81b5ed392d4d2183c11e6cc1e0d86fc5b2fc83cc1afe1d6a3c72fcf8924d779fbd04fdffb
7
- data.tar.gz: 3f21328f3beff54191cf496f784a432185f9999d4b71ddeab91d772627f26bbc97deb1882cab9d9f997d16432993d2c742c3d2638005d2f372959428201f4e05
6
+ metadata.gz: c48f8cb2676bbc08309a6c103b7df1c7f121e586b300357bc278bccc3dcdfb72f597b9e89bf11603a749a329910685ee93adf719ab4f47db7b3676a9290911ac
7
+ data.tar.gz: 623d1af171edc6e69bc1d8967d9b9262f2a96dd560fcaa6cc5982be75d1e4d4177957255fd28895230c4645cc1ed778a0f77354d3b0b30d031cda8d9bc984687
@@ -0,0 +1,33 @@
1
+ #ifndef RGEO_PROJ4_ERRORS_INCLUDED
2
+ #define RGEO_PROJ4_ERRORS_INCLUDED
3
+
4
+ #include <ruby.h>
5
+
6
+ #include "preface.h"
7
+
8
+ #ifdef RGEO_PROJ4_SUPPORTED
9
+
10
+ #include "errors.h"
11
+
12
+ RGEO_BEGIN_C
13
+
14
+ VALUE error_module;
15
+ VALUE rb_eRGeoError;
16
+ VALUE rb_eRGeoInvalidProjectionError;
17
+
18
+ void rgeo_init_proj_errors() {
19
+ VALUE rgeo_module;
20
+
21
+ rgeo_module = rb_define_module("RGeo");
22
+ error_module = rb_define_module_under(rgeo_module, "Error");
23
+ rb_eRGeoError =
24
+ rb_define_class_under(error_module, "RGeoError", rb_eRuntimeError);
25
+ rb_eRGeoInvalidProjectionError =
26
+ rb_define_class_under(error_module, "InvalidProjection", rb_eRGeoError);
27
+ }
28
+
29
+ RGEO_END_C
30
+
31
+ #endif // RGEO_PROJ4_SUPPORTED
32
+
33
+ #endif // RGEO_GEOS_ERROS_INCLUDED
@@ -0,0 +1,22 @@
1
+ #ifndef RGEO_PROJ4_ERRORS_INCLUDED
2
+ #define RGEO_PROJ4_ERRORS_INCLUDED
3
+
4
+ #include <ruby.h>
5
+
6
+ #ifdef RGEO_PROJ4_SUPPORTED
7
+
8
+ RGEO_BEGIN_C
9
+
10
+ extern VALUE error_module;
11
+ // Main rgeo error type
12
+ extern VALUE rb_eRGeoError;
13
+ // RGeo::Error::InvalidProjection
14
+ extern VALUE rb_eRGeoInvalidProjectionError;
15
+
16
+ void rgeo_init_proj_errors();
17
+
18
+ RGEO_END_C
19
+
20
+ #endif // RGEO_PROJ4_SUPPORTED
21
+
22
+ #endif // RGEO_PROJ4_ERRORS_INCLUDED
@@ -12,7 +12,18 @@ else
12
12
 
13
13
  require "mkmf"
14
14
 
15
- header_dirs_ =
15
+ if ENV.key?("DEBUG") || ENV.key?("MAINTAINER_MODE")
16
+ $CFLAGS << " -DDEBUG" \
17
+ " -Wall" \
18
+ " -ggdb" \
19
+ " -pedantic" \
20
+ " -std=c17"
21
+
22
+ extra_flags = ENV.fetch("MAINTAINER_MODE", ENV.fetch("DEBUG", ""))
23
+ $CFLAGS << " " << extra_flags if extra_flags.strip.start_with?("-")
24
+ end
25
+
26
+ header_dirs =
16
27
  [
17
28
  ::RbConfig::CONFIG["includedir"],
18
29
  "/usr/local/include",
@@ -26,7 +37,7 @@ else
26
37
  "/Library/Frameworks/PROJ.framework/unix/include",
27
38
  "/usr/include"
28
39
  ]
29
- lib_dirs_ =
40
+ lib_dirs =
30
41
  [
31
42
  ::RbConfig::CONFIG["libdir"],
32
43
  "/usr/local/lib",
@@ -42,28 +53,65 @@ else
42
53
  "/usr/lib",
43
54
  "/usr/lib64"
44
55
  ]
45
- header_dirs_.delete_if { |path_| !::File.directory?(path_) }
46
- lib_dirs_.delete_if { |path_| !::File.directory?(path_) }
56
+ header_dirs.delete_if { |path| !::File.directory?(path) }
57
+ lib_dirs.delete_if { |path| !::File.directory?(path) }
47
58
 
48
- found_proj_ = false
49
- header_dirs_, lib_dirs_ = dir_config("proj", header_dirs_, lib_dirs_)
59
+ found_proj = false
60
+ found_valid_proj_version = false
61
+ header_dirs, lib_dirs = dir_config("proj", header_dirs, lib_dirs)
50
62
  if have_header("proj.h")
51
63
  $libs << " -lproj"
64
+ found_proj = true
52
65
 
53
- if have_func("proj_create", "proj.h")
54
- found_proj_ = true
55
- have_func("proj_create_crs_to_crs_from_pj", "proj.h")
56
- have_func("proj_normalize_for_visualization", "proj.h")
57
- else
58
- $libs.gsub!(" -lproj", "")
66
+ required_proj_funcs = %w[
67
+ proj_create
68
+ proj_create_crs_to_crs_from_pj
69
+ proj_normalize_for_visualization
70
+ ]
71
+ found_valid_proj_version = required_proj_funcs.all? do |func|
72
+ have_func(func, "proj.h")
59
73
  end
60
74
  end
61
75
  have_func("rb_gc_mark_movable")
62
76
 
63
- unless found_proj_
64
- puts "**** WARNING: Unable to find Proj headers or Proj version is too old."
65
- puts "**** Compiling without Proj support."
77
+ unless found_proj
78
+
79
+ install_text = case RUBY_PLATFORM
80
+ when /linux/
81
+ %(
82
+ Please install proj like so:
83
+ apt-get install libproj-dev proj-bin
84
+ )
85
+ when /darwin/
86
+ %(
87
+ Please install proj like so:
88
+ brew install proj
89
+ )
90
+ else
91
+ %(
92
+ Please install proj.
93
+ )
94
+ end
95
+ error_msg = %(
96
+ **** WARNING: Unable to find Proj headers. Ensure that Proj is properly installed.
97
+
98
+ #{install_text}
99
+
100
+ or set the path manually using:
101
+ --with-proj-dir or with the --with-proj-include and --with-proj-lib options
102
+ )
103
+ warn error_msg
104
+ raise
66
105
  end
67
- create_makefile("rgeo/coord_sys/proj4_c_impl")
68
106
 
107
+ unless found_valid_proj_version
108
+ error_msg = %(
109
+ **** WARNING: The found Proj version is not new enough to be used for this version of rgeo-proj4.
110
+ **** Proj 6.2+ is required.
111
+ )
112
+ warn error_msg
113
+ raise
114
+ end
115
+
116
+ create_makefile("rgeo/coord_sys/proj4_c_impl")
69
117
  end