I am in the process of creating a meson build system for an open source project that currently uses autoconf. One of the target executables has additional configuration if dtrace is found in the host operating system. The snippet of relevant code from the makefile.am is:
if WITH_DTRACE
DTRACE_OBJ = afpd-afp_dsi.o afpd-fork.o afpd-appl.o afpd-catsearch.o afpd-directory.o afpd-enumerate.o afpd-file.o afpd-filedir.o
afp_dtrace.o: $(top_srcdir)/include/atalk/afp_dtrace.d $(DTRACE_OBJ)
if test -f afp_dtrace.o ; then rm -f afp_dtrace.o ; fi
CC=$(CC) $(LIBTOOL) --mode=execute dtrace -G -s $(top_srcdir)/include/atalk/afp_dtrace.d -o afp_dtrace.o $(DTRACE_OBJ)
afpd_LDADD += afp_dtrace.o @DTRACE_LIBS@
CLEANFILES += afp_dtrace.o
endif
So if dtrace is found libtool is used on some of the already compiled object files (DTRACE_OBJ) to create the afp_dtrace.o object using a dtrace command. This object then becomes an additional linker item for the executable :
afpd_LDADD += afp_dtrace.o @DTRACE_LIBS@
Can anyone who is familiar with meson point me in the right direction for the syntax required to achieve the same result?
I have tried using the extract_objects() function within a custom_target to no avail so far:
afpd = executable(
'afpd',
afpd_sources,
include_directories: root_includes,
link_with: [afpd_internal_deps, libatalk],
dependencies: [
afpd_external_deps,
gssapi,
kerberos,
libgcrypt,
mysqlclient,
threads,
],
c_args: [
'-DAPPLCNAME',
confdir,
dversion,
messagedir,
statedir,
uamdir,
],
export_dynamic: true,
install: true,
install_dir: sbindir,
)
if have_dtrace
afp_dtrace_object = custom_target(
'afp_dtrace_object',
input: afpd.extract_objects(
'afp_dsi.c',
'fork.c',
'appl.c',
'catsearch.c',
'directory.c',
'enumerate.c',
'file.c',
'filedir.c',
),
output: 'afp_dtrace.o',
command: [
dtrace,
'-G',
'-s', meson.project_source_root() / 'include/atalk/afp_dtrace.d',
'-o', '@OUTPUT@',
'@INPUT@',
],
)
dtrace_deps += declare_dependency(sources: afp_dtrace_object)
afpd_external_deps += dtrace_deps
endif