summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBoris Nagaev <bnagaev@gmail.com>2016-01-25 18:56:13 (GMT)
committerBoris Nagaev <bnagaev@gmail.com>2016-01-25 18:56:13 (GMT)
commit8ec0d4dafb6ddd244a88e787ec3a6abac470b331 (patch)
tree97dd94f2202ef6aa845211296ad24a54766d6aad
parenteae41ccbfd983312b99cbf1461d6217b701a57b0 (diff)
downloadmxe-8ec0d4dafb6ddd244a88e787ec3a6abac470b331.zip
mxe-8ec0d4dafb6ddd244a88e787ec3a6abac470b331.tar.gz
mxe-8ec0d4dafb6ddd244a88e787ec3a6abac470b331.tar.bz2
build-pkg: set MXE_DIR automatically
Produce a warning if MXE_DIR != /usr/lib/mxe When making a debug build, it is better to get a warning than set MXE_DIR manually each time.
-rwxr-xr-xtools/build-pkg.lua15
1 files changed, 8 insertions, 7 deletions
diff --git a/tools/build-pkg.lua b/tools/build-pkg.lua
index 40fcdc9..d087031 100755
--- a/tools/build-pkg.lua
+++ b/tools/build-pkg.lua
@@ -13,9 +13,7 @@ Packages are written to `*.tar.xz` files.
Debian packages are written to `*.deb` files.
Build in directory /usr/lib/mxe
-This directory can not be changed in .deb packages
-To change this directory, set environment variable
-MXE_DIR to other directory.
+This directory can not be changed in .deb packages.
To prevent build-pkg from creating deb packages,
set environment variable MXE_NO_DEBS to 1
@@ -37,8 +35,6 @@ local no_debs = os.getenv('MXE_NO_DEBS')
local TODAY = os.date("%Y%m%d")
-local MXE_DIR = os.getenv('MXE_DIR') or '/usr/lib/mxe'
-
local GIT = 'git --work-tree=./usr/ --git-dir=./usr/.git '
local GIT_USER = '-c user.name="build-pkg" ' ..
'-c user.email="build-pkg@mxe" '
@@ -150,6 +146,8 @@ local function execute(cmd)
end
end
+local MXE_DIR = trim(shell('pwd'))
+
-- for tar, try gtar and gnutar first
local tools = {}
local function tool(name)
@@ -920,8 +918,11 @@ local function makeMxeSourcePackage()
end
assert(not io.open('usr/.git'), 'Remove usr/')
-assert(trim(shell('pwd')) == MXE_DIR,
- "Clone MXE to " .. MXE_DIR)
+local MXE_DIR_EXPECTED = '/usr/lib/mxe'
+if MXE_DIR ~= MXE_DIR_EXPECTED then
+ log("Warning! Building in dir %s, not in %s",
+ MXE_DIR, MXE_DIR_EXPECTED)
+end
gitInit()
assert(execute(("%s check-requirements MXE_TARGETS=%q"):format(
tool 'make', table.concat(TARGETS, ' '))))