eugmes / fntsample

PDF and PostScript font samples generator (migrating from https://sourceforge.net/projects/fntsample/)
GNU General Public License v3.0
23 stars 4 forks source link

Full build instructions #12

Closed waldyrious closed 4 years ago

waldyrious commented 4 years ago

I've had some trouble building this on a macOS, and thought I'd report the final set of commands I had to run to make it work:

git clone https://github.com/eugmes/fntsample
cd fntsample
brew install cairo fontconfig freetype glib pango
wget --no-check-certificate https://unicode.org/Public/UNIDATA/Blocks.txt
mkdir build
cd build
export CMAKE_INCLUDE_PATH=/usr/local/Cellar/gettext/0.20.1/include
cmake .. -DUNICODE_BLOCKS=../Blocks.txt
make

I'd highlight in particular the need to tell CMake about Homebrew's gettext include path via export CMAKE_INCLUDE_PATH. Without this, CMake was erroring with the following message:

  Failed to find Gettext libintl (missing: Intl_INCLUDE_DIR)

Note that Homebrew does not expose its gettext paths on purpose, to avoid overriding the system ones:

$ brew link gettext
Warning: Refusing to link macOS provided/shadowed software: gettext
If you need to have gettext first in your PATH run:
  echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.zshrc

For compilers to find gettext you may need to set:
  export LDFLAGS="-L/usr/local/opt/gettext/lib"
  export CPPFLAGS="-I/usr/local/opt/gettext/include"

However, CMake doesn't detect the system gettext either...

I would hope that this process could be more streamlined for macOS. In any case, I hope this issue will help others who run into the same problems.

eugmes commented 4 years ago

@waldyrious: thanks fo the report. I'll try to improve the installation instructions.

Please also note that you can use homebrew to install fntsample directly on macOS:

brew install eugmes/fntsample/fntsample

See also: https://github.com/eugmes/homebrew-fntsample

waldyrious commented 4 years ago

Oh, nice! I didn't realize there was already a Homebrew formula. It should definitely be mentioned in the README (especially since it can also be used on Linux).

I have a couple questions:

eugmes commented 4 years ago

I initially developed fntsample on Linux and there libintl is part of libc I think, so it does not need to be installed separately.

It seems that homebrew has special processing for keg-only dependencies, it adjusts various environment variables so those dependencies could be found by cmake: https://github.com/Homebrew/brew/blob/3d9cf83fec45a75af61551f53d25383abe009d31/Library/Homebrew/build.rb#L97