[Abort when an addon fails to compile
Jonas Eschenburg <indyjo@gmx.de>**20080105223518] {
hunk ./debian/changelog 12
+  * Abort build when addon compilation fails
hunk ./debian/patches/00list 11
+add-strict-mode-option-to-build.io.dpatch
hunk ./debian/patches/01_fine-grained-installation.dpatch 9
---- Io-2007-12-12~/Makefile	2007-12-30 18:16:51.000000000 +0100
-+++ Io-2007-12-12/Makefile	2007-12-30 18:25:09.000000000 +0100
+--- Io-2007-12-12~/Makefile	2007-12-10 07:35:50.000000000 +0100
++++ Io-2007-12-12/Makefile	2008-01-05 22:14:03.000000000 +0100
hunk ./debian/patches/01_fine-grained-installation.dpatch 39
-@@ -129,6 +141,58 @@
+@@ -129,6 +141,61 @@
hunk ./debian/patches/01_fine-grained-installation.dpatch 64
++buildAddon:
++	./_build/binaries/io_static$(BINARY_SUFFIX) build.io -s -a $(ADDON_NAME)
++
addfile ./debian/patches/add-strict-mode-option-to-build.io.dpatch
hunk ./debian/patches/add-strict-mode-option-to-build.io.dpatch 1
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 05_addonloader.dpatch by Jonas Eschenburg <indyjo@gmx.de>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Running build.io with the -s option will cause addon building to abort.
+
+@DPATCH@
+diff -urNad a/build.io b/build.io
+--- a/build.io
++++ b/build.io
+@@ -7,11 +7,35 @@ Directory fileNamedOrNil := method(path,
+ 
+ Directory setCurrentWorkingDirectory(launchPath)
+ 
++arguments := args slice(1)
++
++strictMode := false
++addonToBuild := nil
++command := nil
++
++while(arguments isNotEmpty,
++    if(arguments at(0) == "-s") then(
++        strictMode = true
++        arguments removeFirst
++    ) elseif (arguments at(0) == "-a") then(
++        addonToBuild = arguments at(1)
++        arguments = arguments slice(2)
++    ) else(
++        command = arguments at(0)
++        break
++    )
++)
++
+ project := Project clone
+-if(args at(1) == "-a") then(
+-    project buildAddon(args at(2))
+-) elseif (args at(1)) then(
+-	project clone doString(args at(1))
+-) else (
+-	project clone build
++project setStrictMode(strictMode)
++
++if (addonToBuild isNil) then(
++    if (command isNil) then(
++        project build
++    ) else(
++        project doString(command)
++    )
++) else(
++    project buildAddon(addonToBuild)
+ )
++
+diff -urNad a/build/AddonBuilder.io b/build/AddonBuilder.io
+--- a/build/AddonBuilder.io
++++ b/build/AddonBuilder.io
+@@ -189,8 +189,14 @@ AddonBuilder := Object clone do(
+ 		module
+ 	)
+ 
+-	systemCall := method(s,
+-		if(trySystemCall(s) == 256, System exit(1))
++	systemCall := method(s, strictMode,
++		retval := trySystemCall(s)
++		if(retval == 256, System exit(1))
++		if(strictMode and retval != 0,
++			"Error while executing '#{s}': exit code was #{retval}." interpolate println
++			"Aborting because strict mode is set." println
++			System exit(1)
++		)
+ 	)
+ 
+ 	trySystemCall := method(s,
+@@ -231,7 +237,7 @@ AddonBuilder := Object clone do(
+ 		includePaths
+ 	)
+ 
+-	build := method(options,
++	build := method(options, strictMode,
+ 		writeln(("--- " .. folder name .. " ") alignLeft(79, "-"))
+ 		writeln("build.io: Entering directory `", folder path, "'")
+ 		mkdir("_build/headers")
+@@ -259,21 +265,21 @@ AddonBuilder := Object clone do(
+                                     s = s .. "_ADDON "
+                                 )
+ 				s = s .. "-c " .. ccOutFlag .. "_build/objs/" .. obj .. " source/" .. f name
+-				systemCall(s)
++				systemCall(s, strictMode)
+ 			)
+ 		)
+ 
+-		buildLib
+-		buildDynLib
++		buildLib(strictMode)
++		buildDynLib(strictMode)
+ 		if(platform == "windows", embedManifest)
+ 		writeln("build.io: Leaving directory `", folder path, "'")
+ 		writeln
+ 	)
+ 	
+-	buildLib := method(
++	buildLib := method(strictMode,
+ 		mkdir("_build/lib")
+-		systemCall(ar .. " " .. arFlags ..  "_build/lib/" .. libName .. " _build/objs/*.o")
+-                if (ranlib != nil, systemCall(ranlib .. " _build/lib/" .. libName))
++		systemCall(ar .. " " .. arFlags ..  "_build/lib/" .. libName .. " _build/objs/*.o", strictMode)
++		if (ranlib != nil, systemCall(ranlib .. " _build/lib/" .. libName, strictMode))
+ 	)
+ 
+ 	dllSuffix := method(
+@@ -296,7 +302,7 @@ AddonBuilder := Object clone do(
+             )
+         )
+ 
+-	buildDynLib := method(
++	buildDynLib := method(strictMode,
+ 		mkdir("_build/dll")
+ 
+ 		links := depends addons map(b, linkDirPathFlag .. "../" .. b .. "/_build/dll")
+@@ -323,7 +329,8 @@ AddonBuilder := Object clone do(
+ 			s := " -install_name " .. System installPrefix .. "/lib/io/addons/" .. self name .. "/_build/dll/" .. libname
+ 		)
+ 
+-		systemCall(linkdll .. " " .. cflags .. " " .. dllCommand .. " " .. s .. " " .. linkOutFlag .. "_build/dll/" .. libname .. " _build/objs/*.o" .. " " .. links join(" "))
++		command := linkdll .. " " .. cflags .. " " .. dllCommand .. " " .. s .. " " .. linkOutFlag .. "_build/dll/" .. libname .. " _build/objs/*.o" .. " " .. links join(" ")
++		systemCall(command, strictMode)
+ 	)
+ 
+ 	embedManifest := method(
+diff -urNad a/build/Project.io b/build/Project.io
+--- a/build/Project.io
++++ b/build/Project.io
+@@ -2,6 +2,7 @@ Project := Object clone do(
+ 	cc  := method(System getenv("CC")  ifNilEval(return "cc"))
+ 	cxx := method(System getenv("CXX") ifNilEval(return "g++"))
+ 	platform := System platform split at(0) asLowercase
++	newSlot("strictMode", false)
+ 
+ 	systemCall := method(s,
+ 		r := trySystemCall(s)
+@@ -31,7 +32,7 @@ Project := Object clone do(
+ 	)
+ 
+     buildAddon := method(name,
+-        addons detect(addon, addon name == name) build(options)
++        addons detect(addon, addon name == name) build(options, strictMode)
+     )
+ 
+ 	availableAddon := method(addon,
+@@ -97,7 +98,7 @@ Project := Object clone do(
+ 	buildAddons := method(
+ 		writeln("\n--- building addons ---\n")
+ 
+-		orderedAddons foreach(build(options))
++		orderedAddons foreach(build(options, strictMode))
+ 		self
+ 	)
hunk ./debian/rules 43
-	$(MAKE) addons INSTALL_PREFIX=/usr
-	touch $@
+	# 
+	# ADDONS
+	# (Addon HDB is missing because it has no build.io file and does not need to be built)
+	#
+	$(MAKE) buildAddon ADDON_NAME=AsyncRequest
+	$(MAKE) buildAddon ADDON_NAME=BigNum
+	$(MAKE) buildAddon ADDON_NAME=Blowfish
+	$(MAKE) buildAddon ADDON_NAME=Box
+	$(MAKE) buildAddon ADDON_NAME=CGI
+	$(MAKE) buildAddon ADDON_NAME=ContinuedFraction
+	$(MAKE) buildAddon ADDON_NAME=Curses
+	$(MAKE) buildAddon ADDON_NAME=DBI
+	$(MAKE) buildAddon ADDON_NAME=EditLine
+	$(MAKE) buildAddon ADDON_NAME=Flux
+	$(MAKE) buildAddon ADDON_NAME=Fnmatch
+	$(MAKE) buildAddon ADDON_NAME=Font
+	$(MAKE) buildAddon ADDON_NAME=Image
+	$(MAKE) buildAddon ADDON_NAME=Libxml2
+	$(MAKE) buildAddon ADDON_NAME=LibSndFile
+	$(MAKE) buildAddon ADDON_NAME=LZO
+	$(MAKE) buildAddon ADDON_NAME=MD5
+	$(MAKE) buildAddon ADDON_NAME=MySQL
+	$(MAKE) buildAddon ADDON_NAME=NotificationCenter
+	$(MAKE) buildAddon ADDON_NAME=OpenGL
+	$(MAKE) buildAddon ADDON_NAME=Postgres
+	$(MAKE) buildAddon ADDON_NAME=PostgreSQL
+	$(MAKE) buildAddon ADDON_NAME=Python
+	$(MAKE) buildAddon ADDON_NAME=QDBM
+	$(MAKE) buildAddon ADDON_NAME=Random
+	$(MAKE) buildAddon ADDON_NAME=Range
+	$(MAKE) buildAddon ADDON_NAME=Rational
+	$(MAKE) buildAddon ADDON_NAME=ReadLine
+	$(MAKE) buildAddon ADDON_NAME=Regex
+	$(MAKE) buildAddon ADDON_NAME=SampleRateConverter
+	$(MAKE) buildAddon ADDON_NAME=SHA1
+	$(MAKE) buildAddon ADDON_NAME=Socket
+	$(MAKE) buildAddon ADDON_NAME=SqlDatabase
+	$(MAKE) buildAddon ADDON_NAME=SQLite
+	$(MAKE) buildAddon ADDON_NAME=SQLite3
+	$(MAKE) buildAddon ADDON_NAME=SoundTouch
+	$(MAKE) buildAddon ADDON_NAME=Syslog
+	$(MAKE) buildAddon ADDON_NAME=SystemCall
+	$(MAKE) buildAddon ADDON_NAME=Thread
+	$(MAKE) buildAddon ADDON_NAME=User
+	$(MAKE) buildAddon ADDON_NAME=UUID
+	$(MAKE) buildAddon ADDON_NAME=Zlib
}
