File: extconf.rb

package info (click to toggle)
obexftp 0.24.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 792 kB
  • sloc: ansic: 7,735; ruby: 229; sh: 89; perl: 43; makefile: 39; python: 16
file content (39 lines) | stat: -rw-r--r-- 1,040 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env ruby

require 'mkmf'

# hack 1: ruby black magic to write a Makefile.new instead of a Makefile
alias open_orig open
def open(path, mode=nil, perm=nil)
  path = 'Makefile.new' if path == 'Makefile'
  if block_given?
    open_orig(path, mode, perm) { |io| yield(io) }
  else
    open_orig(path, mode, perm)
  end
end

if ENV['PREFIX']
  prefix = CONFIG['prefix']
  %w[ prefix sitedir datadir infodir mandir oldincludedir ].each do |key|
    CONFIG[key] = CONFIG[key].sub(/#{prefix}/, ENV['PREFIX'])
  end
end

dir_config('obexftp')
if have_library('openobex', 'OBEX_Init') and
   find_library('bfb', 'bfb_io_open', '../../bfb/.libs') and
   find_library('multicobex', 'cobex_ctrans', '../../multicobex/.libs') and
   find_library('obexftp', 'obexftp_open', '../../obexftp/.libs')
  create_makefile('obexftp')

  # hack 2: strip all rpath references
  open('Makefile.ruby', 'w') do |out|
    IO.foreach('Makefile.new') do |line|
      out.puts line.gsub(/-Wl,-R'[^']*'/, '')
    end
  end
else
  puts 'obex libs not found'
end