summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mk/pkg-bottom.mk2
-rwxr-xr-xscripts/tsort17
2 files changed, 18 insertions, 1 deletions
diff --git a/mk/pkg-bottom.mk b/mk/pkg-bottom.mk
index 41fecf3f2..13b49dfdd 100644
--- a/mk/pkg-bottom.mk
+++ b/mk/pkg-bottom.mk
@@ -18,7 +18,7 @@ do-configure:
post-configure:
${_CONFIGURE_COOKIE}: ${_PATCH_COOKIE}
@sed -e '/^#/d' ${REORDER_DEPENDENCIES} | \
- tsort | tac | while read f; do \
+ tsort | while read f; do \
cd ${WRKSRC}; \
case $$f in \
/*) \
diff --git a/scripts/tsort b/scripts/tsort
new file mode 100755
index 000000000..45bd2bc24
--- /dev/null
+++ b/scripts/tsort
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+# This file is part of the OpenADK project. OpenADK is copyrighted
+# material, please see the LICENCE file in the top-level directory.
+
+os=$(uname)
+case $os in
+ NetBSD|MirBSD|OpenBSD)
+ targ="-r"
+ ;;
+ *)
+ targ="|tac"
+ ;;
+esac
+if [ -x /usr/bin/tsort ];then
+ /usr/bin/tsort $targ "$@"
+fi
+