fcitx / libime

43 stars 21 forks source link

include of endian.h does not work on FreeBSD #15

Closed HenryHu closed 3 years ago

HenryHu commented 3 years ago

On linux, endian.h lives at /usr/include/endian.h. On FreeBSD, it lives at /usr/include/sys/endian.h. BSD currently needs a patch like this to compile:

diff --git a/src/libime/core/utils_p.h b/src/libime/core/utils_p.h
index 4e46c32..d3cddb3 100644
--- a/src/libime/core/utils_p.h
+++ b/src/libime/core/utils_p.h
@@ -8,7 +8,7 @@
 #define _LIBIME_LIBIME_CORE_UTILS_P_H_

 #include <cstdint>
-#include <endian.h>
+#include <sys/endian.h>
 #include <iostream>
 #include <utility>
 #include <vector>
diff --git a/tools/libime_migrate_fcitx4_table.cpp b/tools/libime_migrate_fcitx4_table.cpp
index fdd3371..fbb00d2 100644
--- a/tools/libime_migrate_fcitx4_table.cpp
+++ b/tools/libime_migrate_fcitx4_table.cpp
@@ -12,7 +12,7 @@
 #include "libime/table/tablebaseddictionary.h"
 #include <boost/iostreams/device/file_descriptor.hpp>
 #include <boost/iostreams/stream.hpp>
-#include <endian.h>
+#include <sys/endian.h>
 #include <fcitx-utils/charutils.h>
 #include <fcitx-utils/standardpath.h>
 #include <fcntl.h>

Needs a conditional statement, like these, to make it work universally.