Licenses: PHP in the app

The Mailgist app for Mac and Windows runs on a bundled PHP interpreter. It contains libraries under the GNU LGPL 2.1 — you may modify them, rebuild PHP and put your own build into the installed app. Below: what is included, how we build PHP and how to replace it.

Mailgist 0.9.11PHP 8.5.12

What is included and under which licenses

Mac: how we build PHP

PHP for Mac is built statically with static-php-cli 2.8.5 (MIT), then rebuilt against the system iconv. You need macOS 14+ and the Xcode Command Line Tools.

  1. Download spc and verify its sha256:
    curl -LO https://github.com/crazywhalecc/static-php-cli/releases/download/2.8.5/spc-macos-aarch64.tar.gz
    shasum -a 256 spc-macos-aarch64.tar.gz
    # Apple Silicon: acf2f25d56d0cbf8e65aa82e5054fef555f7be7c5c38046c6e0819f266d83225
    # Intel (spc-macos-x86_64.tar.gz): e8b798048f62ca4960764196543b60ae703f7174aa418824cf542aeec1d2cd6a
    tar xzf spc-macos-aarch64.tar.gz
  2. Build PHP with the same extensions:
    EXTS="ctype,curl,dom,fileinfo,filter,iconv,mbstring,mbregex,openssl,pcntl,pdo,pdo_sqlite,phar,posix,session,simplexml,sodium,sqlite3,tokenizer,xml,xmlreader,xmlwriter,zip,zlib"
    ./spc doctor --auto-fix
    ./spc download --with-php=8.5.12 --for-extensions="$EXTS" --prefer-pre-built
    ./spc build --build-cli "$EXTS"
  3. Our relink step with the macOS iconv (so that GNU libiconv is not linked in):
    • remove libiconv.*, libcharset.*, their .pc files and the headers iconv.h, libcharset.h, localcharset.h from buildroot;
    • rebuild libxml2 with the same cmake command from the spc log (log/spc.shell.log), adding -DIconv_IS_BUILT_IN=FALSE -DIconv_INCLUDE_DIR=$(xcrun --show-sdk-path)/usr/include -DIconv_LIBRARY=$(xcrun --show-sdk-path)/usr/lib/libiconv.tbd, and remove -liconv from libxml-2.0.pc;
    • in source/php-src: make clean, ./configure with the arguments from ./config.status --config, with --with-iconv= replaced by $(xcrun --show-sdk-path)/usr, then the same make … cli command from the spc log, without -lcharset;
    • strip -S sapi/cli/php, delete the rpath entries (install_name_tool -delete_rpath) and sign ad hoc: codesign -f -s - php.
  4. Check: otool -L php shows /usr/lib/libiconv.2.dylib, and php -m lists all the extensions.

To use a modified libmbfl, change the sources in source/php-src/ext/mbstring/libmbfl and repeat the last PHP build step. We will send our complete build script on request.

Windows: which PHP we use

On Windows we use the official build from windows.php.net, unmodified: php-8.5.12-nts-Win32-vs17-x64.zip, sha256 2ab242af38d76bdf417cde5ec048b1bcd76a5a40f39a3d15d5f046f38571c477. From it we take php.exe, the core DLLs and the curl, fileinfo, mbstring, openssl, pdo_sqlite, sodium, sqlite3 and zip extensions.

Sources of this build: php-8.5.12-src.zip; build tools — php-sdk-binary-tools; dependency libraries (including libiconv) — downloads.php.net/~windows/php-sdk/deps. The build procedure is in the PHP guide.

How to replace PHP in the installed app

  • Mac. Quit Mailgist. The file is /Applications/Mailgist.app/Contents/MacOS/php. Replace it with your build and re-sign the app: codesign --force --deep --sign - /Applications/Mailgist.app. This removes the developer signature, so macOS may ask for confirmation on the next launch.
  • Windows. Quit Mailgist. The folder is %LOCALAPPDATA%\Mailgist\php\. Replace php.exe, php8.dll or ext\php_mbstring.dll with your own files built from the same PHP version.

An app update restores our build — repeat the replacement afterwards. Use the same PHP version and the same set of extensions, otherwise the app may fail to start.

Copy of the sources

On request to support@mailgist.app we will send a copy of the sources of the LGPL libraries and PHP in exactly the versions included in the app, together with our build script. This offer is valid for at least three years from the release of each app version.

Terms of Use →   Privacy →