CRUX-ARM : Home

Home :: Documentation :: Download :: Development :: Community :: Ports :: Packages :: Bugs :: Links :: About :: Donors
Replaced scp commands by wget which would be better for non account users who want...
[devtools.git] / getBuildOrder.sh
CommitLineData
258775a1
JB
1#!/bin/bash
2
3getDeps() {
4 local pkg="$1"
5 local deps="$(grep "^# Depends on:" $pkg/Pkgfile | cut -d':' -f2-)"
6 echo "${deps# *}"
7}
8
9getRecursiveDeps() {
10 local pkg="$1"
11 local deps="$(getDeps $pkg)"
12 if [ -z "$deps" ]; then
13 case $pkg in
f637bdc0 14 libgmp|libmpfr|libmpc|binutils|glibc|zlib|gcc)
258775a1
JB
15 # discard these ports
16 ;;
17 *)
18 if [ ! "$(echo $BUILD_ORDER | grep " ${pkg}")" ]; then
19 BUILD_ORDER="$BUILD_ORDER $pkg"
20 fi
21 ;;
22 esac
23 else
24 for d in ${deps[@]}; do
25 getRecursiveDeps "$d"
26 done
27 BUILD_ORDER="$BUILD_ORDER $pkg"
28 fi
29}
30
31# global var to store all final deps order
f637bdc0 32BUILD_ORDER="libgmp libmpfr libmpc binutils glibc zlib gcc"
258775a1
JB
33
34for f in *; do
35 [ ! -d "$f" ] && continue
36 case $f in
f637bdc0 37 libgmp|libmpfr|libmpc|binutils|glibc|zlib|gcc) continue ;;
258775a1
JB
38 esac
39 getRecursiveDeps "$f"
40done
41
42echo $BUILD_ORDER
43echo
44
45# End fo file