build: cleanup possibly dangling Python 3 host symlink
[librecmc/librecmc.git] / include / prereq.mk
index 0f0f2537448f2f314a4b923d0f3fb3f4924f4397..60f1e47c3db61d9d271ddaa3e5766e1ec757320d 100644 (file)
@@ -66,6 +66,18 @@ define RequireHeader
   $$(eval $$(call Require,$(1),$(2)))
 endef
 
+define CleanupPython3
+  define Require/python3-cleanup
+       if [ -f "$(STAGING_DIR_HOST)/bin/python" ] && \
+               $(STAGING_DIR_HOST)/bin/python -V 2>&1 | \
+               grep -q 'Python 3'; then \
+                       rm $(STAGING_DIR_HOST)/bin/python; \
+       fi
+  endef
+
+  $$(eval $$(call Require,python3-cleanup))
+endef
+
 define QuoteHostCommand
 '$(subst ','"'"',$(strip $(1)))'
 endef