-@echo off\r
-cd %HOME%\r
-rem build a request for a cert that will be valid for ten years\r
-openssl req -days 3650 -new -keyout %KEY_DIR%\%1.key -out %KEY_DIR%\%1.csr -config %KEY_CONFIG%\r
-rem sign the cert request with our ca, creating a cert/key pair\r
-openssl ca -days 3650 -out %KEY_DIR%\%1.crt -in %KEY_DIR%\%1.csr -config %KEY_CONFIG%\r
-rem delete any .old files created in this process, to avoid future file creation errors\r
-del /q %KEY_DIR%\*.old\r
+@echo off
+cd %HOME%
+rem build a request for a cert that will be valid for ten years
+openssl req -days 3650 -new -keyout %KEY_DIR%\%1.key -out %KEY_DIR%\%1.csr -config %KEY_CONFIG%
+rem sign the cert request with our ca, creating a cert/key pair
+openssl ca -days 3650 -out %KEY_DIR%\%1.crt -in %KEY_DIR%\%1.csr -config %KEY_CONFIG%
+rem delete any .old files created in this process, to avoid future file creation errors
+del /q %KEY_DIR%\*.old
-@echo off\r
-cd %HOME%\r
-rem build a request for a cert that will be valid for ten years\r
-openssl req -days 3650 -new -keyout %KEY_DIR%\%1.key -out %KEY_DIR%\%1.csr -config %KEY_CONFIG%\r
-rem sign the cert request with our ca, creating a cert/key pair\r
-openssl ca -days 3650 -out %KEY_DIR%\%1.crt -in %KEY_DIR%\%1.csr -config %KEY_CONFIG%\r
-rem delete any .old files created in this process, to avoid future file creation errors\r
-del /q %KEY_DIR%\*.old\r
+@echo off
+cd %HOME%
+rem build a request for a cert that will be valid for ten years
+openssl req -days 3650 -new -keyout %KEY_DIR%\%1.key -out %KEY_DIR%\%1.csr -config %KEY_CONFIG%
+rem sign the cert request with our ca, creating a cert/key pair
+openssl ca -days 3650 -out %KEY_DIR%\%1.crt -in %KEY_DIR%\%1.csr -config %KEY_CONFIG%
+rem delete any .old files created in this process, to avoid future file creation errors
+del /q %KEY_DIR%\*.old
-@echo off\r
-cd %HOME%\r
-rem build a request for a cert that will be valid for ten years\r
-openssl req -days 3650 -new -keyout %KEY_DIR%\%1.key -out %KEY_DIR%\%1.csr -config %KEY_CONFIG%\r
-rem sign the cert request with our ca, creating a cert/key pair\r
-openssl ca -days 3650 -out %KEY_DIR%\%1.crt -in %KEY_DIR%\%1.csr -extensions server -config %KEY_CONFIG%\r
-rem delete any .old files created in this process, to avoid future file creation errors\r
-del /q %KEY_DIR%\*.old\r
+@echo off
+cd %HOME%
+rem build a request for a cert that will be valid for ten years
+openssl req -days 3650 -new -keyout %KEY_DIR%\%1.key -out %KEY_DIR%\%1.csr -config %KEY_CONFIG%
+rem sign the cert request with our ca, creating a cert/key pair
+openssl ca -days 3650 -out %KEY_DIR%\%1.crt -in %KEY_DIR%\%1.csr -extensions server -config %KEY_CONFIG%
+rem delete any .old files created in this process, to avoid future file creation errors
+del /q %KEY_DIR%\*.old
-/*\r
- * OpenVPN -- An application to securely tunnel IP networks\r
- * over a single TCP/UDP port, with support for SSL/TLS-based\r
- * session authentication and key exchange,\r
- * packet encryption, packet authentication, and\r
- * packet compression.\r
- *\r
- * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@openvpn.net>\r
- *\r
- * This program is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License version 2\r
- * as published by the Free Software Foundation.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program (see the file COPYING included with this\r
- * distribution); if not, write to the Free Software Foundation, Inc.,\r
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- */\r
-\r
-#include "syshead.h"\r
-\r
-#if PROXY_DIGEST_AUTH\r
-\r
-#include "crypto.h"\r
-#include "httpdigest.h"\r
-\r
-static void\r
-CvtHex(\r
- IN HASH Bin,\r
- OUT HASHHEX Hex\r
- )\r
-{\r
- unsigned short i;\r
- unsigned char j;\r
-\r
- for (i = 0; i < HASHLEN; i++) {\r
- j = (Bin[i] >> 4) & 0xf;\r
- if (j <= 9)\r
- Hex[i*2] = (j + '0');\r
- else\r
- Hex[i*2] = (j + 'a' - 10);\r
- j = Bin[i] & 0xf;\r
- if (j <= 9)\r
- Hex[i*2+1] = (j + '0');\r
- else\r
- Hex[i*2+1] = (j + 'a' - 10);\r
- };\r
- Hex[HASHHEXLEN] = '\0';\r
-};\r
-\r
-/* calculate H(A1) as per spec */\r
-void\r
-DigestCalcHA1(\r
- IN char * pszAlg,\r
- IN char * pszUserName,\r
- IN char * pszRealm,\r
- IN char * pszPassword,\r
- IN char * pszNonce,\r
- IN char * pszCNonce,\r
- OUT HASHHEX SessionKey\r
- )\r
-{\r
- MD5_CTX Md5Ctx;\r
- HASH HA1;\r
-\r
- MD5_Init(&Md5Ctx);\r
- MD5_Update(&Md5Ctx, pszUserName, strlen(pszUserName));\r
- MD5_Update(&Md5Ctx, ":", 1);\r
- MD5_Update(&Md5Ctx, pszRealm, strlen(pszRealm));\r
- MD5_Update(&Md5Ctx, ":", 1);\r
- MD5_Update(&Md5Ctx, pszPassword, strlen(pszPassword));\r
- MD5_Final(HA1, &Md5Ctx);\r
- if (pszAlg && strcasecmp(pszAlg, "md5-sess") == 0)\r
- {\r
- MD5_Init(&Md5Ctx);\r
- MD5_Update(&Md5Ctx, HA1, HASHLEN);\r
- MD5_Update(&Md5Ctx, ":", 1);\r
- MD5_Update(&Md5Ctx, pszNonce, strlen(pszNonce));\r
- MD5_Update(&Md5Ctx, ":", 1);\r
- MD5_Update(&Md5Ctx, pszCNonce, strlen(pszCNonce));\r
- MD5_Final(HA1, &Md5Ctx);\r
- };\r
- CvtHex(HA1, SessionKey);\r
-}\r
-\r
-/* calculate request-digest/response-digest as per HTTP Digest spec */\r
-void\r
-DigestCalcResponse(\r
- IN HASHHEX HA1, /* H(A1) */\r
- IN char * pszNonce, /* nonce from server */\r
- IN char * pszNonceCount, /* 8 hex digits */\r
- IN char * pszCNonce, /* client nonce */\r
- IN char * pszQop, /* qop-value: "", "auth", "auth-int" */\r
- IN char * pszMethod, /* method from the request */\r
- IN char * pszDigestUri, /* requested URL */\r
- IN HASHHEX HEntity, /* H(entity body) if qop="auth-int" */\r
- OUT HASHHEX Response /* request-digest or response-digest */\r
- )\r
-{\r
- MD5_CTX Md5Ctx;\r
- HASH HA2;\r
- HASH RespHash;\r
- HASHHEX HA2Hex;\r
-\r
- // calculate H(A2)\r
- MD5_Init(&Md5Ctx);\r
- MD5_Update(&Md5Ctx, pszMethod, strlen(pszMethod));\r
- MD5_Update(&Md5Ctx, ":", 1);\r
- MD5_Update(&Md5Ctx, pszDigestUri, strlen(pszDigestUri));\r
- if (strcasecmp(pszQop, "auth-int") == 0)\r
- {\r
- MD5_Update(&Md5Ctx, ":", 1);\r
- MD5_Update(&Md5Ctx, HEntity, HASHHEXLEN);\r
- };\r
- MD5_Final(HA2, &Md5Ctx);\r
- CvtHex(HA2, HA2Hex);\r
-\r
- // calculate response\r
- MD5_Init(&Md5Ctx);\r
- MD5_Update(&Md5Ctx, HA1, HASHHEXLEN);\r
- MD5_Update(&Md5Ctx, ":", 1);\r
- MD5_Update(&Md5Ctx, pszNonce, strlen(pszNonce));\r
- MD5_Update(&Md5Ctx, ":", 1);\r
- if (*pszQop)\r
- {\r
- MD5_Update(&Md5Ctx, pszNonceCount, strlen(pszNonceCount));\r
- MD5_Update(&Md5Ctx, ":", 1);\r
- MD5_Update(&Md5Ctx, pszCNonce, strlen(pszCNonce));\r
- MD5_Update(&Md5Ctx, ":", 1);\r
- MD5_Update(&Md5Ctx, pszQop, strlen(pszQop));\r
- MD5_Update(&Md5Ctx, ":", 1);\r
- };\r
- MD5_Update(&Md5Ctx, HA2Hex, HASHHEXLEN);\r
- MD5_Final(RespHash, &Md5Ctx);\r
- CvtHex(RespHash, Response);\r
-}\r
-\r
-#endif\r
+/*
+ * OpenVPN -- An application to securely tunnel IP networks
+ * over a single TCP/UDP port, with support for SSL/TLS-based
+ * session authentication and key exchange,
+ * packet encryption, packet authentication, and
+ * packet compression.
+ *
+ * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@openvpn.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program (see the file COPYING included with this
+ * distribution); if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "syshead.h"
+
+#if PROXY_DIGEST_AUTH
+
+#include "crypto.h"
+#include "httpdigest.h"
+
+static void
+CvtHex(
+ IN HASH Bin,
+ OUT HASHHEX Hex
+ )
+{
+ unsigned short i;
+ unsigned char j;
+
+ for (i = 0; i < HASHLEN; i++) {
+ j = (Bin[i] >> 4) & 0xf;
+ if (j <= 9)
+ Hex[i*2] = (j + '0');
+ else
+ Hex[i*2] = (j + 'a' - 10);
+ j = Bin[i] & 0xf;
+ if (j <= 9)
+ Hex[i*2+1] = (j + '0');
+ else
+ Hex[i*2+1] = (j + 'a' - 10);
+ };
+ Hex[HASHHEXLEN] = '\0';
+};
+
+/* calculate H(A1) as per spec */
+void
+DigestCalcHA1(
+ IN char * pszAlg,
+ IN char * pszUserName,
+ IN char * pszRealm,
+ IN char * pszPassword,
+ IN char * pszNonce,
+ IN char * pszCNonce,
+ OUT HASHHEX SessionKey
+ )
+{
+ MD5_CTX Md5Ctx;
+ HASH HA1;
+
+ MD5_Init(&Md5Ctx);
+ MD5_Update(&Md5Ctx, pszUserName, strlen(pszUserName));
+ MD5_Update(&Md5Ctx, ":", 1);
+ MD5_Update(&Md5Ctx, pszRealm, strlen(pszRealm));
+ MD5_Update(&Md5Ctx, ":", 1);
+ MD5_Update(&Md5Ctx, pszPassword, strlen(pszPassword));
+ MD5_Final(HA1, &Md5Ctx);
+ if (pszAlg && strcasecmp(pszAlg, "md5-sess") == 0)
+ {
+ MD5_Init(&Md5Ctx);
+ MD5_Update(&Md5Ctx, HA1, HASHLEN);
+ MD5_Update(&Md5Ctx, ":", 1);
+ MD5_Update(&Md5Ctx, pszNonce, strlen(pszNonce));
+ MD5_Update(&Md5Ctx, ":", 1);
+ MD5_Update(&Md5Ctx, pszCNonce, strlen(pszCNonce));
+ MD5_Final(HA1, &Md5Ctx);
+ };
+ CvtHex(HA1, SessionKey);
+}
+
+/* calculate request-digest/response-digest as per HTTP Digest spec */
+void
+DigestCalcResponse(
+ IN HASHHEX HA1, /* H(A1) */
+ IN char * pszNonce, /* nonce from server */
+ IN char * pszNonceCount, /* 8 hex digits */
+ IN char * pszCNonce, /* client nonce */
+ IN char * pszQop, /* qop-value: "", "auth", "auth-int" */
+ IN char * pszMethod, /* method from the request */
+ IN char * pszDigestUri, /* requested URL */
+ IN HASHHEX HEntity, /* H(entity body) if qop="auth-int" */
+ OUT HASHHEX Response /* request-digest or response-digest */
+ )
+{
+ MD5_CTX Md5Ctx;
+ HASH HA2;
+ HASH RespHash;
+ HASHHEX HA2Hex;
+
+ // calculate H(A2)
+ MD5_Init(&Md5Ctx);
+ MD5_Update(&Md5Ctx, pszMethod, strlen(pszMethod));
+ MD5_Update(&Md5Ctx, ":", 1);
+ MD5_Update(&Md5Ctx, pszDigestUri, strlen(pszDigestUri));
+ if (strcasecmp(pszQop, "auth-int") == 0)
+ {
+ MD5_Update(&Md5Ctx, ":", 1);
+ MD5_Update(&Md5Ctx, HEntity, HASHHEXLEN);
+ };
+ MD5_Final(HA2, &Md5Ctx);
+ CvtHex(HA2, HA2Hex);
+
+ // calculate response
+ MD5_Init(&Md5Ctx);
+ MD5_Update(&Md5Ctx, HA1, HASHHEXLEN);
+ MD5_Update(&Md5Ctx, ":", 1);
+ MD5_Update(&Md5Ctx, pszNonce, strlen(pszNonce));
+ MD5_Update(&Md5Ctx, ":", 1);
+ if (*pszQop)
+ {
+ MD5_Update(&Md5Ctx, pszNonceCount, strlen(pszNonceCount));
+ MD5_Update(&Md5Ctx, ":", 1);
+ MD5_Update(&Md5Ctx, pszCNonce, strlen(pszCNonce));
+ MD5_Update(&Md5Ctx, ":", 1);
+ MD5_Update(&Md5Ctx, pszQop, strlen(pszQop));
+ MD5_Update(&Md5Ctx, ":", 1);
+ };
+ MD5_Update(&Md5Ctx, HA2Hex, HASHHEXLEN);
+ MD5_Final(RespHash, &Md5Ctx);
+ CvtHex(RespHash, Response);
+}
+
+#endif
-/*\r
- * OpenVPN -- An application to securely tunnel IP networks\r
- * over a single TCP/UDP port, with support for SSL/TLS-based\r
- * session authentication and key exchange,\r
- * packet encryption, packet authentication, and\r
- * packet compression.\r
- *\r
- * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@openvpn.net>\r
- *\r
- * This program is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License version 2\r
- * as published by the Free Software Foundation.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program (see the file COPYING included with this\r
- * distribution); if not, write to the Free Software Foundation, Inc.,\r
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- */\r
-\r
-#if PROXY_DIGEST_AUTH\r
-\r
-#define HASHLEN 16\r
-typedef unsigned char HASH[HASHLEN];\r
-#define HASHHEXLEN 32\r
-typedef unsigned char HASHHEX[HASHHEXLEN+1];\r
-#undef IN\r
-#undef OUT\r
-#define IN const\r
-#define OUT\r
-\r
-/* calculate H(A1) as per HTTP Digest spec */\r
-void DigestCalcHA1(\r
- IN char * pszAlg,\r
- IN char * pszUserName,\r
- IN char * pszRealm,\r
- IN char * pszPassword,\r
- IN char * pszNonce,\r
- IN char * pszCNonce,\r
- OUT HASHHEX SessionKey\r
- );\r
-\r
-/* calculate request-digest/response-digest as per HTTP Digest spec */\r
-void DigestCalcResponse(\r
- IN HASHHEX HA1, /* H(A1) */\r
- IN char * pszNonce, /* nonce from server */\r
- IN char * pszNonceCount, /* 8 hex digits */\r
- IN char * pszCNonce, /* client nonce */\r
- IN char * pszQop, /* qop-value: "", "auth", "auth-int" */\r
- IN char * pszMethod, /* method from the request */\r
- IN char * pszDigestUri, /* requested URL */\r
- IN HASHHEX HEntity, /* H(entity body) if qop="auth-int" */\r
- OUT HASHHEX Response /* request-digest or response-digest */\r
- );\r
-\r
-#endif\r
+/*
+ * OpenVPN -- An application to securely tunnel IP networks
+ * over a single TCP/UDP port, with support for SSL/TLS-based
+ * session authentication and key exchange,
+ * packet encryption, packet authentication, and
+ * packet compression.
+ *
+ * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@openvpn.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program (see the file COPYING included with this
+ * distribution); if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#if PROXY_DIGEST_AUTH
+
+#define HASHLEN 16
+typedef unsigned char HASH[HASHLEN];
+#define HASHHEXLEN 32
+typedef unsigned char HASHHEX[HASHHEXLEN+1];
+#undef IN
+#undef OUT
+#define IN const
+#define OUT
+
+/* calculate H(A1) as per HTTP Digest spec */
+void DigestCalcHA1(
+ IN char * pszAlg,
+ IN char * pszUserName,
+ IN char * pszRealm,
+ IN char * pszPassword,
+ IN char * pszNonce,
+ IN char * pszCNonce,
+ OUT HASHHEX SessionKey
+ );
+
+/* calculate request-digest/response-digest as per HTTP Digest spec */
+void DigestCalcResponse(
+ IN HASHHEX HA1, /* H(A1) */
+ IN char * pszNonce, /* nonce from server */
+ IN char * pszNonceCount, /* 8 hex digits */
+ IN char * pszCNonce, /* client nonce */
+ IN char * pszQop, /* qop-value: "", "auth", "auth-int" */
+ IN char * pszMethod, /* method from the request */
+ IN char * pszDigestUri, /* requested URL */
+ IN HASHHEX HEntity, /* H(entity body) if qop="auth-int" */
+ OUT HASHHEX Response /* request-digest or response-digest */
+ );
+
+#endif
--- openssl-0.9.7m.orig/ms/mw.bat Sat Feb 22 11:02:46 2003
+++ openssl-0.9.7m/ms/mw.bat Mon Jan 21 23:12:34 2008
@@ -1,17 +1,23 @@
- @rem OpenSSL with Mingw32\r
- @rem --------------------\r
- \r
+ @rem OpenSSL with Mingw32
+ @rem --------------------
+
+@rem Include MinGW, MSYS, and ActiveState Perl in path
+set PATH=c:\perl\bin;c:\MinGW\bin;c:\msys\1.0\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
+
- @rem Makefile\r
- perl util\mkfiles.pl >MINFO\r
--perl util\mk1mf.pl Mingw32 >ms\mingw32.mak\r
+ @rem Makefile
+ perl util\mkfiles.pl >MINFO
+-perl util\mk1mf.pl Mingw32 >ms\mingw32.mak
+perl util\mk1mf.pl no-idea no-mdc2 no-rc5 Mingw32 >ms\mingw32.mak
+
- @rem DLL definition files\r
--perl util\mkdef.pl 32 libeay >ms\libeay32.def\r
+ @rem DLL definition files
+-perl util\mkdef.pl 32 libeay >ms\libeay32.def
+perl util\mkdef.pl no-idea no-mdc2 no-rc5 32 libeay >ms\libeay32.def
- if errorlevel 1 goto end\r
--perl util\mkdef.pl 32 ssleay >ms\ssleay32.def\r
+ if errorlevel 1 goto end
+-perl util\mkdef.pl 32 ssleay >ms\ssleay32.def
+perl util\mkdef.pl no-idea no-mdc2 no-rc5 32 ssleay >ms\ssleay32.def
- if errorlevel 1 goto end\r
- \r
- @rem Build the libraries\r
--make -f ms/mingw32.mak\r
+ if errorlevel 1 goto end
+
+ @rem Build the libraries
+-make -f ms/mingw32.mak
+
+@rem JY added --win32 flag
+make --win32 -f ms/mingw32.mak
- if errorlevel 1 goto end\r
- \r
- @rem Generate the DLLs and input libraries\r
+ if errorlevel 1 goto end
+
+ @rem Generate the DLLs and input libraries
@@ -20,7 +26,9 @@
- dllwrap --dllname libssl32.dll --output-lib out/libssl32.a --def ms/ssleay32.def out/libssl.a out/libeay32.a\r
- if errorlevel 1 goto end\r
- \r
+ dllwrap --dllname libssl32.dll --output-lib out/libssl32.a --def ms/ssleay32.def out/libssl.a out/libeay32.a
+ if errorlevel 1 goto end
+
+@rem JY added openssl.exe linked to DLL
+gcc -o openssl tmp\verify.o tmp\asn1pars.o tmp\req.o tmp\dgst.o tmp\dh.o tmp\dhparam.o tmp\enc.o tmp\passwd.o tmp\gendh.o tmp\errstr.o tmp\ca.o tmp\pkcs7.o tmp\crl2p7.o tmp\crl.o tmp\rsa.o tmp\rsautl.o tmp\dsa.o tmp\dsaparam.o tmp\x509.o tmp\genrsa.o tmp\gendsa.o tmp\s_server.o tmp\s_client.o tmp\speed.o tmp\s_time.o tmp\apps.o tmp\s_cb.o tmp\s_socket.o tmp\app_rand.o tmp\version.o tmp\sess_id.o tmp\ciphers.o tmp\nseq.o tmp\pkcs12.o tmp\pkcs8.o tmp\spkac.o tmp\smime.o tmp\rand.o tmp\engine.o tmp\ocsp.o tmp\prime.o tmp\openssl.o -leay32 -lssl32 -L. -lwsock32 -lgdi32
+
- echo Done compiling OpenSSL\r
- \r
- :end\r
--\r
+ echo Done compiling OpenSSL
+
+ :end
+-
diff -wur openssl-0.9.7m.orig/util/pl/Mingw32.pl openssl-0.9.7m/util/pl/Mingw32.pl
--- openssl-0.9.7m.orig/util/pl/Mingw32.pl Sun May 16 23:28:32 2004
+++ openssl-0.9.7m/util/pl/Mingw32.pl Mon Jan 21 17:52:36 2008
--- tmp/openssl-0.9.8h/ms/mw.bat Sat Feb 22 11:00:10 2003
+++ openssl-0.9.8h/ms/mw.bat Wed Jun 4 02:56:54 2008
@@ -1,17 +1,23 @@
- @rem OpenSSL with Mingw32\r
- @rem --------------------\r
- \r
+ @rem OpenSSL with Mingw32
+ @rem --------------------
+
+@rem Include MinGW, MSYS, and ActiveState Perl in path
+set PATH=c:\bin;C:\Perl\bin\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\MinGW\bin;c:\msys\1.0\bin
+
- @rem Makefile\r
- perl util\mkfiles.pl >MINFO\r
--perl util\mk1mf.pl Mingw32 >ms\mingw32.mak\r
+ @rem Makefile
+ perl util\mkfiles.pl >MINFO
+-perl util\mk1mf.pl Mingw32 >ms\mingw32.mak
+perl util\mk1mf.pl no-idea no-mdc2 no-rc5 Mingw32 >ms\mingw32.mak
+
- @rem DLL definition files\r
--perl util\mkdef.pl 32 libeay >ms\libeay32.def\r
+ @rem DLL definition files
+-perl util\mkdef.pl 32 libeay >ms\libeay32.def
+perl util\mkdef.pl no-idea no-mdc2 no-rc5 32 libeay >ms\libeay32.def
- if errorlevel 1 goto end\r
--perl util\mkdef.pl 32 ssleay >ms\ssleay32.def\r
+ if errorlevel 1 goto end
+-perl util\mkdef.pl 32 ssleay >ms\ssleay32.def
+perl util\mkdef.pl no-idea no-mdc2 no-rc5 32 ssleay >ms\ssleay32.def
- if errorlevel 1 goto end\r
- \r
- @rem Build the libraries\r
--make -f ms/mingw32.mak\r
+ if errorlevel 1 goto end
+
+ @rem Build the libraries
+-make -f ms/mingw32.mak
+
+@rem JY added --win32
+make --win32 -f ms/mingw32.mak
- if errorlevel 1 goto end\r
- \r
- @rem Generate the DLLs and input libraries\r
+ if errorlevel 1 goto end
+
+ @rem Generate the DLLs and input libraries
-/*\r
- * Minimum TAP-Win32 version number expected by userspace\r
- *\r
- * The TAP-Win32 version number is defined in tap-win32/SOURCES\r
- */\r
-#define TAP_ID "@PRODUCT_TAP_ID@"\r
-#define TAP_WIN32_MIN_MAJOR @PRODUCT_TAP_WIN32_MIN_MAJOR@\r
-#define TAP_WIN32_MIN_MINOR @PRODUCT_TAP_WIN32_MIN_MINOR@\r
-\r
-/* Name of package */\r
-#define PACKAGE "@PRODUCT_UNIX_NAME@"\r
-\r
-/* Define to the full name of this package. */\r
-#define PACKAGE_NAME "@PRODUCT_NAME@"\r
-\r
-/* Define to the one symbol short name of this package. */\r
-#define PACKAGE_TARNAME "@PRODUCT_UNIX_NAME@"\r
-\r
-/* Define to the version of this package. */\r
-#define PACKAGE_VERSION "@PRODUCT_VERSION@"\r
+/*
+ * Minimum TAP-Win32 version number expected by userspace
+ *
+ * The TAP-Win32 version number is defined in tap-win32/SOURCES
+ */
+#define TAP_ID "@PRODUCT_TAP_ID@"
+#define TAP_WIN32_MIN_MAJOR @PRODUCT_TAP_WIN32_MIN_MAJOR@
+#define TAP_WIN32_MIN_MINOR @PRODUCT_TAP_WIN32_MIN_MINOR@
+
+/* Name of package */
+#define PACKAGE "@PRODUCT_UNIX_NAME@"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "@PRODUCT_NAME@"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "@PRODUCT_UNIX_NAME@"
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "@PRODUCT_VERSION@"
-# build autodefs.h and \r
-\r
-import re\r
-\r
-autogen = "Automatically generated by config.py"\r
-\r
-def parse_version_m4(kv, version_m4):\r
- r = re.compile(r'^define\((\w+),\[(.*)\]\)$')\r
- f = open(version_m4)\r
- for line in f:\r
- line = line.rstrip()\r
- m = re.match(r, line)\r
- if m:\r
- g = m.groups()\r
- kv[g[0]] = g[1]\r
- f.close()\r
-\r
-def parse_settings_in(kv, settings_in):\r
- r = re.compile(r'^!define\s+(\w+)(?:\s+"?(.*?)"?)$')\r
- f = open(settings_in)\r
- for line in f:\r
- line = line.rstrip()\r
- m = re.match(r, line)\r
- if m:\r
- g = m.groups()\r
- kv[g[0]] = g[1] or ''\r
- f.close()\r
-\r
-def build_autodefs(kv, autodefs_in, autodefs_out):\r
- def repfn(m):\r
- var, = m.groups()\r
- return kv.get(var, '')\r
-\r
- r = re.compile(r'@(\w+)@')\r
- fin = open(autodefs_in)\r
- fout = open(autodefs_out, 'w')\r
- fout.write("/* %s */\n\n" % autogen)\r
- for line in fin:\r
- newline = re.sub(r, repfn, line)\r
- fout.write(newline)\r
- fin.close()\r
- fout.close()\r
-\r
-def print_key_values(kv):\r
- for k, v in sorted(kv.items()):\r
- print "%s%s%s" % (k, ' '*(32-len(k)), repr(v))\r
-\r
-def get_sources(makefile_am):\r
- c = set()\r
- h = set()\r
- f = open(makefile_am)\r
- state = False\r
- for line in f:\r
- line = line.rstrip()\r
- if line == 'openvpn_SOURCES = \\':\r
- state = True\r
- elif not line:\r
- state = False\r
- elif state:\r
- for sf in line.split():\r
- if sf.endswith('.c'):\r
- c.add(sf[:-2])\r
- elif sf.endswith('.h'):\r
- h.add(sf[:-2])\r
- elif sf == '\\':\r
- pass\r
- else:\r
- print >>sys.stderr, "Unrecognized filename:", sf\r
- f.close()\r
- return [ sorted(list(s)) for s in (c, h) ]\r
-\r
-def output_mak_list(out, title, srclist, ext):\r
- out.write("%s =" % (title,))\r
- for x in srclist:\r
- out.write(" \\\n\t%s.%s" % (x, ext))\r
- out.write('\n\n')\r
-\r
-def output_mak(makefile_am, outfile):\r
- c, h = get_sources(makefile_am)\r
- out = open(outfile, 'w')\r
- out.write("# %s\n\n" % autogen)\r
- output_mak_list(out, 'HEADERS', h, 'h')\r
- output_mak_list(out, 'OBJS', c, 'obj')\r
- out.close()\r
-\r
-def main():\r
- kv = {}\r
- parse_version_m4(kv, 'version.m4')\r
- parse_settings_in(kv, 'install-win32/settings.in')\r
- build_autodefs(kv, 'msvc/autodefs.h.in', 'autodefs.h')\r
- output_mak('Makefile.am', 'head_obj.mak')\r
-\r
-main()\r
+# build autodefs.h and
+
+import re
+
+autogen = "Automatically generated by config.py"
+
+def parse_version_m4(kv, version_m4):
+ r = re.compile(r'^define\((\w+),\[(.*)\]\)$')
+ f = open(version_m4)
+ for line in f:
+ line = line.rstrip()
+ m = re.match(r, line)
+ if m:
+ g = m.groups()
+ kv[g[0]] = g[1]
+ f.close()
+
+def parse_settings_in(kv, settings_in):
+ r = re.compile(r'^!define\s+(\w+)(?:\s+"?(.*?)"?)$')
+ f = open(settings_in)
+ for line in f:
+ line = line.rstrip()
+ m = re.match(r, line)
+ if m:
+ g = m.groups()
+ kv[g[0]] = g[1] or ''
+ f.close()
+
+def build_autodefs(kv, autodefs_in, autodefs_out):
+ def repfn(m):
+ var, = m.groups()
+ return kv.get(var, '')
+
+ r = re.compile(r'@(\w+)@')
+ fin = open(autodefs_in)
+ fout = open(autodefs_out, 'w')
+ fout.write("/* %s */\n\n" % autogen)
+ for line in fin:
+ newline = re.sub(r, repfn, line)
+ fout.write(newline)
+ fin.close()
+ fout.close()
+
+def print_key_values(kv):
+ for k, v in sorted(kv.items()):
+ print "%s%s%s" % (k, ' '*(32-len(k)), repr(v))
+
+def get_sources(makefile_am):
+ c = set()
+ h = set()
+ f = open(makefile_am)
+ state = False
+ for line in f:
+ line = line.rstrip()
+ if line == 'openvpn_SOURCES = \\':
+ state = True
+ elif not line:
+ state = False
+ elif state:
+ for sf in line.split():
+ if sf.endswith('.c'):
+ c.add(sf[:-2])
+ elif sf.endswith('.h'):
+ h.add(sf[:-2])
+ elif sf == '\\':
+ pass
+ else:
+ print >>sys.stderr, "Unrecognized filename:", sf
+ f.close()
+ return [ sorted(list(s)) for s in (c, h) ]
+
+def output_mak_list(out, title, srclist, ext):
+ out.write("%s =" % (title,))
+ for x in srclist:
+ out.write(" \\\n\t%s.%s" % (x, ext))
+ out.write('\n\n')
+
+def output_mak(makefile_am, outfile):
+ c, h = get_sources(makefile_am)
+ out = open(outfile, 'w')
+ out.write("# %s\n\n" % autogen)
+ output_mak_list(out, 'HEADERS', h, 'h')
+ output_mak_list(out, 'OBJS', c, 'obj')
+ out.close()
+
+def main():
+ kv = {}
+ parse_version_m4(kv, 'version.m4')
+ parse_settings_in(kv, 'install-win32/settings.in')
+ build_autodefs(kv, 'msvc/autodefs.h.in', 'autodefs.h')
+ output_mak('Makefile.am', 'head_obj.mak')
+
+main()
-# This makefile builds the user-mode component\r
-# of OpenVPN for Windows in the Visual Studio 2008 environment.\r
-\r
-# To build:\r
-# python msvc\config.py\r
-# nmake /f msvc\msvc.mak\r
-\r
-# Each of the OPENSSL and LZO dirs should have 'lib' and 'include'\r
-# directories under them.\r
-\r
-OPENSSL = \src\openssl\r
-OPENSSL_DYNAMIC = libeay32.lib ssleay32.lib\r
-\r
-LZO = \src\lzo\r
-LZO_DYNAMIC = lzo2.lib\r
-\r
-INCLUDE_DIRS = -I$(OPENSSL)/include -I$(LZO)/include\r
-\r
-LIBS = $(OPENSSL_DYNAMIC) $(LZO_DYNAMIC) ws2_32.lib crypt32.lib iphlpapi.lib winmm.lib user32.lib gdi32.lib advapi32.lib wininet.lib\r
-\r
-LIB_DIRS = -LIBPATH:$(OPENSSL)\lib -LIBPATH:$(LZO)\lib\r
-\r
-EXE = openvpn.exe\r
-\r
-CPP=cl.exe\r
-CPP_ARG_COMMON=/nologo /W3 /O2 -DWIN32 -DWIN32_LEAN_AND_MEAN -D_CONSOLE -D_MBCS -D_CRT_SECURE_NO_DEPRECATE $(INCLUDE_DIRS) /FD /c\r
-# release:\r
-CPP_PROJ=$(CPP_ARG_COMMON) /MD -DNDEBUG\r
-# debug:\r
-#CPP_PROJ=$(CPP_ARG_COMMON) /MDd /Zi /Od -D_DEBUG\r
-\r
-LINK32=link.exe\r
-# release:\r
-LINK32_FLAGS=/nologo /subsystem:console /incremental:no /out:"$(EXE)"\r
-# debug:\r
-#LINK32_FLAGS=/nologo /subsystem:console /incremental:no /debug /out:"$(EXE)"\r
-\r
-# HEADERS and OBJS definitions, automatically generated\r
-!INCLUDE head_obj.mak\r
-\r
-openvpn : $(OBJS)\r
- $(LINK32) @<<\r
- $(LINK32_FLAGS) $(LIB_DIRS) $(LIBS) $(OBJS)\r
-<<\r
-\r
-clean :\r
- del /Q $(OBJS) $(EXE) *.idb *.pdb\r
-\r
-.c.obj::\r
- $(CPP) @<<\r
- $(CPP_PROJ) $<\r
-<<\r
+# This makefile builds the user-mode component
+# of OpenVPN for Windows in the Visual Studio 2008 environment.
+
+# To build:
+# python msvc\config.py
+# nmake /f msvc\msvc.mak
+
+# Each of the OPENSSL and LZO dirs should have 'lib' and 'include'
+# directories under them.
+
+OPENSSL = \src\openssl
+OPENSSL_DYNAMIC = libeay32.lib ssleay32.lib
+
+LZO = \src\lzo
+LZO_DYNAMIC = lzo2.lib
+
+INCLUDE_DIRS = -I$(OPENSSL)/include -I$(LZO)/include
+
+LIBS = $(OPENSSL_DYNAMIC) $(LZO_DYNAMIC) ws2_32.lib crypt32.lib iphlpapi.lib winmm.lib user32.lib gdi32.lib advapi32.lib wininet.lib
+
+LIB_DIRS = -LIBPATH:$(OPENSSL)\lib -LIBPATH:$(LZO)\lib
+
+EXE = openvpn.exe
+
+CPP=cl.exe
+CPP_ARG_COMMON=/nologo /W3 /O2 -DWIN32 -DWIN32_LEAN_AND_MEAN -D_CONSOLE -D_MBCS -D_CRT_SECURE_NO_DEPRECATE $(INCLUDE_DIRS) /FD /c
+# release:
+CPP_PROJ=$(CPP_ARG_COMMON) /MD -DNDEBUG
+# debug:
+#CPP_PROJ=$(CPP_ARG_COMMON) /MDd /Zi /Od -D_DEBUG
+
+LINK32=link.exe
+# release:
+LINK32_FLAGS=/nologo /subsystem:console /incremental:no /out:"$(EXE)"
+# debug:
+#LINK32_FLAGS=/nologo /subsystem:console /incremental:no /debug /out:"$(EXE)"
+
+# HEADERS and OBJS definitions, automatically generated
+!INCLUDE head_obj.mak
+
+openvpn : $(OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LIB_DIRS) $(LIBS) $(OBJS)
+<<
+
+clean :
+ del /Q $(OBJS) $(EXE) *.idb *.pdb
+
+.c.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
-#ifndef AUTODEFS_H\r
-#define AUTODEFS_H\r
-\r
-/*\r
- * Minimum TAP-Win32 version number expected by userspace\r
- *\r
- * The TAP-Win32 version number is defined in tap-win32/SOURCES\r
- */\r
-#define TAP_ID "@PRODUCT_TAP_ID@"\r
-#define TAP_WIN32_MIN_MAJOR @PRODUCT_TAP_WIN32_MIN_MAJOR@\r
-#define TAP_WIN32_MIN_MINOR @PRODUCT_TAP_WIN32_MIN_MINOR@\r
-\r
-/* Friendly name for TAP driver */\r
-#define PRODUCT_TAP_DEVICE_DESCRIPTION "@PRODUCT_TAP_DEVICE_DESCRIPTION@"\r
-\r
-/* Version number of DDK/WDK used to build TAP driver */\r
-#define DDKVER_MAJOR @DDKVER_MAJOR@\r
-\r
-/* Name of package */\r
-#define PACKAGE "@PRODUCT_UNIX_NAME@"\r
-\r
-/* Define to the full name of this package. */\r
-#define PACKAGE_NAME "@PRODUCT_NAME@"\r
-\r
-/* Define to the one symbol short name of this package. */\r
-#define PACKAGE_TARNAME "@PRODUCT_UNIX_NAME@"\r
-\r
-/* Define to the version of this package. */\r
-#define PACKAGE_VERSION "@PRODUCT_VERSION@"\r
-\r
-#endif\r
+#ifndef AUTODEFS_H
+#define AUTODEFS_H
+
+/*
+ * Minimum TAP-Win32 version number expected by userspace
+ *
+ * The TAP-Win32 version number is defined in tap-win32/SOURCES
+ */
+#define TAP_ID "@PRODUCT_TAP_ID@"
+#define TAP_WIN32_MIN_MAJOR @PRODUCT_TAP_WIN32_MIN_MAJOR@
+#define TAP_WIN32_MIN_MINOR @PRODUCT_TAP_WIN32_MIN_MINOR@
+
+/* Friendly name for TAP driver */
+#define PRODUCT_TAP_DEVICE_DESCRIPTION "@PRODUCT_TAP_DEVICE_DESCRIPTION@"
+
+/* Version number of DDK/WDK used to build TAP driver */
+#define DDKVER_MAJOR @DDKVER_MAJOR@
+
+/* Name of package */
+#define PACKAGE "@PRODUCT_UNIX_NAME@"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "@PRODUCT_NAME@"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "@PRODUCT_UNIX_NAME@"
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "@PRODUCT_VERSION@"
+
+#endif
# if we are run directly, and not loaded as a module
if __name__ == "__main__":
- if len(sys.argv) == 2 and sys.argv[1] == 'clean':\r
- clean()\r
- else:\r
- main()\r
+ if len(sys.argv) == 2 and sys.argv[1] == 'clean':
+ clean()
+ else:
+ main()
-import os\r
-from wb import system, home_fn, choose_arch\r
-\r
-def build_ddk(config, dir, x64):\r
- ddk_path = config['DDK_PATH']\r
- ddk_major = int(config['DDKVER_MAJOR'])\r
- debug = 'PRODUCT_TAP_DEBUG' in config\r
- return build_tap(ddk_path, ddk_major, debug, dir, x64)\r
-\r
-def build_tap(ddk_path, ddk_major, debug, dir, x64):\r
+import os
+from wb import system, home_fn, choose_arch
+
+def build_ddk(config, dir, x64):
+ ddk_path = config['DDK_PATH']
+ ddk_major = int(config['DDKVER_MAJOR'])
+ debug = 'PRODUCT_TAP_DEBUG' in config
+ return build_tap(ddk_path, ddk_major, debug, dir, x64)
+
+def build_tap(ddk_path, ddk_major, debug, dir, x64):
"""Build drivers using WinDDK tools"""
- setenv_bat = os.path.realpath(os.path.join(ddk_path, 'bin/setenv.bat'))\r
- target = 'chk' if debug else 'fre'\r
- if x64:\r
- target += ' x64'\r
- else:\r
- target += ' x86'\r
- if ddk_major >= 7600:\r
- if x64:\r
- target += ' wlh' # vista\r
- else:\r
- target += ' wnet' # server 2003\r
- else:\r
- if x64:\r
- target += ' wnet' # server 2003\r
- else:\r
- target += ' w2k' # 2000\r
-\r
- system('cmd /c "%s %s %s && cd %s && build -cef"' % (\r
- setenv_bat,\r
- os.path.realpath(ddk_path),\r
- target,\r
- dir\r
- ))\r
-\r
-def main(config, proj, arch):\r
- if proj == 'tap':\r
- dir = home_fn('tap-win32')\r
- elif proj == 'tapinstall':\r
- dir = home_fn('tapinstall')\r
- else:\r
- raise ValueError("unknown project: %s" % (proj,))\r
-\r
- for x64 in choose_arch(arch):\r
- build_ddk(config, dir, x64)\r
-\r
-# if we are run directly, and not loaded as a module\r
-if __name__ == "__main__":\r
- import sys\r
- from wb import config\r
- if len(sys.argv) >= 3:\r
- main(config, sys.argv[1], sys.argv[2])\r
- else:\r
- print "usage: build <tap|tapinstall> <x64|x86|all>"\r
- sys.exit(2)\r
+ setenv_bat = os.path.realpath(os.path.join(ddk_path, 'bin/setenv.bat'))
+ target = 'chk' if debug else 'fre'
+ if x64:
+ target += ' x64'
+ else:
+ target += ' x86'
+ if ddk_major >= 7600:
+ if x64:
+ target += ' wlh' # vista
+ else:
+ target += ' wnet' # server 2003
+ else:
+ if x64:
+ target += ' wnet' # server 2003
+ else:
+ target += ' w2k' # 2000
+
+ system('cmd /c "%s %s %s && cd %s && build -cef"' % (
+ setenv_bat,
+ os.path.realpath(ddk_path),
+ target,
+ dir
+ ))
+
+def main(config, proj, arch):
+ if proj == 'tap':
+ dir = home_fn('tap-win32')
+ elif proj == 'tapinstall':
+ dir = home_fn('tapinstall')
+ else:
+ raise ValueError("unknown project: %s" % (proj,))
+
+ for x64 in choose_arch(arch):
+ build_ddk(config, dir, x64)
+
+# if we are run directly, and not loaded as a module
+if __name__ == "__main__":
+ import sys
+ from wb import config
+ if len(sys.argv) >= 3:
+ main(config, sys.argv[1], sys.argv[2])
+ else:
+ print "usage: build <tap|tapinstall> <x64|x86|all>"
+ sys.exit(2)
-from config import main as config_main\r
-from build import main as build_openvpn\r
-from build_ddk import main as build_ddk\r
-from sign import main as sign\r
-from make_dist import main as make_dist\r
-\r
-def main(config):\r
- config_main(config)\r
- build_openvpn()\r
- make_dist(config, tap=False)\r
-\r
-# if we are run directly, and not loaded as a module\r
-if __name__ == "__main__":\r
- from wb import config\r
- main(config)\r
+from config import main as config_main
+from build import main as build_openvpn
+from build_ddk import main as build_ddk
+from sign import main as sign
+from make_dist import main as make_dist
+
+def main(config):
+ config_main(config)
+ build_openvpn()
+ make_dist(config, tap=False)
+
+# if we are run directly, and not loaded as a module
+if __name__ == "__main__":
+ from wb import config
+ main(config)
-from config import main as config_main\r
-from config_tap import main as config_tap\r
-from config_ti import main as config_ti\r
-\r
-def main(config):\r
- config_main(config)\r
- config_tap(config)\r
- config_ti(config)\r
-\r
-# if we are run directly, and not loaded as a module\r
-if __name__ == "__main__":\r
- from wb import config\r
- main(config)\r
+from config import main as config_main
+from config_tap import main as config_tap
+from config_ti import main as config_ti
+
+def main(config):
+ config_main(config)
+ config_tap(config)
+ config_ti(config)
+
+# if we are run directly, and not loaded as a module
+if __name__ == "__main__":
+ from wb import config
+ main(config)
-import os\r
-from wb import preprocess, home_fn, autogen, dict_def\r
-\r
-def main(config):\r
- preprocess(config,\r
- in_fn=home_fn('tap-win32/SOURCES.in'),\r
- out_fn=home_fn('tap-win32/SOURCES'),\r
- quote_begin='@@',\r
- quote_end='@@',\r
- head_comment='# %s\n\n' % autogen)\r
-\r
- preprocess(config,\r
- in_fn=home_fn('tap-win32/i386/OemWin2k.inf.in'),\r
- out_fn=home_fn('tap-win32/i386/OemWin2k.inf'),\r
- quote_begin='@@',\r
- quote_end='@@',\r
- if_prefix='!',\r
- head_comment='; %s\n\n' % autogen)\r
-\r
- try:\r
- os.mkdir(home_fn('tap-win32/amd64'))\r
- except:\r
- pass\r
- preprocess(dict_def(config, [('AMD64', '1')]),\r
- in_fn=home_fn('tap-win32/i386/OemWin2k.inf.in'),\r
- out_fn=home_fn('tap-win32/amd64/OemWin2k.inf'),\r
- quote_begin='@@',\r
- quote_end='@@',\r
- if_prefix='!',\r
- head_comment='; %s\n\n' % autogen)\r
-\r
-# if we are run directly, and not loaded as a module\r
-if __name__ == "__main__":\r
- from wb import config\r
- main(config)\r
+import os
+from wb import preprocess, home_fn, autogen, dict_def
+
+def main(config):
+ preprocess(config,
+ in_fn=home_fn('tap-win32/SOURCES.in'),
+ out_fn=home_fn('tap-win32/SOURCES'),
+ quote_begin='@@',
+ quote_end='@@',
+ head_comment='# %s\n\n' % autogen)
+
+ preprocess(config,
+ in_fn=home_fn('tap-win32/i386/OemWin2k.inf.in'),
+ out_fn=home_fn('tap-win32/i386/OemWin2k.inf'),
+ quote_begin='@@',
+ quote_end='@@',
+ if_prefix='!',
+ head_comment='; %s\n\n' % autogen)
+
+ try:
+ os.mkdir(home_fn('tap-win32/amd64'))
+ except:
+ pass
+ preprocess(dict_def(config, [('AMD64', '1')]),
+ in_fn=home_fn('tap-win32/i386/OemWin2k.inf.in'),
+ out_fn=home_fn('tap-win32/amd64/OemWin2k.inf'),
+ quote_begin='@@',
+ quote_end='@@',
+ if_prefix='!',
+ head_comment='; %s\n\n' % autogen)
+
+# if we are run directly, and not loaded as a module
+if __name__ == "__main__":
+ from wb import config
+ main(config)
-import os, shutil\r
-from wb import preprocess, home_fn, autogen\r
-\r
-def main(config):\r
- src = os.path.join(home_fn(config['TISRC']), config['DDKVER_MAJOR'])\r
- dest = home_fn('tapinstall')\r
- shutil.rmtree(dest, ignore_errors=True)\r
- shutil.copytree(src, dest)\r
- preprocess(config,\r
- in_fn=os.path.join(dest, 'sources.in'),\r
- out_fn=os.path.join(dest, 'sources'),\r
- if_prefix='!',\r
- head_comment='# %s\n\n' % autogen)\r
-\r
-# if we are run directly, and not loaded as a module\r
-if __name__ == "__main__":\r
- from wb import config\r
- main(config)\r
+import os, shutil
+from wb import preprocess, home_fn, autogen
+
+def main(config):
+ src = os.path.join(home_fn(config['TISRC']), config['DDKVER_MAJOR'])
+ dest = home_fn('tapinstall')
+ shutil.rmtree(dest, ignore_errors=True)
+ shutil.copytree(src, dest)
+ preprocess(config,
+ in_fn=os.path.join(dest, 'sources.in'),
+ out_fn=os.path.join(dest, 'sources'),
+ if_prefix='!',
+ head_comment='# %s\n\n' % autogen)
+
+# if we are run directly, and not loaded as a module
+if __name__ == "__main__":
+ from wb import config
+ main(config)
-import json\r
-\r
-# usage:\r
-# print JSON().encode(kv)\r
-\r
-class JSON(json.JSONEncoder):\r
- def __init__(self, **kwargs):\r
- args = dict(sort_keys=True, indent=2)\r
- args.update(kwargs)\r
- json.JSONEncoder.__init__(self, **args)\r
+import json
+
+# usage:
+# print JSON().encode(kv)
+
+class JSON(json.JSONEncoder):
+ def __init__(self, **kwargs):
+ args = dict(sort_keys=True, indent=2)
+ args.update(kwargs)
+ json.JSONEncoder.__init__(self, **args)
def main(config, tap=True):
dist = config['DIST']
- assert dist\r
- dist = home_fn(dist)\r
- bin = os.path.join(dist, 'bin')\r
- i386 = os.path.join(dist, 'i386')\r
- amd64 = os.path.join(dist, 'amd64')\r
+ assert dist
+ dist = home_fn(dist)
+ bin = os.path.join(dist, 'bin')
+ i386 = os.path.join(dist, 'i386')
+ amd64 = os.path.join(dist, 'amd64')
samples = os.path.join(dist, 'samples')
-\r
- # build dist and subdirectories\r
+
+ # build dist and subdirectories
rm_rf(dist)
mkdir(dist)
mkdir(bin)
mkdir(samples)
# copy openvpn.exe, openvpnserv.exe and their manifests
- cp(home_fn('openvpn.exe'), bin)\r
- cp(home_fn('openvpn.exe.manifest'), bin)\r
+ cp(home_fn('openvpn.exe'), bin)
+ cp(home_fn('openvpn.exe.manifest'), bin)
cp(home_fn('service-win32/openvpnserv.exe'), bin)
cp(home_fn('service-win32/openvpnserv.exe.manifest'), bin)
# copy openvpn-gui
cp(home_fn(config['OPENVPN_GUI_DIR']+"/"+config['OPENVPN_GUI']), bin)
-\r
- # copy DLL dependencies\r
- cp(home_fn(config['LZO_DIR']+'/bin/lzo2.dll'), bin)\r
+
+ # copy DLL dependencies
+ cp(home_fn(config['LZO_DIR']+'/bin/lzo2.dll'), bin)
cp(home_fn(config['LZO_DIR']+'/bin/lzo2.dll.manifest'), bin)
- cp(home_fn(config['OPENSSL_DIR']+'/bin/libeay32.dll'), bin)\r
- cp(home_fn(config['OPENSSL_DIR']+'/bin/ssleay32.dll'), bin)\r
+ cp(home_fn(config['OPENSSL_DIR']+'/bin/libeay32.dll'), bin)
+ cp(home_fn(config['OPENSSL_DIR']+'/bin/ssleay32.dll'), bin)
cp(home_fn(config['PKCS11_HELPER_DIR']+'/lib/libpkcs11-helper-1.dll'), bin)
cp(home_fn(config['PKCS11_HELPER_DIR']+'/lib/libpkcs11-helper-1.dll.manifest'), bin)
# if we are run directly, and not loaded as a module
if __name__ == "__main__":
- from wb import config\r
- main(config)\r
+ from wb import config
+ main(config)
#
# - Everything between @<< and << is inserted into a s.c. "in-line file". This
# file drives the linker (link.exe).
-# - HEADERS_OBJS is expanded to all all header and source files listed in
+# - HEADERS_OBJS is expanded to all all header and source files listed in
# ..\Makefile.am
# - OPENSSL_DIR and LZO_DIR are dynamically created from settings.in
-\r
-OPENSSL = @OPENSSL_DIR@\r
-OPENSSL_DYNAMIC = libeay32.lib ssleay32.lib\r
-\r
-LZO = @LZO_DIR@\r
-LZO_DYNAMIC = lzo2.lib\r
-\r
-INCLUDE_DIRS = -I$(OPENSSL)/include -I$(LZO)/include\r
-\r
-LIBS = $(OPENSSL_DYNAMIC) $(LZO_DYNAMIC) ws2_32.lib crypt32.lib iphlpapi.lib winmm.lib user32.lib gdi32.lib advapi32.lib wininet.lib\r
-\r
-LIB_DIRS = -LIBPATH:$(OPENSSL)\lib -LIBPATH:$(LZO)\lib\r
-\r
-EXE = openvpn.exe\r
-\r
-CPP=cl.exe\r
-CPP_ARG_COMMON=/nologo /W3 -DWIN32 -DWIN32_LEAN_AND_MEAN -D_CONSOLE -D_MBCS -D_CRT_SECURE_NO_DEPRECATE $(INCLUDE_DIRS) /FD /c\r
-\r
-LINK32=link.exe\r
-\r
-!ifdef PRODUCT_OPENVPN_DEBUG\r
-# debug:\r
-CPP_PROJ=$(CPP_ARG_COMMON) /MD /Z7\r
+
+OPENSSL = @OPENSSL_DIR@
+OPENSSL_DYNAMIC = libeay32.lib ssleay32.lib
+
+LZO = @LZO_DIR@
+LZO_DYNAMIC = lzo2.lib
+
+INCLUDE_DIRS = -I$(OPENSSL)/include -I$(LZO)/include
+
+LIBS = $(OPENSSL_DYNAMIC) $(LZO_DYNAMIC) ws2_32.lib crypt32.lib iphlpapi.lib winmm.lib user32.lib gdi32.lib advapi32.lib wininet.lib
+
+LIB_DIRS = -LIBPATH:$(OPENSSL)\lib -LIBPATH:$(LZO)\lib
+
+EXE = openvpn.exe
+
+CPP=cl.exe
+CPP_ARG_COMMON=/nologo /W3 -DWIN32 -DWIN32_LEAN_AND_MEAN -D_CONSOLE -D_MBCS -D_CRT_SECURE_NO_DEPRECATE $(INCLUDE_DIRS) /FD /c
+
+LINK32=link.exe
+
+!ifdef PRODUCT_OPENVPN_DEBUG
+# debug:
+CPP_PROJ=$(CPP_ARG_COMMON) /MD /Z7
LINK32_FLAGS=/nologo /subsystem:console /incremental:no /opt:ref /opt:icf /debug
-!else\r
-# release:\r
-CPP_PROJ=$(CPP_ARG_COMMON) /O2 /MD -DNDEBUG\r
+!else
+# release:
+CPP_PROJ=$(CPP_ARG_COMMON) /O2 /MD -DNDEBUG
LINK32_FLAGS=/nologo /subsystem:console /incremental:no
-!endif\r
-\r
+!endif
+
# HEADERS and OBJS definitions, automatically generated from ../Makefile.am
-@HEADERS_OBJS@\r
-\r
-openvpn : $(OBJS)\r
- $(LINK32) @<<\r
+@HEADERS_OBJS@
+
+openvpn : $(OBJS)
+ $(LINK32) @<<
$(LINK32_FLAGS) "/out:$(EXE)" $(LIB_DIRS) $(LIBS) $(OBJS)
-<<\r
-\r
-clean :\r
- del /Q $(OBJS) $(EXE) *.idb *.pdb\r
-\r
-.c.obj::\r
- $(CPP) @<<\r
- $(CPP_PROJ) $<\r
-<<\r
+<<
+
+clean :
+ del /Q $(OBJS) $(EXE) *.idb *.pdb
+
+.c.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
from wb import get_config
-from js import JSON\r
-\r
-def main():\r
+from js import JSON
+
+def main():
print JSON().encode(get_config())
-\r
-# if we are run directly, and not loaded as a module\r
-if __name__ == "__main__":\r
- main()\r
+
+# if we are run directly, and not loaded as a module
+if __name__ == "__main__":
+ main()
-import sys\r
-from wb import config, choose_arch, home_fn\r
-\r
-if 'SIGNTOOL' in config:\r
- sys.path.append(home_fn(config['SIGNTOOL']))\r
-\r
-def main(conf, arch):\r
- from signtool import SignTool\r
- st = SignTool(conf)\r
- for x64 in choose_arch(arch):\r
- st.sign_verify(x64=x64)\r
-\r
-# if we are run directly, and not loaded as a module\r
-if __name__ == "__main__":\r
- if len(sys.argv) >= 2:\r
- main(config, sys.argv[1])\r
- else:\r
- print "usage: sign <x64|x86|all>"\r
- sys.exit(2)\r
+import sys
+from wb import config, choose_arch, home_fn
+
+if 'SIGNTOOL' in config:
+ sys.path.append(home_fn(config['SIGNTOOL']))
+
+def main(conf, arch):
+ from signtool import SignTool
+ st = SignTool(conf)
+ for x64 in choose_arch(arch):
+ st.sign_verify(x64=x64)
+
+# if we are run directly, and not loaded as a module
+if __name__ == "__main__":
+ if len(sys.argv) >= 2:
+ main(config, sys.argv[1])
+ else:
+ print "usage: sign <x64|x86|all>"
+ sys.exit(2)
-import sys, os, shutil\r
-from wb import config, home_fn, mod_fn, preprocess, autogen, dict_def, build_autodefs, rm_rf, mkdir_silent, cp\r
-if 'SIGNTOOL' in config:\r
- sys.path.append(home_fn(config['SIGNTOOL']))\r
-from signtool import SignTool\r
-from build_ddk import build_tap\r
-\r
-ti_dir = "c:/src/tapinstall"\r
-hi = ("c:/winddk/7600.16385.1", 7600, 7600, ("i386", "amd64"))\r
-low = ("c:/winddk/6001.18002", 6001, 5600, ("win2k",))\r
-dest_top = home_fn('tap_build')\r
-dist = home_fn(config['TAP_DIST'])\r
-\r
-def copy_tap(src, dest, x64):\r
- dir = os.path.join(src, { False : 'i386', True: 'amd64' }[x64])\r
- mkdir_silent(dest)\r
- for dirpath, dirnames, filenames in os.walk(dir):\r
- for f in filenames:\r
- root, ext = os.path.splitext(f)\r
- if ext in ('.inf', '.cat', '.sys'):\r
- cp(os.path.join(dir, f), dest)\r
- break\r
-\r
-def copy_tapinstall(src, dest, x64):\r
- base = { False : 'i386', True: 'amd64' }[x64]\r
+import sys, os, shutil
+from wb import config, home_fn, mod_fn, preprocess, autogen, dict_def, build_autodefs, rm_rf, mkdir_silent, cp
+if 'SIGNTOOL' in config:
+ sys.path.append(home_fn(config['SIGNTOOL']))
+from signtool import SignTool
+from build_ddk import build_tap
+
+ti_dir = "c:/src/tapinstall"
+hi = ("c:/winddk/7600.16385.1", 7600, 7600, ("i386", "amd64"))
+low = ("c:/winddk/6001.18002", 6001, 5600, ("win2k",))
+dest_top = home_fn('tap_build')
+dist = home_fn(config['TAP_DIST'])
+
+def copy_tap(src, dest, x64):
+ dir = os.path.join(src, { False : 'i386', True: 'amd64' }[x64])
+ mkdir_silent(dest)
+ for dirpath, dirnames, filenames in os.walk(dir):
+ for f in filenames:
+ root, ext = os.path.splitext(f)
+ if ext in ('.inf', '.cat', '.sys'):
+ cp(os.path.join(dir, f), dest)
+ break
+
+def copy_tapinstall(src, dest, x64):
+ base = { False : 'i386', True: 'amd64' }[x64]
mkdir_silent(dest)
for dirpath, dirnames, filenames in os.walk(home_fn(src)):
for f in filenames:
dir_name = os.path.basename(dirpath)
s = os.path.join(dirpath, f)
if dir_name == base:
- cp(s, dest)\r
-\r
-def main():\r
- rm_rf(dest_top)\r
- os.mkdir(dest_top)\r
-\r
- rm_rf(dist)\r
- os.mkdir(dist)\r
-\r
- for ver in hi, low:\r
- top = os.path.join(dest_top, str(ver[1]))\r
- os.mkdir(top)\r
- tap_dest = os.path.join(top, "tap-win32")\r
- ti_dest = os.path.join(top, "tapinstall")\r
- ti_src = os.path.join(ti_dir, str(ver[2]))\r
- shutil.copytree(home_fn("tap-win32"), tap_dest)\r
- shutil.copytree(ti_src, ti_dest)\r
-\r
- i386 = os.path.join(tap_dest, "i386")\r
- amd64 = os.path.join(tap_dest, "amd64")\r
-\r
- build_amd64 = (len(ver[3]) >= 2)\r
-\r
- build_autodefs(config, mod_fn('autodefs.h.in'), os.path.join(top, 'autodefs.h'))\r
-\r
- st = SignTool(config, tap_dest)\r
-\r
- preprocess(config,\r
- in_fn=os.path.join(tap_dest, 'SOURCES.in'),\r
- out_fn=os.path.join(tap_dest, 'SOURCES'),\r
- quote_begin='@@',\r
- quote_end='@@',\r
- head_comment='# %s\n\n' % autogen)\r
-\r
- preprocess(config,\r
- in_fn=os.path.join(i386, 'OemWin2k.inf.in'),\r
- out_fn=os.path.join(i386, 'OemWin2k.inf'),\r
- quote_begin='@@',\r
- quote_end='@@',\r
- if_prefix='!',\r
- head_comment='; %s\n\n' % autogen)\r
-\r
- preprocess(config,\r
- in_fn=os.path.join(ti_dest, 'sources.in'),\r
- out_fn=os.path.join(ti_dest, 'sources'),\r
- if_prefix='!',\r
- head_comment='# %s\n\n' % autogen)\r
-\r
- build_tap(ddk_path=ver[0],\r
- ddk_major=ver[1],\r
- debug=False,\r
- dir=tap_dest,\r
- x64=False)\r
-\r
- st.sign_verify(x64=False)\r
-\r
- build_tap(ddk_path=ver[0],\r
- ddk_major=ver[1],\r
- debug=False,\r
- dir=ti_dest,\r
- x64=False)\r
-\r
- tap_dist = os.path.join(dist, ver[3][0])\r
-\r
- copy_tap(tap_dest, tap_dist, x64=False)\r
- copy_tapinstall(ti_dest, tap_dist, x64=False)\r
-\r
- if build_amd64:\r
- os.mkdir(amd64)\r
- preprocess(dict_def(config, [('AMD64', '1')]),\r
- in_fn=os.path.join(i386, 'OemWin2k.inf.in'),\r
- out_fn=os.path.join(amd64, 'OemWin2k.inf'),\r
- quote_begin='@@',\r
- quote_end='@@',\r
- if_prefix='!',\r
- head_comment='; %s\n\n' % autogen)\r
-\r
- build_tap(ddk_path=ver[0],\r
- ddk_major=ver[1],\r
- debug=False,\r
- dir=tap_dest,\r
- x64=True)\r
-\r
- build_tap(ddk_path=ver[0],\r
- ddk_major=ver[1],\r
- debug=False,\r
- dir=ti_dest,\r
- x64=True)\r
-\r
- st.sign_verify(x64=True)\r
-\r
- tap_dist_x64 = os.path.join(dist, ver[3][1])\r
-\r
- copy_tap(tap_dest, tap_dist_x64, x64=True)\r
- copy_tapinstall(ti_dest, tap_dist_x64, x64=True)\r
-\r
-main()\r
+ cp(s, dest)
+
+def main():
+ rm_rf(dest_top)
+ os.mkdir(dest_top)
+
+ rm_rf(dist)
+ os.mkdir(dist)
+
+ for ver in hi, low:
+ top = os.path.join(dest_top, str(ver[1]))
+ os.mkdir(top)
+ tap_dest = os.path.join(top, "tap-win32")
+ ti_dest = os.path.join(top, "tapinstall")
+ ti_src = os.path.join(ti_dir, str(ver[2]))
+ shutil.copytree(home_fn("tap-win32"), tap_dest)
+ shutil.copytree(ti_src, ti_dest)
+
+ i386 = os.path.join(tap_dest, "i386")
+ amd64 = os.path.join(tap_dest, "amd64")
+
+ build_amd64 = (len(ver[3]) >= 2)
+
+ build_autodefs(config, mod_fn('autodefs.h.in'), os.path.join(top, 'autodefs.h'))
+
+ st = SignTool(config, tap_dest)
+
+ preprocess(config,
+ in_fn=os.path.join(tap_dest, 'SOURCES.in'),
+ out_fn=os.path.join(tap_dest, 'SOURCES'),
+ quote_begin='@@',
+ quote_end='@@',
+ head_comment='# %s\n\n' % autogen)
+
+ preprocess(config,
+ in_fn=os.path.join(i386, 'OemWin2k.inf.in'),
+ out_fn=os.path.join(i386, 'OemWin2k.inf'),
+ quote_begin='@@',
+ quote_end='@@',
+ if_prefix='!',
+ head_comment='; %s\n\n' % autogen)
+
+ preprocess(config,
+ in_fn=os.path.join(ti_dest, 'sources.in'),
+ out_fn=os.path.join(ti_dest, 'sources'),
+ if_prefix='!',
+ head_comment='# %s\n\n' % autogen)
+
+ build_tap(ddk_path=ver[0],
+ ddk_major=ver[1],
+ debug=False,
+ dir=tap_dest,
+ x64=False)
+
+ st.sign_verify(x64=False)
+
+ build_tap(ddk_path=ver[0],
+ ddk_major=ver[1],
+ debug=False,
+ dir=ti_dest,
+ x64=False)
+
+ tap_dist = os.path.join(dist, ver[3][0])
+
+ copy_tap(tap_dest, tap_dist, x64=False)
+ copy_tapinstall(ti_dest, tap_dist, x64=False)
+
+ if build_amd64:
+ os.mkdir(amd64)
+ preprocess(dict_def(config, [('AMD64', '1')]),
+ in_fn=os.path.join(i386, 'OemWin2k.inf.in'),
+ out_fn=os.path.join(amd64, 'OemWin2k.inf'),
+ quote_begin='@@',
+ quote_end='@@',
+ if_prefix='!',
+ head_comment='; %s\n\n' % autogen)
+
+ build_tap(ddk_path=ver[0],
+ ddk_major=ver[1],
+ debug=False,
+ dir=tap_dest,
+ x64=True)
+
+ build_tap(ddk_path=ver[0],
+ ddk_major=ver[1],
+ debug=False,
+ dir=ti_dest,
+ x64=True)
+
+ st.sign_verify(x64=True)
+
+ tap_dist_x64 = os.path.join(dist, ver[3][1])
+
+ copy_tap(tap_dest, tap_dist_x64, x64=True)
+ copy_tapinstall(ti_dest, tap_dist_x64, x64=True)
+
+main()
-# Python module containing general build functions\r
-# for OpenVPN on Windows\r
-\r
-import os, re, shutil, stat\r
-\r
-autogen = "Automatically generated by OpenVPN Windows build system"\r
-\r
-def get_config():\r
- kv = {}\r
- parse_version_m4(kv, home_fn('version.m4'))\r
- parse_settings_in(kv, mod_fn('settings.in'))\r
-\r
- # config fixups\r
- kv['DDKVER'] = os.path.basename(kv['DDK_PATH'])\r
- kv['DDKVER_MAJOR'] = re.match(r'^(\d+)\.', kv['DDKVER']).groups()[0]\r
-\r
- if 'VERSION_SUFFIX' in kv:\r
- kv['PRODUCT_VERSION'] += kv['VERSION_SUFFIX']\r
-\r
- return kv\r
-\r
+# Python module containing general build functions
+# for OpenVPN on Windows
+
+import os, re, shutil, stat
+
+autogen = "Automatically generated by OpenVPN Windows build system"
+
+def get_config():
+ kv = {}
+ parse_version_m4(kv, home_fn('version.m4'))
+ parse_settings_in(kv, mod_fn('settings.in'))
+
+ # config fixups
+ kv['DDKVER'] = os.path.basename(kv['DDK_PATH'])
+ kv['DDKVER_MAJOR'] = re.match(r'^(\d+)\.', kv['DDKVER']).groups()[0]
+
+ if 'VERSION_SUFFIX' in kv:
+ kv['PRODUCT_VERSION'] += kv['VERSION_SUFFIX']
+
+ return kv
+
def get_build_params():
kv = {}
parse_build_params(kv,mod_fn('settings.in'))
return kv
-def mod_fn(fn, src=__file__, real=True):\r
- p = os.path.join(os.path.dirname(src), os.path.normpath(fn))\r
- if real:\r
- p = os.path.realpath(p)\r
- return p\r
-\r
-def home_fn(fn, real=True):\r
- return mod_fn(os.path.join('..', fn), real=real)\r
-\r
-def cd_home():\r
- os.chdir(os.path.join(os.path.dirname(__file__), '..'))\r
-\r
+def mod_fn(fn, src=__file__, real=True):
+ p = os.path.join(os.path.dirname(src), os.path.normpath(fn))
+ if real:
+ p = os.path.realpath(p)
+ return p
+
+def home_fn(fn, real=True):
+ return mod_fn(os.path.join('..', fn), real=real)
+
+def cd_home():
+ os.chdir(os.path.join(os.path.dirname(__file__), '..'))
+
def cd_service_win32():
os.chdir(os.path.join(os.path.dirname(__file__), '../service-win32'))
-def system(cmd):\r
+def system(cmd):
print "RUN:", cmd
os.system(cmd)
def parse_version_m4(kv, version_m4):
'''Parse define lines in version.m4'''
r = re.compile(r'^define\((\w+),\[(.*)\]\)$')
- f = open(version_m4)\r
- for line in f:\r
- line = line.rstrip()\r
- m = re.match(r, line)\r
+ f = open(version_m4)
+ for line in f:
+ line = line.rstrip()
+ m = re.match(r, line)
- if m:\r
- g = m.groups()\r
+ if m:
+ g = m.groups()
- # If we encounter PRODUCT_TAP_WIN32_MIN_MAJOR or
- # PRODUCT_TAP_WIN32_MIN_MAJOR then we need to generate extra
+ # If we encounter PRODUCT_TAP_WIN32_MIN_MAJOR or
+ # PRODUCT_TAP_WIN32_MIN_MAJOR then we need to generate extra
# variables, PRODUCT_TAP_MAJOR_VER and PRODUCT_TAP_MINOR_VER with
# the same contents. This is necessary because tap-win32/tapdrv.c
# build depends on those.
kv['PRODUCT_TAP_MINOR_VER'] = g[1]
# Add the variable to build configuration
- kv[g[0]] = g[1]\r
- f.close()\r
-\r
-def parse_settings_in(kv, settings_in):\r
- r = re.compile(r'^!define\s+(\w+)(?:\s+"?(.*?)"?)?$')\r
- f = open(settings_in)\r
- for line in f:\r
- line = line.rstrip()\r
- m = re.match(r, line)\r
- if m:\r
- g = m.groups()\r
- kv[g[0]] = g[1] or ''\r
- f.close()\r
-\r
+ kv[g[0]] = g[1]
+ f.close()
+
+def parse_settings_in(kv, settings_in):
+ r = re.compile(r'^!define\s+(\w+)(?:\s+"?(.*?)"?)?$')
+ f = open(settings_in)
+ for line in f:
+ line = line.rstrip()
+ m = re.match(r, line)
+ if m:
+ g = m.groups()
+ kv[g[0]] = g[1] or ''
+ f.close()
+
def parse_build_params(kv, settings_in):
r = re.compile(r'^!define\s+(ENABLE_\w+)\s+(\w+)')
return ret
def build_autodefs(kv, autodefs_in, autodefs_out):
- preprocess(kv,\r
+ preprocess(kv,
in_fn=autodefs_in,
out_fn=autodefs_out,
quote_begin='@',
return kv.get(var, '')
re_macro = re_ifdef = None
-\r
- if quote_begin and quote_end:\r
- re_macro = re.compile(r'%s(\w+)%s' % (re.escape(quote_begin), re.escape(quote_end)))\r
-\r
- if if_prefix:\r
- re_ifdef = re.compile(r'^\s*%sifdef\s+(\w+)\b' % (re.escape(if_prefix),))\r
- re_else = re.compile(r'^\s*%selse\b' % (re.escape(if_prefix),))\r
- re_endif = re.compile(r'^\s*%sendif\b' % (re.escape(if_prefix),))\r
-\r
- if_stack = []\r
- fin = open(in_fn)\r
- fout = open(out_fn, 'w')\r
- if head_comment:\r
- fout.write(head_comment)\r
- for line in fin:\r
- if re_ifdef:\r
- m = re.match(re_ifdef, line)\r
- if m:\r
- var, = m.groups()\r
- if_stack.append(int(var in kv))\r
- continue\r
- elif re.match(re_else, line):\r
- if_stack[-1] ^= 1\r
- continue\r
- elif re.match(re_endif, line):\r
- if_stack.pop()\r
- continue\r
- if not if_stack or min(if_stack):\r
- if re_macro:\r
- line = re.sub(re_macro, repfn, line)\r
- fout.write(line)\r
- assert not if_stack\r
- fin.close()\r
- fout.close()\r
-\r
-def print_key_values(kv):\r
- for k, v in sorted(kv.items()):\r
- print "%s%s%s" % (k, ' '*(32-len(k)), repr(v))\r
-\r
-def get_sources(makefile_am):\r
+
+ if quote_begin and quote_end:
+ re_macro = re.compile(r'%s(\w+)%s' % (re.escape(quote_begin), re.escape(quote_end)))
+
+ if if_prefix:
+ re_ifdef = re.compile(r'^\s*%sifdef\s+(\w+)\b' % (re.escape(if_prefix),))
+ re_else = re.compile(r'^\s*%selse\b' % (re.escape(if_prefix),))
+ re_endif = re.compile(r'^\s*%sendif\b' % (re.escape(if_prefix),))
+
+ if_stack = []
+ fin = open(in_fn)
+ fout = open(out_fn, 'w')
+ if head_comment:
+ fout.write(head_comment)
+ for line in fin:
+ if re_ifdef:
+ m = re.match(re_ifdef, line)
+ if m:
+ var, = m.groups()
+ if_stack.append(int(var in kv))
+ continue
+ elif re.match(re_else, line):
+ if_stack[-1] ^= 1
+ continue
+ elif re.match(re_endif, line):
+ if_stack.pop()
+ continue
+ if not if_stack or min(if_stack):
+ if re_macro:
+ line = re.sub(re_macro, repfn, line)
+ fout.write(line)
+ assert not if_stack
+ fin.close()
+ fout.close()
+
+def print_key_values(kv):
+ for k, v in sorted(kv.items()):
+ print "%s%s%s" % (k, ' '*(32-len(k)), repr(v))
+
+def get_sources(makefile_am):
"""Parse ../Makefile.am to obtain a list of .h and .c files"""
- c = set()\r
- h = set()\r
- f = open(makefile_am)\r
- state = False\r
- for line in f:\r
- line = line.rstrip()\r
- if line == 'openvpn_SOURCES = \\':\r
- state = True\r
- elif not line:\r
- state = False\r
- elif state:\r
- for sf in line.split():\r
- if sf.endswith('.c'):\r
- c.add(sf[:-2])\r
- elif sf.endswith('.h'):\r
- h.add(sf[:-2])\r
- elif sf == '\\':\r
- pass\r
- else:\r
- print >>sys.stderr, "Unrecognized filename:", sf\r
- f.close()\r
- return [ sorted(list(s)) for s in (c, h) ]\r
-\r
-def output_mak_list(title, srclist, ext):\r
- ret = "%s =" % (title,)\r
- for x in srclist:\r
- ret += " \\\n\t%s.%s" % (x, ext)\r
- ret += '\n\n'\r
- return ret\r
-\r
-def make_headers_objs(makefile_am):\r
+ c = set()
+ h = set()
+ f = open(makefile_am)
+ state = False
+ for line in f:
+ line = line.rstrip()
+ if line == 'openvpn_SOURCES = \\':
+ state = True
+ elif not line:
+ state = False
+ elif state:
+ for sf in line.split():
+ if sf.endswith('.c'):
+ c.add(sf[:-2])
+ elif sf.endswith('.h'):
+ h.add(sf[:-2])
+ elif sf == '\\':
+ pass
+ else:
+ print >>sys.stderr, "Unrecognized filename:", sf
+ f.close()
+ return [ sorted(list(s)) for s in (c, h) ]
+
+def output_mak_list(title, srclist, ext):
+ ret = "%s =" % (title,)
+ for x in srclist:
+ ret += " \\\n\t%s.%s" % (x, ext)
+ ret += '\n\n'
+ return ret
+
+def make_headers_objs(makefile_am):
"""Generate HEADER and OBJS entries dynamically from ../Makefile.am"""
- c, h = get_sources(makefile_am)\r
- ret = output_mak_list('HEADERS', h, 'h')\r
- ret += output_mak_list('OBJS', c, 'obj')\r
- return ret\r
-\r
-def choose_arch(arch_name):\r
- if arch_name == 'x64':\r
- return (True,)\r
- elif arch_name == 'x86':\r
- return (False,)\r
- elif arch_name == 'all':\r
- return (True, False)\r
- else:\r
- raise ValueError("architecture ('%s') must be x86, x64, or all" % (arch_name,))\r
-\r
-def rm_rf(dir):\r
- print "REMOVE", dir\r
- shutil.rmtree(dir, ignore_errors=True)\r
-\r
-def mkdir(dir):\r
- print "MKDIR", dir\r
- os.mkdir(dir)\r
-\r
-def cp_a(src, dest, dest_is_dir=True):\r
- if dest_is_dir:\r
- dest = os.path.join(dest, os.path.basename(src))\r
- print "COPY_DIR %s %s" % (src, dest)\r
- shutil.copytree(src, dest)\r
-\r
-def cp(src, dest, dest_is_dir=True):\r
- if dest_is_dir:\r
- dest = os.path.join(dest, os.path.basename(src))\r
- print "COPY %s %s" % (src, dest)\r
- shutil.copyfile(src, dest)\r
-\r
+ c, h = get_sources(makefile_am)
+ ret = output_mak_list('HEADERS', h, 'h')
+ ret += output_mak_list('OBJS', c, 'obj')
+ return ret
+
+def choose_arch(arch_name):
+ if arch_name == 'x64':
+ return (True,)
+ elif arch_name == 'x86':
+ return (False,)
+ elif arch_name == 'all':
+ return (True, False)
+ else:
+ raise ValueError("architecture ('%s') must be x86, x64, or all" % (arch_name,))
+
+def rm_rf(dir):
+ print "REMOVE", dir
+ shutil.rmtree(dir, ignore_errors=True)
+
+def mkdir(dir):
+ print "MKDIR", dir
+ os.mkdir(dir)
+
+def cp_a(src, dest, dest_is_dir=True):
+ if dest_is_dir:
+ dest = os.path.join(dest, os.path.basename(src))
+ print "COPY_DIR %s %s" % (src, dest)
+ shutil.copytree(src, dest)
+
+def cp(src, dest, dest_is_dir=True):
+ if dest_is_dir:
+ dest = os.path.join(dest, os.path.basename(src))
+ print "COPY %s %s" % (src, dest)
+ shutil.copyfile(src, dest)
+
def rename(src, dest):
print "RENAME %s %s" % (src, dest)
shutil.move(src, dest)
-def rm_rf(path):\r
- try:\r
- shutil.rmtree(path, onerror=onerror)\r
- except:\r
- pass\r
-\r
-def onerror(func, path, exc_info):\r
- """\r
- Error handler for ``shutil.rmtree``.\r
-\r
- If the error is due to an access error (read only file)\r
- it attempts to add write permission and then retries.\r
-\r
- If the error is for another reason it re-raises the error.\r
-\r
- Usage : ``shutil.rmtree(path, onerror=onerror)``\r
- """\r
- if not os.access(path, os.W_OK):\r
- # Is the error an access error ?\r
- os.chmod(path, stat.S_IWUSR)\r
- func(path)\r
- else:\r
- raise\r
-\r
-def mkdir_silent(dir):\r
- try:\r
- os.mkdir(dir)\r
- except:\r
- pass\r
-\r
-config = get_config()\r
+def rm_rf(path):
+ try:
+ shutil.rmtree(path, onerror=onerror)
+ except:
+ pass
+
+def onerror(func, path, exc_info):
+ """
+ Error handler for ``shutil.rmtree``.
+
+ If the error is due to an access error (read only file)
+ it attempts to add write permission and then retries.
+
+ If the error is for another reason it re-raises the error.
+
+ Usage : ``shutil.rmtree(path, onerror=onerror)``
+ """
+ if not os.access(path, os.W_OK):
+ # Is the error an access error ?
+ os.chmod(path, stat.S_IWUSR)
+ func(path)
+ else:
+ raise
+
+def mkdir_silent(dir):
+ try:
+ os.mkdir(dir)
+ except:
+ pass
+
+config = get_config()