From: Jeremy Harris Date: Mon, 12 Aug 2024 14:40:22 +0000 (+0100) Subject: better build for dyn modules X-Git-Url: https://git.exim.org/exim.git/commitdiff_plain/4d10782e6dc0928b4b9ac6f3980f71f3b05383f6?hp=9995dd161eda29d2f5213f124e0042ec01a5ab5e better build for dyn modules --- diff --git a/src/OS/Makefile-Base b/src/OS/Makefile-Base index f494249bf..5b74b6ac8 100644 --- a/src/OS/Makefile-Base +++ b/src/OS/Makefile-Base @@ -36,7 +36,7 @@ FE = $(FULLECHO) # up-to-date. Then the os-specific source files and the C configuration file # are set up, and finally it goes to the main Exim target. -all: utils exim +all: utils exim dynmodules config: $(EDITME) checklocalmake Makefile os.c config.h version.h version.sh macro.c exim_openssl exim_gnutls: clean exim @@ -245,7 +245,7 @@ macro.c: macro_predef .PHONY: all config utils \ buildauths buildlookups buildpdkim buildrouters \ - buildtransports checklocalmake clean + buildtransports dynmodules checklocalmake clean utils: $(EXIM_MONITOR) exicyclog exinext exiwhat \ @@ -943,6 +943,18 @@ $(MONBIN): $(HDRS) # Targets for the various libraries that Exim uses. +# Copies of modules built as dynamic-load libraries + +dynmodules: buildlookups buildrouters buildtransports buildauths + rm -fr dynmodules + mkdir dynmodules + for d in lookup router transport auth; do \ + for f in $${d}s/*.so; do \ + [ -e $$f ] && ln $$f dynmodules/`basename $$f .so`_$$d.so; \ + done; \ + done; \ + true + # The lookups library. buildlookups: config diff --git a/src/src/drtables.c b/src/src/drtables.c index 424c6197c..19a70ab8b 100644 --- a/src/src/drtables.c +++ b/src/src/drtables.c @@ -770,12 +770,13 @@ addlookupmodule(NULL, &readsock_lookup_module_info); if (!(dd = exim_opendir(CUS LOOKUP_MODULE_DIR))) { DEBUG(D_lookup) debug_printf("Couldn't open %s: not loading lookup modules\n", LOOKUP_MODULE_DIR); - log_write(0, LOG_MAIN, "Couldn't open %s: not loading lookup modules\n", LOOKUP_MODULE_DIR); + log_write(0, LOG_MAIN|LOG_PANIC, + "Couldn't open %s: not loading lookup modules\n", LOOKUP_MODULE_DIR); } else { const pcre2_code * regex_islookupmod = regex_must_compile( - US"\\." DYNLIB_FN_EXT "$", MCS_NOFLAGS, TRUE); + US"_lookup\\." DYNLIB_FN_EXT "$", MCS_NOFLAGS, TRUE); DEBUG(D_lookup) debug_printf("Loading lookup modules from %s\n", LOOKUP_MODULE_DIR); while ((ent = readdir(dd))) diff --git a/src/src/lookups/Makefile b/src/src/lookups/Makefile index 19585bf31..f305e0655 100644 --- a/src/src/lookups/Makefile +++ b/src/src/lookups/Makefile @@ -2,16 +2,17 @@ # This is called from the main make file, after cd'ing # to the lookups subdirectory. # -# Copyright (c) The Exim Maintainers 2021 +# Copyright (c) The Exim Maintainers 2021 - 2024 # nb: at build time, the version of this file used will have had some # extra variable definitions and prepended to it and module build rules -# interpolated below. +# interpolated below. This is done by scripts/lookups-Makefile. # MAGIC-TAG-MODS-OBJ-RULES-GO-HERE all: lookups.a lf_quote.o lf_check_file.o lf_sqlperform.o $(MODS) +# for f in *.so; do mv $$f `basename $$f .so`_lookup.so; done lookups.a: $(OBJ) @$(RM_COMMAND) -f lookups.a diff --git a/test/runtest b/test/runtest index b89960a8b..d73bc393e 100755 --- a/test/runtest +++ b/test/runtest @@ -4138,7 +4138,7 @@ system("sudo cp eximdir/exim eximdir/exim_exim;" . ($parm_exim_dir) = $parm_exim =~ m?^(.*)/exim?; -while (my $file = glob("$parm_exim_dir/lookups/*.so")) { +while (my $file = glob("$parm_exim_dir/dynmodules/*.so")) { my $base = basename($file); cp("$file", "eximdir/"); system("sudo chmod 755 eximdir/$base");