Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ioctl and luajit #1

Open
Juul opened this issue Dec 8, 2017 · 3 comments
Open

ioctl and luajit #1

Juul opened this issue Dec 8, 2017 · 3 comments

Comments

@Juul
Copy link
Member

Juul commented Dec 8, 2017

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
Copy link
Member Author

Juul commented Dec 8, 2017

To install ljsyscall:

sudo luarocks install ljsyscall

@Juul
Copy link
Member Author

Juul commented Dec 8, 2017

To use ljsyscall:

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

From here

@Juul
Copy link
Member Author

Juul commented Dec 9, 2017

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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant