Blame src/README

Packit fc043f
Notes on the source code
Packit fc043f
========================
Packit fc043f
Packit fc043f
The mechanism to generate the system error codes is delicate and
Packit fc043f
fragile, but it's the best I could come up with that supports
Packit fc043f
cross-compilation and dynamic self-configuration.  Here is how it
Packit fc043f
works:
Packit fc043f
Packit fc043f
1. Generate list of supported system error codes.
Packit fc043f
Packit fc043f
mkerrcodes1.awk generates a list of supported system error codes from
Packit fc043f
errnos.in.  Each entry in the list is protected with #ifdef/#endif,
Packit fc043f
and contains a GPG_ERR_* marker.  The list is stored in "_mkerrcodes.h".
Packit fc043f
Packit fc043f
2. The HOST cpp is run on _mkerrcodes.h.  This evaluates the known
Packit fc043f
system error macros to something (may be a number, maybe a constant
Packit fc043f
expression as on the GNU/Hurd), suppressing the unknown ones.  The
Packit fc043f
output is piped into step 3.
Packit fc043f
Packit fc043f
3. The cpp output is filtered with grep for only those lines which
Packit fc043f
contain a GPG_ERR_* marker.  The output is piped into step 4.
Packit fc043f
Packit fc043f
4. The filtered output is processed by mkerrcodes.awk, which produces
Packit fc043f
a table of constant expressions plus GPG_ERR_* code string symbols in
Packit fc043f
a format suitable for the C program mkerrcodes.c.  At this point we
Packit fc043f
are crossing our fingers that the constant expressions produced by the
Packit fc043f
system do not contain GPG_ERR_* markers.  The output is stored in
Packit fc043f
mkerrcodes.h.
Packit fc043f
Packit fc043f
5. The file mkerrcodes.h is included by mkerrcodes.c, which is
Packit fc043f
compiled to a binary executable on the BUILD system.  At this point we
Packit fc043f
are crossing our fingers that the constant expressions produced by the
Packit fc043f
system do not depend on the build platform anymore.  The output is
Packit fc043f
post-processed by mkerrcodes2.awk and stored in "code-from-errno.h",
Packit fc043f
which is subsequently used in the library.
Packit fc043f
Packit fc043f
-- Marcus
Packit fc043f
Packit fc043f
 Copyright 2006 g10 Code GmbH
Packit fc043f
Packit fc043f
 This file is free software; as a special exception the author gives
Packit fc043f
 unlimited permission to copy and/or distribute it, with or without
Packit fc043f
 modifications, as long as this notice is preserved.
Packit fc043f
Packit fc043f
 This file is distributed in the hope that it will be useful, but
Packit fc043f
 WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
Packit fc043f
 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.