@@ -48,47 +48,29 @@ def configure_system_libraries
4848 end
4949
5050 def configure_packaged_libraries
51- minimal_recipe . tap do |recipe |
52- recipe . configure_options += [ "--enable-shared=no" , "--enable-static=yes" ]
53- ENV . to_h . tap do |env |
54- user_cflags = with_config ( "sqlite-cflags" )
55- more_cflags = [
56- "-fPIC" , # needed for linking the static library into a shared library
57- "-O2" , # see https://github.com/sparklemotion/sqlite3-ruby/issues/335 for some benchmarks
58- "-fvisibility=hidden" , # see https://github.com/rake-compiler/rake-compiler-dock/issues/87
59- ]
60- env [ "CFLAGS" ] = [ user_cflags , env [ "CFLAGS" ] , more_cflags ] . flatten . join ( " " )
61- recipe . configure_options += env . select { |k , v | ENV_ALLOWLIST . include? ( k ) }
62- . map { |key , value | "#{ key } =#{ value . strip } " }
63- end
64-
65- unless File . exist? ( File . join ( recipe . target , recipe . host , recipe . name , recipe . version ) )
66- recipe . cook
67- end
68- recipe . activate
69-
70- # on macos, pkg-config will not return --cflags without this
71- ENV [ "PKG_CONFIG_ALLOW_SYSTEM_CFLAGS" ] = "t"
72-
73- # only needed for Ruby 3.1.3, see https://bugs.ruby-lang.org/issues/19233
74- RbConfig ::CONFIG [ "PKG_CONFIG" ] = config_string ( "PKG_CONFIG" ) || "pkg-config"
51+ recipe = minimal_recipe
52+
53+ recipe . configure_options += [ "--enable-shared=no" , "--enable-static=yes" ]
54+ ENV . to_h . tap do |env |
55+ user_cflags = with_config ( "sqlite-cflags" )
56+ more_cflags = [
57+ "-fPIC" , # needed for linking the static library into a shared library
58+ "-O2" , # see https://github.com/sparklemotion/sqlite3-ruby/issues/335 for some benchmarks
59+ "-fvisibility=hidden" , # see https://github.com/rake-compiler/rake-compiler-dock/issues/87
60+ ]
61+ env [ "CFLAGS" ] = [ user_cflags , env [ "CFLAGS" ] , more_cflags ] . flatten . join ( " " )
62+ recipe . configure_options += env . select { |k , v | ENV_ALLOWLIST . include? ( k ) }
63+ . map { |key , value | "#{ key } =#{ value . strip } " }
64+ end
7565
76- lib_path = File . join ( recipe . path , "lib" )
77- pcfile = File . join ( lib_path , "pkgconfig" , "sqlite3.pc" )
78- abort_pkg_config ( "pkg_config" ) unless pkg_config ( pcfile )
66+ unless File . exist? ( File . join ( recipe . target , recipe . host , recipe . name , recipe . version ) )
67+ recipe . cook
68+ end
7969
80- # see https://bugs.ruby-lang.org/issues/18490
81- ldflags = xpopen ( [ "pkg-config" , "--libs" , "--static" , pcfile ] , err : [ :child , :out ] , &:read )
82- abort_pkg_config ( "xpopen" ) unless $?. success?
83- ldflags = ldflags . split
70+ lib_path = File . join ( recipe . path , "lib" )
71+ pcfile = File . join ( lib_path , "pkgconfig" , "sqlite3.pc" )
8472
85- # see https://github.com/flavorjones/mini_portile/issues/118
86- "-L#{ lib_path } " . tap do |lib_path_flag |
87- ldflags . prepend ( lib_path_flag ) unless ldflags . include? ( lib_path_flag )
88- end
89-
90- ldflags . each { |ldflag | append_ldflags ( ldflag ) }
91- end
73+ MiniPortile . activate_mkmf ( pkgconf : pcfile )
9274 end
9375
9476 def configure_extension
0 commit comments