@@ -33,25 +33,24 @@ endef
3333define $(package)_set_vars
3434$(package ) _config_opts=--target=$(host ) --disable-lto-support
3535$(package ) _ldflags+=-Wl,-rpath=\\$$$$$$$$\$$$$$$$$ORIGIN/../lib
36-
37- # default (non-darwin) – keep original behaviour
3836$(package ) _cc=$($(package ) _extract_dir) /toolchain/bin/clang
3937$(package ) _cxx=$($(package ) _extract_dir) /toolchain/bin/clang++
4038endef
4139
42- define $(package)_preprocess_cmds
43- # ============================================================
44- # macOS cross-compile: FORCE real GCC instead of LLVM 3.7 clang
45- # ============================================================
46- if echo "$(host ) " | grep -q darwin; then \
47- echo "⚡ Overriding compiler for macOS toolchain build..."; \
48- export CC =gcc; \
49- export CXX=g++; \
50- export LD=gcc; \
51- export AR=$(build_AR ) ; \
52- export RANLIB=$(build_RANLIB ) ; \
53- fi
5440
41+ # ==================================================================
42+ # FIX: Override compiler BEFORE preprocess/configure (NO RECIPES HERE)
43+ # ==================================================================
44+ ifeq ($(findstring darwin,$(host_os ) ) ,darwin)
45+ $(package)_cc =gcc
46+ $(package)_cxx =g++
47+ $(package)_cflags+ =-Wno-unused-command-line-argument
48+ $(package)_cxxflags+ =-Wno-unused-command-line-argument
49+ $(package)_ldflags+ =-Wno-unused-command-line-argument
50+ endif
51+
52+
53+ define $(package)_preprocess_cmds
5554 cd $($(package ) _build_subdir) ; ./autogen.sh && \
5655 sed -i.old "/define HAVE_PTHREADS/d" ld64/src/ld/InputFiles.h
5756endef
@@ -69,27 +68,11 @@ define $(package)_stage_cmds
6968 cd $($(package ) _extract_dir) /toolchain && \
7069 mkdir -p $($(package ) _staging_prefix_dir) /lib/clang/$($(package ) _clang_version) /include && \
7170 mkdir -p $($(package ) _staging_prefix_dir) /bin $($(package ) _staging_prefix_dir) /include && \
72- cp bin/clang $($(package ) _staging_prefix_dir) /bin/ &&\
73- cp -P bin/clang++ $($(package ) _staging_prefix_dir) /bin/ &&\
71+ cp bin/clang $($(package ) _staging_prefix_dir) /bin/ && \
72+ cp -P bin/clang++ $($(package ) _staging_prefix_dir) /bin/ && \
7473 cp lib/libLTO.so $($(package ) _staging_prefix_dir) /lib/ && \
7574 cp -rf lib/clang/$($(package ) _clang_version) /include/* $($(package ) _staging_prefix_dir) /lib/clang/$($(package ) _clang_version) /include/ && \
7675 cp bin/llvm-dsymutil $($(package ) _staging_prefix_dir) /bin/$(host ) -dsymutil && \
77- if ` test -d include/c++/` ; then cp -rf include/c++/ $($(package ) _staging_prefix_dir) /include/; fi && \
78- if ` test -d lib/c++/` ; then cp -rf lib/c++/ $($(package ) _staging_prefix_dir) /lib/; fi
76+ if test -d include/c++/; then cp -rf include/c++/ $($(package ) _staging_prefix_dir) /include/; fi && \
77+ if test -d lib/c++/; then cp -rf lib/c++/ $($(package ) _staging_prefix_dir) /lib/; fi
7978endef
80-
81- # ============================================================
82- # macOS toolchain build: override compiler for *native_cctools*
83- # ============================================================
84- ifeq ($(findstring darwin,$(host_os ) ) ,darwin)
85-
86- # Force system compilers (fixes: C compiler cannot create executables)
87- $(package)_cc =gcc
88- $(package)_cxx =g++
89-
90- # Silence problematic unused flag errors during linking
91- $(package)_cflags+ = -Wno-unused-command-line-argument
92- $(package)_cxxflags+ = -Wno-unused-command-line-argument
93- $(package)_ldflags+ = -Wno-unused-command-line-argument
94-
95- endif
0 commit comments