Guest User

freebsd-lwjgl

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