Sha256: e67fec06d7eef0d4b53fabffff066fa05c7ffda39a7818c6b50680f2d8dd1baa

Contents?: true

Size: 1.89 KB

Versions: 11

Compression:

Stored size: 1.89 KB

Contents

# Workaround to make Rubygems believe it builds a native gem

def emulate_extension_install(extension_name)
  File.open('Makefile', 'w') { |f| f.write "all:\n\ninstall:\n\n" }
  File.open('make', 'w') do |f|
    f.write '#!/bin/sh'
    f.chmod f.stat.mode | 0111
  end
  File.open(extension_name + '.so', 'w') {}
  File.open(extension_name + '.dll', 'w') {}
  File.open('nmake.bat', 'w') { |f| }
end

emulate_extension_install('fsevent')


# Compile the actual fsevent_sleep binary

if `uname -s`.chomp == 'Darwin'
  gem_root = File.expand_path(File.join('..', '..'))
  darwin_version = `uname -r`.to_i
  sdk_version = darwin_version < 20 ? "10.#{darwin_version - 4}" : darwin_version - 9

  `mkdir -p #{File.join(gem_root, 'bin')}`
  if ENV.has_key?('FSEVENT_SLEEP')
    require 'fileutils'
    FileUtils.cp(ENV['FSEVENT_SLEEP'], "#{gem_root}/bin/fsevent_sleep", :preserve => true)
    fail "Installation of fsevent_sleep binary failed - see README for assistance" unless File.executable?("#{gem_root}/bin/fsevent_sleep")
  elsif File.exist?('/Developer/Applications/Xcode.app')
    `CFLAGS='-isysroot /Developer/SDKs/MacOSX#{sdk_version}.sdk -mmacosx-version-min=#{sdk_version}' /usr/bin/gcc -framework CoreServices -o "#{gem_root}/bin/fsevent_sleep" fsevent_sleep.c`
    fail "Compilation of fsevent_sleep binary failed - see README for assistance" unless File.executable?("#{gem_root}/bin/fsevent_sleep")
  elsif File.exist?('/Applications/Xcode.app') # Xcode 4.3
    `CFLAGS='-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX#{sdk_version}.sdk -mmacosx-version-min=#{sdk_version}' /usr/bin/gcc -framework CoreServices -o "#{gem_root}/bin/fsevent_sleep" fsevent_sleep.c`
    fail "Compilation of fsevent_sleep binary failed - see README for assistance" unless File.executable?("#{gem_root}/bin/fsevent_sleep")
  else
    fail "Xcode not found - see README for assistance"
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
autotest-fsevent-0.2.22 ext/fsevent/extconf.rb
cloudsmith-api-2.0.16 vendor/bundle/ruby/2.6.0/gems/autotest-fsevent-0.2.21/ext/fsevent/extconf.rb
cloudsmith-api-2.0.15 vendor/bundle/ruby/2.6.0/gems/autotest-fsevent-0.2.21/ext/fsevent/extconf.rb
cloudsmith-api-2.0.14 vendor/bundle/ruby/2.6.0/gems/autotest-fsevent-0.2.21/ext/fsevent/extconf.rb
cloudsmith-api-2.0.13 vendor/bundle/ruby/2.6.0/gems/autotest-fsevent-0.2.21/ext/fsevent/extconf.rb
cloudsmith-api-2.0.12 vendor/bundle/ruby/2.6.0/gems/autotest-fsevent-0.2.21/ext/fsevent/extconf.rb
cloudsmith-api-2.0.11 vendor/bundle/ruby/2.6.0/gems/autotest-fsevent-0.2.21/ext/fsevent/extconf.rb
cloudsmith-api-2.0.10 vendor/bundle/ruby/2.6.0/gems/autotest-fsevent-0.2.21/ext/fsevent/extconf.rb
cloudsmith-api-2.0.9 vendor/bundle/ruby/2.6.0/gems/autotest-fsevent-0.2.21/ext/fsevent/extconf.rb
cloudsmith-api-2.0.8 vendor/bundle/ruby/2.6.0/gems/autotest-fsevent-0.2.21/ext/fsevent/extconf.rb
autotest-fsevent-0.2.21 ext/fsevent/extconf.rb