[pkg-opensc-commit] [engine-pkcs11] 29/43: Cygwin dependency removed from MSVC build

Eric Dorland eric at moszumanska.debian.org
Sun Jan 31 06:38:50 UTC 2016


This is an automated email from the git hooks/post-receive script.

eric pushed a commit to branch master
in repository engine-pkcs11.

commit 49b05c154aaa16930a1aef0f0e0c3959885bed38
Author: Michał Trojnara <Michal.Trojnara at stunnel.org>
Date:   Tue Jan 26 19:42:50 2016 +0100

    Cygwin dependency removed from MSVC build
---
 NEWS                |  2 ++
 appveyor.yml        | 27 ++++++------------
 make.rules.mak      | 82 ++++++++++++++++++++++++++++++-----------------------
 src/Makefile.am     |  5 ++--
 src/Makefile.mak    | 22 ++++++++------
 src/engine_pkcs11.c |  3 +-
 src/engine_pkcs11.h |  4 +++
 src/hw_pkcs11.c     |  3 +-
 src/pkcs11.exports  |  2 ++
 9 files changed, 81 insertions(+), 69 deletions(-)

diff --git a/NEWS b/NEWS
index 6e57817..e14d6ef 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,8 @@
 NEWS for Engine PKCS#11 -- History of user visible changes
 
 New in 0.2.1; unreleased;
+* Windows library name updated to "pkcs11.dll" to match other
+  OpenSSL engines (Michał Trojnara)
 * Added "--with-pkcs11-module" configure option; addresses #36
   (Michał Trojnara)
 * Fixed OpenSSL engines directory autoselection (Michał Trojnara)
diff --git a/appveyor.yml b/appveyor.yml
index 990c41c..9acb85e 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -19,7 +19,6 @@ install:
         Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
         throw "There are newer queued builds for this pull request, failing early." }
   - date /T & time /T
-  - set PATH=C:\cygwin\bin;%PATH%
   - set OPENSSL_VER=1_0_2e
   - ps: >-
       If ($env:Platform -Match "x86") {
@@ -40,38 +39,30 @@ install:
       }
   - ps: >-
       If ($env:Configuration -Like "*Debug*") {
-        $env:NMAKE_EXTRA="DEBUG_DEF=/DDEBUG ${env:NMAKE_EXTRA}"
+        $env:NMAKE_EXTRA="DEBUG=yes ${env:NMAKE_EXTRA}"
       }
   - ps: $env:VSCOMNTOOLS=(Get-Content ("env:VS" + "$env:VSVER" + "0COMNTOOLS"))
   - echo "Using Visual Studio %VSVER%.0 at %VSCOMNTOOLS%"
   - call "%VSCOMNTOOLS%\..\..\VC\vcvarsall.bat" %VCVARS_PLATFORM%
-  - uname -a
 
 build_script:
   - git clone -q https://github.com/OpenSC/libp11.git C:\projects\libp11
   - cd C:\projects\libp11
-  - bash -c "exec 0</dev/null && ./bootstrap"
-  # disable features to speed up the script
-  - bash -c "exec 0</dev/null && ./configure OPENSSL_CFLAGS=\"-IC:\OpenSSL-Win32\include -IC:\OpenSSL-Win64\include\" OPENSSL_LIBS=\"-LC:\OpenSSL-Win32 -LC:\OpenSSL-Win64 -leay\" || cat config.log"
   - nmake /f Makefile.mak %NMAKE_ARCH% %NMAKE_EXTRA%
   - appveyor PushArtifact src\libp11.dll
   - appveyor PushArtifact src\libp11.lib
   - ps: >-
-       If ($env:Configuration -Like "*Debug*") {
-          Push-AppveyorArtifact src\libp11.pdb
-       }
+      If ($env:Configuration -Like "*Debug*") {
+         Push-AppveyorArtifact src\libp11.pdb
+      }
   - cd C:\projects\engine-pkcs11
-  - bash -c "exec 0</dev/null && ./bootstrap"
-  # disable features to speed up the script
-  - bash -c "exec 0</dev/null && ./configure OPENSSL_CFLAGS=\"-IC:\OpenSSL-Win32\include -IC:\OpenSSL-Win64\include\" OPENSSL_LIBS=\"-LC:\OpenSSL-Win32 -LC:\OpenSSL-Win64 -leay\" LIBP11_CFLAGS=\"-Ic:\projects\libp11\src\" LIBP11_LIBS=\"-Lc:\projects\libp11\src\" || cat config.log"
-  - cp winconfig.h config.h
   - nmake /f Makefile.mak %NMAKE_ARCH% %NMAKE_EXTRA%
-  - appveyor PushArtifact src\engine_pkcs11.dll
-  - appveyor PushArtifact src\engine_pkcs11.lib
+  - appveyor PushArtifact src\pkcs11.dll
+  - appveyor PushArtifact src\pkcs11.lib
   - ps: >-
-       If ($env:Configuration -Like "*Debug*") {
-          Push-AppveyorArtifact src\engine_pkcs11.pdb
-       }
+      If ($env:Configuration -Like "*Debug*") {
+         Push-AppveyorArtifact src\pkcs11.pdb
+      }
 
 cache:
   - C:\OpenSSL-Win32
diff --git a/make.rules.mak b/make.rules.mak
index ce6bdba..cb28d9e 100644
--- a/make.rules.mak
+++ b/make.rules.mak
@@ -1,36 +1,46 @@
-
-LIBP11_DIR = c:\projects\libp11
-!IF "$(BUILD_FOR)" == "WIN64" 
-OPENSSL_DIR = C:\OpenSSL-Win64 
-!ELSE 
-OPENSSL_DIR = C:\OpenSSL-Win32 
-!ENDIF 
-OPENSSL_INC = /I$(OPENSSL_DIR)\include 
- 
-!IF "$(DEBUG_DEF)" == "/DDEBUG" 
-OPENSSL_LIB = $(OPENSSL_DIR)\lib\VC\$(OPENSSL_STATIC_DIR)\libeay32MTd.lib user32.lib advapi32.lib crypt32.lib gdi32.lib
-!ELSE 
-OPENSSL_LIB = $(OPENSSL_DIR)\lib\VC\$(OPENSSL_STATIC_DIR)\libeay32MT.lib user32.lib advapi32.lib crypt32.lib gdi32.lib
-!ENDIF 
-
-LIBP11_INC = /I$(LIBP11_DIR)\src
-LIBP11_LIB = $(LIBP11_DIR)\src\libp11.lib
-
-ALL_INCLUDES= $(OPENSSL_INC) $(LIBP11_INC)
-
-!IF "$(DEBUG_DEF)" == "/DDEBUG"
-LINKDEBUGFLAGS = /NODEFAULTLIB:LIBCMT /DEBUG
-CODE_OPTIMIZATION =
-COPTS =  /GS /W3 /D_CRT_SECURE_NO_DEPRECATE /MTd /nologo $(ALL_INCLUDES) /I..\ /I. /D_WIN32_WINNT=0x0502 /DWIN32_LEAN_AND_MEAN /DDEBUG /Zi /Od
-!ELSE
-LINKDEBUGFLAGS = /NODEFAULTLIB:LIBCMTD
-COPTS =  /GS /W3 /D_CRT_SECURE_NO_DEPRECATE /MT /nologo $(ALL_INCLUDES) /I..\ /I. /D_WIN32_WINNT=0x0502 /DWIN32_LEAN_AND_MEAN
-!ENDIF
-
-!IF "$(BUILD_FOR)" == "WIN64"
-LINKFLAGS = /NOLOGO /INCREMENTAL:NO /MACHINE:X64 /MANIFEST:NO /NODEFAULTLIB:MSVCRTD  /NODEFAULTLIB:MSVCRT /NXCOMPAT /DYNAMICBASE $(LINKDEBUGFLAGS)
-LIBFLAGS =  /nologo /machine:x64
-!ELSE
-LINKFLAGS = /NOLOGO /INCREMENTAL:NO /MACHINE:X86 /MANIFEST:NO /NODEFAULTLIB:MSVCRTD  /NODEFAULTLIB:MSVCRT /NXCOMPAT /DYNAMICBASE $(LINKDEBUGFLAGS)
-LIBFLAGS =  /nologo /machine:x86
-!ENDIF
+#define OPENSSL_STATIC if you have visual studio compatible with OpenSSL's static binaries
+#OPENSSL_STATIC_DIR = static
+
+!IF "$(LIBP11_DIR)" == ""
+LIBP11_DIR = C:\projects\libp11
+!ENDIF
+
+!IF "$(DEBUG)" != ""
+DEBUG_SUFFIX = d
+DEBUG_COMPILE = /DDEBUG /Zi /Od
+DEBUG_LINK = /DEBUG
+!ENDIF
+
+!IF "$(BUILD_FOR)" == "WIN64"
+MACHINE = /MACHINE:X64
+!IF "$(OPENSSL_DIR)" == ""
+OPENSSL_DIR = C:\OpenSSL-Win64
+!ENDIF
+!ELSE
+MACHINE = /MACHINE:X86
+!IF "$(OPENSSL_DIR)" == ""
+OPENSSL_DIR = C:\OpenSSL-Win32
+!ENDIF
+!ENDIF
+
+!IF "$(OPENSSL_INC)" == ""
+OPENSSL_INC = /I$(OPENSSL_DIR)\include
+!ENDIF
+
+!IF "$(OPENSSL_STATIC_DIR)" == ""
+OPENSSL_LIB = $(OPENSSL_DIR)\lib\libeay32.lib
+!ELSE
+OPENSSL_LIB = $(OPENSSL_DIR)\lib\VC\static\libeay32MT$(DEBUG_SUFFIX).lib
+!ENDIF
+
+!IF "$(LIBP11_INC)" == ""
+LIBP11_INC = /I$(LIBP11_DIR)\src
+!ENDIF
+
+!IF "$(LIBP11_LIB)" == ""
+LIBP11_LIB = $(LIBP11_DIR)\src\libp11.lib
+!ENDIF
+
+CLFLAGS =  /nologo /GS /W3 /D_CRT_SECURE_NO_DEPRECATE /MT$(DEBUG_SUFFIX) $(OPENSSL_INC) $(LIBP11_INC) /D_WIN32_WINNT=0x0502 /DWIN32_LEAN_AND_MEAN $(DEBUG_COMPILE)
+
+LINKFLAGS = /NOLOGO /INCREMENTAL:NO $(MACHINE) /MANIFEST:NO /NXCOMPAT /DYNAMICBASE $(DEBUG_LINK)
diff --git a/src/Makefile.am b/src/Makefile.am
index 7b47c9d..0bc5e1c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -13,8 +13,7 @@ OPENSSL_EXTRA_CFLAGS = \
 	-DSHA1_ASM -DMD5_ASM -DRMD160_ASM
 
 libpkcs11_la_SOURCES = \
-	hw_pkcs11.c engine_pkcs11.c engine_pkcs11.h  \
-	engine_pkcs11.exports
+	hw_pkcs11.c engine_pkcs11.c engine_pkcs11.h pkcs11.exports
 if WIN32
 libpkcs11_la_SOURCES += versioninfo.rc
 else
@@ -25,7 +24,7 @@ libpkcs11_la_CFLAGS = $(AM_CFLAGS) $(OPENSSL_EXTRA_CFLAGS) $(OPENSSL_CFLAGS) \
 libpkcs11_la_LIBADD = $(OPENSSL_LIBS) $(LIBP11_LIBS)
 libpkcs11_la_LDFLAGS = $(AM_LDFLAGS) \
 	-module -shared -avoid-version \
-	-export-symbols "$(srcdir)/engine_pkcs11.exports" \
+	-export-symbols "$(srcdir)/pkcs11.exports" \
 	-no-undefined
 
 RCCOMPILE = $(RC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
diff --git a/src/Makefile.mak b/src/Makefile.mak
index 2e95617..6a0c250 100644
--- a/src/Makefile.mak
+++ b/src/Makefile.mak
@@ -1,20 +1,26 @@
 TOPDIR = ..
 
-!INCLUDE $(TOPDIR)\Make.rules.mak
-# see make.rules.mak to edit openssl or libp11 path
+# see ..\make.rules.mak to edit openssl or libp11 path
+!INCLUDE $(TOPDIR)\make.rules.mak
 
-TARGET                  = engine_pkcs11.dll
+TARGET = pkcs11.dll
 
-OBJECTS			= engine_pkcs11.obj hw_pkcs11.obj
+OBJECTS = engine_pkcs11.obj hw_pkcs11.obj
 
-all: $(TARGET)
+all: $(TARGET) versioninfo.res
+
+RSC_PROJ=/l 0x809 /r /fo"versioninfo.res"
+
+versioninfo.res: versioninfo.rc
+	rc $(RSC_PROJ) versioninfo.rc
 
 .c.obj::
-	cl $(COPTS) /c $<
+	cl $(CLFLAGS) /c $<
 
-$(TARGET): $(OBJECTS) .
+$(TARGET): $(OBJECTS) versioninfo.res
 	echo LIBRARY $* > $*.def
 	echo EXPORTS >> $*.def
 	type $*.exports >> $*.def
-	link $(LINKFLAGS) /dll /def:$*.def /implib:$*.lib /out:$(TARGET) $(OBJECTS) $(OPENSSL_LIB) $(LIBP11_LIB)
+	link $(LINKFLAGS) /dll /def:$*.def /implib:$*.lib /out:$(TARGET) \
+		$(OBJECTS) $(OPENSSL_LIB) $(LIBP11_LIB) versioninfo.res
 	if EXIST $*.dll.manifest mt -manifest $*.dll.manifest -outputresource:$*.dll;2
diff --git a/src/engine_pkcs11.c b/src/engine_pkcs11.c
index 85fbf7f..8136c42 100644
--- a/src/engine_pkcs11.c
+++ b/src/engine_pkcs11.c
@@ -25,14 +25,13 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <config.h>
+#include "engine_pkcs11.h"
 #include <stdio.h>
 #include <string.h>
 #include <openssl/crypto.h>
 #include <openssl/objects.h>
 #include <openssl/engine.h>
 #include <libp11.h>
-#include "engine_pkcs11.h"
 
 #ifdef _WIN32
 #define strncasecmp strnicmp
diff --git a/src/engine_pkcs11.h b/src/engine_pkcs11.h
index 7bc87e0..3261a22 100644
--- a/src/engine_pkcs11.h
+++ b/src/engine_pkcs11.h
@@ -27,6 +27,10 @@
 #ifndef _ENGINE_PKCS11_H
 #define _ENGINE_PKCS11_H
 
+#ifndef _WIN32
+#include "config.h"
+#endif
+
 #include <stdio.h>
 #include <string.h>
 #include <openssl/crypto.h>
diff --git a/src/hw_pkcs11.c b/src/hw_pkcs11.c
index 1053bf4..f52fb05 100644
--- a/src/hw_pkcs11.c
+++ b/src/hw_pkcs11.c
@@ -59,7 +59,7 @@
  *
  */
 
-#include <config.h>
+#include "engine_pkcs11.h"
 #include <stdio.h>
 #include <string.h>
 #include <openssl/opensslv.h>
@@ -72,7 +72,6 @@
 #error did not get engine.h
 #endif
 #include <libp11.h>
-#include "engine_pkcs11.h"
 
 #define PKCS11_ENGINE_ID "pkcs11"
 #define PKCS11_ENGINE_NAME "pkcs11 engine"
diff --git a/src/pkcs11.exports b/src/pkcs11.exports
new file mode 100644
index 0000000..6b8b3a9
--- /dev/null
+++ b/src/pkcs11.exports
@@ -0,0 +1,2 @@
+v_check
+bind_engine

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opensc/engine-pkcs11.git



More information about the pkg-opensc-commit mailing list