Compiling NVDA

Article Introduction

This article explains in detail how to compile a working source copy of NVDA that may have been obtained via the use of an SVN client. If successful, NVDA will be packaged in a folder in the source directory which you can copy somewhere else and rename. The now compiled NVDA works much like that of the portable NVDA that you can grab in zipped files from the NVDA-project website. After creating a compiled copy of NVDA from your source copy, you will be able to move the new folder now containing the compiled NVDA anywhere you like, on a cd, on a jump drive, or you could even overwrite an installed copy of NVDA with it.

Before beginning

First, you need to have a source copy of NVDA running smoothly on your system. You can learn how to obtain and run the source copy of NVDA by reading AccessingAndRunningSourceCode.

get py2exe

Next, you'll need a utility that lets you create a windows executable file out of python scripts. This utility is called py2exe. Here is a hotlink for py2exe that worked when I wrote this. http://sf.net/project/downloading.php?group_id=15583&use_mirror=easynews&filename=py2exe-0.6.6.win32-py2.5.exe&75678794 If the hotlink didn't work, or you want to make sure you have the very latest version of py2exe (recommended), follow the below instructions instead of using that hotlink. Otherwise, skip this stuff below and go down to where it says "install py2exe".

brows to download py2exe

Follow the below link to go to the py2exe page on Source Forge. http://sf.net/projects/py2exe now, find the level three heading that says "Download py2exe" and activate that link. When the page comes up, look for a table containing file releases for py2exe, and choose the one for py2exe-aVersionNumberHere.win32-py2.5.exe Note, it's important not to get it for py2.4 or 2.3, it won't work. Make sure it says py2.5.

Install py2exe

To install py2exe, follow the same steps used to install pywin32, comtypes, etc. Activate the py2exe installer and keep on hitting next and finally finish to complete the process.

Compiling NVDA Source

Now that that's complete, it's time to try to compile NVDA. Remember, You must be able to run the source NVDA on your system before you'll be able to compile NVDA with it. Having NVDA running while compiling shouldn't have an effect on the compiling process. To compile, you'll need to use the command prompt to browse to the source directory for NVDA, on my system that is c:\NVDA\source and type

setup.py py2exe

The py2exe scripts will spend a while compiling NVDA into an executable along with all the needed dependancies. On my system it took about 1 minute, and a lot of information was displayed on my command prompt in very rapid succession. There wasn't any indication that the process was finished except that the information about what was happening stopped scrolling. I just typed exit and the command prompt closed and all was great.

using batch files

alternatively, instead of using command prompt, you can compile NVDA using a batch file. This process is actually not more difficult than using the command prompt itself, and it'll make it a breeze to compile new versions of NVDA. Here's how to make the batch file. Open up notepad and type

setup.py py2exe

into the file and hit enter. Now save the notepad document as something like compileNVDA.bat inside your source directory for NVDA. Make sure you don't save the file with a .txt extention, the extention must be .bat. It's ok to have txt selected as the filetype, but the extention must be .bat.

Now, use windows explorer to browse to the batch file you just saved with notepad and activate the batch file itself. You'll get a command prompt window and things should be happening in very rapid succession. After a time, the window will vanish and you'll be dumped back into the source directory again.

did it work?

Ok, now that we've compiled NVDA, let's see what it did for us. You should have a folder inside your source directory named "dist". This folder is the folder inside which the compiled copy of NVDA was placed. You can open the dist folder, navigate to NVDA.exe and activate it to start the newly compiled copy of NVDA. You can also copy the dist folder anywhere you like and rename it to something like NVDA. I have tested with success copying the newly compiled copy of NVDA to the installed NVDA folder in my program files folder: c:\program files\NVDA First, I copied nvda.ini from c:\program files\NVDA to another location. This allowed me to keep my settings after I updated. Next I copied the contents of the dist folder into my installed NVDA folder c:\program files\NVDA and selected the yes to all button when I was asked if I wanted to replace. After about 15 or 20 seconds, the copy was completed. I next copied the nvda.ini file from where I had made a copy of it and placed it back in the NVDA folder, overwriting the nvda.ini file already in there. I launched NVDA and I had a new version of it while still having my settings.

get a pre-created batch file to compile for you

I just wrote a batch file of my own that compiles NVDA, renames nvda.ini in the program files folder, copies the contents of the dist folder onto the program files folder for NVDA, deletes the nvda.ini file that got copied there from the dist folder, then names that old nvda.ini file back to nvda.ini, all of this gets done, hopefully, by simply activating the batch file below. Just download it and put it in the source folder for your NVDA source. here's the link for it http://aarontech.randylaptop.com/screenreaders/NVDA/compileNVDA.bat Note, if you use my batch file, you must have a copy of NVDA that you installed from an installer version that you got from nvda-project.org, and you must have installed NVDA in the default folder c:\program files\nvda. If these aren't the case, you can still use the batch file but you must edit the destination paths so that they'll point to the folder your copy of NVDA is in.