#!/usr/bin/make -f DEB_DESTDIR=debian/tmp %: dh $@ override_dh_auto_configure: ./configure \ --lua-version=5.1 \ --prefix=/usr \ --sysconfdir=/etc/luarocks \ --with-lua=/usr \ --with-lua-include=/usr/include/lua5.1 \ --with-lua-lib=/usr/local/lib \ --rocks-tree=/usr/local/ \ --with-downloader=wget \ --with-md5-checker=md5sum override_dh_auto_build: make build txt2man -t "luarocks 1" -r "LuaRocks" -v "" debian/luarocks.1.txt \ > luarocks.1 txt2man -t "luarocks-admin 1" -r "LuaRocks repository administration"\ -v "" debian/luarocks-admin.1.txt > luarocks-admin.1 define LUAROCKS_CONF rocks_trees = { home..[[/.luarocks]], [[/usr/local]] } endef export LUAROCKS_CONF override_dh_auto_install: mkdir -p $(DEB_DESTDIR)/etc/luarocks/ mkdir -p $(DEB_DESTDIR)/usr/bin/ mkdir -p $(DEB_DESTDIR)/usr/share/doc/luarocks/doc/ for V in 5.1 5.2 5.3; do\ mkdir -p $(DEB_DESTDIR)/usr/share/lua/$$V/;\ cp -r src/luarocks $(DEB_DESTDIR)/usr/share/lua/$$V/;\ sed -i -e '1i\local popen = io.popen' $(DEB_DESTDIR)/usr/share/lua/$$V/luarocks/site_config.lua;\ sed -i -e 's/^site_config.LUAROCKS_UNAME_S.*/site_config.LUAROCKS_UNAME_S=(popen("uname -s"):read("*a"):gsub("\\n",""))/' $(DEB_DESTDIR)/usr/share/lua/$$V/luarocks/site_config.lua;\ sed -i -e 's/^site_config.LUAROCKS_UNAME_M.*/site_config.LUAROCKS_UNAME_M=(popen("uname -m"):read("*a"):gsub("\\n",""))/' $(DEB_DESTDIR)/usr/share/lua/$$V/luarocks/site_config.lua;\ sed -i -e "s/^site_config.LUA_INTERPRETER.*/site_config.LUA_INTERPRETER=[[lua$$V]]/" $(DEB_DESTDIR)/usr/share/lua/$$V/luarocks/site_config.lua;\ sed -i -e "s?^site_config.LUA_INCDIR.*?site_config.LUA_INCDIR=[[/usr/include/lua$$V]]?" $(DEB_DESTDIR)/usr/share/lua/$$V/luarocks/site_config.lua;\ done cp src/bin/luarocks $(DEB_DESTDIR)/usr/bin/ cp src/bin/luarocks-admin $(DEB_DESTDIR)/usr/bin/ sed -i -e '1c\#!/usr/bin/env lua-any\n-- Lua-Versions: 5.1 5.2 5.3' $(DEB_DESTDIR)/usr/bin/* sed -i -e '3d' $(DEB_DESTDIR)/usr/bin/* echo "$$LUAROCKS_CONF" > $(DEB_DESTDIR)/etc/luarocks/config.lua dh_lua -pluarocks -P$(DEB_DESTDIR) override_dh_auto_clean: rm -f luarocks.1 luarocks-admin.1 make clean || true