Using lib*.so as a linker script ...
the paths can be avoided, making the file mobile, so generate during build and we need to handle staging it.
This commit is contained in:
parent
7bbde42e0d
commit
f187ca8c90
@ -212,10 +212,40 @@ SOLINKOPTS+= -Wl,--fatal-warnings -Wl,--warn-shared-textrel
|
||||
beforelinking: ${SOBJS}
|
||||
${SHLIB_NAME_FULL}: beforelinking
|
||||
.endif
|
||||
|
||||
.if defined(SHLIB_LINK)
|
||||
# ${_SHLIBDIRPREFIX} and ${_LDSCRIPTROOT} are both needed when cross-building
|
||||
# and when building 32 bits library shims. ${_SHLIBDIRPREFIX} is the directory
|
||||
# prefix where shared objects will be installed by the install target.
|
||||
#
|
||||
# ${_LDSCRIPTROOT} is the directory prefix that will be used when generating
|
||||
# ld(1) scripts. The crosstools' ld is configured to lookup libraries in an
|
||||
# alternative directory which is called "sysroot", so during buildworld binaries
|
||||
# won't be linked against the running system libraries but against the ones of
|
||||
# the current source tree. ${_LDSCRIPTROOT} behavior is twisted because of
|
||||
# the location where we store them:
|
||||
# - 64 bits libs are located under sysroot, so ${_LDSCRIPTROOT} must be empty
|
||||
# because ld(1) will manage to find them from sysroot;
|
||||
# - 32 bits shims are not, so ${_LDSCRIPTROOT} is used to specify their full
|
||||
# path, outside of sysroot.
|
||||
# Note that ld(1) scripts are generated both during buildworld and
|
||||
# installworld; in the later case ${_LDSCRIPTROOT} must be obviously empty
|
||||
# because on the target system, libraries are meant to be looked up from /.
|
||||
.if defined(SHLIB_LDSCRIPT) && !empty(SHLIB_LDSCRIPT) && exists(${.CURDIR}/${SHLIB_LDSCRIPT})
|
||||
${SHLIB_LINK:R}.ld: ${.CURDIR}/${SHLIB_LDSCRIPT}
|
||||
sed -e 's,@@SHLIB@@,${_LDSCRIPTROOT}${_SHLIBDIR}/${SHLIB_NAME},g' \
|
||||
-e 's,@@LIBDIR@@,${_LDSCRIPTROOT}${_LIBDIR},g' \
|
||||
-e 's,/[^ ]*/,,g' \
|
||||
${.ALLSRC} > ${.TARGET}
|
||||
|
||||
${SHLIB_NAME_FULL}: ${SHLIB_LINK:R}.ld
|
||||
.endif
|
||||
.endif
|
||||
|
||||
${SHLIB_NAME_FULL}: ${SOBJS}
|
||||
@${ECHO} building shared library ${SHLIB_NAME}
|
||||
@rm -f ${SHLIB_NAME} ${SHLIB_LINK}
|
||||
.if defined(SHLIB_LINK)
|
||||
.if defined(SHLIB_LINK) && !commands(${SHLIB_LINK:R}.ld)
|
||||
@${INSTALL_SYMLINK} ${SHLIB_NAME} ${SHLIB_LINK}
|
||||
.endif
|
||||
.if !defined(NM)
|
||||
@ -329,32 +359,10 @@ _libinstall:
|
||||
${SHLIB_NAME}.debug ${DESTDIR}${DEBUGFILEDIR}
|
||||
.endif
|
||||
.if defined(SHLIB_LINK)
|
||||
# ${_SHLIBDIRPREFIX} and ${_LDSCRIPTROOT} are both needed when cross-building
|
||||
# and when building 32 bits library shims. ${_SHLIBDIRPREFIX} is the directory
|
||||
# prefix where shared objects will be installed by the install target.
|
||||
#
|
||||
# ${_LDSCRIPTROOT} is the directory prefix that will be used when generating
|
||||
# ld(1) scripts. The crosstools' ld is configured to lookup libraries in an
|
||||
# alternative directory which is called "sysroot", so during buildworld binaries
|
||||
# won't be linked against the running system libraries but against the ones of
|
||||
# the current source tree. ${_LDSCRIPTROOT} behavior is twisted because of
|
||||
# the location where we store them:
|
||||
# - 64 bits libs are located under sysroot, so ${_LDSCRIPTROOT} must be empty
|
||||
# because ld(1) will manage to find them from sysroot;
|
||||
# - 32 bits shims are not, so ${_LDSCRIPTROOT} is used to specify their full
|
||||
# path, outside of sysroot.
|
||||
# Note that ld(1) scripts are generated both during buildworld and
|
||||
# installworld; in the later case ${_LDSCRIPTROOT} must be obviously empty
|
||||
# because on the target system, libraries are meant to be looked up from /.
|
||||
.if defined(SHLIB_LDSCRIPT) && !empty(SHLIB_LDSCRIPT) && exists(${.CURDIR}/${SHLIB_LDSCRIPT})
|
||||
sed -e 's,@@SHLIB@@,${_LDSCRIPTROOT}${_SHLIBDIR}/${SHLIB_NAME},g' \
|
||||
-e 's,@@LIBDIR@@,${_LDSCRIPTROOT}${_LIBDIR},g' \
|
||||
${.CURDIR}/${SHLIB_LDSCRIPT} > ${DESTDIR}${_LIBDIR}/${SHLIB_LINK:R}.ld
|
||||
.if commands(${SHLIB_LINK:R}.ld)
|
||||
${INSTALL} -S -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
||||
${_INSTALLFLAGS} ${DESTDIR}${_LIBDIR}/${SHLIB_LINK:R}.ld \
|
||||
${_INSTALLFLAGS} ${SHLIB_LINK:R}.ld \
|
||||
${DESTDIR}${_LIBDIR}/${SHLIB_LINK}
|
||||
rm -f ${DESTDIR}${_LIBDIR}/${SHLIB_LINK:R}.ld
|
||||
|
||||
.else
|
||||
.if ${_SHLIBDIR} == ${_LIBDIR}
|
||||
${INSTALL_SYMLINK} ${SHLIB_NAME} ${DESTDIR}${_LIBDIR}/${SHLIB_LINK}
|
||||
|
@ -168,7 +168,7 @@ PHONY_NOTMAIN+= fetch patch
|
||||
.else
|
||||
.PHONY: ${PHONY_NOTMAIN}
|
||||
.endif
|
||||
.NOTMAIN: ${PHONY_NOTMAIN}
|
||||
.NOTMAIN: ${PHONY_NOTMAIN:Nall}
|
||||
|
||||
.if !defined(.PARSEDIR)
|
||||
# this is a no-op
|
||||
@ -184,6 +184,7 @@ staging stage_libs stage_files stage_as stage_links stage_symlinks:
|
||||
.else
|
||||
# allow targets like beforeinstall to be leveraged
|
||||
DESTDIR= ${STAGE_OBJTOP}
|
||||
_SHLIBDIRPREFIX= ${STAGE_OBJTOP}
|
||||
|
||||
.if commands(beforeinstall)
|
||||
.if !empty(_LIBS) || ${MK_STAGING_PROG} != "no"
|
||||
@ -209,14 +210,42 @@ staging: stage_files
|
||||
.endif
|
||||
|
||||
.if !empty(_LIBS) && !defined(INTERNALLIB)
|
||||
.if defined(SHLIBDIR) && ${SHLIBDIR} != ${LIBDIR} && ${_LIBS:Uno:M*.so.*} != ""
|
||||
STAGE_SETS+= shlib
|
||||
STAGE_DIR.shlib= ${STAGE_OBJTOP}${SHLIBDIR}
|
||||
STAGE_FILES.shlib+= ${_LIBS:M*.so.*}
|
||||
stage_files.shlib: ${_LIBS:M*.so.*}
|
||||
.endif
|
||||
|
||||
.if defined(SHLIB_LINK) && commands(${SHLIB_LINK:R}.ld)
|
||||
_LDSCRIPTROOT?= ${STAGE_OBJTOP}
|
||||
STAGE_AS_SETS+= ldscript
|
||||
STAGE_AS.ldscript+= ${SHLIB_LINK:R}.ld
|
||||
stage_as.ldscript: ${SHLIB_LINK:R}.ld
|
||||
STAGE_DIR.ldscript = ${STAGE_LIBDIR}
|
||||
STAGE_AS_${SHLIB_LINK:R}.ld:= ${SHLIB_LINK}
|
||||
NO_SHLIB_LINKS=
|
||||
.endif
|
||||
|
||||
.if target(stage_files.shlib)
|
||||
stage_libs: ${_LIBS}
|
||||
.if defined(DEBUG_FLAGS) && target(${SHLIB_NAME}.symbols)
|
||||
stage_files.shlib: ${SHLIB_NAME}.symbols
|
||||
.endif
|
||||
.else
|
||||
stage_libs: ${_LIBS}
|
||||
.endif
|
||||
.if defined(SHLIB_NAME) && defined(DEBUG_FLAGS) && target(${SHLIB_NAME}.symbols)
|
||||
stage_libs: ${SHLIB_NAME}.symbols
|
||||
.endif
|
||||
|
||||
.endif
|
||||
|
||||
.if !empty(INCS) || !empty(INCSGROUPS) && target(buildincludes)
|
||||
beforebuild: buildincludes
|
||||
.if !defined(NO_BEFOREBUILD_INCLUDES)
|
||||
stage_includes: buildincludes
|
||||
beforebuild: stage_includes
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.for t in stage_libs stage_files stage_as
|
||||
|
Loading…
x
Reference in New Issue
Block a user