diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2018-08-10 17:34:31 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-08-10 22:49:47 -0300 |
commit | b5926be6dd3438c7f98afe7c9ffb28f52fb6a573 (patch) | |
tree | 5bdd3f1ab0832f01eb303f52d73fea5eb2053a52 | |
parent | c49e581f8df1d40acb759e54fd8fcfb52570be95 (diff) | |
download | luarocks-b5926be6dd3438c7f98afe7c9ffb28f52fb6a573.tar.gz luarocks-b5926be6dd3438c7f98afe7c9ffb28f52fb6a573.tar.bz2 luarocks-b5926be6dd3438c7f98afe7c9ffb28f52fb6a573.zip |
Build Windows binaries as .exe in a separate directory
-rw-r--r-- | GNUmakefile | 56 | ||||
-rw-r--r-- | binary/Makefile.windows | 2 | ||||
-rwxr-xr-x | binary/all_in_one | 2 |
3 files changed, 32 insertions, 28 deletions
diff --git a/GNUmakefile b/GNUmakefile index 45eb38b1..a8e2a01e 100644 --- a/GNUmakefile +++ b/GNUmakefile | |||
@@ -8,6 +8,7 @@ bindir ?= $(prefix)/bin | |||
8 | sysconfdir ?= $(prefix)/etc | 8 | sysconfdir ?= $(prefix)/etc |
9 | INSTALL ?= install | 9 | INSTALL ?= install |
10 | INSTALL_DATA ?= $(INSTALL) -m 644 | 10 | INSTALL_DATA ?= $(INSTALL) -m 644 |
11 | BINARY_PLATFORM ?= unix | ||
11 | 12 | ||
12 | LUA_INTERPRETER ?= lua | 13 | LUA_INTERPRETER ?= lua |
13 | ifdef LUA_BINDIR | 14 | ifdef LUA_BINDIR |
@@ -21,6 +22,8 @@ LUA_VERSION ?= $(shell $(LUA) -e 'print(_VERSION:match(" (5%.[1234])$$"))') | |||
21 | rocks_tree ?= $(prefix) | 22 | rocks_tree ?= $(prefix) |
22 | luarocksconfdir ?= $(sysconfdir)/luarocks | 23 | luarocksconfdir ?= $(sysconfdir)/luarocks |
23 | luadir ?= $(datarootdir)/lua/$(LUA_VERSION) | 24 | luadir ?= $(datarootdir)/lua/$(LUA_VERSION) |
25 | builddir ?= ./build | ||
26 | buildbinarydir ?= ./build-binary | ||
24 | 27 | ||
25 | 28 | ||
26 | LUAROCKS_FILES = $(shell find src/luarocks/ -type f -name '*.lua') | 29 | LUAROCKS_FILES = $(shell find src/luarocks/ -type f -name '*.lua') |
@@ -31,7 +34,7 @@ all: build | |||
31 | # Base build | 34 | # Base build |
32 | # ---------------------------------------- | 35 | # ---------------------------------------- |
33 | 36 | ||
34 | build: luarocks luarocks-admin ./build/luarocks ./build/luarocks-admin | 37 | build: luarocks luarocks-admin $(builddir)/luarocks $(builddir)/luarocks-admin |
35 | 38 | ||
36 | config.unix: | 39 | config.unix: |
37 | @echo Please run the "./configure" script before building. | 40 | @echo Please run the "./configure" script before building. |
@@ -70,7 +73,7 @@ luarocks-admin: config.unix | |||
70 | echo 'LUAROCKS_SYSCONFDIR="$(luarocksconfdir)" LUA_PATH="$(CURDIR)/src/?.lua;;" exec "$(LUA)" "$(CURDIR)/src/bin/luarocks-admin" --project-tree="$(CURDIR)/lua_modules" "$$@"' >> luarocks-admin | 73 | echo 'LUAROCKS_SYSCONFDIR="$(luarocksconfdir)" LUA_PATH="$(CURDIR)/src/?.lua;;" exec "$(LUA)" "$(CURDIR)/src/bin/luarocks-admin" --project-tree="$(CURDIR)/lua_modules" "$$@"' >> luarocks-admin |
71 | chmod +rx ./luarocks-admin | 74 | chmod +rx ./luarocks-admin |
72 | 75 | ||
73 | ./build/luarocks: src/bin/luarocks config.unix | 76 | $(builddir)/luarocks: src/bin/luarocks config.unix |
74 | mkdir -p "$(@D)" | 77 | mkdir -p "$(@D)" |
75 | (printf '$(SHEBANG)\n'\ | 78 | (printf '$(SHEBANG)\n'\ |
76 | 'package.loaded["luarocks.core.hardcoded"] = { SYSCONFDIR = [[$(luarocksconfdir)]] }\n'\ | 79 | 'package.loaded["luarocks.core.hardcoded"] = { SYSCONFDIR = [[$(luarocksconfdir)]] }\n'\ |
@@ -78,7 +81,7 @@ luarocks-admin: config.unix | |||
78 | tail -n +2 src/bin/luarocks \ | 81 | tail -n +2 src/bin/luarocks \ |
79 | )> "$@" | 82 | )> "$@" |
80 | 83 | ||
81 | ./build/luarocks-admin: src/bin/luarocks-admin config.unix | 84 | $(builddir)/luarocks-admin: src/bin/luarocks-admin config.unix |
82 | mkdir -p "$(@D)" | 85 | mkdir -p "$(@D)" |
83 | (printf '$(SHEBANG)\n'\ | 86 | (printf '$(SHEBANG)\n'\ |
84 | 'package.loaded["luarocks.core.hardcoded"] = { SYSCONFDIR = [[$(luarocksconfdir)]] }\n'\ | 87 | 'package.loaded["luarocks.core.hardcoded"] = { SYSCONFDIR = [[$(luarocksconfdir)]] }\n'\ |
@@ -87,6 +90,20 @@ luarocks-admin: config.unix | |||
87 | )> "$@" | 90 | )> "$@" |
88 | 91 | ||
89 | # ---------------------------------------- | 92 | # ---------------------------------------- |
93 | # Base build | ||
94 | # ---------------------------------------- | ||
95 | |||
96 | binary: luarocks $(buildbinarydir)/luarocks.exe $(buildbinarydir)/luarocks-admin.exe | ||
97 | |||
98 | $(buildbinarydir)/luarocks.exe: src/bin/luarocks $(LUAROCKS_FILES) | ||
99 | (unset $(LUA_ENV_VARS); \ | ||
100 | "$(LUA)" binary/all_in_one "$<" "$(LUA_DIR)" "^src/luarocks/admin/" "$(luarocksconfdir)" "$(@D)" $(BINARY_PLATFORM) $(CC) $(NM) $(SYSROOT)) | ||
101 | |||
102 | $(buildbinarydir)/luarocks-admin.exe: src/bin/luarocks-admin $(LUAROCKS_FILES) | ||
103 | (unset $(LUA_ENV_VARS); \ | ||
104 | "$(LUA)" binary/all_in_one "$<" "$(LUA_DIR)" "^src/luarocks/cmd/" "$(luarocksconfdir)" "$(@D)" $(BINARY_PLATFORM) $(CC) $(NM) $(SYSROOT)) | ||
105 | |||
106 | # ---------------------------------------- | ||
90 | # Regular install | 107 | # Regular install |
91 | # ---------------------------------------- | 108 | # ---------------------------------------- |
92 | 109 | ||
@@ -97,45 +114,32 @@ INSTALL_FILES = $(DESTDIR)$(bindir)/luarocks \ | |||
97 | 114 | ||
98 | install: $(INSTALL_FILES) | 115 | install: $(INSTALL_FILES) |
99 | 116 | ||
100 | $(DESTDIR)$(bindir)/luarocks: ./build/luarocks | 117 | $(DESTDIR)$(bindir)/luarocks: $(builddir)/luarocks |
101 | $(INSTALL) -D "$<" "$@" | 118 | $(INSTALL) -D "$<" "$@" |
102 | 119 | ||
103 | $(DESTDIR)$(bindir)/luarocks-admin: ./build/luarocks-admin | 120 | $(DESTDIR)$(bindir)/luarocks-admin: $(builddir)/luarocks-admin |
104 | $(INSTALL) -D "$<" "$@" | 121 | $(INSTALL) -D "$<" "$@" |
105 | 122 | ||
106 | $(DESTDIR)$(luadir)/luarocks/%.lua: src/luarocks/%.lua | 123 | $(DESTDIR)$(luadir)/luarocks/%.lua: src/luarocks/%.lua |
107 | $(INSTALL_DATA) -D "$<" "$@" | 124 | $(INSTALL_DATA) -D "$<" "$@" |
108 | 125 | ||
109 | $(DESTDIR)$(luarocksconfdir)/config-$(LUA_VERSION).lua: ./build/config-$(LUA_VERSION).lua | 126 | $(DESTDIR)$(luarocksconfdir)/config-$(LUA_VERSION).lua: $(builddir)/config-$(LUA_VERSION).lua |
110 | $(INSTALL_DATA) -D "$<" "$@" | 127 | $(INSTALL_DATA) -D "$<" "$@" |
111 | 128 | ||
112 | uninstall: | 129 | uninstall: |
113 | rm -rf $(INSTALL_FILES) | 130 | rm -rf $(INSTALL_FILES) |
114 | 131 | ||
115 | # ---------------------------------------- | 132 | # ---------------------------------------- |
116 | # Binary build | ||
117 | # ---------------------------------------- | ||
118 | |||
119 | binary: build-binary/luarocks.exe build-binary/luarocks-admin.exe | ||
120 | |||
121 | build-binary/luarocks.exe: src/bin/luarocks $(LUAROCKS_FILES) | ||
122 | (unset $(LUA_ENV_VARS); \ | ||
123 | "$(LUA)" binary/all_in_one "$<" "$(LUA_DIR)" "^src/luarocks/admin/" "$(luarocksconfdir)" "$(@D)" $(BINARY_PLATFORM) $(CC) $(NM) $(SYSROOT)) | ||
124 | |||
125 | build-binary/luarocks-admin.exe: src/bin/luarocks-admin $(LUAROCKS_FILES) | ||
126 | (unset $(LUA_ENV_VARS); \ | ||
127 | "$(LUA)" binary/all_in_one "$<" "$(LUA_DIR)" "^src/luarocks/cmd/" "$(luarocksconfdir)" "$(@D)" $(BINARY_PLATFORM) $(CC) $(NM) $(SYSROOT)) | ||
128 | |||
129 | # ---------------------------------------- | ||
130 | # Binary install | 133 | # Binary install |
131 | # ---------------------------------------- | 134 | # ---------------------------------------- |
132 | 135 | ||
133 | LUAROCKS_CORE_FILES = $(wildcard src/luarocks/core/* src/luarocks/loader.lua) | 136 | LUAROCKS_CORE_FILES = $(wildcard src/luarocks/core/* src/luarocks/loader.lua) |
134 | INSTALL_BINARY_FILES = $(patsubst src/%, $(DESTDIR)$(luadir)/%, $(LUAROCKS_CORE_FILES)) | 137 | INSTALL_BINARY_FILES = $(patsubst src/%, $(DESTDIR)$(luadir)/%, $(LUAROCKS_CORE_FILES)) \ |
138 | $(DESTDIR)$(luarocksconfdir)/config-$(LUA_VERSION).lua | ||
135 | 139 | ||
136 | install-binary: $(INSTALL_BINARY_FILES) build-binary/luarocks.exe build-binary/luarocks-admin.exe | 140 | install-binary: $(INSTALL_BINARY_FILES) |
137 | $(INSTALL) -D build-binary/luarocks.exe "$(DESTDIR)$(bindir)/luarocks" | 141 | $(INSTALL) -D "$(buildbinarydir)/luarocks.exe" "$(DESTDIR)$(bindir)/luarocks" |
138 | $(INSTALL) -D build-binary/luarocks-admin.exe "$(DESTDIR)$(bindir)/luarocks-admin" | 142 | $(INSTALL) -D "$(buildbinarydir)/luarocks-admin.exe" "$(DESTDIR)$(bindir)/luarocks-admin" |
139 | 143 | ||
140 | # ---------------------------------------- | 144 | # ---------------------------------------- |
141 | # Bootstrap install | 145 | # Bootstrap install |
@@ -162,8 +166,8 @@ clean: windows-clean | |||
162 | rm -rf ./config.unix \ | 166 | rm -rf ./config.unix \ |
163 | ./luarocks \ | 167 | ./luarocks \ |
164 | ./luarocks-admin \ | 168 | ./luarocks-admin \ |
165 | ./build/ \ | 169 | $(builddir)/ \ |
166 | build-binary \ | 170 | $(buildbinarydir)/ \ |
167 | ./.luarocks \ | 171 | ./.luarocks \ |
168 | ./lua_modules | 172 | ./lua_modules |
169 | 173 | ||
diff --git a/binary/Makefile.windows b/binary/Makefile.windows index e7a5ea3b..e7bcca27 100644 --- a/binary/Makefile.windows +++ b/binary/Makefile.windows | |||
@@ -16,7 +16,7 @@ windows-binary: windows-deps/lib/liblua.a windows-deps/lib/libssl.a windows-deps | |||
16 | STATIC_GCC_RANLIB=$(MINGW_PREFIX)-ranlib \ | 16 | STATIC_GCC_RANLIB=$(MINGW_PREFIX)-ranlib \ |
17 | STATIC_GCC_CC=$(MINGW_PREFIX)-gcc \ | 17 | STATIC_GCC_CC=$(MINGW_PREFIX)-gcc \ |
18 | LUAROCKS_CROSS_COMPILING=1 \ | 18 | LUAROCKS_CROSS_COMPILING=1 \ |
19 | $(MAKE) binary LUA_DIR=$(CURDIR)/windows-deps CC=$(MINGW_PREFIX)-gcc NM=$(MINGW_PREFIX)-nm BINARY_PLATFORM=windows BINARY_TARGET=build-windows-binary BINARY_SYSROOT=$(MINGW_SYSROOT) | 19 | $(MAKE) binary LUA_DIR=$(CURDIR)/windows-deps CC=$(MINGW_PREFIX)-gcc NM=$(MINGW_PREFIX)-nm BINARY_PLATFORM=windows buildbinarydir=build-windows-binary BINARY_SYSROOT=$(MINGW_SYSROOT) |
20 | 20 | ||
21 | build-windows-deps/lua-$(LIBLUA_VERSION).tar.gz: | 21 | build-windows-deps/lua-$(LIBLUA_VERSION).tar.gz: |
22 | mkdir -p $(@D) | 22 | mkdir -p $(@D) |
diff --git a/binary/all_in_one b/binary/all_in_one index f1c2e0a1..d6517d79 100755 --- a/binary/all_in_one +++ b/binary/all_in_one | |||
@@ -29,7 +29,7 @@ local MAIN_PROGRAM = arg[1] or "src/bin/luarocks" | |||
29 | local LUA_DIR = arg[2] or "/usr" | 29 | local LUA_DIR = arg[2] or "/usr" |
30 | local EXCLUDE = arg[3] or "^src/luarocks/admin/" | 30 | local EXCLUDE = arg[3] or "^src/luarocks/admin/" |
31 | local SYSCONFDIR = arg[4] or "/etc/luarocks" | 31 | local SYSCONFDIR = arg[4] or "/etc/luarocks" |
32 | local TARGET = arg[5] or "binary-build" | 32 | local TARGET = arg[5] or "build-binary" |
33 | local MY_PLATFORM = arg[6] or "unix" | 33 | local MY_PLATFORM = arg[6] or "unix" |
34 | local CC = arg[7] or "gcc" | 34 | local CC = arg[7] or "gcc" |
35 | local NM = arg[8] or "nm" | 35 | local NM = arg[8] or "nm" |