diff --git a/5.6/Dockerfile b/5.6/Dockerfile index 89f6fe4bd6..fcd72a1245 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 9a73a79295..ac77397e61 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 2a6f8394ea..93d31601c9 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 79df34e176..c06602302f 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 31d5a50b33..aa82224411 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 2a6f8394ea..93d31601c9 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 79df34e176..c06602302f 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 2a6f8394ea..93d31601c9 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 79df34e176..c06602302f 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 d7536790e8..521fdba860 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 ab9a90f4a1..afdd7d28ec 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 2a6f8394ea..93d31601c9 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 79df34e176..c06602302f 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 2a6f8394ea..93d31601c9 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 79df34e176..c06602302f 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 4895987b50..63f17f9f1d 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 29bcf7cfe2..688e5c7563 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 2a6f8394ea..93d31601c9 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 79df34e176..c06602302f 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 2a6f8394ea..93d31601c9 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 79df34e176..c06602302f 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 6ce44750d9..71b0e2bd8c 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 0fea38bc53..b42ea75040 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 2a6f8394ea..93d31601c9 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 79df34e176..c06602302f 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 18a7319fd0..5a7cbdfa6a 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 2a6f8394ea..93d31601c9 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 79df34e176..c06602302f 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 2a6f8394ea..93d31601c9 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 79df34e176..c06602302f 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 f01de3c470..774be771ba 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 fecf60bb02..f77dfd614e 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 2a6f8394ea..93d31601c9 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 79df34e176..c06602302f 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 2a6f8394ea..93d31601c9 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 79df34e176..c06602302f 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 68c1b2ac98..8214805623 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 2872392e33..3238639f6d 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 2a6f8394ea..93d31601c9 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 79df34e176..c06602302f 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 2a6f8394ea..93d31601c9 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 79df34e176..c06602302f 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 9acdbc82e7..5668b5de13 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 5f3cd9aee7..92f6de810a 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 2a6f8394ea..93d31601c9 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 79df34e176..c06602302f 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 a29b6a08d0..592736ee4d 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 2a6f8394ea..93d31601c9 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 79df34e176..c06602302f 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 2a6f8394ea..93d31601c9 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 79df34e176..c06602302f 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 adf9cca62b..9cc7c35d8a 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 af61e203e2..31dab76360 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 2a6f8394ea..93d31601c9 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 79df34e176..c06602302f 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 2a6f8394ea..93d31601c9 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 79df34e176..c06602302f 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 334efebb8b..fcb111e889 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 47c0a98a8c..dc8e02fc01 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 2a6f8394ea..93d31601c9 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 79df34e176..c06602302f 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 2a6f8394ea..93d31601c9 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 79df34e176..c06602302f 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 diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template index 43e4097423..1404280f98 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 2f4de9cd82..896f1b17b1 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 2a6f8394ea..93d31601c9 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 79df34e176..c06602302f 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