Publishing an X11 based application to the App Store

Ryan Schmidt ryandesign at macports.org
Thu Jan 21 00:19:05 UTC 2021


On Jan 20, 2021, at 18:01, filhol wrote:

> On 21 Jan 2021, at 00:53, Ryan Schmidt wrote:
> 
>> On Jan 20, 2021, at 09:47, filhol wrote:
>> 
>>> I am new at this mailing list and I hope my question is not out of scope.
>> 
>> Welcome!
>> 
>>> An X11 based application can easily notarised, but is it possible to publish to it to the Mac App Store ?
>>> If someone already succeeded what is the recipe ?
>>> For example, would it be enough to copy the contents of /opt/X11/bin/Xquartz to the App bundle and set a RPATH ?
>> 
>> I don't know if you can publish an X11-based app to the app store. If Apple allows it, then I don't know how best to accomplish it.
>> 
>> Certainly just copying the Xquartz program into your app bundle is not sufficient. It links with many libraries. You would need to copy those as well. MacPorts builds libraries with absolute paths in their install_names (we don't use rpath for most ports) so they are not relocatable, so once you copy the libraries, their library paths will be wrong. You would have to edit each of their install_names, and the inter-library linkages, so that they become relative to one another. Apple's install_name_tool program included with Xcode can be used to do this. The dylib_bundler program available in MacPorts can be used to automate this for an entire app bundle.
>> 
>> For a non-X11 app, the above might be sufficient (assuming there are not other instances of the installation path baked into any of the files), however X11 also requires a launchd plist to be loaded and requires the user to log out and log back in before it takes effect. I don't know if Apple permits apps to install and load launchd plists. I suspect not; I suspect they require apps to be contained within their app bundle.
>> 
>> A final consideration anytime you want to use third-party libraries in your app is whether the combination of their licenses permits that.
> 
> Thanks a lot Ryan.
> It is now clear to me that publishing an X11 based application is either extremely difficult (too difficult for me) or impossible.
> I will stay with the notarised version.

Another worthwhile consideration for you or anyone else thinking of attempting this is whether it is appropriate to bundle an X11 server with your app. What if the user already uses other X11 apps with another X11 server, like the one from MacPorts or the one from Xquartz.org? Will they interfere with one another?

If you want to distribute a binary of your app that uses X11, I might suggest bundling all of the third-party libraries that you link with, including X11 libraries, but don't bundle an X11 server. Require the user to provide their own. Then they're in charge of which one to use and making sure its launchd plist is loaded properly.


More information about the macports-dev mailing list