Request new specs string token for multilib_os_dir

2012-04-27 Thread Steven Drake
In the GCC FAQ under "Dynamic linker is unable to find GCC libraries", one
suggestion is to add '-R' or '-rpath' linker option to the *link or *lib 
specs so that the GCC libraries can be found.

E.G. the following line is added to the DRIVER_DEFINES when building gcc
via pkgsrc ('$(LINKER_RPATH_FLAG)' comes from the environment):

  -DLINK_LIBGCC_SPEC="\"%D $(LINKER_RPATH_FLAG)$(libdir) \""

This is needed as the prefix is normally something like '/usr/pkg/gcc47'.

The problem is that this does not allow for multilib os directory's and
there is currently no simple way of dong so.

My solution is to add the '%M' token that expands to multilib_os_dir.

The above line can then be easily change to handle multilib directory's:

  -DLINK_LIBGCC_SPEC="\"%D $(LINKER_RPATH_FLAG)$(libdir)/%M \""


2012-04-27  Steven Drake 

* gcc.c (do_spec_1): Add %M spec token to output multilib_os_dir.

--- gcc/gcc.c.orig  2012-02-28 17:31:38.0 +
+++ gcc/gcc.c
@@ -5115,6 +5115,13 @@ do_spec_1 (const char *spec, int inswitc
  return value;
break;
 
+ case 'M':
+   if (multilib_os_dir == NULL)
+ obstack_1grow (&obstack, '.');
+   else
+ obstack_grow (&obstack, multilib_os_dir, strlen(multilib_os_dir));
+   break;
+
  case 'G':
value = do_spec_1 (libgcc_spec, 0, NULL);
if (value != 0)

-- 
Steven


Fix the java-home OS include directory.

2012-05-06 Thread Steven Drake
If the libjava configure option --enable-java-home is used the os directory
under include will always be 'linux' as it is hardcoded so.

I.E. it is not configurable using '--with-os-directory' or auto-detected as
suggested by the configure help text.

-- 
Steven

2012-05-07  Steven Drake 

libjava:
* Makefile.am (install-data-local): Use the $(OS) variable for the
java-home os directory under include.

diff --git a/libjava/Makefile.am b/libjava/Makefile.am
index 1b71962..b40fa76 100644
--- a/libjava/Makefile.am
+++ b/libjava/Makefile.am
@@ -899,7 +899,7 @@ if CREATE_JAVA_HOME
cd $(DESTDIR)$(JRE_LIB_DIR)/security; \
  ln -sf $$RELATIVE/classpath.security java.security; \
cd $$working_dir; \
-   $(mkinstalldirs) $(DESTDIR)$(SDK_INCLUDE_DIR)/linux; \
+   $(mkinstalldirs) $(DESTDIR)$(SDK_INCLUDE_DIR)/$(OS); \
$(mkinstalldirs) $(DESTDIR)$(JRE_LIB_DIR)/$(CPU)/client; \
$(mkinstalldirs) $(DESTDIR)$(JRE_LIB_DIR)/$(CPU)/server; \
$(mkinstalldirs) $(DESTDIR)$(SDK_LIB_DIR); \
@@ -935,9 +935,9 @@ if CREATE_JAVA_HOME
  DIRECTORY=$$(dirname $$($(DESTDIR)$(bindir)/`echo gcj | sed 
's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
-print-file-name=include/$$headername.h)); \
  RELATIVE=$$(relative $$DIRECTORY \
-   $(DESTDIR)$(SDK_INCLUDE_DIR)/linux); \
+   $(DESTDIR)$(SDK_INCLUDE_DIR)/$(OS)); \
  ln -sf $$RELATIVE/$$headername.h \
-   $(DESTDIR)$(SDK_INCLUDE_DIR)/linux/$$headername.h; \
+   $(DESTDIR)$(SDK_INCLUDE_DIR)/$(OS)/$$headername.h; \
done; \
RELATIVE=$$(relative $(DESTDIR)$(datadir)/java \
  $(DESTDIR)$(JVM_ROOT_DIR)/$(SDK_DIR));