We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5e2ac6e commit 19a3547Copy full SHA for 19a3547
1 file changed
ext/extconf.rb
@@ -330,3 +330,20 @@ module PG
330
create_header()
331
create_makefile( "pg_ext" )
332
333
+if gem_platform
334
+ # exercise the strip command on native binary gems
335
+ # This approach borrowed from
336
+ # https://github.com/rake-compiler/rake-compiler-dock/blob/38066d479050f4fdb3956469255b35a05e5949ef/test/rcd_test/ext/mri/extconf.rb#L97C1-L110C42
337
+ strip_tool = RbConfig::CONFIG['STRIP']
338
+ strip_tool += ' -x' if RUBY_PLATFORM =~ /darwin/
339
+ File.open('Makefile.new', 'w') do |o|
340
+ o.puts 'hijack: all strip'
341
+ o.puts
342
+ o.write(File.read('Makefile'))
343
344
+ o.puts 'strip: $(DLLIB)'
345
+ o.puts "\t$(ECHO) Stripping $(DLLIB)"
346
+ o.puts "\t$(Q) #{strip_tool} $(DLLIB)"
347
+ end
348
+ File.rename('Makefile.new', 'Makefile')
349
+end
0 commit comments