Skip to content

Commit

Permalink
Allow developers to disable default includes and libs paths
Browse files Browse the repository at this point in the history
Due to a mismatch between the GCC we use for our project, and the new
version delivered on Ubuntu 22.04, our bundle started failing. I traced
the issue to GCC being called with `-I/usr/include`. By adding
`--without-default-header-paths` to the gem install call make it work
for us.
  • Loading branch information
kalbasit committed Jun 17, 2022
1 parent 24b1cdf commit 8096d2f
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions ext/proj4_c_impl/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@

require "mkmf"

header_dirs_ =
[
::RbConfig::CONFIG["includedir"],
with_default_header_paths = with_config("default-header-paths", default = true)
with_default_lib_paths = with_config("default-lib-paths", default = true)

header_dirs_ = [ ::RbConfig::CONFIG["includedir"] ]
if with_default_header_paths
header_dirs_.push(
"/usr/local/include",
"/usr/local/proj/include",
"/usr/local/proj4/include",
Expand All @@ -24,10 +27,12 @@
"/opt/include",
"/Library/Frameworks/PROJ.framework/unix/include",
"/usr/include"
]
lib_dirs_ =
[
::RbConfig::CONFIG["libdir"],
)
end

lib_dirs_ = [ ::RbConfig::CONFIG["libdir"] ]
if with_default_lib_paths
lib_dirs_.push(
"/usr/local/lib",
"/usr/local/lib64",
"/usr/local/proj/lib",
Expand All @@ -39,7 +44,9 @@
"/Library/Frameworks/PROJ.framework/unix/lib",
"/usr/lib",
"/usr/lib64"
]
)
end

header_dirs_.delete_if { |path_| !::File.directory?(path_) }
lib_dirs_.delete_if { |path_| !::File.directory?(path_) }

Expand Down

0 comments on commit 8096d2f

Please sign in to comment.