Skip to content

Commit

Permalink
Update installer in order to specify libuv install dir
Browse files Browse the repository at this point in the history
  • Loading branch information
Watson1978 committed Feb 5, 2024
1 parent ecede20 commit d184c7b
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions ext/ilios/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ module CassandraDriverInstaller

class CassandraRecipe < MiniPortileCMake
def initialize(name, version, **kwargs)
ENV['LIBUV_ROOT_DIR'] = LibuvInstaller.special_install_path
ENV['LIBUV_ROOT_DIR'] ||= LibuvInstaller.special_install_path

super(name, version, **kwargs)
end
Expand All @@ -99,23 +99,9 @@ def configure_prefix
end

def self.install
return if install_from_package

install_from_source
end

def self.install_from_package
# Install Cassandra C/C++ driver via MiniPortile2.
# It doesn't provide pre-built package in some official repository.
return unless NativePackageInstaller.install(homebrew: 'cassandra-cpp-driver')

path = `brew --prefix cassandra-cpp-driver`.strip
$CPPFLAGS += " -I#{path}/include"
$LDFLAGS += " -L#{path}/lib -Wl,-rpath,#{path}/lib -lcassandra"

true
end

def self.install_from_source
unless File.exist?(CASSANDRA_CPP_DRIVER_INSTALL_PATH)
cassandra_recipe = CassandraRecipe.new('cpp-driver', Ilios::CASSANDRA_CPP_DRIVER_VERSION, make_command: "make -j #{num_cpu_cores}")
Expand Down Expand Up @@ -158,7 +144,13 @@ def self.install_from_source
raise
end

LibuvInstaller.install
if (dir = with_config('--with-libuv-dir'))
$CPPFLAGS += " -I#{dir}/include"
$LDFLAGS += " -L#{dir}/lib -Wl,-rpath,#{dir}/lib -luv"
ENV['LIBUV_ROOT_DIR'] = dir
else
LibuvInstaller.install
end
CassandraDriverInstaller.install
end

Expand Down

0 comments on commit d184c7b

Please sign in to comment.