onefang pushed a commit to branch master. http://git.enlightenment.org/admin/devs.git/commit/?id=3d9732e04b6e0bf051e4bad2627995c95704be98
commit 3d9732e04b6e0bf051e4bad2627995c95704be98 Author: David Walter Seikel <[email protected]> Date: Tue Apr 19 18:32:10 2016 +1000 A major rewrite that took four days! A lot more smart about how to (attempt to) build everything in E's git repos. Still some more tweaking to go, but it's working now, time to push. --- developers/onefang/build_efl.lua | 688 ++++++++++++++++++++++++++++++--------- 1 file changed, 542 insertions(+), 146 deletions(-) diff --git a/developers/onefang/build_efl.lua b/developers/onefang/build_efl.lua index a4fcf00..e115010 100755 --- a/developers/onefang/build_efl.lua +++ b/developers/onefang/build_efl.lua @@ -33,26 +33,27 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ]] - -- TODO - Might need more environment stuff for cmake EFL find functions? - -- Read environment variables as if they were global variables. local f = function(t, i) return os.getenv(i) end setmetatable(getfenv(), {__index = f}) -- TODO - Should get these out of a config lua script, but keep these as defaults. -local installPath = '/opt/EFL' +local installPath = "/opt/EFL" local cythonPath = PWD .. '/cython' local threads = 5 + + +-- This is not airlocked, previous /opt/EFL stuff leaks in. local envVars = { 'PATH="' .. installPath .. '/bin:' .. cythonPath .. '/bin:$PATH"', 'LD_LIBRARY_PATH="' .. installPath .. '/lib:$LD_LIBRARY_PATH"', 'PKG_CONFIG_PATH="' .. installPath .. '/lib/pkgconfig:$PKG_CONFIG_PATH"', 'CC="ccache gcc"', - 'CFLAGS="-g -ggdb3 -W -Wall -Wextra -Wshadow"', + 'CFLAGS="-g -ggdb3 -W -Wall -Wextra -Wshadow"', -- 'CFLAGS="-O2 -march=native -ffast-math -g3 -W -Wall -Wextra -Wshadow"', 'CPPFLAGS="$CPPFLAGS -I' .. installPath .. '/include -I`python -c \"import distutils.sysconfig; print distutils.sysconfig.get_python_inc(prefix=\'/usr\')\" 2>/dev/null`"', 'LDFLAGS="$LDFLAGS -L' .. installPath .. '/lib"', @@ -63,230 +64,625 @@ local envVars = } local SVNtrunk = 'GIT/legacy/subversion-history/trunk' -local searchPaths = {'GIT/legacy', SVNtrunk, SVNtrunk .. '/BINDINGS/javascript', SVNtrunk .. '/BINDINGS/python', SVNtrunk .. '/DEBUG', SVNtrunk .. '/E-MODULES-EXTRA', SVNtrunk .. '/eterm', SVNtrunk .. '/EXAMPLES/azy', SVNtrunk .. '/EXAMPLES/elementary', SVNtrunk .. '/FORMATTING', SVNtrunk .. '/GAMES', --[['SVN/trunk/IN-EFL',]] SVNtrunk .. '/MISC', SVNtrunk .. '/PROTO', SVNtrunk .. '/THEMES'} -local eflCore = {'efl', 'elementary', 'emotion_generic_players', 'evas_generic_loaders'} +local searchPaths = {'GIT/legacy', 'GIT/legacy/bindings/python', SVNtrunk, SVNtrunk .. '/BINDINGS', SVNtrunk .. '/BINDINGS/javascript', SVNtrunk .. '/BINDINGS/python', SVNtrunk .. '/DEBUG', +SVNtrunk .. '/E-MODULES-EXTRA', SVNtrunk .. '/eterm', SVNtrunk .. '/EXAMPLES/azy', SVNtrunk .. '/EXAMPLES/edje', SVNtrunk .. '/EXAMPLES/elementary', SVNtrunk .. '/GAMES', +SVNtrunk .. '/MISC', SVNtrunk .. '/PROTO', } + +local eflCore = {'efl', 'elementary', 'emotion_generic_players', 'evas_generic_loaders', 'enlightenment'} +local binCore = {'entrance', 'terminology'} local eflExtra = { - 'imlib2', 'imlib2_loaders', 'emap', 'azy', 'enlil', 'libast', 'libeweather', - 'e_dbus', -- Legacy, but building it anyway, some things might still depend on it. - 'egraph', 'ekbd', 'elev8', 'elocation', 'email', 'epdf', 'eupnp', 'efx', 'esskyuehl', 'etam', 'etrophy', 'ewe', - 'ffi-efl', - --[['python-evas', 'python-ecore', 'python-e_dbus', 'python-edje', 'python-ethumb', 'python-emotion', 'python-elementary' Legacy bindings.]] - 'python-efl' --[[ Ubuntu LTS cython is too old.]] + 'imlib2', + 'imlib2_loaders', +-- 'emap', +-- 'azy', + 'eaper', -- Needed by ea_generators. +-- 'enlil', + 'e_dbus', -- Legacy, but building it anyway, some things might still depend on it. + 'egraph', -- Wrong version of ... something. + 'email', +-- 'epdf', +-- 'eupnp', + 'efx', +-- 'etam', + 'etrophy', + 'ewe', -- Needs JSON-C. + 'exalt', +-- 'exchange', } -local binBasic = {'exchange', 'enlightenment', 'entrance', 'exalt', 'emprint', 'geneet', 'terminology'} -local eModulesExtra = {} +--[[ None of these are in the GIT repo. local binExtra = { - 'amnesia', 'apathy', 'ardy', 'calculator', 'clouseau', 'community', 'converter', - 'e_cho', 'e_jeweled', 'e_pattern_lock', 'econcentration', 'econnman', 'ecrire', 'editje', 'edje_list', 'edje_smart_thumb', 'edje_viewer', 'edi', 'edje_writer', - --[['edvi', No dvilib2 in Ubuntu LTS.]] - 'efbb', 'eflete', 'egui', 'ekeko', 'elemines', 'elife', - 'elm_fullscreen', 'elm_illume', 'elm_indicator', 'elm_kbd', 'elm_quickpanel', 'elm_softkey', 'elm-theme-viewer', 'elmdentica', 'embiance', 'emote', 'empower', 'ecrustify', - --[['enjoy', No lightmediascanner in Ubuntu LTS.]] - 'enki', 'ensure', 'enventor', 'eo_bindings', 'eo_tokenizer', 'eolian', - --[['envision', Hangs waiting for input.]] - 'ephoto', 'ephysics_tests', 'epour', 'eps', 'epulse', 'equate', 'erssd', 'eruler', 'eskiss', 'espik', 'espionnage', 'etypers', 'eterm', 'ev', 'evas-3d-elm', - --[['eve', No ewebkit. The release of webkit-efl in turn requires GLIB 2.36.0, Ubuntu LTS has only 2.32.4 Not going down that rabbit hole again.]] - 'exactness', 'examine', 'excessive', 'expedite', 'explicit', 'exquisite', 'eyelight', 'eyelight_edit', 'eyesight', - 'gpick', 'keys', 'maelstrom', 'ninestime', 'phonebook', 'rage', 'shellementary', 'smman', 'solve', 'sticky-notes', 'valosoitin', 'vigrid' + 'ardy', 'calculator', 'community', 'converter', + 'e_pattern_lock', 'ecrustify', 'edje_viewer', 'edje_writer', 'ekeko', + 'elm_fullscreen', 'elm_illume', 'elm_indicator', 'elm_kbd', 'elm_quickpanel', 'elm_softkey', + 'elmdentica', 'enki', 'ensure', 'eolian', 'eps', + 'examine', 'excessive' 'explicit', 'exquisite', 'eyelight', 'eyelight_edit', 'eyesight', + 'gpick', 'keys', 'ninestime', 'phonebook', 'shellementary', 'sticky-notes', 'vigrid', +} +]] + +--[[ Autodisabled +azy Not in git, but still in SVN. +emap Not in git, but still in SVN. +enlil Not in git, but still in SVN. +epdf Not in git, but still in SVN. +etam Not in git, but still in SVN. +eupnp Not in git, but still in SVN. +exalt Not in git, but still in SVN. +exchange There's only the website one, which gets stripped, and is not a binary anyway. +]] +local disable = +{ + 'devs', -- Beber has a copy of admin/devs, and we don't want either one. +-- 'python-evas', 'python-ecore', 'python-e_dbus', 'python-edje', 'python-ethumb', 'python-emotion', 'python-elementary', -- Legacy bindings. + 'edvi', -- No dvilib2 in Ubuntu LTS. + 'elementary', -- Now part of EFL. + 'elocation', -- Now part of EFL. + 'enjoy', -- No lightmediascanner in Ubuntu LTS. + 'envision', -- Hangs waiting for input. + 'eomte', -- Looks like a typo, it's empty. + 'eve', -- No ewebkit. The release of webkit-efl in turn requires GLIB 2.36.0, Ubuntu LTS has only 2.32.4 Not going down that rabbit hole again. + 'python-efl', -- Ubuntu LTS cython is too old. + 'scripts', -- Hangs waiting for input. } -local eThemes = {} local configOptions = { -- --enable-image-loader-jp2k (Needs openjp2 ,which is not in Ubuntu LTS.) --enable-image-loader-webp (Currently borked.) --enable-image-loader-tgv (Currently borked.) -- efl = '--enable-xinput22 --enable-multisense --enable-fb --enable-valgrind --enable-xine --disable-gstreamer1 --enable-gstreamer --enable-lua-old --enable-i-really-know-what-i-am-doing-and-that-this-will-probably-break-things-and-i-will-fix-them-myself-and-send-patches-aba', -- --enable-always-build-examples - efl = '--enable-xine --disable-gstreamer1 --enable-gstreamer --enable-lua-old --enable-i-really-know-what-i-am-doing-and-that-this-will-probably-break-things-and-i-will-fix-them-myself-and-send-patches-aba', + efl = '--enable-xine --disable-gstreamer1 --enable-gstreamer --enable-lua-old --enable-i-really-know-what-i-am-doing-and-that-this-will-probably-break-things-and-i-will-fix-them-myself-and-send-patches-abb', -- efl = '--enable-xinput22 --enable-multisense --disable-gstreamer1 --enable-gstreamer --enable-i-really-know-what-i-am-doing-and-that-this-will-probably-break-things-and-i-will-fix-them-myself-and-send-patches-aaa', -- Left out --enable-systemd --enable-harfbuzz --enable-wayland --disable-tslib --enable-fb --enable-image-loader-webp --enable-always-build-examples -- The moment I saw --enable-i-really-know-what-i-am-doing-... hit git, I knew I'd end up using it. Coz apparently the stable version of the worlds most popular Linux distro isn't important to support. -- elementary = '--enable-build-examples --enable-install-examples', } +local repos = {} +local packages = {} local exportedEnvVars = '' local saEnvVars = '' local startTime = os.time() +local tmpFile = os.tmpname() + +local function readCommand(command) + -- Coz io.popen() doesn't work so well? + os.execute(command .. ' >' .. tmpFile) + local tf = io.open(tmpFile, 'r') + local result = tf:read("*a") + tf:close() + return result +end + -- Wrapper coz I'm a C coder. local function printf(...) io.write(string.format(...)) end +function printTableStart(table, space, name) + print(space .. name .. ": ") + print(space .. "{") + printTable(table, space .. " ") + print(space .. "}") + if '' == space then print('') end +end -local function fileExists(path) return 0 == os.execute('stat -tc "%F" ' .. path .. ' > /dev/null 2>&1') end +function printTable(table, space) + if nil == table then return end + for k, v in pairs(table) do + if type(v) == "table" then + if v._NAME then + print(space .. "SKANG module " .. v._NAME .. ";") + else + printTableStart(v, space, k) + end + elseif type(v) == "string" then + print(space .. k .. ': "' .. v .. '";') + elseif type(v) == "function" then + print(space .. "function " .. k .. "();") + elseif type(v) == "userdata" then + print(space .. "userdata " .. k .. ";") + elseif type(v) == "boolean" then + if (v) then + print(space .. "boolean " .. k .. " TRUE ;") + else + print(space .. "boolean " .. k .. " FALSE ;") + end + else + print(space .. k .. ": " .. v .. ";") + end + end +end + +local function log(message, file) + if type(file) == 'table' then file = file.log end + os.execute('echo "`date --rfc-3339=seconds` ' .. message .. '" >>' .. file) +end +local function fileExists(path) return 0 == os.execute('stat -tc "%F" ' .. path .. ' > /dev/null 2>&1') end local function progress(i, package, path, message) -- TODO - Yes, I know, this will fuck up on average sized terminals. I could get terminal size from environment variables LINES and COLUMNS. Except those are not passed to us dammit. - printf('\r%3d %-32s %-80s ', i, path, message); io.flush() - os.execute('echo "\\n`date --rfc-3339=seconds` ============================================================================================\\n' .. message .. '\\n" >>/tmp/eflBuild/' .. package .. '.log') + printf('\r%-80s %-55s', ".", ".") -- Just to scrub out lengthy old messages. + printf('\r%3d %-32s %-80s ', i, string.sub(path, 5, -1), message) + io.flush() + log('\\n ========================================================================== ' .. message .. '\\n', '/tmp/EFL/' .. package .. '.log') end +local function packageProgress(found, message) + local pre = 'GIT/' + if nil ~= found.updated then + if found.updated then + pre = 'GIT/*' + end + end + progress(found.i, found.name, pre .. found.gitPath, message) +end -local function runBuildCommand(i, package, path, command) - progress(i, package, path, command) - return (0 == os.execute(exportedEnvVars .. 'cd ' .. path .. ';' .. command .. ' >> /tmp/eflBuild/' .. package .. '.log 2>&1')) +local function logResult(found, result) + if result then + packageProgress(found, 'DONE') + else + printf(' ' .. found.errorMsg) + end end -local function build(i, package) - local exists - local path - local conf = configOptions[package] +local function runBuildCommand(found, command0, command1) + local command = command0 + local result = -1 - if not conf then conf = '' end + if nil ~= command1 then command = command1 else command1 = '' end + packageProgress(found, command) + result = os.execute(exportedEnvVars .. 'cd ' .. found.path .. '; ' .. command0 .. '' .. command1 .. ' >> ' .. found.log .. ' 2>&1') + log('===================== RESULT ' .. result .. ' ===================== ' .. command .. '\\n', found) + return 0 == result +end - for j, dir in ipairs(searchPaths) do - path = dir .. '/' .. package - exists = fileExists(path) - if exists then - local good = true +local function addPath(i, path) + -- Try to keep these unique. + local gotIt = false - os.execute('echo "' .. path .. '" >/tmp/eflBuild/' .. package .. '.log') - os.execute('echo "' .. string.gsub(exportedEnvVars, '; ', '\n') .. '" >>/tmp/eflBuild/' .. package .. '.log') + for k, dir in ipairs(searchPaths) do + if dir == path then + gotIt = true + break + end + end - if fileExists(path .. '/Makefile') then - if good then runBuildCommand(i, package, path, 'make -j' .. threads .. ' clean distclean') end - end + if not gotIt then + table.insert(searchPaths, i, path) + i = i + 1 + end + return i +end + +local function addPackage(line) + local path = string.sub(line, 1, -5) + local name = string.gsub(path, "^.*/", "") + local found = nil + + -- Capture some of the conflicts while we do this. + found = packages[name] + + if nil == found then + found = + { + name = name, + log = '/tmp/EFL/' .. name .. '.log', + i = -1, + path = '', + gitPath = path, + exists = false, + critical = false, + conflicts = {}, + errorMsg = 'ERROR!', + updated = nil, -- nil means we have not tried yet, otherwise it's the changed result of the update. + built = nil, -- nil means we have not tried yet, otherwise it's the success result of the build. + } + else + if found.gitPath ~= path then found.conflicts[path] = path end + end - if fileExists(path .. '/autogen.sh') then - if good then good = runBuildCommand(i, package, path, './autogen.sh --prefix=' .. installPath .. ' --cache-file=/tmp/eflBuild/autofoo.cache ' .. conf) end - if good then good = runBuildCommand(i, package, path, 'make -j' .. threads) end - if good then good = runBuildCommand(i, package, path, 'sudo make install') end - elseif fileExists(path .. '/build.lua') then - if good then good = runBuildCommand(i, package, path, './build.lua') end - elseif fileExists(path .. '/build.sh') then - if good then good = runBuildCommand(i, package, path, './build.sh') end - elseif fileExists(path .. '/bootstrap.sh') then - if good then good = runBuildCommand(i, package, path, './bootstrap.sh') end - if good then good = runBuildCommand(i, package, path, './configure --prefix=' .. installPath .. ' --cache-file=/tmp/eflBuild/autofoo.cache ' .. conf) end - if good then good = runBuildCommand(i, package, path, 'make -j' .. threads) end - if good then good = runBuildCommand(i, package, path, 'sudo make install') end - elseif fileExists(path .. '/Makefile.PL') then - if good then good = runBuildCommand(i, package, path, './perl Makefile.PL prefix=' .. installPath) end - if good then good = runBuildCommand(i, package, path, 'make -j' .. threads) end - if good then good = runBuildCommand(i, package, path, 'sudo make install') end - elseif fileExists(path .. '/CMakeLists.txt') then - if good then good = runBuildCommand(i, package, path, 'mkdir -p build && cd build && cmake ..') end - if good then good = runBuildCommand(i, package, path, 'cd build && make PREFIX=' .. installPath .. ' -j' .. threads) end - if good then good = runBuildCommand(i, package, path, 'cd build && sudo make PREFIX=' .. installPath .. ' install') end - elseif fileExists(path .. '/setup.py') then - if good then good = runBuildCommand(i, package, path, 'python setup.py build build_ext --include-dirs=$PYTHONINCLUDE') end - if good then good = runBuildCommand(i, package, path, 'sudo PYTHONPATH=' .. cythonPath .. ':$PYTHONPATH -E python setup.py install --prefix=' .. installPath) end - good = false - elseif fileExists(path .. '/Makefile') then -- Keep this last, as others might generate this, so we want to detect those others first. - if good then good = runBuildCommand(i, package, path, 'make PREFIX=' .. installPath .. ' -j' .. threads) end - if good then good = runBuildCommand(i, package, path, 'sudo make PREFIX=' .. installPath .. ' install') end + packages[found.name] = found + +--[[ Hmmm, fileExists() will fail if this repo needs to be cloned first, if gitGet() is after this. + +The purpose of this loop is + 1) find found.path + complicated by extra searching inside allIn(Dir) + 2) find the rest of the conflicts. + + for packages added later + 1) added during allIn(dir) if package doesn't exist, these would be pointing to SVN and legacy? + 2) might also need to do a pass through SVN, to build ancient packages. + Won't need to add these to searchPaths, but should still search. +]] + for j, dir in ipairs(searchPaths) do + local path = dir .. '/' .. found.name + + if fileExists(path) then + if not found.exists then + found.exists = true + found.path = path +-- log(found.path, found) else - progress(i, package, path, 'NO BUILD SYSTEM!'); - good = false + if found.path ~= path then + local t = string.sub(path, 5, -1) + found.conflicts[t] = t + end end + end + end + + return found +end - -- Run the doc generation in the background, should not be any dependencies. - if good then - if fileExists(path .. '/gendoc') then - if good then runBuildCommand(i, package, path, 'sh gendoc > /tmp/eflBuild/' .. package .. '_doc.log 2>&1 &') end - elseif fileExists(path .. '/doc/Doxyfile') then - if good then runBuildCommand(i, package, path, 'make doc > /tmp/eflBuild/' .. package .. '_doc.log 2>&1 &') end +local function gitGet(found) + local oldPath = found.path + local function actualGet(found, gitPath) + if nil == gitPath then gitPath = found.gitPath end + if not fileExists('GIT/' .. gitPath) then + found.path = PWD + found.updated = runBuildCommand(found, saEnvVars, 'mkdir -p GIT/`dirname ' .. gitPath .. '` && cd GIT/`dirname ' .. gitPath .. '` && git clone ssh://[email protected]/' .. gitPath .. '.git') + if found.updated then packageProgress(found, 'CLONED GIT/' .. gitPath) end + elseif fileExists('GIT/' .. gitPath .. '/.git/HEAD') then + found.path = 'GIT/' .. gitPath + found.updated = runBuildCommand(found, saEnvVars, 'git checkout master -q && git clean -dfqx && git reset --hard -q && git pull --rebase') + if found.updated then + local last = readCommand('tail -n 3 ' .. found.log .. ' | head -n 1') -- Wow this entire thing is fragile. + + -- Only set .updated true if the repo actually changed, otherwise false. + if 'Current branch master is up to date.' == string.sub(last, 1, 36) then + found.updated = false + packageProgress(found, 'No change in GIT/' .. gitPath) + else + found.updated = true + packageProgress(found, 'PULLED GIT/' .. gitPath .. ' CHANGES.') end + + else + found.updated = nil + packageProgress(found, "DIDN'T GET GIT/" .. gitPath) end + else + packageProgress(found, 'Already got GIT/' .. gitPath) + end + os.execute('sudo echo -n ""') -- Just tickle the sudo so it remembers, in case the git takes too long. + end - if good then progress(i, package, path, 'DONE') else printf(' ERROR!') end + if nil == found.updated then + -- Get the conflicts first. + for k, v in pairs(found.conflicts) do + actualGet(found, k) + print('') + end - break + -- Pull it last, so we don't have to worry about it showing, unless something goes wrong. + found.updated = nil + actualGet(found) + end + + found.path = oldPath +end + +local function build(i, package, git) + local found = packages[package] + local good = true + local errorMsg = 'ERROR!' + + if nil == git then git = true end + if nil == found then + progress(i, package, 'GIT/ ' .. package, 'SKIPPED') + print('') + return + end + + found.i = i + + if nil ~= found.built then + if found.built then + packageProgress(found, 'DONE ALREADY') + print('') + else + packageProgress(found, 'TRIED ALREADY and') + print(' failed') + end + return + end + + if git then gitGet(found) end +--[[ Don't bother doing this unless we are doing some sort of dependency tracking / skip rebuilding old stuff. + if nil ~= found.updated then + if not found.updated then + print(' NO CHANGE for ' .. found.path) + return end end +]] + + if found.exists then + local conf = configOptions[package] + + if nil == conf then conf = '' end + packageProgress(found, 'Building in ' .. found.path) + log('Environment variables -\\n ' .. string.gsub(exportedEnvVars, '; ', '\n '), found) + + if fileExists(found.path .. '/Makefile') then + if good then runBuildCommand(found, 'make -j' .. threads .. ' clean distclean') end + end + + if fileExists(found.path .. '/autogen.sh') then + if good then good = runBuildCommand(found, './autogen.sh --prefix=' .. installPath .. ' --cache-file=/tmp/EFL/.cache ' .. conf) end + if good then good = runBuildCommand(found, 'make -j' .. threads) end + if good then good = runBuildCommand(found, 'sudo make install') end + elseif fileExists(found.path .. '/build.lua') then + if good then good = runBuildCommand(found, './build.lua') end + elseif fileExists(found.path .. '/build.sh') then + if good then good = runBuildCommand(found, './build.sh') end + elseif fileExists(found.path .. '/bootstrap.sh') then + if good then good = runBuildCommand(found, './bootstrap.sh') end + if good then good = runBuildCommand(found, './configure --prefix=' .. installPath .. ' --cache-file=/tmp/EFL/.cache ' .. conf) end + if good then good = runBuildCommand(found, 'make -j' .. threads) end + if good then good = runBuildCommand(found, 'sudo make install') end + elseif fileExists(found.path .. '/Makefile.PL') then + if good then good = runBuildCommand(found, './perl Makefile.PL prefix=' .. installPath) end + if good then good = runBuildCommand(found, 'make -j' .. threads) end + if good then good = runBuildCommand(found, 'sudo make install') end + elseif fileExists(found.path .. '/CMakeLists.txt') then + if good then good = runBuildCommand(found, 'mkdir -p build && cd build && cmake ..') end + if good then good = runBuildCommand(found, 'cd build && make PREFIX=' .. installPath .. ' -j' .. threads) end + if good then good = runBuildCommand(found, 'cd build && sudo make PREFIX=' .. installPath .. ' install') end + elseif fileExists(found.path .. '/setup.py') then + if good then good = runBuildCommand(found, 'python setup.py build build_ext --include-dirs=$PYTHONINCLUDE') end + if good then good = runBuildCommand(found, 'sudo PYTHONPATH=' .. cythonPath .. ':$PYTHONPATH -E python setup.py install --prefix=' .. installPath) end + elseif fileExists(found.path .. '/Makefile') then -- Keep this last, as others might generate this, so we want to detect those others first. + if good then good = runBuildCommand(found, 'make PREFIX=' .. installPath .. ' -j' .. threads) end + if good then good = runBuildCommand(found, 'sudo make PREFIX=' .. installPath .. ' install') end + else + packageProgress(found, 'NO BUILD SYSTEM') + found.errorMsg = '' + good = false + end - if not exists then - progress(i, package, package, 'DOES NOT EXIST!'); + -- Run the doc generation in the background, should not be any dependencies. + if good then + if fileExists(found.path .. '/gendoc') then + if good then runBuildCommand(found, 'sh gendoc > /tmp/EFL/' .. found.name .. '_doc.log 2>&1 &') end + elseif fileExists(found.path .. '/doc/Doxyfile') then + if good then runBuildCommand(found, 'make doc > /tmp/EFL/' .. found.name .. '_doc.log 2>&1 &') end + end + end + else + found.errorMsg = 'DOES NOT EXIST!' + good = false end + + found.built = good + logResult(found, found.built) print('') + if not good and found.critical then os.exit(1) end end +local function allIn(dir, git, svn) + local name = string.gsub(dir, "^.*/", "") + local stuff = {} + local count = 0 + local i = 1 + local len = #dir --- Build the compile environment. -for i, var in ipairs(envVars) do - exportedEnvVars = exportedEnvVars .. 'export ' .. var .. '; ' + if nil == git then git = false end + + for j, found in pairs(packages) do + if string.sub(found.gitPath, 1, 1 + len) == dir .. '/' then + count = count + 1 + table.insert(stuff, found) + end + end + + -- TODO - I don't think this is actually needed anymore. + if nil ~= svn then + os.execute('find SVN/trunk/' .. svn ..' -maxdepth 1 -type d ! -name .svn ! -name .git ! -name ' .. svn ..' -printf "%f\n" | sort > /tmp/EFL/' .. name ..'.txt') + for package in io.lines('/tmp/EFL/' .. name ..'.txt') do + local found = packages[package] + +-- TODO - Should addPackage() this if it doesn't exist. +-- TODO - Oops, should change the build path here. + if nil ~= found then count = count + 1; table.insert(stuff, found) end + end + end + + if git then + printf("Updating %d " .. dir .. " gits\n", count) + else + printf('Building %d ' .. dir ..'.\n', count) + end + for j, found in pairs(stuff) do + found.i = i + i = i + 1 + if git then + gitGet(found) + logResult(found, nil ~= found.updated) + print('') + else + build(found.i, found.name) + end + end end --- Recreate the temporary directory. -os.execute('rm -fr /tmp/eflBuild') -os.execute('mkdir /tmp/eflBuild') -printf("G'day %s, let's start with your ssh key, a password might be needed.\n", USER) -os.execute('eval `ssh-agent -s` >/dev/null && ssh-add && echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK\\nSSH_AGENT_PID=$SSH_AGENT_PID" >/tmp/eflBuild/sa') --- Grab the ssh-agent variables for later. -for line in io.lines('/tmp/eflBuild/sa') do - saEnvVars = saEnvVars .. 'export ' .. line .. '; ' +---------------------------------------------------------------------------------------------------- +---------------------------------------------------------------------------------------------------- + + +-- Build the compile environment. +for j, var in ipairs(envVars) do + exportedEnvVars = exportedEnvVars .. 'export ' .. var .. '; ' end -printf('Now we need your sudo password.\n') + +printf("G'day %s, let's start with your sudo password.\n", USER) os.execute('sudo echo "https://en.wikipedia.org/wiki/Pseudo_Echo Welcome to the 80\'s"') -- There was an aussie band called that. lol +-- Recreate the build, install, and temporary directories. +os.execute('rm -fr /tmp/EFL && mkdir -p /tmp/EFL') +-- The problem we are trying to solve is that installPath is compiled into lots of the binaries. B-( +-- As well as a desire to switch to the newly built Enlightenment ASAP, then continue building the rest. +-- But only if it builds fine. +-- Create /opt/EFL_timestamp, relink /opt/EFL_NEW to it before starting to build, then build to /opt/EFL_NEW. +-- When happy that it's working, switch to building in /opt/EFL. +-- Can't have ':' in this path. +local buildPath = "/opt/EFL_" .. os.date('%Y%m%d_%H%M', startTime) +-- Delete /opt/EFL_NEW first, coz the ln command puts it's results INSIDE that directory otherwise. +os.execute('sudo rm ' .. installPath .. ' && sudo mkdir -p ' .. buildPath .. ' && sudo ln -fs ' .. buildPath .. ' ' .. installPath) + -- Get the git repo list. -os.execute('cd /tmp/eflBuild && wget http://git.enlightenment.org/repos.txt') --- Evil hack so we get the proper ones listed first. The evil part is that alphabetical order just happens to work. For now. -os.execute('sort /tmp/eflBuild/repos.txt > /tmp/eflBuild/repos_sorted.txt') +os.execute('cd /tmp/EFL && wget http://git.enlightenment.org/repos.txt') + +-- Evil hack so we get the proper ones searched first. The evil part is that alphabetical order just happens to work. Mostly. +-- Except we may or may not want certain devs/ things to override others. Default to devs/ later, until I need it. Also, hard code legacy/ stuff at the end. +local r,message = io.popen('sort /tmp/EFL/repos.txt') +if nil == r then + print(message) +else + for path in r:lines() do + local name = string.gsub(string.sub(path, 1, -5), "^.*/", "") + local valid = true + + -- Less evil than the evil hack mentioned above. + if string.sub(path, 1, 6) == 'admin/' then valid = false end + if string.sub(path, 1, 22) == 'devs/asdfuser/migrate/' then valid = false end + if string.sub(path, 1, 4) == 'e16/' then valid = false end + if string.sub(path, 1, 8) == 'website/' then valid = false end + if valid then + for j, package in ipairs(disable) do + if name == package then + valid = false + print('Disabled ' .. path) + break + end + end + end + + if valid then table.insert(repos, path) end + end + r:close() +end + +print('Compiling repos and search path.') local i = 1 -for line in io.lines('/tmp/eflBuild/repos_sorted.txt') do - local path = string.sub(line, 1, -5) +-- Stick most at the beginning. +for j, path in ipairs(repos) do + local entry = 'GIT/' .. string.gsub(path, "/[^/]+$", "", 1) local valid = true; - -- Less evil than the evil hack above. - if string.sub(path, 1, 22) == 'devs/asdfuser/migrate/' then valid = false end --- if string.sub(path, 1, 7) == 'legacy/' then valid = false end + if string.sub(path, 1, 5) == 'devs/' then valid = false end + if string.sub(path, 1, 7) == 'legacy/' then valid = false end + if valid then i = addPath(i, entry) end +end +-- Stick devs/ in the middle. +for j, path in ipairs(repos) do + local entry = 'GIT/' .. string.gsub(path, "/[^/]+$", "", 1) + if string.sub(path, 1, 5) == 'devs/' then i = addPath(i, entry) end +end + +--printTableStart(searchPaths, '', 'searchPaths') - -- TODO - Should try to keep these unique. - if valid then - table.insert(searchPaths, i, 'GIT/' .. string.gsub(path, "/[^/]+$", "", 1)) - i = i + 1 - end +print('Getting package list.') +for j, path in ipairs(repos) do + addPackage(path) end +-- Mark the criticals. +for j, package in ipairs(eflCore) do if nil ~= packages[package] then packages[package].critical = true end end +for j, package in ipairs({'enlightenment', 'terminology'}) do packages[package].critical = true end + +--printTableStart(packages, '', 'packages') + -- Build stuff. if nil ~= arg[1] then printf('Building %d projects from the command line.\n', table.maxn(arg)) - for i, package in ipairs(arg) do - if 0 < i then - build(i, package); + for j, package in ipairs(arg) do + if 0 < j then + build(j, package, false); os.execute('sudo ldconfig') -- In case it was a library. end end else - - printf("Updating git, this might take a while.\n") - for line in io.lines('/tmp/eflBuild/repos_sorted.txt') do - local path = string.sub(line, 1, -5) - - if not fileExists('GIT/' .. path .. '/.git/HEAD') then - os.execute(saEnvVars .. 'mkdir -p GIT/`dirname ' .. path .. '` && cd GIT/`dirname ' .. path .. '` && git clone ssh://[email protected]/' .. line .. ' 2>&1 | tee /tmp/eflBuild/git.log') - else - printf('Updating %-42s ', path); io.flush() - os.execute(saEnvVars .. 'cd GIT/' .. path .. ' && git checkout master -q && git clean -dfqx && git reset --hard -q && git pull --rebase -q 2>&1 | tee /tmp/eflBuild/git.log') - end - os.execute('sudo echo -n ""') -- Just tickle the sudo so it remembers, in case the git takes too long. + local j = 1 + local count = 0 + + printf("Now we need your ssh key, a password might be needed.\n") + os.execute('eval `ssh-agent -s` >/dev/null && ssh-add ~/.ssh/id_rsa && echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK\\nSSH_AGENT_PID=$SSH_AGENT_PID" >/tmp/EFL/sa') + -- Grab the ssh-agent variables for later. + for line in io.lines('/tmp/EFL/sa') do + saEnvVars = saEnvVars .. 'export ' .. line .. '; ' end - printf('Building %d core EFL libraries.\n', #eflCore) - for i, package in ipairs(eflCore) do build(i, package); os.execute('sudo ldconfig') end + printf('Building %d core EFL things.\n', #eflCore) + for k, package in ipairs(eflCore) do build(k, package); os.execute('sudo ldconfig') end - printf('Building %d extra EFL libraries.\n', #eflExtra) - for i, package in ipairs(eflExtra) do build(i, package); os.execute('sudo ldconfig') end + printf('Building %d needed things.\n', #binCore) + for k, package in ipairs(binCore) do build(k, package) end - printf('Building %d basic binaries.\n', #binBasic) - for i, package in ipairs(binBasic) do build(i, package) end + printf('\nBuilding Enlightenment took %d minutes. ', os.difftime(os.time(), startTime) / 60) + print("Now's a good time to restart it, see if it works.") + -- At this point Enlightement and terminology are ready to go. + os.execute('sudo ldconfig') +-- os.execute('enlightenment_remote -restart') + print('') - os.execute('find GIT/enlightenment/modules -maxdepth 1 -type d ! -name .svn ! -name .git ! -name modules -printf "%f\n" | sort > /tmp/eflBuild/modules.txt') - os.execute('find SVN/trunk/E-MODULES-EXTRA -maxdepth 1 -type d ! -name .svn ! -name .git ! -name E-MODULES-EXTRA -printf "%f\n" | sort >> /tmp/eflBuild/modules.txt') - for package in io.lines('/tmp/eflBuild/modules.txt') do table.insert(eModulesExtra, package) end - printf('Building %d E17 extra modules.\n', #eModulesExtra) - for i, package in ipairs(eModulesExtra) do build(i, package) end + -- Look for new repos, download them now. + j = 0 + for k, found in pairs(packages) do + if not fileExists('GIT/' .. found.gitPath) then j = j + 1 end + end + printf('Cloning %d new gits.\n', j) + if 0 ~= j then + j = 1 + for k, found in pairs(packages) do + if not fileExists('GIT/' .. found.gitPath) then + found.i = j + j = j + 1 + gitGet(found) + print('') + end + end + end - printf('Building %d extra binaries.\n', #binExtra) - for i, package in ipairs(binExtra) do build(i, package) end + allIn('legacy', true) + allIn('libs') + os.execute('sudo ldconfig') + allIn('bindings') + os.execute('sudo ldconfig') + allIn('tools') + + printf('Building %d extra EFL things.\n', #eflExtra) + for k, package in ipairs(eflExtra) do build(k, package); os.execute('sudo ldconfig') end + + allIn('misc') -- Coz libast, used by apps/eterm. + os.execute('sudo ldconfig') + allIn('apps') -- Coz emprint, used by legacy/subversion-history/trunk/E-MODULES-EXTRA/screenshot. +-- TODO - wlan goes odd. + allIn('enlightenment/modules', false, 'E-MODULES-EXTRA') + allIn('games') + allIn('themes') + + -- Build what ever is left over. + count = 0 + for k, found in pairs(packages) do + local delete = false; + + if string.sub(found.gitPath, 1, 7) == 'legacy/' then delete = true end + if nil ~= found.built then delete = true end + if delete then packages[found.name] = nil else count = count + 1 end + end - os.execute('find GIT/themes -maxdepth 1 -type d ! -name .svn ! -name .git ! -name themes -printf "%f\n" | sort > /tmp/eflBuild/themes.txt') - for package in io.lines('/tmp/eflBuild/themes.txt') do table.insert(eThemes, package) end - printf('Building %d themes.\n', #eThemes) - for i, package in ipairs(eThemes) do build(i, package) end + printf('Building %d left over things.\n', count) + j = 1 + for v, package in pairs(packages) do + build(j, v) + j = j + 1 + end + os.execute('sudo ldconfig') end printf('\nBuilding took %d minutes.\n', os.difftime(os.time(), startTime) / 60) --
