aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2018-08-05 12:12:52 +1000
committerHisham Muhammad <hisham@gobolinux.org>2018-08-10 16:52:18 -0300
commitfaaaded2a5a299ec0120bb794f815e97b78dbd33 (patch)
tree6ab0e65c3a8719b71760007a8dad4fa28fcbb4bf
parentad717af4711046700ebe63ad8cff064faf990158 (diff)
downloadluarocks-faaaded2a5a299ec0120bb794f815e97b78dbd33.tar.gz
luarocks-faaaded2a5a299ec0120bb794f815e97b78dbd33.tar.bz2
luarocks-faaaded2a5a299ec0120bb794f815e97b78dbd33.zip
Makefile: Generate luarocks 'binary' locally before installing with 'install'
-rw-r--r--.gitignore1
-rw-r--r--Makefile16
2 files changed, 13 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
index f1481cfc..c8155a2d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
3/test/testing_* 3/test/testing_*
4/test/luacov.* 4/test/luacov.*
5# Stuff that pops up during development but shouldn't be in the repo (helps clean up `git status`) 5# Stuff that pops up during development but shouldn't be in the repo (helps clean up `git status`)
6/build
6/build-binary 7/build-binary
7/*.rock 8/*.rock
8/*.tar.gz 9/*.tar.gz
diff --git a/Makefile b/Makefile
index ca2f379b..1b582933 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,9 @@
1 1
2-include config.unix 2-include config.unix
3 3
4INSTALL ?= install
5
6
4all: luarocks luarocks-admin 7all: luarocks luarocks-admin
5 8
6# ---------------------------------------- 9# ----------------------------------------
@@ -40,23 +43,27 @@ install: all $(DESTDIR)$(prefix)/bin/luarocks $(DESTDIR)$(prefix)/bin/luarocks-a
40 mkdir -p "$(DESTDIR)$(prefix)/share/lua/$(LUA_VERSION)/luarocks" 43 mkdir -p "$(DESTDIR)$(prefix)/share/lua/$(LUA_VERSION)/luarocks"
41 cp -a src/luarocks/* "$(DESTDIR)$(prefix)/share/lua/$(LUA_VERSION)/luarocks" 44 cp -a src/luarocks/* "$(DESTDIR)$(prefix)/share/lua/$(LUA_VERSION)/luarocks"
42 45
43$(DESTDIR)$(prefix)/bin/luarocks: src/bin/luarocks config.unix 46./build/luarocks: src/bin/luarocks config.unix
44 mkdir -p "$(@D)" 47 mkdir -p "$(@D)"
45 (printf '#!$(LUA_BINDIR)/$(LUA_INTERPRETER)\n'\ 48 (printf '#!$(LUA_BINDIR)/$(LUA_INTERPRETER)\n'\
46 'package.loaded["luarocks.core.hardcoded"] = { SYSCONFDIR = [[$(luarocksconfdir)]] }\n'\ 49 'package.loaded["luarocks.core.hardcoded"] = { SYSCONFDIR = [[$(luarocksconfdir)]] }\n'\
47 'package.path=[[$(prefix)/share/lua/$(LUA_VERSION)/?.lua;]] .. package.path\n'; \ 50 'package.path=[[$(prefix)/share/lua/$(LUA_VERSION)/?.lua;]] .. package.path\n'; \
48 tail -n +2 src/bin/luarocks \ 51 tail -n +2 src/bin/luarocks \
49 )> "$@" 52 )> "$@"
50 chmod +rx $@
51 53
52$(DESTDIR)$(prefix)/bin/luarocks-admin: src/bin/luarocks-admin config.unix 54./build/luarocks-admin: src/bin/luarocks-admin config.unix
53 mkdir -p "$(@D)" 55 mkdir -p "$(@D)"
54 (printf '#!$(LUA_BINDIR)/$(LUA_INTERPRETER)\n'\ 56 (printf '#!$(LUA_BINDIR)/$(LUA_INTERPRETER)\n'\
55 'package.loaded["luarocks.core.hardcoded"] = { SYSCONFDIR = [[$(luarocksconfdir)]] }\n'\ 57 'package.loaded["luarocks.core.hardcoded"] = { SYSCONFDIR = [[$(luarocksconfdir)]] }\n'\
56 'package.path=[[$(prefix)/share/lua/$(LUA_VERSION)/?.lua;]] .. package.path\n'; \ 58 'package.path=[[$(prefix)/share/lua/$(LUA_VERSION)/?.lua;]] .. package.path\n'; \
57 tail -n +2 src/bin/luarocks-admin \ 59 tail -n +2 src/bin/luarocks-admin \
58 )> "$@" 60 )> "$@"
59 chmod +rx $@ 61
62$(DESTDIR)$(prefix)/bin/luarocks: ./build/luarocks
63 $(INSTALL) -D "$<" "$@"
64
65$(DESTDIR)$(prefix)/bin/luarocks-admin: ./build/luarocks-admin
66 $(INSTALL) -D "$<" "$@"
60 67
61$(DESTDIR)$(luarocksconfdir)/config-$(LUA_VERSION).lua: config-$(LUA_VERSION).lua.in 68$(DESTDIR)$(luarocksconfdir)/config-$(LUA_VERSION).lua: config-$(LUA_VERSION).lua.in
62 mkdir -p "$(DESTDIR)$(luarocksconfdir)" 69 mkdir -p "$(DESTDIR)$(luarocksconfdir)"
@@ -115,6 +122,7 @@ clean:
115 rm -f ./config.unix 122 rm -f ./config.unix
116 rm -f ./luarocks 123 rm -f ./luarocks
117 rm -f ./luarocks-admin 124 rm -f ./luarocks-admin
125 rm -rf ./build/
118 rm -rf build-binary 126 rm -rf build-binary
119 rm -rf ./.luarocks 127 rm -rf ./.luarocks
120 rm -rf ./lua_modules 128 rm -rf ./lua_modules