diff --git a/include/slibtool/slibtool.h b/include/slibtool/slibtool.h index 24dd8be..cb9a75d 100644 --- a/include/slibtool/slibtool.h +++ b/include/slibtool/slibtool.h @@ -53,6 +53,9 @@ extern "C" { #define SLBT_DRIVER_NO_UNDEFINED 0x040000 #define SLBT_DRIVER_MODULE 0x080000 #define SLBT_DRIVER_AVOID_VERSION 0x100000 +#define SLBT_DRIVER_IMAGE_ELF 0x200000 +#define SLBT_DRIVER_IMAGE_PE 0x400000 +#define SLBT_DRIVER_IMAGE_MACHO 0x800000 /* execution modes */ enum slbt_mode { @@ -132,6 +135,7 @@ struct slbt_host_params { }; struct slbt_flavor_settings { + const char * imagefmt; const char * arprefix; const char * arsuffix; const char * dsoprefix; diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c index 919e823..36f1466 100644 --- a/src/driver/slbt_driver_ctx.c +++ b/src/driver/slbt_driver_ctx.c @@ -16,15 +16,15 @@ /* flavor settings */ -#define SLBT_FLAVOR_SETTINGS(flavor,arp,ars,dsop,dsos,exep,exes,impp,imps,ldenv) \ +#define SLBT_FLAVOR_SETTINGS(flavor,bfmt,arp,ars,dsop,dsos,exep,exes,impp,imps,ldenv) \ static const struct slbt_flavor_settings flavor = { \ - arp,ars,dsop,dsos,exep,exes,impp,imps,ldenv} + bfmt,arp,ars,dsop,dsos,exep,exes,impp,imps,ldenv} -SLBT_FLAVOR_SETTINGS(host_flavor_default, "lib",".a", "lib",".so", "","", "", "", "LD_LIBRARY_PATH"); -SLBT_FLAVOR_SETTINGS(host_flavor_midipix, "lib",".a", "lib",".so", "","", "lib",".lib.a", "PATH"); -SLBT_FLAVOR_SETTINGS(host_flavor_mingw, "lib",".a", "lib",".dll", "",".exe", "lib",".dll.a", "PATH"); -SLBT_FLAVOR_SETTINGS(host_flavor_cygwin, "lib",".a", "lib",".dll", "",".exe", "lib",".dll.a", "PATH"); -SLBT_FLAVOR_SETTINGS(host_flavor_darwin, "lib",".a", "lib",".dylib", "","", "", "", "DYLD_LIBRARY_PATH"); +SLBT_FLAVOR_SETTINGS(host_flavor_default, "elf", "lib",".a", "lib",".so", "","", "", "", "LD_LIBRARY_PATH"); +SLBT_FLAVOR_SETTINGS(host_flavor_midipix, "pe", "lib",".a", "lib",".so", "","", "lib",".lib.a", "PATH"); +SLBT_FLAVOR_SETTINGS(host_flavor_mingw, "pe", "lib",".a", "lib",".dll", "",".exe", "lib",".dll.a", "PATH"); +SLBT_FLAVOR_SETTINGS(host_flavor_cygwin, "pe", "lib",".a", "lib",".dll", "",".exe", "lib",".dll.a", "PATH"); +SLBT_FLAVOR_SETTINGS(host_flavor_darwin, "macho","lib",".a", "lib",".dylib", "","", "", "", "DYLD_LIBRARY_PATH"); /* annotation strings */ @@ -440,6 +440,13 @@ static void slbt_init_flavor_settings(struct slbt_common_ctx * cctx) else settings = &host_flavor_default; + if (!strcmp(settings->imagefmt,"elf")) + cctx->drvflags |= SLBT_DRIVER_IMAGE_ELF; + else if (!strcmp(settings->imagefmt,"pe")) + cctx->drvflags |= SLBT_DRIVER_IMAGE_PE; + else if (!strcmp(settings->imagefmt,"macho")) + cctx->drvflags |= SLBT_DRIVER_IMAGE_PE; + memcpy(&cctx->settings,settings,sizeof(*settings)); }