--- ./librepo/checksum.c_orig	2024-12-06 07:52:09.284335298 -0600
+++ ./librepo/checksum.c	2024-12-06 07:54:00.643759500 -0600
@@ -27,7 +27,11 @@
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#ifndef _AIX
 #include <sys/xattr.h>
+#else
+#include <sys/ea.h>
+#endif
 #include <unistd.h>
 #include <openssl/evp.h>
 
--- ./librepo/downloader.c_orig	2024-12-08 01:50:34.657392179 -0600
+++ ./librepo/downloader.c	2024-12-08 02:09:12.207318153 -0600
@@ -32,7 +32,11 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/time.h>
+#ifndef _AIX
 #include <sys/xattr.h>
+#else
+#include <sys/ea.h>
+#endif
 #include <fcntl.h>
 #include <curl/curl.h>
 
@@ -2272,8 +2276,13 @@
             long remote_filetime = -1;
             c_rc = curl_easy_getinfo(target->curl_handle, CURLINFO_FILETIME, &remote_filetime);
             if (c_rc == CURLE_OK && remote_filetime >= 0) {
+#ifndef _AIX
                 const struct timeval tv[] = {{remote_filetime, 0}, {remote_filetime, 0}};
                 if (futimes(fd, tv) == -1)
+#else
+		const struct timespec ts[] = {{remote_filetime, 0}, {remote_filetime, 0}};
+		if (futimens (fileno(target->f), ts) == -1)
+#endif
                     g_debug("%s: Failed to change timestamps of downloaded file \"%s\"",
                             __func__, target->target->path);
             } else {
--- ./librepo/python/metadatatarget-py.c_orig	2024-12-08 02:18:51.387816986 -0600
+++ ./librepo/python/metadatatarget-py.c	2024-12-08 02:19:19.792819800 -0600
@@ -18,7 +18,9 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#ifndef _AIX
 #include <err.h>
+#endif
 
 #include "librepo/librepo.h"
 #include "librepo/downloader_internal.h"
--- ./tests/test_checksum.c_orig	2024-12-08 02:22:53.867261105 -0600
+++ ./tests/test_checksum.c	2024-12-08 02:23:28.217278760 -0600
@@ -7,7 +7,11 @@
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#ifndef _AIX
 #include <sys/xattr.h>
+#else
+#include <sys/ea.h>
+#endif
 #include <fcntl.h>
 
 #include "librepo/util.h"
--- ./librepo/xattr_internal.h_orig	2024-12-06 08:04:15.460553041 -0600
+++ ./librepo/xattr_internal.h	2024-12-08 02:40:03.397403806 -0600
@@ -37,6 +37,19 @@
 #define GETXATTR(PATH, NAME, VALUE, SIZE)   \
             getxattr((PATH), (NAME), (VALUE), (SIZE), 0, 0)
 
+#elif defined(_AIX)
+
+#define FGETXATTR(FD, NAME, VALUE, SIZE)   \
+            fgetea((FD), (NAME), (VALUE), (SIZE))
+#define FLISTXATTR(FD, LIST, SIZE)   \
+            flistea((FD), (LIST), (SIZE))
+#define FREMOVEXATTR(FD, NAME)   \
+            fremoveea((FD), (NAME))
+#define FSETXATTR(FD, NAME, VALUE, SIZE, FLAGS)   \
+            fsetea((FD), (NAME), (VALUE), (SIZE), (FLAGS))
+#define GETXATTR(FILE, NAME, VALUE, SIZE) \
+	    getea((FILE), (NAME), (VALUE), (SIZE))
+
 #else
 
 #define FGETXATTR(FD, NAME, VALUE, SIZE)   \
