-$1_$2_USE_BOOT_LIBS = YES
-$(call package-config,$1,$2,$3)
+
+define build-package-helper
+# $1 = dir
+# $2 = distdir
+# $3 = GHC stage to use (0 == bootstrapping compiler)
+
+# We don't install things compiled by stage 0, so no need to put them
+# in the bindist.
+ifneq "$$(BINDIST) $3" "YES 0"
+
+$(call all-target,$1,all_$1_$2)
+# This give us things like
+# all_libraries: all_libraries/base_dist-install
+ifneq "$$($1_$2_GROUP)" ""
+all_$$($1_$2_GROUP): all_$1_$2
+endif
+
+ifneq "$$(CHECKED_$1)" "YES"
+CHECKED_$1 = YES
+check_packages: check_$1
+.PHONY: check_$1
+check_$1: $$(GHC_CABAL_INPLACE)
+ $$(GHC_CABAL_INPLACE) check $1
+endif
+
+# --- CONFIGURATION