Alon Bar-Lev wrote:
> On 4/4/08, Douglas E. Engert <[EMAIL PROTECTED]> wrote:
>> This is the first of two messages, dealing with building OpenSC on Windows
>> using the win32/Makefile.mak files as has been done in the past. As I had
>> stated before, I would like to see OpenSC built on Windows using the
>> Windows
>> compiler header files and dlls. I understand some would like to convert
>> to using cross compilation for a number of reasons.
>
> As long as you maintain this... :)
I will for now, at least until you can get the cross compile working,
and can produce a SCB with installer, that will run on XP and Vista,
for use by CSPs for login, IE and pkcs11 for other browsers and mailers.
> And there are no more complexity into the code.
The complexity issue works both ways. By doing cross compiling you have
now introduced additional packages to build it, using derived header files.
>
>> win32/makedep.pl - changed to not export the _real@ entry created for
>> the one float number in all the source code.
>
> There is no reason for this now.
> You can construct proper def files from *.exports.
> Just:
> echo LIBRARY > x.def
> type x.exports >> x.def
>
> Much cleaner!
>
>> win32/version.rc - change version number.
>>
>
> I would like this to come from configure, can you find a way to
> have something like sed on Windows to replace @VAR@ with
> content?
Perl us already required to build, so iut could be used.
> This way we will have just one place with version.
Yes.
>
> Alternatively, I can produce .rc out of rc.in when we distribute
> the package, so Windows build will find already prepared .rc file
> with correct version.
>
I like that better. I don't believe there is any requirement
to build from SVN using Windows only.
> This mean that if you build from svn, you need to do on cygwin or msys:
> autoreconf
> ./configure && make dist
>
> And use the tar output to build, as the ./configure will set
> appropriate variables
> into winconfig.h.
>
>> src/pkcs11/pkcs11-global.c - This tries to allocate a variable
>> size array an an automatic variable. The compiler
>> complained, so I changed it to use calloc.
>
> Why did it complain?
> Can you please send the error?
Will do that today.
>
>> src/pkcs15init/pkcs15-lib.c - don't include rutoken for now on windows.
>
> I guess this can be added now.
>
>> src/libopensc/reader-pcsc.c - read config.h early, so WinSock2.h is
>> included before windows.h
>
> Can you please try to define WIN32_LEAN_AND_MEAN as global
> preprocessor macro and try without this hack?
OK will try that.
>
>> src/libopensc/internal-winscard.h - (1) add #ifdefs for
>> USE_WINDOWS_PCSC
>> This is set by the wincof.h It says we are uing the
>> Microsoft header files, that include many of
>> defines for PSCS that neede to be added if not using
>> the Windows headers.
>
> Are you sure this is happening if you define WIN32_LEAN_AND_MEAN?
the SDK has winSCard.h and WinSmCrd.h. This then goes back to the
choice of using the Windows header files vs the ming/opensc versions.
The use of the part10.h from the previous verison of OpenSC, that appears
to be based on some PCSC standard, would also be more acceptable.
>
>> (2) Change the typdefs for the SC_*_t routines.
>> The WINAPI had to be moved. For example from:
>> typedef PCSC_API LONG (*SCardEstablishContext_t)...
>> to:
>> typedef LONG (PCSC_API *SCardEstablishContext_t)...
>> I am not sure if this will cause problems with the
>> ming builds or not.
>
> No issues.
> Committed rev 3458.
>
> Thanks!
>
> Although I don't understand why you want to maintain two build systems...
A philosophy of using as much of the vendor's build environment including
header files as possible, in order to avoid compatibility problems.
Actually I don't like two build systems. I would prefer the Windows based
build over the MinG approach. But that does not appear the way the project
is headed. So until you can produce a SCB 0.11.5, I would like to keep
the option of building using the Windows environment and header files
alive.
>
> Alon
>
>> Index: win32/makedef.pl
>> ===================================================================
>> --- win32/makedef.pl (revision 3456)
>> +++ win32/makedef.pl (working copy)
>> @@ -21,7 +21,7 @@
>> split;
>> $_ = $_[0];
>>
>> - if(!/^\?\?_G/ && !/^\?\?_E/ && !/DllMain/)
>> + if(!/^\?\?_G/ && !/^\?\?_E/ && !/_real@/ && !/DllMain/)
>> {
>> # Stupid windows linker needs to have
>> # preceding underscore for ANSI C programs
>
> This script should be removed.
>
>> Index: win32/version.rc
>> ===================================================================
>> --- win32/version.rc (revision 3456)
>> +++ win32/version.rc (working copy)
>> @@ -19,8 +19,8 @@
>> #endif
>>
>> VS_VERSION_INFO VERSIONINFO
>> - FILEVERSION 0,11,4,0
>> - PRODUCTVERSION 0,11,4,0
>> + FILEVERSION 0,11,4,1
>> + PRODUCTVERSION 0,11,4,1
>> FILEFLAGSMASK 0x3fL
>
> Should find a way to not commit version.
>
>> Index: src/tools/opensc-tool.c
>> ===================================================================
>> --- src/tools/opensc-tool.c (revision 3456)
>> +++ src/tools/opensc-tool.c (working copy)
>> @@ -84,11 +84,13 @@
>>
>> static int opensc_info(void)
>> {
>> +#ifndef _WIN32
>> printf (
>> "%s %s ",
>> PACKAGE_NAME,
>> PACKAGE_VERSION
>> );
>> +#endif
>
> Please define PACKAGE_NAME and PACKAGE_VERSION
> at winconfig.h or something.
>
>> +#ifndef _WIN32
>> printf ("Enabled features:%s\n", OPENSC_FEATURES);
>> +#endif
>> return 0;
>> }
>
> Please also add this into winconfig.h or something.
>
> The behavior of the components should be the same. at
> each compiler used.
>
>> Index: src/pkcs11/pkcs11-global.c
>> ===================================================================
>> --- src/pkcs11/pkcs11-global.c (revision 3456)
>> +++ src/pkcs11/pkcs11-global.c (working copy)
>> @@ -320,7 +320,7 @@
>> CK_SLOT_ID_PTR pSlotList, /* receives the array of
>> slot IDs */
>> CK_ULONG_PTR pulCount) /* receives the number of
>> slots */
>> {
>> - CK_SLOT_ID
>> found[sc_pkcs11_conf.pkcs11_max_virtual_slots];
>> + CK_SLOT_ID_PTR found = NULL;
>
> Need error/warning... :)
>
>> Index: src/include/winconfig.h
>> ===================================================================
>> --- src/include/winconfig.h (revision 3456)
>> +++ src/include/winconfig.h (working copy)
>> @@ -2,6 +2,9 @@
>> #define _OPENSC_WINCONFIG_H
>>
>> #include <stdio.h>
>> +#ifdef IF_WIN_USE_WINSOCK2_H
>> +#include <winsock2.h>
>> +#endif
>
> This should be solved by WIN32_LEAN_AND_MEAN, please
> move the winsock2 after windows.h and include it always.
>
>> #include <windows.h>
>> #include <sys/timeb.h>
>>
>> @@ -65,13 +68,14 @@
>> #endif
>>
>> #define HAVE_IO_H
>> -#define HAVE_GETPASS
>> -#define HAVE_PCSC
>> +#define ENABLE_PCSC
>> +#define USE_WINDOWS_PCSC
>> +#define DEFAULT_PCSC_PROVIDER "winscard.dll"
>>
>> #define PATH_MAX _MAX_PATH
>>
>> #ifndef VERSION
>> -#define VERSION "0.11.4"
>> +#define VERSION "0.11.4.1"
>> #endif
>
> Here you should also define PACKAGE_NAME, PACKAGE_VERSION
> and FEATURES.
>
>> Index: src/libopensc/reader-pcsc.c
>> ===================================================================
>> --- src/libopensc/reader-pcsc.c (revision 3456)
>> +++ src/libopensc/reader-pcsc.c (working copy)
>> @@ -18,6 +18,11 @@
>> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
>> USA
>> */
>>
>> +#ifdef HAVE_CONFIG_H
>> +#define IF_WIN_USE_WINSOCK2_H
>> +#include <config.h>
>> +#endif
>> +
>
> I don't understand why this is required.
>
>> -#ifdef _WIN32
>> -#include <winsock2.h>
>> -#else
>> +#ifndef _WIN32
>> #include <arpa/inet.h>
>> #endif
>
> winsock2 is required here. Please don't remove anything as
> mingw configuration will stop working.
>
>> Index: src/libopensc/internal-winscard.h
>> ===================================================================
>> --- src/libopensc/internal-winscard.h (revision 3456)
>> +++ src/libopensc/internal-winscard.h (working copy)
>> @@ -28,6 +28,8 @@
>> #warning no uint32_t type available, please contact
>> [EMAIL PROTECTED]
>> #endif
>>
>> +#ifndef USE_WINDOWS_PCSC
>> +
>
> I don't understand.
> why you added this?
> Was any issue?
> The API is portable, and correct.
> Please explain.
>
>
--
Douglas E. Engert <[EMAIL PROTECTED]>
Argonne National Laboratory
9700 South Cass Avenue
Argonne, Illinois 60439
(630) 252-5444
_______________________________________________
opensc-devel mailing list
[email protected]
http://www.opensc-project.org/mailman/listinfo/opensc-devel