[pkg-opensc-commit] [libp11] 54/67: Cygwin dependency removed from MSVC build

Eric Dorland eric at moszumanska.debian.org
Sat Jan 30 05:34:17 UTC 2016


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

eric pushed a commit to branch master
in repository libp11.

commit 0a67ed8e129f94b23356edf1ee31744881318c0f
Author: Michał Trojnara <Michal.Trojnara at stunnel.org>
Date:   Tue Jan 19 12:50:29 2016 +0100

    Cygwin dependency removed from MSVC build
---
 .gitignore         |  2 ++
 INSTALL.md         | 37 ++++++++++++++++++++++++++++
 Makefile.am        |  4 +--
 Makefile.mak       |  5 ----
 appveyor.yml       |  8 +-----
 bootstrap          | 11 ---------
 configure.ac       |  2 +-
 make.rules.mak     | 72 ++++++++++++++++++++++++++++--------------------------
 src/Makefile.mak   | 13 ++++------
 src/atfork.c       |  3 +--
 src/atfork.h       |  2 --
 src/libp11-int.h   |  6 ++++-
 src/libpkcs11.c    |  3 +--
 src/p11_attr.c     |  4 +--
 src/p11_cert.c     |  3 +--
 src/p11_ec.c       |  8 +++---
 src/p11_err.c      |  1 -
 src/p11_key.c      |  3 +--
 src/p11_load.c     |  3 +--
 src/p11_misc.c     |  3 +--
 src/p11_ops.c      |  3 +--
 src/p11_rsa.c      |  3 +--
 src/p11_slot.c     |  3 +--
 src/versioninfo.rc | 35 ++++++++++++++++++++++++++
 winconfig.h        |  1 -
 25 files changed, 139 insertions(+), 99 deletions(-)

diff --git a/.gitignore b/.gitignore
index fb12f4c..6fd9a1c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -48,6 +48,8 @@ stamp-h*
 *.gz
 *.bz2
 *.out
+*.exp
+*.obj
 
 m4/ltoptions.m4
 m4/ltsugar.m4
diff --git a/INSTALL.md b/INSTALL.md
new file mode 100644
index 0000000..789a183
--- /dev/null
+++ b/INSTALL.md
@@ -0,0 +1,37 @@
+# libp11 Installation
+
+## Unix Build
+
+Install the OpenSSL development package.  On Debian/Ubuntu use:
+
+  sudo apt-get install libssl-dev
+
+Build and install libp11:
+
+  ./configure && make && sudo make install
+
+## Windows Build
+
+Download and install OpenSSL, for example:
+
+* https://slproweb.com/download/Win32OpenSSL-1_0_2e.exe
+* https://slproweb.com/download/Win64OpenSSL-1_0_2e.exe
+
+### MSVC
+
+To build libp11 use:
+
+  nmake -f Makefile.mak
+
+In case your OpenSSL is installed in a different directory, use:
+
+  nmake -f Makefile.mak OPENSSL_DIR=\your\openssl\directory
+
+### Mingw
+
+TODO
+
+### Cygwin
+
+TODO
+
diff --git a/Makefile.am b/Makefile.am
index 7fd0c2b..985d326 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -12,9 +12,9 @@ MAINTAINERCLEANFILES = \
 	$(srcdir)/m4/ltversion.m4 $(srcdir)/m4/lt~obsolete.m4 \
 	$(srcdir)/m4/ltoptions.m4 \
 	$(srcdir)/packaged
-EXTRA_DIST = .gitignore Makefile.mak winconfig.h README.md
+EXTRA_DIST = .gitignore Makefile.mak README.md
 
-dist_noinst_DATA = COPYING bootstrap
+dist_noinst_DATA = COPYING INSTALL.md
 
 dist_doc_DATA = NEWS
 
diff --git a/Makefile.mak b/Makefile.mak
index bfb1a31..312a537 100644
--- a/Makefile.mak
+++ b/Makefile.mak
@@ -3,11 +3,6 @@ SUBDIRS = src
 
 all::
 
-all:: config.h
-
-config.h: winconfig.h
-	@copy /y winconfig.h config.h
-	
 all depend install clean::
 	 @for %i in ( $(SUBDIRS) ) do \
 		@cmd /c "cd %i && $(MAKE) /nologo /f Makefile.mak $@"
diff --git a/appveyor.yml b/appveyor.yml
index e3f1d22..cfa2336 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,18 +39,13 @@ 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:
-  - 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"
-  - cp winconfig.h config.h
   - nmake /f Makefile.mak %NMAKE_ARCH% %NMAKE_EXTRA%
   - appveyor PushArtifact src\libp11.dll
   - appveyor PushArtifact src\libp11.lib
diff --git a/bootstrap b/bootstrap
deleted file mode 100755
index ffdcf30..0000000
--- a/bootstrap
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-
-set -e
-set -x
-if test -f Makefile; then
-  make distclean
-fi
-
-rm -rf *~ *.cache *.m4 config.guess config.log \
-	config.status config.sub depcomp ltmain.sh
-autoreconf --verbose --install --force
diff --git a/configure.ac b/configure.ac
index 25bd99a..aef25ab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,7 +9,7 @@ define([PACKAGE_SUFFIX], [_git])
 
 AC_INIT([libp11],[PACKAGE_VERSION_MAJOR.PACKAGE_VERSION_MINOR.PACKAGE_VERSION_FIX[]PACKAGE_SUFFIX])
 AC_CONFIG_AUX_DIR([.])
-AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_HEADERS([src/config.h])
 AC_CONFIG_MACRO_DIR([m4])
 AM_INIT_AUTOMAKE([subdir-objects])
 
diff --git a/make.rules.mak b/make.rules.mak
index bd584ef..b10d983 100644
--- a/make.rules.mak
+++ b/make.rules.mak
@@ -1,34 +1,38 @@
-!IF "$(BUILD_FOR)" == "WIN64" 
-OPENSSL_DIR = C:\OpenSSL-Win64 
-!ELSE 
-OPENSSL_DIR = C:\OpenSSL-Win32 
-!ENDIF 
-OPENSSL_INC = /I$(OPENSSL_DIR)\include 
- 
-#define OPENSSL_STATIC if you have visual studio compatible with OpenSSL's static binaries 
-#OPENSSL_STATIC_DIR = static
- 
-!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 
-
-ALL_INCLUDES= $(OPENSSL_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 "$(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
+
+LIBS = $(OPENSSL_LIB) user32.lib advapi32.lib crypt32.lib gdi32.lib
+
+CFLAGS =  /nologo /GS /W3 /D_CRT_SECURE_NO_DEPRECATE /MT$(DEBUG_SUFFIX) $(OPENSSL_INC) /D_WIN32_WINNT=0x0502 /DWIN32_LEAN_AND_MEAN $(DEBUG_COMPILE)
+
+LINKFLAGS = /NOLOGO /INCREMENTAL:NO $(MACHINE) /MANIFEST:NO /NXCOMPAT /DYNAMICBASE $(DEBUG_LINK)
+
+LIBFLAGS =  /NOLOGO $(MACHINE)
diff --git a/src/Makefile.mak b/src/Makefile.mak
index a7b44c3..2955a41 100644
--- a/src/Makefile.mak
+++ b/src/Makefile.mak
@@ -1,10 +1,10 @@
 TOPDIR = ..
 
-!INCLUDE $(TOPDIR)\Make.rules.mak
+!INCLUDE $(TOPDIR)\make.rules.mak
 
-TARGET                  = libp11.dll
+TARGET = libp11.dll
 
-OBJECTS                 = libpkcs11.obj p11_attr.obj p11_cert.obj \
+OBJECTS = libpkcs11.obj p11_attr.obj p11_cert.obj \
 	p11_err.obj p11_key.obj p11_load.obj p11_misc.obj p11_rsa.obj \
 	p11_ec.obj p11_slot.obj p11_ops.obj
 
@@ -15,17 +15,14 @@ RSC_PROJ=/l 0x809 /r /fo"versioninfo.res"
 versioninfo.res: versioninfo.rc
 	rc $(RSC_PROJ) versioninfo.rc
  
-versioninfo.rc: versioninfo.rc.in
-    @copy /y versioninfo.rc.in versioninfo.rc
-
 .c.obj::
-	cl $(COPTS) /c $<
+	cl $(CFLAGS) /c $<
 
 $(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) versioninfo.res
+		$(OBJECTS) $(LIBS) versioninfo.res
 	if EXIST $*.dll.manifest mt -manifest $*.dll.manifest -outputresource:$*.dll;2
 
diff --git a/src/atfork.c b/src/atfork.c
index ceae1a6..a51835f 100644
--- a/src/atfork.c
+++ b/src/atfork.c
@@ -19,8 +19,7 @@
  *
  */
 
-#include <config.h>
-
+#include "libp11-int.h"
 #include <sys/socket.h>
 #include <errno.h>
 #include <sys/stat.h>
diff --git a/src/atfork.h b/src/atfork.h
index 35c1ac8..d772794 100644
--- a/src/atfork.h
+++ b/src/atfork.h
@@ -23,8 +23,6 @@
 #ifndef ATFORK_H
 # define ATFORK_H
 
-#include <config.h>
-
 extern unsigned int P11_forkid;
 
 #if defined(HAVE___REGISTER_ATFORK)
diff --git a/src/libp11-int.h b/src/libp11-int.h
index 3ae052b..687ed2c 100644
--- a/src/libp11-int.h
+++ b/src/libp11-int.h
@@ -19,12 +19,16 @@
 #ifndef _LIBP11_INT_H
 #define _LIBP11_INT_H
 
+#ifndef _WIN32
+#include "config.h"
+#endif
+
 #include <openssl/bio.h>
 #include <openssl/err.h>
 #include <openssl/x509.h>
 
 #define CRYPTOKI_EXPORTS
-#include <pkcs11.h>
+#include "pkcs11.h"
 
 extern void *C_LoadModule(const char *name, CK_FUNCTION_LIST_PTR_PTR);
 extern CK_RV C_UnloadModule(void *module);
diff --git a/src/libpkcs11.c b/src/libpkcs11.c
index 6e36c51..cba4729 100644
--- a/src/libpkcs11.c
+++ b/src/libpkcs11.c
@@ -23,7 +23,7 @@
  * Copyright (C) 2002  Olaf Kirch <okir at lst.de>
  */
 
-#include <config.h>
+#include "libp11-int.h"
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -32,7 +32,6 @@
 #else
 #include <dlfcn.h>
 #endif
-#include "libp11-int.h"
 
 #define MAGIC			0xd00bed00
 
diff --git a/src/p11_attr.c b/src/p11_attr.c
index 3582963..81cbee6 100644
--- a/src/p11_attr.c
+++ b/src/p11_attr.c
@@ -25,12 +25,10 @@
  * Copyright (C) 2002, Olaf Kirch <okir at lst.de>
  */
 
-#include <config.h>
+#include "libp11-int.h"
 #include <assert.h>
 #include <string.h>
 
-#include "libp11-int.h"
-
 /*
  * Query pkcs11 attributes
  */
diff --git a/src/p11_cert.c b/src/p11_cert.c
index 481518f..f8658c4 100644
--- a/src/p11_cert.c
+++ b/src/p11_cert.c
@@ -22,9 +22,8 @@
  * Copyright (C) 2002, Olaf Kirch <okir at lst.de>
  */
 
-#include <config.h>
-#include <string.h>
 #include "libp11-int.h"
+#include <string.h>
 
 static int pkcs11_find_certs(PKCS11_TOKEN *);
 static int pkcs11_next_cert(PKCS11_CTX *, PKCS11_TOKEN *, CK_SESSION_HANDLE);
diff --git a/src/p11_ec.c b/src/p11_ec.c
index 9630611..a8a811e 100644
--- a/src/p11_ec.c
+++ b/src/p11_ec.c
@@ -24,7 +24,7 @@
  * PKCS11 token
  */
 
-#include <config.h>
+#include "libp11-int.h"
 #include <string.h>
 #include <openssl/opensslv.h>
 #include <openssl/opensslconf.h>
@@ -82,8 +82,6 @@
 
 #if !defined(LIBP11_BUILD_WITHOUT_ECDSA)
 
-#include "libp11-int.h"
-
 static ECDSA_METHOD *ops = NULL;
 static int ecdsa_ex_index = 0;
 
@@ -317,14 +315,14 @@ PKCS11_KEY_ops *pkcs11_ec_ops = {&pkcs11_ec_ops_s};
 
 #else /* LIBP11_BUILD_WITHOUT_ECDSA */
 
-void *pkcs11_ec_ops = {NULL};
+PKCS11_KEY_ops *pkcs11_ec_ops = {NULL};
 
 /* if not built with EC or OpenSSL does not support ECDSA
  * add these routines so engine_pkcs11 can be built now and not
  * require further changes */
 #warning "ECDSA support not built with libp11"
 
-void * PKCS11_get_ecdsa_method(void)
+ECDSA_METHOD *PKCS11_get_ecdsa_method(void)
 {
 	return NULL;
 }
diff --git a/src/p11_err.c b/src/p11_err.c
index 9e5091a..7fb987e 100644
--- a/src/p11_err.c
+++ b/src/p11_err.c
@@ -16,7 +16,6 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  */
 
-#include <config.h>
 #include "libp11-int.h"
 
 /* BEGIN ERROR CODES */
diff --git a/src/p11_key.c b/src/p11_key.c
index 452f60b..bfa6f0d 100644
--- a/src/p11_key.c
+++ b/src/p11_key.c
@@ -17,9 +17,8 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  */
 
-#include <config.h>
-#include <string.h>
 #include "libp11-int.h"
+#include <string.h>
 
 #ifdef _WIN32
 #define strncasecmp strnicmp
diff --git a/src/p11_load.c b/src/p11_load.c
index 4eeb4e7..ea83cf0 100644
--- a/src/p11_load.c
+++ b/src/p11_load.c
@@ -16,9 +16,8 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  */
 
-#include <config.h>
-#include <string.h>
 #include "libp11-int.h"
+#include <string.h>
 
 static void *handle = NULL;
 
diff --git a/src/p11_misc.c b/src/p11_misc.c
index eab3de3..6551642 100644
--- a/src/p11_misc.c
+++ b/src/p11_misc.c
@@ -17,10 +17,9 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  */
 
-#include <config.h>
+#include "libp11-int.h"
 #include <string.h>
 #include <openssl/crypto.h>
-#include "libp11-int.h"
 
 /* PKCS11 strings are fixed size blank padded,
  * so when strduping them we must make sure
diff --git a/src/p11_ops.c b/src/p11_ops.c
index 05c8971..60dec42 100644
--- a/src/p11_ops.c
+++ b/src/p11_ops.c
@@ -20,9 +20,8 @@
 
 /* this file does certain cryptographic operations via the pkcs11 library */
 
-#include <config.h>
-#include <string.h>
 #include "libp11-int.h"
+#include <string.h>
 
 int
 PKCS11_ecdsa_sign(const unsigned char *m, unsigned int m_len,
diff --git a/src/p11_rsa.c b/src/p11_rsa.c
index 69e6053..abab3ed 100644
--- a/src/p11_rsa.c
+++ b/src/p11_rsa.c
@@ -22,11 +22,10 @@
  * PKCS11 token
  */
 
-#include <config.h>
+#include "libp11-int.h"
 #include <string.h>
 #include <openssl/evp.h>
 #include <openssl/rsa.h>
-#include "libp11-int.h"
 
 static int rsa_ex_index = 0;
 
diff --git a/src/p11_slot.c b/src/p11_slot.c
index 1ee6328..f849f06 100644
--- a/src/p11_slot.c
+++ b/src/p11_slot.c
@@ -16,10 +16,9 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  */
 
-#include <config.h>
+#include "libp11-int.h"
 #include <string.h>
 #include <openssl/buffer.h>
-#include "libp11-int.h"
 
 static int pkcs11_init_slot(PKCS11_CTX *, PKCS11_SLOT *, CK_SLOT_ID);
 static int pkcs11_check_token(PKCS11_CTX *, PKCS11_SLOT *);
diff --git a/src/versioninfo.rc b/src/versioninfo.rc
new file mode 100644
index 0000000..0804637
--- /dev/null
+++ b/src/versioninfo.rc
@@ -0,0 +1,35 @@
+#include <winresrc.h>
+
+VS_VERSION_INFO VERSIONINFO
+	FILEVERSION 4,2,0,0
+	PRODUCTVERSION 0,3,1,0
+	FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+	FILEFLAGS 0x21L
+#else
+	FILEFLAGS 0x20L
+#endif
+	FILEOS 0x40004L
+	FILETYPE 0x1L
+	FILESUBTYPE 0x0L
+BEGIN
+	BLOCK "StringFileInfo"
+	BEGIN
+		BLOCK "040904b0"
+		BEGIN
+			VALUE "Comments", "Provided under the terms of the GNU General Public License (LGPLv2.1+).\0"
+			VALUE "CompanyName", "OpenSC Project\0"
+			VALUE "FileDescription", "PKCS#11 access library\0"
+			VALUE "FileVersion", "4.2.0.0\0"
+			VALUE "InternalName", "libp11\0"
+			VALUE "LegalCopyright", "OpenSC Project\0"
+			VALUE "LegalTrademarks", "\0"
+			VALUE "OriginalFilename", "libp11-2.dll\0"
+			VALUE "PrivateBuild", "\0"
+			VALUE "ProductName", "libp11\0"
+			VALUE "ProductVersion", "0,3,1,0\0"
+			VALUE "SpecialBuild", "\0"
+		END
+	END
+END
+
diff --git a/winconfig.h b/winconfig.h
deleted file mode 100644
index 013255c..0000000
--- a/winconfig.h
+++ /dev/null
@@ -1 +0,0 @@
-/* nothing for now */

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



More information about the pkg-opensc-commit mailing list