Lines 91-96
efetch() {
Link Here
|
91 |
return 0 |
91 |
return 0 |
92 |
} |
92 |
} |
93 |
|
93 |
|
|
|
94 |
darwin_symlink_sdk() { |
95 |
# setup MacOSX.sdk symlink for GCC/clang, this should probably be |
96 |
# managed using an eselect module in the future |
97 |
rm -f "${ROOT}/MacOSX.sdk" |
98 |
local SDKPATH=$(xcrun --show-sdk-path --sdk macosx) |
99 |
local SDKVERSION=$(xcrun --show-sdk-version --sdk macosx) |
100 |
( cd ${ROOT} && ln -s "${SDKPATH}" MacOSX.sdk ) |
101 |
einfo "using system sources (${SDKVERSION}) from: ${SDKPATH}" |
102 |
} |
103 |
|
104 |
darwin_include_paths() { |
105 |
local SDKPATH="${ROOT}/MacOSX.sdk" |
106 |
export C_INCLUDE_PATH="${SDKPATH}/usr/include" |
107 |
|
108 |
# we require command line tools. This allows stage2 to progress. |
109 |
export CPLUS_INCLUDE_PATH="/Library/Developer/CommandLineTools/usr/include/c++/v1:${C_INCLUDE_PATH}" |
110 |
} |
111 |
|
94 |
configure_cflags() { |
112 |
configure_cflags() { |
95 |
export CPPFLAGS="-I${ROOT}/tmp/usr/include" |
113 |
export CPPFLAGS="-I${ROOT}/tmp/usr/include" |
96 |
|
114 |
|
Lines 241-247
configure_toolchain() {
Link Here
|
241 |
sys-libs/libcxx" |
259 |
sys-libs/libcxx" |
242 |
CC=clang |
260 |
CC=clang |
243 |
CXX=clang++ |
261 |
CXX=clang++ |
|
|
262 |
# sys-devel/binutils-apple requires sys-libs/tapi, but we |
263 |
# cannot build it first. so, stage2 needs to bootstrap it. |
264 |
#linker="sys-libs/tapi sys-devel/binutils-apple" |
244 |
linker=sys-devel/binutils-apple |
265 |
linker=sys-devel/binutils-apple |
|
|
266 |
if [[ ! -d /usr/include ]]; then |
267 |
darwin_symlink_sdk |
268 |
darwin_include_paths |
269 |
fi |
245 |
;; |
270 |
;; |
246 |
*"Apple LLVM version "*) |
271 |
*"Apple LLVM version "*) |
247 |
vers=${ccvers#*Apple LLVM version } |
272 |
vers=${ccvers#*Apple LLVM version } |
Lines 504-516
bootstrap_setup() {
Link Here
|
504 |
esac |
529 |
esac |
505 |
|
530 |
|
506 |
if [[ ${DARWIN_USE_GCC} == 1 ]] ; then |
531 |
if [[ ${DARWIN_USE_GCC} == 1 ]] ; then |
507 |
# setup MacOSX.sdk symlink for GCC, this should probably be |
532 |
darwin_symlink_sdk |
508 |
# managed using an eselect module in the future |
|
|
509 |
rm -f "${ROOT}"/MacOSX.sdk |
510 |
local SDKPATH=$(xcrun --show-sdk-path --sdk macosx) |
511 |
( cd "${ROOT}" && ln -s "${SDKPATH}" MacOSX.sdk ) |
512 |
einfo "using system sources from ${SDKPATH}" |
513 |
|
514 |
# amend profile, to use gcc one |
533 |
# amend profile, to use gcc one |
515 |
profile="${profile}/gcc" |
534 |
profile="${profile}/gcc" |
516 |
fi |
535 |
fi |
Lines 1332-1337
bootstrap_libressl() {
Link Here
|
1332 |
https://ftp.openbsd.org/pub/OpenBSD/LibreSSL |
1351 |
https://ftp.openbsd.org/pub/OpenBSD/LibreSSL |
1333 |
} |
1352 |
} |
1334 |
|
1353 |
|
|
|
1354 |
bootstrap_libtapi() { |
1355 |
# grab the libtapi headers (which are actually compiled headers) |
1356 |
# but link with libtapi.dylib from CommaandLineTools |
1357 |
|
1358 |
local PN PV A S |
1359 |
PN=libtapi |
1360 |
PV=1000.10.8_1 |
1361 |
rev=${CHOST##*darwin} |
1362 |
A=${PN}-${PV}.darwin_${rev}.x86_64.tbz2 |
1363 |
einfo "Bootstrapping ${A%-*} (link to system dylib)" |
1364 |
|
1365 |
efetch "http://packages.macports.org/libtapi/${A}" |
1366 |
|
1367 |
einfo "Unpacking ${A%-*}" |
1368 |
S="${PORTAGE_TMPDIR}/${PN}-${PV}" |
1369 |
rm -rf "${S}" |
1370 |
mkdir -p "${S}" |
1371 |
cd "${S}" |
1372 |
bzip2 -dc "${DISTDIR}/${A}" | tar -xf - || return 1 |
1373 |
cp -r opt/local/include/tapi "${ROOT}"/tmp/usr/include || return 1 |
1374 |
|
1375 |
# to link with this lib, pass '-client_name ld' in LDFLAGS |
1376 |
ln -s /Library/Developer/CommandLineTools/usr/lib/libtapi.dylib "${ROOT}"/tmp/usr/lib |
1377 |
} |
1378 |
|
1335 |
bootstrap_stage_host_gentoo() { |
1379 |
bootstrap_stage_host_gentoo() { |
1336 |
if ! is-rap ; then |
1380 |
if ! is-rap ; then |
1337 |
einfo "Shortcut only supports prefix-standalone, but we are bootstrapping" |
1381 |
einfo "Shortcut only supports prefix-standalone, but we are bootstrapping" |
Lines 1736-1743
bootstrap_stage2() {
Link Here
|
1736 |
[[ ${CHOST} == *-solaris* ]] && echo "=dev-libs/libffi-3.3_rc0" \ |
1780 |
[[ ${CHOST} == *-solaris* ]] && echo "=dev-libs/libffi-3.3_rc0" \ |
1737 |
>> "${ROOT}"/tmp/etc/portage/package.mask |
1781 |
>> "${ROOT}"/tmp/etc/portage/package.mask |
1738 |
|
1782 |
|
1739 |
# unlock GCC on Darwin for DARWIN_USE_GCC bootstraps |
1783 |
# unlock Darwin builds for GCC and clang bootstraps |
1740 |
if [[ ${DARWIN_USE_GCC} == 1 ]] ; then |
1784 |
if [[ -d "${ROOT}/MacOSX.sdk" ]] ; then |
1741 |
rm -f "${ROOT}"/tmp/MacOSX.sdk |
1785 |
rm -f "${ROOT}"/tmp/MacOSX.sdk |
1742 |
( cd "${ROOT}"/tmp && ln -s ../MacOSX.sdk ) |
1786 |
( cd "${ROOT}"/tmp && ln -s ../MacOSX.sdk ) |
1743 |
fi |
1787 |
fi |
Lines 1746-1753
bootstrap_stage2() {
Link Here
|
1746 |
# unless we only build the buildtool, bug #603012 |
1790 |
# unless we only build the buildtool, bug #603012 |
1747 |
echo "dev-util/cmake -server" >> "${ROOT}"/tmp/etc/portage/package.use |
1791 |
echo "dev-util/cmake -server" >> "${ROOT}"/tmp/etc/portage/package.use |
1748 |
|
1792 |
|
|
|
1793 |
# rhash (dep of cmake) configure can't find the openssl/libressl. |
1794 |
# ssl use flag allows RHash to "use optimized algorithms" |
1795 |
# but RHash will work fine without, so disable during bootstrap. |
1796 |
echo "app-crypt/rhash -ssl" >> "${ROOT}"/tmp/etc/portage/package.use |
1797 |
|
1749 |
emerge_pkgs --nodeps "${pkgs[@]}" || return 1 |
1798 |
emerge_pkgs --nodeps "${pkgs[@]}" || return 1 |
1750 |
|
1799 |
|
|
|
1800 |
if [[ ${CHOST} == *-darwin* ]]; then |
1801 |
# libtapi.dylib is needed to build the binutils-apple linker, |
1802 |
# but building sys-libs/tapi requires llvm to be installed |
1803 |
# because it uses llvm.eclass which checks for which version |
1804 |
# of llvm is installed. Also, building libtapi includes |
1805 |
# re-building the sources of llvm & clang to get some internal |
1806 |
# binaries that don't get installed, but we haven't installed |
1807 |
# the llvm deps yet. So, we can't install tapi via portage yet. |
1808 |
[[ ${DARWIN_USE_GCC} == 1 ]] \ |
1809 |
|| [[ -f "${ROOT}"/tmp/usr/lib/libtapi.dylib ]] \ |
1810 |
|| (bootstrap_libtapi) || return 1 |
1811 |
fi |
1812 |
|
1751 |
# Debian multiarch supported by RAP needs ld to support sysroot. |
1813 |
# Debian multiarch supported by RAP needs ld to support sysroot. |
1752 |
EXTRA_ECONF=$(rapx --with-sysroot=/) \ |
1814 |
EXTRA_ECONF=$(rapx --with-sysroot=/) \ |
1753 |
emerge_pkgs --nodeps ${linker} || return 1 |
1815 |
emerge_pkgs --nodeps ${linker} || return 1 |
Lines 2836-2842
EOF
Link Here
|
2836 |
export CHOST=$(portageq envvar CHOST) |
2898 |
export CHOST=$(portageq envvar CHOST) |
2837 |
|
2899 |
|
2838 |
# after stage1 and stage2 we should have a bash of our own, which |
2900 |
# after stage1 and stage2 we should have a bash of our own, which |
2839 |
# is preferably over the host-provided one, because we know it can |
2901 |
# is preferable over the host-provided one, because we know it can |
2840 |
# deal with the bash-constructs we use in stage3 and onwards |
2902 |
# deal with the bash-constructs we use in stage3 and onwards |
2841 |
hash -r |
2903 |
hash -r |
2842 |
|
2904 |
|