Installing from the repository

$ wget http://www.lua.org/ftp/lua-5.1.4.tar.gz ; tar zxvf lua-5.1.4.tar.gz ; cd lua-5.1.4 ; make freebsd ; su root -c make install
$ hg clone https://hg.prosody.im/trunk prosody-hg ; cd prosody-hg
$ ./configure --with-lua-include="/usr/local/include/lua51" --cflags="-I/usr/local/include" --ldflags="-I/usr/local/include -shared" --lua-suffix=""
$ make ; su root -c make install

Additional dependencies also needed. See Prosody Dependencies.