-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add PECL wrapper commands #1339
Closed
Closed
Changes from 1 commit
Commits
Show all changes
3 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 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 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 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,59 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
# prefer user supplied CFLAGS, but default to our PHP_CFLAGS | ||
: ${CFLAGS:=$PHP_CFLAGS} | ||
: ${CPPFLAGS:=$PHP_CPPFLAGS} | ||
: ${LDFLAGS:=$PHP_LDFLAGS} | ||
export CFLAGS CPPFLAGS LDFLAGS | ||
|
||
usage() { | ||
echo "usage: $0 ext-name [configure flags]" | ||
echo " ie: $0 apcu --enable-apcu-spinlocks" | ||
echo " $0 -j5 apcu redis grpc protobuf" | ||
echo | ||
echo 'if custom ./configure arguments are necessary, see docker-php-pecl-configure' | ||
} | ||
|
||
if [ ! -d $tmpDir ]; then | ||
if [ -e $tmpdir ]; then | ||
rm -rf $tmpDir | ||
fi | ||
mkdir -p $tmpDir | ||
fi | ||
|
||
ext="$1" | ||
if [ -z "$ext" ]; then | ||
usage >&2 | ||
exit 1 | ||
fi | ||
shift | ||
|
||
pm='unknown' | ||
if [ -e /lib/apk/db/installed ]; then | ||
pm='apk' | ||
fi | ||
|
||
if [ "$pm" = 'apk' ]; then | ||
if \ | ||
[ -n "$PHPIZE_DEPS" ] \ | ||
&& ! apk info --installed .phpize-deps > /dev/null \ | ||
&& ! apk info --installed .phpize-deps-configure > /dev/null \ | ||
; then | ||
apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS | ||
fi | ||
fi | ||
|
||
if command -v dpkg-architecture > /dev/null; then | ||
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" | ||
set -- --build="$gnuArch" "$@" | ||
fi | ||
|
||
if [ ! -z "$http_proxy" ]; then | ||
pear config-set http_proxy $http_proxy | ||
fi | ||
|
||
pecl install --onlyreqdeps --nobuild "$ext" | ||
cd "/tmp/pear/temp/$ext" | ||
phpize | ||
./configure --enable-option-checking=fatal "$@" |
This file contains 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,89 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
# prefer user supplied CFLAGS, but default to our PHP_CFLAGS | ||
: ${CFLAGS:=$PHP_CFLAGS} | ||
: ${CPPFLAGS:=$PHP_CPPFLAGS} | ||
: ${LDFLAGS:=$PHP_LDFLAGS} | ||
export CFLAGS CPPFLAGS LDFLAGS | ||
|
||
usage() { | ||
echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" | ||
echo " ie: $0 apcu redis" | ||
echo " $0 -j5 apcu redis grpc protobuf" | ||
echo | ||
echo 'if custom ./configure arguments are necessary, see docker-php-pecl-configure' | ||
} | ||
|
||
opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" | ||
eval set -- "$opts" | ||
|
||
j=1 | ||
iniName= | ||
while true; do | ||
flag="$1" | ||
shift | ||
case "$flag" in | ||
--help|-h|'-?') usage && exit 0 ;; | ||
--ini-name) iniName="$1" && shift ;; | ||
--jobs|-j) j="$1" && shift ;; | ||
--) break ;; | ||
*) | ||
{ | ||
echo "error: unknown flag: $flag" | ||
usage | ||
} >&2 | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
exts= | ||
for ext; do | ||
if [ -z "$ext" ]; then | ||
continue | ||
fi | ||
exts="$exts $ext" | ||
done | ||
|
||
if [ -z "$exts" ]; then | ||
usage >&2 | ||
exit 1 | ||
fi | ||
|
||
popDir="$PWD" | ||
for ext in $exts; do | ||
docker-php-pecl-configure "$ext" | ||
cd "/tmp/pear/temp/$ext" | ||
|
||
make -j"$j" | ||
|
||
if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then | ||
# only "strip" modules if we aren't using a debug build of PHP | ||
# (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) | ||
# https://github.com/docker-library/php/issues/1268 | ||
|
||
find modules \ | ||
-maxdepth 1 \ | ||
-name '*.so' \ | ||
-exec sh -euxc ' \ | ||
strip --strip-all "$@" || : | ||
' -- '{}' + | ||
fi | ||
|
||
make -j"$j" install | ||
|
||
find modules \ | ||
-maxdepth 1 \ | ||
-name '*.so' \ | ||
-exec basename '{}' ';' \ | ||
| xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} | ||
|
||
make -j"$j" clean | ||
|
||
cd "$popDir" | ||
done | ||
|
||
if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then | ||
apk del --no-network $apkDel | ||
fi |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This refers to itself. Is that correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This is redundant and has been removed.
Error caused by copy & paste.