Skip to content
This repository was archived by the owner on Jan 16, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
183 changes: 183 additions & 0 deletions Library/Formula/libgdiplus.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
class Libgdiplus < Formula
desc "C-based implementation of the GDI+ API for Mono"
homepage "http://www.mono-project.com/docs/gui/libgdiplus/"
version "3.12"
url "https://github.com/mono/libgdiplus/tarball/3b284ab28cb8737f9d14dabfedc6903655c66a7f"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need a stable release before we can add this to Homebrew.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean you need a stable location to download the bytes from, because this code is both stable and released. How do you prefer it hosted and what precisely are your requirements to allow it to be included in homebrew? Is not github a stable place to download it from?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a stable, tagged release.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be clear about what you need so we can move forward from this back-and-forth:

So you need a git tag in the linked repo? Or you can take a tag in any cloned repo? Are you saying you need the official mono sponsor, Xamarin, to tag it? Or isn't the code base OpenSUSE uses (this particular commit) good enough? Or good enough if it's git-tagged? Does it matter this code-base hasn't been changed for basically three quarters of a year and that many a mono release has been built from it; many stable official releases. Or isn't it stable because I say so because I've verified that it is on my side? Please be specific.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our documentation is clear.

So you need a git tag in the linked repo?

Yes.

Are you saying you need the official mono sponsor, Xamarin, to tag it?

Yes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@directhex / Jo, Could you please tag the currently merged state in the git repository? Thank you. :)

head "https://github.com/mono/libgdiplus.git"
sha256 "c7b6e68f4f4ef62e1f7551769c7f0b87e7debd52311123a0264d23cf7ac9aee8"
patch :DATA

# it depends on mono to link to System.Drawing
depends_on "libexif"
depends_on "glib"
depends_on "cairo"
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "autoconf" => :build
depends_on "pkg-config" => :build
# And it depends on mono to build, but this formula is specified as a resource
# in that recipe.

def install
system "./autogen.sh"
system "./configure", "--disable-dependency-tracking",
"--disable-silent-rules",
"--disable-tests",
"--prefix=#{prefix}"
system "make", "install"
end

test do
system "true"
end
end

__END__
diff --git a/Makefile.am b/Makefile.am
index bb89e98..ca2cf51 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = @CAIRO_DIR@ src tests
+SUBDIRS = @CAIRO_DIR@ src @TESTS_DIR@
DIST_SUBDIRS = src tests

pkgconfigdir = $(libdir)/pkgconfig
diff --git a/configure.ac b/configure.ac
index 772d5fc..54d8677 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,8 +19,8 @@ fi
GLIB_REQUIRED_VERSION="2.2.3"
PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION)

-GDIPLUS_LIBS="`pkg-config --libs glib-2.0 `"
-GDIPLUS_CFLAGS="`pkg-config --cflags glib-2.0 `"
+GDIPLUS_LIBS="`$PKG_CONFIG --libs glib-2.0 `"
+GDIPLUS_CFLAGS="`$PKG_CONFIG --cflags glib-2.0 `"

CAIRO_REQUIRED_VERSION="1.6.4"
PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_REQUIRED_VERSION)
@@ -122,8 +122,8 @@ esac

# Add xrender here so that we don't fail to find glib if we won't have xrender.pc
if test "x$no_x" != "xyes"; then
- GDIPLUS_LIBS="$GDIPLUS_LIBS `pkg-config --libs xrender `"
- GDIPLUS_CFLAGS="$GDIPLUS_CFLAGS `pkg-config --cflags xrender `"
+ GDIPLUS_LIBS="$GDIPLUS_LIBS `$PKG_CONFIG --libs xrender `"
+ GDIPLUS_CFLAGS="$GDIPLUS_CFLAGS `$PKG_CONFIG --cflags xrender `"
fi

# Apparently for BSD special handling needs to happen
@@ -363,17 +363,16 @@ else
fi
AM_CONDITIONAL(HAVE_LIBEXIF, test x$libexif_pkgconfig = xyes)

-dnl
-dnl Produce a diagnostic, to reduce support time
-dnl
-AC_TRY_COMPILE([#include <X11/Xlib.h>],
- [],[x11_failed=false],[x11_failed=true])
-if $x11_failed; then
- AC_ERROR("Failed to compile with X11/Xlib.h include. You must fix your compiler paths")
-fi
-
GDIPLUS_PKG_LIBS="$GDIPLUS_LIBS"
GDIPLUS_PKG_CFLAGS="$GDIPLUS_CFLAGS"
+
+AC_ARG_ENABLE(tests, [AC_HELP_STRING([--disable-tests],
+ [ Disable building tests ])],
+ [disable_tests=yes])
+if test x$disable_tests != xyes ; then
+ TESTS_DIR=tests
+ AC_SUBST(TESTS_DIR)
+fi

AC_SUBST(GDIPLUS_LIBS)
AC_SUBST(GDIPLUS_CFLAGS)
diff --git a/src/gdiplus-private.h b/src/gdiplus-private.h
index dfccc02..8a409ad 100644
--- a/src/gdiplus-private.h
+++ b/src/gdiplus-private.h
@@ -64,7 +64,9 @@
#endif
#endif

+#ifdef CAIRO_HAS_XLIB_SURFACE
#include <X11/Xlib.h>
+#endif

#include "win32structs.h"
#include "gdipenums.h"
diff --git a/src/general.c b/src/general.c
index 8a170ce..406b5aa 100644
--- a/src/general.c
+++ b/src/general.c
@@ -123,7 +123,6 @@ float
gdip_get_display_dpi ()
{
static float dpis = 0;
- Display* display;

if (dpis == 0) {
#if __APPLE__
@@ -132,7 +131,8 @@ gdip_get_display_dpi ()

dpis = h_dpi;
return dpis;
-#else
+#elif defined(CAIRO_HAS_XLIB_SURFACE)
+ Display* display;
char *val;

display = XOpenDisplay (0);
@@ -148,7 +148,9 @@ gdip_get_display_dpi ()
} else {
dpis = 96.0f;
}
+ return dpis;
#endif
+ dpis = 96.0f;
}

return dpis;
diff --git a/src/graphics-private.h b/src/graphics-private.h
index 25660c6..bdbc8a2 100644
--- a/src/graphics-private.h
+++ b/src/graphics-private.h
@@ -105,8 +105,10 @@ typedef struct _Graphics {
cairo_t *ct;
GpMatrix *copy_of_ctm;
cairo_matrix_t previous_matrix;
+#ifdef CAIRO_HAS_XLIB_SURFACE
Display *display;
Drawable drawable;
+#endif
void *image;
int type;
GpPen* last_pen; /* caching pen and brush to avoid unnecessary sets */
diff --git a/src/graphics.c b/src/graphics.c
index 16a29ea..71ad9b8 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -151,8 +151,10 @@ gdip_graphics_common_init (GpGraphics *graphics)
graphics->render_origin_y = 0;
graphics->dpi_x = graphics->dpi_y = 0;

+#ifdef CAIRO_HAS_XLIB_SURFACE
graphics->display = NULL;
graphics->drawable = NULL;
+#endif

gdip_graphics_reset (graphics);
}
@@ -216,7 +218,9 @@ GdipCreateFromHDC (void *hDC, GpGraphics **graphics)
cairo_surface_t *surface;
int x, y;
unsigned int w, h, border_w, depth;
+#ifdef CAIRO_HAS_XLIB_SURFACE
Window root;
+#endif

if (!hDC)
return OutOfMemory;
16 changes: 16 additions & 0 deletions Library/Formula/mono.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ class Mono < Formula
:revision => "c5e345b194eaddad7f06d47cd944b098f3dbe325"
end

resource "libgdiplus" do
url "https://github.com/mono/libgdiplus/tarball/3b284ab28cb8737f9d14dabfedc6903655c66a7f"
sha256 "c7b6e68f4f4ef62e1f7551769c7f0b87e7debd52311123a0264d23cf7ac9aee8"
end

depends_on "automake" => :build
depends_on "autoconf" => :build
depends_on "pkg-config" => :build
Expand Down Expand Up @@ -69,6 +74,17 @@ def install
system "make", "install"
end
end

if build.with? "libgdiplus"
resource("libgdiplus").stage do
system "./autogen.sh"
system "./configure", "--disable-dependency-tracking",
"--disable-silent-rules",
"--disable-tests",
"--prefix=#{prefix}"
system "make", "install"
end
end
end

test do
Expand Down