diff options
author | Lauri Leukkunen <lle@rahina.org> | 2007-12-11 14:08:08 +0200 |
---|---|---|
committer | Lauri Leukkunen <lle@rahina.org> | 2007-12-11 14:08:08 +0200 |
commit | 5159d6ec7e9074b013c082e5749222e79b2c7592 (patch) | |
tree | 5b31ccce97029dc8827b74107c5021afaff59df8 | |
parent | 49d7cd677d4541884b46215607a0b399865b1d6d (diff) |
Add -m mapping_mode switch to sb2-init
Allows specifying the default mapping mode for a given target.
Useful values include "maemo".
Signed-off-by: Lauri Leukkunen <lle@rahina.org>
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | lua_scripts/pathmaps/maemo/00_default.lua | 126 | ||||
-rw-r--r-- | lua_scripts/pathmaps/simple/00_default.lua | 54 | ||||
-rwxr-xr-x | utils/sb2-init | 19 |
4 files changed, 147 insertions, 55 deletions
@@ -85,6 +85,8 @@ install-noarch: $(BUILD_TARGET) install -d -m 755 $(prefix)/share/scratchbox2/lua_scripts/pathmaps/complex install -d -m 755 $(prefix)/share/scratchbox2/lua_scripts/pathmaps/emulate install -d -m 755 $(prefix)/share/scratchbox2/lua_scripts/pathmaps/simple + install -d -m 755 $(prefix)/share/scratchbox2/lua_scripts/pathmaps/maemo + install -d -m 755 $(prefix)/share/scratchbox2/scripts install -d -m 755 $(prefix)/share/scratchbox2/tests install -d -m 755 $(prefix)/share/man/man1 @@ -100,6 +102,7 @@ install-noarch: $(BUILD_TARGET) install -c -m 644 $(SRCDIR)/lua_scripts/pathmaps/complex/*.lua $(prefix)/share/scratchbox2/lua_scripts/pathmaps/complex/ install -c -m 644 $(SRCDIR)/lua_scripts/pathmaps/emulate/*.lua $(prefix)/share/scratchbox2/lua_scripts/pathmaps/emulate/ install -c -m 644 $(SRCDIR)/lua_scripts/pathmaps/simple/*.lua $(prefix)/share/scratchbox2/lua_scripts/pathmaps/simple/ + install -c -m 644 $(SRCDIR)/lua_scripts/pathmaps/maemo/*.lua $(prefix)/share/scratchbox2/lua_scripts/pathmaps/maemo/ install -c -m 644 $(SRCDIR)/tests/* $(prefix)/share/scratchbox2/tests chmod a+x $(prefix)/share/scratchbox2/tests/run.sh diff --git a/lua_scripts/pathmaps/maemo/00_default.lua b/lua_scripts/pathmaps/maemo/00_default.lua new file mode 100644 index 0000000..2a4bc81 --- /dev/null +++ b/lua_scripts/pathmaps/maemo/00_default.lua @@ -0,0 +1,126 @@ +-- Copyright (C) 2007 Lauri Leukkunen <lle@rahina.org> +-- Licensed under MIT license. + + +simple_chain = { + next_chain = nil, + binary = ".*", + rules = { + {path = "^/lib.*", map_to = "="}, +-- /usr/share is mapped to the buildroot except these directories +-- (taken from bora rootstrap contents) + {path = "^/usr/share/aclocal.*", map_to = "="}, + {path = "^/usr/share/alsa.*", map_to = "="}, + {path = "^/usr/share/applications.*", map_to = "="}, + {path = "^/usr/share/apt.*", map_to = "="}, + {path = "^/usr/share/backgrounds.*", map_to = "="}, + {path = "^/usr/share/base.files.*", map_to = "="}, + {path = "^/usr/share/bug.*", map_to = "="}, + {path = "^/usr/share/certs.*", map_to = "="}, + {path = "^/usr/share/dbus.1.*", map_to = "="}, + {path = "^/usr/share/debconf.*", map_to = "="}, +--autoscripts {path = "^/usr/share/debhelper.*", map_to = "="}, + {path = "^/usr/share/defoma.*", map_to = "="}, + {path = "^/usr/share/dict.*", map_to = "="}, + {path = "^/usr/share/dpkg.*", map_to = "="}, + {path = "^/usr/share/docbook.utils.*", map_to = nil}, + {path = "^/usr/share/doc.*", map_to = "="}, +--trippletable error if taken from target: {path = "^/usr/share/dpkg.*", map_to = "="}, + {path = "^/usr/share/fonts.*", map_to = "="}, + {path = "^/usr/share/glib.*", map_to = "="}, + {path = "^/usr/share/gnupg.*", map_to = "="}, + {path = "^/usr/share/gtk.doc/data/gtkdoc.common*", map_to = nil}, + {path = "^/usr/share/gtk.doc/data/gtk.doc.make*", map_to = nil}, + {path = "^/usr/share/gtk.doc/data/.*xsl", map_to = nil}, + {path = "^/usr/share/gtk.doc.*", map_to = "="}, +--gtk-doc.make error if taken from target: {path = "^/usr/share/gtk.*", map_to = "="}, + {path = "^/usr/share/i18n.*", map_to = "="}, + {path = "^/usr/share/icons.*", map_to = "="}, + {path = "^/usr/share/ifupdown.*", map_to = "="}, + {path = "^/usr/share/info.*", map_to = "="}, + {path = "^/usr/share/initscripts.*", map_to = "="}, + {path = "^/usr/share/lintian.*", map_to = "="}, + {path = "^/usr/share/locale.*", map_to = "="}, + {path = "^/usr/share/man.*", map_to = "="}, + {path = "^/usr/share/mime.*", map_to = "="}, +--readline {path = "^/usr/share/misc.*", map_to = "="}, + {path = "^/usr/share/osso.*", map_to = "="}, + {path = "^/usr/share/passwd.*", map_to = "="}, + {path = "^/usr/share/ppp.*", map_to = "="}, +--docbook {path = "^/usr/share/sgml.*", map_to = "="}, + {path = "^/usr/share/sounds.*", map_to = "="}, + {path = "^/usr/share/sysklogd.*", map_to = "="}, + {path = "^/usr/share/sysvinit.*", map_to = "="}, + {path = "^/usr/share/tabset.*", map_to = "="}, + {path = "^/usr/share/telepathy.*", map_to = "="}, + {path = "^/usr/share/terminfo.*", map_to = "="}, + {path = "^/usr/share/themes.*", map_to = "="}, + {path = "^/usr/share/user.icons.*", map_to = "="}, + {path = "^/usr/share/X11.*", map_to = "="}, +--docbook/stylesheet... {path = "^/usr/share/xml.*", map_to = "="}, + {path = "^/usr/share/zoneinfo.*", map_to = "="}, + {path = "^/usr/bin/xml2.conf.*", map_to = "="}, +--glib-mkenums error: points to /scratchbox/tools/bin/perl {path = "^/usr/bin/glib.*", map_to = "="}, + {path = "^/usr/bin/gobject.query.*", map_to = "="}, + {path = "^/usr/lib/perl.*", map_to = nil}, + {path = "^/usr/lib/dpkg.*", map_to = nil}, + {path = "^/usr/lib/cdbs.*", map_to = nil}, + {path = "^/usr/lib.*", map_to = "="}, + {path = "^/usr/include.*", map_to = "="}, + {path = "^/usr/share/aclocal.*", map_to = "="}, + {path = "^/var/.*/apt.*", map_to = "="}, + {path = "^/var/.*/dpkg.*", map_to = "="}, + {path = "^/host_usr", map_to = "="}, + {path = ".*", map_to = nil} + } +} + +qemu_chain = { + next_chain = nil, + binary = ".*qemu.*", + rules = { + {path = "^/lib.*", map_to = "="}, + {path = "^/usr/lib.*", map_to = "="}, + {path = "^/usr/local/lib.*", map_to = "="}, + {path = ".*", map_to = nil} + } +} + +dpkg_chain = { + next_chain = simple_chain, + binary = ".*", + rules = { + {path = "^/var/dpkg.*", map_to = "="}, + {path = "^/var/lib/dpkg.*", map_to = "="} + } +} + +apt_chain = { + next_chain = simple_chain, + binary = ".*apt.*", + rules = { + {path = "^" .. escape_string(target_root) .. ".*", map_to = nil}, + {path = "^/var/lib/apt.*", map_to = "="}, + {path = "^/var/cache/apt.*", map_to = "="}, + {path = "^/usr/lib/apt.*", map_to = nil}, + {path = "^/etc/apt.*", map_to = "="} + } +} + + +-- fakeroot needs this +sh_chain = { + next_chain = simple_chain, + binary = ".*sh.*", + rules = { + {path = "^/usr/lib.*la", map_to = "="}, + {path = "^/usr/lib.*", map_to = nil}, + } +} + +export_chains = { + qemu_chain, + sh_chain, + apt_chain, + simple_chain +} diff --git a/lua_scripts/pathmaps/simple/00_default.lua b/lua_scripts/pathmaps/simple/00_default.lua index 2a4bc81..c09d297 100644 --- a/lua_scripts/pathmaps/simple/00_default.lua +++ b/lua_scripts/pathmaps/simple/00_default.lua @@ -7,67 +7,13 @@ simple_chain = { binary = ".*", rules = { {path = "^/lib.*", map_to = "="}, --- /usr/share is mapped to the buildroot except these directories --- (taken from bora rootstrap contents) - {path = "^/usr/share/aclocal.*", map_to = "="}, - {path = "^/usr/share/alsa.*", map_to = "="}, - {path = "^/usr/share/applications.*", map_to = "="}, - {path = "^/usr/share/apt.*", map_to = "="}, - {path = "^/usr/share/backgrounds.*", map_to = "="}, - {path = "^/usr/share/base.files.*", map_to = "="}, - {path = "^/usr/share/bug.*", map_to = "="}, - {path = "^/usr/share/certs.*", map_to = "="}, - {path = "^/usr/share/dbus.1.*", map_to = "="}, - {path = "^/usr/share/debconf.*", map_to = "="}, ---autoscripts {path = "^/usr/share/debhelper.*", map_to = "="}, - {path = "^/usr/share/defoma.*", map_to = "="}, - {path = "^/usr/share/dict.*", map_to = "="}, - {path = "^/usr/share/dpkg.*", map_to = "="}, - {path = "^/usr/share/docbook.utils.*", map_to = nil}, - {path = "^/usr/share/doc.*", map_to = "="}, ---trippletable error if taken from target: {path = "^/usr/share/dpkg.*", map_to = "="}, - {path = "^/usr/share/fonts.*", map_to = "="}, - {path = "^/usr/share/glib.*", map_to = "="}, - {path = "^/usr/share/gnupg.*", map_to = "="}, - {path = "^/usr/share/gtk.doc/data/gtkdoc.common*", map_to = nil}, - {path = "^/usr/share/gtk.doc/data/gtk.doc.make*", map_to = nil}, - {path = "^/usr/share/gtk.doc/data/.*xsl", map_to = nil}, - {path = "^/usr/share/gtk.doc.*", map_to = "="}, ---gtk-doc.make error if taken from target: {path = "^/usr/share/gtk.*", map_to = "="}, - {path = "^/usr/share/i18n.*", map_to = "="}, - {path = "^/usr/share/icons.*", map_to = "="}, - {path = "^/usr/share/ifupdown.*", map_to = "="}, - {path = "^/usr/share/info.*", map_to = "="}, - {path = "^/usr/share/initscripts.*", map_to = "="}, - {path = "^/usr/share/lintian.*", map_to = "="}, - {path = "^/usr/share/locale.*", map_to = "="}, - {path = "^/usr/share/man.*", map_to = "="}, - {path = "^/usr/share/mime.*", map_to = "="}, ---readline {path = "^/usr/share/misc.*", map_to = "="}, - {path = "^/usr/share/osso.*", map_to = "="}, - {path = "^/usr/share/passwd.*", map_to = "="}, - {path = "^/usr/share/ppp.*", map_to = "="}, ---docbook {path = "^/usr/share/sgml.*", map_to = "="}, - {path = "^/usr/share/sounds.*", map_to = "="}, - {path = "^/usr/share/sysklogd.*", map_to = "="}, - {path = "^/usr/share/sysvinit.*", map_to = "="}, - {path = "^/usr/share/tabset.*", map_to = "="}, - {path = "^/usr/share/telepathy.*", map_to = "="}, - {path = "^/usr/share/terminfo.*", map_to = "="}, - {path = "^/usr/share/themes.*", map_to = "="}, - {path = "^/usr/share/user.icons.*", map_to = "="}, - {path = "^/usr/share/X11.*", map_to = "="}, ---docbook/stylesheet... {path = "^/usr/share/xml.*", map_to = "="}, - {path = "^/usr/share/zoneinfo.*", map_to = "="}, {path = "^/usr/bin/xml2.conf.*", map_to = "="}, ---glib-mkenums error: points to /scratchbox/tools/bin/perl {path = "^/usr/bin/glib.*", map_to = "="}, {path = "^/usr/bin/gobject.query.*", map_to = "="}, {path = "^/usr/lib/perl.*", map_to = nil}, {path = "^/usr/lib/dpkg.*", map_to = nil}, {path = "^/usr/lib/cdbs.*", map_to = nil}, {path = "^/usr/lib.*", map_to = "="}, {path = "^/usr/include.*", map_to = "="}, - {path = "^/usr/share/aclocal.*", map_to = "="}, {path = "^/var/.*/apt.*", map_to = "="}, {path = "^/var/.*/dpkg.*", map_to = "="}, {path = "^/host_usr", map_to = "="}, diff --git a/utils/sb2-init b/utils/sb2-init index 7b8b81c..8ea4497 100755 --- a/utils/sb2-init +++ b/utils/sb2-init @@ -22,6 +22,7 @@ Options: -r [hostname] generate sbrsh config using remote device address -l [hostname] NFS server/localhost address seen by remote device -d set target as default scratchbox2 target + -m mapping_mode use mapping_mode as default -h print this help -n don't build libtool for the target -s skip checks for target root's /usr/include etc. @@ -29,6 +30,7 @@ Options: Examples: sb2-init ARM arm-linux-gcc + sb2-init -m maemo ARM arm-linux-gcc sb2-init -sn -c sbrsh armel-debian /path/to/arm-linux-gcc EOF exit 2 @@ -79,6 +81,10 @@ export SBOX_HOST_GCC_DIR=/usr/bin export SBOX_HOST_GCC_LD_ARGS= export SBRSH_CONFIG=$HOME/.scratchbox2/$TARGET/sbrsh.config + +if [ -z "\$SBOX_MAPMODE" ]; then + export SBOX_MAPMODE=$MAPPING_MODE +fi EOF echo "Finished writing sb2.config" } @@ -144,7 +150,7 @@ if [ -z "$*" ]; then usage fi -while getopts c:r:l:dhnsv foo +while getopts c:r:l:m:dhnsv foo do case $foo in (c) cputransparency=$OPTARG ;; @@ -152,6 +158,7 @@ do (l) LOCALHOST=$OPTARG ;; (d) set_as_default=1 ;; (h) usage ;; + (m) MAPPING_MODE=$OPTARG ;; (n) with_libtool=0 ;; (s) skip_checks=true ;; (v) version ;; @@ -245,6 +252,16 @@ sbrsh) ;; esac +if [ -z "$MAPPING_MODE" ]; then + MAPPING_MODE="simple" +fi + +if [ ! -d $SBOX_DIR/share/scratchbox2/lua_scripts/pathmaps/$MAPPING_MODE ]; then + echo "Invalid mapping mode: $MAPPING_MODE" + exit 1 +fi + + if [ ! $skip_checks ]; then check_buildroot_sanity fi |