GTK development toolkit Installation

We use the installer provided by the Glade for Win32 project. In particular, the version at the time of writing of this document was GTK 2.8.20

Installation of NSIS installer compiler

The installer is available at http://nsis.sourceforge.net/Download You can select a list of download mirrors for the version we use, the 2.21

Preparing your environment

:!: Take care to put /usr/bin before /cygwin/c/GTK/bin in your PATH so that you use /usr/bin/pkg-config. This is required because GTK’s pkg-config post-processes paths, often transforming them in their Windows absolute paths equivalents. As a consequence, tools under cygwin may not understand those paths.

As GTK must be made available to the cygwin environment, simply link GTK directory as /target.

ln -s /cygwin/c/GTK /target

Further configuration is required to set up where the makensis tool lies, where the GTK .pc files read by pkg-config can be found.

  • Edit ~/.bashrc
  • The file hierarchy of “C:\” is available under /cygdrive/c. You should adapt the following lines according to where you installed GTK and NSIS.
  • Here is an example of a .bashrc:
GTK_BASEPATH=/target
NSIS_PATH=/cygdrive/c/Program\ Files/NSIS
PKG_CONFIG_PATH=$GTK_BASEPATH/lib/pkgconfig
export PKG_CONFIG_PATH
 
LD_LIBRARY_PATH=$GTK_BASEPATH/lib:$LD_LIBRARY_PATH
LD_RUN_PATH=$GTK_BASEPATH/lib:$LD_RUN_PATH
export LD_LIBRARY_PATH LD_RUN_PATH
 
# to use /usr/bin/pkg-config
export PATH=/usr/bin:$PATH:$GTK_BASEPATH/bin:$NSIS_PATH

libintl.h hack

This is required because we want the demexp client to be linked against GTK’s (shared library) intl.dll and not cygwin’s cygintl-3.dll. This removes duplicate binaries and potentially prevent mysterious bugs.

A first step is then to avoid using cygwin’s includes and libraries for cygwin. A way to back them up would be for instance:

$ mkdir intl-moved
$ mv /usr/lib/*intl* intl-moved/
$ mv /usr/include/libintl.h intl-moved/

Then comes a tricky matter. GTK’s intl.dll is compiled in a Microsoft Visual C++ fashion, where symbols in shared libraries (dlls) are prefixed with a particular symbol. In addition, C symbols are prefixed with _. Acknowledging this, the libintl.h header tries to redirect the original symbols to compatible ones, but fails for some reason.

The simplest way (untill an upstream fix) to overcome this problem is to avoid the code paths in the header leading to the redirection. We however tried to minimize its impact, in particular if you use it in another environment. This is what is implemented in the following patch.

--- /cygdrive/c/GTK/include/libintl.h.orig      2006-10-25 20:06:10.965976900 +0200
+++ /cygdrive/c/GTK/include/libintl.h   2006-10-25 20:05:23.077116100 +0200
@@ -89,8 +89,9 @@
    If he doesn't, we choose the method.  A third possible method is
    _INTL_REDIRECT_ASM, supported only by GCC.  */
 #if !(defined _INTL_REDIRECT_INLINE || defined _INTL_REDIRECT_MACROS)
-# if __GNUC__ >= 2 && !defined __APPLE_CC__ && !defined __MINGW32__ && !(__GNUC__ == 2 && defined _AIX) && (defined __STDC__ || defined __cplusplus)
+# if __GNUC__ >= 2 && !defined __APPLE_CC__ && !defined __MINGW32__ && !defined INTL_HACK && !(__GNUC__ == 2 && defined _AIX) && (defined __STDC__ || defined __cplusplus)
 #  define _INTL_REDIRECT_ASM
+#  warning "Wrong case: INTL_HACK not used"
 # else
 #  ifdef __cplusplus
 #   define _INTL_REDIRECT_INLINE

noweb

$ wget http://www.eecs.harvard.edu/~nr/noweb/dist/noweb-2.11b.tgz
$ tar xvzf noweb-2.11b.tgz 
$ cd noweb-2.11b
$ cd src
$ mkdir -p /usr/local/tex/inputs
$ make all install
We modified the installation procedure because binaries built in the windows environment have a .exe suffix; some file operations fail as a consequence in the original makefile.
diff -Naur noweb-2.11b/src/Makefile noweb-2.11b-cygwin/src/Makefile
--- noweb-2.11b/src/Makefile    2006-06-12 22:14:20.000000000 +0200
+++ noweb-2.11b-cygwin/src/Makefile     2006-07-24 22:23:18.000000000 +0200
@@ -53,7 +53,7 @@
        /bin/cp $(HOME)/www/noweb/FAQ.html FAQ.html
        chmod -w FAQ.html
 
-install: install-code install-man install-tex install-elisp
+install: install-code install-man install-tex #install-elisp
 uninstall: uninstall-code uninstall-man uninstall-tex uninstall-elisp
        -rmdir $(BIN) $(LIB) 2>/dev/null
 
@@ -99,8 +99,8 @@
 
 install-code: install-shell
        -mkdir $(BIN) $(LIB) 2>/dev/null
-       strip c/nt c/markup c/mnt c/finduses
-       cp c/nt c/markup c/mnt c/finduses $(LIB)
+       strip c/nt.exe c/markup.exe c/mnt.exe c/finduses.exe
+       cp c/nt.exe c/markup.exe c/mnt.exe c/finduses.exe $(LIB)
        cd $(LIBSRC); make ICONT=$(ICONT) ICONC=$(ICONC) LIB=$(LIB) BIN=$(BIN) install
        cd lib; make LIB=$(LIB) install
 

Finally, noweb installs its binary in the unusual $prefix/noweb folder; we fix this by symlinking them to a more usual /usr/local/bin/ place.

$ cd /usr/local/bin/
$ ln -s /usr/local/noweb/noweb .
$ ln -s /usr/local/noweb/notangle .
$ ln -s /usr/local/noweb/noweave .

findlib

$ wget http://www.ocaml-programming.de/packages/findlib-1.1.2pl1.tar.gz
$ tar xvzf findlib-1.1.2pl1.tar.gz 
$ cd findlib-1.1.2pl1
$ ./configure 
$ make all
$ make opt
$ make install

equeue

$ wget http://www.ocaml-programming.de/packages/equeue-2.1.3.tar.gz
$ tar xvzf equeue-2.1.3.tar.gz 
$ cd equeue-2.1.3
$ ./configure 
$ make all
$ make opt
$ make install

rpc

$ wget -c http://www.ocaml-programming.de/packages/rpc-0.4.5.tar.gz
$ tar xvzf rpc-0.4.5.tar.gz 
$ cd rpc-0.4.5
$ ./configure 
$ make all
$ make opt
$ make install

gz

$ wget http://ocamlplot.sourceforge.net/gz-0.5.7.tar.gz
$ tar zxf gz-0.5.7.tar.gz
$ cd gz-0.5.7
ocamlmklib under windows environment has a specific non-feature: it can’t build shared libraries. gz makes the opposite assumption. Therefore, we need to remove any reference to the shared library. We provide the following patch not suitable for upstream inclusion.
--- gz-0.5.7/Makefile.in        2002-12-18 20:20:32.000000000 +0100
+++ gz-0.5.7-cygwin/Makefile.in 2006-07-24 23:25:02.000000000 +0200
@@ -18,7 +18,7 @@
 
 NAME := gz
 VERSION := 0.5.6
-INSTALLFILES := {gz,bz}.{cmi,cmx,mli} gz.{a,cma,cmxa} dllmlgz.so libmlgz.a
+INSTALLFILES := {gz,bz}.{cmi,cmx,mli} gz.{a,cma,cmxa} libmlgz.a
 
 DISTSRC := {gz,bz}.{ml,mli} c_{gz,bz}.c io.h \
          aclocal.m4 install-sh \
@@ -37,7 +37,7 @@
 install : normal-install
 endif
 
-stub   : dllmlgz.so libmlgz.a
+stub   : libmlgz.a
 lib    : gz.cma
 libopt : gz.cmxa
 

Once this patch is applied, the compilation and installation are easily dealt with.

$ ./configure --with-findlib
$ make all
$ make install

ocaml-fileutils

$ wget http://sylvain.le-gall.net/download/ocaml-fileutils-0.3.0.tar.gz
$ tar zxf ocaml-fileutils-0.3.0.tar.gz
$ cd ocaml-fileutils-0.3.0
$ ./configure --enable-ocamlfind
$ make all
$ cp -a build/lib/fileutils /usr/lib/ocaml/site-lib/

ocamlidl

$ wget http://caml.inria.fr/pub/old_caml_site/distrib/bazar-ocaml/camlidl-1.05.tar.gz
$ tar zxf camlidl-1.05.tar.gz
$ cd camlidl-1.05
$ cp config/Makefile.unix config/Makefile
A trivial patch is required to fit cygwin’s installation for ocaml’s libs:
--- config/Makefile.unix        2002-04-22 13:50:46.000000000 +0200
+++ config/Makefile     2006-10-18 21:06:16.545806400 +0200
@@ -31,7 +31,7 @@
 #RANLIB=:
 
 # Location of the Objective Caml library in your installation
-OCAMLLIB=/usr/local/lib/ocaml
+OCAMLLIB=/usr/lib/ocaml
 
 # Where to install the binaries
 BINDIR=/usr/local/bin
$ make all
$ make install

ocaml-ast-analyze

$ wget http://sylvain.le-gall.net/download/ocaml-ast-analyze-0.1.1.tar.gz
$ tar zxf ocaml-ast-analyze-0.1.1.tar.gz
$ cd ocaml-ast-analyze-0.1.1
$ ./configure
$ make
$ cp -a build/lib/ast-analyze/ /usr/lib/ocaml/site-lib/

Camomile

$ wget http://ovh.dl.sourceforge.net/sourceforge/camomile/camomile-0.6.2.tar.bz2
$ tar jxf camomile-0.6.2.tar.bz2
$ cd camomile-0.6.2
$ ./configure
$ make
$ make install

ocaml-gettext

This is a tough work. As some ocaml software from Sylvain Legall, some problems have to be circumvented.

First, let’s see which version of gettext will be used.

$ which gettext
/cygdrive/c/GTK/bin/gettext
$ wget http://sylvain.le-gall.net/download/ocaml-gettext-0.2.0.tar.gz
$ tar zxf ocaml-gettext-0.2.0.tar.gz
$ cd ocaml-gettext-0.2.0

The following diffs provide fixes for:

  • ocamlmklib not producing shared libraries, only static
  • mkcamlp4, being a simplistic shell script, has trouble with parameter order on the command-line; may not be fatal and unnecessary
  • Use of the libintl hack to use proper libintl symbols
$ diff -u ocaml-gettext/Makefile.orig ocaml-gettext/Makefile
--- libgettext-stub-ocaml/Makefile.orig 2006-10-18 22:17:04.413940800 +0200
+++ libgettext-stub-ocaml/Makefile      2006-10-18 22:17:46.534507200 +0200
@@ -47,7 +47,6 @@
  gettextStub.cmxa          \
  gettextStub.cma           \
  gettextStub.a             \
- dllgettextStub.so         \
  libgettextStub.a          \
  gettextStub.cmi           \
  gettextStubCompat.cmi
--- ocaml-gettext/Makefile.orig 2006-10-18 22:03:32.196028800 +0200
+++ ocaml-gettext/Makefile      2006-10-18 22:04:02.068984000 +0200
@@ -64,12 +64,11 @@
 uninstall: ocaml-xgettext-uninstall
 
 ocaml-xgettext: $(BUILDBIN)
-       $(MKCAMLP4)                                                          \
+       $(MKCAMLP4) -o $@                                                    \
            -I +camlp4 pa_o.cmo                                               \
           `$(OCAMLFIND) query -r -predicates byte gettext.extract -i-format` \
           `$(OCAMLFIND) query -r -predicates byte gettext.extract -a-format` \
-          `$(OCAMLFIND) query -r -predicates byte gettext.extract -o-format` \
-          -o $@
+          `$(OCAMLFIND) query -r -predicates byte gettext.extract -o-format`
        $(CP) $@ $(BUILDBIN)/
 
--- ConfMakefile.in.orig        2006-10-25 19:42:53.306240900 +0200
+++ ConfMakefile.in     2006-10-25 20:09:05.927559300 +0200
@@ -36,8 +36,8 @@
 OCAMLFIND_COMMANDS = "ocamlc=@OCAMLC@ \
        ocamlopt=@OCAMLOPT@ \
        ocamldep=@OCAMLDEP@"
-OCAMLC       = @OCAMLFIND@ ocamlc
-OCAMLOPT     = @OCAMLFIND@ ocamlopt
+OCAMLC       = @OCAMLFIND@ ocamlc -ccopt -DINTL_HACK
+OCAMLOPT     = @OCAMLFIND@ ocamlopt -ccopt -DINTL_HACK
 OCAMLDEP     = @OCAMLFIND@ ocamldep
 OCAMLBEST    = @OCAMLBEST@
 OCAMLVERSION = @OCAMLVERSION@

In order to reduce dependencies required, we deactivated some stuff not required by demexp.

$ ./configure --disable-bench --disable-doc
$ make

At this point, and on 2 more occasions, a make failure will occur: for some reason, while it seems to use/compile to the proper folders under another environment such as a “Debian”, it fails to find the path under cygwin. In addition, make install does nothing, so the simplest solution is simply to copy missing files to a place where they can be reached.

This has been submitted upstream, but Sylvain Legall has disable public bug tracking interface because of spamming. He can however be easily reached through mail for bug submission.

$ cp -a build/lib/gettext/ /usr/lib/ocaml/site-lib/

We then go back to compiling, as the previous error is fixed by our copying the files.

$ make

Second failure, concerning gettext-camomile camommile at this point. Then, a bug/incompatibility/strictness issue in camomile leads to many locales (such as iso8859-1) not to be recognized. Therefore, we restart make by forcing the environement language to C so as to avoid such incoming problem.

$ cp -a build/lib/gettext-camomile/ /usr/lib/ocaml/site-lib/
$ LANG=C make

This last failure is probably concerning the installation of .po/.mo files into $prefix/locale/LC_MESSAGES/$LANG/$domain.mo. This is not important, as the only thing you loose is French localization, and your reading this document already indicates that you should be fine with LANG=C.

Last failure, we proceed by copying gettext-stub.

$ cp -a build/lib/gettext-stub/ /usr/lib/ocaml/site-lib/

In addition, we complete the manual “install” process by copying by ourselves the produced binaries

$ cp build/bin/* /usr/local/bin/

config_file

$ wget http://download.gna.org/cameleon/config_file_0.1.tar.gz
$ tar zxf config_file_0.1.tar.gz
$ cd config_file-0.1/
$ ./configure

After configuration, we can apply a trivial fix so as to make config_file available as an ocaml lib.

--- master.Makefile.orig        2006-10-18 22:32:17.246529600 +0200
+++ master.Makefile     2006-10-18 22:31:22.678064000 +0200
@@ -47,7 +47,7 @@
 RM=rm -fr
 
 DESTDIR=   # For debian packagers
-INSTALLDIR=$(DESTDIR)$(OCAMLLIB)
+INSTALLDIR=$(DESTDIR)$(OCAMLLIB)/config_file
 
 # Compilation
 #############
$ make 
$ make opt
$ make install

LablGTK

In order for it to compile, you should absolutely have followed and performed changes similar to what we described earlier in this document:

  • cygwin’s pkg-config must prevail over GTK’s version
  • The PKG_CONFIG_PATH variable must be correctly set
  • /target must point to your GTK development toolkit’s installation path

To reduce problems with dynamic linking/use of shared libraries, and in general compilation problems, we compile lablgtk as a static library. The usual autotools configure flags are used for this matter.

$ wget http://wwwfun.kurims.kyoto-u.ac.jp/soft/olabl/dist/lablgtk-2.6.0.tar.gz
$ tar zxf lablgtk-2.6.0.tar.gz
$ cd lablgtk-2.6.0
$ ./configure --disable-shared --enable-static
$ make

The compilation breaks with an error on -llablgtk2 not found. A solution (probably not the cleanest nor the simplest) is covered by the following shell commands:

$ cd src
$ ocamlc.opt -cclib '-L.' -o gdk-pixbuf-mlsource lablgtk.cma gtkInit.cmo gdk-pixbuf-mlsource.ml
$ make
$ make opt
$ cd ..
$ make install

demexp

The acme of this story is reached, as the final scene unveils itself. However, it should be an hollywoodian, good-guys-win (despite goals of world domination, demexp people are still considered the ‘good’ ones) ending with demexp client flawlessly compiling.

$ wget http://www.linux-france.org/~dmentre/demexp/latest-src/demexp-0.8.3.tar.gz
$ tar xvzf demexp-0.8.3.tar.gz 
$ cd demexp-0.8.3
$ ./configure --no-dvi --no-pdf --no-web --no-server
$ make

Last but not least, we must compile localization files. As already mentioned, installing compiled .mo files to their usual locale/$LANG/LC_MESSAGES/$domain.mo doesn’t work because of a bug in ocaml-gettext, so the failure you will notice can be ignored. The installer will take care of such thing.

$ LANG=C make install-buildpo

Now that every thing is ready, you can prepair the installer. This requires copying a GTK runtime installer, ideally corresponding to your development toolkit, into win32/ directory. This is not completely required, as GTK 2.x have a rule of being binary backwardly compatible. However, the installer expects it to be named gtk<something>.exe

We suggest the Glade for win32 ones, as we used the 2.8.20 in our case.

$ make installer
 
en/demexp_build_on_windows.txt · Last modified: 2006/10/28 00:32 by 82.229.60.246
 
Recent changes RSS feed Powered by PHP Valid XHTML 1.0 Valid CSS Debian Driven by DokuWiki