Commits

Chris Reuter committed 6b94f66

Minor enhancements to the MinGW+Msys build scripts.

Makefile now creates a zipfile containing the DLLs.

Resulting DLL no longer contains a version number in its name. (The
Windows convention is to ship the DLL with the program using it.
Versioning the name just makes it harder for scripts to find the DLL.)

Tweaked the README a bit.

Comments (0)

Files changed (2)

windows/msys/Makefile

 GNUDIR=/c/tools/GnuWin32
 GNUINC=-I$(GNUDIR)/include
 GNULIB=-L$(GNUDIR)/lib
+GNUDLL=$(GNUDIR)/bin/
 
 # Various optional components.  Comment-out the ones you don't have
 # and edit the paths and options as needed if you do.  The default
 JPEG_L=-ljpeg
 JPEG_I=$(GNUINC)
 JPEG_LIBDIR=$(GNULIB)
+JPEG_DLLDIR=$(GNUDLL)
 
 PNG_D=-DHAVE_LIBPNG
 PNG_L=-lpng
 PNG_I=				#$(GNUINC)
 PNG_LIBDIR=			#$(GNULIB)
+PNG_DLLDIR=			#$(GNUDLL)
 
 TIFF_D=-DHAVE_LIBTIFF
 TIFF_L=-ltiff
 TIFF_I=				#$(GNUINC)
 TIFF_LIBDIR=		#$(GNULIB)
+TIFF_DLLDIR=		#$(GNUDLL)
 
 LIBZ_D=-DHAVE_LIBZ
 LIBZ_L=-lz
 LIBZ_I=				#$(GNUINC)
 LIBZ_LIBDIR=		#$(GNULIB)
+LIBZ_DLLDIR=		#$(GNUDLL)
 
 # LIBXPM_D=-DHAVE_LIBXPM
 # LIBXPM_L=-lxpm
 FREETYPE_L=-lfreetype
 FREETYPE_I=$(GNUINC)/freetype2/
 FREETYPE_LIBDIR=	#$(GNULIB)
+FREETYPE_DLLDIR=	#$(GNUDLL)
 
 # FONTCONFIG_D=-DHAVE_LIBFONTCONFIG
 # FONTCONFIG_L=
 ALL_I=$(FREETYPE_I) $(JPEG_I) $(PNG_I) $(TIFF_I) $(LIBZ_I) $(LIBXPM_I)
 ALL_LIBDIR=$(FREETYPE_LIBDIR) $(JPEG_LIBDIR) $(PNG_LIBDIR) $(TIFF_LIBDIR) \
 	$(LIBZ_LIBDIR) $(LIBXPM_LIBDIR)
-
+ALL_DLLDIR=$(FREETYPE_DLLDIR) $(JPEG_DLLDIR) $(PNG_DLLDIR) $(TIFF_DLLDIR) \
+	$(LIBZ_DLLDIR) $(LIBXPM_DLLDIR)
 
 DEFS=$(CDEFS) $(ALL_D)
 INCLUDES=$(ALL_I)
 LDFLAGS=-g -O2 -fvisibility=hidden $(ALL_LIBDIR)
 LIBS=-liconv $(ALL_L)
 
+ZIP=zip -j9
+DIST=libgd-win.zip
+
 # Get this list from c files in libgd_la_SOURCES in Makefile.mk
 SRC=gd.c gd_color.c gd_color_map.c gd_transform.c gdfx.c			\
 gd_security.c gd_gd.c gd_gd2.c gd_io.c gd_io_dp.c gd_gif_in.c		\
 
 OBJ=$(SRC:.c=.o)
 
-TARGETBASE=libgd.$(LIBVER)
+TARGETBASE=libgd
 TARGET=$(TARGETBASE).dll
 TARGET_A=$(TARGETBASE).a
 
 all:
 	(cd ../../src; make -f ../windows/msys/Makefile $(TARGET))
 
+dist: all
+	(cd ../..; $(ZIP) $(DIST) src/*.dll src/*.a $$(for d in $(ALL_DLLDIR); do echo $$d/*.dll; done | sort -u) )
+
 clean:
+	-rm ../../$(DIST)
 	(cd ../../src; rm -f $(TARGET) $(OBJ) $(TARGET_A) deps.mk)
 
 check: all
 	gcc -MM $(DEFS) $(INCLUDES) $(SRC) > deps.mk
 
 $(TARGET): $(OBJ)
-	gcc -shared -o $(TARGET) $(LDFLAGS) -Wl,--out-implib,$(TARGET_A) $(OBJ) $(LIBS)
+	gcc -shared -o $(TARGET) $(LDFLAGS) -Wl,--out-implib,$(TARGET_A) \
+		$(OBJ) $(LIBS)
 
 include deps.mk
 

windows/msys/README.MSYS.md

 
 ## To build LibGD:
 
-1. Install MinGW and MSYS.
+1. Install MinGW and MSYS (see <http://www.mingw.org/wiki/Getting_Started>).
+   You will need to install zip and unzip as well as the 32-bit C compiler
+   and related tools.
 
 2. Install LibJpeg, LibPng, LibTiff, Zlib and FreeType from
    <http://gnuwin32.sourceforge.net> and install them all in
     here.  This is fine.  As long as most tests pass, you're probably
     okay.)
 
-5.  Copy the lib (in src/) to wherever it needs to go.  There's no
-    `make install` here.
+5.  Type
+
+       make dist
+
+    This will create libgd-win.zip, a zip file containing the new
+    library and its dependants.  Note that this step may pick up extra
+    DLLs; it sweeps up all of the DLLs in the directories pointed to
+    by *_DLLDIR Makefile variables.
+
+    Alternately, you can copy the lib (in src/) to wherever it needs
+    to go.
 
 
 ## Stuff that Doesn't Work