Skip to content

Commit 6ddab0b

Browse files
Statically compile raylib and modify raylib pkgbuild :)
1 parent f757a6d commit 6ddab0b

File tree

3 files changed

+50
-2
lines changed

3 files changed

+50
-2
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
11
/target
2+
3+
raylib/
4+
build/
5+
6+
*.zst

PKGBUILD

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Maintainer: Alexander F. Rødseth <[email protected]>
2+
# Contributor: Wilhem Barbier <[email protected]>
3+
4+
pkgname=raylib
5+
pkgver=5.0
6+
pkgrel=1
7+
pkgdesc='Simple and easy-to-use game programming library'
8+
arch=(x86_64)
9+
url='https://www.raylib.com'
10+
license=(ZLIB)
11+
makedepends=(cmake git libx11 libxcursor libxinerama libxrandr ninja vulkan-headers xorg-xinput)
12+
source=("git+https://github.com/raysan5/raylib#commit=ae50bfa2cc569c0f8d5bc4315d39db64005b1b08") # tag: 5.0
13+
b2sums=('SKIP')
14+
15+
build() {
16+
cmake \
17+
-B build \
18+
-D BUILD_EXAMPLES=OFF \
19+
-D CMAKE_BUILD_TYPE=Release \
20+
-D USE_STATIC_LIBS=ON \
21+
-D CMAKE_C_FLAGS="$CFLAGS -fPIC -w" \
22+
-D CMAKE_INSTALL_LIBDIR=lib \
23+
-D CMAKE_INSTALL_PREFIX=/usr \
24+
-D OpenGL_GL_PREFERENCE=GLVND \
25+
-D PLATFORM=Desktop \
26+
-D USE_EXTERNAL_GLFW=OFF \
27+
-D WITH_PIC=ON \
28+
-G Ninja \
29+
-S $pkgname \
30+
-W no-dev
31+
ninja -C build
32+
}
33+
34+
package() {
35+
DESTDIR="$pkgdir" ninja -C build install
36+
# Extra include files that are used in the raylib examples
37+
for f in rcamera rgestures; do
38+
install -Dm644 $pkgname/src/$f.h "$pkgdir/usr/include/$f.h"
39+
done
40+
install -Dm644 $pkgname/LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
41+
}
42+
43+
# getver: github.com/raysan5/raylib/releases

build.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
fn main() {
2-
println!("cargo:rustc-link-search=native=/usrlib/");
3-
println!("cargo:rustc-link-lib=raylib");
2+
println!("cargo:rustc-link-search=native=pkg/raylib/usr/lib");
3+
println!("cargo:rustc-link-lib=static=raylib");
44
}

0 commit comments

Comments
 (0)