MacOSX version of Scribus

From Scribus Wiki
Revision as of 21:01, 5 March 2005 by Mhanski (talk | contribs)
Jump to navigation Jump to search
This article is part of the Ongoing Discussions series.
Installation Usability MacOS Fonts Other

On the Scribus mailing list, Andreas Vox have started an interesting discussion on bringing Scribus natively to Mac OSX. Join in with your opinion!


http://nashi.altmuehlnet.de/pipermail/scribus/2005-March/009442.html

I noticed that you still require X11 for the MacOSX version of Scribus.

I managed to compile Scribus 1.2.1 with Qt/Mac native and I wondered if you'd like to get some hints how it is done. In fact it was quite easy once I solved my libtool problems (screenshot attached :-) )

So this is what I did:

0. Started with the Scribus 1.2.1 sources

1. configured Scribus to use Qt/Mac inbstead of the fink Qt version

2. replaced all gdk-* sourcefiles with empty files

3. commented out all #include <X11.h> etc.

4. Removed GC from scpainter

5. Rewrote scpainter::end():

void ScPainter::end()
{
        QImage qimg(m_width, m_height, 32, QImage::BigEndian);
        QRgb * bits = (QRgb *) qimg.bits();
        int words = qimg.numBytes() / 4;
        art_u8 * p = m_buffer;;
        for (int i=0; i < words; ++i) {
                art_u8 r = *p++;
               art_u8 g = *p++;
               art_u8 b = *p++;
               art_u8 a = *p++;
               *bits++ = qRgba(r,g,b,a);
        }
        bitBlt(m_target, 0, 0, &qimg);
}


6. libtool nuisances:

6a) Apply fink patch to use correct -bundle for libtool

6b) Remove -s option (stripping is no good idea if you want to link plugins)

7. Make Scribus ignore any "-psn_*" commandline options passed by Qt

8. Adjust a few #includes to MacOSX

9. Created a rudimentary Scribus.app/ bundle (thanks to Ronald Florence who did the same for LyX so I just had to replace a few strings)

The application still uses the files (plugins etc.) which Scribus installs to /usr/local. The following libraries get linked:

/Applications/local/Scribus.app/Contents/MacOS/scribus:
/sw/lib/libjpeg.62.dylib (compatibility version 63.0.0, current version 63.0.0)
/sw/lib/libart_lgpl_2.2.dylib (compatibility version 6.0.0, current version 6.16.0)
/usr/local/lib/libfreetype6.dylib (compatibility version 6.2.0, current version 6.3.4)
/usr/lib/libcups.2.dylib (compatibility version 2.0.0, current version 2.5.0)
/usr/lib/libssl.0.9.7.dylib (compatibility version 0.9.7, current version 0.9.7)
/usr/lib/libcrypto.0.9.7.dylib (compatibility version 0.9.7, current version 0.9.7)
/sw/lib/liblcms.1.dylib (compatibility version 2.0.0, current version 2.12.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 71.1.1)
/sw/lib/libtiff.3.dylib (compatibility version 3.6.0, current version 3.6.1)
libqt-mt.3.dylib (compatibility version 3.3.0, current version 3.3.3)
/sw/lib/libpng.3.dylib (compatibility version 3.0.0, current version 3.0.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.0.0)

I still have problems with some plugins and some icons don't show, but otherwise it's usable. Anyone who want's to test and help finishing it to a proper MacOSX application?

Regards Andreas

Ah, yes, the screenshot:

scribus-screen-shot-small-0001.jpg


http://nashi.altmuehlnet.de/pipermail/scribus/2005-March/009443.html

http://nashi.altmuehlnet.de/pipermail/scribus/2005-March/009444.html


Looks great.. erm.. what replaces the gdk sources then?

and what replaces the X call(s) in scfonts.cpp ? Does this mean you always have to add in the font paths via the additional font paths setup?

Craig


http://nashi.altmuehlnet.de/pipermail/scribus/2005-March/009447.html

This does seem extremely interesting. I've been meaning to try an Aqua- native port of 1.3cvs for a while, but I just don't have the mac development experience, and there was the gdk-pixbuf issue to consider.

Like Craig Bradney, I'd be very interested in knowing how you handled fonts and how you worked around the gdk dependencies.

From what I see in your library list below, I see that you still link to quite a few fink-supplied libraries. I imagine we'd have to ship prebuilt copies of those, or statically link them, with any "installable" Aqua Scribus build. Sound about right?


9. Created a rudimentary Scribus.app/ bundle (thanks to Ronald Florence who did the same for LyX so I just had to replace a few strings)


That's very, very useful to know.

Did you end up using Xcode for all this, or just tweaked the existing build to use Qt/Aqua?


/sw/lib/libjpeg.62.dylib (compatibility version 63.0.0, current version 63.0.0)


Does MacOS X not provide libjpeg? That's from fink by the looks...


/sw/lib/libart_lgpl_2.2.dylib (compatibility version 6.0.0, current version 6.16.0)


I imagine we'd have to bundle or statically link libart.


/usr/local/lib/libfreetype6.dylib (compatibility version 6.2.0, current version 6.3.4)

/usr/local/lib . Interesting. Did you compile a Mac-native version of freetype yourself, or use an installer package or something?

/usr/lib/libcups.2.dylib (compatibility version 2.0.0, current version 2.5.0)


Glad to see we can rely on MacOS/X for CUPS libraries.


/usr/lib/libssl.0.9.7.dylib (compatibility version 0.9.7, current version 0.9.7)

/usr/lib/libcrypto.0.9.7.dylib (compatibility version 0.9.7, current version 0.9.7)

/sw/lib/liblcms.1.dylib (compatibility version 2.0.0, current version 2.12.0)


Fink again. I guess that'd be another static linking candidate.


/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 71.1.1)


Is this MacOS/X's libc equivalent? Or does it provide the core Aqua routines etc?


/sw/lib/libtiff.3.dylib (compatibility version 3.6.0, current version 3.6.1)


Hmm, you got libtiff from fink too. Again, I'm rather surprised OS/X doesn't include that.


libqt-mt.3.dylib (compatibility version 3.3.0, current version 3.3.3)

/sw/lib/libpng.3.dylib (compatibility version 3.0.0, current version 3.0.0)


libpng from fink too :-(


Anyone who want's to test and help finishing it to a proper MacOSX application?


Me!

Especially if you can give some more detailed info, especially about how you did the build and where the various libraries are from.

One thing I'm curious about... I know MacOS/X has five different major APIs:

       Carbon         (Cleaned up OS/9)
       Classic        (Virtual OS/9 for unchanged apps)
       Cocoa          (Native MacOS/X Objective C/Aqua)
       Java           (duh!)
       POSIX/BSD/X11  (unix-style apps, usually console or X11 based)

but I was always under the impression they were rather separate, and one couldn't for example write a POSIX/BSD app that used Cocoa (Aqua) graphics. I also thought Cocoa apps had to link to 'Libraries' and 'Frameworks' that were different from the POSIX/BSD style shared libraries.

Do you know if this distinction is less strict than I thought, and one can mix and match to an extent? Or is Qt doing some magic to protect us from these issues? Can we do things like use the MacOS/X font APIs? Have you built Scribus as a Cocoa application, a POSIX/BSD app, or some hybrid of the two?

If you know where I can go to find out more about MacOS/X development and porting from UNIX, that'd be really handy too...

(It's funny - I don't actually like macs. But I still want to help port Scribus across.)

-- Craig Ringer


http://nashi.altmuehlnet.de/pipermail/scribus/2005-March/009448.html

On Sat, 2005-03-05 at 09:41 +0100, Craig Bradney wrote:

and what replaces the X call(s) in scfonts.cpp ? Does this mean you always have to add in the font paths via the additional font paths setup?

I expect fontconfig, as used in 1.3, should work fine for this job. It probably won't permit the use of MacOS9 style resource-fork-based fonts (PostScript / Type 1 and TrueType) or OS/X native style .dfont fonts, though.

I'm rather more curious about what replaced gdk-* and the more general issues with how it all works, though.

-- Craig Ringer


http://nashi.altmuehlnet.de/pipermail/scribus/2005-March/009452.html

Please sign me up for the porting/testing effort for the native Aqua Scribus. I spent months last year trying to get it to build. Alas, I don't know C++ at all, and always had to stop when I ran into the screenpaint/X11 calls: just didn't know how to work around them.

I've gotten pretty knowledgable about building and deploying app bundles from Qt, however: I'm comfortable with Qt/Mac from a build standpoint, so I think I can help there.

It may not be possible to have the ideal binary distribution, which is a ~ standalone, drag-and-drop app bundle. One can do that if you compile Qt to be statically linked, rather than dynamically linked. However, I know Scribus has other external dependencies as well. Still, if Scribus can be built against a static Qt, then it should be simple to isolate the other external dependencies (libtif? etc.) into a Mac pkg installer. A standard Mac user in Scribus' target market (publishing, graphics) isn't going to want to install all of Qt just to run Scribus, even if you provide a binary installer (I maintain PyQt for the Mac with a binary installer, so I have some insight here).

The example of Gimp.app (a Mac app bundle of Gimp 2.2.x) is instructive here: it's become wildly popular in terms of downloads because it wraps all the Gimp binaries and GTK libraries into a single app bundle. Its only external dependency is Apple's X11 environment.

One area where we'd have to tread carefully is if the Scribus build links to Fink libraries. That complicates matters, for several reasons. One, the goal should be to make Scribus as standalone/isolated as possible; I don't think that requiring a separate installation of Fink should be part of this. Also, the Fink leaders are serious about enforcing GPL on their packages: I was warned last year when I asked about making an X11 app bundle of Scribus that I'd have to carefully document all my steps, make all my source code available, etc. I decided all that was too complex for me to undertake by myself. If Fink winds up being part of this equation, then I just want to highlight the due diligence that would need to be taken. Perhaps Martin can provide advice on this front.

Another question: where should this project be hosted? My little AquaScribus app launcher is available from the Scribus site, as well as from my own server, but it's a very small download. Depending on the libraries, a Mac pkg installer of Scribus could be 20-50 megabytes to download. Can the Scribus servers in the UK handle this, or should a Sourceforge project be set up for the back end?

I'm incredibly excited about this: I've been wanting to ditch my Microsoft/Adobe toolchain in my publishing business (I publish about 50 poetry books per year via POD) for some time, but Scribus hasn't been quite mature enough for my needs. (I have used it successfully with cover design only, so I know that Scribus can handle commercial work, but those covers were more work than a comparable version in InDesign would be.) With 1.2.1 supporting styled text import, it looks like Scribus may have crossed that threshold. And with NeoOffice J running natively on the Mac, that and Scribus.app would allow me to ditch X11 for everything except Gimp.

So, just let me know what I need to do! I can't wait!

- -- Cheers,

Kevin Walzer, PhD


http://nashi.altmuehlnet.de/pipermail/scribus/2005-March/009460.html

Kevin Walzer wrote:

The example of Gimp.app (a Mac app bundle of Gimp 2.2.x) is instructive here: it's become wildly popular in terms of downloads because it wraps all the Gimp binaries and GTK libraries into a single app bundle. Its only external dependency is Apple's X11 environment.

Gimp.app uses a whole bunch of dynamic libraries from Fink. It just puts them into the bundle and ships them with the app. Scribus.app could do the same, at least for the smaller libs. I agree that libqt is perhaps better linked statically if possible.

One area where we'd have to tread carefully is if the Scribus build links to Fink libraries. That complicates matters, for several reasons. One, the goal should be to make Scribus as standalone/isolated as possible; I don't think that requiring a separate installation of Fink should be part of this. Also, the Fink leaders are serious about enforcing GPL on their packages: I was warned last year when I asked about making an X11 app bundle of Scribus that I'd have to carefully document all my steps, make all my source code available, etc. I decided all that was too complex for me to undertake by myself. If Fink winds up being part of this equation, then I just want to highlight the due diligence that would need to be taken. Perhaps Martin can provide advice on this front.

Actually I even annoyed the guy who distributes Gimp.app until he provided a detailed account of his build procedure. He has such a text now on his web site at http://gimp-app.sourceforge.net/gimp.app.howto.txt, and I think this is a good thing. It can be useful for example for a project like Scribus.app. That's is the idea of this part of the GPL, namely to allow others to learn from your work.

I don't see any conflict between Fink and a possible standalone Scribus.app. I could even imagine a Fink package that produces this standalone Scribus.app which could then be distributed from the scribus servers. Just because such a thing has not yet been done, doesn't mean it is impossible.

There is another example of a Mac app bundle made with the help of Fink: Nicotine.app http://nicotine-app.sourceforge.net/cgi-bin/wiki.pl. The maintainer of this project (vasi) is also one of the main Fink developers. On that page there are even two more app bundles made in the same way. All these app bundles are running with X11, though.


So, just let me know what I need to do! I can't wait!


The first and foremost point is to get this thing working.

All other questions about packaging etc are secondary. You remember that Ben Reed had a scribus version using Qt/Mac already some 2 years ago, but it never worked correctly. Maybe both Qt/Mac and scribus are now in a shape that makes this possible, but this has to be seen.

-- Martin