fread-ink / awesome-4.2-fread

Attempt at adding xdamage functionality to awesome 4.2 for use in fread.ink
GNU General Public License v2.0
1 stars 0 forks source link

ioctl and luajit #1

Open Juul opened 6 years ago

Juul commented 6 years ago

We need to do ioctl calls from within awesome. The quickest and ugliest way to do this would be to simply make the calls directly from the awesome C code. The slightly nicer way would be to expose a function to call ioctl from awesome. An even nicer way might be to use ljsyscall to expose ioctl to lua. Now ljsyscall requires either LuaJIT or luaffi. Since LuaJIT is really fast why not use LuaJIT? Well, awesome does compile against LuaJIT but it is a bit more work. Here's how:

Install luajit from source:

wget http://luajit.org/download/LuaJIT-2.0.5.tar.gz
tar xvzf LuaJIT-2.0.5.tar.gz
cd LuaJIT-2.0.5/
make
sudo make install

Install luarocks from source:

wget https://luarocks.org/releases/luarocks-2.4.3.tar.gz
tar xvzf luarocks-2.4.3.tar.gz
cd luarocks-2.4.3/
./configure
sudo make bootstrap

Install lgi using luarocks:

sudo luarocks install lgi

Symlink the luajit binary to lua:

cd /usr/local/bin/
ln -s luajit lua

Before running make to compile awesome, run the following:

export CMAKE_ARGS="-DLUA_LIBRARY=/usr/local/lib/libluajit-5.1.so -DLUA_INCLUDE_DIR=/usr/local/include/luajit-2.0"
Juul commented 6 years ago

To install ljsyscall:

sudo luarocks install ljsyscall
Juul commented 6 years ago

To use ljsyscall:

syscall = require('syscall')
ioctl = syscall.ioctl
ret = ioctl(syscall.stdout, 'TIOCGWINSZ')

From here

Juul commented 6 years ago

It's possible to compile awesome 4.2 against luajit in debian jessie using only the system packages:

apt install luajit libluajit-5.1-2 libluajit-5.1-dev lua-lgi lua-lgi-dev
export CMAKE_ARGS="-DLUA_LIBRARY=/usr/lib/x86_64-linux-gnu/libluajit-5.1.so -DLUA_INCLUDE_DIR=/usr/include/luajit-2.0"