Hi everybody,

My efforts to make GUB fit for the Cairo backend patch came to the following 
result:

Building  of LilyPond with the cairo backend code and the old versions of 
Pixman and Cairo included in Gub works fine. Old Cairo means that pdfs are 
generated without hyperlinks and without metadata.

Building of Lilypond with the cairo backend code and the current stable 
versions of Pixman 0.40.0 and Cairo 1.16.0  works fine for the linux-x86, 
darwin-x86 and linux-64 platforms.

For the mingw platform building of Pixman 0.40  fails. Pixman 0.30, the minimum 
version required by Cairo 1.16.0, fails with the same problem, so there is no 
need to work on anything but the latest stable code.

Pixman 0.40 initially failed for all platforms, but adding appropriate LDFLAGS 
helped for linux.* and darwin-x86. See pixman-new.py.

It's also a linker problem with mingw, but this problem proves to be hard for 
me. I tried many more or less obvious link options and searched google's 
advice, but I simply was unable to persuade the linker to resolve the PNG 
symbols that are in the libpng given on the command line.

An excerpt from the log of a 'bin/gub mingw::pixman-new' run:

libtool: link: i686-mingw32-gcc -mwindows -mms-bitfields -g -O2 -Wall -Wdeclaration-after-statement -Wno-unused-local-typedefs -fno-strict-aliasing -pthread -g -O2 -Wall -Wdeclaration-after-statement -Wno-unused-local-typedefs -fno-strict-aliasing -pthread -o .libs/region-test.exe region-test.o  -L/home/gub/gub/target/mingw/root/usr/lib -L/home/gub/gub/target/mingw/root/usr/bin -L/home/gub/gub/target/mingw/root/usr/lib/w32api ./.libs/libutils.a ../pixman/.libs/libpixman-1.dll.a /home/gub/gub/target/mingw/root/usr/lib/libpng12.dll.a -lz -pthread -Wl,-rpath -Wl,/home/gub/gub/target/mingw/root/usr/lib -Wl,-rpath -Wl,'$'ORIGIN/../lib -Wl,-rpath -Wl,/home/gub/gub/target/mingw/root/usr/lib libtool: link: i686-mingw32-gcc -mwindows -mms-bitfields -g -O2 -Wall -Wdeclaration-after-statement -Wno-unused-local-typedefs -fno-strict-aliasing -pthread -g -O2 -Wall -Wdeclaration-after-statement -Wno-unused-local-typedefs -fno-strict-aliasing -pthread -o .libs/region-translate-test.exe region-translate-test.o -L/home/gub/gub/target/mingw/root/usr/lib -L/home/gub/gub/target/mingw/root/usr/bin -L/home/gub/gub/target/mingw/root/usr/lib/w32api ./.libs/libutils.a ../pixman/.libs/libpixman-1.dll.a /home/gub/gub/target/mingw/root/usr/lib/libpng12.dll.a -lz -pthread -Wl,-rpath -Wl,/home/gub/gub/target/mingw/root/usr/lib -Wl,-rpath -Wl,'$'ORIGIN/../lib -Wl,-rpath -Wl,/home/gub/gub/target/mingw/root/usr/lib
./.libs/libutils.a(utils.o): In function `write_png':
/home/gub/gub/target/mingw/src/pixman-new-0.40.0/test/utils.c:683: undefined 
reference to `png_create_write_struct'
/home/gub/gub/target/mingw/src/pixman-new-0.40.0/test/utils.c:687: undefined 
reference to `png_create_info_struct'
/home/gub/gub/target/mingw/src/pixman-new-0.40.0/test/utils.c:690: undefined 
reference to `png_init_io'
/home/gub/gub/target/mingw/src/pixman-new-0.40.0/test/utils.c:692: undefined 
reference to `png_set_IHDR'
/home/gub/gub/target/mingw/src/pixman-new-0.40.0/test/utils.c:697: undefined 
reference to `png_write_info'
/.home//gub/.gublibs//target/libutils.amingw(/utils.osrc)/:pixman -newIn- 
0.40.0function/ test`/utils.cwrite_png:'699::
 /undefinedhome /referencegub /togub /`targetpng_write_image/'mingw
//srchome//pixmangub-/gubnew/-target0.40.0//mingwtest//src/utils.cpixman:-new683-:0.40.0
 /undefinedtest /utils.creference: 701to : `undefinedpng_create_write_struct 
'reference
 /tohome /`gubpng_write_end/'gub
//targethome//mingwgub//srcgub//pixmantarget/-mingwnew/-src0.40.0/pixman/-testnew/-utils.c0.40.0/:test687/:utils.c
 :undefined706 : referenceundefined  toreference `topng_create_info_struct '`
png_destroy_write_struct/'home
/gub/gub/target/mingw/src/pixman-new-0.40.0/test/utils.c:690: undefined 
reference to `png_init_io'
/home/gub/gub/target/mingw/src/pixman-new-0.40.0/test/utils.c:692: undefined 
reference to `png_set_IHDR'
/home/gub/gub/target/mingw/src/pixman-new-0.40.0/test/utils.c:697: undefined 
reference to `png_write_info'
/home/gub/gub/target/mingw/src/pixman-new-0.40.0/test/utils.c:699: undefined 
reference to `png_write_image'
/home/gub/gub/target/mingw/src/pixman-new-0.40.0/test/utils.c:701: undefined 
reference to `png_write_end'
/home/gub/gub/target/mingw/src/pixman-new-0.40.0/test/utils.c:706: undefined 
reference to `png_destroy_write_struct'

Attached are my modified gub/gub/spec files for the old versions (pixman.py, 
cairo.py) and spec files for the current versions of pixman and cairo (*new.py).

Any idea how to solve the problem is welcome. Thanks in advance!

Knut

from gub import target

class Pixman (target.AutoBuild):
    source = 'https://src.fedoraproject.org/repo/pkgs/pixman/pixman-0.13.2.tar.gz/837df4a02c61a60a880644393b57faed/pixman-0.13.2.tar.gz'
    dependencies = ['libtool']
    def get_conflict_dict (self):
      return {'': ['pixman-new'],
              'doc': ['pixman-new-doc'],
              'devel': ['pixman-new-devel']}

class Pixman__linux__ppc (Pixman):
    patches = ['pixman-0.13.2-auxvec.patch']
from gub import target

class Pixman_new (target.AutoBuild):
    source = 'https://www.cairographics.org/releases/pixman-0.40.0.tar.gz'
    dependencies = ['libtool']
    dependencies = ['tools::libtool',
                    'libpng-devel' ]
    configure_flags = (target.AutoBuild.configure_flags
                )
    def get_conflict_dict (self):
      return {'': ['pixman'],
              'doc': ['pixman-doc'],
              'devel': ['pixman-devel']}

class Pixman_new__linux (Pixman_new):
    configure_flags = (Pixman_new.configure_flags
                + 'LDFLAGS="-dy"' )

# LDFLAGS: see e.g. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39888
class Pixman_new__darwin__x86 (Pixman_new):
    configure_flags = (Pixman_new.configure_flags
                + 'LDFLAGS=-lgcc_eh' )


class Pixman_new__mingw (Pixman_new):
    dependencies = (Pixman_new.dependencies
                # + ['mingw-w64-runtime']
                )
    configure_flags = (Pixman_new.configure_flags
                )
from gub import target


class Cairo (target.AutoBuild):
    source = 'http://www.cairographics.org/releases/cairo-1.8.8.tar.gz'
    def patch (self):
        target.AutoBuild.patch (self)
        self.system ('rm -f %(srcdir)s/src/cairo-features.h')
    configure_flags = (target.AutoBuild.configure_flags
                 + '--disable-xlib'
                 + '--disable-xlib-xrender'
                 + '--disable-xcb'
                 + '--disable-poppler' )
    dependencies = ['tools::libtool',
                'fontconfig-devel',
                'ghostscript-devel',
                'libpng-devel',
                'pixman-devel',
                'zlib-devel']
    def get_conflict_dict (self):
      return {'': ['cairo-new'],
              'doc': ['cairo-new-doc'],
              'devel': ['cairo-new-devel']}


class Cairo__mingw (Cairo):
    configure_flags = (Cairo.configure_flags
                + ' --enable-ft'
                + ' LDFLAGS="-lpthread -llibpng12"'
                )
    dependencies = (Cairo.dependencies
                    + ['mingw-w64-runtime'])



class Cairo__darwin (Cairo):
    dependencies = ([x for x in Cairo.dependencies
                 if 'libx' not in x
                 and 'poppler' not in x] # poppler does not build for mingw
                )
    pass

class Cairo__darwin__ppc (Cairo__darwin):
    patches = Cairo__darwin.patches + [
        'cairo-1.8.8-darwin-ppc.patch',
        ]
from gub import target


class Cairo_new (target.AutoBuild):
    source = 'https://www.cairographics.org/releases/cairo-1.16.0.tar.xz'
    def patch (self):
        target.AutoBuild.patch (self)
        self.system ('rm -f %(srcdir)s/src/cairo-features.h')
    configure_flags = (target.AutoBuild.configure_flags
                    + '--disable-xlib'
                    + '--disable-xlib-xrender'
                    + '--disable-xcb'
                    + '--disable-poppler' )
    dependencies = ['tools::libtool',
                    'fontconfig-devel',
                    'ghostscript-devel',
                    'glib-devel',
                    'libpng-devel',
                    'pixman-new-devel',
                    'zlib-devel']
    def get_conflict_dict (self):
      return {'': ['cairo'],
              'doc': ['cairo-doc'],
              'devel': ['cairo-devel']}



class Cairo_new__darwin (Cairo_new):
    configure_flags = (Cairo_new.configure_flags
                    + ' CFLAGS="-D CAIRO_NO_MUTEX=1"' )
    dependencies = ([x for x in Cairo_new.dependencies
                 if 'libx' not in x
                 and 'poppler' not in x] # poppler does not build for mingw ???? old comment, test
                )


class Cairo_new__mingw (Cairo_new):
    configure_flags = (Cairo_new.configure_flags
                    + ' --enable-ft'
                    + ' LDFLAGS="-lpthread -llibpng12"')
    dependencies = (Cairo_new.dependencies
                    + ['mingw-w64-runtime'])

Reply via email to