@@ -25,6 +25,8 @@ def configure(conf):
2525
2626 if conf .env .DEST_BINFMT == 'mac-o' :
2727 conf .env .STRIPFLAGS += ['-x' ]
28+ conf .find_program ('dsymutil' , var = 'DSYMUTIL' )
29+ conf .env .STRIPFLAGS += ['-S' ] # we will use .dSYM instead
2830 return # macOS don't have objcopy
2931
3032 # a1ba: I am lazy to add `export OBJCOPY=` everywhere in my scripts
@@ -56,12 +58,19 @@ def copy_fun(self, src, tgt):
5658 c3 = Logs .colors .YELLOW
5759 c4 = Logs .colors .BLUE
5860 try :
59- if self .generator .bld .options .strip_to_file and self .env .DEST_BINFMT == 'elf' :
60- ocopy_cmd = self .env .OBJCOPY + ['--only-keep-debug' , tgt , tgt_debug ]
61- self .generator .bld .cmd_and_log (ocopy_cmd , output = Context .BOTH , quiet = Context .BOTH )
62- if not self .generator .bld .progress_bar :
63- Logs .info ('%s+ objcopy --only-keep-debug %s%s%s %s%s%s' , c1 , c4 , tgt , c1 , c3 , tgt_debug , c1 )
64-
61+ if self .generator .bld .options .strip_to_file :
62+ if self .env .DEST_BINFMT == 'elf' :
63+ ocopy_cmd = self .env .OBJCOPY + ['--only-keep-debug' , tgt , tgt_debug ]
64+ self .generator .bld .cmd_and_log (ocopy_cmd , output = Context .BOTH , quiet = Context .BOTH )
65+ if not self .generator .bld .progress_bar :
66+ Logs .info ('%s+ objcopy --only-keep-debug %s%s%s %s%s%s' , c1 , c4 , tgt , c1 , c3 , tgt_debug , c1 )
67+ elif self .env .DEST_BINFMT == 'mac-o' :
68+ tgt_debug = os .path .splitext (tgt )[0 ] + '.dSYM'
69+ dsymutil_cmd = self .env .DSYMUTIL + [tgt , '-o' , tgt_debug ]
70+ self .generator .bld .cmd_and_log (dsymutil_cmd , output = Context .BOTH , quiet = Context .BOTH )
71+ if not self .generator .bld .progress_bar :
72+ Logs .info ('%s+ dsymutil %s%s%s -o %s%s%s' , c1 , c4 , tgt , c1 , c3 , tgt_debug , c1 )
73+
6574 strip_cmd = self .env .STRIP + self .env .STRIPFLAGS + [tgt ]
6675 self .generator .bld .cmd_and_log (strip_cmd , output = Context .BOTH , quiet = Context .BOTH )
6776 if not self .generator .bld .progress_bar :
0 commit comments