Amulet-Map-Editor icon indicating copy to clipboard operation
Amulet-Map-Editor copied to clipboard

OSX Builds

Open gentlegiantJGC opened this issue 4 years ago • 9 comments

The OSX build has issues. None of the developers are OSX users so we don't really know what we are doing and have no way to test.

If you have access to a Mac and have some idea of what you are doing please help us out.

gentlegiantJGC avatar Nov 18 '20 20:11 gentlegiantJGC

I'm the user that mentioned the issue on Discord. I have two Macs (Both intel-based) that can be used to build if needed. I am not very familiar with building applications, but I can go off to see if there's a set of instructions that generate a proper .app bundle and can report back if it'll help.

Matthewrbowker avatar Nov 18 '20 20:11 Matthewrbowker

If you want to take a look we use a python library called PyInstaller to bundle the code and the python interpreter into the executable. python -m pip install pyinstaller will install it python setup.py build will copy all the required code into the build directory python -m PyInstaller -y Amulet.spec will run pyinstaller using our custom spec file. The Amulet.spec file is what you will need to modify to fix OSX support. To build it into one file rather than one folder you need to remove the COLLECT step and pass the exe into the BUNDLE step and pass some of the collect steps into the EXE step. I did this the other day for windows but it took a while for the program to load so I didn't continue with it.

For one file mode to work properly there are some path related things we need to fix but it should work as is

gentlegiantJGC avatar Nov 18 '20 20:11 gentlegiantJGC

All right, I'm going to dump some notes here:

By default, A mac does not include the proper version of python (the one with the developer headings). A version of python3 will need to be installed using either HomeBrew or MacPorts: sudo port install python38 was my command. Make sure that this version of Python is first in the $PATH.

Commands:

  • python3 -m pip install setuptools
  • python3 -m pip install wheel
  • python3 -m pip install cython
  • sudo port install jpeg
  • python3 -m pip install -r requirements.txt (this takes a while...)
  • python3 setup.py build
  • python3 -m PyInstaller -y Amulet.spec

This generates a complete .app package on a fresh Mac for the latest build. However, it still doesn't draw a window. I'm going to look into logs after work and see if there's something that needs to be fixed.

Now, once I figure this out, I have an offer. I don't have the time to properly contribute to this repository right now. However, when you run a release I am more than willing to run the Mac build on my machine. Please go ahead and open an issue or reach out on Discord, and I'll run the build and hand back an app bundle.

Matthewrbowker avatar Nov 18 '20 22:11 Matthewrbowker

We are using GitHub actions to automatically build the app so we won't need you to build a Mac version for each release. What we need is to get a version of the spec file that builds a working version for Mac. Once you have something working we can upload it to the build system and it will do the rest from there.

gentlegiantJGC avatar Nov 18 '20 22:11 gentlegiantJGC

Okay, let me see what I can pull out of the log files for you!

Matthewrbowker avatar Nov 18 '20 22:11 Matthewrbowker

This program needs access to the screen. Please run with a Framework build of python, and only when you are logged in on the main display of your Mac.

According to what I've found so far, it's wxPython, specifically running in a Virtual Environment, that causes this error.

Matthewrbowker avatar Nov 18 '20 22:11 Matthewrbowker

It is probably due to it being bundled by pyinstaller. This might be useful https://github.com/chriskiehl/Gooey/issues/259

It suggests using --windowed in the command

Docs: https://pyinstaller.readthedocs.io/en/stable/usage.html

gentlegiantJGC avatar Nov 18 '20 23:11 gentlegiantJGC

The framework issue can apparently be resolved with this env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install 3.9.6

gentlegiantJGC avatar Apr 19 '23 14:04 gentlegiantJGC

The framework issue can apparently be resolved with this env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install 3.9.6

The version I ended up using was this

env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install 3.9.16
pyenv global 3.9.16

cwesterfield avatar Apr 19 '23 16:04 cwesterfield