View unanswered posts | View active topics


Reply to topic  [ 7 posts ] 
How-to: Building AS3 projects on Linux (edit: and MacOS) 
Author Message
Member

Joined: Wed Aug 01, 2007 3:37 pm
Posts: 1220
Location: Grizzly Flats, CA
Post How-to: Building AS3 projects on Linux (edit: and MacOS)
Hey everyone!

I just wanted to share how you can compile your FlashDevelop projects under Linux.

No virtual machine is required. I am using Ubuntu 10.10 x64, but it should work fine on other distributions, maybe with slight modifications.

Copy this script, open a terminal (Ctrl+Alt+T) and paste (Ctrl+Shift+V)

Code:
sudo apt-get install mono-runtime
wget http://www.eclecticdesignstudio.com/code/flashdevelop/fdbuild.zip
sudo unzip fdbuild.zip -d /opt/fdbuild
sudo chmod 755 /opt/fdbuild/fdbuild.exe
sudo chmod 755 /opt/fdbuild/fdbuild.sh
wget http://fpdownload.adobe.com/pub/flex/sdk/builds/flex4/flex_sdk_4.1.0.16076.zip
sudo unzip flex_sdk_4.1.0.16076.zip -d /opt/FlexSDK
sudo chmod -R 755 /opt/FlexSDK
sudo gzip -dc /opt/FlexSDK/runtimes/player/10.1/lnx/flashplayerdebugger.tar.gz | tar xf -
sudo cp flashplayerdebugger /usr/bin/flashplayerdebugger
sudo chmod 755 /usr/bin/flashplayerdebugger
rm fdbuild.zip
rm flex_sdk_4.1.0.16076.zip
rm flashplayerdebugger


This will download Mono, FDBuild, the FlexSDK and extract the standalone player for viewing SWF files.

To use it, you can either call FDBuild directly by running "mono /opt/fdbuild/fdbuild.exe" from a terminal, or you can use the shell script I have provided.

The shell script gives FDBuild the path to the Flex SDK, and can also be edited to support any global classpaths you may have. There is already a blank "-cp" argument to help you get started. The script currently accepts two arguments: the path to the project file you wish to compile, and the path to the output SWF so it can launch it after compiling

Code:
. /opt/fdbuild/fdbuild.sh "path/to/my/Project File.as3proj" "path/to/my/Output File.swf"


The script currently runs using sudo, since Java (on my system) complains about not being able to find jar files when it is run as a normal user. I'm not entirely sure why. This could also probably be a bit more elegant ... but I hope it is still helpful!

Feel free to share any suggestions you may have to improve the process. This currently does not run FCSH for faster compile times, and will still run the SWF if there are compiler errors. However, this should make it a lot easier to compile projects on Linux, even if you don't use FlashDevelop to edit the code.

UPDATE:

Until we have a plugin or other application in Linux to create FlashDevelop projects for us, I have temporarily added a "template.as3proj" file to the FDBuild package which should help.

Code:
cd path/to/my/project/directory
cp /opt/fdbuild/template.as3proj project-name.as3proj
vim project-name.as3proj


You can copy out the template, then edit with gedit, vim, or whatever you prefer. You'll need to put in the relative path for where you want the SWF to be created (IE: "Export\MyProject.swf") and the relative path for where your document class is located (IE: "Source\com\my\project\MyProject.as")

UPDATE (2):

I've just integrated Philippe's great "bonus" to the fdbuild.sh script, so now you can compile projects like so:

Code:
. /opt/fdbuild/fdbuild.sh "path/to/my/Project File.as3proj"


... and it will automatically pull the output SWF path from the project file in order to launch Flash Player.

If you already have the scripts installed, you can update to the latest version like this:

Code:
wget http://www.eclecticdesignstudio.com/code/flashdevelop/fdbuild.zip
sudo unzip fdbuild.zip -d /opt/fdbuild
sudo chmod 755 /opt/fdbuild/fdbuild.exe
sudo chmod 755 /opt/fdbuild/fdbuild.sh
sudo chmod -R 755 /opt/FlexSDK
rm fdbuild.zip


Last edited by elyon on Sat Mar 05, 2011 7:31 pm, edited 1 time in total.



Fri Mar 04, 2011 10:57 pm
Profile WWW
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 10726
Location: Paris, France
Post Re: How-to: Building AS3 projects on Linux
MacOS instructions:

First download and install 'mono' for MacOSX if you don't have it (type 'mono' in the terminal to check if it's installed already).

Download Flex SDK, FDBuild and scripts:
Code:
wget http://www.eclecticdesignstudio.com/code/flashdevelop/fdbuild.zip
sudo unzip fdbuild.zip -d /opt/fdbuild
sudo chmod 755 /opt/fdbuild/fdbuild.exe
sudo chmod 755 /opt/fdbuild/fdbuild.sh
wget http://fpdownload.adobe.com/pub/flex/sdk/builds/flex4/flex_sdk_4.1.0.16076.zip
sudo unzip flex_sdk_4.1.0.16076.zip -d /opt/FlexSDK
sudo chmod -R 755 /opt/FlexSDK
rm fdbuild.zip
rm flex_sdk_4.1.0.16076.zip

Please note that the standalone Flash Player must be installed interactively - the DMG is in the SDK:
Quote:
open /opt/FlexSDK/runtimes/player/10.1/mac/Install\ Adobe\ Flash\ Player\ Debugger\ 10.1.dmg

Build script (fdbuild.sh) must be modified to run the player app:
Code:
#!/bin/sh
mono /opt/fdbuild/fdbuild.exe -compiler /opt/FlexSDK "$1"
open -a "Flash Player Debugger" "`cat "$1" | egrep -o 'movie path="([^"]+)' | sed 's/movie path="//' | sed 's/\\\\/\\//'`"

Bonus: In this new script the output SWF is extracted from the project file so you can now just do:
Code:
cd path/to/project
/opt/fdbuild/fdbuild.sh myproject.as3proj


Sat Mar 05, 2011 6:42 pm
Profile WWW
Member

Joined: Thu Aug 28, 2008 3:16 pm
Posts: 47
Location: Ho Chi Minh city, Vietnam
Post Re: How-to: Building AS3 projects on Linux (edit: and MacOS)
Nice, this would save me time from creating Linux build scripts for projects made with FlashDevelop.

About the "sudo" issue, you forget to grant access for normal users to FlexSDK. To fix, add the following command after unzipping FlexSDK:
Code:
sudo chmod -R 755 /opt/FlexSDK

Then remove "sudo" in fdbuild.sh.

(It is better to be able to build the project as normal user. If you use sudo, the output file will be own by root)

_________________
You know who.


Mon Mar 07, 2011 9:19 am
Profile WWW
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 10726
Location: Paris, France
Post Re: How-to: Building AS3 projects on Linux (edit: and MacOS)
Thanks ttt_conan - I updated the instructions.


Mon Mar 07, 2011 10:43 am
Profile WWW
Member

Joined: Wed Aug 01, 2007 3:37 pm
Posts: 1220
Location: Grizzly Flats, CA
Post Re: How-to: Building AS3 projects on Linux (edit: and MacOS)
I also updated the script in fdbuild.zip to not use sudo. Thanks! I knew there must have been a logical cause for the jarfile error :)


Mon Mar 07, 2011 11:52 am
Profile WWW
Member

Joined: Wed May 05, 2010 9:18 pm
Posts: 6
Post Re: How-to: Building AS3 projects on Linux (edit: and MacOS)
I just tried this with Mac OSX Lion. Terminal doesn't know what the opt folder is. Typing in
sudo unzip fdbuild.zip -d /opt/fdbuild
causes an error that it doesn't know the path. Leaving out the opt section works to a degree. With leaving out the opt, I get an error with

#!/bin/sh
mono /opt/fdbuild/fdbuild.exe -compiler /opt/FlexSDK "$1"
open -a "Flash Player Debugger" "`cat "$1" | egrep -o 'movie path="([^"]+)' | sed 's/movie path="//' | sed 's/\\\\/\\//'`"

Any thoughts?


Fri Jul 13, 2012 6:23 pm
Profile
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 10726
Location: Paris, France
Post Re: How-to: Building AS3 projects on Linux (edit: and MacOS)
Create the /opt folder


Fri Jul 13, 2012 8:04 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 7 posts ] 

Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.