Hi,

attached is a patch (mainly to Makefiles) which builds and installs
a shared lib 'lib3dkit.so' (I chose the name after the header file
3dkit.h) and installs the headers 3dkit.h / triangle.h. The patch
applies to svgalib 1.9.12.

I'd really love to see this going into the distribution as I think
the 3dkit functions are really useful. Note that the documentation
is already there.

-- 
   Johannes
*** ./threeDKit/quickmath.h.orig        Wed Jan 30 10:29:58 2002
--- ./threeDKit/quickmath.h     Wed Jan 30 10:13:59 2002
***************
*** 25,32 ****
--- 25,34 ----
  #ifndef QUICK_MATH_H
  #define QUICK_MATH_H
  
+ #if 0
  #ifndef SVGALIB
  #include "../config.h"
+ #endif
  #endif
  
  #ifndef PI
*** ./threeDKit/Makefile.orig   Sun Jul 23 22:00:26 2000
--- ./threeDKit/Makefile        Wed Jan 30 10:42:17 2002
***************
*** 1,54 ****
  #----------------------------------------------------------------------
! # Makefile for plane and wrapdemo. See README file.
! #
! # This file is a part of SVGAlib.
  #----------------------------------------------------------------------
  
  include ../Makefile.cfg
  
  srcdir    = ..
! VPATH     = $(srcdir)/threeDKit
  
  #----------------------------------------------------------------------
  # Compiler Section (overrides Makefile.cfg)
  #----------------------------------------------------------------------
  
! LOCAL_DEFINES = -DSVGALIB
! CFLAGS = $(WARN) $(OPTIMIZE) -I$(srcdir)/include -I$(srcdir)/gl -I. $(LOCAL_DEFINES)
! DLLFLAGS  =
  
  #----------------------------------------------------------------------
  # Rules Section
  #----------------------------------------------------------------------
  
! OBJECTS = 3dinit.o 3dkit.o wrapsurf.o quickmath.o triangle.o striangle.o \
!           wtriangle.o swtriangle.o
! 
  # Determine what library (static or shared) we will be linking programs with
  ifdef INSTALLSHAREDLIB
    LIBS = -lm -lvgagl -lvga
  endif
  ifndef LIBS
!   LIBS    = -lm ../staticlib/libvgagl.a ../staticlib/libvga.a
!   LVGADEP = ../staticlib/libvgagl.a ../staticlib/libvga.a
  endif
  
! .PHONY: clean
  
! all: plane wrapdemo
  
  plane: planukit.o planinit.o $(OBJECTS) $(LVGADEP)
        $(CC) $(LDFLAGS) -o plane planukit.o planinit.o $(OBJECTS) $(LIBS)
!       chown root plane
!       chmod u+s plane
  
  wrapdemo: wrapdemo.o $(OBJECTS) $(LVGADEP)
        $(CC) $(CFLAGS) $(LDFLAGS) -o wrapdemo wrapdemo.c $(OBJECTS) $(LIBS)
!       chown root wrapdemo
!       chmod u+s wrapdemo
! 
! .c.o:
!       $(CC) $(CFLAGS) -c -o $*.o $<
  
  clean:
!       rm -f *.o plane wrapdemo *.bak
--- 1,91 ----
  #----------------------------------------------------------------------
! # Makefile for threeDKit
  #----------------------------------------------------------------------
  
+ # *** NO SERVICIBLE PARTS HERE!
+ #     All options are in Makefile.cfg.
+ 
  include ../Makefile.cfg
  
  srcdir    = ..
! VPATH     = $(srcdir)/src
  
  #----------------------------------------------------------------------
  # Compiler Section (overrides Makefile.cfg)
  #----------------------------------------------------------------------
  
! INCLUDES += -I$(srcdir)/src
  
  #----------------------------------------------------------------------
  # Rules Section
  #----------------------------------------------------------------------
  
! CFILES = 3dinit.c 3dkit.c quickmath.c swtriangle.c triangl.c triangle.c wrapsurf.c 
wtriangle.c
! OBJECTS = $(CFILES:.c=.o)
!       #
  # Determine what library (static or shared) we will be linking programs with
  ifdef INSTALLSHAREDLIB
    LIBS = -lm -lvgagl -lvga
  endif
  ifndef LIBS
!   LIBS    = -lm $(srcdir)/staticlib/libvgagl.a $(srcdir)/staticlib/libvga.a
!   LVGADEP = $(srcdir)/staticlib/libvgagl.a $(srcdir)/staticlib/libvga.a
  endif
  
! .c.o:
!       $(CC) $(CFLAGS) -c -o $*.o $<
! 
! .c.s:
!       $(CC) $(CFLAGS) -S -o $*.s $<
! 
! .PHONY:       all clean install installheaders
! 
! 
! 
! ifeq (a.out, $(TARGET_FORMAT))
! 
! all:  lib3dkit.a plane wrapdemo
! 
! else                                                               
! 
! all:  lib3dkit.so.$(VERSION) plane wrapdemo
  
! # These rules are for ELF only.
! lib3dkit.so.$(VERSION): $(OBJECTS)
!       $(CC) -shared -Wl,-soname,lib3dkit.so.$(MAJOR_VER) \
!         -o lib3dkit.so.$(VERSION) $(OBJECTS) -lm
! 
! $(sharedlibdir)/lib3dkit.so.$(VERSION): lib3dkit.so.$(VERSION)
!       $(INSTALL_PROGRAM) $< $(sharedlibdir)/$<
!       (cd $(sharedlibdir); ln -sf lib3dkit.so.$(VERSION) `echo 
lib3dkit.so.$(VERSION) | sed 's/\.so\..*/.so/'` )
!       ldconfig
! 
! install: $(sharedlibdir)/lib3dkit.so.$(VERSION) installheaders
! 
! installheaders:
!       @cp 3dkit.h $(includedir)/3dkit.h
!       @chmod a+r $(includedir)/3dkit.h
!       @cp triangle.h $(includedir)/triangle.h
!       @chmod a+r $(includedir)/triangle.h
! 
! endif   
! 
! 
! lib3dkit.a: $(ALLOBJS)
!       rm -f lib3dkit.a
!       $(AR) rcs lib3dkit.a $(ALLOBJS)
  
  plane: planukit.o planinit.o $(OBJECTS) $(LVGADEP)
        $(CC) $(LDFLAGS) -o plane planukit.o planinit.o $(OBJECTS) $(LIBS)
!       # chown root plane
!       # chmod u+s plane
  
  wrapdemo: wrapdemo.o $(OBJECTS) $(LVGADEP)
        $(CC) $(CFLAGS) $(LDFLAGS) -o wrapdemo wrapdemo.c $(OBJECTS) $(LIBS)
!       # chown root wrapdemo
!       # chmod u+s wrapdemo
  
  clean:
!       rm -f *.o core
! 
! 
*** ./Makefile.orig     Wed Jan 30 09:52:31 2002
--- ./Makefile  Wed Jan 30 10:27:15 2002
***************
*** 265,273 ****
  
  installmodule:
        (cd kernel/svgalib_helper ; $(MAKE) install )
         
  install: uninstall $(INSTALLAOUTLIB) installheaders $(INSTALLSHAREDLIB) 
installconfig \
!       $(INSTALLSTATICLIB) $(INSTALLUTILS) $(INSTALLMAN) installmodule
        @echo
        @echo
        @echo Now run "'make demoprogs'" to make the test and demo programs in
--- 265,276 ----
  
  installmodule:
        (cd kernel/svgalib_helper ; $(MAKE) install )
+ 
+ lib3dkit-install:
+       (cd threeDKit/; $(MAKE) install)
         
  install: uninstall $(INSTALLAOUTLIB) installheaders $(INSTALLSHAREDLIB) 
installconfig \
!       $(INSTALLSTATICLIB) $(INSTALLUTILS) $(INSTALLMAN) installmodule 
lib3dkit-install
        @echo
        @echo
        @echo Now run "'make demoprogs'" to make the test and demo programs in

Reply via email to