summaryrefslogtreecommitdiff
path: root/windows
diff options
context:
space:
mode:
Diffstat (limited to 'windows')
-rw-r--r--windows/msys/Makefile115
-rw-r--r--windows/msys/README.MSYS.md54
-rwxr-xr-xwindows/msys/deps.mk1
-rwxr-xr-xwindows/msys/run_tests.sh66
4 files changed, 236 insertions, 0 deletions
diff --git a/windows/msys/Makefile b/windows/msys/Makefile
new file mode 100644
index 0000000..2a4440d
--- /dev/null
+++ b/windows/msys/Makefile
@@ -0,0 +1,115 @@
+
+# Simple makefile for building and testing libgd under MSYS/MinGW on
+# Windows
+
+
+# The version
+LIBVER=3.0.1
+
+# Misc. config flags.
+CDEFS=-DHAVE_ERRNO_H -DHAVE_ICONV -DHAVE_ICONV_H \
+-DHAVE_ICONV_T_DEF -DHAVE_INTTYPES_H -DHAVE_LIMITS_H -DHAVE_STDDEF_H \
+-DHAVE_STDINT_H -DHAVE_STDLIB_H -DHAVE_VISIBILITY -DICONV_CONST
+
+# GnuWin32 libs are all installed in one place
+GNUINC=-I/c/Progra~1/GnuWin32/include
+GNULIB=-L/c/Progra~1/GnuWin32/lib
+
+# Various optional components. Comment-out the ones you don't have
+# and edit the paths and options as needed if you do. The default
+# assumes GnuWin32 packages installed in /c/Program Files/GnuWin32.
+JPEG_D=-DHAVE_LIBJPEG
+JPEG_L=-ljpeg
+JPEG_I=$(GNUINC)
+JPEG_LIBDIR=$(GNULIB)
+
+PNG_D=-DHAVE_LIBPNG
+PNG_L=-lpng
+PNG_I= #$(GNUINC)
+PNG_LIBDIR= #$(GNULIB)
+
+TIFF_D=-DHAVE_LIBTIFF
+TIFF_L=-ltiff
+TIFF_I= #$(GNUINC)
+TIFF_LIBDIR= #$(GNULIB)
+
+LIBZ_D=-DHAVE_LIBZ
+LIBZ_L=-lz
+LIBZ_I= #$(GNUINC)
+LIBZ_LIBDIR= #$(GNULIB)
+
+# LIBXPM_D=-DHAVE_LIBXPM
+# LIBXPM_L=-lxpm
+# LIBXPM_I= #$(GNUINC)
+# LIBXPM_LIBDIR= #$(GNULIB)
+
+FREETYPE_D=-DHAVE_LIBFREETYPE -DHAVE_FT2BUILD_H
+FREETYPE_L=-lfreetype
+FREETYPE_I=$(GNUINC)/freetype2/
+FREETYPE_LIBDIR= #$(GNULIB)
+
+# FONTCONFIG_D=-DHAVE_LIBFONTCONFIG
+# FONTCONFIG_L=
+# FONTCONFIG_I=
+# FONTCONFIG_LIBDIR=
+
+ALL_D=$(FREETYPE_D) $(JPEG_D) $(PNG_D) $(TIFF_D) $(LIBZ_D) $(LIBXPM_D)
+ALL_L=$(FREETYPE_L) $(JPEG_L) $(PNG_L) $(TIFF_L) $(LIBZ_L) $(LIBXPM_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)
+
+
+DEFS=$(CDEFS) $(ALL_D)
+INCLUDES=$(ALL_I)
+
+CC=gcc
+CFLAGS=-g -O2 -I. -std=gnu99 -fvisibility=hidden -D_WIN32 -DBGDWIN32 $(DEFS) $(INCLUDES)
+
+LD=gcc
+LDFLAGS=-g -O2 -fvisibility=hidden $(ALL_LIBDIR)
+LIBS=-liconv $(ALL_L)
+
+# 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 \
+gd_gif_out.c gd_io_file.c gd_io_ss.c gd_jpeg.c gd_png.c gd_ss.c \
+gd_topal.c gd_wbmp.c gdcache.c gdfontg.c gdfontl.c gdfontmb.c \
+gdfonts.c gdfontt.c gdft.c gdhelpers.c gdkanji.c gdtables.c gdxpm.c \
+wbmp.c gd_filter.c gd_nnquant.c gd_rotate.c gd_matrix.c \
+gd_interpolation.c gd_crop.c webpimg.c gd_webp.c gd_tiff.c gd_tga.c \
+gd_bmp.c gd_xbm.c gd_color_match.c gd_version.c
+
+OBJ=$(SRC:.c=.o)
+
+TARGETBASE=libgd.$(LIBVER)
+TARGET=$(TARGETBASE).dll
+TARGET_A=$(TARGETBASE).a
+
+all:
+ (cd ../../src; make -f ../windows/msys/Makefile $(TARGET))
+
+clean:
+ (cd ../../src; rm -f $(TARGET) $(OBJ) $(TARGET_A) deps.mk)
+
+check: all
+ bash run_tests.sh "$(INCLUDES)"
+
+deps.mk:
+ [ -f gd.h ] # Sanity check: we're in src/, right?
+ gcc -MM $(DEFS) $(INCLUDES) $(SRC) > deps.mk
+
+$(TARGET): $(OBJ)
+ gcc -shared -o $(TARGET) $(LDFLAGS) -Wl,--out-implib,$(TARGET_A) $(OBJ) $(LIBS)
+
+include deps.mk
+
+
+
+
+
+
+
+
+
+
diff --git a/windows/msys/README.MSYS.md b/windows/msys/README.MSYS.md
new file mode 100644
index 0000000..8abdf08
--- /dev/null
+++ b/windows/msys/README.MSYS.md
@@ -0,0 +1,54 @@
+
+# MSYS Fallback Makefile
+
+This is a simple, straightforward Makefile for building LibGD with
+MinGW on MSYS (or possibly Cygwin). It is here for anyone who doesn't
+want to deal with autotools or CMake on Windows or who can't get
+either of them working on their particular setup.
+
+Note that this Makefile only builds the library and test cases; the
+standalone utilities are ignored. If you need those, you'll need to
+use one of the other build systems (or add them yourself.)
+
+## To build LibGD:
+
+1. Install MinGW and MSYS.
+
+2. Install LibJpeg, LibPng, LibTiff, Zlib and FreeType from
+ <http://gnuwin32.sourceforge.net> and install them all in
+ <c:/Program Files/GnuWin32>. (You can get these libraries from other
+ places and/or install them in different locations, but you'll need to
+ edit the Makefile accordingly if you do.)
+
+3. Skip ahead to the next step. If that doesn't work, edit the
+ Makefile to fix what went wrong. Things to try include:
+ * Ensure SRC contains an up-to-date list of source files. (Take a
+ look at libgd_la_SOURCES src/Makefile.am for a reference.)
+ * Ensure that the paths and #defines for unsupported libraries
+ are commented out. They're nicely grouped into clusters to
+ simplify that.
+
+4. `cd` to this directory and type:
+
+ make
+ make check
+
+ If both commands succeed, you're done. (Note that some of the
+ testcases will fail, just because they test features not enabled
+ 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.
+
+
+## Stuff that Doesn't Work
+
+* LibXpm: It's probably nothing serious, just more trouble than it's
+ worth.
+* LibFontconfig: I couldn't find Windows binaries for it anywhere
+ reputable.
+
+
+
+
diff --git a/windows/msys/deps.mk b/windows/msys/deps.mk
new file mode 100755
index 0000000..9b531b3
--- /dev/null
+++ b/windows/msys/deps.mk
@@ -0,0 +1 @@
+# Nothing to see here. (But it shuts up make.)
diff --git a/windows/msys/run_tests.sh b/windows/msys/run_tests.sh
new file mode 100755
index 0000000..be2b214
--- /dev/null
+++ b/windows/msys/run_tests.sh
@@ -0,0 +1,66 @@
+#!/bin/bash
+
+set -e
+
+# Parameters
+CFLAGS_EXTRA=$1 # Extra C flags
+
+
+LOG=run_tests.log
+
+CFLAGS="-g -Igdtest/ -I. -I../src/ -D_WIN32 $CFLAGS_EXTRA"
+LDFLAGS='-L../src -llibgd.3.0.1'
+DLLPATH=../src:/c/Progra~1/GnuWin32/bin
+
+function run_gcc {
+ if msg=`gcc $* 2>&1`; then
+ true
+ else
+ echo "COMMAND: gcc $*" >> $LOG
+ echo $msg >> $LOG
+ false
+ fi
+}
+
+# Switch to the working directory
+PATH=$PATH:$DLLPATH
+cd ../../tests
+
+# Initial setup
+echo "Setting up..."
+[ -f $LOG ] && rm -f $LOG
+[ -f test_config.h ] || echo '#define GDTEST_TOP_DIR "."' > test_config.h
+run_gcc -c $CFLAGS gdtest/gdtest.c
+
+
+echo "Running tests:"
+count=0
+failures=0
+compile_failures=0
+for test in `find . -name \*.c | grep -v '^./gdtest'`; do
+ count=`expr $count + 1`
+
+ exe=${test%.c}.exe
+ if run_gcc -o $exe $CFLAGS $LDFLAGS $test gdtest.o; then
+ true;
+ else
+ echo "COMPILE_FAIL: $test"
+ compile_failures=`expr $compile_failures + 1`
+ continue
+ fi
+
+ echo "Running $exe:" >> $LOG
+ if $exe 2>&1 >> $LOG; then
+ echo "PASS: $test"
+ else
+ failures=`expr $failures + 1`
+ echo "FAIL: $test"
+ fi
+ echo >> $LOG
+done
+
+echo "$failures failures and $compile_failures compile failures out of $count tests."
+echo "Error messages in $LOG"
+
+
+