Skip to content

Instantly share code, notes, and snippets.

@jeroen
Last active August 29, 2015 14:26
Show Gist options
  • Save jeroen/5b380fbed8d93187d8b5 to your computer and use it in GitHub Desktop.
Save jeroen/5b380fbed8d93187d8b5 to your computer and use it in GitHub Desktop.
Patch for mignw-w64-gpgme
--- w32-util.c 2015-08-05 14:36:14.302473400 +0200
+++ w32-util-fix.c 2015-08-05 14:34:49.600519000 +0200
@@ -454,6 +454,22 @@
}
}
}
+
+ /* On Windows x64 also check in C:\Program Files (x86)\ */
+ if (!result && SHGetSpecialFolderPathA (NULL, path, CSIDL_PROGRAM_FILESX86, 0 ))
+ {
+ result = malloc (strlen (path) + 1 + strlen (name) + 1);
+ if (result)
+ {
+ strcpy (stpcpy (stpcpy (result, path), "\\"), name);
+ if (access (result, F_OK))
+ {
+ free (result);
+ result = NULL;
+ }
+ }
+ }
+
return result;
}
@@ -509,7 +525,7 @@
default_gpg_name ? get_basename (default_gpg_name) : "gpg.exe");
if (!gpg)
{
-#ifndef __MINGW32__
+#if defined(__MINGW32__) || defined(__MINGW64__)
name = (default_gpg_name ? default_gpg_name
/* */ : "GNU\\GnuPG\\gpg.exe");
gpg = find_program_at_standard_place (name);
@@ -537,7 +553,7 @@
default_gpgconf_name ? get_basename (default_gpgconf_name) : "gpgconf.exe" );
if (!gpgconf)
{
-#ifndef __MINGW32__
+#if defined(__MINGW32__) || defined(__MINGW64__)
name = (default_gpgconf_name ? default_gpgconf_name
/* */ : "GNU\\GnuPG\\gpgconf.exe");
gpgconf = find_program_at_standard_place (name);
@@ -560,7 +576,7 @@
LOCK (get_path_lock);
if (!w32spawn_program)
w32spawn_program = find_program_in_inst_dir (inst_dir,"gpgme-w32spawn.exe") ;
-#ifndef __MINGW32__
+#if defined(__MINGW32__) || defined(__MINGW64__)
if (!w32spawn_program)
w32spawn_program
= find_program_at_standard_place ("GNU\\GnuPG\\gpgme-w32spawn.exe");
@mingwandroid
Copy link

64-bit MinGW-w64 GCC defines __MINGW32__ already so that change isn't relevant and should therefore not be done (minimum change/patch-size principle). To see the predefined flags you can use:

echo "" | gcc -E -dM -

I explicitly won't merge fixes for searching outside of MSYS2. GPGME upstream may be interested in your patch for that though.

If you do the PATH search that would be fine though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment