[Vm-dev] Saturday am insanity, xcode projects to Makefiles

Eliot Miranda eliot.miranda at gmail.com
Sat Jan 9 18:02:06 UTC 2016


Hi All,

    I just blew an hour investigating converting the xcode build files to
Makefiles.  I've hit a wall but I thought I'd share because
a) someone might want to take a tilt at this themselves
b) someone might have a nifty way around the wall

So what's the issue here?  Under
http://www.squeakvm.org/svn/squeak/branches/Cog/{build.macos32x86,build.macos64x64}
are build directories for each configuration of cog, such as squeak.cog.v3
or newspeak.stack.spur.  These contain project files. The old 10.6 Carbon
UI project files are called CoreVM.xcodeproj/project.pbxproj and the new
10.8 Cocoa UI ones, currently extant for only
{build.macos32x86,build.macos64x64}/squeak.cog.spur) are called
SqueakCogSpur32x86.xcodeproj/project.pbxproj.

There are also a bunch of projects for external plugins such
as SqueakFFIPrims/SqueakFFIPrims.xcodeproj.  These things are all
monolithic property lists with lots of commonality and they differ only
slightly, mostly to include the relevant interp.h file for the
configuration.  For example, build.macos32x86/squeak.cog.v3 uses
src/vm/interp.h, build.macos32x86/squeak.cog.spur uses spursrc/vm/interp.h,
build.macos64x64/squeak.cog.spur uses spur64src/vm/interp.h, etc.

Now, if these were replaced by makefiles, they could trivially be
parameterised by the relevant interp.h and lots of duplication would
disappear.  It would be much faster to add a new configuration, etc.

So how to derive the first set of makefiles?  Manually, obviously, but
ghaaa, no please no.

So I found GNUStep's pbxbuild.  This was deprecated in 2012 and apparently
applies only to xcode version 2 project files, not the version 3.2 we're
using.  It still builds and installs (with a little bit of effort):

1. download GNUStep Makefiles from
http://wwwmain.gnustep.org/resources/downloads.php?site=ftp%3A%2F%2Fftp.gnustep.org%2Fpub%2Fgnustep%2F
2. unpack the tar
    $ tar xzf ~/Downloads/gnustep-make-2.6.7.tar.gz
3. cd and build
    $ cd gnustep-make-2.6.7/;./configure; sudo gnumake install

4. Download pbxbuild from github
    $ git clone https://github.com/gnustep/pbxbuild.git pbxbuild
5. cd and build
    $ cd pbxbuild; GNUSTEP_MAKEFILES=/Library/GNUstep/Makefiles make -f
GNUmakefile

But when one tries this (-g = generate makefiles)
    $ cd build.macos32x86/squeak.cog.spur; ~/src/pbxbuild/pbxbuild  -g
SqueakCogSpur32x86.xcodeproj
it outputs some errors and segfaults:
2016-01-09 09:55:44.568 pbxbuild[33864:507] -[PBPbxProject
initWithFile:](146) rootObject class: __NSCFDictionary
2016-01-09 09:55:44.569 pbxbuild[33864:507] -[PBPbxProject
initWithFile:](147) description:
2016-01-09 09:55:44.569 pbxbuild[33864:507] -[PBPbxProject
initWithFile:](148) {
    buildConfigurationList = 94D95B1D0923E6810034C6F0;
    compatibilityVersion = "Xcode 2.4";
    developmentRegion = English;
    hasScannedForEncodings = 1;
    isa = PBXProject;
    knownRegions =     (
        English,
        Japanese,
        French,
        German
    );
    mainGroup = 08773EB500C6A1C4C0A80109;
    productRefGroup = 08773F3000C6A1C4C0A80109;
    projectDirPath = "";
    projectRoot = "";
    targets =     (
        941A3B2B09AA144000C9D25A
    );
}
2016-01-09 09:55:44.570 pbxbuild[33864:507] -[PBPbxProject(Private)
addGroupRecursivelyByKey:parentPath:](82) Examining Group with name:
'Sources'
2016-01-09 09:55:44.571 pbxbuild[33864:507] Warning: Unknown reference type
'(null)' in PBXGroup!
2016-01-09 09:55:44.571 pbxbuild[33864:507] Warning: Unknown reference type
'(null)' in PBXGroup!
2016-01-09 09:55:44.571 pbxbuild[33864:507] Warning: Unknown reference type
'(null)' in PBXGroup!
2016-01-09 09:55:44.572 pbxbuild[33864:507] Warning: Unknown reference type
'(null)' in PBXGroup!
Segmentation fault: 11




Then the thought is to try parsing the project files with Smalltalk and
writing the exporter myself.  (In fact I tried this first cuz I suspected
pbxbuild would be a bust).  So one can convert a project.pbxproj file to an
xml file via
$  plutil -convert xml1 -o - SqueakCogSpur32x86.xcodeproj/project.pbxproj
>SqueakCogSpur32x86.xml
and I loaded XML_Parser.  But the resulting tree is so deeply nested I gave
up.

The next thought was that yes, I could try and debug the pbxbuild
Objective-C, but that would take time learning new tools, and it would be
much nicer to use Smalltalk.  So I cast around for an Objective-C to
Smalltalk translator. I can't find one.  There /are/ Objective-C to Java
and Objective-C to Swift translators.  But I'm not about to try and convert
those so that I can convert the pbxbuild code to Smalltalk.  But I thought
there might be some folks here that have copious free time and are crazy
enough to try.  hence this message.

good morning.
_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20160109/85da5789/attachment.htm


More information about the Vm-dev mailing list