From 7fdaa8285e640109d1120ba481c90a02c76284d0 Mon Sep 17 00:00:00 2001
From: pkubaj <pkubaj@users.noreply.github.com>
Date: Sun, 13 Oct 2019 16:43:18 +0000
Subject: [PATCH 1/2] Fix build on FreeBSD/!x86

Checking battery status uses x86-only headers and functions. Remove this functionality to get it to build on other architectures.
---
 src/cryptonote_basic/miner.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/cryptonote_basic/miner.cpp b/src/cryptonote_basic/miner.cpp
index 0188bf114..be46e011c 100644
--- a/src/cryptonote_basic/miner.cpp
+++ b/src/cryptonote_basic/miner.cpp
@@ -62,7 +62,9 @@
   #include <devstat.h>
   #include <errno.h>
   #include <fcntl.h>
+#if defined(__amd64__) || defined(__i386__)
   #include <machine/apm_bios.h>
+#endif
   #include <stdio.h>
   #include <sys/resource.h>
   #include <sys/sysctl.h>
@@ -1086,6 +1088,7 @@ namespace cryptonote
           return boost::logic::tribool(boost::logic::indeterminate);
         }
 
+#if defined(__amd64__) || defined(__i386__)
         apm_info info;
         if( ioctl(fd, APMIO_GETINFO, &info) == -1 ) {
           close(fd);
@@ -1126,6 +1129,7 @@ namespace cryptonote
         LOG_ERROR("sysctlbyname(\"hw.acpi.acline\") output is unexpectedly "
           << n << " bytes instead of the expected " << sizeof(ac) << " bytes.");
         return boost::logic::tribool(boost::logic::indeterminate);
+#endif
       }
       return boost::logic::tribool(ac == 0);
     #endif

From 0f4fddc2f8308d4bf1fd4d32ff4735d8f1a33ac3 Mon Sep 17 00:00:00 2001
From: pkubaj <pkubaj@users.noreply.github.com>
Date: Sun, 13 Oct 2019 19:08:23 +0000
Subject: [PATCH 2/2] Add also ifdef __x86_64__

---
 src/cryptonote_basic/miner.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/cryptonote_basic/miner.cpp b/src/cryptonote_basic/miner.cpp
index be46e011c..c4b5c8455 100644
--- a/src/cryptonote_basic/miner.cpp
+++ b/src/cryptonote_basic/miner.cpp
@@ -62,7 +62,7 @@
   #include <devstat.h>
   #include <errno.h>
   #include <fcntl.h>
-#if defined(__amd64__) || defined(__i386__)
+#if defined(__amd64__) || defined(__i386__) || defined(__x86_64__)
   #include <machine/apm_bios.h>
 #endif
   #include <stdio.h>
@@ -1088,7 +1088,7 @@ namespace cryptonote
           return boost::logic::tribool(boost::logic::indeterminate);
         }
 
-#if defined(__amd64__) || defined(__i386__)
+#if defined(__amd64__) || defined(__i386__) || defined(__x86_64__)
         apm_info info;
         if( ioctl(fd, APMIO_GETINFO, &info) == -1 ) {
           close(fd);