How to Build GD on Mac OS X ? I have been trying to get the Smart Image Processor extension to work. Does anyone know where the GD library is supposed to go? I keep getting an error (GD Library not installed correctly).
This is extra complimentary content which purpose is to show additional usage that is not part of the product, i.e. it suggests tips for extending the functionality of the product by the users themselves. It is provided "as is", without warranty of any kind, express or implied , including but not limited to the warranties of merchantability, fitness for a particular purpose and nonfringement of third party rights.
DMXzone does not take responsibility to support the suggested content to be fully compatible and working as intended and does not provide support for extended functionality which is not included in the current release of the extension.
It is highly recommended that only more advanced developers use it.
GD is a set of utilities for creating and manipulating JPEG and PNG images, as well as libraries for adding graphics support in particular PHP. Smart Image Proccessor supports these libraries. The compile requires a couple of additional libraries to be installed first.
Create a temporary directory to build the libraries that GD requires, as well as GD itself. Also create the install directories since they may not yet exist.
sudo mkdir -p /usr/local/share/man /usr/local/include /usr/local/bin /usr/local/lib
Building the required libraries
For JPEG images support, the jpeg-6b libraries need to be installed. Smart Image Proccessor can not function without them. Aside from relocating the man pages to the place where we expect them on Mac OS X, no changes are required.
Download and build the latest jpeg libraries:
curl -O ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz
gnutar -xzf jpegsrc.v6b.tar.gz
sudo make install mandir="/usr/local/share/man"
sudo make install-lib
sudo ranlib /usr/local/lib/libjpeg.a
For manipulating PNG files, the libpng code needs to be compiled. For the Smart Image Proccessor this part is not required, only if you want to support PNG files for resize. After resize the image gets always converted to a JPEG
Download and build the latest png libraries:
curl -O http://www.libpng.org/pub/png/src/libpng-1.2.5.tar.gz
gnutar -xzf libpng-1.2.5.tar.gz
cp scripts/makefile.macosx ./Makefile
perl -i.pre -p -e 's/-current_version \$\(PNGVER\)//g' Makefile
make zlibinc="/usr/lib" zliblib="/usr/lib"
sudo make install
sudo ranlib /usr/local/lib/libpng.a
GD also requires the zlib library, but Apple this one is supplied with Mac OS X.
After completing the above steps, the actual GD source can be compiled. Because we don’t want to change the Makefile, the correct value for the COMPILER variable is passed. This will cause a couple of errors at the end of this compile, complaining about missing X-Windows directories. They aren't required, and it’s is nothing to worry about.
This will install the GD applications (webpng, pngtogd and a bunch of others) as well as the libraries that allow other applications to use GD functionality.
Download and build the latest GD:
curl -O http://www.boutell.com/gd/http/gd-1.8.4.tar.gz
gnutar -xzf gd-1.8.4.tar.gz
sudo make install
sudo ranlib /usr/local/lib/libgd.a
There will be a warning about no symbols in the library, but that's something that can be safely ignored.
You are now ready to add GD support to PHP!