[pacman-dev] [PATCH] autotools: preserve LDFLAGS when building libalpm

Allan McRae allan at archlinux.org
Thu Jan 16 01:22:13 UTC 2020


On 16/1/20 11:02 am, Allan McRae wrote:
> On 15/1/20 5:08 am, anthraxx at archlinux.org wrote:
>> From: Levente Polyak <anthraxx at archlinux.org>
>>
>> Use AM_LDFLAGS for libalpm_la so defined LDFLAGS will not be ignored.
>>
>> Signed-off-by: anthraxx <anthraxx at archlinux.org>
>> ---
>>  lib/libalpm/Makefile.am | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/lib/libalpm/Makefile.am b/lib/libalpm/Makefile.am
>> index e4f83223..06dc0e43 100644
>> --- a/lib/libalpm/Makefile.am
>> +++ b/lib/libalpm/Makefile.am
>> @@ -59,7 +59,7 @@ libalpm_la_SOURCES = \
>>  	util-common.h util-common.c \
>>  	version.c
>>  
>> -libalpm_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_INFO)
>> +libalpm_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined -version-info $(LIB_VERSION_INFO)
>>  
>>  libalpm_la_CFLAGS = \
>>  	$(AM_CFLAGS) \
>>
> 
> What am I missing here?
> 
> Here is my configure output:
> linker flags       : -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now
> 
> 
> Before (with warning flags edited):
> libtool: link: gcc -pedantic -D_GNU_SOURCE -g -march=x86-64
> -mtune=generic -O2 -fstack-clash-protection -fno-plt
> -fstack-protector-all -fstack-clash-protection
> -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -o .libs/testpkg
> testpkg.o  -Wl,--as-needed ../../lib/libalpm/.libs/libalpm.so -lgpgme
> -lassuan -lgpg-error -larchive -lcurl -lcrypto -lm
> 
> After:
> libtool: link: gcc -pedantic -D_GNU_SOURCE -g -march=x86-64
> -mtune=generic -O2 -fstack-clash-protection -fno-plt
> -fstack-protector-all -fstack-clash-protection
> -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -o .libs/testpkg
> testpkg.o  -Wl,--as-needed ../../lib/libalpm/.libs/libalpm.so -lgpgme
> -lassuan -lgpg-error -larchive -lcurl -lcrypto -lm
> 
> Both are identical.
> 

Also:

https://www.gnu.org/software/automake/manual/html_node/Libtool-Flags.html#Libtool-Flags

"The ‘library_LDFLAGS’ variable is the place to list *additional*
libtool linking flags, ..."


As far as I can tell, this is a patch without a problem.

Allan


More information about the pacman-dev mailing list