@@ -89,6 +89,11 @@ class PackageSource(Enum):
89
89
, "cabal-install-solver"
90
90
, "cabal-install" ]
91
91
92
+ # Value passed to setup build -j {jobs_amount}
93
+ # 1 is not set by default.
94
+ # For the default look up the parser.set_default in main() function
95
+ jobs_amount = 1
96
+
92
97
class Compiler :
93
98
def __init__ (self , ghc_path : Path ):
94
99
if not ghc_path .is_file ():
@@ -206,11 +211,15 @@ def install_sdist(dist_dir: Path, sdist_dir: Path, ghc: Compiler, flags: List[st
206
211
setup_dist_dir = dist_dir / 'setup'
207
212
setup = setup_dist_dir / 'Setup'
208
213
209
- build_args = [
210
- f'--builddir={ dist_dir } ' ,
214
+ build_dir = [
215
+ f'--builddir={ dist_dir } '
216
+ ]
217
+
218
+ build_args = build_dir + [
219
+ f'-j{ jobs_amount } '
211
220
]
212
221
213
- configure_args = build_args + [
222
+ configure_args = build_dir + [
214
223
f'--package-db={ PKG_DB .resolve ()} ' ,
215
224
f'--prefix={ prefix } ' ,
216
225
f'--bindir={ BINDIR .resolve ()} ' ,
@@ -232,7 +241,7 @@ def check_call(args: List[str]) -> None:
232
241
check_call ([str (ghc .ghc_path ), '--make' , '-package-env=-' , '-i' , f'-odir={ setup_dist_dir } ' , f'-hidir={ setup_dist_dir } ' , '-o' , setup , 'Setup' ])
233
242
check_call ([setup , 'configure' ] + configure_args )
234
243
check_call ([setup , 'build' ] + build_args )
235
- check_call ([setup , 'install' ] + build_args )
244
+ check_call ([setup , 'install' ] + build_dir )
236
245
237
246
def hash_file (h , f : BinaryIO ) -> SHA256Hash :
238
247
while True :
@@ -376,10 +385,15 @@ def main() -> None:
376
385
help = 'path to GHC' )
377
386
parser .add_argument ('-s' , '--bootstrap-sources' , type = Path ,
378
387
help = 'path to prefetched bootstrap sources archive' )
388
+
379
389
parser .add_argument ('--archive' , dest = 'want_archive' , action = 'store_true' )
380
390
parser .add_argument ('--no-archive' , dest = 'want_archive' , action = 'store_false' )
381
391
parser .set_defaults (want_archive = True )
382
392
393
+ parser .add_argument ('-j' , type = int , metavar = "NUM" ,
394
+ help = 'specify the number of jobs (commands) to run simultaneously' )
395
+ parser .set_defaults (j = 1 )
396
+
383
397
subparsers = parser .add_subparsers (dest = "command" )
384
398
385
399
parser_fetch = subparsers .add_parser ('build' , help = 'build cabal-install (default)' )
@@ -389,6 +403,9 @@ def main() -> None:
389
403
390
404
args = parser .parse_args ()
391
405
406
+ global jobs_amount
407
+ jobs_amount = args .j
408
+
392
409
print (dedent ("""
393
410
DO NOT use this script if you have another recent cabal-install available.
394
411
This script is intended only for bootstrapping cabal-install on new
0 commit comments