@@ -25,6 +25,8 @@ def configure(conf):
25
25
26
26
if conf .env .DEST_BINFMT == 'mac-o' :
27
27
conf .env .STRIPFLAGS += ['-x' ]
28
+ conf .find_program ('dsymutil' , var = 'DSYMUTIL' )
29
+ conf .env .STRIPFLAGS += ['-S' ] # we will use .dSYM instead
28
30
return # macOS don't have objcopy
29
31
30
32
# a1ba: I am lazy to add `export OBJCOPY=` everywhere in my scripts
@@ -56,12 +58,19 @@ def copy_fun(self, src, tgt):
56
58
c3 = Logs .colors .YELLOW
57
59
c4 = Logs .colors .BLUE
58
60
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
+
65
74
strip_cmd = self .env .STRIP + self .env .STRIPFLAGS + [tgt ]
66
75
self .generator .bld .cmd_and_log (strip_cmd , output = Context .BOTH , quiet = Context .BOTH )
67
76
if not self .generator .bld .progress_bar :
0 commit comments