Skip to content

Commit 6bf5b94

Browse files
committed
wip: try github build
1 parent f144da5 commit 6bf5b94

3 files changed

Lines changed: 222 additions & 141 deletions

File tree

.docker/build-linux.sh

Lines changed: 41 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ cd build
7777
# Stick to clang-18, clang-19 has a regression for nilsimsa performance
7878
if [[ "$BUILD_DIST" == "alpine" ]]; then
7979
GCC_VERSION=
80-
CLANG_VERSION=-19
80+
CLANG_VERSION=-20
8181
elif [[ "$BUILD_DIST" == "ubuntu-2204" ]]; then
8282
GCC_VERSION=-12
8383
CLANG_VERSION=-15
@@ -287,39 +287,53 @@ if [[ "-$BUILD_TYPE-" == *-shared-* ]]; then
287287
fi
288288

289289
if [[ "-$BUILD_TYPE-" == *-static-* ]]; then
290-
if [[ "-$BUILD_TYPE-" == *-relsize-* ]]; then
291-
_LIBSTDCXXDIR="/opt/static-libs/libstdc++-Os/lib"
292-
if [[ "$ARCH" == "aarch64" ]]; then
293-
# Similar to the issue with *not* linking against `gcc_eh` in the CMakeLists.txt,
294-
# if we link against the `gcc_eh` from the `-Os` build, we run into exactly the
295-
# same issue. So we temporarily copy the size-optimized `libgcc.a` to a directory
296-
# we then use for linking.
297-
_GCCLIBDIR="/tmp/gcclib"
298-
mkdir -p "$_GCCLIBDIR"
299-
cp -a "$_LIBSTDCXXDIR"/gcc/*/*/libgcc.a "$_GCCLIBDIR"
300-
else
301-
_GCCLIBDIR=$(ls -d1 $_LIBSTDCXXDIR/gcc/*/*)
302-
fi
303-
LDFLAGS="${LDFLAGS} -L$_GCCLIBDIR -L$_LIBSTDCXXDIR"
304-
fi
305-
export LDFLAGS="${LDFLAGS} -L/opt/static-libs/$COMPILER/lib"
306-
if [[ "$ARCH" == "aarch64" ]]; then
307-
# For some reason, this dependency of libunwind is not resolved on aarch64
308-
export LDFLAGS="${LDFLAGS} -lz"
309-
fi
310-
CMAKE_ARGS="${CMAKE_ARGS} -DSTATIC_BUILD_DO_NOT_USE=1 -DWITH_UNIVERSAL_BINARY=1 -DWITH_FUSE_EXTRACT_BINARY=1"
290+
_SYSROOT="/opt/cross/Os"
291+
_MARCH="${CROSS_ARCH:-$ARCH}"
292+
_TARGET="${_MARCH}-unknown-linux-musl"
293+
export CC="${_TARGET}-${CC}"
294+
export CXX="${_TARGET}-${CXX}"
295+
export PATH="$_SYSROOT/usr/bin:$PATH"
296+
# if [[ "-$BUILD_TYPE-" == *-relsize-* ]]; then
297+
# _LIBSTDCXXDIR="/opt/static-libs/libstdc++-Os/lib"
298+
# if [[ "$ARCH" == "aarch64" ]]; then
299+
# # Similar to the issue with *not* linking against `gcc_eh` in the CMakeLists.txt,
300+
# # if we link against the `gcc_eh` from the `-Os` build, we run into exactly the
301+
# # same issue. So we temporarily copy the size-optimized `libgcc.a` to a directory
302+
# # we then use for linking.
303+
# _GCCLIBDIR="/tmp/gcclib"
304+
# mkdir -p "$_GCCLIBDIR"
305+
# cp -a "$_LIBSTDCXXDIR"/gcc/*/*/libgcc.a "$_GCCLIBDIR"
306+
# else
307+
# _GCCLIBDIR=$(ls -d1 $_LIBSTDCXXDIR/gcc/*/*)
308+
# fi
309+
# LDFLAGS="${LDFLAGS} -L$_GCCLIBDIR -L$_LIBSTDCXXDIR"
310+
# fi
311+
312+
_staticprefix="/opt/static-libs/$COMPILER/$_TARGET"
311313
if [[ "$BUILD_TYPE" == *-minimal-* ]]; then
312-
_jemallocprefix="/opt/static-libs/$COMPILER-jemalloc-minimal"
314+
_jemallocprefix="/opt/static-libs/$COMPILER-jemalloc-minimal/$_TARGET"
313315
else
314316
CMAKE_ARGS="${CMAKE_ARGS} -DWITH_PXATTR=1"
315-
_jemallocprefix="/opt/static-libs/$COMPILER-jemalloc-full"
317+
_jemallocprefix="/opt/static-libs/$COMPILER-jemalloc-full/$_TARGET"
316318
fi
317319
if [[ "$BUILD_TYPE" == *-libressl-* ]]; then
318-
_sslprefix="/opt/static-libs/$COMPILER-libressl"
320+
_sslprefix="/opt/static-libs/$COMPILER-libressl/$_TARGET"
319321
else
320-
_sslprefix="/opt/static-libs/$COMPILER-openssl"
322+
_sslprefix="/opt/static-libs/$COMPILER-openssl/$_TARGET"
323+
fi
324+
325+
export LDFLAGS="${LDFLAGS} --sysroot=$_SYSROOT -L$_staticprefix/lib -L$_SYSROOT/usr/$_TARGET/lib -lucontext"
326+
export CFLAGS="${CFLAGS} --sysroot=$_SYSROOT"
327+
export CXXFLAGS="${CXXFLAGS} --sysroot=$_SYSROOT"
328+
# if [[ "$ARCH" == "aarch64" ]]; then
329+
# # For some reason, this dependency of libunwind is not resolved on aarch64
330+
# export LDFLAGS="${LDFLAGS} -lz"
331+
# fi
332+
CMAKE_ARGS="${CMAKE_ARGS} -DSTATIC_BUILD_DO_NOT_USE=1 -DWITH_UNIVERSAL_BINARY=1 -DWITH_FUSE_EXTRACT_BINARY=1 -DSTATIC_BUILD_EXTRA_PREFIX=$_staticprefix;$_sslprefix;$_jemallocprefix"
333+
334+
if [[ -n "$CROSS_ARCH" ]]; then
335+
CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=$MARCH -DCMAKE_CROSSCOMPILING_EMULATOR=/usr/bin/qemu-$MARCH -DFOLLY_HAVE_UNALIGNED_ACCESS=OFF -DFOLLY_HAVE_WEAK_SYMBOLS=ON -DFOLLY_HAVE_LINUX_VDSO=OFF -DFOLLY_HAVE_WCHAR_SUPPORT=OFF -DHAVE_VSNPRINTF_ERRORS=OFF"
321336
fi
322-
CMAKE_ARGS="${CMAKE_ARGS} -DSTATIC_BUILD_EXTRA_PREFIX=/opt/static-libs/$COMPILER;$_sslprefix;$_jemallocprefix"
323337
fi
324338

325339
INSTALLDIR="$HOME/install"

0 commit comments

Comments
 (0)