Skip to content

OSX 10.10 Dependencies

Cecil edited this page Sep 16, 2018 · 1 revision

In order to build Shoes for old versions of OSX you need dependent libraries that are properly compiled. This is hard to do if, for example you want to build Shoes for 10.10 from 10.13. The homebrew package manager is not up to that task. Trust me (unless you know how to install multiple homebrews and are willing to figure it out). So, we're going to do something similar to Windows - Build them ourselves. We do that in Linux too if needed.

We can use a VM and install 10.10 (Yosemite) and xCode in the VM and build the libraries and copy them to our 10.13 system where the Shoes build can access them - that's the OLD WAY and certainly usable. We could

OSX is very picky about versions and there are a lot versions to watch out for as a developer. First is the OS - 10.10 or 10.13 for example. Then there is the Xcode version and the SDK version. The Xcode version determines the default compiler output (x86_64-darwin14 for Yosemite and x86_64-darwin17 for High Sierra). Note the word default. Generally you shouldn't mix libraries from one with another.

You can compile down, say from 10.13 to 10.10 as long as you keep all the libraries correct. OSX has Unix roots and there is a /usr/lib in the running system (10.13 for me) and libraries will load from there unless told otherwise. When you install the 10.10 SDK in xCode you can get those "default system libraries".

We also need an easier way to install and manage packages. Homebrew is pretty good but it only works for the running system and doesn't know about building down.

New Way

You do need a OSX 10.10 machine, real or Virtual. You need it to test that everything is OK. Sadly, OSX stamps libruby.dylib with the build machine version numbers so we have to build Ruby on 10.10 or fix the Ruby install scripts. You also need a way to copy files to and from the Virtual Machine. You may also need the VM and ruby to build any gems you want.

Setup 10,10 machine.

Install OSX 10.10.

Get NFS setup first. Change your user-id to match the nfs server so you can write to the server.

Install Xcode and xcode command line tools.

xcode 7.2.1

Install homebrew for some build tools.

I separate Ruby and the other dependent libs for several reasons.

cd 
mkdir -p ~/shoesdeps/src
mkdir -p ~/shoesdeps/10.10-1
mkdir -p ~/extralibs-10-1 

gdbm-1.18

#! /bin/bash
export dest="/Users/ccoupe/shoesdeps/10.10-1"
./configure \
  --enable-shared \
  --enable-libgdbm-compat \
  --without-readline \
  --prefix=${dest}

make and make install. Check that the gdbm dylibs are where you expect them to be.

libffi-3.2.1

#! /bin/bash
# execute it instead of ./configure
export dest="/Users/ccoupe/shoesdeps/10.10-1"
./configure \
  --prefix=${dest}

libyaml-0.1.7

#! /bin/bash
# execute it instead of ./configure
export dest=/Users/ccoupe/shoesdeps/10.10-1
export PKG_CONFIG_PATH="${dest}/lib/pkgconfig"
./configure \
  --enable-shared \
  --prefix="$dest"

openssl-1.0.2

Ruby 2.3.x wants openssl 1.0.2. Known requirement. Ruby does not like Apples openssl. I used 1.0.2k but 'p' also compiles.

./Configure darwin64-x86_64-cc \
 shared zlib-dynamic \
--prefix=/Users/ccoupe/shoesdeps/10.10-1 

Ruby-2.3.7

#! /bin/bash
export dest=/Users/ccoupe/shoesdeps/10.10-1
export CPPFLAGS="-I${dest}/include"
export LDFLAGS="-L${dest}/lib"
export PKG_CONFIG_PATH="/Users/ccoupe/shoesdeps/10.10-1/lib/pkgconfig"
./configure \
  --enable-shared \
  --enable-load-relative \
  --disable-install-doc \
  --without-tk --without-tcllib --without-tcltk \
  --prefix="/Users/ccoupe/shoesdeps/ruby237"

make and make install, of course. Note: This puts ruby, the include files and libs in a different directory than the deps, aka ${dest}

Rubygems-2.7.7

We can test ruby and update the gems at the same time. Untar the rubygems-2.7.7.tgz, cd into it and use the new ruby to run the setup.rb. For me, ../../ruby237/bin/ruby setup.rb --no-doc

extralibs

There are a few 10.10 libraries from Apple that we can't build but we need a copy of them on the build machine. I call these the 'extralibs'. Copy these from /usr/lib on the 10.10 machine:

libbz2.1.0.dylib	        libexpat.1.dylib	        liblzma.5.dylib
libc++.1.dylib		libiconv.2.dylib	        libpcre.0.dylib
libc++abi.dylib		libicucore.A.dylib	libresolv.9.dylib

Move Ruby, it's dependencies and extralibs

If you intend to do most of the work with out having to deal with a VM, then you need to copy Ruby, the deps and the extralibs from the VM to the main Build machine.

Finish the ruby dependencies.

cd 
mkdir -p ~/shoesdeps/src
mkdir -p ~/shoesdeps/10.10-2

Copy the files from the 10.10 VM (if you have one and you should - please). cd shoesdeps cp -R path-to-10.10/ruby237 . mkdir 10.10-2 cp -R path-to-10.10-1/* 10.10-2 cp -R path-to-extralibs/* 10.10-2

You can test it to make sure it's working. 
```sh
ccoupe@mini:~/shoesdeps$ which ruby
/Users/ccoupe/.rvm/rubies/ruby-2.3.7/bin/ruby
ccoupe@mini:~/shoesdeps$ ruby -e "puts RUBY_PLATFORM"
x86_64-darwin17
ccoupe@mini:~/shoesdeps$ ./ruby237/bin/ruby -e "puts RUBY_PLATFORM"
x86_64-darwin14

darwin14 means OSX 10.10. Now we can build everything else with that bit of knowledge. This would be a good time to take a break.

why not use Homebrew for everything?

Homebrew on 10.13 creates x86_64-darwin17 libraries. We want x86_64-darwin14. OSX 10.10 won't run 17, only 14.

How do you know what a library was build with/for?

ccoupe@mini:~/shoesdeps$ otool -l ruby237/lib/libruby.2.3.dylib | grep -A3 LC_VERSION
      cmd LC_VERSION_MIN_MACOSX
  cmdsize 16
  version 10.10
      sdk 10.10

That version field is critical. The sdk may change, as you'll see.

Is it possible to do everything in 10.13 ?

I think so. Consider this configure for Ruby.

#! /bin/bash
export dest="/Users/ccoupe/shoesdeps/10.10-2"
SDK="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk"
export CPPFLAGS="-mmacosx-version-min=10.10 -isysroot ${SDK} -I${dest}/include"
export LDFLAGS="-mmacosx-version-min=10.10 -isysroot ${SDK} -L${dest}/lib"
export PKG_CONFIG_PATH="${dest}/lib/pkgconfig"
export XLDFLAGS='-mmacosx-version-min=10.10'
#export MACOSX_DEPLOYMENT_TARGET=10.10 # doesn't work
./configure \
  --enable-shared \
  --enable-load-relative \
  --build=x86_64-darwin14 \
  --target=x86_64-darwin14 \
  --disable-install-doc \
  --without-tk --without-tcllib --without-tcltk \
  --prefix="/Users/ccoupe/shoesdeps/ruby237-14"

Ruby needs to be built against the 10.10 SDK. (10.11 in the example) and the -isysroot does that. The XLDFLAGS is an undocumented way to get libruby.2.3.0.dylib and all the .bundles stamped as 10.10. The --build and --target are used to set the name of the lib/ruby/2.3.0/x86_64-darwin14/ that contains the .bundle (.so in linux). It does produce a working Shoes for OSX 10.10 (Yosemite)

Don't forget to update rubygems!

How do you build gems with that Ruby on 10.13? That is a very good question. Think about where you'd put them?

bzip2 aka libbz2.dylib

I'm not going to build this. I'll rely on copy we got from 10.10 via extralibs. If you were going to build it, do it know.

xv aka liblzma.dylib

I'm not going to build this. I'll rely on copy we got from 10.10 via extralibs. If you were going to build it, do it know.

libiconv-1.15

DO NOT build libiconv for OSX. Just Don't. Why use the copy from extralibs? Because you'll have to build a bunch of other stuff (in extralibs) that you don't have the source or patience to deal with.

gettext-0.19.8.1

export dest=/Users/ccoupe/shoesdeps/10.10-2
export CPPFLAGS="-mmacosx-version-min=10.10 -I${dest}/include"
export LDFLAGS="-mmacosx-version-min=10.10 -L${dest}/lib"
export PKG_CONFIG_PATH="${dest}/lib/pkgconfig"
./configure \
  --prefix=${dest}

libpng-1.6.35

#! /bin/bash
# execute it instead of ./configure
export dest=/Users/ccoupe/shoesdeps/10.10-2
export CPPFLAGS="-mmacosx-version-min=10.10 -I${dest}/include"
export LDFLAGS="-mmacosx-version-min=10.10 -L${dest}/lib"
./configure \
  --prefix=${dest}

giflib-5.1.4

#! /bin/bash
export dest=/Users/ccoupe/shoesdeps/10.10-2
export CPPFLAGS="-mmacosx-version-min=10.10 -I${dest}/include"
export LDFLAGS="-mmacosx-version-min=10.10 -L${dest}/lib"
./configure \
  --prefix=${dest}

jpeg-8

Don't use jpeg-9. You have been warned.

#! /bin/bash
export dest=/Users/ccoupe/shoesdeps/10.10-2
export CPPFLAGS="-mmacosx-version-min=10.10 -I${dest}/include"
export LDFLAGS="-mmacosx-version-min=10.10 -L${dest}/lib"
./configure \
  --prefix=${dest}

libxml2-2.9.2

#! /bin/bash
# execute it instead of ./configure
export dest=/Users/ccoupe/shoesdeps/10.10-2
export CPPFLAGS="-mmacosx-version-min=10.10 -I${dest}/include"
export LDFLAGS="-mmacosx-version-min=10.10 -L${dest}/lib"
./configure \
  --without-python \
  --prefix=${dest}

glib-2.58.0

#! /bin/bash
# execute this instead of ./configure
export dest=/Users/ccoupe/shoesdeps/10.10-2
export CPPFLAGS="-mmacosx-version-min=10.10 -I${dest}/include"
export LDFLAGS="-mmacosx-version-min=10.10 -L${dest}/lib"
export PKG_CONFIG_PATH="${dest}/lib/pkgconfig"
export LIBFFI_CFLAGS="-I${dest}/lib/libffi-3.2.1/include"
export LIBFFI_LIBS="-L${dest}/lib/ -lffi"
./configure \
  --with-libiconv=native \
      --disable-maintainer-mode \
      --disable-dependency-tracking \
      --disable-silent-rules \
      --disable-dtrace \
      --disable-libelf \
      --enable-static \
  --prefix="${dest}"

This is a fairly recent glib - it's dependency of fairly recent pango and gtk3 and other things.

Note: If you insisted on building libiconv yourself even after be warned not to, the you might want to set '--with-libiconv=gnu` or delete the line and see what happens hours later.

freetype - pass 1

We have to resolve a circular dependency involving freetype, harfbuzz and fontconfig.

#! /bin/bash
# execute it instead of ./configure
export dest=/Users/ccoupe/shoesdeps/10.10-2
export CPPFLAGS="-mmacosx-version-min=10.10 -I${dest}/include"
export LDFLAGS="-mmacosx-version-min=10.10 -L${dest}/lib"
export PKG_CONFIG_PATH="${dest}/lib/pkgconfig"
./configure \
  --with-harfbuzz=no \
  --enable-shared \
  --prefix=${dest}

fontconfig - pass 1

#! /bin/bash
# execute it instead of ./configure
export dest=/Users/ccoupe/shoesdeps/10.10-2
export CPPFLAGS="-mmacosx-version-min=10.10 -I${dest}/include"
export LDFLAGS="-mmacosx-version-min=10.10 -L${dest}/lib"
export PKG_CONFIG_PATH="${dest}/lib/pkgconfig"
#export FREETYPE_CFLAGS="-I${dest}/include/freetype2"
./configure \
  --prefix=${dest}

harfbuzz

#! /bin/bash
# execute it instead of ./configure
export dest=/Users/ccoupe/shoesdeps/10.10-2
export CPPFLAGS="-mmacosx-version-min=10.10 -I${dest}/include"
export LDFLAGS="-mmacosx-version-min=10.10 -L${dest}/lib"
export PKG_CONFIG_PATH="${dest}/lib/pkgconfig"
./configure \
  --prefix=${dest}

freetype - pass 2

#! /bin/bash
# execute it instead of ./configure
export dest=/Users/ccoupe/shoesdeps/10.10-2
export CPPFLAGS="-mmacosx-version-min=10.10 -I${dest}/include"
export LDFLAGS="-mmacosx-version-min=10.10 -L${dest}/lib"
export PKG_CONFIG_PATH="${dest}/lib/pkgconfig"
export BZIP2_LIBS="-L${dest}/lib -lbz2"
export HARFBUZZ_CFLAGS="-I${dest}/include/harfbuzz"
export HARFBUZZ_LIBS="-L${dest}/lib -lharfbuzz -lharfbuzz-subset"
./configure \
  --enable-shared \
  --prefix=${dest}

fontconfig -pass 2

#! /bin/bash
export dest=/Users/ccoupe/shoesdeps/10.10-2
export CPPFLAGS="-mmacosx-version-min=10.10 -I${dest}/include"
export LDFLAGS="-mmacosx-version-min=10.10 -L${dest}/lib"
export PKG_CONFIG_PATH="${dest}/lib/pkgconfig"
#export FREETYPE_CFLAGS="-I${dest}/include/freetype2"
./configure \
  --prefix=${dest}

pixman-0.34.0

#! /bin/bash
export dest=/Users/ccoupe/shoesdeps/10.10-2
export CPPFLAGS="-mmacosx-version-min=10.10 -I${dest}/include"
export LDFLAGS="-mmacosx-version-min=10.10 -L${dest}/lib"
export PKG_CONFIG_PATH="${dest}/lib/pkgconfig"
./configure \
  --prefix=${dest}

This fails linking in tests. We don't need no tests! make install does copy dylibs and .h files and that's all we want. A known bug in osx 10.13 clang - see https://github.com/Homebrew/homebrew-core/blob/master/Formula/pixman.rb https://bugs.freedesktop.org/attachment.cgi?id=137100

cairo-1.15.12

#! /bin/bash
# execute it instead of ./configure
export dest=/Users/ccoupe/shoesdeps/10.10-2
export CPPFLAGS="-mmacosx-version-min=10.10 -I${dest}/include"
export LDFLAGS="-mmacosx-version-min=10.10 -L${dest}/lib"
export PKG_CONFIG_PATH="${dest}/lib/pkgconfig"
./configure \
  --disable-dependency-tracking \
  --enable-gobject=yes \
  --enable-svg=yes \
  --enable-quartz-image \
  --enable-xcb=no \
  --enable-xlib=no \
  --enable-xlib-xrender=no \
  --prefix=${dest}

Note: This a recent cairo.

pango-1.42.4

#! /bin/bash
# execute it instead of ./configure
export PATH="/usr/local/opt/gettext/bin:$PATH"
export dest=/Users/ccoupe/shoesdeps/10.10-2
export CPPFLAGS="-mmacosx-version-min=10.10 -I${dest}/include"
export LDFLAGS="-mmacosx-version-min=10.10 -L${dest}/lib"
export PKG_CONFIG_PATH="${dest}/lib/pkgconfig"
./configure \
  --with-cairo \
  --without-xft \
  --enable-introspection=no \
  --disable-debug --disable-gtk-doc \
  --prefix=${dest}

This one is recent and a pain. Note the use of the PATH setting to get the homebrew installed gettext. See https://github.com/Homebrew/homebrew-core/blob/master/Formula/pango.rb for another viewpoint.

gdk-pixbuf-2.38.0

Sigh... Meson and Ninja see https://github.com/Homebrew/homebrew-core/blob/master/Formula/gdk-pixbuf.rb We need that patch, In ~/shoesdeps/src, do

`brew install meson`
wget https://raw.githubusercontent.com/Homebrew/formula-patches/3d39ffd/gdk-pixbuf/meson-patches.diff
cd gdk-pixbuf-2.38.0
patch -p1 <../meson-patches.diff

For Shoes we need slightly different settings. I configured by running this script (osx-gdk.sh)

#! /bin/bash
export dest=/Users/ccoupe/shoesdeps/10.10-2
export CPPFLAGS="-mmacosx-version-min=10.10 -I${dest}/include"
export LDFLAGS="-mmacosx-version-min=10.10 -L${dest}/lib"
export PKG_CONFIG_PATH="${dest}/lib/pkgconfig"
mkdir -p build
cd build
meson \
 --prefix=${dest} \
 -Dx11=false -Ddocs=false -Dinstalled_tests=false \
 -Dman=false -Dgir=false -Dtiff=false -Drelocatable=false \
 -Dnative_windows_loaders=false
ninja -v

To install, cd build and ninja install

#! /bin/bash
# execute it instead of ./configure
export dest=/Users/ccoupe/shoesdeps/10.10-2
export CPPFLAGS="-mmacosx-version-min=10.10 -I${dest}/include"
export LDFLAGS="-mmacosx-version-min=10.10 -L${dest}/lib"
export PKG_CONFIG_PATH="${dest}/lib/pkgconfig"
./configure \
  --disable-dependency-tracking \
  --disable-gtk-doc-html \
  --disable-Bsymbolic \
  --prefix=${dest}

make and make install

see https://github.com/Homebrew/homebrew-core/blob/master/Formula/librsvg.rb More fun.. brew install rust Our configure script:

#! /bin/bash
# execute it instead of ./configure
export dest=/Users/ccoupe/shoesdeps/10.10-2
export CPPFLAGS="-mmacosx-version-min=10.10 -I${dest}/include"
export LDFLAGS="-mmacosx-version-min=10.10 -L${dest}/lib"
export PKG_CONFIG_PATH="${dest}/lib/pkgconfig"
./configure \
  --disable-dependency-tracking \
  --disable-Bsymbolic \
  --disable-introspection \
  --disable-tools \
  --prefix=${dest}

make will also build a lot of rust dependencies and takes some time. make install

sqlite3

see https://github.com/Homebrew/homebrew-core/blob/master/Formula/sqlite.rb While there are a lot of interesting things that sqlite could be configured with, Shoes uses the defaults. Configure with osx-sql.sh

#! /bin/bash
# execute it instead of ./configure
export dest=/Users/ccoupe/shoesdeps/10.10-2
export CPPFLAGS="-mmacosx-version-min=10.10 -I${dest}/include"
export LDFLAGS="-mmacosx-version-min=10.10 -L${dest}/lib"
export PKG_CONFIG_PATH="${dest}/lib/pkgconfig"
./configure \
  --prefix="$dest"

see https://github.com/Homebrew/homebrew-core/blob/master/Formula/curl.rb Configure with osx-curl.sh

#! /bin/bash
# execute it instead of ./configure
export dest="/usr/local"
export CFLAGS="-I${dest}/include" 
export LDFLAGS="-L${dest}/lib"
./configure \
  --enable-silent-rules \
  --disable-ldap \
  --disable-telnet \
  --disable-tfp \
  --disable-pop3 \
  --disable-imap \
  --disable-smb \
  --disable-smtp \
  --disable-gopher \
  --disable-manual \
  --enable-pthreads \
  --disable-unix-sockets \
  --prefix=${dest}

make and make install

see https://github.com/Homebrew/homebrew-core/blob/master/Formula/fribidi.rb Configure script:

#! /bin/bash
export dest=/Users/ccoupe/shoesdeps/10.10-2
export CPPFLAGS="-mmacosx-version-min=10.10 -I${dest}/include"
export LDFLAGS="-mmacosx-version-min=10.10 -L${dest}/lib"
export PKG_CONFIG_PATH="${dest}/lib/pkgconfig"
./configure \
  --enable-shared \
  --disable-debug \
  --disable-dependency-tracking \
  --prefix="$dest"

make and make install

bzip2-1.0.6

This one is funny/difficult. Most likely, Shoes should NOT include the dylib.

see https://github.com/Homebrew/homebrew-core/blob/master/Formula/bzip2.rb

Extra credit

We could do gtk3. Shoes doesn't use it on osx (yet, if ever, but...). There are more deps, sigh. Note, meson wants to use gobject-introspection (Shoes doesn't use that capability) but we need it to build the deps, so... brew install gobject-introspection

We also need to build gobject-introspection for 10.10 and this causes a problem. We need to do this as a cross compile so the correct python has the correct setup. Extra Credit Indeed.

see https://github.com/Homebrew/homebrew-core/blob/master/Formula/atk.rb Another meson/ninja configure - troublesome.

epoxy

hicolor-icon-theme

gtk3

see https://github.com/Homebrew/homebrew-core/blob/master/Formula/gtk+3.rb

How to test?

Build Shoes and try to run it from the command line. Reasonable error messages will appear if things go wrong. $ rake osx:setup:yosemite $ rake $ .cshoes $ rake clobber is needed to rebuild everything and changes in dependencies and/or gems means everything needs to be rebuilt.

Old Way - VM

Basic Idea:

  • Get 10.10, Xcode and xcode command line tools installed in a VM in Parallels or Oracle's VirtualBox
  • install homebrew for a few dependencies.
  • Compile Ruby and it's dependencies and install into /usr/local.
  • Build Shoes and test it in 10.9 VM. Test that it works in 10.x
  • Copy /usr/local from the VM to a directory that OSX 10.x can build 10.9 from. (Down-version build) Sounds simple. It isn't - way too many ways to do it wrong. I've found them.

OSX 10.10 install in Oracle VirtualBox.

This is a giant pain in the ass! Give yourself 40GB of disk space and a couple of days. Maybe more. Even more time if you want to mount an NFS disk. You might as well create two VM's 'test' and 'develop'. Test doesn't need the NFS stuff or the Xcode install. 20GB is fine for a Test VM.

get an 10.10 iso

I can download the Yosemite installer from the App Store because they know I had Yosemite on the previous machine. (option-click on Purchased). Other people will have to find a pirated iso download - If so then follow their instructions to install it. My situation is different, I'm following these instructions and/or these

As suggested, I had resource busy errors. Using Disk Utility to mount/unmount from Finder worked. The installation into the VM had error messages (pwr management chip) on the boot console but it appears to install.

install xcode and command line tools

This takes longer than installing OSX! Gawd awful slow. You'll need an Apple ID to get it. I have one because I'm using a real Mac.

get NFS or CIFS (samba) working in the VM and host.

It is very helpful (critical?) to get a decent way of moving files between your virtual machine and the VM host or some other system.

get the base set up

Because NFS is so damn slow from a OSX VM I'm going put all the stuff in ~/deps. All the downloaded tar balls and build scripts. I'm going to install into /user/local/ Once everything is working then I'll tar up the important stuff in `/usr/local/ and copy/expand that in the master build accessible directories (nfs mounted). I want to build everything in the VM but I also want to build (cross build) Shoes/OSX 10.9 from OSX 10.x

build zlib-1.2.8

This is the root of many issues. Gem nokogiri won't build without it. OSX 10.9 provides 1.2.5. Because Shoes provides it's own dylib's and otool's them ahead of the system libs we can do this. PITA and I don't trust brew to do the right thing here. And I'm correct about brew.

download, untar it and cd in.

./configure --prefix /usr/local 
make 
make install

verify that it is a x86_64 file /usr/local/lib/libz.1.dylib and otool -L

build openssl-1.0.2d

This takes damn near forever. Download it, untar, cd inside and execute

./Configure darwin64-x86_64-cc --prefix=/usr/local
make 
make install

gdbm

We don't really need this but it doesn't hurt.

#! /bin/bash
# execute it instead of ./configure
export dest="/usr/local"
export CPPFLAGS="-I${dest}/include"
export LDFLAGS="-L${dest}/lib"
./configure \
  --enable-shared \
  --enable-libgdbm-compat \
  --prefix=${dest}

libffi-3.2.1 ??

#! /bin/bash
# execute it instead of ./configure
export dest="/usr/local"
export CPPFLAGS="-I${dest}/include"
export LDFLAGS="-L${dest}/lib"
./configure \
  --prefix=${dest}

libyaml

#! /bin/bash
# execute it instead of ./configure
export dest=/usr/local
export CPPFLAGS="-I${dest}/include"
export LDFLAGS="-L${dest}/lib"
./configure \
  --enable-shared \
  --prefix="$dest"

Ruby build

OSX 10.9 has most of the things we need for a decent Ruby (2.1.7 in this case). By default, it includes Tcl and Tk gems which we don't want.

Building Ruby is not that difficult. Download 2.1.7 (this example). I put the tar ball in ~/deps cd into there. untar it tar -xvf ruby-2.1.7.tar.gz. Create this osx-ruby.sh file in ~/deps

#! /bin/bash
# copy this to the ruby dir or soft link it.
# execute it instead of ./configure
export dest="/usr/local"
export CPPFLAGS="-I${dest}/include"
export LDFLAGS="-L${dest}/lib"
./configure \
  --enable-shared \
  --enable-load-relative \
  --disable-install-doc \
  --with-openssl-dir=/usr/local/opt/openssl \
  --without-tk --without-tcllib --without-tcltk \
  --prefix="${dest}"

Then do the make and if everything looks good to you, sudo make install

We need to get ruby gems updated to something current. So check to make sure your path has /usr/local/bin ahead of everything and ruby -v returns the correct version. We also want to tell gems to not install documentation. Download rubygems (2.4.8) for me. Untar and cd.

`sudo -s`
echo "gem: --no-document" >>/usr/local/etc/gemrc
ruby setup.rb

Exit sudo. (^D)

A note about sudo: (I give myself rw permissions to /usr/local just like brew does) so it might not be required to sudo make install then again, maybe it is. Of course, you'll do a gem -v to verify. 2.4.7 for me (instead of 2.2.5).

Sometimes I need to do sudo chown -R <myname> /usr/local/* where is your account name. Before you go security crazy remember this a VM and all we use if for is building Shoes and possibly only once. Shortcuts are acceptable

Shoes deps.

gettext-0.19.4 aka libintl.8

In this case you get a gettext-latest.lz so we have to expand it with ?? How do you do that? xv.

You might be tempted to brew install gettext because unzipping a tar.lz is a little difficult on Mavericks. That is a bad idea - brew uninstall gettext. Damn kegs.

Create script osx-gettext.sh:

#! /bin/bash
# execute it instead of ./configure
export dest="/usr/local"
export CPPFLAGS="-I${dest}/include"
export LDFLAGS="-L${dest}/lib"
./configure \
  --prefix=${dest}

You might need to install java/javac first.

This probably won't go as well as I've shown here. It might take forever to configure (yes), build (yes) and install (yes). This creates /usr/local/include/libintl.h and /usr/local/lib/libintl.* which is used by damn near everything.

libpng-1.16.16

Easy

#! /bin/bash
# execute it instead of ./configure
export dest=/usr/local
export CPPFLAGS="-I${dest}/include"
export LDFLAGS="-L${dest}/lib"
./configure \
  --prefix=${dest}

Then

cd deps/libpng-1.6.16
../osx-png.sh
make
make install

NOTE: because I have access rights to write in /usr/local/* I don't need to sudo.

BIG NOTE I'm just going to show the configure script until the pattern changes (it will).

jpeg-8d (not 9)

# execute it instead of ./configure
export dest="/usr/local"
export CPPFLAGS="-I${dest}/include"
export LDFLAGS="-L${dest}/lib"
./configure \
  --prefix=${dest}

iconv-1.14

Do not build this on osx. We want to use the one in the system. You may have to rebuild everything if you did build it.

libxml-2.9.2

This one can be trouble. Nokogiri does NOT need libxml2 (it does need libxlst below). So even though I show how to build it you SHOULD NOT unless you have a gem that really, really needs it. Shoes uses /usr/lib/libexpat on OSX for both 10.9 and 10.10 (same version of expat)

#! /bin/bash
# execute it instead of ./configure
export dest="/usr/local"
export CPPFLAGS="-I${dest}/include"
export LDFLAGS="-L${dest}/lib"
./configure \
  --without-python \
  --prefix=${dest}

Note: --without-python means don't create the python bindings. They would be meaningless for this setup.

Remember: you don't need xml2 now so don't build it now.

pkg-config 0.28

Yes we need this. It's surprising I got this far without it. It can depend on glib and glib wants to use pkg-config. To break that cycle, compile pkg-config this way:

#! /bin/bash
# execute it instead of ./configure
export dest="/usr/local"
export CPPFLAGS="-I${dest}/include"
export LDFLAGS="-L${dest}/lib"
./configure \
  --with-internal-glib \
  --prefix=${dest}

glib-2.42.2

Wake up! This one is important and big and confusing. We may have to come back here to do something different. It is essential that you build your own gettext from source - DO NOT use homebrew!

export dest=/usr/local
export CFLAGS="-I${dest}/include"
export LDFLAGS="-L${dest}/lib"
export PKG_CONFIG_PATH="${dest}/lib/pkgconfig"
#export LIBFFI_CFLAGS="-I${dest}/lib/libffi-3.2.1/include"
#export LIBFFI_LIBS="-L${dest}/lib/"
./configure \
  --with-libiconv=native \
  --prefix="${dest}"

--with-libiconv= has three values, 'no','gnu', 'native' and whatever the default is. 'gnu' doesn't work here. 'native' does. default does. No idea if 'no' would work.

Yes, it does take forever to configure. And to build.

yaml-0.14 (may not be needed?)

#! /bin/bash
# execute it instead of ./configure
export dest=/usr/local
./configure \
  --enable-shared \
  --prefix="$dest"

giflib-4.2.3

#! /bin/bash
# execute it instead of ./configure
export dest="/usr/local"
export CPPFLAGS="-I${dest}/include"
export LDFLAGS="-L${dest}/lib"
./configure \
  --prefix=${dest}

Don't worry about the make error in doc.

freetype-2.5.5

#! /bin/bash
# execute it instead of ./configure
export dest="/usr/local/"
export CPPFLAGS="-I${dest}/include"
export LDFLAGS="-L${dest}/lib"
export LIBPNG_CFLAGS="-I ${dest}/include/libpng16"
export LIBPNG_LIBS="-L${dest}/lib -lpng16"
./configure \
  --enable-shared \
  --prefix=${dest}

fontconfig-2.11.1

#! /bin/bash
# execute it instead of ./configure
export dest="/usr/local"
export CPPFLAGS="-I${dest}/include"
export LDFLAGS="-L${dest}/lib"
export PKG_CONFIG_PATH="${dest}/lib/pkgconfig"
export FREETYPE_CFLAGS="-I${dest}/include/freetype2"
./configure \
  --prefix=${dest}

pixman-0.32.6

#! /bin/bash
# execute it instead of ./configure
export dest="/usr/local"
export CPPFLAGS="-I${dest}/include"
export LDFLAGS="-L${dest}/lib"
export PNG_CFLAGS="-I${dest}/include/libpng16"
export PNG_LIBS="-L${dest}/lib -lpng16"
./configure \
  --prefix=${dest}

cairo-1.40.0

See the article [Tower of Cairo] for some hints about cairo. In this case it appears that the configure does pick the quartz backend. So far, no X11 has been dragged in.

#! /bin/bash
# execute it instead of ./configure
export dest="/usr/local"
export CFLAGS="-I${dest}/include"
export LDFLAGS="-L${dest}/lib"
export png_CFLAGS="-I${dest}/include/libpng16"
export png_LIBS="-L${dest}/lib -lpng16"
./configure \
  --enable-xcb=no \
  --enable-xlib=no \
  --enable-xlib-xrender=no \
  --prefix=${dest}

harfbuzz-0.9.38

#! /bin/bash
# execute it instead of ./configure
export dest="/usr/local"
export CPPFLAGS="-I${dest}/include"
export LDFLAGS="-L${dest}/lib"
export PKG_CONFIG_PATH="${dest}/lib/pkgconfig"
export FREETYPE_CFLAGS="-I${dest}/include/freetype2"
./configure \
  --prefix=${dest}

pango-1.38.0

I'm going to try 1.38.0 because it does away with pango-querymodules which has been a pain in the behind since forever.

# execute it instead of ./configure
export dest="/usr/local"
export CPPFLAGS="-I${dest}/include"
export LDFLAGS="-L${dest}/lib"
./configure \
  --with-cairo \
  --without-xft \
  --with-included-modules=yes \
  --disable-debug --disable-gtk-doc \
  --prefix=${dest}

Gems

Shoes includes some binary gems (nokogiri, byebug). Some of these are difficult to cross compile (cough nokogiri) or down-build. Later versions of Shoes 3.2 uses prebuilt gems. These gems are gem install from the command line, and then extracted out that ruby to a place that the shoes build can use them for including into Shoes builds.

For this example I created a ~/deps/gems/ directory and we'll copy our gems from ruby to there and then we'll uninstall that gem(s).

libxlst-1.1.28

Nokogiri needs xslt to build but we do NOT want it to pickup our stuff in /usr/local/include or /usr/local/lib

#! /bin/bash
# execute it instead of ./configure
export dest="/usr/local"
./configure \
  --without-python \
  --prefix=${dest}

We do all this from where we stored the Shoes source code. 'cd ~/Projects/shoes3` for me. All paths in the example below will need to change for some other system (We're still using the 10.9 VM)

$ cd ~/Projects/shoes3
$ gem install nokogiri
$ which ruby
/usr/local/bin/ruby
$ ruby -v
ruby 2.1.7p400 (2015-08-18 revision 51632) [x86_64-darwin13.0]
$ ruby gemutils/extract1gem.rb /usr/local/lib/ruby/gems/2.1.0/specifications/nokogiri-1.6.6.2.gemspec ~/deps/gems/
copy nokogiri-1.6.6.2 from /usr/local/lib/ruby/gems/2.1.0 to /Users/ccoupe/deps/gems/
binary /usr/local/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-13/2.1.0/nokogiri-1.6.6.2/gem.build_complete
Require paths ["/usr/local/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-13/2.1.0/nokogiri-1.6.6.2", "lib"]
weird lib copy 
$ gem uninstall nokogiri
$ gem uninstall mini_portile

libsqlite3

Before we can install the sqlite3 gem we need to build and install the sqlite3.dylib and headers. So untar that sqlite-autoconf-3080500.tar.gz, cd inside and then run the following configure script, make, make install - just like almost everything above.

#! /bin/bash
# execute it instead of ./configure
export dest=/usr/local
export CPPFLAGS="-I${dest}/include"
export LDFLAGS="-L${dest}/lib"
./configure \
  --prefix="$dest"

That's just the /usr/local/lib/libsqlite3.dylib. Now we need to get the ruby gem installed, copied, and removed. Now do the gem install, extract1gem.rb and gem uninstall

rb-readline

I'm not going to show the commands - the only change from the nokogiri example about by gem name and how many gems were dragged in as dependencies. This is a pure ruby gem (or uses existing dylibs. gem install, extract1gem.rb and gem uninstall.

byebug

This one doesn't require building any new external libraries so you can do the gem install, extract1gem.rb and gem uninstall.

mini_portile

Part of nokogiri

columnize

part of byebug

building the Shoes exts and special gems

It's quite possible those gem install/extract1gem/uninstall brought in a newer version so you need to update your mavericks-custom.yaml to reflect any changed version numbers. For instance my mavericks-custom.yaml is:

Deps: /usr/local
Zlib: /usr/local/lib
Gemloc: /Users/ccoupe/Projects/gems/shoes
Extloc: /Users/ccoupe/Projects/gems/shoes
Exts:
  - ftsearch
  - chipmunk
Gems:
  - hpricot
  - sqlite3
InclGems:
  - mini_portile-0.6.2
  - sqlite3
  - columnize-0.9.0
  - nokogiri-1.6.6.2
  - byebug-6.0.2
  - rb-readline-0.5.3
Debug: false
CFLAGS: -DNEW_RADIO

Before you build Shoes you have one more step. Muy importante! rake shoesgems which will compile entries in the Ext: section and the special shoes gems in the Gems section and copy them to that Gemloc: location. The InclGems section is the gems that you want to copy into a new Shoes (so sqlite3 has to be in there too).

Downshift build

Since you have the dependencies for a 10.9 Shoes in /usr/local they could be copied to another system and used for building Shoes without having to do all the hand crafted compiling. Those can also be used to build Shoes/OSX 10.9 from 10.10 or 10.11. It's like a cross compile only it's for an older OS. It works if you have the proper SDK in Xcode. That is what is going to be done for Shoes 3.3. Brew has completely screwed up my 10.10 system so those brew libs can't be used to compile for 10.9. `rake osx:setup:

Librsvg

Shoes 3.3 may have a new widget for dealing with SVG (files, image display) that exposes an API for libsrvg. Of course before we can do that we need to compile librsvg and that's not the easiest task because of it's dependencies. The versions I chose do compile and link on 10.9 but they are not bleeding edge.

gdk-pixbuf 2.30.8

This builds on OSX and so far, it hasn't dragged in gtk.

#! /bin/bash
# execute it instead of ./configure
export dest="/usr/local"
export CPPFLAGS="-I${dest}/include"
export LDFLAGS="-L${dest}/lib"
./configure \
  --without-libtiff \
  --prefix=${dest}

libcroco 0.6

#! /bin/bash
# execute it instead of ./configure
export dest="/usr/local"
export CPPFLAGS="-I${dest}/include"
export LDFLAGS="-L${dest}/lib"
./configure \
  --disable-gtk-doc-html \
  --disable-Bsymbolic \
  --prefix=${dest}

libxml-2.0

Now we have to build it. - See the notes above.

librsvg 2.40.6

# execute it instead of ./configure
export dest="/usr/local"
export CPPFLAGS="-I${dest}/include"
export LDFLAGS="-L${dest}/lib"
./configure \
  --disable-tools \
  --disable-introspection \
  --disable-Bsymbolic \
  --prefix=${dest}

### how to test it

`gem install rsvg` with the Ruby/Gem that we built above. The go look into the gem../exe/rsvg2/rsvg2.bundle and make sure all the links are to our libraries.
If tiff is a problem later we'll have to build it later.
Clone this wiki locally