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

Anki: Darwin support #21681

Merged
merged 5 commits into from Jan 18, 2017
Merged

Anki: Darwin support #21681

merged 5 commits into from Jan 18, 2017

Conversation

matthewbauer
Copy link
Member

@matthewbauer matthewbauer commented Jan 5, 2017

Motivation for this change

These are all changes needed to get Anki working on macOS. No changes to the Anki derivation are necessary. However, to run Anki correctly you must set DYLD_FRAMEWORK_PATH correctly until #20484 is fixed:

DYLD_FRAMEWORK_PATH=/System/Library/Frameworks `nix-build '<nixpkgs>' -A anki --no-out-link`/bin/anki
Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@mention-bot
Copy link

@matthewbauer, thanks for your PR! By analyzing the history of the files in this pull request, we identified @lovek323, @bjornfor and @urkud to be potential reviewers.

@LnL7 LnL7 added the 6.topic: darwin Running or building packages on Darwin label Jan 5, 2017
@@ -41,7 +43,8 @@ stdenv.mkDerivation rec {
sha256 = "11j682g2mn723sz3bh4i44ggq29z053zcggy0glzn63zh9mxdly3";
};

patches = [ ./caps-fix.patch ];
patches = [ ./caps-fix.patch ]
Copy link
Member

Choose a reason for hiding this comment

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

Where did this patch come from? It looks like you can probably use fetchpatch instead.

Copy link
Member

Choose a reason for hiding this comment

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

Note this patch was already here

Copy link
Member Author

Choose a reason for hiding this comment

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

I think he was referring to the below one.

Copy link
Member

Choose a reason for hiding this comment

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

Indeed, the changes are good now apart from the xcode dependency.

[ "--build=x86_64" "--without-oss" "--enable-static" "--enable-shared" ];
[ "--disable-mac-universal" ];

propagatedBuildInputs = stdenv.lib.optionals stdenv.isDarwin [ AudioUnit AudioToolbox CoreAudio CoreServices Carbon ];

preBuild = stdenv.lib.optionalString stdenv.isDarwin ''
sed -i '50 i\
Copy link
Member

Choose a reason for hiding this comment

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

Not your changes, but this looks really fragile.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep. It's needed here because Makefile is not generated until after configurePhase. We should just modify Makefile.in but the line numbers won't be the same.

Copy link
Member

Choose a reason for hiding this comment

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

I would prefer a patch that fixes the Makefile.in then, if that's possible.

@LnL7
Copy link
Member

LnL7 commented Jan 6, 2017

This builds fine, but running it seems to require xcode. Is that expected?

@matthewbauer
Copy link
Member Author

@LnL7 It shouldn't require Xcode. Do you have any clues as to where it uses Xcode?

@matthewbauer matthewbauer mentioned this pull request Jan 9, 2017
7 tasks
Copy link
Contributor

@mdaiter mdaiter left a comment

Choose a reason for hiding this comment

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

Just trying to understand some minor changes in here -- looks good, but particularly concerned about the change from linux to unix when the title suggests only Darwin support.

@@ -199,6 +199,6 @@ stdenv.mkDerivation rec {
homepage = "http://mplayerhq.hu";
license = "GPL";
maintainers = [ stdenv.lib.maintainers.eelco stdenv.lib.maintainers.urkud ];
platforms = stdenv.lib.platforms.linux;
platforms = stdenv.lib.platforms.unix;
Copy link
Contributor

Choose a reason for hiding this comment

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

Hesitations about changing this to "unix" when the title says "Darwin support". Unix is defined to be Linux, Darwin, FreeBSD, OpenBSD, NetBSD and Illumos; as defined here:

unix = linux ++ darwin ++ freebsd ++ openbsd ++ netbsd ++ illumos;
. This might want to be formatted as with stdenv.lib.platforms; linux ++ darwin ; to conform to the header.

Copy link
Member

@LnL7 LnL7 Jan 11, 2017

Choose a reason for hiding this comment

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

I personally don't like being to restrictive with the platforms, IMHO this should include all the platforms that are supported upstream even if they don't necessarily work (yet) in nixpkgs.

@@ -4,7 +4,7 @@
, libmng, which, mesaSupported, mesa, mesa_glu, openssl, dbus, cups, pkgconfig
, libtiff, glib, icu, mysql, postgresql, sqlite, perl, coreutils, libXi
, buildMultimedia ? stdenv.isLinux, alsaLib, gstreamer, gst_plugins_base
, buildWebkit ? stdenv.isLinux
, buildWebkit ? true
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this now set to true? Seems like a change for any library dependent on qt-4.8. Why not buildWebkit ? stdenv.isLinux | stdenv.isDarwin?

@@ -12,30 +13,26 @@ stdenv.mkDerivation rec {
++ stdenv.lib.optional (!stdenv.isDarwin) alsaLib;

configureFlags = stdenv.lib.optionals stdenv.isDarwin
[ "--build=x86_64" "--without-oss" "--enable-static" "--enable-shared" ];
[ "--disable-mac-universal" ];
Copy link
Member

Choose a reason for hiding this comment

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

Does this flag do any harm when passed into a non-darwin build? I generally try to minimize platform-conditional stuff.

Copy link
Member Author

Choose a reason for hiding this comment

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

it will just appear on stdenv..isDarwin

Copy link
Member

Choose a reason for hiding this comment

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

That's what I mean. Does it need to be conditional at all? Wouldn't a linux build just ignore the flag?

Copy link
Member Author

Choose a reason for hiding this comment

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

The conditional is probably not needed but it will cause a rebuild without it.

Copy link
Member

Choose a reason for hiding this comment

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

I also prefer not to use isDarwin conditionals if not necessary, is the resulting rebuild significant?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, I can change it

@LnL7
Copy link
Member

LnL7 commented Jan 11, 2017

https://gist.github.com/9a33c428ab2748fcba50dd5727600bb4

@matthewbauer
Copy link
Member Author

@LnL7 see 7165b38

@LnL7
Copy link
Member

LnL7 commented Jan 11, 2017

Oh, I'll take a closer look at the error then.

@vbgl
Copy link
Contributor

vbgl commented Jan 12, 2017

gst-plugins-base does not build: ld complains about a missing framework (this is probably unrelated to this PR). After fixing it (patch below), I could build anki, but running it results in SIGSEGV.

OS version: Mac OS X 10.11.6 (15G1212)

--- a/pkgs/development/libraries/gstreamer/legacy/gst-plugins-base/default.nix
+++ b/pkgs/development/libraries/gstreamer/legacy/gst-plugins-base/default.nix
@@ -1,6 +1,7 @@
 { fetchurl, stdenv, pkgconfig, python, gstreamer, xorg, alsaLib, cdparanoia
 , libogg, libtheora, libvorbis, freetype, pango, liboil, glib, cairo, orc
 , libintlOrEmpty
+, darwin
 , # Whether to build no plugins that have external dependencies
   # (except the ALSA plugin).
   minimalDeps ? false
@@ -36,6 +37,8 @@ stdenv.mkDerivation rec {
         liboil ]
     # can't build cdparanoia on darwin
     ++ stdenv.lib.optional (!minimalDeps && !stdenv.isDarwin) cdparanoia
+    ++ stdenv.lib.optional stdenv.isDarwin
+       (with darwin.apple_sdk.frameworks; ApplicationServices)
     ++ libintlOrEmpty;

   NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-lintl";

@LnL7
Copy link
Member

LnL7 commented Jan 12, 2017

@vbgl Are you on the latest master? http://hydra.nixos.org/build/46408265

@vbgl
Copy link
Contributor

vbgl commented Jan 12, 2017

After updating to master, gst-plugins-base indeed builds correctly. But anki still crashes before it starts.

QtWebkit is needed by Anki
- don't use preBuild for patching
- leave all of the tests in place (no tests are run anyway)
@matthewbauer
Copy link
Member Author

@LnL7 Do you know which derivation requires Xcode to be installed? Most likely it is some bogus version check.

@LnL7
Copy link
Member

LnL7 commented Jan 18, 2017

Oh right, forget about that. It's either fixed or I just did something strange when testing.

Copy link
Member

@LnL7 LnL7 left a comment

Choose a reason for hiding this comment

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

testing, I'll merge once it's finished.

@LnL7 LnL7 merged commit 2b0ca8d into NixOS:master Jan 18, 2017
@matthewbauer matthewbauer deleted the anki branch January 19, 2017 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: darwin Running or building packages on Darwin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants