Skip to content

mac-universal build target #1829

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

Open
ninjamuffin99 opened this issue Aug 13, 2024 · 1 comment
Open

mac-universal build target #1829

ninjamuffin99 opened this issue Aug 13, 2024 · 1 comment

Comments

@ninjamuffin99
Copy link
Contributor

ninjamuffin99 commented Aug 13, 2024

Been testing and using the new arm64 version of lime very nicely! It's possible to compile downwards to x86 from apple silicon, but then creating a universal binary would involve running all of the build/compile commands twice, and then combining the builds with lipo.

A good convenience might be something like a mac-universal target, which would compile both x86 and arm for mac, and then run lipo to create a universal binary with no fuss. Of course it might be unpleasant for day to day use, but rather something nice for when getting ready to package something up!

@ninjamuffin99
Copy link
Contributor Author

for potential reference, for FNF I made this script

#!/bin/sh
# Create x86_64 version
lime build mac -64 -release 
# Create folder to hold our universal binary stuff (and delete our previous one if it exists so we start fresh)
cd export/release
rm -rf macosUniversal
mkdir macosUniversal
# Move the x86_64 version to our universal folder
cp -r macos/bin/Funkin.app macosUniversal
cd ../..
# Create arm64 version
lime build mac -arm64 -release
# Move the arm64 Funkin *executable* and *lime.ndll* into our to-be universal binary, renaming them along the way
cd export/release
cp -r macos/bin/Funkin.app/Contents/MacOS/Funkin macosUniversal/Funkin.app/Contents/MacOS/FunkinArm
cp -r macos/bin/Funkin.app/Contents/MacOS/lime.ndll macosUniversal/Funkin.app/Contents/MacOS/limeArm.ndll
# cd into where we will run our `lipo` commands to combine the binaries
cd macosUniversal/Funkin.app/Contents/MacOS
# change the filenames of the x86_64 versions of the executable/ndll 
mv Funkin Funkin64
mv lime.ndll lime64.ndll
# combine our x86_64 and our arm64 versions of the ndll into a universal lime.ndll
lipo -create -output lime.ndll lime64.ndll limeArm.ndll
# combine our x86_64 and our arm64 versions of the Funkin executable into a universal binary
lipo -create -output Funkin Funkin64 FunkinArm
# remove leftovers
rm FunkinArm Funkin64 lime64.ndll limeArm.ndll

and this creates a universal binary!

There's other files that we include but those are already universal (libvlc stuff), but potentially maybe some stuff like Steam api or other libraries might need to be created universally if they don't go thru the lime build process

I think phase 1 of making this workflow easier is to allow easy creation of a universal lime.ndll, since right now lime separates the x86 and arm64 versions into their own folders, so can probably just make a new folder somewhere along the process for a combined universal lime.ndll?

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

No branches or pull requests

1 participant