Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac OS X maintainer #1583

Open
dorkster opened this issue Feb 24, 2018 · 104 comments
Open

Mac OS X maintainer #1583

dorkster opened this issue Feb 24, 2018 · 104 comments

Comments

@dorkster
Copy link
Collaborator

@dorkster dorkster commented Feb 24, 2018

Opening this thread for anyone that would like to create the .dmg files for Mac OS X. This includes both the engine and the engine+game files.

@dorkster dorkster added this to the Pre-1.0 milestone Feb 24, 2018
@tvleavitt
Copy link

@tvleavitt tvleavitt commented Mar 3, 2018

What's involved here? I've got a fair amount of experience compiling software as a Unix/Linux Sysadmin over the last quarter century.

@dorkster
Copy link
Collaborator Author

@dorkster dorkster commented Mar 3, 2018

I know practically nothing about Mac OS development. Maybe @clintbellanger can at least explain, how 0.19 was built and packaged. I suspect the most notable change for the current engine would be swapping out SDL 1.2 for SDL 2.

I don't know if a dmg is just a plain archive, or if there's more to it. If the files that would need to be added are similar to the Windows zips, the dmgs should look like this:

Engine

flare executable
SDL 2 libraries, akin to Windows .dlls
COPYING
CREDITS.engine.txt
README.engine.md
RELEASE_NOTES.txt
mods/mods.txt
mods/default/

Engine + Game

(everything from the engine)
README.md (part of flare-game)
CREDITS.txt (part of flare-game)
mods/fantasycore/ (part of flare-game)
mods/empyrean_campaign/ (part of flare-game)
mods/centered_statbars/ (part of flare-game)
@tvleavitt
Copy link

@tvleavitt tvleavitt commented Mar 3, 2018

Hmm... well, I was able to pull the source from GitHub, and successfully build and run the code (0.95.19), and creating a DMG looks to be pretty trivial, so I suspect all I need is a list of what should be contained in the DMG and I'll be good to go.

@clintbellanger
Copy link
Collaborator

@clintbellanger clintbellanger commented Mar 3, 2018

Maybe you can grab a prebuilt copy of 0.18 or 0.19 to see how the DMG was structured.
Besides all those data files listed above, I remember needing to put a copy of the main Libraries / Frameworks in the DMG. Version 2 of these:

  • SDL,
  • SDL_image
  • SDL_mixer
  • SDL_ttf
@clintbellanger
Copy link
Collaborator

@clintbellanger clintbellanger commented Mar 3, 2018

I always cobbled the DMG together manually. If you (or anyone) knows how to make a script that will create the DMG perfectly each time, we'd love to add it to this repo.

@tvleavitt
Copy link

@tvleavitt tvleavitt commented Mar 4, 2018

I'll take a look at the previous DMG. Should I build it based on the current release, 0.95.19?

@dorkster
Copy link
Collaborator Author

@dorkster dorkster commented Mar 4, 2018

Since we're finished the first week of our 2-week testing period, I've bumped the version to 0.96 for both engine and game. So please use that tag.

@dorkster
Copy link
Collaborator Author

@dorkster dorkster commented Mar 10, 2018

Today is the last day of our testing period. The original plan was to tag 1.0 tomorrow and get the binaries ready, However, @gunchleoc asked me for an extension to finish his translation.

So @tvleavitt, if I tagged 1.0 on Monday, do you think you could get the DMG files made and sent to me the same day? I think we will release no matter what on Monday, but I would like the Mac OS release to be simultaneous.

@dorkster dorkster modified the milestones: Pre-1.0, Post-1.0 Mar 12, 2018
@dorkster
Copy link
Collaborator Author

@dorkster dorkster commented Mar 12, 2018

@gunchleoc finished his translation, so I've tagged 1.0 tonight. We'll be releasing tomorrow, so getting DMGs for the engine and game soon would be much appreciated.

@tvleavitt
Copy link

@tvleavitt tvleavitt commented Mar 12, 2018

I'll work on this tomorrow afternoon, then. Will provide update around 5 p.m. or so.

Edit: I took a peek at this, just before going to bed.

So, this is what is in the 0.19 Engine + Alpha Demo DMG:

COPYING
CREDITS.txt
Flare.app
README
RELEASE_NOTES.txt
(plus misc. OS X system files that I doubt are relevant)

I see no SDL or other libraries. I see no "mods" directory.

The executable produced by running cmake / make is "flare". Not Flare.app.

My main question at this point would be, how do I create a .app file, and what would go into it? Or do we want to create a .pkg file instead, and have people run that, instead of dragging and dropping the monolithic executable?

@tvleavitt
Copy link

@tvleavitt tvleavitt commented Mar 12, 2018

I'm finished with my morning client; am free most of the day, I'll try and figure this out, but guidance would speed up the process considerably, I suspect.

@dorkster
Copy link
Collaborator Author

@dorkster dorkster commented Mar 12, 2018

I think the Flare.app file is a package that contains

  • the mods directory
  • a "MacOS" folder with the actual flare executable (and probably SDL libs) inside of it. Apparently, you can browse this via "Show Package Contents" in Finder
@tvleavitt
Copy link

@tvleavitt tvleavitt commented Mar 12, 2018

Got it. See that now. Just have to figure out how to create the package.

@tvleavitt
Copy link

@tvleavitt tvleavitt commented Mar 12, 2018

Building Info.plist.

What do I put for these (optional)? No values in previous Info.plist.

LSMinimumSystemVersion (Minimum system version) The minimum version of macOS required for this application to run. The value for this key is a string of the form n.n.n where each n is a number representing either the major or minor version number of macOS that is required. For example, the value 10.1.5 would represent macOS v10.1.5.
NSHumanReadableCopyright (Copyright (human-readable)) The copyright notice for the application. This is a human readable string and can be localized by including the key in an InfoPlist.strings file in your language-specific project directories.

Have the following changed?

NSMainNibFile (Main nib file base name) The nib file to load when the application is launched (without the .nib filename extension). The main nib file is an Interface Builder archive containing the objects (main window, application delegate, and so on) needed at launch time.
NSPrincipalClass (Principal class) The entry point for dynamically loaded Objective-C code. For an application bundle, this is almost always the NSApplication class or a custom subclass.

Here's what's there now:

    <key>NSMainNibFile</key>
<string>SDLMain</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>

I'm building the package by hand (will turn it into a script), trying to figure out how to do it via XCode seems like a lot of overhead for a one-off project like this.

https://developer.apple.com/library/content/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html#//apple_ref/doc/uid/10000123i-CH101-SW1

@dorkster
Copy link
Collaborator Author

@dorkster dorkster commented Mar 12, 2018

I think @clintbellanger used XCode to do the old builds, so I don't know much about those fields. I would leave the first blank and if we get any old Mac users complaining they can't run the game. NSMainNibFile is probably the same as it was before.

@tvleavitt
Copy link

@tvleavitt tvleavitt commented Mar 12, 2018

InfoPlist.strings from 0.19

/* Localized versions of Info.plist keys */

CFBundleName = "Flare";
CFBundleShortVersionString = "Flare version 0.1";
CFBundleGetInfoString = "Flare version 0.1, Copyright 2013 Clint Bellanger.";
NSHumanReadableCopyright = "Copyright 2013 Clint Bellanger.";

Would this update to

/* Localized versions of Info.plist keys */

CFBundleName = "Flare";
CFBundleShortVersionString = "Flare version 1.0";
CFBundleGetInfoString = "Flare version 1.0, Copyright 2018 Clint Bellanger.";
NSHumanReadableCopyright = "Copyright 2018 Clint Bellanger.";

?

@dorkster
Copy link
Collaborator Author

@dorkster dorkster commented Mar 12, 2018

Yes. Looks like it was made for the first Mac OS build and then forgotten about.

@tvleavitt
Copy link

@tvleavitt tvleavitt commented Mar 12, 2018

I think I have everything. I looks like I have to manually create the SDL_xxxxx.framework files, working on that now. Then, obviously, testing.

@tvleavitt
Copy link

@tvleavitt tvleavitt commented Mar 12, 2018

Great; SDL wiki page says I'm right. I don't see SDL in either /Library/Frameworks or ~/Library/Frameworks. I'm going to see if I can download them from somewhere... manually assembling these seems... sketchy.

http://overooped.com/post/42240519/properly-bundling-frameworks-in-your-application

@tvleavitt
Copy link

@tvleavitt tvleavitt commented Mar 13, 2018

I downloaded DMG files for the appropriate SDL libraries and copied them over.

I don't see an application icon file in the original Flare.app build. I'm building a Flare.app and Flare-engine.app folder for Flare and Flare-engine, along with associated DMG files. What do I do here? Like, 1.0 should have an icon. I can repurpose something else if I'm pointed to it.

The Application Icon File

One special resource that belongs in your top-level Resources directory is your application icon file. By convention, this file takes the name of the bundle and an extension of .icns; the image format can be any supported type, but if no extension is specified, the system assumes .icns.

@dorkster
Copy link
Collaborator Author

@dorkster dorkster commented Mar 13, 2018

@tvleavitt
Copy link

@tvleavitt tvleavitt commented Mar 13, 2018

This is what I get when I try to launch the Flare.app at this point.

flare error ss

@dorkster
Copy link
Collaborator Author

@dorkster dorkster commented Mar 13, 2018

Where did you put the mods folder in the Flare.app? It might need to be alongside the actual executable.

@tvleavitt
Copy link

@tvleavitt tvleavitt commented Mar 13, 2018

Resources/mods as in original 0.19 DMG Flare.app package.

@dorkster
Copy link
Collaborator Author

@dorkster dorkster commented Mar 13, 2018

If you're building with cmake you may need to add -DDATADIR=Resources. If you're not using cmake, you'll need to define DATA_INSTALL_DIR. In our cmake file, DATA_INSTALL_DIR is set to ${CMAKE_INSTALL_PREFIX}/${DATADIR}.

@dorkster
Copy link
Collaborator Author

@dorkster dorkster commented Mar 27, 2018

From the SDL wiki:

The SDL-devel package contains the SDL libraries in the form of a Framework. That is perfectly fine as long as you want to develop using Xcode. However, applications which use a configure script almost always require SDL to be installed Unix-style.

I suspect that we shouldn't be using the frameworks to begin with.

@elosha
Copy link

@elosha elosha commented Mar 28, 2018

How did you package during the beta phase (release 0.18 for example)? Because that worked very well for users :)

@dorkster
Copy link
Collaborator Author

@dorkster dorkster commented Mar 28, 2018

@elosha The pre-1.0 versions were built with Xcode. We're trying to get a non-Xcode solution working. This would be easier to put into a script for use by future Mac packagers.

@apocarteres
Copy link
Contributor

@apocarteres apocarteres commented May 8, 2018

btw why you want to build DMG? I created in the past for some guy tar.gz file with working flare for OSX with no issues.

@apocarteres
Copy link
Contributor

@apocarteres apocarteres commented May 8, 2018

fresh build in case someone interested in: http://files.ruads.org/flare-osx-09.05.2018.tar.gz

use run-osx.sh script to start

@dorkster
Copy link
Collaborator Author

@dorkster dorkster commented May 31, 2018

Sorry for being late on the response. I would be fine at this point with shipping a tarball with libs like we do on Linux. @apocarteres, yours looks good. Would you be willing to make tarballs for Flare releases going forward? I've restored the Darwin branch to the *nix launcher script (which is symlinked in distribution/macos/), so you can copy that file instead of making run-osx.sh.

@apocarteres
Copy link
Contributor

@apocarteres apocarteres commented Oct 20, 2018

@dorkster is it still relevant? i can take look in a while

for now just please feel free to use fresh flare build: http://files.ruads.org/flare-osx-20.10.2018.tar.gz

@dorkster
Copy link
Collaborator Author

@dorkster dorkster commented Oct 20, 2018

@apocarteres Yes, it's still relevant. We want to have two tarballs, one engine+game and one engine-only. Ideally, we'd have scripts to create these so that any Mac contributor can replicate them for us.

Your tarball looks good, but like the other platforms, it should contain:

(from flare-engine)
RELEASE_NOTES.txt
README.engine.md
CREDITS.engine.txt
COPYING

(from flare-game, not required for the engine-only tarball)
CREDITS.txt
LICENSE.txt
@igorko
Copy link
Collaborator

@igorko igorko commented Oct 22, 2018

Hello. @dorkster when do you plan to release 1.09? I am currently working on translations update, it would be nice to include updated version into release.

@dorkster
Copy link
Collaborator Author

@dorkster dorkster commented Oct 22, 2018

@igorko There's no set date for 1.09, so don't worry about having to rush.

@elosha
Copy link

@elosha elosha commented Nov 1, 2018

@apocarteres Thanks again for the build!

I have an iprovement idea for your 'run_osx.sh' launcher script. If you change it like that, the script may be doubleclicked right from Finder (i.e. without firing up Terminal and cd-ing to FLARE's path):

#!/bin/sh
cd "$(dirname "${BASH_SOURCE[0]}")"
DYLD_LIBRARY_PATH=./lib ./flare
@apocarteres
Copy link
Contributor

@apocarteres apocarteres commented Nov 2, 2018

@elosha makes sense, i'm going to add that, thx.

@dorkster for now, let me just create a simple packaging script which uses pre-built dependencies for OSX (so i can publish tar bar with ones using my servers). I guess it simplest way for most the OSX users to build a delivery package.

@hexstr1p
Copy link

@hexstr1p hexstr1p commented Feb 4, 2019

With that latest merge, is there a stable macOS build above 1.0 now?

@apocarteres
Copy link
Contributor

@apocarteres apocarteres commented Feb 4, 2019

@panpanick i guess if nobody did that so far, then answer is no. I can build it for you in a while

@apocarteres
Copy link
Contributor

@apocarteres apocarteres commented Feb 4, 2019

@panpanick pls check it out here (latest master build): http://files.ruads.org/flare-osx-04.02.2019.tar.gz

@apocarteres
Copy link
Contributor

@apocarteres apocarteres commented May 26, 2019

hey folks. the latest build is here: http://files.ruads.org/flare-osx-26.05.2019.tar.gz

@ludoza
Copy link
Contributor

@ludoza ludoza commented Sep 5, 2019

Trying to package flare on my machine I get:

./package_osx.sh flare
...
http://files.ruads.org/flare_osx_dependencies.tar.gz
Resolving files.ruads.org (files.ruads.org)... failed: nodename nor servname provided, or not known.
wget: unable to resolve host address ‘files.ruads.org’

Anybody know what was the layout and content of flare_osx_dependencies.tar.gz?

edit: I'm having a look at Flare DMG Build Documentation.pdf now, but would still like to know the content of the tar.gz file.

@apocarteres
Copy link
Contributor

@apocarteres apocarteres commented Sep 5, 2019

@ludoza hi, yeah seems machine hosted that file was reconfigured recently, let me try to restore the access. I will put my update here

@apocarteres
Copy link
Contributor

@apocarteres apocarteres commented Sep 5, 2019

@ludoza i've fixed it. please try again

@ludoza
Copy link
Contributor

@ludoza ludoza commented Sep 5, 2019

@apocarteres thanks for your effort, it works.

I'm trying to copy the dependancies from homebrew as seen in pull/1732.

The files in the flare_osx_dependencies.tar.gz seem to be:

libSDL2-2.0.0.dylib
libSDL2.a
libSDL2.dylib -> libSDL2-2.0.0.dylib
libSDL2.la
libSDL2_image-2.0.0.dylib
libSDL2_image.a
libSDL2_image.dylib -> libSDL2_image-2.0.0.dylib
libSDL2_image.la
libSDL2_mixer-2.0.0.dylib
libSDL2_mixer.a
libSDL2_mixer.dylib -> libSDL2_mixer-2.0.0.dylib
libSDL2_mixer.la
libSDL2_test.a
libSDL2_ttf-2.0.0.dylib
libSDL2_ttf.a
libSDL2_ttf.dylib -> libSDL2_ttf-2.0.0.dylib
libSDL2_ttf.la
libSDL2main.a
libfreetype.6.dylib
libfreetype.a
libfreetype.dylib -> libfreetype.6.dylib
libfreetype.la
libogg.0.dylib
libogg.a
libogg.dylib -> libogg.0.dylib
libvorbis.0.dylib
libvorbis.a
libvorbis.dylib -> libvorbis.0.dylib
libvorbisenc.2.dylib
libvorbisenc.a
libvorbisenc.dylib -> libvorbisenc.2.dylib
libvorbisfile.3.dylib
libvorbisfile.a
libvorbisfile.dylib -> libvorbisfile.3.dylib

But if I copy it from homebrew I seem to only need:

OGG-COPYING
SDL2-COPYING.txt
SDL2-README.txt
VORBIS-COPYING
libSDL2-2.0.0.dylib
libSDL2_image-2.0.0.dylib
libSDL2_mixer-2.0.0.dylib
libSDL2_ttf-2.0.0.dylib
libogg.0.dylib
libvorbis.0.dylib
libvorbisenc.2.dylib
libvorbisfile.3.dylib

Why libfreetype the *.a files and symlinks?

I uploaded the packages here(sorry for using a free service, hope it works):

Finally a bit off-topic question were does save files get stored on macOS. I did rm -rf ~/.config/flare/ before testing the package but I see my two saves slot was still available?

@ludoza
Copy link
Contributor

@ludoza ludoza commented Sep 5, 2019

So after extending package_osx.sh I read the Flare DMG Build Documentation.pdf.

I downloaded the current flare.dmg from the website and removed the Content/Flare binary and replaced it with a simple shell script.

I then created a create-flare-dmg.sh script based on @tvleavitt efforts.

The difference is I dropped Frameworks/* and moved out English.lproj to be able to destroy Resources/ and recreate by unpacking flare_osx-engine.tar.gz and then moving English.lproj back before building flare.dmg.

My first proof of concept attempt can be downloaded here:

Everything I used to build the dmg can be found at https://github.com/ludoza/flare-dmg and might want to move it to flare-engine/distribution/macos/ if the poc is working for other people.

ps. To answer my own question the save files is found in ~/.local/share/flare/.

@apocarteres
Copy link
Contributor

@apocarteres apocarteres commented Sep 6, 2019

@apocarteres thanks for your effort, it works.

I'm trying to copy the dependancies from homebrew as seen in pull/1732.

The files in the flare_osx_dependencies.tar.gz seem to be:

libSDL2-2.0.0.dylib
libSDL2.a
libSDL2.dylib -> libSDL2-2.0.0.dylib
libSDL2.la
libSDL2_image-2.0.0.dylib
libSDL2_image.a
libSDL2_image.dylib -> libSDL2_image-2.0.0.dylib
libSDL2_image.la
libSDL2_mixer-2.0.0.dylib
libSDL2_mixer.a
libSDL2_mixer.dylib -> libSDL2_mixer-2.0.0.dylib
libSDL2_mixer.la
libSDL2_test.a
libSDL2_ttf-2.0.0.dylib
libSDL2_ttf.a
libSDL2_ttf.dylib -> libSDL2_ttf-2.0.0.dylib
libSDL2_ttf.la
libSDL2main.a
libfreetype.6.dylib
libfreetype.a
libfreetype.dylib -> libfreetype.6.dylib
libfreetype.la
libogg.0.dylib
libogg.a
libogg.dylib -> libogg.0.dylib
libvorbis.0.dylib
libvorbis.a
libvorbis.dylib -> libvorbis.0.dylib
libvorbisenc.2.dylib
libvorbisenc.a
libvorbisenc.dylib -> libvorbisenc.2.dylib
libvorbisfile.3.dylib
libvorbisfile.a
libvorbisfile.dylib -> libvorbisfile.3.dylib

But if I copy it from homebrew I seem to only need:

OGG-COPYING
SDL2-COPYING.txt
SDL2-README.txt
VORBIS-COPYING
libSDL2-2.0.0.dylib
libSDL2_image-2.0.0.dylib
libSDL2_mixer-2.0.0.dylib
libSDL2_ttf-2.0.0.dylib
libogg.0.dylib
libvorbis.0.dylib
libvorbisenc.2.dylib
libvorbisfile.3.dylib

Why libfreetype the *.a files and symlinks?

I uploaded the packages here(sorry for using a free service, hope it works):

Finally a bit off-topic question were does save files get stored on macOS. I did rm -rf ~/.config/flare/ before testing the package but I see my two saves slot was still available?

as far as i remember "freetype" ones and probably some other were required by OSX Sierra / High Sierra . It might be ok to run with out them on the latest OSX releases

@elosha
Copy link

@elosha elosha commented Sep 7, 2019

@ludoza That doesn't work:

dyld: Library not loaded: /usr/local/opt/libpng/lib/libpng16.16.dylib
  Referenced from: /Applications/Spiele/Flare.app/Contents/Resources/lib/libSDL2_image-2.0.0.dylib
  Reason: image not found
../MacOS/Flare: line 4: 25859 Trace/BPT trap: 5       DYLD_LIBRARY_PATH=./lib ./flare

It excpects the libSDL2's dependencies to be there, too. I wonder if one could just link them against system libraries.

It at least used my /opt/local/lib (MacPorts libpath) but the libSDL2 you linked expects ./libpng/lib/libpng16.16.dylib as part of the relative path for libpng and doesn't find my /opt/local/lib/libpng16.16.dylib that MacPorts put there.

The same for your other image from the other thread.

@ludoza
Copy link
Contributor

@ludoza ludoza commented Sep 7, 2019

@apocarteres thanks for the info, I updated the package_osx.sh script to use otool to scan all the dylibs for dependencies after @elosha alerted me of the missing libpng16.16.dylib and it seems libfreetype.6.dylib was needed with a couple of other I missed by hand.

Latest dmg files can be found here and it seems the icns @elosha supplied fixed my Flare.app icon issues.

@dorkster
Copy link
Collaborator Author

@dorkster dorkster commented Sep 24, 2019

So I got my hands on a Mac and can also confirm @ludoza's package works well on High Sierra 10.13.6 (latest version I can run). I'll have to set aside some time to get a proper dev environment set up, but I think it's safe to say that the next version of Flare will be the return of official Mac support. Thanks again to everyone who's worked on this!

Something I noticed immediately is that the installer could use a bit of a facelift. The black text is hard to read with the screenshot that was picked (see image):
Screen Shot 2019-09-23 at 8 18 40 PM

@ludoza
Copy link
Contributor

@ludoza ludoza commented Sep 25, 2019

dmg packaging seems tricky:

  • Apple wants users to confirm "Security & Privacy" if you want to execute Flare.app because it is unsigned by Unidentified Developer(something wrong with plist file?).
  • The sh and py modules to create a dmg seems broken/unmaintained.
  • I stumbled upon https://cmake.org/cmake/help/v3.6/module/CPackDMG.html and believe it might be a better option to create a dmg. Becausecmake is already being used by flare-engine(but it is uncharted territory for me).

I will give more feedback as soon as I get CPackDMG working.

@ludoza
Copy link
Contributor

@ludoza ludoza commented Sep 27, 2019

Eish, CPackDMG seems atm a bit out of reach for me, and my google-foo is failing me to find a useful tutorial.

I'm not really attached to the background just used the one in the current dmg that I decompiled. Not really sure if I'm happy with this modification/suggestion:

flare.dmg with orange bar

Any other background one might want to use, or should the background just be dropped all together?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
8 participants
You can’t perform that action at this time.