tacacs: fix musl build

This commit is contained in:
Jürgen Buchmüller 2020-06-11 13:53:50 +02:00
parent 0955edecfb
commit c051ca9327
2 changed files with 148 additions and 6 deletions

View file

@ -0,0 +1,145 @@
Source: @pullmoll
Upstream: no
Reason: The test whether child processes need to be reaped makes the
x86_64-musl build hang forever. For now simply assume we need
the same as glibc for musl and always add "#define REAPCHILD 1"
and also "#define REAPSIGIGN 1" to confdefs.h
Also remove the "-lnsl" from the LIBS for musl.
--- configure.orig 2015-01-06 22:55:35.000000000 +0100
+++ configure 2020-06-11 13:26:11.442527446 +0200
@@ -3289,7 +3289,7 @@
# existence of libnsl instead of hard-coding
CPPFLAGS="$CFLAGS -I/usr/local/include"; export CPPFLAGS
LDFLAGS="$LDFLAGS -L/usr/local/lib -L/lib"; export LDFLAGS
- LIBS="-lnsl -lcrypt $LIBS"; export LIBS
+ LIBS="-lcrypt $LIBS"; export LIBS
$as_echo "#define LINUX 1" >>confdefs.h
@@ -15400,122 +15400,9 @@
fi
-# Check for need to reap children when the default is to ignore SIGCHLD
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if children need to be reaped" >&5
-$as_echo_n "checking if children need to be reaped... " >&6; }
-if test "$cross_compiling" = yes; then :
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: tac_plus may be less efficient when cross-compiled" >&5
-$as_echo "$as_me: WARNING: tac_plus may be less efficient when cross-compiled" >&2;}
- $as_echo "#define REAPCHILD 1" >>confdefs.h
-
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <signal.h>
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
-#if HAVE_SYS_RESOURCE_H
-#include <sys/resource.h>
-#endif
-#include <errno.h>
-pid_t child, pid;
-int main()
-{
- int status;
- child = vfork();
- if (child == 0)
- exit(1);
-#if HAVE_WAIT4
- pid = wait4(child, &status, WNOHANG, NULL);
-#else
- do {
- pid = wait3(&status, WNOHANG, NULL);
- } while (pid != child && pid != -1);
-#endif
- if (pid == -1 && errno == ECHILD)
- exit(0);
- exit(114);
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- $as_echo "#define REAPCHILD 1" >>confdefs.h
-
- # try again with SIG_IGN
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking if children need to be reaped with SIG_IGN" >&5
-$as_echo_n "checking if children need to be reaped with SIG_IGN... " >&6; }
- if test "$cross_compiling" = yes; then :
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot run test program while cross compiling
-See \`config.log' for more details" "$LINENO" 5; }
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <signal.h>
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
-#if HAVE_SYS_RESOURCE_H
-#include <sys/resource.h>
-#endif
-#include <errno.h>
-pid_t child, pid;
-int main()
-{
- int status;
- signal(SIGCHLD, SIG_IGN);
- child = vfork();
- if (child == 0)
- exit(1);
-#if HAVE_WAIT4
- pid = wait4(child, &status, WNOHANG, NULL);
-#else
- do {
- pid = wait3(&status, WNOHANG, NULL);
- } while (pid != child && pid != -1);
-#endif
- if (pid == -1 && errno == ECHILD)
- exit(0);
- exit(114);
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; };$as_echo "#define REAPSIGIGN 1" >>confdefs.h
-
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
+# Always define REAPCHILD and REAPSIGIGN for musl
+$as_echo "#define REAPCHILD 1" >>confdefs.h
+$as_echo "#define REAPSIGIGN 1" >>confdefs.h
# Find an appropriate tar for use in "dist" targets. A "best guess"
# is good enough -- if we can't find GNU tar, we don't really care.

View file

@ -15,13 +15,10 @@ checksum=147f2dc98d26d2f93f0aba76c988ced196ffe1c001dc2e91f788a1a2c747219e
python_version=2
disable_parallel_build=yes
if [ -z "$CROSS_BUILD" -a "$XBPS_MACHINE" = "x86_64-musl" ]; then
broken="Hangs when configure tests if children need to be reaped"
fi
pre_configure() {
# -lnsl is not required w/o libwrap and prevents musl builds; rip it out
sed -i configure -e "s;-lnsl ;;g"
if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
patch -Np0 -i ${FILESDIR}/no-reap-child-test-no-nsl.patch
fi
}
post_install() {