[Lunar-commits] r18949 - lunar/trunk/var/lib/lunar/plugins

Auke Kok sofar at lunar-linux.org
Wed Mar 1 01:16:24 UTC 2006


Author: sofar
Date: 2006-03-01 01:16:18 +0000 (Wed, 01 Mar 2006)
New Revision: 18949

Added:
   lunar/trunk/var/lib/lunar/plugins/optimize-wrappers.plugin
Log:
Adding the optimization wrappers in here as a default-present system wrapper. This is needed to make wrappers work again with the latest changes.


Added: lunar/trunk/var/lib/lunar/plugins/optimize-wrappers.plugin
===================================================================
--- lunar/trunk/var/lib/lunar/plugins/optimize-wrappers.plugin	                        (rev 0)
+++ lunar/trunk/var/lib/lunar/plugins/optimize-wrappers.plugin	2006-03-01 01:16:18 UTC (rev 18949)
@@ -0,0 +1,69 @@
+#
+# wrappers linker optimizations plugin
+#
+
+plugin_wrappers_optimize()
+{
+
+	if [ -f /etc/lunar/local/optimizations.WRAPPERS ]; then
+		. /etc/lunar/local/optimizations.WRAPPERS
+	fi
+	
+	if [ "${USE_WRAPPERS:-yes}" == "yes" ]; then
+		verbose_msg "Enabled wrapper script usage"
+		export PATH=/var/lib/lunar/compilers/:${PATH}
+	fi
+	return 2
+}
+
+
+plugin_wrappers_optimize_menu()
+{
+	# The main code calls this function WITHOUT $1 to find out which
+	# compiler optimization plugins exist. It then returns the version
+	# number which will be saved in $LUNAR_COMPILER as the user's
+	# choice for COMPILERS
+	if [ -z "$1" ]; then
+		echo "WRAPPERS"
+		echo "Compiler wrappers"
+		return 2
+	elif [ "$1" != "WRAPPERS" ]; then
+		# we don't display anything when the user selected a
+		# different menu
+		return 2
+	fi
+
+	# load previous optimizations
+	if [ -e /etc/lunar/local/optimizations.WRAPPERS ]; then
+		. /etc/lunar/local/optimizations.WRAPPERS
+	fi
+
+	save_optimizations()
+	{
+		debug_msg "save_optimizations($@)"
+		cat > /etc/lunar/local/optimizations.WRAPPERS  <<EOF
+USE_WRAPPERS=$USE_WRAPPERS
+EOF
+	}
+
+	export IFS=$'\t\n'
+	TITLE="Lunar CCache Optimizations"
+	
+	while true; do
+		RESULT=`$DIALOG --cancel-label "Close" --menu "Use the Compiler wrapper scripts? This will enable all optimizations for most programs even if the Makefile doesn't support them, and allows for more debugging output." 0 0 0 "USE_WRAPPERS" "Use the compile wrappers         [$USE_WRAPPERS]"`
+		if [ $? != 0 ]; then
+			break
+		else
+			if [ $USE_WRAPPERS == 'yes' ]; then
+				USE_WRAPPERS=no
+			else
+				USE_WRAPPERS=yes
+			fi
+			save_optimizations
+		fi
+	done
+}
+
+
+plugin_register BUILD_BUILD plugin_wrappers_optimize
+plugin_register OPTIMIZE_MENU plugin_wrappers_optimize_menu



More information about the Lunar-commits mailing list