1enable cross-compilation of glibc on Darwin (build=Darwin, host=Linux)
2* increase ulimit for open files: macOS default of 256 is too low for glibc build system
3* use host version of ar, which is given by environment variable
4* build system uses stamp.os and stamp.oS files, which only differ in case;
5 this fails on macOS, so replace .oS with .o_S
6--- glibc-2.32/Makefile.in 2018-02-01 17:17:18.000000000 +0100
7+++ glibc-2.32/Makefile.in 2020-12-27 18:21:30.000000000 +0100
8@@ -6,9 +6,11 @@
9 .PHONY: all install bench
10
11 all .DEFAULT:
12- $(MAKE) -r PARALLELMFLAGS="$(PARALLELMFLAGS)" -C $(srcdir) objdir=`pwd` $@
13+ ulimit -n 1024; \
14+ $(MAKE) -r AR=$$AR PARALLELMFLAGS="$(PARALLELMFLAGS)" -C $(srcdir) objdir=`pwd` $@
15
16 install:
17+ ulimit -n 1024; \
18 LC_ALL=C; export LC_ALL; \
19 $(MAKE) -r PARALLELMFLAGS="$(PARALLELMFLAGS)" -C $(srcdir) objdir=`pwd` $@
20
21--- glibc-2.32/Makerules 2018-02-01 17:17:18.000000000 +0100
22+++ glibc-2.32/Makerules 2020-12-27 18:21:30.000000000 +0100
23@@ -847,8 +847,8 @@
24 ifndef objects
25
26 # Create the stamp$o files to keep the parent makefile happy.
27-subdir_lib: $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)
28-$(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o):
29+subdir_lib: $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$(subst .oS,.o_S,$o))
30+$(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$(subst .oS,.o_S,$o)):
31 $(make-target-directory)
32 rm -f $@; > $@
33 else
34@@ -859,7 +859,7 @@
35 # The parent will then actually add them all to the archive in the
36 # archive rule, below.
37 define o-iterator-doit
38-$(objpfx)stamp$o: $(o-objects); $$(do-stamp)
39+$(objpfx)stamp$(subst .oS,.o_S,$o): $(o-objects); $$(do-stamp)
40 endef
41 define do-stamp
42 $(make-target-directory)
43@@ -875,14 +875,14 @@
44 # on the stamp files built above.
45 define o-iterator-doit
46 $(common-objpfx)$(patsubst %,$(libtype$o),c): \
47- $(subdirs-stamp-o) $(common-objpfx)stamp$o; $$(do-makelib)
48+ $(subdirs-stamp-o) $(common-objpfx)stamp$(subst .oS,.o_S,$o); $$(do-makelib)
49 endef
50 define do-makelib
51 cd $(common-objdir) && \
52 $(AR) $(CREATE_ARFLAGS) $(@F) `cat $(patsubst $(common-objpfx)%,%,$^)`
53 endef
54 subdirs-stamps := $(foreach d,$(subdirs),$(common-objpfx)$d/stamp%)
55-subdirs-stamp-o = $(subst %,$o,$(subdirs-stamps))
56+subdirs-stamp-o = $(subst %,$(subst .oS,.o_S,$o),$(subdirs-stamps))
57 ifndef subdir
58 $(subdirs-stamps): subdir_lib;
59 endif
60@@ -893,7 +893,7 @@
61 # This makes all the object files.
62 .PHONY: objects objs libobjs extra-objs
63 objects objs: libobjs extra-objs
64-libobjs: $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)
65+libobjs: $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$(subst .oS,.o_S,$o))
66 extra-objs: $(addprefix $(objpfx),$(extra-objs))
67
68 # Canned sequence for building an extra library archive.
69@@ -1499,7 +1499,7 @@
70 $(rmobjs)
71 define rmobjs
72 $(foreach o,$(object-suffixes-for-libc),
73--rm -f $(objpfx)stamp$o $(o-objects))
74+-rm -f $(objpfx)stamp$(subst .oS,.o_S,$o) $(o-objects))
75 endef
76
77 # Also remove the dependencies and generated source files.