Typo3 can produce graphics on the fly. That's used for example when building graphical menus, thumbnails, etc. But in order to do that, it needs external Unix programs and libraries. We are not going to install prebuilt packages, that may sometimes may incompatible or incomplete. We are going to download the source code of the needed programs, and convert it into an executable binary program. That operation is called compiling. It sometimes takes a lot of time, so don't be surprised. That's a fun part, because you'll see your Macintosh working alone. The installation order is VERY important, because those programs have dependencies. It means that you won't be able to compile a program if one or more others aren't already installed. So respect the installation order of this tutorial.
On Unix platforms, compiling a program is usually done like this:
Download and decompress the source code.
Open a shell.
Gain root privileges.
Cd to the source directory.
Configure the compilation:
./configure [optional params]
Launch the compilation process:
make
Install the files:
make install
After that, when make install is done, you can delete the source directory. If you need to obtain all the parameters which can be used with the configure command, just type ./configure --help, while in the source directory.
1. About
That library isn't needed by Typo3. However, since we are going to recompile PHP in a next chapter, we are going to include it. It's not hard to install, and you'll maybe need it for some web development.
2. Getting the source
The source can be downloaded from the Independent JPEG Group website (http://www.ijg.org/). The version used in this tutorial is JPEG v6b. Be sure to download this version.
3. Compiling
The compilation of Lib JPEG is very easy. As root, just cd to the source directory, then type the following:
cp -f /usr/share/libtool/config.* ./
./configure --enable-static --enable-shared
make
make install
Before launching the configure command, we have copied the config files of libtool to the source directory. Those files are needed to compile the libraries of Lib JPEG on Mac OS X.
The --enable-shared and --enable-static parameters are used to produce the libraries of Lib JPEG as well as the binary files. Those libraries will be used by ImageMagick, for example.
The files produced by the make command will be installed in /usr/local/, which is the default place for most of the third-party libraries and programs.
1. About
Now we are going to install the library used by Typo3 to produce PNG image files. Most of the time, Typo3 prefers to use PNG files, so that library is very important.
2. Getting the source
You can get the source code of libpng from the project homepage (http://www.libpng.org/pub/png/libpng.html). The tested version is 1.2.5.
3. Compiling
Lib PNG provides a lot of makefiles. Each one is for a specific platform. A make file is the script used to compile a program, when you type the make command. In the libpng folder, there is a directory called «scripts». In that directory, you'll find the Mac OS X makefile (makefile.macosx). Just copy that file in the libpng folder, and rename it «makefile».
Before executing the standard compiling process, we need to make some corrections on that makefile. If you try to compile it without the following modifications, you will get an error. The fact is that in the installation process, the script removes the produced files before installing them! So of course, that doesn't work at all. Open the makefile in your favorite text editor, and carefully replace the lines below:
Line: | Correct code: |
|---|---|
12 13 14 15 | ZLIBLIB=/usr/lib ZLIBINC=/usr/include #ZLIBLIB=../zlib #ZLIBINC=../zlib |
24 | LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz |
119 120 121 122 123 124 125 | ln -f -s libpng.3.$(PNGMIN).$(SHAREDLIB_POSTFIX) \ libpng.3.$(SHAREDLIB_POSTFIX); \ ln -f -s libpng.3.$(SHAREDLIB_POSTFIX) libpng.$(SHAREDLIB_POSTFIX); \ ln -f -s $(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX) \ libpng.$(SHAREDLIB_POSTFIX); \ ln -f -s libpng.3.$(PNGMIN).$(SHAREDLIB_POSTFIX) \ libpng.3.$(SHAREDLIB_POSTFIX); \ |
That's for the corrections. Now we've also got to deactivate the following lines by placing a # sign at the beginning:
Line: | Correct code: |
|---|---|
94 95 | #-@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h #-@/bin/rm -f $(DI)/libpng |
102 | #-@/bin/rm -f $(DL)/libpng.a |
108 | #-@/bin/rm -f \ |
110 111 112 113 | #-@/bin/rm -f $(DL)/$(LIBNAME).$(SHAREDLIB_POSTFIX) #-@/bin/rm -f libpng.$(SHARED_POSTFIX) #-@/bin/rm -f libpng.3.$(SHARED_POSTFIX) #-@/bin/rm -f libpng.3.$(PNGMIN)*.$(SHARED_POSTFIX) |
131 132 | #-@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc #-@/bin/rm -f $(DL)/pkgconfig/libpng.pc |
140 141 | #-@/bin/rm -f $(DM)/man3/libpng.3 #-@/bin/rm -f $(DM)/man3/libpngpf.3 |
145 | #-@/bin/rm -f $(DM)/man5/png.5 |
150 151 | #-@/bin/rm -f $(DB)/libpng-config #-@/bin/rm -f $(DB)/$(LIBNAME)-config |
That's all. Now we have a working makefile. There's no configure script, since we've put the OS X makefile in place. So to compile libpng, just type make, then make install.
1. About
The next library adds the support for the TIFF image format. It will be used by Typo3 to produce thumbnails from TIFF files.
2. Getting the source
The source can be downloaded from http://www.libtiff.org/. Tested version is 3.6.1.
3. Compiling
Lib TIFF compiles without problem by using the standard procedure (./configure - make - make install). As usual, the installation directory is /usr/local/.
1. About
Now it's time for the FreeType Library. Like libpng, FreeType is a very important library for Typo3. It is used to generate on the fly graphics with typography. You'll use that to produce dynamic images, menus, buttons, etc...
2. Getting the source
We are going to install the version 2 of FreeType, since the previous version doesn't compile very well on OS X. You can get FreeType2 on the SourceForge website (http://sourceforge.net/projects/freetype). Tested version is FreeType 2.1.9.
3. Compiling
Use the standard procedure to compile FreeType in /usr/local/.
4. Fixing installation
Now we have to correct a FreeType include file in order to use it with other programs. The file is freetype.h and can be found in /usr/local/include/freetype2/freetype/.
You'll need to deactivate the following lines by placing a // sign at the beginning:
Line: | Correct code: |
|---|---|
19 20 21 22 23 24 25 | //#ifndef FT_FREETYPE_H //#error "`ft2build.h' hasn't been included yet!" //#error "Please always use macros to include FreeType header files." //#error "Example:" //#error " #include <ft2build.h>" //#error " #include FT_FREETYPE_H" //#endif |
1. About
GhostScript will add support for Adobe Illustrator (.ai) and PDF files to Typo3.
2. Getting the source
The source for GNU GhostScript can be found on the project homepage (http://www.ghostscript.com/doc/gnu/). Tested version is 7.07.
3. Compiling
Use the standard procedure to compile GhostScript in /usr/local/. You may see some warnings during the compilation process, but it's safe to ignore them.
1. About
Now it's time to install ImageMagick. ImageMagick is a graphic transformation tool. It will use the libraries we just installed to read, write, and manipulate an image in many other image formats.
2. Getting the source
You can get the ImageMagick source from the FTP repository of the project (ftp://ftp.imagemagick.org/pub/ImageMagick/). At this time, the latest version is 6, but you won't be able to use that version with Typo3 (for performance purposes). So, you must download ImageMagick 5. The version we use in this tutorial is 5.5.7-23. Be sure to download to correct one.
3. Compiling
We are going to need the shared libraries of ImageMagick, which aren't installed by default. So use the configure command below:
./configure --enable-shared
Then, just type make and make install. The compilation process of ImageMagick takes some time, so don't worry.