include $(TOPLEVEL)/make.vars
-CLEAN_FILES = *~ E2_COMMIT
+CLEAN_FILES = *~ E2_COMMIT buildconfig.lua
.PHONY: all e2commit install install-local clean local localdist uninstall \
help:
@cat INSTALL
-all: e2commit
+buildconfig.lua: Makefile
+ echo 'module ("buildconfig")' > $@
+ echo 'PREFIX="$(PREFIX)"' >>$@
+ echo 'BINDIR="$(BINDIR)"' >>$@
+ echo 'LIBDIR="$(LIBDIR)"' >>$@
+ echo 'TOOLDIR="$(TOOLDIR)"' >>$@
+ echo 'E2="$(E2)"' >>$@
+ echo 'LUA="$(LUA)"' >>$@
+ echo 'E2_VERSION="$(E2_VERSION)"' >>$@
+ echo 'E2_COMMIT="$(E2_COMMIT)"' >>$@
+ echo 'E2_SYNTAX="$(E2_SYNTAX)"' >>$@
+
+all: e2commit buildconfig.lua
$(MAKE) -C lua
$(MAKE) -C generic
$(MAKE) -C global
mkdir -p $(DESTDIR)$(INCDIR)
mkdir -p $(DESTDIR)$(MANDIR)
mkdir -p $(DESTDIR)$(TOOLDIR)
+ install -m 644 buildconfig.lua $(DESTDIR)$(LIBDIR)
$(MAKE) -C lua install
$(MAKE) -C generic install
$(MAKE) -C global install
$(MAKE) -C templates uninstall
$(MAKE) -C local uninstall
-local: e2commit
+local: e2commit buildconfig.lua
$(MAKE) -C generic local
$(MAKE) -C local
$(MAKE) -C templates local
$(MAKE) -C generic install-local
$(MAKE) -C local install-local
$(MAKE) -C templates install-local
+ install -m 644 buildconfig.lua $(LOCALLIBDIR)
doc:
for s in $(SUBDIRS) ; do \
if info then
hfile = info.root .. "/proj/hooks/" .. hookname
else
- hfile = E2_PREFIX .. "/share/e2/hooks/" .. hookname
+ hfile = buildconfig.PREFIX .. "/share/e2/hooks/" .. hookname
end
if e2util.exists(hfile) then
e2lib.log(3, "running hook `" .. hookname .. "' ...")
]]
_version = "e2factory, the emlix embedded build system, version " ..
- E2_VERSION
+ buildconfig.E2_VERSION
_licence = [[
e2factory is free software: you can redistribute it and/or modify
default_e2 = {
local_branch = "master",
local_tag = "^",
- local_syntax = E2_SYNTAX,
+ local_syntax = buildconfig.E2_SYNTAX,
},
local_e2_branch = nil,
local_e2_tag = nil,
end
local logstring = string.format(
"%s %s %s/%s %s \"%s %s\"\n",
- pname, os.date(), E2_VERSION, E2_COMMIT, e2lib.username,
- arg[0], table.concat(args, " "))
+ pname, os.date(), buildconfig.E2_VERSION, buildconfig.E2_COMMIT,
+ e2lib.username, arg[0], table.concat(args, " "))
-- always log to the user logfile
local ulogdir = string.format("%s/.e2", e2lib.homedir)
}
function lua_versions.get_version(e2_version)
- local v = e2_version or E2_VERSION
+ local v = e2_version or buildconfig.E2_VERSION
local lv = lua_versions[ v ]
return lv or lua_versions.latest
end
along with this program. If not, see <http://www.gnu.org/licenses/>.
]]
+require("buildconfig")
+
local tools = {
which = { name = "which", flags = "", optional = false },
curl = { name = "curl", flags = "", optional = false },
touch = { name = "touch", flags = "", optional = false },
uname = { name = "uname", flags = "", optional = false },
patch = { name = "patch", flags = "", optional = false },
- ["e2-su"] = { name = E2_PREFIX .. "/bin/e2-su", flags = "",
- optional = false },
- ["e2-su-2.2"] = { name = E2_PREFIX .. "/bin/e2-su-2.2", flags = "",
+ ["e2-su"] = { name = buildconfig.PREFIX .. "/bin/e2-su", flags = "",
optional = false },
+ ["e2-su-2.2"] = { name = buildconfig.PREFIX .. "/bin/e2-su-2.2",
+ flags = "", optional = false },
}
.PHONY: all install uninstall clean
-all: e2 e2-root e2global.lc $(SCRIPTS) e2-su $(GLOBALLUATOOLS:=.lc) \
+all: e2 e2-root $(SCRIPTS) e2-su $(GLOBALLUATOOLS:=.lc) \
$(GLOBALSHTOOLS:=.sh) e2.conf
install: all
install -m 755 e2-root $(DESTDIR)$(TOOLDIR)/
install -m 4754 -o root -g $(E2_GROUP) e2-su $(DESTDIR)$(BINDIR)/
install -m 755 e2 $(DESTDIR)$(BINDIR)/
- install -m 644 e2global.lc $(DESTDIR)$(LIBDIR)/
install -d $(DESTDIR)$(SYSCONFDIR)
if [ ! -f "$(DESTDIR)$(SYSCONFDIR)/e2.conf" ] ; then \
install -m 644 e2.conf $(DESTDIR)$(SYSCONFDIR)/e2.conf ; \
rm -f $(DESTDIR)$(TOOLDIR)/e2-root
rm -f $(DESTDIR)$(BINDIR)/e2-su
rm -f $(DESTDIR)$(BINDIR)/e2
- rm -f $(DESTDIR)$(LIBDIR)/e2global.lc
doc:
for s in $(SUBDIRS) ; do \
clean:
rm -f $(CLEAN_FILES)
-e2global.lc: config.lua e2global.lua
- $(BUILD_LUAC) -o $@ $^
-
%.lua: %.lua.in
$(TOPLEVEL)/scripts/genscript.sh $< $@
+++ /dev/null
---[[
- e2factory, the emlix embedded build system
-
- Copyright (C) 2007-2009 Gordon Hecker <gh@emlix.com>, emlix GmbH
- Copyright (C) 2007-2009 Oskar Schirmer <os@emlix.com>, emlix GmbH
- Copyright (C) 2007-2008 Felix Winkelmann, emlix GmbH
-
- For more information have a look at http://www.e2factory.org
-
- e2factory is a registered trademark by emlix GmbH.
-
- This file is part of e2factory, the emlix embedded build system.
-
- e2factory is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-]]
-
---[[
- e2factory, the emlix embedded build system
-
- Copyright (C) 2007-2009 Gordon Hecker <gh@emlix.com>, emlix GmbH
- Copyright (C) 2007-2009 Oskar Schirmer <os@emlix.com>, emlix GmbH
- Copyright (C) 2007-2008 Felix Winkelmann, emlix GmbH
-
- For more information have a look at http://www.e2factory.org
-
- e2factory is a registered trademark by emlix GmbH.
-
- This file is part of e2factory, the emlix embedded build system.
-
- e2factory is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-]]
-
--- Program configuration
-
-E2_VERSION = "@E2_VERSION@"
-E2_COMMIT = "@E2_COMMIT@"
-E2_PREFIX = "@E2_PREFIX@"
-E2_SYNTAX = "@E2_SYNTAX@"
along with this program. If not, see <http://www.gnu.org/licenses/>.
]]
-require("e2global")
+require("buildconfig")
+require("e2generic_global")
+
e2lib.init()
local doc = [[
along with this program. If not, see <http://www.gnu.org/licenses/>.
]]
-require("e2global")
+require("buildconfig")
+require("e2generic_global")
e2lib.init()
local e = new_error("fetching project failed")
-- call e2-install-e2
e2_install_e2 = string.format("'%s' '%s/e2-install-e2'",
- getinstallpath("LUA"), getinstallpath("TOOLDIR"))
+ buildconfig.LUA, buildconfig.TOOLDIR)
rc, re = e2lib.callcmd_log(e2_install_e2)
if not rc then
e:append("installing local e2 failed")
along with this program. If not, see <http://www.gnu.org/licenses/>.
]]
-require("e2global")
+require("buildconfig")
+require("e2generic_global")
-install_prefix = getinstallpath("PREFIX")
+install_prefix = buildconfig.PREFIX
e2lib.init()
package.path = "@LIBDIR@/?.lc;@LIBDIR@/?.lua"
package.cpath = "@LIBDIR@/?.so"
-require("e2global")
+require("buildconfig")
+require("e2generic_global")
e2lib.init()
e2option.documentation = [[
e2option.flag("prefix", "print installation prefix",
function()
- print("@E2_PREFIX@")
+ print(buildconfig.PREFIX)
os.exit(0)
end)
e2call.arg_string = quoteargs(table.concat(arg, "' '", 1))
end
--- provide install paths in the environment
-setinstallpaths()
-
-e2call.globaltool = getinstallpath("TOOLDIR") .. "/" .. e2call.toolname
+e2call.globaltool = buildconfig.TOOLDIR .. "/" .. e2call.toolname
if root then
e2call.localtool = root .. "/.e2/bin/" .. e2call.toolname
end
if e2util.stat(e2call.globaltool) then
e2call.tool = e2call.globaltool
- env = "LUA_PATH='@LIBDIR@/?.lc;@LIBDIR@/?.lua'" ..
- "LUA_CPATH='@LIBDIR@/?.so'"
- lua = "@LIBEXECDIR@/e2-lua-@LUA_VERSION@"
+ env = string.format("LUA_PATH='%s/?.lc;%s/?.lua' " ..
+ "LUA_CPATH='%s/?.so'", buildconfig.LIBDIR, buildconfig.LIBDIR,
+ buildconfig.LIBDIR)
+ lua = buildconfig.LUA
cmd = string.format("%s %s %s %s", env, lua, e2call.tool, e2call.arg_string)
elseif not root then
e2lib.abort(e2call.toolname ..
+++ /dev/null
---[[
- e2factory, the emlix embedded build system
-
- Copyright (C) 2007-2009 Gordon Hecker <gh@emlix.com>, emlix GmbH
- Copyright (C) 2007-2009 Oskar Schirmer <os@emlix.com>, emlix GmbH
- Copyright (C) 2007-2008 Felix Winkelmann, emlix GmbH
-
- For more information have a look at http://www.e2factory.org
-
- e2factory is a registered trademark by emlix GmbH.
-
- This file is part of e2factory, the emlix embedded build system.
-
- e2factory is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-]]
-
-package.path="@LIBDIR@/?.lc;@LIBDIR@/?.lua;" .. package.path
-package.cpath="@LIBDIR@/?.so;" .. package.cpath
-
-require("e2generic_global")
-
--- project
--- .name
--- .path
--- .checkout_path
--- .server_versionfile
--- .versionfile
--- .version
--- .e2versionfile
--- .e2version
-
-
-local install = {}
-install [ "PREFIX" ] = "@E2_PREFIX@"
-install [ "BINDIR" ] = "@BINDIR@"
-install [ "LIBDIR" ] = "@LIBDIR@"
-install [ "LIBEXECDIR" ] = "@LIBEXECDIR@"
-install [ "TOOLDIR" ] = "@TOOLDIR@"
-install [ "LUA" ] = "@LIBEXECDIR@/e2-lua-@LUA_VERSION@"
-
--- getinstallpath(var)
---
--- lookup an installation path from the install table.
-
-function getinstallpath(var)
- if install [ var ] == nil then
- e2lib.abort("querying non-existent variable in getinstallpath()")
- end
- return install[var]
-end
-
--- setinstallpaths()
---
--- set all installation paths in the environment. That enables the local
--- tools to call the correct e2-su global tools.
-
-function setinstallpaths()
- for var,val in pairs(install) do
- e2util.setenv(var, val, true)
- end
-end
-
--- e2generic table: holds functions that must work across all future
--- e2 versions
-
-e2generic = {}
-
---- get the project version from the server
--- @param a project description table
--- @return string: the project version, or nil
--- @return an error object on failure
-function e2generic.getprojectversionfromserver(project)
- local e = new_error("getting project version from server failed")
- local tmpdir = e2lib.mktempdir()
- local location = string.format("%s/%s", project.location,
- project.server_versionfile)
- local rc, re = transport.fetch_file(project.surl, location, tmpdir, nil)
- if not rc then
- return nil, e:cat(re)
- end
- local vfile = string.format("%s/%s", tmpdir, project.server_versionfile)
- local v = e2lib.parse_versionfile(vfile)
- if not v then
- return nil, e:cat("can't parse version file")
- end
- e2lib.rmtempdir(tmpdir)
- return v, nil
-end
-
-function e2generic.getprojectversionfromproject(project)
- return e2lib.parse_versionfile("./" .. project.versionfile)
-end
-
-function e2generic.gete2versionfromproject(project)
- return e2lib.parse_e2versionfile(project.checkout_path .. "/" .. project.e2versionfile)
-end
-
-e2lib.module("e2generic", e2generic)
-
--- V table: holds functions implementing the global tool interfaces for each version
-
-V = {}
include $(TOPLEVEL)/make.vars
-CLEAN_FILES = *~ *.so linux32 config.lua *.lc *.o
+CLEAN_FILES = *~ *.so linux32 *.lc *.o
CFLAGS += -I. -I$(DESTDIR)$(INCDIR) -I$(DESTDIR)$(INCDIR)/lua-$(LUA_VERSION) \
-I../lua/lua-$(LUA_VERSION)/src -fPIC
LDFLAGS += -L. -L../lua/lua-$(LUA_VERSION)/src -Wl,-R$(LIBDIR)
%.lc: %.lua
$(LUAC) -o $@ $<
-e2local.lc: config.lua $(TOPLEVEL)/generic/strict.lua \
+e2local.lc: $(TOPLEVEL)/generic/strict.lua \
result.lua \
loader.lua \
$(TOPLEVEL)/generic/scm.git.lua \
+++ /dev/null
---[[
- e2factory, the emlix embedded build system
-
- Copyright (C) 2007-2009 Gordon Hecker <gh@emlix.com>, emlix GmbH
- Copyright (C) 2007-2009 Oskar Schirmer <os@emlix.com>, emlix GmbH
- Copyright (C) 2007-2008 Felix Winkelmann, emlix GmbH
-
- For more information have a look at http://www.e2factory.org
-
- e2factory is a registered trademark by emlix GmbH.
-
- This file is part of e2factory, the emlix embedded build system.
-
- e2factory is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-]]
-
--- config.lua -*- lua -*-
---
--- Program configuration
-
-E2_VERSION = "@E2_VERSION@"
-E2_COMMIT = "@E2_COMMIT@"
-E2_PREFIX = "@E2_PREFIX@"
-E2_SYNTAX = "@E2_SYNTAX@"
-
-require("e2util_local")
-- first, to maintain correct error messages
local config_syntax_compat = {
- E2_SYNTAX, -- keep this one, it holds the current syntax.
+ buildconfig.E2_SYNTAX, -- keep this one, it holds the current syntax.
"2_2_0",
}
end
hc:hash_line(info.release_id)
hc:hash_line(info.project.chroot_arch)
- hc:hash_line(E2_VERSION)
+ hc:hash_line(buildconfig.E2_VERSION)
info.projid = hc:hash_finish()
return info.projid
end
ARCH = $(shell uname -m)
LUA_VERSION = 5.1.3
LUA_ALL_VERSIONS = 5.1.2 5.1.3
+LUA = $(LIBEXECDIR)/e2-lua-$(LUA_VERSION)
LUAC = $(LIBEXECDIR)/e2-luac-$(LUA_VERSION)
ifdef LUA_UNPACK_PATH
BUILD_LUAC = $(LUA_UNPACK_PATH)/lua-$(LUA_VERSION)/src/luac