libmagic: Add swap.c and magic.h to SRCS.

file 5.48 added swap.c and swap.h for byte-swapping operations, which are
required on hosts that lack <byteswap.h> or <sys/bswap.h> (e.g. macOS cross-building
or older FreeBSD bootstrap environments).

Also add magic.h to SRCS so object files depend on the generated header
before compiling, avoiding falling back to the host's /usr/include/magic.h
during parallel builds.

Reported by:    wosch
MFC after:      1 week
Fixes:          7af41682a9 ("MFV: file 5.48")
This commit is contained in:
Xin LI committed 2026-09-05 16:57:30 -07:00
1 parent 76f5fccc5f
commit 8929675e11
1 file changed
+4 -2
+4 -2
View File
@@ -19,7 +19,9 @@ SRCS= apprentice.c apptype.c ascmagic.c buffer.c cdf.c cdf_time.c \
compress.c der.c encoding.c fsmagic.c funcs.c is_json.c \
is_csv.c \
is_simh.c \
is_tar.c magic.c print.c readcdf.c readelf.c seccomp.c softmagic.c
is_tar.c magic.c print.c readcdf.c readelf.c seccomp.c softmagic.c \
swap.c
SRCS+= magic.h
INCS= magic.h
MAGICPATH?= /usr/share/misc
@@ -62,7 +64,7 @@ CLEANFILES+= mkmagic
DEPENDOBJS+= mkmagic
build-tools: mkmagic
# For the non-dirdeps build, HOST_CC is CC by default
mkmagic: apprentice.c cdf_time.c encoding.c funcs.c magic.c print.c ${INCS} ${BUILD_TOOLS_META}
mkmagic: apprentice.c cdf_time.c encoding.c funcs.c magic.c print.c swap.c ${INCS} ${BUILD_TOOLS_META}
${HOST_CC:N${CCACHE_BIN}} ${CFLAGS} -DCOMPILE_ONLY ${LDFLAGS} -o ${.TARGET} \
${.ALLSRC:N*.h:O:u} ${LDADD}