Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/dn-build225
m---------scripts/jhbuild0
-rw-r--r--scripts/jhbuildrc45
-rw-r--r--scripts/modules/activities.json7
-rw-r--r--scripts/modules/sugar.json12
-rw-r--r--scripts/modules/sugar.modules42
-rw-r--r--scripts/modules/system-3.4.json40
-rw-r--r--scripts/modules/system-3.4.modules84
-rw-r--r--scripts/modules/system-3.6.json3
-rw-r--r--scripts/modules/system-3.6.modules15
-rw-r--r--scripts/xinitrc3
11 files changed, 268 insertions, 208 deletions
diff --git a/scripts/dn-build b/scripts/dn-build
index abee345..ec97b92 100755
--- a/scripts/dn-build
+++ b/scripts/dn-build
@@ -1,51 +1,242 @@
-#!/usr/bin/python
+#!/usr/bin/python -u
+from distutils import sysconfig
import json
import os
+import multiprocessing
import sys
import subprocess
+import sysinfo
+
+system_version = sysinfo.get_system_version()
scripts_dir = os.path.abspath(os.path.dirname(__file__))
base_dir = os.path.dirname(scripts_dir)
install_dir = os.path.join(base_dir, "install")
+dnbuild_dir = os.path.join(install_dir, "dnbuild")
+share_dir = os.path.join(install_dir, "share")
+include_dir = os.path.join(install_dir, "include")
+bin_dir = os.path.join(install_dir, "bin")
+etc_dir = os.path.join(install_dir, "etc")
+build_dir = os.path.join(base_dir, "build")
source_dir = os.path.join(base_dir, "source")
-activities_dir = os.path.join(source_dir, "activities")
modules_dir = os.path.join(scripts_dir, "modules")
+build_state_path = os.path.join(dnbuild_dir, "state.json")
-def get_module_dir(module):
- return os.path.join(activities_dir, module["name"])
+if os.uname()[4] == "x86_64":
+ lib_dir = os.path.join(install_dir, "lib64")
+ system_lib_dir = "/usr/lib64"
+else:
+ lib_dir = os.path.join(install_dir, "lib")
+ system_lib_dir = "/usr/lib"
-def pull_source(module):
- if not os.path.exists(activities_dir):
- os.mkdir(activities_dir)
+module_files = { "activities": ["activities.json"],
+ "glucose": ["system-%s.json" % system_version,
+ "sugar.json"] }
+
+state = { "built_modules": {} }
+
+def add_path(name, path):
+ if name not in os.environ:
+ os.environ[name] = path
+ return
+
+ splitted = os.environ[name].split(":")
+ splitted.append(path)
+
+ os.environ[name] = ":".join(splitted)
+
+def get_module_source_dir(module):
+ return os.path.join(source_dir, module["name"])
- module_dir = get_module_dir(module)
+def get_module_build_dir(module):
+ return os.path.join(build_dir, module["name"])
+
+def get_module_commit_id(module):
+ orig_cwd = os.getcwd()
+
+ os.chdir(get_module_source_dir(module))
+ commit_id = subprocess.check_output(["git", "rev-parse", "HEAD"])
+
+ os.chdir(orig_cwd)
+
+ return commit_id.strip()
+
+def run_command(args):
+ print " ".join(args)
+ subprocess.check_call(args)
+
+def pull_source(module):
+ module_dir = get_module_source_dir(module)
if os.path.exists(module_dir):
os.chdir(module_dir)
- subprocess.check_call(["git", "pull"])
+
+ run_command(["git", "remote", "set-url", "origin", module["repo"]])
+ run_command(["git", "remote", "update", "origin"])
else:
- os.chdir(activities_dir)
- subprocess.check_call(["git", "clone", module["repo"], module["name"]])
+ os.chdir(source_dir)
+ run_command(["git", "clone", module["repo"], module["name"]])
os.chdir(module_dir)
branch = module.get("branch", "master")
- subprocess.check_call(["git", "checkout", branch])
+ run_command(["git", "checkout", branch])
+
+def build_autotools(module):
+ autogen = os.path.join(get_module_source_dir(module), "autogen.sh")
+
+ jobs = multiprocessing.cpu_count() * 2
+
+ run_command([autogen,
+ "--prefix", install_dir,
+ "--libdir", lib_dir])
+
+ run_command(["make", "-j", "%d" % jobs])
+ run_command(["make", "install"])
+
+def build_activity(module):
+ run_command(["./setup.py", "install", "--prefix", install_dir])
def build(module):
- os.chdir(get_module_dir(module))
- subprocess.check_call(["./setup.py", "install", "--prefix", install_dir])
+ module_source_dir = get_module_source_dir(module)
-def main():
- modules = json.load(open(os.path.join(modules_dir, "activities.json")))
+ if module.get("out-of-source", True):
+ module_build_dir = get_module_build_dir(module)
+
+ if not os.path.exists(module_build_dir):
+ os.mkdir(module_build_dir)
+
+ os.chdir(module_build_dir)
+ else:
+ os.chdir(module_source_dir)
+
+ if os.path.exists(os.path.join(module_source_dir, "setup.py")):
+ build_activity(module)
+ elif os.path.exists(os.path.join(module_source_dir, "autogen.sh")):
+ build_autotools(module)
+ else:
+ print "Unknown build system"
+ sys.exit(1)
+
+ state["built_modules"][module["name"]] = get_module_commit_id(module)
+
+def cmd_build():
+ modules = []
+ for module_file in module_files[sys.argv[2]]:
+ path = os.path.join(modules_dir, module_file)
+ modules.extend(json.load(open(path)))
for module in modules:
print "\n=== Building %s ===\n" % module["name"]
try:
pull_source(module)
- build(module)
+
+ old_commit_id = state["built_modules"].get(module["name"], None)
+ new_commit_id = get_module_commit_id(module)
+
+ if old_commit_id is None or old_commit_id != new_commit_id:
+ build(module)
+ else:
+ print "\n* Already built, skipping *"
except subprocess.CalledProcessError:
sys.exit(1)
+def cmd_shell():
+ user_shell = os.environ.get('SHELL', '/bin/sh')
+ os.execlp(user_shell, user_shell)
+
+def cmd_run():
+ os.execlp(sys.argv[2], *sys.argv[2:])
+
+def setup_environ():
+ add_path("LD_LIBRARY_PATH", lib_dir)
+ add_path("PATH", bin_dir)
+
+ add_path("GIO_EXTRA_MODULES",
+ os.path.join(system_lib_dir, "gio", "modules"))
+ add_path("GI_TYPELIB_PATH",
+ os.path.join(lib_dir, "girepository-1.0"))
+ add_path("GI_TYPELIB_PATH",
+ os.path.join(system_lib_dir, "girepository-1.0"))
+ add_path("PKG_CONFIG_PATH",
+ os.path.join(lib_dir, "pkgconfig"))
+ add_path("GST_PLUGIN_PATH",
+ os.path.join(lib_dir , "gstreamer-1.0"))
+ add_path("GST_REGISTRY",
+ os.path.join(dnbuild_dir, "gstreamer.registry"))
+ add_path("PYTHONPATH",
+ sysconfig.get_python_lib(prefix=install_dir))
+ add_path("PYTHONPATH",
+ sysconfig.get_python_lib(prefix=install_dir, plat_specific=True))
+
+ add_path("XDG_DATA_DIRS", "/usr/share")
+ add_path("XDG_DATA_DIRS", share_dir)
+
+ add_path("XDG_CONFIG_DIRS", "/etc")
+ add_path("XDG_CONFIG_DIRS", etc_dir)
+
+ os.environ["GTK_DATA_PREFIX"] = install_dir
+ os.environ["GTK_PATH"] = os.path.join(lib_dir, "gtk-2.0")
+
+def setup_gconf():
+ gconf_dir = os.path.join(etc_dir, "gconf")
+ gconf_pathdir = os.path.join(gconf_dir, "2")
+
+ if not os.path.exists(gconf_pathdir):
+ os.makedirs(gconf_pathdir)
+
+ gconf_path = os.path.join(gconf_pathdir, "path.jhbuild")
+ if not os.path.exists(gconf_path):
+ input = open("/etc/gconf/2/path")
+ output = open(gconf_path, "w")
+
+ for line in input.readlines():
+ if "/etc/gconf" in line:
+ output.write(line.replace("/etc/gconf", gconf_dir))
+ output.write(line)
+
+ output.close()
+ input.close()
+
+ os.environ["GCONF_DEFAULT_SOURCE_PATH"] = gconf_path
+
+ os.environ["GCONF_SCHEMA_INSTALL_SOURCE"] = \
+ "xml:merged:" + os.path.join(gconf_dir, "gconf.xml.defaults")
+
+def setup_dirs():
+ for dir in [source_dir,
+ install_dir,
+ build_dir,
+ share_dir,
+ dnbuild_dir,
+ os.path.join(share_dir, "aclocal")]:
+ if not os.path.exists(dir):
+ os.mkdir(dir)
+
+def load_state():
+ global state
+
+ if os.path.exists(build_state_path):
+ state = json.load(open(build_state_path))
+
+def save_state():
+ json.dump(state, open(build_state_path, "w+"))
+
+def main():
+ load_state()
+
+ setup_dirs()
+ setup_gconf()
+ setup_environ()
+
+ if sys.argv[1] == "build":
+ cmd_build()
+ elif sys.argv[1] == "shell":
+ cmd_shell()
+ elif sys.argv[1] == "run":
+ cmd_run()
+
+ save_state()
+
main()
diff --git a/scripts/jhbuild b/scripts/jhbuild
deleted file mode 160000
-Subproject d2e266da3d9b0437964ac59d4253480f7990fca
diff --git a/scripts/jhbuildrc b/scripts/jhbuildrc
deleted file mode 100644
index e129091..0000000
--- a/scripts/jhbuildrc
+++ /dev/null
@@ -1,45 +0,0 @@
-import os
-import sys
-
-sys.path.append(os.path.join(os.getcwd(), "scripts"))
-
-import sysinfo
-
-# HACK Ubuntu 64 bit gobject-introspection is not multilib
-if os.path.exists("/usr/lib/girepository-1.0"):
- addpath("GI_TYPELIB_PATH", "/usr/lib/girepository-1.0")
-
-def root():
- return os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
-
-def moduleset_path(moduleset):
- return os.path.join(root(), "scripts", "modules",
- "%s.modules" % moduleset)
-
-def libdir(system=False):
- if system:
- base = "/usr"
- else:
- base = prefix
-
- if use_lib64:
- return os.path.join(base, "lib64")
- else:
- return os.path.join(base, "lib")
-
-interact = not "SUGAR_BUILDBOT" in os.environ
-
-use_local_modulesets = True
-moduleset = [moduleset_path("system-%s" %
- sysinfo.get_system_version()),
- moduleset_path("sugar")]
-modules = ["meta-system", "meta-sugar"]
-
-checkoutroot = os.path.join(root(), "source")
-buildroot = os.path.join(root(), "build")
-prefix = os.path.join(root(), "install")
-
-os.environ["GTK_DATA_PREFIX"] = prefix
-os.environ["GTK_PATH"] = os.path.join(libdir(), "gtk-2.0")
-os.environ["GIO_EXTRA_MODULES"] = os.path.join(libdir(system=True),
- "gio", "modules")
diff --git a/scripts/modules/activities.json b/scripts/modules/activities.json
index 1abf756..e97a0fc 100644
--- a/scripts/modules/activities.json
+++ b/scripts/modules/activities.json
@@ -1,6 +1,7 @@
[{ "name": "browse",
- "repo": "git://git.sugarlabs.org/browse/mainline.git" },
+ "repo": "git://git.sugarlabs.org/browse/mainline.git",
+ "out-of-source": false },
{ "name": "chat",
"repo": "git://git.sugarlabs.org/chat/mainline.git",
- "branch": "gtk3" }
-]
+ "branch": "gtk3",
+ "out-of-source": false }]
diff --git a/scripts/modules/sugar.json b/scripts/modules/sugar.json
new file mode 100644
index 0000000..b9e659a
--- /dev/null
+++ b/scripts/modules/sugar.json
@@ -0,0 +1,12 @@
+[{ "name": "sugar-base",
+ "repo": "git://git.sugarlabs.org/sugar-base/mainline.git" },
+ { "name": "sugar-toolkit",
+ "repo": "git://git.sugarlabs.org/sugar-toolkit/mainline.git" },
+ { "name": "sugar-toolkit-gtk3",
+ "repo": "git://git.sugarlabs.org/sugar-toolkit-gtk3/sugar-toolkit-gtk3.git" },
+ { "name": "sugar",
+ "repo": "git://git.sugarlabs.org/sugar/mainline.git" },
+ { "name": "sugar-artwork",
+ "repo": "git://git.sugarlabs.org/sugar-artwork/mainline.git" },
+ { "name": "sugar-datastore",
+ "repo": "git://git.sugarlabs.org/sugar-datastore/mainline.git" }]
diff --git a/scripts/modules/sugar.modules b/scripts/modules/sugar.modules
deleted file mode 100644
index 1c506eb..0000000
--- a/scripts/modules/sugar.modules
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0"?><!--*- mode: nxml; indent-tabs-mode: nil -*-->
-<?xml-stylesheet type="text/xsl" href="moduleset.xsl"?>
-<moduleset>
- <repository type="git" name="git.sugarlabs.org" default="yes"
- href="git://git.sugarlabs.org"/>
- <autotools id="sugar-base">
- <branch module="sugar-base/mainline.git" checkoutdir="sugar-base"/>
- </autotools>
- <autotools id="sugar-toolkit">
- <branch module="sugar-toolkit/mainline.git" checkoutdir="sugar-toolkit"/>
- <dependencies>
- <dep package="sugar-datastore"/>
- </dependencies>
- </autotools>
- <autotools id="sugar-toolkit-gtk3">
- <branch module="sugar-toolkit-gtk3/sugar-toolkit-gtk3.git" checkoutdir="sugar-toolkit-gtk3"/>
- <dependencies>
- <dep package="sugar-datastore"/>
- </dependencies>
- </autotools>
- <autotools id="sugar">
- <branch module="sugar/mainline.git" checkoutdir="sugar"/>
- <dependencies>
- <dep package="sugar-base"/>
- <dep package="sugar-toolkit"/>
- <dep package="sugar-artwork"/>
- </dependencies>
- </autotools>
- <autotools id="sugar-artwork">
- <branch module="sugar-artwork/mainline.git" checkoutdir="sugar-artwork"/>
- </autotools>
- <autotools id="sugar-datastore">
- <branch module="sugar-datastore/mainline.git" checkoutdir="sugar-datastore"/>
- </autotools>
-
- <metamodule id="meta-sugar">
- <dependencies>
- <dep package="sugar-toolkit-gtk3"/>
- <dep package="sugar"/>
- </dependencies>
- </metamodule>
-</moduleset>
diff --git a/scripts/modules/system-3.4.json b/scripts/modules/system-3.4.json
new file mode 100644
index 0000000..9ba12cd
--- /dev/null
+++ b/scripts/modules/system-3.4.json
@@ -0,0 +1,40 @@
+[{ "name": "glib",
+ "repo": "git://git.gnome.org/glib",
+ "branch": "2.34.2" },
+ { "name": "gobject-introspection",
+ "repo": "git://git.gnome.org/gobject-introspection",
+ "branch": "GOBJECT_INTROSPECTION_1_34_1_1" },
+ { "name": "pygobject",
+ "repo": "git://git.gnome.org/pygobject",
+ "branch": "3.4.2" },
+ { "name": "atk",
+ "repo": "git://git.gnome.org/atk",
+ "branch": "ATK_2_6_0" },
+ { "name": "at-spi2-core",
+ "repo": "git://git.gnome.org/at-spi2-core",
+ "branch": "AT_SPI2_CORE_2_6_1" },
+ { "name": "at-spi2-atk",
+ "repo": "git://git.gnome.org/at-spi2-atk",
+ "branch": "AT_SPI2_ATK_2_6_1" },
+ { "name": "gtk+",
+ "repo": "git://git.gnome.org/gtk+",
+ "branch": "3.6.1" },
+ { "name": "gstreamer",
+ "repo": "git://anongit.freedesktop.org/gstreamer/gstreamer",
+ "branch": "1.0.2",
+ "out-of-source": false },
+ { "name": "gst-plugins-base",
+ "repo": "git://anongit.freedesktop.org/gstreamer/gst-plugins-base",
+ "branch": "1.0.2",
+ "out-of-source": false },
+ { "name": "gst-plugins-good",
+ "repo": "git://anongit.freedesktop.org/gstreamer/gst-plugins-good",
+ "branch": "1.0.2",
+ "out-of-source": false },
+ { "name": "gst-plugins-espeak",
+ "repo": "git://git.sugarlabs.org/gst-plugins-espeak/mainline.git",
+ "branch": "v0.4.0",
+ "out-of-source": false },
+ { "name": "libxklavier",
+ "repo": "git://anongit.freedesktop.org/libxklavier",
+ "branch": "libxklavier-5.3" }]
diff --git a/scripts/modules/system-3.4.modules b/scripts/modules/system-3.4.modules
deleted file mode 100644
index 9d06150..0000000
--- a/scripts/modules/system-3.4.modules
+++ /dev/null
@@ -1,84 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="moduleset.xsl"?>
-<moduleset>
- <repository type="git" name="git.gnome.org" href="git://git.gnome.org"/>
- <repository type="git" name="github.com/dnarvaez" href="git://github.com/dnarvaez"/>
- <repository type="git" name="gstreamer.freedesktop.org" href="git://anongit.freedesktop.org/gstreamer/"/>
- <repository type="git" name="freedesktop.org" href="git://anongit.freedesktop.org/"/>
- <repository type="git" name="git.sugarlabs.org" href="git://git.sugarlabs.org"/>
- <repository type="tarball" name="gnome.org" href="http://download.gnome.org/sources/"/>
- <autotools id="gtk+">
- <branch repo="git.gnome.org" revision="3.6.1"/>
- <dependencies>
- <dep package="atk"/>
- </dependencies>
- </autotools>
- <autotools id="atk">
- <branch repo="git.gnome.org" revision="ATK_2_6_0"/>
- <dependencies>
- <dep package="at-spi2-atk"/>
- </dependencies>
- </autotools>
- <autotools id="at-spi2-atk">
- <branch repo="git.gnome.org" revision="AT_SPI2_ATK_2_6_1"/>
- <dependencies>
- <dep package="at-spi2-core"/>
- </dependencies>
- </autotools>
- <autotools id="at-spi2-core">
- <branch repo="git.gnome.org" revision="AT_SPI2_CORE_2_6_1"/>
- <dependencies>
- </dependencies>
- </autotools>
- <autotools id="pygobject">
- <branch repo="git.gnome.org" revision="3.4.1.1"/>
- <dependencies>
- <dep package="glib"/>
- <dep package="gobject-introspection"/>
- </dependencies>
- </autotools>
- <autotools id="gobject-introspection">
- <branch repo="git.gnome.org" revision="GOBJECT_INTROSPECTION_1_34_1_1"/>
- <dependencies>
- <dep package="glib"/>
- </dependencies>
- </autotools>
- <autotools id="glib">
- <branch module="glib/2.34/glib-2.34.1.tar.xz" version="2.34.1"
- repo="gnome.org"
- hash="sha256:6e84dc9d84b104725b34d255421ed7ac3629e49f437d37addde5ce3891c2e2f1"
- size="6363332"/>
- </autotools>
- <autotools id="gstreamer" supports-non-srcdir-builds="no">
- <branch repo="gstreamer.freedesktop.org" revision="1.0.2"/>
- </autotools>
- <autotools id="gst-plugins-base" supports-non-srcdir-builds="no">
- <branch repo="gstreamer.freedesktop.org" revision="1.0.2"/>
- <dependencies>
- <dep package="gstreamer"/>
- </dependencies>
- </autotools>
- <autotools id="gst-plugins-good" supports-non-srcdir-builds="no">
- <branch repo="gstreamer.freedesktop.org" revision="1.0.2"/>
- <dependencies>
- <dep package="gst-plugins-base"/>
- </dependencies>
- </autotools>
- <autotools id="gst-plugins-espeak" supports-non-srcdir-builds="no">
- <branch repo="git.sugarlabs.org" module="gst-plugins-espeak/mainline.git"
- revision="v0.4.0" checkoutdir="gst-plugins-espeak"/>
- </autotools>
- <autotools id="libxklavier">
- <branch repo="freedesktop.org" revision="libxklavier-5.3"/>
- </autotools>
-
- <metamodule id="meta-system">
- <dependencies>
- <dep package="pygobject"/>
- <dep package="gtk+"/>
- <dep package="gst-plugins-good"/>
- <dep package="gst-plugins-espeak"/>
- <dep package="libxklavier"/>
- </dependencies>
- </metamodule>
-</moduleset>
diff --git a/scripts/modules/system-3.6.json b/scripts/modules/system-3.6.json
new file mode 100644
index 0000000..a868125
--- /dev/null
+++ b/scripts/modules/system-3.6.json
@@ -0,0 +1,3 @@
+[{ "name": "pygobject",
+ "repo": "git://git.gnome.org/pygobject",
+ "branch": "3.4.2" }]
diff --git a/scripts/modules/system-3.6.modules b/scripts/modules/system-3.6.modules
deleted file mode 100644
index 4fa1bc4..0000000
--- a/scripts/modules/system-3.6.modules
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="moduleset.xsl"?>
-<moduleset>
- <repository type="git" name="github.com/dnarvaez" href="git://github.com/dnarvaez"/>
- <autotools id="pygobject">
- <branch repo="github.com/dnarvaez" revision="pygobject-3-4"/>
- <dependencies>
- </dependencies>
- </autotools>
- <metamodule id="meta-system">
- <dependencies>
- <dep package="pygobject"/>
- </dependencies>
- </metamodule>
-</moduleset>
diff --git a/scripts/xinitrc b/scripts/xinitrc
index aa4da72..345a8a7 100644
--- a/scripts/xinitrc
+++ b/scripts/xinitrc
@@ -52,11 +52,10 @@ if [ -n $SUGAR_XKBCONFIG ]; then
rm $SUGAR_XKBCONFIG
fi
-JHBUILD="$ROOT_DIR/install/bin/jhbuild -f $ROOT_DIR/scripts/jhbuildrc"
RUN_COMMAND="dbus-launch --exit-with-session $SCRIPTS_DIR/run-with-keyring sugar"
if [ -z $SUGAR_BUILD_SHELL ]; then
- $JHBUILD run $RUN_COMMAND
+ $SCRIPTS_DIR/dn-build run $RUN_COMMAND
else
$RUN_COMMAND
fi