1
0
Fork 0
forked from len0rd/rockbox

Make simulator compile on MacOS

Tested on MacOS Sequoia (Apple Silicon) with the
latest Xcode command line tools, gcc 14
(Homebrew GCC 14.2.0_1) and sdl2 (Homebrew 2.30.9)

Make sure 'gcc' (and 'gcc-ar') is in your PATH
ahead of the Xcode-provided "gcc"(clang). E.g.
by setting up symlinks in /usr/local/bin that
point to gcc-14 and gcc-ar-14.

Notes:
- The appropriate bmp from uisimulator/bitmaps
  has to be manually copied to your build folder
  and renamed to UI256.bmp, if you want the sim
  background to be displayed

Change-Id: I559f33d2165065f913f30c016b85906af380fb81
This commit is contained in:
Christian Soffke 2023-08-12 17:27:43 +02:00 committed by Solomon Peachy
parent f9ae6d6524
commit 1745b74576
13 changed files with 75 additions and 8 deletions

View file

@ -19,7 +19,12 @@
*
****************************************************************************/
#define RB_FILESYSTEM_OS
#ifdef __APPLE__
#include <sys/param.h>
#include <sys/mount.h>
#else
#include <sys/statfs.h> /* lowest common denominator */
#endif
#include <sys/stat.h>
#include <string.h>
#include <errno.h>
@ -218,6 +223,15 @@ void volume_size(IF_MV(int volume,) sector_t *sizep, sector_t *freep)
if (os_volume_path(IF_MV(volume,) volpath, sizeof (volpath)) >= 0
&& !statfs(volpath, &fs))
{
#ifdef __APPLE__
DEBUGF("statvfs: frsize=%d blocks=%ld bfree=%ld\n",
(int)fs.f_bsize, (long)fs.f_blocks, (long)fs.f_bfree);
if (sizep)
size = (fs.f_blocks / 2) * (fs.f_bsize / 512);
if (freep)
free = (fs.f_bfree / 2) * (fs.f_bsize / 512);
#else
DEBUGF("statvfs: frsize=%d blocks=%ld bfree=%ld\n",
(int)fs.f_frsize, (long)fs.f_blocks, (long)fs.f_bfree);
if (sizep)
@ -225,6 +239,7 @@ void volume_size(IF_MV(int volume,) sector_t *sizep, sector_t *freep)
if (freep)
free = (fs.f_bfree / 2) * (fs.f_frsize / 512);
#endif
}
if (sizep)