[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.3, Thu Mar 14 03:43:35 2019 UTC (14 months, 1 week ago) by thfr
Branch: MAIN
Changes since 1.2: +13 -5 lines

remove memcpy wrapper from gdx-controllers-desktop JNI, adjust README-OpenBSD: use maven instead of intellij, mention Windows and Linux versions of Slay the Spire work, provid example for using jar(1) - thanks solene@ for the README-OpenBSD changes!

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

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

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 files of Slay the Spire to your OpenBSD installation.

2. Locate desktop-1.0.jar and extract it to a separate directory:

   $ mkdir unjar
   $ cd unjar
   $ jar xvf path/to/desktop-1.0.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

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 -
   $ cd extensions/gdx-controllers/gdx-controllers-desktop/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. Open the libgdx-openbsd directory in intellij(1). This will import the Maven
   project.

8. 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

9. 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.)

10.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/

11.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>