diff options
Diffstat (limited to 'recipes-core/icedtea/icedtea7-native.inc')
-rw-r--r-- | recipes-core/icedtea/icedtea7-native.inc | 249 |
1 files changed, 249 insertions, 0 deletions
diff --git a/recipes-core/icedtea/icedtea7-native.inc b/recipes-core/icedtea/icedtea7-native.inc new file mode 100644 index 0000000..e209a68 --- /dev/null +++ b/recipes-core/icedtea/icedtea7-native.inc | |||
@@ -0,0 +1,249 @@ | |||
1 | DESCRIPTION = "Harness to build the source code from OpenJDK using Free Software build tools" | ||
2 | HOMEPAGE = "http://icedtea.classpath.org" | ||
3 | LICENSE = "GPL-2.0-with-classpath-exception" | ||
4 | INC_PR = "r0" | ||
5 | |||
6 | DEPENDS = "virtual/javac-native virtual/java-native classpath-native \ | ||
7 | rhino-native ant-native \ | ||
8 | libx11-native xproto-native libxt-native libxext-native libxrender-native \ | ||
9 | giflib-native jpeg-native libpng-native \ | ||
10 | glib-2.0-native freetype-native zlib-native \ | ||
11 | fontconfig-native zip-native alsa-lib-native \ | ||
12 | " | ||
13 | |||
14 | inherit native java autotools | ||
15 | |||
16 | JAVA_HOME[unexport] = "1" | ||
17 | |||
18 | SRC_URI = " \ | ||
19 | ${ICEDTEA_URI} \ | ||
20 | ${OPENJDK_URI} \ | ||
21 | ${HOTSPOT_URI} \ | ||
22 | ${CORBA_URI} \ | ||
23 | ${JAXP_URI} \ | ||
24 | ${JAXWS_URI} \ | ||
25 | ${JDK_URI} \ | ||
26 | ${LANGTOOLS_URI} \ | ||
27 | ${ICEDTEA_PATCHES} \ | ||
28 | ${OPENJDK_PATCHES} \ | ||
29 | " | ||
30 | |||
31 | S = "${WORKDIR}/${ICEDTEA}" | ||
32 | B = "${S}/build" | ||
33 | |||
34 | # openjdk looks in /usr/include and /usr/lib for freetype by default. | ||
35 | export ALT_FREETYPE_HEADERS_PATH = "${STAGING_INCDIR}/freetype2" | ||
36 | export ALT_FREETYPE_LIB_PATH = "${STAGING_LIBDIR}" | ||
37 | |||
38 | # OpenJDK supports parallel compilation but uses a plain number for this. | ||
39 | # In OE we have PARALLEL_MAKE which is the actual option passed to make, | ||
40 | # e.g. "-j 4". | ||
41 | ICEDTEA_PARALLEL_MAKE := "${PARALLEL_MAKE}" | ||
42 | PARALLEL_MAKE = "" | ||
43 | def get_jdk7_native_jobs(d): | ||
44 | import bb | ||
45 | |||
46 | pm = bb.data.getVar('ICEDTEA_PARALLEL_MAKE', d, 1); | ||
47 | if not pm: | ||
48 | return "1" | ||
49 | |||
50 | pm = pm.split("j"); | ||
51 | if (len(pm) == 2): | ||
52 | return pm[1].strip() | ||
53 | |||
54 | # Whatever found in PARALLEL_MAKE was not suitable. | ||
55 | return "1" | ||
56 | |||
57 | JDK_JOBS = "${@get_jdk7_native_jobs(d)}" | ||
58 | |||
59 | EXTRA_OECONF = "\ | ||
60 | --with-parallel-jobs=${JDK_JOBS} \ | ||
61 | \ | ||
62 | --disable-tests \ | ||
63 | --disable-hotspot-tests \ | ||
64 | --disable-langtools-tests \ | ||
65 | --disable-jdk-tests \ | ||
66 | --disable-pulse-java \ | ||
67 | --disable-docs \ | ||
68 | --disable-nss \ | ||
69 | --disable-system-lcms \ | ||
70 | --disable-system-gtk \ | ||
71 | \ | ||
72 | --with-jdk-home=${WORKDIR}/fake-jdk \ | ||
73 | --with-javac=${STAGING_BINDIR_NATIVE}/javac \ | ||
74 | --with-rhino=${STAGING_DATADIR_NATIVE}/java/rhino.jar \ | ||
75 | \ | ||
76 | --with-openjdk-src-zip=${DL_DIR}/${OPENJDK_FILE} \ | ||
77 | --with-hotspot-src-zip=${DL_DIR}/${HOTSPOT_FILE} \ | ||
78 | --with-corba-src-zip=${DL_DIR}/${CORBA_FILE} \ | ||
79 | --with-jaxp-src-zip=${DL_DIR}/${JAXP_FILE} \ | ||
80 | --with-jaxws-src-zip=${DL_DIR}/${JAXWS_FILE} \ | ||
81 | --with-jdk-src-zip=${DL_DIR}/${JDK_FILE} \ | ||
82 | --with-langtools-src-zip=${DL_DIR}/${LANGTOOLS_FILE} \ | ||
83 | " | ||
84 | |||
85 | JDK_DIR = "icedtea7-native" | ||
86 | |||
87 | JDK_INSTALL_DIR = "${D}/${libdir_jvm}/${JDK_DIR}" | ||
88 | |||
89 | do_configure_prepend() { | ||
90 | echo "Configure with parallel-jobs: ${JDK_JOBS}" | ||
91 | |||
92 | case "${TRANSLATED_TARGET_ARCH}" in | ||
93 | x86-64) | ||
94 | libarch=amd64 | ||
95 | ;; | ||
96 | i386|i486|i586|i686) | ||
97 | libarch=x86 | ||
98 | ;; | ||
99 | *) | ||
100 | arch=${TARGET_ARCH} | ||
101 | libarch=${TARGET_ARCH} | ||
102 | ;; | ||
103 | esac | ||
104 | |||
105 | # Automatically copy everything that starts with "icedtea" and ends with | ||
106 | # ".patch" into the patches directory. | ||
107 | find ${WORKDIR} -maxdepth 1 -name "icedtea*.patch" -exec cp {} ${S}/patches \; | ||
108 | |||
109 | # Prepare JDK-like directory with Classpath' files which we can treat as a | ||
110 | # SYSTEM_GCJ_DIR afterwards. | ||
111 | mkdir -p ${WORKDIR}/fake-jdk/jre/lib/ | ||
112 | ln -sf ${STAGING_DATADIR_NATIVE}/classpath/glibj.zip ${WORKDIR}/fake-jdk/jre/lib/rt.jar | ||
113 | |||
114 | mkdir -p ${WORKDIR}/fake-jdk/bin | ||
115 | ln -sf ${STAGING_BINDIR_NATIVE}/java ${WORKDIR}/fake-jdk/bin/java | ||
116 | #ln -sf ${STAGING_BINDIR_NATIVE}/javac ${WORKDIR}/fake-jdk/bin/javac | ||
117 | ln -sf ${STAGING_BINDIR_NATIVE}/gjavah ${WORKDIR}/fake-jdk/bin/javah | ||
118 | ln -sf ${STAGING_BINDIR_NATIVE}/gjar ${WORKDIR}/fake-jdk/bin/jar | ||
119 | ln -sf ${STAGING_BINDIR_NATIVE}/grmic ${WORKDIR}/fake-jdk/bin/rmic | ||
120 | ln -sf ${STAGING_BINDIR_NATIVE}/gnative2ascii ${WORKDIR}/fake-jdk/bin/native2ascii | ||
121 | |||
122 | mkdir -p ${WORKDIR}/fake-jdk/include | ||
123 | for i in ${STAGING_INCDIR_NATIVE}/classpath/* ;do | ||
124 | test -r $i | continue; | ||
125 | bn=`basename $i` | ||
126 | ln -sf $i ${WORKDIR}/fake-jdk/include/$bn; | ||
127 | done | ||
128 | } | ||
129 | |||
130 | do_configure_append() { | ||
131 | oe_runmake patch-fsg | ||
132 | |||
133 | for F in openjdk/jdk/make/common/shared/Compiler-gcc.gmk ; | ||
134 | do | ||
135 | sed -i \ | ||
136 | -e"s|\$(COMPILER_PATH)gcc\$(GCC_SUFFIX)|${CC}|" \ | ||
137 | -e"s|\$(COMPILER_PATH)gcc\$(GCC_SUFFIX) -E|${CPP}|" \ | ||
138 | -e"s|\$(COMPILER_PATH)g++\$(GCC_SUFFIX)|${CXX}|" \ | ||
139 | $F | ||
140 | done | ||
141 | |||
142 | for F in openjdk/hotspot/make/linux/makefiles/gcc.make openjdk/hotspot/agent/src/os/linux/Makefile ; | ||
143 | do | ||
144 | sed -i \ | ||
145 | -e"s|gcc\$(GCC_SUFFIX)|${CC}|" \ | ||
146 | -e"s|g++\$(GCC_SUFFIX)|${CXX}|" \ | ||
147 | $F | ||
148 | done | ||
149 | oe_runmake patch-boot | ||
150 | } | ||
151 | |||
152 | EXTRA_OEMAKE = ' \ | ||
153 | OE_CFLAGS="${CFLAGS}" \ | ||
154 | OE_CPPFLAGS="${CPPFLAGS}" \ | ||
155 | OE_CXXFLAGS="${CXXFLAGS}" \ | ||
156 | OE_LDFLAGS="${LDFLAGS}" \ | ||
157 | ZIPEXE="${STAGING_BINDIR_NATIVE}/zip" \ | ||
158 | ' | ||
159 | |||
160 | do_compile() { | ||
161 | # OpenJDK uses slightly different names for certain arches. We need to know | ||
162 | # this to create some files which are expected by the build. | ||
163 | case "${TRANSLATED_TARGET_ARCH}" in | ||
164 | x86-64) | ||
165 | arch=amd64 | ||
166 | libarch=amd64 | ||
167 | ;; | ||
168 | i386|i486|i586|i686) | ||
169 | arch=x86 | ||
170 | libarch=x86 | ||
171 | ;; | ||
172 | *) | ||
173 | arch=${TARGET_ARCH} | ||
174 | libarch=${TARGET_ARCH} | ||
175 | ;; | ||
176 | esac | ||
177 | |||
178 | install -d openjdk-boot/control/build/linux-$arch/hotspot/import/jre/lib | ||
179 | if [ $libarch != $arch ]; then | ||
180 | # Something is strange with the directoy naming. OpenJDK uses both variants. | ||
181 | ln -sf $libarch openjdk-boot/control/build/linux-$arch/hotspot/import/jre/lib/$arch | ||
182 | fi | ||
183 | |||
184 | common_dirs="openjdk.build-boot/tmp/sun openjdk.build/tmp/sun" | ||
185 | for CM in ${common_dirs} | ||
186 | do | ||
187 | for DM in javax.sound/jsoundalsa sun.awt.X11/xawt sun.awt/jawt; | ||
188 | do | ||
189 | bbnote "creating ${CM}/${DM}/obj64/.files_compiled" | ||
190 | install -d ${CM}/${DM}/obj64 | ||
191 | touch ${CM}/${DM}/obj64/.files_compiled | ||
192 | |||
193 | bbnote "creating ${CM}/${DM}/obj/.files_compiled" | ||
194 | install -d ${CM}/${DM}/obj | ||
195 | touch ${CM}/${DM}/obj/.files_compiled | ||
196 | done | ||
197 | done | ||
198 | |||
199 | # Now cross-compile bootstrap JDK | ||
200 | oe_runmake icedtea | ||
201 | } | ||
202 | |||
203 | def jdk_arch(d): | ||
204 | import bb | ||
205 | |||
206 | target_arch = bb.data.getVar('TRANSLATED_TARGET_ARCH', d, 1) | ||
207 | |||
208 | if target_arch in ['i386', 'i486', 'i586', 'i686']: | ||
209 | return "x86" | ||
210 | elif target_arch in ['x86-64']: | ||
211 | return "amd64" | ||
212 | |||
213 | return target_arch | ||
214 | |||
215 | do_install() { | ||
216 | case "${TRANSLATED_TARGET_ARCH}" in | ||
217 | x86-64) | ||
218 | JDK_ARCH=amd64 | ||
219 | ;; | ||
220 | i386|i486|i586|i686) | ||
221 | JDK_ARCH=x86 | ||
222 | ;; | ||
223 | *) | ||
224 | JDK_ARCH=${TARGET_ARCH} | ||
225 | ;; | ||
226 | esac | ||
227 | |||
228 | install -d ${JDK_INSTALL_DIR} | ||
229 | |||
230 | SDKDIR=openjdk.build/j2sdk-image | ||
231 | for F in ${SDKDIR}/bin ${SDKDIR}/include ${SDKDIR}/jre ${SDKDIR}/lib | ||
232 | do | ||
233 | cp -RL $F ${JDK_INSTALL_DIR} | ||
234 | done | ||
235 | |||
236 | #cp openjdk-boot/jdk/src/solaris/hpi/export/*.h ${JDK_INSTALL_DIR}/include/hpi | ||
237 | #cp openjdk-boot/jdk/src/share/hpi/export/*.h ${JDK_INSTALL_DIR}/include/hpi | ||
238 | |||
239 | install -d ${JDK_INSTALL_DIR}/include/javavm | ||
240 | cp openjdk-boot/jdk/src/share/javavm/export/*.h ${JDK_INSTALL_DIR}/include/javavm | ||
241 | cp openjdk-boot/jdk/src/solaris/javavm/export/*.h ${JDK_INSTALL_DIR}/include/javavm | ||
242 | |||
243 | # Fix libjvm.so dependency of libfontmanager.so | ||
244 | ln -sf server/libjvm.so ${JDK_INSTALL_DIR}/jre/lib/${JDK_ARCH}/libjvm.so | ||
245 | ln -sf server/libjvm.so ${JDK_INSTALL_DIR}/jre/lib/${JDK_ARCH}/libjvm.so.0 | ||
246 | |||
247 | # Fix missing write permissions on the files. | ||
248 | chmod ug+w -R ${JDK_INSTALL_DIR} | ||
249 | } | ||