
This file is intended to describe the steps needed to build Condor version
7.5.5 and later from the source code tree.


==================================
Tools
==================================

For building Condor on Windows 2K/XP, we use Microsoft Visual C++
v6.0 on a machine running Windows 2K with the latest service packs.  

For building Condor on all of our Unix platforms, we use GNU gcc and g++.

On Linux, such as RedHat Linux, we typically use the "default" compiler
version found in /usr/bin/gcc|g++.  For instance, on RedHat Enterprise
Server 3 (the recommended Linux build platform), we use gcc 3.2.3. 
For a complete list of platforms and supported compiler versions, see:
http://www.cs.wisc.edu/condor/manual/latest/1_5Availability.html
We cannot make any claims about the ability to compile Condor with any
other compilers or other versions of gcc.

Building Condor on Unix also requires the following utilities:
- cmake (2.8.3 or greater)
- GNU autoconf and autoheader (2.59 or greater), automake
- GNU make
- GNU tar (1.13 or higher)
- gzip
- perl (5.005_03 or greater)
- patch (must support unified diffs, GNU patch is preferred)
- strip (can be either GNU or the vendor's version)
- lex/flex
- yacc (or bison)
- curses5
- X11 (if you want kbdd support)
- awk (which can do the extended regular expression set (e.g., gawk, not mawk))
- some other typically-found utilities (for example, cut, etc.)

All of these tools need to be available in order to perform a build.

For the remainder of this README, follow the instructions before for either
Unix or Win32.


==================================
External software packages
==================================

On both UNIX and Windows, the Condor build depends on some external
software packages (Globus, zlib, etc).  There are two methods for
getting and linking against these external libraries.  The one
supported in this document is to have the build system download
and compile packages plus patches from the UW external collection.
The other method is to configure the build as a 'proper' build that
uses native libraries from the system.  The rest of this document
will assume the former approach.

The specific versions of each external software package used for a
given version of Condor are listed in the
build/cmake/CondorConfigure.cmake file (search for instances of the
"CONDOR_EXTERNAL_DIR" macro), and depend on what platform you are
building on.  Generally, these versions do not change frequently when
new versions of Condor are released.



==================================
BUILDING CONDOR ON UNIX
==================================

1) Make certain that a proper version of gcc and g++ is in your PATH,
along with the other required tools described above.

2) The source release of Condor should contain the following
directories: build, externals and src.  It may be necessary to edit
the files in build/cmake to match your environment.  In particular,
SystemSpecificInformations.cmake is of possible interest.

3) Run "./configure_uw".

In case of problems, additional arguments may need to be passed to
cmake by appending them to the command-line to configure_uw.  On most
common platforms, no additional build options are required. For other
platforms, there are several ways to explore the build options:

    * ccmake
    * cmake-gui
    * cmake -i
    * nmi_tools/glue/SubmitInfo.pm, which shows the build options that
      are used to build Condor on a wide variety of platforms in the
      NMI build system.

4) Run "make" to build everything.  Additional make targets of interest:

    * make install   (copy binaries to ./release_dir)
    * make package   (create packages)



==================================
BUILDING CONDOR ON WIN32
==================================

1. Install your tools (make sure to have their paths added to system path)
	a) Visual Studio 2012 
		* (64-bit tools not needed atm, but good to install for future) 
	b) Perl
	    * http://www.activestate.com/activeperl/downloads
	c) Python (if python bindings are desired) (3.4+ version is fine)
		* https://www.python.org/downloads/
	d) CMake
		* http://www.cmake.org/download/
	e) Git
		* http://git-scm.com/download/win
	f) Wix (if you wish to craft installer msi file)
		* http://wix.codeplex.com/ 
	g) 7-zip 
		* http://www.7-zip.org/download.html

2. Configure your environment
	a) You can invoke any shell you wish but make sure that the paths 
		to the tools are available. Additionally you should add an additional
		path (b) for building in Windows.  These can be added after the source 
		code is on the system since the paths are relative to the condor source.
		1) I use the command prompt shell provided with Visual Studio installation.
			This sets up the paths to the Visual Studio toolsets automatically. 
			e.g.
				"C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Visual Studio 2012\Visual Studio Tools\Developer Command Prompt for VS2012.lnk" 
	b)Add <PATH_TO_CONDOR_SRC>\condor\msconfig to path

3. Get the source code. 
	a) in an environment shell change directories to where you would like the condor
		folder created by the git clone command. 
	b) clone the condor repository
		1) git clone http://condor-git.cs.wisc.edu/repos/condor.git
	This will take a while and once done you will have the condor source tree in the current
	working directory. 
	* remember to add the condor\msconfig to your path

4. build condor
	There are 2 methods to build condor 1. in source build and 2. out of source build
	a) in source build
		This method builds the binaries within the source tree. 
		1) cd to within the condor folder.
		2) Generate the Visual Studio solution files with CMake
			cmake -G "Visual Studio 11 2012"
	b) out of source builds
		This method preserves the source tree and creates all files out side of the source tree
		1) cd to within the condor folder and set _condor_sources environment variable
			cd condor
			set _condor_sources=%CD%
		2) Make a directory somewhere else you would like to build and cd there
			md c:\src\build_dest
			cd /d c:\src\build_dest
		3) Generate the Visual Studio solution files with CMake
			cmake CMakeLists.txt -G "Visual Studio 11 2012" %_condor_sources%
	c) Build condor
		1) within the IDE
			a) Launch Visual Studio editor and open the CONDOR.sln
			b) Select the build type Debug or RelWithDebInfo (Release is being deprecated)
			c) Choose the All_BUILD project
			d) build
		2) with the command line
			a) With devenv
				devenv CONDOR.sln /Build RelWithDebInfo or
			   	devenv CONDOR.sln /Build Debug
			b) With msbuild
				msbuild CONDOR.sln /t:ALL_BUILD /p:Configuration:RelWithDebugInfo or
				msbuild CONDOR.sln /t:ALL_BUILD /p:Configuration:Debug

5. Creating installer
	An msi style installer can be created with included scripts and with the aid of the Wix tools.
	a) Copy the build sources to an installer staging area with cmake. (this will create a directory 
		at the CMAKE_INSTALL_PREFIX path)
			cmake -DBUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX:PATH=c:\src\installer\release_dir -P cmake_install.cmake
	b) Change directory to the copied location and run the do_wix.bat batch file
		cd c:\src\installer\release_dir
		etc\WiX\do_wix.bat %CD% c:\src\installer\Condor_installer.msi

=================================
OLD instructions as of 11-6-2014
=================================
1. Make certain that you have Microsoft Visual C++ 6.0 installed,
	and that you have the "bin" directory to Visual C++ in your path.
	For example, by default VC++ 6.0 will install into:
	   C:\Program Files\Microsoft Visual Studio\VC98\bin 
	So make certain this bin subdirectory is in your path. Also, make
	certain that both "cl.exe" and "rebase.exe" exist in this
	subdirectory. The rebase.exe tool is installed by the VC++ 6.0
	installation program when you tell it to install the resource
	developer kit tools (which is installed by default, I think).

2. Into a subdirectory, unzip/untar the source files to Condor -  be
	certain to have the subdirectories created intact!!!!!!  For
	example, you should find the following subdirectories and likely
	others as well:

    + "src" - contains the source code (can be shared across Win32 and Unix)
    + "build" - contains cmake configuration files
    + "msconfig" - contains files to build Condor source on Win32
	+ "externals" - contains links to external packages that
		Condor requires, such as OpenSSL, gSoap, etc; these external
		packages will be built as part of the Condor build process.

3. Starting with Condor 6.6.7 and above, you should also have a copy
	of the Microsoft Platform SDK for Windows XP SP2 installed on your
	Machine.  You can pick it up from this URL:
	   http://www.microsoft.com/msdownload/platformsdk/sdkupdate 
	Note: The SDK is now part of a larger package called Windows® Server
	2003 SP1 Platform SDK. The link won't work unless you're running a
	recent version of Internet Explorer (no Firefox, bummer!).

	+ You must have the SDK directory in your path (by default it's
	C:\Program Files\Microsoft Platform SDK). Our make.bat file
	prepares the command line build environment for you. You do not need
	Windows XP SP2 to build Condor, though 2000 or XP is recommended.

	+ Look at .\msconfig\set_env.bat line 28 (the set PATH= statement),
	and make sure that the right directory name is specified for the
	Platform SDK.

	+ If the SDK directory (\Program Files\Microsoft Platform SDK)
	contains SetEnv.cmd (and not setenv.bat), then issue a "copy
	SetEnv.cmd setenv.bat" in the platform SDK subdirectory.  Our build
	scripts expect to find "setenv.bat".

4. Run "cmake-gui".

5. Install perl if not already on your machine

    * http://www.activestate.com/activeperl/downloads 

6. Install the lastest platform SDK and reopen the solution

    * http://msdn.microsoft.com/en-us/windows/bb980924 

7. Download and install WiX 3.0 on your windows machine

    * http://wix.codeplex.com/ 

8. Download and install 7-zip (you will need to add it to your PATH)

    * http://www.7-zip.org/download.html 

9. Patch your version of cmake/cpack to enable wix support by dropping
the following into your cmake path. You may want to verify with a diff
tool such as beyond compare when updating. NOTE: This patch is making
it's way upstream, hopefully in the next point release.

    * https://docs.google.com/leaf?id=0Bzq0eFfVveNqZTgxNjQyZmItNmEyNy00MWZlLTg2NTktMzJiYjljMDc3NTQ0&sort=name&layout=list&num=50 

10.) Open Tools->Options under "Projects and Solutions" click on VC++
Directories and add the following to the Executable directories

    * $(SolutionDir)\msconfig
    * Move $(PATH) to the bottom as sometimes C:\cygwin\bin is in the
      $(PATH) which can cause issues with condor's bundled binaries.

11.) Open and build. 

	+ From inside of Visual C++, choose the menu option "Build/Set
	Active Configuration...". Select the item at the top of the list,
	which is "Condor - Win32 Release".

	+ Now press F7 to build Condor.

12. Once you have built a release of Condor,
	now from the command prompt, cd back into the msconfig
	subdirectory.  From a command prompt in the msconfig
	directory, run:

    	dorelease <path-to-final-release-subdirectory> 

	The dorelease.bat script will copy the all the necessary executables and
	DLL files into the specified release subdirectory. It will then
	strip out the debugging information from all the executables
	(shrinking them to a fraction of their former size). It will leave
	the debug information for the Condor daemons inside of *.dbg files
	-- you can delete these if you do not desire to debug the resulting
	daemons. So if you do

		cd msconfig
		dorelease c:\condor

	then everything needed for Condor will end up in c:\condor\bin. 
	

Questions relating to Condor can be sent to condor-admin@cs.wisc.edu.
