--- ./CMakeLists.txt_orig	2020-01-19 05:00:17 +0000
+++ ./CMakeLists.txt	2020-01-19 06:09:40 +0000
@@ -224,7 +224,7 @@
   ENDIF (RPM5)
 
   # check if rpm contains a bundled berkeley db
-  CHECK_INCLUDE_FILE(rpm/db.h HAVE_RPM_DB_H)
+  CHECK_INCLUDE_FILE(rpm/rpmdb.h HAVE_RPM_DB_H)
   IF (NOT ENABLE_RPMDB_LIBRPM)
     IF (NOT HAVE_RPM_DB_H)
       FIND_LIBRARY (DB_LIBRARY NAMES db)
@@ -240,6 +240,8 @@
   CHECK_LIBRARY_EXISTS(rpmio pgpDigGetParams "" HAVE_PGPDIGGETPARAMS)
 ENDIF (ENABLE_RPMDB OR ENABLE_RPMPKG_LIBRPM)
 
+SET(RPMDB_LIBRARY /usr/opt/rpm/lib/librpmio.so /usr/opt/rpm/lib/librpm.so)
+
 IF (ENABLE_PUBKEY)
   SET (ENABLE_PGPVRFY ON)
 ENDIF (ENABLE_PUBKEY)
--- ./ext/repo_autopattern.c_orig	2020-01-19 06:09:54 +0000
+++ ./ext/repo_autopattern.c	2020-01-19 06:10:25 +0000
@@ -79,7 +79,7 @@
       if (!p || *p) 
         return 0;
     }   
-  return timegm(&tm);
+  return mktime(&tm);
 }
 
 /* we just look at the repodata keys and do not iterate
--- ./ext/repo_updateinfoxml.c_orig	2020-01-19 06:10:57 +0000
+++ ./ext/repo_updateinfoxml.c	2020-01-19 06:11:11 +0000
@@ -134,7 +134,7 @@
   memset(&tm, 0, sizeof(tm));
   if (!strptime(date, "%F%T", &tm))
     return 0;
-  return timegm(&tm);
+  return mktime(&tm);
 }
 
 /*
--- ./src/poolvendor.c_orig	2020-01-19 06:11:22 +0000
+++ ./src/poolvendor.c	2020-01-19 06:11:58 +0000
@@ -65,7 +65,7 @@
 	    break;	/* sorry, out of bits */
 	  m <<= 1;	/* next vendor equivalence class */
 	}
-      if (fnmatch(*vs == '!' ? vs + 1 : vs, vstr, FNM_CASEFOLD) == 0)
+      if (fnmatch(*vs == '!' ? vs + 1 : vs, vstr, 0) == 0)
 	{
 	  if (*vs != '!')
 	    mask |= m;
--- ./src/repodata.c_orig	2020-01-19 06:12:03 +0000
+++ ./src/repodata.c	2020-01-19 06:14:45 +0000
@@ -40,8 +40,23 @@
 
 #define REPODATA_BLOCK 255
 
+
 static unsigned char *data_skip_key(Repodata *data, unsigned char *dp, Repokey *key);
 
+#ifndef HAVE_STRCASESTR
+const char *strcasestr(const char *a, const char *b)
+{
+   size_t l;
+   char f[3];
+
+   snprintf(f, sizeof(f), "%c%c", tolower(*b), toupper(*b));
+   for (l = strcspn(a, f); l != strlen(a); l += strcspn(a + l + 1, f) + 1)
+       if (strncasecmp(a + l, b, strlen(b)) == 0)
+          return(a + l);
+       return(NULL);
+   }
+#endif
+
 void
 repodata_initdata(Repodata *data, Repo *repo, int localpool)
 {
@@ -1417,7 +1432,7 @@
       else
 	return !strcmp(ma->match, str + l);
     case SEARCH_GLOB:
-      return !fnmatch(ma->match, str, (ma->flags & SEARCH_NOCASE) ? FNM_CASEFOLD : 0);
+      return !fnmatch(ma->match, str, (ma->flags & SEARCH_NOCASE) ? 0 : 0);
     case SEARCH_REGEX:
       return !regexec((const regex_t *)ma->matchdata, str, 0, NULL, 0);
     default:
--- ./src/selection.c_orig	2020-01-19 06:12:36 +0000
+++ ./src/selection.c	2020-01-19 06:13:55 +0000
@@ -501,7 +501,7 @@
 
   nocase = flags & SELECTION_NOCASE;
   doglob = (flags & SELECTION_GLOB) != 0 && strpbrk(name, "[*?") != 0;
-  globflags = doglob && nocase ? FNM_CASEFOLD : 0;
+  globflags = doglob && nocase ? 0 : 0;
 
   FOR_POOL_SOLVABLES(p)
     {
@@ -624,7 +624,7 @@
 
   /* looks like a glob or nocase match. really hard work. */
   match = 0;
-  globflags = doglob && nocase ? FNM_CASEFOLD : 0;
+  globflags = doglob && nocase ? 0 : 0;
   for (id = 1; id < pool->ss.nstrings; id++)
     {
       /* do we habe packages providing this id? */
@@ -781,7 +781,7 @@
 
   /* do a name match over all packages. hard work. */
   match = 0;
-  globflags = doglob && nocase ? FNM_CASEFOLD : 0;
+  globflags = doglob && nocase ? 0 : 0;
   FOR_POOL_SOLVABLES(p)
     {
       Solvable *s = pool->solvables + p;
@@ -1402,7 +1402,7 @@
     return 0;
   if (flags & SELECTION_GLOB)
     {
-      int globflags = (flags & SELECTION_NOCASE) != 0 ? FNM_CASEFOLD : 0;
+      int globflags = (flags & SELECTION_NOCASE) != 0 ? 0 : 0;
       return fnmatch(pattern, string, globflags) == 0 ? 1 : 0;
     }
   if (flags & SELECTION_NOCASE)
--- ./ext/solv_xfopen.c_orig	2020-01-19 06:14:51 +0000
+++ ./ext/solv_xfopen.c	2020-01-19 06:16:17 +0000
@@ -48,7 +48,7 @@
   cio.close = cclose;
   return  fopencookie(cookie, *mode == 'w' ? "w" : "r", cio);
 #else
-# error Need to implement custom I/O
+/* # error Need to implement custom I/O */
 #endif
 }
 
--- ./ext/repo_products.c_orig	2020-01-19 10:02:13 +0000
+++ ./ext/repo_products.c	2020-01-19 10:02:24 +0000
@@ -141,7 +141,7 @@
       if (!p || *p)
 	return 0;
     }
-  return timegm(&tm);
+  return mktime(&tm);
 }
 
 static void
