-
Notifications
You must be signed in to change notification settings - Fork 8k
Basic PIE downloader flag --with-pie #21524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
asgrim
wants to merge
4
commits into
php:master
Choose a base branch
from
asgrim:add-pie-installer
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+84
−1
Draft
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| piedir=$(PIE_INSTALLDIR) | ||
|
|
||
| PIE_PHP_FLAGS = -dmemory_limit=-1 | ||
|
|
||
| CURL = `which curl 2>/dev/null` | ||
| WGET = `which wget 2>/dev/null` | ||
| FETCH = `which fetch 2>/dev/null` | ||
| FETCH_PHP = $(top_srcdir)/pear/fetch.php | ||
| GH = `which gh 2>/dev/null` | ||
| PIE_PHAR_URL = https://github.com/php/pie/releases/latest/download/pie.phar | ||
| PIE_PHAR_TEMP_DL_LOCATION = $(top_srcdir)/pie/pie_temp.phar | ||
| PIE_PHAR_DESTINATION = $(INSTALL_ROOT)$(piedir)/pie | ||
|
|
||
| $(PIE_PHAR_DESTINATION): | ||
| @echo "Installing PIE: $(PIE_PHAR_DESTINATION)" | ||
| # First, figure out a way to download the phar, with curl, wget, fetch, or a backup PHP script... | ||
| @if test ! -z "$(CURL)" && test -x "$(CURL)"; then \ | ||
| "$(CURL)" --no-progress-meter --silent --location "${PIE_PHAR_URL}" --output $(PIE_PHAR_TEMP_DL_LOCATION); \ | ||
| elif test ! -z "$(WGET)" && test -x "$(WGET)"; then \ | ||
| "$(WGET)" "${PIE_PHAR_URL}" --quiet --no-directories --output-document=$(PIE_PHAR_TEMP_DL_LOCATION); \ | ||
| elif test ! -z "$(FETCH)" && test -x "$(FETCH)"; then \ | ||
| "$(FETCH)" -o $(PIE_PHAR_TEMP_DL_LOCATION) "${PIE_PHAR_URL}"; \ | ||
| else \ | ||
| $(top_builddir)/sapi/cli/php -n "${FETCH_PHP}" "${PIE_PHAR_URL}" $(PIE_PHAR_TEMP_DL_LOCATION) ; \ | ||
| fi | ||
| # Try to verify using `gh` CLI, or if not use `self-verify` (which isn't the best, since it could already have been tampered) | ||
| @if test ! -z "$(GH)" && test -x "$(GH)"; then \ | ||
| "$(GH)" attestation verify --owner=php $(PIE_PHAR_TEMP_DL_LOCATION); \ | ||
| else \ | ||
| $(top_builddir)/sapi/cli/php $(PIE_PHP_FLAGS) $(PIE_PHAR_TEMP_DL_LOCATION) self-verify; \ | ||
| fi | ||
| # Once verified, move it to the real location | ||
| @mv $(PIE_PHAR_TEMP_DL_LOCATION) $(PIE_PHAR_DESTINATION) | ||
| @chmod +x $(PIE_PHAR_DESTINATION) | ||
|
|
||
| .PHONY: install-pie | ||
| install-pie: $(PIE_PHAR_DESTINATION) | ||
| @$(top_builddir)/sapi/cli/php $(PIE_PHP_FLAGS) $(PIE_PHAR_DESTINATION) self-update > /dev/null 2>&1 | ||
| @$(top_builddir)/sapi/cli/php $(PIE_PHP_FLAGS) $(PIE_PHAR_DESTINATION) --version | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # PIE downloader | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. General question to reviewers; what is the earliest version of PHP we could get this into? PIE supports PHP 8.1+, so ideally that, but obviously it is out of support, so won't actually get any new releases. I suppose it would be PHP 8.4+? |
||
|
|
||
| When building PHP, supply the `--with-pie` flag. This will attempt to download | ||
| the latest stable version of PIE, using `curl`, `wget`, `fetch`, or a PHP script. | ||
|
|
||
| By default it will download PIE to `$prefix/bin/pie`. You can change | ||
| the target path, e.g. `--with-pie=/usr/local/bin`, which will cause PIE to be | ||
| downloaded to `/usr/local/bin/pie`. | ||
|
|
||
| If the `gh` CLI tool exists on the system, it will be used to verify that the | ||
| PIE that is downloaded was built within PHP's CI system. If not, the | ||
| `pie self-verify` command is used, but this has limited benefit. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.