Browse Source

gdb: make static builds work, ugly hack

Waldemar Brodkorb 7 years ago
parent
commit
a5b4cab910
2 changed files with 99 additions and 9 deletions
  1. 3 9
      package/gdb/Makefile
  2. 96 0
      package/gdb/patches/patch-gdb_configure

+ 3 - 9
package/gdb/Makefile

@@ -20,32 +20,26 @@ include ${ADK_TOPDIR}/mk/package.mk
 
 $(eval $(call PKG_template,GDB,gdb,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
 
-TARGET_CFLAGS+=		${TARGET_CPPFLAGS} -fPIC
-CONFIGURE_ARGS+=	--enable-static \
-			--without-uiout \
+CONFIGURE_ARGS+=	--without-uiout \
 			--disable-tui \
 			--disable-gdbtk \
 			--disable-gdbserver \
 			--without-x \
 			--disable-sim \
+			--disable-plugins \
 			--disable-werror \
 			--without-python \
 			--without-included-gettext \
 			--without-auto-load-safe-path \
 			--disable-install-libiberty \
 			--disable-install-libbfd \
+			--with-system-zlib \
 			--with-curses \
 			--enable-gdbmi
 
-XAKE_FLAGS+=		LDFLAGS='${TARGET_LDFLAGS}'
-# disable honour cflags stuff
-XAKE_FLAGS+=		GCC_HONOUR_COPTS:=s
-
 gdb-install:
 	${INSTALL_DIR} ${IDIR_GDB}/usr/bin
 	${INSTALL_BIN} ${WRKINST}/usr/bin/gdb \
 		${IDIR_GDB}/usr/bin/
-	# shipped libbfd conflicts with system wide one
-	rm -f ${WRKINST}/usr/lib/libbfd*
 
 include ${ADK_TOPDIR}/mk/pkg-bottom.mk

+ 96 - 0
package/gdb/patches/patch-gdb_configure

@@ -0,0 +1,96 @@
+--- gdb-8.0.orig/gdb/configure	2017-06-04 17:54:54.000000000 +0200
++++ gdb-8.0/gdb/configure	2017-06-20 22:54:16.961589341 +0200
+@@ -14547,93 +14547,6 @@ $as_echo "$gdb_cv_bigtoc" >&6; }
+   ;;
+ esac
+ 
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the dynamic export flag" >&5
+-$as_echo_n "checking for the dynamic export flag... " >&6; }
+-dynamic_list=false
+-if test "${gdb_native}" = yes; then
+-   # The dynamically loaded libthread_db needs access to symbols in the gdb
+-   # executable.  Older GNU ld supports --export-dynamic but --dynamic-list
+-   # may not be supported there.
+-   old_LDFLAGS="$LDFLAGS"
+-   # Older GNU ld supports --export-dynamic but --dynamic-list it does not.
+-   RDYNAMIC="-Wl,--dynamic-list=${srcdir}/proc-service.list"
+-   LDFLAGS="$LDFLAGS $RDYNAMIC"
+-   if test "${have_libpython}" = no; then
+-     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h.  */
+-
+-int
+-main ()
+-{
+-
+-  ;
+-  return 0;
+-}
+-_ACEOF
+-if ac_fn_c_try_link "$LINENO"; then :
+-  dynamic_list=true
+-fi
+-rm -f core conftest.err conftest.$ac_objext \
+-    conftest$ac_exeext conftest.$ac_ext
+-   else
+-     # Workaround http://bugs.python.org/issue4434 where static
+-     # libpythonX.Y.a would get its symbols required for
+-     # pythonX.Y/lib-dynload/*.so modules hidden by -Wl,--dynamic-list.
+-     # Problem does not happen for the recommended libpythonX.Y.so linkage.
+-
+-     # Note the workaround for Python
+-     # http://bugs.python.org/issue10112 earlier has removed
+-     # -export-dynamic from PYTHON_LIBS.  That's exactly what we want
+-     # here too, as otherwise it'd make this -Wl,--dynamic-list test
+-     # always pass.
+-     old_CFLAGS="$CFLAGS"
+-     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
+-     old_LIBS="$LIBS"
+-     LIBS="$LIBS $PYTHON_LIBS"
+-     old_CPPFLAGS="$CPPFLAGS"
+-     CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS"
+-     if test "$cross_compiling" = yes; then :
+-  true
+-else
+-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h.  */
+-#include "Python.h"
+-int
+-main ()
+-{
+-int err;
+-          Py_Initialize ();
+-          err = PyRun_SimpleString ("import itertools\n");
+-          Py_Finalize ();
+-          return err == 0 ? 0 : 1;
+-  ;
+-  return 0;
+-}
+-_ACEOF
+-if ac_fn_c_try_run "$LINENO"; then :
+-  dynamic_list=true
+-fi
+-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+-  conftest.$ac_objext conftest.beam conftest.$ac_ext
+-fi
+-
+-     LIBS="$old_LIBS"
+-     CFLAGS="$old_CFLAGS"
+-     CPPFLAGS="$old_CPPFLAGS"
+-   fi
+-   LDFLAGS="$old_LDFLAGS"
+-fi
+-if $dynamic_list; then
+-  found="-Wl,--dynamic-list"
+-  RDYNAMIC='-Wl,--dynamic-list=$(srcdir)/proc-service.list'
+-else
+-  found="-rdynamic"
+-  RDYNAMIC="-rdynamic"
+-fi
+-
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $found" >&5
+-$as_echo "$found" >&6; }
+-
+ 
+ if test ${build} = ${host} -a ${host} = ${target} ; then
+    case ${host_os} in