From c9dcd34f33f62f350a814e10dc45acd6e4247fd7 Mon Sep 17 00:00:00 2001 From: Venca Krecl Date: Sun, 19 Jul 2026 17:34:16 +0200 Subject: [PATCH 1/2] Add PIE support (GH-56) Add a composer.json with the `php-ext` type and metadata required by PIE (https://github.com/php/pie), the modern replacement for PECL, so the extension can be installed via `pie install php-gnupg/gnupg`. The `configure-options` mirror the flags exposed by config.m4 (`--with-gnupg`, `--with-gpg`). Windows is excluded via `os-families-exclude` since GpgME builds supported by PHP are unavailable there. Document the PIE install method in the README. Co-Authored-By: Claude Opus 4.8 (1M context) --- README.md | 9 +++++++++ composer.json | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 composer.json diff --git a/README.md b/README.md index 005500b..1db212c 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,15 @@ is supported is 1.3.0. The extension supports GnuPG version 1 and 2. Of course PHP has to be installed too. The minimal version that is supported is 5.3.2. +#### PIE + +This extension can be installed with [PIE](https://github.com/php/pie), the modern +successor to PECL. + +``` +$ pie install php-gnupg/gnupg +``` + #### PECL This extension is available on PECL. diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..3175618 --- /dev/null +++ b/composer.json @@ -0,0 +1,34 @@ +{ + "name": "php-gnupg/gnupg", + "description": "A wrapper around the GpgME library that provides access to GnuPG.", + "type": "php-ext", + "license": "BSD-2-Clause", + "keywords": ["gnupg", "gpg", "gpgme", "encryption", "signing", "extension"], + "homepage": "https://github.com/php-gnupg/php-gnupg", + "support": { + "issues": "https://github.com/php-gnupg/php-gnupg/issues", + "source": "https://github.com/php-gnupg/php-gnupg", + "docs": "https://www.php.net/manual/en/book.gnupg.php" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "php-ext": { + "extension-name": "gnupg", + "support-zts": true, + "support-nts": true, + "os-families-exclude": ["windows"], + "configure-options": [ + { + "name": "with-gnupg", + "description": "Include gnupg support, optionally specifying the path to the GpgME installation (directory containing include/gpgme.h)", + "needs-value": true + }, + { + "name": "with-gpg", + "description": "Path to the gpg v1.x binary", + "needs-value": true + } + ] + } +} From 769f032a7c72a7d30afd5f428525c32e01ed4ef2 Mon Sep 17 00:00:00 2001 From: Venca Krecl Date: Sun, 19 Jul 2026 17:37:31 +0200 Subject: [PATCH 2/2] Add CI job that installs the extension with PIE Prove the composer.json works end to end: a `pie-install` job downloads a pinned pie.phar, runs `pie install` from the checkout, and verifies the gnupg extension is loaded. Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/ci.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4cafb1e..b7a2779 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,3 +36,32 @@ jobs: - name: Run tests run: | make test + + pie-install: + runs-on: ubuntu-24.04 + env: + PIE_VERSION: "1.4.8" + + steps: + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y gpg gpgsm libgpgme-dev php-cli php-dev autoconf libtool make gcc + + - name: Checkout php-gnupg + uses: actions/checkout@v4 + with: + submodules: true + + - name: Download pie.phar + run: | + curl -fsSL -o pie.phar \ + "https://github.com/php/pie/releases/download/${PIE_VERSION}/pie.phar" + + - name: Install php-gnupg with PIE + # PIE builds as the current user and auto-elevates with sudo (passwordless + # in GitHub Actions) only for the final install step. + run: php pie.phar install + + - name: Verify the extension is loaded + run: php -m | grep -qx gnupg