caryll / otfcc

Optimized OpenType builder and inspector.
Apache License 2.0
422 stars 63 forks source link

There seem to be some missing steps for building for Mac. #23

Closed curtisblackwell closed 8 years ago

curtisblackwell commented 8 years ago

So far, it's just installing premake5, but I'm giving up on that for now. Not on homebrew which means it's tedious on El Capitan.

be5invis commented 8 years ago

@curtisblackwell I don’t have a mac because of poverty... So sorry I cannot maintain Homebrew packages. I’ve suggested this to @schriftgestalt, or you can maintain one :)

curtisblackwell commented 8 years ago

I'd be willing to help out with that if I was able to figure out how to get this running. I can't seem to get premake5 working in order to build.

be5invis commented 8 years ago

@curtisblackwell It is simple:

  1. install premake5. There is one in dep/bin-osx/.
  2. cd into the project directory
  3. premake5 xcode4
  4. open the folder “build/xcode” and find the XCode workspace
  5. build in XCode
curtisblackwell commented 8 years ago

So my reason for using otfcc is to customize Iosevka, which requires that everything be runnable via my command line. The problem was that I was trying to put things in the wrong directory on Friday.

I'll look into what it takes to set up a homebrew package later.

anthrotype commented 8 years ago

I usually do this to build the two otfcc* executables from the command line:

$ premake5 xcode4
$ xcodebuild -workspace build/xcode/otfcc.xcworkspace -scheme otfccbuild -configuration Release
$ xcodebuild -workspace build/xcode/otfcc.xcworkspace -scheme otfccdump -configuration Release
anthrotype commented 8 years ago

the output is generated in bin/Release-x64 or bin/Debug-x64 depending on the configuration you passed in.

be5invis commented 8 years ago

@curtisblackwell Leave a comment if your package is published. @anthrotype I'll add this commands to README :)

anthrotype commented 8 years ago

that works for me but I'm not an Xcode expert; maybe somebody else knows a better command for that... /cc @schriftgestalt

be5invis commented 8 years ago

@anthrotype My friend @darkfall also follows this and successfully built the binaries.

schriftgestalt commented 8 years ago

I don’t use the command line to build with Xcode. But the command looks good. But do you need to rebuild the often binaries all the time? You could build it from Xcode and then use them in a script?

be5invis commented 8 years ago

@schriftgestalt For me, my development is done one a PC so I often use the scripts to build them and test. But for users, providing a pre-built package is good enough. Actually I already provide EXEs for Windows, but I do not have the platform to build homebrew packages... Maybe you can help me?

curtisblackwell commented 8 years ago

@anthrotype So the first line works, but the other two just hang. Should they take a long while?

I also realized I didn't finish getting this running and update the instructions or anything for Mac, so I'm reopening until I get it figured out and update the instructions/include a Mac build.

premake5 xcode4
xcodebuild -workspace build/xcode/otfcc.xcworkspace -scheme otfccbuild -configuration Release
xcodebuild -workspace build/xcode/otfcc.xcworkspace -scheme otfccdump -configuration Release
be5invis commented 8 years ago

@curtisblackwell Have you tried to open build/xcode/otfcc.xcworkspace directly with XCode?

anthrotype commented 8 years ago

I also noticed that the xcodebuild command sometimes hangs when running from a fresh checkout. If I then load the generated xcworkspace file in the Xcode.app, and then I simply quit without (apparently) modifying it, if I re-run xcodebuild it does not get stuck this time. I have no idea of that thing works I'm afraid. You should try digging the documentation or look at how other similar homebrew formulas solves this.

be5invis commented 8 years ago

@anthrotype @darkfall does not encountered into such a situation.

schriftgestalt commented 8 years ago

I don’t have time to look into this right now. But you could compare the project.pbxproj file (somewhere inside the workspace bundle) before and after you open it in Xcode.

be5invis commented 8 years ago

@schriftgestalt Yeah, and I can modify the "xcode" plugin to make it work

anthrotype commented 8 years ago
$ git diff --staged
diff --git a/build/xcode/otfcc.xcworkspace/contents.xcworkspacedata b/build/xcode/otfcc.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 0000000..19ac855
--- /dev/null
+++ b/build/xcode/otfcc.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+       version = "1.0">
+       <FileRef
+               location = "group:deps.xcodeproj">
+       </FileRef>
+       <FileRef
+               location = "group:libotfcc.xcodeproj">
+       </FileRef>
+       <FileRef
+               location = "group:otfccdump.xcodeproj">
+       </FileRef>
+       <FileRef
+               location = "group:otfccbuild.xcodeproj">
+       </FileRef>
+</Workspace>
\ No newline at end of file
be5invis commented 8 years ago

@anthrotype Nope, the xcworkspacedata generated in my computer is identical to yours...

be5invis commented 8 years ago

@anthrotype @schriftgestalt I think you should follow this:

  1. Remove build/ and bin/ directory.
  2. Run premake5 xcode4 to produce build/xcode directory.
  3. Rename build/ into build_old/.
  4. Run premake5 xcode4 again.
  5. Open build/xcode/otfcc.xcworkspace with XCode, do nothing, and close.
  6. Compare correspond files between build/ and build_old/.
curtisblackwell commented 8 years ago

So I thought I'd already had Xcode set up properly, but turns out I was wrong. I opened up build/xcode/otfcc.xcworkspace directly as suggested by @be5invis, and clicked build. It asked me if I was sure I wanted to enable Developer Mode. Yes. Then the commands ran successfully.

I need to stop for now and actually get some work done, but so I can come back later and finish this, I'll keep track of the missing steps so far:

  1. Install premake5.
  2. Ensure Xcode's Developer Mode is enabled.
anthrotype commented 8 years ago

Sorry ignore that diff.

OK, I just did what @be5invis suggested and I noticed that the .pbxproj files in the .xcodeproj bundles have no differences. But all of them have a new subfolder called xcuserdata with some extra content:

$ ls -R build/xcode/otfccdump.xcodeproj
project.pbxproj xcuserdata

build/xcode/otfccdump.xcodeproj/xcuserdata:
cosimolupo.xcuserdatad

build/xcode/otfccdump.xcodeproj/xcuserdata/cosimolupo.xcuserdatad:
xcschemes

build/xcode/otfccdump.xcodeproj/xcuserdata/cosimolupo.xcuserdatad/xcschemes:
otfccdump.xcscheme      xcschememanagement.plist

I have no idea what these are for, but they seem to make a difference as to whether xcodebuild runs or gets stuck.

be5invis commented 8 years ago

xcuserdata are, well user data... They should be automatically generated for saving things like scroll bar position... Maybe @curtisblackwell’s report is the true reason

anthrotype commented 8 years ago

No, because Developer Mode is already enabled on my machine

$ DevToolsSecurity -enable 
Developer mode is already enabled.
be5invis commented 8 years ago

@anthrotype I have no idea now... Instructions are now updated to directly open with IDE.

anthrotype commented 8 years ago

have a look at this: https://github.com/nomad/shenzhen/issues/217 it seems related.

anthrotype commented 8 years ago

the problem looks like missing .xcscheme files. Xcode seems to auto-generate them when they are missing.

be5invis commented 8 years ago

I’ve added prebuilt Mac OS binaries to “Releases”.

be5invis commented 8 years ago

@curtisblackwell @anthrotype image

curtisblackwell commented 8 years ago

Thanks @be5invis. I'll give that a go tonight.

be5invis commented 8 years ago

@curtisblackwell Finally @Liam0205 is making a Homebrew package. This issue can be closed. Installation:

brew tap caryll/tap && brew install otfcc-mac64
Liam0205 commented 8 years ago

@curtisblackwell Have you tried this?

be5invis commented 8 years ago

@schriftgestalt @anthrotype Does the brew package work?

moyogo commented 8 years ago

@be5invis the brew package works for me.

curtisblackwell commented 8 years ago

@Liam0205 Sorry for the delayed response, I'm at a conference, so I've been really busy. The brew package does work.

Liam0205 commented 8 years ago

@curtisblackwell It's ok. +@moyogo Glad to know that the brew package works fine, since this was my first time to make one.

anthrotype commented 8 years ago

are you planning to send a pull request to add the formula to https://github.com/Homebrew/homebrew-core?

Liam0205 commented 8 years ago

@anthrotype This is a good suggestion. Semi unfortunately, however, the brew community won’t just add our app to brew, because:

moyogo commented 8 years ago

Homebrew has fontforge, fonttools, woff2, zopfli and probably others so it might be fine once it’s stable.

Liam0205 commented 8 years ago

@moyogo Thanks for your info. Let's look forward to the stable version, then.

anthrotype commented 8 years ago

the brew tap is fine for now. why "otfcc-mac64" and not just "otfcc"? brew is mac-only, and 32 bit is no option nowadays, is it?

anthrotype commented 8 years ago

I just realised the formula simply unzips and installs the pre-compiled binaries for otfccdump and otfccbuild, downloaded from the github releases page. That'll never going to be accepted by hombrew-core I guess.

The formula should be able to compile from source. "Bottles" are automatically generated by homebrew.

premake5 is on homebrew (you need to pass --devel or you get the stable, premake 4). So we should have everything we need to have brew build otfcc from source.