Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: src/java/org/lwjgl/FreeBSDSysImplementation.java
- ===================================================================
- --- src/java/org/lwjgl/FreeBSDSysImplementation.java (revision )
- +++ src/java/org/lwjgl/FreeBSDSysImplementation.java (revision )
- @@ -0,0 +1,87 @@
- +/*
- + * Copyright (c) 2002-2008 LWJGL Project
- + * All rights reserved.
- + *
- + * Redistribution and use in source and binary forms, with or without
- + * modification, are permitted provided that the following conditions are
- + * met:
- + *
- + * * Redistributions of source code must retain the above copyright
- + * notice, this list of conditions and the following disclaimer.
- + *
- + * * Redistributions in binary form must reproduce the above copyright
- + * notice, this list of conditions and the following disclaimer in the
- + * documentation and/or other materials provided with the distribution.
- + *
- + * * Neither the name of 'LWJGL' nor the names of
- + * its contributors may be used to endorse or promote products derived
- + * from this software without specific prior written permission.
- + *
- + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- + */
- +package org.lwjgl;
- +
- +import java.security.AccessController;
- +import java.security.PrivilegedAction;
- +
- +/**
- + *
- + */
- +final class FreeBSDSysImplementation extends J2SESysImplementation {
- + private static final int JNI_VERSION = 19;
- +
- + static {
- + // Load libawt.so and libmawt.so, needed for libjawt.so
- + java.awt.Toolkit.getDefaultToolkit();
- +
- + // manually load libjawt.so into vm, needed since Java 7
- + AccessController.doPrivileged(new PrivilegedAction<Object>() {
- + public Object run() {
- + try {
- + System.loadLibrary("jawt");
- + } catch (UnsatisfiedLinkError e) {
- + // catch and ignore an already loaded in another classloader
- + // exception, as vm already has it loaded
- + }
- + return null;
- + }
- + });
- + }
- +
- + public int getRequiredJNIVersion() {
- + return JNI_VERSION;
- + }
- +
- + public boolean openURL(final String url) {
- + // simply copied from Linux
- +
- + String[] browsers = {"xdg-open", "firefox", "mozilla", "opera", "konqueror", "nautilus", "galeon", "netscape"};
- +
- + for ( final String browser : browsers ) {
- + try {
- + LWJGLUtil.execPrivileged(new String[] { browser, url });
- + return true;
- + } catch (Exception e) {
- + // Ignore
- + e.printStackTrace(System.err);
- + }
- + }
- +
- + // Seems to have failed
- + return false;
- + }
- +
- + public boolean has64Bit() {
- + return true;
- + }
- +}
- Index: platform_build/linux_ant/build.xml
- ===================================================================
- --- platform_build/linux_ant/build.xml (revision 3704)
- +++ platform_build/linux_ant/build.xml (revision )
- @@ -4,8 +4,8 @@
- <property name="native" location="../../src/native"/>
- <property name="libname32" value="liblwjgl.so"/>
- <property name="libname64" value="liblwjgl64.so"/>
- - <property name="libs32" value="-L/usr/X11R6/lib -L/usr/X11/lib -lm -lX11 -lXext -lXcursor -lXrandr -lpthread -L${java.home}/lib/i386 -ljawt" />
- - <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" />
- + <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" />
- + <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" />
- <property name="cflags32" value="-O2 -Wall -c -fPIC -std=c99 -Wunused"/>
- <target name="clean">
- @@ -45,6 +45,7 @@
- <condition property="build.32bit.only">
- <not>
- <or>
- + <equals arg1="${hwplatform}" arg2="amd64"/>
- <equals arg1="${hwplatform}" arg2="x86_64"/>
- <equals arg1="${hwplatform}" arg2="i86pc"/>
- </or>
- @@ -53,10 +54,16 @@
- <!-- On linux, the 64 bit jre doesn't have the 32 bit libs -->
- <condition property="build.64bit.only">
- + <or>
- - <and>
- - <os name="Linux"/>
- - <equals arg1="${hwplatform}" arg2="x86_64"/>
- - </and>
- + <and>
- + <os name="Linux"/>
- + <equals arg1="${hwplatform}" arg2="x86_64"/>
- + </and>
- + <and>
- + <os name="FreeBSD"/>
- + <equals arg1="${hwplatform}" arg2="amd64"/>
- + </and>
- + </or>
- </condition>
- <antcall target="compile32"/>
- @@ -69,9 +76,12 @@
- <arg line="${cflags32} ${cflags_pthread}"/>
- <arg value="-I${java.home}/include"/>
- <arg value="-I${java.home}/include/linux"/>
- + <arg value="-I${java.home}/include/freebsd"/>
- <arg value="-I${java.home}/../include"/>
- <arg value="-I${java.home}/../include/linux"/>
- + <arg value="-I${java.home}/../include/freebsd"/>
- <arg value="-I${java.home}/../include/solaris"/>
- + <arg value="-I/usr/local/include"/>
- <arg value="-I${native}/common"/>
- <arg value="-I${native}/common/opengl"/>
- <arg value="-I${native}/linux"/>
- @@ -101,11 +111,15 @@
- <arg line="${cflags64} ${cflags_pthread}"/>
- <arg value="-I${java.home}/include"/>
- <arg value="-I${java.home}/include/linux"/>
- + <arg value="-I${java.home}/include/freebsd"/>
- <arg value="-I${java.home}/../include"/>
- <arg value="-I${java.home}/../include/linux"/>
- + <arg value="-I${java.home}/../include/freebsd"/>
- <arg value="-I${java.home}/../include/solaris"/>
- + <arg value="-I/usr/local/include"/>
- - <arg value="-I${native}/common"/>
- + <arg value="-I${native}/common"/>
- <arg value="-I${native}/common/opengl"/>
- + <arg value="-I${native}/common/opengl"/>
- <arg value="-I${native}/linux"/>
- <arg value="-I${native}/linux/opengl"/>
- <mapper type="glob" from="*.c" to="*.o"/>
- Index: build.xml
- ===================================================================
- --- build.xml (revision 3704)
- +++ build.xml (revision )
- @@ -31,6 +31,7 @@
- <mkdir dir="${lwjgl.temp}/native" taskname="initialiazing temp/native folder" />
- <mkdir dir="${lwjgl.temp}/native/windows" taskname="initialiazing temp/windows folder" />
- <mkdir dir="${lwjgl.temp}/native/linux" taskname="initialiazing temp/linux folder" />
- + <mkdir dir="${lwjgl.temp}/native/freebsd" taskname="initialiazing temp/freebsd folder" />
- <mkdir dir="${lwjgl.temp}/native/macosx" taskname="initialiazing temp/macosx folder" />
- <mkdir dir="${lwjgl.temp}/native/solaris" taskname="initialiazing temp/solaris folder" />
- </target>
- @@ -55,7 +56,7 @@
- <!-- Creates a distribution of LWJGL -->
- <target name="release" description="Creates a distribution of LWJGL using supplied native binaries">
- <!-- Warn user -->
- - <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"/>
- + <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"/>
- <input
- message="All data in the ${lwjgl.dist} folder will be deleted. Continue? "
- validargs="yes,no"
- @@ -237,6 +238,11 @@
- <patternset refid="lwjgl-linux.fileset" />
- </fileset>
- </copy>
- + <copy todir="${lwjgl.temp}/native/freebsd">
- + <fileset dir="${lwjgl.lib}/freebsd">
- + <patternset refid="lwjgl-freebsd.fileset" />
- + </fileset>
- + </copy>
- <copy todir="${lwjgl.temp}/native/macosx">
- <fileset dir="${lwjgl.lib}/macosx">
- <patternset refid="lwjgl-macosx.fileset" />
- @@ -373,6 +379,13 @@
- </tokenfilter>
- </filterchain>
- </loadfile>
- + <loadfile srcfile="${lwjgl.src}/java/org/lwjgl/FreeBSDSysImplementation.java" property="lwjgl.java.freebsd.version">
- + <filterchain>
- + <tokenfilter>
- + <containsstring contains="JNI_VERSION ="/>
- + </tokenfilter>
- + </filterchain>
- + </loadfile>
- <loadfile srcfile="${lwjgl.src}/java/org/lwjgl/MacOSXSysImplementation.java" property="lwjgl.java.macosx.version">
- <filterchain>
- <tokenfilter>
- @@ -405,6 +418,7 @@
- lwjgl.java.windows.version = ${lwjgl.java.windows.version}
- lwjgl.native.windows.version = ${lwjgl.native.windows.version}
- lwjgl.java.linux.version = ${lwjgl.java.linux.version}
- + lwjgl.java.freebsd.version = ${lwjgl.java.freebsd.version}
- lwjgl.native.linux.version = ${lwjgl.native.linux.version}
- lwjgl.java.macosx.version = ${lwjgl.java.macosx.version}
- lwjgl.native.macosx.version = ${lwjgl.native.macosx.version}
- @@ -465,6 +479,11 @@
- </condition>
- <antcall target="-compile_native_linux" />
- + <condition property="lwjgl.platform.freebsd">
- + <os name="FreeBSD" />
- + </condition>
- + <antcall target="-compile_native_freebsd" />
- +
- <condition property="lwjgl.platform.solaris">
- <os name="SunOS" />
- </condition>
- @@ -494,6 +513,14 @@
- <!-- headless issues <version-check platform="linux"/> -->
- </target>
- + <!-- Compiles LWJGL on FreeBSD platforms -->
- + <target name="-compile_native_freebsd" if="lwjgl.platform.freebsd">
- + <ant antfile="platform_build/linux_ant/build.xml" inheritAll="false"/>
- + <copy todir="${lwjgl.lib}/freebsd">
- + <fileset dir="${lwjgl.bin}/lwjgl" includes="liblwjgl*.so"/>
- + </copy>
- + </target>
- +
- <!-- Compiles LWJGL on solaris platforms -->
- <target name="-compile_native_solaris" if="lwjgl.platform.solaris">
- <!-- Reusing the linux ant task, but copy the output to solaris -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement