Recompiling EiffelStudio on Windows
Recently I found an issue with EiffelStudio and some .NET assemblies. I decided to rebuild my own version of the Eiffel compiler to implement a quick workaround. I succeeded but had to overcome some small issues, so in this post I will provide a detailed guide on how to proceed.
I won't cover the case of operating systems other than Windows, and will focus on Windows Vista, although almost everything applies to Windows XP as well.
There is a page at dev.eiffel.com http://dev.eiffel.com/Compiling_EiffelStudio describing the procedure. If my way doesn't work for you, please follow instructions from that page, it should be up to date.
Importing the source code
The source code of most of EiffelStudio is available as web pages at svn.eiffel.com https://svn.eiffel.com/eiffelstudio/trunk/, and through CVS (Concurrent Versioning System) as well. Using a CVS client is the easy way if you have one installed. If not, I suggest to use TortoiseSVN, by doing the following:
Go to http://tortoisesvn.tigris.org/, click the Dowload button, then pick the version corresponding to your version of Windows. I chose the 32-bit version.
Reboot Windows, if the installation program asks you to.
Once a CVS client is available, you will need to choose a folder where to download the source code. EiffelStudio developers recommend to choose a name of the form xxdev where xx is the major and minor version of EiffelStudio. For instance, 66dev for version 6.6. From experience, this is only good if you want to maintain several branches of the code simultaneously, but our case all we want is the latest version. Therefore, another name like 'EiffelStudioSource' is probably better suited. This is the name I will use throughout the rest of this guide.
Wherever you put the source file, make sure the full path to this folder doesn't contain any space. For instance, 'EiffelStudio Source' doesn't work.
Open the explorer, go to where this folder will be created, right-click the base folder and select 'SVN Checkouts...
Fill the url line exactly as below, and the folder line as you want. You can use the default values for other options in the dialog box. Here is the base url that you can copy-paste:
https://svn.eiffel.com/eiffelstudio/trunk (don't forget to add /Src).
If you run into the following error, it's up to you to accept or reject the invalid certificate.
There will be 4 checkouts to perform. Here is the mapping to use. Note that the /Src folder isn't mapped the same way as the other 3.
The entire download process takes about an hour.
Preparing the building process
Since I'm assuming you have EiffelStudio installed already, you must have a C compiler installed as well. However, as far as I know the Eiffel compiler source code is built with Visual Studio 2005. I used Visual Studio 2008, if you don't have one of them you will probably have to install Visual Studio. For this purpose, Microsoft offers a free version called Visual Studio Express, but I didn't try it.
To prepare the building process, you need to set two environment variables. This is done from the Control Panel, choose the System icon and on the left of the dialog box click Advanced system settings.
Click the Environment Variables button to pop the dialog used to manage environment variables.
In the section dedicated to user variables (the top section), click New... and enter the following:
Name: EIFFEL_SRC Value: The name of the folder where the source code was downloaded, in my case C:\Users\dlebansais\Documents\EiffelStudioSource.
Create another environment variable called ISE_LIBRARY and give it the same value. If you forget to do that, the building process can go pretty far but eventually will fail.
Building the compiler
Now, what the official instructions don't tell you, is that you need to launch a specific command prompt. To find it, click the start button and navigate through the 'All programs' menu to find the Visual Studio group. Under this menu is the Visual Studio Tools group, that countains the Visual Studio Command Prompt. Open it.
This will automatically setup the environment required to run the C compiler.
configure win32 m
This is assuming you want to build the 32-bit version of the compiler, of course. Otherwise, type 'configure win64 m'.
This command starts the build of all C files required by Eiffel source files. Once done, just close the command prompt. From now on, we will run tools coming from EiffelStudio, so launch the command prompt that the EiffelStudio installation provides, you can find it the same way you found the Visual Studio prompt.
If launching this prompt generate a few error messages, you will need to fix your EiffelStudio installation (I reported this bug and it should be fixed if you installed recently). You need to modify the following file: <EiifelStudio path in program Files>\studio\config\windows\esvars.bat
With this fix, the EiffelStudio command prompt should now start flawlessly. Type the following:
Until now, we have compiled C and C++ files. We are now ready build the compiler from Eiffel source files. Before this final step, you need to choose which version of the compiler you want, and if you want to finalize it. To choose the compiler version, you can pick one of these arguments for the -target option:
This will compile either the command-line version or the studio version of the compiler. There are actually two possibilities for the studio version, either bench or bench_windows. I'm not sure what the difference is, and so far bench_windows has worked for me.
To build a finalized version, simply add -finalize to the command.
If like me you plan to rebuild the compiler regularly, when source files are updated, you can create your own batch file, with these lines:
ec -config ec.ecf -target bench_windows -c_compile -finalize
The file you have built is %EIFFEL_SRC%\Eiffel\Ace\EIFGENs\bench_windows\F_code\ec.exe
==Staying up to date==
Every time a developer updates a source file, you can get the change with your SVN client. In the case of TortoiseSVN, simply open the explorer, find the 'EiffelStudioSource' folder, right-click and choose 'SVN Update'.
This will automatically download all modified files.