nixpkgs/pkgs/development/tools/misc/binutils/build-components-separately.patch
2020-12-28 08:43:32 +01:00

165 lines
5.8 KiB
Diff

diff --git a/bfd/configure.ac b/bfd/configure.ac
index c5bfbd5d..45ad4c26 100644
--- a/bfd/configure.ac
+++ b/bfd/configure.ac
@@ -278,31 +278,19 @@ AC_CACHE_CHECK(linker --as-needed support, bfd_cv_ld_as_needed,
LT_LIB_M
-# When building a shared libbfd, link against the pic version of libiberty
-# so that apps that use libbfd won't need libiberty just to satisfy any
-# libbfd references.
-# We can't do that if a pic libiberty is unavailable since including non-pic
-# code would insert text relocations into libbfd.
SHARED_LIBADD=
-SHARED_LDFLAGS=
+SHARED_LDFLAGS=-liberty
if test "$enable_shared" = "yes"; then
-changequote(,)dnl
- x=`sed -n -e 's/^[ ]*PICFLAG[ ]*=[ ]*//p' < ../libiberty/Makefile | sed -n '$p'`
-changequote([,])dnl
- if test -n "$x"; then
- SHARED_LIBADD="-L`pwd`/../libiberty/pic -liberty"
- fi
-
case "${host}" in
# More hacks to build DLLs on Windows.
*-*-cygwin*)
SHARED_LDFLAGS="-no-undefined"
- SHARED_LIBADD="-L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin -lkernel32"
+ SHARED_LIBADD="-liberty -lintl -lcygwin -lkernel32"
;;
# Use built-in libintl on macOS, since it is not provided by libc.
*-*-darwin*)
- SHARED_LIBADD="-L`pwd`/../libiberty/pic -L`pwd`/../intl -liberty -lintl"
+ SHARED_LIBADD="-liberty -lintl"
;;
esac
diff --git a/opcodes/Makefile.am b/opcodes/Makefile.am
index 4f06074a..6836c589 100644
--- a/opcodes/Makefile.am
+++ b/opcodes/Makefile.am
@@ -51,7 +51,7 @@ libopcodes_la_LDFLAGS += -rpath $(rpath_bfdlibdir)
endif
# This is where bfd.h lives.
-BFD_H = ../bfd/bfd.h
+BFD_H = $(BFDDIR)/bfd.h
BUILD_LIBS = @BUILD_LIBS@
BUILD_LIB_DEPS = @BUILD_LIB_DEPS@
@@ -301,7 +301,7 @@ OFILES = @BFD_MACHINES@
# development.sh is used to determine -Werror default.
CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/development.sh
-AM_CPPFLAGS = -I. -I$(srcdir) -I../bfd -I$(INCDIR) -I$(BFDDIR) @HDEFINES@ @INCINTL@
+AM_CPPFLAGS = -I. -I$(srcdir) -I$(INCDIR) -I$(BFDDIR) @HDEFINES@ @INCINTL@
disassemble.lo: disassemble.c
if am__fastdepCC
@@ -322,12 +322,21 @@ libopcodes_la_SOURCES = dis-buf.c disassemble.c dis-init.c
# old version of libbfd, or to pick up libbfd for the wrong architecture
# if host != build. So for building with shared libraries we use a
# hardcoded path to libbfd.so instead of relying on the entries in libbfd.la.
-libopcodes_la_DEPENDENCIES = $(OFILES) @SHARED_DEPENDENCIES@
+libopcodes_la_DEPENDENCIES = $(OFILES) @SHARED_DEPENDENCIES@ libtool-soversion
libopcodes_la_LIBADD = $(OFILES) @SHARED_LIBADD@
-libopcodes_la_LDFLAGS += -release `cat ../bfd/libtool-soversion` @SHARED_LDFLAGS@
+libopcodes_la_LDFLAGS += -release `cat libtool-soversion` @SHARED_LDFLAGS@
# Allow dependency tracking to work on all the source files.
EXTRA_libopcodes_la_SOURCES = $(LIBOPCODES_CFILES)
+libtool-soversion:
+ @echo "creating $@"
+ bfd_soversion="$(VERSION)" ;\
+ . $(BFDDIR)/development.sh ;\
+ if test "$$development" = true ; then \
+ bfd_soversion="$(VERSION).$${bfd_version_date}" ;\
+ fi ;\
+ echo "$${bfd_soversion}" > $@
+
# libtool will build .libs/libopcodes.a. We create libopcodes.a in
# the build directory so that we don't have to convert all the
# programs that use libopcodes.a simultaneously. This is a hack which
diff --git a/opcodes/configure.ac b/opcodes/configure.ac
index 00be9c88..6e589ae4 100644
--- a/opcodes/configure.ac
+++ b/opcodes/configure.ac
@@ -86,6 +86,7 @@ AC_PROG_INSTALL
AC_CHECK_HEADERS(string.h strings.h stdlib.h limits.h)
ACX_HEADER_STRING
+GCC_HEADER_STDINT(bfd_stdint.h)
AC_CHECK_DECLS([basename, stpcpy])
@@ -137,61 +138,27 @@ AC_CACHE_CHECK(linker --as-needed support, bfd_cv_ld_as_needed,
LT_LIB_M
-#Libs for generator progs
-if test "x$cross_compiling" = "xno"; then
- BUILD_LIBS=../libiberty/libiberty.a
- BUILD_LIB_DEPS=$BUILD_LIBS
-else
- # if cross-compiling, assume that the system provides -liberty
- # and that the version is compatible with new headers.
- BUILD_LIBS=-liberty
- BUILD_LIB_DEPS=
-fi
-BUILD_LIBS="$BUILD_LIBS $LIBINTL"
-BUILD_LIB_DEPS="$BUILD_LIB_DEPS $LIBINTL_DEP"
+BUILD_LIBS="-liberty $LIBINTL"
+BUILD_LIB_DEPS="$LIBINTL_DEP"
AC_SUBST(BUILD_LIBS)
AC_SUBST(BUILD_LIB_DEPS)
# Horrible hacks to build DLLs on Windows and a shared library elsewhere.
SHARED_LDFLAGS=
-SHARED_LIBADD=
+SHARED_LIBADD=-liberty
SHARED_DEPENDENCIES=
if test "$enable_shared" = "yes"; then
-# When building a shared libopcodes, link against the pic version of libiberty
-# so that apps that use libopcodes won't need libiberty just to satisfy any
-# libopcodes references.
-# We can't do that if a pic libiberty is unavailable since including non-pic
-# code would insert text relocations into libopcodes.
# Note that linking against libbfd as we do here, which is itself linked
# against libiberty, may not satisfy all the libopcodes libiberty references
# since libbfd may not pull in the entirety of libiberty.
-changequote(,)dnl
- x=`sed -n -e 's/^[ ]*PICFLAG[ ]*=[ ]*//p' < ../libiberty/Makefile | sed -n '$p'`
-changequote([,])dnl
- if test -n "$x"; then
- SHARED_LIBADD="-L`pwd`/../libiberty/pic -liberty"
- fi
-
case "${host}" in
*-*-cygwin*)
SHARED_LDFLAGS="-no-undefined"
- SHARED_LIBADD="-L`pwd`/../bfd -lbfd -L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin"
+ SHARED_LIBADD="-lbfd -liberty -lintl -lcygwin"
;;
- *-*-darwin*)
- SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.dylib ${SHARED_LIBADD}"
- SHARED_DEPENDENCIES="../bfd/libbfd.la"
- ;;
*)
- case "$host_vendor" in
- hp)
- SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.sl ${SHARED_LIBADD}"
- ;;
- *)
- SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.so ${SHARED_LIBADD}"
- ;;
- esac
- SHARED_DEPENDENCIES="../bfd/libbfd.la"
+ SHARED_LIBADD="-lbfd ${SHARED_LIBADD}"
;;
esac