diff --git a/config.project b/config.project index de383e9..80669df 100644 --- a/config.project +++ b/config.project @@ -12,7 +12,7 @@ mb_disable_static=no mb_disable_shared=no # custom config step -mb_use_custom_cfgdefs=no +mb_use_custom_cfgdefs=yes mb_use_custom_cfgtest=no # pkgconfig diff --git a/project/config/cfgdefs.in b/project/config/cfgdefs.in new file mode 100644 index 0000000..191a7e7 --- /dev/null +++ b/project/config/cfgdefs.in @@ -0,0 +1,2 @@ +# optionally install libsltdl (also) as a libltdl drop-in replacement? +LTDL_DROP_IN_REPLACEMENT = @ltdl_drop_in_replacement@ diff --git a/project/config/cfgdefs.sh b/project/config/cfgdefs.sh new file mode 100644 index 0000000..ac597c9 --- /dev/null +++ b/project/config/cfgdefs.sh @@ -0,0 +1,42 @@ +# in projects where [ $mb_use_custom_cfgdefs = yes ], +# cfgdefs.sh is invoked from within ./configure via +# . $mb_project_dir/project/cfgdefs.sh + +# a successful return from cfgdefs.sh will be followed +# by a second invocation of the config_copy() function, +# reflecting any changes to common config variables +# made by cfgdefs.sh. + +# finally, cfgdefs.sh may update the contents of the +# config-time generated cfgdefs.mk. + + +ltdl_drop_in_replacement='no' + +for arg ; do + case "$arg" in + --as-ltdl-drop-in-replacement ) + ltdl_drop_in_replacement='yes' ;; + + *) + error_msg ${arg#}: "unsupported config argument." + exit 2 + esac +done + + +cfgdefs_output_custom_defs() +{ + sed \ + -e 's/@ltdl_drop_in_replacement@/'"$ltdl_drop_in_replacement"'/g' \ + "$mb_project_dir/project/config/cfgdefs.in" \ + | sed -e 's/[ \t]*$//g' \ + >> "$mb_pwd/cfgdefs.mk" +} + + +# cfgdefs.in --> cfgdefs.mk +cfgdefs_output_custom_defs + +# all done +return 0 diff --git a/project/config/cfgdefs.usage b/project/config/cfgdefs.usage new file mode 100644 index 0000000..b9fca0e --- /dev/null +++ b/project/config/cfgdefs.usage @@ -0,0 +1,6 @@ +configure: libsltdl specific switches: +-------------------------------------- + --as-ltdl-drop-in-replacement install additional symlinks that + would allow using libsltdl as a + drop-in replacement of the legacy + ltdl library. diff --git a/project/extras.mk b/project/extras.mk index e69de29..5aa769b 100644 --- a/project/extras.mk +++ b/project/extras.mk @@ -0,0 +1,37 @@ +ifeq ($(LTDL_DROP_IN_REPLACEMENT),yes) + +LIBLTDL_SOLINK = $(OS_LIB_PREFIX)ltdl$(OS_LIB_SUFFIX) +LIBLTDL_ARLINK = $(OS_LIB_PREFIX)ltdl$(OS_ARCHIVE_EXT) +LIBLTDL_IMPLIB = $(OS_LIB_PREFIX)ltdl$(OS_IMPLIB_EXT) + +install-headers-ltdl: + mkdir -p $(DESTDIR)$(INCLUDEDIR) + rm -f $(DESTDIR)$(INCLUDEDIR)/ltdl.h.tmp + ln -s sltdl/sltdl.h $(DESTDIR)$(INCLUDEDIR)/ltdl.h.tmp + mv $(DESTDIR)$(INCLUDEDIR)/ltdl.h.tmp $(DESTDIR)$(INCLUDEDIR)/ltdl.h + +install-shared-ltdl: + rm -f lib/libltdl.so.tmp + ln -s $(DSO_SOLINK) lib/libltdl.so.tmp + mv lib/libltdl.so.tmp $(DESTDIR)$(LIBDIR)/$(LIBLTDL_SOLINK) + +install-static-ltdl: + rm -f lib/libltdl.a.tmp + ln -s $(STATIC_LIB_NAME) lib/libltdl.a.tmp + mv lib/libltdl.a.tmp $(DESTDIR)$(LIBDIR)/$(LIBLTDL_ARLINK) + +install-implib-ltdl: + rm -f lib/libltdl.lib.a.tmp + ln -s $(IMP_SOLINK) lib/libltdl.lib.a.tmp + mv lib/libltdl.lib.a.tmp $(DESTDIR)$(LIBDIR)/$(LIBLTDL_IMPLIB) + + +install-headers: install-headers-ltdl +install-static: install-static-ltdl +install-shared: install-shared-ltdl + +ifeq ($(CC_BINFMT),PE) +install-shared: install-implib-ltdl +endif + +endif