summaryrefslogtreecommitdiff
path: root/redir_scripts
diff options
context:
space:
mode:
authorLauri Leukkunen <lle@rahina.org>2006-12-23 05:28:45 +0200
committerLauri Leukkunen <lleukkun@leka.rahina.org>2006-12-23 05:28:45 +0200
commit70b9560f6fb39a1bacd79c7a68e6c9b0ecebcd87 (patch)
treebef74f918ee0437165c9b1ff2afb9858b2551784 /redir_scripts
parent6dd431fdb8e5fdc780bcafe06bf451074d5cde58 (diff)
* now we're able to build glib
Diffstat (limited to 'redir_scripts')
-rw-r--r--redir_scripts/main.lua31
-rw-r--r--redir_scripts/parts/default.lua27
2 files changed, 49 insertions, 9 deletions
diff --git a/redir_scripts/main.lua b/redir_scripts/main.lua
index 9e68ed6..cccae51 100644
--- a/redir_scripts/main.lua
+++ b/redir_scripts/main.lua
@@ -1,18 +1,23 @@
-- Scratchbox2 universal redirector dynamic path translation scripts
-- Copyright (C) 2006 Lauri Leukkunen
--- print "hello!\n"
+--print "hello!\n"
tools_root = os.getenv("SBOX_TOOLS_ROOT")
-if (tools_root == nil) then
+if (not tools_root) then
tools_root = "/scratchbox/sarge"
end
target_root = os.getenv("SBOX_TARGET_ROOT")
-if (target_root == nil) then
+if (not target_root) then
target_root = "/"
end
+compiler_root = os.getenv("SBOX_COMPILER_ROOT")
+if (not compiler_root) then
+ compiler_root = "/usr"
+end
+
-- SBOX_REDIR_SCRIPTS environment variable controls where
-- we look for the scriptlets defining the path mappings
@@ -80,18 +85,26 @@ end
function sbox_map_to(binary_name, func_name, work_dir, rp, path, rule)
- ret = ""
-
+ local ret = ""
if (rule.map_to) then
if (string.sub(rule.map_to, 1, 1) == "=") then
- ret = target_root .. string.sub(rule.map_to, 2)
+ --print(string.format("rp: %s\ntarget_root: %s", rp, target_root))
+ s = string.find(rp, target_root, 1, true)
+ if (s) then
+ -- the file's already within target_root
+ return path
+ end
+ return target_root .. rp
+ elseif (string.sub(rule.map_to, 1, 1) == "+") then
+ ret = compiler_root .. string.sub(rule.map_to, 2) .. "/" .. basename(path)
+ return ret
else
ret = target_root .. rule.map_to
+ return ret .. path
end
end
- --print("mapping to: " .. ret .. path)
- return ret .. path
+ return path
end
@@ -104,7 +117,7 @@ function sbox_translate_path(binary_name, func_name, work_dir, path)
--print(string.format("debug: [%s][%s][%s][%s]", binary_name, func_name, work_dir, path))
ret = path
- rp = sb.sb_realpath(path)
+ rp = path
if (rp == "no such file") then
rp = path
diff --git a/redir_scripts/parts/default.lua b/redir_scripts/parts/default.lua
index 2339ff6..85994ee 100644
--- a/redir_scripts/parts/default.lua
+++ b/redir_scripts/parts/default.lua
@@ -9,6 +9,7 @@
--
-- "=" map to TARGETDIR .. "/" .. path
-- "=/some/path" map to TARGETDIR .. "/some/path" .. "/" .. path
+-- "+/some/path" map to COMPILERDIR .. "/some/path"
-- nil no mapping, use straight
--
-- Any other value is prepended to path (map_to .. "/" .. path).
@@ -99,6 +100,29 @@ default_scratchbox = {
custom_map_func = nil
}
+default_dev = {
+ binary = ".*",
+ func_name = ".*",
+ func_param = nil,
+ path = "^/dev",
+ map_to = nil,
+ custom_map_func = nil
+}
+
+libtool = {
+ binary = ".*",
+ func_name = "exec.*",
+ path = ".*libtool",
+ map_to = "+/arch_tools/bin"
+}
+
+qemu = {
+ binary = ".*qemu.*",
+ func_name = ".*",
+ path = "^/",
+ map_to = "="
+}
+
-- catch all rule to map everything else to TARGETDIR/
default_rootdir = {
binary = ".*",
@@ -110,10 +134,13 @@ default_rootdir = {
}
export_rules = {
+ libtool,
+ qemu,
default_bin,
default_usrbin,
default_usrlocalbin,
default_scratchbox,
+ default_dev,
default_home,
default_proc,
default_tmp,