Monday, February 6, 2023

How to package your Gtk App for Mac

Preface

Couldn't get the gtk-mac-bundler to work so I had to package my Gtk app on my own. searching the internet for information.

So how do you package Gtk app for Mac distribution? Luckily, a guy on Stackoverflow asked the same question.  With no one having the answer, he answered his own question.  He created a blog on a website that's long gone.  Thanks to Wayback Machine, the information is preserved.  Somewhat.

Thanks to danivdwerf, I was able to package Kage Studio for Mac!

One learning from this activity is the copying of Gtk library to the App.  And having to modify the copied libraries to actually access the same libraries already copied inside the App.

danivdwerf indicated on his blogpost that he had to create a shell script so he doesn't have to do the same manually in the future.  My concern was,  Gtk library is always updating, and I will have to modify the shell script each time.

So, I decided to create a python script to generate the shell script itself.

How to package your Gtk App for Mac

Automatically creating the App file is a work in progress but currently, simply run this line on Terminal

python3 copylib.py yourapp

You should have a shell script called, copylib_yourapp.sh, which you can use to copy all the Gtk libraries and modifying them for your App.

Final Words

Get a copy of copylib.py on Gtk-App-Builder.

Happy hacking!

~creek23

No comments: