- add support for a shared library

- make gd respect CFLAGS
- add patch to suppress malloc.h warnings
This commit is contained in:
brad 1999-11-26 16:50:03 +00:00
parent b9e8e76450
commit e2e695ba60
3 changed files with 192 additions and 8 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.6 1999/11/26 15:47:53 brad Exp $
# $OpenBSD: Makefile,v 1.7 1999/11/26 16:50:03 brad Exp $
# $FreeBSD: Makefile,v 1.5 1998/06/25 03:13:16 vanilla Exp $
DISTNAME= gd-1.7.3
@ -23,3 +23,7 @@ post-install:
@${LDCONFIG} -m ${PREFIX}/lib
.include <bsd.port.mk>
.if defined(NO_SHARED_LIBS)
MAKE_ENV= NO_SHARED_LIBS=yes
.endif

View File

@ -1,6 +1,11 @@
--- Makefile.orig Wed Oct 13 21:20:11 1999
+++ Makefile Tue Nov 16 15:51:06 1999
@@ -15,19 +15,21 @@
--- Makefile.orig Wed Oct 13 17:20:11 1999
+++ Makefile Fri Nov 26 10:50:12 1999
@@ -11,27 +11,27 @@
#If the install command is not in your path, provide
#an explicit path for it here, or install manually.
-INSTALL=install
+#INSTALL=install
#If you don't have FreeType and/or Xpm installed, including the
#header files, uncomment this (default).
@ -8,8 +13,8 @@
+#CFLAGS=-O
#If you do have FreeType and/or Xpm fully installed, uncomment a
#variation of this and comment out the line above. See also LIBS below.
#CFLAGS=-O -DHAVE_XPM -DHAVE_LIBTTF
+CFLAGS=-O -DHAVE_LIBTTF
-#CFLAGS=-O -DHAVE_XPM -DHAVE_LIBTTF
+CFLAGS+=-DHAVE_XPM -DHAVE_LIBTTF $(INCLUDEDIRS)
#If you don't have FreeType and/or Xpm fully installed, uncomment this
#(default).
@ -19,8 +24,171 @@
#If you do have FreeType and/or Xpm fully installed, uncomment a
#variation of this and comment out the line above. Note that
#Xpm requires X11. See also CFLAGS above.
#LIBS=-lm -lgd -lpng -lz -lttf -lXpm -lX11
+LIBS=-lm -lgd -lpng -lz -lttf -lX11
-#LIBS=-lm -lgd -lpng -lz -lttf -lXpm -lX11
+LIBS=-lm -lgd -lpng -lz -lttf -lXpm -lX11
#Typical install locations for freetype, zlib, xpm and libpng header files.
#If yours are somewhere else, change this.
-INCLUDEDIRS=-I/usr/local/include -I/usr/include/X11 -I/usr/X11R6/include/X11
+INCLUDEDIRS=-I/usr/local/include -I/usr/X11R6/include -I/usr/X11R6/include/X11
#Typical install locations for freetype, zlib, xpm and libpng libraries.
#If yours are somewhere else, other than a standard location
@@ -39,16 +39,16 @@
#-L. as this allows the gd library itself to be found.
#Put -L. first so that old versions of the gd library elsewhere
#on your system can't cause conflicts while building a new one.
-LIBDIRS=-L. -L/usr/local/lib -L/usr/lib/X11 -L/usr/X11R6/lib
+LIBDIRS=-L. -L/usr/local/lib -L/usr/X11R6/lib
#Location where libgd.a should be installed by "make install".
-INSTALL_LIB=/usr/local/lib
+INSTALL_LIB=$(PREFIX)/lib
#Location where .h files should be installed by "make install".
-INSTALL_INCLUDE=/usr/local/include
+INSTALL_INCLUDE=$(PREFIX)/include
#Location where useful non-test programs should be installed by "make install".
-INSTALL_BIN=/usr/local/bin
+INSTALL_BIN=$(PREFIX)/bin
#
#
@@ -58,79 +58,99 @@
VERSION=1.7
-CC=$(COMPILER) $(INCLUDEDIRS)
+#CC=$(COMPILER) $(INCLUDEDIRS)
LINK=$(CC) $(LIBDIRS) $(LIBS)
PROGRAMS=$(BIN_PROGRAMS) $(TEST_PROGRAMS)
BIN_PROGRAMS=pngtogd pngtogd2 gdtopng gd2topng gd2copypal gdparttopng webpng
TEST_PROGRAMS=gdtest gddemo gd2time gdtestttf
+SOLIBGD=libgd.so.17.3
+.if defined(NO_SHARED_LIBS)
all: libgd.a $(PROGRAMS)
+.else
+all: libgd.a $(SOLIBGD) $(PROGRAMS)
+.endif
+.if defined(NO_SHARED_LIBS)
install: libgd.a $(BIN_PROGRAMS)
- $(INSTALL) -m 644 libgd.a $(INSTALL_LIB)/libgd.a
- $(INSTALL) -m 755 pngtogd $(INSTALL_BIN)/pngtogd
- $(INSTALL) -m 755 pngtogd2 $(INSTALL_BIN)/pngtogd2
- $(INSTALL) -m 755 gdtopng $(INSTALL_BIN)/gdtopng
- $(INSTALL) -m 755 gd2topng $(INSTALL_BIN)/gd2topng
- $(INSTALL) -m 755 gd2copypal $(INSTALL_BIN)/gd2copypal
- $(INSTALL) -m 755 gdparttopng $(INSTALL_BIN)/gdparttopng
- $(INSTALL) -m 755 webpng $(INSTALL_BIN)/webpng
- $(INSTALL) -m 755 bdftogd $(INSTALL_BIN)/bdftogd
- $(INSTALL) -m 644 gd.h $(INSTALL_INCLUDE)/gd.h
- $(INSTALL) -m 644 gdcache.h $(INSTALL_INCLUDE)/gdcache.h
- $(INSTALL) -m 644 gd_io.h $(INSTALL_INCLUDE)/gd_io.h
- $(INSTALL) -m 644 gdfontg.h $(INSTALL_INCLUDE)/gdfontg.h
- $(INSTALL) -m 644 gdfontl.h $(INSTALL_INCLUDE)/gdfontl.h
- $(INSTALL) -m 644 gdfontmb.h $(INSTALL_INCLUDE)/gdfontmb.h
- $(INSTALL) -m 644 gdfonts.h $(INSTALL_INCLUDE)/gdfonts.h
- $(INSTALL) -m 644 gdfontt.h $(INSTALL_INCLUDE)/gdfontt.h
+.else
+install: libgd.a $(SOLIBGD) $(BIN_PROGRAMS)
+.endif
+ $(INSTALL) -m 644 libgd.a $(INSTALL_LIB)
+ @if [ -f $(SOLIBGD) ]; then \
+ $(INSTALL) -m 644 $(SOLIBGD) $(INSTALL_LIB);\
+ fi
+ $(INSTALL) -m 755 pngtogd $(INSTALL_BIN)
+ $(INSTALL) -m 755 pngtogd2 $(INSTALL_BIN)
+ $(INSTALL) -m 755 gdtopng $(INSTALL_BIN)
+ $(INSTALL) -m 755 gd2topng $(INSTALL_BIN)
+ $(INSTALL) -m 755 gd2copypal $(INSTALL_BIN)
+ $(INSTALL) -m 755 gdparttopng $(INSTALL_BIN)
+ $(INSTALL) -m 755 webpng $(INSTALL_BIN)
+ $(INSTALL) -m 755 bdftogd $(INSTALL_BIN)
+ $(INSTALL) -m 644 gd.h $(INSTALL_INCLUDE)
+ $(INSTALL) -m 644 gdcache.h $(INSTALL_INCLUDE)
+ $(INSTALL) -m 644 gd_io.h $(INSTALL_INCLUDE)
+ $(INSTALL) -m 644 gdfontg.h $(INSTALL_INCLUDE)
+ $(INSTALL) -m 644 gdfontl.h $(INSTALL_INCLUDE)
+ $(INSTALL) -m 644 gdfontmb.h $(INSTALL_INCLUDE)
+ $(INSTALL) -m 644 gdfonts.h $(INSTALL_INCLUDE)
+ $(INSTALL) -m 644 gdfontt.h $(INSTALL_INCLUDE)
gddemo: gddemo.o libgd.a
- $(CC) gddemo.o -o gddemo $(LIBDIRS) $(LIBS)
+ $(CC) $(CFLAGS) gddemo.o -o gddemo $(LIBDIRS) $(LIBS)
pngtogd: pngtogd.o libgd.a
- $(CC) pngtogd.o -o pngtogd $(LIBDIRS) $(LIBS)
+ $(CC) $(CFLAGS) pngtogd.o -o pngtogd $(LIBDIRS) $(LIBS)
webpng: webpng.o libgd.a
- $(CC) webpng.o -o webpng $(LIBDIRS) $(LIBS)
+ $(CC) $(CFLAGS) webpng.o -o webpng $(LIBDIRS) $(LIBS)
pngtogd2: pngtogd2.o libgd.a
- $(CC) pngtogd2.o -o pngtogd2 $(LIBDIRS) $(LIBS)
+ $(CC) $(CFLAGS) pngtogd2.o -o pngtogd2 $(LIBDIRS) $(LIBS)
gdtopng: gdtopng.o libgd.a
- $(CC) gdtopng.o -o gdtopng $(LIBDIRS) $(LIBS)
+ $(CC) $(CFLAGS) gdtopng.o -o gdtopng $(LIBDIRS) $(LIBS)
gd2topng: gd2topng.o libgd.a
- $(CC) gd2topng.o -o gd2topng $(LIBDIRS) $(LIBS)
+ $(CC) $(CFLAGS) gd2topng.o -o gd2topng $(LIBDIRS) $(LIBS)
gd2copypal: gd2copypal.o libgd.a
- $(CC) gd2copypal.o -o gd2copypal $(LIBDIRS) $(LIBS)
+ $(CC) $(CFLAGS) gd2copypal.o -o gd2copypal $(LIBDIRS) $(LIBS)
gdparttopng: gdparttopng.o libgd.a
- $(CC) gdparttopng.o -o gdparttopng $(LIBDIRS) $(LIBS)
+ $(CC) $(CFLAGS) gdparttopng.o -o gdparttopng $(LIBDIRS) $(LIBS)
gdtest: gdtest.o libgd.a
- $(CC) gdtest.o -o gdtest $(LIBDIRS) $(LIBS)
+ $(CC) $(CFLAGS) gdtest.o -o gdtest $(LIBDIRS) $(LIBS)
gd2time: gd2time.o libgd.a
- $(CC) gd2time.o -o gd2time $(LIBDIRS) $(LIBS)
+ $(CC) $(CFLAGS) gd2time.o -o gd2time $(LIBDIRS) $(LIBS)
gdtestttf: gdtestttf.o libgd.a
- $(CC) gdtestttf.o -o gdtestttf $(LIBDIRS) $(LIBS)
+ $(CC) $(CFLAGS) gdtestttf.o -o gdtestttf $(LIBDIRS) $(LIBS)
libgd.a: gd.o gd_gd.o gd_gd2.o gd_io.o gd_io_dp.o gd_io_file.o gd_ss.o \
gd_io_ss.o gd_png.o gdxpm.o gdfontt.o gdfonts.o gdfontmb.o gdfontl.o \
- gdfontg.o gdtables.o gdttf.o gdcache.o gdkanji.o \
- gd.h gdfontt.h gdfonts.h gdfontmb.h gdfontl.h gdfontg.h
- rm -f libgd.a
- $(AR) rc libgd.a gd.o gd_gd.o gd_gd2.o gd_io.o gd_io_dp.o \
- gd_io_file.o gd_ss.o gd_io_ss.o gd_png.o gdxpm.o \
- gdfontt.o gdfonts.o gdfontmb.o gdfontl.o gdfontg.o \
- gdtables.o gdttf.o gdcache.o gdkanji.o
+ gdfontg.o gdtables.o gdttf.o gdcache.o gdkanji.o
+ rm -f ${.TARGET}
+ $(AR) rc ${.TARGET} ${.ALLSRC}
-ranlib libgd.a
+$(SOLIBGD): gd.so gd_gd.so gd_gd2.so gd_io.so gd_io_dp.so gd_io_file.so \
+ gd_ss.so gd_io_ss.so gd_png.so gdxpm.so gdfontt.so gdfonts.so \
+ gdfontmb.so gdfontl.so gdfontg.so gdtables.so gdttf.so gdcache.so \
+ gdkanji.so
+ rm -f ${.TARGET}
+ ld -Bshareable -Bforcearchive -o ${.TARGET} ${.ALLSRC}
+
clean:
- rm -f *.o *.a ${PROGRAMS}
+ rm -f *.o *.so ${PROGRAMS} libgd.a $(SOLIBGD)
+.SUFFIXES: .c .o .so
+.c.o:
+ ${CC} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
+.c.so:
+ ${CC} ${CFLAGS} -fpic -DPIC -c ${.IMPSRC} -o ${.TARGET}

View File

@ -0,0 +1,12 @@
--- gdcache.h.orig Fri Nov 26 11:10:54 1999
+++ gdcache.h Fri Nov 26 11:11:36 1999
@@ -40,7 +40,9 @@
/* header */
/*********************************************************/
+#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
#include <malloc.h>
+#endif
#ifndef NULL
#define NULL (void *)0
#endif