PREREQUISITES
-------------
First, install XCode, MacPorts, and its dependencies required for building Tux
Paint.  These are described in the macos/README.txt file in the Tux Paint
source code.

Additionally, the following MacPorts package is required:

  fltk-devel
  libunibreak^*

  ^* Not available from MacPorts as of this writing, see below.

libunibreak

   libunibreak is not available from MacPorts as of this writing.
   It can be installed from the source code as follows. It should be
   installed to /opt/local (same as MacPorts) for the library to be
   included in TuxPaint-Config.dmg.

     $ sudo port install autoconf automake libtool
     $ git clone https://github.com/adah1972/libunibreak.git
     $ cd libunibreak
     $ ./bootstrap
     $ ./configure --prefix=/opt/local
     $ make && sudo make install

   WARNING: Having any UNIX-like toolset installed on your Mac besides
   MacPorts and Xcode, such as Fink or Brew, will prevent your app
   bundle from being portable. Be sure Fink and Brew are not accessible
   from your build environment.


HOW TO BUILD
------------
Simply, run the following commands:

  % make macos                # build the binary
  % make install-macos        # build TuxPaint-Config.app

  .. code sign and/or build the universal bundle (see below) ..

  % make TuxPaint-Config.dmg  # build TuxPaint-Config.dmg for distribution


CODE SIGNING
------------
Code signing is mandatory for running the Apple Silicon binary natively on the
Apple Silicon version of macOS.  For more information, see:

  https://developer.apple.com/documentation/macos-release-notes/macos-big-sur-11_0_1-universal-apps-release-notes#:~:text=New%20in%20macOS,pass%20through%20Gatekeeper.

To sign the App Bundle, simply type:

  $ codesign -s IDENTITY TuxPaint-Config.app

... where IDENTITY is your Apple Developer ID.  If you do not have an Apple
Developer ID, you can sign the App Bundle using the ad-hoc identity, "-" (the
hyphen).


BUILDING THE UNIVERSAL BUNDLE
-----------------------------
To build the universal bundle:

  1. Build TuxPaint-Config.app on the Intel version of macOS.  Rename it to
     TuxPaint-Config-x86_64.app.

  2. Build TuxPaint-Config.app on the Apple Silicon version of macOS.  Rename it
     to TuxPaint-Config-arm64.app.

  3. Copy TuxPaint-Config-x86_64.app to the Apple Silicon version of macOS, to
     the same directory as TuxPaint-Config-arm64.app.

  4. Run `macos/build-universal.sh` to combine the two versions of the app
     bundles into the Universal Bundle, TuxPaint-Config.app

  5. Unsign the universal bundle if it's already signed:

       codesign --remove-signature TuxPaint-Config.app

  6. Sign the universal bundle since all Apple Silicon app bundles must be
     signed:

       codesign -s - TuxPaint-Config.app  # (or use your own Apple Developer ID)


BACKWARD COMPATIBILITY
----------------------
As with Tux Paint, Tux Paint Config built on a specific version of macOS only
works on that version of macOS and later.  To build a binary that is as
backward compatible as possible, build Tux Paint Config on the oldest version
of macOS available to you, or build all MacPorts libraries from the source code
as described in the Tux Paint's docs/[locale]/INSTALL.txt document.

