From f7484fefdecd84bb06c5add2fcc7519b18e0fe4c Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Wed, 19 Apr 2017 21:39:44 +0200 Subject: [PATCH] build: brew dropped 32-bit support sdl2, modify macOS stuff to reflect that --- Makefile | 23 +++++++++++++++-------- README.md | 9 ++++++++- emu.sh | 15 ++++++++++----- 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 692747fa3..819464fb7 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,22 @@ .PHONY: vendor -JOBS=4 -MAKE=make -j $(JOBS) +JOBS = 4 +MAKE = make -j $(JOBS) -BOARDLOADER_BUILD_DIR=micropython/boardloader/build -BOOTLOADER_BUILD_DIR=micropython/bootloader/build -FIRMWARE_BUILD_DIR=micropython/firmware/build +BOARDLOADER_BUILD_DIR = micropython/boardloader/build +BOOTLOADER_BUILD_DIR = micropython/bootloader/build +FIRMWARE_BUILD_DIR = micropython/firmware/build -TREZORHAL_PORT_OPTS=FROZEN_MPY_DIR=src DEBUG=1 -UNIX_PORT_OPTS=MICROPY_FORCE_32BIT=1 MICROPY_PY_BTREE=0 MICROPY_PY_TERMIOS=0 MICROPY_PY_FFI=0 MICROPY_PY_USSL=0 MICROPY_SSL_AXTLS=0 DEBUG=1 -CROSS_PORT_OPTS=MICROPY_FORCE_32BIT=1 +TREZORHAL_PORT_OPTS = FROZEN_MPY_DIR=src DEBUG=1 +CROSS_PORT_OPTS = MICROPY_FORCE_32BIT=1 +UNIX_PORT_OPTS = MICROPY_PY_BTREE=0 MICROPY_PY_TERMIOS=0 MICROPY_PY_FFI=0 MICROPY_PY_USSL=0 MICROPY_SSL_AXTLS=0 DEBUG=1 + +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Darwin) +UNIX_PORT_OPTS += MICROPY_FORCE_32BIT=0 +else +UNIX_PORT_OPTS += MICROPY_FORCE_32BIT=1 +endif ## help commands: diff --git a/README.md b/README.md index 9c7599f15..8bfedd97f 100644 --- a/README.md +++ b/README.md @@ -39,8 +39,15 @@ make build_unix ### OS X +Install SDL2 using DMG installer from [SDL download page](https://www.libsdl.org/download-2.0.php) or run the following if you use Homebrew: + +```sh +brew install sdl2 sdl2_image +``` + +Build the emulator: + ```sh -brew install --universal sdl2 sdl2_image make build_unix ``` diff --git a/emu.sh b/emu.sh index 4742bb36f..854fb0db2 100755 --- a/emu.sh +++ b/emu.sh @@ -2,10 +2,15 @@ source emu.config 2>/dev/null +EXE=vendor/micropython/unix/micropython OPTLEVEL="${OPTLEVEL:-0}" -HEAPSIZE="${HEAPSIZE:-100000}" MAIN="${MAIN:-main.py}" BROWSER="${BROWSER:-chromium}" +if file $EXE | grep -q 80386 ; then +HEAPSIZE="${HEAPSIZE:-100000}" +else +HEAPSIZE="${HEAPSIZE:-1000000}" +fi ARGS="-O${OPTLEVEL} -X heapsize=${HEAPSIZE}" @@ -14,12 +19,12 @@ cd `dirname $0`/src case "$1" in "-d") shift - gdb --args ../vendor/micropython/unix/micropython $ARGS $* $MAIN + gdb --args ../$EXE $ARGS $* $MAIN ;; "-r") shift while true; do - ../vendor/micropython/unix/micropython $ARGS $* $MAIN & + ../$EXE $ARGS $* $MAIN & UPY_PID=$! find -name '*.py' | inotifywait -q -e close_write --fromfile - echo Restarting ... @@ -28,12 +33,12 @@ case "$1" in ;; "-p") shift - ../vendor/micropython/unix/micropython $ARGS $* $MAIN & + ../$EXE $ARGS $* $MAIN & perf record -F 100 -p $! -g -- sleep 600 perf script > perf.trace ../vendor/flamegraph/stackcollapse-perf.pl perf.trace | ../vendor/flamegraph/flamegraph.pl > perf.svg $BROWSER perf.svg ;; *) - ../vendor/micropython/unix/micropython $ARGS $* $MAIN + ../$EXE $ARGS $* $MAIN esac