From fecdb31648e1552591d663c4055c566871621144 Mon Sep 17 00:00:00 2001 From: Venca Date: Tue, 24 Nov 2026 22:05:09 +0100 Subject: [PATCH] Add PIE support (GH-56) (#65) Declare the extension metadata and GpgME dependency for PIE, document installation, and verify a PIE install from the checkout in CI. --- .github/workflows/ci.yml | 34 ++++++++++++++++++++++++++++++++++ README.md | 9 +++++++++ composer.json | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 composer.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ce6b8a..b8c22dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -122,3 +122,37 @@ jobs: - name: Run tests run: make test + + pie-install: + runs-on: ubuntu-24.04 + env: + PIE_VERSION: "1.5.0" + + 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 "$RUNNER_TEMP/pie.phar" \ + "https://github.com/php/pie/releases/download/${PIE_VERSION}/pie.phar" + + - name: Install php-gnupg with PIE + env: + INSTALL_ROOT: ${{ runner.temp }}/pie-install + run: | + mkdir -p "$INSTALL_ROOT$(php-config --extension-dir)" + php "$RUNNER_TEMP/pie.phar" repository:add path "$GITHUB_WORKSPACE" + php "$RUNNER_TEMP/pie.phar" install --no-interaction --skip-enable-extension 'php-gnupg/gnupg:@dev' + + - name: Verify the extension is loaded + env: + INSTALL_ROOT: ${{ runner.temp }}/pie-install + run: php -n -d "extension=$INSTALL_ROOT$(php-config --extension-dir)/gnupg.so" -m | grep -qx gnupg diff --git a/README.md b/README.md index 005500b..0995e9a 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) 1.5.0 or later, 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..faddb54 --- /dev/null +++ b/composer.json @@ -0,0 +1,35 @@ +{ + "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", + "lib-gpgme": ">=1.3.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 + } + ] + } +}