@@ -22,35 +22,39 @@ def do_help
22
22
23
23
# Make sure to check the ports path for the configured host
24
24
host = RbConfig ::CONFIG [ 'host' ]
25
- project_dir = File . join ( [ '..' ] * 4 )
25
+ project_dir = File . expand_path ( "../../.." , __FILE__ )
26
26
freetds_ports_dir = File . join ( project_dir , 'ports' , host , 'freetds' , FREETDS_VERSION )
27
27
freetds_ports_dir = File . expand_path ( freetds_ports_dir )
28
28
29
29
# Add all the special path searching from the original tiny_tds build
30
- # order is important here! First in, last searched.
30
+ # order is important here! First in, first searched.
31
31
DIRS = %w(
32
- /usr/local
33
32
/opt/local
33
+ /usr/local
34
34
)
35
35
36
+ # Add the ports directory if it exists for local developer builds
37
+ DIRS . unshift ( freetds_ports_dir ) if File . directory? ( freetds_ports_dir )
38
+
36
39
# Grab freetds environment variable for use by people on services like
37
40
# Heroku who they can't easily use bundler config to set directories
38
- DIRS . push ( ENV [ 'FREETDS_DIR' ] ) if ENV . has_key? ( 'FREETDS_DIR' )
39
-
40
- # Add the ports directory if it exists for local developer builds
41
- DIRS . push ( freetds_ports_dir ) if File . directory? ( freetds_ports_dir )
41
+ DIRS . unshift ( ENV [ 'FREETDS_DIR' ] ) if ENV . has_key? ( 'FREETDS_DIR' )
42
42
43
43
# Add the search paths for freetds configured above
44
- DIRS . each do |path |
45
- idir = "#{ path } /include"
44
+ ldirs = DIRS . flat_map do |path |
46
45
ldir = "#{ path } /lib"
46
+ [ ldir , "#{ ldir } /freetds" ]
47
+ end
47
48
48
- dir_config ( 'freetds' ,
49
- [ idir , "#{ idir } /freetds" ] ,
50
- [ ldir , "#{ ldir } /freetds" ]
51
- )
49
+ idirs = DIRS . flat_map do |path |
50
+ idir = "#{ path } /include"
51
+ [ idir , "#{ idir } /freetds" ]
52
52
end
53
53
54
+ puts "looking for freetds headers in the following directories:\n #{ idirs . map { |a | " - #{ a } \n " } . join } "
55
+ puts "looking for freetds library in the following directories:\n #{ ldirs . map { |a | " - #{ a } \n " } . join } "
56
+ dir_config ( 'freetds' , idirs , ldirs )
57
+
54
58
have_dependencies = [
55
59
find_header ( 'sybfront.h' ) ,
56
60
find_header ( 'sybdb.h' ) ,
0 commit comments