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