summaryrefslogtreecommitdiffstats
path: root/freebsd/dependencies/imlib
diff options
context:
space:
mode:
Diffstat (limited to 'freebsd/dependencies/imlib')
-rw-r--r--freebsd/dependencies/imlib/Makefile48
-rw-r--r--freebsd/dependencies/imlib/distinfo3
-rw-r--r--freebsd/dependencies/imlib/files/patch-445914.diff46
-rw-r--r--freebsd/dependencies/imlib/files/patch-448360.diff95
-rw-r--r--freebsd/dependencies/imlib/files/patch-PrintGifError.diff24
-rw-r--r--freebsd/dependencies/imlib/files/patch-bpp16-CVE-2007-3568.diff16
-rw-r--r--freebsd/dependencies/imlib/files/patch-disable-gtk-configure-check.diff19
-rw-r--r--freebsd/dependencies/imlib/files/patch-fix-potential-buffer-overflow.diff19
-rw-r--r--freebsd/dependencies/imlib/files/patch-gdk-makefile.diff30
-rw-r--r--freebsd/dependencies/imlib/files/patch-giflib-ungif.diff24
-rw-r--r--freebsd/dependencies/imlib/files/patch-giflib5.1.diff50
-rw-r--r--freebsd/dependencies/imlib/files/patch-giflib5.diff30
-rw-r--r--freebsd/dependencies/imlib/files/patch-gmodule.diff734
-rw-r--r--freebsd/dependencies/imlib/files/patch-imlib-config.diff28
-rw-r--r--freebsd/dependencies/imlib/files/patch-imlib-m4.diff32
-rw-r--r--freebsd/dependencies/imlib/files/patch-link-against-x11.diff16
-rw-r--r--freebsd/dependencies/imlib/files/patch-png1.5.diff80
-rw-r--r--freebsd/dependencies/imlib/files/patch-png1.6.diff36
-rw-r--r--freebsd/dependencies/imlib/files/patch-search-system-include-for-xshm.diff14
-rw-r--r--freebsd/dependencies/imlib/pkg-descr4
-rw-r--r--freebsd/dependencies/imlib/pkg-plist16
21 files changed, 1364 insertions, 0 deletions
diff --git a/freebsd/dependencies/imlib/Makefile b/freebsd/dependencies/imlib/Makefile
new file mode 100644
index 000000000..055b37d14
--- /dev/null
+++ b/freebsd/dependencies/imlib/Makefile
@@ -0,0 +1,48 @@
+# -*-mode: makefile-*-
+# Created by: slavek.banko@axis.cz
+# $FreeBSD$
+#
+# TDE port map: dependencies/imlib
+
+PORTSDIR?=/usr/ports
+.include <${PORTSDIR}/Mk/bsd.trinity.mk>
+
+PORTNAME= imlib
+COMMENT= A graphic library for enlightenment package
+MASTER_SITE_SUBDIR= i/${PORTNAME}
+PORTVERSION= 1.9.15
+PORTREVISION= 17
+CATEGORIES= graphics
+MASTER_SITES= ${MASTER_SITE_TDE_DEPS}
+DISTNAME= ${PORTNAME}_${PORTVERSION}
+DISTSRC= ${PORTNAME}-${PORTVERSION}
+DIST_SUBDIR= TDE/dependencies
+PREFIX= ${LOCALBASE}
+
+
+LIB_DEPENDS+= \
+ libpng.so:graphics/png \
+ libtiff.so:graphics/tiff \
+ libgif.so:graphics/giflib
+
+# Use gmake for automake build
+USES= gmake
+USES+= autoreconf libtool
+USE_XORG= sm xext x11
+GNU_CONFIGURE= yes
+USE_LDCONFIG= yes
+CONFIGURE_ARGS= --sysconfdir=${PREFIX}/etc/imlib --disable-modules
+CONFIGURE_ENV= LIBS="-L${LOCALBASE}/lib"
+CPPFLAGS+= -I${LOCALBASE}/include -I${LOCALBASE}/include/libpng15
+
+MAN1= imlib-config.1 imlib_config.1
+
+pre-configure:
+ @${REINPLACE_CMD} -e "s|glib-config|${GLIB_CONFIG}|" ${WRKSRC}/configure
+ @${REINPLACE_CMD} -e "s|@SUPPORT_LIBS@|-L${LOCALBASE}/lib @SUPPORT_LIBS@|" ${WRKSRC}/imlib-config.in
+
+post-configure:
+ @${FIND} ${WRKSRC} -name "Makefile" -type f | ${XARGS} ${REINPLACE_CMD} -e \
+ 's|[(]libdir[)]/pkgconfig|(prefix)/libdata/pkgconfig|g'
+
+.include <bsd.port.mk>
diff --git a/freebsd/dependencies/imlib/distinfo b/freebsd/dependencies/imlib/distinfo
new file mode 100644
index 000000000..1568357fa
--- /dev/null
+++ b/freebsd/dependencies/imlib/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1495991805
+SHA256 (TDE/dependencies/imlib_1.9.15.orig.tar.xz) = 8e5df78cfbb6b5c16466cd2fe411bda30064ada2c69704f989b81f1ceb00e47a
+SIZE (TDE/dependencies/imlib_1.9.15.orig.tar.xz) = 605220
diff --git a/freebsd/dependencies/imlib/files/patch-445914.diff b/freebsd/dependencies/imlib/files/patch-445914.diff
new file mode 100644
index 000000000..31608378d
--- /dev/null
+++ b/freebsd/dependencies/imlib/files/patch-445914.diff
@@ -0,0 +1,46 @@
+
+Fixes #445914.
+
+ -- Chris Lamb <chris@chris-lamb.co.uk> Sun, 18 May 2008 02:11:57 +0100
+
+--- imlib-1.9.15.orig/gdk_imlib/misc.c
++++ imlib-1.9.15/gdk_imlib/misc.c
+@@ -455,6 +455,8 @@
+ if (xvir[i].depth > max)
+ max = xvir[i].depth;
+ }
++ if (max > 24)
++ max = 24;
+ if (max > 8)
+ {
+ id->x.depth = max;
+@@ -1004,6 +1006,8 @@
+ if (xvir[i].depth > max)
+ max = xvir[i].depth;
+ }
++ if (max > 24)
++ max = 24;
+ if (max > 8)
+ {
+ id->x.depth = max;
+--- imlib-1.9.15.orig/Imlib/misc.c
++++ imlib-1.9.15/Imlib/misc.c
+@@ -423,6 +423,8 @@
+ if (xvir[i].depth > max)
+ max = xvir[i].depth;
+ }
++ if (max > 24)
++ max = 24;
+ if (max > 8)
+ {
+ id->x.depth = max;
+@@ -1026,6 +1028,8 @@
+ if (xvir[i].depth > max)
+ max = xvir[i].depth;
+ }
++ if (max > 24)
++ max = 24;
+ if (max > 8)
+ {
+ id->x.depth = max;
+
diff --git a/freebsd/dependencies/imlib/files/patch-448360.diff b/freebsd/dependencies/imlib/files/patch-448360.diff
new file mode 100644
index 000000000..4873aa689
--- /dev/null
+++ b/freebsd/dependencies/imlib/files/patch-448360.diff
@@ -0,0 +1,95 @@
+
+Fixes #448360.
+
+ -- Chris Lamb <chris@chris-lamb.co.uk> Sun, 18 May 2008 02:11:57 +0100
+
+--- imlib-1.9.15.orig/gdk_imlib/misc.c 2008-05-18 01:47:54.000000000 +0100
++++ imlib-1.9.15/gdk_imlib/misc.c 2008-05-18 02:14:13.000000000 +0100
+@@ -676,6 +674,10 @@
+ visual = gdk_rgb_get_visual();
+ id->x.visual = GDK_VISUAL_XVISUAL(visual); /* the visual type */
+ id->x.depth = visual->depth; /* the depth of the screen in bpp */
++
++ id->x.shm = 0;
++ id->x.shmp = 0;
++ id->max_shm = 0;
+ #ifdef HAVE_SHM
+ if (XShmQueryExtension(id->x.disp))
+ {
+@@ -691,17 +693,14 @@
+ id->x.last_xim = NULL;
+ id->x.last_sxim = NULL;
+ id->max_shm = 0x7fffffff;
+- if (XShmPixmapFormat(id->x.disp) == ZPixmap)
++ if ((XShmPixmapFormat(id->x.disp) == ZPixmap) &&
++ (pm == True))
+ id->x.shmp = 1;
+ }
+ }
+ }
+- else
+ #endif
+- {
+- id->x.shm = 0;
+- id->x.shmp = 0;
+- }
++
+ id->cache.on_image = 0;
+ id->cache.size_image = 0;
+ id->cache.num_image = 0;
+@@ -937,8 +936,8 @@
+ }
+ if (p->flags & PARAMS_SHAREDPIXMAPS)
+ {
+- if (id->x.shm)
+- id->x.shmp = p->sharedpixmaps;
++ if (!p->sharedpixmaps)
++ id->x.shmp = 0;
+ }
+ if (p->flags & PARAMS_PALETTEOVERRIDE)
+ override = p->paletteoverride;
+--- imlib-1.9.15.orig/Imlib/misc.c 2008-05-18 01:47:54.000000000 +0100
++++ imlib-1.9.15/Imlib/misc.c 2008-05-18 02:14:13.000000000 +0100
+@@ -677,6 +675,10 @@
+ id->x.root = DefaultRootWindow(disp); /* the root window id */
+ id->x.visual = DefaultVisual(disp, id->x.screen); /* the visual type */
+ id->x.depth = DefaultDepth(disp, id->x.screen); /* the depth of the screen in bpp */
++
++ id->x.shm = 0;
++ id->x.shmp = 0;
++ id->max_shm = 0;
+ #ifdef HAVE_SHM
+ if (XShmQueryExtension(id->x.disp))
+ {
+@@ -692,17 +694,14 @@
+ id->x.last_xim = NULL;
+ id->x.last_sxim = NULL;
+ id->max_shm = 0x7fffffff;
+- if (XShmPixmapFormat(id->x.disp) == ZPixmap)
++ if ((XShmPixmapFormat(id->x.disp) == ZPixmap &&
++ (pm == True)))
+ id->x.shmp = 1;
+ }
+ }
+ }
+- else
+ #endif
+- {
+- id->x.shm = 0;
+- id->x.shmp = 0;
+- }
++
+ id->cache.on_image = 0;
+ id->cache.size_image = 0;
+ id->cache.num_image = 0;
+@@ -954,8 +953,8 @@
+ }
+ if (p->flags & PARAMS_SHAREDPIXMAPS)
+ {
+- if (id->x.shm)
+- id->x.shmp = p->sharedpixmaps;
++ if (!p->sharedpixmaps)
++ id->x.shmp = 0;
+ }
+ if (p->flags & PARAMS_PALETTEOVERRIDE)
+ override = p->paletteoverride;
diff --git a/freebsd/dependencies/imlib/files/patch-PrintGifError.diff b/freebsd/dependencies/imlib/files/patch-PrintGifError.diff
new file mode 100644
index 000000000..6437515d6
--- /dev/null
+++ b/freebsd/dependencies/imlib/files/patch-PrintGifError.diff
@@ -0,0 +1,24 @@
+--- a/Imlib/load.c 2012-06-16 20:19:27.000000000 +0200
++++ b/Imlib/load.c 2012-06-16 20:19:56.000000000 +0200
+@@ -420,6 +420,21 @@
+ #endif /* HAVE_LIBTIFF */
+
+ #ifdef HAVE_LIBGIF
++
++#if defined(GIFLIB_MAJOR) && defined(GIFLIB_MINOR) && ((GIFLIB_MAJOR == 4 && GIFLIB_MINOR >= 2) || GIFLIB_MAJOR > 4)
++static void PrintGifError(void) {
++#if GIFLIB_MAJOR >= 5
++ fprintf(stderr, "GIF-LIB error (exact reporting not implemented)\n");
++#else
++ const char * errorString = GifErrorString();
++ if (errorString)
++ fprintf(stderr, "GIF-LIB error: %s\n", errorString);
++ else
++ fprintf(stderr, "GIF-LIB undefined error: %d\n", GifError());
++#endif
++}
++#endif
++
+ unsigned char *
+ _LoadGIF(ImlibData * id, FILE *f, int *w, int *h, int *t)
+ {
diff --git a/freebsd/dependencies/imlib/files/patch-bpp16-CVE-2007-3568.diff b/freebsd/dependencies/imlib/files/patch-bpp16-CVE-2007-3568.diff
new file mode 100644
index 000000000..83e28cec6
--- /dev/null
+++ b/freebsd/dependencies/imlib/files/patch-bpp16-CVE-2007-3568.diff
@@ -0,0 +1,16 @@
+
+Fixes #437708.
+
+ -- Chris Lamb <chris@chris-lamb.co.uk> Sun, 18 May 2008 02:11:57 +0100
+
+--- imlib/Imlib/load.c.orig 2007-08-13 23:06:20.000000000 -0300
++++ imlib/Imlib/load.c 2007-08-13 23:06:51.000000000 -0300
+@@ -645,7 +645,7 @@
+ planes = (int)word;
+ fread(&word, 2, 1, file);
+ bpp = (int)word;
+- if (bpp != 1 && bpp != 4 && bpp != 8 && bpp && 16 && bpp != 24 && bpp != 32)
++ if (bpp != 1 && bpp != 4 && bpp != 8 && bpp != 16 && bpp != 24 && bpp != 32)
+ {
+ fprintf(stderr, "IMLIB ERROR: unknown bitdepth in file\n");
+ return NULL;
diff --git a/freebsd/dependencies/imlib/files/patch-disable-gtk-configure-check.diff b/freebsd/dependencies/imlib/files/patch-disable-gtk-configure-check.diff
new file mode 100644
index 000000000..fdb5e3957
--- /dev/null
+++ b/freebsd/dependencies/imlib/files/patch-disable-gtk-configure-check.diff
@@ -0,0 +1,19 @@
+Index: b/configure.in
+===================================================================
+--- a/configure.in
++++ b/configure.in
+@@ -17,10 +17,10 @@
+ dnl incase it is broken for example.
+ AC_ARG_ENABLE(shm, [ --enable-shm support shared memory if available [default=yes]], echo $enable_shm, enable_shm="yes")
+
+-AM_PATH_GTK(1.2.1,[
+- GDK_IMLIB="gdk_imlib utils"],[
+- GDK_IMLIB=""
+- AC_MSG_WARN([*** gdk_imlib will not be built ***])])
++dnl AM_PATH_GTK(1.2.1,[
++dnl GDK_IMLIB="gdk_imlib utils"],[
++dnl GDK_IMLIB=""
++dnl AC_MSG_WARN([*** gdk_imlib will not be built ***])])
+
+ AC_MSG_CHECKING(whether to build gmodulized imlib)
+
diff --git a/freebsd/dependencies/imlib/files/patch-fix-potential-buffer-overflow.diff b/freebsd/dependencies/imlib/files/patch-fix-potential-buffer-overflow.diff
new file mode 100644
index 000000000..406aead10
--- /dev/null
+++ b/freebsd/dependencies/imlib/files/patch-fix-potential-buffer-overflow.diff
@@ -0,0 +1,19 @@
+Index: b/Imlib/load.c
+===================================================================
+--- a/Imlib/load.c
++++ b/Imlib/load.c
+@@ -1974,11 +1974,11 @@
+ if (iden[0])
+ {
+ #ifndef __EMX__
+- strncat(fil, ":", sizeof(fil) - strlen(fil));
++ strncat(fil, ":", sizeof(fil) - strlen(fil) - 1);
+ #else
+- strncat(fil, ";", sizeof(fil) - strlen(fil));
++ strncat(fil, ";", sizeof(fil) - strlen(fil) - 1);
+ #endif
+- strncat(fil, iden, sizeof(fil) - strlen(fil));
++ strncat(fil, iden, sizeof(fil) - strlen(fil) - 1);
+ }
+ }
+ im->mod.gamma = id->mod.gamma;
diff --git a/freebsd/dependencies/imlib/files/patch-gdk-makefile.diff b/freebsd/dependencies/imlib/files/patch-gdk-makefile.diff
new file mode 100644
index 000000000..11bf6271f
--- /dev/null
+++ b/freebsd/dependencies/imlib/files/patch-gdk-makefile.diff
@@ -0,0 +1,30 @@
+--- imlib-1.9.15.orig/gdk_imlib/Makefile.am
++++ imlib-1.9.15/gdk_imlib/Makefile.am
+@@ -15,7 +15,7 @@
+ libimlib_jpeg_la_LIBADD = $(JPEGLIBS) libgdk_imlib.la
+
+ libimlib_png_la_SOURCES = io-png.c
+-libimlib_png_la_LDFLAGS = $(common_ldflags)
++libimlib_png_la_LDFLAGS = $(common_ldflags) -lglib
+ libimlib_png_la_LIBADD = $(PNGLIBS) libgdk_imlib.la
+
+ libimlib_tiff_la_SOURCES = io-tiff.c
+@@ -31,7 +31,7 @@
+ libimlib_bmp_la_LIBADD = libgdk_imlib.la
+
+ libimlib_xpm_la_SOURCES = io-xpm.c
+-libimlib_xpm_la_LDFLAGS = $(common_ldflags)
++libimlib_xpm_la_LDFLAGS = $(common_ldflags) -lX11
+ libimlib_xpm_la_LIBADD = libgdk_imlib.la
+
+ libimlib_ppm_la_SOURCES = io-ppm.c
+@@ -86,7 +86,7 @@
+ modules.c
+
+
+-libgdk_imlib_la_LDFLAGS = -version-info 10:15:9
++libgdk_imlib_la_LDFLAGS = -version-info 10:15:8
+ libgdk_imlib_la_LIBADD = $(GX_LIBS)
+
+
+
diff --git a/freebsd/dependencies/imlib/files/patch-giflib-ungif.diff b/freebsd/dependencies/imlib/files/patch-giflib-ungif.diff
new file mode 100644
index 000000000..e0b49557f
--- /dev/null
+++ b/freebsd/dependencies/imlib/files/patch-giflib-ungif.diff
@@ -0,0 +1,24 @@
+Index: b/configure.in
+===================================================================
+--- a/configure.in
++++ b/configure.in
+@@ -250,12 +250,13 @@
+
+
+ AC_CHECK_HEADER(gif_lib.h,
+- [AC_CHECK_LIB(ungif, DGifOpenFileName,
+- [GIFLIBS="-lungif"
+- SUPPORT_LIBS="$SUPPORT_LIBS -lungif"; AC_DEFINE(HAVE_LIBGIF, 1, [ ])],
+- [AC_CHECK_LIB(gif, DGifOpenFileName,
+- [GIFLIBS="-lgif"
+- SUPPORT_LIBS="$SUPPORT_LIBS -lgif"
++ [AC_CHECK_LIB(gif, DGifOpenFileName,
++ [GIFLIBS="-lgif"
++ SUPPORT_LIBS="$SUPPORT_LIBS -lgif"
++ AC_DEFINE(HAVE_LIBGIF, 1, [ ])],
++ [AC_CHECK_LIB(ungif, DGifOpenFileName,
++ [GIFLIBS="-lungif"
++ SUPPORT_LIBS="$SUPPORT_LIBS -lungif"
+ AC_DEFINE(HAVE_LIBGIF, 1, [ ])],
+ [AC_MSG_ERROR(*** GIF library file not found ***)],
+ $GX_LIBS)],
diff --git a/freebsd/dependencies/imlib/files/patch-giflib5.1.diff b/freebsd/dependencies/imlib/files/patch-giflib5.1.diff
new file mode 100644
index 000000000..fddd984fc
--- /dev/null
+++ b/freebsd/dependencies/imlib/files/patch-giflib5.1.diff
@@ -0,0 +1,50 @@
+Index: imlib-1.9.15/Imlib/load.c
+===================================================================
+--- imlib-1.9.15.orig/Imlib/load.c
++++ imlib-1.9.15/Imlib/load.c
+@@ -489,13 +489,21 @@ _LoadGIF(ImlibData * id, FILE *f, int *w
+ rows = malloc(*h * sizeof(GifRowType *));
+ if (!rows)
+ {
++#if GIFLIB_MAJOR > 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1)
++ DGifCloseFile(gif, NULL);
++#else
+ DGifCloseFile(gif);
++#endif
+ return NULL;
+ }
+ data = _imlib_malloc_image(*w, *h);
+ if (!data)
+ {
++#if GIFLIB_MAJOR > 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1)
++ DGifCloseFile(gif, NULL);
++#else
+ DGifCloseFile(gif);
++#endif
+ free(rows);
+ return NULL;
+ }
+@@ -506,7 +514,11 @@ _LoadGIF(ImlibData * id, FILE *f, int *w
+ rows[i] = malloc(*w * sizeof(GifPixelType));
+ if (!rows[i])
+ {
++#if GIFLIB_MAJOR > 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1)
++ DGifCloseFile(gif, NULL);
++#else
+ DGifCloseFile(gif);
++#endif
+ for (i = 0; i < *h; i++)
+ if (rows[i])
+ free(rows[i]);
+@@ -595,7 +607,11 @@ _LoadGIF(ImlibData * id, FILE *f, int *w
+ }
+ }
+ }
++#if GIFLIB_MAJOR > 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1)
++ DGifCloseFile(gif, NULL);
++#else
+ DGifCloseFile(gif);
++#endif
+ for (i = 0; i < *h; i++)
+ free(rows[i]);
+ free(rows);
diff --git a/freebsd/dependencies/imlib/files/patch-giflib5.diff b/freebsd/dependencies/imlib/files/patch-giflib5.diff
new file mode 100644
index 000000000..2249a5202
--- /dev/null
+++ b/freebsd/dependencies/imlib/files/patch-giflib5.diff
@@ -0,0 +1,30 @@
+diff -ru a/Imlib/load.c b/Imlib/load.c
+--- a/Imlib/load.c 2015-06-21 03:21:07.000000000 +0200
++++ b/Imlib/load.c 2015-06-21 03:16:28.000000000 +0200
+@@ -443,7 +443,11 @@
+ fd = fileno(f);
+ /* Apparently rewind(f) isn't sufficient */
+ lseek(fd, (long) 0, 0);
++#if GIFLIB_MAJOR >= 5
++ gif = DGifOpenFileHandle(fd, NULL);
++#else
+ gif = DGifOpenFileHandle(fd);
++#endif
+
+ if (!gif)
+ return NULL;
+diff -ru a/gdk_imlib/io-gif.c b/gdk_imlib/io-gif.c
+--- a/gdk_imlib/io-gif.c 2002-03-04 18:06:29.000000000 +0100
++++ b/gdk_imlib/io-gif.c 2015-06-21 03:15:40.000000000 +0200
+@@ -30,7 +30,11 @@
+ fd = fileno(f);
+ /* Apparently rewind(f) isn't sufficient */
+ lseek(fd, (long) 0, 0);
++#if GIFLIB_MAJOR >= 5
++ gif = DGifOpenFileHandle(fd, NULL);
++#else
+ gif = DGifOpenFileHandle(fd);
++#endif
+
+ transp = -1;
+ data = NULL;
diff --git a/freebsd/dependencies/imlib/files/patch-gmodule.diff b/freebsd/dependencies/imlib/files/patch-gmodule.diff
new file mode 100644
index 000000000..6aed03bc7
--- /dev/null
+++ b/freebsd/dependencies/imlib/files/patch-gmodule.diff
@@ -0,0 +1,734 @@
+--- imlib-1.9.15.orig/gdk_imlib/local-hack-gmodule/gmodule-dl.c
++++ imlib-1.9.15/gdk_imlib/local-hack-gmodule/gmodule-dl.c
+@@ -0,0 +1,158 @@
++/* GMODULE - GLIB wrapper code for dynamic module loading
++ * Copyright (C) 1998, 2000 Tim Janik
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public
++ * License along with this library; if not, write to the
++ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
++ * Boston, MA 02111-1307, USA.
++ */
++
++/*
++ * Modified by the GLib Team and others 1997-1999. See the AUTHORS
++ * file for a list of people on the GLib Team. See the ChangeLog
++ * files for a list of changes. These files are distributed with
++ * GLib at ftp://ftp.gtk.org/pub/gtk/.
++ */
++
++/*
++ * MT safe
++ */
++
++#include <dlfcn.h>
++
++/* Perl includes <nlist.h> and <link.h> instead of <dlfcn.h> on some systmes? */
++
++
++/* dlerror() is not implemented on all systems
++ */
++#ifndef LOCAL_HACK_G_MODULE_HAVE_DLERROR
++# ifdef __NetBSD__
++# define dlerror() g_strerror (errno)
++# else /* !__NetBSD__ */
++/* could we rely on errno's state here? */
++# define dlerror() "unknown dl-error"
++# endif /* !__NetBSD__ */
++#endif /* LOCAL_HACK_G_MODULE_HAVE_DLERROR */
++
++/* some flags are missing on some systems, so we provide
++ * harmless defaults.
++ * The Perl sources say, RTLD_LAZY needs to be defined as (1),
++ * at least for Solaris 1.
++ *
++ * Mandatory:
++ * RTLD_LAZY - resolve undefined symbols as code from the dynamic library
++ * is executed.
++ * RTLD_NOW - resolve all undefined symbols before dlopen returns, and fail
++ * if this cannot be done.
++ * Optionally:
++ * RTLD_GLOBAL - the external symbols defined in the library will be made
++ * available to subsequently loaded libraries.
++ */
++#ifndef RTLD_LAZY
++#define RTLD_LAZY 1
++#endif /* RTLD_LAZY */
++#ifndef RTLD_NOW
++#define RTLD_NOW 0
++#endif /* RTLD_NOW */
++/* some systems (OSF1 V5.0) have broken RTLD_GLOBAL linkage */
++#ifdef LOCAL_HACK_G_MODULE_BROKEN_RTLD_GLOBAL
++#undef RTLD_GLOBAL
++#endif /* LOCAL_HACK_G_MODULE_BROKEN_RTLD_GLOBAL */
++#ifndef RTLD_GLOBAL
++#define RTLD_GLOBAL 0
++#endif /* RTLD_GLOBAL */
++
++
++/* --- functions --- */
++static gchar*
++fetch_dlerror (void)
++{
++ gchar *msg = dlerror ();
++
++ /* make sure we always return an error message != NULL */
++
++ return msg ? msg : "unknown dl-error";
++}
++
++static gpointer
++_local_hack_g_module_open (const gchar *file_name,
++ gboolean bind_lazy)
++{
++ gpointer handle;
++
++ handle = dlopen (file_name, (bind_lazy ? RTLD_LAZY : RTLD_NOW));
++ if (!handle)
++ local_hack_g_module_set_error (fetch_dlerror ());
++
++ return handle;
++}
++
++static gpointer
++_local_hack_g_module_self (void)
++{
++ gpointer handle;
++
++ /* to query symbols from the program itself, special link options
++ * are required on some systems.
++ */
++
++ handle = dlopen (NULL, RTLD_LAZY);
++ if (!handle)
++ local_hack_g_module_set_error (fetch_dlerror ());
++
++ return handle;
++}
++
++static void
++_local_hack_g_module_close (gpointer handle,
++ gboolean is_unref)
++{
++ /* are there any systems out there that have dlopen()/dlclose()
++ * without a reference count implementation?
++ */
++ is_unref |= 1;
++
++ if (is_unref)
++ {
++ if (dlclose (handle) != 0)
++ local_hack_g_module_set_error (fetch_dlerror ());
++ }
++}
++
++static gpointer
++_local_hack_g_module_symbol (gpointer handle,
++ const gchar *symbol_name)
++{
++ gpointer p;
++
++ p = dlsym (handle, symbol_name);
++ if (!p)
++ local_hack_g_module_set_error (fetch_dlerror ());
++
++ return p;
++}
++
++static gchar*
++_local_hack_g_module_build_path (const gchar *directory,
++ const gchar *module_name)
++{
++ if (directory && *directory) {
++ if (strncmp (module_name, "lib", 3) == 0)
++ return g_strconcat (directory, "/", module_name, NULL);
++ else
++ return g_strconcat (directory, "/lib", module_name, ".so", NULL);
++ } else if (strncmp (module_name, "lib", 3) == 0)
++ return g_strdup (module_name);
++ else
++ return g_strconcat ("lib", module_name, ".so", NULL);
++}
+--- imlib-1.9.15.orig/gdk_imlib/local-hack-gmodule/gmodule-local.h
++++ imlib-1.9.15/gdk_imlib/local-hack-gmodule/gmodule-local.h
+@@ -0,0 +1,100 @@
++/* GMODULE - GLIB wrapper code for dynamic module loading
++ * Copyright (C) 1998 Tim Janik
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public
++ * License along with this library; if not, write to the
++ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
++ * Boston, MA 02111-1307, USA.
++ */
++
++/*
++ * Modified by the GLib Team and others 1997-1999. See the AUTHORS
++ * file for a list of people on the GLib Team. See the ChangeLog
++ * files for a list of changes. These files are distributed with
++ * GLib at ftp://ftp.gtk.org/pub/gtk/.
++ */
++
++#ifndef __GMODULE_H__
++#define __GMODULE_H__
++
++#include <glib.h>
++
++#ifdef __cplusplus
++extern "C" {
++#endif /* __cplusplus */
++
++/* exporting and importing functions, this is special cased
++ * to feature Windows dll stubs.
++ */
++#define LOCAL_HACK_G_MODULE_IMPORT extern
++#ifdef NATIVE_WIN32
++# define LOCAL_HACK_G_MODULE_EXPORT __declspec(dllexport)
++#else /* !NATIVE_WIN32 */
++# define LOCAL_HACK_G_MODULE_EXPORT
++#endif /* !NATIVE_WIN32 */
++
++typedef enum
++{
++ LOCAL_HACK_G_MODULE_BIND_LAZY = 1 << 0,
++ LOCAL_HACK_G_MODULE_BIND_MASK = 0x01
++} LocalHackGModuleFlags;
++
++typedef struct _LocalHackGModule LocalHackGModule;
++typedef const gchar* (*LocalHackGModuleCheckInit) (LocalHackGModule *module);
++typedef void (*LocalHackGModuleUnload) (LocalHackGModule *module);
++
++/* return TRUE if dynamic module loading is supported */
++gboolean local_hack_g_module_supported (void);
++
++/* open a module `file_name' and return handle, which is NULL on error */
++LocalHackGModule* local_hack_g_module_open (const gchar *file_name,
++ LocalHackGModuleFlags flags);
++
++/* close a previously opened module, returns TRUE on success */
++gboolean local_hack_g_module_close (LocalHackGModule *module);
++
++/* make a module resident so local_hack_g_module_close on it will be ignored */
++void local_hack_g_module_make_resident (LocalHackGModule *module);
++
++/* query the last module error as a string */
++gchar* local_hack_g_module_error (void);
++
++/* retrive a symbol pointer from `module', returns TRUE on success */
++gboolean local_hack_g_module_symbol (LocalHackGModule *module,
++ const gchar *symbol_name,
++ gpointer *symbol);
++
++/* retrive the file name from an existing module */
++gchar* local_hack_g_module_name (LocalHackGModule *module);
++
++
++/* Build the actual file name containing a module. `directory' is the
++ * directory where the module file is supposed to be, or NULL or empty
++ * in which case it should either be in the current directory or, on
++ * some operating systems, in some standard place, for instance on the
++ * PATH. Hence, to be absoultely sure to get the correct module,
++ * always pass in a directory. The file name consists of the directory,
++ * if supplied, and `module_name' suitably decorated accoring to
++ * the operating system's conventions (for instance lib*.so or *.dll).
++ *
++ * No checks are made that the file exists, or is of correct type.
++ */
++gchar* local_hack_g_module_build_path (const gchar *directory,
++ const gchar *module_name);
++
++#ifdef __cplusplus
++}
++#endif /* __cplusplus */
++
++
++#endif /* __GMODULE_H__ */
+--- imlib-1.9.15.orig/gdk_imlib/local-hack-gmodule/gmoduleconf.h
++++ imlib-1.9.15/gdk_imlib/local-hack-gmodule/gmoduleconf.h
+@@ -0,0 +1,45 @@
++/* GMODULE - GLIB wrapper code for dynamic module loading
++ * Copyright (C) 1998 Tim Janik
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public
++ * License along with this library; if not, write to the
++ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
++ * Boston, MA 02111-1307, USA.
++ */
++#ifndef __LOCAL_HACK_G_MODULE_CONF_H__
++#define __LOCAL_HACK_G_MODULE_CONF_H__
++
++
++#ifdef __cplusplus
++extern "C" {
++#endif /* __cplusplus */
++
++
++#define LOCAL_HACK_G_MODULE_IMPL_NONE 0
++#define LOCAL_HACK_G_MODULE_IMPL_DL 1
++#define LOCAL_HACK_G_MODULE_IMPL_DLD 2
++#define LOCAL_HACK_G_MODULE_IMPL_WIN32 3
++
++#define LOCAL_HACK_G_MODULE_IMPL LOCAL_HACK_G_MODULE_IMPL_DL
++#undef LOCAL_HACK_G_MODULE_HAVE_DLERROR
++#if (1)
++#define LOCAL_HACK_G_MODULE_HAVE_DLERROR
++#endif
++
++
++#ifdef __cplusplus
++}
++#endif /* __cplusplus */
++
++
++#endif /* __LOCAL_HACK_G_MODULE_CONF_H__ */
+--- imlib-1.9.15.orig/gdk_imlib/local-hack-gmodule/gmodule-local.c
++++ imlib-1.9.15/gdk_imlib/local-hack-gmodule/gmodule-local.c
+@@ -0,0 +1,418 @@
++/* GMODULE - GLIB wrapper code for dynamic module loading
++ * Copyright (C) 1998 Tim Janik
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Library General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Library General Public
++ * License along with this library; if not, write to the
++ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
++ * Boston, MA 02111-1307, USA.
++ */
++
++/*
++ * Modified by the GLib Team and others 1997-1999. See the AUTHORS
++ * file for a list of people on the GLib Team. See the ChangeLog
++ * files for a list of changes. These files are distributed with
++ * GLib at ftp://ftp.gtk.org/pub/gtk/.
++ */
++
++/*
++ * MT safe
++ */
++
++#include "gmodule-local.h"
++#include "gmoduleconf.h"
++#include <errno.h>
++#include <string.h>
++
++
++/* We maintain a list of modules, so we can reference count them.
++ * That's needed because some platforms don't support refernce counts on
++ * modules e.g. the shl_* implementation of HP-UX
++ * (http://www.stat.umn.edu/~luke/xls/projects/dlbasics/dlbasics.html).
++ * Also, the module for the program itself is kept seperatedly for
++ * faster access and because it has special semantics.
++ */
++
++
++/* --- structures --- */
++struct _LocalHackGModule
++{
++ gchar *file_name;
++ gpointer handle;
++ guint ref_count : 31;
++ guint is_resident : 1;
++ LocalHackGModuleUnload unload;
++ LocalHackGModule *next;
++};
++
++
++/* --- prototypes --- */
++static gpointer _local_hack_g_module_open (const gchar *file_name,
++ gboolean bind_lazy);
++static void _local_hack_g_module_close (gpointer handle,
++ gboolean is_unref);
++static gpointer _local_hack_g_module_self (void);
++static gpointer _local_hack_g_module_symbol (gpointer handle,
++ const gchar *symbol_name);
++static gchar* _local_hack_g_module_build_path (const gchar *directory,
++ const gchar *module_name);
++static inline void local_hack_g_module_set_error (const gchar *error);
++static inline LocalHackGModule* local_hack_g_module_find_by_handle (gpointer handle);
++static inline LocalHackGModule* local_hack_g_module_find_by_name (const gchar *name);
++
++
++/* --- variables --- */
++G_LOCK_DEFINE_STATIC (LocalHackGModule);
++static LocalHackGModule *modules = NULL;
++static LocalHackGModule *main_module = NULL;
++static GStaticPrivate module_error_private = G_STATIC_PRIVATE_INIT;
++
++
++/* --- inline functions --- */
++static inline LocalHackGModule*
++local_hack_g_module_find_by_handle (gpointer handle)
++{
++ LocalHackGModule *module;
++ LocalHackGModule *retval = NULL;
++
++ G_LOCK (LocalHackGModule);
++ if (main_module && main_module->handle == handle)
++ retval = main_module;
++ else
++ for (module = modules; module; module = module->next)
++ if (handle == module->handle)
++ {
++ retval = module;
++ break;
++ }
++ G_UNLOCK (LocalHackGModule);
++
++ return retval;
++}
++
++static inline LocalHackGModule*
++local_hack_g_module_find_by_name (const gchar *name)
++{
++ LocalHackGModule *module;
++ LocalHackGModule *retval = NULL;
++
++ G_LOCK (LocalHackGModule);
++ for (module = modules; module; module = module->next)
++ if (strcmp (name, module->file_name) == 0)
++ {
++ retval = module;
++ break;
++ }
++ G_UNLOCK (LocalHackGModule);
++
++ return retval;
++}
++
++static inline void
++local_hack_g_module_set_error (const gchar *error)
++{
++ g_static_private_set (&module_error_private, g_strdup (error), g_free);
++ errno = 0;
++}
++
++
++/* --- include platform specifc code --- */
++#define SUPPORT_OR_RETURN(rv) { local_hack_g_module_set_error (NULL); }
++#if (LOCAL_HACK_G_MODULE_IMPL == LOCAL_HACK_G_MODULE_IMPL_DL)
++#include "gmodule-dl.c"
++#elif (LOCAL_HACK_G_MODULE_IMPL == LOCAL_HACK_G_MODULE_IMPL_DLD)
++#include "gmodule-dld.c"
++#elif (LOCAL_HACK_G_MODULE_IMPL == LOCAL_HACK_G_MODULE_IMPL_WIN32)
++#include "gmodule-win32.c"
++#else
++#undef SUPPORT_OR_RETURN
++#define SUPPORT_OR_RETURN(rv) { local_hack_g_module_set_error ("dynamic modules are " \
++ "not supported by this system"); return rv; }
++static gpointer
++_local_hack_g_module_open (const gchar *file_name,
++ gboolean bind_lazy)
++{
++ return NULL;
++}
++static void
++_local_hack_g_module_close (gpointer handle,
++ gboolean is_unref)
++{
++}
++static gpointer
++_local_hack_g_module_self (void)
++{
++ return NULL;
++}
++static gpointer
++_local_hack_g_module_symbol (gpointer handle,
++ const gchar *symbol_name)
++{
++ return NULL;
++}
++static gchar*
++_local_hack_g_module_build_path (const gchar *directory,
++ const gchar *module_name)
++{
++ return NULL;
++}
++#endif /* no implementation */
++
++#if defined (NATIVE_WIN32) && defined (__LCC__)
++int __stdcall
++LibMain (void *hinstDll,
++ unsigned long dwReason,
++ void *reserved)
++{
++ return 1;
++}
++#endif /* NATIVE_WIN32 && __LCC__ */
++
++
++/* --- functions --- */
++gboolean
++local_hack_g_module_supported (void)
++{
++ SUPPORT_OR_RETURN (FALSE);
++
++ return TRUE;
++}
++
++LocalHackGModule*
++local_hack_g_module_open (const gchar *file_name,
++ LocalHackGModuleFlags flags)
++{
++ LocalHackGModule *module;
++ gpointer handle;
++
++ SUPPORT_OR_RETURN (NULL);
++
++ if (!file_name)
++ {
++ G_LOCK (LocalHackGModule);
++ if (!main_module)
++ {
++ handle = _local_hack_g_module_self ();
++ if (handle)
++ {
++ main_module = g_new (LocalHackGModule, 1);
++ main_module->file_name = NULL;
++ main_module->handle = handle;
++ main_module->ref_count = 1;
++ main_module->is_resident = TRUE;
++ main_module->unload = NULL;
++ main_module->next = NULL;
++ }
++ }
++ G_UNLOCK (LocalHackGModule);
++
++ return main_module;
++ }
++
++ /* we first search the module list by name */
++ module = local_hack_g_module_find_by_name (file_name);
++ if (module)
++ {
++ module->ref_count++;
++
++ return module;
++ }
++
++ /* open the module */
++ handle = _local_hack_g_module_open (file_name, (flags & LOCAL_HACK_G_MODULE_BIND_LAZY) != 0);
++ if (handle)
++ {
++ gchar *saved_error;
++ LocalHackGModuleCheckInit check_init;
++ const gchar *check_failed = NULL;
++
++ /* search the module list by handle, since file names are not unique */
++ module = local_hack_g_module_find_by_handle (handle);
++ if (module)
++ {
++ _local_hack_g_module_close (module->handle, TRUE);
++ module->ref_count++;
++ local_hack_g_module_set_error (NULL);
++
++ return module;
++ }
++
++ saved_error = g_strdup (local_hack_g_module_error ());
++ local_hack_g_module_set_error (NULL);
++
++ module = g_new (LocalHackGModule, 1);
++ module->file_name = g_strdup (file_name);
++ module->handle = handle;
++ module->ref_count = 1;
++ module->is_resident = FALSE;
++ module->unload = NULL;
++ G_LOCK (LocalHackGModule);
++ module->next = modules;
++ modules = module;
++ G_UNLOCK (LocalHackGModule);
++
++ /* check initialization */
++ if (local_hack_g_module_symbol (module, "local_hack_g_module_check_init", (gpointer) &check_init))
++ check_failed = check_init (module);
++
++ /* we don't call unload() if the initialization check failed. */
++ if (!check_failed)
++ local_hack_g_module_symbol (module, "local_hack_g_module_unload", (gpointer) &module->unload);
++
++ if (check_failed)
++ {
++ gchar *error;
++
++ error = g_strconcat ("LocalHackGModule initialization check failed: ", check_failed, NULL);
++ local_hack_g_module_close (module);
++ module = NULL;
++ local_hack_g_module_set_error (error);
++ g_free (error);
++ }
++ else
++ local_hack_g_module_set_error (saved_error);
++
++ g_free (saved_error);
++ }
++
++ return module;
++}
++
++gboolean
++local_hack_g_module_close (LocalHackGModule *module)
++{
++ SUPPORT_OR_RETURN (FALSE);
++
++ g_return_val_if_fail (module != NULL, FALSE);
++ g_return_val_if_fail (module->ref_count > 0, FALSE);
++
++ module->ref_count--;
++
++ if (!module->ref_count && !module->is_resident && module->unload)
++ {
++ LocalHackGModuleUnload unload;
++
++ unload = module->unload;
++ module->unload = NULL;
++ unload (module);
++ }
++
++ if (!module->ref_count && !module->is_resident)
++ {
++ LocalHackGModule *last;
++ LocalHackGModule *node;
++
++ last = NULL;
++
++ G_LOCK (LocalHackGModule);
++ node = modules;
++ while (node)
++ {
++ if (node == module)
++ {
++ if (last)
++ last->next = node->next;
++ else
++ modules = node->next;
++ break;
++ }
++ last = node;
++ node = last->next;
++ }
++ module->next = NULL;
++ G_UNLOCK (LocalHackGModule);
++
++ _local_hack_g_module_close (module->handle, FALSE);
++ g_free (module->file_name);
++
++ g_free (module);
++ }
++
++ return local_hack_g_module_error() == NULL;
++}
++
++void
++local_hack_g_module_make_resident (LocalHackGModule *module)
++{
++ g_return_if_fail (module != NULL);
++
++ module->is_resident = TRUE;
++}
++
++gchar*
++local_hack_g_module_error (void)
++{
++ return g_static_private_get (&module_error_private);
++}
++
++gboolean
++local_hack_g_module_symbol (LocalHackGModule *module,
++ const gchar *symbol_name,
++ gpointer *symbol)
++{
++ gchar *module_error;
++
++ if (symbol)
++ *symbol = NULL;
++ SUPPORT_OR_RETURN (FALSE);
++
++ g_return_val_if_fail (module != NULL, FALSE);
++ g_return_val_if_fail (symbol_name != NULL, FALSE);
++ g_return_val_if_fail (symbol != NULL, FALSE);
++
++#ifdef LOCAL_HACK_G_MODULE_NEED_USCORE
++ {
++ gchar *name;
++
++ name = g_strconcat ("_", symbol_name, NULL);
++ *symbol = _local_hack_g_module_symbol (module->handle, name);
++ g_free (name);
++ }
++#else /* !LOCAL_HACK_G_MODULE_NEED_USCORE */
++ *symbol = _local_hack_g_module_symbol (module->handle, symbol_name);
++#endif /* !LOCAL_HACK_G_MODULE_NEED_USCORE */
++
++ module_error = local_hack_g_module_error ();
++ if (module_error)
++ {
++ gchar *error;
++
++ error = g_strconcat ("`", symbol_name, "': ", module_error, NULL);
++ local_hack_g_module_set_error (error);
++ g_free (error);
++ *symbol = NULL;
++
++ return FALSE;
++ }
++
++ return TRUE;
++}
++
++gchar*
++local_hack_g_module_name (LocalHackGModule *module)
++{
++ g_return_val_if_fail (module != NULL, NULL);
++
++ if (module == main_module)
++ return "main";
++
++ return module->file_name;
++}
++
++gchar*
++local_hack_g_module_build_path (const gchar *directory,
++ const gchar *module_name)
++{
++ g_return_val_if_fail (module_name != NULL, NULL);
++
++ return _local_hack_g_module_build_path (directory, module_name);
++}
+
diff --git a/freebsd/dependencies/imlib/files/patch-imlib-config.diff b/freebsd/dependencies/imlib/files/patch-imlib-config.diff
new file mode 100644
index 000000000..ad1a076d0
--- /dev/null
+++ b/freebsd/dependencies/imlib/files/patch-imlib-config.diff
@@ -0,0 +1,28 @@
+--- imlib-1.9.15.orig/imlib-config.in
++++ imlib-1.9.15/imlib-config.in
+@@ -49,21 +49,21 @@
+ if test @includedir@ != /usr/include ; then
+ includes=-I@includedir@
+ fi
+- echo $includes @X_CFLAGS@
++ echo $includes
+ ;;
+ --cflags-gdk)
+ if test @includedir@ != /usr/include ; then
+ includes=-I@includedir@
+ fi
+- echo `@GTK_CONFIG@ --cflags` $includes @X_CFLAGS@
++ echo `@GTK_CONFIG@ --cflags` $includes
+ ;;
+ --libs)
+ libdirs=-L@libdir@
+- echo $libdirs -lImlib @LDFLAGS@ $gx_libs @X_LIBS@ @X_PRE_LIBS@ -lXext -lX11 @X_EXTRA_LIBS@
++ echo $libdirs -lImlib
+ ;;
+ --libs-gdk)
+ libdirs=-L@libdir@
+- echo $libdirs -lgdk_imlib$gdk_gx_libs `@GTK_CONFIG@ --libs` $gdk_libs
++ echo $libdirs -lgdk_imlib
+ ;;
+ *)
+ echo "${usage}" 1>&2
diff --git a/freebsd/dependencies/imlib/files/patch-imlib-m4.diff b/freebsd/dependencies/imlib/files/patch-imlib-m4.diff
new file mode 100644
index 000000000..d40a3a6c5
--- /dev/null
+++ b/freebsd/dependencies/imlib/files/patch-imlib-m4.diff
@@ -0,0 +1,32 @@
+--- imlib-1.9.15.orig/imlib.m4
++++ imlib-1.9.15/imlib.m4
+@@ -6,7 +6,7 @@
+ dnl AM_PATH_IMLIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+ dnl Test for IMLIB, and define IMLIB_CFLAGS and IMLIB_LIBS
+ dnl
+-AC_DEFUN(AM_PATH_IMLIB,
++AC_DEFUN([AM_PATH_IMLIB],
+ [dnl
+ dnl Get the cflags and libraries from the imlib-config script
+ dnl
+@@ -164,7 +164,7 @@
+ ])
+
+ # Check for gdk-imlib
+-AC_DEFUN(AM_PATH_GDK_IMLIB,
++AC_DEFUN([AM_PATH_GDK_IMLIB],
+ [dnl
+ dnl Get the cflags and libraries from the imlib-config script
+ dnl
+@@ -291,8 +291,8 @@
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+- IMLIB_CFLAGS=""
+- IMLIB_LIBS=""
++ GDK_IMLIB_CFLAGS=""
++ GDK_IMLIB_LIBS=""
+ ifelse([$3], , :, [$3])
+ fi
+ AC_SUBST(GDK_IMLIB_CFLAGS)
+
diff --git a/freebsd/dependencies/imlib/files/patch-link-against-x11.diff b/freebsd/dependencies/imlib/files/patch-link-against-x11.diff
new file mode 100644
index 000000000..25cdac17c
--- /dev/null
+++ b/freebsd/dependencies/imlib/files/patch-link-against-x11.diff
@@ -0,0 +1,16 @@
+--- imlib-1.9.15.orig/Imlib/Makefile.am
++++ imlib-1.9.15/Imlib/Makefile.am
+@@ -30,10 +30,10 @@
+ save.c \
+ snprintf.c
+
+-libImlib_la_LDFLAGS = -version-info 10:15:9
++libImlib_la_LDFLAGS = -version-info 11:0:0
+ #libImlib_la_LDDADD = $(SUPPORT_LIBS)
+ libImlib_la_LIBADD = $(SUPPORT_LIBS) $(X_PRE_LIBS) \
+- $(X_LIBS) $(X_EXTRA_LIBS)
++ $(X_LIBS) $(X_EXTRA_LIBS) -lX11
+
+ DEFS = -DSYSTEM_IMRC=\"$(sysconfdir)/imrc\" \
+ -DSYSCONFDIR=\"$(sysconfdir)\"
+
diff --git a/freebsd/dependencies/imlib/files/patch-png1.5.diff b/freebsd/dependencies/imlib/files/patch-png1.5.diff
new file mode 100644
index 000000000..c40192493
--- /dev/null
+++ b/freebsd/dependencies/imlib/files/patch-png1.5.diff
@@ -0,0 +1,80 @@
+--- a/gdk_imlib/io-png.c 2002-03-04 18:06:29.000000000 +0100
++++ b/gdk_imlib/io-png.c 2012-04-24 23:11:43.000000000 +0200
+@@ -40,7 +41,7 @@
+ return NULL;
+ }
+
+- if (setjmp(png_ptr->jmpbuf))
++ if (setjmp(png_jmpbuf(png_ptr)))
+ {
+ png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+ return NULL;
+@@ -275,7 +276,7 @@
+ return NULL;
+ }
+
+- if (setjmp(png_ptr->jmpbuf))
++ if (setjmp(png_jmpbuf(png_ptr)))
+ {
+ png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+ return NULL;
+@@ -440,7 +441,7 @@
+ return NULL;
+ }
+
+- if (setjmp(png_ptr->jmpbuf))
++ if (setjmp(png_jmpbuf(png_ptr)))
+ {
+ png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+ return NULL;
+@@ -635,7 +636,7 @@
+ png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
+ return 0;
+ }
+- if (setjmp(png_ptr->jmpbuf))
++ if (setjmp(png_jmpbuf(png_ptr)))
+ {
+ fclose(f);
+ png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
+--- a/Imlib/load.c 2004-09-21 02:23:20.000000000 +0200
++++ b/Imlib/load.c 2010-03-28 16:23:13.000000000 +0200
+@@ -192,7 +198,7 @@
+ png_destroy_read_struct(&png_ptr, NULL, NULL);
+ return NULL;
+ }
+- if (setjmp(png_ptr->jmpbuf))
++ if (setjmp(png_jmpbuf(png_ptr)))
+ {
+ png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+ return NULL;
+@@ -1619,7 +1619,7 @@
+ return 0;
+ fread(buf, 1, 8, f);
+ rewind(f);
+- return (int)png_check_sig(buf, 8);
++ return (int)!png_sig_cmp(buf, 0, 8);
+ #else
+ return 0;
+ #endif
+--- a/Imlib/save.c 2004-09-21 02:22:59.000000000 +0200
++++ b/Imlib/save.c 2012-04-27 07:19:57.000000000 +0200
+@@ -342,7 +342,7 @@
+ png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
+ return 0;
+ }
+- if (setjmp(png_ptr->jmpbuf))
++ if (setjmp(png_jmpbuf(png_ptr)))
+ {
+ fclose(f);
+ png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
+--- a/Imlib/utils.c 2012-04-27 07:12:19.000000000 +0200
++++ b/Imlib/utils.c 2012-04-27 07:15:39.000000000 +0200
+@@ -1982,7 +1983,7 @@
+ return NULL;
+ }
+
+- if (setjmp(png_ptr->jmpbuf))
++ if (setjmp(png_jmpbuf(png_ptr)))
+ {
+ png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+ return NULL;
diff --git a/freebsd/dependencies/imlib/files/patch-png1.6.diff b/freebsd/dependencies/imlib/files/patch-png1.6.diff
new file mode 100644
index 000000000..b5e2f6324
--- /dev/null
+++ b/freebsd/dependencies/imlib/files/patch-png1.6.diff
@@ -0,0 +1,36 @@
+diff -ru a/Imlib/load.c b/Imlib/load.c
+--- a/Imlib/load.c 2015-06-21 03:21:07.000000000 +0200
++++ b/Imlib/load.c 2015-06-21 03:16:28.000000000 +0200
+@@ -196,7 +196,7 @@
+ png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+ return NULL;
+ }
+- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
++ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA)
+ {
+ png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+ return NULL;
+diff -ru a/Imlib/utils.c b/Imlib/utils.c
+--- a/Imlib/utils.c 2015-06-21 03:21:07.000000000 +0200
++++ b/Imlib/utils.c 2015-06-21 03:16:20.000000000 +0200
+@@ -1965,7 +1965,7 @@
+ return NULL;
+ }
+
+- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
++ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA)
+ {
+ png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+ return NULL;
+diff -ru a/gdk_imlib/io-png.c b/gdk_imlib/io-png.c
+--- a/gdk_imlib/io-png.c 2015-06-21 03:21:07.000000000 +0200
++++ b/gdk_imlib/io-png.c 2015-06-21 03:16:37.000000000 +0200
+@@ -46,7 +46,7 @@
+ return NULL;
+ }
+
+- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
++ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA)
+ {
+ png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+ return NULL;
diff --git a/freebsd/dependencies/imlib/files/patch-search-system-include-for-xshm.diff b/freebsd/dependencies/imlib/files/patch-search-system-include-for-xshm.diff
new file mode 100644
index 000000000..47271a097
--- /dev/null
+++ b/freebsd/dependencies/imlib/files/patch-search-system-include-for-xshm.diff
@@ -0,0 +1,14 @@
+--- imlib-1.9.15.orig/configure.in
++++ imlib-1.9.15/configure.in
+@@ -197,7 +197,9 @@
+ AC_MSG_RESULT(no)
+ no_xshm=yes
+ else
+- if test -f "$x_includes/X11/extensions/XShm.h"; then
++ if test -f "$x_includes/X11/extensions/XShm.h" || \
++ test -f "/usr/include/X11/extensions/XShm.h" || \
++ test -f "/usr/local/include/X11/extensions/XShm.h"; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_XSHM_H, 1, [ ])
+ else
+
diff --git a/freebsd/dependencies/imlib/pkg-descr b/freebsd/dependencies/imlib/pkg-descr
new file mode 100644
index 000000000..236661985
--- /dev/null
+++ b/freebsd/dependencies/imlib/pkg-descr
@@ -0,0 +1,4 @@
+Imlib is a general Image loading and rendering library designed to make the
+task of loading images, and obtaining X-Windows drawables a simple task, as
+well as a quick one. It also aims to provide simple manipulation routines that
+might be desired for common operations.
diff --git a/freebsd/dependencies/imlib/pkg-plist b/freebsd/dependencies/imlib/pkg-plist
new file mode 100644
index 000000000..3085dae0c
--- /dev/null
+++ b/freebsd/dependencies/imlib/pkg-plist
@@ -0,0 +1,16 @@
+bin/imlib-config
+etc/imlib/im_palette-small.pal
+etc/imlib/im_palette-tiny.pal
+etc/imlib/im_palette.pal
+etc/imlib/imrc
+include/Imlib.h
+include/Imlib_private.h
+include/Imlib_types.h
+lib/libImlib.a
+lib/libImlib.so
+lib/libImlib.so.11
+lib/libImlib.so.11.0.0
+libdata/pkgconfig/imlib.pc
+libdata/pkgconfig/imlibgdk.pc
+man/man1/imlib-config.1.gz
+share/aclocal/imlib.m4