Skip to content

Create mac-build-intel.sh#1222

Open
flagsoft wants to merge 41 commits into
sillsdev:masterfrom
flagsoft:master
Open

Create mac-build-intel.sh#1222
flagsoft wants to merge 41 commits into
sillsdev:masterfrom
flagsoft:master

Conversation

@flagsoft

Copy link
Copy Markdown

How to build App on macOS with intel chip.
App does work, but DMG not.

@mhosken

mhosken commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

This is good to have, thank you. A few suggestions:

  1. Give a general link to https://flagsoft.com/public/ptxprint to save having to update the file every release, which would get noisy. That way we can put that link on our website
  2. Put the distribution/readme into docs somewhere
  3. put mac-build.sh into docs/dev thus alleviating the need for the same information in quite so many places
  4. don't clone the repo in the mac-build.sh since it will come with the clone and be versioned.
  5. The script seems to be about building and installing on a local machine, could you adapt it to build a downloadable package file. Then if we ever find a build machine, we can promote the script and run it under CI.
  6. Do we need to rename mac-build.sh to mac-intel-build.sh?

@flagsoft

flagsoft commented Jun 4, 2026

Copy link
Copy Markdown
Author

General questions:

  • How can one checkout a specific version like 3.0.31, or 3.0 etc., while checkin and pull requests will go on? (Is there a TAG overall ALL files?) How you do that if someone wants to checkout and build from source a very specific version to a local machine.
  • You update the source until the 1st of very month? then do a release? But there must be a way to checkout a specific version at any time.

This is good to have, thank you. A few suggestions:

  1. Give a general link to https://flagsoft.com/public/ptxprint to save having to update the file every release, which would get noisy. That way we can put that link on our website

You can now access https://flagsoft.com/public/ptxprint directly.

  1. Put the distribution/readme into docs somewhere
  1. put mac-build.sh into docs/dev thus alleviating the need for the same information in quite so many places

mac-build.sh - is not from me. So I think this is used to build the macOS Apple silicon chip version?

  1. don't clone the repo in the mac-build.sh since it will come with the clone and be versioned.

How then? If someone builds from source we must clone the whole thing. HEAD-version the so called bleeding edge version / latest nightly build. and with TAGs a specific version, for example 3.0.31.

  1. The script seems to be about building and installing on a local machine, could you adapt it to build a downloadable package file. Then if we ever find a build machine, we can promote the script and run it under CI.

As for now, only the .app file works. Do .DMG install image. Don't know why.

  1. Do we need to rename mac-build.sh to mac-intel-build.sh?

No. I did not touch mac-build.sh. Instead created a new mac-intel-build.sh with instructions.
mac-intel-build.sh is just for manually build and change some source to have an working .app on your local machine.

@flagsoft

flagsoft commented Jun 5, 2026

Copy link
Copy Markdown
Author

My new script can now build the .app autonomous.
It uses so called "ad hoc" signing for code signing.
It patches some code on the fly.
Creates a zip file of the app and create checksum file.

Just put this script mac-build-intel.sh inside your main folder.

So you can just download a release ZIP file, unzip it, and put this script in main folder, and run it with

bash ./mac-build-intel.sh
https://github.com/flagsoft/ptx2pdf/blob/master/mac-build-intel.sh

https://github.com/flagsoft/ptx2pdf/blob/master/mac-build-intel.sh

Maybe the user still needs to do

Important NOTE after downloading .app file
When an application gets downloaded from any source other than those that Apple seems suited, the application gets an extended attribute "com.apple.Quarantine". This triggers the message: "application XY is damaged and can't be opened. You should move it to the Bin."

Remove the attribute and you can launch the application.

So after download: open a console and type:

$ xattr -c <path/to/application.app>

After that you can run the App as usual.

You must Install XeTeX separately
You must install XeTeX with brew (Homebrew), see https://brew.sh/ else it will not work.

% brew install xetex

This will install XeTeX with binaries:

/usr/local/bin/fc-list
/Library/TeX/texbin/xetex
/Library/TeX/texbin/xdvipdfmx

@flagsoft

flagsoft commented Jun 5, 2026

Copy link
Copy Markdown
Author

So with this bild script I was able to compile some versions and create an App for macOS with Intel Chip.

https://www.flagsoft.com/public/ptxprint/

@mhosken

mhosken commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator
  1. There is no top level distributions/ directory and I don't want to add one. If you want a readme.md then can you find somewhere else to put it, with an appropriate name in docs/dev somewhere.
  2. A top level mac-build-intel.sh must produce a .app or whatever and not actually install on the users machine (which is what I think this is doing).

@flagsoft

flagsoft commented Jun 10, 2026

Copy link
Copy Markdown
Author
  1. There is no top level distributions/ directory and I don't want to add one. If you want a readme.md then can you find somewhere else to put it, with an appropriate name in docs/dev somewhere.

No, it is as it always was/is. Just a script which builds an .app within ./dist

  1. A top level mac-build-intel.sh must produce a .app or whatever and not actually install on the users machine (which is what I think this is doing).

NO! See existing mac-build.ch it just builds an .app within your existing ./dist sub-folder as it should exactly as with building your .dmg

MY top level ./distribution folder is JUST my privat folder.

@flagsoft

flagsoft commented Jun 10, 2026

Copy link
Copy Markdown
Author

Step by step Instruction - How to build PTXprint on macOS with intel chip

I think best is: Just ignore or revert, cancel my push request if possible.

Just create ONE new file on your repository ("mac-build-intel.sh") ist MUST be within your TOP folder as existing mac-build.sh.

Just copy my script mac-build-intel.sh by creating a new file on your repository in your top folder and put the contents there, as it was and still is with your existing mac-build.ch script.

That's all, your are set and ready to go!

  1. Just deploy (=copy 1:1) a ZIP of your existing distribution (TAGed ZIP Versions) with source (and this script).
  2. Unpack it on macOS with intel chip on target computer.
  3. run script with bash ./mac-build-intel.sh on macOS with intel chip.
  4. wait, until it's done will build a .app within your existing ./dist sub-folder as always and it always was.

This can be easily integrated in automated build systems.

Will build down to version PTXprint Version 2.8.5. WITHOUT any change on your source code. Very little patch is within the build script ON-THE-FLY.

At the end, you will have a up-and-running .app file. But user must install TeTeX locally with well known and widely used BREW (install missing packages on macOS) as described in documentation, which is easy to do.

@mhosken

mhosken commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

OK so we are getting there. As you say, let's go with a single top level script and if you want to add something to docs/dev to point people to your github repo, you can. In such an md can I recommend you tell them to run your script rather than giving them a script to hand execute, and then tell them how to appropriate the results.

I notice that your script patches various files. Please don't do that. Instead let's fix the code so that it works for you. I have added the GtkSource version requirement. I'm unsure about the import gi; gi.require_version('Gtk', 3.0) in main. I certainly don't want it right at the top because we work very hard to allow ptxprint to run headless without pulling in anything from Gtk. How about around line 502 where the code imports stuff from gtkview, etc.?

I would entertain such a change in this PR, but it will take a bit of testing from you to ensure we have the necessary changes to the code correct.

If it's easier for you, feel free to start a new PR.

@flagsoft

Copy link
Copy Markdown
Author

OK so we are getting there. As you say, let's go with a single top level script and if you want to add something to docs/dev to point people to your github repo, you can. In such an md can I recommend you tell them to run your script rather than giving them a script to hand execute, and then tell them how to appropriate the results.

Ok.

I notice that your script patches various files. Please don't do that. Instead let's fix the code so that it works for you. I have added the GtkSource version requirement. I'm unsure about the import gi; gi.require_version('Gtk', 3.0) in main. I certainly don't want it right at the top because we work very hard to allow ptxprint to run headless without pulling in anything from Gtk. How about around line 502 where the code imports stuff from gtkview, etc.?

I would entertain such a change in this PR, but it will take a bit of testing from you to ensure we have the necessary changes to the code correct.

If it's easier for you, feel free to start a new PR.

Just 2 files.
I'm very very cautions to change main source... because you never know what happens to build with Windows + Linux...
-> I think it's best you change it and make sure it works on Windows + Linux ? (I can't)

The problem seems to be about Gtk Version mix. Fix: Prevent Gtk Version mix.

I think BEST would be that you do the testing IF such code goes directly in the main source.

I can not test Windows + Linux by myself.
I do not know for sure where to put such things about Gtk to make sure it will work on any platform.

Required changes:

For macOS (and Windows?, and Linux? I DO NOT know that.)

# main.py:
import gi
gi.require_version('Gtk', '3.0')
# gtkview.py add about on top:
gi.require_version('GtkSource', '3.0')
gi.require_version('Gtk', '3.0')

This will prevent the CRASH:

## [PYI-14051:ERROR] Failed to execute script 'ptxprint' due to unhandled exception: gtk-builder-error-quark: .:15738:56 Invalid object type 'GtkSourceBuffer' (6)

These 2 changes makes sure it loads ONLY version 3 of Gtk.

I know that if we do that change to make sure it loads Gtk 3.0 and it does not mix with Gtk 4.x or whatever, then it worked. (GUI is loading)

One can test this do start the app, it should load.

Test TeTeX usage:
It should load the font-pannel and will be able to create PDFs.
If it does not: it will show blank white space instead of font list. if TeTeX is not working.

Better would be: PTXprint need to have a SETUP screen for where it can find TeTeX.

@mhosken

mhosken commented Jun 12, 2026 via email

Copy link
Copy Markdown
Collaborator

@flagsoft

flagsoft commented Jun 12, 2026

Copy link
Copy Markdown
Author

This is getting complicated. Then try it yourself. Put it where you think it should be. I can not test it for Windows + Linux + macOS and make sure it works everywhere.
BTW: This was initially the idea. But then it must work on macOS + Windows + Linux.
For running later versions this was the only solution right now because we can not change source from the past.

Else I can not help. You have any information about how to make a up and running .app for macOS with intel chip right now.

@flagsoft

flagsoft commented Jun 15, 2026

Copy link
Copy Markdown
Author

BTW: I do not use AI, Claude etc. It's best you put where ever you think the patch should go, this was also the initial idea, but I'm not familiar with your Gtk setup. One must check for side effects.
If it works at the end for Windows + Linux + macOS Apple Silicon and macOS with Intel chip would be great.

I can do a test on my macOS with Intel chip - after main source has changed.

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

Successfully merging this pull request may close these issues.

2 participants