Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: A build in libasn1 always creates new header files



On Tue, Jul 22, 2008 at 06:11:38PM +0200, Bernd Ernesti wrote:
> On Tue, Jul 22, 2008 at 09:06:55AM +1000, Luke Mewburn wrote:
> > On Mon, Jul 21, 2008 at 11:24:12PM +0200, Bernd Ernesti wrote:
> [..]
> 
> >   | I opened a pr for this problem: lib/39185
> >   | 
> >   | See this pr and the older related one lib/9702 for more information
> >   | what is going on and how Simon Burge fixed the problem 8 years ago.
> >   | 
> >   | Do we want to bring the local modifications back?
> > 
> > Seems reasonable to me.  Do you want to do it?
> 
> I can see if I find the time to do it, but wouldn't mind if someone else
> does it before me.

Attached is a patch which works for me.
I will apply it if there are no objections for it in the next 4 days.

While I was working on that patch I noticed something strange with
src/lib/libhx509/Makefile:

BUILT_SOURCES doesn't include gen_files_crmf and so all that code is
not part of libhx509. I tried to add '${gen_files_crmf:.x=.c}' to
BUILT_SOURCES, but that caused some build errors:

    compile  libhx509/asn1_CRMFRDNSequence.o
In file included from asn1_CRMFRDNSequence.c:11:
./crmf_asn1.h:121: error: expected specifier-qualifier-list before 
'POPOSigningKeyInput'
*** Error code 1

Bernd

Index: libasn1/Makefile
===================================================================
RCS file: /cvsroot/src/lib/libasn1/Makefile,v
retrieving revision 1.31
diff -b -u -r1.31 Makefile
--- libasn1/Makefile    21 Apr 2008 21:30:59 -0000      1.31
+++ libasn1/Makefile    27 Jul 2008 13:03:45 -0000
@@ -27,7 +27,18 @@
        @cd ${.CURDIR}/asn1_compile && ${MAKE}
 .endif
 
-DPSRCS+=       asn1_err.h
+DPSRCS += \
+       krb5_asn1.h \
+       cms_asn1.h \
+       rfc2459_asn1.h \
+       pkinit_asn1.h \
+       pkcs12_asn1.h \
+       pkcs8_asn1.h \
+       pkcs9_asn1.h \
+       digest_asn1.h \
+       kx509_asn1.h \
+       asn1_err.h
+
 CLEANFILES+=   asn1_err.h
 
 asn1_err.h asn1_err.c: asn1_err.et ${TOOL_COMPILE_ET}
@@ -480,15 +491,15 @@
 CPPFLAGS+=-DHAVE_IPV6
 .endif
 
-${gen_files_k5} krb5_asn1.h: krb5_asn1_files
-${gen_files_cms} cms_asn1.h: cms_asn1_files
-${gen_files_rfc2459} rfc2459_asn1.h: rfc2459_asn1_files
-${gen_files_pkinit} pkinit_asn1.h: pkinit_asn1_files
-${gen_files_pkcs12} pkcs12_asn1.h: pkcs12_asn1_files
-${gen_files_pkcs8} pkcs8_asn1.h: pkcs8_asn1_files
-${gen_files_pkcs9} pkcs9_asn1.h: pkcs9_asn1_files
-${gen_files_digest} digest_asn1.h: digest_asn1_files
-${gen_files_kx509} kx509_asn1.h: kx509_asn1_files
+${gen_files_k5} krb5_asn1.hx: krb5_asn1_files
+${gen_files_cms} cms_asn1.hx: cms_asn1_files
+${gen_files_rfc2459} rfc2459_asn1.hx: rfc2459_asn1_files
+${gen_files_pkinit} pkinit_asn1.hx: pkinit_asn1_files
+${gen_files_pkcs12} pkcs12_asn1.hx: pkcs12_asn1_files
+${gen_files_pkcs8} pkcs8_asn1.hx: pkcs8_asn1_files
+${gen_files_pkcs9} pkcs9_asn1.hx: pkcs9_asn1_files
+${gen_files_digest} digest_asn1.hx: digest_asn1_files
+${gen_files_kx509} kx509_asn1.hx: kx509_asn1_files
 
 krb5_asn1_files: k5.asn1 ${TOOL_ASN1_COMPILE}
        ${TOOL_ASN1_COMPILE} \
@@ -523,32 +534,20 @@
 kx509_asn1_files: kx509.asn1 ${TOOL_ASN1_COMPILE}
        ${TOOL_ASN1_COMPILE} ${DIST}/heimdal/lib/asn1/kx509.asn1 kx509_asn1
 
-${SRCS}: \
-       krb5_asn1.h \
-       cms_asn1.h \
-       rfc2459_asn1.h \
-       pkinit_asn1.h \
-       pkcs12_asn1.h \
-       pkcs8_asn1.h \
-       pkcs9_asn1.h \
-       digest_asn1.h \
-       kx509_asn1.h
-       
-
 CLEANFILES=    ${BUILT_SOURCES} ${gen_files_k5} \
        ${gen_files_cms} ${gen_files_rfc2459} \
        ${gen_files_pkinit} ${gen_files_pkcs12} \
        ${gen_files_pkcs8} ${gen_files_pkcs9} \
        ${gen_files_digest} ${gen_files_kx509} \
-       krb5_asn1_files krb5_asn1.h \
-       cms_asn1_files cms_asn1.h \
-       rfc2459_asn1_files rfc2459_asn1.h \
-       pkinit_asn1_files pkinit_asn1.h \
-       pkcs12_asn1_files pkcs12_asn1.h \
-       pkcs8_asn1_files pkcs8_asn1.h \
-       pkcs9_asn1_files pkcs9_asn1.h \
-       digest_asn1_files digest_asn1.h \
-       kx509_asn1_files kx509_asn1.h
+       krb5_asn1_files krb5_asn1.h krb5_asn1.hx \
+       cms_asn1_files cms_asn1.h cms_asn1.hx \
+       rfc2459_asn1_files rfc2459_asn1.h rfc2459_asn1.hx \
+       pkinit_asn1_files pkinit_asn1.h pkinit_asn1.hx \
+       pkcs12_asn1_files pkcs12_asn1.h pkcs12_asn1.hx \
+       pkcs8_asn1_files pkcs8_asn1.h pkcs8_asn1.hx \
+       pkcs9_asn1_files pkcs9_asn1.h pkcs9_asn1.hx \
+       digest_asn1_files digest_asn1.h digest_asn1.hx \
+       kx509_asn1_files kx509_asn1.h kx509_asn1.hx
 
 .if ${USETOOLS} != "yes"
 SUBDIR=        asn1_compile
@@ -559,7 +558,10 @@
 .include <bsd.subdir.mk>
 .endif
 
-.SUFFIXES: .x
+.SUFFIXES: .hx .x
+
+.hx.h:
+       @cmp -s $< $@ 2> /dev/null || cp $< $@
 
 .x.c:
        @cmp -s $< $@ 2> /dev/null || cp $< $@
Index: libgssapi/Makefile
===================================================================
RCS file: /cvsroot/src/lib/libgssapi/Makefile,v
retrieving revision 1.19
diff -b -u -r1.19 Makefile
--- libgssapi/Makefile  29 Mar 2008 17:51:42 -0000      1.19
+++ libgssapi/Makefile  27 Jul 2008 13:03:46 -0000
@@ -47,7 +47,7 @@
        asn1_NegTokenInitWin.x          \
        asn1_NegTokenResp.x
 
-DPSRCS=         gkrb5_err.h
+DPSRCS=         spnego_asn1.h gssapi_asn1.h gkrb5_err.h
 
 BUILT_SOURCES= \
        ${gssapi_files:.x=.c}           \
@@ -261,13 +261,15 @@
 INCSDIR=       /usr/include
 
 CLEANFILES+= ${BUILT_SOURCES} \
-               ${spnego_files} spnego_asn1_files spnego_asn1.h \
-               ${gssapi_files} gssapi_asn1_files gssapi_asn1.h \
+               ${spnego_files} spnego_asn1_files \
+               spnego_asn1.h spnego_asn1.hx \
+               ${gssapi_files} gssapi_asn1_files \
+               gssapi_asn1.h gssapi_asn1.hx \
                gkrb5_err.h  \
                ${krb5src} ${mechsrc} ${spnegosrc} ${ntlmsrc}
 
-${spnego_files} spnego_asn1.h: spnego_asn1_files
-${gssapi_files} gssapi_asn1.h: gssapi_asn1_files
+${spnego_files} spnego_asn1.hx: spnego_asn1_files
+${gssapi_files} gssapi_asn1.hx: gssapi_asn1_files
 
 spnego_asn1_files: spnego/spnego.asn1 ${TOOL_ASN1_COMPILE}
        ${TOOL_ASN1_COMPILE} \
@@ -305,7 +307,10 @@
 
 .include <bsd.lib.mk>
 
-.SUFFIXES: .x
+.SUFFIXES: .hx .x
+
+.hx.h:
+       @cmp -s $< $@ 2> /dev/null || cp $< $@
 
 .x.c:       
        @cmp -s $< $@ 2> /dev/null || cp $< $@
Index: libhdb/Makefile
===================================================================
RCS file: /cvsroot/src/lib/libhdb/Makefile,v
retrieving revision 1.22
diff -b -u -r1.22 Makefile
--- libhdb/Makefile     22 Mar 2008 08:37:26 -0000      1.22
+++ libhdb/Makefile     27 Jul 2008 13:03:46 -0000
@@ -98,16 +98,19 @@
 .endfor
 .endif
 
-${gen_files} hdb_asn1.h: hdb_asn1_files
+${gen_files} hdb_asn1.hx: hdb_asn1_files
 
-${SRCS:.c=.o}: hdb_err.h hdb_asn1.h
+#${SRCS:.c=.o}: hdb_err.h hdb_asn1.h
 
 CLEANFILES=    ${gen_files} ${BUILT_SOURCES} \
-               hdb_asn1.h hdb_asn1_files hdb_err.h
+               hdb_asn1.h hdb_asn1.hx hdb_asn1_files hdb_err.h
 
 .include <bsd.lib.mk>
 
-.SUFFIXES: .x
+.SUFFIXES: .hx .x
+
+.hx.h:
+       @cmp -s $< $@ 2> /dev/null || cp $< $@
 
 .x.c:
        @cmp -s $< $@ 2> /dev/null || cp $< $@
Index: libhx509/Makefile
===================================================================
RCS file: /cvsroot/src/lib/libhx509/Makefile,v
retrieving revision 1.2
diff -b -u -r1.2 Makefile
--- libhx509/Makefile   13 Apr 2008 21:25:14 -0000      1.2
+++ libhx509/Makefile   27 Jul 2008 13:03:46 -0000
@@ -146,22 +146,23 @@
 .endfor
 .endif
 
-${gen_files_ocsp} ocsp_asn1.h: ocsp_asn1_files
-${gen_files_pkcs10} pkcs10_asn1.h: pkcs10_asn1_files
-${gen_files_crmf} crmf_asn1.h: crmf_asn1_files
-
-${SRCS}: ocsp_asn1.h pkcs10_asn1.h crmf_asn1.h hx509_err.h
+${gen_files_ocsp} ocsp_asn1.hx: ocsp_asn1_files
+${gen_files_pkcs10} pkcs10_asn1.hx: pkcs10_asn1_files
+${gen_files_crmf} crmf_asn1.hx: crmf_asn1_files
 
 CLEANFILES=    ${gen_files_ocsp} ${gen_files_pkcs10} ${gen_files_crmf} \
                ${BUILT_SOURCES} \
-               ocsp_asn1_files ocsp_asn1.h \
-               pkcs10_asn1_files pkcs10_asn1.h \
-               crmf_asn1_files crmf_asn1.h \
+               ocsp_asn1_files ocsp_asn1.h ocsp_asn1.hx \
+               pkcs10_asn1_files pkcs10_asn1.h pkcs10_asn1.hx \
+               crmf_asn1_files crmf_asn1.h crmf_asn1.hx \
                hx509_err.h
 
 .include <bsd.lib.mk>
 
-.SUFFIXES: .x
+.SUFFIXES: .hx .x
+
+.hx.h:
+       @cmp -s $< $@ 2> /dev/null || cp $< $@
 
 .x.c:
        @cmp -s $< $@ 2> /dev/null || cp $< $@
Index: gen.c
===================================================================
RCS file: /cvsroot/src/crypto/dist/heimdal/lib/asn1/gen.c,v
retrieving revision 1.9
diff -b -u -r1.9 gen.c
--- gen.c       22 Mar 2008 08:37:04 -0000      1.9
+++ gen.c       27 Jul 2008 13:24:40 -0000
@@ -84,7 +84,7 @@
        if (headerbase == NULL)
            errx(1, "strdup");
     }
-    asprintf(&header, "%s.h", headerbase);
+    asprintf(&header, "%s.hx", headerbase);
     if (header == NULL)
        errx(1, "malloc");
     headerfile = fopen (header, "w");
Index: HACKS
===================================================================
RCS file: /cvsroot/src/doc/HACKS,v
retrieving revision 1.105
diff -b -u -r1.105 HACKS
--- HACKS       21 Jul 2008 10:00:51 -0000      1.105
+++ HACKS       27 Jul 2008 13:24:46 -0000
@@ -293,6 +293,21 @@
        workaround not to call mdsetimage with the -v argument on Darwin
 kcah
 
+hack   avoid rebuilding asn1 libraries
+mdate  27 July 2008
+who    veego
+file   src/crypto/dist/heimdal/lib/asn1/gen.c  : 1.10
+file   src/lib/libasn1/Makefile        : 1.30
+file   src/lib/libhdb/Makefile : 1.23
+file   src/lib/libgssapi/Makefile      : 1.20
+file   src/lib/libhx509/Makefile       : 1.3
+pr     9702 39185
+descr
+       asn1_compile does not check if generated header files do not have to
+       be rebuilld.
+       Generate .hx files and copy it in the Makefiles if they changed.
+kcah
+
 port   vax
 
        hack    gcc4/vax ICE


Home | Main Index | Thread Index | Old Index