Skip to content

Commit 070eb19

Browse files
Update Linux build to use Docker with Ubuntu 16.04 for better glibc compatibility
- Migrate build-linux job from ubuntu-20.04 runner to Docker container - Use ubuntu:16.04 image for glibc 2.23 compatibility with older systems like Slackware 14.2 - Replace actions/setup-java with manual OpenJDK 8 installation in container - Remove sudo commands since container runs as root - Add CLAUDE.md documentation for future development 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent d9cc892 commit 070eb19

File tree

2 files changed

+107
-8
lines changed

2 files changed

+107
-8
lines changed

.github/workflows/build.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,38 @@ env:
1313

1414
jobs:
1515
build-linux:
16-
runs-on: ubuntu-20.04
16+
runs-on: ubuntu-latest
17+
container:
18+
image: ubuntu:16.04
19+
options: --user root
1720

1821
steps:
1922
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
2023
- uses: actions/checkout@v2
2124
with:
2225
submodules: recursive
2326

24-
- uses: actions/setup-java@v2
25-
with:
26-
distribution: 'adopt' # See 'Supported distributions' for available options
27-
java-version: '8'
27+
- name: Install dependencies
28+
run: |
29+
apt update
30+
apt install -y wget curl git build-essential cmake
31+
apt install -y libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev libwayland-dev libxkbcommon-dev
2832
33+
- name: Setup Java 8
34+
run: |
35+
apt install -y openjdk-8-jdk
36+
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
37+
echo "JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64" >> $GITHUB_ENV
38+
echo "/usr/lib/jvm/java-8-openjdk-amd64/bin" >> $GITHUB_PATH
2939
3040
- name: Build raylib
3141
run: |
32-
sudo apt update
33-
sudo apt install libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev libwayland-dev libxkbcommon-dev
3442
cd raylib
3543
mkdir build
3644
cd build
3745
cmake -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
3846
make -j2
39-
sudo make install
47+
make install
4048
4149
- name: Build jaylib
4250
env:

CLAUDE.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
Jaylib is a Java Native Interface (JNI) binding library for Raylib 5.5, providing Java developers with access to the popular C game development library. The project uses JavaCPP to automatically generate JNI bindings from the native Raylib headers.
8+
9+
## Build System and Commands
10+
11+
### Primary Build Commands
12+
- `./build-java.sh` - Main Java compilation and JAR creation (requires `RAYLIB_VERSION` environment variable)
13+
- `./build-linux.sh` - Linux platform-specific build
14+
- `./build-windows.sh` - Windows platform build (requires Visual Studio environment)
15+
- `./build-native.sh` - Native library compilation
16+
17+
### Testing
18+
- `./run-test.sh` - Run the basic functionality test (requires `RAYLIB_PLATFORM` environment variable)
19+
- `./run-test-jar.sh` - Run tests using the compiled JAR
20+
21+
### Documentation
22+
- `./build-docs.sh` - Generate Javadoc documentation
23+
24+
### Environment Variables Required
25+
- `RAYLIB_VERSION` - Version string for builds (e.g., "5.5.0-0")
26+
- `RAYLIB_PLATFORM` - Platform identifier (e.g., "linux-x86_64", "windows-x86_64", "macosx-x86_64")
27+
28+
## Architecture and Key Components
29+
30+
### Core Structure
31+
- **JavaCPP Integration**: Uses `javacpp.jar` and JavaCPP annotations in `RaylibConfig.java` to automatically generate JNI bindings
32+
- **Multi-stage Build Process**:
33+
1. Generate Java bindings from C headers using JavaCPP
34+
2. Compile native code with platform-specific linkers
35+
3. Package everything into distributable JARs
36+
37+
### Key Source Files
38+
- `src/com/raylib/RaylibConfig.java` - JavaCPP configuration defining platform-specific linking and header includes
39+
- `src/com/raylib/Raylib.java` - Auto-generated main binding class (created during build)
40+
- `src/com/raylib/Colors.java` - Predefined color constants (RAYWHITE, BLACK, etc.)
41+
- `src/com/raylib/Helpers.java` - Alternative constructor methods for structs
42+
- `src/com/raylib/Test.java` - Basic functionality test and demo
43+
44+
### Native Headers
45+
The project includes Raylib C header files:
46+
- `raylib.h` - Core Raylib API
47+
- `rlgl.h` - OpenGL abstraction layer
48+
- `raymath.h` - Math utility functions
49+
- `physac.h` - Physics simulation
50+
- `raygui.h` - Immediate mode GUI
51+
52+
### Platform Support
53+
Configured for cross-platform builds supporting:
54+
- Windows x86_64
55+
- macOS x86_64 and ARM64
56+
- Linux x86_64 and ARM64
57+
58+
## JavaCPP Binding Specifics
59+
60+
### Field Access Pattern
61+
- Getters: `vector.x()` returns the x field value
62+
- Setters: `vector.x(3)` sets the x field to 3
63+
- Position field renamed to `_position` due to JavaCPP's internal position field
64+
65+
### Struct Initialization
66+
JavaCPP uses fluent constructor syntax:
67+
```java
68+
var vec = new Vector3().x(1).y(2).z(3);
69+
```
70+
Alternative constructors available in `Helpers.java`:
71+
```java
72+
var vec = Helpers.createVector3(1, 2, 3);
73+
```
74+
75+
### Array Access
76+
C arrays are not Java arrays - use position() method:
77+
```java
78+
model.materials().position(1).maps().position(2) // Second map of first material
79+
```
80+
81+
## Build Dependencies
82+
- Java 8+ (JDK required for compilation)
83+
- Platform-specific C++ compiler (GCC on Linux, Visual Studio on Windows, Xcode on macOS)
84+
- JavaCPP tool (included as `javacpp.jar`)
85+
- Raylib native library (included as git submodule)
86+
87+
## macOS Specific Requirements
88+
When running Java applications on macOS, use the `-XstartOnFirstThread` JVM option:
89+
```bash
90+
java -XstartOnFirstThread -cp jaylib.jar:. MyGame
91+
```

0 commit comments

Comments
 (0)