DevelopersWin32Environment

Version 12 (Robert Terzi, 12/01/2013 01:49 pm)

1 1 Dan Smith
h1. Setting up a Win32 Development Environment
2 1 Dan Smith
3 9 Robert Terzi
{{toc}}
4 9 Robert Terzi
5 1 Dan Smith
h2. Library and Runtime Prerequisites
6 1 Dan Smith
7 1 Dan Smith
Get and install the following in this order:
8 1 Dan Smith
9 7 Jens Jensen
 # "Python 2.7.x":http://python.org/download/releases/2.7.6/
10 1 Dan Smith
 # "PyGTK Win32 All-in-one installer":http://ftp.gnome.org/pub/GNOME/binaries/win32/pygtk/2.24/
11 1 Dan Smith
 # "PyLibXML2":http://users.skynet.be/sbi/libxml-python/
12 1 Dan Smith
 # "PyWin32":http://sourceforge.net/projects/pywin32/files/pywin32/
13 1 Dan Smith
 # "PySerial":http://sourceforge.net/projects/pyserial/files/pyserial/2.5/
14 1 Dan Smith
15 3 Dan Smith
Notes:
16 4 Dan Smith
17 3 Dan Smith
 * For any of the above, be sure to get the latest version, and the py27 variant if/when available.
18 11 Robert Terzi
 * If you are on 64-bit Windows, you must download the versions with the same bitness (either 64-bit or 32-bit) in order for everything to work together, all 32-bit or all 64-bit. 
19 11 Robert Terzi
 ** If your intent is to be able to build an .exe for others to test/use, you should use only the 32-bit versions to ensure the generated .exe will install and run on the widest range of Windows systems.
20 12 Robert Terzi
 * On Windows 7 (and possibly other newer versions of Windows with UAC) the PyLibXML2 installer will generate an error during the installation about not being able to modify the runtime directory. (This appears to be bening but needs to be confirmed.)
21 3 Dan Smith
22 5 Dan Smith
When everything is installed, you will want to make sure that Python is in your system PATH variable:
23 5 Dan Smith
24 5 Dan Smith
h3. Windows XP
25 5 Dan Smith
26 5 Dan Smith
 * On the Desktop or in the Start menu, right-click on *My Computer* and choose *Properties*
27 5 Dan Smith
 * In the dialog that opens, on the *Advanced* tab, click on *Environment Variables*
28 5 Dan Smith
 * Under *System variables*, find *Path*, select it, and then edit *Edit*
29 8 Jens Jensen
 * At the end of the existing value, add exactly this string: @;C:\Python27@ (obviously adjust this path if you installed it elsewhere. Don't forget the leading semicolon)
30 5 Dan Smith
 * Click the *OK* buttons until you're done.
31 5 Dan Smith
32 5 Dan Smith
h3. Windows Vista/7
33 5 Dan Smith
34 5 Dan Smith
 * In the Windows menu, right-click on the *Computer* item and choose *Properties*
35 5 Dan Smith
 * Click on *Advanced System Settings* on the left
36 5 Dan Smith
 * In the dialog that opens, click on *Environment Variables*
37 5 Dan Smith
 * Under *System variables*, find *Path*, select it, and then edit *Edit*
38 5 Dan Smith
 * At the end of the existing value, add exactly this string: @;C:\Python27\bin@ (obviously adjust this path if you installed it elsewhere. Don't forget the leading semicolon)
39 5 Dan Smith
 * Click the *OK* buttons until you're done.
40 5 Dan Smith
41 1 Dan Smith
h2. CHIRP Development Process
42 1 Dan Smith
43 1 Dan Smith
Get and install the mercurial source code management tool:
44 1 Dan Smith
45 1 Dan Smith
 * "Mercurial SCM":http://mercurial.selenic.com/downloads/
46 1 Dan Smith
47 1 Dan Smith
48 1 Dan Smith
h2. Clone the repository
49 1 Dan Smith
50 2 Dan Smith
The next step is to download a copy of the repository. This is done from the command-line, and will create a @chirp.hg/@ directory in your current directory. Thus, you should change to the place you want it to be first. For example:
51 1 Dan Smith
52 2 Dan Smith
<pre>
53 2 Dan Smith
C:\Users\Foo> cd \MyWorkspace
54 2 Dan Smith
C:\MyWorkspace> hg clone http://d-rats.com/hg/chirp.hg
55 2 Dan Smith
</pre>
56 1 Dan Smith
57 1 Dan Smith
h2. Run chirp
58 1 Dan Smith
59 2 Dan Smith
Python should be in your search path from the install, but if not, put it in the system PATH environment variable. Once you do that, you should be able to enter the directory that was created in the clone step above, and run chirpw with python:
60 1 Dan Smith
61 2 Dan Smith
<pre>
62 2 Dan Smith
C:\MyWorkspace> cd chirp.hg
63 2 Dan Smith
C:\MyWorkspace\chirp.hg> python chirpw
64 2 Dan Smith
</pre>
65 9 Robert Terzi
66 9 Robert Terzi
h2. Setting up a Win32 Build Environment to create chirp .exe files
67 9 Robert Terzi
68 9 Robert Terzi
The following notes are for setting up a chirp build environment on a Win32 system, that can be used to create chirp .exe files and the installer for running on other Win32 systems without requiring a Python environment. Note: it is probably best to use the 32 bit versions of all of the components if your intent is to build an .exe that will work on the widest range of Windows systems.
69 9 Robert Terzi
70 9 Robert Terzi
# Follow the directions above to create a working chirp development environment
71 9 Robert Terzi
# Install py2exe - This utility creates .exe files from python environments.  See http://www.py2exe.org/
72 9 Robert Terzi
# Install cygwin - Cygwin provides a Unix/Linux like environment on a Windows system using the freely available GNU tools. See http://www.cygwin.com/
73 9 Robert Terzi
## During the cygwin installation, make sure zip and unzip are installed (from the Archive group) to provide the command line tools that can be used to manipulate ZIP files.
74 9 Robert Terzi
# install NSIS - The free Nullsoft Scriptable Install System is used to create Windows installer packages.  These are the .exe's that most users will download to install chirp on a Windows system.  See http://nsis.sourceforge.net/
75 9 Robert Terzi
76 9 Robert Terzi
h2. Creating Win32 .exe files
77 9 Robert Terzi
78 9 Robert Terzi
Follow the above instructions to setup a chirp build environment on a Windows system.
79 9 Robert Terzi
80 9 Robert Terzi
# Launch Cygwin Terminal to get a command prompt.
81 9 Robert Terzi
# cd to the chirp.hg directory where your sources are.
82 9 Robert Terzi
# run ./build/make_Win32_build.sh 
83 9 Robert Terzi
# The output in winds up in c:\cygwin (To Be Verified)