Advertisement
Guest User

lwjgl-patch

a guest
Nov 29th, 2011
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.39 KB | None | 0 0
  1. Index: src/java/org/lwjgl/FreeBSDSysImplementation.java
  2. ===================================================================
  3. --- src/java/org/lwjgl/FreeBSDSysImplementation.java (revision )
  4. +++ src/java/org/lwjgl/FreeBSDSysImplementation.java (revision )
  5. @@ -0,0 +1,87 @@
  6. +/*
  7. + * Copyright (c) 2002-2008 LWJGL Project
  8. + * All rights reserved.
  9. + *
  10. + * Redistribution and use in source and binary forms, with or without
  11. + * modification, are permitted provided that the following conditions are
  12. + * met:
  13. + *
  14. + * * Redistributions of source code must retain the above copyright
  15. + * notice, this list of conditions and the following disclaimer.
  16. + *
  17. + * * Redistributions in binary form must reproduce the above copyright
  18. + * notice, this list of conditions and the following disclaimer in the
  19. + * documentation and/or other materials provided with the distribution.
  20. + *
  21. + * * Neither the name of 'LWJGL' nor the names of
  22. + * its contributors may be used to endorse or promote products derived
  23. + * from this software without specific prior written permission.
  24. + *
  25. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  26. + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  27. + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  28. + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  29. + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  30. + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  31. + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  32. + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  33. + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  34. + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  35. + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  36. + */
  37. +package org.lwjgl;
  38. +
  39. +import java.security.AccessController;
  40. +import java.security.PrivilegedAction;
  41. +
  42. +/**
  43. + *
  44. + */
  45. +final class FreeBSDSysImplementation extends J2SESysImplementation {
  46. + private static final int JNI_VERSION = 19;
  47. +
  48. + static {
  49. + // Load libawt.so and libmawt.so, needed for libjawt.so
  50. + java.awt.Toolkit.getDefaultToolkit();
  51. +
  52. + // manually load libjawt.so into vm, needed since Java 7
  53. + AccessController.doPrivileged(new PrivilegedAction<Object>() {
  54. + public Object run() {
  55. + try {
  56. + System.loadLibrary("jawt");
  57. + } catch (UnsatisfiedLinkError e) {
  58. + // catch and ignore an already loaded in another classloader
  59. + // exception, as vm already has it loaded
  60. + }
  61. + return null;
  62. + }
  63. + });
  64. + }
  65. +
  66. + public int getRequiredJNIVersion() {
  67. + return JNI_VERSION;
  68. + }
  69. +
  70. + public boolean openURL(final String url) {
  71. + // simply copied from Linux
  72. +
  73. + String[] browsers = {"xdg-open", "firefox", "mozilla", "opera", "konqueror", "nautilus", "galeon", "netscape"};
  74. +
  75. + for ( final String browser : browsers ) {
  76. + try {
  77. + LWJGLUtil.execPrivileged(new String[] { browser, url });
  78. + return true;
  79. + } catch (Exception e) {
  80. + // Ignore
  81. + e.printStackTrace(System.err);
  82. + }
  83. + }
  84. +
  85. + // Seems to have failed
  86. + return false;
  87. + }
  88. +
  89. + public boolean has64Bit() {
  90. + return true;
  91. + }
  92. +}
  93. Index: platform_build/linux_ant/build.xml
  94. ===================================================================
  95. --- platform_build/linux_ant/build.xml (revision 3704)
  96. +++ platform_build/linux_ant/build.xml (revision )
  97. @@ -4,8 +4,8 @@
  98. <property name="native" location="../../src/native"/>
  99. <property name="libname32" value="liblwjgl.so"/>
  100. <property name="libname64" value="liblwjgl64.so"/>
  101. - <property name="libs32" value="-L/usr/X11R6/lib -L/usr/X11/lib -lm -lX11 -lXext -lXcursor -lXrandr -lpthread -L${java.home}/lib/i386 -ljawt" />
  102. - <property name="libs64" value="-L/usr/X11R6/lib64 -L/usr/X11/lib64 -lm -lX11 -lXext -lXcursor -lXrandr -lXxf86vm -lpthread -L${java.home}/lib/amd64 -ljawt" />
  103. + <property name="libs32" value="-L/usr/X11R6/lib -L/usr/X11/lib -L/usr/local/lib -lm -lX11 -lXext -lXcursor -lXrandr -lpthread -L${java.home}/lib/i386 -ljawt" />
  104. + <property name="libs64" value="-L/usr/X11R6/lib64 -L/usr/X11/lib64 -L/usr/local/lib -lm -lX11 -lXext -lXcursor -lXrandr -lXxf86vm -lpthread -L${java.home}/lib/amd64 -ljawt" />
  105. <property name="cflags32" value="-O2 -Wall -c -fPIC -std=c99 -Wunused"/>
  106.  
  107. <target name="clean">
  108. @@ -45,6 +45,7 @@
  109. <condition property="build.32bit.only">
  110. <not>
  111. <or>
  112. + <equals arg1="${hwplatform}" arg2="amd64"/>
  113. <equals arg1="${hwplatform}" arg2="x86_64"/>
  114. <equals arg1="${hwplatform}" arg2="i86pc"/>
  115. </or>
  116. @@ -53,10 +54,16 @@
  117.  
  118. <!-- On linux, the 64 bit jre doesn't have the 32 bit libs -->
  119. <condition property="build.64bit.only">
  120. + <or>
  121. - <and>
  122. - <os name="Linux"/>
  123. - <equals arg1="${hwplatform}" arg2="x86_64"/>
  124. - </and>
  125. + <and>
  126. + <os name="Linux"/>
  127. + <equals arg1="${hwplatform}" arg2="x86_64"/>
  128. + </and>
  129. + <and>
  130. + <os name="FreeBSD"/>
  131. + <equals arg1="${hwplatform}" arg2="amd64"/>
  132. + </and>
  133. + </or>
  134. </condition>
  135.  
  136. <antcall target="compile32"/>
  137. @@ -69,9 +76,12 @@
  138. <arg line="${cflags32} ${cflags_pthread}"/>
  139. <arg value="-I${java.home}/include"/>
  140. <arg value="-I${java.home}/include/linux"/>
  141. + <arg value="-I${java.home}/include/freebsd"/>
  142. <arg value="-I${java.home}/../include"/>
  143. <arg value="-I${java.home}/../include/linux"/>
  144. + <arg value="-I${java.home}/../include/freebsd"/>
  145. <arg value="-I${java.home}/../include/solaris"/>
  146. + <arg value="-I/usr/local/include"/>
  147. <arg value="-I${native}/common"/>
  148. <arg value="-I${native}/common/opengl"/>
  149. <arg value="-I${native}/linux"/>
  150. @@ -101,11 +111,15 @@
  151. <arg line="${cflags64} ${cflags_pthread}"/>
  152. <arg value="-I${java.home}/include"/>
  153. <arg value="-I${java.home}/include/linux"/>
  154. + <arg value="-I${java.home}/include/freebsd"/>
  155. <arg value="-I${java.home}/../include"/>
  156. <arg value="-I${java.home}/../include/linux"/>
  157. + <arg value="-I${java.home}/../include/freebsd"/>
  158. <arg value="-I${java.home}/../include/solaris"/>
  159. + <arg value="-I/usr/local/include"/>
  160. - <arg value="-I${native}/common"/>
  161. + <arg value="-I${native}/common"/>
  162. <arg value="-I${native}/common/opengl"/>
  163. + <arg value="-I${native}/common/opengl"/>
  164. <arg value="-I${native}/linux"/>
  165. <arg value="-I${native}/linux/opengl"/>
  166. <mapper type="glob" from="*.c" to="*.o"/>
  167. Index: build.xml
  168. ===================================================================
  169. --- build.xml (revision 3704)
  170. +++ build.xml (revision )
  171. @@ -31,6 +31,7 @@
  172. <mkdir dir="${lwjgl.temp}/native" taskname="initialiazing temp/native folder" />
  173. <mkdir dir="${lwjgl.temp}/native/windows" taskname="initialiazing temp/windows folder" />
  174. <mkdir dir="${lwjgl.temp}/native/linux" taskname="initialiazing temp/linux folder" />
  175. + <mkdir dir="${lwjgl.temp}/native/freebsd" taskname="initialiazing temp/freebsd folder" />
  176. <mkdir dir="${lwjgl.temp}/native/macosx" taskname="initialiazing temp/macosx folder" />
  177. <mkdir dir="${lwjgl.temp}/native/solaris" taskname="initialiazing temp/solaris folder" />
  178. </target>
  179. @@ -55,7 +56,7 @@
  180. <!-- Creates a distribution of LWJGL -->
  181. <target name="release" description="Creates a distribution of LWJGL using supplied native binaries">
  182. <!-- Warn user -->
  183. - <echo message="Before running the release target, please manually compile all platforms and place required files in ${lwjgl.lib}/windows, ${lwjgl.lib}/linux and ${lwjgl.lib}/macosx${line.separator}Missing files will result in a successfull built, but with incomplete release zips"/>
  184. + <echo message="Before running the release target, please manually compile all platforms and place required files in ${lwjgl.lib}/windows, ${lwjgl.lib}/freebsd , ${lwjgl.lib}/linux and ${lwjgl.lib}/macosx${line.separator}Missing files will result in a successfull built, but with incomplete release zips"/>
  185. <input
  186. message="All data in the ${lwjgl.dist} folder will be deleted. Continue? "
  187. validargs="yes,no"
  188. @@ -237,6 +238,11 @@
  189. <patternset refid="lwjgl-linux.fileset" />
  190. </fileset>
  191. </copy>
  192. + <copy todir="${lwjgl.temp}/native/freebsd">
  193. + <fileset dir="${lwjgl.lib}/freebsd">
  194. + <patternset refid="lwjgl-freebsd.fileset" />
  195. + </fileset>
  196. + </copy>
  197. <copy todir="${lwjgl.temp}/native/macosx">
  198. <fileset dir="${lwjgl.lib}/macosx">
  199. <patternset refid="lwjgl-macosx.fileset" />
  200. @@ -373,6 +379,13 @@
  201. </tokenfilter>
  202. </filterchain>
  203. </loadfile>
  204. + <loadfile srcfile="${lwjgl.src}/java/org/lwjgl/FreeBSDSysImplementation.java" property="lwjgl.java.freebsd.version">
  205. + <filterchain>
  206. + <tokenfilter>
  207. + <containsstring contains="JNI_VERSION ="/>
  208. + </tokenfilter>
  209. + </filterchain>
  210. + </loadfile>
  211. <loadfile srcfile="${lwjgl.src}/java/org/lwjgl/MacOSXSysImplementation.java" property="lwjgl.java.macosx.version">
  212. <filterchain>
  213. <tokenfilter>
  214. @@ -405,6 +418,7 @@
  215. lwjgl.java.windows.version = ${lwjgl.java.windows.version}
  216. lwjgl.native.windows.version = ${lwjgl.native.windows.version}
  217. lwjgl.java.linux.version = ${lwjgl.java.linux.version}
  218. + lwjgl.java.freebsd.version = ${lwjgl.java.freebsd.version}
  219. lwjgl.native.linux.version = ${lwjgl.native.linux.version}
  220. lwjgl.java.macosx.version = ${lwjgl.java.macosx.version}
  221. lwjgl.native.macosx.version = ${lwjgl.native.macosx.version}
  222. @@ -465,6 +479,11 @@
  223. </condition>
  224. <antcall target="-compile_native_linux" />
  225.  
  226. + <condition property="lwjgl.platform.freebsd">
  227. + <os name="FreeBSD" />
  228. + </condition>
  229. + <antcall target="-compile_native_freebsd" />
  230. +
  231. <condition property="lwjgl.platform.solaris">
  232. <os name="SunOS" />
  233. </condition>
  234. @@ -494,6 +513,14 @@
  235. <!-- headless issues <version-check platform="linux"/> -->
  236. </target>
  237.  
  238. + <!-- Compiles LWJGL on FreeBSD platforms -->
  239. + <target name="-compile_native_freebsd" if="lwjgl.platform.freebsd">
  240. + <ant antfile="platform_build/linux_ant/build.xml" inheritAll="false"/>
  241. + <copy todir="${lwjgl.lib}/freebsd">
  242. + <fileset dir="${lwjgl.bin}/lwjgl" includes="liblwjgl*.so"/>
  243. + </copy>
  244. + </target>
  245. +
  246. <!-- Compiles LWJGL on solaris platforms -->
  247. <target name="-compile_native_solaris" if="lwjgl.platform.solaris">
  248. <!-- Reusing the linux ant task, but copy the output to solaris -->
  249.  
  250.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement