Alchemy shell script for easy compilation
August 4th, 2009
Hello all!
Once the blog is with a new face, let’s start to renew the posts too
Today I’m posting a quick tip for those who are new with Adobe Alchemy. I really agree that it kind of sucks when you’re new with theses technologies and you need to configure a lot of things.
Well, I have created a little shell script that helps to compile a C or C++ Alchemy project without the necessity of configuring the .profile file.
The steps to install and compile a Alchemy project with this shell script are:
- Download the Alchemy Toolkit at http://labs.adobe.com/downloads/alchemy.html
- Unzip the package in a directory (that will be your main Alchemy directory)
- Go to the main Alchemy directory via Terminal (i.e. cd /Documents/alchemy)
- Run the config script in Terminal (i.e. ./config)
Now to compile a project just copy the shell script file to the folder that contains your C or C++ Alchemy project. But before run the script you just need to change the path (highlighted line) to the alchemy-setup directory located in the Alchemy directory (i.e. source /Documents/alchemy/alchemy-setup).
And that is it
Now to run the shell script just make the file executable (i.e. in terminal type “chmod +x run.sh”) and run it. The script will then ask the main C file of the project: Just type the name of the file without extension and click Return. Done! Your project will be compiled!
Ps.: This is a shell script for Unix. If you want to port it to Windows (.bat) feel free to do that! Just share with us!
Ps.: To compile a C++ file just change the lines of the c-file extension (i.e. cName=”$fname.cpp”) and change the compiler to the g++ (i.e. which g++ AND g++ $cName -O3 -Wall -swc -o $swcName).
#!/bin/bash # # About: This file is a shell script to make easier # the compilation of Adobe Alchemy sources # # The MIT License # # Copyright (c) 2009 Filipe Silvestrim - http://www.filipesilvestrim.com # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # echo "**************** Easy Alchemy Compiler script ****************" shopt -s expand_aliases echo "// Configurating Alchemy..." source /Documents/alchemy/alchemy-setup PATH=$PATH:~/bin:/usr/local/bin:~/bin/flex/bin:~/bin/astmp:$ALCHEMY_HOME/achacks export PATH alc-on which gcc echo "// Accessing Current Dir..." DIR=$( (cd -P $(dirname $0) && pwd) ) cd $DIR echo "// Please, write the main C file name:" read fname cName="$fname.c" swcName="$fname.swc" gcc $cName -O3 -Wall -swc -o $swcName echo "**************** DONE ****************"
