@@ -45,6 +45,16 @@ def sqlcipher?
45
45
def configure_system_libraries
46
46
pkg_config ( libname )
47
47
append_cppflags ( "-DUSING_SQLCIPHER" ) if sqlcipher?
48
+
49
+ if find_header ( "sqlite3.h" )
50
+ # noop
51
+ elsif sqlcipher? && find_header ( "sqlcipher/sqlite3.h" )
52
+ append_cppflags ( "-DUSING_SQLCIPHER_INC_SUBDIR" )
53
+ else
54
+ abort_could_not_find ( "sqlite3.h" )
55
+ end
56
+
57
+ abort_could_not_find ( libname ) unless find_library ( libname , "sqlite3_libversion_number" , "sqlite3.h" )
48
58
end
49
59
50
60
def configure_packaged_libraries
@@ -65,29 +75,9 @@ def configure_packaged_libraries
65
75
unless File . exist? ( File . join ( recipe . target , recipe . host , recipe . name , recipe . version ) )
66
76
recipe . cook
67
77
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"
75
-
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 )
79
-
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
84
-
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
78
90
- ldflags . each { |ldflag | append_ldflags ( ldflag ) }
79
+ recipe . mkmf_config ( pkg : libname , static : libname )
80
+ have_func ( "sqlite3_libversion_number" , "sqlite3.h" ) || abort_could_not_find ( libname )
91
81
end
92
82
end
93
83
@@ -98,16 +88,6 @@ def configure_extension
98
88
99
89
append_cflags ( "-fvisibility=hidden" ) # see https://github.com/rake-compiler/rake-compiler-dock/issues/87
100
90
101
- if find_header ( "sqlite3.h" )
102
- # noop
103
- elsif sqlcipher? && find_header ( "sqlcipher/sqlite3.h" )
104
- append_cppflags ( "-DUSING_SQLCIPHER_INC_SUBDIR" )
105
- else
106
- abort_could_not_find ( "sqlite3.h" )
107
- end
108
-
109
- abort_could_not_find ( libname ) unless find_library ( libname , "sqlite3_libversion_number" , "sqlite3.h" )
110
-
111
91
# Functions defined in 1.9 but not 1.8
112
92
have_func ( 'rb_proc_arity' )
113
93
@@ -131,6 +111,8 @@ def configure_extension
131
111
end
132
112
133
113
def minimal_recipe
114
+ require "rubygems"
115
+ gem "mini_portile2" , "2.8.5.rc2" # gemspec is not respected at install time
134
116
require "mini_portile2"
135
117
136
118
MiniPortile . new ( libname , sqlite3_config [ :version ] ) . tap do |recipe |
0 commit comments