注册 登录
自由的生活_软路由 返回首页

心想事成的个人空间 https://bbs.routerclub.com/?681 [收藏] [复制] [分享] [RSS]

日志

vc6 编译openvpn 2.1

已有 230 次阅读2009-8-31 18:03 |

http://www.w3china.org/blog/more.asp?name=hongrui&id=46835

编译前 使用最新下载的源码 openssl lzo和pkcs11-helper-1.05.tar.bz2,我使用mingw编译过的,发现很多头文件都有错误。

1 编译 OpenSSL
cd C:\openssl-0.9.8g
perl Configure VC-WIN32 --prefix=c:/openssl
ms\do_masm
nmake -f ms\nt.mak && nmake -f ms\nt.mak test && nmake -f ms\nt.mak install

out32目录下有 libeay32.lib和ssleay32.lib

2 编译 LZO

cd C:\lzo-2.03b\win32\vc.bat 得到lzo2.lib

3 编译 pkcs11-helper

cd C:\pkcs11-helper
cd lib
nmake -f Makefile.w32-vc OPENSSL=1 OPENSSL_HOME=C:\openssl-0.9.8k

生成pkcs11-helper.lib

4 编译OpenVPN

 config-win32.h, 删除 #include "autodefs/defs.h"

vc 没有函数 使用

#ifdef CONFIG_WIN32
#define strcasecmp _stricmp
#endif

nmake -f makefile.w32-vc

patch文件 openvpn-2_1_rc7-windows-compile.patch

diff -u8rp openvpn-2.1_rc7.orig/config-win32.h openvpn-2.1_rc7/config-win32.h
--- openvpn-2.1_rc7.orig/config-win32.h Thu Jan 24 00:38:42 2008
+++ openvpn-2.1_rc7/config-win32.h      Mon May  5 01:21:31 2008
@@ -28,19 +28,19 @@
  *
  * config-win32.h is normally generated by copying
  * config-win32.h.in -> config-win32.h and replacing
  * [ampersand] VERSION [ampersand]
  * with the appropriate version #.  This is normally
  * done automatically by configure.ac
  */

+#include <stdio.h>
 #include <windows.h>
 #include <winsock2.h>
-#include "autodefs/defs.h"

 #define sleep(x) Sleep((x)*1000)

 #define random rand
 #define srandom srand

 typedef unsigned long in_addr_t;

@@ -210,35 +210,35 @@ typedef unsigned long in_addr_t;

 /* Define to 1 if you have the `vsnprintf' function. */
 #define HAVE_VSNPRINTF 1

 /* Special Windows version of getpass() defined in io.c */
 #define HAVE_GETPASS 1

 /* Name of package */
-#define PACKAGE PRODUCT_UNIX_NAME
+#define PACKAGE "openvpn"

 /* Define to the address where bug reports for this package should be sent. */
 //#define PACKAGE_BUGREPORT "openvpn-users@lists.sourceforge.net"

 /* Define to the full name of this package. */
-#define PACKAGE_NAME PRODUCT_NAME
+#define PACKAGE_NAME "OpenVPN"

 /* Define to the one symbol short name of this package. */
-#define PACKAGE_TARNAME PACKAGE
+#define PACKAGE_TARNAME "openvpn"

 /* Define to the version of this package. */
-#define PACKAGE_VERSION PRODUCT_VERSION
+#define PACKAGE_VERSION "2.1_rc7"

 /* Define to the full name and version of this package. */
 #ifdef DEBUG_LABEL
-#define PACKAGE_STRING PACKAGE_NAME " " PACKAGE_VERSION " " DEBUG_LABEL
+#define PACKAGE_STRING "OpenVPN " PACKAGE_VERSION " " DEBUG_LABEL
 #else
-#define PACKAGE_STRING PACKAGE_NAME " " PACKAGE_VERSION
+#define PACKAGE_STRING "OpenVPN " PACKAGE_VERSION
 #endif

 /* Define as the return type of signal handlers (`int' or `void'). */
 #define RETSIGTYPE void

 /* The size of a `unsigned int', as computed by sizeof. */
 #define SIZEOF_UNSIGNED_INT 4

diff -u8rp openvpn-2.1_rc7.orig/tap-win32/common.h openvpn-2.1_rc7/tap-win32/common.h
--- openvpn-2.1_rc7.orig/tap-win32/common.h     Thu Jan 24 00:38:40 2008
+++ openvpn-2.1_rc7/tap-win32/common.h  Mon May  5 01:21:24 2008
@@ -27,17 +27,17 @@
  */

 //===============================================
 // This file is included both by OpenVPN and
 // the TAP-Win32 driver and contains definitions
 // common to both.
 //===============================================

-#include "../autodefs/defs.h"
+#define PRODUCT_TAP_ID "tap0901"
 
 //=============
 // TAP IOCTLs
 //=============

 #define TAP_CONTROL_CODE(request,method) \
   CTL_CODE (FILE_DEVICE_UNKNOWN, request, method, FILE_ANY_ACCESS)


路过

雷人

握手

鲜花

鸡蛋

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 注册

QQ|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )

GMT+8, 2024-5-9 22:11 , Processed in 0.038858 second(s), 5 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2023 Discuz! Team.

返回顶部