From 42ad8b4c55117523e08040033bcc3b150d6a16a7 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Wed, 5 Jan 2022 13:10:56 -0500 Subject: [PATCH] lib/asn1: build static runtime version of libasn1 on Windows This commit builds a static runtime version of the asn1 library which is required for some thirdparty applications. LIBASN1_S =$(LIBDIR)\libasn1_s.lib This differs from libasn1.lib which is compiled to use the dynamic runtime. Change-Id: Ib04f5b53a7f16d7bbe9d2debb75e944322a6792a --- lib/asn1/NTMakefile | 129 ++++++++++++++++++++++++++++++++++++++++- windows/NTMakefile.w32 | 3 + 2 files changed, 130 insertions(+), 2 deletions(-) diff --git a/lib/asn1/NTMakefile b/lib/asn1/NTMakefile index a2bbf229f..559634515 100644 --- a/lib/asn1/NTMakefile +++ b/lib/asn1/NTMakefile @@ -1,6 +1,6 @@ ######################################################################## # -# Copyright (c) 2009, Secure Endpoints Inc. +# Copyright (c) 2009-2022, Secure Endpoints Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -167,6 +167,131 @@ $(**: = clean:: -$(RM) $(LIBASN1) +# +# The static runtime version LIBASN1_S is for use by thirdparty +# components. It is not used in the construction of the Heimdal +# DLLs. + +LIBASN1_S_OBJS= \ + $(OBJ)\der.s.obj \ + $(OBJ)\der_get.s.obj \ + $(OBJ)\der_put.s.obj \ + $(OBJ)\der_free.s.obj \ + $(OBJ)\der_print.s.obj \ + $(OBJ)\der_length.s.obj \ + $(OBJ)\der_copy.s.obj \ + $(OBJ)\der_cmp.s.obj \ + $(OBJ)\der_format.s.obj \ + $(OBJ)\template.s.obj \ + $(OBJ)\extra.s.obj \ + $(OBJ)\oid_resolution.s.obj \ + $(OBJ)\timegm.s.obj \ + $(gen_files_rfc2459:.x=.s.obj) \ + $(gen_files_rfc4108:.x=.s.obj) \ + $(gen_files_cms:.x=.s.obj) \ + $(gen_files_krb5:.x=.s.obj) \ + $(gen_files_ocsp:.x=.s.obj) \ + $(gen_files_pkinit:.x=.s.obj) \ + $(gen_files_pkcs8:.x=.s.obj) \ + $(gen_files_pkcs9:.x=.s.obj) \ + $(gen_files_pkcs10:.x=.s.obj) \ + $(gen_files_pkcs12:.x=.s.obj) \ + $(gen_files_digest:.x=.s.obj) \ + $(gen_files_kx509:.x=.s.obj) \ + $(gen_files_x690sample:.x=.s.obj) \ + $(OBJ)\asn1_err.s.obj + +$(OBJ)\oid_resolution.s.obj: oid_resolution.c $(LIBASN1_X) + $(C2OBJ_C_MT) -Fo$@ -Fd$(@D)\ oid_resolution.c + +$(OBJ)\der.s.obj: der.c + $(C2OBJ_C_MT) -Fo$@ -Fd$(@D)\ $** + +$(OBJ)\der_get.s.obj: der_get.c + $(C2OBJ_C_MT) -Fo$@ -Fd$(@D)\ $** + +$(OBJ)\der_put.s.obj: der_put.c + $(C2OBJ_C_MT) -Fo$@ -Fd$(@D)\ $** + +$(OBJ)\der_free.s.obj: der_free.c + $(C2OBJ_C_MT) -Fo$@ -Fd$(@D)\ $** + +$(OBJ)\der_print.s.obj: der_print.c + $(C2OBJ_C_MT) -Fo$@ -Fd$(@D)\ $** + +$(OBJ)\der_length.s.obj: der_length.c + $(C2OBJ_C_MT) -Fo$@ -Fd$(@D)\ $** + +$(OBJ)\der_copy.s.obj: der_copy.c + $(C2OBJ_C_MT) -Fo$@ -Fd$(@D)\ $** + +$(OBJ)\der_cmp.s.obj: der_cmp.c + $(C2OBJ_C_MT) -Fo$@ -Fd$(@D)\ $** + +$(OBJ)\der_format.s.obj: der_format.c + $(C2OBJ_C_MT) -Fo$@ -Fd$(@D)\ $** + +$(OBJ)\template.s.obj: template.c + $(C2OBJ_C_MT) -Fo$@ -Fd$(@D)\ $** + +$(OBJ)\extra.s.obj: extra.c + $(C2OBJ_C_MT) -Fo$@ -Fd$(@D)\ $** + +$(OBJ)\timegm.s.obj: timegm.c + $(C2OBJ_C_MT) -Fo$@ -Fd$(@D)\ $** + +$(gen_files_rfc2459:.x=.s.obj): $(gen_files_rfc2459:.x=.c) + $(C2OBJ_C_MT) -Fo$@ -Fd$(@D)\ $** + +$(gen_files_rfc4108:.x=.s.obj): $(gen_files_rfc4108:.x=.c) + $(C2OBJ_C_MT) -Fo$@ -Fd$(@D)\ $** + +$(gen_files_cms:.x=.s.obj): $(gen_files_cms:.x=.c) + $(C2OBJ_C_MT) -Fo$@ -Fd$(@D)\ $** + +$(gen_files_krb5:.x=.s.obj): $(gen_files_krb5:.x=.c) + $(C2OBJ_C_MT) -Fo$@ -Fd$(@D)\ $** + +$(gen_files_ocsp:.x=.s.obj): $(gen_files_ocsp:.x=.c) + $(C2OBJ_C_MT) -Fo$@ -Fd$(@D)\ $** + +$(gen_files_pkinit:.x=.s.obj): $(gen_files_pkinit:.x=.c) + $(C2OBJ_C_MT) -Fo$@ -Fd$(@D)\ $** + +$(gen_files_pkcs8:.x=.s.obj): $(gen_files_pkcs8:.x=.c) + $(C2OBJ_C_MT) -Fo$@ -Fd$(@D)\ $** + +$(gen_files_pkcs9:.x=.s.obj): $(gen_files_pkcs9:.x=.c) + $(C2OBJ_C_MT) -Fo$@ -Fd$(@D)\ $** + +$(gen_files_pkcs10:.x=.s.obj): $(gen_files_pkcs10:.x=.c) + $(C2OBJ_C_MT) -Fo$@ -Fd$(@D)\ $** + +$(gen_files_pkcs12:.x=.s.obj): $(gen_files_pkcs12:.x=.c) + $(C2OBJ_C_MT) -Fo$@ -Fd$(@D)\ $** + +$(gen_files_digest:.x=.s.obj): $(gen_files_digest:.x=.c) + $(C2OBJ_C_MT) -Fo$@ -Fd$(@D)\ $** + +$(gen_files_kx509:.x=.s.obj): $(gen_files_kx509:.x=.c) + $(C2OBJ_C_MT) -Fo$@ -Fd$(@D)\ $** + +$(gen_files_x690sample:.x=.s.obj): $(gen_files_x690sample:.x=.c) + $(C2OBJ_C_MT) -Fo$@ -Fd$(@D)\ $** + +$(OBJ)\asn1_err.s.obj: $(OBJ)\asn1_err.c + $(C2OBJ_C_MT) -Fo$@ -Fd$(@D)\ $** + +$(LIBASN1_S): $(LIBASN1_S_OBJS) + $(LIBCON_C) -out:$@ @<< +$(**: = +) +<< + +clean:: + -$(RM) $(LIBASN1_S) + + # # Generate list of exports # @@ -421,7 +546,7 @@ $(OBJ)\der-private.h: $(libasn1_SOURCES) clean:: -$(RM) $(INCDIR)\der-protos.h -all:: $(INCFILES) $(GENINCFILES) $(ASN1_BINARIES) $(LIBASN1) +all:: $(INCFILES) $(GENINCFILES) $(ASN1_BINARIES) $(LIBASN1) $(LIBASN1_S) all-tools:: $(LIBEXECDIR)\asn1_print.exe $(BINDIR)\asn1_gen.exe diff --git a/windows/NTMakefile.w32 b/windows/NTMakefile.w32 index 929bcf5e4..d975cc465 100644 --- a/windows/NTMakefile.w32 +++ b/windows/NTMakefile.w32 @@ -207,6 +207,8 @@ EXEGUILINK_C = $(LINK) $(ldebug) $(guilflags) $(guilibsdll) $(libmach) DLLCONLINK_C = $(LINK) $(ldebug) $(dlllflags) $(conlibsdll) $(libmach) DLLGUILINK_C = $(LINK) $(ldebug) $(dlllflags) $(guilibsdll) $(libmach) +C2OBJ_C_MT = $(CC) $(cdebug) $(cflags) $(cvarsmt) $(AUXCFLAGS) $(intcflags) $(cdefines) $(cincdirs) $(cwarn) + !else # STATICRUNTIME C2OBJ_C = $(CC) $(cdebug) $(cflags) $(cvarsmt) $(AUXCFLAGS) $(intcflags) $(cdefines) $(cincdirs) $(cwarn) @@ -574,6 +576,7 @@ DLLPREP_MERGE=\ # LIBASN1 =$(LIBDIR)\libasn1.lib +LIBASN1_S =$(LIBDIR)\libasn1_s.lib LIBCOMERR =$(LIBDIR)\libcom_err.lib LIBEDITLINE =$(LIBDIR)\libeditline.lib LIBGSSAPI =$(LIBDIR)\libgssapi.lib