Skip to content

Commit d85ef12

Browse files
committed
fix: use pkg-config to find Lua library (#42)
Use pkg-config with fallbacks to resolve the correct library name across platforms (lua on macOS, lua5.4 on Ubuntu/Debian). Add installation instructions for common platforms.
1 parent 5bfd3c7 commit d85ef12

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,23 @@ Crystal bindings to Lua. Supports [Lua 5.4](http://www.lua.org/ftp/) and higher
88

99
## Installation
1010

11-
Add this to your application's `shard.yml`:
11+
Lua development libraries must be installed on your system:
12+
13+
```bash
14+
# macOS
15+
brew install lua
16+
17+
# Ubuntu/Debian
18+
sudo apt install liblua5.4-dev
19+
20+
# Arch Linux
21+
sudo pacman -S lua
22+
23+
# Fedora
24+
sudo dnf install lua-devel
25+
```
26+
27+
Then add this to your application's `shard.yml`:
1228

1329
```yaml
1430
dependencies:

src/lua/liblua.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@[Link("lua")]
1+
@[Link(ldflags: "`pkg-config --libs lua 2>/dev/null || pkg-config --libs lua5.4 2>/dev/null || echo -llua`")]
22
lib LibLua
33
type State = Void*
44

0 commit comments

Comments
 (0)