diff --git a/srcpkgs/nsjail/files/musl-compat.h b/srcpkgs/nsjail/files/musl-compat.h new file mode 100644 index 00000000000..721b4708d2e --- /dev/null +++ b/srcpkgs/nsjail/files/musl-compat.h @@ -0,0 +1,11 @@ +#if !defined(MUSL_COMPAT_H) +#define MUSL_COMPAT_H + +# define TEMP_FAILURE_RETRY(expression) \ + (__extension__ \ + ({ long int __result; \ + do __result = (long int) (expression); \ + while (__result == -1L && errno == EINTR); \ + __result; })) + +#endif /* !defined(MUSL_COMPAT_H) */ diff --git a/srcpkgs/nsjail/patches/musl-rlim64_t.patch b/srcpkgs/nsjail/patches/musl-rlim64_t.patch new file mode 100644 index 00000000000..62a39a106d4 --- /dev/null +++ b/srcpkgs/nsjail/patches/musl-rlim64_t.patch @@ -0,0 +1,54 @@ +--- common.h 2016-09-10 03:20:32.000000000 +0200 ++++ common.h 2017-01-04 17:24:12.807104061 +0100 +@@ -100,13 +100,13 @@ + bool verbose; + bool keep_env; + bool keep_caps; +- __rlim64_t rl_as; +- __rlim64_t rl_core; +- __rlim64_t rl_cpu; +- __rlim64_t rl_fsize; +- __rlim64_t rl_nofile; +- __rlim64_t rl_nproc; +- __rlim64_t rl_stack; ++ rlim64_t rl_as; ++ rlim64_t rl_core; ++ rlim64_t rl_cpu; ++ rlim64_t rl_fsize; ++ rlim64_t rl_nofile; ++ rlim64_t rl_nproc; ++ rlim64_t rl_stack; + unsigned long personality; + bool clone_newnet; + bool clone_newuser; +--- cmdline.h 2016-09-10 03:20:32.000000000 +0200 ++++ cmdline.h 2017-01-04 17:25:32.479110539 +0100 +@@ -27,7 +27,7 @@ + + #include "common.h" + +-__rlim64_t cmdlineParseRLimit(int res, const char *optarg, unsigned long mul); ++rlim64_t cmdlineParseRLimit(int res, const char *optarg, unsigned long mul); + void cmdlineLogParams(struct nsjconf_t *nsjconf); + bool cmdlineParse(int argc, char *argv[], struct nsjconf_t *nsjconf); + +--- cmdline.c 2016-09-10 03:20:32.000000000 +0200 ++++ cmdline.c 2017-01-04 17:26:19.346114418 +0100 +@@ -137,7 +137,7 @@ + return true; + } + +-__rlim64_t cmdlineParseRLimit(int res, const char *optarg, unsigned long mul) ++rlim64_t cmdlineParseRLimit(int res, const char *optarg, unsigned long mul) + { + struct rlimit64 cur; + if (prlimit64(0, res, NULL, &cur) == -1) { +@@ -153,7 +153,7 @@ + LOG_F("RLIMIT %d needs a numeric or 'max'/'def' value ('%s' provided)", res, + optarg); + } +- __rlim64_t val = strtoull(optarg, NULL, 0) * mul; ++ rlim64_t val = strtoull(optarg, NULL, 0) * mul; + if (val == ULLONG_MAX && errno != 0) { + PLOG_F("strtoul('%s', 0)", optarg); + } diff --git a/srcpkgs/nsjail/template b/srcpkgs/nsjail/template index 9b158a1e0c6..145a169d4d3 100644 --- a/srcpkgs/nsjail/template +++ b/srcpkgs/nsjail/template @@ -10,7 +10,14 @@ homepage="https://github.com/google/$pkgname" distfiles="$homepage/archive/$version.tar.gz" checksum="9f262d56a189cf26f5c66b2c022364df979da92042f64c04300fdbb88aaba8ab" +CFLAGS="-Wno-error=format" + do_build() { + case "$XBPS_TARGET_MACHINE" in + *-musl) cp ${FILESDIR}/musl-compat.h . + sed -i common.h -e '/#include /a #include "musl-compat.h"' + ;; + esac make CC=$CC }