From bb4874c9af4380bec5c10d3f8bdb1163345d5a72 Mon Sep 17 00:00:00 2001 From: Joe Ferguson Date: Mon, 12 Dec 2016 15:16:09 -0800 Subject: [PATCH 1/2] Switch CFLAGS to PHP_CFLAGS, so we can keep pie without breaking users --- Dockerfile-alpine.template | 9 ++++++--- Dockerfile-debian.template | 9 ++++++--- docker-php-ext-configure | 6 ++++++ docker-php-ext-install | 6 ++++++ 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template index 43e409742..1404280f9 100644 --- a/Dockerfile-alpine.template +++ b/Dockerfile-alpine.template @@ -37,9 +37,9 @@ RUN mkdir -p $PHP_INI_DIR/conf.d # Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) # Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) # https://github.com/docker-library/php/issues/272 -ENV CFLAGS="-fstack-protector-strong -fpic -fpie -O2" -ENV CPPFLAGS="$CFLAGS" -ENV LDFLAGS="-Wl,-O1 -Wl,--hash-style=both" +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" ENV GPG_KEYS %%GPG_KEYS%% @@ -89,6 +89,9 @@ RUN set -xe \ openssl-dev \ sqlite-dev \ \ + && export CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ && docker-php-source extract \ && cd /usr/src/php \ && ./configure \ diff --git a/Dockerfile-debian.template b/Dockerfile-debian.template index 2f4de9cd8..896f1b17b 100644 --- a/Dockerfile-debian.template +++ b/Dockerfile-debian.template @@ -32,9 +32,9 @@ RUN mkdir -p $PHP_INI_DIR/conf.d # Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) # Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) # https://github.com/docker-library/php/issues/272 -ENV CFLAGS="-fstack-protector-strong -fpic -fpie -O2" -ENV CPPFLAGS="$CFLAGS" -ENV LDFLAGS="-Wl,-O1 -Wl,--hash-style=both" +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" ENV GPG_KEYS %%GPG_KEYS%% @@ -88,6 +88,9 @@ RUN set -xe \ " \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ \ + && export CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ && docker-php-source extract \ && cd /usr/src/php \ && ./configure \ diff --git a/docker-php-ext-configure b/docker-php-ext-configure index 2a6f8394e..93d31601c 100755 --- a/docker-php-ext-configure +++ b/docker-php-ext-configure @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/docker-php-ext-install b/docker-php-ext-install index 79df34e17..c06602302 100755 --- a/docker-php-ext-install +++ b/docker-php-ext-install @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 From 9f2e76eeba464f20798faaea172416340e3099c1 Mon Sep 17 00:00:00 2001 From: Joe Ferguson Date: Mon, 12 Dec 2016 15:21:44 -0800 Subject: [PATCH 2/2] Update.sh: apply "CFLAGS -> PHP_CFLAGS" to all the things --- 5.6/Dockerfile | 9 ++++++--- 5.6/alpine/Dockerfile | 9 ++++++--- 5.6/alpine/docker-php-ext-configure | 6 ++++++ 5.6/alpine/docker-php-ext-install | 6 ++++++ 5.6/apache/Dockerfile | 9 ++++++--- 5.6/apache/docker-php-ext-configure | 6 ++++++ 5.6/apache/docker-php-ext-install | 6 ++++++ 5.6/docker-php-ext-configure | 6 ++++++ 5.6/docker-php-ext-install | 6 ++++++ 5.6/fpm/Dockerfile | 9 ++++++--- 5.6/fpm/alpine/Dockerfile | 9 ++++++--- 5.6/fpm/alpine/docker-php-ext-configure | 6 ++++++ 5.6/fpm/alpine/docker-php-ext-install | 6 ++++++ 5.6/fpm/docker-php-ext-configure | 6 ++++++ 5.6/fpm/docker-php-ext-install | 6 ++++++ 5.6/zts/Dockerfile | 9 ++++++--- 5.6/zts/alpine/Dockerfile | 9 ++++++--- 5.6/zts/alpine/docker-php-ext-configure | 6 ++++++ 5.6/zts/alpine/docker-php-ext-install | 6 ++++++ 5.6/zts/docker-php-ext-configure | 6 ++++++ 5.6/zts/docker-php-ext-install | 6 ++++++ 7.0/Dockerfile | 9 ++++++--- 7.0/alpine/Dockerfile | 9 ++++++--- 7.0/alpine/docker-php-ext-configure | 6 ++++++ 7.0/alpine/docker-php-ext-install | 6 ++++++ 7.0/apache/Dockerfile | 9 ++++++--- 7.0/apache/docker-php-ext-configure | 6 ++++++ 7.0/apache/docker-php-ext-install | 6 ++++++ 7.0/docker-php-ext-configure | 6 ++++++ 7.0/docker-php-ext-install | 6 ++++++ 7.0/fpm/Dockerfile | 9 ++++++--- 7.0/fpm/alpine/Dockerfile | 9 ++++++--- 7.0/fpm/alpine/docker-php-ext-configure | 6 ++++++ 7.0/fpm/alpine/docker-php-ext-install | 6 ++++++ 7.0/fpm/docker-php-ext-configure | 6 ++++++ 7.0/fpm/docker-php-ext-install | 6 ++++++ 7.0/zts/Dockerfile | 9 ++++++--- 7.0/zts/alpine/Dockerfile | 9 ++++++--- 7.0/zts/alpine/docker-php-ext-configure | 6 ++++++ 7.0/zts/alpine/docker-php-ext-install | 6 ++++++ 7.0/zts/docker-php-ext-configure | 6 ++++++ 7.0/zts/docker-php-ext-install | 6 ++++++ 7.1/Dockerfile | 9 ++++++--- 7.1/alpine/Dockerfile | 9 ++++++--- 7.1/alpine/docker-php-ext-configure | 6 ++++++ 7.1/alpine/docker-php-ext-install | 6 ++++++ 7.1/apache/Dockerfile | 9 ++++++--- 7.1/apache/docker-php-ext-configure | 6 ++++++ 7.1/apache/docker-php-ext-install | 6 ++++++ 7.1/docker-php-ext-configure | 6 ++++++ 7.1/docker-php-ext-install | 6 ++++++ 7.1/fpm/Dockerfile | 9 ++++++--- 7.1/fpm/alpine/Dockerfile | 9 ++++++--- 7.1/fpm/alpine/docker-php-ext-configure | 6 ++++++ 7.1/fpm/alpine/docker-php-ext-install | 6 ++++++ 7.1/fpm/docker-php-ext-configure | 6 ++++++ 7.1/fpm/docker-php-ext-install | 6 ++++++ 7.1/zts/Dockerfile | 9 ++++++--- 7.1/zts/alpine/Dockerfile | 9 ++++++--- 7.1/zts/alpine/docker-php-ext-configure | 6 ++++++ 7.1/zts/alpine/docker-php-ext-install | 6 ++++++ 7.1/zts/docker-php-ext-configure | 6 ++++++ 7.1/zts/docker-php-ext-install | 6 ++++++ 63 files changed, 378 insertions(+), 63 deletions(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index 89f6fe4bd..fcd72a124 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -38,9 +38,9 @@ RUN mkdir -p $PHP_INI_DIR/conf.d # Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) # Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) # https://github.com/docker-library/php/issues/272 -ENV CFLAGS="-fstack-protector-strong -fpic -fpie -O2" -ENV CPPFLAGS="$CFLAGS" -ENV LDFLAGS="-Wl,-O1 -Wl,--hash-style=both" +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" ENV GPG_KEYS 0BD78B5F97500D450838F95DFE857D9A90D90EC1 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3 @@ -94,6 +94,9 @@ RUN set -xe \ " \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ \ + && export CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ && docker-php-source extract \ && cd /usr/src/php \ && ./configure \ diff --git a/5.6/alpine/Dockerfile b/5.6/alpine/Dockerfile index 9a73a7929..ac77397e6 100644 --- a/5.6/alpine/Dockerfile +++ b/5.6/alpine/Dockerfile @@ -43,9 +43,9 @@ RUN mkdir -p $PHP_INI_DIR/conf.d # Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) # Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) # https://github.com/docker-library/php/issues/272 -ENV CFLAGS="-fstack-protector-strong -fpic -fpie -O2" -ENV CPPFLAGS="$CFLAGS" -ENV LDFLAGS="-Wl,-O1 -Wl,--hash-style=both" +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" ENV GPG_KEYS 0BD78B5F97500D450838F95DFE857D9A90D90EC1 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3 @@ -95,6 +95,9 @@ RUN set -xe \ openssl-dev \ sqlite-dev \ \ + && export CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ && docker-php-source extract \ && cd /usr/src/php \ && ./configure \ diff --git a/5.6/alpine/docker-php-ext-configure b/5.6/alpine/docker-php-ext-configure index 2a6f8394e..93d31601c 100755 --- a/5.6/alpine/docker-php-ext-configure +++ b/5.6/alpine/docker-php-ext-configure @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/5.6/alpine/docker-php-ext-install b/5.6/alpine/docker-php-ext-install index 79df34e17..c06602302 100755 --- a/5.6/alpine/docker-php-ext-install +++ b/5.6/alpine/docker-php-ext-install @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/5.6/apache/Dockerfile b/5.6/apache/Dockerfile index 31d5a50b3..aa8222441 100644 --- a/5.6/apache/Dockerfile +++ b/5.6/apache/Dockerfile @@ -94,9 +94,9 @@ ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2 # Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) # Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) # https://github.com/docker-library/php/issues/272 -ENV CFLAGS="-fstack-protector-strong -fpic -fpie -O2" -ENV CPPFLAGS="$CFLAGS" -ENV LDFLAGS="-Wl,-O1 -Wl,--hash-style=both" +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" ENV GPG_KEYS 0BD78B5F97500D450838F95DFE857D9A90D90EC1 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3 @@ -150,6 +150,9 @@ RUN set -xe \ " \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ \ + && export CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ && docker-php-source extract \ && cd /usr/src/php \ && ./configure \ diff --git a/5.6/apache/docker-php-ext-configure b/5.6/apache/docker-php-ext-configure index 2a6f8394e..93d31601c 100755 --- a/5.6/apache/docker-php-ext-configure +++ b/5.6/apache/docker-php-ext-configure @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/5.6/apache/docker-php-ext-install b/5.6/apache/docker-php-ext-install index 79df34e17..c06602302 100755 --- a/5.6/apache/docker-php-ext-install +++ b/5.6/apache/docker-php-ext-install @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/5.6/docker-php-ext-configure b/5.6/docker-php-ext-configure index 2a6f8394e..93d31601c 100755 --- a/5.6/docker-php-ext-configure +++ b/5.6/docker-php-ext-configure @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/5.6/docker-php-ext-install b/5.6/docker-php-ext-install index 79df34e17..c06602302 100755 --- a/5.6/docker-php-ext-install +++ b/5.6/docker-php-ext-install @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/5.6/fpm/Dockerfile b/5.6/fpm/Dockerfile index d7536790e..521fdba86 100644 --- a/5.6/fpm/Dockerfile +++ b/5.6/fpm/Dockerfile @@ -39,9 +39,9 @@ ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-gr # Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) # Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) # https://github.com/docker-library/php/issues/272 -ENV CFLAGS="-fstack-protector-strong -fpic -fpie -O2" -ENV CPPFLAGS="$CFLAGS" -ENV LDFLAGS="-Wl,-O1 -Wl,--hash-style=both" +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" ENV GPG_KEYS 0BD78B5F97500D450838F95DFE857D9A90D90EC1 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3 @@ -95,6 +95,9 @@ RUN set -xe \ " \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ \ + && export CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ && docker-php-source extract \ && cd /usr/src/php \ && ./configure \ diff --git a/5.6/fpm/alpine/Dockerfile b/5.6/fpm/alpine/Dockerfile index ab9a90f4a..afdd7d28e 100644 --- a/5.6/fpm/alpine/Dockerfile +++ b/5.6/fpm/alpine/Dockerfile @@ -44,9 +44,9 @@ ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-gr # Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) # Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) # https://github.com/docker-library/php/issues/272 -ENV CFLAGS="-fstack-protector-strong -fpic -fpie -O2" -ENV CPPFLAGS="$CFLAGS" -ENV LDFLAGS="-Wl,-O1 -Wl,--hash-style=both" +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" ENV GPG_KEYS 0BD78B5F97500D450838F95DFE857D9A90D90EC1 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3 @@ -96,6 +96,9 @@ RUN set -xe \ openssl-dev \ sqlite-dev \ \ + && export CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ && docker-php-source extract \ && cd /usr/src/php \ && ./configure \ diff --git a/5.6/fpm/alpine/docker-php-ext-configure b/5.6/fpm/alpine/docker-php-ext-configure index 2a6f8394e..93d31601c 100755 --- a/5.6/fpm/alpine/docker-php-ext-configure +++ b/5.6/fpm/alpine/docker-php-ext-configure @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/5.6/fpm/alpine/docker-php-ext-install b/5.6/fpm/alpine/docker-php-ext-install index 79df34e17..c06602302 100755 --- a/5.6/fpm/alpine/docker-php-ext-install +++ b/5.6/fpm/alpine/docker-php-ext-install @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/5.6/fpm/docker-php-ext-configure b/5.6/fpm/docker-php-ext-configure index 2a6f8394e..93d31601c 100755 --- a/5.6/fpm/docker-php-ext-configure +++ b/5.6/fpm/docker-php-ext-configure @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/5.6/fpm/docker-php-ext-install b/5.6/fpm/docker-php-ext-install index 79df34e17..c06602302 100755 --- a/5.6/fpm/docker-php-ext-install +++ b/5.6/fpm/docker-php-ext-install @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/5.6/zts/Dockerfile b/5.6/zts/Dockerfile index 4895987b5..63f17f9f1 100644 --- a/5.6/zts/Dockerfile +++ b/5.6/zts/Dockerfile @@ -39,9 +39,9 @@ ENV PHP_EXTRA_CONFIGURE_ARGS --enable-maintainer-zts # Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) # Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) # https://github.com/docker-library/php/issues/272 -ENV CFLAGS="-fstack-protector-strong -fpic -fpie -O2" -ENV CPPFLAGS="$CFLAGS" -ENV LDFLAGS="-Wl,-O1 -Wl,--hash-style=both" +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" ENV GPG_KEYS 0BD78B5F97500D450838F95DFE857D9A90D90EC1 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3 @@ -95,6 +95,9 @@ RUN set -xe \ " \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ \ + && export CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ && docker-php-source extract \ && cd /usr/src/php \ && ./configure \ diff --git a/5.6/zts/alpine/Dockerfile b/5.6/zts/alpine/Dockerfile index 29bcf7cfe..688e5c756 100644 --- a/5.6/zts/alpine/Dockerfile +++ b/5.6/zts/alpine/Dockerfile @@ -44,9 +44,9 @@ ENV PHP_EXTRA_CONFIGURE_ARGS --enable-maintainer-zts # Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) # Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) # https://github.com/docker-library/php/issues/272 -ENV CFLAGS="-fstack-protector-strong -fpic -fpie -O2" -ENV CPPFLAGS="$CFLAGS" -ENV LDFLAGS="-Wl,-O1 -Wl,--hash-style=both" +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" ENV GPG_KEYS 0BD78B5F97500D450838F95DFE857D9A90D90EC1 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3 @@ -96,6 +96,9 @@ RUN set -xe \ openssl-dev \ sqlite-dev \ \ + && export CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ && docker-php-source extract \ && cd /usr/src/php \ && ./configure \ diff --git a/5.6/zts/alpine/docker-php-ext-configure b/5.6/zts/alpine/docker-php-ext-configure index 2a6f8394e..93d31601c 100755 --- a/5.6/zts/alpine/docker-php-ext-configure +++ b/5.6/zts/alpine/docker-php-ext-configure @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/5.6/zts/alpine/docker-php-ext-install b/5.6/zts/alpine/docker-php-ext-install index 79df34e17..c06602302 100755 --- a/5.6/zts/alpine/docker-php-ext-install +++ b/5.6/zts/alpine/docker-php-ext-install @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/5.6/zts/docker-php-ext-configure b/5.6/zts/docker-php-ext-configure index 2a6f8394e..93d31601c 100755 --- a/5.6/zts/docker-php-ext-configure +++ b/5.6/zts/docker-php-ext-configure @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/5.6/zts/docker-php-ext-install b/5.6/zts/docker-php-ext-install index 79df34e17..c06602302 100755 --- a/5.6/zts/docker-php-ext-install +++ b/5.6/zts/docker-php-ext-install @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/7.0/Dockerfile b/7.0/Dockerfile index 6ce44750d..71b0e2bd8 100644 --- a/7.0/Dockerfile +++ b/7.0/Dockerfile @@ -38,9 +38,9 @@ RUN mkdir -p $PHP_INI_DIR/conf.d # Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) # Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) # https://github.com/docker-library/php/issues/272 -ENV CFLAGS="-fstack-protector-strong -fpic -fpie -O2" -ENV CPPFLAGS="$CFLAGS" -ENV LDFLAGS="-Wl,-O1 -Wl,--hash-style=both" +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" ENV GPG_KEYS 1A4E8B7277C42E53DBA9C7B9BCAA30EA9C0D5763 @@ -94,6 +94,9 @@ RUN set -xe \ " \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ \ + && export CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ && docker-php-source extract \ && cd /usr/src/php \ && ./configure \ diff --git a/7.0/alpine/Dockerfile b/7.0/alpine/Dockerfile index 0fea38bc5..b42ea7504 100644 --- a/7.0/alpine/Dockerfile +++ b/7.0/alpine/Dockerfile @@ -43,9 +43,9 @@ RUN mkdir -p $PHP_INI_DIR/conf.d # Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) # Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) # https://github.com/docker-library/php/issues/272 -ENV CFLAGS="-fstack-protector-strong -fpic -fpie -O2" -ENV CPPFLAGS="$CFLAGS" -ENV LDFLAGS="-Wl,-O1 -Wl,--hash-style=both" +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" ENV GPG_KEYS 1A4E8B7277C42E53DBA9C7B9BCAA30EA9C0D5763 @@ -95,6 +95,9 @@ RUN set -xe \ openssl-dev \ sqlite-dev \ \ + && export CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ && docker-php-source extract \ && cd /usr/src/php \ && ./configure \ diff --git a/7.0/alpine/docker-php-ext-configure b/7.0/alpine/docker-php-ext-configure index 2a6f8394e..93d31601c 100755 --- a/7.0/alpine/docker-php-ext-configure +++ b/7.0/alpine/docker-php-ext-configure @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/7.0/alpine/docker-php-ext-install b/7.0/alpine/docker-php-ext-install index 79df34e17..c06602302 100755 --- a/7.0/alpine/docker-php-ext-install +++ b/7.0/alpine/docker-php-ext-install @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/7.0/apache/Dockerfile b/7.0/apache/Dockerfile index 18a7319fd..5a7cbdfa6 100644 --- a/7.0/apache/Dockerfile +++ b/7.0/apache/Dockerfile @@ -94,9 +94,9 @@ ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2 # Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) # Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) # https://github.com/docker-library/php/issues/272 -ENV CFLAGS="-fstack-protector-strong -fpic -fpie -O2" -ENV CPPFLAGS="$CFLAGS" -ENV LDFLAGS="-Wl,-O1 -Wl,--hash-style=both" +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" ENV GPG_KEYS 1A4E8B7277C42E53DBA9C7B9BCAA30EA9C0D5763 @@ -150,6 +150,9 @@ RUN set -xe \ " \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ \ + && export CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ && docker-php-source extract \ && cd /usr/src/php \ && ./configure \ diff --git a/7.0/apache/docker-php-ext-configure b/7.0/apache/docker-php-ext-configure index 2a6f8394e..93d31601c 100755 --- a/7.0/apache/docker-php-ext-configure +++ b/7.0/apache/docker-php-ext-configure @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/7.0/apache/docker-php-ext-install b/7.0/apache/docker-php-ext-install index 79df34e17..c06602302 100755 --- a/7.0/apache/docker-php-ext-install +++ b/7.0/apache/docker-php-ext-install @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/7.0/docker-php-ext-configure b/7.0/docker-php-ext-configure index 2a6f8394e..93d31601c 100755 --- a/7.0/docker-php-ext-configure +++ b/7.0/docker-php-ext-configure @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/7.0/docker-php-ext-install b/7.0/docker-php-ext-install index 79df34e17..c06602302 100755 --- a/7.0/docker-php-ext-install +++ b/7.0/docker-php-ext-install @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/7.0/fpm/Dockerfile b/7.0/fpm/Dockerfile index f01de3c47..774be771b 100644 --- a/7.0/fpm/Dockerfile +++ b/7.0/fpm/Dockerfile @@ -39,9 +39,9 @@ ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-gr # Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) # Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) # https://github.com/docker-library/php/issues/272 -ENV CFLAGS="-fstack-protector-strong -fpic -fpie -O2" -ENV CPPFLAGS="$CFLAGS" -ENV LDFLAGS="-Wl,-O1 -Wl,--hash-style=both" +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" ENV GPG_KEYS 1A4E8B7277C42E53DBA9C7B9BCAA30EA9C0D5763 @@ -95,6 +95,9 @@ RUN set -xe \ " \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ \ + && export CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ && docker-php-source extract \ && cd /usr/src/php \ && ./configure \ diff --git a/7.0/fpm/alpine/Dockerfile b/7.0/fpm/alpine/Dockerfile index fecf60bb0..f77dfd614 100644 --- a/7.0/fpm/alpine/Dockerfile +++ b/7.0/fpm/alpine/Dockerfile @@ -44,9 +44,9 @@ ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-gr # Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) # Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) # https://github.com/docker-library/php/issues/272 -ENV CFLAGS="-fstack-protector-strong -fpic -fpie -O2" -ENV CPPFLAGS="$CFLAGS" -ENV LDFLAGS="-Wl,-O1 -Wl,--hash-style=both" +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" ENV GPG_KEYS 1A4E8B7277C42E53DBA9C7B9BCAA30EA9C0D5763 @@ -96,6 +96,9 @@ RUN set -xe \ openssl-dev \ sqlite-dev \ \ + && export CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ && docker-php-source extract \ && cd /usr/src/php \ && ./configure \ diff --git a/7.0/fpm/alpine/docker-php-ext-configure b/7.0/fpm/alpine/docker-php-ext-configure index 2a6f8394e..93d31601c 100755 --- a/7.0/fpm/alpine/docker-php-ext-configure +++ b/7.0/fpm/alpine/docker-php-ext-configure @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/7.0/fpm/alpine/docker-php-ext-install b/7.0/fpm/alpine/docker-php-ext-install index 79df34e17..c06602302 100755 --- a/7.0/fpm/alpine/docker-php-ext-install +++ b/7.0/fpm/alpine/docker-php-ext-install @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/7.0/fpm/docker-php-ext-configure b/7.0/fpm/docker-php-ext-configure index 2a6f8394e..93d31601c 100755 --- a/7.0/fpm/docker-php-ext-configure +++ b/7.0/fpm/docker-php-ext-configure @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/7.0/fpm/docker-php-ext-install b/7.0/fpm/docker-php-ext-install index 79df34e17..c06602302 100755 --- a/7.0/fpm/docker-php-ext-install +++ b/7.0/fpm/docker-php-ext-install @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/7.0/zts/Dockerfile b/7.0/zts/Dockerfile index 68c1b2ac9..821480562 100644 --- a/7.0/zts/Dockerfile +++ b/7.0/zts/Dockerfile @@ -39,9 +39,9 @@ ENV PHP_EXTRA_CONFIGURE_ARGS --enable-maintainer-zts # Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) # Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) # https://github.com/docker-library/php/issues/272 -ENV CFLAGS="-fstack-protector-strong -fpic -fpie -O2" -ENV CPPFLAGS="$CFLAGS" -ENV LDFLAGS="-Wl,-O1 -Wl,--hash-style=both" +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" ENV GPG_KEYS 1A4E8B7277C42E53DBA9C7B9BCAA30EA9C0D5763 @@ -95,6 +95,9 @@ RUN set -xe \ " \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ \ + && export CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ && docker-php-source extract \ && cd /usr/src/php \ && ./configure \ diff --git a/7.0/zts/alpine/Dockerfile b/7.0/zts/alpine/Dockerfile index 2872392e3..3238639f6 100644 --- a/7.0/zts/alpine/Dockerfile +++ b/7.0/zts/alpine/Dockerfile @@ -44,9 +44,9 @@ ENV PHP_EXTRA_CONFIGURE_ARGS --enable-maintainer-zts # Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) # Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) # https://github.com/docker-library/php/issues/272 -ENV CFLAGS="-fstack-protector-strong -fpic -fpie -O2" -ENV CPPFLAGS="$CFLAGS" -ENV LDFLAGS="-Wl,-O1 -Wl,--hash-style=both" +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" ENV GPG_KEYS 1A4E8B7277C42E53DBA9C7B9BCAA30EA9C0D5763 @@ -96,6 +96,9 @@ RUN set -xe \ openssl-dev \ sqlite-dev \ \ + && export CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ && docker-php-source extract \ && cd /usr/src/php \ && ./configure \ diff --git a/7.0/zts/alpine/docker-php-ext-configure b/7.0/zts/alpine/docker-php-ext-configure index 2a6f8394e..93d31601c 100755 --- a/7.0/zts/alpine/docker-php-ext-configure +++ b/7.0/zts/alpine/docker-php-ext-configure @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/7.0/zts/alpine/docker-php-ext-install b/7.0/zts/alpine/docker-php-ext-install index 79df34e17..c06602302 100755 --- a/7.0/zts/alpine/docker-php-ext-install +++ b/7.0/zts/alpine/docker-php-ext-install @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/7.0/zts/docker-php-ext-configure b/7.0/zts/docker-php-ext-configure index 2a6f8394e..93d31601c 100755 --- a/7.0/zts/docker-php-ext-configure +++ b/7.0/zts/docker-php-ext-configure @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/7.0/zts/docker-php-ext-install b/7.0/zts/docker-php-ext-install index 79df34e17..c06602302 100755 --- a/7.0/zts/docker-php-ext-install +++ b/7.0/zts/docker-php-ext-install @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/7.1/Dockerfile b/7.1/Dockerfile index 9acdbc82e..5668b5de1 100644 --- a/7.1/Dockerfile +++ b/7.1/Dockerfile @@ -38,9 +38,9 @@ RUN mkdir -p $PHP_INI_DIR/conf.d # Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) # Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) # https://github.com/docker-library/php/issues/272 -ENV CFLAGS="-fstack-protector-strong -fpic -fpie -O2" -ENV CPPFLAGS="$CFLAGS" -ENV LDFLAGS="-Wl,-O1 -Wl,--hash-style=both" +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" ENV GPG_KEYS A917B1ECDA84AEC2B568FED6F50ABC807BD5DCD0 @@ -94,6 +94,9 @@ RUN set -xe \ " \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ \ + && export CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ && docker-php-source extract \ && cd /usr/src/php \ && ./configure \ diff --git a/7.1/alpine/Dockerfile b/7.1/alpine/Dockerfile index 5f3cd9aee..92f6de810 100644 --- a/7.1/alpine/Dockerfile +++ b/7.1/alpine/Dockerfile @@ -43,9 +43,9 @@ RUN mkdir -p $PHP_INI_DIR/conf.d # Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) # Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) # https://github.com/docker-library/php/issues/272 -ENV CFLAGS="-fstack-protector-strong -fpic -fpie -O2" -ENV CPPFLAGS="$CFLAGS" -ENV LDFLAGS="-Wl,-O1 -Wl,--hash-style=both" +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" ENV GPG_KEYS A917B1ECDA84AEC2B568FED6F50ABC807BD5DCD0 @@ -95,6 +95,9 @@ RUN set -xe \ openssl-dev \ sqlite-dev \ \ + && export CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ && docker-php-source extract \ && cd /usr/src/php \ && ./configure \ diff --git a/7.1/alpine/docker-php-ext-configure b/7.1/alpine/docker-php-ext-configure index 2a6f8394e..93d31601c 100755 --- a/7.1/alpine/docker-php-ext-configure +++ b/7.1/alpine/docker-php-ext-configure @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/7.1/alpine/docker-php-ext-install b/7.1/alpine/docker-php-ext-install index 79df34e17..c06602302 100755 --- a/7.1/alpine/docker-php-ext-install +++ b/7.1/alpine/docker-php-ext-install @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/7.1/apache/Dockerfile b/7.1/apache/Dockerfile index a29b6a08d..592736ee4 100644 --- a/7.1/apache/Dockerfile +++ b/7.1/apache/Dockerfile @@ -94,9 +94,9 @@ ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2 # Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) # Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) # https://github.com/docker-library/php/issues/272 -ENV CFLAGS="-fstack-protector-strong -fpic -fpie -O2" -ENV CPPFLAGS="$CFLAGS" -ENV LDFLAGS="-Wl,-O1 -Wl,--hash-style=both" +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" ENV GPG_KEYS A917B1ECDA84AEC2B568FED6F50ABC807BD5DCD0 @@ -150,6 +150,9 @@ RUN set -xe \ " \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ \ + && export CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ && docker-php-source extract \ && cd /usr/src/php \ && ./configure \ diff --git a/7.1/apache/docker-php-ext-configure b/7.1/apache/docker-php-ext-configure index 2a6f8394e..93d31601c 100755 --- a/7.1/apache/docker-php-ext-configure +++ b/7.1/apache/docker-php-ext-configure @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/7.1/apache/docker-php-ext-install b/7.1/apache/docker-php-ext-install index 79df34e17..c06602302 100755 --- a/7.1/apache/docker-php-ext-install +++ b/7.1/apache/docker-php-ext-install @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/7.1/docker-php-ext-configure b/7.1/docker-php-ext-configure index 2a6f8394e..93d31601c 100755 --- a/7.1/docker-php-ext-configure +++ b/7.1/docker-php-ext-configure @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/7.1/docker-php-ext-install b/7.1/docker-php-ext-install index 79df34e17..c06602302 100755 --- a/7.1/docker-php-ext-install +++ b/7.1/docker-php-ext-install @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/7.1/fpm/Dockerfile b/7.1/fpm/Dockerfile index adf9cca62..9cc7c35d8 100644 --- a/7.1/fpm/Dockerfile +++ b/7.1/fpm/Dockerfile @@ -39,9 +39,9 @@ ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-gr # Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) # Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) # https://github.com/docker-library/php/issues/272 -ENV CFLAGS="-fstack-protector-strong -fpic -fpie -O2" -ENV CPPFLAGS="$CFLAGS" -ENV LDFLAGS="-Wl,-O1 -Wl,--hash-style=both" +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" ENV GPG_KEYS A917B1ECDA84AEC2B568FED6F50ABC807BD5DCD0 @@ -95,6 +95,9 @@ RUN set -xe \ " \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ \ + && export CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ && docker-php-source extract \ && cd /usr/src/php \ && ./configure \ diff --git a/7.1/fpm/alpine/Dockerfile b/7.1/fpm/alpine/Dockerfile index af61e203e..31dab7636 100644 --- a/7.1/fpm/alpine/Dockerfile +++ b/7.1/fpm/alpine/Dockerfile @@ -44,9 +44,9 @@ ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-gr # Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) # Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) # https://github.com/docker-library/php/issues/272 -ENV CFLAGS="-fstack-protector-strong -fpic -fpie -O2" -ENV CPPFLAGS="$CFLAGS" -ENV LDFLAGS="-Wl,-O1 -Wl,--hash-style=both" +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" ENV GPG_KEYS A917B1ECDA84AEC2B568FED6F50ABC807BD5DCD0 @@ -96,6 +96,9 @@ RUN set -xe \ openssl-dev \ sqlite-dev \ \ + && export CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ && docker-php-source extract \ && cd /usr/src/php \ && ./configure \ diff --git a/7.1/fpm/alpine/docker-php-ext-configure b/7.1/fpm/alpine/docker-php-ext-configure index 2a6f8394e..93d31601c 100755 --- a/7.1/fpm/alpine/docker-php-ext-configure +++ b/7.1/fpm/alpine/docker-php-ext-configure @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/7.1/fpm/alpine/docker-php-ext-install b/7.1/fpm/alpine/docker-php-ext-install index 79df34e17..c06602302 100755 --- a/7.1/fpm/alpine/docker-php-ext-install +++ b/7.1/fpm/alpine/docker-php-ext-install @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/7.1/fpm/docker-php-ext-configure b/7.1/fpm/docker-php-ext-configure index 2a6f8394e..93d31601c 100755 --- a/7.1/fpm/docker-php-ext-configure +++ b/7.1/fpm/docker-php-ext-configure @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/7.1/fpm/docker-php-ext-install b/7.1/fpm/docker-php-ext-install index 79df34e17..c06602302 100755 --- a/7.1/fpm/docker-php-ext-install +++ b/7.1/fpm/docker-php-ext-install @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/7.1/zts/Dockerfile b/7.1/zts/Dockerfile index 334efebb8..fcb111e88 100644 --- a/7.1/zts/Dockerfile +++ b/7.1/zts/Dockerfile @@ -39,9 +39,9 @@ ENV PHP_EXTRA_CONFIGURE_ARGS --enable-maintainer-zts # Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) # Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) # https://github.com/docker-library/php/issues/272 -ENV CFLAGS="-fstack-protector-strong -fpic -fpie -O2" -ENV CPPFLAGS="$CFLAGS" -ENV LDFLAGS="-Wl,-O1 -Wl,--hash-style=both" +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" ENV GPG_KEYS A917B1ECDA84AEC2B568FED6F50ABC807BD5DCD0 @@ -95,6 +95,9 @@ RUN set -xe \ " \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ \ + && export CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ && docker-php-source extract \ && cd /usr/src/php \ && ./configure \ diff --git a/7.1/zts/alpine/Dockerfile b/7.1/zts/alpine/Dockerfile index 47c0a98a8..dc8e02fc0 100644 --- a/7.1/zts/alpine/Dockerfile +++ b/7.1/zts/alpine/Dockerfile @@ -44,9 +44,9 @@ ENV PHP_EXTRA_CONFIGURE_ARGS --enable-maintainer-zts # Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) # Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) # https://github.com/docker-library/php/issues/272 -ENV CFLAGS="-fstack-protector-strong -fpic -fpie -O2" -ENV CPPFLAGS="$CFLAGS" -ENV LDFLAGS="-Wl,-O1 -Wl,--hash-style=both" +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" ENV GPG_KEYS A917B1ECDA84AEC2B568FED6F50ABC807BD5DCD0 @@ -96,6 +96,9 @@ RUN set -xe \ openssl-dev \ sqlite-dev \ \ + && export CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ && docker-php-source extract \ && cd /usr/src/php \ && ./configure \ diff --git a/7.1/zts/alpine/docker-php-ext-configure b/7.1/zts/alpine/docker-php-ext-configure index 2a6f8394e..93d31601c 100755 --- a/7.1/zts/alpine/docker-php-ext-configure +++ b/7.1/zts/alpine/docker-php-ext-configure @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/7.1/zts/alpine/docker-php-ext-install b/7.1/zts/alpine/docker-php-ext-install index 79df34e17..c06602302 100755 --- a/7.1/zts/alpine/docker-php-ext-install +++ b/7.1/zts/alpine/docker-php-ext-install @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/7.1/zts/docker-php-ext-configure b/7.1/zts/docker-php-ext-configure index 2a6f8394e..93d31601c 100755 --- a/7.1/zts/docker-php-ext-configure +++ b/7.1/zts/docker-php-ext-configure @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1 diff --git a/7.1/zts/docker-php-ext-install b/7.1/zts/docker-php-ext-install index 79df34e17..c06602302 100755 --- a/7.1/zts/docker-php-ext-install +++ b/7.1/zts/docker-php-ext-install @@ -1,6 +1,12 @@ #!/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 + srcExists= if [ -d /usr/src/php ]; then srcExists=1