    <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/">
     <channel>
        <title>ACCU  :: Welcome to the Wonderful World of Porting!</title>
        <link>https://members.accu.org/index.php/journals/818</link>
        <description>Professionalism in Programming</description>
        <dc:language>en-us</dc:language> 
        <dc:creator>Administrator</dc:creator> 
        <admin:generatorAgent rdf:resource="http://www.xaraya.org" /> 
        <admin:errorReportsTo rdf:resource="mailto:webeditor@accu.org" />
       <sy:updatePeriod>hourly</sy:updatePeriod>
       <sy:updateFrequency>1</sy:updateFrequency>
       <docs>http://backend.userland.com/rss</docs>


        <h2>Journal Articles</h2>


<div class="xar-mod-head"><span class="xar-mod-title">CVu Journal Vol 17, #3 - Jun 2005 + Programming Topics</span></div>

<table border="0" cellpadding="1" cellspacing="0">
    <tbody>
    <tr>
        <td valign="top">
            Browse in :
       </td>
       <td valign="top">

                                            <a href="https://members.accu.org/index.php/journals/">All</a>

                     &gt;                         <a href="https://members.accu.org/index.php/journals/c76/">Journals</a>

                     &gt;                         <a href="https://members.accu.org/index.php/journals/c77/">CVu</a>

                     &gt;                         <a href="https://members.accu.org/index.php/journals/c96/">173</a>
                    (15)
<br />

                                            <a href="https://members.accu.org/index.php/journals/">All</a>

                     &gt;                         <a href="https://members.accu.org/index.php/journals/c13/">Topics</a>

                     &gt;                         <a href="https://members.accu.org/index.php/journals/c65/">Programming</a>
                    (877)
<br />

                                            <a href="https://members.accu.org/index.php/journals/c96-65/">Any of these categories</a>

                    -                        <a href="https://members.accu.org/index.php/journals/c96+65/">All of these categories</a>
<br />
</td>
   </tr>
   </tbody>
</table>




<div class="xar-error">
   <p>
 <strong>Note:</strong> when you create a new publication type,
the articles module will automatically use the templates
<em>user-display-[publicationtype].xt</em>
and <em>user-summary-[publicationtype].xt</em>.
If those templates do not exist when you try to preview or display a new article,
you'll get this warning :-)  Please place your own templates in themes/<em>yourtheme</em>/modules/articles . The templates will get the extension .xt there. </p>
</div>
<div class="xar-norm xar-standard-box-padding">
   <h1><strong>Title:</strong>&nbsp;Welcome to the Wonderful World of Porting!</h1>
<p><strong>Author:</strong>&nbsp;</p>
<p>
<strong>Date:</strong> 02 June 2005 05:00:00 +01:00 or Thu, 02 June 2005 05:00:00 +01:00</p>
<p><strong>Summary:</strong>&nbsp;</p>
<p><strong>Body:</strong>&nbsp;<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e20" id="d0e20"></a></h2>
</div>
<p>Since learning C++ back in 2000, I've been one of the
programmers on the open source desktop publishing package called
Scribus. This application looks, feels and works well and has been
favourably compared to commercial offerings from Quark and Adobe.
It is already used around the world for commercial applications -
from newspapers and magazines to catalogues, the application gets
around (especially as it is being championed by Novell's SuSE Linux
distribution).</p>
<div class="c3"><img src="/var/uploads/journals/resources/scribus.png" align=
"middle"></div>
<p>The application is written in standard C++ and uses the Qt
widget set primarily with libart, littlecms and libxml2 also in the
mix. There are a few quirks, but nothing much. Due to this and now
Apple are using (effectively) BSD, there is already a native Mac OS
version of the software. Same cvs tree, but with a couple of small
alterations to accommodate the different hardware.</p>
<p>Time rolls on and the programming team have been under a bit of
pressure to produce a native Win32 version. There is already a
cygwin version available, but it has been a long term aim for there
to be a truly native version without the baggage found on the
cygwin port.</p>
<p>As I have experience of programming under Win32, I was elected
to do the port. Oh well, that should be fun...</p>
</div>
<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e31" id="d0e31"></a>Take 1 :
VisualStudio.NET</h2>
</div>
<div class="c1"><img src="/var/uploads/journals/resources/visualstudiodotnet.png" align=
"right"></div>
<p>I initially approached the porting process by using Visual
Studio .NET under WinXP and with an education licensed copy of
Qt.</p>
<p>Um. That was fun. The compile of Qt failed and I had to do that
by hand. Not a pleasant experience. I then had to install
TortoiseCVS to enable me to obtain the source code. Another pain in
the backside process. Finally, they were installed and I could
begin.</p>
<p>The first problem with any port is to resolve the dependencies.
LittleCMS already has a prebuilt version for Windows as do most of
the other parts required for the build (including fontconfig, which
can be found on the gimp website).</p>
<p>After the dependencies had been resolved (and installed
correctly), the next stage was to find the aspects which differ
greatly between how the different operating systems work. There are
two as far as Scribus is concerned: printing and files. File
systems vary greatly from platform to platform, Linux and Windows
are no different in this respect.</p>
<p>While to any Linux application developer having self-built
applications in <tt class="filename">/usr/local</tt> seems fine, to
a Win32 user who has only ever used Win32, the logic of having
parts of the application in the Windows directory with parts in the
Program Files directory would seem fine. Unfortunately, when you've
exclusively been based on one platform, this logic vanishes (or at
least becomes hazy). Another example, files under Linux are
(typically) saved in <tt class="literal">$HOME</tt>, under Windows
they can be just about anywhere. <tt class="literal">$HOME</tt>
also doesn't exist under Windows (well, not that I could use!).</p>
<div class="c1"><img src="/var/uploads/journals/resources/linuxpenguin.png" align=
"right"></div>
<p>The difference in file systems also has another drawback as far
as porting is concerned. The Makefile cannot be &quot;just&quot; used. The
paths have to be altered to reflect the fact that <tt class=
"filename">/usr/local</tt> would be of little use under Win32. Also
anywhere in the code which relied on <tt class="literal">$HOME</tt>
would also have to be altered with either a conditional for Linux /
Mac OS and Windows or just be removed totally. Reliance on any
hard-wired system variable is not a good idea when porting an
application.</p>
<p>The next major difference between Linux and Windows is in the
printing system. Linux uses CUPS while Windows uses its own system.
Due to a decision made early on in the development cycle of the
original versions of Scribus, the Qt qprinter class was never used
for the printing, instead interfacing with CUPS was opted for. At
the time, there wasn't a plan for a Win32 version and Mac OS has a
port of CUPS already, so the main alternate platform was already
covered in those terms.</p>
<p>My idea was to omit the printing system completely until I had
time to understand how printing works under Windows.</p>
<p>Right, that's all the parts in place, any environment variables
gone and dependencies met. Now to import the source into Visual
Studio.</p>
<p>My last experience with the Microsoft Visual series was Visual
C++ version 5. Quite a lot has changed, but not for the better from
what I could see. The importer was awful. I wasted more time in
trying to import a cvs repository than any other aspect of the port
so far. In the end, I gave up, wrote a script and restarted Visual
Studio. Good. That's the code in. Let's build.</p>
<p>Let's not. The compile failed at the very first file as I'd not
remembered to switch off that very annoying bit that includes the
non-standard <tt class="filename">&lt;stdafx.h&gt;</tt> header. Why
on earth that is switched on by default is anyone's guess. I find
it more of a hindrance than a help.</p>
<p>The actual build went quite nicely until the printing and font
handling files came to being compiled. Here, my system gave up with
memory fault errors (which is strange as the system has over a gig
inside). On closer examination, it wasn't the computer at fault,
but the compiler giving some very strange errors. It seems that
VS.NET is still having problems with templates, especially with the
way I'd been optimising the code. Either there is a leak in the
version of the compiler I was using or the compiler was plain daft.
At this point I was asked not to continue porting Scribus. I won't
go into the politics, but I was thankful. Not least as it meant
that I didn't have to carry on fighting the build system in order
to just compile some pretty straightforward source code.</p>
<p>All went quiet at this point for about a year until March 2005.
During this time, I was approached to start the port again. To
ensure that the same pressure was not bought down on me as before,
I attempted to do the port under emulation on my Linux
machines.</p>
<p>Emulation is good fun and can be very useful (there is nothing
like firing up a ZX-Spectrum emulator and playing Match Day for
hours on end on a typically wet summer afternoon or a ARM emulator
to ensure some code will actually run on a target platform), but it
really does have its limits.</p>
<p>I attempted to get Borland C++ vsn 6 running using CrossOver
Office (a more professional version of Wine). The install went
fine, but it plain refused to run.</p>
<p>Next was to try MinGW (a Win32 version of GCC). This worked, but
was quirky and on the whole, using CrossOver wasn't really proving
to be too good. Win4Lin Pro fared little better. While Win4Lin
requires a full install of Windows to be installed, it was
incredibly slow.</p>
<p>Next time : Onward to a Win32 box and porting.</p>
</div>
</p>
<p><strong>Notes:</strong>&nbsp;</p>
<p><em>More fields may be available via dynamicdata ..</em></p>
</div>
</channel>
</rss>
