On 05/04/2011 03:58, Yaakov (Cygwin/X) wrote:
> On Mon, 2011-04-04 at 14:23 +0100, Jon TURNEY wrote:
>> I tried jhbuilding the entire X.Org stack using these, and while there are
>> several issues with cross-compiling that source which need fixing,
> 
> Here's what I'm aware of, having built RPMs for the X.Org libraries:
> 
> 1) src/util/makekeys in libX11 is a build-native noinst tool used in the
> buildsystem to create a file.  Building it on Linux when cross-compiling
> for Cygwin required overriding X11_CFLAGS (which would get Cygwin's
> system headers instead of glibc's), EXEEXT, and LIBTOOL to
> use /usr/bin/libtool (native) instead of $(top_builddir)/libtool
> (cross).
> 
> 2) Ditto for util/makestrs in libXt.

Have to put this stuff back into fontconfig as well, after commit [1]

"Make most generated-files cross-compiling-safe by simply including a copy in
the tarball." does not work well for cross-compiling from git :-)

[1]
http://cgit.freedesktop.org/fontconfig/commit/?id=2a6b235ff6d2750171e8dff7cfdfe3bccb0f630e

> 3) As we discussed elsewhere, Mesa is clearly not intended for
> cross-compiling.  mklib needs a patch to use cross-ar and cross-ranlib,
> and it still needs to be told what system to build for.

Yes, I'm ignoring mesa for the moment

> What else have you encountered?

In addition to those issues:

4) libXt contains an unguarded AC_HAVE_LIBRARY(ws2_32)

This is just wrong anyhow, but for some reason causes libtool to make libXt
and everything which links to it as a static libary only, which then causes
problems building various apps which link with libXaw7 and libXt, as these
cannot both co-exist as static libraries as they contain a DllMain...

5) Configuring fontconfig with
--with-freetype-config=/usr/i686-pc-cygwin/sys-root/usr/bin/freetype-config, I
needed to patch that freetype-config, which at the moment unconditionally uses
pkg-config, so it checks PKG_CONFIG instead and so will use the cross
pkg-config if needed (it returns bogus paths if it uses the native pkg-config
and a native freetype-devel package isn't installed)

6) font-util macros needs patching so that all font packages don't try to run
mkfontdir when cross-compiling.

Patches attached.

>> I also hit a couple of snags with the tool-chain:
>>
>> 1) i686-pc-cygwin-pkg-config appears to be implemented as a script which
>> ultimately executes a macro from /etc/rpm/macros.cygwin, which sets
>> PKG_CONFIG_LIBDIR to the sysroot and unsets PKG_CONFIG_PATH and invokes the
>> native pkg-config.
>>
>> Unfortunately, this seems to make it impossible to build package A and then
>> build package B which uses pkg-config to depend on A, without installing A
>> into your sysroot.
>>
>> It looks like I'm not the only one to have tripped across this problem, see
>> e.g. [1],[2].
> 
> As I commented in RH bug 668171, it should be safe to allow
> PKG_CONFIG_PATH in the macro used by $host-pkg-config for cases such as
> this, while continuing to unset it in %_cygwin_env when building RPM
> packages.  I've uploaded cygwin-filesystem-4-1 with this change (among
> others); please let me know if that works for you.
> 
>> 2) Some X.Org components don't build with unresolved symbols at link time.
>> The link line generated by the cross-tools contains fewer libraries to that
>> generated by cygwin native tools, I think because the Fedora native 
>> pkg-config
>> wasn't configured with --enable-indirect-deps, which doesn't seem to have an
>> equivalent runtime flag.
> 
> That sounds plausible.  I didn't encounter this with the libraries, but
> you built the apps as well.  I would say that any apps with inadequate
> deps should be fixed in the PKG_CHECK_MODULES call in configure.ac.

I'm not sure that's the correct solution as adding those additional, indirect
deps to PKG_CHECK_MODULES would lead to overlinking on ELF platforms?

Example: bdftopcf only has a PKG_CHECK_MODULES(BDFTOPCF, xfont), so the Fedora
native pkg-config generates BDFTOPCF_LIBS containing only -lXfont, and so
fails to link with unresolved symbols from zlib, required by libXfont.

I built a cross pkg-config with the following configuration, which seems to
work ok.

./configure --enable-indirect-deps --prefix=/usr
--program-prefix=i686-pc-cygwin- --target=i686-pc-cygwin
--with-pc-path=/usr/i686-pc-cygwin/sys-root/usr/lib/pkgconfig
--with-installed-glib --with-installed-popt

(although it should also have /usr/i686-pc-cygwin/sys-root/usr/share/pkgconfig
and /usr/share/pkgconfig in the default pc-path, I wasn't sure of the syntax
to achieve that :-))
--- freetype-config     2011-03-15 02:44:18.000000000 +0000
+++ freetype-config.new 2011-04-06 11:21:02.837249915 +0100
@@ -9,11 +9,12 @@
 # indicate that you have read the license and understand and accept it
 # fully.
 
-prefix=`pkg-config --variable prefix freetype2`
-exec_prefix=`pkg-config --variable exec_prefix freetype2`
+pkgconfig=${PKG_CONFIG:-pkg-config}
+prefix=`$pkgconfig --variable prefix freetype2`
+exec_prefix=`$pkgconfig --variable exec_prefix freetype2`
 exec_prefix_set=no
-includedir=`pkg-config --variable includedir freetype2`
-libdir=`pkg-config --variable libdir freetype2`
+includedir=`$pkgconfig --variable includedir freetype2`
+libdir=`$pkgconfig --variable libdir freetype2`
 enable_shared=
 wl=-Wl,
 hardcode_libdir_flag_spec='-L$libdir'
>From b07b806ff45c82b274856c80e0916620a9a6811c Mon Sep 17 00:00:00 2001
From: Jon TURNEY <[email protected]>
Date: Wed, 6 Apr 2011 11:38:13 +0100
Subject: [PATCH libXt] Only link with ws2_32 for mingw target

For the Cygwin target, we will be using the socket functions provided
by the Cygwin DLL

Signed-off-by: Jon TURNEY <[email protected]>
---
 configure.ac |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index d18b0fe..37cb6bd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -86,7 +86,14 @@ case $host_os in
        ;;
 esac
 
-AC_HAVE_LIBRARY(ws2_32)
+# Link with winsock for mingw32 platform
+case $host_os in
+       *mingw32*)
+               AC_HAVE_LIBRARY(ws2_32)
+       ;;
+       *)
+       ;;
+esac
 
 # Options
 AC_ARG_ENABLE(xkb, AS_HELP_STRING([--disable-xkb], [Disable XKB support]),
-- 
1.7.4

>From 8d0b2b090a9f5d82996f33a0443f1b39f7959622 Mon Sep 17 00:00:00 2001
From: Jon TURNEY <[email protected]>
Date: Wed, 6 Apr 2011 11:26:24 +0100
Subject: [PATCH font/util] Don't run mkfontdir and fc-cache if cross-compiling


Signed-off-by: Jon TURNEY <[email protected]>
---
 fontutil.m4.in |   31 +++++++++++++++++++++++++++----
 1 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/fontutil.m4.in b/fontutil.m4.in
index b2b9bd8..4d1372e 100644
--- a/fontutil.m4.in
+++ b/fontutil.m4.in
@@ -160,15 +160,16 @@ AC_DEFUN([XORG_FONT_REQUIRED_PROG],[
 #
 # Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
 # Set RUN_FCCACHE to a rule suitable for substituting into a makefile
-# to run fc-cache if found and not installing to $DESTDIR
+# to run fc-cache if found and not installing to $DESTDIR and not
+# cross-compiling
 #
 # fc-cache is optional, not required, and should be skipped when making
-# packages (installing to $DESTDIR).
+# packages (installing to $DESTDIR) or cross-compiling
 #
 AC_DEFUN([XORG_FONT_FCCACHE],[
        AC_PATH_PROG(FCCACHE, fc-cache)
        FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** 
Generate this file manually on host system using fc-cache"'
-       if test x"$FCCACHE" = x ; then
+       if test x"$FCCACHE" = x || test x"$cross_compiling" != x"no" ; then
                RUN_FCCACHE="${FCCACHE_WARN}"
        else
                RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) 
$(fontdir); $(FCCACHE) $(fontdir); else'
@@ -177,6 +178,28 @@ AC_DEFUN([XORG_FONT_FCCACHE],[
        AC_SUBST([RUN_FCCACHE])
 ])
 
+# XORG_FONT_MKFONTDIR()
+# -------------------
+# Minimum version: 1.1.1
+#
+# Set MKFONTDIR to path to mkfontdir if found and not cross-compiling,
+# otherwise a shell command which warns mkfontdir needs to be run on
+# target
+#
+AC_DEFUN([XORG_FONT_MKFONTDIR],[
+       AC_PATH_PROG(MKFONTDIR, mkfontdir)
+       MKFONTDIR_WARN='echo "** Warning: mkfontdir not run" ; echo "** Run 
mkfontdir manually on host system"'
+
+       if test x"$cross_compiling" != x"no" ; then
+          MKFONTDIR="${MKFONTDIR_WARN} ; echo '** mkfontdir'"
+       else
+          if test x"$MKFONTDIR" = x; then
+             AC_MSG_ERROR([mkfontdir is required to build $PACKAGE_NAME.])
+          fi
+       fi
+
+       AC_SUBST([MKFONTDIR])
+])
 
 # XORG_FONT_COMMON_UTILS()
 # ------------------------
@@ -186,7 +209,7 @@ AC_DEFUN([XORG_FONT_FCCACHE],[
 
 AC_DEFUN([XORG_FONT_COMMON_UTILS],[
        XORG_FONT_FCCACHE
-       XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
+       XORG_FONT_MKFONTDIR
 ])
 
 # XORG_FONT_SCALED_UTILS()
-- 
1.7.4

------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Cygwin-ports-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cygwin-ports-general

Reply via email to