Przeglądaj źródła

fix compile with uClibc, tested on rb532

Waldemar Brodkorb 14 lat temu
rodzic
commit
96d9f7612b

+ 1 - 0
jtools/Makefile

@@ -5,6 +5,7 @@ include $(TOPDIR)/rules.mk
 
 TARGETS:=
 ifneq ($(ADK_PACKAGE_OPENJDK),)
+# jikes is for ant
 TARGETS+=fastjar gcj ecj jikes classpath jamvm ant openjdk
 endif
 

+ 5 - 1
package/openjdk/Makefile

@@ -24,7 +24,7 @@ PKG_SITES:=		http://download.java.net/openjdk/jdk6/promoted/b22/ \
 			http://icedtea.classpath.org/download/drops/ \
 			http://icedtea.classpath.org/download/source/
 
-PKG_CFLINE_OPENJDK:=	depends on ADK_TARGET_LIB_GLIBC || ADK_TARGET_LIB_EGLIBC && !ADK_TARGET_SYSTEM_LEMOTE_YEELONG
+#PKG_CFLINE_OPENJDK:=	depends on ADK_TARGET_LIB_GLIBC || ADK_TARGET_LIB_EGLIBC && !ADK_TARGET_SYSTEM_LEMOTE_YEELONG
 PKG_HOST_DEPENDS:=	!darwin !cygwin !openbsd !netbsd !freebsd
 
 # autotools infrastructure for OpenJDK
@@ -106,6 +106,10 @@ OPENJDK_NATIVE_ENV+=	ALT_COMPILER_PATH=$(STAGING_HOST_DIR)/$(REAL_GNU_TARGET_NAM
 			TARGET_ALIAS=$(GNU_TARGET_NAME) BUILD_ALIAS=$(GNU_HOST_NAME) HOST_ALIAS=$(GNU_TARGET_NAME)
 ALL_TARGET:=		icedtea
 
+# add include path for Xrender.h from staging directory
+post-patch:
+	$(SED) "s#@ADK_TARGETDIR@#$(STAGING_TARGET_DIR)#" ${WRKDIST}/$(PKG_NAME)-$(PKG_VERSION)/jdk/make/sun/xawt/Makefile
+
 do-extract:
 	cd ${WRKDIST}; mkdir $(PKG_NAME)-$(PKG_VERSION); \
 		tar xzf $(TOPDIR)/dl/$(PKG_NAME)-$(PKG_VERSION)-src-$(PKG_EXTRAVER).tar.gz -C $(PKG_NAME)-$(PKG_VERSION)

+ 53 - 0
package/openjdk/patches/cross-compile.patch

@@ -0,0 +1,53 @@
+--- w-openjdk-6-1.orig/openjdk-6/jdk/make/sun/awt/Makefile	2011-02-28 17:06:11.000000000 +0100
++++ w-openjdk-6-1/openjdk-6/jdk/make/sun/awt/Makefile	2011-08-07 17:00:37.676468717 +0200
+@@ -509,10 +509,7 @@
+ #
+ 
+ ifeq ($(PLATFORM), linux)
+-CPPFLAGS += -I$(MOTIF_DIR)/include \
+-            -I$(OPENWIN_HOME)/include \
+-            -I$(OPENWIN_HOME)/include/X11/extensions \
+-            -I$(PLATFORM_SRC)/native/$(PKGDIR)/font 
++CPPFLAGS += -I$(PLATFORM_SRC)/native/$(PKGDIR)/font 
+ endif
+ CPPFLAGS += -I$(SHARE_SRC)/native/$(PKGDIR)/debug \
+             -I$(SHARE_SRC)/native/$(PKGDIR)/../font \
+@@ -535,10 +532,6 @@
+             -I$(PLATFORM_SRC)/native/$(PKGDIR) \
+ 	    $(EVENT_MODEL)
+ 
+-ifeq ($(PLATFORM), linux)
+-LDFLAGS += -L$(MOTIF_LIB) -L$(OPENWIN_LIB)
+-endif
+-
+ LDFLAGS += -L$(LIBDIR)/$(LIBARCH)/$(TSOBJDIR) \
+ 	   $(AWT_RUNPATH)
+ 
+--- w-openjdk-6-1.orig/openjdk-6/jdk/make/sun/xawt/Makefile	2011-02-28 17:06:12.000000000 +0100
++++ w-openjdk-6-1/openjdk-6/jdk/make/sun/xawt/Makefile	2011-08-07 18:31:08.635355054 +0200
+@@ -96,6 +96,10 @@
+ 
+ CPPFLAGS += -I$(CUPS_HEADERS_PATH)
+ 
++ifeq ($(PLATFORM), linux)
++CPPFLAGS += -I@ADK_TARGETDIR@/usr/include/X11/extensions
++endif
++
+ CPPFLAGS += -DXAWT -DXAWT_HACK \
+         -I$(TEMPDIR)/../../sun.awt/awt/CClassHeaders \
+         -I$(PLATFORM_SRC)/native/sun/awt \
+@@ -122,14 +126,6 @@
+         -I$(SHARE_SRC)/native/sun/awt \
+         -I$(PLATFORM_SRC)/native/sun/awt 
+ 
+-ifeq ($(PLATFORM), linux)
+-# Allows for builds on Debian GNU Linux, X11 is in a different place 
+-  CPPFLAGS += -I/usr/X11R6/include/X11/extensions \
+-              -I/usr/include/X11/extensions \
+-              -I$(MOTIF_DIR)/include \
+-              -I$(OPENWIN_HOME)/include 
+-endif
+-
+ ifeq ($(PLATFORM), solaris)
+   CPPFLAGS += -I$(OPENWIN_HOME)/include/X11/extensions -I$(MOTIF_DIR)/include 
+ endif

+ 12 - 2
package/openjdk/patches/disable-backtrace.patch

@@ -1,6 +1,16 @@
 --- w-openjdk-6-1.orig/openjdk-6/jdk/src/solaris/native/sun/xawt/XToolkit.c	2011-02-28 17:06:50.000000000 +0100
-+++ w-openjdk-6-1/openjdk-6/jdk/src/solaris/native/sun/xawt/XToolkit.c	2011-04-10 22:33:28.481412674 +0200
-@@ -689,7 +689,7 @@
++++ w-openjdk-6-1/openjdk-6/jdk/src/solaris/native/sun/xawt/XToolkit.c	2011-08-08 10:45:01.445330729 +0200
+@@ -27,9 +27,6 @@
+ #include <X11/Xutil.h>
+ #include <X11/Xos.h>
+ #include <X11/Xatom.h>
+-#ifdef __linux__
+-#include <execinfo.h>
+-#endif
+ 
+ #include <jvm.h>
+ #include <jni.h>
+@@ -689,7 +686,7 @@
      return ret;
  }
  

+ 22 - 0
package/openjdk/patches/inc-path.patch

@@ -0,0 +1,22 @@
+--- w-openjdk-6-1.orig/openjdk-6/jdk/make/common/Defs.gmk	2011-02-28 17:06:10.000000000 +0100
++++ w-openjdk-6-1/openjdk-6/jdk/make/common/Defs.gmk	2011-08-07 21:21:49.335286149 +0200
+@@ -173,7 +173,7 @@
+     ifeq ($(DEVTOOLS_FT_DIR_EXISTS), true)
+       FREETYPE_HEADERS_PATH = $(DEVTOOLS_FT_DIR)/include
+     else
+-      FREETYPE_HEADERS_PATH = /usr/include
++      FREETYPE_HEADERS_PATH = /usr/include/disabled
+     endif
+   endif
+ endif
+--- w-openjdk-6-1.orig/openjdk-6/jdk/make/common/shared/Defs-linux.gmk	2011-02-28 17:06:10.000000000 +0100
++++ w-openjdk-6-1/openjdk-6/jdk/make/common/shared/Defs-linux.gmk	2011-08-08 10:07:58.975256728 +0200
+@@ -170,7 +170,7 @@
+   GCC29_COMPILER_PATH = $(JDK_DEVTOOLS_DIR)/$(PLATFORM)/gcc29/usr/
+ endif
+ 
+-_CUPS_HEADERS_PATH=/usr/include
++_CUPS_HEADERS_PATH=/usr/include/disabled
+ 
+ # Import JDK images allow for partial builds, components not built are
+ #    imported (or copied from) these import areas when needed.

+ 92 - 0
package/openjdk/patches/uClibc-compat.patch

@@ -0,0 +1,92 @@
+--- w-openjdk-6-1.orig/openjdk-6/hotspot/src/os/linux/vm/os_linux.cpp	2011-02-28 17:03:14.000000000 +0100
++++ w-openjdk-6-1/openjdk-6/hotspot/src/os/linux/vm/os_linux.cpp	2011-08-07 14:30:00.195403776 +0200
+@@ -53,7 +53,6 @@
+ # include <string.h>
+ # include <syscall.h>
+ # include <sys/sysinfo.h>
+-# include <gnu/libc-version.h>
+ # include <sys/ipc.h>
+ # include <sys/shm.h>
+ # include <link.h>
+@@ -553,9 +552,10 @@
+      os::Linux::set_glibc_version(str);
+   } else {
+      // _CS_GNU_LIBC_VERSION is not supported, try gnu_get_libc_version()
+-     static char _gnu_libc_version[32];
+-     jio_snprintf(_gnu_libc_version, sizeof(_gnu_libc_version),
+-              "glibc %s %s", gnu_get_libc_version(), gnu_get_libc_release());
++     // static char _gnu_libc_version[32];
++     // jio_snprintf(_gnu_libc_version, sizeof(_gnu_libc_version),
++     //       "glibc %s %s", gnu_get_libc_version(), gnu_get_libc_release());
++     static char _gnu_libc_version[32] = "2.12";
+      os::Linux::set_glibc_version(_gnu_libc_version);
+   }
+
+@@ -2434,10 +2434,8 @@
+ // If we are running with earlier version, which did not have symbol versions,
+ // we should use the base version.
+ void* os::Linux::libnuma_dlsym(void* handle, const char *name) {
+-  void *f = dlvsym(handle, name, "libnuma_1.1");
+-  if (f == NULL) {
+-    f = dlsym(handle, name);
+-  }
++  void *f;
++  f = dlsym(handle, name);
+   return f;
+ }
+ 
+@@ -4446,7 +4444,21 @@
+ // Linux doesn't yet have a (official) notion of processor sets,
+ // so just return the system wide load average.
+ int os::loadavg(double loadavg[], int nelem) {
+-  return ::getloadavg(loadavg, nelem);
++ FILE *LOADAVG;
++ double avg[3] = { 0.0, 0.0, 0.0 };
++ int i, res = -1;;
++
++ if ((LOADAVG = fopen("/proc/loadavg", "r"))) {
++ fscanf(LOADAVG, "%lf %lf %lf", &avg[0], &avg[1], &avg[2]);
++ res = 0;
++ fclose(LOADAVG);
++ }
++
++ for (i = 0; (i < nelem) && (i < 3); i++) {
++ loadavg[i] = avg[i];
++ }
++
++ return res;
+ }
+ 
+ void os::pause() {
+
+--- w-openjdk-6-1.orig/openjdk-6/hotspot/make/linux/platform_zero.in	2011-02-28 17:03:13.000000000 +0100
++++ w-openjdk-6-1/openjdk-6/hotspot/make/linux/platform_zero.in	2011-08-07 13:56:56.875281880 +0200
+@@ -14,4 +14,4 @@
+ 
+ gnu_dis_arch = zero
+ 
+-sysdefs = -DLINUX -D_GNU_SOURCE -DCC_INTERP -DZERO -D@ZERO_ARCHDEF@ -DZERO_LIBARCH=\"@ZERO_LIBARCH@\"
++sysdefs = -DLINUX -D_GNU_SOURCE -DCC_INTERP -DZERO -D@ZERO_ARCHDEF@ -DZERO_LIBARCH=\"@ZERO_LIBARCH@\" -D__STDC_LIMIT_MACROS
+
+--- w-openjdk-6-1.orig/openjdk-6/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp	2011-02-28 17:03:22.000000000 +0100
++++ w-openjdk-6-1/openjdk-6/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp	2011-08-07 12:32:09.325489647 +0200
+@@ -238,7 +238,7 @@
+ #endif
+ inline int g_isnan(double f) { return isnand(f); }
+ #elif LINUX
+-inline int g_isnan(float  f) { return isnanf(f); }
++inline int g_isnan(float  f) { return __isnanf(f); }
+ inline int g_isnan(double f) { return isnan(f); }
+ #else
+ #error "missing platform-specific definition here"
+@@ -252,8 +252,8 @@
+ 
+ // Checking for finiteness
+ 
+-inline int g_isfinite(jfloat  f)                 { return finite(f); }
+-inline int g_isfinite(jdouble f)                 { return finite(f); }
++inline int g_isfinite(jfloat  f)                 { return isfinite(f); }
++inline int g_isfinite(jdouble f)                 { return isfinite(f); }
+ 
+ 
+ // Wide characters