How to build fontforge with other libraries (ie. libpng)?

Mike Anderson
Mike Anderson Posts: 16
edited December 2013 in Type Design Software
I am trying to build fontforge from source on Mac OS X Snow Leopard. I got the latest source from here: http://sourceforge.net/projects/fontforge/files/fontforge-source/ I DO NOT want to use homebrew! I repeat DO NOT! cuz I want to have fontforge install to a different location than /usr/local/Cellar/fontforge/20120731/ i want it to install to /fontforge/ and I can do this when I compile like this:

In Terminal under the fontforge src directory "fontforge-20120731-b" I type:

./configure --prefix=/fontforge --with-freetype-src=/freetype

followed by:

make

and finally:

make install

AND THAT ALL WORKS! BUT HERE'S MY PROBLEM!

when I run fontforge and try to open a woff file, it says
"This version of fontforge cannot handle WOFF files. You need to recompile it with libpng and zlib"

now what the heck does that mean EXACTLY?? like I downloaded the sources for libpng-1.6.7 and zlib-1.2.8, unzipped them and placed the folders in the fontforge source folder and tried to recompile fontforge using the same commands above but it didnt create the necessary libraries (libpng.dylib, etc) so im guessing I have to add something to the configure command to tell it where the libpng and zlib sources are located? am i right? something like this (except this doesnt work, it was just a guess):

./configure --prefix=/fontforge --with-freetype-src=/freetype --with-libpng-src=/libpng

so how exactly am i supposed to do this?

your help is much appreciated thank you!

Comments

  • Dave Crossland
    Dave Crossland Posts: 1,429
    edited December 2013
    I don't recommend using that source release, its a year and a half old.

    Why not link the brew directory to where you want it?
    sudo ln -s /usr/local/Cellar/fontforge/20120731 /fontforge
  • Well I'd like to make it portable but the fontforge binary created by homebrew looks for the required libraries in that path u mentioned or around it. And u can't change that: I tried hex editing the binary to change the paths but I just got some Mach-o malfunction errors when trying to run it. So I have to build it from the ground up.
    So does anyone have experience on how to do this with adding libpng etc to the build? I don't understand why there isn't any documentation on this specifically and believe me I googled enough lol!
  • What do you mean, 'make it portable'?
  • Hmm maybe wrong word. I mean if I shared this build with a friend he/she could just copy over the folder 'fontforge' to the root of his Mac drive and run it no problems. The path brew makes is too long and complicated. Many subfolders. is it possible to build fontforge with all libraries including libpng etc and have them all in ONE folder? Cuz it would be nice if it doesn't have to start looking elsewhere for these req files when they can all be under one directory. I believe fontforge on windows works this way. fontforge.exe will run perfectly with all files it needs (ie the library dlls etc) all from one folder. That's nice and simple. that's why I used the word portable cuz it is in a way :) and it's convenient to not have to rebuild it again if I have to reinstall my Mac or move to another one.
  • Dave Crossland
    Dave Crossland Posts: 1,429
    edited December 2013
    Oh I see! You want http://fontforge.github.io/en-US/downloads/mac/

    Since your initial post was about compiling when you say portable, I figured you were meaning http://en.wikipedia.org/wiki/Software_portability and trying to run fontforge on some exotic processor by crosscompiling it on a Mac.
  • Thx Dave I'll check it out! But I am still curious how to build fontforge myself with these extra libraries like libpng. It's just nice to know and gives me more flexiblity. Hopefully someone else might be able to answer this. What commands in bash would I execute to build fontforge with libpng and/or other libraries it supports.
  • Compiling FF on os x is tricky, and homebrew makes it easy.

    If you want to do it by hand, you need to set up your environment the way homebrew does. So you need to set your shell environment variables. These are detailed in the configure help:

    https://gist.github.com/davelab6/8d8327c5de9167474f96
  • I saw this configure help file before. It only says the opposite of what I want: --without-libpng
    I need --with-libpng or like freetype --with-libpng-source[=DIR]

    So how do I specify where my libpng source files are? Or I mean I can build libpng separately and then point to the compiled libpng library whatever.
    What about --x-libraries=DIR??

    Still need to know the command line for this please, thank you!


  • Riiiight... I'm kind of a noob at this but I see you won't help me any further. Thx anyway.
    Where is George Williams btw? Doesn't he have an email or something? I hope I can get a direct answer from him.
  • Dave Crossland
    Dave Crossland Posts: 1,429
    edited December 2013
    He quit the project 3 years ago and won't answer emails about it.

    I am trying to help you. You might have better luck on the actual fontforge-devel mailing list, though.

    I don't know the exact commands you need, and when you say -
    I am still curious how to build fontforge myself with these extra libraries like libpng. It's just nice to know and gives me more flexiblity.
    - then I'm pointing you in the direction you need to go to follow your curiosity.

    I've sent substantial amounts of my own money to make a mac bundle that you can easily share with your friends, and substantial amounts of my own free time making the web site with straightforward installation instructions that anyone with basic computer literacy can follow. If you want to learn how to compile software, you are starting to learn professional software development, and expecting folks to hand hold you is counterproductive to your own learning.

    I recommend reading www.catb.org/~esr/faqs/smart-questions.html :)
  • Do your instructions explain how to compile fontforge with libpng and zlib? I don't think so.
    I have more than basic computer literacy thank you.
    Anyway thanks for your feedbacks I just wish someone else on this site would post here too with what I'm looking for.
  • George Thomas
    George Thomas Posts: 645
    edited December 2013
    .
  • your best bet, honestly, is to use homebrew, but to create a custom version of fontforge.rb which replaces {prefix}, {opt-prefix}, ... with wherever you want fontforge to live.

    the ruby formula is basically answering your question, but in its own domain specific language, it's showing how all the automake configuration options are set, i.e. -I/usr/lib but it saves you the burden of dealing with all the dependency management and command line-fu.

    if your goal is to share this with somebody so they don't have to go through the hassle of running xcode-select --install and then installing homebrew and running your custom fork, it's probably a better use of your time to gift them a copy of glyphs mini (just in time for the holidays). but ultimately, the purpose of homebrew is to make installing something as complex as fontforge easy. why fight it?

    the reason your custom build of fontforge is failing is that your version of libpng and zlib aren't being found in your standard search paths, that's what these options set.

    i'm sorry if this is an unsatisfying response, but it's the best i can offer.