1- require ' mkmf'
2- require_relative ' extconsts'
3-
4- if ENV [ ' MAINTAINER_MODE' ]
5- $stderr . puts "Maintainer mode enabled."
6- $CFLAGS <<
7- ' -Wall' <<
8- ' -ggdb' <<
9- ' -DDEBUG' <<
10- ' -pedantic'
11- $LDFLAGS <<
12- ' -ggdb'
1+ require " mkmf"
2+ require_relative " extconsts"
3+
4+ if ENV [ " MAINTAINER_MODE" ]
5+ warn "Maintainer mode enabled."
6+ $CFLAGS <<
7+ " -Wall" <<
8+ " -ggdb" <<
9+ " -DDEBUG" <<
10+ " -pedantic"
11+ $LDFLAGS <<
12+ " -ggdb"
1313end
1414
15- if gem_platform = with_config ( "cross-build" )
16- require ' mini_portile2'
15+ if gem_platform = with_config ( "cross-build" )
16+ require " mini_portile2"
1717
1818 openssl_platform = with_config ( "openssl-platform" )
1919
@@ -23,7 +23,7 @@ class BuildRecipe < MiniPortile
2323 def initialize ( name , version , files )
2424 super ( name , version )
2525 self . files = files
26- rootdir = File . expand_path ( ' ../../..' , __FILE__ )
26+ rootdir = File . expand_path ( " ../../.." , __FILE__ )
2727 self . target = File . join ( rootdir , "ports" )
2828 self . patch_files = Dir [ File . join ( "patches" , self . name , self . version , "*.patch" ) ] . sort
2929 end
@@ -34,35 +34,35 @@ def port_path
3434 end
3535
3636 def cook_and_activate
37- checkpoint = File . join ( self . target , "#{ self . name } -#{ self . version } -#{ gem_platform } .installed" )
38-
37+ checkpoint = File . join ( target , "#{ name } -#{ version } -#{ gem_platform } .installed" )
38+
3939 unless File . exist? ( checkpoint )
40- self . cook
41- FileUtils . touch checkpoint
42- end
43-
44- self . activate
40+ cook
41+ FileUtils . touch checkpoint
42+ end
43+
44+ activate
4545 self
4646 end
4747 end
4848
4949 openssl_recipe = BuildRecipe . new ( "openssl" , OPENSSL_VERSION , [ OPENSSL_SOURCE_URI ] ) . tap do |recipe |
50- class << recipe
50+ class << recipe
5151 attr_accessor :openssl_platform
52-
52+
5353 def configure
5454 envs = [ ]
5555 envs << "CFLAGS=-DDSO_WIN32 -DOPENSSL_THREADS" if MiniPortile . windows?
5656 envs << "CFLAGS=-fPIC -DOPENSSL_THREADS" if MiniPortile . linux?
57- execute ( ' configure' , [ ' env' , *envs , "./Configure" , openssl_platform , "threads" , "-static" , "CROSS_COMPILE=#{ host } -" , configure_prefix , "--libdir=lib" ] , altlog : "config.log" )
57+ execute ( " configure" , [ " env" , *envs , "./Configure" , openssl_platform , "threads" , "-static" , "CROSS_COMPILE=#{ host } -" , configure_prefix , "--libdir=lib" ] , altlog : "config.log" )
5858 end
59-
59+
6060 def compile
61- execute ( ' compile' , "#{ make_cmd } build_libs" )
61+ execute ( " compile" , "#{ make_cmd } build_libs" )
6262 end
63-
63+
6464 def install
65- execute ( ' install' , "#{ make_cmd } install_dev" )
65+ execute ( " install" , "#{ make_cmd } install_dev" )
6666 end
6767 end
6868
@@ -124,28 +124,28 @@ def configure_defaults
124124 # enable relative path to later load the FreeTDS shared library
125125 $LDFLAGS << " '-Wl,-rpath=$$ORIGIN/../../../ports/#{ gem_platform } /lib'"
126126
127- dir_config ( ' freetds' , "#{ freetds_recipe . path } /include" , "#{ freetds_recipe . path } /lib" )
127+ dir_config ( " freetds" , "#{ freetds_recipe . path } /include" , "#{ freetds_recipe . path } /lib" )
128128else
129129 # Make sure to check the ports path for the configured host
130- architecture = RbConfig ::CONFIG [ ' arch' ]
130+ architecture = RbConfig ::CONFIG [ " arch" ]
131131
132132 project_dir = File . expand_path ( "../../.." , __FILE__ )
133- freetds_ports_dir = File . join ( project_dir , ' ports' , architecture , ' freetds' , FREETDS_VERSION )
133+ freetds_ports_dir = File . join ( project_dir , " ports" , architecture , " freetds" , FREETDS_VERSION )
134134 freetds_ports_dir = File . expand_path ( freetds_ports_dir )
135-
135+
136136 # Add all the special path searching from the original tiny_tds build
137137 # order is important here! First in, first searched.
138- DIRS = %w(
138+ DIRS = %w[
139139 /opt/local
140140 /usr/local
141- )
141+ ]
142142
143- if RbConfig ::CONFIG [ ' host_os' ] =~ /darwin/i
143+ if /darwin/i . match? ( RbConfig ::CONFIG [ " host_os" ] )
144144 # Ruby below 2.7 seems to label the host CPU on Apple Silicon as aarch64
145145 # 2.7 and above print is as ARM64
146- target_host_cpu = Gem ::Version . new ( RUBY_VERSION ) < Gem ::Version . new ( ' 2.7' ) ? ' aarch64' : ' arm64'
146+ target_host_cpu = ( Gem ::Version . new ( RUBY_VERSION ) < Gem ::Version . new ( " 2.7" ) ) ? " aarch64" : " arm64"
147147
148- if RbConfig ::CONFIG [ ' host_cpu' ] == target_host_cpu
148+ if RbConfig ::CONFIG [ " host_cpu" ] == target_host_cpu
149149 # Homebrew on Apple Silicon installs into /opt/hombrew
150150 # https://docs.brew.sh/Installation
151151 # On Intel Macs, it is /usr/local, so no changes necessary to DIRS
@@ -162,7 +162,7 @@ def configure_defaults
162162
163163 # Grab freetds environment variable for use by people on services like
164164 # Heroku who they can't easily use bundler config to set directories
165- DIRS . unshift ( ENV [ ' FREETDS_DIR' ] ) if ENV . has_key? ( ' FREETDS_DIR' )
165+ DIRS . unshift ( ENV [ " FREETDS_DIR" ] ) if ENV . has_key? ( " FREETDS_DIR" )
166166
167167 # Add the search paths for freetds configured above
168168 ldirs = DIRS . flat_map do |path |
@@ -175,15 +175,15 @@ def configure_defaults
175175 [ idir , "#{ idir } /freetds" ]
176176 end
177177
178- puts "looking for freetds headers in the following directories:\n #{ idirs . map { |a | " - #{ a } \n " } . join } "
179- puts "looking for freetds library in the following directories:\n #{ ldirs . map { |a | " - #{ a } \n " } . join } "
180- dir_config ( ' freetds' , idirs , ldirs )
178+ puts "looking for freetds headers in the following directories:\n #{ idirs . map { |a | " - #{ a } \n " } . join } "
179+ puts "looking for freetds library in the following directories:\n #{ ldirs . map { |a | " - #{ a } \n " } . join } "
180+ dir_config ( " freetds" , idirs , ldirs )
181181end
182182
183- find_header ( ' sybfront.h' ) or abort "Can't find the 'sybfront.h' header"
184- find_header ( ' sybdb.h' ) or abort "Can't find the 'sybdb.h' header"
183+ find_header ( " sybfront.h" ) or abort "Can't find the 'sybfront.h' header"
184+ find_header ( " sybdb.h" ) or abort "Can't find the 'sybdb.h' header"
185185
186- unless have_library ( ' sybdb' , ' dbanydatecrack' )
186+ unless have_library ( " sybdb" , " dbanydatecrack" )
187187 abort "Failed! Do you have FreeTDS 1.0.0 or higher installed?"
188188end
189189
0 commit comments