@@ -12,69 +12,95 @@ $(package)_config_opts+=threading=multi link=static -sNO_BZIP2=1 -sNO_ZLIB=1
1212
1313$(package ) _config_opts_linux=threadapi=pthread runtime-link=shared
1414
15- # macOS uses darwin toolset
16- $(package ) _config_opts_darwin=toolset=darwin runtime-link=shared
15+ # macOS: required for cross-compile
16+ $(package ) _config_opts_darwin=toolset=clang runtime-link=shared
1717
1818$(package ) _config_opts_mingw32=binary-format=pe target-os=windows threadapi=win32 runtime-link=static
19+
1920$(package ) _config_opts_x86_64_mingw32=address-model=64
2021$(package ) _config_opts_i686_mingw32=address-model=32
2122$(package ) _config_opts_i686_linux=address-model=32 architecture=x86
2223
24+ $(package ) _toolset_$(host_os ) =gcc
25+ $(package ) _archiver_$(host_os ) =$($(package ) _ar)
26+
27+ # override on Darwin
28+ $(package ) _toolset_darwin=clang
29+ $(package ) _archiver_darwin=$($(package ) _ar)
30+
31+ boost_toolset_darwin=$($(package ) _toolset_darwin)
32+ boost_archiver_darwin=$($(package ) _archiver_darwin)
33+
2334$(package ) _config_libraries=chrono,filesystem,program_options,system,thread
2435
2536$(package ) _cxxflags=-std=c++11 -fvisibility=hidden
2637$(package ) _cxxflags_linux=-fPIC
2738
39+ # required for Darwin SDK includes
2840$(package ) _cppflags+= --sysroot=$(OSX_SDK_PATH )
2941$(package ) _cflags+= --sysroot=$(OSX_SDK_PATH )
3042$(package ) _ldflags+= -Wl,-syslibroot,$(OSX_SDK_PATH )
3143endef
3244
3345# ==================================================================
34- # PREPROCESS — Generate user-config.jam
46+ # PREPROCESS — Generate user-config.jam for clang (macOS) / gcc (others)
3547# ==================================================================
3648
3749ifeq ($(host_os ) ,darwin)
3850
3951define $(package)_preprocess_cmds
52+ # 1) Native gcc toolset for building the Boost.Build engine (b2)
4053 echo "using gcc : : g++ ;" > user-config.jam
41- echo "using darwin : : $(host_CXX ) \
42- : <cxxflags>\"$($(package ) _cxxflags) $($(package ) _cppflags) -stdlib=libc++ -isystem$(OSX_SDK_PATH ) /usr/include/c++/v1\" \
43- <linkflags>\"$($(package ) _ldflags) -stdlib=libc++\" \
44- <archiver>\"$(host_AR ) \" \
45- <ranlib>\"$(host_RANLIB ) \" \
46- <striper>\"$(host_STRIP ) \" ;" >> user-config.jam
54+ # 2) Cross clang toolset for building macOS Boost libs
55+ echo "using clang : : $($(package ) _cxx) \
56+ : <cxxflags>\"$($(package ) _cxxflags) $($(package ) _cppflags) -stdlib=libc++ -isystem$(OSX_SDK_PATH ) /usr/include/c++/v1\" \
57+ <linkflags>\"$($(package ) _ldflags) -stdlib=libc++\" \
58+ <archiver>\"$($(package ) _ar) \" \
59+ <ranlib>\"$(host_RANLIB ) \" \
60+ <striper>\"$(host_STRIP ) \" \
61+ ;" >> user-config.jam
4762endef
4863
49- else
64+ else # non-macOS
5065
5166define $(package)_preprocess_cmds
5267 echo "using gcc : : $($(package ) _cxx) \
53- : <cxxflags>\"$($(package ) _cxxflags) $($(package ) _cppflags) \" \
54- <linkflags>\"$($(package ) _ldflags) \" \
55- <archiver>\"$(package ) _ar\" \
56- <ranlib>\"$(host_RANLIB ) \" \
57- <striper>\"$(host_STRIP ) \" ;" > user-config.jam
68+ : <cxxflags>\"$($(package ) _cxxflags) $($(package ) _cppflags) \" \
69+ <linkflags>\"$($(package ) _ldflags) \" \
70+ <archiver>\"$($(package ) _ar) \" \
71+ <ranlib>\"$(host_RANLIB ) \" \
72+ <striper>\"$(host_STRIP ) \" \
73+ ;" > user-config.jam
5874endef
5975
6076endif
6177
6278# ==================================================================
63- # CONFIG — bootstrap MUST use native compiler
79+ # CONFIG — Do NOT force --with-toolset on macOS (let it use native gcc)
6480# ==================================================================
6581
82+ ifeq ($(host_os ) ,darwin)
83+
6684define $(package)_config_cmds
67- CC=gcc CXX=g++ ./bootstrap.sh --without-icu --with-libraries=$(boost_config_libraries )
85+ ./bootstrap.sh --without-icu --with-libraries=$(boost_config_libraries )
6886endef
6987
88+ else
89+
90+ define $(package)_config_cmds
91+ ./bootstrap.sh --without-icu --with-libraries=$(boost_config_libraries )
92+ endef
93+
94+ endif
95+
7096# ==================================================================
71- # BUILD / INSTALL
97+ # BUILD + INSTALL
7298# ==================================================================
7399
74100define $(package)_build_cmds
75- ./b2 -j4 --prefix=$($(package ) _staging_prefix_dir) $($(package ) _config_opts) stage
101+ ./b2 -d2 -j2 -d1 --prefix=$($(package ) _staging_prefix_dir) $($(package ) _config_opts) stage
76102endef
77103
78104define $(package)_stage_cmds
79- ./b2 -j4 --prefix=$($(package ) _staging_prefix_dir) $($(package ) _config_opts) install
105+ ./b2 -d0 - j4 --prefix=$($(package ) _staging_prefix_dir) $($(package ) _config_opts) install
80106endef
0 commit comments