Configuring the Development Environment


Before source code begins migrating, a decision about the target build environment needs to be made. This decision should have been a part of the business case for the migration project because each choice has cost and benefit implications. This section considers Interix and Microsoft Visual Studio as target build environments.

Installation of each set of tools requires a suitably sized and configured Windows-based infrastructure. This includes hardware and software for the development servers and for the developer s desktop computers. For more information about implementing a Windows network or procuring and installing tool software, see your Microsoft Windows documentation or third-party tools documentation.

Configuring Interix

After Interix is installed, it needs to be configured. Administrators probably wantto add directories to the PATH variable in startup files. An administrator may want PATH to point to, say, programs and shell scripts in a directory named bin under the home directory. For examples of how to modify PATH , under /etc, see the files profile, profile.lcl, and profile.usr.

To manage the logon environment, create login scripts in the home directory. The Korn shell uses the login script .profile. Interix provides the /etc/profile.usr file asa template for creating .profile. To use the Interix template, copy /etc/profile.usr to the home directory and rename it .profile. Then edit .profile to set the initial environment to the desired requirements. To customize the environment in the C shell, create the files $HOME/. cshrc , $HOME/.history, $HOME/.login, and $HOME/.cshdirs. The C shell runs all of these files when a user logs on.

Interix maps the root directory (/) to the Windows Services for UNIX installation directory, which is C:\SFU by default. Under the Interix root directory are the subdirectories that usually exist in UNIX, such as /usr and /etc. There are also virtual directories, such as /net for network resources and /dev for devices. In addition to entries for the usual devices, the /dev directory includes entries that correspond to Windows drive letters . For example, /dev/fs/A and /dev/fs/C correspond to drives A: and C: respectively.

By default, Interix stores system binaries in one of three directories: /bin, /usr/contrib, or /usr/contrib/bin. It stores the X11 binaries in /usr/X11R5/bin and the Win32 binaries in /usr/ contrib /win32/bin. Some symbolic links are added, for example, so that /usr/bin maps to /bin. Because of this, the file system tree s configuration supports most UNIX application and script ports to the Interix environment.

The creation and management of a development project in Interix proceeds just as in any UNIX environment. First, identify the location and format of the application to be prototyped (ported), and then determine its format (such as compressed tar file). Decide the location to which to load the source tree (and of course verify that there is enough disk space). Be sure that the development platform has the tools required for this application and for any other applications that will be ported toor developed in the Interix environment.

The following sections provide more information about the installation and configuration of Interix with Visual Studio.

Configuring Microsoft Visual Studio

Because of the way Interix references the Visual C++ compiler, the first issue to consider if both are to be installed is which to install first. The following factors need to be considered :

  • If Visual C++ is installed before Interix, it configures the Interix SDK to work with the Visual C++ compiler. That is, the c89 compiler interface utility is setup automatically as the interface to the Microsoft Visual C/C++ compiler.(The c89 utility can also be invoked as cc .)

  • If Visual C++ is installed after Interix, the administrator specifies the locationof the Visual C++ compiler and linker to the cc and c89 utilities. The information supplied by using the Windows System Properties dialog box creates a Windows system variable named INTERIX_COMPILERDIR and sets its value, in POSIX format, to the path of the directory where Visual C++ is installed. For example,if Visual C++ is installed in directory C:\MSDEV, the value of INTERIX_COMPILERDIR is /dev/fs/C/MSDEV. If the path contains spaces, the 8.3-format version of the path must be used.

The default installation location for Visual C++ is the Program Files directory, whose name includes a space. Many utilities, such as makedepend , have trouble reading directory names that contain spaces. If the installation directory name includes spaces, the PATH value has spaces. To avoid these issues, add double quotation marks ( )in the PATH variable around paths that contain spaces.

For example, change

 /dev/fs/C/Program Files/Microsoft Visual Studio/VC98/Bin 

to

 "/dev/fs/C/Program Files/Microsoft Visual Studio/VC98/Bin" 

If cc or c89 still cannot find the compiler, try using the 8.3-format version of the directory name. For example, the 8.3-format name for Program Files is PROGRA~1. Make the same change to the value of the environment variable INTERIX_COMPILERDIR, whose value is the directory in which Visual C++ was installed.

Creating a Project in Visual Studio

The creation and management of projects in Visual Studio needs to take into account the sources to be migrated from UNIX to Windows. Applications come in all sizes. To migrate the sources for a small to medium-sized application to the Visual Studio development environment, simply create the projects manually. Larger projects and their associated batch builds could require additional attention.

In Visual Studio, projects can be created by using the project wizards, by manually creating blank projects, or by using the Visual Studio Automation interface. Which method to use depends on how the source will migrate from UNIX.

Creation of a Visual Studio project by any of these methods must follow these three steps:

  1. Decide on the project type. For example, is it a Win32 project or a Custom C project?

  2. Determine which third-party libraries are necessary.

  3. Define the project settings for the application.

The decision matrix shown in Table 7.3 shows how to use criteria to create anexample Visual Studio project. This example shows considerations for two applications: an X-Windows OpenGL package and a stand-alone console application.

Table 7.3: Application Decision Matrix

Application Type

Visual Studio Project Type

Third-Party Libraries

Project Settings

OpenGL Windows application

Win32 project

OpenGL libraries and cross-platform Windows libraries

Use precompiled headers, compile with edit and continue

Console C application

Custom C project

None

Use standard C library, not Windows defaults




UNIX Application Migration Guide
Unix Application Migration Guide (Patterns & Practices)
ISBN: 0735618380
EAN: 2147483647
Year: 2003
Pages: 134

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net