From: Michael Franzl <office@michaelfranzl.com>
Date: Thu, 30 Nov 2023 07:21:08 -0500
Subject: Remove rpath from compilation flags

Last-Update: 2023-11-30

This patch is required to pass the binary-or-shlib-defines-rpath lintian
test. To fix this problem, any attempt to add rpath to $LDFLAGS
inside of ext/mysql2/extconf.rb is patched out
---
 ext/mysql2/extconf.rb | 29 -----------------------------
 1 file changed, 29 deletions(-)

--- a/ext/mysql2/extconf.rb
+++ b/ext/mysql2/extconf.rb
@@ -291,35 +291,6 @@ if RUBY_PLATFORM =~ /mswin|mingw/ && !de
     # Let's do it!
     Rake::Task[vendordll].invoke
   end
-else
-  case explicit_rpath = with_config('mysql-rpath')
-  when true
-    abort "-----\nOption --with-mysql-rpath must have an argument\n-----"
-  when false
-    warn "-----\nOption --with-mysql-rpath has been disabled at your request\n-----"
-  when String
-    # The user gave us a value so use it
-    rpath_flags = " -Wl,-rpath,#{explicit_rpath}"
-    warn "-----\nSetting mysql rpath to #{explicit_rpath}\n-----"
-    $LDFLAGS << rpath_flags
-  else
-    if (libdir = rpath_dir[%r{(-L)?(/[^ ]+)}, 2])
-      rpath_flags = " -Wl,-rpath,#{libdir}"
-      if RbConfig::CONFIG["RPATHFLAG"].to_s.empty? && try_link('int main() {return 0;}', rpath_flags)
-        # Usually Ruby sets RPATHFLAG the right way for each system, but not on OS X.
-        warn "-----\nSetting rpath to #{libdir}\n-----"
-        $LDFLAGS << rpath_flags
-      else
-        if RbConfig::CONFIG["RPATHFLAG"].to_s.empty?
-          # If we got here because try_link failed, warn the user
-          warn "-----\nDon't know how to set rpath on your system, if MySQL libraries are not in path mysql2 may not load\n-----"
-        end
-        # Make sure that LIBPATH gets set if we didn't explicitly set the rpath.
-        warn "-----\nSetting libpath to #{libdir}\n-----"
-        $LIBPATH << libdir unless $LIBPATH.include?(libdir)
-      end
-    end
-  end
 end
 
 create_makefile('mysql2/mysql2')
