[BACK]Return to README-OpenBSD.md CVS log [TXT][DIR] Up to [local] / projects / libgdx-openbsd

File: [local] / projects / libgdx-openbsd / README-OpenBSD.md (download)

Revision 1.6, Fri Mar 15 23:23:42 2019 UTC (14 months, 1 week ago) by thfr
Branch: MAIN
CVS Tags: HEAD
Changes since 1.5: +8 -14 lines

small corrections for README-OpenBSD.md, thanks to solene@

Purpose
=======

This repo is a fork of libgdx with modifications to allow running libgdx
games on OpenBSD. Current limitations are that setup involves many steps and is
difficult, and that only some of the backend code is adapted (lwjgl, but not
lwjgl3, etc). In its current form, this can be used to run Slay the Spire.

The ultimate purpose of this repo is to contribute to making the upstream
libgdx framework usable on OpenBSD. **Ultimately, this repo will hopefully
become obsolete once upstream accomodates OpenBSD.**

Besides upstreaming OpenBSD-specifics, native shared object (.so) libraries
might best be converted to an OpenBSD port.

Files Changed from libgdx 1.9.9 or Added
========================================

backends/gdx-backend-lwjgl/src/com/badlogic/gdx/backends/lwjgl/LwjglNativesLoader.java
backends/gdx-backend-lwjgl/src/com/badlogic/gdx/backends/lwjgl/audio/OpenALMusic.java
extensions/gdx-controllers/gdx-controllers-desktop/jni/build-openbsd64.xml
extensions/gdx-freetype/jni/build-openbsd64.xml
extensions/gdx-jnigen/src/com/badlogic/gdx/jnigen/JniGenSharedLibraryLoader.java
gdx/jni/build-openbsd64.xml
gdx/src/com/badlogic/gdx/scenes/scene2d/utils/UIUtils.java
gdx/src/com/badlogic/gdx/utils/SharedLibraryLoader.java
README.md
README-OpenBSD.md

IDE files from IntelliJ have been removes (.idea directory, various .iml
files).

The file DIFF_OPENBSD shows the changes compared to the upstream libGDX 1.9.9.

Example: Running Slay the Spire on OpenBSD
==========================================

**NOTE**: solene@'s script at https://perso.pw/gaming/openbsd_slay_the_spire.sh
does all of the following steps for you.

This is based on my testing on OpenBSD 6.4-current with jdk-1.8.0.202v0.

Prerequisite Packages:
----------------------

* openal
* lwjgl
* jdk
* maven
* apache-ant
* rsync

Also Slay the Spire, release version 1.0 (needs to be obtained via Steam on
another operating system). Windows or Linux downloads have been reported to
work.

Step-by-Step:
-------------

1. Copy the file desktop-*.jar from Slay the Spire to your OpenBSD installation.

2. Extract desktop-1.0.jar:

   $ jar xvf desktop-*.jar

3. Replace libopenal64.so and liblwjgl64.so with the corresponding libraries
   from the packages, for example:

   $ cp /usr/local/lib/libopenal.so.3.1 libopenal64.so
   $ cp /usr/local/share/lwjgl/liblwjgl64.so liblwjgl64.so

4. Obtain the libgdx-openbsd code:

   $ cvs -d anoncvs@anoncvs.thfr.info:/cvs checkout -P projects/libgdx-openbsd

5. Build native (JNI) libs of the libgdx project:

   $ cd gdx/jni && ant -f build-openbsd64.xml && cd -
   $ cd extensions/gdx-freetype/jni && ant -f build-openbsd64.xml && cd -

6. Copy these libs to the Slay the Spire directory, replacing existing files.
   After building with ant(1), the libs are located in the libs/openbsd64
   subdirectory (e.g. gdx/libs/openbsd64).

7. Go into the following subdirectories and run

   $ mvn package

   in each of them, thereby creating the required class files:
   - extensions/gdx-jnigen
   - gdx
   - backends/gdx-backend-lwjgl
   - extensions/gdx-freetype
   - extensions/gdx-controllers/gdx-controllers
   - extensions/gdx-controllers/gdx-controllers-desktop

8. Locate the class trees in all these modules (in target/classes subdir) and
   put all of them together, for example with:

   $ rsync -avh gdx/target/classes/* /tmp/
   $ rsync -avh backends/gdx-backend-lwjgl/target/classes/* /tmp/

   etc. (gdx-jnigen may not be needed anymore in this step.)

9. Remove the original com/badlogic subdir in Slay the Spire and replace it
   with the one that you just built (in /tmp/com/badlogic following the
   example code).

   $ rm -rf com/badlogic
   $ cp -R /tmp/com/badlogic com/

10.The main java class and the arguments for the Java VM are documented in the
   config.json that comes with the game. Based on that, start the game with the
   following command:

   $ java -Xmx1G -Dsun.java2d.dpiaware=true com.megacrit.cardcrawl.desktop.DesktopLauncher

Notes:
------

* For some reason sometimes the java runtime fails to load libopenal64.so when
  starting the game. This is usually resolved by simply starting the game again
  with the same command.

Goals for the Future:
=====================

* fix gamecontroller support
* lwjgl3 backend (required for MewnBase)
* try it with more libgdx games (e.g. Halfway)
* ...

Contact
=======

Thomas Frohwein <thfr@openbsd.org>