Subject: XFree86-2.0 shared libraries
To: netbsd-current-users <current-users@sun-lamp.cs.berkeley.edu>
From: Thomas Eberhardt <thomas@mathematik.uni-Bremen.de>
List: current-users
Date: 11/14/1993 15:42:06
I've rebuild my entire X world to use shared libraries using the latest
ld & ld.so.  Seems to work fine.  Appended are my additions/changes to
the config directory.  Hope this is useful for others too.

*** config/nbsdLib.rules-	Tue Jan  1 00:00:00 1980
--- config/nbsdLib.rules	Sat Nov 13 15:39:02 1993
***************
*** 0 ****
--- 1,73 ----
+ /*
+  * NetBSD shared library rules
+  */
+ 
+ #ifndef HasSharedLibraries
+ #define HasSharedLibraries YES
+ #endif
+ #ifndef ForceNormalLib
+ #define ForceNormalLib YES
+ #endif
+ #ifndef SharedDataSeparation
+ #define SharedDataSeparation NO
+ #endif
+ #ifndef SharedCodeDef
+ #define SharedCodeDef /**/
+ #endif
+ #ifndef SharedLibraryDef
+ #define SharedLibraryDef /**/
+ #endif
+ #ifndef ShLibIncludeFile
+ #define ShLibIncludeFile <nbsdLib.tmpl>
+ #endif
+ #ifndef SharedLibraryLoadFlags
+ #define SharedLibraryLoadFlags -Bshareable
+ #endif
+ #ifndef PositionIndependentCFlags
+ #define PositionIndependentCFlags -fpic
+ #endif
+ 
+ /*
+  * InstallSharedLibrary - generate rules to install the shared library.
+  */
+ #ifndef InstallSharedLibrary
+ #define	InstallSharedLibrary(libname,rev,dest)				@@\
+ install:: Concat(lib,libname.so.rev) 					@@\
+ 	MakeDir($(DESTDIR)dest)						@@\
+ 	$(INSTALL) -c $(INSTLIBFLAGS) Concat(lib,libname.so.rev) $(DESTDIR)dest @@\
+ 
+ #endif /* InstallSharedLibrary */
+ 
+ /*
+  * InstallSharedLibraryData - generate rules to install the shared library data
+  */
+ #ifndef InstallSharedLibraryData
+ #define	InstallSharedLibraryData(libname,rev,dest)
+ #endif /* InstallSharedLibraryData */
+ 
+ /*
+  * NormalSharedLibraryTarget - generate rules to create a shared library;
+  * build it into a different name so that the we do not hose people by having
+  * the library gone for long periods.
+  */
+ #ifndef SharedLibraryTarget
+ #define SharedLibraryTarget(libname,rev,solist,down,up)			@@\
+ AllTarget(Concat(lib,libname.so.rev))					@@\
+ 									@@\
+ Concat(lib,libname.so.rev):  solist					@@\
+ 	$(RM) $@~							@@\
+ 	(cd down; $(LD) -o up/$@~ $(SHLIBLDFLAGS) solist)		@@\
+ 	$(RM) $@ 							@@\
+ 	$(MV) $@~ $@							@@\
+ 									@@\
+ clean::									@@\
+ 	$(RM) Concat(lib,libname.so.rev)
+ 
+ #endif /* SharedLibraryTarget */
+ 
+ /*
+  * SharedLibraryDataTarget - generate rules to create shlib data file;
+  */
+ #ifndef SharedLibraryDataTarget
+ #define SharedLibraryDataTarget(libname,rev,salist)
+ #endif /* SharedLibraryDataTarget */
*** config/nbsdLib.tmpl-	Tue Jan  1 00:00:00 1980
--- config/nbsdLib.tmpl	Sat Nov 13 16:14:20 1993
***************
*** 0 ****
--- 1,76 ----
+ /*
+  * NetBSD shared library template
+  */
+ 
+ #ifndef SharedXlibRev
+ #define SharedXlibRev 0.0
+ #endif
+ #ifndef SharedOldXRev
+ #define SharedOldXRev 0.0
+ #endif
+ #ifndef SharedXtRev
+ #define SharedXtRev 0.0
+ #endif
+ #ifndef SharedXawRev
+ #define SharedXawRev 0.0
+ #endif
+ #ifndef SharedXmuRev
+ #define SharedXmuRev 0.0
+ #endif
+ #ifndef SharedXextRev
+ #define SharedXextRev 0.0
+ #endif
+ #ifndef SharedXinputRev
+ #define SharedXinputRev 0.0
+ #endif
+ #ifndef SharedXTrapRev
+ #define SharedXTrapRev 0.0
+ #endif
+ #ifndef SharedPexRev
+ #define SharedPexRev 0.0
+ #endif
+ 
+ SHLIBLDFLAGS = SharedLibraryLoadFlags
+ PICFLAGS = PositionIndependentCFlags
+ 
+ /*
+  * and now a little bit of magic for using imake without source tree; if we
+  * are using shared libraries, we really do not need to depend on anything
+  */
+ #if SharedLibXext
+   DEPEXTENSIONLIB = /* _UseCat($(USRLIBDIR),$(EXTENSIONSRC)/lib,/libXext.so.$(SOXEXTREV)) */
+      EXTENSIONLIB = _Use(-lXext,-L$(EXTENSIONSRC)/lib -lXext)
+ #endif
+ #if SharedLibX
+           DEPXLIB = $(DEPEXTENSIONLIB) /* _UseCat($(USRLIBDIR),$(XLIBSRC),/libX11.so.$(SOXLIBREV)) */
+              XLIB = $(EXTENSIONLIB) _Use(-lX11,-L$(XLIBSRC) -lX11)
+ #endif
+ #if SharedOldLibX
+        DEPOLDXLIB = /* _UseCat($(USRLIBDIR),$(OLDXLIBSRC),/liboldX.so.$(SOOLDXREV)) */
+           OLDXLIB = _Use(-loldX,-L$(OLDXLIBSRC) -loldX)
+ #endif
+ #if SharedLibXt
+       DEPXTOOLLIB = /* _UseCat($(USRLIBDIR),$(TOOLKITSRC),/libXt.so.$(SOXTREV)) */
+          XTOOLLIB = _Use(-lXt,-L$(TOOLKITSRC) -lXt)
+ #endif
+ #if SharedLibXaw
+         DEPXAWLIB = /* _UseCat($(USRLIBDIR),$(AWIDGETSRC),/libXaw.so.$(SOXAWREV)) */
+            XAWLIB = _Use(-lXaw,-L$(AWIDGETSRC) -lXaw)
+ #endif
+ #if SharedLibXmu
+ /* NetBSD shared libraries are deficient in link semantics */
+         DEPXMULIB = /* _UseCat($(USRLIBDIR),$(XMUSRC),/libXmu.so.$(SOXMUREV)) */
+        XMULIBONLY = _Use(-lXmu,-L$(XMUSRC) -lXmu)
+            XMULIB = $(XMULIBONLY) $(XTOOLLIB) $(XLIB)
+ #ifndef XawClientLibs
+ #define XawClientLibs $(XAWLIB) $(XMULIBONLY) $(XTOOLLIB) $(XLIB)
+ #endif
+ #endif
+ #if SharedLibXinput
+          DEPXILIB = /* _UseCat($(USRLIBDIR),$(XILIBSRC),/libXi.so.$(SOXINPUTREV)) */
+             XILIB = _Use(-lXi,-L$(XILIBSRC) -lXi)
+ #endif
+ #if SharedLibPex
+         DEPPEXLIB = /* _UseCat($(USRLIBDIR),$(PEXLIBSRC),/libPEX5.so.$(SOPEXREV)) */
+            PEXLIB = _Use(-lPEX5,-L$(PEXLIBSRC) -lPEX5)
+ #endif
*** config/x386.cf-	Mon Oct 25 05:18:08 1993
--- config/x386.cf	Sat Nov 13 03:43:48 1993
***************
*** 1016,1021 ****
--- 1016,1025 ----
  # define NeqnCmd		eqn
  #endif
  
+ #ifdef i386NetBsd
+ #include <nbsdLib.rules>
+ #endif
+ 
  #if FormattedManPages
  /*
   * Rules to install pre-formatted man pages.
***************
*** 1038,1051 ****
  install.man::                                                           @@\
  	@for i in aliases; do (cd $(DESTDIR)destdir; set -x; \          @@\
          $(RM) $$i.0; \                                                  @@\
! 	$(LN) file.0 $$i.0); \                                          @@\
  	done
! #endif
  
  #define InstallGenManPageAliases(file,destdir,suffix,aliases)		@@\
  	InstallManPageAliases(file,destdir,aliases)
  
! #endif /* FormattedManPages */
  
  
  #if defined(i386MachArchitecture)
--- 1042,1055 ----
  install.man::                                                           @@\
  	@for i in aliases; do (cd $(DESTDIR)destdir; set -x; \          @@\
          $(RM) $$i.0; \                                                  @@\
! 	ln file.0 $$i.0); \                                             @@\
  	done
! #endif /* FormattedManPages */
  
  #define InstallGenManPageAliases(file,destdir,suffix,aliases)		@@\
  	InstallManPageAliases(file,destdir,aliases)
  
! #endif /* i386BsdArchitecture */
  
  
  #if defined(i386MachArchitecture)

-- 
thomas@mathematik.uni-Bremen.de | Centrum fuer Complexe Systeme & Visualisierung
Thomas Eberhardt                | Universitaet Bremen, FB 3, Bibliothekstr. 1
Koelner Str. 4, D-28327 Bremen  | D-28359 Bremen, Germany
Home Phone: +49 421 472527      | FAX: +49 421 218-4236, Office: 218-4823

------------------------------------------------------------------------------