NME 2 on Leopard ( maybe tiger to? ).

NME is short for something like Neko Motion Engine - (I think) and basically it's a library that emulates the normal flash classes, and allows direct remaping of many flash classs to haxe c++ or neko ones, this allow the rapid prototyping and development of flash interfaces to be ported and used on the desktop without the need of a swf projector.
Now that Lion has just been released it is even more reason to create this tutorial for thoughts of us on slightly outdated technology, who want to try the bleading edge source. Unfortunately the approach documented here assumes Intel based processor mac, like mac pro dual core, so if you are using older machines I am unsure that this will help you.

Compiler


The first step is to setup a suitable compiler. Now this is possible without Xcode but probably fairly tricky. But even with xcode we still need to update the compiler after. I have an old xcode version on my system so can't be sure if you will have any issues setting up, but I have taken trouble to find free access to Xcode.


1) You need to sign away your life to apple and get hold of Xcode 3.1 ( later versions will not run easily on leopard ).
First create a free account, you can pay for full developer accounts but for leopard users this would be fairly pointless?


http://developer.apple.com/programs/start/register/create.php
You probably don't need to give too accurate address phone etc...if your obsessed with privacy, but will have to verify your email address.


next you need to locate and install XCode 3.1


http://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wo/5.1.17.2.1.3.3.1.0.1.1.0.3.3.3.3.1
( click on login as the link says timed out, should see a page of links scroll down till you see Xcode 3.1 )


once you have found and installed XCode 3.1 we install Macports, we use this to help get a recent version of gcc and install all it's dependencies.
http://www.macports.org/install.php


Once this is installed then from terminal we can get most recent gcc compiler.


sudo port -v install gcc46


For this to install and build takes a few hours so the -v is important as it allows you to check that its working.


Next you have to change the current default gcc used by the terminal. On my machine it would be as below, the first path is the location of the macport gcc you just installed, and the second is the default symbolic name assumed.


sudo ln -sf /opt/local/bin/gcc-mp-4.6 /usr/bin/gcc


Also you need to run similar commands for gcc-- and gcc++, I will try to come back with correct terminal commands but you should be able to work this out by lookng in the directories, so I won't guess them.


2) Getting source files


Ok the work flow Hugh recommends when developing from bleading edge source files is to create a local folder and use haxelib to point to that and keep only stable release builds in the usual standard library. The problem with this approach is that you may easily end up using an incorrect ndll but not be sure that an export link was setup correctly. My suggestion is that the local folder is a good idea, but that it makes sense to remove ( put in an old folder and zip ) all nme related files you have already in your standard library.


TIP1: when trying to write directory paths in terminal you can cd and then drag the folder path from finder to your terminal.


TIP2: for easy access of the hidden directories in finder or terminal.
defaults write com.apple.finder AppleShowAllFiles -bool true
KillAll Finder


Ok so in your finder find the haxe library... /usr/lib/haxe/lib and if you have a hxcpp, static-sdl and nme then put them in an oldNme folder and zip up.


we now download the source file we need, you will need svnsubversion installed, we can get macports to do this for us from terminal.


sudo port install subversion


Now on your desktop or home folder create a nmeDev folder. From terminal in this folder ( tip1 )


cd /Users/myuserName/Desktop/nmeDev


next from terminal lets get the bits that we need.


svn checkout http://nekonme.googlecode.com/svn/trunk/ nme
svn checkout http://sdl-static.googlecode.com/svn/trunk/ sdl-static
svn checkout http://hxcpp.googlecode.com/svn/trunk/ hxcpp
svn checkout http://gm2d.googlecode.com/svn/trunk/ gm2d


These consist of nme ( the remap of the standard flash classes for neko and c++ ), sdl-static some stuff need for creating new ndll's involved? , hxcpp revised hxcpp code and a game engine, with some useful stuff like loading swf assets.


So that haxe lib is not confused we install hxcpp and nme
haxelib install hxcpp
haxelib install nme


tell Haxe to look instead at the svn folders...
haxelib dev hxcpp /Users/myuserName/Desktop/nmeDev/hxcpp
haxelib dev nme /Users/myuserName/Desktop/nmeDev/nme


and add the exports NEED TO MODIFY THIS PART AS THEY DON"T STAY ON REBOOT! so the command line can find stuff.
export NEKO_INSTALL_PATH=/user/lib/neko
export DYLD_LIBRARY_PATH=/Users/justinmills/Desktop/nmeDev/nme/ndll/Mac


now we need to build hxcpp
from our Desktop/nmeDev folder we go into the hxcpp runtime folder


cd hxcpp/runtime/


and run the build script


haxelib run hxcpp *.xml -Ddebug


and then go back to the nmeDev folder..


cd ..
cd ..


now we need to re make static-sdl


cd sdl-static/src
make clean
make


going back to Desktop/nmeDev


cd ..
cd ..


now we build the nme/project


cd nme/project
haxelib run hxcpp *.xml -Ddebug


OH DEAR NOT QUITE WORKING...... To be continued.


We are now ready to try the nme Samples
.

WIP - tutorial in progress

version #10615, modified 2011-06-09 10:16:29 by JLM