summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorjlam <jlam>2004-01-19 10:09:36 +0000
committerjlam <jlam>2004-01-19 10:09:36 +0000
commit0d0b7165e0aeff864ae29eeeb5633c9837fbb6ba (patch)
tree1debad42d9a4ee0b52f5990d44c11ed1aeb1b4bc /mk
parentccebf973384b2767503373592f7180dc7616b7c5 (diff)
downloadpkgsrc-0d0b7165e0aeff864ae29eeeb5633c9837fbb6ba.tar.gz
* Make the mangle and depot commands a bit more conservative in finding
instances of directory paths to mangle. We now check that the path is either a word by itself, or else part of likely compiler/linker options (-[ILR]). * Add a new "submangle" command that does the same thing as mangle but restricts itself to only the directory tree below the named src directory.
Diffstat (limited to 'mk')
-rw-r--r--mk/buildlink3/gen-transform.sh44
1 files changed, 39 insertions, 5 deletions
diff --git a/mk/buildlink3/gen-transform.sh b/mk/buildlink3/gen-transform.sh
index 04b221b02d2..f511d207921 100644
--- a/mk/buildlink3/gen-transform.sh
+++ b/mk/buildlink3/gen-transform.sh
@@ -1,6 +1,6 @@
#!@BUILDLINK_SHELL@
#
-# $NetBSD: gen-transform.sh,v 1.14 2004/01/19 05:11:44 jlam Exp $
+# $NetBSD: gen-transform.sh,v 1.15 2004/01/19 10:09:36 jlam Exp $
transform="@_BLNK_TRANSFORM_SEDFILE@"
untransform="@_BLNK_UNTRANSFORM_SEDFILE@"
@@ -9,6 +9,7 @@ untransform="@_BLNK_UNTRANSFORM_SEDFILE@"
# equivalents:
#
# mangle:src:dst mangles the directory "src" into "dst"
+# submangle:src:dst mangles "src/*" into "dst/*"
# rpath:src:dst translates the directory "src" into "dst"
# in rpath options
# abs-rpath removes all rpath options that try to add
@@ -46,9 +47,38 @@ gen() {
case "$action" in
transform|untransform)
@CAT@ >> $sedfile << EOF
-s|$2\([/$_sep]\)|$3\1|g
-s|$2$|$3|g
+s|^$2\([/$_sep]\)|$3\1|g
+s|^$2$|$3|g
+s|\([$_sep]\)$2\([/$_sep]\)|\1$3\2|g
+s|\([$_sep]\)$2$|\1$3|g
+EOF
+ case "$2" in
+ -*) ;;
+ *)
+ @CAT@ >> $sedfile << EOF
+s|\(-[ILR]\)$2\([/$_sep]\)|\1$3\2|g
+s|\(-[ILR]\)$2$|\1$3|g
+EOF
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ submangle)
+ case "$action" in
+ transform|untransform)
+ @CAT@ >> $sedfile << EOF
+s|^$2\(/[^/$_sep]\)|$3\1|g
+s|\([$_sep]\)$2\(/[^/$_sep]\)|\1$3\2|g
+EOF
+ case "$2" in
+ -*) ;;
+ *)
+ @CAT@ >> $sedfile << EOF
+s|\(-[ILR]\)$2\(/[^/$_sep]\)|\1$3\2|g
EOF
+ ;;
+ esac
;;
esac
;;
@@ -80,8 +110,12 @@ EOF
case "$action" in
transform|untransform)
@CAT@ >> $sedfile << EOF
-s|$2/[^/$_sep]*\(/[^$_sep]\)|$3\1|g
-s|$2/[^/$_sep]*$|$3|g
+s|^$2/[^/$_sep]*\(/[^$_sep]\)|$3\1|g
+s|^$2/[^/$_sep]*$|$3|g
+s|\([$_sep]\)$2/[^/$_sep]*\(/[^$_sep]\)|\1$3\2|g
+s|\([$_sep]\)$2/[^/$_sep]*$|\1$3|g
+s|\(-[ILR]\)$2/[^/$_sep]*\(/[^$_sep]\)|\1$3\2|g
+s|\(-[ILR]\)$2/[^/$_sep]*$|\1$3|g
EOF
;;
esac