Index: build
==================================================================
--- build
+++ build
@@ -176,10 +176,12 @@
 							export PKG_CONFIG_PATH
 						fi
 						;;
 				esac
 			done
+
+			break
 		done
 
 		if [ "${pkgfound}" = '0' ]; then
 			die "Package ${pkg}/${pkgversion:-*}@${pkgdomain} not found."
 		fi
@@ -237,13 +239,15 @@
 	fi
 
 	gcc_default_headers="$(echo '' | ${CPP:-cpp} -v 2>&1 | sed '/^End of search list/,$ d;0,/search starts here:$/ d' | grep '/gcc/' | sed 's@^ *@-isystem @' | tr $'\n' ' ')"
 
 	CC="${CC:-gcc} -nostdinc ${gcc_default_headers} -isystem ${glibcdir}/include"
+	CXX="${CXX:-g++} -nostdinc ${gcc_default_headers} -isystem ${glibcdir}/include"
 
 	if ! echo " ${require[*]} " | grep ' linux-headers[/@: ]' >/dev/null; then
 		CC="${CC} -isystem ${linuxheadersdir}/include"
+		CXX="${CXX} -isystem ${linuxheadersdir}/include"
 	fi
 
 	BUILD_CC="${CC}"
 	HOST_CC="${CC}"
 
@@ -271,11 +275,11 @@
 }
 
 function build() {
 	grep "DESTDIR" Makefile >/dev/null || die "Don't know how to build this software"
 
-	make
+	make "${make_extra[@]}"
 }
 
 function preinstall() {
 	:
 }