Skip to content

Commit

Permalink
_build.sh: apply mman.h hack to alpine+gcc
Browse files Browse the repository at this point in the history
Did not investigate why this is needed for this combination.
  • Loading branch information
vszakats committed Oct 10, 2023
1 parent 7ec4f53 commit d2d78d5
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions _build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -997,17 +997,22 @@ build_single_target() {
_BINUTILS_SUFFIX="${_CCSUFFIX}"
fi

if [ "${_CRT}" = 'musl' ] && [ "${_DISTRO}" = 'debian' ]; then
if [ "${_CRT}" = 'musl' ]; then
if [ "${_OPENSSL}" = 'quictls' ] || \
[ "${_OPENSSL}" = 'openssl' ]; then
# Workaround for:
# ../crypto/mem_sec.c:60:13: fatal error: linux/mman.h: No such file or directory
# Based on: https://github.com/openssl/openssl/issues/7207#issuecomment-880121450
_my_incdir='_sys_include'; rm -r -f "${_my_incdir}"; mkdir "${_my_incdir}"; _my_incdir="$(pwd)/${_my_incdir}"
ln -s "/usr/include/${_TRIPLETSH}/asm" "${_my_incdir}/asm"
ln -s "/usr/include/asm-generic" "${_my_incdir}/asm-generic"
ln -s "/usr/include/linux" "${_my_incdir}/linux"
_CPPFLAGS_GLOBAL="${_CPPFLAGS_GLOBAL} -isystem ${_my_incdir}"
mman_hack=0
[ "${_DISTRO}" = 'debian' ] && mman_hack=1
[ "${_DISTRO}" = 'alpine' ] && [ "${_CC}" = 'gcc' ] && mman_hack=1
if [ "${mman_hack}" = '1' ]; then
# Workaround for:
# ../crypto/mem_sec.c:60:13: fatal error: linux/mman.h: No such file or directory
# Based on: https://github.com/openssl/openssl/issues/7207#issuecomment-880121450
_my_incdir='_sys_include'; rm -r -f "${_my_incdir}"; mkdir "${_my_incdir}"; _my_incdir="$(pwd)/${_my_incdir}"
ln -s "/usr/include/${_TRIPLETSH}/asm" "${_my_incdir}/asm"
ln -s "/usr/include/asm-generic" "${_my_incdir}/asm-generic"
ln -s "/usr/include/linux" "${_my_incdir}/linux"
_CPPFLAGS_GLOBAL="${_CPPFLAGS_GLOBAL} -isystem ${_my_incdir}"
fi
fi
fi

Expand Down

0 comments on commit d2d78d5

Please sign in to comment.