mkbuild

mk based build system
git clone git://git.2f30.org/mkbuild
Log | Files | Refs | LICENSE

mk.fetch (682B)


      1 fetch:QV: fetch-git fetch-http
      2 
      3 fetch-git:QV:
      4 	if test x"$git" != x""; then
      5 		if test x"$branch" = x""; then
      6 			branch=master
      7 		fi
      8 		test -d $src || git clone --depth 1 -b $branch $git $src
      9 	fi
     10 
     11 fetch-http:QV:
     12 	if test x"$url" != x""; then
     13 		for u in $url; do
     14 			ok=1
     15 			if test x"$pkgsrc" = x""; then
     16 				pkgsrc=`basename $u`
     17 			fi
     18 			t=$(cat checksums | $SUM -c && echo ok || echo fail)
     19 			if test "$(echo $t | grep ok)" = ""; then
     20 				rm -f "$pkgsrc"
     21 				wget -c "$u" -O "$pkgsrc" || {
     22 					rm -f "$pkgsrc"
     23 					ok=0
     24 				}
     25 			fi
     26 			if test -e "$pkgsrc"; then
     27 				tar -xf "$pkgsrc"
     28 			fi
     29 		done
     30 		if test "$ok" -eq 0; then
     31 			echo "Package fetching failed" 1>&2
     32 			false
     33 		fi
     34 	fi