Project

General

Profile

LegacyDevelopersWin32Environment » History » Version 14

Robert Terzi, 12/01/2013 02:15 PM

1 1 Dan Smith
h1. Setting up a Win32 Development Environment
2
3 9 Robert Terzi
{{toc}}
4
5 14 Robert Terzi
h2. Overview
6
7
Chirp is written in Python, an interpreted language. For MS windows, chirp is distributed as a compiled .exe file that installs the compiled code and the necessary runtime dependencies.  To run the chirp code directly you need Python installed as well as several other external libraries:
8
9
 * PyGTK - GTK cross-platform GUI,
10
 * PySerial - serial port connectivity for Python
11
 * PyLibXML2 - XML processing
12
13
You must also obtain a copy of the chirp source code, either by downloading the .tar.gz archive or by using the Mercurial source code management system, known as hg.  Installing Mercurial will allow you to pull the latest updates from the chirp site and automates submission of patches for inclusion in future chirp builds.
14
15
Additional downloads and steps are needed to create chirp installer (.exe) files if you need to distribute your work to other systems for testing.
16
17 13 Robert Terzi
h2. Installing Python
18 1 Dan Smith
19 14 Robert Terzi
 To run chirp you will need to install Python 2.7.x from either "Python.org":http://python.org or "ActiveState":http://www.activestate.com/activepython.  Do not install Python 3 as chirp is currently written for Python 2.7 and above, but will generally run on Python 2.6.x.
20 13 Robert Terzi
21
 * "Python 2.7.x":http://python.org/download/releases/2.7.6/
22
 * "ActivePython Community Edition":http://www.activestate.com/activepython/downloads
23
24
See the steps below to add Python to your system's path after installation.
25
 
26
27 1 Dan Smith
h2. Library and Runtime Prerequisites
28
29 13 Robert Terzi
In addition to Python, several other libraries are needed for the GTK cross-platform GUI, serial port connectivity, and XML processing.
30
31 1 Dan Smith
Get and install the following in this order:
32 7 Jens Jensen
33 1 Dan Smith
 # "PyGTK Win32 All-in-one installer":http://ftp.gnome.org/pub/GNOME/binaries/win32/pygtk/2.24/
34
 # "PyLibXML2":http://users.skynet.be/sbi/libxml-python/
35
 # "PyWin32":http://sourceforge.net/projects/pywin32/files/pywin32/
36
 # "PySerial":http://sourceforge.net/projects/pyserial/files/pyserial/2.5/
37
38 3 Dan Smith
Notes:
39 4 Dan Smith
40 3 Dan Smith
 * For any of the above, be sure to get the latest version, and the py27 variant if/when available.
41 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. 
42
 ** 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.
43 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.)
44 3 Dan Smith
45 5 Dan Smith
When everything is installed, you will want to make sure that Python is in your system PATH variable:
46 1 Dan Smith
47 13 Robert Terzi
48
h2. Putting Python in your path.
49
50
After installing python, you will need to add it to your path.  The Active State Python installer for ActivePython handles this for you.  If you installed from python.org follow these instructions.
51
52
53
54 5 Dan Smith
h3. Windows XP
55
56
 * On the Desktop or in the Start menu, right-click on *My Computer* and choose *Properties*
57
 * In the dialog that opens, on the *Advanced* tab, click on *Environment Variables*
58
 * Under *System variables*, find *Path*, select it, and then edit *Edit*
59 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)
60 5 Dan Smith
 * Click the *OK* buttons until you're done.
61
62
h3. Windows Vista/7
63
64
 * In the Windows menu, right-click on the *Computer* item and choose *Properties*
65
 * Click on *Advanced System Settings* on the left
66
 * In the dialog that opens, click on *Environment Variables*
67
 * Under *System variables*, find *Path*, select it, and then edit *Edit*
68
 * 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)
69
 * Click the *OK* buttons until you're done.
70
71 1 Dan Smith
h2. CHIRP Development Process
72
73
Get and install the mercurial source code management tool:
74
75
 * "Mercurial SCM":http://mercurial.selenic.com/downloads/
76
77
78
h2. Clone the repository
79 2 Dan Smith
80 1 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:
81 2 Dan Smith
82
<pre>
83
C:\Users\Foo> cd \MyWorkspace
84
C:\MyWorkspace> hg clone http://d-rats.com/hg/chirp.hg
85 1 Dan Smith
</pre>
86
87
h2. Run chirp
88 2 Dan Smith
89 1 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:
90 2 Dan Smith
91
<pre>
92
C:\MyWorkspace> cd chirp.hg
93
C:\MyWorkspace\chirp.hg> python chirpw
94 1 Dan Smith
</pre>
95 9 Robert Terzi
96 13 Robert Terzi
h1. Setting up a Win32 Build Environment to create chirp .exe files
97 9 Robert Terzi
98
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.
99
100
# Follow the directions above to create a working chirp development environment
101
# Install py2exe - This utility creates .exe files from python environments.  See http://www.py2exe.org/
102
# Install cygwin - Cygwin provides a Unix/Linux like environment on a Windows system using the freely available GNU tools. See http://www.cygwin.com/
103
## 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.
104
# 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/
105
106
h2. Creating Win32 .exe files
107
108
Follow the above instructions to setup a chirp build environment on a Windows system.
109
110
# Launch Cygwin Terminal to get a command prompt.
111
# cd to the chirp.hg directory where your sources are.
112
# run ./build/make_Win32_build.sh 
113
# The output in winds up in c:\cygwin (To Be Verified)