Commit 857e26b6 authored by Janne Grunau's avatar Janne Grunau Committed by Diego Biurrun

build: Add an option for passing linker flags to the shared library build

Also employ this mechanism to pass $libdir to the runtime library search
path if rpath is enabled. This fixes underlinking of some test binaries
on some systems.
parent 333a34da
......@@ -48,7 +48,7 @@ $(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SUBDIR)lib$(NAME).ver $(DEP_LIBS)
$(SLIB_CREATE_DEF_CMD)
$$(LD) $(SHFLAGS) $(LDFLAGS) $$(LD_O) $$(filter %.o,$$^) $(FFEXTRALIBS)
$$(LD) $(SHFLAGS) $(LDFLAGS) $(LDSOFLAGS) $$(LD_O) $$(filter %.o,$$^) $(FFEXTRALIBS)
$(SLIB_EXTRA_CMD)
clean::
......
......@@ -283,6 +283,7 @@ Toolchain options:
--extra-objcflags=FLAGS add FLAGS to OBJCFLAGS [$CFLAGS]
--extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
--extra-ldexeflags=ELDFLAGS add ELDFLAGS to LDEXEFLAGS [$LDEXEFLAGS]
--extra-ldsoflags=ELDFLAGS add ELDFLAGS to LDSOFLAGS [$LDSOFLAGS]
--extra-libs=ELIBS add ELIBS [$ELIBS]
--extra-version=STRING version string suffix []
--optflags=OPTFLAGS override optimization-related compiler flags
......@@ -740,6 +741,10 @@ add_ldexeflags(){
append LDEXEFLAGS $($ldflags_filter "$@")
}
add_ldsoflags(){
append LDSOFLAGS $($ldflags_filter "$@")
}
add_stripflags(){
append STRIPFLAGS "$@"
}
......@@ -2802,6 +2807,9 @@ for opt do
--extra-ldexeflags=*)
add_ldexeflags $optval
;;
--extra-ldsoflags=*)
add_ldsoflags $optval
;;
--extra-libs=*)
add_extralibs $optval
;;
......@@ -4950,7 +4958,7 @@ EOF
# add some linker flags
check_ldflags -Wl,--warn-common
check_ldflags -Wl,-rpath-link=libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample
enabled rpath && add_ldexeflags -Wl,-rpath,$libdir
enabled rpath && add_ldexeflags -Wl,-rpath,$libdir && add_ldsoflags -Wl,-rpath,$libdir
test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
# add some strip flags
......@@ -5410,6 +5418,7 @@ LD_PATH=$LD_PATH
DLLTOOL=$dlltool
LDFLAGS=$LDFLAGS
LDEXEFLAGS=$LDEXEFLAGS
LDSOFLAGS=$LDSOFLAGS
SHFLAGS=$(echo $($ldflags_filter $SHFLAGS))
STRIPFLAGS=$STRIPFLAGS
X86ASMFLAGS=$X86ASMFLAGS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment