@@ -906,6 +906,9 @@ KCAT="sys-kernel" ; KPKG="linux-headers" ; KVER="" KUSE="" KENV="" KOVL="" KMASK
906906LCAT=" sys-libs" ; LPKG=" [none]" ; LVER=" " LUSE=" " LENV=" " LOVL=" " LMASK=" " LFORCE=" "
907907DCAT=" dev-debug" ; DPKG=" gdb" ; DVER=" " DUSE=" " DENV=" " DOVL=" " DMASK=" " DFORCE=" "
908908RCAT=" llvm-runtimes" ; RPKG=" compiler-rt" ; RVER=" " RUSE=" " RENV=" " ROVL=" " RMASK=" " RFORCE=" "
909+ UCAT=" llvm-runtimes" ; UPKG=" libunwind" ; UVER=" " UUSE=" " UENV=" " UOVL=" " UMASK=" " UFORCE=" "
910+ ACAT=" llvm-runtimes" ; APKG=" libcxxabi" ; AVER=" " AUSE=" " AENV=" " AOVL=" " AMASK=" " AFORCE=" "
911+ PCAT=" llvm-runtimes" ; PPKG=" libcxx" ; PVER=" " PUSE=" " PENV=" " POVL=" " PMASK=" " PFORCE=" "
909912CCAT=" sys-devel" ; CPKG=" clang-crossdev-wrappers" ; CVER=" " CUSE=" " CENV=" " COVL=" " CMASK=" " CFORCE=" "
910913XPKGS=() XVERS=() XUSES=() XENVS=() XOVLS=() XMASKS=() XFORCES=()
911914DEFAULT_VER=" [latest]"
@@ -948,69 +951,84 @@ LLVM="no"
948951
949952while [[ $# -gt 0 ]] ; do
950953 case $1 in
951- -V|--version) echo " crossdev-${CROSSDEV_VER} " ; exit 0;;
952- -t|--target) shift ; parse_target $1 ;;
953- --b|--binutils) shift ; BVER=$1 ;;
954- --benv) shift ; BENV=$1 ;;
955- -ob|--ov-binutils) shift ; BOVL=$1 ;;
956- --bcat) shift ; BCAT=$1 ;;
957- --bpkg) shift ; BPKG=$1 ;;
958- --d|--gdb) shift ; DVER=$1 ;;
959- --denv) shift ; DENV=$1 ;;
960- -od|--ov-gdb) shift ; DOVL=$1 ;;
961- --dcat) shift ; DCAT=$1 ;;
962- --dpkg) shift ; DPKG=$1 ;;
963- --g|--gcc) shift ; GVER=$1 ;;
964- --genv) shift ; GENV=$1 ;;
965- -og|--ov-gcc) shift ; GOVL=$1 ;;
966- --gcat) shift ; GCAT=$1 ;;
967- --gpkg) shift ; GPKG=$1 ;;
968- --k|--kernel) shift ; KVER=$1 ;;
969- --kenv) shift ; KENV=$1 ;;
970- -ok|--ov-kernel) shift ; KOVL=$1 ;;
971- --kcat) shift ; KCAT=$1 ;;
972- --kpkg) shift ; KPKG=$1 ;;
973- --l|--libc) shift ; LVER=$1 ;;
974- --lenv) shift ; LENV=$1 ;;
975- -ol|--ov-libc) shift ; LOVL=$1 ;;
976- --lcat) shift ; LCAT=$1 ;;
977- --lpkg) shift ; LPKG=$1 ;;
978- --r|--crt) shift ; RVER=$1 ;;
979- --renv) shift ; RENV=$1 ;;
980- -or|--ov-crt) shift ; ROVL=$1 ;;
981- --rcat) shift ; RCAT=$1 ;;
982- --rpkg) shift ; RPKG=$1 ;;
983- --c|--ccw) shift ; CVER=$1 ;;
984- --cenv) shift ; CENV=$1 ;;
985- -oc|--ov-ccw) shift ; COVL=$1 ;;
986- --ccat) shift ; CCAT=$1 ;;
987- --cpkg) shift ; CPKG=$1 ;;
988- -ox|--ov-extra) shift ; XOVLS+=( " $1 " );;
989- --env) shift ; AENV=$1 ;;
990- -L|--llvm) LLVM=" yes" ;;
991- -A|--abis) shift ; MULTILIB_ABIS=$1 ;;
992- --host-abi) shift ; HOST_ABI=$1 ;;
993- -S|--stable) DEFAULT_VER=" [stable]" ;;
994- -C|--clean) shift ; parse_target $1 ; ACTION=" uninstall" ;;
995- -s? |--stage? ) STAGE=${1: 0-1} ;;
996- -oS|--overlays) shift ; SEARCH_OVERLAYS=$1 ;;
997- -oO|--ov-output) shift ; CROSSDEV_OVERLAY=$1 ;;
998- --ex-only) EX_FAST=" yes" ;;
999- --ex-gcc) EX_GCC=" yes" ;;
1000- --ex-gdb) EX_GDB=" yes" ;;
1001- --ex-pkg) shift ; XPKGS+=( " $1 " );;
1002- --with-* ) eval $( set_withval $1 ) ;;
1003- --without-* ) eval $( set_withval $1 ) ;;
1004- -f|--force) FORCE=" yes" ;;
1005- -x) SET_X=" yes" ;;
1006- --show-target-cfg) SHOW_TARGET_CFG=" yes" ;;
1007- --init-target) INIT_TARGET_ONLY=" yes" ;;
1008- --show-fail-log) SHOW_FAIL_LOG=" yes" ;;
1009- --show-repo-cfg) show_repo_cfg " $2 " ;;
1010- -P|--portage) UOPTS=" ${UOPTS} $2 " ; shift ;;
1011- -h|--help) usage;;
1012- -* ) eerror " UNKNOWN OPTION: '$1 '" ; usage 1;;
1013- * ) parse_target $1 ;;
954+ -V|--version) echo " crossdev-${CROSSDEV_VER} " ; exit 0;;
955+ -t|--target) shift ; parse_target $1 ;;
956+ --b|--binutils) shift ; BVER=$1 ;;
957+ --benv) shift ; BENV=$1 ;;
958+ -ob|--ov-binutils) shift ; BOVL=$1 ;;
959+ --bcat) shift ; BCAT=$1 ;;
960+ --bpkg) shift ; BPKG=$1 ;;
961+ --d|--gdb) shift ; DVER=$1 ;;
962+ --denv) shift ; DENV=$1 ;;
963+ -od|--ov-gdb) shift ; DOVL=$1 ;;
964+ --dcat) shift ; DCAT=$1 ;;
965+ --dpkg) shift ; DPKG=$1 ;;
966+ --g|--gcc) shift ; GVER=$1 ;;
967+ --genv) shift ; GENV=$1 ;;
968+ -og|--ov-gcc) shift ; GOVL=$1 ;;
969+ --gcat) shift ; GCAT=$1 ;;
970+ --gpkg) shift ; GPKG=$1 ;;
971+ --k|--kernel) shift ; KVER=$1 ;;
972+ --kenv) shift ; KENV=$1 ;;
973+ -ok|--ov-kernel) shift ; KOVL=$1 ;;
974+ --kcat) shift ; KCAT=$1 ;;
975+ --kpkg) shift ; KPKG=$1 ;;
976+ --l|--libc) shift ; LVER=$1 ;;
977+ --lenv) shift ; LENV=$1 ;;
978+ -ol|--ov-libc) shift ; LOVL=$1 ;;
979+ --lcat) shift ; LCAT=$1 ;;
980+ --lpkg) shift ; LPKG=$1 ;;
981+ --r|--crt) shift ; RVER=$1 ;;
982+ --renv) shift ; RENV=$1 ;;
983+ -or|--ov-crt) shift ; ROVL=$1 ;;
984+ --rcat) shift ; RCAT=$1 ;;
985+ --rpkg) shift ; RPKG=$1 ;;
986+ --u|--libunwind) shift ; UVER=$1 ;;
987+ --uenv) shift ; UENV=$1 ;;
988+ -ou|--ov-libuinwind) shift ; UOVL=$1 ;;
989+ --ucat) shift ; UCAT=$1 ;;
990+ --upkg) shift ; UPKG=$1 ;;
991+ --a|--libcxxabi) shift ; AVER=$1 ;;
992+ --aenv) shift ; AENV=$1 ;;
993+ -oa|--ov--libcxxabi) shift ; AOVL=$1 ;;
994+ --acat) shift ; ACAT=$1 ;;
995+ --apkg) shift ; APKG=$1 ;;
996+ --p|--libcxx) shift ; PVER=$1 ;;
997+ --penv) shift ; PENV=$1 ;;
998+ -op|--ov-libcxx) shift ; POVL=$1 ;;
999+ --pcat) shift ; PCAT=$1 ;;
1000+ --ppkg) shift ; PPKG=$1 ;;
1001+ --c|--ccw) shift ; CVER=$1 ;;
1002+ --cenv) shift ; CENV=$1 ;;
1003+ -oc|--ov-ccw) shift ; COVL=$1 ;;
1004+ --ccat) shift ; CCAT=$1 ;;
1005+ --cpkg) shift ; CPKG=$1 ;;
1006+ -ox|--ov-extra) shift ; XOVLS+=( " $1 " );;
1007+ --env) shift ; AENV=$1 ;;
1008+ -L|--llvm) LLVM=" yes" ;;
1009+ -A|--abis) shift ; MULTILIB_ABIS=$1 ;;
1010+ --host-abi) shift ; HOST_ABI=$1 ;;
1011+ -S|--stable) DEFAULT_VER=" [stable]" ;;
1012+ -C|--clean) shift ; parse_target $1 ; ACTION=" uninstall" ;;
1013+ -s? |--stage? ) STAGE=${1: 0-1} ;;
1014+ -oS|--overlays) shift ; SEARCH_OVERLAYS=$1 ;;
1015+ -oO|--ov-output) shift ; CROSSDEV_OVERLAY=$1 ;;
1016+ --ex-only) EX_FAST=" yes" ;;
1017+ --ex-gcc) EX_GCC=" yes" ;;
1018+ --ex-gdb) EX_GDB=" yes" ;;
1019+ --ex-pkg) shift ; XPKGS+=( " $1 " );;
1020+ --with-* ) eval $( set_withval $1 ) ;;
1021+ --without-* ) eval $( set_withval $1 ) ;;
1022+ -f|--force) FORCE=" yes" ;;
1023+ -x) SET_X=" yes" ;;
1024+ --show-target-cfg) SHOW_TARGET_CFG=" yes" ;;
1025+ --init-target) INIT_TARGET_ONLY=" yes" ;;
1026+ --show-fail-log) SHOW_FAIL_LOG=" yes" ;;
1027+ --show-repo-cfg) show_repo_cfg " $2 " ;;
1028+ -P|--portage) UOPTS=" ${UOPTS} $2 " ; shift ;;
1029+ -h|--help) usage;;
1030+ -* ) eerror " UNKNOWN OPTION: '$1 '" ; usage 1;;
1031+ * ) parse_target $1 ;;
10141032 esac
10151033 shift
10161034done
@@ -1038,6 +1056,10 @@ GVER=${GVER:-${DEFAULT_VER}}
10381056KVER=${KVER:- ${DEFAULT_VER} }
10391057LVER=${LVER:- ${DEFAULT_VER} }
10401058DVER=${DVER:- ${DEFAULT_VER} }
1059+ RVER=${RVER:- ${DEFAULT_VER} }
1060+ AVER=${AVER:- ${DEFAULT_VER} }
1061+ PVER=${PVER:- ${DEFAULT_VER} }
1062+ UVER=${UVER:- ${DEFAULT_VER} }
10411063STAGE=${STAGE:- ${STAGE_DEFAULT} }
10421064[[ -z ${CTARGET} ]] && usage 1
10431065for with in HEADERS ; do
@@ -1054,8 +1076,6 @@ if [[ ${LPKG} == "newlib" && ${LVER} == "[stable]" ]]; then
10541076 LVER=" [latest]"
10551077fi
10561078
1057- RVER=" [latest]"
1058-
10591079show_target_cfg () {
10601080 local pkgs crosspkgs=()
10611081
@@ -1245,6 +1265,12 @@ einfo "headers: `pretty_atom ${KPKG}- ${KVER}`"
12451265is_s3 && {
12461266einfo " libc: ` pretty_atom ${LPKG} - ${LVER} ` "
12471267}
1268+ is_s4 && {
1269+ [[ " ${LLVM} " == " yes" ]] && \
1270+ einfo " llvm-libunwind: ` pretty_atom ${UPKG} - ${UVER} ` "
1271+ einfo " libcxxabi: ` pretty_atom ${APKG} - ${AVER} ` "
1272+ einfo " libcxx: ` pretty_atom ${PPKG} - ${PVER} ` "
1273+ }
12481274}
12491275ex_gcc && {
12501276einfo " Extra: gcc pass: DO IT"
@@ -1587,7 +1613,7 @@ done
15871613
15881614pkglist=( K L )
15891615if [[ ${LLVM} == " yes" ]] ; then
1590- pkglist+=( R C )
1616+ pkglist+=( R C A P U )
15911617else
15921618 pkglist+=( B G D )
15931619fi
@@ -1777,8 +1803,7 @@ if [[ "${LLVM}" == "yes" ]]; then
17771803 --rtlib=compiler-rt
17781804 --sysroot=/usr/${CTARGET}
17791805 --target=${CTARGET}
1780- --unwindlib=libunwind
1781- --stdlib=libc++
1806+ --unwindlib=none
17821807 -fuse-ld=lld
17831808 EOF
17841809 # Workaround until LLVM libc supports dynamic linking and SSP
@@ -1887,10 +1912,28 @@ if ! ex_fast ; then
18871912 fi
18881913
18891914 # stage4: full compiler (C/C++/etc...)
1890- if is_s4 && [[ " ${LLVM} " != " yes" ]] ; then
1891- EOPTS=" ${EOPTS_UP} --newuse" \
1892- USE=" ${GUSE} ${USE} ${GUSE_DISABLE_STAGE_2} " \
1893- doemerge ${GPKG} ${GPKG} -stage2
1915+ if is_s4 ; then
1916+ if [[ " ${LLVM} " == " yes" ]]; then
1917+ # Static llvm-libunwind is essential for supporting simple static linking in
1918+ # general, see the bug #892956. The same is done in the LLVM profile.
1919+ USE=" ${UUSE} ${USE} static-libs" \
1920+ doemerge ${UPKG}
1921+
1922+ # Include libunwind in the cross configuration. libc++ depends on it.
1923+ sed -i " s/--unwindlib=.*$/--unwindlib=libunwind/" " ${CLANG_CROSS_CFG} "
1924+
1925+ USE=" ${AUSE} ${USE} " \
1926+ doemerge ${APKG}
1927+ USE=" ${PUSE} ${USE} " \
1928+ doemerge ${PPKG}
1929+
1930+ # Finally, include libc++ in the cross configuration.
1931+ sed -i " /--unwindlib/ a --stdlib=libc++" " ${CLANG_CROSS_CFG} "
1932+ else
1933+ EOPTS=" ${EOPTS_UP} --newuse" \
1934+ USE=" ${GUSE} ${USE} ${GUSE_DISABLE_STAGE_2} " \
1935+ doemerge ${GPKG} ${GPKG} -stage2
1936+ fi
18941937 fi
18951938fi
18961939
0 commit comments