diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index f4a3169..cafb47a 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -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 diff --git a/README.md b/README.md index 8ec4b79..baf95aa 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ 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 ``` @@ -27,7 +28,7 @@ $ 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 diff --git a/ext/ilios/extconf.rb b/ext/ilios/extconf.rb index b812559..d3aada6 100644 --- a/ext/ilios/extconf.rb +++ b/ext/ilios/extconf.rb @@ -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 @@ -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}") @@ -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