Archive: Compile in Borland


Compile in Borland
I was wondering if anyone had a makefile to compile NSIS with Borland's free compiler. I found one in the archives but it didnt work to well. Also, it would be nice if makefiles for other compilers were included in the source as well.


This was asked awhile ago. umm. I believe we couldn't find one.

sorry.

-Duane


Crikey! Can it be so hard to write one? I wrote one for the exe head and makensis for VC++ 4.0. The hardest part on other compilers is getting the size tweaks right. (i.e. /nowin98, /FD etc).


The main problem I was having was compiling the resource file in the exehead.

The rc file contains the line:

#include"afxres.h"

This is a mfc include so borland doesnt find it. After commenting it out, I get the error:

- Error resource.rc 100 74: Incomplete expression

Any ideas?
_

sounds liek your headers are not up to date..
a quick fix; open resource.rc and add
#define PBS_SMOOTH 0

I dont know the proper value, neither do I care for the 'smoothing'.

I just checked it and it compiles fine with Borlands free compiler.


now just to get the size optimisations.. 45.5kb on default options, but new simple 'initialisation module' that simply jumps to winmain (equivalical to setting the entry point on the ms compilers).


Okay. There are a few problems, not with compiling makensis, but with the implementation of finding the icon offset.

When you use the borland resource compiler, it changes offset 14h (if I remember rightly - I am at school now) from 0x00 to 0x80 in the .res file. Obviously when the application is linked, this change is maintained. When however, you bin2h, the data at 14h is _not_ changed. The result is that at the initialisation of the exe build class, memcpy does not return 0 even when the correct icon offset is reached.

solutions

1. (Preferred). Use the structures in winnt.h to load the icon offset from the exe header in memory (I decided it would just be easiest to find the offset of the first bitmap, second bitmap and first icon - so if you do any modifications to the resource script as long as you keep the bitmaps and icon in the right order it should be okay). This will oleviate around 100,000 memcpy calls speeding up the initialisation process alot and will fix the icon problem.
THis can be done quite easily; just cast a pointer of the dos header (struct defined in winnt.h) to the exe header and traverse through the sections until you find 1. the resource directory 2. the bitmap or icon group 3. the first actual icon or bitmaps. In order to get a file offset, remember to consider the RVA(relative virtual address or something).

2. Easy - after bin2h'ing load the header and change the 14h (or whatever it was) offset from 0 to 0x80.


Another idea I just had would be why not use on the unused fields in the PE header of the exe head to store the size of the exe head. That way on loading the installer, we would not have to cycle through the header in 512 byte increments searching for the NSIS 'neato surprise' thing.

(just a though, would save space and increase speed).


Nowww.. how do I submit suggestions to Justin?


Anyway, Rainwater, here are the makefiles I used to compile the header and makensis.

Note; you will still need to define PBS_SMOOTH in resource.[h|rc] (either will do).