Subversion + Apache2 + RapidSVN
Building under Windows 2000

Note: The purpose of this is to give a step-by-step guide to building Subversion.  Some references are made to the INSTALL file that comes with the Subversion source tree.  Install can also be found at http://svn.collab.net/repos/svn/trunk/INSTALL .

Needed Programs and Source Code
   For Subversion
	A.) Apache Web Server 2.0.42 or newer
		- http://www.apache.org
	B.) Apache Portable Runtime
		1.) apr
		2.) apr-util
			- These come with the the Apache source tree.  They are under 
			  c:\httpd-2.0\srclib.
		3.) apr-iconv
			- This needs to be checked with CVS.  INSTALL has more details.
	C.) Berkeley DB 4.0.14
		- A binary is available at http://subversion.tigris.org/servlets/ProjectDownloadList
	D.) Cygwin (for the diff and diff3 functions)
		- http://sources.redhat.com/cygwin
	E.) MIcrosoft Visual C++ 6.0
		- sorry, you have to buy it.
		1.) Newest Microsoft SDK
			- http://www.microsoft.com
	F.) Neon Library 0.23.5
		- http://www.webdav.org/neon/neon-0.23.5.tar.gz
	G.) OpenSSL (if you want it)
		- http://www.openssl.org
		1.) NASM (Free Netwide Assembler)
			- http://www.kernel.org/pub/software/devel/nasm/binaries/win32/
		2.) ActiveState Perl 5.6.1.633
			- http://www.activestate.com/ActivePerl
	H.) Python 2.0
		- http://www.phython.org
	I.) Subversion source code
		- the procedure for getting the subversion source (including bootstrapping 
		  from a zip file is included in INSTALL).
	J.) zlib (if you want it)
		- http://www.gzip.org/zlib
   For RapidSVN
	A.) RapidSVN source code
		- bootstrap from the Subversion zip and use the following command 
		  svn co http://svn.collab.net/repos/svn/clients/rapidsvn/trunk rapidsvn 
	B.) wxWindows 2.3.3
		- download wxMSW-2.3.3.zip

Note: For the purposes of this guide I will make the following assumptions about where things have been installed (if it makes a difference).
	Apache 2.0		-- c:\Apache2
	Apache 2.0 Source	-- c:\httpd-2.0
	Cygwin			-- c:\Program Files\cygwin
	OpenSSL		-- c:\openssl
	Subversion		-- c:\svn	
	wxWindows		-- c:\wxwindows-2.3.3
	zlib			-- c:\zlib
We have also assumed that the repository for Subversion has been created at
	c:\repository
	
Building and Installing Subversion Dependencies
Apache
	Unfortunately building Apache is beyond the scope of this guide.  The apache documentation does and excellent job of explaining everything Apache.  It is available at http://www.apache.org.  You will need to build Apache and have an entire Apache source tree when you go to build Subversion.
Note: Be sure to install the Apache source tree to c:\httpd-2.0 (I had trouble when I didn't).

Apache Portable Runtime
	Both apr and apr-util come with the Apache source tree.  Copy them and apr-iconv to the root of the Subversion source tree ( c:\svn ).  Also copy apr-iconv to c:\httpd-2.0\srclib.

Berkeley DB
	Simply download the newest binary and copy it into the root of your Subversion directory tree ( c:\svn ).  Be sure the directory is named \db4-win32.

Cygwin
	Simply go to http://source.redhat.com/cygwin and download the installer.  From there follow the instructions.
	The only thing of importance is that one must point subversion to the diff and diff3 functions that come with Cygwin.  Simply edit svn_private_config.hw and change the following lines to point to the proper spot.
  #  define SVN_CLIENT_DIFF "C:\\Program Files\cygwin\\bin\\diff.exe"
 #  define SVN_CLIENT_DIFF3 "C:\\Program Files\cygwin\\bin\\diff3.exe"

Microsoft Visual C++ 6.0
	Be sure that you know how to add paths to VC++.  You may need to for this project (and it really is something you should know how to do if you plan to build things using VC++).  Be sure that you have the newest SDK and Service Packs for this.  Watch out though!  The newest SDK is a 400MB download.  
Note: Make sure that you associate the newest SDK with MSVC++.  To do this go into the the Start Menu and select "Register PSDK Directories with Visual Studio" under "Microsoft Platform SDK -> Visual Studio Registration".

Neon 0.23.5
	Extract Neon to the directory c:\neon.  To compile Neon with OpenSSL and zlib support execute the following command in c:\neon from within a DOS prompt.

	nmake /f neon.mak OPENSSL_SRC=c:\openssl ZLIB_SRC=c:\zlib-1.1.4

Note that OpenSSL is dynamically linked and zlib is statically linked (these are the defaults).  Subversion will inherit this support from Neon.  
Warning!  Build OpenSSL and zlib before attempting to build Neon.  See below for instructions.

OpenSSL
	Install ActiveState Perl and NASM (be sure to add NASM to your path in either autoexec.bat or in your Enviormental Variables).  With Microsoft Visual C++ comes a file named vcvars32.bat.  Copy it to c:\openssl (we will use it to set up the environment when we build OpenSSL).  Now perform the following operatios at the DOS prompt.
	1.) C:\openssl> perl Configure VC-WIN32
	2.) C:\openssl> ms\do_nasm
	3.) C:\openssl> vcvars32.bat
	4.) C:\openssl> nmake -f ms\ntdll.mak
We are done building OpenSSL.  Now we just need to make it so Apache will be able to compile mod_ssl.so. 
	5.) Copy c:\openssl to c:\httpd-2.0\srclib\
	6.) Copy ssleay.lib and libeay.lib from c:\openssl\outdll\ to c:\WINNT\System32\
	7.) Open mod_ssl.mak in c:\httpd-2.0\modules\ssl\mod_ssl.mak and make the following
	     changes (Note: characters like this were added).
	
	     	SOURCE=.\ssl_expr_parse.c
	     	#"$(INTDIR)\ssl_expr_parse.obj" : $(SOURCE) "$(INTDIR)"
	     	SOURCE=.\ssl_expr.scan.c
	    	#"$(INTDIR)\ssl_expr_scan.obj" :$(SOURCE) "$(INDIR)"

Note that you are just commenting out those two lines.  When you build Apache mod_ssl.so will also be compiled.

Python 2.0
	This is very easy.  Simply run the executable and you are done.

zlib
	Extract zlib to c:\zlib.  Download zlib113-win32.zip (it's the binary for zlib) and extract it (it doesn't matter where.)  Copy Makefile from the directory where you extracted the binary and put it in c:\zlib-1.1.4.  Execute the following command to build zlib.

	C:\zlib> nmake Makefile

Building Subversion
Performing the following operations will allow you to build Subversion.
	1.) Be sure that \apr, \apr-util, \apr-iconv, \db4-win32, and \neon are all in the root of the 
	     Subversion tree.  If they are not there then your compilation will fail.
	2.) Start MSVC++ and open the Subversion workspace ( c:\svn\subversion.dsw ).
	3.) In MSVC++ go to Build->Set Active Configuration and choose _build_-Win32 Release
	4.) In MSVC++ go to Build->build to begin compiling Subversion.

In order to dynamically link Subversion into Apache you will need to compile mod_dav_svn.so. 
	5.) Search for the file libhttpd.lib and copy the entire content of the directory within
	     which it resides into c:\httpd-2.0\Release
	6.) Search for the following files and copy them into c:\httpd-2.0\srclib\apr\Release.
		apr.lib, libapr.exp, and libapr.lib    
	7.) Search for the following files and copy them to c:\httpd-2.0\srclib\aprutil\Release
		libaprutil.exp and libaprutil.lib 
	8.) Copy mod_dav.lib and mod_dav.exp from c:\Apache2\lib to c:\httpd-2.0\Release 	     and c:\httpd-2.0\modules\dav\main\Release
	9.) In MSVC++ set the Active Configuration to be "mod_dav_svn - Win32 Release" and 
	     build it.

All that is left to do is to get Apache to start up with Subversion!
	10.) Copy mod_dav_svn.so into c:\Apache2\modules
	11.) Copy libdb40.dll from c:\svn\db4-win32\bin to c:\Apache2\bin
	12.) Edit httpd.conf for Apache and do the following.
		- Uncomment the lines
			LoadModule dav_module modules/mod_dav.so
			LoadModule dav_fs_module modules/mod_dav_fs.so
		- Add the following line directly below the above two lines.
			LoadModule dav_svn_module modules/mod_dav_svn.so
		- Add the following to the end of httpd.conf
			<Location /svn/repos>
				DAV svn
				SVNPath c:/repository
			</Location>

If everything has gone properly then you now have a working Subversion server!
Note: If you get an error stating that the compiler can not find libdb40.dll and you are sure that you have put Berkeley DB in the proper spot then the files may have the wrong name.  Rename libdb41.* to libdb40.* in c:\svn\db4-win32\bin.
Note: Do not forget to create a repository using svnadmin.

Buildint RapidSVN
Note: You must have a Subversion server in built in order to build RapidSVN.

The first thing to do is to build wxWindows as RapidSVN depends on it.
	1.) Copy the \wx directory from c:\wxwindows-2.3.3\include\ to c:\wxwindows\
	2.) Open up the wxWindows workspace ( wxWindows.dsw ) in MSVC++
	3.) Build.

There is only one more thing to do before we can compile RapidSVN.
	1.) Add the following to your environmental variables.  To get to these variables right-click
	     on My Computer -> Properties -> Advanced and click Environmental Variables.
	2.) Add the following.
		set WX=C:\wxwindows-2.3.3
		set SUBVERSION=C:\svn

Now we are ready to build RapidSVN.
	1.) Open the RapidSVN workspace in MSVC++ ( rapidsvn.dsw ).
	2.) Set your active project to be "rapidsvn - Win32 Release"
	3.) Build.

That's it!

Final Notes: You may (probably will) find it useful to add a reference to libdb40.dll in your CLASSPATH.

For questions contact: Ciruce Movahedi-Lankarani at radix@psu.edu