Skip to content

Commit

Permalink
clang-18: make it able to cross compile
Browse files Browse the repository at this point in the history
  • Loading branch information
hadfl committed Jul 31, 2024
1 parent d544b80 commit 4f34479
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
24 changes: 23 additions & 1 deletion build/clang/build-18.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,29 @@ XFORM_ARGS="
-DVERSION=$MAJVER
"

post_install() {
for a in "${!TRIPLETS[@]}"; do
cfgfile="$DESTDIR$PREFIX/bin/${TRIPLETS[$a]}.cfg"
if cross_arch $a; then
# TODO: globbing only works reliably as long as we just have
# one cross compiler version per arch.
crossgccver=`pkg_ver $a/gcc*`
crossgccver=${crossgccver%%.*}
cxxinc="$CROSSTOOLS/$a/${TRIPLETS[$a]}/include/c++/$crossgccver"
$CAT << EOF >| $cfgfile
--gcc-install-dir=$CROSSTOOLS/$a/lib/gcc/${TRIPLETS[$a]}/$crossgccver
-stdlib++-isystem$cxxinc
-stdlib++-isystem$cxxinc/${TRIPLETS[$a]}
-stdlib++-isystem$cxxinc/backward
EOF
else
$CAT << EOF >| $cfgfile
--gcc-install-dir=$GCCPATH/lib/gcc/${TRIPLETS[$BUILD_ARCH]}/$DEFAULT_GCC_VER
EOF
fi
done
}

CONFIGURE_OPTS[amd64]=
CONFIGURE_OPTS[amd64_WS]="
-DCMAKE_BUILD_TYPE=Release
Expand All @@ -70,7 +93,6 @@ CONFIGURE_OPTS[amd64_WS]="
-DCMAKE_CXX_COMPILER=\"$CXX\"
-DCMAKE_C_LINK_FLAGS=\"${LDFLAGS[amd64]}\"
-DCMAKE_CXX_LINK_FLAGS=\"${LDFLAGS[amd64]}\"
-DGCC_INSTALL_PREFIX=\"$GCCPATH\"
-DCLANG_VENDOR=\"$DISTRO/$RELVER\"
-DCLANG_DEFAULT_RTLIB=libgcc
-DCLANG_DEFAULT_CXX_STDLIB=libstdc++
Expand Down
5 changes: 4 additions & 1 deletion build/clang/local.mog
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# http://www.illumos.org/license/CDDL.
#

# Copyright 2023 OmniOS Community Edition (OmniOSce) Association.
# Copyright 2024 OmniOS Community Edition (OmniOSce) Association.

# Skip dependency resolution for python components
<transform file path=$(PREFIX)/share/$(PROG)/.*\.py$ \
Expand All @@ -31,5 +31,8 @@ link path=$(OPREFIX)/bin/$(PROG)++-$(VERSION) target=../$(PKGROOT)/bin/$(PROG)++
<transform path=.*/s?bin/[^/]+-$(VERSION)$ -> delete mediator .>
<transform path=.*/s?bin/[^/]+-$(VERSION)$ -> delete mediator-version .>

# drop config symlinks
<transform link path=$(OPREFIX)/bin/.+\.cfg$ -> drop>

license LICENSE.TXT license=Apache2

0 comments on commit 4f34479

Please sign in to comment.