diff --git a/devel/compdbgen/Makefile b/devel/compdbgen/Makefile index 9d4717eedd7e..fad3099fd807 100644 --- a/devel/compdbgen/Makefile +++ b/devel/compdbgen/Makefile @@ -1,25 +1,31 @@ PORTNAME= compdbgen DISTVERSION= g20250911 CATEGORIES= devel MAINTAINER= jrm@FreeBSD.org COMMENT= General-purpose tool for generating compile_commands.json files WWW= https://github.com/Virus-V/compdbgen LICENSE= BSD2CLAUSE LICENSE_FILE= ${WRKSRC}/LICENSE USE_GITHUB= yes GH_ACCOUNT= Virus-V GH_TAGNAME= 726a5c1d9b94650ced9dc13044e9459bc8780364 GH_TUPLE= DaveGamble:cJSON:c859b25da02955fef659d658b8f324b5cde87be3:cJSONS/cjson PLIST_FILES= bin/${PORTNAME} do-build: @cd ${WRKSRC}/ && ${SH} ./build.sh do-install: ${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin +.include + +.if ${OPSYS} == FreeBSD && ${OSVERSION} < 1400000 +EXTRA_PATCHES= ${PATCHDIR}/extra-patch-mainloop.c +.endif + .include diff --git a/devel/compdbgen/files/extra-patch-mainloop.c b/devel/compdbgen/files/extra-patch-mainloop.c new file mode 100644 index 000000000000..33a01eecebac --- /dev/null +++ b/devel/compdbgen/files/extra-patch-mainloop.c @@ -0,0 +1,35 @@ +--- mainloop.c.orig 2025-09-11 04:56:11 UTC ++++ mainloop.c +@@ -433,20 +433,32 @@ static void enter_syscall(struct glbctx *info, struct + static int json_item_cnt = 0; + struct syscall *sc; + u_int i, narg; ++#if defined(__FreeBSD_version) && __FreeBSD_version < 1400000 ++ register_t *args; ++#else + syscallarg_t *args; ++#endif + + /* ignore other syscall except execve */ + if (pl->pl_syscall_code != SYS_execve) { + return; + } + ++#if defined(__FreeBSD_version) && __FreeBSD_version < 1400000 ++ args = calloc(pl->pl_syscall_narg, sizeof(register_t)); ++#else + args = calloc(pl->pl_syscall_narg, sizeof(syscallarg_t)); ++#endif + if (args == NULL) { + err(1, "malloc syscall args failed\n"); + } + + if (ptrace(PT_GET_SC_ARGS, t->tid, (caddr_t)args, ++#if defined(__FreeBSD_version) && __FreeBSD_version < 1400000 ++ sizeof(register_t) * pl->pl_syscall_narg) != 0) { ++#else + sizeof(syscallarg_t) * pl->pl_syscall_narg) != 0) { ++#endif + goto _EXIT; + } +