Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support building on macOS with optional X11 #46

Merged
merged 7 commits into from
Mar 16, 2017

Conversation

qmfrederik
Copy link
Contributor

X11 no longer ships with macOS, so building libgdiplus over there fails. This PR makes x11 integration optional, by adding a --without-x11 flag.

This will also enable adoption of libgdiplus in homebrew.

Related issues: Homebrew/legacy-homebrew#45393, #13, #35

pcercuei and others added 5 commits September 3, 2016 19:02
This fixes cross-compilation.

This code is contributed under the terms of the MIT license.
When X11 is not available (like on recent OS X versions), the DPI
is initialized to a default value of 96.
@monojenkins
Copy link

Hello! I'm the build bot for the Mono project.

I need approval from a Mono team member to build this pull request. A team member should reply with "approve" to approve a build of this pull request, "whitelist" to whitelist this and all future pull requests from this contributor, or "build" to explicitly request a build, even if one has already been done.

Contributors can ignore this message.

@dnfclas
Copy link

dnfclas commented Mar 15, 2017

@qmfrederik,
Thanks for having already signed the Contribution License Agreement. Your agreement was validated by .NET Foundation. We will now review your pull request.
Thanks,
.NET Foundation Pull Request Bot

@qmfrederik
Copy link
Contributor Author

@akoeplinger could you trigger a build for this? I'd like to double check this does not break the Linux builds

@akoeplinger
Copy link
Member

whitelist

Copy link
Member

@akoeplinger akoeplinger left a comment

Choose a reason for hiding this comment

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

Looks fine to me thanks. Note that the tests in libgdiplus are very limited. A good test is to build and install libgdiplus and then run the System.Drawing and WinForms* tests from Mono against it.

*the WinForms tests don't work or crash on Mac.

configure.ac Outdated
@@ -348,6 +353,37 @@ dnl Test for libpng
GDIPLUS_LIBS="$GDIPLUS_LIBS $LIBPNG"
AC_DEFINE(HAVE_LIBPNG, 1, Define if png support is available. Always defined.)

dnl
dnl Test for X11. Allow compiling without x11 support using the disable-x11
Copy link
Member

Choose a reason for hiding this comment

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

should be without-x11 since you're using AC_ARG_WITH

#ifdef CAIRO_HAS_XLIB_SURFACE
#include "cairo-xlib.h"
#endif
#endif
Copy link
Member

Choose a reason for hiding this comment

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

should use tabs instead of spaces here and below.

Display *display;
Drawable drawable;
#endif
#endif
Copy link
Member

Choose a reason for hiding this comment

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

this struct isn't passed between managed<->native right? otherwise we might get issues if it changes size/layout.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I checked, it's not in gdipStructs.cs and a search for _Graphics didn't return any struct which matches this one in Mono's codebase, so I'm assuming not.

Copy link
Member

Choose a reason for hiding this comment

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

ok, good. Can you run the System.Drawing tests against the new libgdiplus?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll give it a try and let you know how it goes.

@qmfrederik
Copy link
Contributor Author

@akoeplinger Here's how I ran the tests:

  • Removed /usr/lib/libgdiplus.so* and made sure make run-test returned almost all tests failed (to ensure the tests are using libgdiplus from /usr/lib)
  • Installed the updated libgdiplus.so into /usr/lib via make install
  • Ran make run-test and all tests pass:
NUnitLite 1.0.0 (.NET 4.5 Debug)
Copyright 2013, Charlie Poole

Runtime Environment -
    OS Version: Unix 4.4.0.66
  Mono Version: 4.0.30319.42000

............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
** (process:20212): WARNING **: NOT IMPLEMENTED: GdipWidenPath
.................................................................................................................................................................................NOT IMPLEMENTED YET:GdipTransformPointsI (GpGraphics *graphics, GpCoordinateSpace destSpace, GpCoordinateSpace srcSpace, GpPoint *points, int count)
NOT IMPLEMENTED YET:GdipTransformPoints (GpGraphics *graphics, GpCoordinateSpace destSpace 1, GpCoordinateSpace srcSpace 2, GpPointF *points, int count 5)
.................................................................................................................................................................................................................................................................................
** (process:20212): WARNING **: Unknown metafile format: key 1073106242
.......................................................................................................................................................................................................................................................................................................................................................................................................
** (process:20212): WARNING **: Path conversion requested 0 bytes (8388608 x 8388608). Maximum size is 8388608 bytes.
........................................................................................................................................................................................................................................................................................................................................................................................................................................................
Tests run: 1855, Passed: 1845, Errors: 0, Failures: 0, Inconclusive: 0
  Not run: 10, Invalid: 0, Ignored: 10, Skipped: 0
Elapsed time: 00:00:02.0510000

@qmfrederik
Copy link
Contributor Author

@akoeplinger Tried to run the System.Windows.Forms tests by my Linux box is headless so they pretty much all failed because of that.

@akoeplinger
Copy link
Member

@qmfrederik awesome, thanks for that 👍

Re: WinForms: you can install Xvfb to run it on a headless box, it's how we run it on Jenkins.
I'll do a few more tests on OSX tomorrow but otherwise I think this is good to go.

@qmfrederik
Copy link
Contributor Author

OK, here are the results with xvfb-run:

Tests run: 2850, Passed: 2738, Errors: 0, Failures: 0, Inconclusive: 0
  Not run: 112, Invalid: 0, Ignored: 112, Skipped: 0
Elapsed time: 00:00:11.7690000

@qmfrederik
Copy link
Contributor Author

Related issue: Homebrew/homebrew-core#4202

@akoeplinger akoeplinger merged commit 910ba3a into mono:master Mar 16, 2017
uqs pushed a commit to freebsd/freebsd-ports that referenced this pull request Apr 9, 2017
 - Add extra patch that conditionally compiles x11 support [1]
 - Add X11 option that applies extra patch if X11 support is disabled
 - PORTREVISION is not bumped as:
   - The default case (X11) has not changed, and
   - The non-default case will propogate due to options change

[1] mono/libgdiplus#46

PR:		213973


git-svn-id: svn+ssh://svn.freebsd.org/ports/head@438077 35697150-7ecd-e111-bb59-0022644237b5
uqs pushed a commit to freebsd/freebsd-ports that referenced this pull request Apr 9, 2017
 - Add extra patch that conditionally compiles x11 support [1]
 - Add X11 option that applies extra patch if X11 support is disabled
 - PORTREVISION is not bumped as:
   - The default case (X11) has not changed, and
   - The non-default case will propogate due to options change

[1] mono/libgdiplus#46

PR:		213973
@qmfrederik qmfrederik deleted the optional-x11 branch April 29, 2017 18:14
kwm81 pushed a commit to freebsd/freebsd-ports-gnome that referenced this pull request Sep 15, 2017
 - Add extra patch that conditionally compiles x11 support [1]
 - Add X11 option that applies extra patch if X11 support is disabled
 - PORTREVISION is not bumped as:
   - The default case (X11) has not changed, and
   - The non-default case will propogate due to options change

[1] mono/libgdiplus#46

PR:		213973
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants