Skip to content

Instantly share code, notes, and snippets.

@zinovyev
Last active February 8, 2024 10:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zinovyev/f88e2dc56973e66e38e71639ae45b6ef to your computer and use it in GitHub Desktop.
Save zinovyev/f88e2dc56973e66e38e71639ae45b6ef to your computer and use it in GitHub Desktop.
Compiling Awesome WM with LuaJIT

Based on: https://github.com/awesomeWM/awesome?tab=readme-ov-file#arch-linux-aur

First install the required packages:

sudo pacman -S --needed base-devel git
git clone https://aur.archlinux.org/awesome-git.git
cd awesome-git

Install LuaJIT:

asdf plugin-add luajit https://github.com/smashedtoatoms/asdf-luaJIT.git
asdf install luajit 2.0.5
luarocks install lgi

Modify PKGBUILD to link it to the proper version of Lua(JIT):

@@ -31,7 +31,7 @@ conflicts=('awesome')
 backup=('etc/xdg/awesome/rc.lua')
 source=("$pkgname::git+https://github.com/awesomeWM/awesome.git")
 md5sums=('SKIP')
-_LUA_VER=5.4
+_LUA_JIT_VER=2.0.5
 
 pkgver() {
   cd $pkgname
@@ -45,9 +45,9 @@ build() {
     -DCMAKE_BUILD_TYPE=RELEASE \
     -DCMAKE_INSTALL_PREFIX=/usr \
     -DSYSCONFDIR=/etc \
-    -DLUA_INCLUDE_DIR=/usr/include/lua${_LUA_VER} \
-    -DLUA_LIBRARY=/usr/lib/liblua.so.${_LUA_VER} \
-    -DLUA_EXECUTABLE=/usr/bin/lua${_LUA_VER}
+    -DLUA_INCLUDE_DIR=$HOME/.asdf/installs/luajit/${_LUA_JIT_VER}/include/luajit-2.0 \
+    -DLUA_LIBRARY=$HOME/.asdf/installs/luajit/${_LUA_JIT_VER}/lib/libluajit-5.1.so \
+    -DLUA_EXECUTABLE=$HOME/.asdf/installs/luajit/${_LUA_JIT_VER}/bin/luajit
   make
 }

Compile:

makepkg -fsi

Fix for the LGI lib:

sudo cp -r $HOME/.asdf/installs/luajit/2.0.5/share/lua/5.1/lgi /usr/share/luajit-2.1/lgi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment