From e6bf3581ea89e175d8aa4dfd3f1ddc8abaf61962 Mon Sep 17 00:00:00 2001
From: Vladimir Stoiakin <VStoiakin@lavabit.com>
Date: Mon, 17 Mar 2025 11:18:59 +0300
Subject: [PATCH] build: detect endianess of a system dynamically

---
 buffyboard/lv_conf.h | 3 ---
 meson.build          | 1 +
 unl0kr/lv_conf.h     | 3 ---
 3 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/buffyboard/lv_conf.h b/buffyboard/lv_conf.h
index 23acdb9..f711ded 100644
--- a/buffyboard/lv_conf.h
+++ b/buffyboard/lv_conf.h
@@ -313,9 +313,6 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
  *  COMPILER SETTINGS
  *====================*/
 
-/*For big endian systems set to 1*/
-#define LV_BIG_ENDIAN_SYSTEM    0
-
 /*Define a custom attribute to `lv_tick_inc` function*/
 #define LV_ATTRIBUTE_TICK_INC
 
diff --git a/meson.build b/meson.build
index 042ab15..24737f9 100644
--- a/meson.build
+++ b/meson.build
@@ -5,6 +5,7 @@ project('buffybox', 'c',
 )
 
 add_project_arguments('-DPROJECT_VERSION="@0@"'.format(meson.project_version()), language: 'c')
+add_project_arguments('-DLV_BIG_ENDIAN_SYSTEM=' + (host_machine.endian() == 'big'? '1' : '0'), language: 'c')
 
 depinih      = dependency('inih')
 deplibinput  = dependency('libinput')
diff --git a/unl0kr/lv_conf.h b/unl0kr/lv_conf.h
index d2597e2..de6a8e2 100644
--- a/unl0kr/lv_conf.h
+++ b/unl0kr/lv_conf.h
@@ -207,9 +207,6 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
  *  COMPILER SETTINGS
  *====================*/
 
-/*For big endian systems set to 1*/
-#define LV_BIG_ENDIAN_SYSTEM    0
-
 /*Define a custom attribute to `lv_tick_inc` function*/
 #define LV_ATTRIBUTE_TICK_INC
 
-- 
GitLab