diff --git a/srcpkgs/mongoose/template b/srcpkgs/mongoose/template index c9e41c4f7a2e24..569a4cf5c96153 100644 --- a/srcpkgs/mongoose/template +++ b/srcpkgs/mongoose/template @@ -14,24 +14,49 @@ license="GPL-2.0-only" homepage="https://mongoose.ws/" distfiles="https://github.com/cesanta/mongoose/archive/${version}.tar.gz" checksum=1ef09d971b6de1a6317c109980d6fb5a9c19b39efef2506d6b76869644b3dafa - +CFLAGS="-fPIC -Wno-error=unused-function" # fix-tests.patch causes unused-function export SSL=OPENSSL -CFLAGS+=" -fPIC" -case "$XBPS_TARGET_MACHINE" in - *-musl) CFLAGS+=" -Wno-error=sign-conversion" # FD(c_) macro is broken - make_check_args+=" NO_SANITIZE=1" ;; # libsanitizer-devel unavailable - *) checkdepends+=" libsanitizer-devel" ;; -esac +if [ "$XBPS_TARGET_LIBC" = musl ]; then + # libsanitizer-devel is currenly not available on musl + make_check_args+=" NO_SANITIZE=1" +else + checkdepends+=" libsanitizer-devel" +fi # GitHub CI runner doesn't support IPv6, causing tests to fail if [ "$XBPS_BUILD_ENVIRONMENT" = "void-packages-ci" ]; then make_check_args+=" IPV6=0" fi -pre_check() { - # -Wunused-function -Werror and fix-tests.patch are enemies - CFLAGS+=" -Wno-error=unused-function" +post_extract() { + if [ "$XBPS_TARGET_LIBC" = musl ]; then + # GCC falsely flags musl's FD_{SET,ISSET,CLR} macros as -Wsign-conversion + # https://github.com/cesanta/mongoose/issues/1501#issuecomment-1082750154 + # https://inbox.vuxu.org/musl/20200803174707.GF6949@brightrain.aerifal.cx/T/ + vsed -i src/sock.c -e ' +/[[:space:]]FD_SET(/b label +/[[:space:]]FD_ISSET(/b label +/[[:space:]]FD_CLR(/b label +b +:label +i\ +#pragma GCC diagnostic push\ +#pragma GCC diagnostic ignored "-Wsign-conversion" +p +i\ +#pragma GCC diagnostic pop +d' + # What the above sed script does - + # Searches for FD_{SET,ISSET,CLR} + # - If found, jump to the line after :label + # - If not found, go to the end of the script (print current line as-is) + # :label + # - [i] Insert the two #pragma lines + # - [p] Insert the current line + # - [i] Insert the remaining #pragma line + # - [d] Proceed to the next line of input + fi } mongoose-devel_package() {