Branden Robinson wrote (in a message from Thursday 18) > I'd like to solicit opinions, especially from the Core Team, about the > shared vs. static extension library situation. Debian just went through > a bit of pain and suffering as regards SDL in our development branch, > partly because we have 12 architectures to supprt for our next release. [....]
> Also, if I've gotten any facts wrong in the above analysis, please > correct me. I'm not from the XFree86 core team, so feel free to discard my message... Your analysis seem basically correct to me, to build a shared object loadable via dlopen() you need a position independant version of all code that will be loaded that way. OTOH, I'd like to say that the common habit of linking shared libraries together to allow "lazy" Makefiles to only list the first library of a list of dependent libraries should be discouraged, as it can create lots of problems (for instance it makes it impossible to use this Makefile on systems without shared libraries or on systems where shared libs don't have dependencies). Having remainded that, providing _pic.a versions for the libraries that are only available as static in XFree86 seems reasonable to me, to make it possible to make dlopen'able PIC module. I can even propose an implementation. How to decide which libraries should be provided as _pic.a ? Given that in my implementation the 'DoPicLib' variable will control the build of this library, I propose the following default value for each library XXX: #define DoPicLib HasSharedLibrary && !SharedLibXXX And below is a proposed patch to implement it (the definition of DoPicLib in each directory is left as an exercice :-) Matthieu Index: Imake.rules =================================================================== RCS file: /home/x-cvs/xc/config/cf/Imake.rules,v retrieving revision 3.101 diff -u -r3.101 Imake.rules --- Imake.rules 2001/10/02 11:44:12 3.101 +++ Imake.rules 2001/10/21 18:48:55 @@ -2550,6 +2550,20 @@ /* + * Rule to build libXXX_pic.a from PIC objects for a library + */ +#ifndef PicLibraryTarget +#define PicLibraryTarget(libname,objlist) @@\ +AllTarget(LibraryTargetNameSuffix(libname,_pic)) @@\ + @@\ +LibraryTargetNameSuffix(libname,_pic): objlist $(EXTRALIBRARYDEPS) @@\ + RemoveFile($@) @@\ + MakeLibrary($@,objlist) @@\ + RanLibrary($@) @@\ + _LinkBuildLibrary($@) +#endif /* PicLibraryTarget */ + +/* * SubdirLibraryRule - */ #ifndef SubdirLibraryRule Index: Library.tmpl =================================================================== RCS file: /home/x-cvs/xc/config/cf/Library.tmpl,v retrieving revision 3.15 diff -u -r3.15 Library.tmpl --- Library.tmpl 2001/08/27 17:40:55 3.15 +++ Library.tmpl 2001/10/21 18:49:08 @@ -3,7 +3,7 @@ * that Imakefiles in the various library subtrees will need. * * Before including this, you must set the following boolean variables: - * DoNormalLib, DoSharedLib, DoDebugLib, DoProfileLib + * DoNormalLib, DoSharedLib, DoDebugLib, DoProfileLib, DoPicLib * * To get automatic generation of standard rules, also set the variables: * LibName, SoRev, HasSharedData, and optionally HugeLibrary and IncSubdir. @@ -21,8 +21,15 @@ XCOMM $XFree86: xc/config/cf/Library.tmpl,v 3.15 2001/08/27 17:40:55 dawes Exp $ +/* + * Some libraries may not define DoPicLib + */ +#ifndef DoPicLib +# define DoPicLib NO +#endif + #ifndef LibraryCplusplusOptions -# if DoSharedLib && defined(SharedLibraryCplusplusOptions) +# if (DoSharedLib || DoPicLib) && defined(SharedLibraryCplusplusOptions) # define LibraryCplusplusOptions SharedLibraryCplusplusOptions # else # define LibraryCplusplusOptions DefaultCplusplusOptions @@ -48,14 +55,14 @@ #ifndef CplusplusSource # ifndef LibraryCcCmd -# if DoSharedLib && defined(SharedLibraryCcCmd) +# if (DoSharedLib || DoPicLib) && defined(SharedLibraryCcCmd) # define LibraryCcCmd SharedLibraryCcCmd # else # define LibraryCcCmd CcCmd # endif # endif # ifndef LibraryCCOptions -# if DoSharedLib && defined(SharedLibraryCCOptions) +# if (DoSharedLib || DoPicLib) && defined(SharedLibraryCCOptions) # define LibraryCCOptions SharedLibraryCCOptions # else # define LibraryCCOptions DefaultCCOptions @@ -73,14 +80,14 @@ # endif #else # ifndef LibraryCplusplusCmd -# if DoSharedLib && defined(SharedLibraryCplusplusCmd) +# if (DoSharedLib || DoPicLib) && defined(SharedLibraryCplusplusCmd) # define LibraryCplusplusCmd SharedLibraryCplusplusCmd # else # define LibraryCplusplusCmd CplusplusCmd # endif # endif # ifndef LibraryCplusplusOptions -# if DoSharedLib && defined(SharedLibraryCplusplusOptions) +# if (DoSharedLib || DoPicLib) && defined(SharedLibraryCplusplusOptions) # define LibraryCplusplusOptions SharedLibraryCplusplusOptions # else # define LibraryCplusplusOptions DefaultCplusplusOptions @@ -140,7 +147,7 @@ # define _NormalObjCplusplusCompile(options) $(_NULLCMD_) # define _NormalCleanDir() $(_NULLCMD_) #else -# if DoSharedLib && SeparateSharedCompile +# if (DoSharedLib || DoPicLib) && SeparateSharedCompile # define _NormalLibMkdir() _LibMkdir(unshared) # define _NormalObjCompile(options) UnsharedLibObjCompile(options) # define _NormalObjCplusplusCompile(options) UnsharedLibObjCplusplusCompile(options) @@ -153,7 +160,7 @@ # endif #endif -#if !DoSharedLib || (DoNormalLib && !SeparateSharedCompile) +#if !DoSharedLib && !DoPicLib || (DoNormalLib && !SeparateSharedCompile) # define _SharedObjCompile(options) $(_NULLCMD_) # define _SharedObjCplusplusCompile(options) $(_NULLCMD_) #else @@ -388,13 +395,13 @@ # endif # if DoNormalLib # if HugeLibrary -# if DoSharedLib && SeparateSharedCompile +# if (DoSharedLib || DoPicLib) && SeparateSharedCompile UnsharedLibraryTarget3($(LIBNAME),$(OBJS1),$(OBJS2),$(OBJS3),unshared,..) # else NormalLibraryTarget3($(LIBNAME),$(OBJS1),$(OBJS2),$(OBJS3)) # endif # else -# if DoSharedLib && SeparateSharedCompile +# if (DoSharedLib || DoPicLib) && SeparateSharedCompile UnsharedLibraryTarget($(LIBNAME),$(OBJS),unshared,..) # else NormalLibraryTarget($(LIBNAME),$(OBJS)) @@ -414,6 +421,12 @@ DebuggedLibraryTarget($(LIBNAME),$(OBJS)) # if !defined(LibInstall) || LibInstall InstallLibrary($(LIBNAME)_d,$(USRLIBDIR)) +# endif +# endif +# if DoPicLib +PicLibraryTarget($(LIBNAME),$(OBJS)) +# if !defined(LibInstall) || LibInstall +InstallLibrary($(LIBNAME)_pic,$(USRLIBDIR)) # endif # endif # if DoExtraLib && defined(ExtraLibRules) Matthieu _______________________________________________ Xpert mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/xpert