3
3
import os
4
4
from pathlib import Path
5
5
import platform
6
+ from tempfile import TemporaryDirectory
6
7
7
8
from tc_build .builder import Builder
8
9
from tc_build .source import SourceManager
@@ -28,6 +29,7 @@ def __init__(self):
28
29
'--quiet' ,
29
30
'--with-system-zlib' ,
30
31
]
32
+
31
33
self .configure_vars = {
32
34
'CC' : 'gcc' ,
33
35
'CXX' : 'g++' ,
@@ -54,18 +56,24 @@ def build(self):
54
56
self .folders .build .mkdir (exist_ok = True , parents = True )
55
57
tc_build .utils .print_header (f"Building { self .target } binutils" )
56
58
57
- configure_cmd = [
58
- Path ( self . folders . source , 'configure' ),
59
- * self . configure_flags ,
60
- ] + [ f" { var } = { val } " for var , val in self . configure_vars . items ()]
61
- self .run_cmd ( configure_cmd , cwd = self . folders . build )
59
+ # Binutils does not provide a configuration flag to disable installation of documentation directly.
60
+ # Instead, we redirect generated docs to a temporary directory, deleting them after installation.
61
+ with TemporaryDirectory () as tmpdir :
62
+ doc_dirs = ( 'info' , 'html' , 'pdf' , 'man' )
63
+ self .configure_flags += [ f"-- { doc } dir= { tmpdir } " for doc in doc_dirs ]
62
64
63
- make_cmd = ['make' , '-C' , self .folders .build , '-s' , f"-j{ os .cpu_count ()} " , 'V=0' ]
64
- self .run_cmd (make_cmd )
65
+ configure_cmd = [
66
+ Path (self .folders .source , 'configure' ),
67
+ * self .configure_flags ,
68
+ ] + [f"{ var } ={ val } " for var , val in self .configure_vars .items ()]
69
+ self .run_cmd (configure_cmd , cwd = self .folders .build )
65
70
66
- if self .folders .install :
67
- self .run_cmd ([* make_cmd , 'install' ])
68
- tc_build .utils .create_gitignore (self .folders .install )
71
+ make_cmd = ['make' , '-C' , self .folders .build , '-s' , f"-j{ os .cpu_count ()} " , 'V=0' ]
72
+ self .run_cmd (make_cmd )
73
+
74
+ if self .folders .install :
75
+ self .run_cmd ([* make_cmd , 'install' ])
76
+ tc_build .utils .create_gitignore (self .folders .install )
69
77
70
78
71
79
class StandardBinutilsBuilder (BinutilsBuilder ):
0 commit comments