Skip to content

Commit 5fe723c

Browse files
committedApr 27, 2020
Fix libtool to provide a simple way to generate only "shared" object files or libraries.
- Support for "-shared" option is taken from libtool-2.0 that is already at lease 15 years old. - Change PHP build system to use "-shared" instead of "--tag=disable-static".
1 parent 7ce8c5a commit 5fe723c

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed
 

‎build/Makefile.global

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ build-modules: $(PHP_MODULES) $(PHP_ZEND_EX)
1616
build-binaries: $(PHP_BINARIES)
1717

1818
libphp.la: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
19-
$(LIBTOOL) --mode=link --tag=disable-static $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -rpath $(phptempdir) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@
19+
$(LIBTOOL) --mode=link $(CC) -shared $(CFLAGS) $(EXTRA_CFLAGS) -rpath $(phptempdir) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@
2020
-@$(LIBTOOL) --silent --mode=install cp $@ $(phptempdir)/$@ >/dev/null 2>&1
2121

2222
libs/libphp.bundle: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)

‎build/ltmain.sh

+13
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,13 @@ if test -z "$show_help"; then
811811

812812
for arg in $later; do
813813
case $arg in
814+
-shared)
815+
test yes = "$build_libtool_libs" \
816+
|| func_fatal_configuration "cannot build a shared library"
817+
build_old_libs=no
818+
continue
819+
;;
820+
814821
-static)
815822
build_old_libs=yes
816823
continue
@@ -1177,6 +1184,12 @@ EOF
11771184
for arg
11781185
do
11791186
case $arg in
1187+
-shared)
1188+
test yes != "$build_libtool_libs" \
1189+
&& func_fatal_configuration "cannot build a shared library"
1190+
build_old_libs=no
1191+
break
1192+
;;
11801193
-all-static | -static | -static-libtool-libs)
11811194
case $arg in
11821195
-all-static)

‎build/php.m4

+1-1
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ AC_DEFUN([PHP_SHARED_MODULE],[
851851
\$(LIBTOOL) --mode=install cp $3/$1.$suffix \$(phplibdir)
852852
853853
$3/$1.$suffix: \$($2) \$(translit($1,a-z_-,A-Z__)_SHARED_DEPENDENCIES)
854-
\$(LIBTOOL) --mode=link --tag=disable-static ifelse($4,,[\$(CC)],[\$(CXX)]) \$(COMMON_FLAGS) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(LDFLAGS) $additional_flags -o [\$]@ -export-dynamic -avoid-version -prefer-pic -module -rpath \$(phplibdir) \$(EXTRA_LDFLAGS) \$($2) \$(translit($1,a-z_-,A-Z__)_SHARED_LIBADD)
854+
\$(LIBTOOL) --mode=link ifelse($4,,[\$(CC)],[\$(CXX)]) -shared \$(COMMON_FLAGS) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(LDFLAGS) $additional_flags -o [\$]@ -export-dynamic -avoid-version -prefer-pic -module -rpath \$(phplibdir) \$(EXTRA_LDFLAGS) \$($2) \$(translit($1,a-z_-,A-Z__)_SHARED_LIBADD)
855855
856856
EOF
857857
])

0 commit comments

Comments
 (0)
Please sign in to comment.