Skip to contentSkip to conversation

package/php: Fix static linking by reworking static libs handling

PATCH New Bernd Kuhls 2 participants 2 messages May 31, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 package/php: Fix static linking by reworking static libs handling

Fixes
http://autobuild.buildroot.net/results/157/157749f8b44bc02fbed0232a2b33137aba495134/
http://autobuild.buildroot.net/results/df4/df4e2ea098b0126867455af1891837c6d7d99a92/
http://autobuild.buildroot.net/results/e69/e6993d66aeebbe994063a60871412b2235ce5455/

---
v2: merged sqlite and unixodbc fix, switched to pkgconf for sqlite,
add openssl to new variable PHP_STATIC_LIBS and switch to pkgconf (Thomas)

 package/php/php.mk |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
package/php/php.mk +9 -3
index b74cfd6..6f06f26 100644
@@ -25,6 +25,10 @@ PHP_CONF_ENV = \
 	ac_cv_func_strcasestr=yes \
 	EXTRA_LIBS="$(PHP_EXTRA_LIBS)"
 
+ifeq ($(BR2_STATIC_LIBS),y)
+PHP_CONF_ENV += LIBS="$(PHP_STATIC_LIBS)"
+endif
+
 ifeq ($(BR2_TARGET_LOCALTIME),)
 PHP_LOCALTIME = UTC
 else
@@ -131,9 +135,7 @@ PHP_CONF_OPTS += --with-openssl=$(STAGING_DIR)/usr
 PHP_DEPENDENCIES += openssl
 # openssl needs zlib, but the configure script forgets to link against
 # it causing detection failures with static linking
-ifeq ($(BR2_STATIC_LIBS),y)
-PHP_CONF_ENV += LIBS='-lz'
-endif
+PHP_STATIC_LIBS += $(shell $(PKG_CONFIG_HOST_BINARY) --libs --static openssl)
 endif
 
 ifeq ($(BR2_PACKAGE_PHP_EXT_LIBXML2),y)
@@ -204,6 +206,7 @@ endif
 ifeq ($(BR2_PACKAGE_PHP_EXT_SQLITE),y)
 PHP_CONF_OPTS += --with-sqlite3=$(STAGING_DIR)/usr
 PHP_DEPENDENCIES += sqlite
+PHP_STATIC_LIBS += $(shell $(PKG_CONFIG_HOST_BINARY) --libs --static sqlite3)
 endif
 
 ### PDO
@@ -225,6 +228,9 @@ endif
 ifeq ($(BR2_PACKAGE_PHP_EXT_PDO_UNIXODBC),y)
 PHP_CONF_OPTS += --with-pdo-odbc=unixODBC,$(STAGING_DIR)/usr
 PHP_DEPENDENCIES += unixodbc
+ifeq ($(BR2_STATIC_LIBS),y)
+PHP_STATIC_LIBS += -lpthread
+endif
 endif
 endif
 
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH v2 1/1 package/php: Fix static linking by reworking static libs handling

Quoted 14 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Bernd" == Bernd Kuhls <[email protected]> writes:

Fixes
http://autobuild.buildroot.net/results/157/157749f8b44bc02fbed0232a2b33137aba495134/
http://autobuild.buildroot.net/results/df4/df4e2ea098b0126867455af1891837c6d7d99a92/
http://autobuild.buildroot.net/results/e69/e6993d66aeebbe994063a60871412b2235ce5455/

---
v2: merged sqlite and unixodbc fix, switched to pkgconf for sqlite,
add openssl to new variable PHP_STATIC_LIBS and switch to pkgconf (Thomas)

package/php/php.mk endif · line 233

Quoted 6 lines
package/php/php.mk +3 -0
@@ -225,6 +228,9 @@ endif
 ifeq ($(BR2_PACKAGE_PHP_EXT_PDO_UNIXODBC),y)
 PHP_CONF_OPTS += --with-pdo-odbc=unixODBC,$(STAGING_DIR)/usr
 PHP_DEPENDENCIES += unixodbc
+ifeq ($(BR2_STATIC_LIBS),y)
+PHP_STATIC_LIBS += -lpthread
+endif

unixodbc can be built without pthread support (by a patch from you), so this should be:

ifeq ($(BR2_STATIC_LIBS)$(BR2_TOOLCHAIN_HAS_THREADS),yy)

Committed with that fixed, thanks.

Signature · 1 line
Bye, Peter Korsgaard