Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Bug 483653: unable to build certutil.exe for fennec/wince
Patch by Hiroyuki Ikezoe <ikezoe@clear-code.com>, r=nelson
  • Loading branch information
nelson%bolyard.com committed Jun 17, 2009
1 parent 6476d4f commit b1d2c98
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 4 deletions.
2 changes: 2 additions & 0 deletions security/coreconf/WINCE.mk
Expand Up @@ -83,6 +83,8 @@ LIB_SUFFIX = lib
DLL_SUFFIX = dll
OS_DLLFLAGS += -DLL

EXTRA_EXE_LD_FLAGS += -ENTRY:mainWCRTStartup

ifdef BUILD_OPT
# OS_CFLAGS += -MD
OPTIMIZER += -O2
Expand Down
4 changes: 2 additions & 2 deletions security/coreconf/rules.mk
Expand Up @@ -273,7 +273,7 @@ alltags:
$(PROGRAM): $(OBJS) $(EXTRA_LIBS)
@$(MAKE_OBJDIR)
ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
$(MKPROG) $(subst /,\\,$(OBJS)) -Fe$@ -link $(LDFLAGS) $(subst /,\\,$(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS))
$(MKPROG) $(subst /,\\,$(OBJS)) -Fe$@ -link $(LDFLAGS) $(subst /,\\,$(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS)) $(EXTRA_EXE_LD_FLAGS)
ifdef MT
if test -f $@.manifest; then \
$(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
Expand Down Expand Up @@ -373,7 +373,7 @@ $(OBJDIR)/$(PROG_PREFIX)%$(PROG_SUFFIX): $(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX)
@$(MAKE_OBJDIR)
ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
$(MKPROG) $< -Fe$@ -link \
$(LDFLAGS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS)
$(LDFLAGS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(EXTRA_EXE_LD_FLAGS)
ifdef MT
if test -f $@.manifest; then \
$(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
Expand Down
4 changes: 4 additions & 0 deletions security/nss/cmd/lib/config.mk
Expand Up @@ -45,3 +45,7 @@ SHARED_LIBRARY =
IMPORT_LIBRARY =
PROGRAM =

ifeq (WINCE,$(OS_ARCH))
CSRCS += wincemain.c
endif

65 changes: 65 additions & 0 deletions security/nss/cmd/lib/wincemain.c
@@ -0,0 +1,65 @@
/* ***** 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 the Netscape security libraries.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1994-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* 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 ***** */

#ifdef WINCE
#include <windows.h>

int
wmain(int argc, WCHAR **wargv)
{
char **argv;
int i, ret;

argv = malloc(argc * sizeof(char*));

for (i = 0; i < argc; i++) {
int len = WideCharToMultiByte(CP_ACP, 0, wargv[i], -1, NULL, 0, 0, 0);
argv[i] = malloc(len * sizeof(char));
WideCharToMultiByte(CP_ACP, 0, wargv[i], -1, argv[i], len, 0, 0);
}

ret = main(argc, argv);

for (i = 0; i < argc; i++) {
free(argv[i]);
}
free(argv);

return ret;
}

#endif

4 changes: 2 additions & 2 deletions security/nss/cmd/platlibs.mk
Expand Up @@ -91,7 +91,7 @@ endif
ifdef USE_STATIC_LIBS

# can't do this in manifest.mn because OS_ARCH isn't defined there.
ifeq ($(OS_ARCH), WINNT)
ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH)))

DEFINES += -DNSS_USE_STATIC_LIBS
# $(PROGRAM) has explicit dependencies on $(EXTRA_LIBS)
Expand Down Expand Up @@ -211,7 +211,7 @@ endif

else # USE_STATIC_LIBS
# can't do this in manifest.mn because OS_ARCH isn't defined there.
ifeq ($(OS_ARCH), WINNT)
ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH)))

# $(PROGRAM) has explicit dependencies on $(EXTRA_LIBS)
EXTRA_LIBS += \
Expand Down

0 comments on commit b1d2c98

Please sign in to comment.