You are here

Started on haXe and Neko Portable

14 posts / 0 new
Last post
mloots
Offline
Last seen: 13 years 6 months ago
Joined: 2009-07-18 19:08
Started on haXe and Neko Portable

haXe and Neko Portable is a fully functional Open Source development platform by Nicolas Cannasse that compiles a single Object Oriented programming language (haXe) into Flash, Javascript, PHP, Neko and more; haXe enables full source code reuse and communication between different platforms, while Neko in particular offers much more speed for server applications than for example PHP or Perl. For more info, see http://haxe.org/.

I just created a very alpha version for haXe and Neko Portable, to be found at http://www.cosix.com/haXeNekoPortable, but I have some issues that I need advice on:

1. The "application" just sets the environment; this conflicts with PortableApps regulations in that an application has to reset to the previous environment settings after it finishes. The only way to solve this I think is to make it a resident (taskbar ?) app. I simply have no experience with that.

2. To solve issue 1., I have a second application that does the missing job: it restores the previous environment settings. It has to be run by hand though before the portable app is removed...

3. I need some help with the launchers. Both 1. and 2. launchers are .BAT files at the moment, so I can't turn this into a "real" PortableApp package yet.

4. I need some advice how to store and restore the original environment settings. Both 1. and 2. launchers only contain a remark on this, but do not have this functionality yet...

I hope that someone here can give me some pointers. As a portable application, it works perfectly, but I would like to beef it up to standards.

Thanks in advance,
--
-Martijn Loots

Mark Sikkema
Offline
Last seen: 11 years 4 months ago
Developer
Joined: 2009-07-20 14:55
Have a go with the portableapps template!

What are exactly the environment setting, are they registry- or file settings. Anyway have a go with the portableapps template, http://www.loncarek.de/downloads/ApplicationPortableTemplate.nsi! You will need to use NsisPortable, which you can find on this site. It`s not all that hard to do. As an alternative, try the Portable Apps Creator, PAC. Never used it myself PAC myself though, cause it's that easy to use the template!
Let me know where the settings are stored, I will have a look at it!

Formerly Gringoloco
Windows XP Pro sp3 x32

mloots
Offline
Last seen: 13 years 6 months ago
Joined: 2009-07-18 19:08
Thank you for your reply.

Thank you for your reply. There's not much being configured, the relevant output of RegShot being after the "Start haXe and Neko" has been run:

----------------------------------
Keys added:4
----------------------------------
HKLM\SOFTWARE\Classes\.hxml
HKLM\SOFTWARE\Classes\.hxml\shell
HKLM\SOFTWARE\Classes\.hxml\shell\Compile
HKLM\SOFTWARE\Classes\.hxml\shell\Compile\command

----------------------------------
Values added:6
----------------------------------
HKLM\SOFTWARE\Classes\.hxml\shell\Compile\command\: ""E:\PortableApps\haXeNekoPortable\App\haXeNeko\haxe\haxe.exe" -prompt "%1""
HKU\S-1-5-21-....\Environment\PATH: ";%HAXEPATH%;%NEKO_INSTPATH%"
HKU\S-1-5-21-....\Environment\HAXEPATH: "E:\PortableApps\haXeNekoPortable\App\haXeNeko\haxe\"
HKU\S-1-5-21-....\Environment\NEKO_INSTPATH: "E:\PortableApps\haXeNekoPortable\App\haXeNeko\neko"

I had a quick look at the template before, but I got lost in that big piece of code because it presumes a program that arranges the portable configuration, fires, finishes and restores the old situation.

The "Start" .BAT file just sets up the environment, so I can use it. I don't know what route to follow to conform to PortableApp guidelines. I assume that requires a resident program that neatly restores the environment as it finishes, but my experience with resident programs is limited to my Atari ST period in the mid 80's...

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 7 years 7 months ago
Joined: 2007-04-15 21:08
The Classes things are

The Classes things are registering the .hxml file extension - something which it mustn't do. Normally just the installer does it, or an option or options in some options window.

The Environment thing is environment variables. It's adding them to the path, and setting up variables for both of them so they (and possibly other things) can find them. Environment variables can be set easily in NSIS, and applying just to the process and children, which is what you want. There are quite a few launchers you can look at to see how to handle them; gVim Portable, Inkscape Portable, FileZilla Portable to name three. I'd be interested to see then what's in the batch file - could you post it? Then I can advise you better.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

mloots
Offline
Last seen: 13 years 6 months ago
Joined: 2009-07-18 19:08
So you did understand it ;-)

I didn't have any trouble with the meaning of the RegShot output, but it's nice too see that you didn't either...

The core of the problem is that developing haXe is not at all like starting a development suite, doing your thing and finish the suite.

The batch file only runs the 'haxesetup.exe' program delivered with haXe and Neko. It checks its location and sets the environment accordingly (environment variables as well as the .hxml file class).

Developing haXe is done by merely editing (using whichever editor, Vim being my favorite) the haXe .hx source files.

There's a .hxml compilation file within the project directory tree that you open to start the compilation and linking of the targets.

You don't start a big suite (a la VisualAnyLanguage, Flash, Delphi, etc.). It's all done within the Explorer (as far as Windows is concerned, haXe runs also on MacOSX and Linux).

So, there's no 'cleaning up' bit available: there's no suite that stops after the development cycles have ended. So, to make it PortableApps rules compliant, I need an executable that does the trick of being a development suite:

- on start, it sets the environment (= running 'haxesetup.exe')
- it just sits in the taskbar, checking if the PortableApps are still present
- if the PortableApps are removed, it initiates the Exit procedure
- if the user chooses Exit on the taskbar app, it initiates the Exit procedure
- on the Exit procedure, it cleans the environment variables and the registry key.

So, what I really need are a few pointers how to make a little Windows executable that performs the tasks described here. I'm not really familiar with creating Windows executables; I'm a scripting and command line type of guy... And I don't have VisualC or the likes at hand: if there's an open source dev tool with a bit of Windows GUI capabilities, it would be great.

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 7 years 7 months ago
Joined: 2007-04-15 21:08
Ask the user for a file

I hope you're using my gVim Portable Wink

I suggest that you take a look at how the Java Portable Launcher works - take a leaf from its book about prompting the user for a file. (I just suggested this to daBomb69 as well, for Perl Portable.) I'd need to look into the application further to see what it did, if anything more was needed or anything. I could fairly easily write such a tray icon program with AutoHotkey if it were needed.

I should download it and take a look.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

mloots
Offline
Last seen: 13 years 6 months ago
Joined: 2009-07-18 19:08
'A file' would not be enough...

I pulled gVim portable from sourceforge and 'PortableApped' it myself. I was not aware of your version, but I downloaded it anyway for future use. It probably needs the additional haxe.vim syntax files to be usable to me... Smile (http://tech.motion-twin.com/zip/haxe.vim)

About the file: developing haXe means going through the classical cycles: edit, compile, check, edit etc. And that for a number of files depending of the project size. One just doesn't work on a single file.

The haxesetup.exe only sets the environment: it creates the .hxml class in the registry, the HAXEPATH and NEKO_INSTPATH user environment vars and appends these two vars to the user enviroment var PATH.

A taskbar app should check the existance of a predefined haXe environment, run haxesetup.exe and reset the environment to the original state on exit. If there's no predefined haXe environment at the time of starting the taskbar app, it should just run haxesetup.exe and clear the reg. and env. values and reset PATH on exit. It is not all too difficult and I'd probably could work all this out using a .bat file, but PortableApps requires an .exe file to install... Sad

Anyway, thanks for thinking with me. I need a bit of free time to see if I can find a real nice OS dev tool. I recently took a quick look at Lazarus and that probably has it all, but I hate the learning curve if I probably never use it again...

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 7 years 7 months ago
Joined: 2007-04-15 21:08
FYI, the correct place to put

FYI, the correct place to put the syntax file is Data\settings\vimfiles\syntax\haxe.vim in my version; the older portablegvim.sf.net one was never very good (why I took it up), and didn't support vimfiles anywhere really.

I'll take a look into it; I think it'll be simple enough to do (for me that is), and will be easier if we can bypass this haxesetup.exe thing in any way.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

mloots
Offline
Last seen: 13 years 6 months ago
Joined: 2009-07-18 19:08
Wow

Thanks for pointing the gvim thing out and even better: thanks for the offer to look into the little app !

The haxesetup.exe is a simple clean program that just sets the environment. You can easily use it to spare doing your own settings, but on the other hand, I understand probably what you mean: if I'm busy reading and setting the environment myself, why bother calling another program...

I hope you fare better than I did upto now. I hate to leave loose ends dangling and I'd very much like have the haXe development setup as a real PortableApp.

Can I be of help designing the startup logo picture ? Is there a template of a clean picture ?

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 7 years 7 months ago
Joined: 2007-04-15 21:08
haxe.exe

(The splash screen should be the Development Test one.)

I reckon you shouldn't be running haxesetup.exe at all, just haxe.exe -prompt "X:\...\filename.hxml".

See the Java Portable Launcher for something like what you want.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

mloots
Offline
Last seen: 13 years 6 months ago
Joined: 2009-07-18 19:08
Need the environment

A wrapper routine on .hxml would be an option to get the compiler working, but then again: no double click action...

Have you used haXe ? It really needs the environment to get the development working...

Found the splash screen. Thanks.

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 7 years 7 months ago
Joined: 2007-04-15 21:08
Environment

Don't bother with doing file extension registration; we don't really want that.

I haven't used haXe at all. If the environment variables are needed, that's easy enough.

System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("HAXEPATH", "$EXEDIR\App\haxe").n'
System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("NEKO_INSTPATH", "$EXEDIR\App\neko").n'
ReadEnvStr $0 PATH
System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("PATH", "$0;$EXEDIR\App\haxe;$EXEDIR\App\neko").n'

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

mloots
Offline
Last seen: 13 years 6 months ago
Joined: 2009-07-18 19:08
Code segment

What's this, Python ?

And how do I read an environment var ?

TIA,
--
-Martijn

dagardner
dagardner's picture
Offline
Last seen: 3 years 6 months ago
Developer
Joined: 2007-09-20 14:41
The code is NSIS; most, if

The code is NSIS; most, if not all of the PortableApps launchers are written in NSIS.

You can read environment variables using ReadEnvStr .

Log in or register to post comments