Skip to content

Commit e04e5d0

Browse files
committed
Add comment about loading of libpq in binary gems
1 parent 9f90c05 commit e04e5d0

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

ext/extconf.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,18 @@ def configure
121121
end
122122
end
123123

124+
# We build a libpq library file which static links OpenSSL and krb5.
125+
# Our builtin libpq is referenced in different ways depending on the OS:
126+
# - Window: Add the ports directory at runtime per RubyInstaller::Runtime.add_dll_directory
127+
# The file is called "libpq.dll"
128+
# - Linux: Add a rpath to pg_ext.so which references the ports directory.
129+
# The file is called "libpq-ruby-pg.so.1" to avoid loading of system libpq by accident.
130+
# - Macos: Add a reference with relative path in pg_ext.so to the ports directory.
131+
# The file is called "libpq-ruby-pg.1.dylib" to avoid loading of other libpq by accident.
124132
libpq_orig, libpq_rubypg = case RUBY_PLATFORM
125133
when /linux/ then ["libpq.so.5", "libpq-ruby-pg.so.1"]
126134
when /darwin/ then ["libpq.5.dylib", "libpq-ruby-pg.1.dylib"]
135+
# when /mingw/ then ["libpq.dll", "libpq.dll"] # renaming not needed
127136
end
128137

129138
postgresql_recipe = BuildRecipe.new("postgresql", POSTGRESQL_VERSION, [POSTGRESQL_SOURCE_URI]).tap do |recipe|

0 commit comments

Comments
 (0)