Skip to content

Any plan to a Unix version? #1

@LudovicRousseau

Description

@LudovicRousseau

For now the project fails to build on GNU/Linux because:

  • CHAR is used instead of char
  • WinSCard.h is used instead of winscard.h (the Unix file system is case sensitive)
  • linux support is missing in binding.gyp

Here is a proposed first patch

--- /tmp/W96h0J_binding.gyp 2014-09-23 08:47:09.516120896 +0000
+++ binding.gyp 2014-09-23 08:35:29.576115737 +0000
@@ -10,7 +10,14 @@
       "conditions" : [
        ['OS=="win"', {
           'libraries': ['-lWinSCard']
-        }]
+        }],
+       ['OS=="linux"', {
+                    'include_dirs': [ '/usr/include/PCSC' ],
+                    'link_settings': {
+                        'libraries': [ '-lpcsclite' ],
+                        'library_dirs': [ '/usr/lib' ]
+                    }
+       }]
       ]
     }
   ]
colordiff is /usr/bin/colordiff
--- /tmp/wUnVfM_pcsc.cc 2014-09-23 08:47:09.552120897 +0000
+++ src/pcsc.cc 2014-09-23 08:41:52.652118561 +0000
@@ -1,4 +1,6 @@
 #define BUILDING_NODE_EXTENSION
+#include <string.h>
+
 #include <node.h>
 #include <node_buffer.h>
 #include "pcsc_type.h"
@@ -274,7 +276,7 @@ Handle<Value> PCSC::GetBytes(const Argum
    return scope.Close(actualBuffer);
 }

-void printHexString(CHAR* sPrefix, LPBYTE baData, DWORD dataLen)
+void printHexString(char* sPrefix, LPBYTE baData, DWORD dataLen)
 {
    DWORD i;

@@ -286,4 +288,4 @@ void printHexString(CHAR* sPrefix, LPBYT
    }

    printf("\n");
-}
\ No newline at end of file
+}
colordiff is /usr/bin/colordiff
--- /tmp/4zmkMO_pcscwrap.cc 2014-09-23 08:47:09.584120897 +0000
+++ src/pcscwrap.cc 2014-09-23 08:42:44.400118942 +0000
@@ -6,7 +6,7 @@ SCARDCONTEXT        hContext; // Resource mana
 SCARD_READERSTATE   hReaderState;
 SCARDHANDLE            hCard;
 DWORD              dwActiveProtocol;      // Active protocol (T=0).
-CHAR               szSelectedReader[256]; // reader name
+char               szSelectedReader[256]; // reader name

 LONG pcsc_init()
 {
@@ -152,4 +152,4 @@ LONG pcsc_disconnect()
     LONG ret = SCARD_S_SUCCESS;
    ret = SCardDisconnect(hCard, SCARD_EJECT_CARD);
    return ret;
-}
\ No newline at end of file
+}
colordiff is /usr/bin/colordiff
--- /tmp/QkYPdU_pcscwrap.h  2014-09-23 08:47:09.620120896 +0000
+++ src/pcscwrap.h  2014-09-23 08:30:30.452113532 +0000
@@ -1,7 +1,7 @@
 #ifndef __PCSCWRAP_H__
 #define __PCSCWARP_H__
 #include <stdio.h>
-#include <WinSCard.h>
+#include <winscard.h>
 #include "pcsc_type.h"


@@ -19,4 +19,4 @@ LONG pcsc_disconnect();
 LONG pcsc_release();


-#endif /* #ifndef __PCSCWRAP_H__ */
\ No newline at end of file
+#endif /* #ifndef __PCSCWRAP_H__ */

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions