Dale Walsh hat eine aktualisierte Installations-Anleitung geschrieben, das PHP5 und eine informativere gd_info() Routine enthält.
Einleitung und Vorbereitungen
Dieses Dokument erklärt (in der Ausdrucksweise, im Gegensatz zu anderen HOWTOs, etwas hochmütigem Ton) Schritt für Schritt das Erzeugen von GD 2.0.28 aus den Sourcen. Dieses HOWTO setzt allerdings weit mehr als nur Grundkenntnisse der Mac OS X Terminal Applikation und Unix Kommandozeile voraus.
Ausserdem, und das sollte selbstverständlich sein, müssen zwingend die Mac OS X Developer Tools installiert sein. Es ist eine exzellente Idee, immer die aktuellste Version einzusetzen, welche auf Apple”s ADC-Seite verfügbar ist.
Ich kann nicht jede mögliche Systemumgebung voraussehen (und ich bin sicher, irgendeine kritische Annahme übersehen zu haben). Einige dieser Bibliotheken benötigen «GNU make” für die Installation. Überprüfen Sie Ihre Version mit make --version
; falls es nicht ”GNU make” sein sollte, müssen Sie im Folgenden gnumake
systematisch durch make
ersetzen.
Das primäre Lernziel dieser Bemühung war, GD4O (GD für OCaml) zu kompilieren, was ich auch tat.
Das Arbeits-Verzeichnis einrichten
% mkdir /SourceCache/
% mkdir /SourceCache/apache_mod_php/
% mkdir /SourceCache/apache_mod_php/apache_mod_php-12/
% cd /SourceCache/apache_mod_php/apache_mod_php-12/
dlcompat
bereits auf Ihrem System installiert ist. Wenn Sie mit Panther (Mac OS X 10.3) arbeiten, ist dlcompat
bereits vorinstalliert (in /usr/lib/libdl.dylib
). Sollte dies nicht der Fall sein, überprüfen Sie zuerst, ob die Datei sonst irgendwo installiert ist, indem Sie im Terminal folgendes eintippen:
% gcc -ldl
ld: Undefined symbols:
_main
”ld: can”t locate file for: -ldl”
ausgibt, lesen Sie hier weiter.dlcompat
ist ein Teil des Fink-Projekts, das Unterstützung für die Linux-eigene Methode des dynamischen Ladens von Bibliotheken in Mac OS X zur Verfügung stellt.
% curl -O http://optusnet.dl.sourceforge.net/sourceforge/fink/dlcompat-20030629.tar.gz
% tar zxvf dlcompat-20030629.tar.gz
dlcompat
Quell-Verzeichnis (dort gibt es eine Reihe von ausschliesslich gross geschriebenen Dateien wie README, die so aussehen, als sollte man Sie lesen) und konfigurieren Sie das Paket; dann kompilieren und installieren Sie es:
% cd dlcompat-20030629
% ./configure; make; sudo make install
% cd /SourceCache/apache_mod_php/apache_mod_php-12/
% md5 php-4.3.9.tar.gz
% ls *.gz | xargs -n 1 tar zxvf
% ls *.bz2 | xargs -n 1 tar jxvf
% cd curl
% ./configure --prefix=/usr; make; sudo make install
% cd ../expat
% ./configure --prefix=/usr --mandir=/usr/share/man; make; sudo make install
% cd ../zlib
% ./configure; make; sudo make install
makefile.darwin
aus dem Ordner ”scripts” in das libpng
Installations-Verzeichnis:
% cd ../libpng
% cp scripts/makefile.darwin ./Makefile
% make; sudo make install
GNU libtool
als die, welche im libjpeg
Paket enthalten ist. Glücklicherweise verfügt GD über eine kompatible Version, die wir verwenden können. Um sie zu erhalten, müssen wir GD konfigurieren:
% cd ../gd
% ./configure
libtool
ins jpeg-Verzeichnis:
% cp libtool ../jpeg
% cd ../jpeg
% ./configure --enable-shared
% make; sudo make install
% cd ../freetype
include/freetype/config/ftoption.h
wie folgt:
#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER
/* #define TT_CONFIG_OPTION_UNPATENTED_HINTING */
% ./configure; make; sudo make install
% cd ../gd
% ./configure; make; sudo make install
configure
berichten, dass GD PNG, JPEG und FreeType unterstützen wird:
** Configuration summary for gd:
Support for PNG library: yes
Support for JPEG library: yes
Support for Freetype 2.x library: yes
Support for Xpm library: yes
Support for pthreads: yes
configure
aus, dann kompilieren und installieren Sie es:
% cd ../php
% ./configure --mandir=/usr/share/man --infodir=/usr/share/info --sysconfdir=/etc --with-freetype-dir=/usr/local --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-tiff-dir=/usr/local --with-zlib-dir=/usr --enable-cgi --enable-cli --enable-dbx --enable-exif --enable-ftp --enable-mbstring --enable-sockets --enable-trans-sid --enable-wddx --with-apxs --with-curl --with-expat --with-gd --with-iodbc --with-kerberos --with-ldap --with-mysql --with-openssl --with-xml --with-xmlrpc
% make; make install
configure
, wenn Sie Apples bestehende PHP-Version durch Ihre eigene ersetzen möchten:
% /SourceCache/apache_mod_php/apache_mod_php-12/php/configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --sysconfdir=/etc --with-freetype-dir=/usr/local --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-tiff-dir=/usr/local --with-zlib-dir=/usr --enable-cgi --enable-cli --enable-dbx --enable-exif --enable-ftp --enable-mbstring --enable-sockets --enable-trans-sid --enable-wddx --with-apxs --with-curl --with-expat --with-gd --with-iodbc --with-kerberos --with-ldap --with-mysql --with-openssl --with-xml --with-xmlrpc
% ./configure --mandir=/usr/share/man --infodir=/usr/share/info --sysconfdir=/etc --with-freetype-dir=/usr/local --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-tiff-dir=/usr/local --with-zlib-dir=/usr --enable-cgi --enable-cli --enable-dbx --enable-exif --enable-ftp --enable-mbstring --enable-sockets --enable-trans-sid --enable-wddx --enable-xslt --with-apxs --with-curl --with-expat --with-gd --with-iodbc --with-kerberos --with-ldap --with-mysql --with-openssl --with-xml --with-xmlrp
% make; make install
configure
, wenn Sie Apples bestehende PHP-Version durch PHP5 ersetzen möchten:
% /SourceCache/apache_mod_php/apache_mod_php-12/php/configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --sysconfdir=/etc --with-freetype-dir=/usr/local --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-tiff-dir=/usr/local --with-zlib-dir=/usr --enable-cgi --enable-cli --enable-dbx --enable-exif --enable-ftp --enable-mbstring --enable-sockets --enable-trans-sid --enable-wddx --enable-xslt --with-apxs --with-curl --with-expat --with-gd --with-iodbc --with-kerberos --with-ldap --with-mysql --with-openssl --with-xml --with-xmlrp
httpd.conf
alle Verweise zu PHP4
% sudo pico /etc/httpd/httpd.conf
% sudo rm /usr/libexec/httpd/libphp4.so
annotate
, mit dem Text über JPEG-Bilder gelegt werden kann. Damit können wir unsere Installation testen. Die libjpeg
beinhaltet das traditionelle Rosen-JPEG zu Testzwecken. Sie brauchen dazu nur eine TrueType-Schrift, die von freetype2
gelesen werden kann (Mac OS X .dfont”s können leider nicht verwendet werden): Windows- oder X-Windows .TTF-Schriften funktionieren prächtig. Holen Sie sich eine davon und kopieren Sie es in Ihr Benutzerverzeichnis nach ~/Library/Fonts (oder wohin auch immer).
% cd ..
annotate.cmd
mit folgendem Inhalt (ändern Sie den Schrift-Pfad entsprechend):
/Users/shortname/Library/Fonts/FONT.TTF
move 113 75
align center
color 63 63 255
size 40
text Mac OS X
annotate jpeg/testimg.jpg ./annotated.jpg
% rm -rf annotate.cmd annotated.jpg dlcompat/ freetype/ expat/ php/ gd/ jpeg/ libpng/ zlib/
% cd /SourceCache/apache_mod_php/apache_mod_php-12/
% rm -r *.gz
ext/gd/gd.c
,
”#define PHP_GD_VERSION_STRING ”bundled”
”modified”
PHP_FUNCTION(gd_info)
Routine durch unsere neue ersetzen (es gibt eine für GD 2.0.23 oder GD 2.0.28).
PHP_FUNCTION(gd_info)
{
char *gd_uname;
if (ZEND_NUM_ARGS() != 0) {
ZEND_WRONG_PARAM_COUNT();
RETURN_FALSE;
}
gd_uname = php_get_uname(”a”);
PUTS(”n”);
PUTS(””);
PUTS(”n”);
php_info_print_style(TSRMLS_C);
PUTS(”gd_info()”);
PUTS(”n”);
PUTS(”n”);
php_info_print_box_start(1);
php_printf(”GD Version %sn”, PHP_GD_VERSION_STRING);
php_info_print_box_end();
php_info_print_table_start();
php_info_print_table_row(2, ”System”, gd_uname );
php_info_print_table_row(2, ”GD Version”, PHP_GD_VERSION_STRING);
#ifdef ENABLE_GD_TTF
php_info_print_table_row(2, ”FreeType Support”, ”enabled”);
#if HAVE_LIBFREETYPE
php_info_print_table_row(2, ”FreeType Linkage”, ”with freetype”);
#elif HAVE_LIBTTF
php_info_print_table_row(2, ”FreeType Linkage”, ”with TTF library”);
#else
php_info_print_table_row(2, ”FreeType Linkage”, ”with unknown library”);
#endif
#else
php_info_print_table_row(2, ”FreeType Support”, ”disabled”);
#endif
#ifdef HAVE_LIBT1
php_info_print_table_row(2, ”T1Lib Support”, ”enabled”);
#else
php_info_print_table_row(2, ”T1Lib Support”, ”disabled”);
#endif
#ifdef HAVE_GD_GIF_READ
php_info_print_table_row(2, ”GIF Read Support”, ”enabled”);
#else
php_info_print_table_row(2, ”GIF Read Support”, ”disabled”);
#endif
#ifdef HAVE_GD_GIF_CREATE
php_info_print_table_row(2, ”GIF Create Support”, ”enabled”);
#else
php_info_print_table_row(2, ”GIF Create Support”, ”disabled”);
#endif
#ifdef HAVE_GD_JPG
php_info_print_table_row(2, ”JPG Support”, ”enabled”);
#else
php_info_print_table_row(2, ”JPG Support”, ”disabled”);
#endif
#ifdef HAVE_GD_PNG
php_info_print_table_row(2, ”PNG Support”, ”enabled”);
#else
php_info_print_table_row(2, ”PNG Support”, ”disabled”);
#endif
#ifdef HAVE_GD_WBMP
php_info_print_table_row(2, ”WBMP Support”, ”enabled”);
#else
php_info_print_table_row(2, ”WBMP Support”, ”disabled”);
#endif
#ifdef HAVE_GD_XBM
php_info_print_table_row(2, ”XBM Support”, ”enabled”);
#else
php_info_print_table_row(2, ”XBM Support”, ”enabled”);
#endif
#if defined(USE_GD_JISX0208) && defined(HAVE_GD_BUNDLED)
php_info_print_table_row(2, ”JIS-mapped Japanese Font Support”, ”enabled”);
#else
php_info_print_table_row(2, ”JIS-mapped Japanese Font Support”, ”disabled”);
#endif
php_info_print_table_end();
PUTS(”GD Copyrightn”);
php_info_print_box_start(0);
PUTS(”COPYRIGHT STATEMENT FOLLOWS THIS LINEnn”);
PUTS(”Portions copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 by Cold Spring Harbor Laboratory. Funded under Grant P41-RR02188 by the National Institutes of Health.
n”);
PUTS(”Portions copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 by Boutell.Com, Inc.
n”);
PUTS(”Portions relating to GD2 format copyright 1999, 2000, 2001, 2002, 2003, 2004 Philip Warner.
n”);
PUTS(”Portions relating to PNG copyright 1999, 2000, 2001, 2002, 2003, 2004 Greg Roelofs.
n”);
PUTS(”Portions relating to gd.c copyright 2003, 2004 Dale Walsh (Diese E-Mail-Adresse ist vor Spambots geschützt! Zur Anzeige muss JavaScript eingeschaltet sein!).
n”);
PUTS(”Portions relating to gdttf.c copyright 1999, 2000, 2001, 2002, 2003, 2004 John Ellson (Diese E-Mail-Adresse ist vor Spambots geschützt! Zur Anzeige muss JavaScript eingeschaltet sein!).
n”);
PUTS(”Portions relating to gdft.c copyright 2001, 2002, 2003, 2004 John Ellson (Diese E-Mail-Adresse ist vor Spambots geschützt! Zur Anzeige muss JavaScript eingeschaltet sein!).
n”);
PUTS(”Portions relating to JPEG and to color quantization copyright 2000, 2001, 2002, 2003, 2004, Doug Becker and copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Thomas G. Lane. ”);
PUTS(”This software is based in part on the work of the Independent JPEG Group. See the file README-JPEG.TXT for more information.
n”);
PUTS(”Portions relating to GIF compression copyright 1989 by Jef Poskanzer and David Rowley, with modifications for thread safety by Thomas Boutell.
n”);
PUTS(”Portions relating to GIF decompression copyright 1990, 1991, 1993 by David Koblas, with modifications for thread safety by Thomas Boutell.
n”);
PUTS(”Portions relating to WBMP copyright 2000, 2001, 2002, 2003, 2004 Maurice Szmurlo and Johan Van den Brande.
n”);
php_info_print_box_end();
PUTS(”GD Licensen”);
php_info_print_box_start(0);
PUTS(”Permission has been granted to copy, distribute and modify gd in any context without fee, including a commercial application, provided that this notice is present in user-accessible supporting documentation.
”);
PUTS(”This does not affect your ownership of the derived work itself, and the intent is to assure proper credit for the authors of gd, not to interfere with your productive use of gd. If you have questions, ask. ”Derived works” ”);
PUTS(”includes all programs that utilize the library. Credit must be given in user-accessible documentation.
n”);
PUTS(”This software is provided ”AS IS.” The copyright holders disclaim all warranties, either express or implied, including but not limited to implied warranties of merchantability and fitness for a particular purpose, ”);
PUTS(”with respect to this code and accompanying documentation.
n”);
php_info_print_box_end();
PUTS(””);
}
PHP_FUNCTION(gd_info)
{
char *gd_uname;
if (ZEND_NUM_ARGS() != 0) {
ZEND_WRONG_PARAM_COUNT();
RETURN_FALSE;
}
gd_uname = php_get_uname(”a”);
PUTS(”n”);
PUTS(””);
PUTS(”n”);
php_info_print_style(TSRMLS_C);
PUTS(”gd_info()”);
PUTS(”n”);
PUTS(”n”);
php_info_print_box_start(1);
php_printf(”GD Version %sn”, PHP_GD_VERSION_STRING);
php_info_print_box_end();
php_info_print_table_start();
php_info_print_table_row(2, ”System”, gd_uname );
php_info_print_table_row(2, ”GD Version”, PHP_GD_VERSION_STRING);
#ifdef ENABLE_GD_TTF
php_info_print_table_row(2, ”FreeType Support”, ”enabled”);
#if HAVE_LIBFREETYPE
php_info_print_table_row(2, ”FreeType Linkage”, ”with freetype”);
{
char tmp[256];
#ifdef FREETYPE_PATCH
snprintf(tmp, sizeof(tmp), ”%d.%d.%d”, FREETYPE_MAJOR, FREETYPE_MINOR, FREETYPE_PATCH);
#else
snprintf(tmp, sizeof(tmp), ”%d.%d”, FREETYPE_MAJOR, FREETYPE_MINOR);
#endif
php_info_print_table_row(2, ”FreeType Version”, tmp);
}
#elif HAVE_LIBTTF
php_info_print_table_row(2, ”FreeType Linkage”, ”with TTF library”);
{
char tmp[256];
snprintf(tmp, sizeof(tmp), ”%d.%d”, TT_FREETYPE_MAJOR, TT_FREETYPE_MINOR);
php_info_print_table_row(2, ”FreeType Version”, tmp);
}
#else
php_info_print_table_row(2, ”FreeType Linkage”, ”with unknown library”);
#endif
#else
php_info_print_table_row(2, ”FreeType Support”, ”disabled”);
#endif
#ifdef HAVE_LIBT1
php_info_print_table_row(2, ”T1Lib Support”, ”enabled”);
#else
php_info_print_table_row(2, ”T1Lib Support”, ”disabled”);
#endif
#ifdef HAVE_GD_GIF_READ
php_info_print_table_row(2, ”GIF Read Support”, ”enabled”);
#else
php_info_print_table_row(2, ”GIF Read Support”, ”disabled”);
#endif
#ifdef HAVE_GD_GIF_CREATE
php_info_print_table_row(2, ”GIF Create Support”, ”enabled”);
#else
php_info_print_table_row(2, ”GIF Create Support”, ”disabled”);
#endif
#ifdef HAVE_GD_JPG
php_info_print_table_row(2, ”JPG Support”, ”enabled”);
#else
php_info_print_table_row(2, ”JPG Support”, ”disabled”);
#endif
#ifdef HAVE_GD_PNG
php_info_print_table_row(2, ”PNG Support”, ”enabled”);
#else
php_info_print_table_row(2, ”PNG Support”, ”disabled”);
#endif
#ifdef HAVE_GD_WBMP
php_info_print_table_row(2, ”WBMP Support”, ”enabled”);
#else
php_info_print_table_row(2, ”WBMP Support”, ”disabled”);
#endif
#if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED)
php_info_print_table_row(2, ”XPM Support”, ”enabled”);
#else
php_info_print_table_row(2, ”XPM Support”, ”disabled”);
#endif
#ifdef HAVE_GD_XBM
php_info_print_table_row(2, ”XBM Support”, ”enabled”);
#else
php_info_print_table_row(2, ”XBM Support”, ”disabled”);
#endif
#if defined(USE_GD_JISX0208) && defined(HAVE_GD_BUNDLED)
php_info_print_table_row(2, ”JIS-mapped Japanese Font Support”, ”enabled”);
#else
php_info_print_table_row(2, ”JIS-mapped Japanese Font Support”, ”disabled”);
#endif
php_info_print_table_end();
PUTS(”GD Copyrightn”);
php_info_print_box_start(0);
PUTS(”COPYRIGHT STATEMENT FOLLOWS THIS LINEnn”);
PUTS(”Portions copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 by Cold Spring Harbor Laboratory. Funded under Grant P41-RR02188 by the National Institutes of Health.
n”);
PUTS(”Portions copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 by Boutell.Com, Inc.
n”);
PUTS(”Portions relating to GD2 format copyright 1999, 2000, 2001, 2002, 2003, 2004 Philip Warner.
n”);
PUTS(”Portions relating to PNG copyright 1999, 2000, 2001, 2002, 2003, 2004 Greg Roelofs.
n”);
PUTS(”Portions relating to gd.c copyright 2003, 2004 Dale Walsh (Diese E-Mail-Adresse ist vor Spambots geschützt! Zur Anzeige muss JavaScript eingeschaltet sein!).
n”);
PUTS(”Portions relating to gdttf.c copyright 1999, 2000, 2001, 2002, 2003, 2004 John Ellson (Diese E-Mail-Adresse ist vor Spambots geschützt! Zur Anzeige muss JavaScript eingeschaltet sein!).
n”);
PUTS(”Portions relating to gdft.c copyright 2001, 2002, 2003, 2004 John Ellson (Diese E-Mail-Adresse ist vor Spambots geschützt! Zur Anzeige muss JavaScript eingeschaltet sein!).
n”);
PUTS(”Portions relating to JPEG and to color quantization copyright 2000, 2001, 2002, 2003, 2004, Doug Becker and copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Thomas G. Lane. ”);
PUTS(”This software is based in part on the work of the Independent JPEG Group. See the file README-JPEG.TXT for more information.
n”);
PUTS(”Portions relating to GIF compression copyright 1989 by Jef Poskanzer and David Rowley, with modifications for thread safety by Thomas Boutell.
n”);
PUTS(”Portions relating to GIF decompression copyright 1990, 1991, 1993 by David Koblas, with modifications for thread safety by Thomas Boutell.
n”);
PUTS(”Portions relating to WBMP copyright 2000, 2001, 2002, 2003, 2004 Maurice Szmurlo and Johan Van den Brande.
n”);
php_info_print_box_end();
PUTS(”GD Licensen”);
php_info_print_box_start(0);
PUTS(”Permission has been granted to copy, distribute and modify gd in any context without fee, including a commercial application, provided that this notice is present in user-accessible supporting documentation.
”);
PUTS(”This does not affect your ownership of the derived work itself, and the intent is to assure proper credit for the authors of gd, not to interfere with your productive use of gd. If you have questions, ask. ”Derived works” ”);
PUTS(”includes all programs that utilize the library. Credit must be given in user-accessible documentation.
n”);
PUTS(”This software is provided ”AS IS.” The copyright holders disclaim all warranties, either express or implied, including but not limited to implied warranties of merchantability and fitness for a particular purpose, ”);
PUTS(”with respect to this code and accompanying documentation.
n”);
php_info_print_box_end();
PUTS(””);
}
© by macjaner.ch | Powered by GoeGG-ArT.ch