Return-Path: Delivered-To: apmail-incubator-harmony-dev-archive@www.apache.org Received: (qmail 53009 invoked from network); 9 Jun 2006 10:48:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 9 Jun 2006 10:48:52 -0000 Received: (qmail 23542 invoked by uid 500); 9 Jun 2006 10:48:48 -0000 Delivered-To: apmail-incubator-harmony-dev-archive@incubator.apache.org Received: (qmail 23502 invoked by uid 500); 9 Jun 2006 10:48:48 -0000 Mailing-List: contact harmony-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-dev@incubator.apache.org Received: (qmail 23491 invoked by uid 99); 9 Jun 2006 10:48:48 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Jun 2006 03:48:48 -0700 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=RCVD_IN_SORBS_WEB,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of oliver.deakin@googlemail.com designates 64.233.182.186 as permitted sender) Received: from [64.233.182.186] (HELO nf-out-0910.google.com) (64.233.182.186) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Jun 2006 03:48:47 -0700 Received: by nf-out-0910.google.com with SMTP id c29so524284nfb for ; Fri, 09 Jun 2006 03:48:26 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=googlemail.com; h=received:message-id:date:from:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding; b=Cowpvu8p5rtUBe2eoITYxIfm+kOquERvYi8RGpzOvZchp7OYEBlRnq5W792ugL+GL4hg3f45JJ99Q0Iw2LGNbcsqW3v0XYmNZwvhCAgfUSRvn1M5F1RN+ctMiepBAxjfIC+J+qqfk1nwjPaUihOQz3wDvmtEO0r9sWBtxHgAoKM= Received: by 10.49.93.18 with SMTP id v18mr2273116nfl; Fri, 09 Jun 2006 03:48:26 -0700 (PDT) Received: from ?9.20.132.221? ( [195.212.29.67]) by mx.gmail.com with ESMTP id c1sm3119433nfe.2006.06.09.03.48.25; Fri, 09 Jun 2006 03:48:26 -0700 (PDT) Message-ID: <448951EF.8090900@googlemail.com> Date: Fri, 09 Jun 2006 11:48:15 +0100 From: Oliver Deakin User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) MIME-Version: 1.0 To: harmony-dev@incubator.apache.org Subject: Re: [drlvm] building... References: <4488B26D.6040502@pobox.com> <7edfeeef0606081643i71738cber87af38a94e088b6b@mail.gmail.com> In-Reply-To: <7edfeeef0606081643i71738cber87af38a94e088b6b@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Garrett Rooney wrote: > > > Now sometimes you do need to have a totally different implementation > for a new platform, but a lot of the time, there can be some minor > ifdefs (based on availability of FEATURES, not platform) that allow > the same file to work on multiple platforms. > > Just splitting up into two implementations (or really N > implementations, since eventually Harmony will run on more than just > Linux and Windows) is a bit of a waste, and ifdefing based on platform > is just as bad, since the stuff that works on FreeBSD or OpenBSD or > Solaris is often the same as the stuff that works on Linux... > > What we ended up with in APR is something like this: > > There's a base implementation of each file that is designed to work on > any unix system. These go in unix/ subdirectories. If it's feasable > to make that file work elsewhere (Netware, Windows, OS/2, BeOS, > whatever) then it's done via ifdefs. If the ifdefs get out of > control, or the platform is really that different then you start > splitting off into platform specific implementations, but that's a > last resort. We actually had some discussion about doing exactly that kind of thing a while back [1] and more recently [2]. The basic ideas were: - Make the code as shared as possible, by using IFDEFs where it makes sense. We've made some progress in this area, with a lot of our code shared, but as you say there is still more to do. Im working on moving the native code around at the moment, so more unification is probably something I will look at at the same time. - Where IFDEFs are starting to make the code difficult to read, split the source up into platform specific files. The kind of layout that could be used for this is described in [2]. I think this matches what you're describing for APR. Do you agree? Im interested to know what kind of build system is used in APR - previous suggestions for picking up platform specific code have included using clever Ant scripts to figure out which file versions are needed, or using gmake and its vpath variable to pick them up (they are described more extensively in [1]). What does APR use to deal with building platform specific versions of files over shared ones? > > So in the end, the main things to keep in mind are to make your unix > implemenation try to work across as many systems as possible, ifdefing > based on availability of features as much as you can, not based on > specific platforms, and only as a last resort split out into totally > different platform specific implementations. > IIRC Mark suggested ifdef'ing on features as opposed to platforms before [3], and it seems like a good idea to me, providing a more obvious reason for the existence of the ifdef and allowing us to use ifdefs that describe more than just a ballpark platform distinction. I think in general we have similar ideas to those you describe, but we're not at a point yet where they have been completely embodied in the codebase, or even summarised in a single post/page. Perhaps I will put these ideas together into a page for the classlib section of the Harmony website, so we have something concrete to talk about without digging back into the mail archives. Regards, Oliver [1] http://mail-archives.apache.org/mod_mbox/incubator-harmony-dev/200603.mbox/%3c4410328E.4070904@googlemail.com%3e [2] http://mail-archives.apache.org/mod_mbox/incubator-harmony-dev/200605.mbox/%3c44687AAA.5080302@googlemail.com%3e [3] http://mail-archives.apache.org/mod_mbox/incubator-harmony-dev/200602.mbox/%3cfcb9f9160602230106v5d865575g@mail.gmail.com%3e > -garrett > > --------------------------------------------------------------------- > Terms of use : http://incubator.apache.org/harmony/mailing.html > To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org > For additional commands, e-mail: harmony-dev-help@incubator.apache.org > > -- Oliver Deakin IBM United Kingdom Limited --------------------------------------------------------------------- Terms of use : http://incubator.apache.org/harmony/mailing.html To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org For additional commands, e-mail: harmony-dev-help@incubator.apache.org