Hi all, The following details just what I had to patch, and/or otherwise work around, in order to build GPG and its supporting libraries, based on the release versions supplied by the GnuPG website. The build system was a Power Mac G5 running Mac OS 10.5.8, and the compiler was Apple’s version of GCC 4.2.1 (mainly because it supports “universal”, i.e. multi‐platform, builds without having to repeat the compilation for each target). In the same order as the various packages are listed on GnuPG’s website,
1) GnuPG: In addition to arranging updated versions of assorted support software (such as cURL, OpenSSH, and ld), I had to write the following patch: --- old/g10/gpg.h 2023-04-04 01:28:39.000000000 -0700 +++ new/g10/gpg.h 2024-10-04 09:55:48.000000000 -0700 @@ -68,9 +68,6 @@ struct dirmngr_local_s; typedef struct dirmngr_local_s *dirmngr_local_t; -/* Object used to describe a keyblock node. */ -typedef struct kbnode_struct *KBNODE; /* Deprecated use kbnode_t. */typedef struct kbnode_struct *kbnode_t; - /* The handle for keydb operations. */ typedef struct keydb_handle_s *KEYDB_HANDLE; --- old/g10/keydb.h 2024-03-07 05:17:49 -0800 +++ new/g10/keydb.h 2024-10-04 12:43:11 -0700 @@ -24,6 +24,7 @@ #include "../common/types.h" #include "../common/util.h" +#include "keyring.h" #include "packet.h" /* What qualifies as a certification (key-signature in contrast to a --- old/g10/keydb-private.h 2023-04-04 01:28:39 -0700 +++ new/g10/keydb-private.h 2024-10-04 09:55:38 -0700 @@ -23,13 +23,9 @@ #include <assuan.h> #include "../common/membuf.h" - - -/* Ugly forward declarations. */ -struct keyring_handle; -typedef struct keyring_handle *KEYRING_HANDLE; -struct keybox_handle; -typedef struct keybox_handle *KEYBOX_HANDLE; +#include "gpg.h" +#include "keyring.h" +#include "../kbx/keybox.h" /* This is for keydb.c and only used in non-keyboxd mode. */ --- old/g10/keyring.h 2023-04-04 01:28:39 -0700 +++ new/g10/keyring.h 2024-10-04 11:06:21 -0700 @@ -22,6 +22,10 @@ #include "../common/userids.h" +/* Object used to describe a keyblock node. */ +typedef struct kbnode_struct *KBNODE; /* Deprecated use kbnode_t. */ +typedef struct kbnode_struct *kbnode_t; + typedef struct keyring_handle *KEYRING_HANDLE; int keyring_register_filename (const char *fname, int read_only, void **ptr); --- old/g10/packet.h 2023-04-04 01:28:39 -0700 +++ new/g10/packet.h 2024-10-04 12:47:37 -0700 @@ -30,6 +30,7 @@ #include "../common/openpgpdefs.h" #include "../common/userids.h" #include "../common/util.h" +#include "keyring.h" #define DEBUG_PARSE_PACKET 1 --- old/g13/Makefile.in 2024-03-07 05:45:52 -0800 +++ new/g13/Makefile.in 2024-10-04 12:54:33 -0700 @@ -530,7 +530,7 @@ $(LIBASSUAN_LIBS) $(GPG_ERROR_LIBS) $(LIBICONV) t_g13tuple_SOURCES = t-g13tuple.c g13tuple.c -t_g13tuple_LDADD = $(t_common_ldadd) +t_g13tuple_LDADD = $(t_common_ldadd) $(LIBINTL) all: all-am .SUFFIXES: --- old/kbx/keybox.h 2023-05-30 04:44:45 -0700 +++ new/kbx/keybox.h 2024-10-04 00:27:09 -0700 @@ -28,6 +28,7 @@ #include "../common/iobuf.h" #include "keybox-search-desc.h" +#include "../g10/keyring.h" #ifdef KEYBOX_WITH_X509 # include <ksba.h> Notice that most elements of this patch involve swapping around the inclusion of a specific header file and/or the declaration of a specific data type. The only exception is the bit for the G13 Makefile, which adds libintl to a list of linker flags. 2) Libgpg-error: I had to write the following patch for src/spawn-posix.c, to account for Darwin’s very indirect manner of accessing the environment. Some elements of it will need to be adjusted for general use; for example, I have no idea how to appropriately conditionalize the header‐file inclusion in the first chunk. --- old/src/spawn-posix.c 2024-06-19 00:33:41 -0700 +++ new/src/spawn-posix.c 2024-10-02 18:34:07 -0700 @@ -36,6 +36,7 @@ # include <signal.h> #endif #include <unistd.h> +#include <crt_externs.h> #include <fcntl.h> #include <sys/socket.h> @@ -318,6 +319,7 @@ my_exec (const char *pgmname, const char *argv[], gpgrt_spawn_actions_t act) { int i; + char **envp; /* Assign /dev/null to unused FDs. */ for (i = 0; i <= 2; i++) @@ -342,7 +344,9 @@ _gpgrt_close_all_fds (3, act->except_fds); if (act->environ) - environ = act->environ; + envp = act->environ; + else + envp = _NSGetEnviron; if (act->atfork) act->atfork (act->atfork_arg); @@ -351,7 +355,7 @@ if (pgmname == NULL) return 0; - execv (pgmname, (char *const *)argv); + execve (pgmname, (char *const *)argv, (char *const *)envp); /* No way to print anything, as we have may have closed all streams. */ _exit (127); return -1; 3) Libgcrypt: This actually needed no patching at all for my system, but if you try to build it on the slightly older Mac OS 10.4, you need to conditionalize the inclusion of Availablity.h (which apparently only existed as of Mac OS 10.5). The patch below – not written by me – makes this change. --- old/random/rndoldlinux.c 2023-11-28 18:04:36 +0000 +++ new/random/rndoldlinux.c 2023-11-28 18:05:45 +0000 @@ -29,7 +29,11 @@ #include <fcntl.h> #include <poll.h> #if defined(__APPLE__) && defined(__MACH__) +#ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ +#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050 #include <Availability.h> +#endif +#endif #ifdef __MAC_10_11 #include <TargetConditionals.h> #if !defined(TARGET_OS_IPHONE) || TARGET_OS_IPHONE == 0 4) Libksba: This is the only element of the entire system that seems to work entirely unmodified. 5) Libassuan: This actually does not build correctly no matter what I do, and I have no idea why. It SEEMS to, but the `make check` step reveals that two of the four tests fail outright, whining about an invalid argument to assuan_sendfd(). Here: [...] fdpassing[22515]: assuan_sendfd failed: Invalid argument FAIL: fdpassing fdpassing[22549]: assuan_sendfd failed: Invalid argument FAIL: fdpassing-socket.sh I can still _install_ it just fine, but this shows that the utility of so doing is rather limited. 6) ntbTLS: This seems to work correctly, but the `make check` step doesn’t actually do anything, so it’s hard to really tell. 7) nPth: I had to make some fairly extensive, if minor, changes to make this work, due mainly to the age of my system. They are collected in this patch: --- old/src/npth.c 2024-02-05 03:09:26 -0800 +++ new/src/npth.c 2024-10-31 11:18:20 -0700 @@ -63,7 +63,41 @@ return 0; } #else -# include <semaphore.h> +# ifdef __MAC_10_0 /* i.e., if we’re on a Mac at all */ + /* As noted above, Mac OS only partially implements POSIX semaphores + – but Grand Central Dispatch only exists from Mac OS 10.6 onward. + This glue is for older versions of Mac OS. (Only tested on 10.5.) + */ +# include <CoreServices/CoreServices.h> +# include <CarbonCore/Multiprocessing.h> + typedef MPSemaphoreID sem_t; + + static int + sem_init (sem_t *sem, int is_shared, unsigned int value) + { + (void)is_shared; + if (MPCreateSemaphore ((MPSemaphoreCount)UINT_MAX, (MPSemaphoreCount)value, sem) == noErr) + return 0; + else + return -1; + } + + static int + sem_post (sem_t *sem) + { + MPSignalSemaphore (*sem); + return 0; + } + + static int + sem_wait (sem_t *sem) + { + MPWaitOnSemaphore (*sem, kDurationForever); + return 0; + } +# else +# include <semaphore.h> +# endif #endif #ifdef HAVE_UNISTD_H # include <unistd.h> I also had to add a couple of `-F` flags to the compiler command line to tell it what system frameworks to include: -F/System/Library/Frameworks/CoreServices -F/System/Library/Frameworks/CoreServices.framework/Frameworks It’s likely that a more concise way of putting that exists, but this worked. 8) Pinentry: As with ntbTLS, this _looks_ OK, but since the `make check` step doesn’t do anything, you can’t really tell. The configuration step also appears to have missed the presence of X11 in the system, but it’s unclear whether that would actually affect anything in the absence of GTK et sim. 9) GPGME: I can’t get this to build the Python 3 bindings, because it uses setup.py – which has been deprecated to the point of unuseability. Even if that part WAS doing what it is meant to do, it looks like it still wouldn’t work; the Make script which cycles through the list of Pythons that were located fails to properly switch between them, so that it builds a working directory for each version but only actually compiles anything into the first one. (It’s hard to tell, but that might be SWIG’s fault. I don’t understand the process well enough to diagnose it properly; there’s a lot of black magic going on while setup.py is executing, assuming of course that you’re running a Python obsolete enough it _will_ deign to execute. I can state authoratively that under Python 3.10 it refuses to, and rather loudly at that.) In addition to those woes, `make check` fails outright in a number of respects. The stage that tests GPGSM fails 7 out of 9 tests, for reasons I cannot make sense of, and the Python bindings don’t test correctly because it’s looking in the wrong place for some of the files under Python 2.7, and as aforementioned, nothing gets built in the first place under Python 3.10. If you work around that by copying the Python 2.7 extension into the Python 3.10 directory, it still fails to test properly; it tries to load `gpg.py` but doesn’t find it. Unsurprisingly, `make install` fails due to the Python bindings not being as expected, and also of course due to `setup.py` being called directly which Python 3.10 refuses to tolerate. I hope this all is at least vaguely useful to soemone. Sincerely, Gordon Steemson -- The world’s only gsteemso _______________________________________________ Gnupg-devel mailing list Gnupg-devel@gnupg.org https://lists.gnupg.org/mailman/listinfo/gnupg-devel