extrawurst's blog

Homebrew contribution

• general and osx

I recently made my first homebrew contribution. homebrew is a package manager for osx much like yum/apt-get and the like you know from linux systems. Since this may not be the last time I did this or have to do this I will elaborate what the workflow was. This may help me remember and others get a grip how to do that the first time.

I am using the freeimage library in lot of my projects and since it turned out to be pretty hairy to build this lib on osx by hand I tried to find it in homebrew.

Indeed homebrew has a formular for it: freeimage on homebrew

Updating a formular

Unfortunately the freeimage formular was a bit dated and just supported version 3.16.0.

Since I needed the most recent version I opened a ticket for version 3.17.0 on github: issue #41609.

@bfontaine suggested to do the update myself ;)

After looking into the formular of this version I tried to apply the patches to the src-download of freeimage by hand and found it working.

So the update was pretty streight forward using the instructions for getting a pull request merged for homebrew.

In the case of the freeimage update there were essentially four changes:

Updating the file hash

Here it got a little tricky, since the sourceforge download info just provided md5 or sha1 hashes. A little googling later I had a working shell line to create the file hash in sha256:

shasum -a 256 FreeImage3170.zip

Update the patching

This was the most work since the old patch did not work anymore because the makefiles of freeimage changed from 3.16.0 to 3.17.0. So I created a copy of the targeted makefiles and applied the patches by hand and created the diff using git:

git diff Makefile.gnu p.Makefile.gnu > patch.diff

TL;DR - The pull request

freeimage formular diff

So the final change that got merged into homebrew to update the freeimage formular: pull request #41619

comments powered by Disqus