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

pinentry_mac: use xcbuild #24838

Merged
merged 15 commits into from Apr 13, 2017
Merged

pinentry_mac: use xcbuild #24838

merged 15 commits into from Apr 13, 2017

Conversation

matthewbauer
Copy link
Member

@matthewbauer matthewbauer commented Apr 12, 2017

Motivation for this change

This switches pinentry_mac over to xcbuild.

Sadly, pinentry_mac does not work out of the box. I've had to make a few changes for it to compile:

This PR adds a couple of new packages too:

Each of these packages needs some changes to get working from MSVSC to NixPkgs, so I'm going to try to work to get those changes include so we have legitimate versioning.

I'll try to clean this PR up in the coming, but right now it works as is.

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, @globin, @pSub and @FRidh to be potential reviewers.

@copumpkin
Copy link
Member

Whoa, you figured out where to get a pure ibtool-equivalent??

@matthewbauer
Copy link
Member Author

@copumpkin Microsoft has tool inside of WinObjC called xib2nib. I've moved it to a separate repo and got it running on *nix systems. Then I made a bash wrapper that fakes ibtool options and passes them to xib2nib. That means there are some parts of ibtool that it doesn't actually implement. In addition xib2nib has spotty support for some nib files especially older ones (like in pinentry_mac). So after some modifications pinentry_mac is able to work with it.

Copy link
Member

@copumpkin copumpkin left a comment

Choose a reason for hiding this comment

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

Awesome. Anyway, I'm fine with merging this but if you want to do more work to it first, that's also fine.

@matthewbauer matthewbauer changed the title pinentry_mac: use xcbuild [wip] pinentry_mac: use xcbuild Apr 12, 2017
@matthewbauer
Copy link
Member Author

matthewbauer commented Apr 12, 2017

Ok even though it builds correctly, something weird is going on with the .nib file. I'm marking it [wip] for right now.

@LnL7 LnL7 added the 6.topic: darwin Running or building packages on Darwin label Apr 12, 2017
sadly, xib2nib hasn't been working like i though. I've just
precompiled into our modified pinentry_mac. Eventually we can get this
fixed but it's not as easy as first thought.
also:
- NSPlist
- PlistCpp
@matthewbauer matthewbauer changed the title [wip] pinentry_mac: use xcbuild pinentry_mac: use xcbuild Apr 13, 2017
@matthewbauer
Copy link
Member Author

matthewbauer commented Apr 13, 2017

Looks good to me if no one has anything to fix.

Some notes on xib2nib:

  • it only supports "CocoaTouch" layouts and storyboards not "Cocoa"
  • we can get it working eventually, but there isn't much documentation on Cocoa layouts
  • the IBCocoa .nib format seems to be a nskeyedarchive but I don't know how to extract it without a defined struct

@copumpkin
Copy link
Member

copumpkin commented Apr 13, 2017 via email

@matthewbauer
Copy link
Member Author

@copumpkin So, I'm cheating now and just compiling them in Xcode and checking them into the pienntry_mac tree. I want to keep xib2nib in here though because eventually it should be useful.

@copumpkin
Copy link
Member

Oh, I see. That works for now I guess 😄 so the xib2nib tool isn't actually used here?

@copumpkin
Copy link
Member

Also, is converting xib files to nib files the only thing builds generally need to do? I've done a lot of reverse engineering and we could probably revive https://github.com/davidquesada/ibtool without much effort.

@matthewbauer
Copy link
Member Author

matthewbauer commented Apr 13, 2017

I'd say that converting xib to nib is the main thing. Storyboards may also be includes and they're basically just a wrapper around a bunch of .xib's. That part involves linking and compiling but that shouldn't be a big deal.

You're going to have the same problem with ibtool.py though where it just works with CocoaTouch. I've been looking at the format of .nib's and it's not very well documented. They look like they're just binary plists encoded as nskeyedarchive.

@copumpkin
Copy link
Member

What's the main difference between CocoaTouch and Cocoa for this? Is it just that there's a bigger RE community around iOS?

@matthewbauer
Copy link
Member Author

matthewbauer commented Apr 13, 2017

Probably because iOS is more locked down and stuff so you can't use some other layout tools like in gtk or qt. Also Cocoa has a lot more features that need to be included to work while CocoaTouch has relatively less. Even for CocoaTouch I don't think it works with 100% of layouts.

@copumpkin
Copy link
Member

I just took a peek at the "source" for ibtool and there really isn't that much of it... 😄 and it doesn't seem to link to external libraries or pull in external files (as far as I've been able to tell yet)

Anyway, this seems fine and promising. I'll look into ibtool a bit more later. Feel free to drop by IRC, too!

@copumpkin
Copy link
Member

Aha, ibtoold is what contains the meat of the logic

@copumpkin
Copy link
Member

Aha, InterfaceBuilderKit.framework is yuuuge! This is going to be interesting 😄

@copumpkin copumpkin merged commit f21a694 into NixOS:master Apr 13, 2017
@copumpkin
Copy link
Member

Merging this since my random banter has no bearing on any of this stuff.

@copumpkin
Copy link
Member

@matthewbauer have you looked at gorm at all, from GNUstep? It looks like it understands nibs and xibs, but it might not understand the cocoa stuff

@matthewbauer
Copy link
Member Author

matthewbauer commented Apr 13, 2017

@copumpkin

I don't think gorm supports the .xib format. Apple just added it in Xcode 5 to support version control that didn't like changes to binary files. You're right that it's probably not too complicated and somebody with some RE skills like yourself or others could probably get it working but looking at xib2nib source, it's definitely not going to be too easy.

We actually have gorm in nixpkgs but it looks like it's broken right now on darwin at least.

I don't know if you've got any connections at Apple but maybe if we beg we can get them to open source ibtool? It definitely doesn't have a lot of applications for the average user but it certainly would make this whole thing easier. I suspect, however, that it would be impossible to open source ibtool without open sourcing the whole Cocoa framework and interface builder which is understandably closed source.

Also: do you know what's going on with Hydra? pinentry_mac isn't building for some reason but I can't get any logs on it. They're all in some non-text format. Maybe gzip?

https://lists.gnu.org/archive/html/gnustep-dev/2013-08/msg00078.html
http://wiki.gnustep.org/index.php/XIB

@matthewbauer matthewbauer deleted the ibtool branch April 13, 2017 17:46
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

5 participants