Closed Bug 179512 Opened 22 years ago Closed 22 years ago

Mozilla build on FreeBSD with GTK2 fails to configure and compile w/o patching

Categories

(Core Graveyard :: Embedding: GTK Widget, defect)

x86
FreeBSD
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: gvs, Assigned: blizzard)

References

Details

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.1) Gecko/20021111
Build Identifier: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.1) Gecko/20021111

FreeBSD port of Mozilla depends on gtk1.2, imlib1, orbit1 etc. Having
gtk2/glib2, imlib2, orbit2 etc I've been quite annoyed of gtk12 dependency and
built up Mozilla with gtk2. It took me about 2 hours of extensive configure
hacking and patching some sources, but voila - I'm writing you from Mozilla
built with gtk2, which seems to be working quite well. I have one patch
perfectly accurate, one which can be treated as dirty hack and no patch but only
description for a third problem, sorry for that. I hope it'll be easy to fix it
for developers who know the project structure etc.

Reproducible: Always

Steps to Reproduce:
Download mozilla-source-1.1.tar.gz, unpack it and try to configure with
--enable-default-toolkit=gtk2 option. The configure script will fail because it
still relies upon gtk-config, glib-config, imlib-config and so on which all have
been replaced with pkg-config in 2nd generation of that software.

Actual Results:  
if you try configure unpatched, you'll get errors as follows:

checking for glib-config... no
checking for GLIB - version >= 1.2.0... no
*** The glib-config script installed by GLIB could not be found
*** If GLIB was installed in PREFIX, make sure PREFIX/bin is in
*** your path, or set the GLIB_CONFIG environment variable to the
*** full path to glib-config.
checking for libIDL-config... no
checking for libIDL - version >= 0.6.3... no
*** The libIDL-config script installed by libIDL could not be found
*** If libIDL was installed in PREFIX, make sure PREFIX/bin is in
*** your path, or set the LIBIDL_CONFIG environment variable to the
*** full path to libIDL-config.
checking for orbit-config... no
configure: error: libIDL not found.
        libIDL 0.6.3 or higher is required.

despite of that fact that it says few lines above:

checking for pkg-config... /usr/local/bin/pkg-config
checking for gtk+-2.0 >= 1.3.7... yes
checking MOZ_GTK2_CFLAGS... -I/usr/local/include/atk-1.0
-I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include
-I/usr/X11R6/include/gtk-2.0 -I/usr/X11R6/lib/gtk-2.0/include
-I/usr/X11R6/include/pango-1.0 -I/usr/X11R6/include
-I/usr/local/include/freetype2 -I/usr/local/include
checking MOZ_GTK2_LIBS... -Wl,--export-dynamic -L/usr/local/lib -L/usr/X11R6/lib
-lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangoxft-1.0 -lXft
-lXrender -lXext -lfreetype -lpangox-1.0 -lX11 -lpango-1.0 -lgobject-2.0
-lgmodule-2.0 -lglib-2.0 -lintl -liconv



Expected Results:  
supposedly Mozilla's configure should try pkg-config for glib-2.0, gtk-2.0,
IMLib-2.0, gmodule-2.0 etc

It's maybe time to show up compilation details and patches. Okay, I haven't
autoconf, my call to configure was:

CFLAGS="-O -march=pentiumpro -pipe" CPPFLAGS="-I/usr/local/include" CXXFLAGS="-O
-march=pentiumpro -pipe" LDFLAGS="-L/usr/local/lib" ./configure --with-x
--enable-xinerama --with-pthreads --with-system-jpeg=/usr/local
--enable-extensions --with-system-zlib --with-system-png=/usr/local
--with-system-mng=/usr/local --enable-default-toolkit=gtk2
--enable-extensions=all --enable-reorder --disable-ldap --enable-mailnews
--disable-xterm-updates --enable-strip --disable-md --disable-pedantic
--enable-double-buffer --disable-debug --enable-crypto --disable-cpp-rtti
--disable-cpp-exceptions --enable-chrome-format=jar --disable-tests

An attempt to --enable-xft results to many complaints about unresolved symbols
somewhere deep in Xft/freetype, so I omit it and stay with working variant.

The patch needed in control extensions to make them compiling under gtk2 is

--- extensions/ctl/src/pangoLite/pango-types.h.orig        Mon Nov 11 13:52:41 2002
+++ extensions/ctl/src/pangoLite/pango-types.h     Mon Nov 11 13:52:43 2002
@@ -76,8 +76,10 @@
   PangoDirection   aDir;
 };

+#ifndef MOZ_WIDGET_GTK2
 typedef guint32 gunichar;
 typedef guint16 gunichar2;
+#endif

 #define G_CONST_RETURN const

--- extensions/ctl/src/thaiShaper/thai-x.c.orig    Mon Nov 11 14:52:53 2002
+++ extensions/ctl/src/thaiShaper/thai-x.c Mon Nov 11 14:53:33 2002
@@ -105,6 +105,7 @@
 typedef guint16 PangoXSubfont;
 #define PANGO_MOZ_MAKE_GLYPH(index) ((guint32)0 | (index))

+#ifndef MOZ_WIDGET_GTK2
 char g_utf8_skip[256] = {
   1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
   1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
@@ -115,6 +116,7 @@
   2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
   3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,6,6,0,0
 };
+#endif
 #define g_utf8_next_char(p) (char*)((p) + g_utf8_skip[*(unsigned char*)(p)])


The quick and dirty hack for configure is:

--- configure.orig Sun Nov 10 20:02:47 2002
+++ configure      Mon Nov 11 20:47:05 2002
@@ -11208,7 +11208,7 @@
 fi


-if test -z "$MOZ_ENABLE_GTK" && test `echo "$MOZ_EXTENSIONS" | grep -c xmlterm`
-ne 0; then
+if test -z "$MOZ_ENABLE_GTK" -a -z "$MOZ_ENABLE_GTK2" && test `echo
"$MOZ_EXTENSIONS" | grep -c xmlterm` -ne 0; then
     echo "configure: warning: Cannot build xmlterm without gtk toolkit.
Removing xmlterm from MOZ_EXTENSIONS." 1>&2
     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xmlterm||'`
 fi
@@ -12892,13 +12892,13 @@
   if test x$libIDL_config_exec_prefix != x ; then
      libIDL_config_args="$libIDL_config_args
--exec-prefix=$libIDL_config_exec_prefix"
      if test x${LIBIDL_CONFIG+set} != xset ; then
-        LIBIDL_CONFIG=$libIDL_config_exec_prefix/bin/libIDL-config
+        LIBIDL_CONFIG=$libIDL_config_exec_prefix/bin/pkg-config
      fi
   fi
   if test x$libIDL_config_prefix != x ; then
      libIDL_config_args="$libIDL_config_args --prefix=$libIDL_config_prefix"
      if test x${LIBIDL_CONFIG+set} != xset ; then
-        LIBIDL_CONFIG=$libIDL_config_prefix/bin/libIDL-config
+        LIBIDL_CONFIG=$libIDL_config_prefix/bin/pkg-config
      fi
   fi
@@ -12930,13 +12930,13 @@
   if test x$glib_config_exec_prefix != x ; then
      glib_config_args="$glib_config_args --exec-prefix=$glib_config_exec_prefix"
      if test x${GLIB_CONFIG+set} != xset ; then
-        GLIB_CONFIG=$glib_config_exec_prefix/bin/glib-config
+        GLIB_CONFIG=$glib_config_exec_prefix/bin/pkg-config
      fi
   fi
   if test x$glib_config_prefix != x ; then
      glib_config_args="$glib_config_args --prefix=$glib_config_prefix"
      if test x${GLIB_CONFIG+set} != xset ; then
-        GLIB_CONFIG=$glib_config_prefix/bin/glib-config
+        GLIB_CONFIG=$glib_config_prefix/bin/pkg-config
      fi
   fi

@@ -12954,8 +12954,8 @@

     unset ac_cv_path_GLIB_CONFIG

-  # Extract the first word of "glib-config", so it can be a program name with args.
-set dummy glib-config; ac_word=$2
+  # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
 echo "configure:12961: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_GLIB_CONFIG'+set}'`\" = set"; then
@@ -12997,13 +12997,14 @@
   if test "$GLIB_CONFIG" = "no" ; then
     no_glib=yes
   else
-    GLIB_CFLAGS=`$GLIB_CONFIG $glib_config_args --cflags`
-    GLIB_LIBS=`$GLIB_CONFIG $glib_config_args --libs`
-    glib_config_major_version=`$GLIB_CONFIG $glib_config_args --version | \
+    GLIB_CFLAGS=`$GLIB_CONFIG --cflags glib-2.0`
+    GLIB_LIBS=`$GLIB_CONFIG --libs glib-2.0`
+    glib_config_version=`$GLIB_CONFIG --modversion glib-2.0`
+    glib_config_major_version=`echo $glib_config_version | \
            sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`
-    glib_config_minor_version=`$GLIB_CONFIG $glib_config_args --version | \
+    glib_config_minor_version=`echo $glib_config_version | \
            sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`
-    glib_config_micro_version=`$GLIB_CONFIG $glib_config_args --version | \
+    glib_config_micro_version=`echo $glib_config_version | \
            sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
     if test "x$enable_glibtest" = "xyes" ; then
       ac_save_CFLAGS="$CFLAGS"
@@ -13176,8 +13177,8 @@

     unset ac_cv_path_LIBIDL_CONFIG

-  # Extract the first word of "libIDL-config", so it can be a program name with
args.
-set dummy libIDL-config; ac_word=$2
+  # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
 echo "configure:13183: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_LIBIDL_CONFIG'+set}'`\" = set"; then
@@ -13219,17 +13220,18 @@
   if test "$LIBIDL_CONFIG" = "no" ; then
     no_libIDL=yes
   else
-    LIBIDL_CFLAGS=`$LIBIDL_CONFIG $libIDL_config_args --cflags`
-    LIBIDL_LIBS=`$LIBIDL_CONFIG $libIDL_config_args --libs`
+    LIBIDL_CFLAGS=`$LIBIDL_CONFIG --cflags libIDL-2.0`
+    LIBIDL_LIBS=`$LIBIDL_CONFIG --libs libIDL-2.0`
     # hack to allow us to keep using libIDL 0.6.3-0.6.7. Anyone may remove
     # this after we start requiring libIDL 0.6.8 or anything higher
     LIBIDL_CFLAGS="$GLIB_CFLAGS $LIBIDL_CFLAGS"
     LIBIDL_LIBS="$GLIB_LIBS $LIBIDL_LIBS"
-    libIDL_config_major_version=`$LIBIDL_CONFIG $libIDL_config_args --version | \
+    libIDL_config_version=`$LIBIDL_CONFIG --modversion libIDL-2.0`
+    libIDL_config_major_version=`echo $libIDL_config_version | \
            sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`
-    libIDL_config_minor_version=`$LIBIDL_CONFIG $libIDL_config_args --version | \
+    libIDL_config_minor_version=`echo $libIDL_config_version | \
            sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`
-    libIDL_config_micro_version=`$LIBIDL_CONFIG $libIDL_config_args --version | \
+    libIDL_config_micro_version=`echo $libIDL_config_version | \
            sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
     if test "x$enable_libIDLtest" = "xyes" ; then
       ac_save_CFLAGS="$CFLAGS"
@@ -13406,7 +13408,7 @@
   rm -f conf.libIDLtest

                     if test -n "$_LIBIDL_NOT_FOUND" && test -z
"$CROSS_COMPILE"; then
-        for ac_prog in $ORBIT_CONFIG orbit-config
+        for ac_prog in $ORBIT_CONFIG pkg-config
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
@@ -13447,8 +13449,8 @@
 done

         if test -n "$ORBIT_CONFIG"; then
-               _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
-           _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
+               _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags ORBit-2.0`
+           _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs ORBit-2.0`
             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f
=~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f
=~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
             LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
@@ -13468,15 +13470,15 @@
         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
     fi
     if test -n "$HOST_LIBIDL_CONFIG"; then
-        HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags`
-        HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs`
+        HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags libIDL-2.0`
+        HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs libIDL-2.0`
     else
         HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS"
         HOST_LIBIDL_LIBS="$LIBIDL_LIBS"
     fi
     if test "$OS_TARGET" = "POSIX_for_OpenVMS_AXP"; then
-      LIBIDL_CFLAGS=`${LIBIDL_CONFIG}-VMS --cflags`
-      LIBIDL_LIBS=`${LIBIDL_CONFIG}-VMS --libs`
+      LIBIDL_CFLAGS=`${LIBIDL_CONFIG}-VMS --cflags libIDL-2.0`
+      LIBIDL_LIBS=`${LIBIDL_CONFIG}-VMS --libs libIDL-2.0`
     fi
 fi

@@ -13510,13 +13512,13 @@
   if test x$glib_config_exec_prefix != x ; then
      glib_config_args="$glib_config_args --exec-prefix=$glib_config_exec_prefix"
      if test x${GLIB_CONFIG+set} != xset ; then
-        GLIB_CONFIG=$glib_config_exec_prefix/bin/glib-config
+        GLIB_CONFIG=$glib_config_exec_prefix/bin/pkg-config
      fi
   fi
   if test x$glib_config_prefix != x ; then
      glib_config_args="$glib_config_args --prefix=$glib_config_prefix"
      if test x${GLIB_CONFIG+set} != xset ; then
-        GLIB_CONFIG=$glib_config_prefix/bin/glib-config
+        GLIB_CONFIG=$glib_config_prefix/bin/pkg-config
      fi
   fi

@@ -13534,8 +13536,8 @@

     unset ac_cv_path_GLIB_CONFIG

-  # Extract the first word of "glib-config", so it can be a program name with args.
-set dummy glib-config; ac_word=$2
+  # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
 echo "configure:13541: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_GLIB_CONFIG'+set}'`\" = set"; then
@@ -13577,13 +13579,14 @@
   if test "$GLIB_CONFIG" = "no" ; then
     no_glib=yes
   else
-    GLIB_CFLAGS=`$GLIB_CONFIG $glib_config_args --cflags`
-    GLIB_LIBS=`$GLIB_CONFIG $glib_config_args --libs`
-    glib_config_major_version=`$GLIB_CONFIG $glib_config_args --version | \
+    GLIB_CFLAGS=`$GLIB_CONFIG --cflags glib-2.0`
+    GLIB_LIBS=`$GLIB_CONFIG --libs glib-2.0`
+    glib_config_version=`$GLIB_CONFIG --modversion glib-2.0`
+    glib_config_major_version=`echo $glib_config_version | \
            sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`
-    glib_config_minor_version=`$GLIB_CONFIG $glib_config_args --version | \
+    glib_config_minor_version=`echo $glib_config_version | \
            sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`
-    glib_config_micro_version=`$GLIB_CONFIG $glib_config_args --version | \
+    glib_config_micro_version=`echo $glib_config_version | \
            sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
     if test "x$enable_glibtest" = "xyes" ; then
       ac_save_CFLAGS="$CFLAGS"
@@ -13757,7 +13760,7 @@
 fi

 if test -z "${GLIB_GMODULE_LIBS}" ; then
-    GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
+    GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule-2.0 --libs`
 fi




Huh. I only hope the patch wasn't mangled when copy-pasting it here. Guys, this
form isn't that good for supplying patches. Some file uploading form must be. I
can send patch upon request.

Finally, the problem appears with making options in extensions/xmlterm, because
autoconf.mk produces Makefile with

CXXFLAGS += $(MOZ_GTK_CFLAGS)

string which is better to be replaced with

CXXFLAGS += $(TK_CFLAGS)

one to have xmlterm compiled with GTK2. I did not find the right place for
patching so I've patched Makefiles after they were built.

Well, that's all, folks. Have a nice Mozilla
Keywords: patch
Blocks: gtk2
http://bugzilla.mozilla.org/attachment.cgi?bugid=179512&action=enter lets you
upload a file... (it's not present on the bug reporting form, but once you
report a bug, the link is there -- "Create a New Attachment").
Status: UNCONFIRMED → NEW
Ever confirmed: true
BTW, soon I've found that any "Choose File/Save File" dialog provides me with
filenames which look like chinese signs and question marks instead of latin
symbols. That's only obvious bug I can see, quite annoying, though. Sorry, dunno
what category it is to submit separate PR.
How about try newer mozilla source instead of mozilla-source-1.1.tar.gz? such as
checkout from trunk? the situation should be better. I think.
well, it is better. There a few patches still, though, and one thing which
remains unpatched 'cause I don't know where to look at. The problem is still
with "save as" and "choose file" dialogs, they show me chinese signs and
question marks instead of latin. I have LANG=ru_RU.KOI8-R and Mozilla's locale
en_US and I don't know why it affects latin symbols.

Regarding patches: configure still refuses to build xmlterm with GTK2 w/o little
patch, and there's a problem inside xmlterm's Makefiles in base/ and build/
subdirs which can be covered by another little patch. I attach patches below.

BTW, Mozilla still refuses to build with libart_lgpl2 (--enable-svg option), but
that's minor problem
cd mozilla
patch < /path/to/patch

now xmlterm is recognized as available for building with GTK2
cd mozilla/extensions/xmlterm/base
patch < /path/to/patch
cd ../build
patch < /path/to/patch

now you can build xmlterm with GTK2
problem seems to be completely resolved in current mozilla source
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: