Skip to content

Commit

Permalink
Update installer in order to specify libuv install dir (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
Watson1978 authored Feb 5, 2024
1 parent ecede20 commit 4fd9384
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 19 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,5 @@ jobs:
bundler-cache: true
- name: Prepare tests
run: bundle exec rake compile
- name: Wait until Cassandra is stable
run: sleep 30
- name: Run tests
run: bundle exec rake test
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ This gem's installer will install the DataStax C/C++ Driver to the appropriate l
However, if you prefer to install the DataStax C/C++ Driver manually, you can do so by executing:

```sh
$ bundle config set --local build.ilios --with-libuv-dir=/path/to/libuv-installed-dir
$ bundle config set --local build.ilios --with-cassandra-driver-dir=/path/to/cassandra-cpp-driver-installed-dir
$ bundle add ilios
```

or

```sh
$ gem install ilios -- --with-cassandra-driver-dir=/path/to/cassandra-cpp-driver-installed-dir
$ gem install ilios -- --with-libuv-dir=/path/to/libuv-installed-dir --with-cassandra-driver-dir=/path/to/cassandra-cpp-driver-installed-dir
```

## Requirements
Expand Down
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 4fd9384

Please sign in to comment.