<<

INSTALL GTK-Ada X11 on MAC OS X

1) Install of GTK-Ada library

Binaries for GTK-Ada for Mac aren't included in GPL 2011 release. They can be either built from source code (see next paragraph) or downloaded from Source Forge (what we are going to do in this paragraph).

Download the following file on Mac desktop: . GTKAda : "gtkada-gpl-2011-x11-x86_64-apple-darwin10.8.0-bin.tgz", from Source Forge "http://sourceforge.net/projects/gnuada/files/GNAT_GPL %20Mac%20OS%20X/2011-snow-leopard".

Launch Terminal from admin and type the following commands to install it for instance at /usr/local:

$ cd /usr/local $ sudo tar xzf ~/Desktop/gtkada-gpl-2011-x11-x86_64-apple- darwin10.8.0-bin.tgz

GTK, GTKAda and Glade are then installed in directory: /usr/local/-2011

For a common usage, type the following commands:

$ echo 'PATH=/usr/local/gtk-2011/bin:$PATH' >> ~/.profile $ echo 'PATH=/usr/local/gtk-2011/bin:$PATH' >> ~/.bashrc $ echo 'export GPR_PROJECT_PATH=/usr/local/gtk-2011/lib/gnat: $GPR_PROJECT_PATH' >> ~/.profile $ echo 'export GPR_PROJECT_PATH=/usr/local/gtk-2011/lib/gnat: $GPR_PROJECT_PATH' >> ~/.bashrc

For a temporary usage, type the following commands each time:

$ PATH=/usr/local/gtk-2011/bin:$PATH $ export GPR_PROJECT_PATH=/usr/local/gtk-2011/lib/gnat: $GPR_PROJECT_PATH

Examples in Ada are available in: usr/local/gtk-2011/share/examples/gtkada. Documentation is available in HTML format in /usr/local/gtk-2011/share/doc/gtkada and /usr/local/gtk-2011/share/ gtk-doc/:

$ open /usr/local/gtk-2011/share/doc/gtkada/gtkada_rm/index.html $ open /usr/local/gtk-2011/share/doc/gtkada/gtkada_ug/gtkada_ug.html $ open /usr/local/gtk-2011/share/gtk-doc/html/gtk/index.html

See GTKAda use with an example on Blady.

2) Building GTKAda for X11 with complete GTK+ from source

Binaries for GTKAda for Mac aren't included in GPL 2011 release. We are going to build them from source code. The following steps were made on Mac OS X 10.6.8 Intel with GNAT GPL 2011. GNAT Ada compiler must have been installed before (see on Blady). Software description come from native description on corresponding web site. Take care of every software license.

Download GPL 2011 x86_64-darwin GNAT source codes on desktop from http://libre.adacore.com:

- atk-1.32.0.tar.gz 952 KB Sep 27, 2010 - -1.10.0.tar.gz 24.0 MB Sep 6, 2010 - fontconfig-2.8.0.tar.gz 1.55 MB Nov 18, 2009 - freetype-2.4.1.tar.gz 1.90 MB Jul 18, 2010 - -pixbuf-2.22.1.tar.gz 2.19 MB Nov 6, 2010 - gettext-0.18.1.1.tar.gz 15.1 MB Jan 3, 2011 - -2.26.1.tar.gz 9.55 MB Nov 14, 2010 - gtk+-2.22.1.tar.gz 27.1 MB Nov 15, 2010 - gtkada-for-gps-5.0.1-gpl-src.tgz 8.23 MB Jan 12, 2011 - jpegsrc.v6b.tar.gz 613 KB Jun 9, 2009 - libpng-1.2.44.tar.gz 829 KB Jun 26, 2010 - -1.28.3.tar.gz 2.12 MB Sep 29, 2010 - pixman-0.20.0.tar.gz 537 KB Oct 27, 2010 - pkg-config-0.20.tar.gz 970 KB Jun 9, 2009 - zlib-1.2.5.tar.gz 545 KB Apr 20, 2010

And also: . LibTIFF from http://www.libtif.org: ftp://ftp.remotesensing.org//pub/libtif/tif-3.9.5.tar.gz Lauch X11 xterm and configure environnement variables for native Mac GCC:

$ echo $PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin $ which gcc /usr/bin/gcc

I advice to create a dedicated directory:

$ cd /usr/local $ mkdir gtk-2011 $ PATH=/usr/local/gtk-2011/bin:$PATH

2.1) Pkg-config Pkg-config is a helper tool used when compiling applications and libraries. It helps you insert the correct compiler options on the command line

$ cd $ tar xzf ~/Desktop/pkg-config-0.20.tar.gz $ cd pkg-config-0.20 $ ./configure --prefix=/usr/local/gtk-2011 $ make $ sudo make install $ pkg-config --list-all

2.2) GTK+ a) JPEG IJG is an informal group that writes and distributes a widely used free library for JPEG image compression.

$ cd $ tar xzf ~/Desktop/jpegsrc.v6b.tar.gz $ cd jpeg-6b $ ./configure --enable-static --enable-shared --prefix=/usr/local/ gtk-2011 $ make $ sudo make install b) PNG b.1) ZLIB Zlib is a general purpose data compression library.

$ cd $ tar xzf ~/Desktop/zlib-1.2.5.tar.gz $ cd zlib-1.2.5 $ ./configure --prefix=/usr/local/gtk-2011 $ make $ sudo make install

b.2) PNG Libpng is the ofcial PNG reference library. It supports almost all PNG features, is extensible, and has been extensively tested for over 13 years.

$ cd $ tar xzf ~/Desktop/libpng-1.2.44.tar.gz $ cd libpng-1.2.44 $ ./configure --prefix=/usr/local/gtk-2011 $ make $ sudo make install ) GLIB c.1) GETTEXT The goal of gettext library was to give a unique interface to message handling functions. It is interesting for authors or maintainers of other packages or programs which they want to see internationalized.

$ cd $ tar xzf ~/Desktop/gettext-0.18.1.1.tar.gz $ cd gettext-0.18.1.1 $ ./configure --prefix=/usr/local/gtk-2011 $ make $ sudo make install

c.2) GLIB GLib is the low-level core library that forms the basis for projects such as GTK+ and GNOME.

$ cd $ tar xzf ~/Desktop/glib-2.26.1.tar.gz $ cd glib-2.26.1 # Modify glib/gconvert.c # Replace #if !defined(USE_LIBICONV_GNU) && defined (_LIBICONV_H) # With #if !(defined(__APPLE__) && defined(__LP64__)) && !defined (USE_LIBICONV_GNU) && defined (_LIBICONV_H) # Locate gettext $ CPPFLAGS=-I/usr/local/gtk-2011/include LDFLAGS=-L/usr/local/ gtk-2011/lib ./configure --prefix=/usr/local/gtk-2011 $ make $ sudo make install d) ATK

$ cd $ tar xzf ~/Desktop/atk-1.32.0.tar.gz $ cd atk-1.32.0 $ ./configure --prefix=/usr/local/gtk-2011 $ make $ sudo make install e) Cairo e1) Freetype FreeType 2 is a software font engine that is designed to be small, efcient, highly customizable, and portable while capable of producing high-quality output (glyph images). It can be used in graphics libraries, display servers, font conversion tools, text image generation tools, and many other products as well. $ cd $ tar xzf ~/Desktop/freetype-2.4.1.tar.gz $ cd freetype-2.4.1 $ ./configure --prefix=/usr/local/gtk-2011 $ make $ sudo make install

e2) Pixman Pixman is a library that provides low-level pixel manipulation features such as image compositing and trapezoid rasterization.

$ cd $ tar xzvf ~/Desktop/pixman-0.20.0.tar.gz $ cd pixman-0.20.0 $ ./configure --prefix=/usr/local/gtk-2011 $ make $ sudo make install e3) Fontconfig A font configuration and customization library.

$ cd $ tar xzf ~/Desktop/fontconfig-2.8.0 $ cd fontconfig-2.8.0 $ ./configure --prefix=/usr/local/gtk-2011 $ make $ sudo make install

e4) Cairo Cairo is a 2D graphics library with support for multiple output devices. Currently supported output targets include the , win32, and image bufers, as well as PDF, PostScript, and SVG file output.

$ cd $ tar xzf ~/Desktop/cairo-1.10.0.tar.gz $ cd cairo-1.10.0 $ ./configure --prefix=/usr/local/gtk-2011 $ make $ sudo make install f) Pango Pango is a library for layout and rendering of text, with an emphasis on internationalization. (Must be built after Cairo !!!!!)

$ cd $ tar xzf ~/Desktop/pango-1.28.3.tar.gz $ cd pango-1.28.3 $ ./configure --prefix=/usr/local/gtk-2011 $ make $ sudo make install g) GDK-PixBuf g1) LibTif This library provides support for the Tag Image File Format (TIFF), a widely used format for storing image data..

$ cd $ tar xzf ~/Desktop/tif-3.9.5.tar.gz $ cd tif-3.9.5 # Loacate libjpeg $ CPPFLAGS=-I/usr/local/gtk-2011/include LDFLAGS=-L/usr/local/ gtk-2011/lib ./configure --prefix=/usr/local/gtk-2011 $ make $ sudo make install

g2) GDK-PixBuf GDK-PixBuf is getting parts of a GDK drawable's image data into a pixbuf.

$ cd $ tar xzf ~/Desktop/gdk-pixbuf-2.22.1.tar.gz $ cd gdk-pixbuf-2.22.1 # Locate libtif $ CPPFLAGS=-I/usr/local/gtk-2011/include LDFLAGS=-L/usr/local/ gtk-2011/lib ./configure --prefix=/usr/local/gtk-2011 $ make $ sudo make install h) GTK+ Gtk+ is a wonderful graphic toolkit written in C for X-Window and Win32 that was originally developed as the basis for the .

$ cd $ tar xzf ~/Desktop/gtk+-2.22.1.tar.gz $ cd gtk+-2.22.1 $ ./configure --prefix=/usr/local/gtk-2011 $ make $ sudo make install

2.3) GtkAda GtkAda is an Ada95 graphical toolkit based on Gtk+, providing the complete set of Gtk+ widgets using the Object-Oriented features of this language.

Configure environnement variables for GNAT GCC:

$ PATH=/usr/local/gnat/bin:$PATH $ which gcc /usr/local/gnat/bin/gcc

$ cd $ tar xzf ~/Desktop/gtkada-for-gps-5.0.1-gpl-src.tgz $ cd gtkada-2.18.0-src # Add OPENGL_FLAGS in testgtk/Makefile # See testgtk-Makefile.dif in annex $ ./configure --prefix=/usr/local/gtk-2011 --with-GL=GL --with-GL- prefix=/usr/X11 $ make $ sudo make install See setting of environment variables in first paragraph. See GTKAda use with an example on Blady.

3) Building GLADE

Download following files from corresponding web site: . Intltool from http://freedesktop.org/wiki/Software/intltool : http://ftp.gnome.org/pub/gnome/sources/intltool/0.40/ intltool-0.40.6.tar.gz . LibXML from Libre d'AdaCore "https://libre.adacore.com" page "Download GNAT GPL", select plateform x86_64-linux 2011 then GtkAda -> Sources : -2.5.7.tar.gz 3.15 MB Jun 16, 2003 . Glade from http://glade.gnome.org http://caesar.acc.umu.se/pub/GNOME/sources/glade3/3.8/ glade3-3.8.0.tar.gz . index.theme from http://www.freedesktop.org/wiki/Software/icon- theme http://icon-theme.freedesktop.org/releases/hicolor-icon-theme-0.12.tar.gz

3.1) Intltool The intltool package contains an internationalization tool. This is useful for extracting translatable strings from source files, collecting the extracted strings with messages from traditional source files and merging the translations into ., .desktop and .oaf files.

$ cd $ tar xzf ~/Desktop/intltool-0.40.6.tar.gz $ cd intltool-0.40.6/ $ ./configure --prefix=/usr/local/gtk-2011 $ make $ make install

3.2) LibXML Libxml2 is the XML C parser and toolkit developed for the Gnome project.

$ cd $ tar xzf ~/Desktop/libxml2-2.5.7.tar.gz $ cd libxml2-2.5.7/ $ ./configure --prefix=/usr/local/gtk-2011 $ make $ make install 3.3) Glade Glade is a RAD tool to enable quick & easy development of user interfaces for the GTK+ toolkit and the GNOME desktop environment. The user interfaces designed in Glade are saved as XML, and by using the GtkBuilder GTK+ object these can be loaded by applications dynamically as needed. By using GtkBuilder, Glade XML files can be used in numerous programming languages including C, C++, C#, Vala, Java, , Python,and others... Ada ;-)

$ cd $ tar xzf ~/Desktop/glade3-3.8.0.tar.gz $ cd glade3-3.8.0/ $ ./configure --prefix=/usr/local/gtk-2011 $ make $ make install

$ cd $ tar xzf ~/Desktop/hicolor-icon-theme-0.12.tar.gz $ cp -p hicolor-icon-theme-0.12/index.theme /usr/local/gtk-2011/share/ glade3/pixmaps/hicolor

French user may read first steps with GTKAda and Glade on Blady.

Pascal Pignard, July 2011. http://blady.pagesperso-orange.fr

Annex : testgtk-Makefile.dif

*** ./testgtk/Makefile.0 2011-07-24 08:50:35.000000000 +0200 --- ./testgtk/Makefile 2011-07-24 08:58:27.000000000 +0200 *************** *** 21,26 **** --- 21,27 ----

ifeq ($(HAVE_OPENGL),True) OPENGL_C_OBJECTS=lw.o + OPENGL_FLAGS = -I/usr/X11/include OPENGL_LIBS= -L/usr/X11/lib -lGLU -lGL GTKADA_GL_LIBS=-lgtkada_gl else *************** *** 42,48 **** opengl/view_gl.gpb opengl/view_gl.adb

lw.o: opengl/lw.c opengl/lw.h ! $(CC) -c opengl/lw.c -Iopengl -D_REENTRANT -I/usr/local/gtk-2011/ include/gtk-2.0 -I/usr/local/gtk-2011/lib/gtk-2.0/include -I/usr/local/ gtk-2011/include/atk-1.0 -I/usr/local/gtk-2011/include/cairo -I/usr/ local/gtk-2011/include/gdk-pixbuf-2.0 -I/usr/local/gtk-2011/include/ pango-1.0 -I/usr/local/gtk-2011/include/glib-2.0 -I/usr/local/gtk-2011/ lib/glib-2.0/include -I/usr/local/gtk-2011/include/libpng12 -I/usr/local/ gtk-2011/include/freetype2 -I/usr/local/gtk-2011/include

install: force $(MKDIR) $(examples) --- 43,49 ---- opengl/view_gl.gpb opengl/view_gl.adb

lw.o: opengl/lw.c opengl/lw.h ! $(CC) -c opengl/lw.c $(OPENGL_FLAGS) -Iopengl -D_REENTRANT -I/ usr/local/gtk-2011/include/gtk-2.0 -I/usr/local/gtk-2011/lib/gtk-2.0/ include -I/usr/local/gtk-2011/include/atk-1.0 -I/usr/local/gtk-2011/ include/cairo -I/usr/local/gtk-2011/include/gdk-pixbuf-2.0 -I/usr/local/ gtk-2011/include/pango-1.0 -I/usr/local/gtk-2011/include/glib-2.0 -I/ usr/local/gtk-2011/lib/glib-2.0/include -I/usr/local/gtk-2011/include/ libpng12 -I/usr/local/gtk-2011/include/freetype2 -I/usr/local/gtk-2011/ include

install: force $(MKDIR) $(examples)