@@ -219,7 +219,6 @@ def create_ninja_file(input_files, filename, libname, cflags, asflags=None, cust
219
219
suffix = shared .suffix (libname )
220
220
build_dir = os .path .dirname (filename )
221
221
222
- case_insensitive = is_case_insensitive (os .path .dirname (filename ))
223
222
if suffix == '.o' :
224
223
assert len (input_files ) == 1
225
224
input_file = escape_ninja_path (input_files [0 ])
@@ -229,12 +228,11 @@ def create_ninja_file(input_files, filename, libname, cflags, asflags=None, cust
229
228
else :
230
229
objects = []
231
230
for src in input_files :
232
- # Resolve duplicates by appending unique.
233
- # This is needed on case insensitive filesystem to handle,
234
- # for example, _exit.o and _Exit.o.
235
- object_basename = shared .unsuffixed_basename (src )
236
- if case_insensitive :
237
- object_basename = object_basename .lower ()
231
+ # Resolve duplicates by appending unique. This is needed on case
232
+ # insensitive filesystem to handle, for example, _exit.o and _Exit.o.
233
+ # This is done even on case sensitive filesystem so that builds are
234
+ # reproducible across platforms.
235
+ object_basename = shared .unsuffixed_basename (src ).lower ()
238
236
o = os .path .join (build_dir , object_basename + '.o' )
239
237
object_uuid = 0
240
238
# Find a unique basename
@@ -270,14 +268,6 @@ def create_ninja_file(input_files, filename, libname, cflags, asflags=None, cust
270
268
ensure_target_in_ninja_file (get_top_level_ninja_file (), f'subninja { escape_ninja_path (filename )} ' )
271
269
272
270
273
- def is_case_insensitive (path ):
274
- """Returns True if the filesystem at `path` is case insensitive."""
275
- utils .write_file (os .path .join (path , 'test_file' ), '' )
276
- case_insensitive = os .path .exists (os .path .join (path , 'TEST_FILE' ))
277
- os .remove (os .path .join (path , 'test_file' ))
278
- return case_insensitive
279
-
280
-
281
271
class Library :
282
272
"""
283
273
`Library` is the base class of all system libraries.
@@ -490,7 +480,6 @@ def build_objects(self, build_dir):
490
480
commands = []
491
481
objects = set ()
492
482
cflags = self .get_cflags ()
493
- case_insensitive = is_case_insensitive (build_dir )
494
483
for src in self .get_files ():
495
484
ext = shared .suffix (src )
496
485
if ext in {'.s' , '.S' , '.c' }:
@@ -507,15 +496,12 @@ def build_objects(self, build_dir):
507
496
cmd += cflags
508
497
cmd = self .customize_build_cmd (cmd , src )
509
498
510
- object_basename = shared .unsuffixed_basename (src )
511
- if case_insensitive :
512
- object_basename = object_basename .lower ()
499
+ object_basename = shared .unsuffixed_basename (src ).lower ()
513
500
o = os .path .join (build_dir , object_basename + '.o' )
514
501
if o in objects :
515
- # If we have seen a file with the same name before, we are on a case-insensitive
516
- # filesystem and need a separate command to compile this file with a
517
- # custom unique output object filename, as batch compile doesn't allow
518
- # such customization.
502
+ # If we have seen a file with the same name before, we need a separate
503
+ # command to compile this file with a custom unique output object
504
+ # filename, as batch compile doesn't allow such customization.
519
505
#
520
506
# This is needed to handle, for example, _exit.o and _Exit.o.
521
507
object_uuid = 0
@@ -530,6 +516,8 @@ def build_objects(self, build_dir):
530
516
src = os .path .relpath (src , build_dir )
531
517
src = utils .normalize_path (src )
532
518
batches .setdefault (tuple (cmd ), []).append (src )
519
+ # No -o in command, use original file name.
520
+ o = os .path .join (build_dir , shared .unsuffixed_basename (src ) + '.o' )
533
521
else :
534
522
commands .append (cmd + [src , '-o' , o ])
535
523
objects .add (o )
0 commit comments