tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: wrappers and gcc -isystem



On Mon, 01 Feb 2016 11:54:01 Mark Davies wrote:
> Can someone who is sufficiently clued up about the wrapper system tell me
> how to teach it to do the same directory mapping for gcc's "-isystem dir"
> that it currently does for "-I dir" ?

Following up my own post, below are some patches that do this.
Basically arg-source converts "-isystem DIR" to "-isystem,DIR"
cmd-sync converts "-isystem,DIR" back to "-isystem DIR"
and gen-transform.sh treats "-isystem,DIR" the same way it treats
"-IDIR"

comments?

cheers
mark


Index: arg-source
===================================================================
RCS file: /src/cvs/netbsd/pkgsrc/mk/wrapper/arg-source,v
retrieving revision 1.16
diff -u -r1.16 arg-source
--- arg-source	20 Nov 2015 05:49:24 -0000	1.16
+++ arg-source	1 Feb 2016 18:51:04 -0000
@@ -61,6 +61,18 @@
 		$debug_log $wrapperlog "    (arg-source) push: $arg$nextarg"
 		;;
 	##############################################################
+	# Convert "-isystem /dir" into a single "-isystem,/dir".
+	# cmd-sync will put it back
+	##############################################################
+	-isystem)
+		nextarg="$1"; shift
+		case "$nextarg" in
+		-*) msg_log $wrapperlog "WARNING: [arg-source] An $arg option must 
not be followed by another option, $nextarg." ;;
+		esac
+		append_queue argbuf "$arg,$nextarg"
+		$debug_log $wrapperlog "    (arg-source) push: $arg,$nextarg"
+		;;
+	##############################################################
 	# Split -Wl,option1,option2 into -Wl,option1 -Wl,option2 and
 	# process them again.
 	#
Index: cmd-sink
===================================================================
RCS file: /src/cvs/netbsd/pkgsrc/mk/wrapper/cmd-sink,v
retrieving revision 1.1
diff -u -r1.1 cmd-sink
--- cmd-sink	21 Sep 2004 15:01:41 -0000	1.1
+++ cmd-sink	1 Feb 2016 18:28:55 -0000
@@ -38,5 +38,13 @@
 while ! queue_is_empty cmdbuf; do
 	pop_queue cmdbuf arg
 	$debug_log $wrapperlog "    (cmd-sink) pop: $arg"
+	case $arg in
+	-isystem,*)
+		dir="${arg#-isystem,}"
+		arg="-isystem"
+		. $buildcmd
+		arg="$dir"
+		;;
+	esac
 	. $buildcmd
 done
Index: gen-transform.sh
===================================================================
RCS file: /src/cvs/netbsd/pkgsrc/mk/wrapper/gen-transform.sh,v
retrieving revision 1.10
diff -u -r1.10 gen-transform.sh
--- gen-transform.sh	30 Dec 2014 15:13:20 -0000	1.10
+++ gen-transform.sh	1 Feb 2016 19:43:01 -0000
@@ -81,7 +81,9 @@
 		transform)
 			$debug_log $wrapperlog "   (gen-transform) $_cmd: $@"
 			gen $_action "opt:-I$1:-I$2"
+			gen $_action "opt:-isystem,$1:-isystem,$2"
 			gen $_action "opt-sub:-I$1:-I$2"
+			gen $_action "opt-sub:-isystem,$1:-isystem,$2"
 			;;
 		untransform)
 			$debug_log $wrapperlog "   (gen-transform) $_cmd: $@"
@@ -161,6 +163,7 @@
 		$debug_log $wrapperlog "   (gen-transform) $_cmd: $@"
 		#gen $_action "opt:$1:$2"
 		gen $_action "opt:-I$1:-I$2"
+		gen $_action "opt:-isystem,$1:-isystem,$2"
 		gen $_action "opt:-L$1:-L$2"
 		gen $_action "rpath-exact:$1:$2"
 		gen $_action "sub-mangle:$1:$2"
@@ -355,6 +358,7 @@
 		#gen $_action "opt-sub:$1:$2"
 		gen $_action "libpath:$1:$2"
 		gen $_action "opt-sub:-I$1:-I$2"
+		gen $_action "opt-sub:-isystem,$1:-isystem,$2"
 		gen $_action "opt-sub:-L$1:-L$2"
 		gen $_action "sub-rpath:$1:$2"
 		;;
Index: transform-gcc
===================================================================
RCS file: /src/cvs/netbsd/pkgsrc/mk/wrapper/transform-gcc,v
retrieving revision 1.29
diff -u -r1.29 transform-gcc
--- transform-gcc	31 Dec 2013 13:56:35 -0000	1.29
+++ transform-gcc	1 Feb 2016 18:44:58 -0000
@@ -52,6 +52,7 @@
 -fweb			|\
 -fwrapv			|\
 -ggdb			|\
+-isystem,*		|\
 -M			|\
 -M[DFMPT]		|\
 -MMD			|\



Home | Main Index | Thread Index | Old Index