windows build fixes for crypto component

This commit is contained in:
Dan Mills 2008-05-13 18:37:07 -07:00
parent 5bc6a61d86
commit 0ac923cec9
2 changed files with 172 additions and 56 deletions

134
services/crypto/Makefile Normal file → Executable file
View File

@ -36,56 +36,6 @@
#
# ***** END LICENSE BLOCK *****
idl = IWeaveCrypto.idl
cpp_sources = WeaveCrypto.cpp WeaveCryptoModule.cpp
target = WeaveCrypto # will have .so / .dylib / .dll appended
sdkdir ?= ${MOZSDKDIR}
destdir = ..
platformdir = $(destdir)/platform/$(platform)
xpidl = $(sdkdir)/bin/xpidl
# FIXME: we don't actually require this for e.g. clean
ifndef sdkdir
$(warning No 'sdkdir' variable given)
$(warning It should point to the location of the Gecko SDK)
$(warning For example: "make sdkdir=/foo/bar/baz")
$(error )
endif
######################################################################
headers = -I$(sdkdir)/include \
-I$(sdkdir)/include/system_wrappers \
-I$(sdkdir)/include/nss \
-I$(sdkdir)/include/xpcom \
-I$(sdkdir)/include/string \
-I$(sdkdir)/include/pipnss \
-I$(sdkdir)/include/nspr \
-I$(sdkdir)/sdk/include
cppflags += -c -pipe -Os \
-fPIC -fno-rtti -fno-exceptions -fno-strict-aliasing \
-fpascal-strings -fno-common -fshort-wchar -pthread \
-Wall -Wconversion -Wpointer-arith -Woverloaded-virtual -Wsynth \
-Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align \
-Wno-long-long \
-include xpcom-config.h $(headers)
libdirs = -L$(sdkdir)/lib -L$(sdkdir)/bin
libs = -lxpcomglue_s -lxpcom \
-lcrmf -lsmime3 -lssl3 -lnss3 -lnssutil3 -lsoftokn3 \
-lplds4 -lplc4 -lnspr4
ldflags += -pthread -pipe -bundle \
-Wl,-executable_path,$(sdkdir)/bin \
-Wl,-dead_strip \
-Wl,-exported_symbol \
-Wl,_NSGetModule \
$(libdirs) $(libs)
######################################################################
# Platform detection
sys := $(shell uname -s)
@ -104,15 +54,14 @@ else
so = dylib
cppflags += -dynamiclib
else
ifeq ($(os), MINGW32_NT-5.1)
$(error Sorry, windows is not supported yet)
ifeq ($(sys), MINGW32_NT-6.0)
os = WINNT
compiler = msvc
cxx = c++ # fixme
cxx = cl
so = dll
cppflags += -shared
# cppflags += -LD
else
$(error Sorry, your os is unknown/unsupported: $(os))
$(error Sorry, your os is unknown/unsupported: $(sys))
endif
endif
endif
@ -140,11 +89,71 @@ endif
platform = $(os)_$(arch)-$(compiler)
######################################################################
idl = IWeaveCrypto.idl
cpp_sources = WeaveCrypto.cpp WeaveCryptoModule.cpp
target = WeaveCrypto # will have .so / .dylib / .dll appended
sdkdir ?= ${MOZSDKDIR}
destdir = ..
platformdir = $(destdir)/platform/$(platform)
xpidl = $(sdkdir)/bin/xpidl
# FIXME: we don't actually require this for e.g. clean
ifeq ($(sdkdir),)
$(warning No 'sdkdir' variable given)
$(warning It should point to the location of the Gecko SDK)
$(warning For example: "make sdkdir=/foo/bar/baz")
$(warning Or set the MOZSDKDIR environment variable to point to it)
$(error )
endif
idl_headers = $(idl:.idl=.h)
idl_typelib = $(idl:.idl=.xpt)
cpp_objects = $(cpp_sources:.cpp=.o)
so_target = $(target:=.$(so))
headers = -I$(sdkdir)/include \
-I$(sdkdir)/include/system_wrappers \
-I$(sdkdir)/include/nss \
-I$(sdkdir)/include/xpcom \
-I$(sdkdir)/include/string \
-I$(sdkdir)/include/pipnss \
-I$(sdkdir)/include/nspr \
-I$(sdkdir)/sdk/include
libdirs := $(sdkdir)/lib $(sdkdir)/bin
libs := xpcomglue_s xpcom nspr4 \
crmf smime3 ssl3 nss3 nssutil3 softokn3 \
plds4 plc4
ifeq ($(compiler),msvc)
libdirs := $(patsubst %,-LIBPATH:%,$(libdirs))
libs := $(patsubst %,$(sdkdir)/lib/%.lib,$(libs))
cppflags += -c -nologo -O1 -GR- -TP -nologo -Zc:wchar_t- -W3 -Gy $(headers)
ldflags += -DLL -NOLOGO -SUBSYSTEM:WINDOWS $(libdirs) $(libs) kernel32.lib \
user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib
rcflags := -r $(headers)
else
libdirs := $(patsubst %,-L%,$(libdirs))
libs := $(patsubst %,-l%,$(libs))
cppflags += -c -pipe -Os \
-fPIC -fno-rtti -fno-exceptions -fno-strict-aliasing \
-fpascal-strings -fno-common -fshort-wchar -pthread \
-Wall -Wconversion -Wpointer-arith -Woverloaded-virtual -Wsynth \
-Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align \
-Wno-long-long \
-include xpcom-config.h $(headers)
ldflags += -pthread -pipe -bundle \
-Wl,-executable_path,$(sdkdir)/bin \
-Wl,-dead_strip \
-Wl,-exported_symbol \
-Wl,_NSGetModule \
$(libdirs) $(libs)
endif
######################################################################
.PHONY: all build install test-install clean
@ -181,9 +190,22 @@ $(idl_typelib): $(idl)
# "main" (internal) rules, build sources and link the component
$(cpp_objects): $(cpp_sources)
ifeq ($(cxx),cl)
$(cxx) -Fo$@ -Fd$(@:.o=.pdb) $(cppflags) $(@:.o=.cpp)
else
$(cxx) -o $@ $(cppflags) $(@:.o=.cpp)
endif
$(so_target): $(idl_headers) $(cpp_objects)
$(target:=.res): $(target:=.rc)
ifeq ($(compiler),msvc)
rc -Fo$@ $(rcflags) $(target:=.rc)
endif
$(so_target): $(idl_headers) $(cpp_objects) $(target:=.res)
ifeq ($(compiler),msvc)
link -out:$@ $(ldflags) $(cpp_objects)
else
$(cxx) -o $@ $(ldflags) $(cpp_objects)
endif
chmod +x $@
# strip $@

View File

@ -0,0 +1,94 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Weave code.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Dan Mills <thunder@mozilla.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* See http://msdn.microsoft.com/en-us/library/aa381058.aspx for format docs,
* and mozilla/config/version_win.pl for what Mozilla uses
*/
#include<winver.h>
#define VER_BUILDID_STR "@buildid@"
#define VER_FILEVERSION 1,9,0,@buildid@
#define VER_PRODUCTVERSION 1,9,0,@buildid@
#define VER_FILEFLAGS 0 | VS_FF_PRIVATEBUILD | VS_FF_PRERELEASE
#define VER_PRODUCTNAME_STR "Weave"
#define VER_INTERNALNAME_STR "WeaveCrypto"
#define VER_FILEVERSION_STR "1.9pre"
#define VER_PRODUCTVERSION_STR "1.9pre"
#define VER_COMPANYNAME_STR "Mozilla Corporation"
#define VER_LEGALTRADEMARKS_STR "Mozilla"
#define VER_LEGALCOPYRIGHT_STR "License: MPL 1.1/GPL 2.0/LGPL 2.1"
#define VER_COMMENTS_STR ""
#define VER_FILEDESCRIPTION_STR ""
#define VER_ORIGINALFILENAME_STR ""
VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_PRODUCTVERSION
PRODUCTVERSION VER_PRODUCTVERSION
FILEFLAGSMASK 0x3fL
FILEFLAGS VER_FILEFLAGS
FILEOS VOS__WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "000004b0"
BEGIN
VALUE "Comments", VER_COMMENTS_STR
VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR
VALUE "CompanyName", VER_COMPANYNAME_STR
VALUE "FileDescription", VER_FILEDESCRIPTION_STR
VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
VALUE "InternalName", VER_INTERNALNAME_STR
VALUE "LegalTrademarks", VER_LEGALTRADEMARKS_STR
VALUE "OriginalFilename", VER_ORIGINALFILENAME_STR
VALUE "ProductName", VER_PRODUCTNAME_STR
VALUE "BuildID", VER_BUILDID_STR
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0, 1200
END
END